Skip to content

Commit

Permalink
Close OpenRCT2#19596: Disable replay effects with a startup flag (Ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
fidwell authored Jul 25, 2024
1 parent 30a555d commit df07d9c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions distribution/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.4.13 (in development)
------------------------------------------------------------------------
- Feature: [#19596] Allow for playing back a replay without camera movement or alert box.
- Feature: [#20831] The ride selection window now shows object authors if debugging tools are active.
- Feature: [#20832] The ride music tab now shows a track listing for the current music style.
- Feature: [#22172] [Plugin] Expose ride satisfaction ratings to the plugin API.
Expand Down
2 changes: 2 additions & 0 deletions src/openrct2/OpenRCT2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ uint32_t gCurrentDrawCount = 0;
uint8_t gScreenFlags;
uint32_t gScreenAge;
PromptMode gSavePromptMode;

bool gSilentReplays = false;
1 change: 1 addition & 0 deletions src/openrct2/OpenRCT2.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern bool gOpenRCT2NoGraphics;
extern bool gOpenRCT2ShowChangelog;
extern bool gOpenRCT2SilentBreakpad;
extern u8string gSilentRecordingName;
extern bool gSilentReplays;

#ifndef DISABLE_NETWORK
extern int32_t gNetworkStart;
Expand Down
7 changes: 5 additions & 2 deletions src/openrct2/ReplayManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ namespace OpenRCT2
#ifndef DISABLE_NETWORK
// If the network is disabled we will only get a dummy hash which will cause
// false positives during replay.
CheckState();
if (!gSilentReplays)
{
CheckState();
}
#endif
ReplayCommands();

Expand Down Expand Up @@ -870,7 +873,7 @@ namespace OpenRCT2
}

// Focus camera on event.
if (isPositionValid && !result.Position.IsNull())
if (!gSilentReplays && isPositionValid && !result.Position.IsNull())
{
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
Expand Down
7 changes: 7 additions & 0 deletions src/openrct2/command_line/RootCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static bool _all = false;
static bool _about = false;
static bool _verbose = false;
static bool _headless = false;
static bool _silentReplays = false;
static u8string _password = {};
static u8string _userDataPath = {};
static u8string _openrct2DataPath = {};
Expand All @@ -73,6 +74,7 @@ static constexpr CommandLineOptionDefinition StandardOptions[]
{ CMDLINE_TYPE_SWITCH, &_about, NAC, "about", "show information about " OPENRCT2_NAME },
{ CMDLINE_TYPE_SWITCH, &_verbose, NAC, "verbose", "log verbose messages" },
{ CMDLINE_TYPE_SWITCH, &_headless, NAC, "headless", "run " OPENRCT2_NAME " headless" IMPLIES_SILENT_BREAKPAD },
{ CMDLINE_TYPE_SWITCH, &_silentReplays, NAC, "silent-replays", "use unobtrusive replays" },
#ifndef DISABLE_NETWORK
{ CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" },
{ CMDLINE_TYPE_STRING, &_address, NAC, "address", "address to listen on when hosting a server" },
Expand Down Expand Up @@ -224,6 +226,11 @@ exitcode_t CommandLine::HandleCommandDefault()
gCustomPassword = _password;
}

if (_silentReplays)
{
gSilentReplays = _silentReplays;
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/paint/Painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Painter::Paint(IDrawingEngine& de)
auto* replayManager = GetContext()->GetReplayManager();
const char* text = nullptr;

if (replayManager->IsReplaying())
if (replayManager->IsReplaying() && !gSilentReplays)
text = "Replaying...";
else if (replayManager->ShouldDisplayNotice())
text = "Recording...";
Expand Down

0 comments on commit df07d9c

Please sign in to comment.