Skip to Content
The Alchemy Project

include/battle/battle.h

The battle engine's functions as other files call them: the battle module's own, file by file, then the battle effects, the field engine's functions the battle and its effects borrow, and the stub calls into the main image.

Included by battle_internal.h, battle_effect_internal.h, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, script_commands_internal.h, game_internal.h, menu_internal.h, lobby.c, emote_pop_tilted.c, shop_internal.h, window_internal.h and screen_transition.h.

Macros

NameDescription
#defineBATTLE_BACKGROUND_SCROLL_Y 32BG1's vertical scroll that sets the battle background in the battle view.
#defineBATTLE_BG1_SCREEN_BLOCK 31BG1's map in a battle, a screen block: while the battle background lies flat, lines outside its plane read the padded map there; the command row places its icons' tiles in it, and the effects that take BG1 over (the canvas, Ulysses's rune circles) lay their own maps there.
#defineBATTLE_ZOOM_NORMAL 100btCameraSetView's zoom, in percent, for the battle's usual view.
#defineBATTLE_MULTIPLIER_ONE 256The battle's multipliers are 256ths: this one keeps an amount as it is, and gmBattleGetElementMultiplier returns it for no element difference.
#defineHEALING_BASE_POWER 100The element power at which healing is neither stronger nor weaker (gmBattleCalculateRecovery): each point above it counts as two points of element difference.
#definePUSH_MESSAGE (message)Queues a message that waits for the player.
#defineADVANCE_ARROW_PICTURE_BYTES (2 * TILE_SIZE_8BPP)The advance arrow's room in sprite VRAM: one of its pictures (BattleMessageAdvanceArrowTiles), an 8 by 16 sprite of 256 colours.

Enumerations

NameDescription
enumBATTLE_SPR_MODE { SPRITE_OPAQUE, SPRITE_SEMI_TRANSPARENT }A battle unit's sprites' OBJ mode, as btHighlightSetSpriteMode sets it: faded units are semi-transparent, and the battle's blends act on them.
enumBATTLE_ELEMENT_GLOW { GLOW_STAR_FIELD, GLOW_STREAKS, GLOW_PILLAR, GLOW_BURST }The glows btElementGlowPlay plays about a unit in its element.
enumBATTLE_HIGHLIGHT { HIGHLIGHT_OFF, HIGHLIGHT_SELECTED, HIGHLIGHT_PULSE, HIGHLIGH … }btHighlightSetModes's modes: the units listed take one blend and every other unit the other (mode bit 0), and the battle steps the blend each tick (btBackgroundStepHighlightBlend).
enumBATTLE_POSE { POSE_STILL, POSE_STANDING, POSE_LEAP, POSE_CAST, POSE_PARTY_ … }The battle sprites' animations (fdActorSelectAnimation numbers) that the battle code picks by name.

Functions

NameDescription
voidbtDebugBattleRunMenu (void)The battle module's functions in the order of its stub table (src/battle/stubs.s).
Sint32btTransitionRunMosaicFadeOut (void)Fades the screen to black over sixteen ticks as every background's mosaic grows, and leaves every layer off with the backgrounds' controls as they were.
voidbtActorSpawnObjectsForList (Sint16 *list, Sint32 refresh)Readies the sprites of the units in list, ended by BATTLE_UNIT_LIST_END, and destroys every other unit's; with refresh, sets the listed units' poses again.
voidbtBackgroundFadeAlphaOut (void)Fades BG2 out over the backdrop in eight ticks, its blend weight falling by 2 a tick from 15, while the backdrop's stays 16.
voidbtBackgroundFadeAlphaIn (void)Fades BG2 in over the backdrop in eight ticks, its blend weight rising by 2 a tick from 1, while the backdrop's stays 16.
voidbtCameraSetView (Sint32 x, Sint32 depth, Sint32 y, Sint32 zoom)Points the battle camera at (x, depth, y) with a zoom in percent, and lines the zoomed background up with it: where the battlefield's origin falls on the screen moves the plane as much, and the zoom scales the focal length and the far depth.
voidbtCameraSetViewAtPairMidpoint (Sint32 firstUnitId, Sint32 secondUnitId, Sint32 zoom)Points the battle camera at the ground between two units, with a zoom in percent.
voidbtBackgroundSetMode (Sint32 mode, Sint32 backgroundId, Sint32 fade)Switches the battle background's display mode and rebuilds both its maps.
voidbtBackgroundLoad (Sint32 mode, Sint32 resource, Sint32 level)Loads a battle background: its picture decoded into BG VRAM, its palette darkened by level steps of 1/60 (none when level is negative), its tile table and tilemap, and the HBlank scroll the first time.
voidbtBackgroundSetPaletteLevel (Sint32 unused, Sint32 level)Darkens the battle background's palette by level steps of a sixtieth; level 0 restores its saved colours.
Uint32btSpriteGetEffectHeight (Uint32 index)Returns the height a battle effect is drawn at over an enemy, in pixels, or 0 for its size's default; 0 out of range.
Sint32btSpriteHasHeavyImpact (Sint32 index)Returns 1 for an enemy whose blow lands with a heavier impact; 0 out of range.
Uint32btSpriteGetAttackHop (Uint32 index)Returns how high an enemy hops as it runs up to attack, in pixels; 0 out of range.
Sint32btSpriteIsSmall (Sint32 index)Returns 1 for a small enemy, which takes one enemy sprite slot instead of two and stands closer to its neighbours; 0 out of range.
FIXEDbtUnitGetEffectHeight (Sint32 unitId)Returns the height above a unit where its battle effects play, in 16.16 pixels: its BattleSprites row's own, else EFFECT_HEIGHT_SMALL for a small enemy and EFFECT_HEIGHT_LARGE for others.
voidbtMotionApproachTarget (Sint32 actorId, Sint32 targetId, Sint32 travelTicks, Sint32 initVelocityY)Sends one unit leaping three quarters of the way to another, arriving in travelTicks ticks.
voidbtMotionLeapBack (Sint32 unitId)Unused: sends unitId leaping back to 1.3 times its spot's distance from the centre, in POSE_DAMAGE.
voidbtMotionApplyKnockback (Sint32 id, Sint32 variant)Knocks a unit back as the knockback variant (BATTLE_KNOCKBACK) says, in its damage pose; the Fusion Dragon and the Doom Dragon's three forms only take the pose.
Sint32btUnitListIds (Sint32 sideMask, Uint16 *unitIds)Lists the units in the battle on the sides in sideMask, standing or not, and returns how many.
struct BATTLE_OBJECT *btObjectGet (Sint32 objectId)Returns a unit's battle object, through its place in BATTLE_STATE.placement, or null for a unit with no place: the same lookup as btObjectFindSlot, for the other parts of the battle.
Sint32btRun (Sint32 enemyGroup)Fights the battle against the enemy formation enemyGroup, from the opening to the end.
Sint32btMotionProjectPos (Sint32 id, Sint32 *projected)Projects a battle object's position to the screen, in projected.
Sint32btMotionProjectScaledPos (Sint32 unitId, Sint32 *screen)Projects the point above a unit where its battle effects play (btUnitGetEffectHeight) onto the screen, into screen, scaled as its sprite is.
Sint32btMotionProjectCursorPoint (Sint32 unitId, Sint32 *screen)Projects the point above a unit onto the screen, into screen: the target cursor's place, EFFECT_HEIGHT_SMALL up for a small enemy and EFFECT_HEIGHT_LARGE for others, scaled as the sprite is.
Sint32btUnitListLiving (Sint32 sideMask, Uint16 *unitIds)Lists the units still standing on the sides in sideMask, party first, into unitIds when it is not null, and returns how many.
Sint32btPartyPrepareMembers (Uint16 *owners)Lists the party members who fight, three in a link battle, into owners when it is not null, and returns how many.
voidbtCameraSetCommandView (Sint32 verticalOffset)Sets the camera up for the fixed view the battle shows while commands are chosen, raised by verticalOffset pixels.
void *btActorGetSprite (struct MOTION_OBJECT *object, Sint32 recordIndex)Returns sprite recordIndex of an actor (0 only, for a single sprite), or null when it has no such sprite.
voidbtHighlightSetModes (Uint16 *actors, Sint32 mode)Highlights the units in actors (up to UNIT_MAX, ended by BATTLE_UNIT_LIST_END), the others taking the other blend, or with HIGHLIGHT_OFF stops the highlight.
voidbtPlaybackStart (Sint32 sound)Starts playback of the action's targets when the effect's blow lands, with sound as the hit's sound (0 keeps the one set); later calls change nothing.
voidbtColorBufferScale (Uint16 *src, Uint32 dest, Sint32 value, Sint32 size)Writes size BGR555 colours of source to destination scaled by value / 256, at most 1.0: a palette dimmed toward black.
Sint32btDjinnRecoveryCountDown (void)Brings the party's recovering Djinn one turn nearer, setting each that is ready, and returns 1 when any was set.
Sint32btMotionGetSlotPalette (Sint32 id)Returns the palette of a unit's battle object.
Sint32btDjinnRecoverAll (void)Runs btDjinnRecoveryCountDown twenty times, which sets every recovering Djinni of a party member with HP; those on standby stay so.
Sint32btDebugParamSetLoad (Sint32 set)Debug: replaces the party with parameter set number set, each member at its level with its Djinn, abilities and equipped items.
voidbtObjectPut (void)Readies every unit's sprites, destroying those of units no longer in the battle, and sets each unit's pose again.
voidbtObjectDestroySprites (Sint32 unitId)Destroys a unit's sprites, its status icon and shadow with them, leaving its battle object with none.
Sint32btMessageWaitForAdvanceAt (Sint32 x, Sint32 y)Shows the cursor bobbing at (x, y) and waits for the player to go on with A, B, L or R; returns 1.
Sint32btDjinnCountStandby (Uint32 unitId, Uint8 *counts)Counts the standby Djinn on a unit's side, by element into counts.
Sint32btPartyPrepareReserveOwners (Uint16 *owners)Lists the party's reserve members, those past the fourth (none in a link battle), into owners when it is not null, puts each on the party's side and returns how many there are.
Sint32btUnitListLivingIds (Sint32 sideMask, Uint16 *unitIds)As btUnitListIds, listing only the units whose HP is not 0.
voidbtObjectSpawnObjectsForList (Sint16 *unitIds, Sint32 refreshPoses, Sint32 releaseOthers)Readies the sprites of the units in unitIds (ended by BATTLE_UNIT_LIST_END): with releaseOthers, first destroys those of every unit not listed; then creates each listed unit's sprites (body, overlay, status icon and shadow; or the two parts of a two-part enemy) unless it has them, builds its status icons and sets its pose.
voidbtChangeEnemyForm (Sint32 id)Replaces the first enemy with the Doom Dragon's next form: ENEMY_DOOM_DRAGON_E after FORMATION_DOOM_DRAGON_A, else ENEMY_DOOM_DRAGON_H.
voidbtSummonUpdateAvailability (void)Works out which of the summons up to SUMMON_THOR the party can call: those whose Djinn of every element the party holds (djinnHeldCounts, set or not), all members together, and stores them in the party's summon mask beside the ones learned.
voidbtIntroAnnounceEncounter (Sint32 enemyCount)The battle's run and turn: the battle itself, the actions gathered and sorted, the turn's end and the spoils.
voidbtTurnStartNoOperation (void)Called by btRun at the start of every turn; does nothing.
voidbtTurnEndNoOperation (void)Does nothing; btRun calls it at the end of each turn and of the battle.
Sint32btGatherActions (struct BATTLE_ACTION_RECORD *actions)Builds this turn's actions and sorts them by descending priority: the allies' commands and either the link opponent's or the enemies' actions.
Sint32btBuildEnemyActions (struct BATTLE_ACTION_RECORD *entries)The enemies' actions for the turn, in a shuffled order; none act when the party struck first.
Sint32btBuildUnitActions (struct BATTLE_ACTION_RECORD *entries)Builds the party's commands for the turn into entries and returns how many there are, or -1 when none could be chosen.
Sint32btLinkBattleWaitSync (void)In a link battle, shows the "EXEC" signature and waits up to 30 ticks for the other console to show it too.
Sint32btAppendLinkedActions (struct BATTLE_ACTION_RECORD *actions, Sint32 count)Link battle: exchanges the turn's actions with the other console and appends the opponent's, their units and targets seen from this side.
voidbtActionOrderSort (struct BATTLE_ACTION_RECORD *actions, Sint32 count)Sorts the actions by descending priority, after putting the Djinn that shield, guard or defend ahead of the rest.
Sint32btFindUnitPlace (Uint32 id)Returns the list place of a unit, PLACE_PARTY or PLACE_ENEMY with its place, or -1 when it is in neither list.
voidbtUnitResetGuardLevels (void)Ends every unit's guard (Defend and the like) and recalculates its stats.
voidbtUnitProcessActionEnd (BATTLE_PLAN *plan)Ends one unit's action: its Djinn on standby are taken off its set, the Djinn a summon used begin to recover, and the unit takes its summon's power boost, the haunt's damage, poison and the Grim Reaper.
voidbtProcessTurnEnd (void)Ends a turn: counts down the recovering Djinn and sets those recovered, then gives each unit its regeneration and counts down its stat changes and statuses, showing each that ends.
Sint32btDjinnRecoveryCountDownSide (Sint32 side)Counts down one side's Djinn recovery at the turn's end, for owners in the battle.
voidbtUnitDrainDjinn (Sint32 unitId, Sint32 all, Sint32 announce)Djinnfest, Fugue, Djinn Blast, Djinn Storm and Djinn Stun: puts one of the unit's set Djinn at random on standby (every one, when all is set), or, when none is set, drains one that could be set so it must recover.
voidbtSpoilsClear (void)Empties the battle's spoils and the party's pending item.
Sint32btEnemyRecordDefeat (Sint32 unitId, Sint32 earned)Counts a fallen enemy and adds its spoils, The Broken Seal's btEnemyRecordDefeat with the battle state from its heap slot.
voidbtAwardSpoils (void)Hands out the spoils after a victory: experience to each party member still standing, with every level gained, then the coins, then the items best first.
Uint32btUnitIsListed (Uint32 id)The battle's units: who is living, on which side, and where.
Sint32btUnitListLivingWithReserve (Sint32 sideMask, Uint16 *unitIds)As btUnitListLiving, with the reserve members listed after the front line.
voidbtUnitRefreshPlacement (void)Places every unit at the start of a battle and creates its battle object at its spot, the reserve party members too.
Sint32btUnitGetPartyAttackEffect (Sint32 kind)A party member's attack effect, staged by id range (EFFECT_BY_ID_RANGE): ATTACK_EFFECT_SLASH for Isaac, Garet, Felix, Jenna and Piers, ATTACK_EFFECT_WAVE for Ivan, Mia and Sheba, as their BattleSprites rows give, any other none.
Sint32btAbilityApplyToTarget (BATTLE_PLAN *plan, Sint32 slot)Applies the action's ability to one of its targets, slot, in the seven steps of README.md's "How an ability resolves", queueing what playback will show.
Uint32btAbilityIsPsynergy (Sint32 actionId)Returns 1 for abilities that cost PP, and for Psy Drain whatever its cost.
Sint32btAbilityReplaceDefeated (const struct BATTLE_ACTION_RECORD *action)Returns the action's target, or a random living unit of its side when the target is down; TARGET_SIDE_DEFEATED when none is left.
Sint32btActionRunBuild (struct BATTLE_ACTION_RECORD *request, struct BATTLE_PLAN *plan)Announces the action and builds it for its targets, paying its PP or Djinn.
Sint32btAIChooseAction (struct BATTLE_ACTION_RECORD *request, Sint32 retry)Chooses an enemy's action: one of the eight in its definition, picked by its action strategy, with an item instead where its item mask says so, and a target worth the ability.
Sint32btAIChooseRandomTarget (Sint32 party)Picks a random living target on one side: the party (PLACE_PARTY | slot) when party is set, otherwise the enemies (PLACE_ENEMY | slot); 0 when none lives.
Sint32btFleeCheckSuccess (void)Rolls whether the party gets away: 50 percent, 20 more for each failed attempt, and 5 for each level the party's average is above the enemies'.
BoolbtFleePlayRun (struct BATTLE_ACTION_RECORD *action)Auto battle: the party tries to run, and gets away 15 times in 16.
Sint32btEnemyGetFreeUnitId (void)Returns the id of the first free enemy unit, or -1 when all six are taken.
Sint32btEnemyHasSpriteRoom (Sint32 classId)Returns 1 if an enemy of the class would find room among the enemy sprite slots, two side by side for a large one.
Sint32btFormationGetRandomMember (Sint32 formationId)Returns the enemy id of a random member of the formation that may appear.
Sint32btFormationBuildEnemyList (Sint32 formationId)Builds the battle's enemies from a formation and returns how many there are: each member its fewest times and at random up to its most while the sprite slots hold them, laid out as the formation says.
Sint32btEnemyClaimNameLetter (Sint32 classId, Sint32 n)Gives an enemy its name suffix, which tells it from others of its kind: digits abroad and the alphabet in Japanese.
UNREAD_RESULTbtEnemyReleaseNameLetter (Sint32 unitId)Frees a departing enemy's name suffix for the next of its kind.
Sint32btEnemyLetterFirstOfKind (Sint32 classId)Gives the first enemy of the kind on the field the first suffix (0), appended to its name, once a second of its kind arrives.
voidbtPlacementRelayoutEnemies (void)Lays the enemies out again and moves each one's battle object anchor to its new place, skipping the removed places before the first enemy and laying out up to the last one still there.
Sint32btUnitRemoveEnemy (Sint32 unitId)Takes an enemy out of the battle at once, one that leaves rather than falls.
Sint32btSpriteGetSprite (Sint32 index)An enemy kind's battle sprite, palette, attack effect and defeat sound.
Sint32btSpriteGetPalette (Sint32 index)Returns the enemy's sprite palette.
Uint32btSpriteGetAttackEffect (Uint32 index)Returns the battle effect an enemy's plain attack shows, 1 for none or out of range.
Uint32btSpriteGetDefeatSound (Sint32 index)Returns the enemy's defeat-sound kind, 0 to 4, or -1 for none; a fallen enemy's sound is SE_ENEMY_CRY plus it.
Sint32btStagingDispatchAction (struct BATTLE_ACTION_RECORD *action, Sint32 delay)An action's staging, and the battle as Auto Battle plays it.
Sint32btStagingRunAttack (struct BATTLE_PLAN *plan, Sint32 mode)Plays an attack: the attacker runs up to its first target and the blow lands.
Sint32btStagingRunFullScreen (BATTLE_PLAN *plan, Sint32 mode)Plays a summon or a full-screen Psynergy: the unit glows in its element and the other side fades out while the effect plays, then everyone fades back in.
Sint32btStagingRunPsynergyCast (BATTLE_PLAN *plan, Sint32 mode)Plays Psynergy, a Djinni or an enemy's cast.
Sint32btStagingRunItem (BATTLE_PLAN *plan, Sint32 unused, struct BATTLE_ACTION_RECORD *selection)Plays an item's use: the camera turns to the user's side, the user raises the item and, for an item with a battle effect, the battle background dims to two thirds while the effect plays with its messages.
Sint32btStagingRunFlee (BATTLE_PLAN *plan)Plays a unit's attempt to run: the party runs off one by one unless the roll failed ("But there's no escape!"); an enemy gets away 7 times in 10.
voidbtStagingBuildTargetList (BATTLE_PLAN *plan, struct BATTLE_PRESENTATION_STATE *effect)Fills a battle effect command from an action run: its kind and strength, the user and the targets still standing, or all of them for an effect that revives.
Sint32btAutoBattleBuildActions (struct BATTLE_ACTION_RECORD *entries)Auto battle: gives every living unit a plain attack and sorts them into action order.
Sint32btAutoBattleRunAction (struct BATTLE_ACTION_RECORD *action)Auto battle: plays one action, a defeated target replaced by a living unit of its side.
Sint32btAutoBattleShowDefend (Sint16 *action)Auto battle: shows that a standing unit is defending, "<unit> is defending!".
Sint32btAutoBattleRunAttackOrItem (struct BATTLE_ACTION_RECORD *action)Auto battle: an attack or an item, played on the first living unit of the target's side as each element's pillar in turn.
Sint32btAutoBattleRunPsynergy (struct BATTLE_ACTION_RECORD *action)Auto battle: casts Psynergy, the caster's side fading out while its effect plays on the target side.
voidbtPlaybackPush (Uint32 opcode, Uint32 operand)Queues one playback command with its operand.
Uint32btPlaybackRunAll (void)Runs the queued battle events in order, then resets the queue.
voidbtPlaybackRun (void)Plays the action's targets one at a time: resolves each with btAbilityApplyToTarget, then plays what it queued over the ticks that follow, without waiting.
Sint32btPlaybackWaitForReady (void)Waits until playback has played every target, starting it if the effect never showed the damage.
Uint32btPlaybackReset (void)Stops playback and empties the playback queue.
voidbtMessageWaitForAdvance (void)Waits for the player to advance a battle message: once the window has finished printing, shows the bobbing arrow at its corner until B is held, or A, B, L or R is pressed (or held, after 16 ticks), then plays the cursor sound.
voidbtObjectMake (struct BATTLE_OBJECT *battleObject, Sint32 unitId, Sint32 x, Sint32 y)Creates the battle object of a unit at (x, y) on the battlefield: its sprite, palette, size and weapon, turned to face the centre.
Sint32btObjectRemoveFromLists (Sint32 id)Takes unit id out of the battle: off the party's or the enemies' list, its name suffix freed and its actions this turn struck off.
voidbtObjectReleaseSpriteSlots (Sint32 objectId)Frees every enemy sprite slot unit unitId holds, unloading its sprite.
voidbtObjectSetColorMode (struct MOTION_OBJECT *object, Sint32 value)Draws a unit's body in colour mode value on each of its sprites (SPRITE_COLOR_WHITE for a hit's flash, its own palette to end it), and its other layers in their plain colours.
voidbtObjectUpdatePose (Sint32 id)Sets a unit's pose to match its state, held, down or standing, and sets its sway a little out of step with its neighbours': from two steps below normal speed to one above, by its id.
voidbtObjectPutKeepingPoses (void)Readies every unit's sprites, destroying those of units no longer in the battle, and leaves the poses of units that have sprites as they are.
voidbtObjectUpdateSpritePriorities (void)Event, each tick of a battle: advances every unit's status icon, sets its shadow's priority by whether it is airborne, draws the nearer side in front and draws a unit under Haze (DEFEND_VANISHED) as an outline.
voidbtUnitBuildStatusFlags (Sint32 id, struct BATTLE_OBJECT *slot)Builds the status icon bits of unit id's statuses into its battle object's activeStatuses, which btStatusIconCycle shows; a called beast's object (BATTLE_OBJECT.borrowed) keeps its bits.
voidbtStatusIconCycle (struct BATTLE_OBJECT *slot)Shows the unit's status icons in turn, each for ICON_CYCLE_TICKS, and moves on at once when the shown status ends.
voidbtSpriteDetachScripts (void *recordGroup)Detaches the scripts from the four sprite entries of one sprite.
voidbtActorDetachSpriteScripts (struct MOTION_OBJECT *object)Unused: detaches the scripts from every sprite of a unit's actor.
Sint32btObjectMarkForRelease (Sint32 objectId)Frees the enemy sprite slots a unit holds and marks its actor for release at the end of the action.
Sint32btEnemySpriteLoadIntoSlots (Sint32 unit)Loads an enemy's battle sprite into the first free enemy sprite slots: one slot, or two neighbouring ones for a large enemy.
voidbtMotionReturnToSpot (Sint32 slot)Sends unitId back to its spot, landing exactly there (snapToTarget), and turns it to face the centre at once.
voidbtMotionHopBack (Sint32 objectId)Sends unitId hopping out to one and a half times its spot's distance from the centre.
voidbtMotionPlayFall (Sint32 unitId)Unused, as its one caller, btAutoBattleApplyDamage, is: for a unit whose HP has run out, plays its falling effect to the last tick and marks its battle object for release (btObjectMarkForRelease).
voidbtMotionSetupEscapeObject (Sint32 objectId)Sends unitId running off its side of the battlefield, three times as far out as its spot, with a hop, in POSE_STANDING.
voidbtMotionReturnObjectToSpot (struct BATTLE_OBJECT *slot)Unused: sends a unit back to its spot.
voidbtMotionDestroyAllSlotObjects (void)Releases the actor of every battle object marked for release.
voidbtMotionApproachTargetStub (Sint32 actorId, Sint32 targetId, Sint32 travelTicks, Sint32 initVelocityY)
voidbtCameraSetDefaultView (void)The camera, the background and the units' highlight.
voidbtTransitionRun (Sint32 enemyCount, Sint32 kind)Opens the battle against formation formationId with enemyCount enemies: the curtain opening, then the enemies announced (Karst and Agatio's battles wait a second instead); for the Doom Dragon's the shattering opening over the Serpent's stars.
voidbtBackgroundInit (void)Allocates the zoomed background's scanline state.
voidbtBackgroundFree (void)Frees the zoomed background's scanline state.
voidbtBackgroundRestorePalette (void)Copies the background's saved palette back undarkened, as the star field of btElementGlowPlay leaves it dark.
voidbtElementGlowPlay (Sint32 unitId, Sint32 element, Sint32 mode, Sint32 value)Plays a glow of the element about a unit, and returns when it is over: the star field, the streaks, the pillar or the burst.
voidbtHighlightSetModesStub (Uint16 *actors, Sint32 mode)
voidbtEffectNoOperation (void)The battle effects these call by name (battle_effect/).
voidbtEffectRunTargetMotes (struct BATTLE_EFFECT_PARM *effect, Uint32 mode)Around each target in turn, motes (smoke, hearts, orbs) close in on it or rise, and the target flashes.
voidbtEffectRunProjectileVolley (struct BATTLE_EFFECT_PARM *effect, Sint32 mode)Shots fly from the user to each target and burst into a flash and sparks when they pass it.
voidbtEffectRunHealingMotes (struct BATTLE_EFFECT_PARM *effect, Uint32 mode)Motes of light scattered around each target swirl in towards it, one target after another, eight ticks apart; a healing chime sounds as they gather and the target glows.
voidbtEffectRunBurstShower (struct BATTLE_EFFECT_PARM *effect, Uint32 mode)The user fires one shot a tick at a point near one of the targets, taking them in turn, and each target is hit in turn; the blend fades over the last eight ticks.
voidbtEffectRunSparkGroups (struct BATTLE_EFFECT_PARM *effect, Sint32 kind)One to three bursts go off: each flashes, rings itself with smaller flashes that fade, and throws out sparks that bounce on the ground, knocking the targets back.
voidbtEffectRunCanvasBurst (struct BATTLE_EFFECT_PARM *effect, Uint32 mode)A glowing ball, or Shred's glow growing on the target as sixteen rays close on it, hits the target; at the hit the targets flash and recoil, sixteen flames rise and 47 sparks scatter.
voidbtEffectRunStatReduction (struct BATTLE_EFFECT_PARM *effect, Sint32 mode)A dagger (Dull) or a shield (Impair and Weaken) appears over each target and breaks into shards that fly off and fade.
voidfdBattleEffectUpdateArcEffect (void)Each tick: draws the two pairs of swelling arcs on their actor: each pair swells and shrinks over 32 ticks (scale sin(age / 64 turn)) as it rises a pixel a tick, the second arc of a pair upside down, one in front of the actor and one behind.
voidfdPsynergyFrost (void)The field engine's Psynergy, effects and palette fade, which the battle's effects and the field engine's own share.
voidfdPsynergyDouse (void)A rain cloud rises from 16 pixels above the caster to 32 pixels above the destination (80 with childOption, 32 more over a Moai) over GROW_STEPS ticks, growing as it goes, rains drops, and returns.
voidfdPsynergyCyclone (void)Cyclone ("Conjure wind to scatter weeds."): the caster spins in a whirlwind of blue and white drawn on the canvas sprite, and the weeds on the metatiles round it (fdPsynergyGatherNearbyMetatiles) are scattered.
voidfdPsynergyWhirlwindOnTarget (Sint32 unused)Runs Whirlwind cast on a target, using the target already stored in the field effect.
voidfdParticleDraw (struct FIELD_PARTICLE *object)Draws a field particle at its screen position and scale, when it is near the screen: x from -32 to 272 pixels and z from -32 to 224, both exclusive.
voidfdParticleUpdateMotion (struct FIELD_PARTICLE *effect)Moves a field particle toward its target, turning at most turnStepMax a tick when turnStepLimited is set and speeding up by acceleration to speedMax.
voidfdAdvanceWithGravity2D (Sint32 *vector, Sint32 damping, Sint32 gravity)fdAdvanceWithGravity3D for x and y alone: the third word is left as it is, and the velocities follow it.
voidfdAdvanceWithGravity3D (Sint32 *vector, Sint32 damping, Sint32 gravity)Moves a point (three 16.16 coordinates, their velocities after them) by its velocity, then adds gravity to the second velocity and scales each by damping / 64.
voidfdActorSnapToTerrain (void *actor)Sets an actor's y and groundHeight to the map's height at its x and z.
struct ACTOR *fdItemDisplayShowItemInFront (Sint32 actor, Sint32 item)Shows the picture of item 16 pixels above actor actorId, or for the leader at the centre of the metatile 16 pixels in front of them: it rises a little and hangs there, sparkling.
voidfdPaletteFadeBuild (Uint32 mode, Uint16 *src, Uint16 *dest, Sint32 half)Builds colours for the palette fade from the palette src into dest, which holds each colour as B, G and R channels, each where RGB555 keeps blue. mode below PALETTE_TINT_FROM_SOURCE is one colour for all; PALETTE_TINT_FROM_SOURCE the backdrop colour; the other PALETTE_TINT_* values tint each colour; any other value is the address of a ready buffer to copy. half is the palette selection: PALETTES_ALL for every colour, PALETTES_BG for the BG's, PALETTES_OBJECTS for the OBJ's.
voidfdPaletteFadeUpdate (void)Each tick (unless FLAG_PALETTE_BLEND_HELD is set): moves the palette fade one step toward its target, packs it into RGB555 and queues it for the BG and OBJ palettes.
struct ACTION_DESCRIPTOR *fdFindActorPlacement (Sint32 id)The scene's cues and encounters, as field Psynergy and the battle's start read them.
Sint32fdSelectPsynergyTarget (Sint32 kind)Chooses what a Psynergy of the given kind acts on, for fdFindPsynergyCue: among the scene's Psynergy cues for that kind whose condition holds (and whose direction, if any, the leader faces), the metatile the leader faces, or for Teleport the metatile under it; else the nearest target in reach (with PSYNERGY_TARGET_ACTOR); else PSYNERGY_TARGET_ANYWHERE for a cue that applies anywhere, or -1.
struct CUE *fdFindPsynergyCue (Sint32 filter, Sint32 kind, Sint32 selector)Psynergy kind whose condition holds, whose facing (when it has one) the leader faces, whose stage matches filter (PSYNERGY_CUE_ANY takes any) and whose target is what selector names (fdSelectPsynergyTarget: a metatile, an actor, or anything); NULL when there is none.
Sint32fdMeasurePsynergyReach (Sint32 kind, Sint32 selfId, Sint32 otherId)How far actor otherId stands from actor selfId, in pixels over the ground, when it lies within the reach of field Psynergy kind in front of selfId; -1 when it does not.
Sint32fdEncounterResolveWorldMapZoneAndBackdrop (void *pos)Returns the World Map encounter zone for the ground at position (0 for none), and chooses the battle background for its battle environment (MainRoutineStateWork.battleBg).
Sint32gmBattleGetElementMultiplier (Sint32 selector, Sint32 mode)The game logic: units, Djinn, flags and elements.
Sint32gmEnemyGetAttackElement (UNIT *unit)Returns the element an enemy attacks with, from its element preset; an id past the table's end reads the first preset.
voidgmUnitCalculateStub (Sint32 unitId)Works a unit's stats out again from its base stats, equipment, set Djinn, class and battle stat levels, keeping its HP and PP at the same fraction.
voidgmUnitSetHpStub (UNIT *unit, Sint32 hp)Sets the unit's HP, kept between 0 and its maximum, and updates its gauges.
Sint32gmPartyCountMembersStub (void)
Sint32gmDjinnSetStub (Sint32 unitId, Sint32 element, Sint32 index)
struct DJINN_RECOVERY_TABLE *gmDjinnGetRecoveryTableStub (Sint32 owner)
Sint32gmDjinnRecoveryRemoveStub (Sint32 unitId, Sint32 element, Sint32 index)
voidfdActorSetPosAndResetMotionStub (struct ACTOR *actor, Sint32 x, Sint32 y, Sint32 z)The main image's actors, sprites and windows.
voidfdActorSetAnimationSpeedStub (struct ACTOR *actor, Sint32 value)Sets the timer step of every sprite of an actor (16 is normal speed).
voidfdActorReleaseStub (struct ACTOR *actor)
voidfdRenderApplyProjectedPlacementStub (SPR *sprite, Sint32 *pos, Sint32 *scale, Sint32 mode)
Sint32fdSpriteDissolveRunStub (void *object)
voidfdSpriteDissolveRunManyStub (void **sprites, Sint32 count)
voidfdSpriteDissolveStepStub (void *record, Sint32 step)
voidfdSpriteSkipToStopStub (void *record)
voidfdSpriteRemoveAnimationAtStub (void *record, Sint32 slot)
Sint32fdSpriteAnimationSumCommandLengthsStub (Sint32 id, Sint32 animation, Sint32 timedCount)
voidmnMessageArgumentClearAllStub (void)
voidmnMessageArgumentPushStub (Sint32 value, Sint32 kind)
voidmnBattleMessageOpenStub (Sint32 msg)
voidmnBattleMessageShowAndWaitStub (Sint32 msgId)
voidmnBattleMessageCloseStub (void)
voidmnPartyStatusDrawStub (Sint32 mode)
voidmnPartyStatusHighlightMembersStub (Uint16 *unitIds)

Variables

NameDescription
extern const Sint8HaltFlickerColorModes []The tables other modules lend the battle, in the order they are declared.
extern const Sint8BattlePlacementSpots []Spots on the battlefield, x and y pixels from its centre, each layout ended by a 0, 0 pair: the party's four, the same four again, then six in the enemies' column (ENEMY_COLUMN_X).
extern Uint8EncounterDjinnBattles []The encounter of each Djinni battle (fdEncounterGetDjinnFormation): {zone, slot}, by Djinni number, as The Broken Seal's EncounterDjinnBattles.
extern Uint16BattleUnitWeaponKinds []The kind of weapon each weapon item is, which picks its holder's battle sprite (BattleUnitWeaponAnimationsIsaac and the rest).
extern const Uint8FieldEffectSparkTiles []The 32x16 spark the swelling arcs over a caster are drawn with (field_effects.list.tsv).
extern const Uint16InputDpadAnglesEightWay []A heading for each value of the right, left, up and down bits of the +Control Pad, in eight ways (fdInputGetDpadAngleEightWay); the same as The Broken Seal's WorldMapCursorDirectionAngles.
extern const Sint32ItemDisplaySparkleScript []A sparkle round the found item, sinking a quarter pixel a tick for 60 ticks before it goes (field_engine_item_display.c).
extern const Uint8MindReadCrescentEndScript []A script that releases its actor at once: a Mind Read crescent's end, once it reaches the caster (fdMindReadUpdateCrescent).
extern const Uint8ColorBufferDarkenOneLevelMap [32]The colour ramp from 224 to 255 darkened by one, two and four levels: each colour's index one, two or four steps down, 0 below 224.
extern const Uint8ColorBufferDarkenTwoLevelsMap [32]As ColorBufferDarkenOneLevelMap, two steps down.
extern const Uint8ColorBufferDarkenFourLevelsMap [32]As ColorBufferDarkenOneLevelMap, four steps down.
extern const Uint8btModelDecodeCode []The bit decoder btBackgroundLoad copies to RAM to decode a battle background's tiles (background_decode.s).
extern Uint8ModelDecodeCodeSize []btModelDecodeCode's
extern Uint8BattleMessageAdvanceArrowTiles []The advance arrow beside a battle message: eight pictures of ADVANCE_ARROW_PICTURE_BYTES, one every four ticks.
extern Uint8BattleAIActionWeights [3][8]btAIChooseAction's rolls for the first three action strategies, a row each: the chance in 256 of each place in the enemy's actions.
extern Uint16BattleAIDullahanForms []The enemy definitions Dullahan acts as, one drawn at random.
extern const Uint8BattleTransitionCurtainVariants []The battle transition's curtain tile in eight variants, 32 bytes (one 4-bit tile) each, a new one every four ticks.
extern Uint8BattleTransitionCurtainTiles []The battle transition's curtain tiles, 32 bytes (one 4-bit tile) each.
extern const struct BATTLE_SIDE_ORDERBattleTurnEndSideOrderThe party, then the enemies: the order the sides take their turn-end effects in.

Description

The battle engine's functions as other files call them: the battle module's own, file by file, then the battle effects, the field engine's functions the battle and its effects borrow, and the stub calls into the main image.

Macros in detail

BATTLE_BACKGROUND_SCROLL_Y

#define BATTLE_BACKGROUND_SCROLL_Y 32

BG1's vertical scroll that sets the battle background in the battle view.

Referenced by btCameraApplyVerticalShake(), btCameraShake(), btEffectEndCanvasLayer(), btEffectOpenCanvasLayer(), btEffectRunAttackSlash(), btEffectRunBackgroundFadeIn(), btEffectRunBoreas(), btEffectRunCatastrophe(), btEffectRunCriticalHit(), btEffectRunCruelRuin(), btEffectRunDaedalus(), btEffectRunEclipse(), btEffectRunFlora(), btEffectRunGatheringLights(), btEffectRunJudgment(), btEffectRunKirin(), btEffectRunRisingDragonEnemy(), btEffectRunShatteringOpening(), btEffectRunStarfieldFall(), btEffectRunUlysses(), btEffectSetupBlendedDisplay(), btEffectSetupCanvasTileMap(), btEffectStartCanvasLayer(), btEffectStartElementStreaks(), btIrisDrawSplash() and mnBattleCommandRowRun().

Definition at line 244 of file battle.h.

BATTLE_BG1_SCREEN_BLOCK

#define BATTLE_BG1_SCREEN_BLOCK 31

BG1's map in a battle, a screen block: while the battle background lies flat, lines outside its plane read the padded map there; the command row places its icons' tiles in it, and the effects that take BG1 over (the canvas, Ulysses's rune circles) lay their own maps there.

Referenced by btBackgroundLoad(), btBackgroundSetMode(), btEffectBuildCanvasTilemap(), btEffectBuildRepeatingTilemap(), btEffectHideBg1AndRestoreBackdrop(), btEffectRunCatastrophe(), btEffectRunShatteringOpening(), btEffectRunUlysses(), btEffectSetupCanvasTileMap() and mnBattleCommandRowRun().

Definition at line 249 of file battle.h.

BATTLE_ZOOM_NORMAL

#define BATTLE_ZOOM_NORMAL 100

btCameraSetView's zoom, in percent, for the battle's usual view.

Referenced by btAutoBattleRunPsynergy(), btEffectOpenCanvasLayer(), btEffectRunBackgroundFadeIn(), btEffectRunDragonCloud(), btEffectRunFire(), btEffectRunShatteringOpening(), btEffectRunVoidBeam(), btEffectStartCanvasLayer(), btEffectStartElementStreaks(), btStagingRunAttack(), btStagingRunFullScreen(), btTransitionAdvanceOpening() and btTransitionRun().

Definition at line 251 of file battle.h.

BATTLE_MULTIPLIER_ONE

#define BATTLE_MULTIPLIER_ONE 256

The battle's multipliers are 256ths: this one keeps an amount as it is, and gmBattleGetElementMultiplier returns it for no element difference.

Referenced by gmBattleCalculateAttackDamage(), gmBattleCalculatePsynergyPower(), gmBattleCalculateRecovery(), gmBattleGetElementMultiplier() and mnAbilityApplyToTargets().

Definition at line 255 of file battle.h.

HEALING_BASE_POWER

#define HEALING_BASE_POWER 100

The element power at which healing is neither stronger nor weaker (gmBattleCalculateRecovery): each point above it counts as two points of element difference.

Referenced by gmBattleCalculateRecovery() and mnAbilityApplyToTargets().

Definition at line 259 of file battle.h.

PUSH_MESSAGE

#define PUSH_MESSAGE(message)

Queues a message that waits for the player.

Referenced by btAbilityApplyToTarget().

Definition at line 382 of file battle.h.

ADVANCE_ARROW_PICTURE_BYTES

#define ADVANCE_ARROW_PICTURE_BYTES (2 * TILE_SIZE_8BPP)

The advance arrow's room in sprite VRAM: one of its pictures (BattleMessageAdvanceArrowTiles), an 8 by 16 sprite of 256 colours.

Referenced by btEffectRunCatastrophe(), btEffectRunDaedalus(), btEffectRunEclipse(), btMessageWaitForAdvance(), btPlaybackRun() and btRun().

Definition at line 391 of file battle.h.

Enumerations in detail

BATTLE_SPR_MODE

enum BATTLE_SPR_MODE

A battle unit's sprites' OBJ mode, as btHighlightSetSpriteMode sets it: faded units are semi-transparent, and the battle's blends act on them.

EnumeratorValueDescription
SPRITE_OPAQUE
SPRITE_SEMI_TRANSPARENT

Definition at line 200 of file battle.h.

BATTLE_ELEMENT_GLOW

enum BATTLE_ELEMENT_GLOW

The glows btElementGlowPlay plays about a unit in its element.

EnumeratorValueDescription
GLOW_STAR_FIELDThe star field gathering on the unit while the background darkens: a cast
GLOW_STREAKSthe element's streaks: an enemy's cast
GLOW_PILLARthe element's pillar, at a strength: a summon's boost
GLOW_BURSTthe element's burst: a Djinni set

Definition at line 207 of file battle.h.

BATTLE_HIGHLIGHT

enum BATTLE_HIGHLIGHT

btHighlightSetModes's modes: the units listed take one blend and every other unit the other (mode bit 0), and the battle steps the blend each tick (btBackgroundStepHighlightBlend).

EnumeratorValueDescription
HIGHLIGHT_OFF0every unit opaque, the blend stopped
HIGHLIGHT_SELECTED1the units listed lighten by the ramp
HIGHLIGHT_PULSE2listed units pulse semi-transparently by the ramp (party reserve)
HIGHLIGHT_FADE_OUT4the units listed fade out over 32 ticks
HIGHLIGHT_FADE_IN6the units listed fade in over 32 ticks

Definition at line 219 of file battle.h.

BATTLE_POSE

enum BATTLE_POSE

The battle sprites' animations (fdActorSelectAnimation numbers) that the battle code picks by name.

EnumeratorValueDescription
POSE_STILL0held still: asleep/stunned/held enemy, or party
POSE_STANDING1standing between turns
POSE_LEAP2running up to a target and leaping
POSE_CAST3a hand raised to cast or use an item
POSE_PARTY_HELD4asleep, stunned or held; also a downed member
POSE_DAMAGE5taking damage
POSE_ENEMY_DOWN5a downed enemy stays in its damage pose

Definition at line 231 of file battle.h.

Functions in detail

btColorBufferScale

void btColorBufferScale(Uint16 *src, Uint32 dest, Sint32 value, Sint32 size)

Writes size BGR555 colours of source to destination scaled by value / 256, at most 1.0: a palette dimmed toward black.

Referenced by btBackgroundLoad(), btBackgroundSetPaletteLevel(), btElementGlowPlay() and btStagingRunItem().

Definition at line 131 of file battle.h.

btMotionApproachTargetStub

void btMotionApproachTargetStub(Sint32 actorId, Sint32 targetId, Sint32 travelTicks, Sint32 initVelocityY)

Referenced by btEffectRunAnnihilation(), btEffectRunCrescentSlash(), btEffectRunFlashingStrike(), btEffectRunFlurry(), btEffectRunHelmSplitter(), btEffectRunHurricane(), btEffectRunMegiddo(), btEffectRunMightyPress(), btEffectRunPlumeEdge(), btEffectRunSevereBlow(), btEffectRunTargetMotes(), btEffectRunThrash() and btEffectRunUnusedTriangleStrike().

Definition at line 419 of file battle.h.

btHighlightSetModesStub

void btHighlightSetModesStub(Uint16 *actors, Sint32 mode)

Referenced by mnBattleCollectPartyCommands(), mnBattlePartyChooseReserve(), mnBattleTargetRunSelection() and mnClearBattleHighlight().

Definition at line 434 of file battle.h.

fdAdvanceWithGravity2D

void fdAdvanceWithGravity2D(Sint32 *vector, Sint32 damping, Sint32 gravity)

fdAdvanceWithGravity3D for x and y alone: the third word is left as it is, and the velocities follow it.

Referenced by fdBattleEffectStepVector2(), fdGrowingParticleUpdate(), fdPsynergyUpdateArrow(), fdPsynergyUpdateBurst() and fdPsynergyUpdatePound().

Definition at line 458 of file battle.h.

fdAdvanceWithGravity3D

void fdAdvanceWithGravity3D(Sint32 *vector, Sint32 damping, Sint32 gravity)

Moves a point (three 16.16 coordinates, their velocities after them) by its velocity, then adds gravity to the second velocity and scales each by damping / 64.

Referenced by fdBattleEffectStepVector3(), fdBlazeUpdateSpray(), fdPsynergyEndRing(), fdPsynergyUpdateArrow(), fdPsynergyUpdateLash(), fdScoopDustUpdateGrain(), fdSummonTabletUpdateRunes() and fdTeleportPlaySparks().

Definition at line 462 of file battle.h.

gmUnitCalculateStub

void gmUnitCalculateStub(Sint32 unitId)

Works a unit's stats out again from its base stats, equipment, set Djinn, class and battle stat levels, keeping its HP and PP at the same fraction.

Referenced by btAbilityApplyToTarget(), btActionRunBuild(), btDebugBattleRunMenu(), btDjinnRecoveryCountDown(), btDjinnRecoveryCountDownSide(), btEnemyAdjustLevel(), btPartyClearBattleStatuses(), btProcessTurnEnd(), btUnitClearStatuses(), btUnitProcessActionEnd(), btUnitResetGuardLevels(), btUnitStrengthen(), fdPartyInventoryGiveItem(), mnAbilityApplyToTargets(), mnBattleDjinnMenuShowChangePreview(), mnBattleStatusScreenRun(), mnDjinnMenuDrawStatPreview(), mnDjinnMenuRunPreview(), mnDjinnMenuRunScreen(), mnDjinnMenuSelectDjinn(), mnItemMenuConfirmEquip(), mnItemMenuRunCommands(), mnItemMenuUse(), mnPsynergyMenuRunSteps(), mnSanctumApplyService(), mnShopDrawEquipComparison(), mnShopSellItem() and mnStatusPanelDraw().

Definition at line 482 of file battle.h.

gmUnitSetHpStub

void gmUnitSetHpStub(UNIT *unit, Sint32 hp)

Sets the unit's HP, kept between 0 and its maximum, and updates its gauges.

Referenced by btScriptedBattleRestoreUnits() and btUnitRemoveEnemy().

Definition at line 485 of file battle.h.

gmPartyCountMembersStub

Sint32 gmPartyCountMembersStub(void)

Referenced by btPartyPrepareMembers(), btPartyPrepareReserveOwners(), fdPartyAddHp(), fdPartyAddPp(), fdPartyApplyPoisonDamage(), fdPartyCheckItemLimit(), fdPartyIsInFrontRow(), fdPartyRemoveMemberRestored(), fdTalkToActor(), fdUpdateWalking(), fdUseItem(), mnBattleCommandRowRun(), mnDjinnMenuDrawPage(), mnPartyStatusBuildLayoutBounds(), mnPartyStatusDraw() and mnPlacePartyFigures().

Definition at line 486 of file battle.h.

gmDjinnSetStub

Sint32 gmDjinnSetStub(Sint32 unitId, Sint32 element, Sint32 index)

Referenced by btActionRunBuild(), btDebugParamSetLoad(), btDjinnRecoveryCountDown(), btDjinnRecoveryCountDownSide(), btProcessTurnEnd(), mnBattleDjinnMenuShowChangePreview(), mnDjinnMenuDrawStatPreview(), mnDjinnMenuRunPreview(), mnDjinnMenuRunScreen() and mnDjinnMenuSelectDjinn().

Definition at line 487 of file battle.h.

gmDjinnGetRecoveryTableStub

struct DJINN_RECOVERY_TABLE *gmDjinnGetRecoveryTableStub(Sint32 owner)

Referenced by btActionRunBuild(), btDebugParamSetLoad(), btDjinnCountStandby(), btDjinnRecoveryCountDown(), btDjinnRecoveryCountDownSide(), btDjinnRecoveryReconcile(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btProcessTurnEnd(), btRun(), btSummonUpdateAvailability(), btUnitDrainDjinn(), btUnitProcessActionEnd(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun() and mnBattleStatusScreenRun().

Definition at line 488 of file battle.h.

gmDjinnRecoveryRemoveStub

Sint32 gmDjinnRecoveryRemoveStub(Sint32 unitId, Sint32 element, Sint32 index)

Referenced by btActionRunBuild(), btDjinnRecoveryCountDown(), btDjinnRecoveryCountDownSide(), btProcessTurnEnd(), mnDjinnMenuRunScreen() and mnDjinnMenuSelectDjinn().

Definition at line 489 of file battle.h.

fdActorSetPosAndResetMotionStub

void fdActorSetPosAndResetMotionStub(struct ACTOR *actor, Sint32 x, Sint32 y, Sint32 z)

The main image's actors, sprites and windows.

Referenced by btPartySwapInReserves(), fdActorDescendInWhirlwind(), fdActorLaunchFromLeader(), fdActorPlaceOnActor(), fdActorSetHorizontalPosAndAngleWithTerrain(), fdActorSetHorizontalPosWithTerrain(), fdActorSetPosWithTerrain(), fdDjinnRestoreActorAfterBattle(), fdLeaderPushObjectAhead(), fdPsynergyCatch(), fdPsynergyCyclone(), fdPsynergyEndHover(), fdPsynergyEndSand(), fdPsynergyHover(), fdPsynergySand(), fdPsynergySteerPushedTarget(), fdPsynergyUpdateLash(), fdScriptSpawnActorTable(), fdTalkToActor(), fdWhirlwindUpdateTarget() and mnBattlePartyChooseReserve().

Definition at line 492 of file battle.h.

fdActorSetAnimationSpeedStub

void fdActorSetAnimationSpeedStub(struct ACTOR *actor, Sint32 value)

Sets the timer step of every sprite of an actor (16 is normal speed).

Referenced by btActionRunBuild(), btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btDjinnRecoveryCountDownSide(), btEffectRunAgingGas(), btEffectRunAstralBlast(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunDjinniCharge(), btEffectRunFireDance(), btEffectRunFlashingStrike(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunHeavyBlow(), btEffectRunMegiddo(), btEffectRunMineBall(), btEffectRunOdyssey(), btEffectRunRagnarok(), btEffectRunRisingDragon(), btEffectRunRushingStrike(), btEffectRunStoneJustice(), btEffectRunVolleyWithAction(), btEffectRunWyrdCurse(), btMotionCallBeast(), btObjectUpdatePose(), btProcessTurnEnd(), btStagingRunAttack(), btStagingRunItem(), btStagingRunPsynergyCast(), btUnitProcessActionEnd(), fdActorSetAnimationSpeedById(), fdActorSetOthersPaused(), fdPsynergyHaltActor(), fdPsynergyResumeHaltedActor() and fdTalkToActor().

Definition at line 497 of file battle.h.

fdActorReleaseStub

void fdActorReleaseStub(struct ACTOR *actor)

Referenced by btMotionDestroyAllSlotObjects(), btUnitRemoveEnemy(), fdActorAppearInWhirlwind(), fdActorDescendInWhirlwind(), fdActorReleaseAtIndex(), fdActorReleaseById(), fdActorReleaseIfPresent(), fdActorSpawn(), fdAvoidUpdateRingBackHalf(), fdAvoidUpdateRingFrontHalf(), fdDjinnRunJupiterJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdEffectBurstHand(), fdEffectSetAttached(), fdEffectShrinkActorAndDestroyFast(), fdEffectShrinkActorAndDestroySlow(), fdEffectUpdateDescendingOrbitActor(), fdItemDisplayShowItem(), fdItemDisplayShowItemInFront(), fdPsynergyBlaze(), fdPsynergyCarry(), fdPsynergyCatch(), fdPsynergyCyclone(), fdPsynergyDouse(), fdPsynergyHalt(), fdPsynergyLash(), fdPsynergyLift(), fdPsynergyPly(), fdPsynergyPound(), fdPsynergyScoop(), fdPsynergySteerLiftedTarget(), fdPsynergyWhirlwind() and fdTalkToActor().

Definition at line 498 of file battle.h.

fdSpriteDissolveRunStub

Sint32 fdSpriteDissolveRunStub(void *object)

Referenced by btMotionPlayFall().

Definition at line 503 of file battle.h.

fdSpriteDissolveRunManyStub

void fdSpriteDissolveRunManyStub(void **sprites, Sint32 count)

Referenced by btMotionShowDowned().

Definition at line 504 of file battle.h.

fdSpriteDissolveStepStub

void fdSpriteDissolveStepStub(void *record, Sint32 step)

Referenced by btPlaybackRun().

Definition at line 505 of file battle.h.

fdSpriteSkipToStopStub

void fdSpriteSkipToStopStub(void *record)

Referenced by btMotionReleaseBuffer().

Definition at line 506 of file battle.h.

fdSpriteRemoveAnimationAtStub

void fdSpriteRemoveAnimationAtStub(void *record, Sint32 slot)

Referenced by btMotionReleaseBuffer().

Definition at line 507 of file battle.h.

fdSpriteAnimationSumCommandLengthsStub

Sint32 fdSpriteAnimationSumCommandLengthsStub(Sint32 id, Sint32 animation, Sint32 timedCount)

Referenced by btStagingRunAttack().

Definition at line 508 of file battle.h.

mnMessageArgumentClearAllStub

void mnMessageArgumentClearAllStub(void)

Referenced by btActionRunBuild(), btAutoBattleApplyDamage(), btAutoBattleRunAction(), btAutoBattleShowDefend(), btAwardSpoils(), btIntroAnnounceEncounter(), btPlaybackRun(), btPlaybackRunAll() and btRun().

Definition at line 511 of file battle.h.

mnMessageArgumentPushStub

void mnMessageArgumentPushStub(Sint32 value, Sint32 kind)

Referenced by btActionRunBuild(), btAutoBattleApplyDamage(), btAutoBattleRunApproachAttack(), btAutoBattleShowDefend(), btAwardSpoils(), btIntroAnnounceEncounter(), btPlaybackRun(), btPlaybackRunAll(), btProcessTurnEnd(), btRun(), btStagingDispatchAction(), fdEngineRun(), fdPartyCheckItemLimit(), fdPartyInventoryGiveItem(), fdPartyLearnAbility(), fdPsynergyShowAvoidWoreOff(), fdPsynergyStartCast(), fdScriptPickUpItem(), fdTalkToActor(), fdUseItem(), fdUsePsynergy(), mnAbilityApplyToTargets(), mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnForgeOfferItem(), mnInnCheckIn(), mnPsynergyMenuDrawShortcuts(), mnSanctumDrawFee(), mnSanctumRunPartyService(), mnShopConfirmEquip(), mnShopDrawCarriedItem(), mnShopGiveGameTicket(), mnShopRepairItem(), mnShopSelectBuy(), mnShopSellItem() and mnStatusScreenShowMemberProgressMessage().

Definition at line 512 of file battle.h.

mnBattleMessageOpenStub

void mnBattleMessageOpenStub(Sint32 msg)

Referenced by btPlaybackRun().

Definition at line 513 of file battle.h.

mnBattleMessageShowAndWaitStub

void mnBattleMessageShowAndWaitStub(Sint32 msgId)

Referenced by btActionRunBuild(), btAutoBattleApplyDamage(), btAutoBattleRunAction(), btAutoBattleRunApproachAttack(), btAutoBattleShowDefend(), btAwardSpoils(), btFleePlayRun(), btIntroAnnounceEncounter(), btPlaybackRunAll(), btProcessTurnEnd(), btRun(), btStagingDispatchAction() and btStagingRunFlee().

Definition at line 514 of file battle.h.

mnBattleMessageCloseStub

void mnBattleMessageCloseStub(void)

Referenced by btGatherActions() and btIntroAnnounceEncounter().

Definition at line 515 of file battle.h.

mnPartyStatusDrawStub

void mnPartyStatusDrawStub(Sint32 mode)

Referenced by btAbilityApplyToTarget(), btAutoBattleApplyDamage(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btMotionFlashHit(), btPartySwapInReserves(), btPlaybackRun(), btPlaybackRunAll(), btRun(), btStagingRunAttack(), btStagingRunFullScreen() and btStagingRunPsynergyCast().

Definition at line 516 of file battle.h.

mnPartyStatusHighlightMembersStub

void mnPartyStatusHighlightMembersStub(Uint16 *unitIds)

Referenced by btMotionFlashHit() and btPlaybackRun().

Definition at line 517 of file battle.h.

Variables in detail

FieldEffectSparkTiles

extern const Uint8 FieldEffectSparkTiles[]

The 32x16 spark the swelling arcs over a caster are drawn with (field_effects.list.tsv).

Referenced by fdBattleEffectStartArcEffect().

Definition at line 268 of file battle.h.

btModelDecodeCode

extern const Uint8 btModelDecodeCode[]

The bit decoder btBackgroundLoad copies to RAM to decode a battle background's tiles (background_decode.s).

Referenced by btBackgroundLoad().

Definition at line 278 of file battle.h.

ModelDecodeCodeSize

extern Uint8 ModelDecodeCodeSize[]

btModelDecodeCode's

Referenced by btBackgroundLoad().

Definition at line 280 of file battle.h.

BattleMessageAdvanceArrowTiles

extern Uint8 BattleMessageAdvanceArrowTiles[]

The advance arrow beside a battle message: eight pictures of ADVANCE_ARROW_PICTURE_BYTES, one every four ticks.

Referenced by btMessageWaitForAdvance() and btPlaybackRun().

Definition at line 285 of file battle.h.

BattleTransitionCurtainVariants

extern const Uint8 BattleTransitionCurtainVariants[]

The battle transition's curtain tile in eight variants, 32 bytes (one 4-bit tile) each, a new one every four ticks.

Referenced by btTransitionUploadTileVariant().

Definition at line 296 of file battle.h.

BattleTransitionCurtainTiles

extern Uint8 BattleTransitionCurtainTiles[]

The battle transition's curtain tiles, 32 bytes (one 4-bit tile) each.

Definition at line 299 of file battle.h.