A cave's course depends only on the seed and the chunk it starts in, so each source chunk's tunnels are traced once, in its own coordinates, as the ellipsoids they carve. A chunk is carved as the game carves it: its eleven by eleven sources in order, each ellipsoid skipped where the terrain's water or earlier lava is near, lava and basalt below y 12 by geologic activity, the height map lowered where a cave opens. The terrain now keeps whether each block is solid, which makes the water exact; story locations keep caves away as theirs do. vsmv verify compares every stored block below our surface: 96.1% of the 18.5 million carved blocks agree, and of the rest all but 0.28% are what later passes put in caves or made of air themselves, the vugs and the block layers above all. Carving lifts the columns matching the stored height by 71,379. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.8 KiB
Makefile
51 lines
1.8 KiB
Makefile
# The generator has to reproduce .NET arithmetic bit for bit, so every
|
|
# unit is built without FMA contraction (clang on arm64 fuses a*b+c,
|
|
# .NET does not) and with wrapping signed overflow (C# is unchecked).
|
|
SEXC ?= $(HOME)/dev/sex/sexc
|
|
CFLAGS ?= -O2 -g
|
|
CFLAGS += -std=c11 -Wall -ffp-contract=off -fwrapv
|
|
CPPFLAGS += -Isrc -Ithird_party/nuklear -Ithird_party/stb -IcJSON $(shell pkg-config --cflags sdl3 libzstd)
|
|
# Sex writes C with only the parentheses precedence needs.
|
|
SEX_CFLAGS = -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-shift-op-parentheses
|
|
SDL_LIBS := $(shell pkg-config --libs sdl3)
|
|
ZSTD_LIBS := $(shell pkg-config --libs libzstd)
|
|
|
|
B = build
|
|
|
|
all: $(B)/vsmv $(B)/vs-map-viewer
|
|
|
|
# An import pastes the imported module's public forms into the
|
|
# importer, so a Sex object depends on every module it reads; sexc
|
|
# names them in a .d beside the object.
|
|
$(B)/%.o: src/%.sex | $(B)
|
|
$(SEXC) $< -c -o $@ --depfile=$(@:.o=.d) -- $(CFLAGS) $(SEX_CFLAGS) $(CPPFLAGS)
|
|
|
|
-include $(wildcard $(B)/*.d)
|
|
|
|
$(B)/nk.o: src/nk.c src/nk.h | $(B)
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
|
|
|
$(B)/cJSON.o: cJSON/cJSON.c cJSON/cJSON.h | $(B)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(B)/stb.o: src/stb.c third_party/stb/stb_image_write.h | $(B)
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
|
|
|
VSMV_OBJ = vsmv cs pb json maps save img dump lcg noise shape worldgen fastnoise rivers terra strata ores caves settings verify cJSON stb
|
|
|
|
$(B)/vsmv: $(VSMV_OBJ:%=$(B)/%.o)
|
|
$(CC) $^ -o $@ -lsqlite3 $(ZSTD_LIBS)
|
|
|
|
VIEWER_OBJ = viewer tiles search hover settings worldgen fastnoise rivers terra strata ores shape noise lcg maps save pb json cs nk cJSON stb
|
|
|
|
$(B)/vs-map-viewer: $(VIEWER_OBJ:%=$(B)/%.o)
|
|
$(CC) $^ -o $@ $(SDL_LIBS) -lsqlite3 $(ZSTD_LIBS)
|
|
|
|
$(B):
|
|
mkdir -p $@
|
|
|
|
clean:
|
|
rm -rf $(B)
|
|
|
|
.PHONY: all clean
|