14 donation = level * 20;
20 donation = level * 10;
42 s32 eligibleCount = 0;
59 messageId += MsgCurePoisonService - MsgReviveService;
62 messageId += MsgExorcismService - MsgReviveService;
65 messageId += MsgRemoveCurseService - MsgReviveService;
80 (portraitResource << 0x10) | 0x22);
97 savedCursorMode = (*cursorSlot)->
active;
100 (*cursorSlot)->active = 13;
112 s32 serviceSelection = 0;
122 s32 keeperAnimationId =
132 if (listWindow == 0) {
135 if (listWindow == 0) {
143 cursorAnchor->
kind = 0;
154 if (serviceSelection == -1)
158 s32 messageBase = MsgReviveService;
159 s32 message = messageBase;
210 while (memberIndex < shop->partyMemberCount) {
219 if (chooseAgain != 0) {
224 while (memberIndex < shop->partyMemberCount) {
252 messageBase = MsgReviveDonation;
322 for (inventorySlot = 0; inventorySlot <
INVENTORY_SLOTS; inventorySlot++) {
342 for (memberIndex = 0; memberIndex < shop->
partyMemberCount; memberIndex++) {
343 if (memberIndex == selected)
359 s32 serviceOrMessage;
367 serviceOrMessage = MsgReviveCost;
369 serviceOrMessage = MsgNoHealingNeeded;
385 statePointer = &effect->
state;
386 state = *statePointer;
400 *statePointer = *statePointer + 1;
401 }
else if (state == 1) {
403 if (targetPending == 0)
404 *statePointer = targetPending;
405 }
else if (state == 2) {
415 s32 remainingEffects = 23;
422 }
while (remainingEffects >= 0);
424 if (burstMember != -1)
445 s32 callbackPriority;
456 callbackPriority = 0xc80;
460 position.
z = (shop->
partyMemberY[member] << 16) + 0xfff40000;
474 if (effectIndex == 5) {
479 }
while (effectIndex <= 17);
486 for (effectIndex = 23; effectIndex >= 0; effectIndex--) {
487 if (*(
s8 *)(entry + 5) != 0) {
503 for (effectIndex = 23; effectIndex >= 0; effectIndex--) {
504 s32 flag = *flagEntry;
void Shop_DrawMoney(void)
Draws the party's coins in the coins window, in the edition's layout.
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 Shop_RestoreFieldPalette(void)
Fades back to the colours Shop_SaveAndTintFieldPalette saved, over 16 frames.
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.
s32 AnimationObjects_SelectAnimationFar(struct AnimationObject *state, s32 flags)
void AnimationObjects_SetActiveTimerStepsFar(struct AnimationObject *group, s32 val)
void ObjectGroup_SetChildValueUnlessFifteenFar(void *raw_parent, u32 value)
struct BattleUnit * UnitGetFar(u32 owner)
struct ItemDefinition * Item_GetDirectFar(s32 item)
void UnitRatioFar(s32 owner_id)
void UnitCalcFar(s32 owner)
s32 Party_AdjustCoinsFar(s32 amount)
s32 BattleFx_GetResourceIdFar(u32 id)
void BattleFx_ClearOwnedSlotFar(struct EffectSlot *slot)
u32 EffectSlot_HasPendingTargetFar(struct EffectSlot *effect)
void EffectSlot_SetCallbackFar(struct EffectSlot *effect, EffectCallback callback)
void EffectSlot_InitializeFar(struct EffectSlot *effect, s32 kind, s32 x, s32 z)
void EffectSlot_SetPositionFar(struct EffectSlot *effect, s32 x, s32 z)
void EffectSlot_UpdateFar(struct EffectSlot *effect)
void EffectSlot_SetObjectModeFar(struct EffectSlot *effect, s32 mode)
struct FieldActor * Object_GetByIdFar(s32 objectId)
void AudioCommand_PlayFar(s32 id)
void RenderOutput_PrepareForRedrawFar(struct UiWindow *window)
struct UiWindow * UiWindow_CreateFar(s32 x, s32 y, s32 width, s32 height, s32 attrs)
s32 Menu_SelectSanctumServiceFar(s32 selection)
struct RenderOutput * SideObject_CreateFar(s32 object_kind, s32 position, s32 side, struct UiWindow *arg3, s32 arg4, s32 arg5)
Far call to CreateSideObject.
struct RenderOutput * RenderOutput_CreateFar(s32 slot, s32 flags, struct UiWindow *input, s32 offsetX, s32 offsetY)
void UiText_DrawResourceFar(s32 arg0, struct UiWindow *arg1, s32 arg2, s32 arg3)
void UiWork_FinalizeFar(struct UiWindow *work, s32 release)
struct UiWindow * UiWindow_CreateWithSideObjectFar(s32 arg0, s32 arg1, s32 x, s32 y)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
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
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
void Shop_ReleaseCursorWork(void)
Stops the cursor task, frees the six cursor icons and the work block.
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 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...
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,...
void Shop_RunPartyMemberIconBurst(s32 member)
Animates the selected member and service particles, then restores the menu and cursor.
void BattleUnit_ResetStateByMode(s32 unitId, s32 serviceKind)
Revives, cures poison, removes a haunting or unequips cursed items for a sanctum service.
s32 Shop_CountUnits(void)
Counts party members who need the currently selected sanctum service.
void UiMessage_ShowResolvedAndRestoreState(s32 messageId)
Resolves service dialogue, waits for it and restores the cursor's saved mode.
s32 Shop_CanServe(s32 unitId, s32 serviceKind)
Checks whether a member needs the selected sanctum service.
void UiMessage_ShowResolvedAndWait(s32 messageId)
Resolves service dialogue and waits for completion, including the final frame.
s32 Sanctum_RunPartyService(void)
Selects an eligible member, confirms the donation and applies the chosen service.
static const s8 sSanctumServiceCues[4]
Sound effects for each party member action.
void Shop_ResetEffects(void)
Updates all 24 service particles, then randomizes the active member's pose.
void BattleFx_UpdateRadialMotion(struct EffectSlot *effect)
Picks random particle positions, moves toward the target and releases finished particles.
s32 Shop_ConfirmAct(s32 unitId)
Runs the sanctum service menu using the shared shop cursor and window resources.
void Shop_HiliteUnit(struct UiWindow *window, s32 selected)
Highlights the selected party icon and dims members who do not need the sanctum service.
s32 Shop_ServicePrice(s32 unitId, s32 serviceKind)
Calculates the existing fee for reviving, curing poison, exorcising or removing a curse.
s32 Shop_MsgByMode(s32 messageId)
Selects the matching poison, exorcism or curse-service message from a revive message base.
void Shop_DrawSelectMsg(struct UiWindow *target, s32 unitId)
Shows the selected member's service price or the message that no treatment is needed.
What every part of the shop object shares: its includes, the shop actions and sanctum services,...
@ SANCTUM_SERVICE_EXORCISE
@ SANCTUM_SERVICE_REMOVE_CURSE
@ SANCTUM_SERVICE_CURE_POISON
#define SANCTUM_PRICE_WINDOW_WIDTH
#define SHOP_MONEY_WINDOW_WIDTH
#define SANCTUM_PRICE_WINDOW_X
#define SE_MENU_CURSOR_MOVE
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
s8 poison
1 poisoned, 2 deadly poison
u8 haunt
set while an evil spirit grips the unit
s16 hp
current HP, 0 when downed
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
u8 level
1 to 99 for a character
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
A particle a Psynergy effect moves and draws: its sprite, its position and target,...
s32 scaleY
16.16 fixed point, 0x10000 full size
s8 state
the callback's own step; 0 when it is given
void * object
the slot's sprite, released with the slot
s32 originX
16.16 fixed-point pixels; where the slot started
s8 limitTurnStep
Clamp steering to maxTurnStep; zero faces the target directly.
s32 originZ
16.16 fixed-point pixels; where the slot started
s32 targetZ
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 targetX
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
s8 active
nonzero while the slot is in use
s32 maxSpeed
16.16 fixed-point pixels per frame
s32 acceleration
16.16 fixed-point pixels per frame, each frame
A position in three coordinates, each in 16.16 fixed point.
One of the 64 field objects in the object pool (heap slot 5): its script, position,...
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...
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,...
s32 partyMemberScale[8]
16.16 fixed point, 0x10000 full size
s8 burstMember
the sanctum's member whose pose is randomized; -1 none
struct EffectSlot effects[24]
the sanctum service's particles
struct ShopCursor cursor
the hand cursor
s16 partyMemberIds[9]
the party in order (Party_ListActiveOwners)
struct AnimationObject * partyMemberIcons[8]
the party row's sprites
s16 partyMemberY[8]
pixels
struct UiWindow * moneyWindow
the coins window
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 partyMemberX[8]
pixels
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...