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
This commit is contained in:
helixhorned 2008-09-14 21:25:23 +00:00
parent 746071a4f4
commit ca763dafad

View file

@ -11174,6 +11174,7 @@ MAIN_LOOP_RESTART:
if (ud.warp_on == 0 && playback()) if (ud.warp_on == 0 && playback())
{ {
ud.multimode = numplayers; // fixes playback() infinite loop after watching demo
FX_StopAllSounds(); FX_StopAllSounds();
clearsoundlocks(); clearsoundlocks();
g_NoLogoAnim = 1; g_NoLogoAnim = 1;
@ -11431,8 +11432,8 @@ corrupt:
void opendemowrite(void) void opendemowrite(void)
{ {
char *d = "demo1.dmo"; char d[13];
int dummylong = 0; int dummylong = 0, demonum=1;
char ver; char ver;
short i; short i;
@ -11440,6 +11441,15 @@ void opendemowrite(void)
ver = BYTEVERSION; 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; if ((frecfilep = fopen(d,"wb")) == NULL) return;
fwrite(&dummylong,4,1,frecfilep); fwrite(&dummylong,4,1,frecfilep);
fwrite(&ver,sizeof(char),1,frecfilep); fwrite(&ver,sizeof(char),1,frecfilep);