|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: player.c,v 1.63 2004/01/06 01:24:56 stpohle Exp $
|
|
|
|
/* $Id: player.c,v 1.64 2004/01/06 02:19:57 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>
|
|
|
@ -40,13 +40,13 @@ draw_player (_player * player)
|
|
|
|
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.0f); i--);
|
|
|
|
if (i >= 0) {
|
|
|
|
if (i >= 0) {
|
|
|
|
player->illframe += timefactor;
|
|
|
|
player->illframe += timefactor;
|
|
|
|
if (player->illframe > gfx.ill.frames)
|
|
|
|
while (player->illframe >= gfx.ill.frames)
|
|
|
|
player->illframe = 0.0f;
|
|
|
|
player->illframe -= gfx.ill.frames;
|
|
|
|
|
|
|
|
|
|
|
|
dest.w = src.w = gfx.block.x * 2;
|
|
|
|
dest.w = src.w = gfx.block.x * 2;
|
|
|
|
dest.h = src.h = gfx.block.y * 2;
|
|
|
|
dest.h = src.h = gfx.block.y * 2;
|
|
|
|
src.x = 0;
|
|
|
|
src.x = 0;
|
|
|
|
src.y = (2 * gfx.block.y) * (int)player->illframe;
|
|
|
|
src.y = (int)player->illframe * (2 * gfx.block.y);
|
|
|
|
dest.x =
|
|
|
|
dest.x =
|
|
|
|
gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x);
|
|
|
|
gfx.offset.x + ((player->pos.x-0.5f) * gfx.block.x);
|
|
|
|
dest.y =
|
|
|
|
dest.y =
|
|
|
@ -597,7 +597,7 @@ player_calcpos ()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
player_ilness_loop ()
|
|
|
|
player_ilness_loop (int plnr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_player *p;
|
|
|
|
_player *p;
|
|
|
|
int type,
|
|
|
|
int type,
|
|
|
@ -607,26 +607,24 @@ player_ilness_loop ()
|
|
|
|
float tmpf;
|
|
|
|
float tmpf;
|
|
|
|
int pl[MAX_PLAYERS + 1];
|
|
|
|
int pl[MAX_PLAYERS + 1];
|
|
|
|
|
|
|
|
|
|
|
|
/* do the illness for the network players */
|
|
|
|
/* do the illness for the network and ai players */
|
|
|
|
if (GT_MP) {
|
|
|
|
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
|
|
|
|
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
|
|
|
|
if (pnr != plnr && PS_IS_alife (players[pnr].state) && PS_IS_netplayer (players[pnr].state)) {
|
|
|
|
if (pnr != bman.p_nr && PS_IS_alife (players[pnr].state) && PS_IS_netplayer (players[pnr].state)) {
|
|
|
|
p = &players[pnr];
|
|
|
|
p = &players[pnr];
|
|
|
|
for (type = 0; type < PI_max; type++)
|
|
|
|
for (type = 0; type < PI_max; type++)
|
|
|
|
if (p->ill[type].to > 0.0f) {
|
|
|
|
if (p->ill[type].to > 0.0f) {
|
|
|
|
p->ill[type].to -= timediff;
|
|
|
|
p->ill[type].to -= timediff;
|
|
|
|
p->illframe += timefactor;
|
|
|
|
p->illframe += timefactor;
|
|
|
|
if (p->illframe < 0.0f || p->illframe >= gfx.ill.frames)
|
|
|
|
if (p->illframe < 0.0f || p->illframe >= gfx.ill.frames)
|
|
|
|
p->illframe = 0.0f;
|
|
|
|
p->illframe = 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* check if we have contact with an other ill player */
|
|
|
|
/* check if we have contact with an other ill player */
|
|
|
|
p = &players[bman.p_nr];
|
|
|
|
p = &players[plnr];
|
|
|
|
get_player_on (p->pos.x, p->pos.y, pl);
|
|
|
|
get_player_on (p->pos.x, p->pos.y, pl);
|
|
|
|
for (i = 0; (pl[i] != -1 && i < MAX_PLAYERS); i++)
|
|
|
|
for (i = 0; (pl[i] != -1 && i < MAX_PLAYERS); i++)
|
|
|
|
if (pl[i] != bman.p_nr) {
|
|
|
|
if (pl[i] != plnr) {
|
|
|
|
send = 0;
|
|
|
|
send = 0;
|
|
|
|
for (type = 0; type < PI_max; type++) {
|
|
|
|
for (type = 0; type < PI_max; type++) {
|
|
|
|
if (players[pl[i]].ill[type].to > p->ill[type].to) {
|
|
|
|
if (players[pl[i]].ill[type].to > p->ill[type].to) {
|
|
|
@ -638,7 +636,7 @@ player_ilness_loop ()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (send != 0 && GT_MP)
|
|
|
|
if (send != 0 && GT_MP)
|
|
|
|
net_game_send_ill (bman.p_nr);
|
|
|
|
net_game_send_ill (plnr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* do the illness for the givin player */
|
|
|
|
/* do the illness for the givin player */
|
|
|
@ -672,7 +670,7 @@ player_ilness_loop ()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type == PI_bomb)
|
|
|
|
else if (type == PI_bomb)
|
|
|
|
/* player is dropping bombs */
|
|
|
|
/* player is dropping bombs */
|
|
|
|
player_drop_bomb (bman.p_nr);
|
|
|
|
player_drop_bomb (plnr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|