mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
* Correct V_PERPLAYER's screen-centered (no snapto flags on a given axis) behaviour.
* Fix that one comment Digiku mentioned. ;P * Make extra lives/100 ring rewards consistent between lives being relevant and lives being infinite/not present, which was a problem this branch made evident when Race ended up getting the infinite lives symbol!
This commit is contained in:
parent
3c74952522
commit
15903c6271
5 changed files with 145 additions and 23 deletions
|
@ -3243,14 +3243,7 @@ void A_ExtraLife(mobj_t *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
// In shooter gametypes, give the player 100 rings instead of an extra life.
|
||||
if (gametype != GT_COOP && gametype != GT_COMPETITION)
|
||||
{
|
||||
P_GivePlayerRings(player, 100);
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
else
|
||||
P_GiveCoopLives(player, 1, true);
|
||||
P_GiveCoopLives(player, 1, true);
|
||||
}
|
||||
|
||||
// Function: A_GiveShield
|
||||
|
|
44
src/p_user.c
44
src/p_user.c
|
@ -909,8 +909,12 @@ void P_ResetPlayer(player_t *player)
|
|||
// Gives rings to the player, and does any special things required.
|
||||
// Call this function when you want to increment the player's health.
|
||||
//
|
||||
|
||||
void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player->bot)
|
||||
player = &players[consoleplayer];
|
||||
|
||||
|
@ -929,7 +933,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
|||
player->rings = 0;
|
||||
|
||||
// Now extra life bonuses are handled here instead of in P_MovePlayer, since why not?
|
||||
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
|
||||
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives() && player->lives != 0x7f)
|
||||
{
|
||||
INT32 gainlives = 0;
|
||||
|
||||
|
@ -941,7 +945,12 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
|||
|
||||
if (gainlives)
|
||||
{
|
||||
P_GivePlayerLives(player, gainlives);
|
||||
player->lives += gainlives;
|
||||
if (player->lives > 99)
|
||||
player->lives = 99;
|
||||
else if (player->lives < 1)
|
||||
player->lives = 1;
|
||||
|
||||
P_PlayLivesJingle(player);
|
||||
}
|
||||
}
|
||||
|
@ -955,7 +964,30 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
|||
//
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives)
|
||||
{
|
||||
if (player->lives == 0x7f) return;
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player->bot)
|
||||
player = &players[consoleplayer];
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
if (player->lives == 0x7f || (gametype != GT_COOP && gametype != GT_COMPETITION))
|
||||
{
|
||||
P_GivePlayerRings(player, 100*numlives);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0)
|
||||
{
|
||||
UINT8 prevlives = player->lives;
|
||||
P_GivePlayerRings(player, 100*numlives);
|
||||
if (player->lives - prevlives >= numlives)
|
||||
return;
|
||||
|
||||
numlives = (numlives + prevlives - player->lives);
|
||||
}
|
||||
}
|
||||
|
||||
player->lives += numlives;
|
||||
|
||||
|
@ -1159,11 +1191,7 @@ void P_PlayLivesJingle(player_t *player)
|
|||
if (player && !P_IsLocalPlayer(player))
|
||||
return;
|
||||
|
||||
if ((player && player->lives == 0x7f)
|
||||
|| (!player && &players[consoleplayer] && players[consoleplayer].lives == 0x7f)
|
||||
|| (gametype == GT_COOP && (netgame || multiplayer) && cv_cooplives.value == 0))
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
else if (use1upSound)
|
||||
if (use1upSound)
|
||||
S_StartSound(NULL, sfx_oneup);
|
||||
else if (mariomode)
|
||||
S_StartSound(NULL, sfx_marioa);
|
||||
|
|
|
@ -776,7 +776,7 @@ static void ST_drawLivesArea(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
livescount = ((cv_cooplives.value == 0) ? 0x7f : stplyr->lives);
|
||||
livescount = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0x7f : stplyr->lives);
|
||||
notgreyedout = true;
|
||||
}
|
||||
|
||||
|
|
102
src/v_video.c
102
src/v_video.c
|
@ -542,6 +542,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
fixed_t pwidth; // patch width
|
||||
fixed_t offx = 0; // x offset
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
|
@ -639,19 +641,37 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
colfrac <<= 1;
|
||||
x >>= 1;
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
else if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||
}
|
||||
else if (stplyr == &players[thirddisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
y += adjusty;
|
||||
scrn &= ~V_SNAPTOTOP|V_SNAPTORIGHT;
|
||||
}
|
||||
else //if (stplyr == &players[fourthdisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
y += adjusty;
|
||||
scrn &= ~V_SNAPTOTOP|V_SNAPTOLEFT;
|
||||
|
@ -662,9 +682,15 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
// 2 players
|
||||
{
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle = 1;
|
||||
scrn &= ~V_SNAPTOBOTTOM;
|
||||
}
|
||||
else //if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle = 2;
|
||||
y += adjusty;
|
||||
scrn &= ~V_SNAPTOTOP;
|
||||
}
|
||||
|
@ -710,6 +736,10 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
x += (vid.width - (BASEVIDWIDTH * dupx));
|
||||
else if (!(scrn & V_SNAPTOLEFT))
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
||||
if (perplayershuffle & 4)
|
||||
x -= (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
else if (perplayershuffle & 8)
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
{
|
||||
|
@ -718,6 +748,10 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
y += (vid.height - (BASEVIDHEIGHT * dupy));
|
||||
else if (!(scrn & V_SNAPTOTOP))
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||
if (perplayershuffle & 1)
|
||||
y -= (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
else if (perplayershuffle & 2)
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -792,6 +826,8 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
UINT8 *desttop, *dest;
|
||||
const UINT8 *source, *deststop;
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
|
@ -852,21 +888,39 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
sx >>= 1;
|
||||
w >>= 1;
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
else if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
sx += adjustx;
|
||||
scrn &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||
}
|
||||
else if (stplyr == &players[thirddisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
y += adjusty;
|
||||
sy += adjusty;
|
||||
scrn &= ~V_SNAPTOTOP|V_SNAPTORIGHT;
|
||||
}
|
||||
else //if (stplyr == &players[fourthdisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(scrn & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
sx += adjustx;
|
||||
y += adjusty;
|
||||
|
@ -879,9 +933,15 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
// 2 players
|
||||
{
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
scrn &= ~V_SNAPTOBOTTOM;
|
||||
}
|
||||
else //if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(scrn & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
y += adjusty;
|
||||
sy += adjusty;
|
||||
scrn &= ~V_SNAPTOTOP;
|
||||
|
@ -927,6 +987,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
x += (vid.width - (BASEVIDWIDTH * dupx));
|
||||
else if (!(scrn & V_SNAPTOLEFT))
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
||||
if (perplayershuffle & 4)
|
||||
x -= (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
else if (perplayershuffle & 8)
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
{
|
||||
|
@ -935,6 +999,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
y += (vid.height - (BASEVIDHEIGHT * dupy));
|
||||
else if (!(scrn & V_SNAPTOTOP))
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||
if (perplayershuffle & 1)
|
||||
y -= (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
else if (perplayershuffle & 2)
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1081,6 +1149,8 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
|
@ -1104,19 +1174,37 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
w >>= 1;
|
||||
x >>= 1;
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(c & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
c &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT;
|
||||
}
|
||||
else if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
if (!(c & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
c &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT;
|
||||
}
|
||||
else if (stplyr == &players[thirddisplayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(c & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 4;
|
||||
y += adjusty;
|
||||
c &= ~V_SNAPTOTOP|V_SNAPTORIGHT;
|
||||
}
|
||||
else //if (stplyr == &players[fourthdisplayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
if (!(c & (V_SNAPTOLEFT|V_SNAPTORIGHT)))
|
||||
perplayershuffle |= 8;
|
||||
x += adjustx;
|
||||
y += adjusty;
|
||||
c &= ~V_SNAPTOTOP|V_SNAPTOLEFT;
|
||||
|
@ -1127,9 +1215,15 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
// 2 players
|
||||
{
|
||||
if (stplyr == &players[displayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 1;
|
||||
c &= ~V_SNAPTOBOTTOM;
|
||||
}
|
||||
else //if (stplyr == &players[secondarydisplayplayer])
|
||||
{
|
||||
if (!(c & (V_SNAPTOTOP|V_SNAPTOBOTTOM)))
|
||||
perplayershuffle |= 2;
|
||||
y += adjusty;
|
||||
c &= ~V_SNAPTOTOP;
|
||||
}
|
||||
|
@ -1160,6 +1254,10 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
x += (vid.width - (BASEVIDWIDTH * dupx));
|
||||
else if (!(c & V_SNAPTOLEFT))
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
|
||||
if (perplayershuffle & 4)
|
||||
x -= (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
else if (perplayershuffle & 8)
|
||||
x += (vid.width - (BASEVIDWIDTH * dupx)) / 4;
|
||||
}
|
||||
if (vid.height != BASEVIDHEIGHT * dupy)
|
||||
{
|
||||
|
@ -1168,6 +1266,10 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
y += (vid.height - (BASEVIDHEIGHT * dupy));
|
||||
else if (!(c & V_SNAPTOTOP))
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
|
||||
if (perplayershuffle & 1)
|
||||
y -= (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
else if (perplayershuffle & 2)
|
||||
y += (vid.height - (BASEVIDHEIGHT * dupy)) / 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -858,7 +858,7 @@ void Y_Ticker(void)
|
|||
tallydonetic = -1;
|
||||
}
|
||||
|
||||
if (intertic < 2*TICRATE) // one second pause before tally begins
|
||||
if (intertic < 2*TICRATE) // TWO second pause before tally begins, thank you mazmazz
|
||||
return;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -1822,13 +1822,13 @@ static void Y_AwardCoopBonuses(void)
|
|||
players[i].score = MAXSCORE;
|
||||
}
|
||||
|
||||
ptlives = (!ultimatemode && !modeattacking) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0;
|
||||
ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0;
|
||||
if (ptlives)
|
||||
P_GivePlayerLives(&players[i], ptlives);
|
||||
|
||||
if (i == consoleplayer)
|
||||
{
|
||||
data.coop.gotlife = ptlives;
|
||||
data.coop.gotlife = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0 : ptlives);
|
||||
M_Memcpy(&data.coop.bonuses, &localbonuses, sizeof(data.coop.bonuses));
|
||||
}
|
||||
}
|
||||
|
@ -1866,16 +1866,15 @@ static void Y_AwardSpecialStageBonus(void)
|
|||
players[i].score = MAXSCORE;
|
||||
|
||||
// grant extra lives right away since tally is faked
|
||||
ptlives = (!ultimatemode && !modeattacking) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0;
|
||||
ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0;
|
||||
if (ptlives)
|
||||
P_GivePlayerLives(&players[i], ptlives);
|
||||
|
||||
if (i == consoleplayer)
|
||||
{
|
||||
data.spec.gotlife = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0 : ptlives);
|
||||
M_Memcpy(&data.spec.bonus, &localbonus, sizeof(data.spec.bonus));
|
||||
|
||||
data.spec.gotlife = ptlives;
|
||||
|
||||
// Continues related
|
||||
data.spec.continues = min(players[i].continues, 8);
|
||||
if (players[i].gotcontinue)
|
||||
|
|
Loading…
Reference in a new issue