Deprecate performance-sensitive type-agnostic mobj hooks

This commit is contained in:
LJ Sonic 2024-09-13 18:40:17 +02:00
parent fffc142d67
commit 947fa0ca5c

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)
{
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]);
}
@ -751,7 +767,7 @@ static void hook_think_frame(int type)
PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
else if (type == 6)
PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
hook_index++;
}
}