put conditional operands back where they are used
A conditional expression as an operand keeps its parentheses now (sex#59), so the clamps and offsets are written inline again. The story's z direction stays a local: it is drawn before the distances, and inlining it would reorder the draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -222,12 +222,9 @@
|
||||
;;; Terrain height, shaded: water by depth under sea level, land by
|
||||
;;; height, lit from the north-west.
|
||||
(fn height-colour ((h int) (west int) (north int) (sea int) (size-y int)) u32
|
||||
;; TODO sex#59: clamp the depth inline once a conditional operand
|
||||
;; keeps its parentheses.
|
||||
(var depth int (- sea h))
|
||||
(if (> depth 40) (= depth 40))
|
||||
(if (< h sea)
|
||||
(return (lerp-colour 0x61A9D8 0x121B63 (/ (* depth 255) 40))))
|
||||
(return (lerp-colour 0x61A9D8 0x121B63 (/ (* (if (> depth 40) 40 depth) 255) 40))))
|
||||
(var t int (/ (* (- h sea) 255) (- size-y sea)))
|
||||
(var base u32 (if (< t 32) (lerp-colour 0x558A38 0x7EA23A (* t 8))
|
||||
(if (< t 96) (lerp-colour 0x7EA23A 0x976953 (/ (* (- t 32) 255) 64))
|
||||
|
||||
Reference in New Issue
Block a user