From ffacefe00ac83d2fd630268ff1e2d56854883876 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 16 Jun 2023 04:57:18 +1000 Subject: [PATCH] items: temp kludge to reduce visibility of prediction errors FIXME PROPERLY: needs moar sv_legacy_bbox_expand 0 --- qcsrc/client/items/items.qc | 9 +++++++++ qcsrc/common/items/item.qh | 3 ++- qcsrc/server/items/items.qc | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/items/items.qc b/qcsrc/client/items/items.qc index c1bcfe6e5..755f0f9cd 100644 --- a/qcsrc/client/items/items.qc +++ b/qcsrc/client/items/items.qc @@ -315,6 +315,15 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) set_movetype(this, MOVETYPE_TOSS); this.velocity = ReadVector(); } + else if (this.gravity) // caution: kludge FIXME (with sv_legacy_bbox_expand) + { + // workaround for prediction errors caused by bbox discrepancy between SVQC and CSQC + this.gravity = 0; // don't do this kludge again + this.pushable = false; // no fun allowed + set_movetype(this, MOVETYPE_NONE); // disable physics + this.velocity = '0 0 0'; // disable it more + SET_ONGROUND(this); // extra overkill + } this.entremove = ItemRemove; diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 2de498aaf..038566784 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -63,7 +63,8 @@ const int ITS_EXPIRING = BIT(7); const float IT_DESPAWNFX_TIME = 1.5; // 2hz probably enough to correct a desync caused by serious lag -const float IT_UPDATE_INTERVAL = 0.5; +// FIXME but updating faster applies the kludge in Item_Think() sooner so it's less noticeable +const float IT_UPDATE_INTERVAL = 0.0625; .float fade_start; .float fade_end; diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 3aef870e0..46587b9c1 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -205,6 +205,11 @@ void Item_Think(entity this) if (this.itemdef.instanceOfPowerup) powerups_DropItem_Think(this); + // caution: kludge FIXME (with sv_legacy_bbox_expand) + // this works around prediction errors caused by bbox discrepancy between SVQC and CSQC + if (this.velocity == '0 0 0' && IS_ONGROUND(this)) + this.gravity = 0; // don't send ISF_DROP anymore + // send slow updates even if the item didn't move // recovers prediction desyncs where server thinks item stopped, client thinks it didn't ItemUpdate(this); -- 2.39.2