feat(session): Add Local Weather Options (#123)

Co-authored-by: LiamD-Flop <contact@liamd.me>
This commit is contained in:
Maddy 2022-03-21 17:06:16 -04:00 committed by GitHub
parent c659f68ab5
commit 0efb118349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View File

@ -132,7 +132,9 @@ namespace big
struct session struct session
{ {
int local_weather = 0;
bool override_time = {}; bool override_time = {};
bool override_weather = false;
struct struct
{ {
int hour{}, minute{}, second{}; int hour{}, minute{}, second{};

View File

@ -2,6 +2,7 @@
#include "core/data/session_types.hpp" #include "core/data/session_types.hpp"
#include "script_global.hpp" #include "script_global.hpp"
#include "script.hpp" #include "script.hpp"
#include "natives.hpp"
namespace big::session namespace big::session
{ {
@ -16,4 +17,15 @@ namespace big::session
script::get_current()->yield(200ms); script::get_current()->yield(200ms);
*script_global(1574587).as<int*>() = 0; *script_global(1574587).as<int*>() = 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<bool*>() = g->session.local_weather == 13;
}
} }

View File

@ -1,3 +1,4 @@
#include "fiber_pool.hpp"
#include "util/session.hpp" #include "util/session.hpp"
#include "views/view.hpp" #include "views/view.hpp"
@ -64,6 +65,26 @@ namespace big
ImGui::SliderInt("Second", &g->session.custom_time.second, 0, 59); 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(); ImGui::TreePop();
} }
} }