Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions MTA10/game_sa/CPhysicalSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,22 @@ void CPhysicalSA::SetLighting ( float fLighting )
CPhysicalSAInterface * pInterface = (CPhysicalSAInterface *)this->GetInterface();
pInterface->m_fLighting = fLighting;
}

void CPhysicalSA::SetMovementDisabled ( bool bDisabled )
{
CPhysicalSAInterface * pInterface = (CPhysicalSAInterface *) this->GetInterface();
// Ignore non gravity entities
if ( pInterface->bApplyGravity )
{
// Make entity (not) movable
pInterface->bDisableMovement = bDisabled;
// Make entity (not) rotatable
pInterface->bDisableFriction = bDisabled;
}
else
{
// Reset move speed manually only for non gravity entities
SetMoveSpeed ( &CVector() );
}
SetTurnSpeed ( &CVector() );
}
2 changes: 2 additions & 0 deletions MTA10/game_sa/CPhysicalSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class CPhysicalSA : public virtual CPhysical, public virtual CEntitySA
float GetLighting ( void );
void SetLighting ( float fLighting );

void SetMovementDisabled ( bool bDisabled );

/*
VOID SetMassMultiplier(FLOAT fMassMultiplier);
FLOAT GetMassMultiplier();
Expand Down
9 changes: 3 additions & 6 deletions MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,21 +1119,18 @@ bool CStaticFunctionDefinitions::SetElementVelocity ( CClientEntity& Entity, con
case CCLIENTPLAYER:
{
CClientPed& Ped = static_cast < CClientPed& > ( Entity );
Ped.SetMoveSpeed ( vecVelocity );
break;
return Ped.SetMoveSpeed ( vecVelocity );
}
case CCLIENTVEHICLE:
{
CClientVehicle& Vehicle = static_cast < CClientVehicle& > ( Entity );
Vehicle.SetMoveSpeed ( vecVelocity );
break;
return Vehicle.SetMoveSpeed ( vecVelocity );
}
case CCLIENTOBJECT:
case CCLIENTWEAPON:
{
CClientObject& Object = static_cast < CClientObject& > ( Entity );
Object.SetMoveSpeed ( vecVelocity );
break;
return Object.SetMoveSpeed ( vecVelocity );
}
case CCLIENTPROJECTILE:
{
Expand Down
23 changes: 15 additions & 8 deletions MTA10/mods/shared_logic/CClientObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ void CClientObject::Render ( void )
void CClientObject::SetStatic ( bool bStatic )
{
m_bIsStatic = bStatic;
StreamOutForABit ( );
if ( m_pObject )
{
m_pObject->SetMovementDisabled ( bStatic );
}
m_vecMoveSpeed = CVector();
}


Expand Down Expand Up @@ -502,10 +506,8 @@ void CClientObject::Create ( void )
// Add XRef
g_pClientGame->GetGameEntityXRefManager ()->AddEntityXRef ( this, m_pObject );

// If set to true,this has the effect of forcing the object to be static at all times
m_pObject->SetStaticWaitingForCollision ( m_bIsStatic );

// Apply our data to the object
m_pObject->SetMovementDisabled ( m_bIsStatic );
m_pObject->Teleport ( m_vecPosition.fX, m_vecPosition.fY, m_vecPosition.fZ );
m_pObject->SetOrientation ( m_vecRotation.fX, m_vecRotation.fY, m_vecRotation.fZ );
#ifndef MTA_BUILDINGS
Expand Down Expand Up @@ -644,13 +646,18 @@ void CClientObject::GetMoveSpeed ( CVector& vecMoveSpeed ) const
}


void CClientObject::SetMoveSpeed ( const CVector& vecMoveSpeed )
bool CClientObject::SetMoveSpeed ( const CVector& vecMoveSpeed )
{
if ( m_pObject )
if ( !m_bIsStatic )
{
m_pObject->SetMoveSpeed ( const_cast < CVector* > ( &vecMoveSpeed ) );
if ( m_pObject )
{
m_pObject->SetMoveSpeed ( const_cast < CVector* > ( &vecMoveSpeed ) );
}
m_vecMoveSpeed = vecMoveSpeed;
return true;
}
m_vecMoveSpeed = vecMoveSpeed;
return false;
}


Expand Down
2 changes: 1 addition & 1 deletion MTA10/mods/shared_logic/CClientObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CClientObject : public CClientStreamElement
virtual void SetRotationRadians ( const CVector& vecRotation );

void GetMoveSpeed ( CVector& vecMoveSpeed ) const;
void SetMoveSpeed ( const CVector& vecMoveSpeed );
bool SetMoveSpeed ( const CVector& vecMoveSpeed );

void GetOrientation ( CVector& vecPosition, CVector& vecRotationRadians );
virtual void SetOrientation ( const CVector& vecPosition, const CVector& vecRotationRadians );
Expand Down
26 changes: 18 additions & 8 deletions MTA10/mods/shared_logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,18 @@ void CClientPed::GetMoveSpeed ( CVector& vecMoveSpeed ) const
}


void CClientPed::SetMoveSpeed ( const CVector& vecMoveSpeed )
bool CClientPed::SetMoveSpeed ( const CVector& vecMoveSpeed )
{
if ( m_pPlayerPed )
if ( !m_bFrozen )
{
m_pPlayerPed->SetMoveSpeed ( const_cast < CVector* > ( &vecMoveSpeed ) );
if ( m_pPlayerPed )
{
m_pPlayerPed->SetMoveSpeed ( const_cast < CVector* > ( &vecMoveSpeed ) );
}
m_vecMoveSpeed = vecMoveSpeed;
return true;
}
m_vecMoveSpeed = vecMoveSpeed;
return false;
}


Expand All @@ -813,13 +818,18 @@ void CClientPed::GetTurnSpeed ( CVector& vecTurnSpeed ) const
}


void CClientPed::SetTurnSpeed ( const CVector& vecTurnSpeed )
bool CClientPed::SetTurnSpeed ( const CVector& vecTurnSpeed )
{
if ( m_pPlayerPed )
if ( !m_bFrozen )
{
m_pPlayerPed->SetTurnSpeed ( const_cast < CVector* > ( &vecTurnSpeed ) );
if ( m_pPlayerPed )
{
m_pPlayerPed->SetTurnSpeed ( const_cast < CVector* > ( &vecTurnSpeed ) );
}
m_vecTurnSpeed = vecTurnSpeed;
return true;
}
m_vecTurnSpeed = vecTurnSpeed;
return false;
}


Expand Down
4 changes: 2 additions & 2 deletions MTA10/mods/shared_logic/CClientPed.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule
void SetCameraRotation ( float fRotation );

void GetMoveSpeed ( CVector& vecMoveSpeed ) const;
void SetMoveSpeed ( const CVector& vecMoveSpeed );
bool SetMoveSpeed ( const CVector& vecMoveSpeed );

void GetTurnSpeed ( CVector& vecTurnSpeed ) const;
void SetTurnSpeed ( const CVector& vecTurnSpeed );
bool SetTurnSpeed ( const CVector& vecTurnSpeed );

void GetControllerState ( CControllerState& ControllerState );
void GetLastControllerState ( CControllerState& ControllerState );
Expand Down
8 changes: 6 additions & 2 deletions MTA10/mods/shared_logic/CClientVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ void CClientVehicle::GetMoveSpeedMeters ( CVector& vecMoveSpeed ) const
}


void CClientVehicle::SetMoveSpeed ( const CVector& vecMoveSpeed )
bool CClientVehicle::SetMoveSpeed ( const CVector& vecMoveSpeed )
{
if ( !m_bIsFrozen )
{
Expand All @@ -569,7 +569,9 @@ void CClientVehicle::SetMoveSpeed ( const CVector& vecMoveSpeed )

if ( IsFrozenWaitingForGroundToLoad() )
m_vecWaitingForGroundSavedMoveSpeed = vecMoveSpeed;
return true;
}
return false;
}


Expand All @@ -590,7 +592,7 @@ void CClientVehicle::GetTurnSpeed ( CVector& vecTurnSpeed ) const
}


void CClientVehicle::SetTurnSpeed ( const CVector& vecTurnSpeed )
bool CClientVehicle::SetTurnSpeed ( const CVector& vecTurnSpeed )
{
if ( !m_bIsFrozen )
{
Expand All @@ -602,7 +604,9 @@ void CClientVehicle::SetTurnSpeed ( const CVector& vecTurnSpeed )

if ( IsFrozenWaitingForGroundToLoad() )
m_vecWaitingForGroundSavedTurnSpeed = vecTurnSpeed;
return true;
}
return false;
}


Expand Down
4 changes: 2 additions & 2 deletions MTA10/mods/shared_logic/CClientVehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class CClientVehicle : public CClientStreamElement

void GetMoveSpeed ( CVector& vecMoveSpeed ) const;
void GetMoveSpeedMeters ( CVector& vecMoveSpeed ) const;
void SetMoveSpeed ( const CVector& vecMoveSpeed );
bool SetMoveSpeed ( const CVector& vecMoveSpeed );
void GetTurnSpeed ( CVector& vecTurnSpeed ) const;
void SetTurnSpeed ( const CVector& vecTurnSpeed );
bool SetTurnSpeed ( const CVector& vecTurnSpeed );

bool IsVisible ( void );
void SetVisible ( bool bVisible );
Expand Down
2 changes: 2 additions & 0 deletions MTA10/sdk/game/CPhysical.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class CPhysical : public virtual CEntity
virtual float GetLighting ( void ) = 0;
virtual void SetLighting ( float fLighting ) = 0;

virtual void SetMovementDisabled ( bool bDisabled ) = 0;

/* virtual VOID SetMass(FLOAT fMass)=0;
virtual FLOAT GetMass()=0;
virtual VOID SetTurnMass(FLOAT fTurnMass)=0;
Expand Down