Spawn/Reload
Spawn
A small struct in static data that determines spawn locations, of size [2c]. There are two contiguous instances:
805b6ae0
| slave
805b6b0c
| master
Layout
offset | size | description |
---|---|---|
0 | [20] | location (folder string) |
20 | [2] | ? (resets to 00 0F ) |
22 | [1] | room |
23 | [1] | layer |
24 | [1] | entrance |
25 | [1] | night? (iff == 01 ) |
26 | [1] | trial? (iff == 01 ) |
27 | [1] | ? |
28 | [1] | ? (resets to FF ) |
29 | [3] | _ |
During a reload, the data from master is copied over slave. The layer in master is the forced layer – if it’s 0, the actual layer is computed from story flags and stored at the layer in slave.
Reloader
Reloader | |
---|---|
Location | (variable) |
Pointer | 805789f4 (static) | aka r13 (=8057c6a0 ) - 0x3cac |
Size | 0x2b0 | confirmed in 801b9760: _Heap::allocReloader() |
Also have a nearby helper variable:
805789fd
[1] (static): reloadType. All reloads use the spawn data from the master spawn (above), but load different position and angle data from file FA. This data comes in triples, labelled type-1,2,3 in file docs.
The function 80063640
| determineReload (partial decomp here) uses this flag to select data to load, then clears the flag.
- 0: normal (indirect) reload thru entrance; no position+angle data used.
- 1: direct reload into type-1 position+angle from FA.
- 2: reload into type-2 position+angle from FA from higher y-coordinate (vertical) with sailcloth.
- 3: direct reload into type-3 position+angle from FA.
Files store triples (type-1,2,3) of Spawn data (area, forced layer, entrance, etc.) as well as position and angle; both Spawn and position+angle obey these dynamics:
- type-1: stored when saving a file; loaded when starting a file (with type-1 reload).
- type-2: stored when returning to sky; loading unknown (but with type-2 reload, which simulates landing from sky).
- type-3: stored when entering area; loaded when continuing after death (with type-3 reload).
Reloader Data
offset | name | size | description |
---|---|---|---|
23c | reload trigger | [2] | normally 0x2bf; triggers reload when set to 0x5 |
240 | ? | [2c] | a Spawn object, unknown use |
26c | type-0 pos data | [e] | [x,y,z,θ] (float × 3, short): Link position used during a t0 pos load |
28b | type-0 cs flag | [1] | if 1, force cutscene on type-0 load |
2a0 | type-0 pos flag | [1] | if 1, force position on type-0 load (and use data at 26c) |
2a2 | save-prompt flag | [1] | if 1, display save-prompt on next reload |
Functions
801bc080
: assignSpawn. Directly sets values in a Spawn object (the first arg). Breakpointing this shows some of the dynamics between the two Spawn objects and Reloader.