Skip to content

Commit

Permalink
Implement entering/exiting/jacking for peds (#1748)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zangomangu committed Nov 28, 2020
1 parent fe1c418 commit 94c6aba
Show file tree
Hide file tree
Showing 24 changed files with 1,512 additions and 1,037 deletions.
16 changes: 15 additions & 1 deletion Client/mods/deathmatch/ClientCommands.cpp
Expand Up @@ -177,7 +177,21 @@ void COMMAND_EnterPassenger(const char* szCmdLine)
{
if (pWeapon->GetState() != WEAPONSTATE_RELOADING)
{
g_pClientGame->ProcessVehicleInOutKey(true);
// If we are already in a vehicle
CClientVehicle* pVehicle = pPlayer->GetOccupiedVehicle();
if (pVehicle)
{
// Make sure we are in a passenger seat, otherwise we must use enter_exit
if (pPlayer->GetOccupiedVehicleSeat() != 0)
{
pPlayer->ExitVehicle();
}
}
else
{
// Enter nearest vehicle as passenger
pPlayer->EnterVehicle(nullptr, true);
}
}
}
}
Expand Down
543 changes: 24 additions & 519 deletions Client/mods/deathmatch/logic/CClientGame.cpp

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions Client/mods/deathmatch/logic/CClientGame.h
Expand Up @@ -251,8 +251,6 @@ class CClientGame
bool IsNickValid(const char* szNick);
bool IsNametagValid(const char* szNick);

bool IsGettingIntoVehicle() { return m_bIsGettingIntoVehicle; };

void StartPlayback();
void EnablePacketRecorder(const char* szFilename);
void InitVoice(bool bEnabled, unsigned int uiServerSampleRate, unsigned char ucQuality, unsigned int uiBitrate);
Expand Down Expand Up @@ -345,10 +343,6 @@ class CClientGame
bool GetDamageSent() { return m_bDamageSent; }
void SetDamageSent(bool b) { m_bDamageSent = b; }

void ProcessVehicleInOutKey(bool bPassenger);

void ResetVehicleInOut();

void SetAllDimensions(unsigned short usDimension);
void SetAllInteriors(unsigned char ucInterior);

Expand Down Expand Up @@ -464,7 +458,6 @@ class CClientGame

// Network update functions
void DoVehicleInKeyCheck();
void UpdateVehicleInOut();
void UpdatePlayerTarget();
void UpdatePlayerWeapons();
void UpdateTrailers();
Expand Down Expand Up @@ -725,18 +718,6 @@ class CClientGame
bool m_bTriggeredIngameAndConnected;
bool m_bGracefulDisconnect;

// Network update vars
unsigned long m_ulLastVehicleInOutTime;
bool m_bIsGettingOutOfVehicle;
bool m_bIsGettingIntoVehicle;
bool m_bIsJackingVehicle;
bool m_bIsGettingJacked;
ElementID m_VehicleInOutID;
unsigned char m_ucVehicleInOutSeat;
bool m_bNoNewVehicleTask;
ElementID m_NoNewVehicleTaskReasonID;
CClientPlayer* m_pGettingJackedBy;

CEntity* m_pTargetedGameEntity;
CClientEntity* m_pTargetedEntity;
bool m_bTargetSent;
Expand Down

0 comments on commit 94c6aba

Please sign in to comment.