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; }
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; } }