From 0efb11834907a298648829b1fe4378662169deb4 Mon Sep 17 00:00:00 2001 From: Maddy <59680197+xM4ddy@users.noreply.github.com> Date: Mon, 21 Mar 2022 17:06:16 -0400 Subject: [PATCH] feat(session): Add Local Weather Options (#123) Co-authored-by: LiamD-Flop --- BigBaseV2/src/core/globals.hpp | 2 ++ BigBaseV2/src/util/session.hpp | 12 ++++++++++++ BigBaseV2/src/views/view_session.cpp | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 773e7f55..99dc13b3 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -132,7 +132,9 @@ namespace big struct session { + int local_weather = 0; bool override_time = {}; + bool override_weather = false; struct { int hour{}, minute{}, second{}; diff --git a/BigBaseV2/src/util/session.hpp b/BigBaseV2/src/util/session.hpp index d4a52b42..f3151d8c 100644 --- a/BigBaseV2/src/util/session.hpp +++ b/BigBaseV2/src/util/session.hpp @@ -2,6 +2,7 @@ #include "core/data/session_types.hpp" #include "script_global.hpp" #include "script.hpp" +#include "natives.hpp" namespace big::session { @@ -16,4 +17,15 @@ namespace big::session script::get_current()->yield(200ms); *script_global(1574587).as() = 0; } + + static constexpr char const* weathers[] = { "EXTRASUNNY", "CLEAR", "CLOUDS", "SMOG", "FOGGY", "OVERCAST", "RAIN", "THUNDER", "CLEARING", "NEUTRAL", "SNOW", "BLIZZARD", "SNOWLIGHT", "XMAS", "HALLOWEEN" }; + + void local_weather() + { + MISC::CLEAR_OVERRIDE_WEATHER(); + + MISC::SET_OVERRIDE_WEATHER(weathers[g->session.local_weather]); + + *script_global(262145).at(4723).as() = g->session.local_weather == 13; + } } \ No newline at end of file diff --git a/BigBaseV2/src/views/view_session.cpp b/BigBaseV2/src/views/view_session.cpp index 8b4d8c7e..5e1c4401 100644 --- a/BigBaseV2/src/views/view_session.cpp +++ b/BigBaseV2/src/views/view_session.cpp @@ -1,3 +1,4 @@ +#include "fiber_pool.hpp" #include "util/session.hpp" #include "views/view.hpp" @@ -64,6 +65,26 @@ namespace big ImGui::SliderInt("Second", &g->session.custom_time.second, 0, 59); } + ImGui::TreePop(); + } + if (ImGui::TreeNode("Local Weather")) + { + if (ImGui::Button("Clear Override")) + { + g_fiber_pool->queue_job([] + { + MISC::CLEAR_OVERRIDE_WEATHER(); + }); + } + + if (ImGui::ListBox("", &g->session.local_weather, session::weathers, 15)) + { + g_fiber_pool->queue_job([] + { + session::local_weather(); + }); + } + ImGui::TreePop(); } }