From 922f80b22f394e5fb59b1032d5ae70de74cb3f02 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 04:30:41 -0500 Subject: [PATCH 1/8] Uncap player-count item distribution modifiers Was an idea I had in development to make 16P less chaotic, but decided against it due to lack of testing and that it could backfire badly... --- src/k_kart.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 8189cd0f..2c68440f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -631,15 +631,14 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) } } - if (first != -1 && second != -1) // calculate 2nd's distance from 1st, for SPB + if (first != -1 && second != -1 && !G_BattleGametype()) // calculate 2nd's distance from 1st, for SPB { secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x, players[first].mo->y - players[second].mo->y), players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale; if (franticitems) secondist = (15*secondist/14); - if (pingame < 8 && !G_BattleGametype()) - secondist = ((28+(8-pingame))*secondist/28); + secondist = ((28+(8-pingame))*secondist/28); } // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. @@ -647,14 +646,13 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) // Then, it multiplies it further if there's less than 5 players in game. // This is done to make low player count races more fair & interesting. (1v1s are basically the same as franticitems false in a normal race) // Lastly, it *divides* it by your mashed value, which was determined in K_KartItemRoulette, to punish those who are impatient. - // The last two are very fractional and complicated, very sorry! #define POWERITEMODDS(odds) \ if (franticitems) \ - odds *= 2; \ - if (pingame < 8 && !G_BattleGametype()) \ - odds = FixedMul(odds*FRACUNIT, FRACUNIT+min((8-pingame)*(FRACUNIT/25), FRACUNIT))/FRACUNIT; \ + odds <<= 1; \ + if (!G_BattleGametype()) \ + odds = FixedMul(odds<> FRACBITS; \ if (mashed > 0) \ - odds = FixedDiv(odds*FRACUNIT, mashed+FRACUNIT)/FRACUNIT \ + odds = FixedDiv(odds<> FRACBITS \ switch (item) { @@ -837,8 +835,7 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3 if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items pdis = (15*pdis/14); - if (pingame < 8 && !G_BattleGametype()) - pdis = ((28+(8-pingame))*pdis/28); + pdis = ((28+(8-pingame))*pdis/28); if (pingame == 1 && oddsvalid[0]) // Record Attack, or just alone useodds = 0; From 24a32c2f517b20ae0ecbad6df16ac2f9bf40f1fc Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 04:31:35 -0500 Subject: [PATCH 2/8] Allow player-count modifiers in Battle --- src/k_kart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2c68440f..b97a518f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -649,8 +649,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) #define POWERITEMODDS(odds) \ if (franticitems) \ odds <<= 1; \ - if (!G_BattleGametype()) \ - odds = FixedMul(odds<> FRACBITS; \ + odds = FixedMul(odds<> FRACBITS; \ if (mashed > 0) \ odds = FixedDiv(odds<> FRACBITS \ From 650522fc59da39db4492095ddb0087cc0a21a500 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 04:43:43 -0500 Subject: [PATCH 3/8] Don't increment ingame count without bumpers --- src/k_kart.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b97a518f..92aafad5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -613,21 +613,24 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) { if (!playeringame[i] || players[i].spectator) continue; - - pingame++; + if (!G_BattleGametype() || players[i].kartstuff[k_bumper]) + pingame++; if (players[i].exiting) pexiting++; if (players[i].mo) { - if (players[i].kartstuff[k_position] == 1 && first == -1) - first = i; - if (players[i].kartstuff[k_position] == 2 && second == -1) - second = i; if (players[i].kartstuff[k_itemtype] == KITEM_INVINCIBILITY || players[i].kartstuff[k_itemtype] == KITEM_GROW || players[i].kartstuff[k_invincibilitytimer] || players[i].kartstuff[k_growshrinktimer] > 0) pinvin++; + if (!G_BattleGametype()) + { + if (players[i].kartstuff[k_position] == 1 && first == -1) + first = i; + if (players[i].kartstuff[k_position] == 2 && second == -1) + second = i; + } } } From 0ef5c2e388f86010da807ba8540eccb433a6d24c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 05:01:36 -0500 Subject: [PATCH 4/8] Some house-cleaning --- src/k_kart.c | 126 ++++++++++++++++++++------------------------------- 1 file changed, 48 insertions(+), 78 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 92aafad5..049e3c54 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -603,6 +603,32 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) UINT8 pingame = 0, pexiting = 0, pinvin = 0; SINT8 first = -1, second = -1; INT32 secondist = 0; + boolean itemenabled[NUMKARTRESULTS] = { + cv_sneaker.value, + cv_rocketsneaker.value, + cv_invincibility.value, + cv_banana.value, + cv_eggmanmonitor.value, + cv_orbinaut.value, + cv_jawz.value, + cv_mine.value, + cv_ballhog.value, + cv_selfpropelledbomb.value, + cv_grow.value, + cv_shrink.value, + cv_thundershield.value, + cv_hyudoro.value, + cv_kitchensink.value, + cv_triplesneaker.value, + cv_triplebanana.value, + cv_decabanana.value, + cv_tripleorbinaut.value, + cv_quadorbinaut.value, + cv_dualjawz.value + }; + + if (!itemenabled[item] && !modeattacking) + return 0; if (G_BattleGametype()) newodds = K_KartItemOddsBattle[item-1][pos]; @@ -634,14 +660,14 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) } } - if (first != -1 && second != -1 && !G_BattleGametype()) // calculate 2nd's distance from 1st, for SPB + if (first != -1 && second != -1) // calculate 2nd's distance from 1st, for SPB { secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x, players[first].mo->y - players[second].mo->y), players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale; if (franticitems) - secondist = (15*secondist/14); - secondist = ((28+(8-pingame))*secondist/28); + secondist = (15 * secondist) / 14; + secondist = ((28 + (8-pingame)) * secondist) / 28; } // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. @@ -658,97 +684,41 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) switch (item) { - case KITEM_SNEAKER: - if ((!cv_sneaker.value) && (!modeattacking)) newodds = 0; - break; - case KITEM_ROCKETSNEAKER: - POWERITEMODDS(newodds); - if (!cv_rocketsneaker.value) newodds = 0; - break; case KITEM_INVINCIBILITY: - POWERITEMODDS(newodds); - if ((!cv_invincibility.value) || (pinvin >= 2)) newodds = 0; - break; - case KITEM_BANANA: - if (!cv_banana.value) newodds = 0; - break; - case KITEM_EGGMAN: - if (!cv_eggmanmonitor.value) newodds = 0; - break; - case KITEM_ORBINAUT: - if (!cv_orbinaut.value) newodds = 0; - break; + case KITEM_GROW: + if (pinvin >= 2) + newodds = 0; + else + /* FALLTHRU */ + case KITEM_ROCKETSNEAKER: case KITEM_JAWZ: - POWERITEMODDS(newodds); - if (!cv_jawz.value) newodds = 0; - break; case KITEM_MINE: - POWERITEMODDS(newodds); - if (!cv_mine.value) newodds = 0; - break; case KITEM_BALLHOG: + case KITEM_THUNDERSHIELD: + case KRITEM_TRIPLESNEAKER: + case KRITEM_TRIPLEBANANA: + case KRITEM_TENFOLDBANANA: + case KRITEM_TRIPLEORBINAUT: + case KRITEM_QUADORBINAUT: + case KRITEM_DUALJAWZ: POWERITEMODDS(newodds); - if (!cv_ballhog.value) newodds = 0; break; case KITEM_SPB: //POWERITEMODDS(newodds); - if ((!cv_selfpropelledbomb.value) - || (indirectitemcooldown > 0) - || (pexiting > 0) - || (secondist/distvar < (4+gamespeed))) + if ((indirectitemcooldown > 0) || (pexiting > 0) || (secondist/distvar < 5)) newodds = 0; - newodds *= min((secondist/distvar)-(3+gamespeed), 3); - break; - case KITEM_GROW: - POWERITEMODDS(newodds); - if ((!cv_grow.value) || (pinvin >= 2)) newodds = 0; + else + newodds *= min((secondist/distvar)-4, 3); break; case KITEM_SHRINK: POWERITEMODDS(newodds); - if ((!cv_shrink.value) - || (indirectitemcooldown > 0) - || (pingame-1 <= pexiting)) newodds = 0; - break; - case KITEM_THUNDERSHIELD: - POWERITEMODDS(newodds); - if (!cv_thundershield.value) newodds = 0; - break; - case KITEM_HYUDORO: - if (!cv_hyudoro.value) newodds = 0; - break; - case KITEM_POGOSPRING: - if (!cv_pogospring.value) newodds = 0; - break; - case KITEM_KITCHENSINK: - newodds = 0; // Not obtained via normal means. - break; - case KRITEM_TRIPLESNEAKER: - POWERITEMODDS(newodds); - if (!cv_triplesneaker.value) newodds = 0; - break; - case KRITEM_TRIPLEBANANA: - POWERITEMODDS(newodds); - if (!cv_triplebanana.value) newodds = 0; - break; - case KRITEM_TENFOLDBANANA: - POWERITEMODDS(newodds); - if (!cv_decabanana.value) newodds = 0; - break; - case KRITEM_TRIPLEORBINAUT: - POWERITEMODDS(newodds); - if (!cv_tripleorbinaut.value) newodds = 0; - break; - case KRITEM_QUADORBINAUT: - POWERITEMODDS(newodds); - if (!cv_quadorbinaut.value) newodds = 0; - break; - case KRITEM_DUALJAWZ: - POWERITEMODDS(newodds); - if (!cv_dualjawz.value) newodds = 0; + if ((indirectitemcooldown > 0) || (pingame-1 <= pexiting)) + newodds = 0; break; default: break; } + #undef POWERITEMODDS return newodds; From 5ed4d0256ee876cd352a2e38b7fc9764f422715e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 05:03:05 -0500 Subject: [PATCH 5/8] spacing & () --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 049e3c54..ffe30eb5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -806,8 +806,8 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3 if (oddsvalid[8]) SETUPDISTTABLE(8,1); if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items - pdis = (15*pdis/14); - pdis = ((28+(8-pingame))*pdis/28); + pdis = (15 * pdis) / 14; + pdis = ((28 + (8-pingame)) * pdis) / 28; if (pingame == 1 && oddsvalid[0]) // Record Attack, or just alone useodds = 0; From 2416d7822409b69f6490e5c7d1df07d7654b528e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 12 Jan 2019 05:12:20 -0500 Subject: [PATCH 6/8] Update comment to be more accurate --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index ffe30eb5..63c9d454 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -673,7 +673,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) // POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items. // First, it multiplies it by 2 if franticitems is true; easy-peasy. // Then, it multiplies it further if there's less than 5 players in game. - // This is done to make low player count races more fair & interesting. (1v1s are basically the same as franticitems false in a normal race) + // This is done to make low player count races more fair & interesting. (2P normal would be about halfway between 8P normal and 8P frantic) // Lastly, it *divides* it by your mashed value, which was determined in K_KartItemRoulette, to punish those who are impatient. #define POWERITEMODDS(odds) \ if (franticitems) \ From 55c6ab2581af730748bfcb0d7bbba5f777c470f4 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sun, 27 Jan 2019 17:51:46 -0500 Subject: [PATCH 7/8] Scale number of allowed invuln items w/ player count 0-5 players: 1 invincibility/grow allowed out at once 6-9 players: 2 invincibilities (how it was before) 10-13 players: 3 invincibilities 14+ players: 4 invincibilites --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 18165a7f..bc5e53ca 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -700,7 +700,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) { case KITEM_INVINCIBILITY: case KITEM_GROW: - if (pinvin >= 2) + if (pinvin >= max(1, (pingame+2) / 4)) newodds = 0; else /* FALLTHRU */ From 80d1c303e3dc4612c84d3bdbeedd2cfadede03b0 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Mon, 28 Jan 2019 12:47:23 -0500 Subject: [PATCH 8/8] Reduce frequency of Eggman items, give some of those points to Orbinaut or Banana --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index bc5e53ca..619f2b1e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -499,9 +499,9 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS][10] = /*Sneaker*/ {20, 0, 0, 4, 6, 6, 0, 0, 0, 0 }, // Sneaker /*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 1, 3, 5, 3, 0 }, // Rocket Sneaker /*Invincibility*/ { 0, 0, 0, 0, 0, 1, 4, 6,14, 0 }, // Invincibility - /*Banana*/ { 0, 9, 4, 2, 1, 0, 0, 0, 0, 0 }, // Banana - /*Eggman Monitor*/ { 0, 4, 3, 2, 0, 0, 0, 0, 0, 0 }, // Eggman Monitor - /*Orbinaut*/ { 0, 6, 5, 3, 2, 0, 0, 0, 0, 0 }, // Orbinaut + /*Banana*/ { 0,10, 4, 2, 1, 0, 0, 0, 0, 0 }, // Banana + /*Eggman Monitor*/ { 0, 3, 2, 1, 0, 0, 0, 0, 0, 0 }, // Eggman Monitor + /*Orbinaut*/ { 0, 8, 6, 4, 2, 0, 0, 0, 0, 0 }, // Orbinaut /*Jawz*/ { 0, 0, 3, 2, 1, 1, 0, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 0, 2, 2, 1, 0, 0, 0, 0, 0 }, // Mine /*Ballhog*/ { 0, 0, 0, 2, 1, 0, 0, 0, 0, 0 }, // Ballhog