diff --git a/src/combat.cpp b/src/combat.cpp index 7e39530..3c4beb7 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -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) diff --git a/src/engine.cpp b/src/engine.cpp index f3283e9..520179a 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -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 () == 0) { + cv_show_latency.set (2); + } + } return; // listen servers doesn't care about it at all } diff --git a/src/linkage.cpp b/src/linkage.cpp index 6bed47c..227ca83 100644 --- a/src/linkage.cpp +++ b/src/linkage.cpp @@ -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 (__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 (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