ref: c47c4ce0f7fa832f3aabe2ebb3bd5de45d93651a
parent: ccb1b27acc35859fe35c909c9bd005b9148ebc89
author: Simon Howard <[email protected]>
date: Sun Sep 4 13:33:43 EDT 2005
Support demos recorded with cph's modified "v1.91" doom exe - which contain higher resolution angleturn Subversion-branch: /trunk/chocolate-doom Subversion-revision: 70
--- 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,9 +37,12 @@
// 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
// to handle IWAD dependend animations etc.
typedef enum
@@ -362,6 +365,10 @@
//-----------------------------------------------------------------------------
//
// $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
--- 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 @@
char demoname[32];
boolean demorecording;
+boolean longtics; // cph's doom 1.91 longtics hack
boolean demoplayback;
boolean netdemo;
byte* demobuffer;
@@ -1548,7 +1553,19 @@
}
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++;
}
@@ -1555,13 +1572,33 @@
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_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 @@
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;
}