code wiki / _hdl_build / nx_wire_diablo2_gate.nx

nx_wire_diablo2_gate.nx

buildroot/runtime/_hdl_build/nx_wire_diablo2_gate.nx

37853 B979 linesdepth 6pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic wire
docsdependenciesstructsconstsfunctions

about

nx_wire_diablo2_gate.nx -- TITLE WIRING #2: Open Diablo II (ARPG). An actual playable hack-and-slash loop built ONLY from certified parts: procgen act maps seed monster packs (nx_entity_store), every kill grants XP (nx_rpgstats) and rolls LOOT (nx_loottable) whose affixes EQUIP as stat modifiers (rs_apply_mods -- order-independent by construction), the act theme renders through nx_gamemusic, and the whole game state round-trips through nx_gamesave with the GX-9 transparency test. CAPS EXERCISED (bit = nx_gamebench capability index; the measured mask is payload[0] of the artifact): bit 10 loot-item-tables bit 9 rpg-stats-progression bit 3 procgen-world bit 6 entity-component-sim bit 16 audio-sfx-music bit 15 save-load-persistence bit 18 ui-menus-hud (nx_gamehud: every DROP's equip-or-keep decision goes THROUGH a modal menu -- item 0 carries the tier policy, the RETURNED id drives the equip mutation; HUD binds live hp/lvl/act/kills/tier per round, render-chain deterministic across replays) NOT exercised (title requires, loop does not prove): bit 7 pathfinding, bit 0 render-2d, bit 17 input-realtime -- the board must down-score these for this title. FLAGSHIP (mutation target): the kill->loot wiring. Skipping the roll must drive the loot tooth RED (no tiers observed) while the game still plays to a win (anti-vacuity stays GREEN). DIALECT: no `else if`, no `||`, no multiline `else` -- those DESYNC the nx_cc parser (found by the NetHack wiring; minimal repro nx_wire_probe.nx aux2). Plain ifs + flag vars only. license_tier: ORIGINAL expect_exit: 0

dependencies 11 imports · 0 importers

nx_syscalls.nx nx_gamesave.nx nx_rpgstats.nx nx_entity_store.nx nx_loottable.nx nx_gamemusic.nx nx_audio_wav.nx nx_gamehud.nx nx_game_raster.nx nx_frame_sanity.nx nx_wire_diablo2_gate.nx

diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_gamesave.nxnx_rpgstats.nxnx_entity_store.nxnx_loottable.nxnx_gamemusic.nxnx_audio_wav.nxnx_gamehud.nxnx_game_raster.nxnx_frame_sanity.nxnx_wire_harness.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ww sys_write sys_mmap d2_new rs_derived_hp rs_sadd rs_smul rs_clamp d2_genact drng en_init en_o_gen en_o_alive en_cap en_o_dense en_cap ↻ en_o_pos en_cap ↻ en_o_free en_cap ↻ en_count en_nth en_o_dense ↻ en_make_handle en_o_gen ↻ en_get en_valid en_handle_idx en_cap ↻ en_o_alive ↻ en_o_gen ↻ en_handle_gen en_ncomp en_o_comp en_cap ↻ en_cap ↻ en_handle_idx ↻ en_spawn en_freelen

structs

none

consts

35const D2_W: i64 = 20
36const D2_H: i64 = 10
37const D2_ACTS: i64 = 3
38const D2_NMON: i64 = 8
39const D2_CAP: i64 = 12
40const D2_NCOMP: i64 = 3 // 0=hp 1=xp_reward 2=packed pos
41const D2_CARVE: i64 = 90
42const D2_MAXT: i64 = 400
44const D2_XB: i64 = 20
45const D2_XQ: i64 = 10
46const D2_HPB: i64 = 20
47const D2_HPC: i64 = 2
48const D2_HPL: i64 = 4
49const D2_CON: i64 = 12
50const D2_BDMG: i64 = 8 // base weapon damage before mods
51const D2_STRIKERS: i64 = 2 // how many monsters strike back per round
53const D2_NTIER: i64 = 4 // normal / magic / rare / unique
54const D2_NAFF: i64 = 5 // +dmg / +dmg% / +hp / +hp% / +armor
56const D2_HDRN: i64 = 48
57const D2_NSV: i64 = 85 // 48 hdr + 1 n + 12*3 monsters
58const D2_SCHEMA: i64 = 7308
59const D2_ART_SCHEMA: i64 = 7318
61const D2_T1W: i64 = 22
62const D2_T2W: i64 = 46
64const DG_O_GRID: i64 = 64 // 200 cells
65const DG_O_CARVE: i64 = 272 // 208
66const DG_O_ENT: i64 = 480 // en_words(12,3)=4+60+36+8=108 pad 112
67const DG_O_HUD: i64 = 640 // nx_gamehud arena (GH_WORDS=64) APPENDED; UI transient, out of the save
68const DG_WORDS: i64 = 704
69const D2_HUDINK: i64 = 50 // min ink px for a non-vacuous HUD frame (T10 guard)
71const D_WS: i64 = 0
72const D_ACT: i64 = 1
73const D_TURN: i64 = 2
74const D_XP: i64 = 3
75const D_LVL: i64 = 4
76const D_HP: i64 = 5
77const D_KILLS: i64 = 6
78const D_DROPS: i64 = 7
79const D_T0: i64 = 8
80const D_T1: i64 = 9
81const D_T2: i64 = 10
82const D_T3: i64 = 11
83const D_WIN: i64 = 12
84const D_SPAWNED: i64 = 13
85const D_EQUIPS: i64 = 14
86const D_GENRNG: i64 = 15
87const D_DUPAFF: i64 = 16 // duplicate-affix violations observed (must stay 0)
88const D_AFFBAD: i64 = 17 // affix value out of declared range (must stay 0)
89const D_WT: i64 = 18 // equipped weapon tier (-1 none)
90const D_WNA: i64 = 19 // weapon affix count
91const D_WPAIR: i64 = 20 // 6 pairs (affix,val) -> 20..31
92const D_AT: i64 = 32
93const D_ANA: i64 = 33
94const D_APAIR: i64 = 34 // 34..45
95const D_ORDCHK: i64 = 46 // multi-mod drops where fwd/rev order equality was verified
96const D_ORDBAD: i64 = 47 // order-dependence violations observed (must stay 0)
410const R2_CELL: i64 = 16
411const R2_W: i64 = 320
412const R2_H: i64 = 180

functions

98func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
99func wn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
108func dbit(i: i64) -> i64 { var v: i64=1; var k: i64=0; while k<i { v=v*2; k=k+1 } return v }
called by 1: main
109func drng(d: *i64) -> i64
called by 1: d2_genact
118func dckv(ck: i64, v0: i64) -> i64
called by 2: d2_ckmain
124func d2_tables(tw: *i64, ta: *i64, aw: *i64, alo: *i64, ahi: *i64) -> i64
called by 1: d2_tick
136func d2_genact(d: *i64) -> i64
200func d2_new(d: *i64, ws: i64) -> i64
216func d2_wmods(d: *i64, mods: *i64) -> i64
called by 2: d2_tickmain
229func d2_amods(d: *i64, mods: *i64) -> i64
called by 1: d2_maxhp
241func d2_maxhp(d: *i64) -> i64
248func d2_tick(d: *i64) -> i64
413func d2_render(d: *i64, fb: *i64) -> i64
445func d2_fbck(fb: *i64) -> i64
called by 1: d2_rchain calls 1: wh_fbck
450func d2_rchain(seed: i64, turns: i64, out: *i64) -> i64
473func d2_hudchain(seed: i64, turns: i64, out: *i64) -> i64
513func d2_run_full(d: *i64) -> i64
called by 1: main calls 1: d2_tick
527func d2_serialize(d: *i64, S: *i64) -> i64
called by 1: main calls 3: en_counten_nthen_get
549func d2_restore(d: *i64, S: *i64) -> i64
575func d2_ck(d: *i64) -> i64
called by 1: main calls 4: dckven_counten_nthen_get
596func d2_song(sng: *i64, k: i64, a2: i64, b2: i64, c2: i64) -> i64
called by 1: d2_render_theme
600func d2_render_theme(smp: *i64, nsamp: i64) -> i64
called by 1: main calls 3: sys_mmapd2_songmus_render
635func main() -> i64