+static void DrawLaserLines(struct XY *points, int num_points, int mode)
+{
+ Pixel pixel_drawto = (mode == DL_LASER_ENABLED ? pen_ray : pen_bg);
+ Pixel pixel_buffer = (mode == DL_LASER_ENABLED ? WHITE_PIXEL : BLACK_PIXEL);
+
+ DrawLines(drawto, points, num_points, pixel_drawto);
+
+ BEGIN_NO_HEADLESS
+ {
+ DrawLines(laser_bitmap, points, num_points, pixel_buffer);
+ }
+ END_NO_HEADLESS
+}
+
+static boolean CheckLaserPixel(int x, int y)
+{
+ Pixel pixel;
+
+ BEGIN_NO_HEADLESS
+ {
+ pixel = ReadPixel(laser_bitmap, x, y);
+ }
+ END_NO_HEADLESS
+
+ return (pixel == WHITE_PIXEL);
+}
+
+static void CheckExitMM()
+{
+ int exit_element = EL_EMPTY;
+ int exit_x = 0;
+ int exit_y = 0;
+ int x, y;
+ static int xy[4][2] =
+ {
+ { +1, 0 },
+ { 0, -1 },
+ { -1, 0 },
+ { 0, +1 }
+ };
+
+ for (y = 0; y < lev_fieldy; y++)
+ {
+ for (x = 0; x < lev_fieldx; x++)
+ {
+ if (Feld[x][y] == EL_EXIT_CLOSED)
+ {
+ /* initiate opening animation of exit door */
+ Feld[x][y] = EL_EXIT_OPENING;
+
+ exit_element = EL_EXIT_OPEN;
+ exit_x = x;
+ exit_y = y;
+ }
+ else if (IS_RECEIVER(Feld[x][y]))
+ {
+ /* remove field that blocks receiver */
+ int phase = Feld[x][y] - EL_RECEIVER_START;
+ int blocking_x, blocking_y;
+
+ blocking_x = x + xy[phase][0];
+ blocking_y = y + xy[phase][1];
+
+ if (IN_LEV_FIELD(blocking_x, blocking_y))
+ {
+ Feld[blocking_x][blocking_y] = EL_EMPTY;
+
+ DrawField_MM(blocking_x, blocking_y);
+ }
+
+ exit_element = EL_RECEIVER;
+ exit_x = x;
+ exit_y = y;
+ }
+ }
+ }
+
+ if (exit_element != EL_EMPTY)
+ PlayLevelSound_MM(exit_x, exit_y, exit_element, MM_ACTION_OPENING);
+}
+