{
{ CE_TOUCHED_BY_PLAYER, "touched by player" },
{ CE_PRESSED_BY_PLAYER, "pressed by player" },
+ { CE_SWITCHED_BY_PLAYER, "switched by player" },
+ { CE_SNAPPED_BY_PLAYER, "snapped by player" },
{ CE_PUSHED_BY_PLAYER, "pushed by player" },
{ CE_ENTERED_BY_PLAYER, "entered by player" },
{ CE_LEFT_BY_PLAYER, "left by player" },
{
{ CE_PLAYER_TOUCHES_X, "player touches" },
{ CE_PLAYER_PRESSES_X, "player presses" },
+ { CE_PLAYER_SWITCHES_X, "player switches" },
+ { CE_PLAYER_SNAPS_X, "player snaps" },
{ CE_PLAYER_PUSHES_X, "player pushes" },
{ CE_PLAYER_ENTERS_X, "player enters" },
{ CE_PLAYER_LEAVES_X, "player leaves" },
{ CE_SWITCH_OF_X, "switch of" },
{ CE_CHANGE_OF_X, "change by page of" },
{ CE_EXPLOSION_OF_X, "explosion of" },
+ { CE_MOVE_OF_X, "move of" },
{ CE_VALUE_GETS_ZERO_OF_X, "CE value gets 0 of" },
{ -1, NULL }
{ CA_ARG_ELEMENT_HEADLINE, "[element]" },
{ CA_ARG_ELEMENT_TARGET, "target" },
{ CA_ARG_ELEMENT_TRIGGER, "trigger" },
+ { CA_ARG_UNDEFINED, " " },
+ { CA_ARG_ELEMENT_RESET, "reset" },
{ -1, NULL }
};
custom_element_change.direct_action =
(HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_SWITCHED_BY_PLAYER) ? CE_SWITCHED_BY_PLAYER :
+ HAS_CHANGE_EVENT(element, CE_SNAPPED_BY_PLAYER) ? CE_SNAPPED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_ENTERED_BY_PLAYER) ? CE_ENTERED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER :
custom_element_change.other_action =
(HAS_CHANGE_EVENT(element, CE_PLAYER_TOUCHES_X) ? CE_PLAYER_TOUCHES_X :
HAS_CHANGE_EVENT(element, CE_PLAYER_PRESSES_X) ? CE_PLAYER_PRESSES_X :
+ HAS_CHANGE_EVENT(element, CE_PLAYER_SWITCHES_X) ? CE_PLAYER_SWITCHES_X :
+ HAS_CHANGE_EVENT(element, CE_PLAYER_SNAPS_X) ? CE_PLAYER_SNAPS_X :
HAS_CHANGE_EVENT(element, CE_PLAYER_PUSHES_X) ? CE_PLAYER_PUSHES_X :
HAS_CHANGE_EVENT(element, CE_PLAYER_ENTERS_X) ? CE_PLAYER_ENTERS_X :
HAS_CHANGE_EVENT(element, CE_PLAYER_LEAVES_X) ? CE_PLAYER_LEAVES_X :
HAS_CHANGE_EVENT(element, CE_SWITCH_OF_X) ? CE_SWITCH_OF_X :
HAS_CHANGE_EVENT(element, CE_CHANGE_OF_X) ? CE_CHANGE_OF_X :
HAS_CHANGE_EVENT(element, CE_EXPLOSION_OF_X) ? CE_EXPLOSION_OF_X :
+ HAS_CHANGE_EVENT(element, CE_MOVE_OF_X) ? CE_MOVE_OF_X :
HAS_CHANGE_EVENT(element, CE_VALUE_GETS_ZERO_OF_X) ? CE_VALUE_GETS_ZERO_OF_X :
custom_element_change.other_action);
}
/* set player change event from checkbox and selectbox */
custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_SWITCHED_BY_PLAYER] = FALSE;
+ custom_element_change_events[CE_SNAPPED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_PUSHED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
/* set other element action change event from checkbox and selectbox */
custom_element_change_events[CE_PLAYER_TOUCHES_X] = FALSE;
custom_element_change_events[CE_PLAYER_PRESSES_X] = FALSE;
+ custom_element_change_events[CE_PLAYER_SWITCHES_X] = FALSE;
+ custom_element_change_events[CE_PLAYER_SNAPS_X] = FALSE;
custom_element_change_events[CE_PLAYER_PUSHES_X] = FALSE;
custom_element_change_events[CE_PLAYER_ENTERS_X] = FALSE;
custom_element_change_events[CE_PLAYER_LEAVES_X] = FALSE;
custom_element_change_events[CE_SWITCH_OF_X] = FALSE;
custom_element_change_events[CE_CHANGE_OF_X] = FALSE;
custom_element_change_events[CE_EXPLOSION_OF_X] = FALSE;
+ custom_element_change_events[CE_MOVE_OF_X] = FALSE;
custom_element_change_events[CE_VALUE_GETS_ZERO_OF_X] = FALSE;
custom_element_change_events[custom_element_change.other_action] =
custom_element_change_events[CE_BY_OTHER_ACTION];
int gadget_id = drawingarea_info[drawingarea_id].gadget_id;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
+ drawingarea_info[drawingarea_id].area_xsize = xsize;
+ drawingarea_info[drawingarea_id].area_ysize = ysize;
+
ModifyGadget(gi, GDI_AREA_SIZE, xsize, ysize, GDI_END);
}
/* forward declaration for internal use */
+static void SetPlayerWaiting(struct PlayerInfo *, boolean);
static void AdvanceFrameAndPlayerCounters(int);
static boolean MovePlayerOneStep(struct PlayerInfo *, int, int, int, int);
}
else
{
- stored_player[0].use_murphy_graphic = TRUE;
+ stored_player[0].use_murphy = TRUE;
}
Feld[x][y] = EL_PLAYER_1;
access_direction_list[i].direction;
}
+int get_num_special_action(int element, int action_first, int action_last)
+{
+ int num_special_action = 0;
+ int i, j;
+
+ for (i = action_first; i <= action_last; i++)
+ {
+ boolean found = FALSE;
+
+ for (j = 0; j < NUM_DIRECTIONS; j++)
+ if (el_act_dir2img(element, i, j) !=
+ el_act_dir2img(element, ACTION_DEFAULT, j))
+ found = TRUE;
+
+ if (found)
+ num_special_action++;
+ else
+ break;
+ }
+
+ return num_special_action;
+}
/*
=============================================================================
boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */
- int i, j, k, x, y;
+ int i, j, x, y;
InitGameEngine();
player->Frame = 0;
player->StepFrame = 0;
- player->use_murphy_graphic = FALSE;
+ player->use_murphy = FALSE;
+ player->artwork_element = player->element_nr;
player->block_last_field = FALSE; /* initialized in InitPlayerField() */
player->block_delay_adjustment = 0; /* initialized in InitPlayerField() */
player->special_action_bored = ACTION_DEFAULT;
player->special_action_sleeping = ACTION_DEFAULT;
- player->num_special_action_bored = 0;
- player->num_special_action_sleeping = 0;
-
- /* determine number of special actions for bored and sleeping animation */
- for (j = ACTION_BORING_1; j <= ACTION_BORING_LAST; j++)
- {
- boolean found = FALSE;
-
- for (k = 0; k < NUM_DIRECTIONS; k++)
- if (el_act_dir2img(player->element_nr, j, k) !=
- el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
- found = TRUE;
-
- if (found)
- player->num_special_action_bored++;
- else
- break;
- }
- for (j = ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++)
- {
- boolean found = FALSE;
-
- for (k = 0; k < NUM_DIRECTIONS; k++)
- if (el_act_dir2img(player->element_nr, j, k) !=
- el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
- found = TRUE;
-
- if (found)
- player->num_special_action_sleeping++;
- else
- break;
- }
+ /* set number of special actions for bored and sleeping animation */
+ player->num_special_action_bored =
+ get_num_special_action(player->artwork_element,
+ ACTION_BORING_1, ACTION_BORING_LAST);
+ player->num_special_action_sleeping =
+ get_num_special_action(player->artwork_element,
+ ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
player->switch_x = -1;
player->switch_y = -1;
player->element_nr = some_player->element_nr;
#endif
+ player->artwork_element = some_player->artwork_element;
+
player->block_last_field = some_player->block_last_field;
player->block_delay_adjustment = some_player->block_delay_adjustment;
break;
}
- if (PLAYERINFO(ex, ey)->use_murphy_graphic)
+ if (PLAYERINFO(ex, ey)->use_murphy)
Store[x][y] = EL_EMPTY;
}
else if (center_element == EL_MOLE)
{
struct PlayerInfo *player = PLAYERINFO(x, y);
- element = Feld[x][y] = (player->use_murphy_graphic ? EL_SP_MURPHY :
+ element = Feld[x][y] = (player->use_murphy ? EL_SP_MURPHY :
player->element_nr);
}
if (pushed_by_player && !game.use_change_when_pushing_bug)
{
- int dig_side = MV_DIR_OPPOSITE(direction);
+ int push_side = MV_DIR_OPPOSITE(direction);
struct PlayerInfo *player = PLAYERINFO(x, y);
CheckElementChangeByPlayer(newx, newy, element, CE_PUSHED_BY_PLAYER,
- player->index_bit, dig_side);
+ player->index_bit, push_side);
CheckTriggeredElementChangeByPlayer(newx,newy, element, CE_PLAYER_PUSHES_X,
- player->index_bit, dig_side);
+ player->index_bit, push_side);
}
+ CheckTriggeredElementChangeBySide(x, y, element, CE_MOVE_OF_X, direction);
+
TestIfElementTouchesCustomElement(x, y); /* empty or new element */
TestIfElementHitsCustomElement(newx, newy, direction);
{
for (i = 0; i < MAX_PLAYERS; i++)
{
- int element = action_arg_element;
+ if (trigger_player_bits & (1 << i))
+ {
+ int artwork_element = action_arg_element;
+
+ if (action_arg == CA_ARG_ELEMENT_RESET)
+ artwork_element = stored_player[i].element_nr;
+
+ stored_player[i].artwork_element = artwork_element;
+
+ SetPlayerWaiting(&stored_player[i], FALSE);
+
+ /* set number of special actions for bored and sleeping animation */
+ stored_player[i].num_special_action_bored =
+ get_num_special_action(artwork_element,
+ ACTION_BORING_1, ACTION_BORING_LAST);
+ stored_player[i].num_special_action_sleeping =
+ get_num_special_action(artwork_element,
+ ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
+ }
}
break;
static void PlayPlayerSound(struct PlayerInfo *player)
{
int jx = player->jx, jy = player->jy;
- int element = player->element_nr;
+ int sound_element = player->artwork_element;
int last_action = player->last_action_waiting;
int action = player->action_waiting;
if (player->is_waiting)
{
if (action != last_action)
- PlayLevelSoundElementAction(jx, jy, element, action);
+ PlayLevelSoundElementAction(jx, jy, sound_element, action);
else
- PlayLevelSoundElementActionIfLoop(jx, jy, element, action);
+ PlayLevelSoundElementActionIfLoop(jx, jy, sound_element, action);
}
else
{
if (action != last_action)
- StopSound(element_info[element].sound[last_action]);
+ StopSound(element_info[sound_element].sound[last_action]);
if (last_action == ACTION_SLEEPING)
- PlayLevelSoundElementAction(jx, jy, element, ACTION_AWAKENING);
+ PlayLevelSoundElementAction(jx, jy, sound_element, ACTION_AWAKENING);
}
}
last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ?
last_special_action + 1 : ACTION_SLEEPING);
int special_graphic =
- el_act_dir2img(player->element_nr, special_action, move_dir);
+ el_act_dir2img(player->artwork_element, special_action, move_dir);
player->anim_delay_counter =
graphic_info[special_graphic].anim_delay_fixed +
int special_action =
ACTION_BORING_1 + SimpleRND(player->num_special_action_bored);
int special_graphic =
- el_act_dir2img(player->element_nr, special_action, move_dir);
+ el_act_dir2img(player->artwork_element, special_action, move_dir);
player->anim_delay_counter =
graphic_info[special_graphic].anim_delay_fixed +
{
RemoveField(x, y);
DrawLevelField(x, y);
+
+ TestIfElementTouchesCustomElement(x, y); /* for empty space */
}
}
#endif
CheckTriggeredElementChangeByPlayer(jx, jy, new_element,
CE_PLAYER_ENTERS_X,
player->index_bit, enter_side);
+
+ CheckTriggeredElementChangeBySide(jx, jy, player->element_nr,
+ CE_MOVE_OF_X, move_direction);
}
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
if (!player->active)
return;
- PlayLevelSoundElementAction(jx, jy, player->element_nr, ACTION_DYING);
+ PlayLevelSoundElementAction(jx, jy, player->artwork_element, ACTION_DYING);
PlayLevelSound(jx, jy, SND_GAME_LOSING);
player->GameOver = TRUE;
if (mode == DF_SNAP && !IS_SNAPPABLE(element) &&
game.engine_version >= VERSION_IDENT(2,2,0,0))
+ {
+ CheckElementChangeByPlayer(x, y, element, CE_SNAPPED_BY_PLAYER,
+ player->index_bit, dig_side);
+ CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+ player->index_bit, dig_side);
+
+ if (Feld[x][y] != element) /* field changed by snapping */
+ return MF_ACTION;
+
return MF_NO_ACTION;
+ }
if (game.gravity && is_player && !player->is_auto_moving &&
canFallDown(player) && move_direction != MV_DOWN &&
if (element_info[sound_element].sound[sound_action] != SND_UNDEFINED)
PlayLevelSoundElementAction(x, y, sound_element, sound_action);
else
- PlayLevelSoundElementAction(x, y, player->element_nr, sound_action);
+ PlayLevelSoundElementAction(x, y, player->artwork_element, sound_action);
}
else if (IS_PASSABLE(element) && canPassField(x, y, move_direction))
{
if (mode == DF_SNAP)
{
- TestIfElementTouchesCustomElement(x, y); /* for empty space */
-
#if USE_NEW_SNAP_DELAY
if (level.block_snap_field)
setFieldForSnapping(x, y, element, move_direction);
+ else
+ TestIfElementTouchesCustomElement(x, y); /* for empty space */
+#else
+ TestIfElementTouchesCustomElement(x, y); /* for empty space */
#endif
+
+ CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+ player->index_bit, dig_side);
}
}
else if (IS_COLLECTIBLE(element))
if (mode == DF_SNAP)
{
- TestIfElementTouchesCustomElement(x, y); /* for empty space */
-
#if USE_NEW_SNAP_DELAY
if (level.block_snap_field)
setFieldForSnapping(x, y, element, move_direction);
+ else
+ TestIfElementTouchesCustomElement(x, y); /* for empty space */
+#else
+ TestIfElementTouchesCustomElement(x, y); /* for empty space */
#endif
+
+ CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+ player->index_bit, dig_side);
}
}
else if (IS_PUSHABLE(element))
CheckTriggeredElementChangeByPlayer(x, y, element, CE_SWITCH_OF_X,
player->index_bit, dig_side);
+ CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SWITCHES_X,
+ player->index_bit, dig_side);
+
CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PRESSES_X,
player->index_bit, dig_side);
player->index_bit, dig_side);
CheckTriggeredElementChangeByPlayer(x, y, element, CE_SWITCH_OF_X,
player->index_bit, dig_side);
+
+ CheckElementChangeByPlayer(x, y, element, CE_SWITCHED_BY_PLAYER,
+ player->index_bit, dig_side);
+ CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SWITCHES_X,
+ player->index_bit, dig_side);
}
CheckElementChangeByPlayer(x, y, element, CE_PRESSED_BY_PLAYER,