2004-02-21
* "spring push bug" reintroduced as configurable element property
+ * fixed bug with missing properties for "mole"
+ * fixed bug that showed up when fixing the above "mole" properties bug
2004-02-17
* fixed bug which caused all CE change pages to be ignored which had
-#define COMPILE_DATE_STRING "[2004-02-21 13:33]"
+#define COMPILE_DATE_STRING "[2004-02-21 21:18]"
int x_right = gi_up->x + gi_up->width + xoffset_right;
int y_above = gi_down->y - yoffset_above;
int x = gi_down->x;
- int y = gi_up->y + yoffset;
+ int y; /* set after gadget position was modified */
#endif
-#if 1
- /* special case needed for "score" counter gadget */
+ /* set position for "score" counter gadget */
if (id == ED_COUNTER_ID_ELEMENT_SCORE)
{
ModifyGadget(gi_down, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
ModifyGadget(gi_text, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
ModifyGadget(gi_up, GDI_Y, SY + counterbutton_info[id].y, GDI_END);
- y = gi_up->y + yoffset;
}
-#endif
+
+ y = gi_up->y + yoffset;
if (counterbutton_info[id].text_above)
DrawText(x, y_above, counterbutton_info[id].text_above, FONT_TEXT_1);
int yoffset = ED_BORDER_SIZE;
int x_left = gi->x - xoffset_left;
int x_right = gi->x + gi->width + xoffset_right;
- int y = gi->y + yoffset;
+ int y; /* set after gadget position was modified */
- /* special case needed for "stickybutton" and "can move into acid" gadgets */
+ /* set position for "stickybutton" and "can move into acid" gadgets */
if (id == ED_CHECKBUTTON_ID_STICK_ELEMENT ||
id == ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID)
- {
- ModifyGadget(gi, GDI_CHECKED, *checkbutton_info[id].value,
- GDI_Y, SY + checkbutton_info[id].y, GDI_END);
- y = gi->y + yoffset;
- }
+ ModifyGadget(gi, GDI_Y, SY + checkbutton_info[id].y, GDI_END);
+
+ y = gi->y + yoffset;
if (checkbutton_info[id].text_left)
DrawText(x_left, y, checkbutton_info[id].text_left, FONT_TEXT_1);
if (checkbutton_info[id].text_right)
DrawText(x_right, y, checkbutton_info[id].text_right, FONT_TEXT_1);
+ ModifyGadget(gi, GDI_CHECKED, *checkbutton_info[id].value, GDI_END);
+
MapGadget(gi);
}
static void CopyClassicElementPropertiesToEditor(int element)
{
+#if 1
+ if (COULD_MOVE_INTO_ACID(element))
+ custom_element_properties[EP_CAN_MOVE_INTO_ACID] =
+ getMoveIntoAcidProperty(&level, element);
+
+#else
+
if (COULD_MOVE_INTO_ACID(element))
{
int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
custom_element_properties[EP_CAN_MOVE_INTO_ACID] =
((level.can_move_into_acid & (1 << bit_nr)) != 0);
}
+#endif
}
static void CopyElementPropertiesToEditor(int element)
static void CopyClassicElementPropertiesToGame(int element)
{
+#if 1
+ if (COULD_MOVE_INTO_ACID(element))
+ setMoveIntoAcidProperty(&level, element,
+ custom_element_properties[EP_CAN_MOVE_INTO_ACID]);
+#else
+
if (COULD_MOVE_INTO_ACID(element))
{
int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
level.can_move_into_acid |= (1 << bit_nr);
}
}
+#endif
}
static void CopyElementPropertiesToGame(int element)
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
if (COULD_MOVE_INTO_ACID(properties_element) &&
- !IS_CUSTOM_ELEMENT(properties_element))
+ (!IS_CUSTOM_ELEMENT(properties_element) ||
+ edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2))
{
checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
- ED_SETTINGS_YPOS(HAS_CONTENT(properties_element) ? 1 : 0);
+ ED_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 :
+ HAS_CONTENT(properties_element) ? 1 : 0);
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID);
}
}
else if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2)
{
+ /* set position for special checkbutton for "can move into acid" */
+
/* draw checkbutton gadgets */
for (i = ED_CHECKBUTTON_ID_CUSTOM2_FIRST;
i <= ED_CHECKBUTTON_ID_CUSTOM2_LAST; i++)
#define CHUNK_SIZE_NONE -1 /* do not write chunk size */
#define FILE_VERS_CHUNK_SIZE 8 /* size of file version chunk */
#define LEVEL_HEADER_SIZE 80 /* size of level file header */
-#define LEVEL_HEADER_UNUSED 10 /* unused level header bytes */
+#define LEVEL_HEADER_UNUSED 8 /* unused level header bytes */
#define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */
#define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */
#define LEVEL_CHUNK_CNT3_HEADER 16 /* size of level CNT3 header */
change->post_change_function = NULL;
}
-static void setMoveIntoAcid(struct LevelInfo *level, int element)
-{
- int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
-
- if (bit_nr > -1)
- level->can_move_into_acid |= (1 << bit_nr);
-}
-
static void setLevelInfoToDefaults(struct LevelInfo *level)
{
int i, j, x, y;
level->em_slippery_gems = FALSE;
level->block_last_field = FALSE;
level->sp_block_last_field = TRUE;
+
level->use_spring_bug = FALSE;
level->can_move_into_acid = ~0; /* everything can move into acid */
for (j = 0; j < NUM_EP_BITFIELDS; j++)
Properties[element][j] = EP_BITMASK_DEFAULT;
+ /* now set default properties */
+ SET_PROPERTY(element, EP_CAN_MOVE_INTO_ACID, TRUE);
+
element_info[element].modified_settings = FALSE;
}
else if (IS_GROUP_ELEMENT(element) || element == EL_INTERNAL_EDITOR)
level->use_spring_bug = (getFile8Bit(file) == 1 ? TRUE : FALSE);
+ level->can_move_into_acid = getFile16BitBE(file);
+
ReadUnusedBytesFromFile(file, LEVEL_HEADER_UNUSED);
return chunk_size;
if (level->game_version < VERSION_IDENT(3,0,9,0))
{
+ int i;
+
level->can_move_into_acid = 0; /* nothing can move into acid */
- setMoveIntoAcid(level, EL_ROBOT);
- setMoveIntoAcid(level, EL_SATELLITE);
- setMoveIntoAcid(level, EL_PENGUIN);
- setMoveIntoAcid(level, EL_BALLOON);
+ setMoveIntoAcidProperty(level, EL_ROBOT, TRUE);
+ setMoveIntoAcidProperty(level, EL_SATELLITE, TRUE);
+ setMoveIntoAcidProperty(level, EL_PENGUIN, TRUE);
+ setMoveIntoAcidProperty(level, EL_BALLOON, TRUE);
+
+ for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
+ SET_PROPERTY(EL_CUSTOM_START + i, EP_CAN_MOVE_INTO_ACID, TRUE);
}
}
else
putFile8Bit(file, (level->use_spring_bug ? 1 : 0));
+ putFile16BitBE(file, level->can_move_into_acid);
+
WriteUnusedBytesToFile(file, LEVEL_HEADER_UNUSED);
}
#define GET_MAX_MOVE_DELAY(e) ( (element_info[e].move_delay_fixed) + \
(element_info[e].move_delay_random))
-#if 1
#define ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
(condition) || \
(DONT_COLLIDE_WITH(e) && \
IS_PLAYER(x, y) && \
!PLAYER_ENEMY_PROTECTED(x, y))))
-#else
-#define ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, condition) \
+
+#define ELEMENT_CAN_ENTER_FIELD_GENERIC_X(e, x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
(condition) || \
+ (CAN_MOVE_INTO_ACID(e) && \
+ Feld[x][y] == EL_ACID) || \
(DONT_COLLIDE_WITH(e) && \
- IS_FREE_OR_PLAYER(x, y))))
-#endif
+ IS_PLAYER(x, y) && \
+ !PLAYER_ENEMY_PROTECTED(x, y))))
#define ELEMENT_CAN_ENTER_FIELD_GENERIC_2(x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
Feld[x][y] == EL_EXIT_OPEN || \
Feld[x][y] == EL_ACID))
-#if 0
-#if 1
-#define MAZE_RUNNER_CAN_ENTER_FIELD(x, y) \
- (IN_LEV_FIELD(x, y) && IS_FREE(x, y))
-#else
-#define MAZE_RUNNER_CAN_ENTER_FIELD(x, y) \
- (IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
- IS_FOOD_DARK_YAMYAM(Feld[x][y])))
-#endif
-#endif
-
#define GROUP_NR(e) ((e) - EL_GROUP_START)
#define MOVE_ENTER_EL(e) (element_info[e].move_enter_element)
#define IS_IN_GROUP(e, nr) (element_info[e].in_group[nr] == TRUE)
#define IS_EQUAL_OR_IN_GROUP(e, ge) \
(IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
-#if 1
#define CE_ENTER_FIELD_COND(e, x, y) \
(!IS_PLAYER(x, y) && \
(Feld[x][y] == EL_ACID || \
IS_EQUAL_OR_IN_GROUP(Feld[x][y], MOVE_ENTER_EL(e))))
-#else
-#define CE_ENTER_FIELD_COND(e, x, y) \
+
+#define CE_ENTER_FIELD_COND_X(e, x, y) \
(!IS_PLAYER(x, y) && \
- (Feld[x][y] == EL_ACID || \
- Feld[x][y] == MOVE_ENTER_EL(e) || \
- (IS_GROUP_ELEMENT(MOVE_ENTER_EL(e)) && \
- IS_IN_GROUP_EL(Feld[x][y], MOVE_ENTER_EL(e)))))
-#endif
+ IS_EQUAL_OR_IN_GROUP(Feld[x][y], MOVE_ENTER_EL(e)))
#define CUSTOM_ELEMENT_CAN_ENTER_FIELD(e, x, y) \
- ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, CE_ENTER_FIELD_COND(e, x, y))
+ ELEMENT_CAN_ENTER_FIELD_GENERIC_X(e, x, y, CE_ENTER_FIELD_COND_X(e, x, y))
#define MOLE_CAN_ENTER_FIELD(x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || (condition)))
#endif
}
+#if 1
+ else if (CAN_MOVE_INTO_ACID(element) && MovDir[x][y] == MV_DOWN &&
+ IN_LEV_FIELD(newx, newy) && Feld[newx][newy] == EL_ACID)
+
+#else
+
else if ((element == EL_PENGUIN ||
element == EL_ROBOT ||
element == EL_SATELLITE ||
IS_CUSTOM_ELEMENT(element)) &&
IN_LEV_FIELD(newx, newy) &&
MovDir[x][y] == MV_DOWN && Feld[newx][newy] == EL_ACID)
+#endif
{
SplashAcid(x, y);
Store[x][y] = EL_ACID;
InitGameModeMusicInfo(); /* game mode music mapping */
}
+static int get_special_property_bit(int element, int base_property_bit)
+{
+ static struct
+ {
+ int element;
+ int bit_nr;
+ } pb_can_move_into_acid[] =
+ {
+ { EL_BUG, 0 },
+ { EL_BUG_LEFT, 0 },
+ { EL_BUG_RIGHT, 0 },
+ { EL_BUG_UP, 0 },
+ { EL_BUG_DOWN, 0 },
+ { EL_SPACESHIP, 0 },
+ { EL_SPACESHIP_LEFT, 0 },
+ { EL_SPACESHIP_RIGHT, 0 },
+ { EL_SPACESHIP_UP, 0 },
+ { EL_SPACESHIP_DOWN, 0 },
+ { EL_BD_BUTTERFLY, 1 },
+ { EL_BD_BUTTERFLY_LEFT, 1 },
+ { EL_BD_BUTTERFLY_RIGHT, 1 },
+ { EL_BD_BUTTERFLY_UP, 1 },
+ { EL_BD_BUTTERFLY_DOWN, 1 },
+ { EL_BD_FIREFLY, 1 },
+ { EL_BD_FIREFLY_LEFT, 1 },
+ { EL_BD_FIREFLY_RIGHT, 1 },
+ { EL_BD_FIREFLY_UP, 1 },
+ { EL_BD_FIREFLY_DOWN, 1 },
+ { EL_YAMYAM, 2 },
+ { EL_DARK_YAMYAM, 2 },
+ { EL_ROBOT, 3 },
+ { EL_PACMAN, 4 },
+ { EL_PACMAN_LEFT, 4 },
+ { EL_PACMAN_RIGHT, 4 },
+ { EL_PACMAN_UP, 4 },
+ { EL_PACMAN_DOWN, 4 },
+ { EL_MOLE, 4 },
+ { EL_MOLE_LEFT, 4 },
+ { EL_MOLE_RIGHT, 4 },
+ { EL_MOLE_UP, 4 },
+ { EL_MOLE_DOWN, 4 },
+ { EL_PENGUIN, 5 },
+ { EL_PIG, 6 },
+ { EL_DRAGON, 6 },
+ { EL_SATELLITE, 7 },
+ { EL_SP_SNIKSNAK, 8 },
+ { EL_SP_ELECTRON, 8 },
+ { EL_BALLOON, 9 },
+
+ { -1, 0 },
+ };
+ int i;
+
+ if (base_property_bit != EP_CAN_MOVE_INTO_ACID)
+ return -1;
+
+ for (i = 0; pb_can_move_into_acid[i].element != -1; i++)
+ if (pb_can_move_into_acid[i].element == element)
+ return pb_can_move_into_acid[i].bit_nr;
+
+ return -1;
+}
+
+void setMoveIntoAcidProperty(struct LevelInfo *level, int element, boolean set)
+{
+ int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
+
+ if (bit_nr > -1)
+ {
+ level->can_move_into_acid &= ~(1 << bit_nr);
+
+ if (set)
+ level->can_move_into_acid |= (1 << bit_nr);
+ }
+}
+
+boolean getMoveIntoAcidProperty(struct LevelInfo *level, int element)
+{
+ int bit_nr = get_special_property_bit(element, EP_CAN_MOVE_INTO_ACID);
+
+ if (bit_nr > -1)
+ return ((level->can_move_into_acid & (1 << bit_nr)) != 0);
+
+ return FALSE;
+}
+
void InitElementPropertiesStatic()
{
static int ep_diggable[] =
EL_PACMAN_LEFT, EL_PACMAN_RIGHT,
EL_PACMAN_UP, EL_PACMAN_DOWN
},
-#if 1
{
EL_MOLE,
EL_MOLE_LEFT, EL_MOLE_RIGHT,
EL_MOLE_UP, EL_MOLE_DOWN
},
-#endif
{
-1,
-1, -1, -1, -1
i == EL_BLACK_ORB));
/* ---------- COULD_MOVE_INTO_ACID ------------------------------------- */
- SET_PROPERTY(i, EP_COULD_MOVE_INTO_ACID, (CAN_MOVE(i) && i != EL_SPRING));
+ SET_PROPERTY(i, EP_COULD_MOVE_INTO_ACID, ((CAN_MOVE(i) && i != EL_SPRING)||
+ IS_CUSTOM_ELEMENT(i)));
+
+ /* ---------- CAN_MOVE_INTO_ACID --------------------------------------- */
+ if (getMoveIntoAcidProperty(&level, i))
+ SET_PROPERTY(i, EP_CAN_MOVE_INTO_ACID, TRUE);
/* ---------- SP_PORT -------------------------------------------------- */
SET_PROPERTY(i, EP_SP_PORT, (IS_SP_ELEMENT(i) &&
InitElementGraphicInfo();
}
-int get_special_property_bit(int element, int base_property_bit)
-{
- static struct
- {
- int element;
- int bit_nr;
- } pb_can_move_into_acid[] =
- {
- { EL_BUG, 0 },
- { EL_BUG_LEFT, 0 },
- { EL_BUG_RIGHT, 0 },
- { EL_BUG_UP, 0 },
- { EL_BUG_DOWN, 0 },
- { EL_SPACESHIP, 0 },
- { EL_SPACESHIP_LEFT, 0 },
- { EL_SPACESHIP_RIGHT, 0 },
- { EL_SPACESHIP_UP, 0 },
- { EL_SPACESHIP_DOWN, 0 },
- { EL_BD_BUTTERFLY, 1 },
- { EL_BD_BUTTERFLY_LEFT, 1 },
- { EL_BD_BUTTERFLY_RIGHT, 1 },
- { EL_BD_BUTTERFLY_UP, 1 },
- { EL_BD_BUTTERFLY_DOWN, 1 },
- { EL_BD_FIREFLY, 1 },
- { EL_BD_FIREFLY_LEFT, 1 },
- { EL_BD_FIREFLY_RIGHT, 1 },
- { EL_BD_FIREFLY_UP, 1 },
- { EL_BD_FIREFLY_DOWN, 1 },
- { EL_YAMYAM, 2 },
- { EL_DARK_YAMYAM, 2 },
- { EL_ROBOT, 3 },
- { EL_PACMAN, 4 },
- { EL_PACMAN_LEFT, 4 },
- { EL_PACMAN_RIGHT, 4 },
- { EL_PACMAN_UP, 4 },
- { EL_PACMAN_DOWN, 4 },
- { EL_MOLE, 4 },
- { EL_MOLE_LEFT, 4 },
- { EL_MOLE_RIGHT, 4 },
- { EL_MOLE_UP, 4 },
- { EL_MOLE_DOWN, 4 },
- { EL_PENGUIN, 5 },
- { EL_PIG, 6 },
- { EL_DRAGON, 6 },
- { EL_SATELLITE, 7 },
- { EL_SP_SNIKSNAK, 8 },
- { EL_SP_ELECTRON, 8 },
- { EL_BALLOON, 9 },
-
- { -1, 0 },
- };
- int i;
-
- if (base_property_bit != EP_CAN_MOVE_INTO_ACID)
- return -1;
-
- for (i = 0; pb_can_move_into_acid[i].element != -1; i++)
- if (pb_can_move_into_acid[i].element == element)
- return pb_can_move_into_acid[i].bit_nr;
-
- return -1;
-}
-
static void InitGlobal()
{
global.autoplay_leveldir = NULL;
#include "main.h"
+void setMoveIntoAcidProperty(struct LevelInfo *, int, boolean);
+boolean getMoveIntoAcidProperty(struct LevelInfo *, int);
void InitElementPropertiesStatic(void);
void InitElementPropertiesEngine(int);
-int get_special_property_bit(int, int);
void ReloadCustomArtwork(int);
stepsize = 20; /* must be choosen to always draw last frame */
door_delay_value = 0;
+#if 0
StopSound(SND_DOOR_OPENING);
StopSound(SND_DOOR_CLOSING);
+#endif
}
if (global.autoplay_leveldir)
door_1.anim_mode == ANIM_VERTICAL ? DYSIZE : DXSIZE);
int x;
- if (!(door_state & DOOR_NO_DELAY))
+ if (!(door_state & DOOR_NO_DELAY) && !setup.quick_doors)
{
/* opening door sound has priority over simultaneously closing door */
if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2))
}
}
+#if 0
if (setup.quick_doors)
{
StopSound(SND_DOOR_OPENING);
StopSound(SND_DOOR_CLOSING);
}
+#endif
if (door_state & DOOR_ACTION_1)
door1 = door_state & DOOR_ACTION_1;