pen_ray =
GetPixelFromRGB(window,
- (native_mm_level.laser_red ? color_max : color_up),
- (native_mm_level.laser_green ? color_down : color_min),
- (native_mm_level.laser_blue ? color_down : color_min));
+ (game_mm.laser_red ? color_max : color_up),
+ (game_mm.laser_green ? color_down : color_min),
+ (game_mm.laser_blue ? color_down : color_min));
}
static void InitMovDir_MM(int x, int y)
laser.start_edge.x = x;
laser.start_edge.y = y;
laser.start_angle = get_element_angle(element);
+
+ if (IS_MCDUFFIN(element))
+ {
+ game_mm.laser_red = native_mm_level.mm_laser_red;
+ game_mm.laser_green = native_mm_level.mm_laser_green;
+ game_mm.laser_blue = native_mm_level.mm_laser_blue;
+ }
+ else
+ {
+ game_mm.laser_red = native_mm_level.df_laser_red;
+ game_mm.laser_green = native_mm_level.df_laser_green;
+ game_mm.laser_blue = native_mm_level.df_laser_blue;
+ }
}
break;
game_mm.num_keys = 0;
game_mm.ball_choice_pos = 0;
+ game_mm.laser_red = FALSE;
+ game_mm.laser_green = FALSE;
+ game_mm.laser_blue = TRUE;
+
game_mm.level_solved = FALSE;
game_mm.game_over = FALSE;
game_mm.game_over_cause = 0;
return hit_mask;
}
-void ScanLaser(void)
+static void DeactivateLaserTargetElement(void)
{
- int element;
- int end = 0, rf = laser.num_edges;
-
- // do not scan laser again after the game was lost for whatever reason
- if (game_mm.game_over)
- return;
-
if (laser.dest_element_last == EL_BOMB_ACTIVE ||
laser.dest_element_last == EL_MINE_ACTIVE ||
laser.dest_element_last == EL_GRAY_BALL_OPENING)
laser.dest_element_last_x = -1;
laser.dest_element_last_y = -1;
}
+}
+
+void ScanLaser(void)
+{
+ int element;
+ int end = 0, rf = laser.num_edges;
+
+ // do not scan laser again after the game was lost for whatever reason
+ if (game_mm.game_over)
+ return;
+
+ // do not scan laser if fuse is off
+ if (laser.fuse_off)
+ return;
+
+ DeactivateLaserTargetElement();
laser.overloaded = FALSE;
laser.stops_inside_element = FALSE;
if (rf)
DrawLaser(rf - 1, DL_LASER_ENABLED);
rf = laser.num_edges;
+
+ if (!IS_DF_WALL_STEEL(element))
+ {
+ // only used for scanning DF steel walls; reset for all other elements
+ last_LX = 0;
+ last_LY = 0;
+ last_hit_mask = 0;
+ }
}
#if 0
void DrawLaser(int start_edge, int mode)
{
+ // do not draw laser if fuse is off
+ if (laser.fuse_off && mode == DL_LASER_ENABLED)
+ return;
+
+ if (mode == DL_LASER_DISABLED)
+ DeactivateLaserTargetElement();
+
if (laser.num_edges - start_edge < 0)
{
Warn("DrawLaser: laser.num_edges - start_edge < 0");
// this is more precise: check if laser would go through the center
if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS)
{
+ // prevent cutting through laser emitter with laser beam
+ if (IS_LASER(element))
+ return TRUE;
+
// skip the whole element before continuing the scan
do
{