src/shop/shop_run.c
Running a shop, its cursor state, and the message helpers every counter uses. More…
Included by shop.c.
Macros
| Name | Description | |
|---|---|---|
#define | SHOP_DEBUG_STOCK_ROW | The debug shop sells Vale's armor in Japanese and its weapons in every edition but the Japanese. |
#define | DEBUG_SHOP_COINS 200000 | The coins the debug shop gives. |
#define | DEBUG_SHOP_KEEPER 30 | The actor whose sprite picks the debug shop keeper's portrait, in whatever room it opens. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | mnShopListAvailableArtifacts (void) | Lists the current shop's artifacts: every item of the shop's type whose shared stock counter is above zero. |
void | mnCursorStep (void) | Advances the hand cursor one tick. |
void | mnShopInitState (void) | Opens a counter's state: the party list, the cursor icons and the cursor's event, which last until mnShopReleaseState. |
void | mnShopReleaseState (void) | Stops the cursor event, frees the six cursor icons and the state block. |
Sint32 | mnShopRun (Sint32 stockRow, Sint32 keeperId) | Runs a shop: the shopkeeper's welcome, then buy, sell, artifacts and repair until the player leaves. keeperId is the actor whose portrait the lines show. |
Sint32 | mnShopOpenDebugShop (Sint32 unused) | Opens the debug shop with DEBUG_SHOP_COINS, the ticket counter at its cap, broken equipment for repairs and poisoned or haunted party members for the sanctum. |
void | mnSoundWaitForJingle (void) | Waits a tick at a time while a jingle holds back the music, as the inn's does through the night. |
void | mnShopShowKeeperMessage (Sint32 msgId) | Shows a shopkeeper's line and waits until it is typed out. |
void | mnShopShowKeeperMessageHidingCursor (Sint32 msgId) | Shows a shopkeeper's line as mnShopShowKeeperMessage does, hiding the hand cursor while it shows and putting back its motion after. |
Sint32 | mnShopAskYesNo (Sint32 choice) | Runs the Yes or No choice beside the shopkeeper's line: 0 for Yes, 1 for No or B. |
Sint32 | mnSanctumAskYesNo (Sint32 choice) | Runs the Yes or No choice at the sanctum's place on the screen and returns it, keeping the hand cursor's motion. |
SELECTION_NODE * | mnNodeChainGetNodeAtIndex (SELECTION_MENU_STATE *state) | Returns the node state->count next links on from state->node. |
Description
Running a shop, its cursor state, and the message helpers every counter uses.
Part of shop.c.
Macros in detail
SHOP_DEBUG_STOCK_ROW
#define SHOP_DEBUG_STOCK_ROW
The debug shop sells Vale's armor in Japanese and its weapons in every edition but the Japanese.
Referenced by mnShopOpenDebugShop().
Definition at line 197 of file shop_run.c.
DEBUG_SHOP_COINS
#define DEBUG_SHOP_COINS 200000
The coins the debug shop gives.
Referenced by mnShopOpenDebugShop().
Definition at line 203 of file shop_run.c.
DEBUG_SHOP_KEEPER
#define DEBUG_SHOP_KEEPER 30
The actor whose sprite picks the debug shop keeper's portrait, in whatever room it opens.
Referenced by mnShopOpenDebugShop().
Definition at line 206 of file shop_run.c.
Functions in detail
mnShopListAvailableArtifacts
Sint32 mnShopListAvailableArtifacts(void)
Lists the current shop's artifacts: every item of the shop's type whose shared stock counter is above zero.
References gmItemAdjustRareItemStockStub(), gmItemGetEquipmentGroupStub() and Sint32.
Referenced by mnShopRun() and mnShopSelectBuy().
Definition at line 8 of file shop_run.c.
mnCursorStep
void mnCursorStep(void)
Advances the hand cursor one tick. Runs every tick as an event while a counter is open.
References mnCursorAdvance().
Referenced by mnShopInitState() and mnShopReleaseState().
Definition at line 40 of file shop_run.c.
mnShopInitState
void mnShopInitState(void)
Opens a counter's state: the party list, the cursor icons and the cursor's
event, which last until mnShopReleaseState. Every counter opens with it.
References fdEndBusyAndRevealStub(), gmPartyListMembersStub(), MenuCursorHandTiles, mnCursorStep(), ShopDownArrowTiles, ShopGemTiles, ShopSmallDownArrowTiles, ShopSmallUpArrowTiles, ShopUpArrowTiles, Sint32, syHeapSlotAllocate(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnInnCheckIn(), mnItemPickerRun(), mnSanctumRun() and mnShopRun().
Definition at line 47 of file shop_run.c.
mnShopReleaseState
void mnShopReleaseState(void)
Stops the cursor event, frees the six cursor icons and the state block. Every counter closes with it.
References mnCursorStep(), mnMessageCloseFinishedWindowsStub(), state, syCloseEvent(), syHeapSlotRelease() and syVRAMCacheFreeEntry().
Referenced by mnInnCheckIn(), mnItemPickerRun(), mnSanctumRun() and mnShopRun().
Definition at line 81 of file shop_run.c.
mnShopRun
Sint32 mnShopRun(Sint32 stockRow, Sint32 keeperId)
Runs a shop: the shopkeeper's welcome, then buy, sell, artifacts and repair until the player leaves. keeperId is the actor whose portrait the lines show.
References fdActorGetByIdStub(), mnCursorSetPosImmediate(), mnPortraitOpenWindowStub(), mnSelectShopCommandStub(), mnShopChooseMember(), mnShopInitState(), mnShopListAvailableArtifacts(), mnShopReleaseState(), mnShopRunRepairMemberChoice(), mnShopSelectBuy(), mnShopShowKeeperMessage(), mnShopStockAddArtifacts(), mnShopStockCopyItems(), mnShopStockGetRowCount(), mnShopStockGetType(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowSpriteCreateStub(), Sint32 and sySynch().
Referenced by mnShopOpenDebugShop(), scAltinTalkToArmorMerchant(), scAltinTalkToItemMerchant(), scCottageRoomsATalkToArmorMerchant(), scCottageRoomsATalkToItemMerchant(), scCottageRoomsATalkToWeaponMerchant(), scCottageRoomsCTalkToArmorMerchant(), scCottageRoomsCTalkToItemMerchant(), scCottageRoomsCTalkToWeaponMerchant(), scCottageRoomsDTalkToWeaponMerchant(), scImilTalkToArmorMerchant(), scImilTalkToItemMerchant(), scImilTalkToWeaponMerchant(), scKalayTalkToArmorMerchant(), scKalayTalkToItemMerchant(), scKalayTalkToWeaponMerchant(), scLacquerRoomsBTalkToArmorMerchant(), scLacquerRoomsBTalkToItemMerchant(), scLacquerRoomsBTalkToWeaponMerchant(), scLogRoomsATalkToArmorMerchant(), scLogRoomsATalkToItemMerchant(), scLogRoomsATalkToWeaponMerchant(), scLogRoomsBTalkToArmorMerchant(), scLogRoomsBTalkToItemMerchant(), scLogRoomsBTalkToWeaponMerchant(), scLogRoomsCTalkToArmorMerchant(), scLogRoomsCTalkToItemMerchant(), scLogRoomsCTalkToWeaponMerchant(), scRockRoomsTalkToArmorMerchant(), scRockRoomsTalkToItemMerchant(), scRockRoomsTalkToWeaponMerchant(), scStuccoRoomsBTalkToArmorMerchant(), scStuccoRoomsBTalkToItemMerchant(), scStuccoRoomsBTalkToWeaponMerchant(), scTimberRoomsATalkToMerchant(), scTimberRoomsBCTalkToArmorMerchant(), scTimberRoomsBCTalkToItemMerchant() and scTimberRoomsBCTalkToWeaponMerchant().
Definition at line 99 of file shop_run.c.
mnShopOpenDebugShop
Sint32 mnShopOpenDebugShop(Sint32 unused)
Opens the debug shop with DEBUG_SHOP_COINS, the ticket counter at its cap,
broken equipment for repairs and poisoned or haunted party members for the
sanctum.
References gmInventoryAddItemStub(), gmInventoryEquipStub(), gmUnitGetStub(), MainRoutineStateWork, mnShopRun() and Sint32.
Referenced by dbMenuTestOpenDebugShop().
Definition at line 211 of file shop_run.c.
mnSoundWaitForJingle
void mnSoundWaitForJingle(void)
Waits a tick at a time while a jingle holds back the music, as the inn's does through the night.
References sySoundGetBGMRestoreDelayStub() and sySynch().
Referenced by mnInnPlaySleep(), mnSanctumRunMemberIconBurst(), scInit() and scLemurianShipRaiseTheShip().
Definition at line 230 of file shop_run.c.
mnShopShowKeeperMessage
void mnShopShowKeeperMessage(Sint32 msgId)
Shows a shopkeeper's line and waits until it is typed out. The line is given as a weapon shop's: an armor or item shop says its own, the same distance on in the text, and a warriors' shop its own beyond that.
References fdSpeakerGetVoiceStub(), mnMessageAllTypedStub(), mnMessageCloseFinishedWindowsStub(), mnMessageOpenWindowStub(), Sint32 and sySynch().
Referenced by mnInnCheckIn(), mnShopConfirmEquip(), mnShopGiveGameTicket(), mnShopRun(), mnShopSelectBuy(), mnShopSelectBuyCount(), mnShopSelectRepair(), mnShopSelectSell() and mnShopSelectSellCount().
Definition at line 241 of file shop_run.c.
mnShopShowKeeperMessageHidingCursor
void mnShopShowKeeperMessageHidingCursor(Sint32 msgId)
Shows a shopkeeper's line as mnShopShowKeeperMessage does, hiding the hand
cursor while it shows and putting back its motion after.
References fdSpeakerGetVoiceStub(), mnMessageAllTypedStub(), mnMessageCloseFinishedWindowsStub(), mnMessageOpenWindowStub(), Sint32 and sySynch().
Referenced by mnShopBuyDone(), mnShopConfirmEquip(), mnShopGiveGameTicket(), mnShopRepairItem(), mnShopSelectBuy() and mnShopSellItem().
Definition at line 269 of file shop_run.c.
mnShopAskYesNo
Sint32 mnShopAskYesNo(Sint32 choice)
Runs the Yes or No choice beside the shopkeeper's line: 0 for Yes, 1 for No or B.
References mnIconShowStub(), mnYesNoMenuRunAtStub() and Sint32.
Referenced by mnInnCheckIn(), mnShopConfirmEquip(), mnShopRepairItem(), mnShopSelectBuy() and mnShopSellItem().
Definition at line 315 of file shop_run.c.
mnSanctumAskYesNo
Sint32 mnSanctumAskYesNo(Sint32 choice)
Runs the Yes or No choice at the sanctum's place on the screen and returns it, keeping the hand cursor's motion.
References mnIconShowStub(), mnYesNoMenuRunAtStub() and Sint32.
Referenced by mnSanctumRunPartyService().
Definition at line 327 of file shop_run.c.
mnNodeChainGetNodeAtIndex
SELECTION_NODE *mnNodeChainGetNodeAtIndex(SELECTION_MENU_STATE *state)
Returns the node state->count next links on from state->node. Nothing
calls it.
Definition at line 339 of file shop_run.c.