From fac8f7f5388540fe34ebebca5bbaa4b9b2d292a0 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 3 Jun 2020 16:34:23 -0400 Subject: [PATCH] You get 1ups for carrying rings to the goal --- src/g_game.c | 2 ++ src/p_setup.c | 4 +++- src/p_user.c | 20 +++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index bd9ebfcf6..2716dcd3d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4642,6 +4642,8 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool if (resetplayer && !(multiplayer && demo.playback)) // SRB2Kart { players[i].lives = 3; + players[i].xtralife = 0; + players[i].totalring = 0; players[i].score = 0; } } diff --git a/src/p_setup.c b/src/p_setup.c index 2f73f38cb..b975e1238 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2421,6 +2421,8 @@ static void P_LevelInitStuff(void) if (grandprixinfo.roundnum == 0) { players[i].lives = 3; + players[i].xtralife = 0; + players[i].totalring = 0; } players[i].realtime = racecountdown = exitcountdown = 0; @@ -2429,7 +2431,7 @@ static void P_LevelInitStuff(void) players[i].lostlife = false; players[i].gotcontinue = false; - players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0; + players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0; players[i].health = 1; players[i].aiming = 0; players[i].pflags &= ~PF_TIMEOVER; diff --git a/src/p_user.c b/src/p_user.c index 7ff53aaed..259d156a8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -949,7 +949,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) return; player->kartstuff[k_rings] += num_rings; - //player->totalring += num_rings; // Used for GP lives later if (player->kartstuff[k_rings] > 20) player->kartstuff[k_rings] = 20; // Caps at 20 rings, sorry! @@ -967,8 +966,8 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) { player->lives += numlives; - if (player->lives > 99) - player->lives = 99; + if (player->lives > 9) + player->lives = 9; else if (player->lives < 1) player->lives = 1; } @@ -1748,8 +1747,23 @@ void P_DoPlayerExit(player_t *player) } else if (!losing) { + const UINT8 lifethreshold = 20; + UINT8 extra = 0; + // YOU WIN grandprixinfo.wonround = true; + + // Increase your total rings + player->totalring += RINGTOTAL(player); + + extra = player->totalring / lifethreshold; + + if (extra > player->xtralife) + { + P_GivePlayerLives(player, extra - player->xtralife); + S_StartSound(NULL, sfx_cdfm73); + player->xtralife = extra; + } } }