diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f62ba12aadb73c908b470750ad6a4a3e891932e7..d6aeb9a31726ae191e1fd8e5397c0bfd9aba1009 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -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}, diff --git a/src/lua_hook.h b/src/lua_hook.h index 6df58bbc67eb409fa211a900cd36fc22d3f1d90d..8249bacfcab61bd6217aadb3f240ce6c00c51f77 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -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 diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index e67ba90406f412e257f2b447dd93548e0a17a383..aeecf807175e71577b2224fb922d6939cd98a296 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -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 diff --git a/src/lua_script.h b/src/lua_script.h index 51f1eaeaaeb4d00b4c55721aa4ae8fad165cd185..ce95ae6f0611215dde17bad2bb76a5df53138e0d 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -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 diff --git a/src/s_sound.c b/src/s_sound.c index 3dab5261a919289c4291d5f6c021301d0036ac9f..bd27e4da26d2594673f968f541a19e0c343aa0a4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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