# marks.ludic - a mark, the providers the game registers, and the frame's list export const COMPASS_PLAIN: int = 0 # priorities: an ordinary mark export const COMPASS_NOTE: int = 1 # one the player asked for (a mark of their own) export const COMPASS_TRACKED: int = 2 # the objective: its distance is shown, at the edge too export property CompassMark { x: float = 0.0 z: float = 0.0 icon: int = 0 # the game's key for its picture colour: int = 0 # the game's key for its colour tier: int = 1 # the least compass that shows it prio: int = 0 label: string = "" } # a provider says where its things are by calling compass_mark; the game fills the registry # (`def CompassProviders story { gather: fn story_marks }`) and they are asked in its order export property CompassProvider { key: string = "" gather: fn() -> void = null } export open registry CompassProviders of CompassProvider as COMPASS_FROM export state CompassState { cmp_cap: int = 64 cmp_list: []CompassMark = new []CompassMark # this frame's, sorted and culled cmp_back: []CompassMark = new []CompassMark # the list the sort fills, then swapped with cmp_list @max(2048) cmp_pool: []CompassMark = cmp_pool__new() # a frame's marks, made with the state and reused: Ludic frees nothing cmp_used: int = 0 cmp_capturing: bool = false cmp_caught: []CompassMark = new []CompassMark # what providers said while someone was listening @max(2048) cmp_cpool: []CompassMark = cmp_pool__new() # the capture's marks, reused from one capture to the next cmp_none: CompassMark = new CompassMark # what compass_at answers past the end cmp_cused: int = 0 cmp_ranges: []float = null cmp_radar_from: int = 2 # marks of at least this tier are blips; the tracked one always is } # how many marks a frame keeps (the lowest priorities go first past it) export function compass_config(compass_st: mut CompassState, cap: int) -> void { compass_st.cmp_cap = Math.max(cap, 1) compass_begin(compass_st) } # a pooled mark filled in place function cmp_fill(m: CompassMark, x: float, z: float, icon: int, colour: int, tier: int, prio: int, label: string) -> CompassMark { m.x = x m.z = z m.icon = icon m.colour = colour m.tier = tier m.prio = prio m.label = label return m }