rnd-20031129-3-src
[rocksndiamonds.git] / src / game.c
index e0423a0cf4bea429d6ced5eb7ad7ce54bf7a08cf..22a65dc7b5c1dde2ec2b2d5e816e9c90724723c3 100644 (file)
@@ -756,8 +756,8 @@ void DrawGameDoorValues()
 {
   int i, j;
 
-  for (i=0; i<MAX_PLAYERS; i++)
-    for (j=0; j<4; j++)
+  for (i = 0; i < MAX_PLAYERS; i++)
+    for (j = 0; j < 4; j++)
       if (stored_player[i].key[j])
        DrawMiniGraphicExt(drawto, DX_KEYS + j * MINI_TILEX, DY_KEYS,
                           el2edimg(EL_KEY_1 + j));
@@ -820,7 +820,7 @@ static void InitGameEngine()
   /* ---------- initialize changing elements ------------------------------- */
 
   /* initialize changing elements information */
-  for (i=0; i < MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
   {
     struct ElementInfo *ei = &element_info[i];
 
@@ -836,7 +836,7 @@ static void InitGameEngine()
     }
 
     ei->change_events = CE_BITMASK_DEFAULT;
-    for (j=0; j < NUM_CHANGE_EVENTS; j++)
+    for (j = 0; j < NUM_CHANGE_EVENTS; j++)
     {
       ei->event_page_nr[j] = 0;
       ei->event_page[j] = &ei->change_page[0];
@@ -844,7 +844,7 @@ static void InitGameEngine()
   }
 
   /* add changing elements from pre-defined list */
-  for (i=0; change_delay_list[i].element != EL_UNDEFINED; i++)
+  for (i = 0; change_delay_list[i].element != EL_UNDEFINED; i++)
   {
     struct ChangingElementInfo *ch_delay = &change_delay_list[i];
     struct ElementInfo *ei = &element_info[ch_delay->element];
@@ -861,16 +861,16 @@ static void InitGameEngine()
 
 #if 1
   /* add change events from custom element configuration */
-  for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
   {
     struct ElementInfo *ei = &element_info[EL_CUSTOM_START + i];
 
-    for (j=0; j < ei->num_change_pages; j++)
+    for (j = 0; j < ei->num_change_pages; j++)
     {
       if (!ei->change_page[j].can_change)
        continue;
 
-      for (k=0; k < NUM_CHANGE_EVENTS; k++)
+      for (k = 0; k < NUM_CHANGE_EVENTS; k++)
       {
        /* only add event page for the first page found with this event */
        if (ei->change_page[j].events & CH_EVENT_BIT(k) &&
@@ -887,7 +887,7 @@ static void InitGameEngine()
 #else
 
   /* add change events from custom element configuration */
-  for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
   {
     int element = EL_CUSTOM_START + i;
 
@@ -900,16 +900,16 @@ static void InitGameEngine()
   /* ---------- initialize trigger events ---------------------------------- */
 
   /* initialize trigger events information */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
     trigger_events[i] = EP_BITMASK_DEFAULT;
 
 #if 1
   /* add trigger events from element change event properties */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
   {
     struct ElementInfo *ei = &element_info[i];
 
-    for (j=0; j < ei->num_change_pages; j++)
+    for (j = 0; j < ei->num_change_pages; j++)
     {
       if (!ei->change_page[j].can_change)
        continue;
@@ -924,7 +924,7 @@ static void InitGameEngine()
   }
 #else
   /* add trigger events from element change event properties */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
     if (HAS_CHANGE_EVENT(i, CE_BY_OTHER_ACTION))
       trigger_events[element_info[i].change->trigger_element] |=
        element_info[i].change->events;
@@ -933,7 +933,7 @@ static void InitGameEngine()
   /* ---------- initialize push delay -------------------------------------- */
 
   /* initialize push delay values to default */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
   {
     if (!IS_CUSTOM_ELEMENT(i))
     {
@@ -943,7 +943,7 @@ static void InitGameEngine()
   }
 
   /* set push delay value for certain elements from pre-defined list */
-  for (i=0; push_delay_list[i].element != EL_UNDEFINED; i++)
+  for (i = 0; push_delay_list[i].element != EL_UNDEFINED; i++)
   {
     int e = push_delay_list[i].element;
 
@@ -954,12 +954,12 @@ static void InitGameEngine()
   /* ---------- initialize move stepsize ----------------------------------- */
 
   /* initialize move stepsize values to default */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
     if (!IS_CUSTOM_ELEMENT(i))
       element_info[i].move_stepsize = MOVE_STEPSIZE_NORMAL;
 
   /* set move stepsize value for certain elements from pre-defined list */
-  for (i=0; move_stepsize_list[i].element != EL_UNDEFINED; i++)
+  for (i = 0; move_stepsize_list[i].element != EL_UNDEFINED; i++)
   {
     int e = move_stepsize_list[i].element;
 
@@ -969,12 +969,12 @@ static void InitGameEngine()
   /* ---------- initialize gem count --------------------------------------- */
 
   /* initialize gem count values for each element */
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
     if (!IS_CUSTOM_ELEMENT(i))
       element_info[i].collect_count = 0;
 
   /* add gem count values for all elements from pre-defined list */
-  for (i=0; collect_count_list[i].element != EL_UNDEFINED; i++)
+  for (i = 0; collect_count_list[i].element != EL_UNDEFINED; i++)
     element_info[collect_count_list[i].element].collect_count =
       collect_count_list[i].count;
 }
@@ -1010,7 +1010,7 @@ void InitGame()
   /* don't play tapes over network */
   network_playing = (options.network && !tape.playing);
 
-  for (i=0; i < MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     struct PlayerInfo *player = &stored_player[i];
 
@@ -1030,7 +1030,7 @@ void InitGame()
     player->lights_still_needed = 0;
     player->friends_still_needed = 0;
 
-    for (j=0; j < 4; j++)
+    for (j = 0; j < 4; j++)
       player->key[j] = FALSE;
 
     player->dynabomb_count = 0;
@@ -1076,11 +1076,11 @@ void InitGame()
     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++)
+    for (j = ACTION_BORING_1; j <= ACTION_BORING_LAST; j++)
     {
       boolean found = FALSE;
 
-      for (k=0; k < NUM_DIRECTIONS; k++)
+      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;
@@ -1090,11 +1090,11 @@ void InitGame()
       else
        break;
     }
-    for (j=ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++)
+    for (j = ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++)
     {
       boolean found = FALSE;
 
-      for (k=0; k < NUM_DIRECTIONS; k++)
+      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;
@@ -1166,18 +1166,18 @@ void InitGame()
 
   game.envelope_active = FALSE;
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     game.belt_dir[i] = MV_NO_MOVING;
     game.belt_dir_nr[i] = 3;           /* not moving, next moving left */
   }
 
-  for (i=0; i<MAX_NUM_AMOEBA; i++)
+  for (i = 0; i < MAX_NUM_AMOEBA; i++)
     AmoebaCnt[i] = AmoebaCnt2[i] = 0;
 
-  for (x=0; x<lev_fieldx; x++)
+  for (x = 0; x < lev_fieldx; x++)
   {
-    for (y=0; y<lev_fieldy; y++)
+    for (y = 0; y < lev_fieldy; y++)
     {
       Feld[x][y] = level.field[x][y];
       MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
@@ -1204,9 +1204,9 @@ void InitGame()
     }
   }
 
-  for(y=0; y<lev_fieldy; y++)
+  for (y = 0; y < lev_fieldy; y++)
   {
-    for(x=0; x<lev_fieldx; x++)
+    for (x = 0; x < lev_fieldx; x++)
     {
       if (emulate_bd && !IS_BD_ELEMENT(Feld[x][y]))
        emulate_bd = FALSE;
@@ -1226,18 +1226,18 @@ void InitGame()
                    emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
 
   /* correct non-moving belts to start moving left */
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
     if (game.belt_dir[i] == MV_NO_MOVING)
       game.belt_dir_nr[i] = 3;         /* not moving, next moving left */
 
   /* check if any connected player was not found in playfield */
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     struct PlayerInfo *player = &stored_player[i];
 
     if (player->connected && !player->present)
     {
-      for (j=0; j<MAX_PLAYERS; j++)
+      for (j = 0; j < MAX_PLAYERS; j++)
       {
        struct PlayerInfo *some_player = &stored_player[j];
        int jx = some_player->jx, jy = some_player->jy;
@@ -1263,7 +1263,7 @@ void InitGame()
   {
     /* when playing a tape, eliminate all players who do not participate */
 
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
     {
       if (stored_player[i].active && !tape.player_participates[i])
       {
@@ -1280,11 +1280,11 @@ void InitGame()
   {
     /* when in single player mode, eliminate all but the first active player */
 
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
     {
       if (stored_player[i].active)
       {
-       for (j=i+1; j<MAX_PLAYERS; j++)
+       for (j = i + 1; j < MAX_PLAYERS; j++)
        {
          if (stored_player[j].active)
          {
@@ -1303,14 +1303,14 @@ void InitGame()
   /* when recording the game, store which players take part in the game */
   if (tape.recording)
   {
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
       if (stored_player[i].active)
        tape.player_participates[i] = TRUE;
   }
 
   if (options.debug)
   {
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
     {
       struct PlayerInfo *player = &stored_player[i];
 
@@ -1353,7 +1353,7 @@ void InitGame()
     int found_rating = 0;
     int found_element = EL_UNDEFINED;
 
-    for(y=0; y < lev_fieldy; y++) for(x=0; x < lev_fieldx; x++)
+    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
     {
       int element = Feld[x][y];
       int content;
@@ -1365,7 +1365,7 @@ void InitGame()
 
       if (CAN_CHANGE(element))
       {
-       for (i=0; i < element_info[element].num_change_pages; i++)
+       for (i = 0; i < element_info[element].num_change_pages; i++)
        {
          content = element_info[element].change_page[i].target_element;
          is_player = ELEM_IS_PLAYER(content);
@@ -1381,7 +1381,7 @@ void InitGame()
        }
       }
 
-      for(yy=0; yy < 3; yy++) for(xx=0; xx < 3; xx++)
+      for (yy = 0; yy < 3; yy++) for (xx = 0; xx < 3; xx++)
       {
        content = element_info[element].content[xx][yy];
        is_player = ELEM_IS_PLAYER(content);
@@ -1398,7 +1398,7 @@ void InitGame()
        if (!CAN_CHANGE(element))
          continue;
 
-       for (i=0; i < element_info[element].num_change_pages; i++)
+       for (i = 0; i < element_info[element].num_change_pages; i++)
        {
          content = element_info[element].change_page[i].content[xx][yy];
          is_player = ELEM_IS_PLAYER(content);
@@ -1504,7 +1504,7 @@ void InitGame()
 
   if (options.debug)
   {
-    for (i=0; i<4; i++)
+    for (i = 0; i < 4; i++)
       printf("Player %d %sactive.\n",
             i + 1, (stored_player[i].active ? "" : "not "));
   }
@@ -1607,7 +1607,7 @@ void InitMovDir(int x, int y)
        else if (element_info[element].move_pattern == MV_ALONG_LEFT_SIDE ||
                 element_info[element].move_pattern == MV_ALONG_RIGHT_SIDE)
        {
-         for (i=0; i<4; i++)
+         for (i = 0; i < 4; i++)
          {
            int x1 = x + xy[i][0];
            int y1 = y + xy[i][1];
@@ -1634,7 +1634,7 @@ void InitMovDir(int x, int y)
            element != EL_BD_FIREFLY)
          break;
 
-       for (i=0; i<4; i++)
+       for (i = 0; i < 4; i++)
        {
          int x1 = x + xy[i][0];
          int y1 = y + xy[i][1];
@@ -1668,7 +1668,7 @@ void InitAmoebaNr(int x, int y)
 
   if (group_nr == 0)
   {
-    for (i=1; i<MAX_NUM_AMOEBA; i++)
+    for (i = 1; i < MAX_NUM_AMOEBA; i++)
     {
       if (AmoebaCnt[i] == 0)
       {
@@ -1829,7 +1829,7 @@ int NewHiScore()
       local_player->score < highscore[MAX_SCORE_ENTRIES - 1].Score) 
     return -1;
 
-  for (k=0; k<MAX_SCORE_ENTRIES; k++) 
+  for (k = 0; k < MAX_SCORE_ENTRIES; k++) 
   {
     if (local_player->score > highscore[k].Score)
     {
@@ -1840,14 +1840,14 @@ int NewHiScore()
        int m = MAX_SCORE_ENTRIES - 1;
 
 #ifdef ONE_PER_NAME
-       for (l=k; l<MAX_SCORE_ENTRIES; l++)
+       for (l = k; l < MAX_SCORE_ENTRIES; l++)
          if (!strcmp(setup.player_name, highscore[l].Name))
            m = l;
        if (m == k)     /* player's new highscore overwrites his old one */
          goto put_into_list;
 #endif
 
-       for (l=m; l>k; l--)
+       for (l = m; l > k; l--)
        {
          strcpy(highscore[l].Name, highscore[l - 1].Name);
          highscore[l].Score = highscore[l - 1].Score;
@@ -2236,7 +2236,7 @@ void Explode(int ex, int ey, int phase, int mode)
       Feld[ex][ey] = center_element;
     }
 
-    for (y = ey - 1; y <= ey + 1; y++) for(x = ex - 1; x <= ex + 1; x++)
+    for (y = ey - 1; y <= ey + 1; y++) for (x = ex - 1; x <= ex + 1; x++)
     {
       int xx = x - ex + 1;
       int yy = y - ey + 1;
@@ -2556,9 +2556,9 @@ void DynaExplode(int ex, int ey)
 
   Explode(ex, ey, EX_PHASE_START, EX_CENTER);
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
-    for (j=1; j<=dynabomb_size; j++)
+    for (j = 1; j <= dynabomb_size; j++)
     {
       int x = ex + j * xy[i % 4][0];
       int y = ey + j * xy[i % 4][1];
@@ -2704,11 +2704,11 @@ static void InitBeltMovement()
   int x, y, i, j;
 
   /* set frame order for belt animation graphic according to belt direction */
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int belt_nr = i;
 
-    for (j=0; j<3; j++)
+    for (j = 0; j < 3; j++)
     {
       int element = belt_base_active_element[belt_nr] + j;
       int graphic = el2img(element);
@@ -2720,13 +2720,13 @@ static void InitBeltMovement()
     }
   }
 
-  for(y=0; y<lev_fieldy; y++)
+  for (y = 0; y < lev_fieldy; y++)
   {
-    for(x=0; x<lev_fieldx; x++)
+    for (x = 0; x < lev_fieldx; x++)
     {
       int element = Feld[x][y];
 
-      for (i=0; i<4; i++)
+      for (i = 0; i < 4; i++)
       {
        if (IS_BELT(element) && game.belt_dir[i] != MV_NO_MOVING)
        {
@@ -2792,7 +2792,7 @@ static void ToggleBeltSwitch(int x, int y)
     belt_dir_nr = 1;
 
   /* set frame order for belt animation graphic according to belt direction */
-  for (i=0; i<3; i++)
+  for (i = 0; i < 3; i++)
   {
     int element = belt_base_active_element[belt_nr] + i;
     int graphic = el2img(element);
@@ -2803,9 +2803,9 @@ static void ToggleBeltSwitch(int x, int y)
       graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
   }
 
-  for (yy=0; yy<lev_fieldy; yy++)
+  for (yy = 0; yy < lev_fieldy; yy++)
   {
-    for (xx=0; xx<lev_fieldx; xx++)
+    for (xx = 0; xx < lev_fieldx; xx++)
     {
       int element = Feld[xx][yy];
 
@@ -2853,9 +2853,9 @@ static void ToggleSwitchgateSwitch(int x, int y)
 
   game.switchgate_pos = !game.switchgate_pos;
 
-  for (yy=0; yy<lev_fieldy; yy++)
+  for (yy = 0; yy < lev_fieldy; yy++)
   {
-    for (xx=0; xx<lev_fieldx; xx++)
+    for (xx = 0; xx < lev_fieldx; xx++)
     {
       int element = Feld[xx][yy];
 
@@ -2909,9 +2909,9 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
 {
   int x, y;
 
-  for (y=0; y<lev_fieldy; y++)
+  for (y = 0; y < lev_fieldy; y++)
   {
-    for (x=0; x<lev_fieldx; x++)
+    for (x = 0; x < lev_fieldx; x++)
     {
       int element = Feld[x][y];
 
@@ -2966,9 +2966,9 @@ static void ActivateTimegateSwitch(int x, int y)
 
   game.timegate_time_left = level.time_timegate * FRAMES_PER_SECOND;
 
-  for (yy=0; yy<lev_fieldy; yy++)
+  for (yy = 0; yy < lev_fieldy; yy++)
   {
-    for (xx=0; xx<lev_fieldx; xx++)
+    for (xx = 0; xx < lev_fieldx; xx++)
     {
       int element = Feld[xx][yy];
 
@@ -3104,8 +3104,8 @@ void Impact(int x, int y)
         EL_BD_MAGIC_WALL_ACTIVE);
 
       /* activate magic wall / mill */
-      for (yy=0; yy<lev_fieldy; yy++)
-       for (xx=0; xx<lev_fieldx; xx++)
+      for (yy = 0; yy < lev_fieldy; yy++)
+       for (xx = 0; xx < lev_fieldx; xx++)
          if (Feld[xx][yy] == smashed)
            Feld[xx][yy] = activated_magic_wall;
 
@@ -3537,7 +3537,7 @@ inline static void TurnRoundExt(int x, int y)
     {
       int i;
 
-      for (i=0; i<MAX_PLAYERS; i++)
+      for (i = 0; i < MAX_PLAYERS; i++)
       {
        struct PlayerInfo *player = &stored_player[i];
        int jx = player->jx, jy = player->jy;
@@ -3571,7 +3571,7 @@ inline static void TurnRoundExt(int x, int y)
        { 0, +1 }
       };
 
-      for (i=0; i<4; i++)
+      for (i = 0; i < 4; i++)
       {
        int ex = x + xy[i % 4][0];
        int ey = y + xy[i % 4][1];
@@ -3743,7 +3743,7 @@ inline static void TurnRoundExt(int x, int y)
     {
       int i;
 
-      for (i=0; i<MAX_PLAYERS; i++)
+      for (i = 0; i < MAX_PLAYERS; i++)
       {
        struct PlayerInfo *player = &stored_player[i];
        int jx = player->jx, jy = player->jy;
@@ -3833,7 +3833,7 @@ static boolean JustBeingPushed(int x, int y)
 {
   int i;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     struct PlayerInfo *player = &stored_player[i];
 
@@ -4270,7 +4270,7 @@ void StartMoving(int x, int y)
 
        PlayLevelSoundActionIfLoop(x, y, ACTION_ATTACKING);
 
-       for (i=1; i <= 3; i++)
+       for (i = 1; i <= 3; i++)
        {
          int xx = x + i * dx;
          int yy = y + i * dy;
@@ -4782,7 +4782,7 @@ int AmoebeNachbarNr(int ax, int ay)
     { 0, +1 }
   };
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int x = ax + xy[i][0];
     int y = ay + xy[i][1];
@@ -4812,7 +4812,7 @@ void AmoebenVereinigen(int ax, int ay)
   if (new_group_nr == 0)
     return;
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     x = ax + xy[i][0];
     y = ay + xy[i][1];
@@ -4835,9 +4835,9 @@ void AmoebenVereinigen(int ax, int ay)
       AmoebaCnt2[new_group_nr] += AmoebaCnt2[old_group_nr];
       AmoebaCnt2[old_group_nr] = 0;
 
-      for (yy=0; yy<lev_fieldy; yy++)
+      for (yy = 0; yy < lev_fieldy; yy++)
       {
-       for (xx=0; xx<lev_fieldx; xx++)
+       for (xx = 0; xx < lev_fieldx; xx++)
        {
          if (AmoebaNr[xx][yy] == old_group_nr)
            AmoebaNr[xx][yy] = new_group_nr;
@@ -4864,9 +4864,9 @@ void AmoebeUmwandeln(int ax, int ay)
     }
 #endif
 
-    for (y=0; y<lev_fieldy; y++)
+    for (y = 0; y < lev_fieldy; y++)
     {
-      for (x=0; x<lev_fieldx; x++)
+      for (x = 0; x < lev_fieldx; x++)
       {
        if (Feld[x][y] == EL_AMOEBA_DEAD && AmoebaNr[x][y] == group_nr)
        {
@@ -4890,7 +4890,7 @@ void AmoebeUmwandeln(int ax, int ay)
       { 0, +1 }
     };
 
-    for (i=0; i<4; i++)
+    for (i = 0; i < 4; i++)
     {
       x = ax + xy[i][0];
       y = ay + xy[i][1];
@@ -4924,9 +4924,9 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element)
   }
 #endif
 
-  for (y=0; y<lev_fieldy; y++)
+  for (y = 0; y < lev_fieldy; y++)
   {
-    for (x=0; x<lev_fieldx; x++)
+    for (x = 0; x < lev_fieldx; x++)
     {
       if (AmoebaNr[x][y] == group_nr &&
          (Feld[x][y] == EL_AMOEBA_DEAD ||
@@ -5086,7 +5086,7 @@ void AmoebeAbleger(int ax, int ay)
     int start = RND(4);
     boolean waiting_for_player = FALSE;
 
-    for (i=0; i<4; i++)
+    for (i = 0; i < 4; i++)
     {
       int j = (start + i) % 4;
       int x = ax + xy[j][0];
@@ -5207,7 +5207,7 @@ void Life(int ax, int ay)
       return;
   }
 
-  for (y1=-1; y1<2; y1++) for(x1=-1; x1<2; x1++)
+  for (y1 = -1; y1 < 2; y1++) for (x1 = -1; x1 < 2; x1++)
   {
     int xx = ax+x1, yy = ay+y1;
     int nachbarn = 0;
@@ -5215,7 +5215,7 @@ void Life(int ax, int ay)
     if (!IN_LEV_FIELD(xx, yy))
       continue;
 
-    for (y2=-1; y2<2; y2++) for (x2=-1; x2<2; x2++)
+    for (y2 = -1; y2 < 2; y2++) for (x2 = -1; x2 < 2; x2++)
     {
       int x = xx+x2, y = yy+y2;
 
@@ -5334,9 +5334,9 @@ static void CloseAllOpenTimegates()
 {
   int x, y;
 
-  for (y=0; y<lev_fieldy; y++)
+  for (y = 0; y < lev_fieldy; y++)
   {
-    for (x=0; x<lev_fieldx; x++)
+    for (x = 0; x < lev_fieldx; x++)
     {
       int element = Feld[x][y];
 
@@ -5568,9 +5568,9 @@ void CheckForDragon(int x, int y)
     { 0, +1 }
   };
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
-    for (j=0; j<4; j++)
+    for (j = 0; j < 4; j++)
     {
       int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
 
@@ -5587,9 +5587,9 @@ void CheckForDragon(int x, int y)
 
   if (!dragon_found)
   {
-    for (i=0; i<4; i++)
+    for (i = 0; i < 4; i++)
     {
-      for (j=0; j<3; j++)
+      for (j = 0; j < 3; j++)
       {
        int xx = x + j*xy[i][0], yy = y + j*xy[i][1];
   
@@ -5630,7 +5630,7 @@ static void WarnBuggyBase(int x, int y)
     { 0, +1 }
   };
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int xx = x + xy[i][0], yy = y + xy[i][1];
 
@@ -5732,7 +5732,7 @@ static boolean ChangeElementNow(int x, int y, int element, int page)
     boolean can_change[3][3];
     int xx, yy;
 
-    for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++)
+    for (yy = 0; yy < 3; yy++) for (xx = 0; xx < 3 ; xx++)
     {
       boolean half_destructible;
       int ex = x + xx - 1;
@@ -5783,7 +5783,7 @@ static boolean ChangeElementNow(int x, int y, int element, int page)
          RND(100) < change->random)
        return FALSE;
 
-      for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++)
+      for (yy = 0; yy < 3; yy++) for (xx = 0; xx < 3 ; xx++)
       {
        int ex = x + xx - 1;
        int ey = y + yy - 1;
@@ -5897,7 +5897,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly,
   if (!(trigger_events[trigger_element] & CH_EVENT_BIT(trigger_event)))
     return FALSE;
 
-  for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
   {
     int element = EL_CUSTOM_START + i;
 
@@ -5907,7 +5907,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly,
     if (!CAN_CHANGE(element) || !HAS_ANY_CHANGE_EVENT(element, trigger_event))
       continue;
 
-    for (j=0; j < element_info[element].num_change_pages; j++)
+    for (j = 0; j < element_info[element].num_change_pages; j++)
     {
       struct ElementChangeInfo *change = &element_info[element].change_page[j];
 
@@ -5934,7 +5934,7 @@ static boolean CheckTriggeredElementSideChange(int lx, int ly,
     if (!change_element)
       continue;
 
-    for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
     {
 #if 0
       if (x == lx && y == ly)  /* do not change trigger element itself */
@@ -6286,7 +6286,7 @@ void GameActions()
 
   recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     summarized_player_action |= stored_player[i].action;
 
@@ -6302,7 +6302,7 @@ void GameActions()
   if (!options.network && !setup.team_mode)
     local_player->effective_action = summarized_player_action;
 
-  for (i=0; i < MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     int actual_player_action = stored_player[i].effective_action;
 
@@ -6333,14 +6333,14 @@ void GameActions()
   FrameCounter++;
   TimeFrames++;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
     stored_player[i].Frame++;
 #endif
 
 #if 1
   if (game.engine_version < VERSION_IDENT(2,2,0,7))
   {
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
     {
       struct PlayerInfo *player = &stored_player[i];
       int x = player->jx;
@@ -6361,7 +6361,7 @@ void GameActions()
   }
 #endif
 
-  for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
   {
     Changed[x][y] = CE_BITMASK_DEFAULT;
     ChangeEvent[x][y] = CE_BITMASK_DEFAULT;
@@ -6411,7 +6411,7 @@ void GameActions()
 #endif
   }
 
-  for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
   {
     element = Feld[x][y];
 #if 1
@@ -6635,7 +6635,7 @@ void GameActions()
   {
     game.explosions_delayed = FALSE;
 
-    for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
     {
       element = Feld[x][y];
 
@@ -6669,7 +6669,7 @@ void GameActions()
       game.magic_wall_time_left--;
       if (!game.magic_wall_time_left)
       {
-       for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+       for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
        {
          element = Feld[x][y];
 
@@ -6708,7 +6708,7 @@ void GameActions()
       CloseAllOpenTimegates();
   }
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     struct PlayerInfo *player = &stored_player[i];
 
@@ -6726,7 +6726,7 @@ void GameActions()
     TimeFrames = 0;
     TimePlayed++;
 
-    for (i=0; i<MAX_PLAYERS; i++)
+    for (i = 0; i < MAX_PLAYERS; i++)
     {
       struct PlayerInfo *player = &stored_player[i];
 
@@ -6752,7 +6752,7 @@ void GameActions()
       DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
 
       if (!TimeLeft && setup.time_limit)
-       for (i=0; i<MAX_PLAYERS; i++)
+       for (i = 0; i < MAX_PLAYERS; i++)
          KillHero(&stored_player[i]);
     }
     else if (level.time == 0 && !AllPlayersGone) /* level without time limit */
@@ -6795,7 +6795,7 @@ void GameActions()
   FrameCounter++;
   TimeFrames++;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     int move_frames =
       MOVE_DELAY_NORMAL_SPEED /  stored_player[i].move_delay_value;
@@ -6822,7 +6822,7 @@ static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y)
   int min_x = x, min_y = y, max_x = x, max_y = y;
   int i;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     int jx = stored_player[i].jx, jy = stored_player[i].jy;
 
@@ -6842,7 +6842,7 @@ static boolean AllPlayersInVisibleScreen()
 {
   int i;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     int jx = stored_player[i].jx, jy = stored_player[i].jy;
 
@@ -6872,14 +6872,14 @@ void ScrollLevel(int dx, int dy)
   if (dx)
   {
     x = (dx == 1 ? BX1 : BX2);
-    for (y=BY1; y <= BY2; y++)
+    for (y = BY1; y <= BY2; y++)
       DrawScreenField(x, y);
   }
 
   if (dy)
   {
     y = (dy == 1 ? BY1 : BY2);
-    for (x=BX1; x <= BX2; x++)
+    for (x = BX1; x <= BX2; x++)
       DrawScreenField(x, y);
   }
 
@@ -7384,7 +7384,7 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
   int center_element = Feld[x][y];     /* should always be non-moving! */
   int i;
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int xx = x + xy[i][0];
     int yy = y + xy[i][1];
@@ -7460,7 +7460,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
   int center_element = Feld[x][y];     /* should always be non-moving! */
   int i, j;
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int xx = x + xy[i][0];
     int yy = y + xy[i][1];
@@ -7485,7 +7485,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
        HAS_ANY_CHANGE_EVENT(center_element, CE_OTHER_IS_TOUCHING) &&
        !change_center_element)
     {
-      for (j=0; j < element_info[center_element].num_change_pages; j++)
+      for (j = 0; j < element_info[center_element].num_change_pages; j++)
       {
        struct ElementChangeInfo *change =
          &element_info[center_element].change_page[j];
@@ -7507,7 +7507,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
     if (IS_CUSTOM_ELEMENT(border_element) &&
        HAS_ANY_CHANGE_EVENT(border_element, CE_OTHER_IS_TOUCHING))
     {
-      for (j=0; j < element_info[border_element].num_change_pages; j++)
+      for (j = 0; j < element_info[border_element].num_change_pages; j++)
       {
        struct ElementChangeInfo *change =
          &element_info[border_element].change_page[j];
@@ -7548,7 +7548,7 @@ void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
     MV_DOWN
   };
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int test_x, test_y, test_move_dir, test_element;
 
@@ -7623,7 +7623,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir)
   if (bad_element == EL_EXPLOSION)     /* skip just exploding bad things */
     return;
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int test_x, test_y, test_move_dir, test_element;
 
@@ -7727,7 +7727,7 @@ void TestIfBadThingTouchesOtherBadThing(int bad_x, int bad_y)
     { 0, +1 }
   };
 
-  for (i=0; i<4; i++)
+  for (i = 0; i < 4; i++)
   {
     int x, y, element;
 
@@ -7803,7 +7803,7 @@ void RemoveHero(struct PlayerInfo *player)
   if (!ExplodeField[jx][jy])
     StorePlayer[jx][jy] = 0;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
     if (stored_player[i].active)
       found = TRUE;
 
@@ -8185,7 +8185,7 @@ int DigField(struct PlayerInfo *player,
        {
          int i;
 
-         for (i=0; i < element_info[element].collect_count; i++)
+         for (i = 0; i < element_info[element].collect_count; i++)
            if (player->inventory_size < MAX_INVENTORY_SIZE)
              player->inventory_element[player->inventory_size++] = element;
 
@@ -8392,7 +8392,7 @@ int DigField(struct PlayerInfo *player,
        {
          int xx, yy;
 
-         for (yy=0; yy < lev_fieldy; yy++) for (xx=0; xx < lev_fieldx; xx++)
+         for (yy = 0; yy < lev_fieldy; yy++) for (xx=0; xx < lev_fieldx; xx++)
          {
            if (Feld[xx][yy] == EL_SP_DISK_YELLOW)
              Bang(xx, yy);
@@ -8905,7 +8905,7 @@ void CreateGameButtons()
 {
   int i;
 
-  for (i=0; i<NUM_GAME_BUTTONS; i++)
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
   {
     Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
     struct GadgetInfo *gi;
@@ -8971,7 +8971,7 @@ void FreeGameButtons()
 {
   int i;
 
-  for (i=0; i<NUM_GAME_BUTTONS; i++)
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
     FreeGadget(game_gadget[i]);
 }
 
@@ -8979,7 +8979,7 @@ static void MapGameButtons()
 {
   int i;
 
-  for (i=0; i<NUM_GAME_BUTTONS; i++)
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
     MapGadget(game_gadget[i]);
 }
 
@@ -8987,7 +8987,7 @@ void UnmapGameButtons()
 {
   int i;
 
-  for (i=0; i<NUM_GAME_BUTTONS; i++)
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
     UnmapGadget(game_gadget[i]);
 }