Import from neverball-1.3.1.tar.gz
[neverball-archive.git] / share / config.c
blob31eccd4df41071c84a1ae96d84e70ffd3bab14d7
1 /*
2 * Copyright (C) 2003 Robert Kooima
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.
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.
15 #include <SDL.h>
16 #include <SDL_mixer.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <stdio.h>
20 #include <errno.h>
22 #include "config.h"
23 #include "glext.h"
25 /*---------------------------------------------------------------------------*/
27 /* Define the mkdir symbol. */
29 #ifdef _WIN32
30 #include <direct.h>
31 #else
32 #include <sys/stat.h>
33 #endif
35 /*---------------------------------------------------------------------------*/
37 static int option_d[CONFIG_OPTION_D_COUNT];
38 static char *option_s[CONFIG_OPTION_S_COUNT];
40 /*---------------------------------------------------------------------------*/
42 static void config_key(const char *s, int i, int d)
44 int c;
46 config_set_d(i, d);
48 for (c = 0; c < SDLK_LAST; c++)
49 if (strcmp(s, SDL_GetKeyName(c)) == 0)
51 config_set_d(i, c);
52 break;
56 /*---------------------------------------------------------------------------*/
58 void config_init(void)
60 memset(option_d, 0, CONFIG_OPTION_D_COUNT * sizeof (int));
61 memset(option_s, 0, CONFIG_OPTION_S_COUNT * sizeof (char *));
63 config_set_d(CONFIG_FULLSCREEN, DEFAULT_FULLSCREEN);
64 config_set_d(CONFIG_WIDTH, DEFAULT_WIDTH);
65 config_set_d(CONFIG_HEIGHT, DEFAULT_HEIGHT);
66 config_set_d(CONFIG_STEREO, DEFAULT_STEREO);
67 config_set_d(CONFIG_CAMERA, DEFAULT_CAMERA);
68 config_set_d(CONFIG_TEXTURES, DEFAULT_TEXTURES);
69 config_set_d(CONFIG_GEOMETRY, DEFAULT_GEOMETRY);
70 config_set_d(CONFIG_REFLECTION, DEFAULT_REFLECTION);
71 config_set_d(CONFIG_BACKGROUND, DEFAULT_BACKGROUND);
72 config_set_d(CONFIG_SHADOW, DEFAULT_SHADOW);
73 config_set_d(CONFIG_AUDIO_RATE, DEFAULT_AUDIO_RATE);
74 config_set_d(CONFIG_AUDIO_BUFF, DEFAULT_AUDIO_BUFF);
75 config_set_d(CONFIG_MOUSE_SENSE, DEFAULT_MOUSE_SENSE);
76 config_set_d(CONFIG_MOUSE_INVERT, DEFAULT_MOUSE_INVERT);
77 config_set_d(CONFIG_NICE, DEFAULT_NICE);
78 config_set_d(CONFIG_FPS, DEFAULT_FPS);
79 config_set_d(CONFIG_SOUND_VOLUME, DEFAULT_SOUND_VOLUME);
80 config_set_d(CONFIG_MUSIC_VOLUME, DEFAULT_MUSIC_VOLUME);
81 config_set_d(CONFIG_JOYSTICK, DEFAULT_JOYSTICK);
82 config_set_d(CONFIG_JOYSTICK_DEVICE, DEFAULT_JOYSTICK_DEVICE);
83 config_set_d(CONFIG_JOYSTICK_AXIS_X, DEFAULT_JOYSTICK_AXIS_X);
84 config_set_d(CONFIG_JOYSTICK_AXIS_Y, DEFAULT_JOYSTICK_AXIS_Y);
85 config_set_d(CONFIG_JOYSTICK_BUTTON_A, DEFAULT_JOYSTICK_BUTTON_A);
86 config_set_d(CONFIG_JOYSTICK_BUTTON_B, DEFAULT_JOYSTICK_BUTTON_B);
87 config_set_d(CONFIG_JOYSTICK_BUTTON_L, DEFAULT_JOYSTICK_BUTTON_L);
88 config_set_d(CONFIG_JOYSTICK_BUTTON_R, DEFAULT_JOYSTICK_BUTTON_R);
89 config_set_d(CONFIG_JOYSTICK_BUTTON_EXIT, DEFAULT_JOYSTICK_BUTTON_EXIT);
90 config_set_d(CONFIG_JOYSTICK_CAMERA_1, DEFAULT_JOYSTICK_CAMERA_1);
91 config_set_d(CONFIG_JOYSTICK_CAMERA_2, DEFAULT_JOYSTICK_CAMERA_2);
92 config_set_d(CONFIG_JOYSTICK_CAMERA_3, DEFAULT_JOYSTICK_CAMERA_3);
93 config_set_d(CONFIG_KEY_CAMERA_1, DEFAULT_KEY_CAMERA_1);
94 config_set_d(CONFIG_KEY_CAMERA_2, DEFAULT_KEY_CAMERA_2);
95 config_set_d(CONFIG_KEY_CAMERA_3, DEFAULT_KEY_CAMERA_3);
96 config_set_d(CONFIG_KEY_CAMERA_R, DEFAULT_KEY_CAMERA_R);
97 config_set_d(CONFIG_KEY_CAMERA_L, DEFAULT_KEY_CAMERA_L);
98 config_set_d(CONFIG_VIEW_FOV, DEFAULT_VIEW_FOV);
99 config_set_d(CONFIG_VIEW_DP, DEFAULT_VIEW_DP);
100 config_set_d(CONFIG_VIEW_DC, DEFAULT_VIEW_DC);
101 config_set_d(CONFIG_VIEW_DZ, DEFAULT_VIEW_DZ);
102 config_set_s(CONFIG_PLAYER, DEFAULT_PLAYER);
103 config_set_s(CONFIG_BALL, DEFAULT_BALL);
104 config_set_s(CONFIG_COIN, DEFAULT_COIN);
107 void config_load(void)
109 FILE *fp;
111 if ((fp = fopen(config_user(USER_CONFIG_FILE), "r")))
113 char buf[MAXSTR];
114 char key[MAXSTR];
115 char val[MAXSTR];
117 while (fgets(buf, MAXSTR, fp))
118 if (sscanf(buf, "%s %s", key, val) == 2)
120 if (strcmp(key, "fullscreen") == 0)
121 config_set_d(CONFIG_FULLSCREEN, atoi(val));
122 else if (strcmp(key, "width") == 0)
123 config_set_d(CONFIG_WIDTH, atoi(val));
124 else if (strcmp(key, "height") == 0)
125 config_set_d(CONFIG_HEIGHT, atoi(val));
126 else if (strcmp(key, "stereo") == 0)
127 config_set_d(CONFIG_STEREO, atoi(val));
128 else if (strcmp(key, "camera") == 0)
129 config_set_d(CONFIG_CAMERA, atoi(val));
130 else if (strcmp(key, "textures") == 0)
131 config_set_d(CONFIG_TEXTURES, atoi(val));
132 else if (strcmp(key, "geometry") == 0)
133 config_set_d(CONFIG_GEOMETRY, atoi(val));
134 else if (strcmp(key, "reflection") == 0)
135 config_set_d(CONFIG_REFLECTION, atoi(val));
136 else if (strcmp(key, "background") == 0)
137 config_set_d(CONFIG_BACKGROUND, atoi(val));
138 else if (strcmp(key, "shadow") == 0)
139 config_set_d(CONFIG_SHADOW, atoi(val));
140 else if (strcmp(key, "audio_rate") == 0)
141 config_set_d(CONFIG_AUDIO_RATE, atoi(val));
142 else if (strcmp(key, "audio_buff") == 0)
143 config_set_d(CONFIG_AUDIO_BUFF, atoi(val));
144 else if (strcmp(key, "mouse_sense") == 0)
145 config_set_d(CONFIG_MOUSE_SENSE, atoi(val));
146 else if (strcmp(key, "mouse_invert") == 0)
147 config_set_d(CONFIG_MOUSE_INVERT, atoi(val));
148 else if (strcmp(key, "nice") == 0)
149 config_set_d(CONFIG_NICE, atoi(val));
150 else if (strcmp(key, "fps") == 0)
151 config_set_d(CONFIG_FPS, atoi(val));
152 else if (strcmp(key, "sound_volume") == 0)
153 config_set_d(CONFIG_SOUND_VOLUME, atoi(val));
154 else if (strcmp(key, "music_volume") == 0)
155 config_set_d(CONFIG_MUSIC_VOLUME, atoi(val));
156 else if (strcmp(key, "joystick") == 0)
157 config_set_d(CONFIG_JOYSTICK, atoi(val));
158 else if (strcmp(key, "joystick_device") == 0)
159 config_set_d(CONFIG_JOYSTICK_DEVICE, atoi(val));
160 else if (strcmp(key, "joystick_axis_x") == 0)
161 config_set_d(CONFIG_JOYSTICK_AXIS_X, atoi(val));
162 else if (strcmp(key, "joystick_axis_y") == 0)
163 config_set_d(CONFIG_JOYSTICK_AXIS_Y, atoi(val));
164 else if (strcmp(key, "joystick_button_a") == 0)
165 config_set_d(CONFIG_JOYSTICK_BUTTON_A, atoi(val));
166 else if (strcmp(key, "joystick_button_b") == 0)
167 config_set_d(CONFIG_JOYSTICK_BUTTON_B, atoi(val));
168 else if (strcmp(key, "joystick_button_r") == 0)
169 config_set_d(CONFIG_JOYSTICK_BUTTON_R, atoi(val));
170 else if (strcmp(key, "joystick_button_l") == 0)
171 config_set_d(CONFIG_JOYSTICK_BUTTON_L, atoi(val));
172 else if (strcmp(key, "joystick_button_exit") == 0)
173 config_set_d(CONFIG_JOYSTICK_BUTTON_EXIT, atoi(val));
174 else if (strcmp(key, "joystick_camera_1") == 0)
175 config_set_d(CONFIG_JOYSTICK_CAMERA_1, atoi(val));
176 else if (strcmp(key, "joystick_camera_2") == 0)
177 config_set_d(CONFIG_JOYSTICK_CAMERA_2, atoi(val));
178 else if (strcmp(key, "joystick_camera_3") == 0)
179 config_set_d(CONFIG_JOYSTICK_CAMERA_3, atoi(val));
180 else if (strcmp(key, "view_fov") == 0)
181 config_set_d(CONFIG_VIEW_FOV, atoi(val));
182 else if (strcmp(key, "view_dp") == 0)
183 config_set_d(CONFIG_VIEW_DP, atoi(val));
184 else if (strcmp(key, "view_dc") == 0)
185 config_set_d(CONFIG_VIEW_DC, atoi(val));
186 else if (strcmp(key, "view_dz") == 0)
187 config_set_d(CONFIG_VIEW_DZ, atoi(val));
189 else if (strcmp(key, "key_camera_1") == 0)
190 config_key(val, CONFIG_KEY_CAMERA_1, DEFAULT_KEY_CAMERA_1);
191 else if (strcmp(key, "key_camera_2") == 0)
192 config_key(val, CONFIG_KEY_CAMERA_2, DEFAULT_KEY_CAMERA_2);
193 else if (strcmp(key, "key_camera_3") == 0)
194 config_key(val, CONFIG_KEY_CAMERA_3, DEFAULT_KEY_CAMERA_3);
195 else if (strcmp(key, "key_camera_r") == 0)
196 config_key(val, CONFIG_KEY_CAMERA_R, DEFAULT_KEY_CAMERA_R);
197 else if (strcmp(key, "key_camera_l") == 0)
198 config_key(val, CONFIG_KEY_CAMERA_L, DEFAULT_KEY_CAMERA_L);
200 else if (strcmp(key, "player") == 0)
201 config_set_s(CONFIG_PLAYER, val);
202 else if (strcmp(key, "ball") == 0)
203 config_set_s(CONFIG_BALL, val);
204 else if (strcmp(key, "coin") == 0)
205 config_set_s(CONFIG_COIN, val);
208 fclose(fp);
212 void config_save(void)
214 FILE *fp;
216 if ((fp = fopen(config_user(USER_CONFIG_FILE), "w")))
218 fprintf(fp, "fullscreen %d\n",
219 option_d[CONFIG_FULLSCREEN]);
220 fprintf(fp, "width %d\n",
221 option_d[CONFIG_WIDTH]);
222 fprintf(fp, "height %d\n",
223 option_d[CONFIG_HEIGHT]);
224 fprintf(fp, "stereo %d\n",
225 option_d[CONFIG_STEREO]);
226 fprintf(fp, "camera %d\n",
227 option_d[CONFIG_CAMERA]);
228 fprintf(fp, "textures %d\n",
229 option_d[CONFIG_TEXTURES]);
230 fprintf(fp, "geometry %d\n",
231 option_d[CONFIG_GEOMETRY]);
232 fprintf(fp, "reflection %d\n",
233 option_d[CONFIG_REFLECTION]);
234 fprintf(fp, "background %d\n",
235 option_d[CONFIG_BACKGROUND]);
236 fprintf(fp, "shadow %d\n",
237 option_d[CONFIG_SHADOW]);
238 fprintf(fp, "audio_rate %d\n",
239 option_d[CONFIG_AUDIO_RATE]);
240 fprintf(fp, "audio_buff %d\n",
241 option_d[CONFIG_AUDIO_BUFF]);
242 fprintf(fp, "mouse_sense %d\n",
243 option_d[CONFIG_MOUSE_SENSE]);
244 fprintf(fp, "mouse_invert %d\n",
245 option_d[CONFIG_MOUSE_INVERT]);
246 fprintf(fp, "nice %d\n",
247 option_d[CONFIG_NICE]);
248 fprintf(fp, "fps %d\n",
249 option_d[CONFIG_FPS]);
250 fprintf(fp, "sound_volume %d\n",
251 option_d[CONFIG_SOUND_VOLUME]);
252 fprintf(fp, "music_volume %d\n",
253 option_d[CONFIG_MUSIC_VOLUME]);
254 fprintf(fp, "joystick %d\n",
255 option_d[CONFIG_JOYSTICK]);
256 fprintf(fp, "joystick_device %d\n",
257 option_d[CONFIG_JOYSTICK_DEVICE]);
258 fprintf(fp, "joystick_axis_x %d\n",
259 option_d[CONFIG_JOYSTICK_AXIS_X]);
260 fprintf(fp, "joystick_axis_y %d\n",
261 option_d[CONFIG_JOYSTICK_AXIS_Y]);
262 fprintf(fp, "joystick_button_a %d\n",
263 option_d[CONFIG_JOYSTICK_BUTTON_A]);
264 fprintf(fp, "joystick_button_b %d\n",
265 option_d[CONFIG_JOYSTICK_BUTTON_B]);
266 fprintf(fp, "joystick_button_r %d\n",
267 option_d[CONFIG_JOYSTICK_BUTTON_R]);
268 fprintf(fp, "joystick_button_l %d\n",
269 option_d[CONFIG_JOYSTICK_BUTTON_L]);
270 fprintf(fp, "joystick_button_exit %d\n",
271 option_d[CONFIG_JOYSTICK_BUTTON_EXIT]);
272 fprintf(fp, "joystick_camera_1 %d\n",
273 option_d[CONFIG_JOYSTICK_CAMERA_1]);
274 fprintf(fp, "joystick_camera_2 %d\n",
275 option_d[CONFIG_JOYSTICK_CAMERA_2]);
276 fprintf(fp, "joystick_camera_3 %d\n",
277 option_d[CONFIG_JOYSTICK_CAMERA_3]);
278 fprintf(fp, "view_fov %d\n",
279 option_d[CONFIG_VIEW_FOV]);
280 fprintf(fp, "view_dp %d\n",
281 option_d[CONFIG_VIEW_DP]);
282 fprintf(fp, "view_dc %d\n",
283 option_d[CONFIG_VIEW_DC]);
284 fprintf(fp, "view_dz %d\n",
285 option_d[CONFIG_VIEW_DZ]);
287 fprintf(fp, "key_camera_1 %s\n",
288 SDL_GetKeyName(option_d[CONFIG_KEY_CAMERA_1]));
289 fprintf(fp, "key_camera_2 %s\n",
290 SDL_GetKeyName(option_d[CONFIG_KEY_CAMERA_2]));
291 fprintf(fp, "key_camera_3 %s\n",
292 SDL_GetKeyName(option_d[CONFIG_KEY_CAMERA_3]));
293 fprintf(fp, "key_camera_r %s\n",
294 SDL_GetKeyName(option_d[CONFIG_KEY_CAMERA_R]));
295 fprintf(fp, "key_camrea_l %s\n",
296 SDL_GetKeyName(option_d[CONFIG_KEY_CAMERA_L]));
298 fprintf(fp, "player %s\n", option_s[CONFIG_PLAYER]);
299 fprintf(fp, "ball %s\n", option_s[CONFIG_BALL]);
300 fprintf(fp, "coin %s\n", option_s[CONFIG_COIN]);
302 fclose(fp);
306 /*---------------------------------------------------------------------------*/
308 int config_mode(int f, int w, int h)
310 int stereo = config_get_d(CONFIG_STEREO) ? 1 : 0;
311 int stencil = config_get_d(CONFIG_REFLECTION) ? 1 : 0;
313 SDL_GL_SetAttribute(SDL_GL_STEREO, stereo);
314 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencil);
316 /* Try to set the currently specified mode. */
318 if (SDL_SetVideoMode(w, h, 0, SDL_OPENGL | (f ? SDL_FULLSCREEN : 0)))
320 option_d[CONFIG_FULLSCREEN] = f;
321 option_d[CONFIG_WIDTH] = w;
322 option_d[CONFIG_HEIGHT] = h;
323 option_d[CONFIG_SHADOW] = (option_d[CONFIG_SHADOW] & glext_init());
325 glViewport(0, 0, w, h);
326 glClearColor(0.0f, 0.0f, 0.1f, 0.0f);
328 glEnable(GL_NORMALIZE);
329 glEnable(GL_CULL_FACE);
330 glEnable(GL_DEPTH_TEST);
331 glEnable(GL_TEXTURE_2D);
332 glEnable(GL_LIGHTING);
334 return 1;
337 /* If the mode failed, try it without stereo. */
339 else if (config_get_d(CONFIG_STEREO))
341 config_set_d(CONFIG_STEREO, 0);
342 return config_mode(f, w, h);
345 /* If that mode failed, try it without reflections. */
347 else if (config_get_d(CONFIG_REFLECTION))
349 config_set_d(CONFIG_REFLECTION, 0);
350 return config_mode(f, w, h);
353 /* If THAT mode failed, punt. */
355 return 0;
358 /*---------------------------------------------------------------------------*/
360 static char data_path[MAXSTR];
361 static char user_path[MAXSTR];
364 * Given a path and a file name relative to that path, create an
365 * absolute path name and return a temporary pointer to it.
367 static const char *config_file(const char *path, const char *file)
369 static char absolute[MAXSTR];
371 size_t d = strlen(path);
373 strncpy(absolute, path, MAXSTR - 1);
374 strncat(absolute, "/", MAXSTR - d - 1);
375 strncat(absolute, file, MAXSTR - d - 2);
377 return absolute;
380 static int config_test(const char *path, const char *file)
382 if (file)
384 FILE *fp;
386 if ((fp = fopen(config_file(path, file), "r")))
388 fclose(fp);
389 return 1;
391 return 0;
393 return 1;
396 const char *config_data(const char *file)
398 return config_file(data_path, file);
401 const char *config_user(const char *file)
403 return config_file(user_path, file);
406 /*---------------------------------------------------------------------------*/
409 * Attempt to find the game data directory. Search the command line
410 * paramater, the environment, and the hard-coded default, in that
411 * order. Confirm it by checking for presense of the named file.
413 int config_data_path(const char *path, const char *file)
415 char *dir;
417 if (path && config_test(path, file))
419 strncpy(data_path, path, MAXSTR);
420 return 1;
423 if ((dir = getenv("NEVERBALL_DATA")) && config_test(dir, file))
425 strncpy(data_path, dir, MAXSTR);
426 return 1;
429 if (CONFIG_DATA && config_test(CONFIG_DATA, file))
431 strncpy(data_path, CONFIG_DATA, MAXSTR);
432 return 1;
435 return 0;
439 * Determine the location of the user's home directory. Ensure there
440 * is a directory there for storing configuration, high scores, and
441 * replays.
443 * HACK: under Windows just assume the user has permission to write to
444 * the data directory. This is more reliable than trying to devine
445 * anything reasonable from the environment.
447 int config_user_path(const char *file)
449 #ifdef _WIN32
450 size_t d = strlen(CONFIG_USER);
452 strncpy(user_path, data_path, MAXSTR - 1);
453 strncat(user_path, "\\", MAXSTR - d - 1);
454 strncat(user_path, CONFIG_USER, MAXSTR - d - 2);
456 if ((mkdir(user_path) == 0) || (errno = EEXIST))
457 if (config_test(user_path, file))
458 return 1;
459 #else
460 char *dir;
462 if ((dir = getenv("HOME")))
464 size_t d = strlen(dir);
466 strncpy(user_path, getenv("HOME"), MAXSTR - 1);
467 strncat(user_path, "/", MAXSTR - d - 1);
468 strncat(user_path, CONFIG_USER, MAXSTR - d - 2);
471 if ((mkdir(user_path, 0777) == 0) || (errno = EEXIST))
472 if (config_test(user_path, file))
473 return 1;
474 #endif
476 return 0;
479 /*---------------------------------------------------------------------------*/
481 void config_set_d(int i, int d)
483 option_d[i] = d;
486 void config_tgl_d(int i)
488 option_d[i] = (option_d[i] ? 0 : 1);
491 int config_tst_d(int i, int d)
493 return (option_d[i] == d) ? 1 : 0;
496 int config_get_d(int i)
498 return option_d[i];
501 /*---------------------------------------------------------------------------*/
503 void config_set_s(int i, char *src)
505 int len = (int) strlen(src);
507 if (option_s[i])
508 free(option_s[i]);
510 if ((option_s[i] = (char *) malloc(len + 1)))
511 strncpy(option_s[i], src, len + 1);
514 void config_get_s(int i, char *dst, int len)
516 strncpy(dst, option_s[i], len);
519 /*---------------------------------------------------------------------------*/
521 static int grabbed = 0;
522 static int paused = 0;
524 void config_set_grab(void)
526 SDL_WM_GrabInput(SDL_GRAB_ON);
527 SDL_ShowCursor(SDL_DISABLE);
528 grabbed = 1;
531 void config_clr_grab(void)
533 SDL_WM_GrabInput(SDL_GRAB_OFF);
534 SDL_ShowCursor(SDL_ENABLE);
535 grabbed = 0;
538 int config_get_pause(void)
540 return paused;
543 void config_set_pause(void)
545 Mix_PauseMusic();
546 paused = 1;
548 if (grabbed)
550 SDL_ShowCursor(SDL_ENABLE);
551 SDL_WM_GrabInput(SDL_GRAB_OFF);
555 void config_clr_pause(void)
557 Mix_ResumeMusic();
558 paused = 0;
560 if (grabbed)
562 SDL_WM_GrabInput(SDL_GRAB_ON);
563 SDL_ShowCursor(SDL_DISABLE);
567 void config_tgl_pause(void)
569 if (paused)
570 config_clr_pause();
571 else
572 config_set_pause();
574 /*---------------------------------------------------------------------------*/
576 void config_push_persp(float fov, float n, float f)
578 GLdouble w = (GLdouble) option_d[CONFIG_WIDTH];
579 GLdouble h = (GLdouble) option_d[CONFIG_HEIGHT];
581 glMatrixMode(GL_PROJECTION);
583 glPushMatrix();
584 glLoadIdentity();
585 gluPerspective(fov, w / h, n, f);
587 glMatrixMode(GL_MODELVIEW);
590 void config_push_ortho(void)
592 GLdouble w = (GLdouble) option_d[CONFIG_WIDTH];
593 GLdouble h = (GLdouble) option_d[CONFIG_HEIGHT];
595 glMatrixMode(GL_PROJECTION);
597 glPushMatrix();
598 glLoadIdentity();
599 glOrtho(0.0, w, 0.0, h, -1.0, +1.0);
601 glMatrixMode(GL_MODELVIEW);
604 void config_pop_matrix(void)
606 glMatrixMode(GL_PROJECTION);
608 glPopMatrix();
610 glMatrixMode(GL_MODELVIEW);
613 void config_clear(void)
615 if (option_d[CONFIG_REFLECTION])
616 glClear(GL_COLOR_BUFFER_BIT |
617 GL_DEPTH_BUFFER_BIT |
618 GL_STENCIL_BUFFER_BIT);
619 else
620 glClear(GL_COLOR_BUFFER_BIT |
621 GL_DEPTH_BUFFER_BIT);
624 /*---------------------------------------------------------------------------*/