From: Holger Schemel Date: Sun, 29 Jun 2003 15:40:47 +0000 (+0200) Subject: rnd-20030629-2-src X-Git-Tag: 3.0.0^2~34 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=12a224578d49391c7c4c27ad898059ae17e9b880;p=rocksndiamonds.git rnd-20030629-2-src --- diff --git a/src/conftime.h b/src/conftime.h index f4750822..aca25e24 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-06-28 19:51]" +#define COMPILE_DATE_STRING "[2003-06-29 17:38]" diff --git a/src/editor.c b/src/editor.c index bfec772d..d4b4102a 100644 --- a/src/editor.c +++ b/src/editor.c @@ -119,7 +119,7 @@ ED_GADGET_DISTANCE) /* custom element content */ #define ED_AREA_ELEM_CONTENT4_XPOS (29 * MINI_TILEX) -#define ED_AREA_ELEM_CONTENT4_YPOS (ED_SETTINGS_YPOS(2) + \ +#define ED_AREA_ELEM_CONTENT4_YPOS (ED_SETTINGS_YPOS(12) + \ ED_GADGET_DISTANCE - MINI_TILEY) /* custom change trigger element */ #define ED_AREA_ELEM_CONTENT5_XPOS (30 * MINI_TILEX + MINI_TILEX / 2) @@ -308,30 +308,33 @@ #define GADGET_ID_ELEMENT_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 24) #define GADGET_ID_ELEMENT_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 25) #define GADGET_ID_ELEMENT_CONTENT_UP (GADGET_ID_COUNTER_FIRST + 26) -#define GADGET_ID_CUSTOM_SCORE_DOWN (GADGET_ID_COUNTER_FIRST + 27) -#define GADGET_ID_CUSTOM_SCORE_TEXT (GADGET_ID_COUNTER_FIRST + 28) -#define GADGET_ID_CUSTOM_SCORE_UP (GADGET_ID_COUNTER_FIRST + 29) -#define GADGET_ID_PUSH_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 30) -#define GADGET_ID_PUSH_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 31) -#define GADGET_ID_PUSH_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 32) -#define GADGET_ID_PUSH_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 33) -#define GADGET_ID_PUSH_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 34) -#define GADGET_ID_PUSH_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 35) -#define GADGET_ID_MOVE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 36) -#define GADGET_ID_MOVE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 37) -#define GADGET_ID_MOVE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 38) -#define GADGET_ID_MOVE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 39) -#define GADGET_ID_MOVE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 40) -#define GADGET_ID_MOVE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 41) -#define GADGET_ID_CHANGE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 42) -#define GADGET_ID_CHANGE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 43) -#define GADGET_ID_CHANGE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 44) -#define GADGET_ID_CHANGE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 45) -#define GADGET_ID_CHANGE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 46) -#define GADGET_ID_CHANGE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 47) +#define GADGET_ID_COLLECT_SCORE_DOWN (GADGET_ID_COUNTER_FIRST + 27) +#define GADGET_ID_COLLECT_SCORE_TEXT (GADGET_ID_COUNTER_FIRST + 28) +#define GADGET_ID_COLLECT_SCORE_UP (GADGET_ID_COUNTER_FIRST + 29) +#define GADGET_ID_COLLECT_GEMCOUNT_DOWN (GADGET_ID_COUNTER_FIRST + 30) +#define GADGET_ID_COLLECT_GEMCOUNT_TEXT (GADGET_ID_COUNTER_FIRST + 31) +#define GADGET_ID_COLLECT_GEMCOUNT_UP (GADGET_ID_COUNTER_FIRST + 32) +#define GADGET_ID_PUSH_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 33) +#define GADGET_ID_PUSH_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 34) +#define GADGET_ID_PUSH_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 35) +#define GADGET_ID_PUSH_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 36) +#define GADGET_ID_PUSH_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 37) +#define GADGET_ID_PUSH_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 38) +#define GADGET_ID_MOVE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 39) +#define GADGET_ID_MOVE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 40) +#define GADGET_ID_MOVE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 41) +#define GADGET_ID_MOVE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 42) +#define GADGET_ID_MOVE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 43) +#define GADGET_ID_MOVE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 44) +#define GADGET_ID_CHANGE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 45) +#define GADGET_ID_CHANGE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 46) +#define GADGET_ID_CHANGE_DELAY_FIX_UP (GADGET_ID_COUNTER_FIRST + 47) +#define GADGET_ID_CHANGE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 48) +#define GADGET_ID_CHANGE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 49) +#define GADGET_ID_CHANGE_DELAY_RND_UP (GADGET_ID_COUNTER_FIRST + 50) /* drawing area identifiers */ -#define GADGET_ID_DRAWING_AREA_FIRST (GADGET_ID_COUNTER_FIRST + 48) +#define GADGET_ID_DRAWING_AREA_FIRST (GADGET_ID_COUNTER_FIRST + 51) #define GADGET_ID_DRAWING_LEVEL (GADGET_ID_DRAWING_AREA_FIRST + 0) #define GADGET_ID_ELEMENT_CONTENT_0 (GADGET_ID_DRAWING_AREA_FIRST + 1) @@ -365,14 +368,15 @@ #define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 4) #define GADGET_ID_CUSTOM_MOVE_STEPSIZE (GADGET_ID_SELECTBOX_FIRST + 5) #define GADGET_ID_CUSTOM_SMASH_TARGETS (GADGET_ID_SELECTBOX_FIRST + 6) -#define GADGET_ID_CUSTOM_WALKABLE_LAYER (GADGET_ID_SELECTBOX_FIRST + 7) -#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 8) -#define GADGET_ID_CHANGE_PLAYER_ACTION (GADGET_ID_SELECTBOX_FIRST + 9) -#define GADGET_ID_CHANGE_IMPACT_ACTION (GADGET_ID_SELECTBOX_FIRST + 10) -#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 11) +#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 7) +#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 8) +#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 9) +#define GADGET_ID_CHANGE_PLAYER_ACTION (GADGET_ID_SELECTBOX_FIRST + 10) +#define GADGET_ID_CHANGE_IMPACT_ACTION (GADGET_ID_SELECTBOX_FIRST + 11) +#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 12) /* textbutton identifiers */ -#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 12) +#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 13) #define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0) #define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1) @@ -416,7 +420,7 @@ #define GADGET_ID_CUSTOM_CAN_FALL (GADGET_ID_CHECKBUTTON_FIRST + 14) #define GADGET_ID_CUSTOM_CAN_SMASH (GADGET_ID_CHECKBUTTON_FIRST + 15) #define GADGET_ID_CUSTOM_SLIPPERY (GADGET_ID_CHECKBUTTON_FIRST + 16) -#define GADGET_ID_CUSTOM_WALKABLE (GADGET_ID_CHECKBUTTON_FIRST + 17) +#define GADGET_ID_CUSTOM_ACCESSIBLE (GADGET_ID_CHECKBUTTON_FIRST + 17) #define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 18) #define GADGET_ID_CUSTOM_USE_TEMPLATE (GADGET_ID_CHECKBUTTON_FIRST + 19) #define GADGET_ID_CUSTOM_CAN_CHANGE (GADGET_ID_CHECKBUTTON_FIRST + 20) @@ -447,20 +451,21 @@ #define ED_COUNTER_ID_LEVEL_RANDOM 6 #define ED_COUNTER_ID_ELEMENT_SCORE 7 #define ED_COUNTER_ID_ELEMENT_CONTENT 8 -#define ED_COUNTER_ID_CUSTOM_SCORE 9 -#define ED_COUNTER_ID_PUSH_DELAY_FIX 10 -#define ED_COUNTER_ID_PUSH_DELAY_RND 11 -#define ED_COUNTER_ID_MOVE_DELAY_FIX 12 -#define ED_COUNTER_ID_MOVE_DELAY_RND 13 -#define ED_COUNTER_ID_CHANGE_DELAY_FIX 14 -#define ED_COUNTER_ID_CHANGE_DELAY_RND 15 +#define ED_COUNTER_ID_COLLECT_SCORE 9 +#define ED_COUNTER_ID_COLLECT_GEMCOUNT 10 +#define ED_COUNTER_ID_PUSH_DELAY_FIX 11 +#define ED_COUNTER_ID_PUSH_DELAY_RND 12 +#define ED_COUNTER_ID_MOVE_DELAY_FIX 13 +#define ED_COUNTER_ID_MOVE_DELAY_RND 14 +#define ED_COUNTER_ID_CHANGE_DELAY_FIX 15 +#define ED_COUNTER_ID_CHANGE_DELAY_RND 16 -#define ED_NUM_COUNTERBUTTONS 16 +#define ED_NUM_COUNTERBUTTONS 17 #define ED_COUNTER_ID_LEVEL_FIRST ED_COUNTER_ID_LEVEL_XSIZE #define ED_COUNTER_ID_LEVEL_LAST ED_COUNTER_ID_LEVEL_RANDOM -#define ED_COUNTER_ID_CUSTOM_FIRST ED_COUNTER_ID_CUSTOM_SCORE +#define ED_COUNTER_ID_CUSTOM_FIRST ED_COUNTER_ID_COLLECT_SCORE #define ED_COUNTER_ID_CUSTOM_LAST ED_COUNTER_ID_MOVE_DELAY_RND #define ED_COUNTER_ID_CHANGE_FIRST ED_COUNTER_ID_CHANGE_DELAY_FIX @@ -506,16 +511,17 @@ #define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION 4 #define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE 5 #define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 6 -#define ED_SELECTBOX_ID_CUSTOM_WALKABLE_LAYER 7 -#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 8 -#define ED_SELECTBOX_ID_CHANGE_PLAYER_ACTION 9 -#define ED_SELECTBOX_ID_CHANGE_IMPACT_ACTION 10 -#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 11 +#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 7 +#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 8 +#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 9 +#define ED_SELECTBOX_ID_CHANGE_PLAYER_ACTION 10 +#define ED_SELECTBOX_ID_CHANGE_IMPACT_ACTION 11 +#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 12 -#define ED_NUM_SELECTBOX 12 +#define ED_NUM_SELECTBOX 13 #define ED_SELECTBOX_ID_CUSTOM_FIRST ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION -#define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM_WALKABLE_LAYER +#define ED_SELECTBOX_ID_CUSTOM_LAST ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER #define ED_SELECTBOX_ID_CHANGE_FIRST ED_SELECTBOX_ID_CHANGE_TIME_UNITS #define ED_SELECTBOX_ID_CHANGE_LAST ED_SELECTBOX_ID_CHANGE_OTHER_ACTION @@ -544,7 +550,7 @@ #define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL 12 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH 13 #define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY 14 -#define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE 15 +#define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE 15 #define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 16 #define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE 17 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE 18 @@ -559,7 +565,7 @@ #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED #define ED_CHECKBUTTON_ID_CUSTOM_FIRST ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_RESULT -#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM_WALKABLE +#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE #define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC #define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_BY_OTHER @@ -608,6 +614,10 @@ #define MIN_SCORE 0 #define MAX_SCORE 255 +/* values for elements with gem count */ +#define MIN_GEM_COUNT 0 +#define MAX_GEM_COUNT 100 + /* values for random placement */ #define RANDOM_USE_PERCENTAGE 0 #define RANDOM_USE_QUANTITY 1 @@ -672,6 +682,8 @@ static struct char *text_above, *text_left, *text_right; } counterbutton_info[ED_NUM_COUNTERBUTTONS] = { + /* ---------- level and editor settings ---------------------------------- */ + { DX + 5 - SX, DY + 3 - SY, 1, 100, @@ -728,6 +740,9 @@ static struct &random_placement_value, "random element placement", NULL, "in" }, + + /* ---------- element settings: configure (various elements) ------------- */ + { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(0), MIN_SCORE, MAX_SCORE, @@ -744,16 +759,27 @@ static struct &level.num_yamyam_contents, NULL, NULL, "number of content areas" }, + + /* ---------- element settings: configure (custom elements) ------------- */ + { - ED_SETTINGS_XPOS(9), ED_SETTINGS_YPOS(4), + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(3), MIN_SCORE, MAX_SCORE, - GADGET_ID_CUSTOM_SCORE_DOWN, GADGET_ID_CUSTOM_SCORE_UP, - GADGET_ID_CUSTOM_SCORE_TEXT, - &custom_element.score, - NULL, "score", NULL + GADGET_ID_COLLECT_SCORE_DOWN, GADGET_ID_COLLECT_SCORE_UP, + GADGET_ID_COLLECT_SCORE_TEXT, + &custom_element.collect_score, + NULL, "collect score", NULL }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(5), + ED_SETTINGS_XPOS(13) + 10, ED_SETTINGS_YPOS(3), + MIN_GEM_COUNT, MAX_GEM_COUNT, + GADGET_ID_COLLECT_GEMCOUNT_DOWN, GADGET_ID_COLLECT_GEMCOUNT_UP, + GADGET_ID_COLLECT_GEMCOUNT_TEXT, + &custom_element.collect_gem_count, + NULL, "gems", NULL + }, + { + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4), 0, 999, GADGET_ID_PUSH_DELAY_FIX_DOWN, GADGET_ID_PUSH_DELAY_FIX_UP, GADGET_ID_PUSH_DELAY_FIX_TEXT, @@ -761,7 +787,7 @@ static struct NULL, "push delay", NULL }, { - ED_COUNT_PUSH_DELAY_RND_XPOS, ED_SETTINGS_YPOS(5), + ED_COUNT_PUSH_DELAY_RND_XPOS, ED_SETTINGS_YPOS(4), 0, 999, GADGET_ID_PUSH_DELAY_RND_DOWN, GADGET_ID_PUSH_DELAY_RND_UP, GADGET_ID_PUSH_DELAY_RND_TEXT, @@ -769,7 +795,7 @@ static struct NULL, "+random", NULL }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8), + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(7), 0, 999, GADGET_ID_MOVE_DELAY_FIX_DOWN, GADGET_ID_MOVE_DELAY_FIX_UP, GADGET_ID_MOVE_DELAY_FIX_TEXT, @@ -777,13 +803,16 @@ static struct NULL, "move delay", NULL }, { - ED_COUNT_MOVE_DELAY_RND_XPOS, ED_SETTINGS_YPOS(8), + ED_COUNT_MOVE_DELAY_RND_XPOS, ED_SETTINGS_YPOS(7), 0, 999, GADGET_ID_MOVE_DELAY_RND_DOWN, GADGET_ID_MOVE_DELAY_RND_UP, GADGET_ID_MOVE_DELAY_RND_TEXT, &custom_element.move_delay_random, NULL, "+random", NULL }, + + /* ---------- element settings: advanced (custom elements) --------------- */ + { ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(3), 0, 999, @@ -900,14 +929,22 @@ static struct ValueTextInfo options_smash_targets[] = }; static int value_smash_targets = 0; -static struct ValueTextInfo options_walkable_layer[] = +static struct ValueTextInfo options_access_type[] = { - { EP_WALKABLE_OVER, "over" }, - { EP_WALKABLE_INSIDE, "inside" }, - { EP_WALKABLE_UNDER, "under" }, + { EP_WALKABLE, "walk" }, + { EP_PASSABLE, "pass" }, { -1, NULL } }; -static int value_walkable_layer = 0; +static int value_access_type = 0; + +static struct ValueTextInfo options_access_layer[] = +{ + { EP_ACCESSIBLE_OVER, "over" }, + { EP_ACCESSIBLE_INSIDE, "inside" }, + { EP_ACCESSIBLE_UNDER, "under" }, + { -1, NULL } +}; +static int value_access_layer = 0; static struct ValueTextInfo options_time_units[] = { @@ -953,32 +990,34 @@ static struct char *text_left, *text_right, *infotext; } selectbox_info[ED_NUM_SELECTBOX] = { + /* ---------- element settings: configure (custom elements) ------------- */ + { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(4), - GADGET_ID_CUSTOM_WALK_TO_ACTION, + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(1), + GADGET_ID_CUSTOM_ACCESS_TYPE, -1, - options_walk_to_action, - &value_walk_to_action, - NULL, NULL, "diggable/collectible/pushable" + options_access_type, + &value_access_type, + "player can", NULL, "type of access to this field" }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(2), - GADGET_ID_CUSTOM_CONSISTENCY, + ED_SETTINGS_XPOS(11), ED_SETTINGS_YPOS(1), + GADGET_ID_CUSTOM_ACCESS_LAYER, -1, - options_consistency, - &value_consistency, - NULL, "explodes to:", "consistency/destructibility" + options_access_layer, + &value_access_layer, + NULL, NULL, "layer of access for this field" }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(1), - GADGET_ID_CUSTOM_DEADLINESS, + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(2), + GADGET_ID_CUSTOM_WALK_TO_ACTION, -1, - options_deadliness, - &value_deadliness, - "deadly when", NULL, "deadliness of element" + options_walk_to_action, + &value_walk_to_action, + NULL, NULL, "diggable/collectible/pushable" }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(6), + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(5), GADGET_ID_CUSTOM_MOVE_PATTERN, -1, options_move_pattern, @@ -986,7 +1025,7 @@ static struct "can move", NULL, "element move direction" }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(7), + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(6), GADGET_ID_CUSTOM_MOVE_DIRECTION, -1, options_move_direction, @@ -994,29 +1033,40 @@ static struct "starts moving", NULL, "initial element move direction" }, { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(9), + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(8), GADGET_ID_CUSTOM_MOVE_STEPSIZE, -1, options_move_stepsize, &custom_element.move_stepsize, - "move speed", NULL, "speed of element movement" + "move/fall speed", NULL, "speed of element movement" }, { - ED_SETTINGS_XPOS(7), ED_SETTINGS_YPOS(10), + ED_SETTINGS_XPOS(7), ED_SETTINGS_YPOS(9), GADGET_ID_CUSTOM_SMASH_TARGETS, -1, options_smash_targets, &value_smash_targets, "can smash", NULL, "elements that can be smashed" }, + { + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(11), + GADGET_ID_CUSTOM_DEADLINESS, + -1, + options_deadliness, + &value_deadliness, + "deadly when", NULL, "deadliness of element" + }, { ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(12), - GADGET_ID_CUSTOM_WALKABLE_LAYER, + GADGET_ID_CUSTOM_CONSISTENCY, -1, - options_walkable_layer, - &value_walkable_layer, - "player can walk", NULL, "layer where player can walk" + options_consistency, + &value_consistency, + NULL, "explodes to:", "consistency/destructibility" }, + + /* ---------- element settings: advanced (custom elements) --------------- */ + { ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(4), GADGET_ID_CHANGE_TIME_UNITS, @@ -1197,6 +1247,8 @@ static struct char *text_right, *infotext; } checkbutton_info[ED_NUM_CHECKBUTTONS] = { + /* ---------- level and editor settings ---------------------------------- */ + { ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(6) - MINI_TILEY, GADGET_ID_DOUBLE_SPEED, @@ -1215,6 +1267,9 @@ static struct &random_placement_background_restricted, "restrict random placement to", "set random placement restriction" }, + + /* ---------- element settings: configure (various elements) ------------- */ + { ED_SETTINGS_XPOS(0), 0, /* set at runtime */ GADGET_ID_STICK_ELEMENT, @@ -1227,84 +1282,84 @@ static struct &level.em_slippery_gems, "slip down from certain flat walls","use EM style slipping behaviour" }, + + /* ---------- element settings: configure (custom elements) ------------- */ + { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2), - GADGET_ID_CUSTOM_EXPLODE_RESULT, - &custom_element_properties[EP_EXPLODE_RESULT], - NULL, "set consistency/destructibility" - }, - { - ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(3), - GADGET_ID_CUSTOM_EXPLODE_FIRE, - &custom_element_properties[EP_CAN_EXPLODE_BY_FIRE], - "by fire", "element can explode by fire/explosion" - }, - { - ED_SETTINGS_XPOS(7), ED_SETTINGS_YPOS(3), - GADGET_ID_CUSTOM_EXPLODE_SMASH, - &custom_element_properties[EP_CAN_EXPLODE_SMASHED], - "smashed", "element can explode when smashed" - }, - { - ED_SETTINGS_XPOS(13), ED_SETTINGS_YPOS(3), - GADGET_ID_CUSTOM_EXPLODE_IMPACT, - &custom_element_properties[EP_CAN_EXPLODE_IMPACT], - "impact", "element can explode on impact" + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1), + GADGET_ID_CUSTOM_ACCESSIBLE, + &custom_element_properties[EP_ACCESSIBLE], + NULL, "player can walk to or pass this field" }, { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(4), + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2), GADGET_ID_CUSTOM_WALK_TO_OBJECT, &custom_element_properties[EP_WALK_TO_OBJECT], NULL, "player can dig/collect/push element" }, { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1), - GADGET_ID_CUSTOM_DEADLY, - &custom_element_properties[EP_DEADLY], - NULL, "element can kill the player" - }, - { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(6), + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(5), GADGET_ID_CUSTOM_CAN_MOVE, &custom_element_properties[EP_CAN_MOVE], NULL, "element can move in some direction" }, { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(10), + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(9), GADGET_ID_CUSTOM_CAN_FALL, &custom_element_properties[EP_CAN_FALL], "can fall", "element can fall down" }, { - ED_SETTINGS_XPOS(6), ED_SETTINGS_YPOS(10), + ED_SETTINGS_XPOS(6), ED_SETTINGS_YPOS(9), GADGET_ID_CUSTOM_CAN_SMASH, &custom_element_properties[EP_CAN_SMASH], NULL, "element can smash other elements" }, { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(11), + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(10), GADGET_ID_CUSTOM_SLIPPERY, &custom_element_properties[EP_SLIPPERY], "slippery", "other elements can fall down from it" }, + { + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(11), + GADGET_ID_CUSTOM_DEADLY, + &custom_element_properties[EP_DEADLY], + NULL, "element can kill the player" + }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(12), - GADGET_ID_CUSTOM_WALKABLE, - &custom_element_properties[EP_WALKABLE], - NULL, "player can walk on the same field" + GADGET_ID_CUSTOM_EXPLODE_RESULT, + &custom_element_properties[EP_EXPLODE_RESULT], + NULL, "set consistency/destructibility" + }, + { + ED_SETTINGS_XPOS(1), ED_SETTINGS_YPOS(13), + GADGET_ID_CUSTOM_EXPLODE_FIRE, + &custom_element_properties[EP_CAN_EXPLODE_BY_FIRE], + "by fire", "element can explode by fire/explosion" + }, + { + ED_SETTINGS_XPOS(7), ED_SETTINGS_YPOS(13), + GADGET_ID_CUSTOM_EXPLODE_SMASH, + &custom_element_properties[EP_CAN_EXPLODE_SMASHED], + "smashed", "element can explode when smashed" + }, + { + ED_SETTINGS_XPOS(13), ED_SETTINGS_YPOS(13), + GADGET_ID_CUSTOM_EXPLODE_IMPACT, + &custom_element_properties[EP_CAN_EXPLODE_IMPACT], + "impact", "element can explode on impact" }, + + /* ---------- element settings: advanced (custom elements) --------------- */ + { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1), GADGET_ID_CUSTOM_USE_GRAPHIC, &custom_element.use_gfx_element, "use graphic of element:", "use graphic for custom element" }, - { - ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(12), - GADGET_ID_CUSTOM_USE_TEMPLATE, - &custom_element.use_template, - "use template", "use template for custom properties" - }, { ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2), GADGET_ID_CUSTOM_CAN_CHANGE, @@ -1335,6 +1390,12 @@ static struct &custom_element_change_events[CE_BY_OTHER], NULL, "element changes by other element" }, + { + ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(12), + GADGET_ID_CUSTOM_USE_TEMPLATE, + &custom_element.use_template, + "use template", "use template for custom properties" + }, }; @@ -3511,16 +3572,20 @@ static void CopyCustomElementPropertiesToEditor(int element) CAN_SMASH_ENEMIES(element) || CAN_SMASH_PLAYER(element)); - /* set walkable layer selectbox help value */ - value_walkable_layer = - (IS_WALKABLE_OVER(element) ? EP_WALKABLE_OVER : - IS_WALKABLE_INSIDE(element) ? EP_WALKABLE_INSIDE : - IS_WALKABLE_UNDER(element) ? EP_WALKABLE_UNDER : - EP_WALKABLE_OVER); - custom_element_properties[EP_WALKABLE] = - (IS_WALKABLE_OVER(element) || - IS_WALKABLE_INSIDE(element) || - IS_WALKABLE_UNDER(element)); + /* set accessible layer selectbox help value */ + value_access_type = + (IS_WALKABLE(element) ? EP_WALKABLE : + IS_PASSABLE(element) ? EP_PASSABLE : + EP_WALKABLE); + value_access_layer = + (IS_ACCESSIBLE_OVER(element) ? EP_ACCESSIBLE_OVER : + IS_ACCESSIBLE_INSIDE(element) ? EP_ACCESSIBLE_INSIDE : + IS_ACCESSIBLE_UNDER(element) ? EP_ACCESSIBLE_UNDER : + EP_ACCESSIBLE_OVER); + custom_element_properties[EP_ACCESSIBLE] = + (IS_ACCESSIBLE_OVER(element) || + IS_ACCESSIBLE_INSIDE(element) || + IS_ACCESSIBLE_UNDER(element)); /* set change by player selectbox help value */ value_change_player_action = @@ -3577,12 +3642,17 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[value_smash_targets] = custom_element_properties[EP_CAN_SMASH]; - /* set walkable property from checkbox and selectbox */ + /* set accessible property from checkbox and selectbox */ custom_element_properties[EP_WALKABLE_OVER] = FALSE; custom_element_properties[EP_WALKABLE_INSIDE] = FALSE; custom_element_properties[EP_WALKABLE_UNDER] = FALSE; - custom_element_properties[value_walkable_layer] = - custom_element_properties[EP_WALKABLE]; + custom_element_properties[EP_PASSABLE_OVER] = FALSE; + custom_element_properties[EP_PASSABLE_INSIDE] = FALSE; + custom_element_properties[EP_PASSABLE_UNDER] = FALSE; + custom_element_properties[((value_access_type == EP_WALKABLE ? + EP_WALKABLE_OVER : EP_PASSABLE_OVER) + + (value_access_layer - EP_ACCESSIBLE_OVER))] = + custom_element_properties[EP_ACCESSIBLE]; /* set player change event from checkbox and selectbox */ custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE; @@ -5394,6 +5464,10 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) (draw_level || drawing_function == GADGET_ID_PICK_ELEMENT ? drawing_function : GADGET_ID_SINGLE_ITEMS); + /* clicking into drawing area with pressed Control key picks element */ + if (GetKeyModState() & KMOD_Control) + actual_drawing_function = GADGET_ID_PICK_ELEMENT; + switch (actual_drawing_function) { case GADGET_ID_SINGLE_ITEMS: @@ -5743,7 +5817,8 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (id < ED_NUM_CTRL1_BUTTONS && id != GADGET_ID_PROPERTIES && id != GADGET_ID_PICK_ELEMENT && edit_mode != ED_MODE_DRAWING && - drawing_function != GADGET_ID_PICK_ELEMENT) + drawing_function != GADGET_ID_PICK_ELEMENT && + !(GetKeyModState() & KMOD_Control)) { DrawDrawingWindow(); edit_mode = ED_MODE_DRAWING; @@ -6024,7 +6099,8 @@ static void HandleControlButtons(struct GadgetInfo *gi) PickDrawingElement(button, new_element); if (!stick_element_properties_window && - drawing_function != GADGET_ID_PICK_ELEMENT) + drawing_function != GADGET_ID_PICK_ELEMENT && + !(GetKeyModState() & KMOD_Control)) { properties_element = new_element; if (edit_mode == ED_MODE_PROPERTIES) @@ -6184,7 +6260,9 @@ void HandleEditorGadgetInfoText(void *ptr) { if (gi->custom_id == GADGET_ID_SINGLE_ITEMS) /* special case 1 */ sprintf(shortcut, " ('.' or '%c')", key); - else if (gi->custom_id == GADGET_ID_TEST) /* special case 2 */ + else if (gi->custom_id == GADGET_ID_PICK_ELEMENT) /* special case 2 */ + sprintf(shortcut, " ('%c' or 'Ctrl')", key); + else if (gi->custom_id == GADGET_ID_TEST) /* special case 3 */ sprintf(shortcut, " ('Enter' or 'Shift-%c')", key); else /* normal case */ sprintf(shortcut, " ('%s%c')", @@ -6210,6 +6288,11 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) int min_sx = 0, min_sy = 0; int max_sx = gi->drawing.area_xsize - 1; int max_sy = gi->drawing.area_ysize - 1; + int actual_drawing_function = drawing_function; + + /* pressed Control key: simulate picking element */ + if (GetKeyModState() & KMOD_Control) + actual_drawing_function = GADGET_ID_PICK_ELEMENT; ClearEditorGadgetInfoText(); @@ -6250,7 +6333,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) start_ly = ly; } - switch (drawing_function) + switch (actual_drawing_function) { case GADGET_ID_SINGLE_ITEMS: infotext = "Drawing single items"; @@ -6288,7 +6371,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) break; } - if (drawing_function == GADGET_ID_PICK_ELEMENT) + if (actual_drawing_function == GADGET_ID_PICK_ELEMENT) DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "%s: %d, %d", infotext, lx, ly); else @@ -6296,7 +6379,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) "%s: %d, %d", infotext, ABS(lx - start_lx) + 1, ABS(ly - start_ly) + 1); } - else if (drawing_function == GADGET_ID_PICK_ELEMENT) + else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT) DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, "%s", getElementInfoText(Feld[lx][ly])); else @@ -6313,7 +6396,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) DeleteBrushFromCursor(); } } - else if (drawing_function == GADGET_ID_PICK_ELEMENT) + else if (actual_drawing_function == GADGET_ID_PICK_ELEMENT) { if (id == GADGET_ID_AMOEBA_CONTENT) DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FONT_TEXT_2, diff --git a/src/events.c b/src/events.c index 5dbf4cd6..61bdf6be 100644 --- a/src/events.c +++ b/src/events.c @@ -23,11 +23,6 @@ #include "tape.h" #include "network.h" -/* values for key_status */ -#define KEY_NOT_PRESSED FALSE -#define KEY_RELEASED FALSE -#define KEY_PRESSED TRUE - static boolean cursor_inside_playfield = FALSE; static boolean playfield_cursor_set = FALSE; @@ -311,7 +306,9 @@ void HandleKeyEvent(KeyEvent *event) int key_status = (event->type==EVENT_KEYPRESS ? KEY_PRESSED : KEY_RELEASED); boolean with_modifiers = (game_status == GAME_MODE_PLAYING ? FALSE : TRUE); Key key = GetEventKey(event, with_modifiers); + Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key); + HandleKeyModState(keymod, key_status); HandleKey(key, key_status); } diff --git a/src/game.c b/src/game.c index 745407c9..b51a1873 100644 --- a/src/game.c +++ b/src/game.c @@ -375,7 +375,7 @@ struct int element; int gem_count; } -gem_count_list[] = +collect_gem_count_list[] = { { EL_EMERALD, 1 }, { EL_BD_DIAMOND, 1 }, @@ -392,7 +392,6 @@ gem_count_list[] = static struct ChangingElementInfo changing_element[MAX_NUM_ELEMENTS]; static unsigned long trigger_events[MAX_NUM_ELEMENTS]; -static int gem_count[MAX_NUM_ELEMENTS]; #define IS_AUTO_CHANGING(e) (changing_element[e].base_element != EL_UNDEFINED) #define IS_JUST_CHANGING(x, y) (ChangeDelay[x][y] != 0) @@ -818,11 +817,13 @@ static void InitGameEngine() /* initialize gem count values for each element */ for (i=0; i= VERSION_IDENT(2,2,0)) return MF_NO_ACTION; -#endif switch (element) { -#if 0 - case EL_EMPTY: - PlaySoundLevelElementAction(x, y, player->element_nr, ACTION_MOVING); - break; -#endif - -#if 0 - case EL_SAND: - case EL_INVISIBLE_SAND: - case EL_INVISIBLE_SAND_ACTIVE: - case EL_TRAP: - case EL_SP_BASE: - case EL_SP_BUGGY_BASE: - case EL_SP_BUGGY_BASE_ACTIVATING: - RemoveField(x, y); - - if (mode != DF_SNAP && element != EL_EMPTY) - { - GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : element); - player->is_digging = TRUE; - } - - PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING); - break; -#endif - -#if 0 - - case EL_EMERALD: - case EL_BD_DIAMOND: - case EL_EMERALD_YELLOW: - case EL_EMERALD_RED: - case EL_EMERALD_PURPLE: - case EL_DIAMOND: - case EL_SP_INFOTRON: - case EL_PEARL: - case EL_CRYSTAL: - RemoveField(x, y); - - if (mode != DF_SNAP) - { - GfxElement[x][y] = element; - player->is_collecting = TRUE; - } - - local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 : - element == EL_PEARL ? 5 : - element == EL_CRYSTAL ? 8 : 1); - if (local_player->gems_still_needed < 0) - local_player->gems_still_needed = 0; - RaiseScoreElement(element); - DrawText(DX_EMERALDS, DY_EMERALDS, - int2str(local_player->gems_still_needed, 3), FONT_TEXT_2); - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - -#endif - -#if 0 - - case EL_SPEED_PILL: - RemoveField(x, y); - player->move_delay_value = MOVE_DELAY_HIGH_SPEED; -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_SPEED_PILL_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - -#endif - - -#if 0 - case EL_ENVELOPE: - Feld[x][y] = EL_EMPTY; -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_ENVELOPE_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; -#endif - -#if 0 - - case EL_EXTRA_TIME: - RemoveField(x, y); - if (level.time > 0) - { - TimeLeft += 10; - DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2); - } -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_MIDDLE); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - -#endif - -#if 0 - case EL_SHIELD_NORMAL: - RemoveField(x, y); - player->shield_normal_time_left += 10; -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_SHIELD_NORMAL_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - - case EL_SHIELD_DEADLY: - RemoveField(x, y); - player->shield_normal_time_left += 10; - player->shield_deadly_time_left += 10; -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_SHIELD_DEADLY_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; -#endif - -#if 0 - case EL_DYNAMITE: - case EL_SP_DISK_RED: - RemoveField(x, y); - player->dynamite++; - player->use_disk_red_graphic = (element == EL_SP_DISK_RED); - RaiseScoreElement(EL_DYNAMITE); - DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3), - FONT_TEXT_2); - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; -#endif - -#if 0 - case EL_DYNABOMB_INCREASE_NUMBER: - RemoveField(x, y); - player->dynabomb_count++; - player->dynabombs_left++; - RaiseScoreElement(EL_DYNAMITE); -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_NUMBER_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - - case EL_DYNABOMB_INCREASE_SIZE: - RemoveField(x, y); - player->dynabomb_size++; - RaiseScoreElement(EL_DYNAMITE); -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_SIZE_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - - case EL_DYNABOMB_INCREASE_POWER: - RemoveField(x, y); - player->dynabomb_xl = TRUE; - RaiseScoreElement(EL_DYNAMITE); -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_POWER_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; -#endif - -#if 0 - case EL_KEY_1: - case EL_KEY_2: - case EL_KEY_3: - case EL_KEY_4: - { - int key_nr = element - EL_KEY_1; - int graphic = el2edimg(element); - - RemoveField(x, y); - player->key[key_nr] = TRUE; - RaiseScoreElement(element); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, - graphic); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, - graphic); -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_CLASS_KEY_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - } - - case EL_EM_KEY_1: - case EL_EM_KEY_2: - case EL_EM_KEY_3: - case EL_EM_KEY_4: - { - int key_nr = element - EL_EM_KEY_1; - int graphic = el2edimg(EL_KEY_1 + key_nr); - - RemoveField(x, y); - player->key[key_nr] = TRUE; - RaiseScoreElement(element); - DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, - graphic); - DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS, - graphic); -#if 1 - PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING); -#else - PlaySoundLevel(x, y, SND_CLASS_KEY_COLLECTING); -#endif - CheckTriggeredElementChange(element, CE_OTHER_COLLECTING); - break; - } -#endif - case EL_ROBOT_WHEEL: Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE; ZX = x; @@ -6905,175 +6674,6 @@ int DigField(struct PlayerInfo *player, return MF_ACTION; break; -#if 0 - - /* the following elements cannot be pushed by "snapping" */ - case EL_ROCK: - case EL_BOMB: - case EL_DX_SUPABOMB: - case EL_NUT: - case EL_TIME_ORB_EMPTY: - case EL_SP_ZONK: - case EL_SP_DISK_ORANGE: - case EL_SPRING: - if (mode == DF_SNAP) - return MF_NO_ACTION; - - /* no "break" -- fall through to next case */ - - /* the following elements can be pushed by "snapping" */ - case EL_BD_ROCK: - if (dy) - return MF_NO_ACTION; - - if (CAN_FALL(element) && IN_LEV_FIELD(x, y + 1) && IS_FREE(x, y + 1) && - !(element == EL_SPRING && use_spring_bug)) - return MF_NO_ACTION; - - player->Pushing = TRUE; - -#if 0 - if (element == EL_ROCK) - printf("::: wanna push [%d] [%d]\n", - FrameCounter, player->push_delay_value); -#endif - - if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy)) - return MF_NO_ACTION; - - if (!checkDiagonalPushing(player, x, y, real_dx, real_dy)) - return MF_NO_ACTION; - - - if (player->push_delay == 0) - player->push_delay = FrameCounter; - -#if 0 - printf("want push... %d [%d]\n", FrameCounter, player->push_delay_value); -#endif - -#if 0 - if (!FrameReached(&player->push_delay, player->push_delay_value) && - !tape.playing && - element != EL_SPRING) - return MF_NO_ACTION; -#else - if (!FrameReached(&player->push_delay, player->push_delay_value) && - !(tape.playing && tape.file_version < FILE_VERSION_2_0) && - element != EL_SPRING) - return MF_NO_ACTION; -#endif - - if (mode == DF_SNAP) - { - InitMovingField(x, y, move_direction); - ContinueMoving(x, y); - } - else - { -#if 1 - InitMovingField(x, y, (dx < 0 ? MV_LEFT : - dx > 0 ? MV_RIGHT : - dy < 0 ? MV_UP : MV_DOWN)); - MovPos[x][y] = (dx != 0 ? dx : dy); -#else - RemoveField(x, y); - Feld[x + dx][y + dy] = element; -#endif - } - -#if 0 - printf("pushing %d/%d ... %d [%d]\n", dx, dy, - FrameCounter, player->push_delay_value); -#endif - -#if 0 - if (element == EL_SPRING) - { - Feld[x + dx][y + dy] = EL_SPRING; - MovDir[x + dx][y + dy] = move_direction; - } -#endif - - player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8)); - - DrawLevelField(x + dx, y + dy); - PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING); - - CheckTriggeredElementChange(element, CE_OTHER_PUSHING); - - break; - -#endif - -#if 0 - case EL_GATE_1: - case EL_GATE_2: - case EL_GATE_3: - case EL_GATE_4: - if (!player->key[element - EL_GATE_1]) - return MF_NO_ACTION; - break; - - case EL_GATE_1_GRAY: - case EL_GATE_2_GRAY: - case EL_GATE_3_GRAY: - case EL_GATE_4_GRAY: - if (!player->key[element - EL_GATE_1_GRAY]) - return MF_NO_ACTION; - break; - - case EL_EM_GATE_1: - case EL_EM_GATE_2: - case EL_EM_GATE_3: - case EL_EM_GATE_4: - if (!player->key[element - EL_EM_GATE_1]) - return MF_NO_ACTION; - if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) - return MF_NO_ACTION; - - /* automatically move to the next field with double speed */ - player->programmed_action = move_direction; - DOUBLE_PLAYER_SPEED(player); - - PlaySoundLevel(x, y, SND_CLASS_GATE_PASSING); - break; - - case EL_EM_GATE_1_GRAY: - case EL_EM_GATE_2_GRAY: - case EL_EM_GATE_3_GRAY: - case EL_EM_GATE_4_GRAY: - if (!player->key[element - EL_EM_GATE_1_GRAY]) - return MF_NO_ACTION; - if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) - return MF_NO_ACTION; - - /* automatically move to the next field with double speed */ - player->programmed_action = move_direction; - DOUBLE_PLAYER_SPEED(player); - -#if 1 - PlaySoundLevelAction(x, y, ACTION_PASSING); -#else - PlaySoundLevel(x, y, SND_GATE_PASSING); -#endif - break; -#endif - -#if 0 - case EL_SWITCHGATE_OPEN: - case EL_TIMEGATE_OPEN: - if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) - return MF_NO_ACTION; - - /* automatically move to the next field with double speed */ - player->programmed_action = move_direction; - DOUBLE_PLAYER_SPEED(player); - - PlaySoundLevelElementAction(x, y, element, ACTION_PASSING); - break; -#endif - case EL_SP_PORT_LEFT: case EL_SP_PORT_RIGHT: case EL_SP_PORT_UP: @@ -7159,28 +6759,6 @@ int DigField(struct PlayerInfo *player, } break; -#if 0 - case EL_EXIT_CLOSED: - case EL_SP_EXIT_CLOSED: - case EL_EXIT_OPENING: - return MF_NO_ACTION; - break; -#endif - -#if 0 - case EL_EXIT_OPEN: - case EL_SP_EXIT_OPEN: - if (mode == DF_SNAP) - return MF_NO_ACTION; - - if (element == EL_EXIT_OPEN) - PlaySoundLevel(x, y, SND_CLASS_EXIT_PASSING); - else - PlaySoundLevel(x, y, SND_CLASS_SP_EXIT_PASSING); - - break; -#endif - case EL_LAMP: Feld[x][y] = EL_LAMP_ACTIVE; local_player->lights_still_needed--; @@ -7198,168 +6776,6 @@ int DigField(struct PlayerInfo *player, return MF_ACTION; break; -#if 0 - -#if 0 - case EL_SOKOBAN_FIELD_EMPTY: - break; -#endif - - case EL_SOKOBAN_OBJECT: - case EL_SOKOBAN_FIELD_FULL: - case EL_SATELLITE: - case EL_SP_DISK_YELLOW: - case EL_BALLOON: - if (mode == DF_SNAP) - return MF_NO_ACTION; - - player->Pushing = TRUE; - - if (!IN_LEV_FIELD(x+dx, y+dy) - || (!IS_FREE(x+dx, y+dy) - && (Feld[x+dx][y+dy] != EL_SOKOBAN_FIELD_EMPTY - || !IS_SB_ELEMENT(element)))) - return MF_NO_ACTION; - - if (!checkDiagonalPushing(player, x, y, real_dx, real_dy)) - return MF_NO_ACTION; - - if (player->push_delay == 0) - player->push_delay = FrameCounter; -#if 0 - if (!FrameReached(&player->push_delay, player->push_delay_value) && - !tape.playing && element != EL_BALLOON) - return MF_NO_ACTION; -#else - if (!FrameReached(&player->push_delay, player->push_delay_value) && - !(tape.playing && tape.file_version < FILE_VERSION_2_0) && - element != EL_BALLOON) - return MF_NO_ACTION; -#endif - - if (IS_SB_ELEMENT(element)) - { -#if 1 - if (element == EL_SOKOBAN_FIELD_FULL) - { - Back[x][y] = EL_SOKOBAN_FIELD_EMPTY; - local_player->sokobanfields_still_needed++; - } - - if (Feld[x + dx][y + dy] == EL_SOKOBAN_FIELD_EMPTY) - { - Back[x + dx][y + dy] = EL_SOKOBAN_FIELD_EMPTY; - local_player->sokobanfields_still_needed--; - } - - Feld[x][y] = EL_SOKOBAN_OBJECT; - - if (Back[x][y] == Back[x + dx][y + dy]) - PlaySoundLevelAction(x, y, ACTION_PUSHING); - else if (Back[x][y] != 0) - PlaySoundLevelElementAction(x, y, EL_SOKOBAN_FIELD_FULL, - ACTION_EMPTYING); - else - PlaySoundLevelElementAction(x + dx, y + dy, EL_SOKOBAN_FIELD_EMPTY, - ACTION_FILLING); - - InitMovingField(x, y, (dx < 0 ? MV_LEFT : - dx > 0 ? MV_RIGHT : - dy < 0 ? MV_UP : MV_DOWN)); - MovPos[x][y] = (dx != 0 ? dx : dy); - -#if 0 - printf("::: %s -> %s [%s -> %s]\n", - element_info[Feld[x][y]].token_name, - element_info[Feld[x + dx][y + dy]].token_name, - element_info[Back[x][y]].token_name, - element_info[Back[x + dx][y + dy]].token_name); -#endif - -#else - if (element == EL_SOKOBAN_FIELD_FULL) - { - Feld[x][y] = EL_SOKOBAN_FIELD_EMPTY; - local_player->sokobanfields_still_needed++; - } - else - RemoveField(x, y); - - if (Feld[x+dx][y+dy] == EL_SOKOBAN_FIELD_EMPTY) - { - Feld[x+dx][y+dy] = EL_SOKOBAN_FIELD_FULL; - local_player->sokobanfields_still_needed--; - if (element == EL_SOKOBAN_OBJECT) -#if 1 - PlaySoundLevelAction(x+dx, y+dy, ACTION_FILLING); -#else - PlaySoundLevel(x, y, SND_CLASS_SOKOBAN_FIELD_FILLING); -#endif - else -#if 1 - PlaySoundLevelAction(x+dx, y+dy, ACTION_PUSHING); -#else - PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); -#endif - } - else - { - Feld[x+dx][y+dy] = EL_SOKOBAN_OBJECT; - if (element == EL_SOKOBAN_FIELD_FULL) -#if 1 - PlaySoundLevelAction(x+dx, y+dy, ACTION_EMPTYING); -#else - PlaySoundLevel(x, y, SND_SOKOBAN_FIELD_EMPTYING); -#endif - else -#if 1 - PlaySoundLevelAction(x+dx, y+dy, ACTION_PUSHING); -#else - PlaySoundLevel(x, y, SND_SOKOBAN_OBJECT_PUSHING); -#endif - } -#endif - } - else - { -#if 1 - InitMovingField(x, y, (dx < 0 ? MV_LEFT : - dx > 0 ? MV_RIGHT : - dy < 0 ? MV_UP : MV_DOWN)); - MovPos[x][y] = (dx != 0 ? dx : dy); -#else - RemoveField(x, y); - Feld[x + dx][y + dy] = element; -#endif - PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING); - } - - player->push_delay_value = (element == EL_BALLOON ? 0 : 2); - - DrawLevelField(x, y); - DrawLevelField(x + dx, y + dy); - - if (IS_SB_ELEMENT(element) && - local_player->sokobanfields_still_needed == 0 && - game.emulation == EMU_SOKOBAN) - { - player->LevelSolved = player->GameOver = TRUE; - PlaySoundLevel(x, y, SND_GAME_SOKOBAN_SOLVING); - } - - CheckTriggeredElementChange(element, CE_OTHER_PUSHING); - - break; - -#endif - -#if 0 - case EL_PENGUIN: - case EL_PIG: - case EL_DRAGON: - break; -#endif - default: if (IS_WALKABLE(element)) @@ -7488,9 +6904,10 @@ int DigField(struct PlayerInfo *player, el2edimg(EL_KEY_1 + key_nr)); redraw_mask |= REDRAW_DOOR_1; } - else if (gem_count[element] > 0) + else if (element_info[element].collect_gem_count > 0) { - local_player->gems_still_needed -= gem_count[element]; + local_player->gems_still_needed -= + element_info[element].collect_gem_count; if (local_player->gems_still_needed < 0) local_player->gems_still_needed = 0; @@ -7909,7 +7326,7 @@ void RaiseScoreElement(int element) RaiseScore(level.score[SC_KEY]); break; default: - RaiseScore(element_info[element].score); + RaiseScore(element_info[element].collect_score); break; } } diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 7b928200..b80910d8 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -828,6 +828,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) int border_xsize = gi->border.xsize; int border_ysize = gi->border.ysize; int button_size = gi->border.xsize_selectbutton; + int bottom_screen_border = gfx.sy + gfx.sysize - font_height; Bitmap *src_bitmap; int src_x, src_y; @@ -848,10 +849,10 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) gi->selectbox.x = gi->x; gi->selectbox.y = gi->y + gi->height; - if (gi->selectbox.y + gi->selectbox.height > gfx.real_sy + gfx.full_sysize) + if (gi->selectbox.y + gi->selectbox.height > bottom_screen_border) gi->selectbox.y = gi->y - gi->selectbox.height; if (gi->selectbox.y < 0) - gi->selectbox.y = gfx.real_sy + gfx.full_sysize - gi->selectbox.height; + gi->selectbox.y = bottom_screen_border - gi->selectbox.height; getFontCharSource(font_nr, FONT_ASCII_CURSOR, &src_bitmap, &src_x, &src_y); src_x += font_width / 2; diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 4ea00b5f..8ad6308b 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -41,6 +41,7 @@ typedef Uint32 Pixel; typedef SDL_Cursor *Cursor; typedef SDLKey Key; +typedef unsigned int KeyMod; typedef SDL_Event Event; typedef SDL_MouseButtonEvent ButtonEvent; @@ -331,6 +332,21 @@ struct XY #define KSYM_FKEY_LAST KSYM_F15 #define KSYM_NUM_FKEYS (KSYM_FKEY_LAST - KSYM_FKEY_FIRST + 1) +#define KMOD_None None +#define KMOD_Shift_L KMOD_LSHIFT +#define KMOD_Shift_R KMOD_RSHIFT +#define KMOD_Control_L KMOD_LCTRL +#define KMOD_Control_R KMOD_RCTRL +#define KMOD_Meta_L KMOD_LMETA +#define KMOD_Meta_R KMOD_RMETA +#define KMOD_Alt_L KMOD_LALT +#define KMOD_Alt_R KMOD_RALT + +#define KMOD_Shift (KMOD_Shift_L | KMOD_Shift_R) +#define KMOD_Control (KMOD_Control_L | KMOD_Control_R) +#define KMOD_Meta (KMOD_Meta_L | KMOD_Meta_R) +#define KMOD_Alt (KMOD_Alt_L | KMOD_Alt_R) + /* SDL function definitions */ diff --git a/src/libgame/system.c b/src/libgame/system.c index 18776bd4..d2e5e38f 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1070,6 +1070,64 @@ inline Key GetEventKey(KeyEvent *event, boolean with_modifiers) #endif } +inline KeyMod HandleKeyModState(Key key, int key_status) +{ +#if !defined(TARGET_SDL) + static KeyMod current_modifiers = KMOD_None; + + if (key != KSYM_UNDEFINED) /* new key => check for modifier key change */ + { + KeyMod new_modifier = KMOD_None; + + switch(key) + { + case KSYM_Shift_L: + new_modifier = KMOD_Shift_L; + break; + case KSYM_Shift_R: + new_modifier = KMOD_Shift_R; + break; + case KSYM_Control_L: + new_modifier = KMOD_Control_L; + break; + case KSYM_Control_R: + new_modifier = KMOD_Control_R; + break; + case KSYM_Meta_L: + new_modifier = KMOD_Meta_L; + break; + case KSYM_Meta_R: + new_modifier = KMOD_Meta_R; + break; + case KSYM_Alt_L: + new_modifier = KMOD_Alt_L; + break; + case KSYM_Alt_R: + new_modifier = KMOD_Alt_R; + break; + default: + break; + } + + if (key_status == KEY_PRESSED) + current_modifiers |= new_modifier; + else + current_modifiers &= ~new_modifier; + } + + return current_modifiers; +#endif +} + +inline KeyMod GetKeyModState() +{ +#if defined(TARGET_SDL) + return (KeyMod)SDL_GetModState(); +#else + return HandleKeyModState(KSYM_UNDEFINED, 0); +#endif +} + inline boolean CheckCloseWindowEvent(ClientMessageEvent *event) { if (event->type != EVENT_CLIENTMESSAGE) diff --git a/src/libgame/system.h b/src/libgame/system.h index 76a421bd..399e1e65 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -68,6 +68,24 @@ #define DEFAULT_KEY_LOAD_GAME KSYM_F2 #define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space +/* values for key_status */ +#define KEY_NOT_PRESSED FALSE +#define KEY_RELEASED FALSE +#define KEY_PRESSED TRUE + +/* values for button status */ +#define MB_NOT_PRESSED FALSE +#define MB_NOT_RELEASED TRUE +#define MB_RELEASED FALSE +#define MB_PRESSED TRUE +#define MB_MENU_CHOICE FALSE +#define MB_MENU_MARK TRUE +#define MB_MENU_INITIALIZE (-1) +#define MB_MENU_LEAVE (-2) +#define MB_LEFTBUTTON 1 +#define MB_MIDDLEBUTTON 2 +#define MB_RIGHTBUTTON 3 + /* values for basic move directions (effective at runtime) */ #define MV_BIT_LEFT 0 @@ -117,19 +135,6 @@ #define MV_TURNING_LEFT (1 << MV_BIT_TURNING_LEFT) #define MV_TURNING_RIGHT (1 << MV_BIT_TURNING_RIGHT) -/* values for button status */ -#define MB_NOT_PRESSED FALSE -#define MB_NOT_RELEASED TRUE -#define MB_RELEASED FALSE -#define MB_PRESSED TRUE -#define MB_MENU_CHOICE FALSE -#define MB_MENU_MARK TRUE -#define MB_MENU_INITIALIZE (-1) -#define MB_MENU_LEAVE (-2) -#define MB_LEFTBUTTON 1 -#define MB_MIDDLEBUTTON 2 -#define MB_RIGHTBUTTON 3 - /* values for animation mode (frame order and direction) */ #define ANIM_NONE 0 @@ -754,6 +759,8 @@ inline void InitEventFilter(EventFilter); inline boolean PendingEvent(void); inline void NextEvent(Event *event); inline Key GetEventKey(KeyEvent *, boolean); +inline KeyMod HandleKeyModState(Key, int); +inline KeyMod GetKeyModState(); inline boolean CheckCloseWindowEvent(ClientMessageEvent *); inline void InitJoysticks(); diff --git a/src/libgame/x11.h b/src/libgame/x11.h index 4ef96acb..99dc4c9c 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -58,6 +58,7 @@ typedef struct X11DrawableInfo DrawBuffer; /* "Cursor" is already defined */ typedef KeySym Key; +typedef unsigned int KeyMod; typedef XEvent Event; typedef XButtonEvent ButtonEvent; @@ -315,6 +316,21 @@ struct XY #define KSYM_FKEY_LAST KSYM_F24 #define KSYM_NUM_FKEYS (KSYM_FKEY_LAST - KSYM_FKEY_FIRST + 1) +#define KMOD_None None +#define KMOD_Shift_L 0x0001 +#define KMOD_Shift_R 0x0002 +#define KMOD_Control_L 0x0040 +#define KMOD_Control_R 0x0080 +#define KMOD_Meta_L 0x0400 +#define KMOD_Meta_R 0x0800 +#define KMOD_Alt_L 0x0100 +#define KMOD_Alt_R 0x0200 + +#define KMOD_Shift (KMOD_Shift_L | KMOD_Shift_R) +#define KMOD_Control (KMOD_Control_L | KMOD_Control_R) +#define KMOD_Meta (KMOD_Meta_L | KMOD_Meta_R) +#define KMOD_Alt (KMOD_Alt_L | KMOD_Alt_R) + /* X11 function definitions */ diff --git a/src/main.h b/src/main.h index bb39c7b3..4a3cee3c 100644 --- a/src/main.h +++ b/src/main.h @@ -1201,7 +1201,8 @@ struct ElementInfo boolean use_gfx_element; short gfx_element; /* optional custom graphic element */ - int score; /* score for collection, smashing, ... */ + int collect_score; /* score value for collecting */ + int collect_gem_count; /* gem count value for collecting */ int push_delay_fixed; /* constant frame delay for pushing */ int push_delay_random; /* additional random frame delay for pushing */