This reverts commit 8626082068.
This commit is contained in:
@@ -65,8 +65,7 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
TextMarker::new,
|
||||
LineMarker::new,
|
||||
TextureMarker::new,
|
||||
QuadMarker::new,
|
||||
LightMarker::new
|
||||
QuadMarker::new
|
||||
);
|
||||
|
||||
registerLegacyMarker("Minimap", PointMarker::new);
|
||||
@@ -621,12 +620,13 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
|
||||
/** Marker used for drawing various content to indicate something along with an objective. Mostly used as UI overlay. */
|
||||
public static abstract class ObjectiveMarker{
|
||||
/** Whether to display marker in the world. Do not modify directly if added, use control() instead. */
|
||||
public @IndexBool int world = 1;
|
||||
/** Whether to display marker on the minimap. Do not modify directly if added, use control() instead. */
|
||||
public @IndexBool int minimap = -1;
|
||||
/** Whether to use the marker as light. Do not modify directly if added, use control() instead. */
|
||||
public @IndexBool int light = -1;
|
||||
/** Internal use only! Do not access. */
|
||||
public transient int arrayIndex;
|
||||
|
||||
/** Whether to display marker in the world. */
|
||||
public boolean world = true;
|
||||
/** Whether to display marker on minimap. */
|
||||
public boolean minimap = false;
|
||||
/** Whether to scale marker corresponding to player's zoom level. */
|
||||
public boolean autoscale = false;
|
||||
/** On which z-sorting layer is marker drawn. */
|
||||
@@ -634,18 +634,13 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
|
||||
public void draw(float scaleFactor){}
|
||||
|
||||
public void drawLight(float scaleFactor){
|
||||
draw(scaleFactor);
|
||||
}
|
||||
|
||||
/** Control marker with world processor code. Ignores NaN (null) values. */
|
||||
public void control(LMarkerControl type, double p1, double p2, double p3){
|
||||
if(Double.isNaN(p1)) return;
|
||||
|
||||
switch(type){
|
||||
case world -> state.markers.updateMarker(state.markers.worldMarkers, this, !Mathf.equal((float)p1, 0f), m -> m.world, (m, i) -> m.world = i);
|
||||
case minimap -> state.markers.updateMarker(state.markers.mapMarkers, this, !Mathf.equal((float)p1, 0f), m -> m.minimap, (m, i) -> m.minimap = i);
|
||||
case light -> state.markers.updateMarker(state.markers.lightMarkers, this, !Mathf.equal((float)p1, 0f), m -> m.light, (m, i) -> m.light = i);
|
||||
case world -> world = !Mathf.equal((float)p1, 0f);
|
||||
case minimap -> minimap = !Mathf.equal((float)p1, 0f);
|
||||
case autoscale -> autoscale = !Mathf.equal((float)p1, 0f);
|
||||
case drawLayer -> drawLayer = (float)p1;
|
||||
}
|
||||
@@ -847,13 +842,8 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
Draw.z(drawLayer);
|
||||
Lines.stroke(Scl.scl((1f - fin) * stroke + 0.1f), color);
|
||||
Lines.circle(pos.x, pos.y, rad * fin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(float scaleFactor){
|
||||
float rad = radius * tilesize * scaleFactor;
|
||||
|
||||
renderer.lights.add(pos.x, pos.y, radius, color, color.a);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -911,6 +901,8 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
Fill.arc(pos.x, pos.y, radius * scaleFactor, (startAngle - endAngle) / 360f, rotation + endAngle, sides);
|
||||
}
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1051,11 +1043,6 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
Lines.line(pos.x, pos.y, color1, endPos.x, endPos.y, color2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(float scaleFactor){
|
||||
renderer.lights.line(pos.x, pos.y, endPos.x, endPos.y, stroke, color1, color1.a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void control(LMarkerControl type, double p1, double p2, double p3){
|
||||
super.control(type, p1, p2, p3);
|
||||
@@ -1260,48 +1247,6 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
|
||||
}
|
||||
|
||||
/** Displays a single point light. */
|
||||
public static class LightMarker extends PosMarker{
|
||||
public float radius = 5f;
|
||||
public Color color = Color.valueOf("ffd37f");
|
||||
|
||||
public LightMarker(int x, int y){
|
||||
this.pos.set(x, y);
|
||||
}
|
||||
|
||||
public LightMarker(int x, int y, Color color){
|
||||
this.pos.set(x, y);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public LightMarker(int x, int y, float radius, Color color){
|
||||
this.pos.set(x, y);
|
||||
this.radius = radius;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public LightMarker(){}
|
||||
|
||||
@Override
|
||||
public void drawLight(float scaleFactor){
|
||||
float rad = radius * tilesize * scaleFactor;
|
||||
|
||||
renderer.lights.add(pos.x, pos.y, radius, color, color.a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void control(LMarkerControl type, double p1, double p2, double p3){
|
||||
super.control(type, p1, p2, p3);
|
||||
|
||||
if(!Double.isNaN(p1)){
|
||||
switch(type){
|
||||
case radius -> radius = (float)p1;
|
||||
case color -> color.fromDouble(p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void lookupRegion(String name, TextureRegion out){
|
||||
TextureRegion region = Core.atlas.find(name);
|
||||
if(region.found()){
|
||||
@@ -1330,11 +1275,6 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
@Retention(RUNTIME)
|
||||
public @interface Vertices{}
|
||||
|
||||
/** For {@code int}; treats it as a boolean with -1 for false and any other value for true (defaulting to 1) */
|
||||
@Target(FIELD)
|
||||
@Retention(RUNTIME)
|
||||
public @interface IndexBool{}
|
||||
|
||||
/** For {@code byte}; treats it as a world label flag. */
|
||||
@Target(FIELD)
|
||||
@Retention(RUNTIME)
|
||||
|
||||
Reference in New Issue
Block a user