From 1a328aaa5e33c74b87cd1ca729b643363383d27c Mon Sep 17 00:00:00 2001 From: James R <justsomejames2@gmail.com> Date: Thu, 3 Oct 2019 21:49:04 -0700 Subject: [PATCH] W_LumpExists is also a thing cool --- src/w_wad.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index c98ba09bd..451130e60 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1222,15 +1222,27 @@ lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, con // Used by Lua. Case sensitive lump checking, quickly... #include "fastcmp.h" +static boolean +FindLump (const char *name, int wad) +{ + INT32 j; + for (j = 0; j < wadfiles[wad]->numlumps; ++j) + if (fastcmp(wadfiles[wad]->lumpinfo[j].name,name)) + return true; + return false; +} UINT8 W_LumpExists(const char *name) { - INT32 i,j; + INT32 i; + if (wadfiles[WAD_MUSIC]) + { + if (FindLump(name, WAD_MUSIC)) + return true; + } for (i = numwadfiles - 1; i >= 0; i--) { - lumpinfo_t *lump_p = wadfiles[i]->lumpinfo; - for (j = 0; j < wadfiles[i]->numlumps; ++j, ++lump_p) - if (fastcmp(lump_p->name,name)) - return true; + if (FindLump(name, i)) + return true; } return false; } -- GitLab