static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
static void TestIfElementHitsCustomElement(int, int, int);
+#if 0
+static void TestIfElementSmashesCustomElement(int, int, int);
+#endif
static void ChangeElement(int, int, int);
some_player->present = FALSE;
some_player->active = FALSE;
+#if 0
+ player->element_nr = some_player->element_nr;
+#endif
+
StorePlayer[jx][jy] = player->element_nr;
player->jx = player->last_jx = jx;
player->jy = player->last_jy = jy;
{
int center_element = Feld[ex][ey];
+#if 0
+ printf("::: start explosion %d,%d [%d]\n", ex, ey, FrameCounter);
+#endif
+
#if 0
/* --- This is only really needed (and now handled) in "Impact()". --- */
/* do not explode moving elements that left the explode field in time */
{
int element;
+#if 0
+ printf("::: explosion %d,%d done [%d]\n", x, y, FrameCounter);
+#endif
+
element = Feld[x][y] = Store[x][y];
Store[x][y] = Store2[x][y] = 0;
GfxElement[x][y] = EL_UNDEFINED;
}
else
{
+#if 0
+ TestIfElementSmashesCustomElement(x, y, MV_DOWN);
+#endif
+
CheckElementChange(x, y + 1, smashed, CE_SMASHED);
CheckTriggeredElementChangeSide(x, y + 1, smashed,
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
+#if 1
+ if (recorded_player_action != NULL)
+ for (i = 0; i < MAX_PLAYERS; i++)
+ stored_player[i].action = recorded_player_action[i];
+#endif
+
for (i = 0; i < MAX_PLAYERS; i++)
{
summarized_player_action |= stored_player[i].action;
#if 0
if (stored_player[i].programmed_action &&
stored_player[i].programmed_action != recorded_player_action[i])
- printf("::: %d <-> %d\n",
+ printf("::: %d: %d <-> %d\n", i,
stored_player[i].programmed_action, recorded_player_action[i]);
#endif
+#if 0
actual_player_action = recorded_player_action[i];
+#endif
}
#if 0
{
if (game.gravity && !player->programmed_action)
{
- int move_dir_vertical = player->action & (MV_UP | MV_DOWN);
- int move_dir_horizontal = player->action & (MV_LEFT | MV_RIGHT);
+ int move_dir_horizontal = player->action & MV_HORIZONTAL;
+ int move_dir_vertical = player->action & MV_VERTICAL;
int move_dir =
- (player->last_move_dir & (MV_LEFT | MV_RIGHT) ?
+ (player->last_move_dir & MV_HORIZONTAL ?
(move_dir_vertical ? move_dir_vertical : move_dir_horizontal) :
(move_dir_horizontal ? move_dir_horizontal : move_dir_vertical));
int jx = player->jx, jy = player->jy;
int dx = (move_dir & MV_LEFT ? -1 : move_dir & MV_RIGHT ? +1 : 0);
int dy = (move_dir & MV_UP ? -1 : move_dir & MV_DOWN ? +1 : 0);
int new_jx = jx + dx, new_jy = jy + dy;
- boolean field_under_player_is_free =
- (IN_LEV_FIELD(jx, jy + 1) && IS_FREE(jx, jy + 1));
+ boolean player_is_snapping = player->action & JOY_BUTTON_1;
+#if 0
+ /* !!! MAKE THIS CUSTOMIZABLE !!! */
+ boolean field_under_player_is_free_or_acid =
+ (IN_LEV_FIELD(jx, jy + 1) &&
+ (IS_FREE(jx, jy + 1) || Feld[jx][jy + 1] == EL_ACID));
+#else
+ boolean field_under_player_is_free_or_acid =
+ (IN_LEV_FIELD(jx, jy + 1) &&
+ (IS_FREE(jx, jy + 1)));
+#endif
boolean player_is_moving_to_valid_field =
- (IN_LEV_FIELD(new_jx, new_jy) &&
+ (
+#if 1
+ !player_is_snapping &&
+#endif
+ IN_LEV_FIELD(new_jx, new_jy) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND ||
(IS_SP_PORT(Feld[new_jx][new_jy]) &&
(IS_WALKABLE(Feld[jx][jy]) &&
!(element_info[Feld[jx][jy]].access_direction & MV_DOWN)));
- if (field_under_player_is_free &&
+#if 0
+ printf("::: checking gravity NOW [%d, %d, %d] [%d] ...\n",
+ field_under_player_is_free_or_acid,
+ player_is_standing_on_valid_field,
+ player_is_moving_to_valid_field,
+ (player_is_moving_to_valid_field ? Feld[new_jx][new_jy] : -1));
+#endif
+
+ if (field_under_player_is_free_or_acid &&
!player_is_standing_on_valid_field &&
!player_is_moving_to_valid_field)
+ {
+#if 0
+ printf("::: setting programmed_action to MV_DOWN [%d,%d - %d] ...\n",
+ jx, jy, FrameCounter);
+#endif
+
player->programmed_action = MV_DOWN;
+ }
}
}
player->move_delay_value = original_move_delay_value;
}
- if (player->last_move_dir & (MV_LEFT | MV_RIGHT))
+ if (player->last_move_dir & MV_HORIZONTAL)
{
if (!(moved |= MovePlayerOneStep(player, 0, dy, dx, dy)))
moved |= MovePlayerOneStep(player, dx, 0, dx, dy);
}
}
+#if 0
+void TestIfElementSmashesCustomElement(int x, int y, int direction)
+{
+ int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
+ int dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0);
+ int hitx = x + dx, hity = y + dy;
+ int hitting_element = Feld[x][y];
+#if 0
+ boolean object_hit = (IN_LEV_FIELD(hitx, hity) &&
+ !IS_FREE(hitx, hity) &&
+ (!IS_MOVING(hitx, hity) ||
+ MovDir[hitx][hity] != direction ||
+ ABS(MovPos[hitx][hity]) <= TILEY / 2));
+#endif
+
+ if (IN_LEV_FIELD(hitx, hity) && IS_FREE(hitx, hity))
+ return;
+
+#if 0
+ if (IN_LEV_FIELD(hitx, hity) && !object_hit)
+ return;
+#endif
+
+ CheckElementChangeSide(x, y, hitting_element, EP_CAN_SMASH_EVERYTHING,
+ direction);
+
+ if (IN_LEV_FIELD(hitx, hity))
+ {
+ int opposite_direction = MV_DIR_OPPOSITE(direction);
+ int hitting_side = direction;
+ int touched_side = opposite_direction;
+ int touched_element = MovingOrBlocked2Element(hitx, hity);
+#if 1
+ boolean object_hit = (!IS_MOVING(hitx, hity) ||
+ MovDir[hitx][hity] != direction ||
+ ABS(MovPos[hitx][hity]) <= TILEY / 2);
+
+ object_hit = TRUE;
+#endif
+
+ if (object_hit)
+ {
+ int i;
+
+ CheckElementChangeSide(hitx, hity, touched_element,
+ CE_SMASHED_BY_SOMETHING, opposite_direction);
+
+ if (IS_CUSTOM_ELEMENT(hitting_element) &&
+ HAS_ANY_CHANGE_EVENT(hitting_element, CE_OTHER_IS_SMASHING))
+ {
+ for (i = 0; i < element_info[hitting_element].num_change_pages; i++)
+ {
+ struct ElementChangeInfo *change =
+ &element_info[hitting_element].change_page[i];
+
+ if (change->can_change &&
+ change->events & CH_EVENT_BIT(CE_OTHER_IS_SMASHING) &&
+ change->trigger_side & touched_side &&
+
+#if 1
+ IS_EQUAL_OR_IN_GROUP(touched_element, change->trigger_element)
+#else
+ change->trigger_element == touched_element
+#endif
+ )
+ {
+ CheckElementChangePage(x, y, hitting_element, CE_OTHER_IS_SMASHING,
+ i);
+ break;
+ }
+ }
+ }
+
+ if (IS_CUSTOM_ELEMENT(touched_element) &&
+ HAS_ANY_CHANGE_EVENT(touched_element, CE_OTHER_GETS_SMASHED))
+ {
+ for (i = 0; i < element_info[touched_element].num_change_pages; i++)
+ {
+ struct ElementChangeInfo *change =
+ &element_info[touched_element].change_page[i];
+
+ if (change->can_change &&
+ change->events & CH_EVENT_BIT(CE_OTHER_GETS_SMASHED) &&
+ change->trigger_side & hitting_side &&
+#if 1
+ IS_EQUAL_OR_IN_GROUP(hitting_element, change->trigger_element)
+#else
+ change->trigger_element == hitting_element
+#endif
+ )
+ {
+ CheckElementChangePage(hitx, hity, touched_element,
+ CE_OTHER_GETS_SMASHED, i);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+#endif
+
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
{
int i, kill_x = -1, kill_y = -1;
DOUBLE_PLAYER_SPEED(player);
#endif
+#if 0
+ printf("::: passing port %d,%d [%d]\n", x, y, FrameCounter);
+#endif
+
PlayLevelSound(x, y, SND_CLASS_SP_PORT_PASSING);
break;