+ int door_token = doors[i].door_token;
+ int door_index = DOOR_INDEX_FROM_TOKEN(door_token);
+ int part_1 = doors[i].part_1;
+ int part_8 = doors[i].part_8;
+ int part_2 = part_1 + 1;
+ int part_3 = part_1 + 2;
+ struct DoorInfo *door = doors[i].door;
+ struct Rect *door_rect = &door_rect_list[door_index];
+ boolean door_gfx_redefined = FALSE;
+
+ // check if any door part graphic definitions have been redefined
+
+ for (j = 0; door_part_controls[j].door_token != -1; j++)
+ {
+ struct DoorPartControlInfo *dpc = &door_part_controls[j];
+ struct FileInfo *fi = getImageListEntryFromImageID(dpc->graphic);
+
+ if (dpc->door_token == door_token && fi->redefined)
+ door_gfx_redefined = TRUE;
+ }
+
+ // check for old-style door graphic/animation modifications
+
+ if (!door_gfx_redefined)
+ {
+ if (door->anim_mode & ANIM_STATIC_PANEL)
+ {
+ door->panel.step_xoffset = 0;
+ door->panel.step_yoffset = 0;
+ }
+
+ if (door->anim_mode & (ANIM_HORIZONTAL | ANIM_VERTICAL))
+ {
+ struct GraphicInfo *g_part_1 = &graphic_info[part_1];
+ struct GraphicInfo *g_part_2 = &graphic_info[part_2];
+ int num_door_steps, num_panel_steps;
+
+ // remove door part graphics other than the two default wings
+
+ for (j = 0; door_part_controls[j].door_token != -1; j++)
+ {
+ struct DoorPartControlInfo *dpc = &door_part_controls[j];
+ struct GraphicInfo *g = &graphic_info[dpc->graphic];
+
+ if (dpc->graphic >= part_3 &&
+ dpc->graphic <= part_8)
+ g->bitmap = NULL;
+ }
+
+ // set graphics and screen positions of the default wings
+
+ g_part_1->width = door_rect->width;
+ g_part_1->height = door_rect->height;
+ g_part_2->width = door_rect->width;
+ g_part_2->height = door_rect->height;
+ g_part_2->src_x = door_rect->width;
+ g_part_2->src_y = g_part_1->src_y;
+
+ door->part_2.x = door->part_1.x;
+ door->part_2.y = door->part_1.y;
+
+ if (door->width != -1)
+ {
+ g_part_1->width = door->width;
+ g_part_2->width = door->width;
+
+ // special treatment for graphics and screen position of right wing
+ g_part_2->src_x += door_rect->width - door->width;
+ door->part_2.x += door_rect->width - door->width;
+ }
+
+ if (door->height != -1)
+ {
+ g_part_1->height = door->height;
+ g_part_2->height = door->height;
+
+ // special treatment for graphics and screen position of bottom wing
+ g_part_2->src_y += door_rect->height - door->height;
+ door->part_2.y += door_rect->height - door->height;
+ }
+
+ // set animation delays for the default wings and panels
+
+ door->part_1.step_delay = door->step_delay;
+ door->part_2.step_delay = door->step_delay;
+ door->panel.step_delay = door->step_delay;
+
+ // set animation draw order for the default wings
+
+ door->part_1.sort_priority = 2; // draw left wing over ...
+ door->part_2.sort_priority = 1; // ... right wing
+
+ // set animation draw offset for the default wings
+
+ if (door->anim_mode & ANIM_HORIZONTAL)
+ {
+ door->part_1.step_xoffset = door->step_offset;
+ door->part_1.step_yoffset = 0;
+ door->part_2.step_xoffset = door->step_offset * -1;
+ door->part_2.step_yoffset = 0;
+
+ num_door_steps = g_part_1->width / door->step_offset;
+ }
+ else // ANIM_VERTICAL
+ {
+ door->part_1.step_xoffset = 0;
+ door->part_1.step_yoffset = door->step_offset;
+ door->part_2.step_xoffset = 0;
+ door->part_2.step_yoffset = door->step_offset * -1;
+
+ num_door_steps = g_part_1->height / door->step_offset;
+ }
+
+ // set animation draw offset for the default panels
+
+ if (door->step_offset > 1)
+ {
+ num_panel_steps = 2 * door_rect->height / door->step_offset;
+ door->panel.start_step = num_panel_steps - num_door_steps;
+ door->panel.start_step_closing = door->panel.start_step;
+ }
+ else
+ {
+ num_panel_steps = door_rect->height / door->step_offset;
+ door->panel.start_step = num_panel_steps - num_door_steps / 2;
+ door->panel.start_step_closing = door->panel.start_step;
+ door->panel.step_delay *= 2;
+ }
+ }
+ }
+ }
+}
+
+void InitDoors(void)
+{
+ int i;
+
+ for (i = 0; door_part_controls[i].door_token != -1; i++)
+ {
+ struct DoorPartControlInfo *dpc = &door_part_controls[i];
+ struct DoorPartOrderInfo *dpo = &door_part_order[i];
+
+ // initialize "start_step_opening" and "start_step_closing", if needed
+ if (dpc->pos->start_step_opening == 0 &&
+ dpc->pos->start_step_closing == 0)
+ {
+ // dpc->pos->start_step_opening = dpc->pos->start_step;
+ dpc->pos->start_step_closing = dpc->pos->start_step;
+ }
+
+ // fill structure for door part draw order (sorted below)
+ dpo->nr = i;
+ dpo->sort_priority = dpc->pos->sort_priority;
+ }
+
+ // sort door part controls according to sort_priority and graphic number
+ qsort(door_part_order, MAX_DOOR_PARTS,
+ sizeof(struct DoorPartOrderInfo), compareDoorPartOrderInfo);
+}
+
+unsigned int OpenDoor(unsigned int door_state)
+{
+ if (door_state & DOOR_COPY_BACK)
+ {
+ if (door_state & DOOR_OPEN_1)
+ BlitBitmap(bitmap_db_door_1, bitmap_db_door_1,
+ 1 * DXSIZE, 0, DXSIZE, DYSIZE, 0 * DXSIZE, 0);
+
+ if (door_state & DOOR_OPEN_2)
+ BlitBitmap(bitmap_db_door_2, bitmap_db_door_2,
+ 1 * VXSIZE, 0, VXSIZE, VYSIZE, 0 * VXSIZE, 0);
+
+ door_state &= ~DOOR_COPY_BACK;
+ }
+
+ return MoveDoor(door_state);
+}
+
+unsigned int CloseDoor(unsigned int door_state)
+{
+ unsigned int old_door_state = GetDoorState();
+
+ if (!(door_state & DOOR_NO_COPY_BACK))
+ {
+ if (old_door_state & DOOR_OPEN_1)
+ BlitBitmap(backbuffer, bitmap_db_door_1,
+ DX, DY, DXSIZE, DYSIZE, 0, 0);
+
+ if (old_door_state & DOOR_OPEN_2)
+ BlitBitmap(backbuffer, bitmap_db_door_2,
+ VX, VY, VXSIZE, VYSIZE, 0, 0);
+
+ door_state &= ~DOOR_NO_COPY_BACK;
+ }
+
+ return MoveDoor(door_state);
+}
+
+unsigned int GetDoorState(void)
+{
+ return MoveDoor(DOOR_GET_STATE);
+}
+
+unsigned int SetDoorState(unsigned int door_state)
+{
+ return MoveDoor(door_state | DOOR_SET_STATE);
+}
+
+static int euclid(int a, int b)
+{
+ return (b ? euclid(b, a % b) : a);
+}
+
+unsigned int MoveDoor(unsigned int door_state)
+{
+ struct Rect door_rect_list[] =
+ {
+ { DX, DY, DXSIZE, DYSIZE },
+ { VX, VY, VXSIZE, VYSIZE }
+ };
+ static int door1 = DOOR_CLOSE_1;
+ static int door2 = DOOR_CLOSE_2;
+ DelayCounter door_delay = { 0 };
+ int i;
+
+ if (door_state == DOOR_GET_STATE)
+ return (door1 | door2);
+
+ if (door_state & DOOR_SET_STATE)
+ {
+ if (door_state & DOOR_ACTION_1)
+ door1 = door_state & DOOR_ACTION_1;
+ if (door_state & DOOR_ACTION_2)
+ door2 = door_state & DOOR_ACTION_2;
+
+ return (door1 | door2);
+ }
+
+ if (!(door_state & DOOR_FORCE_REDRAW))
+ {
+ if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
+ door_state &= ~DOOR_OPEN_1;
+ else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
+ door_state &= ~DOOR_CLOSE_1;
+ if (door2 == DOOR_OPEN_2 && door_state & DOOR_OPEN_2)
+ door_state &= ~DOOR_OPEN_2;
+ else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
+ door_state &= ~DOOR_CLOSE_2;
+ }
+
+ if (global.autoplay_leveldir)
+ {
+ door_state |= DOOR_NO_DELAY;
+ door_state &= ~DOOR_CLOSE_ALL;
+ }
+
+ if (game_status == GAME_MODE_EDITOR && !(door_state & DOOR_FORCE_ANIM))
+ door_state |= DOOR_NO_DELAY;
+
+ if (door_state & DOOR_ACTION)
+ {
+ boolean game_ended = (game_status == GAME_MODE_PLAYING && checkGameEnded());
+ boolean door_panel_drawn[NUM_DOORS];
+ boolean panel_has_doors[NUM_DOORS];
+ boolean door_part_skip[MAX_DOOR_PARTS];
+ boolean door_part_done[MAX_DOOR_PARTS];
+ boolean door_part_done_all;
+ int num_steps[MAX_DOOR_PARTS];
+ int max_move_delay = 0; // delay for complete animations of all doors
+ int max_step_delay = 0; // delay (ms) between two animation frames
+ int num_move_steps = 0; // number of animation steps for all doors
+ int max_move_delay_doors_only = 0; // delay for doors only (no panel)
+ int num_move_steps_doors_only = 0; // steps for doors only (no panel)
+ int start = 0;
+ int k;
+
+ for (i = 0; i < NUM_DOORS; i++)
+ panel_has_doors[i] = FALSE;
+
+ for (i = 0; i < MAX_DOOR_PARTS; i++)
+ {
+ struct DoorPartControlInfo *dpc = &door_part_controls[i];
+ struct GraphicInfo *g = &graphic_info[dpc->graphic];
+ int door_token = dpc->door_token;
+
+ door_part_done[i] = FALSE;
+ door_part_skip[i] = (!(door_state & door_token) ||
+ !g->bitmap);
+ }
+
+ for (i = 0; i < MAX_DOOR_PARTS; i++)
+ {
+ int nr = door_part_order[i].nr;
+ struct DoorPartControlInfo *dpc = &door_part_controls[nr];
+ struct DoorPartPosInfo *pos = dpc->pos;
+ struct GraphicInfo *g = &graphic_info[dpc->graphic];
+ int door_token = dpc->door_token;
+ int door_index = DOOR_INDEX_FROM_TOKEN(door_token);
+ boolean is_panel = DOOR_PART_IS_PANEL(nr);
+ int step_xoffset = ABS(pos->step_xoffset);
+ int step_yoffset = ABS(pos->step_yoffset);
+ int step_delay = pos->step_delay;
+ int current_door_state = door_state & door_token;
+ boolean door_opening = ((current_door_state & DOOR_OPEN) != 0);
+ boolean door_closing = ((current_door_state & DOOR_CLOSE) != 0);
+ boolean part_opening = (is_panel ? door_closing : door_opening);
+ int start_step = (part_opening ? pos->start_step_opening :
+ pos->start_step_closing);
+ float move_xsize = (step_xoffset ? g->width : 0);
+ float move_ysize = (step_yoffset ? g->height : 0);
+ int move_xsteps = (step_xoffset ? ceil(move_xsize / step_xoffset) : 0);
+ int move_ysteps = (step_yoffset ? ceil(move_ysize / step_yoffset) : 0);
+ int move_steps = (move_xsteps && move_ysteps ?
+ MIN(move_xsteps, move_ysteps) :
+ move_xsteps ? move_xsteps : move_ysteps) - start_step;
+ int move_delay = move_steps * step_delay;
+
+ if (door_part_skip[nr])
+ continue;
+
+ max_move_delay = MAX(max_move_delay, move_delay);
+ max_step_delay = (max_step_delay == 0 ? step_delay :
+ euclid(max_step_delay, step_delay));
+ num_steps[nr] = move_steps;
+
+ if (!is_panel)
+ {
+ max_move_delay_doors_only = MAX(max_move_delay_doors_only, move_delay);
+
+ panel_has_doors[door_index] = TRUE;
+ }
+ }
+
+ max_step_delay = MAX(1, max_step_delay); // prevent division by zero
+
+ num_move_steps = max_move_delay / max_step_delay;
+ num_move_steps_doors_only = max_move_delay_doors_only / max_step_delay;
+
+ door_delay.value = max_step_delay;
+
+ if ((door_state & DOOR_NO_DELAY) || setup.quick_doors)
+ {
+ start = num_move_steps - 1;
+ }
+ else
+ {
+ // opening door sound has priority over simultaneously closing door
+ if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2))
+ {
+ PlayMenuSoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE);
+
+ if (door_state & DOOR_OPEN_1)
+ PlayMenuSoundStereo(SND_DOOR_1_OPENING, SOUND_MIDDLE);
+ if (door_state & DOOR_OPEN_2)
+ PlayMenuSoundStereo(SND_DOOR_2_OPENING, SOUND_MIDDLE);
+ }
+ else if (door_state & (DOOR_CLOSE_1 | DOOR_CLOSE_2))
+ {
+ PlayMenuSoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE);
+
+ if (door_state & DOOR_CLOSE_1)
+ PlayMenuSoundStereo(SND_DOOR_1_CLOSING, SOUND_MIDDLE);
+ if (door_state & DOOR_CLOSE_2)
+ PlayMenuSoundStereo(SND_DOOR_2_CLOSING, SOUND_MIDDLE);
+ }
+ }
+
+ SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
+
+ game.any_door_active = TRUE;
+
+ for (k = start; k < num_move_steps; k++)
+ {
+ int last_frame = num_move_steps - 1; // last frame of this "for" loop
+
+ door_part_done_all = TRUE;
+
+ for (i = 0; i < NUM_DOORS; i++)
+ door_panel_drawn[i] = FALSE;
+
+ for (i = 0; i < MAX_DOOR_PARTS; i++)
+ {
+ int nr = door_part_order[i].nr;
+ struct DoorPartControlInfo *dpc = &door_part_controls[nr];
+ struct DoorPartPosInfo *pos = dpc->pos;
+ struct GraphicInfo *g = &graphic_info[dpc->graphic];
+ int door_token = dpc->door_token;
+ int door_index = DOOR_INDEX_FROM_TOKEN(door_token);
+ boolean is_panel = DOOR_PART_IS_PANEL(nr);
+ boolean is_panel_and_door_has_closed = FALSE;
+ struct Rect *door_rect = &door_rect_list[door_index];
+ Bitmap *bitmap_db_door = (door_token == DOOR_1 ? bitmap_db_door_1 :
+ bitmap_db_door_2);
+ Bitmap *bitmap = (is_panel ? bitmap_db_door : g->bitmap);
+ int current_door_state = door_state & door_token;
+ boolean door_opening = ((current_door_state & DOOR_OPEN) != 0);
+ boolean door_closing = !door_opening;
+ boolean part_opening = (is_panel ? door_closing : door_opening);
+ boolean part_closing = !part_opening;
+ int start_step = (part_opening ? pos->start_step_opening :
+ pos->start_step_closing);
+ int step_delay = pos->step_delay;
+ int step_factor = step_delay / max_step_delay;
+ int k1 = (step_factor ? k / step_factor + 1 : k);
+ int k2 = (part_opening ? k1 + start_step : num_steps[nr] - k1);
+ int kk = MAX(0, k2);
+ int g_src_x = 0;
+ int g_src_y = 0;
+ int src_x, src_y, src_xx, src_yy;
+ int dst_x, dst_y, dst_xx, dst_yy;
+ int width, height;
+
+ if (door_part_skip[nr])
+ continue;
+
+ if (!(door_state & door_token))
+ continue;
+
+ if (!g->bitmap)
+ continue;
+
+ if (!is_panel)
+ {
+ int k2_door = (door_opening ? k : num_move_steps_doors_only - k - 1);
+ int kk_door = MAX(0, k2_door);
+ int sync_frame = kk_door * door_delay.value;
+ int frame = getGraphicAnimationFrame(dpc->graphic, sync_frame);
+
+ getFixedGraphicSource(dpc->graphic, frame, &bitmap,
+ &g_src_x, &g_src_y);
+ }
+
+ // draw door panel
+
+ if (!door_panel_drawn[door_index])
+ {
+ ClearRectangleOnBackground(drawto, door_rect->x, door_rect->y,
+ door_rect->width, door_rect->height);
+
+ door_panel_drawn[door_index] = TRUE;
+ }
+
+ // draw opening or closing door parts
+
+ if (pos->step_xoffset < 0) // door part on right side
+ {
+ src_xx = 0;
+ dst_xx = pos->x + ABS(kk * pos->step_xoffset);
+ width = g->width;
+
+ if (dst_xx + width > door_rect->width)
+ width = door_rect->width - dst_xx;
+ }
+ else // door part on left side
+ {
+ src_xx = 0;
+ dst_xx = pos->x - kk * pos->step_xoffset;
+
+ if (dst_xx < 0)
+ {
+ src_xx = ABS(dst_xx);
+ dst_xx = 0;
+ }
+
+ width = g->width - src_xx;
+
+ if (width > door_rect->width)
+ width = door_rect->width;
+
+ // Debug("tools:MoveDoor", "k == %d [%d]", k, start_step);
+ }
+
+ if (pos->step_yoffset < 0) // door part on bottom side
+ {
+ src_yy = 0;
+ dst_yy = pos->y + ABS(kk * pos->step_yoffset);
+ height = g->height;
+
+ if (dst_yy + height > door_rect->height)
+ height = door_rect->height - dst_yy;
+ }
+ else // door part on top side
+ {
+ src_yy = 0;
+ dst_yy = pos->y - kk * pos->step_yoffset;
+
+ if (dst_yy < 0)
+ {
+ src_yy = ABS(dst_yy);
+ dst_yy = 0;
+ }
+
+ height = g->height - src_yy;
+ }
+
+ src_x = g_src_x + src_xx;
+ src_y = g_src_y + src_yy;
+
+ dst_x = door_rect->x + dst_xx;
+ dst_y = door_rect->y + dst_yy;
+
+ is_panel_and_door_has_closed =
+ (is_panel &&
+ door_closing &&
+ panel_has_doors[door_index] &&
+ k >= num_move_steps_doors_only - 1);
+
+ if (width >= 0 && width <= g->width &&
+ height >= 0 && height <= g->height &&
+ !is_panel_and_door_has_closed)
+ {
+ if (is_panel || !pos->draw_masked)
+ BlitBitmap(bitmap, drawto, src_x, src_y, width, height,
+ dst_x, dst_y);
+ else
+ BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height,
+ dst_x, dst_y);
+ }
+
+ redraw_mask |= REDRAW_DOOR_FROM_TOKEN(door_token);
+
+ if ((part_opening && (width < 0 || height < 0)) ||
+ (part_closing && (width >= g->width && height >= g->height)))
+ door_part_done[nr] = TRUE;
+
+ // continue door part animations, but not panel after door has closed
+ if (!door_part_done[nr] && !is_panel_and_door_has_closed)
+ door_part_done_all = FALSE;
+ }
+
+ if (!(door_state & DOOR_NO_DELAY))
+ {
+ if (game_ended)
+ HandleGameActions();
+
+ BackToFront();
+
+ SkipUntilDelayReached(&door_delay, &k, last_frame);
+
+ // prevent OS (Windows) from complaining about program not responding
+ CheckQuitEvent();
+ }
+
+ if (door_part_done_all)
+ break;
+ }
+
+ if (!(door_state & DOOR_NO_DELAY))
+ {
+ // wait for specified door action post delay
+ if (door_state & DOOR_ACTION_1 && door_state & DOOR_ACTION_2)
+ door_delay.value = MAX(door_1.post_delay, door_2.post_delay);
+ else if (door_state & DOOR_ACTION_1)
+ door_delay.value = door_1.post_delay;
+ else if (door_state & DOOR_ACTION_2)
+ door_delay.value = door_2.post_delay;
+
+ while (!DelayReached(&door_delay))
+ {
+ if (game_ended)
+ HandleGameActions();
+
+ BackToFront();
+ }
+ }
+
+ game.any_door_active = FALSE;
+ }
+
+ if (door_state & DOOR_ACTION_1)
+ door1 = door_state & DOOR_ACTION_1;
+ if (door_state & DOOR_ACTION_2)
+ door2 = door_state & DOOR_ACTION_2;
+
+ // draw masked border over door area
+ DrawMaskedBorder(REDRAW_DOOR_1);
+ DrawMaskedBorder(REDRAW_DOOR_2);
+
+ ClearAutoRepeatKeyEvents();
+
+ return (door1 | door2);
+}
+
+static boolean useSpecialEditorDoor(void)
+{
+ int graphic = IMG_GLOBAL_BORDER_EDITOR;
+ boolean redefined = getImageListEntryFromImageID(graphic)->redefined;
+
+ // do not draw special editor door if editor border defined or redefined
+ if (graphic_info[graphic].bitmap != NULL || redefined)
+ return FALSE;
+
+ // do not draw special editor door if global border defined to be empty
+ if (graphic_info[IMG_GLOBAL_BORDER].bitmap == NULL)
+ return FALSE;
+
+ // do not draw special editor door if viewport definitions do not match
+ if (EX != VX ||
+ EY >= VY ||
+ EXSIZE != VXSIZE ||
+ EY + EYSIZE != VY + VYSIZE)
+ return FALSE;
+
+ return TRUE;
+}
+
+void DrawSpecialEditorDoor(void)
+{
+ struct GraphicInfo *gfx1 = &graphic_info[IMG_DOOR_2_TOP_BORDER_CORRECTION];
+ int top_border_width = gfx1->width;
+ int top_border_height = gfx1->height;
+ int outer_border = viewport.door_2[GAME_MODE_EDITOR].border_size;
+ int ex = EX - outer_border;
+ int ey = EY - outer_border;
+ int vy = VY - outer_border;
+ int exsize = EXSIZE + 2 * outer_border;
+
+ if (!useSpecialEditorDoor())
+ return;
+
+ // draw bigger level editor toolbox window
+ BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y,
+ top_border_width, top_border_height, ex, ey - top_border_height);
+ BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto, ex, vy,
+ exsize, EYSIZE - VYSIZE + outer_border, ex, ey);
+
+ redraw_mask |= REDRAW_ALL;
+}
+
+void UndrawSpecialEditorDoor(void)
+{
+ struct GraphicInfo *gfx1 = &graphic_info[IMG_DOOR_2_TOP_BORDER_CORRECTION];
+ int top_border_width = gfx1->width;
+ int top_border_height = gfx1->height;
+ int outer_border = viewport.door_2[GAME_MODE_EDITOR].border_size;
+ int ex = EX - outer_border;
+ int ey = EY - outer_border;
+ int ey_top = ey - top_border_height;
+ int exsize = EXSIZE + 2 * outer_border;
+ int eysize = EYSIZE + 2 * outer_border;
+
+ if (!useSpecialEditorDoor())
+ return;
+
+ // draw normal tape recorder window
+ if (graphic_info[IMG_GLOBAL_BORDER].bitmap)
+ {
+ BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto,
+ ex, ey_top, top_border_width, top_border_height,
+ ex, ey_top);
+ BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto,
+ ex, ey, exsize, eysize, ex, ey);
+ }
+ else
+ {
+ // if screen background is set to "[NONE]", clear editor toolbox window
+ ClearRectangle(drawto, ex, ey_top, top_border_width, top_border_height);
+ ClearRectangle(drawto, ex, ey, exsize, eysize);
+ }
+
+ redraw_mask |= REDRAW_ALL;
+}
+
+
+// ---------- new tool button stuff -------------------------------------------
+
+static struct
+{
+ int graphic;
+ struct TextPosInfo *pos;
+ int gadget_id;
+ boolean is_touch_button;
+ char *infotext;
+} toolbutton_info[NUM_TOOL_BUTTONS] =
+{
+ {
+ IMG_GFX_REQUEST_BUTTON_YES, &request.button.yes,
+ TOOL_CTRL_ID_YES, FALSE, "yes"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_NO, &request.button.no,
+ TOOL_CTRL_ID_NO, FALSE, "no"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_CONFIRM, &request.button.confirm,
+ TOOL_CTRL_ID_CONFIRM, FALSE, "confirm"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_PLAYER_1, &request.button.player_1,
+ TOOL_CTRL_ID_PLAYER_1, FALSE, "player 1"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_PLAYER_2, &request.button.player_2,
+ TOOL_CTRL_ID_PLAYER_2, FALSE, "player 2"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_PLAYER_3, &request.button.player_3,
+ TOOL_CTRL_ID_PLAYER_3, FALSE, "player 3"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_PLAYER_4, &request.button.player_4,
+ TOOL_CTRL_ID_PLAYER_4, FALSE, "player 4"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_TOUCH_YES, &request.button.touch_yes,
+ TOOL_CTRL_ID_TOUCH_YES, TRUE, "yes"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_TOUCH_NO, &request.button.touch_no,
+ TOOL_CTRL_ID_TOUCH_NO, TRUE, "no"
+ },
+ {
+ IMG_GFX_REQUEST_BUTTON_TOUCH_CONFIRM, &request.button.touch_confirm,
+ TOOL_CTRL_ID_TOUCH_CONFIRM, TRUE, "confirm"
+ }
+};
+
+void CreateToolButtons(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_TOOL_BUTTONS; i++)
+ {
+ int graphic = toolbutton_info[i].graphic;
+ struct GraphicInfo *gfx = &graphic_info[graphic];
+ struct TextPosInfo *pos = toolbutton_info[i].pos;
+ struct GadgetInfo *gi;
+ Bitmap *deco_bitmap = None;
+ int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0;
+ unsigned int event_mask = GD_EVENT_RELEASED;
+ boolean is_touch_button = toolbutton_info[i].is_touch_button;
+ int base_x = (is_touch_button ? 0 : DX);
+ int base_y = (is_touch_button ? 0 : DY);
+ int gd_x = gfx->src_x;
+ int gd_y = gfx->src_y;
+ int gd_xp = gfx->src_x + gfx->pressed_xoffset;
+ int gd_yp = gfx->src_y + gfx->pressed_yoffset;
+ int x = pos->x;
+ int y = pos->y;
+ int id = i;
+
+ // do not use touch buttons if overlay touch buttons are disabled
+ if (is_touch_button && !setup.touch.overlay_buttons)
+ continue;
+
+ if (global.use_envelope_request && !is_touch_button)
+ {
+ setRequestPosition(&base_x, &base_y, TRUE);
+
+ // check if request buttons are outside of envelope and fix, if needed
+ if (x < 0 || x + gfx->width > request.width ||
+ y < 0 || y + gfx->height > request.height)
+ {
+ if (id == TOOL_CTRL_ID_YES)
+ {
+ x = 0;
+ y = request.height - 2 * request.border_size - gfx->height;
+ }
+ else if (id == TOOL_CTRL_ID_NO)
+ {
+ x = request.width - 2 * request.border_size - gfx->width;
+ y = request.height - 2 * request.border_size - gfx->height;
+ }
+ else if (id == TOOL_CTRL_ID_CONFIRM)
+ {
+ x = (request.width - 2 * request.border_size - gfx->width) / 2;
+ y = request.height - 2 * request.border_size - gfx->height;
+ }
+ else if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4)
+ {
+ int player_nr = id - TOOL_CTRL_ID_PLAYER_1;
+
+ x = (request.width - 2 * request.border_size - gfx->width) / 2;
+ y = request.height - 2 * request.border_size - gfx->height * 2;
+
+ x += (player_nr == 3 ? -1 : player_nr == 1 ? +1 : 0) * gfx->width;
+ y += (player_nr == 0 ? -1 : player_nr == 2 ? +1 : 0) * gfx->height;
+ }
+ }
+ }
+
+ if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4 &&
+ pos->draw_player)
+ {
+ int player_nr = id - TOOL_CTRL_ID_PLAYER_1;
+
+ getSizedGraphicSource(PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0,
+ pos->size, &deco_bitmap, &deco_x, &deco_y);
+ deco_xpos = (gfx->width - pos->size) / 2;
+ deco_ypos = (gfx->height - pos->size) / 2;
+ }
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_IMAGE_ID, graphic,
+ GDI_INFO_TEXT, toolbutton_info[i].infotext,
+ GDI_X, base_x + x,
+ GDI_Y, base_y + y,
+ GDI_WIDTH, gfx->width,
+ GDI_HEIGHT, gfx->height,
+ GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
+ GDI_STATE, GD_BUTTON_UNPRESSED,
+ GDI_DESIGN_UNPRESSED, gfx->bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gfx->bitmap, gd_xp, gd_yp,
+ GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
+ GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
+ GDI_DECORATION_SIZE, pos->size, pos->size,
+ GDI_DECORATION_SHIFTING, 1, 1,
+ GDI_DIRECT_DRAW, FALSE,
+ GDI_OVERLAY_TOUCH_BUTTON, is_touch_button,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_ACTION, HandleToolButtons,
+ GDI_END);
+
+ if (gi == NULL)
+ Fail("cannot create gadget");
+
+ tool_gadget[id] = gi;
+ }
+}
+
+void FreeToolButtons(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_TOOL_BUTTONS; i++)
+ FreeGadget(tool_gadget[i]);
+}
+
+static void MapToolButtons(unsigned int req_state)
+{
+ if (req_state & REQ_ASK)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_YES]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_NO]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_YES]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_NO]);
+ }
+ else if (req_state & REQ_CONFIRM)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_CONFIRM]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_CONFIRM]);
+ }
+ else if (req_state & REQ_PLAYER)
+ {
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_1]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_2]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_3]);
+ MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_4]);
+ }
+}
+
+static void UnmapToolButtons(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_TOOL_BUTTONS; i++)
+ UnmapGadget(tool_gadget[i]);
+}
+
+static void HandleToolButtons(struct GadgetInfo *gi)
+{
+ request_gadget_id = gi->custom_id;
+}
+
+static int getEngineElement_Ext(int element, int game_engine_type, boolean is_drawing_element)
+{
+ int el_empty;
+ int el_player;
+ int el_sand;
+ int el_wall;
+ int el_steelwall;
+ int el_exit_closed;
+
+ if (game_engine_type == -1)
+ game_engine_type = level.game_engine_type;
+
+ if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
+ {
+ el_empty = EL_EMPTY;
+ el_player = EL_BD_PLAYER;
+ el_sand = EL_BD_SAND;
+ el_wall = EL_BD_WALL;
+ el_steelwall = EL_BD_STEELWALL;
+ el_exit_closed = EL_BD_EXIT_CLOSED;
+ }
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+ {
+ el_empty = EL_EMPTY;
+ el_player = EL_PLAYER_1;
+ el_sand = EL_SAND;
+ el_wall = EL_WALL;
+ el_steelwall = EL_STEELWALL;
+ el_exit_closed = EL_EM_EXIT_CLOSED;
+ }
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+ {
+ el_empty = EL_EMPTY;
+ el_player = EL_SP_MURPHY;
+ el_sand = EL_SP_BASE;
+ el_wall = EL_SP_CHIP_SINGLE;
+ el_steelwall = EL_SP_HARDWARE_GRAY;
+ el_exit_closed = EL_SP_EXIT_CLOSED;
+ }
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
+ {
+ el_empty = EL_EMPTY;
+ el_player = EL_MM_MCDUFFIN_DOWN;
+ el_sand = EL_EMPTY;
+ el_wall = EL_MM_WOODEN_WALL;
+ el_steelwall = EL_MM_STEEL_WALL;
+ el_exit_closed = EL_MM_EXIT_CLOSED;
+
+ if (is_drawing_element)
+ {
+ el_wall = EL_MM_MIRROR_START;
+ el_sand = EL_MM_WOODEN_WALL;
+ }
+ }
+ else
+ {
+ el_empty = EL_EMPTY;
+ el_player = EL_PLAYER_1;
+ el_sand = EL_SAND;
+ el_wall = EL_WALL;
+ el_steelwall = EL_STEELWALL;
+ el_exit_closed = EL_EXIT_CLOSED;
+ }
+
+ return (element == EL_EMPTY ? el_empty :
+ element == EL_PLAYER_1 ? el_player :
+ element == EL_SAND ? el_sand :
+ element == EL_WALL ? el_wall :
+ element == EL_STEELWALL ? el_steelwall :
+ element == EL_EXIT_CLOSED ? el_exit_closed : EL_EMPTY);
+}
+
+int getEngineElement(int element)
+{
+ return getEngineElement_Ext(element, -1, FALSE);
+}
+
+int getDrawingElement(int element)
+{
+ return getEngineElement_Ext(element, -1, TRUE);
+}
+
+static struct Mapping_BD_to_RND_object
+{
+ int element_bd;
+ boolean is_rnd_to_bd_mapping; // unique mapping BD <-> RND
+
+ int element_rnd;
+ int action;
+ int direction;
+}
+bd_object_mapping_list[] =
+{
+ // additional RND style elements mapped to BD style elements (must be listed first)
+
+ {
+ O_DIRT, TRUE,
+ EL_SAND, -1, -1
+ },
+ {
+ O_STONE, TRUE,
+ EL_BD_ROCK, -1, -1
+ },
+ {
+ O_BRICK, TRUE,
+ EL_BD_WALL, -1, -1
+ },
+ {
+ O_STEEL, TRUE,
+ EL_STEELWALL, -1, -1
+ },
+ {
+ O_DIAMOND, TRUE,
+ EL_BD_DIAMOND, -1, -1
+ },
+ {
+ O_INBOX, TRUE,
+ EL_PLAYER_1, -1, -1
+ },
+ {
+ O_INBOX, TRUE,
+ EL_PLAYER_2, -1, -1
+ },
+ {
+ O_INBOX, TRUE,
+ EL_PLAYER_3, -1, -1
+ },
+ {
+ O_INBOX, TRUE,
+ EL_PLAYER_4, -1, -1
+ },
+ {
+ O_PRE_OUTBOX, TRUE,
+ EL_EXIT_CLOSED, -1, -1
+ },
+
+ // BD style elements with their corresponding RND style elements
+
+ {
+ O_SPACE, TRUE,
+ EL_EMPTY, -1, -1
+ },
+ {
+ O_DIRT, TRUE,
+ EL_BD_SAND, -1, -1
+ },
+ {
+ O_DIRT_SLOPED_UP_RIGHT, TRUE,
+ EL_BD_SAND_SLOPED_UP_RIGHT, -1, -1
+ },
+ {
+ O_DIRT_SLOPED_UP_LEFT, TRUE,
+ EL_BD_SAND_SLOPED_UP_LEFT, -1, -1
+ },
+ {
+ O_DIRT_SLOPED_DOWN_LEFT, TRUE,
+ EL_BD_SAND_SLOPED_DOWN_LEFT, -1, -1
+ },
+ {
+ O_DIRT_SLOPED_DOWN_RIGHT, TRUE,
+ EL_BD_SAND_SLOPED_DOWN_RIGHT, -1, -1
+ },
+ {
+ O_DIRT_BALL, TRUE,
+ EL_BD_SAND_BALL, -1, -1
+ },
+ {
+ O_DIRT_BALL_F, TRUE,
+ EL_BD_SAND_BALL_FALLING, -1, -1
+ },
+ {
+ O_DIRT_BALL_F, FALSE,
+ EL_BD_SAND_BALL, ACTION_FALLING, -1
+ },
+ {
+ O_DIRT_LOOSE, TRUE,
+ EL_BD_SAND_LOOSE, -1, -1
+ },
+ {
+ O_DIRT_LOOSE_F, TRUE,
+ EL_BD_SAND_LOOSE_FALLING, -1, -1
+ },
+ {
+ O_DIRT_LOOSE_F, FALSE,
+ EL_BD_SAND_LOOSE, ACTION_FALLING, -1
+ },
+ {
+ O_DIRT2, TRUE,
+ EL_BD_SAND_2, -1, -1
+ },
+ {
+ O_BRICK, TRUE,
+ EL_BD_WALL, -1, -1
+ },
+ {
+ O_BRICK_SLOPED_UP_RIGHT, TRUE,
+ EL_BD_WALL_SLOPED_UP_RIGHT, -1, -1
+ },
+ {
+ O_BRICK_SLOPED_UP_LEFT, TRUE,
+ EL_BD_WALL_SLOPED_UP_LEFT, -1, -1
+ },
+ {
+ O_BRICK_SLOPED_DOWN_LEFT, TRUE,
+ EL_BD_WALL_SLOPED_DOWN_LEFT, -1, -1
+ },
+ {
+ O_BRICK_SLOPED_DOWN_RIGHT, TRUE,
+ EL_BD_WALL_SLOPED_DOWN_RIGHT, -1, -1
+ },
+ {
+ O_BRICK_NON_SLOPED, TRUE,
+ EL_BD_WALL_NON_SLOPED, -1, -1
+ },
+ {
+ O_MAGIC_WALL, TRUE,
+ EL_BD_MAGIC_WALL, ACTION_ACTIVE, -1
+ },
+ {
+ O_PRE_OUTBOX, TRUE,
+ EL_BD_EXIT_CLOSED, -1, -1
+ },
+ {
+ O_OUTBOX, TRUE,
+ EL_BD_EXIT_OPEN, -1, -1
+ },
+ {
+ O_PRE_INVIS_OUTBOX, TRUE,
+ EL_BD_INVISIBLE_EXIT_CLOSED, -1, -1
+ },
+ {
+ O_INVIS_OUTBOX, TRUE,
+ EL_BD_INVISIBLE_EXIT_OPEN, -1, -1
+ },
+ {
+ O_STEEL, TRUE,
+ EL_BD_STEELWALL, -1, -1
+ },
+ {
+ O_STEEL_SLOPED_UP_RIGHT, TRUE,
+ EL_BD_STEELWALL_SLOPED_UP_RIGHT, -1, -1
+ },
+ {
+ O_STEEL_SLOPED_UP_LEFT, TRUE,
+ EL_BD_STEELWALL_SLOPED_UP_LEFT, -1, -1
+ },
+ {
+ O_STEEL_SLOPED_DOWN_LEFT, TRUE,
+ EL_BD_STEELWALL_SLOPED_DOWN_LEFT, -1, -1
+ },
+ {
+ O_STEEL_SLOPED_DOWN_RIGHT, TRUE,
+ EL_BD_STEELWALL_SLOPED_DOWN_RIGHT, -1, -1
+ },
+ {
+ O_STEEL_EXPLODABLE, TRUE,
+ EL_BD_STEELWALL_EXPLODABLE, -1, -1
+ },
+ {
+ O_STEEL_EATABLE, TRUE,
+ EL_BD_STEELWALL_DIGGABLE, -1, -1
+ },
+ {
+ O_BRICK_EATABLE, TRUE,
+ EL_BD_WALL_DIGGABLE, -1, -1
+ },
+ {
+ O_STONE, TRUE,
+ EL_BD_ROCK, -1, -1
+ },
+ {
+ O_STONE_F, TRUE,
+ EL_BD_ROCK_FALLING, -1, -1
+ },
+ {
+ O_STONE_F, FALSE,
+ EL_BD_ROCK, ACTION_FALLING, -1
+ },
+ {
+ O_FLYING_STONE, TRUE,
+ EL_BD_FLYING_ROCK, -1, -1
+ },
+ {
+ O_FLYING_STONE_F, TRUE,
+ EL_BD_FLYING_ROCK_FLYING, -1, -1
+ },
+ {
+ O_FLYING_STONE_F, FALSE,
+ EL_BD_FLYING_ROCK, ACTION_FLYING, -1
+ },
+ {
+ O_MEGA_STONE, TRUE,
+ EL_BD_MEGA_ROCK, -1, -1
+ },
+ {
+ O_MEGA_STONE_F, TRUE,
+ EL_BD_MEGA_ROCK_FALLING, -1, -1
+ },
+ {
+ O_MEGA_STONE_F, FALSE,
+ EL_BD_MEGA_ROCK, ACTION_FALLING, -1
+ },
+ {
+ O_DIAMOND, TRUE,
+ EL_BD_DIAMOND, -1, -1
+ },
+ {
+ O_DIAMOND_F, TRUE,
+ EL_BD_DIAMOND_FALLING, -1, -1
+ },
+ {
+ O_DIAMOND_F, FALSE,
+ EL_BD_DIAMOND, ACTION_FALLING, -1
+ },
+ {
+ O_FLYING_DIAMOND, TRUE,
+ EL_BD_FLYING_DIAMOND, -1, -1
+ },
+ {
+ O_FLYING_DIAMOND_F, TRUE,
+ EL_BD_FLYING_DIAMOND_FLYING, -1, -1
+ },
+ {
+ O_FLYING_DIAMOND_F, FALSE,
+ EL_BD_FLYING_DIAMOND, ACTION_FLYING, -1
+ },
+ {
+ O_NUT, TRUE,
+ EL_BD_NUT, -1, -1
+ },
+ {
+ O_NUT_F, TRUE,
+ EL_BD_NUT_FALLING, -1, -1
+ },
+ {
+ O_NUT_F, FALSE,
+ EL_BD_NUT, ACTION_FALLING, -1
+ },
+ {
+ O_BLADDER_SPENDER, TRUE,
+ EL_BD_BLADDER_SPENDER, -1, -1
+ },
+ {
+ O_INBOX, TRUE,
+ EL_BD_INBOX, -1, -1
+ },
+ {
+ O_H_EXPANDING_WALL, TRUE,
+ EL_BD_EXPANDABLE_WALL_HORIZONTAL, -1, -1
+ },
+ {
+ O_V_EXPANDING_WALL, TRUE,
+ EL_BD_EXPANDABLE_WALL_VERTICAL, -1, -1
+ },
+ {
+ O_EXPANDING_WALL, TRUE,
+ EL_BD_EXPANDABLE_WALL_ANY, -1, -1
+ },
+ {
+ O_H_EXPANDING_STEEL_WALL, TRUE,
+ EL_BD_EXPANDABLE_STEELWALL_HORIZONTAL, -1, -1
+ },
+ {
+ O_V_EXPANDING_STEEL_WALL, TRUE,
+ EL_BD_EXPANDABLE_STEELWALL_VERTICAL, -1, -1
+ },
+ {
+ O_EXPANDING_STEEL_WALL, TRUE,
+ EL_BD_EXPANDABLE_STEELWALL_ANY, -1, -1
+ },
+ {
+ O_EXPANDING_WALL_SWITCH, TRUE,
+ EL_BD_EXPANDABLE_WALL_SWITCH, -1, -1
+ },
+ {
+ O_CREATURE_SWITCH, TRUE,
+ EL_BD_CREATURE_SWITCH, -1, -1
+ },
+ {
+ O_BITER_SWITCH, TRUE,
+ EL_BD_BITER_SWITCH_1, -1, -1
+ },
+ {
+ O_REPLICATOR_SWITCH, TRUE,
+ EL_BD_REPLICATOR_SWITCH, -1, -1
+ },
+ {
+ O_CONVEYOR_SWITCH, TRUE,
+ EL_BD_CONVEYOR_SWITCH, -1, -1
+ },
+ {
+ O_CONVEYOR_DIR_SWITCH, TRUE,
+ EL_BD_CONVEYOR_DIR_SWITCH, -1, -1
+ },
+ {
+ O_ACID, TRUE,
+ EL_BD_ACID, -1, -1
+ },
+ {
+ O_FALLING_WALL, TRUE,
+ EL_BD_FALLING_WALL, -1, -1
+ },
+ {
+ O_FALLING_WALL_F, TRUE,
+ EL_BD_FALLING_WALL_FALLING, -1, -1
+ },
+ {
+ O_FALLING_WALL_F, FALSE,
+ EL_BD_FALLING_WALL, ACTION_FALLING, -1
+ },
+ {
+ O_BOX, TRUE,
+ EL_BD_BOX, -1, -1
+ },
+ {
+ O_TIME_PENALTY, TRUE,
+ EL_BD_TIME_PENALTY, -1, -1
+ },
+ {
+ O_GRAVESTONE, TRUE,
+ EL_BD_GRAVESTONE, -1, -1
+ },
+ {
+ O_STONE_GLUED, TRUE,
+ EL_BD_ROCK_GLUED, -1, -1
+ },
+ {
+ O_DIAMOND_GLUED, TRUE,
+ EL_BD_DIAMOND_GLUED, -1, -1
+ },
+ {
+ O_DIAMOND_KEY, TRUE,
+ EL_BD_DIAMOND_KEY, -1, -1
+ },
+ {
+ O_TRAPPED_DIAMOND, TRUE,
+ EL_BD_TRAPPED_DIAMOND, -1, -1
+ },
+ {
+ O_CLOCK, TRUE,
+ EL_BD_CLOCK, -1, -1
+ },
+ {
+ O_DIRT_GLUED, TRUE,
+ EL_BD_SAND_GLUED, -1, -1
+ },
+ {
+ O_KEY_1, TRUE,
+ EL_BD_KEY_1, -1, -1
+ },
+ {
+ O_KEY_2, TRUE,
+ EL_BD_KEY_2, -1, -1
+ },
+ {
+ O_KEY_3, TRUE,
+ EL_BD_KEY_3, -1, -1
+ },
+ {
+ O_DOOR_1, TRUE,
+ EL_BD_GATE_1, -1, -1
+ },
+ {
+ O_DOOR_2, TRUE,
+ EL_BD_GATE_2, -1, -1
+ },
+ {
+ O_DOOR_3, TRUE,
+ EL_BD_GATE_3, -1, -1
+ },
+ {
+ O_POT, TRUE,
+ EL_BD_POT, -1, -1
+ },
+ {
+ O_GRAVITY_SWITCH, TRUE,
+ EL_BD_GRAVITY_SWITCH, -1, -1
+ },
+ {
+ O_PNEUMATIC_HAMMER, TRUE,
+ EL_BD_PNEUMATIC_HAMMER, -1, -1
+ },
+ {
+ O_TELEPORTER, TRUE,
+ EL_BD_TELEPORTER, -1, -1
+ },
+ {
+ O_SKELETON, TRUE,
+ EL_BD_SKELETON, -1, -1
+ },
+ {
+ O_WATER, TRUE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_1, TRUE,
+ EL_BD_WATER_1, -1, -1
+ },
+ {
+ O_WATER_1, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_2, TRUE,
+ EL_BD_WATER_2, -1, -1
+ },
+ {
+ O_WATER_2, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_3, TRUE,
+ EL_BD_WATER_3, -1, -1
+ },
+ {
+ O_WATER_3, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_4, TRUE,
+ EL_BD_WATER_4, -1, -1
+ },
+ {
+ O_WATER_4, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_5, TRUE,
+ EL_BD_WATER_5, -1, -1
+ },
+ {
+ O_WATER_5, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_6, TRUE,
+ EL_BD_WATER_6, -1, -1
+ },
+ {
+ O_WATER_6, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_7, TRUE,
+ EL_BD_WATER_7, -1, -1
+ },
+ {
+ O_WATER_7, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_8, TRUE,
+ EL_BD_WATER_8, -1, -1
+ },
+ {
+ O_WATER_8, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_9, TRUE,
+ EL_BD_WATER_9, -1, -1
+ },
+ {
+ O_WATER_9, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_10, TRUE,
+ EL_BD_WATER_10, -1, -1
+ },
+ {
+ O_WATER_10, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_11, TRUE,
+ EL_BD_WATER_11, -1, -1
+ },
+ {
+ O_WATER_11, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_12, TRUE,
+ EL_BD_WATER_12, -1, -1
+ },
+ {
+ O_WATER_12, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_13, TRUE,
+ EL_BD_WATER_13, -1, -1
+ },
+ {
+ O_WATER_13, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_14, TRUE,
+ EL_BD_WATER_14, -1, -1
+ },
+ {
+ O_WATER_14, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_15, TRUE,
+ EL_BD_WATER_15, -1, -1
+ },
+ {
+ O_WATER_15, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_WATER_16, TRUE,
+ EL_BD_WATER_16, -1, -1
+ },
+ {
+ O_WATER_16, FALSE,
+ EL_BD_WATER, -1, -1
+ },
+ {
+ O_COW_1, TRUE,
+ EL_BD_COW_LEFT, -1, -1
+ },
+ {
+ O_COW_2, TRUE,
+ EL_BD_COW_UP, -1, -1
+ },
+ {
+ O_COW_3, TRUE,
+ EL_BD_COW_RIGHT, -1, -1
+ },
+ {
+ O_COW_4, TRUE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_1, TRUE,
+ EL_BD_COW_ENCLOSED_1, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_1, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_2, TRUE,
+ EL_BD_COW_ENCLOSED_2, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_2, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_3, TRUE,
+ EL_BD_COW_ENCLOSED_3, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_3, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_4, TRUE,
+ EL_BD_COW_ENCLOSED_4, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_4, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_5, TRUE,
+ EL_BD_COW_ENCLOSED_5, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_5, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_6, TRUE,
+ EL_BD_COW_ENCLOSED_6, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_6, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_7, TRUE,
+ EL_BD_COW_ENCLOSED_7, -1, -1
+ },
+ {
+ O_COW_ENCLOSED_7, FALSE,
+ EL_BD_COW_DOWN, -1, -1
+ },
+ {
+ O_WALLED_DIAMOND, TRUE,
+ EL_BD_WALL_DIAMOND, -1, -1
+ },
+ {
+ O_WALLED_KEY_1, TRUE,
+ EL_BD_WALL_KEY_1, -1, -1
+ },
+ {
+ O_WALLED_KEY_2, TRUE,
+ EL_BD_WALL_KEY_2, -1, -1
+ },
+ {
+ O_WALLED_KEY_3, TRUE,
+ EL_BD_WALL_KEY_3, -1, -1
+ },
+ {
+ O_AMOEBA, TRUE,
+ EL_BD_AMOEBA, -1, -1
+ },
+ {
+ O_AMOEBA_2, TRUE,
+ EL_BD_AMOEBA_2, -1, -1
+ },
+ {
+ O_REPLICATOR, TRUE,
+ EL_BD_REPLICATOR, -1, -1
+ },
+ {
+ O_CONVEYOR_LEFT, TRUE,
+ EL_BD_CONVEYOR_LEFT, -1, -1
+ },
+ {
+ O_CONVEYOR_RIGHT, TRUE,
+ EL_BD_CONVEYOR_RIGHT, -1, -1
+ },
+ {
+ O_LAVA, TRUE,
+ EL_BD_LAVA, -1, -1
+ },
+ {
+ O_SWEET, TRUE,
+ EL_BD_SWEET, -1, -1
+ },
+ {
+ O_VOODOO, TRUE,
+ EL_BD_VOODOO_DOLL, -1, -1
+ },
+ {
+ O_SLIME, TRUE,
+ EL_BD_SLIME, -1, -1
+ },
+ {
+ O_BLADDER, TRUE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_1, TRUE,
+ EL_BD_BLADDER_1, -1, -1
+ },
+ {
+ O_BLADDER_1, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_2, TRUE,
+ EL_BD_BLADDER_2, -1, -1
+ },
+ {
+ O_BLADDER_2, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_3, TRUE,
+ EL_BD_BLADDER_3, -1, -1
+ },
+ {
+ O_BLADDER_3, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_4, TRUE,
+ EL_BD_BLADDER_4, -1, -1
+ },
+ {
+ O_BLADDER_4, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_5, TRUE,
+ EL_BD_BLADDER_5, -1, -1
+ },
+ {
+ O_BLADDER_5, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_6, TRUE,
+ EL_BD_BLADDER_6, -1, -1
+ },
+ {
+ O_BLADDER_6, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_7, TRUE,
+ EL_BD_BLADDER_7, -1, -1
+ },
+ {
+ O_BLADDER_7, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_BLADDER_8, TRUE,
+ EL_BD_BLADDER_8, -1, -1
+ },
+ {
+ O_BLADDER_8, FALSE,
+ EL_BD_BLADDER, -1, -1
+ },
+ {
+ O_WAITING_STONE, TRUE,
+ EL_BD_WAITING_ROCK, -1, -1
+ },
+ {
+ O_CHASING_STONE, TRUE,
+ EL_BD_CHASING_ROCK, -1, -1
+ },
+ {
+ O_GHOST, TRUE,
+ EL_BD_GHOST, -1, -1
+ },
+ {
+ O_FIREFLY_1, TRUE,
+ EL_BD_FIREFLY_LEFT, -1, -1
+ },
+ {
+ O_FIREFLY_2, TRUE,
+ EL_BD_FIREFLY_UP, -1, -1
+ },
+ {
+ O_FIREFLY_3, TRUE,
+ EL_BD_FIREFLY_RIGHT, -1, -1
+ },
+ {
+ O_FIREFLY_4, TRUE,
+ EL_BD_FIREFLY_DOWN, -1, -1
+ },
+ {
+ O_ALT_FIREFLY_1, TRUE,
+ EL_BD_FIREFLY_2_LEFT, -1, -1
+ },
+ {
+ O_ALT_FIREFLY_2, TRUE,
+ EL_BD_FIREFLY_2_UP, -1, -1
+ },
+ {
+ O_ALT_FIREFLY_3, TRUE,
+ EL_BD_FIREFLY_2_RIGHT, -1, -1
+ },
+ {
+ O_ALT_FIREFLY_4, TRUE,
+ EL_BD_FIREFLY_2_DOWN, -1, -1
+ },
+ {
+ O_BUTTER_1, TRUE,
+ EL_BD_BUTTERFLY_LEFT, -1, -1
+ },
+ {
+ O_BUTTER_2, TRUE,
+ EL_BD_BUTTERFLY_UP, -1, -1
+ },
+ {
+ O_BUTTER_3, TRUE,
+ EL_BD_BUTTERFLY_RIGHT, -1, -1
+ },
+ {
+ O_BUTTER_4, TRUE,
+ EL_BD_BUTTERFLY_DOWN, -1, -1
+ },
+ {
+ O_ALT_BUTTER_1, TRUE,
+ EL_BD_BUTTERFLY_2_LEFT, -1, -1
+ },
+ {
+ O_ALT_BUTTER_2, TRUE,
+ EL_BD_BUTTERFLY_2_UP, -1, -1
+ },
+ {
+ O_ALT_BUTTER_3, TRUE,
+ EL_BD_BUTTERFLY_2_RIGHT, -1, -1
+ },
+ {
+ O_ALT_BUTTER_4, TRUE,
+ EL_BD_BUTTERFLY_2_DOWN, -1, -1
+ },
+ {
+ O_STONEFLY_1, TRUE,
+ EL_BD_STONEFLY_LEFT, -1, -1
+ },
+ {
+ O_STONEFLY_2, TRUE,
+ EL_BD_STONEFLY_UP, -1, -1
+ },
+ {
+ O_STONEFLY_3, TRUE,
+ EL_BD_STONEFLY_RIGHT, -1, -1
+ },
+ {
+ O_STONEFLY_4, TRUE,
+ EL_BD_STONEFLY_DOWN, -1, -1
+ },
+ {
+ O_BITER_1, TRUE,
+ EL_BD_BITER_UP, -1, -1
+ },
+ {
+ O_BITER_2, TRUE,
+ EL_BD_BITER_RIGHT, -1, -1
+ },
+ {
+ O_BITER_3, TRUE,
+ EL_BD_BITER_DOWN, -1, -1
+ },
+ {
+ O_BITER_4, TRUE,
+ EL_BD_BITER_LEFT, -1, -1
+ },
+ {
+ O_DRAGONFLY_1, TRUE,
+ EL_BD_DRAGONFLY_LEFT, -1, -1
+ },
+ {
+ O_DRAGONFLY_2, TRUE,
+ EL_BD_DRAGONFLY_UP, -1, -1
+ },
+ {
+ O_DRAGONFLY_3, TRUE,
+ EL_BD_DRAGONFLY_RIGHT, -1, -1
+ },
+ {
+ O_DRAGONFLY_4, TRUE,
+ EL_BD_DRAGONFLY_DOWN, -1, -1
+ },
+ {
+ O_PRE_PL_1, TRUE,
+ EL_BD_PLAYER_GROWING_1, -1, -1
+ },
+ {
+ O_PRE_PL_1, FALSE,
+ EL_BD_PLAYER, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_PL_2, TRUE,
+ EL_BD_PLAYER_GROWING_2, -1, -1
+ },
+ {
+ O_PRE_PL_2, FALSE,
+ EL_BD_PLAYER, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_PL_3, TRUE,
+ EL_BD_PLAYER_GROWING_3, -1, -1
+ },
+ {
+ O_PRE_PL_3, FALSE,
+ EL_BD_PLAYER, ACTION_GROWING, -1
+ },
+ {
+ O_PLAYER, TRUE,
+ EL_BD_PLAYER, -1, -1
+ },
+ {
+ O_PLAYER_BOMB, TRUE,
+ EL_BD_PLAYER_WITH_BOMB, -1, -1
+ },
+ {
+ O_PLAYER_ROCKET_LAUNCHER, TRUE,
+ EL_BD_PLAYER_WITH_ROCKET_LAUNCHER, -1, -1
+ },
+ {
+ O_PLAYER_GLUED, TRUE,
+ EL_BD_PLAYER_GLUED, -1, -1
+ },
+ {
+ O_PLAYER_STIRRING, TRUE,
+ EL_BD_PLAYER_STIRRING, -1, -1
+ },
+ {
+ O_ROCKET_LAUNCHER, TRUE,
+ EL_BD_ROCKET_LAUNCHER, -1, -1
+ },
+ {
+ O_ROCKET_1, TRUE,
+ EL_BD_ROCKET_RIGHT, -1, -1
+ },
+ {
+ O_ROCKET_2, TRUE,
+ EL_BD_ROCKET_UP, -1, -1
+ },
+ {
+ O_ROCKET_3, TRUE,
+ EL_BD_ROCKET_LEFT, -1, -1
+ },
+ {
+ O_ROCKET_4, TRUE,
+ EL_BD_ROCKET_DOWN, -1, -1
+ },
+ {
+ O_BOMB, TRUE,
+ EL_BD_BOMB, -1, -1
+ },
+ {
+ O_BOMB_TICK_1, TRUE,
+ EL_BD_BOMB_TICKING_1, -1, -1
+ },
+ {
+ O_BOMB_TICK_1, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_2, TRUE,
+ EL_BD_BOMB_TICKING_2, -1, -1
+ },
+ {
+ O_BOMB_TICK_2, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_3, TRUE,
+ EL_BD_BOMB_TICKING_3, -1, -1
+ },
+ {
+ O_BOMB_TICK_3, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_4, TRUE,
+ EL_BD_BOMB_TICKING_4, -1, -1
+ },
+ {
+ O_BOMB_TICK_4, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_5, TRUE,
+ EL_BD_BOMB_TICKING_5, -1, -1
+ },
+ {
+ O_BOMB_TICK_5, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_6, TRUE,
+ EL_BD_BOMB_TICKING_6, -1, -1
+ },
+ {
+ O_BOMB_TICK_6, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_BOMB_TICK_7, TRUE,
+ EL_BD_BOMB_TICKING_7, -1, -1
+ },
+ {
+ O_BOMB_TICK_7, FALSE,
+ EL_BD_BOMB, ACTION_ACTIVE, -1
+ },
+ {
+ O_NITRO_PACK, TRUE,
+ EL_BD_NITRO_PACK, -1, -1
+ },
+ {
+ O_NITRO_PACK_F, TRUE,
+ EL_BD_NITRO_PACK_FALLING, -1, -1
+ },
+ {
+ O_NITRO_PACK_F, FALSE,
+ EL_BD_NITRO_PACK, ACTION_FALLING, -1
+ },
+ {
+ O_PRE_CLOCK_1, TRUE,
+ EL_BD_CLOCK_GROWING_1, -1, -1
+ },
+ {
+ O_PRE_CLOCK_1, FALSE,
+ EL_BD_CLOCK, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_CLOCK_2, TRUE,
+ EL_BD_CLOCK_GROWING_2, -1, -1
+ },
+ {
+ O_PRE_CLOCK_2, FALSE,
+ EL_BD_CLOCK, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_CLOCK_3, TRUE,
+ EL_BD_CLOCK_GROWING_3, -1, -1
+ },
+ {
+ O_PRE_CLOCK_3, FALSE,
+ EL_BD_CLOCK, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_CLOCK_4, TRUE,
+ EL_BD_CLOCK_GROWING_4, -1, -1
+ },
+ {
+ O_PRE_CLOCK_4, FALSE,
+ EL_BD_CLOCK, ACTION_GROWING, -1
+ },
+ {
+ O_PRE_DIA_1, TRUE,
+ EL_BD_DIAMOND_GROWING_1, -1, -1
+ },
+ {
+ O_PRE_DIA_1, FALSE,
+ EL_BD_DIAMOND, ACTION_GROWING, -1