ref: 7a7a66e0af1be72938616b04ebebe6bd9dbd706c
parent: b295df80fe09802a774f9ef05d126f5139a383fa
author: Simon Howard <[email protected]>
date: Sat Mar 22 23:30:41 EDT 2014
heretic/hexen: Fix -timedemo. The -timedemo flag is broken in Vanilla Heretic/Hexen, as not all fields are read from the demo headers. Fix it, as there's no utility in having it nonfunctional and plenty of utility in having it functional. This fixes #300.
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1735,12 +1735,18 @@
void G_TimeDemo(char *name)
{
skill_t skill;
- int episode, map;
+ int episode, map, i;
demobuffer = demo_p = W_CacheLumpName(name, PU_STATIC);
skill = *demo_p++;
episode = *demo_p++;
map = *demo_p++;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ playeringame[i] = *demo_p++;
+ }
+
G_InitNew(skill, episode, map);
usergame = false;
demoplayback = true;
@@ -1761,13 +1767,16 @@
boolean G_CheckDemoStatus(void)
{
- int endtime;
+ int endtime, realtics;
if (timingdemo)
{
+ float fps;
endtime = I_GetTime();
- I_Error("timed %i gametics in %i realtics", gametic,
- endtime - starttime);
+ realtics = endtime - starttime;
+ fps = ((float) gametic * TICRATE) / realtics;
+ I_Error("timed %i gametics in %i realtics (%f fps)",
+ gametic, realtics, fps);
}
if (demoplayback)
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1881,12 +1881,19 @@
void G_TimeDemo(char *name)
{
skill_t skill;
- int episode, map;
+ int episode, map, i;
demobuffer = demo_p = W_CacheLumpName(name, PU_STATIC);
skill = *demo_p++;
episode = *demo_p++;
map = *demo_p++;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ playeringame[i] = *demo_p++;
+ PlayerClass[i] = *demo_p++;
+ }
+
G_InitNew(skill, episode, map);
usergame = false;
demoplayback = true;
@@ -1907,13 +1914,16 @@
boolean G_CheckDemoStatus(void)
{
- int endtime;
+ int endtime, realtics;
if (timingdemo)
{
+ float fps;
endtime = I_GetTime();
- I_Error("timed %i gametics in %i realtics", gametic,
- endtime - starttime);
+ realtics = endtime - starttime;
+ fps = ((float) gametic * TICRATE) / realtics;
+ I_Error("timed %i gametics in %i realtics (%f fps)",
+ gametic, realtics, fps);
}
if (demoplayback)