Add enums for weather effect and rain level

This commit is contained in:
Ted John authored and Richard Jenkins committed 2018-01-14 01:06:47 +00:00
1 parent 68202db51c
commit 742690b4f4
6 files changed
+33 -18

No files matched your search

+1 -1
View File
@@ -176,7 +176,7 @@ void DrawRain(rct_drawpixelinfo * dpi, IRainDrawer * rainDrawer)
{
// Get rain draw function and draw rain
uint32 rainType = gClimateCurrent.RainLevel;
if (rainType > 0 && !gTrackDesignSaveMode)
if (rainType != RAIN_LEVEL_NONE && !gTrackDesignSaveMode)
{
DrawRainAnimation(dpi, rainDrawer, rainType);
}
+5 -5
View File
@@ -1899,7 +1899,7 @@ void peep_update_sprite_type(rct_peep * peep)
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY;
}
if (gClimateCurrent.RainLevel != 0 && (peep->item_standard_flags & PEEP_ITEM_UMBRELLA) && peep->x != LOCATION_NULL)
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE && (peep->item_standard_flags & PEEP_ITEM_UMBRELLA) && peep->x != LOCATION_NULL)
{
sint32 x = peep->x & 0xFFE0;
sint32 y = peep->y & 0xFFE0;
@@ -12152,7 +12152,7 @@ static bool peep_decide_and_buy_item(rct_peep * peep, sint32 rideIndex, sint32 s
if ((shopItem == SHOP_ITEM_BALLOON) || (shopItem == SHOP_ITEM_ICE_CREAM) || (shopItem == SHOP_ITEM_CANDYFLOSS) ||
(shopItem == SHOP_ITEM_SUNGLASSES))
{
if (gClimateCurrent.RainLevel != 0)
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE)
return false;
}
@@ -12174,7 +12174,7 @@ static bool peep_decide_and_buy_item(rct_peep * peep, sint32 rideIndex, sint32 s
return false;
}
if ((shopItem == SHOP_ITEM_UMBRELLA) && (gClimateCurrent.RainLevel != 0))
if ((shopItem == SHOP_ITEM_UMBRELLA) && (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE))
goto loc_69B119;
if ((shopItem != SHOP_ITEM_MAP) && shop_item_is_souvenir(shopItem) && !has_voucher)
@@ -12214,7 +12214,7 @@ loc_69B119:
value -= price;
if (shopItem == SHOP_ITEM_UMBRELLA)
{
if (gClimateCurrent.RainLevel != 0)
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE)
goto loc_69B221;
}
@@ -13199,7 +13199,7 @@ static bool peep_should_go_on_ride(rct_peep * peep, sint32 rideIndex, sint32 ent
// Peeps won't go on rides that aren't sufficiently undercover while it's raining.
// The threshold is fairly low and only requires about 10-15% of the ride to be undercover.
if (gClimateCurrent.RainLevel != 0 && (ride->sheltered_eighths >> 5) < 3)
if (gClimateCurrent.RainLevel != RAIN_LEVEL_NONE && (ride->sheltered_eighths >> 5) < 3)
{
if (peepAtRide)
{
+2 -2
View File
@@ -2171,12 +2171,12 @@ private:
gClimateUpdateTimer = _s4.climate_timer;
gClimateCurrent.Temperature = _s4.temperature;
gClimateCurrent.Weather = _s4.weather;
gClimateCurrent.WeatherEffect = 0;
gClimateCurrent.WeatherEffect = WEATHER_EFFECT_NONE;
gClimateCurrent.WeatherGloom = _s4.weather_gloom;
gClimateCurrent.RainLevel = _s4.rain;
gClimateNext.Temperature = _s4.target_temperature;
gClimateNext.Weather = _s4.target_weather;
gClimateNext.WeatherEffect = 0;
gClimateNext.WeatherEffect = WEATHER_EFFECT_NONE;
gClimateNext.WeatherGloom = _s4.target_weather_gloom;
gClimateNext.RainLevel = _s4.target_rain;
}
+1 -1
View File
@@ -2353,7 +2353,7 @@ static sint32 ride_get_new_breakdown_problem(Ride *ride)
rct_ride_entry *entry;
// Brake failure is more likely when it's raining
_breakdownProblemProbabilities[BREAKDOWN_BRAKES_FAILURE] = gClimateCurrent.RainLevel == 0 ? 3 : 20;
_breakdownProblemProbabilities[BREAKDOWN_BRAKES_FAILURE] = gClimateCurrent.RainLevel == RAIN_LEVEL_NONE ? 3 : 20;
entry = get_ride_entry_by_ride(ride);
if (entry == nullptr || entry->flags & RIDE_ENTRY_FLAG_CANNOT_BREAK_DOWN)
+10 -9
View File
@@ -144,7 +144,7 @@ extern "C"
climate_determine_future_weather(scenario_rand());
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
}
else if (gClimateNext.RainLevel <= 2)
else if (gClimateNext.RainLevel <= RAIN_LEVEL_HEAVY)
{
gClimateCurrent.RainLevel = climate_step_weather_level(gClimateCurrent.RainLevel, gClimateNext.RainLevel);
}
@@ -169,7 +169,7 @@ extern "C"
climate_update_lightning();
climate_update_thunder();
}
else if (gClimateCurrent.WeatherEffect == 2)
else if (gClimateCurrent.WeatherEffect == WEATHER_EFFECT_STORM)
{
// Create new thunder and lightning
uint32 randomNumber = util_rand();
@@ -269,7 +269,8 @@ static void climate_determine_future_weather(sint32 randomDistribution)
static void climate_update_rain_sound()
{
if (gClimateCurrent.WeatherEffect == 1 || gClimateCurrent.WeatherEffect == 2)
if (gClimateCurrent.WeatherEffect == WEATHER_EFFECT_RAIN ||
gClimateCurrent.WeatherEffect == WEATHER_EFFECT_STORM)
{
// Start playing the rain sound
if (gRainSoundChannel == nullptr)
@@ -403,12 +404,12 @@ const FILTER_PALETTE_ID ClimateWeatherGloomColours[4] =
// There is actually a sprite at 0x5A9C for snow but only these weather types seem to be fully implemented
const WeatherState ClimateWeatherData[6] =
{
{ 10, 0, 0, 0, SPR_WEATHER_SUN }, // Sunny
{ 5, 0, 0, 0, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy
{ 0, 0, 0, 0, SPR_WEATHER_CLOUD }, // Cloudy
{ -2, 1, 1, 1, SPR_WEATHER_LIGHT_RAIN }, // Rain
{ -4, 1, 2, 2, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain
{ 2, 2, 2, 2, SPR_WEATHER_STORM }, // Thunderstorm
{ 10, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_SUN }, // Sunny
{ 5, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy
{ 0, WEATHER_EFFECT_NONE, 0, RAIN_LEVEL_NONE, SPR_WEATHER_CLOUD }, // Cloudy
{ -2, WEATHER_EFFECT_RAIN, 1, RAIN_LEVEL_LIGHT, SPR_WEATHER_LIGHT_RAIN }, // Rain
{ -4, WEATHER_EFFECT_RAIN, 2, RAIN_LEVEL_HEAVY, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain
{ 2, WEATHER_EFFECT_STORM, 2, RAIN_LEVEL_HEAVY, SPR_WEATHER_STORM }, // Thunderstorm
};
static constexpr const WeatherTransition ClimateTransitionsCoolAndWet[] =
+14
View File
@@ -38,6 +38,20 @@ enum WEATHER
WEATHER_THUNDER,
};
enum WEATHER_EFFECT
{
WEATHER_EFFECT_NONE,
WEATHER_EFFECT_RAIN,
WEATHER_EFFECT_STORM,
};
enum RAIN_LEVEL
{
RAIN_LEVEL_NONE,
RAIN_LEVEL_LIGHT,
RAIN_LEVEL_HEAVY,
};
typedef struct WeatherState
{
sint8 TemperatureDelta;