diff --git a/include/bomberclone.h b/include/bomberclone.h index 901fffa..a7cffc2 100644 --- a/include/bomberclone.h +++ b/include/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.7 2003/11/08 19:53:06 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.8 2003/11/09 23:56:34 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -85,7 +85,7 @@ struct { int gfx_nr; // number of the player GFX float frame; // step of the animation (only integer part will shown) - int illframe; + float illframe; _pointf pos; // position on the field _pointf old; // the old position diff --git a/include/network.h b/include/network.h index 1a7009d..db109bb 100644 --- a/include/network.h +++ b/include/network.h @@ -43,9 +43,9 @@ network.h file... for everything what have to do with the network stuff /* converting of float to int and other direction */ #define FTOI16(__x) ((Sint16)((float)(__x * 256.0f))) -#define FTOI32(__x) ((Sint32)((float)(__x * 1024.0f))) +#define FTOI32(__x) ((Sint32)((float)(__x * 4096.0f))) #define I16TOF(__x) (((float)__x) / 256.0f) -#define I32TOF(__x) (((float)__x) / 1024.0f) +#define I32TOF(__x) (((float)__x) / 4096.0f) #ifdef _WIN32 #define _sockaddr sockaddr diff --git a/include/packets.h b/include/packets.h index d37468d..b9cdcde 100644 --- a/include/packets.h +++ b/include/packets.h @@ -213,7 +213,7 @@ struct pkg_fieldline { struct pkg_ill { struct pkgheader h; signed char pl_nr; - Sint16 to[PI_max]; + Sint32 to[PI_max]; }; diff --git a/src/debug.c b/src/debug.c index 6580d5b..a53d5c0 100644 --- a/src/debug.c +++ b/src/debug.c @@ -35,9 +35,9 @@ void d_playerdetail (char *head) { int i; d_printf ("---------------> %s\n", head); - d_printf ("Nr Name GFX Sta Pkt Win [Addr]\n"); + d_printf ("Nr Name GFX Sta Pkt Win [Addr] FireWall\n"); for (i = 0; i < MAX_PLAYERS; i++) - d_printf ("%2d %16s %3d %3d %3d %3d [%s:%s]\n",i, players[i].name, players[i].gfx_nr, players[i].state, players[i].points, players[i].wins, players[i].net.addr.host, players[i].net.addr.port); + d_printf ("%2d %16s %3d %3d %3d %3d [%s:%s]\n",i, players[i].name, players[i].gfx_nr, players[i].state, players[i].points, players[i].wins, players[i].net.addr.host, players[i].net.addr.port, players[i].net.flags); }; diff --git a/src/multiwait.c b/src/multiwait.c index 1aedc77..2abe032 100644 --- a/src/multiwait.c +++ b/src/multiwait.c @@ -235,11 +235,12 @@ mw_draw_chat () chat_show (16, mw_chat + 16, gfx.res.x - 16, gfx.res.y - 32); chat_addstatusline ("Press [STRG] or [CTRL] - to select a player"); if (GT_MP_PTPM) { + chat_addstatusline ("F2 - to change map settings"); + chat_addstatusline ("F3 - to change player settings"); chat_addstatusline ("F4 - to start the game"); - chat_addstatusline ("F5 - to change map settings"); } else { - chat_addstatusline ("F5 - to see the map settings"); + chat_addstatusline ("F2 - to see the map settings"); } } }; diff --git a/src/network.c b/src/network.c index 83a40db..26affb4 100644 --- a/src/network.c +++ b/src/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.44 2003/11/09 03:56:56 stpohle Exp $ */ +/* $Id: network.c,v 1.45 2003/11/09 23:56:35 stpohle Exp $ */ /* network routines. */ @@ -748,7 +748,7 @@ net_send_chat (char *text, signed char notigamesrv) int i; 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)) + if ((!PS_IS_aiplayer (players[i].state)) && PS_IS_netplayer (players[i].state) && i != bman.p_nr && NET_CANSEND(i)) send_chat (&players[i].net.addr, text); if (GT_MP_PTPM && bman.notifygamemaster && notigamesrv == 1 && bman.broadcasted_chat) /* send notification the the gamemaster */ @@ -764,7 +764,7 @@ net_game_send_ill (int p_nr) d_printf ("net_game_send_ill (%d)\n", p_nr); 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)) + if ((!PS_IS_aiplayer (players[i].state)) && PS_IS_netplayer (players[i].state) && i != bman.p_nr && NET_CANSEND(i)) send_ill (&players[i].net.addr, p_nr, &players[p_nr]); }; diff --git a/src/packets.c b/src/packets.c index 25be992..6b8fd34 100644 --- a/src/packets.c +++ b/src/packets.c @@ -85,6 +85,9 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) { vsu; char text[255]; + d_printf + ("do_joingame (From:%s:%s Player(name:%s)\n", addr->host, addr->port, p_jg->name); + sscanf (VERSION, "%d.%d.%d", &vma, &vmi, &vsu); if (p_jg->ver_sub != vsu || p_jg->ver_major != vma || p_jg->ver_minor != vmi) { @@ -98,9 +101,6 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) { return; } - d_printf - ("do_joingame (From:%s:%s Player(name:%s)\n", addr->host, addr->port, p_jg->name); - /* find a free place for the player and add the player to the game*/ if ((addr->pl_nr == -1) && GS_WAITRUNNING && GT_MP_PTPM) { /* find free player slot */ @@ -598,10 +598,8 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr) } /* set the state of the player */ - if (p_dat->p_nr != bman.p_nr && PS_IS_used (pl->state)) { + if (p_dat->p_nr != bman.p_nr && PS_IS_used (pl->state)) pl->state |= PSF_net; - pl->state &= (0xff - PSF_ai); - } else pl->state &= (0xff - PSF_net); @@ -631,8 +629,10 @@ do_ill (struct pkg_ill *ill, _net_addr * addr) if (ill->pl_nr < 0 || ill->pl_nr >= MAX_PLAYERS || ill->pl_nr == bman.p_nr) return; - for (i = 0; i < PI_max; i++) - players[ill->pl_nr].ill[i].to = I16TOF (NTOH16 (ill->to[i])); + for (i = 0; i < PI_max; i++) { + players[ill->pl_nr].ill[i].to = I32TOF (NTOH32 (ill->to[i])); + d_printf (" to[%d]:%f\n",i, players[ill->pl_nr].ill[i].to); + } }; void @@ -647,7 +647,7 @@ send_ill (_net_addr * addr, int p_nr, _player * pl) ill.pl_nr = p_nr; for (i = 0; i < PI_max; i++) - ill.to[i] = HTON16 (FTOI16 (pl->ill[i].to)); + ill.to[i] = HTON32 (FTOI32 (pl->ill[i].to)); send_pkg ((struct pkg *) &ill, addr); }; @@ -719,7 +719,7 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr) if (b_dat->state == BS_off) return; // if there was a bomb let it explose don't delete the bomb - d_printf ("do_bombdata [%d,%d] Player: %d Bomb: %d, ex_nr:%d\n", + d_printf ("do_bombdata [%f,%f] Player: %d Bomb: %d, ex_nr:%d\n", I16TOF(NTOH16 (b_dat->x)), I16TOF(NTOH16 (b_dat->y)), b_dat->p_nr, b_dat->b_nr, NTOH32 (b_dat->ex_nr)); @@ -1079,6 +1079,9 @@ send_playerstatus (_net_addr * addr, int pl_nr, int net_istep, int status) void do_chat (struct pkg_chat *chat_pkg, _net_addr * addr) { + d_printf ("do_chat (%s:%s) %d Text:%s\n", addr->host, + addr->port, addr->pl_nr, chat_pkg->text); + chat_addline (chat_pkg->text); if (GT_MP_PTPM && bman.notifygamemaster) /* send notification the the gamemaster */ @@ -1337,7 +1340,7 @@ do_pkg (struct pkg *packet, _net_addr * addr) if ((((packet->h.flags & PKGF_ipv6) == 0 && bman.net_ai_family != PF_INET) || ((packet->h.flags & PKGF_ipv6) != 0 && bman.net_ai_family == PF_INET)) && packet->h.typ != PKG_bcmservchat) { - d_printf ("-----packet comes from the wrong network type\n"); + d_printf ("do_pkg: packet comes from the wrong network type\n"); return 0; } /* get the addr and set the ping timeout value */ @@ -1352,7 +1355,7 @@ do_pkg (struct pkg *packet, _net_addr * addr) /* check the packet with the index */ if (packet->h.typ != PKG_bcmservchat && inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) { /* we have got this packet already */ - d_printf ("-----packet ignored\n"); + d_printf ("do_pkg: double packet ignoring\n"); if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS) players[addr->pl_nr].net.pkgopt.to_2sec++; return 0; diff --git a/src/player.c b/src/player.c index 120445a..a345680 100644 --- a/src/player.c +++ b/src/player.c @@ -33,20 +33,22 @@ draw_player (_player * player) gfx_blit (player->gfx->ani.image, &src, gfx.screen, &dest, (player->pos.y * 256) + 128); /* if the player is ill, draw this image above him */ - if (PS_IS_alife (player->state)) { - for (i = PI_max - 1; (i >= 0) && (player->ill[i].to == 0); i--); - if (i >= 0) { - dest.w = src.w = gfx.block.x * 2; - dest.h = src.h = gfx.block.y * 2; - src.x = 0; - src.y = (2 * gfx.block.y) * player->illframe; - dest.x = - gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x); - dest.y = - gfx.offset.y + ((player->pos.y - 1.0f) * gfx.block.y); - gfx_blit (gfx.ill.image, &src, gfx.screen, &dest, (player->pos.y*256) + 129); - } - } + for (i = PI_max - 1; (i >= 0) && (player->ill[i].to <= 0.0f); i--); + if (i >= 0) { + player->illframe += timefactor; + if (player->illframe > gfx.ill.frames) + player->illframe = 0.0f; + + dest.w = src.w = gfx.block.x * 2; + dest.h = src.h = gfx.block.y * 2; + src.x = 0; + src.y = (2 * gfx.block.y) * (int)player->illframe; + dest.x = + gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x); + dest.y = + gfx.offset.y + ((player->pos.y - 1.0f) * gfx.block.y); + gfx_blit (gfx.ill.image, &src, gfx.screen, &dest, (player->pos.y*256) + 129); + } } else { @@ -186,7 +188,7 @@ player_check_powerup (int p_nr) case FT_death: player_set_ilness (p, -1); bman.updatestatusbar = 1; - if (GT_SP) + if (GT_MP) net_game_send_ill (bman.p_nr); field_clear (fx, fy); break; @@ -523,8 +525,7 @@ player_animation (_player * player) return; if (PS_IS_alife (player->state)) { - if ((int)player->frame < player->gfx->ani.frames) - player->frame += timefactor; + player->frame += timefactor; if ((int)player->frame >= player->gfx->ani.frames) player->frame = 0.0f; } diff --git a/src/single.c b/src/single.c index d9fc38e..b953201 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.48 2003/11/09 04:09:49 stpohle Exp $ */ +/* $Id: single.c,v 1.49 2003/11/09 23:56:35 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -625,6 +625,9 @@ single_loop () i; _airunaway rawdir; + if (GT_MP_PTPS) // we are not the master so no need for this. + return; + for (p = 0; p < MAX_PLAYERS; p++) if (p != bman.p_nr && PS_IS_alife (players[p].state) && PS_IS_aiplayer(players[p].state)) { pl = &players[p];