Skip to content

Commit 9eac3d3

Browse files
xezonhelmutbuhler
andauthored
[GEN][ZH] Improve Replay Menu to show names of missing maps in red color (#1022)
Co-authored-by: Helmut Buhler <buhler@8gadgetpack.net>
1 parent 1d8109f commit 9eac3d3

File tree

2 files changed

+60
-14
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

2 files changed

+60
-14
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,25 @@ void PopulateReplayFileListbox(GameWindow *listbox)
182182

183183
GadgetListBoxReset(listbox);
184184

185+
// TheSuperHackers @tweak xezon 08/06/2025 Now shows missing maps in red color.
185186
enum {
186187
COLOR_SP = 0,
187188
COLOR_SP_CRC_MISMATCH,
188189
COLOR_MP,
189190
COLOR_MP_CRC_MISMATCH,
191+
COLOR_MISSING_MAP,
192+
COLOR_MISSING_MAP_CRC_MISMATCH,
190193
COLOR_MAX
191194
};
192-
Color colors[COLOR_MAX] = {
195+
Color colors[] = {
193196
GameMakeColor( 255, 255, 255, 255 ),
194197
GameMakeColor( 128, 128, 128, 255 ),
195198
GameMakeColor( 255, 255, 255, 255 ),
196-
GameMakeColor( 128, 128, 128, 255 )
199+
GameMakeColor( 128, 128, 128, 255 ),
200+
GameMakeColor( 243, 24, 24, 255 ),
201+
GameMakeColor( 128, 32, 32, 255 )
197202
};
203+
static_assert(ARRAY_SIZE(colors) == COLOR_MAX, "Mismatch between colors array size and COLOR_MAX");
198204

199205
AsciiString asciistr;
200206
AsciiString asciisearch;
@@ -270,10 +276,18 @@ void PopulateReplayFileListbox(GameWindow *listbox)
270276

271277
// pick a color
272278
Color color;
273-
if (header.versionString == TheVersion->getUnicodeVersion() && header.versionNumber == TheVersion->getVersionNumber() &&
274-
header.exeCRC == TheGlobalData->m_exeCRC && header.iniCRC == TheGlobalData->m_iniCRC)
279+
Color mapColor;
280+
281+
const Bool hasMap = mapData != NULL;
282+
283+
const Bool isCrcCompatible =
284+
header.versionString == TheVersion->getUnicodeVersion()
285+
&& header.versionNumber == TheVersion->getVersionNumber()
286+
&& header.exeCRC == TheGlobalData->m_exeCRC
287+
&& header.iniCRC == TheGlobalData->m_iniCRC;
288+
289+
if (isCrcCompatible)
275290
{
276-
// good version
277291
if (header.localPlayerIndex >= 0)
278292
{
279293
// MP
@@ -284,10 +298,14 @@ void PopulateReplayFileListbox(GameWindow *listbox)
284298
// SP
285299
color = colors[COLOR_SP];
286300
}
301+
302+
if (hasMap)
303+
mapColor = color;
304+
else
305+
mapColor = colors[COLOR_MISSING_MAP];
287306
}
288307
else
289308
{
290-
// bad version
291309
if (header.localPlayerIndex >= 0)
292310
{
293311
// MP
@@ -298,12 +316,17 @@ void PopulateReplayFileListbox(GameWindow *listbox)
298316
// SP
299317
color = colors[COLOR_SP_CRC_MISMATCH];
300318
}
319+
320+
if (hasMap)
321+
mapColor = color;
322+
else
323+
mapColor = colors[COLOR_MISSING_MAP_CRC_MISMATCH];
301324
}
302325

303326
Int insertionIndex = GadgetListBoxAddEntryText(listbox, replayNameToShow, color, -1, 0);
304327
GadgetListBoxAddEntryText(listbox, displayTimeBuffer, color, insertionIndex, 1);
305328
GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 2);
306-
GadgetListBoxAddEntryText(listbox, mapStr, color, insertionIndex, 3);
329+
GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 3);
307330
//GadgetListBoxAddEntryText(listbox, extraStr, color, insertionIndex, 4);
308331
}
309332
}

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,25 @@ void PopulateReplayFileListbox(GameWindow *listbox)
182182

183183
GadgetListBoxReset(listbox);
184184

185+
// TheSuperHackers @tweak xezon 08/06/2025 Now shows missing maps in red color.
185186
enum {
186187
COLOR_SP = 0,
187188
COLOR_SP_CRC_MISMATCH,
188189
COLOR_MP,
189190
COLOR_MP_CRC_MISMATCH,
191+
COLOR_MISSING_MAP,
192+
COLOR_MISSING_MAP_CRC_MISMATCH,
190193
COLOR_MAX
191194
};
192-
Color colors[COLOR_MAX] = {
195+
Color colors[] = {
193196
GameMakeColor( 255, 255, 255, 255 ),
194197
GameMakeColor( 128, 128, 128, 255 ),
195198
GameMakeColor( 255, 255, 255, 255 ),
196-
GameMakeColor( 128, 128, 128, 255 )
199+
GameMakeColor( 128, 128, 128, 255 ),
200+
GameMakeColor( 243, 24, 24, 255 ),
201+
GameMakeColor( 128, 32, 32, 255 )
197202
};
203+
static_assert(ARRAY_SIZE(colors) == COLOR_MAX, "Mismatch between colors array size and COLOR_MAX");
198204

199205
AsciiString asciistr;
200206
AsciiString asciisearch;
@@ -270,10 +276,18 @@ void PopulateReplayFileListbox(GameWindow *listbox)
270276

271277
// pick a color
272278
Color color;
273-
if (header.versionString == TheVersion->getUnicodeVersion() && header.versionNumber == TheVersion->getVersionNumber() &&
274-
header.exeCRC == TheGlobalData->m_exeCRC && header.iniCRC == TheGlobalData->m_iniCRC)
279+
Color mapColor;
280+
281+
const Bool hasMap = mapData != NULL;
282+
283+
const Bool isCrcCompatible =
284+
header.versionString == TheVersion->getUnicodeVersion()
285+
&& header.versionNumber == TheVersion->getVersionNumber()
286+
&& header.exeCRC == TheGlobalData->m_exeCRC
287+
&& header.iniCRC == TheGlobalData->m_iniCRC;
288+
289+
if (isCrcCompatible)
275290
{
276-
// good version
277291
if (header.localPlayerIndex >= 0)
278292
{
279293
// MP
@@ -284,10 +298,14 @@ void PopulateReplayFileListbox(GameWindow *listbox)
284298
// SP
285299
color = colors[COLOR_SP];
286300
}
301+
302+
if (hasMap)
303+
mapColor = color;
304+
else
305+
mapColor = colors[COLOR_MISSING_MAP];
287306
}
288307
else
289308
{
290-
// bad version
291309
if (header.localPlayerIndex >= 0)
292310
{
293311
// MP
@@ -298,12 +316,17 @@ void PopulateReplayFileListbox(GameWindow *listbox)
298316
// SP
299317
color = colors[COLOR_SP_CRC_MISMATCH];
300318
}
319+
320+
if (hasMap)
321+
mapColor = color;
322+
else
323+
mapColor = colors[COLOR_MISSING_MAP_CRC_MISMATCH];
301324
}
302325

303326
Int insertionIndex = GadgetListBoxAddEntryText(listbox, replayNameToShow, color, -1, 0);
304327
GadgetListBoxAddEntryText(listbox, displayTimeBuffer, color, insertionIndex, 1);
305328
GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 2);
306-
GadgetListBoxAddEntryText(listbox, mapStr, color, insertionIndex, 3);
329+
GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 3);
307330
//GadgetListBoxAddEntryText(listbox, extraStr, color, insertionIndex, 4);
308331
}
309332
}

0 commit comments

Comments
 (0)