10 0x00, 0x01, 0x02, 0x03,
11 0x20, 0x21, 0x22, 0x23,
12 0x40, 0x41, 0x42, 0x43,
13 0x60, 0x61, 0x62, 0x63,
14 0x80, 0x81, 0x82, 0x83,
15 0xa0, 0xa1, 0xa2, 0xa3,
16 0xc0, 0xc1, 0xc2, 0xc3,
26 const u16 *tileOffset;
28 paletteSelector = (paletteSelector << 4) + 1;
35 record->
values[0] = paletteSelector;
36 record->
values[4] = paletteSelector;
37 record->
values[8] = paletteSelector;
38 record->
values[12] = paletteSelector;
39 record->
values[16] = paletteSelector;
40 record->
values[20] = paletteSelector;
42 }
while (itemCount != 0);
49 0xc0, 0x90, 0x80, 0x50, 0x40,
103 remainingDigits = value / 10;
104 if (remainingDigits != 0)
132 u8 *eventBytes = (
u8 *)workCells[0];
134 u16 *savedPalette = paletteBuffers->
target;
136 Dma_Set(savedPalette, eventBytes + 0x236,
165 durationFrames = cursor->
kind;
166 if (durationFrames == 0)
171 cursor->
x + (cursor->
targetX - (
s16)cursor->
x) * frame / durationFrames;
173 sprite->
oam.
x = cursorX;
175 cursor->
y + (cursor->
targetY - (
s16)cursor->
y) * frame / durationFrames;
177 sprite->
oam.
y = cursorY;
178 if (frame == durationFrames) {
192 if (sprite !=
NULL) {
193 delta = sprite->
x - cursor->
targetX;
199 sprite->
x = sprite->
x - step;
201 sprite->
x = sprite->
x - 1;
202 sprite->
oam.
x = sprite->
x;
203 }
else if (delta < 0) {
205 sprite->
x = sprite->
x + step;
207 sprite->
x = sprite->
x + 1;
208 sprite->
oam.
x = sprite->
x;
211 delta = sprite->
y - cursor->
targetY;
217 sprite->
y = sprite->
y - step;
219 sprite->
y = sprite->
y - 1;
220 sprite->
oam.
y = sprite->
y;
221 }
else if (delta < 0) {
223 sprite->
y = sprite->
y + step;
225 sprite->
y = sprite->
y + 1;
226 sprite->
oam.
y = sprite->
y;
238 cursor->
x = anchor->
x;
239 cursor->
y = anchor->
y;
258 sprite->
oam.
x = sprite->
x =
x;
266 sprite->
oam.
y = sprite->
y =
y;
281 if (window !=
NULL) {
282 cursorX = cursorX + (window->
x * 8) + 8;
283 cursorY = cursorY + (window->
y * 8) + 8;
struct BattleEffectBuffers * gPaletteBufferWork
static const u16 sSelectorTileOffsets[30]
Where each of the quantity bar's 30 segments starts in its tile buffer.
void Shop_SetCursor(struct ShopCursor *cursor, s32 targetX, s32 targetY, s32 kind)
Starts a glide of the cursor from where it is to (targetX, targetY) over kind frames,...
void Shop_PlaceCursor(struct UiWindow *window, s32 x, s32 y)
Starts the hand cursor's glide to (x, y) pixels inside window (the screen when it is NULL),...
void ShopCursor_Advance(struct ShopCursor *cursor)
Moves the cursor from its saved position toward its target, in a straight line over kind frames,...
void Shop_CopyGlyphs(s32 digit, u8 *tileBuffer, u32 digitPosition)
Copies decimal glyph digit into its price-tile position, stopping at zero source bytes.
void Shop_RestoreFieldPalette(void)
Fades back to the colours Shop_SaveAndTintFieldPalette saved, over 16 frames.
static const u16 sPriceDigitTileOffsets[5]
Where each of a price's five digits starts in its tile buffer, ones first.
struct RenderOutput * Shop_CreatePriceSprite(s32 value, struct UiWindow *window, s32 x, s32 y)
Builds a price of up to five digits in scratch tiles (heap slot 14), loads them into a free VRAM cach...
void Shop_SaveAndTintFieldPalette(s32 layer)
Saves the field colours in event work and fades to layer over 16 frames.
void ShopCursor_SetPositionImmediate(struct ShopCursor *cursor, s32 x, s32 y)
Places the cursor and its sprite at (x, y) at once, with a one-frame glide that has already arrived.
void ShopCursor_MoveTowardTarget(struct ShopCursor *cursor)
Moves each cursor axis one quarter of the remaining distance, with a minimum one-pixel step.
void Shop_FillSelector(s32 itemCount, s32 paletteSelector, u8 *tileBuffer)
Colours the first itemCount segments of the quantity bar with palette paletteSelector,...
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...
void BattleFx_ApplyColorToTargetBufferFar(s32 mode, s32 half)
void BattleFx_StartBufferInterpolationFar(s32 frames)
struct RenderOutput * RenderOutput_CreateFar(s32 slot, s32 flags, struct UiWindow *input, s32 offsetX, s32 offsetY)
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
void Runtime_ReleaseHeapBlock(s32 slot)
const u8 gShop_PriceTiles[]
What every part of the shop object shares: its includes, the shop actions and sanctum services,...
struct EventWork * gEventWork
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
u16 current[0x540]
The shown colours, as B, G and R channels shifted up 10 bits, three a colour.
u16 target[0x540]
the colours current moves toward, as current
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
s8 kind
0 for a glyph; otherwise it owns VRAM cache slot index, freed with it, and 2 (a portrait) also its pa...
Byte view of the six colour writes in a quantity-bar segment.
u8 values[21]
palette bytes at indices 0, 4, 8, 12, 16 and 20
Cursor that approaches its target, shared by shop, name entry and settings.
u16 x
screen pixels: where the current move started
s8 kind
frames the move takes; 0 when the cursor is still
u16 y
screen pixels: where the current move started
struct RenderOutput * anchor
the cursor's sprite, moved with its OAM
s8 active
frames of the current move done; reset when it ends
A shop's work: its windows, the party members' icons, the stock, the cursor and its icons,...
struct ShopCursor cursor
the hand cursor
u8 mode
passed on as the hand cursor's kind; set to 12 at first
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.