mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Merge branch 'forfeit-fixes' into 'master'
PWR forfeit / calculation fixes Closes #1642 See merge request kart-krew-dev/ring-racers-internal!2766
This commit is contained in:
commit
90ee6dbdc0
7 changed files with 52 additions and 25 deletions
|
|
@ -900,6 +900,8 @@ struct player_t
|
||||||
|
|
||||||
boolean pullup; // True if the player is attached to a pullup hook
|
boolean pullup; // True if the player is attached to a pullup hook
|
||||||
|
|
||||||
|
boolean finalized; // Did PWR finalize already, don't repeat it even if exit conditions are weird.
|
||||||
|
|
||||||
tic_t ebrakefor; // Ebrake timer, used for visuals.
|
tic_t ebrakefor; // Ebrake timer, used for visuals.
|
||||||
|
|
||||||
UINT16 faultflash; // Used for misc FAULT visuals
|
UINT16 faultflash; // Used for misc FAULT visuals
|
||||||
|
|
|
||||||
|
|
@ -2289,6 +2289,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
|
|
||||||
boolean cangrabitems;
|
boolean cangrabitems;
|
||||||
|
|
||||||
|
boolean finalized;
|
||||||
|
|
||||||
SINT8 xtralife;
|
SINT8 xtralife;
|
||||||
|
|
||||||
uint8_t public_key[PUBKEYLENGTH];
|
uint8_t public_key[PUBKEYLENGTH];
|
||||||
|
|
@ -2481,6 +2483,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
bigwaypointgap = 0;
|
bigwaypointgap = 0;
|
||||||
duelscore = 0;
|
duelscore = 0;
|
||||||
|
|
||||||
|
finalized = false;
|
||||||
|
|
||||||
tallyactive = false;
|
tallyactive = false;
|
||||||
|
|
||||||
cangrabitems = 0;
|
cangrabitems = 0;
|
||||||
|
|
@ -2517,6 +2521,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
gradingfactor = players[player].gradingfactor;
|
gradingfactor = players[player].gradingfactor;
|
||||||
gradingpointnum = players[player].gradingpointnum;
|
gradingpointnum = players[player].gradingpointnum;
|
||||||
|
|
||||||
|
finalized = players[player].finalized;
|
||||||
|
|
||||||
roundscore = players[player].roundscore;
|
roundscore = players[player].roundscore;
|
||||||
|
|
||||||
exiting = players[player].exiting;
|
exiting = players[player].exiting;
|
||||||
|
|
@ -2667,6 +2673,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
p->botvars.foe = botfoe;
|
p->botvars.foe = botfoe;
|
||||||
p->xtralife = xtralife;
|
p->xtralife = xtralife;
|
||||||
|
|
||||||
|
p->finalized = finalized;
|
||||||
|
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
p->itemtype = itemtype;
|
p->itemtype = itemtype;
|
||||||
p->itemamount = itemamount;
|
p->itemamount = itemamount;
|
||||||
|
|
|
||||||
|
|
@ -182,10 +182,10 @@ INT16 K_CalculatePowerLevelAvg(void)
|
||||||
return (INT16)avg;
|
return (INT16)avg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
void K_UpdatePowerLevels(player_t *player, UINT8 gradingpoint, boolean forfeit)
|
||||||
{
|
{
|
||||||
const UINT8 playerNum = player - players;
|
const UINT8 playerNum = player - players;
|
||||||
const boolean exitBonus = ((lap > numlaps) || (player->pflags & PF_NOCONTEST));
|
const boolean exitBonus = ((gradingpoint >= K_GetNumGradingPoints()) || (player->pflags & PF_NOCONTEST));
|
||||||
|
|
||||||
SINT8 powerType = K_UsingPowerLevels();
|
SINT8 powerType = K_UsingPowerLevels();
|
||||||
|
|
||||||
|
|
@ -204,13 +204,21 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playeringame[playerNum] || player->spectator)
|
// Spectators don't have immunity if they're forfeiting: we're TRYING to punish them!
|
||||||
|
if (!playeringame[playerNum] || (player->spectator && !forfeit))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Probably being called from some stray codepath or a double exit.
|
||||||
|
// We have already finished calculating PWR, don't touch anything!
|
||||||
|
if (player->finalized)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Debug(DBG_PWRLV, "\n========\n");
|
CONS_Debug(DBG_PWRLV, "\n========\n");
|
||||||
CONS_Debug(DBG_PWRLV, "* Power Level change for player %s (LAP %d) *\n", player_names[playerNum], lap);
|
CONS_Debug(DBG_PWRLV, "* Power Level change for player %s (CHECKPOINT %d) *\n", player_names[playerNum], gradingpoint);
|
||||||
CONS_Debug(DBG_PWRLV, "========\n");
|
CONS_Debug(DBG_PWRLV, "========\n");
|
||||||
|
|
||||||
yourPower = clientpowerlevels[playerNum][powerType];
|
yourPower = clientpowerlevels[playerNum][powerType];
|
||||||
|
|
@ -310,7 +318,7 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
||||||
INT16 prevInc = inc;
|
INT16 prevInc = inc;
|
||||||
|
|
||||||
// INT32 winnerscore = (yourScore > theirScore) ? player->duelscore : players[i].duelscore;
|
// INT32 winnerscore = (yourScore > theirScore) ? player->duelscore : players[i].duelscore;
|
||||||
INT32 multiplier = 2;
|
INT16 multiplier = 2;
|
||||||
inc *= multiplier;
|
inc *= multiplier;
|
||||||
|
|
||||||
if (inc == 0)
|
if (inc == 0)
|
||||||
|
|
@ -335,7 +343,11 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
||||||
{
|
{
|
||||||
INT16 prevInc = inc;
|
INT16 prevInc = inc;
|
||||||
|
|
||||||
inc /= max(numlaps-1, 1);
|
// WARNING, BULLSHIT TYPING REASONS MAKE DOING THIS
|
||||||
|
// INLINE POSTFIX COMPLETE NONSENSE
|
||||||
|
// LIKE, -9 / 12 = 27000 NONSENSE
|
||||||
|
INT16 dvs = max(K_GetNumGradingPoints(), 1);
|
||||||
|
inc = inc / dvs;
|
||||||
|
|
||||||
if (inc == 0)
|
if (inc == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -349,7 +361,7 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Debug(DBG_PWRLV, "Reduced (%d / %d = %d) because it's not the end of the race\n", prevInc, numlaps, inc);
|
CONS_Debug(DBG_PWRLV, "Reduced (%d / %d = %d) because it's not the end of the race\n", prevInc, dvs, inc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,29 +390,32 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
|
||||||
|
|
||||||
void K_UpdatePowerLevelsFinalize(player_t *player, boolean onForfeit)
|
void K_UpdatePowerLevelsFinalize(player_t *player, boolean onForfeit)
|
||||||
{
|
{
|
||||||
// Finalize power level increments for any laps not yet calculated.
|
if (player->finalized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Finalize power level increments for any checkpoints not yet calculated.
|
||||||
// For spectate / quit / NO CONTEST
|
// For spectate / quit / NO CONTEST
|
||||||
INT16 lapsLeft = 0;
|
INT16 checksleft = 0;
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
// No remaining laps in Duel.
|
// No remaining laps in Duel.
|
||||||
if (K_InRaceDuel())
|
if (K_InRaceDuel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lapsLeft = (numlaps - player->latestlap) + 1;
|
checksleft = K_GetNumGradingPoints() - player->gradingpointnum;
|
||||||
|
|
||||||
if (lapsLeft <= 0)
|
if (checksleft <= 0)
|
||||||
{
|
{
|
||||||
// We've done every lap already.
|
// We've done every checkpoint already.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < lapsLeft; i++)
|
for (i = 1; i <= checksleft; i++)
|
||||||
{
|
{
|
||||||
K_UpdatePowerLevels(player, player->latestlap + (i + 1), onForfeit);
|
K_UpdatePowerLevels(player, player->gradingpointnum + i, onForfeit);
|
||||||
}
|
}
|
||||||
|
|
||||||
player->latestlap = numlaps+1;
|
player->finalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 K_FinalPowerIncrement(player_t *player, INT16 yourPower, INT16 baseInc)
|
INT16 K_FinalPowerIncrement(player_t *player, INT16 yourPower, INT16 baseInc)
|
||||||
|
|
@ -705,7 +720,7 @@ void K_PlayerForfeit(UINT8 playerNum, boolean pointLoss)
|
||||||
|
|
||||||
if (pointLoss)
|
if (pointLoss)
|
||||||
{
|
{
|
||||||
clientpowerlevels[playerNum][powerType] += clientPowerAdd[playerNum];
|
clientpowerlevels[playerNum][powerType] += inc;
|
||||||
clientPowerAdd[playerNum] = 0;
|
clientPowerAdd[playerNum] = 0;
|
||||||
SV_UpdateStats();
|
SV_UpdateStats();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void K_ClearClientPowerLevels(void);
|
||||||
INT16 K_CalculatePowerLevelInc(INT16 diff);
|
INT16 K_CalculatePowerLevelInc(INT16 diff);
|
||||||
INT16 K_PowerLevelPlacementScore(player_t *player);
|
INT16 K_PowerLevelPlacementScore(player_t *player);
|
||||||
INT16 K_CalculatePowerLevelAvg(void);
|
INT16 K_CalculatePowerLevelAvg(void);
|
||||||
void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit);
|
void K_UpdatePowerLevels(player_t *player, UINT8 gradingpoint, boolean forfeit);
|
||||||
void K_UpdatePowerLevelsFinalize(player_t *player, boolean onForfeit);
|
void K_UpdatePowerLevelsFinalize(player_t *player, boolean onForfeit);
|
||||||
INT16 K_FinalPowerIncrement(player_t *player, INT16 yourPower, INT16 increment);
|
INT16 K_FinalPowerIncrement(player_t *player, INT16 yourPower, INT16 increment);
|
||||||
void K_CashInPowerLevels(void);
|
void K_CashInPowerLevels(void);
|
||||||
|
|
|
||||||
|
|
@ -520,8 +520,8 @@ struct CheckpointManager
|
||||||
chk->gingerbread();
|
chk->gingerbread();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
lines_.clear();
|
lines_.clear();
|
||||||
list_.clear();
|
list_.clear();
|
||||||
count_ = 0;
|
count_ = 0;
|
||||||
|
|
@ -588,7 +588,7 @@ void Obj_CrossCheckpoints(player_t* player, fixed_t old_x, fixed_t old_y)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LineOnDemand ray(old_x, old_y, player->mo->x, player->mo->y, player->mo->radius);
|
LineOnDemand ray(old_x, old_y, player->mo->x, player->mo->y, player->mo->radius);
|
||||||
|
|
||||||
auto it = std::find_if(
|
auto it = std::find_if(
|
||||||
|
|
@ -699,7 +699,7 @@ void Obj_CrossCheckpoints(player_t* player, fixed_t old_x, fixed_t old_y)
|
||||||
K_SpawnEXP(player, expdiff, chk->other());
|
K_SpawnEXP(player, expdiff, chk->other());
|
||||||
}
|
}
|
||||||
|
|
||||||
K_UpdatePowerLevels(player, player->laps, false);
|
K_UpdatePowerLevels(player, player->gradingpointnum, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mobj_t* Obj_FindCheckpoint(INT32 id)
|
mobj_t* Obj_FindCheckpoint(INT32 id)
|
||||||
|
|
|
||||||
|
|
@ -610,6 +610,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
|
|
||||||
WRITEUINT8(save->p, players[i].pullup);
|
WRITEUINT8(save->p, players[i].pullup);
|
||||||
|
|
||||||
|
WRITEUINT8(save->p, players[i].finalized);
|
||||||
|
|
||||||
WRITEUINT32(save->p, players[i].ebrakefor);
|
WRITEUINT32(save->p, players[i].ebrakefor);
|
||||||
|
|
||||||
WRITEUINT32(save->p, players[i].roundscore);
|
WRITEUINT32(save->p, players[i].roundscore);
|
||||||
|
|
@ -1283,6 +1285,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
|
|
||||||
players[i].pullup = READUINT8(save->p);
|
players[i].pullup = READUINT8(save->p);
|
||||||
|
|
||||||
|
players[i].finalized = READUINT8(save->p);
|
||||||
|
|
||||||
players[i].ebrakefor = READUINT32(save->p);
|
players[i].ebrakefor = READUINT32(save->p);
|
||||||
|
|
||||||
players[i].roundscore = READUINT32(save->p);
|
players[i].roundscore = READUINT32(save->p);
|
||||||
|
|
|
||||||
|
|
@ -2127,11 +2127,9 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
player->laptime[LAP_LAST] = player->laptime[LAP_CUR];
|
player->laptime[LAP_LAST] = player->laptime[LAP_CUR];
|
||||||
player->laptime[LAP_CUR] = 0;
|
player->laptime[LAP_CUR] = 0;
|
||||||
|
|
||||||
// Update power levels for this lap.
|
|
||||||
K_UpdatePowerLevels(player, player->laps, false);
|
|
||||||
|
|
||||||
UINT16 oldexp = player->exp;
|
UINT16 oldexp = player->exp;
|
||||||
K_CheckpointCrossAward(player);
|
K_CheckpointCrossAward(player);
|
||||||
|
K_UpdatePowerLevels(player, player->gradingpointnum, false);
|
||||||
|
|
||||||
if (player->exp > oldexp)
|
if (player->exp > oldexp)
|
||||||
{
|
{
|
||||||
|
|
@ -9638,7 +9636,7 @@ void P_DoQuakeOffset(UINT8 view, mappoint_t *viewPos, mappoint_t *offset)
|
||||||
{
|
{
|
||||||
if (r_splitscreen != 1)
|
if (r_splitscreen != 1)
|
||||||
maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4;
|
maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4;
|
||||||
|
|
||||||
// For 2p SPLITSCREEN SPECIFICALLY:
|
// For 2p SPLITSCREEN SPECIFICALLY:
|
||||||
// The view is pretty narrow, so move it back 3/20 of the way towards default camera height.
|
// The view is pretty narrow, so move it back 3/20 of the way towards default camera height.
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue