Alchemy
Loading...
Searching...
No Matches

sanctum.c

Go to the documentation of this file.
1/// @file
2/// The sanctum's services, their prices and their sparkles.
3/// Part of shop.c, the shop object, compiled only through it.
4
5#include "../shop_internal.h"
6
7/// Calculates the existing fee for reviving, curing poison, exorcising or
8/// removing a curse.
9s32 Shop_ServicePrice(s32 unitId, s32 serviceKind) {
10 u8 level = UnitGetFar(unitId)->level;
11 s32 donation = 0;
12
13 if (serviceKind == SANCTUM_SERVICE_REVIVE) {
14 donation = level * 20;
15 } else if (serviceKind == SANCTUM_SERVICE_CURE_POISON) {
16 donation = 10;
17 } else if (serviceKind == SANCTUM_SERVICE_EXORCISE) {
18 donation = 50;
19 } else if (serviceKind == SANCTUM_SERVICE_REMOVE_CURSE) {
20 donation = level * 10;
21 }
22 return donation;
23}
24
25/// Checks whether a member needs the selected sanctum service.
26s32 Shop_CanServe(s32 unitId, s32 serviceKind) {
27 struct BattleUnit *unit = UnitGetFar(unitId);
28 s32 eligible = 0;
29
30 if ((serviceKind == SANCTUM_SERVICE_REVIVE && unit->hp <= 0) ||
31 (serviceKind == SANCTUM_SERVICE_CURE_POISON && unit->poison != 0) ||
32 (serviceKind == SANCTUM_SERVICE_EXORCISE && unit->haunt != 0) ||
33 (serviceKind == SANCTUM_SERVICE_REMOVE_CURSE && unit->restraint != 0)) {
34 eligible = 1;
35 }
36 return eligible;
37}
38
39/// Counts party members who need the currently selected sanctum service.
41 struct ShopRuntime *shop = gMenuWork;
42 s32 eligibleCount = 0;
43 s32 serviceKind = shop->partyAction;
44 s32 memberIndex;
45
46 for (memberIndex = 0; memberIndex < shop->partyMemberCount; memberIndex++) {
47 if (Shop_CanServe(shop->partyMemberIds[memberIndex], serviceKind))
48 eligibleCount++;
49 }
50 return eligibleCount;
51}
52
53/// Selects the matching poison, exorcism or curse-service message from a revive
54/// message base.
56 s8 serviceKind = ((struct ShopRuntime *)gMenuWork)->partyAction;
57
58 if (serviceKind == SANCTUM_SERVICE_CURE_POISON) {
59 messageId += MsgCurePoisonService - MsgReviveService;
60 }
61 if (serviceKind == SANCTUM_SERVICE_EXORCISE) {
62 messageId += MsgExorcismService - MsgReviveService;
63 }
64 if (serviceKind == SANCTUM_SERVICE_REMOVE_CURSE) {
65 messageId += MsgRemoveCurseService - MsgReviveService;
66 }
67 return messageId;
68}
69
70/// Resolves service dialogue and waits for completion, including the final
71/// frame.
73 s32 portraitResource;
74
75 portraitResource = BattleFx_GetResourceIdFar(
78 messageId = Shop_MsgByMode(messageId);
79 UiText_OpenMessageWindowFar(messageId, 5, 0,
80 (portraitResource << 0x10) | 0x22);
81 while (UiWork_IsCompleteFar() == 0) {
82 WaitFrames(1U);
83 }
84 WaitFrames(1U);
85}
86
87/// Resolves service dialogue, waits for it and restores the cursor's saved
88/// mode.
90 struct ShopRuntime *shop;
91 struct RenderOutput **cursorSlot;
92 s32 portraitResource;
93 u8 savedCursorMode;
94
95 shop = gMenuWork;
96 cursorSlot = &shop->cursor.anchor;
97 savedCursorMode = (*cursorSlot)->active;
98 portraitResource = BattleFx_GetResourceIdFar(shop->keeperResource);
99 messageId = Shop_MsgByMode(messageId);
100 (*cursorSlot)->active = 13;
102 UiText_OpenMessageWindowFar(messageId, 5, 0, (portraitResource << 16) | 0x22);
103 while (UiWork_IsCompleteFar() == 0)
104 WaitFrames(1);
105 WaitFrames(1);
106 shop->cursor.anchor->active = savedCursorMode;
107}
108
109/// Runs the sanctum service menu using the shared shop cursor and window
110/// resources.
112 s32 serviceSelection = 0;
113 struct UiWindow *listWindow = 0;
114 struct ShopRuntime *shop;
115 struct RenderOutput *cursorAnchor;
116
118 shop = gMenuWork;
119 shop->partyAction = serviceSelection;
120
121 {
122 s32 keeperAnimationId =
123 (u16)((struct AnimationObject *)((struct ObjectRuntime *)
124 Object_GetByIdFar(unitId))
125 ->animation)
126 ->entries[0]
127 ->animId;
128 shop->keeperResource = keeperAnimationId;
129 }
130
131 listWindow = UiWindow_CreateWithSideObjectFar(shop->keeperResource, 0, 0, 0);
132 if (listWindow == 0) {
133 listWindow = UiWindow_CreateFar(-5, 0, 5, 5, 2);
134 }
135 if (listWindow == 0) {
136 listWindow = UiWindow_CreateFar(0, 0, 5, 5, 2);
137 SideObject_CreateFar(2, 0, 0, listWindow, -4, -4);
138 }
139
140 cursorAnchor =
141 RenderOutput_CreateFar(shop->cursorIcon, 0x40000000, listWindow, 0, 0);
142 cursorAnchor->active = 1;
143 cursorAnchor->kind = 0;
144 ShopCursor_SetPositionImmediate(&shop->cursor, -32, 112);
145 shop->cursor.anchor = cursorAnchor;
146 UiMessage_ShowResolvedAndWait(MsgSanctumWelcome);
147
150
151 for (;;) {
152 serviceSelection = Menu_SelectSanctumServiceFar(serviceSelection);
153 shop->partyAction = serviceSelection;
154 if (serviceSelection == -1)
155 break;
156
157 {
158 s32 messageBase = MsgReviveService;
159 s32 message = messageBase;
160
161 messageBase = 0;
163 if (Shop_CountUnits() == 0) {
165 } else {
167 }
168 }
169 shop->partyAction = 0;
170 ShopCursor_SetPositionImmediate(&shop->cursor, -32, 112);
171 UiMessage_ShowResolvedAndWait(MsgSanctumMoreAid);
172 }
173
174 UiMessage_ShowResolvedAndWait(MsgSanctumFarewell);
176 UiWork_FinalizeFar(listWindow, 2);
178 return 0;
179}
180
181/// Selects an eligible member, confirms the donation and applies the chosen
182/// service.
184 struct ShopRuntime *shop = gMenuWork;
185 struct UiWindow *priceWindow;
186 s32 redraw;
187 s32 serviceKind;
188 struct UiWindow *listWindow;
189 s32 memberIndex;
190 s32 unitId;
191 s32 chooseAgain;
192 s32 donation;
193 s32 messageBase;
194
195 priceWindow = 0;
196 redraw = 1;
197 serviceKind = shop->partyAction;
198 UiMessage_ShowResolvedAndWait(MsgWhoToRevive);
199
200 listWindow = UiWindow_CreateFar(1, 12, 13, 3, 2);
201 shop->cursor.anchor->active = 4;
202 shop->mode = redraw;
203 PsynergyMenu_InitializeEntryObjectsFar(listWindow, 2, 0, 8, 0);
206
207 memberIndex = 0;
208 unitId = 0;
209 chooseAgain = 0;
210 while (memberIndex < shop->partyMemberCount) {
211 unitId = shop->partyMemberIds[memberIndex];
212 if (Shop_CanServe(unitId, serviceKind) != 0)
213 break;
214 memberIndex++;
215 }
216
217 redraw = 1;
218 for (;;) {
219 if (chooseAgain != 0) {
220 chooseAgain = 0;
221 UiMessage_ShowResolvedAndWait(MsgWhoToRevive);
222 redraw = 1;
223 memberIndex = 0;
224 while (memberIndex < shop->partyMemberCount) {
225 unitId = shop->partyMemberIds[memberIndex];
226 if (Shop_CanServe(unitId, serviceKind) != 0)
227 break;
228 memberIndex++;
229 }
230 }
231
232 if (redraw != 0) {
233 redraw = 0;
234 memberIndex =
235 (memberIndex + shop->partyMemberCount) % shop->partyMemberCount;
236 unitId = shop->partyMemberIds[memberIndex];
237 Shop_PlaceCursor(listWindow, memberIndex * 24 - 12, 0);
238 shop->mode = 3;
239 Shop_HiliteUnit(listWindow, memberIndex);
240 Shop_DrawSelectMsg(priceWindow, unitId);
241 }
242
243 if ((gKeysPressed & KEY_A) != 0) {
244 WaitFrames(1);
245 donation = Shop_ServicePrice(unitId, serviceKind);
246 if (Shop_CanServe(unitId, serviceKind) == 0) {
248 continue;
249 }
250 UiWork_PushValueSlotFar(unitId, 1);
251 UiWork_PushValueSlotFar(donation, 5);
252 messageBase = MsgReviveDonation;
254 if (UiMessage_ShowChoiceVariant(0) != 0) {
256 chooseAgain = 1;
257 continue;
258 }
259 if (donation > (u32)gGameState.coins) {
262 chooseAgain = 1;
263 continue;
264 }
265 UiWork_PushValueSlotFar(unitId, 1);
266 UiMessage_ShowResolvedAndWait(messageBase + 3);
268 // Apply the cure and animation before collecting the donation.
269 BattleUnit_ResetStateByMode(unitId, serviceKind);
270 Shop_RunPartyMemberIconBurst(memberIndex);
271 Party_AdjustCoinsFar(-donation);
273 UiWork_PushValueSlotFar(unitId, 1);
274 UiMessage_ShowResolvedAndWait(messageBase + 4);
275 if (Shop_CountUnits() != 0) {
276 chooseAgain = 1;
277 continue;
278 }
279 break;
280 }
281 if ((gKeysPressed & KEY_B) != 0) {
283 break;
284 }
285 if ((gKeysRepeat & KEY_LEFT) != 0) {
287 redraw = 1;
288 memberIndex -= 1;
289 }
290 if ((gKeysRepeat & KEY_RIGHT) != 0) {
292 redraw = 1;
293 memberIndex += 1;
294 }
295 WaitFrames(1);
296 continue;
297 }
298
300 UiWork_FinalizeFar(priceWindow, 2);
301 UiWork_FinalizeFar(listWindow, 2);
302 WaitFrames(1);
303 return 0;
304}
305
306/// Revives, cures poison, removes a haunting or unequips cursed items for a
307/// sanctum service.
308void BattleUnit_ResetStateByMode(s32 unitId, s32 serviceKind) {
309 struct BattleUnit *unit;
310
311 unit = UnitGetFar(unitId);
312 if (serviceKind == SANCTUM_SERVICE_REVIVE) {
313 unit->hp = unit->maxHp;
314 UnitRatioFar(unitId);
315 } else if (serviceKind == SANCTUM_SERVICE_CURE_POISON) {
316 unit->poison = 0;
317 } else if (serviceKind == SANCTUM_SERVICE_EXORCISE) {
318 unit->haunt = 0;
319 } else if (serviceKind == SANCTUM_SERVICE_REMOVE_CURSE) {
320 s32 inventorySlot;
321
322 for (inventorySlot = 0; inventorySlot < INVENTORY_SLOTS; inventorySlot++) {
323 if (unit->inventory[inventorySlot] & INVENTORY_EQUIPPED) {
324 if (Item_GetDirectFar(unit->inventory[inventorySlot])->flags &
325 ITEM_CURSED) {
326 unit->inventory[inventorySlot] ^= INVENTORY_EQUIPPED;
327 UnitCalcFar(unitId);
328 }
329 }
330 }
331 }
332}
333
334/// Highlights the selected party icon and dims members who do not need the
335/// sanctum service.
336void Shop_HiliteUnit(struct UiWindow *window, s32 selected) {
337 struct ShopRuntime *shop = gMenuWork;
338 s32 memberIndex;
339 s32 serviceKind = shop->partyAction;
340
341 if (window != 0) {
342 for (memberIndex = 0; memberIndex < shop->partyMemberCount; memberIndex++) {
343 if (memberIndex == selected)
345 30);
346 else
348 1);
349 shop->partyMemberScale[memberIndex] = 0x10000;
350 if (!Shop_CanServe(shop->partyMemberIds[memberIndex], serviceKind))
351 shop->partyMemberScale[memberIndex] = 0xb333;
352 }
353 }
354}
355
356/// Shows the selected member's service price or the message that no treatment
357/// is needed.
358void Shop_DrawSelectMsg(struct UiWindow *target, s32 unitId) {
359 s32 serviceOrMessage;
360 s32 donation;
361
362 serviceOrMessage = ((struct ShopRuntime *)gMenuWork)->partyAction;
363 donation = Shop_ServicePrice(unitId, serviceOrMessage);
364 if (target != 0) {
366 if (Shop_CanServe(unitId, serviceOrMessage) != 0) {
367 serviceOrMessage = MsgReviveCost;
368 } else {
369 serviceOrMessage = MsgNoHealingNeeded;
370 }
371 serviceOrMessage = Shop_MsgByMode(serviceOrMessage);
372 UiWork_PushValueSlotFar(donation, 5);
373 UiText_DrawResourceFar(serviceOrMessage, target, 0, 0);
374 }
375}
376
377/// Picks random particle positions, moves toward the target and releases
378/// finished particles.
380 struct FixedPointPosition position;
381 s8 *statePointer;
382 s32 state;
383 s32 targetPending;
384
385 statePointer = &effect->state;
386 state = *statePointer;
387 if (state == 0) {
388 position.x = effect->originX;
389 position.z = effect->originZ;
390 Vector_AddPolarOffset(0x280000, Random16(), &position);
391 EffectSlot_SetPositionFar(effect, position.x, position.z);
392 position.x = effect->originX;
393 position.z = effect->originZ;
394 Vector_AddPolarOffset(0x40000, Random16(), &position);
395 effect->targetX = position.x;
396 effect->targetZ = position.z;
397 effect->maxSpeed = 0x20000;
398 effect->acceleration = 0x6666;
399 effect->limitTurnStep = state;
400 *statePointer = *statePointer + 1;
401 } else if (state == 1) {
402 targetPending = EffectSlot_HasPendingTargetFar(effect);
403 if (targetPending == 0)
404 *statePointer = targetPending;
405 } else if (state == 2) {
406 if (EffectSlot_HasPendingTargetFar(effect) == 0)
408 }
409}
410
411/// Updates all 24 service particles, then randomizes the active member's pose.
413 struct ShopRuntime *shop = gMenuWork;
414 struct EffectSlot *effect = shop->effects;
415 s32 remainingEffects = 23;
416 s8 burstMember;
417
418 do {
419 remainingEffects--;
420 EffectSlot_UpdateFar(effect);
421 effect++;
422 } while (remainingEffects >= 0);
423 burstMember = shop->burstMember;
424 if (burstMember != -1)
426 shop->partyMemberIcons[burstMember], (Random16() * 7) >> 16);
427}
428
429/// Sound effects for each party member action
430static const s8 sSanctumServiceCues[4] = {
431 0x52,
432 0x54,
433 0x58,
434 0x57,
435};
436
437/// Animates the selected member and service particles, then restores the menu
438/// and cursor.
440
441 struct ShopRuntime *shop;
442 s8 savedCursorMode;
443 struct FixedPointPosition position;
444 struct EffectSlot *effect;
445 s32 callbackPriority;
446 s32 effectIndex;
447
448 shop = gMenuWork;
449 savedCursorMode = shop->cursor.anchor->active;
450 shop->burstMember = 0xff;
451 shop->cursor.anchor->active = 13;
455 WaitFrames(20);
456 callbackPriority = 0xc80;
458
459 position.x = shop->partyMemberX[member] << 16;
460 position.z = (shop->partyMemberY[member] << 16) + 0xfff40000;
461
462 // Spawn eighteen particles while the task continues updating all twenty-four.
463 effectIndex = 0;
464 effect = shop->effects;
465 do {
466 EffectSlot_InitializeFar(effect, 0x11c, position.x, position.z);
470 (Random16() * 7) >> 16);
471 effect->scaleY = 0xb333;
472 effect->scaleX = 0xb333;
473 WaitFrames(3);
474 if (effectIndex == 5) {
475 shop->burstMember = member;
476 }
477 effectIndex++;
478 effect++;
479 } while (effectIndex <= 17);
480
481 // Let active particles finish, then release remaining slots and restore UI.
483 {
484 u8 activeMode = 2;
485 u8 *entry = (u8 *)&shop->effects[0].state;
486 for (effectIndex = 23; effectIndex >= 0; effectIndex--) {
487 if (*(s8 *)(entry + 5) != 0) {
488 *entry = activeMode;
489 }
490 entry += sizeof(struct EffectSlot);
491 }
492 }
493
494 WaitFrames(20);
496 shop->burstMember = -1;
498 WaitFrames(20);
499
500 {
501 u8 *flagEntry = (u8 *)&shop->effects[0].active;
502 struct EffectSlot *effectSlot = shop->effects;
503 for (effectIndex = 23; effectIndex >= 0; effectIndex--) {
504 s32 flag = *flagEntry;
505
506 flag <<= 24;
507
508 flagEntry += 0x48;
509 if (flag != 0) {
510 BattleFx_ClearOwnedSlotFar(effectSlot);
511 }
512 effectSlot++;
513 }
514 }
515
519 WaitFrames(30);
520 shop->cursor.anchor->active = savedCursorMode;
521}
void Shop_DrawMoney(void)
Draws the party's coins in the coins window, in the edition's layout.
Definition buy.c:305
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),...
Definition cursor.c:273
void Shop_RestoreFieldPalette(void)
Fades back to the colours Shop_SaveAndTintFieldPalette saved, over 16 frames.
Definition cursor.c:147
void Shop_SaveAndTintFieldPalette(s32 layer)
Saves the field colours in event work and fades to layer over 16 frames.
Definition cursor.c:122
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.
Definition cursor.c:249
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)
void Menu_ReleaseEntryObjectsFar(void)
void PsynergyMenu_InitializeEntryObjectsFar(void *source, s32 originX, s32 originY, s32 spacing, s32 unused)
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.
Definition frame.c:97
struct GameState gGameState
void * gMenuWork
@ KEY_B
Definition io_reg.h:244
@ KEY_LEFT
Definition io_reg.h:248
@ KEY_RIGHT
Definition io_reg.h:247
@ KEY_A
Definition io_reg.h:243
@ INVENTORY_EQUIPPED
Definition item.h:17
@ INVENTORY_SLOTS
Definition item.h:23
@ ITEM_CURSED
Definition item.h:27
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,...
Definition math.c:23
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
void Shop_ReleaseCursorWork(void)
Stops the cursor task, frees the six cursor icons and the work block.
Definition run.c:79
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...
Definition run.c:291
void AudioCommand_WaitForStateByteClear(void)
Waits one frame at a time until the sound driver has finished the last command.
Definition run.c:198
void Shop_InitializeCursorWork(void)
Allocates and clears the work block in the menu's heap slot, lists the party, loads the six cursor ic...
Definition run.c:47
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
void Shop_RunPartyMemberIconBurst(s32 member)
Animates the selected member and service particles, then restores the menu and cursor.
Definition sanctum.c:439
void BattleUnit_ResetStateByMode(s32 unitId, s32 serviceKind)
Revives, cures poison, removes a haunting or unequips cursed items for a sanctum service.
Definition sanctum.c:308
s32 Shop_CountUnits(void)
Counts party members who need the currently selected sanctum service.
Definition sanctum.c:40
void UiMessage_ShowResolvedAndRestoreState(s32 messageId)
Resolves service dialogue, waits for it and restores the cursor's saved mode.
Definition sanctum.c:89
s32 Shop_CanServe(s32 unitId, s32 serviceKind)
Checks whether a member needs the selected sanctum service.
Definition sanctum.c:26
void UiMessage_ShowResolvedAndWait(s32 messageId)
Resolves service dialogue and waits for completion, including the final frame.
Definition sanctum.c:72
s32 Sanctum_RunPartyService(void)
Selects an eligible member, confirms the donation and applies the chosen service.
Definition sanctum.c:183
static const s8 sSanctumServiceCues[4]
Sound effects for each party member action.
Definition sanctum.c:430
void Shop_ResetEffects(void)
Updates all 24 service particles, then randomizes the active member's pose.
Definition sanctum.c:412
void BattleFx_UpdateRadialMotion(struct EffectSlot *effect)
Picks random particle positions, moves toward the target and releases finished particles.
Definition sanctum.c:379
s32 Shop_ConfirmAct(s32 unitId)
Runs the sanctum service menu using the shared shop cursor and window resources.
Definition sanctum.c:111
void Shop_HiliteUnit(struct UiWindow *window, s32 selected)
Highlights the selected party icon and dims members who do not need the sanctum service.
Definition sanctum.c:336
s32 Shop_ServicePrice(s32 unitId, s32 serviceKind)
Calculates the existing fee for reviving, curing poison, exorcising or removing a curse.
Definition sanctum.c:9
s32 Shop_MsgByMode(s32 messageId)
Selects the matching poison, exorcism or curse-service message from a revive message base.
Definition sanctum.c:55
void Shop_DrawSelectMsg(struct UiWindow *target, s32 unitId)
Shows the selected member's service price or the message that no treatment is needed.
Definition sanctum.c:358
What every part of the shop object shares: its includes, the shop actions and sanctum services,...
@ SANCTUM_SERVICE_EXORCISE
@ SANCTUM_SERVICE_REVIVE
@ 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_RECOVERY
Definition songs.h:119
#define SE_MENU_CANCEL
Definition songs.h:106
#define SE_MENU_CURSOR_MOVE
Definition songs.h:104
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
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
s8 restraint
The curse.
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,...
Definition effect_slot.h:18
s32 scaleY
16.16 fixed point, 0x10000 full size
Definition effect_slot.h:30
s8 state
the callback's own step; 0 when it is given
Definition effect_slot.h:38
void * object
the slot's sprite, released with the slot
Definition effect_slot.h:19
s32 originX
16.16 fixed-point pixels; where the slot started
Definition effect_slot.h:24
s8 limitTurnStep
Clamp steering to maxTurnStep; zero faces the target directly.
Definition effect_slot.h:40
s32 originZ
16.16 fixed-point pixels; where the slot started
Definition effect_slot.h:25
s32 targetZ
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
Definition effect_slot.h:23
s32 scaleX
16.16 fixed point, 0x10000 full size
Definition effect_slot.h:29
s32 targetX
16.16 fixed-point pixels; EFFECT_NO_TARGET at rest
Definition effect_slot.h:22
s8 active
nonzero while the slot is in use
Definition effect_slot.h:44
s32 maxSpeed
16.16 fixed-point pixels per frame
Definition effect_slot.h:27
s32 acceleration
16.16 fixed-point pixels per frame, each frame
Definition effect_slot.h:28
A position in three coordinates, each in 16.16 fixed point.
s32 z
16.16 fixed point
s32 x
16.16 fixed point
u8 flags
enum ItemFlags
Definition item.h:107
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
Definition cursor.h:14
A shop's work: its windows, the party members' icons, the stock, the cursor and its icons,...
Definition shop.h:18
s32 partyMemberScale[8]
16.16 fixed point, 0x10000 full size
Definition shop.h:27
s8 burstMember
the sanctum's member whose pose is randomized; -1 none
Definition shop.h:51
struct EffectSlot effects[24]
the sanctum service's particles
Definition shop.h:54
s8 partyMemberCount
Definition shop.h:47
struct ShopCursor cursor
the hand cursor
Definition shop.h:31
s16 partyMemberIds[9]
the party in order (Party_ListActiveOwners)
Definition shop.h:30
struct AnimationObject * partyMemberIcons[8]
the party row's sprites
Definition shop.h:24
s16 partyMemberY[8]
pixels
Definition shop.h:26
struct UiWindow * moneyWindow
the coins window
Definition shop.h:20
u16 keeperResource
the shopkeeper's animation; picks the portrait
Definition shop.h:45
u16 cursorIcon
VRAM cache slots of the six cursor icons, loaded when the work is set up and freed with it.
Definition shop.h:35
s16 partyMemberX[8]
pixels
Definition shop.h:25
s8 partyAction
the counter chosen (enum ShopAction)
Definition shop.h:50
u8 mode
passed on as the hand cursor's kind; set to 12 at first
Definition shop.h:48
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11