mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Merge branch 'skip-unused-mobj-hooks' into 'next'
Only invoke the Lua API for mobj hooks that need it See merge request STJr/SRB2!1209
This commit is contained in:
commit
503e83653e
1 changed files with 33 additions and 3 deletions
|
@ -264,6 +264,9 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which)
|
|||
|
||||
I_Assert(mo->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[mo->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -536,6 +539,9 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
|
|||
|
||||
I_Assert(thing1->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjcollidehooks[MT_NULL] || mobjcollidehooks[thing1->type]))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -615,6 +621,9 @@ UINT8 LUAh_MobjLineCollideHook(mobj_t *thing, line_t *line, enum hook which)
|
|||
|
||||
I_Assert(thing->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjcollidehooks[MT_NULL] || mobjcollidehooks[thing->type]))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -695,6 +704,9 @@ boolean LUAh_MobjThinker(mobj_t *mo)
|
|||
|
||||
I_Assert(mo->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjthinkerhooks[MT_NULL] || mobjthinkerhooks[mo->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -747,10 +759,13 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher)
|
|||
hook_p hookp;
|
||||
boolean hooked = false;
|
||||
if (!gL || !(hooksAvailable[hook_TouchSpecial/8] & (1<<(hook_TouchSpecial%8))))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
I_Assert(special->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[special->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -821,6 +836,9 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
|
||||
I_Assert(target->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[target->type]))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -908,10 +926,13 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
hook_p hookp;
|
||||
boolean hooked = false;
|
||||
if (!gL || !(hooksAvailable[hook_MobjDamage/8] & (1<<(hook_MobjDamage%8))))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
I_Assert(target->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[target->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -990,10 +1011,13 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8
|
|||
hook_p hookp;
|
||||
boolean hooked = false;
|
||||
if (!gL || !(hooksAvailable[hook_MobjDeath/8] & (1<<(hook_MobjDeath%8))))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
I_Assert(target->type < NUMMOBJTYPES);
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[target->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -1392,6 +1416,9 @@ boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing)
|
|||
if (!gL || !(hooksAvailable[hook_MapThingSpawn/8] & (1<<(hook_MapThingSpawn%8))))
|
||||
return false;
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[mo->type]))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
@ -1460,6 +1487,9 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
|
|||
if (!gL || !(hooksAvailable[hook_FollowMobj/8] & (1<<(hook_FollowMobj%8))))
|
||||
return 0;
|
||||
|
||||
if (!(mobjhooks[MT_NULL] || mobjhooks[mobj->type]))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
|
|
Loading…
Reference in a new issue