Skip to content
Permalink
Browse files

Merge pull request #825 from nullworks/lightcat

Fixes & Improvements
  • Loading branch information...
BenCat07 committed Oct 3, 2019
2 parents 59957b1 + 9d94f11 commit ef07b6ac208ad06d5b20ff1f135bb85ac9dc2dd2
Showing with 118 additions and 25 deletions.
  1. +1 −1 data/menu/nullifiedcat/misc/collective.xml
  2. +15 −1 src/hacks/Misc.cpp
  3. +75 −19 src/hacks/SkinChanger.cpp
  4. +11 −3 src/hooks/CreateMove.cpp
  5. +16 −1 src/settings/SettingsIO.cpp
@@ -16,7 +16,7 @@
<AutoVariable width="fill" target="misc.no-lerp" label="nolerp"/>
<AutoVariable width="fill" target="misc.no-push" label="nopush"/>
<AutoVariable width="fill" target="misc.roll-speedhack" label="Moonwalk"/>
<AutoVariable width="fill" target="misc.semi-auto" label="Semiauto Fire"/>
<AutoVariable width="fill" target="misc.full-auto" label="Fully Automated Firing"/>
<AutoVariable width="fill" target="misc.show-spectators" label="Show spectators"/>
<LabeledObject width="fill" label="Skybox Override">
<Select target="misc.skybox-override">
@@ -31,6 +31,7 @@ static settings::Boolean tauntslide_tf2{ "misc.tauntslide", "false" };
static settings::Boolean flashlight_spam{ "misc.flashlight-spam", "false" };
static settings::Boolean auto_balance_spam{ "misc.auto-balance-spam", "false" };
static settings::Boolean nopush_enabled{ "misc.no-push", "false" };
static settings::Boolean dont_hide_stealth_kills{ "misc.dont-hide-stealth-kills", "true" };

#if ENABLE_VISUALS
static settings::Boolean god_mode{ "misc.god-mode", "false" };
@@ -751,8 +752,21 @@ static InitRoutine init([]() {

static BytePatch stealth_kill{ gSignatures.GetClientSignature, "84 C0 75 28 A1", 2, { 0x90, 0x90 } }; // stealth kill patch
stealth_kill.Patch();
static BytePatch cyoa_patch{ gSignatures.GetClientSignature, "74 20 A1 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24", 0, { 0xEB } };
cyoa_patch.Patch();
EC::Register(
EC::Shutdown, []() { stealth_kill.Shutdown(); }, "shutdown_stealthkill");
EC::Shutdown,
[]() {
stealth_kill.Shutdown();
cyoa_patch.Shutdown();
},
"shutdown_stealthkill");
dont_hide_stealth_kills.installChangeCallback([](settings::VariableBase<bool> &, bool after) {
if (after)
stealth_kill.Patch();
else
stealth_kill.Shutdown();
});
#endif
#endif
});
@@ -6,6 +6,7 @@
*/

#include "common.hpp"
#include "MiscTemporary.hpp"

#include <sys/dir.h>
#include <sys/stat.h>
@@ -110,23 +111,65 @@ static CatCommand australize("australize", "Make everything australium", []() {
InvalidateCookie();
});
static CatCommand set_attr("skinchanger_set", "Set Attribute", [](const CCommand &args) {
enable = true;
unsigned attrid = strtoul(args.Arg(1), nullptr, 10);
float attrv = strtof(args.Arg(2), nullptr);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).Set(attrid, attrv);
InvalidateCookie();
if (args.ArgC() < 1)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please Provide an Argument\n");
return;
}
enable = true;
try
{
if (CE_BAD(LOCAL_W))
return;
unsigned attrid = std::strtoul(args.Arg(1), nullptr, 10);
float attrv = std::strtof(args.Arg(2), nullptr);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).Set(attrid, attrv);
InvalidateCookie();
}
catch (std::invalid_argument)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please pass a valid int\n");
}
});
static CatCommand remove_attr("skinchanger_remove", "Remove attribute", [](const CCommand &args) {
enable = true;
unsigned attrid = strtoul(args.Arg(1), nullptr, 10);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).Remove(attrid);
InvalidateCookie();
if (args.ArgC() < 1)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please Provide an Argument\n");
return;
}
try
{
if (CE_BAD(LOCAL_W))
return;
enable = true;
unsigned attrid = std::strtoul(args.Arg(1), nullptr, 10);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).Remove(attrid);
InvalidateCookie();
}
catch (std::invalid_argument)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please pass a valid int\n");
}
});
static CatCommand set_redirect("skinchanger_redirect", "Set Redirect", [](const CCommand &args) {
enable = true;
unsigned redirect = strtoul(args.Arg(1), nullptr, 10);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).defidx_redirect = redirect;
InvalidateCookie();
if (args.ArgC() < 1)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please Provide an Argument\n");
return;
}
try
{
if (CE_BAD(LOCAL_W))
return;
enable = true;
unsigned redirect = std::strtoul(args.Arg(1), nullptr, 10);
GetModifier(CE_INT(LOCAL_W, netvar.iItemDefinitionIndex)).defidx_redirect = redirect;
InvalidateCookie();
}
catch (std::invalid_argument)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please pass a valid int\n");
}
});
static CatCommand dump_attrs("skinchanger_debug_attrs", "Dump attributes", []() {
CAttributeList *list = (CAttributeList *) ((uintptr_t)(RAW_ENT(LOCAL_W)) + netvar.AttributeList);
@@ -142,7 +185,7 @@ static CatCommand list_redirects("skinchanger_redirect_list", "Dump redirects",
{
if (mod.second.defidx_redirect)
{
logging::Info("%d -> %d", mod.first, mod.second.defidx_redirect);
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "%d -> %d\n", mod.first, mod.second.defidx_redirect);
}
}
});
@@ -173,11 +216,24 @@ static CatCommand load_merge("skinchanger_load_merge", "Load with merge", [](con
Load(filename, true);
});
static CatCommand remove_redirect("skinchanger_remove_redirect", "Remove redirect", [](const CCommand &args) {
enable = true;
unsigned redirectid = strtoul(args.Arg(1), nullptr, 10);
GetModifier(redirectid).defidx_redirect = 0;
logging::Info("Redirect removed");
InvalidateCookie();
if (args.ArgC() < 1)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please Provide an argument\n");
}
try
{
if (CE_BAD(LOCAL_W))
return;
enable = true;
unsigned redirectid = std::strtoul(args.Arg(1), nullptr, 10);
GetModifier(redirectid).defidx_redirect = 0;
logging::Info("Redirect removed");
InvalidateCookie();
}
catch (std::invalid_argument)
{
g_ICvar->ConsoleColorPrintf(MENU_COLOR, "Please supply a valid int\n");
}
});
static CatCommand reset("skinchanger_reset", "Reset", []() { modifier_map.clear(); });

@@ -22,9 +22,10 @@

static settings::Boolean minigun_jump{ "misc.minigun-jump-tf2c", "false" };
static settings::Boolean roll_speedhack{ "misc.roll-speedhack", "false" };
static settings::Boolean forward_speedhack{ "misc.roll-speedhack.forward", "false" };
static settings::Boolean engine_pred{ "misc.engine-prediction", "true" };
static settings::Boolean debug_projectiles{ "debug.projectiles", "false" };
static settings::Int semiauto{ "misc.semi-auto", "0" };
static settings::Int fullauto{ "misc.full-auto", "0" };
static settings::Int fakelag_amount{ "misc.fakelag", "0" };
static settings::Boolean fuckmode{ "misc.fuckmode", "false" };

@@ -286,9 +287,9 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
++attackticks;
else
attackticks = 0;
if (semiauto)
if (fullauto)
if (current_user_cmd->buttons & IN_ATTACK)
if (attackticks % *semiauto < *semiauto - 1)
if (attackticks % *fullauto + 1 < *fullauto)
current_user_cmd->buttons &= ~IN_ATTACK;
static int fakelag_queue = 0;
if (CE_GOOD(LOCAL_E))
@@ -348,7 +349,14 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
if (fabs(speed) > 0.0f)
{

if (forward_speedhack)
{
cmd->forwardmove *= -1.0f;
cmd->sidemove *= -1.0f;
cmd->viewangles.x = 91;
}
Vector vecMove(cmd->forwardmove, cmd->sidemove, 0.0f);

vecMove *= -1;
float flLength = vecMove.Length();
Vector angMoveReverse{};
@@ -148,7 +148,6 @@ void settings::SettingsReader::pushChar(char c)
}
else
{

was_non_space = true;
}

@@ -186,6 +185,17 @@ void settings::SettingsReader::pushChar(char c)
}
}

struct migration_struct
{
const std::string from;
const std::string to;
};
/* clang-format off */
// Use one per line, from -> to
static std::array<migration_struct, 1> migrations = {
{ "misc.semi-auto", "misc.full-auto" }
};
/* clang-format on */
void settings::SettingsReader::finishString(bool complete)
{
if (complete && reading_key)
@@ -199,6 +209,11 @@ void settings::SettingsReader::finishString(bool complete)
if (reading_key)
{
stored_key = std::move(str);
for (auto &migration : migrations)
{
if (stored_key == migration.from)
stored_key = migration.to;
}
}
else
{

0 comments on commit ef07b6a

Please sign in to comment.
You can’t perform that action at this time.