ref: e913d920dc242ccc05048f4c17fa9b64c47234de
parent: 45e57dd270a4045b709e8baacd02aff7428f35b8
author: Simon Howard <fraggle@soulsphere.org>
date: Thu Nov 24 19:03:29 EST 2016
heretic: Convert vvHeretic code to 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/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1790,7 +1790,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
@@ -1836,7 +1837,7 @@
// 0x02 = -nomonsters
*demo_p = 1; // assume player one exists
- if (respawnparm)
+ if (D_NonVanillaRecord(respawnparm, "vvHeretic -respawn header flag"))
{
*demo_p |= DEMOHEADER_RESPAWN;
}
@@ -1844,7 +1845,7 @@
{
*demo_p |= DEMOHEADER_LONGTICS;
}
- if (nomonsters)
+ if (D_NonVanillaRecord(nomonsters, "vvHeretic -nomonsters header flag"))
{
*demo_p |= DEMOHEADER_NOMONSTERS;
}
@@ -1873,21 +1874,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;
@@ -1902,19 +1888,21 @@
map = *demo_p++;
// vvHeretic allows extra options to be stored in the upper bits of
- // the player 1 present byte. 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))
+ // the player 1 present byte. However, this is a non-vanilla extension.
+ 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++)