Add missing tweaks

Also remove a test printf.

Signed-off-by: Nev3r <apophycens@gmail.com>
This commit is contained in:
Nev3r 2018-11-23 17:58:45 +01:00
parent c548aaa347
commit 0487558a98
3 changed files with 31 additions and 16 deletions

View File

@ -6243,9 +6243,21 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 259: // Make-Your-Own FOF!
if (lines[i].sidenum[1] != 0xffff)
{
UINT8 *data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
UINT8 *data;
UINT16 b;
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
{ // HACK: Open wad file rather quickly so we can get the data from the sidedefs lump
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
fileinfo += ML_SIDEDEFS; // we only need the SIDEDEFS lump
data = Z_Malloc(fileinfo->size, PU_STATIC, NULL);
M_Memcpy(data, wadData + fileinfo->filepos, fileinfo->size); // copy data
Z_Free(wadData); // we're done with this now
}
else // phew it's just a WAD
data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
for (b = 0; b < (INT16)numsides; b++)
{
register mapsidedef_t *msd = (mapsidedef_t *)data + b;

View File

@ -177,18 +177,28 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0);
if (posStart != INT16_MAX)
{
posStart++;
posEnd = W_CheckNumForFolderEndPK3("Lua/", wadnum, posStart);
posStart++;
for (; posStart < posEnd; posStart++)
LUA_LoadLump(wadnum, posStart);
}
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
if (posStart != INT16_MAX)
{
posStart++;
posEnd = W_CheckNumForFolderEndPK3("SOC/", wadnum, posStart);
posStart++;
for(; posStart < posEnd; posStart++)
{
lumpinfo_t *lump_p = &wadfiles[wadnum]->lumpinfo[posStart];
size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
char *name = malloc(length + 1);
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
name[length] = '\0';
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, posStart);
free(name);
}
}
}
@ -212,20 +222,13 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
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
size_t len = strlen(wadfiles[wadnum]->filename);
char *name = malloc(len+10);
strcpy(name, wadfiles[wadnum]->filename);
if (!fasticmp(&name[len - 4], ".soc")) {
// If it's not a .soc file, copy the lump name in too.
name[len] = '|';
M_Memcpy(name+len+1, lump_p->name, 8);
name[len+9] = '\0';
}
size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
char *name = malloc(length + 1);
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
name[length] = '\0';
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, lump);
free(name);
}
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
@ -314,7 +317,7 @@ UINT16 W_InitFile(const char *filename)
FILE *handle;
lumpinfo_t *lumpinfo;
wadfile_t *wadfile;
enum restype type;
restype_t type;
UINT16 numlumps;
size_t i;
INT32 compressed = 0;

View File

@ -90,7 +90,7 @@ typedef enum restype
typedef struct wadfile_s
{
char *filename;
enum restype type;
restype_t type;
lumpinfo_t *lumpinfo;
lumpcache_t *lumpcache;
#ifdef HWRENDER