* added option "use explosion from element" for player explosions
2005-12-30
+ * added cascaded element lists in the level editor
* added possibility for multiple CE changes per frame (experimental)
2005-12-28
-#define COMPILE_DATE_STRING "[2006-01-02 02:52]"
+#define COMPILE_DATE_STRING "[2006-01-02 21:04]"
return new_index_value;
}
+static void setSelectboxSpecialActionVariablesIfNeeded()
+{
+ int i;
+
+ /* change action mode and arg variables according to action type variable */
+ for (i = 0; action_arg_options[i].value != -1; i++)
+ {
+ if (action_arg_options[i].value == custom_element_change.action_type)
+ {
+ int mode = action_arg_options[i].mode;
+
+ /* only change if corresponding selectbox has changed */
+ if (selectbox_info[ED_SELECTBOX_ID_ACTION_MODE].options !=
+ action_arg_modes[mode])
+ custom_element_change.action_mode = -1;
+
+ /* only change if corresponding selectbox has changed */
+ if (selectbox_info[ED_SELECTBOX_ID_ACTION_ARG].options !=
+ action_arg_options[i].options)
+ custom_element_change.action_arg = -1;
+
+ break;
+ }
+ }
+}
+
static void setSelectboxSpecialActionOptions()
{
int i;
action_arg_options[i].options);
ModifyEditorSelectboxValue(ED_SELECTBOX_ID_ACTION_ARG,
custom_element_change.action_arg);
+ break;
}
}
}
DrawPropertiesChangeDrawingAreas();
}
-static void DrawElementName(int x, int y, int element)
+static void DrawEditorElementAnimation(int x, int y)
+{
+ int graphic = el2img(properties_element);
+ int frame = (ANIM_MODE(graphic) == ANIM_CE_VALUE ?
+ custom_element.ce_value_fixed_initial :
+ ANIM_MODE(graphic) == ANIM_CE_SCORE ?
+ custom_element.collect_score_initial : FrameCounter);
+
+ DrawGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
+}
+
+static void DrawEditorElementName(int x, int y, int element)
{
char *element_name = getElementInfoText(element);
int font_nr = FONT_TEXT_1;
"Element Settings", FONT_TITLE_1);
#endif
+#if 1
+ FrameCounter = 0; /* restart animation frame counter */
+#endif
+
DrawElementBorder(SX + xstart * MINI_TILEX,
SY + ystart * MINI_TILEY + MINI_TILEY / 2,
TILEX, TILEY, FALSE);
+#if 1
+ DrawEditorElementAnimation(SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY + MINI_TILEY / 2);
+#else
DrawGraphicAnimationExt(drawto,
SX + xstart * MINI_TILEX,
SY + ystart * MINI_TILEY + MINI_TILEY / 2,
el2img(properties_element), -1, NO_MASKING);
+#endif
+#if 0
FrameCounter = 0; /* restart animation frame counter */
+#endif
- DrawElementName((xstart + 3) * MINI_TILEX + 1, (ystart + 1) * MINI_TILEY + 1,
- properties_element);
+ DrawEditorElementName((xstart + 3) * MINI_TILEX + 1,
+ (ystart + 1) * MINI_TILEY + 1,
+ properties_element);
DrawPropertiesTabulatorGadgets();
{
if (type_id == ED_SELECTBOX_ID_ACTION_TYPE)
{
- /* when changing action type, reset action mode and action arg */
+ /* when changing action type, also check action mode and action arg */
if (value_old != value_new)
{
+#if 1
+ setSelectboxSpecialActionVariablesIfNeeded();
+#else
custom_element_change.action_mode = -1;
custom_element_change.action_arg = -1;
+#endif
}
DrawPropertiesChange();
if (!DelayReached(&action_delay, action_delay_value))
return;
+#if 1
+ DrawEditorElementAnimation(SX + xpos * TILEX,
+ SY + ypos * TILEY + MINI_TILEY / 2);
+#else
DrawGraphicAnimationExt(drawto,
SX + xpos * TILEX,
SY + ypos * TILEY + MINI_TILEY / 2,
el2img(properties_element), -1, NO_MASKING);
+#endif
MarkTileDirty(xpos, ypos);
MarkTileDirty(xpos, ypos + 1);
RND(element_info[e].ce_value_random_initial))
#define GET_CHANGE_DELAY(c) ( ((c)->delay_fixed * (c)->delay_frames) + \
RND((c)->delay_random * (c)->delay_frames))
+#define GET_CE_DELAY_VALUE(c) ( ((c)->delay_fixed) + \
+ RND((c)->delay_random))
#define GET_TARGET_ELEMENT(e, ch) \
((e) == EL_TRIGGER_ELEMENT ? (ch)->actual_trigger_element : \
i == EL_BD_BUTTERFLY ? EL_BD_DIAMOND :
i == EL_SP_ELECTRON ? EL_SP_INFOTRON :
i == EL_AMOEBA_TO_DIAMOND ? level.amoeba_content :
- i == EL_YAMYAM ? EL_UNDEFINED :
i == EL_WALL_EMERALD ? EL_EMERALD :
i == EL_WALL_DIAMOND ? EL_DIAMOND :
i == EL_WALL_BD_DIAMOND ? EL_BD_DIAMOND :
Store[x][y] = level.yamyam_content[game.yamyam_content_nr].e[xx][yy];
else if (element_info[center_element].content.e[xx][yy] != EL_EMPTY)
Store[x][y] = element_info[center_element].content.e[xx][yy];
+#if 1
+ /* needed because EL_BD_BUTTERFLY is not defined as "CAN_EXPLODE"
+ (killing EL_BD_BUTTERFLY with dynamite would result in BD diamond
+ otherwise) -- FIX THIS !!! */
+ else if (!CAN_EXPLODE(element) && element != EL_BD_BUTTERFLY)
+ Store[x][y] = element_info[element].content.e[1][1];
+#else
else if (!CAN_EXPLODE(element))
Store[x][y] = element_info[element].content.e[1][1];
+#endif
else
Store[x][y] = EL_EMPTY;
#else
{
static struct
{
- int x, y;
+ int dx, dy;
} move_xy[] =
{
{ 0, 0 },
int right_dir = turn[old_move_dir].right;
int back_dir = turn[old_move_dir].back;
- int left_dx = move_xy[left_dir].x, left_dy = move_xy[left_dir].y;
- int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y;
- int move_dx = move_xy[old_move_dir].x, move_dy = move_xy[old_move_dir].y;
- int back_dx = move_xy[back_dir].x, back_dy = move_xy[back_dir].y;
+ int left_dx = move_xy[left_dir].dx, left_dy = move_xy[left_dir].dy;
+ int right_dx = move_xy[right_dir].dx, right_dy = move_xy[right_dir].dy;
+ int move_dx = move_xy[old_move_dir].dx, move_dy = move_xy[old_move_dir].dy;
+ int back_dx = move_xy[back_dir].dx, back_dy = move_xy[back_dir].dy;
int left_x = x + left_dx, left_y = y + left_dy;
int right_x = x + right_dx, right_y = y + right_dy;
else
MovDir[x][y] = back_dir;
- xx = x + move_xy[MovDir[x][y]].x;
- yy = y + move_xy[MovDir[x][y]].y;
+ xx = x + move_xy[MovDir[x][y]].dx;
+ yy = y + move_xy[MovDir[x][y]].dy;
if (!IN_LEV_FIELD(xx, yy) ||
(!IS_FREE(xx, yy) && !IS_FOOD_PIG(Feld[xx][yy])))
else
MovDir[x][y] = back_dir;
- xx = x + move_xy[MovDir[x][y]].x;
- yy = y + move_xy[MovDir[x][y]].y;
+ xx = x + move_xy[MovDir[x][y]].dx;
+ yy = y + move_xy[MovDir[x][y]].dy;
if (!IN_LEV_FIELD_AND_IS_FREE(xx, yy))
MovDir[x][y] = old_move_dir;
MovDelay[newx][newy] = 0;
+#if 1
+ if (CAN_CHANGE_OR_HAS_ACTION(element))
+#else
if (CAN_CHANGE(element))
+#endif
{
/* copy element change control values to new field */
ChangeDelay[newx][newy] = ChangeDelay[x][y];
#else
action_arg == CA_ARG_NUMBER_CE_VALUE ? ei->custom_value_initial :
#endif
- action_arg == CA_ARG_NUMBER_CE_DELAY ? GET_CHANGE_DELAY(change) :
+ action_arg == CA_ARG_NUMBER_CE_DELAY ? GET_CE_DELAY_VALUE(change) :
action_arg == CA_ARG_NUMBER_LEVEL_TIME ? level_time_value :
action_arg == CA_ARG_NUMBER_LEVEL_GEMS ? local_player->gems_still_needed :
action_arg == CA_ARG_NUMBER_LEVEL_SCORE ? local_player->score :
change->actual_trigger_side = trigger_side;
change->actual_trigger_ce_value = CustomValue[x][y];
+ /* special case: trigger element not at (x,y) position for some events */
+ if (check_trigger_element)
+ {
+ static struct
+ {
+ int dx, dy;
+ } move_xy[] =
+ {
+ { 0, 0 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, 0 },
+ { 0, -1 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, +1 }
+ };
+
+ int xx = x + move_xy[MV_DIR_OPPOSITE(trigger_side)].dx;
+ int yy = y + move_xy[MV_DIR_OPPOSITE(trigger_side)].dy;
+
+ change->actual_trigger_ce_value = CustomValue[xx][yy];
+ }
+
if (change->can_change && !change_done)
{
ChangeDelay[x][y] = 1;
if (graphic_info[graphic].anim_global_sync)
GfxFrame[x][y] = FrameCounter;
+ else if (ANIM_MODE(graphic) == ANIM_CE_VALUE)
+ {
+ int old_gfx_frame = GfxFrame[x][y];
+
+ GfxFrame[x][y] = CustomValue[x][y];
+
+#if 1
+ if (GfxFrame[x][y] != old_gfx_frame)
+#endif
+ DrawLevelGraphicAnimation(x, y, graphic);
+ }
+ else if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
+ {
+ int old_gfx_frame = GfxFrame[x][y];
+
+ GfxFrame[x][y] = element_info[element].collect_score;
+
+#if 1
+ if (GfxFrame[x][y] != old_gfx_frame)
+#endif
+ DrawLevelGraphicAnimation(x, y, graphic);
+ }
if (ANIM_MODE(graphic) == ANIM_RANDOM &&
IS_NEXT_FRAME(GfxFrame[x][y], graphic))
printf("::: ChangeDelay == %d\n", ChangeDelay[x][y]);
#endif
+#if 0
+ if (element == EL_CUSTOM_255)
+ printf("::: ChangeDelay == %d\n", ChangeDelay[x][y]);
+#endif
+
#if 1
ChangeElement(x, y, page);
#else
else if (IS_ANIMATED(graphic) && !IS_CHANGING(x, y))
DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
+#if 0
+ if (element == EL_CUSTOM_255 ||
+ element == EL_CUSTOM_256)
+ DrawLevelGraphicAnimation(x, y, graphic);
+#endif
+
if (IS_BELT_ACTIVE(element))
PlayLevelSoundAction(x, y, ACTION_ACTIVE);
}
else if (strcmp(suffix, ".anim_mode") == 0)
{
- result = (string_has_parameter(value, "none") ? ANIM_NONE :
- string_has_parameter(value, "loop") ? ANIM_LOOP :
- string_has_parameter(value, "linear") ? ANIM_LINEAR :
- string_has_parameter(value, "pingpong") ? ANIM_PINGPONG :
- string_has_parameter(value, "pingpong2") ? ANIM_PINGPONG2 :
- string_has_parameter(value, "random") ? ANIM_RANDOM :
- string_has_parameter(value, "horizontal") ? ANIM_HORIZONTAL :
- string_has_parameter(value, "vertical") ? ANIM_VERTICAL :
+ result = (string_has_parameter(value, "none") ? ANIM_NONE :
+ string_has_parameter(value, "loop") ? ANIM_LOOP :
+ string_has_parameter(value, "linear") ? ANIM_LINEAR :
+ string_has_parameter(value, "pingpong") ? ANIM_PINGPONG :
+ string_has_parameter(value, "pingpong2") ? ANIM_PINGPONG2 :
+ string_has_parameter(value, "random") ? ANIM_RANDOM :
+ string_has_parameter(value, "ce_value") ? ANIM_CE_VALUE :
+ string_has_parameter(value, "ce_score") ? ANIM_CE_SCORE :
+ string_has_parameter(value, "horizontal") ? ANIM_HORIZONTAL :
+ string_has_parameter(value, "vertical") ? ANIM_VERTICAL :
ANIM_DEFAULT);
if (string_has_parameter(value, "reverse"))
#define ANIM_PINGPONG (1 << 2)
#define ANIM_PINGPONG2 (1 << 3)
#define ANIM_RANDOM (1 << 4)
-#define ANIM_REVERSE (1 << 5)
+#define ANIM_CE_VALUE (1 << 5)
+#define ANIM_CE_SCORE (1 << 6)
+#define ANIM_REVERSE (1 << 7)
/* values for special (non game element) animation modes */
-#define ANIM_HORIZONTAL (1 << 6)
-#define ANIM_VERTICAL (1 << 7)
+#define ANIM_HORIZONTAL (1 << 8)
+#define ANIM_VERTICAL (1 << 9)
#define ANIM_DEFAULT ANIM_LOOP
else
frame = gfx.anim_random_frame % num_frames;
}
+ else if (mode & (ANIM_CE_VALUE | ANIM_CE_SCORE))
+ {
+ frame = sync_frame % num_frames;
+ }
if (mode & ANIM_REVERSE) /* use reverse animation direction */
frame = num_frames - frame - 1;
#if 0
{ TYPE_STRING, NULL, "Offer Special Elements:"},
#endif
+
+#if 0
+#else
{ TYPE_SWITCH, &setup.editor.el_boulderdash, "BoulderDash:" },
{ TYPE_SWITCH, &setup.editor.el_emerald_mine, "Emerald Mine:" },
- { TYPE_SWITCH, &setup.editor.el_emerald_mine_club,"E.M. Club:" },
- { TYPE_SWITCH, &setup.editor.el_more, "More:" },
+ { TYPE_SWITCH, &setup.editor.el_emerald_mine_club,"E.M.C.:" },
+ { TYPE_SWITCH, &setup.editor.el_more, "R'n'D:" },
{ TYPE_SWITCH, &setup.editor.el_sokoban, "Sokoban:" },
{ TYPE_SWITCH, &setup.editor.el_supaplex, "Supaplex:" },
- { TYPE_SWITCH, &setup.editor.el_diamond_caves, "Diamd. Caves:" },
- { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX Boulderd.:" },
+ { TYPE_SWITCH, &setup.editor.el_diamond_caves, "DC II:" },
+ { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX BD:" },
+#endif
{ TYPE_SWITCH, &setup.editor.el_chars, "Characters:" },
{ TYPE_SWITCH, &setup.editor.el_custom, "Custom:" },
{ TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" },