Entry 484
Effects take the game's fog: each piece's fog bit as the game sets it, the area's SetFog in the effects' draw environment, a sprite's FOG drawn; no effect casts a shadow
40mrender
Documented in The field's effects - ccThEffect and ccThParticle, The model draw path and VU1 microcode.
This entry answers what was left open by question 1 of Open questions after the triage: the effects and the streams' effect tasks, question 13 of Open questions after the triage: the effects and the streams' effect tasks.
Files11 in 7 directories
effect.rsdraw.rsdrawelm.rssprite.rshost.rscrates/piney-draw/src/lib.rscrates/piney-gs/src/convert.rscrates/piney-desktop/src/soft.rscrates/piney-world/src/town.rscrates/piney-game/src/fx.rstools/test_effect_spell_rs.pyPlay question 79/231 (284.1) and the sprites' fog from the same
entry: which effect objects the game fogs and shadows, and whether a
sprite's FOG reaches the picture. The port drew every effect clump and
anim without fog, and every ccEff sprite without its FOG. The effects'
camera held a Reset draw environment, not the area's fog.
The fog bit.
ccObj::Init(main 0x0013b5c0) sets every object's fog bit (+0xa0 bit 3), and its shadow bit (bit 2) when it has a shadow model.ccObj::Draw(0x0013f33c) makes PRIM.FGE from bit 3.ccClump::SetFogSwandccAnm::SetFogSw(0x0013d6c0, 0x00152a60) set it on every object.- Their callers are the same on all four volumes (checked with the
relocations and
--scan):- Off:
InitEffect; the fire, fireball and plasma elements' anims and the fire's shade; the ring, thunder, thunderbolt and magic-circle elements; the particles; the portal. - Back on (
SetFogSw(1)):effMeteoFireBall2(dark, and soil),effSmokeRock,effIceRock,effSmokeIce,UpheavalSystem's pillars,effUpheavalFragmentkinds 0 and 1, and four pieces by attribute:effSkillTornadeObjPos,effRadiateSomething/2andeffSmmonsFragmentwith water or soil,effSkillChargeObjwith dark, wind or water. - On: everything else - the rock, dark, ice, blantch and needle
elements, the trees, the drills, every boss's own clumps and anims,
the resistant shield. No boss class calls
SetFogSw.
- Off:
- The port:
Effect::fog_sw,AnmObj::fogand afogonDrawRec::Clump/Anm. A fogged one draws with VU1's fog by depth from the camera's draw environment (DrawEnv::depth_fog). - The area-level calls (the towns' skies, clouds and water, the
EVENTAREAs' backgrounds,WORLD::Init's four background clumps andSetLake, the dungeons' lake backgrounds andSetWater) were already drawn without fog by their modules. "Only the gate was fixed" was out of date.
The draw environment. ccDrawEnv::active is cc3d from
InitCCSys (0x0010a5d0) on. Only ccThDrainEnemy and ccThStrParty
swap it for a moment. Every area's SetFog writes cc3d. So the effects
draw under the area's fog:
TownLights::fognow holdsSetFog's arguments (FogParams), so the effects can build the environment with the EE's arithmetic.FieldFx::set_foghands the place's fog over each frame, and the town passesWorld::fog.Camera::foggedwrites it intoenv.
The sprites. GsSprite already held FOG's F (at the centre's w) and
FOGCOL, checked against the game; prim dropped them. Now
piney_draw::DrawState::fog carries them when PRIM.FGE is set, and
piney-gs (Params::FOG with the fog word) and the soft renderer put the
primitive through the fog stage, (Cs F + FOGCOL (0xff - F)) >> 8. The
effects' own sprites still clear FGE. The bosses' particles, a town's
sprites with depth and a story map's keep it, and now fog.
Shadows.
- Of the effect files only x703's objects 6 and 10 (the drill's) have
shadow models, and
DecodeShadowModelrefuses both. Its refusals are checked against the game for every shadow model inDATA.BIN. So no effect casts a shadow. - The drill's
ccAnm::SetShadowSw(1)and its case's draw environment change nothing seen. At 0x001c7234 it sets alpha +0xa4 to 128 and length +0xa0 to 450.0, and at 0x001cbff4 it puts the alpha back to 128 but leaves the length. Every caster that reads the length sets its own first (ccChar::Draw,ccBoss::Draw,TOBJ::Draw,ccGimBox::main, ...), as the port's casters do. ccTreeUpheavalMngrElement'sSetShadowSw(0)is on a tree with no shadow model. effects.md saidccObj::Drawskips the shadow model below 1/128; it draws it whatever the transparency, and the page is fixed.
Checks:
tools/test_effect_spell_rs.pynow hooks bothSetFogSws (ccObj::Init's bit atccClump::InitandSetAnm). Each frame it compares every clump and anim draw's bit with the probe's newfoglist. All five spell systems pass (2 random casts of every spell, 400 frames). A sample of nine spells drew both 0s (CMP_x300) and 1s (CMP_x101-x202) the same as the game.a_fogged_sprite_carries_its_f: Mac Anu's fog gives the environmentDrawEnv::set_fogdoes, F 154 at w 4000, and no fog without FGE.a_fogged_primitive_takes_its_fin piney-gs and the soft renderer.
Still unknown: nothing