tool paths configurable by environment (LLAMAMOD_CD, LAMA_WINEPREFIX, LAMA_MOD, APPTEST_ROOT, APPTEST_ISO; tools/lamapaths.py), music tracks without a file on the cd marked in the editor and the tutorial uses kronk, levelbuild.py accepts the english texture names

This commit is contained in:
MineTec committed 2026-11-07 16:34:17 +01:00
1 parent a0d961357e
commit 6d449257a7
21 files changed
+153 -44

No files matched your search

+31 -6
View File
@@ -13,8 +13,9 @@ ambient occlusion) and object placement (strats by type name, parameters from th
Coordinates (as in the game / for strats): x east, y up, z = grid row
(positive). 1 unit = 1 grid cell. The base level's grid is 96x96 (x,z in 0..96).
Angles in degrees (0..360) about the y axis.
Texture names (TEX/FLAT below) are German keys and part of the level script API; TEX indices are
village indices, other bases (--base) map a name to the same picture or reject it.
Texture names (TEX/FLAT below) are German keys and part of the level script API; the English names of
the Java builder work too (ALIASES). TEX indices are village indices, other bases (--base) map a name
to the same picture or reject it.
Docs: ../notes/levelbau.md
"""
import argparse
@@ -35,9 +36,11 @@ import mapchunk as M # noqa: E402
import stpcwalk # noqa: E402
import strats as S # noqa: E402
WADS = os.path.expanduser('~/.wine-lama/iso-dk/Setup/Eng/Cd/wads')
import lamapaths # noqa: E402
WADS = lamapaths.CD_WADS
BASE = os.path.join(WADS, 't1l1m001.wad')
MODWAD = os.path.expanduser('~/.wine-lama/mods/testlevel/wads/T1L9M001.wad')
MODWAD = lamapaths.TESTLEVEL_WAD
FX = 4096
# texture names for the village (t1l1m001). Contact sheet: notes/img/texturen_dorf.png
@@ -61,6 +64,23 @@ FLAT = {
'rot': (190, 50, 40), 'gelb': (230, 190, 60), 'blau': (60, 90, 190), 'schwarz': (20, 20, 20),
'gruen': (70, 140, 50), 'grau': (120, 120, 120),
}
# English names of the Java builder (levelbuild/LevelBuilder.java) -> the German keys above
ALIASES = {
'grass': 'gras', 'grass2': 'gras2', 'grass_light': 'gras_hell', 'grass_striped': 'gras_streifen',
'grass_dark': 'gras_dunkel', 'grass_patch': 'gras_fleck', 'flowers': 'blumen', 'flowers2': 'blumen2',
'flowers3': 'blumen3', 'earth': 'erde', 'earth2': 'erde2', 'earth3': 'erde3', 'grass_edge': 'graskante',
'grass_edge2': 'graskante2', 'grass_edge_sand': 'graskante_sand', 'stone': 'stein', 'stone2': 'stein2',
'stone_blue': 'stein_blau', 'stone_edge': 'stein_kante', 'stone_green': 'stein_gruen',
'stone_green2': 'stein_gruen2', 'stone_moss': 'stein_moos', 'slab': 'platte', 'slab2': 'platte2',
'slab_edge': 'platte_kante', 'wood_dark': 'holz_dunkel', 'bamboo': 'bambus', 'bamboo2': 'bambus2',
'wood_grain': 'holz_maser', 'wood_grain2': 'holz_maser2', 'crate': 'kiste', 'bark': 'rinde',
'wood_brown': 'holz_braun', 'wood_brown2': 'holz_braun2', 'beam': 'holzbalken', 'wood_rings': 'holz_ringe',
'wood_edge': 'holzkante', 'inca': 'inka', 'pattern_purple': 'muster_lila', 'pattern_purple2': 'muster_lila2',
'pattern_purple3': 'muster_lila3', 'mushroom_red': 'pilz_rot', 'mushroom_red2': 'pilz_rot2',
'stone_stairs': 'treppe_stein',
'sea': 'meer', 'sea_deep': 'meer_tief', 'white': 'weiss', 'red': 'rot', 'yellow': 'gelb', 'blue': 'blau',
'black': 'schwarz', 'green': 'gruen', 'grey': 'grau',
}
# strat types present in the village code but not placed in the village:
# take type fields (nvars, slots, flags, extra) + parameters from another level
FOREIGN = {'RubyIdol': 't1l1m002.wad'}
@@ -200,6 +220,7 @@ class Level:
key = 'rgb%02x%02x%02x' % t
FLAT.setdefault(key, t)
t = key
t = ALIASES.get(t, t)
if t in TEX:
names = self._base_names()
if t not in names:
@@ -425,7 +446,7 @@ class Level:
V.append(tuple(float(c) * scale + o for c, o in zip(p[1:4], offset)))
elif p[0] == 'usemtl':
m = p[1]
cur = int(m[4:]) if m.startswith('tex_') else (m if (m in TEX or m in FLAT) else tex)
cur = int(m[4:]) if m.startswith('tex_') else (m if (m in TEX or m in FLAT or m in ALIASES) else tex)
elif p[0] == 'f':
ids = [int(t.split('/')[0]) for t in p[1:]]
pts = [V[i - 1 if i > 0 else len(V) + i] for i in ids]
@@ -980,6 +1001,8 @@ def main():
ap.add_argument('--textures', metavar='PNG')
ap.add_argument('--set', action='append', default=[], help='variable for the level script, e.g. --set teil=a')
a = ap.parse_args()
if a.types or a.textures or a.level:
lamapaths.need(a.base, 'base level', 'pass --base or set LLAMAMOD_CD')
if a.types:
L = Level(a.base)
for n in L.types():
@@ -990,9 +1013,10 @@ def main():
if a.textures:
import subprocess
names = {v: k for k, v in TEX.items()}
english = {g: e for e, g in ALIASES.items()}
subprocess.run([sys.executable, os.path.join(HERE, 'texsheet.py'), a.base, a.textures], check=True)
for i in sorted(names):
print('%4d %s' % (i, names[i]))
print('%4d %-16s %s' % (i, names[i], english.get(names[i], '')))
return
if not (a.level and a.out):
ap.error('specify LEVEL.py and OUT.wad')
@@ -1006,6 +1030,7 @@ def main():
mod.report(L)
if a.install:
import shutil
lamapaths.need(os.path.dirname(MODWAD), 'TestLevel mod folder', 'set LAMA_WINEPREFIX')
if not os.path.exists(MODWAD + '.orig'):
shutil.copy2(MODWAD, MODWAD + '.orig')
shutil.copyfile(a.out, MODWAD)