mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Replays: let name be changed any time until the file is saved
This commit is contained in:
parent
983fb4c53c
commit
38e1ae1c53
7 changed files with 17 additions and 50 deletions
|
|
@ -2878,7 +2878,7 @@ static void Got_Mapcmd(const UINT8 **cp, INT32 playernum)
|
||||||
if (demo.playback && !demo.timing)
|
if (demo.playback && !demo.timing)
|
||||||
precache = false;
|
precache = false;
|
||||||
|
|
||||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
demo.willsave = (cv_recordmultiplayerdemos.value == 2);
|
||||||
demo.savebutton = 0;
|
demo.savebutton = 0;
|
||||||
|
|
||||||
G_InitNew(pencoremode, mapnumber, presetplayer, skipprecutscene);
|
G_InitNew(pencoremode, mapnumber, presetplayer, skipprecutscene);
|
||||||
|
|
|
||||||
|
|
@ -3992,7 +3992,7 @@ boolean G_CheckDemoStatus(void)
|
||||||
if (!demo.recording)
|
if (!demo.recording)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (modeattacking || demo.savemode != demovars_s::DSM_NOTSAVING)
|
if (modeattacking || demo.willsave)
|
||||||
{
|
{
|
||||||
if (demobuf.p)
|
if (demobuf.p)
|
||||||
{
|
{
|
||||||
|
|
@ -4081,14 +4081,13 @@ void G_SaveDemo(void)
|
||||||
md5_buffer((char *)p+16, (demobuf.buffer + length) - (p+16), p);
|
md5_buffer((char *)p+16, (demobuf.buffer + length) - (p+16), p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIL_WriteFile(demoname, demobuf.buffer, demobuf.p - demobuf.buffer)) // finally output the file.
|
bool saved = FIL_WriteFile(demoname, demobuf.buffer, demobuf.p - demobuf.buffer); // finally output the file.
|
||||||
demo.savemode = demovars_s::DSM_SAVED;
|
|
||||||
Z_Free(demobuf.buffer);
|
Z_Free(demobuf.buffer);
|
||||||
demo.recording = false;
|
demo.recording = false;
|
||||||
|
|
||||||
if (!modeattacking)
|
if (!modeattacking)
|
||||||
{
|
{
|
||||||
if (demo.savemode == demovars_s::DSM_SAVED)
|
if (saved)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
|
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
|
||||||
if (gamedata->eversavedreplay == false)
|
if (gamedata->eversavedreplay == false)
|
||||||
|
|
@ -4111,7 +4110,7 @@ boolean G_CheckDemoTitleEntry(void)
|
||||||
if (!G_PlayerInputDown(0, gc_b, 0) && !G_PlayerInputDown(0, gc_x, 0))
|
if (!G_PlayerInputDown(0, gc_b, 0) && !G_PlayerInputDown(0, gc_x, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
demo.savemode = demovars_s::DSM_WILLSAVE;
|
demo.willsave = true;
|
||||||
M_OpenVirtualKeyboard(
|
M_OpenVirtualKeyboard(
|
||||||
false,
|
false,
|
||||||
[](const char* replace) -> const char*
|
[](const char* replace) -> const char*
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,7 @@ struct demovars_s {
|
||||||
boolean netgame; // multiplayer netgame
|
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
|
tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going
|
||||||
enum {
|
boolean willsave;
|
||||||
DSM_NOTSAVING,
|
|
||||||
DSM_WILLAUTOSAVE,
|
|
||||||
DSM_WILLSAVE,
|
|
||||||
DSM_SAVED
|
|
||||||
} savemode;
|
|
||||||
|
|
||||||
boolean freecam;
|
boolean freecam;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4549,7 +4549,7 @@ void G_AfterIntermission(void)
|
||||||
M_PlaybackQuit(0);
|
M_PlaybackQuit(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
else if (demo.recording && (modeattacking || demo.willsave))
|
||||||
G_SaveDemo();
|
G_SaveDemo();
|
||||||
|
|
||||||
if (modeattacking) // End the run.
|
if (modeattacking) // End the run.
|
||||||
|
|
|
||||||
|
|
@ -1178,9 +1178,8 @@ void P_Ticker(boolean run)
|
||||||
{
|
{
|
||||||
G_WriteAllGhostTics();
|
G_WriteAllGhostTics();
|
||||||
|
|
||||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime)
|
||||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime)
|
G_CheckDemoTitleEntry();
|
||||||
G_CheckDemoTitleEntry();
|
|
||||||
}
|
}
|
||||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1459,26 +1459,11 @@ void ST_DrawServerSplash(boolean timelimited)
|
||||||
|
|
||||||
void ST_DrawSaveReplayHint(INT32 flags)
|
void ST_DrawSaveReplayHint(INT32 flags)
|
||||||
{
|
{
|
||||||
const char *text = "";
|
V_DrawRightAlignedThinString(
|
||||||
switch (demo.savemode)
|
BASEVIDWIDTH - 2, 2,
|
||||||
{
|
flags|V_YELLOWMAP,
|
||||||
case DSM_NOTSAVING:
|
demo.willsave ? "Replay will be saved. \xAB" "Change title" : "\xAB" "or " "\xAE" "Save replay"
|
||||||
text = "\xAB" "or " "\xAE" "Save replay";
|
);
|
||||||
break;
|
|
||||||
|
|
||||||
case DSM_WILLAUTOSAVE:
|
|
||||||
text = "Replay will be saved. \xAB" "Change title";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DSM_WILLSAVE:
|
|
||||||
text = "Replay will be saved.";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DSM_SAVED:
|
|
||||||
text = "Replay saved!";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, flags|V_YELLOWMAP, text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static fixed_t ST_CalculateFadeIn(player_t *player)
|
static fixed_t ST_CalculateFadeIn(player_t *player)
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ static INT32 powertype = PWRLV_DISABLED;
|
||||||
static INT32 intertic;
|
static INT32 intertic;
|
||||||
static INT32 endtic = -1;
|
static INT32 endtic = -1;
|
||||||
static INT32 sorttic = -1;
|
static INT32 sorttic = -1;
|
||||||
static INT32 replayprompttic;
|
|
||||||
|
|
||||||
static fixed_t mqscroll = 0;
|
static fixed_t mqscroll = 0;
|
||||||
static fixed_t chkscroll = 0;
|
static fixed_t chkscroll = 0;
|
||||||
|
|
@ -1690,12 +1689,8 @@ skiptallydrawer:
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcounter:
|
finalcounter:
|
||||||
{
|
if ((modeattacking == ATTACKING_NONE) && demo.recording)
|
||||||
if ((modeattacking == ATTACKING_NONE) && (demo.recording || demo.savemode == demovars_s::DSM_SAVED) && !demo.playback)
|
ST_DrawSaveReplayHint(0);
|
||||||
{
|
|
||||||
ST_DrawSaveReplayHint(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Y_CanSkipIntermission())
|
if (Y_CanSkipIntermission())
|
||||||
{
|
{
|
||||||
|
|
@ -1731,13 +1726,7 @@ void Y_Ticker(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (demo.recording)
|
if (demo.recording)
|
||||||
{
|
G_CheckDemoTitleEntry();
|
||||||
if (demo.savemode == demovars_s::DSM_NOTSAVING)
|
|
||||||
{
|
|
||||||
replayprompttic++;
|
|
||||||
G_CheckDemoTitleEntry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for pause or menu up in single player
|
// Check for pause or menu up in single player
|
||||||
if (paused || P_AutoPause())
|
if (paused || P_AutoPause())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue