Skip to content

Commit fc3f52e

Browse files
committed
Add flags argument
1 parent 926a75a commit fc3f52e

18 files changed

+45
-33
lines changed

Client/game_sa/CBuildingSA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void CBuildingSA::SetLod(CBuilding* pLod)
7272
}
7373
}
7474

75-
void CBuildingSA::SetAnimation(CAnimBlendHierarchySAInterface* animation)
75+
void CBuildingSA::SetAnimation(CAnimBlendHierarchySAInterface* animation, eAnimationFlags flags)
7676
{
7777
if (!m_pInterface || !m_pInterface->m_pRwObject)
7878
return;
@@ -83,7 +83,7 @@ void CBuildingSA::SetAnimation(CAnimBlendHierarchySAInterface* animation)
8383
RpAnimBlendClumpInit(clump);
8484

8585
if (animation)
86-
pGame->GetAnimManager()->BlendAnimation(clump, animation, ANIMATION_IS_LOOPED, 1.0f);
86+
pGame->GetAnimManager()->BlendAnimation(clump, animation, flags, 1.0f);
8787
}
8888

8989
bool CBuildingSA::SetAnimationSpeed(float speed)

Client/game_sa/CBuildingSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CBuildingSA final : public virtual CBuilding, public virtual CEntitySA
2727
CBuildingSAInterface* GetBuildingInterface() { return static_cast<CBuildingSAInterface*>(GetInterface()); };
2828

2929
void SetLod(CBuilding* pLod) override;
30-
void SetAnimation(class CAnimBlendHierarchySAInterface* animation) override;
30+
void SetAnimation(class CAnimBlendHierarchySAInterface* animation, eAnimationFlags flags) override;
3131
bool SetAnimationSpeed(float speed) override;
3232

3333
void AllocateMatrix();

Client/game_sa/CModelInfoSA.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ void CModelInfoSA::StaticResetModelAnimations()
15271527
if (modelInfo)
15281528
{
15291529
modelInfo->DisableObjectAnimation(false);
1530-
modelInfo->SetObjectAnimation(nullptr, 0);
1530+
modelInfo->SetObjectAnimation(nullptr, 0, 0);
15311531
}
15321532

15331533
CBaseModelInfoSAInterface* modelInfoInterface = modelInfo->GetInterface();
@@ -2233,6 +2233,7 @@ RpClump* __fastcall CClumpModelInfoSAInterface::CreateInstance(CClumpModelInfoSA
22332233
{
22342234
CAnimBlendHierarchySAInterface* anim = nullptr;
22352235
auto* modelInfo = pGame->GetModelInfo(static_cast<CBaseModelInfoSAInterface*>(clumpModelInfo));
2236+
eAnimationFlags flags = ANIMATION_IS_LOOPED;
22362237

22372238
if (clumpModelInfo->m_nAnimFileIndex != -1)
22382239
{
@@ -2246,12 +2247,15 @@ RpClump* __fastcall CClumpModelInfoSAInterface::CreateInstance(CClumpModelInfoSA
22462247
}
22472248
}
22482249
else if (modelInfo)
2250+
{
22492251
anim = modelInfo->GetObjectAnimation();
2252+
flags = modelInfo->GetObjectAnimationFlags();
2253+
}
22502254

22512255
if (anim)
22522256
{
22532257
RpAnimBlendClumpInit(clump);
2254-
pGame->GetAnimManager()->BlendAnimation(clump, anim, ANIMATION_IS_LOOPED, 1.0f);
2258+
pGame->GetAnimManager()->BlendAnimation(clump, anim, flags, 1.0f);
22552259
}
22562260
}
22572261

Client/game_sa/CModelInfoSA.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ class CModelInfoSA : public CModelInfo
393393
CAnimBlendHierarchySAInterface* m_objectAimation{};
394394
bool m_objectAnimationDisabled{false};
395395
unsigned int m_objectAnimationBlockNameHash{0};
396+
eAnimationFlags m_animationFlags{};
396397

397398
public:
398399
CModelInfoSA();
@@ -534,9 +535,10 @@ class CModelInfoSA : public CModelInfo
534535
void RestoreObjectPropertiesGroup();
535536
static void RestoreAllObjectsPropertiesGroups();
536537

537-
void SetObjectAnimation(CAnimBlendHierarchySAInterface* anim, unsigned int blockNameHash) noexcept override { m_objectAimation = anim; InsertModelIntoModifiedAnimList(m_dwModelID); m_objectAnimationBlockNameHash = blockNameHash; }
538+
void SetObjectAnimation(CAnimBlendHierarchySAInterface* anim, unsigned int blockNameHash, std::uint16_t flags) noexcept override { m_objectAimation = anim; InsertModelIntoModifiedAnimList(m_dwModelID); m_objectAnimationBlockNameHash = blockNameHash; m_animationFlags = static_cast<eAnimationFlags>(flags); }
538539
CAnimBlendHierarchySAInterface* GetObjectAnimation() const noexcept override { return m_objectAimation; }
539540
unsigned int GetObjectAnimationBlockNameHash() const noexcept override { return m_objectAnimationBlockNameHash; }
541+
eAnimationFlags GetObjectAnimationFlags() const noexcept override { return m_animationFlags; }
540542

541543
void DisableObjectAnimation(bool disable) noexcept override { m_objectAnimationDisabled = disable; InsertModelIntoModifiedAnimList(m_dwModelID); }
542544
bool IsObjectAnimationDisabled() const noexcept override { return m_objectAnimationDisabled; }

Client/game_sa/CObjectSA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ bool CObjectSA::SetOnFire(bool onFire)
325325
return true;
326326
}
327327

328-
void CObjectSA::SetAnimation(CAnimBlendHierarchySAInterface* animation)
328+
void CObjectSA::SetAnimation(CAnimBlendHierarchySAInterface* animation, eAnimationFlags flags)
329329
{
330330
if (!m_pInterface || !m_pInterface->m_pRwObject)
331331
return;
@@ -336,7 +336,7 @@ void CObjectSA::SetAnimation(CAnimBlendHierarchySAInterface* animation)
336336
RpAnimBlendClumpInit(clump);
337337

338338
if (animation)
339-
pGame->GetAnimManager()->BlendAnimation(clump, animation, ANIMATION_IS_LOOPED, 1.0f);
339+
pGame->GetAnimManager()->BlendAnimation(clump, animation, flags, 1.0f);
340340
else
341341
{
342342
for (auto assoc = pGame->GetAnimManager()->RpAnimBlendClumpGetFirstAssociation(clump); assoc; assoc = pGame->GetAnimManager()->RpAnimBlendGetNextAssociation(assoc))

Client/game_sa/CObjectSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class CObjectSA : public virtual CObject, public virtual CPhysicalSA
156156
bool IsOnFire() override { return GetObjectInterface()->pFire != nullptr; }
157157
bool SetOnFire(bool onFire) override;
158158

159-
void SetAnimation(class CAnimBlendHierarchySAInterface* animation) override;
159+
void SetAnimation(class CAnimBlendHierarchySAInterface* animation, eAnimationFlags flags) override;
160160
bool SetAnimationSpeed(float speed) override;
161161

162162
private:

Client/mods/deathmatch/logic/CClientBuilding.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,11 @@ float CClientBuilding::GetDistanceFromCentreOfMassToBaseOfModel()
226226
return m_pBuilding ? m_pBuilding->GetDistanceFromCentreOfMassToBaseOfModel() : 0.0f;
227227
}
228228

229-
void CClientBuilding::SetAnimation(CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash)
229+
void CClientBuilding::SetAnimation(CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash, std::uint16_t flags)
230230
{
231231
m_animation = animation;
232232
m_animationBlockNameHash = blockNameHash;
233+
m_animationFlags = static_cast<eAnimationFlags>(flags);
233234

234235
Recreate();
235236
RunAnimation();
@@ -254,7 +255,7 @@ void CClientBuilding::RunAnimation()
254255
if (!m_pBuilding)
255256
return;
256257

257-
m_pBuilding->SetAnimation(m_animation);
258+
m_pBuilding->SetAnimation(m_animation, m_animationFlags);
258259
m_pBuilding->SetAnimationSpeed(m_animationSpeed);
259260
m_animationPlaying = m_animation != nullptr && m_pBuilding->GetRpClump();
260261
}

Client/mods/deathmatch/logic/CClientBuilding.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CClientBuilding : public CClientEntity
5858

5959
float GetDistanceFromCentreOfMassToBaseOfModel();
6060

61-
void SetAnimation(class CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash);
61+
void SetAnimation(class CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash, std::uint16_t flags);
6262
bool SetAnimationSpeed(float speed);
6363

6464
unsigned int GetAnimationBlockNameHash() const noexcept { return m_animationBlockNameHash; }
@@ -92,5 +92,6 @@ class CClientBuilding : public CClientEntity
9292
unsigned int m_animationBlockNameHash{0};
9393
bool m_animationPlaying{false};
9494
float m_animationSpeed{1.0f};
95+
eAnimationFlags m_animationFlags{};
9596
bool m_animationSpeedUpdated{false};
9697
};

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void CClientIFP::Unlink()
4141
{
4242
CModelInfo* modelInfo = g_pGame->GetModelInfo(model);
4343
if (modelInfo)
44-
modelInfo->SetObjectAnimation(nullptr, 0);
44+
modelInfo->SetObjectAnimation(nullptr, 0, 0);
4545

4646
m_pManager->GetObjectManager()->RestreamObjects(model);
4747
m_pManager->GetBuildingManager()->RestreamBuildings(model);
@@ -50,9 +50,9 @@ void CClientIFP::Unlink()
5050
for (auto entity : m_entitiesUsingThisIFP)
5151
{
5252
if (entity->GetType() == eEntityType::ENTITY_TYPE_OBJECT)
53-
static_cast<CClientObject*>(entity)->SetAnimation(nullptr, 0);
53+
static_cast<CClientObject*>(entity)->SetAnimation(nullptr, 0, 0);
5454
else if (entity->GetType() == eEntityType::ENTITY_TYPE_BUILDING)
55-
static_cast<CClientBuilding*>(entity)->SetAnimation(nullptr, 0);
55+
static_cast<CClientBuilding*>(entity)->SetAnimation(nullptr, 0, 0);
5656
}
5757
}
5858
}

Client/mods/deathmatch/logic/CClientObject.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,11 @@ void CClientObject::SetHealth(float fHealth)
444444
m_fHealth = fHealth;
445445
}
446446

447-
void CClientObject::SetAnimation(CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash)
447+
void CClientObject::SetAnimation(CAnimBlendHierarchySAInterface* animation, unsigned int blockNameHash, std::uint16_t flags)
448448
{
449449
m_animation = animation;
450450
m_animationBlockNameHash = blockNameHash;
451+
m_animationFlags = static_cast<eAnimationFlags>(flags);
451452

452453
RunAnimation();
453454
}
@@ -709,7 +710,7 @@ void CClientObject::RunAnimation()
709710
if (!m_pObject)
710711
return;
711712

712-
m_pObject->SetAnimation(m_animation);
713+
m_pObject->SetAnimation(m_animation, m_animationFlags);
713714
m_pObject->SetAnimationSpeed(m_animationSpeed);
714715

715716
m_animationPlaying = m_animation != nullptr && m_pObject->GetRpClump();

0 commit comments

Comments
 (0)