1 /* 2 * 3 * Copyright (c) 1994, 2002, 2003 Johannes Prix 4 * Copyright (c) 1994, 2002 Reinhard Prix 5 * Copyright (c) 2004-2007 Arthur Huillet 6 * 7 * 8 * This file is part of Freedroid 9 * 10 * Freedroid is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * Freedroid is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Freedroid; see the file COPYING. If not, write to the 22 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 23 * MA 02111-1307 USA 24 * 25 */ 26 27 #ifndef _global_h 28 #define _global_h 29 30 #include "BFont.h" 31 #include "lists.h" 32 33 extern char *freedroid_version; 34 35 #undef EXTERN 36 #ifdef _main_c 37 #define EXTERN 38 #else 39 #define EXTERN extern 40 #endif 41 42 EXTERN float FPSover1; 43 EXTERN char *AllSkillTexts[]; 44 EXTERN char font_switchto_red[]; 45 EXTERN char font_switchto_blue[]; 46 EXTERN char font_switchto_neon[]; 47 EXTERN char font_switchto_msgstat[]; 48 EXTERN char font_switchto_msgvar[]; 49 50 EXTERN float MeleeDamageMultiplierTable[]; 51 EXTERN float MeleeRechargeMultiplierTable[]; 52 EXTERN float RangedDamageMultiplierTable[]; 53 EXTERN float RangedRechargeMultiplierTable[]; 54 EXTERN spell_skill_spec *SpellSkillMap; 55 EXTERN tux_t Me; /* the influence data */ 56 EXTERN droidspec *Droidmap; 57 EXTERN blastspec Blastmap[ALLBLASTTYPES]; 58 EXTERN int skip_initial_menus; 59 EXTERN int number_of_skills; 60 EXTERN int last_bot_number; 61 EXTERN enum _game_status game_status; 62 63 EXTERN SDL_Rect User_Rect; 64 EXTERN SDL_Rect Full_User_Rect; 65 EXTERN SDL_Rect Cons_Text_Rect; 66 67 extern char *our_homedir; 68 extern char *our_config_dir; 69 extern int term_has_color_cap; 70 extern int run_from_term; 71 72 EXTERN int Number_Of_Droid_Types; 73 EXTERN int QuitProgram; 74 EXTERN int GameOver; 75 EXTERN int quest_browser_activated; 76 77 extern list_head_t alive_bots_head; 78 extern list_head_t dead_bots_head; 79 extern list_head_t level_bots_head[MAX_LEVELS]; 80 81 EXTERN spell_active AllActiveSpells[MAX_ACTIVE_SPELLS]; 82 EXTERN ship curShip; /* the current ship-data */ 83 84 EXTERN bullet AllBullets[MAXBULLETS + 10]; 85 EXTERN melee_shot AllMeleeShots[MAX_MELEE_SHOTS]; 86 EXTERN blast AllBlasts[MAXBLASTS + 10]; 87 88 EXTERN int sound_on; // Toggle TRUE/FALSE for turning sounds on/off 89 EXTERN int debug_level; // 0=no debug 1=some debug messages 2=...etc 90 // (currently only 0 or !=0 is implemented) 91 EXTERN int show_all_droids; // display enemies regardless of IsVisible() 92 EXTERN int draw_collision_rectangles; // to better debug collision rectangles 93 EXTERN int start_editor; 94 EXTERN int load_saved; 95 EXTERN char *saved_game_name; 96 97 EXTERN FPSmanager SDL_FPSmanager; 98 99 #undef EXTERN 100 #ifdef _misc_c 101 #define EXTERN 102 #else 103 #define EXTERN extern 104 #endif 105 106 EXTERN float timeout_from_item_drop; 107 EXTERN int use_open_gl; 108 #ifdef DEBUG_QUAD_BORDER 109 EXTERN unsigned int debug_quad_border_seed; 110 #endif 111 112 EXTERN mouse_press_button AllMousePressButtons[MAX_MOUSE_PRESS_BUTTONS]; 113 EXTERN item *item_held_in_hand; 114 115 EXTERN struct image MouseCursorImageList[NUMBER_OF_MOUSE_CURSOR_PICTURES]; 116 117 EXTERN int Number_Of_Droids_On_Ship; 118 EXTERN configuration_for_freedroid GameConfig; 119 EXTERN float Overall_Average; 120 EXTERN int SkipAFewFrames; 121 EXTERN struct data_dir data_dirs[]; 122 123 #undef EXTERN 124 #ifdef _view_c 125 #define EXTERN 126 #else 127 #define EXTERN extern 128 #endif 129 EXTERN struct image light_radius_chunk[NUMBER_OF_SHADOW_IMAGES]; 130 EXTERN SDL_Rect InventoryRect; 131 EXTERN SDL_Rect CharacterRect; 132 #ifdef HAVE_LIBGL 133 EXTERN GLuint automap_texture; // this is to store an open_gl texture... 134 EXTERN GLuint light_radius_stretch_texture; // this is to store an open_gl texture... 135 EXTERN SDL_Surface *light_radius_stretch_surface; 136 #endif 137 EXTERN int amask; 138 EXTERN int gmask; 139 EXTERN int bmask; 140 EXTERN int rmask; 141 142 struct neighbor_data_cell { 143 int delta_x; 144 int delta_y; 145 int lvl_idx; 146 int valid; 147 }; 148 EXTERN struct neighbor_data_cell gps_transform_matrix[MAX_LEVELS][MAX_LEVELS]; 149 EXTERN struct neighbor_data_cell *(level_neighbors_map[MAX_LEVELS][3][3]); 150 EXTERN list_head_t visible_level_list; 151 EXTERN int gps_transform_map_dirty_flag; 152 153 #define NEIGHBOR_IDX(x,len) ( ( (x) < 0) ? (0) : ( ( (x) < (len) ) ? (1) : (2) ) ) 154 #define NEIGHBOR_ID(lvl, x, y) (level_neighbors_map[lvl][y][x] ? level_neighbors_map[lvl][y][x]->lvl_idx : -1) 155 #define NEIGHBOR_ID_NW(lvl) NEIGHBOR_ID(lvl, 0, 0) 156 #define NEIGHBOR_ID_N(lvl) NEIGHBOR_ID(lvl, 1, 0) 157 #define NEIGHBOR_ID_NE(lvl) NEIGHBOR_ID(lvl, 2, 0) 158 #define NEIGHBOR_ID_W(lvl) NEIGHBOR_ID(lvl, 0, 1) 159 #define NEIGHBOR_ID_E(lvl) NEIGHBOR_ID(lvl, 2, 1) 160 #define NEIGHBOR_ID_SW(lvl) NEIGHBOR_ID(lvl, 0, 2) 161 #define NEIGHBOR_ID_S(lvl) NEIGHBOR_ID(lvl, 1, 2) 162 #define NEIGHBOR_ID_SE(lvl) NEIGHBOR_ID(lvl, 2, 2) 163 164 EXTERN struct tux_rendering tux_rendering; 165 EXTERN int clickable_obstacle_under_cursor; 166 167 #undef EXTERN 168 #ifdef _light_c 169 #define EXTERN 170 #else 171 #define EXTERN extern 172 #endif 173 EXTERN light_radius_config LightRadiusConfig; 174 175 #undef EXTERN 176 #ifdef _sound_c 177 #define EXTERN 178 #else 179 #define EXTERN extern 180 #endif 181 182 #undef EXTERN 183 #ifdef _enemy_c 184 #define EXTERN 185 #else 186 #define EXTERN extern 187 #endif 188 189 #undef EXTERN 190 #ifdef _graphics_c 191 #define EXTERN 192 #else 193 #define EXTERN extern 194 #endif 195 EXTERN SDL_Surface *Screen; 196 EXTERN SDL_Surface *StoredMenuBackground[2]; 197 EXTERN int mouse_cursor; 198 #ifdef HAVE_LIBGL 199 EXTERN GLuint StoredMenuBackgroundTex[2]; 200 #endif 201 202 //-------------------- 203 // Now the iso-image pointers for the new individually shaped 204 // isometric enemy images 205 // 206 EXTERN struct image enemy_images[ENEMY_ROTATION_MODELS_AVAILABLE][ROTATION_ANGLES_PER_ROTATION_MODEL][MAX_ENEMY_MOVEMENT_PHASES]; 207 EXTERN struct image chat_portrait_of_droid[ENEMY_ROTATION_MODELS_AVAILABLE]; 208 209 // EXTERN int phases_in_enemy_animation [ ENEMY_ROTATION_MODELS_AVAILABLE ]; 210 EXTERN int first_walk_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 211 EXTERN int last_walk_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 212 EXTERN int first_attack_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 213 EXTERN int last_attack_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 214 EXTERN int first_gethit_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 215 EXTERN int last_gethit_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 216 EXTERN int first_death_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 217 EXTERN int last_death_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 218 EXTERN int first_stand_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 219 EXTERN int last_stand_animation_image[ENEMY_ROTATION_MODELS_AVAILABLE]; 220 EXTERN int droid_walk_animation_speed_factor[ENEMY_ROTATION_MODELS_AVAILABLE]; 221 EXTERN int droid_attack_animation_speed_factor[ENEMY_ROTATION_MODELS_AVAILABLE]; 222 EXTERN int droid_gethit_animation_speed_factor[ENEMY_ROTATION_MODELS_AVAILABLE]; 223 EXTERN int droid_death_animation_speed_factor[ENEMY_ROTATION_MODELS_AVAILABLE]; 224 EXTERN int droid_stand_animation_speed_factor[ENEMY_ROTATION_MODELS_AVAILABLE]; 225 226 EXTERN struct tux_motion_class_images *tux_images; 227 EXTERN struct dynarray obstacle_images; 228 229 EXTERN float iso_floor_tile_width; 230 EXTERN float iso_floor_tile_height; 231 EXTERN float iso_floor_tile_width_over_two; 232 EXTERN float iso_floor_tile_height_over_two; 233 EXTERN int vid_bpp; // bits per pixel 234 235 #undef EXTERN 236 #ifdef _hud_c 237 #define EXTERN 238 #else 239 #define EXTERN extern 240 #endif 241 EXTERN struct widget_text *message_log; 242 243 #undef EXTERN 244 #ifdef _blocks_c 245 #define EXTERN 246 #else 247 #define EXTERN extern 248 #endif 249 EXTERN struct dynarray obstacle_map; 250 EXTERN struct dynarray underlay_floor_tiles; 251 EXTERN struct dynarray overlay_floor_tiles; 252 EXTERN char *PrefixToFilename[ENEMY_ROTATION_MODELS_AVAILABLE]; 253 254 #undef EXTERN 255 #ifdef _text_c 256 #define EXTERN 257 #else 258 #define EXTERN extern 259 #endif 260 EXTERN SDL_Rect Droid_Image_Window; 261 262 #undef EXTERN 263 #ifdef _text_public_c 264 #define EXTERN 265 #else 266 #define EXTERN extern 267 #endif 268 269 #undef EXTERN 270 #ifdef _leveleditor_c 271 #define EXTERN 272 #else 273 #define EXTERN extern 274 #endif 275 276 #undef EXTERN 277 #ifdef _input_c 278 #define EXTERN 279 #else 280 #define EXTERN extern 281 #endif 282 EXTERN point input_axis; /* joystick (and mouse) axis values */ 283 284 #undef EXTERN 285 #ifdef _takeover_c 286 #define EXTERN 287 #else 288 #define EXTERN extern 289 #endif 290 291 #undef EXTERN 292 #ifdef _skills_c 293 #define EXTERN 294 #else 295 #define EXTERN extern 296 #endif 297 298 EXTERN SDL_Rect SkillScreenRect; 299 300 #undef EXTERN 301 #ifdef _items_c 302 #define EXTERN 303 #else 304 #define EXTERN extern 305 #endif 306 307 EXTERN int Number_Of_Item_Types; 308 EXTERN itemspec *ItemMap; 309 EXTERN short int item_count_per_class[MAX_DROP_CLASS + 1]; 310 311 EXTERN int game_root_mode; 312 enum { 313 ROOT_IS_UNKNOWN = 0, 314 ROOT_IS_GAME, 315 ROOT_IS_LVLEDIT, 316 }; 317 318 #undef EXTERN 319 #ifdef _obstacle_c 320 #define EXTERN 321 #else 322 #define EXTERN extern 323 #endif 324 325 EXTERN struct dynarray obstacle_groups; 326 327 #undef EXTERN 328 #ifdef _saveloadgame_c 329 #define EXTERN 330 #else 331 #define EXTERN extern 332 #endif 333 EXTERN struct auto_string *savestruct_autostr; 334 EXTERN jmp_buf saveload_jmpbuf; 335 336 #undef EXTERN 337 #ifdef _benchmark_c 338 #define EXTERN 339 #else 340 #define EXTERN extern 341 #endif 342 EXTERN char *do_benchmark; 343 344 #undef EXTERN 345 #ifdef _npc_c 346 #define EXTERN 347 #else 348 #define EXTERN extern 349 #endif 350 351 EXTERN list_head_t npc_head; 352 353 #undef EXTERN 354 #ifdef _game_ui_c 355 #define EXTERN 356 #else 357 #define EXTERN extern 358 #endif 359 EXTERN struct widget_button *game_map; 360 361 #undef EXTERN 362 #ifdef _influ_c 363 #define EXTERN 364 #else 365 #define EXTERN extern 366 #endif 367 368 EXTERN struct { 369 int standing_keyframe; 370 struct timebased_animation attack; 371 struct distancebased_animation walk; 372 struct distancebased_animation run; 373 } tux_anim; 374 375 #define IMAGE_SCALE_RGB_TRANSFO(SCALE, R, G, B) set_image_transformation(SCALE, SCALE, R, G, B, 1.0, 0) 376 #define IMAGE_SCALE_TRANSFO(SCALE) IMAGE_SCALE_RGB_TRANSFO(SCALE, 1.0, 1.0, 1.0) 377 #define IMAGE_NO_TRANSFO IMAGE_SCALE_TRANSFO(1.0) 378 379 #undef EXTERN 380 #ifdef _bullet_c 381 #define EXTERN 382 #else 383 #define EXTERN extern 384 #endif 385 386 EXTERN struct dynarray bullet_specs; 387 388 #undef EXTERN 389 #ifdef _lang_c 390 #define EXTERN 391 #else 392 #define EXTERN extern 393 #endif 394 395 EXTERN struct dynarray lang_specs; 396 EXTERN struct dynarray lang_codesets; 397 398 #undef EXTERN 399 #ifdef _init_c 400 #define EXTERN 401 #else 402 #define EXTERN extern 403 #endif 404 405 EXTERN struct dynarray difficulties; 406 407 #undef EXTERN 408 #ifdef _font_c 409 #define EXTERN 410 #else 411 #define EXTERN extern 412 #endif 413 EXTERN struct font *Menu_Font; 414 EXTERN struct font *Messagevar_Font; 415 EXTERN struct font *Messagestat_Font; 416 EXTERN struct font *Para_Font; 417 EXTERN struct font *FPS_Display_Font; 418 EXTERN struct font *Blue_Font; 419 EXTERN struct font *Red_Font; 420 EXTERN struct font *Messagered_Font; 421 422 #undef EXTERN 423 #ifdef _colldet_c 424 #define EXTERN 425 #else 426 #define EXTERN extern 427 #endif 428 EXTERN colldet_filter WalkablePassFilter; 429 EXTERN colldet_filter WalkableWithMarginPassFilter; 430 EXTERN colldet_filter FlyablePassFilter; 431 EXTERN colldet_filter VisiblePassFilter; 432 EXTERN colldet_filter ObstacleByIdPassFilter; 433 EXTERN colldet_filter WalkableExceptIdPassFilter; 434 EXTERN colldet_filter FlyableExceptIdPassFilter; 435 436 #undef EXTERN 437 #endif // _global_h 438