From 31d20cefb23c29db16abfbd878c626314c3b9349 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Mon, 14 Sep 2020 21:36:30 +0200 Subject: [PATCH] Rename rain to weather where appropriate Co-authored-by: Brett Penzer --- src/openrct2-ui/UiContext.cpp | 30 ++++----- src/openrct2-ui/audio/AudioContext.cpp | 2 +- .../engines/opengl/OpenGLDrawingEngine.cpp | 12 ++-- src/openrct2/audio/Audio.cpp | 16 ++--- src/openrct2/audio/AudioContext.h | 2 +- src/openrct2/audio/DummyAudioContext.cpp | 2 +- src/openrct2/audio/audio.h | 6 +- src/openrct2/drawing/IDrawingEngine.h | 6 +- src/openrct2/drawing/Weather.cpp | 30 ++++----- src/openrct2/drawing/Weather.h | 4 +- src/openrct2/drawing/X8DrawingEngine.cpp | 36 +++++----- src/openrct2/drawing/X8DrawingEngine.h | 20 +++--- src/openrct2/interface/Screenshot.cpp | 4 +- src/openrct2/paint/Painter.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 4 +- src/openrct2/rct2/S6Exporter.cpp | 4 +- src/openrct2/rct2/S6Importer.cpp | 4 +- src/openrct2/scenario/Scenario.h | 4 +- src/openrct2/title/TitleScreen.cpp | 2 +- src/openrct2/ui/DummyUiContext.cpp | 2 +- src/openrct2/ui/UiContext.h | 12 ++-- src/openrct2/world/Climate.cpp | 66 +++++++++---------- src/openrct2/world/Climate.h | 6 +- src/openrct2/world/Scenery.cpp | 2 +- 24 files changed, 139 insertions(+), 139 deletions(-) diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index f56872696c..001c4b4abc 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -280,7 +280,7 @@ public: return std::make_shared(); } - void DrawRainAnimation(IRainDrawer* rainDrawer, rct_drawpixelinfo* dpi, DrawRainFunc drawFunc) override + void DrawWeatherAnimation(IWeatherDrawer* weatherDrawer, rct_drawpixelinfo* dpi, DrawWeatherFunc drawFunc) override { int32_t left = dpi->x; int32_t right = left + dpi->width; @@ -289,7 +289,7 @@ public: for (auto& w : g_window_list) { - DrawRainWindow(rainDrawer, w.get(), left, right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, w.get(), left, right, top, bottom, drawFunc); } } @@ -797,9 +797,9 @@ private: return SDL_GetWindowFlags(_window); } - static void DrawRainWindow( - IRainDrawer* rainDrawer, rct_window* original_w, int16_t left, int16_t right, int16_t top, int16_t bottom, - DrawRainFunc drawFunc) + static void DrawWeatherWindow( + IWeatherDrawer* weatherDrawer, rct_window* original_w, int16_t left, int16_t right, int16_t top, int16_t bottom, + DrawWeatherFunc drawFunc) { rct_window* w{}; auto itStart = window_get_iterator(original_w); @@ -807,7 +807,7 @@ private: { if (it == g_window_list.end()) { - // Loop ended, draw rain for original_w + // Loop ended, draw weather for original_w auto vp = original_w->viewport; if (vp != nullptr) { @@ -819,7 +819,7 @@ private: { auto width = right - left; auto height = bottom - top; - drawFunc(rainDrawer, left, top, width, height); + drawFunc(weatherDrawer, left, top, width, height); } } return; @@ -841,39 +841,39 @@ private: break; } - DrawRainWindow(rainDrawer, original_w, left, w->windowPos.x, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, w->windowPos.x, top, bottom, drawFunc); left = w->windowPos.x; - DrawRainWindow(rainDrawer, original_w, left, right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, bottom, drawFunc); return; } int16_t w_right = RCT_WINDOW_RIGHT(w); if (right > w_right) { - DrawRainWindow(rainDrawer, original_w, left, w_right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, w_right, top, bottom, drawFunc); left = w_right; - DrawRainWindow(rainDrawer, original_w, left, right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, bottom, drawFunc); return; } if (top < w->windowPos.y) { - DrawRainWindow(rainDrawer, original_w, left, right, top, w->windowPos.y, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, w->windowPos.y, drawFunc); top = w->windowPos.y; - DrawRainWindow(rainDrawer, original_w, left, right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, bottom, drawFunc); return; } int16_t w_bottom = RCT_WINDOW_BOTTOM(w); if (bottom > w_bottom) { - DrawRainWindow(rainDrawer, original_w, left, right, top, w_bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, w_bottom, drawFunc); top = w_bottom; - DrawRainWindow(rainDrawer, original_w, left, right, top, bottom, drawFunc); + DrawWeatherWindow(weatherDrawer, original_w, left, right, top, bottom, drawFunc); return; } } diff --git a/src/openrct2-ui/audio/AudioContext.cpp b/src/openrct2-ui/audio/AudioContext.cpp index 7aa73a9ce0..b89a02fd44 100644 --- a/src/openrct2-ui/audio/AudioContext.cpp +++ b/src/openrct2-ui/audio/AudioContext.cpp @@ -104,7 +104,7 @@ namespace OpenRCT2::Audio void StopCrowdSound() override { } - void StopRainSound() override + void StopWeatherSound() override { } void StopRideMusic() override diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 2d2961bb0f..1b5a782cdb 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -121,12 +121,12 @@ public: } }; -class OpenGLRainDrawer final : public IRainDrawer +class OpenGLWeatherDrawer final : public IWeatherDrawer { OpenGLDrawingContext* _drawingContext; public: - explicit OpenGLRainDrawer(OpenGLDrawingContext* drawingContext) + explicit OpenGLWeatherDrawer(OpenGLDrawingContext* drawingContext) : _drawingContext(drawingContext) { } @@ -194,7 +194,7 @@ private: OpenGLFramebuffer* _screenFramebuffer = nullptr; OpenGLFramebuffer* _scaleFramebuffer = nullptr; OpenGLFramebuffer* _smoothScaleFramebuffer = nullptr; - OpenGLRainDrawer _rainDrawer; + OpenGLWeatherDrawer _weatherDrawer; public: SDL_Color Palette[256]; @@ -203,7 +203,7 @@ public: explicit OpenGLDrawingEngine(const std::shared_ptr& uiContext) : _uiContext(uiContext) , _drawingContext(new OpenGLDrawingContext(this)) - , _rainDrawer(_drawingContext) + , _weatherDrawer(_drawingContext) { _window = static_cast(_uiContext->GetWindow()); _bitsDPI.DrawingEngine = this; @@ -340,10 +340,10 @@ public: window_update_all(); } - void PaintRain() override + void PaintWeather() override { _drawingContext->SetDPI(&_bitsDPI); - DrawRain(&_bitsDPI, &_rainDrawer); + DrawWeather(&_bitsDPI, &_weatherDrawer); } std::string Screenshot() override diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index dfab7f3d0f..556f313c3e 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -46,7 +46,7 @@ bool gGameSoundsOff = false; int32_t gVolumeAdjustZoom = 0; void* gTitleMusicChannel = nullptr; -void* gRainSoundChannel = nullptr; +void* gWeatherSoundChannel = nullptr; rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC]; rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC]; @@ -308,7 +308,7 @@ void audio_stop_all_music_and_sounds() audio_stop_vehicle_sounds(); audio_stop_ride_music(); peep_stop_crowd_noise(); - audio_stop_rain_sound(); + audio_stop_weather_sound(); } void audio_stop_title_music() @@ -320,12 +320,12 @@ void audio_stop_title_music() } } -void audio_stop_rain_sound() +void audio_stop_weather_sound() { - if (gRainSoundChannel != nullptr) + if (gWeatherSoundChannel != nullptr) { - Mixer_Stop_Channel(gRainSoundChannel); - gRainSoundChannel = nullptr; + Mixer_Stop_Channel(gWeatherSoundChannel); + gWeatherSoundChannel = nullptr; } } @@ -381,7 +381,7 @@ void audio_close() peep_stop_crowd_noise(); audio_stop_title_music(); audio_stop_ride_music(); - audio_stop_rain_sound(); + audio_stop_weather_sound(); gAudioCurrentDevice = -1; } @@ -407,7 +407,7 @@ void audio_pause_sounds() audio_stop_vehicle_sounds(); audio_stop_ride_music(); peep_stop_crowd_noise(); - audio_stop_rain_sound(); + audio_stop_weather_sound(); } void audio_unpause_sounds() diff --git a/src/openrct2/audio/AudioContext.h b/src/openrct2/audio/AudioContext.h index 5725503af8..35633445ea 100644 --- a/src/openrct2/audio/AudioContext.h +++ b/src/openrct2/audio/AudioContext.h @@ -47,7 +47,7 @@ namespace OpenRCT2::Audio virtual void StopAll() abstract; virtual void StopCrowdSound() abstract; - virtual void StopRainSound() abstract; + virtual void StopWeatherSound() abstract; virtual void StopRideMusic() abstract; virtual void StopTitleMusic() abstract; virtual void StopVehicleSounds() abstract; diff --git a/src/openrct2/audio/DummyAudioContext.cpp b/src/openrct2/audio/DummyAudioContext.cpp index 1df9197a39..46f51ac74c 100644 --- a/src/openrct2/audio/DummyAudioContext.cpp +++ b/src/openrct2/audio/DummyAudioContext.cpp @@ -65,7 +65,7 @@ namespace OpenRCT2::Audio void StopCrowdSound() override { } - void StopRainSound() override + void StopWeatherSound() override { } void StopRideMusic() override diff --git a/src/openrct2/audio/audio.h b/src/openrct2/audio/audio.h index 4616eac21c..a04cbb7d13 100644 --- a/src/openrct2/audio/audio.h +++ b/src/openrct2/audio/audio.h @@ -161,7 +161,7 @@ extern bool gGameSoundsOff; extern int32_t gVolumeAdjustZoom; extern void* gTitleMusicChannel; -extern void* gRainSoundChannel; +extern void* gWeatherSoundChannel; extern rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC]; extern rct_ride_music_info gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS]; @@ -220,9 +220,9 @@ void audio_populate_devices(); */ void audio_start_title_music(); /** - * Stops the rain sound effect from playing. + * Stops the weather sound effect from playing. */ -void audio_stop_rain_sound(); +void audio_stop_weather_sound(); /** * Stops ride music from playing. * rct2: 0x006BCA9F diff --git a/src/openrct2/drawing/IDrawingEngine.h b/src/openrct2/drawing/IDrawingEngine.h index 968421a5ff..2b492e8bcd 100644 --- a/src/openrct2/drawing/IDrawingEngine.h +++ b/src/openrct2/drawing/IDrawingEngine.h @@ -63,7 +63,7 @@ namespace OpenRCT2::Drawing virtual void EndDraw() abstract; virtual void PaintWindows() abstract; virtual void UpdateWindows() abstract; - virtual void PaintRain() abstract; + virtual void PaintWeather() abstract; virtual void CopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy) abstract; virtual std::string Screenshot() abstract; @@ -84,9 +84,9 @@ namespace OpenRCT2::Drawing DRAWING_ENGINE_TYPE type, const std::shared_ptr& uiContext) abstract; }; - struct IRainDrawer + struct IWeatherDrawer { - virtual ~IRainDrawer() + virtual ~IWeatherDrawer() { } virtual void Draw(int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart) abstract; diff --git a/src/openrct2/drawing/Weather.cpp b/src/openrct2/drawing/Weather.cpp index 1ab5ebac60..f7edb287ec 100644 --- a/src/openrct2/drawing/Weather.cpp +++ b/src/openrct2/drawing/Weather.cpp @@ -21,14 +21,14 @@ using namespace OpenRCT2; using namespace OpenRCT2::Drawing; -static void DrawLightRain(IRainDrawer* rainDrawer, int32_t left, int32_t top, int32_t width, int32_t height); -static void DrawHeavyRain(IRainDrawer* rainDrawer, int32_t left, int32_t top, int32_t width, int32_t height); +static void DrawLightRain(IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height); +static void DrawHeavyRain(IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height); /** * * rct2: 0x009AC058 */ -const DrawRainFunc DrawRainFunctions[] = { +const DrawWeatherFunc DrawRainFunctions[] = { nullptr, &DrawLightRain, &DrawHeavyRain, @@ -38,7 +38,7 @@ const DrawRainFunc DrawRainFunctions[] = { * * rct2: 0x00684218 */ -void DrawRain(rct_drawpixelinfo* dpi, IRainDrawer* rainDrawer) +void DrawWeather(rct_drawpixelinfo* dpi, IWeatherDrawer* weatherDrawer) { if (gConfigGeneral.render_weather_effects) { @@ -49,12 +49,12 @@ void DrawRain(rct_drawpixelinfo* dpi, IRainDrawer* rainDrawer) viewFlags = viewport->flags; // Get rain draw function and draw rain - RainLevel rainType = gClimateCurrent.Level; - if (rainType != RainLevel::None && !gTrackDesignSaveMode && !(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) + WeatherLevel rainType = gClimateCurrent.Level; + if (rainType != WeatherLevel::None && !gTrackDesignSaveMode && !(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) { auto drawFunc = DrawRainFunctions[static_cast(rainType)]; auto uiContext = GetContext()->GetUiContext(); - uiContext->DrawRainAnimation(rainDrawer, dpi, drawFunc); + uiContext->DrawWeatherAnimation(weatherDrawer, dpi, drawFunc); } } } @@ -63,54 +63,54 @@ void DrawRain(rct_drawpixelinfo* dpi, IRainDrawer* rainDrawer) * * rct2: 0x00684114 */ -static void DrawLightRain(IRainDrawer* rainDrawer, int32_t left, int32_t top, int32_t width, int32_t height) +static void DrawLightRain(IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { int32_t x_start = -static_cast(gScenarioTicks) + 8; int32_t y_start = (gScenarioTicks * 3) + 7; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); x_start = -static_cast(gScenarioTicks) + 0x18; y_start = (gScenarioTicks * 4) + 0x0D; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); } /** * * rct2: 0x0068416D */ -static void DrawHeavyRain(IRainDrawer* rainDrawer, int32_t left, int32_t top, int32_t width, int32_t height) +static void DrawHeavyRain(IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height) { int32_t x_start = -static_cast(gScenarioTicks); int32_t y_start = gScenarioTicks * 5; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); x_start = -static_cast(gScenarioTicks) + 0x10; y_start = (gScenarioTicks * 6) + 5; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); x_start = -static_cast(gScenarioTicks) + 8; y_start = (gScenarioTicks * 3) + 7; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); x_start = -static_cast(gScenarioTicks) + 0x18; y_start = (gScenarioTicks * 4) + 0x0D; y_start = -y_start; x_start += left; y_start += top; - rainDrawer->Draw(left, top, width, height, x_start, y_start); + weatherDrawer->Draw(left, top, width, height, x_start, y_start); } diff --git a/src/openrct2/drawing/Weather.h b/src/openrct2/drawing/Weather.h index 047cec80ae..4acad0bf92 100644 --- a/src/openrct2/drawing/Weather.h +++ b/src/openrct2/drawing/Weather.h @@ -15,7 +15,7 @@ struct rct_drawpixelinfo; namespace OpenRCT2::Drawing { - struct IRainDrawer; + struct IWeatherDrawer; } // clang-format off @@ -28,4 +28,4 @@ static constexpr const uint8_t RainPattern[] = }; // clang-format on -void DrawRain(rct_drawpixelinfo* dpi, OpenRCT2::Drawing::IRainDrawer* rainDrawer); +void DrawWeather(rct_drawpixelinfo* dpi, OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer); diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index 0ba3fcf19b..13031754ac 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -30,22 +30,22 @@ using namespace OpenRCT2; using namespace OpenRCT2::Drawing; using namespace OpenRCT2::Ui; -X8RainDrawer::X8RainDrawer() +X8WeatherDrawer::X8WeatherDrawer() { - _rainPixels = new RainPixel[_rainPixelsCapacity]; + _weatherPixels = new WeatherPixel[_weatherPixelsCapacity]; } -X8RainDrawer::~X8RainDrawer() +X8WeatherDrawer::~X8WeatherDrawer() { - delete[] _rainPixels; + delete[] _weatherPixels; } -void X8RainDrawer::SetDPI(rct_drawpixelinfo* dpi) +void X8WeatherDrawer::SetDPI(rct_drawpixelinfo* dpi) { _screenDPI = dpi; } -void X8RainDrawer::Draw(int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart) +void X8WeatherDrawer::Draw(int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart) { const uint8_t* pattern = RainPattern; uint8_t patternXSpace = *pattern++; @@ -60,13 +60,13 @@ void X8RainDrawer::Draw(int32_t x, int32_t y, int32_t width, int32_t height, int uint8_t* screenBits = _screenDPI->bits; // Stores the colours of changed pixels - RainPixel* newPixels = &_rainPixels[_rainPixelsCount]; + WeatherPixel* newPixels = &_weatherPixels[_weatherPixelsCount]; for (; height != 0; height--) { uint8_t patternX = pattern[patternYPos * 2]; if (patternX != 0xFF) { - if (_rainPixelsCount < (_rainPixelsCapacity - static_cast(width))) + if (_weatherPixelsCount < (_weatherPixelsCapacity - static_cast(width))) { uint32_t finalPixelOffset = width + pixelOffset; @@ -78,7 +78,7 @@ void X8RainDrawer::Draw(int32_t x, int32_t y, int32_t width, int32_t height, int { uint8_t current_pixel = screenBits[xPixelOffset]; screenBits[xPixelOffset] = patternPixel; - _rainPixelsCount++; + _weatherPixelsCount++; // Store colour and position *newPixels++ = { xPixelOffset, current_pixel }; @@ -92,15 +92,15 @@ void X8RainDrawer::Draw(int32_t x, int32_t y, int32_t width, int32_t height, int } } -void X8RainDrawer::Restore() +void X8WeatherDrawer::Restore() { - if (_rainPixelsCount > 0) + if (_weatherPixelsCount > 0) { uint32_t numPixels = (_screenDPI->width + _screenDPI->pitch) * _screenDPI->height; uint8_t* bits = _screenDPI->bits; - for (uint32_t i = 0; i < _rainPixelsCount; i++) + for (uint32_t i = 0; i < _weatherPixelsCount; i++) { - RainPixel rainPixel = _rainPixels[i]; + WeatherPixel rainPixel = _weatherPixels[i]; if (rainPixel.Position >= numPixels) { // Pixel out of bounds, bail @@ -109,7 +109,7 @@ void X8RainDrawer::Restore() bits[rainPixel.Position] = rainPixel.Colour; } - _rainPixelsCount = 0; + _weatherPixelsCount = 0; } } @@ -197,8 +197,8 @@ void X8DrawingEngine::BeginDraw() Resize(_width, _height); } #endif - _rainDrawer.SetDPI(&_bitsDPI); - _rainDrawer.Restore(); + _weatherDrawer.SetDPI(&_bitsDPI); + _weatherDrawer.Restore(); } } @@ -222,9 +222,9 @@ void X8DrawingEngine::UpdateWindows() window_update_all(); } -void X8DrawingEngine::PaintRain() +void X8DrawingEngine::PaintWeather() { - DrawRain(&_bitsDPI, &_rainDrawer); + DrawWeather(&_bitsDPI, &_weatherDrawer); } void X8DrawingEngine::CopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy) diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index 9448b04d40..6fd668ba67 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -35,25 +35,25 @@ namespace OpenRCT2 uint8_t* Blocks; }; - class X8RainDrawer final : public IRainDrawer + class X8WeatherDrawer final : public IWeatherDrawer { private: - struct RainPixel + struct WeatherPixel { uint32_t Position; uint8_t Colour; }; - static constexpr uint32_t MaxRainPixels = 0xFFFE; + static constexpr uint32_t MaxWeatherPixels = 0xFFFE; - size_t _rainPixelsCapacity = MaxRainPixels; - uint32_t _rainPixelsCount = 0; - RainPixel* _rainPixels = nullptr; + size_t _weatherPixelsCapacity = MaxWeatherPixels; + uint32_t _weatherPixelsCount = 0; + WeatherPixel* _weatherPixels = nullptr; rct_drawpixelinfo* _screenDPI = nullptr; public: - X8RainDrawer(); - ~X8RainDrawer(); + X8WeatherDrawer(); + ~X8WeatherDrawer(); void SetDPI(rct_drawpixelinfo* dpi); void Draw(int32_t x, int32_t y, int32_t width, int32_t height, int32_t xStart, int32_t yStart) override; void Restore(); @@ -80,7 +80,7 @@ namespace OpenRCT2 bool _lastLightFXenabled = false; #endif - X8RainDrawer _rainDrawer; + X8WeatherDrawer _weatherDrawer; X8DrawingContext* _drawingContext; public: @@ -105,7 +105,7 @@ namespace OpenRCT2 void EndDraw() override; void PaintWindows() override; void UpdateWindows() override; - void PaintRain() override; + void PaintWeather() override; void CopyRect(int32_t x, int32_t y, int32_t width, int32_t height, int32_t dx, int32_t dy) override; std::string Screenshot() override; IDrawingContext* GetDrawingContext(rct_drawpixelinfo* dpi) override; diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 444c37381e..27c587c292 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -75,7 +75,7 @@ void screenshot_check() gScreenshotCountdown--; if (gScreenshotCountdown == 0) { - // update_rain_animation(); + // update_weather_animation(); std::string screenshotPath = screenshot_dump(); if (!screenshotPath.empty()) @@ -87,7 +87,7 @@ void screenshot_check() context_show_error(STR_SCREENSHOT_FAILED, STR_NONE); } - // redraw_rain(); + // redraw_weather(); } } } diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 9c89b8651c..597c05fcd3 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -56,7 +56,7 @@ void Painter::Paint(IDrawingEngine& de) gfx_draw_pickedup_peep(dpi); gfx_invalidate_pickedup_peep(); - de.PaintRain(); + de.PaintWeather(); } auto* replayManager = GetContext()->GetReplayManager(); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 74958829ea..cfa19ea137 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2673,12 +2673,12 @@ private: gClimateCurrent.Weather = _s4.weather; gClimateCurrent.WeatherEffect = WeatherEffectType::None; gClimateCurrent.WeatherGloom = _s4.weather_gloom; - gClimateCurrent.Level = static_cast(_s4.rain); + gClimateCurrent.Level = static_cast(_s4.rain); gClimateNext.Temperature = _s4.target_temperature; gClimateNext.Weather = _s4.target_weather; gClimateNext.WeatherEffect = WeatherEffectType::None; gClimateNext.WeatherGloom = _s4.target_weather_gloom; - gClimateNext.Level = static_cast(_s4.target_rain); + gClimateNext.Level = static_cast(_s4.target_rain); } void ImportScenarioNameDetails() diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 5da890454d..d7244ca657 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -397,8 +397,8 @@ void S6Exporter::Export() _s6.next_weather_effect = static_cast(gClimateNext.WeatherEffect); _s6.current_weather_gloom = gClimateCurrent.WeatherGloom; _s6.next_weather_gloom = gClimateNext.WeatherGloom; - _s6.current_rain_level = static_cast(gClimateCurrent.Level); - _s6.next_rain_level = static_cast(gClimateNext.Level); + _s6.current_weather_level = static_cast(gClimateCurrent.Level); + _s6.next_weather_level = static_cast(gClimateNext.Level); // News items for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 9fe5a457f6..11e3f28833 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -423,8 +423,8 @@ public: gClimateNext.WeatherEffect = WeatherEffectType{ _s6.next_weather_effect }; gClimateCurrent.WeatherGloom = _s6.current_weather_gloom; gClimateNext.WeatherGloom = _s6.next_weather_gloom; - gClimateCurrent.Level = static_cast(_s6.current_rain_level); - gClimateNext.Level = static_cast(_s6.next_rain_level); + gClimateCurrent.Level = static_cast(_s6.current_weather_level); + gClimateNext.Level = static_cast(_s6.next_weather_level); // News items News::InitQueue(); diff --git a/src/openrct2/scenario/Scenario.h b/src/openrct2/scenario/Scenario.h index 28f128d910..ca214a8b4c 100644 --- a/src/openrct2/scenario/Scenario.h +++ b/src/openrct2/scenario/Scenario.h @@ -286,8 +286,8 @@ struct rct_s6_data uint8_t next_weather_effect; uint8_t current_weather_gloom; uint8_t next_weather_gloom; - uint8_t current_rain_level; - uint8_t next_rain_level; + uint8_t current_weather_level; + uint8_t next_weather_level; rct12_news_item news_items[RCT12_MAX_NEWS_ITEMS]; char rct1_scenario_name[62]; // Unused in RCT2 uint16_t rct1_scenario_slot_index; // Unused in RCT2 diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 85c5847e96..a5f4ee0f4a 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -174,7 +174,7 @@ void TitleScreen::Update() _gameState.UpdateLogic(); } update_palette_effects(); - // update_rain_animation(); + // update_weather_animation(); } input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false); diff --git a/src/openrct2/ui/DummyUiContext.cpp b/src/openrct2/ui/DummyUiContext.cpp index cfc1529768..251f9ac37a 100644 --- a/src/openrct2/ui/DummyUiContext.cpp +++ b/src/openrct2/ui/DummyUiContext.cpp @@ -159,7 +159,7 @@ namespace OpenRCT2::Ui { return std::make_shared(); } - void DrawRainAnimation(IRainDrawer* rainDrawer, rct_drawpixelinfo* dpi, DrawRainFunc drawFunc) override + void DrawWeatherAnimation(IWeatherDrawer* weatherDrawer, rct_drawpixelinfo* dpi, DrawWeatherFunc drawFunc) override { } diff --git a/src/openrct2/ui/UiContext.h b/src/openrct2/ui/UiContext.h index 39d3e00e2a..1f92814401 100644 --- a/src/openrct2/ui/UiContext.h +++ b/src/openrct2/ui/UiContext.h @@ -27,9 +27,9 @@ namespace OpenRCT2 namespace Drawing { struct IDrawingEngineFactory; - struct IRainDrawer; - using DrawRainFunc = void (*)( - OpenRCT2::Drawing::IRainDrawer* rainDrawer, int32_t left, int32_t top, int32_t width, int32_t height); + struct IWeatherDrawer; + using DrawWeatherFunc = void (*)( + OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer, int32_t left, int32_t top, int32_t width, int32_t height); } // namespace Drawing namespace Ui @@ -133,9 +133,9 @@ namespace OpenRCT2 // Drawing virtual std::shared_ptr GetDrawingEngineFactory() abstract; - virtual void DrawRainAnimation( - OpenRCT2::Drawing::IRainDrawer* rainDrawer, rct_drawpixelinfo* dpi, - OpenRCT2::Drawing::DrawRainFunc drawFunc) abstract; + virtual void DrawWeatherAnimation( + OpenRCT2::Drawing::IWeatherDrawer* weatherDrawer, rct_drawpixelinfo* dpi, + OpenRCT2::Drawing::DrawWeatherFunc drawFunc) abstract; // Text input virtual bool IsTextInputActive() abstract; diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index d569f71300..cab45b7155 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -54,7 +54,7 @@ uint16_t gClimateUpdateTimer; uint16_t gClimateLightningFlash; // Sound data -static int32_t _rainVolume = 1; +static int32_t _weatherVolume = 1; static uint32_t _lightningTimer; static uint32_t _thunderTimer; static void* _thunderSoundChannels[MAX_THUNDER_INSTANCES]; @@ -65,7 +65,7 @@ static int32_t _thunderStereoEcho = 0; static int8_t climate_step_weather_level(int8_t currentWeatherLevel, int8_t nextWeatherLevel); static void climate_determine_future_weather(int32_t randomDistribution); -static void climate_update_rain_sound(); +static void climate_update_weather_sound(); static void climate_update_thunder_sound(); static void climate_update_lightning(); static void climate_update_thunder(); @@ -95,10 +95,10 @@ void climate_reset(ClimateType climate) _lightningTimer = 0; _thunderTimer = 0; - if (_rainVolume != 1) + if (_weatherVolume != 1) { - audio_stop_rain_sound(); - _rainVolume = 1; + audio_stop_weather_sound(); + _weatherVolume = 1; } climate_determine_future_weather(scenario_rand()); @@ -142,9 +142,9 @@ void climate_update() auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); context_broadcast_intent(&intent); } - else if (gClimateNext.Level <= RainLevel::Heavy) + else if (gClimateNext.Level <= WeatherLevel::Heavy) { - gClimateCurrent.Level = static_cast(climate_step_weather_level( + gClimateCurrent.Level = static_cast(climate_step_weather_level( static_cast(gClimateCurrent.Level), static_cast(gClimateNext.Level))); } } @@ -208,13 +208,13 @@ void climate_update_sound() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - climate_update_rain_sound(); + climate_update_weather_sound(); climate_update_thunder_sound(); } bool climate_is_raining() { - return gClimateCurrent.Level != RainLevel::None; + return gClimateCurrent.Level != WeatherLevel::None; } FILTER_PALETTE_ID climate_get_weather_gloom_palette_id(const ClimateState& state) @@ -275,44 +275,44 @@ static void climate_determine_future_weather(int32_t randomDistribution) gClimateUpdateTimer = 1920; } -static void climate_update_rain_sound() +static void climate_update_weather_sound() { if (gClimateCurrent.WeatherEffect == WeatherEffectType::Rain || gClimateCurrent.WeatherEffect == WeatherEffectType::Storm) { - // Start playing the rain sound - if (gRainSoundChannel == nullptr) + // Start playing the weather sound + if (gWeatherSoundChannel == nullptr) { - gRainSoundChannel = Mixer_Play_Effect(SoundId::Rain, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0); + gWeatherSoundChannel = Mixer_Play_Effect(SoundId::Rain, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0); } - if (_rainVolume == 1) + if (_weatherVolume == 1) { - _rainVolume = -4000; + _weatherVolume = -4000; } else { - // Increase rain sound - _rainVolume = std::min(-1400, _rainVolume + 80); - if (gRainSoundChannel != nullptr) + // Increase weather sound + _weatherVolume = std::min(-1400, _weatherVolume + 80); + if (gWeatherSoundChannel != nullptr) { - Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume)); + Mixer_Channel_Volume(gWeatherSoundChannel, DStoMixerVolume(_weatherVolume)); } } } - else if (_rainVolume != 1) + else if (_weatherVolume != 1) { - // Decrease rain sound - _rainVolume -= 80; - if (_rainVolume > -4000) + // Decrease weather sound + _weatherVolume -= 80; + if (_weatherVolume > -4000) { - if (gRainSoundChannel != nullptr) + if (gWeatherSoundChannel != nullptr) { - Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume)); + Mixer_Channel_Volume(gWeatherSoundChannel, DStoMixerVolume(_weatherVolume)); } } else { - audio_stop_rain_sound(); - _rainVolume = 1; + audio_stop_weather_sound(); + _weatherVolume = 1; } } } @@ -412,12 +412,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, WeatherEffectType::None, 0, RainLevel::None, SPR_WEATHER_SUN }, // Sunny - { 5, WeatherEffectType::None, 0, RainLevel::None, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy - { 0, WeatherEffectType::None, 0, RainLevel::None, SPR_WEATHER_CLOUD }, // Cloudy - { -2, WeatherEffectType::Rain, 1, RainLevel::Light, SPR_WEATHER_LIGHT_RAIN }, // Rain - { -4, WeatherEffectType::Rain, 2, RainLevel::Heavy, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain - { 2, WeatherEffectType::Storm, 2, RainLevel::Heavy, SPR_WEATHER_STORM }, // Thunderstorm + { 10, WeatherEffectType::None, 0, WeatherLevel::None, SPR_WEATHER_SUN }, // Sunny + { 5, WeatherEffectType::None, 0, WeatherLevel::None, SPR_WEATHER_SUN_CLOUD }, // Partially Cloudy + { 0, WeatherEffectType::None, 0, WeatherLevel::None, SPR_WEATHER_CLOUD }, // Cloudy + { -2, WeatherEffectType::Rain, 1, WeatherLevel::Light, SPR_WEATHER_LIGHT_RAIN }, // Rain + { -4, WeatherEffectType::Rain, 2, WeatherLevel::Heavy, SPR_WEATHER_HEAVY_RAIN }, // Heavy Rain + { 2, WeatherEffectType::Storm, 2, WeatherLevel::Heavy, SPR_WEATHER_STORM }, // Thunderstorm }; static constexpr const WeatherTransition ClimateTransitionsCoolAndWet[] = { diff --git a/src/openrct2/world/Climate.h b/src/openrct2/world/Climate.h index 0b6eb8ffa5..2996ef51a0 100644 --- a/src/openrct2/world/Climate.h +++ b/src/openrct2/world/Climate.h @@ -38,7 +38,7 @@ enum class WeatherEffectType : uint8_t Storm, }; -enum class RainLevel +enum class WeatherLevel { None, Light, @@ -50,7 +50,7 @@ struct WeatherState int8_t TemperatureDelta; WeatherEffectType EffectLevel; int8_t GloomLevel; - RainLevel Level; + WeatherLevel Level; uint32_t SpriteId; }; @@ -60,7 +60,7 @@ struct ClimateState int8_t Temperature; WeatherEffectType WeatherEffect; uint8_t WeatherGloom; - RainLevel Level; + WeatherLevel Level; }; extern ClimateType gClimate; diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 7280390cb5..e79811c886 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -121,7 +121,7 @@ void SmallSceneryElement::UpdateAge(const CoordsXY& sceneryPos) return; } - // Check map elements above, presumably to see if map element is blocked from rain + // Check map elements above, presumably to see if map element is blocked from weather TileElement* tileElementAbove = reinterpret_cast(this); // Change from original: RCT2 only checked for the first three quadrants, which was very likely to be a bug. while (!(tileElementAbove->GetOccupiedQuadrants()))