ref: 42e8b05aa46936ada3de4ee68c6dc005fccadfb4
parent: aa3e8e11e588c35eec44ea58f1a9d06b02e3efe5
author: Thomas A. Birkel <capnclever@gmail.com>
date: Fri Oct 21 00:55:50 EDT 2016
Update branch with requested changes, fourth pass Clean up bit checks, add defines to clarify usage
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -1652,6 +1652,9 @@
*/
#define DEMOMARKER 0x80
+#define DEMOHEADER_RESPAWN 0x20
+#define DEMOHEADER_LONGTICS 0x10
+#define DEMOHEADER_NOMONSTERS 0x02
void G_ReadDemoTiccmd(ticcmd_t * cmd)
{
@@ -1791,17 +1794,18 @@
*demo_p = 1; // assume player one exists
if (respawnparm)
{
- *demo_p += 32;
+ *demo_p |= DEMOHEADER_RESPAWN;
}
if (longtics)
{
- *demo_p += 16;
+ *demo_p |= DEMOHEADER_LONGTICS;
}
if (nomonsters)
{
- *demo_p += 2;
+ *demo_p |= DEMOHEADER_NOMONSTERS;
}
demo_p++;
+ demo_p++;
for (i = 1; i < MAXPLAYERS; i++)
*demo_p++ = playeringame[i];
@@ -1838,12 +1842,12 @@
map = *demo_p++;
// Read special parameter bits: see G_RecordDemo() for details.
- respawnparm = *demo_p & 32;
- longtics = *demo_p & 16;
- nomonsters = *demo_p & 2;
+ respawnparm = (*demo_p & DEMOHEADER_RESPAWN) != 0;
+ longtics = (*demo_p & DEMOHEADER_LONGTICS) != 0;
+ nomonsters = (*demo_p & DEMOHEADER_NOMONSTERS) != 0;
for (i = 0; i < MAXPLAYERS; i++)
- playeringame[i] = *demo_p++;
+ playeringame[i] = (*demo_p++) != 0;
precache = false; // don't spend a lot of time in loadlevel
G_InitNew(skill, episode, map);
@@ -1872,13 +1876,13 @@
map = *demo_p++;
// Read special parameter bits: see G_RecordDemo() for details.
- respawnparm = *demo_p & 32;
- longtics = *demo_p & 16;
- nomonsters = *demo_p & 2;
+ respawnparm = (*demo_p & DEMOHEADER_RESPAWN) != 0;
+ longtics = (*demo_p & DEMOHEADER_LONGTICS) != 0;
+ nomonsters = (*demo_p & DEMOHEADER_NOMONSTERS) != 0;
for (i = 0; i < MAXPLAYERS; i++)
{
- playeringame[i] = *demo_p++;
+ playeringame[i] = (*demo_p++) != 0;
}
G_InitNew(skill, episode, map);
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1811,6 +1811,9 @@
*/
#define DEMOMARKER 0x80
+#define DEMOHEADER_RESPAWN 0x20
+#define DEMOHEADER_LONGTICS 0x10
+#define DEMOHEADER_NOMONSTERS 0x02
void G_ReadDemoTiccmd(ticcmd_t * cmd)
{
@@ -1951,15 +1954,15 @@
*demo_p = 1; // assume player one exists
if (respawnparm)
{
- *demo_p += 32;
+ *demo_p |= DEMOHEADER_RESPAWN;
}
if (longtics)
{
- *demo_p += 16;
+ *demo_p |= DEMOHEADER_LONGTICS;
}
if (nomonsters)
{
- *demo_p += 2;
+ *demo_p |= DEMOHEADER_NOMONSTERS;
}
demo_p++;
*demo_p++ = PlayerClass[0];
@@ -2002,13 +2005,13 @@
map = *demo_p++;
// Read special parameter bits: see G_RecordDemo() for details.
- respawnparm = *demo_p & 32;
- longtics = *demo_p & 16;
- nomonsters = *demo_p & 2;
+ respawnparm = (*demo_p & DEMOHEADER_RESPAWN) != 0;
+ longtics = (*demo_p & DEMOHEADER_LONGTICS) != 0;
+ nomonsters = (*demo_p & DEMOHEADER_NOMONSTERS) != 0;
for (i = 0; i < maxplayers; i++)
{
- playeringame[i] = *demo_p++;
+ playeringame[i] = (*demo_p++) != 0;
PlayerClass[i] = *demo_p++;
}
@@ -2042,13 +2045,13 @@
map = *demo_p++;
// Read special parameter bits: see G_RecordDemo() for details.
- respawnparm = *demo_p & 32;
- longtics = *demo_p & 16;
- nomonsters = *demo_p & 2;
+ respawnparm = (*demo_p & DEMOHEADER_RESPAWN) != 0;
+ longtics = (*demo_p & DEMOHEADER_LONGTICS) != 0;
+ nomonsters = (*demo_p & DEMOHEADER_NOMONSTERS) != 0;
for (i = 0; i < maxplayers; i++)
{
- playeringame[i] = *demo_p++;
+ playeringame[i] = (*demo_p++) != 0;
PlayerClass[i] = *demo_p++;
}