mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #5300 from IntelOrca/refactor/climate
Refactor climate
This commit is contained in:
commit
90ec681019
|
@ -21,6 +21,7 @@
|
|||
658F3D911E44A6C200388550 /* ParkImporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 658F3D8F1E44A6C200388550 /* ParkImporter.cpp */; };
|
||||
6876808CD662C4B16392A9B4 /* Balloon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 437490DBD74ECF60C3363559 /* Balloon.cpp */; };
|
||||
791166FB1D7486EF005912EA /* NetworkServerAdvertiser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 791166F91D7486EF005912EA /* NetworkServerAdvertiser.cpp */; };
|
||||
7D02D519C9A56A1FB9854FE7 /* Climate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 242F470FE91956ACA4078F6A /* Climate.cpp */; };
|
||||
85060FD31D8C17CC00DFA2B3 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
8594C0601D885CF600235E93 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
85B468FC1D96822F000F1DB5 /* paint_helpers.c in Sources */ = {isa = PBXBuildFile; fileRef = 85B468FB1D96822F000F1DB5 /* paint_helpers.c */; };
|
||||
|
@ -414,7 +415,6 @@
|
|||
D44272971CC81B3200D84D28 /* viewport.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271D61CC81B3200D84D28 /* viewport.c */; };
|
||||
D44272981CC81B3200D84D28 /* water.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271D71CC81B3200D84D28 /* water.c */; };
|
||||
D442729A1CC81B3200D84D28 /* banner.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271DA1CC81B3200D84D28 /* banner.c */; };
|
||||
D442729B1CC81B3200D84D28 /* climate.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271DC1CC81B3200D84D28 /* climate.c */; };
|
||||
D442729C1CC81B3200D84D28 /* duck.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271DE1CC81B3200D84D28 /* duck.c */; };
|
||||
D442729D1CC81B3200D84D28 /* footpath.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271E01CC81B3200D84D28 /* footpath.c */; };
|
||||
D442729E1CC81B3200D84D28 /* fountain.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271E21CC81B3200D84D28 /* fountain.c */; };
|
||||
|
@ -479,6 +479,7 @@
|
|||
D4EC48E81C2637710024B507 /* title in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E51C2637710024B507 /* title */; };
|
||||
D4F5B5EF1DAD8A4300AB6075 /* CursorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4F5B5EC1DAD8A4300AB6075 /* CursorData.cpp */; };
|
||||
D4F5B5F01DAD8A4300AB6075 /* Cursors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4F5B5ED1DAD8A4300AB6075 /* Cursors.cpp */; };
|
||||
F2CC500E17C9411FBA859888 /* Climate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 242F470FE91956ACA4078F6A /* Climate.cpp */; };
|
||||
F61331C839858250899F1E9B /* Balloon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 437490DBD74ECF60C3363559 /* Balloon.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
|
@ -529,6 +530,7 @@
|
|||
008BF7291CDAA5C30019A2AD /* track_design.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = track_design.h; sourceTree = "<group>"; };
|
||||
00EFEE701CF1D80B0035213B /* NetworkKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkKey.cpp; sourceTree = "<group>"; usesTabs = 0; };
|
||||
00EFEE711CF1D80B0035213B /* NetworkKey.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = NetworkKey.h; sourceTree = "<group>"; usesTabs = 0; };
|
||||
242F470FE91956ACA4078F6A /* Climate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Climate.cpp; sourceTree = "<group>"; };
|
||||
437490DBD74ECF60C3363559 /* Balloon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Balloon.cpp; sourceTree = "<group>"; };
|
||||
652076301E22EFE7000D0C04 /* Imaging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Imaging.cpp; sourceTree = "<group>"; };
|
||||
652076311E22EFE7000D0C04 /* Imaging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Imaging.h; sourceTree = "<group>"; };
|
||||
|
@ -992,8 +994,6 @@
|
|||
D44271D71CC81B3200D84D28 /* water.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = water.c; sourceTree = "<group>"; };
|
||||
D44271DA1CC81B3200D84D28 /* banner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = banner.c; sourceTree = "<group>"; };
|
||||
D44271DB1CC81B3200D84D28 /* banner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = banner.h; sourceTree = "<group>"; };
|
||||
D44271DC1CC81B3200D84D28 /* climate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = climate.c; sourceTree = "<group>"; };
|
||||
D44271DD1CC81B3200D84D28 /* climate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = climate.h; sourceTree = "<group>"; };
|
||||
D44271DE1CC81B3200D84D28 /* duck.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = duck.c; sourceTree = "<group>"; };
|
||||
D44271DF1CC81B3200D84D28 /* entrance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entrance.h; sourceTree = "<group>"; };
|
||||
D44271E01CC81B3200D84D28 /* footpath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = footpath.c; sourceTree = "<group>"; };
|
||||
|
@ -1240,6 +1240,7 @@
|
|||
D4F5B5EC1DAD8A4300AB6075 /* CursorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CursorData.cpp; sourceTree = "<group>"; };
|
||||
D4F5B5ED1DAD8A4300AB6075 /* Cursors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cursors.cpp; sourceTree = "<group>"; };
|
||||
D4F5B5EE1DAD8A4300AB6075 /* Cursors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cursors.h; sourceTree = "<group>"; };
|
||||
EC3C3FED9FA55B65F65D706F /* Climate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Climate.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -2037,11 +2038,11 @@
|
|||
D44271D81CC81B3200D84D28 /* world */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EC3C3FED9FA55B65F65D706F /* Climate.h */,
|
||||
242F470FE91956ACA4078F6A /* Climate.cpp */,
|
||||
437490DBD74ECF60C3363559 /* Balloon.cpp */,
|
||||
D44271DA1CC81B3200D84D28 /* banner.c */,
|
||||
D44271DB1CC81B3200D84D28 /* banner.h */,
|
||||
D44271DC1CC81B3200D84D28 /* climate.c */,
|
||||
D44271DD1CC81B3200D84D28 /* climate.h */,
|
||||
D44271DE1CC81B3200D84D28 /* duck.c */,
|
||||
D44271DF1CC81B3200D84D28 /* entrance.h */,
|
||||
D44271E01CC81B3200D84D28 /* footpath.c */,
|
||||
|
@ -2688,6 +2689,7 @@
|
|||
C64FDAAD1D6D9A2100F259B9 /* submarine_ride.c in Sources */,
|
||||
C64FDAAE1D6D9A2100F259B9 /* water_coaster.c in Sources */,
|
||||
6876808CD662C4B16392A9B4 /* Balloon.cpp in Sources */,
|
||||
7D02D519C9A56A1FB9854FE7 /* Climate.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2905,7 +2907,6 @@
|
|||
C686F9431CDBC3B7009F9BFC /* motion_simulator.c in Sources */,
|
||||
D4469DAD1DEF84480039A779 /* Fonts.cpp in Sources */,
|
||||
D44272281CC81B3200D84D28 /* language.cpp in Sources */,
|
||||
D442729B1CC81B3200D84D28 /* climate.c in Sources */,
|
||||
D464FEC01D31A68800CBABAC /* Image.cpp in Sources */,
|
||||
C686F9261CDBC3B7009F9BFC /* vertical_drop_roller_coaster.c in Sources */,
|
||||
D464FEE91D31A6AA00CBABAC /* ImageTable.cpp in Sources */,
|
||||
|
@ -3046,6 +3047,7 @@
|
|||
C686F9231CDBC3B7009F9BFC /* steeplechase.c in Sources */,
|
||||
D44272871CC81B3200D84D28 /* staff_list.c in Sources */,
|
||||
F61331C839858250899F1E9B /* Balloon.cpp in Sources */,
|
||||
F2CC500E17C9411FBA859888 /* Climate.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "management/finance.h"
|
||||
#include "network/network.h"
|
||||
#include "util/util.h"
|
||||
#include "world/climate.h"
|
||||
#include "world/Climate.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/scenery.h"
|
||||
#include "world/sprite.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "../interface/window.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "drawing.h"
|
||||
#include "../config/Config.h"
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../interface/viewport.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../paint/map_element/map_element.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "drawing.h"
|
||||
#include "lightfx.h"
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "util/sawyercoding.h"
|
||||
#include "util/util.h"
|
||||
#include "world/banner.h"
|
||||
#include "world/climate.h"
|
||||
#include "world/Climate.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/map.h"
|
||||
#include "world/park.h"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "util/util.h"
|
||||
#include "windows/error.h"
|
||||
#include "windows/tooltip.h"
|
||||
#include "world/climate.h"
|
||||
#include "world/Climate.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/map_animation.h"
|
||||
#include "world/park.h"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "../util/util.h"
|
||||
#include "../Version.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/scenery.h"
|
||||
#include "console.h"
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "../ride/track_data.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/entrance.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/map.h"
|
||||
|
|
|
@ -405,7 +405,7 @@
|
|||
<ClCompile Include="windows\viewport.c" />
|
||||
<ClCompile Include="windows\water.c" />
|
||||
<ClCompile Include="world\banner.c" />
|
||||
<ClCompile Include="world\climate.c" />
|
||||
<ClCompile Include="world\Climate.cpp" />
|
||||
<ClCompile Include="world\footpath.c" />
|
||||
<ClCompile Include="world\fountain.c" />
|
||||
<ClCompile Include="world\map.c" />
|
||||
|
@ -596,7 +596,7 @@
|
|||
<ClInclude Include="windows\tile_inspector.h" />
|
||||
<ClInclude Include="windows\tooltip.h" />
|
||||
<ClInclude Include="world\banner.h" />
|
||||
<ClInclude Include="world\climate.h" />
|
||||
<ClInclude Include="world\Climate.h" />
|
||||
<ClInclude Include="world\entrance.h" />
|
||||
<ClInclude Include="world\footpath.h" />
|
||||
<ClInclude Include="world\fountain.h" />
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "../scenario/scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/map.h"
|
||||
#include "../world/scenery.h"
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "../title/TitleScreen.h"
|
||||
#include "../util/util.h"
|
||||
#include "../Version.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "platform.h"
|
||||
|
||||
typedef void(*update_palette_func)(const uint8*, sint32, sint32);
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C"
|
|||
#include "../ride/track.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/map_animation.h"
|
||||
#include "../world/park.h"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "scenario/ScenarioRepository.h"
|
||||
#include "title/TitleScreen.h"
|
||||
#include "util/util.h"
|
||||
#include "world/climate.h"
|
||||
#include "world/Climate.h"
|
||||
#include "world/map.h"
|
||||
#include "world/park.h"
|
||||
#include "world/scenery.h"
|
||||
|
|
|
@ -46,7 +46,7 @@ extern "C"
|
|||
#include "../scenario/scenario.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/map_animation.h"
|
||||
#include "../world/park.h"
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ extern "C"
|
|||
#include "../ride/ride_ratings.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/map_animation.h"
|
||||
#include "../world/park.h"
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "../util/util.h"
|
||||
#include "../windows/error.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/map.h"
|
||||
#include "../world/map_animation.h"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "../ride/ride.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/map.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/scenery.h"
|
||||
|
|
|
@ -36,7 +36,7 @@ extern "C"
|
|||
#include "../localisation/localisation.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "../ride/ride.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "../interface/themes.h"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "../scenario/scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/park.h"
|
||||
#include "dropdown.h"
|
||||
#include "error.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../peep/staff.h"
|
||||
#include "../rct2.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/sprite.h"
|
||||
|
||||
|
@ -490,13 +490,13 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
|
|||
x += 30;
|
||||
|
||||
// Current weather
|
||||
gfx_draw_sprite(dpi, climate_weather_data[gClimateCurrentWeather].sprite_id, x, y, 0);
|
||||
gfx_draw_sprite(dpi, ClimateWeatherData[gClimateCurrentWeather].SpriteId, x, y, 0);
|
||||
|
||||
// Next weather
|
||||
if (climate_weather_data[gClimateCurrentWeather].sprite_id != climate_weather_data[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, climate_weather_data[gClimateNextWeather].sprite_id, x + 40, y, 0);
|
||||
gfx_draw_sprite(dpi, ClimateWeatherData[gClimateNextWeather].SpriteId, x + 40, y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,452 @@
|
|||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Math.hpp"
|
||||
#include "Climate.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../audio/audio.h"
|
||||
#include "../audio/AudioMixer.h"
|
||||
#include "../cheats.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../game.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../rct2.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/util.h"
|
||||
}
|
||||
|
||||
constexpr sint32 MAX_THUNDER_INSTANCES = 2;
|
||||
|
||||
enum class THUNDER_STATUS
|
||||
{
|
||||
NONE,
|
||||
PLAYING,
|
||||
};
|
||||
|
||||
struct WeatherTransition
|
||||
{
|
||||
sint8 BaseTemperature;
|
||||
sint8 DistributionSize;
|
||||
sint8 Distribution[24];
|
||||
};
|
||||
|
||||
extern const WeatherTransition * ClimateTransitions[4];
|
||||
|
||||
// Climate data
|
||||
uint8 gClimate;
|
||||
uint8 gClimateCurrentWeather;
|
||||
sint8 gClimateCurrentTemperature;
|
||||
uint8 gClimateCurrentWeatherEffect;
|
||||
uint8 gClimateCurrentWeatherGloom;
|
||||
uint8 gClimateCurrentRainLevel;
|
||||
uint8 gClimateNextWeather;
|
||||
sint8 gClimateNextTemperature;
|
||||
uint8 gClimateNextWeatherEffect;
|
||||
uint8 gClimateNextWeatherGloom;
|
||||
uint8 gClimateNextRainLevel;
|
||||
uint16 gClimateUpdateTimer;
|
||||
uint16 gClimateLightningFlash;
|
||||
|
||||
// Sound data
|
||||
static sint32 _rainVolume = 1;
|
||||
static uint32 _lightningTimer;
|
||||
static uint32 _thunderTimer;
|
||||
static void * _thunderSoundChannels[MAX_THUNDER_INSTANCES];
|
||||
static THUNDER_STATUS _thunderStatus[MAX_THUNDER_INSTANCES] = { THUNDER_STATUS::NONE, THUNDER_STATUS::PLAYING };
|
||||
static uint32 _thunderSoundId;
|
||||
static sint32 _thunderVolume;
|
||||
static sint32 _thunderStereoEcho = 0;
|
||||
|
||||
static sint8 climate_step_weather_level(sint8 currentWeatherLevel, sint8 nextWeatherLevel);
|
||||
static void climate_determine_future_weather(sint32 randomDistribution);
|
||||
static void climate_update_rain_sound();
|
||||
static void climate_update_thunder_sound();
|
||||
static void climate_update_lightning();
|
||||
static void climate_update_thunder();
|
||||
static void climate_play_thunder(sint32 instanceIndex, sint32 soundId, sint32 volume, sint32 pan);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
sint32 climate_celsius_to_fahrenheit(sint32 celsius)
|
||||
{
|
||||
return (celsius * 29) / 16 + 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set climate and determine start weather.
|
||||
*/
|
||||
void climate_reset(sint32 climate)
|
||||
{
|
||||
uint8 weather = WEATHER_PARTIALLY_CLOUDY;
|
||||
sint32 month = date_get_month(gDateMonthsElapsed);
|
||||
const WeatherTransition * transition = &ClimateTransitions[climate][month];
|
||||
const WeatherState * weatherState = &ClimateWeatherData[weather];
|
||||
|
||||
gClimate = climate;
|
||||
gClimateCurrentWeather = weather;
|
||||
gClimateCurrentTemperature = transition->BaseTemperature + weatherState->TemperatureDelta;
|
||||
gClimateCurrentWeatherEffect = weatherState->EffectLevel;
|
||||
gClimateCurrentWeatherGloom = weatherState->GloomLevel;
|
||||
gClimateCurrentRainLevel = weatherState->RainLevel;
|
||||
|
||||
_lightningTimer = 0;
|
||||
_thunderTimer = 0;
|
||||
if (_rainVolume != 1)
|
||||
{
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
|
||||
climate_determine_future_weather(scenario_rand());
|
||||
}
|
||||
|
||||
/**
|
||||
* Weather & climate update iteration.
|
||||
* Gradually changes the weather parameters towards their determined next values.
|
||||
*/
|
||||
void climate_update()
|
||||
{
|
||||
// Only do climate logic if playing (not in scenario editor or title screen)
|
||||
if (gScreenFlags & (~SCREEN_FLAGS_PLAYING)) return;
|
||||
|
||||
if (!gCheatsFreezeClimate)
|
||||
{
|
||||
if (gClimateUpdateTimer)
|
||||
{
|
||||
if (gClimateUpdateTimer == 960)
|
||||
{
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
}
|
||||
gClimateUpdateTimer--;
|
||||
}
|
||||
else if (!(gCurrentTicks & 0x7F))
|
||||
{
|
||||
if (gClimateCurrentTemperature == gClimateNextTemperature)
|
||||
{
|
||||
if (gClimateCurrentWeatherGloom == gClimateNextWeatherGloom)
|
||||
{
|
||||
gClimateCurrentWeatherEffect = gClimateNextWeatherEffect;
|
||||
_thunderTimer = 0;
|
||||
_lightningTimer = 0;
|
||||
|
||||
if (gClimateCurrentRainLevel == gClimateNextRainLevel)
|
||||
{
|
||||
gClimateCurrentWeather = gClimateNextWeather;
|
||||
climate_determine_future_weather(scenario_rand());
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
}
|
||||
else if (gClimateNextRainLevel <= 2)
|
||||
{
|
||||
gClimateCurrentRainLevel = climate_step_weather_level(gClimateCurrentRainLevel, gClimateNextRainLevel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gClimateCurrentWeatherGloom = climate_step_weather_level(gClimateCurrentWeatherGloom, gClimateNextWeatherGloom);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gClimateCurrentTemperature = climate_step_weather_level(gClimateCurrentTemperature, gClimateNextTemperature);
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_thunderTimer != 0)
|
||||
{
|
||||
climate_update_lightning();
|
||||
climate_update_thunder();
|
||||
}
|
||||
else if (gClimateCurrentWeatherEffect == 2)
|
||||
{
|
||||
// Create new thunder and lightning
|
||||
uint32 randomNumber = util_rand();
|
||||
if ((randomNumber & 0xFFFF) <= 0x1B4)
|
||||
{
|
||||
randomNumber >>= 16;
|
||||
_thunderTimer = 43 + (randomNumber % 64);
|
||||
_lightningTimer = randomNumber % 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void climate_force_weather(uint8 weather)
|
||||
{
|
||||
const auto weatherState = &ClimateWeatherData[weather];
|
||||
gClimateCurrentWeather = weather;
|
||||
gClimateCurrentWeatherGloom = weatherState->GloomLevel;
|
||||
gClimateCurrentRainLevel = weatherState->RainLevel;
|
||||
gClimateCurrentWeatherEffect = weatherState->EffectLevel;
|
||||
gClimateUpdateTimer = 1920;
|
||||
|
||||
climate_update();
|
||||
|
||||
// In case of change in gloom level force a complete redraw
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
|
||||
void climate_update_sound()
|
||||
{
|
||||
if (gAudioCurrentDevice == -1) return;
|
||||
if (gGameSoundsOff) return;
|
||||
if (!gConfigSound.sound_enabled) return;
|
||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return;
|
||||
|
||||
climate_update_rain_sound();
|
||||
climate_update_thunder_sound();
|
||||
}
|
||||
}
|
||||
|
||||
static sint8 climate_step_weather_level(sint8 currentWeatherLevel, sint8 nextWeatherLevel)
|
||||
{
|
||||
if (nextWeatherLevel > currentWeatherLevel)
|
||||
{
|
||||
return currentWeatherLevel + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentWeatherLevel - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates future weather development.
|
||||
* RCT2 implements this as discrete probability distributions dependant on month and climate
|
||||
* for nextWeather. The other weather parameters are then looked up depending only on the
|
||||
* next weather.
|
||||
*/
|
||||
static void climate_determine_future_weather(sint32 randomDistribution)
|
||||
{
|
||||
sint8 month = date_get_month(gDateMonthsElapsed);
|
||||
|
||||
// Generate a random variable with values 0 up to DistributionSize-1 and chose weather from the distribution table accordingly
|
||||
const WeatherTransition * transition = &ClimateTransitions[gClimate][month];
|
||||
sint8 nextWeather = transition->Distribution[((randomDistribution & 0xFF) * transition->DistributionSize) >> 8];
|
||||
gClimateNextWeather = nextWeather;
|
||||
|
||||
const auto nextWeatherState = &ClimateWeatherData[nextWeather];
|
||||
gClimateNextTemperature = transition->BaseTemperature + nextWeatherState->TemperatureDelta;
|
||||
gClimateNextWeatherEffect = nextWeatherState->EffectLevel;
|
||||
gClimateNextWeatherGloom = nextWeatherState->GloomLevel;
|
||||
gClimateNextRainLevel = nextWeatherState->RainLevel;
|
||||
|
||||
gClimateUpdateTimer = 1920;
|
||||
}
|
||||
|
||||
static void climate_update_rain_sound()
|
||||
{
|
||||
if (gClimateCurrentWeatherEffect == 1 || gClimateCurrentWeatherEffect == 2)
|
||||
{
|
||||
// Start playing the rain sound
|
||||
if (gRainSoundChannel == nullptr)
|
||||
{
|
||||
gRainSoundChannel = Mixer_Play_Effect(SOUND_RAIN_1, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0);
|
||||
}
|
||||
if (_rainVolume == 1)
|
||||
{
|
||||
_rainVolume = -4000;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Increase rain sound
|
||||
_rainVolume = Math::Min(-1400, _rainVolume + 80);
|
||||
if (gRainSoundChannel != nullptr)
|
||||
{
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_rainVolume != 1)
|
||||
{
|
||||
// Decrease rain sound
|
||||
_rainVolume -= 80;
|
||||
if (_rainVolume > -4000)
|
||||
{
|
||||
if (gRainSoundChannel != nullptr)
|
||||
{
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_update_thunder_sound()
|
||||
{
|
||||
if (_thunderStereoEcho)
|
||||
{
|
||||
// Play thunder on right side
|
||||
_thunderStereoEcho = 0;
|
||||
climate_play_thunder(1, _thunderSoundId, _thunderVolume, 10000);
|
||||
}
|
||||
|
||||
// Stop thunder sounds if they have finished
|
||||
for (sint32 i = 0; i < MAX_THUNDER_INSTANCES; i++)
|
||||
{
|
||||
if (_thunderStatus[i] != THUNDER_STATUS::NONE)
|
||||
{
|
||||
void * channel = _thunderSoundChannels[i];
|
||||
if (!Mixer_Channel_IsPlaying(channel))
|
||||
{
|
||||
Mixer_Stop_Channel(channel);
|
||||
_thunderStatus[i] = THUNDER_STATUS::NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_update_lightning()
|
||||
{
|
||||
if (_lightningTimer == 0) return;
|
||||
if (gConfigGeneral.disable_lightning_effect) return;
|
||||
if (!gConfigGeneral.render_weather_effects && !gConfigGeneral.render_weather_gloom) return;
|
||||
|
||||
_lightningTimer--;
|
||||
if (gClimateLightningFlash == 0)
|
||||
{
|
||||
if ((util_rand() & 0xFFFF) <= 0x2000)
|
||||
{
|
||||
gClimateLightningFlash = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_update_thunder()
|
||||
{
|
||||
_thunderTimer--;
|
||||
if (_thunderTimer == 0)
|
||||
{
|
||||
uint32 randomNumber = util_rand();
|
||||
if (randomNumber & 0x10000)
|
||||
{
|
||||
if (_thunderStatus[0] == THUNDER_STATUS::NONE &&
|
||||
_thunderStatus[1] == THUNDER_STATUS::NONE)
|
||||
{
|
||||
// Play thunder on left side
|
||||
_thunderSoundId = (randomNumber & 0x20000) ? SOUND_THUNDER_1 : SOUND_THUNDER_2;
|
||||
_thunderVolume = (-((sint32)((randomNumber >> 18) & 0xFF))) * 8;
|
||||
climate_play_thunder(0, _thunderSoundId, _thunderVolume, -10000);
|
||||
|
||||
// Let thunder play on right side
|
||||
_thunderStereoEcho = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_thunderStatus[0] == THUNDER_STATUS::NONE)
|
||||
{
|
||||
_thunderSoundId = (randomNumber & 0x20000) ? SOUND_THUNDER_1 : SOUND_THUNDER_2;
|
||||
sint32 pan = (((randomNumber >> 18) & 0xFF) - 128) * 16;
|
||||
climate_play_thunder(0, _thunderSoundId, 0, pan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_play_thunder(sint32 instanceIndex, sint32 soundId, sint32 volume, sint32 pan)
|
||||
{
|
||||
_thunderSoundChannels[instanceIndex] = Mixer_Play_Effect(soundId, MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(pan), 1, 0);
|
||||
if (_thunderSoundChannels[instanceIndex] != nullptr)
|
||||
{
|
||||
_thunderStatus[instanceIndex] = THUNDER_STATUS::PLAYING;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma region Climate / Weather data tables
|
||||
|
||||
const FILTER_PALETTE_ID ClimateWeatherGloomColours[4] =
|
||||
{
|
||||
(FILTER_PALETTE_ID)0,
|
||||
PALETTE_DARKEN_1,
|
||||
PALETTE_DARKEN_2,
|
||||
PALETTE_DARKEN_3,
|
||||
};
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
static const WeatherTransition ClimateTransitionsCoolAndWet[] =
|
||||
{
|
||||
{ 8, 18, { 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 0, 0, 0, 0, 0 } },
|
||||
{ 10, 21, { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 0, 0 } },
|
||||
{ 14, 17, { 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 17, 17, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 19, 23, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4 } },
|
||||
{ 20, 23, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 } },
|
||||
{ 16, 19, { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0 } },
|
||||
{ 13, 16, { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
};
|
||||
static const WeatherTransition ClimateTransitionsWarm[] = {
|
||||
{ 12, 21, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0 } },
|
||||
{ 13, 22, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5, 0 } },
|
||||
{ 16, 17, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 19, 18, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0 } },
|
||||
{ 21, 22, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0 } },
|
||||
{ 22, 17, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 5, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 19, 17, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 16, 17, { 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0 } },
|
||||
};
|
||||
static const WeatherTransition ClimateTransitionsHotAndDry[] = {
|
||||
{ 12, 15, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 14, 12, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 16, 11, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 19, 9, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 21, 13, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 22, 11, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 21, 12, { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 16, 13, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
};
|
||||
static const WeatherTransition ClimateTransitionsCold[] = {
|
||||
{ 4, 18, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 0, 0, 0, 0, 0 } },
|
||||
{ 5, 21, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0, 0 } },
|
||||
{ 7, 17, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 9, 17, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ 10, 23, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4 } },
|
||||
{ 11, 23, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 5 } },
|
||||
{ 9, 19, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0, 0, 0, 0 } },
|
||||
{ 6, 16, { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
};
|
||||
|
||||
const WeatherTransition * ClimateTransitions[] =
|
||||
{
|
||||
ClimateTransitionsCoolAndWet,
|
||||
ClimateTransitionsWarm,
|
||||
ClimateTransitionsHotAndDry,
|
||||
ClimateTransitionsCold,
|
||||
};
|
||||
|
||||
#pragma endregion
|
|
@ -0,0 +1,85 @@
|
|||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "../drawing/drawing.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
enum CLIMATE
|
||||
{
|
||||
CLIMATE_COOL_AND_WET,
|
||||
CLIMATE_WARM,
|
||||
CLIMATE_HOT_AND_DRY,
|
||||
CLIMATE_COLD
|
||||
};
|
||||
|
||||
enum WEATHER
|
||||
{
|
||||
WEATHER_SUNNY,
|
||||
WEATHER_PARTIALLY_CLOUDY,
|
||||
WEATHER_CLOUDY,
|
||||
WEATHER_RAIN,
|
||||
WEATHER_HEAVY_RAIN,
|
||||
WEATHER_THUNDER,
|
||||
};
|
||||
|
||||
typedef struct WeatherState
|
||||
{
|
||||
sint8 TemperatureDelta;
|
||||
sint8 EffectLevel;
|
||||
sint8 GloomLevel;
|
||||
sint8 RainLevel;
|
||||
uint32 SpriteId;
|
||||
} WeatherState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
extern uint8 gClimate;
|
||||
extern uint8 gClimateCurrentWeather;
|
||||
extern sint8 gClimateCurrentTemperature;
|
||||
extern uint8 gClimateCurrentWeatherEffect;
|
||||
extern uint8 gClimateCurrentWeatherGloom;
|
||||
extern uint8 gClimateCurrentRainLevel;
|
||||
extern uint8 gClimateNextWeather;
|
||||
extern sint8 gClimateNextTemperature;
|
||||
extern uint8 gClimateNextWeatherEffect;
|
||||
extern uint8 gClimateNextWeatherGloom;
|
||||
extern uint8 gClimateNextRainLevel;
|
||||
extern uint16 gClimateUpdateTimer;
|
||||
extern uint16 gClimateLightningFlash;
|
||||
|
||||
extern const WeatherState ClimateWeatherData[6];
|
||||
extern const FILTER_PALETTE_ID ClimateWeatherGloomColours[4];
|
||||
|
||||
sint32 climate_celsius_to_fahrenheit(sint32 celsius);
|
||||
void climate_reset(sint32 climate);
|
||||
void climate_update();
|
||||
void climate_update_sound();
|
||||
void climate_force_weather(uint8 weather);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,450 +0,0 @@
|
|||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../audio/audio.h"
|
||||
#include "../audio/AudioMixer.h"
|
||||
#include "../cheats.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../game.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../rct2.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/util.h"
|
||||
#include "climate.h"
|
||||
|
||||
enum {
|
||||
THUNDER_STATUS_NULL = 0,
|
||||
THUNDER_STATUS_PLAYING = 1,
|
||||
|
||||
MAX_THUNDER_INSTANCES = 2
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct rct_weather_transition {
|
||||
sint8 base_temperature;
|
||||
sint8 distribution_size;
|
||||
sint8 distribution[24];
|
||||
} rct_weather_transition;
|
||||
assert_struct_size(rct_weather_transition, 26);
|
||||
#pragma pack(pop)
|
||||
|
||||
uint8 gClimate;
|
||||
uint8 gClimateCurrentWeather;
|
||||
sint8 gClimateCurrentTemperature;
|
||||
uint8 gClimateCurrentWeatherEffect;
|
||||
uint8 gClimateCurrentWeatherGloom;
|
||||
uint8 gClimateCurrentRainLevel;
|
||||
uint8 gClimateNextWeather;
|
||||
sint8 gClimateNextTemperature;
|
||||
uint8 gClimateNextWeatherEffect;
|
||||
uint8 gClimateNextWeatherGloom;
|
||||
uint8 gClimateNextRainLevel;
|
||||
uint16 gClimateUpdateTimer;
|
||||
|
||||
uint16 gClimateLightningFlash;
|
||||
|
||||
static const rct_weather_transition* climate_transitions[4];
|
||||
|
||||
// Sound data
|
||||
static sint32 _rainVolume = 1;
|
||||
static uint32 _lightningTimer, _thunderTimer;
|
||||
static void* _thunderSoundChannels[MAX_THUNDER_INSTANCES];
|
||||
static sint32 _thunderStatus[MAX_THUNDER_INSTANCES] = { THUNDER_STATUS_NULL, THUNDER_STATUS_NULL };
|
||||
static uint32 _thunderSoundId;
|
||||
static sint32 _thunderVolume;
|
||||
static sint32 _thunderStereoEcho = 0;
|
||||
|
||||
static void climate_determine_future_weather(sint32 randomDistribution);
|
||||
|
||||
static void climate_update_rain_sound();
|
||||
static void climate_update_thunder_sound();
|
||||
static void climate_update_lightning();
|
||||
static void climate_update_thunder();
|
||||
static sint32 climate_play_thunder(sint32 instanceIndex, sint32 soundId, sint32 volume, sint32 pan);
|
||||
|
||||
sint32 climate_celsius_to_fahrenheit(sint32 celsius)
|
||||
{
|
||||
return (celsius * 29) / 16 + 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set climate and determine start weather.
|
||||
* rct2: 0x006C45ED
|
||||
*/
|
||||
void climate_reset(sint32 climate)
|
||||
{
|
||||
gClimate = climate;
|
||||
|
||||
sint8 month = gDateMonthsElapsed & 7;
|
||||
const rct_weather_transition* climate_table = climate_transitions[climate];
|
||||
rct_weather_transition transition = climate_table[month];
|
||||
sint8 weather = WEATHER_PARTIALLY_CLOUDY;
|
||||
gClimateCurrentWeather = weather;
|
||||
gClimateCurrentTemperature = transition.base_temperature + climate_weather_data[weather].temp_delta;
|
||||
gClimateCurrentWeatherEffect = climate_weather_data[weather].effect_level;
|
||||
gClimateCurrentWeatherGloom = climate_weather_data[weather].gloom_level;
|
||||
gClimateCurrentRainLevel = climate_weather_data[weather].rain_level;
|
||||
|
||||
_lightningTimer = 0;
|
||||
_thunderTimer = 0;
|
||||
if (_rainVolume != 1){
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
|
||||
climate_determine_future_weather(scenario_rand());
|
||||
}
|
||||
|
||||
static sint8 step_weather_level(sint8 cur_weather_level, sint8 next_weather_level) {
|
||||
if (next_weather_level > cur_weather_level) {
|
||||
return cur_weather_level + 1;
|
||||
} else {
|
||||
return cur_weather_level - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Weather & climate update iteration.
|
||||
* Gradually changes the weather parameters towards their determined next values.
|
||||
*
|
||||
* rct2: 0x006C46B1
|
||||
*/
|
||||
void climate_update()
|
||||
{
|
||||
uint8 screen_flags = gScreenFlags;
|
||||
sint8 temperature = gClimateCurrentTemperature,
|
||||
target_temperature = gClimateNextTemperature,
|
||||
cur_gloom = gClimateCurrentWeatherGloom,
|
||||
next_gloom = gClimateNextWeatherGloom,
|
||||
cur_rain = gClimateCurrentRainLevel,
|
||||
next_rain = gClimateNextRainLevel;
|
||||
|
||||
if (screen_flags & (~SCREEN_FLAGS_PLAYING)) // only normal play mode gets climate
|
||||
return;
|
||||
|
||||
if (!gCheatsFreezeClimate) {
|
||||
|
||||
if (gClimateUpdateTimer) {
|
||||
if (gClimateUpdateTimer == 960) {
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
}
|
||||
gClimateUpdateTimer--;
|
||||
} else if (!(gCurrentTicks & 0x7F)) {
|
||||
if (temperature == target_temperature) {
|
||||
if (cur_gloom == next_gloom) {
|
||||
gClimateCurrentWeatherEffect = gClimateNextWeatherEffect;
|
||||
_thunderTimer = 0;
|
||||
_lightningTimer = 0;
|
||||
|
||||
if (cur_rain == next_rain) {
|
||||
gClimateCurrentWeather = gClimateNextWeather;
|
||||
climate_determine_future_weather(scenario_rand());
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
} else if (next_rain <= 2) { // Safe-guard
|
||||
gClimateCurrentRainLevel = step_weather_level(cur_rain, next_rain);
|
||||
}
|
||||
} else {
|
||||
gClimateCurrentWeatherGloom = step_weather_level(cur_gloom, next_gloom);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
} else {
|
||||
gClimateCurrentTemperature = step_weather_level(temperature, target_temperature);
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_thunderTimer != 0) {
|
||||
climate_update_lightning();
|
||||
climate_update_thunder();
|
||||
} else if (gClimateCurrentWeatherEffect == 2) {
|
||||
// Create new thunder and lightning
|
||||
uint32 randomNumber = util_rand();
|
||||
if ((randomNumber & 0xFFFF) <= 0x1B4) {
|
||||
randomNumber >>= 16;
|
||||
_thunderTimer = 43 + (randomNumber % 64);
|
||||
_lightningTimer = randomNumber % 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void climate_force_weather(uint8 weather){
|
||||
gClimateCurrentWeather = weather;
|
||||
gClimateCurrentWeatherGloom = climate_weather_data[weather].gloom_level;
|
||||
gClimateCurrentRainLevel = climate_weather_data[weather].rain_level;
|
||||
gClimateCurrentWeatherEffect = climate_weather_data[weather].effect_level;
|
||||
gClimateUpdateTimer = 1920;
|
||||
|
||||
climate_update();
|
||||
|
||||
// In case of change in gloom level force a complete redraw
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates future weather development.
|
||||
* RCT2 implements this as discrete probability distributions dependant on month and climate
|
||||
* for next_weather. The other weather parameters are then looked up depending only on the
|
||||
* next weather.
|
||||
*
|
||||
* rct2: 0x006C461C
|
||||
*/
|
||||
static void climate_determine_future_weather(sint32 randomDistribution)
|
||||
{
|
||||
sint8 climate = gClimate;
|
||||
const rct_weather_transition* climate_table = climate_transitions[climate];
|
||||
sint8 month = gDateMonthsElapsed & 7;
|
||||
rct_weather_transition transition = climate_table[month];
|
||||
|
||||
// Generate a random variable with values 0 up to distribution_size-1 and chose weather from the distribution table accordingly
|
||||
sint8 next_weather = transition.distribution[ ((randomDistribution & 0xFF) * transition.distribution_size) >> 8 ];
|
||||
gClimateNextWeather = next_weather;
|
||||
|
||||
gClimateNextTemperature = transition.base_temperature + climate_weather_data[next_weather].temp_delta;
|
||||
gClimateNextWeatherEffect = climate_weather_data[next_weather].effect_level;
|
||||
gClimateNextWeatherGloom = climate_weather_data[next_weather].gloom_level;
|
||||
gClimateNextRainLevel = climate_weather_data[next_weather].rain_level;
|
||||
|
||||
gClimateUpdateTimer = 1920;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BCB91
|
||||
*/
|
||||
void climate_update_sound()
|
||||
{
|
||||
if (gAudioCurrentDevice == -1)
|
||||
return;
|
||||
if (gGameSoundsOff)
|
||||
return;
|
||||
if (!gConfigSound.sound_enabled)
|
||||
return;
|
||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
climate_update_rain_sound();
|
||||
climate_update_thunder_sound();
|
||||
}
|
||||
|
||||
static void climate_update_rain_sound()
|
||||
{
|
||||
if (gClimateCurrentWeatherEffect == 1 || gClimateCurrentWeatherEffect == 2) {
|
||||
// Start playing the rain sound
|
||||
if (!gRainSoundChannel) {
|
||||
gRainSoundChannel = Mixer_Play_Effect(SOUND_RAIN_1, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0);
|
||||
}
|
||||
if (_rainVolume == 1) {
|
||||
_rainVolume = -4000;
|
||||
} else {
|
||||
// Increase rain sound
|
||||
_rainVolume = min(-1400, _rainVolume + 80);
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
}
|
||||
} else if (_rainVolume != 1) {
|
||||
// Decrease rain sound
|
||||
_rainVolume -= 80;
|
||||
if (_rainVolume > -4000) {
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
} else {
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_update_thunder_sound()
|
||||
{
|
||||
if (_thunderStereoEcho) {
|
||||
// Play thunder on right side
|
||||
_thunderStereoEcho = 0;
|
||||
climate_play_thunder(1, _thunderSoundId, _thunderVolume, 10000);
|
||||
}
|
||||
|
||||
// Stop thunder sounds if they have finished
|
||||
for (sint32 i = 0; i < MAX_THUNDER_INSTANCES; i++) {
|
||||
if (_thunderStatus[i] == THUNDER_STATUS_NULL)
|
||||
continue;
|
||||
|
||||
if (!Mixer_Channel_IsPlaying(_thunderSoundChannels[i])) {
|
||||
Mixer_Stop_Channel(_thunderSoundChannels[i]);
|
||||
_thunderStatus[i] = THUNDER_STATUS_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void climate_update_lightning()
|
||||
{
|
||||
if (_lightningTimer == 0 || gConfigGeneral.disable_lightning_effect ||
|
||||
(!gConfigGeneral.render_weather_effects && !gConfigGeneral.render_weather_gloom))
|
||||
return;
|
||||
|
||||
_lightningTimer--;
|
||||
if (gClimateLightningFlash == 0)
|
||||
if ((util_rand() & 0xFFFF) <= 0x2000)
|
||||
gClimateLightningFlash = 1;
|
||||
}
|
||||
|
||||
static void climate_update_thunder()
|
||||
{
|
||||
_thunderTimer--;
|
||||
if (_thunderTimer != 0)
|
||||
return;
|
||||
|
||||
uint32 randomNumber = util_rand();
|
||||
if (randomNumber & 0x10000) {
|
||||
if (_thunderStatus[0] == THUNDER_STATUS_NULL && _thunderStatus[1] == THUNDER_STATUS_NULL) {
|
||||
// Play thunder on left side
|
||||
_thunderSoundId = (randomNumber & 0x20000) ? SOUND_THUNDER_1 : SOUND_THUNDER_2;
|
||||
_thunderVolume = (-((sint32)((randomNumber >> 18) & 0xFF))) * 8;
|
||||
climate_play_thunder(0, _thunderSoundId, _thunderVolume, -10000);
|
||||
|
||||
// Let thunder play on right side
|
||||
_thunderStereoEcho = 1;
|
||||
}
|
||||
} else {
|
||||
if (_thunderStatus[0] == THUNDER_STATUS_NULL){
|
||||
_thunderSoundId = (randomNumber & 0x20000) ? SOUND_THUNDER_1 : SOUND_THUNDER_2;
|
||||
sint32 pan = (((randomNumber >> 18) & 0xFF) - 128) * 16;
|
||||
climate_play_thunder(0, _thunderSoundId, 0, pan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static sint32 climate_play_thunder(sint32 instanceIndex, sint32 soundId, sint32 volume, sint32 pan)
|
||||
{
|
||||
_thunderSoundChannels[instanceIndex] = Mixer_Play_Effect(soundId, MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(pan), 1, 0);
|
||||
if (_thunderSoundChannels[instanceIndex]) {
|
||||
_thunderStatus[instanceIndex] = THUNDER_STATUS_PLAYING;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma region Climate / Weather data tables
|
||||
|
||||
/** rct2: 0x0098195C */
|
||||
const FILTER_PALETTE_ID ClimateWeatherGloomColours[4] = {
|
||||
0,
|
||||
PALETTE_DARKEN_1,
|
||||
PALETTE_DARKEN_2,
|
||||
PALETTE_DARKEN_3,
|
||||
};
|
||||
|
||||
// rct2: 0x00993C94
|
||||
// There is actually a sprite at 0x5A9C for snow but only these weather types seem to be fully implemented
|
||||
const rct_weather climate_weather_data[6] = {
|
||||
{ .temp_delta = 10, .effect_level = 0, .gloom_level = 0, .rain_level = 0, .sprite_id = SPR_WEATHER_SUN }, // Sunny
|
||||
{ .temp_delta = 5, .effect_level = 0, .gloom_level = 0, .rain_level = 0, .sprite_id = SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy
|
||||
{ .temp_delta = 0, .effect_level = 0, .gloom_level = 0, .rain_level = 0, .sprite_id = SPR_WEATHER_CLOUD }, // Cloudy
|
||||
{ .temp_delta = -2, .effect_level = 1, .gloom_level = 1, .rain_level = 1, .sprite_id = SPR_WEATHER_LIGHT_RAIN }, // Rain
|
||||
{ .temp_delta = -4, .effect_level = 1, .gloom_level = 2, .rain_level = 2, .sprite_id = SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain
|
||||
{ .temp_delta = 2, .effect_level = 2, .gloom_level = 2, .rain_level = 2, .sprite_id = SPR_WEATHER_STORM }, // Thunderstorm
|
||||
};
|
||||
|
||||
|
||||
// rct2: 00993998
|
||||
static const rct_weather_transition climate_cool_and_wet_transitions[] = {
|
||||
{ .base_temperature = 8, .distribution_size = 18,
|
||||
.distribution = { 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 10, .distribution_size = 21,
|
||||
.distribution = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 0, 0 } },
|
||||
{ .base_temperature = 14, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 17, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 19, .distribution_size = 23,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4 } },
|
||||
{ .base_temperature = 20, .distribution_size = 23,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 } },
|
||||
{ .base_temperature = 16, .distribution_size = 19,
|
||||
.distribution = { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 13, .distribution_size = 16,
|
||||
.distribution = { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0 } }
|
||||
};
|
||||
static const rct_weather_transition climate_warm_transitions[] = {
|
||||
{ .base_temperature = 12, .distribution_size = 21,
|
||||
.distribution = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0 } },
|
||||
{ .base_temperature = 13, .distribution_size = 22,
|
||||
.distribution = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 5, 0 } },
|
||||
{ .base_temperature = 16, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 19, .distribution_size = 18,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 21, .distribution_size = 22,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 0 } },
|
||||
{ .base_temperature = 22, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 5, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 19, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 16, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0 } }
|
||||
};
|
||||
static const rct_weather_transition climate_hot_and_dry_transitions[] = {
|
||||
{ .base_temperature = 12, .distribution_size = 15,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 14, .distribution_size = 12,
|
||||
.distribution = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 16, .distribution_size = 11,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 19, .distribution_size = 9,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 21, .distribution_size = 13,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 22, .distribution_size = 11,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 21, .distribution_size = 12,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 16, .distribution_size = 13,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
|
||||
};
|
||||
static const rct_weather_transition climate_cold_transitions[] = {
|
||||
{ .base_temperature = 4, .distribution_size = 18,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 5, .distribution_size = 21,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0, 0 } },
|
||||
{ .base_temperature = 7, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 9, .distribution_size = 17,
|
||||
.distribution = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 10, .distribution_size = 23,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4 } },
|
||||
{ .base_temperature = 11, .distribution_size = 23,
|
||||
.distribution = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 5 } },
|
||||
{ .base_temperature = 9, .distribution_size = 19,
|
||||
.distribution = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 4, 5, 0, 0, 0, 0 } },
|
||||
{ .base_temperature = 6, .distribution_size = 16,
|
||||
.distribution = { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static const rct_weather_transition* climate_transitions[] = {
|
||||
climate_cool_and_wet_transitions,
|
||||
climate_warm_transitions,
|
||||
climate_hot_and_dry_transitions,
|
||||
climate_cold_transitions
|
||||
};
|
||||
|
||||
#pragma endregion
|
|
@ -1,74 +0,0 @@
|
|||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef _CLIMATE_H_
|
||||
#define _CLIMATE_H_
|
||||
|
||||
#include "../common.h"
|
||||
#include "../drawing/drawing.h"
|
||||
|
||||
enum {
|
||||
CLIMATE_COOL_AND_WET,
|
||||
CLIMATE_WARM,
|
||||
CLIMATE_HOT_AND_DRY,
|
||||
CLIMATE_COLD
|
||||
};
|
||||
|
||||
enum{
|
||||
WEATHER_SUNNY,
|
||||
WEATHER_PARTIALLY_CLOUDY,
|
||||
WEATHER_CLOUDY,
|
||||
WEATHER_RAIN,
|
||||
WEATHER_HEAVY_RAIN,
|
||||
WEATHER_THUNDER
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct rct_weather {
|
||||
sint8 temp_delta;
|
||||
sint8 effect_level;
|
||||
sint8 gloom_level;
|
||||
sint8 rain_level;
|
||||
uint32 sprite_id;
|
||||
} rct_weather;
|
||||
assert_struct_size(rct_weather, 8);
|
||||
#pragma pack(pop)
|
||||
|
||||
extern uint8 gClimate;
|
||||
extern uint8 gClimateCurrentWeather;
|
||||
extern sint8 gClimateCurrentTemperature;
|
||||
extern uint8 gClimateCurrentWeatherEffect;
|
||||
extern uint8 gClimateCurrentWeatherGloom;
|
||||
extern uint8 gClimateCurrentRainLevel;
|
||||
extern uint8 gClimateNextWeather;
|
||||
extern sint8 gClimateNextTemperature;
|
||||
extern uint8 gClimateNextWeatherEffect;
|
||||
extern uint8 gClimateNextWeatherGloom;
|
||||
extern uint8 gClimateNextRainLevel;
|
||||
extern uint16 gClimateUpdateTimer;
|
||||
|
||||
extern uint16 gClimateLightningFlash;
|
||||
|
||||
extern const rct_weather climate_weather_data[6];
|
||||
extern const FILTER_PALETTE_ID ClimateWeatherGloomColours[4];
|
||||
|
||||
sint32 climate_celsius_to_fahrenheit(sint32 celsius);
|
||||
void climate_reset(sint32 climate);
|
||||
void climate_update();
|
||||
void climate_update_sound();
|
||||
void climate_force_weather(uint8 weather);
|
||||
|
||||
#endif
|
|
@ -33,7 +33,7 @@
|
|||
#include "../scenario/scenario.h"
|
||||
#include "../util/util.h"
|
||||
#include "banner.h"
|
||||
#include "climate.h"
|
||||
#include "Climate.h"
|
||||
#include "footpath.h"
|
||||
#include "map.h"
|
||||
#include "map_animation.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../scenario/scenario.h"
|
||||
#include "../cheats.h"
|
||||
#include "../object_list.h"
|
||||
#include "climate.h"
|
||||
#include "Climate.h"
|
||||
#include "fountain.h"
|
||||
#include "map.h"
|
||||
#include "park.h"
|
||||
|
|
Loading…
Reference in New Issue