feat(self): Added HUD options. (#553)
This commit is contained in:
parent
1635c0ed93
commit
146c2b8ce8
@ -33,6 +33,7 @@ namespace big
|
||||
looped::self_police();
|
||||
looped::self_super_run();
|
||||
looped::self_no_collision();
|
||||
looped::self_hud();
|
||||
looped::self_unlimited_oxygen();
|
||||
looped::self_no_water_collision();
|
||||
|
||||
|
@ -33,6 +33,7 @@ namespace big
|
||||
static void self_police();
|
||||
static void self_super_run();
|
||||
static void self_no_collision();
|
||||
static void self_hud();
|
||||
static void self_unlimited_oxygen();
|
||||
static void self_no_water_collision();
|
||||
|
||||
|
50
BigBaseV2/src/backend/looped/self/hud.cpp
Normal file
50
BigBaseV2/src/backend/looped/self/hud.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "core/data/hud_component_names.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace big
|
||||
{
|
||||
static bool bLastHideRadar = false;
|
||||
|
||||
void looped::self_hud()
|
||||
{
|
||||
const bool bHideRadar = g->self.hide_radar;
|
||||
const bool bHideAmmo = g->self.hide_ammo;
|
||||
auto& bHudComponents = g->self.hud_components_states;
|
||||
|
||||
if (bHideRadar)
|
||||
{
|
||||
HUD::DISPLAY_RADAR(false);
|
||||
}
|
||||
else if (bHideRadar != bLastHideRadar)
|
||||
{
|
||||
HUD::DISPLAY_RADAR(true);
|
||||
}
|
||||
bLastHideRadar = bHideRadar;
|
||||
|
||||
if (bHideAmmo)
|
||||
{
|
||||
HUD::DISPLAY_AMMO_THIS_FRAME(false);
|
||||
}
|
||||
|
||||
if (
|
||||
std::all_of(
|
||||
std::begin(bHudComponents),
|
||||
std::end(bHudComponents),
|
||||
[](bool i) { return i; }
|
||||
)
|
||||
) {
|
||||
HUD::DISPLAY_HUD(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
HUD::DISPLAY_HUD(true);
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
{
|
||||
if (bHudComponents[i])
|
||||
HUD::HIDE_HUD_COMPONENT_THIS_FRAME(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
BigBaseV2/src/core/data/hud_component_names.hpp
Normal file
27
BigBaseV2/src/core/data/hud_component_names.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "core/enums.hpp"
|
||||
|
||||
inline const char* hud_component_names[(int)big::HudComponents::HUD_WEAPONS] = {
|
||||
"WANTED_STARS",
|
||||
"WEAPON_ICON",
|
||||
"CASH",
|
||||
"MP_CASH",
|
||||
"MP_MESSAGE",
|
||||
"VEHICLE_NAME",
|
||||
"AREA_NAME",
|
||||
"VEHICLE_CLASS",
|
||||
"STREET_NAME",
|
||||
"HELP_TEXT",
|
||||
"FLOATING_HELP_TEXT_1",
|
||||
"FLOATING_HELP_TEXT_2",
|
||||
"CASH_CHANGE",
|
||||
"RETICLE",
|
||||
"SUBTITLE_TEXT",
|
||||
"RADIO_STATIONS",
|
||||
"SAVING_GAME",
|
||||
"GAME_STREAM",
|
||||
"WEAPON_WHEEL",
|
||||
"WEAPON_WHEEL_STATS",
|
||||
"HUD_COMPONENTS",
|
||||
"HUD_WEAPONS"
|
||||
};
|
@ -324,4 +324,29 @@ namespace big
|
||||
PED_TYPE_ANIMAL,
|
||||
PED_TYPE_ARMY
|
||||
};
|
||||
|
||||
enum class HudComponents {
|
||||
WANTED_STARS = 1,
|
||||
WEAPON_ICON,
|
||||
CASH,
|
||||
MP_CASH,
|
||||
MP_MESSAGE,
|
||||
VEHICLE_NAME,
|
||||
AREA_NAME,
|
||||
VEHICLE_CLASS,
|
||||
STREET_NAME,
|
||||
HELP_TEXT,
|
||||
FLOATING_HELP_TEXT_1,
|
||||
FLOATING_HELP_TEXT_2,
|
||||
CASH_CHANGE,
|
||||
RETICLE,
|
||||
SUBTITLE_TEXT,
|
||||
RADIO_STATIONS,
|
||||
SAVING_GAME,
|
||||
GAME_STREAM,
|
||||
WEAPON_WHEEL,
|
||||
WEAPON_WHEEL_STATS,
|
||||
HUD_COMPONENTS,
|
||||
HUD_WEAPONS
|
||||
};
|
||||
}
|
||||
|
@ -165,6 +165,10 @@ namespace big
|
||||
bool proof_drown = false;
|
||||
bool proof_water = false;
|
||||
uint32_t proof_mask = 0;
|
||||
bool hide_radar = false;
|
||||
bool hide_ammo = false;
|
||||
int selected_hud_component = 1;
|
||||
bool hud_components_states[(int)HudComponents::HUD_WEAPONS] = { false };
|
||||
};
|
||||
|
||||
struct session
|
||||
@ -563,6 +567,11 @@ namespace big
|
||||
this->self.off_radar = j["self"]["off_radar"];
|
||||
this->self.super_run = j["self"]["super_run"];
|
||||
this->self.no_collision = j["self"]["no_collision"];
|
||||
this->self.hide_radar = j["self"]["hide_radar"];
|
||||
this->self.hide_ammo = j["self"]["hide_ammo"];
|
||||
this->self.selected_hud_component = j["self"]["selected_hud_component"];
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
this->self.hud_components_states[i] = j["self"]["hud_components_states"].at(i);
|
||||
this->self.unlimited_oxygen = j["self"]["unlimited_oxygen"];
|
||||
this->self.no_water_collision = j["self"]["no_water_collision"];
|
||||
|
||||
@ -833,6 +842,33 @@ namespace big
|
||||
{ "off_radar", this->self.off_radar },
|
||||
{ "super_run", this->self.super_run },
|
||||
{ "no_collision", this->self.no_collision },
|
||||
{ "hide_radar", this->self.hide_radar },
|
||||
{ "hide_ammo", this->self.hide_ammo },
|
||||
{ "selected_hud_component", this->self.selected_hud_component },
|
||||
{ "hud_components_states", nlohmann::json::array({
|
||||
this->self.hud_components_states[0],
|
||||
this->self.hud_components_states[1],
|
||||
this->self.hud_components_states[2],
|
||||
this->self.hud_components_states[3],
|
||||
this->self.hud_components_states[4],
|
||||
this->self.hud_components_states[5],
|
||||
this->self.hud_components_states[6],
|
||||
this->self.hud_components_states[7],
|
||||
this->self.hud_components_states[8],
|
||||
this->self.hud_components_states[9],
|
||||
this->self.hud_components_states[10],
|
||||
this->self.hud_components_states[11],
|
||||
this->self.hud_components_states[12],
|
||||
this->self.hud_components_states[13],
|
||||
this->self.hud_components_states[14],
|
||||
this->self.hud_components_states[15],
|
||||
this->self.hud_components_states[16],
|
||||
this->self.hud_components_states[17],
|
||||
this->self.hud_components_states[18],
|
||||
this->self.hud_components_states[19],
|
||||
this->self.hud_components_states[20],
|
||||
this->self.hud_components_states[21] })
|
||||
},
|
||||
{ "unlimited_oxygen", this->self.unlimited_oxygen },
|
||||
{ "no_water_collision", this->self.no_water_collision },
|
||||
}
|
||||
@ -962,7 +998,7 @@ namespace big
|
||||
{ "infinite_mag", this->weapons.infinite_mag },
|
||||
{ "no_recoil", this->weapons.no_recoil },
|
||||
{ "no_spread", this->weapons.no_spread },
|
||||
{ "bypass_c4_limit", this->weapons.bypass_c4_limit }
|
||||
{ "bypass_c4_limit", this->weapons.bypass_c4_limit },
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "util/entity.hpp"
|
||||
#include "util/local_player.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "core/data/hud_component_names.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -158,6 +159,48 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("HUD");
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Hide Radar", &g->self.hide_radar);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("Hide Ammo", &g->self.hide_ammo);
|
||||
|
||||
ImGui::Combo("##hud_comp_combo", &g->self.selected_hud_component, hud_component_names, (int)HudComponents::HUD_WEAPONS);
|
||||
ImGui::SameLine();
|
||||
components::button("Hide", [] {
|
||||
g->self.hud_components_states[g->self.selected_hud_component] = true;
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Show", [] {
|
||||
g->self.hud_components_states[g->self.selected_hud_component] = false;
|
||||
});
|
||||
|
||||
components::button("Hide all", [] {
|
||||
g->self.hide_radar = true;
|
||||
g->self.hide_ammo = true;
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
{
|
||||
g->self.hud_components_states[i] = true;
|
||||
}
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Show all", [] {
|
||||
g->self.hide_radar = false;
|
||||
g->self.hide_ammo = false;
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
{
|
||||
g->self.hud_components_states[i] = false;
|
||||
}
|
||||
});
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
g->self.proof_mask = 0;
|
||||
if (g->self.god_mode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user