Use KnockOffRider

This commit is contained in:
eray orçunus 2020-06-06 17:19:36 +03:00
parent d6640832f1
commit 4e4a3489ef
4 changed files with 100 additions and 67 deletions

View File

@ -4545,11 +4545,6 @@ CMenuManager::ProcessButtonPresses(void)
}
break;
}
//case MENUACTION_KEYBOARDCTRLS:
// SwitchToNewScreen(MENUPAGE_KEYBOARD_CONTROLS);
// m_nSelectedListRow = 0;
// m_nCurrExLayer = HOVEROPTION_LIST;
// break;
}
}
ProcessOnOffMenuOptions();
@ -4767,6 +4762,7 @@ void
CMenuManager::ProcessOnOffMenuOptions()
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
#ifdef LEGACY_MENU_OPTIONS
case MENUACTION_CTRLVIBRATION:
m_PrefsUseVibration = !m_PrefsUseVibration;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
@ -4777,6 +4773,7 @@ CMenuManager::ProcessOnOffMenuOptions()
CPad::GetPad(0)->Mode = 0;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
#endif
case MENUACTION_FRAMESYNC:
m_PrefsVsyncDisp = !m_PrefsVsyncDisp;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);

View File

@ -218,8 +218,8 @@ enum eMenuAction
MENUACTION_YES,
MENUACTION_NO,
MENUACTION_CHANGEMENU,
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
MENUACTION_UNK5,
MENUACTION_INVERTPADY,
MENUACTION_FRAMESYNC,
MENUACTION_FRAMELIMIT,
MENUACTION_TRAILS,
@ -255,7 +255,6 @@ enum eMenuAction
MENUACTION_PARSEHEAP,
// MENUACTION_MEMCARDSAVECONFIRM is that on VC enum??
MENUACTION_DEBUGSTREAM,
//MENUACTION_KEYBOARDCTRLS,
MENUACTION_GETKEY,
MENUACTION_SHOWHEADBOB,
MENUACTION_UNK80,
@ -273,13 +272,6 @@ enum eMenuAction
MENUACTION_CTRLMETHOD,
MENUACTION_DYNAMICACOUSTIC,
MENUACTION_MOUSESTEER,
MENUACTION_UNK103,
MENUACTION_UNK104,
MENUACTION_UNK105,
MENUACTION_UNK106,
MENUACTION_UNK107,
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL,
@ -290,7 +282,11 @@ enum eMenuAction
MENUACTION_SCREENMODE,
#endif
#ifdef FREE_CAM
MENUACTION_FREECAM
MENUACTION_FREECAM,
#endif
#ifdef LEGACY_MENU_OPTIONS
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
#endif
};

View File

@ -4341,16 +4341,15 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bInVehicle) {
if (method != WEAPONTYPE_DROWNING) {
#ifdef VC_PED_PORTS
if (m_pMyVehicle) {
bool bDone = false;
if (m_pMyVehicle->IsBike()) {
m_fHealth = 0.0f;
//CBike::KnockOffRider -- TODO(MIAMI)
((CBike*)m_pMyVehicle)->KnockOffRider(method, direction, this, false);
bDone = true;
}
else {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) {
} else {
if (m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR) {
if (m_pMyVehicle->pDriver == this) {
if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
@ -4360,11 +4359,11 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
m_pMyVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
m_pMyVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
}
}
// TODO(MIAMI): argument
if (m_pMyVehicle->CanPedExitCar(false)) {
SetObjective(OBJECTIVE_LEAVE_CAR_AND_DIE, m_pMyVehicle);
}
else {
} else {
m_fHealth = 0.0f;
if (m_pMyVehicle && m_pMyVehicle->pDriver == this) {
SetRadioStation();
@ -4397,7 +4396,6 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bDone)
return true;
}
#endif
m_fHealth = 1.0f;
return false;
}
@ -4421,6 +4419,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
}
if (method == WEAPONTYPE_DROWNING)
bIsInTheAir = false;
// TODO(Miami): timesDrowned
return true;
}
@ -6946,15 +6945,39 @@ CPed::ExitTrain(void)
}
#endif
// --MIAMI: Done
void
CPed::ExitCar(void)
{
if (!m_pVehicleAnim)
if (!m_pVehicleAnim) {
if (InVehicle()) {
if (m_pMyVehicle->IsBike()) {
// TODO(Miami): What are those?
if (m_vehEnterType == 18 || m_vehEnterType == 8) {
((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false);
return;
}
} else if (m_pMyVehicle->IsCar()) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_LHS)) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_LF, this);
} else if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLOUT_RHS)) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_RF, this);
}
}
}
return;
}
AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId;
float animTime = m_pVehicleAnim->currentTime;
if (exitAnim == ANIM_BIKE_GETOFF_BACK) {
if (animTime > 0.35f && m_pMyVehicle && m_pMyVehicle->IsBike())
((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false);
else
LineUpPedWithCar(LINE_UP_TO_CAR_FALL);
} else if (exitAnim != ANIM_CAR_ROLLOUT_LHS && exitAnim != ANIM_CAR_ROLLOUT_RHS) {
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime);
if (m_pSeekTarget) {
@ -6964,7 +6987,8 @@ CPed::ExitCar(void)
LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START));
else
LineUpPedWithCar(LINE_UP_TO_CAR_END);
} else {
}
else {
LineUpPedWithCar(LINE_UP_TO_CAR_END);
}
}
@ -6978,9 +7002,17 @@ CPed::ExitCar(void)
break;
}
}
if (foundPed && animTime > 0.4f && foundPed->IsPedInControl())
if(foundPed && (!foundPed->IsPlayer() || m_nPedType == PEDTYPE_COP || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS))
if (animTime > 0.4f && foundPed->IsPedInControl())
foundPed->SetFall(1000, ANIM_KO_SKID_FRONT, 1);
}
} else if (animTime <= 0.07f || !m_pMyVehicle || !m_pMyVehicle->IsCar()) {
LineUpPedWithCar(LINE_UP_TO_CAR_FALL);
} else if (exitAnim == ANIM_CAR_ROLLOUT_LHS) {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_LF, this);
} else {
((CAutomobile*)m_pMyVehicle)->KnockPedOutCar(WEAPONTYPE_UNIDENTIFIED, CAR_DOOR_RF, this);
}
}
// --MIAMI: Done
@ -12525,12 +12557,10 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_objective == OBJECTIVE_LEAVE_VEHICLE)
ped->RestorePreviousObjective();
#ifdef VC_PED_PORTS
else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
ped->m_fHealth = 0.0f;
ped->SetDie(ANIM_FLOOR_HIT, 4.0f, 0.5f);
}
#endif
ped->bInVehicle = false;
if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, nil)) {
@ -12590,7 +12620,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
}
}
#ifdef VC_PED_PORTS
else {
else if (ped->m_nPedState == PED_DRIVING) {
ped->m_nPedState = PED_IDLE;
}
#endif
@ -18735,12 +18765,9 @@ CPed::DriveVehicle(void)
float velocityFwdDotProd = DotProduct(bike->m_vecMoveSpeed, bike->GetForward());
if (m_vecTurnSpeed.MagnitudeSqr() > 0.09f) {
// TODO(Miami)
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0);
*/
bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
return;
}
if (!drivebyAssoc && Abs(velocityFwdDotProd) < 0.02f) {
@ -18756,12 +18783,9 @@ CPed::DriveVehicle(void)
} else {
float maxReverseSpeed = bike->pHandling->Transmission.fMaxReverseVelocity;
if (3.5f * maxReverseSpeed > velocityFwdDotProd && (bike->m_nWheelsOnGround || bike->GetUp().z < -0.5f)) {
// TODO(Miami)
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0);
*/
bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
return;
}
if (bike->m_fGasPedal >= 0.0 || velocityFwdDotProd <= maxReverseSpeed * 1.5) {

View File

@ -31,6 +31,7 @@
#include "WeaponInfo.h"
#include "World.h"
#include "SurfaceTable.h"
#include "Bike.h"
// TODO(Miami)
#define AUDIO_NOT_READY
@ -524,7 +525,22 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
}
damageEntityRegistered = 3;
// TODO(Miami): Bike
if (victimPed->bInVehicle) {
CVehicle *victimVeh = victimPed->m_pMyVehicle;
if (victimVeh) {
if (victimVeh->IsBike()) {
CBike *victimBike = (CBike*)victimVeh;
victimBike->KnockOffRider(m_eWeaponType, localDir, victimPed, false);
if (victimBike->pDriver) {
victimBike->pDriver->ReactToAttack(shooterPed);
} else {
if (victimVeh->pPassengers[0])
victimVeh->pPassengers[0]->ReactToAttack(shooterPed);
}
continue;
}
}
}
if ( !victimPed->DyingOrDead() )
victimPed->ReactToAttack(shooterPed);