Skip to content

Commit 8a9a729

Browse files
committed
Fix for some cutscene bones
1 parent be82b73 commit 8a9a729

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ WORD CClientIFP::ReadSequencesWithDummies(std::unique_ptr<CAnimBlendHierarchy>&
151151
MoveSequencesWithDummies(pAnimationHierarchy, MapOfSequences);
152152
WORD cSequences = m_kcIFPSequences + wUnknownSequences;
153153

154-
// As we need support for all 32 bones, we must change the total sequences count
154+
// As we need support for all 64 bones (32 ped + 32 cutscene ped), we must change the total sequences count
155155
pAnimationHierarchy->SetNumSequences(cSequences);
156156
return cSequences;
157157
}
@@ -243,7 +243,7 @@ std::int32_t CClientIFP::ReadSequenceVersion1(SAnim& Anim)
243243
RoundSize(Anim.Base.Size);
244244
ReadBytes(&Anim.Name, Anim.Base.Size);
245245

246-
SString strBoneName = ConvertStringToKey(Anim.Name);
246+
SString strBoneName = ConvertStringToKey(Anim.Name, true);
247247
std::int32_t iBoneID = GetBoneIDFromName(strBoneName);
248248

249249
SString strCorrectBoneName = GetCorrectBoneNameFromName(strBoneName);
@@ -769,10 +769,21 @@ void CClientIFP::CopyDummyKeyFrameByBoneID(BYTE* pKeyFrames, DWORD dwBoneID)
769769
}
770770
}
771771

772-
SString CClientIFP::ConvertStringToKey(const SString& strBoneName)
772+
SString CClientIFP::ConvertStringToKey(const SString& strBoneName, bool isANPK)
773773
{
774-
SString ConvertedString = strBoneName.ToLower();
775-
// Remove white spaces
774+
SString ConvertedString = strBoneName;
775+
776+
// Fix for some cutscene bones (like cssuitcase:Pelvis etc.)
777+
if (isANPK)
778+
{
779+
std::size_t pos = ConvertedString.find(":");
780+
if (pos != std::string::npos)
781+
ConvertedString = ConvertedString.substr(pos + 1);
782+
}
783+
784+
ConvertedString = ConvertedString.ToLower();
785+
786+
// Remove whitespaces
776787
ConvertedString.erase(std::remove(ConvertedString.begin(), ConvertedString.end(), ' '), ConvertedString.end());
777788
return ConvertedString;
778789
}
@@ -803,8 +814,7 @@ constexpr bool CClientIFP::IsKeyFramesTypeRoot(eFrameType iFrameType)
803814

804815
std::int32_t CClientIFP::GetBoneIDFromName(const SString& strBoneName)
805816
{
806-
// Some cutscene animations have different names like Root suitcase-1, etc
807-
if (strBoneName == "root" || strBoneName.substr(0, 4) == "root")
817+
if (strBoneName == "root")
808818
return eBoneType::NORMAL;
809819
if (strBoneName == "normal")
810820
return eBoneType::NORMAL;
@@ -1133,8 +1143,7 @@ SString CClientIFP::GetCorrectBoneNameFromID(const std::int32_t& iBoneID)
11331143

11341144
SString CClientIFP::GetCorrectBoneNameFromName(const SString& strBoneName)
11351145
{
1136-
// Some cutscene animations have different names like Root suitcase-1, etc
1137-
if (strBoneName == "root" || strBoneName.substr(0, 4) == "root")
1146+
if (strBoneName == "root")
11381147
return "Normal";
11391148
if (strBoneName == "normal")
11401149
return "Normal";

Client/mods/deathmatch/logic/CClientIFP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class CClientIFP final : public CClientEntity, CFileReader
297297

298298
void InsertAnimationDummySequence(std::unique_ptr<CAnimBlendSequence>& pAnimationSequence, const SString& BoneName, const DWORD& dwBoneID);
299299
void CopyDummyKeyFrameByBoneID(BYTE* pKeyFrames, DWORD dwBoneID);
300-
SString ConvertStringToKey(const SString& strBoneName);
300+
SString ConvertStringToKey(const SString& strBoneName, bool isANPK = false);
301301

302302
constexpr void RoundSize(std::uint32_t& u32Size);
303303
constexpr bool IsKeyFramesTypeRoot(eFrameType iFrameType);

0 commit comments

Comments
 (0)