send info about aim assist and voice chat (#430)

This commit is contained in:
Dss0 2022-08-14 21:39:53 +02:00 committed by GitHub
parent f195b70472
commit ca7b8f797d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 2 deletions

View File

@ -43,6 +43,8 @@ namespace Components
static void OnMouseMove(int x, int y, int dx, int dy);
static Dvar::Var sv_allowAimAssist;
private:
static Game::ButtonToCodeMap_t buttonList[];
static Game::StickToCodeMap_t analogStickList[4];
@ -87,7 +89,6 @@ namespace Components
static Dvar::Var gpad_slowdown_enabled;
static Dvar::Var input_viewSensitivity;
static Dvar::Var input_invertPitch;
static Dvar::Var sv_allowAimAssist;
static Dvar::Var aim_turnrate_pitch;
static Dvar::Var aim_turnrate_pitch_ads;
static Dvar::Var aim_turnrate_yaw;

View File

@ -352,7 +352,9 @@ namespace Components
info.set("isPrivate", (Dvar::Var("g_password").get<std::string>().size() ? "1" : "0"));
info.set("hc", (Dvar::Var("g_hardcore").get<bool>() ? "1" : "0"));
info.set("securityLevel", Utils::String::VA("%i", Dvar::Var("sv_securityLevel").get<int>()));
info.set("sv_running", (Dvar::Var("sv_running").get<bool>() ? "1" : "0"));
info.set("sv_running", ((*Game::com_sv_running)->current.enabled ? "1" : "0"));
info.set("aimAssist", (Gamepad::sv_allowAimAssist.get<bool>() ? "1" : "0"));
info.set("voiceChat", (Voice::SV_VoiceEnabled() ? "1" : "0"));
// Ensure mapname is set
if (info.get("mapname").empty() || Party::IsInLobby())

View File

@ -60,6 +60,8 @@ namespace Components
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(info->mapname.data()));
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(info->gametype.data()));
Dvar::Var("uiSi_ModName").set("");
Dvar::Var("uiSi_aimAssist").set(info->aimassist ? "@MENU_YES" : "@MENU_NO");
Dvar::Var("uiSi_voiceChat").set(info->voice ? "@MENU_YES" : "@MENU_NO");
if (info->mod.size() > 5)
{
@ -142,6 +144,8 @@ namespace Components
info.set("mapname", (*Game::sv_mapname)->current.string);
info.set("isPrivate", (Dvar::Var("g_password").get<std::string>().empty() ? "0" : "1"));
info.set("checksum", Utils::String::VA("%X", Utils::Cryptography::JenkinsOneAtATime::Compute(Utils::String::VA("%u", Game::Sys_Milliseconds()))));
info.set("aimAssist", (Gamepad::sv_allowAimAssist.get<bool>() ? "1" : "0"));
info.set("voiceChat", (Voice::SV_VoiceEnabled() ? "1" : "0"));
// Ensure mapname is set
if (info.get("mapname").empty())
@ -245,6 +249,8 @@ namespace Components
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(info.get("mapname").data()));
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(info.get("g_gametype").data()));
Dvar::Var("uiSi_ModName").set("");
Dvar::Var("uiSi_aimAssist").set(info.get("aimAssist") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
Dvar::Var("uiSi_voiceChat").set(info.get("voiceChat") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
switch (atoi(info.get("scr_team_fftype").data()))
{

View File

@ -87,6 +87,16 @@ namespace Components
return ((server->matchType == 1) ? "P" : "M");
}
case Column::AimAssist:
{
return ((server->aimassist == 1) ? "X" : "");
}
case Column::VoiceChat:
{
return ((server->voice == 1) ? "X" : "");
}
case Column::Hostname:
{
return server->hostname.data();
@ -483,6 +493,8 @@ namespace Components
server.securityLevel = atoi(info.get("securityLevel").data());
server.maxClients = atoi(info.get("sv_maxclients").data());
server.password = (atoi(info.get("isPrivate").data()) != 0);
server.aimassist = (atoi(info.get("aimAssist").data()) != 0);
server.voice = (atoi(info.get("voiceChat").data()) != 0);
server.hardcore = (atoi(info.get("hc").data()) != 0);
server.svRunning = (atoi(info.get("sv_running").data()) != 0);
server.ping = (Game::Sys_Milliseconds() - i->sendTime);

View File

@ -28,6 +28,8 @@ namespace Components
int securityLevel;
bool hardcore;
bool svRunning;
bool aimassist;
bool voice;
};
ServerList();
@ -59,6 +61,8 @@ namespace Components
{
Password,
Matchtype,
AimAssist,
VoiceChat,
Hostname,
Mapname,
Players,