Skip to content

Commit 24f44fb

Browse files
committed
Add vehicle_bump mode
1 parent 3738dc5 commit 24f44fb

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

Client/game_sa/CSettingsSA.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ bool ms_fovAimingFromScript = false;
503503
bool ms_fovSniperAimingFromScript = false;
504504
bool ms_fov1stPersonAimingFromScript = false;
505505

506+
float ms_fov1stPerson = 60.0f;
507+
bool ms_fov1stPersonFromScript = false;
508+
506509
// consider moving this to the camera class - qaisjp
507510
float CSettingsSA::GetFieldOfViewPlayer()
508511
{
@@ -542,6 +545,11 @@ float CSettingsSA::GetFieldOfView1stPersonAiming()
542545
return ms_fov1stPersonAiming;
543546
}
544547

548+
float CSettingsSA::GetFieldOfViewVehicleBump()
549+
{
550+
return ms_fov1stPerson;
551+
}
552+
545553
void CSettingsSA::ResetFieldOfViewPlayer()
546554
{
547555
float fieldOfView;
@@ -596,6 +604,14 @@ void CSettingsSA::ResetFieldOfView1stPersonAiming()
596604
ms_fov1stPersonAiming = 70.0f;
597605
}
598606

607+
void CSettingsSA::ResetFieldOfViewVehicleBump()
608+
{
609+
ms_fov1stPerson = 60.0f;
610+
611+
MemCpy((void*)0x517EBA, "\x00\x00\x8C\x42", 4);
612+
MemCpy((void*)0x51814B, "\x00\x00\x70\x42", 4);
613+
}
614+
599615
void CSettingsSA::UpdateFieldOfViewFromSettings()
600616
{
601617
float fFieldOfView;
@@ -605,8 +621,10 @@ void CSettingsSA::UpdateFieldOfViewFromSettings()
605621
SetFieldOfViewVehicle(fFieldOfView, false);
606622
SetFieldOfViewVehicleMax(100, false);
607623

624+
ms_fovAiming = 70.0f;
608625
ResetFieldOfViewSniperAiming();
609626
ResetFieldOfView1stPersonAiming();
627+
ResetFieldOfViewVehicleBump();
610628
}
611629

612630
void CSettingsSA::ResetFieldOfViewFromScript()
@@ -616,6 +634,7 @@ void CSettingsSA::ResetFieldOfViewFromScript()
616634
ms_fovAimingFromScript = false;
617635
ms_fovSniperAimingFromScript = false;
618636
ms_fov1stPersonAimingFromScript = false;
637+
ms_fov1stPersonFromScript = false;
619638

620639
UpdateFieldOfViewFromSettings();
621640
}
@@ -741,7 +760,8 @@ bool CSettingsSA::SetFieldOfViewSniperAiming(float angle, bool fromScript)
741760
if (cameraViewMode == MODE_SNIPER)
742761
{
743762
cam->SetFOV(angle);
744-
*(float*)0x00B6FFE8 = angle;
763+
764+
*(float*)0xB6FFE8 = angle; // something related to FOV - need it to be set here
745765
}
746766

747767
ms_fovSniperAimingFromScript = fromScript;
@@ -773,6 +793,20 @@ bool CSettingsSA::SetFieldOfView1stPersonAiming(float angle, bool fromScript)
773793
return true;
774794
}
775795

796+
bool CSettingsSA::SetFieldOfViewVehicleBump(float angle, bool fromScript)
797+
{
798+
if (!fromScript && ms_fov1stPersonFromScript)
799+
return false;
800+
801+
ms_fov1stPerson = angle;
802+
803+
MemCpy((void*)0x517EBA, &ms_fov1stPerson, 4);
804+
MemCpy((void*)0x51814B, &ms_fov1stPerson, 4);
805+
806+
ms_fov1stPersonFromScript = fromScript;
807+
return true;
808+
}
809+
776810
////////////////////////////////////////////////
777811
//
778812
// Vehicles LOD draw distance

Client/game_sa/CSettingsSA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,20 @@ class CSettingsSA : public CGameSettings
168168
bool SetFieldOfViewAiming(float angle, bool fromScript);
169169
bool SetFieldOfViewSniperAiming(float angle, bool fromScript);
170170
bool SetFieldOfView1stPersonAiming(float angle, bool fromScript);
171+
bool SetFieldOfViewVehicleBump(float angle, bool fromScript);
171172
float GetFieldOfViewPlayer();
172173
float GetFieldOfViewVehicle();
173174
float GetFieldOfViewVehicleMax();
174175
float GetFieldOfViewAiming();
175176
float GetFieldOfViewSniperAiming();
176177
float GetFieldOfView1stPersonAiming();
178+
float GetFieldOfViewVehicleBump();
177179
void ResetFieldOfViewPlayer();
178180
void ResetFieldOfViewVehicle();
179181
void ResetFieldOfViewVehicleMax();
180182
void ResetFieldOfViewSniperAiming();
181183
void ResetFieldOfView1stPersonAiming();
184+
void ResetFieldOfViewVehicleBump();
182185

183186
void SetVehiclesLODDistance(float fVehiclesLODDistance, float fTrainsPlanesLODDistance, bool bFromScript);
184187
void ResetVehiclesLODDistance(bool bForceDefault = false);

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ ADD_ENUM(FOV_MODE_VEHICLE_MAX, "vehicle_max")
556556
ADD_ENUM(FOV_MODE_AIMING, "aiming")
557557
ADD_ENUM(FOV_MODE_SNIPER_AIMING, "sniper_aiming")
558558
ADD_ENUM(FOV_MODE_1ST_PERSON_AIMING, "1stperson_aiming")
559+
ADD_ENUM(FOV_MODE_VEHICLE_BUMP, "vehicle_bump")
559560
IMPLEMENT_ENUM_END("fieldofview-mode")
560561

561562
IMPLEMENT_ENUM_BEGIN(eTrayIconType)

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ enum eFieldOfViewMode
132132
FOV_MODE_VEHICLE_MAX,
133133
FOV_MODE_AIMING,
134134
FOV_MODE_SNIPER_AIMING,
135-
FOV_MODE_1ST_PERSON_AIMING
135+
FOV_MODE_1ST_PERSON_AIMING,
136+
FOV_MODE_VEHICLE_BUMP,
136137
};
137138
DECLARE_ENUM(eFieldOfViewMode);
138139

Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ std::variant<float, bool> CLuaCameraDefs::GetCameraFieldOfView(eFieldOfViewMode
179179
return g_pGame->GetSettings()->GetFieldOfViewSniperAiming();
180180
case FOV_MODE_1ST_PERSON_AIMING:
181181
return g_pGame->GetSettings()->GetFieldOfView1stPersonAiming();
182+
case FOV_MODE_VEHICLE_BUMP:
183+
return g_pGame->GetSettings()->GetFieldOfViewVehicleBump();
182184
default:
183185
return false;
184186
}
@@ -256,6 +258,8 @@ bool CLuaCameraDefs::SetCameraFieldOfView(eFieldOfViewMode mode, float fov, std:
256258
return g_pGame->GetSettings()->SetFieldOfViewSniperAiming(fov, true);
257259
case FOV_MODE_1ST_PERSON_AIMING:
258260
return g_pGame->GetSettings()->SetFieldOfView1stPersonAiming(fov, true);
261+
case FOV_MODE_VEHICLE_BUMP:
262+
return g_pGame->GetSettings()->SetFieldOfViewVehicleBump(fov, true);
259263
}
260264

261265
return true;
@@ -282,6 +286,9 @@ void CLuaCameraDefs::ResetCameraFieldOfView(eFieldOfViewMode mode)
282286
case FOV_MODE_1ST_PERSON_AIMING:
283287
g_pGame->GetSettings()->ResetFieldOfView1stPersonAiming();
284288
break;
289+
case FOV_MODE_VEHICLE_BUMP:
290+
g_pGame->GetSettings()->ResetFieldOfViewVehicleBump();
291+
break;
285292
}
286293
}
287294

Client/sdk/game/CSettings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,22 @@ class CGameSettings
161161
virtual bool SetFieldOfViewAiming(float angle, bool fromScript) = 0;
162162
virtual bool SetFieldOfViewSniperAiming(float angle, bool fromScript) = 0;
163163
virtual bool SetFieldOfView1stPersonAiming(float angle, bool fromScript) = 0;
164+
virtual bool SetFieldOfViewVehicleBump(float angle, bool fromScript) = 0;
164165

165166
virtual float GetFieldOfViewPlayer() = 0;
166167
virtual float GetFieldOfViewVehicle() = 0;
167168
virtual float GetFieldOfViewVehicleMax() = 0;
168169
virtual float GetFieldOfViewAiming() = 0;
169170
virtual float GetFieldOfViewSniperAiming() = 0;
170171
virtual float GetFieldOfView1stPersonAiming() = 0;
172+
virtual float GetFieldOfViewVehicleBump() = 0;
171173

172174
virtual void ResetFieldOfViewPlayer() = 0;
173175
virtual void ResetFieldOfViewVehicle() = 0;
174176
virtual void ResetFieldOfViewVehicleMax() = 0;
175177
virtual void ResetFieldOfViewSniperAiming() = 0;
176178
virtual void ResetFieldOfView1stPersonAiming() = 0;
179+
virtual void ResetFieldOfViewVehicleBump() = 0;
177180

178181
virtual void SetVehiclesLODDistance(float fVehiclesLODDistance, float fTrainsPlanesLODDistance, bool bFromScript) = 0;
179182
virtual void ResetVehiclesLODDistance(bool bForceDefault = false) = 0;

0 commit comments

Comments
 (0)