Merge branch 'new-SOC-lump-names' into 'next'

SOC_**** lump name support

Exactly what it says on the tin: lumps with "SOC_" prefix now are read as SOC lumps like with MAINCFG/OBJCTCFG. Go nuts.

As a bonus, I've changed things with SOC lump detection so MAINCFG, OBJCTCFG and the new SOC_**** lumps are loaded in the order you find them in WAD files (rather than an arbitrary load-MAINCFG-then-load-OBJCTCFG thing as before). All of these are still loaded after Lua scripts though, mind.

See merge request !38
This commit is contained in:
Wolfy 2016-03-04 10:23:20 -05:00
commit 7eaf3cf221

View file

@ -32,6 +32,7 @@
#include "w_wad.h"
#include "z_zone.h"
#include "fastcmp.h"
#include "i_video.h" // rendermode
#include "d_netfil.h"
@ -147,24 +148,32 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
}
#endif
// Check for MAINCFG
for (lump = 0;lump != INT16_MAX;lump++)
{
lump = W_CheckNumForNamePwad("MAINCFG", wadnum, lump);
if (lump == INT16_MAX)
break;
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
// Check for OBJCTCFG
for (lump = 0;lump < INT16_MAX;lump++)
{
lump = W_CheckNumForNamePwad("OBJCTCFG", wadnum, lump);
if (lump == INT16_MAX)
break;
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
{ // shameless copy+paste of code from LUA_LoadLump
char *name = malloc(strlen(wadfiles[wadnum]->filename)+10);
strcpy(name, wadfiles[wadnum]->filename);
if (!fasticmp(&name[strlen(name) - 4], ".soc")) {
// If it's not a .soc file, copy the lump name in too.
name[strlen(wadfiles[wadnum]->filename)] = '|';
M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8);
name[strlen(wadfiles[wadnum]->filename)+9] = '\0';
}
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
{
CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
else if (memcmp(lump_p->name,"OBJCTCFG",8)==0) // Check for OBJCTCFG
{
CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump);
}
}
#ifdef SCANTHINGS