New play mode. be happy.
[neverball] / share / config.h
1 /*
2  * Copyright (C) 2003 Robert Kooima
3  *
4  * NEVERBALL is  free software; you can redistribute  it and/or modify
5  * it under the  terms of the GNU General  Public License as published
6  * by the Free  Software Foundation; either version 2  of the License,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
11  * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
12  * General Public License for more details.
13  */
14
15 #ifndef CONFIG_H
16 #define CONFIG_H
17
18 #include <SDL.h>
19 #include <stdio.h>
20 #include "i18n.h"
21
22 /*---------------------------------------------------------------------------*/
23
24 #define CONFIG_DATA "./data"
25 #define CONFIG_LOCALE "./locale"
26 #define CONFIG_USER ".neverball"
27
28 /*
29  * Global settings are stored in USER_CONFIG_FILE.  Replays are stored
30  * in  USER_REPLAY_FILE.  These files  are placed  in the  user's home
31  * directory as given by the HOME environment var.  If the config file
32  * is deleted, it will be recreated using the defaults.
33  */
34 #define USER_CONFIG_FILE "neverballrc"
35 #define USER_REPLAY_FILE _("Last")
36
37 /*---------------------------------------------------------------------------*/
38
39 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
40 #define RMASK 0xFF000000
41 #define GMASK 0x00FF0000
42 #define BMASK 0x0000FF00
43 #define AMASK 0x000000FF
44 #else
45 #define RMASK 0x000000FF
46 #define GMASK 0x0000FF00
47 #define BMASK 0x00FF0000
48 #define AMASK 0xFF000000
49 #endif
50
51 #ifdef _WIN32
52 #define FMODE_RB "rb"
53 #define FMODE_WB "wb"
54 #else
55 #define FMODE_RB "r"
56 #define FMODE_WB "w"
57 #endif
58
59 #ifdef _WIN32
60 #define AUDIO_BUFF_HI 4096
61 #define AUDIO_BUFF_LO 2048
62 #else
63 #define AUDIO_BUFF_HI 2048
64 #define AUDIO_BUFF_LO 1024
65 #endif
66
67 /*---------------------------------------------------------------------------*/
68
69 enum {
70     CONFIG_FULLSCREEN,
71     CONFIG_WIDTH,
72     CONFIG_HEIGHT,
73     CONFIG_STEREO,
74     CONFIG_CAMERA,
75     CONFIG_TEXTURES,
76     CONFIG_GEOMETRY,
77     CONFIG_REFLECTION,
78     CONFIG_BACKGROUND,
79     CONFIG_SHADOW,
80     CONFIG_AUDIO_RATE,
81     CONFIG_AUDIO_BUFF,
82     CONFIG_MOUSE_SENSE,
83     CONFIG_MOUSE_INVERT,
84     CONFIG_NICE,
85     CONFIG_FPS,
86     CONFIG_SOUND_VOLUME,
87     CONFIG_MUSIC_VOLUME,
88     CONFIG_JOYSTICK,
89     CONFIG_JOYSTICK_DEVICE,
90     CONFIG_JOYSTICK_AXIS_X,
91     CONFIG_JOYSTICK_AXIS_Y,
92     CONFIG_JOYSTICK_BUTTON_A,
93     CONFIG_JOYSTICK_BUTTON_B,
94     CONFIG_JOYSTICK_BUTTON_R,
95     CONFIG_JOYSTICK_BUTTON_L,
96     CONFIG_JOYSTICK_BUTTON_EXIT,
97     CONFIG_JOYSTICK_CAMERA_1,
98     CONFIG_JOYSTICK_CAMERA_2,
99     CONFIG_JOYSTICK_CAMERA_3,
100     CONFIG_KEY_CAMERA_1,
101     CONFIG_KEY_CAMERA_2,
102     CONFIG_KEY_CAMERA_3,
103     CONFIG_KEY_CAMERA_R,
104     CONFIG_KEY_CAMERA_L,
105     CONFIG_VIEW_FOV,
106     CONFIG_VIEW_DP,
107     CONFIG_VIEW_DC,
108     CONFIG_VIEW_DZ,
109     CONFIG_ROTATE_FAST,
110     CONFIG_ROTATE_SLOW,
111     CONFIG_LAST_SET,
112     CONFIG_MODE_FREE,
113
114     CONFIG_OPTION_D_COUNT
115 };
116
117 enum {
118     CONFIG_PLAYER,
119     CONFIG_BALL,
120     CONFIG_COIN,
121     CONFIG_LANG,
122
123     CONFIG_OPTION_S_COUNT
124 };
125
126 /*---------------------------------------------------------------------------*/
127
128 #define DEFAULT_FULLSCREEN           0
129 #define DEFAULT_WIDTH                800
130 #define DEFAULT_HEIGHT               600
131 #define DEFAULT_STEREO               0
132 #define DEFAULT_CAMERA               0
133 #define DEFAULT_TEXTURES             1
134 #define DEFAULT_GEOMETRY             1
135 #define DEFAULT_REFLECTION           1
136 #define DEFAULT_BACKGROUND           1
137 #define DEFAULT_SHADOW               1
138 #define DEFAULT_AUDIO_RATE           44100
139 #define DEFAULT_AUDIO_BUFF           AUDIO_BUFF_HI
140 #define DEFAULT_MOUSE_SENSE          300
141 #define DEFAULT_MOUSE_INVERT         0
142 #define DEFAULT_NICE                 1
143 #define DEFAULT_FPS                  0
144 #define DEFAULT_SOUND_VOLUME         10
145 #define DEFAULT_MUSIC_VOLUME         6
146 #define DEFAULT_JOYSTICK             0
147 #define DEFAULT_JOYSTICK_DEVICE      0
148 #define DEFAULT_JOYSTICK_AXIS_X      0
149 #define DEFAULT_JOYSTICK_AXIS_Y      1
150 #define DEFAULT_JOYSTICK_BUTTON_A    0
151 #define DEFAULT_JOYSTICK_BUTTON_B    1
152 #define DEFAULT_JOYSTICK_BUTTON_R    2
153 #define DEFAULT_JOYSTICK_BUTTON_L    3
154 #define DEFAULT_JOYSTICK_BUTTON_EXIT 4
155 #define DEFAULT_JOYSTICK_CAMERA_1    5
156 #define DEFAULT_JOYSTICK_CAMERA_2    6
157 #define DEFAULT_JOYSTICK_CAMERA_3    7
158 #define DEFAULT_KEY_CAMERA_1         SDLK_F1
159 #define DEFAULT_KEY_CAMERA_2         SDLK_F2
160 #define DEFAULT_KEY_CAMERA_3         SDLK_F3
161 #define DEFAULT_KEY_CAMERA_R         SDLK_RIGHT
162 #define DEFAULT_KEY_CAMERA_L         SDLK_LEFT
163 #define DEFAULT_VIEW_FOV             50
164 #define DEFAULT_VIEW_DP              75
165 #define DEFAULT_VIEW_DC              25
166 #define DEFAULT_VIEW_DZ              200
167 #define DEFAULT_ROTATE_SLOW          100
168 #define DEFAULT_ROTATE_FAST          200
169 #define DEFAULT_LAST_SET             0
170 #define DEFAULT_MODE_FREE            0
171 #define DEFAULT_PLAYER               _("Player")
172 #define DEFAULT_BALL                 "png/ball.png"
173 #define DEFAULT_COIN                 _("png/coin.png")
174 #define DEFAULT_LANG                 ""
175
176 /*---------------------------------------------------------------------------*/
177
178 #define JOY_MAX 32767
179 #define JOY_MID 16383
180
181 #define MAXSTR 256
182 #define MAXLVL 26
183 #define MAXNAM 9
184
185 #define GUI_FACE                    _("ttf/DejaVuSans-Bold.ttf")
186
187 /*---------------------------------------------------------------------------*/
188
189 void config_init(void);
190 void config_load(void);
191 void config_save(void);
192 int  config_mode(int, int, int);
193
194 const char *config_data(const char *);
195 const char *config_user(const char *);
196
197 int  config_data_path(const char *, const char *);
198 int  config_user_path(const char *);
199
200 /*---------------------------------------------------------------------------*/
201
202 void config_set_d(int, int);
203 void config_tgl_d(int);
204 int  config_tst_d(int, int);
205 int  config_get_d(int);
206
207 void config_set_s(int, const char *);
208 void config_get_s(int, char *, int);
209 const char * config_simple_get_s(int i);
210         
211
212 /*---------------------------------------------------------------------------*/
213
214 void config_set_grab(void);
215 void config_clr_grab(void);
216 int  config_get_grab(void);
217
218 int  config_get_pause(void);
219 void config_set_pause(void);
220 void config_clr_pause(void);
221 void config_tgl_pause(void);
222
223 /*---------------------------------------------------------------------------*/
224
225 void config_push_persp(float, float, float);
226 void config_push_ortho(void);
227 void config_pop_matrix(void);
228 void config_clear(void);
229
230 /*---------------------------------------------------------------------------*/
231
232 #endif