From ca763dafad24c12d0533a6bf1e3b52f80584b303 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 14 Sep 2008 21:25:23 +0000 Subject: [PATCH] Game: write numbered demo files, fix infinite loop after finished demo playback git-svn-id: https://svn.eduke32.com/eduke32@1067 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 07dee15f5..2b028b4d5 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -11174,6 +11174,7 @@ MAIN_LOOP_RESTART: if (ud.warp_on == 0 && playback()) { + ud.multimode = numplayers; // fixes playback() infinite loop after watching demo FX_StopAllSounds(); clearsoundlocks(); g_NoLogoAnim = 1; @@ -11431,8 +11432,8 @@ corrupt: void opendemowrite(void) { - char *d = "demo1.dmo"; - int dummylong = 0; + char d[13]; + int dummylong = 0, demonum=1; char ver; short i; @@ -11440,6 +11441,15 @@ void opendemowrite(void) ver = BYTEVERSION; + while (1) + { + if (demonum == 10000) return; + Bsprintf(d, "demo%d.dmo", demonum++); + frecfilep = fopen(d, "rb"); + if (frecfilep == NULL) break; + Bfclose(frecfilep); + } + if ((frecfilep = fopen(d,"wb")) == NULL) return; fwrite(&dummylong,4,1,frecfilep); fwrite(&ver,sizeof(char),1,frecfilep);