From f86030fcda89082ab3bbf412e715d2cd5ea91c02 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 23 Apr 2023 01:04:57 -0400 Subject: [PATCH] Z Voting: More voting conditions - Attempt to make Z votes draw if spectator - Don't show kick votes to the victim - Fix required vote count when in 1P --- src/k_zvote.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/k_zvote.c b/src/k_zvote.c index 41fe9b9e4..fc142e2dc 100644 --- a/src/k_zvote.c +++ b/src/k_zvote.c @@ -22,6 +22,7 @@ #include "v_video.h" #include "k_hud.h" #include "r_draw.h" +#include "r_fps.h" #include "byteptr.h" static CV_PossibleValue_t modulate_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; @@ -367,6 +368,12 @@ boolean K_PlayerIDAllowedInMidVote(const UINT8 id) return false; } + if (g_midVote.active == true && player == g_midVote.victim) + { + // Don't allow the guy getting kicked to vote on it. + return false; + } + return true; } @@ -378,7 +385,6 @@ boolean K_PlayerIDAllowedInMidVote(const UINT8 id) UINT8 K_RequiredMidVotes(void) { UINT8 allowedCount = 0; - UINT8 requiredCount = 0; INT32 i = INT32_MAX; if (g_midVote.active == false) @@ -408,7 +414,7 @@ UINT8 K_RequiredMidVotes(void) else { // 1P session, just require the one vote. - return requiredCount; + return 1; } } @@ -906,31 +912,11 @@ static void K_DrawMidVoteBar(fixed_t x, fixed_t y, INT32 flags, fixed_t fill, sk --------------------------------------------------*/ void K_DrawMidVote(void) { + const INT32 id = R_GetViewNumber(); midVoteGUI_t *gui = NULL; boolean pressed = false; - - UINT8 id = UINT8_MAX; fixed_t x = INT32_MAX, y = INT32_MAX; - INT32 i = INT32_MAX; - - // FIXME: We need a splitscreen version of this HUD! - for (i = 0; i <= splitscreen; i++) - { - if (stplyr == &players[ g_localplayers[i] ]) - { - id = i; - break; - } - } - - if (id == UINT8_MAX) - { - // Player we're drawing doesn't control the - // vote locally, so we shouldn't draw anything. - return; - } - pressed = G_PlayerInputDown(id, gc_z, 0); gui = &g_midVote.gui[id]; @@ -1101,7 +1087,7 @@ void K_DrawMidVote(void) drawVotes = true; } } - + if (drawVotes == true) { const fixed_t voteY = y + (2 * FRACUNIT);