X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_caveengine.c;h=03722b801ca1e62f9943f583685a8ea07d2745ea;hb=5a02e2518b0de59c2a7190ac4e61c2764d4047eb;hp=b2c78716ecb08b8379e6e09215257c8e564cd0cc;hpb=3fb6a71ff8cb550457ba2f4497993d75ef2742bd;p=rocksndiamonds.git diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index b2c78716..03722b80 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -983,17 +983,18 @@ static GdElement player_get_element(GdCave* cave, const GdElement object, int x, process a crazy dream-style teleporter. called from gd_cave_iterate, for a player or a player_bomb. player is standing at px, py, and trying to move in the direction player_move, - where there is a teleporter. - we check the whole cave, from px+1,py, till we get back to px,py (by wrapping + where there is a teleporter at (tx_start, ty_start). we check the whole cave, + from (tx_start + 1, ty_start), till we get back to (tx_start, ty_start) (by wrapping around). the first teleporter we find, and which is suitable, will be the destination. return TRUE if teleporter worked, FALSE if cound not find any suitable teleporter. - */ +*/ static boolean do_teleporter(GdCave *cave, int px, int py, GdDirection player_move) { - int tx, ty; - - tx = px; - ty = py; + // start at teleporter position (not at player position!) + int tx_start = px + gd_dx[player_move]; + int ty_start = py + gd_dy[player_move]; + int tx = tx_start; + int ty = ty_start; do { @@ -1025,7 +1026,7 @@ static boolean do_teleporter(GdCave *cave, int px, int py, GdDirection player_mo } } // loop until we get back to original coordinates - while (tx != px || ty != py); + while (tx != tx_start || ty != ty_start); // return false as we did not find any usable teleporter return FALSE; @@ -3472,7 +3473,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // PLAYER // check if player is alive. - if ((cave->player_state == GD_PL_LIVING && cave->player_seen_ago > 15) || cave->kill_player) + if ((cave->player_state == GD_PL_LIVING && cave->player_seen_ago > 1) || cave->kill_player) cave->player_state = GD_PL_DIED; // check if any voodoo exploded, and kill players the next scan if that happended.