mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- added portal support to A_ThrustImpale, P_PushUp and P_PushDown.
This commit is contained in:
parent
5175d56129
commit
7d7112f427
3 changed files with 35 additions and 26 deletions
|
@ -813,12 +813,6 @@ public:
|
||||||
return bloodcls;
|
return bloodcls;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects(AActor *other) const
|
|
||||||
{
|
|
||||||
fixed_t blockdist = radius + other->radius;
|
|
||||||
return ( abs(X() - other->X()) < blockdist && abs(Y() - other->Y()) < blockdist);
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed_t AproxDistance(fixed_t otherx, fixed_t othery)
|
fixed_t AproxDistance(fixed_t otherx, fixed_t othery)
|
||||||
{
|
{
|
||||||
return P_AproxDistance(X() - otherx, Y() - othery);
|
return P_AproxDistance(X() - otherx, Y() - othery);
|
||||||
|
|
|
@ -153,24 +153,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
|
||||||
AActor *thing;
|
|
||||||
// This doesn't need to iterate through portals.
|
// This doesn't need to iterate through portals.
|
||||||
FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), self->radius));
|
|
||||||
while ((thing = it.Next()))
|
FPortalGroupArray check;
|
||||||
|
FMultiBlockThingsIterator it(check, self);
|
||||||
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
while (it.Next(&cres))
|
||||||
{
|
{
|
||||||
if (!thing->intersects(self))
|
fixed_t blockdist = self->radius + cres.thing->radius;
|
||||||
{
|
if (abs(self->X() - cres.position.x) >= blockdist || abs(self->Y() - cres.position.y) >= blockdist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Q: Make this z-aware for everything? It never was before.
|
||||||
|
if (cres.thing->Top() < self->Z() || cres.thing->Z() > self->Top())
|
||||||
|
{
|
||||||
|
if (self->Sector->PortalGroup != cres.thing->Sector->PortalGroup)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(thing->flags & MF_SHOOTABLE) )
|
if (!(cres.thing->flags & MF_SHOOTABLE) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (thing == self)
|
if (cres.thing == self)
|
||||||
continue; // don't clip against self
|
continue; // don't clip against self
|
||||||
|
|
||||||
int newdam = P_DamageMobj (thing, self, self, 10001, NAME_Crush);
|
int newdam = P_DamageMobj (cres.thing, self, self, 10001, NAME_Crush);
|
||||||
P_TraceBleed (newdam > 0 ? newdam : 10001, thing);
|
P_TraceBleed (newdam > 0 ? newdam : 10001, cres.thing);
|
||||||
self->args[1] = 1; // Mark thrust thing as bloody
|
self->args[1] = 1; // Mark thrust thing as bloody
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -5513,14 +5513,16 @@ void P_FindAboveIntersectors(AActor *actor)
|
||||||
if (!(actor->flags & MF_SOLID))
|
if (!(actor->flags & MF_SOLID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AActor *thing;
|
FPortalGroupArray check;
|
||||||
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
|
FMultiBlockThingsIterator it(check, actor);
|
||||||
while ((thing = it.Next()))
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
while (it.Next(&cres))
|
||||||
{
|
{
|
||||||
if (!thing->intersects(actor))
|
AActor *thing = cres.thing;
|
||||||
{
|
fixed_t blockdist = actor->radius + thing->radius;
|
||||||
|
if (abs(actor->X() - cres.position.x) >= blockdist || abs(actor->Y() - cres.position.y) >= blockdist)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (!(thing->flags & MF_SOLID))
|
if (!(thing->flags & MF_SOLID))
|
||||||
{ // Can't hit thing
|
{ // Can't hit thing
|
||||||
continue;
|
continue;
|
||||||
|
@ -5568,13 +5570,16 @@ void P_FindBelowIntersectors(AActor *actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AActor *thing;
|
AActor *thing;
|
||||||
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
|
FPortalGroupArray check;
|
||||||
while ((thing = it.Next()))
|
FMultiBlockThingsIterator it(check, actor);
|
||||||
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
while (it.Next(&cres))
|
||||||
{
|
{
|
||||||
if (!thing->intersects(actor))
|
AActor *thing = cres.thing;
|
||||||
{
|
fixed_t blockdist = actor->radius + thing->radius;
|
||||||
|
if (abs(actor->X() - cres.position.x) >= blockdist || abs(actor->Y() - cres.position.y) >= blockdist)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (!(thing->flags & MF_SOLID))
|
if (!(thing->flags & MF_SOLID))
|
||||||
{ // Can't hit thing
|
{ // Can't hit thing
|
||||||
continue;
|
continue;
|
||||||
|
@ -5718,6 +5723,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thing->CheckPortalTransition(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5765,6 +5771,7 @@ int P_PushDown(AActor *thing, FChangePosition *cpos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thing->CheckPortalTransition(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue