code wiki / (root) / nx_wasm_diablo.nx

nx_wasm_diablo.nx

buildroot/runtime/nx_wasm_diablo.nx

8724 B177 linesdepth 1pulls 2 transitivereach 1 importersview sourcekind librarytopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_diablo.nx -- BROWSER-PLAYABLE sovereign isometric ARPG ("that generation of game"): BASE-RELATIVE integer core, runs native (-> PNG) AND in the browser (base = 0). Built on nx_gfx_iso: an isometric stone dungeon with 2.5D walls, a shaded hero, fallen-enemy sprites, and the SIGNATURE dynamic torch lighting that FOLLOWS the hero. CLICK to move (the click maps a screen point to a destination); walk into a foe to strike it; grab the gold. NO float, NO JS logic, NO canvas drawing. init()/tick(input)/render()/score()/ww()/hh()/ fb_off()/click(x,y) = the wasm interface. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_gfx_iso.nx nx_nishi_font_core.nx nx_wasm_diablo.nx nx_wasm_diablo_gate.nx

imports: nx_gfx_iso.nxnx_nishi_font_core.nx

imported by: nx_wasm_diablo_gate.nx

structs

none

consts

9const W: i64 = 288
10const H: i64 = 192
11const OX: i64 = 144 // iso origin
12const OY: i64 = 22
13const NM: i64 = 4
14const SPD: i64 = 2
15const O_FB: i64 = 0 // framebuffer W*H i64
16const O_MX: i64 = 442368 // monster screen x[8] (W*H*8)
17const O_MY: i64 = 442432
18const O_MHP: i64 = 442496
19const O_MA: i64 = 442560 // monster alive[8]
20const O_ST: i64 = 442624 // 0=hx 1=hy 2=tx 3=ty 4=gold 5=hp 6=tick 7=atkcd 8=gx 9=gy 10=gtaken 11-15=fx 16=sfx
21const O_MSK: i64 = 442816 // (O_ST widened to 24 slots so st[16] = pending sfx event)
22const O_STR: i64 = 451008

functions

24func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: tick_impl
25func isgn(v: i64) -> i64 { if v > 0 { return 1 } if v < 0 { return 0 - 1 } return 0 }
called by 1: tick_impl
27func init_impl(base: i64) -> i64
called by 3: click_implinitmain calls 2: gx_isoxgx_isoy
45func click_impl(base: i64, x: i64, y: i64) -> i64
called by 2: clickmain calls 1: init_impl
52func tick_impl(base: i64, input: i64) -> i64
called by 2: tickmain calls 2: iabsisgn
86func draw_dungeon(base: i64) -> i64
113func hud(base: i64, x: i64, off: i64, val: i64, col: i64) -> i64
called by 1: render_impl calls 1: nf_draw_text_mem
128func render_impl(base: i64) -> i64
169func init() -> i64 { return init_impl(0) }
calls 1: init_impl
170func tick(input: i64) -> i64 { return tick_impl(0, input) }
calls 1: tick_impl
171func sfx_event() -> i64 { let st: *i64 = (0 + O_ST) as *i64; let e: i64 = st[16]; st[16] = 0; return e } // 1=hit 2=kill 3=coin 4=gameover; cleared on read
172func render() -> i64 { return render_impl(0) }
calls 1: render_impl
173func click(x: i64, y: i64) -> i64 { return click_impl(0, x, y) }
calls 1: click_impl
174func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[4] }
175func fb_off() -> i64 { return O_FB }
176func ww() -> i64 { return W }
177func hh() -> i64 { return H }