Tunnel is now working with multiplayergames. player->tunnelto will be now send together with the PKG_playermove packet.

origin
stpohle 22 years ago
parent 408c67b41f
commit eaca81b97a

@ -1,6 +1,7 @@
$Id: ChangeLog,v 1.37 2003/08/10 15:10:19 stpohle Exp $
$Id: ChangeLog,v 1.38 2003/08/24 20:18:06 stpohle Exp $
- tunnels added
- added tunnels to the game so player can go through.
PKG_playermove changed and PGK_tunneldata added
- the first music file added to the game made by
Digital_D <siggy_stardust@hotmail.com>

@ -515,6 +515,7 @@ send_playermove (_net_addr * addr, int p_nr, _player * pl)
p_dat.d = pl->d;
p_dat.p_nr = p_nr;
p_dat.speed = pl->speed;
p_dat.tunnelto = pl->tunnelto;
send_pkg ((struct pkg *) &p_dat, addr);
};
@ -577,6 +578,7 @@ do_playermove (struct pkg_playermove *p_dat, _net_addr * addr)
pl->speed = p_dat->speed;
pl->pos.x = p_dat->pos.x;
pl->pos.y = p_dat->pos.y;
pl->tunnelto = p_dat->tunnelto;
}

@ -144,6 +144,7 @@ struct pkg_playermove {
signed char m;
signed char d;
signed char speed;
short int tunnelto;
_point pos;
};

@ -242,7 +242,6 @@ stepmove_player (int pl_nr)
d;
if (p->m == 1) {
fpos.x = p->pos.x >> 8;
fpos.y = p->pos.y >> 8;
_pos.x = p->pos.x & 255;
@ -319,6 +318,7 @@ stepmove_player (int pl_nr)
_pos.x = p->pos.x & 255;
_pos.y = p->pos.y & 255;
/* check if we can go though a tunnel */
if (_pos.x == 0 && _pos.y == 0 && map.field[fpos.x][fpos.y].type == FT_tunnel
&& p->tunnelto == -1) {
d_printf ("Tunnel [%d] Player %s is going to (%d,%d)\n",
@ -337,6 +337,7 @@ stepmove_player (int pl_nr)
p->pos.x = map.tunnel[map.field[fpos.x][fpos.y].special].x << 8;
p->pos.y = map.tunnel[map.field[fpos.x][fpos.y].special].y << 8;
p->tunnelto = GAME_TUNNEL_TO;
speed = p->speed;
}
}
}
@ -380,8 +381,12 @@ move_player (int pl_nr)
oldd = p->d;
if (p->tunnelto > 0)
if (p->tunnelto > 0) {
p->tunnelto--;
p->m = 0;
if (p->tunnelto <= 0 && GT_MP_PTP)
net_game_send_playermove (bman.p_nr, 1);
}
else {
if (p->m) {
player_animation (p);

Loading…
Cancel
Save