- added a serializer for the flamethrower's fire map.

This commit is contained in:
Christoph Oelckers 2020-06-29 23:36:06 +02:00
parent 0656beeb2b
commit 7253b4eb74
5 changed files with 54 additions and 38 deletions

View file

@ -218,7 +218,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value,
{
if (arc.isWriting())
{
if (value.Size() == 0) return arc; // do not save empty arrays
if (value.Size() == 0 && key) return arc; // do not save empty arrays
}
bool res = arc.BeginArray(key);
if (arc.isReading())

View file

@ -46,6 +46,8 @@ This file is a combination of code from the following sources:
BEGIN_DUKE_NS
int otherp;
int adjustfall(spritetype* s, int c);
//---------------------------------------------------------------------------
@ -378,7 +380,6 @@ void movedummyplayers(void)
//
//---------------------------------------------------------------------------
int otherp;
void moveplayers(void) //Players
{
short i, nexti;

View file

@ -38,6 +38,7 @@ This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail.
#include "global.h"
#include "zz_actors.h"
#include "names.h"
#include "serializer.h"
BEGIN_DUKE_NS
@ -49,6 +50,54 @@ struct FireProj
static TMap<int, FireProj> fire;
static FSerializer& Serialize(FSerializer& arc, const char* key, FireProj& p, FireProj* def)
{
if (arc.BeginObject(key))
{
arc("x", p.x)
("y", p.y)
("z", p.z)
("xv", p.xv)
("yv", p.yv)
("zv", p.zv)
.EndObject();
}
return arc;
}
void SerializeActorGlobals(FSerializer& arc)
{
if (arc.isWriting() && fire.CountUsed() == 0) return;
bool res = arc.BeginArray("FireProj");
if (arc.isReading())
{
fire.Clear();
if (!res) return;
auto length = arc.ArraySize() / 2;
int key;
FireProj value;
for (int i = 0; i < length; i++)
{
Serialize(arc, nullptr, key, nullptr);
Serialize(arc, nullptr, value, nullptr);
fire.Insert(key, value);
}
}
else
{
TMap<int, FireProj>::Iterator it(fire);
TMap<int, FireProj>::Pair* pair;
while (it.NextPair(pair))
{
int k = pair->Key;
Serialize(arc, nullptr, k, nullptr);
Serialize(arc, nullptr, pair->Value, nullptr);
}
}
arc.EndArray();
}
//---------------------------------------------------------------------------
//
//

View file

@ -45,14 +45,6 @@ void resetpins(short sect);
void resetlanepics(void);
struct FireProj
{
int x, y, z;
int xv, yv, zv;
};
static TMap<int, FireProj> fire;
//---------------------------------------------------------------------------
//
//

View file

@ -1698,34 +1698,8 @@ void G_BonusScreenRRRA(int32_t bonusonly)
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{
videoClearScreen(0);
G_DisplayMPResultsScreen();
PlayBonusMusic();
videoNextPage();
inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, -4);
totalclock = 0;
while (totalclock < TICRATE*10)
{
G_HandleAsync();
if (G_FPSLimit())
{
videoClearScreen(0);
G_DisplayMPResultsScreen();
videoNextPage();
}
if (inputState.CheckAllInput())
{
break;
}
}
fadepal(0, 0, 0, 0, 252, 4);
if (!isRR()) ShowMPBonusScreen_d(g_mostConcurrentPlayers, [](bool) {});
else ShowMPBonusScreen_r(g_mostConcurrentPlayers, [](bool) {});
}
if (bonusonly || (g_netServer || ud.multimode > 1)) return;