Pickup fixes
This commit is contained in:
parent
c40d628fe0
commit
1f36b78c20
@ -628,7 +628,7 @@ CPickups::Update()
|
||||
#ifdef CAMERA_PICKUP
|
||||
if ( bPickUpcamActivated ) // taken from PS2
|
||||
{
|
||||
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
|
||||
float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
|
||||
float mult;
|
||||
if ( dist < 10.0f )
|
||||
mult = 1.0f - (dist / 10.0f );
|
||||
@ -644,8 +644,7 @@ CPickups::Update()
|
||||
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
|
||||
}
|
||||
|
||||
if ( FindPlayerVehicle() != pPlayerVehicle
|
||||
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
|
||||
if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|
||||
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
|
||||
{
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
@ -715,7 +714,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||
|
||||
CObject *object = (CObject*)entity;
|
||||
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
|
||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
||||
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||
const float MAXDIST = 12.0f;
|
||||
|
||||
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
|
||||
@ -746,7 +745,7 @@ void
|
||||
CPickups::DoMineEffects(CEntity *entity)
|
||||
{
|
||||
const CVector &pos = entity->GetPosition();
|
||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
||||
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||
const float MAXDIST = 20.0f;
|
||||
|
||||
if (dist < MAXDIST) {
|
||||
@ -765,7 +764,7 @@ void
|
||||
CPickups::DoMoneyEffects(CEntity *entity)
|
||||
{
|
||||
const CVector &pos = entity->GetPosition();
|
||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
||||
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||
const float MAXDIST = 20.0f;
|
||||
|
||||
if (dist < MAXDIST) {
|
||||
@ -784,7 +783,7 @@ void
|
||||
CPickups::DoCollectableEffects(CEntity *entity)
|
||||
{
|
||||
const CVector &pos = entity->GetPosition();
|
||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
||||
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||
const float MAXDIST = 14.0f;
|
||||
|
||||
if (dist < MAXDIST) {
|
||||
|
@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
|
||||
return (v2 - v1).Magnitude();
|
||||
}
|
||||
|
||||
inline float
|
||||
Distance2D(const CVector &v1, const CVector &v2)
|
||||
{
|
||||
float x = v2.x - v1.x;
|
||||
float y = v2.y - v1.y;
|
||||
return Sqrt(sq(x) + sq(y));
|
||||
}
|
||||
|
||||
class CMatrix;
|
||||
|
||||
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
||||
|
Loading…
Reference in New Issue
Block a user