NULL,
NULL
},
+ {
+ EL_EXIT_CLOSING,
+ EL_EXIT_CLOSED,
+ 29,
+ NULL,
+ NULL,
+ NULL
+ },
{
EL_SWITCHGATE_OPENING,
EL_SWITCHGATE_OPEN,
StopSound(SND_GAME_LEVELTIME_BONUS);
}
+ /* close exit door after last player */
+ if (Feld[ExitX][ExitY] == EL_EXIT_OPEN && AllPlayersGone)
+ {
+ Feld[ExitX][ExitY] = EL_EXIT_CLOSING;
+
+ PlaySoundLevelElementAction(ExitX, ExitY, EL_EXIT_OPEN, ACTION_CLOSING);
+ }
+
/* Hero disappears */
DrawLevelField(ExitX, ExitY);
BackToFront();
ExplodePhase[x][y] = (phase < last_phase ? phase + 1 : 0);
+#ifdef DEBUG
+
+ /* activate this even in non-DEBUG version until cause for crash in
+ getGraphicAnimationFrame() (see below) is found and eliminated */
+#endif
+#if 1
+
+ if (GfxElement[x][y] == EL_UNDEFINED)
+ {
+ printf("\n\n\n");
+ printf("Explode(): x = %d, y = %d: GfxElement == EL_UNDEFINED\n", x, y);
+ printf("Explode(): This should never happen!\n");
+ printf("\n\n\n");
+
+ GfxElement[x][y] = EL_EMPTY;
+ }
+#endif
+
if (phase == first_phase_after_start)
{
int element = Store2[x][y];
return;
}
+ if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ return;
+
Feld[x][y] = EL_EXIT_OPENING;
PlaySoundLevelNearest(x, y, SND_CLASS_EXIT_OPENING);
RelocatePlayer(x, y, target_element);
}
-static void ChangeElementNow(int x, int y, int element, int page)
+static boolean ChangeElementNow(int x, int y, int element, int page)
{
struct ElementChangeInfo *change = &element_info[element].change_page[page];
+ if (Changed[x][y]) /* do not change already changed elements */
+ return FALSE;
+
Changed[x][y] = TRUE; /* no more changes in this frame */
CheckTriggeredElementChange(x, y, Feld[x][y], CE_OTHER_IS_CHANGING);
if (change->explode)
{
Bang(x, y);
- return;
+
+ return TRUE;
}
if (change->use_content)
if (change->only_complete && change->use_random_change &&
RND(100) < change->random)
- return;
+ return FALSE;
for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++)
{
PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING);
}
+
+ return TRUE;
}
static void ChangeElement(int x, int y, int page)
return;
}
- ChangeElementNow(x, y, element, page);
-
- if (change->post_change_function)
- change->post_change_function(x, y);
+ if (ChangeElementNow(x, y, element, page))
+ {
+ if (change->post_change_function)
+ change->post_change_function(x, y);
+ }
}
}
if (x == lx && y == ly) /* do not change trigger element itself */
continue;
+#if 0
if (Changed[x][y]) /* do not change already changed elements */
continue;
+#endif
if (Feld[x][y] == element)
{