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 "w_wad.h"
#include "z_zone.h" #include "z_zone.h"
#include "fastcmp.h"
#include "i_video.h" // rendermode #include "i_video.h" // rendermode
#include "d_netfil.h" #include "d_netfil.h"
@ -147,25 +148,33 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
} }
#endif #endif
// Check for MAINCFG
for (lump = 0;lump != INT16_MAX;lump++)
{ {
lump = W_CheckNumForNamePwad("MAINCFG", wadnum, lump); lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo;
if (lump == INT16_MAX) for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
break; 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); CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump); DEH_LoadDehackedLumpPwad(wadnum, lump);
} }
else if (memcmp(lump_p->name,"OBJCTCFG",8)==0) // Check for OBJCTCFG
// 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); CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename);
DEH_LoadDehackedLumpPwad(wadnum, lump); DEH_LoadDehackedLumpPwad(wadnum, lump);
} }
}
#ifdef SCANTHINGS #ifdef SCANTHINGS
// Scan maps for emblems 'n shit // Scan maps for emblems 'n shit