summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-06-15 15:17:22 +0200
committereray orçunus <erayorcunus@gmail.com>2020-06-15 15:17:22 +0200
commit686d6e9834b21a5acc37123f3913cd83e670d241 (patch)
treea9d402679bc71bfe7876f8f21b8ee8c1efffbbe3 /src
parentMerge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff)
downloadre3-686d6e9834b21a5acc37123f3913cd83e670d241.tar
re3-686d6e9834b21a5acc37123f3913cd83e670d241.tar.gz
re3-686d6e9834b21a5acc37123f3913cd83e670d241.tar.bz2
re3-686d6e9834b21a5acc37123f3913cd83e670d241.tar.lz
re3-686d6e9834b21a5acc37123f3913cd83e670d241.tar.xz
re3-686d6e9834b21a5acc37123f3913cd83e670d241.tar.zst
re3-686d6e9834b21a5acc37123f3913cd83e670d241.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/Cam.cpp12
-rw-r--r--src/core/Camera.cpp72
-rw-r--r--src/core/Camera.h14
3 files changed, 57 insertions, 41 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 62ea950e..5b784947 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4550,7 +4550,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// We may need those later
bool isPlane = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE;
bool isHeli = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI;
- bool isBike = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE || car->IsBike();
+ bool isBike = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE;
bool isCar = car->IsCar() && !isPlane && !isHeli && !isBike;
CPad* pad = CPad::GetPad(0);
@@ -4623,11 +4623,11 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// Taken from VC CCam::Cam_On_A_String_Unobscured. If we don't this, we will end up seeing the world from the inside of RC Goblin/Raider.
// I couldn't find where SA does that. It's possible that they've increased the size of these veh.'s collision bounding box.
- if (car->m_modelIndex == MI_RCRAIDER || car->m_modelIndex == MI_RCBANDIT) {
- newDistance += 6.0f;
- } else if (car->m_modelIndex == MI_RCBARON) {
- newDistance += 9.5f;
- }
+
+ if (car->m_modelIndex == MI_RCRAIDER || car->m_modelIndex == MI_RCGOBLIN)
+ newDistance += INIT_RC_HELI_HORI_EXTRA;
+ else if (car->m_modelIndex == MI_RCBARON)
+ newDistance += INIT_RC_PLANE_HORI_EXTRA;
float minDistForThisCar = approxCarLength * CARCAM_SET[camSetArrPos][3];
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 423a3da6..6d25c6d1 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -76,6 +76,16 @@ float CCamera::m_f3rdPersonCHairMultY;
#define CTRLDOWN(key) ((KEYDOWN(rsLCTRL) || KEYDOWN(rsRCTRL)) && KEYDOWN((RsKeyCodes)key))
#endif
+const float ZOOM_ONE_DISTANCE[] = { -0.6f, 0.05f, -3.2f, 0.05f, -2.41f };
+const float ZOOM_TWO_DISTANCE[] = { 1.9f, 1.4f, 0.65f, 1.9f, 6.49f };
+const float ZOOM_THREE_DISTANCE[] = { 15.9f, 15.9f, 15.9f, 15.9f, 25.25f };
+
+#ifdef FREE_CAM
+const float LCS_ZOOM_ONE_DISTANCE[] = { -1.0f, -0.2f, -3.2f, 0.05f, -2.41f };
+const float LCS_ZOOM_TWO_DISTANCE[] = { 2.0f, 2.2f, 1.65f, 2.9f, 6.49f };
+const float LCS_ZOOM_THREE_DISTANCE[] = { 6.0f, 6.0f, 15.9f, 15.9f, 15.0f };
+#endif
+
CCamera::CCamera(void)
{
Init();
@@ -670,6 +680,10 @@ CCamera::CamControl(void)
if(CarZoomIndicator != CAM_ZOOM_1STPRS && CarZoomIndicator != CAM_ZOOM_TOPDOWN)
ReqMode = CCam::MODE_CAM_ON_A_STRING;
+ int vehApp = ((CVehicle*)pTargetEntity)->GetVehicleAppearance();
+ int vehArrPos = 0;
+ GetArrPosForVehicleType(vehApp, vehArrPos);
+
switch(((CVehicle*)pTargetEntity)->m_vehType){
case VEHICLE_TYPE_CAR:
case VEHICLE_TYPE_BIKE:
@@ -758,26 +772,26 @@ CCamera::CamControl(void)
}
// Car zoom value
- if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){
+ if (CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage) {
CarZoomValue = 0.0f;
ReqMode = CCam::MODE_1STPERSON;
}
#ifdef FREE_CAM
else if (bFreeCam) {
if (CarZoomIndicator == CAM_ZOOM_1)
- CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1;
+ CarZoomValue = LCS_ZOOM_ONE_DISTANCE[vehArrPos];
else if (CarZoomIndicator == CAM_ZOOM_2)
- CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2;
+ CarZoomValue = LCS_ZOOM_TWO_DISTANCE[vehArrPos];
else if (CarZoomIndicator == CAM_ZOOM_3)
- CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3;
+ CarZoomValue = LCS_ZOOM_THREE_DISTANCE[vehArrPos];
}
#endif
- else if(CarZoomIndicator == CAM_ZOOM_1)
- CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_1;
+ else if (CarZoomIndicator == CAM_ZOOM_1)
+ CarZoomValue = ZOOM_ONE_DISTANCE[vehArrPos];
else if(CarZoomIndicator == CAM_ZOOM_2)
- CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_2;
+ CarZoomValue = ZOOM_TWO_DISTANCE[vehArrPos];
else if(CarZoomIndicator == CAM_ZOOM_3)
- CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3;
+ CarZoomValue = ZOOM_THREE_DISTANCE[vehArrPos];
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
CarZoomValue = 1.0f;
@@ -3103,26 +3117,42 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
void
CCamera::SetZoomValueCamStringScript(int16 dist)
{
+ if (Cams[ActiveCam].CamTargetEntity->IsVehicle()) {
+ int vehApp = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->GetVehicleAppearance();
+ int vehArrPos = 0;
+ GetArrPosForVehicleType(vehApp, vehArrPos);
+
#ifdef FREE_CAM
- if (bFreeCam) {
- switch (dist) {
- case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
- case 1: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2; break;
- case 2: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3; break;
- default: break;
+ if (bFreeCam) {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = LCS_ZOOM_ONE_DISTANCE[vehArrPos]; break;
+ case 1: m_fCarZoomValueScript = LCS_ZOOM_TWO_DISTANCE[vehArrPos]; break;
+ case 2: m_fCarZoomValueScript = LCS_ZOOM_THREE_DISTANCE[vehArrPos]; break;
+ default: break;
+ }
}
- } else
+ else
#endif
- {
+ {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = ZOOM_ONE_DISTANCE[vehArrPos]; break;
+ case 1: m_fCarZoomValueScript = ZOOM_TWO_DISTANCE[vehArrPos]; break;
+ case 2: m_fCarZoomValueScript = ZOOM_THREE_DISTANCE[vehArrPos]; break;
+ default: break;
+ }
+ }
+
+ m_bUseScriptZoomValueCar = true;
+ } else {
switch (dist) {
- case 0: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_1; break;
- case 1: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_2; break;
- case 2: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_3; break;
+ case 0: m_fPedZoomValueScript = 0.25f; break;
+ case 1: m_fPedZoomValueScript = 1.5f; break;
+ case 2: m_fPedZoomValueScript = 2.9f; break;
default: break;
}
- }
- m_bUseScriptZoomValueCar = true;
+ m_bUseScriptZoomValuePed = true;
+ }
}
void
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 73e1a15f..7a95f75a 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -26,20 +26,6 @@ enum
CAM_ZOOM_CINEMATIC,
};
-#ifdef FREE_CAM // LCS values
-#define FREE_CAR_ZOOM_VALUE_1 (-1.0f)
-#define FREE_CAR_ZOOM_VALUE_2 (2.0f)
-#define FREE_CAR_ZOOM_VALUE_3 (6.0f)
-
-#define FREE_BOAT_ZOOM_VALUE_1 (-2.41f)
-#define FREE_BOAT_ZOOM_VALUE_2 (6.49f)
-#define FREE_BOAT_ZOOM_VALUE_3 (15.0f)
-#endif
-
-#define DEFAULT_CAR_ZOOM_VALUE_1 (0.05f)
-#define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f)
-#define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f)
-
const float DefaultFOV = 70.0f; // beta: 80.0f
class CCam