From b6ce6ae5277fec8ccef8458fcd6b1df506633362 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 12 May 2022 23:51:05 -0600 Subject: [PATCH] testqbsp: simple_worldspawn_sky: fix expectation so sky leafs don't fill outwards --- qbsp/test_qbsp.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qbsp/test_qbsp.cc b/qbsp/test_qbsp.cc index 4b8d4874..66a8c07a 100644 --- a/qbsp/test_qbsp.cc +++ b/qbsp/test_qbsp.cc @@ -497,10 +497,16 @@ TEST(testmaps_q1, simple_worldspawn_sky) // check contents const qvec3d player_pos{-88, -64, 120}; + const double inside_sky_z = 232; EXPECT_EQ(CONTENTS_EMPTY, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], player_pos)->contents); - EXPECT_EQ(CONTENTS_SKY, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], player_pos + qvec3d(0,0,500))->contents); + // way above map is solid - sky should not fill outwards + // (otherwise, if you had sky with a floor further up above it, it's not clear where the leafs would be divided, or + // if the floor contents would turn to sky, etc.) + EXPECT_EQ(CONTENTS_SOLID, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], player_pos + qvec3d(0,0,500))->contents); + + EXPECT_EQ(CONTENTS_SKY, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], qvec3d(player_pos[0], player_pos[1], inside_sky_z))->contents); EXPECT_EQ(CONTENTS_SOLID, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], player_pos + qvec3d( 500, 0, 0))->contents); EXPECT_EQ(CONTENTS_SOLID, BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], player_pos + qvec3d(-500, 0, 0))->contents);