From 9595c31c7f483c553fe4aa50b1ce3cfd19004f0f Mon Sep 17 00:00:00 2001 From: Flatener Date: Mon, 5 Oct 2026 20:09:41 +0200 Subject: [PATCH] world: implement Manager::isRaining (#214) * world: implement Manager::isRaining Implement the position-based rain check for Rain, HeavyRain, ThunderRain, and BlueskyRain. Declare the climate weather lookup dependency and name both functions in the function table. The rain check matches the original function at 0x71010f33a4. * world: keep rainfall queries const Restore const on Manager::isRaining and make its climate weather helper const. Both queries only read Manager state. Update their function-table symbols; the rain check still matches the original. --- data/uking_functions.csv | 4 ++-- src/KingSystem/World/worldManager.cpp | 13 +++++++++++++ src/KingSystem/World/worldManager.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 913929c7..f48a7fac 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -90131,13 +90131,13 @@ Address,Quality,Size,Name 0x00000071010f2f24,O,000008,_ZNK4ksys5world7Manager17getCurrentClimateEv 0x00000071010f2f2c,O,000008,_ZNK4ksys5world7Manager14getPrevClimateEv 0x00000071010f2f34,O,000008,_ZNK4ksys5world7Manager28getClimateTransitionProgressEv -0x00000071010f2f3c,U,000972,WorldMgr::someWeatherStuff_0 +0x00000071010f2f3c,U,000972,_ZNK4ksys5world7Manager14getWeatherTypeENS0_7ClimateE 0x00000071010f3308,U,000044,WorldMgr::x_14 0x00000071010f3334,O,000032,_ZNK4ksys5world7Manager16isDayLockBlueSkyENS0_7ClimateE 0x00000071010f3354,O,000032,_ZNK4ksys5world7Manager18isNightLockBlueSkyENS0_7ClimateE 0x00000071010f3374,U,000008,WorldMgr::__auto13 0x00000071010f337c,U,000040,_ZN4ksys5world7Manager14sub_71010F337CERKN4sead7Vector3IfEE -0x00000071010f33a4,U,000084,WorldMgr::isRaining +0x00000071010f33a4,O,000084,_ZNK4ksys5world7Manager9isRainingERKN4sead7Vector3IfEE 0x00000071010f33f8,O,000452,_ZNK4ksys5world7Manager11calcTempDayEf 0x00000071010f35bc,O,000452,_ZNK4ksys5world7Manager13calcTempNightEf 0x00000071010f3780,O,000068,_ZNK4ksys5world7Manager14getMoistureMaxEv diff --git a/src/KingSystem/World/worldManager.cpp b/src/KingSystem/World/worldManager.cpp index 9265b0b1..16aa90cb 100644 --- a/src/KingSystem/World/worldManager.cpp +++ b/src/KingSystem/World/worldManager.cpp @@ -136,6 +136,19 @@ bool Manager::isNightLockBlueSky(Climate climate) const { return mWorldInfo.mClimates[int(climate)].NightLockBlueSky.ref(); } +bool Manager::isRaining(const sead::Vector3f& pos) const { + const Climate climate = getClimate(pos); + switch (getWeatherType(climate)) { + case WeatherType::Rain: + case WeatherType::HeavyRain: + case WeatherType::ThunderRain: + case WeatherType::BlueskyRain: + return true; + default: + return false; + } +} + float Manager::calcTempDay(float height) const { float normal_temp = 23.0f; diff --git a/src/KingSystem/World/worldManager.h b/src/KingSystem/World/worldManager.h index 159ebd8d..d0da5464 100644 --- a/src/KingSystem/World/worldManager.h +++ b/src/KingSystem/World/worldManager.h @@ -221,6 +221,8 @@ private: Unloaded, }; + WeatherType getWeatherType(Climate climate) const; + void overrideWindSpeed(float* wind_speed) const; void calcManagers(sead::WorkerMgr* worker_mgr);