always use world entity for looking for _wad key

This commit is contained in:
Jonathan 2022-07-29 21:20:10 -04:00
parent 77e5990016
commit 521daad432
1 changed files with 8 additions and 6 deletions

View File

@ -97,17 +97,19 @@ static std::shared_ptr<fs::archive_like> 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);