mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- sp-> renaming and cleanup in rooms.cpp
This commit is contained in:
parent
49cc2b3cad
commit
270afb5d49
1 changed files with 69 additions and 92 deletions
|
@ -84,10 +84,8 @@ bool FAF_Sector(sectortype* sect)
|
||||||
SWSectIterator it(sect);
|
SWSectIterator it(sect);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.statnum == STAT_FAF &&
|
||||||
|
(actor->spr.hitag >= VIEW_LEVEL1 && actor->spr.hitag <= VIEW_LEVEL6))
|
||||||
if (sp->statnum == STAT_FAF &&
|
|
||||||
(sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -327,11 +325,9 @@ int GetZadjustment(sectortype* sect, short hitag)
|
||||||
SWStatIterator it(STAT_ST1);
|
SWStatIterator it(STAT_ST1);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &itActor->s();
|
if (itActor->spr.hitag == hitag && itActor->spr.sector() == sect)
|
||||||
|
|
||||||
if (sp->hitag == hitag && sp->sector() == sect)
|
|
||||||
{
|
{
|
||||||
return Z(sp->lotag);
|
return Z(itActor->spr.lotag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,25 +584,23 @@ void SetupMirrorTiles(void)
|
||||||
SWStatIterator it(STAT_FAF);
|
SWStatIterator it(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.sector()->ceilingpicnum == FAF_PLACE_MIRROR_PIC)
|
||||||
|
|
||||||
if (sp->sector()->ceilingpicnum == FAF_PLACE_MIRROR_PIC)
|
|
||||||
{
|
{
|
||||||
sp->sector()->ceilingpicnum = FAF_MIRROR_PIC;
|
actor->spr.sector()->ceilingpicnum = FAF_MIRROR_PIC;
|
||||||
SET(sp->sector()->ceilingstat, CSTAT_SECTOR_SKY);
|
SET(actor->spr.sector()->ceilingstat, CSTAT_SECTOR_SKY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp->sector()->floorpicnum == FAF_PLACE_MIRROR_PIC)
|
if (actor->spr.sector()->floorpicnum == FAF_PLACE_MIRROR_PIC)
|
||||||
{
|
{
|
||||||
sp->sector()->floorpicnum = FAF_MIRROR_PIC;
|
actor->spr.sector()->floorpicnum = FAF_MIRROR_PIC;
|
||||||
SET(sp->sector()->floorstat, CSTAT_SECTOR_SKY);
|
SET(actor->spr.sector()->floorstat, CSTAT_SECTOR_SKY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp->sector()->ceilingpicnum == FAF_PLACE_MIRROR_PIC+1)
|
if (actor->spr.sector()->ceilingpicnum == FAF_PLACE_MIRROR_PIC+1)
|
||||||
sp->sector()->ceilingpicnum = FAF_MIRROR_PIC+1;
|
actor->spr.sector()->ceilingpicnum = FAF_MIRROR_PIC+1;
|
||||||
|
|
||||||
if (sp->sector()->floorpicnum == FAF_PLACE_MIRROR_PIC+1)
|
if (actor->spr.sector()->floorpicnum == FAF_PLACE_MIRROR_PIC+1)
|
||||||
sp->sector()->floorpicnum = FAF_MIRROR_PIC+1;
|
actor->spr.sector()->floorpicnum = FAF_MIRROR_PIC+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,11 +620,9 @@ void GetUpperLowerSector(short match, int x, int y, sectortype** upper, sectorty
|
||||||
SWSectIterator it(§);
|
SWSectIterator it(§);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.statnum == STAT_FAF &&
|
||||||
|
(actor->spr.hitag >= VIEW_LEVEL1 && actor->spr.hitag <= VIEW_LEVEL6)
|
||||||
if (sp->statnum == STAT_FAF &&
|
&& actor->spr.lotag == match)
|
||||||
(sp->hitag >= VIEW_LEVEL1 && sp->hitag <= VIEW_LEVEL6)
|
|
||||||
&& sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
@ -685,41 +677,37 @@ bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
{
|
{
|
||||||
int xoff = 0;
|
int xoff = 0;
|
||||||
int yoff = 0;
|
int yoff = 0;
|
||||||
SPRITEp sp = nullptr;
|
|
||||||
int pix_diff;
|
int pix_diff;
|
||||||
int newz;
|
int newz;
|
||||||
|
|
||||||
save.zcount = 0;
|
save.zcount = 0;
|
||||||
|
DSWActor* actor = nullptr;
|
||||||
|
|
||||||
// Search Stat List For closest ceiling view sprite
|
// Search Stat List For closest ceiling view sprite
|
||||||
// Get the match, xoff, yoff from this point
|
// Get the match, xoff, yoff from this point
|
||||||
SWStatIterator it(STAT_FAF);
|
SWStatIterator it(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.hitag == VIEW_THRU_CEILING && actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->hitag == VIEW_THRU_CEILING && sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
xoff = *x - sp->pos.X;
|
xoff = *x - actor->spr.pos.X;
|
||||||
yoff = *y - sp->pos.Y;
|
yoff = *y - actor->spr.pos.Y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it.Reset(STAT_FAF);
|
it.Reset(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
// determine x,y position
|
// determine x,y position
|
||||||
if (sp->hitag == VIEW_THRU_FLOOR)
|
if (actor->spr.hitag == VIEW_THRU_FLOOR)
|
||||||
{
|
{
|
||||||
sectortype* upper,* lower;
|
sectortype* upper,* lower;
|
||||||
|
|
||||||
*x = sp->pos.X + xoff;
|
*x = actor->spr.pos.X + xoff;
|
||||||
*y = sp->pos.Y + yoff;
|
*y = actor->spr.pos.Y + yoff;
|
||||||
|
|
||||||
// get new sector
|
// get new sector
|
||||||
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
||||||
|
@ -732,7 +720,7 @@ bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
if (*sect == nullptr)
|
if (*sect == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sp || sp->hitag != VIEW_THRU_FLOOR)
|
if (!actor || actor->spr.hitag != VIEW_THRU_FLOOR)
|
||||||
{
|
{
|
||||||
*sect = nullptr;
|
*sect = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
@ -741,30 +729,28 @@ bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
|
|
||||||
if (!testnewrenderer)
|
if (!testnewrenderer)
|
||||||
{
|
{
|
||||||
pix_diff = labs(z - sp->sector()->floorz) >> 8;
|
pix_diff = labs(z - actor->spr.sector()->floorz) >> 8;
|
||||||
newz = sp->sector()->floorz + ((pix_diff / 128) + 1) * Z(128);
|
newz = actor->spr.sector()->floorz + ((pix_diff / 128) + 1) * Z(128);
|
||||||
|
|
||||||
it.Reset(STAT_FAF);
|
it.Reset(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
// move lower levels ceilings up for the correct view
|
// move lower levels ceilings up for the correct view
|
||||||
if (sp->hitag == VIEW_LEVEL2)
|
if (actor->spr.hitag == VIEW_LEVEL2)
|
||||||
{
|
{
|
||||||
// save it off
|
// save it off
|
||||||
save.sect[save.zcount] = sp->sector();
|
save.sect[save.zcount] = actor->spr.sector();
|
||||||
save.zval[save.zcount] = sp->sector()->floorz;
|
save.zval[save.zcount] = actor->spr.sector()->floorz;
|
||||||
save.pic[save.zcount] = sp->sector()->floorpicnum;
|
save.pic[save.zcount] = actor->spr.sector()->floorpicnum;
|
||||||
save.slope[save.zcount] = sp->sector()->floorheinum;
|
save.slope[save.zcount] = actor->spr.sector()->floorheinum;
|
||||||
|
|
||||||
sp->sector()->floorz = newz;
|
actor->spr.sector()->floorz = newz;
|
||||||
// don't change FAF_MIRROR_PIC - ConnectArea
|
// don't change FAF_MIRROR_PIC - ConnectArea
|
||||||
if (sp->sector()->floorpicnum != FAF_MIRROR_PIC)
|
if (actor->spr.sector()->floorpicnum != FAF_MIRROR_PIC)
|
||||||
sp->sector()->floorpicnum = FAF_MIRROR_PIC + 1;
|
actor->spr.sector()->floorpicnum = FAF_MIRROR_PIC + 1;
|
||||||
sp->sector()->setfloorslope(0);
|
actor->spr.sector()->setfloorslope(0);
|
||||||
|
|
||||||
save.zcount++;
|
save.zcount++;
|
||||||
PRODUCTION_ASSERT(save.zcount < ZMAX);
|
PRODUCTION_ASSERT(save.zcount < ZMAX);
|
||||||
|
@ -772,7 +758,6 @@ bool FindCeilingView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,42 +765,38 @@ bool FindFloorView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
{
|
{
|
||||||
int xoff = 0;
|
int xoff = 0;
|
||||||
int yoff = 0;
|
int yoff = 0;
|
||||||
SPRITEp sp = nullptr;
|
|
||||||
int newz;
|
int newz;
|
||||||
int pix_diff;
|
int pix_diff;
|
||||||
|
|
||||||
save.zcount = 0;
|
save.zcount = 0;
|
||||||
|
DSWActor* actor = nullptr;
|
||||||
|
|
||||||
// Search Stat List For closest ceiling view sprite
|
// Search Stat List For closest ceiling view sprite
|
||||||
// Get the match, xoff, yoff from this point
|
// Get the match, xoff, yoff from this point
|
||||||
SWStatIterator it(STAT_FAF);
|
SWStatIterator it(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.hitag == VIEW_THRU_FLOOR && actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->hitag == VIEW_THRU_FLOOR && sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
xoff = *x - sp->pos.X;
|
xoff = *x - actor->spr.pos.X;
|
||||||
yoff = *y - sp->pos.Y;
|
yoff = *y - actor->spr.pos.Y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
it.Reset(STAT_FAF);
|
it.Reset(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
// determine x,y position
|
// determine x,y position
|
||||||
if (sp->hitag == VIEW_THRU_CEILING)
|
if (actor->spr.hitag == VIEW_THRU_CEILING)
|
||||||
{
|
{
|
||||||
sectortype* upper,* lower;
|
sectortype* upper,* lower;
|
||||||
|
|
||||||
*x = sp->pos.X + xoff;
|
*x = actor->spr.pos.X + xoff;
|
||||||
*y = sp->pos.Y + yoff;
|
*y = actor->spr.pos.Y + yoff;
|
||||||
|
|
||||||
// get new sector
|
// get new sector
|
||||||
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
GetUpperLowerSector(match, *x, *y, &upper, &lower);
|
||||||
|
@ -828,7 +809,7 @@ bool FindFloorView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
if (*sect == nullptr)
|
if (*sect == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sp || sp->hitag != VIEW_THRU_CEILING)
|
if (!actor || actor->spr.hitag != VIEW_THRU_CEILING)
|
||||||
{
|
{
|
||||||
*sect = nullptr;
|
*sect = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
@ -837,31 +818,29 @@ bool FindFloorView(int match, int* x, int* y, int z, sectortype** sect)
|
||||||
if (!testnewrenderer)
|
if (!testnewrenderer)
|
||||||
{
|
{
|
||||||
// move ceiling multiple of 128 so that the wall tile will line up
|
// move ceiling multiple of 128 so that the wall tile will line up
|
||||||
pix_diff = labs(z - sp->sector()->ceilingz) >> 8;
|
pix_diff = labs(z - actor->spr.sector()->ceilingz) >> 8;
|
||||||
newz = sp->sector()->ceilingz - ((pix_diff / 128) + 1) * Z(128);
|
newz = actor->spr.sector()->ceilingz - ((pix_diff / 128) + 1) * Z(128);
|
||||||
|
|
||||||
it.Reset(STAT_FAF);
|
it.Reset(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.lotag == match)
|
||||||
|
|
||||||
if (sp->lotag == match)
|
|
||||||
{
|
{
|
||||||
// move upper levels floors down for the correct view
|
// move upper levels floors down for the correct view
|
||||||
if (sp->hitag == VIEW_LEVEL1)
|
if (actor->spr.hitag == VIEW_LEVEL1)
|
||||||
{
|
{
|
||||||
// save it off
|
// save it off
|
||||||
save.sect[save.zcount] = sp->sector();
|
save.sect[save.zcount] = actor->spr.sector();
|
||||||
save.zval[save.zcount] = sp->sector()->ceilingz;
|
save.zval[save.zcount] = actor->spr.sector()->ceilingz;
|
||||||
save.pic[save.zcount] = sp->sector()->ceilingpicnum;
|
save.pic[save.zcount] = actor->spr.sector()->ceilingpicnum;
|
||||||
save.slope[save.zcount] = sp->sector()->ceilingheinum;
|
save.slope[save.zcount] = actor->spr.sector()->ceilingheinum;
|
||||||
|
|
||||||
sp->sector()->ceilingz = newz;
|
actor->spr.sector()->ceilingz = newz;
|
||||||
|
|
||||||
// don't change FAF_MIRROR_PIC - ConnectArea
|
// don't change FAF_MIRROR_PIC - ConnectArea
|
||||||
if (sp->sector()->ceilingpicnum != FAF_MIRROR_PIC)
|
if (actor->spr.sector()->ceilingpicnum != FAF_MIRROR_PIC)
|
||||||
sp->sector()->ceilingpicnum = FAF_MIRROR_PIC + 1;
|
actor->spr.sector()->ceilingpicnum = FAF_MIRROR_PIC + 1;
|
||||||
sp->sector()->setceilingslope(0);
|
actor->spr.sector()->setceilingslope(0);
|
||||||
|
|
||||||
save.zcount++;
|
save.zcount++;
|
||||||
PRODUCTION_ASSERT(save.zcount < ZMAX);
|
PRODUCTION_ASSERT(save.zcount < ZMAX);
|
||||||
|
@ -880,20 +859,18 @@ short FindViewSectorInScene(sectortype* cursect, short level)
|
||||||
SWStatIterator it(STAT_FAF);
|
SWStatIterator it(STAT_FAF);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &actor->s();
|
if (actor->spr.hitag == level)
|
||||||
|
|
||||||
if (sp->hitag == level)
|
|
||||||
{
|
{
|
||||||
if (cursect == sp->sector())
|
if (cursect == actor->spr.sector())
|
||||||
{
|
{
|
||||||
// ignore case if sprite is pointing up
|
// ignore case if sprite is pointing up
|
||||||
if (sp->ang == 1536)
|
if (actor->spr.ang == 1536)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// only gets to here is sprite is pointing down
|
// only gets to here is sprite is pointing down
|
||||||
|
|
||||||
// found a potential match
|
// found a potential match
|
||||||
match = sp->lotag;
|
match = actor->spr.lotag;
|
||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue