1 /*
2  *
3  *   Copyright (c) 1994, 2002, 2003  Johannes Prix
4  *   Copyright (c) 1994, 2002, 2003  Reinhard Prix
5  *
6  *
7  *  This file is part of Freedroid
8  *
9  *  Freedroid is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  Freedroid is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with Freedroid; see the file COPYING. If not, write to the
21  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22  *  MA  02111-1307  USA
23  *
24  */
25 
26 
27 #ifndef _global_h
28 #define _global_h
29 
30 #include "system.h"
31 #include "BFont.h"
32 #include "takeover.h"
33 
34 #undef EXTERN
35 #ifdef _main_c
36 #define EXTERN
37 #else
38 #define EXTERN extern
39 #endif
40 
41 extern char ConfigDir[255];
42 
43 EXTERN SDL_Rect OrigBlock_Rect;
44 EXTERN SDL_Rect Block_Rect;
45 EXTERN SDL_Rect Screen_Rect;
46 EXTERN SDL_Rect User_Rect;
47 EXTERN SDL_Rect Classic_User_Rect;
48 EXTERN SDL_Rect Full_User_Rect;
49 EXTERN SDL_Rect Banner_Rect;
50 EXTERN SDL_Rect Portrait_Rect;
51 EXTERN SDL_Rect Cons_Droid_Rect;
52 EXTERN SDL_Rect Menu_Rect;
53 EXTERN SDL_Rect OptionsMenu_Rect;
54 EXTERN SDL_Rect OrigDigit_Rect;
55 EXTERN SDL_Rect Digit_Rect;
56 EXTERN SDL_Rect FirstDigit_Rect;
57 EXTERN SDL_Rect SecondDigit_Rect;
58 EXTERN SDL_Rect ThirdDigit_Rect;
59 
60 EXTERN SDL_Rect Cons_Header_Rect;
61 EXTERN SDL_Rect Cons_Menu_Rect;
62 EXTERN SDL_Rect Cons_Text_Rect;
63 EXTERN SDL_Rect Cons_Menu_Rects[4];
64 
65 EXTERN SDL_Rect LeftInfo_Rect;
66 EXTERN SDL_Rect RightInfo_Rect;
67 
68 EXTERN SDL_Rect ConsMenuItem_Rect;
69 
70 
71 EXTERN float LastRefreshSound;
72 EXTERN float LastGotIntoBlastSound;
73 extern float FPSover1;
74 extern float FPSover10;
75 extern float FPSover100;
76 EXTERN char *Alertcolor[AL_LAST];
77 EXTERN char *Shipnames[ALLSHIPS];
78 
79 EXTERN char *Classname[];
80 EXTERN char *Classes[];
81 EXTERN char *Weaponnames[];
82 EXTERN char *Sensornames[];
83 EXTERN char *Brainnames[];
84 EXTERN char *Drivenames[];
85 EXTERN char *InfluenceModeNames[];
86 EXTERN int ThisMessageTime;
87 
88 EXTERN influence_t Me;		/* the influence data */
89 EXTERN Druidspec Druidmap;
90 EXTERN Bulletspec Bulletmap;
91 EXTERN blastspec Blastmap[ALLBLASTTYPES];
92 
93 EXTERN int Number_Of_Droid_Types;
94 EXTERN int PreTakeEnergy;
95 EXTERN int QuitProgram;
96 EXTERN int GameOver;
97 EXTERN int InvincibleMode;
98 EXTERN int HideInvisibleMap;
99 EXTERN int AlertLevel;
100 EXTERN int AlertThreshold; // threshold for FIRST Alert-color (yellow), the others are 2*, 3*..
101 EXTERN float AlertBonusPerSec; // bonus/sec for FIRST Alert-color, the others are 2*, 3*,...
102 EXTERN float DeathCount;   // a cumulative/draining counter of kills->determines Alert!
103 EXTERN float DeathCountDrainSpeed;  // drain per second
104 EXTERN float RealScore;
105 EXTERN long ShowScore;
106 
107 EXTERN enemy AllEnemys[MAX_ENEMYS_ON_SHIP];
108 
109 EXTERN int NumEnemys;
110 
111 EXTERN Level CurLevel;		/* the current level data */
112 EXTERN ship curShip;		/* the current ship-data */
113 
114 EXTERN bullet AllBullets[MAXBULLETS + 10];
115 EXTERN blast AllBlasts[MAXBLASTS + 10];
116 
117 EXTERN int sound_on;		/* Toggle TRUE/FALSE for turning sounds on/off */
118 EXTERN int debug_level;       	/* 0=no debug 1=some debug messages 2=...etc */
119 				/* (currently only 0 or !=0 is implemented) */
120 EXTERN int show_all_droids;     /* display enemys regardless of IsVisible() */
121 EXTERN int stop_influencer;     /* for bullet debugging: stop where u are */
122 
123 #undef EXTERN
124 #ifdef _misc_c
125 #define EXTERN
126 #else
127 #define EXTERN extern
128 #endif
129 EXTERN float Time_For_Each_Phase_Of_Door_Movement;
130 EXTERN float Blast_Damage_Per_Second;
131 EXTERN float Blast_Radius;
132 EXTERN float Droid_Radius;
133 EXTERN float LevelDoorsNotMovedTime;
134 EXTERN float collision_lose_energy_calibrator;
135 EXTERN config_t GameConfig;
136 EXTERN float CurrentCombatScaleFactor;
137 EXTERN BFont_Info *Menu_BFont;
138 EXTERN BFont_Info *Para_BFont;
139 EXTERN BFont_Info *FPS_Display_BFont;
140 EXTERN BFont_Info *Highscore_BFont;
141 EXTERN int SkipAFewFrames;
142 
143 #undef EXTERN
144 #ifdef _view_c
145 #define EXTERN
146 #else
147 #define EXTERN extern
148 #endif
149 EXTERN SDL_Color Black;
150 
151 #undef EXTERN
152 #ifdef _sound_c
153 #define EXTERN
154 #else
155 #define EXTERN extern
156 #endif
157 
158 #undef EXTERN
159 #ifdef _graphics_c
160 #define EXTERN
161 #else
162 #define EXTERN extern
163 #endif
164 EXTERN themelist_t AllThemes;
165 EXTERN SDL_Cursor *crosshair_cursor;
166 EXTERN SDL_Cursor  *arrow_cursor;
167 EXTERN int Number_Of_Bullet_Types;
168 EXTERN SDL_Surface *ne_screen;   /* the graphics display */
169 
170 EXTERN SDL_Surface *EnemySurfacePointer[ ENEMYPHASES ];   // A pointer to the surfaces containing the pictures of the
171                                                // enemys in different phases of rotation
172 EXTERN SDL_Surface *InfluencerSurfacePointer[ ENEMYPHASES ];   // A pointer to the surfaces containing the pictures of the
173                                                // influencer in different phases of rotation
174 EXTERN SDL_Surface *InfluDigitSurfacePointer[ DIGITNUMBER ];   // A pointer to the surfaces containing the pictures of the
175                                                // influencer in different phases of rotation
176 EXTERN SDL_Surface *EnemyDigitSurfacePointer[ DIGITNUMBER ];   // A pointer to the surfaces containing the pictures of the
177                                                // influencer in different phases of rotation
178 EXTERN SDL_Surface *MapBlockSurfacePointer[ NUM_COLORS ][ NUM_MAP_BLOCKS ];   // A pointer to the surfaces containing the map-pics, which may be rescaled with respect to
179 EXTERN SDL_Surface *OrigMapBlockSurfacePointer[ NUM_COLORS ][ NUM_MAP_BLOCKS ];   // A pointer to the surfaces containing the original map-pics as read from disk
180 EXTERN SDL_Surface *BuildBlock;			// a block for temporary pic-construction
181 
182 EXTERN int BannerIsDestroyed;
183 
184 EXTERN int screen_bpp; 			/* bits per pixel */
185 
186 EXTERN SDL_Surface *banner_pic;      /* the banner pic */
187 EXTERN SDL_Surface *pic999;
188 EXTERN SDL_RWops *packed_portraits[NUM_DROIDS];
189 
190 EXTERN SDL_Surface *Decal_pics[NUM_DECAL_PICS];
191 
192 EXTERN SDL_Surface *takeover_bg_pic;
193 EXTERN SDL_Surface *console_pic;
194 EXTERN SDL_Surface *console_bg_pic1;
195 EXTERN SDL_Surface *console_bg_pic2;
196 
197 EXTERN SDL_Surface *arrow_up;
198 EXTERN SDL_Surface *arrow_down;
199 EXTERN SDL_Surface *arrow_right;
200 EXTERN SDL_Surface *arrow_left;
201 
202 EXTERN SDL_Surface *ship_off_pic;    	/* Side-view of ship: lights off */
203 EXTERN SDL_Surface *ship_on_pic;	/* Side-view of ship: lights on */
204 
205 EXTERN SDL_Rect level_rect[MAX_LEVELS]; /* rect's of levels in side-view */
206 EXTERN SDL_Rect liftrow_rect[MAX_LIFT_ROWS]; /* the lift-row rect's in side-view*/
207 
208 
209 #undef EXTERN
210 #ifdef _text_c
211 #define EXTERN
212 #else
213 #define EXTERN extern
214 #endif
215 
216 #undef EXTERN
217 #ifdef _input_c
218 #define EXTERN
219 #else
220 #define EXTERN extern
221 #endif
222 EXTERN SDL_Joystick *joy;
223 EXTERN int joy_num_axes; /* number of joystick axes */
224 EXTERN int joy_sensitivity;
225 EXTERN point input_axis;  /* joystick (and mouse) axis values */
226 EXTERN int axis_is_active;  /* is firing to use axis-values or not */
227 EXTERN Uint32 last_mouse_event; // SDL-ticks of last mouse event
228 
229 #undef EXTERN
230 #ifdef _highscore_c
231 #define EXTERN
232 #else
233 #define EXTERN extern
234 #endif
235 EXTERN highscore_entry **Highscores;
236 EXTERN int num_highscores;  /* total number of entries in our list (fixed) */
237 
238 #undef EXTERN
239 #ifdef _takeover_c
240 #define EXTERN
241 #else
242 #define EXTERN extern
243 #endif
244 EXTERN SDL_Surface *to_blocks;      /* the global surface containing all game-blocks */
245 /* the rectangles containing the blocks */
246 EXTERN SDL_Rect FillBlocks[NUM_FILL_BLOCKS];
247 EXTERN SDL_Rect CapsuleBlocks[NUM_CAPS_BLOCKS];
248 EXTERN SDL_Rect ToGameBlocks[NUM_TO_BLOCKS];
249 EXTERN SDL_Rect ToGroundBlocks[NUM_GROUND_BLOCKS];
250 EXTERN SDL_Rect ToColumnBlock;
251 EXTERN SDL_Rect ToLeaderBlock;
252 
253 
254 EXTERN point LeftCapsulesStart[TO_COLORS];
255 EXTERN point CurCapsuleStart[TO_COLORS];
256 EXTERN point PlaygroundStart[TO_COLORS];
257 EXTERN point DruidStart[TO_COLORS];
258 EXTERN point TO_LeftGroundStart;
259 EXTERN point TO_RightGroundStart;
260 EXTERN point TO_ColumnStart;
261 EXTERN point TO_LeaderBlockStart;
262 
263 EXTERN SDL_Rect TO_LeaderLed;
264 EXTERN SDL_Rect TO_FillBlock;
265 EXTERN SDL_Rect TO_ElementRect;
266 EXTERN SDL_Rect TO_CapsuleRect;
267 EXTERN SDL_Rect TO_GroundRect;
268 EXTERN SDL_Rect TO_ColumnRect;
269 
270 #endif  // _global_h
271