# Conflicts:
#	src/CMakeLists.txt
#	src/g_level.cpp
#	src/p_saveg.cpp
#	src/r_defs.h
#	src/version.h

(note that this commit will not compile!)
This commit is contained in:
Christoph Oelckers 2016-09-24 00:40:15 +02:00
commit 6bfbe30b99
201 changed files with 21832 additions and 6631 deletions

View file

@ -39,7 +39,7 @@
#include "p_local.h"
#include "i_system.h"
#include "po_man.h"
#include "farchive.h"
#include "serializer.h"
//==========================================================================
//
@ -66,7 +66,8 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
void Serialize(FArchive &arc);
virtual void Serialize(FSerializer &arc);
size_t PointerSubstitution (DObject *old, DObject *notOld);
size_t PropagateMark();
};
@ -94,7 +95,8 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
void Serialize(FArchive &arc);
virtual void Serialize(FSerializer &arc);
};
@ -121,7 +123,8 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
void Serialize(FArchive &arc);
virtual void Serialize(FSerializer &arc);
};
//==========================================================================
@ -147,7 +150,8 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
void Serialize(FArchive &arc);
virtual void Serialize(FSerializer &arc);
};
@ -370,11 +374,11 @@ void DInterpolation::Destroy()
//
//==========================================================================
void DInterpolation::Serialize(FArchive &arc)
void DInterpolation::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc << refcount;
if (arc.IsLoading())
arc("refcount", refcount);
if (arc.isReading())
{
interpolator.AddInterpolation(this);
}
@ -414,15 +418,18 @@ DSectorPlaneInterpolation::DSectorPlaneInterpolation(sector_t *_sector, bool _pl
void DSectorPlaneInterpolation::Destroy()
{
if (ceiling)
if (sector != nullptr)
{
sector->interpolations[sector_t::CeilingMove] = NULL;
if (ceiling)
{
sector->interpolations[sector_t::CeilingMove] = nullptr;
}
else
{
sector->interpolations[sector_t::FloorMove] = nullptr;
}
sector = nullptr;
}
else
{
sector->interpolations[sector_t::FloorMove] = NULL;
}
for(unsigned i=0; i<attached.Size(); i++)
{
attached[i]->DelRef();
@ -516,10 +523,14 @@ void DSectorPlaneInterpolation::Interpolate(double smoothratio)
//
//==========================================================================
void DSectorPlaneInterpolation::Serialize(FArchive &arc)
void DSectorPlaneInterpolation::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc << sector << ceiling << oldheight << oldtexz << attached;
arc("sector", sector)
("ceiling", ceiling)
("oldheight", oldheight)
("oldtexz", oldtexz)
("attached", attached);
}
//==========================================================================
@ -585,13 +596,17 @@ DSectorScrollInterpolation::DSectorScrollInterpolation(sector_t *_sector, bool _
void DSectorScrollInterpolation::Destroy()
{
if (ceiling)
if (sector != nullptr)
{
sector->interpolations[sector_t::CeilingScroll] = NULL;
}
else
{
sector->interpolations[sector_t::FloorScroll] = NULL;
if (ceiling)
{
sector->interpolations[sector_t::CeilingScroll] = nullptr;
}
else
{
sector->interpolations[sector_t::FloorScroll] = nullptr;
}
sector = nullptr;
}
Super::Destroy();
}
@ -648,10 +663,13 @@ void DSectorScrollInterpolation::Interpolate(double smoothratio)
//
//==========================================================================
void DSectorScrollInterpolation::Serialize(FArchive &arc)
void DSectorScrollInterpolation::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc << sector << ceiling << oldx << oldy;
arc("sector", sector)
("ceiling", ceiling)
("oldx", oldx)
("oldy", oldy);
}
@ -683,7 +701,11 @@ DWallScrollInterpolation::DWallScrollInterpolation(side_t *_side, int _part)
void DWallScrollInterpolation::Destroy()
{
side->textures[part].interpolation = NULL;
if (side != nullptr)
{
side->textures[part].interpolation = nullptr;
side = nullptr;
}
Super::Destroy();
}
@ -739,10 +761,13 @@ void DWallScrollInterpolation::Interpolate(double smoothratio)
//
//==========================================================================
void DWallScrollInterpolation::Serialize(FArchive &arc)
void DWallScrollInterpolation::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc << side << part << oldx << oldy;
arc("side", side)
("part", part)
("oldx", oldx)
("oldy", oldy);
}
//==========================================================================
@ -774,7 +799,10 @@ DPolyobjInterpolation::DPolyobjInterpolation(FPolyObj *po)
void DPolyobjInterpolation::Destroy()
{
poly->interpolation = NULL;
if (poly != nullptr)
{
poly->interpolation = nullptr;
}
Super::Destroy();
}
@ -855,15 +883,14 @@ void DPolyobjInterpolation::Interpolate(double smoothratio)
//
//==========================================================================
void DPolyobjInterpolation::Serialize(FArchive &arc)
void DPolyobjInterpolation::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
int po = int(poly - polyobjs);
arc << po << oldverts;
poly = polyobjs + po;
arc << oldcx << oldcy;
if (arc.IsLoading()) bakverts.Resize(oldverts.Size());
arc("poly", poly)
("oldverts", oldverts)
("oldcx", oldcx)
("oldcy", oldcy);
if (arc.isReading()) bakverts.Resize(oldverts.Size());
}

View file

@ -31,7 +31,8 @@ public:
virtual void UpdateInterpolation() = 0;
virtual void Restore() = 0;
virtual void Interpolate(double smoothratio) = 0;
virtual void Serialize(FArchive &arc);
virtual void Serialize(FSerializer &arc);
};
//==========================================================================

View file

@ -46,8 +46,10 @@
#include "i_system.h"
#include "w_wad.h"
#include "r_data/colormaps.h"
#include "farchive.h"
#include "serializer.h"
#include "d_player.h"
#include "r_data/sprites.h"
#include "r_state.h"
#include "gi.h"
#include "stats.h"
@ -192,27 +194,62 @@ bool FRemapTable::operator==(const FRemapTable &o)
//
//----------------------------------------------------------------------------
void FRemapTable::Serialize(FArchive &arc)
void FRemapTable::Serialize(FSerializer &arc)
{
int n = NumEntries;
arc << NumEntries;
if (arc.IsStoring())
{
arc.Write (Remap, NumEntries);
}
else
arc("numentries", NumEntries);
if (arc.isReading())
{
if (n != NumEntries)
{
Free();
Alloc(NumEntries);
}
arc.Read (Remap, NumEntries);
}
for (int j = 0; j < NumEntries; ++j)
arc.Array("remap", Remap, NumEntries);
arc.Array("palette", Palette, NumEntries);
}
void FRemapTable::StaticSerializeTranslations(FSerializer &arc)
{
if (arc.BeginArray("translations"))
{
arc << Palette[j];
// Does this level have custom translations?
FRemapTable *trans;
int w;
if (arc.isWriting())
{
for (unsigned int i = 0; i < translationtables[TRANSLATION_LevelScripted].Size(); ++i)
{
trans = translationtables[TRANSLATION_LevelScripted][i];
if (trans != NULL && !trans->IsIdentity())
{
if (arc.BeginObject(nullptr))
{
arc("index", i);
trans->Serialize(arc);
arc.EndObject();
}
}
}
}
else
{
while (arc.BeginObject(nullptr))
{
arc("index", w);
trans = translationtables[TRANSLATION_LevelScripted].GetVal(w);
if (trans == NULL)
{
trans = new FRemapTable;
translationtables[TRANSLATION_LevelScripted].SetVal(w, trans);
}
trans->Serialize(arc);
arc.EndObject();
}
}
arc.EndArray();
}
}

View file

@ -5,7 +5,7 @@
#include "tarray.h"
class FNativePalette;
class FArchive;
class FSerializer;
enum
{
@ -36,7 +36,8 @@ struct FRemapTable
void UpdateNative();
FNativePalette *GetNative();
bool IsIdentity() const;
void Serialize(FArchive &ar);
void Serialize(FSerializer &arc);
static void StaticSerializeTranslations(FSerializer &arc);
void AddIndexRange(int start, int end, int pal1, int pal2);
void AddColorRange(int start, int end, int r1,int g1, int b1, int r2, int g2, int b2);
void AddDesaturation(int start, int end, double r1, double g1, double b1, double r2, double g2, double b2);

View file

@ -32,7 +32,6 @@
**
*/
#include "farchive.h"
#include "templates.h"
#include "renderstyle.h"
#include "c_cvars.h"
@ -99,12 +98,6 @@ static struct LegacyInit
#endif
FArchive &operator<< (FArchive &arc, FRenderStyle &style)
{
arc << style.BlendOp << style.SrcAlpha << style.DestAlpha << style.Flags;
return arc;
}
double GetAlpha(int type, double alpha)
{
switch (type)

View file

@ -34,6 +34,7 @@
**---------------------------------------------------------------------------
**
*/
#include <stdint.h>
// <wingdi.h> also #defines OPAQUE
#ifdef OPAQUE
@ -130,15 +131,15 @@ union FRenderStyle
{
struct
{
BYTE BlendOp; // Of ERenderOp type
BYTE SrcAlpha; // Of ERenderAlpha type
BYTE DestAlpha; // Of ERenderAlpha type
BYTE Flags;
uint8_t BlendOp; // Of ERenderOp type
uint8_t SrcAlpha; // Of ERenderAlpha type
uint8_t DestAlpha; // Of ERenderAlpha type
uint8_t Flags;
};
uint32 AsDWORD;
uint32_t AsDWORD;
inline FRenderStyle &operator= (ERenderStyle legacy);
operator uint32() const { return AsDWORD; }
operator uint32_t() const { return AsDWORD; }
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
void CheckFuzz();
bool IsVisible(double alpha) const throw();
@ -162,8 +163,4 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
return *this;
}
class FArchive;
FArchive &operator<< (FArchive &arc, FRenderStyle &style);
#endif