From cc34f973e2302c27d599320d9d74f13578e47da8 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 25 Mar 2012 01:54:36 +0000 Subject: [PATCH] - Fixed: Using -playdemo in conjunction with -loadgame did not work. SVN r3481 (trunk) --- src/d_event.h | 1 + src/d_main.cpp | 18 +++++++++--------- src/g_game.cpp | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/d_event.h b/src/d_event.h index 12257e2c2b..c7ab5b1b81 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -63,6 +63,7 @@ typedef enum ga_newgame2, ga_loadgame, ga_loadgamehidecon, + ga_loadgameplaydemo, ga_autoloadgame, ga_savegame, ga_autosave, diff --git a/src/d_main.cpp b/src/d_main.cpp index a15aa9378d..bea68ca593 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2329,6 +2329,15 @@ void D_DoomMain (void) V_Init2(); + v = Args->CheckValue ("-loadgame"); + if (v) + { + FString file(v); + FixPathSeperator (file); + DefaultExtension (file, ".zds"); + G_LoadGame (file); + } + v = Args->CheckValue("-playdemo"); if (v != NULL) { @@ -2343,15 +2352,6 @@ void D_DoomMain (void) G_TimeDemo (v); D_DoomLoop (); // never returns } - - v = Args->CheckValue ("-loadgame"); - if (v) - { - FString file(v); - FixPathSeperator (file); - DefaultExtension (file, ".zds"); - G_LoadGame (file); - } if (gameaction != ga_loadgame && gameaction != ga_loadgamehidecon) { diff --git a/src/g_game.cpp b/src/g_game.cpp index badfc44b21..286744ac31 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1035,6 +1035,9 @@ void G_Ticker () G_DoAutoSave (); gameaction = ga_nothing; break; + case ga_loadgameplaydemo: + G_DoLoadGame (); + // fallthrough case ga_playdemo: G_DoPlayDemo (); break; @@ -2366,7 +2369,7 @@ FString defdemoname; void G_DeferedPlayDemo (const char *name) { defdemoname = name; - gameaction = ga_playdemo; + gameaction = (gameaction == ga_loadgame) ? ga_loadgameplaydemo : ga_playdemo; } CCMD (playdemo) @@ -2449,7 +2452,11 @@ bool G_ProcessIFFDemo (char *mapname) mapname[8] = 0; demo_p += 8; rngseed = ReadLong (&demo_p); - FRandom::StaticClearRandom (); + // Only reset the RNG if this demo is not in conjunction with a savegame. + if (mapname[0] != 0) + { + FRandom::StaticClearRandom (); + } consoleplayer = *demo_p++; break; @@ -2578,7 +2585,10 @@ void G_DoPlayDemo (void) // don't spend a lot of time in loadlevel precache = false; demonew = true; - G_InitNew (mapname, false); + if (mapname[0] != 0) + { + G_InitNew (mapname, false); + } C_HideConsole (); demonew = false; precache = true; @@ -2599,7 +2609,7 @@ void G_TimeDemo (const char* name) singletics = true; defdemoname = name; - gameaction = ga_playdemo; + gameaction = (gameaction == ga_loadgame) ? ga_loadgameplaydemo : ga_playdemo; }