mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 18:25:42 +00:00
Pickup fixes
This commit is contained in:
parent
c40d628fe0
commit
1f36b78c20
2 changed files with 14 additions and 7 deletions
|
@ -628,7 +628,7 @@ CPickups::Update()
|
||||||
#ifdef CAMERA_PICKUP
|
#ifdef CAMERA_PICKUP
|
||||||
if ( bPickUpcamActivated ) // taken from PS2
|
if ( bPickUpcamActivated ) // taken from PS2
|
||||||
{
|
{
|
||||||
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
|
float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
|
||||||
float mult;
|
float mult;
|
||||||
if ( dist < 10.0f )
|
if ( dist < 10.0f )
|
||||||
mult = 1.0f - (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);
|
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FindPlayerVehicle() != pPlayerVehicle
|
if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|
||||||
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
|
|
||||||
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
|
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
|
||||||
{
|
{
|
||||||
TheCamera.RestoreWithJumpCut();
|
TheCamera.RestoreWithJumpCut();
|
||||||
|
@ -715,7 +714,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||||
|
|
||||||
CObject *object = (CObject*)entity;
|
CObject *object = (CObject*)entity;
|
||||||
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
|
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;
|
const float MAXDIST = 12.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
|
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
|
||||||
|
@ -746,7 +745,7 @@ void
|
||||||
CPickups::DoMineEffects(CEntity *entity)
|
CPickups::DoMineEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 20.0f;
|
const float MAXDIST = 20.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
@ -765,7 +764,7 @@ void
|
||||||
CPickups::DoMoneyEffects(CEntity *entity)
|
CPickups::DoMoneyEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 20.0f;
|
const float MAXDIST = 20.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
@ -784,7 +783,7 @@ void
|
||||||
CPickups::DoCollectableEffects(CEntity *entity)
|
CPickups::DoCollectableEffects(CEntity *entity)
|
||||||
{
|
{
|
||||||
const CVector &pos = entity->GetPosition();
|
const CVector &pos = entity->GetPosition();
|
||||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
float dist = Distance2D(pos, TheCamera.GetPosition());
|
||||||
const float MAXDIST = 14.0f;
|
const float MAXDIST = 14.0f;
|
||||||
|
|
||||||
if (dist < MAXDIST) {
|
if (dist < MAXDIST) {
|
||||||
|
|
|
@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
|
||||||
return (v2 - v1).Magnitude();
|
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;
|
class CMatrix;
|
||||||
|
|
||||||
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
||||||
|
|
Loading…
Reference in a new issue