mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 09:20:59 +00:00
- copysect.cpp iterators.
This commit is contained in:
parent
f41d68b376
commit
32fa3c52ea
1 changed files with 17 additions and 19 deletions
|
@ -108,30 +108,28 @@ void CopySectorWalls(short dest_sectnum, short src_sectnum)
|
||||||
|
|
||||||
void CopySectorMatch(short match)
|
void CopySectorMatch(short match)
|
||||||
{
|
{
|
||||||
int ed,ss;
|
|
||||||
SPRITEp dest_sp, src_sp;
|
SPRITEp dest_sp, src_sp;
|
||||||
SECTORp dsectp,ssectp;
|
SECTORp dsectp,ssectp;
|
||||||
int kill;
|
int kill;
|
||||||
SPRITEp k;
|
SPRITEp k;
|
||||||
|
|
||||||
StatIterator it(STAT_COPY_DEST);
|
SWStatIterator it(STAT_COPY_DEST);
|
||||||
while ((ed = it.NextIndex()) >= 0)
|
while (auto dActor = it.Next())
|
||||||
{
|
{
|
||||||
dest_sp = &sprite[ed];
|
dest_sp = &dActor->s();
|
||||||
dsectp = §or[dest_sp->sectnum];
|
dsectp = §or[dest_sp->sectnum];
|
||||||
|
|
||||||
if (match != sprite[ed].lotag)
|
if (match != dest_sp->lotag)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
StatIterator it2(STAT_COPY_SOURCE);
|
SWStatIterator it2(STAT_COPY_SOURCE);
|
||||||
while ((ss = it2.NextIndex()) >= 0)
|
while (auto sActor = it2.Next())
|
||||||
{
|
{
|
||||||
src_sp = &sprite[ss];
|
src_sp = &sActor->s();
|
||||||
|
|
||||||
if (SP_TAG2(src_sp) == SP_TAG2(dest_sp) &&
|
if (SP_TAG2(src_sp) == SP_TAG2(dest_sp) &&
|
||||||
SP_TAG3(src_sp) == SP_TAG3(dest_sp))
|
SP_TAG3(src_sp) == SP_TAG3(dest_sp))
|
||||||
{
|
{
|
||||||
int src_move;
|
|
||||||
ssectp = §or[src_sp->sectnum];
|
ssectp = §or[src_sp->sectnum];
|
||||||
|
|
||||||
// !!!!!AAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH
|
// !!!!!AAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH
|
||||||
|
@ -166,9 +164,9 @@ void CopySectorMatch(short match)
|
||||||
CopySectorWalls(dest_sp->sectnum, src_sp->sectnum);
|
CopySectorWalls(dest_sp->sectnum, src_sp->sectnum);
|
||||||
|
|
||||||
itsec.Reset(src_sp->sectnum);
|
itsec.Reset(src_sp->sectnum);
|
||||||
while ((src_move = itsec.NextIndex()) >= 0)
|
while (auto itActor = itsec.Next())
|
||||||
{
|
{
|
||||||
auto sp = &sprite[src_move];
|
auto sp = &itActor->s();
|
||||||
// don't move ST1 Copy Tags
|
// don't move ST1 Copy Tags
|
||||||
if (SP_TAG1(sp) != SECT_COPY_SOURCE)
|
if (SP_TAG1(sp) != SECT_COPY_SOURCE)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +187,7 @@ void CopySectorMatch(short match)
|
||||||
sp->y = dy - src_yoff;
|
sp->y = dy - src_yoff;
|
||||||
|
|
||||||
// change sector
|
// change sector
|
||||||
changespritesect(src_move, dest_sp->sectnum);
|
ChangeActorSect(itActor, dest_sp->sectnum);
|
||||||
|
|
||||||
// check to see if it moved on to a sector object
|
// check to see if it moved on to a sector object
|
||||||
if (TEST(sector[dest_sp->sectnum].extra, SECTFX_SECTOR_OBJECT))
|
if (TEST(sector[dest_sp->sectnum].extra, SECTFX_SECTOR_OBJECT))
|
||||||
|
@ -198,7 +196,7 @@ void CopySectorMatch(short match)
|
||||||
|
|
||||||
// find and add sprite to SO
|
// find and add sprite to SO
|
||||||
sop = DetectSectorObject(§or[sp->sectnum]);
|
sop = DetectSectorObject(§or[sp->sectnum]);
|
||||||
AddSpriteToSectorObject(src_move, sop);
|
AddSpriteToSectorObject(itActor->GetSpriteIndex(), sop);
|
||||||
|
|
||||||
// update sprites postions so they aren't in the
|
// update sprites postions so they aren't in the
|
||||||
// wrong place for one frame
|
// wrong place for one frame
|
||||||
|
@ -259,18 +257,18 @@ void CopySectorMatch(short match)
|
||||||
|
|
||||||
// kill all matching dest
|
// kill all matching dest
|
||||||
it.Reset(STAT_COPY_DEST);
|
it.Reset(STAT_COPY_DEST);
|
||||||
while ((ed = it.NextIndex()) >= 0)
|
while (auto dActor = it.Next())
|
||||||
{
|
{
|
||||||
if (match == sprite[ed].lotag)
|
if (match == dActor->s().lotag)
|
||||||
KillSprite(ed);
|
KillActor(dActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// kill all matching sources
|
// kill all matching sources
|
||||||
it.Reset(STAT_COPY_SOURCE);
|
it.Reset(STAT_COPY_SOURCE);
|
||||||
while ((ss = it.NextIndex()) >= 0)
|
while (auto sActor = it.Next())
|
||||||
{
|
{
|
||||||
if (match == sprite[ss].lotag)
|
if (match == sActor->s().lotag)
|
||||||
KillSprite(ss);
|
KillActor(sActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue