Skip to Content
The Alchemy Project

src/battle/battle_playback.c

Battle playback: starting it, scheduling its phases, resetting it and waiting until it is ready. More…

Included by battle.c.

Macros

NameDescription
#definePLAY_MESSAGE 3btPlaybackRun's waits, in BATTLE_PLAYBACK_STATE.phase beside the phases BATTLE_PLAYBACK_PHASE_ names.
#definePLAY_ADVANCE 5shows the arrow and waits for the player
#definePLAY_HIT 10flashes the unit that was hit
#definePLAY_FELLED 11greys a fallen enemy and dissolves it
#definePLAY_MESSAGE_ADD 13waits for the message, then goes straight on
#defineFELLED_FLASH 1024PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept apart from the counts of the fall itself (0 to 36).
#defineFELLED_FLASH_TICKS 30The Djinn bonus's colour cycle lasts 30 ticks.
#defineDISSOLVE_STEPS_PER_TICK 4A felled enemy's sprite dissolves over field/field.h's DISSOLVE_STEPS, four a tick.
#defineFELLED_LEAVES_LISTS 4PLAY_FELLED's timer at the tick the grey enemy leaves the lists, and at the dissolve's first tick.
#defineFELLED_DISSOLVE_START 5
#definePLAYBACK_ARROW_ATTR0 (OBJ_SIZE_8X16 | OBJ_256_COLORS)The arrow btPlaybackRun shows at a message: The Broken Seal's advance arrow, opaque.

Functions

NameDescription
voidbtDMAStopDMA3 (void)Unused: makes three empty DMA3 transfers after a multiplication whose result it drops.
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.
Sint32btPlaybackSchedulePhase (Sint32 ticks)Empties the playback queue and plays the commands queued next, after ticks ticks, with no targets to resolve.
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.
Uint32btPlaybackReset (void)Stops playback and empties the playback queue.
Sint32btPlaybackWaitForReady (void)Waits until playback has played every target, starting it if the effect never showed the damage.

Description

Battle playback: starting it, scheduling its phases, resetting it and waiting until it is ready. Part of battle.c.

Macros in detail

PLAY_MESSAGE

#define PLAY_MESSAGE 3

btPlaybackRun's waits, in BATTLE_PLAYBACK_STATE.phase beside the phases BATTLE_PLAYBACK_PHASE_ names.

waits for the message, then for the player

Referenced by btPlaybackRun().

Definition at line 51 of file battle_playback.c.

PLAY_ADVANCE

#define PLAY_ADVANCE 5

shows the arrow and waits for the player

Referenced by btPlaybackRun().

Definition at line 52 of file battle_playback.c.

PLAY_HIT

#define PLAY_HIT 10

flashes the unit that was hit

Referenced by btPlaybackRun().

Definition at line 53 of file battle_playback.c.

PLAY_FELLED

#define PLAY_FELLED 11

greys a fallen enemy and dissolves it

Referenced by btPlaybackRun().

Definition at line 54 of file battle_playback.c.

PLAY_MESSAGE_ADD

#define PLAY_MESSAGE_ADD 13

waits for the message, then goes straight on

Referenced by btPlaybackRun().

Definition at line 55 of file battle_playback.c.

FELLED_FLASH

#define FELLED_FLASH 1024

PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept apart from the counts of the fall itself (0 to 36).

Referenced by btPlaybackRun().

Definition at line 59 of file battle_playback.c.

FELLED_FLASH_TICKS

#define FELLED_FLASH_TICKS 30

The Djinn bonus's colour cycle lasts 30 ticks.

Referenced by btPlaybackRun().

Definition at line 61 of file battle_playback.c.

DISSOLVE_STEPS_PER_TICK

#define DISSOLVE_STEPS_PER_TICK 4

A felled enemy's sprite dissolves over field/field.h's DISSOLVE_STEPS, four a tick.

Referenced by btPlaybackRun().

Definition at line 64 of file battle_playback.c.

FELLED_LEAVES_LISTS

#define FELLED_LEAVES_LISTS 4

PLAY_FELLED's timer at the tick the grey enemy leaves the lists, and at the dissolve's first tick.

Referenced by btPlaybackRun().

Definition at line 67 of file battle_playback.c.

FELLED_DISSOLVE_START

#define FELLED_DISSOLVE_START 5

Referenced by btPlaybackRun().

Definition at line 68 of file battle_playback.c.

PLAYBACK_ARROW_ATTR0

#define PLAYBACK_ARROW_ATTR0 (OBJ_SIZE_8X16 | OBJ_256_COLORS)

The arrow btPlaybackRun shows at a message: The Broken Seal's advance arrow, opaque.

Referenced by btPlaybackRun().

Definition at line 72 of file battle_playback.c.

Functions in detail

btDMAStopDMA3

void btDMAStopDMA3(void)

Unused: makes three empty DMA3 transfers after a multiplication whose result it drops.

References syDMAXCopy() and syMathUnsignedMultiplyHigh().

Definition at line 6 of file battle_playback.c.

btPlaybackStart

void btPlaybackStart(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.

References Sint32.

Definition at line 16 of file battle_playback.c.

btPlaybackSchedulePhase

Sint32 btPlaybackSchedulePhase(Sint32 ticks)

Empties the playback queue and plays the commands queued next, after ticks ticks, with no targets to resolve.

References btPlaybackRun(), Sint32 and sySetEvent().

Referenced by btActionRunBuild(), btDjinnRecoveryCountDownSide(), btProcessTurnEnd() and btUnitProcessActionEnd().

Definition at line 34 of file battle_playback.c.

btPlaybackRun

void btPlaybackRun(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.

References BattleMessageAdvanceArrowTiles, btAbilityApplyToTarget(), btActorGetSprite(), btEnemyRecordDefeat(), btMotionGetSlotPalette(), btObjectGet(), btObjectMarkForRelease(), btObjectRemoveFromLists(), btObjectSetColorMode(), btObjectUpdatePose(), btPlaybackGrantDjinnBonus(), btSpriteGetDefeatSound(), btUnitBuildStatusFlags(), btUnitClearStatuses(), btUnitRemoveEnemy(), fdActorSelectAnimationStub(), fdSpriteDissolveStepStub(), fdSpriteStartAnimationStub(), FrameCount, gmUnitGet(), LastTickFrames, mnBattleMessageOpenStub(), mnMessageAllTypedStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub(), mnPartyStatusDrawStub(), mnPartyStatusHighlightMembersStub(), PerWork, Sint32, syIOWriteQueueClearBits16(), syIOWriteQueueSetBits16(), syOAMAddSpriteAtDepth(), sySoundPlayStub(), syVRAMCacheReload(), TickCount and VramCacheEntries.

Referenced by btPlaybackSchedulePhase(), btPlaybackWaitForReady(), btStagingRunAttack(), btStagingRunFullScreen(), btStagingRunItem() and btStagingRunPsynergyCast().

Definition at line 77 of file battle_playback.c.

btPlaybackReset

Uint32 btPlaybackReset(void)

Stops playback and empties the playback queue.

Referenced by btActionRunBuild(), btDjinnRecoveryCountDownSide(), btPlaybackRunAll(), btPlaybackWaitForReady(), btProcessTurnEnd(), btUnitCountDownRegenerate() and btUnitProcessActionEnd().

Definition at line 473 of file battle_playback.c.

btPlaybackWaitForReady

Sint32 btPlaybackWaitForReady(void)

Waits until playback has played every target, starting it if the effect never showed the damage.

References btPlaybackReset(), btPlaybackRun(), Sint32, syCloseEvent() and sySynch().

Referenced by btActionRunBuild(), btDjinnRecoveryCountDownSide(), btProcessTurnEnd(), btStagingRunAttack(), btStagingRunFullScreen(), btStagingRunItem(), btStagingRunPsynergyCast() and btUnitProcessActionEnd().

Definition at line 492 of file battle_playback.c.