SetPosition, part 2

This commit is contained in:
Sergeanur 2020-05-02 15:28:19 +03:00
parent d23b2c423e
commit 52390062b3
14 changed files with 49 additions and 49 deletions

View File

@ -1448,14 +1448,14 @@ void CGarage::UpdateDoorsHeight()
{
RefreshDoorPointers(false);
if (m_pDoor1) {
m_pDoor1->GetPosition().z = m_fDoorPos + m_fDoor1Z;
m_pDoor1->GetMatrix().GetPosition().z = m_fDoorPos + m_fDoor1Z;
if (m_bRotatedDoor)
BuildRotatedDoorMatrix(m_pDoor1, m_fDoorPos / m_fDoorHeight);
m_pDoor1->GetMatrix().UpdateRW();
m_pDoor1->UpdateRwFrame();
}
if (m_pDoor2) {
m_pDoor2->GetPosition().z = m_fDoorPos + m_fDoor2Z;
m_pDoor2->GetMatrix().GetPosition().z = m_fDoorPos + m_fDoor2Z;
if (m_bRotatedDoor)
BuildRotatedDoorMatrix(m_pDoor2, m_fDoorPos / m_fDoorHeight);
m_pDoor2->GetMatrix().UpdateRW();
@ -1482,18 +1482,18 @@ void CGarage::UpdateCrusherAngle()
void CGarage::UpdateCrusherShake(float X, float Y)
{
RefreshDoorPointers(false);
m_pDoor1->GetPosition().x += X;
m_pDoor1->GetPosition().y += Y;
m_pDoor1->GetMatrix().GetPosition().x += X;
m_pDoor1->GetMatrix().GetPosition().y += Y;
m_pDoor1->GetMatrix().UpdateRW();
m_pDoor1->UpdateRwFrame();
m_pDoor1->GetPosition().x -= X;
m_pDoor1->GetPosition().y -= Y;
m_pDoor2->GetPosition().x += X;
m_pDoor2->GetPosition().y += Y;
m_pDoor1->GetMatrix().GetPosition().x -= X;
m_pDoor1->GetMatrix().GetPosition().y -= Y;
m_pDoor2->GetMatrix().GetPosition().x += X;
m_pDoor2->GetMatrix().GetPosition().y += Y;
m_pDoor2->GetMatrix().UpdateRW();
m_pDoor2->UpdateRwFrame();
m_pDoor2->GetPosition().x -= X;
m_pDoor2->GetPosition().y -= Y;
m_pDoor2->GetMatrix().GetPosition().x -= X;
m_pDoor2->GetMatrix().GetPosition().y -= Y;
}
// This is dumb but there is no way to avoid goto. What was there originally even?
@ -1854,7 +1854,7 @@ CVehicle* CStoredCar::RestoreCar()
#else
CVehicle* pVehicle = new CAutomobile(m_nModelIndex, RANDOM_VEHICLE);
#endif
pVehicle->GetPosition() = m_vecPos;
pVehicle->SetPosition(m_vecPos);
pVehicle->SetStatus(STATUS_ABANDONED);
pVehicle->GetForward() = m_vecAngle;
pVehicle->GetRight() = CVector(m_vecAngle.y, -m_vecAngle.x, 0.0f);
@ -2089,15 +2089,15 @@ void CGarage::CenterCarInGarage(CVehicle* pVehicle)
float offsetZ = pos.z - pos.z;
float distance = CVector(offsetX, offsetY, offsetZ).Magnitude();
if (distance < RESPRAY_CENTERING_COEFFICIENT) {
pVehicle->GetPosition().x = GetGarageCenterX();
pVehicle->GetPosition().y = GetGarageCenterY();
pVehicle->GetMatrix().GetPosition().x = GetGarageCenterX();
pVehicle->GetMatrix().GetPosition().y = GetGarageCenterY();
}
else {
pVehicle->GetPosition().x += offsetX * RESPRAY_CENTERING_COEFFICIENT / distance;
pVehicle->GetPosition().y += offsetY * RESPRAY_CENTERING_COEFFICIENT / distance;
pVehicle->GetMatrix().GetPosition().x += offsetX * RESPRAY_CENTERING_COEFFICIENT / distance;
pVehicle->GetMatrix().GetPosition().y += offsetY * RESPRAY_CENTERING_COEFFICIENT / distance;
}
if (!IsEntityEntirelyInside3D(pVehicle, 0.1f))
pVehicle->GetPosition() = pos;
pVehicle->SetPosition(pos);
}
void CGarages::CloseHideOutGaragesBeforeSave()
@ -2205,7 +2205,7 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
default:
aGarages[i].RefreshDoorPointers(true);
if (aGarages[i].m_pDoor1) {
aGarages[i].m_pDoor1->GetPosition().z = aGarages[i].m_fDoor1Z;
aGarages[i].m_pDoor1->GetMatrix().GetPosition().z = aGarages[i].m_fDoor1Z;
if (aGarages[i].m_pDoor1->IsObject())
((CObject*)aGarages[i].m_pDoor1)->m_objectMatrix.GetPosition().z = aGarages[i].m_fDoor1Z;
if (aGarages[i].m_bRotatedDoor)
@ -2214,7 +2214,7 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
aGarages[i].m_pDoor1->UpdateRwFrame();
}
if (aGarages[i].m_pDoor2) {
aGarages[i].m_pDoor2->GetPosition().z = aGarages[i].m_fDoor2Z;
aGarages[i].m_pDoor2->GetMatrix().GetPosition().z = aGarages[i].m_fDoor2Z;
if (aGarages[i].m_pDoor2->IsObject())
((CObject*)aGarages[i].m_pDoor2)->m_objectMatrix.GetPosition().z = aGarages[i].m_fDoor2Z;
if (aGarages[i].m_bRotatedDoor)

View File

@ -288,7 +288,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
case PICKUP_NAUTICAL_MINE_INACTIVE:
{
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, false))
m_pObject->GetPosition().z = waterLevel + 0.6f;
m_pObject->GetMatrix().GetPosition().z = waterLevel + 0.6f;
m_pObject->GetMatrix().UpdateRW();
m_pObject->UpdateRwFrame();
@ -310,7 +310,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
case PICKUP_NAUTICAL_MINE_ARMED:
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, false))
m_pObject->GetPosition().z = waterLevel + 0.6f;
m_pObject->GetMatrix().GetPosition().z = waterLevel + 0.6f;
m_pObject->GetMatrix().UpdateRW();
m_pObject->UpdateRwFrame();
@ -337,7 +337,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
case PICKUP_FLOATINGPACKAGE:
m_pObject->m_vecMoveSpeed.z -= 0.01f * CTimer::GetTimeStep();
m_pObject->GetPosition() += m_pObject->GetMoveSpeed() * CTimer::GetTimeStep();
m_pObject->GetMatrix().GetPosition() += m_pObject->GetMoveSpeed() * CTimer::GetTimeStep();
m_pObject->GetMatrix().UpdateRW();
m_pObject->UpdateRwFrame();
@ -346,7 +346,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
break;
case PICKUP_FLOATINGPACKAGE_FLOATING:
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z + 5.0f, &waterLevel, 0))
m_pObject->GetPosition().z = waterLevel;
m_pObject->GetMatrix().GetPosition().z = waterLevel;
m_pObject->GetMatrix().UpdateRW();
m_pObject->UpdateRwFrame();

View File

@ -3794,7 +3794,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@ -3941,7 +3941,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}

View File

@ -104,7 +104,7 @@ void TankCheat()
if (tank != nil) {
CVector pos = ThePaths.m_pathNodes[node].pos;
pos.z += 4.0f;
tank->GetPosition() = pos;
tank->SetPosition(pos);
tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
tank->SetStatus(STATUS_ABANDONED);

View File

@ -524,7 +524,7 @@ void CRadar::DrawBlips()
} else {
#ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
CVector &blipPos = blipEntity->GetPosition();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -630,7 +630,7 @@ void CRadar::DrawBlips()
#ifdef TRIANGULAR_BLIPS
{
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
CVector &blipPos = blipEntity->GetPosition();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;

View File

@ -522,7 +522,7 @@ CCullZone::CalcDistToCullZoneSquared(float x, float y)
bool
CCullZone::IsEntityCloseEnoughToZone(CEntity *entity, bool checkLevel)
{
CVector &pos = entity->GetPosition();
const CVector &pos = entity->GetPosition();
CSimpleModelInfo *minfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(entity->GetModelIndex());
float distToZone = CalcDistToCullZone(pos.x, pos.y);

View File

@ -116,11 +116,11 @@ SpawnCar(int id)
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
if(CModelInfo::IsBoatModel(id))
v->GetPosition() = TheCamera.GetPosition() + TheCamera.GetForward()*15.0f;
v->SetPosition(TheCamera.GetPosition() + TheCamera.GetForward()*15.0f);
else
v->GetPosition() = ThePaths.m_pathNodes[node].pos;
v->SetPosition(ThePaths.m_pathNodes[node].pos);
v->GetPosition().z += 4.0f;
v->GetMatrix().GetPosition().z += 4.0f;
v->SetOrientation(0.0f, 0.0f, 3.49f);
v->SetStatus(STATUS_ABANDONED);
v->m_nDoorLock = CARLOCK_UNLOCKED;

View File

@ -137,7 +137,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
pobj->m_nState = POBJECTSTATE_UPDATE_CLOSE;
pobj->m_Type = (eParticleObjectType)type;
pobj->GetPosition() = pos;
pobj->SetPosition(pos);
pobj->m_vecTarget = target;
pobj->m_nNumEffectCycles = 1;
@ -1174,7 +1174,7 @@ CParticleObject::LoadParticle(uint8 *buffer, uint32 length)
dst->m_nState = POBJECTSTATE_UPDATE_CLOSE;
dst->m_Type = src->m_Type;
dst->m_ParticleType = src->m_ParticleType;
dst->GetPosition() = src->GetPosition();
dst->SetPosition(src->GetPosition());
dst->m_vecTarget = src->m_vecTarget;
dst->m_nFrameCounter = src->m_nFrameCounter;
dst->m_bRemove = src->m_bRemove;

View File

@ -647,7 +647,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
}
object->bGlassBroken = true;
object->GetPosition().z = -100.0f;
object->GetMatrix().GetPosition().z = -100.0f;
}
void

View File

@ -1213,7 +1213,7 @@ CAutomobile::Teleport(CVector pos)
{
CWorld::Remove(this);
GetPosition() = pos;
SetPosition(pos);
SetOrientation(0.0f, 0.0f, 0.0f);
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);

View File

@ -513,7 +513,7 @@ CBoat::ProcessControl(void)
// is this some inlined CPlaceable method?
CVector pos = GetPosition();
GetMatrix().RotateZ(m_fOrientation - GetForward().Heading());
GetPosition() = pos;
GetMatrix().GetPosition() = pos;
}
}
@ -673,7 +673,7 @@ CBoat::BlowUpCar(CEntity *culprit)
dist.Normalise();
if(GetUp().z > 0.0f)
dist += GetUp();
obj->GetPosition() += GetUp();
obj->GetMatrix().GetPosition() += GetUp();
CWorld::Add(obj);
@ -764,7 +764,7 @@ void
CBoat::Teleport(CVector v)
{
CWorld::Remove(this);
GetPosition() = v;
SetPosition(v);
SetOrientation(0.0f, 0.0f, 0.0f);
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);

View File

@ -59,7 +59,7 @@ void CCarGenerator::DoInternalProcessing()
if (pos.z <= -100.0f)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += pBoat->GetDistanceFromCentreOfMassToBaseOfModel();
pBoat->GetPosition() = pos;
pBoat->SetPosition(pos);
pBoat->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle));
pBoat->SetStatus(STATUS_ABANDONED);
pBoat->m_nDoorLock = CARLOCK_UNLOCKED;
@ -93,7 +93,7 @@ void CCarGenerator::DoInternalProcessing()
pCar->bIsStatic = false;
pCar->bEngineOn = false;
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();
pCar->GetPosition() = pos;
pCar->SetPosition(pos);
pCar->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle));
pCar->SetStatus(STATUS_ABANDONED);
pCar->bLightsOn = false;

View File

@ -340,7 +340,7 @@ void CCrane::Update(void)
case GOING_TOWARDS_TARGET_ONLY_HEIGHT:
case ROTATING_TARGET:
if (m_pVehiclePickedUp) {
m_pVehiclePickedUp->GetPosition() = CVector(m_vecHookCurPos.x, m_vecHookCurPos.y, m_vecHookCurPos.z - m_pVehiclePickedUp->GetColModel()->boundingBox.max.z);
m_pVehiclePickedUp->SetPosition(m_vecHookCurPos.x, m_vecHookCurPos.y, m_vecHookCurPos.z - m_pVehiclePickedUp->GetColModel()->boundingBox.max.z);
m_pVehiclePickedUp->SetMoveSpeed(0.0f, 0.0f, 0.0f);
CVector up(vecHook.x - m_vecHookCurPos.x, vecHook.y - m_vecHookCurPos.y, 20.0f);
up.Normalise();
@ -585,7 +585,7 @@ void CCrane::SetHookMatrix()
{
if (m_pHook == nil)
return;
m_pHook->GetPosition() = m_vecHookCurPos;
m_pHook->SetPosition(m_vecHookCurPos);
CVector up(m_vecHookInitPos.x - m_vecHookCurPos.x, m_vecHookInitPos.y - m_vecHookCurPos.y, 20.0f);
up.Normalise();
m_pHook->GetRight() = CrossProduct(CVector(0.0f, 1.0f, 0.0f), up);

View File

@ -144,11 +144,11 @@ CHeli::ProcessControl(void)
if(GetPosition().z > 31.55f)
break;
m_pathState = 7;
GetPosition().z = 31.55f;
GetMatrix().GetPosition().z = 31.55f;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
break;
case 7:
GetPosition().z = 31.55f;
GetMatrix().GetPosition().z = 31.55f;
target = GetPosition();
break;
@ -214,8 +214,8 @@ CHeli::ProcessControl(void)
vTargetDist = target - GetPosition();
m_fTargetZ = target.z;
if(m_pathState == 6){
GetPosition().x = GetPosition().x*0.99f + target.x*0.01f;
GetPosition().y = GetPosition().y*0.99f + target.y*0.01f;
GetMatrix().GetPosition().x = GetMatrix().GetPosition().x*0.99f + target.x*0.01f;
GetMatrix().GetPosition().y = GetMatrix().GetPosition().y*0.99f + target.y*0.01f;
}
}else{
vTargetDist = FindPlayerCoors() - GetPosition();
@ -367,8 +367,8 @@ CHeli::ProcessControl(void)
m_vecMoveSpeed.x += speedDir.x*speedInc;
m_vecMoveSpeed.y += speedDir.y*speedInc;
}
GetPosition().x += m_vecMoveSpeed.x*CTimer::GetTimeStep();
GetPosition().y += m_vecMoveSpeed.y*CTimer::GetTimeStep();
GetMatrix().GetPosition().x += m_vecMoveSpeed.x*CTimer::GetTimeStep();
GetMatrix().GetPosition().y += m_vecMoveSpeed.y*CTimer::GetTimeStep();
// Find z target
if(m_heliStatus == HELI_STATUS_FLY_AWAY)
@ -389,7 +389,7 @@ CHeli::ProcessControl(void)
m_vecMoveSpeed.z -= speedIncZ;
else
m_vecMoveSpeed.z += speedIncZ*1.5f;
GetPosition().z += m_vecMoveSpeed.z*CTimer::GetTimeStep();
GetMatrix().GetPosition().z += m_vecMoveSpeed.z*CTimer::GetTimeStep();
// Find angular speed
float targetAngularSpeed;