1 /*
2     XBlockOut a 3D Tetris
3 
4     Copyright (C) 1992,1993,1994,2001,2006  Thierry EXCOFFIER
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 1, or (at your option)
9     any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 
20     Contact: Thierry.EXCOFFIER@liris.univ-lyon1.fr
21 */
22 
23 struct opt
24 	{
25 	int verbose ;		/* Verbose mode 0=off */
26 	int newmap ;		/* Use a new colormap */
27 	int use_bw ;		/* Work in black and white */
28 	int buffering ;		/* Buffering mode */
29 	int statis ;		/* Display statistique at end game */
30 	int drawmode ; 		/* wire , solid , transparent */
31 	int wx,wy,wz ; 		/* World size */
32 	int smooth ;		/* Smooth drawing (hard if false) */
33 	int level ;		/* Start level of game */
34 	int mode ;		/* PLAY , TRAINING */
35 	int land ; 		/* USER,SMALL,BIG */
36 	int volume ;		/* Sound volume 0...10 */
37 	int speedtest ;		/* If set, test drawing speed */
38 	int clearline ;		/* 0 Useclear rectangle 1:use clear line */
39 	int linewidth ;		/* 0 fast, else : thickness */
40 	char thefont[256] ;	/* Font for texts */
41 	char thefont2[256] ;	/* Font for big texts */
42 	int button_height ;	/* Height of relief button */
43 	int keyboard ;		/* Key board type */
44 	char userkey[256] ;	/* User key map */
45 	char displayname[256] ;	/* Name of the display */
46 	char geometry[256] ;	/* Geometry of the game window */
47 	char menugeometry[256] ;/* Geometry of the menu window */
48 	char scoregeometry[256];/* Geometry of the score window */
49 	char zoogeometry[256];  /* Geometry of the zoo window */
50         int state ;             /* SHOW,STOP,SUSPEND,RUN,DEMO */
51 	int backcolor ;		/* background color for menu */
52 	int presskey ;		/* Supress the message presskey */
53 	int visual ;		/* If true, search a best visual */
54 	int time_to_demo ;	/* Number of seconds between demo */
55 	int Time_to_demo ;	/* current Number of seconds before demo */
56 	int fps ;		/* Number of frame by second, 0 : max */
57 	int stereo ;		/* Stereo */
58 	float eye_distance ;
59 	} ;
60 
61 #define STRCPY_SAFE(A,B)						\
62 do									\
63 {									\
64   if ( sizeof(A) == sizeof(int*) )					\
65     {									\
66       fprintf(stderr, "%s:%d There is a bug.\n", __FILE__, __LINE__) ;	\
67       exit(1) ;								\
68     }									\
69   else									\
70     if ( strlen(B) >= sizeof(A)-1 ) 					\
71       {									\
72 	fprintf(stderr, "%s:%d Buffer overflow\n", __FILE__, __LINE__) ;\
73 	exit(1) ;							\
74       }									\
75     else								\
76       strcpy(A, B) ;							\
77 }									\
78 while(0)
79