You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
284 lines
8.9 KiB
284 lines
8.9 KiB
/* $Id: bomberclone.h,v 1.17 2004/01/25 14:10:28 stpohle Exp $ */
|
|
/* bomberclone.h */
|
|
|
|
#ifndef _BOMBERCLONE_H_
|
|
#define _BOMBERCLONE_H_
|
|
|
|
#include <stdarg.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
#include <time.h>
|
|
#include <ctype.h>
|
|
#include <sys/stat.h>
|
|
#include <math.h>
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#include <winsock.h>
|
|
#include <sys/stat.h>
|
|
#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 <sys/time.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <netdb.h>
|
|
#include <arpa/inet.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <dirent.h>
|
|
#endif
|
|
#include <SDL.h>
|
|
#include <SDL_image.h>
|
|
|
|
#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 {
|
|
float to; // if (to > 0) the ilness is still working
|
|
int datai; // hold a integer data (like number of something..)
|
|
float dataf; // hold a float data (speed and so on)
|
|
} 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 */
|
|
float to; // timeout in ms after dropping the bomb. (loops * 0.0005sec)
|
|
float frame; // frame of the animation
|
|
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
|
|
float 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
|
|
|
|
float frame; // step of the animation (only integer part will shown)
|
|
float illframe;
|
|
|
|
_pointf pos; // position on the field
|
|
_pointf old; // the old position
|
|
float 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];
|
|
|
|
int p_nr; // Playernumber 0 if you host a game or the number of the one you are.
|
|
int p_servnr; // Playernumber of the Server
|
|
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
|
|
float 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
|
|
int 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
|
|
char gamename[LEN_GAMENAME]; // this will hold the game name
|
|
char ogcserver[LEN_SERVERNAME+LEN_PORT+2];
|
|
char ogc_port[LEN_PORT];
|
|
int firewall;
|
|
int notifygamemaster;
|
|
int askplayername; // ask player for name at startup
|
|
|
|
int start_bombs; // start values
|
|
int start_range;
|
|
float start_speed;
|
|
|
|
float bomb_tickingtime; // time before the bomb explodes
|
|
|
|
unsigned char ai_players; // number of ai players
|
|
} typedef _bomberclone;
|
|
|
|
|
|
struct {
|
|
signed char dir;
|
|
signed char bestdir;
|
|
} typedef _airunaway;
|
|
|
|
|
|
extern _bomberclone bman;
|
|
extern _player *players;
|
|
extern Uint32 timestamp;
|
|
extern float timefactor;
|
|
extern float timediff;
|
|
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 float 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 int check_exfield (short int x, short int y);
|
|
extern void player_calcpos ();
|
|
extern void player_set_ilness (_player * p, int t, float new_to);
|
|
extern void player_clear_ilness (_player *p, int type);
|
|
extern void player_ilness_loop (int plnr);
|
|
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);
|
|
|
|
// 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);
|
|
|
|
// configuration
|
|
extern void config_init (int argc, char **argv);
|
|
extern void config_menu ();
|
|
extern int config_read();
|
|
extern int config_write();
|
|
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,...);
|
|
extern void debug_ingameinfo();
|
|
extern void d_printsdlrect (char *text, SDL_Rect *rect);
|
|
|
|
|
|
// single.c
|
|
extern void single_game_new ();
|
|
extern void single_create_ai (int num_players);
|
|
extern void single_delete_ai (int num_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
|