Skip to content

Commit c8fbacd

Browse files
authored
Fix animation list and add some small checks in game_sa (#4178)
* Add groups and anims * Add anim names for compatibility * Add some checks
1 parent 09226a3 commit c8fbacd

File tree

4 files changed

+409
-7
lines changed

4 files changed

+409
-7
lines changed

Client/game_sa/CAnimManagerSA.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -874,12 +874,18 @@ const char* CAnimManagerSA::GetGateWayAnimationName() const
874874

875875
bool CAnimManagerSA::IsValidGroup(std::uint32_t uiAnimGroup) const
876876
{
877+
if ((eAnimGroup)uiAnimGroup <= eAnimGroup::ANIM_GROUP_NONE || (eAnimGroup)uiAnimGroup >= eAnimGroup::ANIM_TOTAL_GROUPS)
878+
return false;
879+
877880
const auto pGroup = GetAnimBlendAssoc(uiAnimGroup);
878881
return pGroup && pGroup->IsCreated();
879882
}
880883

881884
bool CAnimManagerSA::IsValidAnim(std::uint32_t uiAnimGroup, std::uint32_t uiAnimID) const
882885
{
886+
if ((eAnimID)uiAnimID <= eAnimID::ANIM_ID_UNDEFINED || (eAnimID)uiAnimID >= eAnimID::ANIM_ID_MAX)
887+
return false;
888+
883889
// We get an animation for the checks
884890
const auto pAnim = GetAnimStaticAssociation((eAnimGroup)uiAnimGroup, (eAnimID)uiAnimID);
885891
if (!pAnim)

Client/mods/deathmatch/logic/CClientPed.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ void CClientPed::ApplyControllerStateFixes(CControllerState& Current)
29782978
// Check we're not doing any important animations
29792979
eAnimID animId = pAssoc->GetAnimID();
29802980
if (animId == eAnimID::ANIM_ID_WALK || animId == eAnimID::ANIM_ID_RUN || animId == eAnimID::ANIM_ID_IDLE ||
2981-
animId == eAnimID::ANIM_ID_WEAPON_CROUCH || animId == eAnimID::ANIM_ID_STEALTH_AIM)
2981+
animId == eAnimID::ANIM_ID_WEAPON_CROUCH || animId == eAnimID::ANIM_ID_KILL_PARTIAL)
29822982
{
29832983
// Are our knife anims loaded?
29842984
std::unique_ptr<CAnimBlock> pBlock = g_pGame->GetAnimManager()->GetAnimationBlock("KNIFE");

Client/multiplayer_sa/CMultiplayerSA_FixBadAnimId.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ eAnimID _cdecl OnCAnimBlendAssocGroupCopyAnimation_FixBadAnim(eAnimGroup* pAnimG
2121
pMultiplayer->SetLastStaticAnimationPlayed(*pAnimGroup, *pAnimId, *(DWORD*)0xb4ea34);
2222

2323
// Fix #1109: Weapon Fire ancient crash with anim ID 224
24-
if (*pAnimId == eAnimID::ANIM_ID_WEAPON_FIRE && *pAnimGroup != eAnimGroup::ANIM_GROUP_GRENADE)
24+
if (*pAnimId == eAnimID::ANIM_ID_FIRE && *pAnimGroup != eAnimGroup::ANIM_GROUP_GRENADE)
2525
{
2626
if (*pAnimGroup < eAnimGroup::ANIM_GROUP_PYTHON || *pAnimGroup > eAnimGroup::ANIM_GROUP_GOGGLES)
2727
{

0 commit comments

Comments
 (0)