/* $Id: bomberclone.h,v 1.5 2003/11/05 12:15:25 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ #define _BOMBERCLONE_H_ #include #include #include #include #include #include #include #include #include #ifdef _WIN32 #include #include #include #ifndef S_ISDIR #define S_ISDIR(a) ((a & _S_IFDIR) == _S_IFDIR) #endif #ifndef S_ISREG #define S_ISREG(a) ((a & _S_IFREG) == _S_IFREG) #endif #else #include #include #include #include #include #include #include #include #endif #include #if HAVE_CONFIG_H #include "config.h" #endif #include "basic.h" #include "map.h" #include "gfx.h" #include "font.h" #include "sound.h" #include "network.h" #include "sysfunc.h" #include "keybinput.h" struct { int to; // if (to > 0) the ilness is still working int data; } typedef _playerilness; struct { _pointf pos; // lower byte = _X Higher Byte = FX int firer[4]; // range of the fire for the fire for each direction int firerst[4]; /* just save here where the direction was going to stop (-1) if the exp is still growing */ int to; // timeout in ms after dropping the bomb. (loops * 0.0005sec) int frame; // frame of the animation int frameto; // timeout for the frame unsigned char r; // range of the bomb unsigned char state; // state of the bomb BS_* unsigned char mode; // mode of the bomb BM_* int ex_nr; // explosion number _point dest; // destination to move the bomb to float speed; // bomb moving speed } typedef _bomb; struct { int type; // type of the special int to; // timeout int numuse; // num of uses left int use; /* currently used set by special_use and deleted in special_loop */ } typedef _special; struct { _gfxplayer *gfx; // pointer to the gfx information int gfx_nr; // number of the player GFX int frame; // step of the animation int frameto; // timeout for the animation int illframe; int illframeto; _pointf pos; // position on the field _pointf old; // the old position int tunnelto; /* timeout for dont show and move player needed on the tunnel effect */ signed char d; // direction signed char m; // player is moving ? signed char old_m; // to save the old state.. int bombs_n; // maximal number of bombs for the player int bomb_lastex; // number of the bomb which explode the last time _bomb bombs[MAX_BOMBS]; // number of bombs who are ticking. int range; // range of the bombs float speed; // how fast we can go (0 = slow, 1 = normal... 3 = fastest) _playerilness ill[PI_max]; // all possible types _special special; // special the player has char name[LEN_PLAYERNAME]; // name oder name[0] == 0 unsigned char state; // status of the player signed char in_nr; // number of the connected player entry int points; // points int wins; // wins signed char dead_by; // player who killed this player _net_player net; // holds all important network data } typedef _player; struct { char name[255]; } typedef _serverlist; struct { char datapath[512]; _player players[MAX_PLAYERS]; int p_nr; // Playernumber 0 if you host a game or the number of the one you are. int last_ex_nr; // number of the last explosion int updatestatusbar; // 1 if statusbar has to be updated unsigned char gametype; unsigned char multitype; unsigned char state; int init_timeout; // gametimeout init value int timeout; // game timeout char playername[LEN_PLAYERNAME]; int players_nr_s; // number of players at the beginning int players_nr; // number of player who are alife signed char lastwinner; // number of the last winnet int maxplayer; // number of max players for the server int sock; // the server socket unsigned char net_ai_family; char port[LEN_PORT]; // what port we're using char servername[LEN_SERVERNAME + LEN_PORT + 2]; // holds the name of the current server _serverlist serverlist[MAX_SERVERENTRYS]; // ** CONFIG name of the server we are connected to char gamename[LEN_GAMENAME]; // this will hold the game name char gamemaster[LEN_SERVERNAME + LEN_PORT + 2]; // ** CONFIG ... GameMaster Address unsigned char firewall; unsigned char notifygamemaster; unsigned char broadcasted_chat; // 1 if the chat should be send to the bc server unsigned char askplayername; // ask player for name at startup unsigned char ai_players; // number of ai players signed char debug; // 0 = off 1 = on } typedef _bomberclone; struct { int index; char text[255]; // int type; // could be visible / disabled / grayed ?? should avoid -2 trick } typedef _menu; struct { signed char dir; signed char bestdir; } typedef _airunaway; extern _bomberclone bman; extern Uint32 timestamp; extern float timefactor; extern int debug; // Game routines.. extern void game_draw_info (); extern void game_loop (); extern void game_end (); extern void game_start(); extern void game_showresult (); // everything is declared in field.c extern void draw_field (); extern void field_clear(int x, int y); extern void field_animation_add (int x, int y); extern void field_animation (); extern void field_loop (); extern void field_hurrysize (); extern void field_hurrydropitems (); extern int field_check_alldirs (int x, int y, int type); extern void draw_stone (int x, int y); extern void stonelist_add (int x, int y); extern void stonelist_del (); extern void stonelist_draw (); // everything what is declared in players.c extern int dead_playerani (); extern void draw_player (_player * player); extern void restore_players_screen (); extern void move_player (int pl_nr); extern int stepmove_player (int pl_nr); extern void player_drop_bomb (int pl_nr); extern void get_player_on (float x, float y, int pl_nr[]); extern void player_died (_player * player, signed char dead_by); extern void draw_players (); extern void player_animation (_player * player); extern int check_field (short int x, short int y); extern void player_calcstep (_player * pl); extern void player_calcpos (); extern void player_set_ilness (_player *p, int t); extern void player_clear_ilness (_player *p, int type); extern void player_ilness_loop (int pl_nr); extern void player_check_powerup (int p_nr); extern void player_set_gfx (_player *p, signed char gfx_nr); extern int player_findfreebomb (_player *player); extern int player_checkpos (int x, int y); // extern inline int postofield (int pos); // for the bomb.. extern int bomb_loop (); extern void bomb_explode (int p, int b, int net); extern inline void bomb_action (_bomb *bomb); extern void bomb_move (_bomb *bomb); extern void get_bomb_on (float x, float y, _point bombs[]); extern void draw_fire (int x, int y, int d, int frame); extern void do_explosion (int p, int b); extern void restore_explosion (_bomb * bomb); extern int explosion_check_field (int x, int y, int p, int b); // menus extern void draw_select (int select, _menu menu[], int x, int y); extern int menu_loop (char *menutitle, _menu menu[], int lastselect); extern void draw_menu (char *text, _menu menu[], int *x, int *y); extern void menu_get_text (char *title, char *text, int len); extern void menu_displaymessage (char *title, char *text); extern void menu_displaytext (char *title, char *text, Uint8 r, Uint8 g, Uint8 b); extern char *menu_dir_select (char *title, char *path, signed char dirflags); void menu_clearkeybuff(); void draw_menubox (int x, int y); // configuration extern void configuration (); extern void game_init (int argc, char **argv); extern int ReadConfig(); extern int WriteConfig(); extern void ReadPrgArgs (int argc, char **argv); // debug.c extern void d_in_pl_detail (char *head); extern void d_playerdetail (char *head); extern void d_gamedetail (char *head); extern void d_printf (char *fmt,...); extern void d_bitprint (int bits, int nr); extern void d_fatal (char *fmt,...); // single.c extern void single_game_new (); extern void single_create_ai (int players); extern void single_loop(); extern void single_playergame (); extern void single_menu (); extern int single_select_player (); extern int ai_choosedir (int dir, int nearbomb, int oldpos); extern inline int ai_invertdir (int dir); extern inline int ai_checkpos (_player * pl, _point * pos); extern int ai_findnearbombs (_point pos); extern int ai_findbestbombdir (_point pos, int dir, int range); extern int ai_bombpoints (_point pos, int range); extern _airunaway ai_runawayfrom (_point p, int nearbomb, signed char norecursive); extern int ai_checkfield (int x, int y); extern int ai_easyrunaway (_point p); // special.c extern void special_use (int p_nr); extern void special_pickup (int p_nr, int s_type); extern void special_loop (); extern void special_clear (int p_nr); extern void special_push (int p_nr); extern void special_row (int p_nr); extern void special_trigger (int p_nr); extern void special_liquidmoved (int p_nr); extern void tileset_load (char *tileset); extern void tileset_random (); extern void tileset_free (); #endif