Merge branch 'deprecate-global-mobj-hooks' into 'next'

Deprecate performance-sensitive type-agnostic mobj hooks

See merge request STJr/SRB2!2516
This commit is contained in:
LJ Sonic 2024-09-13 16:55:53 +00:00
commit ef9dc17646

View file

@ -498,6 +498,22 @@ static int call_string_hooks(Hook_State *hook)
static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type)
{ {
if (mobj_type == MT_NULL && (
hook->hook_type == MOBJ_HOOK(MobjThinker )
|| hook->hook_type == MOBJ_HOOK(MobjCollide )
|| hook->hook_type == MOBJ_HOOK(MobjLineCollide)
|| hook->hook_type == MOBJ_HOOK(MobjMoveCollide)
|| hook->hook_type == MOBJ_HOOK(MobjFuse )
|| hook->hook_type == MOBJ_HOOK(MobjThinker )
|| hook->hook_type == MOBJ_HOOK(BossThinker )
|| hook->hook_type == MOBJ_HOOK(MobjMoveBlocked)
|| hook->hook_type == MOBJ_HOOK(FollowMobj )
))
LUA_UsageWarning(L, va(
"%s hooks not attached to a specific mobj type are deprecated and will be removed.",
mobjHookNames[hook->hook_type])
);
return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]);
} }
@ -751,7 +767,7 @@ static void hook_think_frame(int type)
PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src); PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
else if (type == 6) else if (type == 6)
PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src); PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
hook_index++; hook_index++;
} }
} }