[saco] Implement/match CPlayerPed::EnterVehicle(...)

This commit is contained in:
RD42 2024-10-31 17:26:43 +08:00
parent aacad6daf2
commit 0a7fc0799b
4 changed files with 34 additions and 0 deletions

View File

@ -24,6 +24,9 @@ DWORD dwFarClipReturnAddr=0;
// used generically
PED_TYPE *_pPlayer;
BOOL bIgnoreNextEntry=FALSE;
BOOL bIgnoreNextExit=FALSE;
BYTE byteSavedCameraMode;
DWORD dwCurPlayerActor=0;
BYTE *pbyteCameraMode = (BYTE *)0xB6F1A8;

View File

@ -11,6 +11,9 @@
#include "task.h"
extern CGame *pGame;
extern CNetGame *pNetGame;
extern BOOL bIgnoreNextEntry;
extern BOOL bIgnoreNextExit;
extern BYTE *pbyteCurrentPlayer;
@ -836,6 +839,30 @@ void CPlayerPed::PutDirectlyInVehicle(int iVehicleID, int iSeat)
//-----------------------------------------------------------
void CPlayerPed::EnterVehicle(int iVehicleID, BOOL bPassenger)
{
if(!m_pPed) return;
VEHICLE_TYPE *ThisVehicleType;
if((ThisVehicleType = GamePool_Vehicle_GetAt(iVehicleID)) == NULL) return;
if(!GamePool_Ped_GetAt(m_dwGTAId)) return;
bIgnoreNextEntry = TRUE;
if(GetCurrentWeapon() == WEAPON_PARACHUTE) {
SetArmedWeapon(0);
}
if(bPassenger) {
if(ThisVehicleType->entity.nModelIndex == TRAIN_PASSENGER && (m_pPed == GamePool_FindPlayerPed())) {
ScriptCommand(&put_actor_in_car2,m_dwGTAId,iVehicleID,-1);
} else {
ScriptCommand(&send_actor_to_car_passenger,m_dwGTAId,iVehicleID,3000,-1);
}
} else {
ScriptCommand(&send_actor_to_car_driverseat,m_dwGTAId,iVehicleID,3000);
}
}
//-----------------------------------------------------------
// Forceful removal

View File

@ -67,6 +67,7 @@ public:
void SetImmunities(BOOL bBullet, BOOL bFire, BOOL bExplosion, BOOL bDamage, BOOL bUnknown);
void PutDirectlyInVehicle(int iVehicleID, int iSeat);
void EnterVehicle(int iVehicleID, BOOL bPassenger);
void RemoveFromVehicleAndPutAt(float fX, float fY, float fZ);
BOOL IsAPassenger();

View File

@ -77,6 +77,9 @@ const SCRIPT_COMMAND set_actor_can_be_decapitated = { 0x0446, "ii" };
const SCRIPT_COMMAND play_sound = { 0x018c, "fffi" };
const SCRIPT_COMMAND remove_actor_from_car_and_put_at = { 0x0362, "ifff" };
const SCRIPT_COMMAND send_actor_to_car_driverseat = { 0x05CB, "iii" };
const SCRIPT_COMMAND send_actor_to_car_passenger = { 0x05CA, "iiii" };
const SCRIPT_COMMAND enable_train_traffic = { 0x06d7, "i" };
const SCRIPT_COMMAND lock_car = { 0x0519, "ii" };