Skip to main content

Types


bsp-header

bsp-header: drawablesource
Fields
type: type
id: int16
bsphere: vector
info: file-info
all-visible-list: pointer
visible-list-length: int32
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
unk-zero-0: 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
unk-data-2: uint16
boxes: box8s-array
current-bsp-back-flags: uint32
ambients: drawable-inline-array-ambient
unk-data-4: float
unk-data-5: float
adgifs: adgif-shader-array
actor-birth-order: pointer
split-box-indices: pointer
unk-data-8: uint32
Methods
relocate(obj: bsp-header, dest-heap: kheap, name: pointer) => nonesource
Handle a bsp file load.
birth(obj: bsp-header) => nonesource
Birth everything in the level.
deactivate-entities(obj: bsp-header) => nonesource

bsp-node

bsp-node: structuresource
Fields
front: int32
back: int32
front-flags: uint32
back-flags: uint32
plane: vector

cl-stat

cl-stat: structuresource
Fields
fragments: uint32
tris: uint32
output: uint32

collide-stats

collide-stats: structuresource
Fields
other: cl-stat
total: cl-stat
nodes: uint32
calls: uint32
total-target: stopwatch
target-cache-fill: stopwatch
target-ray-poly: stopwatch
pad: uint32

game-level

game-level: basicsource
Fields
type: type
master-bsp: basic

view-frustum

view-frustum: structuresource
Fields
hither-top-left: vector
hither-top-right: vector
hither-bottom-left: vector
hither-bottom-right: vector
yon-top-left: vector
yon-top-right: vector
yon-bottom-left: vector
yon-bottom-right: vector

Functions


inspect-bsp-tree

inspect-bsp-tree(arg0: bsp-header, arg1: bsp-node) => nonesource

map-bsp-tree

map-bsp-tree(arg0: function, arg1: bsp-header, arg2: bsp-node) => nonesource
Recursively apply arg0 to all nodes in the bsp tree

Variables


TERRAIN_BSP_SCRATCHPAD

TERRAIN_BSP_SCRATCHPAD: unknownsource

VISIBLE_LIST_SCRATCHPAD

VISIBLE_LIST_SCRATCHPAD: unknownsource

Functions


bsp-camera-asm

bsp-camera-asm(bsp-hdr: bsp-header, camera-pos: vector) => nonesource
Look up the camera position in the bsp tree.
The result is stored in the bsp-hdr current-leaf-idx

clear-cl-stat

clear-cl-stat(arg0: cl-stat) => nonesource
Reset stats

level-remap-texture

level-remap-texture(tex-id: texture-id) => texture-idsource
Levels can request textures to be remapped during login

mem-usage-bsp-tree

mem-usage-bsp-tree(header: bsp-header, node: bsp-node, mem-use: memory-usage-block, flags: int) => nonesource
Update the given mem-use for the memory used by the tree structure itself
print-cl-stat(arg0: cl-stat, arg1: string) => nonesource
Print stats for arg1
print-collide-stats() => nonesource
Print and reset collide stats for this frame

Variables


*test-shrub*

*test-shrub*: intsource

level-h

source

Types


level

level: basicsource
Fields
type: type
name: symbol
load-name: symbol
nickname: symbol
index: int32
status: symbol
other: level
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
tfrag-tex-foreground-sink-group: dma-foreground-sink-group
pris-tex-foreground-sink-group: dma-foreground-sink-group
water-tex-foreground-sink-group: dma-foreground-sink-group
foreground-sink-group: dma-foreground-sink-group
foreground-draw-engine: engine
entity: entity-links-array
ambient: entity-ambient-data-array
closest-object: float
upload-size: int32
level-distance: meters
inside-sphere?: symbol
inside-boxes?: symbol
display?: symbol
meta-inside?: symbol
mood: mood-context
mood-func: function
vis-bits: pointer
all-visible?: symbol
force-all-visible?: symbol
linking: basic
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
texture-mask: uint32
force-inside?: symbol
pad: uint8
Methods
deactivate(obj: level) => _type_source
Kill the level. This won't remove it from memory.
is-object-visible?(obj: level, arg0: int) => symbolsource
Is arg0 visible? Note that this will return #f if the visibility data is not loaded.
add-irq-to-tex-buckets!(obj: level) => nonesource
Adds a packet that will cause a VIF interrupt to the end of all texture
buckets for a given level. This will trigger a VU1 profiler bar
unload!(obj: level) => _type_source
Unloads the level. This does not free the heap. The level will be made inactive and ready to be loaded some other time.
bsp-name(obj: level) => symbolsource
Get the name of the bsp tree of the level
compute-memory-usage(obj: level, arg0: object) => memory-usage-blocksource
Compute the memory usage of a level. Arg0 will force a recalculation.
point-in-boxes?(obj: level, arg0: vector) => symbolsource
Is this point in the list of level boxes?
update-vis!(obj: level, vis-info: level-vis-info, arg1: uint, arg2: uint) => symbolsource
Update the vis-bits for the level with the given vis info.
arg1 unused. if the vis-file flag isn't set, will use arg2 as vis data.
load-continue(obj: level) => _type_source
Continue loading a level from where we left off last time.
load-begin(obj: level) => _type_source
Start loading the level. Uses 2 megabyte heaps for loading each object.
login-begin(obj: level) => _type_source
Start the login. This is spread over multiple frames.
vis-load(obj: level) => uintsource
Start the initial load of a VIS file to the IOP VIS buffer. After this is done, we can use
ramdisk-load to load chunks.
unused-21: unknown
birth(obj: level) => _type_source
Birth a level to make it alive! It must be loaded.
level-status-set!(obj: level, want-status: symbol) => _type_source
Change the status of a level, performing any cleanup and prep work as necessary.
Only change loading statuses in order!
Returns the level.
load-required-packages(obj: level) => _type_source
Load required packages for the level. This is mostly useless, but might load common.
This will have no effect most of the time - common is often loaded at boot as part of
game.cgo.
init-vis(obj: level) => intsource
Set up the vis info in a level from the vis info in the BSP.
vis-clear(obj: level) => intsource
Clear the visibility info for when the level is loading.
debug-print-splitbox(obj: level, arg0: vector, arg1: string) => nonesource
Print the current splitbox, if we're in one.
art-group-get-by-name(obj: level, arg0: string) => art-groupsource
Get the art group in the given level with the given name.
If it doesn't exist, #f.

level-group

level-group: basicsource
Fields
type: type
length: int32
log-in-level-bsp: bsp-header
loading-level: level
entity-link: entity-links
border?: basic
vis?: basic
want-level: basic
receiving-level: basic
load-commands: pair
play?: symbol
_hack-pad: uint8
level0: level
level1: level
level-default: level
level: level
data: level
pad: uint32
Methods
level-get(obj: level-group, name: symbol) => levelsource
Return the level data using its name, if it is available. Returns #f if none are found.
level-get-with-status(obj: level-group, status: symbol) => levelsource
level-get-for-use(obj: level-group, name: symbol, want-status: symbol) => levelsource
Get a level in a playable form, loading it if necessary.
activate-levels!(obj: level-group) => intsource
Try to activate all levels.
debug-print-entities(obj: level-group, mode: symbol, expected-type: type) => nonesource
Print a table of entities. If expected-type is #f, print all. Otherwise, print only entities of the given type.
Modes:
'art-group: print art groups instead.
'entity-meters: print entity location in meters.
'entity-perm: also print entity-perm values.
debug-draw-actors(obj: level-group, arg0: symbol) => nonesource
actors-update(obj: level-group) => objectsource
level-update(obj: level-group) => intsource
level-get-target-inside(obj: level-group) => levelsource
Get the level target is in, or one it is close to.
The distance checks do not work.
alloc-levels!(obj: level-group, compact-level-heaps: symbol) => intsource
Allocate the level heaps and load the common packages for levels.
load-commands-set!(obj: level-group, load-commands: pair) => pairsource
art-group-get-by-name(obj: level-group, arg0: string) => art-groupsource
load-command-get-index(obj: level-group, name: symbol, cmd-idx: int) => pairsource
Get the n-th load command for the given level.
update-vis-volumes(obj: level-group) => nonesource
update-vis-volumes-from-nav-mesh(obj: level-group) => nonesource
Update the visvol to fit the entire nav-mesh. Does this for all actors in bsps.
Probably only used for debugging.
print-volume-sizes(obj: level-group) => nonesource
Loop through all entities and print their visibility.
Excludes crate, fuel-cell and springbox.
level-status(obj: level-group, level-name: symbol) => symbolsource
Get the status of an existing level.
level-get-most-disposable(obj: level-group) => levelsource
Get a level that's least likely to be in use right now. #f = all levels in use.

level-load-info

level-load-info: basicsource
Fields
type: type
name-list: symbol
index: int32
name: symbol
visname: symbol
nickname: symbol
packages: pair
sound-banks: pair
music-bank: symbol
ambient-sounds: pair
mood: symbol
mood-func: symbol
ocean: symbol
sky: symbol
sun-fade: float
continues: pair
tasks: pair
priority: int32
load-commands: pair
alt-load-commands: pair
bsp-mask: uint64
bsphere: sphere
buzzer: int32
bottom-height: meters
run-packages: pair
prev-level: basic
next-level: basic
wait-for-load: symbol

level-vis-info

level-vis-info: basicsource
Fields
type: type
level: symbol
from-level: symbol
from-bsp: bsp-header
flags: uint32
length: uint32
allocated-length: uint32
dictionary-length: uint32
dictionary: uint32
string-block: uint32
ramdisk: uint32
vis-bits: pointer
current-vis-string: uint32
vis-string: uint32

login-state

login-state: basicsource
Fields
type: type
state: int32
pos: uint32
elts: uint32
elt: drawable

Variables


LEVEL_COUNT

LEVEL_COUNT: unknownsource

level-info

source

Variables


*level-load-list*

*level-load-list*: pairsource

beach

beach: level-load-infosource

citadel

citadel: level-load-infosource

darkcave

darkcave: level-load-infosource

default-level

const default-level: level-load-infosource

demo

demo: level-load-infosource

finalboss

finalboss: level-load-infosource

firecanyon

firecanyon: level-load-infosource

halfpipe

const halfpipe: level-load-infosource

intro

intro: level-load-infosource

jungle

jungle: level-load-infosource

jungleb

const jungleb: level-load-infosource

lavatube

const lavatube: level-load-infosource

maincave

maincave: level-load-infosource

misty

misty: level-load-infosource

ogre

ogre: level-load-infosource

robocave

robocave: level-load-infosource

rolling

rolling: level-load-infosource

snow

snow: level-load-infosource

sunken

sunken: level-load-infosource

sunkenb

const sunkenb: level-load-infosource

swamp

swamp: level-load-infosource

test-zone

test-zone: level-load-infosource

title

title: level-load-infosource

training

const training: level-load-infosource

village1

const village1: level-load-infosource

village2

const village2: level-load-infosource

village3

const village3: level-load-infosource

Functions


add-bsp-drawable

add-bsp-drawable(arg0: bsp-header, arg1: level, arg2: symbol, arg3: display-frame) => nonesource
Draw a level!

bg

bg(level-name: symbol) => intsource
Begin game in a given level.
The level name can be the full name (village3), the nickname (vi3), or visname (village3-vis)
If the visname is used (and its a recognized level in level-info), it will use vis mode.
Otherwise, it will use the non-vis DGO name (like VILLAGE3.DGO) which will usually fail.

level-update-after-load

level-update-after-load(loaded-level: level, level-login-state: login-state) => levelsource
Run some small amount of logins.
This will time itself and stop after some time.
When it's done, it will set the status to loaded.

load-vis-info

load-vis-info(vis-name: symbol, old-vis-name: symbol) => intsource
Load a new VIS file and dump the old one. The corresponding level must be active!

lookup-level-info

lookup-level-info(name: symbol) => level-load-infosource
Get the level-load-info of a level using its name. name can be the level name, the visname or the nickname. First match is returned.

play

play(use-vis: symbol, init-game: symbol) => intsource
The entry point to the actual game! This allocates the level heaps, loads some data, sets some default parameters and sets the startup level.

remap-level-name

remap-level-name(level-info: level-load-info) => symbolsource
Get the canonical name for a level using its level-load-info

show-level

show-level(level-name: symbol) => intsource

update-sound-banks

update-sound-banks() => intsource

Variables


*login-state*

*login-state*: login-statesource
*print-login*: symbolsource

DEFAULT_DRAW_MAX_COUNT_0

DEFAULT_DRAW_MAX_COUNT_0: unknownsource

DEFAULT_DRAW_MAX_COUNT_2

DEFAULT_DRAW_MAX_COUNT_2: unknownsource

FOREGROUND_DRAW_MAX_COUNT_0

FOREGROUND_DRAW_MAX_COUNT_0: unknownsource

FOREGROUND_DRAW_MAX_COUNT_2

FOREGROUND_DRAW_MAX_COUNT_2: unknownsource

LEVEL_HEAP_SIZE

LEVEL_HEAP_SIZE: unknownsource

LEVEL_HEAP_SIZE_DEBUG

LEVEL_HEAP_SIZE_DEBUG: unknownsource

load-boundary-data

source

Variables


*static-load-boundary-list*

*static-load-boundary-list*: arraysource

load-boundary-h

source

Types


lbvtx

lbvtx: structuresource
Fields
x: float
y: float
z: float
v0: uint8
v1: uint8
v2: uint8
ix: uint8
quad: uint128
v: vector

load-boundary

load-boundary: basicsource
Fields
type: type
num-points: uint16
flags: load-boundary-flags
top-plane: float
bot-plane: float
tri-cnt: int32
next: load-boundary
cmd-fwd: load-boundary-crossing-command
cmd-bwd: load-boundary-crossing-command
rejector: vector
data: lbvtx
data2: lbvtx

load-boundary-crossing-command

load-boundary-crossing-command: structuresource
Fields
cmd: load-boundary-cmd
bparm: uint8
parm: uint32
lev0: basic
lev1: basic
displev: basic
dispcmd: basic
nick: basic
forcelev: basic
forceonoff: basic
checkname: basic

Variables


*load-boundary-list*

*load-boundary-list*: load-boundarysource

*load-boundary-target*

*load-boundary-target*: inline-arraysource

load-boundary

source

Types


lb-editor-parms

lb-editor-parms: basicsource
Fields
type: type
boundary: load-boundary
vertex: int32
x-origin: float
z-origin: float

Functions


---lb-save

---lb-save() => nonesource

add-boundary-shader

add-boundary-shader(arg0: texture-id, arg1: dma-buffer) => nonesource

boundary-set-color

boundary-set-color(arg0: lbvtx, arg1: load-boundary-crossing-command) => nonesource

check-boundary

check-boundary(arg0: load-boundary) => nonesource

check-closed-boundary

check-closed-boundary(arg0: load-boundary, arg1: lbvtx, arg2: lbvtx) => symbolsource

check-open-boundary

check-open-boundary(arg0: load-boundary, arg1: lbvtx, arg2: lbvtx) => symbolsource

command-get-float

command-get-float(arg0: object, arg1: float) => floatsource

command-get-int

command-get-int(arg0: object, arg1: int) => intsource

command-get-param

command-get-param(arg0: object, arg1: object) => objectsource

command-get-quoted-param

command-get-quoted-param(arg0: object, arg1: object) => objectsource

command-get-time

command-get-time(arg0: object, arg1: int) => intsource

command-list-get-process

command-list-get-process(arg0: object) => processsource

copy-load-boundary!

copy-load-boundary!(arg0: load-boundary, arg1: load-boundary) => nonesource

copy-load-command!

copy-load-command!(arg0: load-boundary-crossing-command, arg1: load-boundary-crossing-command) => nonesource

draw-boundary-cap

draw-boundary-cap(arg0: load-boundary, arg1: float, arg2: dma-buffer, arg3: symbol) => nonesource

draw-boundary-side

draw-boundary-side(arg0: load-boundary, arg1: integer, arg2: integer, arg3: dma-buffer, arg4: symbol) => nonesource

edit-load-boundaries

edit-load-boundaries() => nonesource

find-bounding-circle

find-bounding-circle(arg0: load-boundary) => nonesource

fix-boundary-normals

fix-boundary-normals(arg0: load-boundary) => nonesource

format-boundary-cmd

format-boundary-cmd(arg0: load-boundary-crossing-command) => nonesource

lb-add

lb-add() => load-boundarysource

lb-add-load

lb-add-load(arg0: object, arg1: object) => nonesource

lb-add-load-plane

lb-add-load-plane(arg0: object, arg1: object) => nonesource

lb-add-plane

lb-add-plane() => load-boundarysource

lb-add-vtx-after

lb-add-vtx-after() => nonesource

lb-add-vtx-before

lb-add-vtx-before() => nonesource

lb-copy

lb-copy() => nonesource

lb-del

lb-del() => nonesource

lb-del-vtx

lb-del-vtx() => nonesource

lb-flip

lb-flip() => nonesource

lb-set-camera

lb-set-camera() => nonesource

lb-set-player

lb-set-player() => nonesource

load-boundary-from-template

load-boundary-from-template(arg0: array) => nonesource

load-state-want-display-level

load-state-want-display-level(arg0: symbol, arg1: symbol) => intsource

load-state-want-force-vis

load-state-want-force-vis(arg0: symbol, arg1: symbol) => intsource

load-state-want-levels

load-state-want-levels(arg0: symbol, arg1: symbol) => intsource

load-state-want-vis

load-state-want-vis(arg0: symbol) => intsource

point-in-polygon

point-in-polygon(arg0: load-boundary, arg1: vector) => symbolsource

render-boundaries

render-boundaries() => nonesource

render-boundary

render-boundary(arg0: load-boundary) => nonesource

replace-load-boundary

replace-load-boundary(arg0: load-boundary, arg1: load-boundary) => nonesource

save-boundary-cmd

save-boundary-cmd(arg0: load-boundary-crossing-command, arg1: string, arg2: object) => nonesource

split-monotone-polygon

split-monotone-polygon(arg0: load-boundary, arg1: int) => nonesource

triangulate-boundary

triangulate-boundary(arg0: load-boundary) => objectsource

try-corner

try-corner(arg0: object, arg1: int) => symbolsource

Variables


*backup-load-state*

*backup-load-state*: load-statesource

*boundary-polygon*

*boundary-polygon*: inline-arraysource

*display-load-commands*

*display-load-commands*: symbolsource

*lb-editor-parms*

*lb-editor-parms*: lb-editor-parmssource

*triangulation-buffer*

*triangulation-buffer*: inline-arraysource