mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
* Per Mystic's request, made lives for 100 rings individual.
* P_GiveCoopLives bundles the coop lives reward for everyone versus reward for one person in other gametypes thing into one function. Available in Lua.
This commit is contained in:
parent
fd873185ae
commit
2f3e4c3c65
4 changed files with 41 additions and 36 deletions
|
@ -978,6 +978,19 @@ static int lib_pGivePlayerLives(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pGiveCoopLives(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
INT32 numlives = (INT32)luaL_checkinteger(L, 2);
|
||||
boolean sound = (boolean)lua_opttrueboolean(L, 3);
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_GiveCoopLives(player, numlives, sound);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pResetScore(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2428,6 +2441,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
|
||||
{"P_GivePlayerRings",lib_pGivePlayerRings},
|
||||
{"P_GivePlayerLives",lib_pGivePlayerLives},
|
||||
{"P_GiveCoopLives",lib_pGiveCoopLives},
|
||||
{"P_ResetScore",lib_pResetScore},
|
||||
{"P_DoJumpShield",lib_pDoJumpShield},
|
||||
{"P_DoBubbleBounce",lib_pDoBubbleBounce},
|
||||
|
|
|
@ -3285,25 +3285,7 @@ void A_ExtraLife(mobj_t *actor)
|
|||
P_PlayLivesJingle(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!((netgame || multiplayer) && gametype == GT_COOP))
|
||||
{
|
||||
P_GivePlayerLives(player, 1);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
P_GivePlayerLives(&players[i], 1);
|
||||
P_PlayLivesJingle(&players[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
P_GiveCoopLives(player, 1, true);
|
||||
}
|
||||
|
||||
// Function: A_BombShield
|
||||
|
|
|
@ -148,6 +148,7 @@ void P_SwitchShield(player_t *player, UINT16 shieldtype);
|
|||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||
void P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives);
|
||||
void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound);
|
||||
UINT8 P_GetNextEmerald(void);
|
||||
void P_GiveEmerald(boolean spawnObj);
|
||||
#if 0
|
||||
|
|
42
src/p_user.c
42
src/p_user.c
|
@ -933,23 +933,8 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
|||
|
||||
if (gainlives)
|
||||
{
|
||||
if (!((netgame || multiplayer) && gametype == GT_COOP))
|
||||
{
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
P_GivePlayerLives(&players[i], gainlives);
|
||||
P_PlayLivesJingle(&players[i]);
|
||||
}
|
||||
}
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -970,6 +955,29 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
|
|||
player->lives = 1;
|
||||
}
|
||||
|
||||
void P_GiveCoopLives(player_t player, INT32 numlives, boolean sound)
|
||||
{
|
||||
if (!((netgame || multiplayer) && gametype == GT_COOP && cv_playstyle.value))
|
||||
{
|
||||
P_GivePlayerLives(player, 1);
|
||||
if (sound)
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
P_GivePlayerLives(&players[i], 1);
|
||||
if (sound)
|
||||
P_PlayLivesJingle(&players[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_DoSuperTransformation
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue