Add cheat dvars

This commit is contained in:
Federico Cecchetto 2021-08-27 16:38:20 +02:00
parent 25427a586d
commit 93aec8e726
5 changed files with 98 additions and 59 deletions

View File

@ -169,7 +169,7 @@ namespace fps
void post_unpack() override
{
cg_drawspeed = dvars::register_int("cg_drawSpeed", 0, 0, 2, game::DVAR_FLAG_SAVED);
cg_drawfps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED);
cg_drawfps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED, false);
scheduler::loop(draw, scheduler::pipeline::renderer);
}

View File

@ -38,6 +38,27 @@ namespace patches
dvars::register_float("jump_height", 39, 0, 1000, game::DVAR_FLAG_REPLICATED);
dvars::register_float("g_gravity", 800, 1, 1000, game::DVAR_FLAG_REPLICATED);
dvars::register_int("g_speed", 190, 0, 1000, game::DVAR_FLAG_REPLICATED);
dvars::register_bool("sf_use_martyr_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_precision_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_greenberet_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_slowmo", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_fortitude_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_desperation_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_polterghost_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_wolf_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_attraction_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_starvation_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_ignoreammo", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_pineapple_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_football_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_tire_explosion", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_clustergrenade", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_pomegrenade_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_pinata_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_chaplin", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_edge_mode", false, game::DVAR_FLAG_NONE);
dvars::register_bool("sf_use_bw", false, game::DVAR_FLAG_NONE);
}
};
}

View File

@ -18,6 +18,7 @@ namespace dvars
game::dvar_t* jump_enableFallDamage;
game::dvar_t* r_fullbright;
game::dvar_t* r_chams;
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
{
@ -1158,38 +1159,54 @@ namespace dvars
"xblive_privatematch_solo"
};
game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags)
game::dvar_t* register_int(const std::string& name, int value, int min, int max,
game::DvarFlags flags, bool add_to_list)
{
const auto hash = game::generateHashValue(name.data());
dvar_list.push_back(name);
if (add_to_list)
{
dvar_list.push_back(name);
}
return game::Dvar_RegisterInt(hash, "", value, min, max, flags);
}
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags)
game::dvar_t* register_bool(const std::string& name, bool value,
game::DvarFlags flags, bool add_to_list)
{
const auto hash = game::generateHashValue(name.data());
dvar_list.push_back(name);
if (add_to_list)
{
dvar_list.push_back(name);
}
return game::Dvar_RegisterBool(hash, "", value, flags);
}
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags)
game::dvar_t* register_float(const std::string& name, float value, float min,
float max, game::DvarFlags flags, bool add_to_list)
{
const auto hash = game::generateHashValue(name.data());
dvar_list.push_back(name);
if (add_to_list)
{
dvar_list.push_back(name);
}
return game::Dvar_RegisterFloat(hash, "", value, min, max, flags);
}
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, game::DvarFlags flags)
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z,
float w, float min, float max, game::DvarFlags flags, bool add_to_list)
{
const auto hash = game::generateHashValue(name.data());
dvar_list.push_back(name);
if (add_to_list)
{
dvar_list.push_back(name);
}
return game::Dvar_RegisterVec4(hash, "", x, y, z, w, min, max, flags);
}

View File

@ -19,14 +19,15 @@ namespace dvars
extern game::dvar_t* jump_enableFallDamage;
extern game::dvar_t* r_fullbright;
extern game::dvar_t* r_chams;
extern std::vector<std::string> dvar_list;
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);
std::string dvar_get_domain(const game::dvar_type type, const game::dvar_limits& domain);
game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags);
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags);
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags);
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, game::DvarFlags flags);
game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags, bool add_to_list = true);
game::dvar_t* register_bool(const std::string& name, bool value, game::DvarFlags flags, bool add_to_list = true);
game::dvar_t* register_float(const std::string& name, float value, float min, float max, game::DvarFlags flags, bool add_to_list = true);
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, game::DvarFlags flags, bool add_to_list = true);
}

View File

@ -68,9 +68,9 @@ namespace scripting
{"gettime", 62},
{"sub_7ff7de282330", 63},
{"getentbynum", 64},
{"sub_7ff7de282620", 65},
{"getzonecount", 66},
{"sub_7ff7de2828b0", 67},
{"getscreenwidth", 65},
{"getscreenheight", 66},
{"getweaponmodel", 67},
{"setgameendtime", 68},
{"sub_7ff7de292c50", 69},
{"sub_7ff7de292c90", 70},
@ -225,11 +225,11 @@ namespace scripting
{"sub_7ff7de2950a0", 221},
{"sub_7ff7de295360", 222},
{"sub_7ff7de295520", 223},
{"sub_7ff7de295840", 224},
{"sub_7ff7de295730", 225},
{"sub_7ff7de295a40", 226},
{"sub_7ff7de295b40", 227},
{"errorinternal", 228},
{"getspawnerarray", 224},
{"getcorpsearray", 225},
{"getspawnerteamarray", 226},
{"getweaponclipmodel", 227},
{"getbrushmodelcenter", 228},
{"getkeybinding", 229},
{"max", 230},
{"floor", 231},
@ -298,9 +298,9 @@ namespace scripting
{"sub_7ff7de282e00", 299},
{"worldentnumber", 325},
{"sub_7ff7de292940", 328},
{"sub_7ff7de292a20", 329},
{"sub_7ff7de292a30", 330},
{"sub_7ff7de2852c0", 331},
{"visionsetnight", 329},
{"visionsetmissilecam", 330},
{"ambientstop", 331},
{"precachemodel", 332},
{"sub_7ff7de27b670", 333},
{"sub_7ff7de281fc0", 334},
@ -379,7 +379,7 @@ namespace scripting
{"getweaponflashtagname", 457},
{"summarizearraypoints", 458},
{"buildhudoutlineclientmaskfromentarray", 459},
{"getspawnerarray", 460},
{"sub_7ff7de46a010", 460},
{"sub_7ff7de27c020", 461},
{"sub_7ff7de27c050", 462},
{"sub_7ff7de27c0f0", 463},
@ -625,7 +625,7 @@ namespace scripting
{"thermaldrawenable", 32768},
{"playerforcedeathanim", 32769},
{"sub_7ff7de272590", 32794},
{"sub_7ff7de27fbc0", 32797},
{"attach", 32797},
{"sub_7ff7de294220", 32798},
{"sub_7ff7de294350", 32799},
{"sub_7ff7de2944c0", 32800},
@ -637,7 +637,7 @@ namespace scripting
{"nullsub_368", 32806},
{"setcoopplayerdatareservedint", 32808},
{"entitywillneverchange", 32809},
{"sub_7ff7de280510", 32810},
{"detach", 32810},
{"detachall", 32811},
{"getattachsize", 32812},
{"getattachmodelname", 32813},
@ -732,23 +732,23 @@ namespace scripting
{"playerlinkedoffsetenable", 32904},
{"setwaypointedgestyle_secondaryarrow", 32905},
{"setwaypointiconoffscreenonly", 32906},
{"changefontscaleovertime", 32907},
{"fadeovertime", 32907},
{"scaleovertime", 32908},
{"moveovertime", 32909},
{"reset", 32910},
{"destroy", 32911},
{"setpulsefx", 32912},
{"playersetexponentialfog", 32913},
{"fadeovertime", 32914},
{"sub_7ff7de2973d0", 32915},
{"sub_7ff7de2973f0", 32916},
{"sub_7ff7de2985c0", 32917},
{"sub_7ff7de2985e0", 32918},
{"sub_7ff7de295180", 32919},
{"sub_7ff7de28f530", 32920},
{"setplayernamestring", 32913},
{"changefontscaleovertime", 32914},
{"startignoringspotlight", 32915},
{"stopignoringspotlight", 32916},
{"dontcastshadows", 32917},
{"castshadows", 32918},
{"setstablemissile", 32919},
{"playersetgroundreferenceent", 32920},
{"dontinterpolate", 32921},
{"sub_7ff7de291390", 32922},
{"sub_7ff7de291430", 32923},
{"dospawn", 32922},
{"stalingradspawn", 32923},
{"getorigin", 32924},
{"getcentroid", 32925},
{"getshootatpos", 32926},
@ -960,25 +960,25 @@ namespace scripting
{"sub_7ff7de22bfb0", 33151},
{"sub_7ff7de22c0d0", 33152},
{"getenemysqdist", 33153},
{"sub_7ff7de2c15a0", 33154},
{"getclosestenemysqdist", 33154},
{"setthreatbiasgroup", 33155},
{"getthreatbiasgroup", 33156},
{"sub_7ff7de27b470", 33157},
{"turretfireenable", 33157},
{"setturretmodechangewait", 33158},
{"sub_7ff7de27ade0", 33159},
{"usetriggerrequirelookat", 33159},
{"getstance", 33160},
{"sub_7ff7de27f790", 33161},
{"setstance", 33161},
{"itemweaponsetammo", 33162},
{"sub_7ff7de27d240", 33163},
{"getammocount", 33163},
{"gettagorigin", 33164},
{"gettagangles", 33165},
{"sub_7ff7de288bc0", 33166},
{"shellshock", 33166},
{"stunplayer", 33167},
{"sub_7ff7de27d870", 33168},
{"sub_7ff7de27dad0", 33169},
{"stopshellshock", 33168},
{"fadeoutshellshock", 33169},
{"setdepthoffield", 33170},
{"setviewmodeldepthoffield", 33171},
{"sub_7ff7de285a30", 33172},
{"setmotionblurmovescale", 33172},
{"sub_7ff7de228f10", 33173},
{"sub_7ff7de228f60", 33174},
{"sub_7ff7de228fd0", 33175},
@ -1004,15 +1004,15 @@ namespace scripting
{"sub_7ff7de22a050", 33199},
{"sub_7ff7de228850", 33200},
{"sub_7ff7de22a1b0", 33201},
{"sub_7ff7de22a410", 33202},
{"sub_7ff7de22a480", 33203},
{"sub_7ff7de22a520", 33204},
{"sub_7ff7de22a650", 33205},
{"sub_7ff7de22a7c0", 33206},
{"sub_7ff7de22a810", 33207},
{"sub_7ff7de22a8d0", 33208},
{"sub_7ff7de285a40", 33209},
{"sub_7ff7de285a50", 33210},
{"setgoalpos", 33202},
{"setgoalentity", 33203},
{"setgoalvolume", 33204},
{"setgoalvolumeauto", 33205},
{"getgoalvolume", 33206},
{"cleargoalvolume", 33207},
{"setfixednodesafevolume", 33208},
{"setmotionblurturnscale", 33209},
{"setmotionblurzoomscale", 33210},
{"viewkick", 33211},
{"sub_7ff7de27cfe0", 33212},
{"getnodenumber", 33213},
@ -1032,7 +1032,7 @@ namespace scripting
{"sub_7ff7de22d060", 33227},
{"setcorpsefalling", 33228},
{"sub_7ff7de2c1340", 33229},
{"sub_7ff7de22d1b0", 33230},
{"dropweapon", 33230},
{"sub_7ff7de227fe0", 33231},
{"sub_7ff7de228150", 33232},
{"sub_7ff7de228270", 33233},
@ -1101,7 +1101,7 @@ namespace scripting
{"sub_7ff7de22c660", 33296},
{"sub_7ff7de273ff0", 33297},
{"sub_7ff7de274380", 33298},
{"setgoalentity", 33300},
{"sub_7ff7de291020", 33300},
{"sub_7ff7de276720", 33308},
{"sub_7ff7de276aa0", 33309},
{"sub_7ff7de277320", 33310},
@ -1127,7 +1127,7 @@ namespace scripting
{"vehicleturretcontroloff", 33332},
{"isturretready", 33333},
{"vehicledriveto", 33334},
{"dospawn", 33335},
{"vehicle_dospawn", 33335},
{"isphysveh", 33336},
{"phys_crash", 33337},
{"sub_7ff7de465f30", 33338},