# Gate 26: the boot spine -- the real Stage actor. (Renumbered from 24 at merge.)
#
# The port's level boot already runs the game's own Stage::LoadClsnAndObjects
# (gate 14) but against harness-staged storage: a bare MeshCollider in
# walk_window and an ActorBase-shaped block seated as the scene root. Neither
# stand-in exists on the ROM. Both are the SAME object there -- the Stage
# actor, whose +0x91c IS the level collider and whose +0x14 IS the scene tree's
# head -- and this slice is that object.
#
# Stage::Stage is a factory: it allocates its own 0x9c8 through
# ActorBase::operator new (which memsets it), runs the ActorBase constructor,
# installs the vptr, and constructs the three sub-objects at +0x50, +0x86c and
# +0x91c. The seam it needs -- the vtable array, the ROM SpawnInfo the
# ActorBase constructor reads, and the one honest stub for the particle
# tracker -- is port/hal/stage_bridges.cpp.
src/d_s_stage.cpp

# The level MODEL. The harness loaded it by hand -- SharedFilePtr::Construct on
# a hard-coded 1943, Model::LoadFile, ModelBase::SetFile, into its own 0x50-byte
# block -- and the ROM's own loader does the same job from the LVL_Overlay's own
# bmdFileId into Stage+0x86c. It then walks the component list rewriting each
# part's polygon-attribute field (0x3f000000 -> 0x13000000) for everything that
# is not already fully lit, and parks the ModelComponents pointer in
# data_0209f320 where CopyTexPalFromLevelModel reads it back. The harness did
# neither of those two.
#
# Its one unresolved name was Model::LoadAndSetFile, a real MSVC member reached
# here by its C name; hal/method_faces.cpp carries the __thiscall face.
src/_ZN5Stage9LoadModelEv.cpp

# The level RENDER. Not simply a Render call: Stage::RenderModel is the
# level's per-AREA visibility pass. Stage+0x8bc is the area table (stride 0xc:
# the area's TextureTransformer at +0, the "is this area showing" flag at +4,
# which ShowArea/HideArea toggle and IsAreaShowing reads), and for each area
# the loop either clears or sets bit 31 of every component's polygon-attribute
# word before handing the whole model to Model::Render with the ROM's own
# {125.0, 125.0, 125.0} scale.
src/_ZN5Stage11RenderModelEv.cpp

# ...and the table's FILLER: Stage::InitResources' own call that news a
# TextureTransformer into the area-table slot of every area entry naming a
# BTA. The port drives it from port_stage_advance_anims
# (hal/stage_bridges.cpp), which also runs Stage::Render's first block -- the
# per-frame Advance of every shown area's transformer -- so the waterfall
# scrolls instead of holding frame 0.
src/_ZN5Stage23LoadTextureTransformersEv.cpp

# ...and its companion. Stage::Render's own order is RenderModel,
# ShadowModel::RenderAll, RenderModelTransparent, and the two model passes are
# exact inverses: RenderModel keeps the components whose polygon-attribute
# alpha field is 0x1f0000 (fully opaque) and hides the rest, this one keeps
# exactly the rest. Running only the first drew the castle grounds with its
# moat EMPTY -- the water is translucent, so the opaque pass hides it and
# nothing brought it back.
src/_ZN5Stage22RenderModelTransparentEv.cpp

# The SKYBOX. Stage::LoadSkybox reads the skybox id out of the current
# LVL_Overlay (GetSkyboxID: word 6, bits 4..8; 0 means no skybox), maps it
# through data_02075620 to a vrbox file handle (id 1 -> 2040 ->
# data/vrbox/vr01.bmd on castle grounds), news a Model off the game heap and
# LoadAndSetFiles it into Stage+0x9bc. Every name it needs is already in this
# link: _Znwj (hal/cxxname_bridge.cpp), Model's C1 (slice_gate4b), the
# LoadAndSetFile face (hal/method_faces.cpp), and data_02075620 comes from
# romdata. The draw side is Stage::Render's own block, carried as
# port_stage_render_skybox in hal/stage_bridges.cpp.
src/_ZN5Stage11GetSkyboxIDEv.cpp
src/_ZN5Stage10LoadSkyboxEv.cpp
