Skip to content

Commit 9a5b666

Browse files
committed
Fix #1337 engineReplaceModel kicks the player out of the vehicle
1 parent 5dd446b commit 9a5b666

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ CClientGame::CClientGame(bool bLocalPlay) : m_ServerInfo(new CServerInfo())
121121
m_Glitches[GLITCH_FASTSPRINT] = false;
122122
m_Glitches[GLITCH_BADDRIVEBYHITBOX] = false;
123123
m_Glitches[GLITCH_QUICKSTAND] = false;
124+
m_Glitches[GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE] = false;
124125
g_pMultiplayer->DisableBadDrivebyHitboxes(true);
125126

126127
// Remove Night & Thermal vision view (if enabled).

Client/mods/deathmatch/logic/CClientGame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ class CClientGame
190190
GLITCH_FASTSPRINT,
191191
GLITCH_BADDRIVEBYHITBOX,
192192
GLITCH_QUICKSTAND,
193+
GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE,
193194
NUM_GLITCHES
194195
};
195196
class CStoredWeaponSlot

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,6 @@ void CClientPed::GetIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat, u
13471347

13481348
void CClientPed::WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat)
13491349
{
1350-
SetWarpInToVehicleRequired(true);
1351-
13521350
// Ensure vehicle model is loaded
13531351
CModelInfo* pModelInfo = pVehicle->GetModelInfo();
13541352
if (g_pGame->IsASyncLoadingEnabled() && !pModelInfo->IsLoaded())
@@ -1515,14 +1513,12 @@ void CClientPed::WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat)
15151513
RemoveTargetPosition();
15161514

15171515
// Make peds stream in when they warp to a vehicle
1518-
if (pVehicle)
1519-
{
1520-
CVector vecInVehiclePosition;
1521-
GetPosition(vecInVehiclePosition);
1522-
UpdateStreamPosition(vecInVehiclePosition);
1523-
if (pVehicle->IsStreamedIn() && !m_pPlayerPed)
1524-
StreamIn(true);
1525-
}
1516+
CVector vecInVehiclePosition;
1517+
GetPosition(vecInVehiclePosition);
1518+
UpdateStreamPosition(vecInVehiclePosition);
1519+
if (pVehicle->IsStreamedIn() && !m_pPlayerPed)
1520+
StreamIn(true);
1521+
SetWarpInToVehicleRequired(true);
15261522
}
15271523

15281524
void CClientPed::ResetToOutOfVehicleWeapon()
@@ -1537,6 +1533,7 @@ void CClientPed::ResetToOutOfVehicleWeapon()
15371533

15381534
CClientVehicle* CClientPed::RemoveFromVehicle(bool bSkipWarpIfGettingOut)
15391535
{
1536+
SetWarpInToVehicleRequired(false);
15401537
SetDoingGangDriveby(false);
15411538

15421539
// Reset any enter/exit tasks

Client/mods/deathmatch/logic/CClientVehicle.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,14 +2981,19 @@ void CClientVehicle::Destroy()
29812981
{
29822982
// Only remove him physically. Don't let the ped update us
29832983
pPed->InternalRemoveFromVehicle(m_pVehicle);
2984+
if (!g_pClientGame->IsGlitchEnabled(CClientGame::GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE))
2985+
pPed->SetWarpInToVehicleRequired(true);
29842986
}
29852987

29862988
// Remove all the passengers physically
29872989
for (unsigned int i = 0; i < 8; i++)
29882990
{
2989-
if (m_pPassengers[i])
2991+
CClientPed* pPassenger = m_pPassengers[i];
2992+
if (pPassenger)
29902993
{
2991-
m_pPassengers[i]->InternalRemoveFromVehicle(m_pVehicle);
2994+
pPassenger->InternalRemoveFromVehicle(m_pVehicle);
2995+
if (!g_pClientGame->IsGlitchEnabled(CClientGame::GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE))
2996+
pPassenger->SetWarpInToVehicleRequired(true);
29922997
}
29932998
}
29942999

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
173173
m_Glitches[GLITCH_FASTSPRINT] = false;
174174
m_Glitches[GLITCH_BADDRIVEBYHITBOX] = false;
175175
m_Glitches[GLITCH_QUICKSTAND] = false;
176+
m_Glitches[GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE] = false;
176177
for (int i = 0; i < WEAPONTYPE_LAST_WEAPONTYPE; i++)
177178
m_JetpackWeapons[i] = false;
178179

@@ -189,6 +190,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti
189190
m_GlitchNames["fastsprint"] = GLITCH_FASTSPRINT;
190191
m_GlitchNames["baddrivebyhitbox"] = GLITCH_BADDRIVEBYHITBOX;
191192
m_GlitchNames["quickstand"] = GLITCH_QUICKSTAND;
193+
m_GlitchNames["kickoutofvehicle_onmodelreplace"] = GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE;
192194

193195
m_bCloudsEnabled = true;
194196

Server/mods/deathmatch/logic/CGame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ class CGame
182182
GLITCH_FASTSPRINT,
183183
GLITCH_BADDRIVEBYHITBOX,
184184
GLITCH_QUICKSTAND,
185+
GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE,
185186
NUM_GLITCHES
186187
};
187188

0 commit comments

Comments
 (0)