diff --git a/source/common/engine/serializer.h b/source/common/engine/serializer.h index fe20f247b..e1f54d36e 100644 --- a/source/common/engine/serializer.h +++ b/source/common/engine/serializer.h @@ -218,7 +218,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray &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()) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 5d37a8781..1d9a85134 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index c4ab7c73d..edd34d663 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -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 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::Iterator it(fire); + TMap::Pair* pair; + while (it.NextPair(pair)) + { + int k = pair->Key; + Serialize(arc, nullptr, k, nullptr); + Serialize(arc, nullptr, pair->Value, nullptr); + } + } + arc.EndArray(); +} + //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index f6515208d..478e4a29e 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -45,14 +45,6 @@ void resetpins(short sect); void resetlanepics(void); -struct FireProj -{ - int x, y, z; - int xv, yv, zv; -}; - -static TMap fire; - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 791db197b..a1e6725b7 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -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;