formated part of the source, fixed: send_quit

origin
stpohle 21 years ago
parent 8e8d381ddf
commit 2c43dfc8f0

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.31 2005/04/09 18:22:40 stpohle Exp $ */ /* $Id: basic.h,v 1.32 2005/04/10 00:22:16 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -14,21 +14,21 @@
#define GAME_SPECIAL_ITEMSROW 3 #define GAME_SPECIAL_ITEMSROW 3
#define GAME_SPECIAL_ITEMSPUSH 3 #define GAME_SPECIAL_ITEMSPUSH 3
#define GAME_SPECIAL_ITEMSKICK 3 #define GAME_SPECIAL_ITEMSKICK 3
#define GAME_MAX_TUNNELS 4 // number of tunnel entrys #define GAME_MAX_TUNNELS 4 // number of tunnel entrys
#define GAME_TIMEOUT 600.0 // game timeout 10min) #define GAME_TIMEOUT 600.0 // game timeout 10min)
#define GAME_OVERTIMEOUT 5.0 // second of remaining the last player #define GAME_OVERTIMEOUT 5.0 // second of remaining the last player
#define GAME_TUNNEL_TO 0.5 // wait 0.5 seconds #define GAME_TUNNEL_TO 0.5 // wait 0.5 seconds
#define HURRYWARN_TO_BLINKING 0.10 #define HURRYWARN_TO_BLINKING 0.10
#define EXPLOSION_SAVE_DISTANCE 0.25 #define EXPLOSION_SAVE_DISTANCE 0.25
#define EXPLOSION_GROW_SPEED 0.75f #define EXPLOSION_GROW_SPEED 0.75f
#define SPECIAL_TRIGGER_TIMEOUT 15 #define SPECIAL_TRIGGER_TIMEOUT 15
#define SPECIAL_TRIGGER_NUMUSE 5 // 0=unlimited #define SPECIAL_TRIGGER_NUMUSE 5 // 0=unlimited
#define SPECIAL_TRIGGER_TIME 25 #define SPECIAL_TRIGGER_TIME 25
#define SPECIAL_ROW_TIME 30 #define SPECIAL_ROW_TIME 30
#define SPECIAL_PUSH_TIME 50 #define SPECIAL_PUSH_TIME 50
#define SPECIAL_KICK_TIME 30 #define SPECIAL_KICK_TIME 30
#define SPECIAL_KICK_MAXDIST 8 // maximum distance allowed #define SPECIAL_KICK_MAXDIST 8 // maximum distance allowed
#define START_BOMBS 1 #define START_BOMBS 1
#define START_RANGE 2 #define START_RANGE 2
@ -47,8 +47,8 @@
#define MAX_FIELDSIZE_Y 31 #define MAX_FIELDSIZE_Y 31
#define MIN_FIELDSIZE_X 15 #define MIN_FIELDSIZE_X 15
#define MIN_FIELDSIZE_Y 9 #define MIN_FIELDSIZE_Y 9
#define MAX_FIELDANIMATION 2048 /* number of points on the field to be animated exploding #define MAX_FIELDANIMATION 2048 /* number of points on the field to be animated exploding
stoned or powerups*/ stoned or powerups */
#define EXPLOSIONTIMEOUT 0.5 #define EXPLOSIONTIMEOUT 0.5
#define ANI_FIRETIMEOUT 2 #define ANI_FIRETIMEOUT 2
@ -80,129 +80,129 @@
#define UDP_TIMEOUT 15000 #define UDP_TIMEOUT 15000
#define BUF_SIZE 1024 #define BUF_SIZE 1024
#define AUTOSTART 20 /* dedicated server autostart */ #define AUTOSTART 20 /* dedicated server autostart */
#define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (__result >= 0) && (players[__result].gfx_nr != __gfx_nr); __result--); #define MW_IS_GFX_SELECT(__gfx_nr,__result) for (__result = (MAX_PLAYERS-1); (__result >= 0) && (players[__result].gfx_nr != __gfx_nr); __result--);
#define CUTINT(__x) (__x-floorf(__x)) // cut the integer part off #define CUTINT(__x) (__x-floorf(__x)) // cut the integer part off
#define postofield(__x) ((int)(rintf(__x))) // position to int with rounding #define postofield(__x) ((int)(rintf(__x))) // position to int with rounding
#define UINT16_HALF 32767 #define UINT16_HALF 32767
#include <SDL.h> #include <SDL.h>
enum _backgound { // to load some diffrent logos.. enum _backgound { // to load some diffrent logos..
BG_start = 0, BG_start = 0,
BG_net, BG_net,
BG_conf BG_conf
}; };
enum _gametype { enum _gametype {
GT_bomberman = 0, GT_bomberman = 0,
GT_deathmatch, GT_deathmatch,
GT_team GT_team
}; };
enum _gamestate { enum _gamestate {
GS_startup = 0, GS_startup = 0,
GS_quit, GS_quit,
GS_wait, // waiting for players to join GS_wait, // waiting for players to join
GS_update, GS_update,
GS_ready, GS_ready,
GS_running GS_running
}; };
enum _maptype { enum _maptype {
MAPT_random = -1, // random map MAPT_random = -1, // random map
MAPT_normal = 0, // a normal map MAPT_normal = 0, // a normal map
MAPT_tunnel, // a map with tunnels MAPT_tunnel, // a map with tunnels
MAPT_max MAPT_max
}; };
enum _fieldtype { enum _fieldtype {
FT_nothing = 0, // Nothing in here FT_nothing = 0, // Nothing in here
FT_stone, // Stones you can bomb away FT_stone, // Stones you can bomb away
FT_block, // Stones which can't bomb away FT_block, // Stones which can't bomb away
FT_tunnel, // the tunnel item FT_tunnel, // the tunnel item
FT_death, // The bad Powerup FT_death, // The bad Powerup
FT_fire, // The fire Powerup FT_fire, // The fire Powerup
FT_bomb, // The bomb Powerup FT_bomb, // The bomb Powerup
FT_shoe, // The shoe Powerup FT_shoe, // The shoe Powerup
FT_mixed, // The mixed Powerup FT_mixed, // The mixed Powerup
FT_sp_trigger, // The Triggered bomb Special FT_sp_trigger, // The Triggered bomb Special
FT_sp_row, // The bomb-row special FT_sp_row, // The bomb-row special
FT_sp_push, // The push-boms special FT_sp_push, // The push-boms special
FT_sp_moved, // The moved-boms special FT_sp_moved, // The moved-boms special
FT_sp_liquid, // The liquid-bomb special FT_sp_liquid, // The liquid-bomb special
FT_sp_kick, // The kick-bomb special FT_sp_kick, // The kick-bomb special
FT_max // just to know how many types there are FT_max // just to know how many types there are
}; };
extern const char *ft_filenames[]; // declared in tileset.c extern const char *ft_filenames[]; // declared in tileset.c
enum _poweruptypes { enum _poweruptypes {
PWUP_good = 0, PWUP_good = 0,
PWUP_bad, PWUP_bad,
PWUP_special, PWUP_special,
PWUP_max PWUP_max
}; };
enum _direction { // to handle directions better enum _direction { // to handle directions better
left = 0, left = 0,
right, right,
up, up,
down down
}; };
enum _mapselection { enum _mapselection {
MAPS_select = 0, MAPS_select = 0,
MAPS_randmap, MAPS_randmap,
MAPS_randgen MAPS_randgen
}; };
enum _mstatus { enum _mstatus {
MS_normal = 0, MS_normal = 0,
MS_hurrywarn, MS_hurrywarn,
MS_hurry, // mapsize will go down MS_hurry, // mapsize will go down
MS_dropitems, // alot of items will be droppen randomly into the game MS_dropitems, // alot of items will be droppen randomly into the game
MS_max MS_max
}; };
enum _help_page { enum _help_page {
HP_howto0 = 0, HP_howto0 = 0,
HP_powerup0, HP_powerup0,
HP_powerup1, HP_powerup1,
HP_powerup2, HP_powerup2,
HP_keyboard0, HP_keyboard0,
HP_credit0, HP_credit0,
HP_credit1, HP_credit1,
HP_max HP_max
}; };
struct { struct {
Sint16 x; Sint16 x;
Sint16 y; Sint16 y;
} typedef _point; } typedef _point;
struct { struct {
float x; float x;
float y; float y;
} typedef _pointf; } typedef _pointf;
struct __charlist { struct __charlist {
char text[LEN_CHARENTRY]; char text[LEN_CHARENTRY];
struct __charlist *next; struct __charlist *next;
} typedef _charlist; } typedef _charlist;
extern _point dir_change[]; extern _point dir_change[];

@ -1,4 +1,4 @@
/* $Id: bomb.h,v 1.4 2004/12/01 02:41:54 stpohle Exp $ /* $Id: bomb.h,v 1.5 2005/04/10 00:22:16 stpohle Exp $
* bomb include file * bomb include file
*/ */
@ -7,51 +7,51 @@
enum _bombstate { enum _bombstate {
BS_off = 0, BS_off = 0,
BS_ticking, BS_ticking,
BS_exploding, BS_exploding,
BS_trigger BS_trigger
}; };
enum _bombmode { enum _bombmode {
BM_normal = 0, BM_normal = 0,
BM_pushed, BM_pushed,
BM_moving, BM_moving,
BM_liquid, BM_liquid,
BM_kicked BM_kicked
}; };
struct { struct {
_pointf pos; // lower byte = _X Higher Byte = FX _pointf pos; // lower byte = _X Higher Byte = FX
struct __bomb_id { // save the bomb id struct __bomb_id { // save the bomb id
signed char p; // playernumber of this bomb signed char p; // playernumber of this bomb
signed char b; // bombnumber of this bomb signed char b; // bombnumber of this bomb
} id; } id;
float firer[4]; // range of the fire for the fire for each direction float firer[4]; // range of the fire for the fire for each direction
int firemaxr [4]; // max range reached? int firemaxr[4]; // max range reached?
float to; // timeout in ms after dropping the bomb. (loops * 0.0005sec) float to; // timeout in ms after dropping the bomb. (loops * 0.0005sec)
float frame; // frame of the animation float frame; // frame of the animation
unsigned char r; // range of the bomb unsigned char r; // range of the bomb
unsigned char state; // state of the bomb BS_* unsigned char state; // state of the bomb BS_*
unsigned char mode; // mode of the bomb BM_* unsigned char mode; // mode of the bomb BM_*
int ex_nr; // explosion number int ex_nr; // explosion number
_point dest; // destination to move the bomb to _point dest; // destination to move the bomb to
float speed; // bomb moving speed float speed; // bomb moving speed
} typedef _bomb; } typedef _bomb;
// for the bomb.. // for the bomb..
extern void bomb_loop (); extern void bomb_loop ();
extern void bomb_explode (_bomb *bomb, int net); extern void bomb_explode (_bomb * bomb, int net);
extern inline void bomb_action (_bomb *bomb); extern inline void bomb_action (_bomb * bomb);
extern void bomb_move (_bomb *bomb); extern void bomb_move (_bomb * bomb);
extern void get_bomb_on (float x, float y, _point bombs[]); extern void get_bomb_on (float x, float y, _point bombs[]);
extern void explosion_do (_bomb *bomb); extern void explosion_do (_bomb * bomb);
extern void explosion_restore (_bomb * bomb); extern void explosion_restore (_bomb * bomb);
extern int explosion_check_field (int x, int y, _bomb *bomb); extern int explosion_check_field (int x, int y, _bomb * bomb);
#endif #endif

@ -1,4 +1,4 @@
/* $Id: configuration.c,v 1.74 2005/04/09 18:22:40 stpohle Exp $ /* $Id: configuration.c,v 1.75 2005/04/10 00:22:17 stpohle Exp $
* configuration */ * configuration */
#include <SDL.h> #include <SDL.h>
@ -134,9 +134,9 @@ config_init (int argc, char **argv)
bman.start_speed = START_SPEED; bman.start_speed = START_SPEED;
bman.start_range = START_RANGE; bman.start_range = START_RANGE;
bman.bomb_tickingtime = BOMB_TIMEOUT; bman.bomb_tickingtime = BOMB_TIMEOUT;
bman.dropitemsondeath = 0; bman.dropitemsondeath = 0;
d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION); d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
config_read (); config_read ();
ReadPrgArgs (argc, argv); ReadPrgArgs (argc, argv);
@ -686,22 +686,23 @@ ReadPrgArgs (int argc, char **argv)
if (!strcmp (argv[i], "-name")) if (!strcmp (argv[i], "-name"))
strncpy (bman.playername, argv[++i], LEN_PLAYERNAME); strncpy (bman.playername, argv[++i], LEN_PLAYERNAME);
if (!strcmp (argv[i], "-name2")) if (!strcmp (argv[i], "-name2"))
strncpy (bman.player2name, argv[++i], LEN_PLAYERNAME); strncpy (bman.player2name, argv[++i], LEN_PLAYERNAME);
if (!strcmp (argv[i], "-gamename")) if (!strcmp (argv[i], "-gamename"))
strncpy (bman.gamename, argv[++i], LEN_GAMENAME); strncpy (bman.gamename, argv[++i], LEN_GAMENAME);
if (!strcmp (argv[i], "-ogc")) if (!strcmp (argv[i], "-ogc"))
bman.notifygamemaster = atoi (argv[++i]); bman.notifygamemaster = atoi (argv[++i]);
if (!strcmp (argv[i], "-broadcast")) if (!strcmp (argv[i], "-broadcast"))
bman.broadcast = atoi (argv[++i]); bman.broadcast = atoi (argv[++i]);
if (!strcmp (argv[i], "-debug")) if (!strcmp (argv[i], "-debug"))
debug = atoi (argv[++i]); debug = atoi (argv[++i]);
if (!strcmp (argv[i], "-dedicated")) { if (!strcmp (argv[i], "-dedicated")) {
if (bman.minplayers <= 1) if (bman.minplayers <= 1)
bman.minplayers = 2; bman.minplayers = 2;
bman.dedicated = 1; bman.dedicated = 1;
} printf ("\nDedicated Bomberclone Server - Version " VERSION "\n\n");
if (!strcmp (argv[i], "-autostart")) }
bman.autostart = atoi (argv[++i]); if (!strcmp (argv[i], "-autostart"))
bman.autostart = atoi (argv[++i]);
} }
}; };

@ -1,4 +1,4 @@
/* $Id: game.c,v 1.110 2005/04/09 19:44:08 stpohle Exp $ /* $Id: game.c,v 1.111 2005/04/10 00:22:17 stpohle Exp $
game.c - procedures for the game. */ game.c - procedures for the game. */
#include <string.h> #include <string.h>
@ -217,11 +217,12 @@ void game_keys_loop () {
void void
game_loop () game_loop ()
{ {
SDL_Event event; SDL_Event event;
int done = 0, eventstate; int done = 0, eventstate;
int ready_timestamp = 0;
if (GT_MP) if (GT_MP)
net_game_fillsockaddr (); net_game_fillsockaddr ();
menu = NULL; menu = NULL;
bman.updatestatusbar = 1; // force an update bman.updatestatusbar = 1; // force an update
@ -281,10 +282,13 @@ game_loop ()
if (NET_CANSEND (i) && !players[i].ready) if (NET_CANSEND (i) && !players[i].ready)
ready = 0; ready = 0;
if (ready) if (ready && ready_timestamp == 0)
bman.state = GS_running; ready_timestamp = timestamp;
net_send_servermode (); if (ready && (timestamp - ready_timestamp) > 2500) {
bman.state = GS_running;
net_send_servermode ();
}
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save