76#define ADVANCE_ARROW_ATTR0 0xa400
106 prompt = &promptStorage;
108 for (frame = 0;; frame++) {
121 prompt->
attributes.fields.attr2 = (attr2 & ~0x3ff) | tile;
123 x = (
u16)((window->
x * 8 + (offset->
x >> 8) + 4) & 0x1ff);
125 prompt->
attributes.fields.attr1 = (attr1 & ~0x1ff) |
x;
128 window->
y * 8 + (offset->
y >> 8) + 6;
165 prompt = &promptStorage;
172 ((
s32 *)prompt)[2] = 0;
219#define EVENT_FLAG_DJINN_BONUS 1
247 for (eventIndex = 0; eventIndex < queue->
count; eventIndex++) {
325 queue->
opcodes[index] = opcode;
327 queue->
count = index + 1;
331#undef ADVANCE_ARROW_ATTR0
s32 BattleActor_ResetRuntimeFields(s32 unitId)
Clears every ailment and stat change of a unit that goes down, recalculates its stats and rebuilds it...
#define ADVANCE_ARROW_ATTR0
The advance arrow's attribute 0: a 256-colour, semi-transparent tall sprite; with attribute 1's size ...
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,...
#define EVENT_FLAG_DJINN_BONUS
BattleEventState.flags bit 0: a Djinni struck a weakness, so enemies that fall pay the Djinn bonus (B...
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 BattlePres_SetActorModeAndAction(s32 unitId)
Sets unit id's pose to match its state: held (asleep, stunned or unable to move) or down,...
struct BattleObj * BattleObjGet(s32 unitId)
Returns unitId's battle object, through its place, or null for a unit with no place.
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...
u8 gBattlePres_AdvanceArrowTiles[]
@ BATTLE_EVENT_DEFEAT
the unit falls; an enemy fades out
@ BATTLE_EVENT_UNIT_NAME
a unit's name for the next message
@ BATTLE_EVENT_MARK
sets gBattleDisplayWork->marked
@ BATTLE_EVENT_DRAW_STATUS
redraws the party's status
@ BATTLE_EVENT_DJINN_BONUS
later defeats give the Djinn bonus
@ BATTLE_EVENT_HIT
the unit flinches and flashes
@ BATTLE_EVENT_CLEAR_ARGUMENTS
forgets the names and numbers pushed
@ BATTLE_EVENT_ABILITY_NAME
an ability's name for the next message
@ BATTLE_EVENT_REFRESH_UNIT
the unit's status icons, colour, pose
@ BATTLE_EVENT_REMOVE_UNIT
an enemy leaves the battle
@ BATTLE_EVENT_MESSAGE
a message, waiting for the player
@ BATTLE_EVENT_MESSAGE_NO_WAIT
a message, going straight on
@ BATTLE_EVENT_ITEM_NAME
an item's name for the next message
@ BATTLE_EVENT_NUMBER
a number for the next message
What every part of the battle object shares: its includes, in their original order,...
#define VALUE_ABILITY_NAME
#define KEY_ADVANCE
The keys that take the player on past a message: A, B, L and R.
struct BattleWork * gBattleWork
struct BattleDisplayWork * gBattleDisplayWork
void ObjectDispatch_ReleaseFar(struct DispatchObject *obj)
struct BattleUnit * UnitGetFar(u32 owner)
void Unit_SetHpFar(struct BattleUnit *unit, s32 hp)
void UnitCalcFar(s32 owner)
void AudioCommand_PlayFar(s32 id)
s32 Ui_GetTableWordZeroFar(s32 no)
void PartyStatusDrawFar(s32 flags)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
s32 UiWork_IsCompleteFar(void)
void UiText_ShowMessageAndWaitCoreFar(s32 argument)
void UiWork_ClearValueNameTablesFar(void)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
void IoWriteQueue_ClearBits16(u32 address, u32 value)
Queues clearing a halfword register's bits.
void IoWriteQueue_SetBits16(u32 address, u32 value)
Queues setting a halfword register's bits.
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysPressed
Keys that went down this frame.
void BattleEventRuntime_Reset(void)
Stops playback and empties the event queue.
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
#define SE_MENU_CURSOR_MOVE
s32 BattleEnemy_RecordDefeat(s32 unitId, s32 djinnBonus)
Counts a fallen enemy and adds its coins, experience and perhaps its item to the spoils.
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...
void BattleActor_RemoveFromLists(s32 unitId)
Takes unit id out of the party's or the enemies' list and out of this round's actions,...
void BattleMotion_ShowDowned(s32 unitId)
Shows a downed unit: a party member lies down, an enemy keeps its damage pose, turns grey,...
u16 attr1
OAM attribute 1: x in the low nine bits.
u16 attr3
cleared with attr2 each frame
u16 attr2
OAM attribute 2: tile in the low ten bits.
u16 attr0
OAM attribute 0: y in the low byte.
One OAM entry for Runtime_PushSlotEntry.
struct AdvanceSprite * next
never set here
union AdvanceSprite::@053115132014001324162033173333120206315020022315 attributes
The battle message's text channel, as far as its offset in the window.
s32 marked
set by BATTLE_EVENT_MARK; passed to the next message
struct UiWindow * window
the message window
struct BattleDisplayOffset * offset
its text channel
The battle event queue: up to 64 events, each an opcode (enum BattleEventOpcode) and one operand,...
u32 operands[BATTLE_EVENT_CAPACITY]
u8 opcodes[BATTLE_EVENT_CAPACITY]
The battle event queue and the state of its playback: the phase, the event playing and the advance ar...
struct BattleEventQueue queue
s32 pendingCue
hit sound (an SE_ id), played on the next hit
s32 flags
bits: 0 Djinn bonus (EVENT_FLAG_DJINN_BONUS), for the enemies that fall during the action
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct MotionObject * object
NULL once released.
s16 active
Set by BattleObj_MarkForRelease: the object is released with the others by BattleMotion_DestroyAllSlo...
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 agilityTurns
the Agility change's turns left, 5 when cast
u8 immobile
set by Ground: the next action is lost
s8 elementLevels[4]
A summon's boost to each element: the Djinn of that element the summon spent, adding (n * n + n) * 5 ...
u8 grimReaper
The Grim Reaper's countdown: 7 when cursed, down one at each turn's end; at 0 the unit falls.
u8 psySeal
bits: 7..3 Luff (16 when cast, minus 8 a turn) | 2..0 Bind's turns (7 when cast).
u8 side
BATTLE_UNIT_ABSENT (0), BATTLE_UNIT_ENEMY (1) or BATTLE_UNIT_PARTY (2).
s8 poison
1 poisoned, 2 deadly poison
u8 haunt
set while an evil spirit grips the unit
struct BattleElementStats element[4]
Power and resistance in each element, 0 to 200, after equipment, element levels and Resistance stages...
s8 challenge
Set by the challenge effect: an enemy with it never chooses to flee.
s8 agilityStage
The Agility stage: -4 (Vine) to 8 (Zephyr, twice the Agility).
u8 refrain
Regenerate's turns left, 7 when cast.
s8 reflect
Reflect's turns left, 7 when cast.
u8 equipBonus[2]
The totals of equipment effects 23 (unleash chance) and 24 that UnitCalc sums; TBS never reads them b...
u8 attackTurns
Each stat change: the turns it has left, and its stage (UnitCalc: an eighth of Attack,...
u8 delusion
Delusion to sleep: the turns each status has left, 7 when it lands; each may end sooner at the end of...
u8 ready
Kite's extra action: 2 when cast, down one at each turn's end; while nonzero UnitCalc gives the unit ...
u8 partyStatus
PARTY_STATUS_SUMMONS or PARTY_STATUS_NO_SUMMONS.
struct BattleEventState events
A cursor or prompt sprite: a list link and its OAM attributes as fields.
A field object as the object dispatcher's far calls take it.
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
struct AdvanceSprite::@053115132014001324162033173333120206315020022315::@032333004100157315263147312361357251135164165300 fields
u8 bytes[8]
the y byte can change without replacing attribute 0
u32 words[2]
paired attributes, initialized together
s32 VramCache_AllocEntry(s32 size)
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).