Skip to content

Commit 9fff215

Browse files
committed
Release 1.6.0
1 parent d469da7 commit 9fff215

File tree

3 files changed

+44
-22
lines changed

3 files changed

+44
-22
lines changed

CustomCameraVPlus.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ InertiaAffectsPitch = 0
2626
SmartHeading = 1
2727
SmartHeadingIntensity = 1.0
2828

29+
2930
[1stPersonView]
3031
fov = 75.0
3132

@@ -46,6 +47,16 @@ InertiaEffects = 1
4647
# Set to 1 to enable, 0 to disable
4748
GetInputFromGearsAsi = 1
4849

50+
# Which camera will be used by default?
51+
# Possible values (number):
52+
# 0 => First Person Camera
53+
# 1 => Third Person Camera "Smooth" (Legacy)
54+
# 2 => Thrid Person Camera "Racing" (New)
55+
#
56+
# You can also switch camera while playing by pressing "V" (or other key mapped to switch cameras)
57+
# Any values below 0 or above 2 will be clamped to the nearest valid number
58+
DefaultCamera = 2
59+
4960

5061
[input]
5162

changelog.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
1.6.0
3+
4+
* New third person camera! Racing oriented, so now you can switch between 3 cameras: 1st person, 3rd person smooth (legacy), and 3rd person racing (new)
5+
* Ability to select the default camera via settings .ini file (Default camera now is 3rd person racing, but you can set it back to 3rd person smooth or 1st person)
6+
* Other minor enhancements
7+
18
1.5.0
29

310
* More natural and "elastic" cam behaviour in 3rd person. Reworked algorithm.
@@ -32,7 +39,7 @@
3239
* Added a sensibility setting for both gamepad/mouse (via INI file).
3340
* Fixed an error where camera wasn't taking towed vehicle/trailer distance into account (this happened only in v1.0).
3441

35-
1.0:
42+
1.0
3643

3744
* Reworked 3rd person camera algorithm (completely rewritten)
3845
* 3rd person camera rotation doesn't get affected by suspension bounciness

script.cpp

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,13 @@ float smoothIsAiming = 0.f;
134134
bool customCamEnabled = true;
135135

136136
enum eCamType {
137-
Smooth3P = 0,
138-
DriverSeat1P = 1
137+
DriverSeat1P = 0,
138+
Smooth3P = 1, // Legacy
139+
Racing3P = 2, // New
139140
};
140141

141-
int camsLength = 2;
142-
int currentCam = eCamType::Smooth3P;
142+
int camsLength = 3;
143+
int currentCam = eCamType::Racing3P; // Use new by default
143144

144145
NativeMenu::Menu menu;
145146
NativeMenu::MenuControls menuControls;
@@ -614,16 +615,16 @@ void ShowNotification(const char* msg)
614615
UI::_DRAW_NOTIFICATION(false, true);
615616
}
616617

617-
void ReadSettings(bool notify)
618+
void ReadSettings(bool byUser)
618619
{
619620
CSimpleIniA ini;
620621
//ini.SetUnicode();
621622
SI_Error res = ini.LoadFile("CustomCameraVPlus.ini");
622623

623624
if (res == SI_Error::SI_OK) {
624-
reloadKey = strdup(ini.GetValue("keyMappings", "reloadSettingsKey", "F10"));
625+
reloadKey = strdup(ini.GetValue("keyMappings", "reloadSettingsKey", "F10"));
625626
toggleModKey = strdup(ini.GetValue("keyMappings", "toggleModKey", "1"));
626-
lookLeftKey = strdup(ini.GetValue("keyMappings", "lookLeftKey", "B"));
627+
lookLeftKey = strdup(ini.GetValue("keyMappings", "lookLeftKey", "B"));
627628
lookRightKey = strdup(ini.GetValue("keyMappings", "lookRightKey", "N"));
628629

629630
distanceOffset3p = (float)ini.GetDoubleValue("3rdPersonView", "distanceOffset", 0.0);
@@ -654,7 +655,13 @@ void ReadSettings(bool notify)
654655
gamepadSensibility = (float)ini.GetDoubleValue("input", "gamepadSensibility", 1.0);
655656
mouseSensibility = (float)ini.GetDoubleValue("input", "mouseSensibility", 1.0);
656657

657-
if (notify) {
658+
if (!byUser)
659+
{
660+
currentCam = (int)ini.GetLongValue("general", "DefaultCamera", 2);
661+
currentCam = currentCam % camsLength;
662+
}
663+
664+
if (byUser) {
658665
ShowNotification("CCVPlus: Settings reloaded");
659666
updateVehicleProperties();
660667
setupCurrentCamera();
@@ -1103,7 +1110,7 @@ void setupCurrentCamera() {
11031110
smoothQuatSeat = getEntityQuaternion(veh);
11041111
relAngle3p = 0.f;
11051112
}
1106-
else if (currentCam == eCamType::Smooth3P) {
1113+
else if (currentCam == eCamType::Smooth3P || currentCam == eCamType::Racing3P) {
11071114
CAM::SET_CAM_NEAR_CLIP(customCam, 0.15f);
11081115
CAM::SET_CAM_FAR_CLIP(customCam, 800.0f);
11091116
CAM::SET_CAM_FOV(customCam, fov3P);
@@ -1474,7 +1481,7 @@ Vector3f V3Reflect(Vector3f vector, Vector3f normal)
14741481
return vector - temp;
14751482
}
14761483

1477-
void updateCamV3Alogrithm()
1484+
void updateCamRacing3P()
14781485
{
14791486
float calcHeigthOffset = heightOffset3p + 0.15f + heightIcrementCalc;
14801487

@@ -1705,15 +1712,15 @@ void updateCamV3Alogrithm()
17051712

17061713
rotEuler = QuatToEuler(compositeQuat);
17071714

1708-
rotEuler[1] = smoothAngularDiff * -2.25f;
1715+
rotEuler[1] = angularVelZ * -0.2f;
17091716

17101717
//smoothVehRightVector = lerp(smoothVehRightVector, vehRightVector, 8.8f * getDeltaTime());
17111718

1712-
CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f + (distIncFinal * 2.3f)) - cameraAngle3p, rotEuler.y(), rotEuler.z() + (smoothAngularDiff * 1.925f * (1.f - clamp01(smoothVelocity.normalized().dot(vehForwardVector)))), 2);
1719+
CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f + (distIncFinal * 2.3f)) - cameraAngle3p, rotEuler.y(), rotEuler.z() + (angularVelZ * 1.925f * (1.f - clamp01(smoothVelocity.normalized().dot(vehForwardVector)))), 2);
17131720
//CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f + (distIncFinal * 2.3f)) - cameraAngle3p, rotEuler.y(), rotEuler.z() + ((smoothAngularDiff * + (smoothVelocity.dot(smoothVehRightVector))) * 0.2f), 2);
17141721
}
17151722

1716-
void updateCam3pNfsAlgorithm()
1723+
void updateCamSmooth3P()
17171724
{
17181725
float calcHeigthOffset = heightOffset3p + 0.15f + heightIcrementCalc;
17191726

@@ -1952,16 +1959,13 @@ void updateCam3pNfsAlgorithm()
19521959
CAM::SET_CAM_ROT(customCam, rotEuler.x() + (lookDownThreshold * 7.5f + (distIncFinal * 2.3f)) - cameraAngle3p, rotEuler.y(), rotEuler.z(), 2);
19531960
}
19541961

1955-
void updateCameraSmooth3P() {
1956-
//updateCam3pSmoothAlgorithm();
1957-
//updateCam3pNfsAlgorithm();
1958-
updateCamV3Alogrithm();
1959-
}
1960-
19611962
void updateCustomCamera()
19621963
{
1963-
if (currentCam == eCamType::Smooth3P) {
1964-
updateCameraSmooth3P();
1964+
if (currentCam == eCamType::Racing3P) {
1965+
updateCamRacing3P();
1966+
}
1967+
else if (currentCam == eCamType::Smooth3P) {
1968+
updateCamSmooth3P();
19651969
}
19661970
else if(currentCam == eCamType::DriverSeat1P) {
19671971
updateCameraDriverSeat();

0 commit comments

Comments
 (0)