diff --git a/include/hacks/Announcer.hpp b/include/hacks/Announcer.hpp index 118252d9..70d50e1d 100755 --- a/include/hacks/Announcer.hpp +++ b/include/hacks/Announcer.hpp @@ -16,6 +16,7 @@ namespace shared namespace announcer { +void playsound(const std::string&); void init(); void shutdown(); } diff --git a/include/menu/ncc/List.hpp b/include/menu/ncc/List.hpp index d2eb5042..ecd9acad 100755 --- a/include/menu/ncc/List.hpp +++ b/include/menu/ncc/List.hpp @@ -28,6 +28,8 @@ public: void FillWithCatVars(std::vector vec); void OpenSublist(List *sublist, int dy); bool ShouldClose(); + static void ShowInvalidCatVars(); + static void ShowMissingCatVars(); static List *FromString(const std::string &string); @@ -48,6 +50,20 @@ public: List *open_sublist{ nullptr }; std::string title; }; +class DecoyCatVar +{ + CatVar_t type{ CV_SWITCH }; + const std::string name; + int defaults{ 0 }; + const std::string desc_short{ "" }; + const std::string desc_long{ "INVALID COMMAND" }; + bool registered{ false }; + +public: + DecoyCatVar(const std::string value) : desc_short(value) + { + } +}; } } #endif diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index a0dd7470..ae5fe55e 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -50,6 +50,9 @@ CatVar tauntslide(CV_SWITCH, "tauntslide", "0", "TF2C tauntslide", CatVar tauntslide_tf2(CV_SWITCH, "tauntslide_tf2", "0", "Tauntslide", "Allows free movement while taunting with movable " "taunts\nOnly works in tf2"); +CatVar + show_spectators(CV_SWITCH, "show_spectators", "0", "Show spectators", + "Show who's spectating you\nonly works in valve servers"); void *C_TFPlayer__ShouldDraw_original = nullptr; @@ -108,7 +111,6 @@ CatCommand void CreateMove() { - // Crithack static IClientEntity *localplayer, *weapon, *last_weapon = nullptr; static int tries, cmdn, md5seed, rseed, c, b; @@ -123,22 +125,23 @@ void CreateMove() static IClientEntity *last_checked_weapon = nullptr; /*IF_GAME (IsTF2()) { - if (crit_hack_next && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && WeaponCanCrit() && RandomCrits()) { - PROF_SECTION(CM_misc_crit_hack_prediction); - weapon = RAW_ENT(LOCAL_W); - // IsBaseCombatWeapon - if (weapon && - vfunc(weapon, 1944 / 4, 0)(weapon)) { - /*if (experimental_crit_hack.KeyDown()) { - if (!g_pUserCmd->command_number || critWarmup < 8) { - if (g_pUserCmd->buttons & IN_ATTACK) { - critWarmup++; - } else { - critWarmup = 0; - } - g_pUserCmd->buttons &= ~(IN_ATTACK); - } - }*/ /* + if (crit_hack_next && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && + WeaponCanCrit() && RandomCrits()) { + PROF_SECTION(CM_misc_crit_hack_prediction); + weapon = RAW_ENT(LOCAL_W); + // IsBaseCombatWeapon + if (weapon && + vfunc(weapon, 1944 / 4, 0)(weapon)) { + /*if (experimental_crit_hack.KeyDown()) { + if (!g_pUserCmd->command_number || critWarmup < 8) { + if (g_pUserCmd->buttons & IN_ATTACK) { + critWarmup++; + } else { + critWarmup = 0; + } + g_pUserCmd->buttons &= ~(IN_ATTACK); + } + }*/ /* if (g_pUserCmd->command_number && (last_checked_weapon != weapon || last_checked_command_number < @@ -280,7 +283,7 @@ void CreateMove() static bool flswitch = false; if (flswitch && !g_pUserCmd->impulse) g_pUserCmd->impulse = 100; - flswitch = !flswitch; + flswitch = !flswitch; } } @@ -317,7 +320,7 @@ void CreateMove() if (!(hacks::shared::antiaim::enabled && hacks::shared::antiaim::yaw_mode && !(side || forward))) - g_pUserCmd->viewangles.y = camera_angle[1]; + g_pUserCmd->viewangles.y = camera_angle[1]; g_pLocalPlayer->v_OrigViewangles.y = camera_angle[1]; // Use silent since we dont want to prevent the player from @@ -375,7 +378,37 @@ void DrawText() fonts::font_main, color); }*/ - + if (show_spectators) + { + for (int i = 0; i < 32; i++) + { + // Assign the for loops tick number to an ent + CachedEntity *ent = ENTITY(i); + player_info_s info; + if (!CE_BAD(ent) && ent != LOCAL_E && + ent->m_Type == ENTITY_PLAYER && + (CE_INT(ent, netvar.hObserverTarget) & 0xFFF) == + LOCAL_E->m_IDX && + CE_INT(ent, netvar.iObserverMode) >= 4 && + g_IEngine->GetPlayerInfo(i, &info)) + { + auto observermode = "N/A"; + switch (CE_INT(ent, netvar.iObserverMode)) + { + case 4: + observermode = "Firstperson"; + break; + case 5: + observermode = "Thirdperson"; + break; + case 7: + observermode = "Freecam"; + break; + } + AddSideString(format(info.name, " ", observermode)); + } + } + } if (!debug_info) return; if (CE_GOOD(g_pLocalPlayer->weapon())) @@ -655,9 +688,9 @@ static CatCommand const char *ft = (args.ArgC() > 1 ? args[2] : 0); DumpRecvTable(ent, clz->m_pRecvTable, 0, ft, 0); }); -} -} -} +} // namespace misc +} // namespace shared +} // namespace hacks /*void DumpRecvTable(CachedEntity* ent, RecvTable* table, int depth, const char* ft, unsigned acc_offset) { bool forcetable = ft && strlen(ft); if (!forcetable diff --git a/src/menu/GUI.cpp b/src/menu/GUI.cpp index 6be2b76a..e02d5d97 100755 --- a/src/menu/GUI.cpp +++ b/src/menu/GUI.cpp @@ -37,8 +37,10 @@ CatVar gui_visible(CV_SWITCH, "gui_visible", "0", "GUI Active", "GUI switch (bind it to a key!)"); CatVar gui_draw_bounds(CV_SWITCH, "gui_bounds", "0", "Draw Bounds", "Draw GUI elements' bounding boxes"); -// CatVar gui_nullcore(CV_SWITCH, "gui_nullcore", "1", "NullCore GUI", "Use -// NullCoreCheat GUI"); +CatCommand debug_invalid("debug_invalid", "Display all invalid CatVars", + []() { menu::ncc::List::ShowInvalidCatVars(); }); +CatCommand debug_missing("debug_missing", "Display all missing CatVars", + []() { menu::ncc::List::ShowMissingCatVars(); }); CatGUI::CatGUI() { @@ -76,6 +78,7 @@ int NCGUIColor() void CatGUI::Setup() { menu::ncc::Init(); + menu::ncc::List::ShowInvalidCatVars(); root_nullcore = menu::ncc::root; gui_visible.OnRegister([](CatVar *var) { var->convar->InstallChangeCallback(GUIVisibleCallback); diff --git a/src/menu/ncc/ItemVariable.cpp b/src/menu/ncc/ItemVariable.cpp index 7fb19021..1d092554 100755 --- a/src/menu/ncc/ItemVariable.cpp +++ b/src/menu/ncc/ItemVariable.cpp @@ -40,7 +40,8 @@ void ItemVariable::Change(float amount) { case CV_SWITCH: { - catvar = !catvar; + if (catvar.desc_long != "INVALID COMMAND") + catvar = !catvar; } break; case CV_ENUM: @@ -89,7 +90,8 @@ void ItemVariable::OnMousePress() capturing = true; } if (catvar.type == CV_SWITCH) - catvar = !catvar; + if (catvar.desc_long != "INVALID COMMAND") + catvar = !catvar; } void ItemVariable::OnFocusLose() @@ -107,7 +109,7 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat) if (capturing) { if (key == ButtonCode_t::KEY_ESCAPE) - key = (ButtonCode_t) 0; + key = (ButtonCode_t) 0; catvar = (int) key; capturing = false; return; @@ -159,10 +161,10 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat) if (key == ButtonCode_t::MOUSE_WHEEL_UP) { - if (catvar.type == CV_FLOAT && + if ((catvar.type == CV_FLOAT || catvar.type == CV_INT) && g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT)) Change(change * 2); - else if (catvar.type == CV_FLOAT && + else if ((catvar.type == CV_FLOAT || catvar.type == CV_INT) && g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LCONTROL)) Change(change / 4); else @@ -189,7 +191,8 @@ void ItemVariable::Draw(int x, int y) { case CV_SWITCH: { - val = catvar ? "ON" : "OFF"; + if (catvar.desc_long != "INVALID COMMAND") + val = catvar ? "ON" : "OFF"; } break; case CV_INT: diff --git a/src/menu/ncc/List.cpp b/src/menu/ncc/List.cpp index 14146321..6a5c23b6 100755 --- a/src/menu/ncc/List.cpp +++ b/src/menu/ncc/List.cpp @@ -18,6 +18,7 @@ namespace menu { namespace ncc { +std::vector invalidvars, missingvars, menu_vars; List::List(std::string title) : open_sublist(nullptr), title(title), got_mouse(false), @@ -100,8 +101,51 @@ CatVar *FindCatVar(const std::string name) if (var->name == name) return var; } - logging::Info("can't find %s", name.c_str()); - throw std::runtime_error("can't find catvar " + name); + invalidvars.push_back(name); + DecoyCatVar *unknownvar = + new DecoyCatVar(format("Error, can't find ", name)); + logging::Info("Can't find %s", name.c_str()); + return (CatVar *) unknownvar; +} + +void FindMissingCatVars() +{ + for (auto var : CatVarList()) + { + if (std::find(menu_vars.begin(), menu_vars.end(), var->name) == + menu_vars.end()) + missingvars.push_back(var->name); + } +} + +void List::ShowInvalidCatVars() +{ + if (invalidvars.size()) + { + g_ICvar->ConsolePrintf("The following CatVars are invalid\n"); + for (int i = 0; i < invalidvars.size(); i++) + g_ICvar->ConsolePrintf("%s\n", invalidvars[i].c_str()); + } + else + g_ICvar->ConsolePrintf("No CatVars are invalid\n"); + static bool init = false; + if (!init) + { + FindMissingCatVars(); + init = true; + } +} + +void List::ShowMissingCatVars() +{ + if (missingvars.size()) + { + g_ICvar->ConsolePrintf("The following CatVars are missing\n"); + for (int i = 0; i < missingvars.size(); i++) + g_ICvar->ConsolePrintf("%s\n", missingvars[i].c_str()); + } + else + g_ICvar->ConsolePrintf("No CatVars are missing\n"); } // abc def, ghj, [, fdg sgf saqw rter, ], gs void FillFromTokens(List *list, const std::vector &tokens) @@ -114,6 +158,7 @@ void FillFromTokens(List *list, const std::vector &tokens) if (i == tokens.size() - 1 || tokens[i + 1] != "[") { list->AddChild(new ItemVariable(*FindCatVar(str))); + menu_vars.push_back(str); } else { diff --git a/src/menu/ncc/Menu.cpp b/src/menu/ncc/Menu.cpp index 7f3e0838..f27a12bd 100644 --- a/src/menu/ncc/Menu.cpp +++ b/src/menu/ncc/Menu.cpp @@ -451,6 +451,7 @@ static const std::string list_tf2 = R"( "gui_ncc_font_family" "gui_ncc_font_title_family" "fast_outline" + "show_spectators" "ESP" [ "ESP Menu" "esp_enabled" @@ -586,7 +587,7 @@ static const std::string list_tf2 = R"( "Air Stuck Menu" "airstuck" ] - "Anti-/Anti-Aim" [ + "Anti-Aim" [ "Anti-Aim Menu" "aa_enabled" "aa_realfakes" @@ -603,7 +604,8 @@ static const std::string list_tf2 = R"( "aa_no_clamp" "resolver" "identify" - "Anti Anti Aim" [ + "Anti-/Anti-Aim" [ + "Anti-/Anti-Aim" "aa_aaaa_enabled" "aa_aaaa_flip_key" "aa_aaaa_mode"