From 3f8e7b173952c04fcc82e9e1ee856c0c280dce8b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 22 May 2015 20:57:58 -0500 Subject: [PATCH] Revert/remove unused/broken junk from original slopes port m_vector removal to come later. The little thing commented out in it is so I could revert the weird tables.c change. --- src/m_vector.c | 2 +- src/p_enemy.c | 4 --- src/p_floor.c | 3 -- src/p_local.h | 15 ---------- src/p_map.c | 58 +++++++++--------------------------- src/p_maputl.c | 12 +++----- src/p_mobj.c | 1 + src/p_mobj.h | 5 ---- src/p_spec.c | 16 ++++------ src/p_user.c | 81 -------------------------------------------------- src/tables.c | 5 ++-- src/tables.h | 5 ++-- 12 files changed, 31 insertions(+), 176 deletions(-) diff --git a/src/m_vector.c b/src/m_vector.c index 274a806a..96ed7cae 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -330,7 +330,7 @@ angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector fixed_t vectorsMagnitude = FixedMul(FV_Magnitude(Vector1), FV_Magnitude(Vector2)); // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. - return FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); + return 0;//ALFALFA FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); } float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2) diff --git a/src/p_enemy.c b/src/p_enemy.c index 43c0f505..369b6f0c 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -28,10 +28,6 @@ #include "hardware/hw3sound.h" #endif -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif - #ifdef HAVE_BLUA boolean LUA_CallAction(const char *action, mobj_t *actor); #endif diff --git a/src/p_floor.c b/src/p_floor.c index 0d68becb..4e289c8d 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -19,9 +19,6 @@ #include "z_zone.h" #include "g_game.h" #include "r_main.h" -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif // ========================================================================== // FLOORS diff --git a/src/p_local.h b/src/p_local.h index f2376494..1c5874b9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -53,15 +53,6 @@ // above this, a height difference is considered as a 'dropoff' #define MAXSTEPMOVE (24*FRACUNIT) -#ifdef ESLOPE -// [RH] Minimum floorplane.c value for walking -// The lower the value, the steeper the slope is -#define SECPLANESTEEPSLOPE 46000 -// ESLOPE stuff - a slope of 4 or lower is so level, treat it as flat -#define LEVELSLOPE 4 -#define STEEPSLOPE 65 -#endif - #define USERANGE (64*FRACUNIT) #define MELEERANGE (64*FRACUNIT) #define MISSILERANGE (32*64*FRACUNIT) @@ -147,12 +138,6 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec); boolean P_InSpaceSector(mobj_t *mo); boolean P_InQuicksand(mobj_t *mo); -#ifdef ESLOPE -boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling); -boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value); -boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value); -#endif - void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index e2ea76b8..eeff412d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1756,30 +1756,8 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) } else { -#ifdef ESLOPE // SRB2CBTODO: Checking the things momx/y help with collision issues, but makes going done slopes not as smooth - if (thiscam->subsector->sector && thiscam->subsector->sector->f_slope) - { - // SRB2CBTODO: Support a mobj's gravity for this too - if (P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) > P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y)) - thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); - else - thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y); - } - else -#endif - tmfloorz = thiscam->subsector->sector->floorheight; -#ifdef ESLOPE - if (thiscam->subsector->sector && thiscam->subsector->sector->c_slope) - { - // SRB2CBTODO: Support a mobj's gravity for this too - if (P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) < P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y)) - thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y); - else - thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); - } - else -#endif - tmceilingz = thiscam->subsector->sector->ceilingheight; + tmfloorz = P_CameraGetFloorZ(thiscam, thiscam->subsector->sector, x, y, NULL); + tmceilingz = P_CameraGetCeilingZ(thiscam, thiscam->subsector->sector, x, y, NULL); } // the move is ok, @@ -2074,7 +2052,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->momz <= 0) thing->standingslope = tmfloorslope; } - else if (thing->z+thing->height >= tmceilingz /*&& thing->momz >= 0*/ && (thing->eflags & MFE_VERTICALFLIP)) { + else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmceilingslope) P_HandleSlopeLanding(thing, tmceilingslope); @@ -2120,15 +2098,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) if (!(thing->flags & MF_NOCLIP)) { - fixed_t maxstep = MAXSTEPMOVE; - -#ifdef ESLOPE // TODO: Make this collosion better - // Maxstepmove = 0 means the object bounces like a nut while going down a slope - if (thing->subsector->sector->f_slope) - { - maxstep *= thing->subsector->sector->f_slope->zangle; - } -#endif + const fixed_t maxstep = MAXSTEPMOVE; if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit @@ -2450,6 +2420,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (glidesector->sector != player->mo->subsector->sector) { boolean floorclimb = false; + fixed_t topheight, bottomheight; if (glidesector->sector->ffloors) { @@ -2459,8 +2430,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -2551,7 +2522,6 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) static boolean PTR_SlideTraverse(intercept_t *in) { line_t *li; - fixed_t maxstep; I_Assert(in->isaline); @@ -2584,9 +2554,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (opentop - slidemo->z < slidemo->height) goto isblocking; // mobj is too high - maxstep = FixedMul(MAXSTEPMOVE, slidemo->scale); - - if (openbottom - slidemo->z > maxstep) + if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale)) goto isblocking; // too big a step up // this line doesn't block movement @@ -2607,6 +2575,7 @@ isblocking: line_t *checkline = li; sector_t *checksector; ffloor_t *rover; + fixed_t topheight, bottomheight; boolean fofline = false; INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li); @@ -2622,8 +2591,8 @@ isblocking: if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -3258,6 +3227,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE)) { ffloor_t *rover; + fixed_t topheight, bottomheight; fixed_t delta1, delta2; INT32 thingtop = thing->z + thing->height; @@ -3267,8 +3237,8 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) || ((rover->flags & FF_BLOCKOTHERS) && !thing->player)) || !(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; /*#ifdef ESLOPE if (rover->t_slope) diff --git a/src/p_maputl.c b/src/p_maputl.c index a60d9232..c9a42bd4 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -21,9 +21,6 @@ #include "p_maputl.h" #include "p_polyobj.h" #include "z_zone.h" -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif // // P_AproxDistance @@ -862,6 +859,7 @@ void P_SetThingPosition(mobj_t *thing) { // link into subsector subsector_t *ss; sector_t *oldsec = NULL; + fixed_t tfloorz, tceilz; I_Assert(thing != NULL); I_Assert(!P_MobjWasRemoved(thing)); @@ -871,11 +869,6 @@ void P_SetThingPosition(mobj_t *thing) ss = thing->subsector = R_PointInSubsector(thing->x, thing->y); - fixed_t tfloorz, tceilz; - - tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); - tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); - if (!(thing->flags & MF_NOSECTOR)) { // invisible things don't go into the sector links @@ -936,6 +929,9 @@ void P_SetThingPosition(mobj_t *thing) // sector's floor is the same height. if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector) { + tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); + tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); + if (thing->eflags & MFE_VERTICALFLIP) { if (thing->z + thing->height >= tceilz) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2564a842..7a3ee0bb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2181,6 +2181,7 @@ void P_XYMovement(mobj_t *mo) if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true) && !(mo->eflags & MFE_SPRUNG)) { // blocked move + if (player) { moved = false; if (player->bot) diff --git a/src/p_mobj.h b/src/p_mobj.h index 0dc323d7..d7a370c3 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -28,11 +28,6 @@ // Needs precompiled tables/data structures. #include "info.h" -// For slope code, we need v3float_t -#ifdef ESLOPE -//#include "r_defs.h" -#endif - // // NOTES: mobj_t // diff --git a/src/p_spec.c b/src/p_spec.c index 3126413b..914e008d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -33,9 +33,6 @@ #include "m_misc.h" #include "m_cond.h" //unlock triggers #include "lua_hook.h" // LUAh_LinedefExecute -#ifdef ESLOPE -#include "p_slopes.h" -#endif #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4522,6 +4519,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) { boolean nofloorneeded = false; + fixed_t f_affectpoint, c_affectpoint; if (!sector->special) // nothing special, exit return; @@ -4584,8 +4582,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) return; } - fixed_t f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->floorheight; - fixed_t c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->ceilingheight; + f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL); + c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL); // Only go further if on the ground if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) @@ -7386,12 +7384,8 @@ void T_Pusher(pusher_t *p) || GETSECSPECIAL(referrer->special, 3) == 3) foundfloor = true; } - else if ( -#ifdef ESLOPE - (!sec->f_slope) && -#endif - (!(GETSECSPECIAL(sec->special, 3) == 2 - || GETSECSPECIAL(sec->special, 3) == 3))) + else if (!(GETSECSPECIAL(sec->special, 3) == 2 + || GETSECSPECIAL(sec->special, 3) == 3)) return; if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK. diff --git a/src/p_user.c b/src/p_user.c index 450ebca7..b389985b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1197,87 +1197,6 @@ boolean P_IsObjectOnGround(mobj_t *mo) return false; } -#ifdef ESLOPE -// -// P_IsObjectOnSlope -// -// Returns true if the player is -// on a slope. Takes reverse -// gravity into account. -// -boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) // SRB2CBTODO: allow being on underside of mobj too? - return true; - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - return true; - } - - return false; -} - -// -// P_SlopeGreaterThan -// -// Returns true if the object is on a slope -// that has an angle greater than the value -// -boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) - { - if (value < mo->subsector->sector->c_slope->zangle) - return true; - } - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - { - if (value < mo->subsector->sector->f_slope->zangle) - return true; - } - } - - return false; -} - -// -// P_SlopeLessThan -// -// Returns true if the object is on a slope -// that has an angle less than the value -// -boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) - { - if (value < mo->subsector->sector->c_slope->zangle) - return true; - } - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - { - if (value < mo->subsector->sector->f_slope->zangle) - return true; - } - } - - return false; -} -#endif - // // P_IsObjectOnGroundIn // diff --git a/src/tables.c b/src/tables.c index cfc17c9c..fa71effe 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2225,6 +2225,9 @@ angle_t tantoangle[2049] = 536870912 }; + +#ifdef NEED_FIXED_VECTOR + static angle_t fineacon[65536*2] = { ANGLE_MAX, 2143707442, 2142143280, 2140943052, 2139931208, 2139039753, 2138233813, 2137492672, 2136802831, 2136154917, 2135542102, 2134959233, 2134402306, 2133868139, 2133354148, 2132858208, 2132378539, 2131913638, 2131462220, 2131023174, 2130595537, 2130178462, 2129771202, 2129373097, 2128983555, 2128602046, 2128228092, 2127861261, 2127501162, 2127147436, 2126799757, 2126457825, @@ -10426,8 +10429,6 @@ FUNCMATH angle_t FixedAcos(fixed_t x) return fineacon[((x<<(FINE_FRACBITS-FRACBITS)))+FRACUNIT]; } -#ifdef NEED_FIXED_VECTOR - // // AngleBetweenVectors // diff --git a/src/tables.h b/src/tables.h index cd6a17ff..219d668b 100644 --- a/src/tables.h +++ b/src/tables.h @@ -96,11 +96,12 @@ FUNCMATH angle_t FixedAngle(fixed_t fa); // and with a factor, with +factor for (fa/factor) and -factor for (fa*factor) FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); -/// The FixedAcos function -FUNCMATH angle_t FixedAcos(fixed_t x); #ifdef NEED_FIXED_VECTOR +/// The FixedAcos function +FUNCMATH angle_t FixedAcos(fixed_t x); + /// Fixed Point Vector functions angle_t FV2_AngleBetweenVectors(const vector2_t *Vector1, const vector2_t *Vector2); angle_t FV3_AngleBetweenVectors(const vector3_t *Vector1, const vector3_t *Vector2);