diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ad09f09787..396100c8c8 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.22 (in development) ------------------------------------------------------------------------ +- Change: [#23803] Lightning strikes and thunder happen at the same frequency independently of the game speed. 0.4.21 (2025-04-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 3799c3fc8a..5903d89d99 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -80,7 +80,7 @@ using namespace OpenRCT2; uint16_t gCurrentDeltaTime; uint8_t gGamePaused = 0; -int32_t gGameSpeed = 1; +uint8_t gGameSpeed = 1; bool gDoSingleUpdate = false; float gDayNightCycle = 0; bool gInUpdateCode = false; diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index e83ddfbd53..5c44fee7c3 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -141,7 +141,7 @@ extern uint32_t gCurrentRealTimeTicks; extern uint16_t gCurrentDeltaTime; extern uint8_t gGamePaused; -extern int32_t gGameSpeed; +extern uint8_t gGameSpeed; extern bool gDoSingleUpdate; extern float gDayNightCycle; extern bool gInUpdateCode; diff --git a/src/openrct2/actions/GameSetSpeedAction.cpp b/src/openrct2/actions/GameSetSpeedAction.cpp index abf729a7fd..2a88487b03 100644 --- a/src/openrct2/actions/GameSetSpeedAction.cpp +++ b/src/openrct2/actions/GameSetSpeedAction.cpp @@ -15,7 +15,7 @@ using namespace OpenRCT2; -GameSetSpeedAction::GameSetSpeedAction(int32_t speed) +GameSetSpeedAction::GameSetSpeedAction(uint8_t speed) : _speed(speed) { } @@ -70,7 +70,7 @@ GameActions::Result GameSetSpeedAction::Execute() const return res; } -bool GameSetSpeedAction::IsValidSpeed(int32_t speed) const +bool GameSetSpeedAction::IsValidSpeed(uint8_t speed) const { return (speed >= 1 && speed <= 4) || (Config::Get().general.DebuggingTools && speed == 8); } diff --git a/src/openrct2/actions/GameSetSpeedAction.h b/src/openrct2/actions/GameSetSpeedAction.h index 132b4c7718..25e5d1fd98 100644 --- a/src/openrct2/actions/GameSetSpeedAction.h +++ b/src/openrct2/actions/GameSetSpeedAction.h @@ -14,11 +14,11 @@ class GameSetSpeedAction final : public GameActionBase { private: - int32_t _speed{ 1 }; + uint8_t _speed{ 1 }; public: GameSetSpeedAction() = default; - GameSetSpeedAction(int32_t speed); + GameSetSpeedAction(uint8_t speed); void AcceptParameters(GameActionParameterVisitor& visitor) override; @@ -29,5 +29,5 @@ public: OpenRCT2::GameActions::Result Execute() const override; private: - bool IsValidSpeed(int32_t speed) const; + bool IsValidSpeed(uint8_t speed) const; }; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 86bb4d857d..e84d02386b 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -49,7 +49,7 @@ using namespace OpenRCT2; // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kNetworkStreamVersion = 0; +constexpr uint8_t kNetworkStreamVersion = 1; const std::string kNetworkStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kNetworkStreamVersion); diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index b4acceeede..c11e048655 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -208,9 +208,9 @@ void ClimateUpdate() gameState.weatherCurrent.weatherEffect == WeatherEffectType::Storm || gameState.weatherCurrent.weatherEffect == WeatherEffectType::Blizzard) { - // Create new thunder and lightning - uint32_t randomNumber = UtilRand(); - if ((randomNumber & 0xFFFF) <= 0x1B4) + // Create new thunder and lightning. Their amount is scaled inversely proportional + // to the game speed, otherwise they become annoying at very high speeds + if (uint32_t randomNumber = UtilRand(); (randomNumber & 0xFFFF) <= (0x1B4u >> gGameSpeed)) { randomNumber >>= 16; _thunderTimer = 43 + (randomNumber % 64);