summaryrefslogtreecommitdiff
path: root/src/g_game.c
diff options
context:
space:
mode:
authorSimon Howard2006-02-23 19:12:02 +0000
committerSimon Howard2006-02-23 19:12:02 +0000
commit1b4411d96923b16575aeef36c9a4d3c2aea0d64d (patch)
tree833634c51f5c528822a8107f48e8d85f67c9379e /src/g_game.c
parent19b8c7428afd6a42485a76bdf938e686e8450543 (diff)
downloadchocolate-doom-1b4411d96923b16575aeef36c9a4d3c2aea0d64d.tar.gz
chocolate-doom-1b4411d96923b16575aeef36c9a4d3c2aea0d64d.tar.bz2
chocolate-doom-1b4411d96923b16575aeef36c9a4d3c2aea0d64d.zip
Add lowres_turn to indicate whether we generate angleturns which are
8-bit as opposed to 16-bit. This is used when recording demos without -longtics enabled. Sync this option between clients in a netgame, so that if one player is recording a Vanilla demo, all clients record in lowres. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 378
Diffstat (limited to 'src/g_game.c')
-rw-r--r--src/g_game.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/g_game.c b/src/g_game.c
index 647226ab..e929270f 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: g_game.c 374 2006-02-19 13:42:27Z fraggle $
+// $Id: g_game.c 378 2006-02-23 19:12:02Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,13 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.26 2006/02/23 19:12:01 fraggle
+// Add lowres_turn to indicate whether we generate angleturns which are
+// 8-bit as opposed to 16-bit. This is used when recording demos without
+// -longtics enabled. Sync this option between clients in a netgame, so
+// that if one player is recording a Vanilla demo, all clients record
+// in lowres.
+//
// Revision 1.25 2006/02/19 13:42:27 fraggle
// Move tic number expansion code to common code. Parse game data packets
// received from the server.
@@ -127,7 +134,7 @@
static const char
-rcsid[] = "$Id: g_game.c 374 2006-02-19 13:42:27Z fraggle $";
+rcsid[] = "$Id: g_game.c 378 2006-02-23 19:12:02Z fraggle $";
#include <string.h>
#include <stdlib.h>
@@ -234,6 +241,7 @@ int totalkills, totalitems, totalsecret; // for intermission
char demoname[32];
boolean demorecording;
boolean longtics; // cph's doom 1.91 longtics hack
+boolean lowres_turn; // low resolution turning for longtics
boolean demoplayback;
boolean netdemo;
byte* demobuffer;
@@ -563,6 +571,16 @@ void G_BuildTiccmd (ticcmd_t* cmd)
sendsave = false;
cmd->buttons = BT_SPECIAL | BTS_SAVEGAME | (savegameslot<<BTS_SAVESHIFT);
}
+
+ // low-res turning
+
+ if (lowres_turn)
+ {
+ // round angleturn to the nearest 256 boundary
+ // for recording demos with single byte values for turn
+
+ cmd->angleturn = (cmd->angleturn + 128) & 0xff00;
+ }
}
@@ -1616,7 +1634,7 @@ void G_ReadDemoTiccmd (ticcmd_t* cmd)
}
else
{
- cmd->angleturn = ((unsigned char)*demo_p++)<<8;
+ cmd->angleturn = ((unsigned char) *demo_p++)<<8;
}
cmd->buttons = (unsigned char)*demo_p++;
@@ -1644,7 +1662,7 @@ void G_WriteDemoTiccmd (ticcmd_t* cmd)
}
else
{
- *demo_p++ = (cmd->angleturn+128)>>8;
+ *demo_p++ = cmd->angleturn >> 8;
}
*demo_p++ = cmd->buttons;
@@ -1693,7 +1711,11 @@ void G_BeginRecording (void)
// Check for the longtics parameter, to record hires angle
// turns in demos
longtics = M_CheckParm("-longtics") != 0;
-
+
+ // If not recording a longtics demo, record in low res
+
+ lowres_turn = !longtics;
+
demo_p = demobuffer;
// Save the right version code for this demo