use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class AnimationManager method getMinNumberOfAnimsOutOfBounds.
private int getMinNumberOfAnimsOutOfBounds(int y, int x, int y1, int x1, boolean positive) {
int minNumber = Integer.MAX_VALUE;
// TODO consider the panning distance?
int step = positive ? 1 : -1;
while (MathMaster.compare(y, y1, !positive)) {
x += step;
if (MathMaster.compare(x, x1, positive)) {
x = 0;
y += step;
}
Coordinates c_offset = new Coordinates(x, y);
adjustOffset(c_offset);
ArrayList<PhaseAnimation> list = new ArrayList<>(pendingCameraAdjustmentAnims);
for (PhaseAnimation anim : pendingCameraAdjustmentAnims) {
boolean result = anim.updatePoints();
if (result) {
list.remove(anim);
}
}
int size = list.size();
if (size < minNumber) {
minNumber = size;
}
offset = c_offset;
}
return minNumber;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class DC_PositionMaster method getShapedCoordinates.
public static Set<Coordinates> getShapedCoordinates(Coordinates baseCoordinate, FACING_DIRECTION facing, int width, int height, SHAPES shape) {
Set<Coordinates> list = new HashSet<>();
List<Coordinates> line;
switch(shape) {
case CROSS:
//
break;
case STAR:
// four diagonals
break;
case CONE:
// getOrCreate horizontal lines of increasing width
for (int i = 0; i < height; i++) {
list.addAll(getLine(FacingMaster.rotate(facing, false).getDirection(), baseCoordinate, width));
list.addAll(getLine(FacingMaster.rotate(facing, true).getDirection(), baseCoordinate, width));
baseCoordinate = baseCoordinate.getAdjacentCoordinate(facing.getDirection());
if (baseCoordinate == null) {
break;
}
width++;
}
break;
case RECTANGLE:
list.addAll(getLine(facing.getDirection(), baseCoordinate, height));
line = getLine(facing.getDirection(), baseCoordinate, height);
for (Coordinates c : line) {
list.addAll(getLine(FacingMaster.rotate(facing, false).getDirection(), c, width));
list.addAll(getLine(FacingMaster.rotate(facing, true).getDirection(), c, width));
}
line.remove(baseCoordinate);
list.addAll(line);
// }
break;
}
return list;
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class DC_PagedLogPanel method addComponents.
protected void addComponents() {
String pos = "pos 0 0";
add(getCurrentComponent(), pos);
addControls();
returnButton = new CustomButton(VISUALS.ADD) {
public void handleClick() {
back();
}
protected void playClickSound() {
DC_SoundMaster.playStandardSound(STD_SOUNDS.SLING);
}
public VISUALS getVisuals() {
if (!isEnabled()) {
return VISUALS.ADD_BLOCKED;
}
return super.getVisuals();
}
public boolean isEnabled() {
// nodeViewMode
return true;
}
};
// toggleButton = new CustomButton(BUTTON_VISUALS) {
// public void handleClick() {
// toggleMode();
// }
//
// protected void playSound() {
// DC_SoundMaster.playStandardSound(STD_SOUNDS.CLOCK);
// }
//
// };
//
// pos = "pos " + (getPanelWidth() - BUTTON_VISUALS.getWidth()) + " "
// + (getPanelHeight() - BUTTON_VISUALS.getHeight()) + "";
// add(toggleButton, pos);
pos = "pos 0 0";
add(returnButton, pos);
int i = 0;
if (entryNodes != null) {
for (final LogEntryNode node : entryNodes) {
int lineIndex = (node.getLineIndex()) % getRowCount();
if (lineIndex == 0) {
lineIndex = getRowCount();
}
Integer y = Math.min(getPanelHeight() - EntryNodeMaster.getRowHeight(isTopPage()), EntryNodeMaster.getRowHeight(isTopPage()) * (lineIndex));
// TODO
// top
// vs
// generic
// separate!
ImageButton entryNodeButton = new ImageButton((node.getButtonImagePath())) {
@Override
public void handleClick() {
if (entryNode == null) {
setCachedTopPageIndex(getCurrentIndex());
}
if (node.getLinkedAnimation() != null) {
for (ANIM anim : node.getLinkedAnimations()) {
PhaseAnimation animation = (PhaseAnimation) anim;
// DC_Game.game.getAnimationManager()
// .getAnimation(key);
animation.setPhaseFilter(node.getAnimPhasesToPlay());
if (animation != null) {
animation.setReplay(true);
animation.start();
animation.setAutoFinish(false);
}
}
Coordinates bufferedOffset = game.getAnimationManager().updatePoints();
game.getManager().refreshGUI();
game.getBattleField().getGrid().setNextOffsetCoordinate(bufferedOffset);
}
setNodeView(node);
}
@Override
protected void playClickSound() {
DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__OPEN_MENU);
}
};
pos = "pos " + 0 + " " + (y);
add(entryNodeButton, pos);
entryNodeButton.activateMouseListener();
setComponentZOrder(entryNodeButton, i);
i++;
}
}
setComponentZOrder(returnButton, i);
i++;
// setComponentZOrder(toggleButton, i);
// i++;
setComponentZOrder(forwardButton, i);
i++;
setComponentZOrder(backButton, i);
i++;
setComponentZOrder(getCurrentComponent(), i);
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class AnimMultiplicator method applyTemplateAngles.
private void applyTemplateAngles(Set<Coordinates> coordinates) {
int max = template.getNumberOfEmitters(getActive());
// 1 for ray, but we know coordinates precisely
List<EmitterActor> list = new ArrayList<>();
for (EmitterActor e : emitterList) {
int angle = 0;
for (Coordinates coordinate : coordinates) {
if (e.isGenerated()) {
continue;
}
EmitterActor actor = multiplicateEmitter(angle, coordinate, e);
angle += 360 / max;
list.add(actor);
}
}
list.forEach(a -> emitterList.add(a));
}
use of main.game.bf.Coordinates in project Eidolons by IDemiurge.
the class AnimMultiplicator method filterCoordinates.
private Collection<Coordinates> filterCoordinates(SPELL_ANIMS template, Set<Coordinates> coordinates) {
if (template != null) {
FACING_DIRECTION facing = getActive().getOwnerObj().getFacing();
List<Coordinates> filtered = new ArrayList<>(coordinates);
Coordinates farthest = CoordinatesMaster.getFarmostCoordinateInDirection(facing.getDirection(), new ArrayList<>(coordinates), null);
switch(template) {
// template.getNumberOfEmitters(getActive())
case RAY:
anim.setForcedDestinationForAll(farthest);
return Arrays.asList(farthest);
case BLAST:
break;
case WAVE:
case SPRAY:
{
boolean xOrY = !facing.isVertical();
filtered.removeIf(c -> farthest.getXorY(xOrY) != c.getXorY(xOrY));
while (filtered.size() < template.getNumberOfEmitters(getActive())) {
List<Coordinates> list = new ArrayList<>(coordinates);
list.removeAll(filtered);
list.removeIf(c -> farthest.getXorY(!xOrY) == c.getXorY(!xOrY));
Coordinates c = CoordinatesMaster.getFarmostCoordinateInDirection(facing.getDirection(), list, null);
if (c != null)
filtered.add(c);
}
if (ListMaster.isNotEmpty(filtered))
return filtered;
else
return coordinates;
}
case RING:
break;
case NOVA:
break;
}
}
return coordinates;
}
Aggregations