imglib: fix wad3 loading (thanks to erysdren for the fix)
add a basic half-life test case (box map)
This commit is contained in:
parent
40a10b2c52
commit
a02a4ec316
|
|
@ -101,6 +101,8 @@ find_package(TBB REQUIRED)
|
|||
|
||||
set(TEST_QUAKE_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake maps to this directory (useful for testing in game)")
|
||||
set(TEST_QUAKE2_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Quake 2 maps to this directory (useful for testing in game)")
|
||||
set(TEST_HEXEN2_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Hexen 2 maps to this directory (useful for testing in game)")
|
||||
set(TEST_HALFLIFE_MAP_EXPORT_DIR "" CACHE PATH "When running unit tests, export Half-Life maps to this directory (useful for testing in game)")
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
add_subdirectory(common)
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ std::optional<texture> load_mip(
|
|||
if (game->id == GAME_HALF_LIFE) {
|
||||
bool valid_mip_palette = true;
|
||||
|
||||
int32_t mip3_size = (header.width >> 3) + (header.height >> 3);
|
||||
int32_t mip3_size = (header.width >> 3) * (header.height >> 3);
|
||||
size_t palette_size = sizeof(uint16_t) + (sizeof(qvec3b) * 256);
|
||||
|
||||
if (header.offsets[3] <= 0) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
inline const char *testmaps_dir = "@CMAKE_CURRENT_SOURCE_DIR@/testmaps";
|
||||
inline const char *test_quake_maps_dir = "@TEST_QUAKE_MAP_EXPORT_DIR@";
|
||||
inline const char *test_quake2_maps_dir = "@TEST_QUAKE2_MAP_EXPORT_DIR@";
|
||||
inline const char *test_hexen2_maps_dir = "@TEST_HEXEN2_MAP_EXPORT_DIR@";
|
||||
inline const char *test_halflife_maps_dir = "@TEST_HALFLIFE_MAP_EXPORT_DIR@";
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,79 @@
|
|||
// Game: Half-Life
|
||||
// Format: Valve
|
||||
// entity 0
|
||||
{
|
||||
"mapversion" "220"
|
||||
"classname" "worldspawn"
|
||||
"wad" "deprecated/hlwad.wad"
|
||||
// brush 0
|
||||
{
|
||||
( -192 -64 -16 ) ( -192 -63 -16 ) ( -192 -64 -15 ) hltest [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 -128 -16 ) ( -64 -128 -15 ) ( -63 -128 -16 ) hltest [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 -64 -16 ) ( -63 -64 -16 ) ( -64 -63 -16 ) hltest [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 64 16 ) ( 64 65 16 ) ( 65 64 16 ) hltest [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 192 16 ) ( 65 192 16 ) ( 64 192 17 ) hltest [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 256 64 16 ) ( 256 64 17 ) ( 256 65 16 ) hltest [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
// brush 1
|
||||
{
|
||||
( -192 -384 -16 ) ( -192 -383 -16 ) ( -192 -384 -15 ) hltest [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 -144 -16 ) ( -64 -144 -15 ) ( -63 -144 -16 ) hltest [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 64 -256 16 ) ( 65 -256 16 ) ( 64 -255 16 ) hltest [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 -256 304 ) ( 64 -255 304 ) ( 65 -256 304 ) hltest [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 -128 16 ) ( 65 -128 16 ) ( 64 -128 17 ) hltest [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 256 -256 16 ) ( 256 -256 17 ) ( 256 -255 16 ) hltest [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
// brush 2
|
||||
{
|
||||
( -192 -48 -16 ) ( -192 -47 -16 ) ( -192 -48 -15 ) hltest [ 0 -1 0 16 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 192 -16 ) ( -64 192 -15 ) ( -63 192 -16 ) hltest [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 64 80 16 ) ( 65 80 16 ) ( 64 81 16 ) hltest [ 1 0 0 0 ] [ 0 -1 0 16 ] 0 1 1
|
||||
( 64 80 304 ) ( 64 81 304 ) ( 65 80 304 ) hltest [ 1 0 0 0 ] [ 0 -1 0 16 ] 0 1 1
|
||||
( 64 208 16 ) ( 65 208 16 ) ( 64 208 17 ) hltest [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 256 80 16 ) ( 256 80 17 ) ( 256 81 16 ) hltest [ 0 1 0 -16 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
// brush 3
|
||||
{
|
||||
( -208 128 16 ) ( -208 129 16 ) ( -208 128 17 ) hltest [ -6.123233995736766e-17 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 48 -128 -16 ) ( 47 -128 -16 ) ( 48 -128 -15 ) hltest [ 1 -6.123233995736766e-17 0 16 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -80 128 16 ) ( -80 129 16 ) ( -81 128 16 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 1 -6.123233995736766e-17 0 16 ] 90 1 1
|
||||
( -80 128 304 ) ( -81 128 304 ) ( -80 129 304 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 1 -6.123233995736766e-17 0 16 ] 270 1 1
|
||||
( -80 192 16 ) ( -80 192 17 ) ( -81 192 16 ) hltest [ -1 6.123233995736766e-17 0 -16 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -192 0 -16 ) ( -192 0 -15 ) ( -192 1 -16 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
// brush 4
|
||||
{
|
||||
( 256 128 16 ) ( 256 129 16 ) ( 256 128 17 ) hltest [ -6.123233995736766e-17 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 512 -128 -16 ) ( 511 -128 -16 ) ( 512 -128 -15 ) hltest [ 1 -6.123233995736766e-17 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 384 128 16 ) ( 384 129 16 ) ( 383 128 16 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 1 -6.123233995736766e-17 0 0 ] 90 1 1
|
||||
( 384 128 304 ) ( 383 128 304 ) ( 384 129 304 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 1 -6.123233995736766e-17 0 0 ] 270 1 1
|
||||
( 384 192 16 ) ( 384 192 17 ) ( 383 192 16 ) hltest [ -1 6.123233995736766e-17 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 272 0 -16 ) ( 272 0 -15 ) ( 272 1 -16 ) hltest [ 6.123233995736766e-17 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
// brush 5
|
||||
{
|
||||
( -192 -64 304 ) ( -192 -63 304 ) ( -192 -64 305 ) hltest [ 0 -1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 -128 304 ) ( -64 -128 305 ) ( -63 -128 304 ) hltest [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( -64 -64 304 ) ( -63 -64 304 ) ( -64 -63 304 ) hltest [ -1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 64 336 ) ( 64 65 336 ) ( 65 64 336 ) hltest [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
|
||||
( 64 192 336 ) ( 65 192 336 ) ( 64 192 337 ) hltest [ -1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
( 256 64 336 ) ( 256 64 337 ) ( 256 65 336 ) hltest [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
|
||||
}
|
||||
}
|
||||
// entity 1
|
||||
{
|
||||
"classname" "info_player_start"
|
||||
"spawnflags" "0"
|
||||
"angles" "0 0 0"
|
||||
"origin" "32 16 52"
|
||||
}
|
||||
// entity 2
|
||||
{
|
||||
"classname" "light"
|
||||
"spawnflags" "0"
|
||||
"_light" "255 255 128 200"
|
||||
"style" "0"
|
||||
"_fade" "1.0"
|
||||
"_falloff" "0"
|
||||
"origin" "40 8 200"
|
||||
}
|
||||
|
|
@ -97,6 +97,10 @@ std::tuple<mbsp_t, bspxentries_t, std::optional<prtfile_t>> LoadTestmap(
|
|||
destdir = test_quake2_maps_dir;
|
||||
} else if (qbsp_options.target_game->id == GAME_QUAKE) {
|
||||
destdir = test_quake_maps_dir;
|
||||
} else if (qbsp_options.target_game->id == GAME_HEXEN_II) {
|
||||
destdir = test_hexen2_maps_dir;
|
||||
} else if (qbsp_options.target_game->id == GAME_HALF_LIFE) {
|
||||
destdir = test_halflife_maps_dir;
|
||||
}
|
||||
|
||||
// copy .bsp to game's basedir/maps directory, for easy in-game testing
|
||||
|
|
@ -1901,3 +1905,19 @@ TEST_CASE("q1_missing_texture")
|
|||
CHECK("" == bsp.dtex.textures[1].name);
|
||||
CHECK(bsp.dtex.textures[1].null_texture);
|
||||
}
|
||||
|
||||
TEST_CASE("hl_basic")
|
||||
{
|
||||
const auto [bsp, bspx, prt] = LoadTestmap("hl_basic.map", {"-hlbsp"});
|
||||
CHECK(prt);
|
||||
|
||||
REQUIRE(2 == bsp.dtex.textures.size());
|
||||
|
||||
// FIXME: we shouldn't really be writing skip
|
||||
CHECK(bsp.dtex.textures[0].null_texture);
|
||||
|
||||
CHECK("hltest" == bsp.dtex.textures[1].name);
|
||||
CHECK(!bsp.dtex.textures[1].null_texture);
|
||||
CHECK(64 == bsp.dtex.textures[1].width);
|
||||
CHECK(64 == bsp.dtex.textures[1].height);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue