Expand description
the bsp-node class seems broken - it has int16's that get used a pointers.
Types
bsp-header: drawablesource
Fields
type: type
id: int16
bsphere: vector
info: file-info
all-visible-list: pointer
visible-list-length: int16
extra-vis-list-length: int16
drawable-trees: drawable-tree-array
pat: pointer
pat-length: int32
texture-remap-table: pointer
texture-remap-table-len: int32
texture-ids: pointer
texture-page-count: int32
unknown-basic: basic
name: symbol
nickname: symbol
vis-info: level-vis-info
actors: drawable-inline-array-actor
cameras: array
nodes: inline-array
level: level
current-leaf-idx: uint16
texture-flags: texture-page-flag
cam-outside-bsp: uint8
cam-using-back: uint8
cam-box-idx: uint16
ambients: symbol
subdivide-close: float
subdivide-far: float
race-meshes: array
actor-birth-order: pointer
light-hash: light-hash
nav-meshes: array
actor-groups: array
region-trees: array
region-array: region-array
collide-hash: collide-hash
wind-array-length: int32
city-level-info: city-level-info
vis-spheres: vector-array
region-tree: drawable-tree-region-prim
tfrag-masks: texture-masks-array
tfrag-closest: pointer
tfrag-mask-count: uint32
shrub-masks: texture-masks-array
shrub-closest: pointer
shrub-mask-count: uint32
alpha-masks: texture-masks-array
alpha-closest: pointer
alpha-mask-count: uint32
water-masks: texture-masks-array
water-closest: pointer
water-mask-count: uint32
bsp-scale: vector
bsp-offset: vector
unk-data: uint32
end: uint8
Methods
birth(obj: bsp-header) => nonesource
deactivate-entities(obj: bsp-header) => nonesource
bsp-node: structuresource
collide-stats: structuresource
Fields
calls: uint32
spheres: uint32
nodes: uint32
frags: uint32
tris: uint32
output: uint32
pad0: uint32
total-target: uint32
target-cache-fill: uint32
target-ray-poly: uint32
view-frustum: structuresource
Functions
inspect-bsp-tree(arg0: bsp-header, arg1: bsp-node) => nonesource
map-bsp-tree(arg0: function, arg1: bsp-header, arg2: bsp-node) => nonesource
Expand description
The "bsp" is the main level data structure: the bsp-header contains references to all static level data.
The "bsp-tree" is a bsp used to associate camera positions with lists of visibible objects.
Functions
bsp-camera-asm(arg0: bsp-header, arg1: vector) => nonesource
Determine which leaf node of the bsp we are in, and store this in the bsp-header.
build-masks(arg0: bsp-header) => nonesource
Allocate texture masks as needed for a level.
level-remap-texture(arg0: texture-id) => texture-idsource
Remap a texture id.
mem-usage-bsp-tree(arg0: bsp-header, arg1: bsp-node, arg2: memory-usage-block, arg3: int) => nonesource
Compute the memory usage of the bsp-tree part of a bsp-header
print-collide-stats() => nonesource
Display collide stats on screen.
Variables
*test-shrub*: intsource
Types
level: basicsource
Fields
type: type
name: symbol
load-name: string
nickname: string
index: int32
status: symbol
borrow-level: level
borrow-from-level: level
heap: kheap
borrow-heap: kheap
bsp: bsp-header
art-group: load-dir-art-group
info: level-load-info
texture-page: texture-page
loaded-texture-page: texture-page
loaded-texture-page-count: int32
entity: entity-links-array
closest-object: float
closest-object-array: float
upload-size: int32
inside-boxes: symbol
display?: symbol
render?: symbol
meta-inside?: symbol
force-inside?: symbol
mood-context: mood-context
mood-func: function
mood-init: function
vis-bits: pointer
all-visible?: symbol
force-all-visible?: symbol
linking: symbol
vis-info: level-vis-info
vis-self-index: int32
vis-adj-index: int32
vis-buffer: uint8
mem-usage-block: memory-usage-block
mem-usage: int32
code-memory-start: pointer
code-memory-end: pointer
load-start-time: time-frame
load-stop-time: time-frame
load-buffer: uint32
load-buffer-size: uint32
load-buffer-last: uint32
load-buffer-mode: load-buffer-mode
display-start-time: time-frame
memory-mask: uint32
task-mask: task-mask
tfrag-gs-test: gs-test
texture-dirty-masks: texture-mask
texture-mask: texture-mask
sky-mask: texture-mask
tfrag-masks: texture-masks-array
tfrag-dists: pointer
shrub-masks: texture-masks-array
shrub-dists: pointer
alpha-masks: texture-masks-array
alpha-dists: pointer
water-masks: texture-masks-array
water-dists: pointer
tfrag-last-calls: int32
tfrag-last-calls-u32: uint32
texture-anim-array: texture-anim-array
light-hash: light-hash
draw-priority: float
draw-index: int32
part-engine: engine
user-object: basic
loaded-text-info-count: int32
loaded-text-info: game-text-info
level-type: type
load-order: int64
pad: int8
Methods
deactivate(obj: level) => _type_source
Take a level out of active/alive
is-object-visible?(obj: level, arg0: int) => symbolsource
Is drawable arg0 visible? Note that this will return #f if the visibility data is not loaded.
level-method-11: unknown
bsp-name(obj: level) => symbolsource
Get the name of the bsp. If this can't be done, get the name of the level.
compute-memory-usage!(obj: level, force?: symbol) => memory-usage-blocksource
Calculates the memory usage of the level, returns and stores the [[memory-usage-block]]
in mem-usage-block
as well as the total size in mem-usage
@see memory-usage-block::10
inside-boxes-check(obj: level, arg0: vector) => symbolsource
NOTE: this function used to check if we were in boxes - here it just checks
a flag. However, it is still used to set the inside-boxes field, so it keeps
the name we gave it in Jak 1.
The jak 2 behavior is that any loaded level (with a bsp) is considered 'in-boxes'
except for if the require-force-inside flag is set in the bsp-header, in which case
it requires the level to be marked as force-inside?
update-vis!(obj: level, vis-info: level-vis-info, unused: uint, in-bsp-vis-string: pointer) => symbolsource
load-continue(obj: level) => _type_source
Run the loading/login state machine.
This will only make progress on loading, linking, and login for loads that have already started.
No 'scary' state transitions (like birth, alive, deactivate) are made here.
load-begin(obj: level) => _type_source
Begin loading a level.
This assigns memory to a level and is somewhat confusing.
login-begin(obj: level) => _type_source
Begin login of a level after linking.
The login is spread over multiple frames.
debug-print-region-splitbox(obj: level, arg0: vector, arg1: object) => nonesource
Display debug info about the regions of a level.
get-art-group-by-name(obj: level, arg0: string) => art-groupsource
As the name implies, look through the art-groups of this level and get the one
with the given name. Return #f if not found.
level-method-22(obj: level, arg0: symbol) => intsource
lookup-text(obj: level, arg0: text-id, arg1: symbol) => stringsource
level-method-24: unknown
level-status-update!(obj: level, arg0: symbol) => _type_source
Try to update the level to the given status, calling whatever is needed
to make it happen.
This can do both loading, linking, login, and activation.
This is somewhat similar to level-get-for-use, but requires that you already have
the level object.
This function is the way to transition from loaded to alive/active.
load-required-packages(obj: level) => _type_source
Load packages for a level.
This just loads common, and this feature is not really useful.
Packages were only used during development, and seem only partially used in Jak 2
(the only package is common).
init-vis-from-bsp(obj: level) => nonesource
Set up a level's vis-infos from a bsp.
level-group: basicsource
Fields
type: type
length: int32
log-in-level-bsp: bsp-header
loading-level: level
entity-link: entity-links
border?: symbol
vis?: symbol
want-level: basic
receiving-level: basic
load-commands: pair
play?: symbol
target-pos: vector
camera-pos: vector
heap: kheap
sound-bank: basic
disk-load-timing?: symbol
load-level: basic
load-size: uint32
load-time: float
load-login-time: float
draw-level-count: int32
draw-level: level
draw-index-map: uint8
load-order: uint64
pad: uint8
level: level
level0: level
level1: level
level2: level
level3: level
level4: level
level5: level
default-level: level
pad2: uint8
Methods
level-get(obj: level-group, arg0: symbol) => levelsource
Get a level by name or load-name
level-get-with-status(obj: level-group, arg0: symbol) => levelsource
Get a level with the given status.
get-level-by-heap-ptr-and-status(obj: level-group, arg0: pointer, arg1: symbol) => levelsource
Get a level by a heap pointer and status.
If no matching level is found, return #f.
The purpose of the status check is possibly to prevent bugs with getting stuff
from a level that's just been replaced with another.
level-get-for-use(obj: level-group, arg0: symbol, arg1: symbol) => levelsource
Request a level by name in the given state.
Will return quickly (non-blocking) and might not be able to get a level in the desired state,
though it will ofborrow do some small amount of work to make progress on loading.
This is the most general/powerful function like this: if there is no level with this name
it will kick out levels as needed to make a free slot, and set up a new level, and start
the load. This should only be used when you might want to start a load.
activate-levels!(obj: level-group) => intsource
Set all levels to active.
debug-print-entities(obj: level-group, arg0: symbol, arg1: type) => nonesource
debug-draw-actors(obj: level-group, arg0: symbol) => nonesource
assign-draw-indices(obj: level-group) => nonesource
Sort the levels by draw priority.
actors-update(obj: level-group) => nonesource
update-nav-meshes-method(obj: level-group) => nonesource
Clashes with a function name
level-update(obj: level-group) => nonesource
level-get-target-inside(obj: level-group) => levelsource
Get the level that target is 'in'. With a bunch of tricks for what 'in' really means.
alloc-levels-if-needed(obj: level-group, arg0: symbol) => nonesource
Setup for playing levels by loading the required base packages (art, common)
and allocating the level heap.
load-commands-set!(obj: level-group, arg0: pair) => nonesource
Set the load-commands of a level.
art-group-get-by-name(obj: level-group, arg0: string, arg1: pointer) => art-groupsource
Search all levels for an art-group. Return the art group, or #f. Optionally return the level index.
alt-load-command-get-index(obj: level-group, arg0: symbol, arg1: int) => pairsource
Get the n-th alt-load-command for the given level.
This is likely unused in jak 2 because no levels have alt-load-commands.
update-vis-volumes(obj: level-group) => nonesource
update-vis-volumes-from-nav-mesh(obj: level-group) => nonesource
print-volume-sizes(obj: level-group) => nonesource
level-status(obj: level-group, arg0: symbol) => symbolsource
Get the status of a level by name, return #f if no level is found.
load-in-progress?(obj: level-group) => symbolsource
Is a level being loaded right now?
level-get-most-disposable(obj: level-group) => levelsource
Get the level that's least useful.