Updated game structs, variable symbols and references.

This commit is contained in:
Caball
2024-12-31 00:01:31 +01:00
parent 2516a48fc1
commit 3553cd49ff
11 changed files with 468 additions and 58 deletions
+4 -4
View File
@@ -21,7 +21,7 @@ namespace bots
bool can_add()
{
return party::get_client_count() < *game::mp::svs_clientCount;
return party::get_client_count() < game::mp::svs->clientCount;
}
void bot_team_join(const int entity_num)
@@ -29,14 +29,14 @@ namespace bots
// schedule the select team call
scheduler::once([entity_num]()
{
game::SV_ExecuteClientCommand(&game::mp::svs_clients[entity_num],
game::SV_ExecuteClientCommand(&game::mp::svs->clients[entity_num],
utils::string::va("lui 68 2 %i", *game::mp::sv_serverId_value),
false);
// scheduler the select class call
scheduler::once([entity_num]()
{
game::SV_ExecuteClientCommand(&game::mp::svs_clients[entity_num],
game::SV_ExecuteClientCommand(&game::mp::svs->clients[entity_num],
utils::string::va("lui 5 %i %i", (rand() % 5) + 10,
*game::mp::sv_serverId_value), false);
}, scheduler::pipeline::server, 1s);
@@ -175,7 +175,7 @@ namespace bots
num_bots = std::strtoul(params.get(1), nullptr, 10);
}
num_bots = std::min(num_bots, static_cast<std::size_t>(*game::mp::svs_clientCount));
num_bots = std::min(num_bots, static_cast<std::size_t>(game::mp::svs->clientCount));
console::info("Spawning %zu %s\n", num_bots, (num_bots == 1 ? "bot" : "bots"));
+1 -1
View File
@@ -41,7 +41,7 @@ namespace dedicated_info
for (auto i = 0; i < sv_maxclients->current.integer; i++)
{
auto* client = &game::mp::svs_clients[i];
auto* client = &game::mp::svs->clients[i];
auto* self = &game::mp::g_entities[i];
if (client->header.state > game::CS_FREE && self && self->client)
+3 -3
View File
@@ -54,8 +54,8 @@ namespace discord
discord_presence.details = utils::string::va("%s on %s", gametype, map);
discord_presence.partySize = game::mp::cgArray->snap != nullptr
? game::mp::cgArray->snap->numClients
discord_presence.partySize = game::mp::cg->snap != nullptr
? game::mp::cg->snap->numClients
: 1;
if (game::Dvar_GetBool("xblive_privatematch"))
@@ -65,7 +65,7 @@ namespace discord
}
else
{
auto* host_name = reinterpret_cast<char*>(0x14187EBC4);
auto* host_name = game::mp::cgs->szHostName;
utils::string::strip(host_name, host_name, std::strlen(host_name) + 1);
discord_presence.state = host_name;
+1 -1
View File
@@ -505,7 +505,7 @@ namespace game_console
{
if (key == game::keyNum_t::K_F10)
{
if(game::mp::svs_clients[localClientNum].header.state > game::CS_FREE)
if(game::mp::svs->clients[localClientNum].header.state > game::CS_FREE)
{
return false;
}
+1 -1
View File
@@ -61,7 +61,7 @@ namespace notifies
scheduler::once([params, message, client_num]
{
const auto* guid = game::SV_GetGuid(client_num);
const auto* name = game::mp::svs_clients[client_num].name;
const auto* name = game::mp::svs->clients[client_num].name;
game_log::g_log_printf("%s;%s;%i;%s;%s\n",
params.get(0),
+10 -10
View File
@@ -120,9 +120,9 @@ namespace party
int get_client_count()
{
auto count = 0;
for (auto i = 0; i < *game::mp::svs_clientCount; ++i)
for (auto i = 0; i < game::mp::svs->clientCount; ++i)
{
if (game::mp::svs_clients[i].header.state >= game::CS_CONNECTED)
if (game::mp::svs->clients[i].header.state >= game::CS_CONNECTED)
{
++count;
}
@@ -134,10 +134,10 @@ namespace party
int get_bot_count()
{
auto count = 0;
for (auto i = 0; i < *game::mp::svs_clientCount; ++i)
for (auto i = 0; i < game::mp::svs->clientCount; ++i)
{
if (game::mp::svs_clients[i].header.state >= game::CS_CONNECTED &&
game::mp::svs_clients[i].testClient != game::TC_NONE)
if (game::mp::svs->clients[i].header.state >= game::CS_CONNECTED &&
game::mp::svs->clients[i].testClient != game::TC_NONE)
{
++count;
}
@@ -158,7 +158,7 @@ namespace party
int get_client_num_from_name(const std::string& name)
{
for (auto i = 0; !name.empty() && i < *game::mp::svs_clientCount; ++i)
for (auto i = 0; !name.empty() && i < game::mp::svs->clientCount; ++i)
{
if (game::mp::g_entities[i].client)
{
@@ -283,7 +283,7 @@ namespace party
}
const auto client_num = atoi(params.get(1));
if (client_num < 0 || client_num >= *game::mp::svs_clientCount)
if (client_num < 0 || client_num >= game::mp::svs->clientCount)
{
return;
}
@@ -320,7 +320,7 @@ namespace party
const std::string name = params.get(1);
if (name == "all"s)
{
for (auto i = 0; i < *game::mp::svs_clientCount; ++i)
for (auto i = 0; i < game::mp::svs->clientCount; ++i)
{
scheduler::once([i, reason]
{
@@ -331,7 +331,7 @@ namespace party
}
const auto client_num = get_client_num_from_name(name);
if (client_num < 0 || client_num >= *game::mp::svs_clientCount)
if (client_num < 0 || client_num >= game::mp::svs->clientCount)
{
return;
}
@@ -418,7 +418,7 @@ namespace party
info.set("isPrivate", dvars::get_string("g_password").empty() ? "0" : "1");
info.set("clients", std::to_string(get_client_count()));
info.set("bots", std::to_string(get_bot_count()));
info.set("sv_maxclients", std::to_string(*game::mp::svs_clientCount));
info.set("sv_maxclients", std::to_string(game::mp::svs->clientCount));
info.set("protocol", std::to_string(PROTOCOL));
info.set("shortversion", SHORTVERSION);
+1 -1
View File
@@ -191,7 +191,7 @@ namespace patches
{
command::params_sv params{};
const auto menu_id = atoi(params.get(1));
const auto client = &game::mp::svs_clients[ent->s.clientNum];
const auto client = &game::mp::svs->clients[ent->s.clientNum];
// 9 => "end_game"
if (menu_id == 9 && client->header.netchan.remoteAddress.type != game::NA_LOOPBACK)
+1 -1
View File
@@ -50,7 +50,7 @@ namespace rcon
for (int i = 0; i < sv_maxclients->current.integer; i++)
{
const auto client = &game::mp::svs_clients[i];
const auto client = &game::mp::svs->clients[i];
auto self = &game::mp::g_entities[i];
char clean_name[32]{};
+2 -2
View File
@@ -50,8 +50,8 @@ namespace slowmotion
for (auto i = 0; i < game::Dvar_FindVar("sv_maxclients")->current.integer; i++)
{
auto* client = &game::mp::svs_clients[i];
client->nextSnapshotTime = *game::mp::serverTime - 1;
auto* client = &game::mp::svs->clients[i];
client->nextSnapshotTime = game::mp::svs->time - 1;
}
}
}