mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Duke/RR: better handling for one random kill scenario in the player movement code.
Using the same appoach as EDuke32 - instead of outright killing the player it will first reset its position and retry the pushmove check.
This commit is contained in:
parent
9f6d6a0e6d
commit
5ff7d45f7f
2 changed files with 29 additions and 17 deletions
|
@ -2842,6 +2842,7 @@ void processinput_d(int snum)
|
|||
|
||||
checklook(snum,actions);
|
||||
int ii = 40;
|
||||
auto oldpos = p->opos;
|
||||
|
||||
if (p->on_crane != nullptr)
|
||||
goto HORIZONLY;
|
||||
|
@ -3072,25 +3073,31 @@ HORIZONLY:
|
|||
if (p->cursector != pact->sector())
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
|
||||
if (ud.clipping == 0)
|
||||
j = (pushmove(&p->pos, &p->cursector, 164L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
else j = 0;
|
||||
|
||||
if (ud.clipping == 0)
|
||||
int retry = 0;
|
||||
while (ud.clipping == 0)
|
||||
{
|
||||
if (abs(pact->floorz - pact->ceilingz) < (48 << 8) || j)
|
||||
int blocked;
|
||||
blocked = (pushmove(&p->pos, &p->cursector, 164, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
|
||||
if (abs(pact->floorz - pact->ceilingz) < (48 << 8) || blocked)
|
||||
{
|
||||
if (!(pact->sector()->lotag & 0x8000) && (isanunderoperator(pact->sector()->lotag) ||
|
||||
isanearoperator(pact->sector()->lotag)))
|
||||
fi.activatebysector(pact->sector(), pact);
|
||||
if (j)
|
||||
if (blocked)
|
||||
{
|
||||
if (!retry++)
|
||||
{
|
||||
p->pos = p->opos = oldpos;
|
||||
continue;
|
||||
}
|
||||
quickkill(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (abs(fz - cz) < (32 << 8) && isanunderoperator(psectp->lotag))
|
||||
fi.activatebysector(psectp, pact);
|
||||
break;
|
||||
}
|
||||
|
||||
// center_view
|
||||
|
|
|
@ -3558,6 +3558,8 @@ void processinput_r(int snum)
|
|||
checklook(snum, actions);
|
||||
p->apply_seasick(1);
|
||||
|
||||
auto oldpos = p->opos;
|
||||
|
||||
if (p->on_crane != nullptr)
|
||||
goto HORIZONLY;
|
||||
|
||||
|
@ -3912,31 +3914,34 @@ HORIZONLY:
|
|||
if (p->cursector != pact->sector())
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
|
||||
int j;
|
||||
if (ud.clipping == 0)
|
||||
int retry = 0;
|
||||
while (ud.clipping == 0)
|
||||
{
|
||||
int blocked;
|
||||
if (pact->spr.clipdist == 64)
|
||||
j = (pushmove(&p->pos, &p->cursector, 128L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
blocked = (pushmove(&p->pos, &p->cursector, 128, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
else
|
||||
j = (pushmove(&p->pos, &p->cursector, 16L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
}
|
||||
else j = 0;
|
||||
blocked = (pushmove(&p->pos, &p->cursector, 16, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
|
||||
if (ud.clipping == 0)
|
||||
{
|
||||
if (abs(pact->floorz - pact->ceilingz) < (48 << 8) || j)
|
||||
if (abs(pact->floorz - pact->ceilingz) < (48 << 8) || blocked)
|
||||
{
|
||||
if (!(pact->sector()->lotag & 0x8000) && (isanunderoperator(pact->sector()->lotag) ||
|
||||
isanearoperator(pact->sector()->lotag)))
|
||||
fi.activatebysector(pact->sector(), pact);
|
||||
if (j)
|
||||
if (blocked)
|
||||
{
|
||||
if (!retry++)
|
||||
{
|
||||
p->pos = p->opos = oldpos;
|
||||
continue;
|
||||
}
|
||||
quickkill(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (abs(fz - cz) < (32 << 8) && isanunderoperator(psectp->lotag))
|
||||
fi.activatebysector(psectp, pact);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ud.clipping == 0 && p->cursector->ceilingz > (p->cursector->floorz - (12 << 8)))
|
||||
|
|
Loading…
Reference in a new issue