Error message, if you host a game and firewall is enabled

Progress-Bars finished
Chat input in Multiwait-menu is now smoother.
origin
patty21 22 years ago
parent 3a83061d2c
commit e4245211c0

@ -1,4 +1,4 @@
$Id: ChangeLog,v 1.67 2004/02/02 23:26:50 patty21 Exp $ $Id: ChangeLog,v 1.68 2004/02/04 22:56:47 patty21 Exp $
- Fixed: forgot to put the Message F4 to start the game - Fixed: forgot to put the Message F4 to start the game
into the playerselection screen. I put this only into the into the playerselection screen. I put this only into the
@ -16,10 +16,16 @@ $Id: ChangeLog,v 1.67 2004/02/02 23:26:50 patty21 Exp $
- Fixed: Logo is now shown after change of resolution. - Fixed: Logo is now shown after change of resolution.
- Fixed: Bombtickingtime could not be readen from the config - Fixed: Bombtickingtime could not be read from the config
file. file.
* Changed: Download-Screen shows now a progress bar. - Fixed: If you select "Host a Netgame" nothing happened if firewall was
enabled. Now a error message is displayed.
- Fixed: Chat input in multiplayer wait menu is now smoother.
- Changed: Download-Screen shows now a progress bar. Additionally, every
player can now see the download progress of all other players.
Version 0.11.1 Version 0.11.1

@ -1,4 +1,4 @@
/* $Id: network.h,v 1.15 2004/02/02 23:30:34 patty21 Exp $ /* $Id: network.h,v 1.16 2004/02/04 22:56:55 patty21 Exp $
* network.h file... for everything what have to do with the network stuff * network.h file... for everything what have to do with the network stuff
*/ */
@ -19,6 +19,7 @@
#define DYN_PKG_MIN_MISSING 1 #define DYN_PKG_MIN_MISSING 1
#define PKG_SENDSETOPT 2 #define PKG_SENDSETOPT 2
#define MAX_SRVLIST 512 #define MAX_SRVLIST 512
#define TIME_UPDATEINFO 1000
#define GT_MP_PTPM (bman.p_nr == bman.p_servnr && bman.sock >= 0) #define GT_MP_PTPM (bman.p_nr == bman.p_servnr && bman.sock >= 0)
#define GT_MP_PTPS (bman.p_nr != bman.p_servnr && bman.sock >= 0) #define GT_MP_PTPS (bman.p_nr != bman.p_servnr && bman.sock >= 0)
@ -118,6 +119,7 @@ extern int net_check_timeout (int pl_nr);
extern void net_dyn_pkgoption (); extern void net_dyn_pkgoption ();
extern void net_send_chat (char *text, signed char notigamesrv); extern void net_send_chat (char *text, signed char notigamesrv);
extern void net_send_mapinfo (); extern void net_send_mapinfo ();
extern void net_send_updateinfo ();
extern void send_ogc_update (); extern void send_ogc_update ();
// multiwait.c // multiwait.c

@ -25,7 +25,8 @@ enum _network_data {
PKG_special, // forward PKG_special, // forward
PKG_dropitem, // forward PKG_dropitem, // forward
PKG_respawn, // forward PKG_respawn, // forward
PKG_quit // always the last known type PKG_updateinfo, // forward
PKG_quit // always the last known type
}; };
@ -235,6 +236,12 @@ struct pkg_ill {
Sint32 to[PI_max]; Sint32 to[PI_max];
}; };
struct pkg_updateinfo {
struct pkgheader h;
signed char pl_nr;
unsigned char step[MAX_PLAYERS];
unsigned char status[MAX_PLAYERS];
};
struct pkg_respawn { struct pkg_respawn {
struct pkgheader h; struct pkgheader h;
@ -318,6 +325,7 @@ extern void do_joingame (struct pkg_joingame *p_jg, _net_addr * addr);
extern void do_field (struct pkg_field *f_dat, _net_addr *addr); extern void do_field (struct pkg_field *f_dat, _net_addr *addr);
extern void do_ping (struct pkg_ping *p_dat, _net_addr *addr); extern void do_ping (struct pkg_ping *p_dat, _net_addr *addr);
extern void do_playerdata (struct pkg_playerdata *p_dat, _net_addr *addr); extern void do_playerdata (struct pkg_playerdata *p_dat, _net_addr *addr);
extern void do_updateinfo(struct pkg_updateinfo *stat, _net_addr *addr);
extern void do_playermove (struct pkg_playermove *p_dat, _net_addr *addr); extern void do_playermove (struct pkg_playermove *p_dat, _net_addr *addr);
extern void do_bombdata (struct pkg_bombdata *b_dat, _net_addr *addr); extern void do_bombdata (struct pkg_bombdata *b_dat, _net_addr *addr);
extern void do_quit (struct pkg_quit *q_dat, _net_addr *addr); extern void do_quit (struct pkg_quit *q_dat, _net_addr *addr);
@ -356,6 +364,7 @@ extern void send_chat (_net_addr *addr, char *text);
extern void send_ill (_net_addr *addr, int p_nr, _player *pl); extern void send_ill (_net_addr *addr, int p_nr, _player *pl);
extern void send_special (_net_addr *addr, int p_nr, int typ, int ex_nr); extern void send_special (_net_addr *addr, int p_nr, int typ, int ex_nr);
extern void send_mapinfo (_net_addr *addr); extern void send_mapinfo (_net_addr *addr);
extern void send_updateinfo(_net_addr *addr);
extern void send_tunneldata (_net_addr *addr, int tunnelnr, int x, int y); extern void send_tunneldata (_net_addr *addr, int tunnelnr, int x, int y);
extern void send_dropitems (_net_addr *addr, int pl_nr, _flyingitem **fitems, int cnt); extern void send_dropitems (_net_addr *addr, int pl_nr, _flyingitem **fitems, int cnt);
extern void send_respawn (_net_addr * addr, int plnr); extern void send_respawn (_net_addr * addr, int plnr);

@ -158,7 +158,8 @@ chat_clearscreen (signed char all)
src.y = 2; src.y = 2;
src.w = chat.window.w - 4; src.w = chat.window.w - 4;
src.h = chat.window.h - 4; src.h = chat.window.h - 4;
} gfx_blitupdaterectadd (&chat.window);
}
else { else {
/* redraw only the textline of out input box */ /* redraw only the textline of out input box */
dest.x = chat.window.x + 2; dest.x = chat.window.x + 2;
@ -168,7 +169,8 @@ chat_clearscreen (signed char all)
src.x = 2; src.x = 2;
src.y = chat.window.h - 18; src.y = chat.window.h - 18;
} gfx_blitupdaterectadd (&dest);
}
SDL_BlitSurface (chat.oldscreen, &src, gfx.screen, &dest); SDL_BlitSurface (chat.oldscreen, &src, gfx.screen, &dest);
if (all == 1) { if (all == 1) {
@ -182,8 +184,6 @@ chat_clearscreen (signed char all)
src.w = src.x + chat.window.w - 4; src.w = src.x + chat.window.w - 4;
src.h = src.y + font[0].size.y; src.h = src.y + font[0].size.y;
draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_DARK >> 1); draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_DARK >> 1);
gfx_blitupdaterectadd (&chat.window);
}; };

@ -249,8 +249,8 @@ wait_for_players ()
ready = 0, ready = 0,
keypressed = 0, keypressed = 0,
i, i,
selgfx = 0; selgfx = 0,
drawgfx=1;
mw_init (); mw_init ();
draw_logo (); draw_logo ();
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
@ -286,8 +286,11 @@ wait_for_players ()
mw_draw_status (); mw_draw_status ();
bman.updatestatusbar = 0; bman.updatestatusbar = 0;
} }
mw_draw_gfxselect (selgfx); if (!--drawgfx) {
mw_draw_chat (); mw_draw_gfxselect (selgfx);
mw_draw_chat ();
drawgfx=5;
}
} }
gfx_blitdraw (); gfx_blitdraw ();
@ -406,7 +409,7 @@ wait_for_players ()
else if (event.type == SDL_KEYDOWN && event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT) else if (event.type == SDL_KEYDOWN && event.key.keysym.sym != SDLK_RSHIFT && event.key.keysym.sym != SDLK_LSHIFT)
keypressed = 1; keypressed = 1;
s_delay (25); s_delay (5);
} }
gfx_blitdraw (); // to clean the gfx blit data gfx_blitdraw (); // to clean the gfx blit data

@ -123,15 +123,24 @@ multiplayer_firstrun ()
bman.players_nr_s = 1; bman.players_nr_s = 1;
}; };
void host_multiplayer_errormessage()
{
menu_new ("Error", 400, 150);
menu_create_label ("You cannot host a game", 60, 54, 0);
menu_create_label ("with Firewall option enabled.", 60, 84, 0);
menu_loop ();
menu_delete ();
}
/* /*
* We will host a network game * We will host a network game
*/ */
void host_multiplayer_game () { void host_multiplayer_game () {
if (bman.firewall) { if (bman.firewall) {
host_multiplayer_errormessage();
return; return;
} }
multiplayer_firstrun (); multiplayer_firstrun ();
if (network_init () < 0) { if (network_init () < 0) {
@ -192,6 +201,8 @@ void multiplayer_game () {
}; };
/* We will join a network game */ /* We will join a network game */
void void
join_multiplayer_game () join_multiplayer_game ()

@ -1,4 +1,4 @@
/* $Id: network.c,v 1.60 2004/02/02 23:30:35 patty21 Exp $ */ /* $Id: network.c,v 1.61 2004/02/04 22:56:55 patty21 Exp $ */
/* /*
network routines. network routines.
*/ */
@ -284,18 +284,22 @@ void
draw_netupdatestate (char st) draw_netupdatestate (char st)
{ {
char text[255]; char text[255];
unsigned char b;
int y = 0, int y = 0,
b1,
z, z,
zx=200,
i, i,
j; j,
s=map.size.y+MAX_PLAYERS+GAME_MAX_TUNNELS;
SDL_Rect src, SDL_Rect src,
dest; dest;
z=gfx.res.x-110; z=gfx.res.x-zx-30-8;
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
if (PS_IS_used (players[i].state)) { if (PS_IS_used (players[i].state)) {
y += 48; y += 50;
if (st) { if (st) {
redraw_logo (0, y, gfx.res.x, y + 48); redraw_logo (0, y, gfx.res.x, y + 50);
if (players[i].gfx_nr != -1) { if (players[i].gfx_nr != -1) {
dest.w = src.w = players[i].gfx->smal_size.x; dest.w = src.w = players[i].gfx->smal_size.x;
@ -310,56 +314,89 @@ draw_netupdatestate (char st)
gfx_blitupdaterectadd (&dest); gfx_blitupdaterectadd (&dest);
} }
dest.x = 70; dest.x = zx;
dest.y = y+20; dest.y = y;
dest.w = menu.listimages[1][0]->w; dest.w = menu.listimages[1][0]->w;
dest.h = menu.listimages[1][0]->h; dest.h = menu.listimages[1][0]->h;
gfx_blit (menu.listimages[1][0], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][0], NULL, gfx.screen, &dest, 10000);
dest.x = z+70+6; dest.x = z+zx+4;
gfx_blit (menu.listimages[1][2], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][2], NULL, gfx.screen, &dest, 10000);
// draw the bottom left and right of the list // draw the bottom left and right of the list
dest.y = y+36; dest.y = y+29;
gfx_blit (menu.listimages[1][8], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][8], NULL, gfx.screen, &dest, 10000);
dest.x = 70; dest.x = zx;
gfx_blit (menu.listimages[1][6], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][6], NULL, gfx.screen, &dest, 10000);
//top & bottom //top & bottom
for (j=4;j<z;j+=4) { for (j=4;j<z+4;j+=4) {
dest.x=j+70;dest.y=y+20; dest.x=j+zx;dest.y=y;
gfx_blit (menu.listimages[1][1], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][1], NULL, gfx.screen, &dest, 10000);
dest.y = y+36; dest.y = y+29;
gfx_blit (menu.listimages[1][7], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][7], NULL, gfx.screen, &dest, 10000);
} }
//left &right //left &right
for (j=4;j<16;j+=4) { for (j=4;j<29;j+=4) {
dest.x=70;dest.y=y+20+j; dest.x=zx;dest.y=y+j;
gfx_blit (menu.listimages[1][3], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][3], NULL, gfx.screen, &dest, 10000);
dest.x = z+70+6; dest.x = z+zx+4;
gfx_blit (menu.listimages[1][5], NULL, gfx.screen, &dest, 10000); gfx_blit (menu.listimages[1][5], NULL, gfx.screen, &dest, 10000);
} }
sprintf (text, "%s", players[i].name);
font_draw (80, y, text, 0, 4);
} }
else // calc percentage, this a range from 0 to 255)
redraw_logo(75,y+30,75+z-10,y+40); switch(players[i].net.net_istep){
case 3:
sprintf (text, "Getting Tunnel Data %d.", players[i].net.net_status);
b=(players[i].net.net_status+1)*255/s;
break;
case 2:
sprintf (text, "Getting Field Data %d of %d.", players[i].net.net_status,
map.size.y);
b=(players[i].net.net_status+1+GAME_MAX_TUNNELS)*255/s;
break;
case 1:
sprintf (text, "Getting Player Data %d of %d.", players[i].net.net_status,
MAX_PLAYERS);
b=(players[i].net.net_status+1+GAME_MAX_TUNNELS+map.size.y)*255/s;
break;
default:
sprintf (text, "Ready");
b=255;
break;
}
if (players[i].net.net_istep == 0) //draw bar
sprintf (text, "%s", players[i].name); if (b>0) {
else b1=b*z/255;
sprintf (text, "%s", players[i].name); dest.x = zx+4;
font_draw (80, y, text, 0, 4); dest.y = y+4;
text[0] = 0; dest.w = menu.buttonimages[2][0]->w;
if (players[i].net.net_istep == 3) dest.h = menu.buttonimages[2][0]->h;
sprintf (text, "Getting Tunnel Data %d.", players[i].net.net_status); gfx_blit (menu.buttonimages[2][0], NULL, gfx.screen, &dest, 10000);
dest.x = zx+4+b1-menu.buttonimages[1][2]->w;
if (players[i].net.net_istep == 2) if (dest.x<zx+4) dest.x=zx+4;
sprintf (text, "Getting Field Data %d of %d.", players[i].net.net_status, dest.w = menu.buttonimages[2][2]->w;
map.size.x); dest.h = menu.buttonimages[2][2]->h;
gfx_blit (menu.buttonimages[2][2], NULL, gfx.screen, &dest, 10000);
if (players[i].net.net_istep == 1) if (b1>menu.buttonimages[2][0]->w+menu.buttonimages[2][2]->w) {
sprintf (text, "Getting Player Data %d of %d.", players[i].net.net_status, dest.w = menu.buttonimages[2][1]->w;
MAX_PLAYERS); dest.h = menu.buttonimages[2][1]->h;
for(j=menu.buttonimages[2][0]->w;j<b1-menu.buttonimages[2][2]->w;
font_draw (80, y + 32, text, 0, 4); j+=menu.buttonimages[2][1]->w) {
} dest.x=j+zx+4;
gfx_blit (menu.buttonimages[2][1], NULL, gfx.screen, &dest, 10000);
}
}
}
// draw old status in case of debug
if (!players[i].net.net_istep)
font_draw (80, y + 20, text, 0, 4);
else
if (debug) {
redraw_logo (80, y+35, gfx.res.x-80, 15);
font_draw (80, y + 35, text, 0, 4);
}
}
gfx_blitdraw (); gfx_blitdraw ();
return; return;
} }
@ -422,15 +459,13 @@ net_transmit_gamedata ()
else else
font_draw (100, 0, "Downloading Data", 1, 0); font_draw (100, 0, "Downloading Data", 1, 0);
SDL_Flip (gfx.screen);
/* /*
prepare everything for the loop prepare everything for the loop
*/ */
for (x = 0; x < MAX_PLAYERS; x++) { for (x = 0; x < MAX_PLAYERS; x++) {
players[x].net.timestamp = 0; players[x].net.timestamp = 0;
players[x].net.net_status = -1; players[x].net.net_status = -1;
if (PS_IS_aiplayer (players[x].state)) if ((PS_IS_aiplayer (players[x].state)) || (x==bman.p_servnr))
players[x].net.net_istep = 0; players[x].net.net_istep = 0;
else else
players[x].net.net_istep = 3; players[x].net.net_istep = 3;
@ -442,8 +477,9 @@ net_transmit_gamedata ()
else else
net_istep = 3; net_istep = 3;
draw_netupdatestate (1); draw_netupdatestate (1);
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
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))) {
/* the network thing */ /* the network thing */
@ -451,6 +487,10 @@ net_transmit_gamedata ()
/* if PTPM check if all players are ready */ /* if PTPM check if all players are ready */
if (GT_MP_PTPM) { if (GT_MP_PTPM) {
if (timestamp - downtimestamp > TIME_UPDATEINFO) {
downtimestamp = timestamp;
net_send_updateinfo();
}
for (p = 1, i = 1; p < MAX_PLAYERS; p++) for (p = 1, i = 1; p < MAX_PLAYERS; p++)
if (PS_IS_playing (players[p].state) && players[p].net.net_istep != 0) if (PS_IS_playing (players[p].state) && players[p].net.net_istep != 0)
i = 0; i = 0;
@ -539,11 +579,10 @@ net_transmit_gamedata ()
downtimestamp = timestamp; downtimestamp = timestamp;
send_playerstatus (&players[bman.p_servnr].net.addr, bman.p_nr, 0, 0); send_playerstatus (&players[bman.p_servnr].net.addr, bman.p_nr, 0, 0);
} }
} }
/* do the grafik work */ /* do the grafik work */
draw_netupdatestate (0); draw_netupdatestate (0);
SDL_Flip (gfx.screen);
if (SDL_PollEvent (&event) != 0) if (SDL_PollEvent (&event) != 0)
switch (event.type) { switch (event.type) {
@ -829,6 +868,23 @@ net_game_send_special (int pl_nr, int ex_nr)
}; };
/* Send update informations to all clients */
void
net_send_updateinfo ()
{
int i;
if (GT_MP_PTPS)
return;
d_printf ("Send Updateinfo\n");
for (i = 0; i < MAX_PLAYERS; i++)
if (!PS_IS_aiplayer (players[i].state) && PS_IS_netplayer (players[i].state) && i != bman.p_nr && NET_CANSEND(i))
send_updateinfo (&players[i].net.addr);
};
/* Send mapinformations to all clients */ /* Send mapinformations to all clients */
void void
net_send_mapinfo () net_send_mapinfo ()

@ -1059,8 +1059,6 @@ do_getplayerdata (struct pkg_getplayerdata *gp_dat, _net_addr * addr)
void void
do_playerstatus (struct pkg_playerstatus *stat, _net_addr * addr) do_playerstatus (struct pkg_playerstatus *stat, _net_addr * addr)
{ {
int i;
d_printf ("do_playerstatus (%s,%s)\n", addr->host, addr->port); d_printf ("do_playerstatus (%s,%s)\n", addr->host, addr->port);
if (addr->pl_nr != bman.p_servnr && !(GT_MP_PTPM)) { if (addr->pl_nr != bman.p_servnr && !(GT_MP_PTPM)) {
@ -1076,11 +1074,13 @@ do_playerstatus (struct pkg_playerstatus *stat, _net_addr * addr)
players[addr->pl_nr].net.net_status = stat->status; players[addr->pl_nr].net.net_status = stat->status;
players[addr->pl_nr].net.net_istep = stat->net_istep; players[addr->pl_nr].net.net_istep = stat->net_istep;
/*
if (GT_MP_PTPM) if (GT_MP_PTPM)
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
if (players[i].net.addr.host[0] != 0) if (players[i].net.addr.host[0] != 0)
send_playerstatus (&players[i].net.addr, stat->pl_nr, send_playerstatus (addr, stat->pl_nr,
stat->net_istep, stat->status); stat->net_istep, stat->status);
*/
}; };
void void
@ -1101,6 +1101,43 @@ send_playerstatus (_net_addr * addr, int pl_nr, int net_istep, int status)
send_pkg ((struct pkg *) &stat, addr); send_pkg ((struct pkg *) &stat, addr);
}; };
/***
*** Packettype: updateinfo
***/
void
do_updateinfo (struct pkg_updateinfo *stat, _net_addr * addr)
{
int i;
d_printf ("do_updateinfo (%s,%s)\n", addr->host, addr->port);
if (addr->pl_nr != bman.p_servnr && !(GT_MP_PTPM)) {
/* the data we have got are not from the server */
d_printf ("do_updateinfo: the data we have got are not from the server\n");
return;
}
for (i=0;i<MAX_PLAYERS;i++)
if ((i!=bman.p_servnr) && (i!=bman.p_nr)) {
players[i].net.net_status = stat->status[i];
players[i].net.net_istep = stat->step[i];
}
};
void
send_updateinfo (_net_addr * addr)
{
struct pkg_updateinfo stat;
int i;
stat.h.typ = PKG_updateinfo;
stat.h.flags = 0;
stat.h.len = HTON16 (sizeof (struct pkg_updateinfo));
for (i=0;i<MAX_PLAYERS;i++) {
stat.step[i] = players[i].net.net_istep;
stat.status[i] = players[i].net.net_status;
}
send_pkg ((struct pkg *) &stat, addr);
};
/*** /***
*** Packettype: chat *** Packettype: chat
@ -1566,6 +1603,9 @@ do_pkg (struct pkg *packet, _net_addr * addr)
case (PKG_respawn): case (PKG_respawn):
do_respawn ((struct pkg_respawn *) packet, addr); do_respawn ((struct pkg_respawn *) packet, addr);
break; break;
case (PKG_updateinfo):
do_updateinfo ((struct pkg_updateinfo *) packet, addr);
break;
default: default:
send_error (addr, "BomberClone: unknown data packet"); send_error (addr, "BomberClone: unknown data packet");
break; break;

Loading…
Cancel
Save