void AddLaserEdge(int lx, int ly)
{
- if (lx < -2 || ly < -2 || lx >= SXSIZE + 2 || ly >= SYSIZE + 2)
+ int clx = dSX + lx;
+ int cly = dSY + ly;
+
+ if (clx < -2 || cly < -2 || clx >= SXSIZE + 2 || cly >= SYSIZE + 2)
{
Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly);
return;
}
- laser.edge[laser.num_edges].x = SX + 2 + lx;
- laser.edge[laser.num_edges].y = SY + 2 + ly;
+ laser.edge[laser.num_edges].x = cSX2 + lx;
+ laser.edge[laser.num_edges].y = cSY2 + ly;
laser.num_edges++;
laser.redraw = TRUE;
{
int x = LX - XS;
int y = LY - YS;
- int last_x = laser.edge[laser.num_edges - 1].x - SX - 2;
- int last_y = laser.edge[laser.num_edges - 1].y - SY - 2;
+ int last_x = laser.edge[laser.num_edges - 1].x - cSX2;
+ int last_y = laser.edge[laser.num_edges - 1].y - cSY2;
return ((x - last_x) * XS < 0 || (y - last_y) * YS < 0);
}
}
else
{
- pixel = (SX + px < REAL_SX || SX + px >= REAL_SX + FULL_SXSIZE ||
- SY + py < REAL_SY || SY + py >= REAL_SY + FULL_SYSIZE);
+ pixel = (cSX + px < REAL_SX || cSX + px >= REAL_SX + FULL_SXSIZE ||
+ cSY + py < REAL_SY || cSY + py >= REAL_SY + FULL_SYSIZE);
}
if ((Sign[laser.current_angle] & (1 << i)) && pixel)
if (start_edge == 0)
laser.current_angle = laser.start_angle;
- LX = laser.edge[start_edge].x - (SX + 2);
- LY = laser.edge[start_edge].y - (SY + 2);
+ LX = laser.edge[start_edge].x - cSX2;
+ LY = laser.edge[start_edge].y - cSY2;
XS = 2 * Step[laser.current_angle].x;
YS = 2 * Step[laser.current_angle].y;
if (game_mm.kettles_still_needed > 0)
game_mm.kettles_still_needed--;
+ game.snapshot.collected_item = TRUE;
+
if (game_mm.kettles_still_needed == 0)
{
CheckExitMM();
getGraphicSource(graphic, 0, &bitmap, &gx, &gy);
BlitBitmap(bitmap, drawto, gx + dx, gy + dy, 6, 6,
- SX + x * TILEX + dx, SY + y * TILEY + dy);
+ cSX + x * TILEX + dx, cSY + y * TILEY + dy);
MarkTileDirty(x, y);
}
else if (IS_MCDUFFIN(Store[x][y]))
{
Store[x][y] = EL_EMPTY;
+
+ game.restart_game_message = "Bomb killed Mc Duffin ! Play it again ?";
}
Feld[x][y] = Store[x][y];
getGraphicSource(graphic, graphic_phase, &bitmap, &src_x, &src_y);
BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY,
- FX + x * TILEX, FY + y * TILEY);
+ cFX + x * TILEX, cFY + y * TILEY);
MarkTileDirty(x, y);
}
laser.redraw = TRUE;
}
-void ClickElement(int x, int y, int button)
+boolean ClickElement(int x, int y, int button)
{
static unsigned int click_delay = 0;
static int click_delay_value = CLICK_DELAY;
static boolean new_button = TRUE;
+ boolean element_clicked = FALSE;
int element;
if (button == -1)
click_delay_value = CLICK_DELAY;
new_button = TRUE;
- return;
+ return FALSE;
}
/* do not rotate objects hit by the laser after the game was solved */
if (game_mm.level_solved && Hit[x][y])
- return;
+ return FALSE;
if (button == MB_RELEASED)
{
/* release eventually hold auto-rotating mirror */
RotateMirror(x, y, MB_RELEASED);
- return;
+ return FALSE;
}
if (!FrameReached(&click_delay, click_delay_value) && !new_button)
- return;
+ return FALSE;
if (button == MB_MIDDLEBUTTON) /* middle button has no function */
- return;
+ return FALSE;
if (!IN_LEV_FIELD(x, y))
- return;
+ return FALSE;
if (Feld[x][y] == EL_EMPTY)
- return;
+ return FALSE;
element = Feld[x][y];
IS_DF_MIRROR_AUTO(element))
{
RotateMirror(x, y, button);
+
+ element_clicked = TRUE;
}
else if (IS_MCDUFFIN(element))
{
if (!laser.fuse_off)
ScanLaser();
+
+ element_clicked = TRUE;
}
else if (element == EL_FUSE_ON && laser.fuse_off)
{
if (x != laser.fuse_x || y != laser.fuse_y)
- return;
+ return FALSE;
laser.fuse_off = FALSE;
laser.fuse_x = laser.fuse_y = -1;
DrawGraphic_MM(x, y, IMG_MM_FUSE_ACTIVE);
ScanLaser();
+
+ element_clicked = TRUE;
}
else if (element == EL_FUSE_ON && !laser.fuse_off && new_button)
{
DrawLaser(0, DL_LASER_DISABLED);
DrawGraphic_MM(x, y, IMG_MM_FUSE);
+
+ element_clicked = TRUE;
}
else if (element == EL_LIGHTBALL)
{
Bang_MM(x, y);
RaiseScoreElement_MM(element);
DrawLaser(0, DL_LASER_ENABLED);
+
+ element_clicked = TRUE;
}
click_delay_value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
new_button = FALSE;
+
+ return element_clicked;
}
void RotateMirror(int x, int y, int button)
if (bits & HIT_POS_CENTER)
{
- if (CheckLaserPixel(SX + obx + 15,
- SY + oby + 15))
+ if (CheckLaserPixel(cSX + obx + 15,
+ cSY + oby + 15))
return TRUE;
}
if (bits & HIT_POS_EDGE)
{
for (i = 0; i < 4; i++)
- if (CheckLaserPixel(SX + obx + 31 * (i % 2),
- SY + oby + 31 * (i / 2)))
+ if (CheckLaserPixel(cSX + obx + 31 * (i % 2),
+ cSY + oby + 31 * (i / 2)))
return TRUE;
}
if (bits & HIT_POS_BETWEEN)
{
for (i = 0; i < 4; i++)
- if (CheckLaserPixel(SX + 4 + obx + 22 * (i % 2),
- SY + 4 + oby + 22 * (i / 2)))
+ if (CheckLaserPixel(cSX + 4 + obx + 22 * (i % 2),
+ cSY + 4 + oby + 22 * (i / 2)))
return TRUE;
}
SetTileCursorActive(FALSE);
+ game.restart_game_message = "Out of magic energy ! Play it again ?";
+
#if 0
if (Request("Out of magic energy ! Play it again ?",
REQ_ASK | REQ_STAY_CLOSED))
SetTileCursorActive(FALSE);
+ game.restart_game_message = "Magic spell hit Mc Duffin ! Play it again ?";
+
#if 0
if (Request("Magic spell hit Mc Duffin ! Play it again ?",
REQ_ASK | REQ_STAY_CLOSED))
/*
laser.num_edges--;
- LX = laser.edge[laser.num_edges].x - (SX + 2);
- LY = laser.edge[laser.num_edges].y - (SY + 2);
+ LX = laser.edge[laser.num_edges].x - cSX2;
+ LY = laser.edge[laser.num_edges].y - cSY2;
*/
for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--)
{
if (laser.wall_mask & (1 << i))
{
- if (CheckLaserPixel(SX + ELX * TILEX + 14 + (i % 2) * 2,
- SY + ELY * TILEY + 31 * (i / 2)))
+ if (CheckLaserPixel(cSX + ELX * TILEX + 14 + (i % 2) * 2,
+ cSY + ELY * TILEY + 31 * (i / 2)))
break;
- if (CheckLaserPixel(SX + ELX * TILEX + 31 * (i % 2),
- SY + ELY * TILEY + 14 + (i / 2) * 2))
+ if (CheckLaserPixel(cSX + ELX * TILEX + 31 * (i % 2),
+ cSY + ELY * TILEY + 14 + (i / 2) * 2))
break;
}
}
{
if (laser.wall_mask & (1 << i))
{
- if (CheckLaserPixel(SX + ELX * TILEX + 31 * (i % 2),
- SY + ELY * TILEY + 31 * (i / 2)))
+ if (CheckLaserPixel(cSX + ELX * TILEX + 31 * (i % 2),
+ cSY + ELY * TILEY + 31 * (i / 2)))
break;
}
}
if (laser.num_beamers > 0 ||
k1 < 1 || k2 < 4 || k3 < 4 ||
- CheckLaserPixel(SX + ELX * TILEX + 14,
- SY + ELY * TILEY + 14))
+ CheckLaserPixel(cSX + ELX * TILEX + 14,
+ cSY + ELY * TILEY + 14))
{
laser.num_edges = r;
laser.num_damages = d;
void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
{
- ClickElement(action.lx, action.ly, action.button);
+ boolean element_clicked = ClickElement(action.lx, action.ly, action.button);
+ boolean button_released = (action.button == MB_RELEASED);
GameActions_MM_Ext(action, warp_mode);
- CheckSingleStepMode_MM(action.button == MB_RELEASED);
+ CheckSingleStepMode_MM(element_clicked, button_released);
}
void MovePacMen()
getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
CT = FrameCounter;
- ox = SX + ox * TILEX;
- oy = SY + oy * TILEY;
+ ox = cSX + ox * TILEX;
+ oy = cSY + oy * TILEY;
for (i = 1; i < 33; i += 2)
BlitBitmap(bitmap, window,
int getButtonFromTouchPosition(int x, int y, int dst_mx, int dst_my)
{
// calculate start (source) position to be at the middle of the tile
- int src_mx = SX + x * TILESIZE_VAR + TILESIZE_VAR / 2;
- int src_my = SY + y * TILESIZE_VAR + TILESIZE_VAR / 2;
+ int src_mx = cSX + x * TILESIZE_VAR + TILESIZE_VAR / 2;
+ int src_my = cSY + y * TILESIZE_VAR + TILESIZE_VAR / 2;
int dx = dst_mx - src_mx;
int dy = dst_my - src_my;
int element;