refactor(packages): 0.R5 - the rest of the lazy starts are defaults - hints' rail (sized by hints_config), lab's CRC table, rpg's crafting / items / inventory / quests / dialog, shooter's weapons, prefs, and npc's and gameplay's empty ensures gone; gameplay's faction table sits beside its state, since a default names only what is declared before it; --tighten over their tests and examples

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 03:07:29 +03:00
parent 9e4f4edb92
commit f516148e46
15 changed files with 73 additions and 169 deletions

View file

@ -2,21 +2,21 @@
# compressed (a PNG anything opens, with no zlib here): the shot is the PPM's pixels, filter 0
# on every row, in deflate's stored blocks, with its CRCs and its Adler-32.
function lp_table_init(lab_st: mut LabState) -> void {
if lab_st.lp_table != null { return }
lab_st.lp_table = new []long
# the CRC-32 table, made once with the state
function lp_crc_table() -> []long {
let t = new []long
let poly: long = 3988292384 # 0xEDB88320: eight hex digits would be a 32-bit pattern
for n in 0 .. 256 {
var c = long(n)
for k in 0 .. 8 {
if (c & long(1)) != long(0) { c = (c >> long(1)) ^ poly } else { c = c >> long(1) }
}
push(lab_st.lp_table, c)
push(t, c)
}
return t
}
# CRC-32 of out[from .. from + n)
function lp_crc(lab_st: mut LabState, out: []byte, from: int, n: int) -> long {
lp_table_init(lab_st)
let mask: long = 4294967295
var c = mask
for i in from .. from + n {

View file

@ -2,7 +2,7 @@
export state LabState {
lb_plate: Actor = null
lb_plate_dir: string = ""
lp_table: []long = null
lp_table: []long = lp_crc_table()
lp_w: int = 0
lp_h: int = 0
lb_scene: string = ""