Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): hold the replay name across the version mismatch prompt

Olcay Seygan829f4e584bf0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 516a9de54..42d258d18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -429,6 +429,7 @@ found and fixed — EA's own, not port damage.**
- One tree in ten stood dead still in the breeze. The number that picks which way a tree sways was drawn from a range one short at the bottom, and the bottom of that range is the slot meaning "no sway at all".
- Police car lights flash at their own speed instead of your monitor's. On a fast screen with the frame cap off they were cycling five and a half times too quickly.
- Ten more places that wrote terrain, roads, bridges, trees, foundations and scorch marks into a buffer the graphics card had refused to hand over. Every one of them wrote to address zero instead, and a graphics device pulled out from under the game is all it takes; the frame is simply skipped now.
+- Confirming the "recorded by an older version" warning plays the replay you picked. The menu behind the warning stays live, so deleting a replay while it was up rebuilt the list, and the row number the warning had been opened on now belonged to something else - which is what you got, with nothing to tell you.
- The building outline and the target circle stay where they are when the cursor crosses the skyline. There is no ground above the horizon, and the game took the miss for an answer: the corner of the map. Every time the mouse went over the horizon the ghost you were placing shot across the world and back.
- The radar stops reading a hero who has just died. It kept the unit's own position rather than a copy of it, and only rebuilt that list every sixth frame, so the five frames after a hero fell were spent looking at a unit that was no longer there.
- A mission that asks to see more of the ground gets more of it. The script action for widening the drawn terrain was written when the game drew a square of map around the camera and pushed that square out; this one already draws the whole map, so the same arithmetic handed back a patch a few hundred feet across and the ground ended in mid air - in exactly the cutscenes that asked to see further.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp
index edb06ec81..1088b0803 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp
@@ -86,6 +86,12 @@ static Bool callDelete = FALSE;
void deleteReplayFlag( void ) { callDelete = TRUE;}
void copyReplayFlag( void ) { callCopy = TRUE;}
+// The replay the "this was recorded by an older version" prompt is asking about. Held from the
+// moment the prompt goes up, because the menu underneath stays live: delete a replay while it is
+// on screen and the list is rebuilt, so the row index the prompt was opened on now names a
+// different file, or none.
+static AsciiString thePendingReplayFilename;
+
UnicodeString GetReplayFilenameFromListbox(GameWindow *listbox, Int index)
{
UnicodeString fname = GadgetListBoxGetText(listbox, index);
@@ -423,20 +429,17 @@ WindowMsgHandledType ReplayMenuInput( GameWindow *window, UnsignedInt msg,
void reallyLoadReplay(void)
{
- UnicodeString filename;
- Int selected;
- GadgetListBoxGetSelected( listboxReplayFiles, &selected );
- if(selected < 0)
+ // The name was taken when the prompt went up, not now: the list behind it can have been
+ // rebuilt since, and re-reading the selected row would play whatever moved into it.
+ AsciiString asciiFilename = thePendingReplayFilename;
+ thePendingReplayFilename.clear();
+
+ if(asciiFilename.isEmpty())
{
MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), NULL);
return;
}
- filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected);
-
- AsciiString asciiFilename;
- asciiFilename.translate(filename);
-
TheRecorder->playbackFile(asciiFilename);
if(parentReplayMenu != NULL)
@@ -563,6 +566,7 @@ WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg,
if(TheRecorder->testVersionPlayback(asciiFilename))
{
+ thePendingReplayFilename = asciiFilename;
MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"),reallyLoadReplay ,NULL);
}
else