Add some dvar names

This commit is contained in:
Federico Cecchetto 2021-04-24 08:47:17 +02:00
parent 6ee4a8a6af
commit f909521cfb
5 changed files with 1090 additions and 7 deletions

View File

@ -186,6 +186,19 @@ namespace game_console
{ {
input = utils::string::to_lower(input); input = utils::string::to_lower(input);
for (const auto& dvar : dvars::dvar_list)
{
if (match_compare(input, dvar, exact))
{
suggestions.push_back(dvar);
}
if (exact && suggestions.size() > 1)
{
return;
}
}
game::cmd_function_s* cmd = (*game::cmd_functions); game::cmd_function_s* cmd = (*game::cmd_functions);
while (cmd) while (cmd)
{ {
@ -259,8 +272,25 @@ namespace game_console
} }
else if (matches.size() == 1) else if (matches.size() == 1)
{ {
draw_hint_box(1, dvars::con_inputHintBoxColor->current.vector); auto* const dvar = game::Dvar_FindVar(matches[0].data());
draw_hint_text(0, matches[0].data(), dvars::con_inputCmdMatchColor->current.vector); const auto line_count = dvar ? 2 : 1;
draw_hint_box(line_count, dvars::con_inputHintBoxColor->current.vector);
draw_hint_text(0, matches[0].data(),
dvar
? dvars::con_inputDvarMatchColor->current.vector
: dvars::con_inputCmdMatchColor->current.vector);
if (dvar)
{
const auto offset = (con.screen_max[0] - con.globals.x) / 2.5f;
draw_hint_text(0, game::Dvar_ValueToString(dvar, nullptr, &dvar->current),
dvars::con_inputDvarValueColor->current.vector, offset);
draw_hint_text(1, " default", dvars::con_inputDvarInactiveValueColor->current.vector);
draw_hint_text(1, game::Dvar_ValueToString(dvar, nullptr, &dvar->reset),
dvars::con_inputDvarInactiveValueColor->current.vector, offset);
}
strncpy_s(con.globals.auto_complete_choice, matches[0].data(), 64); strncpy_s(con.globals.auto_complete_choice, matches[0].data(), 64);
con.globals.may_auto_complete = true; con.globals.may_auto_complete = true;
@ -273,7 +303,18 @@ namespace game_console
for (size_t i = 0; i < matches.size(); i++) for (size_t i = 0; i < matches.size(); i++)
{ {
draw_hint_text(static_cast<int>(i), matches[i].data(), dvars::con_inputCmdMatchColor->current.vector); auto* const dvar = game::Dvar_FindVar(matches[i].data());
draw_hint_text(static_cast<int>(i), matches[i].data(),
dvar
? dvars::con_inputDvarMatchColor->current.vector
: dvars::con_inputCmdMatchColor->current.vector);
if (dvar)
{
draw_hint_text(static_cast<int>(i), game::Dvar_ValueToString(dvar, nullptr, &dvar->current),
dvars::con_inputDvarValueColor->current.vector, offset);
}
} }
strncpy_s(con.globals.auto_complete_choice, matches[0].data(), 64); strncpy_s(con.globals.auto_complete_choice, matches[0].data(), 64);

View File

@ -20,7 +20,6 @@ DWORD WINAPI console(LPVOID)
while (true) while (true)
{ {
std::cout << "\n";
std::getline(std::cin, cmd); std::getline(std::cin, cmd);
game_console::execute(cmd.data()); game_console::execute(cmd.data());

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,8 @@ namespace dvars
extern game::dvar_t* aimassist_enabled; extern game::dvar_t* aimassist_enabled;
extern std::vector<const char*> dvar_list;
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain); 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); std::string dvar_get_domain(const game::dvar_type type, const game::dvar_limits& domain);
} }

View File

@ -22,6 +22,10 @@ namespace game
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x5A75D0}; WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x5A75D0};
WEAK symbol<dvar_t*(const char* dvarName, bool value, unsigned int flags, const char* description)> WEAK symbol<dvar_t*(const char* dvarName, bool value, unsigned int flags, const char* description)>
Dvar_RegisterBool{0x617BB0}; Dvar_RegisterBool{0x617BB0};
WEAK symbol<dvar_t* (int hash, const char* dvarName, float value, float min, float max, unsigned int flags)>
Dvar_RegisterFloat{0x617F80};
WEAK symbol<dvar_t* (int hash, const char* dvarName, const char* value, unsigned int flags)>
Dvar_RegisterString{0x618170};
WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z, float w, float min, float max, WEAK symbol<dvar_t*(int dvarName, const char* a2, float x, float y, float z, float w, float min, float max,
unsigned int flags)> Dvar_RegisterVec4{0x6185F0}; unsigned int flags)> Dvar_RegisterVec4{0x6185F0};
WEAK symbol<const char* (dvar_t* dvar, void* a2, void* value)> Dvar_ValueToString{0x61B8F0}; WEAK symbol<const char* (dvar_t* dvar, void* a2, void* value)> Dvar_ValueToString{0x61B8F0};