1 /*
2     GL-117
3     Copyright 2001, 2002 Thomas A. Drexl aka heptargon
4 
5     This file is part of GL-117.
6 
7     GL-117 is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     GL-117 is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with GL-117; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
21 
22 /* This file contains all configuration parsing code. */
23 
24 #ifndef IS_CONF_H
25 #define IS_CONF_H
26 
27 // interface definitions
28 extern unsigned int key_firecannon, key_firemissile, key_dropchaff, key_dropflare;
29 extern unsigned int key_selectmissile, key_thrustup, key_thrustdown;
30 extern unsigned int key_targetnearest, key_targetnext, key_targetprevious, key_targetlocking;
31 
32 extern int joystick_firecannon, joystick_firemissile, joystick_dropchaff, joystick_dropflare;
33 extern int joystick_selectmissile, joystick_thrustup, joystick_thrustdown;
34 extern int joystick_targetnearest, joystick_targetnext, joystick_targetprevious, joystick_targetlocking;
35 extern int joystick_aileron, joystick_elevator, joystick_rudder, joystick_throttle;
36 extern int joystick_view_x, joystick_view_y;
37 
38 extern unsigned char mouse_firecannon, mouse_firemissile;
39 extern unsigned char mouse_selectmissile;
40 extern unsigned int mouse_sensitivity;
41 extern bool mouse_reverse;
42 extern bool mouse_relative;
43 extern int mouse_autorudder;
44 
45 // the abstract config file as text file in memory
46 class ConfigFile
47 {
48   public:
49   char buf [32000]; // max file size
50   int length;
51   FILE *out;
52   ConfigFile ();
53   ConfigFile (char *fname);
54   char *skipwhite (char *str);
55   char *skipnum (char *str);
56   char *skipalphanum (char *str);
57   char *getString (char *dest, char *str);
58   int getValue (char *str);
59   int openOutput (char *fname);
60   int write (char *str1, int n);
61   int write (char *str1, char c);
62   void writeText (char *str);
63   void close ();
64 };
65 
66 // special config files of GL-117: conf and conf.interface
67 extern void save_config ();
68 extern void save_saveconfig ();
69 extern int load_config ();
70 extern int load_saveconfig ();
71 extern void save_configInterface ();
72 extern int load_configInterface ();
73 
74 #endif
75