added options to use artwork and to copy template when creating level set
authorHolger Schemel <info@artsoft.org>
Sat, 11 Nov 2017 19:54:10 +0000 (20:54 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:16 +0000 (23:21 +0100)
src/editor.c
src/libgame/setup.c
src/libgame/setup.h

index 7a854200d554445d7c48545c228b303777795d49..9184cc7cd62f4b9a2721ec3d290a07cc79210158 100644 (file)
 #define GADGET_ID_CHECKBUTTON_FIRST    (GADGET_ID_SCROLLING_LIST_FIRST + 3)
 
 #define GADGET_ID_AUTO_COUNT_GEMS      (GADGET_ID_CHECKBUTTON_FIRST + 0)
-#define GADGET_ID_RANDOM_PERCENTAGE    (GADGET_ID_CHECKBUTTON_FIRST + 1)
-#define GADGET_ID_RANDOM_QUANTITY      (GADGET_ID_CHECKBUTTON_FIRST + 2)
-#define GADGET_ID_RANDOM_RESTRICTED    (GADGET_ID_CHECKBUTTON_FIRST + 3)
-#define GADGET_ID_STICK_ELEMENT                (GADGET_ID_CHECKBUTTON_FIRST + 4)
-#define GADGET_ID_EM_SLIPPERY_GEMS     (GADGET_ID_CHECKBUTTON_FIRST + 5)
-#define GADGET_ID_EM_EXPLODES_BY_FIRE  (GADGET_ID_CHECKBUTTON_FIRST + 6)
-#define GADGET_ID_USE_SPRING_BUG       (GADGET_ID_CHECKBUTTON_FIRST + 7)
-#define GADGET_ID_USE_TIME_ORB_BUG     (GADGET_ID_CHECKBUTTON_FIRST + 8)
-#define GADGET_ID_RANDOM_BALL_CONTENT  (GADGET_ID_CHECKBUTTON_FIRST + 9)
-#define GADGET_ID_INITIAL_BALL_STATE   (GADGET_ID_CHECKBUTTON_FIRST + 10)
-#define GADGET_ID_GROW_INTO_DIGGABLE   (GADGET_ID_CHECKBUTTON_FIRST + 11)
-#define GADGET_ID_AUTO_EXIT_SOKOBAN    (GADGET_ID_CHECKBUTTON_FIRST + 12)
-#define GADGET_ID_CONTINUOUS_SNAPPING  (GADGET_ID_CHECKBUTTON_FIRST + 13)
-#define GADGET_ID_BLOCK_SNAP_FIELD     (GADGET_ID_CHECKBUTTON_FIRST + 14)
-#define GADGET_ID_BLOCK_LAST_FIELD     (GADGET_ID_CHECKBUTTON_FIRST + 15)
-#define GADGET_ID_SP_BLOCK_LAST_FIELD  (GADGET_ID_CHECKBUTTON_FIRST + 16)
-#define GADGET_ID_INSTANT_RELOCATION   (GADGET_ID_CHECKBUTTON_FIRST + 17)
-#define GADGET_ID_SHIFTED_RELOCATION   (GADGET_ID_CHECKBUTTON_FIRST + 18)
-#define GADGET_ID_LAZY_RELOCATION      (GADGET_ID_CHECKBUTTON_FIRST + 19)
-#define GADGET_ID_USE_START_ELEMENT    (GADGET_ID_CHECKBUTTON_FIRST + 20)
-#define GADGET_ID_USE_ARTWORK_ELEMENT  (GADGET_ID_CHECKBUTTON_FIRST + 21)
-#define GADGET_ID_USE_EXPLOSION_ELEMENT        (GADGET_ID_CHECKBUTTON_FIRST + 22)
-#define GADGET_ID_INITIAL_GRAVITY      (GADGET_ID_CHECKBUTTON_FIRST + 23)
-#define GADGET_ID_USE_INITIAL_INVENTORY        (GADGET_ID_CHECKBUTTON_FIRST + 24)
-#define GADGET_ID_CAN_PASS_TO_WALKABLE (GADGET_ID_CHECKBUTTON_FIRST + 25)
-#define GADGET_ID_CAN_FALL_INTO_ACID   (GADGET_ID_CHECKBUTTON_FIRST + 26)
-#define GADGET_ID_CAN_MOVE_INTO_ACID   (GADGET_ID_CHECKBUTTON_FIRST + 27)
-#define GADGET_ID_DONT_COLLIDE_WITH    (GADGET_ID_CHECKBUTTON_FIRST + 28)
-#define GADGET_ID_ENVELOPE_AUTOWRAP    (GADGET_ID_CHECKBUTTON_FIRST + 29)
-#define GADGET_ID_ENVELOPE_CENTERED    (GADGET_ID_CHECKBUTTON_FIRST + 30)
-#define GADGET_ID_MM_LASER_RED         (GADGET_ID_CHECKBUTTON_FIRST + 31)
-#define GADGET_ID_MM_LASER_GREEN       (GADGET_ID_CHECKBUTTON_FIRST + 32)
-#define GADGET_ID_MM_LASER_BLUE                (GADGET_ID_CHECKBUTTON_FIRST + 33)
-#define GADGET_ID_DF_LASER_RED         (GADGET_ID_CHECKBUTTON_FIRST + 34)
-#define GADGET_ID_DF_LASER_GREEN       (GADGET_ID_CHECKBUTTON_FIRST + 35)
-#define GADGET_ID_DF_LASER_BLUE                (GADGET_ID_CHECKBUTTON_FIRST + 36)
-#define GADGET_ID_CUSTOM_INDESTRUCTIBLE        (GADGET_ID_CHECKBUTTON_FIRST + 37)
-#define GADGET_ID_CUSTOM_CAN_EXPLODE   (GADGET_ID_CHECKBUTTON_FIRST + 38)
-#define GADGET_ID_CUSTOM_EXPLODE_FIRE  (GADGET_ID_CHECKBUTTON_FIRST + 39)
-#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 40)
-#define GADGET_ID_CUSTOM_EXPLODE_IMPACT        (GADGET_ID_CHECKBUTTON_FIRST + 41)
-#define GADGET_ID_CUSTOM_WALK_TO_OBJECT        (GADGET_ID_CHECKBUTTON_FIRST + 42)
-#define GADGET_ID_CUSTOM_DEADLY                (GADGET_ID_CHECKBUTTON_FIRST + 43)
-#define GADGET_ID_CUSTOM_CAN_MOVE      (GADGET_ID_CHECKBUTTON_FIRST + 44)
-#define GADGET_ID_CUSTOM_CAN_FALL      (GADGET_ID_CHECKBUTTON_FIRST + 45)
-#define GADGET_ID_CUSTOM_CAN_SMASH     (GADGET_ID_CHECKBUTTON_FIRST + 46)
-#define GADGET_ID_CUSTOM_SLIPPERY      (GADGET_ID_CHECKBUTTON_FIRST + 47)
-#define GADGET_ID_CUSTOM_ACCESSIBLE    (GADGET_ID_CHECKBUTTON_FIRST + 48)
-#define GADGET_ID_CUSTOM_GRAV_REACHABLE        (GADGET_ID_CHECKBUTTON_FIRST + 49)
-#define GADGET_ID_CUSTOM_USE_LAST_VALUE        (GADGET_ID_CHECKBUTTON_FIRST + 50)
-#define GADGET_ID_CUSTOM_USE_GRAPHIC   (GADGET_ID_CHECKBUTTON_FIRST + 51)
-#define GADGET_ID_CUSTOM_USE_TEMPLATE_1        (GADGET_ID_CHECKBUTTON_FIRST + 52)
-#define GADGET_ID_CUSTOM_USE_TEMPLATE_2        (GADGET_ID_CHECKBUTTON_FIRST + 53)
-#define GADGET_ID_CUSTOM_USE_TEMPLATE_3        (GADGET_ID_CHECKBUTTON_FIRST + 54)
-#define GADGET_ID_CUSTOM_CAN_CHANGE    (GADGET_ID_CHECKBUTTON_FIRST + 55)
-#define GADGET_ID_CHANGE_USE_CONTENT   (GADGET_ID_CHECKBUTTON_FIRST + 56)
-#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 57)
-#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 58)
-#define GADGET_ID_CHANGE_USE_RANDOM    (GADGET_ID_CHECKBUTTON_FIRST + 59)
-#define GADGET_ID_CHANGE_HAS_ACTION    (GADGET_ID_CHECKBUTTON_FIRST + 60)
-#define GADGET_ID_CHANGE_DELAY         (GADGET_ID_CHECKBUTTON_FIRST + 61)
-#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 62)
-#define GADGET_ID_CHANGE_BY_OTHER_ACT  (GADGET_ID_CHECKBUTTON_FIRST + 63)
+#define GADGET_ID_USE_LEVELSET_ARTWORK (GADGET_ID_CHECKBUTTON_FIRST + 1)
+#define GADGET_ID_COPY_LEVEL_TEMPLATE  (GADGET_ID_CHECKBUTTON_FIRST + 2)
+#define GADGET_ID_RANDOM_PERCENTAGE    (GADGET_ID_CHECKBUTTON_FIRST + 3)
+#define GADGET_ID_RANDOM_QUANTITY      (GADGET_ID_CHECKBUTTON_FIRST + 4)
+#define GADGET_ID_RANDOM_RESTRICTED    (GADGET_ID_CHECKBUTTON_FIRST + 5)
+#define GADGET_ID_STICK_ELEMENT                (GADGET_ID_CHECKBUTTON_FIRST + 6)
+#define GADGET_ID_EM_SLIPPERY_GEMS     (GADGET_ID_CHECKBUTTON_FIRST + 7)
+#define GADGET_ID_EM_EXPLODES_BY_FIRE  (GADGET_ID_CHECKBUTTON_FIRST + 8)
+#define GADGET_ID_USE_SPRING_BUG       (GADGET_ID_CHECKBUTTON_FIRST + 9)
+#define GADGET_ID_USE_TIME_ORB_BUG     (GADGET_ID_CHECKBUTTON_FIRST + 10)
+#define GADGET_ID_RANDOM_BALL_CONTENT  (GADGET_ID_CHECKBUTTON_FIRST + 11)
+#define GADGET_ID_INITIAL_BALL_STATE   (GADGET_ID_CHECKBUTTON_FIRST + 12)
+#define GADGET_ID_GROW_INTO_DIGGABLE   (GADGET_ID_CHECKBUTTON_FIRST + 13)
+#define GADGET_ID_AUTO_EXIT_SOKOBAN    (GADGET_ID_CHECKBUTTON_FIRST + 14)
+#define GADGET_ID_CONTINUOUS_SNAPPING  (GADGET_ID_CHECKBUTTON_FIRST + 15)
+#define GADGET_ID_BLOCK_SNAP_FIELD     (GADGET_ID_CHECKBUTTON_FIRST + 16)
+#define GADGET_ID_BLOCK_LAST_FIELD     (GADGET_ID_CHECKBUTTON_FIRST + 17)
+#define GADGET_ID_SP_BLOCK_LAST_FIELD  (GADGET_ID_CHECKBUTTON_FIRST + 18)
+#define GADGET_ID_INSTANT_RELOCATION   (GADGET_ID_CHECKBUTTON_FIRST + 19)
+#define GADGET_ID_SHIFTED_RELOCATION   (GADGET_ID_CHECKBUTTON_FIRST + 20)
+#define GADGET_ID_LAZY_RELOCATION      (GADGET_ID_CHECKBUTTON_FIRST + 21)
+#define GADGET_ID_USE_START_ELEMENT    (GADGET_ID_CHECKBUTTON_FIRST + 22)
+#define GADGET_ID_USE_ARTWORK_ELEMENT  (GADGET_ID_CHECKBUTTON_FIRST + 23)
+#define GADGET_ID_USE_EXPLOSION_ELEMENT        (GADGET_ID_CHECKBUTTON_FIRST + 24)
+#define GADGET_ID_INITIAL_GRAVITY      (GADGET_ID_CHECKBUTTON_FIRST + 25)
+#define GADGET_ID_USE_INITIAL_INVENTORY        (GADGET_ID_CHECKBUTTON_FIRST + 26)
+#define GADGET_ID_CAN_PASS_TO_WALKABLE (GADGET_ID_CHECKBUTTON_FIRST + 27)
+#define GADGET_ID_CAN_FALL_INTO_ACID   (GADGET_ID_CHECKBUTTON_FIRST + 28)
+#define GADGET_ID_CAN_MOVE_INTO_ACID   (GADGET_ID_CHECKBUTTON_FIRST + 29)
+#define GADGET_ID_DONT_COLLIDE_WITH    (GADGET_ID_CHECKBUTTON_FIRST + 30)
+#define GADGET_ID_ENVELOPE_AUTOWRAP    (GADGET_ID_CHECKBUTTON_FIRST + 31)
+#define GADGET_ID_ENVELOPE_CENTERED    (GADGET_ID_CHECKBUTTON_FIRST + 32)
+#define GADGET_ID_MM_LASER_RED         (GADGET_ID_CHECKBUTTON_FIRST + 33)
+#define GADGET_ID_MM_LASER_GREEN       (GADGET_ID_CHECKBUTTON_FIRST + 34)
+#define GADGET_ID_MM_LASER_BLUE                (GADGET_ID_CHECKBUTTON_FIRST + 35)
+#define GADGET_ID_DF_LASER_RED         (GADGET_ID_CHECKBUTTON_FIRST + 36)
+#define GADGET_ID_DF_LASER_GREEN       (GADGET_ID_CHECKBUTTON_FIRST + 37)
+#define GADGET_ID_DF_LASER_BLUE                (GADGET_ID_CHECKBUTTON_FIRST + 38)
+#define GADGET_ID_CUSTOM_INDESTRUCTIBLE        (GADGET_ID_CHECKBUTTON_FIRST + 39)
+#define GADGET_ID_CUSTOM_CAN_EXPLODE   (GADGET_ID_CHECKBUTTON_FIRST + 40)
+#define GADGET_ID_CUSTOM_EXPLODE_FIRE  (GADGET_ID_CHECKBUTTON_FIRST + 41)
+#define GADGET_ID_CUSTOM_EXPLODE_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 42)
+#define GADGET_ID_CUSTOM_EXPLODE_IMPACT        (GADGET_ID_CHECKBUTTON_FIRST + 43)
+#define GADGET_ID_CUSTOM_WALK_TO_OBJECT        (GADGET_ID_CHECKBUTTON_FIRST + 44)
+#define GADGET_ID_CUSTOM_DEADLY                (GADGET_ID_CHECKBUTTON_FIRST + 45)
+#define GADGET_ID_CUSTOM_CAN_MOVE      (GADGET_ID_CHECKBUTTON_FIRST + 46)
+#define GADGET_ID_CUSTOM_CAN_FALL      (GADGET_ID_CHECKBUTTON_FIRST + 47)
+#define GADGET_ID_CUSTOM_CAN_SMASH     (GADGET_ID_CHECKBUTTON_FIRST + 48)
+#define GADGET_ID_CUSTOM_SLIPPERY      (GADGET_ID_CHECKBUTTON_FIRST + 49)
+#define GADGET_ID_CUSTOM_ACCESSIBLE    (GADGET_ID_CHECKBUTTON_FIRST + 50)
+#define GADGET_ID_CUSTOM_GRAV_REACHABLE        (GADGET_ID_CHECKBUTTON_FIRST + 51)
+#define GADGET_ID_CUSTOM_USE_LAST_VALUE        (GADGET_ID_CHECKBUTTON_FIRST + 52)
+#define GADGET_ID_CUSTOM_USE_GRAPHIC   (GADGET_ID_CHECKBUTTON_FIRST + 53)
+#define GADGET_ID_CUSTOM_USE_TEMPLATE_1        (GADGET_ID_CHECKBUTTON_FIRST + 54)
+#define GADGET_ID_CUSTOM_USE_TEMPLATE_2        (GADGET_ID_CHECKBUTTON_FIRST + 55)
+#define GADGET_ID_CUSTOM_USE_TEMPLATE_3        (GADGET_ID_CHECKBUTTON_FIRST + 56)
+#define GADGET_ID_CUSTOM_CAN_CHANGE    (GADGET_ID_CHECKBUTTON_FIRST + 57)
+#define GADGET_ID_CHANGE_USE_CONTENT   (GADGET_ID_CHECKBUTTON_FIRST + 58)
+#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 59)
+#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 60)
+#define GADGET_ID_CHANGE_USE_RANDOM    (GADGET_ID_CHECKBUTTON_FIRST + 61)
+#define GADGET_ID_CHANGE_HAS_ACTION    (GADGET_ID_CHECKBUTTON_FIRST + 62)
+#define GADGET_ID_CHANGE_DELAY         (GADGET_ID_CHECKBUTTON_FIRST + 63)
+#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 64)
+#define GADGET_ID_CHANGE_BY_OTHER_ACT  (GADGET_ID_CHECKBUTTON_FIRST + 65)
 
 /* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST    (GADGET_ID_CHECKBUTTON_FIRST + 64)
+#define GADGET_ID_ELEMENTLIST_FIRST    (GADGET_ID_CHECKBUTTON_FIRST + 66)
 #define GADGET_ID_ELEMENTLIST_LAST     (GADGET_ID_ELEMENTLIST_FIRST +  \
                                        ED_NUM_ELEMENTLIST_BUTTONS - 1)
 
 
 /* values for checkbutton gadgets */
 #define ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS      0
-#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED    1
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3        2
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2        3
-#define ED_CHECKBUTTON_ID_STICK_ELEMENT                4
-#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS     5
-#define ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE  6
-#define ED_CHECKBUTTON_ID_USE_SPRING_BUG       7
-#define ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG     8
-#define ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT  9
-#define ED_CHECKBUTTON_ID_INITIAL_BALL_STATE   10
-#define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE   11
-#define ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN    12
-#define ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING  13
-#define ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD     14
-#define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD     15
-#define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD  16
-#define ED_CHECKBUTTON_ID_INSTANT_RELOCATION   17
-#define ED_CHECKBUTTON_ID_SHIFTED_RELOCATION   18
-#define ED_CHECKBUTTON_ID_LAZY_RELOCATION      19
-#define ED_CHECKBUTTON_ID_USE_START_ELEMENT    20
-#define ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT  21
-#define ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT        22
-#define ED_CHECKBUTTON_ID_INITIAL_GRAVITY      23
-#define ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY        24
-#define ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE 25
-#define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID   26
-#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID   27
-#define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH    28
-#define ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP    29
-#define ED_CHECKBUTTON_ID_ENVELOPE_CENTERED    30
-#define ED_CHECKBUTTON_ID_MM_LASER_RED         31
-#define ED_CHECKBUTTON_ID_MM_LASER_GREEN       32
-#define ED_CHECKBUTTON_ID_MM_LASER_BLUE                33
-#define ED_CHECKBUTTON_ID_DF_LASER_RED         34
-#define ED_CHECKBUTTON_ID_DF_LASER_GREEN       35
-#define ED_CHECKBUTTON_ID_DF_LASER_BLUE                36
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC   37
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1        38
-#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE    39
-#define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE        40
-#define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE        41
-#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT        42
-#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE        43
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE      44
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL      45
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH     46
-#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY      47
-#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY                48
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE   49
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE  50
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 51
-#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT        52
-#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE    53
-#define ED_CHECKBUTTON_ID_CHANGE_DELAY         54
-#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 55
-#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT  56
-#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 57
-#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT   58
-#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 59
-#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM    60
-#define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION    61
-
-#define ED_NUM_CHECKBUTTONS                    62
+#define ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK 1
+#define ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE  2
+#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED    3
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_3        4
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2        5
+#define ED_CHECKBUTTON_ID_STICK_ELEMENT                6
+#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS     7
+#define ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE  8
+#define ED_CHECKBUTTON_ID_USE_SPRING_BUG       9
+#define ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG     10
+#define ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT  11
+#define ED_CHECKBUTTON_ID_INITIAL_BALL_STATE   12
+#define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE   13
+#define ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN    14
+#define ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING  15
+#define ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD     16
+#define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD     17
+#define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD  18
+#define ED_CHECKBUTTON_ID_INSTANT_RELOCATION   19
+#define ED_CHECKBUTTON_ID_SHIFTED_RELOCATION   20
+#define ED_CHECKBUTTON_ID_LAZY_RELOCATION      21
+#define ED_CHECKBUTTON_ID_USE_START_ELEMENT    22
+#define ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT  23
+#define ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT        24
+#define ED_CHECKBUTTON_ID_INITIAL_GRAVITY      25
+#define ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY        26
+#define ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE 27
+#define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID   28
+#define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID   29
+#define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH    30
+#define ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP    31
+#define ED_CHECKBUTTON_ID_ENVELOPE_CENTERED    32
+#define ED_CHECKBUTTON_ID_MM_LASER_RED         33
+#define ED_CHECKBUTTON_ID_MM_LASER_GREEN       34
+#define ED_CHECKBUTTON_ID_MM_LASER_BLUE                35
+#define ED_CHECKBUTTON_ID_DF_LASER_RED         36
+#define ED_CHECKBUTTON_ID_DF_LASER_GREEN       37
+#define ED_CHECKBUTTON_ID_DF_LASER_BLUE                38
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC   39
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1        40
+#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE    41
+#define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE        42
+#define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE        43
+#define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT        44
+#define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE        45
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE      46
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL      47
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH     48
+#define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY      49
+#define ED_CHECKBUTTON_ID_CUSTOM_DEADLY                50
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE   51
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE  52
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH 53
+#define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT        54
+#define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE    55
+#define ED_CHECKBUTTON_ID_CHANGE_DELAY         56
+#define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT 57
+#define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT  58
+#define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION 59
+#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT   60
+#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 61
+#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM    62
+#define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION    63
+
+#define ED_NUM_CHECKBUTTONS                    64
 
 #define ED_CHECKBUTTON_ID_LEVEL_FIRST  ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS
 #define ED_CHECKBUTTON_ID_LEVEL_LAST   ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS
 
+#define ED_CHECKBUTTON_ID_LEVELSET_FIRST ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK
+#define ED_CHECKBUTTON_ID_LEVELSET_LAST         ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE
+
 #define ED_CHECKBUTTON_ID_EDITOR_FIRST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
 #define ED_CHECKBUTTON_ID_EDITOR_LAST  ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2
 
@@ -1302,6 +1309,8 @@ static struct ElementInfo custom_element;
 static char levelset_name[MAX_LEVEL_NAME_LEN + 1];
 static char levelset_author[MAX_LEVEL_AUTHOR_LEN + 1];
 static int levelset_num_levels = 100;
+static boolean levelset_use_levelset_artwork = FALSE;
+static boolean levelset_copy_level_template = FALSE;
 static int levelset_save_mode = LEVELSET_SAVE_MODE_UPDATE;
 
 static struct
@@ -2422,7 +2431,7 @@ static struct
     NULL, "game engine:", NULL,                "game engine"
   },
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(9),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(10),
     GADGET_ID_LEVELSET_SAVE_MODE,      GADGET_ID_NONE,
     -1,
     options_levelset_save_mode,
@@ -2732,7 +2741,7 @@ static struct
   /* ---------- level and editor settings (buttons) ------------------------ */
 
   {
-    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(9),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(10),
     GADGET_ID_SAVE_LEVELSET,           GADGET_ID_LEVELSET_SAVE_MODE,
     -1,                                        "Save",
     NULL, NULL, NULL,                  "Update or create level set"
@@ -2929,6 +2938,20 @@ static struct
     NULL, NULL,
     "automatically count gems needed", "set counter to number of gems"
   },
+  {
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(7),
+    GADGET_ID_USE_LEVELSET_ARTWORK,    GADGET_ID_NONE,
+    &levelset_use_levelset_artwork,
+    NULL, NULL,
+    "use current custom artwork",      "use custom artwork of this level set"
+  },
+  {
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(8),
+    GADGET_ID_COPY_LEVEL_TEMPLATE,     GADGET_ID_NONE,
+    &levelset_copy_level_template,
+    NULL, NULL,
+    "copy current level template",     "copy level template of this level set"
+  },
   {
     ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(1),
     GADGET_ID_RANDOM_RESTRICTED,       GADGET_ID_NONE,
@@ -8340,6 +8363,9 @@ static void InitLevelSetInfo()
 
   levelset_num_levels = leveldir_current->levels;
 
+  levelset_use_levelset_artwork = FALSE;
+  levelset_copy_level_template = FALSE;
+
   levelset_save_mode = LEVELSET_SAVE_MODE_UPDATE;
 }
 
@@ -8992,12 +9018,25 @@ static void DrawLevelInfoLevelSet_DirectoryInfo()
 
 static void DrawLevelInfoLevelSet()
 {
+  boolean artwork_exists = checkIfCustomArtworkExistsForCurrentLevelSet();
+  boolean template_exists = fileExists(getLocalLevelTemplateFilename());
   int i;
 
   /* draw counter gadgets */
   for (i = ED_COUNTER_ID_LEVELSET_FIRST; i <= ED_COUNTER_ID_LEVELSET_LAST; i++)
     MapCounterButtons(i);
 
+  /* draw checkbutton gadgets */
+  for (i = ED_CHECKBUTTON_ID_LEVELSET_FIRST; i <= ED_CHECKBUTTON_ID_LEVELSET_LAST; i++)
+  {
+    if (levelset_save_mode == LEVELSET_SAVE_MODE_UPDATE ||
+       (i == ED_CHECKBUTTON_ID_USE_LEVELSET_ARTWORK && !artwork_exists) ||
+       (i == ED_CHECKBUTTON_ID_COPY_LEVEL_TEMPLATE  && !template_exists))
+      continue;
+
+    MapCheckbuttonGadget(i);
+  }
+
   /* draw selectbox gadgets */
   for (i = ED_SELECTBOX_ID_LEVELSET_FIRST; i <= ED_SELECTBOX_ID_LEVELSET_LAST; i++)
     MapSelectboxGadget(i);
@@ -12226,6 +12265,18 @@ void WrapLevel(int dx, int dy)
   CopyLevelToUndoBuffer(UNDO_ACCUMULATE);
 }
 
+static void CopyLevelTemplateToUserLevelSet(char *levelset_subdir)
+{
+  char *template_filename_old = getLocalLevelTemplateFilename();
+  char *template_filename_new =
+    getPath2(getUserLevelDir(levelset_subdir), LEVELTEMPLATE_FILENAME);
+
+  if (copyFile(template_filename_old, template_filename_new) != 0)
+    Request("Cannot copy level template!", REQ_CONFIRM);
+
+  free(template_filename_new);
+}
+
 static void HandleDrawingAreas(struct GadgetInfo *gi)
 {
   static boolean started_inside_drawing_area = FALSE;
@@ -12830,13 +12881,21 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
        Request("Updating level set failed!", REQ_CONFIRM);
       }
     }
-    else
+    else if (levelset_save_mode == LEVELSET_SAVE_MODE_CREATE)
     {
+      if (level.changed && !Request("Level has changed! Discard changes?",
+                                    REQ_ASK))
+       return;
+
       if (CreateUserLevelSet(levelset_subdir,
                             levelset_name,
                             levelset_author,
-                            levelset_num_levels))
+                            levelset_num_levels,
+                            levelset_use_levelset_artwork))
       {
+       if (levelset_copy_level_template)
+         CopyLevelTemplateToUserLevelSet(levelset_subdir);
+
        Request("New level set created!", REQ_CONFIRM);
 
        AddUserLevelSetToLevelInfo(levelset_subdir);
@@ -13057,7 +13116,9 @@ static void HandleCheckbuttons(struct GadgetInfo *gi)
   }
 
   /* do not mark level as modified for certain non-level-changing gadgets */
-  if ((type_id >= ED_CHECKBUTTON_ID_EDITOR_FIRST &&
+  if ((type_id >= ED_CHECKBUTTON_ID_LEVELSET_FIRST &&
+       type_id <= ED_CHECKBUTTON_ID_LEVELSET_LAST) ||
+      (type_id >= ED_CHECKBUTTON_ID_EDITOR_FIRST &&
        type_id <= ED_CHECKBUTTON_ID_EDITOR_LAST) ||
       type_id == ED_CHECKBUTTON_ID_STICK_ELEMENT)
     return;
index 1a7972be2be0c095bd1aa58f424bc9119666722f..f28df34f30713cc103e0ce83b88a854fb85fd243 100644 (file)
@@ -3606,6 +3606,43 @@ void AddUserLevelSetToLevelInfo(char *level_subdir_new)
     Error(ERR_EXIT, "internal level set structure corrupted -- aborting");
 }
 
+char *getArtworkIdentifierForUserLevelSet(int type)
+{
+  char *classic_artwork_set = getClassicArtworkSet(type);
+
+  /* check for custom artwork configured in "levelinfo.conf" */
+  char *leveldir_artwork_set =
+    *LEVELDIR_ARTWORK_SET_PTR(leveldir_current, type);
+  boolean has_leveldir_artwork_set =
+    (leveldir_artwork_set != NULL && !strEqual(leveldir_artwork_set,
+                                              classic_artwork_set));
+
+  /* check for custom artwork in sub-directory "graphics" etc. */
+  TreeInfo *artwork_first_node = ARTWORK_FIRST_NODE(artwork, type);
+  char *leveldir_identifier = leveldir_current->identifier;
+  boolean has_artwork_subdir =
+    (getTreeInfoFromIdentifier(artwork_first_node,
+                              leveldir_identifier) != NULL);
+
+  return (has_leveldir_artwork_set ? leveldir_artwork_set :
+         has_artwork_subdir       ? leveldir_identifier :
+         classic_artwork_set);
+}
+
+boolean checkIfCustomArtworkExistsForCurrentLevelSet()
+{
+  char *graphics_set =
+    getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
+  char *sounds_set =
+    getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_SOUNDS);
+  char *music_set =
+    getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_MUSIC);
+
+  return (!strEqual(graphics_set, GFX_CLASSIC_SUBDIR) ||
+         !strEqual(sounds_set,   SND_CLASSIC_SUBDIR) ||
+         !strEqual(music_set,    MUS_CLASSIC_SUBDIR));
+}
+
 boolean UpdateUserLevelSet(char *level_subdir, char *level_name,
                           char *level_author, int num_levels)
 {
@@ -3671,7 +3708,8 @@ boolean UpdateUserLevelSet(char *level_subdir, char *level_name,
 }
 
 boolean CreateUserLevelSet(char *level_subdir, char *level_name,
-                          char *level_author, int num_levels)
+                          char *level_author, int num_levels,
+                          boolean use_artwork_set)
 {
   LevelDirTree *level_info;
   char *filename;
@@ -3703,6 +3741,16 @@ boolean CreateUserLevelSet(char *level_subdir, char *level_name,
   level_info->sort_priority = LEVELCLASS_PRIVATE_START;
   level_info->readonly = FALSE;
 
+  if (use_artwork_set)
+  {
+    level_info->graphics_set =
+      getStringCopy(getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_GRAPHICS));
+    level_info->sounds_set =
+      getStringCopy(getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_SOUNDS));
+    level_info->music_set =
+      getStringCopy(getArtworkIdentifierForUserLevelSet(ARTWORK_TYPE_MUSIC));
+  }
+
   token_value_position = TOKEN_VALUE_POSITION_SHORT;
 
   fprintFileHeader(file, LEVELINFO_FILENAME);
@@ -3715,12 +3763,16 @@ boolean CreateUserLevelSet(char *level_subdir, char *level_name,
        i == LEVELINFO_TOKEN_LEVELS ||
        i == LEVELINFO_TOKEN_FIRST_LEVEL ||
        i == LEVELINFO_TOKEN_SORT_PRIORITY ||
-       i == LEVELINFO_TOKEN_READONLY)
+       i == LEVELINFO_TOKEN_READONLY ||
+       (use_artwork_set && (i == LEVELINFO_TOKEN_GRAPHICS_SET ||
+                            i == LEVELINFO_TOKEN_SOUNDS_SET ||
+                            i == LEVELINFO_TOKEN_MUSIC_SET)))
       fprintf(file, "%s\n", getSetupLine(levelinfo_tokens, "", i));
 
     /* just to make things nicer :) */
     if (i == LEVELINFO_TOKEN_AUTHOR ||
-       i == LEVELINFO_TOKEN_FIRST_LEVEL)
+       i == LEVELINFO_TOKEN_FIRST_LEVEL ||
+       (use_artwork_set && i == LEVELINFO_TOKEN_READONLY))
       fprintf(file, "\n");     
   }
 
@@ -3738,7 +3790,7 @@ boolean CreateUserLevelSet(char *level_subdir, char *level_name,
 
 static void SaveUserLevelInfo()
 {
-  CreateUserLevelSet(getLoginName(), getLoginName(), getRealName(), 100);
+  CreateUserLevelSet(getLoginName(), getLoginName(), getRealName(), 100, FALSE);
 }
 
 char *getSetupValue(int type, void *value)
index 5fad3752fb6e8a46e2eebfe7d906cfa4aa432dce..fab964386587ce5dfc177f54799fdb571035e674 100644 (file)
@@ -313,9 +313,11 @@ void LoadLevelInfo(void);
 void LoadArtworkInfo(void);
 void LoadLevelArtworkInfo(void);
 
+char *getArtworkIdentifierForUserLevelSet(int);
+boolean checkIfCustomArtworkExistsForCurrentLevelSet();
 void AddUserLevelSetToLevelInfo(char *);
 boolean UpdateUserLevelSet(char *, char *, char *, int);
-boolean CreateUserLevelSet(char *, char *, char *, int);
+boolean CreateUserLevelSet(char *, char *, char *, int, boolean);
 
 void LoadLevelSetup_LastSeries(void);
 void SaveLevelSetup_LastSeries(void);