mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Merge branch 'battle-exp-queue' into 'master'
Implement score-to-EXP scaling for Battle and Duel Race when Mobiums are not enabled. See merge request kart-krew-dev/ring-racers!69
This commit is contained in:
		
						commit
						15f66de4af
					
				
					 2 changed files with 67 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1038,6 +1038,8 @@ boolean K_EndBattleRound(player_t *victor)
 | 
			
		|||
			// exiting, the round has already ended.
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		UINT32 topscore = 0;
 | 
			
		||||
 | 
			
		||||
		if (gametyperules & GTR_POINTLIMIT)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -1046,7 +1048,27 @@ boolean K_EndBattleRound(player_t *victor)
 | 
			
		|||
			// TODO: a "won the round" bool used for sorting
 | 
			
		||||
			// position / intermission, so we aren't completely
 | 
			
		||||
			// clobbering the individual scoring.
 | 
			
		||||
			victor->roundscore = 100;
 | 
			
		||||
			
 | 
			
		||||
			// This isn't quite the above TODO but it's something?
 | 
			
		||||
			// For purposes of score-to-EXP conversion, we need to not lock the winner to an arbitrarily high score.
 | 
			
		||||
			// Instead, let's find the highest score, and if they're not the highest scoring player,
 | 
			
		||||
			// give them a bump so they *are* the highest scoring player.
 | 
			
		||||
			for (INT32 i = 0; i < MAXPLAYERS; i++)
 | 
			
		||||
			{
 | 
			
		||||
				if (!playeringame[i] || players[i].spectator)
 | 
			
		||||
				{
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				if ((&players[i])->roundscore > topscore)
 | 
			
		||||
				{
 | 
			
		||||
					topscore = (&players[i])->roundscore;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (victor->roundscore <= topscore)
 | 
			
		||||
			{
 | 
			
		||||
				victor->roundscore = topscore + 3;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (G_GametypeHasTeams() == true && victor->team != TEAM_UNASSIGNED)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,6 +162,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
 | 
			
		|||
	boolean completed[MAXPLAYERS];
 | 
			
		||||
	INT32 numplayersingame = 0;
 | 
			
		||||
	boolean getmainplayer = false;
 | 
			
		||||
	UINT32 topscore = 0, btopemeralds = 0;
 | 
			
		||||
 | 
			
		||||
	// Initialize variables
 | 
			
		||||
	if (rankingsmode > 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -190,6 +191,27 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
 | 
			
		|||
			data.increase[i] = INT16_MIN;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// for getting the proper maximum value for score-to-EXP conversion
 | 
			
		||||
		if (gametype == GT_BATTLE)
 | 
			
		||||
		{
 | 
			
		||||
			if ((&players[i])->roundscore > topscore)
 | 
			
		||||
			{
 | 
			
		||||
				topscore = (&players[i])->roundscore;
 | 
			
		||||
			}
 | 
			
		||||
			if (K_NumEmeralds(&players[i]) > btopemeralds)
 | 
			
		||||
			{
 | 
			
		||||
				btopemeralds = K_NumEmeralds(&players[i]); // necessary so non-emerald wins can still get max EXP if no one else is holding more emeralds
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (K_InRaceDuel() == true)
 | 
			
		||||
		{
 | 
			
		||||
			if (((UINT32)(&players[i])->duelscore) > topscore)
 | 
			
		||||
			{
 | 
			
		||||
				topscore = (&players[i])->duelscore;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!rankingsmode)
 | 
			
		||||
			data.increase[i] = INT16_MIN;
 | 
			
		||||
| 
						 | 
				
			
			@ -294,12 +316,33 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
 | 
			
		|||
			if (powertype == PWRLV_DISABLED)
 | 
			
		||||
			{
 | 
			
		||||
				UINT8 pointgetters = numplayersingame + spectateGriefed;
 | 
			
		||||
				UINT32 scoreconversion = 0;
 | 
			
		||||
				UINT32 pscore = 0;
 | 
			
		||||
 | 
			
		||||
				// accept players that nocontest, but not bots
 | 
			
		||||
				if (data.pos[data.numplayers] <= pointgetters &&
 | 
			
		||||
					!((players[i].pflags & PF_NOCONTEST) && players[i].bot))
 | 
			
		||||
				{
 | 
			
		||||
					data.increase[i] = K_CalculateGPRankPoints((&players[i])->exp, data.pos[data.numplayers], pointgetters);
 | 
			
		||||
					if (gametype == GT_BATTLE)
 | 
			
		||||
					{
 | 
			
		||||
						pscore = (&players[i])->roundscore + K_NumEmeralds(&players[i]);
 | 
			
		||||
						scoreconversion = FixedRescale(pscore, 0, topscore + btopemeralds, Easing_Linear, EXP_MIN, EXP_MAX);
 | 
			
		||||
						data.increase[i] = K_CalculateGPRankPoints(scoreconversion, data.pos[data.numplayers], pointgetters);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						// For Duel scoring, convert duelscore into EXP.
 | 
			
		||||
						if (K_InRaceDuel())
 | 
			
		||||
						{
 | 
			
		||||
							pscore = (&players[i])->duelscore;
 | 
			
		||||
							scoreconversion = FixedRescale(pscore, 0, topscore, Easing_Linear, EXP_MIN, EXP_MAX);
 | 
			
		||||
							data.increase[i] = K_CalculateGPRankPoints(scoreconversion, data.pos[data.numplayers], pointgetters);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							data.increase[i] = K_CalculateGPRankPoints((&players[i])->exp, data.pos[data.numplayers], pointgetters);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (data.winningteam != TEAM_UNASSIGNED)
 | 
			
		||||
					{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue