Alchemy

title

games/tbs/src/graphics/title on GitHub

intro.c

games/tbs/src/graphics/title/intro.c

Functions

Title_UpdateIntroSprites

void Title_UpdateIntroSprites(void)

A VBlank task of the title intro, scheduled by Title_ShowIntro: places the rising sprites along the slope of the scrolling background, alternating two sets every other frame so twice as many show, hides the rest and copies the list to OAM.

Used by Title_ShowIntro.

Line 112

Title_LoadIntroBackgrounds

void Title_LoadIntroBackgrounds(void)

Loads the title intro's two scrolling backgrounds and its sprite tiles, builds their maps and sets the blending and windows. Called by Title_ShowIntro.

Used by Title_ShowIntro.

Line 177

Title_ShowIntro

s32 Title_ShowIntro(s32 prompt)

Plays the title intro: the backgrounds scroll down and the sprites rise until frame 278 (A or Start skips ahead), then the screen flashes white into the title picture. With prompt set the "Press Start" prompt pulses for up to a minute, otherwise the picture stays five seconds. Reached through the palette far-call table from the title screen. Returns 1 when A or Start was pressed on the title picture.

Line 295

Title_NoOpPalette

UNUSED void Title_NoOpPalette(void)

Unused palette entry retained in the far-call table.

Line 511

Title_ShowSplashScreen

s32 Title_ShowSplashScreen(s32 mode)

Shows the Nintendo logo with its jingle. With mode 0 it fades in and holds two seconds; otherwise it waits a second, fades in, holds three seconds and fades out, faster once skipped. Called by Title_Run. Returns -1 when A or Start skipped it.

Used by Title_Run.

Line 517

Title_ShowAnimatedSplash

s32 Title_ShowAnimatedSplash(void)

Shows the Camelot logo for two seconds, cycling its four frames of tiles. A or Start ends it early. Reached through the palette far-call table from the title sequence. Returns 0.

Line 609

Graphics_NoOpColor

UNUSED void Graphics_NoOpColor(void)

Unused color entry retained in the far-call table.

Line 665

PaletteFade_ComputeSteps

void PaletteFade_ComputeSteps(s16 *sourceComponents, s16 *targetComponents, s16 *componentSteps, s32 frames)

Computes each of the 1536 colour components' change per frame from the current components to the target (nothing when frames is not positive). Called by PaletteFade_Start.

Used by PaletteFade_Start.

Line 673

PaletteFade_Update

void PaletteFade_Update(void)

A task scheduled by PaletteFade_Init: steps the palette fade each frame, adding the step to every colour component until the fade is done, packs the components into the spare RGB555 copy of the palettes and queues both halves for VBlank.

Used by PaletteFade_Init, PaletteFade_Release.

Line 697

Palette_Transform

void Palette_Transform(u32 mode, u16 *source, u16 *destination, s32 paletteHalf)

Transforms 512 source colours into destination components (three per colour, each in the high bits of a halfword). mode picks the transform: a colour below 0x8000 fills every colour with it; 0x8000 takes that colour from source[0]; 0x10000 to 0x10007 are the whole-palette filters (plain, grey, sepia and the others); the TINT, BLEND and SPLIT flags carry a colour in their low bits; anything else is the address of components to copy. paletteHalf 1 does only the background palettes, 2 only the sprites'. Called by PaletteFade_Init and the palette fade's setters.

Used by PaletteFade_Init, PaletteFade_SetCurrent, PaletteFade_SetTarget.

Line 748

PaletteFade_Init

void PaletteFade_Init(void)

Allocates the palette fade, saves both hardware palettes in it as the starting colours and schedules PaletteFade_Update. Called by Title_ShowIntro.

Used by Title_ShowIntro.

Line 1005

PaletteFade_Release

UNUSED void PaletteFade_Release(void)

Unschedules the palette fade and frees its buffers. Nothing in ☀️ calls it.

Line 1022

PaletteFade_SetTarget

UNUSED void PaletteFade_SetTarget(s32 mode, s32 paletteHalf)

Sets the fade target by transforming the saved background and/or sprite palettes through the requested mode. Nothing in ☀️ calls it.

Line 1029

PaletteFade_SetCurrent

void PaletteFade_SetCurrent(s32 mode, s32 paletteHalf)

Sets the colours shown now by transforming the saved palettes. Called by Title_ShowIntro.

Used by Title_ShowIntro.

Line 1038

PaletteFade_SetBackdrop

UNUSED void PaletteFade_SetBackdrop(s32 color)

Replaces the first saved colour, the backdrop. Nothing in ☀️ calls it.

Line 1046

PaletteFade_Start

void PaletteFade_Start(s32 frames)

Starts fading the shown colours to the target over the requested frames. Called by Title_ShowIntro for the opening fade from black.

Used by Title_ShowIntro.

Line 1055

Graphics_ClampRgb555Channel

s32 Graphics_ClampRgb555Channel(s32 value)

Clamps a five-bit colour channel to 0..31. Called by Palette_Transform.

Used by Palette_Transform.

Line 1067

Graphics_ClampRgb555Component

s32 Graphics_ClampRgb555Component(s32 value)

Caps a colour component at 0x7c00, the largest a five-bit channel shifted into the high bits reaches. There is no lower bound. Called by Palette_Transform.

Used by Palette_Transform.

Line 1078

Structures

IntroSprite

struct IntroSprite

A sprite of the "Press Start" prompt, linked into a render slot each frame: OAM attributes 0 to 2 with the position split out.

FieldDeclared as
nextu32 nextthe render slot link
yu8 y
attr0Highu8 attr0Highshape and mode bits of attribute 0
xu16 x : 9
attr1Highu16 attr1High : 7flip and size bits of attribute 1
tiles32 tile

Used by Title_ShowIntro.

Line 37

IntroWork

struct IntroWork

The title intro's state, in heap slot 43.

FieldDeclared as
backRowss32 backRowsrows of the far background copied in as it scrolls
frontRowss32 frontRowsrows of the near background copied in
frames32 frame
ticks32 tick
states32 state
rises32 risehow far the sprites have risen
objects, introObjects, sprites, prompt, areaunion { struct OamShadow objects[120]; struct { u8 introObjects[0x68]; ///< objects[0] to [12], still the intro's struct IntroSprite sprites[8]; } prompt; } area

Used by Title_LoadIntroBackgrounds, Title_ShowIntro, Title_UpdateIntroSprites.

Line 47

Macros

WRAP_TO_BYTE

#define WRAP_TO_BYTE(v)

Brings v into 0..255 by whole turns of 256

Used by Title_UpdateIntroSprites.

Line 79

PLACE_ON_SLOPE

#define PLACE_ON_SLOPE(column, half)

Sets x and y to the top left of a sprite of half-width half centred on column column, between slopeBaseY at x = 104 and slopeTopY at x = 184.

Used by Title_UpdateIntroSprites.

Line 87

MIRRORED_QUAD

#define MIRRORED_QUAD(i, size, shape, tile)

Writes OAM entries i to i + 3: four sprites of size pixels, mirrored into the four quarters of one picture at (x, y)

Used by Title_UpdateIntroSprites.

Line 95

Also, macros without a comment: INTRO_OBJ, PROMPT_TILES, PROMPT_TILES, PROMPT_ROWS, PROMPT_SPRITES, PROMPT_X, PROMPT_Y, PROMPT_SPRITES, PROMPT_X, PROMPT_Y, PROMPT_SPRITES, PROMPT_X, PROMPT_Y, PROMPT_SPRITES, PROMPT_X, PROMPT_Y.

Globals

gTitle_IntroSpriteColumns

const u8 gTitle_IntroSpriteColumns[]

The x of each of the six columns of intro sprites

Line 64

gPalette_ChannelCurveLight

u16 gPalette_ChannelCurveLight[32]

A brighter curve

Used by Palette_Transform.

Line 1097

gPalette_ChannelCurveContrast

u16 gPalette_ChannelCurveContrast[32]

A high-contrast curve (25 and above are full)

Used by Palette_Transform.

Line 1105

Also, globals without a comment: gTitle_PromptBlendLevels, gPalette_ChannelCurve.

On this page