diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-05 14:40:56 +0300 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-05 14:40:56 +0300 |
commit | ee261c996b6864ad65f086d97cdb47469c10a651 (patch) | |
tree | f594437503cd2ef4116e9b8c8b6560b970c77541 /src/core | |
parent | ae0c83fa01b05dc2ee70acb2bd4d0e8a3945630c (diff) | |
parent | 84c9484e55874c57c1c017cb2394e0c6b2f32303 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/AnimViewer.cpp | 6 | ||||
-rw-r--r-- | src/core/Camera.cpp | 38 | ||||
-rw-r--r-- | src/core/Placeable.cpp | 4 | ||||
-rw-r--r-- | src/core/Placeable.h | 2 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 6 | ||||
-rw-r--r-- | src/core/PlayerInfo.h | 2 | ||||
-rw-r--r-- | src/core/Radar.cpp | 12 | ||||
-rw-r--r-- | src/core/World.cpp | 15 | ||||
-rw-r--r-- | src/core/World.h | 4 |
9 files changed, 42 insertions, 47 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 7afda509..b4763627 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -108,7 +108,7 @@ CAnimViewer::Initialise(void) { CTimeCycle::Initialise(); CCarCtrl::Init(); 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; CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; @@ -292,14 +292,14 @@ CAnimViewer::Update(void) } newEntity->bIsStuck = true; } - newEntity->GetPosition() = CVector(0.0f, 0.0f, 0.0f); + newEntity->SetPosition(0.0f, 0.0f, 0.0f); CWorld::Add(newEntity); TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); } if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) { ((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) { diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 379b9c36..3f4684e7 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -470,19 +470,19 @@ CCamera::Process(void) } } - GetRight() = CrossProduct(CamUp, CamFront); // actually Left - GetForward() = CamFront; - GetUp() = CamUp; - GetPosition() = CamSource; + GetMatrix().GetRight() = CrossProduct(CamUp, CamFront); // actually Left + GetMatrix().GetForward() = CamFront; + GetMatrix().GetUp() = CamUp; + GetMatrix().GetPosition() = CamSource; // Process Shake float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f; shakeStrength = clamp(shakeStrength, 0.0f, 2.0f); int shakeRand = CGeneral::GetRandomNumber(); float shakeOffset = shakeStrength*0.1f; - GetPosition().x += shakeOffset*((shakeRand&0xF)-7); - GetPosition().y += shakeOffset*(((shakeRand&0xF0)>>4)-7); - GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7); + GetMatrix().GetPosition().x += shakeOffset * ((shakeRand & 0xF) - 7); + GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7); + GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7); if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER) SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150)); @@ -499,27 +499,27 @@ CCamera::Process(void) CVector Front = Cams[2].Front; CVector Up = Cams[2].Up; - GetRight() = CrossProduct(Up, Front); - GetForward() = Front; - GetUp() = Up; - GetPosition() = Source; + GetMatrix().GetRight() = CrossProduct(Up, Front); + GetMatrix().GetForward() = Front; + GetMatrix().GetUp() = Up; + GetMatrix().GetPosition() = Source; CDraw::SetFOV(Cams[2].FOV); m_vecGameCamPos = Cams[ActiveCam].Source; - *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d(); - *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d(); - *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d(); - *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d(); + *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition(); + *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward(); + *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp(); + *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight(); RwMatrixUpdate(RwFrameGetMatrix(frame)); RwFrameUpdateObjects(frame); }else{ RwFrame *frame = RwCameraGetFrame(m_pRwCamera); m_vecGameCamPos = GetPosition(); - *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d(); - *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d(); - *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d(); - *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d(); + *RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition(); + *RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward(); + *RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp(); + *RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight(); RwMatrixUpdate(RwFrameGetMatrix(frame)); RwFrameUpdateObjects(frame); } diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp index 99ca5659..69b3d3ea 100644 --- a/src/core/Placeable.cpp +++ b/src/core/Placeable.cpp @@ -12,9 +12,9 @@ CPlaceable::~CPlaceable(void) = default; void CPlaceable::SetHeading(float angle) { - CVector pos = GetPosition(); + CVector pos = GetMatrix().GetPosition(); m_matrix.SetRotateZ(angle); - GetPosition() += pos; + GetMatrix().Translate(pos); } bool diff --git a/src/core/Placeable.h b/src/core/Placeable.h index d39bb0d9..7e858283 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -10,7 +10,7 @@ public: 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) { m_matrix.GetPosition().x = x; m_matrix.GetPosition().y = y; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 7dadbf28..0cd69119 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -38,7 +38,7 @@ CPlayerInfo::SetPlayerSkin(char *skin) LoadPlayerSkin(); } -CVector& +const CVector & CPlayerInfo::GetPos() { #ifdef FIX_BUGS @@ -430,7 +430,7 @@ CPlayerInfo::Process(void) CPed::PedSetOutCarCB(0, m_pPed); 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); - m_pPed->GetPosition() = sth; + m_pPed->SetPosition(sth); m_pPed->SetMoveState(PEDMOVE_STILL); m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed; } @@ -456,7 +456,7 @@ CPlayerInfo::Process(void) #ifdef VC_PED_PORTS if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f) #else - if (carBelow->m_status != STATUS_WRECKED) + if (carBelow->GetStatus() != STATUS_WRECKED) #endif m_pPed->SetSeekBoatPosition(carBelow); } diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index ff31418c..8d0a27b6 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -62,7 +62,7 @@ public: void DeletePlayerSkin(); void AwardMoneyForExplosion(CVehicle *vehicle); void SetPlayerSkin(char* skin); - CVector& GetPos(); + const CVector &GetPos(); void Process(void); void KillPlayer(void); void ArrestPlayer(void); diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index b4c22068..ca28620e 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -523,7 +523,7 @@ void CRadar::DrawBlips() DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); } else { #ifdef TRIANGULAR_BLIPS - CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); + const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &blipPos = blipEntity->GetPosition(); uint8 mode = BLIP_MODE_TRIANGULAR_UP; 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)); } else { #ifdef TRIANGULAR_BLIPS - CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); - CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; + const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); + const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; 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; @@ -629,7 +629,7 @@ void CRadar::DrawBlips() else #ifdef TRIANGULAR_BLIPS { - CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); + const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector &blipPos = blipEntity->GetPosition(); uint8 mode = BLIP_MODE_TRIANGULAR_UP; if (blipPos.z - pos.z <= 2.0f) { @@ -678,8 +678,8 @@ void CRadar::DrawBlips() else #ifdef TRIANGULAR_BLIPS { - CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); - CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; + const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); + const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; 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; diff --git a/src/core/World.cpp b/src/core/World.cpp index 2833c59c..e87d23f2 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1417,7 +1417,7 @@ FindPlayerSpeed(void) return ped->m_vecMoveSpeed; } -CVector & +const CVector & FindPlayerCentreOfWorld(int32 player) { #ifdef FIX_BUGS @@ -1429,7 +1429,7 @@ FindPlayerCentreOfWorld(int32 player) return CWorld::Players[player].m_pPed->GetPosition(); } -CVector & +const CVector & FindPlayerCentreOfWorld_NoSniperShift(void) { #ifdef FIX_BUGS @@ -1824,12 +1824,7 @@ void CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->m_modelIndex; - if(modelId == MI_SINGLESTREETLIGHTS1 || modelId == MI_SINGLESTREETLIGHTS2 || - 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 || + if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || 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_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || modelId == MI_PARKTABLE) { - CVector &position = pEntity->GetPosition(); + CVector &position = pEntity->GetMatrix().GetPosition(); float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - @@ -1855,7 +1850,7 @@ CWorld::RepositionOneObject(CEntity *pEntity) if(!bFound || fWaterLevel > fGroundZ) { CColModel *pColModel = pEntity->GetColModel(); 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; } } } diff --git a/src/core/World.h b/src/core/World.h index 991180af..ab3f0192 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -164,6 +164,6 @@ CVehicle *FindPlayerTrain(void); CEntity *FindPlayerEntity(void); CVector FindPlayerCoors(void); CVector &FindPlayerSpeed(void); -CVector &FindPlayerCentreOfWorld(int32 player); -CVector &FindPlayerCentreOfWorld_NoSniperShift(void); +const CVector &FindPlayerCentreOfWorld(int32 player); +const CVector &FindPlayerCentreOfWorld_NoSniperShift(void); float FindPlayerHeading(void); |