summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2014-03-23 03:30:41 -0400
committerSimon Howard2014-03-23 03:30:41 -0400
commit7a7a66e0af1be72938616b04ebebe6bd9dbd706c (patch)
tree9b864eccebbeb1690a155c9b7994833630c54377
parentb295df80fe09802a774f9ef05d126f5139a383fa (diff)
downloadchocolate-doom-7a7a66e0af1be72938616b04ebebe6bd9dbd706c.tar.gz
chocolate-doom-7a7a66e0af1be72938616b04ebebe6bd9dbd706c.tar.bz2
chocolate-doom-7a7a66e0af1be72938616b04ebebe6bd9dbd706c.zip
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.
-rw-r--r--src/heretic/g_game.c17
-rw-r--r--src/hexen/g_game.c18
2 files changed, 27 insertions, 8 deletions
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index 2ad9f4b3..5139c950 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1735,12 +1735,18 @@ void G_DoPlayDemo(void)
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 @@ void G_TimeDemo(char *name)
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)
diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c
index 4e40f578..bc58b128 100644
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1881,12 +1881,19 @@ void G_DoPlayDemo(void)
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 @@ void G_TimeDemo(char *name)
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)