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

View File

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

View File

@ -4341,30 +4341,29 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bInVehicle) { if (bInVehicle) {
if (method != WEAPONTYPE_DROWNING) { if (method != WEAPONTYPE_DROWNING) {
#ifdef VC_PED_PORTS
if (m_pMyVehicle) { if (m_pMyVehicle) {
bool bDone = false; bool bDone = false;
if (m_pMyVehicle->IsBike()) { if (m_pMyVehicle->IsBike()) {
m_fHealth = 0.0f; m_fHealth = 0.0f;
//CBike::KnockOffRider -- TODO(MIAMI) ((CBike*)m_pMyVehicle)->KnockOffRider(method, direction, this, false);
bDone = true; bDone = true;
} } else {
else { if (m_pMyVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR) {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) { if (m_pMyVehicle->pDriver == this) {
if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) { if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
m_pMyVehicle->SetStatus(STATUS_PHYSICS); m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle); CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
}
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
m_pMyVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
} }
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT;
m_pMyVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
} }
// TODO(MIAMI): argument // TODO(MIAMI): argument
if (m_pMyVehicle->CanPedExitCar(false)) { if (m_pMyVehicle->CanPedExitCar(false)) {
SetObjective(OBJECTIVE_LEAVE_CAR_AND_DIE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR_AND_DIE, m_pMyVehicle);
} } else {
else {
m_fHealth = 0.0f; m_fHealth = 0.0f;
if (m_pMyVehicle && m_pMyVehicle->pDriver == this) { if (m_pMyVehicle && m_pMyVehicle->pDriver == this) {
SetRadioStation(); SetRadioStation();
@ -4397,7 +4396,6 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (bDone) if (bDone)
return true; return true;
} }
#endif
m_fHealth = 1.0f; m_fHealth = 1.0f;
return false; return false;
} }
@ -4421,6 +4419,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} }
if (method == WEAPONTYPE_DROWNING) if (method == WEAPONTYPE_DROWNING)
bIsInTheAir = false; bIsInTheAir = false;
// TODO(Miami): timesDrowned
return true; return true;
} }
@ -6946,40 +6945,73 @@ CPed::ExitTrain(void)
} }
#endif #endif
// --MIAMI: Done
void void
CPed::ExitCar(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; return;
}
AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId; AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId;
float animTime = m_pVehicleAnim->currentTime; float animTime = m_pVehicleAnim->currentTime;
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime); 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);
if (m_pSeekTarget) { } else if (exitAnim != ANIM_CAR_ROLLOUT_LHS && exitAnim != ANIM_CAR_ROLLOUT_RHS) {
// Car is upside down m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime);
if (m_pMyVehicle->GetUp().z > -0.8f) {
if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f) if (m_pSeekTarget) {
LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START)); // Car is upside down
else if (m_pMyVehicle->GetUp().z > -0.8f) {
if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f)
LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START));
else
LineUpPedWithCar(LINE_UP_TO_CAR_END);
}
else {
LineUpPedWithCar(LINE_UP_TO_CAR_END); LineUpPedWithCar(LINE_UP_TO_CAR_END);
} else {
LineUpPedWithCar(LINE_UP_TO_CAR_END);
}
}
// If there is someone in front of the door, make him fall while we exit.
if (m_nPedState == PED_EXIT_CAR) {
CPed *foundPed = nil;
for (int i = 0; i < m_numNearPeds; i++) {
if ((m_nearPeds[i]->GetPosition() - GetPosition()).MagnitudeSqr2D() < 0.04f) {
foundPed = m_nearPeds[i];
break;
} }
} }
if (foundPed && animTime > 0.4f && foundPed->IsPedInControl())
foundPed->SetFall(1000, ANIM_KO_SKID_FRONT, 1); // If there is someone in front of the door, make him fall while we exit.
if (m_nPedState == PED_EXIT_CAR) {
CPed* foundPed = nil;
for (int i = 0; i < m_numNearPeds; i++) {
if ((m_nearPeds[i]->GetPosition() - GetPosition()).MagnitudeSqr2D() < 0.04f) {
foundPed = m_nearPeds[i];
break;
}
}
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);
} }
} }
@ -12525,12 +12557,10 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_objective == OBJECTIVE_LEAVE_VEHICLE) if (ped->m_objective == OBJECTIVE_LEAVE_VEHICLE)
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
#ifdef VC_PED_PORTS
else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
ped->m_fHealth = 0.0f; ped->m_fHealth = 0.0f;
ped->SetDie(ANIM_FLOOR_HIT, 4.0f, 0.5f); ped->SetDie(ANIM_FLOOR_HIT, 4.0f, 0.5f);
} }
#endif
ped->bInVehicle = false; ped->bInVehicle = false;
if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, nil)) { if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, nil)) {
@ -12590,7 +12620,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
} }
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
else { else if (ped->m_nPedState == PED_DRIVING) {
ped->m_nPedState = PED_IDLE; ped->m_nPedState = PED_IDLE;
} }
#endif #endif
@ -18735,12 +18765,9 @@ CPed::DriveVehicle(void)
float velocityFwdDotProd = DotProduct(bike->m_vecMoveSpeed, bike->GetForward()); float velocityFwdDotProd = DotProduct(bike->m_vecMoveSpeed, bike->GetForward());
if (m_vecTurnSpeed.MagnitudeSqr() > 0.09f) { if (m_vecTurnSpeed.MagnitudeSqr() > 0.09f) {
// TODO(Miami) bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
if (bike->pPassengers[0]) if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0); bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
*/
return; return;
} }
if (!drivebyAssoc && Abs(velocityFwdDotProd) < 0.02f) { if (!drivebyAssoc && Abs(velocityFwdDotProd) < 0.02f) {
@ -18756,12 +18783,9 @@ CPed::DriveVehicle(void)
} else { } else {
float maxReverseSpeed = bike->pHandling->Transmission.fMaxReverseVelocity; float maxReverseSpeed = bike->pHandling->Transmission.fMaxReverseVelocity;
if (3.5f * maxReverseSpeed > velocityFwdDotProd && (bike->m_nWheelsOnGround || bike->GetUp().z < -0.5f)) { if (3.5f * maxReverseSpeed > velocityFwdDotProd && (bike->m_nWheelsOnGround || bike->GetUp().z < -0.5f)) {
// TODO(Miami) bike->KnockOffRider(WEAPONTYPE_FALL, 2, this, false);
/*
bike->KnockOffRider(walkbackAssoc, 44, 2, this, 0);
if (bike->pPassengers[0]) if (bike->pPassengers[0])
bike->KnockOffRider(walkbackAssoc, 44, 2, bike->pPassengers[0], 0); bike->KnockOffRider(WEAPONTYPE_FALL, 2, bike->pPassengers[0], false);
*/
return; return;
} }
if (bike->m_fGasPedal >= 0.0 || velocityFwdDotProd <= maxReverseSpeed * 1.5) { if (bike->m_fGasPedal >= 0.0 || velocityFwdDotProd <= maxReverseSpeed * 1.5) {

View File

@ -31,6 +31,7 @@
#include "WeaponInfo.h" #include "WeaponInfo.h"
#include "World.h" #include "World.h"
#include "SurfaceTable.h" #include "SurfaceTable.h"
#include "Bike.h"
// TODO(Miami) // TODO(Miami)
#define AUDIO_NOT_READY #define AUDIO_NOT_READY
@ -524,7 +525,22 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
} }
damageEntityRegistered = 3; 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() ) if ( !victimPed->DyingOrDead() )
victimPed->ReactToAttack(shooterPed); victimPed->ReactToAttack(shooterPed);