finished scrambles

This commit is contained in:
TehRealSalt 2019-04-26 13:34:30 -04:00
parent 5abe25d0a5
commit 435862b29d
7 changed files with 103 additions and 74 deletions

View file

@ -369,7 +369,10 @@ static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"},
consvar_t cv_kartvoices = {"kartvoices", "Tasteful", CV_SAVE, kartvoices_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOSHOWHELP, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartusepwrlv = {"kartusepwrlv", "Yes", CV_NETVAR|CV_CHEAT, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_speedscramble = {"kartscramblespeed", "Yes", CV_NETVAR|CV_CHEAT, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_encorescramble = {"kartscrambleencore", "Yes", CV_NETVAR|CV_CHEAT, CV_YesNo, NULL, 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|CV_NOSHOWHELP, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};

View file

@ -122,6 +122,8 @@ extern consvar_t cv_kartspeedometer;
extern consvar_t cv_kartvoices;
extern consvar_t cv_karteliminatelast;
extern consvar_t cv_kartusepwrlv;
extern consvar_t cv_speedscramble;
extern consvar_t cv_encorescramble;
extern consvar_t cv_votetime;

View file

@ -474,6 +474,9 @@ extern INT16 nospectategrief[MAXPLAYERS];
extern boolean thwompsactive;
extern SINT8 spbplace;
extern SINT8 speedscramble;
extern SINT8 encorescramble;
extern boolean legitimateexit;
extern boolean comebackshowninfo;
extern tic_t curlap, bestlap;

View file

@ -274,8 +274,8 @@ boolean thwompsactive; // Thwomps activate on lap 2
SINT8 spbplace; // SPB exists, give the person behind better items
// Scrambles
SINT8 speedscramble;
SINT8 encorescramble;
SINT8 speedscramble = -1;
SINT8 encorescramble = -1;
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
boolean legitimateexit; // Did this client actually finish the match?
@ -3210,7 +3210,7 @@ INT16 G_SometimesGetDifferentGametype(void)
if (encorepossible)
{
if (encorescramble >= 0)
encorepossible = (boolean)encorescramble;
encorepossible = (boolean)encorescramble; // FORCE to what was scrambled on intermission
else
{
switch (cv_kartvoterulechanges.value)

View file

@ -545,6 +545,8 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartvoices);
CV_RegisterVar(&cv_karteliminatelast);
CV_RegisterVar(&cv_kartusepwrlv);
CV_RegisterVar(&cv_speedscramble);
CV_RegisterVar(&cv_encorescramble);
CV_RegisterVar(&cv_votetime);
CV_RegisterVar(&cv_kartdebugitem);
@ -6137,6 +6139,9 @@ INT16 K_CalculatePowerLevelAvg(void)
div++;
}
if (!div)
return 0; // No average.
avg /= div;
return (INT16)(avg >> FRACBITS);

View file

@ -2370,13 +2370,20 @@ static void P_LevelInitStuff(void)
if (G_BattleGametype())
gamespeed = 0;
else
gamespeed = (UINT8)cv_kartspeed.value;
{
if (cv_speedscramble.value && speedscramble != -1)
gamespeed = (UINT8)speedscramble;
else
gamespeed = (UINT8)cv_kartspeed.value;
}
franticitems = (boolean)cv_kartfrantic.value;
comeback = (boolean)cv_kartcomeback.value;
}
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
speedscramble = encorescramble = -1;
}
//

View file

@ -705,7 +705,7 @@ dotimer:
if (timer)
{
INT32 tickdown = (timer+1)/TICRATE;
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol,
V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol|V_SNAPTOBOTTOM,
va("%s starts in %d", cv_advancemap.string, tickdown));
}
@ -714,9 +714,9 @@ dotimer:
{
/*if (cv_scrambleonchange.value && cv_teamscramble.value)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, hilicol, M_GetText("Teams will be scrambled next round!"));*/
if (speedscramble != -1)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, hilicol|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM,
M_GetText("The next race will be %s Speed!", (speedscramble == 2 ? "Hard" : "Normal")));
if (speedscramble != -1 && speedscramble != gamespeed)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, hilicol|V_ALLOWLOWERCASE|V_SNAPTOBOTTOM,
va(M_GetText("Next race will be %s Speed!"), kartspeed_cons_t[speedscramble].strvalue));
}
}
@ -949,78 +949,87 @@ void Y_StartIntermission(void)
powertype = 0;
else if (G_BattleGametype())
powertype = 1;
}
// Race scrambles
if ((intertype == int_race) && (cv_speedscramble.value || cv_encorescramble.value))
// Race scrambles
if (powertype == 0 && (cv_speedscramble.value || cv_encorescramble.value))
{
boolean hardmode = false;
boolean encore = false;
INT16 avg = 0, min = 0;
UINT8 i, t = 0;
avg = K_CalculatePowerLevelAvg();
for (i = 0; i < MAXPLAYERS; i++)
{
boolean hardmode = false;
boolean encore = false;
INT16 avg = 0, min = 0;
UINT8 i, t = 0;
if (min == 0 || clientpowerlevels[i][0] < min)
min = clientpowerlevels[i][0];
}
avg = K_CalculatePowerLevelAvg();
for (i = 0; i < MAXPLAYERS; i++)
{
if (min == 0 || clientpowerlevels[i][0] < min)
min = clientpowerlevels[i][0];
}
if (min >= 4000)
{
if (avg >= 5000)
t = 3;
else
t = 2;
}
else if (min >= 2500)
{
if (avg >= 3000)
t = 2;
else
t = 1;
}
else if (min >= 500)
{
if (avg >= 2000)
t = 1;
else
t = 0;
}
if (min >= 6000)
{
if (avg >= 8000)
t = 4;
else
t = 3;
}
else if (min >= 4000)
{
if (avg >= 5000)
t = 3;
else
t = 2;
}
else if (min >= 2500)
{
if (avg >= 3000)
t = 2;
else
t = 1;
}
else if (min >= 500)
{
if (avg >= 2000)
t = 1;
else
t = 0;
switch (t)
{
case 3:
hardmode = true;
encore = M_RandomChance(FRACUNIT>>1);
break;
case 2:
hardmode = M_RandomChance((7<<FRACBITS)/10);
encore = M_RandomChance(FRACUNIT>>2);
break;
case 1:
hardmode = M_RandomChance((3<<FRACBITS)/10);
encore = false;
break;
case 0:
default:
hardmode = false;
encore = false;
break;
}
if (cv_speedscramble.value)
speedscramble = (hardmode ? 2 : 1);
else
speedscramble = -1;
if (cv_encorescramble.value)
encorescramble = (encore ? 1 : 0);
else
encorescramble = -1;
}
else
t = 0;
switch (t)
{
case 4:
hardmode = encore = true;
break;
case 3:
hardmode = true;
encore = M_RandomChance(FRACUNIT>>1);
break;
case 2:
hardmode = M_RandomChance((7<<FRACBITS)/10);
encore = M_RandomChance(FRACUNIT>>2);
break;
case 1:
hardmode = M_RandomChance((3<<FRACBITS)/10);
encore = false;
break;
case 0:
default:
hardmode = encore = false;
break;
}
if (cv_speedscramble.value)
speedscramble = (hardmode ? 2 : 1);
else
speedscramble = -1;
if (cv_encorescramble.value)
encorescramble = (encore ? 1 : 0);
else
encorescramble = -1;
}
if (!multiplayer)