find one rock at any depth
A new rock mode looks for the one highlighted rock anywhere between the surface and the mantle: the overlay shows the columns that hold it, the cursor label how deep it starts, and Find nearest the nearest such column. It can be chosen only while one rock is highlighted, and while it is on, clicking a rock in the legend highlights that one instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,13 +29,16 @@
|
||||
|
||||
(pub define MAX-TILES 65536)
|
||||
;;; Not worldgen maps: Rivers' distance to the nearest river, the
|
||||
;;; terrain height, and the rock at the surface, at a depth or at a Y.
|
||||
;;; terrain height, and the rock at the surface, at a depth or at a Y,
|
||||
;;; or where one rock lies at any depth.
|
||||
(pub define LAYER-RIVERS 6)
|
||||
(pub define LAYER-HEIGHT 7)
|
||||
(pub define LAYER-ROCK 8)
|
||||
(pub define ROCK-AT-SURFACE 0)
|
||||
(pub define ROCK-AT-DEPTH 1)
|
||||
(pub define ROCK-AT-Y 2)
|
||||
;;; The param's value is then the rock's index.
|
||||
(pub define ROCK-ANY-DEPTH 3)
|
||||
;;; Rock tile values besides rock indices.
|
||||
(pub define VALUE-WATER 253)
|
||||
(pub define VALUE-AIR 254)
|
||||
@@ -280,7 +283,9 @@
|
||||
(return px))
|
||||
|
||||
;;; The rock tile: per sample, the rock at the surface, at a depth
|
||||
;;; below it, or at an absolute Y (water or air above the surface).
|
||||
;;; below it, or at an absolute Y (water or air above the surface); or,
|
||||
;;; at any depth, the rock where the column holds it at all and air
|
||||
;;; where it doesn't.
|
||||
(fn render-rocks ((tr (* terra)) (rocks (* strata)) (k tile-key) (size (* int))) (* u8)
|
||||
(var res int (. k stratum))
|
||||
(var step int (/ 512 res))
|
||||
@@ -308,7 +313,10 @@
|
||||
(if (== mode ROCK-AT-DEPTH) (= y (- h value))
|
||||
(== mode ROCK-AT-Y) (= y value))
|
||||
(var v u8 VALUE-AIR)
|
||||
(if (< y 0) (= v ROCK-MANTLE)
|
||||
(if (== mode ROCK-ANY-DEPTH)
|
||||
(for (var ry int 1) (<= ry h) (++ ry)
|
||||
(if (== [column ry] value) (= v (cast value u8))))
|
||||
(< y 0) (= v ROCK-MANTLE)
|
||||
(<= y h) (= v [column y])
|
||||
(< y (. tr sea-level)) (= v VALUE-WATER))
|
||||
(= [out (+ (* (+ (/ (* cz 32) step) dz) res) (/ (* cx 32) step) dx)] v)))))
|
||||
|
||||
Reference in New Issue
Block a user