|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: player.c,v 1.73 2004/01/30 22:32:51 stpohle Exp $
|
|
|
|
|
/* $Id: player.c,v 1.74 2004/02/01 00:10:27 stpohle Exp $
|
|
|
|
|
* player.c - everything what have to do with the player */
|
|
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
@ -318,8 +318,8 @@ stepmove_player (int pl_nr)
|
|
|
|
|
else
|
|
|
|
|
speed = 1.0f - _pos.y;
|
|
|
|
|
|
|
|
|
|
if (speed > (p->speed * timefactor) || speed == 0)
|
|
|
|
|
speed = p->speed * timefactor;
|
|
|
|
|
if (speed > (p->speed) || speed == 0)
|
|
|
|
|
speed = p->speed;
|
|
|
|
|
|
|
|
|
|
// check the new field position
|
|
|
|
|
d.x = d.y = 0.0f;
|
|
|
|
@ -380,7 +380,7 @@ stepmove_player (int pl_nr)
|
|
|
|
|
p->pos.x = map.tunnel[tunnelnr].x;
|
|
|
|
|
p->pos.y = map.tunnel[tunnelnr].y;
|
|
|
|
|
p->tunnelto = GAME_TUNNEL_TO;
|
|
|
|
|
speed = p->speed * timefactor;
|
|
|
|
|
speed = p->speed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -388,7 +388,7 @@ stepmove_player (int pl_nr)
|
|
|
|
|
if (d.x == 0.0f && d.y == 0.0f)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return (p->speed - (speed/timefactor));
|
|
|
|
|
return (p->speed - speed);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -421,8 +421,6 @@ move_player (int pl_nr)
|
|
|
|
|
float speed, stepsleft;
|
|
|
|
|
_player *p = &players[pl_nr];
|
|
|
|
|
|
|
|
|
|
oldd = p->d;
|
|
|
|
|
|
|
|
|
|
if (p->tunnelto > 0.0f) {
|
|
|
|
|
p->tunnelto -= timediff;
|
|
|
|
|
p->m = 0;
|
|
|
|
@ -431,16 +429,19 @@ move_player (int pl_nr)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (p->m) {
|
|
|
|
|
/* prepade playervariables for the moving */
|
|
|
|
|
player_animation (p);
|
|
|
|
|
if ((stepsleft = stepmove_player (pl_nr)) > 0) {
|
|
|
|
|
/* save the speed and go the rest of the step */
|
|
|
|
|
oldd = p->d;
|
|
|
|
|
speed = p->speed;
|
|
|
|
|
stepsleft = speed * timefactor;
|
|
|
|
|
do {
|
|
|
|
|
p->d = oldd;
|
|
|
|
|
speed = p->speed;
|
|
|
|
|
p->speed = stepsleft;
|
|
|
|
|
stepmove_player (pl_nr);
|
|
|
|
|
p->speed = speed;
|
|
|
|
|
}
|
|
|
|
|
} while ((stepsleft = stepmove_player (pl_nr)) > 0);
|
|
|
|
|
|
|
|
|
|
/* restore old settings */
|
|
|
|
|
p->speed = speed;
|
|
|
|
|
|
|
|
|
|
/* network packet send control - send data if it's time to send or if we need to */
|
|
|
|
|
if (GT_MP)
|
|
|
|
|
net_game_send_playermove (pl_nr, (p->old_m == 0));
|
|
|
|
@ -630,8 +631,10 @@ player_calcpos ()
|
|
|
|
|
oldspeed = pl->speed;
|
|
|
|
|
oldm = pl->m;
|
|
|
|
|
oldd = pl->d;
|
|
|
|
|
if (pl->speed > 0.0)
|
|
|
|
|
if (pl->speed > 0.0) {
|
|
|
|
|
pl->speed *= timefactor;
|
|
|
|
|
stepmove_player (p);
|
|
|
|
|
}
|
|
|
|
|
pl->speed = oldspeed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -866,8 +869,10 @@ void player_checkdeath (int pnr) {
|
|
|
|
|
_player *player = &players[pnr];
|
|
|
|
|
int trypos, i;
|
|
|
|
|
|
|
|
|
|
/* check for respawn */
|
|
|
|
|
if (bman.gametype == GT_deathmatch && PS_IS_dead (player->state) && player->frame >= gfx.dead.frames) {
|
|
|
|
|
/* respawn only as long as not the game end have reached
|
|
|
|
|
* and when the gametype is deathmatch mode */
|
|
|
|
|
if (map.state == MS_normal && bman.gametype == GT_deathmatch
|
|
|
|
|
&& PS_IS_dead (player->state) && player->frame >= gfx.dead.frames) {
|
|
|
|
|
/* check new position */
|
|
|
|
|
d_printf ("Respawn for player %s\n", player->name);
|
|
|
|
|
trypos = 0;
|
|
|
|
@ -888,7 +893,8 @@ void player_checkdeath (int pnr) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check for respawn finish */
|
|
|
|
|
if (bman.gametype == GT_deathmatch && PS_IS_respawn (player->state) && player->frame >= gfx.respawn.frames) {
|
|
|
|
|
if (map.state == MS_normal && 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);
|
|
|
|
|