fix: fakeping disappearance completely
not sure when and why pingUpdate was appeared, but it was the cause
This commit is contained in:
parent
99a8ca2d1b
commit
d45e534f3c
4 changed files with 6 additions and 28 deletions
|
|
@ -101,7 +101,7 @@ public:
|
||||||
void calculatePings ();
|
void calculatePings ();
|
||||||
|
|
||||||
// send modified pings to all the clients
|
// send modified pings to all the clients
|
||||||
void sendPings (edict_t *to);
|
void emitPings (edict_t *to);
|
||||||
|
|
||||||
// installs the sendto function intreception
|
// installs the sendto function intreception
|
||||||
void installSendTo ();
|
void installSendTo ();
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,6 @@ struct Client {
|
||||||
int ping; // when bot latency is enabled, client ping stored here
|
int ping; // when bot latency is enabled, client ping stored here
|
||||||
int iconFlags[kGameMaxPlayers]; // flag holding chatter icons
|
int iconFlags[kGameMaxPlayers]; // flag holding chatter icons
|
||||||
float iconTimestamp[kGameMaxPlayers]; // timers for chatter icons
|
float iconTimestamp[kGameMaxPlayers]; // timers for chatter icons
|
||||||
bool pingUpdate; // update ping ?
|
|
||||||
ClientNoise noise;
|
ClientNoise noise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,7 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
|
||||||
if (game.is (GameFlags::HasFakePings) && cv_show_latency.int_ () == 2) {
|
if (game.is (GameFlags::HasFakePings) && cv_show_latency.int_ () == 2) {
|
||||||
if (!util.isFakeClient (ent) && (ent->v.oldbuttons | ent->v.button | cmd->buttons) & IN_SCORE) {
|
if (!util.isFakeClient (ent) && (ent->v.oldbuttons | ent->v.button | cmd->buttons) & IN_SCORE) {
|
||||||
cmd->buttons &= ~IN_SCORE;
|
cmd->buttons &= ~IN_SCORE;
|
||||||
|
util.emitPings (ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,32 +419,18 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
|
||||||
dllapi.pfnCmdStart (ent, cmd, random_seed);
|
dllapi.pfnCmdStart (ent, cmd, random_seed);
|
||||||
};
|
};
|
||||||
|
|
||||||
table->pfnUpdateClientData = [] (const struct edict_s *player, int sendweapons, struct clientdata_s *cd) {
|
table->pfnPM_Move = [] (playermove_t *pm, int server) {
|
||||||
auto ent = const_cast <edict_t *> (player);
|
|
||||||
|
|
||||||
if (game.is (GameFlags::HasFakePings) && cv_show_latency.int_ () == 2) {
|
|
||||||
if (!util.isFakeClient (ent) && (ent->v.oldbuttons | ent->v.button) & IN_SCORE) {
|
|
||||||
util.sendPings (ent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (game.is (GameFlags::Metamod)) {
|
|
||||||
RETURN_META (MRES_IGNORED);
|
|
||||||
}
|
|
||||||
dllapi.pfnUpdateClientData (ent, sendweapons, cd);
|
|
||||||
};
|
|
||||||
|
|
||||||
table->pfnPM_Move = [] (playermove_t *playerMove, int server) {
|
|
||||||
// this is the player movement code clients run to predict things when the server can't update
|
// 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
|
// them often enough (or doesn't want to). The server runs exactly the same function for
|
||||||
// moving players. There is normally no distinction between them, else client-side prediction
|
// moving players. There is normally no distinction between them, else client-side prediction
|
||||||
// wouldn't work properly (and it doesn't work that well, already...)
|
// wouldn't work properly (and it doesn't work that well, already...)
|
||||||
|
|
||||||
illum.setWorldModel (playerMove->physents[0].model);
|
illum.setWorldModel (pm->physents[0].model);
|
||||||
|
|
||||||
if (game.is (GameFlags::Metamod)) {
|
if (game.is (GameFlags::Metamod)) {
|
||||||
RETURN_META (MRES_IGNORED);
|
RETURN_META (MRES_IGNORED);
|
||||||
}
|
}
|
||||||
dllapi.pfnPM_Move (playerMove, server);
|
dllapi.pfnPM_Move (pm, server);
|
||||||
};
|
};
|
||||||
return HLTrue;
|
return HLTrue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -581,8 +581,6 @@ void BotSupport::calculatePings () {
|
||||||
|
|
||||||
// store normal client ping
|
// store normal client ping
|
||||||
client.ping = getPingBitmask (client.ent, loss, ping > 0 ? ping : rg.get (8, 16)); // getting player ping sometimes fails
|
client.ping = getPingBitmask (client.ent, loss, ping > 0 ? ping : rg.get (8, 16)); // getting player ping sometimes fails
|
||||||
client.pingUpdate = true; // force resend ping
|
|
||||||
|
|
||||||
++numHumans;
|
++numHumans;
|
||||||
|
|
||||||
average.first += ping;
|
average.first += ping;
|
||||||
|
|
@ -620,13 +618,11 @@ void BotSupport::calculatePings () {
|
||||||
else if (botPing > 70) {
|
else if (botPing > 70) {
|
||||||
botPing = rg.get (30, 40);
|
botPing = rg.get (30, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.ping = getPingBitmask (client.ent, botLoss, botPing);
|
client.ping = getPingBitmask (client.ent, botLoss, botPing);
|
||||||
client.pingUpdate = true; // force resend ping
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BotSupport::sendPings (edict_t *to) {
|
void BotSupport::emitPings (edict_t *to) {
|
||||||
MessageWriter msg;
|
MessageWriter msg;
|
||||||
|
|
||||||
// missing from sdk
|
// missing from sdk
|
||||||
|
|
@ -636,10 +632,6 @@ void BotSupport::sendPings (edict_t *to) {
|
||||||
if (!(client.flags & ClientFlags::Used) || client.ent == game.getLocalEntity ()) {
|
if (!(client.flags & ClientFlags::Used) || client.ent == game.getLocalEntity ()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!client.pingUpdate) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
client.pingUpdate = false;
|
|
||||||
|
|
||||||
// no ping, no fun
|
// no ping, no fun
|
||||||
if (!client.ping) {
|
if (!client.ping) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue