Entry 564

One sprite request: EffSprite and one ccEff cache for towns, story maps, fields, dungeons and breaths

Files32 in 12 directories
crates/piney-game/src/fx.rstown_fx.rscrates/piney-game/src/fx/ambient.rssprites.rscrates/piney-world/examples/ambient_probe.rsdungeon_probe.rscrates/piney-world/src/combat/breath.rscrates/piney-world/src/dungeon/dress.rscrates/piney-world/src/field/ambient.rsarea.rsfirefly.rsworld.rscrates/piney-world/src/lib.rssprite.rscrates/piney-world/src/story_map/abyss.rsboss_arena.rsdisc.rsending.rsgiant.rsholy_ground.rsmod.rssky.rstruths_core.rscrates/piney-world/src/systems/clouds.rsflare.rsmod.rscrates/piney-world/src/town/lia_fail.rsmod.rsdocs/engine/dungeon.mdevarea.mdtown02.mdplans/rust-cleanup.md

Mentioned inplans/rust-cleanup.md:265plans/rust-cleanup.md:301

The systems audit's "sprite and effect-request system" (plans/rust-cleanup.md section 2). Four types asked the effects for a ccEff::Draw(pos, pattern): TownSprite (the towns' flares, clouds and glows), StorySprite (the story maps'), breath::Flame (an enemy's flames, turned into the next) and field::ambient::Sprite (the weather, fireflies, a dungeon's sparks and glows, a symbol's fire). Three caches made the ccEffs: TownFx::effs, and AreaFx's story and ambient. Nothing drawn changed.

The request

piney_world::sprite::EffSprite: the file, the ccEff's name, the place, pattern and layer, the scale (two lanes), turn, transparency, the colour where the code sets it, and an EffState: what the sprite's owner did to the ccEff after Init(chunk, 1), each from the game's own code:

statewhat the code didwhose
EffState::INITnothing: fogged, depth-testedLia Fail's glows, an arena's FIREFLY2s, the field's fire roamers
EffState::FLARESetRenderState(CCRS_ZENABLE, 0) and PRIM's fog bit clearedLENSFLARE's and CLOUD's constructors, in towns, story maps and fields
EffState::NO_FOGPRIM's fog bit clearedEVENTAREA01's glows, the symbols' fires, a breath's flames (Init(chunk, 0)), a dungeon's lights
EffState::fogged(fog)the fog bit as the drawing left itthe weather's Effs, the fields' fireflies
clut: Clut::Set(new)eff->tex.clutChunk = chunka breath
clut: Clut::Change { new, old }ccEff::ChangeClut(new, old)a dungeon's sparks (DUNGEON::ChangeClut)

The flags that differed by caller type (depth, flare and fog, fog and ztest) are these. A sprite's layer is the field's draw layer; the ambient code turns its SetActiveLayer number into it as it makes the sprite (field::area::ambient_layer; active_layer back for the probe). sysLayer (0) and objLayer (1) are one layer here, so the way back gives 0: the snow under the hack is the one ambient sprite on either (test_field_ambient_rs caught the first try, which gave 1).

One cache

piney_game::fx::sprites::EffSprites: the ccEff of each (file, name, state), made once as Init(chunk, 1) and the state leave it, cloned for each draw, then the place, scale, turn, transparency and colour set and ccEff::Draw run. TownFx::draw and AreaFx (a story map's sprites through FieldFx::sprites, the ambient ops' sprites) both draw through it. The world's Request::Sprite, StoryMap::draw, ambient::Op::Sprite and Breaths::flames carry EffSprite; TownSprite, StorySprite, breath::Flame and ambient::Sprite are gone, and so are the three caches' keys (one of them, worklog 509, once without the file).

Checks

  • Golden shots, every PNG byte for byte: the towns' set (worklog 560, 561) and the story maps', fields', dungeons' and breaths' (worklog 562, the walk's two re-recorded by worklog 563).
  • Against the game on all four volumes, as for worklog 562 (among them test_field_ambient_rs, whose probe prints the sprites' layers and names, and test_dungeon_rt, whose probe prints the sparks' palette).
  • The crates' tests, piney-game's suite (release); piney-gen gen --check, clippy with all features, fmt, cairns check, tools/docs.py check.

Still unknown: nothing.