Fix vehicle cam. zoom values

This commit is contained in:
eray orçunus 2020-06-15 16:17:22 +03:00
parent ef4c8f53c5
commit 686d6e9834
3 changed files with 63 additions and 47 deletions

View File

@ -4550,7 +4550,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// We may need those later // We may need those later
bool isPlane = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE; bool isPlane = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE;
bool isHeli = car->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI; 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; bool isCar = car->IsCar() && !isPlane && !isHeli && !isBike;
CPad* pad = CPad::GetPad(0); 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. // 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. // 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; if (car->m_modelIndex == MI_RCRAIDER || car->m_modelIndex == MI_RCGOBLIN)
} else if (car->m_modelIndex == MI_RCBARON) { newDistance += INIT_RC_HELI_HORI_EXTRA;
newDistance += 9.5f; else if (car->m_modelIndex == MI_RCBARON)
} newDistance += INIT_RC_PLANE_HORI_EXTRA;
float minDistForThisCar = approxCarLength * CARCAM_SET[camSetArrPos][3]; float minDistForThisCar = approxCarLength * CARCAM_SET[camSetArrPos][3];

View File

@ -76,6 +76,16 @@ float CCamera::m_f3rdPersonCHairMultY;
#define CTRLDOWN(key) ((KEYDOWN(rsLCTRL) || KEYDOWN(rsRCTRL)) && KEYDOWN((RsKeyCodes)key)) #define CTRLDOWN(key) ((KEYDOWN(rsLCTRL) || KEYDOWN(rsRCTRL)) && KEYDOWN((RsKeyCodes)key))
#endif #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) CCamera::CCamera(void)
{ {
Init(); Init();
@ -670,6 +680,10 @@ CCamera::CamControl(void)
if(CarZoomIndicator != CAM_ZOOM_1STPRS && CarZoomIndicator != CAM_ZOOM_TOPDOWN) if(CarZoomIndicator != CAM_ZOOM_1STPRS && CarZoomIndicator != CAM_ZOOM_TOPDOWN)
ReqMode = CCam::MODE_CAM_ON_A_STRING; ReqMode = CCam::MODE_CAM_ON_A_STRING;
int vehApp = ((CVehicle*)pTargetEntity)->GetVehicleAppearance();
int vehArrPos = 0;
GetArrPosForVehicleType(vehApp, vehArrPos);
switch(((CVehicle*)pTargetEntity)->m_vehType){ switch(((CVehicle*)pTargetEntity)->m_vehType){
case VEHICLE_TYPE_CAR: case VEHICLE_TYPE_CAR:
case VEHICLE_TYPE_BIKE: case VEHICLE_TYPE_BIKE:
@ -758,26 +772,26 @@ CCamera::CamControl(void)
} }
// Car zoom value // Car zoom value
if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){ if (CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage) {
CarZoomValue = 0.0f; CarZoomValue = 0.0f;
ReqMode = CCam::MODE_1STPERSON; ReqMode = CCam::MODE_1STPERSON;
} }
#ifdef FREE_CAM #ifdef FREE_CAM
else if (bFreeCam) { else if (bFreeCam) {
if (CarZoomIndicator == CAM_ZOOM_1) 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) 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) 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 #endif
else if(CarZoomIndicator == CAM_ZOOM_1) else if (CarZoomIndicator == CAM_ZOOM_1)
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_1; CarZoomValue = ZOOM_ONE_DISTANCE[vehArrPos];
else if(CarZoomIndicator == CAM_ZOOM_2) else if(CarZoomIndicator == CAM_ZOOM_2)
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_2; CarZoomValue = ZOOM_TWO_DISTANCE[vehArrPos];
else if(CarZoomIndicator == CAM_ZOOM_3) else if(CarZoomIndicator == CAM_ZOOM_3)
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3; CarZoomValue = ZOOM_THREE_DISTANCE[vehArrPos];
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){ if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
CarZoomValue = 1.0f; CarZoomValue = 1.0f;
@ -3103,26 +3117,42 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
void void
CCamera::SetZoomValueCamStringScript(int16 dist) CCamera::SetZoomValueCamStringScript(int16 dist)
{ {
#ifdef FREE_CAM if (Cams[ActiveCam].CamTargetEntity->IsVehicle()) {
if (bFreeCam) { int vehApp = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->GetVehicleAppearance();
switch (dist) { int vehArrPos = 0;
case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break; GetArrPosForVehicleType(vehApp, vehArrPos);
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;
}
} else
#endif
{
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;
default: break;
}
}
m_bUseScriptZoomValueCar = true; #ifdef FREE_CAM
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
#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_fPedZoomValueScript = 0.25f; break;
case 1: m_fPedZoomValueScript = 1.5f; break;
case 2: m_fPedZoomValueScript = 2.9f; break;
default: break;
}
m_bUseScriptZoomValuePed = true;
}
} }
void void

View File

@ -26,20 +26,6 @@ enum
CAM_ZOOM_CINEMATIC, 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 const float DefaultFOV = 70.0f; // beta: 80.0f
class CCam class CCam