1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
switch (direction)
{
case LEFT:
if (rx - hallway - rw <= 0 || ry - offset_y <= 0)
break;
if (collision(rx - hallway - rw, ry - offset_y, rw, rh))
break;
fill(rx - hallway - rw, ry - offset_y, rw, rh, 1);
fill(rx - hallway, ry, hallway, 1, 1);
i++;
break;
case UP:
if (rx - offset_x <= 0 || ry - hallway - rh <= 0)
break;
if (collision(rx - offset_x, ry - hallway - rh, rw, rh))
break;
fill(rx - offset_x, ry - hallway - rh, rw, rh, 1);
fill(rx, ry - hallway, 1, hallway, 1);
i++;
break;
case RIGHT:
if (rx + hallway + rw >= cwidth || ry + offset_y >= cheight)
break;
if (collision(rx + hallway, ry - offset_y, rw, rh))
break;
fill(rx + hallway, ry - offset_y, rw, rh, 1);
fill(rx, ry, hallway, 1, 1);
i++;
break;
case DOWN:
if (rx + offset_x >= cwidth || ry + hallway + rh >= cheight)
break;
if (collision(rx - offset_x, ry + hallway, rw, rh))
break;
fill(rx - offset_x, ry + hallway, rw, rh, 1);
fill(rx, ry, 1, hallway, 1);
i++;
break;
}
}
q++;
if (q > 1000000000)
i = room_count;
}
}
|