|
|
@ -67,6 +67,9 @@ uint16 gnNumTempPedList;
|
|
|
|
|
|
|
|
|
|
|
|
CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
|
|
|
|
CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(Miami)
|
|
|
|
|
|
|
|
#define AUDIO_NOT_READY
|
|
|
|
|
|
|
|
|
|
|
|
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
|
|
|
|
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
|
|
|
|
PedAudioData CommentWaitTime[39] = {
|
|
|
|
PedAudioData CommentWaitTime[39] = {
|
|
|
|
{500, 800, 500, 2},
|
|
|
|
{500, 800, 500, 2},
|
|
|
@ -645,6 +648,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
|
|
|
m_maxWeaponTypeAllowed = WEAPONTYPE_UNARMED;
|
|
|
|
m_maxWeaponTypeAllowed = WEAPONTYPE_UNARMED;
|
|
|
|
m_currentWeapon = WEAPONTYPE_UNARMED;
|
|
|
|
m_currentWeapon = WEAPONTYPE_UNARMED;
|
|
|
|
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
|
|
|
|
m_delayedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
|
|
|
for(int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
|
|
|
CWeapon &weapon = GetWeapon(i);
|
|
|
|
CWeapon &weapon = GetWeapon(i);
|
|
|
@ -656,7 +660,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_lastFightMove = FIGHTMOVE_NULL;
|
|
|
|
m_lastFightMove = FIGHTMOVE_NULL;
|
|
|
|
GiveWeapon(WEAPONTYPE_UNARMED, 0);
|
|
|
|
GiveWeapon(WEAPONTYPE_UNARMED, 0, true);
|
|
|
|
m_wepAccuracy = 60;
|
|
|
|
m_wepAccuracy = 60;
|
|
|
|
m_lastWepDam = -1;
|
|
|
|
m_lastWepDam = -1;
|
|
|
|
m_collPoly.valid = false;
|
|
|
|
m_collPoly.valid = false;
|
|
|
@ -1179,7 +1183,7 @@ CPed::FinishedReloadCB(CAnimBlendAssociation *reloadAssoc, void *arg)
|
|
|
|
crouchFireAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_WEAPON_CROUCHFIRE);
|
|
|
|
crouchFireAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_WEAPON_CROUCHFIRE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!!weapon->m_bReload && reloadAssoc) {
|
|
|
|
if (!!weapon->m_bReload && reloadAssoc) {
|
|
|
|
if (reloadAssoc->animId == ANIM_WEAPON_CROUCHRELOAD && !crouchFireAssoc) {
|
|
|
|
if (reloadAssoc->animId == GetCrouchReloadAnim(weapon) && !crouchFireAssoc) {
|
|
|
|
CAnimBlendAssociation *crouchAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_WEAPON_CROUCH, 8.0f);
|
|
|
|
CAnimBlendAssociation *crouchAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_WEAPON_CROUCH, 8.0f);
|
|
|
|
crouchAssoc->SetCurrentTime(crouchAssoc->hierarchy->totalLength);
|
|
|
|
crouchAssoc->SetCurrentTime(crouchAssoc->hierarchy->totalLength);
|
|
|
|
crouchAssoc->flags &= ~ASSOC_RUNNING;
|
|
|
|
crouchAssoc->flags &= ~ASSOC_RUNNING;
|
|
|
@ -1212,7 +1216,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
|
|
|
|
if (ped->m_nPedState != PED_ATTACK) {
|
|
|
|
if (ped->m_nPedState != PED_ATTACK) {
|
|
|
|
if (ped->bIsDucking && ped->IsPedInControl()) {
|
|
|
|
if (ped->bIsDucking && ped->IsPedInControl()) {
|
|
|
|
if (currentWeapon->m_bReload) {
|
|
|
|
if (currentWeapon->m_bReload) {
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_WEAPON_CROUCHRELOAD);
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), GetCrouchReloadAnim(currentWeapon));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentWeapon->m_bCrouchFire && attackAssoc) {
|
|
|
|
if (currentWeapon->m_bCrouchFire && attackAssoc) {
|
|
|
|
if (attackAssoc->animId == ANIM_WEAPON_CROUCHFIRE && !reloadAnimAssoc) {
|
|
|
|
if (attackAssoc->animId == ANIM_WEAPON_CROUCHFIRE && !reloadAnimAssoc) {
|
|
|
@ -1238,7 +1242,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
|
|
|
|
|
|
|
|
|
|
|
|
if (ped->bIsDucking && ped->bCrouchWhenShooting) {
|
|
|
|
if (ped->bIsDucking && ped->bCrouchWhenShooting) {
|
|
|
|
if (currentWeapon->m_bReload) {
|
|
|
|
if (currentWeapon->m_bReload) {
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_WEAPON_CROUCHRELOAD);
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), GetCrouchReloadAnim(currentWeapon));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentWeapon->m_bCrouchFire && attackAssoc) {
|
|
|
|
if (currentWeapon->m_bCrouchFire && attackAssoc) {
|
|
|
|
if (attackAssoc->animId == ANIM_WEAPON_CROUCHFIRE && !reloadAnimAssoc) {
|
|
|
|
if (attackAssoc->animId == ANIM_WEAPON_CROUCHFIRE && !reloadAnimAssoc) {
|
|
|
@ -1302,7 +1306,7 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
// --MIAMI: Done except melee weapons
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::Attack(void)
|
|
|
|
CPed::Attack(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1354,11 +1358,11 @@ CPed::Attack(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ourWeapon->m_bReload) {
|
|
|
|
if (ourWeapon->m_bReload) {
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_RELOAD);
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetReloadAnim(ourWeapon));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!!ourWeapon->m_bReload && !reloadAnimAssoc) {
|
|
|
|
if (!!ourWeapon->m_bReload && !reloadAnimAssoc) {
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHRELOAD);
|
|
|
|
reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(ourWeapon));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( reloadAnimAssoc && reloadAnimAssoc->IsRunning() ) {
|
|
|
|
if ( reloadAnimAssoc && reloadAnimAssoc->IsRunning() ) {
|
|
|
@ -1518,14 +1522,22 @@ CPed::Attack(void)
|
|
|
|
case ASSOCGRP_UNARMED:
|
|
|
|
case ASSOCGRP_UNARMED:
|
|
|
|
if (weaponAnimAssoc->animId == ANIM_FIGHT_PPUNCH || // TODO(Miami): Remove after fighting done
|
|
|
|
if (weaponAnimAssoc->animId == ANIM_FIGHT_PPUNCH || // TODO(Miami): Remove after fighting done
|
|
|
|
weaponAnimAssoc->animId == ANIM_MELEE_ATTACK || weaponAnimAssoc->animId == ANIM_MELEE_ATTACK_START) {
|
|
|
|
weaponAnimAssoc->animId == ANIM_MELEE_ATTACK || weaponAnimAssoc->animId == ANIM_MELEE_ATTACK_START) {
|
|
|
|
|
|
|
|
#ifdef AUDIO_NOT_READY
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_PUNCH_39, 0.0f);
|
|
|
|
|
|
|
|
#else
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_PUNCH_39, (damagerType | (ourWeaponType << 8)));
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_FIGHT_PUNCH_39, (damagerType | (ourWeaponType << 8)));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ASSOCGRP_KNIFE:
|
|
|
|
case ASSOCGRP_KNIFE:
|
|
|
|
case ASSOCGRP_BASEBALLBAT:
|
|
|
|
case ASSOCGRP_BASEBALLBAT:
|
|
|
|
case ASSOCGRP_GOLFCLUB:
|
|
|
|
case ASSOCGRP_GOLFCLUB:
|
|
|
|
case ASSOCGRP_CHAINSAW:
|
|
|
|
case ASSOCGRP_CHAINSAW:
|
|
|
|
|
|
|
|
#ifdef AUDIO_NOT_READY
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f);
|
|
|
|
|
|
|
|
#else
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, (damagerType | (ourWeaponType << 8)));
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, (damagerType | (ourWeaponType << 8)));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1587,12 +1599,12 @@ CPed::Attack(void)
|
|
|
|
if (bIsDucking) {
|
|
|
|
if (bIsDucking) {
|
|
|
|
newReloadAssoc = CAnimManager::BlendAnimation(
|
|
|
|
newReloadAssoc = CAnimManager::BlendAnimation(
|
|
|
|
GetClump(), ourWeapon->m_AnimToPlay,
|
|
|
|
GetClump(), ourWeapon->m_AnimToPlay,
|
|
|
|
ANIM_WEAPON_CROUCHRELOAD,
|
|
|
|
GetCrouchReloadAnim(ourWeapon),
|
|
|
|
8.0f);
|
|
|
|
8.0f);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
newReloadAssoc = CAnimManager::BlendAnimation(
|
|
|
|
newReloadAssoc = CAnimManager::BlendAnimation(
|
|
|
|
GetClump(), ourWeapon->m_AnimToPlay,
|
|
|
|
GetClump(), ourWeapon->m_AnimToPlay,
|
|
|
|
ANIM_WEAPON_RELOAD,
|
|
|
|
GetReloadAnim(ourWeapon),
|
|
|
|
8.0f);
|
|
|
|
8.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newReloadAssoc->SetFinishCallback(FinishedReloadCB, this);
|
|
|
|
newReloadAssoc->SetFinishCallback(FinishedReloadCB, this);
|
|
|
@ -1602,7 +1614,26 @@ CPed::Attack(void)
|
|
|
|
bIsAttacking = false;
|
|
|
|
bIsAttacking = false;
|
|
|
|
bIsPointingGunAt = false;
|
|
|
|
bIsPointingGunAt = false;
|
|
|
|
m_shootTimer = CTimer::GetTimeInMilliseconds();
|
|
|
|
m_shootTimer = CTimer::GetTimeInMilliseconds();
|
|
|
|
|
|
|
|
#ifdef AUDIO_NOT_READY
|
|
|
|
|
|
|
|
switch (ourWeaponType) {
|
|
|
|
|
|
|
|
case WEAPONTYPE_UZI:
|
|
|
|
|
|
|
|
case WEAPONTYPE_TEC9:
|
|
|
|
|
|
|
|
case WEAPONTYPE_SILENCED_INGRAM:
|
|
|
|
|
|
|
|
case WEAPONTYPE_MP5:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEAPONTYPE_AK47:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEAPONTYPE_M16:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1647,10 +1678,28 @@ CPed::Attack(void)
|
|
|
|
ClearAimFlag();
|
|
|
|
ClearAimFlag();
|
|
|
|
|
|
|
|
|
|
|
|
// Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
|
|
|
|
// Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
|
|
|
|
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < ourWeapon->m_fAnimLoopEnd) {
|
|
|
|
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd) {
|
|
|
|
|
|
|
|
|
|
|
|
// What?! Weapon id as volume??
|
|
|
|
#ifdef AUDIO_NOT_READY
|
|
|
|
|
|
|
|
switch (ourWeaponType) {
|
|
|
|
|
|
|
|
case WEAPONTYPE_UZI:
|
|
|
|
|
|
|
|
case WEAPONTYPE_TEC9:
|
|
|
|
|
|
|
|
case WEAPONTYPE_SILENCED_INGRAM:
|
|
|
|
|
|
|
|
case WEAPONTYPE_MP5:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEAPONTYPE_AK47:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WEAPONTYPE_M16:
|
|
|
|
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
|
|
|
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, GetWeapon()->m_eWeaponType);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fun fact: removing this part leds to reloading flamethrower
|
|
|
|
// Fun fact: removing this part leds to reloading flamethrower
|
|
|
@ -2133,7 +2182,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|
|
|
case ANIM_VAN_GETIN:
|
|
|
|
case ANIM_VAN_GETIN:
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
multExtractedFromAnim = true;
|
|
|
|
multExtractedFromAnim = true;
|
|
|
|
zBlend = Max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.3f, 0.0f) / (1.0f - 0.3f);
|
|
|
|
zBlend = Max(m_pVehicleAnim->GetProgress() - 0.3f, 0.0f) / (1.0f - 0.3f);
|
|
|
|
// fall through
|
|
|
|
// fall through
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
case ANIM_CAR_QJACKED:
|
|
|
|
case ANIM_CAR_QJACKED:
|
|
|
@ -2144,7 +2193,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
if (!multExtractedFromAnim) {
|
|
|
|
if (!multExtractedFromAnim) {
|
|
|
|
multExtractedFromAnim = true;
|
|
|
|
multExtractedFromAnim = true;
|
|
|
|
zBlend = Max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.5f, 0.0f) / (1.0f - 0.5f);
|
|
|
|
zBlend = Max(m_pVehicleAnim->GetProgress() - 0.5f, 0.0f) / (1.0f - 0.5f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// fall through
|
|
|
|
// fall through
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2152,14 +2201,14 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|
|
|
case ANIM_CAR_CRAWLOUT_RHS2:
|
|
|
|
case ANIM_CAR_CRAWLOUT_RHS2:
|
|
|
|
case ANIM_VAN_GETOUT_L:
|
|
|
|
case ANIM_VAN_GETOUT_L:
|
|
|
|
case ANIM_VAN_GETOUT:
|
|
|
|
case ANIM_VAN_GETOUT:
|
|
|
|
seatPosMult = m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength;
|
|
|
|
seatPosMult = m_pVehicleAnim->GetProgress();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ANIM_CAR_GETIN_RHS:
|
|
|
|
case ANIM_CAR_GETIN_RHS:
|
|
|
|
case ANIM_CAR_GETIN_LHS:
|
|
|
|
case ANIM_CAR_GETIN_LHS:
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
if (veh && veh->IsCar() && veh->bIsBus) {
|
|
|
|
if (veh && veh->IsCar() && veh->bIsBus) {
|
|
|
|
multExtractedFromAnimBus = true;
|
|
|
|
multExtractedFromAnimBus = true;
|
|
|
|
zBlend = Min(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength, 0.5f) / 0.5f;
|
|
|
|
zBlend = Min(m_pVehicleAnim->GetProgress(), 0.5f) / 0.5f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// fall through
|
|
|
|
// fall through
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -4520,6 +4569,9 @@ CPed::SetGetUp(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (m_nPedState != PED_GETUP) {
|
|
|
|
if (m_nPedState != PED_GETUP) {
|
|
|
|
SetStoredState();
|
|
|
|
SetStoredState();
|
|
|
|
|
|
|
|
if (m_nPedState == PED_FOLLOW_PATH)
|
|
|
|
|
|
|
|
ClearFollowPath();
|
|
|
|
|
|
|
|
|
|
|
|
m_nPedState = PED_GETUP;
|
|
|
|
m_nPedState = PED_GETUP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5119,7 +5171,7 @@ CPed::SetAttack(CEntity *victim)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (curWeapon->m_bReload &&
|
|
|
|
if (curWeapon->m_bReload &&
|
|
|
|
(RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_RELOAD) || RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHRELOAD))) {
|
|
|
|
(RpAnimBlendClumpGetAssociation(GetClump(), GetReloadAnim(curWeapon)) || RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(curWeapon)))) {
|
|
|
|
if (!IsPlayer() || m_nPedState != PED_ATTACK || ((CPlayerPed*)this)->m_bHaveTargetSelected)
|
|
|
|
if (!IsPlayer() || m_nPedState != PED_ATTACK || ((CPlayerPed*)this)->m_bHaveTargetSelected)
|
|
|
|
bIsAttacking = false;
|
|
|
|
bIsAttacking = false;
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -5511,13 +5563,13 @@ CPed::FightStrike(CVector &touchedNodePos)
|
|
|
|
for (int j = 0; j < hisCol->numSpheres; j++) {
|
|
|
|
for (int j = 0; j < hisCol->numSpheres; j++) {
|
|
|
|
attackDistance = hisCol->spheres[j].center;
|
|
|
|
attackDistance = hisCol->spheres[j].center;
|
|
|
|
attackDistance -= touchedNodePos;
|
|
|
|
attackDistance -= touchedNodePos;
|
|
|
|
CColSphere *ourPieces = hisCol->spheres;
|
|
|
|
CColSphere *hisPieces = hisCol->spheres;
|
|
|
|
float maxDistanceToBeat = ourPieces[j].radius + tFightMoves[m_lastFightMove].strikeRadius;
|
|
|
|
float maxDistanceToBeat = hisPieces[j].radius + tFightMoves[m_lastFightMove].strikeRadius;
|
|
|
|
|
|
|
|
|
|
|
|
// We can beat him too
|
|
|
|
// We can beat him too
|
|
|
|
if (sq(maxDistanceToBeat) > attackDistance.MagnitudeSqr()) {
|
|
|
|
if (sq(maxDistanceToBeat) > attackDistance.MagnitudeSqr()) {
|
|
|
|
pedFound = true;
|
|
|
|
pedFound = true;
|
|
|
|
closestPedPiece = (ePedPieceTypes) ourPieces[j].piece;
|
|
|
|
closestPedPiece = (ePedPieceTypes) hisPieces[j].piece;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -6324,28 +6376,22 @@ CPed::CreateDeadPedMoney(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::CreateDeadPedWeaponPickups(void)
|
|
|
|
CPed::CreateDeadPedPickupCoors(float *x, float *y, float *z)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool found = false;
|
|
|
|
bool found = false;
|
|
|
|
float angleToPed;
|
|
|
|
|
|
|
|
CVector pickupPos;
|
|
|
|
CVector pickupPos;
|
|
|
|
|
|
|
|
|
|
|
|
if (bInVehicle)
|
|
|
|
#define NUMBER_OF_ATTEMPTS 32
|
|
|
|
return;
|
|
|
|
for (int i = 0; i < NUMBER_OF_ATTEMPTS; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eWeaponType weapon = GetWeapon(i).m_eWeaponType;
|
|
|
|
|
|
|
|
int weaponAmmo = GetWeapon(i).m_nAmmoTotal;
|
|
|
|
|
|
|
|
if (weapon == WEAPONTYPE_UNARMED || weapon == WEAPONTYPE_DETONATOR || (weaponAmmo == 0 && !GetWeapon(i).IsTypeMelee()))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
angleToPed = i * 1.75f;
|
|
|
|
|
|
|
|
pickupPos = GetPosition();
|
|
|
|
pickupPos = GetPosition();
|
|
|
|
pickupPos.x += 1.5f * Sin(angleToPed);
|
|
|
|
pickupPos.x = 1.5f * Sin((CGeneral::GetRandomNumber() % 256) * PI / 128) + GetPosition().x;
|
|
|
|
pickupPos.y += 1.5f * Cos(angleToPed);
|
|
|
|
pickupPos.y = 1.5f * Cos((CGeneral::GetRandomNumber() % 256) * PI / 128) + GetPosition().y;
|
|
|
|
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
|
|
|
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
CVector pedPos = GetPosition();
|
|
|
|
CVector pedPos = GetPosition();
|
|
|
|
pedPos.z += 0.3f;
|
|
|
|
pedPos.z += 0.3f;
|
|
|
|
|
|
|
|
|
|
|
@ -6353,21 +6399,53 @@ CPed::CreateDeadPedWeaponPickups(void)
|
|
|
|
float distance = pedToPickup.Magnitude();
|
|
|
|
float distance = pedToPickup.Magnitude();
|
|
|
|
|
|
|
|
|
|
|
|
// outer edge of pickup
|
|
|
|
// outer edge of pickup
|
|
|
|
distance = (distance + 0.3f) / distance;
|
|
|
|
distance = (distance + 0.4f) / distance;
|
|
|
|
CVector pickupPos2 = pedPos;
|
|
|
|
CVector pickupPos2 = pedPos;
|
|
|
|
pickupPos2 += distance * pedToPickup;
|
|
|
|
pickupPos2 += distance * pedToPickup;
|
|
|
|
|
|
|
|
|
|
|
|
// pickup must be on ground and line to its edge must be clear
|
|
|
|
if ((pickupPos - FindPlayerCoors()).Magnitude2D() > 2.0f || i > NUMBER_OF_ATTEMPTS / 2) {
|
|
|
|
if (!found || CWorld::GetIsLineOfSightClear(pickupPos2, pedPos, true, false, false, false, false, false, false)) {
|
|
|
|
|
|
|
|
// otherwise try another position (but disregard second check apparently)
|
|
|
|
if (i > NUMBER_OF_ATTEMPTS / 2 || !CPickups::TestForPickupsInBubble(pickupPos, 1.3f)) {
|
|
|
|
angleToPed += 3.14f;
|
|
|
|
|
|
|
|
pickupPos = GetPosition();
|
|
|
|
if (CWorld::GetIsLineOfSightClear(pickupPos2, pedPos,
|
|
|
|
pickupPos.x += 1.5f * Sin(angleToPed);
|
|
|
|
true, i < NUMBER_OF_ATTEMPTS / 2, false, i < NUMBER_OF_ATTEMPTS / 2, false, false, false)) {
|
|
|
|
pickupPos.y += 1.5f * Cos(angleToPed);
|
|
|
|
|
|
|
|
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
|
|
|
if (i > NUMBER_OF_ATTEMPTS / 2 || !CWorld::TestSphereAgainstWorld(pickupPos, 1.2f, nil, false, true, false, false, false, false)) {
|
|
|
|
|
|
|
|
*x = pickupPos.x;
|
|
|
|
|
|
|
|
*y = pickupPos.y;
|
|
|
|
|
|
|
|
*z = pickupPos.z;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*x = GetPosition().x;
|
|
|
|
|
|
|
|
*y = GetPosition().y;
|
|
|
|
|
|
|
|
*z = GetPosition().z + 0.4f;
|
|
|
|
|
|
|
|
#undef NUMBER_OF_ATTEMPTS
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
CPed::CreateDeadPedWeaponPickups(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CVector pickupPos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bInVehicle)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eWeaponType weapon = GetWeapon(i).m_eWeaponType;
|
|
|
|
|
|
|
|
int weaponAmmo = GetWeapon(i).m_nAmmoTotal;
|
|
|
|
|
|
|
|
if (weapon == WEAPONTYPE_UNARMED || weapon == WEAPONTYPE_DETONATOR || (weaponAmmo == 0 && !GetWeapon(i).IsTypeMelee()))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int quantity = Min(weaponAmmo, AmmoForWeapon_OnStreet[weapon] / 2);
|
|
|
|
|
|
|
|
CreateDeadPedPickupCoors(&pickupPos.x, &pickupPos.y, &pickupPos.z);
|
|
|
|
|
|
|
|
if (!CPickups::TryToMerge_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, quantity, false)) {
|
|
|
|
|
|
|
|
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, Min(weaponAmmo, quantity));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found)
|
|
|
|
|
|
|
|
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, Min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ClearWeapons();
|
|
|
|
ClearWeapons();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -8945,7 +9023,11 @@ CPed::InvestigateEvent(void)
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
CPed::IsPedDoingDriveByShooting(void)
|
|
|
|
CPed::IsPedDoingDriveByShooting(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
if (FindPlayerPed() == this && CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nWeaponSlot == 5) {
|
|
|
|
if (FindPlayerPed() == this && CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nWeaponSlot == 5) {
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (FindPlayerPed() == this && GetWeapon()->m_eWeaponType == WEAPONTYPE_UZI) {
|
|
|
|
|
|
|
|
#endif
|
|
|
|
if (TheCamera.Cams[TheCamera.ActiveCam].LookingLeft || TheCamera.Cams[TheCamera.ActiveCam].LookingRight)
|
|
|
|
if (TheCamera.Cams[TheCamera.ActiveCam].LookingLeft || TheCamera.Cams[TheCamera.ActiveCam].LookingRight)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -9982,11 +10064,8 @@ CPed::ProcessControl(void)
|
|
|
|
if (m_nPedState == PED_FOLLOW_PATH) {
|
|
|
|
if (m_nPedState == PED_FOLLOW_PATH) {
|
|
|
|
if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) {
|
|
|
|
if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) {
|
|
|
|
SetJump();
|
|
|
|
SetJump();
|
|
|
|
|
|
|
|
|
|
|
|
// Moved break into here, for compatibility with III
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
if (m_pedInObjective &&
|
|
|
|
if (m_pedInObjective &&
|
|
|
@ -10957,15 +11036,13 @@ CPed::ProcessControl(void)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pMyVehicle->pDriver != this || m_pMyVehicle->IsBoat()) {
|
|
|
|
if (m_pMyVehicle->pDriver != this) {
|
|
|
|
LookForSexyPeds();
|
|
|
|
LookForSexyPeds();
|
|
|
|
LookForSexyCars();
|
|
|
|
LookForSexyCars();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE || !m_pMyVehicle->pDriver->IsPlayer()) {
|
|
|
|
// TODO(Miami): Start KILL_CHAR_ON_BOAT objective
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CPad* pad = CPad::GetPad(0);
|
|
|
|
CPad* pad = CPad::GetPad(0);
|
|
|
|
|
|
|
|
|
|
|
@ -10995,12 +11072,24 @@ CPed::ProcessControl(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(Miami): This part moved to DriveVehicle in VC
|
|
|
|
float steerAngle = m_pMyVehicle->m_fSteerAngle;
|
|
|
|
float steerAngle = m_pMyVehicle->m_fSteerAngle;
|
|
|
|
CAnimBlendAssociation *lDriveAssoc;
|
|
|
|
CAnimBlendAssociation *lDriveAssoc;
|
|
|
|
CAnimBlendAssociation *rDriveAssoc;
|
|
|
|
CAnimBlendAssociation *rDriveAssoc;
|
|
|
|
CAnimBlendAssociation *lbAssoc;
|
|
|
|
CAnimBlendAssociation *lbAssoc;
|
|
|
|
CAnimBlendAssociation *sitAssoc;
|
|
|
|
CAnimBlendAssociation *sitAssoc;
|
|
|
|
if (m_pMyVehicle->bLowVehicle) {
|
|
|
|
if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT)) {
|
|
|
|
|
|
|
|
sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_L);
|
|
|
|
|
|
|
|
rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_BOAT_R);
|
|
|
|
|
|
|
|
lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_BOAT_LB);
|
|
|
|
|
|
|
|
} else if (m_pMyVehicle->bLowVehicle) {
|
|
|
|
sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LSIT);
|
|
|
|
sitAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LSIT);
|
|
|
|
|
|
|
|
|
|
|
|
if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
|
|
|
|
if (!sitAssoc || sitAssoc->blendAmount < 1.0f) {
|
|
|
@ -11020,18 +11109,21 @@ CPed::ProcessControl(void)
|
|
|
|
lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_L);
|
|
|
|
lDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_L);
|
|
|
|
rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_R);
|
|
|
|
rDriveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVE_R);
|
|
|
|
lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB);
|
|
|
|
lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lbAssoc &&
|
|
|
|
if (lbAssoc &&
|
|
|
|
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON
|
|
|
|
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON
|
|
|
|
&& TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) {
|
|
|
|
&& TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) {
|
|
|
|
lbAssoc->blendDelta = -1000.0f;
|
|
|
|
lbAssoc->blendDelta = -1000.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CAnimBlendAssociation *driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_L);
|
|
|
|
CAnimBlendAssociation *driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_L);
|
|
|
|
|
|
|
|
|
|
|
|
if (!driveByAssoc)
|
|
|
|
if (!driveByAssoc)
|
|
|
|
driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_R);
|
|
|
|
driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_R);
|
|
|
|
|
|
|
|
if (!driveByAssoc)
|
|
|
|
|
|
|
|
driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_L);
|
|
|
|
|
|
|
|
if (!driveByAssoc)
|
|
|
|
|
|
|
|
driveByAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DRIVEBY_LOW_R);
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc) {
|
|
|
|
if (m_pMyVehicle->bLowVehicle || m_pMyVehicle->m_fGasPedal >= 0.0f || driveByAssoc) {
|
|
|
|
if (steerAngle == 0.0f || driveByAssoc) {
|
|
|
|
if (steerAngle == 0.0f || driveByAssoc) {
|
|
|
@ -11046,6 +11138,8 @@ CPed::ProcessControl(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (rDriveAssoc)
|
|
|
|
if (rDriveAssoc)
|
|
|
|
rDriveAssoc->blendAmount = clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f);
|
|
|
|
rDriveAssoc->blendAmount = clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
|
|
|
|
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_R);
|
|
|
|
else if (m_pMyVehicle->bLowVehicle)
|
|
|
|
else if (m_pMyVehicle->bLowVehicle)
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_R);
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_R);
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -11057,6 +11151,8 @@ CPed::ProcessControl(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (lDriveAssoc)
|
|
|
|
if (lDriveAssoc)
|
|
|
|
lDriveAssoc->blendAmount = clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f);
|
|
|
|
lDriveAssoc->blendAmount = clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
|
|
|
|
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT_L);
|
|
|
|
else if (m_pMyVehicle->bLowVehicle)
|
|
|
|
else if (m_pMyVehicle->bLowVehicle)
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_L);
|
|
|
|
CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_LOW_L);
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -11069,10 +11165,18 @@ CPed::ProcessControl(void)
|
|
|
|
|
|
|
|
|
|
|
|
if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
|
|
|
|
if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
|
|
|
|
|| TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
|
|
|
|
|| TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
|
|
|
|
&& (!lbAssoc || lbAssoc->blendAmount < 1.0f)) {
|
|
|
|
&& (!lbAssoc || lbAssoc->blendAmount < 1.0f && lbAssoc->blendDelta <= 0.0f)) {
|
|
|
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f);
|
|
|
|
|
|
|
|
|
|
|
|
if(m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT))
|
|
|
|
|
|
|
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_BOAT_LB, 4.0f);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(Miami): This part belongs to DriveVehicle
|
|
|
|
|
|
|
|
if (!m_pMyVehicle)
|
|
|
|
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case PED_DIE:
|
|
|
|
case PED_DIE:
|
|
|
@ -11124,7 +11228,8 @@ CPed::ProcessControl(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_pCurrentPhysSurface = nil;
|
|
|
|
m_pCurrentPhysSurface = nil;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
|
|
|
|
ServiceTalking();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
@ -11145,11 +11250,27 @@ CPed::SetInTheAir(void)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::RestoreHeadPosition(void)
|
|
|
|
CPed::RestoreHeadPosition(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool canUseMyBody = false;
|
|
|
|
|
|
|
|
if (m_nPedState != PED_DRIVING && m_nPedState != PED_DRAG_FROM_CAR && !bIsDucking) {
|
|
|
|
|
|
|
|
if (m_animGroup != ASSOCGRP_SEXYWOMAN && m_animGroup != ASSOCGRP_WOMAN)
|
|
|
|
|
|
|
|
canUseMyBody = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!canUseMyBody)
|
|
|
|
|
|
|
|
m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pedIK.RestoreLookAt()) {
|
|
|
|
if (m_pedIK.RestoreLookAt()) {
|
|
|
|
bIsRestoringLook = false;
|
|
|
|
bIsRestoringLook = false;
|
|
|
|
|
|
|
|
canUseMyBody = false;
|
|
|
|
|
|
|
|
if (m_nPedState != PED_DRIVING && m_nPedState != PED_DRAG_FROM_CAR && !bIsDucking) {
|
|
|
|
|
|
|
|
if (m_animGroup != ASSOCGRP_SEXYWOMAN && m_animGroup != ASSOCGRP_WOMAN)
|
|
|
|
|
|
|
|
canUseMyBody = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(canUseMyBody)
|
|
|
|
|
|
|
|
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -12234,19 +12355,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|
|
|
ped->SetObjective(OBJECTIVE_NONE);
|
|
|
|
ped->SetObjective(OBJECTIVE_NONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (veh->pDriver == ped) {
|
|
|
|
ped->AddInCarAnims(veh, veh->pDriver == ped);
|
|
|
|
if (veh->bLowVehicle) {
|
|
|
|
|
|
|
|
ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_LSIT, 100.0f);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_SIT, 100.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (veh->bLowVehicle) {
|
|
|
|
|
|
|
|
ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_SITPLO, 100.0f);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_SITP, 100.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ped->StopNonPartialAnims();
|
|
|
|
|
|
|
|
if (veh->bIsBus)
|
|
|
|
if (veh->bIsBus)
|
|
|
|
ped->bRenderPedInCar = false;
|
|
|
|
ped->bRenderPedInCar = false;
|
|
|
|
|
|
|
|
|
|
|
@ -12651,11 +12760,11 @@ CPed::ReplaceWeaponWhenExitingVehicle(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Add driveby check, enumarate weapon slots
|
|
|
|
// --MIAMI: Done
|
|
|
|
inline void
|
|
|
|
inline void
|
|
|
|
CPed::RemoveWeaponWhenEnteringVehicle(void)
|
|
|
|
CPed::RemoveWeaponWhenEnteringVehicle(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (IsPlayer() && GetWeapon(5).m_eWeaponType && GetWeapon(5).m_nAmmoTotal > 0) {
|
|
|
|
if (IsPlayer() && HasWeaponSlot(5) && GetWeapon(5).m_nAmmoTotal > 0 && ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed()->m_bDriveByAllowed) {
|
|
|
|
if (m_storedWeapon == WEAPONTYPE_UNIDENTIFIED)
|
|
|
|
if (m_storedWeapon == WEAPONTYPE_UNIDENTIFIED)
|
|
|
|
m_storedWeapon = GetWeapon()->m_eWeaponType;
|
|
|
|
m_storedWeapon = GetWeapon()->m_eWeaponType;
|
|
|
|
SetCurrentWeapon(GetWeapon(5).m_eWeaponType);
|
|
|
|
SetCurrentWeapon(GetWeapon(5).m_eWeaponType);
|
|
|
@ -14190,7 +14299,7 @@ CPed::ProcessObjective(void)
|
|
|
|
|
|
|
|
|
|
|
|
if (reloadAssoc || !m_pedInObjective->IsPedShootable()) {
|
|
|
|
if (reloadAssoc || !m_pedInObjective->IsPedShootable()) {
|
|
|
|
if (reloadAssoc &&
|
|
|
|
if (reloadAssoc &&
|
|
|
|
(!reloadAssoc->IsRunning() || reloadAssoc->currentTime / reloadAssoc->hierarchy->totalLength > 0.8f)) {
|
|
|
|
(!reloadAssoc->IsRunning() || reloadAssoc->GetProgress() > 0.8f)) {
|
|
|
|
CAnimBlendAssociation *punchAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_PPUNCH, 8.0f);
|
|
|
|
CAnimBlendAssociation *punchAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_PPUNCH, 8.0f);
|
|
|
|
punchAssoc->flags |= ASSOC_DELETEFADEDOUT;
|
|
|
|
punchAssoc->flags |= ASSOC_DELETEFADEDOUT;
|
|
|
|
punchAssoc->flags |= ASSOC_FADEOUTWHENDONE;
|
|
|
|
punchAssoc->flags |= ASSOC_FADEOUTWHENDONE;
|
|
|
@ -17529,33 +17638,11 @@ CPed::WarpPedIntoCar(CVehicle *car)
|
|
|
|
DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_ENGINE_START, 1.0f);
|
|
|
|
DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_ENGINE_START, 1.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
|
|
|
|
RpAnimBlendClumpSetBlendDeltas(GetClump(), ASSOC_PARTIAL, -1000.0f);
|
|
|
|
RpAnimBlendClumpSetBlendDeltas(GetClump(), ASSOC_PARTIAL, -1000.0f);
|
|
|
|
|
|
|
|
|
|
|
|
// VC uses AddInCarAnims but we don't have that
|
|
|
|
AddInCarAnims(car, car->pDriver == this);
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
|
|
|
|
|
|
|
|
RemoveWeaponWhenEnteringVehicle();
|
|
|
|
RemoveWeaponWhenEnteringVehicle();
|
|
|
|
#else
|
|
|
|
|
|
|
|
if (car->IsBoat()) {
|
|
|
|
|
|
|
|
#ifndef FIX_BUGS
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CWeaponInfo *ourWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
|
|
|
|
|
|
|
|
RemoveWeaponModel(ourWeapon->m_nModelId);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Because we can use Uzi for drive by
|
|
|
|
|
|
|
|
RemoveWeaponWhenEnteringVehicle();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (car->bLowVehicle)
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LSIT, 100.0f);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_SIT, 100.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StopNonPartialAnims();
|
|
|
|
|
|
|
|
if (car->bIsBus)
|
|
|
|
if (car->bIsBus)
|
|
|
|
bRenderPedInCar = false;
|
|
|
|
bRenderPedInCar = false;
|
|
|
|
|
|
|
|
|
|
|
@ -17837,25 +17924,13 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
|
|
|
|
m_vecOffsetSeek = doorOpenPos - GetPosition();
|
|
|
|
m_vecOffsetSeek = doorOpenPos - GetPosition();
|
|
|
|
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
|
|
|
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
|
|
|
if (car->IsBoat()) {
|
|
|
|
if (car->IsBoat()) {
|
|
|
|
#ifdef VC_PED_PORTS
|
|
|
|
if(car->pHandling->Flags & HANDLING_SIT_IN_BOAT)
|
|
|
|
// VC checks for handling flag, but we can't do that
|
|
|
|
|
|
|
|
if(car->GetModelIndex() == MI_SPEEDER)
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_SIT, 100.0f);
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_SIT, 100.0f);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
|
|
|
|
|
|
|
|
|
|
|
|
PedSetInCarCB(nil, this);
|
|
|
|
PedSetInCarCB(nil, this);
|
|
|
|
bVehExitWillBeInstant = true;
|
|
|
|
bVehExitWillBeInstant = true;
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FIX_BUGS
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, this);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (IsPlayer())
|
|
|
|
if (IsPlayer())
|
|
|
|
CWaterLevel::AllocateBoatWakeArray();
|
|
|
|
CWaterLevel::AllocateBoatWakeArray();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -18418,14 +18493,15 @@ CPed::Load(uint8*& buf)
|
|
|
|
#undef CopyToBuf
|
|
|
|
#undef CopyToBuf
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::GiveDelayedWeapon(eWeaponType weapon, uint32 ammo)
|
|
|
|
CPed::GiveDelayedWeapon(eWeaponType weapon, uint32 ammo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_storedWeapon = weapon;
|
|
|
|
m_delayedWeapon = weapon;
|
|
|
|
m_storedWeaponAmmo = ammo;
|
|
|
|
m_delayedWeaponAmmo = ammo;
|
|
|
|
if (m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
|
|
|
|
if (m_delayedWeapon != WEAPONTYPE_UNIDENTIFIED) {
|
|
|
|
int modelId1 = CWeaponInfo::GetWeaponInfo(m_storedWeapon)->m_nModelId;
|
|
|
|
int modelId1 = CWeaponInfo::GetWeaponInfo(m_delayedWeapon)->m_nModelId;
|
|
|
|
int modelId2 = CWeaponInfo::GetWeaponInfo(m_storedWeapon)->m_nModel2Id;
|
|
|
|
int modelId2 = CWeaponInfo::GetWeaponInfo(m_delayedWeapon)->m_nModel2Id;
|
|
|
|
if (modelId1 != -1)
|
|
|
|
if (modelId1 != -1)
|
|
|
|
CStreaming::RequestModel(modelId1, STREAMFLAGS_DEPENDENCY);
|
|
|
|
CStreaming::RequestModel(modelId1, STREAMFLAGS_DEPENDENCY);
|
|
|
|
if (modelId2 != -1)
|
|
|
|
if (modelId2 != -1)
|
|
|
@ -18433,18 +18509,19 @@ CPed::GiveDelayedWeapon(eWeaponType weapon, uint32 ammo)
|
|
|
|
|
|
|
|
|
|
|
|
if ((modelId1 == -1 || CStreaming::HasModelLoaded(modelId1))
|
|
|
|
if ((modelId1 == -1 || CStreaming::HasModelLoaded(modelId1))
|
|
|
|
&& (modelId2 == -1 || CStreaming::HasModelLoaded(modelId2))) {
|
|
|
|
&& (modelId2 == -1 || CStreaming::HasModelLoaded(modelId2))) {
|
|
|
|
GiveWeapon(m_storedWeapon, m_storedWeaponAmmo, 1);
|
|
|
|
GiveWeapon(m_delayedWeapon, m_delayedWeaponAmmo, true);
|
|
|
|
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
m_delayedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::RequestDelayedWeapon()
|
|
|
|
CPed::RequestDelayedWeapon()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
|
|
|
|
if (m_delayedWeapon != WEAPONTYPE_UNIDENTIFIED) {
|
|
|
|
int modelId1 = CWeaponInfo::GetWeaponInfo(m_storedWeapon)->m_nModelId;
|
|
|
|
int modelId1 = CWeaponInfo::GetWeaponInfo(m_delayedWeapon)->m_nModelId;
|
|
|
|
int modelId2 = CWeaponInfo::GetWeaponInfo(m_storedWeapon)->m_nModel2Id;
|
|
|
|
int modelId2 = CWeaponInfo::GetWeaponInfo(m_delayedWeapon)->m_nModel2Id;
|
|
|
|
if (modelId1 != -1)
|
|
|
|
if (modelId1 != -1)
|
|
|
|
CStreaming::RequestModel(modelId1, STREAMFLAGS_DEPENDENCY);
|
|
|
|
CStreaming::RequestModel(modelId1, STREAMFLAGS_DEPENDENCY);
|
|
|
|
if (modelId2 != -1)
|
|
|
|
if (modelId2 != -1)
|
|
|
@ -18452,12 +18529,13 @@ CPed::RequestDelayedWeapon()
|
|
|
|
|
|
|
|
|
|
|
|
if ((modelId1 == -1 || CStreaming::HasModelLoaded(modelId1))
|
|
|
|
if ((modelId1 == -1 || CStreaming::HasModelLoaded(modelId1))
|
|
|
|
&& (modelId2 == -1 || CStreaming::HasModelLoaded(modelId2))) {
|
|
|
|
&& (modelId2 == -1 || CStreaming::HasModelLoaded(modelId2))) {
|
|
|
|
GiveWeapon(m_storedWeapon, m_storedWeaponAmmo, 1);
|
|
|
|
GiveWeapon(m_delayedWeapon, m_delayedWeaponAmmo, 1);
|
|
|
|
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
m_delayedWeapon = WEAPONTYPE_UNIDENTIFIED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
void
|
|
|
|
void
|
|
|
|
CPed::ClearFollowPath()
|
|
|
|
CPed::ClearFollowPath()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -18467,3 +18545,43 @@ CPed::ClearFollowPath()
|
|
|
|
m_nPathNodes = 0;
|
|
|
|
m_nPathNodes = 0;
|
|
|
|
m_nCurPathNode = 0;
|
|
|
|
m_nCurPathNode = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --MIAMI: Done
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
CPed::AddInCarAnims(CVehicle* car, bool isDriver)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AnimationId anim;
|
|
|
|
|
|
|
|
AssocGroupId group;
|
|
|
|
|
|
|
|
if (car->IsBoat()) {
|
|
|
|
|
|
|
|
if (car->pHandling->Flags & HANDLING_SIT_IN_BOAT) {
|
|
|
|
|
|
|
|
anim = ANIM_CAR_SIT;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
anim = ANIM_DRIVE_BOAT;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
group = ASSOCGRP_STD;
|
|
|
|
|
|
|
|
} else if (car->IsBike()) {
|
|
|
|
|
|
|
|
if (isDriver) {
|
|
|
|
|
|
|
|
// TODO(Miami): Bikes
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// TODO(Miami): Bikes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (isDriver) {
|
|
|
|
|
|
|
|
if (car->bLowVehicle) {
|
|
|
|
|
|
|
|
anim = ANIM_CAR_LSIT;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
anim = ANIM_CAR_SIT;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (car->bLowVehicle) {
|
|
|
|
|
|
|
|
anim = ANIM_CAR_SITPLO;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
anim = ANIM_CAR_SITP;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
group = ASSOCGRP_STD;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), group, anim, 100.0f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StopNonPartialAnims();
|
|
|
|
|
|
|
|
}
|