1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Refactor climate.h structs

This commit is contained in:
Ted John
2017-03-11 11:20:52 +00:00
parent 0d722d55e1
commit 04a3c73c59
4 changed files with 30 additions and 30 deletions

View File

@@ -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,

View File

@@ -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);
}
}
}

View File

@@ -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

View File

@@ -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);