X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=4a47194a4066bd6b346616bbca718db1f1a1c7b8;hb=945d51a5966241e4964a2b72058b6295cbc4a688;hp=bd466026306226acc12106ee6af914c4c2fa74f6;hpb=76b3cb92402127cde194888bab57397eca735220;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index bd466026..4a47194a 100644 --- a/src/editor.c +++ b/src/editor.c @@ -924,7 +924,7 @@ static struct GADGET_ID_ELEMENT_NAME, MAX_ELEMENT_NAME_LEN - 2, /* currently 2 chars less editable */ custom_element.description, - NULL + "Element name" } }; @@ -1020,7 +1020,8 @@ static struct ValueTextInfo options_deadliness[] = static struct ValueTextInfo options_consistency[] = { - { EP_CAN_EXPLODE, "can explode" }, + { EP_CAN_EXPLODE_3X3, "can explode 3x3" }, + { EP_CAN_EXPLODE_1X1, "can explode 1x1" }, { EP_INDESTRUCTIBLE, "indestructible" }, { -1, NULL } }; @@ -2468,6 +2469,170 @@ static int editor_el_custom[] = }; static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom); +static int editor_el_custom_more[] = +{ + EL_CUSTOM_START + 128, + EL_CUSTOM_START + 129, + EL_CUSTOM_START + 130, + EL_CUSTOM_START + 131, + + EL_CUSTOM_START + 132, + EL_CUSTOM_START + 133, + EL_CUSTOM_START + 134, + EL_CUSTOM_START + 135, + + EL_CUSTOM_START + 136, + EL_CUSTOM_START + 137, + EL_CUSTOM_START + 138, + EL_CUSTOM_START + 139, + + EL_CUSTOM_START + 140, + EL_CUSTOM_START + 141, + EL_CUSTOM_START + 142, + EL_CUSTOM_START + 143, + + EL_CUSTOM_START + 144, + EL_CUSTOM_START + 145, + EL_CUSTOM_START + 146, + EL_CUSTOM_START + 147, + + EL_CUSTOM_START + 148, + EL_CUSTOM_START + 149, + EL_CUSTOM_START + 150, + EL_CUSTOM_START + 151, + + EL_CUSTOM_START + 152, + EL_CUSTOM_START + 153, + EL_CUSTOM_START + 154, + EL_CUSTOM_START + 155, + + EL_CUSTOM_START + 156, + EL_CUSTOM_START + 157, + EL_CUSTOM_START + 158, + EL_CUSTOM_START + 159, + + EL_CUSTOM_START + 160, + EL_CUSTOM_START + 161, + EL_CUSTOM_START + 162, + EL_CUSTOM_START + 163, + + EL_CUSTOM_START + 164, + EL_CUSTOM_START + 165, + EL_CUSTOM_START + 166, + EL_CUSTOM_START + 167, + + EL_CUSTOM_START + 168, + EL_CUSTOM_START + 169, + EL_CUSTOM_START + 170, + EL_CUSTOM_START + 171, + + EL_CUSTOM_START + 172, + EL_CUSTOM_START + 173, + EL_CUSTOM_START + 174, + EL_CUSTOM_START + 175, + + EL_CUSTOM_START + 176, + EL_CUSTOM_START + 177, + EL_CUSTOM_START + 178, + EL_CUSTOM_START + 179, + + EL_CUSTOM_START + 180, + EL_CUSTOM_START + 181, + EL_CUSTOM_START + 182, + EL_CUSTOM_START + 183, + + EL_CUSTOM_START + 184, + EL_CUSTOM_START + 185, + EL_CUSTOM_START + 186, + EL_CUSTOM_START + 187, + + EL_CUSTOM_START + 188, + EL_CUSTOM_START + 189, + EL_CUSTOM_START + 190, + EL_CUSTOM_START + 191, + + EL_CUSTOM_START + 192, + EL_CUSTOM_START + 193, + EL_CUSTOM_START + 194, + EL_CUSTOM_START + 195, + + EL_CUSTOM_START + 196, + EL_CUSTOM_START + 197, + EL_CUSTOM_START + 198, + EL_CUSTOM_START + 199, + + EL_CUSTOM_START + 200, + EL_CUSTOM_START + 201, + EL_CUSTOM_START + 202, + EL_CUSTOM_START + 203, + + EL_CUSTOM_START + 204, + EL_CUSTOM_START + 205, + EL_CUSTOM_START + 206, + EL_CUSTOM_START + 207, + + EL_CUSTOM_START + 208, + EL_CUSTOM_START + 209, + EL_CUSTOM_START + 210, + EL_CUSTOM_START + 211, + + EL_CUSTOM_START + 212, + EL_CUSTOM_START + 213, + EL_CUSTOM_START + 214, + EL_CUSTOM_START + 215, + + EL_CUSTOM_START + 216, + EL_CUSTOM_START + 217, + EL_CUSTOM_START + 218, + EL_CUSTOM_START + 219, + + EL_CUSTOM_START + 220, + EL_CUSTOM_START + 221, + EL_CUSTOM_START + 222, + EL_CUSTOM_START + 223, + + EL_CUSTOM_START + 224, + EL_CUSTOM_START + 225, + EL_CUSTOM_START + 226, + EL_CUSTOM_START + 227, + + EL_CUSTOM_START + 228, + EL_CUSTOM_START + 229, + EL_CUSTOM_START + 230, + EL_CUSTOM_START + 231, + + EL_CUSTOM_START + 232, + EL_CUSTOM_START + 233, + EL_CUSTOM_START + 234, + EL_CUSTOM_START + 235, + + EL_CUSTOM_START + 236, + EL_CUSTOM_START + 237, + EL_CUSTOM_START + 238, + EL_CUSTOM_START + 239, + + EL_CUSTOM_START + 240, + EL_CUSTOM_START + 241, + EL_CUSTOM_START + 242, + EL_CUSTOM_START + 243, + + EL_CUSTOM_START + 244, + EL_CUSTOM_START + 245, + EL_CUSTOM_START + 246, + EL_CUSTOM_START + 247, + + EL_CUSTOM_START + 248, + EL_CUSTOM_START + 249, + EL_CUSTOM_START + 250, + EL_CUSTOM_START + 251, + + EL_CUSTOM_START + 252, + EL_CUSTOM_START + 253, + EL_CUSTOM_START + 254, + EL_CUSTOM_START + 255 +}; +static int num_editor_el_custom_more = SIZEOF_ARRAY_INT(editor_el_custom_more); + static int *editor_elements = NULL; /* dynamically allocated */ static int num_editor_elements = 0; /* dynamically determined */ @@ -2499,6 +2664,8 @@ editor_elements_info[] = &num_editor_el_chars }, { &setup.editor.el_custom, editor_el_custom, &num_editor_el_custom }, + { &setup.editor.el_custom_more, editor_el_custom_more, + &num_editor_el_custom_more }, { NULL, NULL, NULL } }; @@ -2541,6 +2708,12 @@ static void ReinitializeElementList() if (*editor_elements_info[i].setup_value) for (j=0; j<*editor_elements_info[i].element_list_size; j++) editor_elements[pos++] = editor_elements_info[i].element_list[j]; + + /* correct position of element list scrollbar */ + if (element_shift < 0) + element_shift = 0; + if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS) + element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS; } static void ReinitializeElementListButtons() @@ -3868,6 +4041,21 @@ static void CopyPlayfield(short src[MAX_LEV_FIELDX][MAX_LEV_FIELDY], dst[x][y] = src[x][y]; } +static int SetSelectboxValue(int selectbox_id, int new_value) +{ + int new_index_value = 0; + int i; + + for(i=0; selectbox_info[selectbox_id].options[i].text != NULL; i++) + if (selectbox_info[selectbox_id].options[i].value == new_value) + new_index_value = i; + + *selectbox_info[selectbox_id].value = + selectbox_info[selectbox_id].options[new_index_value].value; + + return new_index_value; +} + static void CopyCustomElementPropertiesToEditor(int element) { int i; @@ -3877,6 +4065,10 @@ static void CopyCustomElementPropertiesToEditor(int element) custom_element = element_info[element]; + /* needed to initially set selectbox value variables to reliable defaults */ + for (i=0; i < ED_NUM_SELECTBOX; i++) + SetSelectboxValue(i, *selectbox_info[i].value); + for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) custom_element_properties[i] = HAS_PROPERTY(element, i); @@ -3938,11 +4130,13 @@ static void CopyCustomElementPropertiesToEditor(int element) /* set consistency selectbox help value */ custom_element.consistency = (IS_INDESTRUCTIBLE(element) ? EP_INDESTRUCTIBLE : - CAN_EXPLODE(element) ? EP_CAN_EXPLODE : + CAN_EXPLODE_1X1(element) ? EP_CAN_EXPLODE_1X1 : + CAN_EXPLODE_3X3(element) ? EP_CAN_EXPLODE_3X3 : custom_element.consistency); custom_element_properties[EP_EXPLODE_RESULT] = (IS_INDESTRUCTIBLE(element) || - CAN_EXPLODE(element)); + CAN_EXPLODE_1X1(element) || + CAN_EXPLODE_3X3(element)); /* special case: sub-settings dependent from main setting */ if (CAN_EXPLODE_BY_FIRE(element)) @@ -4047,7 +4241,8 @@ static void CopyCustomElementPropertiesToGame(int element) /* set consistency property from checkbox and selectbox */ custom_element_properties[EP_INDESTRUCTIBLE] = FALSE; - custom_element_properties[EP_CAN_EXPLODE] = FALSE; + custom_element_properties[EP_CAN_EXPLODE_1X1] = FALSE; + custom_element_properties[EP_CAN_EXPLODE_3X3] = FALSE; custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = FALSE; custom_element_properties[EP_CAN_EXPLODE_SMASHED] = FALSE; custom_element_properties[EP_CAN_EXPLODE_IMPACT] = FALSE; @@ -4055,7 +4250,8 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[EP_EXPLODE_RESULT]; /* special case: sub-settings dependent from main setting */ - if (custom_element_properties[EP_CAN_EXPLODE]) + if (custom_element_properties[EP_CAN_EXPLODE_3X3] || + custom_element_properties[EP_CAN_EXPLODE_1X1]) { custom_element_properties[EP_CAN_EXPLODE_BY_FIRE] = custom_element.can_explode_by_fire; @@ -4290,15 +4486,7 @@ static void ModifyEditorSelectbox(int selectbox_id, int new_value) { int gadget_id = selectbox_info[selectbox_id].gadget_id; struct GadgetInfo *gi = level_editor_gadget[gadget_id]; - int new_index_value = 0; - int i; - - for(i=0; selectbox_info[selectbox_id].options[i].text != NULL; i++) - if (selectbox_info[selectbox_id].options[i].value == new_value) - new_index_value = i; - - *selectbox_info[selectbox_id].value = - selectbox_info[selectbox_id].options[new_index_value].value; + int new_index_value = SetSelectboxValue(selectbox_id, new_value); ModifyGadget(gi, GDI_SELECTBOX_INDEX, new_index_value, GDI_END); }