generate the region maps as the game does

Every map in all 118 stored regions matches the save to the pixel, so
the port is checked against ground truth rather than eyeballed. Getting
there meant reproducing .NET quirks the output depends on: LCGRandom
reseeding from its previous seed, Dictionary slot order in
NaturalShape, and C#'s left-to-right evaluation of RNG draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 18:12:40 +03:00
parent 90b5d50fa5
commit 63fd30a189
12 changed files with 1843 additions and 36 deletions

24
src/maps.sex Normal file
View File

@@ -0,0 +1,24 @@
;;; The map types both sides of the comparison produce: what the save
;;; stored and what the generator makes for one map region.
(include stdlib.h)
(pub define MAX-STRATA 32)
;;; IntDataMap2D: a square map whose border pixels only feed lerps
;;; and blurs. The region's own pixels are the inner
;;; (size - pad-tl - pad-br) square.
(pub record int-map ((data (* i32)) (size i32) (pad-tl i32) (pad-br i32)))
(pub record region-maps
((landform int-map) (climate int-map) (geoprov int-map) (upheaval int-map)
(ocean int-map) (strata [int-map MAX_STRATA]) (strata-count int)))
(pub fn region-maps/free ((m (* region-maps))) void
(free (. m landform data))
(free (. m climate data))
(free (. m geoprov data))
(free (. m upheaval data))
(free (. m ocean data))
(for (var i int 0) (< i (. m strata-count)) (++ i)
(free (. [(. m strata) i] data))))