Hide MusicPlus lua behind an #ifdef HAVE_LUA_MUSICPLUS

# Conflicts:
#	src/lua_hook.h
#	src/lua_hooklib.c
#	src/p_user.c
This commit is contained in:
mazmazz 2018-08-15 03:37:11 -04:00
parent 0254f4f368
commit d93ca34859
5 changed files with 15 additions and 2 deletions

View file

@ -2265,6 +2265,7 @@ static int lib_sSpeedMusic(lua_State *L)
return 1;
}
#ifdef HAVE_LUA_MUSICPLUS
static int lib_sSetMusicPosition(lua_State *L)
{
UINT32 position = 0;
@ -2470,7 +2471,7 @@ static int lib_sMusicExists(lua_State *L)
lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi));
return 1;
}
#endif
static int lib_sOriginPlaying(lua_State *L)
{
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -2848,6 +2849,7 @@ static luaL_Reg lib[] = {
{"S_StopSound",lib_sStopSound},
{"S_ChangeMusic",lib_sChangeMusic},
{"S_SpeedMusic",lib_sSpeedMusic},
#ifdef HAVE_LUA_MUSICPLUS
{"S_SetMusicPosition",lib_sSetMusicPosition},
{"S_GetMusicPosition",lib_sGetMusicPosition},
{"S_PauseMusic",lib_sPauseMusic},
@ -2859,6 +2861,7 @@ static luaL_Reg lib[] = {
{"S_MusicPaused",lib_sMusicPaused},
{"S_MusicName",lib_sMusicName},
{"S_MusicExists",lib_sMusicExists},
#endif
{"S_OriginPlaying",lib_sOriginPlaying},
{"S_IdPlaying",lib_sIdPlaying},
{"S_SoundPlaying",lib_sSoundPlaying},

View file

@ -88,6 +88,8 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8
#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following
#ifdef HAVE_LUA_MUSICPLUS
boolean LUAh_MusicChange(const char *oldname, const char *newname, char *newmusic, UINT16 *mflags, boolean *looping); // Hook for music changes
#endif
#endif

View file

@ -1192,6 +1192,9 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
lua_settop(gL, 0);
return hooked;
}
#ifdef HAVE_LUA_MUSICPLUS
// Hook for music changes
boolean LUAh_MusicChange(const char *oldname, const char *newname, char *newmusic, UINT16 *mflags, boolean *looping)
{
@ -1241,3 +1244,5 @@ boolean LUAh_MusicChange(const char *oldname, const char *newname, char *newmusi
}
#endif
#endif

View file

@ -97,4 +97,7 @@ void COM_Lua_f(void);
// uncomment if you want seg_t/node_t in Lua
// #define HAVE_LUA_SEGS
// uncomment for extended music features
// #define HAVE_LUA_MUSICPLUS
#endif

View file

@ -1385,7 +1385,7 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
return;
char newmusic[7];
#ifdef HAVE_BLUA
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
if(LUAh_MusicChange(music_name, mmusic, newmusic, &mflags, &looping))
return;
#else