fakeping: force-enable fake pings on listen server

combat: reduce jumping when in strafe mode (ref #699)
linkage: enable bots bullet spread when running without metamod
Co-Authored-By: Max <161382234+dyspose@users.noreply.github.com>
This commit is contained in:
jeefo 2025-06-09 13:07:55 +03:00
commit ae913a52db
No known key found for this signature in database
GPG key ID: D696786B81B667C8
3 changed files with 29 additions and 2 deletions

View file

@ -1606,6 +1606,7 @@ void Bot::attackMovement () {
}
if (m_difficulty >= Difficulty::Normal
&& distanceSq < cr::sqrf (kSprayDistance)
&& (m_jumpTime + 5.0f < game.time ()
&& isOnFloor ()
&& rg (0, 1000) < (m_isReloading ? 8 : 2)

View file

@ -1216,7 +1216,16 @@ void Game::printBotVersion () const {
}
void Game::ensureHealthyGameEnvironment () {
if (!isDedicated () || is (GameFlags::Legacy | GameFlags::Xash3D)) {
const bool dedicated = isDedicated ();
if (!dedicated || is (GameFlags::Legacy | GameFlags::Xash3D)) {
if (!dedicated) {
// force enable pings on listen servers if disabled at all
if (is (GameFlags::Modern) && cv_show_latency.as <int> () == 0) {
cv_show_latency.set (2);
}
}
return; // listen servers doesn't care about it at all
}

View file

@ -86,7 +86,7 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int interfaceVersion) {
plat.bzero (table, sizeof (gamefuncs_t));
if (!(game.is (GameFlags::Metamod))) {
if (!game.is (GameFlags::Metamod)) {
auto api_GetEntityAPI = game.lib ().resolve <decltype (&GetEntityAPI)> (__func__);
// pass other DLLs engine callbacks to function table...
@ -436,6 +436,23 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int interfaceVersion) {
};
}
// add some bullet spread on games, where w're runnung without metamod
if (!game.is (GameFlags::Metamod) && !game.is (GameFlags::Legacy)) {
table->pfnCmdStart = [] (const edict_t *player, usercmd_t *cmd, unsigned int random_seed) CR_FORCE_STACK_ALIGN {
// some MODs don't feel like doing like everybody else. It's the case in DMC, where players
// don't select their weapons using a simple client command, but have to use an horrible
// datagram like this. CmdStart() marks the start of a network packet clients send to the
// server that holds a limited set of requests (see the usercmd_t structure for details).
// It has been adapted for usage to HLTV spectators, who don't send ClientCommands, but send
// all their update information to the server using usercmd's instead, it seems.
if (bots[const_cast <edict_t *> (player)]) {
random_seed = rg (0, 0x7fffffff);
}
dllapi.pfnCmdStart (player, cmd, random_seed);
};
}
table->pfnPM_Move = [] (playermove_t *pm, int server) CR_FORCE_STACK_ALIGN {
// this is the player movement code clients run to predict things when the server can't update
// them often enough (or doesn't want to). The server runs exactly the same function for