Entry 569

Fields as defs: FieldDef by field type, WORLD's pictures and background as systems on the runner

Documented in Field generation.

Files69 in 17 directories

Mentioned inplans/rust-cleanup.md:318

Section 2's map systems item, step 3's first half (plans/rust-cleanup.md): a field was FieldArea with an Ambient that made every picture inline by field type (ty == 0, ty == 7, ty == 9, ty == 10, ty <= 3) and handed a list of Ops to the field, which drew the models and the background itself (ambient_models, bg_draw) and the sprites and puffs through the effects. Now each field type is a FieldDef and the pictures are its systems on the runner the towns and story maps use (worklog 560, 566). Nothing drawn changed.

The def

field::def::FieldDef, one static a type (FIELDS, FieldDef::of), each BASE_FIELD with its differences: class (GameClass::World), ty, field (type 4 has none: its first dungeon is a lake's and stands for it), def_se (GO's jump table, the old DEF_SE), skies (GetWeather and GetTime by background row, the old get_weather / get_time switches as data: DRY, WET, SNOWY), back (where SetCharPosition stands the party back from the dungeon, the old field_start's type 10 and 6 arms), spark (FIREFLY::Move's sparks, EFF_sfzfir1 in type 9), and the systems by who makes them: init (WORLD::Init's, from the seed's fieldrand), plain / hacked (DrawBG's by isHacked), generate (Generate's after SetStartPos, from the layout's); order (FIELD_ORDER) and asleep (FIELD_ASLEEP).

systemgamemadetypes
SnowSNOW: flakes by weather (type 5's sfg8, 6's sfh8, SnowDef::Flakes), type 0's embersInit0, 5, 6
SmokeWORLD's ccMask 2D smokeInit2, 3, 5, 6
SteamDrawSteamInit0
Hazethe heat haze (HazeDef::ahead)Init0-3
LensFlareLENSFLARE mode 1: Sun::Row (DMY_<x>lig_<b+1>point), field_eff's six, FlareDraw::Field (the torus wrap)Initall
Scrolls, SkyDrawBG: v$4519 with the turns (ScrollsDef::turns, Wrap::Below hacked), the row's clumps (ClumpName::Row, Aurora) at the centre turned (At::Centre)DrawBGall
TobjTOBJ by Generate's rollGenerateall
Rain, ThunderDrawRain's drops; its stormGenerate7-10
FirefliesFIREFLY by night or hacked (Made::Generate)Generateall but 9
Firefly2FIREFLY2 roaming (Firefly2Made::Roam)Generate9
LakeSetLake's waterGenerateall
FiresSetSpecialObj's fires' smokeGenerate7
BirdBIRD by day out of the rainGenerate10

Each system's constructor makes what the game's does under the area's weather, time and hack flag (FieldCx: the def, the weather row, the server, the field as Init and Generate left it, WORLD_MAN's centre) and nothing otherwise. The systems' steps are WORLD::Draw's and DrawEffect's order; asleep, the last frame's pieces are drawn again, the haze's and the lake's sampling of the picture under them brought up to the camera (Hook::Again). GameClass is now a column of the systems table (Kind::class).

What else became data

  • ScrollsDef: a material takes its lanes Shown::Before or after per material (MatScroll::before; the arena's sky), names a field's sky or aurora material (Mat::Sky, Mat::Aurora), and the turns ride with their statics.
  • FlareDef: its Sun (a dummy or a field row's) and its file (town_z, or field_eff for a field).
  • Firefly2Def: who makes them (Markers, Roam) and their sprite (ByField, Field); both steps read the frame's Env (Fly's ground a Ground).
  • TownView, TownEvent are systems::MapView (with camera 1's place and turns, the frame's low bit) and MapEvent (with effSmoke, the sounds, TOBJ's hum, the flash).
  • New requests: Posed (a field's ccAnm::Draw: drawn models, skin nodes, alpha, one model's edits, TOBJ's shadow) and Masks (a ccMask's puffs in one send).
  • The drawing's function statics (SaveState::field_ambient) are each system's words (ambient::statics), the executable's start BOOT_STATICS; a field without a system keeps its words as they were.

What the world sees

FieldArea { def, core: AreaCore, .. } with step(view, awake, cc) (its MapEvents), paint (its sprites), take / put, take_made (TOBJ's tobjSeLoopStart, once). The field's draw, a dungeon's and the breaths' sprites go through FieldFx::sprites, their puffs through FieldFx::smoke; field::ambient::Op is gone. No world or game code names a field type: WorldMan::no_field() and DungeonArea::no_field() (type 4's def), the gate-out checks, member_transfer and loaddisp::kind take that flag; defSE is the def's.

tools/test_field_ambient_rs.py and ambient_probe: the probe makes the port's field from the disc (FieldArea::with_world with the case's Init centre) and hands the game's side the sun, the fires and Ω's runners it found; draws and calls are compared apart (each in order).

Checks

  • Golden shots, every file byte for byte against worklog 568's baseline (4,548 files: the towns', story maps', fields', dungeons', breaths' and 568's field and dungeon sets, every frame's digest among them).
  • Against the game on all four volumes, all fifteen EE harnesses (60 of 60, as the baseline), test_field_ambient_rs through the new probe.
  • The crates' tests, piney-game's suite (release); piney-gen gen --check, clippy with all features (too_many_arguments 144, one fewer: anim_edited is gone; no dead_code allows), fmt, cairns check, tools/docs.py check.

Found on the way, for the next entries: WORLD::Init loads fieldccs2 (field_a1 ..) for a hacked field, the port fieldccs always.

Was unknown

whether a hacked field's objects and ground come from fieldccs2 in the port as WORLD::Init loads them (it loads fieldccs)

Closed by No. 571 — A hacked field reads its field file from fieldccs2.