SetTileCursorSXSY(cSX, cSY);
}
+void BackToFront_MM(void)
+{
+ BlitScreenToBitmap_MM(backbuffer);
+
+ BackToFront();
+}
+
void ClearWindow(void)
{
- ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ ClearRectangle(drawto_mm, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
SetDrawtoField(DRAW_TO_BACKBUFFER);
SetDrawtoField_MM(DRAW_TO_BACKBUFFER);
getGraphicSource(graphic, frame, &bitmap, &src_x, &src_y);
- BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY,
+ BlitBitmap(bitmap, drawto_mm, src_x, src_y, TILEX, TILEY,
cFX + x * TILEX, cFY + y * TILEY);
}
}
#endif
- DrawGraphicExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY, graphic);
+ int frame = getGraphicAnimationFrameXY(graphic, x, y);
+
+ DrawGraphicAnimation_MM(x, y, graphic, frame);
MarkTileDirty(x, y);
}
BlitBitmap(bitmap, d, src_x, src_y, TILEX, TILEY, x, y);
}
-void DrawGraphicThruMask_MM(int x, int y, int graphic)
+void DrawGraphicThruMask_MM(int x, int y, int graphic, int frame)
{
#if DEBUG
if (!IN_SCR_FIELD(x,y))
}
#endif
- DrawGraphicThruMaskExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY,
- graphic);
+ DrawGraphicThruMaskExt_MM(drawto_mm, cFX + x * TILEX, cFY + y * TILEY,
+ graphic, frame);
MarkTileDirty(x,y);
}
void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y,
- int graphic)
+ int graphic, int frame)
{
int src_x, src_y;
Bitmap *src_bitmap;
if (graphic == IMG_EMPTY)
return;
- getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
void DrawMiniGraphic_MM(int x, int y, int graphic)
{
- DrawMiniGraphicExt_MM(drawto, cSX + x * MINI_TILEX, cSY + y * MINI_TILEY,
+ DrawMiniGraphicExt_MM(drawto_mm, cSX + x * MINI_TILEX, cSY + y * MINI_TILEY,
graphic);
MarkTileDirty(x / 2, y / 2);
}
-#if 0
-static void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
-{
- getSizedGraphicSource(graphic, 0, TILESIZE / 4, bitmap, x, y);
-}
-#endif
-
void DrawMiniGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic)
{
Bitmap *bitmap;
#endif
if (mask_mode == USE_MASKING)
- BlitBitmapMasked(src_bitmap, drawto_field,
+ BlitBitmapMasked(src_bitmap, drawto_mm,
src_x, src_y, TILEX, TILEY, dest_x, dest_y);
else
- BlitBitmap(src_bitmap, drawto_field,
+ BlitBitmap(src_bitmap, drawto_mm,
src_x, src_y, width, height, dest_x, dest_y);
MarkTileDirty(x,y);
if (dx || dy)
DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, mask_mode);
else if (mask_mode == USE_MASKING)
- DrawGraphicThruMask_MM(x, y, graphic);
+ DrawGraphicThruMask_MM(x, y, graphic, 0);
else
DrawGraphic_MM(x, y, graphic);
}
void DrawLevelField_MM(int x, int y)
{
- DrawScreenField_MM(x, y);
+ if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawScreenField_MM(SCREENX(x), SCREENY(y));
+ else if (IS_MOVING(x, y))
+ {
+ int newx,newy;
+
+ Moving2Blocked(x, y, &newx, &newy);
+ if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
+ DrawScreenField_MM(SCREENX(newx), SCREENY(newy));
+ }
+ else if (IS_BLOCKED(x, y))
+ {
+ int oldx, oldy;
+
+ Blocked2Moving(x, y, &oldx, &oldy);
+ if (IN_SCR_FIELD(SCREENX(oldx), SCREENY(oldy)))
+ DrawScreenField_MM(SCREENX(oldx), SCREENY(oldy));
+ }
}
void DrawMiniElement_MM(int x, int y, int element)
continue;
if (element & (1 << i))
- BlitBitmap(bitmap, drawto, gx, gy, MINI_TILEX, MINI_TILEY,
+ BlitBitmap(bitmap, drawto_mm, gx, gy, MINI_TILEX, MINI_TILEY,
dest_x, dest_y);
else
- ClearRectangle(drawto, dest_x, dest_y, MINI_TILEX, MINI_TILEY);
+ ClearRectangle(drawto_mm, dest_x, dest_y, MINI_TILEX, MINI_TILEY);
}
MarkTileDirty(x, y);
getSizedGraphicSource(graphic, frame, MINI_TILESIZE, &bitmap,
&src_x, &src_y);
- BlitBitmap(bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY,
+ BlitBitmap(bitmap, drawto_mm, src_x, src_y, MINI_TILEX, MINI_TILEY,
dst_x, dst_y);
}
}
laser.fuse_x == x &&
laser.fuse_y == y)
DrawGraphic_MM(x, y, IMG_MM_FUSE);
+ else if (element == EL_GRAY_BALL_ACTIVE)
+ DrawGraphic_MM(x, y, el_act2gfx(EL_GRAY_BALL, MM_ACTION_ACTIVE));
+ else if (element == EL_GRAY_BALL_OPENING)
+ DrawGraphic_MM(x, y, el_act2gfx(EL_GRAY_BALL, MM_ACTION_OPENING));
+ else if (element == EL_BOMB_ACTIVE)
+ DrawGraphic_MM(x, y, el_act2gfx(EL_BOMB, MM_ACTION_ACTIVE));
+ else if (element == EL_MINE_ACTIVE)
+ DrawGraphic_MM(x, y, el_act2gfx(EL_MINE, MM_ACTION_ACTIVE));
else
DrawGraphic_MM(x, y, el2gfx(element));
}
-#if 0
-static void DrawMicroWalls_MM(int x, int y, int element)
-{
- Bitmap *bitmap;
- int graphic = el2gfx(WALL_BASE(element));
- int gx, gy;
- int i;
-
- getMicroGraphicSource(graphic, &bitmap, &gx, &gy);
-
- for (i = 0; i < 4; i++)
- {
- int xpos = MICROLEV_XPOS + x * MICRO_TILEX + MICRO_WALLX * (i % 2);
- int ypos = MICROLEV_YPOS + y * MICRO_TILEY + MICRO_WALLY * (i / 2);
-
- if (element & (1 << i))
- BlitBitmap(bitmap, drawto, gx, gy, MICRO_WALLX, MICRO_WALLY, xpos, ypos);
- else
- ClearRectangle(drawto, xpos, ypos, MICRO_WALLX, MICRO_WALLY);
- }
-}
-
-static void DrawMicroElement_MM(int x, int y, int element)
-{
- Bitmap *bitmap;
- int graphic = el2gfx(element);
- int gx, gy;
-
- if (element == EL_EMPTY)
- return;
-
- if (IS_WALL(element))
- {
- DrawMicroWalls_MM(x, y, element);
-
- return;
- }
-
- getMicroGraphicSource(graphic, &bitmap, &gx, &gy);
-
- BlitBitmap(bitmap, drawto, gx, gy, MICRO_TILEX, MICRO_TILEY,
- MICROLEV_XPOS + x * MICRO_TILEX, MICROLEV_YPOS + y * MICRO_TILEY);
-}
-
-static void DrawMicroLevelExt_MM(int xpos, int ypos)
-{
- int x, y;
-
- ClearRectangle(drawto, xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
-
- for (x = 0; x < STD_LEV_FIELDX; x++)
- for (y = 0; y < STD_LEV_FIELDY; y++)
- DrawMicroElement_MM(x, y, Ur[x][y]);
-
- redraw_mask |= REDRAW_FIELD;
-}
-#endif
-
// ----------------------------------------------------------------------------
// XSN
dst_x, dst_y);
}
-#if 0
-static int REQ_in_range(int x, int y)
-{
- if (y > DY + 249 && y < DY + 278)
- {
- if (x > DX + 1 && x < DX + 48)
- return 1;
- else if (x > DX + 51 && x < DX + 98)
- return 2;
- }
-
- return 0;
-}
-#endif
-
Pixel ReadPixel(DrawBuffer *bitmap, int x, int y)
{
return GetPixel(bitmap, x, y);
}
-void SetRGB(unsigned int pixel,
- unsigned short red, unsigned short green, unsigned short blue)
-{
-}
-
int get_base_element(int element)
{
if (IS_MIRROR(element))
return base_element + (element_phase + step + num_elements) % num_elements;
}
-static int map_element(int element)
+int map_wall_from_base_element(int element)
{
switch (element)
{
- case EL_WALL_STEEL: return EL_STEEL_WALL;
- case EL_WALL_WOOD: return EL_WOODEN_WALL;
- case EL_WALL_ICE: return EL_ICE_WALL;
- case EL_WALL_AMOEBA: return EL_AMOEBA_WALL;
- case EL_DF_WALL_STEEL: return EL_DF_STEEL_WALL;
- case EL_DF_WALL_WOOD: return EL_DF_WOODEN_WALL;
+ case EL_WALL_STEEL_BASE: return EL_WALL_STEEL;
+ case EL_WALL_WOOD_BASE: return EL_WALL_WOOD;
+ case EL_WALL_ICE_BASE: return EL_WALL_ICE;
+ case EL_WALL_AMOEBA_BASE: return EL_WALL_AMOEBA;
+ case EL_DF_WALL_STEEL_BASE: return EL_DF_WALL_STEEL;
+ case EL_DF_WALL_WOOD_BASE: return EL_DF_WALL_WOOD;
default: return element;
}
}
-int el2gfx(int element)
+int map_wall_to_base_element(int element)
{
- element = map_element(element);
-
switch (element)
{
- case EL_LIGHTBALL:
- return IMG_MM_LIGHTBALL_RED + RND(3);
+ case EL_WALL_STEEL: return EL_WALL_STEEL_BASE;
+ case EL_WALL_WOOD: return EL_WALL_WOOD_BASE;
+ case EL_WALL_ICE: return EL_WALL_ICE_BASE;
+ case EL_WALL_AMOEBA: return EL_WALL_AMOEBA_BASE;
+ case EL_DF_WALL_STEEL: return EL_DF_WALL_STEEL_BASE;
+ case EL_DF_WALL_WOOD: return EL_DF_WALL_WOOD_BASE;
- default:
- return el2img_mm(element);
+ default: return element;
}
}
+int el2gfx(int element)
+{
+ return el2img_mm(map_wall_from_base_element(element));
+}
+
+int el_act2gfx(int element, int action)
+{
+ return el_act2img_mm(map_wall_from_base_element(element), action);
+}
+
void RedrawPlayfield_MM(void)
{
DrawLevel_MM();
void BlitScreenToBitmap_MM(Bitmap *target_bitmap)
{
- BlitBitmap(drawto_field, target_bitmap,
+ BlitBitmap(drawto_mm, target_bitmap,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY);
}