mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 05:11:34 +00:00
Overhaul slope collision (NOT PHYSICS) to work almost perfectly
This commit is contained in:
parent
58dd6d42af
commit
6694480f68
5 changed files with 56 additions and 136 deletions
|
@ -28,7 +28,7 @@
|
||||||
#include "hardware/hw3sound.h"
|
#include "hardware/hw3sound.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef SPRINGCLEAN// ESLOPE
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5611,12 +5611,8 @@ void A_MixUp(mobj_t *actor)
|
||||||
P_SetThingPosition(players[i].mo);
|
P_SetThingPosition(players[i].mo);
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
players[i].mo->floorz = (players[i].mo->subsector->sector->f_slope ?
|
players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
|
||||||
P_GetZAt(players[i].mo->subsector->sector->f_slope, players[i].mo->x, players[i].mo->y) :
|
players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
|
||||||
players[i].mo->subsector->sector->floorheight);
|
|
||||||
players[i].mo->ceilingz = (players[i].mo->subsector->sector->c_slope ?
|
|
||||||
P_GetZAt(players[i].mo->subsector->sector->c_slope, players[i].mo->x, players[i].mo->y) :
|
|
||||||
players[i].mo->subsector->sector->ceilingheight);
|
|
||||||
#else
|
#else
|
||||||
players[i].mo->floorz = players[i].mo->subsector->sector->floorheight;
|
players[i].mo->floorz = players[i].mo->subsector->sector->floorheight;
|
||||||
players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight;
|
players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#ifdef ESLOPE
|
#ifdef SPRINGCLEAN// ESLOPE
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1177,18 +1177,15 @@ void T_SpikeSector(levelspecthink_t *spikes)
|
||||||
|
|
||||||
if (affectsec == spikes->sector) // Applied to an actual sector
|
if (affectsec == spikes->sector) // Applied to an actual sector
|
||||||
{
|
{
|
||||||
fixed_t affectpoint = affectsec->floorheight;
|
fixed_t affectfloor = P_GetFloorZ(thing, affectsec, thing->x, thing->y, NULL);
|
||||||
|
fixed_t affectceil = P_GetCeilingZ(thing, affectsec, thing->x, thing->y, NULL);
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (affectsec->f_slope)
|
|
||||||
affectpoint = P_GetZAt(affectsec->f_slope, thing->x, thing->y);
|
|
||||||
#endif
|
|
||||||
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
|
if (affectsec->flags & SF_FLIPSPECIAL_FLOOR)
|
||||||
{
|
{
|
||||||
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0)
|
if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (thing->z == affectpoint)
|
if (thing->z == affectfloor)
|
||||||
dothepain = true;
|
dothepain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1194,7 @@ void T_SpikeSector(levelspecthink_t *spikes)
|
||||||
if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0)
|
if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (thing->z + thing->height == affectsec->ceilingheight)
|
if (thing->z + thing->height == affectceil)
|
||||||
dothepain = true;
|
dothepain = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
70
src/p_map.c
70
src/p_map.c
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "r_splats.h"
|
#include "r_splats.h"
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef SPRINGCLEAN// ESLOPE
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
/*Someone want to make these work like bumpers?*/
|
/*Someone want to make these work like bumpers?*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
||||||
|
|
||||||
|
@ -1208,21 +1208,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||||
// that contains the point.
|
// that contains the point.
|
||||||
// Any contacted lines the step closer together
|
// Any contacted lines the step closer together
|
||||||
// will adjust them.
|
// will adjust them.
|
||||||
#ifdef ESLOPE
|
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->floorheight;
|
||||||
if (newsubsec->sector->f_slope)
|
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->ceilingheight;
|
||||||
{
|
|
||||||
tmfloorz = tmdropoffz = P_GetZAt(newsubsec->sector->f_slope, thing->x, thing->y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
|
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (newsubsec->sector->c_slope)
|
|
||||||
tmceilingz = P_GetZAt(newsubsec->sector->c_slope, thing->x, thing->y);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
tmceilingz = newsubsec->sector->ceilingheight;
|
|
||||||
|
|
||||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||||
if (newsubsec->sector->ffloors)
|
if (newsubsec->sector->ffloors)
|
||||||
|
@ -1535,7 +1522,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||||
|
|
||||||
fixed_t topheight = *rover->topheight;
|
fixed_t topheight = *rover->topheight;
|
||||||
fixed_t bottomheight = *rover->bottomheight;
|
fixed_t bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
/*#ifdef ESLOPE
|
/*#ifdef ESLOPE
|
||||||
if (rover->t_slope)
|
if (rover->t_slope)
|
||||||
topheight = P_GetZAt(rover->t_slope, thiscam->x, thiscam->y);
|
topheight = P_GetZAt(rover->t_slope, thiscam->x, thiscam->y);
|
||||||
|
@ -2033,7 +2020,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
// Link the thing into its new position
|
// Link the thing into its new position
|
||||||
P_UnsetThingPosition(thing);
|
P_UnsetThingPosition(thing);
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef SRPINGCLEAN// ESLOPE
|
||||||
// By virtue of being derived from SRB2 code, Kalaron's physics are GPL.
|
// By virtue of being derived from SRB2 code, Kalaron's physics are GPL.
|
||||||
if (P_IsObjectOnSlope(thing, false))
|
if (P_IsObjectOnSlope(thing, false))
|
||||||
{
|
{
|
||||||
|
@ -2112,32 +2099,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// P_CheckPosition sets the tmfloorz with slopes, but after P_UnsetThingPosition, recheck the function here
|
thing->floorz = tmfloorz;
|
||||||
// TODO: Make a function for floor/ceilingz auto check with slopes?
|
thing->ceilingz = tmceilingz;
|
||||||
#ifdef ESLOPE
|
|
||||||
if (thing->subsector->sector->f_slope)
|
|
||||||
{
|
|
||||||
// TODO: Support a mobj's gravity for this too
|
|
||||||
if (P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy) > P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y))
|
|
||||||
thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy);
|
|
||||||
else
|
|
||||||
thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
thing->floorz = tmfloorz;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (thing->subsector->sector->c_slope)
|
|
||||||
{
|
|
||||||
// SRB2CBTODO: Support a mobj's gravity for this too
|
|
||||||
if (P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy) < P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y))
|
|
||||||
thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y);
|
|
||||||
else
|
|
||||||
thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
thing->ceilingz = tmceilingz;
|
|
||||||
thing->x = x;
|
thing->x = x;
|
||||||
thing->y = y;
|
thing->y = y;
|
||||||
|
|
||||||
|
@ -2494,16 +2458,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
|
|
||||||
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
||||||
|
|
||||||
floorz = glidesector->sector->floorheight;
|
floorz = P_GetFloorZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL);
|
||||||
#ifdef ESLOPE
|
ceilingz = P_GetCeilingZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL);
|
||||||
if (glidesector->sector->f_slope)
|
|
||||||
floorz = P_GetZAt(glidesector->sector->f_slope, player->mo->x + platx, player->mo->y + platy);
|
|
||||||
#endif
|
|
||||||
ceilingz = glidesector->sector->ceilingheight;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (glidesector->sector->c_slope)
|
|
||||||
ceilingz = P_GetZAt(glidesector->sector->c_slope, player->mo->x + platx, player->mo->y + platy);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (glidesector->sector != player->mo->subsector->sector)
|
if (glidesector->sector != player->mo->subsector->sector)
|
||||||
{
|
{
|
||||||
|
@ -2519,7 +2475,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
|
|
||||||
fixed_t topheight = *rover->topheight;
|
fixed_t topheight = *rover->topheight;
|
||||||
fixed_t bottomheight = *rover->bottomheight;
|
fixed_t bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
/*#ifdef ESLOPE
|
/*#ifdef ESLOPE
|
||||||
if (rover->t_slope)
|
if (rover->t_slope)
|
||||||
topheight = P_GetZAt(rover->t_slope, player->mo->x, player->mo->y);
|
topheight = P_GetZAt(rover->t_slope, player->mo->x, player->mo->y);
|
||||||
|
@ -4046,7 +4002,7 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||||
|
|
||||||
fixed_t topheight = *rover->topheight;
|
fixed_t topheight = *rover->topheight;
|
||||||
fixed_t bottomheight = *rover->bottomheight;
|
fixed_t bottomheight = *rover->bottomheight;
|
||||||
|
|
||||||
/*#ifdef ESLOPE
|
/*#ifdef ESLOPE
|
||||||
if (rover->t_slope)
|
if (rover->t_slope)
|
||||||
topheight = P_GetZAt(rover->t_slope, x, y);
|
topheight = P_GetZAt(rover->t_slope, x, y);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "p_polyobj.h"
|
#include "p_polyobj.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#ifdef ESLOPE
|
#ifdef SPRINGCLEAN// ESLOPE
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -557,26 +557,36 @@ void P_LineOpening(line_t *linedef)
|
||||||
I_Assert(front != NULL);
|
I_Assert(front != NULL);
|
||||||
I_Assert(back != NULL);
|
I_Assert(back != NULL);
|
||||||
|
|
||||||
if (front->ceilingheight < back->ceilingheight)
|
{ // Set open and high/low values here
|
||||||
{
|
fixed_t frontheight, backheight;
|
||||||
opentop = front->ceilingheight;
|
|
||||||
highceiling = back->ceilingheight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
opentop = back->ceilingheight;
|
|
||||||
highceiling = front->ceilingheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (front->floorheight > back->floorheight)
|
frontheight = P_GetCeilingZ(tmthing, front, tmthing->x, tmthing->y, linedef);
|
||||||
{
|
backheight = P_GetCeilingZ(tmthing, back, tmthing->x, tmthing->y, linedef);
|
||||||
openbottom = front->floorheight;
|
|
||||||
lowfloor = back->floorheight;
|
if (frontheight < backheight)
|
||||||
}
|
{
|
||||||
else
|
opentop = frontheight;
|
||||||
{
|
highceiling = backheight;
|
||||||
openbottom = back->floorheight;
|
}
|
||||||
lowfloor = front->floorheight;
|
else
|
||||||
|
{
|
||||||
|
opentop = backheight;
|
||||||
|
highceiling = frontheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
frontheight = P_GetFloorZ(tmthing, front, tmthing->x, tmthing->y, linedef);
|
||||||
|
backheight = P_GetFloorZ(tmthing, back, tmthing->x, tmthing->y, linedef);
|
||||||
|
|
||||||
|
if (frontheight > backheight)
|
||||||
|
{
|
||||||
|
openbottom = frontheight;
|
||||||
|
lowfloor = backheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
openbottom = backheight;
|
||||||
|
lowfloor = frontheight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmthing)
|
if (tmthing)
|
||||||
|
@ -627,32 +637,6 @@ void P_LineOpening(line_t *linedef)
|
||||||
openbottom = textop;
|
openbottom = textop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ESLOPE
|
|
||||||
// I suspect the math here is wrong and we should be comparing the slope Zs
|
|
||||||
// if either are slopes.
|
|
||||||
// -- Fury
|
|
||||||
if (front->c_slope && front->ceilingheight < back->ceilingheight)
|
|
||||||
{
|
|
||||||
opentop = P_GetZAt(front->c_slope, tmthing->x, tmthing->y);
|
|
||||||
if (back->c_slope) highceiling = P_GetZAt(back->c_slope, tmthing->x, tmthing->y);
|
|
||||||
}
|
|
||||||
else if (back->c_slope && front->ceilingheight >= back->ceilingheight)
|
|
||||||
{
|
|
||||||
opentop = P_GetZAt(back->c_slope, tmthing->x, tmthing->y);
|
|
||||||
if (front->c_slope) highceiling = P_GetZAt(front->c_slope, tmthing->x, tmthing->y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (front->f_slope && front->floorheight < back->floorheight)
|
|
||||||
{
|
|
||||||
openbottom = P_GetZAt(front->f_slope, tmthing->x, tmthing->y);
|
|
||||||
if (back->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y);
|
|
||||||
}
|
|
||||||
if (back->f_slope && front->floorheight >= back->floorheight)
|
|
||||||
{
|
|
||||||
openbottom = P_GetZAt(back->f_slope, tmthing->x, tmthing->y);
|
|
||||||
if (front->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check for fake floors in the sector.
|
// Check for fake floors in the sector.
|
||||||
if (front->ffloors || back->ffloors
|
if (front->ffloors || back->ffloors
|
||||||
|
@ -889,14 +873,9 @@ void P_SetThingPosition(mobj_t *thing)
|
||||||
ss = thing->subsector = R_PointInSubsector(thing->x, thing->y);
|
ss = thing->subsector = R_PointInSubsector(thing->x, thing->y);
|
||||||
|
|
||||||
fixed_t tfloorz, tceilz;
|
fixed_t tfloorz, tceilz;
|
||||||
tfloorz = ss->sector->floorheight;
|
|
||||||
tceilz = ss->sector->ceilingheight;
|
tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL);
|
||||||
#ifdef ESLOPE
|
tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL);
|
||||||
if (ss->sector->f_slope)
|
|
||||||
tfloorz = P_GetZAt(ss->sector->f_slope, thing->x, thing->y);
|
|
||||||
if (ss->sector->c_slope)
|
|
||||||
tceilz = P_GetZAt(ss->sector->c_slope, thing->x, thing->y);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(thing->flags & MF_NOSECTOR))
|
if (!(thing->flags & MF_NOSECTOR))
|
||||||
{
|
{
|
||||||
|
|
12
src/p_spec.c
12
src/p_spec.c
|
@ -4584,16 +4584,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t f_affectpoint = sector->floorheight;
|
fixed_t f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->floorheight;
|
||||||
fixed_t c_affectpoint = sector->ceilingheight;
|
fixed_t c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->ceilingheight;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (sector->f_slope)
|
|
||||||
f_affectpoint = P_GetZAt(sector->f_slope, player->mo->x, player->mo->y);
|
|
||||||
|
|
||||||
if (sector->c_slope)
|
|
||||||
c_affectpoint = P_GetZAt(sector->c_slope, player->mo->x, player->mo->y);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Only go further if on the ground
|
// Only go further if on the ground
|
||||||
if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint)
|
if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint)
|
||||||
|
|
Loading…
Reference in a new issue