moving player on slow systems and high speed illness

origin
stpohle 22 years ago
parent 7c19823bcd
commit 2bb83b37e2

@ -1,4 +1,4 @@
$Id: ChangeLog,v 1.60 2004/02/01 00:44:16 stpohle Exp $ $Id: ChangeLog,v 1.61 2004/02/01 01:15:03 stpohle Exp $
- Added: Deathmatch mode. - Added: Deathmatch mode.
@ -39,6 +39,9 @@ $Id: ChangeLog,v 1.60 2004/02/01 00:44:16 stpohle Exp $
- Fixed: Crash on Hosting games with OGC enabled and no internet - Fixed: Crash on Hosting games with OGC enabled and no internet
connection connection
- Fixed: player_move had a problem with the speed of the player
on slow systems.
Version 0.11.0 Version 0.11.0
============== ==============

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.20 2004/01/27 22:17:22 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.21 2004/02/01 01:15:04 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -101,6 +101,7 @@ struct {
_bomb bombs[MAX_BOMBS]; // number of bombs who are ticking. _bomb bombs[MAX_BOMBS]; // number of bombs who are ticking.
int range; // range of the bombs int range; // range of the bombs
float speed; // how fast we can go (0 = slow, 1 = normal... 3 = fastest) float speed; // how fast we can go (0 = slow, 1 = normal... 3 = fastest)
float stepsleft; // distance to walk on the next stepmove_player
int collect_shoes; int collect_shoes;
_playerilness ill[PI_max]; // all possible types _playerilness ill[PI_max]; // all possible types
_special special; // special the player has _special special; // special the player has

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.74 2004/02/01 00:10:27 stpohle Exp $ /* $Id: player.c,v 1.75 2004/02/01 01:15:04 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>
@ -217,8 +217,8 @@ player_check_powerup (int p_nr)
/* we found a shoe powerup */ /* we found a shoe powerup */
case FT_shoe: case FT_shoe:
if (p->speed < MAX_SPEED && p->ill[PI_slow].to <= 0.0) { if (p->speed < MAX_SPEED && p->ill[PI_slow].to <= 0.0) {
p->speed *= SPEEDMUL;
bman.updatestatusbar = 1; bman.updatestatusbar = 1;
p->speed *= SPEEDMUL;
p->collect_shoes++; p->collect_shoes++;
} }
field_clear (fx, fy); field_clear (fx, fy);
@ -318,8 +318,8 @@ stepmove_player (int pl_nr)
else else
speed = 1.0f - _pos.y; speed = 1.0f - _pos.y;
if (speed > (p->speed) || speed == 0) if (speed > (p->stepsleft) || speed == 0)
speed = p->speed; speed = p->stepsleft;
// check the new field position // check the new field position
d.x = d.y = 0.0f; d.x = d.y = 0.0f;
@ -380,7 +380,7 @@ stepmove_player (int pl_nr)
p->pos.x = map.tunnel[tunnelnr].x; p->pos.x = map.tunnel[tunnelnr].x;
p->pos.y = map.tunnel[tunnelnr].y; p->pos.y = map.tunnel[tunnelnr].y;
p->tunnelto = GAME_TUNNEL_TO; p->tunnelto = GAME_TUNNEL_TO;
speed = p->speed; speed = p->stepsleft;
} }
} }
} }
@ -388,7 +388,7 @@ stepmove_player (int pl_nr)
if (d.x == 0.0f && d.y == 0.0f) if (d.x == 0.0f && d.y == 0.0f)
return 0; return 0;
return (p->speed - speed); return (p->stepsleft - speed);
}; };
@ -417,8 +417,7 @@ void
move_player (int pl_nr) move_player (int pl_nr)
{ {
int oldd; int oldd, coll_speed;
float speed, stepsleft;
_player *p = &players[pl_nr]; _player *p = &players[pl_nr];
if (p->tunnelto > 0.0f) { if (p->tunnelto > 0.0f) {
@ -432,15 +431,11 @@ move_player (int pl_nr)
/* prepade playervariables for the moving */ /* prepade playervariables for the moving */
player_animation (p); player_animation (p);
oldd = p->d; oldd = p->d;
speed = p->speed; p->stepsleft = p->speed * timefactor;
stepsleft = speed * timefactor; coll_speed = p->collect_shoes;
do { do {
p->d = oldd; p->d = oldd;
p->speed = stepsleft; } while ((p->stepsleft = stepmove_player (pl_nr)) > 0);
} 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 */ /* network packet send control - send data if it's time to send or if we need to */
if (GT_MP) if (GT_MP)

@ -1,4 +1,4 @@
/* $Id: single.c,v 1.56 2004/01/28 18:19:12 stpohle Exp $ */ /* $Id: single.c,v 1.57 2004/02/01 01:15:04 stpohle Exp $ */
/* single player */ /* single player */
#include "basic.h" #include "basic.h"
@ -577,7 +577,7 @@ single_create_ai (int num_players)
for (pl = NULL, p = 0; (pl == NULL && p < MAX_PLAYERS); p++) for (pl = NULL, p = 0; (pl == NULL && p < MAX_PLAYERS); p++)
if (!(PS_IS_used (players[p].state))) { if (!(PS_IS_used (players[p].state))) {
pl = &players[p]; pl = &players[p];
sprintf (pl->name, "AIPlayer %d", p + 1); sprintf (pl->name, "AI %d", p + 1);
pl->state |= PSF_used + PSF_alife + PSF_playing + PSF_ai; pl->state |= PSF_used + PSF_alife + PSF_playing + PSF_ai;
pl->net.flags = NETF_firewall; pl->net.flags = NETF_firewall;
sprintf (pl->net.addr.host, "localhost"); sprintf (pl->net.addr.host, "localhost");

Loading…
Cancel
Save