Skip to Content
The Alchemy Project

src/battle/battle_playback_queue.c

The battle playback queue: clearing statuses, waiting for the player to advance messages, and queuing and running playback events. More…

Included by battle.c.

Functions

NameDescription
voidbtUnitClearStatuses (Sint32 unitId)Clears every status and stat change of a unit that goes down and works out its stats again.
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.
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.
voidbtMessageWaitForTyping (void)Waits until the battle message has typed out, then marks the next message (BATTLE_MESSAGE_STATE.marked).
Sint32btUnitRemoveEnemy (Sint32 unitId)Takes an enemy out of the battle at once, one that leaves rather than falls.
voidbtPlaybackGrantDjinnBonus (BATTLE_PLAYBACK_STATE *runtime, Uint32 operand)Grants the Djinn bonus for the rest of the action.
Uint32btPlaybackRunAll (void)Runs the queued battle events in order, then resets the queue.
voidbtPlaybackPush (Uint32 opcode, Uint32 operand)Queues one playback command with its operand.

Description

The battle playback queue: clearing statuses, waiting for the player to advance messages, and queuing and running playback events. Part of battle.c.

Functions in detail

btUnitClearStatuses

void btUnitClearStatuses(Sint32 unitId)

Clears every status and stat change of a unit that goes down and works out its stats again.

References btObjectGet(), btUnitBuildStatusFlags(), gmUnitCalculateStub(), gmUnitGet() and Sint32.

Referenced by btPlaybackRun() and btPlaybackRunAll().

Definition at line 6 of file battle_playback_queue.c.

btMessageWaitForAdvance

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

References BattleMessageAdvanceArrowTiles, mnMessageAllTypedStub(), PerWork, Sint32, syIOWriteQueueClearBits16(), syIOWriteQueueSetBits16(), syOAMAddSpriteAtDepth(), sySoundPlayStub(), sySynch(), syVRAMCacheAllocateEntry(), syVRAMCacheFreeEntry(), syVRAMCacheReload() and TickCount.

Referenced by btActionRunBuild(), btAwardSpoils(), btIntroAnnounceEncounter(), btPlaybackRunAll(), btProcessTurnEnd(), btRun(), btStagingDispatchAction(), btStagingRunFlee() and btStagingRunMessages().

Definition at line 48 of file battle_playback_queue.c.

btMessageWaitForAdvanceAt

Sint32 btMessageWaitForAdvanceAt(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.

References mnMessageAllTypedStub(), mnWindowSpriteGetPointerTilesStub(), PerWork, Sint32, syIOWriteQueueClearBits16(), syIOWriteQueueSetBits16(), syOAMAddSpriteAtDepth(), sySynch(), syVRAMCacheAllocateEntry(), syVRAMCacheFreeEntry(), syVRAMCacheReload() and TickCount.

Referenced by btRun().

Definition at line 100 of file battle_playback_queue.c.

btMessageWaitForTyping

void btMessageWaitForTyping(void)

Waits until the battle message has typed out, then marks the next message (BATTLE_MESSAGE_STATE.marked).

References mnMessageAllTypedStub() and sySynch().

Referenced by btActionRunBuild().

Definition at line 138 of file battle_playback_queue.c.

btUnitRemoveEnemy

Sint32 btUnitRemoveEnemy(Sint32 unitId)

Takes an enemy out of the battle at once, one that leaves rather than falls.

References btObjectGet(), btObjectMarkForRelease(), btObjectRemoveFromLists(), fdActorReleaseStub(), gmUnitGet(), gmUnitSetHpStub() and Sint32.

Referenced by btPlaybackRun() and btPlaybackRunAll().

Definition at line 146 of file battle_playback_queue.c.

btPlaybackGrantDjinnBonus

void btPlaybackGrantDjinnBonus(BATTLE_PLAYBACK_STATE *runtime, Uint32 operand)

Grants the Djinn bonus for the rest of the action.

Referenced by btPlaybackRun() and btPlaybackRunAll().

Definition at line 166 of file battle_playback_queue.c.

btPlaybackRunAll

Uint32 btPlaybackRunAll(void)

Runs the queued battle events in order, then resets the queue.

References btEnemyRecordDefeat(), btMessageWaitForAdvance(), btMotionFlashHit(), btMotionShowDowned(), btObjectGet(), btObjectRemoveFromLists(), btObjectUpdatePose(), btPlaybackGrantDjinnBonus(), btPlaybackReset(), btUnitBuildStatusFlags(), btUnitClearStatuses(), btUnitRemoveEnemy(), mnBattleMessageShowAndWaitStub(), mnMessageArgumentClearAllStub(), mnMessageArgumentPushStub(), mnPartyStatusDrawStub(), Sint32 and sySoundPlayStub().

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

Definition at line 172 of file battle_playback_queue.c.

btPlaybackPush

void btPlaybackPush(Uint32 opcode, Uint32 operand)

Queues one playback command with its operand. Nothing checks the queue's capacity.

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

Definition at line 258 of file battle_playback_queue.c.