Skip to Content
The Alchemy Project

src/menu/title_intro.c

The title intro, the view rising up a peak towards the sun and its lens flare until the flash into the title picture and its "Press Start" prompt; the publisher's and Camelot's logos; and the palette fade the intro uses.

Structures

NameDescription
structINTRO_PROMPT_SPRITEA sprite of the "Press Start" prompt, linked into a render slot each tick: OAM attributes 0 to 2 with the position split out.
structINTRO_STATEThe title intro's state, in HEAP_SLOT_TITLE_INTRO.

Macros

NameDescription
#defineINTRO_SKIP_AFTER_TICK 20The intro's ticks: A or Start skips to the approach only after the first INTRO_SKIP_AFTER_TICK, and the screen flashes white into the title at INTRO_FLASH_TICK.
#defineINTRO_APPROACH_TICK 239
#defineINTRO_FLASH_TICK 280
#defineINTRO_OBJECT_COUNT 120OAM entries the intro builds each VBlank.
#defineFLARE_OBJECT_COUNT 12The most OAM entries the lens flare takes in a VBlank; the entry after them is always hidden, and the sun is built there.
#defineINTRO_BACK_TILE (n) (BG_CHAR_BLOCK(0) + (n) * TILE_SIZE_4BPP)The intro's two pictures share character block 0: the clouds (BG1) in 16-colour tiles, the peak (BG2) in 256-colour tiles after them.
#defineINTRO_FRONT_TILE (n) (BG_CHAR_BLOCK(0) + (n) * 2 * TILE_SIZE_4BPP)
#defineINTRO_FRONT_SCREEN 30The screen blocks of the two pictures' maps
#defineINTRO_BACK_SCREEN 31
#defineINTRO_MAP_ROWS 32Both maps are 32 rows of tiles.
#definePICTURE_SCREEN 6The screen block of the map of the title picture and of the logos.
#defineINTRO_SCROLL_START 96Both pictures start scrolled this far down and scroll up into place.
#defineCLOUD_ROWS 33The intro's pictures unpack one after the other: the clouds, 33 rows of tiles in 16 colours, then the peak, 28 rows in 256 colours, each row a screen wide.
#defineCLOUD_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_4BPP)
#definePEAK_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_8BPP)
#defineCLOUD_ROW (row) (RamMapGridMetatileBuffer + (row) * CLOUD_ROW_BYTES)
#definePEAK_ROW (row) (CLOUD_ROW(CLOUD_ROWS) + (row) * PEAK_ROW_BYTES)
#defineINTRO_VRAM_ROWS (DISPLAY_TILE_HEIGHT + 1)Each picture keeps 21 rows of tiles in VRAM, the screen's 20 and the one coming into view, and its map's 32 rows wrap round them: map row INTRO_FIRST_MAP_ROW, the one above the screen at the start, shows the first.
#defineINTRO_FIRST_MAP_ROW (INTRO_SCROLL_START / 8 - 1)
#definePEAK_FIRST_TILE (INTRO_VRAM_ROWS * CLOUD_ROW_BYTES / TILE_SIZE_8BPP)The peak's first tile, after the clouds' in character block 0; it is blank.
#defineCLOUD_VRAM_ROW (row) INTRO_BACK_TILE((row) * DISPLAY_TILE_WIDTH)
#definePEAK_VRAM_ROW (row)
#definePEAK_MAP_ROW 6The peak's top stands this many rows down the map, below the clouds' top.
#definePEAK_ROWS_ABOVE 4The peak's rows above those in VRAM at the start, copied in as they come into view; its top row is blank and never copied.
#definePROMPT_PULSE_TICKS TICKS_PER_SECONDThe prompt pulses once a second.
#defineINTRO_OBJ (i) (state->area.objects[i])
#defineWRAP_OBJ_Y (v)Brings v into a sprite's y, 0 to 255, by whole turns
#defineFLARE_LINE_LEFT 104The lens flare's pieces lie on a line from lineLeftY at this x to lineRightY at FLARE_LINE_RIGHT.
#defineFLARE_LINE_RIGHT 184
#defineSUN_TILE 0The lens flare's pictures in the sprite tiles, after the sun's: an orange disc whole, and quarters, mirrored into the rest, of a rainbow ring, a yellow-green ring, a green disc with a cyan heart and a white-hot disc.
#defineFLARE_ORANGE_DISC_TILE 128
#defineFLARE_RAINBOW_RING_TILE 160
#defineFLARE_GREEN_RING_TILE 192
#defineFLARE_GREEN_DISC_TILE 224
#defineFLARE_WHITE_DISC_TILE 232
#defineINTRO_SPRITE_TILES (FLARE_WHITE_DISC_TILE + 8)The sprite tiles end with the white disc's eight.
#defineFLARE_DISC_RADIUS 16A disc is 32 pixels across, a ring 64.
#defineFLARE_RING_RADIUS 32
#definePLACE_ON_FLARE_LINE (column, radius)Sets x and y to the top left of a piece of radius centred on column column, on the flare's line.
#defineMIRRORED_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)
#defineSUN_X 92Where the sun stands over the clouds, which it scrolls with.
#defineSUN_Y 32
#defineFILL_INTRO_MAP_ROWS (first, last)Writes map rows first to last at tilemap: each row the screen's width of tiles numbered on from tileIndex, then two columns past the edge that show offscreenTile.
#defineTITLE_PROMPT_HOLD_TICKS (60 * TICKS_PER_SECOND)How long the title waits for A or Start: a minute with the prompt shown, five seconds without.
#defineTITLE_HOLD_TICKS (5 * TICKS_PER_SECOND)
#definePROMPT_TILES GERMAN_OR(8, 5)The "Press Start" prompt, by edition: the 32-by-8 pictures it loads (PROMPT_TILES), its rows and the sprites in each, and where it stands.
#definePROMPT_ROWS 2
#definePROMPT_ROW_HEIGHT 8
#definePROMPT_SPRITES 3
#definePROMPT_X 80
#definePROMPT_Y 116
#defineTITLE_PICTURE_TILE (BG_CHAR_SIZE / TILE_SIZE_8BPP)The title picture's first tile: character block 1's, as BG2 numbers its 256-colour tiles from block 0.
#defineTITLE_PICTURE_COLORS (15 * PALETTE_COLORS)The title picture's colours, palettes 0 to 14; the last is the window's.
#definePROMPT_SPRITE_BYTES (4 * TILE_SIZE_4BPP)A prompt sprite's picture: 32 by 8 pixels in 16 colours.
#defineLOGO_PALETTE_BYTES (LOGO_PALETTE_COLORS * 2)
#definePUBLISHER_LOGO_TILE (BG_CHAR_SIZE / TILE_SIZE_8BPP)The publisher logo's first tile: character block 1's, as BG2 numbers its 256-colour tiles from block 0.
#defineCAMELOT_FLAG_TILE 4The Camelot logo's flag: four pictures of 16 tiles after the logo's own, each shown 8 ticks, whose first 13 tiles are copied over the logo's from its fifth tile.
#defineCAMELOT_FLAG_PICTURE_BYTES (16 * TILE_SIZE_8BPP)
#defineCAMELOT_FLAG_BYTES (13 * TILE_SIZE_8BPP)
#defineBUILD_DIMMER_COLORS ()PALETTE_TINT_DIMMER: red halved, green cut by a third, then red and green raised and blue lowered, each channel through its own curve.

Enumerations

NameDescription
enumINTRO_PHASE { INTRO_PHASE_SCROLLING, INTRO_PHASE_APPROACH, INTRO_PHASE_AFT … }INTRO_STATE.phase, which the intro writes and nothing reads.

Functions

NameDescription
voidmnTitleUpdateIntroSprites (void)A VBlank event of the title intro, added by mnTitleShowTitleScreen: places the lens flare's pieces along a line down from the sun, which swings up as the intro goes on, alternating two sets of three every other VBlank so all six show, hides the rest, adds the sun and copies the list to OAM.
voidmnTitleLoadIntroBackgrounds (void)Loads the title intro's two scrolling images, the clouds and the peak, and the sun's and lens flare's sprite tiles, builds the images' maps and sets the blending and windows.
voidmnTitlePaletteFadeCalculateSteps (Sint16 *srcComponents, Sint16 *targetComponents, Sint16 *componentSteps, Sint32 ticks)Computes each of the 1536 colour components' change per tick from the current components to the target (nothing when ticks is not positive).
voidmnTitlePaletteFadeUpdate (void)An event added by mnTitlePaletteFadeInit: steps the palette fade each tick, 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 palettes for VBlank.
voidmnTitlePaletteFadeBuildColors (Uint32 mode, Uint16 *src, Uint16 *dest, Sint32 selectedPalettes)Tints 512 source colours into destination components (three per colour, each in the high bits of a halfword).
voidmnTitlePaletteFadeInit (void)Allocates the palette fade, saves both hardware palettes in it as the starting colours and adds the event mnTitlePaletteFadeUpdate.
voidmnTitlePaletteFadeRelease (void)Unused: removes the palette fade's event and frees its buffers.
voidmnTitlePaletteFadeSetTarget (Sint32 mode, Sint32 selectedPalettes)Unused: sets the fade target by tinting the saved background and/or sprite palettes with the requested tint.
voidmnTitlePaletteFadeSetCurrent (Sint32 mode, Sint32 selectedPalettes)Sets the colours shown now by tinting the saved palettes.
voidmnTitlePaletteFadeSetBackdrop (Sint32 color)Unused: replaces the first saved colour, the backdrop.
voidmnTitlePaletteFadeStart (Sint32 ticks)Starts fading the shown colours to the target over the requested ticks: each of the 1,536 components (three for each of the 512 colours) steps by its distance divided by the ticks, the remainder kept in the ten bits below it, so every colour arrives together.
Sint32mnTitlePaletteFadeClampChannel (Sint32 value)Clamps a five-bit colour channel to 0..31.
Sint32mnTitlePaletteFadeClampShiftedChannel (Sint32 value)Caps a colour component at a channel's brightest level moved up to the components' place.
Sint32mnTitleShowTitleScreen (Sint32 prompt)Plays the title intro: the view rises up the peak towards the sun, the clouds slower behind it, while the sun's lens flare swings up, until just before INTRO_FLASH_TICK (A or Start skips ahead); then the screen flashes white into the title picture, the Golden Sun logo over the peak.
voidmnTitleBeforeLogosNoOperation (void)Unused: an empty entry the stub table keeps.
Sint32mnTitleShowPublisherLogo (Sint32 fadeOut)Shows the publisher's logo with its chime.
Sint32mnTitleShowCamelotLogo (void)Shows the Camelot logo for two seconds, its flag waving.
voidmnTitleAfterIntroNoOperation (void)Unused: an empty entry the stub table keeps.

Variables

NameDescription
extern const Uint8TitleFlareColumns []The x of each of the lens flare's six pieces
extern const Uint8TitlePromptBlendLevels [60]The prompt's blend level over its pulse
Uint16TitlePaletteFadeChannelCurve [32]Maps a channel (0..31) to a component (0..31 << 10).
Uint16TitlePaletteFadeChannelCurveLight [32]A brighter curve
Uint16TitlePaletteFadeChannelCurveContrast [32]A high-contrast curve (25 and above are full)

Description

The title intro, the view rising up a peak towards the sun and its lens flare until the flash into the title picture and its "Press Start" prompt; the publisher's and Camelot's logos; and the palette fade the intro uses.

Macros in detail

INTRO_SKIP_AFTER_TICK

#define INTRO_SKIP_AFTER_TICK 20

The intro's ticks: A or Start skips to the approach only after the first INTRO_SKIP_AFTER_TICK, and the screen flashes white into the title at INTRO_FLASH_TICK.

Referenced by mnTitleShowTitleScreen().

Definition at line 57 of file title_intro.c.

INTRO_APPROACH_TICK

#define INTRO_APPROACH_TICK 239

Referenced by mnTitleShowTitleScreen().

Definition at line 58 of file title_intro.c.

INTRO_FLASH_TICK

#define INTRO_FLASH_TICK 280

Referenced by mnTitleShowTitleScreen() and mnTitleUpdateIntroSprites().

Definition at line 59 of file title_intro.c.

INTRO_OBJECT_COUNT

#define INTRO_OBJECT_COUNT 120

OAM entries the intro builds each VBlank.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 72 of file title_intro.c.

FLARE_OBJECT_COUNT

#define FLARE_OBJECT_COUNT 12

The most OAM entries the lens flare takes in a VBlank; the entry after them is always hidden, and the sun is built there.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 76 of file title_intro.c.

INTRO_BACK_TILE

#define INTRO_BACK_TILE(n) (BG_CHAR_BLOCK(0) + (n) * TILE_SIZE_4BPP)

The intro's two pictures share character block 0: the clouds (BG1) in 16-colour tiles, the peak (BG2) in 256-colour tiles after them.

Definition at line 107 of file title_intro.c.

INTRO_FRONT_TILE

#define INTRO_FRONT_TILE(n) (BG_CHAR_BLOCK(0) + (n) * 2 * TILE_SIZE_4BPP)

Referenced by mnTitleShowTitleScreen().

Definition at line 108 of file title_intro.c.

INTRO_FRONT_SCREEN

#define INTRO_FRONT_SCREEN 30

The screen blocks of the two pictures' maps

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 111 of file title_intro.c.

INTRO_BACK_SCREEN

#define INTRO_BACK_SCREEN 31

Referenced by mnTitleLoadIntroBackgrounds().

Definition at line 112 of file title_intro.c.

INTRO_MAP_ROWS

#define INTRO_MAP_ROWS 32

Both maps are 32 rows of tiles.

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 114 of file title_intro.c.

PICTURE_SCREEN

#define PICTURE_SCREEN 6

The screen block of the map of the title picture and of the logos.

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

Definition at line 116 of file title_intro.c.

INTRO_SCROLL_START

#define INTRO_SCROLL_START 96

Both pictures start scrolled this far down and scroll up into place.

Referenced by mnTitleLoadIntroBackgrounds().

Definition at line 118 of file title_intro.c.

CLOUD_ROWS

#define CLOUD_ROWS 33

The intro's pictures unpack one after the other: the clouds, 33 rows of tiles in 16 colours, then the peak, 28 rows in 256 colours, each row a screen wide.

Definition at line 122 of file title_intro.c.

CLOUD_ROW_BYTES

#define CLOUD_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_4BPP)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 123 of file title_intro.c.

PEAK_ROW_BYTES

#define PEAK_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_8BPP)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 124 of file title_intro.c.

CLOUD_ROW

#define CLOUD_ROW(row) (RamMapGridMetatileBuffer + (row) * CLOUD_ROW_BYTES)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 125 of file title_intro.c.

PEAK_ROW

#define PEAK_ROW(row) (CLOUD_ROW(CLOUD_ROWS) + (row) * PEAK_ROW_BYTES)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 126 of file title_intro.c.

INTRO_VRAM_ROWS

#define INTRO_VRAM_ROWS (DISPLAY_TILE_HEIGHT + 1)

Each picture keeps 21 rows of tiles in VRAM, the screen's 20 and the one coming into view, and its map's 32 rows wrap round them: map row INTRO_FIRST_MAP_ROW, the one above the screen at the start, shows the first.

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 131 of file title_intro.c.

INTRO_FIRST_MAP_ROW

#define INTRO_FIRST_MAP_ROW (INTRO_SCROLL_START / 8 - 1)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 132 of file title_intro.c.

PEAK_FIRST_TILE

#define PEAK_FIRST_TILE (INTRO_VRAM_ROWS * CLOUD_ROW_BYTES / TILE_SIZE_8BPP)

The peak's first tile, after the clouds' in character block 0; it is blank.

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 134 of file title_intro.c.

CLOUD_VRAM_ROW

#define CLOUD_VRAM_ROW(row) INTRO_BACK_TILE((row) * DISPLAY_TILE_WIDTH)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 135 of file title_intro.c.

PEAK_VRAM_ROW

#define PEAK_VRAM_ROW(row)

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 136 of file title_intro.c.

PEAK_MAP_ROW

#define PEAK_MAP_ROW 6

The peak's top stands this many rows down the map, below the clouds' top.

Referenced by mnTitleLoadIntroBackgrounds() and mnTitleShowTitleScreen().

Definition at line 139 of file title_intro.c.

PEAK_ROWS_ABOVE

#define PEAK_ROWS_ABOVE 4

The peak's rows above those in VRAM at the start, copied in as they come into view; its top row is blank and never copied.

Referenced by mnTitleShowTitleScreen().

Definition at line 142 of file title_intro.c.

PROMPT_PULSE_TICKS

#define PROMPT_PULSE_TICKS TICKS_PER_SECOND

The prompt pulses once a second.

Referenced by mnTitleShowTitleScreen() and TitlePromptBlendLevels.

Definition at line 148 of file title_intro.c.

INTRO_OBJ

#define INTRO_OBJ(i) (state->area.objects[i])

Referenced by mnTitleUpdateIntroSprites().

Definition at line 160 of file title_intro.c.

WRAP_OBJ_Y

#define WRAP_OBJ_Y(v)

Brings v into a sprite's y, 0 to 255, by whole turns

Referenced by mnTitleUpdateIntroSprites().

Definition at line 163 of file title_intro.c.

FLARE_LINE_LEFT

#define FLARE_LINE_LEFT 104

The lens flare's pieces lie on a line from lineLeftY at this x to lineRightY at FLARE_LINE_RIGHT.

Definition at line 171 of file title_intro.c.

FLARE_LINE_RIGHT

#define FLARE_LINE_RIGHT 184

Definition at line 172 of file title_intro.c.

SUN_TILE

#define SUN_TILE 0

The lens flare's pictures in the sprite tiles, after the sun's: an orange disc whole, and quarters, mirrored into the rest, of a rainbow ring, a yellow-green ring, a green disc with a cyan heart and a white-hot disc.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 177 of file title_intro.c.

FLARE_ORANGE_DISC_TILE

#define FLARE_ORANGE_DISC_TILE 128

Referenced by mnTitleUpdateIntroSprites().

Definition at line 178 of file title_intro.c.

FLARE_RAINBOW_RING_TILE

#define FLARE_RAINBOW_RING_TILE 160

Referenced by mnTitleUpdateIntroSprites().

Definition at line 179 of file title_intro.c.

FLARE_GREEN_RING_TILE

#define FLARE_GREEN_RING_TILE 192

Referenced by mnTitleUpdateIntroSprites().

Definition at line 180 of file title_intro.c.

FLARE_GREEN_DISC_TILE

#define FLARE_GREEN_DISC_TILE 224

Referenced by mnTitleUpdateIntroSprites().

Definition at line 181 of file title_intro.c.

FLARE_WHITE_DISC_TILE

#define FLARE_WHITE_DISC_TILE 232

Referenced by mnTitleUpdateIntroSprites().

Definition at line 182 of file title_intro.c.

INTRO_SPRITE_TILES

#define INTRO_SPRITE_TILES (FLARE_WHITE_DISC_TILE + 8)

The sprite tiles end with the white disc's eight.

Referenced by mnTitleLoadIntroBackgrounds().

Definition at line 184 of file title_intro.c.

FLARE_DISC_RADIUS

#define FLARE_DISC_RADIUS 16

A disc is 32 pixels across, a ring 64.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 186 of file title_intro.c.

FLARE_RING_RADIUS

#define FLARE_RING_RADIUS 32

Referenced by mnTitleUpdateIntroSprites().

Definition at line 187 of file title_intro.c.

PLACE_ON_FLARE_LINE

#define PLACE_ON_FLARE_LINE(column, radius)

Sets x and y to the top left of a piece of radius centred on column column, on the flare's line.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 191 of file title_intro.c.

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)

Referenced by mnTitleUpdateIntroSprites().

Definition at line 200 of file title_intro.c.

SUN_X

#define SUN_X 92

Where the sun stands over the clouds, which it scrolls with.

Referenced by mnTitleUpdateIntroSprites().

Definition at line 219 of file title_intro.c.

SUN_Y

#define SUN_Y 32

Referenced by mnTitleUpdateIntroSprites().

Definition at line 220 of file title_intro.c.

FILL_INTRO_MAP_ROWS

#define FILL_INTRO_MAP_ROWS(first, last)

Writes map rows first to last at tilemap: each row the screen's width of tiles numbered on from tileIndex, then two columns past the edge that show offscreenTile.

Referenced by mnTitleLoadIntroBackgrounds().

Definition at line 315 of file title_intro.c.

TITLE_PROMPT_HOLD_TICKS

#define TITLE_PROMPT_HOLD_TICKS (60 * TICKS_PER_SECOND)

How long the title waits for A or Start: a minute with the prompt shown, five seconds without.

Referenced by mnTitleShowTitleScreen().

Definition at line 420 of file title_intro.c.

TITLE_HOLD_TICKS

#define TITLE_HOLD_TICKS (5 * TICKS_PER_SECOND)

Referenced by mnTitleShowTitleScreen().

Definition at line 421 of file title_intro.c.

PROMPT_TILES

#define PROMPT_TILES GERMAN_OR(8, 5)

The "Press Start" prompt, by edition: the 32-by-8 pictures it loads (PROMPT_TILES), its rows and the sprites in each, and where it stands.

Referenced by mnTitleShowTitleScreen().

Definition at line 425 of file title_intro.c.

PROMPT_ROWS

#define PROMPT_ROWS 2

Referenced by mnTitleShowTitleScreen().

Definition at line 427 of file title_intro.c.

PROMPT_ROW_HEIGHT

#define PROMPT_ROW_HEIGHT 8

Referenced by mnTitleShowTitleScreen().

Definition at line 428 of file title_intro.c.

PROMPT_SPRITES

#define PROMPT_SPRITES 3

#define PROMPT_SPRITES 5

Referenced by mnTitleShowTitleScreen().

Definition at lines 429, 433, 437 and 441 of file title_intro.c.

PROMPT_X

#define PROMPT_X 80

#define PROMPT_X 56

Referenced by mnTitleShowTitleScreen().

Definition at lines 430, 434, 438 and 442 of file title_intro.c.

PROMPT_Y

#define PROMPT_Y 116

#define PROMPT_Y 126

#define PROMPT_Y 124

Referenced by mnTitleShowTitleScreen().

Definition at lines 431, 435, 439 and 443 of file title_intro.c.

TITLE_PICTURE_TILE

#define TITLE_PICTURE_TILE (BG_CHAR_SIZE / TILE_SIZE_8BPP)

The title picture's first tile: character block 1's, as BG2 numbers its 256-colour tiles from block 0.

Referenced by mnTitleShowTitleScreen().

Definition at line 448 of file title_intro.c.

TITLE_PICTURE_COLORS

#define TITLE_PICTURE_COLORS (15 * PALETTE_COLORS)

The title picture's colours, palettes 0 to 14; the last is the window's.

Referenced by mnTitleShowTitleScreen().

Definition at line 450 of file title_intro.c.

PROMPT_SPRITE_BYTES

#define PROMPT_SPRITE_BYTES (4 * TILE_SIZE_4BPP)

A prompt sprite's picture: 32 by 8 pixels in 16 colours.

Referenced by mnTitleShowTitleScreen().

Definition at line 452 of file title_intro.c.

LOGO_PALETTE_BYTES

#define LOGO_PALETTE_BYTES (LOGO_PALETTE_COLORS * 2)

Referenced by mnTitleShowCamelotLogo() and mnTitleShowPublisherLogo().

Definition at line 743 of file title_intro.c.

PUBLISHER_LOGO_TILE

#define PUBLISHER_LOGO_TILE (BG_CHAR_SIZE / TILE_SIZE_8BPP)

The publisher logo's first tile: character block 1's, as BG2 numbers its 256-colour tiles from block 0.

Referenced by mnTitleShowPublisherLogo().

Definition at line 747 of file title_intro.c.

CAMELOT_FLAG_TILE

#define CAMELOT_FLAG_TILE 4

The Camelot logo's flag: four pictures of 16 tiles after the logo's own, each shown 8 ticks, whose first 13 tiles are copied over the logo's from its fifth tile.

Referenced by mnTitleShowCamelotLogo().

Definition at line 862 of file title_intro.c.

CAMELOT_FLAG_PICTURE_BYTES

#define CAMELOT_FLAG_PICTURE_BYTES (16 * TILE_SIZE_8BPP)

Referenced by mnTitleShowCamelotLogo().

Definition at line 863 of file title_intro.c.

CAMELOT_FLAG_BYTES

#define CAMELOT_FLAG_BYTES (13 * TILE_SIZE_8BPP)

Referenced by mnTitleShowCamelotLogo().

Definition at line 864 of file title_intro.c.

BUILD_DIMMER_COLORS

#define BUILD_DIMMER_COLORS()

PALETTE_TINT_DIMMER: red halved, green cut by a third, then red and green raised and blue lowered, each channel through its own curve.

Referenced by mnTitlePaletteFadeBuildColors().

Definition at line 1029 of file title_intro.c.

Enumerations in detail

INTRO_PHASE

enum INTRO_PHASE

INTRO_STATE.phase, which the intro writes and nothing reads.

EnumeratorValueDescription
INTRO_PHASE_SCROLLING0the pictures scroll in
INTRO_PHASE_APPROACH1From tick 239, or a skip with A or Start: the approach to the flash.
INTRO_PHASE_AFTER_FLASH2Set from tick 281, which the loop never reaches: it ends at 280.

Definition at line 62 of file title_intro.c.

Functions in detail

mnTitleUpdateIntroSprites

void mnTitleUpdateIntroSprites(void)

A VBlank event of the title intro, added by mnTitleShowTitleScreen: places the lens flare's pieces along a line down from the sun, which swings up as the intro goes on, alternating two sets of three every other VBlank so all six show, hides the rest, adds the sun and copies the list to OAM.

References BgScrollWork, DebugPaused, Sint32, state and syDMAXCopy().

Referenced by mnTitleShowTitleScreen().

Definition at lines 16 and 226 of file title_intro.c.

mnTitleLoadIntroBackgrounds

void mnTitleLoadIntroBackgrounds(void)

Loads the title intro's two scrolling images, the clouds and the peak, and the sun's and lens flare's sprite tiles, builds the images' maps and sets the blending and windows.

References BgScrollWork, Sint32, syDecompressByteLZ(), syDMAXCopy() and syResourceGetTableEntry().

Referenced by mnTitleShowTitleScreen().

Definition at lines 17 and 327 of file title_intro.c.

mnTitlePaletteFadeCalculateSteps

void mnTitlePaletteFadeCalculateSteps(Sint16 *srcComponents, Sint16 *targetComponents, Sint16 *componentSteps, Sint32 ticks)

Computes each of the 1536 colour components' change per tick from the current components to the target (nothing when ticks is not positive).

References Sint32 and syIntegerDivide().

Referenced by mnTitlePaletteFadeStart().

Definition at lines 18 and 944 of file title_intro.c.

mnTitlePaletteFadeUpdate

void mnTitlePaletteFadeUpdate(void)

An event added by mnTitlePaletteFadeInit: steps the palette fade each tick, 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 palettes for VBlank.

References Sint32, state and syDMAXCopy().

Referenced by mnTitlePaletteFadeInit() and mnTitlePaletteFadeRelease().

Definition at lines 22 and 971 of file title_intro.c.

mnTitlePaletteFadeBuildColors

void mnTitlePaletteFadeBuildColors(Uint32 mode, Uint16 *src, Uint16 *dest, Sint32 selectedPalettes)

Tints 512 source colours into destination components (three per colour, each in the high bits of a halfword). mode picks the tint: a colour below PALETTE_TINT_FROM_SOURCE fills every colour with it; PALETTE_TINT_FROM_SOURCE takes that colour from source[0]; PALETTE_TINT_NONE to PALETTE_TINT_DIMMER are the whole-palette filters; the CUSTOM, BLEND and SPLIT flags carry a colour in their low bits; anything else is the address of components to copy. selectedPalettes is an enum PALETTE_SELECTION.

References mnTitlePaletteFadeClampChannel(), mnTitlePaletteFadeClampShiftedChannel(), Sint32, syDMAXCopy(), syIntegerDivide(), syMulFX(), TitlePaletteFadeChannelCurve, TitlePaletteFadeChannelCurveContrast and TitlePaletteFadeChannelCurveLight.

Referenced by mnTitlePaletteFadeInit(), mnTitlePaletteFadeSetCurrent() and mnTitlePaletteFadeSetTarget().

Definition at lines 23 and 1058 of file title_intro.c.

mnTitlePaletteFadeInit

void mnTitlePaletteFadeInit(void)

Allocates the palette fade, saves both hardware palettes in it as the starting colours and adds the event mnTitlePaletteFadeUpdate.

References mnTitlePaletteFadeBuildColors(), mnTitlePaletteFadeUpdate(), syDMAXCopy(), syHeapSlotAllocateEWRAM() and sySetEvent().

Referenced by mnTitleShowTitleScreen().

Definition at lines 27 and 1320 of file title_intro.c.

mnTitlePaletteFadeRelease

void mnTitlePaletteFadeRelease(void)

Unused: removes the palette fade's event and frees its buffers.

References mnTitlePaletteFadeUpdate(), syCloseEvent() and syHeapSlotRelease().

Definition at lines 28 and 1338 of file title_intro.c.

mnTitlePaletteFadeSetTarget

void mnTitlePaletteFadeSetTarget(Sint32 mode, Sint32 selectedPalettes)

Unused: sets the fade target by tinting the saved background and/or sprite palettes with the requested tint.

References mnTitlePaletteFadeBuildColors() and Sint32.

Definition at lines 29 and 1346 of file title_intro.c.

mnTitlePaletteFadeSetCurrent

void mnTitlePaletteFadeSetCurrent(Sint32 mode, Sint32 selectedPalettes)

Sets the colours shown now by tinting the saved palettes.

References mnTitlePaletteFadeBuildColors() and Sint32.

Referenced by mnTitleShowTitleScreen().

Definition at lines 35 and 1356 of file title_intro.c.

mnTitlePaletteFadeSetBackdrop

void mnTitlePaletteFadeSetBackdrop(Sint32 color)

Unused: replaces the first saved colour, the backdrop.

References Sint32.

Definition at lines 37 and 1366 of file title_intro.c.

mnTitlePaletteFadeStart

void mnTitlePaletteFadeStart(Sint32 ticks)

Starts fading the shown colours to the target over the requested ticks: each of the 1,536 components (three for each of the 512 colours) steps by its distance divided by the ticks, the remainder kept in the ten bits below it, so every colour arrives together.

References mnTitlePaletteFadeCalculateSteps() and Sint32.

Referenced by mnTitleShowTitleScreen().

Definition at lines 38 and 1378 of file title_intro.c.

mnTitlePaletteFadeClampChannel

Sint32 mnTitlePaletteFadeClampChannel(Sint32 value)

Clamps a five-bit colour channel to 0..31.

References Sint32.

Referenced by mnTitlePaletteFadeBuildColors().

Definition at lines 39 and 1394 of file title_intro.c.

mnTitlePaletteFadeClampShiftedChannel

Sint32 mnTitlePaletteFadeClampShiftedChannel(Sint32 value)

Caps a colour component at a channel's brightest level moved up to the components' place. There is no lower bound.

References Sint32.

Referenced by mnTitlePaletteFadeBuildColors().

Definition at lines 40 and 1405 of file title_intro.c.

mnTitleShowTitleScreen

Sint32 mnTitleShowTitleScreen(Sint32 prompt)

Plays the title intro: the view rises up the peak towards the sun, the clouds slower behind it, while the sun's lens flare swings up, until just before INTRO_FLASH_TICK (A or Start skips ahead); then the screen flashes white into the title picture, the Golden Sun logo over the peak. That holds a minute with the "Press Start" prompt pulsing when prompt is set, five seconds without, and returns 1 when A or Start ends it, else 0.

References BgScrollWork, CpuLoadDisplayEnabled, mnTitleLoadIntroBackgrounds(), mnTitlePaletteFadeInit(), mnTitlePaletteFadeSetCurrent(), mnTitlePaletteFadeStart(), mnTitleUpdateIntroSprites(), OamCopyEnabled, PerPush, Sint32, syCloseEvent(), syDecompressByteLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), syInitEvent(), syOAMAddSpriteAtDepth(), syPrintClear(), syResourceGetTableEntry(), syScreenFadeFromWhite(), syScreenFadeToWhite(), syScreenFadeWait(), sySetEvent(), sySynch(), syVRAMCacheFindFreeEntry(), syVRAMCacheLoad(), syVRAMCacheReset(), syWindowLoadGraphics(), TitlePromptBlendLevels and TitlePromptTiles.

Referenced by scInit().

Definition at line 460 of file title_intro.c.

mnTitleBeforeLogosNoOperation

void mnTitleBeforeLogosNoOperation(void)

Unused: an empty entry the stub table keeps.

Definition at line 739 of file title_intro.c.

Sint32 mnTitleShowPublisherLogo(Sint32 fadeOut)

Shows the publisher's logo with its chime. Without fadeOut, as the title shows it, the logo appears at once and holds two seconds; with it, unused, the logo fades in after a second of black, holds three seconds and fades out. Returns -1 when A or Start skipped it.

References BgScrollWork, OamCopyEnabled, PerPush, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syInitEvent(), syPrintClear(), syResourceGetTableEntry(), syScreenFadeFromBlack(), syScreenFadeToBlack(), syScreenFadeWait(), sySoundPlayStub(), sySynch() and syWindowLoadGraphics().

Referenced by scInit().

Definition at line 753 of file title_intro.c.

Sint32 mnTitleShowCamelotLogo(void)

Shows the Camelot logo for two seconds, its flag waving. A or Start ends it early; it returns 0 either way.

References BgScrollWork, OamCopyEnabled, PerPush, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syInitEvent(), syPrintClear(), syResourceGetTableEntry(), syScreenFadeFromWhite(), syScreenFadeToBlack(), syScreenFadeWait(), sySynch(), syWindowLoadGraphics() and TickCount.

Definition at line 868 of file title_intro.c.

mnTitleAfterIntroNoOperation

void mnTitleAfterIntroNoOperation(void)

Unused: an empty entry the stub table keeps.

Definition at line 933 of file title_intro.c.

Variables in detail

TitleFlareColumns

extern const Uint8 TitleFlareColumns[]

const Uint8 TitleFlareColumns[]

The x of each of the lens flare's six pieces

Definition at lines 14 and 145 of file title_intro.c.

TitlePromptBlendLevels

extern const Uint8 TitlePromptBlendLevels[60]

const Uint8 TitlePromptBlendLevels[PROMPT_PULSE_TICKS]

The prompt's blend level over its pulse

Referenced by mnTitleShowTitleScreen().

Definition at lines 15 and 152 of file title_intro.c.

TitlePaletteFadeChannelCurve

Uint16 TitlePaletteFadeChannelCurve[32]

Maps a channel (0..31) to a component (0..31 << 10).

Referenced by mnTitlePaletteFadeBuildColors().

Definition at line 1416 of file title_intro.c.

TitlePaletteFadeChannelCurveLight

Uint16 TitlePaletteFadeChannelCurveLight[32]

A brighter curve

Referenced by mnTitlePaletteFadeBuildColors().

Definition at line 1424 of file title_intro.c.

TitlePaletteFadeChannelCurveContrast

Uint16 TitlePaletteFadeChannelCurveContrast[32]

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

Referenced by mnTitlePaletteFadeBuildColors().

Definition at line 1432 of file title_intro.c.

On this page

StructuresMacrosEnumerationsFunctionsVariablesDescriptionMacros in detailINTRO_SKIP_AFTER_TICKINTRO_APPROACH_TICKINTRO_FLASH_TICKINTRO_OBJECT_COUNTFLARE_OBJECT_COUNTINTRO_BACK_TILEINTRO_FRONT_TILEINTRO_FRONT_SCREENINTRO_BACK_SCREENINTRO_MAP_ROWSPICTURE_SCREENINTRO_SCROLL_STARTCLOUD_ROWSCLOUD_ROW_BYTESPEAK_ROW_BYTESCLOUD_ROWPEAK_ROWINTRO_VRAM_ROWSINTRO_FIRST_MAP_ROWPEAK_FIRST_TILECLOUD_VRAM_ROWPEAK_VRAM_ROWPEAK_MAP_ROWPEAK_ROWS_ABOVEPROMPT_PULSE_TICKSINTRO_OBJWRAP_OBJ_YFLARE_LINE_LEFTFLARE_LINE_RIGHTSUN_TILEFLARE_ORANGE_DISC_TILEFLARE_RAINBOW_RING_TILEFLARE_GREEN_RING_TILEFLARE_GREEN_DISC_TILEFLARE_WHITE_DISC_TILEINTRO_SPRITE_TILESFLARE_DISC_RADIUSFLARE_RING_RADIUSPLACE_ON_FLARE_LINEMIRRORED_QUADSUN_XSUN_YFILL_INTRO_MAP_ROWSTITLE_PROMPT_HOLD_TICKSTITLE_HOLD_TICKSPROMPT_TILESPROMPT_ROWSPROMPT_ROW_HEIGHTPROMPT_SPRITESPROMPT_XPROMPT_YTITLE_PICTURE_TILETITLE_PICTURE_COLORSPROMPT_SPRITE_BYTESLOGO_PALETTE_BYTESPUBLISHER_LOGO_TILECAMELOT_FLAG_TILECAMELOT_FLAG_PICTURE_BYTESCAMELOT_FLAG_BYTESBUILD_DIMMER_COLORSEnumerations in detailINTRO_PHASEFunctions in detailmnTitleUpdateIntroSpritesmnTitleLoadIntroBackgroundsmnTitlePaletteFadeCalculateStepsmnTitlePaletteFadeUpdatemnTitlePaletteFadeBuildColorsmnTitlePaletteFadeInitmnTitlePaletteFadeReleasemnTitlePaletteFadeSetTargetmnTitlePaletteFadeSetCurrentmnTitlePaletteFadeSetBackdropmnTitlePaletteFadeStartmnTitlePaletteFadeClampChannelmnTitlePaletteFadeClampShiftedChannelmnTitleShowTitleScreenmnTitleBeforeLogosNoOperationmnTitleShowPublisherLogomnTitleShowCamelotLogomnTitleAfterIntroNoOperationVariables in detailTitleFlareColumnsTitlePromptBlendLevelsTitlePaletteFadeChannelCurveTitlePaletteFadeChannelCurveLightTitlePaletteFadeChannelCurveContrast