summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2005-09-04 17:33:43 +0000
committerSimon Howard2005-09-04 17:33:43 +0000
commitc47c4ce0f7fa832f3aabe2ebb3bd5de45d93651a (patch)
treec1c02a583044ce57f6bcf2ae367ff214ce75092c /src
parentccb1b27acc35859fe35c909c9bd005b9148ebc89 (diff)
downloadchocolate-doom-c47c4ce0f7fa832f3aabe2ebb3bd5de45d93651a.tar.gz
chocolate-doom-c47c4ce0f7fa832f3aabe2ebb3bd5de45d93651a.tar.bz2
chocolate-doom-c47c4ce0f7fa832f3aabe2ebb3bd5de45d93651a.zip
Support demos recorded with cph's modified "v1.91" doom exe - which
contain higher resolution angleturn Subversion-branch: /trunk/chocolate-doom Subversion-revision: 70
Diffstat (limited to 'src')
-rw-r--r--src/doomdef.h11
-rw-r--r--src/g_game.c76
2 files changed, 77 insertions, 10 deletions
diff --git a/src/doomdef.h b/src/doomdef.h
index 99e06cf4..1ea9750d 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: doomdef.h 41 2005-08-04 22:55:08Z fraggle $
+// $Id: doomdef.h 70 2005-09-04 17:33:43Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -37,7 +37,10 @@
// Global parameters/defines.
//
// DOOM version
-enum { DOOM_VERSION = 109 };
+#define DOOM_VERSION 109
+
+// Version code for cph's longtics hack ("v1.91")
+#define DOOM_191_VERSION 111
// Game mode handling - identify IWAD version
@@ -362,6 +365,10 @@ typedef enum
//-----------------------------------------------------------------------------
//
// $Log$
+// Revision 1.7 2005/09/04 17:33:43 fraggle
+// Support demos recorded with cph's modified "v1.91" doom exe - which
+// contain higher resolution angleturn
+//
// Revision 1.6 2005/08/04 22:55:08 fraggle
// Use DOOM_VERSION to define the Doom version (don't conflict with
// automake's config.h). Display GPL message instead of anti-piracy
diff --git a/src/g_game.c b/src/g_game.c
index c35b8540..eda7706a 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: g_game.c 69 2005-09-04 15:59:45Z fraggle $
+// $Id: g_game.c 70 2005-09-04 17:33:43Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.7 2005/09/04 17:33:43 fraggle
+// Support demos recorded with cph's modified "v1.91" doom exe - which
+// contain higher resolution angleturn
+//
// Revision 1.6 2005/09/04 15:59:45 fraggle
// 'novert' command line option to disable vertical mouse movement
//
@@ -49,7 +53,7 @@
static const char
-rcsid[] = "$Id: g_game.c 69 2005-09-04 15:59:45Z fraggle $";
+rcsid[] = "$Id: g_game.c 70 2005-09-04 17:33:43Z fraggle $";
#include <string.h>
#include <stdlib.h>
@@ -153,6 +157,7 @@ int totalkills, totalitems, totalsecret; // for intermission
char demoname[32];
boolean demorecording;
+boolean longtics; // cph's doom 1.91 longtics hack
boolean demoplayback;
boolean netdemo;
byte* demobuffer;
@@ -1548,20 +1553,52 @@ void G_ReadDemoTiccmd (ticcmd_t* cmd)
}
cmd->forwardmove = ((signed char)*demo_p++);
cmd->sidemove = ((signed char)*demo_p++);
- cmd->angleturn = ((unsigned char)*demo_p++)<<8;
+
+ // If this is a longtics demo, read back in higher resolution
+
+ if (longtics)
+ {
+ cmd->angleturn = *demo_p++;
+ cmd->angleturn |= (*demo_p++) << 8;
+ }
+ else
+ {
+ cmd->angleturn = ((unsigned char)*demo_p++)<<8;
+ }
+
cmd->buttons = (unsigned char)*demo_p++;
}
void G_WriteDemoTiccmd (ticcmd_t* cmd)
{
+ byte *demo_start;
+
if (gamekeydown['q']) // press q to end demo recording
G_CheckDemoStatus ();
+
+ demo_start = demo_p;
+
*demo_p++ = cmd->forwardmove;
*demo_p++ = cmd->sidemove;
- *demo_p++ = (cmd->angleturn+128)>>8;
+
+ // If this is a longtics demo, record in higher resolution
+
+ if (longtics)
+ {
+ *demo_p++ = (cmd->angleturn & 0xff);
+ *demo_p++ = (cmd->angleturn >> 8) & 0xff;
+ }
+ else
+ {
+ *demo_p++ = (cmd->angleturn+128)>>8;
+ }
+
*demo_p++ = cmd->buttons;
- demo_p -= 4;
+
+ // reset demo pointer back
+ demo_p = demo_start;
+
if (demo_p > demoend - 16)
{
// no more space
@@ -1599,10 +1636,24 @@ void G_RecordDemo (char* name)
void G_BeginRecording (void)
{
int i;
+
+ // Check for the longtics parameter, to record hires angle
+ // turns in demos
+ longtics = M_CheckParm("-longtics") != 0;
demo_p = demobuffer;
- *demo_p++ = DOOM_VERSION;
+ // Save the right version code for this demo
+
+ if (longtics)
+ {
+ *demo_p++ = DOOM_191_VERSION;
+ }
+ else
+ {
+ *demo_p++ = DOOM_VERSION;
+ }
+
*demo_p++ = gameskill;
*demo_p++ = gameepisode;
*demo_p++ = gamemap;
@@ -1640,10 +1691,19 @@ void G_DoPlayDemo (void)
demoversion = *demo_p++;
- if ( demoversion != DOOM_VERSION)
+ if (demoversion == DOOM_VERSION)
+ {
+ longtics = false;
+ }
+ else if (demoversion == DOOM_191_VERSION)
+ {
+ // demo recorded with cph's modified "v1.91" doom exe
+ longtics = true;
+ }
+ else
{
fprintf( stderr, "Demo is from a different game version!\n");
- // fprintf(stderr, "%i, %i\n", demoversion, DOOM_VERSION);
+ fprintf(stderr, "%i, %i\n", demoversion, DOOM_VERSION);
gameaction = ga_nothing;
return;
}