- consolidated Duke’s ‚away from wall‘ check in the backend

This was also very useful in SW to avoid spawning ‚floating‘ footprints due to lack of an equivalent check in the original.
This commit is contained in:
Christoph Oelckers 2022-09-13 19:40:32 +02:00
parent 1a597c4e0b
commit 3c9a94dba8
5 changed files with 42 additions and 58 deletions

View file

@ -560,6 +560,35 @@ sectortype* nextsectorneighborzptr(sectortype* sectp, double startz, int flags)
return bestsec;
}
//==========================================================================
//
//
//
//==========================================================================
bool isAwayFromWall(DCoreActor* ac, double delta)
{
sectortype* s1;
updatesector(ac->spr.pos + DVector2(delta, delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos - DVector2(delta, delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos + DVector2(delta, -delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos + DVector2(-delta, delta), &s1);
if (s1 == ac->sector())
return true;
}
}
}
return false;
}
//==========================================================================
//
//

View file

@ -350,7 +350,7 @@ enum EFindNextSector
Find_FloorDown = Find_Floor | Find_Down,
};
sectortype* nextsectorneighborzptr(sectortype* sectp, double startz, int flags);
bool isAwayFromWall(DCoreActor* ac, double delta);
inline double WallStartX(int wallnum)

View file

@ -2801,23 +2801,7 @@ int ParseState::parse(void)
{
auto s1 = g_ac->sector();
j = 0;
updatesector(g_ac->int_pos().X + 108, g_ac->int_pos().Y + 108, &s1);
if (s1 == g_ac->sector())
{
updatesector(g_ac->int_pos().X - 108, g_ac->int_pos().Y - 108, &s1);
if (s1 == g_ac->sector())
{
updatesector(g_ac->int_pos().X + 108, g_ac->int_pos().Y - 108, &s1);
if (s1 == g_ac->sector())
{
updatesector(g_ac->int_pos().X - 108, g_ac->int_pos().Y + 108, &s1);
if (s1 == g_ac->sector())
j = 1;
}
}
}
j = isAwayFromWall(g_ac, 6.75);
parseifelse(j);
break;
}

View file

@ -340,28 +340,12 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam)
int spawnbloodpoolpart1(DDukeActor* act)
{
auto s1 = act->sector();
updatesector(act->int_pos().X + 108, act->int_pos().Y + 108, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
bool away = isAwayFromWall(act, 6.75);
if (!away)
{
updatesector(act->int_pos().X - 108, act->int_pos().Y - 108, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
{
updatesector(act->int_pos().X + 108, act->int_pos().Y - 108, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
{
updatesector(act->int_pos().X - 108, act->int_pos().Y + 108, &s1);
if (s1 && s1->floorz != act->sector()->floorz)
{
act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return true;
}
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return true; }
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return true; }
act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return true;
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return true; }
if (act->sector()->lotag == 1)
{
@ -382,28 +366,12 @@ void initfootprint(DDukeActor* actj, DDukeActor* act)
auto sect = act->sector();
if (actj)
{
auto s1 = act->sector();
updatesector(act->int_pos().X + 84, act->int_pos().Y + 84, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
bool away = isAwayFromWall(act, 5.25);
if (!away)
{
updatesector(act->int_pos().X - 84, act->int_pos().Y - 84, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
{
updatesector(act->int_pos().X + 84, act->int_pos().Y - 84, &s1);
if (s1 && s1->floorz == act->sector()->floorz)
{
updatesector(act->int_pos().X - 84, act->int_pos().Y + 84, &s1);
if (s1 && s1->floorz != act->sector()->floorz)
{
act->spr.xrepeat = act->spr.yrepeat = 0; ChangeActorStat(act, STAT_MISC); return;
}
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; return; }
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; return; }
act->spr.xrepeat = act->spr.yrepeat = 0;
return;
}
else { act->spr.xrepeat = act->spr.yrepeat = 0; return; }
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR;
if ((ps[actj->PlayerIndex()].footprintcount & 1)) act->spr.cstat |= CSTAT_SPRITE_XFLIP;

View file

@ -18124,6 +18124,9 @@ int QueueFootPrint(DSWActor* actor)
if (TestDontStickSector(actor->sector()))
return -1; // Not on special sectors you don't
if (!isAwayFromWall(actor, 5.25))
return -1; // not if it goes ouzside the sector
// So, are we like, done checking now!?
if (FloorBloodQueue[FloorBloodQueueHead] != nullptr)