mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-18 10:31:42 +00:00
Lua PositionMusic/GetPositionMusic and console TUNES position
This commit is contained in:
parent
c6f63d9e9b
commit
eab4d6b989
2 changed files with 27 additions and 4 deletions
|
@ -3983,7 +3983,7 @@ static void Command_Tunes_f(void)
|
||||||
|
|
||||||
if (argc < 2) //tunes slot ...
|
if (argc < 2) //tunes slot ...
|
||||||
{
|
{
|
||||||
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
CONS_Printf("tunes <name/num> [track] [speed] [position] / <-show> / <-default> / <-none>:\n");
|
||||||
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
||||||
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
||||||
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
||||||
|
@ -4041,15 +4041,12 @@ static void Command_Tunes_f(void)
|
||||||
if (speed > 0.0f)
|
if (speed > 0.0f)
|
||||||
S_SpeedMusic(speed);
|
S_SpeedMusic(speed);
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
if (argc > 4)
|
if (argc > 4)
|
||||||
{
|
{
|
||||||
UINT32 position = (UINT32)atoi(COM_Argv(4));
|
UINT32 position = (UINT32)atoi(COM_Argv(4));
|
||||||
S_PositionMusic(position);
|
S_PositionMusic(position);
|
||||||
}
|
}
|
||||||
>>>>>>> f453fb65... Change get/set music position to UINT32 parameter, milliseconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Command_RestartAudio_f(void)
|
static void Command_RestartAudio_f(void)
|
||||||
|
|
|
@ -2255,6 +2255,30 @@ static int lib_sSpeedMusic(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_sPositionMusic(lua_State *L)
|
||||||
|
{
|
||||||
|
float position = 0;
|
||||||
|
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_PositionMusic(position));
|
||||||
|
else
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_sGetPositionMusic(lua_State *L)
|
||||||
|
{
|
||||||
|
lua_pushinteger(L, (UINT32)S_GetPositionMusic());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_sStopMusic(lua_State *L)
|
static int lib_sStopMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
|
@ -2677,6 +2701,8 @@ 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},
|
||||||
|
{"S_PositionMusic",lib_sPositionMusic},
|
||||||
|
{"S_GetPositionMusic",lib_sGetPositionMusic},
|
||||||
{"S_StopMusic",lib_sStopMusic},
|
{"S_StopMusic",lib_sStopMusic},
|
||||||
{"S_MidiPlaying",lib_sMidiPlaying},
|
{"S_MidiPlaying",lib_sMidiPlaying},
|
||||||
{"S_MusicPlaying",lib_sMusicPlaying},
|
{"S_MusicPlaying",lib_sMusicPlaying},
|
||||||
|
|
Loading…
Reference in a new issue