From 04a3c73c59ae33335944bca25978d91a786dd30e Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 11 Mar 2017 11:20:52 +0000 Subject: [PATCH] Refactor climate.h structs --- src/openrct2/ride/track_paint.c | 2 +- src/openrct2/windows/game_bottom_toolbar.c | 6 ++-- src/openrct2/world/Climate.cpp | 34 +++++++++++----------- src/openrct2/world/climate.h | 18 ++++++------ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/openrct2/ride/track_paint.c b/src/openrct2/ride/track_paint.c index be45d6b807..922a74adb1 100644 --- a/src/openrct2/ride/track_paint.c +++ b/src/openrct2/ride/track_paint.c @@ -1533,7 +1533,7 @@ void track_paint_util_left_quarter_turn_3_tiles_paint_with_height_offset(sint8 t // } // // const sprite_bb *spriteBB = &sprites[direction][sprite]; -// uint32 imageId = spriteBB->sprite_id | colourFlags; +// uint32 imageId = spriteBB->SpriteId | colourFlags; // sub_98197C(imageId, // (sint8)spriteBB->offset.x, (sint8)spriteBB->offset.y, // spriteBB->bb_size.x, spriteBB->bb_size.y, (sint8)spriteBB->bb_size.z, diff --git a/src/openrct2/windows/game_bottom_toolbar.c b/src/openrct2/windows/game_bottom_toolbar.c index cf3aa4a137..7f0df1bad3 100644 --- a/src/openrct2/windows/game_bottom_toolbar.c +++ b/src/openrct2/windows/game_bottom_toolbar.c @@ -490,13 +490,13 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, x += 30; // Current weather - gfx_draw_sprite(dpi, ClimateWeatherData[gClimateCurrentWeather].sprite_id, x, y, 0); + gfx_draw_sprite(dpi, ClimateWeatherData[gClimateCurrentWeather].SpriteId, x, y, 0); // Next weather - if (ClimateWeatherData[gClimateCurrentWeather].sprite_id != ClimateWeatherData[gClimateNextWeather].sprite_id) { + if (ClimateWeatherData[gClimateCurrentWeather].SpriteId != ClimateWeatherData[gClimateNextWeather].SpriteId) { if (gClimateUpdateTimer < 960) { gfx_draw_sprite(dpi, SPR_NEXT_WEATHER, x + 27, y + 5, 0); - gfx_draw_sprite(dpi, ClimateWeatherData[gClimateNextWeather].sprite_id, x + 40, y, 0); + gfx_draw_sprite(dpi, ClimateWeatherData[gClimateNextWeather].SpriteId, x + 40, y, 0); } } } diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index c795407568..2f976fe6b4 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -95,17 +95,17 @@ extern "C" */ void climate_reset(sint32 climate) { - sint8 weather = WEATHER_PARTIALLY_CLOUDY; - sint8 month = date_get_month(gDateMonthsElapsed); + uint8 weather = WEATHER_PARTIALLY_CLOUDY; + sint32 month = date_get_month(gDateMonthsElapsed); const WeatherTransition * transition = &ClimateTransitions[climate][month]; - const rct_weather * climateData = &ClimateWeatherData[weather]; + const WeatherState * weatherState = &ClimateWeatherData[weather]; gClimate = climate; gClimateCurrentWeather = weather; - gClimateCurrentTemperature = transition->BaseTemperature + climateData->temp_delta; - gClimateCurrentWeatherEffect = climateData->effect_level; - gClimateCurrentWeatherGloom = climateData->gloom_level; - gClimateCurrentRainLevel = climateData->rain_level; + gClimateCurrentTemperature = transition->BaseTemperature + weatherState->TemperatureDelta; + gClimateCurrentWeatherEffect = weatherState->EffectLevel; + gClimateCurrentWeatherGloom = weatherState->GloomLevel; + gClimateCurrentRainLevel = weatherState->RainLevel; _lightningTimer = 0; _thunderTimer = 0; @@ -193,11 +193,11 @@ extern "C" void climate_force_weather(uint8 weather) { - const auto climateData = &ClimateWeatherData[weather]; + const auto weatherState = &ClimateWeatherData[weather]; gClimateCurrentWeather = weather; - gClimateCurrentWeatherGloom = climateData->gloom_level; - gClimateCurrentRainLevel = climateData->rain_level; - gClimateCurrentWeatherEffect = climateData->effect_level; + gClimateCurrentWeatherGloom = weatherState->GloomLevel; + gClimateCurrentRainLevel = weatherState->RainLevel; + gClimateCurrentWeatherEffect = weatherState->EffectLevel; gClimateUpdateTimer = 1920; climate_update(); @@ -246,11 +246,11 @@ static void climate_determine_future_weather(sint32 randomDistribution) sint8 nextWeather = transition->Distribution[((randomDistribution & 0xFF) * transition->DistributionSize) >> 8]; gClimateNextWeather = nextWeather; - const auto nextClimateData = &ClimateWeatherData[nextWeather]; - gClimateNextTemperature = transition->BaseTemperature + nextClimateData->temp_delta; - gClimateNextWeatherEffect = nextClimateData->effect_level; - gClimateNextWeatherGloom = nextClimateData->gloom_level; - gClimateNextRainLevel = nextClimateData->rain_level; + const auto nextWeatherState = &ClimateWeatherData[nextWeather]; + gClimateNextTemperature = transition->BaseTemperature + nextWeatherState->TemperatureDelta; + gClimateNextWeatherEffect = nextWeatherState->EffectLevel; + gClimateNextWeatherGloom = nextWeatherState->GloomLevel; + gClimateNextRainLevel = nextWeatherState->RainLevel; gClimateUpdateTimer = 1920; } @@ -389,7 +389,7 @@ 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 rct_weather ClimateWeatherData[6] = +const WeatherState ClimateWeatherData[6] = { { 10, 0, 0, 0, SPR_WEATHER_SUN }, // Sunny { 5, 0, 0, 0, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy diff --git a/src/openrct2/world/climate.h b/src/openrct2/world/climate.h index 4ec2462505..bf38a9c6a4 100644 --- a/src/openrct2/world/climate.h +++ b/src/openrct2/world/climate.h @@ -42,17 +42,17 @@ enum WEATHER WEATHER_CLOUDY, WEATHER_RAIN, WEATHER_HEAVY_RAIN, - WEATHER_THUNDER + WEATHER_THUNDER, }; -typedef struct rct_weather +typedef struct WeatherState { - sint8 temp_delta; - sint8 effect_level; - sint8 gloom_level; - sint8 rain_level; - uint32 sprite_id; -} rct_weather; + sint8 TemperatureDelta; + sint8 EffectLevel; + sint8 GloomLevel; + sint8 RainLevel; + uint32 SpriteId; +} WeatherState; #ifdef __cplusplus extern "C" @@ -72,7 +72,7 @@ extern "C" extern uint16 gClimateUpdateTimer; extern uint16 gClimateLightningFlash; - extern const rct_weather ClimateWeatherData[6]; + extern const WeatherState ClimateWeatherData[6]; extern const FILTER_PALETTE_ID ClimateWeatherGloomColours[4]; sint32 climate_celsius_to_fahrenheit(sint32 celsius);