Fixed: If the player is move on a field where is currently an explosion then will the player die.

origin
stpohle 22 years ago
parent c61297e2cd
commit 4e3e315223

@ -1,4 +1,7 @@
$Id: ChangeLog,v 1.46 2003/12/28 19:07:37 stpohle Exp $ $Id: ChangeLog,v 1.47 2004/01/02 13:54:47 stpohle Exp $
- Fixed: If the player is move on a field where is
currently an explosion then will the player die.
- wrote new OpenGameCache Server for this game and - wrote new OpenGameCache Server for this game and
other games. This server is working almost the same other games. This server is working almost the same

@ -1,12 +1,9 @@
$Id: TODO,v 1.32 2003/12/31 01:09:58 stpohle Exp $ $Id: TODO,v 1.33 2004/01/02 13:54:47 stpohle Exp $
* player position at start up need some little work * player position at start up need some little work
it is still happening that player just die because it is still happening that player just die because
they could not been set. they could not been set.
* check if the player is on a field with
an running explosion
- better configuration for home made map files - better configuration for home made map files
- opetion that you can have only one illness.. if you catch - opetion that you can have only one illness.. if you catch

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.9 2003/12/24 02:38:15 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.10 2004/01/02 13:54:48 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -201,6 +201,7 @@ extern void player_died (_player * player, signed char dead_by);
extern void draw_players (); extern void draw_players ();
extern void player_animation (_player * player); extern void player_animation (_player * player);
extern int check_field (short int x, short int y); extern int check_field (short int x, short int y);
extern int check_exfield (short int x, short int y);
extern void player_calcstep (_player * pl); extern void player_calcstep (_player * pl);
extern void player_calcpos (); extern void player_calcpos ();
extern void player_set_ilness (_player *p, int t); extern void player_set_ilness (_player *p, int t);

@ -1,4 +1,5 @@
/* player.c - everything what have to do with the player */ /* $Id: player.c,v 1.55 2004/01/02 13:54:48 stpohle Exp $
* player.c - everything what have to do with the player */
#include <SDL.h> #include <SDL.h>
#include "bomberclone.h" #include "bomberclone.h"
@ -213,7 +214,7 @@ player_check_powerup (int p_nr)
int int
check_field (short int x, short int y) check_field (short int x, short int y)
{ {
int res = 0; int res = 0, i;
if (map.field[x][y].type != FT_stone && map.field[x][y].type != FT_block) if (map.field[x][y].type != FT_stone && map.field[x][y].type != FT_block)
res = 1; res = 1;
@ -222,6 +223,18 @@ check_field (short int x, short int y)
} }
/* check if there is any explosion on this field */
int check_exfield (short int x, short int y) {
int res = 1, i;
for (i = 0; (i < 4 && res == 1); i++)
if (map.field[x][y].ex[i].count > 0)
res = 0;
return res;
}
/* make only a smal step until i can go around the corner /* make only a smal step until i can go around the corner
return the rest speed for this move */ return the rest speed for this move */
int int
@ -400,15 +413,15 @@ move_player (int pl_nr)
/* check the players position */ /* check the players position */
if ((CUTINT(p->pos.x) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right)) if ((CUTINT(p->pos.x) > EXPLOSION_SAVE_DISTANCE && (p->d == left || p->d == right))
&& (!check_field (p->pos.x + 1.0f, p->pos.y))) && (!check_exfield (p->pos.x + 1.0f, p->pos.y)))
player_died (p, -1); player_died (p, -1);
if ((CUTINT(p->pos.y) > EXPLOSION_SAVE_DISTANCE && (p->d == up || p->d == down)) if ((CUTINT(p->pos.y) > EXPLOSION_SAVE_DISTANCE && (p->d == up || p->d == down))
&& (!check_field (p->pos.x, p->pos.y + 1.0f))) && (!check_exfield (p->pos.x, p->pos.y + 1.0f)))
player_died (p, -1); player_died (p, -1);
if (((CUTINT(p->pos.x) < (1.0f - EXPLOSION_SAVE_DISTANCE) && (p->d == left || p->d == right)) if (((CUTINT(p->pos.x) < (1.0f - EXPLOSION_SAVE_DISTANCE) && (p->d == left || p->d == right))
|| (CUTINT(p->pos.y) < (1.0f - EXPLOSION_SAVE_DISTANCE) || (CUTINT(p->pos.y) < (1.0f - EXPLOSION_SAVE_DISTANCE)
&& (p->d == up || p->d == down))) && (p->d == up || p->d == down)))
&& (!check_field (p->pos.x, p->pos.y))) && (!check_exfield (p->pos.x, p->pos.y)))
player_died (p, -1); player_died (p, -1);
} }
}; };

Loading…
Cancel
Save