Entry 570

Dungeons as defs: DungeonDef by dungeon type, the dress, lake and leaves as systems

Documented in Dungeon generation.

Files33 in 13 directories
crates/piney-game/src/session.rscrates/piney-game/src/session/tests/boxes.rsdressing.rsfield_shots.rsshrine.rscrates/piney-world/examples/ambient_probe.rsdungeon_probe.rsmap_probe.rsstory_map_probe.rscrates/piney-world/src/combat/mod.rscrates/piney-world/src/dungeon/def.rsdress.rslake.rsleaves.rsmod.rscrates/piney-world/src/field/area.rsdef.rsworld.rscrates/piney-world/src/field/world/ride.rscrates/piney-world/src/map/dungeon.rsmod.rscrates/piney-world/src/story_map/mod.rscrates/piney-world/src/systems/fireflies.rslake_sky.rsleaves.rsmod.rspieces.rsroom_lights.rsroom_water.rssparks.rscrates/piney-world/src/town/mod.rsdocs/engine/dungeon.mdplans/rust-cleanup.md

Mentioned inplans/rust-cleanup.md:327

Section 2's map systems item, step 3's second half (plans/rust-cleanup.md): a dungeon was DungeonArea with a Dressing (dungeon/dress.rs: the water, sparks, room lights, objects and anm objects SetRoom stands in a room), a Lake (dungeon/lake.rs: a lake's DrawBG and its fireflies) and type 32's Leaves (dungeon/leaves.rs), each a field of the area called by name, the lake gated on dtype >= 8. Now each dungeon type is a DungeonDef and those are its systems on the runner the towns, story maps and fields use (worklog 560, 566, 569). Nothing drawn changed.

The def

dungeon::def::DungeonDef, one static a type (DUNGEONS, DungeonDef::of), each BASE_DUNGEON with its differences: class (GameClass::Dungeon), ty, lake (types 8 and 9: one floor, no event rooms, the statues), food (GetFood()'s gimmick), breakables (EntryBreakObject's rows), family (the story rooms' ROOM_INFO family), door_se and leaf_off (MoveDoor's sound and whether an open door's leaf leaves the hit list, its jump tables @8659 and @8664), the systems, room (SetRoom's steps, ROOM), order (Draw's, ORDER) and asleep (ASLEEP). The old per-type matches on dtype for these are gone.

systemgametypes
RoomWaterSetWater's three water anms, DrawWater (u$8862)all
SparksSetWater's SNOW type 3 embers at OBJ_o_magma*, ChangeClut's palettes in 0 and 1all
RoomLightsSetLight's glows and omni lights (type & 3, the altar's in 2 and 6)0-7
Piecesobject[], anmobj[], anmobj2[]: the lakes' statues, 3 and 7's walls, 0-3's anmsall
LakeSkya lake's DrawBG (v$8917), about the room under the player8, 9
FirefliesSetRoom's five FIREFLYs (Made::Room)8, 9
Leavestype 32's tree and twenty LEAFsall (event room 32)

SetRoom as steps

SetRoom builds the room's anm and its hits itself, then runs the def's RoomSteps: each a system's RoomPart (Leaves, Water, Light, Object, AnmObject, Fireflies) through MapSystem::room, or Doors (the core's SetDoor and the ban block) between SetObject and SetAnmObject, as the game orders them. RoomCx hands each system the dungeon's files (Rooms: the scene file, its objects' models and hits, the event room's spccs, the water model, the palette swaps), the room's anm and slot, the floor and level, the event room's type, fieldrand, the light group and the hit list's joins. What joins the ccModelHit list after the room's is Joined::{Door, Block, Piece(Kind, ..)}, in the game's order, so put_doors, MoveDoor and HitEnable keep it; the pieces' hits come back through MapSystem::hits and hit_names. RoomPart::Clear is DeleteRoom and ClearRoom. Type 32's owed ccRandF tilts are MapSystem::settle, which DungeonArea::settle runs after each call that can SetRoom.

Draw

DungeonArea::draw runs order (asleep, asleep: each piece again, the water sampling the picture afresh and the fireflies drawn again, as before) with MapView::room the room under the player (its centre and size, which LakeSky reads), paints the requests, then draws the room, its doors and the ban block. The anms' and clumps' pieces are a new Request::Pieces (models each at its own matrix, the file's palette swaps, one model's vertex edits). u$8862 and v$8917 stay statics of the executable through take / put (worklog 474); the page's "lives as long as the dungeon" lines were stale and are gone.

Checks

  • Golden shots (worklog 568): all 4,548 byte-identical to the baseline, the dungeons' (dungeon_shots, every type and volume, the lakes by night and hacked, area 101's leaves) among them.
  • tools/test_dungeon_rt.py, test_map_rs, test_lights_rs, test_field_rt, test_world_rs and test_area_rs on all four volumes: 24 of 24 pass, each line as before. Crate tests, the piney-game suite (344), gen --check, clippy (too_many_arguments 144, dead_code 0), fmt, cairns check, the docs check.

Still unknown: nothing