mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Make P_PlayLivesJingle player optional in Lua
This commit is contained in:
parent
283bb52e7d
commit
40488096c0
2 changed files with 9 additions and 5 deletions
|
@ -1674,11 +1674,15 @@ static int lib_pPlayVictorySound(lua_State *L)
|
|||
|
||||
static int lib_pPlayLivesJingle(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
player_t *player = NULL;
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
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");
|
||||
}
|
||||
P_PlayLivesJingle(player);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ void P_GiveFinishFlags(player_t *player)
|
|||
mobj_t* flag = P_SpawnMobjFromMobj(player->mo, xoffs, yoffs, 0, MT_FINISHFLAG);
|
||||
flag->angle = angle;
|
||||
angle += FixedAngle(120*FRACUNIT);
|
||||
|
||||
|
||||
P_SetTarget(&flag->target, player->mo);
|
||||
}
|
||||
}
|
||||
|
@ -1533,7 +1533,7 @@ void P_PlayJingle(player_t *player, jingletype_t jingletype)
|
|||
void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status)
|
||||
{
|
||||
// If gamestate != GS_LEVEL, always play the jingle (1-up intermission)
|
||||
if (gamestate == GS_LEVEL && !P_IsLocalPlayer(player))
|
||||
if (gamestate == GS_LEVEL && player && !P_IsLocalPlayer(player))
|
||||
return;
|
||||
|
||||
S_RetainMusic(musname, musflags, looping, 0, status);
|
||||
|
|
Loading…
Reference in a new issue