mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Add cvar for netreplay saving options
This commit is contained in:
parent
35be2e0be6
commit
276373123e
6 changed files with 62 additions and 27 deletions
|
@ -793,6 +793,8 @@ void D_RegisterClientCommands(void)
|
|||
|
||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||
|
||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||
|
||||
// FIXME: not to be here.. but needs be done for config loading
|
||||
CV_RegisterVar(&cv_usegamma);
|
||||
|
||||
|
@ -2502,6 +2504,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
LUAh_MapChange(mapnumber);
|
||||
#endif*/
|
||||
|
||||
demosaved = demodefersave = false;
|
||||
demosavebutton = 0;
|
||||
G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene);
|
||||
if (demoplayback && !timingdemo)
|
||||
precache = true;
|
||||
|
|
32
src/g_game.c
32
src/g_game.c
|
@ -288,8 +288,8 @@ UINT32 timesBeatenWithEmeralds;
|
|||
//UINT32 timesBeatenUltimate;
|
||||
|
||||
static char demoname[64];
|
||||
boolean demorecording;
|
||||
boolean demoplayback;
|
||||
boolean demorecording, demosaved, demodefersave, demoplayback;
|
||||
tic_t demosavebutton;
|
||||
boolean titledemo; // Title Screen demo can be cancelled by any key
|
||||
boolean fromtitledemo; // SRB2Kart: Don't stop the music
|
||||
static UINT8 *demobuffer = NULL;
|
||||
|
@ -334,6 +334,9 @@ boolean precache = true; // if true, load all graphics at start
|
|||
|
||||
INT16 prevmap, nextmap;
|
||||
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
consvar_t cv_recordmultiplayerdemos = {"recordmultiplayerdemos", "Manual Save", CV_SAVE, recordmultiplayerdemos_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static UINT8 *savebuffer;
|
||||
|
||||
// Analog Control
|
||||
|
@ -3206,6 +3209,9 @@ void G_ExitLevel(void)
|
|||
|
||||
// Remove CEcho text on round end.
|
||||
HU_ClearCEcho();
|
||||
|
||||
if (multiplayer && demorecording && cv_recordmultiplayerdemos.value == 2)
|
||||
G_SaveDemo();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6990,8 +6996,6 @@ void G_StopDemo(void)
|
|||
|
||||
boolean G_CheckDemoStatus(void)
|
||||
{
|
||||
boolean saved;
|
||||
|
||||
while (ghosts)
|
||||
{
|
||||
demoghost *next = ghosts->next;
|
||||
|
@ -7040,7 +7044,17 @@ boolean G_CheckDemoStatus(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (demorecording)
|
||||
if (demorecording && (!multiplayer || cv_recordmultiplayerdemos.value == 2))
|
||||
{
|
||||
G_SaveDemo();
|
||||
return true;
|
||||
}
|
||||
demorecording = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void G_SaveDemo(void)
|
||||
{
|
||||
UINT8 *p = demobuffer+16; // checksum position
|
||||
#ifdef NOMD5
|
||||
|
@ -7052,21 +7066,17 @@ boolean G_CheckDemoStatus(void)
|
|||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.
|
||||
#endif
|
||||
saved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
|
||||
demosaved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
|
||||
free(demobuffer);
|
||||
demorecording = false;
|
||||
|
||||
if (modeattacking != ATTACKING_RECORD)
|
||||
{
|
||||
if (saved)
|
||||
if (demosaved)
|
||||
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Demo %s not saved\n"), demoname);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -36,7 +36,9 @@ extern boolean playeringame[MAXPLAYERS];
|
|||
// ======================================
|
||||
|
||||
// demoplaying back and demo recording
|
||||
extern boolean demoplayback, titledemo, fromtitledemo, demorecording, timingdemo;
|
||||
extern boolean demoplayback, titledemo, fromtitledemo, demorecording, timingdemo, demosaved, demodefersave;
|
||||
extern tic_t demosavebutton;
|
||||
extern consvar_t cv_recordmultiplayerdemos;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
|
@ -207,6 +209,7 @@ void G_StopMetalDemo(void);
|
|||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void);
|
||||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
void G_SaveDemo(void);
|
||||
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "p_local.h"
|
||||
#include "z_zone.h"
|
||||
#include "s_sound.h"
|
||||
|
@ -737,6 +738,9 @@ void P_Ticker(boolean run)
|
|||
|
||||
G_WriteGhostTic(players[i].mo, i);
|
||||
}
|
||||
|
||||
if (demosavebutton && demosavebutton + 3*TICRATE < leveltime && InputDown(gc_lookback, 1))
|
||||
demodefersave = true;
|
||||
}
|
||||
if (demoplayback) // Use Ghost data for consistency checks.
|
||||
{
|
||||
|
|
|
@ -1835,6 +1835,9 @@ void P_DoPlayerExit(player_t *player)
|
|||
player->powers[pw_spacetime] = 0;
|
||||
player->kartstuff[k_cardanimation] = 0; // srb2kart: reset battle animation
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
demosavebutton = leveltime;
|
||||
|
||||
/*if (playeringame[player-players] && netgame && !circuitmap)
|
||||
CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);*/
|
||||
}
|
||||
|
|
|
@ -562,6 +562,11 @@ dotimer:
|
|||
string);
|
||||
}
|
||||
|
||||
if (demorecording && cv_recordmultiplayerdemos.value == 1)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 178, V_ALLOWLOWERCASE|hilicol, "Press Look Backward to save the replay");
|
||||
else if (demosaved)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 178, V_ALLOWLOWERCASE|hilicol, "Replay saved!");
|
||||
|
||||
// Make it obvious that scrambling is happening next round.
|
||||
if (cv_scrambleonchange.value && cv_teamscramble.value && (intertic/TICRATE % 2 == 0))
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, hilicol, M_GetText("Teams will be scrambled next round!"));
|
||||
|
@ -577,6 +582,12 @@ void Y_Ticker(void)
|
|||
if (intertype == int_none)
|
||||
return;
|
||||
|
||||
if (demorecording && cv_recordmultiplayerdemos.value == 1 && (demodefersave || InputDown(gc_lookback, 1)))
|
||||
{
|
||||
demodefersave = false;
|
||||
G_SaveDemo();
|
||||
}
|
||||
|
||||
// Check for pause or menu up in single player
|
||||
if (paused || P_AutoPause())
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue