content: package tanks.gui.screen;
  
  import tanks.*;
  import tanks.obstacle.Obstacle;
  import tanks.tank.TankSpawnMarker;
  
  import java.util.ArrayList;
  
  public class DisplayLevel
  {
      @SuppressWarnings("unchecked")
      protected ArrayList<IDrawable>[] drawables = (ArrayList<IDrawable>[])(new ArrayList[10]);
  
      public ArrayList<TankSpawnMarker> spawns = new ArrayList<>();
  
      public DisplayLevel()
      {
          for (int i = 0; i < drawables.length; i++)
          {
              drawables[i] = new ArrayList<>();
          }
          Obstacle.draw_size = Game.tile_size;
      }
  
      public void draw()
      {
          Game.screen.drawDefaultBackground();
  
          for (Movable m: Game.movables)
              drawables[m.drawLevel].add(m);
  
          for (Obstacle o: Game.obstacles)
          {
              if (!Game.enable3d || !o.batchDraw)
                  drawables[o.drawLevel].add(o);
          }
  
          for (Effect e: Game.effects)
              drawables[7].add(e);
  
          for (int i = 0; i < this.drawables.length; i++)
          {
              if (i == 5 && Game.enable3d)
              {
                  Drawing drawing = Drawing.drawing;
                  Drawing.drawing.setColor(174, 92, 16);
                  Drawing.drawing.fillForcedBox(drawing.sizeX / 2, -Game.tile_size / 2, 0, drawing.sizeX + Game.tile_size * 2, Game.tile_size, Obstacle.draw_size, (byte) 0);
                  Drawing.drawing.fillForcedBox(drawing.sizeX / 2, Drawing.drawing.sizeY + Game.tile_size / 2, 0, drawing.sizeX + Game.tile_size * 2, Game.tile_size, Obstacle.draw_size, (byte) 0);
                  Drawing.drawing.fillForcedBox(-Game.tile_size / 2, drawing.sizeY / 2, 0, Game.tile_size, drawing.sizeY, Obstacle.draw_size, (byte) 0);
                  Drawing.drawing.fillForcedBox(drawing.sizeX + Game.tile_size / 2, drawing.sizeY / 2, 0, Game.tile_size, drawing.sizeY, Obstacle.draw_size, (byte) 0);
              }
  
              for (IDrawable d: this.drawables[i])
              {
                  d.draw();
  
                  if (d instanceof Movable)
                      ((Movable) d).drawTeam();
              }
  
              if (Game.glowEnabled)
              {
                  for (IDrawable d : this.drawables[i])
                  {
                      if (d instanceof IDrawableWithGlow && ((IDrawableWithGlow) d).isGlowEnabled())
                          ((IDrawableWithGlow) d).drawGlow();
                  }
              }
  
              drawables[i].clear();
          }
      }
  }
  