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);
}
void DrawGraphic_MM(int x, int y, int graphic)
{
#if DEBUG
- if (!IN_SCR_FIELD(x,y))
+ if (!IN_SCR_FIELD(x, y))
{
Debug("game:mm:DrawGraphic_MM", "x = %d, y = %d, graphic = %d",
x, y, graphic);
void DrawGraphicThruMask_MM(int x, int y, int graphic, int frame)
{
#if DEBUG
- if (!IN_SCR_FIELD(x,y))
+ if (!IN_SCR_FIELD(x, y))
{
- Debug("game:mm:DrawGraphicThruMask_MM", "x = %d,y = %d, graphic = %d",
+ Debug("game:mm:DrawGraphicThruMask_MM", "x = %d, y = %d, graphic = %d",
x, y, graphic);
Debug("game:mm:DrawGraphicThruMask_MM", "This should never happen!");
}
#endif
- DrawGraphicThruMaskExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY,
+ DrawGraphicThruMaskExt_MM(drawto_mm, cFX + x * TILEX, cFY + y * TILEY,
graphic, frame);
- MarkTileDirty(x,y);
+ MarkTileDirty(x, y);
}
void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int 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);
BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
}
-void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic,
- int cut_mode, int mask_mode)
+void DrawGraphicShifted_MM(int x, int y, int dx, int dy, int graphic,
+ int cut_mode, int mask_mode)
{
int width = TILEX, height = TILEY;
int cx = 0, cy = 0;
dest_y = cFY + y * TILEY + dy;
#if DEBUG
- if (!IN_SCR_FIELD(x,y))
+ if (!IN_SCR_FIELD(x, y))
{
Debug("game:mm:DrawGraphicShifted_MM", "x = %d, y = %d, graphic = %d",
x, y, graphic);
#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);
+ MarkTileDirty(x, y);
}
void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element,
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)
void DrawLevel_MM(void)
{
- int x,y;
+ int x, y;
ClearWindow();
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);
}
}
int xsn_m3 = xsn_m2 + 10;
time_t xsn_e0 = time(NULL);
struct tm *xsn_t0 = localtime(&xsn_e0);
- struct tm xsn_t1 = { 0,0,0, xsn_m2*3, xsn_m3/3, xsn_t0->tm_year, 0,0,-1 };
+ struct tm xsn_t1 = { 0,0,0, xsn_m2 * 3, xsn_m3 / 3, xsn_t0->tm_year, 0,0,-1 };
time_t xsn_e1 = mktime(&xsn_t1);
int xsn_c0 = (25 * xsn_m3) << xsn_m1;
int xsn_c1 = (xsn_t1.tm_wday - xsn_m1) * !!xsn_t1.tm_wday;
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 unmap_element(int element)
+int map_wall_to_base_element(int element)
{
switch (element)
{
- case EL_STEEL_WALL: return EL_WALL_STEEL;
- case EL_WOODEN_WALL: return EL_WALL_WOOD;
- case EL_ICE_WALL: return EL_WALL_ICE;
- case EL_AMOEBA_WALL: return EL_WALL_AMOEBA;
- case EL_DF_STEEL_WALL: return EL_DF_WALL_STEEL;
- case EL_DF_WOODEN_WALL: return EL_DF_WALL_WOOD;
+ 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 element;
}
int el2gfx(int element)
{
- return el2img_mm(map_element(element));
+ return el2img_mm(map_wall_from_base_element(element));
}
int el_act2gfx(int element, int action)
{
- return el_act2img_mm(map_element(element), action);
+ return el_act2img_mm(map_wall_from_base_element(element), action);
}
void RedrawPlayfield_MM(void)
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);
}