mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'rivals-fix' into 'master'
Rivals and Replays and Re-Entry, oh my Closes #544 and #577 See merge request KartKrew/Kart!1340
This commit is contained in:
commit
7912b24e6f
7 changed files with 80 additions and 50 deletions
|
|
@ -1617,7 +1617,11 @@ 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
|
||||
&& players[playernum].spectatorReentry == 0
|
||||
)
|
||||
{
|
||||
UINT8 pcount = 0;
|
||||
|
||||
|
|
@ -3230,12 +3234,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
if (demo.timing)
|
||||
G_DoneLevelLoad();
|
||||
|
||||
if (metalrecording)
|
||||
G_BeginMetal();
|
||||
if (demo.recording) // Okay, level loaded, character spawned and skinned,
|
||||
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
||||
demo.deferstart = true;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
|
|
@ -4078,6 +4076,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
|
||||
//Now that we've done our error checking and killed the player
|
||||
//if necessary, put the player on the correct team/status.
|
||||
boolean nochangeoccourred = false;
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (!NetPacket.packet.newteam)
|
||||
|
|
@ -4089,6 +4089,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
players[playernum].ctfteam = NetPacket.packet.newteam;
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
nochangeoccourred = true;
|
||||
}
|
||||
}
|
||||
else if (G_GametypeHasSpectators())
|
||||
|
|
@ -4096,7 +4097,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
if (!NetPacket.packet.newteam)
|
||||
players[playernum].spectator = true;
|
||||
else
|
||||
{
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
nochangeoccourred = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (NetPacket.packet.autobalance)
|
||||
|
|
@ -4137,7 +4141,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
}
|
||||
}*/
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
if (gamestate != GS_LEVEL || nochangeoccourred == true)
|
||||
return;
|
||||
|
||||
FinalisePlaystateChange(playernum);
|
||||
|
|
|
|||
12
src/g_demo.c
12
src/g_demo.c
|
|
@ -3060,6 +3060,10 @@ void G_DoPlayDemo(const char *defdemoname)
|
|||
}
|
||||
else
|
||||
{
|
||||
// FIXME: this file doesn't manage its memory and actually free this when it's done using it
|
||||
//Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
|
||||
n = defdemoname+strlen(defdemoname);
|
||||
while (*n != '/' && *n != '\\' && n != defdemoname)
|
||||
n--;
|
||||
|
|
@ -4179,13 +4183,19 @@ boolean G_CheckDemoStatus(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
if (!demo.recording)
|
||||
return false;
|
||||
|
||||
if (modeattacking || demo.savemode != DSM_NOTSAVING)
|
||||
{
|
||||
G_SaveDemo();
|
||||
return true;
|
||||
}
|
||||
|
||||
Z_Free(demobuf.buffer);
|
||||
|
||||
demo.recording = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7789,33 +7789,6 @@ static void P_InitGametype(void)
|
|||
spectateGriefed = 0;
|
||||
K_CashInPowerLevels(); // Pushes power level changes even if intermission was skipped
|
||||
|
||||
if (grandprixinfo.gp == true)
|
||||
{
|
||||
if (savedata.lives > 0)
|
||||
{
|
||||
K_LoadGrandPrixSaveGame();
|
||||
savedata.lives = 0;
|
||||
}
|
||||
else if (grandprixinfo.initalize == true)
|
||||
{
|
||||
K_InitGrandPrixRank(&grandprixinfo.rank);
|
||||
K_InitGrandPrixBots();
|
||||
grandprixinfo.initalize = false;
|
||||
}
|
||||
else if (grandprixinfo.wonround == true)
|
||||
{
|
||||
K_UpdateGrandPrixBots();
|
||||
grandprixinfo.wonround = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're in a Match Race, use simplistic randomized bots.
|
||||
K_UpdateMatchRaceBots();
|
||||
}
|
||||
|
||||
P_InitPlayers();
|
||||
|
||||
if (modeattacking && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
|
|
@ -8331,8 +8304,13 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
// a netgame save is being loaded, and could actively be harmful by messing with
|
||||
// the client's view of the data.)
|
||||
if (!fromnetsave)
|
||||
{
|
||||
P_InitGametype();
|
||||
|
||||
// Initialize ACS scripts
|
||||
ACS_LoadLevelScripts(gamemap-1);
|
||||
}
|
||||
|
||||
// Now safe to free.
|
||||
vres_Free(curmapvirt);
|
||||
curmapvirt = NULL;
|
||||
|
|
@ -8344,12 +8322,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
K_InitDirector();
|
||||
}
|
||||
|
||||
// Initialize ACS scripts
|
||||
if (!fromnetsave)
|
||||
{
|
||||
ACS_LoadLevelScripts(gamemap-1);
|
||||
}
|
||||
|
||||
// Remove the loading shit from the screen
|
||||
if (rendermode != render_none && !titlemapinaction && !reloadinggamestate)
|
||||
F_WipeColorFill(levelfadecol);
|
||||
|
|
@ -8415,6 +8387,48 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
|
||||
void P_PostLoadLevel(void)
|
||||
{
|
||||
P_MapStart();
|
||||
|
||||
if (G_GametypeHasSpectators())
|
||||
{
|
||||
K_CheckSpectateStatus(false);
|
||||
}
|
||||
|
||||
if (demo.playback)
|
||||
;
|
||||
else if (grandprixinfo.gp == true)
|
||||
{
|
||||
if (savedata.lives > 0)
|
||||
{
|
||||
K_LoadGrandPrixSaveGame();
|
||||
savedata.lives = 0;
|
||||
}
|
||||
else if (grandprixinfo.initalize == true)
|
||||
{
|
||||
K_InitGrandPrixRank(&grandprixinfo.rank);
|
||||
K_InitGrandPrixBots();
|
||||
grandprixinfo.initalize = false;
|
||||
}
|
||||
else if (grandprixinfo.wonround == true)
|
||||
{
|
||||
K_UpdateGrandPrixBots();
|
||||
grandprixinfo.wonround = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're in a Match Race, use simplistic randomized bots.
|
||||
K_UpdateMatchRaceBots();
|
||||
}
|
||||
|
||||
P_InitPlayers();
|
||||
|
||||
if (metalrecording)
|
||||
G_BeginMetal();
|
||||
if (demo.recording) // Okay, level loaded, character spawned and skinned,
|
||||
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
||||
demo.deferstart = true;
|
||||
|
||||
K_TimerInit();
|
||||
|
||||
nextmapoverride = 0;
|
||||
|
|
@ -8429,12 +8443,10 @@ void P_PostLoadLevel(void)
|
|||
marathonmode &= ~MA_INIT;
|
||||
}
|
||||
|
||||
P_MapStart(); // just in case MapLoad modifies tm.thing
|
||||
|
||||
ACS_RunLevelStartScripts();
|
||||
LUA_HookInt(gamemap, HOOK(MapLoad));
|
||||
|
||||
P_MapEnd(); // just in case MapLoad modifies tm.thing
|
||||
P_MapEnd();
|
||||
|
||||
// We're now done loading the level.
|
||||
levelloading = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue