rework the viewer around base layers, overlays and side panels
One base layer is drawn opaque and any number of overlays over it, so rocks can be looked for on top of the terrain rather than instead of it. Settings and rock finding live in fixed panels beside the map, not in windows over it. What is under the cursor is worked out on a thread of its own, since computing it per frame stalled the window. Find nearest searches regions outward from the view's centre and stops once no nearer region is left; probes leave pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
(import terra)
|
||||
(import strata)
|
||||
|
||||
(pub define MAX-TILES 16384)
|
||||
(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.
|
||||
(pub define LAYER-RIVERS 6)
|
||||
@@ -439,9 +439,11 @@
|
||||
(= (. self queue-pos) 0)
|
||||
(= (. self waiting) 0))
|
||||
|
||||
;; The texture for KEY if it is ready, else NULL and the tile is
|
||||
;; queued behind those requested earlier this frame.
|
||||
(pub fn request ((self (* tiles)) (renderer (* SDL-Renderer)) (k tile-key)) (* SDL-Texture)
|
||||
;; The texture for KEY if it is ready, and VALUES and SIZE if it is a
|
||||
;; value tile (both may be NULL); else NULL and the tile is queued
|
||||
;; behind those requested earlier this frame.
|
||||
(pub fn request ((self (* tiles)) (renderer (* SDL-Renderer)) (k tile-key)
|
||||
(values (* * u8)) (size (* int))) (* SDL-Texture)
|
||||
(var slot int (index-get self k))
|
||||
(if (< slot 0)
|
||||
(do
|
||||
@@ -470,7 +472,11 @@
|
||||
(= (. tl pixels) NULL)
|
||||
(= (. tl state) TILE-DRAWN)))
|
||||
(if (== (. tl state) TILE-DRAWN)
|
||||
(return (. tl texture)))
|
||||
(do
|
||||
;; a value tile's values, for whoever wants to count them
|
||||
(if values (= (* values) (. tl values)))
|
||||
(if size (= (* size) (. tl size)))
|
||||
(return (. tl texture))))
|
||||
(++ (. self waiting))
|
||||
(if (&& (== (. tl state) TILE-QUEUED) (< (. self queue-len) MAX-TILES))
|
||||
(do
|
||||
|
||||
Reference in New Issue
Block a user