Rename hook to ShouldJingleContinue

This commit is contained in:
fickleheart 2020-03-18 22:35:21 -05:00
parent 352029fd76
commit e0badd1e5b
3 changed files with 10 additions and 10 deletions

View File

@ -58,7 +58,7 @@ enum hook {
hook_ViewpointSwitch, hook_ViewpointSwitch,
hook_SeenPlayer, hook_SeenPlayer,
hook_PlayerThink, hook_PlayerThink,
hook_JingleStatus, hook_ShouldJingleContinue,
hook_MAX // last hook hook_MAX // last hook
}; };
@ -111,6 +111,6 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
#endif #endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink #define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
boolean LUAh_JingleStatus(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
#endif #endif

View File

@ -69,7 +69,7 @@ const char *const hookNames[hook_MAX+1] = {
"ViewpointSwitch", "ViewpointSwitch",
"SeenPlayer", "SeenPlayer",
"PlayerThink", "PlayerThink",
"JingleStatus", "ShouldJingleContinue",
NULL NULL
}; };
@ -81,7 +81,7 @@ struct hook_s
UINT16 id; UINT16 id;
union { union {
mobjtype_t mt; mobjtype_t mt;
char *skinname; // also used as musname for JingleStatus... I'm lazy char *skinname; // also used as musname for ShouldJingleContinue... I'm lazy
char *funcname; char *funcname;
} s; } s;
boolean error; boolean error;
@ -149,7 +149,7 @@ static int lib_addHook(lua_State *L)
luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t"); luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t");
break; break;
case hook_BotAI: case hook_BotAI:
case hook_JingleStatus: case hook_ShouldJingleContinue:
hook.s.skinname = NULL; hook.s.skinname = NULL;
if (lua_isstring(L, 2)) if (lua_isstring(L, 2))
{ // lowercase copy { // lowercase copy
@ -1634,11 +1634,11 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
} }
#endif // SEENAMES #endif // SEENAMES
boolean LUAh_JingleStatus(player_t *player, const char *musname) boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
{ {
hook_p hookp; hook_p hookp;
boolean keepplaying = false; boolean keepplaying = false;
if (!gL || !(hooksAvailable[hook_JingleStatus/8] & (1<<(hook_JingleStatus%8)))) if (!gL || !(hooksAvailable[hook_ShouldJingleContinue/8] & (1<<(hook_ShouldJingleContinue%8))))
return true; return true;
lua_settop(gL, 0); lua_settop(gL, 0);
@ -1646,9 +1646,9 @@ boolean LUAh_JingleStatus(player_t *player, const char *musname)
for (hookp = roothook; hookp; hookp = hookp->next) for (hookp = roothook; hookp; hookp = hookp->next)
{ {
if (hookp->type == hook_JingleStatus) CONS_Printf("jingle status hook for %s vs %s\n", hookp->s.skinname, musname); if (hookp->type == hook_ShouldJingleContinue) CONS_Printf("jingle status hook for %s vs %s\n", hookp->s.skinname, musname);
if (hookp->type != hook_JingleStatus if (hookp->type != hook_ShouldJingleContinue
|| (hookp->s.skinname && strcmp(hookp->s.skinname, musname))) || (hookp->s.skinname && strcmp(hookp->s.skinname, musname)))
continue; continue;

View File

@ -1599,7 +1599,7 @@ boolean P_EvaluateMusicStatus(UINT16 status, const char *musname)
break; break;
case JT_OTHER: // Other state case JT_OTHER: // Other state
result = LUAh_JingleStatus(&players[i], musname); result = LUAh_ShouldJingleContinue(&players[i], musname);
break; break;
case JT_NONE: // Null state case JT_NONE: // Null state