mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- let's save the terrain properties as names so that they survive a change in the definition files.
This commit is contained in:
parent
7f454358b9
commit
23cfd29dbb
4 changed files with 30 additions and 2 deletions
|
@ -193,7 +193,7 @@ void AActor::Serialize (FArchive &arc)
|
|||
<< Damage;
|
||||
if (SaveVersion >= 4530)
|
||||
{
|
||||
arc << floorterrain;
|
||||
P_SerializeTerrain(arc, floorterrain);
|
||||
}
|
||||
if (SaveVersion >= 3227)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "farchive.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_acs.h"
|
||||
#include "p_terrain.h"
|
||||
|
||||
static void CopyPlayer (player_t *dst, player_t *src, const char *name);
|
||||
static void ReadOnePlayer (FArchive &arc, bool skipload);
|
||||
|
@ -371,7 +372,8 @@ void P_SerializeWorld (FArchive &arc)
|
|||
<< sec->gravity;
|
||||
if (SaveVersion >= 4530)
|
||||
{
|
||||
arc << sec->terrainnum[0] << sec->terrainnum[1];
|
||||
P_SerializeTerrain(arc, sec->terrainnum[0]);
|
||||
P_SerializeTerrain(arc, sec->terrainnum[1]);
|
||||
}
|
||||
if (SaveVersion >= 4529)
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "s_sound.h"
|
||||
#include "p_local.h"
|
||||
#include "templates.h"
|
||||
#include "farchive.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -704,3 +705,26 @@ int P_FindTerrain (FName name)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void P_SerializeTerrain(FArchive &arc, int &terrainnum)
|
||||
{
|
||||
FName val;
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
if (terrainnum < 0 || terrainnum >= (int)Terrains.Size())
|
||||
{
|
||||
val = NAME_Null;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = Terrains[terrainnum].Name;
|
||||
}
|
||||
arc << val;
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << val;
|
||||
terrainnum = P_FindTerrain(val);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,8 @@ struct FTerrainDef
|
|||
extern TArray<FSplashDef> Splashes;
|
||||
extern TArray<FTerrainDef> Terrains;
|
||||
|
||||
class FArchive;
|
||||
int P_FindTerrain(FName name);
|
||||
void P_SerializeTerrain(FArchive &arc, int &terrainnum);
|
||||
|
||||
#endif //__P_TERRAIN_H__
|
||||
|
|
Loading…
Reference in a new issue