mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Slope collision fixes
This commit is contained in:
parent
10ba850871
commit
776b5254e6
4 changed files with 46 additions and 12 deletions
|
@ -296,6 +296,8 @@ extern fixed_t tmfloorz;
|
|||
extern fixed_t tmceilingz;
|
||||
extern mobj_t *tmfloorthing, *tmthing;
|
||||
extern camera_t *mapcampointer;
|
||||
extern fixed_t tmx;
|
||||
extern fixed_t tmy;
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
extern void P_MapStart(void);
|
||||
|
|
22
src/p_map.c
22
src/p_map.c
|
@ -38,8 +38,8 @@
|
|||
fixed_t tmbbox[4];
|
||||
mobj_t *tmthing;
|
||||
static INT32 tmflags;
|
||||
static fixed_t tmx;
|
||||
static fixed_t tmy;
|
||||
fixed_t tmx;
|
||||
fixed_t tmy;
|
||||
|
||||
static precipmobj_t *tmprecipthing;
|
||||
static fixed_t preciptmbbox[4];
|
||||
|
@ -1208,8 +1208,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
// that contains the point.
|
||||
// Any contacted lines the step closer together
|
||||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->ceilingheight;
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
|
@ -1945,13 +1945,23 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
{
|
||||
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
||||
{
|
||||
thing->z = tmceilingz - thing->height;
|
||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
else if (thingtop == thing->ceilingz && tmceilingz , thingtop && thingtop - tmceilingz <= maxstep)
|
||||
{
|
||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
}
|
||||
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
||||
{
|
||||
thing->z = tmfloorz;
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
else if (thing->z == thing->floorz && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
|
||||
{
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,8 +560,8 @@ void P_LineOpening(line_t *linedef)
|
|||
{ // Set open and high/low values here
|
||||
fixed_t frontheight, backheight;
|
||||
|
||||
frontheight = P_GetCeilingZ(tmthing, front, tmthing->x, tmthing->y, linedef);
|
||||
backheight = P_GetCeilingZ(tmthing, back, tmthing->x, tmthing->y, linedef);
|
||||
frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef);
|
||||
backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef);
|
||||
|
||||
if (frontheight < backheight)
|
||||
{
|
||||
|
@ -574,8 +574,8 @@ void P_LineOpening(line_t *linedef)
|
|||
highceiling = frontheight;
|
||||
}
|
||||
|
||||
frontheight = P_GetFloorZ(tmthing, front, tmthing->x, tmthing->y, linedef);
|
||||
backheight = P_GetFloorZ(tmthing, back, tmthing->x, tmthing->y, linedef);
|
||||
frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef);
|
||||
backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef);
|
||||
|
||||
if (frontheight > backheight)
|
||||
{
|
||||
|
|
26
src/p_mobj.c
26
src/p_mobj.c
|
@ -747,7 +747,7 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t
|
|||
|
||||
if (slope->zdelta > 0) {
|
||||
testx = -testx;
|
||||
testx = -testy;
|
||||
testy = -testy;
|
||||
}
|
||||
|
||||
testx += x;
|
||||
|
@ -775,6 +775,17 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t
|
|||
v2.x = line->v2->x;
|
||||
v2.y = line->v2->y;
|
||||
|
||||
/*CONS_Printf("BEFORE: v1 = %f %f %f\n",
|
||||
FIXED_TO_FLOAT(v1.x),
|
||||
FIXED_TO_FLOAT(v1.y),
|
||||
FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y))
|
||||
);
|
||||
CONS_Printf(" v2 = %f %f %f\n",
|
||||
FIXED_TO_FLOAT(v2.x),
|
||||
FIXED_TO_FLOAT(v2.y),
|
||||
FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y))
|
||||
);*/
|
||||
|
||||
if (abs(v1.x-x) > mobj->radius) {
|
||||
// v1's x is out of range, so rein it in
|
||||
fixed_t diff = abs(v1.x-x) - mobj->radius;
|
||||
|
@ -827,6 +838,17 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t
|
|||
}
|
||||
}
|
||||
|
||||
/*CONS_Printf("AFTER: v1 = %f %f %f\n",
|
||||
FIXED_TO_FLOAT(v1.x),
|
||||
FIXED_TO_FLOAT(v1.y),
|
||||
FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y))
|
||||
);
|
||||
CONS_Printf(" v2 = %f %f %f\n",
|
||||
FIXED_TO_FLOAT(v2.x),
|
||||
FIXED_TO_FLOAT(v2.y),
|
||||
FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y))
|
||||
);*/
|
||||
|
||||
// Return the higher of the two points
|
||||
return max(
|
||||
P_GetZAt(slope, v1.x, v1.y),
|
||||
|
@ -860,7 +882,7 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line
|
|||
|
||||
if (slope->zdelta < 0) {
|
||||
testx = -testx;
|
||||
testx = -testy;
|
||||
testy = -testy;
|
||||
}
|
||||
|
||||
testx += x;
|
||||
|
|
Loading…
Reference in a new issue