CheatMenuSA/src/visual.h

56 lines
2.3 KiB
C
Raw Normal View History

2020-12-02 16:19:16 -05:00
#pragma once
2021-08-19 16:19:20 -04:00
#include "pch.h"
2021-09-21 04:00:26 -04:00
2020-12-02 16:19:16 -05:00
class Visual
{
private:
2021-10-24 18:08:00 -04:00
static inline bool m_bLockWeather;
2020-12-02 16:19:16 -05:00
#ifdef GTASA
2021-10-24 18:08:00 -04:00
static inline bool m_bInvisibleWater;
static inline bool m_bNoWater;
static inline bool m_bDisableHydrant;
#endif
2021-09-21 04:00:26 -04:00
2021-10-24 18:08:00 -04:00
// Timecyc stuff
static inline int m_nTimecycHour = 8;
static inline std::vector<std::string> m_WeatherNames{"EXTRASUNNY LA", "SUNNY LA",
"EXTRASUNNY SMOG LA", "SUNNY SMOG LA",
"CLOUDY LA", "SUNNY SF",
"EXTRASUNNY SF", "CLOUDY SF",
"RAINY SF", "FOGGY SF",
"SUNNY VEGAS", "EXTRASUNNY VEGAS",
"CLOUDY VEGAS", "EXTRASUNNY COUNTRYSIDE",
"SUNNY COUNTRYSIDE", "CLOUDY COUNTRYSIDE",
"RAINY COUNTRYSIDE", "EXTRASUNNY DESERT",
"SUNNY DESERT", "SANDSTORM DESERT",
"UNDERWATER", "EXTRACOLOURS 1",
"EXTRACOLOURS 2"};
static void GenerateTimecycFile();
static int CalcArrayIndex();
static bool TimeCycColorEdit3(const char *label, uchar *r, uchar *g, uchar *b, ImGuiColorEditFlags flags = 0);
static bool TimeCycColorEdit4(const char *label, uchar *r, uchar *g, uchar *b, uchar *a,
ImGuiColorEditFlags flags = 0);
template <typename T> static void TimecycSlider(const char *label, T *data, int min, int max);
2020-12-02 16:19:16 -05:00
public:
2021-10-24 18:08:00 -04:00
Visual();
static void Draw();
2020-12-02 16:19:16 -05:00
};
2021-10-24 18:08:00 -04:00
template <typename T> void Visual::TimecycSlider(const char *label, T *ptr, int min, int max)
2020-12-02 16:19:16 -05:00
{
2021-10-24 18:08:00 -04:00
int val = CalcArrayIndex();
2021-08-20 02:09:59 -04:00
#ifdef GTASA
2021-10-24 18:08:00 -04:00
// Compatable with 24h TimeCyc
T *arr = static_cast<T *>(patch::GetPointer(int(ptr)));
2021-10-21 18:23:02 -04:00
#else // GTA3 & GTAVC
2021-10-24 18:08:00 -04:00
T *arr = static_cast<T *>(ptr);
2021-08-20 02:09:59 -04:00
#endif
2021-10-24 18:08:00 -04:00
int a = arr[val];
2021-10-24 18:08:00 -04:00
if (ImGui::SliderInt(label, &a, min, max))
arr[val] = static_cast<T>(a);
2021-06-18 12:49:11 -04:00
}