summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-12-18 01:58:09 +0100
committerSergeanur <s.anureev@yandex.ua>2020-12-18 01:58:09 +0100
commitcfda5eb148abdb502b049083c83f166460ccc8be (patch)
tree290b84a8053f37f3b676fd26314631a528f04630 /src
parentFix placement of some script functions (diff)
downloadre3-cfda5eb148abdb502b049083c83f166460ccc8be.tar
re3-cfda5eb148abdb502b049083c83f166460ccc8be.tar.gz
re3-cfda5eb148abdb502b049083c83f166460ccc8be.tar.bz2
re3-cfda5eb148abdb502b049083c83f166460ccc8be.tar.lz
re3-cfda5eb148abdb502b049083c83f166460ccc8be.tar.xz
re3-cfda5eb148abdb502b049083c83f166460ccc8be.tar.zst
re3-cfda5eb148abdb502b049083c83f166460ccc8be.zip
Diffstat (limited to '')
-rw-r--r--src/collision/Collision.cpp14
-rw-r--r--src/control/Replay.cpp24
-rw-r--r--src/control/Script6.cpp2
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/PlayerInfo.cpp626
-rw-r--r--src/core/PlayerInfo.h21
-rw-r--r--src/core/World.cpp96
-rw-r--r--src/core/World.h12
-rw-r--r--src/extras/screendroplets.cpp6
-rw-r--r--src/math/Matrix.h9
-rw-r--r--src/math/Vector.h25
-rw-r--r--src/math/VuVector.h13
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp2
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/EmergencyPed.cpp16
-rw-r--r--src/peds/Ped.h2
-rw-r--r--src/peds/PedFight.cpp2
-rw-r--r--src/peds/PedIK.h1
-rw-r--r--src/peds/PlayerPed.cpp2
-rw-r--r--src/render/Clouds.cpp2
-rw-r--r--src/render/Coronas.cpp6
-rw-r--r--src/render/Fluff.cpp4
-rw-r--r--src/render/Particle.cpp6
-rw-r--r--src/render/PointLights.cpp4
-rw-r--r--src/render/Renderer.cpp4
-rw-r--r--src/render/Shadows.cpp4
-rw-r--r--src/vehicles/Bike.cpp2
-rw-r--r--src/vehicles/Boat.cpp6
-rw-r--r--src/weapons/Explosion.cpp2
-rw-r--r--src/weapons/Weapon.cpp14
30 files changed, 449 insertions, 482 deletions
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp
index 20778345..c90390c4 100644
--- a/src/collision/Collision.cpp
+++ b/src/collision/Collision.cpp
@@ -499,7 +499,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
// If we don't intersect with the bounding box, no chance on the rest
if(!TestLineBox(*(CColLine*)newline, model.boundingBox))
@@ -1321,7 +1321,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1456,7 +1456,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
// transform line to model space
Invert(matrix, matTransform);
CVuVector newline[2];
- TransformPoints(newline, 2, matTransform, (RwV3d*)&line.p0, sizeof(CColLine)/2);
+ TransformPoints(newline, 2, matTransform, &line.p0, sizeof(CColLine)/2);
if(mindist < 1.0f)
newline[1] = newline[0] + (newline[1] - newline[0])*mindist;
@@ -1655,16 +1655,16 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matAB *= matrixA;
CVuVector bsphereAB; // bounding sphere of A in B space
- TransformPoint(bsphereAB, matAB, *(RwV3d*)modelA.boundingSphere.center); // inlined
+ TransformPoint(bsphereAB, matAB, modelA.boundingSphere.center); // inlined
bsphereAB.w = modelA.boundingSphere.radius;
if(!TestSphereBox(*(CColSphere*)&bsphereAB, modelB.boundingBox))
return 0;
// transform modelA's spheres and lines to B space
- TransformPoints(aSpheresA, modelA.numSpheres, matAB, (RwV3d*)&modelA.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresA, modelA.numSpheres, matAB, &modelA.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelA.numSpheres; i++)
aSpheresA[i].w = modelA.spheres[i].radius;
- TransformPoints(aLinesA, modelA.numLines*2, matAB, (RwV3d*)&modelA.lines->p0, sizeof(CColLine)/2);
+ TransformPoints(aLinesA, modelA.numLines*2, matAB, &modelA.lines->p0, sizeof(CColLine)/2);
// Test them against model B's bounding volumes
int numSpheresA = 0;
@@ -1681,7 +1681,7 @@ CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
matBA *= matrixB;
// transform modelB's spheres to A space
- TransformPoints(aSpheresB, modelB.numSpheres, matBA, (RwV3d*)&modelB.spheres->center, sizeof(CColSphere));
+ TransformPoints(aSpheresB, modelB.numSpheres, matBA, &modelB.spheres->center, sizeof(CColSphere));
for(i = 0; i < modelB.numSpheres; i++)
aSpheresB[i].w = modelB.spheres[i].radius;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 0c70d2f6..6f53c0ad 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -1218,10 +1218,10 @@ void CReplay::ProcessReplayCamera(void)
TheCamera.GetUp() = CVector(0.0f, 1.0f, 0.0f);
TheCamera.GetRight() = CVector(1.0f, 0.0f, 0.0f);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetRight();
+ pm->pos = TheCamera.GetPosition();
+ pm->at = TheCamera.GetForward();
+ pm->up = TheCamera.GetUp();
+ pm->right = TheCamera.GetRight();
break;
}
case REPLAYCAMMODE_FIXED:
@@ -1237,10 +1237,10 @@ void CReplay::ProcessReplayCamera(void)
TheCamera.GetMatrix().GetUp() = up;
TheCamera.GetMatrix().GetRight() = right;
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetMatrix().GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetMatrix().GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetMatrix().GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetMatrix().GetRight();
+ pm->pos = TheCamera.GetMatrix().GetPosition();
+ pm->at = TheCamera.GetMatrix().GetForward();
+ pm->up = TheCamera.GetMatrix().GetUp();
+ pm->right = TheCamera.GetMatrix().GetRight();
break;
}
default:
@@ -1840,10 +1840,10 @@ void CReplay::ProcessLookAroundCam(void)
TheCamera.GetRight() = right;
TheCamera.SetPosition(camera_pt);
RwMatrix* pm = RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera));
- pm->pos = *(RwV3d*)&TheCamera.GetPosition();
- pm->at = *(RwV3d*)&TheCamera.GetForward();
- pm->up = *(RwV3d*)&TheCamera.GetUp();
- pm->right = *(RwV3d*)&TheCamera.GetRight();
+ pm->pos = TheCamera.GetPosition();
+ pm->at = TheCamera.GetForward();
+ pm->up = TheCamera.GetUp();
+ pm->right = TheCamera.GetRight();
TheCamera.CalculateDerivedValues();
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 50a7f745..272ecd4b 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -999,7 +999,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CVector vTestedPos(pTestedPed->GetPosition().x, pTestedPed->GetPosition().y, pTestedPed->GetPosition().z + 0.4);
CVector vScreenPos;
float w, h;
- if (CSprite::CalcScreenCoors(vTestedPos, vScreenPos, &w, &h, false)) {
+ if (CSprite::CalcScreenCoors(vTestedPos, &vScreenPos, &w, &h, false)) {
CVector2D vCrosshairPosition(CCamera::m_f3rdPersonCHairMultX * RsGlobal.maximumWidth, CCamera::m_f3rdPersonCHairMultY * RsGlobal.maximumHeight);
float fScreenDistance = ((CVector2D)vScreenPos - vCrosshairPosition).Magnitude();
if (SCREEN_STRETCH_X(0.45f) > fScreenDistance / w) {
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index a63954c1..05a95950 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -2703,7 +2703,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(CamTargetEntity->GetClump());
int32 idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD));
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
- RwV3dTransformPoints((RwV3d*)&HeadPos, (RwV3d*)&HeadPos, 1, &mats[idx]);
+ RwV3dTransformPoints(&HeadPos, &HeadPos, 1, &mats[idx]);
RwV3d scl = { 0.0f, 0.0f, 0.0f };
RwMatrixScale(&mats[idx], &scl, rwCOMBINEPRECONCAT);
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 61e2f67a..8cb9c49e 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -3,6 +3,7 @@
#include "Automobile.h"
#include "Bridge.h"
#include "Camera.h"
+#include "CarCtrl.h"
#include "Cranes.h"
#include "Darkel.h"
#include "Explosion.h"
@@ -34,93 +35,10 @@
#include "Automobile.h"
#include "GameLogic.h"
-CVector lastPlayerPos;
-
-// --MIAMI: Done
-void
-CPlayerInfo::SetPlayerSkin(char *skin)
-{
- strncpy(m_aSkinName, skin, 32);
- LoadPlayerSkin();
-}
-
-// --MIAMI: Done
-const CVector &
-CPlayerInfo::GetPos()
-{
-#ifdef FIX_BUGS
- if (!m_pPed)
- return TheCamera.GetPosition();
-#endif
- if (m_pPed->InVehicle())
- return m_pPed->m_pMyVehicle->GetPosition();
- return m_pPed->GetPosition();
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::LoadPlayerSkin()
-{
- DeletePlayerSkin();
-
- m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::DeletePlayerSkin()
-{
- if (m_pSkinTexture) {
- RwTextureDestroy(m_pSkinTexture);
- m_pSkinTexture = nil;
- }
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::KillPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
-
- m_WBState = WBSTATE_WASTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
- CStats::TimesDied++;
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::ArrestPlayer()
-{
- if (m_WBState != WBSTATE_PLAYING) return;
+// --MIAMI: File done
- m_WBState = WBSTATE_BUSTED;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
- CDarkel::ResetOnPlayerDeath();
- CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
- CStats::TimesArrested++;
-}
-
-// --MIAMI: Done
-bool
-CPlayerInfo::IsPlayerInRemoteMode()
-{
- return m_pRemoteVehicle || m_bInRemoteMode;
-}
-
-void
-CPlayerInfo::PlayerFailedCriticalMission()
-{
- if (m_WBState != WBSTATE_PLAYING)
- return;
- m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
- m_nWBTime = CTimer::GetTimeInMilliseconds();
- CDarkel::ResetOnPlayerDeath();
-}
+CVector lastPlayerPos;
-// --MIAMI: Done
void
CPlayerInfo::Clear(void)
{
@@ -181,192 +99,6 @@ CPlayerInfo::Clear(void)
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
}
-// --MIAMI: Done
-void
-CPlayerInfo::BlowUpRCBuggy(bool actually)
-{
- if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
- return;
-
- CRemote::TakeRemoteControlledCarFromPlayer(actually);
- if (actually)
- m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
-{
- if (!car || car == m_pPed->m_pMyVehicle) {
- if (m_pPed->EnteringCar())
- m_pPed->QuitEnteringCar();
- }
- if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
- m_pPed->ClearObjective();
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::MakePlayerSafe(bool toggle)
-{
- if (toggle) {
- m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
- CWorld::StopAllLawEnforcersInTheirTracks();
- CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
- CPad::StopPadsShaking();
- m_pPed->bBulletProof = true;
- m_pPed->bFireProof = true;
- m_pPed->bCollisionProof = true;
- m_pPed->bMeleeProof = true;
- m_pPed->bOnlyDamagedByPlayer = true;
- m_pPed->bExplosionProof = true;
- m_pPed->m_bCanBeDamaged = false;
- ((CPlayerPed*)m_pPed)->ClearAdrenaline();
- CancelPlayerEnteringCars(nil);
- gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
- CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
- CProjectileInfo::RemoveAllProjectiles();
- CWorld::SetAllCarsCanBeDamaged(false);
- CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
- CReplay::DisableReplays();
-
- } else {
- m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
- CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
- m_pPed->bBulletProof = false;
- m_pPed->bFireProof = false;
- m_pPed->bCollisionProof = false;
- m_pPed->bMeleeProof = false;
- m_pPed->bOnlyDamagedByPlayer = false;
- m_pPed->bExplosionProof = false;
- m_pPed->m_bCanBeDamaged = true;
- CWorld::SetAllCarsCanBeDamaged(true);
- CReplay::EnableReplays();
- }
-}
-
-// --MIAMI: Done
-bool
-CPlayerInfo::IsRestartingAfterDeath()
-{
- return m_WBState == WBSTATE_WASTED;
-}
-
-// --MIAMI: Done
-bool
-CPlayerInfo::IsRestartingAfterArrest()
-{
- return m_WBState == WBSTATE_BUSTED;
-}
-
-// --MIAMI: Done
-// lastCloseness is passed to other calls of this function
-void
-CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
-{
- // This dist used for determining the angle to face
- CVector2D dist(carToTest->GetPosition() - player->GetPosition());
- float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
- while (neededTurn >= PI) {
- neededTurn -= 2 * PI;
- }
-
- while (neededTurn < -PI) {
- neededTurn += 2 * PI;
- }
-
- // This dist used for evaluating cars' distances, weird...
- // Accounts inverted needed turn (or needed turn in long way) and car dist.
- float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
- if (closeness > *lastCloseness) {
- *lastCloseness = closeness;
- *closestCarOutput = (CVehicle*)carToTest;
- }
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
-{
- // Interesting
- *size = sizeof(CPlayerInfo);
-
-#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
- CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio);
-#undef CopyToBuf
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
-{
-#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
- CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio)
-#undef CopyFromBuf
-}
-
-// --MIAMI: Done
-void
-CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
-{
- for (CPtrNode* node = carList.first; node; node = node->next) {
- CVehicle *car = (CVehicle*)node->item;
- if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
- if (!car->bUsesCollision || !car->IsVehicle())
- continue;
-
- car->m_scanCode = CWorld::GetCurrentScanCode();
- if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
- && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
- CVector carCentre = car->GetBoundCentre();
-
- if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) {
- float dist = (ped->GetPosition() - carCentre).Magnitude2D();
- if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
- EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
- }
- }
- }
- }
- }
-}
-
void
CPlayerInfo::Process(void)
{
@@ -796,3 +528,355 @@ CPlayerInfo::Process(void)
m_nMoney = Min(999999999, m_nMoney);
m_nVisibleMoney = Min(999999999, m_nVisibleMoney);
}
+
+bool
+CPlayerInfo::IsPlayerInRemoteMode()
+{
+ return m_pRemoteVehicle || m_bInRemoteMode;
+}
+
+void
+CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
+{
+ // Interesting
+ *size = sizeof(CPlayerInfo);
+
+#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
+ CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio);
+#undef CopyToBuf
+}
+
+void
+CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
+{
+#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
+ CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio)
+#undef CopyFromBuf
+}
+
+void
+CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
+{
+ for (CPtrNode* node = carList.first; node; node = node->next) {
+ CVehicle *car = (CVehicle*)node->item;
+ if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
+ if (!car->bUsesCollision || !car->IsVehicle())
+ continue;
+
+ car->m_scanCode = CWorld::GetCurrentScanCode();
+ if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING
+ && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
+ CVector carCentre = car->GetBoundCentre();
+
+ if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) {
+ float dist = (ped->GetPosition() - carCentre).Magnitude2D();
+ if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
+ EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
+ }
+ }
+ }
+ }
+ }
+}
+
+// lastCloseness is passed to other calls of this function
+void
+CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
+{
+ // This dist used for determining the angle to face
+ CVector2D dist(carToTest->GetPosition() - player->GetPosition());
+ float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
+ while (neededTurn >= PI) {
+ neededTurn -= 2 * PI;
+ }
+
+ while (neededTurn < -PI) {
+ neededTurn += 2 * PI;
+ }
+
+ // This dist used for evaluating cars' distances, weird...
+ // Accounts inverted needed turn (or needed turn in long way) and car dist.
+ float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
+ if (closeness > *lastCloseness) {
+ *lastCloseness = closeness;
+ *closestCarOutput = (CVehicle*)carToTest;
+ }
+}
+
+const CVector &
+CPlayerInfo::GetPos()
+{
+#ifdef FIX_BUGS
+ if (!m_pPed)
+ return TheCamera.GetPosition();
+#endif
+ if (m_pPed->InVehicle())
+ return m_pPed->m_pMyVehicle->GetPosition();
+ return m_pPed->GetPosition();
+}
+
+CVector
+FindPlayerCoors(void)
+{
+#ifdef FIX_BUGS
+ if (CReplay::IsPlayingBack())
+ return TheCamera.GetPosition();
+#endif
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle->GetPosition();
+ else
+ return ped->GetPosition();
+}
+
+const CVector &
+FindPlayerSpeed(void)
+{
+#ifdef FIX_BUGS
+ static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
+ if (CReplay::IsPlayingBack())
+ return vecTmpVector;
+#endif
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle->m_vecMoveSpeed;
+ else
+ return ped->m_vecMoveSpeed;
+}
+
+CVehicle *
+FindPlayerVehicle(void)
+{
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
+ return nil;
+}
+
+CEntity *
+FindPlayerEntity(void)
+{
+ CPlayerPed *ped = FindPlayerPed();
+ if(ped->InVehicle())
+ return ped->m_pMyVehicle;
+ else
+ return ped;
+}
+
+CVehicle *
+FindPlayerTrain(void)
+{
+ if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
+ return FindPlayerVehicle();
+ else
+ return nil;
+}
+
+CPlayerPed *
+FindPlayerPed(void)
+{
+ return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
+}
+
+const CVector &
+FindPlayerCentreOfWorld(int32 player)
+{
+#ifdef FIX_BUGS
+ if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
+#endif
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
+ if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
+ return CWorld::Players[player].m_pPed->GetPosition();
+}
+
+const CVector &
+FindPlayerCentreOfWorld_NoSniperShift(void)
+{
+#ifdef FIX_BUGS
+ if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
+#endif
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
+ if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
+ return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
+ return FindPlayerPed()->GetPosition();
+}
+
+float
+FindPlayerHeading(void)
+{
+ if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
+ return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
+ return FindPlayerPed()->GetForward().Heading();
+}
+
+bool
+CPlayerInfo::IsRestartingAfterDeath()
+{
+ return m_WBState == WBSTATE_WASTED;
+}
+
+bool
+CPlayerInfo::IsRestartingAfterArrest()
+{
+ return m_WBState == WBSTATE_BUSTED;
+}
+
+void
+CPlayerInfo::KillPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_WASTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
+ CStats::TimesDied++;
+}
+
+void
+CPlayerInfo::ArrestPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_BUSTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
+ CStats::TimesArrested++;
+}
+
+void
+CPlayerInfo::PlayerFailedCriticalMission()
+{
+ if (m_WBState != WBSTATE_PLAYING)
+ return;
+ m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+}
+
+void
+CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
+{
+ if (!car || car == m_pPed->m_pMyVehicle) {
+ if (m_pPed->EnteringCar())
+ m_pPed->QuitEnteringCar();
+ }
+ if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
+ m_pPed->ClearObjective();
+}
+
+void
+CPlayerInfo::MakePlayerSafe(bool toggle)
+{
+ if (toggle) {
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
+ CWorld::StopAllLawEnforcersInTheirTracks();
+ CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
+ CPad::StopPadsShaking();
+ m_pPed->bBulletProof = true;
+ m_pPed->bFireProof = true;
+ m_pPed->bCollisionProof = true;
+ m_pPed->bMeleeProof = true;
+ m_pPed->bOnlyDamagedByPlayer = true;
+ m_pPed->bExplosionProof = true;
+ m_pPed->m_bCanBeDamaged = false;
+ ((CPlayerPed*)m_pPed)->ClearAdrenaline();
+ CancelPlayerEnteringCars(nil);
+ gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
+ CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
+ CProjectileInfo::RemoveAllProjectiles();
+ CWorld::SetAllCarsCanBeDamaged(false);
+ CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
+ CReplay::DisableReplays();
+
+ } else {
+ m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
+ CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
+ m_pPed->bBulletProof = false;
+ m_pPed->bFireProof = false;
+ m_pPed->bCollisionProof = false;
+ m_pPed->bMeleeProof = false;
+ m_pPed->bOnlyDamagedByPlayer = false;
+ m_pPed->bExplosionProof = false;
+ m_pPed->m_bCanBeDamaged = true;
+ CWorld::SetAllCarsCanBeDamaged(true);
+ CReplay::EnableReplays();
+ }
+}
+
+void
+CPlayerInfo::BlowUpRCBuggy(bool actually)
+{
+ if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
+ return;
+
+ CRemote::TakeRemoteControlledCarFromPlayer(actually);
+ if (actually)
+ m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
+}
+
+#ifdef GTA_PC
+void
+CPlayerInfo::SetPlayerSkin(const char *skin)
+{
+ strncpy(m_aSkinName, skin, 32);
+ LoadPlayerSkin();
+}
+
+void
+CPlayerInfo::LoadPlayerSkin()
+{
+ DeletePlayerSkin();
+
+ m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
+}
+
+void
+CPlayerInfo::DeletePlayerSkin()
+{
+ if (m_pSkinTexture) {
+ RwTextureDestroy(m_pSkinTexture);
+ m_pSkinTexture = nil;
+ }
+}
+#endif
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index 68a50c82..a3896ebb 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -84,13 +84,12 @@ public:
bool m_bDriveByAllowed;
uint8 m_nBustedAudioStatus;
int16 m_nCurrentBustedAudio;
+#ifdef GTA_PC
char m_aSkinName[32];
RwTexture *m_pSkinTexture;
+#endif
void MakePlayerSafe(bool);
- void LoadPlayerSkin();
- void DeletePlayerSkin();
- void SetPlayerSkin(char* skin);
const CVector &GetPos();
void Process(void);
void KillPlayer(void);
@@ -107,5 +106,19 @@ public:
void SavePlayerInfo(uint8 *buf, uint32* size);
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
- ~CPlayerInfo() { };
+#ifdef GTA_PC
+ void LoadPlayerSkin();
+ void SetPlayerSkin(const char *skin);
+ void DeletePlayerSkin();
+#endif
};
+
+CPlayerPed *FindPlayerPed(void);
+CVehicle *FindPlayerVehicle(void);
+CVehicle *FindPlayerTrain(void);
+CEntity *FindPlayerEntity(void);
+CVector FindPlayerCoors(void);
+const CVector &FindPlayerSpeed(void);
+const CVector &FindPlayerCentreOfWorld(int32 player);
+const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
+float FindPlayerHeading(void); \ No newline at end of file
diff --git a/src/core/World.cpp b/src/core/World.cpp
index a75d17eb..7d5f89b8 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1399,102 +1399,6 @@ CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList &list, const CVec
}
}
-CPlayerPed *
-FindPlayerPed(void)
-{
- return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
-}
-
-CVehicle *
-FindPlayerVehicle(void)
-{
- CPlayerPed *ped = FindPlayerPed();
- if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
- return nil;
-}
-
-CVehicle *
-FindPlayerTrain(void)
-{
- if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
- return FindPlayerVehicle();
- else
- return nil;
-}
-
-CEntity *
-FindPlayerEntity(void)
-{
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle;
- else
- return ped;
-}
-
-CVector
-FindPlayerCoors(void)
-{
-#ifdef FIX_BUGS
- if (CReplay::IsPlayingBack())
- return TheCamera.GetPosition();
-#endif
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle->GetPosition();
- else
- return ped->GetPosition();
-}
-
-CVector &
-FindPlayerSpeed(void)
-{
-#ifdef FIX_BUGS
- static CVector vecTmpVector(0.0f, 0.0f, 0.0f);
- if (CReplay::IsPlayingBack())
- return vecTmpVector;
-#endif
- CPlayerPed *ped = FindPlayerPed();
- if(ped->InVehicle())
- return ped->m_pMyVehicle->m_vecMoveSpeed;
- else
- return ped->m_vecMoveSpeed;
-}
-
-const CVector &
-FindPlayerCentreOfWorld(int32 player)
-{
-#ifdef FIX_BUGS
- if(CReplay::IsPlayingBack()) return TheCamera.GetPosition();
-#endif
- if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
- if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
- return CWorld::Players[player].m_pPed->GetPosition();
-}
-
-const CVector &
-FindPlayerCentreOfWorld_NoSniperShift(void)
-{
-#ifdef FIX_BUGS
- if (CReplay::IsPlayingBack()) return TheCamera.GetPosition();
-#endif
- if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
- if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
- return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
- return FindPlayerPed()->GetPosition();
-}
-
-float
-FindPlayerHeading(void)
-{
- if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
- return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
- if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
- return FindPlayerPed()->GetForward().Heading();
-}
-
void
CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
{
diff --git a/src/core/World.h b/src/core/World.h
index 74ee4d8a..59bf634c 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -178,15 +178,3 @@ public:
};
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
-
-class CPlayerPed;
-class CVehicle;
-CPlayerPed *FindPlayerPed(void);
-CVehicle *FindPlayerVehicle(void);
-CVehicle *FindPlayerTrain(void);
-CEntity *FindPlayerEntity(void);
-CVector FindPlayerCoors(void);
-CVector &FindPlayerSpeed(void);
-const CVector &FindPlayerCentreOfWorld(int32 player);
-const CVector &FindPlayerCentreOfWorld_NoSniperShift(void);
-float FindPlayerHeading(void);
diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp
index 2d34cdcb..3f91a754 100644
--- a/src/extras/screendroplets.cpp
+++ b/src/extras/screendroplets.cpp
@@ -384,9 +384,9 @@ ScreenDroplets::ProcessCameraMovement(void)
ms_prevCamUp = camUp;
ms_prevCamPos = camPos;
- ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, (RwV3d*)&ms_camMoveDelta);
- ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, (RwV3d*)&ms_camMoveDelta);
- ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, (RwV3d*)&ms_camMoveDelta);
+ ms_screenMoveDelta.x = -RwV3dDotProduct(&camMat->right, &ms_camMoveDelta);
+ ms_screenMoveDelta.y = RwV3dDotProduct(&camMat->up, &ms_camMoveDelta);
+ ms_screenMoveDelta.z = RwV3dDotProduct(&camMat->at, &ms_camMoveDelta);
ms_screenMoveDelta *= 10.0f;
ms_screenMoveDist = ms_screenMoveDelta.Magnitude2D();
diff --git a/src/math/Matrix.h b/src/math/Matrix.h
index bf811af7..d32b1d93 100644
--- a/src/math/Matrix.h
+++ b/src/math/Matrix.h
@@ -23,15 +23,6 @@ public:
void UpdateRW(void);
void operator=(CMatrix const &rhs);
CMatrix &operator+=(CMatrix const &rhs);
-#ifdef RWCORE_H
- operator RwMatrix (void) const {
- return m_matrix;
- }
-
- operator RwMatrix *(void) {
- return &m_matrix;
- }
-#endif
CMatrix &operator*=(CMatrix const &rhs);
const CVector &GetPosition(void) const { return *(CVector*)&m_matrix.pos; }
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 4cc2171f..02128454 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -1,23 +1,22 @@
#pragma once
-class CVector
+class CVector : public RwV3d
{
public:
- float x, y, z;
CVector(void) {}
- CVector(float x, float y, float z) : x(x), y(y), z(z) {}
-#ifdef RWCORE_H
- CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
-
- operator RwV3d (void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
+ CVector(float x, float y, float z)
+ {
+ this->x = x;
+ this->y = y;
+ this->z = z;
}
-
- operator RwV3d *(void) {
- return (RwV3d*)this;
+
+ CVector(const RwV3d &v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
}
-#endif
// (0,1,0) means no rotation. So get right vector and its atan
float Heading(void) const { return Atan2(-x, y); }
float Magnitude(void) const { return Sqrt(x*x + y*y + z*z); }
diff --git a/src/math/VuVector.h b/src/math/VuVector.h
index f90818e0..30d62cfc 100644
--- a/src/math/VuVector.h
+++ b/src/math/VuVector.h
@@ -8,18 +8,7 @@ public:
CVuVector(float x, float y, float z) : CVector(x, y, z) {}
CVuVector(float x, float y, float z, float w) : CVector(x, y, z), w(w) {}
CVuVector(const CVector &v) : CVector(v.x, v.y, v.z) {}
-#ifdef RWCORE_H
- CVuVector(const RwV3d &v) : CVector(v.x, v.y, v.z) {}
-
- operator RwV3d (void) const {
- RwV3d vecRw = { this->x, this->y, this->z };
- return vecRw;
- }
-
- operator RwV3d *(void) {
- return (RwV3d*)this;
- }
-#endif
+ CVuVector(const RwV3d &v) : CVector(v) {}
/*
void Normalise(void) {
float sq = MagnitudeSqr();
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index f9caffc5..b9d6f300 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -549,7 +549,7 @@ CVehicleModelInfo::PreprocessHierarchy(void)
if(desc[i].flags & VEHICLE_FLAG_POS){
f = assoc.frame;
- rwvec = (RwV3d*)&m_positions[desc[i].hierId];
+ rwvec = &m_positions[desc[i].hierId];
*rwvec = *RwMatrixGetPos(RwFrameGetMatrix(f));
for(f = RwFrameGetParent(f); f; f = RwFrameGetParent(f))
RwV3dTransformPoints(rwvec, rwvec, 1, RwFrameGetMatrix(f));
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 9684794a..762c7f1a 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -264,7 +264,7 @@ CCopPed::ArrestPlayer(void)
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_ARREST_GUN, 4.0f);
CVector suspMidPos;
- suspect->m_pedIK.GetComponentPosition(*(RwV3d *)&suspMidPos, PED_MID);
+ suspect->m_pedIK.GetComponentPosition(suspMidPos, PED_MID);
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(suspMidPos.x, suspMidPos.y,
GetPosition().x, GetPosition().y);
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 24d9a6a1..2eabfe04 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -230,8 +230,8 @@ CEmergencyPed::MedicAI(void)
if (nearestAccident) {
m_pRevivedPed = nearestAccident->m_pVictim;
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
bIsRunning = true;
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
@@ -270,8 +270,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_STOP;
break;
}
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
bIsRunning = true;
--m_pAttendedAccident->m_nMedicsAttending;
@@ -324,8 +324,8 @@ CEmergencyPed::MedicAI(void)
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
else {
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y,
@@ -346,8 +346,8 @@ CEmergencyPed::MedicAI(void)
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
break;
}
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&midPos, PED_MID);
- m_pRevivedPed->m_pedIK.GetComponentPosition(*(RwV3d *)&headPos, PED_HEAD);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
+ m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
midPos = (headPos + midPos) * 0.5f;
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
midPos.x, midPos.y,
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 92cb8eff..fb44f59c 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -1119,7 +1119,7 @@ public:
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int32 idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
- RwV3dTransformPoints((RwV3d*)&pos, (RwV3d*)&pos, 1, &mats[idx]);
+ RwV3dTransformPoints(&pos, &pos, 1, &mats[idx]);
}
// set by 0482:set_threat_reaction_range_multiplier opcode
diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp
index 3a4e785a..3e0dfb6d 100644
--- a/src/peds/PedFight.cpp
+++ b/src/peds/PedFight.cpp
@@ -2151,7 +2151,7 @@ CPed::FightStrike(CVector &touchedNodePos, bool fightWithWeapon)
if (m_fightState == FIGHTSTATE_NO_MOVE)
m_fightState = FIGHTSTATE_1;
- m_vecHitLastPos = *touchedNodePos;
+ m_vecHitLastPos = touchedNodePos;
return false;
}
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index 7dcf0ef3..ee719fea 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -52,7 +52,6 @@ public:
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position);
void GetComponentPosition(RwV3d &pos, uint32 node);
- void GetComponentPosition(CVector &pos, uint32 node) { GetComponentPosition(*(RwV3d*)pos, node); }
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 04f98366..62559443 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1436,7 +1436,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
if (m_pPointGunAt) {
CVector markPos;
if (m_pPointGunAt->IsPed()) {
- ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&markPos, PED_MID);
+ ((CPed*)m_pPointGunAt)->m_pedIK.GetComponentPosition(markPos, PED_MID);
} else {
markPos = m_pPointGunAt->GetPosition();
}
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index 15bae90b..c7554356 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -129,7 +129,7 @@ CClouds::Render(void)
CSprite::InitSpriteBuffer();
float minute = CClock::GetHours()*60 + CClock::GetMinutes() + CClock::GetSeconds()/60.0f;
- RwV3d campos = *(RwV3d*)&TheCamera.GetPosition();
+ RwV3d campos = TheCamera.GetPosition();
// Moon
float moonfadeout = Abs(minute - 180.0f); // fully visible at 3AM
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index c40577d7..9c87e2e0 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -271,7 +271,7 @@ CCoronas::Render(void)
CVector spriteCoors;
float spritew, spriteh;
- if(!CSprite::CalcScreenCoors(aCoronas[i].coors, spriteCoors, &spritew, &spriteh, true)){
+ if(!CSprite::CalcScreenCoors(aCoronas[i].coors, &spriteCoors, &spritew, &spriteh, true)){
aCoronas[i].offScreen = true;
aCoronas[i].sightClear = false;
}else{
@@ -478,7 +478,7 @@ CCoronas::RenderReflections(void)
CVector spriteCoors;
float spritew, spriteh;
- if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(coors, &spriteCoors, &spritew, &spriteh, true)) {
float drawDist = 0.75f * aCoronas[i].drawDist;
drawDist = Min(drawDist, 55.0f);
if(spriteCoors.z < drawDist){
@@ -669,7 +669,7 @@ CCoronas::DoSunAndMoon(void)
CVector spriteCoors;
float spritew, spriteh;
- if(CSprite::CalcScreenCoors(sunCoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(sunCoors, &spriteCoors, &spritew, &spriteh, true)) {
SunScreenX = spriteCoors.x;
SunScreenY = spriteCoors.y;
}else{
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index e220ce5a..ac6fa7df 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -756,7 +756,7 @@ void CScrollBar::Render()
// Render main coronas
if (m_MessageBar[i] & (1 << j))
{
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
@@ -768,7 +768,7 @@ void CScrollBar::Render()
// Render smaller and faded coronas for a trailing effect
else if (m_MessageBar[i - 1] & (1 << j))
{
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ if (CSprite::CalcScreenCoors(coronaCoord, &screenCoord, &screenW, &screenH, true))
{
CSprite::RenderBufferedOneXLUSprite(
screenCoord.x, screenCoord.y, screenCoord.z,
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 6a42bc4d..5ea4f610 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -941,7 +941,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
CVector screen;
float w, h;
- if ( !CSprite::CalcScreenCoors(vecPos, screen, &w, &h, true) )
+ if ( !CSprite::CalcScreenCoors(vecPos, &screen, &w, &h, true) )
return nil;
pParticle->m_vecPosition = screen;
@@ -2034,7 +2034,7 @@ void CParticle::Render()
float w;
float h;
- if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
+ if ( CSprite::CalcScreenCoors(particle->m_vecPosition, &coors, &w, &h, true) )
{
if ( i == PARTICLE_ENGINE_STEAM
@@ -2189,7 +2189,7 @@ void CParticle::Render()
float fTrailLength;
CVector vecScreenPosition;
- if ( CSprite::CalcScreenCoors(vecPrevPos, vecScreenPosition, &fTrailLength, &fRotation, true) )
+ if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
{
CVector2D vecDist
(
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index b09b07bd..c8f21d21 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -239,7 +239,7 @@ CPointLights::RenderFogEffect(void)
// more intensity the closer to line
intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
- if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)) {
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x2000;
float size = FogSizes[r>>1];
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
@@ -287,7 +287,7 @@ CPointLights::RenderFogEffect(void)
intensity *= 1.0f - sq(lightdist / FOG_AREA_RADIUS);
CVector fogcoors(xi, yi, groundZ + 1.6f);
- if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
+ if(CSprite::CalcScreenCoors(fogcoors, &spriteCoors, &spritew, &spriteh, true)) {
float rotation = (CTimer::GetTimeInMilliseconds()&0x3FFF) * 2*3.14f / 0x4000;
float size = FogSizes[r>>1];
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(spriteCoors.x, spriteCoors.y, spriteCoors.z,
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index b9be21fe..4771eb79 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1302,7 +1302,7 @@ CRenderer::ScanWorld(void)
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
- RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
+ RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
m_loadingPriority = false;
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
@@ -1422,7 +1422,7 @@ CRenderer::RequestObjectsInFrustum(void)
vectors[CORNER_PRIO_RIGHT].x = vectors[CORNER_LOD_RIGHT].x * 0.2f;
vectors[CORNER_PRIO_RIGHT].y = vectors[CORNER_LOD_RIGHT].y * 0.2f;
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
- RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
+ RwV3dTransformPoints(vectors, vectors, 9, cammatrix);
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
#ifdef FIX_BUGS
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index a964ceb6..e8be23bd 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -2229,7 +2229,7 @@ CShadows::CastShadowEntityXYZ(CEntity *pEntity, CVector *pPosn,
sphere.Set(2.0f, center);
RwV3d point;
- RwV3dTransformPoints(&point, center, 1, &invMatrix);
+ RwV3dTransformPoints(&point, &center, 1, &invMatrix);
CColSphere colSphere;
colSphere.Set(2.0f, CVector(point), 0, 0);
@@ -2252,7 +2252,7 @@ CShadows::CastShadowEntityXYZ(CEntity *pEntity, CVector *pPosn,
p[1] += offset;
p[2] += offset;
- if ( !ShadowRenderTriangleCB((RwV3d *)p, n, &proj) )
+ if ( !ShadowRenderTriangleCB(p, &n, &proj) )
break;
}
i++;
diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index faf31077..06cca57e 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -1597,7 +1597,7 @@ CBike::PreRender(void)
CVector forkAxis(0.0f, Sin(DEGTORAD(mi->m_bikeSteerAngle)), -Cos(DEGTORAD(mi->m_bikeSteerAngle)));
forkAxis.Normalise(); // as if that's not already the case
CQuaternion quat;
- quat.Set((RwV3d*)&forkAxis, -m_fWheelAngle);
+ quat.Set(&forkAxis, -m_fWheelAngle);
quat.Get(rot.m_attachment);
rot.Update();
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index feaa80de..695d380f 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -443,7 +443,7 @@ CBoat::ProcessControl(void)
CVector wakePos = GetPosition() + sternPos;
// no actual particles for player...
}else if(IsVisible() && ((CTimer::GetFrameCounter() + m_randomSeed) & 1) &&
- CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&propellerWorld) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
+ CVisibilityPlugins::GetDistanceSquaredFromCamera(&propellerWorld) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
jetDir.z = 0.015f;
jetDir.x *= 3.5f;
jetDir.y *= 3.5f;
@@ -613,7 +613,7 @@ CBoat::ProcessControl(void)
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
if(splashPos.z-waterLevel < 3.0f &&
- CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
+ CVisibilityPlugins::GetDistanceSquaredFromCamera(&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
splashPos.z = waterLevel + 0.1f;
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
@@ -670,7 +670,7 @@ CBoat::ProcessControl(void)
splashDir.z += 0.0003f*m_nDeltaVolumeUnderWater;
CWaterLevel::GetWaterLevel(splashPos, &waterLevel, true);
if(splashPos.z-waterLevel < 3.0f &&
- CVisibilityPlugins::GetDistanceSquaredFromCamera((RwV3d*)&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
+ CVisibilityPlugins::GetDistanceSquaredFromCamera(&splashPos) < SQR(70.0f * TheCamera.GenerationDistMultiplier)){
splashPos.z = waterLevel + 0.1f;
CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashPos, 0.75f*splashDir, nil, splashSize+0.1f, splashColor,
CGeneral::GetRandomNumberInRange(0.0f, 10.0f), CGeneral::GetRandomNumberInRange(0.0f, 90.0f),
diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp
index 515dff94..38ce6e53 100644
--- a/src/weapons/Explosion.cpp
+++ b/src/weapons/Explosion.cpp
@@ -220,7 +220,7 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
} else if (veh->IsComponentPresent(CAR_BOOT)) {
veh->GetComponentWorldPosition(CAR_BOOT, componentPos);
}
- if (componentPos != nil) {
+ if (componentPos.x != 0.0f) {
int rn = (CGeneral::GetRandomNumber() & 1) + 1;
for (int i = 0; i < rn; i++)
CParticle::AddJetExplosion(componentPos, (CGeneral::GetRandomNumber() & 7) / 7.0f + 1.5f, 0.5f);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 52d95abb..2435d544 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -506,7 +506,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
if ( victimPed->bUsesCollision || victimPed->Dead() || victimPed->Driving() )
{
CVector victimPedPos = victimPed->GetPosition();
- if ( SQR(victimPedRadius) > (victimPedPos-(*fireSource)).MagnitudeSqr() )
+ if ( SQR(victimPedRadius) > (victimPedPos-fireSource).MagnitudeSqr() )
{
CVector collisionDist;
CColModel* victimPedCol = &CTempColModels::ms_colModelPed1;
@@ -528,9 +528,9 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
CColSphere *sphere = &victimPedCol->spheres[s];
if (useLocalPos)
- collisionDist = sphere->center - (*fireSource);
+ collisionDist = sphere->center - fireSource;
else
- collisionDist = victimPedPos + sphere->center - (*fireSource);
+ collisionDist = victimPedPos + sphere->center - fireSource;
if ( SQR(sphere->radius + info->m_fRadius) > collisionDist.MagnitudeSqr() )
{
@@ -873,7 +873,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CPed *threatAttack = (CPed*)shooterPed->m_pPointGunAt;
if ( threatAttack->IsPed() )
{
- threatAttack->m_pedIK.GetComponentPosition(*(RwV3d *)&target, PED_MID);
+ threatAttack->m_pedIK.GetComponentPosition(target, PED_MID);
threatAttack->ReactToPointGun(shooter);
}
else
@@ -1703,7 +1703,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
{
CVector pos;
if (shooterPed->m_pPointGunAt->IsPed()) {
- ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition(*(RwV3d *)&pos, PED_MID);
+ ((CPed*)shooterPed->m_pPointGunAt)->m_pedIK.GetComponentPosition(pos, PED_MID);
} else {
pos = ((CPed*)shooterPed->m_pPointGunAt)->GetPosition();
}
@@ -2167,7 +2167,7 @@ CWeapon::LaserScopeDot(CVector *pOutPos, float *pOutSize)
CVector pos = foundCol.point;
float w, h;
- if ( CSprite::CalcScreenCoors(foundCol.point, pos, &w, &h, true) )
+ if ( CSprite::CalcScreenCoors(foundCol.point, &pos, &w, &h, true) )
{
*pOutPos = pos;
*pOutSize = w * 0.05f;
@@ -2262,7 +2262,7 @@ CWeapon::TakePhotograph(CEntity *shooter)
CVector pos;
float w, h;
- if ( CSprite::CalcScreenCoors(pedPos, pos, &w, &h, false) )
+ if ( CSprite::CalcScreenCoors(pedPos, &pos, &w, &h, false) )
{
if ( SCREEN_WIDTH * 0.1f < pos.x && SCREEN_WIDTH * 0.9f > pos.x
&& SCREEN_HEIGHT * 0.1f < pos.y && SCREEN_HEIGHT * 0.9f > pos.y )