Tunnel fixed player postitions and destination of the tunnels.. they got sometimes overwritten

origin
stpohle 22 years ago
parent 0a2af7c18c
commit 51968034b1

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.50 2003/08/10 15:10:19 stpohle Exp $ */
/* $Id: bomberclone.h,v 1.51 2003/08/10 21:10:07 stpohle Exp $ */
/* bomberclone.h */
#ifndef _BOMBERCLONE_H_
@ -191,6 +191,7 @@ extern void field_animation ();
extern void field_loop ();
extern void field_hurrysize ();
extern void field_hurrydropitems ();
extern int field_check_alldirs (int x, int y, int type);
extern void draw_stone (int x, int y);
extern void stonelist_add (int x, int y);
extern void stonelist_del ();
@ -217,6 +218,7 @@ extern void player_check_powerup (int p_nr);
extern void player_set_gfx (_player *p, signed char gfx_nr);
extern int player_findfreebomb (_player *player);
extern int player_checkpos (int x, int y);
extern inline int postofield (int pos);
// for the bomb..
extern int bomb_loop ();

@ -1,4 +1,4 @@
/* $Id: field.c,v 1.43 2003/08/10 15:10:19 stpohle Exp $ */
/* $Id: field.c,v 1.44 2003/08/10 21:10:07 stpohle Exp $ */
/* field.c - procedures which are needed to control the field */
#include "bomberclone.h"
@ -203,6 +203,17 @@ draw_field ()
};
/* will check all direction without the field on pos x,y
for the fieldtype */
int field_check_alldirs (int x, int y, int type) {
if (x <= 0 || y <= 0 || x >= map.size.x-1 || y >= map.size.y-1)
return 0;
if (map.field[x-1][y].type == type || map.field[x+1][y].type == type || map.field[x][y-1].type == type || map.field[x][y+1].type == type)
return 1;
else
return 0;
}
// clear field and send this to all netplayers
void
field_clear (int x, int y)

@ -1,4 +1,4 @@
/* $Id: map.c,v 1.8 2003/08/10 19:31:14 stpohle Exp $ */
/* $Id: map.c,v 1.9 2003/08/10 21:10:07 stpohle Exp $ */
/* map handling, like generate and load maps. */
#include "bomberclone.h"
@ -19,14 +19,15 @@ map_fillitems (int fieldtype, int num)
for (d = 0; d < num * fkt; d++) {
x = y = 0;
while (map.field[x][y].type != FT_tunnel && map.field[x][y].type != FT_stone && map.field[x][y].special != FT_nothing) {
while (map.field[x][y].type != FT_stone && map.field[x][y].special != FT_nothing) {
x = ((float) rand () / (float) RAND_MAX) * (map.size.x - 1);
y = ((float) rand () / (float) RAND_MAX) * (map.size.y - 1);
nb_try--;
if (nb_try < 0)
break;
}
map.field[x][y].special = fieldtype;
if (map.field[x][y].type != FT_tunnel)
map.field[x][y].special = fieldtype;
}
}

@ -397,8 +397,9 @@ move_player (int pl_nr)
/* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single)
net_game_send_playermove (pl_nr, (p->old_m == 0));
if (p->tunnelto == 0)
p->tunnelto = -1;
if (p->tunnelto == 0 && (map.field[postofield(p->pos.x)][postofield(p->pos.y)].type != FT_tunnel || !field_check_alldirs (p->pos.x>>8, p->pos.y>>8, FT_nothing)))
p->tunnelto = -1;
}
/* the player just stopt moving so send data */
@ -425,6 +426,16 @@ move_player (int pl_nr)
};
inline int postofield (int pos) {
int rp = pos & 8;
if (rp > 0 && rp <= 128)
return (pos >> 8);
else
return ((pos >> 8)+1);
}
void
player_drop_bomb (int pl_nr)
{

Loading…
Cancel
Save