shithub: choc

Download patch

ref: cf42188fb493250133fd15fccb61faaf0444a03a
parent: 154d9d8024ffad9027981eb586913d14c6c50d60
author: Simon Howard <fraggle@gmail.com>
date: Wed Sep 10 18:28:23 EDT 2008

Split out variables for controls into common m_controls.c.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1219

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,7 @@
 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                 \
--- 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"
@@ -157,51 +158,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]) 
  
--- 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,17 +51,11 @@
 #include "i_video.h"
 #include "v_video.h"
 
-#include "hu_stuff.h"
+#include "m_misc.h"
 
-// State.
+#include "m_menu.h"
 #include "doomstat.h"
 
-// Data.
-#include "dstrings.h"
-
-#include "m_misc.h"
-
-
 //
 // DEFAULTS
 //
@@ -71,50 +65,14 @@
 
 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[];
 
--- /dev/null
+++ b/src/m_controls.c
@@ -1,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;
+ 
--- /dev/null
+++ b/src/m_controls.h
@@ -1,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__ */
+