mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 01:04:50 +01:00
Scale lightning and thunder inversely proportional to game speed (#23803)
* Disable lightning flashes at higher speeds * Scale lightning/thunder inversely proportional to game speed * Change gGameSpéed from uint32 to uint8 * Update changelog.txt * Increment network version
This commit is contained in:
@@ -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)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
class GameSetSpeedAction final : public GameActionBase<GameCommand::SetGameSpeed>
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user