]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Add cvar mod_q1bsp_zero_hullsize_cutoff for games using "big" projectiles on Q1BSP
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 21 Jul 2023 08:28:04 +0000 (18:28 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 21 Jul 2023 08:38:50 +0000 (18:38 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cmd.c
model_brush.c

diff --git a/cmd.c b/cmd.c
index c9b2cd5d8b0fc8d172d69685c59880122518d1d7..0fd600187e04081b333f708b93e94949068ebcad 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -804,6 +804,7 @@ static void Cmd_Exec(cmd_state_t *cmd, const char *filename)
 "csqc_polygons_defaultmaterial_nocullface 1\n"
 "con_chatsound_team_mask 13\n"
 "sv_gameplayfix_customstats 1\n"
+"mod_q1bsp_zero_hullsize_cutoff 8.03125\n"
                                );
                        break;
                // Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1
index bfed557107e7088e547dde9b614e80309d4f9c61..8d22e70c3bf25879e9a625b82c7e7bde51e38187 100644 (file)
@@ -65,6 +65,7 @@ cvar_t mod_q3shader_force_addalpha = {CF_CLIENT, "mod_q3shader_force_addalpha",
 cvar_t mod_q3shader_force_terrain_alphaflag = {CF_CLIENT, "mod_q3shader_force_terrain_alphaflag", "0", "for multilayered terrain shaders force TEXF_ALPHA flag on both layers"};
 
 cvar_t mod_q1bsp_polygoncollisions = {CF_CLIENT | CF_SERVER, "mod_q1bsp_polygoncollisions", "0", "disables use of precomputed cliphulls and instead collides with polygons (uses Bounding Interval Hierarchy optimizations)"};
+cvar_t mod_q1bsp_zero_hullsize_cutoff = {CF_CLIENT | CF_SERVER, "mod_q1bsp_zero_hullsize_cutoff", "3", "bboxes with an X dimension smaller than this will use the smallest cliphull (0x0x0) instead of being rounded up to the player's cliphull (32x32x56)"};
 cvar_t mod_recalculatenodeboxes = {CF_CLIENT | CF_SERVER, "mod_recalculatenodeboxes", "1", "enables use of generated node bounding boxes based on BSP tree portal reconstruction, rather than the node boxes supplied by the map compiler"};
 
 static texture_t mod_q1bsp_texture_solid;
@@ -115,6 +116,7 @@ void Mod_BrushInit(void)
        Cvar_RegisterVariable(&mod_q3shader_force_addalpha);
        Cvar_RegisterVariable(&mod_q3shader_force_terrain_alphaflag);
        Cvar_RegisterVariable(&mod_q1bsp_polygoncollisions);
+       Cvar_RegisterVariable(&mod_q1bsp_zero_hullsize_cutoff);
        Cvar_RegisterVariable(&mod_recalculatenodeboxes);
 
        // these games were made for older DP engines and are no longer
@@ -976,7 +978,7 @@ static void Mod_Q1BSP_TraceBox(struct model_s *model, const frameblend_t *frameb
        rhc.trace->fraction = 1;
        rhc.trace->allsolid = true;
        VectorSubtract(boxmaxs, boxmins, boxsize);
-       if (boxsize[0] < 3)
+       if (boxsize[0] < mod_q1bsp_zero_hullsize_cutoff.value)
                rhc.hull = &model->brushq1.hulls[0]; // 0x0x0
        else if (model->brush.ishlbsp)
        {
@@ -3828,7 +3830,7 @@ static void Mod_Q1BSP_RoundUpToHullSize(model_t *cmodel, const vec3_t inmins, co
        VectorSubtract(inmaxs, inmins, size);
        if (cmodel->brush.ishlbsp)
        {
-               if (size[0] < 3)
+               if (size[0] < mod_q1bsp_zero_hullsize_cutoff.value)
                        hull = &cmodel->brushq1.hulls[0]; // 0x0x0
                else if (size[0] <= 32)
                {