From 2c943b957e730bc137bfae6404369b3af34b77ce Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 23 May 2023 21:51:18 +1000 Subject: [PATCH] sv_q3compat_changehitbox: use correct model scale and offset This reverts ead859bab7cbd97dea819ac023599c10a3bb017c forgot to check model offset, oops and better documents the config. Player's head no longer sticks out of the bbox, offset and scaling are equivalent to default settings. --- qcsrc/common/physics/player.qc | 22 ++++++++++++++++------ qcsrc/server/client.qc | 3 ++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 8f681ce5f..e7f88b27b 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -64,13 +64,23 @@ void Physics_UpdateStats(entity this) STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, this) = Physics_ClientOption(this, "airspeedlimit_nonqw", autocvar_sv_airspeedlimit_nonqw) * maxspd_mod; } + /* Q3 uses the following: + * MIN '-15 -15 -24' + * MAX '15 15 32' + * VIEW_OFS '0 0 26' + * CROUCH_MIN '-15 -15 -24' + * CROUCH_MAX '15 15 16' + * CROUCH_VIEW_OFS '0 0 12' + * but xon player models have a different z offset to suit the origin at 24/69 + * at q3compat hitbox and model scale the equivalent offset is origin at 20/56 + */ bool q3hb = q3compat && autocvar_sv_q3compat_changehitbox; - STAT(PL_MIN, this) = q3hb ? '-15 -15 -24' : autocvar_sv_player_mins; - STAT(PL_MAX, this) = q3hb ? '15 15 32' : autocvar_sv_player_maxs; - STAT(PL_VIEW_OFS, this) = q3hb ? '0 0 26' : autocvar_sv_player_viewoffset; - STAT(PL_CROUCH_MIN, this) = q3hb ? '-15 -15 -24' : autocvar_sv_player_crouch_mins; - STAT(PL_CROUCH_MAX, this) = q3hb ? '15 15 16' : autocvar_sv_player_crouch_maxs; - STAT(PL_CROUCH_VIEW_OFS, this) = q3hb ? '0 0 12' : autocvar_sv_player_crouch_viewoffset; + STAT(PL_MIN, this) = q3hb ? '-15 -15 -20' : autocvar_sv_player_mins; + STAT(PL_MAX, this) = q3hb ? '15 15 36' : autocvar_sv_player_maxs; + STAT(PL_VIEW_OFS, this) = q3hb ? '0 0 30' : autocvar_sv_player_viewoffset; + STAT(PL_CROUCH_MIN, this) = q3hb ? '-15 -15 -20' : autocvar_sv_player_crouch_mins; + STAT(PL_CROUCH_MAX, this) = q3hb ? '15 15 20' : autocvar_sv_player_crouch_maxs; + STAT(PL_CROUCH_VIEW_OFS, this) = q3hb ? '0 0 16' : autocvar_sv_player_crouch_viewoffset; // old stats // fix some new settings diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f78d772c5..4c19adcff 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -641,7 +641,8 @@ void PutPlayerInServer(entity this) this.respawn_flags = 0; this.respawn_time = 0; STAT(RESPAWN_TIME, this) = 0; - this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.9 : autocvar_sv_player_scale); + // DP model scaling uses 1/16 accuracy and 13/16 is closest to 56/69 + this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.8125 : autocvar_sv_player_scale); this.fade_time = 0; this.pain_finished = 0; this.pushltime = 0; -- 2.39.2