public MapDisplayManager() {
    active = false;
    ani = new MoveAnimation(this);

    display = new FastTable<DisplayItem>();
    displayListComperator = new DisplayListComparator();
    display.setValueComparator(displayListComperator);
    corridor = FadingCorridor.getInstance();
    origin = new Location();

    legacyRendering = IllaClient.getCfg().getBoolean("legacyRender");

    dX = 0;
    dY = 0;

    levelAni =
        new MoveAnimation(
            new AnimatedMove() {
              @Override
              public void animationFinished(final boolean ok) {
                // nothing to do here
              }

              @Override
              public void setPosition(final int x, final int y, final int z) {
                dL = y;
              }
            });
    elevation = 0;
    dL = 0;
  }
  /**
   * Update the display entries.
   *
   * @param container the container that holds the game
   * @param delta the time in milliseconds since the last update
   */
  public void update(@Nonnull GameContainer container, int delta) {
    if (!active) {
      return;
    }

    int centerX = container.getWidth() >> 1;
    int centerY = container.getHeight() >> 1;

    int offX = (centerX - origin.getDcX()) + dX;
    int offY = (centerY - origin.getDcY()) + dY - dL;

    Avatar av = World.getPlayer().getCharacter().getAvatar();
    if (av != null) {
      glueAvatarToOrigin(av);
      corridor.setCorridor(av);
    }

    Camera.getInstance().setViewport(-offX, -offY, container.getWidth(), container.getHeight());

    Input engineInput = container.getEngine().getInput();
    gameScene.publishEvent(
        new CurrentMouseLocationEvent(engineInput.getMouseX(), engineInput.getMouseY()));
    gameScene.update(container, delta);
    updateFog(container);
    updateDeadView(container);
  }
  public void update(final GameContainer c, final int delta) {
    if (!active) {
      return;
    }

    final int centerX = c.getWidth() >> 1;
    final int centerY = c.getHeight() >> 1;

    final int offX = (centerX - origin.getDcX()) + dX;
    final int offY = (centerY - origin.getDcY()) + dY;

    final Avatar av = World.getAvatar();
    if (av != null) {
      glueAvatarToOrigin(av);
      corridor.setCorridor(av);
    }

    Camera.getInstance().setViewport(-offX, -offY, c.getWidth(), c.getHeight());
    Camera.getInstance().clearDirtyAreas();

    if (legacyRendering) {
      Camera.getInstance().markEverythingDirty();
    }

    synchronized (display) {
      for (final Rectangle rect : removedAreaList) {
        Camera.getInstance().markAreaDirty(rect);
      }
      synchronized (GameMap.LIGHT_LOCK) {
        while (true) {
          final MapInteractionEvent event = eventQueue.poll();
          if (event == null) {
            break;
          }

          for (int i = display.size() - 1; i >= 0; i--) {
            if (display.get(i).processEvent(c, delta, event)) {
              break;
            }
          }
        }

        // update the items
        for (int i = 0, displaySize = display.size(); i < displaySize; i++) {
          display.get(i).update(c, delta);
        }
      }
    }

    if (fadeOutColor.getAlpha() > 0) {
      fadeOutColor.a = AnimationUtility.approach(fadeOutColor.getAlpha(), 0, 0, 255, delta) / 255.f;
    }
  }
  public MapDisplayManager(@Nonnull Engine engine) {
    active = false;

    corridor = FadingCorridor.getInstance();
    origin = new Location();

    gameScene = engine.getAssets().createNewScene();

    dX = 0;
    dY = 0;
    elevation = 0;
    dL = 0;
  }