mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 14:12:28 +00:00
- refactored the level backup data needed by the serializer into p_saveg.h.
This commit is contained in:
parent
5ec786eef7
commit
5ee52f159e
5 changed files with 32 additions and 16 deletions
|
@ -63,6 +63,10 @@
|
|||
#include "r_renderer.h"
|
||||
#include "serializer.h"
|
||||
|
||||
static TStaticArray<sector_t> loadsectors;
|
||||
static TArray<line_t> loadlines;
|
||||
static TArray<side_t> loadsides;
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -988,4 +992,20 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
|
||||
}
|
||||
|
||||
// Create a backup of the map data so the savegame code can toss out all fields that haven't changed in order to reduce processing time and file size.
|
||||
|
||||
void P_BackupMapData()
|
||||
{
|
||||
loadsectors = level.sectors;
|
||||
loadlines.Resize(numlines);
|
||||
memcpy(&loadlines[0], lines, numlines * sizeof(line_t));
|
||||
loadsides.Resize(numsides);
|
||||
memcpy(&loadsides[0], sides, numsides * sizeof(side_t));
|
||||
}
|
||||
|
||||
void P_FreeMapDataBackup()
|
||||
{
|
||||
loadsectors.Clear();
|
||||
loadlines.Clear();
|
||||
loadsides.Clear();
|
||||
}
|
|
@ -46,4 +46,7 @@ void P_WriteACSDefereds (FSerializer &);
|
|||
|
||||
void G_SerializeLevel(FSerializer &arc, bool hubLoad);
|
||||
|
||||
void P_BackupMapData();
|
||||
void P_FreeMapDataBackup();
|
||||
|
||||
#endif // __P_SAVEG_H__
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
#include "p_blockmap.h"
|
||||
#include "r_utility.h"
|
||||
#include "p_spec.h"
|
||||
#include "p_saveg.h"
|
||||
#ifndef NO_EDATA
|
||||
#include "edata.h"
|
||||
#endif
|
||||
|
@ -122,10 +123,6 @@ int numsegs;
|
|||
seg_t* segs;
|
||||
glsegextra_t* glsegextras;
|
||||
|
||||
//int numsectors;
|
||||
//sector_t* sectors;
|
||||
TArray<sector_t> loadsectors;
|
||||
|
||||
int numsubsectors;
|
||||
subsector_t* subsectors;
|
||||
|
||||
|
@ -134,11 +131,9 @@ node_t* nodes;
|
|||
|
||||
int numlines;
|
||||
line_t* lines;
|
||||
TArray<line_t> loadlines;
|
||||
|
||||
int numsides;
|
||||
side_t* sides;
|
||||
TArray<side_t> loadsides;
|
||||
|
||||
TArray<zone_t> Zones;
|
||||
|
||||
|
@ -3431,6 +3426,7 @@ extern polyblock_t **PolyBlockMap;
|
|||
|
||||
void P_FreeLevelData ()
|
||||
{
|
||||
P_FreeMapDataBackup();
|
||||
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
||||
Renderer->CleanLevelData();
|
||||
FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.
|
||||
|
@ -4193,12 +4189,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
MapThingsUserDataIndex.Clear();
|
||||
MapThingsUserData.Clear();
|
||||
|
||||
loadsectors.Resize(level.sectors.Size());
|
||||
memcpy(&loadsectors[0], &level.sectors[0], loadsectors.Size() * sizeof(sector_t));
|
||||
loadlines.Resize(numlines);
|
||||
memcpy(&loadlines[0], lines, numlines * sizeof(line_t));
|
||||
loadsides.Resize(numsides);
|
||||
memcpy(&loadsides[0], sides, numsides * sizeof(side_t));
|
||||
P_BackupMapData();
|
||||
|
||||
if (glsegextras != NULL)
|
||||
{
|
||||
|
|
|
@ -15,10 +15,6 @@ struct usercmd_t;
|
|||
struct FWriter;
|
||||
struct FReader;
|
||||
|
||||
extern TArray<sector_t> loadsectors;
|
||||
extern TArray<line_t> loadlines;
|
||||
extern TArray<side_t> loadsides;
|
||||
|
||||
inline bool nullcmp(const void *buffer, size_t length)
|
||||
{
|
||||
const char *p = (const char *)buffer;
|
||||
|
|
|
@ -573,6 +573,12 @@ public:
|
|||
this->Array = new T[amount];
|
||||
this->Count = amount;
|
||||
}
|
||||
TStaticArray &operator=(const TStaticArray &other)
|
||||
{
|
||||
Alloc(other.Size());
|
||||
memcpy(Array, other.Array, Count * sizeof(T));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue