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.
228 lines
7.2 KiB
228 lines
7.2 KiB
/* $Id: bomberclone.h,v 1.9 2003/05/05 20:40:04 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>
|
|
#ifdef _WIN32
|
|
#include <winsock.h>
|
|
#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>
|
|
#endif
|
|
#include <SDL.h>
|
|
#include "../config.h"
|
|
#include "gfx.h"
|
|
#include "network.h"
|
|
|
|
|
|
|
|
struct __playerilness {
|
|
int to; // if (to > 0) the ilness is still working
|
|
int data;
|
|
} typedef _playerilness;
|
|
|
|
|
|
struct __bomb {
|
|
_point 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
|
|
int ex_nr; // explosion number
|
|
} typedef _bomb;
|
|
|
|
|
|
struct __player {
|
|
_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;
|
|
|
|
_point pos; /* position (without the offset)
|
|
_x = pos.x & 255; fx = pos.x >> 8; */
|
|
_point old; // the old position
|
|
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
|
|
_bomb bombs[MAX_BOMBS]; // number of bombs who are ticking.
|
|
int range; // range of the bombs
|
|
int speed; // how fast we can go (0 = slow, 1 = normal... 3 = fastest)
|
|
int speeddat; // some data i need to do the speed thing
|
|
_playerilness ill[PI_max]; // all possible types
|
|
|
|
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 __ex_field {
|
|
unsigned char count;
|
|
unsigned char frame;
|
|
} typedef _ex_field;
|
|
|
|
|
|
struct __field {
|
|
unsigned char type;
|
|
int frame; // frame (frame > 0 && FS_stone)
|
|
int frameto; // frame to
|
|
unsigned char special; // to save special stones
|
|
_ex_field ex[4]; // count up every explosion there is on this field for ever direction
|
|
int ex_nr; // number to identify the explosion.
|
|
} typedef _field;
|
|
|
|
|
|
struct __serverlist {
|
|
char name[255];
|
|
} typedef _serverlist;
|
|
|
|
|
|
struct __bomberclone {
|
|
_point fieldsize; // dimension of the field
|
|
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.
|
|
|
|
_field field[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y];
|
|
char fieldpath[512]; // path of the field file
|
|
|
|
int last_ex_nr; // number of the last explosion
|
|
|
|
unsigned char gametype;
|
|
unsigned char multitype;
|
|
unsigned char state;
|
|
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 notifygamemaster;
|
|
unsigned char askplayername; // ask player for name at startup
|
|
signed char debug; // 0 = off 1 = on
|
|
} typedef _bomberclone;
|
|
|
|
|
|
struct __menu {
|
|
int index;
|
|
char text[255];
|
|
} typedef _menu;
|
|
|
|
extern _bomberclone bman;
|
|
extern Uint32 timestamp;
|
|
extern int debug;
|
|
|
|
// Game routines..
|
|
extern void game_draw_info ();
|
|
extern void game_loop ();
|
|
extern void game_end ();
|
|
extern void game_set_playerposition();
|
|
|
|
// everything is declared in field.c
|
|
extern void draw_field ();
|
|
extern void draw_stone (int x, int y);
|
|
extern void field_new (char *filename);
|
|
extern void field_set_playerposition (int usermap);
|
|
|
|
// everything what is declared in players.c
|
|
extern void dead_playerani ();
|
|
extern void draw_player (_player * player);
|
|
extern void restore_players_screen ();
|
|
extern void move_player ();
|
|
extern int stepmove_player ();
|
|
extern void player_drop_bomb ();
|
|
extern void get_player_on (short int x, short int 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 fx, short int fy, _player * p);
|
|
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 ();
|
|
extern void player_check_powerup (_player * p);
|
|
extern void player_set_gfx (_player *p, signed char gfx_nr);
|
|
|
|
// for the bomb..
|
|
extern void bomb_loop ();
|
|
extern void restore_bomb_screen ();
|
|
extern void get_bomb_on (int x, int 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);
|
|
extern void bomb_explode (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);
|
|
|
|
// configuration
|
|
extern void configuration ();
|
|
extern void game_init ();
|
|
extern int ReadConfig();
|
|
extern int WriteConfig();
|
|
extern void ReadPrgArgs (int argc, char **argv);
|
|
|
|
// sysfunc.c
|
|
extern void s_delay (int ms);
|
|
extern int s_random (int maxnr);
|
|
extern char *s_gethomedir ();
|
|
|
|
// 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,...);
|
|
|
|
|
|
// single.c
|
|
extern void single_game_new ();
|
|
extern void single_create_ai ();
|
|
extern void single_loop();
|
|
#endif
|
|
|