Alchemy
Loading...
Searching...
No Matches

fade.c File Reference

Screen fades through the blend registers. More...

Go to the source code of this file.

Macros

#define FADE_DEFINE_BLEND(name, brighten, level)
 Fades BG1 to BG3, the sprites and the backdrop (0x3e) from the current target brightness to level over frames frames.

Enumerations

enum  {
  FADE_GAME_LAYERS = BLDCNT_TGT1_ALL & ~BLDCNT_TGT1_BG0 , FADE_LAYER_MASK = BLDCNT_TGT1_ALL , FADE_BRIGHTEN = BLDCNT_EFFECT_LIGHTEN , FADE_DARKEN = BLDCNT_EFFECT_DARKEN ,
  FADE_LEVEL_MAX = 16
}

Functions

void Fade_Update (void)
 Steps the screen fade once a frame, called by System_VBlankHandler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts gBlendFramesLeft down; at the end it clears gBlendDuration.
void Fade_ToBlack (s32 frames)
 Fades out to black.
void Fade_FromBlack (s32 frames)
 Fades in from black.
void Fade_ToWhite (s32 frames)
 Fades out to white.
void Fade_FromWhite (s32 frames)
 Fades in from white.
void Fade_Start (s8 bright, s32 layer, u32 start, s32 target, s32 frames)
 Starts a fade of any layers by setting the gBlend globals Fade_Update steps.
void Fade_Wait (void)
 Waits a frame at a time until the running fade has finished.

Detailed Description

Screen fades through the blend registers.

Part of runtime.c, the runtime object, compiled only through it.

Definition in file fade.c.

Macro Definition Documentation

◆ FADE_DEFINE_BLEND

#define FADE_DEFINE_BLEND ( name,
brighten,
level )
Value:
void name(s32 frames) { \
gBlendBrighten = brighten; \
gBlendTargetLevel = level; \
gBlendDuration = frames; \
}
@ FADE_GAME_LAYERS
The layers the screen fades take: all but BG0.
Definition fade.c:9
u16 gBlendLayers
u8 gBlendBrighten
volatile u8 gBlendTargetLevel
u8 gBlendFramesLeft
volatile u8 gBlendDuration
u8 gBlendStartLevel
signed int s32
Definition types.h:14

Fades BG1 to BG3, the sprites and the backdrop (0x3e) from the current target brightness to level over frames frames.

Definition at line 65 of file fade.c.

Referenced by Fade_FromBlack(), Fade_FromWhite(), Fade_ToBlack(), and Fade_ToWhite().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FADE_GAME_LAYERS 

The layers the screen fades take: all but BG0.

FADE_LAYER_MASK 
FADE_BRIGHTEN 
FADE_DARKEN 
FADE_LEVEL_MAX 

BLDY's strongest level: all white or all black.

Definition at line 7 of file fade.c.

Function Documentation

◆ Fade_Update()

void Fade_Update ( void )

Steps the screen fade once a frame, called by System_VBlankHandler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts gBlendFramesLeft down; at the end it clears gBlendDuration.

Definition at line 20 of file fade.c.

Referenced by Fade_Update(), System_GetLanguage(), and System_VBlankHandler().

◆ Fade_ToBlack()

◆ Fade_FromBlack()

◆ Fade_ToWhite()

void Fade_ToWhite ( s32 frames)

Fades out to white.

Definition at line 82 of file fade.c.

Referenced by Fade_ToWhite(), System_GetLanguage(), and Title_ShowIntro().

◆ Fade_FromWhite()

void Fade_FromWhite ( s32 frames)

Fades in from white.

Definition at line 85 of file fade.c.

Referenced by Fade_FromWhite(), System_GetLanguage(), Title_ShowAnimatedSplash(), and Title_ShowIntro().

◆ Fade_Start()

void Fade_Start ( s8 bright,
s32 layer,
u32 start,
s32 target,
s32 frames )

Starts a fade of any layers by setting the gBlend globals Fade_Update steps.

Reached through the far-call table. bright : 0 toward black, 1 toward white layer : the BLDCNT layers to fade (low six bits) start : the starting brightness; above 16, the current target target : the brightness to end at frames : how long the fade takes

Definition at line 94 of file fade.c.

Referenced by Fade_Start(), and System_GetLanguage().

◆ Fade_Wait()

void Fade_Wait ( void )

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

Called by the title screen and the battle, and through the far-call table.

Definition at line 108 of file fade.c.

Referenced by Battle_RunEncounter(), Fade_Wait(), System_GetLanguage(), Title_Run(), Title_ShowAnimatedSplash(), Title_ShowIntro(), and Title_ShowSplashScreen().