Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Include/TSE.h
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ class CSpaceObject : public CObject
bool IsEnemy (const CDamageSource &Obj) const;
bool IsEnemyInRange (Metric rMaxRange, bool bIncludeStations = false);
bool IsEscortingFriendOf (const CSpaceObject *pObj) const;
bool IsEscorting(const CSpaceObject *pObj) const;
bool IsFriend (const CSpaceObject *pObj) const;
inline bool IsHighlighted (void) { return ((m_iHighlightCountdown != 0) || m_fSelected || m_iHighlightChar); }
bool IsInDamageCode (void) { return (m_fInDamage ? true : false); }
Expand Down
3 changes: 2 additions & 1 deletion Include/TSESovereign.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class CSovereign : public CDesignType
bool GetPropertyString (const CString &sProperty, CString *retsValue);
CString GetText (MessageTypes iMsg);
inline bool IsEnemy (CSovereign *pSovereign) { return (m_bSelfRel || (pSovereign != this)) && (GetDispositionTowards(pSovereign) == dispEnemy); }
inline bool IsFriend (CSovereign *pSovereign) { return (!m_bSelfRel && (pSovereign == this)) || (GetDispositionTowards(pSovereign) == dispFriend); }
inline bool IsNeutral(CSovereign *pSovereign) { return (m_bSelfRel || (pSovereign != this)) && (GetDispositionTowards(pSovereign) == dispNeutral); }
inline bool IsFriend (CSovereign *pSovereign) { return (GetDispositionTowards(pSovereign) == dispFriend); } //Self-checks are already optimized within the function
void MessageFromObj (CSpaceObject *pSender, const CString &sText);
void OnObjDestroyedByPlayer (CSpaceObject *pObj);
static Alignments ParseAlignment (const CString &sAlign);
Expand Down
44 changes: 37 additions & 7 deletions TSE/CSpaceObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4464,17 +4464,35 @@ CG32bitPixel CSpaceObject::GetSymbolColor (void)
// Returns the color to paint this object in the player's scanner

{

//Not sure where to put these
CG32bitPixel COLOR_WHITE = CG32bitPixel(255, 255, 255);
CG32bitPixel COLOR_GRAY = CG32bitPixel(200, 200, 200);
CG32bitPixel COLOR_CYAN = CG32bitPixel(50, 255, 255);
CG32bitPixel COLOR_GREEN = CG32bitPixel(0, 192, 0);
CG32bitPixel COLOR_RED = CG32bitPixel(255, 80, 80);
CG32bitPixel COLOR_ORANGE = CG32bitPixel(255, 150, 80);
CG32bitPixel COLOR_GREEN_YELLOW = CG32bitPixel(200, 255, 80);
CG32bitPixel COLOR_GREEN_LIGHT = CG32bitPixel(80, 255, 80);

CSpaceObject *pPlayerShip = g_pUniverse->GetPlayerShip();
CSovereign *pPlayer = g_pUniverse->GetPlayerSovereign();
if (GetSovereign() == pPlayer)
return CG32bitPixel(255, 255, 255);
if (pPlayerShip && this == pPlayerShip)
return COLOR_WHITE;
else if (GetSovereign() == pPlayer || IsEscorting(pPlayerShip) || IsPlayerWingman())
return COLOR_CYAN;
else if (IsWreck())
return CG32bitPixel(0, 192, 0);
return COLOR_GREEN;
else if (GetSovereign()->IsEnemy(pPlayer))
return CG32bitPixel(255, 80, 80);
else if (GetCategory() == CSpaceObject::catShip)
return CG32bitPixel(80, 255, 80);
return COLOR_RED;
else if (pPlayerShip && IsAngryAt(pPlayerShip))
return COLOR_ORANGE;
else if (GetSovereign()->IsNeutral(pPlayer))
return COLOR_GREEN_YELLOW;
else if (GetSovereign()->IsFriend(pPlayer))
return COLOR_GREEN_LIGHT;
else
return CG32bitPixel(0, 192, 0);
return COLOR_GREEN;
}

void CSpaceObject::GetVisibleEnemies (DWORD dwFlags, TArray<CSpaceObject *> *retList, CSpaceObject *pExcludeObj)
Expand Down Expand Up @@ -5053,7 +5071,19 @@ bool CSpaceObject::IsEscortingFriendOf (const CSpaceObject *pObj) const
else
return false;
}
bool CSpaceObject::IsEscorting(const CSpaceObject *pObj) const

// IsEscorting
//
// Returns TRUE if we're escorting pObj

{
CSpaceObject *pPrincipal = GetEscortPrincipal();
if (pPrincipal)
return pPrincipal == pObj;
else
return false;
}
bool CSpaceObject::IsPlayerAttackJustified (void) const

// IsPlayerAttackJustified
Expand Down