From 291af230c1fb2e475725abe0451ed9271abe5617 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 9 May 2003 23:15:47 +0200 Subject: [PATCH] rnd-20030509-1-src --- src/conf_gfx.c | 6 +- src/conf_gfx.h | 19 +- src/conftime.h | 2 +- src/editor.c | 539 +++++++++++++++++++++++++++---------------------- src/files.c | 6 +- src/game.c | 3 +- src/main.h | 22 +- src/tools.c | 21 +- 8 files changed, 345 insertions(+), 273 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 868fb084..0c98764c 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -959,7 +959,7 @@ struct ConfigInfo image_config[] = { "amoeba.shrinking.ypos", "6" }, { "amoeba.shrinking.frames", "3" }, { "amoeba.shrinking.delay", "2" }, - { "amoeba.shrinking.anim_mode", "loop,linear,reverse" }, + { "amoeba.shrinking.anim_mode", "linear,reverse" }, { "amoeba_wet", "RocksElements.pcx" }, { "amoeba_wet.xpos", "8" }, { "amoeba_wet.ypos", "6" }, @@ -3345,6 +3345,10 @@ struct ConfigInfo image_config[] = { "editor.element_border.xpos", "0" }, { "editor.element_border.ypos", "0" }, + { "editor.element_border_input", "RocksElements.pcx" }, + { "editor.element_border_input.xpos", "0" }, + { "editor.element_border_input.ypos", "0" }, + { "background", UNDEFINED_FILENAME }, { "background.MAIN", UNDEFINED_FILENAME }, { "background.LEVELS", UNDEFINED_FILENAME }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index b24103bd..32ca0562 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -882,15 +882,16 @@ #define IMG_GLOBAL_BORDER 861 #define IMG_GLOBAL_DOOR 862 #define IMG_EDITOR_ELEMENT_BORDER 863 -#define IMG_BACKGROUND 864 -#define IMG_BACKGROUND_MAIN 865 -#define IMG_BACKGROUND_LEVELS 866 -#define IMG_BACKGROUND_SCORES 867 -#define IMG_BACKGROUND_EDITOR 868 -#define IMG_BACKGROUND_INFO 869 -#define IMG_BACKGROUND_SETUP 870 -#define IMG_BACKGROUND_DOOR 871 +#define IMG_EDITOR_ELEMENT_BORDER_INPUT 864 +#define IMG_BACKGROUND 865 +#define IMG_BACKGROUND_MAIN 866 +#define IMG_BACKGROUND_LEVELS 867 +#define IMG_BACKGROUND_SCORES 868 +#define IMG_BACKGROUND_EDITOR 869 +#define IMG_BACKGROUND_INFO 870 +#define IMG_BACKGROUND_SETUP 871 +#define IMG_BACKGROUND_DOOR 872 -#define NUM_IMAGE_FILES 872 +#define NUM_IMAGE_FILES 873 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 261aacbf..33e3efed 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-05-07 23:10]" +#define COMPILE_DATE_STRING "[2003-05-09 23:12]" diff --git a/src/editor.c b/src/editor.c index 8e326ea2..73248193 100644 --- a/src/editor.c +++ b/src/editor.c @@ -106,6 +106,10 @@ #define ED_AREA_ELEM_CONTENT2_YPOS (ED_COUNTER_YPOS2(5) + \ ED_GADGET_DISTANCE) +#define ED_AREA_ELEM_CONTENT3_XPOS (24 * MINI_TILEX) +#define ED_AREA_ELEM_CONTENT3_YPOS (ED_COUNTER_YPOS2(6) + \ + ED_GADGET_DISTANCE) + /* values for random placement background drawing area */ #define ED_AREA_RANDOM_BACKGROUND_XPOS (29 * MINI_TILEX) #define ED_AREA_RANDOM_BACKGROUND_YPOS (31 * MINI_TILEY) @@ -367,12 +371,13 @@ #define GADGET_ID_CUSTOM_WALKABLE_OVER (GADGET_ID_CHECKBUTTON_FIRST + 15) #define GADGET_ID_CUSTOM_WALKABLE_INSIDE (GADGET_ID_CHECKBUTTON_FIRST+ 16) #define GADGET_ID_CUSTOM_WALKABLE_UNDER (GADGET_ID_CHECKBUTTON_FIRST + 17) -#define GADGET_ID_CUSTOM_CHANGEABLE (GADGET_ID_CHECKBUTTON_FIRST + 18) -#define GADGET_ID_CHANGE_DELAY_FIXED (GADGET_ID_CHECKBUTTON_FIRST + 19) -#define GADGET_ID_CHANGE_DELAY_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 20) +#define GADGET_ID_CUSTOM_USE_GRAPHIC (GADGET_ID_CHECKBUTTON_FIRST + 18) +#define GADGET_ID_CUSTOM_CHANGEABLE (GADGET_ID_CHECKBUTTON_FIRST + 19) +#define GADGET_ID_CHANGE_DELAY_FIXED (GADGET_ID_CHECKBUTTON_FIRST + 20) +#define GADGET_ID_CHANGE_DELAY_RANDOM (GADGET_ID_CHECKBUTTON_FIRST + 21) /* gadgets for buttons in element list */ -#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 21) +#define GADGET_ID_ELEMENTLIST_FIRST (GADGET_ID_CHECKBUTTON_FIRST + 22) #define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \ ED_NUM_ELEMENTLIST_BUTTONS - 1) @@ -469,17 +474,18 @@ #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_OVER 13 #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_INSIDE 14 #define ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_UNDER 15 -#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE 16 -#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED 17 -#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM 18 +#define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC 16 +#define ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE 17 +#define ED_CHECKBUTTON_ID_CHANGE_DELAY_FIXED 18 +#define ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM 19 -#define ED_NUM_CHECKBUTTONS 19 +#define ED_NUM_CHECKBUTTONS 20 #define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED #define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED #define ED_CHECKBUTTON_ID_CUSTOM_FIRST ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE -#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM_WALKABLE_UNDER +#define ED_CHECKBUTTON_ID_CUSTOM_LAST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC #define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CHANGEABLE #define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_DELAY_RANDOM @@ -580,7 +586,7 @@ static boolean random_placement_background_restricted = FALSE; static boolean stick_element_properties_window = FALSE; static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES]; static boolean custom_element_change_events[NUM_CHANGE_EVENTS]; -static struct CustomElementChangeInfo custom_element_change; +static struct CustomElementInfo custom_element; static struct { @@ -669,7 +675,7 @@ static struct 0, 999, GADGET_ID_CHANGE_DELAY_FIX_DOWN, GADGET_ID_CHANGE_DELAY_FIX_UP, GADGET_ID_CHANGE_DELAY_FIX_TEXT, - &custom_element_change.delay_fixed, + &custom_element.change.delay_fixed, NULL, "units (fixed)" }, { @@ -677,7 +683,7 @@ static struct 0, 999, GADGET_ID_CHANGE_DELAY_RND_DOWN, GADGET_ID_CHANGE_DELAY_RND_UP, GADGET_ID_CHANGE_DELAY_RND_TEXT, - &custom_element_change.delay_random, + &custom_element.change.delay_random, NULL, "units (random)" } }; @@ -741,7 +747,7 @@ static struct GADGET_ID_CHANGE_TIME_UNITS, 0, options_change_time_units, &index_change_time_units, - &custom_element_change.delay_frames, + &custom_element.change.delay_frames, "delay units given in", "time units for change" }, { @@ -930,71 +936,77 @@ static struct "slip down from certain flat walls","use EM style slipping behaviour" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(6), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(7), GADGET_ID_CUSTOM_INDESTRUCTIBLE, &custom_element_properties[EP_INDESTRUCTIBLE], "indestructible", "element cannot be destroyed" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(7), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(8), GADGET_ID_CUSTOM_DIGGABLE, &custom_element_properties[EP_DIGGABLE], "diggable", "element can be digged away" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(8), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(9), GADGET_ID_CUSTOM_COLLECTIBLE, &custom_element_properties[EP_COLLECTIBLE], "collectible", "element can be collected" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(9), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(10), GADGET_ID_CUSTOM_PUSHABLE, &custom_element_properties[EP_PUSHABLE], "pushable", "element can be pushed" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(10), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(11), GADGET_ID_CUSTOM_CAN_FALL, &custom_element_properties[EP_CAN_FALL], "can fall", "element can fall down" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(11), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(12), GADGET_ID_CUSTOM_CAN_SMASH, &custom_element_properties[EP_CAN_SMASH], "can smash", "element can smash other elements" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(12), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(13), GADGET_ID_CUSTOM_CAN_MOVE, &custom_element_properties[EP_CAN_MOVE], "can move", "element can move in some direction" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(13), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(14), GADGET_ID_CUSTOM_SLIPPERY, &custom_element_properties[EP_SLIPPERY], "slippery", "other elements can fall down from it" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(14), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(15), GADGET_ID_CUSTOM_WALKABLE_OVER, &custom_element_properties[EP_WALKABLE_OVER], "player can walk over", "player can walk over this element" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(15), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(16), GADGET_ID_CUSTOM_WALKABLE_INSIDE, &custom_element_properties[EP_WALKABLE_INSIDE], "player can walk inside", "player can walk inside this element" }, { - ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(16), + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(17), GADGET_ID_CUSTOM_WALKABLE_UNDER, &custom_element_properties[EP_WALKABLE_UNDER], "player can walk under", "player can walk under this element" }, + { + ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(6), + GADGET_ID_CUSTOM_USE_GRAPHIC, + &custom_element.use_gfx_element, + "use graphic of element:", "use optional custom graphic element" + }, { ED_SETTINGS_XPOS, ED_COUNTER_YPOS2(5), GADGET_ID_CUSTOM_CHANGEABLE, @@ -1048,6 +1060,7 @@ static void ModifyEditorElementList(); static void DrawDrawingWindow(); static void DrawLevelInfoWindow(); static void DrawPropertiesWindow(); +static boolean checkPropertiesConfig(); static void CopyLevelToUndoBuffer(int); static void HandleDrawingAreas(struct GadgetInfo *); static void HandleCounterButtons(struct GadgetInfo *); @@ -2400,12 +2413,12 @@ static void CreateDrawingAreas() /* ... one for each custom element optional graphic element ... */ id = GADGET_ID_CUSTOM_GRAPHIC; gi = CreateGadget(GDI_CUSTOM_ID, id, - GDI_X, SX + 2 * MINI_TILEX, - GDI_Y, SY + 4 * MINI_TILEY + MINI_TILEY / 2, - GDI_WIDTH, TILEX, - GDI_HEIGHT, TILEY, + GDI_X, SX + ED_AREA_ELEM_CONTENT3_XPOS, + GDI_Y, SY + ED_AREA_ELEM_CONTENT3_YPOS, + GDI_WIDTH, MINI_TILEX, + GDI_HEIGHT, MINI_TILEY, GDI_TYPE, GD_TYPE_DRAWING_AREA, - GDI_ITEM_SIZE, TILEX, TILEY, + GDI_ITEM_SIZE, MINI_TILEX, MINI_TILEY, GDI_EVENT_MASK, event_mask, GDI_CALLBACK_INFO, HandleDrawingAreaInfo, GDI_CALLBACK_ACTION, HandleDrawingAreas, @@ -2976,7 +2989,7 @@ static void CopyCustomElementPropertiesToEditor(int element) int i; i = properties_element - EL_CUSTOM_START; - custom_element_change = level.custom_element[i].change; + custom_element = level.custom_element[i]; for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) custom_element_properties[i] = HAS_PROPERTY(element, i); @@ -2990,7 +3003,7 @@ static void CopyCustomElementPropertiesToGame(int element) int i; i = properties_element - EL_CUSTOM_START; - level.custom_element[i].change = custom_element_change; + level.custom_element[i] = custom_element; for (i=0; i < NUM_ELEMENT_PROPERTIES; i++) SET_PROPERTY(element, i, custom_element_properties[i]); @@ -3000,7 +3013,7 @@ static void CopyCustomElementPropertiesToGame(int element) /* copy change events also to special level editor variable */ i = properties_element - EL_CUSTOM_START; - custom_element_change = level.custom_element[i].change; + custom_element = level.custom_element[i]; } void DrawLevelEd() @@ -3276,9 +3289,11 @@ static void DrawDrawingWindow() MapMainDrawingArea(); } -static void DrawElementBorder(int dest_x, int dest_y, int width, int height) +static void DrawElementBorder(int dest_x, int dest_y, int width, int height, + boolean input) { - int border_graphic = IMG_EDITOR_ELEMENT_BORDER; + int border_graphic = + (input ? IMG_EDITOR_ELEMENT_BORDER_INPUT : IMG_EDITOR_ELEMENT_BORDER); Bitmap *src_bitmap; int src_x, src_y; int num_mini_tilex = width / MINI_TILEX + 1; @@ -3305,7 +3320,7 @@ static void DrawRandomPlacementBackgroundArea() ElementContent[0][0][0] = random_placement_background_element; - DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY); + DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE); DrawMiniElement(area_x, area_y, ElementContent[0][0][0]); MapDrawingArea(GADGET_ID_RANDOM_BACKGROUND); @@ -3413,7 +3428,7 @@ static void DrawAmoebaContentArea() ElementContent[0][0][0] = level.amoeba_content; - DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY); + DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE); DrawMiniElement(area_x, area_y, ElementContent[0][0][0]); DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba", FONT_TEXT_1); @@ -3421,6 +3436,53 @@ static void DrawAmoebaContentArea() MapDrawingArea(GADGET_ID_AMOEBA_CONTENT); } +static void DrawCustomGraphicElementArea() +{ + struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_GRAPHIC]; +#if 0 + int xoffset_right2 = ED_CHECKBUTTON_XSIZE + 2 * ED_GADGET_DISTANCE; + int yoffset_right2 = ED_BORDER_SIZE; + int i = ED_CHECKBUTTON_ID_CUSTOM_GRAPHIC; + int text_len = strlen(checkbutton_info[i].text); + int text_width = text_len * getFontWidth(FONT_TEXT_1); + int xpos = checkbutton_info[i].x + 2 * xoffset_right2 + text_width; + int ypos = checkbutton_info[i].y + yoffset_right2; +#else + int xpos = ED_AREA_ELEM_CONTENT3_XPOS; + int ypos = ED_AREA_ELEM_CONTENT3_YPOS; +#endif + int area_x = xpos / MINI_TILEX; + int area_y = ypos / MINI_TILEY; + int area_sx = SX + xpos; + int area_sy = SY + ypos; + + if (!IS_CUSTOM_ELEMENT(properties_element)) + { + /* this should never happen */ + Error(ERR_WARN, "element %d is no custom element", properties_element); + + return; + } + + ElementContent[0][0][0] = custom_element.gfx_element; + + DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE); +#if 1 + DrawMiniGraphicExt(drawto, + gi->x, + gi->y, + el2edimg(ElementContent[0][0][0])); +#else + DrawMiniElement(area_x, area_y, ElementContent[0][0][0]); +#endif + +#if 0 + DrawText(area_sx + TILEX, area_sy + 1, "Element after change", FONT_TEXT_1); +#endif + + MapDrawingArea(GADGET_ID_CUSTOM_GRAPHIC); +} + static void DrawCustomChangedArea() { struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_CUSTOM_CHANGED]; @@ -3449,9 +3511,9 @@ static void DrawCustomChangedArea() return; } - ElementContent[0][0][0] = custom_element_change.successor; + ElementContent[0][0][0] = custom_element.change.successor; - DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY); + DrawElementBorder(area_sx, area_sy, MINI_TILEX, MINI_TILEY, TRUE); #if 1 DrawMiniGraphicExt(drawto, gi->x, @@ -3501,7 +3563,7 @@ static void DrawElementContentAreas() for (i=0; i= ED_CHECKBUTTON_ID_CHANGE_FIRST && type_id <= ED_CHECKBUTTON_ID_CHANGE_LAST)) CopyCustomElementPropertiesToGame(properties_element); + + if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC) + ModifyEditorElementList(); } static void HandleControlButtons(struct GadgetInfo *gi) diff --git a/src/files.c b/src/files.c index fadd0b6d..ce657d22 100644 --- a/src/files.c +++ b/src/files.c @@ -99,11 +99,13 @@ static void setLevelInfoToDefaults() { int element = EL_CUSTOM_START + i; + level.custom_element[i].use_gfx_element = FALSE; + level.custom_element[i].gfx_element = EL_EMPTY_SPACE; + level.custom_element[i].change.events = CE_BITMASK_DEFAULT; - level.custom_element[i].change.gfx_element = element; - level.custom_element[i].change.successor = EL_EMPTY_SPACE; level.custom_element[i].change.delay_fixed = 0; level.custom_element[i].change.delay_random = 0; + level.custom_element[i].change.successor = EL_EMPTY_SPACE; /* start with no properties at all */ for (j=0; j < NUM_EP_BITFIELDS; j++) diff --git a/src/game.c b/src/game.c index 7436b1d9..cd8e5341 100644 --- a/src/game.c +++ b/src/game.c @@ -6594,7 +6594,8 @@ int DigField(struct PlayerInfo *player, #if 1 if (mode != DF_SNAP) { - GfxElement[x][y] = element; + GfxElement[x][y] = + (CAN_BE_CRUMBLED(element) ? EL_SAND : GFX_ELEMENT(element)); player->is_digging = TRUE; } #endif diff --git a/src/main.h b/src/main.h index 54340c1f..8e918517 100644 --- a/src/main.h +++ b/src/main.h @@ -190,7 +190,8 @@ /* macros for pre-defined properties */ #define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER) -#define CAN_BE_CRUMBLED(e) HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED) +#define CAN_BE_CRUMBLED_OLD(e) HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED) +#define CAN_BE_CRUMBLED(e) HAS_PROPERTY(GFX_ELEMENT(e),EP_CAN_BE_CRUMBLED) #define CAN_MOVE(e) HAS_PROPERTY(e, EP_CAN_MOVE) #define CAN_PASS_MAGIC_WALL(e) HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL) #define IS_SWITCHABLE(e) HAS_PROPERTY(e, EP_SWITCHABLE) @@ -234,6 +235,10 @@ #define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \ (e) <= EL_CUSTOM_END) +#define GFX_ELEMENT(e) (IS_CUSTOM_ELEMENT(e) && \ + CUSTOM_ELEMENT_INFO(e).use_gfx_element ? \ + CUSTOM_ELEMENT_INFO(e).gfx_element : e) + #define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y])) #define IS_FREE(x,y) (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x,y)) @@ -1012,19 +1017,20 @@ struct PlayerInfo struct CustomElementChangeInfo { - unsigned long events; /* bitfield for change events */ - - short gfx_element; /* optional custom graphic element */ + unsigned long events; /* bitfield for change events */ - short successor; /* new custom element after change */ + int delay_fixed; /* added frame delay before changed (fixed) */ + int delay_random; /* added frame delay before changed (random) */ + int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */ - int delay_fixed; /* added frame delay before changed (fixed) */ - int delay_random; /* added frame delay before changed (random) */ - int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */ + short successor; /* new custom element after change */ }; struct CustomElementInfo { + boolean use_gfx_element; + short gfx_element; /* optional custom graphic element */ + struct CustomElementChangeInfo change; }; diff --git a/src/tools.c b/src/tools.c index 3961f93d..4fe26689 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1199,7 +1199,8 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) element = (IN_LEV_FIELD(xx, yy) ? Feld[xx][yy] : EL_STEELWALL); - if (CAN_BE_CRUMBLED(element)) /* neighbour is of same type */ + /* check if neighbour field is of same type */ + if (CAN_BE_CRUMBLED(element)) continue; if (i == 1 || i == 2) @@ -2390,47 +2391,43 @@ int get_next_element(int element) int el_act_dir2img(int element, int action, int direction) { + element = GFX_ELEMENT(element); direction = MV_DIR_BIT(direction); - if (IS_CUSTOM_ELEMENT(element)) - element = CUSTOM_ELEMENT_INFO(element).change.gfx_element; - return element_info[element].direction_graphic[action][direction]; } int el_act2img(int element, int action) { - if (IS_CUSTOM_ELEMENT(element)) - element = CUSTOM_ELEMENT_INFO(element).change.gfx_element; + element = GFX_ELEMENT(element); return element_info[element].graphic[action]; } int el_dir2img(int element, int direction) { + element = GFX_ELEMENT(element); + return el_act_dir2img(element, ACTION_DEFAULT, direction); } int el2img(int element) { - if (IS_CUSTOM_ELEMENT(element)) - element = CUSTOM_ELEMENT_INFO(element).change.gfx_element; + element = GFX_ELEMENT(element); return element_info[element].graphic[ACTION_DEFAULT]; } int el2edimg(int element) { - if (IS_CUSTOM_ELEMENT(element)) - element = CUSTOM_ELEMENT_INFO(element).change.gfx_element; + element = GFX_ELEMENT(element); return element_info[element].special_graphic[GFX_SPECIAL_ARG_EDITOR]; } int el2preimg(int element) { - if (IS_CUSTOM_ELEMENT(element)) - element = CUSTOM_ELEMENT_INFO(element).change.gfx_element; + element = GFX_ELEMENT(element); return element_info[element].special_graphic[GFX_SPECIAL_ARG_PREVIEW]; } -- 2.34.1