- neartag cleanup in checksectors.

This commit is contained in:
Christoph Oelckers 2021-11-18 18:04:17 +01:00
parent 3d05020f4c
commit a9aadfd63d
3 changed files with 26 additions and 21 deletions

View file

@ -193,6 +193,10 @@ inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
p->horizon.calcviewpitch(p->pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust);
}
inline DDukeActor* EGS(sectortype* whatsect, int s_x, int s_y, int s_z, int s_pn, int8_t s_s, int8_t s_xr, int8_t s_yr, int s_a, int s_ve, int s_zv, DDukeActor* s_ow, int8_t s_ss)
{
return EGS(sectnum(whatsect), s_x, s_y, s_z, s_pn, s_s, s_xr, s_yr, s_a, s_ve, s_zv, s_ow, s_ss);
}
//---------------------------------------------------------------------------
//

View file

@ -1645,15 +1645,16 @@ void checksectors_d(int snum)
}
}
auto ntwall = neartagwall < 0? nullptr : &wall[neartagwall];
auto ntsector = neartagsector < 0 ? nullptr : &sector[neartagsector];
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr)
if (isanunderoperator(p->GetActor()->getSector()->lotag))
neartagsector = p->GetActor()->s->sectnum;
ntsector = p->GetActor()->s->sector();
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384))
if (ntsector && (ntsector->lotag & 16384))
return;
if (neartagsprite == nullptr && neartagwall == -1)
if (neartagsprite == nullptr && ntwall == nullptr)
if (p->cursector()->lotag == 2)
{
DDukeActor* hit;
@ -1769,7 +1770,7 @@ void checksectors_d(int snum)
return;
}
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == nullptr)
if (ntwall == nullptr && ntsector == nullptr && neartagsprite == nullptr)
if (abs(hits(p->GetActor())) < 512)
{
if ((krand() & 255) < 16)
@ -1778,7 +1779,7 @@ void checksectors_d(int snum)
return;
}
if (neartagwall >= 0)
if (ntwall)
{
if (ntwall->lotag > 0 && fi.isadoorwall(ntwall->picnum))
{
@ -1793,15 +1794,15 @@ void checksectors_d(int snum)
}
}
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384) == 0 && isanearoperator(sector[neartagsector].lotag))
if (ntsector && (ntsector->lotag & 16384) == 0 && isanearoperator(ntsector->lotag))
{
DukeSectIterator it(neartagsector);
DukeSectIterator it(ntsector);
while (auto act = it.Next())
{
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
operatesectors(neartagsector, p->GetActor());
operatesectors(sectnum(ntsector), p->GetActor());
}
else if ((p->GetActor()->getSector()->lotag & 16384) == 0)
{

View file

@ -2595,17 +2595,17 @@ void checksectors_r(int snum)
}
}
auto ntwall = neartagwall < 0? nullptr : &wall[neartagwall];
auto ntsector = neartagsector < 0 ? nullptr : &sector[neartagsector];
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr)
if (isanunderoperator(p->GetActor()->getSector()->lotag))
neartagsector = p->GetActor()->s->sectnum;
ntsector = p->GetActor()->s->sector();
auto ntsect = neartagsector < 0? nullptr : &sector[neartagsector];
if (neartagsector >= 0 && (ntsect->lotag & 16384))
if (ntsector && (ntsector->lotag & 16384))
return;
if (neartagsprite == nullptr && neartagwall == -1)
if (neartagsprite == nullptr && ntwall == nullptr)
if (p->cursector()->lotag == 2)
{
DDukeActor* hit;
@ -2720,7 +2720,7 @@ void checksectors_r(int snum)
if (!PlayerInput(snum, SB_OPEN)) return;
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == nullptr)
if (ntwall == nullptr && ntsector == nullptr && neartagsprite == nullptr)
if (abs(hits(p->GetActor())) < 512)
{
if ((krand() & 255) < 16)
@ -2729,7 +2729,7 @@ void checksectors_r(int snum)
return;
}
if (neartagwall >= 0)
if (ntwall != nullptr)
{
if (ntwall->lotag > 0 && fi.isadoorwall(ntwall->picnum))
{
@ -2739,16 +2739,16 @@ void checksectors_r(int snum)
}
}
if (neartagsector >= 0 && (ntsect->lotag & 16384) == 0 && isanearoperator(ntsect->lotag))
if (ntsector && (ntsector->lotag & 16384) == 0 && isanearoperator(ntsector->lotag))
{
DukeSectIterator it(neartagsector);
DukeSectIterator it(ntsector);
while (auto act = it.Next())
{
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(neartagsector, snum))
operatesectors(neartagsector, p->GetActor());
if (haskey(sectnum(ntsector), snum))
operatesectors(sectnum(ntsector), p->GetActor());
else
{
if (neartagsprite && neartagsprite->spriteextra > 3)
@ -2768,7 +2768,7 @@ void checksectors_r(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(neartagsector, snum))
if (haskey(sectnum(ntsector), snum))
operatesectors(p->GetActor()->s->sectnum, p->GetActor());
else
{