Merge branch 'youvebeenblocked' into 'next'

Add proper parameters to MobjMoveBlocked so you can actually tell what you're being blocked by (Resolves #332)

Closes #332

See merge request STJr/SRB2!1491
This commit is contained in:
Tatsuru 2021-09-12 21:38:40 +00:00
commit cd5ba1271a
3 changed files with 15 additions and 1 deletions

View file

@ -116,6 +116,7 @@ int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
int LUA_HookMobjMoveBlocked(mobj_t *, mobj_t *, line_t *);
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg);

View file

@ -713,6 +713,19 @@ int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 d
MOBJ_HOOK(MobjDeath), 4, res_true);
}
int LUA_HookMobjMoveBlocked(mobj_t *t1, mobj_t *t2, line_t *line)
{
Hook_State hook;
if (prepare_mobj_hook(&hook, 0, MOBJ_HOOK(MobjMoveBlocked), t1->type))
{
LUA_PushUserdata(gL, t1, META_MOBJ);
LUA_PushUserdata(gL, t2, META_MOBJ);
LUA_PushUserdata(gL, line, META_LINE);
call_hooks(&hook, 3, 1, res_true);
}
return hook.status;
}
typedef struct {
mobj_t * tails;
ticcmd_t * cmd;

View file

@ -1842,7 +1842,7 @@ void P_XYMovement(mobj_t *mo)
if (player)
B_MoveBlocked(player);
if (LUA_HookMobj(mo, MOBJ_HOOK(MobjMoveBlocked)))
if (LUA_HookMobjMoveBlocked(mo, tmhitthing, blockingline))
{
if (P_MobjWasRemoved(mo))
return;