From ce5bb68880443ad6bbbc0569181c81582fea69c8 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Mon, 28 Aug 2017 23:17:21 -0700 Subject: [PATCH 1/4] Add more Display Attribute colors Enhancement (foreign positive effects, REPLACES Enhancement) - Green Degradation (foreign negative effects, REPLACES Weakness) - Orange Controlled (May be legally possessed for certain reasons) - Violet Banned (May not be legally possessed for ANY reason - Black Magenta (Custom/Placeholder) - Magenta Brown (Custom/Placeholder) - Brown --- Include/TSEItemDefs.h | 13 ++++++---- Include/TSUI.h | 33 ++++++++++++++++++------- TSE/CDisplayAttributeDefinitions.cpp | 36 +++++++++++++++++++++++++--- TSE/CItem.cpp | 8 +++---- TSUI/CArmorHUDImages.cpp | 2 +- TSUI/CUIHelper.cpp | 31 ++++++++++++++++++++---- TSUI/CVisualPalette.cpp | 15 ++++++++++++ 7 files changed, 112 insertions(+), 26 deletions(-) diff --git a/Include/TSEItemDefs.h b/Include/TSEItemDefs.h index 0d7f4f6..2d30dae 100644 --- a/Include/TSEItemDefs.h +++ b/Include/TSEItemDefs.h @@ -81,7 +81,13 @@ enum EDisplayAttributeTypes attribNegative, attribEnhancement, - attribWeakness, + attribDegradation, + + attribControlled, + attribBanned, + + attribCustomMagenta, + attribCustomBrown, }; enum EAttributeTypes @@ -109,9 +115,8 @@ struct SDisplayAttribute if (*sText.GetASCIIZPointer() != '+') sText = strPatternSubst(CONSTLIT("+%s"), sText); break; - case attribNegative: - iType = attribWeakness; + iType = attribDegradation; if (*sText.GetASCIIZPointer() != '-') sText = strPatternSubst(CONSTLIT("-%s"), sText); break; @@ -123,7 +128,7 @@ struct SDisplayAttribute { int i; for (i = 0; i < List.GetCount(); i++) - if (List[i].iType == attribEnhancement || List[i].iType == attribWeakness) + if (List[i].iType == attribEnhancement || List[i].iType == attribDegradation) return true; return false; diff --git a/Include/TSUI.h b/Include/TSUI.h index 92f1d78..558d4dd 100644 --- a/Include/TSUI.h +++ b/Include/TSUI.h @@ -398,15 +398,30 @@ enum EColorPalette colorAreaAdvantage = 29, // H:210 S:100 B:65 colorAreaDisadvantage = 30, // H:0 S:80 B:65 - colorAreaShields = 31, // H:90 S:80 B:45 - colorTextAdvantage = 32, // H:210 S:20 B:100 - colorTextDisadvantage = 33, // H:0 S:20 B:100 - colorTextShields = 34, // H:90 S:20 B:100 - colorTextAccelerator = 35, // H:60 S:100 B:100 - colorAreaAccelerator = 36, // H:60 S:100 B:80 - colorTextQuote = 37, // H:210 S:30 B:100 - - colorCount = 38, + colorAreaEnhancement = 31, // H:120 S:80 B:65 + colorAreaDegradation = 32, // H:30 S:80 B:65 + colorAreaControlled = 33, // H:280 S:80 B:65 + colorAreaBanned = 34, // H:0 S:0 B:0 + colorAreaCustomMagenta= 35, // H:310 S:80 B:65 + colorAreaCustomBrown= 36, // H:32 S:80 B:32 + + colorAreaShields = 37, // H:90 S:80 B:45 + + colorTextAdvantage = 38, // H:210 S:20 B:100 + colorTextDisadvantage = 39, // H:0 S:20 B:100 + colorTextEnhancement = 40, // H:120 S:20 B:100 + colorTextDegradation = 41, // H:30 S:20 B:100 + colorTextControlled = 42, // H:280 S:20 B:100 + colorTextBanned = 43, // H:0 S:0 B:100 + colorTextCustomMagenta = 44, // H:310 S:20 B:100 + colorTextCustomBrown = 45, // H:32 S:20 B:100 + + colorTextShields = 46, // H:90 S:20 B:100 + colorTextAccelerator = 47, // H:60 S:100 B:100 + colorAreaAccelerator = 48, // H:60 S:100 B:80 + colorTextQuote = 49, // H:210 S:30 B:100 + + colorCount = 50, }; enum EFontScale diff --git a/TSE/CDisplayAttributeDefinitions.cpp b/TSE/CDisplayAttributeDefinitions.cpp index 04dcda7..ee79721 100644 --- a/TSE/CDisplayAttributeDefinitions.cpp +++ b/TSE/CDisplayAttributeDefinitions.cpp @@ -17,6 +17,12 @@ #define TYPE_POSITIVE CONSTLIT("advantage") #define TYPE_NEGATIVE CONSTLIT("disadvantage") #define TYPE_NEUTRAL CONSTLIT("neutral") +#define TYPE_ENHANCEMENT CONSTLIT("enhancement") //Allowed for flexibility +#define TYPE_DEGRADATION CONSTLIT("degradation") //Allowed for flexibility +#define TYPE_CONTROLLED CONSTLIT("controlled") +#define TYPE_BANNED CONSTLIT("banned") +#define TYPE_CUSTOM_MAGENTA CONSTLIT("customMagenta") +#define TYPE_CUSTOM_BROWN CONSTLIT("customBrown") const int DEFAULT_LOCATION_FREQUENCY = 20; @@ -103,6 +109,18 @@ bool CDisplayAttributeDefinitions::InitFromCCItem (ICCItem *pEntry, SDisplayAttr iType = attribPositive; else if (strEquals(sType, TYPE_NEGATIVE)) iType = attribNegative; + else if (strEquals(sType, TYPE_ENHANCEMENT)) + iType = attribEnhancement; + else if (strEquals(sType, TYPE_DEGRADATION)) + iType = attribDegradation; + else if (strEquals(sType, TYPE_CONTROLLED)) + iType = attribControlled; + else if (strEquals(sType, TYPE_BANNED)) + iType = attribBanned; + else if (strEquals(sType, TYPE_CUSTOM_MAGENTA)) + iType = attribCustomMagenta; + else if (strEquals(sType, TYPE_CUSTOM_BROWN)) + iType = attribCustomBrown; else return false; } @@ -154,12 +172,24 @@ ALERROR CDisplayAttributeDefinitions::InitFromXML (SDesignLoadCtx &Ctx, CXMLElem CString sType; if (pDef->FindAttribute(LABEL_TYPE_ATTRIB, &sType)) { - if (strEquals(sType, TYPE_POSITIVE)) + if (strEquals(sType, TYPE_NEUTRAL)) + pEntry->iType = attribNeutral; + else if (strEquals(sType, TYPE_POSITIVE)) pEntry->iType = attribPositive; else if (strEquals(sType, TYPE_NEGATIVE)) pEntry->iType = attribNegative; - else if (strEquals(sType, TYPE_NEUTRAL)) - pEntry->iType = attribNeutral; + else if (strEquals(sType, TYPE_ENHANCEMENT)) + pEntry->iType = attribEnhancement; + else if (strEquals(sType, TYPE_DEGRADATION)) + pEntry->iType = attribDegradation; + else if (strEquals(sType, TYPE_CONTROLLED)) + pEntry->iType = attribControlled; + else if (strEquals(sType, TYPE_BANNED)) + pEntry->iType = attribBanned; + else if (strEquals(sType, TYPE_CUSTOM_MAGENTA)) + pEntry->iType = attribCustomMagenta; + else if (strEquals(sType, TYPE_CUSTOM_BROWN)) + pEntry->iType = attribCustomBrown; else { Ctx.sError = strPatternSubst(CONSTLIT("Invalid label type: %s."), sType); diff --git a/TSE/CItem.cpp b/TSE/CItem.cpp index 9af68ba..268165b 100644 --- a/TSE/CItem.cpp +++ b/TSE/CItem.cpp @@ -811,10 +811,10 @@ bool CItem::GetDisplayAttributes (CItemCtx &Ctx, TArray *retL // Military and Illegal attributes if (m_pItemType->HasLiteralAttribute(CONSTLIT("Military"))) - retList->Insert(SDisplayAttribute(attribPositive, CONSTLIT("military"))); + retList->Insert(SDisplayAttribute(attribControlled, CONSTLIT("military"))); if (m_pItemType->HasLiteralAttribute(CONSTLIT("Illegal"))) - retList->Insert(SDisplayAttribute(attribNegative, CONSTLIT("illegal"))); + retList->Insert(SDisplayAttribute(attribBanned, CONSTLIT("illegal"))); // Add any enhancements @@ -830,10 +830,10 @@ bool CItem::GetDisplayAttributes (CItemCtx &Ctx, TArray *retL // type is unknown). if (IsDamaged()) - retList->Insert(SDisplayAttribute(attribNegative, CONSTLIT("damaged"))); + retList->Insert(SDisplayAttribute(attribDegradation, CONSTLIT("damaged"))); if (IsDisrupted()) - retList->Insert(SDisplayAttribute(attribNegative, CONSTLIT("ionized"))); + retList->Insert(SDisplayAttribute(attribDegradation, CONSTLIT("ionized"))); // Done diff --git a/TSUI/CArmorHUDImages.cpp b/TSUI/CArmorHUDImages.cpp index 8609ceb..2620fa7 100644 --- a/TSUI/CArmorHUDImages.cpp +++ b/TSUI/CArmorHUDImages.cpp @@ -386,7 +386,7 @@ void CArmorHUDImages::Realize (SHUDPaintCtx &Ctx) if (ItemCtx.GetEnhancementDisplayAttributes(&Attribs)) { const CString &sMods = Attribs[0].sText; - bool bDisadvantage = (Attribs[0].iType == attribWeakness); + bool bDisadvantage = (Attribs[0].iType == attribDegradation); int cx = SmallFont.MeasureText(sMods); m_Buffer.Fill(ARMOR_ENHANCE_X - cx - 4, diff --git a/TSUI/CUIHelper.cpp b/TSUI/CUIHelper.cpp index aff98d1..947dc82 100644 --- a/TSUI/CUIHelper.cpp +++ b/TSUI/CUIHelper.cpp @@ -164,7 +164,7 @@ int CUIHelper::CalcItemEntryHeight (CSpaceObject *pSource, const CItem &Item, co // Reference - CString sReference = Item.GetReference(Ctx); + CString sReference = pType->GetReference(Ctx); // If this is a weapon, then add room for the weapon damage @@ -929,17 +929,38 @@ void CUIHelper::PaintDisplayAttributes (CG32bitImage &Dest, TArrayGetApparentLevel(Ctx); - CString sReference = Item.GetReference(Ctx); + CString sReference = pItemType->GetReference(Ctx); DamageTypes iDamageType; CString sDamageRef; int iDamageAdj[damageCount]; diff --git a/TSUI/CVisualPalette.cpp b/TSUI/CVisualPalette.cpp index f237ddf..d666aac 100644 --- a/TSUI/CVisualPalette.cpp +++ b/TSUI/CVisualPalette.cpp @@ -58,12 +58,27 @@ static SColorInitTable COLOR_TABLE[] = { "TextDockText", CG32bitPixel(0xAF, 0xB7, 0xBF) }, // H:210 S:8 B:75 { "TextDockTitle", CG32bitPixel(0xE7, 0xF3, 0xFF) }, // H:210 S:9 B:100 { "TextDockTextWarning", CG32bitPixel(0xFF, 0x33, 0x33) }, // H:0 S:80 B:100 + { "AreaAdvantage", CG32bitPixel(0x00, 0x53, 0xA6) }, { "AreaDisadvantage", CG32bitPixel(0xA6, 0x21, 0x21) }, + { "AreaEnhancement", CG32bitPixel(0x21, 0xA6, 0x21) }, + { "AreaDegradation", CG32bitPixel(0xA6, 0x63, 0x21) }, + { "AreaControlled", CG32bitPixel(0x7A, 0x21, 0xA6) }, + { "AreaBanned", CG32bitPixel(0x00, 0x00, 0x00) }, + { "AreaCustomMagenta", CG32bitPixel(0xA6, 0x21, 0x90) }, + { "AreaCustomBrown", CG32bitPixel(0x52, 0x33, 0x10) }, { "AreaShields", CG32bitPixel(0x45, 0x73, 0x17) }, + { "TextAdvantage", CG32bitPixel(0xCC, 0xE5, 0xFF) }, { "TextDisadvantage", CG32bitPixel(0xFF, 0xCC, 0xCC) }, + { "TextEnhancement", CG32bitPixel(0xCC, 0xFF, 0xCC) }, + { "TextDegradation", CG32bitPixel(0xFF, 0xE6, 0xCC) }, + { "TextControlled", CG32bitPixel(0xEE, 0xCC, 0xFF) }, + { "TextBanned", CG32bitPixel(0xFF, 0xFF, 0xFF) }, + { "TextCustomMagenta", CG32bitPixel(0xFF, 0xCC, 0xF6) }, + { "TextCustomBrown", CG32bitPixel(0xFF, 0xE7, 0xCC) }, + { "TextShields", CG32bitPixel(0xE5, 0xFF, 0xCC) }, { "TextAccelerator", CG32bitPixel(0xFF, 0xFF, 0x00) }, // H:60 S:100 B:100 From 63e54c9e63f057269e7c23a9816acfa56d22de66 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Mon, 28 Aug 2017 23:59:13 -0700 Subject: [PATCH 2/4] Fix enhancement/degradation tag colors on HUD and Dockscreens --- TSUI/CArmorHUDImages.cpp | 4 ++-- TSUI/CShieldHUDDefault.cpp | 4 ++-- TSUI/CWeaponHUDDefault.cpp | 4 ++-- TSUI/IHUDPainter.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TSUI/CArmorHUDImages.cpp b/TSUI/CArmorHUDImages.cpp index 2620fa7..98d6c13 100644 --- a/TSUI/CArmorHUDImages.cpp +++ b/TSUI/CArmorHUDImages.cpp @@ -393,12 +393,12 @@ void CArmorHUDImages::Realize (SHUDPaintCtx &Ctx) pImage->yName + MediumFont.GetHeight() - HP_DISPLAY_HEIGHT, cx + 8, HP_DISPLAY_HEIGHT, - (bDisadvantage ? VI.GetColor(colorAreaDisadvantage) : VI.GetColor(colorAreaAdvantage))); + (bDisadvantage ? VI.GetColor(colorAreaDegradation) : VI.GetColor(colorAreaEnhancement))); SmallFont.DrawText(m_Buffer, ARMOR_ENHANCE_X - cx, pImage->yName + 3, - (bDisadvantage ? VI.GetColor(colorTextDisadvantage) : VI.GetColor(colorTextAdvantage)), + (bDisadvantage ? VI.GetColor(colorTextDegradation) : VI.GetColor(colorTextEnhancement)), sMods); } } diff --git a/TSUI/CShieldHUDDefault.cpp b/TSUI/CShieldHUDDefault.cpp index e89933a..cfb7a7f 100644 --- a/TSUI/CShieldHUDDefault.cpp +++ b/TSUI/CShieldHUDDefault.cpp @@ -251,12 +251,12 @@ void CShieldHUDDefault::OnPaint (CG32bitImage &Dest, int x, int y, SHUDPaintCtx y + SHIELD_HP_DISPLAY_Y, cx + 8, SHIELD_HP_DISPLAY_HEIGHT, - (bDisadvantage ? VI.GetColor(colorAreaDisadvantage) : VI.GetColor(colorAreaAdvantage))); + (bDisadvantage ? VI.GetColor(colorAreaDegradation) : VI.GetColor(colorAreaEnhancement))); SmallFont.DrawText(Dest, x + SHIELD_HP_DISPLAY_X - cx - 4, y + SHIELD_HP_DISPLAY_Y + (SHIELD_HP_DISPLAY_HEIGHT - SmallFont.GetHeight()) / 2, - (bDisadvantage ? VI.GetColor(colorTextDisadvantage) : VI.GetColor(colorTextAdvantage)), + (bDisadvantage ? VI.GetColor(colorTextDegradation) : VI.GetColor(colorTextEnhancement)), sMods); } } diff --git a/TSUI/CWeaponHUDDefault.cpp b/TSUI/CWeaponHUDDefault.cpp index a83023f..b2bb952 100644 --- a/TSUI/CWeaponHUDDefault.cpp +++ b/TSUI/CWeaponHUDDefault.cpp @@ -168,14 +168,14 @@ void CWeaponHUDDefault::PaintDeviceStatus (CShip *pShip, DeviceNames iDev, int x rcRect.top + 1, cxBonus + 4, cyHeight - 2, - (bDisadvantage ? VI.GetColor(colorAreaDisadvantage) : VI.GetColor(colorAreaAdvantage))); + (bDisadvantage ? VI.GetColor(colorAreaDegradation) : VI.GetColor(colorAreaEnhancement))); // Bonus text SmallFont.DrawText(m_Buffer, rcRect.left, rcRect.top, - (bDisadvantage ? VI.GetColor(colorTextDisadvantage) : VI.GetColor(colorTextAdvantage)), + (bDisadvantage ? VI.GetColor(colorTextDegradation) : VI.GetColor(colorTextEnhancement)), sBonus); cxBonus += 4; diff --git a/TSUI/IHUDPainter.cpp b/TSUI/IHUDPainter.cpp index e6137ee..b128244 100644 --- a/TSUI/IHUDPainter.cpp +++ b/TSUI/IHUDPainter.cpp @@ -159,12 +159,12 @@ void IHUDPainter::DrawModifier (CG32bitImage &Dest, int x, int y, const CString yBox, cxBox, cyBox, - (bDisadvantage ? VI.GetColor(colorAreaDisadvantage) : VI.GetColor(colorAreaAdvantage))); + (bDisadvantage ? VI.GetColor(colorAreaDegradation) : VI.GetColor(colorAreaEnhancement))); SmallFont.DrawText(Dest, xBox + (cxBox - cx) / 2, yBox, - (bDisadvantage ? VI.GetColor(colorTextDisadvantage) : VI.GetColor(colorTextAdvantage)), + (bDisadvantage ? VI.GetColor(colorTextDegradation) : VI.GetColor(colorTextEnhancement)), sText); } } From 242ca46c46ed195be23ecbc4568d5409b2e5102b Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Tue, 29 Aug 2017 12:59:11 -0700 Subject: [PATCH 3/4] Switch disadvantage and degradation tag colors --- TSUI/CVisualPalette.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TSUI/CVisualPalette.cpp b/TSUI/CVisualPalette.cpp index d666aac..ec8f657 100644 --- a/TSUI/CVisualPalette.cpp +++ b/TSUI/CVisualPalette.cpp @@ -60,9 +60,9 @@ static SColorInitTable COLOR_TABLE[] = { "TextDockTextWarning", CG32bitPixel(0xFF, 0x33, 0x33) }, // H:0 S:80 B:100 { "AreaAdvantage", CG32bitPixel(0x00, 0x53, 0xA6) }, - { "AreaDisadvantage", CG32bitPixel(0xA6, 0x21, 0x21) }, + { "AreaDisadvantage", CG32bitPixel(0xA6, 0x63, 0x21) }, { "AreaEnhancement", CG32bitPixel(0x21, 0xA6, 0x21) }, - { "AreaDegradation", CG32bitPixel(0xA6, 0x63, 0x21) }, + { "AreaDegradation", CG32bitPixel(0xA6, 0x21, 0x21) }, { "AreaControlled", CG32bitPixel(0x7A, 0x21, 0xA6) }, { "AreaBanned", CG32bitPixel(0x00, 0x00, 0x00) }, { "AreaCustomMagenta", CG32bitPixel(0xA6, 0x21, 0x90) }, @@ -71,9 +71,9 @@ static SColorInitTable COLOR_TABLE[] = { "AreaShields", CG32bitPixel(0x45, 0x73, 0x17) }, { "TextAdvantage", CG32bitPixel(0xCC, 0xE5, 0xFF) }, - { "TextDisadvantage", CG32bitPixel(0xFF, 0xCC, 0xCC) }, + { "TextDisadvantage", CG32bitPixel(0xFF, 0xE6, 0xCC) }, { "TextEnhancement", CG32bitPixel(0xCC, 0xFF, 0xCC) }, - { "TextDegradation", CG32bitPixel(0xFF, 0xE6, 0xCC) }, + { "TextDegradation", CG32bitPixel(0xFF, 0xCC, 0xCC) }, { "TextControlled", CG32bitPixel(0xEE, 0xCC, 0xFF) }, { "TextBanned", CG32bitPixel(0xFF, 0xFF, 0xFF) }, { "TextCustomMagenta", CG32bitPixel(0xFF, 0xCC, 0xF6) }, From 25ef862f0e5eeb23476721c316ba7afcd537f7d4 Mon Sep 17 00:00:00 2001 From: INeedAUniqueUsername Date: Tue, 29 Aug 2017 13:18:16 -0700 Subject: [PATCH 4/4] Swich tag comments for disadvantage and degradation --- Include/TSUI.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Include/TSUI.h b/Include/TSUI.h index 558d4dd..7eef19f 100644 --- a/Include/TSUI.h +++ b/Include/TSUI.h @@ -397,9 +397,9 @@ enum EColorPalette colorTextDockWarning = 28, // H:0 S:80 B:100 colorAreaAdvantage = 29, // H:210 S:100 B:65 - colorAreaDisadvantage = 30, // H:0 S:80 B:65 + colorAreaDisadvantage = 30, // H:30 S:80 B:65 colorAreaEnhancement = 31, // H:120 S:80 B:65 - colorAreaDegradation = 32, // H:30 S:80 B:65 + colorAreaDegradation = 32, // H:0 S:80 B:65 colorAreaControlled = 33, // H:280 S:80 B:65 colorAreaBanned = 34, // H:0 S:0 B:0 colorAreaCustomMagenta= 35, // H:310 S:80 B:65 @@ -408,9 +408,9 @@ enum EColorPalette colorAreaShields = 37, // H:90 S:80 B:45 colorTextAdvantage = 38, // H:210 S:20 B:100 - colorTextDisadvantage = 39, // H:0 S:20 B:100 + colorTextDisadvantage = 39, // H:30 S:20 B:100 colorTextEnhancement = 40, // H:120 S:20 B:100 - colorTextDegradation = 41, // H:30 S:20 B:100 + colorTextDegradation = 41, // H:0 S:20 B:100 colorTextControlled = 42, // H:280 S:20 B:100 colorTextBanned = 43, // H:0 S:0 B:100 colorTextCustomMagenta = 44, // H:310 S:20 B:100