mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-01 07:11:02 +00:00
Add support for encore and battle replays
This commit is contained in:
parent
ce59b705a4
commit
fe7c6c7f83
1 changed files with 10 additions and 1 deletions
11
src/g_game.c
11
src/g_game.c
|
@ -4629,6 +4629,9 @@ char *G_BuildMapTitle(INT32 mapnum)
|
||||||
#define DF_NIGHTSATTACK 0x04 // This demo is from NiGHTS attack and contains its time left, score, and mares!
|
#define DF_NIGHTSATTACK 0x04 // This demo is from NiGHTS attack and contains its time left, score, and mares!
|
||||||
#define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ???
|
#define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ???
|
||||||
#define DF_ATTACKSHIFT 1
|
#define DF_ATTACKSHIFT 1
|
||||||
|
#define DF_GAMETYPEMASK 0x30
|
||||||
|
#define DF_GAMESHIFT 4
|
||||||
|
#define DF_ENCORE 0x40
|
||||||
#define DF_MULTIPLAYER 0x80 // This demo contains a dynamic number of players!
|
#define DF_MULTIPLAYER 0x80 // This demo contains a dynamic number of players!
|
||||||
|
|
||||||
#define DEMO_SPECTATOR 0x40
|
#define DEMO_SPECTATOR 0x40
|
||||||
|
@ -5767,6 +5770,11 @@ void G_BeginRecording(void)
|
||||||
demo_p = demobuffer;
|
demo_p = demobuffer;
|
||||||
demoflags = multiplayer ? DF_MULTIPLAYER : (DF_GHOST|(modeattacking<<DF_ATTACKSHIFT));
|
demoflags = multiplayer ? DF_MULTIPLAYER : (DF_GHOST|(modeattacking<<DF_ATTACKSHIFT));
|
||||||
|
|
||||||
|
demoflags |= gametype<<DF_GAMESHIFT;
|
||||||
|
|
||||||
|
if (encoremode)
|
||||||
|
demoflags |= DF_ENCORE;
|
||||||
|
|
||||||
// Setup header.
|
// Setup header.
|
||||||
M_Memcpy(demo_p, DEMOHEADER, 12); demo_p += 12;
|
M_Memcpy(demo_p, DEMOHEADER, 12); demo_p += 12;
|
||||||
WRITEUINT8(demo_p,VERSION);
|
WRITEUINT8(demo_p,VERSION);
|
||||||
|
@ -6205,6 +6213,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
demoflags = READUINT8(demo_p);
|
demoflags = READUINT8(demo_p);
|
||||||
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
|
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
|
||||||
multiplayer = !!(demoflags & DF_MULTIPLAYER);
|
multiplayer = !!(demoflags & DF_MULTIPLAYER);
|
||||||
|
gametype = (demoflags & DF_GAMETYPEMASK)>>DF_GAMESHIFT;
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
|
|
||||||
hu_demotime = UINT32_MAX;
|
hu_demotime = UINT32_MAX;
|
||||||
|
@ -6368,7 +6377,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
}
|
}
|
||||||
|
|
||||||
P_SetRandSeed(randseed);
|
P_SetRandSeed(randseed);
|
||||||
G_InitNew(false, G_BuildMapName(gamemap), true, true); // Doesn't matter whether you reset or not here, given changes to resetplayer.
|
G_InitNew(demoflags & DF_ENCORE, G_BuildMapName(gamemap), true, true); // Doesn't matter whether you reset or not here, given changes to resetplayer.
|
||||||
|
|
||||||
if (!multiplayer) {
|
if (!multiplayer) {
|
||||||
// Set skin
|
// Set skin
|
||||||
|
|
Loading…
Reference in a new issue