refactor!: globals (#717)

* refactor(globals): use macro's for to_json/from_json
* refactor(globals): switch from global pointer to global instance
This commit is contained in:
Yimura
2022-12-18 23:15:52 +01:00
committed by GitHub
parent 4041370763
commit f6c00f113d
147 changed files with 1280 additions and 1902 deletions

View File

@ -10,7 +10,7 @@ namespace big
components::sub_title("Lester");
ImGui::Checkbox("Off Radar", &g->self.off_radar);
ImGui::Checkbox("Off Radar", &g.self.off_radar);
ImGui::Separator();

View File

@ -52,36 +52,36 @@ namespace big
ImGui::BeginGroup();
ImGui::Checkbox("God Mode", &g->self.god_mode);
ImGui::Checkbox("Off Radar", &g->self.off_radar);
ImGui::Checkbox("Free Cam", &g->self.free_cam);
ImGui::Checkbox("Disable Phone", &g->tunables.disable_phone);
ImGui::Checkbox("Unlimited Oxygen", &g->self.unlimited_oxygen);
ImGui::Checkbox("Fast Respawn", &g->self.fast_respawn);
ImGui::Checkbox("God Mode", &g.self.god_mode);
ImGui::Checkbox("Off Radar", &g.self.off_radar);
ImGui::Checkbox("Free Cam", &g.self.free_cam);
ImGui::Checkbox("Disable Phone", &g.tunables.disable_phone);
ImGui::Checkbox("Unlimited Oxygen", &g.self.unlimited_oxygen);
ImGui::Checkbox("Fast Respawn", &g.self.fast_respawn);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("No Clip", &g->self.noclip);
ImGui::Checkbox("No Ragdoll", &g->self.no_ragdoll);
ImGui::Checkbox("Super Run", &g->self.super_run);
ImGui::Checkbox("No Idle Kick", &g->tunables.no_idle_kick);
ImGui::Checkbox("No Water Collision", &g->self.no_water_collision);
ImGui::Checkbox("No Clip", &g.self.noclip);
ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll);
ImGui::Checkbox("Super Run", &g.self.super_run);
ImGui::Checkbox("No Idle Kick", &g.tunables.no_idle_kick);
ImGui::Checkbox("No Water Collision", &g.self.no_water_collision);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Invisibility", &g->self.invisibility);
if (g->self.invisibility) {
ImGui::Checkbox("Locally Visible", &g->self.local_visibility);
ImGui::Checkbox("Invisibility", &g.self.invisibility);
if (g.self.invisibility) {
ImGui::Checkbox("Locally Visible", &g.self.local_visibility);
}
ImGui::Checkbox("Keep Player Clean", &g->self.clean_player);
ImGui::Checkbox("No Collision", &g->self.no_collision);
ImGui::Checkbox("Mobile Radio", &g->self.mobile_radio);
ImGui::Checkbox("Keep Player Clean", &g.self.clean_player);
ImGui::Checkbox("No Collision", &g.self.no_collision);
ImGui::Checkbox("Mobile Radio", &g.self.mobile_radio);
ImGui::Checkbox("Dance Mode", &g->self.dance_mode);
ImGui::Checkbox("Dance Mode", &g.self.dance_mode);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Hold Right DPAD or E to enter dance mode");
@ -93,55 +93,55 @@ namespace big
if (ImGui::Button("Check all"))
{
g->self.proof_bullet = true;
g->self.proof_fire = true;
g->self.proof_collision = true;
g->self.proof_melee = true;
g->self.proof_explosion = true;
g->self.proof_steam = true;
g->self.proof_drown = true;
g->self.proof_water = true;
g.self.proof_bullet = true;
g.self.proof_fire = true;
g.self.proof_collision = true;
g.self.proof_melee = true;
g.self.proof_explosion = true;
g.self.proof_steam = true;
g.self.proof_drown = true;
g.self.proof_water = true;
}
ImGui::SameLine();
if (ImGui::Button("Uncheck all"))
{
g->self.proof_bullet = false;
g->self.proof_fire = false;
g->self.proof_collision = false;
g->self.proof_melee = false;
g->self.proof_explosion = false;
g->self.proof_steam = false;
g->self.proof_drown = false;
g->self.proof_water = false;
g.self.proof_bullet = false;
g.self.proof_fire = false;
g.self.proof_collision = false;
g.self.proof_melee = false;
g.self.proof_explosion = false;
g.self.proof_steam = false;
g.self.proof_drown = false;
g.self.proof_water = false;
}
ImGui::BeginGroup();
ImGui::Checkbox("Bullet", &g->self.proof_bullet);
ImGui::Checkbox("Fire", &g->self.proof_fire);
ImGui::Checkbox("Bullet", &g.self.proof_bullet);
ImGui::Checkbox("Fire", &g.self.proof_fire);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Collision", &g->self.proof_collision);
ImGui::Checkbox("Melee", &g->self.proof_melee);
ImGui::Checkbox("Collision", &g.self.proof_collision);
ImGui::Checkbox("Melee", &g.self.proof_melee);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Explosion", &g->self.proof_explosion);
ImGui::Checkbox("Steam", &g->self.proof_steam);
ImGui::Checkbox("Explosion", &g.self.proof_explosion);
ImGui::Checkbox("Steam", &g.self.proof_steam);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Drown", &g->self.proof_drown);
ImGui::Checkbox("Water", &g->self.proof_water);
ImGui::Checkbox("Drown", &g.self.proof_drown);
ImGui::Checkbox("Water", &g.self.proof_water);
ImGui::EndGroup();
@ -149,18 +149,18 @@ namespace big
components::sub_title("Police");
ImGui::Checkbox("Never Wanted", &g->self.never_wanted);
ImGui::Checkbox("Never Wanted", &g.self.never_wanted);
if (!g->self.never_wanted)
if (!g.self.never_wanted)
{
ImGui::Checkbox("Force Wanted Level", &g->self.force_wanted_level);
ImGui::Checkbox("Force Wanted Level", &g.self.force_wanted_level);
ImGui::Text("Wanted Level");
if (
ImGui::SliderInt("###wanted_level", &g->self.wanted_level, 0, 5) &&
!g->self.force_wanted_level &&
ImGui::SliderInt("###wanted_level", &g.self.wanted_level, 0, 5) &&
!g.self.force_wanted_level &&
g_local_player != nullptr
) {
g_local_player->m_player_info->m_wanted_level = g->self.wanted_level;
g_local_player->m_player_info->m_wanted_level = g.self.wanted_level;
}
}
@ -170,86 +170,86 @@ namespace big
ImGui::BeginGroup();
ImGui::Checkbox("Hide Radar", &g->self.hide_radar);
ImGui::Checkbox("Hide Radar", &g.self.hide_radar);
ImGui::SameLine();
ImGui::Checkbox("Hide Ammo", &g->self.hide_ammo);
ImGui::Checkbox("Hide Ammo", &g.self.hide_ammo);
ImGui::SameLine();
ImGui::Checkbox("Force show HUD", &g->self.force_show_hud);
ImGui::Checkbox("Force show HUD", &g.self.force_show_hud);
ImGui::Combo("##hud_comp_combo", &g->self.selected_hud_component, hud_component_names, (int)HudComponents::HUD_WEAPONS);
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;
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;
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;
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;
g.self.hud_components_states[i] = true;
}
});
ImGui::SameLine();
components::button("Show all", [] {
g->self.hide_radar = false;
g->self.hide_ammo = false;
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;
g.self.hud_components_states[i] = false;
}
});
ImGui::SameLine();
ImGui::Checkbox("Force show HUD element", &g->self.force_show_hud_element);
ImGui::Checkbox("Force show HUD element", &g.self.force_show_hud_element);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("To force show a HUD specific element, click Hide all then click Show on the desired element.");
ImGui::EndGroup();
g->self.proof_mask = 0;
if (g->self.god_mode)
g.self.proof_mask = 0;
if (g.self.god_mode)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::GOD);
g.self.proof_mask |= static_cast<int>(eEntityProofs::GOD);
}
if (g->self.proof_bullet)
if (g.self.proof_bullet)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
g.self.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
}
if (g->self.proof_fire)
if (g.self.proof_fire)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
g.self.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
}
if (g->self.proof_collision)
if (g.self.proof_collision)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
g.self.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
}
if (g->self.proof_melee)
if (g.self.proof_melee)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
g.self.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
}
if (g->self.proof_explosion)
if (g.self.proof_explosion)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
g.self.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
}
if (g->self.proof_steam)
if (g.self.proof_steam)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
g.self.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
}
if (g->self.proof_drown)
if (g.self.proof_drown)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::DROWN);
g.self.proof_mask |= static_cast<int>(eEntityProofs::DROWN);
}
if (g->self.proof_water)
if (g.self.proof_water)
{
g->self.proof_mask |= static_cast<int>(eEntityProofs::WATER);
g.self.proof_mask |= static_cast<int>(eEntityProofs::WATER);
}
}
}

View File

@ -21,7 +21,7 @@ namespace big
teleport::to_objective();
});
ImGui::Checkbox("Auto-Teleport To Waypoint", &g->self.auto_tp);
ImGui::Checkbox("Auto-Teleport To Waypoint", &g.self.auto_tp);
ImGui::Text("Vehicles:");

View File

@ -15,30 +15,30 @@ namespace big
ImGui::BeginGroup();
ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo);
ImGui::Checkbox("Infinite Clip", &g->weapons.infinite_mag);
ImGui::Checkbox("Infinite Ammo", &g.weapons.infinite_ammo);
ImGui::Checkbox("Infinite Clip", &g.weapons.infinite_mag);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
if (ImGui::Checkbox("Bypass C4 Limit", &g->weapons.bypass_c4_limit))
if (ImGui::Checkbox("Bypass C4 Limit", &g.weapons.bypass_c4_limit))
{
if (g->weapons.bypass_c4_limit)
if (g.weapons.bypass_c4_limit)
g_pointers->m_bypass_max_count_of_active_sticky_bombs->apply();
else
g_pointers->m_bypass_max_count_of_active_sticky_bombs->restore();
}
ImGui::Checkbox("Rapid Fire", &g->weapons.rapid_fire);
ImGui::Checkbox("Rapid Fire", &g.weapons.rapid_fire);
ImGui::EndGroup();
ImGui::Separator();
ImGui::Checkbox("Enable Special Ammo", &g->weapons.ammo_special.toggle);
ImGui::Checkbox("Enable Special Ammo", &g.weapons.ammo_special.toggle);
eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type;
eExplosionTag selected_explosion = g->weapons.ammo_special.explosion_tag;
eAmmoSpecialType selected_ammo = g.weapons.ammo_special.type;
eExplosionTag selected_explosion = g.weapons.ammo_special.explosion_tag;
if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name))
{
@ -46,7 +46,7 @@ namespace big
{
if (ImGui::Selectable(special_ammo.name, special_ammo.type == selected_ammo))
{
g->weapons.ammo_special.type = special_ammo.type;
g.weapons.ammo_special.type = special_ammo.type;
}
if (special_ammo.type == selected_ammo)
@ -64,7 +64,7 @@ namespace big
{
if (ImGui::Selectable(name, type == selected_explosion))
{
g->weapons.ammo_special.explosion_tag = type;
g.weapons.ammo_special.explosion_tag = type;
}
if (type == selected_explosion)
@ -80,15 +80,15 @@ namespace big
components::sub_title("Misc");
ImGui::Checkbox("Force Crosshairs", &g->weapons.force_crosshairs);
ImGui::Checkbox("Force Crosshairs", &g.weapons.force_crosshairs);
ImGui::SameLine();
ImGui::Checkbox("No Recoil", &g->weapons.no_recoil);
ImGui::Checkbox("No Recoil", &g.weapons.no_recoil);
ImGui::SameLine();
ImGui::Checkbox("No Spread", &g->weapons.no_spread);
ImGui::Checkbox("No Spread", &g.weapons.no_spread);
components::button("Get All Weapons", []
{
@ -111,13 +111,13 @@ namespace big
}
});
ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f");
ImGui::SliderFloat("Damage Multiplier", &g.weapons.increased_damage, 1.f, 10.f, "%.1f");
ImGui::Separator();
components::sub_title("Custom Weapons");
CustomWeapon selected = g->weapons.custom_weapon;
CustomWeapon selected = g.weapons.custom_weapon;
if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name))
{
@ -125,7 +125,7 @@ namespace big
{
if (ImGui::Selectable(weapon.name, weapon.id == selected))
{
g->weapons.custom_weapon = weapon.id;
g.weapons.custom_weapon = weapon.id;
}
if (weapon.id == selected)
@ -140,11 +140,20 @@ namespace big
switch (selected)
{
case CustomWeapon::VEHICLE_GUN:
components::input_text_with_hint(
"Shooting Model",
"Name of the vehicle model",
g->weapons.vehicle_gun_model, sizeof(g->weapons.vehicle_gun_model)
);
// this some ugly ass looking code
static char vehicle_gun[12];
std::memcpy(vehicle_gun, g.weapons.vehicle_gun_model.c_str(), 12);
if (ImGui::InputTextWithHint("Shooting Model", "Name of the vehicle model", vehicle_gun, sizeof(vehicle_gun)))
{
g.weapons.vehicle_gun_model = vehicle_gun;
}
if (ImGui::IsItemActive())
{
g_fiber_pool->queue_job([]
{
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
});
}
break;
}