ref: 7a140df7c041e1ee627bac432a345bdc3c4f6308
parent: e913d920dc242ccc05048f4c17fa9b64c47234de
author: Simon Howard <fraggle@soulsphere.org>
date: Thu Nov 24 19:12:31 EST 2016
hexen: Convert demo code to use new demo API. The vvHeretic bits are non-vanilla extensions and we should be able to disable these entirely either when recording or playing back.
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1958,7 +1958,8 @@
// Record or playback a demo with high resolution turning.
//
- longtics = M_ParmExists("-longtics");
+ longtics = D_NonVanillaRecord(M_ParmExists("-longtics"),
+ "vvHeretic longtics demo");
// If not recording a longtics demo, record in low res
@@ -2005,7 +2006,7 @@
// 0x02 = -nomonsters
*demo_p = 1; // assume player one exists
- if (respawnparm)
+ if (D_NonVanillaRecord(respawnparm, "vvHeretic -respawn header flag"))
{
*demo_p |= DEMOHEADER_RESPAWN;
}
@@ -2013,7 +2014,7 @@
{
*demo_p |= DEMOHEADER_LONGTICS;
}
- if (nomonsters)
+ if (D_NonVanillaRecord(nomonsters, "vvHeretic -nomonsters header flag"))
{
*demo_p |= DEMOHEADER_NOMONSTERS;
}
@@ -2046,21 +2047,6 @@
gameaction = ga_playdemo;
}
-// Returns true if the given lump number corresponds to data from a .lmp
-// file, as opposed to a WAD.
-static boolean IsDemoFile(int lumpnum)
-{
- char *lower;
- boolean result;
-
- lower = M_StringDuplicate(lumpinfo[lumpnum]->wad_file->path);
- M_ForceLowercase(lower);
- result = M_StringEndsWith(lower, ".lmp");
- free(lower);
-
- return result;
-}
-
void G_DoPlayDemo(void)
{
skill_t skill;
@@ -2075,20 +2061,24 @@
map = *demo_p++;
// When recording we store some extra options inside the upper bits
- // of the player 1 present byte; this is equivalent to what vvHeretic
- // does. However, only recognize these bits if they are in a demo file
- // being played manually by the user; we ignore them (as is Vanilla
- // behavior) if they are inside a WAD file.
- // These extra bits are a convenience feature for demo playback, not
- // an editing extension for WAD authors.
- if (IsDemoFile(lumpnum))
+ // of the player 1 present byte. However, this is a non-vanilla extension.
+ // Note references to vvHeretic here; these are the extensions used by
+ // vvHeretic, which we're just reusing for Hexen demos too. There is no
+ // vvHexen.
+ if (D_NonVanillaPlayback((*demo_p & DEMOHEADER_LONGTICS) != 0,
+ lumpnum, "vvHeretic longtics demo"))
{
- // Read special parameter bits: see G_RecordDemo() for details.
- longtics = (*demo_p & DEMOHEADER_LONGTICS) != 0;
-
- // don't overwrite arguments from the command line
- respawnparm |= (*demo_p & DEMOHEADER_RESPAWN) != 0;
- nomonsters |= (*demo_p & DEMOHEADER_NOMONSTERS) != 0;
+ longtics = true;
+ }
+ if (D_NonVanillaPlayback((*demo_p & DEMOHEADER_RESPAWN) != 0,
+ lumpnum, "vvHeretic -respawn header flag"))
+ {
+ respawnparm = true;
+ }
+ if (D_NonVanillaPlayback((*demo_p & DEMOHEADER_NOMONSTERS) != 0,
+ lumpnum, "vvHeretic -nomonsters header flag"))
+ {
+ nomonsters = true;
}
for (i = 0; i < maxplayers; i++)