- activeXSprites map.

This commit is contained in:
Christoph Oelckers 2020-11-21 22:25:56 +01:00
parent d4873754f3
commit 2c6fa57090
2 changed files with 22 additions and 8 deletions

View file

@ -51,6 +51,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
FixedBitArray<MAXSPRITES> activeXSprites;
// All AI states for assigning an index.
static AISTATE* allAIStates[] =
{
@ -720,8 +722,6 @@ void MyLoadSave::Save(void)
Write(skyInfo, sizeof(*skyInfo));
}
void ActorLoadSaveConstruct(void);
void AILoadSaveConstruct(void);
void EndGameLoadSaveConstruct(void);
void LevelsLoadSaveConstruct(void);
void MessagesLoadSaveConstruct(void);
@ -736,7 +736,6 @@ void LoadSaveSetup(void)
{
new MyLoadSave();
AILoadSaveConstruct();
EndGameLoadSaveConstruct();
LevelsLoadSaveConstruct();
MessagesLoadSaveConstruct();
@ -754,6 +753,7 @@ void SerializeSequences(FSerializer& arc);
void SerializeWarp(FSerializer& arc);
void SerializeTriggers(FSerializer& arc);
void SerializeActor(FSerializer& arc);
void SerializeAI(FSerializer& arc);
void GameInterface::SerializeGameState(FSerializer& arc)
{
@ -761,16 +761,29 @@ void GameInterface::SerializeGameState(FSerializer& arc)
sfxKillAllSounds();
ambKillAll();
seqKillAll();
if (arc.isWriting())
{
activeXSprites.Zero();
for (int i = 0; i < kMaxSprites; i++)
{
if (activeSprites[i] && sprite[i].extra > 0) activeXSprites.Set(sprite[i].extra);
}
}
else
{
if (gamestate != GS_LEVEL)
{
memset(xsprite, 0, sizeof(xsprite));
}
}
arc.SerializeMemory("activexsprites", activeXSprites.Storage(), activeXSprites.StorageSize());
SerializeActor(arc);
SerializeAI(arc);
SerializeEvents(arc);
SerializeSequences(arc);
SerializeWarp(arc);
SerializeTriggers(arc);
SerializeActor(arc);
}

View file

@ -44,5 +44,6 @@ public:
};
void LoadSaveSetup(void);
extern FixedBitArray<MAXSPRITES> activeXSprites;
END_BLD_NS