From aa15b34a0863f26462bc90fc338cfd3f5bd9ef48 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 19:53:12 -0500 Subject: [PATCH 1/6] Actual Race starts --- src/g_game.c | 38 ++++++++++++++++++++++++++++++-------- src/g_game.h | 2 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 3d7d5d42..2f148cda 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2611,7 +2611,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) { if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start - spawnpoint = G_FindCoopStart(playernum); // fallback + spawnpoint = G_FindRaceStart(playernum); // fallback } // -- DM/Tag/CTF-spectator/etc -- @@ -2621,14 +2621,14 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) { if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start && !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start - spawnpoint = G_FindCoopStart(playernum); // fallback + spawnpoint = G_FindRaceStart(playernum); // fallback } // -- Other game modes -- // Order: Coop->DM->CTF else { - if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start + if (!(spawnpoint = G_FindRaceStart(playernum)) // find a Race start && !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start spawnpoint = G_FindCTFStart(playernum); // fallback } @@ -2760,24 +2760,46 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return NULL; } -mapthing_t *G_FindCoopStart(INT32 playernum) +mapthing_t *G_FindRaceStart(INT32 playernum) { if (numcoopstarts) { + INT32 i, pos = 0; + //if there's 6 players in a map with 3 player starts, this spawns them 1/2/3/1/2/3. - if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) - return playerstarts[playernum % numcoopstarts]; + /*if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) + return playerstarts[playernum % numcoopstarts];*/ + + // SRB2Kart: figure out player spawn pos from points + for (i = 0; i < MAXPLAYERS; i++) + { + if (i == playernum) + continue; + if (players[i].score > players[playernum]->score) + pos++; + } + + if (G_CheckSpot(playernum, playerstarts[pos % numcoopstarts])) + return playerstarts[pos % numcoopstarts]; //Don't bother checking to see if the player 1 start is open. //Just spawn there. - return playerstarts[0]; + //return playerstarts[0]; + + // SRB2Kart: We have solid players, so that is less ideal. + if (playernum == consoleplayer + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) + CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); + return NULL; } if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer) || (splitscreen > 1 && playernum == thirddisplayplayer) || (splitscreen > 2 && playernum == fourthdisplayplayer)) - CONS_Alert(CONS_WARNING, M_GetText("No Co-op starts in this map!\n")); + CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } diff --git a/src/g_game.h b/src/g_game.h index 8ea9d8f6..9e11727f 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -112,7 +112,7 @@ char *G_BuildMapTitle(INT32 mapnum); // XMOD spawning mapthing_t *G_FindCTFStart(INT32 playernum); mapthing_t *G_FindMatchStart(INT32 playernum); -mapthing_t *G_FindCoopStart(INT32 playernum); +mapthing_t *G_FindRaceStart(INT32 playernum); void G_SpawnPlayer(INT32 playernum, boolean starpost); // Can be called by the startup code or M_Responder. From adfe3337cb5682128dd563fc445047f13d623679 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 20:40:06 -0500 Subject: [PATCH 2/6] Race position starts --- src/g_game.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2f148cda..89725ce6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2766,27 +2766,46 @@ mapthing_t *G_FindRaceStart(INT32 playernum) { INT32 i, pos = 0; - //if there's 6 players in a map with 3 player starts, this spawns them 1/2/3/1/2/3. - /*if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) - return playerstarts[playernum % numcoopstarts];*/ - // SRB2Kart: figure out player spawn pos from points + if (!playeringame[playernum] || players[playernum].spectator) + return playerstarts[0]; // go to first spot if you're a spectator + for (i = 0; i < MAXPLAYERS; i++) { if (i == playernum) continue; - if (players[i].score > players[playernum]->score) + if (!playeringame[i] || players[i].spectator) + continue; + if (players[i].score > players[playernum].score) pos++; + if (i != 0) + { + INT32 j; + for (j = 0; j < i; j++) // I don't like loops in loops, but is needed to resolve ties :< + { + if (i == j) + continue; + if (!playeringame[j] || players[j].spectator) + continue; + if (players[i].score == players[j].score) + pos++; + } + } } if (G_CheckSpot(playernum, playerstarts[pos % numcoopstarts])) return playerstarts[pos % numcoopstarts]; - //Don't bother checking to see if the player 1 start is open. - //Just spawn there. + // Your spot isn't available? Go for the old behavior + // if there's 6 players in a map with 3 player starts, this spawns them 1/2/3/1/2/3. + if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) + return playerstarts[playernum % numcoopstarts]; + + // SRB2Kart: We have solid players, so this behavior is less ideal. + // Don't bother checking to see if the player 1 start is open. + // Just spawn there. //return playerstarts[0]; - // SRB2Kart: We have solid players, so that is less ideal. if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer) || (splitscreen > 1 && playernum == thirddisplayplayer) From 29e4c6764d574e49fd115583f39d9dfb9ee0dbb0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 20:46:01 -0500 Subject: [PATCH 3/6] Fixed an odd bug --- src/y_inter.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index e1bf1e5e..ed26e2f3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2368,18 +2368,29 @@ void Y_VoteTicker(void) if (server) { - if (splitscreen) - { - if (votes[0] == -1) - return; - } - else + if (timer == 0) { for (i = 0; i < MAXPLAYERS; i++) { if ((playeringame[i] && !players[i].spectator) && votes[i] == -1) + votes[i] = 3; + } + } + else + { + if (splitscreen) + { + if (votes[0] == -1) return; } + else + { + for (i = 0; i < MAXPLAYERS; i++) + { + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1) + return; + } + } } timer = 0; From acb98b50c731d64136b3981525d3dadbe39563d9 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 20:52:12 -0500 Subject: [PATCH 4/6] Another minor voting thing --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index ed26e2f3..62f60388 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2372,7 +2372,7 @@ void Y_VoteTicker(void) { for (i = 0; i < MAXPLAYERS; i++) { - if ((playeringame[i] && !players[i].spectator) && votes[i] == -1) + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen) votes[i] = 3; } } @@ -2520,7 +2520,7 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) for (i = 0; i < MAXPLAYERS; i++) { - if ((playeringame[i] && !players[i].spectator) && votes[i] == -1) + if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen) votes[i] = 3; if (votes[i] == -1) From 0ed75724e6be12bc134a6ab00d198dca4e99e988 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 21:17:34 -0500 Subject: [PATCH 5/6] Some offset adjustin' --- src/y_inter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 62f60388..8fdbac27 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2188,7 +2188,7 @@ void Y_VoteDrawer(void) } x = 20; - y = 15; + y = 10; for (i = 0; i < MAXPLAYERS; i++) { @@ -2226,10 +2226,10 @@ void Y_VoteDrawer(void) y += 30; - if (y > BASEVIDHEIGHT-38) + if (y > BASEVIDHEIGHT-40) { - x += 100; - y = 15; + x += 60; + y = 10; } } From a144a04abb8967d808e382d7d0ccecda790fd390 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 27 Feb 2018 21:18:42 -0500 Subject: [PATCH 6/6] Taunt sound simplification --- src/k_kart.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index daddb0c0..8e06c527 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1190,21 +1190,7 @@ void K_KartPlayerAfterThink(player_t *player) static void K_PlayTauntSound(mobj_t *source) { - switch (P_RandomFixed() % 4) - { - case 0: - S_StartSound(source, sfx_taunt1); - return; - case 1: - S_StartSound(source, sfx_taunt2); - return; - case 2: - S_StartSound(source, sfx_taunt3); - return; - case 3: - S_StartSound(source, sfx_taunt4); - return; - } + S_StartSound(source, sfx_taunt1+P_RandomKey(4)); } void K_MomentumToFacing(player_t *player)