NPC paths now show action index at points

This commit is contained in:
Collin Smith 2019-02-21 00:35:06 -08:00
parent 27976a3712
commit 8cfe8f9090
3 changed files with 18 additions and 5 deletions

View File

@ -432,7 +432,7 @@ public class Entity {
shapes.set(ShapeRenderer.ShapeType.Line);
}
public void drawDebugPath(ShapeRenderer shapes) {}
public void drawDebugPath(PaletteIndexedBatch batch, ShapeRenderer shapes) {}
public void draw(Batch batch) {
draw((PaletteIndexedBatch) batch);

View File

@ -53,7 +53,7 @@ public class Monster extends Entity {
}
@Override
public void drawDebugPath(ShapeRenderer shapes) {
public void drawDebugPath(PaletteIndexedBatch batch, ShapeRenderer shapes) {
DS1.Path path = object.path;
if (path == null) return;
float p1x = +(position.x * Tile.SUBTILE_WIDTH50) - (position.y * Tile.SUBTILE_WIDTH50);
@ -91,6 +91,19 @@ public class Monster extends Entity {
shapes.setColor(Color.WHITE);
shapes.rect(p1x - HALF_BOX, p1y - HALF_BOX, BOX_SIZE, BOX_SIZE);
}
shapes.end();
batch.begin();
batch.setShader(null);
for (int i = 0; i < path.numPoints; i++) {
DS1.Path.Point point = path.points[i];
p1x = +(point.x * Tile.SUBTILE_WIDTH50) - (point.y * Tile.SUBTILE_WIDTH50);
p1y = -(point.x * Tile.SUBTILE_HEIGHT50) - (point.y * Tile.SUBTILE_HEIGHT50);
Diablo.fonts.consolas16.draw(batch, Integer.toString(point.action), p1x, p1y - BOX_SIZE, 0, Align.center, false);
}
batch.end();
batch.setShader(Diablo.shader);
shapes.begin(ShapeRenderer.ShapeType.Filled);
}
@Override

View File

@ -491,7 +491,7 @@ public class MapRenderer {
}
if (RENDER_DEBUG_PATHS)
drawDebugPaths(shapes);
drawDebugPaths(batch, shapes);
if (RENDER_DEBUG_CAMERA) {
float viewportWidth = width;
@ -883,7 +883,7 @@ public class MapRenderer {
}
}
private void drawDebugPaths(ShapeRenderer shapes) {
private void drawDebugPaths(PaletteIndexedBatch batch, ShapeRenderer shapes) {
shapes.set(ShapeRenderer.ShapeType.Filled);
int startX2 = startX;
int startY2 = startY;
@ -901,7 +901,7 @@ public class MapRenderer {
Vector3 position = entity.position();
if ((stx <= position.x && position.x < stx + Tile.SUBTILE_SIZE)
&& (sty <= position.y && position.y < sty + Tile.SUBTILE_SIZE)) {
entity.drawDebugPath(shapes);
entity.drawDebugPath(batch, shapes);
}
}
}