mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 13:21:04 +00:00
- serialize the sector portal offset table.
Due to where this happens, the init code for these portals cannot be run when loading a savegame so it has to be saved.
This commit is contained in:
parent
1297e4ed02
commit
e47b4507e4
3 changed files with 25 additions and 4 deletions
|
@ -313,3 +313,17 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
||||||
RenderViewpoint(r_viewpoint, nullptr, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, false, false);
|
RenderViewpoint(r_viewpoint, nullptr, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, false, false);
|
||||||
All.Unclock();
|
All.Unclock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FSerializer& Serialize(FSerializer& arc, const char* key, PortalDesc& obj, PortalDesc* defval)
|
||||||
|
{
|
||||||
|
if (arc.BeginObject(key))
|
||||||
|
{
|
||||||
|
arc("type", obj.type)
|
||||||
|
("dx", obj.dx)
|
||||||
|
("dy", obj.dy)
|
||||||
|
("dz", obj.dz)
|
||||||
|
("targets", obj.targets)
|
||||||
|
.EndObject();
|
||||||
|
}
|
||||||
|
return arc;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
|
||||||
|
class FSerializer;
|
||||||
|
|
||||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang);
|
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang);
|
||||||
|
|
||||||
struct PortalDesc
|
struct PortalDesc
|
||||||
|
@ -10,6 +12,9 @@ struct PortalDesc
|
||||||
TArray<int> targets;
|
TArray<int> targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FSerializer& Serialize(FSerializer& arc, const char* key, PortalDesc& obj, PortalDesc* defval);
|
||||||
|
|
||||||
|
|
||||||
extern TArray<PortalDesc> allPortals;
|
extern TArray<PortalDesc> allPortals;
|
||||||
|
|
||||||
inline void portalClear()
|
inline void portalClear()
|
||||||
|
@ -28,10 +33,10 @@ inline int portalAdd(int type, int target, int dx = 0, int dy = 0, int dz = 0)
|
||||||
return allPortals.Size() - 1;
|
return allPortals.Size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// merges portals in adjoining sectors. AFAIK the only one of this kind is in Blood's E4M9, which with the original code is very glitchy.
|
// merges portals in adjoining sectors.
|
||||||
inline void mergePortals()
|
inline void mergePortals()
|
||||||
{
|
{
|
||||||
Printf("Have %d portals\n", allPortals.Size());
|
//Printf("Have %d portals\n", allPortals.Size());
|
||||||
bool didsomething = true;
|
bool didsomething = true;
|
||||||
while (didsomething)
|
while (didsomething)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +61,7 @@ inline void mergePortals()
|
||||||
pt2.type = -1;
|
pt2.type = -1;
|
||||||
for (int n = 0; n < numsectors; n++)
|
for (int n = 0; n < numsectors; n++)
|
||||||
{
|
{
|
||||||
Printf("Merged %d and %d\n", i, j);
|
//Printf("Merged %d and %d\n", i, j);
|
||||||
if (sector[n].portalnum == j) sector[n].portalnum = i;
|
if (sector[n].portalnum == j) sector[n].portalnum = i;
|
||||||
didsomething = true;
|
didsomething = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include "razemenu.h"
|
#include "razemenu.h"
|
||||||
#include "interpolate.h"
|
#include "interpolate.h"
|
||||||
#include "gamefuncs.h"
|
#include "gamefuncs.h"
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
|
|
||||||
sectortype sectorbackup[MAXSECTORS];
|
sectortype sectorbackup[MAXSECTORS];
|
||||||
|
@ -649,7 +650,8 @@ void SerializeMap(FSerializer& arc)
|
||||||
("parallaxys", parallaxyscale_override)
|
("parallaxys", parallaxyscale_override)
|
||||||
("pskybits", pskybits_override)
|
("pskybits", pskybits_override)
|
||||||
("numsprites", Numsprites)
|
("numsprites", Numsprites)
|
||||||
("gamesetinput", gamesetinput);
|
("gamesetinput", gamesetinput)
|
||||||
|
("allportals", allPortals);
|
||||||
|
|
||||||
SerializeInterpolations(arc);
|
SerializeInterpolations(arc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue