Alchemy
Loading...
Searching...
No Matches

transition.c

Go to the documentation of this file.
1/// @file
2/// The opening transition: the curtain, or the Venus Lighthouse storm.
3/// Part of battle.c, the battle object, compiled only through it.
4
6
7/// The formation the Fusion Dragon leads (row 347 of formatn.tsv, whose first
8/// member is enemy 140), fought on the Venus Lighthouse aerie: it opens with
9/// the storm instead of the curtain.
10#define TRANSITION_STORM_FORMATION 0x15b
11
12/// The curtain's map entries: tile 128 + n of CURTAIN_TILE, palette 15.
13#define TRANSITION_CURTAIN_ENTRY(n) (0xf080 + (n))
14
15/// Fades the screen to black over sixteen frames as every background's
16/// mosaic grows, then shows no layer.
17/// Reached only through its entry in the battle bank's far-call table
18/// (FarCall_BattleTable), which no code in TBS names. Sets REG_BLDCNT to
19/// darken the backgrounds, leaves REG_MOSAIC at its largest and REG_DISPCNT
20/// in mode 1 with every layer off; the four BGxCNT are put back as they were.
21/// It draws four random numbers a frame, which only advances the sequence.
23 /* FAKEMATCH(volatile): the four saved BGxCNT values kept on the stack, each
24 * stored and loaded again as in the ROM; without volatile, 28 of 90
25 * instructions differ in tbs-en. */
26 volatile u16 bg0cnt;
27 volatile u16 bg1cnt;
28 volatile u16 bg2cnt;
29 volatile u16 bg3cnt;
30 s32 mosaicSize;
31 volatile u16 *registerCursor;
32
33 bg0cnt = REG_BG0CNT;
34 REG_BG0CNT = bg0cnt | BGCNT_MOSAIC;
35 registerCursor = &REG_BG0CNT;
36 bg1cnt = *++registerCursor;
37 *registerCursor = bg1cnt | BGCNT_MOSAIC;
38 bg2cnt = *++registerCursor;
39 *registerCursor = bg2cnt | BGCNT_MOSAIC;
40 bg3cnt = *++registerCursor;
41 *registerCursor = bg3cnt | BGCNT_MOSAIC;
42 // 0x21 halfwords on from REG_BG3CNT is REG_BLDCNT.
43 registerCursor += 0x21;
44 *registerCursor = BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 |
48
49 Fade_ToBlack(16);
50 for (mosaicSize = 0; mosaicSize <= 15; mosaicSize++) {
51 Random16();
52 Random16();
53 Random16();
54 Random16();
55 REG_MOSAIC = (mosaicSize << 8) | mosaicSize;
56 WaitFrames(1);
57 }
58
60 WaitFrames(4);
61 registerCursor = &REG_BG0CNT;
62 *registerCursor++ = bg0cnt;
63 *registerCursor++ = bg1cnt;
64 *registerCursor++ = bg2cnt;
65 *registerCursor = bg3cnt;
66 return 0;
67}
68
69/// Builds the perspective plane's 32 by 32 affine map: tiles 0 to 255 in its
70/// first eight rows, 0 to 223 in the next seven, and 0xff in the rest.
71/// The two runs show the background picture's two halves, which the
72/// scanline BG2CNT values (BattleCamera_SetRange) read from character blocks 2
73/// and 3. Called with screen block 7 by BattleBackground_Load and
74/// BattlePresentation_ConfigurePaletteFade.
76 s32 *destination = tilemap;
77 u32 packedIndices;
78 s32 wordIndex;
79
80 // Four tile numbers to a word.
81 packedIndices = 0x03020100;
82 wordIndex = 0;
83 do {
84 wordIndex += 1;
85 *destination++ = packedIndices;
86 packedIndices += 0x04040404U;
87 } while (wordIndex >= 0 && wordIndex <= 63);
88
89 packedIndices = 0x03020100;
90 wordIndex = 0;
91 do {
92 wordIndex += 1;
93 *destination++ = packedIndices;
94 packedIndices += 0x04040404U;
95 } while (wordIndex >= 0 && wordIndex <= 55);
96
97 Iwram_FillWords(destination, 544, -1);
98}
99
100/// Builds BG1's flat map of the same picture: rows 0 to 3 0xffff, rows 4 and
101/// 5 tile 0x3ff, rows 6 to 20 tiles 0x200 to 0x3df in order, then tile 0x3ff.
102/// In 256 colours from character block 0, tile 0x200 is the start of block 2,
103/// where BattleBackground_Load decodes the picture. Called with screen block
104/// 31 (BATTLE_BG1CNT) by BattleBackground_Load and
105/// BattlePresentation_ConfigurePaletteFade.
107 s32 *destination = tilemap;
108 s32 entry;
109 u32 index;
110
111 // Iwram_FillWords counts bytes; the pointer steps in words.
112 Iwram_FillWords(destination, 0x100, -1);
113 destination += 0x40;
114 Iwram_FillWords(destination, 0x80, 0x03ff03ff);
115 entry = (0x0201 << 16) | 0x0200;
116 destination += 0x20;
117 index = 0;
118 do {
119 index++;
120 *destination++ = entry;
121 entry += 0x00020002;
122 } while (index <= 239);
123 Iwram_FillWords(destination, 0x280, 0x03ff03ff);
124}
125
126/// Shows the perspective plane's finished page each frame while the
127/// background is in mode 2: its first line's BG2CNT now, the rest by HBlank
128/// DMA 0, and its affine parameters into BG2PA to BG2Y.
129/// Runs each frame as a scheduler callback, added by BattleBackground_Load
130/// and BattlePresentation_ConfigurePaletteFade; BattleCamera_SetRange builds
131/// the pages.
133 struct BattleAffineHdma *scanlines;
134 u16 *line;
135
137 ->mode == 2) {
138 scanlines = WORK_SLOT(10);
139 line = scanlines->lines[scanlines->page];
140 Io_Write16(line[0], &REG_BG2CNT);
142 &REG_DMA0SAD);
143 Dma_Set(&scanlines->affine, (void *)&REG_BG2PA, DMA_COPY_WORDS(4),
144 REG_DMA3);
145 }
146}
147
148/// Copies one of eight curtain tiles from gBattlePres_TileVariants into
149/// CURTAIN_TILE(0), a new one every four frames while the transition timer
150/// (gDisp) runs from 1 to 32.
151/// XXX: no code in TBS names it; a scheduler or table entry that reaches it
152/// would show which transition used it.
154 u32 variant = *gDisp - 1;
155 if (variant <= 31)
156 Dma_Set(gBattlePres_TileVariants + (variant >> 2) * 32, CURTAIN_TILE(0),
158}
159
160/// Advances the curtain opening by a frame: scrolls BG0 from 32 pixels to 0
161/// over frames 20 to 52, and over frames 0 to 80 turns the camera round to
162/// YAW_PARTY_TURN and zooms it from 180 to 100 percent.
163/// Runs each frame as a scheduler callback added by
164/// BattlePres_RunEntryTransition, which removes it once the encounter is
165/// announced. Advances the timer in gDisp's slot (heap slot 42), and writes
166/// gBgScroll[0].y and the camera's yaw.
168 s32 scroll;
169 struct BattleCamera *camera;
170 u32 *timer;
171 struct BgScroll *offset;
172 u32 frame;
173 u32 next;
174
175 timer = *(u32 **)Ram_Disp;
176 frame = *timer;
177 camera = *(struct BattleCamera **)Ram_CameraWork;
178 scroll = 0x34 - frame;
179 if (scroll > 0x20)
180 scroll = 0x20;
181 offset = (struct BgScroll *)Ram_BgScroll;
182 if (scroll < 0)
183 scroll = 0;
184 offset->y = scroll;
185 // 360 a frame from 0xaf80 reaches 0x12000, YAW_PARTY_TURN, at frame 80.
186 if (frame <= 0x50U)
187 camera->yaw = 45 * frame * 8 + 0xaf80;
188 next = (*timer = *timer + 1);
189 if (next <= 0x50U) {
190 BattlePres_SetupTransitionScene(0, 0, 0, 0xb4 - next);
191 return;
192 }
193 BattlePres_SetupTransitionScene(0, 0, 0, 0x64);
194}
195
196/// Draws a frame of the curtain opening on BG1: over 80 frames a row moves up
197/// from row 13 to row 4 and its vertically flipped twin down to row 20, the
198/// row's tile stepping through CURTAIN_TILE(1) to (8), the last one clear.
199/// Runs each frame as a scheduler callback added by
200/// BattlePres_RunEntryTransition, reading the frame from gDisp's timer;
201/// writes BG1's map in screen block 12.
203 u32 column;
204 s32 transitionFrame;
205 s32 alignedFrame;
206 s32 tileEntry;
207 u32 tileRow;
208 u16 *tilemap;
209
210 transitionFrame = *gDisp;
211 if (transitionFrame >= 0 && transitionFrame <= 79) {
212 tileEntry = (7 & transitionFrame) + 0xf081;
213 // transitionFrame / 8 as signed division rounds it; the frame is never
214 // negative here.
215 if (transitionFrame >= 0) {
216 alignedFrame = transitionFrame;
217 } else {
218 alignedFrame = transitionFrame + 7;
219 }
220 tileRow = 13 - (alignedFrame >> 3);
221 column = 0;
222 tilemap = (u16 *)(BG_SCREEN_BLOCK(12) + (tileRow << 6));
223 do {
224 column++;
225 *tilemap = tileEntry;
226 tilemap++;
227 } while (column != 32);
228
229 // The lower half: the same tile flipped vertically.
230 tileEntry |= 0x800;
231 alignedFrame = transitionFrame;
232 if (transitionFrame < 0) {
233 alignedFrame += 7;
234 }
235 tileRow = (alignedFrame >> 3) + 13;
236 if (tileRow <= 20) {
237 column = 0;
238 tilemap = (u16 *)(BG_SCREEN_BLOCK(12) + (tileRow << 6));
239 do {
240 column++;
241 *tilemap = tileEntry;
242 tilemap++;
243 } while (column != 32);
244 }
245 }
246}
247
248/// Clears REG_BG0VOFS, so that BG0's scroll applies only above the line the
249/// interrupt fires on.
250/// Installed by BattlePres_RunEntryTransition as the VCount interrupt's
251/// handler at line 32, while gBgScroll[0].y holds BG0 scrolled.
253 u32 zero = 0;
254
255 REG_BG0VOFS = zero;
256}
257
258/// The display control and green swap registers, REG_DISPCNT onward.
260 u16 control; ///< REG_DISPCNT
261 u16 greenSwap; ///< the undocumented green swap register after it
262};
263
264/// Opens a battle: the curtain opening, or for the Fusion Dragon the storm
265/// on the Venus Lighthouse aerie; then announces the enemies and leaves the
266/// battle's display set.
267/// Called once by Battle_RunEncounter with the enemy count and formation.
268/// Uses heap slot 42 for the opening's frame timer and frees it; leaves BG1 on
269/// BATTLE_BG1CNT, BG0's priority lowered by 2 again, REG_DISPCNT showing BG0,
270/// BG2 and the sprites, and no VCount handler. The storm also sets
271/// BattleWork.background to the aerie's storm backdrop.
272void BattlePres_RunEntryTransition(s32 enemyCount, s32 encounterId) {
273 volatile u32 fill;
274 struct BattlePresentationWork presentation;
275 u16 unitIds[14];
276 u16 visibleUnitIds[14];
277 struct BattleBackgroundView *background;
278 s32 *timer;
279 u16 *tilemap;
280 s32 tile;
281 u32 index;
282 u32 column;
283 s32 count;
284 s32 id;
285 struct BattleObj *object;
286 struct BattleWork *battle;
287 u16 *visibleUnits;
288 s32 visibleCount;
289
291 timer = Runtime_AllocateHeapBlock(42, 4);
292 if (encounterId != TRANSITION_STORM_FORMATION) {
293 // The curtain: its seven edge tiles, and the display off while BG1 is
294 // set up.
295 {
296 volatile u32 *dma;
297
299 REG_DMA3);
301 REG_DMA3);
303 REG_DMA3);
305 REG_DMA3);
312 dma = REG_DMA3;
313 /* FAKEMATCH(barrier): REG_DISPCNT reached from DMA3's address through an
314 * empty asm, as the ROM's subs r3, #212; without the barrier, 12 of 414
315 * instructions differ in tbs-en. */
316 asm volatile("" : "+l"(dma));
317 ((struct DisplayRegisters *)((u8 *)dma - 212))->control = 1;
318 }
319 // Tile 128 solid colour 3 and tile 136 clear; BG1 shows the curtain
320 // from screen block 12 behind BG0, whose priority is raised by 2.
321 background->secondMode = 1;
322 background->mode = 1;
323 background->busy = 0;
324 Dma_Fill32Cell(fill, 0x33333333, CURTAIN_TILE(0), 0x20);
325 Dma_Fill32Cell(fill, 0, CURTAIN_TILE(8), 0x20);
328 background->mode = 2;
329 // A closed curtain: solid rows 0 to 20, clear below.
330 tilemap = (u16 *)BG_SCREEN_BLOCK(12);
331 for (index = 0; index <= 31; index++) {
332 if (index <= 20)
333 tile = TRANSITION_CURTAIN_ENTRY(0);
334 else
335 tile = TRANSITION_CURTAIN_ENTRY(8);
336 for (column = 0; column <= 31; column++)
337 *tilemap++ = tile;
338 }
339 {
340 s32 start = 0;
341
342 // Display on, with windows 0 and 1 over the field above the status
343 // window (lines 0 to 136).
344 gBgScroll[0].y = 32;
345 gBgScroll[1].y = 32;
346 gBgScroll[1].x = 8;
347 WaitFrames(1);
348 REG_WIN0H = WIN_RANGE(0, 240);
349 REG_WIN0V = WIN_RANGE(0, 136);
350 REG_WIN1H = WIN_RANGE(0, 240);
351 REG_WIN1V = WIN_RANGE(0, 136);
359 // The opening runs from the callbacks while the status window opens
360 // and the encounter is announced.
362 *timer = start;
366 gBgScroll[0].y = 32;
367 WaitFrames(1);
369 WaitFrames(20);
375 gBgScroll[0].y = start;
377 }
378 } else {
379 // The storm: every unit but class 148 drawn at 0.7 scale (16.16), the
380 // display blank but for the windows.
381 battle = WORK_SLOT(HEAP_SLOT_BATTLE);
382 background->secondMode = 1;
383 background->busy = 0;
384 count = BattleParty_ListActorIds(BATTLE_SIDE_BOTH, (u16 *)unitIds);
385 for (index = 0; index != count; index++) {
386 // The list's index taken as a unit id: 0 to 7, then 128 onward.
387 // BUG: unitIds is never read. A gap among party ids can make
388 // BattleObjGet return NULL before the loop reaches the enemy ids,
389 // and the scale store then goes near address 0.
390 id = index + 120;
391 if ((s32)index <= 7)
392 id = index;
393 object = BattleObjGet(id);
394 if (UnitGetFar(id)->classId != 148)
395 object->scale = 0xb333;
396 }
400 0x20000);
401 WaitFrames(1);
402 {
403 s32 start = 0;
404
405 // The enemies alone take part in the shattering opening.
408 BATTLE_SIDE_ENEMIES, presentation.effect.actors);
409 presentation.effect.actors[presentation.effect.count] =
414 *timer = start;
415 }
417 WaitFrames(1);
418 WaitFrames(20);
422 // Every unit's sprites appear; the party's fade in over 16 frames as
423 // semi-transparent sprites.
425 visibleUnits = visibleUnitIds;
426 visibleCount =
428 visibleUnitIds[visibleCount] = BATTLE_UNIT_LIST_END;
429 BattleActor_SpawnObjectsForList(visibleUnits, 0);
430 visibleCount =
432 for (index = 0; index != visibleCount; index++)
433 BattlePres_SetActorRecordMode(visibleUnits[index], 1);
434 for (index = 0; index != 16; index++) {
435 REG_BLDALPHA = BLEND_ALPHA(index, 16);
436 WaitFrames(1);
437 }
438 for (index = 0; index != visibleCount; index++)
439 BattlePres_SetActorRecordMode(visibleUnits[index], 0);
441 gBgScroll[0].y = 0;
442 WaitFrames(1);
444 }
445 // Both: the battle's own BG1 and display.
448 WaitFrames(1);
451 gBgScroll[1].x = 8;
455}
456
457#undef TRANSITION_CURTAIN_ENTRY
458#undef TRANSITION_STORM_FORMATION
void BattlePres_SetActorRecordMode(s32 actorId, s32 mode)
Sets the OBJ mode (1 semi-transparent, 0 normal) of every sprite of a unit's battle object,...
Definition background.c:515
void BattlePres_SetupTransitionScene(s32 x, s32 depth, s32 y, s32 zoom)
Points the battle camera at (x, depth, y) with a zoom in percent, and lines the perspective plane up ...
Definition background.c:359
s32 BattleParty_ListActorIds(s32 sideMask, u16 *unitIds)
Lists the units in the battle's unit lists on the sides in sideMask, party first, skipping those remo...
Definition encounter.c:510
void BattleActor_SpawnObjectsForList(s16 *unitIds, s32 refreshPoses)
Readies the sprites of the units in list: releases those of every place list lacks,...
Definition objects.c:356
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
void BattleIntro_AnnounceEncounter(s32 enemyCount)
Announces the enemies at the start of a battle, then whether the party strikes first or is caught by ...
Definition setup.c:90
void BattlePresentation_BuildTilemap(void *tilemap)
Builds BG1's flat map of the same picture: rows 0 to 3 0xffff, rows 4 and 5 tile 0x3ff,...
Definition transition.c:106
void BattlePres_AdvanceTransitionTimer(void)
Advances the curtain opening by a frame: scrolls BG0 from 32 pixels to 0 over frames 20 to 52,...
Definition transition.c:167
#define TRANSITION_STORM_FORMATION
The formation the Fusion Dragon leads (row 347 of formatn.tsv, whose first member is enemy 140),...
Definition transition.c:10
void BattlePresentation_UploadTileVariant(void)
Copies one of eight curtain tiles from gBattlePres_TileVariants into CURTAIN_TILE(0),...
Definition transition.c:153
void BattlePres_UpdateHBlankScroll(void)
Shows the perspective plane's finished page each frame while the background is in mode 2: its first l...
Definition transition.c:132
void Graphics_ClearBg0Vofs(void)
Clears REG_BG0VOFS, so that BG0's scroll applies only above the line the interrupt fires on.
Definition transition.c:252
void BattlePres_RunEntryTransition(s32 enemyCount, s32 encounterId)
Opens a battle: the curtain opening, or for the Fusion Dragon the storm on the Venus Lighthouse aerie...
Definition transition.c:272
#define TRANSITION_CURTAIN_ENTRY(n)
The curtain's map entries: tile 128 + n of CURTAIN_TILE, palette 15.
Definition transition.c:13
void BattlePres_DrawTransitionRows(void)
Draws a frame of the curtain opening on BG1: over 80 frames a row moves up from row 13 to row 4 and i...
Definition transition.c:202
void Graphics_BuildSequentialTileTable(void *tilemap)
Builds the perspective plane's 32 by 32 affine map: tiles 0 to 255 in its first eight rows,...
Definition transition.c:75
s32 BattlePres_RunMosaicFadeOut(void)
Fades the screen to black over sixteen frames as every background's mosaic grows, then shows no layer...
Definition transition.c:22
const u8 gBattlePres_TileVariants[]
const u8 gBattlePres_CurtainTiles[]
What every part of the battle object shares: its includes, in their original order,...
#define CURTAIN_TILE(n)
The opening curtain's tiles: 4-bit tiles 128 to 136 of character block 1, which BG1 shows from its ma...
#define BLEND_SPRITES_OVER_ALL
REG_BLDCNT: blend the semi-transparent sprites (OBJ mode 1) over every layer, to fade them.
#define BATTLE_WININ
The battle's windows: window 0 shows BG0 to BG2, sprites and blending, window 1 BG0,...
#define BATTLE_BG1CNT
BG1 during a battle: 256 colours, priority 3, its map in screen block 31.
#define BATTLE_WINOUT
@ BATTLE_UNIT_LIST_END
ends the list
@ BATTLE_SIDE_PARTY
@ BATTLE_SIDE_ENEMIES
@ BATTLE_SIDE_BOTH
struct BattleWork * gBattleWork
#define Dma_Fill32Cell(cell, value, destination, size)
Dma_Fill32 through the caller's own volatile word cell, so a function that fills several blocks keeps...
Definition dma.h:42
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
void Fade_ToBlack(s32 frames)
Fades out to black.
Definition fade.c:76
void BattleFx_RunShatteringOpeningFar(struct BattleEffectArgument *effect)
struct BattleUnit * UnitGetFar(u32 owner)
void UiWindow_CreateWithLayoutBoundsFar(s32 flags)
void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler)
Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and...
Definition frame.c:37
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
Definition frame.c:97
s32 * gDisp
Slot 42: transition timer.
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
Definition heap.c:47
@ HEAP_SLOT_BATTLE_BACKGROUND
Definition heap_state.h:45
@ HEAP_SLOT_BATTLE
Definition heap_state.h:37
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
Definition heap_state.h:14
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
void IoWriteQueue_Store16(u32 address, u32 value)
Queues a halfword store.
Definition io_queue.c:21
#define BLDCNT_TGT1_BD
Definition io_reg.h:128
#define REG_WIN1H
Definition io_reg.h:75
#define BLDCNT_TGT2_OBJ
Definition io_reg.h:138
#define BGCNT_CHAR_BASE(block)
Definition io_reg.h:25
#define REG_WININ
Definition io_reg.h:81
#define BLDCNT_TGT2_BG2
Definition io_reg.h:136
#define BLDCNT_TGT1_BG3
Definition io_reg.h:126
#define BGCNT_PRIORITY(n)
Definition io_reg.h:24
#define BG_SCREEN_BLOCK(n)
Definition io_reg.h:167
#define DMA_HBLANK_HALFWORD_PER_LINE
Definition io_reg.h:228
#define BLDCNT_TGT1_BG2
Definition io_reg.h:125
#define REG_DMA0SAD
Definition io_reg.h:282
#define BLDCNT_EFFECT_DARKEN
towards black by REG_BLDY
Definition io_reg.h:133
#define REG_WIN0H
Definition io_reg.h:74
@ DISPCNT_OBJ_ON
Definition io_reg.h:44
@ DISPCNT_WIN0_ON
Definition io_reg.h:45
@ DISPCNT_BG0_ON
Definition io_reg.h:40
@ DISPCNT_OBJ_1D_MAP
Definition io_reg.h:39
@ DISPCNT_MODE_1
BG0 and BG1 text, BG2 affine.
Definition io_reg.h:37
@ DISPCNT_WIN1_ON
Definition io_reg.h:46
@ DISPCNT_BG2_ON
Definition io_reg.h:42
@ DISPCNT_BG1_ON
Definition io_reg.h:41
#define REG_BG0VOFS
Definition io_reg.h:262
#define REG_DISPCNT
Definition io_reg.h:9
#define BLDCNT_TGT2_BG1
Definition io_reg.h:135
#define REG_DMA3
Definition io_reg.h:153
#define BLDCNT_TGT2_BG3
Definition io_reg.h:137
#define BLEND_ALPHA(top, bottom)
A REG_BLDALPHA value: top and bottom are the two targets' weights, out of 16.
Definition io_reg.h:145
#define BGCNT_SCREEN_BASE(block)
Definition io_reg.h:28
#define BLDCNT_TGT1_BG1
Definition io_reg.h:124
#define REG_BG2CNT
Definition io_reg.h:21
#define DMA_COPY_WORDS(n)
Definition io_reg.h:226
#define REG_BLDALPHA
Definition io_reg.h:142
#define REG_WINOUT
Definition io_reg.h:82
#define WIN_RANGE(start, end)
A REG_WINxH or REG_WINxV value: the window covers start up to, but not including, end.
Definition io_reg.h:80
#define BGCNT_MOSAIC
Definition io_reg.h:26
#define REG_BG2PA
Definition io_reg.h:61
#define REG_BLDCNT
Definition io_reg.h:119
#define REG_BG1CNT
Definition io_reg.h:20
#define REG_MOSAIC
Definition io_reg.h:118
#define REG_WIN1V
Definition io_reg.h:77
#define BLDCNT_TGT2_BD
Definition io_reg.h:139
#define REG_BG0CNT
Definition io_reg.h:261
#define REG_WIN0V
Definition io_reg.h:76
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped...
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
Definition iowrite.h:14
@ IRQ_VCOUNT
Definition irq.h:15
static s32 Iwram_FillWords(void *destination, s32 size, u32 value)
Definition iwram_call.h:59
struct BgScroll gBgScroll[]
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void Runtime_ReleaseHeapBlock(s32 slot)
#define Ram_BgScroll
Definition ram_buffer.h:37
#define Ram_CameraWork
Definition ram_buffer.h:49
#define Ram_Disp
Definition ram_buffer.h:53
char ResourceId_VenusLighthouseAerieStormBackdrop
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
The battle background's scanline work in heap slot 10: two pages of per-line BG2CNT values,...
u32 page
the page of lines shown; the other one is built
u16 lines[2][160]
struct BattleAffine affine
The battle background's work slot as the background code reads it: its display mode (2 draws it as an...
s32 mode
2 draws the affine plane; 1 sets BG1's scroll too
s32 busy
while set, BattleCamera_SetRange leaves BG1's scroll
s32 secondMode
1 also sets BG1's scroll; one effect sets it
The battle camera: its eye, the focus it turns about, and its pitch, yaw and distance.
u16 yaw
1/65536 turns
s16 actors[8]
the targets' unit ids, count of them
s32 count
targets in actors, at least 1
A unit's place on the battlefield: its sprite object, resources and animations, its anchor spot and s...
struct MotionObject * object
NULL once released.
The effect updates its command while the presentation keeps animation state.
struct BattleEffectArgument effect
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
u16 background
the battle background's id
A background's hardware scroll offsets.
Definition map_scroll.h:64
u16 y
pixels
Definition map_scroll.h:65
The display control and green swap registers, REG_DISPCNT onward.
Definition transition.c:259
u16 control
REG_DISPCNT.
Definition transition.c:260
u16 greenSwap
the undocumented green swap register after it
Definition transition.c:261
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