171#define SHOP_DEBUG_STOCK_ROW 1
173#define SHOP_DEBUG_STOCK_ROW 2
219 s32 resolvedMessage = messageId;
225 resolvedMessage += MsgArmorShopWelcome - MsgWeaponShopWelcome;
227 resolvedMessage += MsgItemShopWelcome - MsgWeaponShopWelcome;
229 resolvedMessage += MsgWarriorShopWelcome - MsgWeaponShopWelcome;
231 (portraitResource << 16) | 0x22);
240 s32 portraitResource;
250 savedCursorMode = (*cursorSlot)->
active;
251 resolvedMessage = messageId;
255 resolvedMessage += MsgArmorShopWelcome - MsgWeaponShopWelcome;
258 resolvedMessage += MsgItemShopWelcome - MsgWeaponShopWelcome;
261 if (warriorShop != 0) {
262 resolvedMessage += MsgWarriorShopWelcome - MsgWeaponShopWelcome;
264 (*cursorSlot)->active = 13;
267 (portraitResource << 0x10) | 0x22);
281 u8 savedCursorMode = (*cursorSlot)->active;
284 (*cursorSlot)->active = savedCursorMode;
294 u8 savedCursorMode = (*cursorSlot)->active;
297 (*cursorSlot)->active = savedCursorMode;
307 for (linkIndex = 0; linkIndex != state->
count; ++linkIndex) {
313#undef SHOP_DEBUG_STOCK_ROW
s32 EventTable_CopyRowHeader(s32 stockRow, s16 *output)
Copies the shop's ordinary stock, up to 24 items, to output with a 0 after, and returns how many.
s32 EventTable_GetRowType(s32 stockRow)
Returns the shop's type from the last column of its stock row: 0 items, 1 weapons,...
s32 EventTable_GetRowLimit(void)
Returns how many stock rows there are; Shop_Run refuses a row past them.
void EventTable_ApplyRowAbilities(s32 stockRow)
Adds a shop's artifacts to the shared stock counters once, on its first visit, and sets the shop's fl...
s32 Shop_SelectBuy(void)
Runs the Buy and Artifacts counters: the player browses the stock seven items a page,...
#define SCHEDULER_KEY_MAIN_LOOP
void ShopCursor_Advance(struct ShopCursor *cursor)
Moves the cursor from its saved position toward its target, in a straight line over kind 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.
#define Dma_Fill32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
struct BattleUnit * UnitGetFar(u32 owner)
s32 Party_ListActiveOwnersFar(s16 *owners)
s32 Item_AdjustCounterFar(s32 item_id, s32 delta)
s32 Inventory_AddItemFar(s32 owner_id, s32 item_id)
s32 Item_GetEquipmentGroupFar(s32 item_id)
s32 Inventory_EquipFar(s32 owner, s32 slot)
s32 BattleFx_GetResourceIdFar(u32 id)
void Battle_ResetEffectCounterFar(void)
struct FieldActor * Object_GetByIdFar(s32 objectId)
s32 AudioCommand_GetStateByteFar(void)
struct UiWindow * UiWindow_CreateFar(s32 x, s32 y, s32 width, s32 height, s32 attrs)
s32 Menu_RunConfirmSelectionAtFar(s32 x, s32 y, s32 selection)
s32 Menu_SelectShopCommandFar(s32 selection)
struct RenderOutput * RenderOutput_CreateFar(s32 slot, s32 flags, struct UiWindow *input, s32 offsetX, s32 offsetY)
void UiWork_FinalizeFar(struct UiWindow *work, s32 release)
struct UiWindow * UiWindow_CreateWithSideObjectFar(s32 arg0, s32 arg1, s32 x, s32 y)
s32 UiWork_IsCompleteFar(void)
struct UiWindow * UiText_OpenMessageWindowFar(s32 message, s32 x, s32 y, u32 packed)
void UiWork_FinalizePendingCoreFar(void)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
struct GameState gGameState
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
void Runtime_ReleaseHeapBlock(s32 slot)
s32 Shop_SelectUnit(void)
Runs the repair counter's member choice; always returns 0.
#define SHOP_DEBUG_STOCK_ROW
UNUSED struct NodeChainNode * NodeChain_GetNodeAtIndex(struct NodeChainState *state)
Unused original list walker: follows the requested number of next links.
void Shop_ReleaseCursorWork(void)
Stops the cursor task, frees the six cursor icons and the work block.
void UiMessage_ShowAndRestoreState(s32 messageId)
Shows a shopkeeper's line as UiMessage_ShowAndWait does, hiding the hand cursor while it shows and pu...
s32 Shop_ListAvailableArtifacts(void)
Lists the current shop's artifacts: every item of the shop's type whose shared stock counter is above...
s32 UiMessage_ShowChoiceVariant(s32 choice)
Runs the Yes or No choice at the sanctum's place on the screen and returns it, keeping the hand curso...
void Shop_StepCursor(void)
Advances the hand cursor one frame.
s32 Battle_ApplyPresetItemsAndFlags(s32 unused)
Opens the debug shop with 200000 coins, the ticket counter at its cap, broken equipment for repairs a...
s32 Shop_Run(s32 stockRow, s32 keeperId)
Runs a shop: the shopkeeper's welcome, then buy, sell, artifacts and repair until the player leaves.
s32 UiMessage_ShowChoice(s32 choice)
Runs the Yes or No choice beside the shopkeeper's line and returns it, keeping the hand cursor's moti...
void AudioCommand_WaitForStateByteClear(void)
Waits one frame at a time until the sound driver has finished the last command.
void Shop_InitializeCursorWork(void)
Allocates and clears the work block in the menu's heap slot, lists the party, loads the six cursor ic...
void UiMessage_ShowAndWait(s32 messageId)
Shows a shopkeeper's line and waits for its window to finish, one more frame included.
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...
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
s32 Shop_PickUnit(void)
Lets the player choose whose items to sell or repair, with the coins window and the member's item gri...
const u8 gShop_UpArrowTiles[]
const u8 gShop_GemTiles[]
const u8 gShop_SmallUpArrowTiles[]
const u8 gShop_SmallDownArrowTiles[]
const u8 gShop_DownArrowTiles[]
const u8 gShop_HandTiles[]
What every part of the shop object shares: its includes, the shop actions and sanctum services,...
#define SHOP_CONFIRM_MENU_X
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
s8 poison
1 poisoned, 2 deadly poison
u8 haunt
set while an evil spirit grips the unit
s8 shopGifts
indexes the Game Ticket's credit cost
struct NodeChainNode * next
struct NodeChainNode * node
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
s16 action
The parameter its action script reads (a follow distance or an angle), or the player's frames to its ...
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
s8 active
its UI_SPRITE_ motion; 0 while free
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 filler0[4]
bytes before the first coloured pixel
u8 values[21]
palette bytes at indices 0, 4, 8, 12, 16 and 20
struct RenderOutput * anchor
the cursor's sprite, moved with its OAM
A shop's work: its windows, the party members' icons, the stock, the cursor and its icons,...
struct ShopCursor cursor
the hand cursor
s16 partyMemberIds[9]
the party in order (Party_ListActiveOwners)
u8 warriorShop
1 for stock rows 16 to 18, which greet as warriors'
u16 keeperResource
the shopkeeper's animation; picks the portrait
u16 cursorIcon
VRAM cache slots of the six cursor icons, loaded when the work is set up and freed with it.
s16 stockItemIds[129]
the items on sale, ended by 0
u8 shopType
the stock row's type: 0 items, 2 armor, else weapons
s8 partyAction
the counter chosen (enum ShopAction)
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_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
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.