shithub: choc

Download patch

ref: df1837c1210b85ebc4ec84e42b5edb2001c66463
parent: 6a14787a8a25bf37aacecbd7c42e69ed35e7ad09
author: Fabian Greffrath <fabian@greffrath.com>
date: Thu Oct 29 11:01:56 EDT 2020

hexen: allow for arbitrarily long demo file names (#1329)


--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -92,7 +92,7 @@
 int displayplayer;              // view being displayed
 int levelstarttic;              // gametic at level start
 
-char demoname[32];
+char *demoname;
 boolean demorecording;
 boolean longtics;               // specify high resolution turning in demos
 boolean lowres_turn;
@@ -1952,6 +1952,7 @@
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
                   const char *name)
 {
+    size_t demoname_size;
     int i;
     int maxsize;
 
@@ -1978,8 +1979,9 @@
 
     G_InitNew(skill, episode, map);
     usergame = false;
-    M_StringCopy(demoname, name, sizeof(demoname));
-    M_StringConcat(demoname, ".lmp", sizeof(demoname));
+    demoname_size = strlen(name) + 5;
+    demoname = Z_Malloc(demoname_size, PU_STATIC, NULL);
+    M_snprintf(demoname, demoname_size, "%s.lmp", name);
     maxsize = 0x20000;
 
     //!