From: Holger Schemel Date: Sat, 10 Aug 2024 13:26:41 +0000 (+0200) Subject: renamed types and variables X-Git-Tag: 4.4.0.0-test-4~313 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0003ccc86a51ae2cb2d95e763cb740d28488cff7;p=rocksndiamonds.git renamed types and variables --- diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 6a0a0459..3e17fde5 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -1464,7 +1464,7 @@ static void save_properties(GdPtrArray *out, void *str, void *str_def, break; case GD_TYPE_ELEMENT: - appendStringPrint(&line, "%s", gd_elements[((GdElement *) value)[j]].filename); + appendStringPrint(&line, "%s", gd_element_properties[((GdElement *) value)[j]].filename); if (((GdElement *) value)[j] != ((GdElement *) default_value)[j]) should_write = TRUE; break; @@ -1473,7 +1473,7 @@ static void save_properties(GdPtrArray *out, void *str, void *str_def, // for effects, the property identifier is the effect name. // "Effect=" is hardcoded; see above. appendStringPrint(&line, "%s %s", prop_desc[i].identifier, - gd_elements[((GdElement *) value)[j]].filename); + gd_element_properties[((GdElement *) value)[j]].filename); if (((GdElement *) value)[j] != ((GdElement *) default_value)[j]) should_write = TRUE; break; @@ -1618,10 +1618,10 @@ static void caveset_save_cave_func(GdCave *cave, GdPtrArray *out) { // check if character is non-zero; // the ...save() should have assigned a character to every element - if (gd_elements[cave->map[y][x]].character_new == 0) - Warn("gd_elements[cave->map[y][x]].character_new should be non-zero"); + if (gd_element_properties[cave->map[y][x]].character_new == 0) + Warn("gd_element_properties[cave->map[y][x]].character_new should be non-zero"); - line[x] = gd_elements[cave->map[y][x]].character_new; + line[x] = gd_element_properties[cave->map[y][x]].character_new; } gd_ptr_array_add(out, getStringCopy(line)); @@ -1697,7 +1697,7 @@ GdPtrArray *gd_caveset_save_to_bdcff(void) // check if we need an own mapcode table ------ // copy original characters to character_new fields; new elements will be added to that one for (i = 0; i < O_MAX; i++) - gd_elements[i].character_new = gd_elements[i].character; + gd_element_properties[i].character_new = gd_element_properties[i].character; // also regenerate this table as we use it gd_create_char_to_element_table(); @@ -1719,7 +1719,7 @@ GdPtrArray *gd_caveset_save_to_bdcff(void) GdElement e = cave->map[y][x]; // if no character assigned - if (gd_elements[e].character_new == 0) + if (gd_element_properties[e].character_new == 0) { int j; @@ -1738,7 +1738,7 @@ GdPtrArray *gd_caveset_save_to_bdcff(void) if (j == 128) Warn("variable j should be != 128"); - gd_elements[e].character_new = j; + gd_element_properties[e].character_new = j; // we also record to this table, as we use it ^^ a few lines above gd_char_to_element[j] = e; @@ -1761,8 +1761,8 @@ GdPtrArray *gd_caveset_save_to_bdcff(void) for (i = 0; i < O_MAX; i++) { // if no character assigned by specification BUT (AND) we assigned one - if (gd_elements[i].character == 0 && gd_elements[i].character_new != 0) - gd_ptr_array_add(out, getStringPrint("%c=%s", gd_elements[i].character_new, gd_elements[i].filename)); + if (gd_element_properties[i].character == 0 && gd_element_properties[i].character_new != 0) + gd_ptr_array_add(out, getStringPrint("%c=%s", gd_element_properties[i].character_new, gd_element_properties[i].filename)); } gd_ptr_array_add(out, getStringCopy("[/mapcodes]")); diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 7c958619..1f41cf3a 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -241,7 +241,7 @@ void gd_create_char_to_element_table(void) // then set fixed characters for (i = 0; i < O_MAX; i++) { - int c = gd_elements[i].character; + int c = gd_element_properties[i].character; if (c) { @@ -278,7 +278,7 @@ void gd_cave_init(void) for (i = 0; i < O_MAX; i++) { - char *key_1 = getStringToUpper(gd_elements[i].filename); + char *key_1 = getStringToUpper(gd_element_properties[i].filename); if (hashtable_exists(name_to_element, key_1)) // hash value may be 0 Warn("Name %s already used for element %x", key_1, i); @@ -1354,29 +1354,29 @@ void gd_drawcave_game(const GdCave *cave, for (x = 0; x < O_MAX_ALL; x++) { elemmapping[x] = x; - elemdrawing[x] = gd_elements[x].image_game; + elemdrawing[x] = gd_element_properties[x].image_game; } if (bonus_life_flash) { elemmapping[O_SPACE] = O_FAKE_BONUS; - elemdrawing[O_SPACE] = gd_elements[O_FAKE_BONUS].image_game; + elemdrawing[O_SPACE] = gd_element_properties[O_FAKE_BONUS].image_game; } elemmapping[O_MAGIC_WALL] = (cave->magic_wall_state == GD_MW_ACTIVE ? O_MAGIC_WALL : O_BRICK); - elemdrawing[O_MAGIC_WALL] = gd_elements[cave->magic_wall_state == GD_MW_ACTIVE ? O_MAGIC_WALL : O_BRICK].image_game; + elemdrawing[O_MAGIC_WALL] = gd_element_properties[cave->magic_wall_state == GD_MW_ACTIVE ? O_MAGIC_WALL : O_BRICK].image_game; elemmapping[O_CREATURE_SWITCH] = (cave->creatures_backwards ? O_CREATURE_SWITCH_ON : O_CREATURE_SWITCH); - elemdrawing[O_CREATURE_SWITCH] = gd_elements[cave->creatures_backwards ? O_CREATURE_SWITCH_ON : O_CREATURE_SWITCH].image_game; + elemdrawing[O_CREATURE_SWITCH] = gd_element_properties[cave->creatures_backwards ? O_CREATURE_SWITCH_ON : O_CREATURE_SWITCH].image_game; elemmapping[O_EXPANDING_WALL_SWITCH] = (cave->expanding_wall_changed ? O_EXPANDING_WALL_SWITCH_VERT : O_EXPANDING_WALL_SWITCH_HORIZ); - elemdrawing[O_EXPANDING_WALL_SWITCH] = gd_elements[cave->expanding_wall_changed ? O_EXPANDING_WALL_SWITCH_VERT : O_EXPANDING_WALL_SWITCH_HORIZ].image_game; + elemdrawing[O_EXPANDING_WALL_SWITCH] = gd_element_properties[cave->expanding_wall_changed ? O_EXPANDING_WALL_SWITCH_VERT : O_EXPANDING_WALL_SWITCH_HORIZ].image_game; elemmapping[O_GRAVITY_SWITCH] = (cave->gravity_switch_active ? O_GRAVITY_SWITCH_ACTIVE : O_GRAVITY_SWITCH); - elemdrawing[O_GRAVITY_SWITCH] = gd_elements[cave->gravity_switch_active ? O_GRAVITY_SWITCH_ACTIVE : O_GRAVITY_SWITCH].image_game; + elemdrawing[O_GRAVITY_SWITCH] = gd_element_properties[cave->gravity_switch_active ? O_GRAVITY_SWITCH_ACTIVE : O_GRAVITY_SWITCH].image_game; elemmapping[O_REPLICATOR_SWITCH] = (cave->replicators_active ? O_REPLICATOR_SWITCH_ON : O_REPLICATOR_SWITCH_OFF); - elemdrawing[O_REPLICATOR_SWITCH] = gd_elements[cave->replicators_active ? O_REPLICATOR_SWITCH_ON : O_REPLICATOR_SWITCH_OFF].image_game; + elemdrawing[O_REPLICATOR_SWITCH] = gd_element_properties[cave->replicators_active ? O_REPLICATOR_SWITCH_ON : O_REPLICATOR_SWITCH_OFF].image_game; if (cave->replicators_active) // if the replicators are active, animate them. @@ -1387,7 +1387,7 @@ void gd_drawcave_game(const GdCave *cave, elemdrawing[O_REPLICATOR] = ABS(elemdrawing[O_REPLICATOR]); elemmapping[O_CONVEYOR_SWITCH] = (cave->conveyor_belts_active ? O_CONVEYOR_SWITCH_ON : O_CONVEYOR_SWITCH_OFF); - elemdrawing[O_CONVEYOR_SWITCH] = gd_elements[cave->conveyor_belts_active ? O_CONVEYOR_SWITCH_ON : O_CONVEYOR_SWITCH_OFF].image_game; + elemdrawing[O_CONVEYOR_SWITCH] = gd_element_properties[cave->conveyor_belts_active ? O_CONVEYOR_SWITCH_ON : O_CONVEYOR_SWITCH_OFF].image_game; if (cave->conveyor_belts_direction_changed) { @@ -1402,12 +1402,12 @@ void gd_drawcave_game(const GdCave *cave, elemdrawing[O_CONVEYOR_RIGHT] = temp; elemmapping[O_CONVEYOR_DIR_SWITCH] = O_CONVEYOR_DIR_CHANGED; - elemdrawing[O_CONVEYOR_DIR_SWITCH] = gd_elements[O_CONVEYOR_DIR_CHANGED].image_game; + elemdrawing[O_CONVEYOR_DIR_SWITCH] = gd_element_properties[O_CONVEYOR_DIR_CHANGED].image_game; } else { elemmapping[O_CONVEYOR_DIR_SWITCH] = O_CONVEYOR_DIR_NORMAL; - elemdrawing[O_CONVEYOR_DIR_SWITCH] = gd_elements[O_CONVEYOR_DIR_NORMAL].image_game; + elemdrawing[O_CONVEYOR_DIR_SWITCH] = gd_element_properties[O_CONVEYOR_DIR_NORMAL].image_game; } if (cave->conveyor_belts_active) @@ -1441,44 +1441,44 @@ void gd_drawcave_game(const GdCave *cave, if (player_blinking && player_tapping) { map = O_PLAYER_TAP_BLINK; - draw = gd_elements[O_PLAYER_TAP_BLINK].image_game; + draw = gd_element_properties[O_PLAYER_TAP_BLINK].image_game; } else if (player_blinking) { map = O_PLAYER_BLINK; - draw = gd_elements[O_PLAYER_BLINK].image_game; + draw = gd_element_properties[O_PLAYER_BLINK].image_game; } else if (player_tapping) { map = O_PLAYER_TAP; - draw = gd_elements[O_PLAYER_TAP].image_game; + draw = gd_element_properties[O_PLAYER_TAP].image_game; } else { map = O_PLAYER; - draw = gd_elements[O_PLAYER].image_game; + draw = gd_element_properties[O_PLAYER].image_game; } } else if (cave->last_direction == GD_MV_UP && use_bd_up_down_graphics()) { map = O_PLAYER_UP; - draw = gd_elements[O_PLAYER_UP].image_game; + draw = gd_element_properties[O_PLAYER_UP].image_game; } else if (cave->last_direction == GD_MV_DOWN && use_bd_up_down_graphics()) { map = O_PLAYER_DOWN; - draw = gd_elements[O_PLAYER_DOWN].image_game; + draw = gd_element_properties[O_PLAYER_DOWN].image_game; } else if (cave->last_horizontal_direction == GD_MV_LEFT) { map = O_PLAYER_LEFT; - draw = gd_elements[O_PLAYER_LEFT].image_game; + draw = gd_element_properties[O_PLAYER_LEFT].image_game; } else { // of course this is GD_MV_RIGHT. map = O_PLAYER_RIGHT; - draw = gd_elements[O_PLAYER_RIGHT].image_game; + draw = gd_element_properties[O_PLAYER_RIGHT].image_game; } elemmapping[O_PLAYER] = map; @@ -1499,15 +1499,15 @@ void gd_drawcave_game(const GdCave *cave, } elemmapping[O_INBOX] = (cave->inbox_flash_toggle ? O_INBOX_OPEN : O_INBOX_CLOSED); - elemdrawing[O_INBOX] = gd_elements[cave->inbox_flash_toggle ? O_OUTBOX_OPEN : O_OUTBOX_CLOSED].image_game; + elemdrawing[O_INBOX] = gd_element_properties[cave->inbox_flash_toggle ? O_OUTBOX_OPEN : O_OUTBOX_CLOSED].image_game; elemmapping[O_OUTBOX] = (cave->inbox_flash_toggle ? O_OUTBOX_OPEN : O_OUTBOX_CLOSED); - elemdrawing[O_OUTBOX] = gd_elements[cave->inbox_flash_toggle ? O_OUTBOX_OPEN : O_OUTBOX_CLOSED].image_game; + elemdrawing[O_OUTBOX] = gd_element_properties[cave->inbox_flash_toggle ? O_OUTBOX_OPEN : O_OUTBOX_CLOSED].image_game; - // hack, not fit into gd_elements + // hack, not fit into gd_element_properties elemmapping[O_BITER_SWITCH] = O_BITER_SWITCH_1 + cave->biter_delay_frame; - // hack, not fit into gd_elements - elemdrawing[O_BITER_SWITCH] = gd_elements[O_BITER_SWITCH].image_game + cave->biter_delay_frame; + // hack, not fit into gd_element_properties + elemdrawing[O_BITER_SWITCH] = gd_element_properties[O_BITER_SWITCH].image_game + cave->biter_delay_frame; // visual effects elemmapping[O_DIRT] = cave->dirt_looks_like; @@ -1550,7 +1550,7 @@ void gd_drawcave_game(const GdCave *cave, // if covered, real element is not important if (actual & COVERED) - draw = gd_elements[O_COVERED].image_game; + draw = gd_element_properties[O_COVERED].image_game; else draw = elemdrawing[actual]; @@ -1668,7 +1668,7 @@ void gd_cave_adler_checksum_more(GdCave *cave, unsigned int *a, unsigned int *b) for (y = 0; y < cave->h; y++) for (x = 0; x < cave->w; x++) { - *a += gd_elements[cave->map[y][x] & O_MASK].character; + *a += gd_element_properties[cave->map[y][x] & O_MASK].character; *b += *a; *a %= 65521; diff --git a/src/game_bd/bd_cave.h b/src/game_bd/bd_cave.h index becee295..30f93532 100644 --- a/src/game_bd/bd_cave.h +++ b/src/game_bd/bd_cave.h @@ -94,7 +94,7 @@ void gd_struct_set_defaults_from_array(void *str, const GdStructDescriptor *prop extern const GdColor gd_flash_color; extern const GdColor gd_select_color; -enum _element_property +enum _element_property_enum { E_P_SLOPED_LEFT, // stones and diamonds roll down to left on this E_P_SLOPED_RIGHT, // stones and diamonds roll down to right on this @@ -242,9 +242,10 @@ enum // ELEMENTS DESCRIPTION -typedef struct _elements +typedef struct _element_property { GdElement element; // element number. for example O_DIRT + // In the array, should be equal to the index of the array item. char *name; // name in editor, for example "Dirt". some have // different names than their real engine meaning! unsigned int properties; // engine properties, like P_SLOPED or P_EXPLODES @@ -260,7 +261,7 @@ typedef struct _elements // generated inside the game. char character_new; // character given automatically for elements which // don't have one defined in original bdcff description -} GdElements; +} GdElementProperty; typedef char GdString[MAX_LINE_LEN]; diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index f21cb289..d5230b8e 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -116,7 +116,7 @@ enum _generated_cells_indexes indexes which are in the png have to be given as numeric constants. for generated cells (ie. guard + an arrow), use the above enum */ -GdElements gd_elements[] = +GdElementProperty gd_element_properties[] = { { O_SPACE, N_("Space"), @@ -2894,32 +2894,32 @@ void gd_cave_db_init(void) lowercase_names = FALSE; // check element database for faults. - for (i = 0; gd_elements[i].element != -1; i++) + for (i = 0; gd_element_properties[i].element != -1; i++) { - if (gd_elements[i].element != i) - Error("element: i:0x%x != 0x%x", i, gd_elements[i].element); + if (gd_element_properties[i].element != i) + Error("element: i:0x%x != 0x%x", i, gd_element_properties[i].element); // if it has a name, create a lowercase name (of the translated one). // will be used by the editor - if (gd_elements[i].name) + if (gd_element_properties[i].name) { if (lowercase_names) // the function allocates a new string, but it is needed as long as the app is running - gd_elements[i].lowercase_name = getStringToLower(gettext(gd_elements[i].name)); + gd_element_properties[i].lowercase_name = getStringToLower(gettext(gd_element_properties[i].name)); else // only translate, no lowercase. - gd_elements[i].lowercase_name = gettext(gd_elements[i].name); + gd_element_properties[i].lowercase_name = gettext(gd_element_properties[i].name); } // we do not like generated pixbufs for games. only those that are in the png. - if (ABS(gd_elements[i].image_game) > GD_NUM_OF_CELLS_X * GD_NUM_OF_CELLS_Y) - Error("game pixbuf for element %x (%s) bigger than png size", i, gd_elements[i].name); + if (ABS(gd_element_properties[i].image_game) > GD_NUM_OF_CELLS_X * GD_NUM_OF_CELLS_Y) + Error("game pixbuf for element %x (%s) bigger than png size", i, gd_element_properties[i].name); - if (gd_elements[i].image < 0) - Error("editor pixbuf for element %x (%s) should not be animated", i, gd_elements[i].name); + if (gd_element_properties[i].image < 0) + Error("editor pixbuf for element %x (%s) should not be animated", i, gd_element_properties[i].name); - if (gd_elements[i].properties & P_CAN_BE_HAMMERED && gd_element_get_hammered((GdElement) i) == O_NONE) - Error("element %x (%s) can be hammered, but get_hammered_element does not define another one", i, gd_elements[i].name); + if (gd_element_properties[i].properties & P_CAN_BE_HAMMERED && gd_element_get_hammered((GdElement) i) == O_NONE) + Error("element %x (%s) can be hammered, but get_hammered_element does not define another one", i, gd_element_properties[i].name); } /* diff --git a/src/game_bd/bd_cavedb.h b/src/game_bd/bd_cavedb.h index 747bfdd4..593ddeaf 100644 --- a/src/game_bd/bd_cavedb.h +++ b/src/game_bd/bd_cavedb.h @@ -20,7 +20,7 @@ #include "bd_cave.h" -extern GdElements gd_elements[]; +extern GdElementProperty gd_element_properties[]; extern const GdStructDescriptor gd_cave_properties[]; extern const GdStructDescriptor gd_replay_properties[]; diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 4c3b7b0a..44da27df 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -129,13 +129,13 @@ void gd_cave_set_seconds_sound(GdCave *cave) // returns true if the element can fall static inline boolean el_can_fall(const int element) { - return (gd_elements[element & O_MASK].properties & P_CAN_FALL) != 0; + return (gd_element_properties[element & O_MASK].properties & P_CAN_FALL) != 0; } // returns true if the element is diggable static inline boolean el_diggable(const int element) { - return (gd_elements[element & O_MASK].properties & P_DIGGABLE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_DIGGABLE) != 0; } // returns true if the element can smash the player @@ -408,20 +408,20 @@ static inline GdElement get_dir(const GdCave *cave, const int x, const int y, static inline boolean explodes_by_hit_dir(const GdCave *cave, const int x, const int y, GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_EXPLODES_BY_HIT) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_EXPLODES_BY_HIT) != 0; } // returns true if the element is not explodable, for example the steel wall static inline boolean non_explodable(const GdCave *cave, const int x, const int y) { - return (gd_elements[get(cave, x,y) & O_MASK].properties & P_NON_EXPLODABLE) != 0; + return (gd_element_properties[get(cave, x,y) & O_MASK].properties & P_NON_EXPLODABLE) != 0; } // returns true if the element can be eaten by the amoeba, eg. space and dirt. static inline boolean amoeba_eats_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_AMOEBA_CONSUMES) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_AMOEBA_CONSUMES) != 0; } // returns true if the element is sloped, so stones and diamonds roll down on it. @@ -432,16 +432,16 @@ static inline boolean sloped_dir(const GdCave *cave, const int x, const int y, switch (slop) { case GD_MV_LEFT: - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_LEFT) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_LEFT) != 0; case GD_MV_RIGHT: - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_RIGHT) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_RIGHT) != 0; case GD_MV_UP: - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_UP) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_UP) != 0; case GD_MV_DOWN: - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_DOWN) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_SLOPED_DOWN) != 0; default: break; @@ -455,65 +455,65 @@ static inline boolean sloped_dir(const GdCave *cave, const int x, const int y, static inline boolean sloped_for_bladder_dir (const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_BLADDER_SLOPED) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_BLADDER_SLOPED) != 0; } static inline boolean blows_up_flies_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_BLOWS_UP_FLIES) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_BLOWS_UP_FLIES) != 0; } // returns true if the element is a counter-clockwise creature static inline boolean rotates_ccw (const GdCave *cave, const int x, const int y) { - return (gd_elements[get(cave, x, y) & O_MASK].properties & P_CCW) != 0; + return (gd_element_properties[get(cave, x, y) & O_MASK].properties & P_CCW) != 0; } // returns true if the element is a player boolean is_player(const GdCave *cave, const int x, const int y) { - return (gd_elements[get(cave, x, y) & O_MASK].properties & P_PLAYER) != 0; + return (gd_element_properties[get(cave, x, y) & O_MASK].properties & P_PLAYER) != 0; } // returns true if the element is a player static inline boolean is_player_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_PLAYER) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_PLAYER) != 0; } static inline boolean can_be_hammered_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_CAN_BE_HAMMERED) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_CAN_BE_HAMMERED) != 0; } // returns true if the element can be pushed boolean can_be_pushed_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_PUSHABLE) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_PUSHABLE) != 0; } // returns true if the element is explodable and explodes to space, for example the player static inline boolean is_first_stage_of_explosion(const GdCave *cave, const int x, const int y) { - return (gd_elements[get(cave, x, y) & O_MASK].properties & P_EXPLOSION_FIRST_STAGE) != 0; + return (gd_element_properties[get(cave, x, y) & O_MASK].properties & P_EXPLOSION_FIRST_STAGE) != 0; } // returns true if the element is moved by the conveyor belt static inline boolean moved_by_conveyor_top_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_MOVED_BY_CONVEYOR_TOP) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_MOVED_BY_CONVEYOR_TOP) != 0; } // returns true if the element is moved by the conveyor belt static inline boolean moved_by_conveyor_bottom_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { - return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_MOVED_BY_CONVEYOR_BOTTOM) != 0; + return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_MOVED_BY_CONVEYOR_BOTTOM) != 0; } static inline boolean is_scanned_dir(const GdCave *cave, const int x, const int y, @@ -531,10 +531,10 @@ static inline boolean is_element_dir(const GdCave *cave, const int x, const int GdElement examined = get_dir(cave, x, y, dir); // if it is a dirt-like, change to dirt, so equality will evaluate to true - if (gd_elements[examined & O_MASK].properties & P_DIRT) + if (gd_element_properties[examined & O_MASK].properties & P_DIRT) examined = O_DIRT; - if (gd_elements[e & O_MASK].properties & P_DIRT) + if (gd_element_properties[e & O_MASK].properties & P_DIRT) e = O_DIRT; // if the element on the map is a lava, it should be like space @@ -1738,7 +1738,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, } // add the ckdelay correction value for every element seen. - cave->ckdelay += gd_elements[get(cave, x, y) & O_MASK].ckdelay; + cave->ckdelay += gd_element_properties[get(cave, x, y) & O_MASK].ckdelay; switch (get(cave, x, y)) { @@ -4004,7 +4004,7 @@ void set_initial_cave_speed(GdCave *cave) for (x = 0; x < cave->w; x++) { // add the ckdelay correction value for every element seen. - cave->ckdelay += gd_elements[get(cave, x, y) & O_MASK].ckdelay; + cave->ckdelay += gd_element_properties[get(cave, x, y) & O_MASK].ckdelay; } } diff --git a/src/game_bd/bd_caveobject.c b/src/game_bd/bd_caveobject.c index cea246fa..337d3642 100644 --- a/src/game_bd/bd_caveobject.c +++ b/src/game_bd/bd_caveobject.c @@ -36,32 +36,32 @@ char *gd_object_get_bdcff(const GdObject *object) switch (object->type) { case GD_POINT: - return getStringPrint("Point=%d %d %s", object->x1, object->y1, gd_elements[object->element].filename); + return getStringPrint("Point=%d %d %s", object->x1, object->y1, gd_element_properties[object->element].filename); case GD_LINE: - return getStringPrint("Line=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_elements[object->element].filename); + return getStringPrint("Line=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_element_properties[object->element].filename); case GD_RECTANGLE: - return getStringPrint("Rectangle=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_elements[object->element].filename); + return getStringPrint("Rectangle=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_element_properties[object->element].filename); case GD_FILLED_RECTANGLE: // if elements are not the same if (object->fill_element!=object->element) - return getStringPrint("FillRect=%d %d %d %d %s %s", object->x1, object->y1, object->x2, object->y2, gd_elements[object->element].filename, gd_elements[object->fill_element].filename); + return getStringPrint("FillRect=%d %d %d %d %s %s", object->x1, object->y1, object->x2, object->y2, gd_element_properties[object->element].filename, gd_element_properties[object->fill_element].filename); // they are the same - return getStringPrint("FillRect=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_elements[object->element].filename); + return getStringPrint("FillRect=%d %d %d %d %s", object->x1, object->y1, object->x2, object->y2, gd_element_properties[object->element].filename); case GD_RASTER: - return getStringPrint("Raster=%d %d %d %d %d %d %s", object->x1, object->y1, (object->x2-object->x1)/object->dx+1, (object->y2-object->y1)/object->dy+1, object->dx, object->dy, gd_elements[object->element].filename); + return getStringPrint("Raster=%d %d %d %d %d %d %s", object->x1, object->y1, (object->x2-object->x1)/object->dx+1, (object->y2-object->y1)/object->dy+1, object->dx, object->dy, gd_element_properties[object->element].filename); case GD_JOIN: - return getStringPrint("Add=%d %d %s %s", object->dx, object->dy, gd_elements[object->element].filename, gd_elements[object->fill_element].filename); + return getStringPrint("Add=%d %d %s %s", object->dx, object->dy, gd_element_properties[object->element].filename, gd_element_properties[object->fill_element].filename); case GD_FLOODFILL_BORDER: - return getStringPrint("BoundaryFill=%d %d %s %s", object->x1, object->y1, gd_elements[object->fill_element].filename, gd_elements[object->element].filename); + return getStringPrint("BoundaryFill=%d %d %s %s", object->x1, object->y1, gd_element_properties[object->fill_element].filename, gd_element_properties[object->element].filename); case GD_FLOODFILL_REPLACE: - return getStringPrint("FloodFill=%d %d %s %s", object->x1, object->y1, gd_elements[object->fill_element].filename, gd_elements[object->element].filename); + return getStringPrint("FloodFill=%d %d %s %s", object->x1, object->y1, gd_element_properties[object->fill_element].filename, gd_element_properties[object->element].filename); case GD_MAZE: case GD_MAZE_UNICURSAL: @@ -85,18 +85,18 @@ char *gd_object_get_bdcff(const GdObject *object) break; } - return getStringPrint("Maze=%d %d %d %d %d %d %d %d %d %d %d %d %s %s %s", object->x1, object->y1, object->x2, object->y2, object->dx, object->dy, object->horiz, object->seed[0], object->seed[1], object->seed[2], object->seed[3], object->seed[4], gd_elements[object->element].filename, gd_elements[object->fill_element].filename, type); + return getStringPrint("Maze=%d %d %d %d %d %d %d %d %d %d %d %d %s %s %s", object->x1, object->y1, object->x2, object->y2, object->dx, object->dy, object->horiz, object->seed[0], object->seed[1], object->seed[2], object->seed[3], object->seed[4], gd_element_properties[object->element].filename, gd_element_properties[object->fill_element].filename, type); case GD_RANDOM_FILL: - appendStringPrint(&str, "%s=%d %d %d %d %d %d %d %d %d %s", object->c64_random?"RandomFillC64":"RandomFill", object->x1, object->y1, object->x2, object->y2, object->seed[0], object->seed[1], object->seed[2], object->seed[3], object->seed[4], gd_elements[object->fill_element].filename); + appendStringPrint(&str, "%s=%d %d %d %d %d %d %d %d %d %s", object->c64_random?"RandomFillC64":"RandomFill", object->x1, object->y1, object->x2, object->y2, object->seed[0], object->seed[1], object->seed[2], object->seed[3], object->seed[4], gd_element_properties[object->fill_element].filename); // seed and initial fill for (j = 0; j < 4; j++) if (object->random_fill_probability[j] != 0) - appendStringPrint(&str, " %s %d", gd_elements[object->random_fill[j]].filename, object->random_fill_probability[j]); + appendStringPrint(&str, " %s %d", gd_element_properties[object->random_fill[j]].filename, object->random_fill_probability[j]); if (object->element != O_NONE) - appendStringPrint(&str, " %s", gd_elements[object->element].filename); + appendStringPrint(&str, " %s", gd_element_properties[object->element].filename); return str; diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index 793987e2..d2d0e0fa 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -545,77 +545,77 @@ Bitmap *gd_get_tile_bitmap(Bitmap *bitmap) // returns true if the element is a player static inline boolean el_player(const int element) { - return (gd_elements[element & O_MASK].properties & P_PLAYER) != 0; + return (gd_element_properties[element & O_MASK].properties & P_PLAYER) != 0; } #if 0 // returns true if the element is walkable static inline boolean el_walkable(const int element) { - return (gd_elements[element & O_MASK].properties & P_WALKABLE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_WALKABLE) != 0; } #endif // returns true if the element is diggable static inline boolean el_diggable(const int element) { - return (gd_elements[element & O_MASK].properties & P_DIGGABLE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_DIGGABLE) != 0; } #if 0 // returns true if the element is collectible static inline boolean el_collectible(const int element) { - return (gd_elements[element & O_MASK].properties & P_COLLECTIBLE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_COLLECTIBLE) != 0; } #endif // returns true if the element is pushable static inline boolean el_pushable(const int element) { - return (gd_elements[element & O_MASK].properties & P_PUSHABLE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_PUSHABLE) != 0; } // returns true if the element can move static inline boolean el_can_move(const int element) { - return (gd_elements[element & O_MASK].properties & P_CAN_MOVE) != 0; + return (gd_element_properties[element & O_MASK].properties & P_CAN_MOVE) != 0; } // returns true if the element can fall static inline boolean el_can_fall(const int element) { - return (gd_elements[element & O_MASK].properties & P_CAN_FALL) != 0; + return (gd_element_properties[element & O_MASK].properties & P_CAN_FALL) != 0; } // returns true if the element can grow static inline boolean el_can_grow(const int element) { - return (gd_elements[element & O_MASK].properties & P_CAN_GROW) != 0; + return (gd_element_properties[element & O_MASK].properties & P_CAN_GROW) != 0; } // returns true if the element can dig static inline boolean el_can_dig(const int element) { - return (gd_elements[element & O_MASK].properties & P_CAN_DIG) != 0; + return (gd_element_properties[element & O_MASK].properties & P_CAN_DIG) != 0; } // returns true if the element can fall static inline boolean el_falling(const int element) { - return (gd_elements[element & O_MASK].properties & P_FALLING) != 0; + return (gd_element_properties[element & O_MASK].properties & P_FALLING) != 0; } // returns true if the element is growing static inline boolean el_growing(const int element) { - return (gd_elements[element & O_MASK].properties & P_GROWING) != 0; + return (gd_element_properties[element & O_MASK].properties & P_GROWING) != 0; } // returns true if the element is exploding static inline boolean el_explosion(const int element) { - return (gd_elements[element & O_MASK].properties & P_EXPLOSION) != 0; + return (gd_element_properties[element & O_MASK].properties & P_EXPLOSION) != 0; } static inline boolean el_smooth_movable(const int element) @@ -748,7 +748,7 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d draw, frame, new_x, new_y, old_x, old_y, - gd_elements[draw].name); + gd_element_properties[draw].name); } } #endif