mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement/match CEntity::EnforceWorldBoundries(...)
This commit is contained in:
parent
65d1cb2201
commit
c7ae0d329c
@ -321,6 +321,68 @@ void CEntity::Remove()
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
BOOL CEntity::EnforceWorldBoundries(float fPX, float fZX, float fPY, float fNY)
|
||||
{
|
||||
MATRIX4X4 matWorld;
|
||||
VECTOR vecMoveSpeed;
|
||||
|
||||
if(!m_pEntity) return FALSE;
|
||||
|
||||
GetMatrix(&matWorld);
|
||||
GetMoveSpeedVector(&vecMoveSpeed);
|
||||
|
||||
if(matWorld.pos.X > fPX)
|
||||
{
|
||||
if(vecMoveSpeed.X != 0.0f) {
|
||||
vecMoveSpeed.X = -0.2f;
|
||||
vecMoveSpeed.Z = 0.1f;
|
||||
}
|
||||
SetMoveSpeedVector(vecMoveSpeed);
|
||||
matWorld.pos.Z += 0.04f;
|
||||
SetMatrix(matWorld);
|
||||
return TRUE;
|
||||
}
|
||||
else if(matWorld.pos.X < fZX)
|
||||
{
|
||||
if(vecMoveSpeed.X != 0.0f) {
|
||||
vecMoveSpeed.X = 0.2f;
|
||||
vecMoveSpeed.Z = 0.1f;
|
||||
}
|
||||
SetMoveSpeedVector(vecMoveSpeed);
|
||||
matWorld.pos.Z += 0.04f;
|
||||
SetMatrix(matWorld);
|
||||
return TRUE;
|
||||
}
|
||||
else if(matWorld.pos.Y > fPY)
|
||||
{
|
||||
if(vecMoveSpeed.Y != 0.0f) {
|
||||
vecMoveSpeed.Y = -0.2f;
|
||||
vecMoveSpeed.Z = 0.1f;
|
||||
}
|
||||
|
||||
SetMoveSpeedVector(vecMoveSpeed);
|
||||
matWorld.pos.Z += 0.04f;
|
||||
SetMatrix(matWorld);
|
||||
return TRUE;
|
||||
}
|
||||
else if(matWorld.pos.Y < fNY)
|
||||
{
|
||||
if(vecMoveSpeed.Y != 0.0f) {
|
||||
vecMoveSpeed.Y = 0.2f;
|
||||
vecMoveSpeed.Z = 0.1f;
|
||||
}
|
||||
|
||||
SetMoveSpeedVector(vecMoveSpeed);
|
||||
matWorld.pos.Z += 0.04f;
|
||||
SetMatrix(matWorld);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -29,6 +29,8 @@ public:
|
||||
float GetDistanceFromPoint(float X, float Y, float Z);
|
||||
BOOL IsStationary();
|
||||
|
||||
BOOL EnforceWorldBoundries(float fPX, float fZX, float fPY, float fNY);
|
||||
|
||||
virtual void Add();
|
||||
virtual void Remove();
|
||||
BOOL IsAdded();
|
||||
|
Loading…
Reference in New Issue
Block a user