mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
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
0dbe217979
commit
b4a44236b0
1 changed files with 4 additions and 11 deletions
|
|
@ -3569,7 +3569,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));
|
||||
}
|
||||
|
||||
|
|
@ -4876,7 +4876,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
|
||||
|
|
@ -5968,15 +5970,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…
Add table
Reference in a new issue