Func_* labeling: name 6 duel/engine functions via the dynamic call graph

Used cg.txt (a duel play-through's deduped dynamic graph) + static callees
+ tcg1 as a semantic reference to name a confident batch:

  Func_6fa5   -> TakePrizesForKnockedOutPokemon  (CountKnockedOutPokemon + TurnDuelistTakePrizes)
  Func_6986   -> TriggerPlayedEnergyCardEffect    (played card's PKMN_POWER_TRIGGER effect)
  Func_1bb4   -> RedrawDuelSceneAndPrintFailedEffect (HandleConfusionDamageToSelf)
  Func_12c36a -> AdvanceToNextSpriteAnimFrame      (inc frame index + GetFramesetData)
  Func_fc094  -> ExecuteNextSFXCommand             (tcg1 exact match)
  Func_fc094_2-> ExecuteNextSFX2Command            (bank-$7f SFX2 copy)

make compare: poketcg2.gbc OK (symbol-only, byte-identical).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test User
2026-06-06 18:21:12 -04:00
parent 2a85762a68
commit c299256899
7 changed files with 47 additions and 34 deletions

View File

@@ -57,8 +57,16 @@ Renames are **byte-neutral** (`make compare` must stay OK after every batch).
| `Func_3a81` | `00:3a81` | `FrameFunc_AnimationQueue` | per-frame update during queued screen anims (gated on wActiveScreenAnim) | 2026-06-06 |
| `Func_110b9` | `04:50b9` | `SetAnimationQueueFrameFunc` | pushes FrameFunc_AnimationQueue; caller ResetAnimationQueue | 2026-06-06 |
| `Func_110c2` | `04:50c2` | `UnsetAnimationQueueFrameFunc` | pops it; caller FinishQueuedAnimations | 2026-06-06 |
| `Func_6fa5` | `01:6fa5` | `TakePrizesForKnockedOutPokemon` | body: CountKnockedOutPokemon + TurnDuelistTakePrizes + "Took all the Prizes"; caller HandleBetweenTurnKnockOuts | 2026-06-06 |
| `Func_6986` | `01:6986` | `TriggerPlayedEnergyCardEffect` | runs played card's PKMN_POWER_TRIGGER effect; callers PlayEnergyCard / OppAction_PlayEnergyCard | 2026-06-06 |
| `Func_1bb4` | `00:1bb4` | `RedrawDuelSceneAndPrintFailedEffect` | DrawDuelMainScene/HUDs + PrintFailedEffectText; caller HandleConfusionDamageToSelf | 2026-06-06 |
| `Func_12c36a` | `4b:436a` | `AdvanceToNextSpriteAnimFrame` | inc frame index + GetFramesetData; caller DecrementSpriteAnimFrameDuration | 2026-06-06 |
| `Func_fc094` | `7e:40ec` | `ExecuteNextSFXCommand` | tcg1 exact match; SFX command dispatcher | 2026-06-06 |
| `Func_fc094_2` | `7f:40ec` | `ExecuteNextSFX2Command` | bank-$7f SFX2 copy of the above | 2026-06-06 |
## Progress
- 2026-06-06: 13 named. 1,196 remaining. Latest batch (6) used the dynamic call graph
(cg.txt from a duel session) + tcg1 as a semantic reference for the duel-engine funcs.
- 2026-06-06: 7 named (1 tcg1-match + 6 overworld/animation frame-function cluster). 1,202 remaining.
Pilot confirmed the xref workflow: callers + named callees + the frame-func convention
resolve a cluster cleanly and byte-neutrally. The higher-level transition orchestrators

View File

@@ -140,7 +140,7 @@ SFX_Update:
ld a, [hli]
ld h, [hl]
ld l, a
call Func_fc094
call ExecuteNextSFXCommand
.asm_fc08d
inc c
ld a, c
@@ -148,7 +148,7 @@ SFX_Update:
jr nz, .asm_fc06c
ret
Func_fc094:
ExecuteNextSFXCommand:
ld a, [hl]
and $f0
swap a
@@ -186,7 +186,7 @@ SFX_CommandTable:
dw SFX_end
SFX_unused:
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_frequency:
ld d, a
@@ -260,7 +260,7 @@ SFX_envelope:
ld l, a
ld [hl], e
pop hl
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_duty:
swap a
@@ -274,7 +274,7 @@ SFX_duty:
ld l, a
ld [hl], e
pop hl
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_loop:
ld hl, wde43
@@ -291,7 +291,7 @@ SFX_loop:
ld [hl], a
ld l, e
ld h, d
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_endloop:
ld hl, wde3f
@@ -307,10 +307,10 @@ SFX_endloop:
ld h, [hl]
ld l, a
pop de
jp Func_fc094
jp ExecuteNextSFXCommand
.asm_fc162
pop hl
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_pitch_offset:
ld hl, wde2f
@@ -320,7 +320,7 @@ SFX_pitch_offset:
pop hl
ld a, [hli]
ld [de], a
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_wait:
ld a, c
@@ -465,7 +465,7 @@ SFX_wave:
ldh [rAUD3ENA], a
ld b, $0
pop hl
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_pan:
pop hl
@@ -489,13 +489,13 @@ SFX_pan:
ld [hl], a
pop bc
pop hl
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_sweep:
pop hl
ld a, [hli]
ldh [rAUD1SWEEP], a
jp Func_fc094
jp ExecuteNextSFXCommand
SFX_end:
ld e, c

View File

@@ -140,7 +140,7 @@ SFX2_Update:
ld a, [hli]
ld h, [hl]
ld l, a
call Func_fc094_2
call ExecuteNextSFX2Command
.asm_fc08d
inc c
ld a, c
@@ -148,7 +148,7 @@ SFX2_Update:
jr nz, .asm_fc06c
ret
Func_fc094_2:
ExecuteNextSFX2Command:
ld a, [hl]
and $f0
swap a
@@ -186,7 +186,7 @@ SFX2_CommandTable:
dw SFX2_end
SFX2_unused:
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_frequency:
ld d, a
@@ -260,7 +260,7 @@ SFX2_envelope:
ld l, a
ld [hl], e
pop hl
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_duty:
swap a
@@ -274,7 +274,7 @@ SFX2_duty:
ld l, a
ld [hl], e
pop hl
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_loop:
ld hl, wde43
@@ -291,7 +291,7 @@ SFX2_loop:
ld [hl], a
ld l, e
ld h, d
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_endloop:
ld hl, wde3f
@@ -307,10 +307,10 @@ SFX2_endloop:
ld h, [hl]
ld l, a
pop de
jp Func_fc094_2
jp ExecuteNextSFX2Command
.asm_fc162
pop hl
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_pitch_offset:
ld hl, wde2f
@@ -320,7 +320,7 @@ SFX2_pitch_offset:
pop hl
ld a, [hli]
ld [de], a
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_wait:
ld a, c
@@ -465,7 +465,7 @@ SFX2_wave:
ldh [rAUD3ENA], a
ld b, $0
pop hl
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_pan:
pop hl
@@ -489,13 +489,13 @@ SFX2_pan:
ld [hl], a
pop bc
pop hl
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_sweep:
pop hl
ld a, [hli]
ldh [rAUD1SWEEP], a
jp Func_fc094_2
jp ExecuteNextSFX2Command
SFX2_end:
ld e, c

View File

@@ -694,7 +694,7 @@ PlayEnergyCard:
ld a, OPPACTION_PLAY_ENERGY
call SetOppAction_SerialSendDuelData
farcall PrintAttachedEnergyToPokemon
call Func_6986
call TriggerPlayedEnergyCardEffect
jp DuelMainInterface
.rain_dance_active
@@ -6032,7 +6032,7 @@ HandleBetweenTurnKnockOuts:
ret
.Func_6ef6:
call Func_6fa5
call TakePrizesForKnockedOutPokemon
ld hl, wDuelFinishParam
rl [hl]
ret
@@ -6142,7 +6142,9 @@ ReplaceKnockedOutPokemon:
ldh [hTempPlayAreaLocation_ff9d], a
jr .replace_pokemon
Func_6fa5:
; has the (swapped-to) turn duelist take prizes for the just-knocked-out Pokemon;
; prints "Took all the Prizes" and returns carry if that claimed their last prize
TakePrizesForKnockedOutPokemon:
call CountKnockedOutPokemon
ret nc
; at least one Pokemon knocked out
@@ -6725,7 +6727,8 @@ LoadNonPokemonCardEffectCommands:
ld [wcd15], a
ret
Func_6986:
; runs the just-played energy card's on-play (PKMN_POWER_TRIGGER) effect command, if it has one
TriggerPlayedEnergyCardEffect:
ldh a, [hTempCardIndex_ff98]
ldh [hDuelActionCardIndex], a
call LoadNonPokemonCardEffectCommands

View File

@@ -583,7 +583,7 @@ OppAction_PlayEnergyCard:
ld a, TRUE
ld [wAlreadyPlayedEnergy], a
bank1call DrawDuelMainScene
bank1call Func_6986
bank1call TriggerPlayedEnergyCardEffect
ret
OppAction_EvolvePokemonCard:

View File

@@ -622,7 +622,7 @@ DecrementSpriteAnimFrameDuration:
ld [wCurSpriteAnimFrameDuration], a
and a
ret nz
call Func_12c36a
call AdvanceToNextSpriteAnimFrame
ret
Func_12c35c:
@@ -633,7 +633,8 @@ Func_12c35c:
ret nz
ld a, -1
ld [wCurSpriteAnimFrameIndex], a
Func_12c36a:
; advance the current sprite animation to its next frame and reload that frame's data
AdvanceToNextSpriteAnimFrame:
ld a, [wCurSpriteAnimFrameIndex]
inc a
ld [wCurSpriteAnimFrameIndex], a

View File

@@ -1458,7 +1458,7 @@ Func_17fb:
ld [wNoDamageOrEffect], a
bank1call ProcessEffectsTriggeredByTakingDamage
bank1call ApplyStatusConditionQueue
call Func_1bb4
call RedrawDuelSceneAndPrintFailedEffect
bank1call UpdateArenaCardLastTurnDamage
bank1call HandleDestinyBondAndBetweenTurnKnockOuts
or a
@@ -1496,7 +1496,7 @@ HandleConfusionDamageToSelf::
pop hl
ld a, l
call DealConfusionDamageToSelf
call Func_1bb4
call RedrawDuelSceneAndPrintFailedEffect
bank1call HandleDestinyBondAndBetweenTurnKnockOuts
bank1call ClearNonTurnTemporaryDuelvars
or a
@@ -2061,7 +2061,8 @@ DealDamageToPlayAreaPokemon_GotPlayAreaLocation::
pop hl
ret
Func_1bb4:
; redraws the duel scene + HUDs and prints the arena Pokemon's "failed effect" text
RedrawDuelSceneAndPrintFailedEffect:
call FinishQueuedAnimations
bank1call DrawDuelMainScene
bank1call DrawDuelHUDs