mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
- re-added serialization of treanslations.
- removed more dead code.
This commit is contained in:
parent
e101014432
commit
970c168b13
17 changed files with 56 additions and 164 deletions
|
@ -39,7 +39,6 @@
|
|||
|
||||
class PClass;
|
||||
|
||||
class FArchive;
|
||||
class FSerializer;
|
||||
|
||||
class DObject;
|
||||
|
|
|
@ -1873,10 +1873,10 @@ bool PArray::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
|||
BYTE *addrb = (BYTE *)addr;
|
||||
for(unsigned i=0;i<loop;i++)
|
||||
{
|
||||
readsomething |= ElementType->ReadValue(ar, key, addrb);
|
||||
readsomething |= ElementType->ReadValue(ar, nullptr, addrb);
|
||||
addrb += ElementSize;
|
||||
}
|
||||
if (loop < ElementCount)
|
||||
if (loop < count)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "Array on disk (%u) is bigger than in memory (%u)\n",
|
||||
count, ElementCount);
|
||||
|
|
|
@ -339,7 +339,6 @@ struct mapthinghexen_t
|
|||
BYTE args[5];
|
||||
};
|
||||
|
||||
class FArchive;
|
||||
struct FDoomEdEntry;
|
||||
|
||||
// Internal representation of a mapthing
|
||||
|
|
|
@ -206,7 +206,6 @@ struct PalEntry
|
|||
#endif
|
||||
};
|
||||
|
||||
class FArchive;
|
||||
class PClassInventory;
|
||||
|
||||
class FTextureID
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
struct Baggage;
|
||||
class FScanner;
|
||||
struct FActorInfo;
|
||||
class FArchive;
|
||||
class FIntCVar;
|
||||
|
||||
enum EStateType
|
||||
|
|
|
@ -893,6 +893,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
arc("subsectors", subsectors);
|
||||
StatusBar->SerializeMessages(arc);
|
||||
AM_SerializeMarkers(arc);
|
||||
FRemapTable::StaticSerializeTranslations(arc);
|
||||
|
||||
}
|
||||
|
||||
|
@ -933,37 +934,6 @@ void P_SerializeSounds (FArchive &arc)
|
|||
void G_SerializeLevel(FArchive &arc, bool hubLoad)
|
||||
{
|
||||
#if 0
|
||||
// Does this level have custom translations?
|
||||
FRemapTable *trans;
|
||||
WORD w;
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
for (unsigned int i = 0; i < translationtables[TRANSLATION_LevelScripted].Size(); ++i)
|
||||
{
|
||||
trans = translationtables[TRANSLATION_LevelScripted][i];
|
||||
if (trans != NULL && !trans->IsIdentity())
|
||||
{
|
||||
w = WORD(i);
|
||||
arc << w;
|
||||
trans->Serialize(arc);
|
||||
}
|
||||
}
|
||||
w = 0xffff;
|
||||
arc << w;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (arc << w, w != 0xffff)
|
||||
{
|
||||
trans = translationtables[TRANSLATION_LevelScripted].GetVal(w);
|
||||
if (trans == NULL)
|
||||
{
|
||||
trans = new FRemapTable;
|
||||
translationtables[TRANSLATION_LevelScripted].SetVal(w, trans);
|
||||
}
|
||||
trans->Serialize(arc);
|
||||
}
|
||||
}
|
||||
|
||||
// This must be saved, too, of course!
|
||||
FCanvasTextureInfo::Serialize(arc);
|
||||
|
|
|
@ -41,12 +41,7 @@ struct PNGHandle;
|
|||
// These are the load / save game routines.
|
||||
// Also see farchive.(h|cpp)
|
||||
void P_SerializePlayers (FArchive &arc, bool fakeload);
|
||||
void P_SerializeWorldActors(FArchive &arc);
|
||||
void P_SerializeWorld (FArchive &arc);
|
||||
void P_DestroyThinkers(bool hubLoad);
|
||||
void P_SerializeThinkers (FArchive &arc, bool);
|
||||
void P_SerializePolyobjs (FArchive &arc);
|
||||
void P_SerializeSubsectors(FArchive &arc);
|
||||
void P_SerializeSounds (FArchive &arc);
|
||||
|
||||
void P_ReadACSDefereds (PNGHandle *png);
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "s_sound.h"
|
||||
#include "p_local.h"
|
||||
#include "templates.h"
|
||||
#include "farchive.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -725,18 +724,3 @@ FName P_GetTerrainName(int terrainnum)
|
|||
}
|
||||
}
|
||||
|
||||
void P_SerializeTerrain(FArchive &arc, int &terrainnum)
|
||||
{
|
||||
FName val;
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
val = P_GetTerrainName(terrainnum);
|
||||
arc << val;
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << val;
|
||||
terrainnum = P_FindTerrain(val);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,30 +194,63 @@ bool FRemapTable::operator==(const FRemapTable &o)
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void FRemapTable::Serialize(FArchive &arc)
|
||||
void FRemapTable::Serialize(FSerializer &arc)
|
||||
{
|
||||
#if 0
|
||||
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();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "r_data/voxels.h"
|
||||
|
||||
|
||||
class FArchive;
|
||||
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
|
||||
void R_SetupColormap(player_t *);
|
||||
void R_SetupFreelook();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "doomtype.h"
|
||||
#include "tarray.h"
|
||||
#include "s_sound.h"
|
||||
#include "farchive.h"
|
||||
#include "sc_man.h"
|
||||
#include "cmdlib.h"
|
||||
#include "templates.h"
|
||||
|
@ -481,30 +480,6 @@ void S_AddEnvironment (ReverbContainer *settings)
|
|||
}
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, ReverbContainer *&env)
|
||||
{
|
||||
WORD id;
|
||||
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
if (env != NULL)
|
||||
{
|
||||
arc << env->ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = 0;
|
||||
arc << id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << id;
|
||||
env = S_FindEnvironment (id);
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
static void ReadReverbDef (int lump)
|
||||
{
|
||||
FScanner sc;
|
||||
|
|
|
@ -387,9 +387,6 @@ void S_NoiseDebug ();
|
|||
extern ReverbContainer *Environments;
|
||||
extern ReverbContainer *DefaultEnvironments[26];
|
||||
|
||||
class FArchive;
|
||||
FArchive &operator<< (FArchive &arc, ReverbContainer *&env);
|
||||
|
||||
void S_SetEnvironment (const ReverbContainer *settings);
|
||||
ReverbContainer *S_FindEnvironment (const char *name);
|
||||
ReverbContainer *S_FindEnvironment (int id);
|
||||
|
|
|
@ -133,9 +133,9 @@ struct FReader
|
|||
return &it->value;
|
||||
}
|
||||
}
|
||||
else if (obj.mObject->IsArray())
|
||||
else if (obj.mObject->IsArray() && obj.mIndex < obj.mObject->Size())
|
||||
{
|
||||
return &obj.mObject[obj.mIndex++];
|
||||
return &(*obj.mObject)[obj.mIndex++];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1074,61 +1074,6 @@ FTextureID FTextureManager::PalCheck(FTextureID tex)
|
|||
return *newtex;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: WriteTexture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FTextureManager::WriteTexture (FArchive &arc, int picnum)
|
||||
{
|
||||
FTexture *pic;
|
||||
|
||||
if (picnum < 0)
|
||||
{
|
||||
arc.WriteName(NULL);
|
||||
return;
|
||||
}
|
||||
else if ((size_t)picnum >= Textures.Size())
|
||||
{
|
||||
pic = Textures[0].Texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
pic = Textures[picnum].Texture;
|
||||
}
|
||||
|
||||
if (Wads.GetLinkedTexture(pic->SourceLump) == pic)
|
||||
{
|
||||
arc.WriteName(Wads.GetLumpFullName(pic->SourceLump));
|
||||
}
|
||||
else
|
||||
{
|
||||
arc.WriteName(pic->Name);
|
||||
}
|
||||
arc.WriteCount(pic->UseType);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: ReadTexture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FTextureManager::ReadTexture (FArchive &arc)
|
||||
{
|
||||
int usetype;
|
||||
const char *name;
|
||||
|
||||
name = arc.ReadName ();
|
||||
if (name != NULL)
|
||||
{
|
||||
usetype = arc.ReadCount ();
|
||||
return GetTexture (name, usetype).GetIndex();
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// R_GuesstimateNumTextures
|
||||
|
|
|
@ -380,9 +380,6 @@ public:
|
|||
|
||||
int NumTextures () const { return (int)Textures.Size(); }
|
||||
|
||||
void WriteTexture (FArchive &arc, int picnum);
|
||||
int ReadTexture (FArchive &arc);
|
||||
|
||||
void UpdateAnimations (DWORD mstime);
|
||||
int GuesstimateNumTextures ();
|
||||
|
||||
|
@ -498,7 +495,6 @@ protected:
|
|||
// A texture that can be drawn to.
|
||||
class DSimpleCanvas;
|
||||
class AActor;
|
||||
class FArchive;
|
||||
|
||||
class FCanvasTexture : public FTexture
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
class DCanvas;
|
||||
struct FRemapTable;
|
||||
class FTexture;
|
||||
class FArchive;
|
||||
|
||||
enum EColorRange
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue