Skip to content

Commit 1aef5e9

Browse files
committed
Rename property to vehicle_engine_autostart
1 parent 83cf6cf commit 1aef5e9

File tree

15 files changed

+44
-44
lines changed

15 files changed

+44
-44
lines changed

Client/game_sa/CVehicleSA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void _declspec(naked) HOOK_Vehicle_PreRender(void)
5757
}
5858
}
5959

60-
float& fTimeStep = *(float*)(0xB7CB5C);
60+
static float& fTimeStep = *(float*)(0xB7CB5C);
6161
static bool __fastcall CanProcessFlyingCarStuff(CAutomobileSAInterface* vehicleInterface)
6262
{
6363
SClientEntity<CVehicleSA>* vehicle = pGame->GetPools()->GetVehicle((DWORD*)vehicleInterface);
@@ -66,7 +66,7 @@ static bool __fastcall CanProcessFlyingCarStuff(CAutomobileSAInterface* vehicleI
6666

6767
if (vehicle->pEntity->GetVehicleRotorState())
6868
{
69-
if (!g_pCore->GetMultiplayer()->IsVehicleEngineManualModeEnabled()) // keep default behavior
69+
if (g_pCore->GetMultiplayer()->IsVehicleEngineAutoStartEnabled()) // keep default behavior
7070
return true;
7171

7272
if (vehicle->pEntity->GetEntityStatus() != eEntityStatus::STATUS_PHYSICS && !vehicle->pEntity->IsBeingDriven())

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6057,8 +6057,8 @@ bool CClientGame::SetWorldSpecialProperty(const WorldSpecialProperty property, c
60576057
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
60586058
g_pGame->SetVehicleBurnExplosionsEnabled(enabled);
60596059
break;
6060-
case WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE:
6061-
SetVehicleEngineManualModeEnabled(enabled);
6060+
case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART:
6061+
SetVehicleEngineAutoStartEnabled(enabled);
60626062
break;
60636063
default:
60646064
return false;
@@ -6106,8 +6106,8 @@ bool CClientGame::IsWorldSpecialProperty(const WorldSpecialProperty property)
61066106
return m_pVehicleManager->IsSpawnFlyingComponentEnabled();
61076107
case WorldSpecialProperty::VEHICLEBURNEXPLOSIONS:
61086108
return g_pGame->IsVehicleBurnExplosionsEnabled();
6109-
case WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE:
6110-
return IsVehicleEngineManualModeEnabled();
6109+
case WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART:
6110+
return IsVehicleEngineAutoStartEnabled();
61116111
}
61126112

61136113
return false;
@@ -6143,18 +6143,18 @@ bool CClientGame::IsWeaponRenderEnabled() const
61436143
return g_pGame->IsWeaponRenderEnabled();
61446144
}
61456145

6146-
void CClientGame::SetVehicleEngineManualModeEnabled(bool enabled)
6146+
void CClientGame::SetVehicleEngineAutoStartEnabled(bool enabled)
61476147
{
6148-
if (enabled == g_pMultiplayer->IsVehicleEngineManualModeEnabled())
6148+
if (enabled == g_pMultiplayer->IsVehicleEngineAutoStartEnabled())
61496149
return;
61506150

6151-
g_pMultiplayer->SetVehicleEngineManualModeEnabled(enabled);
6151+
g_pMultiplayer->SetVehicleEngineAutoStartEnabled(enabled);
61526152
m_pVehicleManager->ResetNotControlledRotors(enabled);
61536153
}
61546154

6155-
bool CClientGame::IsVehicleEngineManualModeEnabled() const
6155+
bool CClientGame::IsVehicleEngineAutoStartEnabled() const
61566156
{
6157-
return g_pMultiplayer->IsVehicleEngineManualModeEnabled();
6157+
return g_pMultiplayer->IsVehicleEngineAutoStartEnabled();
61586158
}
61596159

61606160
#pragma code_seg(".text")
@@ -6842,7 +6842,7 @@ void CClientGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo
68426842
g_pGame->SetIgnoreFireStateEnabled(false);
68436843
m_pVehicleManager->SetSpawnFlyingComponentEnabled(true);
68446844
g_pGame->SetVehicleBurnExplosionsEnabled(true);
6845-
SetVehicleEngineManualModeEnabled(false);
6845+
SetVehicleEngineAutoStartEnabled(true);
68466846
}
68476847

68486848
// Reset all setWorldProperty to default

Client/mods/deathmatch/logic/CClientGame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ class CClientGame
426426
void SetWeaponRenderEnabled(bool enabled);
427427
bool IsWeaponRenderEnabled() const;
428428

429-
void SetVehicleEngineManualModeEnabled(bool enabled);
430-
bool IsVehicleEngineManualModeEnabled() const;
429+
void SetVehicleEngineAutoStartEnabled(bool enabled);
430+
bool IsVehicleEngineAutoStartEnabled() const;
431431

432432
void ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo);
433433

Client/mods/deathmatch/logic/CClientVehicleManager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,16 +792,16 @@ void CClientVehicleManager::RestreamVehicleUpgrades(unsigned short usModel)
792792
}
793793
}
794794

795-
void CClientVehicleManager::ResetNotControlledRotors(bool isManualMode)
795+
void CClientVehicleManager::ResetNotControlledRotors(bool engineAutoStart)
796796
{
797-
// Reset rotors to custom or original state for loaded vehicles without controller
797+
// Reset rotors to original or custom state for loaded vehicles without controller
798798
// Custom state allows rotors to spin without driver inside (if engine is on)
799-
eEntityStatus status = isManualMode ? eEntityStatus::STATUS_PHYSICS : eEntityStatus::STATUS_ABANDONED;
799+
eEntityStatus status = engineAutoStart ? eEntityStatus::STATUS_ABANDONED : eEntityStatus::STATUS_PHYSICS;
800800
for (auto& pVehicle : m_List)
801801
{
802802
if (pVehicle->GetGameEntity() && pVehicle->GetVehicleRotorState() && !pVehicle->IsDriven())
803803
{
804-
float speed = (isManualMode && pVehicle->IsEngineOn()) ? 0.001f : 0.0f;
804+
float speed = (!engineAutoStart && pVehicle->IsEngineOn()) ? 0.001f : 0.0f;
805805
pVehicle->GetGameEntity()->SetEntityStatus(status);
806806
pVehicle->SetHeliRotorSpeed(speed);
807807
pVehicle->SetPlaneRotorSpeed(speed);

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ void CPacketHandler::Packet_MapInfo(NetBitStreamInterface& bitStream)
24022402
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::IGNOREFIRESTATE, wsProps.data6.ignoreFireState);
24032403
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::FLYINGCOMPONENTS, wsProps.data7.flyingcomponents);
24042404
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, wsProps.data8.vehicleburnexplosions);
2405-
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE, wsProps.data9.vehEngineManualMode);
2405+
g_pClientGame->SetWorldSpecialProperty(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, wsProps.data9.vehicleEngineAutoStart);
24062406

24072407
float fJetpackMaxHeight = 100;
24082408
if (!bitStream.Read(fJetpackMaxHeight))

Client/multiplayer_sa/CMultiplayerSA.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6634,22 +6634,22 @@ void CMultiplayerSA::SetAutomaticVehicleStartupOnPedEnter(bool bSet)
66346634
MemSet((char*)0x64BC0D, 0x90, 6);
66356635
}
66366636

6637-
bool CMultiplayerSA::IsVehicleEngineManualModeEnabled() const noexcept
6637+
bool CMultiplayerSA::IsVehicleEngineAutoStartEnabled() const noexcept
66386638
{
6639-
return *(unsigned char*)0x64BC03 == 0x90;
6639+
return *(unsigned char*)0x64BC03 == 0x75;
66406640
}
66416641

6642-
void CMultiplayerSA::SetVehicleEngineManualModeEnabled(bool enabled)
6642+
void CMultiplayerSA::SetVehicleEngineAutoStartEnabled(bool enabled)
66436643
{
66446644
if (enabled)
66456645
{
6646-
MemSet((void*)0x64BC03, 0x90, 5); // prevent vehicle engine from turning on (driver enter)
6647-
MemCpy((void*)0x6C4EA9, "\xE9\x15\x03\x00", 4); // prevent aircraft engine from turning off (driver exit)
6646+
MemCpy((void*)0x64BC03, "\x75\x05\x80\xC9\x10", 5);
6647+
MemCpy((void*)0x6C4EA9, "\x8A\x86\x28\x04", 4);
66486648
}
66496649
else
66506650
{
6651-
MemCpy((void*)0x64BC03, "\x75\x05\x80\xC9\x10", 5);
6652-
MemCpy((void*)0x6C4EA9, "\x8A\x86\x28\x04", 4);
6651+
MemSet((void*)0x64BC03, 0x90, 5); // prevent vehicle engine from turning on (driver enter)
6652+
MemCpy((void*)0x6C4EA9, "\xE9\x15\x03\x00", 4); // prevent aircraft engine from turning off (driver exit)
66536653
}
66546654
}
66556655

Client/multiplayer_sa/CMultiplayerSA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ class CMultiplayerSA : public CMultiplayer
333333

334334
void SetAutomaticVehicleStartupOnPedEnter(bool bSet);
335335

336-
bool IsVehicleEngineManualModeEnabled() const noexcept override;
337-
void SetVehicleEngineManualModeEnabled(bool enabled) override;
336+
bool IsVehicleEngineAutoStartEnabled() const noexcept override;
337+
void SetVehicleEngineAutoStartEnabled(bool enabled) override;
338338

339339
void SetPedTargetingMarkerEnabled(bool bEnable);
340340
bool IsPedTargetingMarkerEnabled();

Client/sdk/multiplayer/CMultiplayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ class CMultiplayer
444444

445445
virtual void SetAutomaticVehicleStartupOnPedEnter(bool bSet) = 0;
446446

447-
virtual bool IsVehicleEngineManualModeEnabled() const noexcept = 0;
448-
virtual void SetVehicleEngineManualModeEnabled(bool enabled) = 0;
447+
virtual bool IsVehicleEngineAutoStartEnabled() const noexcept = 0;
448+
virtual void SetVehicleEngineAutoStartEnabled(bool enabled) = 0;
449449

450450
virtual void SetPedTargetingMarkerEnabled(bool bEnabled) = 0;
451451
virtual bool IsPedTargetingMarkerEnabled() = 0;

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
263263
m_WorldSpecialProps[WorldSpecialProperty::IGNOREFIRESTATE] = false;
264264
m_WorldSpecialProps[WorldSpecialProperty::FLYINGCOMPONENTS] = true;
265265
m_WorldSpecialProps[WorldSpecialProperty::VEHICLEBURNEXPLOSIONS] = true;
266-
m_WorldSpecialProps[WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE] = false;
266+
m_WorldSpecialProps[WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART] = true;
267267

268268
m_JetpackWeapons[WEAPONTYPE_MICRO_UZI] = true;
269269
m_JetpackWeapons[WEAPONTYPE_TEC9] = true;
@@ -3406,7 +3406,7 @@ void CGame::Packet_Vehicle_InOut(CVehicleInOutPacket& Packet)
34063406
pPed->SetVehicleAction(CPed::VEHICLEACTION_NONE);
34073407

34083408
// Update our engine State
3409-
if (!g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE))
3409+
if (g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART))
34103410
pVehicle->SetEngineOn(true);
34113411

34123412
// Tell everyone he's in (they should warp him in)
@@ -4526,7 +4526,7 @@ void CGame::ResetWorldProperties(const ResetWorldPropsInfo& resetPropsInfo)
45264526
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::IGNOREFIRESTATE, false);
45274527
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::FLYINGCOMPONENTS, true);
45284528
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLEBURNEXPLOSIONS, true);
4529-
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE, false);
4529+
g_pGame->SetWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART, true);
45304530
}
45314531

45324532
// Reset all weather stuff like heat haze, wind velocity etc

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4262,7 +4262,7 @@ bool CStaticFunctionDefinitions::WarpPedIntoVehicle(CPed* pPed, CVehicle* pVehic
42624262
pPed->SetVehicleAction(CPed::VEHICLEACTION_NONE);
42634263

42644264
// If he's the driver, switch on the engine
4265-
if (uiSeat == 0 && !g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_MANUAL_MODE))
4265+
if (uiSeat == 0 && g_pGame->IsWorldSpecialPropertyEnabled(WorldSpecialProperty::VEHICLE_ENGINE_AUTOSTART))
42664266
pVehicle->SetEngineOn(true);
42674267

42684268
// Tell all the players

0 commit comments

Comments
 (0)