From 521daad432b683abc2101ac25c1231ec031c95a7 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 29 Jul 2022 21:20:10 -0400 Subject: [PATCH] always use world entity for looking for _wad key --- qbsp/map.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/qbsp/map.cc b/qbsp/map.cc index ab05832b..f63525e0 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -97,17 +97,19 @@ static std::shared_ptr LoadTexturePath(const fs::path &path) return nullptr; } -static void EnsureTexturesLoaded(const mapentity_t *entity) +static void EnsureTexturesLoaded() { + // Q2 doesn't need this + if (qbsp_options.target_game->id == GAME_QUAKE_II) { + return; + } + if (map.textures_loaded) return; map.textures_loaded = true; - // Q2 doesn't need this - if (qbsp_options.target_game->id == GAME_QUAKE_II) { - return; - } + const mapentity_t *entity = map.world_entity(); std::string wadstring = entity->epairs.get("_wad"); @@ -1727,7 +1729,7 @@ bool ParseEntity(parser_t &parser, mapentity_t *entity) break; else if (parser.token == "{") { // once we run into the first brush, set up textures state. - EnsureTexturesLoaded(entity); + EnsureTexturesLoaded(); mapbrush_t brush = ParseBrush(parser, entity);