summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2005-09-17 20:25:56 +0000
committerSimon Howard2005-09-17 20:25:56 +0000
commit8c0e2a0259906c9b5cc495a24ce07f8cca44cb71 (patch)
treed9b00d18519fa780767e2dc51a30ca29e31ea0f2
parent66bf226f5830b54152a80ab0cc64e2aa7498f418 (diff)
downloadchocolate-doom-8c0e2a0259906c9b5cc495a24ce07f8cca44cb71.tar.gz
chocolate-doom-8c0e2a0259906c9b5cc495a24ce07f8cca44cb71.tar.bz2
chocolate-doom-8c0e2a0259906c9b5cc495a24ce07f8cca44cb71.zip
Set the default values for variables in their initialisers. Remove the
"defaultvalue" parameter and associated code from the configuration file parsing code. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 110
-rw-r--r--src/g_game.c53
-rw-r--r--src/i_video.h9
-rw-r--r--src/m_menu.c27
-rw-r--r--src/m_misc.c146
-rw-r--r--src/s_sound.c16
-rw-r--r--src/v_video.c12
6 files changed, 143 insertions, 120 deletions
diff --git a/src/g_game.c b/src/g_game.c
index ebc75e97..81ae6de9 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: g_game.c 98 2005-09-11 20:25:56Z fraggle $
+// $Id: g_game.c 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,11 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.10 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.9 2005/09/11 20:25:56 fraggle
// Second configuration file to allow chocolate doom-specific settings.
// Adjust some existing command line logic (for graphics settings and
@@ -61,7 +66,7 @@
static const char
-rcsid[] = "$Id: g_game.c 98 2005-09-11 20:25:56Z fraggle $";
+rcsid[] = "$Id: g_game.c 110 2005-09-17 20:25:56Z fraggle $";
#include <string.h>
#include <stdlib.h>
@@ -183,34 +188,34 @@ byte* savebuffer;
//
-// controls (have defaults)
+// Controls
//
-int key_right;
-int key_left;
-
-int key_up;
-int key_down;
-int key_strafeleft;
-int key_straferight;
-int key_fire;
-int key_use;
-int key_strafe;
-int key_speed;
-
-int mousebfire;
-int mousebstrafe;
-int mousebforward;
-
-int joybfire;
-int joybstrafe;
-int joybuse;
-int joybspeed;
+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 joybfire = 0;
+int joybstrafe = 1;
+int joybuse = 3;
+int joybspeed = 2;
// 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;
+int novert = 0;
diff --git a/src/i_video.h b/src/i_video.h
index a5d98569..b45ab857 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.h 98 2005-09-11 20:25:56Z fraggle $
+// $Id: i_video.h 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -61,12 +61,17 @@ extern boolean screenvisible;
extern int screenmultiply;
extern boolean fullscreen;
extern boolean grabmouse;
-
+extern float mouse_acceleration;
#endif
//-----------------------------------------------------------------------------
//
// $Log$
+// Revision 1.7 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.6 2005/09/11 20:25:56 fraggle
// Second configuration file to allow chocolate doom-specific settings.
// Adjust some existing command line logic (for graphics settings and
diff --git a/src/m_menu.c b/src/m_menu.c
index 46f6e27a..196c1ca3 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_menu.c 84 2005-09-07 21:30:42Z fraggle $
+// $Id: m_menu.c 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,11 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.7 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.6 2005/09/07 21:30:42 fraggle
// Remove non-ANSI C headers. Use standard C file I/O functions.
//
@@ -49,7 +54,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_menu.c 84 2005-09-07 21:30:42Z fraggle $";
+rcsid[] = "$Id: m_menu.c 110 2005-09-17 20:25:56Z fraggle $";
#include <stdlib.h>
#include <ctype.h>
@@ -96,34 +101,34 @@ extern boolean chat_on; // in heads-up code
//
// defaulted values
//
-int mouseSensitivity; // has default
+int mouseSensitivity = 5;
// Show messages has default, 0 = off, 1 = on
-int showMessages;
+int showMessages = 1;
// Blocky mode, has default, 0 = high, 1 = normal
-int detailLevel;
-int screenblocks; // has default
+int detailLevel = 0;
+int screenblocks = 9;
// temp for screenblocks (0-9)
-int screenSize;
+int screenSize;
// -1 = no quicksave slot picked!
-int quickSaveSlot;
+int quickSaveSlot;
// 1 = message to be printed
int messageToPrint;
// ...and here is the message string!
-char* messageString;
+char* messageString;
// message x & y
-int messx;
+int messx;
int messy;
int messageLastMenuActive;
// timed message = no input from user
-boolean messageNeedsInput;
+boolean messageNeedsInput;
void (*messageRoutine)(int response);
diff --git a/src/m_misc.c b/src/m_misc.c
index f4264feb..563d0522 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_misc.c 109 2005-09-17 20:06:45Z fraggle $
+// $Id: m_misc.c 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -23,6 +23,11 @@
//
//
// $Log$
+// Revision 1.11 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.10 2005/09/17 20:06:45 fraggle
// Rewrite configuration loading code; assign a type to each configuration
// parameter. Allow float parameters, align all values in the configuration
@@ -70,7 +75,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_misc.c 109 2005-09-17 20:06:45Z fraggle $";
+rcsid[] = "$Id: m_misc.c 110 2005-09-17 20:25:56Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -213,8 +218,8 @@ int M_ReadFile(char const *name, byte **buffer)
// locations of config files
-int usemouse;
-int usejoystick;
+int usemouse = 1;
+int usejoystick = 0;
extern int key_right;
extern int key_left;
@@ -260,12 +265,12 @@ extern char* chat_macros[];
// so that the config file can be shared between chocolate
// doom and doom.exe
-static int snd_musicdevice;
-static int snd_sfxdevice;
-static int snd_sbport;
-static int snd_sbirq;
-static int snd_sbdma;
-static int snd_mport;
+static int snd_musicdevice = 0;
+static int snd_sfxdevice = 0;
+static int snd_sbport = 0;
+static int snd_sbirq = 0;
+static int snd_sbdma = 0;
+static int snd_mport = 0;
typedef enum
{
@@ -279,7 +284,6 @@ typedef struct
{
char * name;
void * location;
- int defaultvalue;
default_type_t type;
int untranslated;
} default_t;
@@ -293,58 +297,58 @@ typedef struct
static default_t doom_defaults_list[] =
{
- {"mouse_sensitivity",&mouseSensitivity, 5},
- {"sfx_volume",&snd_SfxVolume, 8},
- {"music_volume",&snd_MusicVolume, 8},
- {"show_messages",&showMessages, 1},
-
- {"key_right",&key_right, KEY_RIGHTARROW, DEFAULT_KEY},
- {"key_left",&key_left, KEY_LEFTARROW, DEFAULT_KEY},
- {"key_up",&key_up, KEY_UPARROW, DEFAULT_KEY},
- {"key_down",&key_down, KEY_DOWNARROW, DEFAULT_KEY},
- {"key_strafeleft",&key_strafeleft, ',', DEFAULT_KEY},
- {"key_straferight",&key_straferight, '.', DEFAULT_KEY},
-
- {"key_fire",&key_fire, KEY_RCTRL, DEFAULT_KEY},
- {"key_use",&key_use, ' ', DEFAULT_KEY},
- {"key_strafe",&key_strafe, KEY_RALT, DEFAULT_KEY},
- {"key_speed",&key_speed, KEY_RSHIFT, DEFAULT_KEY},
-
- {"use_mouse",&usemouse, 1},
- {"mouseb_fire",&mousebfire,0},
- {"mouseb_strafe",&mousebstrafe,1},
- {"mouseb_forward",&mousebforward,2},
-
- {"use_joystick",&usejoystick, 0},
- {"joyb_fire",&joybfire,0},
- {"joyb_strafe",&joybstrafe,1},
- {"joyb_use",&joybuse,3},
- {"joyb_speed",&joybspeed,2},
-
- {"screenblocks",&screenblocks, 9},
- {"detaillevel",&detailLevel, 0},
-
- {"snd_channels",&numChannels, 3},
-
- {"snd_musicdevice", &snd_musicdevice, 0},
- {"snd_sfxdevice", &snd_sfxdevice, 0},
- {"snd_sbport", &snd_sbport, 0},
- {"snd_sbirq", &snd_sbirq, 0},
- {"snd_sbdma", &snd_sbdma, 0},
- {"snd_mport", &snd_mport, 0},
-
- {"usegamma",&usegamma, 0},
-
- {"chatmacro0", &chat_macros[0], (int) HUSTR_CHATMACRO0, DEFAULT_STRING },
- {"chatmacro1", &chat_macros[1], (int) HUSTR_CHATMACRO1, DEFAULT_STRING },
- {"chatmacro2", &chat_macros[2], (int) HUSTR_CHATMACRO2, DEFAULT_STRING },
- {"chatmacro3", &chat_macros[3], (int) HUSTR_CHATMACRO3, DEFAULT_STRING },
- {"chatmacro4", &chat_macros[4], (int) HUSTR_CHATMACRO4, DEFAULT_STRING },
- {"chatmacro5", &chat_macros[5], (int) HUSTR_CHATMACRO5, DEFAULT_STRING },
- {"chatmacro6", &chat_macros[6], (int) HUSTR_CHATMACRO6, DEFAULT_STRING },
- {"chatmacro7", &chat_macros[7], (int) HUSTR_CHATMACRO7, DEFAULT_STRING },
- {"chatmacro8", &chat_macros[8], (int) HUSTR_CHATMACRO8, DEFAULT_STRING },
- {"chatmacro9", &chat_macros[9], (int) HUSTR_CHATMACRO9, DEFAULT_STRING },
+ {"mouse_sensitivity", &mouseSensitivity},
+ {"sfx_volume",&snd_SfxVolume},
+ {"music_volume",&snd_MusicVolume},
+ {"show_messages",&showMessages},
+
+ {"key_right",&key_right, DEFAULT_KEY},
+ {"key_left",&key_left, DEFAULT_KEY},
+ {"key_up",&key_up, DEFAULT_KEY},
+ {"key_down",&key_down, DEFAULT_KEY},
+ {"key_strafeleft",&key_strafeleft, DEFAULT_KEY},
+ {"key_straferight",&key_straferight, DEFAULT_KEY},
+
+ {"key_fire",&key_fire, DEFAULT_KEY},
+ {"key_use",&key_use, DEFAULT_KEY},
+ {"key_strafe",&key_strafe, DEFAULT_KEY},
+ {"key_speed",&key_speed, DEFAULT_KEY},
+
+ {"use_mouse",&usemouse},
+ {"mouseb_fire",&mousebfire},
+ {"mouseb_strafe",&mousebstrafe},
+ {"mouseb_forward",&mousebforward},
+
+ {"use_joystick",&usejoystick},
+ {"joyb_fire",&joybfire},
+ {"joyb_strafe",&joybstrafe},
+ {"joyb_use",&joybuse},
+ {"joyb_speed",&joybspeed},
+
+ {"screenblocks",&screenblocks},
+ {"detaillevel",&detailLevel},
+
+ {"snd_channels",&numChannels},
+
+ {"snd_musicdevice", &snd_musicdevice},
+ {"snd_sfxdevice", &snd_sfxdevice},
+ {"snd_sbport", &snd_sbport},
+ {"snd_sbirq", &snd_sbirq},
+ {"snd_sbdma", &snd_sbdma},
+ {"snd_mport", &snd_mport},
+
+ {"usegamma",&usegamma},
+
+ {"chatmacro0", &chat_macros[0], DEFAULT_STRING },
+ {"chatmacro1", &chat_macros[1], DEFAULT_STRING },
+ {"chatmacro2", &chat_macros[2], DEFAULT_STRING },
+ {"chatmacro3", &chat_macros[3], DEFAULT_STRING },
+ {"chatmacro4", &chat_macros[4], DEFAULT_STRING },
+ {"chatmacro5", &chat_macros[5], DEFAULT_STRING },
+ {"chatmacro6", &chat_macros[6], DEFAULT_STRING },
+ {"chatmacro7", &chat_macros[7], DEFAULT_STRING },
+ {"chatmacro8", &chat_macros[8], DEFAULT_STRING },
+ {"chatmacro9", &chat_macros[9], DEFAULT_STRING },
};
static default_collection_t doom_defaults =
@@ -355,10 +359,10 @@ static default_collection_t doom_defaults =
static default_t extra_defaults_list[] =
{
- {"grabmouse", &grabmouse, true},
- {"fullscreen", &fullscreen, true},
- {"screenmultiply", &screenmultiply, 1},
- {"novert", &novert, false},
+ {"grabmouse", &grabmouse},
+ {"fullscreen", &fullscreen},
+ {"screenmultiply", &screenmultiply},
+ {"novert", &novert},
};
static default_collection_t extra_defaults =
@@ -488,14 +492,6 @@ static void LoadDefaultCollection(default_collection_t *collection)
char defname[80];
char strparm[100];
- // set everything to base values
-
- for (i=0 ; i<collection->numdefaults ; i++)
- {
- *((int *) defaults[i].location) = defaults[i].defaultvalue;
- defaults[i].untranslated = 0;
- }
-
// read the file in, overriding any set defaults
f = fopen(collection->filename, "r");
diff --git a/src/s_sound.c b/src/s_sound.c
index 8c4b571a..30d7add2 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: s_sound.c 75 2005-09-05 22:50:56Z fraggle $
+// $Id: s_sound.c 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,11 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.7 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.6 2005/09/05 22:50:56 fraggle
// Add mmus2mid code from prboom. Use 'void *' for music handles. Pass
// length of data when registering music.
@@ -50,7 +55,7 @@
static const char
-rcsid[] = "$Id: s_sound.c 75 2005-09-05 22:50:56Z fraggle $";
+rcsid[] = "$Id: s_sound.c 110 2005-09-17 20:25:56Z fraggle $";
@@ -138,10 +143,10 @@ static channel_t* channels;
// These are not used, but should be (menu).
// Maximum volume of a sound effect.
// Internal default is max out of 0-15.
-int snd_SfxVolume = 15;
+int snd_SfxVolume = 8;
// Maximum volume of music. Useless so far.
-int snd_MusicVolume = 15;
+int snd_MusicVolume = 8;
@@ -154,7 +159,8 @@ static musicinfo_t* mus_playing=0;
// following is set
// by the defaults code in M_misc:
// number of channels available
-int numChannels;
+
+int numChannels = 3;
static int nextcleanup;
diff --git a/src/v_video.c b/src/v_video.c
index aa5a1a42..8e2ab7ab 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: v_video.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: v_video.c 110 2005-09-17 20:25:56Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,11 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.3 2005/09/17 20:25:56 fraggle
+// Set the default values for variables in their initialisers. Remove the
+// "defaultvalue" parameter and associated code from the configuration
+// file parsing code.
+//
// Revision 1.2 2005/07/23 16:44:57 fraggle
// Update copyright to GNU GPL
//
@@ -38,7 +43,7 @@
static const char
-rcsid[] = "$Id: v_video.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: v_video.c 110 2005-09-17 20:25:56Z fraggle $";
#include "i_system.h"
@@ -146,8 +151,9 @@ byte gammatable[5][256] =
};
+// Gamma correction level to use
-int usegamma;
+int usegamma = 0;
//
// V_MarkRect