mobj->terrain archive imrpovements
- TERRAIN index is +1 (it can write terrainOverlay at the same time, so there is the possibility of needing to archive NULL terrain). -TERRAIN lookup is done immediately instead of at P_RelinkPointers (dunno why I did this, TERRAIN doesn't do mobjnum crap).
This commit is contained in:
parent
6461678967
commit
59872a8181
1 changed files with 4 additions and 11 deletions
|
|
@ -2651,7 +2651,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
|
|||
}
|
||||
if (diff2 & MD2_TERRAIN)
|
||||
{
|
||||
WRITEUINT32(save->p, K_GetTerrainHeapIndex(mobj->terrain));
|
||||
WRITEUINT32(save->p, K_GetTerrainHeapIndex(mobj->terrain) + 1);
|
||||
WRITEUINT32(save->p, SaveMobjnum(mobj->terrainOverlay));
|
||||
}
|
||||
if (diff3 & MD3_GRAVITY)
|
||||
|
|
@ -3897,7 +3897,9 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||
}
|
||||
if (diff2 & MD2_TERRAIN)
|
||||
{
|
||||
mobj->terrain = (terrain_t *)(size_t)READUINT32(save->p);
|
||||
UINT32 terrain_index = READUINT32(save->p);
|
||||
if (terrain_index > 0)
|
||||
mobj->terrain = K_GetTerrainByIndex(terrain_index - 1);
|
||||
mobj->terrainOverlay = (mobj_t *)(size_t)READUINT32(save->p);
|
||||
}
|
||||
else
|
||||
|
|
@ -4970,15 +4972,6 @@ static void P_RelinkPointers(void)
|
|||
if (!RelinkMobj(&mobj->itnext))
|
||||
CONS_Debug(DBG_GAMELOGIC, "itnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->terrain)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->terrain;
|
||||
mobj->terrain = K_GetTerrainByIndex(temp);
|
||||
if (mobj->terrain == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "terrain not found on %d\n", mobj->type);
|
||||
}
|
||||
}
|
||||
if (mobj->terrainOverlay)
|
||||
{
|
||||
if (!RelinkMobj(&mobj->terrainOverlay))
|
||||
|
|
|
|||
Loading…
Reference in a new issue