mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Eliminate hsScalar and hsFixed
Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
@ -89,9 +89,9 @@ void plDistOpacityMod::SetKey(plKey k)
|
||||
}
|
||||
|
||||
|
||||
hsScalar plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const
|
||||
float plDistOpacityMod::ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const
|
||||
{
|
||||
hsScalar dist = hsVector3(&targPos, &refPos).Magnitude();
|
||||
float dist = hsVector3(&targPos, &refPos).Magnitude();
|
||||
|
||||
if( dist > fDists[kFarTrans] )
|
||||
return 0;
|
||||
@ -129,7 +129,7 @@ void plDistOpacityMod::ISetOpacity()
|
||||
if( !fSetup )
|
||||
ISetup();
|
||||
|
||||
hsScalar opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos);
|
||||
float opacity = ICalcOpacity(GetTarget()->GetLocalToWorld().GetTranslate(), fRefPos);
|
||||
|
||||
const int num = fFadeLays.GetCount();
|
||||
int i;
|
||||
@ -209,7 +209,7 @@ void plDistOpacityMod::SetTarget(plSceneObject* so)
|
||||
fSetup = false;
|
||||
}
|
||||
|
||||
void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent)
|
||||
void plDistOpacityMod::SetFarDist(float opaque, float transparent)
|
||||
{
|
||||
fDists[kFarOpaq] = opaque;
|
||||
fDists[kFarTrans] = transparent;
|
||||
@ -217,7 +217,7 @@ void plDistOpacityMod::SetFarDist(hsScalar opaque, hsScalar transparent)
|
||||
ICheckDists();
|
||||
}
|
||||
|
||||
void plDistOpacityMod::SetNearDist(hsScalar transparent, hsScalar opaque)
|
||||
void plDistOpacityMod::SetNearDist(float transparent, float opaque)
|
||||
{
|
||||
fDists[kNearOpaq] = opaque;
|
||||
fDists[kNearTrans] = transparent;
|
||||
|
@ -77,16 +77,16 @@ protected:
|
||||
|
||||
kNumDists
|
||||
};
|
||||
hsScalar fDists[kNumDists];
|
||||
float fDists[kNumDists];
|
||||
|
||||
hsPoint3 fRefPos;
|
||||
|
||||
hsTArray<plFadeOpacityLay*> fFadeLays;
|
||||
|
||||
// We only act in response to messages.
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
hsScalar ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const;
|
||||
float ICalcOpacity(const hsPoint3& targPos, const hsPoint3& refPos) const;
|
||||
void ISetOpacity();
|
||||
|
||||
void ISetup();
|
||||
@ -116,13 +116,13 @@ public:
|
||||
|
||||
// Rules are:
|
||||
// NearTrans <= NearOpaq <= FarOpaque <= FarTrans
|
||||
void SetFarDist(hsScalar opaque, hsScalar transparent);
|
||||
void SetNearDist(hsScalar transparent, hsScalar opaque);
|
||||
void SetFarDist(float opaque, float transparent);
|
||||
void SetNearDist(float transparent, float opaque);
|
||||
|
||||
hsScalar GetFarTransparent() const { return fDists[kFarTrans]; }
|
||||
hsScalar GetNearTransparent() const { return fDists[kNearTrans]; }
|
||||
hsScalar GetFarOpaque() const { return fDists[kFarOpaq]; }
|
||||
hsScalar GetNearOpaque() const { return fDists[kNearOpaq]; }
|
||||
float GetFarTransparent() const { return fDists[kFarTrans]; }
|
||||
float GetNearTransparent() const { return fDists[kNearTrans]; }
|
||||
float GetFarOpaque() const { return fDists[kFarOpaq]; }
|
||||
float GetNearOpaque() const { return fDists[kNearOpaq]; }
|
||||
};
|
||||
|
||||
#endif // plDistOpacityMod_inc
|
||||
|
@ -48,7 +48,7 @@ plFadeOpacityLay::plFadeOpacityLay()
|
||||
: fOpScale(1.f)
|
||||
{
|
||||
fOwnedChannels |= kOpacity;
|
||||
fOpacity = TRACKED_NEW hsScalar;
|
||||
fOpacity = TRACKED_NEW float;
|
||||
}
|
||||
|
||||
plFadeOpacityLay::~plFadeOpacityLay()
|
||||
|
@ -50,7 +50,7 @@ class plFadeOpacityLay : public plLayerInterface
|
||||
{
|
||||
protected:
|
||||
|
||||
hsScalar fOpScale;
|
||||
float fOpScale;
|
||||
public:
|
||||
|
||||
plFadeOpacityLay();
|
||||
@ -64,8 +64,8 @@ public:
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
void SetOpacity(hsScalar f) { fOpScale = f; }
|
||||
hsScalar GetOpacity() const { return fOpScale; }
|
||||
void SetOpacity(float f) { fOpScale = f; }
|
||||
float GetOpacity() const { return fOpScale; }
|
||||
};
|
||||
|
||||
#endif // plFadeOpacityLay_inc
|
||||
|
@ -83,8 +83,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
hsBool plFadeOpacityMod::fLOSCheckDisabled = false;
|
||||
|
||||
const hsScalar kDefFadeUp(5.f);
|
||||
const hsScalar kDefFadeDown(1.f);
|
||||
const float kDefFadeUp(5.f);
|
||||
const float kDefFadeDown(1.f);
|
||||
|
||||
plFadeOpacityMod::plFadeOpacityMod()
|
||||
: fFadeUp(kDefFadeUp),
|
||||
@ -178,7 +178,7 @@ void plFadeOpacityMod::IOnRenderMsg(plRenderMsg* rend)
|
||||
{
|
||||
// If we've moved more than 3 feet in a frame, we'll consider this a
|
||||
// camera cut. In that case, don't fade up or down, just go there.
|
||||
const hsScalar kCutMagSquared = 3.f * 3.f;
|
||||
const float kCutMagSquared = 3.f * 3.f;
|
||||
if( hsVector3(&eyePos, &fLastEye).MagnitudeSquared() > kCutMagSquared )
|
||||
fFade = kImmediate;
|
||||
}
|
||||
@ -237,7 +237,7 @@ void plFadeOpacityMod::ICalcOpacity()
|
||||
switch( fFade )
|
||||
{
|
||||
case kFadeUp:
|
||||
fOpCurrent = (hsScalar)(t - fStart);
|
||||
fOpCurrent = (float)(t - fStart);
|
||||
if( fOpCurrent > fFadeUp )
|
||||
{
|
||||
fOpCurrent = 1.f;
|
||||
@ -249,7 +249,7 @@ void plFadeOpacityMod::ICalcOpacity()
|
||||
}
|
||||
break;
|
||||
case kFadeDown:
|
||||
fOpCurrent = (hsScalar)(t - fStart);
|
||||
fOpCurrent = (float)(t - fStart);
|
||||
if( fOpCurrent > fFadeDown )
|
||||
{
|
||||
fOpCurrent = 0.f;
|
||||
|
@ -65,8 +65,8 @@ protected:
|
||||
};
|
||||
|
||||
// Input parameters
|
||||
hsScalar fFadeUp;
|
||||
hsScalar fFadeDown;
|
||||
float fFadeUp;
|
||||
float fFadeDown;
|
||||
|
||||
// Internal fade state
|
||||
enum FadeState {
|
||||
@ -76,7 +76,7 @@ protected:
|
||||
kFadeDown = 3,
|
||||
kImmediate = 4
|
||||
};
|
||||
hsScalar fOpCurrent;
|
||||
float fOpCurrent;
|
||||
|
||||
double fStart;
|
||||
FadeState fFade;
|
||||
@ -101,7 +101,7 @@ protected:
|
||||
void ISetup(plSceneObject* so);
|
||||
|
||||
// We only act in response to messages.
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return false; }
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return false; }
|
||||
|
||||
public:
|
||||
plFadeOpacityMod();
|
||||
@ -123,11 +123,11 @@ public:
|
||||
void FadeDown();
|
||||
void Fade(hsBool up) { if( up ) FadeUp(); else FadeDown(); }
|
||||
|
||||
void SetFadeUp(hsScalar f) { fFadeUp = f; }
|
||||
hsScalar GetFadeUp() const { return fFadeUp; }
|
||||
void SetFadeUp(float f) { fFadeUp = f; }
|
||||
float GetFadeUp() const { return fFadeUp; }
|
||||
|
||||
void SetFadeDown(hsScalar f) { fFadeDown = f; }
|
||||
hsScalar GetFadeDown() const { return fFadeDown; }
|
||||
void SetFadeDown(float f) { fFadeDown = f; }
|
||||
float GetFadeDown() const { return fFadeDown; }
|
||||
|
||||
static hsBool GetLOSCheckDisabled() { return fLOSCheckDisabled; }
|
||||
static void SetLOSCheckDisabled(hsBool on) { fLOSCheckDisabled = on; }
|
||||
|
@ -115,7 +115,7 @@ hsBool plLayerAVI::IInit()
|
||||
ISetSize(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight);
|
||||
|
||||
int32_t endFrame = fAVIInfo->fAVIStreamInfo.dwLength-1;
|
||||
hsScalar length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale)
|
||||
float length = float(endFrame) * float(fAVIInfo->fAVIStreamInfo.dwScale)
|
||||
/ float(fAVIInfo->fAVIStreamInfo.dwRate);
|
||||
ISetLength(length);
|
||||
#endif
|
||||
@ -123,7 +123,7 @@ hsBool plLayerAVI::IInit()
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t plLayerAVI::ISecsToFrame(hsScalar secs)
|
||||
int32_t plLayerAVI::ISecsToFrame(float secs)
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
float timeScale = float(fAVIInfo->fAVIStreamInfo.dwRate) / float(fAVIInfo->fAVIStreamInfo.dwScale);
|
||||
|
@ -55,7 +55,7 @@ protected:
|
||||
|
||||
hsBool ICloseMovie();
|
||||
|
||||
virtual int32_t ISecsToFrame(hsScalar secs);
|
||||
virtual int32_t ISecsToFrame(float secs);
|
||||
virtual hsBool IInit();
|
||||
virtual hsBool IGetCurrentFrame();
|
||||
virtual hsBool IRelease();
|
||||
|
@ -82,7 +82,7 @@ hsBool plLayerMovie::ISetFault(const char* errStr)
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plLayerMovie::ISetLength(hsScalar secs)
|
||||
hsBool plLayerMovie::ISetLength(float secs)
|
||||
{
|
||||
fLength = secs;
|
||||
return false;
|
||||
@ -142,7 +142,7 @@ hsBool plLayerMovie::IMovieIsIdle()
|
||||
|
||||
hsBool plLayerMovie::ICurrentFrameDirty(double wSecs)
|
||||
{
|
||||
hsScalar secs = fTimeConvert.WorldToAnimTime(wSecs);
|
||||
float secs = fTimeConvert.WorldToAnimTime(wSecs);
|
||||
uint32_t frame = ISecsToFrame(secs);
|
||||
if( frame == fCurrentFrame )
|
||||
return false;
|
||||
|
@ -58,10 +58,10 @@ protected:
|
||||
// plAnimTimeConvert fTimeConvert;
|
||||
|
||||
int32_t fCurrentFrame;
|
||||
hsScalar fLength;
|
||||
float fLength;
|
||||
uint32_t fWidth, fHeight;
|
||||
|
||||
virtual int32_t ISecsToFrame(hsScalar secs) = 0;
|
||||
virtual int32_t ISecsToFrame(float secs) = 0;
|
||||
|
||||
hsBool IGetFault() const { return !(fMovieName && *fMovieName); }
|
||||
hsBool ISetFault(const char* errStr);
|
||||
@ -69,7 +69,7 @@ protected:
|
||||
hsBool IMovieIsIdle(); // will call IRelease();
|
||||
hsBool ISetupBitmap();
|
||||
hsBool ISetSize(int w, int h);
|
||||
hsBool ISetLength(hsScalar secs);
|
||||
hsBool ISetLength(float secs);
|
||||
hsBool ICurrentFrameDirty(double wSecs);
|
||||
|
||||
virtual hsBool IInit() = 0; // Load header etc, must call ISetSize(w, h), ISetLength(s)
|
||||
@ -97,7 +97,7 @@ public:
|
||||
// Movie specific
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
hsScalar GetLength() const { return fLength; }
|
||||
float GetLength() const { return fLength; }
|
||||
|
||||
virtual void DefaultMovie();
|
||||
};
|
||||
|
Reference in New Issue
Block a user