/************************************************************************** global.h - description ------------------- begin : Mon Jan 3 2000 copyright : (C) 2000 by Perdig email : perdig@linuxbr.com.br $Id: global.h,v 1.10 2001/01/11 15:28:03 perdig Exp $ ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef GLOBAL_H #define GLOBAL_H #include #include "stdio.h" #include "config.h" typedef int bool; #define true 1 #define false 0 // Frames per second #define FPS 20 typedef struct { Pixmap pix; Pixmap mask; } Image; typedef struct { int x; int y; int direction; int toGoDir; Image *img[4]; int fuel; int vel; int aiguess; int ai; } carStruct; typedef struct { Pixmap pix; char *data; int width; int height; int offX; int offY; int tX; int tY; int startX; int startY; int *red_startX; int *red_startY; int redNum; int flagNum; int flagLeft; int *flagX; int *flagY; char startDir; int carVel; int aiVel; int startFuel; int fuelImpact; int fuelpts; bool bonus; int radarmode; int radarrange; int enemywait; } mapStruct; typedef struct { char name[256]; char sum[256]; char tileset[256]; mapStruct *map; int number; int pics; int lives; int extra; int livesbonus; int border; FILE *file; int volume; } levelStruct; typedef struct { Pixmap pix; GC gc; int width; int height; float factor; } radarStruct; typedef struct { carStruct *bot; int number; int *order; int *data; } aiStruct; #define FLAG_VALUE 100 #define SCORE_DIGITS 8 #define SCORE_TIMER 10 #define COLOR_SCORE "#FFFFFF" typedef struct { char string[SCORE_DIGITS]; unsigned int value; unsigned int bonus; unsigned int last; int x; int y; int num_extra; int current_extra; unsigned char timer; } scoreStruct; #define SMOKE_NUM 10 // Smoke duration, in seconds #define SMOKE_DURATION 4 * FPS // Fuel spent (in frames) #define SMOKE_FUEL FPS * 1 typedef struct { int x[SMOKE_NUM]; int y[SMOKE_NUM]; int left[SMOKE_NUM]; int current; } smoke_struct; // Define Directions #define UP 0 #define RIGHT 1 #define DOWN 2 #define LEFT 3 // Define velocity #define STEP 9 #define STEP2 10 // Lives #define NUM_LIVES 5 #define EXTRA_LIVE 5000 // Define fonts #define FONT_SMALL 0 #define FONT_MEDIUM 1 #define FONT_BIG 2 #define FONT_FIXED 3 // Define colors #define COLOR_BLACK "rgb:00/00/00" #define COLOR_YELLOW "rgb:FF/FF/00" #define COLOR_WHITE "rgb:FF/FF/FF" #define COLOR_BLUE "rgb:00/00/FF" #define COLOR_RED "rgb:FF/00/00" #define COLOR_GREEN "rgb:77/FF/87" // DEBUG MACRO // ldbg: Level debug (not very important) (4) // dbg: Normal debug (important) (2) // hdbg: Error debug (very important) (1) #define DEBUG 3 #if DEBUG > 0 #define _D_INFO "\x1b[33m" #define _D_CRIT "\x1b[31m" #define _D_WARN "\x1b[36m" #define _D(args...) { \ printf("\x1b[33m%s \x1b[37m[%s:%d]%s", \ __PRETTY_FUNCTION__, __FILE__, __LINE__, _D_INFO); \ printf(args); \ printf("\x1b[0m\n"); \ } #define ldbg(STR...) { if (DEBUG&4) _D(_D_INFO STR); } #define dbg(STR...) { if (DEBUG&2) _D(_D_WARN STR); } #define hdbg(STR...) { if (DEBUG) _D(_D_CRIT STR); } #endif // Sound #ifdef USE_SOUND #define SOUND_ALARM 0x0f #define SOUND_BONUS 0x10 #define SOUND_CHKFUEL 0x0a #define SOUND_LIGHT 0x1b #define SOUND_SMOKE 0x1c #define SOUND_GETFLAG 0x1d #define SOUND_CRASH 0x1e void play_sound (int); #endif // Results #define RESULT_WIN 0 #define RESULT_LOSE 1 #define RESULT_QUIT 2 #define PLAYABLE #ifndef USE_SOUND #define sound_switch() #define sound_stop() #define sound_volume(a) #define sound_start() #define sound_select(a) #define sound_load(a) #endif #endif