Browse Source

Clamp fix for new method

terrain-tweak2
MagicBot 12 months ago
parent
commit
496b49b349
  1. 8
      src/engine/InterestManagement/Terrain.java

8
src/engine/InterestManagement/Terrain.java

@ -57,7 +57,7 @@ public class Terrain {
this.terrain_size.y = this.zone.minor_radius * 2; this.terrain_size.y = this.zone.minor_radius * 2;
this.cell_count.x = this.image_size.x; this.cell_count.x = this.image_size.x;
this.cell_count.y = this.image_size.x; // Bug in exe this.cell_count.y = this.image_size.y; // Bug in exe
this.cell_size.x = terrain_size.x / this.cell_count.x; this.cell_size.x = terrain_size.x / this.cell_count.x;
this.cell_size.y = terrain_size.y / this.cell_count.y; this.cell_size.y = terrain_size.y / this.cell_count.y;
@ -160,12 +160,12 @@ public class Terrain {
// Calculate terrain cell with offset. Bug mirrors the exe // Calculate terrain cell with offset. Bug mirrors the exe
Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.y); Vector2f terrain_cell = new Vector2f(terrain_loc.x / this.cell_size.x, terrain_loc.y / this.cell_size.x);
// Clamp values when standing directly on pole // Clamp values when standing directly on pole
terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 2, terrain_cell.x)); terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x));
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 2, terrain_cell.y)); terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
return terrain_cell; return terrain_cell;
} }

Loading…
Cancel
Save