bugfix with more as 8 different playergraphics. Dedicated server mode removed

origin
stpohle 21 years ago
parent a98791b800
commit 473a92c692

@ -1,4 +1,13 @@
$Id: ChangeLog,v 1.103 2005/04/11 22:21:11 stpohle Exp $ $Id: ChangeLog,v 1.104 2005/07/06 13:11:51 stpohle Exp $
- Fixed: Bug with more as 8 diffrent player graphics.
The window size hasen't changed if there where more as
8 different player graphics to choose from.
- Removed the Dedicated Server Support from the game.
The whole bomberclone game is not desinged for a dedicated
server. The test shown that the whole game would have to
be rewritten. Also that the host can leave the game would
not work no more.
Version 0.11.6.2 Version 0.11.6.2
- Client network player could die two times in a game. - Client network player could die two times in a game.

@ -1,4 +1,4 @@
# Anjuta Version 1.2.2 # Anjuta Version 1.2.3
Compatibility Level: 1 Compatibility Level: 1
<PROJECT_DESCRIPTION_START> <PROJECT_DESCRIPTION_START>
@ -39,7 +39,7 @@ echo "T $target H $host B $buid" >cross-target.txt
props.file.type=project props.file.type=project
anjuta.version=1.2.2 anjuta.version=1.2.3
anjuta.compatibility.level=1 anjuta.compatibility.level=1
project.name=bomberclone project.name=bomberclone

@ -1,4 +1,4 @@
/* $Id: basic.h,v 1.32 2005/04/10 00:22:16 stpohle Exp $ */ /* $Id: basic.h,v 1.33 2005/07/06 13:11:55 stpohle Exp $ */
/* basic types which we need everywhere */ /* basic types which we need everywhere */
#ifndef _BC_BASIC_H_ #ifndef _BC_BASIC_H_
@ -80,7 +80,7 @@
#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 /* 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--);

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.33 2005/04/09 18:22:40 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.34 2005/07/06 13:11:55 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -85,7 +85,6 @@ struct {
int firewall; int firewall;
int notifygamemaster; int notifygamemaster;
int broadcast; int broadcast;
int dedicated; // if started as dedicated server
int autostart; // time for an autostart of the game int autostart; // time for an autostart of the game
int minplayers; // minimal number of players int minplayers; // minimal number of players

@ -1,4 +1,4 @@
/* $Id: bomb.c,v 1.63 2005/04/09 18:22:40 stpohle Exp $ */ /* $Id: bomb.c,v 1.64 2005/07/06 13:11:55 stpohle Exp $ */
/* everything what have to do with the bombs */ /* everything what have to do with the bombs */
#include "bomberclone.h" #include "bomberclone.h"
@ -19,8 +19,6 @@ draw_bomb (_bomb * bomb)
y1, y1,
y2; y2;
if (bman.dedicated)
return;
if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) { if (x < 0 || y < 0 || x >= map.size.x || y >= map.size.y) {
d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y); d_printf ("FATAL: Draw Bomb out of range [%f,%f]\n", x, y);

@ -1,4 +1,4 @@
/* $Id: configuration.c,v 1.75 2005/04/10 00:22:17 stpohle Exp $ /* $Id: configuration.c,v 1.76 2005/07/06 13:11:55 stpohle Exp $
* configuration */ * configuration */
#include <SDL.h> #include <SDL.h>
@ -21,29 +21,31 @@
* 2) ./data * 2) ./data
* 3) ../data * 3) ../data
*/ */
void config_get_datapath () { void
FILE *f; config_get_datapath ()
char filename[255]; {
FILE *f;
char filename[255];
sprintf (bman.datapath, PACKAGE_DATA_DIR); sprintf (bman.datapath, PACKAGE_DATA_DIR);
sprintf (filename, "%s/gfx/logo.png", bman.datapath); sprintf (filename, "%s/gfx/logo.png", bman.datapath);
f = fopen (filename, "r"); f = fopen (filename, "r");
if (!f) { if (!f) {
sprintf (bman.datapath, "data"); sprintf (bman.datapath, "data");
sprintf (filename, "%s/gfx/logo.png", bman.datapath); sprintf (filename, "%s/gfx/logo.png", bman.datapath);
f = fopen (filename, "r"); f = fopen (filename, "r");
if (!f) { if (!f) {
sprintf (bman.datapath, "../data"); sprintf (bman.datapath, "../data");
sprintf (filename, "%s/gfx/logo.png", bman.datapath); sprintf (filename, "%s/gfx/logo.png", bman.datapath);
f = fopen (filename, "r"); f = fopen (filename, "r");
if (!f) { if (!f) {
printf ("Can't find Datafiles.\n"); printf ("Can't find Datafiles.\n");
exit (1); exit (1);
} }
} }
} }
fclose (f); fclose (f);
} }
@ -53,26 +55,28 @@ void config_get_datapath () {
void void
config_init (int argc, char **argv) config_init (int argc, char **argv)
{ {
SDL_Surface *icon_img; SDL_Surface *icon_img;
char text[255], icon[255]; char text[255],
int i, j; icon[255];
int i,
j;
config_get_datapath (); config_get_datapath ();
srand (((int) time (NULL))); // initialize randomgenerator srand (((int) time (NULL))); // initialize randomgenerator
for (i = 0; i < MAX_TEAMS; i++) { for (i = 0; i < MAX_TEAMS; i++) {
teams[i].col = i; teams[i].col = i;
sprintf (teams[i].name, "Team %d", i+1); sprintf (teams[i].name, "Team %d", i + 1);
for (j = 0; j < MAX_PLAYERS; j++) for (j = 0; j < MAX_PLAYERS; j++)
teams[i].players[j] = NULL; teams[i].players[j] = NULL;
} }
stonelist_del (); stonelist_del ();
chat.oldscreen = NULL; chat.oldscreen = NULL;
chat.active = 0; chat.active = 0;
chat.curline = 0; chat.curline = 0;
keyb_config_reset (); keyb_config_reset ();
keybinput_new (&chat.input, KEYBI_text, 255); keybinput_new (&chat.input, KEYBI_text, 255);
for (i = 0; i < CHAT_MAX_LINES; i++) for (i = 0; i < CHAT_MAX_LINES; i++)
@ -81,28 +85,27 @@ config_init (int argc, char **argv)
bman.maxplayer = MAX_PLAYERS; bman.maxplayer = MAX_PLAYERS;
bman.net_ai_family = PF_INET; bman.net_ai_family = PF_INET;
bman.sock = -1; bman.sock = -1;
bman.p_nr = -1; bman.p_nr = -1;
bman.p2_nr = -1; bman.p2_nr = -1;
bman.gamename[0] = 0; bman.gamename[0] = 0;
sprintf (bman.playername, "Player1"); sprintf (bman.playername, "Player1");
sprintf (bman.player2name, "Player2"); sprintf (bman.player2name, "Player2");
sprintf (bman.port, "%d", DEFAULT_UDPPORT); sprintf (bman.port, "%d", DEFAULT_UDPPORT);
sprintf (bman.ogcserver, DEFAULT_GAMECACHE); sprintf (bman.ogcserver, DEFAULT_GAMECACHE);
sprintf (bman.ogc_port, DEFAULT_GAMECACHEPORT); sprintf (bman.ogc_port, DEFAULT_GAMECACHEPORT);
resend_cache.data = NULL; resend_cache.data = NULL;
resend_cache.fill = -1; resend_cache.fill = -1;
bman.notifygamemaster = 1; bman.notifygamemaster = 1;
bman.broadcast = 1; bman.broadcast = 1;
bman.dedicated = 0; bman.autostart = AUTOSTART;
bman.autostart = AUTOSTART;
bman.askplayername = 0; bman.askplayername = 0;
debug = 0; debug = 0;
gfx.res.x = 640; gfx.res.x = 640;
gfx.res.y = 480; gfx.res.y = 480;
gfx.bpp = 16; gfx.bpp = 16;
gfx.players = NULL; gfx.players = NULL;
bman.password[0] = 0; bman.password[0] = 0;
bman.passwordenabled = 0; bman.passwordenabled = 0;
map.tileset[0] = 0; map.tileset[0] = 0;
map.random_tileset = 1; map.random_tileset = 1;
map.size.x = 25; map.size.x = 25;
@ -113,7 +116,7 @@ config_init (int argc, char **argv)
bman.firewall = 0; bman.firewall = 0;
bman.init_timeout = GAME_TIMEOUT; bman.init_timeout = GAME_TIMEOUT;
bman.ai_players = 1; bman.ai_players = 1;
bman.minplayers = 0; bman.minplayers = 0;
snd.inited = 0; snd.inited = 0;
snd.audio_rate = 22050; snd.audio_rate = 22050;
snd.audio_format = AUDIO_S16; snd.audio_format = AUDIO_S16;
@ -130,51 +133,51 @@ config_init (int argc, char **argv)
map.sp_push = GAME_SPECIAL_ITEMSPUSH; map.sp_push = GAME_SPECIAL_ITEMSPUSH;
map.sp_kick = GAME_SPECIAL_ITEMSKICK; map.sp_kick = GAME_SPECIAL_ITEMSKICK;
bman.start_bombs = START_BOMBS; bman.start_bombs = START_BOMBS;
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);
gfx_init (); gfx_init ();
draw_logo (); draw_logo ();
if (bman.askplayername) if (bman.askplayername)
playernamemenu (); playernamemenu ();
snd_init (); snd_init ();
gfx_blitdraw (); gfx_blitdraw ();
if (!bman.dedicated) SDL_Flip (gfx.screen);
SDL_Flip (gfx.screen);
sprintf (text,"Bomberclone %s", VERSION); sprintf (text, "Bomberclone %s", VERSION);
sprintf (icon,"%s/pixmaps/bomberclone.png", bman.datapath); sprintf (icon, "%s/pixmaps/bomberclone.png", bman.datapath);
SDL_WM_SetCaption(text , NULL); SDL_WM_SetCaption (text, NULL);
icon_img = IMG_Load(icon); icon_img = IMG_Load (icon);
if (icon_img == NULL) if (icon_img == NULL)
d_printf ("could not load icon. (%s)\n", icon); d_printf ("could not load icon. (%s)\n", icon);
#ifdef _WIN32 #ifdef _WIN32
{ {
SDL_Surface *tmp = icon_img; SDL_Surface *tmp = icon_img;
icon_img = scale_image (tmp, 32, 32); icon_img = scale_image (tmp, 32, 32);
SDL_FreeSurface (tmp); SDL_FreeSurface (tmp);
} }
#endif #endif
SDL_WM_SetIcon (icon_img, NULL); SDL_WM_SetIcon (icon_img, NULL);
ReadPrgArgs_Jump (argc, argv); ReadPrgArgs_Jump (argc, argv);
}; };
/* read the configuration file /* read the configuration file
* return -1 if something went wrong and 0 if no problem */ * return -1 if something went wrong and 0 if no problem */
int int
config_read () { config_read ()
{
FILE *config; FILE *config;
char buf[1024]; char buf[1024];
char *findit, char *findit,
@ -373,60 +376,60 @@ config_read () {
bman.dropitemsondeath = atoi (value); bman.dropitemsondeath = atoi (value);
} }
for (i = 0; i < MAX_TEAMS; i++) { for (i = 0; i < MAX_TEAMS; i++) {
char txt[255]; char txt[255];
sprintf (txt,"teamcol%d", i); sprintf (txt, "teamcol%d", i);
if (!strcmp (keyword, txt)) { if (!strcmp (keyword, txt)) {
teams[i].col = atoi (value); teams[i].col = atoi (value);
} }
sprintf (txt,"teamname%d", i); sprintf (txt, "teamname%d", i);
if (!strcmp (keyword, txt)) { if (!strcmp (keyword, txt)) {
strncpy (teams[i].name,value, LEN_PLAYERNAME); strncpy (teams[i].name, value, LEN_PLAYERNAME);
} }
} }
/* /*
* keyboard config, i will give names to the keys insteed of the numbers, * keyboard config, i will give names to the keys insteed of the numbers,
* this is done to add more keys to the game without destroying the config. * this is done to add more keys to the game without destroying the config.
*/ */
if (!strcmp (keyword, "key_p1_up")) if (!strcmp (keyword, "key_p1_up"))
keyb_gamekeys.keycode[BCPK_up] = atoi (value); keyb_gamekeys.keycode[BCPK_up] = atoi (value);
if (!strcmp (keyword, "key_p1_down")) if (!strcmp (keyword, "key_p1_down"))
keyb_gamekeys.keycode[BCPK_down] = atoi (value); keyb_gamekeys.keycode[BCPK_down] = atoi (value);
if (!strcmp (keyword, "key_p1_left")) if (!strcmp (keyword, "key_p1_left"))
keyb_gamekeys.keycode[BCPK_left] = atoi (value); keyb_gamekeys.keycode[BCPK_left] = atoi (value);
if (!strcmp (keyword, "key_p1_right")) if (!strcmp (keyword, "key_p1_right"))
keyb_gamekeys.keycode[BCPK_right] = atoi (value); keyb_gamekeys.keycode[BCPK_right] = atoi (value);
if (!strcmp (keyword, "key_p1_bomb")) if (!strcmp (keyword, "key_p1_bomb"))
keyb_gamekeys.keycode[BCPK_drop] = atoi (value); keyb_gamekeys.keycode[BCPK_drop] = atoi (value);
if (!strcmp (keyword, "key_p1_special")) if (!strcmp (keyword, "key_p1_special"))
keyb_gamekeys.keycode[BCPK_special] = atoi (value); keyb_gamekeys.keycode[BCPK_special] = atoi (value);
if (!strcmp (keyword, "key_p2_up")) if (!strcmp (keyword, "key_p2_up"))
keyb_gamekeys.keycode[BCPK_max + BCPK_up] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_up] = atoi (value);
if (!strcmp (keyword, "key_p2_down")) if (!strcmp (keyword, "key_p2_down"))
keyb_gamekeys.keycode[BCPK_max + BCPK_down] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_down] = atoi (value);
if (!strcmp (keyword, "key_p2_left")) if (!strcmp (keyword, "key_p2_left"))
keyb_gamekeys.keycode[BCPK_max + BCPK_left] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_left] = atoi (value);
if (!strcmp (keyword, "key_p2_right")) if (!strcmp (keyword, "key_p2_right"))
keyb_gamekeys.keycode[BCPK_max + BCPK_right] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_right] = atoi (value);
if (!strcmp (keyword, "key_p2_bomb")) if (!strcmp (keyword, "key_p2_bomb"))
keyb_gamekeys.keycode[BCPK_max + BCPK_drop] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_drop] = atoi (value);
if (!strcmp (keyword, "key_p2_special")) if (!strcmp (keyword, "key_p2_special"))
keyb_gamekeys.keycode[BCPK_max + BCPK_special] = atoi (value); keyb_gamekeys.keycode[BCPK_max + BCPK_special] = atoi (value);
if (!strcmp (keyword, "key_help")) if (!strcmp (keyword, "key_help"))
keyb_gamekeys.keycode[BCK_help] = atoi (value); keyb_gamekeys.keycode[BCK_help] = atoi (value);
if (!strcmp (keyword, "key_playermenu")) if (!strcmp (keyword, "key_playermenu"))
keyb_gamekeys.keycode[BCK_playermenu] = atoi (value); keyb_gamekeys.keycode[BCK_playermenu] = atoi (value);
if (!strcmp (keyword, "key_mapmenu")) if (!strcmp (keyword, "key_mapmenu"))
keyb_gamekeys.keycode[BCK_mapmenu] = atoi (value); keyb_gamekeys.keycode[BCK_mapmenu] = atoi (value);
if (!strcmp (keyword, "key_chat")) if (!strcmp (keyword, "key_chat"))
keyb_gamekeys.keycode[BCK_chat] = atoi (value); keyb_gamekeys.keycode[BCK_chat] = atoi (value);
if (!strcmp (keyword, "key_pause")) if (!strcmp (keyword, "key_pause"))
keyb_gamekeys.keycode[BCK_pause] = atoi (value); keyb_gamekeys.keycode[BCK_pause] = atoi (value);
if (!strcmp (keyword, "key_fullscreen")) if (!strcmp (keyword, "key_fullscreen"))
keyb_gamekeys.keycode[BCK_fullscreen] = atoi (value); keyb_gamekeys.keycode[BCK_fullscreen] = atoi (value);
} }
fclose (config); fclose (config);
return 0; return 0;
@ -437,7 +440,7 @@ int
config_write () config_write ()
{ {
FILE *config; FILE *config;
int i; int i;
char filename[512]; char filename[512];
#ifdef _WIN32 #ifdef _WIN32
@ -466,8 +469,8 @@ config_write ()
fprintf (config, "gametype=%d\n", bman.gametype); fprintf (config, "gametype=%d\n", bman.gametype);
fprintf (config, "maxplayer=%d\n", bman.maxplayer); fprintf (config, "maxplayer=%d\n", bman.maxplayer);
fprintf (config, "debug=%d\n", debug); fprintf (config, "debug=%d\n", debug);
fprintf (config, "password=%s\n", bman.password); fprintf (config, "password=%s\n", bman.password);
fprintf (config, "passwordenabled=%d\n", bman.passwordenabled); fprintf (config, "passwordenabled=%d\n", bman.passwordenabled);
fprintf (config, "askplayername=%d\n", bman.askplayername); fprintf (config, "askplayername=%d\n", bman.askplayername);
fprintf (config, "playername=%s\n", bman.playername); fprintf (config, "playername=%s\n", bman.playername);
fprintf (config, "player2name=%s\n", bman.player2name); fprintf (config, "player2name=%s\n", bman.player2name);
@ -479,37 +482,37 @@ config_write ()
fprintf (config, "sndformat=%d\n", snd.audio_format); fprintf (config, "sndformat=%d\n", snd.audio_format);
fprintf (config, "sndplaymusic=%d\n", snd.playmusic); fprintf (config, "sndplaymusic=%d\n", snd.playmusic);
fprintf (config, "sndplaysound=%d\n", snd.playsound); fprintf (config, "sndplaysound=%d\n", snd.playsound);
fprintf (config, "start_bombs=%d\n", bman.start_bombs); fprintf (config, "start_bombs=%d\n", bman.start_bombs);
fprintf (config, "start_range=%d\n", bman.start_range); fprintf (config, "start_range=%d\n", bman.start_range);
fprintf (config, "start_speed=%f\n", bman.start_speed); fprintf (config, "start_speed=%f\n", bman.start_speed);
fprintf (config, "bomb_ticking=%f\n", bman.bomb_tickingtime); fprintf (config, "bomb_ticking=%f\n", bman.bomb_tickingtime);
for (i = 0; i < MAX_TEAMS; i++) { for (i = 0; i < MAX_TEAMS; i++) {
fprintf (config, "teamcol%d=%d\n", i, teams[i].col); fprintf (config, "teamcol%d=%d\n", i, teams[i].col);
fprintf (config, "teamname%d=%s\n", i, teams[i].name); fprintf (config, "teamname%d=%s\n", i, teams[i].name);
} }
/* /*
* keyboard config * keyboard config
*/ */
fprintf (config, "key_p1_up=%d\n", keyb_gamekeys.keycode[BCPK_up]); fprintf (config, "key_p1_up=%d\n", keyb_gamekeys.keycode[BCPK_up]);
fprintf (config, "key_p1_down=%d\n", keyb_gamekeys.keycode[BCPK_down]); fprintf (config, "key_p1_down=%d\n", keyb_gamekeys.keycode[BCPK_down]);
fprintf (config, "key_p1_left=%d\n", keyb_gamekeys.keycode[BCPK_left]); fprintf (config, "key_p1_left=%d\n", keyb_gamekeys.keycode[BCPK_left]);
fprintf (config, "key_p1_right=%d\n", keyb_gamekeys.keycode[BCPK_right]); fprintf (config, "key_p1_right=%d\n", keyb_gamekeys.keycode[BCPK_right]);
fprintf (config, "key_p1_bomb=%d\n", keyb_gamekeys.keycode[BCPK_drop]); fprintf (config, "key_p1_bomb=%d\n", keyb_gamekeys.keycode[BCPK_drop]);
fprintf (config, "key_p1_special=%d\n", keyb_gamekeys.keycode[BCPK_special]); fprintf (config, "key_p1_special=%d\n", keyb_gamekeys.keycode[BCPK_special]);
fprintf (config, "key_p2_up=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_up]); fprintf (config, "key_p2_up=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_up]);
fprintf (config, "key_p2_down=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_down]); fprintf (config, "key_p2_down=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_down]);
fprintf (config, "key_p2_left=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_left]); fprintf (config, "key_p2_left=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_left]);
fprintf (config, "key_p2_right=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_right]); fprintf (config, "key_p2_right=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_right]);
fprintf (config, "key_p2_bomb=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_drop]); fprintf (config, "key_p2_bomb=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_drop]);
fprintf (config, "key_p2_special=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_special]); fprintf (config, "key_p2_special=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_special]);
fprintf (config, "key_help=%d\n", keyb_gamekeys.keycode[BCK_help]); fprintf (config, "key_help=%d\n", keyb_gamekeys.keycode[BCK_help]);
fprintf (config, "key_fullscreen=%d\n", keyb_gamekeys.keycode[BCK_fullscreen]); fprintf (config, "key_fullscreen=%d\n", keyb_gamekeys.keycode[BCK_fullscreen]);
fprintf (config, "key_chat=%d\n", keyb_gamekeys.keycode[BCK_chat]); fprintf (config, "key_chat=%d\n", keyb_gamekeys.keycode[BCK_chat]);
fprintf (config, "key_mapmenu=%d\n", keyb_gamekeys.keycode[BCK_mapmenu]); fprintf (config, "key_mapmenu=%d\n", keyb_gamekeys.keycode[BCK_mapmenu]);
fprintf (config, "key_pause=%d\n", keyb_gamekeys.keycode[BCK_pause]); fprintf (config, "key_pause=%d\n", keyb_gamekeys.keycode[BCK_pause]);
fprintf (config, "key_playermenu=%d\n", keyb_gamekeys.keycode[BCK_playermenu]); fprintf (config, "key_playermenu=%d\n", keyb_gamekeys.keycode[BCK_playermenu]);
fclose (config); fclose (config);
return 0; return 0;
@ -540,7 +543,7 @@ config_video ()
_charlist *selbpp = NULL; _charlist *selbpp = NULL;
char text[100]; char text[100];
_menu *menu; _menu *menu;
/* set all pointers in this array */ /* set all pointers in this array */
charlist_fillarraypointer (screenres, 5); charlist_fillarraypointer (screenres, 5);
@ -576,14 +579,14 @@ config_video ()
gfx.res.y = y; gfx.res.y = y;
gfx_init (); gfx_init ();
draw_logo (); draw_logo ();
break; break;
case (2): // new color depth case (2): // new color depth
gfx_shutdown (); gfx_shutdown ();
sscanf (selbpp->text, "%d", &x); sscanf (selbpp->text, "%d", &x);
gfx.bpp = x; gfx.bpp = x;
gfx_init (); gfx_init ();
draw_logo (); draw_logo ();
break; break;
default: default:
done = 1; done = 1;
break; break;
@ -602,7 +605,7 @@ void
config_menu () config_menu ()
{ {
int menuselect = 0; int menuselect = 0;
_menu *menu; _menu *menu;
while (menuselect != -1 && bman.state != GS_quit) { while (menuselect != -1 && bman.state != GS_quit) {
menu = menu_new ("Configuration", 400, 300); menu = menu_new ("Configuration", 400, 300);
@ -634,13 +637,13 @@ config_menu ()
else else
menuselect = -1; menuselect = -1;
break; break;
case (1): // player screen case (1): // player screen
playernamemenu (); playernamemenu ();
break; break;
case (2): // keyboard settings case (2): // keyboard settings
keyb_config (); keyb_config ();
break; break;
case (3): // Screen Options case (3): // Screen Options
config_video (); config_video ();
break; break;
} }
@ -665,18 +668,17 @@ ReadPrgArgs (int argc, char **argv)
printf ("\nProgramm options:\n"); printf ("\nProgramm options:\n");
printf (" -name PLAYERNAME - set the Playername\n"); printf (" -name PLAYERNAME - set the Playername\n");
printf (" -name2 PLAYERNAME - set the Playername for the second player\n"); printf (" -name2 PLAYERNAME - set the Playername for the second player\n");
printf (" -gamename GAMENAME - set the name of the game\n"); printf (" -gamename GAMENAME - set the name of the game\n");
printf (" -port PORT - set the local BomberClone port\n"); printf (" -port PORT - set the local BomberClone port\n");
printf (" (Def.: 11000)\n"); printf (" (Def.: 11000)\n");
printf (" -ogcport PORT - set the local OGC Port (Def.: 11100)\n"); printf (" -ogcport PORT - set the local OGC Port (Def.: 11100)\n");
printf (" -ogc 0/1 - Enable/Disable OGC\n"); printf (" -ogc 0/1 - Enable/Disable OGC\n");
printf (" -broadcast 0/1 - Enable/Disable broadcast requests.\n"); printf (" -broadcast 0/1 - Enable/Disable broadcast requests.\n");
printf (" -host - start a network game\n"); printf (" -host - start a network game\n");
printf (" -join - go into the join menu\n"); printf (" -join - go into the join menu\n");
printf (" -connect ADDRESS - connect to a server\n"); printf (" -connect ADDRESS - connect to a server\n");
printf (" -debug 0/1 - enable/disable debug\n"); printf (" -debug 0/1 - enable/disable debug\n");
printf (" -dedicated - run as dedicated server\n"); printf (" -autostart SECONDS - time before a game starts\n");
printf (" -autostart SECONDS - time before a game starts\n");
exit (0); exit (0);
} }
if (!strcmp (argv[i], "-port")) if (!strcmp (argv[i], "-port"))
@ -686,24 +688,18 @@ 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], "-autostart"))
if (bman.minplayers <= 1) bman.autostart = atoi (argv[++i]);
bman.minplayers = 2;
bman.dedicated = 1;
printf ("\nDedicated Bomberclone Server - Version " VERSION "\n\n");
} }
if (!strcmp (argv[i], "-autostart"))
bman.autostart = atoi (argv[++i]);
}
}; };
@ -715,43 +711,45 @@ ReadPrgArgs_Jump (int argc, char **argv)
int i = 0; int i = 0;
while (argv[++i] != NULL) { while (argv[++i] != NULL) {
/* check for commands which will put us into a certain menu */ /* check for commands which will put us into a certain menu */
if (!strcmp (argv[i], "-host")) { if (!strcmp (argv[i], "-host")) {
host_multiplayer_game (); host_multiplayer_game ();
} }
else if (!strcmp (argv[i], "-join")) { else if (!strcmp (argv[i], "-join")) {
join_multiplayer_game (); join_multiplayer_game ();
} }
else if (!strcmp (argv[i], "-connect")) { else if (!strcmp (argv[i], "-connect")) {
strncpy (bman.servername, argv[++i], LEN_SERVERNAME + LEN_PORT + 2); strncpy (bman.servername, argv[++i], LEN_SERVERNAME + LEN_PORT + 2);
join_multiplayer_game (); join_multiplayer_game ();
} }
} }
if (bman.dedicated > 0)
host_multiplayer_game ();
}; };
/* check the version number, return [ 0 =] [-1 <] [ 1 >] */ /* check the version number, return [ 0 =] [-1 <] [ 1 >] */
int check_version (int ma, int mi, int su, char *ver) { int
int v1, v2, v3, res = 0; check_version (int ma, int mi, int su, char *ver)
{
sscanf (ver, "%d.%d.%d", &v1, &v2, &v3); int v1,
if (v1 < ma) v2,
res = -1; v3,
else if (v1 > ma) res = 0;
res = 1;
else if (v2 < mi) sscanf (ver, "%d.%d.%d", &v1, &v2, &v3);
res = -1; if (v1 < ma)
else if (v2 > mi) res = -1;
res = 1; else if (v1 > ma)
else if (v3 < su) res = 1;
res = -1; else if (v2 < mi)
else if (v3 > su) res = -1;
res = 1; else if (v2 > mi)
res = 1;
// d_printf ("version_check (%d.%d.%d, %s = %d\n" , ma, mi, su, ver, res); else if (v3 < su)
res = -1;
return res; else if (v3 > su)
res = 1;
// d_printf ("version_check (%d.%d.%d, %s = %d\n" , ma, mi, su, ver, res);
return res;
}; };

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.15 2005/04/09 18:22:40 stpohle Exp $ */ /* $Id: font.c,v 1.16 2005/07/06 13:11:55 stpohle Exp $ */
// Using Fonts in SDL // Using Fonts in SDL
#include <string.h> #include <string.h>
@ -127,22 +127,17 @@ void font_load () {
break; break;
} }
if (!bman.dedicated) { font[i].image[c] = SDL_DisplayFormat (tmp);
font[i].image[c] = SDL_DisplayFormat (tmp); SDL_SetColorKey (font[i].image[c] , SDL_SRCCOLORKEY, SDL_MapRGB (font[i].image[c]->format, 0,0,0));
SDL_SetColorKey (font[i].image[c] , SDL_SRCCOLORKEY, SDL_MapRGB (font[i].image[c]->format, 0,0,0)); SDL_FillRect (font[i].image[c], NULL, SDL_MapRGB (font[i].image[c]->format, r,g,b));
SDL_FillRect (font[i].image[c], NULL, SDL_MapRGB (font[i].image[c]->format, r,g,b)); SDL_BlitSurface (raw, NULL, font[i].image[c], NULL);
SDL_BlitSurface (raw, NULL, font[i].image[c], NULL);
}
else
font[i].image[c] = tmp;
} }
font[i].size.x = tmp->w / 16; font[i].size.x = tmp->w / 16;
font[i].size.y = tmp->h / 16; font[i].size.y = tmp->h / 16;
SDL_FreeSurface (raw); SDL_FreeSurface (raw);
if (!bman.dedicated) SDL_FreeSurface (tmp);
SDL_FreeSurface (tmp);
} }
}; };

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
/* $Id: gfx.c,v 1.40 2005/04/09 18:22:40 stpohle Exp $ */ /* $Id: gfx.c,v 1.41 2005/07/06 13:11:55 stpohle Exp $ */
/* gfx.c */ /* gfx.c */
#include "bomberclone.h" #include "bomberclone.h"
@ -66,23 +66,16 @@ gfx_load_players (int sx, int sy)
gfx.players[i].ani.w = (tmpimage->w / 4) * sfkt; gfx.players[i].ani.w = (tmpimage->w / 4) * sfkt;
gfx.players[i].ani.frames = tmpimage->h / GFX_PLAYERIMGSIZE_Y; gfx.players[i].ani.frames = tmpimage->h / GFX_PLAYERIMGSIZE_Y;
if (!bman.dedicated) { tmpimage1 = scale_image (tmpimage, gfx.players[i].ani.w * 4, gfx.players[i].ani.frames * gfx.players[i].ani.h);
tmpimage1 = getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
scale_image (tmpimage, gfx.players[i].ani.w * 4, SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.players[i].ani.frames * gfx.players[i].ani.h); gfx.players[i].ani.image = SDL_DisplayFormat (tmpimage1);
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); SDL_FreeSurface (tmpimage1);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.players[i].ani.image = SDL_DisplayFormat (tmpimage1);
SDL_FreeSurface (tmpimage1);
/* calculate the numbers of images for the animation */
gfx.players[i].offset.x = (sx - gfx.players[i].ani.w) / 2;
gfx.players[i].offset.y = -sy;
}
else
gfx.players[i].ani.image = NULL;
SDL_FreeSurface (tmpimage); /* calculate the numbers of images for the animation */
gfx.players[i].offset.x = (sx - gfx.players[i].ani.w) / 2;
gfx.players[i].offset.y = -sy;
SDL_FreeSurface (tmpimage);
} }
} }
@ -96,48 +89,38 @@ gfx_load_players (int sx, int sy)
} }
gfx.dead.frames = tmpimage->h / (2* GFX_IMGSIZE); gfx.dead.frames = tmpimage->h / (2* GFX_IMGSIZE);
if (!bman.dedicated) { tmpimage1 = scale_image (tmpimage, ((2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE)), gfx.dead.frames * (2 * sy));
tmpimage1 = getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
scale_image (tmpimage, ((2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE)), SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
gfx.dead.frames * (2 * sy)); gfx.dead.image = SDL_DisplayFormat (tmpimage1);
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); SDL_FreeSurface (tmpimage1);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b)); SDL_FreeSurface (tmpimage);
gfx.dead.image = SDL_DisplayFormat (tmpimage1);
SDL_FreeSurface (tmpimage1);
SDL_FreeSurface (tmpimage);
/* load the illnessthing */ /* load the illnessthing */
sprintf (filename, "%s/player/playersick.png", bman.datapath); sprintf (filename, "%s/player/playersick.png", bman.datapath);
tmpimage = IMG_Load (filename); tmpimage = IMG_Load (filename);
if (tmpimage == NULL) { if (tmpimage == NULL) {
printf ("Can't load image: %s\n", SDL_GetError ()); printf ("Can't load image: %s\n", SDL_GetError ());
exit (1); exit (1);
} }
gfx.ill.frames = tmpimage->h / (2 * GFX_IMGSIZE); gfx.ill.frames = tmpimage->h / (2 * GFX_IMGSIZE);
tmpimage1 = tmpimage1 = scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE), gfx.ill.frames * (2 * sy));
scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE), getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
gfx.ill.frames * (2 * sy)); SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b));
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b); gfx.ill.image = SDL_DisplayFormat (tmpimage1);
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, r, g, b)); SDL_FreeSurface (tmpimage);
gfx.ill.image = SDL_DisplayFormat (tmpimage1); SDL_FreeSurface (tmpimage1);
SDL_FreeSurface (tmpimage);
SDL_FreeSurface (tmpimage1); /* load the respawn gfx */
sprintf (filename, "%s/player/respawn.png", bman.datapath);
/* load the respawn gfx */ tmpimage = IMG_Load (filename);
sprintf (filename, "%s/player/respawn.png", bman.datapath); if (tmpimage == NULL) {
tmpimage = IMG_Load (filename); printf ("Can't load image: %s\n", SDL_GetError ());
if (tmpimage == NULL) { exit (1);
printf ("Can't load image: %s\n", SDL_GetError ()); }
exit (1); gfx.respawn.frames = tmpimage->h / (2 * GFX_IMGSIZE);
} gfx.respawn.image = scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE), gfx.respawn.frames * (2 * sy));
gfx.respawn.frames = tmpimage->h / (2 * GFX_IMGSIZE); SDL_FreeSurface (tmpimage);
gfx.respawn.image =
scale_image (tmpimage, (2 * sx * tmpimage->w) / (2 * GFX_IMGSIZE),
gfx.respawn.frames * (2 * sy));
SDL_FreeSurface (tmpimage);
}
else
SDL_FreeSurface (tmpimage);
}; };
@ -147,7 +130,7 @@ gfx_free_players ()
{ {
int i; int i;
d_printf ("gfx_free_players\n"); d_printf ("gfx_free_players\n");
for (i = 0; i < gfx.player_gfx_count; i++) { for (i = 0; i < gfx.player_gfx_count; i++) {
if (gfx.players[i].ani.image != NULL) if (gfx.players[i].ani.image != NULL)
@ -170,22 +153,15 @@ gfx_init ()
{ {
int i; int i;
if (gfx.fullscreen && !bman.dedicated) if (gfx.fullscreen)
gfx.screen = gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN);
SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp,
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN);
else if (!bman.dedicated) else
gfx.screen = gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp, if (gfx.screen == NULL) {
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
if (!bman.dedicated && gfx.screen == NULL) {
d_printf ("Unable to set video mode: %s\n", SDL_GetError ()); d_printf ("Unable to set video mode: %s\n", SDL_GetError ());
return; return;
} }
else if (bman.dedicated) {
gfx.screen = NULL;
}
SDL_ShowCursor (SDL_DISABLE); SDL_ShowCursor (SDL_DISABLE);
/* delete small gfx und the menu player gfx */ /* delete small gfx und the menu player gfx */
@ -532,14 +508,13 @@ draw_logo ()
{ {
SDL_Rect dest; SDL_Rect dest;
if (bman.dedicated) return;
dest.x = dest.y = 0; dest.x = dest.y = 0;
dest.w = gfx.res.x; dest.w = gfx.res.x;
dest.h = gfx.res.y; dest.h = gfx.res.y;
SDL_BlitSurface (gfx.logo, NULL, gfx.screen, NULL); SDL_BlitSurface (gfx.logo, NULL, gfx.screen, NULL);
gfx_blitupdaterectadd (&dest); gfx_blitupdaterectadd (&dest);
}; };

@ -1,4 +1,4 @@
/* $Id: gfxengine.c,v 1.6 2005/04/09 18:22:41 stpohle Exp $ */ /* $Id: gfxengine.c,v 1.7 2005/07/06 13:11:55 stpohle Exp $ */
/* GFX Game Engine */ /* GFX Game Engine */
#include "bomberclone.h" #include "bomberclone.h"
@ -103,7 +103,7 @@ gfx_blitdraw ()
{ {
int i; int i;
if (blitdb_nr < 0 || bman.dedicated) { if (blitdb_nr < 0) {
blitdb_nr = 0; blitdb_nr = 0;
return; return;
} }
@ -111,7 +111,7 @@ gfx_blitdraw ()
gfx_blitsort (); gfx_blitsort ();
for (i = 0; i < MAX_BLITRECTS && sortblitdb[i] != NULL; i++) { for (i = 0; i < MAX_BLITRECTS && sortblitdb[i] != NULL; i++) {
SDL_BlitSurface (sortblitdb[i]->srci, &sortblitdb[i]->srcr, sortblitdb[i]->desti, &sortblitdb[i]->destr); SDL_BlitSurface (sortblitdb[i]->srci, &sortblitdb[i]->srcr, sortblitdb[i]->desti, &sortblitdb[i]->destr);
gfx_blitupdaterectadd (&sortblitdb[i]->destr); gfx_blitupdaterectadd (&sortblitdb[i]->destr);
} }

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.31 2005/04/09 18:22:41 stpohle Exp $ */ /* $Id: main.c,v 1.32 2005/07/06 13:11:55 stpohle Exp $ */
#include "basic.h" #include "basic.h"
#include "bomberclone.h" #include "bomberclone.h"
@ -42,7 +42,7 @@ main (int argc, char **argv)
config_init (argc, argv); config_init (argc, argv);
while (menuselect != -1 && bman.state != GS_quit && bman.dedicated == 0) { while (menuselect != -1 && bman.state != GS_quit) {
menu = menu_new ("Bomberclone", 400, 250); // y=230 menu = menu_new ("Bomberclone", 400, 250); // y=230
menu_create_button (menu, "Single Game", -1, 70, 200, 0); menu_create_button (menu, "Single Game", -1, 70, 200, 0);

@ -1,4 +1,4 @@
/* $Id: multiwait.c,v 1.55 2005/04/09 18:22:41 stpohle Exp $ /* $Id: multiwait.c,v 1.56 2005/07/06 13:11:55 stpohle Exp $
multiwait.c - this manages only the network screen where multiwait.c - this manages only the network screen where
everyone have to select it's players and where even the basic chat is inside everyone have to select it's players and where even the basic chat is inside
*/ */
@ -33,30 +33,24 @@ extern int blitdb_nr;
static void mw_init () static void mw_init ()
{ {
team_update (); team_update ();
if (!bman.dedicated) { gfx_blitdraw ();
gfx_blitdraw (); draw_logo ();
draw_logo (); gfx_blitdraw ();
gfx_blitdraw (); bman.updatestatusbar = 1;
}
bman.updatestatusbar = 1;
d_playerdetail ("mw_init:\n"); d_playerdetail ("mw_init:\n");
if (!bman.dedicated) { SDL_Flip (gfx.screen);
SDL_Flip (gfx.screen); chat_show (10, gfx.res.y / 2, gfx.res.x - 20, gfx.res.y / 2 - 10);
chat_show (10, gfx.res.y / 2, gfx.res.x - 20, gfx.res.y / 2 - 10); chat_setactive (1, 1);
chat_setactive (1, 1);
}
}; };
/* free all graphics */ /* free all graphics */
static void mw_shutdown () { static void mw_shutdown () {
if (!bman.dedicated) { chat_show (-1, -1, -1, -1);
chat_show (-1, -1, -1, -1); gfx_blitdraw ();
gfx_blitdraw (); draw_logo ();
draw_logo ();
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
}
}; };
@ -241,50 +235,25 @@ void wait_for_players () {
/* /*
* the drawing stuff * the drawing stuff
*/ */
if (!bman.dedicated) { if (mw_check_screenredraw()) {
if (mw_check_screenredraw()) { d_printf ("Draw Status\n");
d_printf ("Draw Status\n");
gfx_blitdraw ();
draw_logo ();
if (bman.gametype==GT_team) mw_draw_all_teams();
else mw_draw_all_player ();
}
gfx_blitdraw (); gfx_blitdraw ();
draw_logo ();
/* if (bman.gametype==GT_team) mw_draw_all_teams();
* input handling else mw_draw_all_player ();
*/
keyb_loop (&event);
mw_keys_loop ();
chat_loop (&event);
chat.active = 1;
}
else {
/* check for the minimum of players */
for (humanpl_cnt = 0, i = 0, cnt = 0, aipl = -1; i < MAX_PLAYERS; i++) {
if (PS_IS_used (players[i].state)) {
cnt++;
if (PS_IS_aiplayer (players[i].state))
aipl = i;
else if (players[i].gfx_nr >= 0)
humanpl_cnt++;
}
}
if (cnt < (bman.minplayers+1))
single_create_ai (1);
if (cnt > (bman.minplayers+1) && aipl >= 0)
player_delete (aipl);
} }
gfx_blitdraw ();
s_calctimesync (); /*
* input handling
*/
keyb_loop (&event);
mw_keys_loop ();
if ((bman.autostart > 0) && (timestamp > timeout_timestamp) && bman.dedicated && humanpl_cnt > 0) chat_loop (&event);
bman.state = GS_ready; chat.active = 1;
s_calctimesync ();
} while (bman.state == GS_wait && bman.sock != -1); } while (bman.state == GS_wait && bman.sock != -1);
mw_shutdown (); mw_shutdown ();

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.74 2005/04/10 00:22:17 stpohle Exp $ */ /* $Id: network.c,v 1.75 2005/07/06 13:11:56 stpohle Exp $ */
/* /*
network routines. network routines.
*/ */
@ -477,14 +477,12 @@ net_transmit_gamedata ()
Uint8 *keys; Uint8 *keys;
Uint32 downtimestamp = 0; Uint32 downtimestamp = 0;
if (!bman.dedicated) { draw_logo ();
draw_logo ();
if (GT_MP_PTPM) if (GT_MP_PTPM)
font_draw (100, 0, "Waiting for the Clients", 1, 0); font_draw (100, 0, "Waiting for the Clients", 1, 0);
else else
font_draw (100, 0, "Downloading Data", 1, 0); font_draw (100, 0, "Downloading Data", 1, 0);
}
/* /*
prepare everything for the loop prepare everything for the loop
@ -505,10 +503,8 @@ net_transmit_gamedata ()
else else
net_istep = 3; net_istep = 3;
if (!bman.dedicated) { draw_netupdatestate (1);
draw_netupdatestate (1); SDL_Flip (gfx.screen);
SDL_Flip (gfx.screen);
}
downtimestamp = timestamp; downtimestamp = timestamp;
while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) { while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) {
@ -617,40 +613,37 @@ net_transmit_gamedata ()
} }
/* do the grafik work */ /* do the grafik work */
if (!bman.dedicated) { draw_netupdatestate (0);
draw_netupdatestate (0);
if (SDL_PollEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
bman.state = GS_quit;
bman.p_nr = -1;
done = 1;
}
keys = SDL_GetKeyState (NULL); if (SDL_PollEvent (&event) != 0)
switch (event.type) {
if (keys[SDLK_ESCAPE] && event.type == SDL_KEYDOWN) { case (SDL_QUIT):
done = 1; bman.state = GS_quit;
bman.p_nr = -1; bman.p_nr = -1;
keypressed = 1; done = 1;
bman.state = GS_startup;
} }
if (event.type == SDL_KEYUP) keys = SDL_GetKeyState (NULL);
keypressed = 0;
}
timestamp = SDL_GetTicks (); // needed for time sync.
SDL_Delay (1); // we don't need here anything better
/* player is only watching so just go after we have got everything if (keys[SDLK_ESCAPE] && event.type == SDL_KEYDOWN) {
go to show the field */
if (GT_MP_PTPS && bman.state == GS_update && net_istep == 0
&& players[bman.p_nr].gfx_nr == -1) {
done = 1; done = 1;
bman.state = GS_running; bman.p_nr = -1;
keypressed = 1;
bman.state = GS_startup;
} }
if (event.type == SDL_KEYUP)
keypressed = 0;
}
timestamp = SDL_GetTicks (); // needed for time sync.
SDL_Delay (1); // we don't need here anything better
/* player is only watching so just go after we have got everything
go to show the field */
if (GT_MP_PTPS && bman.state == GS_update && net_istep == 0 && players[bman.p_nr].gfx_nr == -1) {
done = 1;
bman.state = GS_running;
} }
}; };

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.101 2005/04/11 22:21:14 stpohle Exp $ /* $Id: player.c,v 1.102 2005/07/06 13:11:56 stpohle Exp $
* player.c - everything what have to do with the player */ * player.c - everything what have to do with the player */
#include <SDL.h> #include <SDL.h>
@ -18,9 +18,6 @@ draw_player (_player * player)
dest; dest;
int i; int i;
if (bman.dedicated)
return;
if ((int)player->pos.x < 0 || (int)player->pos.x >= map.size.x || if ((int)player->pos.x < 0 || (int)player->pos.x >= map.size.x ||
(int)player->pos.y < 0 || (int)player->pos.y >= map.size.y) { (int)player->pos.y < 0 || (int)player->pos.y >= map.size.y) {
d_printf ("FATAL: Draw Player out of range : [%f,%f]\n", player->pos.x, d_printf ("FATAL: Draw Player out of range : [%f,%f]\n", player->pos.x,
@ -582,8 +579,6 @@ draw_players ()
{ {
int p; int p;
if (bman.dedicated) return;
for (p = 0; p < MAX_PLAYERS; p++) { for (p = 0; p < MAX_PLAYERS; p++) {
if (PS_IS_playing (players[p].state) && players[p].tunnelto <= 0) if (PS_IS_playing (players[p].state) && players[p].tunnelto <= 0)
draw_player (&players[p]); draw_player (&players[p]);

@ -1,4 +1,4 @@
/* $Id: playermenu.c,v 1.16 2004/12/26 04:19:20 stpohle Exp $ /* $Id: playermenu.c,v 1.17 2005/07/06 13:11:56 stpohle Exp $
*/ */
#include "bomberclone.h" #include "bomberclone.h"
@ -28,6 +28,8 @@ static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu) {
static int changed = 0; static int changed = 0;
SDL_Rect rect, srcrect; SDL_Rect rect, srcrect;
int i; int i;
int i_start;
int i_end;
/* /*
* delete old state, to force an update of all playergfx * delete old state, to force an update of all playergfx
@ -50,26 +52,36 @@ static void playermenu_selgfx_drawplayer (int selgfx, _menu *menu) {
rect.h = 4 * GFX_IMGSIZE; rect.h = 4 * GFX_IMGSIZE;
menu_draw_background (menu, &rect); menu_draw_background (menu, &rect);
for (i = 0; i < gfx.player_gfx_count; i++) { /* calculate the first element on the screen */
srcrect.h = rect.h = gfx.players[i].menu_image->h; if (gfx.player_gfx_count < 12 || selgfx < 4) i_start = 0;
srcrect.w = rect.w = gfx.players[i].menu_image->w; else {
i_start = (((selgfx / 4)-1) * 4);
if (i_start < 0) i_start = 0;
}
if ((i_end = i_start + 12) > gfx.player_gfx_count)
i_end = gfx.player_gfx_count;
for (i = 0; i < i_end - i_start; i++) {
srcrect.h = rect.h = gfx.players[i + i_start].menu_image->h;
srcrect.w = rect.w = gfx.players[i + i_start].menu_image->w;
rect.x = (2 * GFX_MENUPLAYERIMGSIZE_X) * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) - (8 * GFX_MENUPLAYERIMGSIZE_X)) / 2; rect.x = (2 * GFX_MENUPLAYERIMGSIZE_X) * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) - (8 * GFX_MENUPLAYERIMGSIZE_X)) / 2;
rect.y = (GFX_MENUPLAYERIMGSIZE_X * 2) * (i / 4) + PLAYERMENU_GFXSEL_Y; rect.y = (GFX_MENUPLAYERIMGSIZE_X * 2) * (i / 4) + PLAYERMENU_GFXSEL_Y;
srcrect.x = 0; srcrect.x = 0;
srcrect.y = 0; srcrect.y = 0;
rect.x += menu->oldscreenpos.x + menuimages[0]->w; rect.x += menu->oldscreenpos.x + menuimages[0]->w;
rect.y += menu->oldscreenpos.y + menuimages[0]->h; rect.y += menu->oldscreenpos.y + menuimages[0]->h;
gfx_blit (gfx.players[i].menu_image, &srcrect, gfx.screen, &rect, 10002); gfx_blit (gfx.players[i + i_start].menu_image, &srcrect, gfx.screen, &rect, 10002);
/* draw the select border */ /* draw the select border */
if (i == selgfx) { if ((i + i_start) == selgfx) {
srcrect.x = 0; srcrect.x = 0;
srcrect.y = 0; srcrect.y = 0;
srcrect.h = rect.h = GFX_IMGSIZE; srcrect.h = rect.h = GFX_IMGSIZE;
srcrect.w = rect.w = GFX_IMGSIZE; srcrect.w = rect.w = GFX_IMGSIZE;
rect.x = GFX_IMGSIZE * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) -(4 * GFX_IMGSIZE)) / 2; rect.x = GFX_IMGSIZE * (i % 4) + ((menu->oldscreenpos.w - 2 * menuimages[0]->w) -(4 * GFX_IMGSIZE)) / 2;
rect.y = GFX_IMGSIZE * (i / 4) + PLAYERMENU_GFXSEL_Y; rect.y = GFX_IMGSIZE * (i / 4) + PLAYERMENU_GFXSEL_Y;
rect.x += (gfx.players[i].menu_image->w - gfx.menuselect.image->w) / 2; // center the playergfx rect.x += (gfx.players[i + i_start].menu_image->w - gfx.menuselect.image->w) / 2; // center the playergfx
rect.x += menu->oldscreenpos.x + menuimages[0]->w; rect.x += menu->oldscreenpos.x + menuimages[0]->w;
rect.y += menu->oldscreenpos.y + menuimages[0]->h; rect.y += menu->oldscreenpos.y + menuimages[0]->h;
gfx_blit (gfx.menuselect.image, &srcrect, gfx.screen, &rect, 10001); gfx_blit (gfx.menuselect.image, &srcrect, gfx.screen, &rect, 10001);
@ -98,7 +110,10 @@ int playermenu_selgfx (int pl_nr) {
playermenu_selgfx_drawplayer (-1, NULL); playermenu_selgfx_drawplayer (-1, NULL);
player_set_gfx (&players[pl_nr], -1); player_set_gfx (&players[pl_nr], -1);
menu = menu_new ("Player Selection", 400, 270); if (gfx.player_gfx_count > 8)
menu = menu_new ("Player Selection", 400, 330);
else
menu = menu_new ("Player Selection", 400, 270);
menu_create_text (menu, "playergfxsel", -1, 50, 40, 5, COLOR_yellow, "%s, please select your Player and press ENTER/RETURN or press ESCAPE for no player (that means you will only watch the next game).", players[pl_nr].name); menu_create_text (menu, "playergfxsel", -1, 50, 40, 5, COLOR_yellow, "%s, please select your Player and press ENTER/RETURN or press ESCAPE for no player (that means you will only watch the next game).", players[pl_nr].name);
menu->looprunning = 1; menu->looprunning = 1;

@ -1,4 +1,4 @@
/* $Id: sound.c,v 1.7 2005/04/09 18:22:41 stpohle Exp $ */ /* $Id: sound.c,v 1.8 2005/07/06 13:11:56 stpohle Exp $ */
/* sound */ /* sound */
#include "sound.h" #include "sound.h"
@ -80,11 +80,6 @@ void
snd_init () snd_init ()
{ {
#if HAVE_SDL_MIXER #if HAVE_SDL_MIXER
if (bman.dedicated) {
snd.inited = 0;
return;
}
if (Mix_OpenAudio (snd.audio_rate, snd.audio_format, snd.audio_channels, 1024) < 0) { if (Mix_OpenAudio (snd.audio_rate, snd.audio_format, snd.audio_channels, 1024) < 0) {
d_printf ("Couldn't open audio mixer: %s\n", SDL_GetError ()); d_printf ("Couldn't open audio mixer: %s\n", SDL_GetError ());
snd.inited = 0; snd.inited = 0;

Loading…
Cancel
Save