Fuck it, I'll rewrite parts of PWR later

This commit is contained in:
Antonio Martinez 2025-05-25 18:19:05 -04:00
parent d079783e33
commit 066a804614
3 changed files with 16 additions and 13 deletions

View file

@ -4283,7 +4283,6 @@ void K_CheckpointCrossAward(player_t *player)
if (K_InRaceDuel() && player->position == 1)
{
player->duelscore += 1;
K_UpdatePowerLevels(player, player->laps, false);
if (leveltime > (tic_t)(TICRATE*DUELOVERTIME))
{
@ -11159,6 +11158,7 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
player->respawn.state == RESPAWNST_NONE && // Respawning should be a full reset.
old_currentwaypoint != NULL && // So should touching the first waypoint ever.
player->laps != 0 && // POSITION rooms may have unorthodox waypoints to guide bots.
player->exiting == 0 && // What the fuck? Why do duels antiskip the bot?
!(player->pflags & PF_TRUSTWAYPOINTS)) // Special exception.
{
extern consvar_t cv_debuglapcheat;

View file

@ -214,6 +214,10 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
CONS_Debug(DBG_PWRLV, "========\n");
yourPower = clientpowerlevels[playerNum][powerType];
if (K_InRaceDuel())
yourPower += clientPowerAdd[playerNum];
if (yourPower == 0)
{
// Guests don't record power level changes.
@ -257,6 +261,9 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
CONS_Debug(DBG_PWRLV, "%s VS %s:\n", player_names[playerNum], player_names[i]);
theirPower = clientpowerlevels[i][powerType];
if (K_InRaceDuel())
theirPower += clientPowerAdd[i];
if (theirPower == 0)
{
// No power level (splitscreen guests, bots)
@ -302,14 +309,9 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
{
INT16 prevInc = inc;
// Long duels mean players were closer. Less PWR changes hands when there's a lot of back-and-forth.
INT32 winnerscore = (yourScore > theirScore) ? player->duelscore : players[i].duelscore;
INT32 divisor = 1;
if (winnerscore > DUELWINNINGSCORE) // Opponent scored at least one point.
divisor += (winnerscore - DUELWINNINGSCORE);
inc /= divisor;
// INT32 winnerscore = (yourScore > theirScore) ? player->duelscore : players[i].duelscore;
INT32 multiplier = 2;
inc *= multiplier;
if (inc == 0)
{
@ -323,7 +325,9 @@ void K_UpdatePowerLevels(player_t *player, UINT8 lap, boolean forfeit)
}
}
CONS_Debug(DBG_PWRLV, "DUELING: Reduced (%d / %d = %d)\n", prevInc, divisor, inc);
// CONS_Printf("%s PWR UPDATE: %d\n", player_names[player - players], inc);
CONS_Debug(DBG_PWRLV, "DUELING: Boosted (%d * %d = %d)\n", prevInc, multiplier, inc);
}
else
{
@ -431,7 +435,7 @@ INT16 K_FinalPowerIncrement(player_t *player, INT16 yourPower, INT16 baseInc)
if (inc <= 0)
{
if (player->position == 1 && numPlayers > 1)
if (player->position == 1 && numPlayers > 1 && !(K_InRaceDuel()))
{
// Won the whole match?
// Get at least one point.

View file

@ -2151,8 +2151,7 @@ static void K_HandleLapIncrement(player_t *player)
player->laptime[LAP_CUR] = 0;
// Update power levels for this lap.
if (!K_InRaceDuel) // we do this in K_CheckpointCrossAward instead
K_UpdatePowerLevels(player, player->laps, false);
K_UpdatePowerLevels(player, player->laps, false);
K_CheckpointCrossAward(player);