summaryrefslogtreecommitdiffstats
path: root/src/peds/PedFight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/peds/PedFight.cpp')
-rw-r--r--src/peds/PedFight.cpp138
1 files changed, 76 insertions, 62 deletions
diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp
index 43ded57a..eda59f2e 100644
--- a/src/peds/PedFight.cpp
+++ b/src/peds/PedFight.cpp
@@ -31,6 +31,7 @@ RpClump* flyingClumpTemp;
FightMove tFightMoves[NUM_FIGHTMOVES] =
{
+/*
{ ANIM_STD_NUM, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 },
{ ANIM_STD_PUNCH, 0.2f, 8.f/30.f, 0.0f, 0.3f, 1.0f, HITLEVEL_HIGH, 1, 0 },
{ ANIM_STD_FIGHT_IDLE, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 },
@@ -63,6 +64,7 @@ FightMove tFightMoves[NUM_FIGHTMOVES] =
{ ANIM_ATTACK_2, 4.f/30.f, 7.f/30.f, 10.f/30.f, 0.4f, 1.0f, HITLEVEL_HIGH, 1, 0 },
{ ANIM_ATTACK_3, 4.f / 30.f, 7.f / 30.f, 10.f / 30.f, 0.4f, 1.0f, HITLEVEL_HIGH, 1, 0 },
{ ANIM_STD_FIGHT_2IDLE, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 }
+*/
};
static PedOnGroundState
@@ -182,14 +184,14 @@ CPed::SetPointGunAt(CEntity *to)
if (bCrouchWhenShooting && bIsDucking && GetCrouchFireAnim(curWeapon)) {
aimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(curWeapon));
} else {
- aimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE);
+ aimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATTACK_1);
}
if (!aimAssoc || aimAssoc->blendDelta < 0.0f) {
if (bCrouchWhenShooting && bIsDucking && GetCrouchFireAnim(curWeapon)) {
aimAssoc = CAnimManager::BlendAnimation(GetClump(), curWeapon->m_AnimToPlay, GetCrouchFireAnim(curWeapon), 4.0f);
} else {
- aimAssoc = CAnimManager::AddAnimation(GetClump(), curWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE);
+ aimAssoc = CAnimManager::AddAnimation(GetClump(), curWeapon->m_AnimToPlay, ANIM_ATTACK_1);
}
aimAssoc->blendAmount = 0.0f;
@@ -204,7 +206,7 @@ CPed::PointGunAt(void)
{
CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
float animLoopStart = weaponInfo->m_fAnimLoopStart;
- CAnimBlendAssociation *weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE);
+ CAnimBlendAssociation *weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATTACK_1);
if (!weaponAssoc || weaponAssoc->blendDelta < 0.0f) {
if (weaponInfo->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) {
weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weaponInfo));
@@ -240,7 +242,7 @@ CPed::ClearPointGunAt(void)
RestorePreviousState();
}
weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
- animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE);
+ animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATTACK_1);
if (!animAssoc || animAssoc->blendDelta < 0.0f) {
if (weaponInfo->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) {
animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weaponInfo));
@@ -1013,7 +1015,7 @@ CPed::Attack(void)
weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this);
} else if (GetSecondFireAnim(ourWeapon)) {
if (weaponAnimAssoc->animId == GetSecondFireAnim(ourWeapon)) {
- weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE, 8.0f);
+ weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_ATTACK_1, 8.0f);
} else {
weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetSecondFireAnim(ourWeapon), 8.0f);
}
@@ -1128,10 +1130,7 @@ CPed::StartFightAttack(uint8 buttonPressure)
break;
}
} else {
- if (m_curFightMove == FIGHTMOVE_BACKKICK)
- animAssoc->speed = 1.15f;
- else
- animAssoc->speed = 0.8f;
+ animAssoc->speed = 0.8f;
}
if (IsPlayer())
animAssoc->SetCurrentTime(0.08f);
@@ -1239,12 +1238,14 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
default:
if (hitLevel == HITLEVEL_LOW) {
hitAnim = ANIM_STD_KO_SHOT_STOMACH;
+/* LCS: removed
} else if (CGeneral::GetRandomNumber() & 1) {
fall = false;
hitAnim = ANIM_STD_HIT_WALK;
} else if (CGeneral::GetRandomNumber() & 1) {
fall = false;
hitAnim = ANIM_STD_HIT_HEAD;
+*/
} else {
hitAnim = ANIM_STD_KO_SHOT_FACE;
}
@@ -1279,7 +1280,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
Say(SOUND_PED_DEFEND);
return;
}
- m_curFightMove = FIGHTMOVE_HITBODY;
+ m_curFightMove = FIGHTMOVE_HITFRONT; // LCS
break;
case HITLEVEL_HIGH:
switch (direction) {
@@ -1293,10 +1294,12 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
m_curFightMove = FIGHTMOVE_HITRIGHT;
break;
default:
- if (unk <= 5)
- m_curFightMove = FIGHTMOVE_HITHEAD;
- else
- m_curFightMove = FIGHTMOVE_HITBIGSTEP;
+ // LCS: removed
+ //if (unk <= 5)
+ // m_curFightMove = FIGHTMOVE_HITHEAD;
+ //else
+ // m_curFightMove = FIGHTMOVE_HITBIGSTEP;
+ m_curFightMove = FIGHTMOVE_HITFRONT;
break;
}
break;
@@ -1312,10 +1315,12 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
m_curFightMove = FIGHTMOVE_HITRIGHT;
break;
default:
- if (unk <= 5)
- m_curFightMove = FIGHTMOVE_HITCHEST;
- else
- m_curFightMove = FIGHTMOVE_HITBIGSTEP;
+ // LCS: removed
+ //if (unk <= 5)
+ // m_curFightMove = FIGHTMOVE_HITCHEST;
+ //else
+ // m_curFightMove = FIGHTMOVE_HITBIGSTEP;
+ m_curFightMove = FIGHTMOVE_HITFRONT;
break;
}
break;
@@ -1468,30 +1473,30 @@ CPed::Fight(void)
CVector touchingNodePos(0.0f, 0.0f, 0.0f);
switch (m_curFightMove) {
- case FIGHTMOVE_KNEE:
- TransformToNode(touchingNodePos, PED_LOWERLEGR);
- break;
- case FIGHTMOVE_PUNCHHOOK:
- case FIGHTMOVE_PUNCHJAB:
- TransformToNode(touchingNodePos, PED_HANDL);
- break;
+ // case FIGHTMOVE_KNEE:
+ // TransformToNode(touchingNodePos, PED_LOWERLEGR);
+ // break;
+ // case FIGHTMOVE_PUNCHHOOK:
+ // case FIGHTMOVE_PUNCHJAB:
+ // TransformToNode(touchingNodePos, PED_HANDL);
+ // break;
case FIGHTMOVE_LONGKICK:
case FIGHTMOVE_ROUNDHOUSE:
- case FIGHTMOVE_FWDLEFT:
- case FIGHTMOVE_BACKRIGHT:
+ // case FIGHTMOVE_FWDLEFT:
+ // case FIGHTMOVE_BACKRIGHT:
case FIGHTMOVE_GROUNDKICK:
TransformToNode(touchingNodePos, PED_FOOTR);
break;
case FIGHTMOVE_FWDRIGHT:
TransformToNode(touchingNodePos, PED_HEAD);
break;
- case FIGHTMOVE_BACKKICK:
- case FIGHTMOVE_BACKFLIP:
- TransformToNode(touchingNodePos, PED_FOOTL);
- break;
- case FIGHTMOVE_BACKLEFT:
- TransformToNode(touchingNodePos, PED_UPPERARML);
- break;
+ // case FIGHTMOVE_BACKKICK:
+ // case FIGHTMOVE_BACKFLIP:
+ // TransformToNode(touchingNodePos, PED_FOOTL);
+ // break;
+ // case FIGHTMOVE_BACKLEFT:
+ // TransformToNode(touchingNodePos, PED_UPPERARML);
+ // break;
default:
TransformToNode(touchingNodePos, PED_HANDR);
break;
@@ -1543,10 +1548,7 @@ CPed::Fight(void)
tFightMoves[m_curFightMove].animId, 8.0f);
if (weaponInfo->m_AnimToPlay != ASSOCGRP_KNIFE || m_curFightMove < FIGHTMOVE_MELEE1) {
- if (m_curFightMove == FIGHTMOVE_BACKKICK)
- animAssoc->speed = 1.15f;
- else
- animAssoc->speed = 0.8f;
+ animAssoc->speed = 0.8f;
} else {
switch (GetWeapon()->m_eWeaponType) {
case WEAPONTYPE_SCREWDRIVER:
@@ -1686,8 +1688,9 @@ CPed::ChooseAttackAI(uint8 buttonPressure, bool fightWithWeapon)
return FIGHTMOVE_IDLE;
}
}
- if (dist < 0.95f && canKneeHead)
- return FIGHTMOVE_KNEE;
+ // LCS: removed
+ //if (dist < 0.95f && canKneeHead)
+ // return FIGHTMOVE_KNEE;
if (dist < 1.4f)
return FIGHTMOVE_PUNCH;
if (dist < 2.f && canKick) {
@@ -1805,9 +1808,11 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon)
switch (dir) {
case 0: // forward
if (fightWithWeapon) {
- if (distToVictim < 0.95f - 0.2f && m_nPedState == PED_FIGHT) {
- choosenMove = FIGHTMOVE_KNEE;
- } else {
+ // LCS: removed
+ //if (distToVictim < 0.95f - 0.2f && m_nPedState == PED_FIGHT) {
+ // choosenMove = FIGHTMOVE_KNEE;
+ //} else
+ {
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CLEAVER) {
if (distToVictim < 0.85f * weaponInfo->m_fRange)
choosenMove = FIGHTMOVE_MELEE1;
@@ -1830,18 +1835,20 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon)
}
}
}
- } else if (distToVictim < 0.95f && m_nPedState == PED_FIGHT) {
- choosenMove = FIGHTMOVE_KNEE;
+ // LCS: removed
+ //} else if (distToVictim < 0.95f && m_nPedState == PED_FIGHT) {
+ // choosenMove = FIGHTMOVE_KNEE;
} else if (distToVictim < 1.4f) {
- if (m_curFightMove == FIGHTMOVE_PUNCHJAB) {
+ // LCS: removed
+ /*if (m_curFightMove == FIGHTMOVE_PUNCHJAB) {
choosenMove = FIGHTMOVE_PUNCH;
- } else if (m_curFightMove != FIGHTMOVE_PUNCH || randVal != 1) {
- if (randVal == 2)
+ } else*/ if (m_curFightMove != FIGHTMOVE_PUNCH || randVal != 1) {
+ //if (randVal == 2)
choosenMove = FIGHTMOVE_PUNCH;
- else
- choosenMove = FIGHTMOVE_PUNCHJAB;
+ //else
+ // choosenMove = FIGHTMOVE_PUNCHJAB;
} else {
choosenMove = FIGHTMOVE_LONGKICK;
}
@@ -1849,6 +1856,7 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon)
choosenMove = FIGHTMOVE_LONGKICK;
}
break;
+/* LCS: removed
case 1:
choosenMove = FIGHTMOVE_FWDLEFT;
break;
@@ -1861,6 +1869,7 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon)
case 4:
choosenMove = FIGHTMOVE_BACKRIGHT;
break;
+*/
default:
choosenMove = FIGHTMOVE_FWDRIGHT;
break;
@@ -1926,20 +1935,22 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon)
#else
switch (CGeneral::GetRandomNumberInRange(0,3)) {
#endif
- case 0:
- choosenMove = FIGHTMOVE_PUNCHJAB;
- break;
+ // LCS: hack hack
+ // case 0:
+ // choosenMove = FIGHTMOVE_PUNCHJAB;
+ // break;
+ default:
case 1:
choosenMove = FIGHTMOVE_PUNCH;
break;
case 2:
choosenMove = FIGHTMOVE_LONGKICK;
break;
- case 3:
- choosenMove = FIGHTMOVE_KNEE;
- break;
- default:
- break;
+ // case 3:
+ // choosenMove = FIGHTMOVE_KNEE;
+ // break;
+ // default:
+ // break;
}
}
return choosenMove;
@@ -1982,6 +1993,7 @@ CPed::EndFight(uint8 endType)
void
CPed::PlayHitSound(CPed *hitTo)
{
+#if 0 // LCS: temporarily removed
// That was very complicated to reverse for me...
// First index is our fight move ID (from 1 to 17, total 17), second is the one of we fight with (from 18 to 27, total 10).
enum {
@@ -2052,6 +2064,7 @@ CPed::PlayHitSound(CPed *hitTo)
if (soundId != NO_SND)
DMAudio.PlayOneShot(m_audioEntityId, soundId, (weapon << 8) | ENTITY_TYPE_PED);
+#endif
}
bool
@@ -2183,8 +2196,9 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dir, int16 piece)
bool brassKnucklePunch = false;
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_BRASSKNUCKLE) {
- if (m_curFightMove == FIGHTMOVE_PUNCHHOOK || m_curFightMove == FIGHTMOVE_PUNCHJAB || m_curFightMove == FIGHTMOVE_BACKLEFT ||
- m_curFightMove == FIGHTMOVE_STDPUNCH || m_curFightMove == FIGHTMOVE_PUNCH) {
+ // LCS: removed
+ if (/*m_curFightMove == FIGHTMOVE_PUNCHHOOK || m_curFightMove == FIGHTMOVE_PUNCHJAB || m_curFightMove == FIGHTMOVE_BACKLEFT ||
+ m_curFightMove == FIGHTMOVE_STDPUNCH ||*/ m_curFightMove == FIGHTMOVE_PUNCH) {
brassKnucklePunch = true;
damageMult *= 1.5f;
}
@@ -4172,7 +4186,7 @@ CPed::RemoveWeaponAnims(int unused, float animDelta)
CAnimBlendAssociation *weaponAssoc;
//CWeaponInfo::GetWeaponInfo(unused);
- weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE);
+ weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATTACK_1);
if (weaponAssoc) {
weaponAssoc->blendDelta = animDelta;
weaponAssoc->flags |= ASSOC_DELETEFADEDOUT;
@@ -4187,7 +4201,7 @@ CPed::RemoveWeaponAnims(int unused, float animDelta)
weaponAssoc->blendDelta = animDelta;
weaponAssoc->flags |= ASSOC_DELETEFADEDOUT;
}
- weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_RELOAD);
+ weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_ATTACK_EXTRA1);
if (weaponAssoc) {
weaponAssoc->blendDelta = animDelta;
weaponAssoc->flags |= ASSOC_DELETEFADEDOUT;