public double findShortestStrut() { double minLength = Double.MAX_VALUE; for (int i = 0; i < struts.size(); i++) { minLength = Math.min(minLength, struts.get(i).getSqLength()); } return Math.sqrt(minLength); }
public WB_FrameNode getNeighbor(final int index) { if ((index < 0) || (index >= struts.size())) { throw new IllegalArgumentException("Index outside of strut range."); } if (struts.get(index).start() == this) { return struts.get(index).end(); } return struts.get(index).start(); }
public ArrayList<WB_FrameNode> getNeighbors() { final ArrayList<WB_FrameNode> result = new ArrayList<WB_FrameNode>(); for (int i = 0; i < struts.size(); i++) { if (struts.get(i).start() == this) { result.add(struts.get(i).end()); } else { result.add(struts.get(i).start()); } } return result; }
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 boolean addStrut(final WB_FrameStrut strut) { if ((strut.start() != this) && (strut.end() != this)) { return false; } for (int i = 0; i < struts.size(); i++) { if ((struts.get(i).start() == strut.start()) && (struts.get(i).end() == strut.end())) { return false; } } struts.add(strut); return true; }
/** 입장 가능한 방 을 가져온다 */ public int getRoomNum() { int room = 5; if (_roomlist1.size() <= 0 && _step < 1) { room = 0; } else if (_roomlist1.size() <= 8 && _step < 1) { room = 1; } else if (_roomlist2.size() <= 8 && _step < 2) { room = 2; } else if (_roomlist3.size() <= 8 && _step < 3) { room = 3; } else if (_roomlist4.size() <= 8 && _step < 4) { room = 4; } return room; }
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 boolean removeStrut(final WB_FrameStrut strut) { if ((strut.start() != this) && (strut.end() != this)) { return false; } struts.remove(strut); return true; }
/** * Implementation of the core rendering function that just renders the map to the assigned graphic * context. * * @param g the graphics context used for the render operation */ private void renderImpl(final Graphics g) { final Camera camera = Camera.getInstance(); g.pushTransform(); g.translate(-camera.getViewportOffsetX(), -camera.getViewportOffsetY()); Camera.getInstance().clearDirtyAreas(g); synchronized (display) { synchronized (GameMap.LIGHT_LOCK) { // draw all items for (int i = 0, displaySize = display.size(); i < displaySize; i++) { display.get(i).draw(g); } } } g.popTransform(); }
/** 동굴안에 있는 유저 리스트에 더한다 */ public void addUser4room(L1PcInstance pc, int room) { switch (room) { case 0: case 1: _roomlist1.add(pc); break; case 2: _roomlist2.add(pc); break; case 3: _roomlist3.add(pc); break; case 4: _roomlist4.add(pc); break; default: break; } }
/** * Remove and add a item again. This has to be done in case the value of a item changed. * * @param item the display item to remove and add again */ public void readd(final DisplayItem item) { if (item == null) { assert false : "Trying to add NULL displayItem"; return; } synchronized (display) { display.remove(item); insertSorted(item); } }
private void insertSorted(final DisplayItem item) { int currentStart = 0; int currentEnd = display.size() - 1; int middle; DisplayItem foundItem; int compareResult; while (currentStart <= currentEnd) { middle = currentStart + ((currentEnd - currentStart) >> 1); foundItem = display.get(middle); compareResult = displayListComperator.compare(foundItem, item); if (compareResult < 0) { currentStart = middle + 1; } else if (compareResult > 0) { currentEnd = middle - 1; } else { display.add(middle, item); return; } } display.add(currentStart, item); }
public double findSmallestSpanAroundStrut(final int i) { final int n = struts.size(); if ((i < 0) || (i >= n)) { throw new IllegalArgumentException("Index beyond strut range."); } final ArrayList<WB_FrameNode> nnodes = getNeighbors(); if (n == 1) { return 2 * Math.PI; } else if (n == 2) { final WB_Vector u = nnodes.get(0).subToVector(this); final WB_Vector w = nnodes.get(1).subToVector(this); u._normalizeSelf(); w._normalizeSelf(); final double udw = WB_Math.clamp(u.dot(w), -1, 1); if (udw < WB_Epsilon.EPSILON - 1) { return Math.PI; } else { return Math.acos(udw); } } else { double minAngle = Double.MAX_VALUE; final WB_Vector u = nnodes.get(i).subToVector(this); u._normalizeSelf(); for (int j = 0; j < n; j++) { if (i != j) { final WB_Vector w = nnodes.get(j).subToVector(this); w._normalizeSelf(); final double a = Math.acos(u.dot(w)); minAngle = WB_Math.min(minAngle, a); } } return minAngle; } }
public void AddAttackClan(String attack_clan_name) { if (!_attackClanList.contains(attack_clan_name)) { _attackClanList.add(attack_clan_name); } }
public void InitAttackClan() { _attackClanList.clear(); }
/** * Remove a node from the list of tiles that were not fully checked yet. * * @param node the node that shall be removed from the list */ private void removeFromOpen(final PathNode node) { node.setOpen(false); open.remove(node); }
public double findSmallestSpanAroundStrut(final WB_FrameStrut strut) { return findSmallestSpanAroundStrut(struts.indexOf(strut)); }
/** 레어에 진입할 유저를 넣는다 */ public void addLairUser(L1PcInstance pc) { _antalist.add(pc); }
/** 레어에 진입한 유저 수를 가져온다 */ public int countLairUser() { return _antalist.size(); }
public void removeStrut(final int index) { if ((index < 0) || (index >= struts.size())) { throw new IllegalArgumentException("Index outside of strut range."); } struts.remove(index); }
private void tel4roomOut() { for (int i = 0; i > _roomlist1.size(); i++) { L1PcInstance pc = _roomlist1.get(i); // 방 아닌곳 좌표 잡아서 마을로텔 시키자 } }
public WB_FrameStrut getStrut(final int index) { if ((index < 0) || (index >= struts.size())) { throw new IllegalArgumentException("Index outside of strut range."); } return struts.get(index); }
/** * Remove a node from the list of tiles that were considered already. * * @param node the node that shall be removed from the list */ private void removeFromClosed(final PathNode node) { node.setClosed(false); closed.remove(node); }
public String[] GetAttackClanList() { return _attackClanList.toArray(new String[_attackClanList.size()]); }
public void RemoveAttackClan(String attack_clan_name) { if (_attackClanList.contains(attack_clan_name)) { _attackClanList.remove(attack_clan_name); } }
/** * Remove item from screen * * @param item */ public void remove(final DisplayItem item) { synchronized (display) { display.remove(item); removedAreaList.add(new Rectangle(item.getLastDisplayRect())); } }
public boolean CheckAttackClan(String attack_clan_name) { if (_attackClanList.contains(attack_clan_name)) { return true; } return false; }
public int getOrder() { return struts.size(); }
public int GetAttackClanListSize() { return _attackClanList.size(); }
/** * Add a path node to the list of nodes that were not fully checked yet. * * @param node the path node that shall be added */ private void addToOpen(final PathNode node) { open.add(node); node.setOpen(true); }