Alchemy
Loading...
Searching...
No Matches

pictures.c

Go to the documentation of this file.
1/// @file
2/// Pictures and command icons loaded for the menus, and BG1's priority.
3/// Part of battle_command.c, the menu object, compiled only through it.
4
6
8
9/// Decompresses picture `picture` of gRenderResource_PairSourceTable (two
10/// 32x32 sprites side by side, 512 bytes) into VRAM slot `slot`. The heap
11/// block is not freed when `slot` is not a valid VRAM slot.
12void RenderResource_LoadPair(s32 picture, s32 slot) {
13 void *stagingBuffer = Runtime_AllocateBlock(14, 0x400);
14 const u8 *resource = gRenderResource_PairSourceTable[picture];
15
16 if (slot < VRAM_CACHE_ENTRY_COUNT) {
17 Resource_DecodeByteLz(resource, stagingBuffer);
18 VramCache_Load(slot, 0x200, stagingBuffer);
20 }
21}
22
23/// Shows picture `picture` of gRenderResource_PairSourceTable as two 32x32
24/// sprites side by side at (x, y) in `window`, on draw layer 253, and
25/// returns the left one (the right one follows it in the window's list).
26/// Returns NULL when no VRAM slot is free.
27struct RenderOutput *
28RenderResource_CreatePair(s32 picture, struct UiWindow *window, s32 x, s32 y) {
29 s32 slot;
30 struct RenderOutput *first;
31 struct RenderOutput *second;
32
34 if (slot >= VRAM_CACHE_ENTRY_COUNT)
35 return NULL;
36
37 // 0x4000 is the wide shape bit of attribute 0, with size 2: 64x32.
38 RenderResource_LoadPair(picture, slot);
39 first = RenderOutput_Create(slot, 0x80004000, window, x, y);
40 first->sentinel = 0xFD;
41 second = RenderOutput_Create(slot, 0x80004000, window, x + 32, y);
42 second->sentinel = 0xFD;
43 // The right half's tiles.
44 second->oam.index += 8;
45 return first;
46}
47
48/// Bobs the two sprites of a pair (see RenderResource_CreatePair) up and down
49/// by gUi_PairBobOffsets, one step every four frames.
51 s32 value;
52
53 value = (u8)obj->y + gUi_PairBobOffsets[(gFrameTick >> 2) & 7];
54 obj->oam.y = value;
55 obj = obj->next;
56 /* FAKEMATCH(volatile): gFrameTick read again for the second sprite, as the
57 * bytes do; read plainly, CSE reuses the first index and 20 of 22
58 * instructions differ in tbs-en. */
59 value =
60 (u8)obj->y + gUi_PairBobOffsets[(*(volatile u32 *)&gFrameTick >> 2) & 7];
61 obj->oam.y = value;
62}
63
64/// Decompresses command icon `icon` (a 32x32 picture of 256 colours, 1 KB)
65/// into VRAM slot `slot`, remapping its first 768 bytes' colours by table
66/// when `remap` is nonzero.
67void RenderResource_LoadFrame(s32 icon, s32 slot, s32 remap) {
68 s32 size = 1024;
69 void *buffer = Runtime_AllocateBlock(14, size);
71
72 if (slot < VRAM_CACHE_ENTRY_COUNT) {
73 Resource_DecodeByteLz((void *)((u32)offsetTable + offsetTable[icon]),
74 buffer);
75 if (remap != 0)
77 VramCache_Load(slot, size, buffer);
79 }
80}
81
82/// Shows command icon `icon` (see RenderResource_LoadFrame) as a 32x32
83/// 256-colour sprite at (x, y) in `window`, on draw layer 251. Returns NULL
84/// when no VRAM slot is free.
86 struct UiWindow *window, s32 x,
87 s32 y) {
88 s32 slot;
89 struct RenderOutput *output;
90
92 output = NULL;
93 if (slot != VRAM_CACHE_ENTRY_COUNT) {
94 RenderResource_LoadFrame(icon, slot, remap);
95 output = RenderOutput_Create(slot, OUTPUT_SIZE_32X32, window, x, y);
96 output->oam.palette256 = 1;
97 output->sentinel = 0xfb;
98 }
99 return output;
100}
101
102/// Makes the sprite `obj` pulse: scales it about its centre by
103/// gUi_ObjectPulseScales (in 1/65536, used in 1/256), one step every two
104/// frames, and puts it on draw layer 252. Does nothing when `obj` is NULL.
106 s32 scale = gUi_ObjectPulseScales[(gFrameTick >> 1) & 7];
107 struct AffineTransform effect;
108
109 if (scale < 0)
110 scale += 255;
111 scale >>= 8;
112
113 if (obj != 0) {
114 effect.scaleX = scale;
115 effect.scaleY = scale;
116 effect.angle = 0;
117 obj->oam.matrix = AffineMatrix_BuildForEffect(&effect);
118 obj->oam.affineMode = 3;
119 obj->oam.x = obj->x + 0xfff0;
120 obj->oam.y = (u8)obj->y + 0xf0;
121 obj->sentinel = 0xfc;
122 }
123}
124
125static __inline__ u32 XorWord(u32 word, u32 mask) { return word ^ mask; }
126
127#define RANGE_PATTERN_SET_COUNT 2
128#define RANGE_PATTERN_COUNT 6
129#define RANGE_PATTERN_PAIR_WORDS 16
130
131// Builds two sets of six paired bar-pattern tiles. Each pair starts in
132// color 4, then XORs row masks from gMenu_BarPatternRows.
133// The matching return type keeps pop {r1}; bx r1; void uses r0 instead.
134#ifdef UBFIX
136#else
138#endif
139 u32 *vram = (u32 *)0x06006280;
140 s32 patternSet;
141 s32 patternIndex;
142
143 for (patternSet = 0; patternSet < RANGE_PATTERN_SET_COUNT; patternSet++) {
144 for (patternIndex = 0; patternIndex < RANGE_PATTERN_COUNT; patternIndex++) {
145 u32 *tile =
146 vram + patternSet * (RANGE_PATTERN_COUNT * RANGE_PATTERN_PAIR_WORDS) +
147 patternIndex * RANGE_PATTERN_PAIR_WORDS;
148 s32 row;
149
150 Iwram_FillWords(tile, 64, 0x44444444);
151 for (row = 1; row <= 7; row++) {
152 s32 sourcePattern = patternIndex;
153
154 if (patternSet == 1 && row <= 1) {
155 continue;
156 }
157 if (patternSet == 0 && patternIndex > row - 2) {
158 sourcePattern = row - 2;
159 if (sourcePattern < 0) {
160 sourcePattern = 0;
161 }
162 }
163 tile[row] =
164 XorWord(tile[row], gMenu_BarPatternRows[sourcePattern].word0);
165 tile[row + 8] =
166 XorWord(tile[row + 8], gMenu_BarPatternRows[sourcePattern].word1);
167 }
168 }
169 }
170}
171
172// Draws a range indicator across three adjacent tiles at (x, y), using the
173// selected pattern and a mirrored left end.
174// Void changes pop {r1}; bx r1 to r0 and reorders a preview's argument setup.
175#ifdef UBFIX
176void UiWindow_DrawThreeTileColumn(struct UiWindow *window, s32 x, s32 y,
177 s32 pattern, s32 unused) {
178#else
180 s32 pattern, s32 unused) {
181#endif
182 s32 patternOffset = pattern * 2;
183 s32 rightTile = patternOffset + 0xF315;
184
185 UiWindow_SetTilemapEntry(window, 0x400 | rightTile, x, y, 0);
186 UiWindow_SetTilemapEntry(window, patternOffset + 0xF314, x + 1, y, 0);
187 UiWindow_SetTilemapEntry(window, rightTile, x + 2, y, 0);
188}
189
190/// Merges two 8x8 4bpp tiles row by row. Shift the second tile horizontally by
191/// shift pixels, using the first tile wherever the shifted pixel is
192/// transparent.
193void Graphics_MergeShiftedTileRows(u32 *first, u32 *second, u32 *output,
194 s32 shift) {
195 s32 oppositeShift;
196 s32 rightShift;
197 s32 leftShift;
198 s32 row;
199
200 oppositeShift = -shift;
201 row = 0;
202 rightShift = oppositeShift * 4;
203 leftShift = shift * 4;
204
205 do {
206 u32 result;
207 u32 shifted;
208 u32 fallback;
209 s32 pixel;
210
211 shifted = *second++;
212 result = 0;
213 fallback = *first++;
214 if (shift < 0)
215 shifted >>= rightShift;
216 else
217 shifted <<= leftShift;
218
219 pixel = 7;
220 do {
221 result <<= 4;
222 if (shifted > 0x0FFFFFFF)
223 result += shifted >> 28;
224 else
225 result += fallback >> 28;
226 pixel--;
227 shifted <<= 4;
228 fallback <<= 4;
229 } while (pixel >= 0);
230
231 *output++ = result;
232 row++;
233 } while (row <= 7);
234}
235
236/// Animates the two link indicator tiles with opposing two/three-pixel shifts.
238 s32 phase = (gFrameCount >> 2) & 3;
239
240 if (phase > 2) {
241 phase = 2;
242 }
243 if (phase <= 0) {
244 phase = 1;
245 }
246 phase++;
248 (u32 *)offset, -phase);
250 (u32 *)(gRomShiftedTilePair + 32),
251 (u32 *)(offset + 32), phase);
252}
253
254/// Expands two palette variants of the ten source tile rows at 0x06000600,
255/// mapping each packed nibble through gGraphics_ExpandNibbleTable.
257 s32 bank = 0;
258 s32 paletteOffset = 0;
259 s32 destinationBank = 0;
260
261 do {
262 s32 row = 0;
263 s32 destinationOffset = (destinationBank + bank) << 6;
264
265 do {
266 u16 *output = (u16 *)((u8 *)dst + destinationOffset);
267 u16 *source = (u16 *)((u8 *)0x06000600 + (row << 5));
268 s32 column = 0;
269
270 do {
271 u32 packed = *source++;
272 u32 expanded = 0;
273 s32 nibble = 0;
274
275 do {
276 u32 color = gGraphics_ExpandNibbleTable[(packed & 15) + paletteOffset]
277 << (nibble * 4);
278 nibble++;
279 packed >>= 4;
280 expanded |= color;
281 } while (nibble <= 3);
282
283 column++;
284 *output++ = expanded;
285 } while (column <= 15);
286
287 row++;
288 destinationOffset += 32;
289 } while (row <= 9);
290
291 paletteOffset += 16;
292 destinationBank += 4;
293 bank++;
294 } while (bank <= 1);
295}
296
297/// Composes a table-entry glyph in temporary transfer work, reloads its cache
298/// slot, then releases the temporary work and returns the tile index.
300 s32 result;
301 GlyphTransfer *work;
302
303 work = Runtime_AllocateBlock(17, sizeof(*work));
305 result = VramCache_Reload(index, (s32)work->tiles);
307 return result;
308}
309
310/// Composes the item icon with style 0x1a in temporary transfer work and reload
311/// the requested cache slot. Return its tile index.
313 s32 result;
314 GlyphTransfer *work;
315
316 work = Runtime_AllocateBlock(17, sizeof(*work));
317 ItemIcon_Compose(resource, 0x1a);
318 result = VramCache_Reload(index, (s32)work->tiles);
320 return result;
321}
322
323/// Builds the ability glyph in temporary transfer work, reloads the requested
324/// cache slot and returns its tile index.
326 s32 tile;
327 s32 slot;
328 s32 result;
329 GlyphTransfer *work;
330
331 work = Runtime_AllocateBlock(17, sizeof(*work));
332 slot = index;
333 Ability_LoadGlyph(resource, 0, &slot, &tile, 1);
334 result = VramCache_Reload(index, (s32)work->tiles);
336 return result;
337}
338
339/// Loads a party portrait into the supplied cache slot and returns its tile.
340/// In the prologue, Isaac and Garet use their childhood portrait entries.
341s32 UiGlyph_LoadPortrait(u32 member, s32 cacheSlot) {
342 s32 tile;
343 s32 slot;
344 u32 portrait;
345
346 portrait = member;
347 slot = cacheSlot;
348 if (portrait > 7U) {
349 portrait = 0;
350 }
352 switch (portrait) {
353 case 0:
354 portrait = 0x38;
355 break;
356 case 1:
357 portrait = 0x39;
358 break;
359 }
360 }
361 UiGlyph_LoadEntryWithPalette(portrait, 0, &slot, &tile, 0xE, 1);
362 return tile;
363}
364
365/// Return gUi_FixedTileBlocks[0]; treat any nonzero no as 0 as well.
367 if (no != 0)
368 no = 0;
369 return gUi_FixedTileBlocks[no];
370}
371
372/// Copies the 4bpp decoder into RAM, calls it with the transfer's encoded
373/// source and byte buffer, then releases the copied code. Its ARM entry reads
374/// the stream through r0 and writes bytes through r1, as UiIcon_Decode does.
375/// Nothing calls it.
379 ((void (*)(const void *, u8 *))((union HeapState *)gWorkSlot)
380 ->slots[HEAP_SLOT_TEMP_RENDERER])(work->encoded, work->input);
382}
383
384// Open a 6x4 window at the upper left, write its heading and return it.
385#if LANGUAGE == LANGUAGE_SPANISH || LANGUAGE == LANGUAGE_FRENCH
386#define LINK_COUNTDOWN_DRAW_HEADING UiText_DrawStringAtOffset
387#else
388#define LINK_COUNTDOWN_DRAW_HEADING UiText_DrawStringInWindow
389#endif
390
391/// Creates the link timer window and draws its fixed time heading.
393 struct UiWindow *win = UiWindow_Create(0, 0, 6, 4, 6);
394
396 return win;
397}
398
399/// Decodes a command-icon table entry in temporary transfer work and reload
400/// the requested cache slot. Return its tile index.
402 GlyphTransfer *buffer =
405 u8 **encoded = &buffer->encoded;
406 void *target = (void *)((u32)offsetTable + offsetTable[icon]);
407 s32 result;
408
409 *encoded = target;
410 Resource_DecodeByteLz(target, buffer);
411 result = VramCache_Reload(slotIndex, (s32)buffer);
413 return result;
414}
415
416/// Loads a command icon into 8bpp OBJ VRAM, sharing a compact palette across
417/// the selection's icons. Copy each newly encountered color from OBJ to BG
418/// palette storage before uploading the remapped pixels.
419void UiText_LoadRemappedGlyph(struct GlyphPalette *palette, s32 glyph,
420 s32 tile) {
421 GlyphTransfer *decoded;
422 u8 *font;
423 u8 *remapped;
424 u8 *source;
425 u8 *destination;
426 s32 i;
427 u32 index;
428
429 decoded = Runtime_AllocateHeapBlock(17, sizeof(*decoded));
431 decoded->encoded = font + ((u16 *)font)[glyph];
432 Resource_DecodeByteLz(decoded->encoded, decoded);
433 remapped = MemAlloc(0x400);
434 source = decoded->input;
435 destination = remapped;
436 for (i = 0; i < 0x400; i++) {
437 index = *source++;
438 if (palette->slot[index] == 255) {
439 palette->slot[index] = palette->count;
440 if (palette->count < 64) {
441 ((u16 *)BG_PLTT)[palette->count] = ((u16 *)OBJ_PLTT)[index];
442 palette->count++;
443 }
444 }
445 *destination++ = palette->slot[index];
446 }
447 Dma_Set(remapped, BG_CHAR_BLOCK(1) + tile * 64, DMA_COPY32(256), REG_DMA3);
448 MemFree(remapped);
450}
451
452/// Loads a selection icon, initializes its sprite and binds the decoded tiles.
453/// The icon's kind also chooses its command-name label.
454void UiText_DrawCharacter(struct SelectionWork *work, s32 index, u32 icon) {
455 struct SelectionEntry *entry = &work->entries[index];
456
457 UiText_LoadRemappedGlyph(&work->palette, icon, index * 16);
458 work->entries[index].kind = icon;
459 MenuSprite_Init(entry->sprite, 0x80002000);
460 entry->sprite.oam.f.tile =
462}
463
464/// Puts BG1 behind the other priority levels while the command strip is active.
466 u32 value = REG_BG1CNT;
467
468 value &= ~BGCNT_PRIORITY(3);
469 value |= BGCNT_PRIORITY(3);
470 REG_BG1CNT = value;
471}
472
473/// Restores BG1 priority 0; the VCount handler applies this below the strip.
475 u32 value = REG_BG1CNT;
476
477 value &= ~BGCNT_PRIORITY(3);
478 REG_BG1CNT = value;
479}
480
481/// Clears BG0 vertical scroll and installs the BG1 priority change at line 136.
482/// Nothing calls it.
484 u32 address = 0x04000012;
485 s32 zero = 0;
486
487 *(volatile u16 *)address = zero;
488 /* FAKEMATCH(one-pass): the handler's address set in a block of its own keeps
489 * its load ahead of the handler index; as a plain assignment, 2 of 10
490 * instructions differ in tbs-en. */
491 do {
492 address = (u32)Graphics_SetBg1Priority0;
493 } while (0);
494 Runtime_SetIrqHandler(2, 136, (InterruptHandler)address);
495}
What every part of the menu object shares: its includes, edition values, macros and the link round st...
#define OUTPUT_SIZE_32X32
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 Runtime_RemapBytesByTableFar(u8 *buf, s32 cnt)
s32 GameFlag_TestFar(s32 flag)
#define FLAG_CHILDHOOD
the prologue: Isaac and Garet are children
Definition flags.h:10
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
u32 gFrameTick
Counted up by every VBlank.
volatile u32 gFrameCount
Frames WaitFrames has finished.
const u8 gUi_PairBobOffsets[]
u8 gRomShiftedTilePair[]
s32 gUi_ObjectPulseScales[]
s32 gUi_FixedTileBlocks[]
const u8 Tile_Decompress4bpp[]
const struct TileMask gMenu_BarPatternRows[]
u8 Tile_Decompress4bppCodeSize[]
u16 gGraphics_ExpandNibbleTable[]
void * MemAlloc(s32 size)
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise...
Definition heap.c:115
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
Definition heap.c:80
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_TEMP_RENDERER
Copied field row drawer or window tile decoder, released after each call.
Definition heap_state.h:49
#define OBJ_PLTT
Definition io_reg.h:159
#define BGCNT_PRIORITY(n)
Definition io_reg.h:24
#define BG_CHAR_BLOCK(n)
Definition io_reg.h:166
#define REG_DMA3
Definition io_reg.h:153
#define BG_PLTT
Definition io_reg.h:157
#define REG_BG1CNT
Definition io_reg.h:20
void(*) InterruptHandler(void)
Definition irq.h:36
static s32 Iwram_FillWords(void *destination, s32 size, u32 value)
Definition iwram_call.h:59
void Runtime_ReleaseHeapBlock(s32 slot)
void MemFree(void *buffer)
static __inline__ u32 XorWord(u32 word, u32 mask)
Definition status.c:1202
#define MenuSprite_Init(sprite, shape)
Sets sprite shape (attr0/attr1) and clears the remaining fields.
Definition menu_list.h:76
struct RenderOutput * RenderOutput_Create(s32 slot, s32 oamFlags, struct UiWindow *window, s32 offsetX, s32 offsetY)
Creates a sprite output for the VRAM cache slot slot and attaches it to window, placed at (offsetX,...
Definition outputs.c:13
const u8 * gRenderResource_PairSourceTable[]
void UiText_DrawCharacter(struct SelectionWork *work, s32 index, u32 icon)
Loads a selection icon, initializes its sprite and binds the decoded tiles.
Definition pictures.c:454
void UiText_LoadRemappedGlyph(struct GlyphPalette *palette, s32 glyph, s32 tile)
Loads a command icon into 8bpp OBJ VRAM, sharing a compact palette across the selection's icons.
Definition pictures.c:419
s32 Resource_LoadIndexedIntoBuffer(s32 slotIndex, s32 icon)
Decodes a command-icon table entry in temporary transfer work and reload the requested cache slot.
Definition pictures.c:401
void Graphics_SetBg1Priority3(void)
Puts BG1 behind the other priority levels while the command strip is active.
Definition pictures.c:465
#define RANGE_PATTERN_PAIR_WORDS
Definition pictures.c:129
UNUSED void Graphics_InstallBg1VCountHandler(void)
Clears BG0 vertical scroll and installs the BG1 priority change at line 136.
Definition pictures.c:483
s32 Ui_GetTableWordZero(s32 no)
Return gUi_FixedTileBlocks[0]; treat any nonzero no as 0 as well.
Definition pictures.c:366
void Graphics_SetBg1Priority0(void)
Restores BG1 priority 0; the VCount handler applies this below the strip.
Definition pictures.c:474
struct RenderOutput * RenderResource_CreateFrame(s32 icon, s32 remap, struct UiWindow *window, s32 x, s32 y)
Shows command icon icon (see RenderResource_LoadFrame) as a 32x32 256-colour sprite at (x,...
Definition pictures.c:85
#define LINK_COUNTDOWN_DRAW_HEADING
Definition pictures.c:388
struct RenderOutput * RenderResource_CreatePair(s32 picture, struct UiWindow *window, s32 x, s32 y)
Shows picture picture of gRenderResource_PairSourceTable as two 32x32 sprites side by side at (x,...
Definition pictures.c:28
struct UiWindow * Link_CreateCountdownLabelWindow(void)
Creates the link timer window and draws its fixed time heading.
Definition pictures.c:392
void RenderResource_LoadFrame(s32 icon, s32 slot, s32 remap)
Decompresses command icon icon (a 32x32 picture of 256 colours, 1 KB) into VRAM slot slot,...
Definition pictures.c:67
s32 Resource_LoadIndexedEntryToBuffer(s32 resource, s32 index)
Builds the ability glyph in temporary transfer work, reloads the requested cache slot and returns its...
Definition pictures.c:325
#define RANGE_PATTERN_COUNT
Definition pictures.c:128
void RenderResource_LoadPair(s32 picture, s32 slot)
Decompresses picture picture of gRenderResource_PairSourceTable (two 32x32 sprites side by side,...
Definition pictures.c:12
void Link_DrawShiftedTilePair(s32 offset)
Animates the two link indicator tiles with opposing two/three-pixel shifts.
Definition pictures.c:237
UNUSED void UiIcon_Decompress(GlyphTransfer *work)
Copies the 4bpp decoder into RAM, calls it with the transfer's encoded source and byte buffer,...
Definition pictures.c:376
s32 ItemIcon_LoadIntoSlot(s32 resource, s32 index)
Composes the item icon with style 0x1a in temporary transfer work and reload the requested cache slot...
Definition pictures.c:312
void Ui_ApplyTableScaleToObject(struct RenderOutput *obj)
Makes the sprite obj pulse: scales it about its centre by gUi_ObjectPulseScales (in 1/65536,...
Definition pictures.c:105
s32 Resource_LoadTableEntryToBuffer(s32 resource, s32 index)
Composes a table-entry glyph in temporary transfer work, reloads its cache slot, then releases the te...
Definition pictures.c:299
s32 UiGlyph_LoadPortrait(u32 member, s32 cacheSlot)
Loads a party portrait into the supplied cache slot and returns its tile.
Definition pictures.c:341
void Graphics_ExpandVramTilesByColorTable(u16 *dst)
Expands two palette variants of the ten source tile rows at 0x06000600, mapping each packed nibble th...
Definition pictures.c:256
int UiWindow_DrawThreeTileColumn(struct UiWindow *window, s32 x, s32 y, s32 pattern, s32 unused)
Definition pictures.c:179
void Graphics_MergeShiftedTileRows(u32 *first, u32 *second, u32 *output, s32 shift)
Merges two 8x8 4bpp tiles row by row.
Definition pictures.c:193
#define RANGE_PATTERN_SET_COUNT
Definition pictures.c:127
s32 Menu_BuildLocalizedPatternTiles(void)
Definition pictures.c:137
void RenderOutput_BobPair(struct RenderOutput *obj)
Bobs the two sprites of a pair (see RenderResource_CreatePair) up and down by gUi_PairBobOffsets,...
Definition pictures.c:50
#define RamCode_LoadSlot(slot, code, bytes)
Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.
Definition ramcode.h:26
s32 AffineMatrix_BuildForEffect(struct AffineTransform *source)
Hands out the next OAM affine matrix for a sprite drawn with source's scale and rotation and fills it...
Definition render.c:27
char ResourceId_CommandIcons
s32 Resource_DecodeByteLz(const void *source, void *destination)
Decodes a byte-oriented LZ resource and returns its unpacked byte count.
Definition decompress.c:37
#define NULL
Definition bilibin.h:6
void * gWorkSlot[]
A sprite's rotation and scale: scales in 8.8 fixed point (0x100 is full size), the angle in 1/65536 t...
Definition affine.h:13
u16 angle
1/65536 turns
Definition affine.h:16
u16 scaleY
8.8 fixed point, read signed
Definition affine.h:15
u16 scaleX
8.8 fixed point, read signed: negative mirrors the sprite
Definition affine.h:14
A compact palette shared by a selection's command icons: the slot each icon colour was given,...
Definition glyph.h:19
s32 count
Definition glyph.h:21
u8 slot[256]
Definition glyph.h:20
u8 input[0x400]
Definition glyph.h:39
u8 tiles[0x200]
Definition glyph.h:40
u8 * encoded
Definition glyph.h:43
union MenuSprite::@002225022013150231017316170057321303227123371224 oam
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
struct RenderOam oam
u16 y
screen pixels
u8 sentinel
depth slot it is drawn at (254 for glyphs)
struct RenderOutput * next
the next output in its list
u16 x
screen pixels
The command icon row's work block and one of its icons: pictures.c loads the icons,...
struct MenuSprite sprite
The command icon row's work block: the icons' shared palette, up to six icons, the label window,...
struct GlyphPalette palette
struct SelectionEntry entries[6]
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
Definition system.c:150
u8 gLink_TimeLabelString[]
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
#define UNUSED
Definition types.h:22
unsigned char u8
Definition types.h:11
The heap's 64 work slots, the first two holding the next free EWRAM and IWRAM addresses.
Definition heap_state.h:18
#define DMA_COPY32(count)
The DMA control word that copies count words.
Definition window.h:112
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
Definition vram_cache.c:238
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
Definition vram_cache.c:211
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.
Definition vram_cache.c:143
@ VRAM_CACHE_ENTRY_COUNT
Definition vram_tab.h:12
s32 ItemIcon_Compose(u32 code, u32 layers)
Draws an item's icon into the glyph work buffer from its inventory code (item id in the low 9 bits,...
Definition icons.c:95
void Ability_LoadGlyph(s32 action, s32 withBase, s32 *slot, s32 *tile, s32 reuse)
Builds the Psynergy icon of a battle action, as UiIcon_BuildAbilityIconTiles.
Definition icons.c:234
void Ui_PrepareTransferFromTableEntry(u32 iconIndex)
Draws one of the other icons into the glyph work buffer.
Definition icons.c:278
void UiGlyph_LoadEntryWithPalette(u32 icon, s32 unused, s32 *slot, s32 *tile, s32 palette, s32 reuse)
Loads a 32x32 icon from the icon resource into sprite tile slot *slot (a free slot unless reuse is se...
Definition icons.c:291
void UiWindow_SetTilemapEntry(struct UiWindow *window, s32 value, s32 x, s32 y, u32 mode)
Writes value into a window's tilemap at tile (x, y) of its interior, with the palette mode names (TIL...
Definition sprites.c:345
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...
Definition windows.c:279