Skip to content

Commit e831f62

Browse files
committed
Revert "Add spawnFlyingComponent & breakGlass arguments for setVehiclePanelState (PR #3572)"
This reverts commit 5b69d70.
1 parent 5b69d70 commit e831f62

File tree

14 files changed

+31
-71
lines changed

14 files changed

+31
-71
lines changed

Client/game_sa/CDamageManagerSA.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void CDamageManagerSA::SetWheelStatus(eWheelPosition bWheel, BYTE bTireStatus)
9898
}
9999
}
100100

101-
void CDamageManagerSA::SetPanelStatus(BYTE bPanel, BYTE bPanelStatus, bool spawnFlyingComponent, bool breakGlass)
101+
void CDamageManagerSA::SetPanelStatus(BYTE bPanel, BYTE bPanelStatus)
102102
{
103103
// Valid index?
104104
if (bPanel < MAX_PANELS && bPanelStatus <= 3)
@@ -140,19 +140,28 @@ void CDamageManagerSA::SetPanelStatus(BYTE bPanel, BYTE bPanelStatus, bool spawn
140140
else
141141
{
142142
// Call CAutomobile::SetPanelDamage to update the vehicle
143-
((void(__thiscall*)(CEntitySAInterface*, int, bool, bool))0x6B1480)(internalEntityInterface, dwPanel, bPanel == ePanels::WINDSCREEN_PANEL && breakGlass, !spawnFlyingComponent);
143+
dwFunction = 0x6B1480;
144+
dwThis = (DWORD)internalEntityInterface;
145+
bool bUnknown = false;
146+
_asm
147+
{
148+
mov ecx, dwThis
149+
push bUnknown
150+
push dwPanel
151+
call dwFunction
152+
}
144153
}
145154
}
146155
}
147156
}
148157

149-
void CDamageManagerSA::SetPanelStatus(unsigned long ulStatus, bool spawnFlyingComponent, bool breakGlass)
158+
void CDamageManagerSA::SetPanelStatus(unsigned long ulStatus)
150159
{
151160
unsigned int uiIndex;
152161

153162
for (uiIndex = 0; uiIndex < MAX_PANELS; uiIndex++)
154163
{
155-
SetPanelStatus(static_cast<eDoors>(uiIndex), static_cast<unsigned char>(ulStatus), spawnFlyingComponent, breakGlass);
164+
SetPanelStatus(static_cast<eDoors>(uiIndex), static_cast<unsigned char>(ulStatus));
156165
ulStatus >>= 4;
157166
}
158167
}

Client/game_sa/CDamageManagerSA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class CDamageManagerSA : public CDamageManager
5151
void SetWheelStatus(eWheelPosition bWheel, BYTE bTireStatus);
5252
BYTE GetPanelStatus(BYTE bPanel);
5353
unsigned long GetPanelStatus();
54-
void SetPanelStatus(BYTE bPanel, BYTE bPanelStatus, bool spawnFlyingComponent = true, bool breakGlass = false);
55-
void SetPanelStatus(unsigned long ulStatus, bool spawnFlyingComponent = true, bool breakGlass = false);
54+
void SetPanelStatus(BYTE bPanel, BYTE bPanelStatus);
55+
void SetPanelStatus(unsigned long ulStatus);
5656
BYTE GetLightStatus(BYTE bLight);
5757
unsigned char GetLightStatus();
5858
void SetLightStatus(BYTE bLight, BYTE bLightStatus);

Client/mods/deathmatch/logic/CClientVehicle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,12 +1521,12 @@ bool CClientVehicle::GetWheelMissing(unsigned char ucWheel, const SString& strWh
15211521
return false;
15221522
}
15231523

1524-
void CClientVehicle::SetPanelStatus(unsigned char ucPanel, unsigned char ucStatus, bool spawnFlyingComponent, bool breakGlass)
1524+
void CClientVehicle::SetPanelStatus(unsigned char ucPanel, unsigned char ucStatus)
15251525
{
15261526
if (ucPanel < MAX_PANELS)
15271527
{
15281528
if (m_pVehicle && HasDamageModel())
1529-
m_pVehicle->GetDamageManager()->SetPanelStatus(static_cast<ePanels>(ucPanel), ucStatus, spawnFlyingComponent, breakGlass);
1529+
m_pVehicle->GetDamageManager()->SetPanelStatus(static_cast<ePanels>(ucPanel), ucStatus);
15301530

15311531
m_ucPanelStates[ucPanel] = ucStatus;
15321532
}

Client/mods/deathmatch/logic/CClientVehicle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class CClientVehicle : public CClientStreamElement
292292

293293
void SetDoorStatus(unsigned char ucDoor, unsigned char ucStatus, bool spawnFlyingComponent);
294294
void SetWheelStatus(unsigned char ucWheel, unsigned char ucStatus, bool bSilent = true);
295-
void SetPanelStatus(unsigned char ucPanel, unsigned char ucStatus, bool spawnFlyingComponent = true, bool breakGlass = false);
295+
void SetPanelStatus(unsigned char ucPanel, unsigned char ucStatus);
296296
void SetLightStatus(unsigned char ucLight, unsigned char ucStatus);
297297
bool GetWheelMissing(unsigned char ucWheel, const SString& strWheelName = "");
298298

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,17 +3197,17 @@ bool CStaticFunctionDefinitions::SetVehicleLightState(CClientEntity& Entity, uns
31973197
return false;
31983198
}
31993199

3200-
bool CStaticFunctionDefinitions::SetVehiclePanelState(CClientEntity& Entity, unsigned char ucPanel, unsigned char ucState, bool spawnFlyingComponent, bool breakGlass)
3200+
bool CStaticFunctionDefinitions::SetVehiclePanelState(CClientEntity& Entity, unsigned char ucPanel, unsigned char ucState)
32013201
{
3202-
RUN_CHILDREN(SetVehiclePanelState(**iter, ucPanel, ucState, spawnFlyingComponent, breakGlass))
3202+
RUN_CHILDREN(SetVehiclePanelState(**iter, ucPanel, ucState))
32033203

32043204
if (IS_VEHICLE(&Entity))
32053205
{
32063206
CClientVehicle& Vehicle = static_cast<CClientVehicle&>(Entity);
32073207

32083208
if (ucPanel < 7)
32093209
{
3210-
Vehicle.SetPanelStatus(ucPanel, ucState, spawnFlyingComponent, breakGlass);
3210+
Vehicle.SetPanelStatus(ucPanel, ucState);
32113211
return true;
32123212
}
32133213
}

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class CStaticFunctionDefinitions
243243
static bool SetVehicleDoorState(CClientEntity& Entity, unsigned char ucDoor, unsigned char ucState, bool spawnFlyingComponent);
244244
static bool SetVehicleWheelStates(CClientEntity& Entity, int iFrontLeft, int iRearLeft = -1, int iFrontRight = -1, int iRearRight = -1);
245245
static bool SetVehicleLightState(CClientEntity& Entity, unsigned char ucLight, unsigned char ucState);
246-
static bool SetVehiclePanelState(CClientEntity& Entity, unsigned char ucPanel, unsigned char ucState, bool spawnFlyingComponent = true, bool breakGlass = false);
246+
static bool SetVehiclePanelState(CClientEntity& Entity, unsigned char ucPanel, unsigned char ucState);
247247
static bool SetVehicleOverrideLights(CClientEntity& Entity, unsigned char ucLights);
248248
static bool AttachTrailerToVehicle(CClientVehicle& Vehicle, CClientVehicle& Trailer, const CVector& vecRotationOffsetDegrees);
249249
static bool DetachTrailerFromVehicle(CClientVehicle& Vehicle, CClientVehicle* pTrailer = NULL);

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,17 +1956,14 @@ int CLuaVehicleDefs::SetVehiclePanelState(lua_State* luaVM)
19561956
{
19571957
CClientEntity* pEntity = NULL;
19581958
unsigned char ucPanel = 0, ucState = 0;
1959-
bool spawnFlyingComponent, breakGlass;
19601959
CScriptArgReader argStream(luaVM);
19611960
argStream.ReadUserData(pEntity);
19621961
argStream.ReadNumber(ucPanel);
19631962
argStream.ReadNumber(ucState);
1964-
argStream.ReadBool(spawnFlyingComponent, true);
1965-
argStream.ReadBool(breakGlass, false);
19661963

19671964
if (!argStream.HasErrors())
19681965
{
1969-
if (CStaticFunctionDefinitions::SetVehiclePanelState(*pEntity, ucPanel, ucState, spawnFlyingComponent, breakGlass))
1966+
if (CStaticFunctionDefinitions::SetVehiclePanelState(*pEntity, ucPanel, ucState))
19701967
{
19711968
lua_pushboolean(luaVM, true);
19721969
return 1;

Client/mods/deathmatch/logic/rpc/CVehicleRPCs.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,7 @@ void CVehicleRPCs::SetVehicleDamageState(CClientEntity* pSource, NetBitStreamInt
352352
unsigned char ucPanel, ucState;
353353
if (bitStream.Read(ucPanel) && bitStream.Read(ucState))
354354
{
355-
bool spawnFlyingComponent = true;
356-
bool breakGlass = false;
357-
if (bitStream.Can(eBitStreamVersion::SetVehiclePanelState_SpawnFlyingComponent))
358-
{
359-
bitStream.ReadBit(spawnFlyingComponent);
360-
bitStream.ReadBit(breakGlass);
361-
}
362-
363-
pVehicle->SetPanelStatus(ucPanel, ucState, spawnFlyingComponent, breakGlass);
355+
pVehicle->SetPanelStatus(ucPanel, ucState);
364356
}
365357
}
366358
default:

Client/multiplayer_sa/CMultiplayerSA_Vehicles.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,6 @@ static void _declspec(naked) HOOK_CAEVehicleAudioEntity__Initialise()
107107
}
108108
}
109109

110-
//////////////////////////////////////////////////////////////////////////////////////////
111-
// CAutomobile::SetPanelDamage
112-
//
113-
// This hook allows determining whether flying components should be spawned
114-
//////////////////////////////////////////////////////////////////////////////////////////
115-
#define HOOKPOS_CAutomobile_SetPanelDamage 0x6B15BE
116-
#define HOOKSIZE_CAutomobile_SetPanelDamage 5
117-
static DWORD SPAWN_FLYING_COMPONENTS = 0x6B15C3;
118-
static DWORD SKIP_FLYING_COMPONENTS = 0x6B15DA;
119-
static void _declspec(naked) HOOK_CAutomobile_SetPanelDamage()
120-
{
121-
_asm
122-
{
123-
mov al, byte ptr [esp+1Ch]
124-
test al, al
125-
jnz skipFlyingComponents
126-
127-
push 5
128-
push ebp
129-
mov ecx, esi
130-
jmp SPAWN_FLYING_COMPONENTS
131-
132-
skipFlyingComponents:
133-
jmp SKIP_FLYING_COMPONENTS
134-
}
135-
}
136-
137110
//////////////////////////////////////////////////////////////////////////////////////////
138111
//
139112
// CMultiplayerSA::InitHooks_Vehicles
@@ -145,5 +118,4 @@ void CMultiplayerSA::InitHooks_Vehicles()
145118
{
146119
EZHookInstall(CDamageManager__ProgressDoorDamage);
147120
EZHookInstall(CAEVehicleAudioEntity__Initialise);
148-
EZHookInstall(CAutomobile_SetPanelDamage);
149121
}

Client/sdk/game/CDamageManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ class CDamageManager
175175
virtual void SetWheelStatus(eWheelPosition bTire, BYTE bTireStatus) = 0;
176176
virtual BYTE GetPanelStatus(BYTE bPanel) = 0;
177177
virtual unsigned long GetPanelStatus() = 0;
178-
virtual void SetPanelStatus(BYTE bPanel, BYTE bPanelStatus, bool spawnFlyingComponent = true, bool breakGlass = false) = 0;
179-
virtual void SetPanelStatus(unsigned long ulStatus, bool spawnFlyingComponent = true, bool breakGlass = false) = 0;
178+
virtual void SetPanelStatus(BYTE bPanel, BYTE bPanelStatus) = 0;
179+
virtual void SetPanelStatus(unsigned long ulStatus) = 0;
180180
virtual BYTE GetLightStatus(BYTE bLight) = 0;
181181
virtual unsigned char GetLightStatus() = 0;
182182
virtual void SetLightStatus(BYTE bLight, BYTE bLightStatus) = 0;

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6719,10 +6719,10 @@ bool CStaticFunctionDefinitions::SetVehicleLightState(CElement* pElement, unsign
67196719
return false;
67206720
}
67216721

6722-
bool CStaticFunctionDefinitions::SetVehiclePanelState(CElement* pElement, unsigned char ucPanel, unsigned char ucState, bool spawnFlyingComponent, bool breakGlass)
6722+
bool CStaticFunctionDefinitions::SetVehiclePanelState(CElement* pElement, unsigned char ucPanel, unsigned char ucState)
67236723
{
67246724
assert(pElement);
6725-
RUN_CHILDREN(SetVehiclePanelState(*iter, ucPanel, ucState, spawnFlyingComponent, breakGlass))
6725+
RUN_CHILDREN(SetVehiclePanelState(*iter, ucPanel, ucState))
67266726

67276727
if (IS_VEHICLE(pElement))
67286728
{
@@ -6739,8 +6739,6 @@ bool CStaticFunctionDefinitions::SetVehiclePanelState(CElement* pElement, unsign
67396739
BitStream.pBitStream->Write(ucObject);
67406740
BitStream.pBitStream->Write(ucPanel);
67416741
BitStream.pBitStream->Write(ucState);
6742-
BitStream.pBitStream->WriteBit(spawnFlyingComponent);
6743-
BitStream.pBitStream->WriteBit(breakGlass);
67446742
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pVehicle, SET_VEHICLE_DAMAGE_STATE, *BitStream.pBitStream));
67456743
return true;
67466744
}

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class CStaticFunctionDefinitions
314314
static bool SetVehicleDoorState(CElement* pElement, unsigned char ucDoor, unsigned char ucState, bool spawnFlyingComponent);
315315
static bool SetVehicleWheelStates(CElement* pElement, int iFrontLeft, int iRearLeft = -1, int iFrontRight = -1, int iRearRight = -1);
316316
static bool SetVehicleLightState(CElement* pElement, unsigned char ucLight, unsigned char ucState);
317-
static bool SetVehiclePanelState(CElement* pElement, unsigned char ucPanel, unsigned char ucState, bool spawnFlyingComponent = true, bool breakGlass = false);
317+
static bool SetVehiclePanelState(CElement* pElement, unsigned char ucPanel, unsigned char ucState);
318318
static bool SetVehicleIdleRespawnDelay(CElement* pElement, unsigned long ulTime);
319319
static bool SetVehicleRespawnDelay(CElement* pElement, unsigned long ulTime);
320320
static bool GetVehicleRespawnPosition(CElement* pElement, CVector& vecPosition);

Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,19 +2125,15 @@ int CLuaVehicleDefs::SetVehiclePanelState(lua_State* luaVM)
21252125
CElement* pElement;
21262126
unsigned char ucPanel;
21272127
unsigned char ucState;
2128-
bool spawnFlyingComponent;
2129-
bool breakGlass;
21302128

21312129
CScriptArgReader argStream(luaVM);
21322130
argStream.ReadUserData(pElement);
21332131
argStream.ReadNumber(ucPanel);
21342132
argStream.ReadNumber(ucState);
2135-
argStream.ReadBool(spawnFlyingComponent, true);
2136-
argStream.ReadBool(breakGlass, false);
21372133

21382134
if (!argStream.HasErrors())
21392135
{
2140-
if (CStaticFunctionDefinitions::SetVehiclePanelState(pElement, ucPanel, ucState, spawnFlyingComponent, breakGlass))
2136+
if (CStaticFunctionDefinitions::SetVehiclePanelState(pElement, ucPanel, ucState))
21412137
{
21422138
lua_pushboolean(luaVM, true);
21432139
return 1;

Shared/sdk/net/bitstream.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,9 @@ enum class eBitStreamVersion : unsigned short
589589
WorldSpecialPropertyEvent,
590590

591591
// Add setElementOnFire function
592-
// 2024-12-30
592+
// 2024-30-12
593593
SetElementOnFire,
594594

595-
// Add "spawnFlyingComponent" to setVehiclePanelState
596-
// 2024-12-31
597-
SetVehiclePanelState_SpawnFlyingComponent,
598-
599595
// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
600596
// Make sure you only add things above this comment.
601597
Next,

0 commit comments

Comments
 (0)