Entry 528
Boss split, step six: enum Fx, BossBase::make_fx and one effect pass; on the effect side Mirrored pictures and one sync from one Source
18mbattle
Files7 in 5 directories
Mentioned inplans/rust-cleanup.md:478
The sixth step of section 2's boss split (plans/rust-cleanup.md, the
boss effects item; 523-527 before it). The effects whose Draw a class
runs had ten Option<Box<_>> fields on Eff. They also had seven copies
of the manager's pass, four of the maker, and four separate mirrors on
the effect side. All three are one now:
- the battle side:
Fx,make_fxandeffect_pass; - the effect side:
Source,Mirroredandsync.
The 288 pinned probe answers are byte for byte the same, and the boss harnesses pass against the game.
The battle side
enum Fxin place ofEff's ten fields (missile,meteorite,needle,fidchell,bolt,ball,hell,macha,tarvos,corbenik):Eff.fx: Option<Fx>.- Its variants box each class's rules.
- A
Fromfor each, written by a small macro.
BossBase::make_fx(cx, kind, fx, pos, dirc)puts an effect with its rules in the first free slot and shows it.- It replaces Corbenik's, Fidchell's, Macha's and Tarvos's
make_fxs. - It also replaces the inline create-then-fill of Innis's missiles, Kyvia's meteors, bolts and ball, Magus's needles, a seed's flush and the star dust's thunders.
- Each rules value is built before the slot, as the copies did; the
needle keeps the body's heading as its
dirc. The hell's express still fills its slot itself, since it starts its generators between the two.
- It replaces Corbenik's, Fidchell's, Macha's and Tarvos's
BossBase::effect_pass(mode, draw)isccBossEffManager::Draw's pass:- each enabled effect in slot order, a disabled one freed;
- an effect with rules taken out of its slot for the class's
draw, which gets the base and the slot, then put back; - the rest keep their lives (
Eff::draw). - It replaces the seven
manager_passes (Innis, Magus, Kyvia, Fidchell, Macha, Tarvos, Corbenik).
PassModekeeps the one way they really differed:Set: theDraw's answer setsm_bEnabled(Macha, Tarvos, Corbenik);ClearOnly: it only clears it (Innis, Magus, Kyvia, Fidchell).
- The other difference was not one. The copies ran over a snapshot
of the slot count (
for k in 0..len) or the live count (while k < len). The slots are made all at once (1,024) by the firstcreate. A pass that starts with none has nothing that could make one, so both read the same. - The draws Magus and Kyvia ran in their slots (needles, meteors, bolts) are taken out like the others. None of them reaches the manager.
The effect side
piney_effect::boss::Source: the effects with their rules by their slot ((i32, &Fx), every live boss's in character then slot order), Kyvia's members' places, Magus's leaves' markers and bursts.- piney-game builds it once (
boss_fx,kyvia_members,magus_shows). That replacesboss_spells,innis_flightsandkyvia_shows' effects, and Magus's needles.
- piney-game builds it once (
Mirrored, for a picture that mirrors a rules effect:- the rules it reads in an
Fx(rules); - the slot it follows (
rules_slot); - whether it runs on its own (
unmirrored); - what dropping it lets go (
forget: a missile's and a meteor's trail anchors); - its draw of the rules' state (
mirror). - Innis's missile, Kyvia's meteor, bolt, ball and hell, and Magus's needles implement it. The four Kyvia ones (but the meteor, which forgets its anchors) come from one macro.
- the rules it reads in an
BossEffects::sync(ctrl, cx, t, &Source)replacessync_spells,sync_missiles,sync_kyviaandsync_magus, and the four*_syncs ofpiney_effect::Fx, with oneboss_sync. Its order is explicit and the old one:- Fidchell's spells, each picture made at first sight;
- Innis's missiles: those let go dropped, the rest drawn in the rules' order;
- Kyvia's members' places, then its four kinds: dropped, then drawn in slot order;
- Magus's leaves' markers, its needles likewise, then the bursts.
- A rules slot is matched as before: the first entry at that slot of the picture's own kind.
The diff is about 520 lines added and 600 removed in 28 files.
Checks
- The pin: 288 probe calls replayed, every answer byte for byte the same.
- The tests of piney-battle, piney-world, piney-effect and piney-event, and piney-game's full suite (its boss session tests and the boss effects' shots), release.
- The boss harnesses against the game on their volumes (the eleven
test_battle_*_rs),test_boss_effect_rson all four volumes andtest_bosscam_rson Infection, Mutation and Quarantine. - clippy with all features, fmt,
cairns check,tools/docs.py check. too_many_arguments: 152 before, 152 after.
Still unknown: nothing