From efc4d2f81d5a6c9c1f4fce2a9316fc9116882141 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 26 Oct 2017 16:58:18 +0100 Subject: [PATCH] * Make multiple ANIMDEFS lumps get loaded. * Refactor the multiple TEXTURES lump code. --- src/p_spec.c | 21 +++++++++------------ src/r_data.c | 16 +++++++--------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 7da411580..803c1ab86 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -148,20 +148,17 @@ void P_InitPicAnims(void) maxanims = 0; - if (W_CheckNumForName("ANIMDEFS") != LUMPERROR) + for (w = numwadfiles-1; w >= 0; w--) { - for (w = numwadfiles-1; w >= 0; w--) - { - UINT16 animdefsLumpNum; + UINT16 animdefsLumpNum; - // Find ANIMDEFS lump in the WAD - if (wadfiles[w]->type == RET_PK3) - animdefsLumpNum = W_CheckNumForFullNamePK3("ANIMDEFS", w, 0); - else - animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0); - - if (animdefsLumpNum != INT16_MAX) - P_ParseANIMDEFSLump(w, animdefsLumpNum); + // Find ANIMDEFS lump in the WAD + animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0); + + while (animdefsLumpNum != INT16_MAX) + { + P_ParseANIMDEFSLump(w, animdefsLumpNum); + animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1); } } diff --git a/src/r_data.c b/src/r_data.c index 07db46aa3..1a6162dc2 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -571,20 +571,18 @@ void R_LoadTextures(void) { texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); - while (texturesLumpPos != INT16_MAX) - { - numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos); - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1); - } } else { texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1; texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0); - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); - if (texturesLumpPos != INT16_MAX) - numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos); + } + + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); + while (texturesLumpPos != INT16_MAX) + { + numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1); } // Add all the textures between TX_START and TX_END