diff --git a/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp b/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp index 38eae6b1..78040961 100644 --- a/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp +++ b/BigBaseV2/src/backend/looped/weapons/gravity_gun.cpp @@ -1,4 +1,5 @@ #include "backend/looped/looped.hpp" +#include "core/enums.hpp" #include "core/globals.hpp" #include "util/entity.hpp" #include "util/math.hpp" @@ -16,7 +17,7 @@ namespace big void looped::weapons_gravity_gun() { - bool bGravityGun = g.weapons.custom_weapon == 0; + bool bGravityGun = g.weapons.custom_weapon == CustomWeapons::GRAVITY_GUN; double multiplier = 3.0; if (bGravityGun) diff --git a/BigBaseV2/src/core/data/custom_weapons.hpp b/BigBaseV2/src/core/data/custom_weapons.hpp new file mode 100644 index 00000000..7a968743 --- /dev/null +++ b/BigBaseV2/src/core/data/custom_weapons.hpp @@ -0,0 +1,12 @@ +#pragma once +#include "core/enums.hpp" + +struct custom_weapon { + big::CustomWeapons id; + const char name[16]; +}; + +const custom_weapon custom_weapons[] = { + { big::CustomWeapons::NONE, "No weapon" }, + { big::CustomWeapons::GRAVITY_GUN, "Gravity Gun" } +}; \ No newline at end of file diff --git a/BigBaseV2/src/core/enums.hpp b/BigBaseV2/src/core/enums.hpp new file mode 100644 index 00000000..111f0d03 --- /dev/null +++ b/BigBaseV2/src/core/enums.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace big +{ + enum class CustomWeapons + { + NONE, + GRAVITY_GUN + }; +} \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 526fd52b..4b9f4d21 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -1,4 +1,5 @@ #pragma once +#include "enums.hpp" #ifndef GLOBALS_H #define GLOBALS_H @@ -9,7 +10,7 @@ struct globals { }; struct weapons { - int custom_weapon = -1; + big::CustomWeapons custom_weapon = big::CustomWeapons::NONE; }; self self{}; diff --git a/BigBaseV2/src/gui/window/main/tab_weapons.cpp b/BigBaseV2/src/gui/window/main/tab_weapons.cpp new file mode 100644 index 00000000..98975f4b --- /dev/null +++ b/BigBaseV2/src/gui/window/main/tab_weapons.cpp @@ -0,0 +1,37 @@ +#include "core/data/custom_weapons.hpp" +#include "core/globals.hpp" +#include "gui/window/main/tabs.hpp" + +namespace big +{ + void tab_main::tab_weapons() + { + if (ImGui::BeginTabItem("Weapons")) + { + if (ImGui::TreeNode("Custom Weapons")) + { + int selected = (int)g.weapons.custom_weapon; + + if (ImGui::BeginCombo("Weapon", custom_weapons[selected].name)) + { + for (custom_weapon weapon : custom_weapons) + { + if (ImGui::Selectable(weapon.name, weapon.id == (CustomWeapons)selected)) + { + g.weapons.custom_weapon = weapon.id; + } + + if (weapon.id == (CustomWeapons)selected) + ImGui::SetItemDefaultFocus(); + } + + ImGui::EndCombo(); + } + + ImGui::TreePop(); + } + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/main/tabs.hpp b/BigBaseV2/src/gui/window/main/tabs.hpp index 0cf5c480..c25ee651 100644 --- a/BigBaseV2/src/gui/window/main/tabs.hpp +++ b/BigBaseV2/src/gui/window/main/tabs.hpp @@ -8,5 +8,6 @@ namespace big public: static void tab_self(); static void tab_spawn(); + static void tab_weapons(); }; } \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/window_main.cpp b/BigBaseV2/src/gui/window/window_main.cpp index 4cb51d2f..e4b909d3 100644 --- a/BigBaseV2/src/gui/window/window_main.cpp +++ b/BigBaseV2/src/gui/window/window_main.cpp @@ -1,6 +1,5 @@ #include "gui/window.hpp" #include "imgui.h" -#include "gui/base_tab.h" #include "gui/window/main/tabs.hpp" namespace big @@ -13,6 +12,7 @@ namespace big ImGui::BeginTabBar("tabbar"); tab_main::tab_self(); tab_main::tab_spawn(); + tab_main::tab_weapons(); ImGui::EndTabBar(); } ImGui::End();