mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-18 18:01:33 +00:00
- got rid of the sole linear sprite iterator in Exhumed and deleted the iterator code entirely.
This commit is contained in:
parent
8c298de114
commit
e13a275cfc
5 changed files with 24 additions and 33 deletions
|
@ -286,29 +286,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// For iterating linearly over map spawned sprites. Will later only be valid on map load
|
||||
template<class TActor>
|
||||
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<TActor*>(p);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
using CoreSectIterator = TSectIterator<DCoreActor>;
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ extern int Counters[kNumCounters];
|
|||
|
||||
void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b);
|
||||
|
||||
void LoadObjects();
|
||||
void LoadObjects(TArray<DExhumedActor*>& actors);
|
||||
|
||||
// light
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ using Collision = TCollision<DExhumedActor>;
|
|||
using ExhumedStatIterator = TStatIterator<DExhumedActor>;
|
||||
using ExhumedSectIterator = TSectIterator<DExhumedActor>;
|
||||
using ExhumedSpriteIterator = TSpriteIterator<DExhumedActor>;
|
||||
using ExhumedLinearSpriteIterator = TLinearSpriteIterator<DExhumedActor>;
|
||||
|
||||
|
||||
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DExhumedActor*& w, DExhumedActor** def)
|
||||
|
|
|
@ -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<DExhumedActor*> spawnactors(SpawnSpriteDef& spawns)
|
||||
{
|
||||
insertAllSprites(spawns);
|
||||
TArray<DExhumedActor*> 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<DExhumedActor*>& 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<DExhumedActor*>& actors)
|
||||
{
|
||||
runlist_InitRun();
|
||||
runlist_InitChan();
|
||||
|
@ -796,7 +812,7 @@ void LoadObjects()
|
|||
}
|
||||
}
|
||||
|
||||
ExamineSprites();
|
||||
ExamineSprites(actors);
|
||||
PostProcess();
|
||||
InitRa();
|
||||
InitChunks();
|
||||
|
|
Loading…
Reference in a new issue