code wiki / _hdl_build / nx_vn.nx

nx_vn.nx

buildroot/runtime/_hdl_build/nx_vn.nx

9767 B91 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic vn
docsdependenciesstructsconstsfunctions

about

nx_vn.nx -- a VISUAL NOVEL engine (the simplest genre, the start of the climb): data-driven branching scenes + choices, emitted as PURE SOVEREIGN STATIC HTML -- ZERO JS, ZERO blit, no third-party. Scenes show via the CSS :target trick (one scene visible at a time; choices are <a href='#sN'>), so it plays in any browser with no script at all -- which is exactly why a VN is the right first genre for the no-blit / publish-to-nishifamily bar. Data-driven = moddable: scenes/choices are DATA the critic also reads. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_vn.nx nx_vn_critic.nx nx_vn_site.nx

imports: nx_syscalls.nx

imported by: nx_vn_critic.nxnx_vn_site.nx

structs

none

consts

8const VN_NS: i64 = 32 // max scenes
9const VN_MC: i64 = 4 // max choices per scene

functions

12func vn_scene(txt: *i64, nc: *i64, nbox: *i64, text: *u8) -> i64 { let i: i64 = nbox[0]; txt[i] = text as i64; nc[i] = 0; nbox[0] = i + 1; return i }
called by 2: vn_samplevn_sample2
13func vn_choice(nc: *i64, ct: *i64, cl: *i64, from: i64, label: *u8, to: i64) -> i64 { let j: i64 = nc[from]; ct[from*VN_MC + j] = to; cl[from*VN_MC + j] = label as i64; nc[from] = j + 1; return 0 }
called by 2: vn_samplevn_sample2
15func vn_words(s: *u8) -> i64 { if s[0] == (0 as u8) { return 0 } var w: i64 = 1; var i: i64 = 0; while s[i] != (0 as u8) { if s[i] == (32 as u8) { w = w + 1 } i = i + 1 } return w }
called by 1: critique
17func vp(buf: *u8, o: i64, s: *u8) -> i64 { var w: i64 = o; var i: i64 = 0; while s[i] != (0 as u8) { buf[w] = s[i]; w = w + 1; i = i + 1 } return w }
called by 1: vn_emit_html
18func vnum(buf: *u8, o: i64, v: i64) -> i64 { var w: i64 = o; var m: i64 = v; if m == 0 { buf[w]=48 as u8; return w+1 } let t: *u8=sys_mmap(24); var k: i64=0; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var j: i64=0; while j<k{buf[w]=t[k-1-j];w=w+1;j=j+1} return w }
called by 1: vn_emit_html calls 1: sys_mmap
22func vn_sample(txt: *i64, nc: *i64, ct: *i64, cl: *i64, nbox: *i64) -> i64
called by 1: gate_vn calls 2: vn_scenevn_choice
43func vn_sample2(txt: *i64, nc: *i64, ct: *i64, cl: *i64, nbox: *i64) -> i64
called by 2: gate_vnmain calls 2: vn_scenevn_choice
63func vn_emit_html(txt: *i64, nc: *i64, ct: *i64, cl: *i64, n: i64, title: *u8, buf: *u8) -> i64
called by 2: critiquemain calls 2: vpvnum