fix player view offset and headshot bbox
authorRudolf Polzer <divverent@alientrap.org>
Sun, 7 Nov 2010 21:06:45 +0000 (22:06 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 7 Nov 2010 21:06:45 +0000 (22:06 +0100)
defaultXonotic.cfg
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc

index c38cf5f..59c3be6 100644 (file)
@@ -370,9 +370,10 @@ set sv_fragmessage_information_typefrag 1 "Enable typefrag display information,
 // use default physics
 set sv_friction_on_land 0
 
-set sv_player_viewoffset "0 0 42" "view offset of the player model"
+set sv_player_viewoffset "0 0 35" "view offset of the player model"
 set sv_player_mins "-16 -16 -24" "playermodel mins"
 set sv_player_maxs "16 16 45" "playermodel maxs"
+set sv_player_headsize "24 24 12" "playermodel headshot bbox size (centered at top of player bbox, preview with r_showbboxes)" // actually SHOULD be 19.2 19.2 10 according to docs
 set sv_player_crouch_viewoffset "0 0 20" "view offset of the player model when crouched"
 set sv_player_crouch_mins "-16 -16 -24" "mins of a crouched playermodel"
 set sv_player_crouch_maxs "16 16 25" "maxs of a crouched playermodel"
index 1246d26..809df9e 100644 (file)
@@ -88,11 +88,11 @@ float IsFlying(entity a)
 
 vector GetHeadshotMins(entity targ)
 {
-       return '0.6 0 0' * targ.mins_x + '0 0.6 0' * targ.mins_y + '0 0 1' * (1.3 * targ.view_ofs_z - 0.3 * targ.maxs_z);
+       return '-0.5 0 0' * PL_HEAD_x + '0 -0.5 0' * PL_HEAD_y + '0 0 1' * (targ.maxs_z - PL_HEAD_z);
 }
 vector GetHeadshotMaxs(entity targ)
 {
-       return '0.6 0 0' * targ.maxs_x + '0 0.6 0' * targ.maxs_y + '0 0 1' * targ.maxs_z;
+       return '0.5 0 0' * PL_HEAD_x + '0 0.5 0' * PL_HEAD_y + '0 0 1' * targ.maxs_z;
 }
 
 void UpdateFrags(entity player, float f)
index 5485cc1..08550a1 100644 (file)
@@ -181,6 +181,7 @@ void GameLogClose()
 vector PL_VIEW_OFS;
 vector PL_MIN;
 vector PL_MAX;
+vector PL_HEAD;
 vector PL_CROUCH_VIEW_OFS;
 vector PL_CROUCH_MIN;
 vector PL_CROUCH_MAX;
@@ -191,6 +192,7 @@ void relocate_spawnpoint()
     PL_VIEW_OFS                             = stov(cvar_string("sv_player_viewoffset"));
     PL_MIN                                  = stov(cvar_string("sv_player_mins"));
     PL_MAX                                  = stov(cvar_string("sv_player_maxs"));
+    PL_HEAD                                 = stov(cvar_string("sv_player_headsize"));
     PL_CROUCH_VIEW_OFS                      = stov(cvar_string("sv_player_crouch_viewoffset"));
     PL_CROUCH_MIN                           = stov(cvar_string("sv_player_crouch_mins"));
     PL_CROUCH_MAX                           = stov(cvar_string("sv_player_crouch_maxs"));