Add MusicCredit lua hook
This commit is contained in:
1 parent
279dfcafc4
commit
359befd857
3 files changed
+16
-1
No files matched your search
@@ -55,6 +55,7 @@
|
||||
X (PlayerQuit),\
|
||||
X (PlayerThink),/* P_PlayerThink */\
|
||||
X (MusicChange),\
|
||||
X (MusicCredit),\
|
||||
X (ShouldSpin),/*SRB2KART*/\
|
||||
X (ShouldExplode),/*SRB2KART*/\
|
||||
X (ShouldSquish),/*SRB2KART*/\
|
||||
@@ -130,6 +131,7 @@ int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
|
||||
void LUA_HookPlayerQuit(player_t *, int);
|
||||
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
|
||||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
int LUA_HookMusicCredit(musicdef_t *musicdef);
|
||||
|
||||
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
|
||||
@@ -1065,6 +1065,18 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
int LUA_HookMusicCredit(musicdef_t *musicdef)
|
||||
{
|
||||
Hook_State hook;
|
||||
if (prepare_hook(&hook, 0, HOOK(MusicCredit)))
|
||||
{
|
||||
LUA_PushUserdata(gL, musicdef, META_MUSICDEF);
|
||||
call_hooks(&hook, 1, res_true);
|
||||
}
|
||||
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
static int kartdamage_hook
|
||||
(
|
||||
player_t *player,
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@
|
||||
#include "m_menu.h" // bird music stuff
|
||||
|
||||
#include "lua_hook.h" // MusicChange hook
|
||||
#include "lua_hud.h" // LUA_HudEnabled(hud_musiccredit)
|
||||
|
||||
static boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
||||
static void SetChannelsNum(void);
|
||||
@@ -1452,7 +1453,7 @@ void S_ShowSpecifiedMusicCredit(const char *musname)
|
||||
|
||||
def = S_FindMusicCredit(musname);
|
||||
|
||||
if (def)
|
||||
if (def && !LUA_HookMusicCredit(def))
|
||||
{
|
||||
cursongcredit.def = def;
|
||||
cursongcredit.anim = 5*TICRATE;
|
||||
|
||||
Reference in new issue
Block a user