refactor(runtime,packages,examples): named constants, package enums, idiom sweep

- runtime: HEADLESS_FRAME_PATH, STICK_DEADZONE / STICK_LEFT_X/Y, key and
  byte codes as char literals throughout (`k == 'w'`, `fill(rt_map, ' ', …)`)
- ludic.gameplay/stats: drop the duplicate `stat_field` (it answered "atk"
  for every build stat); Stats.base uses stats_field_name
- ludic.shooter: compare aim modes and fire patterns with AimMode.* and
  WeaponPattern.* instead of raw ints; STICK_RIGHT_X/Y
- ludic.npcai: DecisionMade / brain_set_state use AiState.*
- examples/games/menu.ludic uses Font.load / Ui.* with FONT_PATH and
  BACKDROP named; strings.ludic header says what it prints
- whole tree: `x = x + 1` → `x += 1` (single-term right-hand sides only),
  `0 - x` → `-x`, ASCII codes → char literals; every .ludic and every
  ```ludic fence reformatted with the fixed formatter (whitespace only)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-05 01:12:26 +03:00
parent e3e1bc7784
commit bf36bc8a8f
103 changed files with 1256 additions and 1252 deletions

View file

@ -16,7 +16,7 @@ function tiled_apply_field(e: int, fname: pointer, v: int) -> void {
let fid = world_field_id(pi, fname)
if fid >= 0 { world_set(e, pi, fid, v) }
}
pi = pi + 1
pi += 1
}
}
@ -26,7 +26,7 @@ function tiled_apply_field(e: int, fname: pointer, v: int) -> void {
# unknown. Opt-in — the core load never calls this.
function tiled_spawn_object(m: Tmap, obj: Val, model_name: pointer) -> int {
let mid = world_model_id(model_name)
if mid < 0 { return 0 - 1 }
if mid < 0 { return -1 }
let e = world_spawn(mid)
let pp = world_prop_id("Position")
if pp >= 0 and world_has(e, pp) == 1 {
@ -40,7 +40,7 @@ function tiled_spawn_object(m: Tmap, obj: Val, model_name: pointer) -> int {
while i < value_count(props) {
let p = value_at(props, i)
tiled_apply_field(e, value_as_str(value_get(p, "name")), tiled_prop_int(obj, value_as_str(value_get(p, "name"))))
i = i + 1
i += 1
}
return e
}
@ -50,6 +50,6 @@ function tiled_spawn_layer(m: Tmap, layer: int, model_name: pointer) -> int {
var n = 0
let c = tmap_object_count(m, layer)
var i = 0
while i < c { if tiled_spawn_object(m, tmap_object(m, layer, i), model_name) >= 0 { n = n + 1 }; i = i + 1 }
while i < c { if tiled_spawn_object(m, tmap_object(m, layer, i), model_name) >= 0 { n += 1 }; i += 1 }
return n
}