src/window/window_icons.c
The 16x16 icons of items, Psynergy and commands, built from their pictures, a tick under them and the marks over them, and the 32x32 icons and portraits loaded with their colours. More…
Included by window.c.
Macros
| Name | Description | |
|---|---|---|
#define | ICON_DIGIT_TENS_FIRST 10 | IconDigitPointers: the digits 0 to 9, then the tens 10 to 30 from this entry. |
#define | PORTRAIT_FIRST_SPRITE_ICON 16 | The icon resource's row of the first sprite portrait, PORTRAIT_FIRST_SPRITE_PORTRAIT. |
Enumerations
| Name | Description | |
|---|---|---|
enum | ICON_BASE_KIND { ICON_BASE_COMMAND, ICON_BASE_COMMAND_RED, ICON_BASE_ITEM } | The ticks an icon is drawn over (IconBasePointerTable). |
enum | ICON_MARK { ICON_MARK_EQUIPPED, ICON_MARK_BROKEN, ICON_MARK_ARTIFACT } | The marks drawn over an item's icon (IconMarkPointers). |
Functions
| Name | Description | |
|---|---|---|
void | mnIconDecode (ICON_TRANSFER *glyph, Sint32 overlay) | Decodes a compressed icon into the glyph buffer and expands it to tiles, opaque for the first layer, or over what is there, its colour 0 clear, when overlay is set. glyph->width and height are the icon's size in tiles. |
Sint32 | mnIconCountItemIcons (void) | Returns how many item icons the icon table holds; mnIconBuildItemIconTiles draws icon 0 for a number past them. |
Sint32 | mnIconCountPsynergyIcons (void) | Returns how many Psynergy icons the icon table holds; mnIconBuildAbilityIconTiles draws icon 0 for a number past them. |
void | mnIconBuildCommandIconTiles (Sint32 overlayIcon, Sint32 baseIcon, Sint32 *slot, Sint32 *tileOut, Sint32 reuse) | Builds a command icon (overlay overlayIcon over base baseIcon) and loads it into a sprite tile slot: *slot, or a free one when reuse is 0. |
void | mnAbilityBuildItemIconTiles ( Sint32 action, Sint32 withBase, Sint32 *slot, Sint32 *tile, Sint32 reuse) | Unused: builds the icon of a battle action as an item's icon (mnIconBuildItemIconTiles), where mnAbilityBuildIconTiles builds its Psynergy icon. |
void | mnIconBuildItemIconTiles (Uint32 glyph, Sint32 withBase, Sint32 *cacheSlot, Sint32 *tileOut, Sint32 reuse) | Builds item icon glyph, over the icon base when withBase is set, and loads it into *cacheSlot (a free slot unless reuse is set). |
Sint32 | mnItemIconCompose (Uint32 code, Uint32 layers) | Draws an item's icon into the glyph buffer from its inventory code (INVENTORY_ENCODING) with the layers asked for (ICON_ flags): the tick, the equipped, broken and artifact marks, and the count. |
Sint32 | mnItemIconLoadLayersIntoSlot (Sint32 inventoryCode, Sint32 layers, Sint32 cacheSlot) | Draws an item's icon from its inventory code with the layers asked for (mnItemIconCompose) and loads it into VRAM cache entry cacheSlot. |
Sint32 | mnIconBuildMiscellaneousIconTiles (Sint32 icon, Sint32 unused, Sint32 cacheSlot) | Draws one of the other icons (ICON_KIND_PATTERN) and loads it into cacheSlot, as mnItemIconLoadLayersIntoSlot does an item's. |
void | mnIconDrawItem (Sint32 code) | Decodes item code's icon (the first icon for code 0) into the glyph buffer. |
void | mnAbilityBuildIconTiles ( Sint32 action, Sint32 withBase, Sint32 *slot, Sint32 *tile, Sint32 reuse) | Builds the Psynergy icon of a battle action, as mnIconBuildAbilityIconTiles. |
void | mnIconBuildAbilityIconTiles (Uint32 glyph, Sint32 withBase, Sint32 *cacheSlot, Sint32 *tileOut, Sint32 reuse) | Builds Psynergy icon glyph, over the icon base when withBase is set, and loads it into *cacheSlot (a free slot unless reuse is set). |
void | mnIconDrawMiscellaneous (Uint32 index) | Draws one of the other icons into the glyph buffer. |
void | mnIconLoadWithPalette (Uint32 icon, Sint32 unused, Sint32 *slot, Sint32 *tile, Sint32 palette, Sint32 reuse) | Loads a 32x32 icon from the icon resource into sprite tile slot *slot (a free slot unless reuse is set) and its colours into the sprite palette named by palette. |
void | mnIconReservedNoOperation (void) | Unused: does nothing. |
Variables
| Name | Description | |
|---|---|---|
extern Uint8 * | IconBasePointerTable [] | The encoded icons: the command icons' bases and the pictures drawn over them, the marks an item icon may carry (equipped, broken), and the digits of its count. |
extern Uint8 * | IconOverlayPointerTable [] | |
extern Uint8 * | IconMarkPointers [] | |
extern Uint8 * | IconDigitPointers [] | |
extern Uint8 | mnTileDecompress4bppCode [] | The tile functions RAM_CODE_LOAD copies to RAM to run, and their sizes, as these symbols' addresses. |
extern Uint8 | mnTileExpandMaskedCode [] | |
extern Uint8 | mnTileExpandOpaqueCode [] | |
extern Uint8 | TileDecompress4bppCodeSize [] | The decoder's byte count, as this symbol's address (ld_script.ld). |
extern Uint8 | TileExpandMaskedCodeSize [] | |
extern Uint8 | TileExpandOpaqueCodeSize [] |
Description
The 16x16 icons of items, Psynergy and commands, built from their pictures, a
tick under them and the marks over them, and the 32x32 icons and portraits
loaded with their colours. Part of window.c.
Macros in detail
ICON_DIGIT_TENS_FIRST
#define ICON_DIGIT_TENS_FIRST 10
IconDigitPointers: the digits 0 to 9, then the tens 10 to 30 from this entry.
Referenced by mnItemIconCompose().
Definition at line 31 of file window_icons.c.
PORTRAIT_FIRST_SPRITE_ICON
#define PORTRAIT_FIRST_SPRITE_ICON 16
The icon resource's row of the first sprite portrait,
PORTRAIT_FIRST_SPRITE_PORTRAIT.
Referenced by mnIconLoadWithPalette().
Definition at line 316 of file window_icons.c.
Enumerations in detail
ICON_BASE_KIND
enum ICON_BASE_KIND
The ticks an icon is drawn over (IconBasePointerTable).
| Enumerator | Value | Description |
|---|---|---|
ICON_BASE_COMMAND | 0 | |
ICON_BASE_COMMAND_RED | 1 | |
ICON_BASE_ITEM | 2 |
Definition at line 14 of file window_icons.c.
ICON_MARK
enum ICON_MARK
The marks drawn over an item's icon (IconMarkPointers).
| Enumerator | Value | Description |
|---|---|---|
ICON_MARK_EQUIPPED | 0 | the E of an item equipped |
ICON_MARK_BROKEN | 1 | the cross of a broken item |
ICON_MARK_ARTIFACT | 2 | The phi of an equipped item that cannot be removed (ICON_CURSED) |
Definition at line 22 of file window_icons.c.
Functions in detail
mnIconDecode
void mnIconDecode(ICON_TRANSFER *glyph, Sint32 overlay)
Decodes a compressed icon into the glyph buffer and expands it to tiles, opaque for the first layer, or over what is there, its colour 0 clear, when overlay is set. glyph->width and height are the icon's size in tiles.
References mnTileDecompress4bppCode, mnTileExpandMaskedCode, mnTileExpandOpaqueCode, Sint32, syHeapRelease(), TileDecompress4bppCodeSize, TileExpandMaskedCodeSize and TileExpandOpaqueCodeSize.
Referenced by mnIconBuildAbilityIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildItemIconTiles(), mnIconDrawItem(), mnIconDrawMiscellaneous(), mnIconLoadWithPalette() and mnItemIconCompose().
Definition at lines 33 and 374 of file window_icons.c.
mnIconCountItemIcons
Sint32 mnIconCountItemIcons(void)
Returns how many item icons the icon table holds; mnIconBuildItemIconTiles
draws icon 0 for a number past them.
References ItemIcons, ItemIconsEnd and Sint32.
Referenced by mnIconBuildItemIconTiles().
Definition at line 37 of file window_icons.c.
mnIconCountPsynergyIcons
Sint32 mnIconCountPsynergyIcons(void)
Returns how many Psynergy icons the icon table holds;
mnIconBuildAbilityIconTiles draws icon 0 for a number past them.
References PsynergyIcons, PsynergyIconsEnd and Sint32.
Referenced by mnIconBuildAbilityIconTiles().
Definition at line 44 of file window_icons.c.
mnIconBuildCommandIconTiles
void mnIconBuildCommandIconTiles(Sint32 overlayIcon, Sint32 baseIcon, Sint32 *slot, Sint32 *tileOut, Sint32 reuse)
Builds a command icon (overlay overlayIcon over base baseIcon) and loads it into a sprite tile slot: *slot, or a free one when reuse is 0.
References IconBasePointerTable, IconOverlayPointerTable, mnIconDecode(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnSelectionIconLoad(), mnSelectionIconLoadIntoSlot(), mnSelectionMenuHighlightIcon(), mnSelectionMenuRedrawIcon(), mnSelectionMenuSetupIcon() and mnWindowSpriteCreateCommandIcon().
Definition at line 51 of file window_icons.c.
mnAbilityBuildItemIconTiles
void mnAbilityBuildItemIconTiles( Sint32 action, Sint32 withBase, Sint32 *slot, Sint32 *tile, Sint32 reuse)
Unused: builds the icon of a battle action as an item's icon
(mnIconBuildItemIconTiles), where mnAbilityBuildIconTiles builds its Psynergy
icon.
References gmAbilityGetDefinitionStub(), mnIconBuildItemIconTiles() and Sint32.
Definition at line 79 of file window_icons.c.
mnIconBuildItemIconTiles
void mnIconBuildItemIconTiles(Uint32 glyph, Sint32 withBase, Sint32 *cacheSlot, Sint32 *tileOut, Sint32 reuse)
Builds item icon glyph, over the icon base when withBase is set, and loads it into *cacheSlot (a free slot unless reuse is set). Returns the tile in *tileOut.
References IconBasePointerTable, ItemIcons, mnIconCountItemIcons(), mnIconDecode(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnAbilityBuildItemIconTiles(), mnDebugBrowserIcons() and mnSelectionMenuSetupIcon().
Definition at line 89 of file window_icons.c.
mnItemIconCompose
Sint32 mnItemIconCompose(Uint32 code, Uint32 layers)
Draws an item's icon into the glyph buffer from its inventory code
(INVENTORY_ENCODING) with the layers asked for (ICON_ flags): the tick, the
equipped, broken and artifact marks, and the count. Returns 256, which no
caller reads, or -1 without the glyph buffer.
References gmItemGetDefinitionStub(), IconBasePointerTable, IconDigitPointers, IconMarkPointers, ItemIcons, mnIconDecode() and Sint32.
Referenced by mnItemIconLoadIntoSlot() and mnItemIconLoadLayersIntoSlot().
Definition at line 130 of file window_icons.c.
mnItemIconLoadLayersIntoSlot
Sint32 mnItemIconLoadLayersIntoSlot(Sint32 inventoryCode, Sint32 layers, Sint32 cacheSlot)
Draws an item's icon from its inventory code with the layers asked for
(mnItemIconCompose) and loads it into VRAM cache entry cacheSlot.
References mnItemIconCompose(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease() and syVRAMCacheLoad().
Referenced by mnSelectionIconLoad(), mnSelectionIconLoadIntoSlot() and mnWindowSpriteCreateLoaded().
Definition at line 212 of file window_icons.c.
mnIconBuildMiscellaneousIconTiles
Sint32 mnIconBuildMiscellaneousIconTiles(Sint32 icon, Sint32 unused, Sint32 cacheSlot)
Draws one of the other icons (ICON_KIND_PATTERN) and loads it into cacheSlot,
as mnItemIconLoadLayersIntoSlot does an item's.
References mnIconDrawMiscellaneous(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease() and syVRAMCacheLoad().
Referenced by mnDebugBrowserIcons() and mnSelectionIconLoadIntoSlot().
Definition at line 227 of file window_icons.c.
mnIconDrawItem
void mnIconDrawItem(Sint32 code)
Decodes item code's icon (the first icon for code 0) into the glyph buffer.
References gmItemGetDefinitionStub(), ItemIcons, mnIconDecode() and Sint32.
Referenced by gmItemLoadIcon(), scDehkanPlateauCreatePoundCube(), scGabombaStatueChamberWhereIsTheOrb(), scKandoreanTempleCreateLashPebble(), scKibomboCreateBlackCrystal(), scLemurianShipDeckCreateBlackCrystal(), scShamanVillageCreateRodIcon() and scYampiDesertCreateScoopGem().
Definition at line 240 of file window_icons.c.
mnAbilityBuildIconTiles
void mnAbilityBuildIconTiles( Sint32 action, Sint32 withBase, Sint32 *slot, Sint32 *tile, Sint32 reuse)
Builds the Psynergy icon of a battle action, as mnIconBuildAbilityIconTiles.
References gmAbilityGetDefinitionStub(), mnIconBuildAbilityIconTiles() and Sint32.
Referenced by mnAbilityIconLoadIntoSlot(), mnBattlePsynergyMenuRun(), mnBattleSummonMenuRun(), mnSelectionIconLoad(), mnSelectionIconLoadIntoSlot() and mnSelectionMenuSetupIcon().
Definition at line 256 of file window_icons.c.
mnIconBuildAbilityIconTiles
void mnIconBuildAbilityIconTiles(Uint32 glyph, Sint32 withBase, Sint32 *cacheSlot, Sint32 *tileOut, Sint32 reuse)
Builds Psynergy icon glyph, over the icon base when withBase is set, and loads it into *cacheSlot (a free slot unless reuse is set). Returns the tile in *tileOut.
References IconBasePointerTable, mnIconCountPsynergyIcons(), mnIconDecode(), PsynergyIcons, Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnAbilityBuildIconTiles() and mnDebugBrowserIcons().
Definition at line 266 of file window_icons.c.
mnIconDrawMiscellaneous
void mnIconDrawMiscellaneous(Uint32 index)
Draws one of the other icons into the glyph buffer.
References IconMiscellaneousIconPointers and mnIconDecode().
Referenced by mnIconBuildMiscellaneousIconTiles() and mnMiscellaneousIconLoadIntoSlot().
Definition at line 304 of file window_icons.c.
mnIconLoadWithPalette
void mnIconLoadWithPalette(Uint32 icon, Sint32 unused, Sint32 *slot, Sint32 *tile, Sint32 palette, Sint32 reuse)
Loads a 32x32 icon from the icon resource into sprite tile slot *slot (a free
slot unless reuse is set) and its colours into the sprite palette named by
palette. Returns the tile in *tile. Each icon of the resource has its
PALETTE_COLORS colours before its encoded tiles. Portraits (mnPortraitCreate)
come through here.
References mnIconDecode(), Sint32, syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnDebugBrowserPortraits(), mnDjinnShowJoinedMessage(), mnPartyShowJoinedMessage(), mnPartyShowPairJoinedMessage(), mnPortraitCreate(), mnPortraitLoad() and mnPortraitReload().
Definition at line 323 of file window_icons.c.
mnIconReservedNoOperation
void mnIconReservedNoOperation(void)
Unused: does nothing.
Definition at line 358 of file window_icons.c.
Variables in detail
IconBasePointerTable
extern Uint8 *IconBasePointerTable[]
The encoded icons: the command icons' bases and the pictures drawn over them, the marks an item icon may carry (equipped, broken), and the digits of its count.
Referenced by mnIconBuildAbilityIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildItemIconTiles() and mnItemIconCompose().
Definition at line 8 of file window_icons.c.
IconOverlayPointerTable
extern Uint8 *IconOverlayPointerTable[]
Referenced by mnIconBuildCommandIconTiles().
Definition at line 9 of file window_icons.c.
IconMarkPointers
extern Uint8 *IconMarkPointers[]
Referenced by mnItemIconCompose().
Definition at line 10 of file window_icons.c.
IconDigitPointers
extern Uint8 *IconDigitPointers[]
Referenced by mnItemIconCompose().
Definition at line 11 of file window_icons.c.
mnTileExpandMaskedCode
extern Uint8 mnTileExpandMaskedCode[]
Referenced by mnIconDecode().
Definition at line 365 of file window_icons.c.
mnTileExpandOpaqueCode
extern Uint8 mnTileExpandOpaqueCode[]
Referenced by mnIconDecode().
Definition at line 366 of file window_icons.c.
TileExpandMaskedCodeSize
extern Uint8 TileExpandMaskedCodeSize[]
Referenced by mnIconDecode().
Definition at line 368 of file window_icons.c.
TileExpandOpaqueCodeSize
extern Uint8 TileExpandOpaqueCodeSize[]
Referenced by mnIconDecode().
Definition at line 369 of file window_icons.c.