Skip to content

Commit 69a1f98

Browse files
committed
Update ColorScheme & MessageListClass
- Deprecate superfluous/potentially inaccurate hardcoded color scheme index enum and update PrintMessage to have non-hardcoded default color
1 parent 781e598 commit 69a1f98

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

ColorScheme.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@ class LightConvertClass;
1515
class ColorScheme
1616
{
1717
public:
18-
enum {
19-
//ColorScheme indices, since they are hardcoded all over the exe, why shan't we do it as well?
20-
Yellow = 3,
21-
White = 5,
22-
Grey = 7,
23-
Red = 11,
24-
Orange = 13,
25-
Pink = 15,
26-
Purple = 17,
27-
Blue = 21,
28-
Green = 29,
29-
};
30-
3118
//global array
3219
DEFINE_REFERENCE(DynamicVectorClass<ColorScheme*>, Array, 0xB054D0u)
3320
/*

MessageListClass.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,17 @@ class MessageListClass
8080

8181
// if pLabel is given, the message will be {$pLabel}:{$pMessage}
8282
// else it will be just {$pMessage}
83-
void PrintMessage(const wchar_t* pMessage, int durationFrames = 0x96, int nColorSchemeIndex = ColorScheme::White, bool bSilent = false)
84-
{ this->AddMessage(nullptr, 0, pMessage, nColorSchemeIndex, static_cast<TextPrintType>(0x4046), durationFrames, bSilent); }
83+
// nColorSchemeIndex = -1 will use LightGrey color scheme to print the message, or if it fails to find that color scheme index 0.
84+
void PrintMessage(const wchar_t* pMessage, int durationFrames = 0x96, int nColorSchemeIndex = -1, bool bSilent = false)
85+
{
86+
if (nColorSchemeIndex < 0 )
87+
nColorSchemeIndex = Math::max(ColorScheme::FindIndex("LightGrey", 53), 0);
8588

86-
void PrintMessage(const wchar_t* pMessage, double durationMinutes, int nColorSchemeIndex = ColorScheme::White, bool bSilent = false)
87-
{ this->AddMessage(nullptr, 0, pMessage, nColorSchemeIndex, static_cast<TextPrintType>(0x4046), static_cast<int>(durationMinutes * 900), bSilent); }
89+
this->AddMessage(nullptr, 0, pMessage, nColorSchemeIndex, static_cast<TextPrintType>(0x4046), durationFrames, bSilent);
90+
}
8891

92+
void PrintMessage(const wchar_t* pMessage, double durationMinutes, int nColorSchemeIndex = -1, bool bSilent = false)
93+
{ PrintMessage(pMessage, static_cast<int>(durationMinutes * 900), nColorSchemeIndex, bSilent); }
8994

9095
TextLabelClass* MessageList;
9196
Point2D MessagePos;

0 commit comments

Comments
 (0)