From 2a23549d637099845b77632c0cbd23419d039d91 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 20 Feb 2018 19:11:09 -0500 Subject: [PATCH 1/4] Winning positions scale with number of players Anyone in the top 50% gets winning music & blue position, everyone below gets the losing music & red position. For odd numbers, it rounds up. 2p: 1st wins, 2nd loses 3p: 1-2 win, 3rd loses 4p: 1-2 win, 3-4 lose 5p: 1-3 win, 4-5 lose 6p: 1-3 win, 4-6 lose 7p: 1-4 win, 5-7 lose 8p: 1-4 win, 5-8 lose (SMK) 12p: 1-6 win, 7-12 lose (modern MK) 16p: 1-8 win, 9-16 lose (max player count) In big netgames you won't just hear the losing music all of the time now :V --- src/k_kart.c | 518 +++------------------------------------------------ src/k_kart.h | 1 + src/p_spec.c | 8 +- src/p_user.c | 8 +- 4 files changed, 38 insertions(+), 497 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0cdfdb03..b767e731 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -332,369 +332,35 @@ void K_RegisterKartStuff(void) //} +boolean K_IsPlayerLosing(player_t *player) +{ + INT32 winningpos = 1; + UINT8 i, pcount = 0; + + if (player->kartstuff[k_position] == 1) + return false; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + pcount++; + } + + if (pcount <= 1) + return false; + + winningpos = pcount/2; + if (pcount % 2) // any remainder? + winningpos++; + + return (player->kartstuff[k_position] > winningpos); +} + //{ SRB2kart Roulette Code - Position Based #define NUMKARTITEMS 19 #define NUMKARTODDS 40 -// Ugly ol' 3D arrays -/* -static INT32 K_KartItemOddsPosition_Retro[MAXPLAYERS][NUMKARTITEMS][MAXPLAYERS] = -{ - // 1 Active Player - { //1st // - { 0 }, // Magnet - { 0 }, // Boo - { 40 }, // Mushroom - { 0 }, // Triple Mushroom - { 0 }, // Mega Mushroom - { 0 }, // Gold Mushroom - { 0 }, // Star - { 0 }, // Triple Banana - { 0 }, // Fake Item - { 0 }, // Banana - { 0 }, // Green Shell - { 0 }, // Red Shell - { 0 }, // Triple Green Shell - { 0 }, // Bob-omb - { 0 }, // Blue Shell - { 0 }, // Fire Flower - { 0 }, // Triple Red Shell - { 0 } // Lightning - }, //1st // - - // 2 Active Players - { //1st 2nd // - { 1, 0 }, // Magnet - { 0, 0 }, // Boo - { 6, 11 }, // Mushroom - { 0, 3 }, // Triple Mushroom - { 0, 1 }, // Mega Mushroom - { 0, 1 }, // Gold Mushroom - { 0, 0 }, // Star - { 4, 0 }, // Triple Banana - { 7, 0 }, // Fake Item - { 12, 0 }, // Banana - { 8, 6 }, // Green Shell - { 2, 12 }, // Red Shell - { 0, 4 }, // Triple Green Shell - { 0, 0 }, // Bob-omb - { 0, 2 }, // Blue Shell - { 0, 0 }, // Fire Flower - { 0, 0 }, // Triple Red Shell - { 0, 0 } // Lightning - }, //1st 2nd // - - // 3 Active Players - { //1st 2nd 3rd // - { 1, 0, 0 }, // Magnet - { 0, 1, 0 }, // Boo - { 4, 10, 0 }, // Mushroom - { 0, 4, 11 }, // Triple Mushroom - { 0, 0, 2 }, // Mega Mushroom - { 0, 0, 16 }, // Gold Mushroom - { 0, 0, 6 }, // Star - { 4, 0, 0 }, // Triple Banana - { 7, 2, 0 }, // Fake Item - { 13, 4, 0 }, // Banana - { 9, 4, 0 }, // Green Shell - { 2, 8, 0 }, // Red Shell - { 0, 3, 0 }, // Triple Green Shell - { 0, 2, 0 }, // Bob-omb - { 0, 2, 0 }, // Blue Shell - { 0, 0, 0 }, // Fire Flower - { 0, 0, 0 }, // Triple Red Shell - { 0, 0, 5 } // Lightning - }, //1st 2nd 3rd // - - // 4 Active Players - { //1st 2nd 3rd 4th // - { 1, 1, 0, 0 }, // Magnet - { 0, 3, 0, 0 }, // Boo - { 2, 10, 0, 0 }, // Mushroom - { 0, 3, 9, 10 }, // Triple Mushroom - { 0, 0, 3, 0 }, // Mega Mushroom - { 0, 0, 9, 16 }, // Gold Mushroom - { 0, 0, 0, 8 }, // Star - { 4, 0, 0, 0 }, // Triple Banana - { 7, 2, 0, 0 }, // Fake Item - { 14, 4, 0, 0 }, // Banana - { 9, 5, 0, 0 }, // Green Shell - { 3, 8, 6, 0 }, // Red Shell - { 0, 2, 4, 0 }, // Triple Green Shell - { 0, 2, 0, 0 }, // Bob-omb - { 0, 0, 3, 0 }, // Blue Shell - { 0, 0, 3, 0 }, // Fire Flower - { 0, 0, 3, 0 }, // Triple Red Shell - { 0, 0, 0, 6 } // Lightning - }, //1st 2nd 3rd 4th // - - // 5 Active Players - { //1st 2nd 3rd 4th 5th // - { 1, 2, 0, 0, 0 }, // Magnet - { 0, 3, 0, 0, 0 }, // Boo - { 0, 9, 7, 0, 0 }, // Mushroom - { 0, 0, 8, 12, 12 }, // Triple Mushroom - { 0, 0, 2, 2, 0 }, // Mega Mushroom - { 0, 0, 0, 9, 20 }, // Gold Mushroom - { 0, 0, 0, 3, 8 }, // Star - { 4, 2, 0, 0, 0 }, // Triple Banana - { 7, 3, 0, 0, 0 }, // Fake Item - { 15, 4, 0, 0, 0 }, // Banana - { 10, 6, 3, 0, 0 }, // Green Shell - { 3, 9, 6, 0, 0 }, // Red Shell - { 0, 2, 4, 0, 0 }, // Triple Green Shell - { 0, 0, 3, 0, 0 }, // Bob-omb - { 0, 0, 4, 0, 0 }, // Blue Shell - { 0, 0, 3, 4, 0 }, // Fire Flower - { 0, 0, 0, 3, 0 }, // Triple Red Shell - { 0, 0, 0, 7, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th // - - // 6 Active Players - { //1st 2nd 3rd 4th 5th 6th // - { 1, 2, 0, 0, 0, 0 }, // Magnet - { 0, 2, 2, 0, 0, 0 }, // Boo - { 0, 9, 8, 0, 0, 0 }, // Mushroom - { 0, 0, 5, 11, 14, 12 }, // Triple Mushroom - { 0, 0, 0, 2, 2, 0 }, // Mega Mushroom - { 0, 0, 0, 6, 11, 20 }, // Gold Mushroom - { 0, 0, 0, 0, 3, 8 }, // Star - { 4, 2, 0, 0, 0, 0 }, // Triple Banana - { 7, 3, 0, 0, 0, 0 }, // Fake Item - { 15, 5, 3, 0, 0, 0 }, // Banana - { 10, 6, 4, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 6, 0, 0 }, // Red Shell - { 0, 2, 4, 5, 0, 0 }, // Triple Green Shell - { 0, 0, 3, 0, 0, 0 }, // Bob-omb - { 0, 0, 3, 3, 0, 0 }, // Blue Shell - { 0, 0, 0, 4, 0, 0 }, // Fire Flower - { 0, 0, 0, 3, 3, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 7, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th // - - // 7 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th // - { 1, 2, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 3, 0, 0, 0, 0 }, // Boo - { 0, 8, 8, 8, 0, 0, 0 }, // Mushroom - { 0, 0, 3, 8, 14, 15, 12 }, // Triple Mushroom - { 0, 0, 0, 2, 4, 2, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 7, 12, 20 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 3, 8 }, // Star - { 4, 2, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 2, 0, 0, 0, 0 }, // Fake Item - { 15, 5, 4, 0, 0, 0, 0 }, // Banana - { 10, 6, 4, 0, 0, 0, 0 }, // Green Shell - { 3, 10, 8, 7, 0, 0, 0 }, // Red Shell - { 0, 1, 4, 6, 4, 0, 0 }, // Triple Green Shell - { 0, 0, 3, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 1, 3, 3, 0, 0 }, // Blue Shell - { 0, 0, 0, 3, 5, 0, 0 }, // Fire Flower - { 0, 0, 0, 3, 3, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 8, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th // - - // 8 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th // - { 1, 2, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 3, 0, 0, 0, 0, 0 }, // Boo - { 0, 8, 8, 8, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 3, 7, 12, 15, 11, 7 }, // Triple Mushroom - { 0, 0, 0, 2, 4, 4, 2, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 4, 8, 15, 24 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 2, 5, 9 }, // Star - { 4, 2, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 2, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 5, 4, 0, 0, 0, 0, 0 }, // Banana - { 10, 7, 5, 2, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 5, 0, 0, 0 }, // Red Shell - { 0, 1, 4, 6, 4, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 2, 3, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 1, 3, 3, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 2, 5, 3, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 3, 3, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 5, 7, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th // - - // 9 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th // - { 1, 3, 2, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 2, 3, 0, 0, 0, 0, 0 }, // Boo - { 0, 7, 9, 10, 8, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 3, 7, 10, 17, 16, 12, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 2, 4, 6, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 4, 8, 15, 29 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 3, 6, 11 }, // Star - { 4, 2, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 2, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 6, 5, 2, 0, 0, 0, 0, 0 }, // Banana - { 10, 7, 5, 2, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 6, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 6, 4, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 2, 3, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 2, 3, 3, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 3, 5, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 2, 3, 2, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 5, 7, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th // - - // 10 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t // - { 1, 3, 2, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 3, 3, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 7, 8, 10, 8, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 2, 5, 9, 14, 16, 14, 9, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 2, 4, 6, 5, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 4, 5, 10, 16, 28 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 2, 4, 7, 12 }, // Star - { 4, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 2, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 6, 5, 2, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 7, 6, 4, 2, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 6, 3, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 6, 4, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 2, 3, 1, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 2, 3, 3, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 3, 6, 4, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 2, 3, 1, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 4, 6, 8, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t // - - // 11 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t // - { 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 6, 8, 9, 8, 6, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 2, 5, 9, 10, 15, 17, 14, 10, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 2, 3, 6, 6, 4, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 4, 5, 11, 15, 18 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 3, 5, 7, 12 }, // Star - { 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 7, 5, 2, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 6, 4, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 6, 6, 5, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 2, 3, 3, 2, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 3, 6, 5, 3, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 2, 3, 2, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t // - - // 12 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t // - { 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 6, 8, 9, 10, 8, 0, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 1, 4, 9, 11, 15, 17, 15, 11, 6, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 0, 2, 4, 6, 7, 5, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 3, 5, 9, 13, 18, 28 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 12 }, // Star - { 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 7, 6, 3, 2, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 7, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 6, 5, 2, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 5, 7, 5, 3, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 2, 3, 3, 3, 2, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 0, 2, 5, 4, 0, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t // - - // 13 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t // - { 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 4, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 5, 8, 9, 10, 8, 5, 0, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 0, 2, 6, 9, 11, 15, 16, 14, 11, 10, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 0, 2, 5, 6, 8, 6, 3, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 0, 4, 5, 8, 11, 20, 27 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 10, 13 }, // Star - { 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 7, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 8, 6, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 9, 8, 7, 6, 5, 2, 0, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 5, 7, 6, 5, 0, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 2, 3, 3, 3, 2, 0, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 0, 3, 6, 5, 3, 0, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 10, 0, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t // - - // 14 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t // - { 1, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 4, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 5, 7, 9, 11, 8, 5, 0, 0, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 0, 2, 6, 9, 10, 12, 17, 15, 14, 12, 8, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 0, 2, 5, 6, 8, 7, 3, 0, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 22, 27 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 10, 13 }, // Star - { 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 7, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 8, 6, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 10, 8, 7, 6, 5, 3, 2, 0, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 5, 7, 6, 5, 2, 0, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 0, 2, 3, 4, 3, 1, 0, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 0, 3, 5, 6, 4, 2, 0, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 0, 2, 3, 3, 3, 2, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 10, 0, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t // - - // 15 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t 15t // - { 1, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 4, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 4, 6, 8, 10, 9, 8, 4, 0, 0, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 0, 2, 4, 8, 11, 13, 17, 18, 15, 13, 9, 8, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 0, 0, 2, 5, 6, 8, 7, 3, 0, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 22, 27 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 10, 13 }, // Star - { 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 8, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 8, 6, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 10, 9, 8, 7, 6, 4, 3, 0, 0, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 5, 7, 6, 5, 3, 0, 0, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 0, 2, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 0, 2, 3, 4, 3, 2, 0, 0, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 0, 0, 3, 5, 6, 2, 0, 0, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 2, 0, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 8, 11, 0, 0 } // Lightning - }, //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t 15t // - - // 16 Active Players - { //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t 15t 16t // - { 1, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Magnet - { 0, 2, 4, 4, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Boo - { 0, 4, 6, 8, 10, 9, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0 }, // Mushroom - { 0, 0, 0, 2, 4, 7, 10, 13, 16, 18, 15, 14, 12, 8, 7, 0 }, // Triple Mushroom - { 0, 0, 0, 0, 0, 0, 2, 5, 6, 8, 8, 5, 2, 0, 0, 0 }, // Mega Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 8, 11, 13, 14, 23, 27 }, // Gold Mushroom - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 5, 7, 10, 13 }, // Star - { 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Triple Banana - { 7, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Fake Item - { 15, 8, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Banana - { 10, 8, 6, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Green Shell - { 3, 10, 9, 8, 7, 6, 5, 3, 2, 0, 0, 0, 0, 0, 0, 0 }, // Red Shell - { 0, 0, 2, 4, 5, 8, 7, 5, 3, 2, 0, 0, 0, 0, 0, 0 }, // Triple Green Shell - { 0, 0, 0, 2, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Bob-omb - { 0, 0, 0, 0, 2, 3, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0 }, // Blue Shell - { 0, 0, 0, 0, 0, 0, 3, 5, 6, 4, 2, 0, 0, 0, 0, 0 }, // Fire Flower - { 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 3, 2, 0, 0, 0, 0 }, // Triple Red Shell - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 8, 11, 0, 0 } // Lightning - } //1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10t 11t 12t 13t 14t 15t 16t // -}; -*/ - // Less ugly 2D arrays static INT32 K_KartItemOddsDistance_Retro[NUMKARTITEMS][9] = { @@ -842,133 +508,7 @@ static void K_KartGetItemResult(player_t *player, fixed_t getitem, boolean retro \param player player object passed from P_KartPlayerThink \return void -/ -static void K_KartItemRouletteByPosition(player_t *player, ticcmd_t *cmd) -{ - INT32 i; - INT32 pingame = 0, pexiting = 0; - INT32 roulettestop; - INT32 prandom; - INT32 ppos = player->kartstuff[k_position] - 1; - INT32 spawnchance[NUMKARTITEMS * NUMKARTODDS]; - INT32 chance = 0, numchoices = 0; - - - // This makes the roulette cycle through items - if this is 0, you shouldn't be here. - if (player->kartstuff[k_itemroulette]) - player->kartstuff[k_itemroulette]++; - else - return; - - // This makes the roulette produce the random noises. - if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsLocalPlayer(player)) - S_StartSound(NULL,sfx_mkitm1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); - - // Initializes existing spawnchance values - for (i = 0; i < (NUMKARTITEMS * NUMKARTODDS); i++) - spawnchance[i] = 0; - - // Gotta check how many players are active at this moment. - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && !players[i].spectator) - pingame++; - if (players[i].exiting) - pexiting++; - } - - roulettestop = (TICRATE*1) + (3*(pingame - player->kartstuff[k_position])); - - // If the roulette finishes or the player presses BT_ATTACK, stop the roulette and calculate the item. - // I'm returning via the exact opposite, however, to forgo having another bracket embed. Same result either way, I think. - // Finally, if you get past this check, now you can actually start calculating what item you get. - if (!(player->kartstuff[k_itemroulette] >= (TICRATE*3) - || ((cmd->buttons & BT_ATTACK) && player->kartstuff[k_itemroulette] >= roulettestop))) - return; - - if (cmd->buttons & BT_ATTACK) - player->pflags |= PF_ATTACKDOWN; - - player->kartstuff[k_itemclose] = 0; // Reset the item window closer. - - // Tiny catcher in case player position is unset. - if (ppos < 0) ppos = 0; - -#define SETITEMRESULT(pos, numplayers, itemnum) \ - for (chance = 0; chance < K_KartItemOddsPosition_Retro[numplayers-1][itemnum-1][pos]; chance++) spawnchance[numchoices++] = itemnum - - // Check the game type to differentiate odds. - //if (gametype == GT_RETRO) - //{ - if (cv_magnet.value) SETITEMRESULT(ppos, pingame, 1); // Magnet - if (cv_boo.value) SETITEMRESULT(ppos, pingame, 2); // Boo - if (cv_mushroom.value) SETITEMRESULT(ppos, pingame, 3); // Mushroom - if (cv_mushroom.value) SETITEMRESULT(ppos, pingame, 4); // Triple Mushroom - if (cv_megashroom.value) SETITEMRESULT(ppos, pingame, 5); // Mega Mushroom - if (cv_goldshroom.value) SETITEMRESULT(ppos, pingame, 6); // Gold Mushroom - if (cv_star.value) SETITEMRESULT(ppos, pingame, 7); // Star - if (cv_triplebanana.value) SETITEMRESULT(ppos, pingame, 8); // Triple Banana - if (cv_fakeitem.value) SETITEMRESULT(ppos, pingame, 9); // Fake Item - if (cv_banana.value) SETITEMRESULT(ppos, pingame, 10); // Banana - if (cv_greenshell.value) SETITEMRESULT(ppos, pingame, 11); // Green Shell - if (cv_redshell.value) SETITEMRESULT(ppos, pingame, 12); // Red Shell - if (cv_triplegreenshell.value) SETITEMRESULT(ppos, pingame, 13); // Triple Green Shell - if (cv_bobomb.value) SETITEMRESULT(ppos, pingame, 14); // Bob-omb - if (cv_blueshell.value && pexiting == 0) SETITEMRESULT(ppos, pingame, 15); // Blue Shell - //if (cv_fireflower.value) SETITEMRESULT(ppos, pingame, 16); // Fire Flower - if (cv_tripleredshell.value) SETITEMRESULT(ppos, pingame, 17); // Triple Red Shell - if (cv_lightning.value && pingame > pexiting) SETITEMRESULT(ppos, pingame, 18); // Lightning - - prandom = P_RandomKey(numchoices); - - // Award the player whatever power is rolled - if (numchoices > 0) - K_KartGetItemResult(player, spawnchance[prandom], true); - else - CONS_Printf("ERROR: P_KartItemRoulette - There were no choices given by the roulette (ppos = %d).\n", ppos); - //} - //else if (gametype == GT_NEO) - { - if (cv_magnet.value) SETITEMRESULT(ppos, pingame, 1) // Electro-Shield - if (cv_boo.value) SETITEMRESULT(ppos, pingame, 2) // S3K Ghost - if (cv_mushroom.value) SETITEMRESULT(ppos, pingame, 3) // Speed Shoe - if (cv_mushroom.value) SETITEMRESULT(ppos, pingame, 4) // Triple Speed Shoe - if (cv_megashroom.value) SETITEMRESULT(ppos, pingame, 5) // Size-Up Monitor - if (cv_goldshroom.value) SETITEMRESULT(ppos, pingame, 6) // Rocket Shoe - if (cv_star.value) SETITEMRESULT(ppos, pingame, 7) // Invincibility - if (cv_triplebanana.value) SETITEMRESULT(ppos, pingame, 8) // Triple Banana - if (cv_fakeitem.value) SETITEMRESULT(ppos, pingame, 9) // Eggman Monitor - if (cv_banana.value) SETITEMRESULT(ppos, pingame, 10) // Banana - if (cv_greenshell.value) SETITEMRESULT(ppos, pingame, 11) // 1x Orbinaut - if (cv_redshell.value) SETITEMRESULT(ppos, pingame, 12) // 1x Jaws - if (cv_laserwisp.value) SETITEMRESULT(ppos, pingame, 13) // Laser Wisp - if (cv_triplegreenshell.value) SETITEMRESULT(ppos, pingame, 14) // 3x Orbinaut - if (cv_bobomb.value) SETITEMRESULT(ppos, pingame, 15) // Specialstage Mines - if (cv_blueshell.value && pexiting == 0) SETITEMRESULT(ppos, pingame, 16) // Deton - if (cv_jaws.value) SETITEMRESULT(ppos, pingame, 17) // 2x Jaws - if (cv_lightning.value && pingame > pexiting) SETITEMRESULT(ppos, pingame, 18) // Size-Down Monitor - - prandom = P_RandomKey(numchoices); - - // Award the player whatever power is rolled - if (numchoices > 0) - K_KartGetItemResult(player, spawnchance[prandom], false) - else - CONS_Printf("ERROR: P_KartItemRoulette - There were no choices given by the roulette (ppos = %d).\n", ppos); - } - else - CONS_Printf("ERROR: P_KartItemRoulette - There's no applicable game type!\n"); - // - -#undef SETITEMRESULT - - player->kartstuff[k_itemroulette] = 0; // Since we're done, clear the roulette number - - if (P_IsLocalPlayer(player)) - S_StartSound(NULL, sfx_mkitmF); -}*/ - -//} +*/ static INT32 K_KartGetItemOdds(INT32 pos, INT32 itemnum) { @@ -4061,7 +3601,7 @@ void K_LoadKartHUDGraphics(void) { for (j = 0; j < NUMPOSFRAMES; j++) { - if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th + //if (i > 4 && j < 4 && j != 0) continue; // We don't need blue numbers for ranks past 4th sprintf(buffer, "K_POSN%d%d", i, j); kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } @@ -4717,19 +4257,19 @@ static void K_DrawKartPositionNum(INT32 num) switch (leveltime % 9) { case 1: case 2: case 3: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][4]; else localpatch = kp_positionnum[num % 10][1]; break; case 4: case 5: case 6: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][5]; else localpatch = kp_positionnum[num % 10][2]; break; case 7: case 8: case 9: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) + if (K_IsPlayerLosing(stplyr)) localpatch = kp_positionnum[num % 10][6]; else localpatch = kp_positionnum[num % 10][3]; diff --git a/src/k_kart.h b/src/k_kart.h index 11ec63c6..9d1cf08f 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -17,6 +17,7 @@ UINT8 K_GetKartColorByName(const char *name); void K_RegisterKartStuff(void); +boolean K_IsPlayerLosing(player_t *player); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_LakituChecker(player_t *player); void K_KartMoveAnimation(player_t *player); diff --git a/src/p_spec.c b/src/p_spec.c index 1648829c..2042e492 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4204,13 +4204,13 @@ DoneSection2: { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); - else if (player->kartstuff[k_position] == 2 || player->kartstuff[k_position] == 3) - S_ChangeMusicInternal("karok", true); - else if (player->kartstuff[k_position] >= 4) + else if (K_IsPlayerLosing(player)) S_ChangeMusicInternal("karlos", true); + else + S_ChangeMusicInternal("karok", true); } else - S_ChangeMusicInternal("karwin", true); + S_ChangeMusicInternal("karok", true); // //HU_SetCEchoFlags(0); //HU_SetCEchoDuration(5); diff --git a/src/p_user.c b/src/p_user.c index 75c98f58..f873f1a3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1676,13 +1676,13 @@ void P_DoPlayerExit(player_t *player) { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); - else if (player->kartstuff[k_position] == 2 || player->kartstuff[k_position] == 3) - S_ChangeMusicInternal("karok", true); - else if (player->kartstuff[k_position] >= 4) + else if (K_IsPlayerLosing(player)) S_ChangeMusicInternal("karlos", true); + else + S_ChangeMusicInternal("karok", true); } else - S_ChangeMusicInternal("karwin", true); + S_ChangeMusicInternal("karok", true); } player->exiting = 3*TICRATE; From da32f9a4ed46c609aa4af7ad30649c9abd0a530f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 20 Feb 2018 19:33:50 -0500 Subject: [PATCH 2/4] Fixed fourth taunt sound not playing % 4 would output 0 to 3, not 1 to 4 guys :V --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b767e731..95602ca2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1192,16 +1192,16 @@ static void K_PlayTauntSound(mobj_t *source) { switch (P_RandomFixed() % 4) { - case 1: + case 0: S_StartSound(source, sfx_taunt1); return; - case 2: + case 1: S_StartSound(source, sfx_taunt2); return; - case 3: + case 2: S_StartSound(source, sfx_taunt3); return; - case 4: + case 3: S_StartSound(source, sfx_taunt4); return; } From 6d3d098c3f982e7447aabfcfce95dc7156191c6f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 20 Feb 2018 20:04:33 -0500 Subject: [PATCH 3/4] Fixed stereoreverse, and its effects are applied to mirror mode How long has this cvar been broken?! --- src/s_sound.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index e63aca15..cb310176 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -391,7 +391,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) { INT32 sep, pitch, priority, cnum; sfxinfo_t *sfx; - + const boolean reverse = (stereoreverse.value ^ mirrormode); const mobj_t *origin = (const mobj_t *)origin_p; listener_t listener = {0,0,0,0}; @@ -572,14 +572,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -627,14 +626,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -682,14 +680,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -732,14 +729,13 @@ dontplay: if (sfx->usefulness++ < 0) sfx->usefulness = -1; -#ifdef SURROUND // Avoid channel reverse if surround - if (stereoreverse.value && sep != SURROUND_SEP) - sep = (~sep) & 255; -#else - if (stereoreverse.value) - sep = (~sep) & 255; + if (reverse +#ifdef SURROUND + && sep != SURROUND_SEP #endif + ) + sep = (~sep) & 255; // Assigns the handle to one of the channels in the // mix/output buffer. @@ -1212,6 +1208,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v listener_t listensource; + const boolean reverse = (stereoreverse.value ^ mirrormode); + (void)pitch; if (!listener) return false; @@ -1309,6 +1307,9 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v else angle = angle + InvAngle(listensource.angle); + if (reverse) + angle = InvAngle(angle); + #ifdef SURROUND // Produce a surround sound for angle from 105 till 255 if (surround.value == 1 && (angle > ANG105 && angle < ANG255 )) From cb593aa2b1839e0e514bf3dd8d61a555fe33bf6e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 20 Feb 2018 20:08:53 -0500 Subject: [PATCH 4/4] Battle Mode wins award (player count * 2) points now --- 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 95602ca2..4f36b3cc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3426,7 +3426,7 @@ void K_CheckBalloons(void) if (playeringame[winnernum]) { P_AddPlayerScore(&players[winnernum], numingame); - CONS_Printf(M_GetText("%s recieved %d points for winning!\n"), player_names[winnernum], numingame); // numingame/2 == 1 ? "" : "s" + CONS_Printf(M_GetText("%s recieved %d points for winning!\n"), player_names[winnernum], numingame*2); } for (i = 0; i < MAXPLAYERS; i++)