Skip to Content
The Alchemy Project

src/field/field_engine_heading.c

A heading picture shown in a window that opens from the centre, and wiped away from the left. More…

Included by field_engine.c.

Macros

NameDescription
#defineHEADING_COLUMNS 26A heading picture: 26 by 5 tiles of 16 colours, drawn from tile 16 of character block 0 and shown in the window palette on BG0, 2 metatiles from the screen's left and 3 from its top.
#defineHEADING_ROWS 5
#defineHEADING_LEFT 2
#defineHEADING_TOP 3
#defineHEADING_FIRST_TILE 16
#defineHEADING_TILES
#defineHEADING_TILE_BYTES (HEADING_COLUMNS * HEADING_ROWS * TILE_SIZE_4BPP)
#defineHEADING_BLANK_METATILE BG_TILE_PALETTE(WINDOW_PALETTE)A blank BG0 metatile: tile 0 in the window palette.
#defineHEADING_OPEN_TICKS 24The ticks the heading's window takes to open from the centre, and the pixels it widens by on each side a tick.
#defineHEADING_OPEN_STEP 5
#defineHEADING_WIPE_END (-9)HeadingWipeSteps' last entry, after its last diagonal.

Functions

NameDescription
voidfdHeadingShow (Sint32 heading)Unused: only the stub table refers to it.
voidfdScriptWaitTwoSecondsOrPress (void)Waits up to two seconds, stopping early when a button is pressed.
voidfdHeadingWipeTilePixel (Sint32 x, Sint32 y, Uint32 pixel)Clears pixel pixel (its row times 8 plus its column) of the 4bpp tile at (x, y) of the heading's picture, and the pixels left of it in its halfword: a tile's row is two halfwords of four pixels each, the leftmost in the low bits, so halfword pixel >> 2 loses its low (pixel & 3) + 1 pixels.
voidfdHeadingClose (void)Unused: only the stub table refers to it.

Variables

NameDescription
extern Sint16HeadingWipeSteps []Unused, as fdHeadingClose is: the order the heading's closing wipe clears an 8 by 8 tile in, its pixels (row times 8 plus column) a diagonal at a time from the top left corner, a diagonal every two ticks.

Description

A heading picture shown in a window that opens from the centre, and wiped away from the left. Nothing calls these but the stub table. Part of field_engine.c.

Macros in detail

HEADING_COLUMNS

#define HEADING_COLUMNS 26

A heading picture: 26 by 5 tiles of 16 colours, drawn from tile 16 of character block 0 and shown in the window palette on BG0, 2 metatiles from the screen's left and 3 from its top.

Referenced by fdHeadingClose(), fdHeadingShow() and fdHeadingWipeTilePixel().

Definition at line 8 of file field_engine_heading.c.

HEADING_ROWS

#define HEADING_ROWS 5

Referenced by fdHeadingClose() and fdHeadingShow().

Definition at line 9 of file field_engine_heading.c.

HEADING_LEFT

#define HEADING_LEFT 2

Referenced by fdHeadingShow().

Definition at line 10 of file field_engine_heading.c.

HEADING_TOP

#define HEADING_TOP 3

Referenced by fdHeadingShow().

Definition at line 11 of file field_engine_heading.c.

HEADING_FIRST_TILE

#define HEADING_FIRST_TILE 16

Referenced by fdHeadingShow().

Definition at line 12 of file field_engine_heading.c.

HEADING_TILES

#define HEADING_TILES

Referenced by fdHeadingShow() and fdHeadingWipeTilePixel().

Definition at line 13 of file field_engine_heading.c.

HEADING_TILE_BYTES

#define HEADING_TILE_BYTES (HEADING_COLUMNS * HEADING_ROWS * TILE_SIZE_4BPP)

Referenced by fdHeadingShow().

Definition at line 15 of file field_engine_heading.c.

HEADING_BLANK_METATILE

#define HEADING_BLANK_METATILE BG_TILE_PALETTE(WINDOW_PALETTE)

A blank BG0 metatile: tile 0 in the window palette.

Referenced by fdHeadingClose() and fdHeadingShow().

Definition at line 17 of file field_engine_heading.c.

HEADING_OPEN_TICKS

#define HEADING_OPEN_TICKS 24

The ticks the heading's window takes to open from the centre, and the pixels it widens by on each side a tick.

Referenced by fdHeadingShow().

Definition at line 20 of file field_engine_heading.c.

HEADING_OPEN_STEP

#define HEADING_OPEN_STEP 5

Referenced by fdHeadingShow().

Definition at line 21 of file field_engine_heading.c.

HEADING_WIPE_END

#define HEADING_WIPE_END (-9)

HeadingWipeSteps' last entry, after its last diagonal.

Referenced by fdHeadingClose().

Definition at line 113 of file field_engine_heading.c.

Functions in detail

fdHeadingShow

void fdHeadingShow(Sint32 heading)

Unused: only the stub table refers to it. Draws heading picture heading of the headings resource into a 26 by 5 metatile window and opens the window from the centre.

References fdPaletteFadeSetSource(), fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), fdScriptWaitTransitionTicks(), Sint32, syDecompressByteLZ(), syDMAXCopy(), syHeapAllocateEWRAM(), syHeapRelease(), syResourceGetTableEntry() and sySynch().

Definition at line 26 of file field_engine_heading.c.

fdScriptWaitTwoSecondsOrPress

void fdScriptWaitTwoSecondsOrPress(void)

Waits up to two seconds, stopping early when a button is pressed.

References PerWork and sySynch().

Definition at line 79 of file field_engine_heading.c.

fdHeadingWipeTilePixel

void fdHeadingWipeTilePixel(Sint32 x, Sint32 y, Uint32 pixel)

Clears pixel pixel (its row times 8 plus its column) of the 4bpp tile at (x, y) of the heading's picture, and the pixels left of it in its halfword: a tile's row is two halfwords of four pixels each, the leftmost in the low bits, so halfword pixel >> 2 loses its low (pixel & 3) + 1 pixels.

References Sint32.

Referenced by fdHeadingClose().

Definition at line 95 of file field_engine_heading.c.

fdHeadingClose

void fdHeadingClose(void)

Unused: only the stub table refers to it. Closes fdHeadingShow's picture window: fades the palette out while wiping every one of the picture's 26 by 5 tiles from its top left corner to its bottom right, a diagonal every two ticks (HeadingWipeSteps: a tile's pixels a diagonal at a time, each ended by a negative entry and the last by HEADING_WIPE_END), then turns BG0 and the window off, clears the screen block, reloads the window tiles and turns BG0 back on.

References fdHeadingWipeTilePixel(), fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), HeadingWipeSteps, Sint32, syDMAXCopy(), syResourceGetTableEntry() and sySynch().

Definition at line 122 of file field_engine_heading.c.