P_PrepareRawThings() is now where it was supposed to be at; moved save and flat & texture caching related functions to the end of P_LoadMapData().

This commit is contained in:
Nev3r 2019-12-23 16:36:26 +01:00
parent 1221c108c6
commit d6a86c37b2

View file

@ -485,6 +485,7 @@ static inline void P_LoadRawSubsectors(void *data)
size_t numlevelflats;
levelflat_t *levelflats;
levelflat_t *foundflats;
//SoM: Other files want this info.
size_t P_PrecacheLevelFlats(void)
@ -648,7 +649,6 @@ static void P_LoadRawSectors(UINT8 *data)
{
mapsector_t *ms = (mapsector_t *)data;
sector_t *ss = sectors;
levelflat_t *foundflats;
size_t i;
// Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
@ -725,16 +725,6 @@ static void P_LoadRawSectors(UINT8 *data)
ss->lineoutLength = -1.0l;
#endif // ----- end special tricks -----
}
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
// copy table for global usage
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
// search for animated flats and set up
P_SetupLevelFlatAnims();
}
//
@ -1455,7 +1445,6 @@ static void P_LoadRawSideDefs2(void *data)
break;
}
}
R_ClearTextureNumCache(true);
}
static boolean LineInBlock(fixed_t cx1, fixed_t cy1, fixed_t cx2, fixed_t cy2, fixed_t bx1, fixed_t by1)
@ -2007,7 +1996,29 @@ static void P_LoadMapData(const virtres_t* virt)
P_LoadRawLineDefs(virtlinedefs->data);
P_SetupLines();
P_LoadRawSideDefs2(virtsidedefs->data);
P_PrepareRawThings(virtthings->data);
}
R_ClearTextureNumCache(true);
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
// copy table for global usage
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
// search for animated flats and set up
P_SetupLevelFlatAnims();
// Copy relevant map data for NetArchive purposes.
spawnsectors = Z_Calloc(numsectors * sizeof (*sectors), PU_LEVEL, NULL);
spawnlines = Z_Calloc(numlines * sizeof (*lines), PU_LEVEL, NULL);
spawnsides = Z_Calloc(numsides * sizeof (*sides), PU_LEVEL, NULL);
memcpy(spawnsectors, sectors, numsectors * sizeof (*sectors));
memcpy(spawnlines, lines, numlines * sizeof (*lines));
memcpy(spawnsides, sides, numsides * sizeof (*sides));
}
#if 0
@ -2774,17 +2785,6 @@ boolean P_SetupLevel(boolean skipprecip)
P_LoadLineDefs2();
P_GroupLines();
// Copy relevant map data for NetArchive purposes.
spawnsectors = Z_Calloc(numsectors * sizeof (*sectors), PU_LEVEL, NULL);
spawnlines = Z_Calloc(numlines * sizeof (*lines), PU_LEVEL, NULL);
spawnsides = Z_Calloc(numsides * sizeof (*sides), PU_LEVEL, NULL);
memcpy(spawnsectors, sectors, numsectors * sizeof (*sectors));
memcpy(spawnlines, lines, numlines * sizeof (*lines));
memcpy(spawnsides, sides, numsides * sizeof (*sides));
P_PrepareRawThings(vres_Find(virt, "THINGS")->data);
P_MakeMapMD5(virt, &mapmd5);
vres_Free(virt);