Add K_TerrainInit to partload instead, Exitlevel on Terrain definition load to prevent issues
This commit is contained in:
parent
b60a9d4bae
commit
93c8a62c99
4 changed files with 24 additions and 6 deletions
|
|
@ -2211,10 +2211,11 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
|
|||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_InitTerrain(UINT16 wadNum)
|
||||
boolean K_InitTerrain(UINT16 wadNum)
|
||||
{
|
||||
UINT16 lumpNum;
|
||||
lumpinfo_t *lump_p = wadfiles[wadNum]->lumpinfo;
|
||||
boolean terrainLoaded = false;
|
||||
|
||||
// Iterate through all lumps and compare the name individually.
|
||||
// In PK3 files, you can potentially have multiple TERRAIN differentiated by
|
||||
|
|
@ -2249,6 +2250,8 @@ void K_InitTerrain(UINT16 wadNum)
|
|||
size = W_LumpLengthPwad(wadNum, lumpNum);
|
||||
|
||||
CONS_Printf(M_GetText("Loading TERRAIN from %s\n"), name);
|
||||
terrainLoaded = true;
|
||||
|
||||
|
||||
datacopy = (char *)Z_Malloc((size+1)*sizeof(char),PU_STATIC,NULL);
|
||||
memmove(datacopy,data,size);
|
||||
|
|
@ -2265,4 +2268,7 @@ void K_InitTerrain(UINT16 wadNum)
|
|||
}
|
||||
|
||||
R_ClearTextureNumCache(false);
|
||||
|
||||
return terrainLoaded;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -571,14 +571,15 @@ void K_UpdateTerrainOverlay(mobj_t *mo);
|
|||
|
||||
Finds the TERRAIN lumps in a WAD/PK3, and
|
||||
processes all of them.
|
||||
Also returns if new terrains were loaded
|
||||
|
||||
Input Arguments:-
|
||||
wadNum - WAD file ID to process.
|
||||
|
||||
Return:-
|
||||
None
|
||||
terrainLoaded - Terrain was loaded
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_InitTerrain(UINT16 wadNum);
|
||||
boolean K_InitTerrain(UINT16 wadNum);
|
||||
|
||||
#endif // __K_TERRAIN_H__
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ mapthing_t *redctfstarts[MAXPLAYERS];
|
|||
// Might be replacable with parameters, but non-trivial when the functions are called on separate tics
|
||||
static SINT8 partadd_stage = -1;
|
||||
static boolean partadd_replacescurrentmap = false;
|
||||
static boolean partadd_terrainloaded = false;
|
||||
static boolean partadd_important = false;
|
||||
UINT16 partadd_earliestfile = UINT16_MAX;
|
||||
|
||||
|
|
@ -8486,7 +8487,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename)
|
|||
|
||||
// Reload BRIGHT
|
||||
K_InitBrightmapsPwad(wadnum);
|
||||
|
||||
|
||||
// Reload TERRAIN
|
||||
if (K_InitTerrain(wadnum))
|
||||
partadd_terrainloaded = true;
|
||||
|
||||
//
|
||||
// look for skins
|
||||
//
|
||||
|
|
@ -8607,6 +8612,13 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
|||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
|
||||
if (partadd_terrainloaded && gamestate == GS_LEVEL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Terrain Definition reloaded, ending the level to ensure consistency.\n"));
|
||||
if (server)
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
}
|
||||
partadd_stage = -1;
|
||||
}
|
||||
|
||||
|
|
@ -8616,6 +8628,7 @@ boolean P_MultiSetupWadFiles(boolean fullsetup)
|
|||
{
|
||||
partadd_important = false;
|
||||
partadd_replacescurrentmap = false;
|
||||
partadd_terrainloaded = false;
|
||||
partadd_earliestfile = UINT16_MAX;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -872,8 +872,6 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
|
|||
break;
|
||||
}
|
||||
|
||||
K_InitTerrain(numwadfiles - 1);
|
||||
|
||||
if (refreshdirmenu & REFRESHDIR_GAMEDATA)
|
||||
G_LoadGameData();
|
||||
DEH_UpdateMaxFreeslots();
|
||||
|
|
|
|||
Loading…
Reference in a new issue