mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-27 07:51:36 +00:00
Replay fixes mark whatever
Not a pancaea for EVERYTHING, just a bunch of good stuff. * Some issues with spectators not == true because the assignment wasn't casted. * Netgame status (or rather its inverse) is recorded in netreplays now, to allow for power levels controlling spawn position. * Fixed tally screen for replays to not scream infinitely at you. * P_IsLocalPlayer now uses display players in replays. * A bunch of good testing prints that helped me find these problems, commented out for now just in case we need them again soonish.
This commit is contained in:
parent
17b3cd205e
commit
3141ca0221
7 changed files with 46 additions and 21 deletions
35
src/g_demo.c
35
src/g_demo.c
|
|
@ -112,6 +112,10 @@ demoghost *ghosts = NULL;
|
|||
#define DF_BREAKTHECAPSULES 0x04 // This demo is from Break the Capsules and contains its final completion time!
|
||||
#define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ???
|
||||
|
||||
// 0x08 free
|
||||
|
||||
#define DF_NONETMP 0x10 // multiplayer but not netgame
|
||||
|
||||
#define DF_LUAVARS 0x20 // this demo contains extra lua vars
|
||||
|
||||
#define DF_ATTACKSHIFT 1
|
||||
|
|
@ -309,6 +313,7 @@ void G_ReadDemoExtraData(void)
|
|||
switch (extradata) {
|
||||
case DXD_PST_PLAYING:
|
||||
players[p].pflags |= PF_WANTSTOJOIN; // fuck you
|
||||
//CONS_Printf("player %s is despectating on tic %d\n", player_names[p], leveltime);
|
||||
break;
|
||||
|
||||
case DXD_PST_SPECTATING:
|
||||
|
|
@ -319,9 +324,11 @@ void G_ReadDemoExtraData(void)
|
|||
playeringame[p] = true;
|
||||
G_AddPlayer(p);
|
||||
players[p].spectator = true;
|
||||
//CONS_Printf("player %s is joining server on tic %d\n", player_names[p], leveltime);
|
||||
}
|
||||
else
|
||||
{
|
||||
//CONS_Printf("player %s is spectating on tic %d\n", player_names[p], leveltime);
|
||||
players[p].spectator = true;
|
||||
if (players[p].mo)
|
||||
P_DamageMobj(players[p].mo, NULL, NULL, 1, DMG_INSTAKILL);
|
||||
|
|
@ -366,7 +373,7 @@ void G_ReadDemoExtraData(void)
|
|||
P_SetRandSeed(rng);
|
||||
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced (RNG)!\n"));
|
||||
demosynced = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -863,7 +870,12 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
|||
|
||||
void G_ConsAllGhostTics(void)
|
||||
{
|
||||
UINT8 p = READUINT8(demo_p);
|
||||
UINT8 p;
|
||||
|
||||
if (!demo_p || !demo.deferstart)
|
||||
return;
|
||||
|
||||
p = READUINT8(demo_p);
|
||||
|
||||
while (p != 0xFF)
|
||||
{
|
||||
|
|
@ -888,8 +900,6 @@ void G_ConsGhostTic(INT32 playernum)
|
|||
mobj_t *testmo;
|
||||
UINT32 syncleeway;
|
||||
|
||||
if (!demo_p || !demo.deferstart)
|
||||
return;
|
||||
if (!(demoflags & DF_GHOST))
|
||||
return; // No ghost data to use.
|
||||
|
||||
|
|
@ -966,7 +976,7 @@ void G_ConsGhostTic(INT32 playernum)
|
|||
if (th != &thlist[THINK_MOBJ] && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced (health)!\n"));
|
||||
demosynced = false;
|
||||
P_DamageMobj(mobj, players[0].mo, players[0].mo, 1, DMG_NORMAL);
|
||||
}
|
||||
|
|
@ -1019,7 +1029,7 @@ void G_ConsGhostTic(INT32 playernum)
|
|||
if (ghostext[playernum].desyncframes >= 2)
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
CONS_Alert(CONS_WARNING, "Demo playback has desynced (player %s)!\n", player_names[playernum]);
|
||||
demosynced = false;
|
||||
|
||||
P_UnsetThingPosition(testmo);
|
||||
|
|
@ -1042,7 +1052,7 @@ void G_ConsGhostTic(INT32 playernum)
|
|||
|| players[playernum].bumpers != ghostext[playernum].kartbumpers)
|
||||
{
|
||||
if (demosynced)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced (item/bumpers)!\n"));
|
||||
demosynced = false;
|
||||
|
||||
players[playernum].itemtype = ghostext[playernum].kartitem;
|
||||
|
|
@ -1921,6 +1931,9 @@ void G_BeginRecording(void)
|
|||
demo_p = demobuffer;
|
||||
demoflags = DF_GHOST|(multiplayer ? DF_MULTIPLAYER : (modeattacking<<DF_ATTACKSHIFT));
|
||||
|
||||
if (multiplayer && !netgame)
|
||||
demoflags |= DF_NONETMP;
|
||||
|
||||
if (encoremode)
|
||||
demoflags |= DF_ENCORE;
|
||||
|
||||
|
|
@ -2838,6 +2851,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
|
||||
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
|
||||
multiplayer = !!(demoflags & DF_MULTIPLAYER);
|
||||
demo.netgame = (multiplayer && !(demoflags & DF_NONETMP));
|
||||
CON_ToggleOff();
|
||||
|
||||
hu_demotime = UINT32_MAX;
|
||||
|
|
@ -2927,7 +2941,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
|
||||
while (p != 0xFF)
|
||||
{
|
||||
if ((spectator = (p & DEMO_SPECTATOR)))
|
||||
if ((spectator = !!(p & DEMO_SPECTATOR)))
|
||||
{
|
||||
p &= ~DEMO_SPECTATOR;
|
||||
|
||||
|
|
@ -2975,6 +2989,11 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_Memcpy(player_names[p],demo_p,16);
|
||||
demo_p += 16;
|
||||
|
||||
/*if (players[p].spectator)
|
||||
{
|
||||
CONS_Printf("player %s is spectator at start\n", player_names[p]);
|
||||
}*/
|
||||
|
||||
// Skin
|
||||
M_Memcpy(skin,demo_p,16);
|
||||
demo_p += 16;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ struct demovars_s {
|
|||
boolean inreplayhut; // Go back to replayhut after demos
|
||||
boolean quitafterplaying; // quit after playing a demo from cmdline
|
||||
boolean deferstart; // don't start playing demo right away
|
||||
boolean netgame; // multiplayer netgame
|
||||
|
||||
tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -2551,7 +2551,7 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
|
|||
if (j == i)
|
||||
continue;
|
||||
|
||||
if (netgame && cv_kartusepwrlv.value)
|
||||
if ((netgame || (demo.playback && demo.netgame)) && cv_kartusepwrlv.value)
|
||||
{
|
||||
if (clientpowerlevels[j][PWRLV_RACE] == clientpowerlevels[i][PWRLV_RACE])
|
||||
num++;
|
||||
|
|
@ -2572,7 +2572,7 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
|
|||
pos++;
|
||||
else
|
||||
{
|
||||
if (netgame && cv_kartusepwrlv.value)
|
||||
if ((netgame || (demo.playback && demo.netgame)) && cv_kartusepwrlv.value)
|
||||
{
|
||||
if (clientpowerlevels[i][PWRLV_RACE] > clientpowerlevels[playernum][PWRLV_RACE])
|
||||
pos++;
|
||||
|
|
@ -3112,7 +3112,7 @@ boolean G_GametypeHasTeams(void)
|
|||
//
|
||||
boolean G_GametypeHasSpectators(void)
|
||||
{
|
||||
return (netgame || (multiplayer && demo.playback));
|
||||
return (netgame || (multiplayer && demo.netgame));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void K_TimerReset(void)
|
|||
void K_TimerInit(void)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT8 numPlayers = 0;
|
||||
UINT8 numPlayers = 0;//, numspec = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
|
@ -63,6 +63,7 @@ void K_TimerInit(void)
|
|||
|
||||
if (players[i].spectator == true)
|
||||
{
|
||||
//numspec++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +99,7 @@ void K_TimerInit(void)
|
|||
|
||||
// NOW you can try to spawn in the Battle capsules, if there's not enough players for a match
|
||||
K_SpawnBattleCapsules();
|
||||
//CONS_Printf("numbulbs set to %d (%d players, %d spectators) on tic %d\n", numbulbs, numPlayers, numspec, leveltime);
|
||||
}
|
||||
|
||||
UINT32 K_GetPlayerDontDrawFlag(player_t *player)
|
||||
|
|
@ -9387,6 +9389,7 @@ void K_CheckSpectateStatus(void)
|
|||
{
|
||||
if (cv_ingamecap.value && numingame+i >= cv_ingamecap.value) // Hit the in-game player cap while adding people?
|
||||
break;
|
||||
//CONS_Printf("player %s is joining on tic %d\n", player_names[respawnlist[i]], leveltime);
|
||||
P_SpectatorJoinGame(&players[respawnlist[i]]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ SINT8 K_UsingPowerLevels(void)
|
|||
{
|
||||
SINT8 pt = PWRLV_DISABLED;
|
||||
|
||||
if (!cv_kartusepwrlv.value || !netgame || grandprixinfo.gp == true)
|
||||
if (!cv_kartusepwrlv.value || !(netgame || (demo.playback && demo.netgame)) || grandprixinfo.gp == true)
|
||||
{
|
||||
return PWRLV_DISABLED;
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ void K_PlayerForfeit(UINT8 playernum, boolean pointloss)
|
|||
|
||||
clientpowerlevels[playernum][powertype] += inc;
|
||||
|
||||
if (playernum == consoleplayer)
|
||||
if (!demo.playback && playernum == consoleplayer)
|
||||
{
|
||||
vspowerlevel[powertype] = clientpowerlevels[playernum][powertype];
|
||||
if (M_UpdateUnlockablesAndExtraEmblems())
|
||||
|
|
|
|||
|
|
@ -1058,6 +1058,9 @@ boolean P_IsLocalPlayer(player_t *player)
|
|||
{
|
||||
UINT8 i;
|
||||
|
||||
if (demo.playback)
|
||||
return P_IsDisplayPlayer(player);
|
||||
|
||||
for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1
|
||||
{
|
||||
if (player == &players[g_localplayers[i]])
|
||||
|
|
@ -4352,6 +4355,7 @@ void P_PlayerThink(player_t *player)
|
|||
player->flashing = TICRATE/2 + 1;
|
||||
/*if (P_SpectatorJoinGame(player))
|
||||
return; // player->mo was removed.*/
|
||||
//CONS_Printf("player %s wants to join on tic %d\n", player_names[player-players], leveltime);
|
||||
}
|
||||
|
||||
if (player->respawn.state != RESPAWNST_NONE)
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ void Y_IntermissionDrawer(void)
|
|||
else
|
||||
hilicol = ((intertype == int_race) ? V_SKYMAP : V_REDMAP);
|
||||
|
||||
if (sorttic != -1 && intertic > sorttic && !demo.playback)
|
||||
if (sorttic != -1 && intertic > sorttic && multiplayer)
|
||||
{
|
||||
INT32 count = (intertic - sorttic);
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ void Y_IntermissionDrawer(void)
|
|||
|
||||
y2 = y;
|
||||
|
||||
if (netgame && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot)
|
||||
if ((netgame || (demo.playback && demo.netgame)) && playerconsole[data.num[i]] == 0 && server_lagless && !players[data.num[i]].bot)
|
||||
{
|
||||
static int alagles_timer = 0;
|
||||
patch_t *alagles;
|
||||
|
|
@ -799,7 +799,7 @@ void Y_Ticker(void)
|
|||
|
||||
if (intertype == int_race || intertype == int_battle)
|
||||
{
|
||||
if (!(multiplayer && demo.playback)) // Don't advance to rankings in replays
|
||||
//if (!(multiplayer && demo.playback)) // Don't advance to rankings in replays
|
||||
{
|
||||
if (!data.rankingsmode && (intertic >= sorttic + 8))
|
||||
{
|
||||
|
|
@ -868,8 +868,6 @@ void Y_Ticker(void)
|
|||
endtic = intertic + 3*TICRATE; // 3 second pause after end of tally
|
||||
}
|
||||
}
|
||||
else if (!(intertic & 1))
|
||||
S_StartSound(NULL, sfx_ptally); // tally sound effect
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1013,7 +1011,7 @@ static void K_UpdatePowerLevels(void)
|
|||
data.increase[i] = increment[i];
|
||||
clientpowerlevels[i][powertype] += data.increase[i];
|
||||
|
||||
if (i == consoleplayer)
|
||||
if (!demo.playback && i == consoleplayer)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Player %d is you! Saving...\n", i);
|
||||
vspowerlevel[powertype] = clientpowerlevels[i][powertype];
|
||||
|
|
@ -1069,7 +1067,7 @@ void Y_StartIntermission(void)
|
|||
{
|
||||
if (cv_inttime.value == 0)
|
||||
timer = 0;
|
||||
else if (demo.playback) // Override inttime (which is pulled from the replay anyway
|
||||
else if (demo.playback && !multiplayer) // Override inttime (which is pulled from the replay anyway
|
||||
timer = 10*TICRATE;
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue