default:
if (IS_CUSTOM_ELEMENT(element))
{
- if (element_info[element].move_pattern == MV_ALL_DIRECTIONS)
+ if (element_info[element].move_direction_initial != MV_NO_MOVING)
+ MovDir[x][y] = element_info[element].move_direction_initial;
+ else if (element_info[element].move_pattern == MV_ALL_DIRECTIONS)
MovDir[x][y] = 1 << RND(4);
else if (element_info[element].move_pattern == MV_HORIZONTAL)
MovDir[x][y] = (RND(2) ? MV_LEFT : MV_RIGHT);
if (IS_PLAYER(x, y))
KillHeroUnlessProtected(x, y);
- else if (CAN_EXPLODE(element))
+ else if (CAN_EXPLODE_BY_FIRE(element))
{
Feld[x][y] = Store2[x][y];
Store2[x][y] = 0;
}
else if (element == EL_BD_DIAMOND)
{
- if (IS_ENEMY(smashed) && IS_BD_ELEMENT(smashed))
+ if (IS_CLASSIC_ENEMY(smashed) && IS_BD_ELEMENT(smashed))
{
Bang(x, y + 1);
return;
element == EL_SP_ZONK ||
element == EL_BD_ROCK)
{
- if (IS_ENEMY(smashed) ||
+ if (IS_CLASSIC_ENEMY(smashed) ||
smashed == EL_BOMB ||
smashed == EL_SP_DISK_ORANGE ||
smashed == EL_DX_SUPABOMB ||
int x, y;
} move_xy[] =
{
- { 0, 0 },
- {-1, 0 },
- {+1, 0 },
- { 0, 0 },
- { 0, -1 },
- { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, +1 }
+ { 0, 0 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, 0 },
+ { 0, -1 },
+ { 0, 0 }, { 0, 0 }, { 0, 0 },
+ { 0, +1 }
};
static struct
{
int left, right, back;
} turn[] =
{
- { 0, 0, 0 },
+ { 0, 0, 0 },
{ MV_DOWN, MV_UP, MV_RIGHT },
- { MV_UP, MV_DOWN, MV_LEFT },
- { 0, 0, 0 },
- { MV_LEFT, MV_RIGHT, MV_DOWN },
- { 0,0,0 }, { 0,0,0 }, { 0,0,0 },
- { MV_RIGHT, MV_LEFT, MV_UP }
+ { MV_UP, MV_DOWN, MV_LEFT },
+ { 0, 0, 0 },
+ { MV_LEFT, MV_RIGHT, MV_DOWN },
+ { 0,0,0 }, { 0,0,0 }, { 0,0,0 },
+ { MV_RIGHT, MV_LEFT, MV_UP }
};
int element = Feld[x][y];
{
boolean can_turn_left = FALSE, can_turn_right = FALSE;
- if (IN_LEV_FIELD(left_x, left_y) && IS_FREE(left_x, left_y))
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE(left_x, left_y) ||
+ (DONT_COLLIDE_WITH(element) && IS_FREE_OR_PLAYER(left_x, left_y))))
can_turn_left = TRUE;
- if (IN_LEV_FIELD(right_x, right_y) && IS_FREE(right_x, right_y))
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE(right_x, right_y) ||
+ (DONT_COLLIDE_WITH(element) && IS_FREE_OR_PLAYER(right_x, right_y))))
can_turn_right = TRUE;
if (can_turn_left && can_turn_right)
else if (element_info[element].move_pattern == MV_HORIZONTAL ||
element_info[element].move_pattern == MV_VERTICAL)
{
- MovDir[x][y] = back_dir;
+ if (element_info[element].move_pattern & old_move_dir)
+ MovDir[x][y] = back_dir;
+ else if (element_info[element].move_pattern == MV_HORIZONTAL)
+ MovDir[x][y] = (RND(2) ? MV_LEFT : MV_RIGHT);
+ else if (element_info[element].move_pattern == MV_VERTICAL)
+ MovDir[x][y] = (RND(2) ? MV_UP : MV_DOWN);
+
MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
}
else if (element_info[element].move_pattern & MV_ANY_DIRECTION)
}
else if (element_info[element].move_pattern == MV_ALONG_LEFT_SIDE)
{
- if (IN_LEV_FIELD(left_x, left_y) && IS_FREE(left_x, left_y))
+ if (IN_LEV_FIELD(left_x, left_y) &&
+ (IS_FREE(left_x, left_y) ||
+ (DONT_COLLIDE_WITH(element) && IS_FREE_OR_PLAYER(left_x, left_y))))
MovDir[x][y] = left_dir;
- else if (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y))
+ else if (!IN_LEV_FIELD(move_x, move_y) ||
+ (!IS_FREE(move_x, move_y) &&
+ (!DONT_COLLIDE_WITH(element) || !IS_FREE_OR_PLAYER(move_x, move_y))))
MovDir[x][y] = right_dir;
- MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
+ if (MovDir[x][y] != old_move_dir)
+ MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
}
else if (element_info[element].move_pattern == MV_ALONG_RIGHT_SIDE)
{
- if (IN_LEV_FIELD(right_x, right_y) && IS_FREE(right_x, right_y))
+ if (IN_LEV_FIELD(right_x, right_y) &&
+ (IS_FREE(right_x, right_y) ||
+ (DONT_COLLIDE_WITH(element) && IS_FREE_OR_PLAYER(right_x, right_y))))
MovDir[x][y] = right_dir;
- else if (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y))
+ else if (!IN_LEV_FIELD(move_x, move_y) ||
+ (!IS_FREE(move_x, move_y) &&
+ (!DONT_COLLIDE_WITH(element) || !IS_FREE_OR_PLAYER(move_x, move_y))))
MovDir[x][y] = left_dir;
- MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
+ if (MovDir[x][y] != old_move_dir)
+ MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
}
else if (element_info[element].move_pattern == MV_TOWARDS_PLAYER ||
element_info[element].move_pattern == MV_AWAY_FROM_PLAYER)
Moving2Blocked(x, y, &newx, &newy);
if (IN_LEV_FIELD(newx, newy) && (IS_FREE(newx, newy) ||
+ (DONT_COLLIDE_WITH(element) &&
+ IS_FREE_OR_PLAYER(newx, newy)) ||
Feld[newx][newy] == EL_ACID))
return;
Moving2Blocked(x, y, &newx, &newy);
if (IN_LEV_FIELD(newx, newy) && (IS_FREE(newx, newy) ||
+ (DONT_COLLIDE_WITH(element) &&
+ IS_FREE_OR_PLAYER(newx, newy)) ||
Feld[newx][newy] == EL_ACID))
return;
{
MovDelay[x][y]--;
+#if 0
+ if (element == EL_YAMYAM)
+ {
+ printf("::: %d\n",
+ el_act_dir2img(EL_YAMYAM, ACTION_WAITING, MV_LEFT));
+ DrawLevelElementAnimation(x, y, element);
+ }
+#endif
+
+ if (MovDelay[x][y]) /* element still has to wait some time */
+ {
+#if 0
+ /* !!! PLACE THIS SOMEWHERE AFTER "TurnRound()" !!! */
+ ResetGfxAnimation(x, y);
+#endif
+ GfxAction[x][y] = ACTION_WAITING;
+ }
+
if (element == EL_ROBOT ||
+#if 0
+ element == EL_PACMAN ||
+#endif
element == EL_YAMYAM ||
element == EL_DARK_YAMYAM)
{
+#if 0
+ DrawLevelElementAnimation(x, y, element);
+#else
DrawLevelElementAnimationIfNeeded(x, y, element);
+#endif
PlaySoundLevelAction(x, y, ACTION_WAITING);
}
else if (element == EL_SP_ELECTRON)
{
int flamed = MovingOrBlocked2Element(xx, yy);
- if (IS_ENEMY(flamed) || CAN_EXPLODE(flamed))
+ if (IS_CLASSIC_ENEMY(flamed) || CAN_EXPLODE_BY_FIRE(flamed))
Bang(xx, yy);
else
RemoveMovingField(xx, yy);
return;
}
+
+ GfxAction[x][y] = ACTION_MOVING;
}
/* now make next step */
Moving2Blocked(x, y, &newx, &newy); /* get next screen position */
- if (IS_ENEMY(element) && IS_PLAYER(newx, newy) &&
+ if (DONT_COLLIDE_WITH(element) && IS_PLAYER(newx, newy) &&
!PLAYER_PROTECTED(newx, newy))
{
-
#if 1
TestIfBadThingRunsIntoHero(x, y, MovDir[x][y]);
return;
#else
- /* enemy got the player */
+ /* player killed by element which is deadly when colliding with */
MovDir[x][y] = 0;
KillHero(PLAYERINFO(newx, newy));
return;
#endif
}
- else if ((element == EL_PENGUIN || element == EL_ROBOT ||
- element == EL_SATELLITE || element == EL_BALLOON) &&
+ else if ((element == EL_PENGUIN ||
+ element == EL_ROBOT ||
+ element == EL_SATELLITE ||
+ element == EL_BALLOON ||
+ IS_CUSTOM_ELEMENT(element)) &&
IN_LEV_FIELD(newx, newy) &&
MovDir[x][y] == MV_DOWN && Feld[newx][newy] == EL_ACID)
{
}
else if (!IS_FREE(newx, newy))
{
+ GfxAction[x][y] = ACTION_WAITING;
+
if (IS_PLAYER(x, y))
DrawPlayerField(x, y);
else
int element2 = (IN_LEV_FIELD(newx2, newy2) ?
MovingOrBlocked2Element(newx2, newy2) : EL_STEELWALL);
- if ((wanna_flame || IS_ENEMY(element1) || IS_ENEMY(element2)) &&
+ if ((wanna_flame ||
+ IS_CLASSIC_ENEMY(element1) ||
+ IS_CLASSIC_ENEMY(element2)) &&
element1 != EL_DRAGON && element2 != EL_DRAGON &&
element1 != EL_FLAMES && element2 != EL_FLAMES)
{
TurnRound(x, y);
- if (element == EL_BUG || element == EL_SPACESHIP ||
+#if 1
+ DrawLevelElementAnimation(x, y, element);
+#else
+ if (element == EL_BUG ||
+ element == EL_SPACESHIP ||
element == EL_SP_SNIKSNAK)
DrawLevelField(x, y);
- else if (element == EL_BUG || element == EL_SPACESHIP ||
- element == EL_SP_SNIKSNAK || element == EL_MOLE)
+ else if (element == EL_MOLE)
DrawLevelField(x, y);
- else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
+ else if (element == EL_BD_BUTTERFLY ||
+ element == EL_BD_FIREFLY)
DrawLevelElementAnimationIfNeeded(x, y, element);
else if (element == EL_SATELLITE)
DrawLevelElementAnimationIfNeeded(x, y, element);
else if (element == EL_SP_ELECTRON)
DrawLevelElementAnimationIfNeeded(x, y, element);
+#endif
if (DONT_TOUCH(element))
TestIfBadThingTouchesHero(x, y);
+#if 0
PlaySoundLevelAction(x, y, ACTION_WAITING);
+#endif
return;
}
TestIfFriendTouchesBadThing(newx, newy);
if (CAN_SMASH(element) && direction == MV_DOWN &&
- (newy == lev_fieldy-1 || !IS_FREE(x, newy+1)))
+ (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)))
Impact(x, newy);
}
else /* still moving on */
for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
{
element = Feld[x][y];
+#if 1
+ graphic = el_act_dir2img(element, GfxAction[x][y], MovDir[x][y]);
+#else
graphic = el2img(element);
+#endif
#if 0
if (element == -1)
{
StartMoving(x, y);
+#if 1
+ graphic = el_act_dir2img(element, GfxAction[x][y], MovDir[x][y]);
+#if 0
+ if (element == EL_PACMAN)
+ printf("::: %d, %d, %d\n",
+ IS_ANIMATED(graphic), IS_MOVING(x, y), Stop[x][y]);
+#endif
+#if 0
+ if (element == EL_YAMYAM)
+ printf("::: %d, %d, %d\n",
+ IS_ANIMATED(graphic), IS_MOVING(x, y), Stop[x][y]);
+#endif
+#endif
+
if (IS_ANIMATED(graphic) &&
!IS_MOVING(x, y) &&
!Stop[x][y])
+ {
DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
+#if 0
+ if (element == EL_YAMYAM)
+ printf("::: %d, %d\n", graphic, GfxFrame[x][y]);
+#endif
+ }
+
if (IS_GEM(element) || element == EL_SP_INFOTRON)
EdelsteinFunkeln(x, y);
}
element = MovingOrBlocked2ElementIfNotLeaving(new_jx, new_jy);
#endif
- if (DONT_GO_TO(element))
+ if (DONT_RUN_INTO(element))
{
if (element == EL_ACID && dx == 0 && dy == 1)
{
test_element = MovingOrBlocked2ElementIfNotLeaving(test_x, test_y);
#endif
- /* 1st case: good thing is moving towards DONT_GO_TO style bad thing;
+ /* 1st case: good thing is moving towards DONT_RUN_INTO style bad thing;
2nd case: DONT_TOUCH style bad thing does not move away from good thing
*/
- if ((DONT_GO_TO(test_element) && good_move_dir == test_dir[i]) ||
- (DONT_TOUCH(test_element) && test_move_dir != test_dir[i]))
+ if ((DONT_RUN_INTO(test_element) && good_move_dir == test_dir[i]) ||
+ (DONT_TOUCH(test_element) && test_move_dir != test_dir[i]))
{
kill_x = test_x;
kill_y = test_y;
test_element = Feld[test_x][test_y];
- /* 1st case: good thing is moving towards DONT_GO_TO style bad thing;
+ /* 1st case: good thing is moving towards DONT_RUN_INTO style bad thing;
2nd case: DONT_TOUCH style bad thing does not move away from good thing
*/
- if ((DONT_GO_TO(bad_element) && bad_move_dir == test_dir[i]) ||
- (DONT_TOUCH(bad_element) && test_move_dir != test_dir[i]))
+ if ((DONT_RUN_INTO(bad_element) && bad_move_dir == test_dir[i]) ||
+ (DONT_TOUCH(bad_element) && test_move_dir != test_dir[i]))
{
/* good thing is player or penguin that does not move away */
if (IS_PLAYER(test_x, test_y))