Disable VC_PED_PORTS, better cancellable car enter, weapon and cops fixes

This commit is contained in:
eray orçunus 2020-07-02 16:01:42 +03:00
parent 575f35f2c4
commit c4cd210ae0
3 changed files with 28 additions and 28 deletions

View File

@ -390,7 +390,7 @@ void CGarage::Update()
bTakeMoney = true; bTakeMoney = true;
FindPlayerPed()->m_pWanted->Reset(); FindPlayerPed()->m_pWanted->Reset();
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE); CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
FindPlayerPed()->m_pWanted->m_bIgnoredByCops = true; FindPlayerPed()->m_pWanted->m_bIgnoredByCops = false;
#ifdef FIX_BUGS #ifdef FIX_BUGS
bool bChangedColour = false; bool bChangedColour = false;
#else #else

View File

@ -263,7 +263,7 @@ enum Config {
// Peds // Peds
#define PED_SKIN // support for skinned geometry on peds #define PED_SKIN // support for skinned geometry on peds
#define ANIMATE_PED_COL_MODEL #define ANIMATE_PED_COL_MODEL
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle // #define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward // #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
//#define PEDS_REPORT_CRIMES_ON_PHONE //#define PEDS_REPORT_CRIMES_ON_PHONE

View File

@ -570,9 +570,12 @@ CPed::AddWeaponModel(int id)
if (id != -1) { if (id != -1) {
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(GetClump())) if (IsClumpSkinned(GetClump())) {
if (m_pWeaponModel)
RemoveWeaponModel(-1);
m_pWeaponModel = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance(); m_pWeaponModel = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance();
else } else
#endif #endif
{ {
atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance(); atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance();
@ -834,7 +837,7 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false; bIsAimingGun = false;
bIsRestoringGun = true; bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
m_lookTimer = 0; m_lookTimer = 0;
#endif #endif
} }
@ -2243,11 +2246,6 @@ CPed::CalculateNewVelocity(void)
CAnimBlendAssociation *idleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE); CAnimBlendAssociation *idleAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE);
CAnimBlendAssociation *fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE); CAnimBlendAssociation *fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE);
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if(!fightAssoc)
fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_TIRED);
// There is one more anim in VC.
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc && !bIsDucking) { if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc && !bIsDucking) {
#else #else
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) { if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) {
@ -2486,7 +2484,7 @@ CPed::RestorePreviousObjective(void)
return; return;
if (m_objective != OBJECTIVE_LEAVE_VEHICLE && m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER if (m_objective != OBJECTIVE_LEAVE_VEHICLE && m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
&& m_nPedState != PED_CARJACK && m_nPedState != PED_CARJACK
#endif #endif
) )
@ -4208,7 +4206,7 @@ CPed::ClearObjective(void)
if (m_nPedState == PED_DRIVING && m_pMyVehicle) { if (m_nPedState == PED_DRIVING && m_pMyVehicle) {
if (m_pMyVehicle->pDriver != this) { if (m_pMyVehicle->pDriver != this) {
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
if(!IsPlayer()) if(!IsPlayer())
#endif #endif
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
@ -5850,7 +5848,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_nPedState = PED_CHAT; m_nPedState = PED_CHAT;
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
m_lookTimer = 0; m_lookTimer = 0;
#endif #endif
SetLookFlag(chatWith, true); SetLookFlag(chatWith, true);
@ -10225,19 +10223,22 @@ CPed::ProcessControl(void)
int vehAnim = m_pVehicleAnim->animId; int vehAnim = m_pVehicleAnim->animId;
static bool cancelQuickJack = false;
int16 padWalkX = pad->GetPedWalkLeftRight(); int16 padWalkX = pad->GetPedWalkLeftRight();
int16 padWalkY = pad->GetPedWalkUpDown(); int16 padWalkY = pad->GetPedWalkUpDown();
if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) { if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R || if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) { vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
bCancelEnteringCar = true; bCancelEnteringCar = true;
} else if (vehAnim == ANIM_CAR_QJACK) { } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
if (m_pVehicleAnim->GetTimeLeft() > 0.69f && m_pVehicleAnim->GetTimeLeft() < 0.72f) { cancelQuickJack = true;
}
}
if (cancelQuickJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
cancelQuickJack = false;
QuitEnteringCar(); QuitEnteringCar();
RestorePreviousObjective(); RestorePreviousObjective();
} }
}
}
#endif #endif
break; break;
} }
@ -10580,7 +10581,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
|| !veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil))))) { || !veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil))))) {
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
|| ped->m_nPedState == PED_CARJACK || ped->m_nPedState == PED_CARJACK
#endif #endif
) )
@ -10827,7 +10828,7 @@ void
CPed::SetJump(void) CPed::SetJump(void)
{ {
if (!bInVehicle && if (!bInVehicle &&
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) && m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) &&
#endif #endif
(m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) { (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
@ -11457,7 +11458,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
} }
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
|| ped->m_nPedState == PED_CARJACK || ped->m_nPedState == PED_CARJACK
#endif #endif
) )
@ -11471,7 +11472,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->IsBoat()) { if (veh->IsBoat()) {
if (ped->IsPlayer()) { if (ped->IsPlayer()) {
#if defined(FIX_BUGS) || defined(VC_PED_PORTS) #if defined VC_PED_PORTS || defined FIX_BUGS
CCarCtrl::RegisterVehicleOfInterest(veh); CCarCtrl::RegisterVehicleOfInterest(veh);
#endif #endif
if (veh->GetStatus() == STATUS_SIMPLE) { if (veh->GetStatus() == STATUS_SIMPLE) {
@ -11526,7 +11527,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
} }
// This shouldn't happen at all. Passengers can't enter with PED_CARJACK. Even though they did, we shouldn't call AddPassenger in here and SetDriver in below. // This shouldn't happen at all. Passengers can't enter with PED_CARJACK. Even though they did, we shouldn't call AddPassenger in here and SetDriver in below.
#ifndef VC_PED_PORTS #if !defined VC_PED_PORTS && !defined FIX_BUGS
else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) { else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (ped->m_nPedState == PED_CARJACK) { if (ped->m_nPedState == PED_CARJACK) {
veh->AddPassenger(ped, 0); veh->AddPassenger(ped, 0);
@ -12042,7 +12043,7 @@ CPed::ReplaceWeaponWhenExitingVehicle(void)
// If it's Uzi, we may have stored weapon. Uzi is the only gun we can use in car. // If it's Uzi, we may have stored weapon. Uzi is the only gun we can use in car.
if (IsPlayer() && weaponType == WEAPONTYPE_UZI) { if (IsPlayer() && weaponType == WEAPONTYPE_UZI) {
if (m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) { if (/*IsPlayer() && */ m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
SetCurrentWeapon(m_storedWeapon); SetCurrentWeapon(m_storedWeapon);
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED; m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
} }
@ -13799,7 +13800,7 @@ void
CPed::SetSeekBoatPosition(CVehicle *boat) CPed::SetSeekBoatPosition(CVehicle *boat)
{ {
if (m_nPedState == PED_SEEK_IN_BOAT || boat->pDriver if (m_nPedState == PED_SEEK_IN_BOAT || boat->pDriver
#ifdef VC_PED_PORTS #if defined VC_PED_PORTS || defined FIX_BUGS
|| !IsPedInControl() || !IsPedInControl()
#endif #endif
) )
@ -14566,8 +14567,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
m_vecDamageNormal = intersectionPoint.normal; m_vecDamageNormal = intersectionPoint.normal;
} }
} }
// VC code is working perfectly, but we don't want mega jumps to damage us significantly :shrug: #ifdef VC_PED_PORTS
#if 0 // #ifdef VC_PED_PORTS
float upperSpeedLimit = 0.33f; float upperSpeedLimit = 0.33f;
float lowerSpeedLimit = -0.25f; float lowerSpeedLimit = -0.25f;
float speed = m_vecMoveSpeed.Magnitude2D(); float speed = m_vecMoveSpeed.Magnitude2D();
@ -14575,7 +14575,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
upperSpeedLimit *= 2.0f; upperSpeedLimit *= 2.0f;
lowerSpeedLimit *= 1.5f; lowerSpeedLimit *= 1.5f;
} }
if (!m_ped_flagA2) { if (!bWasStanding) {
if ((speed <= upperSpeedLimit /* || (bfFlagsL >> 5) & 1 */) && m_vecMoveSpeed.z >= lowerSpeedLimit if ((speed <= upperSpeedLimit /* || (bfFlagsL >> 5) & 1 */) && m_vecMoveSpeed.z >= lowerSpeedLimit
|| m_pCollidingEntity == collidingEnt) { || m_pCollidingEntity == collidingEnt) {