summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-01-23 21:21:50 +0100
committerGitHub <noreply@github.com>2020-01-23 21:21:50 +0100
commitd75b9b82571834248a2337473307ffece8a73023 (patch)
treed7465ee2e9019d83f127a2abbbf3a7d01884a029 /src/core
parentFixing possible leaks in CModelInfo::ShutDown (diff)
downloadre3-d75b9b82571834248a2337473307ffece8a73023.tar
re3-d75b9b82571834248a2337473307ffece8a73023.tar.gz
re3-d75b9b82571834248a2337473307ffece8a73023.tar.bz2
re3-d75b9b82571834248a2337473307ffece8a73023.tar.lz
re3-d75b9b82571834248a2337473307ffece8a73023.tar.xz
re3-d75b9b82571834248a2337473307ffece8a73023.tar.zst
re3-d75b9b82571834248a2337473307ffece8a73023.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.cpp15
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/PlayerInfo.cpp20
3 files changed, 27 insertions, 10 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 1aee4edb..a8295763 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -1379,6 +1379,21 @@ CCamera::SetWideScreenOff(void)
m_bWantsToSwitchWidescreenOff = m_WideScreenOn;
}
+void
+CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom)
+{
+ PlayerWeaponMode.Mode = mode;
+ PlayerWeaponMode.MaxZoom = maxZoom;
+ PlayerWeaponMode.MinZoom = minZoom;
+ PlayerWeaponMode.Duration = 0.0f;
+}
+
+void
+CCamera::UpdateAimingCoors(CVector const &coors)
+{
+ m_cvecAimingTargetCoors = coors;
+}
+
STARTPATCHES
InjectHook(0x42C760, (bool (CCamera::*)(const CVector &center, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 81eaa84f..8f0e62d4 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -494,6 +494,8 @@ int m_iModeObbeCamIsInForCar;
void SetCameraDirectlyBehindForFollowPed_CamOnAString(void);
void SetZoomValueFollowPedScript(int16);
void SetZoomValueCamStringScript(int16);
+ void SetNewPlayerWeaponMode(int16, int16, int16);
+ void UpdateAimingCoors(CVector const &);
void dtor(void) { this->CCamera::~CCamera(); }
};
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index d9030250..a01c1398 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -212,9 +212,9 @@ CPlayerInfo::IsRestartingAfterArrest()
return m_WBState == WBSTATE_BUSTED;
}
-// lastClosestness is passed to other calls of this function
+// lastCloseness is passed to other calls of this function
void
-CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastClosestness, CVehicle **closestCarOutput)
+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());
@@ -229,9 +229,9 @@ CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoun
// This dist used for evaluating cars' distances, weird...
// Accounts inverted needed turn (or needed turn in long way) and car dist.
- float closestness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
- if (closestness > *lastClosestness) {
- *lastClosestness = closestness;
+ float closeness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
+ if (closeness > *lastCloseness) {
+ *lastCloseness = closeness;
*closestCarOutput = (CVehicle*)carToTest;
}
}
@@ -312,7 +312,7 @@ INITSAVEBUF
}
void
-CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastClosestness, CVehicle** closestCarOutput)
+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;
@@ -328,7 +328,7 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1,
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
float dist = (ped->GetPosition() - carCentre).Magnitude2D();
if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
- EvaluateCarPosition(car, ped, dist, lastClosestness, closestCarOutput);
+ EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
}
}
}
@@ -434,7 +434,7 @@ CPlayerInfo::Process(void)
// Enter vehicle
if (CPad::GetPad(0)->ExitVehicleJustDown()) {
bool weAreOnBoat = false;
- float lastClosestness = 0.0f;
+ float lastCloseness = 0.0f;
CVehicle *carBelow = nil;
CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface;
if (surfaceBelow && surfaceBelow->IsVehicle()) {
@@ -472,9 +472,9 @@ CPlayerInfo::Process(void)
for (int curX = minXSector; curX <= maxXSector; curX++) {
CSector *sector = CWorld::GetSector(curX, curY);
FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES], m_pPed,
- minX, minY, maxX, maxY, &lastClosestness, &carBelow);
+ minX, minY, maxX, maxY, &lastCloseness, &carBelow);
FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], m_pPed,
- minX, minY, maxX, maxY, &lastClosestness, &carBelow);
+ minX, minY, maxX, maxY, &lastCloseness, &carBelow);
}
}
}