|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: player.c,v 1.71 2004/01/27 22:17:22 stpohle Exp $
|
|
|
|
|
/* $Id: player.c,v 1.72 2004/01/27 22:52:14 stpohle Exp $
|
|
|
|
|
* player.c - everything what have to do with the player */
|
|
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
@ -60,7 +60,6 @@ draw_player (_player * player)
|
|
|
|
|
/* player is respawning
|
|
|
|
|
* first: draw the star */
|
|
|
|
|
|
|
|
|
|
printf ("Respawn Drawing \n");
|
|
|
|
|
dest.w = src.w = gfx.respawn.image->w;
|
|
|
|
|
dest.h = src.h = player->gfx->ani.h;
|
|
|
|
|
|
|
|
|
@ -587,10 +586,15 @@ player_animation (_player * player)
|
|
|
|
|
player->frame += player->gfx->ani.frames;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PS_IS_dead (player->state) || PS_IS_respawn (player->state)) {
|
|
|
|
|
if (PS_IS_dead (player->state)) {
|
|
|
|
|
if ((int)player->frame < gfx.dead.frames)
|
|
|
|
|
player->frame += (timefactor * ANI_PLAYERTIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PS_IS_respawn (player->state)) {
|
|
|
|
|
if ((int)player->frame < gfx.respawn.frames)
|
|
|
|
|
player->frame += (timefactor * ANI_PLAYERTIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -860,14 +864,16 @@ player_findfreebomb (_player * player)
|
|
|
|
|
/* check if a player died and check if we have to respawn */
|
|
|
|
|
void player_checkdeath (int pnr) {
|
|
|
|
|
_player *player = &players[pnr];
|
|
|
|
|
int trypos;
|
|
|
|
|
int trypos, i;
|
|
|
|
|
|
|
|
|
|
/* check for respawn */
|
|
|
|
|
if (bman.gametype == GT_deathmatch && PS_IS_dead (player->state) && player->frame >= gfx.dead.frames) {
|
|
|
|
|
/* check new position */
|
|
|
|
|
printf ("Respawn Test OK\n");
|
|
|
|
|
d_printf ("Respawn for player %s\n", player->name);
|
|
|
|
|
trypos = 0;
|
|
|
|
|
do {
|
|
|
|
|
player->pos.x = -1.0f;
|
|
|
|
|
player->pos.y = -1.0f;
|
|
|
|
|
map_set_player_way1 (pnr);
|
|
|
|
|
trypos++;
|
|
|
|
|
} while (trypos < 100 && (player->pos.x == -1 || player->pos.y == -1));
|
|
|
|
@ -880,4 +886,24 @@ void player_checkdeath (int pnr) {
|
|
|
|
|
net_game_send_respawn (pnr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check for respawn finish */
|
|
|
|
|
if (bman.gametype == GT_deathmatch && PS_IS_respawn (player->state) && player->frame >= gfx.respawn.frames) {
|
|
|
|
|
d_printf ("Respawn completed for player %s\n", player->name);
|
|
|
|
|
player->frame = 0;
|
|
|
|
|
player->state &= (0xFF - PSF_respawn);
|
|
|
|
|
player->state |= PSF_alife;
|
|
|
|
|
|
|
|
|
|
if (bman.dropitemsondeath) {
|
|
|
|
|
player->speed = bman.start_speed;
|
|
|
|
|
player->bombs_n = bman.start_bombs;
|
|
|
|
|
player->range = bman.start_range;
|
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
|
player->ill[i].to = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
|
if (player->ill[i].to > 0.0f)
|
|
|
|
|
player_clear_ilness (player, i);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|