#define GADGET_ID_CHANGE_PLAYER (GADGET_ID_SELECTBOX_FIRST + 19)
#define GADGET_ID_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 20)
#define GADGET_ID_CHANGE_REPLACE_WHEN (GADGET_ID_SELECTBOX_FIRST + 21)
-#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 22)
-#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 23)
+#define GADGET_ID_CHANGE_ACTION (GADGET_ID_SELECTBOX_FIRST + 22)
+#define GADGET_ID_CHANGE_ACTION_MODE (GADGET_ID_SELECTBOX_FIRST + 23)
+#define GADGET_ID_CHANGE_ACTION_ARG (GADGET_ID_SELECTBOX_FIRST + 24)
+#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 25)
+#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 26)
/* textbutton identifiers */
-#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 24)
+#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 27)
#define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0)
#define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1)
#define GADGET_ID_CHANGE_USE_EXPLOSION (GADGET_ID_CHECKBUTTON_FIRST + 33)
#define GADGET_ID_CHANGE_ONLY_COMPLETE (GADGET_ID_CHECKBUTTON_FIRST + 34)
#define GADGET_ID_CHANGE_USE_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 35)
-#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 36)
-#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 37)
-#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 38)
+#define GADGET_ID_CHANGE_USE_ACTION (GADGET_ID_CHECKBUTTON_FIRST + 36)
+#define GADGET_ID_CHANGE_DELAY (GADGET_ID_CHECKBUTTON_FIRST + 37)
+#define GADGET_ID_CHANGE_BY_DIRECT_ACT (GADGET_ID_CHECKBUTTON_FIRST + 38)
+#define GADGET_ID_CHANGE_BY_OTHER_ACT (GADGET_ID_CHECKBUTTON_FIRST + 39)
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 39)
+#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 40)
#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define ED_SELECTBOX_ID_CHANGE_PLAYER 19
#define ED_SELECTBOX_ID_CHANGE_PAGE 20
#define ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN 21
-#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 22
-#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 23
+#define ED_SELECTBOX_ID_CHANGE_ACTION 22
+#define ED_SELECTBOX_ID_CHANGE_ACTION_MODE 23
+#define ED_SELECTBOX_ID_CHANGE_ACTION_ARG 24
+#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 25
+#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 26
-#define ED_NUM_SELECTBOX 24
+#define ED_NUM_SELECTBOX 27
#define ED_SELECTBOX_ID_LEVEL_FIRST ED_SELECTBOX_ID_TIME_OR_STEPS
#define ED_SELECTBOX_ID_LEVEL_LAST ED_SELECTBOX_ID_GAME_ENGINE_TYPE
#define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT 34
#define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE 35
#define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM 36
+#define ED_CHECKBUTTON_ID_CHANGE_USE_ACTION 37
-#define ED_NUM_CHECKBUTTONS 37
+#define ED_NUM_CHECKBUTTONS 38
#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_INITIAL_GRAVITY
#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM2_LAST
#define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
-#define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM
+#define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_USE_ACTION
/* values for radiobutton gadgets */
#define ED_RADIOBUTTON_ID_PERCENTAGE 0
{ -1, NULL }
};
+static struct ValueTextInfo options_change_action[] =
+{
+ { CA_NO_ACTION, "no action" },
+ { CA_EXIT_PLAYER, "exit player" },
+ { CA_KILL_PLAYER, "kill player" },
+ { CA_RESTART_LEVEL, "restart level" },
+ { CA_SHOW_ENVELOPE, "show envelope" },
+ { CA_ADD_KEY, "add key" },
+ { CA_DEL_KEY, "remove key" },
+ { CA_SET_PLAYER_SPEED, "set player speed" },
+ { CA_SET_GEMS, "set gems" },
+ { CA_SET_SCORE, "set score" },
+ { CA_SET_TIME, "set time" },
+ { CA_SET_COUNTER, "set counter" },
+ { CA_SET_DYNABOMB_NUMBER, "set bomb number" },
+ { CA_SET_DYNABOMB_SIZE, "set bomb size" },
+ { CA_SET_DYNABOMB_POWER, "set bomb power" },
+ { CA_TOGGLE_PLAYER_GRAVITY, "toggle gravity" },
+ { CA_ENABLE_PLAYER_GRAVITY, "enable gravity" },
+ { CA_DISABLE_PLAYER_GRAVITY, "disable gravity" },
+
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_action_mode[] =
+{
+ { CA_MODE_UNDEFINED, " " },
+ { CA_MODE_ADD, "+" },
+ { CA_MODE_SUBTRACT, "-" },
+ { CA_MODE_MULTIPLY, "*" },
+ { CA_MODE_DIVIDE, "/" },
+ { CA_MODE_SET, "=" },
+
+ { -1, NULL }
+};
+
+static struct ValueTextInfo options_change_action_arg[] =
+{
+ { CA_ARG_PLAYER_HEADLINE, "[players]" },
+ { CA_ARG_PLAYER_1, "1" },
+ { CA_ARG_PLAYER_2, "2" },
+ { CA_ARG_PLAYER_3, "3" },
+ { CA_ARG_PLAYER_4, "4" },
+ { CA_ARG_PLAYER_ANY, "any" },
+ { CA_ARG_PLAYER_TRIGGER, "trigger" },
+ { CA_ARG_UNDEFINED, " " },
+ { CA_ARG_NUMBER_HEADLINE, "[numbers]" },
+ { CA_ARG_0, "0" },
+ { CA_ARG_1, "1" },
+ { CA_ARG_2, "2" },
+ { CA_ARG_3, "3" },
+ { CA_ARG_4, "4" },
+ { CA_ARG_5, "5" },
+ { CA_ARG_6, "6" },
+ { CA_ARG_7, "7" },
+ { CA_ARG_8, "8" },
+ { CA_ARG_9, "9" },
+ { CA_ARG_10, "10" },
+ { CA_ARG_20, "20" },
+ { CA_ARG_25, "25" },
+ { CA_ARG_50, "50" },
+ { CA_ARG_100, "100" },
+ { CA_ARG_1000, "1000" },
+ { CA_ARG_UNDEFINED, " " },
+ { CA_ARG_NUMBER_MIN, "min" },
+ { CA_ARG_NUMBER_MAX, "max" },
+ { CA_ARG_NUMBER_NORMAL, "normal" },
+ { CA_ARG_NUMBER_RESET, "reset" },
+ { CA_ARG_NUMBER_COUNT, "counter" },
+
+ { -1, NULL }
+};
+
static char options_change_page_strings[MAX_CHANGE_PAGES][10];
static struct ValueTextInfo options_change_page[MAX_CHANGE_PAGES + 1] =
{
&custom_element_change.replace_when,
"replace when", NULL, "which elements can be replaced"
},
+ {
+ ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(13),
+ GADGET_ID_CHANGE_ACTION, GADGET_ID_NONE,
+ -1,
+ options_change_action,
+ &custom_element_change.change_action,
+ NULL, NULL, "action on specified condition"
+ },
+ {
+ -1, ED_ELEMENT_SETTINGS_YPOS(13),
+ GADGET_ID_CHANGE_ACTION_MODE, GADGET_ID_CHANGE_ACTION,
+ -1,
+ options_change_action_mode,
+ &custom_element_change.change_action_mode,
+ NULL, NULL, "action operator"
+ },
+ {
+ -1, ED_ELEMENT_SETTINGS_YPOS(13),
+ GADGET_ID_CHANGE_ACTION_ARG, GADGET_ID_CHANGE_ACTION_MODE,
+ -1,
+ options_change_action_arg,
+ &custom_element_change.change_action_arg,
+ NULL, NULL, "action parameter"
+ },
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(14),
GADGET_ID_SELECT_CHANGE_PAGE, GADGET_ID_NONE,
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
GADGET_ID_CUSTOM_CAN_CHANGE, GADGET_ID_NONE,
&custom_element_change.can_change,
- NULL, "element changes to:", "element can change to other element"
+ NULL, "element changes to:", "change element on specified condition"
},
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
&custom_element_change.use_random_replace,
NULL, NULL, "use percentage for random replace"
},
+ {
+ ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(13),
+ GADGET_ID_CHANGE_USE_ACTION, GADGET_ID_NONE,
+ &custom_element_change.use_change_action,
+ NULL, NULL, "execute action on specified condition"
+ },
};
static struct
static int new_element2 = EL_EMPTY;
static int new_element3 = EL_SAND;
+#define IS_VALID_BUTTON(button) (button >= 1 && button <= 3)
#define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
(button) == 2 ? new_element2 : \
(button) == 3 ? new_element3 : EL_EMPTY)
if (!started_inside_drawing_area)
return;
+#if 1
+ if (!IS_VALID_BUTTON(button) && !button_release_event)
+ return;
+#else
if (!button && !button_release_event)
return;
+#endif
/* automatically switch to 'single item' drawing mode, if needed */
actual_drawing_function =
int new_element = BUTTON_ELEMENT(button);
int x, y;
+#if 0
+ /* MAKES PROBLEMS WITH ELEMENT LIST SCROLLBAR AND IS PROBABLY NOT NEEDED */
+ /* !!! CHECK WHAT HAPPENS WHEN MOUSE WHEEL IS USED OVER ELEMENT LIST !!! */
+
+ if (!IS_VALID_BUTTON(button))
+ return;
+#endif
+
if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT)
DrawLevelText(0, 0, 0, TEXT_END);
#define CH_PLAYER_2 (1 << 1)
#define CH_PLAYER_3 (1 << 2)
#define CH_PLAYER_4 (1 << 3)
-#define CH_PLAYER_ANY (CH_PLAYER_1 | CH_PLAYER_2 | CH_PLAYER_3 | \
+#define CH_PLAYER_ANY (CH_PLAYER_1 | \
+ CH_PLAYER_2 | \
+ CH_PLAYER_3 | \
CH_PLAYER_4)
+#define CH_PLAYER_TRIGGER (1 << 4)
/* values for change page for custom elements */
#define CH_PAGE_ANY_FILE (0xff)
#define CP_WHEN_REMOVABLE 4
#define CP_WHEN_WALKABLE 5
+/* values for change actions for custom elements */
+#define CA_NO_ACTION 0
+#define CA_EXIT_PLAYER 1
+#define CA_KILL_PLAYER 2
+#define CA_RESTART_LEVEL 3
+#define CA_SHOW_ENVELOPE 4
+#define CA_ADD_KEY 5
+#define CA_DEL_KEY 6
+#define CA_SET_PLAYER_SPEED 7
+#define CA_SET_GEMS 8
+#define CA_SET_SCORE 9
+#define CA_SET_TIME 10
+#define CA_SET_COUNTER 11
+#define CA_SET_DYNABOMB_NUMBER 12
+#define CA_SET_DYNABOMB_SIZE 13
+#define CA_SET_DYNABOMB_POWER 14
+#define CA_TOGGLE_PLAYER_GRAVITY 15
+#define CA_ENABLE_PLAYER_GRAVITY 16
+#define CA_DISABLE_PLAYER_GRAVITY 17
+
+/* values for change action mode for custom elements */
+#define CA_MODE_UNDEFINED 0
+#define CA_MODE_ADD 1
+#define CA_MODE_SUBTRACT 2
+#define CA_MODE_MULTIPLY 3
+#define CA_MODE_DIVIDE 4
+#define CA_MODE_SET 5
+
+/* values for change action parameters for custom elements */
+#define CA_ARG_0 0
+#define CA_ARG_1 1
+#define CA_ARG_2 2
+#define CA_ARG_3 3
+#define CA_ARG_4 4
+#define CA_ARG_5 5
+#define CA_ARG_6 6
+#define CA_ARG_7 7
+#define CA_ARG_8 8
+#define CA_ARG_9 9
+#define CA_ARG_10 10
+#define CA_ARG_20 20
+#define CA_ARG_25 25
+#define CA_ARG_50 50
+#define CA_ARG_100 100
+#define CA_ARG_1000 1000
+#define CA_ARG_PLAYER 20000
+#define CA_ARG_PLAYER_HEADLINE (CA_ARG_PLAYER + 0)
+#define CA_ARG_PLAYER_1 (CA_ARG_PLAYER + CH_PLAYER_1)
+#define CA_ARG_PLAYER_2 (CA_ARG_PLAYER + CH_PLAYER_2)
+#define CA_ARG_PLAYER_3 (CA_ARG_PLAYER + CH_PLAYER_3)
+#define CA_ARG_PLAYER_4 (CA_ARG_PLAYER + CH_PLAYER_4)
+#define CA_ARG_PLAYER_ANY (CA_ARG_PLAYER + CH_PLAYER_ANY)
+#define CA_ARG_PLAYER_TRIGGER (CA_ARG_PLAYER + CH_PLAYER_TRIGGER)
+#define CA_ARG_NUMBER 30000
+#define CA_ARG_NUMBER_HEADLINE (CA_ARG_NUMBER + 0)
+#define CA_ARG_NUMBER_MIN (CA_ARG_NUMBER + 1)
+#define CA_ARG_NUMBER_MAX (CA_ARG_NUMBER + 2)
+#define CA_ARG_NUMBER_NORMAL (CA_ARG_NUMBER + 3)
+#define CA_ARG_NUMBER_RESET (CA_ARG_NUMBER + 4)
+#define CA_ARG_NUMBER_COUNT (CA_ARG_NUMBER + 5)
+#define CA_ARG_UNDEFINED 30999
+
/* values for custom move patterns (bits 0 - 3: basic move directions) */
#define MV_BIT_TOWARDS_PLAYER 4
#define MV_BIT_AWAY_FROM_PLAYER 5
boolean explode; /* explode instead of change */
+ boolean use_change_action; /* execute change action after change */
+ int change_action; /* type of change action after change */
+ int change_action_mode; /* mode of change action after change */
+ int change_action_arg; /* parameter of change action after change */
+
/* ---------- internal values used at runtime when playing ---------- */
/* functions that are called before, while and after the change of an
int explosion_delay; /* duration of explosion of this element */
int ignition_delay; /* delay for explosion by other explosion */
+ int counter_initial; /* initial value of generic CE counter */
+
struct ElementChangeInfo *change_page; /* actual list of change pages */
struct ElementChangeInfo *change; /* pointer to current change page */
boolean can_leave_element_last;
#endif
+ int counter; /* current value of generic CE counter */
+
/* ---------- internal values used in level editor ---------- */
int access_type; /* walkable or passable */