From e0badd1e5b7dfb89d19a04be82a9543ceb60820e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 18 Mar 2020 22:35:21 -0500 Subject: [PATCH] Rename hook to ShouldJingleContinue --- src/lua_hook.h | 4 ++-- src/lua_hooklib.c | 14 +++++++------- src/p_user.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index ea11d0236..dde8d4c41 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -58,7 +58,7 @@ enum hook { hook_ViewpointSwitch, hook_SeenPlayer, hook_PlayerThink, - hook_JingleStatus, + hook_ShouldJingleContinue, 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 #endif #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 diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index c56336fca..3a4d67492 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -69,7 +69,7 @@ const char *const hookNames[hook_MAX+1] = { "ViewpointSwitch", "SeenPlayer", "PlayerThink", - "JingleStatus", + "ShouldJingleContinue", NULL }; @@ -81,7 +81,7 @@ struct hook_s UINT16 id; union { 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; } s; boolean error; @@ -149,7 +149,7 @@ static int lib_addHook(lua_State *L) luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t"); break; case hook_BotAI: - case hook_JingleStatus: + case hook_ShouldJingleContinue: hook.s.skinname = NULL; if (lua_isstring(L, 2)) { // lowercase copy @@ -1634,11 +1634,11 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend) } #endif // SEENAMES -boolean LUAh_JingleStatus(player_t *player, const char *musname) +boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) { hook_p hookp; 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; lua_settop(gL, 0); @@ -1646,9 +1646,9 @@ boolean LUAh_JingleStatus(player_t *player, const char *musname) 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))) continue; diff --git a/src/p_user.c b/src/p_user.c index ab85897a5..b7b95f9f0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1599,7 +1599,7 @@ boolean P_EvaluateMusicStatus(UINT16 status, const char *musname) break; case JT_OTHER: // Other state - result = LUAh_JingleStatus(&players[i], musname); + result = LUAh_ShouldJingleContinue(&players[i], musname); break; case JT_NONE: // Null state