BackToFront();
}
+void SetMainBackgroundImage(int graphic)
+{
+ SetMainBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL :
+ new_graphic_info[graphic].bitmap ?
+ new_graphic_info[graphic].bitmap :
+ new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+}
+
+void SetDoorBackgroundImage(int graphic)
+{
+ SetDoorBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL :
+ new_graphic_info[graphic].bitmap ?
+ new_graphic_info[graphic].bitmap :
+ new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+}
+
void DrawBackground(int dest_x, int dest_y, int width, int height)
{
- if (DrawingOnBackground(dest_x, dest_y) && game_status != PLAYING)
- BlitBitmap(gfx.background_bitmap, backbuffer, dest_x, dest_y,
- width, height, dest_x, dest_y);
- else
- ClearRectangle(backbuffer, dest_x, dest_y, width, height);
+ ClearRectangleOnBackground(backbuffer, dest_x, dest_y, width, height);
redraw_mask |= REDRAW_FIELD;
}
}
}
+void MarkTileDirty(int x, int y)
+{
+ int xx = redraw_x1 + x;
+ int yy = redraw_y1 + y;
+
+ if (!redraw[xx][yy])
+ redraw_tiles++;
+
+ redraw[xx][yy] = TRUE;
+ redraw_mask |= REDRAW_TILES;
+}
+
+void SetBorderElement()
+{
+ int x, y;
+
+ BorderElement = EL_EMPTY;
+
+ for(y=0; y<lev_fieldy && BorderElement == EL_EMPTY; y++)
+ {
+ for(x=0; x<lev_fieldx; x++)
+ {
+ if (!IS_MASSIVE(Feld[x][y]))
+ BorderElement = EL_STEELWALL;
+
+ if (y != 0 && y != lev_fieldy - 1 && x != lev_fieldx - 1)
+ x = lev_fieldx - 2;
+ }
+ }
+}
+
static int getGraphicAnimationPhase(int frames, int delay, int mode)
{
int phase;
sync_frame);
}
-void MarkTileDirty(int x, int y)
+inline void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
+ int graphic, int sync_frame, int mask_mode)
{
- int xx = redraw_x1 + x;
- int yy = redraw_y1 + y;
+ int frame = getGraphicAnimationFrame(graphic, sync_frame);
- if (!redraw[xx][yy])
- redraw_tiles++;
+ if (mask_mode == USE_MASKING)
+ DrawGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame);
+ else
+ DrawGraphicExt(dst_bitmap, x, y, graphic, frame);
+}
- redraw[xx][yy] = TRUE;
- redraw_mask |= REDRAW_TILES;
+inline boolean checkDrawGraphicAnimation(int x, int y, int graphic)
+{
+ int lx = LEVELX(x), ly = LEVELY(y);
+
+ return (IN_SCR_FIELD(x, y) &&
+ GfxFrame[lx][ly] % new_graphic_info[graphic].anim_delay == 0);
}
-void SetBorderElement()
+inline boolean checkDrawLevelGraphicAnimation(int x, int y, int graphic)
{
- int x, y;
+ return (IN_SCR_FIELD(SCREENX(x), SCREENY(y)) &&
+ GfxFrame[x][y] % new_graphic_info[graphic].anim_delay == 0);
+}
- BorderElement = EL_EMPTY;
+inline boolean DrawGraphicAnimation(int x, int y, int graphic)
+{
+ int lx = LEVELX(x), ly = LEVELY(y);
- for(y=0; y<lev_fieldy && BorderElement == EL_EMPTY; y++)
- {
- for(x=0; x<lev_fieldx; x++)
- {
- if (!IS_MASSIVE(Feld[x][y]))
- BorderElement = EL_STEELWALL;
+ if (!checkDrawGraphicAnimation(x, y, graphic))
+ return FALSE;
- if (y != 0 && y != lev_fieldy - 1 && x != lev_fieldx - 1)
- x = lev_fieldx - 2;
- }
- }
+ DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic, GfxFrame[lx][ly], NO_MASKING);
+ MarkTileDirty(x, y);
+
+ return TRUE;
+}
+
+boolean DrawLevelGraphicAnimation(int x, int y, int graphic)
+{
+ return DrawGraphicAnimation(SCREENX(x), SCREENY(y), graphic);
+}
+
+boolean DrawLevelElementAnimation(int x, int y, int element)
+{
+ return DrawGraphicAnimation(SCREENX(x), SCREENY(y), el2img(element));
}
void DrawAllPlayers()
frame = 7 - frame;
}
#else
+
+#if 0
frame = getGraphicAnimationFrame(graphic, 96 - MovDelay[jx][jy]);
+#else
+ frame = getGraphicAnimationFrame(graphic, GfxFrame[jx][jy]);
+#endif
+
#endif
if (game.emulation == EMU_SUPAPLEX)
- DrawGraphic(sx, sy, IMG_SP_DISK_RED, 0);
+ DrawGraphic(sx, sy, IMG_SP_DISK_RED, frame);
else
DrawGraphicThruMask(sx, sy, graphic, frame);
}
stored == EL_SP_INFOTRON ? IMG_SP_EXPLOSION_INFOTRON :
IMG_SP_EXPLOSION);
int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
- int phase = Frame[last_jx][last_jy] - 1;
+ int phase = ExplodePhase[last_jx][last_jy] - 1;
int frame = getGraphicAnimationFrame(graphic, phase - delay);
if (phase >= delay)
MarkTileDirty(sx,sy);
}
-void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
- int graphic, int mask_mode)
-{
- int frame = getGraphicAnimationFrame(graphic, -1);
-
- if (mask_mode == USE_MASKING)
- DrawGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame);
- else
- DrawGraphicExt(dst_bitmap, x, y, graphic, frame);
-}
-
-void DrawGraphicAnimation(int x, int y, int graphic)
-{
- if (!IN_SCR_FIELD(x, y) ||
- (FrameCounter % new_graphic_info[graphic].anim_delay) != 0)
- return;
-
- DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
- graphic, NO_MASKING);
- MarkTileDirty(x, y);
-}
-
#if 0
void getOldGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
{
else if (IS_MOVING(x, y) || CAN_MOVE(element) || CAN_FALL(element))
frame_pos = ABS(MovPos[x][y]) / (TILEX / 8);
#else
+
frame_pos = ABS(MovPos[x][y]) / (TILEX / 8);
+
+ frame_pos = GfxFrame[x][y];
+
#endif
return frame_pos;
{
int x,y;
+ SetDrawBackgroundMask(REDRAW_NONE);
ClearWindow();
for(x=BX1; x<=BX2; x++)
#if DEBUG
int graphic_OLD = el2gfx_OLD(element);
- if (element >= MAX_ELEMENTS)
+ if (element >= MAX_NUM_ELEMENTS)
{
- Error(ERR_WARN, "el2gfx: element == %d >= MAX_ELEMENTS", element);
+ Error(ERR_WARN, "el2gfx: element == %d >= MAX_NUM_ELEMENTS", element);
}
if (graphic_NEW != graphic_OLD)