Merge branch 'master' into float
# Conflicts: # src/g_heretic/a_hereticweaps.cpp # src/p_map.cpp # src/p_mobj.cpp # src/p_things.cpp # src/portal.cpp
This commit is contained in:
commit
c64eee5b15
104 changed files with 1206 additions and 1073 deletions
132
src/p_map.cpp
132
src/p_map.cpp
|
|
@ -291,7 +291,7 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
|
|||
sector_t *sec = (!(flags & FFCF_SAMESECTOR) || tmf.thing->Sector == NULL)? P_PointInSector(tmf.x, tmf.y) : tmf.sector;
|
||||
F3DFloor *ffc, *fff;
|
||||
|
||||
tmf.ceilingz = sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z + tmf.thing->height, flags, &tmf.ceilingsector, &ffc);
|
||||
tmf.ceilingz = sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->height, flags, &tmf.ceilingsector, &ffc);
|
||||
tmf.floorz = tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff);
|
||||
|
||||
if (fff)
|
||||
|
|
@ -739,7 +739,7 @@ int P_GetMoveFactor(const AActor *mo, int *frictionp)
|
|||
// phares 3/11/98: you start off slowly, then increase as
|
||||
// you get better footing
|
||||
|
||||
int velocity = P_AproxDistance(mo->velx, mo->vely);
|
||||
int velocity = P_AproxDistance(mo->vel.x, mo->vel.y);
|
||||
|
||||
if (velocity > MORE_FRICTION_VELOCITY << 2)
|
||||
movefactor <<= 3;
|
||||
|
|
@ -998,7 +998,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
spec.oldrefpos = tm.thing->PosRelative(ld);
|
||||
spechit.Push(spec);
|
||||
}
|
||||
if (ld->portalindex != UINT_MAX)
|
||||
if (ld->isLinePortal())
|
||||
{
|
||||
spec.line = ld;
|
||||
spec.refpos = cres.position;
|
||||
|
|
@ -1359,9 +1359,9 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
|||
if (!(thing->flags2 & MF2_BOSS) && (thing->flags3 & MF3_ISMONSTER) && !(thing->flags3 & MF3_DONTBLAST))
|
||||
{
|
||||
// ideally this should take the mass factor into account
|
||||
thing->velx += tm.thing->velx;
|
||||
thing->vely += tm.thing->vely;
|
||||
if ((thing->velx + thing->vely) > 3 * FRACUNIT)
|
||||
thing->vel.x += tm.thing->vel.x;
|
||||
thing->vel.y += tm.thing->vel.y;
|
||||
if ((thing->vel.x + thing->vel.y) > 3 * FRACUNIT)
|
||||
{
|
||||
int newdam;
|
||||
damage = (tm.thing->Mass / 100) + 1;
|
||||
|
|
@ -1497,8 +1497,8 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
|||
{ // Push thing
|
||||
if (thing->lastpush != tm.PushTime)
|
||||
{
|
||||
thing->velx += FixedMul(tm.thing->velx, thing->pushfactor);
|
||||
thing->vely += FixedMul(tm.thing->vely, thing->pushfactor);
|
||||
thing->vel.x += FixedMul(tm.thing->vel.x, thing->pushfactor);
|
||||
thing->vel.y += FixedMul(tm.thing->vel.y, thing->pushfactor);
|
||||
thing->lastpush = tm.PushTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -1556,8 +1556,8 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
|
|||
{ // Push thing
|
||||
if (thing->lastpush != tm.PushTime)
|
||||
{
|
||||
thing->velx += FixedMul(tm.thing->velx, thing->pushfactor);
|
||||
thing->vely += FixedMul(tm.thing->vely, thing->pushfactor);
|
||||
thing->vel.x += FixedMul(tm.thing->vel.x, thing->pushfactor);
|
||||
thing->vel.y += FixedMul(tm.thing->vel.y, thing->pushfactor);
|
||||
thing->lastpush = tm.PushTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -1939,7 +1939,7 @@ void P_FakeZMovement(AActor *mo)
|
|||
//
|
||||
// adjust height
|
||||
//
|
||||
mo->AddZ(mo->velz);
|
||||
mo->AddZ(mo->vel.z);
|
||||
if ((mo->flags&MF_FLOAT) && mo->target)
|
||||
{ // float down towards target if too close
|
||||
if (!(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT))
|
||||
|
|
@ -2128,12 +2128,12 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
// is not blocked.
|
||||
if (thing->Top() > tm.ceilingz)
|
||||
{
|
||||
thing->velz = -8 * FRACUNIT;
|
||||
thing->vel.z = -8 * FRACUNIT;
|
||||
goto pushline;
|
||||
}
|
||||
else if (thing->Z() < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight)
|
||||
{
|
||||
thing->velz = 8 * FRACUNIT;
|
||||
thing->vel.z = 8 * FRACUNIT;
|
||||
goto pushline;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2163,7 +2163,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
thing->SetZ(tm.floorz);
|
||||
// If moving down, cancel vertical component of the velocity
|
||||
if (thing->velz < 0)
|
||||
if (thing->vel.z < 0)
|
||||
{
|
||||
// If it's a bouncer, let it bounce off its new floor, too.
|
||||
if (thing->BounceFlags & BOUNCE_Floors)
|
||||
|
|
@ -2172,7 +2172,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
}
|
||||
else
|
||||
{
|
||||
thing->velz = 0;
|
||||
thing->vel.z = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2244,8 +2244,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
thing->player->Bot->prev = thing->player->Bot->dest;
|
||||
thing->player->Bot->dest = NULL;
|
||||
thing->velx = 0;
|
||||
thing->vely = 0;
|
||||
thing->vel.x = 0;
|
||||
thing->vel.y = 0;
|
||||
thing->SetZ(oldz);
|
||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||
return false;
|
||||
|
|
@ -2288,9 +2288,12 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
fixed_t bestfrac = FIXED_MAX;
|
||||
spechit_t besthit;
|
||||
int besthitnum;
|
||||
// find the portal nearest to the crossing actor
|
||||
for (auto &spec : portalhit)
|
||||
for (unsigned i = 0; i < portalhit.Size();i++)
|
||||
{
|
||||
auto &spec = portalhit[i];
|
||||
|
||||
line_t *ld = spec.line;
|
||||
if (ld->frontsector->PortalGroup != thing->Sector->PortalGroup) continue; // must be in the same group to be considered valid.
|
||||
|
||||
|
|
@ -2306,12 +2309,14 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
{
|
||||
besthit = spec;
|
||||
bestfrac = frac;
|
||||
besthitnum = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestfrac < FIXED_MAX)
|
||||
{
|
||||
portalhit.Delete(besthitnum);
|
||||
line_t *ld = besthit.line;
|
||||
FLinePortal *port = ld->getPortal();
|
||||
if (port->mType == PORTT_LINKED)
|
||||
|
|
@ -2342,7 +2347,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
}
|
||||
thing->UnlinkFromWorld();
|
||||
thing->SetXYZ(pos);
|
||||
P_TranslatePortalVXVY(ld, thing->velx, thing->vely);
|
||||
P_TranslatePortalVXVY(ld, thing->vel.x, thing->vel.y);
|
||||
P_TranslatePortalAngle(ld, thing->angle);
|
||||
thing->LinkToWorld();
|
||||
P_FindFloorCeiling(thing);
|
||||
|
|
@ -2371,7 +2376,10 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
|
|||
}
|
||||
R_AddInterpolationPoint(hit);
|
||||
}
|
||||
if (port->mType == PORTT_LINKED) continue;
|
||||
if (port->mType == PORTT_LINKED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -2891,7 +2899,7 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t
|
|||
//
|
||||
// P_SlideMove
|
||||
//
|
||||
// The velx / vely move is bad, so try to slide along a wall.
|
||||
// The vel.x / vel.y move is bad, so try to slide along a wall.
|
||||
//
|
||||
// Find the first line hit, move flush to it, and slide along it
|
||||
//
|
||||
|
|
@ -2972,14 +2980,14 @@ retry:
|
|||
newy = FixedMul(tryy, bestslidefrac);
|
||||
|
||||
// [BL] We need to abandon this function if we end up going through a teleporter
|
||||
const fixed_t startvelx = mo->velx;
|
||||
const fixed_t startvely = mo->vely;
|
||||
const fixed_t startvelx = mo->vel.x;
|
||||
const fixed_t startvely = mo->vel.y;
|
||||
|
||||
// killough 3/15/98: Allow objects to drop off ledges
|
||||
if (!P_TryMove(mo, mo->X() + newx, mo->Y() + newy, true))
|
||||
goto stairstep;
|
||||
|
||||
if (mo->velx != startvelx || mo->vely != startvely)
|
||||
if (mo->vel.x != startvelx || mo->vel.y != startvely)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2995,16 +3003,16 @@ retry:
|
|||
|
||||
HitSlideLine(bestslideline); // clip the moves
|
||||
|
||||
mo->velx = tmxmove * numsteps;
|
||||
mo->vely = tmymove * numsteps;
|
||||
mo->vel.x = tmxmove * numsteps;
|
||||
mo->vel.y = tmymove * numsteps;
|
||||
|
||||
// killough 10/98: affect the bobbing the same way (but not voodoo dolls)
|
||||
if (mo->player && mo->player->mo == mo)
|
||||
{
|
||||
if (abs(mo->player->velx) > abs(mo->velx))
|
||||
mo->player->velx = mo->velx;
|
||||
if (abs(mo->player->vely) > abs(mo->vely))
|
||||
mo->player->vely = mo->vely;
|
||||
if (abs(mo->player->vel.x) > abs(mo->vel.x))
|
||||
mo->player->vel.x = mo->vel.x;
|
||||
if (abs(mo->player->vel.y) > abs(mo->vel.y))
|
||||
mo->player->vel.y = mo->vel.y;
|
||||
}
|
||||
|
||||
walkplane = P_CheckSlopeWalk(mo, tmxmove, tmymove);
|
||||
|
|
@ -3130,8 +3138,8 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
|
|||
}
|
||||
if (dopush)
|
||||
{
|
||||
xmove = actor->velx = plane->a * 2;
|
||||
ymove = actor->vely = plane->b * 2;
|
||||
xmove = actor->vel.x = plane->a * 2;
|
||||
ymove = actor->vel.y = plane->b * 2;
|
||||
}
|
||||
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
||||
}
|
||||
|
|
@ -3246,7 +3254,7 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
//
|
||||
// trace along the three leading corners
|
||||
//
|
||||
if (mo->velx > 0)
|
||||
if (mo->vel.x > 0)
|
||||
{
|
||||
leadx = mo->X() + mo->radius;
|
||||
}
|
||||
|
|
@ -3254,7 +3262,7 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
{
|
||||
leadx = mo->X() - mo->radius;
|
||||
}
|
||||
if (mo->vely > 0)
|
||||
if (mo->vel.y > 0)
|
||||
{
|
||||
leady = mo->Y() + mo->radius;
|
||||
}
|
||||
|
|
@ -3264,7 +3272,7 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
}
|
||||
bestslidefrac = FRACUNIT + 1;
|
||||
bestslideline = mo->BlockingLine;
|
||||
if (BounceTraverse(leadx, leady, leadx + mo->velx, leady + mo->vely) && mo->BlockingLine == NULL)
|
||||
if (BounceTraverse(leadx, leady, leadx + mo->vel.x, leady + mo->vel.y) && mo->BlockingLine == NULL)
|
||||
{ // Could not find a wall, so bounce off the floor/ceiling instead.
|
||||
fixed_t floordist = mo->Z() - mo->floorz;
|
||||
fixed_t ceildist = mo->ceilingz - mo->Z();
|
||||
|
|
@ -3304,13 +3312,13 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
{
|
||||
lineangle += ANG180;
|
||||
}
|
||||
moveangle = R_PointToAngle2(0, 0, mo->velx, mo->vely);
|
||||
moveangle = R_PointToAngle2(0, 0, mo->vel.x, mo->vel.y);
|
||||
deltaangle = (2 * lineangle) - moveangle;
|
||||
mo->angle = deltaangle;
|
||||
|
||||
deltaangle >>= ANGLETOFINESHIFT;
|
||||
|
||||
movelen = fixed_t(g_sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely));
|
||||
movelen = fixed_t(g_sqrt(double(mo->vel.x)*mo->vel.x + double(mo->vel.y)*mo->vel.y));
|
||||
movelen = FixedMul(movelen, mo->wallbouncefactor);
|
||||
|
||||
FBoundingBox box(mo->X(), mo->Y(), mo->radius);
|
||||
|
|
@ -3326,8 +3334,8 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
{
|
||||
movelen = 2 * FRACUNIT;
|
||||
}
|
||||
mo->velx = FixedMul(movelen, finecosine[deltaangle]);
|
||||
mo->vely = FixedMul(movelen, finesine[deltaangle]);
|
||||
mo->vel.x = FixedMul(movelen, finecosine[deltaangle]);
|
||||
mo->vel.y = FixedMul(movelen, finesine[deltaangle]);
|
||||
if (mo->BounceFlags & BOUNCE_UseBounceState)
|
||||
{
|
||||
FState *bouncestate = mo->FindState(NAME_Bounce, NAME_Wall);
|
||||
|
|
@ -3372,12 +3380,12 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
{
|
||||
fixed_t speed;
|
||||
angle_t angle = BlockingMobj->AngleTo(mo) + ANGLE_1*((pr_bounce() % 16) - 8);
|
||||
speed = P_AproxDistance(mo->velx, mo->vely);
|
||||
speed = P_AproxDistance(mo->vel.x, mo->vel.y);
|
||||
speed = FixedMul(speed, mo->wallbouncefactor); // [GZ] was 0.75, using wallbouncefactor seems more consistent
|
||||
mo->angle = angle;
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
mo->velx = FixedMul(speed, finecosine[angle]);
|
||||
mo->vely = FixedMul(speed, finesine[angle]);
|
||||
mo->vel.x = FixedMul(speed, finecosine[angle]);
|
||||
mo->vel.y = FixedMul(speed, finesine[angle]);
|
||||
mo->PlayBounceSound(true);
|
||||
if (mo->BounceFlags & BOUNCE_UseBounceState)
|
||||
{
|
||||
|
|
@ -3398,11 +3406,11 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
}
|
||||
else
|
||||
{
|
||||
fixed_t dot = mo->velz;
|
||||
fixed_t dot = mo->vel.z;
|
||||
|
||||
if (mo->BounceFlags & (BOUNCE_HereticType | BOUNCE_MBF))
|
||||
{
|
||||
mo->velz -= MulScale15(FRACUNIT, dot);
|
||||
mo->vel.z -= MulScale15(FRACUNIT, dot);
|
||||
if (!(mo->BounceFlags & BOUNCE_MBF)) // Heretic projectiles die, MBF projectiles don't.
|
||||
{
|
||||
mo->flags |= MF_INBOUNCE;
|
||||
|
|
@ -3412,24 +3420,24 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
}
|
||||
else
|
||||
{
|
||||
mo->velz = FixedMul(mo->velz, mo->bouncefactor);
|
||||
mo->vel.z = FixedMul(mo->vel.z, mo->bouncefactor);
|
||||
}
|
||||
}
|
||||
else // Don't run through this for MBF-style bounces
|
||||
{
|
||||
// The reflected velocity keeps only about 70% of its original speed
|
||||
mo->velz = FixedMul(mo->velz - MulScale15(FRACUNIT, dot), mo->bouncefactor);
|
||||
mo->vel.z = FixedMul(mo->vel.z - MulScale15(FRACUNIT, dot), mo->bouncefactor);
|
||||
}
|
||||
|
||||
mo->PlayBounceSound(true);
|
||||
if (mo->BounceFlags & BOUNCE_MBF) // Bring it to rest below a certain speed
|
||||
{
|
||||
if (abs(mo->velz) < (fixed_t)(mo->Mass * mo->GetGravity() / 64))
|
||||
mo->velz = 0;
|
||||
if (abs(mo->vel.z) < (fixed_t)(mo->Mass * mo->GetGravity() / 64))
|
||||
mo->vel.z = 0;
|
||||
}
|
||||
else if (mo->BounceFlags & (BOUNCE_AutoOff | BOUNCE_AutoOffFloorOnly))
|
||||
{
|
||||
if (!(mo->flags & MF_NOGRAVITY) && (mo->velz < 3 * FRACUNIT))
|
||||
if (!(mo->flags & MF_NOGRAVITY) && (mo->vel.z < 3 * FRACUNIT))
|
||||
mo->BounceFlags &= ~BOUNCE_TypeMask;
|
||||
}
|
||||
}
|
||||
|
|
@ -3786,7 +3794,7 @@ struct aim_t
|
|||
intercept_t *in;
|
||||
|
||||
if (aimdebug)
|
||||
Printf("Start AimTraverse, start = %f,%f,%f, vect = %f,%f,%f\n",
|
||||
Printf("Start AimTraverse, start = %f,%f,%f, vect = %f,%f\n",
|
||||
startpos.x / 65536., startpos.y / 65536., startpos.z / 65536.,
|
||||
aimtrace.x / 65536., aimtrace.y / 65536.);
|
||||
|
||||
|
|
@ -4586,11 +4594,11 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile)
|
|||
return;
|
||||
}
|
||||
|
||||
if (missile->velz != 0)
|
||||
if (missile->vel.z != 0)
|
||||
{
|
||||
double aim;
|
||||
|
||||
aim = g_atan((double)missile->velz / (double)target->AproxDistance(missile));
|
||||
aim = g_atan((double)missile->vel.z / (double)target->AproxDistance(missile));
|
||||
pitch = -(int)(aim * ANGLE_180 / PI);
|
||||
}
|
||||
else
|
||||
|
|
@ -5358,7 +5366,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
|
|||
// points and bombdamage should be the same sign
|
||||
if (((points * bombdamage) > 0) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY))
|
||||
{ // OK to damage; target is in direct path
|
||||
double velz;
|
||||
double vz;
|
||||
double thrust;
|
||||
int damage = abs((int)points);
|
||||
int newdam = damage;
|
||||
|
|
@ -5385,20 +5393,20 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
|
|||
{
|
||||
thrust *= selfthrustscale;
|
||||
}
|
||||
velz = (double)(thing->Z() + (thing->height >> 1) - bombspot->Z()) * thrust;
|
||||
vz = (double)(thing->Z() + (thing->height >> 1) - bombspot->Z()) * thrust;
|
||||
if (bombsource != thing)
|
||||
{
|
||||
velz *= 0.5f;
|
||||
vz *= 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
velz *= 0.8f;
|
||||
vz *= 0.8f;
|
||||
}
|
||||
angle_t ang = bombspot->AngleTo(thing) >> ANGLETOFINESHIFT;
|
||||
thing->velx += fixed_t(finecosine[ang] * thrust);
|
||||
thing->vely += fixed_t(finesine[ang] * thrust);
|
||||
thing->vel.x += fixed_t(finecosine[ang] * thrust);
|
||||
thing->vel.y += fixed_t(finesine[ang] * thrust);
|
||||
if (!(flags & RADF_NODAMAGE))
|
||||
thing->velz += (fixed_t)velz; // this really doesn't work well
|
||||
thing->vel.z += (fixed_t)vz; // this really doesn't work well
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5657,8 +5665,8 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
|||
|
||||
mo = Spawn(bloodcls, thing->PosPlusZ(thing->height / 2), ALLOW_REPLACE);
|
||||
|
||||
mo->velx = pr_crunch.Random2() << 12;
|
||||
mo->vely = pr_crunch.Random2() << 12;
|
||||
mo->vel.x = pr_crunch.Random2() << 12;
|
||||
mo->vel.y = pr_crunch.Random2() << 12;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
|
|
@ -5806,7 +5814,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
|
|||
if (oldfloorz == thing->floorz) return;
|
||||
if (thing->flags4 & MF4_ACTLIKEBRIDGE) return; // do not move bridge things
|
||||
|
||||
if (thing->velz == 0 &&
|
||||
if (thing->vel.z == 0 &&
|
||||
(!(thing->flags & MF_NOGRAVITY) ||
|
||||
(thing->Z() == oldfloorz && !(thing->flags & MF_NOLIFTDROP))))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue