Merge pull request #446 from diamante0018/refactor/client_t
Complete client_t
This commit is contained in:
commit
44dec50c4a
@ -180,7 +180,7 @@ namespace Components
|
||||
SteamID guid;
|
||||
guid.bits = cl->steamID;
|
||||
|
||||
InsertBan({guid, cl->netchan.remoteAddress.ip});
|
||||
InsertBan({guid, cl->header.netchan.remoteAddress.ip});
|
||||
|
||||
Game::SV_DropClient(cl, reason.data(), true);
|
||||
}
|
||||
@ -257,7 +257,7 @@ namespace Components
|
||||
}
|
||||
|
||||
const auto* cl = &Game::svs_clients[num];
|
||||
if (cl->state == Game::CS_FREE)
|
||||
if (cl->header.state == Game::CS_FREE)
|
||||
{
|
||||
Logger::Print("Client {} is not active\n", num);
|
||||
return;
|
||||
|
@ -294,7 +294,8 @@ namespace Components
|
||||
|
||||
Bots::Bots()
|
||||
{
|
||||
AssertOffset(Game::client_s, bIsTestClient, 0x41AF0);
|
||||
AssertOffset(Game::client_t, bIsTestClient, 0x41AF0);
|
||||
AssertOffset(Game::client_t, ping, 0x212C8);
|
||||
|
||||
// Replace connect string
|
||||
Utils::Hook::Set<const char*>(0x48ADA6, "connect bot%d \"\\cg_predictItems\\1\\cl_anonymous\\0\\color\\4\\head\\default\\model\\multi\\snaps\\20\\rate\\5000\\name\\%s\\protocol\\%d\\checksum\\%d\\statver\\%d %u\\qport\\%d\"");
|
||||
|
@ -160,7 +160,7 @@ namespace Components
|
||||
{
|
||||
char playerTitle[18];
|
||||
|
||||
if (Game::svs_clients[i].state >= Game::CS_CONNECTED)
|
||||
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||
{
|
||||
strncpy_s(playerTitle, Game::Info_ValueForKey(Game::svs_clients[i].userinfo, "customTitle"), _TRUNCATE);
|
||||
}
|
||||
|
@ -410,6 +410,8 @@ namespace Components
|
||||
|
||||
Chat::Chat()
|
||||
{
|
||||
AssertOffset(Game::client_t, steamID, 0x43F00);
|
||||
|
||||
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_ARCHIVE, "The normalized maximum width of a chat message");
|
||||
sv_disableChat = Dvar::Register<bool>("sv_disableChat", false, Game::DVAR_NONE, "Disable chat messages from clients");
|
||||
Events::OnSVInit(AddChatCommands);
|
||||
|
@ -46,7 +46,7 @@ namespace Components
|
||||
{
|
||||
for (int i = 0; i < maxclientCount; ++i)
|
||||
{
|
||||
if (Game::svs_clients[i].state >= 3)
|
||||
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||
{
|
||||
++clientCount;
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ namespace Components
|
||||
{
|
||||
std::string list = Utils::String::VA("%c", 20);
|
||||
|
||||
for (int i = 0; i < 18; ++i)
|
||||
for (std::size_t i = 0; i < Game::MAX_CLIENTS; ++i)
|
||||
{
|
||||
if (Game::svs_clients[i].state >= 3)
|
||||
if (Game::svs_clients[i].header.state >= 3)
|
||||
{
|
||||
list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamID));
|
||||
|
||||
|
@ -388,9 +388,9 @@ namespace Components
|
||||
{
|
||||
Game::client_t* client = &Game::svs_clients[i];
|
||||
|
||||
if (client->state >= 3)
|
||||
if (client->header.state >= Game::CS_CONNECTED)
|
||||
{
|
||||
if (address.getIP().full == Network::Address(client->netchan.remoteAddress).getIP().full)
|
||||
if (address.getIP().full == Network::Address(client->header.netchan.remoteAddress).getIP().full)
|
||||
{
|
||||
return client;
|
||||
}
|
||||
@ -752,7 +752,7 @@ namespace Components
|
||||
|
||||
if ((*Game::com_sv_running)->current.enabled)
|
||||
{
|
||||
if (Game::svs_clients[i].state < 3) continue;
|
||||
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||
|
||||
playerInfo["score"] = Game::SV_GameClientNum_Score(i);
|
||||
playerInfo["ping"] = Game::svs_clients[i].ping;
|
||||
@ -761,13 +761,13 @@ namespace Components
|
||||
else
|
||||
{
|
||||
// Score and ping are irrelevant
|
||||
const char* namePtr = Game::PartyHost_GetMemberName(reinterpret_cast<Game::PartyData*>(0x1081C00), i);
|
||||
const char* namePtr = Game::PartyHost_GetMemberName(Game::g_lobbyData, i);
|
||||
if (!namePtr || !namePtr[0]) continue;
|
||||
|
||||
playerInfo["name"] = namePtr;
|
||||
}
|
||||
|
||||
players.push_back(playerInfo);
|
||||
players.emplace_back(playerInfo);
|
||||
}
|
||||
|
||||
info["players"] = players;
|
||||
|
@ -251,7 +251,7 @@ namespace Components
|
||||
const auto* ent = Game::GetPlayerEntity(entref);
|
||||
const auto* client = Script::GetClient(ent);
|
||||
|
||||
std::string ip = Game::NET_AdrToString(client->netchan.remoteAddress);
|
||||
std::string ip = Game::NET_AdrToString(client->header.netchan.remoteAddress);
|
||||
|
||||
if (const auto pos = ip.find_first_of(":"); pos != std::string::npos)
|
||||
ip.erase(ip.begin() + pos, ip.end()); // Erase port
|
||||
@ -276,7 +276,7 @@ namespace Components
|
||||
const auto* ent = Game::GetPlayerEntity(entref);
|
||||
auto* client = Script::GetClient(ent);
|
||||
|
||||
client->ping = static_cast<int16_t>(ping);
|
||||
client->ping = ping;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -169,8 +169,8 @@ namespace Components
|
||||
{Game::K_APAD_RIGHT, Game::K_RIGHTARROW},
|
||||
};
|
||||
|
||||
Gamepad::GamePad Gamepad::gamePads[Game::MAX_GAMEPADS]{};
|
||||
Gamepad::GamePadGlobals Gamepad::gamePadGlobals[Game::MAX_GAMEPADS]{{}};
|
||||
Gamepad::GamePad Gamepad::gamePads[Game::MAX_GPAD_COUNT]{};
|
||||
Gamepad::GamePadGlobals Gamepad::gamePadGlobals[Game::MAX_GPAD_COUNT]{{}};
|
||||
int Gamepad::gamePadBindingsModifiedFlags = 0;
|
||||
|
||||
Dvar::Var Gamepad::gpad_enabled;
|
||||
@ -314,7 +314,8 @@ namespace Components
|
||||
|
||||
bool Gamepad::GPad_Check(const int gamePadIndex, const int portIndex)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert((portIndex >= 0) && (portIndex < Game::MAX_GPAD_COUNT));
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
if (XInputGetCapabilities(portIndex, XINPUT_FLAG_GAMEPAD, &gamePad.caps) == ERROR_SUCCESS)
|
||||
@ -332,7 +333,7 @@ namespace Components
|
||||
{
|
||||
auto currentGamePadNum = 0;
|
||||
|
||||
for (auto currentPort = 0; currentPort < XUSER_MAX_COUNT && currentGamePadNum < Game::MAX_GAMEPADS; currentPort++)
|
||||
for (auto currentPort = 0; currentPort < XUSER_MAX_COUNT && currentGamePadNum < Game::MAX_GPAD_COUNT; currentPort++)
|
||||
{
|
||||
if (GPad_Check(currentGamePadNum, currentPort))
|
||||
currentGamePadNum++;
|
||||
@ -366,7 +367,7 @@ namespace Components
|
||||
bool Gamepad::AimAssist_IsPlayerUsingOffhand(Game::AimAssistPlayerState* ps)
|
||||
{
|
||||
// Check offhand flag
|
||||
if ((ps->weapFlags & 2) == 0)
|
||||
if ((ps->weapFlags & Game::PWF_USING_OFFHAND) == 0)
|
||||
return false;
|
||||
|
||||
// If offhand weapon has no id we are not using one
|
||||
@ -421,7 +422,8 @@ namespace Components
|
||||
|
||||
bool Gamepad::AimAssist_IsLockonActive(const int gamePadIndex)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& aaGlob = Game::aaGlobArray[gamePadIndex];
|
||||
|
||||
if (!aim_lockon_enabled.get<bool>() || !gpad_lockon_enabled.get<bool>())
|
||||
@ -439,7 +441,9 @@ namespace Components
|
||||
void Gamepad::AimAssist_ApplyLockOn(const Game::AimInput* input, Game::AimOutput* output)
|
||||
{
|
||||
assert(input);
|
||||
assert(input->localClientNum < Game::MAX_GAMEPADS);
|
||||
assert(output);
|
||||
AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& aaGlob = Game::aaGlobArray[input->localClientNum];
|
||||
|
||||
const auto prevTargetEnt = aaGlob.lockOnTargetEnt;
|
||||
@ -554,10 +558,11 @@ namespace Components
|
||||
void Gamepad::AimAssist_CalcSlowdown(const Game::AimInput* input, float* pitchScale, float* yawScale)
|
||||
{
|
||||
assert(input);
|
||||
assert(input->localClientNum < Game::MAX_GAMEPADS);
|
||||
auto& aaGlob = Game::aaGlobArray[input->localClientNum];
|
||||
assert(pitchScale);
|
||||
assert(yawScale);
|
||||
AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& aaGlob = Game::aaGlobArray[input->localClientNum];
|
||||
|
||||
*pitchScale = 1.0f;
|
||||
*yawScale = 1.0f;
|
||||
@ -586,7 +591,10 @@ namespace Components
|
||||
|
||||
void Gamepad::AimAssist_ApplyTurnRates(const Game::AimInput* input, Game::AimOutput* output)
|
||||
{
|
||||
assert(input->localClientNum < Game::MAX_GAMEPADS);
|
||||
assert(input);
|
||||
assert(output);
|
||||
AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& aaGlob = Game::aaGlobArray[input->localClientNum];
|
||||
|
||||
auto slowdownPitchScale = 0.0f;
|
||||
@ -649,7 +657,8 @@ namespace Components
|
||||
|
||||
void Gamepad::AimAssist_UpdateGamePadInput(const Game::AimInput* input, Game::AimOutput* output)
|
||||
{
|
||||
assert(input->localClientNum < Game::MAX_GAMEPADS);
|
||||
AssertIn(input->localClientNum, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& aaGlob = Game::aaGlobArray[input->localClientNum];
|
||||
|
||||
output->pitch = input->pitch;
|
||||
@ -784,8 +793,8 @@ namespace Components
|
||||
|
||||
float Gamepad::CL_GamepadAxisValue(const int gamePadIndex, const Game::GamepadVirtualAxis virtualAxis)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(virtualAxis > Game::GPAD_VIRTAXIS_NONE && virtualAxis < Game::GPAD_VIRTAXIS_COUNT);
|
||||
|
||||
const auto& gamePadGlobal = gamePadGlobals[gamePadIndex];
|
||||
|
||||
const auto& [physicalAxis, mapType] = gamePadGlobal.axes.virtualAxes[virtualAxis];
|
||||
@ -818,7 +827,8 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadMove(const int gamePadIndex, Game::usercmd_s* cmd, const float frameTimeBase)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
auto& clientActive = Game::clients[gamePadIndex];
|
||||
|
||||
@ -960,7 +970,8 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadResetMenuScrollTime(const int gamePadIndex, const int key, const bool down, const unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePadGlobal = gamePadGlobals[gamePadIndex];
|
||||
|
||||
if (!down)
|
||||
@ -979,8 +990,8 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadGenerateAPad(const int gamePadIndex, const Game::GamepadPhysicalAxis physicalAxis, unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(physicalAxis < Game::GPAD_PHYSAXIS_COUNT && physicalAxis >= 0);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
assert(physicalAxis >= 0 && physicalAxis < Game::GPAD_PHYSAXIS_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
@ -1014,8 +1025,8 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadEvent(const int gamePadIndex, const Game::GamepadPhysicalAxis physicalAxis, const float value, const unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(physicalAxis < Game::GPAD_PHYSAXIS_COUNT && physicalAxis >= 0);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
assert(physicalAxis >= 0 && physicalAxis < Game::GPAD_PHYSAXIS_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
auto& gamePadGlobal = gamePadGlobals[gamePadIndex];
|
||||
@ -1054,7 +1065,8 @@ namespace Components
|
||||
|
||||
bool Gamepad::Scoreboard_HandleInput(int gamePadIndex, int key)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
AssertIn(gamePadIndex, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& keyState = Game::playerKeys[gamePadIndex];
|
||||
|
||||
if (keyState.keys[key].binding && strcmp(keyState.keys[key].binding, "togglescores") == 0)
|
||||
@ -1080,7 +1092,8 @@ namespace Components
|
||||
|
||||
bool Gamepad::CL_CheckForIgnoreDueToRepeat(const int gamePadIndex, const int key, const int repeatCount, const unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
AssertIn(gamePadIndex, Game::STATIC_MAX_LOCAL_CLIENTS);
|
||||
|
||||
auto& gamePadGlobal = gamePadGlobals[gamePadIndex];
|
||||
|
||||
if (Game::Key_IsKeyCatcherActive(gamePadIndex, Game::KEYCATCH_UI))
|
||||
@ -1113,7 +1126,7 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadButtonEvent(const int gamePadIndex, const int key, const Game::GamePadButtonEvent buttonEvent, const unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
const auto pressed = buttonEvent == Game::GPAD_BUTTON_PRESSED;
|
||||
const auto pressedOrUpdated = pressed || buttonEvent == Game::GPAD_BUTTON_UPDATE;
|
||||
@ -1199,7 +1212,7 @@ namespace Components
|
||||
|
||||
void Gamepad::CL_GamepadButtonEventForPort(const int gamePadIndex, const int key, const Game::GamePadButtonEvent buttonEvent, const unsigned time)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
gamePad.inUse = true;
|
||||
@ -1244,7 +1257,9 @@ namespace Components
|
||||
|
||||
float Gamepad::GPad_GetStick(const int gamePadIndex, const Game::GamePadStick stick)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
assert(stick & Game::GPAD_STICK_MASK);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
return gamePad.sticks[stick];
|
||||
@ -1252,7 +1267,7 @@ namespace Components
|
||||
|
||||
float Gamepad::GPad_GetButton(const int gamePadIndex, Game::GamePadButton button)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
float value = 0.0f;
|
||||
@ -1276,7 +1291,9 @@ namespace Components
|
||||
|
||||
bool Gamepad::GPad_IsButtonPressed(const int gamePadIndex, Game::GamePadButton button)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
assert(button & (Game::GPAD_DIGITAL_MASK | Game::GPAD_ANALOG_MASK));
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
bool down = false;
|
||||
@ -1310,7 +1327,8 @@ namespace Components
|
||||
|
||||
bool Gamepad::GPad_IsButtonReleased(int gamePadIndex, Game::GamePadButton button)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
bool down = false;
|
||||
@ -1340,7 +1358,8 @@ namespace Components
|
||||
|
||||
void Gamepad::GPad_UpdateSticksDown(const int gamePadIndex)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
for (auto stickIndex = 0u; stickIndex < std::extent_v<decltype(GamePad::sticks)>; stickIndex++)
|
||||
@ -1371,7 +1390,7 @@ namespace Components
|
||||
|
||||
void Gamepad::GPad_UpdateSticks(const int gamePadIndex, const XINPUT_GAMEPAD& state)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
@ -1403,7 +1422,7 @@ namespace Components
|
||||
|
||||
void Gamepad::GPad_UpdateDigitals(const int gamePadIndex, const XINPUT_GAMEPAD& state)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
@ -1425,7 +1444,7 @@ namespace Components
|
||||
|
||||
void Gamepad::GPad_UpdateAnalogs(const int gamePadIndex, const XINPUT_GAMEPAD& state)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
@ -1452,7 +1471,7 @@ namespace Components
|
||||
{
|
||||
GPad_RefreshAll();
|
||||
|
||||
for (auto currentGamePadIndex = 0; currentGamePadIndex < Game::MAX_GAMEPADS; currentGamePadIndex++)
|
||||
for (auto currentGamePadIndex = 0; currentGamePadIndex < Game::MAX_GPAD_COUNT; currentGamePadIndex++)
|
||||
{
|
||||
const auto& gamePad = gamePads[currentGamePadIndex];
|
||||
if (!gamePad.enabled)
|
||||
@ -1477,7 +1496,7 @@ namespace Components
|
||||
const auto time = Game::Sys_Milliseconds();
|
||||
|
||||
bool gpadPresent = false;
|
||||
for (auto gamePadIndex = 0; gamePadIndex < Game::MAX_GAMEPADS; gamePadIndex++)
|
||||
for (auto gamePadIndex = 0; gamePadIndex < Game::MAX_GPAD_COUNT; gamePadIndex++)
|
||||
{
|
||||
const auto& gamePad = gamePads[gamePadIndex];
|
||||
|
||||
@ -1540,7 +1559,8 @@ namespace Components
|
||||
|
||||
void Gamepad::Gamepad_WriteBindings(const int gamePadIndex, const int handle)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
|
||||
auto& gamePadGlobal = gamePadGlobals[gamePadIndex];
|
||||
|
||||
Game::FS_Printf(handle, "unbindallaxis\n");
|
||||
@ -1592,7 +1612,7 @@ namespace Components
|
||||
|
||||
void Gamepad::Gamepad_BindAxis(const int gamePadIndex, const Game::GamepadPhysicalAxis realIndex, const Game::GamepadVirtualAxis axisIndex, const Game::GamepadMapping mapType)
|
||||
{
|
||||
assert(gamePadIndex < Game::MAX_GAMEPADS);
|
||||
assert(gamePadIndex < Game::MAX_GPAD_COUNT);
|
||||
assert(realIndex > Game::GPAD_PHYSAXIS_NONE && realIndex < Game::GPAD_PHYSAXIS_COUNT);
|
||||
assert(axisIndex > Game::GPAD_VIRTAXIS_NONE && axisIndex < Game::GPAD_VIRTAXIS_COUNT);
|
||||
assert(mapType > Game::GPAD_MAP_NONE && mapType < Game::GPAD_MAP_COUNT);
|
||||
|
@ -62,8 +62,8 @@ namespace Components
|
||||
static Game::keyname_t combinedLocalizedKeyNamesPs3[];
|
||||
static ControllerMenuKeyMapping controllerMenuKeyMappings[];
|
||||
|
||||
static GamePad gamePads[Game::MAX_GAMEPADS];
|
||||
static GamePadGlobals gamePadGlobals[Game::MAX_GAMEPADS];
|
||||
static GamePad gamePads[Game::MAX_GPAD_COUNT];
|
||||
static GamePadGlobals gamePadGlobals[Game::MAX_GPAD_COUNT];
|
||||
|
||||
static int gamePadBindingsModifiedFlags;
|
||||
|
||||
|
@ -270,7 +270,7 @@ namespace Components
|
||||
Logger::Print(Game::conChannel_t::CON_CHANNEL_NETWORK, "Negative reliableAcknowledge from {} - cl->reliableSequence is {}, reliableAcknowledge is {}\n",
|
||||
client->name, client->reliableSequence, client->reliableAcknowledge);
|
||||
client->reliableAcknowledge = client->reliableSequence;
|
||||
SendCommand(Game::NS_SERVER, client->netchan.remoteAddress, "error", "EXE_LOSTRELIABLECOMMANDS");
|
||||
SendCommand(Game::NS_SERVER, client->header.netchan.remoteAddress, "error", "EXE_LOSTRELIABLECOMMANDS");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace Components
|
||||
{
|
||||
for (int i = 0; i < maxclientCount; ++i)
|
||||
{
|
||||
if (Game::svs_clients[i].state >= 3)
|
||||
if (Game::svs_clients[i].header.state >= Game::CS_CONNECTED)
|
||||
{
|
||||
if (Game::svs_clients[i].bIsTestClient) ++botCount;
|
||||
else ++clientCount;
|
||||
|
@ -208,7 +208,7 @@ namespace Components
|
||||
|
||||
if ((*Game::com_sv_running)->current.enabled)
|
||||
{
|
||||
if (Game::svs_clients[i].state < 3) continue;
|
||||
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||
|
||||
score = Game::SV_GameClientNum_Score(i);
|
||||
ping = Game::svs_clients[i].ping;
|
||||
|
@ -70,7 +70,7 @@ namespace Components
|
||||
// set snapshot num to 1 behind (T6 does this, why shouldn't we?)
|
||||
for (int i = 0; i < *Game::svs_clientCount; ++i)
|
||||
{
|
||||
Game::svs_clients[i].snapNum = *Game::svs_time - 1;
|
||||
Game::svs_clients[i].nextSnapshotTime = *Game::svs_time - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace Components
|
||||
|
||||
assert(VoicePacketCount[clientNum] >= 0);
|
||||
|
||||
if (client->state == Game::CS_ACTIVE && VoicePacketCount[clientNum])
|
||||
if (client->header.state == Game::CS_ACTIVE && VoicePacketCount[clientNum])
|
||||
{
|
||||
Game::MSG_Init(&msg, msg_buf.get(), 0x10000);
|
||||
|
||||
@ -58,7 +58,7 @@ namespace Components
|
||||
}
|
||||
else
|
||||
{
|
||||
Game::NET_OutOfBandVoiceData(Game::NS_SERVER, client->netchan.remoteAddress, msg.data, msg.cursize, true);
|
||||
Game::NET_OutOfBandVoiceData(Game::NS_SERVER, client->header.netchan.remoteAddress, msg.data, msg.cursize, true);
|
||||
VoicePacketCount[clientNum] = 0;
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ namespace Components
|
||||
Game::MSG_ReadData(msg, voicePacket.data, voicePacket.dataSize);
|
||||
for (auto otherPlayer = 0; otherPlayer < (*Game::sv_maxclients)->current.integer; ++otherPlayer)
|
||||
{
|
||||
if (otherPlayer != talker && Game::svs_clients[otherPlayer].state >= Game::CS_CONNECTED && !SV_ServerHasClientMuted(talker))
|
||||
if (otherPlayer != talker && Game::svs_clients[otherPlayer].header.state >= Game::CS_CONNECTED && !SV_ServerHasClientMuted(talker))
|
||||
{
|
||||
SV_QueueVoicePacket(talker, otherPlayer, &voicePacket);
|
||||
}
|
||||
@ -213,15 +213,15 @@ namespace Components
|
||||
|
||||
void Voice::SV_VoicePacket(Game::netadr_t from, Game::msg_t* msg)
|
||||
{
|
||||
auto qport = Game::MSG_ReadShort(msg);
|
||||
const auto qport = Game::MSG_ReadShort(msg);
|
||||
auto* cl = Game::SV_FindClientByAddress(from, qport, 0);
|
||||
if (!cl || cl->state == Game::CS_ZOMBIE)
|
||||
if (!cl || cl->header.state == Game::CS_ZOMBIE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cl->lastPacketTime = *Game::svs_time;
|
||||
if (cl->state < Game::CS_ACTIVE)
|
||||
if (cl->header.state < Game::CS_ACTIVE)
|
||||
{
|
||||
SV_PreGameUserVoice(cl, msg);
|
||||
}
|
||||
|
@ -884,8 +884,8 @@ namespace Game
|
||||
{
|
||||
for (auto i = 0; i < *svs_clientCount; ++i)
|
||||
{
|
||||
if (svs_clients[i].state != CS_FREE
|
||||
&& svs_clients[i].netchan.remoteAddress.type == NA_BOT)
|
||||
if (svs_clients[i].header.state != CS_FREE
|
||||
&& svs_clients[i].header.netchan.remoteAddress.type == NA_BOT)
|
||||
{
|
||||
SV_GameDropClient(i, "GAME_GET_TO_COVER");
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ namespace Game
|
||||
typedef bool(__cdecl * SV_Loaded_t)();
|
||||
extern SV_Loaded_t SV_Loaded;
|
||||
|
||||
typedef void(__cdecl * SV_ClientThink_t)(client_s*, usercmd_s*);
|
||||
typedef void(__cdecl * SV_ClientThink_t)(client_t* cl, usercmd_s* cmd);
|
||||
extern SV_ClientThink_t SV_ClientThink;
|
||||
|
||||
typedef void(__cdecl * SV_DropClient_t)(client_t* drop, const char* reason, bool tellThem);
|
||||
|
@ -235,7 +235,7 @@ namespace Game
|
||||
DVAR_TYPE_COUNT = 0xA,
|
||||
} dvar_type;
|
||||
|
||||
typedef enum
|
||||
enum clientState_t
|
||||
{
|
||||
CS_FREE = 0x0,
|
||||
CS_ZOMBIE = 0x1,
|
||||
@ -243,7 +243,7 @@ namespace Game
|
||||
CS_CONNECTED = 0x3,
|
||||
CS_CLIENTLOADING = 0x4,
|
||||
CS_ACTIVE = 0x5,
|
||||
} clientState_t;
|
||||
};
|
||||
|
||||
enum serverState_t
|
||||
{
|
||||
@ -6301,19 +6301,50 @@ namespace Game
|
||||
bool topFire;
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct client_s
|
||||
struct clientHeader_t
|
||||
{
|
||||
clientState_t state; // 0
|
||||
int sendAsActive; // 4
|
||||
int deltaMessage; // 8
|
||||
char __pad1[12]; // 12
|
||||
netchan_t netchan; // 24
|
||||
char __pad2[20]; // 1604
|
||||
const char* delayDropReason; // 1624
|
||||
int state;
|
||||
int sendAsActive;
|
||||
int deltaMessage;
|
||||
int rateDelayed;
|
||||
int hasAckedBaselineData;
|
||||
int hugeSnapshotSent;
|
||||
netchan_t netchan;
|
||||
float predictedOrigin[3];
|
||||
int predictedOriginServerTime;
|
||||
int migrationState;
|
||||
};
|
||||
|
||||
static_assert(sizeof(clientHeader_t) == 1624);
|
||||
|
||||
struct svscmd_info_t
|
||||
{
|
||||
char cmd[1024];
|
||||
int time;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct clientSnapshot_t
|
||||
{
|
||||
playerState_s ps;
|
||||
int num_entities;
|
||||
int num_clients;
|
||||
int first_entity;
|
||||
int first_client;
|
||||
int messageSent;
|
||||
int messageAcked;
|
||||
int messageSize;
|
||||
int serverTime;
|
||||
int timeDelta;
|
||||
int baselineSnap;
|
||||
};
|
||||
|
||||
struct client_t
|
||||
{
|
||||
clientHeader_t header;
|
||||
const char* dropReason; // 1624
|
||||
char userinfo[1024]; // 1628
|
||||
char __pad3[132096]; // 2652
|
||||
svscmd_info_t reliableCommandInfo[128]; // 2652
|
||||
int reliableSequence; // 134748
|
||||
int reliableAcknowledge; // 134752
|
||||
int reliableSent; // 134756
|
||||
@ -6328,21 +6359,31 @@ namespace Game
|
||||
int nextReliableTime; // 135860
|
||||
int lastPacketTime; // 135864
|
||||
int lastConnectTime; // 135868
|
||||
int snapNum; // 135872
|
||||
int __pad5; // 135876
|
||||
short ping; // 135880
|
||||
char __pad6[14]; // 135882
|
||||
int nextSnapshotTime; // 135872
|
||||
int timeoutCount; // 135876
|
||||
int ping; // 135880
|
||||
int rate;
|
||||
int snapshotMsec;
|
||||
int snapshotBackoffCount;
|
||||
int pureAuthentic; // 135896
|
||||
char __pad7[133138]; // 135900
|
||||
short scriptID; // 269038
|
||||
char netchanOutgoingBuffer[131072];
|
||||
char netchanIncomingBuffer[2048];
|
||||
char playerGuid[17];
|
||||
unsigned short scriptId; // 269038
|
||||
int bIsTestClient; // 269040
|
||||
int serverID; // 269044
|
||||
char __pad8[9224]; // 269048
|
||||
bool usingOnlineStatsOffline;
|
||||
char stats[8192];
|
||||
char statsModifiedFlags[1024];
|
||||
bool statsModified;
|
||||
char statPacketsReceived;
|
||||
bool steamAuthorized;
|
||||
char steamAuthFailCount;
|
||||
unsigned __int64 steamID; // 278272
|
||||
char __pad9[403592]; // 278280
|
||||
} client_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
bool sendMatchData;
|
||||
int matchDataSendTime;
|
||||
clientSnapshot_t frames[32];
|
||||
};
|
||||
|
||||
static_assert(sizeof(client_t) == 0xA6790);
|
||||
|
||||
@ -7574,7 +7615,7 @@ namespace Game
|
||||
|
||||
static_assert(sizeof(cg_s) == 0xFD540);
|
||||
|
||||
static constexpr auto MAX_GAMEPADS = 1;
|
||||
static constexpr auto MAX_GPAD_COUNT = 1;
|
||||
|
||||
static constexpr auto GPAD_VALUE_MASK = 0xFFFFFFFu;
|
||||
static constexpr auto GPAD_DPAD_MASK = XINPUT_GAMEPAD_DPAD_UP | XINPUT_GAMEPAD_DPAD_DOWN | XINPUT_GAMEPAD_DPAD_LEFT | XINPUT_GAMEPAD_DPAD_RIGHT;
|
||||
|
Loading…
Reference in New Issue
Block a user