mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Eliminate hsScalar and hsFixed
Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
@ -73,12 +73,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plNetClient/plNetClientMgr.h"
|
||||
|
||||
hsBool plCameraBrain1_FirstPerson::fDontFade = false;
|
||||
hsScalar plCameraBrain1::fFallAccel = 20.0f;
|
||||
hsScalar plCameraBrain1::fFallDecel = 5.0f;
|
||||
hsScalar plCameraBrain1::fFallVelocity = 50.0f;
|
||||
hsScalar plCameraBrain1::fFallPOAAccel = 10.0f;
|
||||
hsScalar plCameraBrain1::fFallPOADecel = 10.0f;
|
||||
hsScalar plCameraBrain1::fFallPOAVelocity = 50.0f;
|
||||
float plCameraBrain1::fFallAccel = 20.0f;
|
||||
float plCameraBrain1::fFallDecel = 5.0f;
|
||||
float plCameraBrain1::fFallVelocity = 50.0f;
|
||||
float plCameraBrain1::fFallPOAAccel = 10.0f;
|
||||
float plCameraBrain1::fFallPOADecel = 10.0f;
|
||||
float plCameraBrain1::fFallPOAVelocity = 50.0f;
|
||||
|
||||
// basic camera brain now is a fixed brain by default.
|
||||
// if it doesn't have a subject (an object) it will just look straight ahead.
|
||||
@ -176,13 +176,13 @@ void plCameraBrain1::Pop()
|
||||
}
|
||||
|
||||
// set the goal to which we want to animate the fov
|
||||
void plCameraBrain1::SetFOVGoal(hsScalar h, double t)
|
||||
void plCameraBrain1::SetFOVGoal(float h, double t)
|
||||
{
|
||||
if (fFOVGoal == h || h == fCamera->GetFOVh())
|
||||
return;
|
||||
|
||||
hsScalar dif = h - fCamera->GetFOVh();
|
||||
fFOVAnimRate = dif / ((hsScalar)t);
|
||||
float dif = h - fCamera->GetFOVh();
|
||||
fFOVAnimRate = dif / ((float)t);
|
||||
|
||||
fFOVGoal = h;
|
||||
fFOVStartTime = hsTimer::GetSysSeconds();
|
||||
@ -192,7 +192,7 @@ void plCameraBrain1::SetFOVGoal(hsScalar h, double t)
|
||||
}
|
||||
|
||||
// set parameters for how this camera zooms FOV based on user input (mostly for telescopes)
|
||||
void plCameraBrain1::SetZoomParams(hsScalar max, hsScalar min, hsScalar rate)
|
||||
void plCameraBrain1::SetZoomParams(float max, float min, float rate)
|
||||
{
|
||||
fZoomRate = rate;
|
||||
fZoomMax = max;
|
||||
@ -240,7 +240,7 @@ void plCameraBrain1::Update(hsBool forced)
|
||||
// adjust FOV based on elapsed time
|
||||
void plCameraBrain1::IAnimateFOV(double time)
|
||||
{
|
||||
hsScalar dH = fFOVAnimRate * hsTimer::GetDelSysSeconds();
|
||||
float dH = fFOVAnimRate * hsTimer::GetDelSysSeconds();
|
||||
|
||||
dH += fCamera->GetFOVh();
|
||||
|
||||
@ -251,7 +251,7 @@ void plCameraBrain1::IAnimateFOV(double time)
|
||||
dH = fFOVGoal;
|
||||
}
|
||||
|
||||
fCamera->SetFOVw( (hsScalar)(dH * plVirtualCam1::Instance()->GetAspectRatio()) );
|
||||
fCamera->SetFOVw( (float)(dH * plVirtualCam1::Instance()->GetAspectRatio()) );
|
||||
fCamera->SetFOVh( dH );
|
||||
|
||||
}
|
||||
@ -274,13 +274,13 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
|
||||
return;
|
||||
}
|
||||
hsVector3 dir(fGoal - fCamera->GetTargetPos());
|
||||
hsScalar distToGoal=dir.Magnitude();
|
||||
float distToGoal=dir.Magnitude();
|
||||
|
||||
//smooth out stoppage...
|
||||
hsScalar adjMaxVel = fVelocity;
|
||||
float adjMaxVel = fVelocity;
|
||||
if (distToGoal <= 5.0f && distToGoal > 0.1f)
|
||||
{
|
||||
hsScalar mult = (distToGoal - 5.0f)*0.1f;
|
||||
float mult = (distToGoal - 5.0f)*0.1f;
|
||||
adjMaxVel = fVelocity - hsABS(fVelocity*mult);
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ void plCameraBrain1::IMoveTowardGoal(double elapsedTime)
|
||||
|
||||
fCurCamSpeed = vel.Magnitude();
|
||||
|
||||
hsScalar distMoved;
|
||||
float distMoved;
|
||||
if (fFlags.IsBitSet(kPanicVelocity))
|
||||
distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime);
|
||||
else
|
||||
@ -350,16 +350,16 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime)
|
||||
|
||||
|
||||
hsVector3 dir(fPOAGoal - fCamera->GetTargetPOA());
|
||||
hsScalar distToGoal=dir.Magnitude();
|
||||
float distToGoal=dir.Magnitude();
|
||||
|
||||
if (distToGoal > 0.0f)
|
||||
dir.Normalize();
|
||||
|
||||
// smooth out stoppage
|
||||
hsScalar adjMaxVel = fPOAVelocity;
|
||||
float adjMaxVel = fPOAVelocity;
|
||||
if (distToGoal <= 5.0f && distToGoal > 0.1f)
|
||||
{
|
||||
hsScalar mult = (distToGoal - 5.0f)*0.1f;
|
||||
float mult = (distToGoal - 5.0f)*0.1f;
|
||||
adjMaxVel = fPOAVelocity - hsABS(fPOAVelocity*mult);
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime)
|
||||
|
||||
fCurViewSpeed = vel.Magnitude();
|
||||
|
||||
hsScalar distMoved;
|
||||
float distMoved;
|
||||
if (fFlags.IsBitSet(kPanicVelocity))
|
||||
distMoved = IClampVelocity(&vel, 1000.0f, elapsedTime);
|
||||
else
|
||||
@ -402,15 +402,15 @@ void plCameraBrain1::IPointTowardGoal(double elapsedTime)
|
||||
}
|
||||
|
||||
|
||||
void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate,
|
||||
hsVector3* dir, hsVector3* vel, hsScalar maxSpeed,
|
||||
hsScalar distToGoal, double elapsedTime)
|
||||
void plCameraBrain1::IAdjustVelocity(float adjAccelRate, float adjDecelRate,
|
||||
hsVector3* dir, hsVector3* vel, float maxSpeed,
|
||||
float distToGoal, double elapsedTime)
|
||||
{
|
||||
hsScalar speed = vel->Magnitude(); // save current speed
|
||||
float speed = vel->Magnitude(); // save current speed
|
||||
*vel = *dir * speed; // change vel to correct dir
|
||||
|
||||
// compute accel/decel
|
||||
hsScalar finalAccelRate;
|
||||
float finalAccelRate;
|
||||
|
||||
if (IShouldDecelerate(adjDecelRate, speed, distToGoal))
|
||||
{
|
||||
@ -425,7 +425,7 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat
|
||||
{
|
||||
// compute accel vector in the direction of the goal
|
||||
hsVector3 accelVec = *dir * finalAccelRate;
|
||||
accelVec = accelVec * (hsScalar)elapsedTime;
|
||||
accelVec = accelVec * (float)elapsedTime;
|
||||
|
||||
// add acceleration to velocity
|
||||
*vel = *vel + accelVec;
|
||||
@ -436,13 +436,13 @@ void plCameraBrain1::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRat
|
||||
}
|
||||
}
|
||||
|
||||
hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime)
|
||||
float plCameraBrain1::IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime)
|
||||
{
|
||||
*vel = *vel * (hsScalar)elapsedTime;
|
||||
maxSpeed *= (hsScalar)elapsedTime;
|
||||
*vel = *vel * (float)elapsedTime;
|
||||
maxSpeed *= (float)elapsedTime;
|
||||
|
||||
// clamp speed (clamp if going negative?)
|
||||
hsScalar distMoved = vel->Magnitude();
|
||||
float distMoved = vel->Magnitude();
|
||||
if (distMoved > maxSpeed)
|
||||
{
|
||||
vel->Normalize();
|
||||
@ -452,16 +452,16 @@ hsScalar plCameraBrain1::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, doubl
|
||||
return distMoved;
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal)
|
||||
hsBool plCameraBrain1::IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal)
|
||||
{
|
||||
if (decelSpeed == 0)
|
||||
// no deceleration
|
||||
return false;
|
||||
|
||||
// compute distance required to stop, given decel speed (in units/sec sq)
|
||||
hsScalar stopTime = curSpeed / decelSpeed;
|
||||
hsScalar avgSpeed = curSpeed * .5f;
|
||||
hsScalar stopDist = avgSpeed * stopTime;
|
||||
float stopTime = curSpeed / decelSpeed;
|
||||
float avgSpeed = curSpeed * .5f;
|
||||
float stopDist = avgSpeed * stopTime;
|
||||
|
||||
return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed?
|
||||
}
|
||||
@ -476,7 +476,7 @@ void plCameraBrain1::AdjustForInput(double secs)
|
||||
if (fOffsetPct < 1.0f)
|
||||
{
|
||||
hsVector3 v(fPOAGoal - fGoal);
|
||||
hsScalar len = v.Magnitude();
|
||||
float len = v.Magnitude();
|
||||
len = len - (len * fOffsetPct);
|
||||
v.Normalize();
|
||||
fGoal = fGoal + (v * len);
|
||||
@ -710,10 +710,10 @@ void plCameraBrain1::SetSubject(plSceneObject* sub)
|
||||
//
|
||||
|
||||
|
||||
hsScalar plCameraBrain1_Drive::fTurnRate = 100.0f;
|
||||
hsScalar plCameraBrain1_Drive::fAcceleration = 200.0f;
|
||||
hsScalar plCameraBrain1_Drive::fDeceleration = 200.0f;
|
||||
hsScalar plCameraBrain1_Drive::fMaxVelocity = 100.0f;
|
||||
float plCameraBrain1_Drive::fTurnRate = 100.0f;
|
||||
float plCameraBrain1_Drive::fAcceleration = 200.0f;
|
||||
float plCameraBrain1_Drive::fDeceleration = 200.0f;
|
||||
float plCameraBrain1_Drive::fMaxVelocity = 100.0f;
|
||||
|
||||
|
||||
// constructor
|
||||
@ -764,7 +764,7 @@ void plCameraBrain1_Drive::Update(hsBool forced)
|
||||
|
||||
// update our desired position:
|
||||
double time = hsTimer::GetSeconds();
|
||||
hsScalar eTime = (hsScalar)(time-fLastTime);
|
||||
float eTime = (float)(time-fLastTime);
|
||||
if(eTime > 0.01f)
|
||||
eTime = 0.01f;
|
||||
fLastTime = time;
|
||||
@ -772,7 +772,7 @@ void plCameraBrain1_Drive::Update(hsBool forced)
|
||||
hsVector3 view, up, right;
|
||||
|
||||
fTargetMatrix.GetAxis(&view,&up,&right);
|
||||
hsScalar delta = 5.0f * eTime;
|
||||
float delta = 5.0f * eTime;
|
||||
|
||||
// adjust speed
|
||||
if (HasMovementFlag(B_CAMERA_DRIVE_SPEED_UP))
|
||||
@ -805,8 +805,8 @@ void plCameraBrain1_Drive::Update(hsBool forced)
|
||||
fMaxVelocity = plVirtualCam1::Instance()->fVel;
|
||||
}
|
||||
|
||||
hsScalar speed = fMaxVelocity;
|
||||
hsScalar turn = 1.0f;
|
||||
float speed = fMaxVelocity;
|
||||
float turn = 1.0f;
|
||||
|
||||
if (HasMovementFlag(B_CONTROL_MODIFIER_FAST))
|
||||
{
|
||||
@ -1583,7 +1583,7 @@ hsBool plCameraBrain1_Fixed::MsgReceive(plMessage* msg)
|
||||
//
|
||||
//
|
||||
// circle camera crap
|
||||
static const hsScalar kTwoPI = 2.0f*hsScalarPI;
|
||||
static const float kTwoPI = 2.0f*M_PI;
|
||||
|
||||
plCameraBrain1_Circle::plCameraBrain1_Circle() : plCameraBrain1_Fixed()
|
||||
{
|
||||
@ -1656,17 +1656,17 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
|
||||
if (fCurRad != fGoalRad)
|
||||
{
|
||||
hsScalar dist = hsABS(fGoalRad-fCurRad);
|
||||
float dist = hsABS(fGoalRad-fCurRad);
|
||||
|
||||
hsAssert(dist>=0 && dist<=kTwoPI, "illegal radian diff");
|
||||
hsBool mustWrap = (dist > hsScalarPI); // go opposite direction for shortcut and wrap
|
||||
hsBool mustWrap = (dist > M_PI); // go opposite direction for shortcut and wrap
|
||||
|
||||
// compute speed
|
||||
hsScalar speed;
|
||||
float speed;
|
||||
if (warp)
|
||||
speed = (hsScalar)(kTwoPI * 100 * secs);
|
||||
speed = (float)(kTwoPI * 100 * secs);
|
||||
else
|
||||
speed = (hsScalar)(kTwoPI * fCirPerSec * secs);
|
||||
speed = (float)(kTwoPI * fCirPerSec * secs);
|
||||
|
||||
// move towards goalRad
|
||||
hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value");
|
||||
@ -1717,7 +1717,7 @@ hsPoint3 plCameraBrain1_Circle::MoveTowardsFromGoal(const hsPoint3* fromGoal, do
|
||||
hsAssert(fCurRad>=0 && fCurRad<=kTwoPI, "illegal radian value");
|
||||
|
||||
hsPoint3 x;
|
||||
x = GetCenterPoint() + hsVector3((hsScalar)hsCosine(fCurRad)*fRadius, (hsScalar)hsSine(fCurRad)*fRadius, 0.0f);
|
||||
x = GetCenterPoint() + hsVector3((float)cos(fCurRad)*fRadius, (float)sin(fCurRad)*fRadius, 0.0f);
|
||||
x.fZ = fCamera->GetTargetPos().fZ;
|
||||
return x;
|
||||
}
|
||||
@ -1737,8 +1737,8 @@ hsPoint3 plCameraBrain1_Circle::IGetClosestPointOnCircle(const hsPoint3* toThis)
|
||||
v = hsVector3(¢er, &p);
|
||||
}
|
||||
v.Normalize();
|
||||
fGoalRad = (hsScalar)atan2(v.fY, v.fX); // -pi to pi
|
||||
hsAssert(fGoalRad>=-hsScalarPI && fGoalRad<=hsScalarPI, "Illegal atan2 val");
|
||||
fGoalRad = (float)atan2(v.fY, v.fX); // -pi to pi
|
||||
hsAssert(fGoalRad>=-M_PI && fGoalRad<=M_PI, "Illegal atan2 val");
|
||||
if (fGoalRad<0)
|
||||
fGoalRad = kTwoPI + fGoalRad; // 0 to 2pi
|
||||
hsAssert(fGoalRad>=0 && fGoalRad<=kTwoPI, "Illegal atan2 val");
|
||||
|
@ -94,12 +94,12 @@ public:
|
||||
|
||||
void SetCamera(plCameraModifier1* pMod) { fCamera = pMod; }
|
||||
|
||||
void SetAccel (hsScalar f) { fAccel = f; }
|
||||
void SetDecel (hsScalar f) { fDecel = f; }
|
||||
void SetVelocity (hsScalar f) { fVelocity = f; }
|
||||
void SetPOAAccel (hsScalar f) { fPOAAccel = f; }
|
||||
void SetPOADecel (hsScalar f) { fPOADecel = f; }
|
||||
void SetPOAVelocity (hsScalar f) { fPOAVelocity = f; }
|
||||
void SetAccel (float f) { fAccel = f; }
|
||||
void SetDecel (float f) { fDecel = f; }
|
||||
void SetVelocity (float f) { fVelocity = f; }
|
||||
void SetPOAAccel (float f) { fPOAAccel = f; }
|
||||
void SetPOADecel (float f) { fPOADecel = f; }
|
||||
void SetPOAVelocity (float f) { fPOAVelocity = f; }
|
||||
|
||||
const plCameraModifier1* GetCamera() { return fCamera; }
|
||||
|
||||
@ -128,13 +128,13 @@ public:
|
||||
|
||||
void SetGoal(hsPoint3 pt) { fGoal = pt; }
|
||||
void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; }
|
||||
void SetFOVGoal(hsScalar h, double t);
|
||||
void SetZoomParams(hsScalar max, hsScalar min, hsScalar rate);
|
||||
void SetFOVGoal(float h, double t);
|
||||
void SetZoomParams(float max, float min, float rate);
|
||||
|
||||
void SetXPanLimit(hsScalar x) {fXPanLimit = x;}
|
||||
void SetZPanLimit(hsScalar y) {fZPanLimit = y;}
|
||||
hsScalar GetXPanLimit() {return fXPanLimit;}
|
||||
hsScalar GetZPanLimit() {return fZPanLimit;}
|
||||
void SetXPanLimit(float x) {fXPanLimit = x;}
|
||||
void SetZPanLimit(float y) {fZPanLimit = y;}
|
||||
float GetXPanLimit() {return fXPanLimit;}
|
||||
float GetZPanLimit() {return fZPanLimit;}
|
||||
|
||||
void SetRail(plRailCameraMod* m) { fRail = m; }
|
||||
|
||||
@ -144,28 +144,28 @@ public:
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Pop();
|
||||
|
||||
hsScalar GetVelocity() { return fVelocity; }
|
||||
hsScalar GetAccel() { return fAccel; }
|
||||
hsScalar GetDecel() { return fDecel; }
|
||||
hsScalar GetPOAAccel() { return fPOAAccel; }
|
||||
hsScalar GetPOAVelocity() { return fPOAVelocity; }
|
||||
hsScalar GetPOADecel() { return fPOADecel; }
|
||||
float GetVelocity() { return fVelocity; }
|
||||
float GetAccel() { return fAccel; }
|
||||
float GetDecel() { return fDecel; }
|
||||
float GetPOAAccel() { return fPOAAccel; }
|
||||
float GetPOAVelocity() { return fPOAVelocity; }
|
||||
float GetPOADecel() { return fPOADecel; }
|
||||
|
||||
hsScalar GetCurrentCamSpeed() { return fCurCamSpeed; }
|
||||
hsScalar GetCurrentViewSpeed() { return fCurViewSpeed; }
|
||||
float GetCurrentCamSpeed() { return fCurCamSpeed; }
|
||||
float GetCurrentViewSpeed() { return fCurViewSpeed; }
|
||||
|
||||
void SetCurrentCamSpeed(hsScalar s) { fCurCamSpeed = s; }
|
||||
void SetCurrentViewSpeed(hsScalar s) { fCurViewSpeed = s; }
|
||||
void SetCurrentCamSpeed(float s) { fCurCamSpeed = s; }
|
||||
void SetCurrentViewSpeed(float s) { fCurViewSpeed = s; }
|
||||
|
||||
hsMatrix44 GetTargetMatrix() { return fTargetMatrix; }
|
||||
|
||||
static hsScalar fFallVelocity;
|
||||
static hsScalar fFallAccel;
|
||||
static hsScalar fFallDecel;
|
||||
static float fFallVelocity;
|
||||
static float fFallAccel;
|
||||
static float fFallDecel;
|
||||
|
||||
static hsScalar fFallPOAVelocity;
|
||||
static hsScalar fFallPOAAccel;
|
||||
static hsScalar fFallPOADecel;
|
||||
static float fFallPOAVelocity;
|
||||
static float fFallPOAAccel;
|
||||
static float fFallPOADecel;
|
||||
|
||||
protected:
|
||||
|
||||
@ -173,48 +173,48 @@ protected:
|
||||
void IMoveTowardGoal(double time);
|
||||
void IPointTowardGoal(double time);
|
||||
void IAnimateFOV(double time);
|
||||
void IAdjustVelocity(hsScalar adjAccelRate,
|
||||
hsScalar adjDecelRate,
|
||||
void IAdjustVelocity(float adjAccelRate,
|
||||
float adjDecelRate,
|
||||
hsVector3* dir,
|
||||
hsVector3* vel,
|
||||
hsScalar maxSpeed,
|
||||
hsScalar distToGoal,
|
||||
float maxSpeed,
|
||||
float distToGoal,
|
||||
double elapsedTime);
|
||||
|
||||
hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime);
|
||||
hsBool IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal);
|
||||
float IClampVelocity(hsVector3* vel, float maxSpeed, double elapsedTime);
|
||||
hsBool IShouldDecelerate(float decelSpeed, float curSpeed, float distToGoal);
|
||||
|
||||
plCameraModifier1* fCamera;
|
||||
plKey fSubjectKey;
|
||||
plRailCameraMod* fRail;
|
||||
hsScalar fCurCamSpeed;
|
||||
hsScalar fCurViewSpeed;
|
||||
float fCurCamSpeed;
|
||||
float fCurViewSpeed;
|
||||
double fLastTime;
|
||||
|
||||
hsScalar fVelocity;
|
||||
hsScalar fAccel;
|
||||
hsScalar fDecel;
|
||||
hsScalar fPOAVelocity;
|
||||
hsScalar fPOAAccel;
|
||||
hsScalar fPOADecel;
|
||||
float fVelocity;
|
||||
float fAccel;
|
||||
float fDecel;
|
||||
float fPOAVelocity;
|
||||
float fPOAAccel;
|
||||
float fPOADecel;
|
||||
hsVector3 fPOAOffset;
|
||||
hsPoint3 fGoal;
|
||||
hsPoint3 fPOAGoal;
|
||||
hsScalar fXPanLimit;
|
||||
hsScalar fZPanLimit;
|
||||
hsScalar fPanSpeed;
|
||||
hsScalar fFOVGoal;
|
||||
float fXPanLimit;
|
||||
float fZPanLimit;
|
||||
float fPanSpeed;
|
||||
float fFOVGoal;
|
||||
double fFOVStartTime;
|
||||
double fFOVEndTime;
|
||||
hsScalar fFOVAnimRate;
|
||||
hsScalar fZoomRate;
|
||||
hsScalar fZoomMax;
|
||||
hsScalar fZoomMin;
|
||||
float fFOVAnimRate;
|
||||
float fZoomRate;
|
||||
float fZoomMax;
|
||||
float fZoomMin;
|
||||
hsBitVector fMoveFlags;
|
||||
hsBitVector fFlags;
|
||||
hsMatrix44 fTargetMatrix;
|
||||
hsScalar fOffsetLength;
|
||||
hsScalar fOffsetPct;
|
||||
float fOffsetLength;
|
||||
float fOffsetPct;
|
||||
double fFallTimer;
|
||||
};
|
||||
|
||||
@ -226,8 +226,8 @@ protected:
|
||||
hsPoint3 fDesiredPosition;
|
||||
hsPoint3 fFacingTarget;
|
||||
hsBool bUseDesiredFacing;
|
||||
hsScalar deltaX;
|
||||
hsScalar deltaY;
|
||||
float deltaX;
|
||||
float deltaY;
|
||||
hsBool bDisregardY; // these are here to prevent
|
||||
hsBool bDisregardX; // the camera from jumping when the mouse cursor recenters / wraps around.
|
||||
hsVector3 fUp;
|
||||
@ -238,7 +238,7 @@ public:
|
||||
plCameraBrain1_Drive(plCameraModifier1* pMod);
|
||||
~plCameraBrain1_Drive();
|
||||
|
||||
static void SetSensitivity(hsScalar f) { fTurnRate = f; }
|
||||
static void SetSensitivity(float f) { fTurnRate = f; }
|
||||
|
||||
CLASSNAME_REGISTER( plCameraBrain1_Drive );
|
||||
GETINTERFACE_ANY( plCameraBrain1_Drive, plCameraBrain1 );
|
||||
@ -248,10 +248,10 @@ public:
|
||||
virtual void Push(hsBool recenter = true);
|
||||
virtual void Pop();
|
||||
|
||||
static hsScalar fAcceleration;
|
||||
static hsScalar fDeceleration;
|
||||
static hsScalar fMaxVelocity;
|
||||
static hsScalar fTurnRate;
|
||||
static float fAcceleration;
|
||||
static float fDeceleration;
|
||||
static float fMaxVelocity;
|
||||
static float fTurnRate;
|
||||
};
|
||||
|
||||
|
||||
@ -365,10 +365,10 @@ protected:
|
||||
uint32_t fCircleFlags;
|
||||
hsPoint3 fCenter;
|
||||
plSceneObject* fCenterObject; // optional, use instead of fCenter
|
||||
hsScalar fRadius;
|
||||
hsScalar fCurRad, fGoalRad; // Radians
|
||||
float fRadius;
|
||||
float fCurRad, fGoalRad; // Radians
|
||||
plSceneObject* fPOAObj; // in this case the subject is who we stay close to/away from
|
||||
hsScalar fCirPerSec;
|
||||
float fCirPerSec;
|
||||
|
||||
hsPoint3 IGetClosestPointOnCircle(const hsPoint3* toThisPt);
|
||||
public:
|
||||
@ -389,13 +389,13 @@ public:
|
||||
uint32_t GetCircleFlags() { return fCircleFlags; }
|
||||
hsPoint3* GetCenter() { return &fCenter; } // use GetCenterPoint
|
||||
hsPoint3 GetCenterPoint();
|
||||
hsScalar GetRadius() { return fRadius; }
|
||||
float GetRadius() { return fRadius; }
|
||||
plSceneObject* GetCenterObject() { return fCenterObject; }
|
||||
|
||||
void SetCircumferencePerSec(hsScalar h) { fCirPerSec = h; }
|
||||
void SetCircumferencePerSec(float h) { fCirPerSec = h; }
|
||||
void SetCircleFlags(uint32_t f) { fCircleFlags|=f; }
|
||||
void SetCenter(hsPoint3* ctr) { fCenter = *ctr; } // Circle lies in the plane z = ctr->z
|
||||
void SetRadius(hsScalar radius) { fRadius = radius; }
|
||||
void SetRadius(float radius) { fRadius = radius; }
|
||||
void SetFarCircleCam(hsBool farType) { if (farType) fCircleFlags |= kFarthest; else fCircleFlags &= ~kFarthest; }
|
||||
void SetCenterObjectKey(plKey k);
|
||||
void SetPOAObject(plSceneObject* pObj) { fPOAObj = pObj; }
|
||||
|
@ -137,14 +137,14 @@ plSceneObject* plCameraModifier1::GetSubject()
|
||||
return fSubObj;
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVw(hsScalar f, hsBool fUpdateVCam)
|
||||
void plCameraModifier1::SetFOVw(float f, hsBool fUpdateVCam)
|
||||
{
|
||||
fFOVw = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVh(hsScalar f, hsBool fUpdateVCam)
|
||||
void plCameraModifier1::SetFOVh(float f, hsBool fUpdateVCam)
|
||||
{
|
||||
fFOVh = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
@ -191,7 +191,7 @@ hsBool plCameraModifier1::MsgReceive(plMessage* msg)
|
||||
double time = (double)fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fAccel;
|
||||
double time2 = (double)pEventMsg->fEventTime;
|
||||
time = hsABS(time - time2);
|
||||
hsScalar h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh;
|
||||
float h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh;
|
||||
if (GetBrain())
|
||||
GetBrain()->SetFOVGoal(h, time);
|
||||
}
|
||||
@ -333,12 +333,12 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
|
||||
hsBool cutpos = stream->ReadBool();
|
||||
hsBool cutpoa = stream->ReadBool();
|
||||
hsBool ignore = stream->ReadBool();
|
||||
hsScalar v = stream->ReadLEScalar();
|
||||
hsScalar a = stream->ReadLEScalar();
|
||||
hsScalar d = stream->ReadLEScalar();
|
||||
hsScalar pV = stream->ReadLEScalar();
|
||||
hsScalar pA = stream->ReadLEScalar();
|
||||
hsScalar pD = stream->ReadLEScalar();
|
||||
float v = stream->ReadLEScalar();
|
||||
float a = stream->ReadLEScalar();
|
||||
float d = stream->ReadLEScalar();
|
||||
float pV = stream->ReadLEScalar();
|
||||
float pA = stream->ReadLEScalar();
|
||||
float pD = stream->ReadLEScalar();
|
||||
|
||||
CamTrans* camTrans = TRACKED_NEW CamTrans(key);
|
||||
camTrans->fAccel = a;
|
||||
|
@ -75,12 +75,12 @@ struct CamTrans
|
||||
hsBool fCutPos;
|
||||
hsBool fCutPOA;
|
||||
hsBool fIgnore;
|
||||
hsScalar fAccel;
|
||||
hsScalar fDecel;
|
||||
hsScalar fVelocity;
|
||||
hsScalar fPOAAccel;
|
||||
hsScalar fPOADecel;
|
||||
hsScalar fPOAVelocity;
|
||||
float fAccel;
|
||||
float fDecel;
|
||||
float fVelocity;
|
||||
float fPOAAccel;
|
||||
float fPOADecel;
|
||||
float fPOAVelocity;
|
||||
|
||||
};
|
||||
|
||||
@ -96,7 +96,7 @@ class plCameraModifier1 : public plSingleModifier
|
||||
protected:
|
||||
|
||||
void Output();
|
||||
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:
|
||||
|
||||
@ -128,10 +128,10 @@ public:
|
||||
void SetTargetPOA(hsPoint3 pos) { fAt = pos; }
|
||||
void SetSubworldPos(hsPoint3 pos) { fLastSubPos = pos; }
|
||||
void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; }
|
||||
hsScalar GetFOVw() { return fFOVw; }
|
||||
hsScalar GetFOVh() { return fFOVh; }
|
||||
void SetFOVw(hsScalar f, hsBool fUpdateVCam = true);
|
||||
void SetFOVh(hsScalar f, hsBool fUpdateVCam = true);
|
||||
float GetFOVw() { return fFOVw; }
|
||||
float GetFOVh() { return fFOVh; }
|
||||
void SetFOVw(float f, hsBool fUpdateVCam = true);
|
||||
void SetFOVh(float f, hsBool fUpdateVCam = true);
|
||||
hsBool GetInSubworld() { return fInSubLastUpdate; }
|
||||
void InSubworld(hsBool b) { fInSubLastUpdate = b; }
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
@ -157,8 +157,8 @@ private:
|
||||
plCameraBrain1* fBrain; // the 'logic' portion of the camera
|
||||
hsTArray<CamTrans*> fTrans;
|
||||
plSceneObject* fSubObj;
|
||||
hsScalar fFOVw;
|
||||
hsScalar fFOVh;
|
||||
float fFOVw;
|
||||
float fFOVh;
|
||||
hsTArray<plMessage*> fMessageQueue;
|
||||
hsTArray<plCameraMsg*> fFOVInstructions;
|
||||
hsBool fAnimated, fStartAnimOnPush, fStopAnimOnPop, fResetAnimOnPop;
|
||||
|
@ -52,11 +52,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "pnKeyedObject/plKey.h"
|
||||
|
||||
|
||||
hsScalar plInterestingModifier::fInterestRadius = 100.0f;
|
||||
hsScalar plInterestingModifier::fInterestWeight = 1.0f;
|
||||
float plInterestingModifier::fInterestRadius = 100.0f;
|
||||
float plInterestingModifier::fInterestWeight = 1.0f;
|
||||
|
||||
|
||||
hsBool plInterestingModifier::IEval(double secs, hsScalar del, uint32_t dirty)
|
||||
hsBool plInterestingModifier::IEval(double secs, float del, uint32_t dirty)
|
||||
{
|
||||
for (int i=0; i < GetNumTargets(); i++)
|
||||
{
|
||||
|
@ -62,12 +62,12 @@ protected:
|
||||
};
|
||||
|
||||
uint8_t fType;
|
||||
hsScalar fView;
|
||||
float fView;
|
||||
|
||||
static hsScalar fInterestRadius;
|
||||
static hsScalar fInterestWeight;
|
||||
static float fInterestRadius;
|
||||
static float fInterestWeight;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
||||
public:
|
||||
plInterestingModifier(){ fType = kTypeInteresting;}
|
||||
@ -78,11 +78,11 @@ public:
|
||||
CLASSNAME_REGISTER( plInterestingModifier );
|
||||
GETINTERFACE_ANY( plInterestingModifier, plSingleModifier );
|
||||
|
||||
hsScalar GetInterestWeight() { return fInterestWeight; }
|
||||
hsScalar GetInterestRadius() { return fInterestRadius; }
|
||||
float GetInterestWeight() { return fInterestWeight; }
|
||||
float GetInterestRadius() { return fInterestRadius; }
|
||||
|
||||
void SetInterestWeight(hsScalar _InterestRadius) { fInterestWeight =_InterestRadius; }
|
||||
void SetInterestRadius(hsScalar _InterestWeight) { fInterestRadius =_InterestWeight; }
|
||||
void SetInterestWeight(float _InterestRadius) { fInterestWeight =_InterestRadius; }
|
||||
void SetInterestRadius(float _InterestWeight) { fInterestRadius =_InterestWeight; }
|
||||
|
||||
virtual void AddTarget(plSceneObject* so);
|
||||
|
||||
|
@ -86,21 +86,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsConfig.h"
|
||||
#include "hsQuat.h"
|
||||
|
||||
hsScalar plVirtualCam1::fFOVw = 45.0f;
|
||||
hsScalar plVirtualCam1::fFOVh = 33.75f;
|
||||
hsScalar plVirtualCam1::fHither = 0.3f;
|
||||
hsScalar plVirtualCam1::fYon = 500.0f;
|
||||
float plVirtualCam1::fFOVw = 45.0f;
|
||||
float plVirtualCam1::fFOVh = 33.75f;
|
||||
float plVirtualCam1::fHither = 0.3f;
|
||||
float plVirtualCam1::fYon = 500.0f;
|
||||
hsBool plVirtualCam1::printFOV = false;
|
||||
hsBool plVirtualCam1::fUseAccelOverride = 1;
|
||||
hsBool plVirtualCam1::freeze = 0;
|
||||
//hsScalar plVirtualCam1::fAccel = 5.0f;
|
||||
//hsScalar plVirtualCam1::fDecel = 5.0f;
|
||||
//hsScalar plVirtualCam1::fVel = 10.0f;
|
||||
hsScalar plVirtualCam1::fAccel = 50.0f;
|
||||
hsScalar plVirtualCam1::fDecel = 50.0f;
|
||||
hsScalar plVirtualCam1::fVel = 100.0f;
|
||||
hsScalar plVirtualCam1::fPanResponseTime = 3.0f;
|
||||
hsScalar plVirtualCam1::fFallTimerDelay = 0.25f;
|
||||
//float plVirtualCam1::fAccel = 5.0f;
|
||||
//float plVirtualCam1::fDecel = 5.0f;
|
||||
//float plVirtualCam1::fVel = 10.0f;
|
||||
float plVirtualCam1::fAccel = 50.0f;
|
||||
float plVirtualCam1::fDecel = 50.0f;
|
||||
float plVirtualCam1::fVel = 100.0f;
|
||||
float plVirtualCam1::fPanResponseTime = 3.0f;
|
||||
float plVirtualCam1::fFallTimerDelay = 0.25f;
|
||||
hsBool plVirtualCam1::alwaysCutForColin = false;
|
||||
hsBool plVirtualCam1::WalkPan3rdPerson = false;
|
||||
hsBool plVirtualCam1::StayInFirstPersonForever = false;
|
||||
@ -287,7 +287,7 @@ void plVirtualCam1::SetOffset(float x, float y, float z)
|
||||
}
|
||||
|
||||
// static function
|
||||
void plVirtualCam1::SetFOV(hsScalar x, hsScalar y)
|
||||
void plVirtualCam1::SetFOV(float x, float y)
|
||||
{
|
||||
|
||||
float fovW = y * fAspectRatio;
|
||||
@ -307,12 +307,12 @@ if (printFOV)
|
||||
|
||||
}
|
||||
// static function
|
||||
void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam)
|
||||
void plVirtualCam1::SetFOV(float x, float y, plCameraModifier1* pCam)
|
||||
{
|
||||
if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam)
|
||||
return;
|
||||
|
||||
hsScalar diff = hsABS(fFOVw - x);
|
||||
float diff = hsABS(fFOVw - x);
|
||||
if (diff > 10.0f)
|
||||
{
|
||||
#ifdef STATUS_LOG
|
||||
@ -339,7 +339,7 @@ void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam)
|
||||
|
||||
// static function
|
||||
|
||||
void plVirtualCam1::SetDepth(hsScalar h, hsScalar y)
|
||||
void plVirtualCam1::SetDepth(float h, float y)
|
||||
{
|
||||
return;
|
||||
fHither = h;
|
||||
@ -684,17 +684,17 @@ void plVirtualCam1::AdjustForInput()
|
||||
|
||||
UnPanIfNeeded();
|
||||
|
||||
hsScalar panSpeed = 0.5f;
|
||||
float panSpeed = 0.5f;
|
||||
double secs = hsTimer::GetDelSysSeconds();
|
||||
|
||||
if (HasMovementFlag(B_CAMERA_PAN_UP))
|
||||
fY -= (hsScalar)(panSpeed * secs);
|
||||
fY -= (float)(panSpeed * secs);
|
||||
if (HasMovementFlag(B_CAMERA_PAN_DOWN))
|
||||
fY += (hsScalar)(panSpeed * secs);
|
||||
fY += (float)(panSpeed * secs);
|
||||
if (HasMovementFlag(B_CAMERA_PAN_LEFT))
|
||||
fX -= (hsScalar)(panSpeed * secs);
|
||||
fX -= (float)(panSpeed * secs);
|
||||
if (HasMovementFlag(B_CAMERA_PAN_RIGHT))
|
||||
fX += (hsScalar)(panSpeed * secs);
|
||||
fX += (float)(panSpeed * secs);
|
||||
}
|
||||
if ((fY == 0.5f && fX == 0.5f) &&
|
||||
fFirstPersonOverride == nil)
|
||||
@ -725,17 +725,17 @@ void plVirtualCam1::AdjustForInput()
|
||||
|
||||
// scale maximum angle by % mouse input
|
||||
|
||||
hsScalar scaledX;
|
||||
float scaledX;
|
||||
if (fFirstPersonOverride)
|
||||
scaledX = 3.14159;
|
||||
else
|
||||
scaledX = (hsScalar)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f)));
|
||||
scaledX = (float)(3.14159 - (fXPanLimit * ( (fX - 0.5f) / 0.5f)));
|
||||
|
||||
hsScalar scaledZ;
|
||||
float scaledZ;
|
||||
if (fFirstPersonOverride)
|
||||
scaledZ = (hsScalar)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f)));
|
||||
scaledZ = (float)(3.14159 - (0.872f * ( (fY - 0.5f) / 0.5f)));
|
||||
else
|
||||
scaledZ = (hsScalar)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f)));
|
||||
scaledZ = (float)(3.14159 - (fZPanLimit * ( (fY - 0.5f) / 0.5f)));
|
||||
|
||||
hsMatrix44 mX;
|
||||
hsMatrix44 mZ;
|
||||
@ -1068,8 +1068,8 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
if (!HasFlags(kFalling))
|
||||
{
|
||||
hsScalar dX = pMouseMsg->GetDX();
|
||||
hsScalar dY = pMouseMsg->GetDY();
|
||||
float dX = pMouseMsg->GetDX();
|
||||
float dY = pMouseMsg->GetDY();
|
||||
if (plMouseDevice::GetInverted())
|
||||
{
|
||||
dX *= -1.f;
|
||||
@ -1906,7 +1906,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
|
||||
curVec.fZ = transVec.fZ = 0;
|
||||
transVec.Normalize();
|
||||
curVec.Normalize();
|
||||
hsScalar dot = curVec * transVec;
|
||||
float dot = curVec * transVec;
|
||||
if (dot <= 0.5f || transVec.MagnitudeSquared() != 0.0f)
|
||||
{
|
||||
pBrain->SetPOAAccel(100);
|
||||
@ -1973,7 +1973,7 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
|
||||
pBrain->SetCamera(fTransitionCamera);
|
||||
|
||||
// deal with FOV -
|
||||
hsScalar diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh());
|
||||
float diffH = hsABS(pCam->GetFOVh() - fPrevCam->GetFOVh());
|
||||
if ( diffH )
|
||||
{
|
||||
double time = 0;
|
||||
@ -2029,7 +2029,7 @@ void plVirtualCam1::RunTransition()
|
||||
plCameraBrain1_Avatar* pAvBr = plCameraBrain1_Avatar::ConvertNoRef(pBrain);
|
||||
if (pAvBr)
|
||||
{
|
||||
hsScalar off = pAvBr->GetOffset().MagnitudeSquared();
|
||||
float off = pAvBr->GetOffset().MagnitudeSquared();
|
||||
hsVector3 dist(pToCam->GetTargetPos() - fTransitionCamera->GetTargetPos());
|
||||
if (dist.MagnitudeSquared() > off)
|
||||
fTransitionCamera->GetBrain()->SetFlags(plCameraBrain1::kPanicVelocity);
|
||||
|
@ -120,13 +120,13 @@ public:
|
||||
void Init();
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
static void SetFOV(hsScalar w, hsScalar h);
|
||||
static void SetFOV(hsScalar w, hsScalar h, plCameraModifier1* pCam);
|
||||
static void SetDepth(hsScalar h, hsScalar y);
|
||||
static hsScalar GetFOVw() { return fFOVw; }
|
||||
static hsScalar GetFOVh() { return fFOVh; }
|
||||
static hsScalar GetHither() { return fHither; }
|
||||
static hsScalar GetYon() { return fYon; }
|
||||
static void SetFOV(float w, float h);
|
||||
static void SetFOV(float w, float h, plCameraModifier1* pCam);
|
||||
static void SetDepth(float h, float y);
|
||||
static float GetFOVw() { return fFOVw; }
|
||||
static float GetFOVh() { return fFOVh; }
|
||||
static float GetHither() { return fHither; }
|
||||
static float GetYon() { return fYon; }
|
||||
static void SetOffset(float x, float y, float z);
|
||||
static void SetAspectRatio(float aspect) { fAspectRatio = aspect; }
|
||||
static float GetAspectRatio() { return fAspectRatio; }
|
||||
@ -174,8 +174,8 @@ public:
|
||||
void StartUnPan();
|
||||
// these are for console access
|
||||
static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever;
|
||||
static hsScalar fDecel, fAccel, fVel;
|
||||
static hsScalar fFallTimerDelay;
|
||||
static float fDecel, fAccel, fVel;
|
||||
static float fFallTimerDelay;
|
||||
|
||||
private:
|
||||
|
||||
@ -215,19 +215,19 @@ private:
|
||||
hsBitVector fFlags;
|
||||
hsTArray<plSceneObject*> fCamerasLoaded;
|
||||
hsBitVector fMoveFlags;
|
||||
hsScalar fX;
|
||||
hsScalar fY;
|
||||
hsScalar fXPanLimit;
|
||||
hsScalar fZPanLimit;
|
||||
hsScalar fXPanLimitGoal;
|
||||
hsScalar fZPanLimitGoal;
|
||||
hsScalar fXUnPanRate;
|
||||
hsScalar fZUnPanRate;
|
||||
hsScalar fXPanInterpRate;
|
||||
hsScalar fZPanInterpRate;
|
||||
float fX;
|
||||
float fY;
|
||||
float fXPanLimit;
|
||||
float fZPanLimit;
|
||||
float fXPanLimitGoal;
|
||||
float fZPanLimitGoal;
|
||||
float fXUnPanRate;
|
||||
float fZUnPanRate;
|
||||
float fXPanInterpRate;
|
||||
float fZPanInterpRate;
|
||||
double fUnPanEndTime;
|
||||
double fInterpPanLimitTime;
|
||||
hsScalar fRetainedFY;
|
||||
float fRetainedFY;
|
||||
|
||||
// built-in cameras
|
||||
plCameraModifier1* fDriveCamera; // for driving around
|
||||
@ -237,11 +237,11 @@ private:
|
||||
plCameraModifier1* fPrevCam; // the last camera we were displaying
|
||||
plCameraModifier1* fThirdPersonCam; // built in third person cam for ccr's when they jump about
|
||||
|
||||
static hsScalar fFOVh, fFOVw;
|
||||
static hsScalar fHither, fYon;
|
||||
static float fFOVh, fFOVw;
|
||||
static float fHither, fYon;
|
||||
static plVirtualCam1* fInstance;
|
||||
static hsBool printFOV;
|
||||
static hsScalar fPanResponseTime;
|
||||
static float fPanResponseTime;
|
||||
static float fAspectRatio;
|
||||
hsBool fForceCutOnce;
|
||||
|
||||
|
Reference in New Issue
Block a user