summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/PathFind.cpp8
-rw-r--r--src/control/Pickups.cpp18
-rw-r--r--src/control/RoadBlocks.cpp6
3 files changed, 22 insertions, 10 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index bf72199d..80d40b45 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -200,8 +200,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
const float fBoundMaxY = boundingBox.max.y + 0.3f;
const float fBoundMinY = boundingBox.min.y - 0.3f;
const float fBoundMaxX = boundingBox.max.x + 0.3f;
- const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
- const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
+ const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
+ const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
const float fBoundRadius = pEntity->GetBoundRadius();
CVector vecBoundCentre;
pEntity->GetBoundCentre(vecBoundCentre);
@@ -215,8 +215,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
if (!pathNodes[x][y].bBlockade) {
const float pointY = y * 0.7f + fDistanceY;
CVector2D point(pointX, pointY);
- if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
- float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
+ if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
+ float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
pathNodes[x][y].bBlockade = true;
}
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 7bc88321..0428ddae 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -1008,8 +1008,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
if (!entity->bDoNotRender) {
- float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
- float modifiedSin = 0.3f * (s + 1.0f);
+ float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
#ifdef FIX_BUGS
int16 colorId = 0;
@@ -1149,7 +1148,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
if (model == MI_MINIGUN || model == MI_MINIGUN2)
scale = 1.2f;
- entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale);
+ float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
+ float c = Cos(angle) * scale;
+ float s = Sin(angle) * scale;
+
+ // we know from SA they were setting each field manually like this
+ entity->GetMatrix().rx = c;
+ entity->GetMatrix().ry = s;
+ entity->GetMatrix().rz = 0.0f;
+ entity->GetMatrix().fx = -s;
+ entity->GetMatrix().fy = c;
+ entity->GetMatrix().fz = 0.0f;
+ entity->GetMatrix().ux = 0.0f;
+ entity->GetMatrix().uy = 0.0f;
+ entity->GetMatrix().uz = scale;
if (entity->GetModelIndex() == MI_MINIGUN2) {
CMatrix matrix1;
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 4f714e80..46eee71f 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -64,7 +64,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
for (int32 i = 0; i < 2; i++) {
const int32 roadBlockIndex = i + 2 * roadBlockType;
- CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
+ CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
int32 modelInfoId = MI_COP;
eCopType copType = COP_STREET;
switch (pVehicle->GetModelIndex())
@@ -239,10 +239,10 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
tmp.GetPosition().z += fModelRadius - 0.6f;
- pVehicle->m_matrix = tmp;
+ pVehicle->SetMatrix(tmp);
pVehicle->PlaceOnRoadProperly();
pVehicle->SetIsStatic(false);
- pVehicle->m_matrix.UpdateRW();
+ pVehicle->GetMatrix().UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->bIsLocked = false;