{ ".2nd_offset", ARG_UNDEFINED, TYPE_INTEGER },
{ ".2nd_xoffset", ARG_UNDEFINED, TYPE_INTEGER },
{ ".2nd_yoffset", ARG_UNDEFINED, TYPE_INTEGER },
+ { ".2nd_swap_tiles", ARG_UNDEFINED, TYPE_BOOLEAN },
{ ".frames", ARG_UNDEFINED, TYPE_INTEGER },
{ ".frames_per_line", ARG_UNDEFINED, TYPE_INTEGER },
{ ".start_frame", ARG_UNDEFINED, TYPE_INTEGER },
if (act == ACTION_FALLING) /* special case */
graphic = element_info[i].graphic[act];
- if (graphic != -1 && graphic_info[graphic].double_movement)
+ if (graphic != -1 &&
+ graphic_info[graphic].double_movement &&
+ graphic_info[graphic].swap_double_tiles != 0)
{
struct GraphicInfo *g = &graphic_info[graphic];
int src_x_front = g->src_x;
g->offset_y != 0);
boolean front_is_left_or_upper = (src_x_front < src_x_back ||
src_y_front < src_y_back);
+#if 0
+ boolean second_tile_is_back =
+ ((move_dir == MV_BIT_LEFT && front_is_left_or_upper) ||
+ (move_dir == MV_BIT_UP && front_is_left_or_upper));
+ boolean second_tile_is_front =
+ ((move_dir == MV_BIT_RIGHT && front_is_left_or_upper) ||
+ (move_dir == MV_BIT_DOWN && front_is_left_or_upper));
+ boolean second_tile_should_be_front =
+ (g->second_tile_is_start == 0);
+ boolean second_tile_should_be_back =
+ (g->second_tile_is_start == 1);
+#endif
+ boolean swap_movement_tiles_always = (g->swap_double_tiles == 1);
+ boolean swap_movement_tiles_autodetected =
+ (!frames_are_ordered_diagonally &&
+ ((move_dir == MV_BIT_LEFT && !front_is_left_or_upper) ||
+ (move_dir == MV_BIT_UP && !front_is_left_or_upper) ||
+ (move_dir == MV_BIT_RIGHT && front_is_left_or_upper) ||
+ (move_dir == MV_BIT_DOWN && front_is_left_or_upper)));
Bitmap *dummy;
#if 0
- printf("::: CHECKING ELEMENT %d ('%s'), ACTION '%s', DIRECTION %d\n",
+ printf("::: CHECKING element %d ('%s'), '%s', dir %d [(%d -> %d, %d), %d => %d]\n",
i, element_info[i].token_name,
- element_action_info[act].suffix, move_dir);
+ element_action_info[act].suffix, move_dir,
+ g->swap_double_tiles,
+ swap_movement_tiles_never,
+ swap_movement_tiles_always,
+ swap_movement_tiles_autodetected,
+ swap_movement_tiles);
#endif
/* swap frontside and backside graphic tile coordinates, if needed */
- if (!frames_are_ordered_diagonally &&
- ((move_dir == MV_BIT_LEFT && !front_is_left_or_upper) ||
- (move_dir == MV_BIT_RIGHT && front_is_left_or_upper) ||
- (move_dir == MV_BIT_UP && !front_is_left_or_upper) ||
- (move_dir == MV_BIT_DOWN && front_is_left_or_upper)))
+ if (swap_movement_tiles_always || swap_movement_tiles_autodetected)
{
/* get current (wrong) backside tile coordinates */
getGraphicSourceExt(graphic, 0, &dummy, &src_x_back, &src_y_back,
g->offset2_x *= -1;
g->offset2_y *= -1;
+ /* do not swap front and backside tiles again after correction */
+ g->swap_double_tiles = 0;
+
#if 0
printf(" CORRECTED\n");
#endif
graphic_info[graphic].offset_y = 0; /* ... will be corrected later */
graphic_info[graphic].offset2_x = 0; /* one or both of these values ... */
graphic_info[graphic].offset2_y = 0; /* ... will be corrected later */
+ graphic_info[graphic].swap_double_tiles = -1; /* auto-detect tile swapping */
graphic_info[graphic].crumbled_like = -1; /* do not use clone element */
graphic_info[graphic].diggable_like = -1; /* do not use clone element */
graphic_info[graphic].border_size = TILEX / 8; /* "CRUMBLED" border size */
if (parameter[GFX_ARG_2ND_YOFFSET] != ARG_UNDEFINED_VALUE)
graphic_info[graphic].offset2_y = parameter[GFX_ARG_2ND_YOFFSET];
+ /* optionally, the second movement tile can be specified as start tile */
+ if (parameter[GFX_ARG_2ND_SWAP_TILES] != ARG_UNDEFINED_VALUE)
+ graphic_info[graphic].swap_double_tiles= parameter[GFX_ARG_2ND_SWAP_TILES];
+
/* automatically determine correct number of frames, if not defined */
if (parameter[GFX_ARG_FRAMES] != ARG_UNDEFINED_VALUE)
graphic_info[graphic].anim_frames = parameter[GFX_ARG_FRAMES];
#define GFX_ARG_2ND_OFFSET 12
#define GFX_ARG_2ND_XOFFSET 13
#define GFX_ARG_2ND_YOFFSET 14
-#define GFX_ARG_FRAMES 15
-#define GFX_ARG_FRAMES_PER_LINE 16
-#define GFX_ARG_START_FRAME 17
-#define GFX_ARG_DELAY 18
-#define GFX_ARG_ANIM_MODE 19
-#define GFX_ARG_GLOBAL_SYNC 20
-#define GFX_ARG_CRUMBLED_LIKE 21
-#define GFX_ARG_DIGGABLE_LIKE 22
-#define GFX_ARG_BORDER_SIZE 23
-#define GFX_ARG_STEP_OFFSET 24
-#define GFX_ARG_STEP_DELAY 25
-#define GFX_ARG_DIRECTION 26
-#define GFX_ARG_POSITION 27
-#define GFX_ARG_DRAW_XOFFSET 28
-#define GFX_ARG_DRAW_YOFFSET 29
-#define GFX_ARG_DRAW_MASKED 30
-#define GFX_ARG_ANIM_DELAY_FIXED 31
-#define GFX_ARG_ANIM_DELAY_RANDOM 32
-#define GFX_ARG_POST_DELAY_FIXED 33
-#define GFX_ARG_POST_DELAY_RANDOM 34
-#define GFX_ARG_NAME 35
-#define GFX_ARG_SCALE_UP_FACTOR 36
-
-#define NUM_GFX_ARGS 37
+#define GFX_ARG_2ND_SWAP_TILES 15
+#define GFX_ARG_FRAMES 16
+#define GFX_ARG_FRAMES_PER_LINE 17
+#define GFX_ARG_START_FRAME 18
+#define GFX_ARG_DELAY 19
+#define GFX_ARG_ANIM_MODE 20
+#define GFX_ARG_GLOBAL_SYNC 21
+#define GFX_ARG_CRUMBLED_LIKE 22
+#define GFX_ARG_DIGGABLE_LIKE 23
+#define GFX_ARG_BORDER_SIZE 24
+#define GFX_ARG_STEP_OFFSET 25
+#define GFX_ARG_STEP_DELAY 26
+#define GFX_ARG_DIRECTION 27
+#define GFX_ARG_POSITION 28
+#define GFX_ARG_DRAW_XOFFSET 29
+#define GFX_ARG_DRAW_YOFFSET 30
+#define GFX_ARG_DRAW_MASKED 31
+#define GFX_ARG_ANIM_DELAY_FIXED 32
+#define GFX_ARG_ANIM_DELAY_RANDOM 33
+#define GFX_ARG_POST_DELAY_FIXED 34
+#define GFX_ARG_POST_DELAY_RANDOM 35
+#define GFX_ARG_NAME 36
+#define GFX_ARG_SCALE_UP_FACTOR 37
+
+#define NUM_GFX_ARGS 38
/* values for sound configuration suffixes */
int offset_x, offset_y; /* x/y offset to next animation frame */
int offset2_x, offset2_y; /* x/y offset to second movement tile */
boolean double_movement; /* animation has second movement tile */
+ int swap_double_tiles; /* explicitely force or forbid tile swapping */
int anim_frames;
int anim_frames_per_line;
int anim_start_frame;