Use virtres in P_SpawnSpecials(). Whether accessing the lump again here is right or not is also a different question.
This commit is contained in:
parent
4d86dc11a6
commit
14ad3b938e
20
src/p_spec.c
20
src/p_spec.c
|
@ -6425,7 +6425,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
INT32 j;
|
INT32 j;
|
||||||
thinkerlist_t *secthinkers;
|
thinkerlist_t *secthinkers;
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
|
virtres_t* virt = NULL;
|
||||||
// This used to be used, and *should* be used in the future,
|
// This used to be used, and *should* be used in the future,
|
||||||
// but currently isn't.
|
// but currently isn't.
|
||||||
(void)fromnetsave;
|
(void)fromnetsave;
|
||||||
|
@ -7177,17 +7177,10 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
UINT8 *data;
|
UINT8 *data;
|
||||||
UINT16 b;
|
UINT16 b;
|
||||||
|
|
||||||
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
|
if (!virt)
|
||||||
{ // HACK: Open wad file rather quickly so we can get the data from the sidedefs lump
|
virt = vres_GetMap(lastloadedmaplumpnum);
|
||||||
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
|
|
||||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
data = (UINT8*) vres_Find(virt, "SIDEDEFS")->data;
|
||||||
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++)
|
for (b = 0; b < (INT16)numsides; b++)
|
||||||
{
|
{
|
||||||
|
@ -7433,6 +7426,9 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virt)
|
||||||
|
vres_Free(virt);
|
||||||
|
|
||||||
// Allocate each list
|
// Allocate each list
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
if(secthinkers[i].thinkers)
|
if(secthinkers[i].thinkers)
|
||||||
|
|
Loading…
Reference in New Issue