Fixed the issue where diagonal springs couldn't teleport you to their centers anymore (guess whose fault that was! =D ). Basically I just made P_DoSpring boolean, which probably could be useful to Lua peeps as well. (it returns true if you were sprung, false if not)

This commit is contained in:
Monster Iestyn 2015-07-28 19:28:51 +01:00
parent ac5c8f10e9
commit fa935be129
3 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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_ATK1);
}
}
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)
@ -819,7 +821,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);
}
}
@ -906,7 +908,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
@ -928,12 +930,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