mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-21 12:49:10 +00:00
Use standard (f)abs functions
This commit is contained in:
@ -133,7 +133,6 @@ typedef uint32_t hsGSeedValue;
|
||||
|
||||
#define hsLongAlign(n) (((n) + 3) & ~3L)
|
||||
|
||||
#define hsABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define hsSGN(x) (((x) < 0) ? -1 : ( ((x) > 0) ? 1 : 0 ))
|
||||
|
||||
#define hsBitTst2Bool(value, mask) (((value) & (mask)) != 0)
|
||||
|
@ -81,7 +81,7 @@ hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) const
|
||||
hsQuat qVec(v->fX, v->fY, v->fZ, 0);
|
||||
hsQuat t = qInv * qVec;
|
||||
hsQuat res = (t * (*this));
|
||||
//hsAssert(hsABS(res.fW)<1e-5, "Error rotating vector");
|
||||
//hsAssert(fabs(res.fW)<1e-5, "Error rotating vector");
|
||||
return hsPoint3(res.fX, res.fY, res.fZ);
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
|
||||
if (distToGoal <= 5.0f && distToGoal > 0.1f)
|
||||
{
|
||||
float mult = (distToGoal - 5.0f)*0.1f;
|
||||
adjMaxVel = fVelocity - hsABS(fVelocity*mult);
|
||||
adjMaxVel = fVelocity - fabs(fVelocity*mult);
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime)
|
||||
if (distToGoal <= 5.0f && distToGoal > 0.1f)
|
||||
{
|
||||
float mult = (distToGoal - 5.0f)*0.1f;
|
||||
adjMaxVel = fPOAVelocity - hsABS(fPOAVelocity*mult);
|
||||
adjMaxVel = fPOAVelocity - fabs(fPOAVelocity*mult);
|
||||
}
|
||||
|
||||
|
||||
@ -483,7 +483,7 @@ bool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float d
|
||||
float avgSpeed = curSpeed * .5f;
|
||||
float stopDist = avgSpeed * stopTime;
|
||||
|
||||
return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed?
|
||||
return (fabs(distToGoal) <= fabs(stopDist)); // stopDist+avgSpeed?
|
||||
}
|
||||
|
||||
//
|
||||
@ -560,7 +560,7 @@ float plCameraBrain1::IMakeFOVwZoom(float fovH) const
|
||||
{
|
||||
float num = tan(hsDegreesToRadians(fovH / 2)) * tan(hsDegreesToRadians(fCamera->GetFOVw() / 2));
|
||||
float denom = tan(hsDegreesToRadians(fCamera->GetFOVh() / 2));
|
||||
return 2 * hsABS(hsRadiansToDegrees(atan(num / denom)));
|
||||
return 2 * fabs(hsRadiansToDegrees(atan(num / denom)));
|
||||
}
|
||||
|
||||
bool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
@ -1689,7 +1689,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
|
||||
if (fCurRad != fGoalRad)
|
||||
{
|
||||
float dist = hsABS(fGoalRad-fCurRad);
|
||||
float dist = fabs(fGoalRad-fCurRad);
|
||||
|
||||
hsAssert(dist>=0 && dist<=kTwoPI, "illegal radian diff");
|
||||
bool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap
|
||||
|
@ -198,7 +198,7 @@ bool plCameraModifier1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
double time = (double)fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fAccel;
|
||||
double time2 = (double)pEventMsg->fEventTime;
|
||||
time = hsABS(time - time2);
|
||||
time = fabs(time - time2);
|
||||
float h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh;
|
||||
float w = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVw;
|
||||
if (GetBrain())
|
||||
|
@ -1949,7 +1949,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
|
||||
pBrain->SetCamera(fTransitionCamera);
|
||||
|
||||
// deal with FOV -
|
||||
float diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh());
|
||||
float diffH = fabs(pCam->GetFOVh() - fPrevCam->GetFOVh());
|
||||
if ( diffH )
|
||||
{
|
||||
double time = 0;
|
||||
|
@ -134,7 +134,7 @@ void plSynchedObject::IAppendSynchedValueFriend(plSynchedValueBase* v)
|
||||
uint8_t plSynchedObject::RegisterSynchedValue(plSynchedValueBase* v)
|
||||
{
|
||||
int32_t addrOff = ((int32_t)v - (int32_t)this)>>2;
|
||||
hsAssert(hsABS(addrOff) < (uint32_t)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow");
|
||||
hsAssert(abs(addrOff) < (uint32_t)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow");
|
||||
IAppendSynchedValueAddrOffset((AddrOffsetType)addrOff);
|
||||
int32_t idx = fNumSynchedValues-1;
|
||||
hsAssert(idx<256, "index too big");
|
||||
|
@ -87,7 +87,7 @@ protected:
|
||||
// is set to his address so we can automatically get at it during construction.
|
||||
fFlags=0;
|
||||
int32_t off = (int32_t)plSynchedObject::GetStaticSynchedObject() - (int32_t)this;
|
||||
if ( hsABS(off) < (1<<(sizeof(fSynchedObjectAddrOffset)<<3)) )
|
||||
if ( abs(off) < (1<<(sizeof(fSynchedObjectAddrOffset)<<3)) )
|
||||
fSynchedObjectAddrOffset = (int16_t)off;
|
||||
else
|
||||
fSynchedObjectAddrOffset=-1;
|
||||
|
@ -622,7 +622,7 @@ float QuatAngleDiff(const hsQuat &a, const hsQuat &b)
|
||||
|
||||
// Calling acos on 1.0 is returning an undefined value. Need to check for it.
|
||||
float epsilon = 0.00001;
|
||||
if (hsABS(cos_t - 1.f) < epsilon)
|
||||
if (fabs(cos_t - 1.f) < epsilon)
|
||||
return 0;
|
||||
|
||||
theta = acos(cos_t);
|
||||
|
@ -284,7 +284,7 @@ void plAnimatedMovementStrategy::RecalcVelocity(double timeNow, float elapsed, b
|
||||
|
||||
// Update controller rotation
|
||||
float zRot = fAnimAngularVel + fTurnStr;
|
||||
if (hsABS(zRot) > 0.0001f)
|
||||
if (fabs(zRot) > 0.0001f)
|
||||
fController->IncrementAngle(zRot * elapsed);
|
||||
|
||||
// Update controller velocity
|
||||
@ -396,7 +396,7 @@ void plWalkingStrategy::Apply(float delSecs)
|
||||
hsVector3 achievedVelocity = fController->GetAchievedLinearVelocity();
|
||||
|
||||
// Add in gravity if the avatar's z velocity isn't being set explicitly
|
||||
if (hsABS(velocity.fZ) < 0.001f)
|
||||
if (fabs(velocity.fZ) < 0.001f)
|
||||
{
|
||||
// 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.
|
||||
@ -625,7 +625,7 @@ void plSwimStrategy::Apply(float delSecs)
|
||||
hsVector3 linCurrent(0.0f, 0.0f, 0.0f);
|
||||
fCurrentRegion->GetCurrent(fController, linCurrent, angCurrent, delSecs);
|
||||
|
||||
if (hsABS(angCurrent) > 0.0001f)
|
||||
if (fabs(angCurrent) > 0.0001f)
|
||||
fController->IncrementAngle(angCurrent * delSecs);
|
||||
|
||||
velocity += linCurrent;
|
||||
@ -710,7 +710,7 @@ void plDynamicWalkingStrategy::Apply(float delSecs)
|
||||
hsVector3 achievedVelocity = fController->GetAchievedLinearVelocity();
|
||||
|
||||
// Add in gravity if the avatar's z velocity isn't being set explicitly
|
||||
if (hsABS(velocity.fZ) < 0.001f)
|
||||
if (fabs(velocity.fZ) < 0.001f)
|
||||
{
|
||||
// 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.
|
||||
|
@ -849,17 +849,17 @@ bool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg )
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos)
|
||||
{
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
}
|
||||
else
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangeNeg)
|
||||
{
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
}
|
||||
pCmd->fPct = pct;
|
||||
if (pct == 1.0f || pct == -1.0f)
|
||||
@ -960,17 +960,17 @@ bool plAvatarInputInterface::InterpretInputEvent( plInputEventMsg *pMsg )
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangePos)
|
||||
{
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
}
|
||||
else
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagRangeNeg)
|
||||
{
|
||||
if (mouseMap->fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (mouseMap->fMap[i]->fBox.fY - mouseMap->fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((mouseMap->fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
pct = fabs((mouseMap->fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (mouseMap->fMap[i]->fBox.fW - mouseMap->fMap[i]->fBox.fZ));
|
||||
}
|
||||
pCmd->fPct = pct;
|
||||
if (pct == 1.0f || pct == -1.0f)
|
||||
|
@ -245,17 +245,17 @@ bool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg )
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos)
|
||||
{
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
}
|
||||
else
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangeNeg)
|
||||
{
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
}
|
||||
pCmd->fPct = pct;
|
||||
if (pct == 1.0f || pct == -1.0f)
|
||||
@ -320,17 +320,17 @@ bool plDebugInputInterface::InterpretInputEvent( plInputEventMsg *pMsg )
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangePos)
|
||||
{
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fX - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fZ - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
}
|
||||
else
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagRangeNeg)
|
||||
{
|
||||
if (fMouseMap.fMap[i]->fControlFlags & kControlFlagXAxisEvent)
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fY - pMouseMsg->GetXPos()) / (fMouseMap.fMap[i]->fBox.fY - fMouseMap.fMap[i]->fBox.fX));
|
||||
else
|
||||
pct = hsABS((fMouseMap.fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
pct = fabs((fMouseMap.fMap[i]->fBox.fW - pMouseMsg->GetYPos()) / (fMouseMap.fMap[i]->fBox.fW - fMouseMap.fMap[i]->fBox.fZ));
|
||||
}
|
||||
pCmd->fPct = pct;
|
||||
if (pct == 1.0f || pct == -1.0f)
|
||||
|
@ -413,7 +413,7 @@ bool plSceneInputInterface::MsgReceive( plMessage *msg )
|
||||
return true;
|
||||
}
|
||||
|
||||
if (hsABS(avPt.fZ - objPt.fZ) > 1.0f) // you need to also be in the same plane (some books are on top of rocks you need to jump onto)
|
||||
if (fabs(avPt.fZ - objPt.fZ) > 1.0f) // you need to also be in the same plane (some books are on top of rocks you need to jump onto)
|
||||
{
|
||||
ResetClickableState();
|
||||
return true;
|
||||
|
@ -61,9 +61,9 @@ void hsPoint3Key::Write(hsStream *stream)
|
||||
|
||||
bool hsPoint3Key::CompareValue(hsPoint3Key *key)
|
||||
{
|
||||
return hsABS(fValue.fX - key->fValue.fX) < .01 &&
|
||||
hsABS(fValue.fY - key->fValue.fY) < .01 &&
|
||||
hsABS(fValue.fZ - key->fValue.fZ) < .01;
|
||||
return fabs(fValue.fX - key->fValue.fX) < .01 &&
|
||||
fabs(fValue.fY - key->fValue.fY) < .01 &&
|
||||
fabs(fValue.fZ - key->fValue.fZ) < .01;
|
||||
}
|
||||
|
||||
void hsBezPoint3Key::Read(hsStream *stream)
|
||||
@ -84,9 +84,9 @@ void hsBezPoint3Key::Write(hsStream *stream)
|
||||
|
||||
bool hsBezPoint3Key::CompareValue(hsBezPoint3Key *key)
|
||||
{
|
||||
return hsABS(fValue.fX - key->fValue.fX) < .01 &&
|
||||
hsABS(fValue.fY - key->fValue.fY) < .01 &&
|
||||
hsABS(fValue.fZ - key->fValue.fZ) < .01;
|
||||
return fabs(fValue.fX - key->fValue.fX) < .01 &&
|
||||
fabs(fValue.fY - key->fValue.fY) < .01 &&
|
||||
fabs(fValue.fZ - key->fValue.fZ) < .01;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
@ -179,21 +179,21 @@ void hsCompressedQuatKey32::SetQuat(hsQuat &q)
|
||||
{
|
||||
q.Normalize();
|
||||
uint32_t maxElement = kCompQuatNukeX;
|
||||
float maxVal = hsABS(q.fX);
|
||||
if (hsABS(q.fY) > maxVal)
|
||||
float maxVal = fabs(q.fX);
|
||||
if (fabs(q.fY) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeY;
|
||||
maxVal = hsABS(q.fY);
|
||||
maxVal = fabs(q.fY);
|
||||
}
|
||||
if (hsABS(q.fZ) > maxVal)
|
||||
if (fabs(q.fZ) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeZ;
|
||||
maxVal = hsABS(q.fZ);
|
||||
maxVal = fabs(q.fZ);
|
||||
}
|
||||
if (hsABS(q.fW) > maxVal)
|
||||
if (fabs(q.fW) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeW;
|
||||
maxVal = hsABS(q.fW);
|
||||
maxVal = fabs(q.fW);
|
||||
}
|
||||
switch (maxElement)
|
||||
{
|
||||
@ -322,21 +322,21 @@ void hsCompressedQuatKey64::SetQuat(hsQuat &q)
|
||||
{
|
||||
q.Normalize();
|
||||
uint32_t maxElement = kCompQuatNukeX;
|
||||
float maxVal = hsABS(q.fX);
|
||||
if (hsABS(q.fY) > maxVal)
|
||||
float maxVal = fabs(q.fX);
|
||||
if (fabs(q.fY) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeY;
|
||||
maxVal = hsABS(q.fY);
|
||||
maxVal = fabs(q.fY);
|
||||
}
|
||||
if (hsABS(q.fZ) > maxVal)
|
||||
if (fabs(q.fZ) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeZ;
|
||||
maxVal = hsABS(q.fZ);
|
||||
maxVal = fabs(q.fZ);
|
||||
}
|
||||
if (hsABS(q.fW) > maxVal)
|
||||
if (fabs(q.fW) > maxVal)
|
||||
{
|
||||
maxElement = kCompQuatNukeW;
|
||||
maxVal = hsABS(q.fW);
|
||||
maxVal = fabs(q.fW);
|
||||
}
|
||||
switch (maxElement)
|
||||
{
|
||||
|
@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
*==LICENSE==*/
|
||||
#include <cfloat>
|
||||
#include <type_traits>
|
||||
#include "hsStream.h"
|
||||
#include "hsTimer.h"
|
||||
#include "plSDL.h"
|
||||
@ -2110,10 +2111,24 @@ void plSimpleStateVariable::CopyData(const plSimpleStateVariable* other, uint32_
|
||||
// send notification msg if necessary, called internally
|
||||
//
|
||||
|
||||
template <typename _T>
|
||||
typename std::enable_if<std::is_floating_point<_T>::value, _T>::type
|
||||
_generic_abs(_T value)
|
||||
{
|
||||
return fabs(value);
|
||||
}
|
||||
|
||||
template <typename _T>
|
||||
typename std::enable_if<std::is_integral<_T>::value, _T>::type
|
||||
_generic_abs(_T value)
|
||||
{
|
||||
return abs(value);
|
||||
}
|
||||
|
||||
#define NOTIFY_CHECK(type, var) \
|
||||
case type: \
|
||||
for(i=0;i<cnt;i++) \
|
||||
if (hsABS(var[i] - other->var[i])>d) \
|
||||
if (_generic_abs(var[i] - other->var[i]) > d) \
|
||||
{ \
|
||||
notify=true; \
|
||||
break; \
|
||||
|
Reference in New Issue
Block a user