From 92af2ed3f7af35b5de8c7b3e910dad8618f6804f Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 22 Jun 2022 22:37:09 -0600 Subject: [PATCH] qbsp: restore weird 1 unit bounds shrinkage Q1 needs --- qbsp/test_qbsp.cc | 6 +++--- qbsp/writebsp.cc | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/qbsp/test_qbsp.cc b/qbsp/test_qbsp.cc index 5c0043ba..0c381790 100644 --- a/qbsp/test_qbsp.cc +++ b/qbsp/test_qbsp.cc @@ -974,9 +974,9 @@ TEST_CASE("q1_cube", "[testmaps_q1]") CHECK(cube_bounds_grown.mins() == headnode.mins); CHECK(cube_bounds_grown.maxs() == headnode.maxs); - // model bounds -// CHECK(cube_bounds_grown.mins() == bsp.dmodels[0].mins); -// CHECK(cube_bounds_grown.maxs() == bsp.dmodels[0].maxs); + // model bounds are shrunk by 1 unit on each side for some reason + CHECK(cube_bounds.grow(-1).mins() == bsp.dmodels[0].mins); + CHECK(cube_bounds.grow(-1).maxs() == bsp.dmodels[0].maxs); } /** diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index f1c72ebe..59d86a1a 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -272,6 +272,12 @@ void ExportDrawNodes(mapentity_t *entity, node_t *headnode, int firstface) dmodel.mins[i] = headnode->bounds.mins()[i] + SIDESPACE; dmodel.maxs[i] = headnode->bounds.maxs()[i] - SIDESPACE; } + + // shrink the bounds in Q1 based games (Q1 engine compensates for this in Mod_LoadSubmodels) + if (options.target_game->id != GAME_QUAKE_II) { + dmodel.mins += qvec3d(1,1,1); + dmodel.maxs -= qvec3d(1,1,1); + } } //=============================================================================