Skip to Content
The Alchemy Project

src/system/system_screen_fade.c

Screen fades through the blend registers. More…

Included by system.c.

Enumerations

NameDescription
enumanonymous enum { FADE_GAME_LAYERS, FADE_LAYER_MASK, FADE_LEVEL_MAX }

Functions

NameDescription
voidsyScreenFadeUpdate (void)Steps the screen fade once a VBlank, called from the VBlank handler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts ScreenFadeFramesLeft down; at the end it clears ScreenFadeFrames, which syScreenFadeWait waits on.
voidsyScreenFadeToBlack (Sint32 frames)Fades out to black over frames frames.
voidsyScreenFadeFromBlack (Sint32 frames)Fades in from black.
voidsyScreenFadeToWhite (Sint32 frames)Fades out to white.
voidsyScreenFadeFromWhite (Sint32 frames)Fades in from white.
voidsyScreenFadeStart ( Sint8 bright, Sint32 layer, Uint32 start, Sint32 target, Sint32 frames)Starts a fade of any layers, toward white when bright is 1 and toward black when 0, from level start (above FADE_LEVEL_MAX: the level the last fade ended at) to target over frames frames; layer holds the BLDCNT target layers.
voidsyScreenFadeWait (void)Waits a tick at a time until the running fade has finished.

Description

Screen fades through the blend registers. Part of system.c.

Enumerations in detail

anonymous enum

enum { FADE_GAME_LAYERS, FADE_LAYER_MASK, FADE_LEVEL_MAX }

EnumeratorValueDescription
FADE_GAME_LAYERSBLDCNT_TGT1_ALL & ~BLDCNT_TGT1_BG0The layers the four plain fades take: all but BG0.
FADE_LAYER_MASKBLDCNT_TGT1_ALLThe layers a fade can take.
FADE_LEVEL_MAX16BLDY's strongest level: all white or all black; 0 leaves the screen as drawn.

Definition at line 3 of file system_screen_fade.c.

Functions in detail

syScreenFadeUpdate

void syScreenFadeUpdate(void)

Steps the screen fade once a VBlank, called from the VBlank handler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts ScreenFadeFramesLeft down; at the end it clears ScreenFadeFrames, which syScreenFadeWait waits on.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel and ScreenFadeToWhite.

Referenced by syVBlankHandler().

Definition at line 18 of file system_screen_fade.c.

syScreenFadeToBlack

void syScreenFadeToBlack(Sint32 frames)

Fades out to black over frames frames.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel, ScreenFadeToWhite and Sint32.

Referenced by btRun(), btTransitionRunMosaicFadeOut(), fdScreenTransitionFinish(), fdScreenTransitionStart(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), scClearLoadBackground(), scInit() and scTitleLoadBackground().

Definition at line 51 of file system_screen_fade.c.

syScreenFadeFromBlack

void syScreenFadeFromBlack(Sint32 frames)

Fades in from black.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel, ScreenFadeToWhite and Sint32.

Referenced by fdMapGridLoadMap(), fdScreenTransitionFinish(), fdScreenTransitionStart(), fdSpriteViewerRun(), fdWorldMapInitPerspective() and mnTitleShowPublisherLogo().

Definition at line 62 of file system_screen_fade.c.

syScreenFadeToWhite

void syScreenFadeToWhite(Sint32 frames)

Fades out to white.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel, ScreenFadeToWhite and Sint32.

Referenced by mnTitleShowTitleScreen() and scLohoFireCannon().

Definition at line 73 of file system_screen_fade.c.

syScreenFadeFromWhite

void syScreenFadeFromWhite(Sint32 frames)

Fades in from white.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel, ScreenFadeToWhite and Sint32.

Referenced by mnTitleShowCamelotLogo(), mnTitleShowTitleScreen() and scLohoFireCannon().

Definition at line 84 of file system_screen_fade.c.

syScreenFadeStart

void syScreenFadeStart( Sint8 bright, Sint32 layer, Uint32 start, Sint32 target, Sint32 frames)

Starts a fade of any layers, toward white when bright is 1 and toward black when 0, from level start (above FADE_LEVEL_MAX: the level the last fade ended at) to target over frames frames; layer holds the BLDCNT target layers. With frames 0 nothing is written, but target still becomes the level a later fade starts from. Reached through the stub call table.

References ScreenFadeFrames, ScreenFadeFramesLeft, ScreenFadeLayers, ScreenFadeStartLevel, ScreenFadeTargetLevel, ScreenFadeToWhite and Sint32.

Definition at line 99 of file system_screen_fade.c.

syScreenFadeWait

void syScreenFadeWait(void)

Waits a tick at a time until the running fade has finished.

References ScreenFadeFrames and sySynch().

Referenced by btRun(), mnTitleIntroScrollClouds(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), mnTitleShowTitleScreen() and scInit().

Definition at line 117 of file system_screen_fade.c.