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

@ -60,15 +60,15 @@ function tw_alloc() -> int {
var i = 0
while i < TW_MAX {
if tw_used[i] == 0 { return i }
i = i + 1
i += 1
}
# none free: reuse the first finished handle so long-lived games don't leak.
i = 0
while i < TW_MAX {
if tw_done[i] != 0 { return i }
i = i + 1
i += 1
}
return 0 - 1
return -1
}
# append one segment to a handle (internal). Silently ignored past TW_SEGS.
@ -88,7 +88,7 @@ function tw_push(h: int, kind: int, from: int, to: int, dur: int, ease: int) ->
# start a new tween handle: from -> to over `dur` ticks with easing `ease`.
function tween_to(from: int, to: int, dur: int, ease: int) -> int {
let h = tw_alloc()
if h < 0 { return 0 - 1 }
if h < 0 { return -1 }
tw_used[h] = 1
tw_seg[h] = 0
tw_nseg[h] = 0
@ -187,7 +187,7 @@ function tw_advance_one(h: int) -> void {
# (a delay segment holds tw_value unchanged.)
if tick >= dur { # this segment finished: advance
if kind == 0 { tw_value[h] = tw_to[s] } # rest exactly on the target
seg = seg + 1
seg += 1
tw_seg[h] = seg
tw_tick[h] = 0
if seg >= n { tw_done[h] = 1 }
@ -203,6 +203,6 @@ function esys_tween() -> void {
var i = 0
while i < TW_MAX {
if (tw_used[i] != 0) and (tw_done[i] == 0) { tw_advance_one(i) }
i = i + 1
i += 1
}
}