clean up extra.kart and extra2.kart lump checking

This commit is contained in:
hayaunderscore authored and alufolie91 committed 2023-10-18 15:03:53 +02:00
1 parent cec92474d2
commit 6eb96a4992
3 files changed
+41 -15

No files matched your search

+18 -15
View File
@@ -1271,27 +1271,30 @@ void D_SRB2Main(void)
#endif //ifndef DEVELOP
if (found_extra_kart){ // found the funny, add it in!
mainwads++;
if (found_extra_kart || found_extra2_kart) // found the funny, add it in!
{
// HAYA: These are seperated for a reason lmao
if (found_extra_kart)
mainwads++;
if (found_extra2_kart)
mainwads++;
// now check for speedometer stuff
if ((W_LumpExists("SP_SMSTC")) && (W_LumpExists("K_TRNULL")) && (W_LumpExists("SP_MKMH")) && (W_LumpExists("SP_MMPH")) && (W_LumpExists("SP_MFRAC")) && (W_LumpExists("SP_MPERC")))
snw_speedo = true;
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
snw_speedo = true;
if ((W_LumpExists("K_STLAPB")) && (W_LumpExists("K_STLA2B"))) // check for bigger lap count
big_lap = true;
}
if (found_extra2_kart){ // found the funny, add it in!
mainwads++;
// check for bigger lap count
if (W_CheckMultipleLumps("K_STLAPB", "K_STLA2B", NULL))
big_lap = true;
// now check for colour hud stuff
if ((W_LumpExists("K_SCTIME")) && (W_LumpExists("K_SCTIMW")) && (W_LumpExists("K_SCLAPS")) && (W_LumpExists("K_SCLAPW")) && (W_LumpExists("K_SCBALN"))
&& (W_LumpExists("K_SCBALW")) && (W_LumpExists("K_SCKARM")) && (W_LumpExists("K_SCTOUT")) && (W_LumpExists("K_ISMULC")) && (W_LumpExists("K_ITMULC")))
clr_hud = true;
if (W_CheckMultipleLumps("K_SCTIME", "K_SCTIMW", "K_SCLAPS", "K_SCLAPW", \
"K_SCBALN", "K_SCBALW", "K_SCKARM", "K_SCTOUT", "K_ISMULC", "K_ITMULC", NULL))
clr_hud = true;
if ((W_LumpExists("K_SCLAPB")) && (W_LumpExists("K_SCLA2B"))) // check for bigger lap count but colour
big_lap_color = true;
// check for bigger lap count but color** its color bitch
if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL))
big_lap_color = true;
}
//
+20
View File
@@ -1319,6 +1319,26 @@ UINT8 W_LumpExists(const char *name)
return false;
}
UINT8 W_CheckMultipleLumps(const char* lump, ...)
{
va_list lumps;
va_start(lumps, lump);
const char* lumpname = lump;
while (lumpname != NULL)
{
if (!W_LumpExists(lumpname))
{
va_end(lumps);
return FALSE;
}
lumpname = va_arg(lumps, const char*);
}
va_end(lumps);
return TRUE;
}
size_t W_LumpLengthPwad(UINT16 wad, UINT16 lump)
{
if (!TestValidLump(wad, lump))
+3
View File
@@ -22,6 +22,8 @@
#pragma interface
#endif
#include <stdarg.h> // hopefully this shouldn't cause any problems...
// a raw entry of the wad directory
// NOTE: This sits here and not in w_wad.c because p_setup.c makes use of it to load map WADs inside PK3s.
#if defined(_MSC_VER)
@@ -165,6 +167,7 @@ lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Err
lumpnum_t W_GetNumForLongName(const char *name);
lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend);
UINT8 W_LumpExists(const char *name); // Lua uses this.
UINT8 W_CheckMultipleLumps(const char* lump, ...); // variadic version of above lmao
size_t W_LumpLengthPwad(UINT16 wad, UINT16 lump);
size_t W_LumpLength(lumpnum_t lumpnum);