diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2a5ff8d65..4be103106 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1009,8 +1009,8 @@ static int lib_pDoSpring(lua_State *L) NOHUD if (!spring || !object) return LUA_ErrInvalid(L, "mobj_t"); - P_DoSpring(spring, object); - return 0; + lua_pushboolean(L, P_DoSpring(spring, object)); + return 1; } // P_INTER diff --git a/src/p_local.h b/src/p_local.h index f2c516d5d..748d616f3 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -316,7 +316,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist); fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height); boolean PIT_PushableMoved(mobj_t *thing); -void P_DoSpring(mobj_t *spring, mobj_t *object); +boolean P_DoSpring(mobj_t *spring, mobj_t *object); // // P_SETUP diff --git a/src/p_map.c b/src/p_map.c index 99a408569..b03705a2b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -102,7 +102,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) // MOVEMENT ITERATOR FUNCTIONS // ========================================================================= -void P_DoSpring(mobj_t *spring, mobj_t *object) +boolean P_DoSpring(mobj_t *spring, mobj_t *object) { INT32 pflags; fixed_t offx, offy; @@ -110,16 +110,16 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) fixed_t horizspeed = spring->info->damage; if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic - return; + return false; // Spectators don't trigger springs. if (object->player && object->player->spectator) - return; + return false; if (object->player && (object->player->pflags & PF_NIGHTSMODE)) { /*Someone want to make these work like bumpers?*/ - return; + return false; } object->eflags |= MFE_SPRUNG; // apply this flag asap! @@ -209,6 +209,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) P_SetPlayerMobjState(object, S_PLAY_SPIN); } } + return true; } static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) @@ -365,6 +366,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) static boolean PIT_CheckThing(mobj_t *thing) { fixed_t blockdist; + boolean iwassprung = false; // don't clip against self if (thing == tmthing) @@ -829,7 +831,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } } @@ -916,7 +918,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } // Are you touching the side of the object you're interacting with? else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height @@ -938,12 +940,14 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - - if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)); - else + if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)) + { + if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... + return false; // "cancel" P_TryMove via blocking so you keep your current position + } // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team - if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) ; // z checking at last diff --git a/src/r_main.c b/src/r_main.c index 1edcb815b..19a6b5cba 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -316,13 +316,13 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; } @@ -332,13 +332,13 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; }