mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- added nextSector access function to walltype and used it to eliminate a few more sector[] references.
This commit is contained in:
parent
0c64560fd8
commit
a594e6465c
8 changed files with 30 additions and 10 deletions
|
@ -158,6 +158,21 @@ inline sectortype* spritetype::sector() const
|
|||
return &::sector[sectnum];
|
||||
}
|
||||
|
||||
inline sectortype* walltype::nextSector() const
|
||||
{
|
||||
return &::sector[nextsector];
|
||||
}
|
||||
|
||||
inline walltype* walltype::nextWall() const
|
||||
{
|
||||
return &::wall[nextwall];
|
||||
}
|
||||
|
||||
inline walltype* sectortype::firstWall() const
|
||||
{
|
||||
return &wall[wallptr];
|
||||
}
|
||||
|
||||
|
||||
extern sectortype sectorbackup[MAXSECTORS];
|
||||
extern walltype wallbackup[MAXWALLS];
|
||||
|
|
|
@ -51,6 +51,7 @@ enum
|
|||
|
||||
|
||||
//40 bytes
|
||||
struct walltype;
|
||||
struct sectortype
|
||||
{
|
||||
int16_t wallptr, wallnum;
|
||||
|
@ -87,6 +88,7 @@ struct sectortype
|
|||
void addfloorypan(float add) { floorypan_ = fmodf(floorypan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
void addceilingxpan(float add) { ceilingxpan_ = fmodf(ceilingxpan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
void addceilingypan(float add) { ceilingypan_ = fmodf(ceilingypan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
walltype *firstWall() const;
|
||||
};
|
||||
|
||||
//cstat:
|
||||
|
@ -134,6 +136,9 @@ struct walltype
|
|||
void setypan(float add) { ypan_ = fmodf(add + 512, 256); } // +512 is for handling negative offsets
|
||||
void addxpan(float add) { xpan_ = fmodf(xpan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
void addypan(float add) { ypan_ = fmodf(ypan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
sectortype* nextSector() const;
|
||||
walltype* nextWall() const;
|
||||
bool twoSided() const { return nextsector >= 0; }
|
||||
|
||||
#if 0
|
||||
// make sure we do not accidentally copy this
|
||||
|
|
|
@ -3773,7 +3773,7 @@ void moveeffectors_d(void) //STATNUM 3
|
|||
auto sc = act->getSector();
|
||||
if (sc->wallnum != 4) continue;
|
||||
auto wal = &wall[sc->wallptr + 2];
|
||||
alignflorslope(act->s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz);
|
||||
alignflorslope(act->s->sectnum, wal->x, wal->y, wal->nextSector()->floorz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3653,7 +3653,7 @@ void moveeffectors_r(void) //STATNUM 3
|
|||
auto sc = act->getSector();
|
||||
if (sc->wallnum != 4) continue;
|
||||
auto wal = &wall[sc->wallptr + 2];
|
||||
alignflorslope(act->s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz);
|
||||
alignflorslope(act->s->sectnum, wal->x, wal->y, wal->nextSector()->floorz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -492,7 +492,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
|
|||
|
||||
if (hitsect >= 0 && sector[hitsect].lotag == 0)
|
||||
if (wal->overpicnum != BIGFORCE)
|
||||
if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) ||
|
||||
if ((wal->nextsector >= 0 && wal->nextSector()->lotag == 0) ||
|
||||
(wal->nextsector == -1 && sector[hitsect].lotag == 0))
|
||||
if ((wal->cstat & 16) == 0)
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
|
|||
|
||||
if (wal->cstat & 2)
|
||||
if (wal->nextsector >= 0)
|
||||
if (hitz >= (sector[wal->nextsector].floorz))
|
||||
if (hitz >= (wal->nextSector()->floorz))
|
||||
hitwall = wal->nextwall;
|
||||
|
||||
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
||||
|
|
|
@ -392,7 +392,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
|
|||
|
||||
if (hitsect >= 0 && sector[hitsect].lotag == 0)
|
||||
if (wal->overpicnum != BIGFORCE)
|
||||
if ((wal->nextsector >= 0 && sector[wal->nextsector].lotag == 0) ||
|
||||
if ((wal->nextsector >= 0 && wal->nextSector()->lotag == 0) ||
|
||||
(wal->nextsector == -1 && sector[hitsect].lotag == 0))
|
||||
if ((wal->cstat & 16) == 0)
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
|
|||
|
||||
if (wal->cstat & 2)
|
||||
if (wal->nextsector >= 0)
|
||||
if (hitz >= (sector[wal->nextsector].floorz))
|
||||
if (hitz >= (wal->nextSector()->floorz))
|
||||
hitwall = wal->nextwall;
|
||||
|
||||
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
||||
|
|
|
@ -667,8 +667,8 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
|
|||
}
|
||||
|
||||
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0)
|
||||
if (sector[wal->nextsector].floorz > z)
|
||||
if (sector[wal->nextsector].floorz - sector[wal->nextsector].ceilingz)
|
||||
if (wal->nextSector()->floorz > z)
|
||||
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
|
||||
switch (wal->overpicnum)
|
||||
{
|
||||
case W_FORCEFIELD:
|
||||
|
|
|
@ -1006,8 +1006,8 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
|
|||
}
|
||||
|
||||
if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0)
|
||||
if (sector[wal->nextsector].floorz > z)
|
||||
if (sector[wal->nextsector].floorz - sector[wal->nextsector].ceilingz)
|
||||
if (wal->nextSector()->floorz > z)
|
||||
if (wal->nextSector()->floorz - wal->nextSector()->ceilingz)
|
||||
switch (wal->overpicnum)
|
||||
{
|
||||
case FANSPRITE:
|
||||
|
|
Loading…
Reference in a new issue