From 014c1d8f03117e46fa0d36c58e8bcec0504246f7 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 4 Jul 2017 14:58:58 +0100 Subject: [PATCH] https://cdn.discordapp.com/attachments/297148222332469249/332227405747847168/unknown.png betterexit integration! --- src/d_netcmd.c | 2 +- src/p_user.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 880d5d770..b84d44494 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -359,7 +359,7 @@ consvar_t cv_cooplives = {"cooplives", "Avoid Game Over", CV_NETVAR|CV_CALL|CV_C static CV_PossibleValue_t advancemap_cons_t[] = {{0, "Off"}, {1, "Next"}, {2, "Random"}, {0, NULL}}; consvar_t cv_advancemap = {"advancemap", "Next", CV_NETVAR, advancemap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "All"}, {0, NULL}}; +static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}}; consvar_t cv_playersforexit = {"playersforexit", "One", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/p_user.c b/src/p_user.c index 21db4143b..08c1a7724 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9419,7 +9419,7 @@ void P_PlayerThink(player_t *player) { if (cv_playersforexit.value) // Count to be sure everyone's exited { - INT32 i; + INT32 i, total = 0, exiting = 0; for (i = 0; i < MAXPLAYERS; i++) { @@ -9428,11 +9428,12 @@ void P_PlayerThink(player_t *player) if (players[i].lives <= 0) continue; + total++; if (!players[i].exiting || players[i].exiting > 3) - break; + exiting++; } - if (i == MAXPLAYERS) + if (((4*exiting)/total) >= cv_playersforexit.value) { if (server) SendNetXCmd(XD_EXITLEVEL, NULL, 0);