diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 0bdd05e01..5fc4fe76c 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -286,29 +286,6 @@ public: } }; -// For iterating linearly over map spawned sprites. Will later only be valid on map load -template -class TLinearSpriteIterator -{ - int index = 0; -public: - - void Reset() - { - index = 0; - } - - TActor* Next() - { - while (index < MAXSPRITES) - { - auto p = actorArray[index++]; - if (p->s().statnum != MAXSTATUS) return static_cast(p); - } - return nullptr; - } -}; - using CoreSectIterator = TSectIterator; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 9f347cbfe..fbc0d5aaf 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -431,7 +431,6 @@ void allocateMapArrays(int numsprites) memset(sector.Data(), 0, sizeof(sectortype) * numsectors); wall.Resize(numwalls); memset(wall.Data(), 0, sizeof(walltype) * numwalls); - memset(sprite, 0, sizeof(*sprite) * MAXSPRITES); memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES + MAXUNIQHUDID)); diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 6f73bee55..9dd7c011f 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -87,7 +87,7 @@ extern int Counters[kNumCounters]; void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b); -void LoadObjects(); +void LoadObjects(TArray& actors); // light diff --git a/source/games/exhumed/src/exhumedactor.h b/source/games/exhumed/src/exhumedactor.h index 24016904c..66d364fce 100644 --- a/source/games/exhumed/src/exhumedactor.h +++ b/source/games/exhumed/src/exhumedactor.h @@ -61,7 +61,6 @@ using Collision = TCollision; using ExhumedStatIterator = TStatIterator; using ExhumedSectIterator = TSectIterator; using ExhumedSpriteIterator = TSpriteIterator; -using ExhumedLinearSpriteIterator = TLinearSpriteIterator; inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DExhumedActor*& w, DExhumedActor** def) diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index ffe9ec0b1..c3cc58ef2 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -57,6 +57,23 @@ int Counters[kNumCounters]; uint8_t bIsVersion6 = true; +//--------------------------------------------------------------------------- +// +// this is just a dummy for now to provide the intended setup. +// +//--------------------------------------------------------------------------- + +static TArray spawnactors(SpawnSpriteDef& spawns) +{ + insertAllSprites(spawns); + TArray actorlist; + for (unsigned i = 0; i < spawns.sprites.Size(); i++) + { + if (exhumedActors[i].exists()) actorlist.Push(&exhumedActors[i]); + } + return actorlist; +} + uint8_t LoadLevel(MapRecord* map) @@ -124,7 +141,7 @@ uint8_t LoadLevel(MapRecord* map) inity = startPos.y; initz = startPos.z; initsectp = §or[initsect]; - insertAllSprites(spawned); + auto actors = spawnactors(spawned); int i; @@ -149,7 +166,7 @@ uint8_t LoadLevel(MapRecord* map) flash = 0; precache(); - LoadObjects(); + LoadObjects(actors); return true; } @@ -707,13 +724,12 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) DeleteActor(pActor); } -void ExamineSprites() +void ExamineSprites(TArray& actors) { nNetStartSprites = 0; nCurStartSprite = 0; - ExhumedLinearSpriteIterator it; - while (auto ac = it.Next()) + for(auto& ac : actors) { auto pSprite = &ac->s(); @@ -751,7 +767,7 @@ void ExamineSprites() } } -void LoadObjects() +void LoadObjects(TArray& actors) { runlist_InitRun(); runlist_InitChan(); @@ -796,7 +812,7 @@ void LoadObjects() } } - ExamineSprites(); + ExamineSprites(actors); PostProcess(); InitRa(); InitChunks();