Skip to Content
The Alchemy Project

src/battle/battle_playback.c

Playback over ticks, btPlaybackRun. More…

Included by battle.c.

Macros

NameDescription
#definePLAY_MESSAGE 3btPlaybackRun's waits, in BATTLE_PLAYBACK_STATE.phase beside the phases playback_queue.h 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
#defineHIT_FLASH_TICKS 8PLAY_HIT's ticks: the unit white on ticks 1 and 5, its own colours again on 3 and 7.
#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.
#defineFELLED_DISSOLVE_FIRST_TICK 5PLAY_FELLED's timer at which the dissolve starts, a tick after the enemy leaves the lists; it takes fdSpriteDissolveStep's 128 steps, four a tick.
#defineFELLED_DISSOLVE_STEPS 128

Functions

NameDescription
void_call_via_r0 (Uint32 routine)
voidbtDMAStopDMA3 (void)Unused: stops DMA3, then calls a function that is not one.
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.
voidbtPlaybackReset (void)Stops playback and empties the playback queue.
UNREAD_RESULTbtPlaybackWaitForReady (void)Waits until playback has played every target, starting it if the effect never showed the damage.

Description

Playback over ticks, btPlaybackRun. Part of battle.c.

Macros in detail

PLAY_MESSAGE

#define PLAY_MESSAGE 3

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

waits for the message, then for the player

Referenced by btPlaybackRun().

Definition at line 53 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 54 of file battle_playback.c.

PLAY_HIT

#define PLAY_HIT 10

flashes the unit that was hit

Referenced by btPlaybackRun().

Definition at line 55 of file battle_playback.c.

PLAY_FELLED

#define PLAY_FELLED 11

greys a fallen enemy and dissolves it

Referenced by btPlaybackRun().

Definition at line 56 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 57 of file battle_playback.c.

HIT_FLASH_TICKS

#define HIT_FLASH_TICKS 8

PLAY_HIT's ticks: the unit white on ticks 1 and 5, its own colours again on 3 and 7.

Referenced by btPlaybackRun().

Definition at line 61 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 65 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 67 of file battle_playback.c.

FELLED_DISSOLVE_FIRST_TICK

#define FELLED_DISSOLVE_FIRST_TICK 5

PLAY_FELLED's timer at which the dissolve starts, a tick after the enemy leaves the lists; it takes fdSpriteDissolveStep's 128 steps, four a tick.

Referenced by btPlaybackRun().

Definition at line 70 of file battle_playback.c.

FELLED_DISSOLVE_STEPS

#define FELLED_DISSOLVE_STEPS 128

Referenced by btPlaybackRun().

Definition at line 71 of file battle_playback.c.

Functions in detail

_call_via_r0

void _call_via_r0(Uint32 routine)

Referenced by btDMAStopDMA3().

Definition at line 5 of file battle_playback.c.

btDMAStopDMA3

void btDMAStopDMA3(void)

Unused: stops DMA3, then calls a function that is not one.

References _call_via_r0(), IwramIrqModeWord and syDMAXCopy().

Definition at line 8 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 21 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(), btProcessTurnEnd() and btUnitProcessActionEnd().

Definition at line 38 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(), btObjectGet(), btObjectGetPalette(), btObjectMarkForRelease(), btObjectRemoveFromLists(), btObjectSetColorMode(), btObjectUpdatePose(), btPlaybackGrantDjinnBonus(), btSpriteGetDefeatSound(), btUnitBuildStatusFlags(), btUnitClearStatuses(), btUnitRemoveEnemy(), fdActorSelectAnimationStub(), fdSpriteDissolveStepStub(), fdSpriteStartAnimationStub(), FrameCount, gmUnitGetStub(), mnBattleMessageOpenStub(), mnMessageAllTypedStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub(), mnPartyStatusDrawStub(), mnPartyStatusHighlightMembersStub(), PerData, PerPushLatch, Sint32, syIOWriteQueueClearBits16(), syIOWriteQueueSetBits16(), syOAMAddSpriteAtDepth(), sySoundPlayStub(), syVRAMCacheReload(), syWordsClear(), TickCount and VramCacheEntries.

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

Definition at line 76 of file battle_playback.c.

btPlaybackReset

void btPlaybackReset(void)

Stops playback and empties the playback queue.

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

Definition at line 483 of file battle_playback.c.

btPlaybackWaitForReady

UNREAD_RESULT btPlaybackWaitForReady(void)

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

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

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

Definition at line 499 of file battle_playback.c.