Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 0330fe8

Browse files
committed
Remove AHuman::GetGraphicalIcon and replace it with an override to MOSprite::GetGraphicalIcon as well as adding the same logic to ACrab, but with Turret
1 parent afe7ea3 commit 0330fe8

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

Entities/ACrab.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ void ACrab::SetRightBGLeg(Leg *newLeg) {
575575

576576
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
577577

578+
BITMAP *ACrab::GetGraphicalIcon() const {
579+
return m_pTurret ? m_pTurret->GetSpriteFrame(0) : MOSprite::GetGraphicalIcon();
580+
}
578581

579582
//////////////////////////////////////////////////////////////////////////////////////////
580583
// Virtual method: CollideAtPoint

Entities/ACrab.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,13 @@ int FirearmActivationDelay() const;
435435
MovableObject * LookForMOs(float FOVSpread = 45, unsigned char ignoreMaterial = 0, bool ignoreAllTerrain = false);
436436

437437

438+
/// <summary>
439+
/// Gets the BITMAP representation of this ACrab's Turret, or its body if no Turret has been defined.
440+
/// </summary>
441+
/// <returns>The Turret or body of this ACrab as a BITMAP.</returns>
442+
BITMAP *GetGraphicalIcon() const override;
443+
444+
438445
//////////////////////////////////////////////////////////////////////////////////////////
439446
// Virtual method: UpdateMovePath
440447
//////////////////////////////////////////////////////////////////////////////////////////

Entities/AHuman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ void AHuman::SetBGLeg(Leg *newLeg) {
630630

631631
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
632632

633-
BITMAP *AHuman::GetHeadBitmap() const {
634-
return (m_pHead && m_pHead->IsAttached()) ? m_pHead->GetSpriteFrame(0) : nullptr;
633+
BITMAP *AHuman::GetGraphicalIcon() const {
634+
return m_pHead ? m_pHead->GetSpriteFrame(0) : MOSprite::GetGraphicalIcon();
635635
}
636636

637637
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Entities/AHuman.h

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,6 @@ ClassInfoGetters;
321321
void SetBGFoot(Attachable *newFoot) { if (m_pBGLeg && m_pBGLeg->IsAttached()) { m_pBGLeg->SetFoot(newFoot); } }
322322

323323

324-
//////////////////////////////////////////////////////////////////////////////////////////
325-
// Method: GetHeadBitmap
326-
//////////////////////////////////////////////////////////////////////////////////////////
327-
// Description: Gets the sprite representing the head of this.
328-
// Arguments: None.
329-
// Return value: A pointer to the bitmap of with the head of this. Ownership is NOT
330-
// transferred!
331-
332-
BITMAP *GetHeadBitmap() const;
333-
334324

335325
//////////////////////////////////////////////////////////////////////////////////////////
336326
// Method: GetJetTimeTotal
@@ -742,16 +732,11 @@ ClassInfoGetters;
742732
MovableObject * LookForMOs(float FOVSpread = 45, unsigned char ignoreMaterial = 0, bool ignoreAllTerrain = false);
743733

744734

745-
//////////////////////////////////////////////////////////////////////////////////////////
746-
// Method: GetGraphicalIcon
747-
//////////////////////////////////////////////////////////////////////////////////////////
748-
// Description: Gets a bitmap showing a good identifyable icon of this, for use in
749-
// GUI lists etc.
750-
// Arguments: None.
751-
// Return value: A good identifyable graphical representation of this in a BITMAP, if
752-
// available. If not, 0 is returned. Ownership is NOT TRANSFERRED!
753-
754-
BITMAP * GetGraphicalIcon() const override { return GetHeadBitmap(); }
735+
/// <summary>
736+
/// Gets the BITMAP representation of this AHuman's Head, or its body if no Head has been defined.
737+
/// </summary>
738+
/// <returns>The Head or body of this AHuman as a BITMAP.</returns>
739+
BITMAP *GetGraphicalIcon() const override;
755740

756741

757742
//////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)