illness and chat problem fixed..

origin
stpohle 22 years ago
parent e8fe2d48cc
commit c84bca3eba

@ -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 */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -85,7 +85,7 @@ struct {
int gfx_nr; // number of the player GFX int gfx_nr; // number of the player GFX
float frame; // step of the animation (only integer part will shown) float frame; // step of the animation (only integer part will shown)
int illframe; float illframe;
_pointf pos; // position on the field _pointf pos; // position on the field
_pointf old; // the old position _pointf old; // the old position

@ -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 */ /* converting of float to int and other direction */
#define FTOI16(__x) ((Sint16)((float)(__x * 256.0f))) #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 I16TOF(__x) (((float)__x) / 256.0f)
#define I32TOF(__x) (((float)__x) / 1024.0f) #define I32TOF(__x) (((float)__x) / 4096.0f)
#ifdef _WIN32 #ifdef _WIN32
#define _sockaddr sockaddr #define _sockaddr sockaddr

@ -213,7 +213,7 @@ struct pkg_fieldline {
struct pkg_ill { struct pkg_ill {
struct pkgheader h; struct pkgheader h;
signed char pl_nr; signed char pl_nr;
Sint16 to[PI_max]; Sint32 to[PI_max];
}; };

@ -35,9 +35,9 @@ void d_playerdetail (char *head) {
int i; int i;
d_printf ("---------------> %s\n", head); 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++) 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);
}; };

@ -235,11 +235,12 @@ mw_draw_chat ()
chat_show (16, mw_chat + 16, gfx.res.x - 16, gfx.res.y - 32); chat_show (16, mw_chat + 16, gfx.res.x - 16, gfx.res.y - 32);
chat_addstatusline ("Press [STRG] or [CTRL] - to select a player"); chat_addstatusline ("Press [STRG] or [CTRL] - to select a player");
if (GT_MP_PTPM) { 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 ("F4 - to start the game");
chat_addstatusline ("F5 - to change map settings");
} }
else { else {
chat_addstatusline ("F5 - to see the map settings"); chat_addstatusline ("F2 - to see the map settings");
} }
} }
}; };

@ -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. network routines.
*/ */
@ -748,7 +748,7 @@ net_send_chat (char *text, signed char notigamesrv)
int i; int i;
for (i = 0; i < MAX_PLAYERS; 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); send_chat (&players[i].net.addr, text);
if (GT_MP_PTPM && bman.notifygamemaster && notigamesrv == 1 && bman.broadcasted_chat) /* send notification the the gamemaster */ 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); d_printf ("net_game_send_ill (%d)\n", p_nr);
for (i = 0; i < MAX_PLAYERS; 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_ill (&players[i].net.addr, p_nr, &players[p_nr]); send_ill (&players[i].net.addr, p_nr, &players[p_nr]);
}; };

@ -85,6 +85,9 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) {
vsu; vsu;
char text[255]; 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); sscanf (VERSION, "%d.%d.%d", &vma, &vmi, &vsu);
if (p_jg->ver_sub != vsu || p_jg->ver_major != vma || p_jg->ver_minor != vmi) { 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; 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*/ /* find a free place for the player and add the player to the game*/
if ((addr->pl_nr == -1) && GS_WAITRUNNING && GT_MP_PTPM) { if ((addr->pl_nr == -1) && GS_WAITRUNNING && GT_MP_PTPM) {
/* find free player slot */ /* find free player slot */
@ -598,10 +598,8 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr)
} }
/* set the state of the player */ /* 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 |= PSF_net;
pl->state &= (0xff - PSF_ai);
}
else else
pl->state &= (0xff - PSF_net); 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) if (ill->pl_nr < 0 || ill->pl_nr >= MAX_PLAYERS || ill->pl_nr == bman.p_nr)
return; return;
for (i = 0; i < PI_max; i++) for (i = 0; i < PI_max; i++) {
players[ill->pl_nr].ill[i].to = I16TOF (NTOH16 (ill->to[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 void
@ -647,7 +647,7 @@ send_ill (_net_addr * addr, int p_nr, _player * pl)
ill.pl_nr = p_nr; ill.pl_nr = p_nr;
for (i = 0; i < PI_max; i++) 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); 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) if (b_dat->state == BS_off)
return; // if there was a bomb let it explose don't delete the bomb 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, I16TOF(NTOH16 (b_dat->x)), I16TOF(NTOH16 (b_dat->y)), b_dat->p_nr,
b_dat->b_nr, NTOH32 (b_dat->ex_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 void
do_chat (struct pkg_chat *chat_pkg, _net_addr * addr) 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); chat_addline (chat_pkg->text);
if (GT_MP_PTPM && bman.notifygamemaster) /* send notification the the gamemaster */ 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) 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.flags & PKGF_ipv6) != 0 && bman.net_ai_family == PF_INET))
&& packet->h.typ != PKG_bcmservchat) { && 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; return 0;
} }
/* get the addr and set the ping timeout value */ /* 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 */ /* check the packet with the index */
if (packet->h.typ != PKG_bcmservchat && inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) { if (packet->h.typ != PKG_bcmservchat && inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) {
/* we have got this packet already */ /* 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) if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS)
players[addr->pl_nr].net.pkgopt.to_2sec++; players[addr->pl_nr].net.pkgopt.to_2sec++;
return 0; return 0;

@ -33,20 +33,22 @@ draw_player (_player * player)
gfx_blit (player->gfx->ani.image, &src, gfx.screen, &dest, (player->pos.y * 256) + 128); 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 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.0f); i--);
for (i = PI_max - 1; (i >= 0) && (player->ill[i].to == 0); i--); if (i >= 0) {
if (i >= 0) { player->illframe += timefactor;
dest.w = src.w = gfx.block.x * 2; if (player->illframe > gfx.ill.frames)
dest.h = src.h = gfx.block.y * 2; player->illframe = 0.0f;
src.x = 0;
src.y = (2 * gfx.block.y) * player->illframe; dest.w = src.w = gfx.block.x * 2;
dest.x = dest.h = src.h = gfx.block.y * 2;
gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x); src.x = 0;
dest.y = src.y = (2 * gfx.block.y) * (int)player->illframe;
gfx.offset.y + ((player->pos.y - 1.0f) * gfx.block.y); dest.x =
gfx_blit (gfx.ill.image, &src, gfx.screen, &dest, (player->pos.y*256) + 129); 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 { else {
@ -186,7 +188,7 @@ player_check_powerup (int p_nr)
case FT_death: case FT_death:
player_set_ilness (p, -1); player_set_ilness (p, -1);
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
if (GT_SP) if (GT_MP)
net_game_send_ill (bman.p_nr); net_game_send_ill (bman.p_nr);
field_clear (fx, fy); field_clear (fx, fy);
break; break;
@ -523,8 +525,7 @@ player_animation (_player * player)
return; return;
if (PS_IS_alife (player->state)) { 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) if ((int)player->frame >= player->gfx->ani.frames)
player->frame = 0.0f; player->frame = 0.0f;
} }

@ -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 */ /* single player */
#include "basic.h" #include "basic.h"
@ -625,6 +625,9 @@ single_loop ()
i; i;
_airunaway rawdir; _airunaway rawdir;
if (GT_MP_PTPS) // we are not the master so no need for this.
return;
for (p = 0; p < MAX_PLAYERS; p++) for (p = 0; p < MAX_PLAYERS; p++)
if (p != bman.p_nr && PS_IS_alife (players[p].state) && PS_IS_aiplayer(players[p].state)) { if (p != bman.p_nr && PS_IS_alife (players[p].state) && PS_IS_aiplayer(players[p].state)) {
pl = &players[p]; pl = &players[p];

Loading…
Cancel
Save