1#ifndef ALCHEMY_UNIT_BATTLE_BATTLE_H
2#define ALCHEMY_UNIT_BATTLE_BATTLE_H
64#define PUSH_MESSAGE(message) BattleEvPush(BATTLE_EVENT_MESSAGE, (message))
67#define DEFINE_ADJUST_CAMERA(name) \
69 struct BattleCamera *cam = WORK_SLOT(HEAP_SLOT_CAMERA); \
70 struct BattlePresentationTransition *trans = \
71 WORK_SLOT(HEAP_SLOT_BATTLE_BACKGROUND); \
73 if ((gKeysHeld & KEY_L) != 0) { \
76 if ((gKeysHeld & KEY_R) != 0) { \
79 if (trans->flag == 0) { \
80 BattleCamera_SetRange(0x780000, 0x780000, 0, 0, 0x10000); \
157 s32 initialVelocityY);
s32 BattlePres_RunUnitAction(struct BattleActionRecord *action)
Auto battle: an attack or an item.
void BattlePres_AdjustCameraByShoulderKeys(void)
Turns the camera while L or R is held. Nothing in the source calls it.
void BattleMotion_SetMode5AndActivateSlot(s32 unitId)
For a unit whose HP has run out: plays its falling animation to the last frame and marks its object f...
s32 BattleObject_IsValidId(u32 unitId)
Returns 0 for a party member's or an enemy's unit id, -1 for any other.
s32 BattlePres_RunApproachAction(struct BattleActionRecord *input)
Auto battle: an attack.
s32 BattleTarget_ReplaceDefeated(const struct BattleActionRecord *action)
Returns the action's target, or a random living unit of its side when the target is down; TARGET_SIDE...
s32 BattleEscape_PlayRun(struct BattleActionRecord *action)
Auto battle: the party tries to run, and gets away 15 times in 16, each living member running off in ...
void BattlePresentation_ApplyUnitDamage(u32 unitId, s32 damage, s32 showMessage, u8 *context)
Auto battle: deals damage HP to unit unitId and shows it.
s32 BattlePres_ShowDefendMessage(const struct BattleActionRecord *action)
Auto battle: shows that a standing unit is defending.
s32 BattlePresentation_BuildSortedUnitEntries(struct BattleActionRecord *entries)
Auto battle: gives every living unit a plain attack and sorts them into turn order.
s32 BattlePres_RunAction(struct BattleActionRecord *action)
Auto battle: plays one action.
s32 BattlePresentation_RunPairedUnitTransition(struct BattleActionRecord *action)
Auto battle: casts Psynergy.
void BattlePresentation_InitializeWorkAndResetState(void)
Allocates the perspective plane's scanline work (heap slot 10) cleared, and sets the background's mod...
void BattlePres_SetOtherActorRecordModes(s32 selectedUnitId)
Makes every unit's sprites semi-transparent but selectedUnitId's, which are left as they are; nothing...
void Runtime_ReleaseHeapBlock10(void)
Frees the perspective plane's scanline work (heap slot 10); called by Battle_RunEncounter as the batt...
void BattlePres_ClearAllActorRecordModes(void)
Returns every unit's sprites to OBJ mode 0; called by BattlePres_SetActorModes when the highlight sto...
void BattlePres_SetActorRecordMode(s32 actorId, s32 mode)
Sets the OBJ mode (1 semi-transparent, 0 normal) of every sprite of a unit's battle object,...
void Graphics_SetBlendControl(void)
Sets REG_BLDCNT to lighten every layer by REG_BLDY; nothing calls it.
void BattlePresentation_InitializeTransitionEntries(struct BattleTransitionEntry *entries)
Sets entries to the identity transform, then stores the first word's old value plus its new one in th...
s32 BattlePres_DivideBy16(s32 value)
Nothing calls it.
void Graphics_FadeAlphaIn(void)
Fades BG2 in over the backdrop in eight frames, its blend weight rising by 2 a frame from 1,...
void Graphics_AdvancePaletteCycle(void)
Lightens the opaque sprites, the highlighted units, by the next step of gBattleFx_HighlightBlendRamp.
void BattlePres_SetupTransitionAtPairMidpoint(s32 firstUnitId, s32 secondUnitId, s32 zoom)
Points the battle camera, through BattlePres_SetupTransitionScene, at the ground between two units' b...
void Graphics_FadeAlphaOut(void)
Fades BG2 out over the backdrop in eight frames, its blend weight falling by 2 a frame from 15,...
void BattleBackground_Load(s32 mode, s32 resourceId, s32 level)
Loads a battle background: its picture into character blocks 2 and 3, its palette into BattleWork....
s32 Runtime_AdjustDebugValueWithButtons(s32 selectedValue)
A debug aid: while Start is held, edits BattleWork.debugValue with the d-pad (1 left and right,...
void BattlePres_SetupTransitionScene(s32 x, s32 depth, s32 y, s32 zoom)
Points the battle camera at (x, depth, y) with a zoom in percent, and lines the perspective plane up ...
void BattlePresentation_ConfigurePaletteFade(s32 mode, s32 unusedResource, s32 fade)
Switches the background's display mode, optionally sets its palette, and rebuilds both its maps.
void BattlePres_SetActorModes(u16 *selectedUnits, s32 mode)
Highlights the units in selectedUnits, a list ended by BATTLE_UNIT_LIST_END, or with mode 0 stops the...
void BattleCamera_SetRange(s32 centerX, s32 centerY, s32 offsetX, s32 offsetY, s32 scale)
Builds the perspective plane's next page for a zoom of scale about centerX and centerY (all 16....
void BattlePresentation_SetPaletteLevel(s32 unused, s32 level)
Copies the background's saved palette to BG palettes 6 to 13, darkened by level (0 for none).
UNUSED void BattlePres_SetupTransitionSceneAtDepth(s32 x, s32 depth, s32 y)
Sets the camera's eye at its stored distance without taking a zoom; nothing in the source calls it.
u32 BattleClass_GetAttackEffect(u32 index)
Returns the effect a class's plain attack shows, 1 for none or out of range.
s32 BattleClass_GetPalette(s32 index)
Returns the class's sprite palette.
u32 BattleClass_GetAttackHop(u32 index)
Returns how high a class hops as it runs up to attack, in pixels; 0 out of range.
s32 BattleClass_IsSmall(s32 index)
Returns 1 for a small class, which takes one enemy sprite slot instead of two and stands closer to it...
s32 BattleClass_GetEffectHeight(s32 index)
Returns the height an effect is drawn at over a class, in pixels, or 0 for its size's default; 0 out ...
s32 BattleClass_GetSprite(s32 index)
Returns the class's battle sprite, row 0's for a class out of range.
s32 Summon_IsEntrySecondaryFlagged(s32 index)
Returns 1 for a class whose blow lands with SE_HEAVY_IMPACT instead of SE_133; 0 out of range.
u32 BattleClass_GetDefeatSoundKind(s32 index)
Returns the class's defeat-sound kind, 0 to 4, or -1 for none; a fallen enemy's sound is SE_146 plus ...
void DebugBattle_ViewMessages(void)
Debug: a message viewer that never returns.
s32 DebugParty_LoadPreset(s32 preset)
Debug: replaces the party with the members of preset number preset.
void DebugBattle_RunMenu(void)
Debug: the battle test menu, which never returns.
s32 BattleParty_ListLivingUnits(s32 sideMask, u16 *unitIds)
Lists the units still standing (HP above 0) on the sides in sideMask (BATTLE_SIDE_PARTY,...
s32 BattleEnemyList(s16 *unitIds)
Lists the enemy units present, ended by BATTLE_UNIT_LIST_END, and returns how many there are (0 when ...
s32 Battle_RunEncounter(s32 enemyGroup)
Fights the battle against the enemy formation enemyGroup, from the opening transition to the end,...
s32 BattleParty_ListActorIds(s32 sideMask, u16 *unitIds)
Lists the units in the battle's unit lists on the sides in sideMask, party first, skipping those remo...
s32 BattleParty_PrepareActiveOwners(u16 *owners)
Lists the party members who fight (the first four of the party, three in a link battle) and marks eac...
s32 BattleActor_ResetRuntimeFields(s32 unitId)
Clears every ailment and stat change of a unit that goes down, recalculates its stats and rebuilds it...
void BattleEv_MarkDisplay(void)
Sets gBattleDisplayWork->marked, which the next message reads, as BATTLE_EVENT_MARK does.
u32 BattleEvPush(u32 opcode, u32 operand)
Queues one battle event (enum BattleEventOpcode) with its operand, and returns the opcode.
u32 BattleEv_DispatchQueued(void)
Plays the queued battle events at once, in order (BattleEvent_Playback plays them over frames instead...
s32 BattleActor_DestroyTemporaryObject(s32 unitId)
Takes an enemy out of the battle at once (one that leaves rather than falls): its HP to 0,...
void BattleEv_GrantDjinnBonus(struct BattleEventState *runtime, u32 operand)
The BATTLE_EVENT_DJINN_BONUS event: grants the Djinn bonus for the rest of the action.
s32 BattlePresentation_WaitForPromptAt(s32 x, s32 y)
Shows the cursor bobbing at (x, y) and waits for one of KEY_ADVANCE.
s32 BattlePresentation_WaitForAdvance(void)
Shows the bobbing arrow at the message window and waits for the player to go on (B,...
s32 BattleMotion_ProjectPosition(s32 unitId, s32 *projected)
Projects unit id's position onto the screen, into projected.
void Camera_InitDefaultTransform(void)
Puts the battle camera at its default view of the battlefield's centre.
void BattleActor_UpdateSpritePriorities(void)
Runs each frame of a battle: advances every unit's status icon, lifts an airborne unit's effect sprit...
void ResetMotionRecordGroup(void *recordGroup)
Detaches the scripts from the four sprite entries of one sprite.
void BattleActor_SpawnObjectsForList(s16 *unitIds, s32 refreshPoses)
Readies the sprites of the units in list: releases those of every place list lacks,...
s32 BattlePres_SetActorModeAndAction(s32 unitId)
Sets unit id's pose to match its state: held (asleep, stunned or unable to move) or down,...
s32 Battle_GetWorkEntryPair(s32 place, struct FixedPointPosition *position)
Writes the battlefield spot of place (its anchor, on the ground) to position.
struct BattleObj * BattleObjGet(s32 unitId)
Returns unitId's battle object, through its place, or null for a unit with no place.
s32 BattleStatusIcon_Cycle(struct BattleObj *battleObject)
Shows a unit's status icons one after another, each for ICON_CYCLE_FRAMES frames, switching at once w...
void ResetBattleObjectRecordGroups(struct MotionObject *object)
Detaches the scripts from every sprite of a battle object.
s32 Camera_ApplyTransformByFlag(void)
Sets up the camera's view for projecting points; under FLAG_CHOOSING_COMMANDS, through the extra tran...
s32 BattleUnit_BuildStatusFlags(s32 unitId, struct BattleObj *battleObject)
Builds the status icon bits of unit id's ailments into its battle object's activeConditions,...
s32 BattleObj_MarkForRelease(s32 unitId)
Frees the enemy sprite slots unitId holds and marks its object for release at the end of the round (B...
void * BattleMotion_DestroyAllSlotObjects(void)
Releases the object of every unit marked by BattleObj_MarkForRelease, leaving its battle object with ...
void * GetMotionRecord(struct MotionObject *object, s32 recordIndex)
Returns sprite recordIndex of an object (0 only, for a single sprite), or null when it has no such sp...
void ReleaseBattleObjectRecords(s32 unitId)
Releases every sprite unitId's object holds and leaves it with none, clearing the battle object's ani...
void BattleParty_CollectUnitList(void)
Fills the battle's two unit lists, each ended by BATTLE_UNIT_LIST_END: the party members in their ord...
void BattleIntro_AnnounceEncounter(s32 enemyCount)
Announces the enemies at the start of a battle, then whether the party strikes first or is caught by ...
s32 BattlePresentation_InitializeTilePattern(void)
Moves the 16 bytes at VRAM 0x06000290 down to 0x06000280 and clears the 20 bytes from 0x0600028c.
void BattlePresentation_UpdateCamera(void)
Runs each frame of a battle.
struct BattleSummonState * BattleSummon_UpdateAvailability(void)
Works out which summons the party can call: one whose Djinn requirement of every element is met by th...
void Party_ReservedNoOp5B14(s32 unused)
Does nothing; Battle_RunEncounter calls it with 1 as the battle is set up.
s32 BattleParty_ReconcileDjinnRecovery(void)
Brings the Djinn recovery list up to date as a battle starts: every Djinni a party member has on stan...
s32 BattleParty_ResetActiveRuntimeFields(void)
Clears every battle-only state of the party members (stat stages and their turns, statuses,...
void BattlePresentation_ClearBg0VerticalOffset(void)
Nothing in the source calls it.
void BattleSummon_ReservedNoOp(void)
Does nothing; nothing in the source calls it.
void BattleObjPut(void)
Readies the sprite of every unit in the battle (releasing those of units that left) and sets each one...
void BattleParty_ListAllUnitsAndSubmit(void)
Readies the sprite of every unit in the battle (releasing those of units that left),...
s32 SummonSlot_RegisterActorSprites(s32 unitId)
Loads an enemy unit's battle sprite into the first free enemy sprite slots (one for a small enemy,...
s32 BattleUnit_LookupWeaponValueByClass(s32 unitId)
Returns the weapon sprite a party member's attack shows for the kind of weapon they have equipped (gB...
s32 BattleUnit_GetWeaponKind(s32 itemId)
Returns the kind of the weapon whose item id is itemId (0 to 5), which picks a party member's attack ...
s32 BattleMotion_ReleaseObjectSlotByValue(s32 unitId)
Frees every enemy sprite slot unit unitId holds, unloading its sprite.
s32 EnemyCheck(s32 classId)
Returns 1 if an enemy of class classId would find room among the enemy sprite slots: one free slot fo...
s32 BattleMotion_GetSlotPalette(s32 id)
Returns the palette of unit id's battle object.
void BattlePresentation_BuildTilemap(void *tilemap)
Builds BG1's flat map of the same picture: rows 0 to 3 0xffff, rows 4 and 5 tile 0x3ff,...
void BattlePres_AdvanceTransitionTimer(void)
Advances the curtain opening by a frame: scrolls BG0 from 32 pixels to 0 over frames 20 to 52,...
void BattlePresentation_UploadTileVariant(void)
Copies one of eight curtain tiles from gBattlePres_TileVariants into CURTAIN_TILE(0),...
void BattlePres_UpdateHBlankScroll(void)
Shows the perspective plane's finished page each frame while the background is in mode 2: its first l...
void Graphics_ClearBg0Vofs(void)
Clears REG_BG0VOFS, so that BG0's scroll applies only above the line the interrupt fires on.
void BattlePres_RunEntryTransition(s32 enemyCount, s32 encounterId)
Opens a battle: the curtain opening, or for the Fusion Dragon the storm on the Venus Lighthouse aerie...
void BattlePres_DrawTransitionRows(void)
Draws a frame of the curtain opening on BG1: over 80 frames a row moves up from row 13 to row 4 and i...
void Graphics_BuildSequentialTileTable(void *tilemap)
Builds the perspective plane's 32 by 32 affine map: tiles 0 to 255 in its first eight rows,...
s32 BattlePres_RunMosaicFadeOut(void)
Fades the screen to black over sixteen frames as every background's mosaic grows, then shows no layer...
s32 BattleCommand_SelectAutomatic(struct BattleActionRecord *request, s32 retry)
Chooses an enemy's action (a party member's is chosen in the menu): one of the eight in its definitio...
s32 Battle_ClearSerialTransferPayload(void)
Clears the link transfer's payload, the signatures included.
s32 BattlePres_WaitSync(void)
In a link battle, shows the "EXEC" signature to the other console and waits up to 30 frames for it to...
s32 LinkBattle_ReceiveParty(void)
Link battle: receives the opponent's party into the enemy units, one member at a time,...
s32 BattlePres_SyncTurn(void)
In a link battle, after each action and after the end of each round, steps both consoles through the ...
s32 BattleParty_AssignMemberSlots(void)
Records, for each party member, the unit id the link opponent knows them by (FIRST_ENEMY_UNIT plus th...
s32 LinkBattle_SendParty(void)
Link battle: sends the party, one member at a time and three places in all (an empty place has side 0...
UNUSED u8 * Text_CopyFiveCharsPaddingUnderscore(u32 unused0, u32 unused1, u16 *source)
Copies four characters of a name and a terminator, an underscore for each missing character,...
void BattleMotion_SpawnSlotEffectAndWait(s32 unitId)
Plays the hit flash on unit id's sprite and waits ten frames.
s32 BattleMotion_ProjectConditionalPosition(s32 unitId, s32 *projected)
Projects the point above unit id onto the screen, into projected: 24 pixels up for a small enemy,...
void BattleMotion_InterpolatePosition(struct BattleObj *startSlot, struct BattleObj *endSlot, s32 progress)
Sends the unit of startSlot leaping progress percent of the way toward the unit of endSlot,...
void BattleMotion_ApplyPairMidpoint(s32 firstId, s32 secondId)
Works out the point halfway between two units, at their move targets where they have one,...
void BattleMotion_SetObjectPosition(struct BattleObj *battleObject)
Sends a unit's object back to its spot. Nothing in the source calls it.
void BattleMotion_ApproachTarget(s32 actorId, s32 targetId, s32 travelDivisor, s32 initialVelocityY)
Sends unit actorId three quarters of the way to unit targetId, arriving in travelDivisor steps,...
void BattleMotion_ResetObjectAtScaledAnchor(s32 unitId)
Sends unitId hopping out to one and a half times its spot's distance from the centre.
s32 BattleUnit_GetEffectHeight(s32 unitId)
Returns the height above unit id where its effects play, 16.16: its class's own (BattleClass_GetEffec...
void BattleMotion_InitializeObject(s32 unitId)
Sends unit id leaping back to 1.3 times its spot's distance from the centre, in pose 5.
s32 BattleMotion_ProjectScaledPosition(s32 unitId, s32 *projected)
Projects the point above unit id where its effects play (its class's height, BattleUnit_GetEffectHeig...
void BattleMotion_ResetSlotObjectMode2(s32 unitId)
Restarts unit id's motion in pose 2. Nothing in the source calls it.
void BattleMotion_ReservedNoOp83B0()
Does nothing; BattleMotion_ApplyPairMidpoint, its only caller, passes it a position and a distance.
void BattleMotion_ApplyVariantMotion(s32 unitId, s32 variant)
Knocks unit id back, by the speed, hop and distance of motion variant (gBattleMotion_Variant*),...
void ObjMotRst(s32 unitId)
Sends unitId back to its spot, landing there, and turns it to face the centre.
void BattleMotion_SetupEscapeObject(s32 unitId)
Sends unitId running off its side of the battlefield, three times as far out as its spot,...
void BattleUnit_RefreshPlacement(void)
Places every unit at the start of a battle: numbers the places (party members 0 up in their order,...
s32 BattlePlacement_ContainsId(s16 *list, s32 place)
Returns 1 if the unit at place is in list.
s32 EnemySlotGet(void)
Returns the id of the first free enemy unit, or -1 when all six are taken.
void BattleObjMake(struct BattleObj *actor, s32 unitId, s32 x, s32 y)
Creates the battle object of unit at (x, y) on the battlefield, in pixels: its sprite (an enemy's fro...
s32 EnemyUpdate(void)
Lays the enemies out again and moves each one's object anchor to its new place.
void Summon_LayoutPositions(u16 *actorIds, s32 count, s32 *xPositions, s32 *zPositions)
Lays out count enemies in a column 80 pixels left of the centre, spaced by their size (38 pixels arou...
void BattlePlacement_GetStepPair(s32 partyPlace, s32 *x, s32 *y)
Reads the battlefield position of party place index from gBattlePlacement_StepPairs,...
s32 BattleCommand_BuildPlan(struct BattleActionRecord *request, struct BattlePlan *plan)
Announces the action and plans its targets and effects.
s32 BattleParty_CountStandbyDjinn(u32 unitId, u8 *counts)
Counts the standby Djinn whose owners fight on unitId's side, from that side's Djinn recovery list.
u32 BattleParty_IsUnitListed(u32 unitId)
Returns one when the unit is in its side's formation.
s32 BattleEventRuntime_SchedulePhase(s32 frames)
Empties the event queue and schedules playback of the events queued next, with no targets to resolve.
s32 BattleEventRuntime_WaitForReady(void)
Waits, a frame at a time, until BattleEvent_Playback has played every target, then removes the callba...
void BattleEventRuntime_Reset(void)
Stops playback and empties the event queue.
void BattleEventRuntime_BeginPhase(s32 cue)
Starts playback of the plan's targets when the effect's blow lands.
void BattleEvent_Playback(void)
Plays the plan's targets one at a time: resolves the next target with BattleTargetExec,...
void Dma_StopAllThenRunHook(void)
Sets DMA3 three times over, stopping it, then calls the IRQ return instruction's word as a routine.
s32 BattlePresentation_BuildActions(struct BattleActionRecord *actions)
Builds the turn's actions and sorts them into turn order: the party's commands, then the link opponen...
void Palette_UpdatePulseBrightness(void)
Pulses BG palette 14's colours: each takes the matching colour of palette 15 brightened by up to twel...
void Palette_CopyBanksWithBrightnessOffset(s32 offset)
Copies BG palette 15 to 14 and 5 to 4, brightened or darkened.
void BattleQueue_SortByPriority(struct BattleActionRecord *entries, s32 count)
Sorts the round's actions into turn order, fastest first, after moving the guarding and grounding Dji...
s32 Battle_GetTaggedSlotValue(s32 taggedPlace)
Returns the unit id at a list place.
s32 BattleEscape_CheckSuccess(void)
Rolls whether the party gets away.
s32 BattlePres_BuildUnitEntries(struct BattleActionRecord *entries)
The party's actions for the round, from the command menu: a member who is asleep, confused,...
void Battle_ReservedNoOp9B2C(void)
Does nothing; Battle_RunEncounter calls it at the start of each round.
void BattleUnit_ResetGuardLevels(void)
Ends every unit's guard (Defend and the like) and recalculates its stats.
void Camera_ConfigureScene(s32 verticalOffset)
Sets the camera up for the fixed view the battle shows while commands are chosen, raised by verticalO...
s32 BattlePresentation_AppendLinkedActions(struct BattleActionRecord *actions, s32 count)
Link battle: exchanges the round's actions with the other console and appends the opponent's after th...
void BattlePres_AdjustCameraByShoulderKeysAlt(void)
Turns the camera while L or R is held (a second copy).
s32 Battle_FindTaggedSlotByValue(u32 unitId)
Returns the list place of unit id, or -1 if it is in neither list: the party's as 0x100 | place,...
s32 BattlePres_BuildOpponentEntries(struct BattleActionRecord *entries)
The enemies' actions for the round, in a shuffled order, each chosen by BattleCommand_SelectAutomatic...
u32 BattleSpoils_RankItem(u32 inventoryEntry)
Ranks an item among the spoils, 0 for none: an indispensable item first, then a rare item,...
void BattleSpoils_Clear(void)
Empties the battle's spoils (BattleWork.spoils) and gGameState.pendingItem.
void Battle_AwardSpoils(void)
Hands out the spoils after a victory: the experience to each party member still standing,...
s32 BattleEnemy_RecordDefeat(s32 unitId, s32 djinnBonus)
Counts a fallen enemy and adds its coins, experience and perhaps its item to the spoils.
void Battle_ReservedNoOp2A08(void)
Does nothing; the debug battle menu (DebugBattle_RunMenu) calls it.
s32 BattlePresentation_DispatchAction(struct BattleActionRecord *request, s32 delay)
Plays one action of the round, after delay frames facing the party: an enemy picks its ability now; t...
s32 BattlePres_RunActorEntries(struct BattlePlan *plan, s32 unused)
Clears the highlights, then applies the action to each target in turn and plays its events; with no t...
s32 BattlePres_RunItem(struct BattlePlan *plan, s32 unused, struct BattleActionRecord *selection)
Plays an item's use: the camera turns to the user's side, the user raises the item and,...
UNUSED s32 BattlePres_RunPlainAttack(struct BattlePlan *input, s32 flags)
Unused.
s32 BattlePres_RunEscape(struct BattlePlan *plan)
Plays a unit's attempt to run.
void BattleMotion_FlashHit(s32 unitId, s32 unused0, s32 unused1)
Flashes unit id as it is hit: puts it in its damage pose and switches its sprites between white and t...
s32 BattlePres_RunPsynergyCast(struct BattlePlan *plan, s32 mode)
Plays Psynergy, a Djinni or an enemy's cast.
s32 BattlePres_BuildTargetList(struct BattlePlan *plan, struct BattleEffectArgument *effect)
Fills an effect command from a plan: its kind and strength, the actor and the targets still standing ...
s32 BattleMotion_SetRecordChildValues(struct MotionObject *object, s32 colorMode)
Draws every sprite of an object in a colour mode (enum SpriteColorMode): colorMode on each sprite's f...
s32 BattlePres_RunAttack(struct BattlePlan *plan, s32 mode)
Plays an attack: the camera turns halfway to the attacker's view, the attacker runs up to its first t...
void BattleActor_RemoveFromLists(s32 unitId)
Takes unit id out of the party's or the enemies' list and out of this round's actions,...
s32 BattlePresentation_RunUnitTransition(struct BattlePlan *plan, s32 mode)
Plays a summon or a full-screen Psynergy.
void BattleMotion_ShowDowned(s32 unitId)
Shows a downed unit: a party member lies down, an enemy keeps its damage pose, turns grey,...
s32 Graphics_ResetVramBlockAndReleaseHeapBlocks(s32 unused)
Ends a star field: clears BG2's tiles in character block 1, frees its blitters, canvas and work,...
s32 BattleFx_InitializeStarField(s32 mode)
Starts a star field of the element mode (0 to 3, enum Element order): sixteen sparks on random rings ...
void BattlePres_RestorePalette(void)
Copies the background's saved palette back undarkened, as the star field of BattleFx_PlayUnitElementE...
void BattleFx_PlayUnitElementEffect(s32 unitId, s32 element, s32 mode, s32 variant)
Plays a glow of the element about a unit, and returns when it is over.
s32 Graphics_ScaleRgb555Clamped(u16 *source, u16 *destination, s32 scale, s32 count)
Copies count colours from source to destination, each channel scaled by scale (16....
u32 BattleFx_UploadStarField(void)
void Runtime_RemoveIrqHandlerSlot2(void)
Removes the VCount interrupt's handler, as BattlePres_RunEntryTransition installs one; nothing calls ...
s32 BattleFx_UpdateStarField(void)
An ability's definition, a row of gBattleAction_DefinitionTable: its targeting, kind,...
A unit's chosen action for the turn: its command, the command's parameter, its target and range,...
The command shared by an effect's caller, dispatcher and handlers.
The battle event queue and the state of its playback: the phase, the event playing and the advance ar...
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
s32 palette
the unit sprite's palette
s32 scale
16.16 fixed point, 0x10000 full size
u16 effect
an effect sprite drawn with the unit
One action, as BattleCommand_BuildPlan lays it out for BattleTargetExec to apply target by target.
The party's Djinn recovery table as summons read it: the mask of summons the party can call,...
What BattlePresentation_InitializeTransitionEntries treats as an array of these; Transform_SetIdentit...
A position in three coordinates, each in 16.16 fixed point.
An effect object that moves and draws one sprite: its position, scale, velocity and target,...
s32 BattleEffectDeadCheck(s32 effect)
Returns 1 for an effect that still applies when the ability's damage has just knocked its target out:...
s32 BattleTargetExec(struct BattlePlan *plan, s32 slot)
Applies the planned ability to one of its targets: first its damage or healing, then its added effect...
u32 Ability_IsPsynergy(s32 abilityId)
Returns 1 for an ability that costs PP, and for Psy Drain, which costs none.
s32 BattleTarget_SelectForAction(s32 actorId, struct BattleAct *action)
Picks the target of an enemy's ability (or a confused unit's), as a place code: among the units of th...
s32 BattleTarget_SelectRandomPosition(s32 requireLivingUnit)
Picks a random place: with requireLivingUnit, a party member still standing; otherwise any enemy plac...
s32 BattleUnit_TickStun(s32 unitId)
Counts down stun, which may end early at bias 40; Battle_ProcessRoundEnd shows MsgCureStun when it re...
s32 Battle_ProcessRoundEnd(void)
Ends a round: sets recovered Djinn, then gives each unit its regeneration and counts down its stat ch...
s32 BattleUnit_ProcessTurnEnd(struct BattlePlan *plan)
Ends one unit's turn: its Djinn on standby are taken off its set, the Djinn a summon used begin to re...
s32 BattleUnit_RollCounterEarlyEnd(s32 unitId, s32 turns, s32 bias)
Rolls whether a stat change or status with five turns or fewer left ends early.
s32 BattleUnit_TickReflect(s32 unitId)
Counts down Reflect and returns 1 when it runs out; it never ends early.
s32 BattleUnit_TickResistanceModifier(s32 unitId)
Counts down a Resistance change; Battle_ProcessRoundEnd shows MsgResNormal when it returns 1.
s32 BattleUnit_TickSleep(s32 unitId)
Counts down sleep, which may end early at bias 50; Battle_ProcessRoundEnd shows MsgWakes when it retu...
s32 BattleUnit_TickDelusion(s32 unitId)
Counts down delusion, which may end early at bias 30; Battle_ProcessRoundEnd shows MsgCureDelusion wh...
s32 BattleUnit_TickRefrain(s32 unitId)
Counts down BattleUnit.refrain and returns 1 when it runs out; it never ends early.
s32 BattleUnit_TickDefenseModifier(s32 unitId)
Counts down a Defense change; Battle_ProcessRoundEnd shows MsgDefNormal when it returns 1.
s32 DjinnRecovery_Tick(void)
Brings the party's recovering Djinn one turn nearer, setting each whose turns reach 0,...
s32 Battle_AdvanceCounterAndCheckChance(s32 unitId)
Counts down both seals packed in BattleUnit.psySeal and returns 1 when the last ends.
s32 DjinnRecovery_TickTwenty(void)
Runs DjinnRecovery_Tick twenty times, which sets every recovering Djinni of a party member with HP.
s32 BattleUnit_TickAgilityModifier(s32 unitId)
Counts down an Agility change, clearing agilityStage and returning 1 when it runs out; unlike the oth...
s32 BattleUnit_TickCharm(s32 unitId)
Counts down charm, which may end early at bias 70; Battle_ProcessRoundEnd shows MsgConscious2 when it...
s32 BattleUnit_TickAttackModifier(s32 unitId)
Counts down an Attack change and returns 1 when it ends.
s32 BattleUnit_TickConfusion(s32 unitId)
Counts down confusion, which may end early at bias 60; Battle_ProcessRoundEnd shows MsgConscious when...
void Battle_ReservedNoOpF674(void)
Does nothing; Battle_RunEncounter calls it at the end of each round and of the battle.
The integer types, TRUE, UNUSED and the fixed-address macros.