Added the ability to toggle the f-zero style elimination of last place specifically.

Type `karteliminatelast off` to turn it off, and `karteliminatelast on` to... you know the rest.
This commit is contained in:
toaster 2018-07-25 21:33:03 +01:00
parent 0dc2c43a67
commit bd12658355
4 changed files with 33 additions and 17 deletions

View file

@ -114,6 +114,7 @@ static void KartFrantic_OnChange(void);
static void KartSpeed_OnChange(void);
static void KartMirror_OnChange(void);
static void KartComeback_OnChange(void);
static void KartEliminateLast_OnChange(void);
#ifdef NETGAME_DEVMODE
static void Fishcake_OnChange(void);
@ -366,6 +367,9 @@ consvar_t cv_kartmirror = {"kartmirror", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NO
static CV_PossibleValue_t kartspeedometer_cons_t[] = {{0, "Off"}, {1, "Kilometers"}, {2, "Miles"}, {3, "Fracunits"}, {0, NULL}};
consvar_t cv_kartspeedometer = {"kartdisplayspeed", "Off", CV_SAVE, kartspeedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
// this might be a debug or it might be an undocumented regular feature
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL, CV_OnOff, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartdebugitem_cons_t[] = {{-1, "MIN"}, {NUMKARTITEMS-1, "MAX"}, {0, NULL}};
consvar_t cv_kartdebugitem = {"kartdebugitem", "0", CV_NETVAR|CV_CHEAT, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartdebugamount_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
@ -5260,3 +5264,9 @@ static void KartComeback_OnChange(void)
}
}
}
static void KartEliminateLast_OnChange(void)
{
if (G_RaceGametype() && cv_karteliminatelast.value)
P_CheckRacers();
}

View file

@ -127,6 +127,8 @@ extern consvar_t cv_kartcomeback;
extern consvar_t cv_kartmirror;
extern consvar_t cv_kartspeedometer;
extern consvar_t cv_karteliminatelast;
extern consvar_t cv_votetime;
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugcheckpoint, cv_kartdebugshrink;

View file

@ -403,6 +403,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartcomeback);
CV_RegisterVar(&cv_kartmirror);
CV_RegisterVar(&cv_kartspeedometer);
CV_RegisterVar(&cv_karteliminatelast);
CV_RegisterVar(&cv_votetime);
CV_RegisterVar(&cv_kartdebugitem);

View file

@ -2068,29 +2068,32 @@ boolean P_CheckRacers(void)
return true;
}
for (j = 0; j < MAXPLAYERS; j++)
if (cv_karteliminatelast.value)
{
if (!playeringame[j] || players[j].spectator)
continue;
numplayersingame++;
}
if (numplayersingame > 1) // if there's more than one player in-game, this is safe to do
{
// check if we just got unlucky and there was only one guy who was a problem
for (j = i+1; j < MAXPLAYERS; j++)
for (j = 0; j < MAXPLAYERS; j++)
{
if (!playeringame[j] || players[j].spectator || players[j].exiting || !players[j].lives)
if (!playeringame[j] || players[j].spectator)
continue;
break;
numplayersingame++;
}
if (j == MAXPLAYERS) // finish anyways, force a time over
if (numplayersingame > 1) // if there's more than one player in-game, this is safe to do
{
P_DoTimeOver(&players[i]);
countdown = countdown2 = 0;
return true;
// check if we just got unlucky and there was only one guy who was a problem
for (j = i+1; j < MAXPLAYERS; j++)
{
if (!playeringame[j] || players[j].spectator || players[j].exiting || !players[j].lives)
continue;
break;
}
if (j == MAXPLAYERS) // finish anyways, force a time over
{
P_DoTimeOver(&players[i]);
countdown = countdown2 = 0;
return true;
}
}
}