Update dvar list + add dvar descriptions
This commit is contained in:
parent
a99c965d3f
commit
bc7f1cbf8d
@ -44,7 +44,12 @@ namespace command
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto dvar = game::Dvar_FindVar(args[0]);
|
||||
auto dvar = game::Dvar_FindVar(args[0]);
|
||||
if (dvar == nullptr)
|
||||
{
|
||||
const auto hash = static_cast<int>(std::strtoull(args[0], nullptr, 16));
|
||||
dvar = game::Dvar_FindMalleableVar(hash);
|
||||
}
|
||||
|
||||
if (dvar)
|
||||
{
|
||||
@ -53,15 +58,25 @@ namespace command
|
||||
const auto current = game::Dvar_ValueToString(dvar, nullptr, &dvar->current);
|
||||
const auto reset = game::Dvar_ValueToString(dvar, nullptr, &dvar->reset);
|
||||
|
||||
game_console::print(game_console::con_type_info, "\"%s\" is: \"%s\" default: \"%s\" hash: 0x%08lX",
|
||||
args[0], current, reset, dvar->name);
|
||||
const auto info = dvars::get_dvar_info_from_hash(dvar->name);
|
||||
std::string desc{};
|
||||
std::string name = args[0];
|
||||
|
||||
game_console::print(game_console::con_type_info, " %s\n",
|
||||
dvars::dvar_get_domain(dvar->type, dvar->domain).data());
|
||||
if (info.has_value())
|
||||
{
|
||||
name = info.value().name;
|
||||
desc = info.value().description;
|
||||
}
|
||||
|
||||
game_console::print(game_console::con_type_info, "\"%s\" is: \"%s\" default: \"%s\" hash: 0x%08lX\n",
|
||||
name.data(), current, reset, dvar->name);
|
||||
|
||||
game_console::print(game_console::con_type_info, "%s\n", desc.data());
|
||||
game_console::print(game_console::con_type_info, " %s\n", dvars::dvar_get_domain(dvar->type, dvar->domain).data());
|
||||
}
|
||||
else
|
||||
{
|
||||
char command[0x1000] = { 0 };
|
||||
char command[0x1000] = {0};
|
||||
game::Dvar_GetCombinedString(command, 1);
|
||||
game::Dvar_SetCommand(dvar->name, "", command);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace database
|
||||
|| !utils::io::directory_exists("Data/config")
|
||||
|| !utils::io::directory_exists("Data/indices"));
|
||||
|
||||
db_filesysImpl = dvars::register_enum("db_filesysImpl", values, default_value, game::DVAR_FLAG_READ);
|
||||
db_filesysImpl = dvars::register_enum("db_filesysImpl", values, default_value, game::DVAR_FLAG_READ, "Filesystem implementation");
|
||||
|
||||
if (default_value == 1)
|
||||
{
|
||||
|
@ -234,7 +234,8 @@ namespace exception
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
dvars::cg_legacyCrashHandling = dvars::register_bool("cg_legacyCrashHandling", false, game::DVAR_FLAG_SAVED);
|
||||
dvars::cg_legacyCrashHandling = dvars::register_bool("cg_legacyCrashHandling", false,
|
||||
game::DVAR_FLAG_SAVED, "Disable new crash handling");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -304,20 +304,23 @@ namespace fps
|
||||
|
||||
sub_7C55D0_hook.create(0x1407C55D0, perf_update);
|
||||
|
||||
cg_drawSpeed = dvars::register_bool("cg_drawSpeed", 0, game::DVAR_FLAG_SAVED);
|
||||
cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED);
|
||||
cg_drawSpeed = dvars::register_bool("cg_drawSpeed", 0, game::DVAR_FLAG_SAVED, "Draw speed");
|
||||
cg_drawFps = dvars::register_int("cg_drawFPS", 0, 0, 4, game::DVAR_FLAG_SAVED, "Draw fps");
|
||||
|
||||
cg_speedGraph = dvars::register_bool("cg_speedGraph", 0, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraph = dvars::register_bool("cg_speedGraph", 0, game::DVAR_FLAG_SAVED, "Enable speed graph");
|
||||
|
||||
cg_speedGraphColor = dvars::register_vec4("cg_speedGraphColor", 1.f, 0.f, 0.f, 1.0f, 0.f, 1.f, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphFontColor = dvars::register_vec4("cg_speedGraphFontColor", 1.f, 1.f, 1.f, 1.f, 0.f, 1.f, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphBackgroundColor = dvars::register_vec4("cg_speedGraphBackgroundColor", 0.f, 0.f, 0.f, 0.8f, 0.f, 1.f, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphColor = dvars::register_vec4("cg_speedGraphColor",
|
||||
1.f, 0.f, 0.f, 1.0f, 0.f, 1.f, game::DVAR_FLAG_SAVED, "Speed graph color");
|
||||
cg_speedGraphFontColor = dvars::register_vec4("cg_speedGraphFontColor",
|
||||
1.f, 1.f, 1.f, 1.f, 0.f, 1.f, game::DVAR_FLAG_SAVED, "Speed graph font color");
|
||||
cg_speedGraphBackgroundColor = dvars::register_vec4("cg_speedGraphBackgroundColor",
|
||||
0.f, 0.f, 0.f, 0.8f, 0.f, 1.f, game::DVAR_FLAG_SAVED, "Speed graph background color");
|
||||
|
||||
cg_speedGraphX = dvars::register_int("cg_speedGraphX", 15, 0, 1000, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphY = dvars::register_int("cg_speedGraphY", 15, 0, 1000, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphX = dvars::register_int("cg_speedGraphX", 15, 0, 1000, game::DVAR_FLAG_SAVED, "Speed graph x position");
|
||||
cg_speedGraphY = dvars::register_int("cg_speedGraphY", 15, 0, 1000, game::DVAR_FLAG_SAVED, "Speed graph y position");
|
||||
|
||||
cg_speedGraphWidth = dvars::register_int("cg_speedGraphWidth", 200, 0, 1000, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphHeight = dvars::register_int("cg_speedGraphHeight", 80, 0, 1000, game::DVAR_FLAG_SAVED);
|
||||
cg_speedGraphWidth = dvars::register_int("cg_speedGraphWidth", 200, 0, 1000, game::DVAR_FLAG_SAVED, "Speed graph width");
|
||||
cg_speedGraphHeight = dvars::register_int("cg_speedGraphHeight", 80, 0, 1000, game::DVAR_FLAG_SAVED, "Speed graph height");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "game_console.hpp"
|
||||
#include "command.hpp"
|
||||
@ -55,7 +54,7 @@ namespace game_console
|
||||
std::deque<std::string> history;
|
||||
|
||||
std::string fixed_input;
|
||||
std::unordered_set<std::string> matches;
|
||||
std::vector<dvars::dvar_info> matches;
|
||||
|
||||
float color_white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
float color_h2[4] = {0.9f, 0.9f, 0.5f, 1.0f};
|
||||
@ -161,21 +160,22 @@ namespace game_console
|
||||
con.globals.x = game::R_TextWidth(str, 0, console_font) + con.globals.x + 6.0f;
|
||||
}
|
||||
|
||||
void draw_hint_box(const int lines, float* color, [[maybe_unused]] float offset_x = 0.0f,
|
||||
float draw_hint_box(const int lines, float* color, [[maybe_unused]] float offset_x = 0.0f,
|
||||
[[maybe_unused]] float offset_y = 0.0f)
|
||||
{
|
||||
const auto _h = lines * con.globals.font_height + 12.0f;
|
||||
const auto _y = con.globals.y - 3.0f + con.globals.font_height + 12.0f;
|
||||
const auto _y = con.globals.y - 3.0f + con.globals.font_height + 12.0f + offset_y;
|
||||
const auto _w = (con.screen_max[0] - con.screen_min[0]) - ((con.globals.x - 6.0f) - con.screen_min[0]);
|
||||
|
||||
draw_box(con.globals.x - 6.0f, _y, _w, _h, color);
|
||||
return _h;
|
||||
}
|
||||
|
||||
void draw_hint_text(const int line, const char* text, float* color, const float offset = 0.0f)
|
||||
void draw_hint_text(const int line, const char* text, float* color, const float offset_x = 0.0f, const float offset_y = 0.0f)
|
||||
{
|
||||
const auto _y = con.globals.font_height + con.globals.y + (con.globals.font_height * (line + 1)) + 15.0f;
|
||||
const auto _y = con.globals.font_height + con.globals.y + (con.globals.font_height * (line + 1)) + 15.0f + offset_y;
|
||||
|
||||
game::R_AddCmdDrawText(text, 0x7FFFFFFF, console_font, con.globals.x + offset, _y, 1.0f, 1.0f, 0.0f, color, 0);
|
||||
game::R_AddCmdDrawText(text, 0x7FFFFFFF, console_font, con.globals.x + offset_x, _y, 1.0f, 1.0f, 0.0f, color, 0);
|
||||
}
|
||||
|
||||
bool match_compare(const std::string& input, const std::string& text, const bool exact)
|
||||
@ -242,56 +242,68 @@ namespace game_console
|
||||
}
|
||||
else if (matches.size() == 1)
|
||||
{
|
||||
const auto first = *matches.begin();
|
||||
auto* const dvar = game::Dvar_FindVar(first.data());
|
||||
const auto line_count = dvar ? 2 : 1;
|
||||
auto* const dvar = game::Dvar_FindVar(matches[0].name.data());
|
||||
const auto line_count = dvar ? 3 : 1;
|
||||
|
||||
draw_hint_box(line_count, dvars::con_inputHintBoxColor->current.vector);
|
||||
draw_hint_text(0, first.data(),
|
||||
dvar
|
||||
? dvars::con_inputDvarMatchColor->current.vector
|
||||
: dvars::con_inputCmdMatchColor->current.vector);
|
||||
const auto height = draw_hint_box(line_count, dvars::con_inputHintBoxColor->current.vector);
|
||||
draw_hint_text(0, matches[0].name.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;
|
||||
const auto offset = (con.screen_max[0] - con.globals.x) / 4.f;
|
||||
|
||||
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);
|
||||
draw_hint_text(2, matches[0].description.data(),
|
||||
color_white, 0);
|
||||
|
||||
const auto offset_y = height + 3.f;
|
||||
const auto line_count_ = dvar->type == game::dvar_type::enumeration
|
||||
? dvar->domain.enumeration.stringCount + 1
|
||||
: 1;
|
||||
|
||||
draw_hint_box(line_count_, dvars::con_inputHintBoxColor->current.vector, 0, offset_y);
|
||||
draw_hint_text(0, dvars::dvar_get_domain(dvar->type, dvar->domain).data(),
|
||||
dvars::con_inputCmdMatchColor->current.vector, 0, offset_y);
|
||||
}
|
||||
|
||||
strncpy_s(con.globals.auto_complete_choice, first.data(), 64);
|
||||
strncpy_s(con.globals.auto_complete_choice, matches[0].name.data(), 64);
|
||||
con.globals.may_auto_complete = true;
|
||||
}
|
||||
else if (matches.size() > 1)
|
||||
{
|
||||
draw_hint_box(static_cast<int>(matches.size()), dvars::con_inputHintBoxColor->current.vector);
|
||||
|
||||
const auto offset = (con.screen_max[0] - con.globals.x) / 2.5f;
|
||||
const auto offset = (con.screen_max[0] - con.globals.x) / 4.f;
|
||||
|
||||
auto index = 0;
|
||||
for (const auto& match : matches)
|
||||
for (size_t i = 0; i < matches.size(); i++)
|
||||
{
|
||||
auto* const dvar = game::Dvar_FindVar(match.data());
|
||||
auto* const dvar = game::Dvar_FindVar(matches[i].name.data());
|
||||
|
||||
draw_hint_text(static_cast<int>(index), match.data(),
|
||||
dvar
|
||||
? dvars::con_inputDvarMatchColor->current.vector
|
||||
: dvars::con_inputCmdMatchColor->current.vector);
|
||||
draw_hint_text(static_cast<int>(i), matches[i].name.data(),
|
||||
dvar
|
||||
? dvars::con_inputDvarMatchColor->current.vector
|
||||
: dvars::con_inputCmdMatchColor->current.vector);
|
||||
|
||||
if (dvar)
|
||||
{
|
||||
draw_hint_text(static_cast<int>(index), game::Dvar_ValueToString(dvar, nullptr, &dvar->current),
|
||||
dvars::con_inputDvarValueColor->current.vector, offset);
|
||||
}
|
||||
const auto value = game::Dvar_ValueToString(dvar, nullptr, &dvar->current);
|
||||
const auto truncated = utils::string::truncate(value, 34, "...");
|
||||
|
||||
index++;
|
||||
draw_hint_text(static_cast<int>(i), truncated.data(),
|
||||
dvars::con_inputDvarValueColor->current.vector, offset);
|
||||
|
||||
draw_hint_text(static_cast<int>(i), matches[i].description.data(),
|
||||
dvars::con_inputDvarValueColor->current.vector, offset * 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
strncpy_s(con.globals.auto_complete_choice, matches.begin()->data(), 64);
|
||||
strncpy_s(con.globals.auto_complete_choice, matches[0].name.data(), 64);
|
||||
con.globals.may_auto_complete = true;
|
||||
}
|
||||
}
|
||||
@ -653,16 +665,16 @@ namespace game_console
|
||||
return true;
|
||||
}
|
||||
|
||||
void find_matches(std::string input, std::unordered_set<std::string>& suggestions, const bool exact)
|
||||
void find_matches(std::string input, std::vector<dvars::dvar_info>& suggestions, const bool exact)
|
||||
{
|
||||
input = utils::string::to_lower(input);
|
||||
|
||||
for (const auto& dvar : dvars::dvar_list)
|
||||
{
|
||||
auto name = utils::string::to_lower(dvar);
|
||||
auto name = utils::string::to_lower(dvar.name);
|
||||
if (game::Dvar_FindVar(name.data()) && match_compare(input, name, exact))
|
||||
{
|
||||
suggestions.insert(dvar);
|
||||
suggestions.push_back(dvar);
|
||||
}
|
||||
|
||||
if (exact && suggestions.size() > 1)
|
||||
@ -673,7 +685,7 @@ namespace game_console
|
||||
|
||||
if (suggestions.size() == 0 && game::Dvar_FindVar(input.data()))
|
||||
{
|
||||
suggestions.insert(input.data());
|
||||
suggestions.push_back({ input, "" });
|
||||
}
|
||||
|
||||
game::cmd_function_s* cmd = (*game::cmd_functions);
|
||||
@ -685,7 +697,7 @@ namespace game_console
|
||||
|
||||
if (match_compare(input, name, exact))
|
||||
{
|
||||
suggestions.insert(cmd->name);
|
||||
suggestions.push_back({ cmd->name, "" });
|
||||
}
|
||||
|
||||
if (exact && suggestions.size() > 1)
|
||||
@ -693,6 +705,7 @@ namespace game_console
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cmd = cmd->next;
|
||||
}
|
||||
}
|
||||
@ -743,58 +756,59 @@ namespace game_console
|
||||
|
||||
// add our dvars
|
||||
dvars::con_inputBoxColor = dvars::register_vec4(
|
||||
"con_inputBoxColor",
|
||||
0.2f, 0.2f, 0.2f, 0.9f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_inputBoxColor",
|
||||
0.2f, 0.2f, 0.2f, 0.9f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console input box"
|
||||
);
|
||||
dvars::con_inputHintBoxColor = dvars::register_vec4(
|
||||
"con_inputHintBoxColor",
|
||||
0.3f, 0.3f, 0.3f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_inputHintBoxColor",
|
||||
0.3f, 0.3f, 0.3f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console input hint box"
|
||||
);
|
||||
dvars::con_outputBarColor = dvars::register_vec4(
|
||||
"con_outputBarColor",
|
||||
0.5f, 0.5f, 0.5f, 0.6f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_outputBarColor",
|
||||
0.5f, 0.5f, 0.5f, 0.6f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console output bar"
|
||||
);
|
||||
dvars::con_outputSliderColor = dvars::register_vec4(
|
||||
"con_outputSliderColor",
|
||||
0.9f, 0.9f, 0.5f, 1.00f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_outputSliderColor",
|
||||
0.3f, 0.7f, 0.3f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console output slider"
|
||||
);
|
||||
dvars::con_outputWindowColor = dvars::register_vec4(
|
||||
"con_outputWindowColor",
|
||||
0.25f, 0.25f, 0.25f, 0.85f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_outputWindowColor",
|
||||
0.25f, 0.25f, 0.25f, 0.85f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console output window"
|
||||
);
|
||||
dvars::con_inputDvarMatchColor = dvars::register_vec4(
|
||||
"con_inputDvarMatchColor",
|
||||
1.0f, 1.0f, 0.8f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_inputDvarMatchColor",
|
||||
1.0f, 1.0f, 0.8f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console matched dvar"
|
||||
);
|
||||
dvars::con_inputDvarValueColor = dvars::register_vec4(
|
||||
"con_inputDvarValueColor",
|
||||
1.0f, 1.0f, 0.8f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_inputDvarValueColor",
|
||||
1.0f, 1.0f, 0.8f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console matched dvar value"
|
||||
);
|
||||
dvars::con_inputDvarInactiveValueColor = dvars::register_vec4(
|
||||
"con_inputDvarInactiveValueColor",
|
||||
0.8f, 0.8f, 0.8f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
|
||||
"con_inputDvarInactiveValueColor",
|
||||
0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console inactive dvar value"
|
||||
);
|
||||
dvars::con_inputCmdMatchColor = dvars::register_vec4(
|
||||
"con_inputCmdMatchColor",
|
||||
0.80f, 0.80f, 1.0f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED);
|
||||
"con_inputCmdMatchColor",
|
||||
0.80f, 0.80f, 1.0f, 1.0f, 0.0f, 1.0f,
|
||||
game::DVAR_FLAG_SAVED,
|
||||
"color of console matched command"
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
namespace game_console
|
||||
{
|
||||
enum console_type
|
||||
@ -14,7 +16,7 @@ namespace game_console
|
||||
bool console_char_event(int local_client_num, int key);
|
||||
bool console_key_event(int local_client_num, int key, int down);
|
||||
|
||||
void find_matches(std::string input, std::unordered_set<std::string>& suggestions, const bool exact);
|
||||
void find_matches(std::string input, std::vector<dvars::dvar_info>& suggestions, const bool exact);
|
||||
void execute(const char* cmd);
|
||||
void clear_console();
|
||||
void add(const std::string& cmd, bool print_ = true);
|
||||
|
@ -94,10 +94,14 @@ namespace gameplay
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
dvars::g_enableElevators = dvars::register_bool("g_enableElevators", false, game::DvarFlags::DVAR_FLAG_NONE);
|
||||
dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::jump_ladderPushVel = dvars::register_float("jump_ladderPushVel", 128.0f, 0.0f, 1024.0f, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::jump_spreadAdd = dvars::register_float("jump_spreadAdd", 64.0f, 0.0f, 512.0f, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::g_enableElevators = dvars::register_bool("g_enableElevators", false,
|
||||
game::DVAR_FLAG_REPLICATED, "Enable elevators");
|
||||
dvars::jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true,
|
||||
game::DVAR_FLAG_REPLICATED, "Enable fall damage");
|
||||
dvars::jump_ladderPushVel = dvars::register_float("jump_ladderPushVel", 128.0f, 0.0f, 1024.0f,
|
||||
game::DVAR_FLAG_REPLICATED, "The velocity of a jump off of a ladder");
|
||||
dvars::jump_spreadAdd = dvars::register_float("jump_spreadAdd", 64.0f, 0.0f, 512.0f,
|
||||
game::DVAR_FLAG_REPLICATED, "The amount of spread scale to add as a side effect of jumping");
|
||||
|
||||
// Influence PM_JitterPoint code flow so the trace->startsolid checks are 'ignored'
|
||||
pm_player_trace_hook.create(0x14068F0A0, &pm_player_trace_stub);
|
||||
@ -114,10 +118,14 @@ namespace gameplay
|
||||
utils::hook::nop(0x14067AE0F, 4);
|
||||
|
||||
// Dvars already present in-game
|
||||
dvars::register_float("jump_height", 39.0f, 0.0f, 1000.0f, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::register_float("jump_stepSize", 18.0f, 0.0f, 64.0f, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::register_float("g_gravity", 800.0f, 1.0f, 1000.0f, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::register_int("g_speed", 190, 0, 1000, game::DVAR_FLAG_REPLICATED);
|
||||
dvars::register_float("jump_height", 39.0f, 0.0f, 1000.0f,
|
||||
game::DVAR_FLAG_REPLICATED, "The maximum height of a player\'s jump");
|
||||
dvars::register_float("jump_stepSize", 18.0f, 0.0f, 64.0f,
|
||||
game::DVAR_FLAG_REPLICATED, "The maximum step up to the top of a jump arc");
|
||||
dvars::register_float("g_gravity", 800.0f, 1.0f, 1000.0f,
|
||||
game::DVAR_FLAG_REPLICATED, "Game gravity in inches per second squared");
|
||||
dvars::register_int("g_speed", 190, 0, 1000,
|
||||
game::DVAR_FLAG_REPLICATED, "Player speed");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace gui::console
|
||||
int history_index = -1;
|
||||
std::string input;
|
||||
std::string filter;
|
||||
std::unordered_set<std::string> matches;
|
||||
std::vector<dvars::dvar_info> matches;
|
||||
|
||||
int input_text_edit(ImGuiInputTextCallbackData* data)
|
||||
{
|
||||
@ -43,7 +43,7 @@ namespace gui::console
|
||||
|
||||
if (matches.size() < 24 && matches.size() > 0)
|
||||
{
|
||||
const auto match = matches.begin()->data();
|
||||
const auto match = matches.begin()->name.data();
|
||||
data->DeleteChars(0, data->BufTextLen);
|
||||
data->InsertChars(0, match, match + strlen(match));
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ namespace logger
|
||||
utils::hook::detour nullsub_48_hook;
|
||||
utils::hook::detour sub_32AEF0;
|
||||
|
||||
game::dvar_t* logger_dev = nullptr;
|
||||
|
||||
void print_error(const char* msg, ...)
|
||||
{
|
||||
char buffer[2048];
|
||||
@ -91,8 +93,7 @@ namespace logger
|
||||
|
||||
void print_dev(const char* msg, ...)
|
||||
{
|
||||
static auto* enabled = dvars::register_bool("logger_dev", false, game::DVAR_FLAG_SAVED);
|
||||
if (!enabled->current.enabled)
|
||||
if (!logger_dev->current.enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -126,8 +127,7 @@ namespace logger
|
||||
}
|
||||
else
|
||||
{
|
||||
static auto* enabled = dvars::register_bool("logger_dev", false, game::DVAR_FLAG_SAVED);
|
||||
if (!enabled->current.enabled)
|
||||
if (!logger_dev->current.enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -147,6 +147,8 @@ namespace logger
|
||||
utils::hook::jump(0x14032AEF0, lui_print, true);
|
||||
com_error_hook.create(0x1405A2D80, com_error_stub);
|
||||
utils::hook::jump(0x14013A98C, print);
|
||||
|
||||
logger_dev = dvars::register_bool("logger_dev", false, game::DVAR_FLAG_SAVED, "Print dev stuff");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -86,8 +86,10 @@ namespace patches
|
||||
|
||||
// Make cg_fov and cg_fovscale saved dvars
|
||||
|
||||
cg_fov = dvars::register_float("cg_fov", 65.f, 40.f, 200.f, game::DvarFlags::DVAR_FLAG_SAVED);
|
||||
cg_fovScale = dvars::register_float("cg_fovScale", 1.f, 0.1f, 2.f, game::DvarFlags::DVAR_FLAG_SAVED);
|
||||
cg_fov = dvars::register_float("cg_fov", 65.f, 40.f, 200.f,
|
||||
game::DVAR_FLAG_SAVED, "The field of view angle in degrees for client 0");
|
||||
cg_fovScale = dvars::register_float("cg_fovScale", 1.f, 0.1f, 2.f,
|
||||
game::DVAR_FLAG_SAVED, "Scale applied to the field of view");
|
||||
|
||||
dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace renderer
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED);
|
||||
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED, "Fullbright method");
|
||||
|
||||
r_init_draw_method_hook.create(0x14072F950, &r_init_draw_method_stub);
|
||||
r_update_front_end_dvar_options_hook.create(0x14076EE70, &r_update_front_end_dvar_options_stub);
|
||||
|
@ -414,7 +414,8 @@ namespace updater
|
||||
void post_unpack() override
|
||||
{
|
||||
delete_old_file();
|
||||
cl_auto_update = dvars::register_bool("cg_auto_update", true, game::DVAR_FLAG_SAVED);
|
||||
cl_auto_update = dvars::register_bool("cg_auto_update", true,
|
||||
game::DVAR_FLAG_SAVED, "Automatically check for updates on launch");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,15 @@
|
||||
|
||||
namespace dvars
|
||||
{
|
||||
struct dvar_info
|
||||
{
|
||||
dvar_info(const std::string& name, const std::string& description);
|
||||
|
||||
std::string name;
|
||||
std::string description;
|
||||
int hash;
|
||||
};
|
||||
|
||||
extern game::dvar_t* con_inputBoxColor;
|
||||
extern game::dvar_t* con_inputHintBoxColor;
|
||||
extern game::dvar_t* con_outputBarColor;
|
||||
@ -25,14 +34,23 @@ namespace dvars
|
||||
|
||||
extern game::dvar_t* g_enableElevators;
|
||||
|
||||
extern std::unordered_set<std::string> dvar_list;
|
||||
extern std::vector<dvar_info> 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);
|
||||
std::string dvar_get_description(const std::string& name);
|
||||
std::optional<dvar_info> get_dvar_info_from_hash(const int hash);
|
||||
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max, unsigned int flags);
|
||||
game::dvar_t* register_bool(const std::string& name, bool value, unsigned int flags);
|
||||
game::dvar_t* register_enum(const std::string& name, const char** valueList, int defaultIndex, unsigned int flags);
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max, unsigned int flags);
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min, float max, unsigned int flags);
|
||||
game::dvar_t* register_int(const std::string& name, int value, int min, int max,
|
||||
unsigned int flags, const std::string& description);
|
||||
game::dvar_t* register_bool(const std::string& name, bool value,
|
||||
unsigned int flags, const std::string& description);
|
||||
game::dvar_t* register_string(const std::string& name, const char* value,
|
||||
unsigned int flags, const std::string& description);
|
||||
game::dvar_t* register_float(const std::string& name, float value, float min, float max,
|
||||
unsigned int flags, const std::string& description);
|
||||
game::dvar_t* register_vec4(const std::string& name, float x, float y, float z, float w, float min,
|
||||
float max, unsigned int flags, const std::string& description);
|
||||
game::dvar_t* register_enum(const std::string& name, const char** value_list, int default_index,
|
||||
unsigned int flags, const std::string& description);
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ namespace game
|
||||
WEAK symbol<int(const RawFile* rawfile, char* buf, int size)> DB_GetRawBuffer{0x140413C40};
|
||||
|
||||
WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x140618F90};
|
||||
WEAK symbol<dvar_t*(int hash)> Dvar_FindMalleableVar{0x140618F00};
|
||||
WEAK symbol<void(char* buffer, int index)> Dvar_GetCombinedString{0x1405A75D0};
|
||||
WEAK symbol<dvar_t*(int hash, const char* name, bool value, unsigned int flags)> Dvar_RegisterBool{0x140617BB0};
|
||||
WEAK symbol<dvar_t*(int hash, const char* name, const char** valueList, int defaultIndex, unsigned int flags)> Dvar_RegisterEnum{0x140617E90};
|
||||
|
Loading…
Reference in New Issue
Block a user