MarkTileDirty(sx,sy);
}
-void DrawGraphicAnimationExt(int x, int y, int graphic, int mask_mode)
+void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
+ int graphic, int mask_mode)
{
- if (IN_SCR_FIELD(x, y) &&
- (FrameCounter % new_graphic_info[graphic].anim_delay) == 0)
- {
- int frame = getGraphicAnimationFrame(graphic, -1);
+ int frame = getGraphicAnimationFrame(graphic, -1);
- if (mask_mode == USE_MASKING)
- DrawGraphicThruMask(x, y, graphic, frame);
- else
- DrawGraphic(x, y, graphic, frame);
- }
+ 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)
{
- DrawGraphicAnimationExt(x, y, graphic, NO_MASKING);
+ 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 1
+#if 0
void getOldGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
{
if (graphic >= 0 && graphic_info[graphic].bitmap != NULL)
MarkTileDirty(x, y);
}
-#if 1
+#if 0
void DrawOldGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic)
{
Bitmap *src_bitmap;
int src_x = mini_startx + new_graphic_info[graphic].src_x / 2;
int src_y = mini_starty + new_graphic_info[graphic].src_y / 2;
+ if (src_x + MINI_TILEX > src_bitmap->width ||
+ src_y + MINI_TILEY > src_bitmap->height)
+ {
+ /* graphic of desired size seems not to be contained in this image;
+ dirty workaround: get it from the middle of the normal sized image */
+
+ getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ src_x += (TILEX / 2 - MINI_TILEX / 2);
+ src_y += (TILEY / 2 - MINI_TILEY / 2);
+ }
+
*bitmap = src_bitmap;
*x = src_x;
*y = src_y;
gfx_action = GfxAction[x][y];
#endif
+#if DEBUG
+ if (gfx_action < 0)
+ printf("getGfxAction: THIS SHOULD NEVER HAPPEN: GfxAction[%d][%d] == %d\n",
+ x, y, gfx_action);
+#endif
+
return gfx_action;
}
int cut_mode, int mask_mode)
{
int ux = LEVELX(x), uy = LEVELY(y);
- int move_dir = MovDir[ux][uy];
- int move_pos = getFramePosition(ux, uy);
- int gfx_action = getGfxAction(ux, uy);
- int graphic = el_dir_act2img(element, move_dir, gfx_action);
- int frame = getGraphicAnimationFrame(graphic, move_pos);
+ int graphic;
+ int frame;
+
+ if (IN_LEV_FIELD(ux, uy))
+ {
+ int move_dir = MovDir[ux][uy];
+ int move_pos = getFramePosition(ux, uy);
+ int gfx_action = getGfxAction(ux, uy);
+
+ graphic = el_dir_act2img(element, move_dir, gfx_action);
+ frame = getGraphicAnimationFrame(graphic, move_pos);
+ }
+ else
+ {
+ graphic = el2img(element);
+ frame = getGraphicAnimationFrame(graphic, 0);
+ }
if (element == EL_WALL_GROWING)
{
int src_x = mini_startx + new_graphic_info[graphic].src_x / 8;
int src_y = mini_starty + new_graphic_info[graphic].src_y / 8;
+ if (src_x + MICRO_TILEX > src_bitmap->width ||
+ src_y + MICRO_TILEY > src_bitmap->height)
+ {
+ /* graphic of desired size seems not to be contained in this image;
+ dirty workaround: get it from the middle of the normal sized image */
+
+ getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ src_x += (TILEX / 2 - MICRO_TILEX / 2);
+ src_y += (TILEY / 2 - MICRO_TILEY / 2);
+ }
+
*bitmap = src_bitmap;
*x = src_x;
*y = src_y;
{
stepsize = 20;
door_delay_value = 0;
+
StopSound(SND_MENU_DOOR_OPENING);
StopSound(SND_MENU_DOOR_CLOSING);
}
+ if (global.autoplay_leveldir)
+ {
+ door_state |= DOOR_NO_DELAY;
+ door_state &= ~DOOR_CLOSE_ALL;
+ }
+
if (door_state & DOOR_ACTION)
{
if (!(door_state & DOOR_NO_DELAY))
Bitmap *bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
GC gc = bitmap->stored_clip_gc;
- WaitUntilDelayReached(&door_delay, door_delay_value);
+ if (!(door_state & DOOR_NO_DELAY))
+ WaitUntilDelayReached(&door_delay, door_delay_value);
if (door_state & DOOR_ACTION_1)
{
}
}
+void FreeToolButtons()
+{
+ int i;
+
+ for (i=0; i<NUM_TOOL_BUTTONS; i++)
+ FreeGadget(tool_gadget[i]);
+}
+
static void UnmapToolButtons()
{
int i;
int el_dir_act2img(int element, int direction, int action)
{
+#if DEBUG
+ if (element < 0)
+ {
+ printf("el_dir_act2img: THIS SHOULD NEVER HAPPEN: element == %d\n",
+ element);
+
+ return IMG_EMPTY;
+ }
+
+ if (action < 0)
+ {
+ printf("el_dir_act2img: THIS SHOULD NEVER HAPPEN: action == %d\n",
+ action);
+
+ return IMG_EMPTY;
+ }
+#endif
+
action = graphics_action_mapping[action];
direction = MV_DIR_BIT(direction);