1 #ifndef	_global_h
2 #define	_global_h
3 
4 // Directory, in which to put the bitmap files for deluxe-playing
5 #ifndef DATA_DIRECTORY
6 #	define	DATA_DIRECTORY		"/tmp"
7 #endif
8 
9 // name of the file to look for static data of the classes
10 #define	PRESET_FILE			"presets.txt"
11 
12 #define	LOG_FILE				DATA_DIRECTORY"/logfile.txt"
13 
14 //
15 // FDS_TYPE should be a cast to the type that is needed for the filedescriptors
16 // mask in the select-call. Unfortunately I dont know how to examine this
17 // type automatically.
18 // (e.g. it has to be (int*) on HP-UX and can be left empty on linux-systems)
19 //
20 
21 // #define	FDS_TYPE				(int*)
22 
23 #ifndef FDS_TYPE
24 #	define FDS_TYPE
25 #endif
26 
27 //
28 // As an optimization, every DynObj gets a storage for caching the calculated
29 // collision-times with other objects. At the moment of a collision, only
30 // the 2 objects taking part in the collision have to update their cache
31 // and probably inform other objects about their changes.
32 #define	TIME_CACHE		1
33 
34 //
35 // The collision detection can be aborted at an early stage, when a minimum
36 // time can be estimated which lies beyond a limit.
37 // Problem: - The check, if to abort, already takes too much time.
38 //          - When time-caching is on, advanced collision times, which aren't
39 //            of any use at the moment of calculation, might be used later on.
40 #define	ABORT_CALC		0
41 #if (ABORT_CALC)
42 #	define	ABORT_CALC_WALL	0
43 #	define	ABORT_CALC_BALL	0
44 #endif
45 
46 //
47 // The basic floating point class can be exchanged between doubles and
48 // floats. The latter one is faster on my 386.
49 #ifndef __TURBOC__
50 #	define	REAL_IS_FLOAT	0
51 #else
52 #	define	REAL_IS_FLOAT	1
53 #endif
54 
55 //
56 // A real C++-Class can be used for real arithmetic. Unfortunately
57 // that really slows the calculation down, even though the whole class
58 // is defined inline.
59 #define	REAL_IS_CLASS	0
60 
61 //
62 // There are some specialized vector classes for 2 and 3 dimensionaL
63 // vectors, which can also be realized by inheriting from an universaL
64 // vector-class (but again, that's expensive)
65 #define	Vec2IsVector	0
66 #define	Vec3IsVector	0
67 
68 //
69 // Switch to pre-existing (better to understand) algorithms for
70 // collision detection, instead of the special algortithm (which is
71 // a bit faster).
72 #define	EasyWall		0
73 
74 //
75 // special constants instead of the collision time
76 #define	MAX_TIME				1e10
77 #define	NO_HIT				MAX_TIME
78 #define	NO_TARGET			MAX_TIME
79 #define	RUNNING_LOSE		4e10
80 #if (ABORT_CALC)
81 #	define	NOT_REACHABLE	2e10
82 #endif
83 
84 //
85 // constants to overcome the problem with unprecise real-arithmetics
86 #if (REAL_IS_FLOAT)
87 #	define	EPS		 	1e-4
88 #else
89 #	define	EPS		 	1e-10
90 #endif
91 
92 //
93 // current time in calculation
94 // not to mix up with the realtime of GetCurrentTime()
95 //
96 extern double	current_time;
97 
98 #ifndef __TURBOC__
99 #	define	_DEBUG
100 #endif
101 //
102 // debugging switches, the main switch DEBUG enables all successive
103 // options, mainly leading to traces on stdout
104 #ifdef DEBUG
105 
106 #include <stdio.h>
107 #include <stdlib.h>
108 #include <string.h>
109 
110 extern long		debug;				// Variable der anzuzeigenden modes
111 #define	ShowLight			0x00000001L
112 #define	ShowColors			0x00000002L
113 #define	ShowRings			0x00000004L
114 #define	ObjectInfo			0x00000008L
115 #define	BeforCollision		0x00000010L
116 #define	AfterCollision		0x00000020L
117 #define	CheckBoundary		0x00000040L
118 #define	MoveAll				0x00000080L
119 #define	__Moves				0x000000f8L
120 #define	PBallHit				0x00000100L
121 #define	PointerMove			0x00000200L
122 #define	XWallHit          0x00000400L
123 #define	YWallHit				0x00000800L
124 #define	CollCalc				0x00001000L
125 #define	AbortCalc			0x00002000L
126 #define	AbortReCalc			0x00004000L
127 #define	StickLevel			0x00008000L
128 #define	GameState			0x00010000L
129 #define	BMover				0x00020000L
130 #define	BState				0x00040000L
131 #define	Sync					0x00080000L
132 #define	ShowTurns			0x00100000L
133 #define	Loops					0x00200000L
134 #define	__ShowAll			0x00100007L
135 #define	__Rings				0x00100004L
136 #define	Intro					0x00400000L
137 #define	xdb               0x00800000L
138 #define	xwd               0x02000000L
139 #define  ForceCalc         0x01000000L
140 #define  Motion				0x04000000L
141 
142 #define	TCTrace				0x40000000L
143 #define	UnixTrace			0x80000000L
144 
145 #define	ShowSubWindow		(ShowLight|ShowColors|ShowRings|ShowTurns)
146 
147 #define	DBG0(m,f)			if (debug&m)	printf( f )
148 #define	DBG1(m,f,a)			if (debug&m)	printf( f,a )
149 #define	DBG2(m,f,a,b)		if (debug&m)	printf( f,a,b )
150 #define	DBG3(m,f,a,b,c)	if (debug&m)	printf( f,a,b,c )
151 #define	DBG4(m,f,a,b,c,d)	if (debug&m)	printf( f,a,b,c,d )
152 
153 int set_debug( const char *flag_name );
154 void show_flags();
155 
156 #else
157 
158 #define	DBG0(m,f)
159 #define	DBG1(m,f,a)
160 #define	DBG2(m,f,a,b)
161 #define	DBG3(m,f,a,b,c)
162 #define	DBG4(m,f,a,b,c,d)
163 
164 #endif
165 
166 #include "stdinc.h"
167 
168 //
169 // F�r Zeitmessungen kann das Zeichnen der sich bewegenden B�lle komplett
170 // unterdr�ckt werden, indem die DrawCircle()-Funktion durch eine leere
171 // Funktion ersetzt wird.
172 #ifdef DEBUG
173 #	define	STATISTICS
174 #endif
175 #define	_NO_DRAW
176 
177 //
178 // Reibungsimplementierung, in dem schrittweise
179 // die Geschwindigkeit verkleinert wird. Das Problem ist allerdings, das mit
180 // jedem Schritt die Zeiten des TIME-CACHE ung�ltig werden, und daher
181 // nicht zu viele Schritte pro Sekunden eingelegt werden sollten.
182 // Die Parametrierung der Reibung und der Aufl�sung der Schrittberechnung
183 // geschieht durch virtuelle Funktionen der Game-Klasse
184 //
185 // Einschalten der Reibungssimulation durch stufige Verlangsamung:
186 #define SIM_SLOW				1
187 
188 #if (SIM_SLOW)
189 #	define	SUPPRESS_SLOWSTEP		-1.0
190 #endif
191 
192 
193 // ===========================================================================
194 //   'Wissenswertes' aus verschiedenen Bereichen (reduziert Abh�ngigkeiten)
195 // ===========================================================================
196 
197 extern double w2n;					// Fensterskalierung				(graph.C)
198 
199 typedef long ColorId;
200 
201 
202 #define	SOUND_SUBSYSTEM	1
203 #if (SOUND_SUBSYSTEM)
204 extern	int sound_request;	// sound einschalten							(main.C)
205 #endif
206 extern	int size;				// gew�nschte (aktuelle) Fenstergr��e	(main.C)
207 extern	int deluxe;				// Luxus-Flag                          (main.C)
208 extern	int light_flag;		// Light-Sources								(main.C)
209 extern	int color_flag;		// table color									(main.C)
210 extern	int nohint_flag;		// aiming hint									(main.C)
211 extern	int enhanced_mover;	// flag for desired mover class        (main.C)
212 extern	int frames_per_sec;	// flag for limited frames             (main.C)
213 
214 extern	int no_server_grabs; // never grab server                   (main.C)
215 extern	int no_override;		// pseudo root as normal window        (main.C)
216 
217 #define	ON_ROOT		-1
218 
219 
220 void show_defaults();
221 void load_konfi();
222 
223 #endif
224