mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Merge branch 'musicplus-core' into musicplus-sdlmixerx
This commit is contained in:
commit
08efe2aa24
9 changed files with 13 additions and 489 deletions
|
|
@ -4056,7 +4056,7 @@ static void Command_Tunes_f(void)
|
||||||
mapmusflags = (track & MUSIC_TRACKMASK);
|
mapmusflags = (track & MUSIC_TRACKMASK);
|
||||||
mapmusposition = position;
|
mapmusposition = position;
|
||||||
|
|
||||||
S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||||
|
|
||||||
if (argc > 3)
|
if (argc > 3)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1831,7 +1831,7 @@ static void F_AdvanceToNextScene(void)
|
||||||
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
|
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
|
||||||
|
|
||||||
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
|
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
|
||||||
S_ChangeMusicAdvanced(cutscenes[cutnum]->scene[scenenum].musswitch,
|
S_ChangeMusicEx(cutscenes[cutnum]->scene[scenenum].musswitch,
|
||||||
cutscenes[cutnum]->scene[scenenum].musswitchflags,
|
cutscenes[cutnum]->scene[scenenum].musswitchflags,
|
||||||
cutscenes[cutnum]->scene[scenenum].musicloop,
|
cutscenes[cutnum]->scene[scenenum].musicloop,
|
||||||
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
|
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
|
||||||
|
|
@ -1905,7 +1905,7 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
|
||||||
stoptimer = 0;
|
stoptimer = 0;
|
||||||
|
|
||||||
if (cutscenes[cutnum]->scene[0].musswitch[0])
|
if (cutscenes[cutnum]->scene[0].musswitch[0])
|
||||||
S_ChangeMusicAdvanced(cutscenes[cutnum]->scene[0].musswitch,
|
S_ChangeMusicEx(cutscenes[cutnum]->scene[0].musswitch,
|
||||||
cutscenes[cutnum]->scene[0].musswitchflags,
|
cutscenes[cutnum]->scene[0].musswitchflags,
|
||||||
cutscenes[cutnum]->scene[0].musicloop,
|
cutscenes[cutnum]->scene[0].musicloop,
|
||||||
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
|
cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -2242,7 +2242,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||||
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
if (!player || P_IsLocalPlayer(player))
|
||||||
{
|
{
|
||||||
S_ChangeMusicAdvanced(music_name, music_flags, looping, position, prefadems, fadeinms);
|
S_ChangeMusicEx(music_name, music_flags, looping, position, prefadems, fadeinms);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2269,392 +2269,6 @@ static int lib_sSpeedMusic(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LUA_MUSICPLUS
|
|
||||||
static int lib_sMusicType(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushinteger(L, S_MusicType());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sMusicPlaying(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushboolean(L, S_MusicPlaying());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sMusicPaused(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushboolean(L, S_MusicPaused());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sMusicName(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushstring(L, S_MusicName());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sMusicInfo(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
char mname[7];
|
|
||||||
UINT16 mflags;
|
|
||||||
boolean looping;
|
|
||||||
if (S_MusicInfo(mname, &mflags, &looping))
|
|
||||||
{
|
|
||||||
lua_pushstring(L, mname);
|
|
||||||
lua_pushinteger(L, mflags);
|
|
||||||
lua_pushboolean(L, looping);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushboolean(L, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sMusicExists(lua_State *L)
|
|
||||||
{
|
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
|
||||||
const char *music_name;
|
|
||||||
UINT32 music_num;
|
|
||||||
char music_compat_name[7];
|
|
||||||
UINT16 music_flags = 0;
|
|
||||||
NOHUD
|
|
||||||
if (lua_isnumber(L, 1))
|
|
||||||
{
|
|
||||||
music_num = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
music_flags = (UINT16)(music_num & 0x0000FFFF);
|
|
||||||
if (music_flags && music_flags <= 1035)
|
|
||||||
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
|
|
||||||
else if (music_flags && music_flags <= 1050)
|
|
||||||
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
|
|
||||||
else
|
|
||||||
music_compat_name[0] = 0; // becomes empty string
|
|
||||||
music_compat_name[6] = 0;
|
|
||||||
music_name = (const char *)&music_compat_name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
music_num = 0;
|
|
||||||
music_name = luaL_checkstring(L, 1);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
const char *music_name = luaL_checkstring(L, 1);
|
|
||||||
#endif
|
|
||||||
boolean checkMIDI = lua_opttrueboolean(L, 2);
|
|
||||||
boolean checkDigi = lua_opttrueboolean(L, 3);
|
|
||||||
NOHUD
|
|
||||||
lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sGetMusicLength(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushinteger(L, (int)S_GetMusicLength());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sSetMusicLoopPoint(lua_State *L)
|
|
||||||
{
|
|
||||||
UINT32 looppoint = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushboolean(L, S_SetMusicLoopPoint(looppoint));
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sGetMusicLoopPoint(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushinteger(L, (int)S_GetMusicLoopPoint());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sSetMusicPosition(lua_State *L)
|
|
||||||
{
|
|
||||||
UINT32 position = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushboolean(L, S_SetMusicPosition(position));
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sGetMusicPosition(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushinteger(L, (int)S_GetMusicPosition());
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sStopMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
S_StopMusic();
|
|
||||||
lua_pushboolean(L, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sPauseMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
S_PauseAudio();
|
|
||||||
lua_pushboolean(L, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sResumeMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
S_ResumeAudio();
|
|
||||||
lua_pushboolean(L, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sSetInternalMusicVolume(lua_State *L)
|
|
||||||
{
|
|
||||||
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
S_SetInternalMusicVolume(volume);
|
|
||||||
lua_pushboolean(L, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sStopFadingMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
S_StopFadingMusic();
|
|
||||||
lua_pushboolean(L, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sFadeMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
UINT32 target_volume = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
UINT32 ms;
|
|
||||||
INT32 source_volume;
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
ms = (UINT32)luaL_checkinteger(L, 2);
|
|
||||||
source_volume = -1;
|
|
||||||
}
|
|
||||||
else if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
source_volume = (INT32)luaL_checkinteger(L, 2);
|
|
||||||
ms = (UINT32)luaL_checkinteger(L, 3);
|
|
||||||
}
|
|
||||||
else if (luaL_optinteger(L, 3, UINT32_MAX) == UINT32_MAX)
|
|
||||||
{
|
|
||||||
ms = (UINT32)luaL_checkinteger(L, 2);
|
|
||||||
source_volume = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
source_volume = (INT32)luaL_checkinteger(L, 2);
|
|
||||||
ms = (UINT32)luaL_checkinteger(L, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
NOHUD
|
|
||||||
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
lua_pushboolean(L, S_FadeMusicFromVolume(target_volume, source_volume, ms));
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_sFadeOutStopMusic(lua_State *L)
|
|
||||||
{
|
|
||||||
UINT32 ms = (UINT32)luaL_checkinteger(L, 1);
|
|
||||||
player_t *player = NULL;
|
|
||||||
NOHUD
|
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
|
||||||
{
|
|
||||||
lua_pushboolean(L, S_FadeOutStopMusic(ms));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
static int lib_sOriginPlaying(lua_State *L)
|
static int lib_sOriginPlaying(lua_State *L)
|
||||||
{
|
{
|
||||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
|
@ -3032,26 +2646,6 @@ static luaL_Reg lib[] = {
|
||||||
{"S_StopSound",lib_sStopSound},
|
{"S_StopSound",lib_sStopSound},
|
||||||
{"S_ChangeMusic",lib_sChangeMusic},
|
{"S_ChangeMusic",lib_sChangeMusic},
|
||||||
{"S_SpeedMusic",lib_sSpeedMusic},
|
{"S_SpeedMusic",lib_sSpeedMusic},
|
||||||
#ifdef HAVE_LUA_MUSICPLUS
|
|
||||||
{"S_MusicType",lib_sMusicType},
|
|
||||||
{"S_MusicPlaying",lib_sMusicPlaying},
|
|
||||||
{"S_MusicPaused",lib_sMusicPaused},
|
|
||||||
{"S_MusicName",lib_sMusicName},
|
|
||||||
{"S_MusicInfo",lib_sMusicInfo},
|
|
||||||
{"S_MusicExists",lib_sMusicExists},
|
|
||||||
{"S_GetMusicLength",lib_sGetMusicLength},
|
|
||||||
{"S_SetMusicLoopPoint",lib_sSetMusicLoopPoint},
|
|
||||||
{"S_GetMusicLoopPoint",lib_sGetMusicLoopPoint},
|
|
||||||
{"S_SetMusicPosition",lib_sSetMusicPosition},
|
|
||||||
{"S_GetMusicPosition",lib_sGetMusicPosition},
|
|
||||||
{"S_PauseMusic",lib_sPauseMusic},
|
|
||||||
{"S_ResumeMusic",lib_sResumeMusic},
|
|
||||||
{"S_StopMusic",lib_sStopMusic},
|
|
||||||
{"S_SetInternalMusicVolume", lib_sSetInternalMusicVolume},
|
|
||||||
{"S_StopFadingMusic",lib_sStopFadingMusic},
|
|
||||||
{"S_FadeMusic",lib_sFadeMusic},
|
|
||||||
{"S_FadeOutStopMusic",lib_sFadeOutStopMusic},
|
|
||||||
#endif
|
|
||||||
{"S_OriginPlaying",lib_sOriginPlaying},
|
{"S_OriginPlaying",lib_sOriginPlaying},
|
||||||
{"S_IdPlaying",lib_sIdPlaying},
|
{"S_IdPlaying",lib_sIdPlaying},
|
||||||
{"S_SoundPlaying",lib_sSoundPlaying},
|
{"S_SoundPlaying",lib_sSoundPlaying},
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,5 @@ 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)
|
#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_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
|
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, char *newname, UINT16 *mflags, boolean *looping,
|
|
||||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1193,67 +1193,4 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LUA_MUSICPLUS
|
|
||||||
|
|
||||||
// Hook for music changes
|
|
||||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
|
|
||||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms)
|
|
||||||
{
|
|
||||||
hook_p hookp;
|
|
||||||
boolean hooked = false;
|
|
||||||
|
|
||||||
if (!gL || !(hooksAvailable[hook_MusicChange/8] & (1<<(hook_MusicChange%8))))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
lua_settop(gL, 0);
|
|
||||||
|
|
||||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
|
||||||
if (hookp->type == hook_MusicChange)
|
|
||||||
{
|
|
||||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
|
||||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
|
||||||
lua_pushstring(gL, oldname);
|
|
||||||
lua_pushstring(gL, newname);
|
|
||||||
lua_pushinteger(gL, *mflags);
|
|
||||||
lua_pushboolean(gL, *looping);
|
|
||||||
lua_pushinteger(gL, *position);
|
|
||||||
lua_pushinteger(gL, *prefadems);
|
|
||||||
lua_pushinteger(gL, *fadeinms);
|
|
||||||
if (lua_pcall(gL, 7, 6, 0)) {
|
|
||||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
|
|
||||||
lua_pop(gL, 1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// output 1: true, false, or string musicname override
|
|
||||||
if (lua_isboolean(gL, -6) && lua_toboolean(gL, -6))
|
|
||||||
hooked = true;
|
|
||||||
else if (lua_isstring(gL, -6))
|
|
||||||
strncpy(newname, lua_tostring(gL, -6), 7);
|
|
||||||
// output 2: mflags override
|
|
||||||
if (lua_isnumber(gL, -5))
|
|
||||||
*mflags = lua_tonumber(gL, -5);
|
|
||||||
// output 3: looping override
|
|
||||||
if (lua_isboolean(gL, -4))
|
|
||||||
*looping = lua_toboolean(gL, -4);
|
|
||||||
// output 4: position override
|
|
||||||
if (lua_isboolean(gL, -3))
|
|
||||||
*position = lua_tonumber(gL, -3);
|
|
||||||
// output 5: prefadems override
|
|
||||||
if (lua_isboolean(gL, -2))
|
|
||||||
*prefadems = lua_tonumber(gL, -2);
|
|
||||||
// output 6: fadeinms override
|
|
||||||
if (lua_isboolean(gL, -1))
|
|
||||||
*fadeinms = lua_tonumber(gL, -1);
|
|
||||||
|
|
||||||
lua_pop(gL, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_settop(gL, 0);
|
|
||||||
newname[6] = 0;
|
|
||||||
return hooked;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,4 @@ void COM_Lua_f(void);
|
||||||
// uncomment if you want seg_t/node_t in Lua
|
// uncomment if you want seg_t/node_t in Lua
|
||||||
// #define HAVE_LUA_SEGS
|
// #define HAVE_LUA_SEGS
|
||||||
|
|
||||||
// uncomment for extended music features
|
|
||||||
#define HAVE_LUA_MUSICPLUS
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1277,13 +1277,13 @@ void P_RestoreMusic(player_t *player)
|
||||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)
|
if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)
|
||||||
{
|
{
|
||||||
S_SpeedMusic(1.4f);
|
S_SpeedMusic(1.4f);
|
||||||
S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_ChangeMusicInternal("_shoes", true);
|
S_ChangeMusicInternal("_shoes", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1551,11 +1551,11 @@ static void S_ClearQueue(void)
|
||||||
|
|
||||||
static void S_ChangeMusicToQueue(void)
|
static void S_ChangeMusicToQueue(void)
|
||||||
{
|
{
|
||||||
S_ChangeMusicAdvanced(queue_name, queue_flags, queue_looping, queue_position, 0, queue_fadeinms);
|
S_ChangeMusicEx(queue_name, queue_flags, queue_looping, queue_position, 0, queue_fadeinms);
|
||||||
S_ClearQueue();
|
S_ClearQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_ChangeMusicAdvanced(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms)
|
void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms)
|
||||||
{
|
{
|
||||||
if (S_MusicDisabled())
|
if (S_MusicDisabled())
|
||||||
return;
|
return;
|
||||||
|
|
@ -1742,5 +1742,5 @@ void S_StartEx(boolean reset)
|
||||||
|
|
||||||
if (cv_resetmusic.value || reset)
|
if (cv_resetmusic.value || reset)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,9 +183,9 @@ UINT32 S_GetMusicPosition(void);
|
||||||
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
|
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
|
||||||
// 13-15 aren't used yet
|
// 13-15 aren't used yet
|
||||||
// and the last bit we ignore (internal game flag for resetting music on reload)
|
// and the last bit we ignore (internal game flag for resetting music on reload)
|
||||||
void S_ChangeMusicAdvanced(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms);
|
void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms);
|
||||||
#define S_ChangeMusicInternal(a,b) S_ChangeMusicAdvanced(a,0,b,0,0,0)
|
#define S_ChangeMusicInternal(a,b) S_ChangeMusicEx(a,0,b,0,0,0)
|
||||||
#define S_ChangeMusic(a,b,c) S_ChangeMusicAdvanced(a,b,c,0,0,0)
|
#define S_ChangeMusic(a,b,c) S_ChangeMusicEx(a,b,c,0,0,0)
|
||||||
|
|
||||||
// Stops the music.
|
// Stops the music.
|
||||||
void S_StopMusic(void);
|
void S_StopMusic(void);
|
||||||
|
|
@ -202,7 +202,7 @@ void S_SetInternalMusicVolume(INT32 volume);
|
||||||
void S_StopFadingMusic(void);
|
void S_StopFadingMusic(void);
|
||||||
boolean S_FadeMusicFromVolume(UINT8 target_volume, INT16 source_volume, UINT32 ms);
|
boolean S_FadeMusicFromVolume(UINT8 target_volume, INT16 source_volume, UINT32 ms);
|
||||||
#define S_FadeMusic(a, b) S_FadeMusicFromVolume(a, -1, b)
|
#define S_FadeMusic(a, b) S_FadeMusicFromVolume(a, -1, b)
|
||||||
#define S_FadeInChangeMusic(a,b,c,d) S_ChangeMusicAdvanced(a,b,c,0,0,d)
|
#define S_FadeInChangeMusic(a,b,c,d) S_ChangeMusicEx(a,b,c,0,0,d)
|
||||||
boolean S_FadeOutStopMusic(UINT32 ms);
|
boolean S_FadeOutStopMusic(UINT32 ms);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue