Alchemy
Loading...
Searching...
No Matches

playback.c

Go to the documentation of this file.
1/// @file
2/// Battle events played over frames, BattleEvent_Playback.
3/// Part of battle.c, the battle object, compiled only through it.
4
6
7/// Sets DMA3 three times over, stopping it, then calls the IRQ return
8/// instruction's word as a routine.
9/// Nothing in this game calls it.
10/// XXX: _call_via_r0 is given the value of IwramIrqModeWord, the instruction
11/// `orr r3, r3, #0x92` in runtime.s, not its address, so it would branch to
12/// 0xe3833092; a caller in another edition, or the same function in The Lost
13/// Age, would show what it was meant to run.
19}
20
21/// Starts playback of the plan's targets when the effect's blow lands.
22/// Reached as EFFECT_SHOW_DAMAGE(hitSound), through
23/// BattleEventRuntime_BeginPhaseFar, from the effects (see the folder README).
24/// Only while playback is idle: sets the phase to
25/// BATTLE_PLAYBACK_RESOLVE_TARGET, and a nonzero cue to pendingCue.
26/// cue : the hit's sound (an SE_ id); zero keeps the one set
28 struct BattleEventState *events;
29
30 events = &gBattleWork->events;
31 if (events->phase == BATTLE_PLAYBACK_IDLE) {
33 if (cue != 0) {
34 events->pendingCue = cue;
35 }
36 }
37}
38
39/// Empties the event queue and schedules playback of the events queued next,
40/// with no targets to resolve.
41/// Called before a Djinni is set (BattleCommand_BuildPlan) and for the Djinn
42/// the round's and a turn's end show (Battle_ProcessRoundEnd,
43/// BattleUnit_ProcessTurnEnd), each followed by
44/// BattleEventRuntime_WaitForReady. Sets the phase to BATTLE_PLAYBACK_DISPATCH
45/// and gBattleWork->plan's targetCount to 0, so playback goes to
46/// BATTLE_PLAYBACK_READY once the queue is played; adds BattleEvent_Playback as
47/// a scheduler callback and returns the scheduler's result. frames : the delay
48/// before the first event
50 struct BattleEventState *events;
51
52 events = &gBattleWork->events;
53 events->queue.count = 0;
54 events->eventIndex = 0;
55 events->timer = frames;
59}
60
61// BattleEvent_Playback's waits, in BattleEventState.phase beside the phases
62// battle_event.h names.
63#define PLAY_MESSAGE 3 ///< waits for the message, then for the player
64#define PLAY_ADVANCE 5 ///< shows the arrow and waits for the player
65#define PLAY_HIT 10 ///< flashes the unit that was hit
66#define PLAY_FELLED 11 ///< greys a fallen enemy and dissolves it
67#define PLAY_MESSAGE_ADD 13 ///< waits for the message, then goes straight on
68
69/// PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept
70/// apart from the counts of the fall itself (0 to 36).
71#define FELLED_FLASH 0x400
72/// The Djinn bonus's colour cycle lasts 30 frames.
73#define FELLED_FLASH_FRAMES 30
74
75/// Plays the plan's targets one at a time: resolves the next target with
76/// BattleTargetExec, then plays the events it queued over the frames that
77/// follow, until every target is done.
78/// Runs each frame as a scheduler callback (priority 0xc80), added by the
79/// staging runners in staging.c and by BattleEventRuntime_SchedulePhase, and
80/// removed by BattleEventRuntime_WaitForReady. Idle until
81/// BattleEventRuntime_BeginPhase or the wait starts it. Advances
82/// gBattleWork->events (phase, eventIndex, timer, queue.targetIndex, actorId,
83/// displaySource, displayEntry, flags); plays the sounds, message arguments,
84/// messages, flashes, falls and redraws as BattleEv_DispatchQueued does,
85/// without waiting. Each pass of its loop handles one phase; a phase that has
86/// to wait for a later frame returns.
88 u16 selection[8];
89 struct AnimationObject *records[4];
90 struct BattleWork *work = gBattleWork;
91 struct BattleEventState *events = &work->events;
92
93 /// Clears a sprite's tiles in OBJ VRAM, at its VRAM cache entry's offset;
94 /// the last step of a fallen enemy's dissolve.
95 void BattleSprite_ClearTiles(struct AnimationObject * record, s32 unused) {
96 u8 *tiles = (u8 *)OBJ_VRAM0 + gVramBlockCache[record->slot].offset;
97
98 Iwram_ClearWords(tiles, record->width * record->height);
99 }
100
101 // Idle until the effect's blow lands; ready once every target is played.
102 if (work->events.phase == BATTLE_PLAYBACK_IDLE)
103 return;
104 for (;;) {
105 if (events->phase == BATTLE_PLAYBACK_READY)
106 return;
107 if (events->phase == BATTLE_PLAYBACK_RESOLVE_TARGET) {
108 // Resolve the next target, which queues its events, then play them;
109 // with none left, playback is ready.
110 if (events->queue.targetIndex < work->plan.targetCount) {
111 events->queue.count = 0;
112 events->eventIndex = 0;
113 events->timer = 0;
114 BattleTargetExec(&work->plan, events->queue.targetIndex);
115 events->queue.targetIndex++;
117 } else {
119 }
120 } else if (events->phase == BATTLE_PLAYBACK_DISPATCH) {
121 // Play the queued events in order. The timer delays the next one; an
122 // event that has to wait (a message, a hit, a fall) changes the phase,
123 // which ends the loop, and its phase comes back here when done.
124 while (events->eventIndex < events->queue.count) {
125 {
126 s32 eventIndex = events->eventIndex;
127
128 if (events->phase != BATTLE_PLAYBACK_DISPATCH)
129 break;
130 if (events->timer != 0) {
131 events->timer--;
132 return;
133 }
134 switch (events->queue.opcodes[eventIndex]) {
137 break;
140 events->queue.operands[eventIndex]);
141 break;
145 break;
149 break;
154 break;
159 break;
162 break;
163 // A negative message shows nothing and only waits for the player.
164 // The key latch is cleared so that only a press after the message
165 // goes on.
167 if ((s32)events->queue.operands[eventIndex] >= 0)
169 events->phase = PLAY_MESSAGE;
171 break;
173 if ((s32)events->queue.operands[eventIndex] >= 0)
175 events->phase = PLAY_MESSAGE_ADD;
176 break;
179 break;
182 events->queue.operands[eventIndex]);
183 break;
184 // The hit's sound, then the damage pose and PLAY_HIT's flashes.
185 case BATTLE_EVENT_HIT:
186 if (events->pendingCue > 0)
188 events->actorId = events->queue.operands[eventIndex];
191 events->phase = PLAY_HIT;
192 events->timer = 0;
193 break;
194 // The spoils are counted and the unit reset; a party member lies
195 // down, an enemy keeps its damage pose and falls in PLAY_FELLED.
196 case BATTLE_EVENT_DEFEAT: {
197 struct BattleUnit *unit;
198 struct AnimationObject *record;
199 s32 recordIndex;
200
201 events->actorId = events->queue.operands[eventIndex];
202 BattleEnemy_RecordDefeat(events->actorId, events->flags);
204 unit = UnitGetFar(events->actorId);
205 for (recordIndex = 0;
206 (record = GetMotionRecord(
207 BattleObjGet(events->actorId)->object, recordIndex)) != 0;
208 recordIndex++) {
209 if (unit->side != BATTLE_UNIT_ENEMY)
211 else
213 }
214 if (unit->side == BATTLE_UNIT_ENEMY) {
215 events->phase = PLAY_FELLED;
216 events->timer = 0;
217 }
218 break;
219 }
222 break;
224 struct BattleObj *slot;
225
227 events->queue.operands[eventIndex],
228 BattleObjGet(events->queue.operands[eventIndex]));
229 slot = BattleObjGet(events->queue.operands[eventIndex]);
232 events->queue.operands[eventIndex]));
234 events->queue.operands[eventIndex]);
235 break;
236 }
237 }
238 events->eventIndex++;
239 }
240 }
241 // The whole queue played: on to the next target.
242 if (events->phase == BATTLE_PLAYBACK_DISPATCH)
244 } else if (events->phase == PLAY_MESSAGE ||
245 events->phase == PLAY_MESSAGE_ADD) {
246 // Wait until the message finishes appearing. The arrow's resource entry
247 // is fetched again (-1) and its wait timed from now.
248 if (UiWork_IsCompleteFar() == 0)
249 return;
250 if (events->phase == PLAY_MESSAGE_ADD) {
252 events->timer = 0;
253 } else {
254 events->phase = PLAY_ADVANCE;
255 events->displaySource = -1;
256 events->timer = gFrameTick;
257 }
258 } else if (events->phase == PLAY_ADVANCE) {
259 // Show the arrow, as BattlePresentation_WaitForAdvance does, and wait
260 // for the player: B held or an advance key pressed goes on; after ten
261 // ticks, a held advance key does too. The arrow is an 8 by 16,
262 // 256-colour sprite (attribute 0 0xa000) cycling eight frames of
263 // gBattlePres_AdvanceArrowTiles, one every four frames.
264 struct BattlePromptSprite *prompt = &events->displayEntry;
265 u8 *arrowTiles = gBattlePres_AdvanceArrowTiles;
266 s32 frameTiles = (s32)arrowTiles + ((gFrameCount >> 2) & 7) * 128;
267 struct BattleDisplayWork *display = gBattleDisplayWork;
268 struct UiWindow *window = display->window;
269 struct BattleDisplayOffset *offset = display->offset;
270 s32 x = 0;
271
272 if (events->displaySource == -1)
273 events->displaySource = work->promptSlot;
277 ((u32 *)prompt)[1] = 0xa000;
278 ((u32 *)prompt)[2] = x;
279 prompt->tile = VramCache_Reload(events->displaySource, frameTiles);
280 x = window->x * 8 + (offset->x >> 8) + 4;
281 prompt->x = x;
282 prompt->y = Trig_Sin(gFrameCount << 12) / 32768 + window->y * 8 +
283 (offset->y >> 8) + 6;
285 ((u32)(gFrameTick - events->timer) > 10 &&
289 events->timer = 0;
290 } else {
291 Runtime_PushSlotEntry(prompt, 240);
292 return;
293 }
294 } else if (events->phase == PLAY_HIT) {
295 // Nine frames, counted by the timer from 0 to 8: at 1 and 5 the unit
296 // turns white and its party panel lights; at 3 and 7 it takes back its
297 // own colours and the panel goes dark.
298 if (events->timer & 1) {
299 if (events->timer & 2) {
300 struct BattleObj *slot;
301
302 selection[0] = BATTLE_UNIT_LIST_END;
303 slot = BattleObjGet(events->actorId);
306 } else {
307 selection[0] = events->actorId;
308 selection[1] = BATTLE_UNIT_LIST_END;
311 }
313 }
314 events->timer++;
315 if (events->timer <= 8)
316 return;
318 events->timer = 0;
319 } else if (events->phase == PLAY_FELLED) {
320 // A fallen enemy. Its timer runs: with the Djinn bonus first, from
321 // FELLED_FLASH, 30 frames cycling colour modes 1 to 5 every 8 frames,
322 // with the defeat sound numbered one before its own; then from 0: grey
323 // (mode 6) and its own defeat sound, out of the lists at 4, and from 5
324 // the dissolve, four steps a frame, until its tiles are cleared and its
325 // object released.
326 if (events->timer == 0 || events->timer >= FELLED_FLASH) {
327 s32 colorMode = SPRITE_COLOR_GREY;
328
329 if (events->timer == 0 && events->flags != 0) {
331 UnitGetFar(events->actorId)->classId);
332
333 if (kind >= 0) {
334 kind--;
335 if (kind < 0)
336 kind = 0;
338 }
339 events->timer = FELLED_FLASH;
340 }
341 if (events->timer > FELLED_FLASH + FELLED_FLASH_FRAMES - 1)
342 events->timer = 0;
343 if (events->timer == 0) {
345 UnitGetFar(events->actorId)->classId);
346
347 if (kind >= 0)
349 }
350 if (events->timer >= FELLED_FLASH)
351 colorMode = (events->timer - FELLED_FLASH) / 8 % 5 + 1;
352 // Recolour every layer's first entry and redraw its frame (255).
353 if (colorMode == SPRITE_COLOR_GREY || (events->timer & 7) == 0) {
354 struct AnimationObject *record;
355 s32 recordIndex;
356 struct AnimationObject **slot;
357 s32 lastFrameMask;
358
359 for (recordIndex = 0, slot = records, lastFrameMask = 0xff;
360 (record = GetMotionRecord(BattleObjGet(events->actorId)->object,
361 recordIndex)) != 0;
362 recordIndex++) {
363 struct AnimationEntry *child;
364 u8 previousFrame;
365
366 *slot++ = record;
367 child = record->entries[0];
368 previousFrame = child->frame;
369 child->param = colorMode;
370 child->frame = previousFrame | lastFrameMask;
371 }
372 }
373 events->timer++;
374 return;
375 }
376 if (events->timer == 4) {
378 events->timer++;
379 return;
380 }
381 if (events->timer > 4) {
382 // The dissolve: steps 0 to 127 of render_animated_tile_frame, four a
383 // frame from timer 5 to 36; at 37 the tiles are cleared, the object
384 // released, and the queue goes on.
385 struct BattleObj *slot;
386 struct AnimationObject *record;
387 s32 count;
388 s32 step;
389 s32 base;
390
391 slot = BattleObjGet(events->actorId);
392 slot->fading = 1;
393 for (count = 0; (record = GetMotionRecord(slot->object, count)) != 0;
394 count++)
395 records[count] = record;
396 base = events->timer * 4;
397 step = base - 20;
398 if (step > 127) {
399 s32 recordIndex;
400
401 for (recordIndex = 0; recordIndex < count; recordIndex++)
402 BattleSprite_ClearTiles(records[recordIndex], 0);
405 events->timer = 0;
406 return;
407 }
408 {
409 s32 recordIndex;
410
411 for (recordIndex = 0; recordIndex < count; recordIndex++) {
412 render_animated_tile_frameFar((u8 *)records[recordIndex], step);
413 render_animated_tile_frameFar((u8 *)records[recordIndex],
414 base - 19);
415 render_animated_tile_frameFar((u8 *)records[recordIndex],
416 base - 18);
417 render_animated_tile_frameFar((u8 *)records[recordIndex],
418 base - 17);
419 }
420 }
421 events->timer++;
422 return;
423 }
424 events->timer++;
425 return;
426 }
427 }
428}
429
430/// Stops playback and empties the event queue.
431/// Called when an action is planned (BattleCommand_BuildPlan), after a queue
432/// is played (BattleEv_DispatchQueued, BattleEventRuntime_WaitForReady), and
433/// before playback is scheduled (BattleCommand_BuildPlan, turn_end.c). Sets
434/// gBattleWork->events' phase to BATTLE_PLAYBACK_IDLE, clears the queue, the
435/// event index, the timer, the target index and the flags (the Djinn bonus),
436/// and sets the hit sound back to SE_HEAVY_IMPACT.
438 struct BattleEventState *events;
439
440 events = &gBattleWork->events;
441 events->phase = BATTLE_PLAYBACK_IDLE;
442 events->queue.count = 0;
443 events->eventIndex = 0;
444 events->timer = 0;
445 events->queue.targetIndex = 0;
446 events->pendingCue = SE_HEAVY_IMPACT;
447 events->flags = 0;
448}
449
450/// Waits, a frame at a time, until BattleEvent_Playback has played every
451/// target, then removes the callback and resets the events.
452/// Called after the effect by the staging runners in staging.c, and after a
453/// Djinn's effect by BattleCommand_BuildPlan and turn_end.c. Playback still
454/// idle (the effect never called EFFECT_SHOW_DAMAGE) is started here.
455#ifdef UBFIX
457#else
459#endif
460 s32 state;
461 struct BattleEventState *events;
462
463 events = &gBattleWork->events;
464 state = events->phase;
465 if (state == BATTLE_PLAYBACK_IDLE) {
468 }
469 if (state != BATTLE_PLAYBACK_READY) {
470 do {
471 WaitFrames(1U);
472 } while (events->phase != BATTLE_PLAYBACK_READY);
473 }
476}
477
478#undef FELLED_FLASH_FRAMES
@ SPRITE_COLOR_WHITE
solid colour 15, white
Definition animspr.h:26
@ SPRITE_COLOR_GREY
greyscale
Definition animspr.h:25
u32 BattleClass_GetDefeatSoundKind(s32 index)
Returns the class's defeat-sound kind, 0 to 4, or -1 for none; a fallen enemy's sound is SE_146 plus ...
Definition classes.c:11
s32 BattleActor_ResetRuntimeFields(s32 unitId)
Clears every ailment and stat change of a unit that goes down, recalculates its stats and rebuilds it...
Definition events.c:19
s32 BattleActor_DestroyTemporaryObject(s32 unitId)
Takes an enemy out of the battle at once (one that leaves rather than falls): its HP to 0,...
Definition events.c:200
void BattleEv_GrantDjinnBonus(struct BattleEventState *runtime, u32 operand)
The BATTLE_EVENT_DJINN_BONUS event: grants the Djinn bonus for the rest of the action.
Definition events.c:226
s32 BattlePres_SetActorModeAndAction(s32 unitId)
Sets unit id's pose to match its state: held (asleep, stunned or unable to move) or down,...
Definition objects.c:294
struct BattleObj * BattleObjGet(s32 unitId)
Returns unitId's battle object, through its place, or null for a unit with no place.
Definition objects.c:480
s32 BattleUnit_BuildStatusFlags(s32 unitId, struct BattleObj *battleObject)
Builds the status icon bits of unit id's ailments into its battle object's activeConditions,...
Definition objects.c:155
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...
Definition objects.c:543
void * GetMotionRecord(struct MotionObject *object, s32 recordIndex)
Returns sprite recordIndex of an object (0 only, for a single sprite), or null when it has no such sp...
Definition objects.c:628
s32 BattleMotion_GetSlotPalette(s32 id)
Returns the palette of unit id's battle object.
Definition sprites.c:32
@ POSE_PARTY_HELD
asleep, stunned or held; also a downed member
Definition battle.h:175
@ POSE_ENEMY_DOWN
a downed enemy stays in its damage pose
Definition battle.h:177
@ POSE_DAMAGE
taking damage
Definition battle.h:176
u8 gBattlePres_AdvanceArrowTiles[]
void _call_via_r0(u32 routine)
#define BATTLE_OPTIONS
@ BATTLE_PLAYBACK_RESOLVE_TARGET
resolves the next target's events
@ BATTLE_PLAYBACK_READY
every target has been played
@ BATTLE_PLAYBACK_IDLE
paused until the effect resumes it
@ BATTLE_PLAYBACK_DISPATCH
plays the queued events in order
@ 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
@ BATTLE_EVENT_SOUND
plays a sound
What every part of the battle object shares: its includes, in their original order,...
#define VALUE_ABILITY_NAME
#define VALUE_UNIT_NAME
#define VALUE_ITEM_NAME
#define VALUE_NUMBER
#define KEY_ADVANCE
The keys that take the player on past a message: A, B, L and R.
@ BATTLE_UNIT_LIST_END
ends the list
@ BATTLE_UNIT_ENEMY
@ OWNER_ACTION_ID_MASK
Definition battle_unit.h:14
struct BattleWork * gBattleWork
struct BattleDisplayWork * gBattleDisplayWork
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
Definition dma.h:62
s32 AnimationObjects_SelectAnimationFar(struct AnimationObject *state, s32 flags)
void ObjectDispatch_SelectAnimationFar(void *raw, s32 no)
void render_animated_tile_frameFar(u8 *obj, u32 pos)
Far call to Map_RenderAnimatedTileFrame.
struct BattleUnit * UnitGetFar(u32 owner)
void AudioCommand_PlayFar(s32 id)
s32 BattleLayout_HighlightPartyPanelsFar(u16 *ids)
void PartyStatusDrawFar(s32 flags)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
s32 UiWork_IsCompleteFar(void)
void UiWork_ClearValueNameTablesFar(void)
void UiText_PrepareMessageWorkFar(s32 argument)
s32 Trig_Sin(s32 angle)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
Definition frame.c:97
u32 gFrameTick
Counted up by every VBlank.
volatile u32 gFrameCount
Frames WaitFrames has finished.
void IoWriteQueue_ClearBits16(u32 address, u32 value)
Queues clearing a halfword register's bits.
Definition io_queue.c:33
void IoWriteQueue_SetBits16(u32 address, u32 value)
Queues setting a halfword register's bits.
Definition io_queue.c:27
#define OBJ_VRAM0
Sprite tile memory, as pret names it: the 32 KB from 0x06010000.
Definition io_reg.h:170
@ KEY_B
Definition io_reg.h:244
#define REG_DMA3
Definition io_reg.h:153
#define DMA_COPY_WORDS(n)
Definition io_reg.h:226
#define REG_WINOUT
Definition io_reg.h:82
const u32 IwramIrqModeWord
@ ITEM_ID_MASK
Definition item.h:16
static s32 Iwram_ClearWords(void *destination, s32 size)
Definition iwram_call.h:55
u32 gKeysPressedLatch
Presses since a reader last cleared it.
#define PLAY_FELLED
greys a fallen enemy and dissolves it
Definition playback.c:66
s32 BattleEventRuntime_SchedulePhase(s32 frames)
Empties the event queue and schedules playback of the events queued next, with no targets to resolve.
Definition playback.c:49
s32 BattleEventRuntime_WaitForReady(void)
Waits, a frame at a time, until BattleEvent_Playback has played every target, then removes the callba...
Definition playback.c:458
void BattleEventRuntime_Reset(void)
Stops playback and empties the event queue.
Definition playback.c:437
#define PLAY_ADVANCE
shows the arrow and waits for the player
Definition playback.c:64
#define FELLED_FLASH_FRAMES
The Djinn bonus's colour cycle lasts 30 frames.
Definition playback.c:73
#define FELLED_FLASH
PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept apart from the counts of th...
Definition playback.c:71
void BattleEventRuntime_BeginPhase(s32 cue)
Starts playback of the plan's targets when the effect's blow lands.
Definition playback.c:27
void BattleEvent_Playback(void)
Plays the plan's targets one at a time: resolves the next target with BattleTargetExec,...
Definition playback.c:87
#define PLAY_HIT
flashes the unit that was hit
Definition playback.c:65
#define PLAY_MESSAGE_ADD
waits for the message, then goes straight on
Definition playback.c:67
#define PLAY_MESSAGE
waits for the message, then for the player
Definition playback.c:63
void Dma_StopAllThenRunHook(void)
Sets DMA3 three times over, stopping it, then calls the IRQ return instruction's word as a routine.
Definition playback.c:14
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
Definition render.c:79
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
Definition scheduler.c:102
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146
#define SE_146
Definition songs.h:139
#define SE_MENU_CURSOR_MOVE
Definition songs.h:104
#define SE_HEAVY_IMPACT
Definition songs.h:127
s32 BattleEnemy_RecordDefeat(s32 unitId, s32 djinnBonus)
Counts a fallen enemy and adds its coins, experience and perhaps its item to the spoils.
Definition spoils.c:99
s32 BattleMotion_SetRecordChildValues(struct MotionObject *object, s32 colorMode)
Draws every sprite of an object in a colour mode (enum SpriteColorMode): colorMode on each sprite's f...
Definition staging.c:830
void BattleActor_RemoveFromLists(s32 unitId)
Takes unit id out of the party's or the enemies' list and out of this round's actions,...
Definition staging.c:1019
One animation layer of a sprite: its animation id, frames, running script and timer.
Definition animspr.h:37
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
Definition animspr.h:45
u8 frame
frame shown, frameBase plus the facing offset; 255 none
Definition animspr.h:53
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
u8 width
pixels; zero marks a free sprite
Definition animspr.h:119
u8 height
pixels
Definition animspr.h:120
u8 slot
VRAM cache entry holding its tiles.
Definition animspr.h:112
struct AnimationEntry * entries[4]
its layers; empty ones null
Definition animspr.h:130
u8 count
layers in use, up to the last one present
Definition animspr.h:129
The battle message's text channel, as far as its offset in the window.
Definition battle_work.h:30
u16 x
1/256 pixels
Definition battle_work.h:32
u16 y
1/256 pixels
Definition battle_work.h:33
The battle message display: its window, its text channel and whether the next message is marked.
Definition battle_work.h:38
s32 marked
set by BATTLE_EVENT_MARK; passed to the next message
Definition battle_work.h:41
struct UiWindow * window
the message window
Definition battle_work.h:39
struct BattleDisplayOffset * offset
its text channel
Definition battle_work.h:40
s32 targetIndex
the plan's next target to resolve
u32 operands[BATTLE_EVENT_CAPACITY]
s32 count
events queued
u8 opcodes[BATTLE_EVENT_CAPACITY]
The battle event queue and the state of its playback: the phase, the event playing and the advance ar...
Definition battle_work.h:51
struct BattleEventQueue queue
Definition battle_work.h:52
s32 timer
frames to wait, or frames waited for the advance key
Definition battle_work.h:55
struct BattlePromptSprite displayEntry
the advance arrow
Definition battle_work.h:56
s32 actorId
the unit of the hit or defeat being played
Definition battle_work.h:58
s32 phase
enum BattlePlaybackPhase, or a message phase
Definition battle_work.h:53
s32 pendingCue
hit sound (an SE_ id), played on the next hit
Definition battle_work.h:59
s32 displaySource
the arrow's resource entry; -1 until it is shown
Definition battle_work.h:57
s32 eventIndex
the next queued event to play
Definition battle_work.h:54
s32 flags
bits: 0 Djinn bonus (EVENT_FLAG_DJINN_BONUS), for the enemies that fall during the action
Definition battle_work.h:62
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct MotionObject * object
NULL once released.
s8 targetCount
targets in targetIds
Definition battle_type.h:28
One OAM entry in a sprite list: the arrow that waits for the player to advance a battle message.
Definition battle_work.h:16
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 side
BATTLE_UNIT_ABSENT (0), BATTLE_UNIT_ENEMY (1) or BATTLE_UNIT_PARTY (2).
u8 classId
Who the unit is: a character's id (ISAAC to JENNA, below 8) or an enemy's id (BattleUnitSet).
The battle's own work: its enemies, units and their objects, the turn's actions, the spoils,...
Definition battle_work.h:71
u8 partyStatus
PARTY_STATUS_SUMMONS or PARTY_STATUS_NO_SUMMONS.
Definition battle_work.h:86
s32 promptSlot
resource entry of the advance arrow's tiles; -1 for none
struct BattlePlan plan
struct BattleEventState events
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
u16 y
tiles
Definition uiwindow.h:16
u16 x
tiles
Definition uiwindow.h:15
u16 offset
bytes from the start of OBJ VRAM
Definition vram_tab.h:25
s32 BattleTargetExec(struct BattlePlan *plan, s32 slot)
Applies the planned ability to one of its targets: first its damage or healing, then its added effect...
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
Definition vram_cache.c:238
struct VramBlockCacheEntry gVramBlockCache[]