illness bug again.. rewrote player_set_ilness

miltplayer wait screen had another bug with the winner and points head.
origin
stpohle 22 years ago
parent 473e604c52
commit 23784f9d16

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.12 2004/01/03 04:39:20 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.13 2004/01/06 01:24:55 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -203,9 +203,9 @@ extern void player_animation (_player * player);
extern int check_field (short int x, short int y);
extern int check_exfield (short int x, short int y);
extern void player_calcpos ();
extern void player_set_ilness (_player *p, int t);
extern void player_set_ilness (_player * p, int t, float new_to);
extern void player_clear_ilness (_player *p, int type);
extern void player_ilness_loop (int pl_nr);
extern void player_ilness_loop ();
extern void player_check_powerup (int p_nr);
extern void player_set_gfx (_player *p, signed char gfx_nr);
extern int player_findfreebomb (_player *player);

@ -85,13 +85,11 @@ mw_draw_status ()
x = (gfx.res.x - px * 320) / 2;
gfx_blitupdaterectclear ();
/* for (pnr = 0; pnr < px; pnr++) {
font_setcolor (128, 128, 128, 0);
font_draw (pnr * 320 + x - 2, 22, " Wins Points", 0);
font_setcolor (192, 192, 255, 0);
font_draw (pnr * 320 + x, 24, " Wins Points", 0);
for (pnr = 0; pnr < px; pnr++) {
font_gfxdrawbold (pnr * 320 + x, 23, " Wins Points", 0, COLOR_gray,1, 0xFF);
font_gfxdraw (pnr * 320 + x, 23, " Wins Points", 0, COLOR_white, 0xFF);
}
*/
/* 2. the names with points */
for (x1 = pnr = 0, y = 48; pnr < MAX_PLAYERS; pnr++) {
redraw_logo (x1 * 320, y - 4, 320, 32);

@ -645,7 +645,7 @@ do_ill (struct pkg_ill *ill, _net_addr * addr)
if (players[ill->pl_nr].ill[i].to <= 0.0f && old_to > 0.0f)
player_clear_ilness (&players[ill->pl_nr], i);
else if (players[ill->pl_nr].ill[i].to > 0.0f && old_to <= 0.0f)
player_set_ilness (&players[ill->pl_nr], i);
player_set_ilness (&players[ill->pl_nr], i, players[ill->pl_nr].ill[i].to);
d_printf (" to[%d]:%f dataf:%f datai:%d\n",i, players[ill->pl_nr].ill[i].to, players[ill->pl_nr].ill[i].dataf, players[ill->pl_nr].ill[i].datai);
}
};

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.62 2004/01/06 00:03:01 stpohle Exp $
/* $Id: player.c,v 1.63 2004/01/06 01:24:56 stpohle Exp $
* player.c - everything what have to do with the player */
#include <SDL.h>
@ -166,7 +166,7 @@ player_check_powerup (int p_nr)
switch (ft) {
/* we found a bomb powerup */
case FT_bomb:
if (p->bombs_n < MAX_BOMBS && p->ill[PI_nobomb].to <= 0) {
if (p->bombs_n < MAX_BOMBS && p->ill[PI_nobomb].to <= 0.0) {
p->bombs_n++;
bman.updatestatusbar = 1;
}
@ -174,7 +174,7 @@ player_check_powerup (int p_nr)
break;
/* we found a fire powerup */
case FT_fire:
if (p->range < MAX_RANGE && p->ill[PI_range].to <= 0) {
if (p->range < MAX_RANGE && p->ill[PI_range].to <= 0.0) {
p->range++;
bman.updatestatusbar = 1;
}
@ -182,7 +182,7 @@ player_check_powerup (int p_nr)
break;
/* we found a shoe powerup */
case FT_shoe:
if (p->speed < MAX_SPEED && p->ill[PI_slow].to <= 0) {
if (p->speed < MAX_SPEED && p->ill[PI_slow].to <= 0.0) {
p->speed *= SPEEDMUL;
bman.updatestatusbar = 1;
}
@ -190,7 +190,7 @@ player_check_powerup (int p_nr)
break;
/* we found a death ?powerup? */
case FT_death:
player_set_ilness (p, -1);
player_set_ilness (p, -1, ILL_TIMEOUT);
bman.updatestatusbar = 1;
if (GT_MP)
net_game_send_ill (bman.p_nr);
@ -597,7 +597,7 @@ player_calcpos ()
void
player_ilness_loop (int pl_nr)
player_ilness_loop ()
{
_player *p;
int type,
@ -610,35 +610,35 @@ player_ilness_loop (int pl_nr)
/* do the illness for the network players */
if (GT_MP) {
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
if (pnr != pl_nr && PS_IS_alife (players[pnr].state)) {
if (pnr != bman.p_nr && PS_IS_alife (players[pnr].state) && PS_IS_netplayer (players[pnr].state)) {
p = &players[pnr];
for (type = 0; type < PI_max; type++)
if (p->ill[type].to > 0.0f) {
p->ill[type].to -= timediff;
p->illframe += timefactor;
if (p->illframe < 0 || p->illframe >= gfx.ill.frames)
p->illframe = 0;
if (p->illframe < 0.0f || p->illframe >= gfx.ill.frames)
p->illframe = 0.0f;
}
}
}
/* check if we have contact with an other ill player */
p = &players[pl_nr];
p = &players[bman.p_nr];
get_player_on (p->pos.x, p->pos.y, pl);
for (i = 0; (pl[i] != -1 && i < MAX_PLAYERS); i++)
if (pl[i] != pl_nr) {
if (pl[i] != bman.p_nr) {
send = 0;
for (type = 0; type < PI_max; type++) {
if (players[pl[i]].ill[type].to > p->ill[type].to) {
tmpf = p->ill[type].to;
player_set_ilness (p, type);
player_set_ilness (p, type, players[pl[i]].ill[type].to);
p->ill[type].to = players[pl[i]].ill[type].to;
if (tmpf <= 0.0f)
send = 1;
}
}
if (send != 0 && GT_MP)
net_game_send_ill (pl_nr);
net_game_send_ill (bman.p_nr);
}
/* do the illness for the givin player */
@ -672,16 +672,17 @@ player_ilness_loop (int pl_nr)
}
else if (type == PI_bomb)
/* player is dropping bombs */
player_drop_bomb (pl_nr);
player_drop_bomb (bman.p_nr);
}
}
}
/* player picked up the death powerup, add timeout for
this illness to the maybe excisting timeout */
/* Set or add the timeout for one illness, depends on if one was givin.
* if the type is -1 so the timeout will be added, else the timeout is
* set to the new value */
void
player_set_ilness (_player * p, int t)
player_set_ilness (_player * p, int t, float new_to)
{
int type;
if (t == -1)
@ -711,24 +712,28 @@ player_set_ilness (_player * p, int t)
else
p->ill[type].dataf = p->speed;
}
p->speed = ILL_FASTSPEED;
break;
case PI_range:
if (p->ill[type].to <= 0.0f)
p->ill[type].datai = p->range;
d_printf ("player_set_ilness PI_range %d\n", p->ill[type].datai);
d_printf (" PI_range %d\n", p->ill[type].datai);
p->range = 1;
break;
case PI_nobomb:
if (p->ill[type].to <= 0.0f)
p->ill[type].datai = p->bombs_n;
d_printf ("player_set_ilness PI_nobomb %d\n", p->ill[type].datai);
d_printf (" PI_nobomb %d\n", p->ill[type].datai);
p->bombs_n = s_random (2);
break;
}
bman.updatestatusbar = 1;
p->ill[type].to += ILL_TIMEOUT;
/* add or set the new timeout */
if (t == -1)
p->ill[type].to += new_to;
else
p->ill[type].to = new_to;
};

Loading…
Cancel
Save