mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-12 03:47:12 +07:00
Aggregation of horizontal walls
This commit is contained in:
parent
c36313304b
commit
7e2b2679ba
@ -192,16 +192,23 @@ public class WallAggregatorTool extends ApplicationAdapter {
|
|||||||
|
|
||||||
IntMap<Filter> filters = new IntMap<>();
|
IntMap<Filter> filters = new IntMap<>();
|
||||||
|
|
||||||
for (int y = 0; y < 280; y++) {
|
for (Map.Zone zone : map.zones) {
|
||||||
for (int x = 0; x < 200; x++) {
|
//Map.Zone zone = map.zones.first();
|
||||||
int flags = map.flags(x, y);
|
for (int y = 0, ty = zone.y, height = zone.height; y < height; y++, ty++) {
|
||||||
|
for (int x = 0, tx = zone.x, width = zone.width; x < width; x++, tx++) {
|
||||||
|
int flags = map.flags(tx, ty);
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
|
int endX = tx + 1;
|
||||||
|
while (endX < width && map.flags(endX, ty) == flags) {
|
||||||
|
endX++;
|
||||||
|
}
|
||||||
|
|
||||||
BodyDef def = new BodyDef();
|
BodyDef def = new BodyDef();
|
||||||
def.type = BodyDef.BodyType.StaticBody;
|
def.type = BodyDef.BodyType.StaticBody;
|
||||||
def.position.set(x, -(y));
|
def.position.set((endX + tx) / 2f, -ty);
|
||||||
|
|
||||||
PolygonShape shape = new PolygonShape();
|
PolygonShape shape = new PolygonShape();
|
||||||
shape.setAsBox(0.5f, 0.5f);
|
shape.setAsBox((endX - tx) / 2f, 0.5f);
|
||||||
|
|
||||||
Filter filter = filters.get(flags);
|
Filter filter = filters.get(flags);
|
||||||
if (filter == null) {
|
if (filter == null) {
|
||||||
@ -216,6 +223,10 @@ public class WallAggregatorTool extends ApplicationAdapter {
|
|||||||
f.setFilterData(filter);
|
f.setFilterData(filter);
|
||||||
|
|
||||||
shape.dispose();
|
shape.dispose();
|
||||||
|
|
||||||
|
x += endX - tx - 1;
|
||||||
|
tx = endX - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user