From 06db2479fca1071cfca38c92348b1aa15a737421 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Tue, 29 Aug 2017 12:23:12 -0700 Subject: [PATCH 1/3] Add unique LRS colors Playership - White Player Sovereign - Gray Player Wingman/Escort - Cyan Friend Ship - Light Green Friend Station/Wreck - Green Neutral - Yellow Green Angry - Orange Enemy - Red --- Include/TSE.h | 1 + Include/TSESovereign.h | 3 ++- TSE/CSpaceObject.cpp | 44 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Include/TSE.h b/Include/TSE.h index 0ace157..7b37864 100644 --- a/Include/TSE.h +++ b/Include/TSE.h @@ -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); } diff --git a/Include/TSESovereign.h b/Include/TSESovereign.h index 11948d1..24d702e 100644 --- a/Include/TSESovereign.h +++ b/Include/TSESovereign.h @@ -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); diff --git a/TSE/CSpaceObject.cpp b/TSE/CSpaceObject.cpp index 985fd7a..d3fcb93 100644 --- a/TSE/CSpaceObject.cpp +++ b/TSE/CSpaceObject.cpp @@ -4464,17 +4464,37 @@ 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, 200, 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) + return COLOR_GRAY; else if (IsWreck()) - return CG32bitPixel(0, 192, 0); + return COLOR_GREEN; else if (GetSovereign()->IsEnemy(pPlayer)) - return CG32bitPixel(255, 80, 80); + return COLOR_RED; + else if (pPlayerShip && IsAngryAt(pPlayerShip)) + return COLOR_ORANGE; + else if (GetSovereign()->IsNeutral(pPlayer)) + return COLOR_GREEN_YELLOW; + else if (pPlayerShip && IsEscortingFriendOf(pPlayerShip) || IsPlayerWingman()) + return COLOR_CYAN; else if (GetCategory() == CSpaceObject::catShip) - return CG32bitPixel(80, 255, 80); + return COLOR_GREEN_LIGHT; else - return CG32bitPixel(0, 192, 0); + return COLOR_GREEN; } void CSpaceObject::GetVisibleEnemies (DWORD dwFlags, TArray *retList, CSpaceObject *pExcludeObj) @@ -5053,7 +5073,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 From 83cf3b031a8b3d30b2e24ec1482f95eb5246a253 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Tue, 29 Aug 2017 19:52:06 -0700 Subject: [PATCH 2/3] Adjust LRS colors --- TSE/CSpaceObject.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TSE/CSpaceObject.cpp b/TSE/CSpaceObject.cpp index d3fcb93..8a2de38 100644 --- a/TSE/CSpaceObject.cpp +++ b/TSE/CSpaceObject.cpp @@ -4471,16 +4471,16 @@ CG32bitPixel CSpaceObject::GetSymbolColor (void) 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, 200, 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 (pPlayerShip && this == pPlayerShip) + if (pPlayerShip && (this == pPlayerShip || IsEscorting(pPlayerShip) || IsPlayerWingman())) return COLOR_WHITE; else if (GetSovereign() == pPlayer) - return COLOR_GRAY; + return COLOR_CYAN; else if (IsWreck()) return COLOR_GREEN; else if (GetSovereign()->IsEnemy(pPlayer)) @@ -4489,9 +4489,7 @@ CG32bitPixel CSpaceObject::GetSymbolColor (void) return COLOR_ORANGE; else if (GetSovereign()->IsNeutral(pPlayer)) return COLOR_GREEN_YELLOW; - else if (pPlayerShip && IsEscortingFriendOf(pPlayerShip) || IsPlayerWingman()) - return COLOR_CYAN; - else if (GetCategory() == CSpaceObject::catShip) + else if (GetSovereign()->IsFriend(pPlayer)) return COLOR_GREEN_LIGHT; else return COLOR_GREEN; From 6d56a2981deb5ea5b61981e2d473438605d29347 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Tue, 29 Aug 2017 22:57:20 -0700 Subject: [PATCH 3/3] Player-sovereign objects, escorts, and wingmen are cyan --- TSE/CSpaceObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TSE/CSpaceObject.cpp b/TSE/CSpaceObject.cpp index 8a2de38..c4a427c 100644 --- a/TSE/CSpaceObject.cpp +++ b/TSE/CSpaceObject.cpp @@ -4477,9 +4477,9 @@ CG32bitPixel CSpaceObject::GetSymbolColor (void) CSpaceObject *pPlayerShip = g_pUniverse->GetPlayerShip(); CSovereign *pPlayer = g_pUniverse->GetPlayerSovereign(); - if (pPlayerShip && (this == pPlayerShip || IsEscorting(pPlayerShip) || IsPlayerWingman())) + if (pPlayerShip && this == pPlayerShip) return COLOR_WHITE; - else if (GetSovereign() == pPlayer) + else if (GetSovereign() == pPlayer || IsEscorting(pPlayerShip) || IsPlayerWingman()) return COLOR_CYAN; else if (IsWreck()) return COLOR_GREEN;