mirror of
				https://github.com/KartKrewDev/RingRacers.git
				synced 2025-10-30 08:01:28 +00:00 
			
		
		
		
	Improve Spectator entry handling
- Re-entry SHOULDN'T get stuck nonzero on first join for a given node
    - Set to 0 for all players on level start
    - Set to 0 for all players on level end
    - DEFINITELY never intentionally set on join with teamchange finalisation
    - This basically just prevents people from spamming New Challenger after hopping out mid-session, since the previous version, in addition to being buggy, was a little annoying.
- New Challenger no longer happens on tic 0 of mapload
    - Handles any late, pending PF_PF_WANTSTOJOINs without threat of reset in P_PostLoadLevel
			
			
This commit is contained in:
		
							parent
							
								
									4885611f47
								
							
						
					
					
						commit
						e0b47b16e7
					
				
					 6 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1617,7 +1617,7 @@ static void FinalisePlaystateChange(INT32 playernum)
 | 
			
		|||
		// To attempt to discourage rage-spectators, we delay any rejoining.
 | 
			
		||||
		// If you're engaging in a DUEL and quit early, in addition to the
 | 
			
		||||
		// indignity of losing your PWR, you get a special extra-long delay.
 | 
			
		||||
		if (netgame)
 | 
			
		||||
		if (netgame && players[playernum].jointime > 1)
 | 
			
		||||
		{
 | 
			
		||||
			UINT8 pcount = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2374,7 +2374,7 @@ void G_Ticker(boolean run)
 | 
			
		|||
			&& (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING // definitely good
 | 
			
		||||
			|| gamestate == GS_WAITINGPLAYERS)) // definitely a problem if we don't do it at all in this gamestate, but might need more protection?
 | 
			
		||||
		{
 | 
			
		||||
			K_CheckSpectateStatus();
 | 
			
		||||
			K_CheckSpectateStatus(true);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (pausedelay && pausedelay != INT32_MIN)
 | 
			
		||||
| 
						 | 
				
			
			@ -2436,6 +2436,8 @@ static inline void G_PlayerFinishLevel(INT32 player)
 | 
			
		|||
 | 
			
		||||
	p->starpostnum = 0;
 | 
			
		||||
	memset(&p->respawn, 0, sizeof (p->respawn));
 | 
			
		||||
 | 
			
		||||
	p->spectatorReentry = 0; // Clean up any pending re-entry forbiddings
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11740,7 +11740,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
 | 
			
		|||
	Obj_RingShooterInput(player);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void K_CheckSpectateStatus(void)
 | 
			
		||||
void K_CheckSpectateStatus(boolean considermapreset)
 | 
			
		||||
{
 | 
			
		||||
	UINT8 respawnlist[MAXPLAYERS];
 | 
			
		||||
	UINT8 i, j, numingame = 0, numjoiners = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -11770,7 +11770,7 @@ void K_CheckSpectateStatus(void)
 | 
			
		|||
			players[i].spectatewait = 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (gamestate != GS_LEVEL)
 | 
			
		||||
		if (gamestate != GS_LEVEL || considermapreset == false)
 | 
			
		||||
		{
 | 
			
		||||
			players[i].spectatorReentry = 0;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -11881,6 +11881,9 @@ void K_CheckSpectateStatus(void)
 | 
			
		|||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (considermapreset == false)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	// Reset the match when 2P joins 1P, DUEL mode
 | 
			
		||||
	// Reset the match when 3P joins 1P and 2P, DUEL mode must be disabled
 | 
			
		||||
	if (i > 0 && !mapreset && gamestate == GS_LEVEL && (numingame < 3 && numingame+i >= 2))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -189,7 +189,7 @@ boolean K_FastFallBounce(player_t *player);
 | 
			
		|||
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original);
 | 
			
		||||
void K_AdjustPlayerFriction(player_t *player);
 | 
			
		||||
void K_MoveKartPlayer(player_t *player, boolean onground);
 | 
			
		||||
void K_CheckSpectateStatus(void);
 | 
			
		||||
void K_CheckSpectateStatus(boolean considermapreset);
 | 
			
		||||
UINT8 K_GetInvincibilityItemFrame(void);
 | 
			
		||||
UINT8 K_GetOrbinautItemFrame(UINT8 count);
 | 
			
		||||
boolean K_IsSPBInGame(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11830,7 +11830,6 @@ void P_SpawnPlayer(INT32 playernum)
 | 
			
		|||
	else if (netgame && p->jointime <= 1 && pcount)
 | 
			
		||||
	{
 | 
			
		||||
		p->spectator = true;
 | 
			
		||||
		p->spectatorReentry = 0;
 | 
			
		||||
	}
 | 
			
		||||
	else if (multiplayer && !netgame)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8389,6 +8389,11 @@ void P_PostLoadLevel(void)
 | 
			
		|||
{
 | 
			
		||||
	P_MapStart();
 | 
			
		||||
 | 
			
		||||
	if (G_GametypeHasSpectators())
 | 
			
		||||
	{
 | 
			
		||||
		K_CheckSpectateStatus(false);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (demo.playback)
 | 
			
		||||
		;
 | 
			
		||||
	else if (grandprixinfo.gp == true)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue