Add some commands

This commit is contained in:
quaK 2021-05-09 09:37:02 +03:00
parent 1f7ff35773
commit f40b27946c
3 changed files with 67 additions and 1 deletions

View File

@ -154,6 +154,8 @@ namespace command
{
utils::hook::jump(game::base_address + 0x5A74F0, dvar_command_stub, true);
add("quit", game::Com_Quit_f);
add("startmap", [](const params& params)
{
const auto map = params.get(1);
@ -232,6 +234,60 @@ namespace command
printf("======== End command dump =========\n");
});
add("god", []()
{
if (!game::SV_Loaded())
{
return;
}
game::g_entities[0].flags ^= 1;
game::CG_GameMessage(0, utils::string::va("godmode %s",
game::g_entities[0].flags & 1
? "^2on"
: "^1off"));
});
add("demigod", []()
{
if (!game::SV_Loaded())
{
return;
}
game::g_entities[0].flags ^= 2;
game::CG_GameMessage(0, utils::string::va("demigod mode %s",
game::g_entities[0].flags & 2
? "^2on"
: "^1off"));
});
add("noclip", []()
{
if (!game::SV_Loaded())
{
return;
}
game::g_entities[0].client->flags ^= 1;
game::CG_GameMessage(0, utils::string::va("noclip %s",
game::g_entities[0].client->flags & 1
? "^2on"
: "^1off"));
});
add("ufo", []()
{
if (!game::SV_Loaded())
{
return;
}
game::g_entities[0].client->flags ^= 2;
game::CG_GameMessage(
0, utils::string::va("ufo %s", game::g_entities[0].client->flags & 2 ? "^2on" : "^1off"));
});
}
};
}

View File

@ -11,6 +11,8 @@ namespace game
{
char __pad0[0x8C];
vec3_t velocity;
char __pad1[59504];
char flags;
};
struct client_t
@ -29,7 +31,9 @@ namespace game
vec3_t origin;
char __pad1[0xF0];
gclient_s* client;
//char __pad3[480];
char __pad2[0x4C];
char flags;
//char __pad3[392];
}; // size = 760
struct Material

View File

@ -11,9 +11,13 @@ namespace game
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x59A050};
WEAK symbol<void(int localClientNum, const char* message)> CG_GameMessage{0x37F450};
WEAK symbol<void(const char* cmdName, void(), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x59A5F0};
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x59ABA0};
WEAK symbol<void()> Com_Quit_f{0x5A50D0};
WEAK symbol<void(XAssetType type, void(__cdecl* func)(game::XAssetHeader, void*), const void* inData, bool includeOverride)>
DB_EnumXAssets_Internal{0x4129F0};
WEAK symbol<const char*(const XAsset* asset)> DB_GetXAssetName{0x3E4090};
@ -66,6 +70,8 @@ namespace game
WEAK symbol<const char*(scr_string_t stringValue)> SL_ConvertToString{0x5BFBB0};
WEAK symbol<scr_string_t(const char* str, unsigned int user)> SL_GetString{0x5C0170};
WEAK symbol<bool()> SV_Loaded{0x6B3860};
WEAK symbol<void()> Sys_ShowConsole{0x633080};
WEAK symbol<const char*(const char* string)> UI_SafeTranslateString{0x5A2930};