commit e913d920dc242ccc05048f4c17fa9b64c47234de
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Fri Nov 25 00:03:29 2016 -0500
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Fri Nov 25 00:03:29 2016 -0500
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.
---
src/heretic/g_game.c | 50 +++++++++++++++++++-------------------------------
1 file changed, 19 insertions(+), 31 deletions(-)
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index 16ee4e5d..6b6dbb90 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1790,7 +1790,8 @@ void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
// 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 @@ void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
// 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 @@ void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
{
*demo_p |= DEMOHEADER_LONGTICS;
}
- if (nomonsters)
+ if (D_NonVanillaRecord(nomonsters, "vvHeretic -nomonsters header flag"))
{
*demo_p |= DEMOHEADER_NOMONSTERS;
}
@@ -1873,21 +1874,6 @@ void G_DeferedPlayDemo(char *name)
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 @@ void G_DoPlayDemo(void)
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))
- {
- // 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;
+ // the player 1 present byte. However, this is a non-vanilla extension.
+ if (D_NonVanillaPlayback((*demo_p & DEMOHEADER_LONGTICS) != 0,
+ lumpnum, "vvHeretic longtics demo"))
+ {
+ 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++)