Reference ยท Engine

Bosses - ccBoss and Skeith

Covers105 in 6 groups
INF gcmn.prg:0x0045b2a0 ccBossEntryStart0x0047b340 ccThBoss010x0045bcf0 ccBoss::ccBoss0x0047b410 ccBoss01::ccBoss010x0045c270 ccBoss::Main0x0047bd50 ccBoss01::Main0x0045c600 ccBoss::Move0x0045c730 ccBoss::Affect0x0047bdf0 ccBoss01::Affect0x0045f090 bossAffectFunc0x0045d310 ccBoss::ChangeAction0x0045d210 ccBoss::ChangeNextPattern0x0045cad0 ccBoss::ExecPatternIndex0x0047c500 ccBoss01::ExecPatternIndex0x0047c1e0 ccBoss01::Think0x0047bf80 ccBoss01::Action0x0047ca50 OnThinkNeutral0x0047cba0 OnThinkDamage0x0047cc20 OnThinkEpitaphNeutral0x0047cdc0 OnThinkEpitaphWave0x0047d000 OnThinkChase0x0047d2f0 OnThinkEscape0x0047dac0 OnThinkReturn0x0047dbd0 OnThinkWander0x0047ddf0 OnThinkDash0x0047e030 OnCrossAtk0x0047e1a0 OnWaveAtk0x0047e410 OnDataDrainAtk0x0047e6a0 OnMagicAtk0x0047c390 ccBoss01::DrawCross0x0045e070 ccBoss::SelectTarget0x0045ec60 ccBoss::CalcTargetInfo0x0045df40 ccBoss::EraseCmndTarget0x0045dfc0 ccBoss::EntryCmndTarget0x0045ee90 ccBoss::BeginDeadEffect0x0045f0e0 _ccBossSkillDamage (char)0x0045f470 _ccBossSkillDamage (pos)0x00461750 ccBossEffManager::Draw0x00461a60 ccBossEffManager::IsEnabledEffect0x00478820 ccBossEffWaveShockCreate0x0046b3f0 ccBossEffWaveShock::Draw0x00478b10 ccBossEffMagicSquareCreate0x004793d0 ccBossEffLightCreate0x004797e0 ccBossEffForceGeneratorCreate0x0046dd90 ccBossEffBrightMagicSquare::ccBossEffBrightMagicSquare0x0046e320 ccBossEffBrightMagicSquare::Draw0x00479900 ccBossEffAutoSamonRingCreate0x0046ed70 ccBossEffAutoSamonRing::Draw0x00462660 ccEffSamonRing::Draw0x00479240 ccBossEffIceBreakCreate0x0046cc10 ccBossEffIceBreak::Draw0x004795d0 ccBossEffDeadCreate0x0046a440 ccBossEffDead::Draw0x00466a30 ccBossEffLight::ccBossEffLight0x00466df0 ccBossEffLight::Draw0x0046c950 ccBossEffIceBreak::ccBossEffIceBreak0x00462430 ccEffSamonRing::ccEffSamonRing0x00461bd0 ccEffSamonRing::SetModel0x00462750 ccEffSamonRing::BurstScale0x00462780 ccEffSamonRing::BurstTransparency0x00462790 ccEffSamonRing::SetPosRot0x00579ad0 ccLattice::ccLattice0x00579b70 ccLattice::Init0x00579c50 ccLattice::ClearCnt0x00579cb0 ccLattice::MakePacket0x0057a0e0 ccLattice::SendPacket0x0057a300 ccLattice::SetPos0x0057a3a0 ccLattice::NextVertex0x0057a470 ccLattice::Disp0x006519b0 latticeAttributeColorTable0x005eb430 boss01NormalActTbl0x005eb490 boss01SuperActTbl0x005eb530 boss01EpitaphActTbl0x005eb5b0 Boss01AnmTbl0x00696ce0 BossSkillTblINF SLUS_202.67:0x00519920 ccCheckTarget0x00519630 ccEntryCmnd0x0056cb50 ccChar::ClearCondition0x0059d080 checkPartyAnnihilation0x00106850 ccBufferReverce::ccBufferReverce0x00106890 ccBufferReverce::MakePacket0x00160240 ccScFade::EntryFlashINF gcmn.prg:0x004618b0 ccBossEffManager::OnCinemaMode0x00461940 ccBossEffManager::OffCinemaMode0x0046a7e0 ccBossEffCinemaFade::ccBossEffCinemaFade0x0046a8c0 SetupSkillName0x0046a9b0 CinemaOn0x0046aa70 CinemaOff0x0046aa80 Init0x0046ac20 Clear0x0046ad10 ccBossEffCinemaFade::Draw0x005eb040 _g_cinemaSkillName0x006aa950 Draw's mode tableINF gcmn.prg:0x00461200 ccBossBlur::Main0x004614b0 ccBossEffManager::ccBossEffManager0x004610e0 ccBoss03BlurParamCB0x00461410 ccThBossEffectINF SLUS_202.67:0x001006c0 _ccMalloc0x00100500 ccHeapFree::SearchFree0x001005a0 ccHeapFree::AddTbl0x00100960 _ccFree0x00100370 ccHeap::InitFirst0x00100008 _startOUT gcmn.prg:0x00472b90 ccBoss03BlurParamCB0x004a3afc ccBoss04::ccBoss04

The bosses are not enemies: ccBoss is its own ccChar with a pattern table, a set of actions and a manager of effects. Infection has one, Skeith (ccBoss01, bossTbl row 0), fought in event 30 (the EVENTAREAB0 arena). This page is the rules: what a frame of Skeith does, and what the Data Drain and Kite's hits do to it. It also covers its pictures: the effects, the cross's trail and the reversed layer, and its camera. The arena is The story maps.

Where it comes from

Event 30's block 20 runs entry type=7 code=0. ccEntryEventMng hands type 7 to ccBossEntryStart(0), which starts two tasks at priority 66: ccThBossEffect (the effect manager) and bossFunc[0] = ccThBoss01. The manager's task runs first in the frame. ccThBoss01 news a ccBoss01 and loops boss->Main(). Once CheckExit() is true it sets its task parameter's +0x14 to 1, which is what the event's absent type 7 reads.

The constructor

ccBoss::ccBoss sets the boss off (exit on, not drawn, no body hit, no cheat HP). It sets affectFunc = bossAffectFunc, waitPatNum = -2, patNum = 13 and loads xeffect. ccBoss01::ccBoss01 then:

  1. SetBaseParam(ccGetBossParam(0)), actAnmTbl = Boss01AnmTbl.
  2. Exit off, drawn, body hit on, cheat HP on.
  3. Stands 500 units below Kite (pos = plw.pos, pos.y -= 500), facing his way.
  4. Loads x11 (CMP_trall) and makes the ccAnm. ChangeAction(0, 0, 4) sets ANM_ex11nut0.
  5. ccEntryCmnd(this) puts it on the enemies' command list.
  6. SetPatternTbl(Normal) and ExecPatternIndex(patTbl, 0). The index it returns is dropped: patIndex stays 0.
  7. InitAfterImage(anm, 50), InitBossEffect(64), InitBossCamera(200, 1000), InitCenterPos() (the arena's DMY_center01), InitStageEffect().

Both ccAnimateObjects (m_animate, m_animateDead) start at transparency 1.0 and scale 1.0.

A frame: ccBoss::Main, ccBoss01::Main

ccBoss::Main:
  if exit: return
  CalcReal(0); CalcTargetInfo()
  centerPosP = W2P(centerPos); centerDist, centerDirc from posP
  if stop: stopCount++ (at 61: stop = 0, stopCount = 0); moveSpd = 0
  else stopCount = 0
  Think(); Action()
  if lockPlayer:
    every party member on a command list gets EntryAffect(this, 5, 32767) (held)
    reserved menu forbid (1) and no menu open: ccMenu.forbid = 1
      (and forbidChatExcept if reserved)
  elif reserved unforbid (-1) and no menu open: ccMenu.forbid = forbidChatExcept = 0
  Move()
  boss camera, stage effect, PreDrawAnm / Draw / DrawAfterImages when drawn
  condition.hold = 0
ccBoss01::Main:
  ccBoss::Main(); condition.hold = 0; DrawCross()
  if (lockPlayer or eraseTarget) and not the Epitaph and PPcount > 0: PPcount++

Think and Action read anmStatus, which PreDrawAnm set the frame before: anm._AnimateForward(anm.speed) has reached the clip's end. Skeith's PreDrawAnm also sets the wave's ccAnm speed to 512 in acts 4 and 13.

Move steps posP by moveSpd along moveDirc (x += sin, y -= cos) plus moveVector, then resolves the body hit.

The camera fade: ccBoss::Draw

ccBoss::Draw (INF gcmn 0x0045d4b0, MUT 0x00472e50, OUT 0x0046e730, QUA 0x00361040) is the same in every volume and every boss draws through it: ccBoss::Main (Skeith, Magus, Fidchell, Gorre's brothers, Macha, Tarvos, Corbenik's three forms, its eyes and killer eyes, Innis's images), and the classes with their own Main call it themselves (Innis, Magus's leaves, Gorre in the Kerse only, the seeds, the second form, Kyvia's four bodies, its core and gomoras). What the rules see of it:

if transDist (+0x90, 1 from ccChar's constructor) and checkCameraType() != 1:
  far, fade = game.area 0 ? (4000, 400) : (7000, 600)
  transparency = setTransparency * ccGetCameraTransparency(pos, base width,
                 base height, far, fade, &hide)     # activeCamPtr's eye
else: transparency = setTransparency
the clip is drawn when transparency >= 0.05 or hide (the camera inside it)

transDist is set by ccBoss's constructor and cleared only by ccBossKyvia03's and ccBossKyvia04's (OUT gcmn 0x004de640, 0x004e7708; QUA 0x003d0f50, 0x003da018): Kyvia's third and fourth bodies never fade; their core and gomoras do.

The rest is drawing: the condition tint and fog blend (+0xa6..+0xb8, SetFogBlend), the draw environment's alpha (setTransparency when hide), the clip's own transparency and ccAnm::Draw. Innis, Kyvia's core and gomoras and Gorre's Kerse set both words to their alpha first, so their drawn transparency is that alpha faded. Code that reads transparency back reads the faded value: Skeith's animate fade starts from it, as do Magus's chase and the seeds' fall.

The port: Boss::draw (piney_battle::boss) at each of those places, reading the active camera of camera.cpp's list as it stands then (after the frame's CamMain: its eye, pitch and type) and game.area's far end and fade. Every boss harness runs Draw natively over the game's own cameras as the case lays them (draw_case and put_cams in tools/test_battle_boss_rs.py: tcam near, about the arena or far, a random pitch, now and then the eye view; the forced cameras put into the active one after the constructor, with bossCamSW cleared) and compares the transparency of the boss and its parts each frame.

Actions and patterns

ChangeAction(n, forbid, anm) gates on actForbid:

forbideffect
0only if actForbid == 0
1actForbid = 0, always
2, 3actForbid = forbid, always

On success it sets actNum = n and zeroes actProccess and actCount. If anm is set and actAnmTbl[n] names one, it sets that animation. Act 12 sets epitaph.

ChangeNextPattern wraps patIndex at the table's -1. It zeroes the movement and changes to 12 (the Epitaph) or 0 with forbid 3 or 1. Then patIndex = ExecPatternIndex(patTbl, patIndex).

A pattern is a word and its operands. Skeith's ExecPatternIndex handles:

wordoperandsdoes
1the wave: act 13 in the Epitaph, else 4
2twait t frames (-1: 30 unless the party is gone; -2: until the skill ends)
9type, skilla skill on the target SelectTarget(type) picks
10typeone of skills 157, 158, 160 (ccRand() % 3) on the target
11skilla skill on itself
14the cross: act 3
15the Data Drain: act 5
16the magic: act 6

For words 9 and 10 an invalid or dead target falls back to SelectTarget(3). If that fails too, it waits 30 frames and the word is tried again. A skill is ccItemSkillRequest, then a -2 wait.

The base ccBoss::ExecPatternIndex handles every other word:

wordoperandsdoes
3escape (act 16)
4chase (act 18)
5return (act 17)
6ddash d units across the centre (act 7)
7wander (act 8)
8neutral
12skilla skill on each living party member

The tables (words, -1 ends):

Normal  0x005eb430: 2 30 4 14 4 14 2 60 3 2 30 4 1 2 60 6 1000 2 30 16 6 500
Super   0x005eb490: 2 30 15 2 60 4 14 4 14 2 60 6 500 6 1000 2 30 16 2 120 4 1
                    2 30 6 1000 2 30 16 2 30 3 2 120 4 14 3 2 100
Epitaph 0x005eb530: 3 2 30 11 150 2 30 7 4 1 2 30 6 1500 3 2 30 10 3 7 4 1 2 30

Word 5 (return) is in none of them, so act 17 never happens to Skeith. Acts 9, 10 and 19 write to address 0, and none is reachable.

The acts

actnameanimwhat it does
0neutralex11nut0face the target; count the wait down; then the next pattern
1, 2damageex11dmg0/1as neutral; at the clip's end SE 195, back to 0
3crossex11atc0hold the target every frame; at frame 40 skill 0 on it, release, SE 171
4waveex11atc1at count 73 the wave's ANM_xx11wave, a flash, WaveShock; 25 frames on, skill 1 at its position
5Data Drainlock the player, cinema; at 45 open menu 74 on the target's slot; when it closes, affect 13 on the target
6magicex11mag0see below
7dashfade to half, off the command list, run to the dash point (120 frames at most)
8wandermove away from the target at speed 45, 60 frames or out of the arena
11Epitaphdrained: cheat HP off, the Epitaph table, act 12
12Epitaph neutralex1xnut0as neutral; patNum 8 also waits for the target within 900 (300 frames at most)
13Epitaph waveex1xatc0the wave from frame 29 of the clip, skill 1 at count 30
14deadex1xdea0off the command list, the dead effect, a 30-frame fade; then exit
16escapezigzag at speed 35 for 90 frames, off the command list
18chasefade to half, speed 150, after the target until within 400 (90 frames)

"The arena" is 1500 units of centerPosP (IsValidArea).

The magic (act 6) is timed by its effects:

  1. Process 0. Lock the player, chat excepted. Switch the arena's layer. Begin the stage effect (0x64000000). Leave the command list. Play ANM_ex11mag0 and make the MagicSquare. SE 225, cinema 2.
  2. Process 1, count 30. A ForceGenerator 1000 units above each living member. SE 226.
  3. Process 2. SE 227 at count 130. Once the last ForceGenerator is gone, an AutoSamonRing at the target.
  4. Process 3. Once the ring is gone, an IceBreak at each living member (or the target). Stop drawing, end the stage effect, SE 228.
  5. Process 4. Switch the layer at count 15. While the IceBreak lives, draw the reversed layer. Then:
    1. draw again and rejoin the command list;
    2. unlock the player;
    3. skill 2 at the target's position;
    4. SEs 66 (note 52), 65 and 56;
    5. cinema off, the next pattern.

Hits and the drain: Affect

Nothing reaches bossAffectFunc unless EntryAffect's checks pass:

  • the boss is on a command list (ccCheckTarget);
  • an enemy's pending affect is not 13;
  • the type is not 5 or 6 (5 holds, 6 does nothing);
  • the type is not masked.

bossAffectFunc calls the vtable's Affect (slot 0x24).

ccBoss01::Affect:
  if type != 21 and (actForbid == 2 or lockPlayer): return
  ccBoss::Affect()
  if type == 21: HP = maxHP = 4500
  elif type is 1 or 3, patMode == 0, PP >= maxPP / 2:
    the Super table from its start; patMode = 1
ccBoss::Affect (the same gate first):
  5: stop = 1          6: stop = 0
  21: HP = maxHP = maxHP / 10; PP = -1; PPcount = 0
  13: ChangeAction(11); affectType = 0
  7, 9: fly font 20, HP += p0 (to maxHP)
  1, 3: nothing once checkPartyAnnihilation() or compulsionGameOver
        fly font 2 (p0); p0 < 0 stops here; the hit mark
        cheatHP: HP -= p0 / 10, never below maxHP / 2; else HP -= p0
        HP <= 0: ccClearSpcCondition, ClearCondition, ChangeAction(14, 2, 4)
        else for type 1: ChangeAction(1 or 2 by ccSys.count's low bit, 0, 4)

ClearCondition here is the plain ccChar::ClearCondition(): the conditions, not PP or the buffs.

So Skeith cannot be killed before the drain. The drain's target menu sends 13 (the Epitaph), and the drain itself sends 21 (4500 HP, cheat HP off from act 11 on).

Targets

SelectTarget(type, radius):

  • Type 0: the nearest person (ccSearchNearPerson(this, 3, 0, radius)).

  • Type 1: the farthest living member.

  • Types 2-14: a pick among living members:

    • 2 and 3: most and least HP;
    • 4-11: most and least of a personality field (+72, +74, +80, +82);
    • 12: no conditions;
    • 13: most conditions.

    The pick is dropped if it is farther than radius.

If the only PC on the list is dead, the boss keeps facing its way and there is no target. CalcTargetInfo copies the target's positions and works out targetDirc and targetDist.

Skill damage

ccBossSkillDamage(boss, X, i) uses BossSkillTbl[i] (0x38 bytes each). It puts the boss back on the command list for the call. sk + 32 is a range:

  • Above 0: every living member within range of the centre (less its width). With flag 0x8000, those other than the target take half. The centre is the target, or with flag 0x2000 the boss itself.
  • Below 0: every living member.
  • 0: the target alone.

Damage is CalcBattleDamage(boss, m, sk, 1.0, -1), sent as affect 1.

Effects

Each ccBossEff*Create news an effect and stores it in the first free of _g_bossEffManager's 1024 slots. It returns the slot, and ccGetBossEffAdrs(id) gives the object. Byte 0 is m_bEnabled.

The manager's Draw runs each effect's Draw (vtable slot 8). It deletes effects that are no longer enabled, the frame after they clear the flag. Skeith waits on m_bEnabled, so each effect's life is part of its timing:

effectSkeith's callDraws until disabled
WaveShock(pos, dirc, 1.0)45: its ccAnm to the end of ANM_ex31lhit (46 frames)
MagicSquare(pos, 0)91: a ccBossEffLight(pos, 0, 80, 10). Returns -1, not the slot
ForceGenerator(p, (pi/2,0,0,1), 10, 200, 200, 8, 100, 8)life + 10 * ((num - 1) / 2) + 3 = 133. Photon k waits (k / 2) * 10
AutoSamonRing(targetPos, (0,0,targetDirc,0), (0, 1/3, 10), 35)20: its ccEffSamonRing fades out, whatever the model (35)
IceBreak(pos, 2.0)123: a flash, 61 frames, 61 more
Dead(pos, pos, 0)120

The ForceGenerator formula was checked for num 1-8 and several lives.

The effects' pictures

ccBossEffManager::Draw (0x00461750) is the task ccThBossEffect (priority 66), which runs before the boss's own task:

SetActiveLayer(3)                      effLayer (priority 20)
each of the 1024 slots in order:
  m_bEnabled 0: delete (vtable +0xc, 1), the slot freed
  else: Draw (vtable +0x8)
SetActiveLayer(5); ccBossBlur::Main; the cinema's Draw

Each effect as Skeith makes it:

  • WaveShock (Create 0x00478820, Draw 0x0046b3f0). The Create plays SE 36, 68 and 56 (note 60) at pos. It makes an Eruption: g_eruptionGenerator at pos with pTexMod 158, in a slot left disabled, so the next pass deletes it. The WaveShock itself holds ANM_ex31lhit of xeffect. Each Draw steps it and draws it at SetMatrix_PosRotZYXScale(pos, vf0, 5 scale). At the clip's end it clears m_bEnabled. The dirc is not used.
  • MagicSquare(pos, 0) (0x00478b10) plays SE 228 and starts MagicSquareGenerator rows 0, 1 and 7 at pos with distSW off. It then makes a ccBossEffLight(pos, 0, 80, 10) and returns -1. (Squares 1 and 2, and the light's modes 1 and 2, are Fidchell's: boss-fidchell.md.)
  • Light (constructor 0x00466a30, Draw 0x00466df0) is an omni light: ccLight(4, 1), ccOmniLight::Init (intensity 1, no fall-off). Each Draw places it at pos plus (0, 200, 300) turned about x by -pi/2, then about z by the camera's heading (cameraGetRot(camID)'s z). It waits 10 Draws, then joins the light group (AddGrp) for 80 more. Its blue climbs by 10 a Draw to 250, holds 255 for 15 Draws, then falls by 10. The colour is ccSetColor(b << 16 | g << 8 | g), with g 1 while b is 2 or more. The characters are lit by it with the arena's lights. The value goes to an unsigned through fptoui on Infection and Mutation (0 for a negative b) but an inline cvt.w.s on Outbreak and Quarantine: there a b below 0 keeps its high bits, which ccSetColor reads as an alpha byte and so as an HSV colour (a grey).
  • ForceGenerator (0x004797e0) makes a ccBossEffBrightMagicSquare (0x0046dd90, Draw 0x0046e320) of num photons, each an EFF_x000 of particle with CLT_x000c5 (clt 8). Photon k waits (k / 2) * 10 Draws, then starts its g_energyOutGenerator, which follows the photon (syncPos). It circles its centre at pi/16 a Draw, its radius going from r0 to r1 over life, and falls by speed (10) a Draw. It is drawn at scale 10 until its life runs out; then its generator is killed.
  • AutoSamonRing (0x00479900, Draw 0x0046ed70, ccEffSamonRing::Draw 0x00462660): SetModel(35) is particle's CMP_x033. It is drawn bursting: the scale grows from 0 by 1/3 a Draw and the transparency falls from 1 by 0.05. It is gone once that is below 0.
  • IceBreak (0x00479240, constructor 0x0046c950, Draw 0x0046cc10). The constructor draws ccRand() once. It starts g_IceSmokeGenerator at (pos.x, pos.y, 180), offset 100 up. The first Draw flashes the screen (60 frames, 0x80e0ffff). The crystal, particle's CMP_x201d, is then drawn at scale 2. After 60 Draws the smoke is killed. After 60 more come twelve effIceRocks: three sizes four ways from 100 above pos, ids 15-18 by rand. Then a 30-frame flash, and it is disabled.
  • Dead (0x004795d0, Draw 0x0046a440) runs four stages of BossDeadGenerator rows, raising its z each time. The first stage (z +220) comes at once, with SE 56. The second (+20, ccSeOnNote(104, 36)) comes 35 Draws later, the third 60 after that, the fourth 20 after that. It is disabled once the last generator has ended.

No Skeith effect reads ccIBossEff::cmn_bossCam.

The port. piney_effect::boss holds the effects: Effects::boss_create and Effects::boss_step, the manager's pass. Their draws go first in the effects' draw. The field's effect tasks gain two calls around the boss's frame (FxTasks::boss_effects, boss_shows):

  1. The manager's pass comes before the boss's task, as the game's task order has it.
  2. The boss's Out::Effects are made after it.

The Creates draw from the battle's rand and ccRand as the game's do. The sounds go to the area mode as notes, positioned or not. The flashes go to scFadeDef. The light joins the characters' light list. In the game the Creates run inside the boss's Main; the port makes them right after it, before any other draw from rand that frame.

Checked. tools/test_boss_effect_rs.py runs the game's ccBossEff*Create and the manager's Draw loop in eemu against boss_probe, frame by frame until every slot is free. It covers each of the six with two cases each, and OnMagicAtk's scripted order of MagicSquare, ForceGenerator, AutoSamonRing and IceBreak with a WaveShock and the dead effect alongside. It compares:

  • every draw in order (the animation's step, the clump's transparency, each sprite's place, scale, turn, colour, transparency, CLUT and pattern, the matrix, the layer);
  • the sounds, the flashes;
  • the generators started (rows and force fields by address, distSW, syncPosType, pTexMod, pos, offset, the photon followed) and their killFlag;
  • the light (in the group, place, colour), each slot's m_bEnabled;
  • the effect slots the ice rocks fill, rand's state and the genrand count.

They match, on Infection's disc and on Outbreak's (where Fidchell's spells and magic squares are run too). genrand (behind ccRand and ccRandF) is a 32-bit LCG on both sides. The particle system itself is not run there (its own tests cover it): no particle is ever free.

The cross's trail: DrawCross and ccLattice

ccBoss01::DrawCross (0x0047c390) runs at the end of each ccBoss01::Main:

act 3 (the cross):
  once: DMY_xdummy_w01, DMY_xdummy_w02 (the sword's ends) and x11's
        OBJ_ex11swd (GetObjAdrsF)
  each through the sword object's last world matrix (sceVu0ApplyMatrix)
  lattice.NextVertex(); SetPos(w01, 0); SetPos(w02, 1)
every frame: lattice.Disp()

The lattice is new ccLattice(2, 7) (0x00579ad0): 16 rows of two vertices, colour type 7 (magenta, latticeAttributeColorTable 0x006519b0).

  • NextVertex (0x0057a3a0) moves the head one row back, the tail with it when they meet, and gives the new row life 6.
  • Disp (0x0057a470) makes a strip from the head row to the tail row (MakePacket 0x00579cb0). A row's alpha is life * 48 / 5 under life 5, else 48.
  • SendPacket (0x0057a0e0) sends it only once 16 rows have been made: TEST 0x73001 (depth GREATER, no write), ALPHA 0x44 (the usual mix), PRIM 0x4c (a gouraud strip), sorted on effLayer by the vertices' mean world z.
  • Each row's life then drops by 1; a row at 0 pulls the tail back.

A vertex behind the eye, or more than 640 x 576 pixels off the display's corner, gets ADC and draws no triangle.

The party's weapons use the same lattice (battle.md, the party's weapon trails). Job 4's has three columns. Disp then sends a strip for columns 0-1 and another for 1-2 in the one packet, each starting with ADC. A middle vertex's z goes into the sum once, and the key is the sum over twice the pairs sent. ClearCnt (0x00579c50) empties the ribbon when +0x72c is set (ClearArmsEffect). ArmsEffect also writes the colour type (+4), which MakePacket reads each time.

MakePacket transforms each vertex once a Disp (a flag per vertex, cleared in SendPacket) and adds its world z to a sum; SendPacket divides the sum by twice the rows for the key, and also clears the first-row flag.

The port. piney_world::sky::lattice::Lattice is ccLattice. The boss's field run (BossRun) keeps one: in the cross it takes the two dummies through OBJ_ex11swd's world matrix at the actor's drawn pose, and World sends the strip each frame (trail_packet) as the triangles it draws.

Checked. test_boss_effect_rs.py's test_skeiths_trail drives the game's ccLattice(2, 7) in eemu as DrawCross does: runs of cross frames (NextVertex, both SetPos, Disp) between runs of Disp alone: 605 frames, 443 of them sending a strip. It compares the port's lattice after every call: head, tail, each row's life and vertices, rows made, full, the first-row flag. After every Disp it also compares the strip SendPacket sent (each vertex's RGBA and ADC as MakePacket wrote it, or none) and the sort key, to the bit. They match. ccTransPosFW2LW and sceVu0RotTransPers are stand-ins that keep every vertex on the screen, so the off-screen ADC is not covered.

The reversed layer: ccBufferReverce

OnMagicAtk's last part keeps a ccBufferReverce (main 0x00106850, MakePacket 0x00106890) drawn on the boss's own layer, Init(1, sysLayer's view): priority 1, over the map and under the characters. It is one sprite over the view (0, 0)-(512, 384), white (0x80ffffff). The blend is (Cs - Cd) * FIX + 0 with FIX 128, so the picture under it comes out inverted. TEST 0x1001 fails every pixel's alpha test into the frame buffer only; no depth test. The port draws it (reverse_packet) at priority 1 while the rules report Out::Reverse.

The camera: ccBossCam

InitBossCamera(z, y) (0x0045e750) news a ccBossCam (0x140 bytes) with PView the boss's pos and transfer (0, y, z, 1), sets bossCamSW, and hands it to the effects (ccIBossEff::cmn_bossCam). Skeith's is InitBossCamera(200, 1000). The constructor (0x00460ca0):

  • tempChar is the player (plw+0x20), MoveTransfer is transfer, MaxRenge 1000, RemitRotMax and RemitRot 1280, LimitRot 1.0, RenXrotFlg and InitLock 1, everything else 0;
  • changeCamera(2): bcam becomes the active camera, of type 3;
  • CamPos is the player's place.

ccBoss::Main runs CamMain (0x0045fbe0) after Move while bossCam and bossCamSW hold:

if not lock:
  CamView = boss pos
  SetTransfer()                         the pad, or a reset easing
  CamPos = player pos; d = ccGetDirc(CamPos, boss pos)
  memDircZ = RAD2DEG(d); deg = RAD2DEG(CamRot.z)
  CamRot.z = CamZRotDeg2Dad(memDircZ, deg)
  t = max(0, (transfer.y + MaxRenge - MoveTransfer.y) / MaxRenge)
  x = Xrot (BasisRot + t LimitRot)      0 for Skeith: Xrot stays 0
  CamPos += Rz(ZrotCont) Rz(CamRot.z) MoveTransfer
  CamView = CamPos + Rz(ZrotCont) Rz(CamRot.z) Rx(x) (0, -1000, 0, 1)
camera 2's pos and view = CamPos, CamView (+ Quakevector when QuakeFlg)
Quakevector = (0, 0, 0, 1); QuakeFlg = 0

So the eye stands MoveTransfer.y behind the player on the line from the boss and 200 up, looking level 1000 ahead: the boss is always in the middle of the picture.

The turn (CamZRotDeg2Dad 0x00460ea0), in 16-bit angles:

  1. The difference is (short)(target - cur).
  2. Past RemitRotMax it is held to it and count goes up.
  3. After 20 such frames it is doubled.
  4. At 113-127 it is +-128 (and count 2); under 112 it is 0 (and count 0).
  5. The heading moves a quarter of it. The first call (InitLock), or a difference of 0, takes the target outright.
  6. Within 128 of the target (as ints, with no wrap) it is the target, count 0 and RemitRotMax back to RemitRot.

The pad (Pad_Control 0x004602a0, from SetTransfer while ResetFlg is 0) moves MoveTransfer.y between transfer.y and transfer.y + MaxRenge by checkCameraDistModValue:

cameraControlTypezoomResetFlg 1 (ease in)ResetFlg 2 (ease out)
0, 1 (A)right stick within pi/4 of angle 0 up to the far end, within pi/4 of pi down to the near end (power 2 or more)R2L2, if not R2
2, 3 (B)R2 up to the far end, R1 down to the near end, the same value bothL1L2

A reset moves a quarter of what is left each frame and snaps to the end within 8, then ResetFlg goes back to 0.

The quake. if (bossCam) bossCam->QuakeCam((35, 35, 35, 1)) in the wave's attack and the Epitaph's wave: Quakevector is three ccRandF(35), which draw from ccRand whether or not the camera still runs.

The dead camera (BeginDeadEffect):

  1. While bossCamSW, camera 2's eye, view and rotation (cameraGetRot(r, 2)) go to camera 1 and changeCamera(1) (as OffBossCamera 0x0045ede0).
  2. bossCamSW = 0.
  3. changeCamera(3): camera 3 at P2W(posP + Rz(dirc.z - pi/2)(2000, 0, 2000)) looking at the boss.

~ccBossCam goes back to camera 1. The boss is deleted only with its task, when the mode changes, so camera 3 holds after the fight.

SetMode, SetFreeCamPosView and SetRotXLimit are other bosses'. Without them ExLock, ZrotControlFlg, Xrot and ZrotCont stay 0, and ResetFlg is never 3 or 4. lock is only cleared (OnThinkRandDrive). Pad_Control reads nothing while ExLock is set, and with ZrotControlFlg (Kyvia's) the stick, or L1 and R1, turns ZrotCont: Kyvia's page, which also has Mutation's CamMain and layout. tools/test_bosscam_rs.py runs on any volume (PINEY_VOLUME), its test_sway with the flag set.

The cinema: ccBossEffCinemaFade

The manager's cinema (+0x00, gcmn 0x0046a7e0) puts black bars over the top and bottom of the picture while a skill runs, with the skill's name in the top one. The boss asks for it with OnCinemaMode(n) and OffCinemaMode: Skeith's magic asks for cinema 2, and its Data Drain for -1 (bars only).

  • The constructor (Clear, Init) makes the cinema's layer (ccLayer::Init(241, sysLayer's view), with the default SetFrame), two ccScFades on it, and a ccMask(128, 0) for the name.
    • CinemaHight is 30 and the bottom bar rests at y 354.
    • NowCinemaData's tops are 30 and -30.
    • tempDat is left as the heap had it.
  • OnCinemaMode(n) (0x004618b0) does nothing while CineMode is 1-3, or while the party is wiped out or a game over forced. Otherwise CinemaOn(n):
    • with 0 <= n < 61 (from Mutation on n < 79: MUT 0x00480648, OUT 0x0047bfd8, QUA 0x0036e8e8) and a file and texture in _g_cinemaSkillName[n] (gcmn 0x005eb040, rows of file, texture, row; the port reads 72, and no call passes 72-78), SetupSkillName gives the mask that texture, sets its transparency to 0 and shows it. (With game+0x24 9-12 the file is x01-x04 instead.)
    • CineMode becomes 2.
    • Row 2 is Skeith's: x11's TEX_ske_skl, row 0 ("Judgement").
  • With a skill (Outbreak on, 0x004733b0): the same checks, then a row by game.field and the skill id (OUT 0x00472550); see boss-fidchell.md.
  • OffCinemaMode calls CinemaOff (CineMode 4) unless CineMode is 0, 4 or 5.
  • Draw (0x0046ad10) runs each frame in ccBossEffManager::Draw, before the boss's task.
    • The name is drawn first while it is shown: cell 0, 256 x 20 texels at (128, 10), wv = row x 320, at the name's transparency.
    • The mode (table 0x006aa950):
      • 0 stops showing the name;
      • 1 holds the bars at rest (top 0, bottom 354) and raises the name's transparency by 1/15 to 1;
      • 2 and 4 draw the bars where tempDat has them and step to 3 and 5;
      • 3 slides them in: NowCinemaData's two tops are each divided by 1.5 a frame (0 once under 1 in size). The bars go at 0 - NowTop and 354 - NowBot. Once both were 0: mode 1, the tops back to 30 and -30.
      • 5 slides them out: the name's transparency falls by 1/15, and the bars go at 0 - (30 - NowTop) and 354 + (30 + NowBot). Then mode 0. From Mutation on (MUT 0x00480ddc, OUT 0x0047c7b4, QUA 0x0036f0c4) the name first fades out by 0.1 a frame while the bars hold where tempDat has them; they slide once it is 0.
    • A bar is ccScFade::EntryFlash(1, 0x80000000, 0, y, 512, 30) (0x00160240): an element from black at alpha 0x80 to the same colour at alpha 0 over one frame, deleted when done. It shows as an opaque black band, drawn by both faders' SendPacket.

The port: piney_world::combat::cinema::Cinema, in BossRun (cinema, cinema_sent).

  • Order. It steps at the start of the boss's frame (the manager's time) and takes Out::Cinema after Main.
  • The name comes from BossLook::names (the rows cinema::takes reads that name the boss's file, looked up when its files load).
  • The outro holds the bars for the name's fade from Mutation on (Cinema::hold_out).
  • The draw. The field draws the cinema on layer 241 with piney_desktop::sprite and fade::draw_rect.
  • tempDat starts at 0, as a fresh heap block has it. So the first cinema's first frame draws both bars at the top.

tools/test_cinema_rs.py checks it (below).

In the port

piney_battle::boss holds the rules:

  • A boss is Boss { def, base: BossBase, systems, output }: what it is (BossDef), ccBoss's members every system shares, its systems (its class's own members, by kind; below) and what its frame shows (Output). Every class is its def and its systems (worklog 556: the per-class enum and trait it dispatched through until then are gone).
  • One runner walks the def's steps (boss::systems): Boss::main its order, Boss::affect its affect, Boss::effects_pass its pass, Boss::hand_over its hand_over, Boss::show each system's draw over ccBoss::Draw's body. Skeith is systems: his wave (systems::wave, m_anmw) and his own (boss::skeith::Skeith: his effects and fades, m_patMode, m_actDirc); his tables are views of tables::combat (alike on every volume). Fidchell is its wave and its own (its prediction, spells and camera; the volume's tables viewed the same way, worklog 541); Tarvos the same (worklog 542), and Macha (its eyes read through Cx::field as its laser leaves, worklog 545), and Gorre (its brothers, its own and its Kerse, a brother its own system, worklog 546), and Magus (its wave, leaves, laser, needles and own, worklog 547), and Kyvia's four fights (its core and the core's gomoras lent, its disc, the fourth fight's places, its own; the core and a gomora each its own system, worklog 553, Kyvia), and Innis (its wave, missiles' pass, images and own, worklog 554, Innis), and Corbenik's three forms, each its own with its parts lent, the first's hand-over its own (worklog 555, Corbenik).
  • Every boss class derives from ccBoss itself, none from ccBoss01 (Infection's DWARF, which carries boss04-08 and Kyvia's classes too): Skeith's code is his alone (boss::skeith, his constructor skeith::new). A class with no Affect of its own runs ccBoss::Affect as its vtable does (Kyvia's bodies, Corbenik's eyes and roots, a bare slave; MUT's __vt__13ccBossKyvia01 +0x24 is ccBoss::Affect); Gorre's is empty. Gorre's ExecPatternIndex falls back on ccBoss's through its own vtable.
  • ccBoss::ExecPatternIndex and ChangeNextPattern call back into the class (its ChangeAction, ExecPatternIndex, ExecPattern, CheckEpitaph, its table): the Patterns trait (systems::patterns), one generic base_exec_pattern_index and base_change_next_pattern. BaseActs holds where the classes' copies parted: two vectors' w lanes. A word no class knows lets the neutral go (forbid 1) on every volume (INF gcmn 0x0045d10c, OUT 0x0046e384, QUA 0x00360c94); Fidchell, Macha and Tarvos fall back on it (OUT 0x004a4664, QUA 0x003a4228, 0x003a8db0), where the port held it (3) until worklog 536.
  • An effect whose Draw its class runs carries its rules in Eff.fx (enum Fx, made by BossBase::make_fx). Each class's ccBossEffManager::Draw pass is BossBase::effect_pass, its PassMode whether the Draw's answer sets m_bEnabled or only clears it. On the effect side BossEffects::sync mirrors those effects' pictures (the Mirrored trait) from one Source, in the frame's order.
  • A boss's parts (Kyvia's core and gomoras, Magus's leaves, Gorre's brothers, Corbenik's seeds, roots and eyes) are bosses of their own characters, each a def whose one system is its own. The master's frame takes them out as Part<T> (Parts<T> where it indexes them: the part's own off its boss's list) and puts them back after.
  • ccBoss::Main is building blocks on BossBase (systems::frame: prologue, tick_stop, lock_party, move_, forward_and_draw), which a def's steps name in its class's order (Step::Prologue, ..., Step::Live for what runs while exit is clear; Step::Draw the body's Draw alone after a class's own PreDrawAnm, Tarvos's). A bare ccBoss (BASE_BOSS) runs them alone; a part's Main its master runs (written out from the blocks where it is ccBoss::Main with its own Think: Innis's images, Corbenik's roots). Every class's tables are views of the volume's tables::combat, and Patterns::words reads its table by the volume; actAnmTbl is a static slice of them.
  • Foe.boss carries the boss's state.
  • AffectFunc::Boss sends an affect on the boss to boss::entry synchronously, as bossAffectFunc does. The Cx a frame needs comes from AffectCtx.boss.
  • What the rules ask of the rest of the game is returned as Out:
    • sounds, flashes and hit marks;
    • effects made, with their slot;
    • the menu's bar, cursor and stream menu, and the cinema;
    • the arena's layer, the stage effect and the reversed layer;
    • the dead camera, skill requests, ccDeleteCmnd.

piney_data::anim::forward_clip is _AnimateForward over a clip's frame count. Skeith's ccAnms use it with the lengths of x11's and xeffect's clips.

In the field (piney_world::combat::boss):

  1. An event's entry 7 code makes the boss at the entry control's set-up (World::start_boss(code), Combat::start_boss): the code's def (BossDef::of) makes it from its bossTbl row (code 0 Skeith, 1 Innis, 2 Magus, 3 Fidchell, 4 Gorre, 5 Macha, 6 Tarvos, 7 Corbenik, 12-15 Kyvia's fights), its centre the arena's DMY_center01. Other codes start nothing.
  2. ccBoss01::Main runs each frame after the entry control, the task order's 66.
  3. It draws as an actor of x11's CMP_trall at the boss's clip and frame, heading and setTransparency. The frame is the one PreDrawAnm's step posed (Anm.posed), and the after-images and the wave take theirs the same way.
  4. The boss joins the enemies Kite and the HUD target.
  5. Affects from Kite's and the members' frames, whose contexts carry no BossEnv, are queued on the boss and applied first in its task, the same frame, with the fight's ccRand (BossEnv::cc: Tarvos's Affect draws it). Those from outside the frame (the menus, the scripts, a member's item: Combat::entry_affect_with) run its Affect at once, as EntryAffect calls bossAffectFunc (QUA gcmn 0x0047f2e0), with the globals the caller left (Combat::env). The drain's 21 must: DataDrainMenu reads base->id right after it, and Tarvos's SetDefMode(2) there is what makes it 6 (issue #79).
  6. The boss's own CalcReal(0) (Boss::calc_real, every class's Main and every part's) names what it raises by the boss's index: the protect's return (effProtect(this, 1, kind), kind 2 when the row's id is not 0) and its SetProtect, and the condition effect. Until worklog 410 these named "me", which the field could not place: no boss's protect showed its return. The ticks it enters on itself (EntryAffect(this, this, 9 | 3 | 10 | 4)) are queued as in 5, and so run at the start of the next task, not inside CalcReal.
  7. Outputs:
    • Out::Skill runs the skill through Combat::item_skill;
    • hit marks and damage numbers go to the effects as rule events, once each: those of the boss's blows on the party (ccBossSkillDamage's EntryAffect) as well (until worklog 370 they were shown twice, the copy a line under the first);
    • sounds, scFadeDef flashes and SwitchLayer go to the area mode;
    • the menu locks go to ccMenu's forbid and cursor;
    • the member drain opens menu 74 (StreamMenu);
    • the body hit goes on the collision list;
    • the stage fader, the after-images and the wave are drawn. Each after-image's ccBossAfterImageEx::Draw (MUT gcmn 0x00471320) moves maxFrame down to 0, colorAlpha by colorSpd within 0-100 and the transparency by transSpd (dead at 0 or 1, drawn that once more), and the scale by (es - ss) / scaleTime (VU0 vectors, a lane held at es's once larger in size), then draws at SetMatrix_PosRotZYXScale(pos, dirc, scale). The wave's ccAnm is placed by its owner's setter: SetMatrix_PosRotZYX for the base and most bosses, SetMatrix_PosRotXYZ for Kyvia's core, SetMatrix_PosRotZYXScale at twice the size for Macha's own wave, the unit matrix moved for Corbenik's ccBossEffWave;
    • the dead effect's ccSqFade goes to the music (its cameras, the quake and the shake are written at the rules' call);
    • the effects are made and drawn ("The effects' pictures"), the cross's trail and the reversed layer drawn;
    • the cinema (above) and the blur (above) are drawn; no script of this volume holds the boss (hold 7).
  8. The boss camera (piney_battle::boss::cam::BossCam) is the boss's (ccBoss +0x14c, BossBase::cam, with bossCamSW +0x150 its cam_sw): made by its constructor on the camera list's camera 2 (InitBossCamera) and run by its Main (Step::CamMain, after the move or the class's lock), with camera.cpp lent to the task and its affects (BossEnv::cams: the list, the shake, the scheme).
  9. The area host answers present/absent 7 from the task's exit.

Defs and requests (worklog 537). A boss is a def, piney_battle::boss::defs (BossDef): its class (BossGameClass), its file and body, the clumps its images and parts draw with, which body an Epitaph's clips move, its hit's radius and its constructor (which makes its camera, InitBossCamera(z, y), at the game's point: BossBase::init_boss_camera). Every def is BASE_BOSS (a part's BASE_PART) with its differences; defs::BOSSES is bossFunc, a def a code, and Corbenik's later forms and every part have theirs. Each def is a static and not Copy, so a def is its address: boss.def == &defs::TARVOS holds from any crate (worklog 544). The field reads a boss only through its def and what it asks, the same for every boss:

  • Out, the frame's calls in order: sounds, flashes, effects made, pictures beside the bodies (Out::Picture: an object or a clip of its file or xeffect, at a place, a matrix or a node of the body as last drawn, at the body's setTransparency unless its own), after-images (AfterImagePart of a part drawn with its body), counts over a character or a place, a clip on a layer of its own (AnmText), a voice line, an omni light, a body's fog, the arena's clump; and Out::Fx(FxCall), what its effects module in piney-effect makes beside the effects it keeps (one Effects::boss_call).
  • Output, written after its frame (Boss::show) for it and each part: where ccBoss::Draw puts the body and whether, a PreDrawAnm matrix and a clip drawn again, its parts, the images it keeps (Innis's slaves), the shard clumps drawn, the objects its draw hides, the wave's pose, its sword trail (a row at two dummies under a node), the places its effects' generators follow and the bursts drawn.
  • What it reads of the field comes through Cx::field (boss::Field): the collision list, the land's lines, a node of a body as last drawn (Magus's leaves, Macha's eyes), a clip's entries posed on it (Magus's laser's shocks) and a character's heading.
  • Boss::hand_over is the task's step after Main: Corbenik's first form exiting makes the second (ccThBoss08, QUA gcmn 0x003acaf8) on the same character, its seeds asked off the field (Out::PartRemoved), and Out::Remade has the field make its hit, parts and camera anew from the new def.

Systems (worklog 540). A def names its systems (BossDef::systems, each a systems::Kind) and the steps of its frame in the game's order (BossDef::order, affect, pass, hand_over, each a list of systems::Step): ccBoss::Main's blocks on the shared members, a system's own step (Step::Run(kind, hook): Think, Action, PreDraw, Late, Affect, ...), and Step::Live for the steps ccBoss::Main's early return guards. A system (systems::System, one match over the kinds) holds its class's members as its constructor starts them, steps on the shared members and its siblings (systems::Others, reached by kind inside the boss's module), and draws into the Output. Skeith's frame:

order:  TickEffects, Live[Prologue, TickStop, Skeith.Think, Skeith.Action,
        LockParty, Move, Skeith.PreDraw, ForwardAndDraw], ClearHold, Skeith.Late
affect: Skeith.Affect
draw:   ccBoss::Draw's body, Wave (its pose), Skeith (the cross's trail)

Tests and probes read a system's state by its kind (Systems::get::<T>()); the field never does.

tools/test_bosscam_rs.py builds the game's ccBossCam in eemu over the field's camera and player tasks. Each frame it runs CamMain with the boss moving, now and then after a QuakeCam, over the four control schemes and random pads, then OffBossCamera. It compares the camera's fields, the cameras and the view matrix with the port's.

tools/test_cinema_rs.py builds the game's ccBossEffCinemaFade in eemu by its constructor, with a manager holding it. It turns the cinema on (numbers 2, -1, 0, 5, 64 and 70) and off at random frames over eight runs of 300-600 frames, and runs Draw every frame against cinema_probe, on each volume's own table (cinema_probe VOLUME). It compares every frame's name (transparency bits, wv; the cell, place and size constant), each bar's EntryFlash (y bits; frames, colour, x, width and height constant), and which ons set a name (SetTex's file and texture as the volume's row gives them). It passes on all four volumes.

tools/test_battle_boss_rs.py runs the game's ccBoss01 in eemu against the port frame by frame over random cases. A case is:

  • a party of one to three;
  • Kite's hits and gauge;
  • the drain, and hits enough to kill after it;
  • menus opening.

It compares the acts, patterns, waits, movement, target, HP, gauge, flags, both animations, the effects, the party's hold, the calls, the menu state, and both random generators. Its effects are stand-ins with the port's lives. test_effect_lives runs each real Create and Draw and checks those lives against them.

The blur

ccBossBlur is part of the effect manager (its +4 to +0x34), so every boss fight has one. Each frame, after the manager's effects, ccBossBlur::Main (gcmn 0x00461200) runs and draws a ccBufferSampling feedback of the last frame on the manager's own layer (ccLayer::Init(200, sysLayer's view)).

The members, from the blur (the manager's own offsets 4 more):

+0x00 +0x04  the layer          +0x08  the ccBufferSampling
+0x0c scale   +0x10 its start   +0x14 turn   +0x18 its start
+0x1c colour (SetReflex)        +0x20 a copy nothing reads
+0x24 enabled                   +0x28 m_exit   +0x2c the callback

The manager's constructor (0x004614b0) sets scale 1.01, turn 0, colour 0x40808080, disabled and no callback. It never writes m_exit.

Main:

  • With m_exit not 0, nothing more.
  • Enabled with a callback: the callback sets the scale, turn and colour.
  • Disabled: the scale eases to 1.0 by a thirtieth of its start's gap a frame, held at 1.0 when it passes. The turn eases to 0 the same way. When both have arrived, m_exit 1. From a turn of 0 the turn never arrives, so it never exits.
  • Then SetReflex(scale, turn, colour) and MakePacket(layer).

The bosses only write it, through ccBoss +0x148 (no boss code reads it but ccBossKyvia01's unreachable second stage and Quarantine's ccBoss06):

bossconstructorlater
Skeith (ccBoss01)enabled, m_exit 0, ccBoss03BlurParamCB (0x0047bc40)
Innis (ccBoss02)enabled, m_exit 0, DefaultARGB, scale 1.01, turn 0.02colour ExARGB or DefaultARGB by act
Magus (ccBoss03)enabled, m_exit 0, 0x48808080, scale 1.01the rise's 0x60808080, a leaf's fire back to 0x48808080
Fidchell (ccBoss04)as Skeith's (OUT 0x004a3afc)
Gorre (ccBoss05)nothingnothing
Kyvia 1-4enabled, m_exit 0, scale 1.0, DefaultARGBscale and colour by act
ccBoss06, 07, 08_b, 08_cenabled, m_exit 0 (and callbacks)

So the blur is drawn every frame of every fight, except Gorre's and ccBoss08's first form, whose m_exit stays as the heap left it.

While a menu stills the world, the blur keeps drawing. StillOn (INF gcmn 0x00525a80) calls ccLayer::OffFlipExcept (main 0x00108830) on the menu's layer, which keeps the packets of every other layer. It then lets only the noise, still and game layers flip again. So the manager's layer keeps its last ccBufferSampling packet, which samples each new frame over the still scene, and the cinema's name stays at its last transparency (worklog 460).

ccBoss03BlurParamCB (INF 0x004610e0, OUT 0x00472b90): blurRad plus pi/30, less 2 pi past pi. Scale 1 + 0.01 sin, turn pi sin / 1800, colour 0x48808080. blurRad is a function static, never reset by a fight. Infection's and Mutation's set it 0 at their first call (init); Outbreak's and Quarantine's start from the .bss's 0. It runs on from one fight to the next until power-off.

m_exit under Gorre. The manager is operator new(0x1038), 0x1050 bytes from the lowest hole that fits (heap.md). In event 218 that hole is always the one stream 64's cutscene leaves: a skinned model's mesh that Decode_Mmat02 decoded there, freed as the cutscene ends. So m_exit is that mesh's word at the manager's +0x2c. Where in the hole the manager lands follows from every handout since power-on (the wait at the title, the weapons, the party), and of the hole's words 465 in 13,244 are 0. heap.md has the sequence, the histories and their words: most leave a word that is not 0, and two (the same save, the same way, other weapons and another frame at the title) leave 0, where the blur shows all fight. The port takes the word of one measured history, 0x0100003f (piney_world::combat::boss::HEAP_EXIT): Gorre's fight shows no blur. Quarantine's ccBoss08 is the same until its second form's constructor writes 0. No code of its first form (ccBoss08 and its ccBoss08Seeds) touches the blur. On the story's way the manager lands in the room town 4's scene leaves:

  • with two members and the save loaded after 900 frames, on a clump object's 0 (the manager's own blur all through the first form);
  • in the other histories measured, on a blit buffer's pixels (no blur).

Straight into field 8 it lands on RAM no game code writes, which is the console's boot residue (heap.md). The port keeps 0 (BOSS08_HEAP_EXIT) for when ccBoss08 is ported.

In the port, piney_battle::boss::blur is ccBossBlur: Blur::new, set (the bosses' writes, Out::Blur), main, and the callback's Statics. piney_world::combat::boss keeps the fight's blur (BossRun::blur) and runs main at the manager's pass, as long as the manager's task runs: past the boss's exit, until the scene ends. The field draws the reflex on layer 200 with piney_desktop::noiz::Sampling::reflex. The session carries the statics from area to area. The effects whose rules the port keeps for Kyvia (meteors, bolts, the magical ball) run in Boss::effects_pass, before main as the manager's Draw runs before the boss's task: what they write to the blur is in that frame's Main (worklog 433).

Checks: every boss harness builds the manager with the game's own constructor over a random m_exit and random statics, runs Main natively each frame and compares the blur, blurRad and the frame's SetReflex with the port's (Skeith, Innis, Magus, Fidchell, Gorre and both Kyvia fights, 60 cases each or more). test_blur_main runs Main on 200 blurs in any state on all four volumes. session::tests::blur::every_fight_shows_its_blur plays each fight and finds the strip drawn every frame its reflex is (worklog 432).

Not described yet

  • hold 7, the event instruction that holds the boss while eventMng.bossTscb+0x14 is not 0: no script of this volume uses it.
  • What the heap leaves in the cinema's tempDat before its first slide.
  • test_battle_boss_rs.py's effects are stand-ins with the port's lives, and they draw nothing from rand. In the field the real effects and their particle generators draw from the battle's rand, as the game's do, but no test runs the rules and the effects together against the game.
  • ccEffSamonRing::SetModel (MUT 0x00477c20) is ported whole (piney_effect::boss::ring_model, Innis); the manager's draw compares the clump's palette swap since worklog 411.

How this was found out

docs/engine/boss.md