- redid the iterators in _polymost.cpp.

This commit is contained in:
Christoph Oelckers 2021-10-29 21:01:22 +02:00
parent d6bdc735d6
commit e84d61e80a
2 changed files with 17 additions and 29 deletions

View file

@ -11,10 +11,10 @@ ViewSectorInScene(short cursectnum, short level)
SPRITEp sp; SPRITEp sp;
short match; short match;
StatIterator it(STAT_FAF); SWStatIterator it(STAT_FAF);
while ((i = it.NextIndex()) >= 0) while (auto actor = it.Next())
{ {
sp = &sprite[i]; sp = &actor->s();
if (sp->hitag == level) if (sp->hitag == level)
{ {
@ -102,17 +102,16 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum) void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum)
{ {
int i; SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); while (auto actor = it.Next())
while ((i = it.NextIndex()) >= 0)
{ {
auto sp = &sprite[i]; auto sp = &actor->s();
if (SP_TAG3(sp) == 0) if (SP_TAG3(sp) == 0)
{ {
// back up ceilingpicnum and ceilingstat // back up ceilingpicnum and ceilingstat
SP_TAG5(sp) = sector[sp->sectnum].ceilingpicnum; SP_TAG5(sp) = sector[sp->sectnum].ceilingpicnum;
sector[sp->sectnum].ceilingpicnum = SP_TAG2(sp); sector[sp->sectnum].ceilingpicnum = SP_TAG2(sp);
SP_TAG4(sp) = sector[sprite[i].sectnum].ceilingstat; SP_TAG4(sp) = sector[sp->sectnum].ceilingstat;
//SET(sp->sectnum].ceilingstat, ((int)SP_TAG7(sp))<<7); //SET(sp->sectnum].ceilingstat, ((int)SP_TAG7(sp))<<7);
SET(sector[sp->sectnum].ceilingstat, SP_TAG6(sp)); SET(sector[sp->sectnum].ceilingstat, SP_TAG6(sp));
RESET(sector[sp->sectnum].ceilingstat, CEILING_STAT_PLAX); RESET(sector[sp->sectnum].ceilingstat, CEILING_STAT_PLAX);
@ -131,9 +130,9 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum); renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum);
it.Reset(STAT_CEILING_FLOOR_PIC_OVERRIDE); it.Reset(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while ((i = it.NextIndex()) >= 0) while (auto actor = it.Next())
{ {
auto sp = &sprite[i]; auto sp = &actor->s();
// manually set gotpic // manually set gotpic
if (gotsector[sp->sectnum]) if (gotsector[sp->sectnum])
{ {
@ -252,8 +251,6 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
sp = &sprite[mirror[cnt].camera]; sp = &sprite[mirror[cnt].camera];
ASSERT(sp);
// Calculate the angle of the mirror wall // Calculate the angle of the mirror wall
w = mirror[cnt].mirrorwall; w = mirror[cnt].mirrorwall;

View file

@ -40,26 +40,17 @@ typedef enum
typedef struct typedef struct
{ {
short mirrorwall; // Wall number containing the mirror short mirrorwall; // Wall number containing the mirror tile
// tile short mirrorsector; // nextsector used internally to draw mirror rooms
short mirrorsector; // nextsector used internally to draw short camera; // Contains number of ST1 sprite used as a camera
// mirror rooms
short camera; // Contains number of ST1 sprite used
// as a camera
short camsprite; // sprite pointing to campic short camsprite; // sprite pointing to campic
short campic; // Editart tile number to draw a short campic; // Editart tile number to draw a screen to
// screen to
short numspawnspots; // Number of spawnspots used short numspawnspots; // Number of spawnspots used
short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill short spawnspots[MAXMIRRORMONSTERS]; // One spot for each possible skill level for a max of up to 4 coolie ghosts to spawn.
// level for a
// max of up to 4 coolie ghosts to spawn.
bool ismagic; // Is this a magic mirror? bool ismagic; // Is this a magic mirror?
uint8_t mstate; // What state the mirror is currently uint8_t mstate; // What state the mirror is currently in
// in int maxtics; // Tic count used to time mirror events
int maxtics; // Tic count used to time mirror int tics; // How much viewing time has been used on mirror?
// events
int tics; // How much viewing time has been
// used on mirror?
} MIRRORTYPE, *MIRRORTYPEp; } MIRRORTYPE, *MIRRORTYPEp;
extern MIRRORTYPE mirror[MAXMIRRORS]; extern MIRRORTYPE mirror[MAXMIRRORS];