1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 17:30:00 +00:00

SetPosition, final part

This commit is contained in:
Sergeanur 2020-05-05 04:45:18 +03:00
parent 131e8af174
commit 84c9484e55
20 changed files with 129 additions and 143 deletions

View file

@ -900,10 +900,10 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
TheCamera.GetMatrix().GetPosition() *= split; TheCamera.GetMatrix().GetPosition() *= split;
TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos; TheCamera.GetMatrix() += CMatrix(interpolation) * pg->camera_pos;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
pm->pos = *(RwV3d*)TheCamera.GetPosition(); pm->pos = TheCamera.GetPosition();
pm->at = *(RwV3d*)TheCamera.GetForward(); pm->at = TheCamera.GetForward();
pm->up = *(RwV3d*)TheCamera.GetUp(); pm->up = TheCamera.GetUp();
pm->right = *(RwV3d*)TheCamera.GetRight(); pm->right = TheCamera.GetRight();
CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x; CameraFocusX = split * CameraFocusX + interpolation * pg->player_pos.x;
CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y; CameraFocusY = split * CameraFocusY + interpolation * pg->player_pos.y;
CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z; CameraFocusZ = split * CameraFocusZ + interpolation * pg->player_pos.z;

View file

@ -1725,7 +1725,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f; pos.z += 1.0f;
ped->GetPosition() = pos; ped->SetPosition(pos);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CTheScripts::ClearSpaceForMissionEntity(pos, ped); CTheScripts::ClearSpaceForMissionEntity(pos, ped);
CWorld::Add(ped); CWorld::Add(ped);
@ -1939,7 +1939,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
boat->GetPosition() = pos; boat->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, boat); CTheScripts::ClearSpaceForMissionEntity(pos, boat);
boat->SetStatus(STATUS_ABANDONED); boat->SetStatus(STATUS_ABANDONED);
boat->bIsLocked = true; boat->bIsLocked = true;
@ -1957,7 +1957,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->GetPosition() = pos; car->SetPosition(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, car); CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED); car->SetStatus(STATUS_ABANDONED);
car->bIsLocked = true; car->bIsLocked = true;
@ -2531,7 +2531,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += pObj->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += pObj->GetDistanceFromCentreOfMassToBaseOfModel();
pObj->GetPosition() = pos; pObj->SetPosition(pos);
pObj->SetOrientation(0.0f, 0.0f, 0.0f); pObj->SetOrientation(0.0f, 0.0f, 0.0f);
pObj->GetMatrix().UpdateRW(); pObj->GetMatrix().UpdateRW();
pObj->UpdateRwFrame(); pObj->UpdateRwFrame();
@ -2751,7 +2751,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->CharCreatedBy = MISSION_CHAR; pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false; pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false; pPed->bAllowMedicsToReviveMe = false;
pPed->GetPosition() = pVehicle->GetPosition(); pPed->SetPosition(pVehicle->GetPosition());
pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING); pPed->SetPedState(PED_DRIVING);
CPopulation::ms_nTotalMissionPeds++; CPopulation::ms_nTotalMissionPeds++;
@ -3943,7 +3943,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->CharCreatedBy = MISSION_CHAR; pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false; pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false; pPed->bAllowMedicsToReviveMe = false;
pPed->GetPosition() = pVehicle->GetPosition(); pPed->SetPosition(pVehicle->GetPosition());
pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetOrientation(0.0f, 0.0f, 0.0f);
pPed->SetPedState(PED_DRIVING); pPed->SetPedState(PED_DRIVING);
CPopulation::ms_nTotalMissionPeds++; CPopulation::ms_nTotalMissionPeds++;
@ -5319,7 +5319,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
CVector pos = *(CVector*)&ScriptParams[1]; CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pObj->GetPosition() = pos; pObj->SetPosition(pos);
pObj->SetOrientation(0.0f, 0.0f, 0.0f); pObj->SetOrientation(0.0f, 0.0f, 0.0f);
pObj->GetMatrix().UpdateRW(); pObj->GetMatrix().UpdateRW();
pObj->UpdateRwFrame(); pObj->UpdateRwFrame();
@ -7343,7 +7343,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += 1.0f; pos.z += 1.0f;
ped->GetPosition() = pos; ped->SetPosition(pos);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CTheScripts::ClearSpaceForMissionEntity(pos, ped); CTheScripts::ClearSpaceForMissionEntity(pos, ped);
CWorld::Add(ped); CWorld::Add(ped);
@ -8165,7 +8165,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
car = new CAutomobile(model, MISSION_VEHICLE); car = new CAutomobile(model, MISSION_VEHICLE);
CVector pos = *(CVector*)&ScriptParams[0]; CVector pos = *(CVector*)&ScriptParams[0];
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->GetPosition() = pos; car->SetPosition(pos);
car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3])); car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3]));
CTheScripts::ClearSpaceForMissionEntity(pos, car); CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED); car->SetStatus(STATUS_ABANDONED);

View file

@ -108,7 +108,7 @@ CAnimViewer::Initialise(void) {
CTimeCycle::Initialise(); CTimeCycle::Initialise();
CCarCtrl::Init(); CCarCtrl::Init();
CPlayerPed *player = new CPlayerPed(); CPlayerPed *player = new CPlayerPed();
player->GetPosition() = CVector(0.0f, 0.0f, 0.0f); player->SetPosition(0.0f, 0.0f, 0.0f);
CWorld::Players[0].m_pPed = player; CWorld::Players[0].m_pPed = player;
CDraw::SetFOV(120.0f); CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f; CDraw::ms_fLODDistance = 500.0f;
@ -292,14 +292,14 @@ CAnimViewer::Update(void)
} }
newEntity->bIsStuck = true; newEntity->bIsStuck = true;
} }
newEntity->GetPosition() = CVector(0.0f, 0.0f, 0.0f); newEntity->SetPosition(0.0f, 0.0f, 0.0f);
CWorld::Add(newEntity); CWorld::Add(newEntity);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
} }
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) { if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
} }
pTarget->GetPosition().z = 0.0f; pTarget->GetMatrix().GetPosition().z = 0.0f;
if (modelInfo->m_type != MITYPE_PED) { if (modelInfo->m_type != MITYPE_PED) {

View file

@ -470,19 +470,19 @@ CCamera::Process(void)
} }
} }
GetRight() = CrossProduct(CamUp, CamFront); // actually Left GetMatrix().GetRight() = CrossProduct(CamUp, CamFront); // actually Left
GetForward() = CamFront; GetMatrix().GetForward() = CamFront;
GetUp() = CamUp; GetMatrix().GetUp() = CamUp;
GetPosition() = CamSource; GetMatrix().GetPosition() = CamSource;
// Process Shake // Process Shake
float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f; float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f;
shakeStrength = clamp(shakeStrength, 0.0f, 2.0f); shakeStrength = clamp(shakeStrength, 0.0f, 2.0f);
int shakeRand = CGeneral::GetRandomNumber(); int shakeRand = CGeneral::GetRandomNumber();
float shakeOffset = shakeStrength*0.1f; float shakeOffset = shakeStrength*0.1f;
GetPosition().x += shakeOffset*((shakeRand&0xF)-7); GetMatrix().GetPosition().x += shakeOffset * ((shakeRand & 0xF) - 7);
GetPosition().y += shakeOffset*(((shakeRand&0xF0)>>4)-7); GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7);
GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7); GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7);
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER) if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150)); SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
@ -499,27 +499,27 @@ CCamera::Process(void)
CVector Front = Cams[2].Front; CVector Front = Cams[2].Front;
CVector Up = Cams[2].Up; CVector Up = Cams[2].Up;
GetRight() = CrossProduct(Up, Front); GetMatrix().GetRight() = CrossProduct(Up, Front);
GetForward() = Front; GetMatrix().GetForward() = Front;
GetUp() = Up; GetMatrix().GetUp() = Up;
GetPosition() = Source; GetMatrix().GetPosition() = Source;
CDraw::SetFOV(Cams[2].FOV); CDraw::SetFOV(Cams[2].FOV);
m_vecGameCamPos = Cams[ActiveCam].Source; m_vecGameCamPos = Cams[ActiveCam].Source;
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d(); *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d(); *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d(); *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d(); *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame)); RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame); RwFrameUpdateObjects(frame);
}else{ }else{
RwFrame *frame = RwCameraGetFrame(m_pRwCamera); RwFrame *frame = RwCameraGetFrame(m_pRwCamera);
m_vecGameCamPos = GetPosition(); m_vecGameCamPos = GetPosition();
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d(); *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition();
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d(); *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward();
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d(); *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp();
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d(); *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight();
RwMatrixUpdate(RwFrameGetMatrix(frame)); RwMatrixUpdate(RwFrameGetMatrix(frame));
RwFrameUpdateObjects(frame); RwFrameUpdateObjects(frame);
} }

View file

@ -12,9 +12,9 @@ CPlaceable::~CPlaceable(void) = default;
void void
CPlaceable::SetHeading(float angle) CPlaceable::SetHeading(float angle)
{ {
CVector pos = GetPosition(); CVector pos = GetMatrix().GetPosition();
m_matrix.SetRotateZ(angle); m_matrix.SetRotateZ(angle);
GetPosition() += pos; GetMatrix().Translate(pos);
} }
bool bool

View file

@ -10,7 +10,7 @@ public:
CPlaceable(void); CPlaceable(void);
virtual ~CPlaceable(void); virtual ~CPlaceable(void);
CVector &GetPosition(void) { return m_matrix.GetPosition(); } const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
void SetPosition(float x, float y, float z) { void SetPosition(float x, float y, float z) {
m_matrix.GetPosition().x = x; m_matrix.GetPosition().x = x;
m_matrix.GetPosition().y = y; m_matrix.GetPosition().y = y;

View file

@ -38,7 +38,7 @@ CPlayerInfo::SetPlayerSkin(char *skin)
LoadPlayerSkin(); LoadPlayerSkin();
} }
CVector& const CVector &
CPlayerInfo::GetPos() CPlayerInfo::GetPos()
{ {
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -430,7 +430,7 @@ CPlayerInfo::Process(void)
CPed::PedSetOutCarCB(0, m_pPed); CPed::PedSetOutCarCB(0, m_pPed);
CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f); CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
m_pPed->GetPosition() = sth; m_pPed->SetPosition(sth);
m_pPed->SetMoveState(PEDMOVE_STILL); m_pPed->SetMoveState(PEDMOVE_STILL);
m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed; m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
} }
@ -456,7 +456,7 @@ CPlayerInfo::Process(void)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f) if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
#else #else
if (carBelow->m_status != STATUS_WRECKED) if (carBelow->GetStatus() != STATUS_WRECKED)
#endif #endif
m_pPed->SetSeekBoatPosition(carBelow); m_pPed->SetSeekBoatPosition(carBelow);
} }

View file

@ -62,7 +62,7 @@ public:
void DeletePlayerSkin(); void DeletePlayerSkin();
void AwardMoneyForExplosion(CVehicle *vehicle); void AwardMoneyForExplosion(CVehicle *vehicle);
void SetPlayerSkin(char* skin); void SetPlayerSkin(char* skin);
CVector& GetPos(); const CVector &GetPos();
void Process(void); void Process(void);
void KillPlayer(void); void KillPlayer(void);
void ArrestPlayer(void); void ArrestPlayer(void);

View file

@ -523,7 +523,7 @@ void CRadar::DrawBlips()
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { } else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition(); const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
@ -562,8 +562,8 @@ void CRadar::DrawBlips()
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { } else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -629,7 +629,7 @@ void CRadar::DrawBlips()
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition(); const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
@ -678,8 +678,8 @@ void CRadar::DrawBlips()
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;

View file

@ -1417,7 +1417,7 @@ FindPlayerSpeed(void)
return ped->m_vecMoveSpeed; return ped->m_vecMoveSpeed;
} }
CVector & const CVector &
FindPlayerCentreOfWorld(int32 player) FindPlayerCentreOfWorld(int32 player)
{ {
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -1429,7 +1429,7 @@ FindPlayerCentreOfWorld(int32 player)
return CWorld::Players[player].m_pPed->GetPosition(); return CWorld::Players[player].m_pPed->GetPosition();
} }
CVector & const CVector &
FindPlayerCentreOfWorld_NoSniperShift(void) FindPlayerCentreOfWorld_NoSniperShift(void)
{ {
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -1824,12 +1824,7 @@ void
CWorld::RepositionOneObject(CEntity *pEntity) CWorld::RepositionOneObject(CEntity *pEntity)
{ {
int16 modelId = pEntity->m_modelIndex; int16 modelId = pEntity->m_modelIndex;
if(modelId == MI_SINGLESTREETLIGHTS1 || modelId == MI_SINGLESTREETLIGHTS2 || if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_SINGLESTREETLIGHTS3 || modelId == MI_DOUBLESTREETLIGHTS || modelId == MI_TREE1 ||
modelId == MI_TREE2 || modelId == MI_TREE3 || modelId == MI_TREE4 || modelId == MI_TREE5 ||
modelId == MI_TREE6 || modelId == MI_TREE7 || modelId == MI_TREE8 || modelId == MI_TREE9 ||
modelId == MI_TREE10 || modelId == MI_TREE11 || modelId == MI_TREE12 || modelId == MI_TREE13 ||
modelId == MI_TREE14 || modelId == MI_TRAFFICLIGHTS || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
@ -1837,7 +1832,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 || modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
modelId == MI_PARKTABLE) { modelId == MI_PARKTABLE) {
CVector &position = pEntity->GetPosition(); CVector &position = pEntity->GetMatrix().GetPosition();
float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
@ -1855,7 +1850,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
if(!bFound || fWaterLevel > fGroundZ) { if(!bFound || fWaterLevel > fGroundZ) {
CColModel *pColModel = pEntity->GetColModel(); CColModel *pColModel = pEntity->GetColModel();
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
pEntity->GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
} }
} }
} }

View file

@ -164,6 +164,6 @@ CVehicle *FindPlayerTrain(void);
CEntity *FindPlayerEntity(void); CEntity *FindPlayerEntity(void);
CVector FindPlayerCoors(void); CVector FindPlayerCoors(void);
CVector &FindPlayerSpeed(void); CVector &FindPlayerSpeed(void);
CVector &FindPlayerCentreOfWorld(int32 player); const CVector &FindPlayerCentreOfWorld(int32 player);
CVector &FindPlayerCentreOfWorld_NoSniperShift(void); const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
float FindPlayerHeading(void); float FindPlayerHeading(void);

View file

@ -317,7 +317,7 @@ CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phy
CWorld::Remove(phys); CWorld::Remove(phys);
phys->GetMatrix() = other->GetMatrix(); phys->GetMatrix() = other->GetMatrix();
phys->GetPosition() = pos; phys->SetPosition(pos);
phys->m_vecMoveSpeed = other->m_vecMoveSpeed; phys->m_vecMoveSpeed = other->m_vecMoveSpeed;
phys->GetMatrix().UpdateRW(); phys->GetMatrix().UpdateRW();
phys->UpdateRwFrame(); phys->UpdateRwFrame();
@ -412,7 +412,7 @@ CPhysical::GetSpeed(const CVector &r)
void void
CPhysical::ApplyMoveSpeed(void) CPhysical::ApplyMoveSpeed(void)
{ {
GetPosition() += m_vecMoveSpeed * CTimer::GetTimeStep(); GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep());
} }
void void
@ -1167,7 +1167,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
float f = Min(Abs(dir.z), 0.9f); float f = Min(Abs(dir.z), 0.9f);
dir.z = 0.0f; dir.z = 0.0f;
dir.Normalise(); dir.Normalise();
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f); B->GetMatrix().Translate(dir * colpoints[mostColliding].depth / (1.0f - f));
// BUG? how can that ever happen? A is a Ped // BUG? how can that ever happen? A is a Ped
if(B->IsVehicle()) if(B->IsVehicle())
B->ProcessEntityCollision(A, colpoints); B->ProcessEntityCollision(A, colpoints);
@ -1184,7 +1184,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(!doShift) if(!doShift)
return false; return false;
GetPosition() += shift; GetMatrix().Translate(shift);
if(boat) if(boat)
ProcessEntityCollision(boat, colpoints); ProcessEntityCollision(boat, colpoints);
return true; return true;

View file

@ -9,11 +9,6 @@ public:
#ifdef RWCORE_H #ifdef RWCORE_H
CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {} CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
RwV3d toRwV3d(void) const {
RwV3d vecRw = { this->x, this->y, this->z };
return vecRw;
}
operator RwV3d (void) const { operator RwV3d (void) const {
RwV3d vecRw = { this->x, this->y, this->z }; RwV3d vecRw = { this->x, this->y, this->z };
return vecRw; return vecRw;
@ -22,10 +17,6 @@ public:
operator RwV3d *(void) { operator RwV3d *(void) {
return (RwV3d*)this; return (RwV3d*)this;
} }
operator RwV3d &(void) {
return *((RwV3d*)this);
}
#endif #endif
// (0,1,0) means no rotation. So get right vector and its atan // (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); } float Heading(void) const { return Atan2(-x, y); }

View file

@ -2019,7 +2019,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
} }
if (seatPosMult > 0.2f || vehIsUpsideDown) { if (seatPosMult > 0.2f || vehIsUpsideDown) {
GetPosition() = neededPos; SetPosition(neededPos);
SetHeading(m_fRotationCur); SetHeading(m_fRotationCur);
} else { } else {
@ -6504,7 +6504,7 @@ CPed::LineUpPedWithTrain(void)
lineUpPos += (GetPosition() - lineUpPos) * percentageLeft; lineUpPos += (GetPosition() - lineUpPos) * percentageLeft;
} }
GetPosition() = lineUpPos; SetPosition(lineUpPos);
SetHeading(m_fRotationCur); SetHeading(m_fRotationCur);
} }
@ -8684,7 +8684,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
carHighestZ = (car->GetMatrix() * CVector(0.0f, vehColMaxY, vehColMaxZ)).z; carHighestZ = (car->GetMatrix() * CVector(0.0f, vehColMaxY, vehColMaxZ)).z;
float highestZDist = carHighestZ - GetPosition().z; float highestZDist = carHighestZ - GetPosition().z;
if (highestZDist > 0.0f) { if (highestZDist > 0.0f) {
GetPosition().z += 0.5f * highestZDist; GetMatrix().GetPosition().z += 0.5f * highestZDist;
carHighestZ += highestZDist * 0.25f; carHighestZ += highestZDist * 0.25f;
} }
carLength = vehColMaxY; carLength = vehColMaxY;
@ -9959,7 +9959,7 @@ CPed::ProcessControl(void)
} }
} else if (!bVehEnterDoorIsBlocked) { } else if (!bVehEnterDoorIsBlocked) {
if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) { if (collidingVeh->GetStatus() != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
SetDirectionToWalkAroundObject(collidingVeh); SetDirectionToWalkAroundObject(collidingVeh);
@ -10169,8 +10169,8 @@ CPed::ProcessControl(void)
} }
if (flyDir != 0 && !bSomeVCflag1) { if (flyDir != 0 && !bSomeVCflag1) {
GetPosition() = (flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point); SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
GetPosition().z += FEET_OFFSET; GetMatrix().GetPosition().z += FEET_OFFSET;
GetMatrix().UpdateRW(); GetMatrix().UpdateRW();
SetLanding(); SetLanding();
bIsStanding = true; bIsStanding = true;
@ -10184,7 +10184,7 @@ CPed::ProcessControl(void)
forceDir.z = 4.0f; forceDir.z = 4.0f;
ApplyMoveForce(forceDir); ApplyMoveForce(forceDir);
GetPosition() += 0.25f * offsetToCheck; GetMatrix().GetPosition() += 0.25f * offsetToCheck;
m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(offsetToCheck.x, offsetToCheck.y, 0.0f, 0.0f); m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(offsetToCheck.x, offsetToCheck.y, 0.0f, 0.0f);
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
@ -10276,13 +10276,13 @@ CPed::ProcessControl(void)
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) { if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) { if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + foundCol.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW(); GetMatrix().UpdateRW();
if (bSomeVCflag1) if (bSomeVCflag1)
bSomeVCflag1 = false; bSomeVCflag1 = false;
} }
#else #else
GetPosition().z = FEET_OFFSET + foundCol.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW(); GetMatrix().UpdateRW();
#endif #endif
SetLanding(); SetLanding();
@ -11562,7 +11562,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
#endif #endif
CPedPlacement::FindZCoorForPed(&posAfterBeingDragged); CPedPlacement::FindZCoorForPed(&posAfterBeingDragged);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->GetPosition() = posAfterBeingDragged; ped->SetPosition(posAfterBeingDragged);
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) { if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) {
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
@ -12187,7 +12187,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
CVector posFromZ = ped->GetPosition(); CVector posFromZ = ped->GetPosition();
CPedPlacement::FindZCoorForPed(&posFromZ); CPedPlacement::FindZCoorForPed(&posFromZ);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->GetPosition() = posFromZ; ped->SetPosition(posFromZ);
veh = ped->m_pMyVehicle; veh = ped->m_pMyVehicle;
if (veh) { if (veh) {
if (ped->m_nPedType == PEDTYPE_PROSTITUTE) { if (ped->m_nPedType == PEDTYPE_PROSTITUTE) {
@ -12310,7 +12310,7 @@ CPed::PedSetOutTrainCB(CAnimBlendAssociation *animAssoc, void *arg)
posAfterExit += ped->GetPosition(); posAfterExit += ped->GetPosition();
CPedPlacement::FindZCoorForPed(&posAfterExit); CPedPlacement::FindZCoorForPed(&posAfterExit);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->GetPosition() = posAfterExit; ped->SetPosition(posAfterExit);
ped->SetHeading(ped->m_fRotationCur); ped->SetHeading(ped->m_fRotationCur);
veh->RemovePassenger(ped); veh->RemovePassenger(ped);
} }
@ -12342,7 +12342,7 @@ CPed::PlacePedOnDryLand(void)
foundColZ = foundCol.point.z; foundColZ = foundCol.point.z;
if (foundColZ >= waterLevel) { if (foundColZ >= waterLevel) {
posToCheck.z = 0.8f + foundColZ; posToCheck.z = 0.8f + foundColZ;
GetPosition() = posToCheck; SetPosition(posToCheck);
bIsStanding = true; bIsStanding = true;
bWasStanding = true; bWasStanding = true;
return true; return true;
@ -12360,7 +12360,7 @@ CPed::PlacePedOnDryLand(void)
return false; return false;
posToCheck.z = 0.8f + foundColZ; posToCheck.z = 0.8f + foundColZ;
GetPosition() = posToCheck; SetPosition(posToCheck);
bIsStanding = true; bIsStanding = true;
bWasStanding = true; bWasStanding = true;
return true; return true;
@ -12388,7 +12388,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
finalPos = finalLocalPos + ped->GetPosition(); finalPos = finalLocalPos + ped->GetPosition();
CPedPlacement::FindZCoorForPed(&finalPos); CPedPlacement::FindZCoorForPed(&finalPos);
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->GetPosition() = finalPos; ped->SetPosition(finalPos);
if (veh) { if (veh) {
ped->m_fRotationDest = veh->GetForward().Heading() - HALFPI; ped->m_fRotationDest = veh->GetForward().Heading() - HALFPI;
@ -12524,11 +12524,11 @@ CPed::PositionPedOutOfCollision(void)
// We refrain from using posNearVeh, probably because of it may be top of the vehicle. // We refrain from using posNearVeh, probably because of it may be top of the vehicle.
if (putSomewhereClose) { if (putSomewhereClose) {
GetPosition() = posSomewhereClose; SetPosition(posSomewhereClose);
} else { } else {
CVector vehSize = veh->GetModelInfo()->GetColModel()->boundingBox.max; CVector vehSize = veh->GetModelInfo()->GetColModel()->boundingBox.max;
GetPosition() = posNearVeh; posNearVeh.z += vehSize.z;
GetPosition().z += vehSize.z; SetPosition(posNearVeh);
} }
return true; return true;
} }
@ -12912,8 +12912,8 @@ CPed::ProcessObjective(void)
int chosenModel = CCarCtrl::ChooseModel(&zoneInfo, &ourPos, &chosenCarClass); int chosenModel = CCarCtrl::ChooseModel(&zoneInfo, &ourPos, &chosenCarClass);
CAutomobile *newVeh = new CAutomobile(chosenModel, RANDOM_VEHICLE); CAutomobile *newVeh = new CAutomobile(chosenModel, RANDOM_VEHICLE);
if (newVeh) { if (newVeh) {
newVeh->GetPosition() = ThePaths.m_pathNodes[closestNode].GetPosition(); newVeh->GetMatrix().GetPosition() = ThePaths.m_pathNodes[closestNode].GetPosition();
newVeh->GetPosition().z += 4.0f; newVeh->GetMatrix().GetPosition().z += 4.0f;
newVeh->SetHeading(DEGTORAD(200.0f)); newVeh->SetHeading(DEGTORAD(200.0f));
newVeh->SetStatus(STATUS_ABANDONED); newVeh->SetStatus(STATUS_ABANDONED);
newVeh->m_nDoorLock = CARLOCK_UNLOCKED; newVeh->m_nDoorLock = CARLOCK_UNLOCKED;
@ -13424,7 +13424,7 @@ CPed::ProcessObjective(void)
} }
} }
if (foundSeat) { if (foundSeat) {
GetPosition() = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType); SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType));
SetEnterCar(m_carInObjective, m_vehEnterType); SetEnterCar(m_carInObjective, m_vehEnterType);
} }
} }
@ -14692,12 +14692,12 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
bStillOnValidPoly = true; bStillOnValidPoly = true;
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if(!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) { if(!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bSomeVCflag1) if (bSomeVCflag1)
bSomeVCflag1 = false; bSomeVCflag1 = false;
} }
#else #else
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif #endif
m_vecMoveSpeed.z = 0.0f; m_vecMoveSpeed.z = 0.0f;
@ -14770,12 +14770,12 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
} }
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) { if (!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bSomeVCflag1) if (bSomeVCflag1)
bSomeVCflag1 = false; bSomeVCflag1 = false;
} }
#else #else
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif #endif
m_nSurfaceTouched = intersectionPoint.surfaceB; m_nSurfaceTouched = intersectionPoint.surfaceB;
if (m_nSurfaceTouched == SURFACE_STONE) { if (m_nSurfaceTouched == SURFACE_STONE) {
@ -14880,7 +14880,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
float speed = m_vecMoveSpeed.Magnitude2D(); float speed = m_vecMoveSpeed.Magnitude2D();
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed); sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed); sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed);
GetPosition().z -= 0.05f; GetMatrix().GetPosition().z -= 0.05f;
bSomeVCflag1 = true; bSomeVCflag1 = true;
} }
#endif #endif
@ -15669,7 +15669,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
zForPed = Max(foundColZ, foundColZ2); zForPed = Max(foundColZ, foundColZ2);
if (zForPed > -99.0f) if (zForPed > -99.0f)
GetPosition().z = FEET_OFFSET + zForPed; GetMatrix().GetPosition().z = FEET_OFFSET + zForPed;
} else { } else {
if (veh->GetUp().z > -0.8f) { if (veh->GetUp().z > -0.8f) {
bool addDoorSmoke = false; bool addDoorSmoke = false;
@ -17002,7 +17002,7 @@ CPed::WarpPedIntoCar(CVehicle *car)
} }
CWorld::Remove(this); CWorld::Remove(this);
GetPosition() = car->GetPosition(); SetPosition(car->GetPosition());
CWorld::Add(this); CWorld::Add(this);
if (car->bIsAmbulanceOnDuty) { if (car->bIsAmbulanceOnDuty) {
@ -17670,7 +17670,7 @@ CPed::SetExitBoat(CVehicle *boat)
m_pCurSurface = boat; m_pCurSurface = boat;
m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface); m_pCurSurface->RegisterReference((CEntity**)&m_pCurSurface);
} }
GetPosition() = firstPos; SetPosition(firstPos);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_vecMoveSpeed = boat->m_vecMoveSpeed; m_vecMoveSpeed = boat->m_vecMoveSpeed;
bTryingToReachDryLand = true; bTryingToReachDryLand = true;
@ -17725,7 +17725,7 @@ CPed::SetExitBoat(CVehicle *boat)
return; return;
} }
*/ } */ }
GetPosition() = newPos; SetPosition(newPos);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_vecMoveSpeed = boat->m_vecMoveSpeed; m_vecMoveSpeed = boat->m_vecMoveSpeed;
#endif #endif
@ -17758,9 +17758,9 @@ void
CPed::Load(uint8*& buf) CPed::Load(uint8*& buf)
{ {
SkipSaveBuf(buf, 52); SkipSaveBuf(buf, 52);
GetPosition().x = ReadSaveBuf<float>(buf); GetMatrix().GetPosition().x = ReadSaveBuf<float>(buf);
GetPosition().y = ReadSaveBuf<float>(buf); GetMatrix().GetPosition().y = ReadSaveBuf<float>(buf);
GetPosition().z = ReadSaveBuf<float>(buf); GetMatrix().GetPosition().z = ReadSaveBuf<float>(buf);
SkipSaveBuf(buf, 288); SkipSaveBuf(buf, 288);
CharCreatedBy = ReadSaveBuf<uint8>(buf); CharCreatedBy = ReadSaveBuf<uint8>(buf);
SkipSaveBuf(buf, 351); SkipSaveBuf(buf, 351);

View file

@ -37,7 +37,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
} }
CEntity* CEntity*
CPedPlacement::IsPositionClearOfCars(CVector* pos) CPedPlacement::IsPositionClearOfCars(Const CVector *pos)
{ {
return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false); return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false);
} }

View file

@ -3,6 +3,6 @@
class CPedPlacement { class CPedPlacement {
public: public:
static void FindZCoorForPed(CVector* pos); static void FindZCoorForPed(CVector* pos);
static CEntity* IsPositionClearOfCars(CVector*); static CEntity* IsPositionClearOfCars(Const CVector*);
static bool IsPositionClearForPed(CVector*); static bool IsPositionClearForPed(CVector*);
}; };

View file

@ -495,7 +495,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_CIVFEMALE: case PEDTYPE_CIVFEMALE:
{ {
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType); CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
if (ms_bGivePedsWeapons) { if (ms_bGivePedsWeapons) {
@ -509,7 +509,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_COP: case PEDTYPE_COP:
{ {
CCopPed *ped = new CCopPed((eCopType)miOrCopType); CCopPed *ped = new CCopPed((eCopType)miOrCopType);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
return ped; return ped;
@ -525,7 +525,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_GANG9: case PEDTYPE_GANG9:
{ {
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType); CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
@ -540,7 +540,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_EMERGENCY: case PEDTYPE_EMERGENCY:
{ {
CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_EMERGENCY); CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_EMERGENCY);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
return ped; return ped;
@ -548,7 +548,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_FIREMAN: case PEDTYPE_FIREMAN:
{ {
CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_FIREMAN); CEmergencyPed *ped = new CEmergencyPed(PEDTYPE_FIREMAN);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
return ped; return ped;
@ -557,7 +557,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
case PEDTYPE_PROSTITUTE: case PEDTYPE_PROSTITUTE:
{ {
CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType); CCivilianPed *ped = new CCivilianPed(pedType, miOrCopType);
ped->GetPosition() = coors; ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f); ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped); CWorld::Add(ped);
return ped; return ped;
@ -880,22 +880,22 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
if (veh->bIsLocked || !veh->CanBeDeleted()) { if (veh->bIsLocked || !veh->CanBeDeleted()) {
switch (movedVehicleCount & 3) { switch (movedVehicleCount & 3) {
case 0: case 0:
veh->GetPosition() = RegenerationPoint_a; veh->SetPosition(RegenerationPoint_a);
break; break;
case 1: case 1:
veh->GetPosition() = RegenerationPoint_b; veh->SetPosition(RegenerationPoint_b);
break; break;
case 2: case 2:
veh->GetPosition() = CVector(RegenerationPoint_a.x, RegenerationPoint_b.y, RegenerationPoint_a.z); veh->SetPosition(RegenerationPoint_a.x, RegenerationPoint_b.y, RegenerationPoint_a.z);
break; break;
case 3: case 3:
veh->GetPosition() = CVector(RegenerationPoint_b.x, RegenerationPoint_a.y, RegenerationPoint_a.z); veh->SetPosition(RegenerationPoint_b.x, RegenerationPoint_a.y, RegenerationPoint_a.z);
break; break;
default: default:
break; break;
} }
veh->GetPosition().z += (movedVehicleCount / 4) * 7.0f; veh->GetMatrix().GetPosition().z += (movedVehicleCount / 4) * 7.0f;
veh->GetForward() = RegenerationForward; veh->GetMatrix().GetForward() = RegenerationForward;
((CAutomobile*)veh)->PlaceOnRoadProperly(); ((CAutomobile*)veh)->PlaceOnRoadProperly();
CCarCtrl::JoinCarWithRoadSystem(veh); CCarCtrl::JoinCarWithRoadSystem(veh);
CTheScripts::ClearSpaceForMissionEntity(veh->GetPosition(), veh); CTheScripts::ClearSpaceForMissionEntity(veh->GetPosition(), veh);
@ -924,14 +924,14 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
CWorld::Remove(ped); CWorld::Remove(ped);
delete ped; delete ped;
} else if (ped->m_nPedType != PEDTYPE_PLAYER1 && ped->m_nPedType != PEDTYPE_PLAYER2) { } else if (ped->m_nPedType != PEDTYPE_PLAYER1 && ped->m_nPedType != PEDTYPE_PLAYER2) {
ped->GetPosition() = RegenerationPoint_a; ped->SetPosition(RegenerationPoint_a);
bool foundGround; bool foundGround;
float groundZ = CWorld::FindGroundZFor3DCoord(ped->GetPosition().x, ped->GetPosition().y, float groundZ = CWorld::FindGroundZFor3DCoord(ped->GetPosition().x, ped->GetPosition().y,
ped->GetPosition().z + 2.0f, &foundGround); ped->GetPosition().z + 2.0f, &foundGround);
if (foundGround) { if (foundGround) {
ped->GetPosition().z = 1.0f + groundZ; ped->GetMatrix().GetPosition().z = 1.0f + groundZ;
//ped->GetPosition().z += 0.0f; //ped->GetPosition().z += 0.0f;
CTheScripts::ClearSpaceForMissionEntity(ped->GetPosition(), ped); CTheScripts::ClearSpaceForMissionEntity(ped->GetPosition(), ped);
} }

View file

@ -255,9 +255,9 @@ GenericLoad()
buf = (work_buff + 0x40); buf = (work_buff + 0x40);
ReadDataFromBufferPointer(buf, saveSize); ReadDataFromBufferPointer(buf, saveSize);
ReadDataFromBufferPointer(buf, CGame::currLevel); ReadDataFromBufferPointer(buf, CGame::currLevel);
ReadDataFromBufferPointer(buf, TheCamera.GetPosition().x); ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().x);
ReadDataFromBufferPointer(buf, TheCamera.GetPosition().y); ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().y);
ReadDataFromBufferPointer(buf, TheCamera.GetPosition().z); ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().z);
ReadDataFromBufferPointer(buf, CClock::ms_nMillisecondsPerGameMinute); ReadDataFromBufferPointer(buf, CClock::ms_nMillisecondsPerGameMinute);
ReadDataFromBufferPointer(buf, CClock::ms_nLastClockTick); ReadDataFromBufferPointer(buf, CClock::ms_nLastClockTick);
ReadDataFromBufferPointer(buf, CClock::ms_nGameClockHours); ReadDataFromBufferPointer(buf, CClock::ms_nGameClockHours);
@ -538,9 +538,9 @@ RestoreForStartLoad()
} else { } else {
uint8 *_buf = buf + sizeof(int32) + sizeof(wchar[24]) + sizeof(SYSTEMTIME) + sizeof(SIZE_OF_ONE_GAME_IN_BYTES); uint8 *_buf = buf + sizeof(int32) + sizeof(wchar[24]) + sizeof(SYSTEMTIME) + sizeof(SIZE_OF_ONE_GAME_IN_BYTES);
ReadDataFromBufferPointer(_buf, CGame::currLevel); ReadDataFromBufferPointer(_buf, CGame::currLevel);
ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().x); ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().x);
ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().y); ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().y);
ReadDataFromBufferPointer(_buf, TheCamera.GetPosition().z); ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().z);
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel);
CCollision::SortOutCollisionAfterLoad(); CCollision::SortOutCollisionAfterLoad();

View file

@ -3186,10 +3186,10 @@ CAutomobile::PlaceOnRoadProperly(void)
float c = Cos(angle); float c = Cos(angle);
float s = Sin(angle); float s = Sin(angle);
GetRight() = CVector((front.y - rear.y)/len, -(front.x - rear.x)/len, 0.0f); GetMatrix().GetRight() = CVector((front.y - rear.y) / len, -(front.x - rear.x) / len, 0.0f);
GetForward() = CVector(-c*GetRight().y, c*GetRight().x, s); GetMatrix().GetForward() = CVector(-c * GetRight().y, c * GetRight().x, s);
GetUp() = CrossProduct(GetRight(), GetForward()); GetMatrix().GetUp() = CrossProduct(GetRight(), GetForward());
GetPosition() = CVector((front.x + rear.x)/2.0f, (front.y + rear.y)/2.0f, (frontZ + rearZ)/2.0f + GetHeightAboveRoad()); GetMatrix().GetPosition() = CVector((front.x + rear.x) / 2.0f, (front.y + rear.y) / 2.0f, (frontZ + rearZ) / 2.0f + GetHeightAboveRoad());
} }
void void
@ -4408,7 +4408,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(GetUp().z > 0.0f){ if(GetUp().z > 0.0f){
// simulate fast upward movement if going fast // simulate fast upward movement if going fast
float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr(); float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr();
obj->GetPosition() += GetUp()*speed; obj->GetMatrix().Translate(GetUp()*speed);
} }
} }
obj->ApplyMoveForce(dist); obj->ApplyMoveForce(dist);

View file

@ -359,8 +359,8 @@ CPlane::ProcessControl(void)
CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p; CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p;
// Now set matrix // Now set matrix
GetPosition() = (posRear + posFront)/2.0f; GetMatrix().GetPosition() = (posRear + posFront) / 2.0f;
GetPosition().z += 4.3f; GetMatrix().GetPosition().z += 4.3f;
CVector fwd = posFront - posRear; CVector fwd = posFront - posRear;
fwd.Normalise(); fwd.Normalise();
if(pitch != 0.0f){ if(pitch != 0.0f){
@ -375,9 +375,9 @@ CPlane::ProcessControl(void)
right.z += 3.0f*roll.z; right.z += 3.0f*roll.z;
right.Normalise(); right.Normalise();
CVector up = CrossProduct(right, fwd); CVector up = CrossProduct(right, fwd);
GetRight() = right; GetMatrix().GetRight() = right;
GetUp() = up; GetMatrix().GetUp() = up;
GetForward() = fwd; GetMatrix().GetForward() = fwd;
// Set speed // Set speed
m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f; m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f;
@ -511,8 +511,8 @@ CPlane::ProcessControl(void)
CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p; CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p;
// Now set matrix // Now set matrix
GetPosition() = (posRear + posFront)/2.0f; GetMatrix().GetPosition() = (posRear + posFront) / 2.0f;
GetPosition().z += 1.0f; GetMatrix().GetPosition().z += 1.0f;
CVector fwd = posFront - posRear; CVector fwd = posFront - posRear;
fwd.Normalise(); fwd.Normalise();
CVector fwd2 = posFront2 - posRear; CVector fwd2 = posFront2 - posRear;
@ -522,9 +522,9 @@ CPlane::ProcessControl(void)
right.z += 3.0f*roll.z; right.z += 3.0f*roll.z;
right.Normalise(); right.Normalise();
CVector up = CrossProduct(right, fwd); CVector up = CrossProduct(right, fwd);
GetRight() = right; GetMatrix().GetRight() = right;
GetUp() = up; GetMatrix().GetUp() = up;
GetForward() = fwd; GetMatrix().GetForward() = fwd;
// Set speed // Set speed
m_vecMoveSpeed = fwd*planePathSpeed/60.0f; m_vecMoveSpeed = fwd*planePathSpeed/60.0f;