foxygit / doom Log in
commit cf42188fb493250133fd15fccb61faaf0444a03a
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Sep 10 22:28:23 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Sep 10 22:28:23 2008 +0000

    Split out variables for controls into common m_controls.c.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1219
---
 src/Makefile.am   |  1 +
 src/doom/g_game.c | 46 +-------------------------------
 src/m_config.c    | 48 +++-------------------------------
 src/m_controls.c  | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/m_controls.h  | 59 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 142 insertions(+), 90 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index eb5d4715..2c732985 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,7 @@ m_argv.c             m_argv.h              \
 m_bbox.c             m_bbox.h              \
 m_cheat.c            m_cheat.h             \
 m_config.c           m_config.h            \
+m_controls.c         m_controls.h          \
 m_fixed.c            m_fixed.h             \
 m_misc.c             m_misc.h              \
 md5.c                md5.h                 \
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index defcf368..d819af8d 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -39,6 +39,7 @@
 #include "z_zone.h"
 #include "f_finale.h"
 #include "m_argv.h"
+#include "m_controls.h"
 #include "m_misc.h"
 #include "m_menu.h"
 #include "m_random.h"
@@ -158,51 +159,6 @@ wbstartstruct_t wminfo;               	// parms for world map / intermission

 byte		consistancy[MAXPLAYERS][BACKUPTICS];

-
-//
-// Controls
-//
-int             key_right = KEY_RIGHTARROW;
-int		key_left = KEY_LEFTARROW;
-
-int		key_up = KEY_UPARROW;
-int		key_down = KEY_DOWNARROW;
-int             key_strafeleft = ',';
-int		key_straferight = '.';
-int             key_fire = KEY_RCTRL;
-int		key_use = ' ';
-int		key_strafe = KEY_RALT;
-int		key_speed = KEY_RSHIFT;
-
-int             mousebfire = 0;
-int             mousebstrafe = 1;
-int             mousebforward = 2;
-
-int             mousebstrafeleft = -1;
-int             mousebstraferight = -1;
-int             mousebbackward = -1;
-int             mousebuse = -1;
-
-// Control whether if a mouse button is double clicked, it acts like
-// "use" has been pressed
-
-int             dclick_use = 1;
-
-int             joybfire = 0;
-int             joybstrafe = 1;
-int             joybuse = 3;
-int             joybspeed = 2;
-int             joybstrafeleft = -1;
-int             joybstraferight = -1;
-
-// fraggle: Disallow mouse and joystick movement to cause forward/backward
-// motion.  Specified with the '-novert' command line parameter.
-// This is an int to allow saving to config file
-
-int             novert = 0;
-
-
-
 #define MAXPLMOVE		(forwardmove[1])

 #define TURBOTHRESHOLD	0x32
diff --git a/src/m_config.c b/src/m_config.c
index bb8d5020..099c81d4 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -39,7 +39,7 @@

 #include "z_zone.h"

-#include "m_menu.h"
+#include "m_controls.h"
 #include "m_argv.h"
 #include "net_client.h"

@@ -51,16 +51,10 @@
 #include "i_video.h"
 #include "v_video.h"

-#include "hu_stuff.h"
-
-// State.
-#include "doomstat.h"
-
-// Data.
-#include "dstrings.h"
-
 #include "m_misc.h"

+#include "m_menu.h"
+#include "doomstat.h"

 //
 // DEFAULTS
@@ -71,51 +65,15 @@

 char *          configdir;

-
 int		usemouse = 1;
 int		usejoystick = 0;

-extern int	key_right;
-extern int	key_left;
-extern int	key_up;
-extern int	key_down;
-
-extern int	key_strafeleft;
-extern int	key_straferight;
-
-extern int	key_fire;
-extern int	key_use;
-extern int	key_strafe;
-extern int	key_speed;
-
-extern int	mousebfire;
-extern int	mousebstrafe;
-extern int	mousebforward;
-
-extern int      mousebstrafeleft;
-extern int      mousebstraferight;
-extern int      mousebbackward;
-extern int      mousebuse;
-
-extern int      dclick_use;
-
-extern int	joybfire;
-extern int	joybstrafe;
-extern int	joybuse;
-extern int	joybspeed;
-extern int      joybstrafeleft;
-extern int      joybstraferight;
-
-extern int	viewwidth;
-extern int	viewheight;
-
 extern int	mouseSensitivity;
 extern int	showMessages;

 // machine-independent sound params
 extern	int	numChannels;

-
 extern char*	chat_macros[];

 extern int      show_endoom;
diff --git a/src/m_controls.c b/src/m_controls.c
new file mode 100644
index 00000000..56084a79
--- /dev/null
+++ b/src/m_controls.c
@@ -0,0 +1,78 @@
+// Emacs style mode select   -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 1993-1996 Id Software, Inc.
+// Copyright(C) 2005-8 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+
+#include "doomtype.h"
+#include "doomkeys.h"
+
+//
+// Keyboard controls
+//
+
+int key_right = KEY_RIGHTARROW;
+int key_left = KEY_LEFTARROW;
+
+int key_up = KEY_UPARROW;
+int key_down = KEY_DOWNARROW;
+int key_strafeleft = ',';
+int key_straferight = '.';
+int key_fire = KEY_RCTRL;
+int key_use = ' ';
+int key_strafe = KEY_RALT;
+int key_speed = KEY_RSHIFT;
+
+//
+// Mouse controls
+//
+
+int mousebfire = 0;
+int mousebstrafe = 1;
+int mousebforward = 2;
+
+int mousebstrafeleft = -1;
+int mousebstraferight = -1;
+int mousebbackward = -1;
+int mousebuse = -1;
+
+//
+// Joystick controls
+//
+
+int joybfire = 0;
+int joybstrafe = 1;
+int joybuse = 3;
+int joybspeed = 2;
+
+int joybstrafeleft = -1;
+int joybstraferight = -1;
+
+// Control whether if a mouse button is double clicked, it acts like
+// "use" has been pressed
+
+int dclick_use = 1;
+
+// Disallow mouse and joystick movement to cause forward/backward
+// motion.  Specified with the '-novert' command line parameter.
+// This is an int to allow saving to config file
+
+int novert = 0;
+
diff --git a/src/m_controls.h b/src/m_controls.h
new file mode 100644
index 00000000..98271bfe
--- /dev/null
+++ b/src/m_controls.h
@@ -0,0 +1,59 @@
+// Emacs style mode select   -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 1993-1996 Id Software, Inc.
+// Copyright(C) 2005-8 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+
+#ifndef __M_CONTROLS_H__
+#define __M_CONTROLS_H__
+
+extern int key_right;
+extern int key_left;
+
+extern int key_up;
+extern int key_down;
+extern int key_strafeleft;
+extern int key_straferight;
+extern int key_fire;
+extern int key_use;
+extern int key_strafe;
+extern int key_speed;
+
+extern int mousebfire;
+extern int mousebstrafe;
+extern int mousebforward;
+
+extern int mousebstrafeleft;
+extern int mousebstraferight;
+extern int mousebbackward;
+extern int mousebuse;
+
+extern int joybfire;
+extern int joybstrafe;
+extern int joybuse;
+extern int joybspeed;
+extern int joybstrafeleft;
+extern int joybstraferight;
+
+extern int dclick_use;
+extern int novert;
+
+#endif /* #ifndef __M_CONTROLS_H__ */
+