X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Feditor.c;h=7ba41621be34cda75b0e381688d46c4ec284def9;hp=fba668d1ccc2eded15fc8841fe96f0f184f92af9;hb=6cf34a189f4a3707c9131652621dd67731f14f6b;hpb=310781167f731177d6d46b15093dc32606eeac4e diff --git a/src/editor.c b/src/editor.c index fba668d1..7ba41621 100644 --- a/src/editor.c +++ b/src/editor.c @@ -3806,7 +3806,7 @@ static int editor_el_players[] = EL_PLAYER_4 }; static int *editor_el_players_ptr = editor_el_players; -static int num_editor_el_players = SIZEOF_ARRAY_INT(editor_el_players); +static int num_editor_el_players = ARRAY_SIZE(editor_el_players); static int editor_hl_boulderdash[] = { @@ -3845,8 +3845,8 @@ static int editor_el_boulderdash[] = }; static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash; static int *editor_el_boulderdash_ptr = editor_el_boulderdash; -static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash); -static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash); +static int num_editor_hl_boulderdash = ARRAY_SIZE(editor_hl_boulderdash); +static int num_editor_el_boulderdash = ARRAY_SIZE(editor_el_boulderdash); static int editor_hl_emerald_mine[] = { @@ -3920,8 +3920,8 @@ static int editor_el_emerald_mine[] = }; static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine; static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine; -static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine); -static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine); +static int num_editor_hl_emerald_mine = ARRAY_SIZE(editor_hl_emerald_mine); +static int num_editor_el_emerald_mine = ARRAY_SIZE(editor_el_emerald_mine); static int editor_hl_emerald_mine_club[] = { @@ -4010,8 +4010,8 @@ static int editor_el_emerald_mine_club[] = }; static int *editor_hl_emerald_mine_club_ptr = editor_hl_emerald_mine_club; static int *editor_el_emerald_mine_club_ptr = editor_el_emerald_mine_club; -static int num_editor_hl_emerald_mine_club=SIZEOF_ARRAY_INT(editor_hl_emerald_mine_club); -static int num_editor_el_emerald_mine_club=SIZEOF_ARRAY_INT(editor_el_emerald_mine_club); +static int num_editor_hl_emerald_mine_club = ARRAY_SIZE(editor_hl_emerald_mine_club); +static int num_editor_el_emerald_mine_club = ARRAY_SIZE(editor_el_emerald_mine_club); static int editor_hl_rnd[] = { @@ -4110,8 +4110,8 @@ static int editor_el_rnd[] = }; static int *editor_hl_rnd_ptr = editor_hl_rnd; static int *editor_el_rnd_ptr = editor_el_rnd; -static int num_editor_hl_rnd = SIZEOF_ARRAY_INT(editor_hl_rnd); -static int num_editor_el_rnd = SIZEOF_ARRAY_INT(editor_el_rnd); +static int num_editor_hl_rnd = ARRAY_SIZE(editor_hl_rnd); +static int num_editor_el_rnd = ARRAY_SIZE(editor_el_rnd); static int editor_hl_sokoban[] = { @@ -4130,8 +4130,8 @@ static int editor_el_sokoban[] = }; static int *editor_hl_sokoban_ptr = editor_hl_sokoban; static int *editor_el_sokoban_ptr = editor_el_sokoban; -static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban); -static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban); +static int num_editor_hl_sokoban = ARRAY_SIZE(editor_hl_sokoban); +static int num_editor_el_sokoban = ARRAY_SIZE(editor_el_sokoban); static int editor_hl_supaplex[] = { @@ -4205,8 +4205,8 @@ static int editor_el_supaplex[] = }; static int *editor_hl_supaplex_ptr = editor_hl_supaplex; static int *editor_el_supaplex_ptr = editor_el_supaplex; -static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex); -static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex); +static int num_editor_hl_supaplex = ARRAY_SIZE(editor_hl_supaplex); +static int num_editor_el_supaplex = ARRAY_SIZE(editor_el_supaplex); static int editor_hl_diamond_caves[] = { @@ -4367,8 +4367,8 @@ static int editor_el_diamond_caves[] = }; static int *editor_hl_diamond_caves_ptr = editor_hl_diamond_caves; static int *editor_el_diamond_caves_ptr = editor_el_diamond_caves; -static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves); -static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves); +static int num_editor_hl_diamond_caves = ARRAY_SIZE(editor_hl_diamond_caves); +static int num_editor_el_diamond_caves = ARRAY_SIZE(editor_el_diamond_caves); static int editor_hl_dx_boulderdash[] = { @@ -4402,8 +4402,8 @@ static int editor_el_dx_boulderdash[] = }; static int *editor_hl_dx_boulderdash_ptr = editor_hl_dx_boulderdash; static int *editor_el_dx_boulderdash_ptr = editor_el_dx_boulderdash; -static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash); -static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash); +static int num_editor_hl_dx_boulderdash = ARRAY_SIZE(editor_hl_dx_boulderdash); +static int num_editor_el_dx_boulderdash = ARRAY_SIZE(editor_el_dx_boulderdash); static int editor_hl_mirror_magic[] = { @@ -4467,8 +4467,8 @@ static int editor_el_mirror_magic[] = }; static int *editor_hl_mirror_magic_ptr = editor_hl_mirror_magic; static int *editor_el_mirror_magic_ptr = editor_el_mirror_magic; -static int num_editor_hl_mirror_magic = SIZEOF_ARRAY_INT(editor_hl_mirror_magic); -static int num_editor_el_mirror_magic = SIZEOF_ARRAY_INT(editor_el_mirror_magic); +static int num_editor_hl_mirror_magic = ARRAY_SIZE(editor_hl_mirror_magic); +static int num_editor_el_mirror_magic = ARRAY_SIZE(editor_el_mirror_magic); static int editor_hl_deflektor[] = { @@ -4512,8 +4512,8 @@ static int editor_el_deflektor[] = }; static int *editor_hl_deflektor_ptr = editor_hl_deflektor; static int *editor_el_deflektor_ptr = editor_el_deflektor; -static int num_editor_hl_deflektor = SIZEOF_ARRAY_INT(editor_hl_deflektor); -static int num_editor_el_deflektor = SIZEOF_ARRAY_INT(editor_el_deflektor); +static int num_editor_hl_deflektor = ARRAY_SIZE(editor_hl_deflektor); +static int num_editor_el_deflektor = ARRAY_SIZE(editor_el_deflektor); static int editor_hl_chars[] = { @@ -4622,8 +4622,8 @@ static int editor_el_chars[] = }; static int *editor_hl_chars_ptr = editor_hl_chars; static int *editor_el_chars_ptr = editor_el_chars; -static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars); -static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars); +static int num_editor_hl_chars = ARRAY_SIZE(editor_hl_chars); +static int num_editor_el_chars = ARRAY_SIZE(editor_el_chars); static int editor_hl_steel_chars[] = { @@ -4732,8 +4732,8 @@ static int editor_el_steel_chars[] = }; static int *editor_hl_steel_chars_ptr = editor_hl_steel_chars; static int *editor_el_steel_chars_ptr = editor_el_steel_chars; -static int num_editor_hl_steel_chars = SIZEOF_ARRAY_INT(editor_hl_steel_chars); -static int num_editor_el_steel_chars = SIZEOF_ARRAY_INT(editor_el_steel_chars); +static int num_editor_hl_steel_chars = ARRAY_SIZE(editor_hl_steel_chars); +static int num_editor_el_steel_chars = ARRAY_SIZE(editor_el_steel_chars); static int editor_hl_custom[] = { @@ -5067,8 +5067,8 @@ static int editor_el_custom[] = }; static int *editor_hl_custom_ptr = editor_hl_custom; static int *editor_el_custom_ptr = editor_el_custom; -static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom); -static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom); +static int num_editor_hl_custom = ARRAY_SIZE(editor_hl_custom); +static int num_editor_el_custom = ARRAY_SIZE(editor_el_custom); static int editor_hl_group[] = { @@ -5122,8 +5122,8 @@ static int editor_el_group[] = }; static int *editor_hl_group_ptr = editor_hl_group; static int *editor_el_group_ptr = editor_el_group; -static int num_editor_hl_group = SIZEOF_ARRAY_INT(editor_hl_group); -static int num_editor_el_group = SIZEOF_ARRAY_INT(editor_el_group); +static int num_editor_hl_group = ARRAY_SIZE(editor_hl_group); +static int num_editor_el_group = ARRAY_SIZE(editor_el_group); static int editor_hl_reference[] = { @@ -5167,8 +5167,8 @@ static int editor_el_reference[] = }; static int *editor_hl_reference_ptr = editor_hl_reference; static int *editor_el_reference_ptr = editor_el_reference; -static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference); -static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference); +static int num_editor_hl_reference = ARRAY_SIZE(editor_hl_reference); +static int num_editor_el_reference = ARRAY_SIZE(editor_el_reference); static int editor_hl_user_defined[] = { @@ -5180,7 +5180,7 @@ static int editor_hl_user_defined[] = static int *editor_hl_user_defined_ptr = editor_hl_user_defined; static int *editor_el_user_defined_ptr = NULL; -static int num_editor_hl_user_defined=SIZEOF_ARRAY_INT(editor_hl_user_defined); +static int num_editor_hl_user_defined = ARRAY_SIZE(editor_hl_user_defined); static int num_editor_el_user_defined = 0; static int editor_hl_dynamic[] = @@ -5193,7 +5193,7 @@ static int editor_hl_dynamic[] = static int *editor_hl_dynamic_ptr = editor_hl_dynamic; static int *editor_el_dynamic_ptr = NULL; -static int num_editor_hl_dynamic = SIZEOF_ARRAY_INT(editor_hl_dynamic); +static int num_editor_hl_dynamic = ARRAY_SIZE(editor_hl_dynamic); static int num_editor_el_dynamic = 0; static int editor_hl_empty[] = { EL_EMPTY }; @@ -6124,6 +6124,7 @@ static void CreateControlButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, controlbutton_info[i].infotext, GDI_X, x, GDI_Y, y, @@ -6198,6 +6199,7 @@ static void CreateControlButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, scrollbutton_info[i].infotext, GDI_X, x, GDI_Y, y, @@ -6246,6 +6248,7 @@ static void CreateControlButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, getElementInfoText(element), GDI_X, x, GDI_Y, y, @@ -6343,6 +6346,7 @@ static void CreateCounterButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, infotext, GDI_X, x, GDI_Y, y, @@ -6399,6 +6403,7 @@ static void CreateCounterButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, "enter counter value", GDI_X, x, GDI_Y, y, @@ -6741,6 +6746,7 @@ static void CreateTextbuttonGadgets() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, infotext, GDI_X, x, GDI_Y, y, @@ -6781,7 +6787,8 @@ static void CreateGraphicbuttonGadgets() int id = graphicbutton_info[i].gadget_id; int x = SX + ED_SETTINGS_X(graphicbutton_info[i].x); int y = SY + ED_SETTINGS_Y(graphicbutton_info[i].y); - struct GraphicInfo *gd = &graphic_info[graphicbutton_info[i].graphic]; + int graphic = graphicbutton_info[i].graphic; + struct GraphicInfo *gd = &graphic_info[graphic]; int gd_x1 = gd->src_x; int gd_y1 = gd->src_y; int gd_x2 = gd->src_x + gd->pressed_xoffset; @@ -6800,6 +6807,7 @@ static void CreateGraphicbuttonGadgets() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, graphicbutton_info[i].infotext, GDI_X, x, GDI_Y, y, @@ -6906,6 +6914,7 @@ static void CreateScrollbarGadgets() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, scrollbar_info[i].infotext, GDI_X, scrollbar_pos[i].x, GDI_Y, scrollbar_pos[i].y, @@ -6971,6 +6980,7 @@ static void CreateCheckbuttonGadgets() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, checkbutton_info[i].infotext, GDI_X, x, GDI_Y, y, @@ -6998,7 +7008,8 @@ static void CreateCheckbuttonGadgets() static void CreateRadiobuttonGadgets() { - struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_RADIOBUTTON]; + int graphic = IMG_EDITOR_RADIOBUTTON; + struct GraphicInfo *gd = &graphic_info[graphic]; int gd_x1 = gd->src_x; int gd_y1 = gd->src_y; int gd_x2 = gd->src_x + gd->pressed_xoffset; @@ -7033,6 +7044,7 @@ static void CreateRadiobuttonGadgets() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, + GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, radiobutton_info[i].infotext, GDI_X, x, GDI_Y, y, @@ -13135,7 +13147,8 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) 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_EDITOR_LAST && + type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2) || type_id == ED_CHECKBUTTON_ID_STICK_ELEMENT) return;