src/menu/title_intro.c
The title intro, the publisher's and Camelot's logos, the title screen and the palette fade they use. More…
#include "sounds.h"#include "edition.h"#include "macros.h"#include "window/window.h"#include "graphics/palette_buffers.h"#include "field/actor.h"#include "resource_ids.h"#include "scene/title.h"
Structures
| Name | Description | |
|---|---|---|
struct | TITLE_SCROLL_STEP | One step of the clouds' scroll (mnTitleRunScrollStep, TITLE_STEP). |
struct | TITLE_SCROLL | The scroll down the lighthouse picture, or back up it: where it is and where it stops, the pixels a step and the ticks each step waits, and the picture's rows of tiles copied into VRAM as they come into view. |
struct | OAM_ENTRY | An OAM entry's attributes 0 to 2, as the title's logo pieces are written. |
struct | TITLE_LOGO_STATE | The title intro's state while the lighthouse shows (HEAP_SLOT_TITLE_INTRO): the gull or the logo, and the countdowns to the fade to white and back that the scroll down starts. |
struct | INTRO_SPR | A sprite of the "Press Start" prompt, linked into a render slot each tick: OAM attributes 0 to 2 with the position split out. |
struct | TITLE_SCREEN_STATE | The title screen's state (HEAP_SLOT_TITLE_INTRO): the prompt's sprites. |
Macros
| Name | Description | |
|---|---|---|
#define | INTRO_FRONT_SCREEN 30 | The screen blocks of the intro's maps: the near clouds on BG2 and the far ones on BG1, which the lighthouse later takes; the cards' text on BG3 and the line blended in over it on BG0. |
#define | INTRO_BACK_SCREEN 31 | |
#define | INTRO_CARD_SCREEN 29 | |
#define | INTRO_CARD_BLEND_SCREEN 28 | |
#define | OAM_SIZE_64 3 | OAM_ENTRY.size for a 64 by 64 OBJ_SHAPE_SQUARE sprite. |
#define | CLOUD_ROWS 16 | The intro's tiles, in 16 colours: the far clouds in character block 0, the near clouds in block 1, each 256 by 128 pixels, and the cards' text in block 2. |
#define | PRESENTS_ROWS 3 | |
#define | GOLDEN_SUN_ROWS 3 | |
#define | BOOK_TWO_ROWS 2 | |
#define | CARD_TEXT_ROWS (PRESENTS_ROWS + GOLDEN_SUN_ROWS + BOOK_TWO_ROWS) | |
#define | GOLDEN_SUN_TILE (PRESENTS_ROWS * BG_SCREEN_WIDTH) | |
#define | BOOK_TWO_TILE (GOLDEN_SUN_TILE + GOLDEN_SUN_ROWS * BG_SCREEN_WIDTH) | |
#define | INTRO_TILE_BYTES | |
#define | TITLE_STEP (duration, | One step of the clouds' scroll: for duration ticks, BG1 and BG2 move by their dy and dx each tick whose count has none of its mask's bits. |
#define | INTRO_DARK_RED RGB(2, 0, 0) | The dark red the clouds and cards fade from and to between them. |
#define | CLOUD_FRONT_WEIGHT 11 | The near clouds' and the far clouds' blend weights over each other; the plunge raises both from the near clouds' to full. |
#define | CLOUD_BACK_WEIGHT 10 | |
#define | PRESENTS_TOP_ROW 9 | The screen rows each card's text stands on. |
#define | GOLDEN_SUN_TOP_ROW 7 | |
#define | BOOK_TWO_TOP_ROW (GOLDEN_SUN_TOP_ROW + GOLDEN_SUN_ROWS) | |
#define | CARD_BLANK_TILE (2 * BG_SCREEN_WIDTH) | A tile every edition's card text leaves blank, the left end of its third row: the Golden Sun card fills the screen around its text with it and with the blank tile below it. |
#define | LIGHTHOUSE_HEIGHT 384 | The lighthouse picture, 240 by 384 pixels in 256 colours: its first screen is loaded before it scrolls and the rest of its rows of tiles are copied in as they come into view, wrapping round the map's 32 rows. |
#define | LIGHTHOUSE_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_8BPP) | |
#define | LIGHTHOUSE_BOTTOM (LIGHTHOUSE_HEIGHT - DISPLAY_HEIGHT) | The scroll that shows the picture's foot. |
#define | SCREEN_TILE_BYTES (DISPLAY_TILE_HEIGHT * LIGHTHOUSE_ROW_BYTES) | A screen of tiles in 256 colours: the lighthouse picture's first screen, and the publisher's logo and the title screen. |
#define | OFFSCREEN_TILE 511 | The map entry of the two columns past the screen's right edge, which never show. |
#define | LOGO_PIECE_BYTES (64 * 64) | A piece of The Lost Age: 64 by 64 pixels in 256 colours, numbered in the sprites' tiles of 32 bytes. |
#define | LOGO_PIECE_TILES (LOGO_PIECE_BYTES / TILE_SIZE_4BPP) | |
#define | LOGO_LEFT_X 24 | |
#define | LOGO_MIDDLE_X 88 | |
#define | LOGO_RIGHT_X 152 | |
#define | LOGO_Y 50 | |
#define | LOGO_MATRIX_START Q_8_8(0.625) | The logo pieces' affine scale, in 8.8: they start drawn 1.6 times their size and shrink to it. |
#define | LOGO_MATRIX_REST Q_8_8(1) | |
#define | GULL_COLUMNS 8 | The gull's pictures are 64 pixels wide, eight 8x8 sprites to a row, and the path places the middle of its first picture, 28 pixels in. |
#define | GULL_CENTER_X 28 | |
#define | GULL_TILES (108 * GULL_COLUMNS) | The tiles the gull's pictures draw from: 108 rows of eight. |
#define | LOAD_LOGO_TILES (id) | Unpacks a picture of The Lost Age, its three pieces, into sprite tiles. |
#define | GULL_PALETTE_BYTES (16 * 2) | The gull's resource begins with its 16 colours. |
#define | PROMPT_SPRITES 5 | |
#define | PROMPT_X 56 | |
#define | PROMPT_Y 126 | |
#define | PROMPT_ROWS 2 | |
#define | PROMPT_ROW_HEIGHT 8 | |
#define | PROMPT_TILES GERMAN_OR(8, 5) | |
#define | TITLE_PROMPT_HOLD_TICKS (90 * TICKS_PER_SECOND) | The title screen holds this long with its prompt, and this long without. |
#define | TITLE_HOLD_TICKS (11 * TICKS_PER_SECOND) | |
#define | PROMPT_PULSE_TICKS TICKS_PER_SECOND | The prompt pulses once a second, from two seconds in. |
#define | PROMPT_DELAY_TICKS (2 * TICKS_PER_SECOND) | |
#define | LOGO_PALETTE_BYTES (LOGO_PALETTE_COLORS * 2) | The publisher's and Camelot's logos are shown as the Golden Sun logo is (scene/title.h), on BG2, each resource beginning with its 224 colours. |
#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. |
#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. |
#define | CAMELOT_FLAG_PICTURE_BYTES (16 * TILE_SIZE_8BPP) | |
#define | CAMELOT_FLAG_BYTES (13 * TILE_SIZE_8BPP) | |
#define | COMPONENT_SHIFT 10 | A component is a colour's five-bit channel shifted into the high bits of a halfword, with ten bits of fraction below it. |
Enumerations
| Name | Description | |
|---|---|---|
enum | TITLE_LOGO_PHASE { TITLE_LOGO_GULL, TITLE_LOGO_ZOOM } | TITLE_LOGO_STATE.phase: what mnTitleIntroUpdateLogo draws. |
enum | CLOUDS_PASS { CLOUD_BEFORE_CARDS, CLOUD_BETWEEN_CARDS, CLOUD_AFTER_CARDS } | The intro's three passes over the clouds. |
enum | GULL_PICTURE_FIELD { GULL_PICTURE_TILE, GULL_PICTURE_ROWS, GULL_PICTURE_DURATION, … } | The fields of a gull picture in TitleIntroGullPictures: its first tile, its rows of GULL_COLUMNS 8x8 sprites, the ticks it shows for and its offset. |
enum | GULL_STEP_FIELD { GULL_STEP_X, GULL_STEP_Y, GULL_STEP_DURATION, GULL_STEP_FIEL … } | The fields of a step of TitleIntroGullPath: where the gull is and the ticks it stays; an x of -1 ends the path. |
Functions
| Name | Description | |
|---|---|---|
void | mnTitlePaletteFadeSetCurrent (Sint32 tint, Sint32 selectedPalettes) | Sets the colours shown now by tinting the saved palettes. |
Sint32 | mnTitlePaletteFadeClampChannel (Sint32 value) | Holds a colour channel's level to 0 to 31. |
Sint32 | mnTitlePaletteFadeClampShiftedChannel (Sint32 value) | Caps a colour component at a channel's brightest level shifted into the high bits. |
void | mnTitleIntroLoadPictureTiles (void) | Blanks the display, loads the intro's clouds and cards: their colours into the BG palette with colour 0 black, and their tiles, unpacked through the map cell buffer, from BG character block 0. |
Bool | mnTitleWaitOrPress (Uint32 ticks) | Waits ticks ticks, stirring the random seed each tick; returns 1 at once when a key is pressed, 0 when the wait ends. |
Bool | mnTitleRunScrollStep (TITLE_SCROLL_STEP *step) | Runs one step of the clouds' scroll, moving BG1 and BG2 each tick by the step's speeds on the ticks its masks allow; returns 0 when a key cuts it short, 1 when it ends. |
Bool | mnTitleIntroScrollClouds (Sint32 pass) | Shows the two layers of clouds and runs one pass's scroll steps over them (a CLOUDS_PASS), fading in from dark red, at once on the first pass; returns 0 when a key cuts it short. |
Bool | mnTitleIntroShowPresentsCard (void) | Fades in the card Camelot presents on BG3, holds it 150 ticks and fades it out to dark red; returns 0 when a key cuts it short. |
Bool | mnTitleIntroShowBookTwoCard (void) | Fades in the card Golden Sun on BG3, blends Book Two in below it from BG0 over 16 steps of 3 ticks, holds the card 150 ticks and fades it out to dark red; returns 0 when a key cuts it short. |
Bool | mnTitleIntroScrollLighthouse (TITLE_SCROLL *s) | Scrolls the lighthouse picture from one position to another: each step moves it by the scroll's step and waits its ticks, copies in the next row of the picture as one comes into view, and starts the fade to white or back when its countdown reaches 1. |
void | mnTitlePlaceLogoPiece (Sint32 tile, Sint32 x, Uint32 y) | Writes one piece of The Lost Age straight into OAM, in the entry its tile picks: affine at double size, so that its top left is at (x, y) unscaled, semi-transparent and in 256 colours. |
void | mnTitleIntroUpdateLogo (void) | The event that draws over the lighthouse each tick: the gull flying off towards it along its path, then The Lost Age closing in, its pictures coming into focus as it fades up. |
Sint32 | mnTitleIntroShowLighthouse (void) | Shows the lighthouse picture from white and scrolls down it to its foot, flashing white once on the way. |
Sint32 | mnTitleIntroRun (Sint32 unused) | Plays the title intro: the clouds, Camelot presents, the clouds again, Golden Sun Book Two, the plunge through the clouds into white, then the lighthouse in its valley. |
Sint32 | mnTitleShowTitleScreen (Sint32 prompt) | Shows the title screen from white: the Golden Sun logo over the valley and its lighthouse, with, when prompt is set, the "Press Start" prompt pulsing. |
void | mnTitleBeforeLogosNoOperation (void) | Unused: an empty entry the stub table keeps. |
Sint32 | mnTitleShowPublisherLogo (Sint32 mode) | Shows the publisher's logo with its chime. |
Sint32 | mnTitleShowCamelotLogo (void) | Shows the Camelot logo for two seconds, cycling the four pictures of its flag. |
void | mnTitleAfterIntroNoOperation (void) | Unused: an empty entry the stub table keeps. |
void | mnTitlePaletteFadeCalculateSteps (Sint16 *current, Sint16 *target, Sint16 *step, Sint32 ticks) | Computes the change per tick of each of the TITLE_PALETTE_FADE_CHANNELS colour components, from the current components to the target (nothing when ticks is not positive). |
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. |
void | mnTitlePaletteFadeBuildColors (Uint32 tint, Uint16 *src, Uint16 *dest, Sint32 selectedPalettes) | Tints 512 source colours into destination components (three per colour, each in the high bits of a halfword). |
void | mnTitlePaletteFadeInit (void) | Allocates the palette fade, saves both hardware palettes in it as the starting colours and adds the event mnTitlePaletteFadeUpdate. |
void | mnTitlePaletteFadeRelease (void) | Unused: removes the palette fade's event and frees its buffers. |
void | mnTitlePaletteFadeSetTarget (Sint32 tint, Sint32 selectedPalettes) | Sets the fade target by tinting the saved background and/or sprite palettes with the requested tint. |
void | mnTitlePaletteFadeSetBackdrop (Sint32 color) | Unused: replaces the first saved colour, the backdrop. |
void | mnTitlePaletteFadeStart (Sint32 ticks) | Starts fading the shown colours to the target over the requested ticks: each of the 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. |
Variables
| Name | Description | |
|---|---|---|
extern const Uint8 | TitlePromptTiles [] | The Title's "Press Start" prompt, byte-LZ compressed, in each language. |
extern Uint16 | TitlePaletteFadeChannelCurve [] | Each curve maps a colour channel's level (0 to 31) to a palette fade component, a level shifted up 10 bits; this one ends at 31 << 10. |
extern Uint16 | TitlePaletteFadeChannelCurveLight [] | The lighter curve, which lifts the dark and middle channels. |
extern Uint16 | TitlePaletteFadeChannelCurveContrast [] | The contrast curve, which darkens the low channels and reaches full at 25. |
const Sint16 | TitleIntroGullPictures [] | The gull's ticks, rows of five: a first tile, a count of columns, a duration in ticks and an x and y offset. |
const Sint16 | TitleIntroGullPath [] | The gull's path, rows of three: an x and y position and a duration in ticks, ending in a row of -1. |
const Uint8 | TitlePromptBlendLevels [TICKS_PER_SECOND] | The "Press Start" prompt's blend weight over the title screen through its pulse of a second: up over 16 ticks, held, and down over the last 16. |
Description
The title intro, the publisher's and Camelot's logos, the title screen and
the palette fade they use. The intro opens on drifting clouds, shows the
cards Camelot presents and Golden Sun Book Two between them, drops
through the clouds into white, and scrolls down the lighthouse in its valley
while a gull flies off towards it and The Lost Age comes into focus.
The gull's pictures and path, the prompt's levels and the fade's channel curves are tables in this file.
Macros in detail
INTRO_FRONT_SCREEN
#define INTRO_FRONT_SCREEN 30
The screen blocks of the intro's maps: the near clouds on BG2 and the far ones on BG1, which the lighthouse later takes; the cards' text on BG3 and the line blended in over it on BG0.
Referenced by mnTitleIntroScrollClouds().
Definition at line 25 of file title_intro.c.
INTRO_BACK_SCREEN
#define INTRO_BACK_SCREEN 31
Referenced by mnTitleIntroScrollClouds(), mnTitleIntroScrollLighthouse() and mnTitleIntroShowLighthouse().
Definition at line 26 of file title_intro.c.
INTRO_CARD_SCREEN
#define INTRO_CARD_SCREEN 29
Referenced by mnTitleIntroShowBookTwoCard() and mnTitleIntroShowPresentsCard().
Definition at line 27 of file title_intro.c.
INTRO_CARD_BLEND_SCREEN
#define INTRO_CARD_BLEND_SCREEN 28
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 28 of file title_intro.c.
OAM_SIZE_64
#define OAM_SIZE_64 3
OAM_ENTRY.size for a 64 by 64 OBJ_SHAPE_SQUARE sprite.
Referenced by mnTitlePlaceLogoPiece().
Definition at line 76 of file title_intro.c.
CLOUD_ROWS
#define CLOUD_ROWS 16
The intro's tiles, in 16 colours: the far clouds in character block 0, the
near clouds in block 1, each 256 by 128 pixels, and the cards' text in block
2. The text is Camelot presents, on three rows in German, Spanish and
Italian and two in the others, then Golden Sun on three and Book Two on
two.
Referenced by mnTitleIntroScrollClouds().
Definition at line 135 of file title_intro.c.
PRESENTS_ROWS
#define PRESENTS_ROWS 3
#define PRESENTS_ROWS 2
Referenced by mnTitleIntroShowPresentsCard().
Definition at lines 138 and 140 of file title_intro.c.
GOLDEN_SUN_ROWS
#define GOLDEN_SUN_ROWS 3
Definition at line 142 of file title_intro.c.
BOOK_TWO_ROWS
#define BOOK_TWO_ROWS 2
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 143 of file title_intro.c.
CARD_TEXT_ROWS
#define CARD_TEXT_ROWS (PRESENTS_ROWS + GOLDEN_SUN_ROWS + BOOK_TWO_ROWS)
Definition at line 144 of file title_intro.c.
GOLDEN_SUN_TILE
#define GOLDEN_SUN_TILE (PRESENTS_ROWS * BG_SCREEN_WIDTH)
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 145 of file title_intro.c.
BOOK_TWO_TILE
#define BOOK_TWO_TILE (GOLDEN_SUN_TILE + GOLDEN_SUN_ROWS * BG_SCREEN_WIDTH)
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 146 of file title_intro.c.
INTRO_TILE_BYTES
#define INTRO_TILE_BYTES
Referenced by mnTitleIntroLoadPictureTiles().
Definition at line 147 of file title_intro.c.
TITLE_STEP
#define TITLE_STEP(duration,
One step of the clouds' scroll: for duration ticks, BG1 and BG2 move by
their dy and dx each tick whose count has none of its mask's bits.
Referenced by mnTitleIntroScrollClouds().
Definition at line 212 of file title_intro.c.
INTRO_DARK_RED
#define INTRO_DARK_RED RGB(2, 0, 0)
The dark red the clouds and cards fade from and to between them.
Referenced by mnTitleIntroScrollClouds(), mnTitleIntroShowBookTwoCard() and mnTitleIntroShowPresentsCard().
Definition at line 233 of file title_intro.c.
CLOUD_FRONT_WEIGHT
#define CLOUD_FRONT_WEIGHT 11
The near clouds' and the far clouds' blend weights over each other; the plunge raises both from the near clouds' to full.
Referenced by mnTitleIntroScrollClouds().
Definition at line 237 of file title_intro.c.
CLOUD_BACK_WEIGHT
#define CLOUD_BACK_WEIGHT 10
Referenced by mnTitleIntroScrollClouds().
Definition at line 238 of file title_intro.c.
PRESENTS_TOP_ROW
#define PRESENTS_TOP_ROW 9
The screen rows each card's text stands on.
Referenced by mnTitleIntroShowPresentsCard().
Definition at line 412 of file title_intro.c.
GOLDEN_SUN_TOP_ROW
#define GOLDEN_SUN_TOP_ROW 7
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 413 of file title_intro.c.
BOOK_TWO_TOP_ROW
#define BOOK_TWO_TOP_ROW (GOLDEN_SUN_TOP_ROW + GOLDEN_SUN_ROWS)
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 414 of file title_intro.c.
CARD_BLANK_TILE
#define CARD_BLANK_TILE (2 * BG_SCREEN_WIDTH)
A tile every edition's card text leaves blank, the left end of its third row:
the Golden Sun card fills the screen around its text with it and with the
blank tile below it.
Referenced by mnTitleIntroShowBookTwoCard().
Definition at line 418 of file title_intro.c.
LIGHTHOUSE_HEIGHT
#define LIGHTHOUSE_HEIGHT 384
The lighthouse picture, 240 by 384 pixels in 256 colours: its first screen is loaded before it scrolls and the rest of its rows of tiles are copied in as they come into view, wrapping round the map's 32 rows.
Definition at line 552 of file title_intro.c.
LIGHTHOUSE_ROW_BYTES
#define LIGHTHOUSE_ROW_BYTES (DISPLAY_TILE_WIDTH * TILE_SIZE_8BPP)
Referenced by mnTitleIntroScrollLighthouse() and mnTitleIntroShowLighthouse().
Definition at line 553 of file title_intro.c.
LIGHTHOUSE_BOTTOM
#define LIGHTHOUSE_BOTTOM (LIGHTHOUSE_HEIGHT - DISPLAY_HEIGHT)
The scroll that shows the picture's foot.
Referenced by mnTitleIntroShowLighthouse().
Definition at line 555 of file title_intro.c.
SCREEN_TILE_BYTES
#define SCREEN_TILE_BYTES (DISPLAY_TILE_HEIGHT * LIGHTHOUSE_ROW_BYTES)
A screen of tiles in 256 colours: the lighthouse picture's first screen, and the publisher's logo and the title screen.
Referenced by mnTitleIntroShowLighthouse(), mnTitleShowPublisherLogo() and mnTitleShowTitleScreen().
Definition at line 558 of file title_intro.c.
OFFSCREEN_TILE
#define OFFSCREEN_TILE 511
The map entry of the two columns past the screen's right edge, which never show.
Referenced by mnTitleIntroScrollLighthouse(), mnTitleIntroShowLighthouse(), mnTitleShowPublisherLogo() and mnTitleShowTitleScreen().
Definition at line 561 of file title_intro.c.
LOGO_PIECE_BYTES
#define LOGO_PIECE_BYTES (64 * 64)
A piece of The Lost Age: 64 by 64 pixels in 256 colours, numbered in the
sprites' tiles of 32 bytes.
Definition at line 653 of file title_intro.c.
LOGO_PIECE_TILES
#define LOGO_PIECE_TILES (LOGO_PIECE_BYTES / TILE_SIZE_4BPP)
Referenced by mnTitleIntroUpdateLogo().
Definition at line 654 of file title_intro.c.
LOGO_LEFT_X
#define LOGO_LEFT_X 24
#define LOGO_LEFT_X 19
#define LOGO_LEFT_X 30
Referenced by mnTitleIntroUpdateLogo().
Definition at lines 682, 686 and 690 of file title_intro.c.
LOGO_MIDDLE_X
#define LOGO_MIDDLE_X 88
#define LOGO_MIDDLE_X 83
Referenced by mnTitleIntroUpdateLogo().
Definition at lines 683, 687 and 691 of file title_intro.c.
LOGO_RIGHT_X
#define LOGO_RIGHT_X 152
#define LOGO_RIGHT_X 147
#define LOGO_RIGHT_X 140
Referenced by mnTitleIntroUpdateLogo().
Definition at lines 684, 688 and 692 of file title_intro.c.
LOGO_Y
#define LOGO_Y 50
Referenced by mnTitleIntroUpdateLogo().
Definition at line 694 of file title_intro.c.
LOGO_MATRIX_START
#define LOGO_MATRIX_START Q_8_8(0.625)
The logo pieces' affine scale, in 8.8: they start drawn 1.6 times their size and shrink to it.
Referenced by mnTitleIntroUpdateLogo().
Definition at line 698 of file title_intro.c.
LOGO_MATRIX_REST
#define LOGO_MATRIX_REST Q_8_8(1)
Referenced by mnTitleIntroUpdateLogo().
Definition at line 699 of file title_intro.c.
GULL_COLUMNS
#define GULL_COLUMNS 8
The gull's pictures are 64 pixels wide, eight 8x8 sprites to a row, and the path places the middle of its first picture, 28 pixels in.
Referenced by mnTitleIntroUpdateLogo().
Definition at line 725 of file title_intro.c.
GULL_CENTER_X
#define GULL_CENTER_X 28
Referenced by mnTitleIntroUpdateLogo().
Definition at line 726 of file title_intro.c.
GULL_TILES
#define GULL_TILES (108 * GULL_COLUMNS)
The tiles the gull's pictures draw from: 108 rows of eight. Its sheet's 109th row is blank and is not copied.
Referenced by mnTitleIntroShowLighthouse().
Definition at line 729 of file title_intro.c.
LOAD_LOGO_TILES
#define LOAD_LOGO_TILES(id)
Unpacks a picture of The Lost Age, its three pieces, into sprite tiles.
Referenced by mnTitleIntroUpdateLogo().
Definition at line 890 of file title_intro.c.
GULL_PALETTE_BYTES
#define GULL_PALETTE_BYTES (16 * 2)
The gull's resource begins with its 16 colours.
Referenced by mnTitleIntroShowLighthouse().
Definition at line 1033 of file title_intro.c.
PROMPT_SPRITES
#define PROMPT_SPRITES 5
#define PROMPT_SPRITES 3
Referenced by mnTitleShowTitleScreen().
Definition at lines 1243, 1247 and 1253 of file title_intro.c.
PROMPT_X
#define PROMPT_X 56
#define PROMPT_X 80
Referenced by mnTitleShowTitleScreen().
Definition at lines 1244, 1250 and 1254 of file title_intro.c.
PROMPT_Y
#define PROMPT_Y 126
#define PROMPT_Y 116
#define PROMPT_Y 124
Referenced by mnTitleShowTitleScreen().
Definition at lines 1245, 1251 and 1255 of file title_intro.c.
PROMPT_ROWS
#define PROMPT_ROWS 2
Referenced by mnTitleShowTitleScreen().
Definition at line 1248 of file title_intro.c.
PROMPT_ROW_HEIGHT
#define PROMPT_ROW_HEIGHT 8
Referenced by mnTitleShowTitleScreen().
Definition at line 1249 of file title_intro.c.
PROMPT_TILES
#define PROMPT_TILES GERMAN_OR(8, 5)
Referenced by mnTitleShowTitleScreen().
Definition at line 1257 of file title_intro.c.
TITLE_PROMPT_HOLD_TICKS
#define TITLE_PROMPT_HOLD_TICKS (90 * TICKS_PER_SECOND)
The title screen holds this long with its prompt, and this long without.
Referenced by mnTitleShowTitleScreen().
Definition at line 1260 of file title_intro.c.
TITLE_HOLD_TICKS
#define TITLE_HOLD_TICKS (11 * TICKS_PER_SECOND)
Referenced by mnTitleShowTitleScreen().
Definition at line 1261 of file title_intro.c.
PROMPT_PULSE_TICKS
#define PROMPT_PULSE_TICKS TICKS_PER_SECOND
The prompt pulses once a second, from two seconds in.
Referenced by mnTitleShowTitleScreen().
Definition at line 1263 of file title_intro.c.
PROMPT_DELAY_TICKS
#define PROMPT_DELAY_TICKS (2 * TICKS_PER_SECOND)
Referenced by mnTitleShowTitleScreen().
Definition at line 1264 of file title_intro.c.
LOGO_PALETTE_BYTES
#define LOGO_PALETTE_BYTES (LOGO_PALETTE_COLORS * 2)
The publisher's and Camelot's logos are shown as the Golden Sun logo is
(scene/title.h), on BG2, each resource beginning with its 224 colours.
Referenced by mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo() and mnTitleShowTitleScreen().
Definition at line 1268 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 1414 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 1524 of file title_intro.c.
CAMELOT_FLAG_PICTURE_BYTES
#define CAMELOT_FLAG_PICTURE_BYTES (16 * TILE_SIZE_8BPP)
Referenced by mnTitleShowCamelotLogo().
Definition at line 1525 of file title_intro.c.
CAMELOT_FLAG_BYTES
#define CAMELOT_FLAG_BYTES (13 * TILE_SIZE_8BPP)
Referenced by mnTitleShowCamelotLogo().
Definition at line 1526 of file title_intro.c.
COMPONENT_SHIFT
#define COMPONENT_SHIFT 10
A component is a colour's five-bit channel shifted into the high bits of a halfword, with ten bits of fraction below it.
Referenced by mnTitlePaletteFadeBuildColors(), mnTitlePaletteFadeClampShiftedChannel() and mnTitlePaletteFadeUpdate().
Definition at line 1595 of file title_intro.c.
Enumerations in detail
TITLE_LOGO_PHASE
enum TITLE_LOGO_PHASE
TITLE_LOGO_STATE.phase: what mnTitleIntroUpdateLogo draws.
| Enumerator | Value | Description |
|---|---|---|
TITLE_LOGO_GULL | 0 | A gull flies off towards the lighthouse along TitleIntroGullPath. |
TITLE_LOGO_ZOOM | 1 | The Lost Age closes in, its three pieces scaling down and fading up. |
Definition at line 79 of file title_intro.c.
CLOUDS_PASS
enum CLOUDS_PASS
The intro's three passes over the clouds.
| Enumerator | Value | Description |
|---|---|---|
CLOUD_BEFORE_CARDS | 0 | |
CLOUD_BETWEEN_CARDS | 1 | |
CLOUD_AFTER_CARDS | 2 | After the last card, ending in a plunge through them into white. |
Definition at line 241 of file title_intro.c.
GULL_PICTURE_FIELD
enum GULL_PICTURE_FIELD
The fields of a gull picture in TitleIntroGullPictures: its first tile, its
rows of GULL_COLUMNS 8x8 sprites, the ticks it shows for and its offset.
| Enumerator | Value | Description |
|---|---|---|
GULL_PICTURE_TILE | ||
GULL_PICTURE_ROWS | ||
GULL_PICTURE_DURATION | ||
GULL_PICTURE_OFFSET_X | ||
GULL_PICTURE_OFFSET_Y | ||
GULL_PICTURE_FIELDS |
Definition at line 703 of file title_intro.c.
GULL_STEP_FIELD
enum GULL_STEP_FIELD
The fields of a step of TitleIntroGullPath: where the gull is and the ticks
it stays; an x of -1 ends the path.
| Enumerator | Value | Description |
|---|---|---|
GULL_STEP_X | ||
GULL_STEP_Y | ||
GULL_STEP_DURATION | ||
GULL_STEP_FIELDS |
Definition at line 715 of file title_intro.c.
Functions in detail
mnTitlePaletteFadeSetCurrent
void mnTitlePaletteFadeSetCurrent(Sint32 tint, Sint32 selectedPalettes)
Sets the colours shown now by tinting the saved palettes.
References mnTitlePaletteFadeBuildColors() and Sint32.
Referenced by mnTitleIntroScrollClouds(), mnTitleIntroShowBookTwoCard() and mnTitleIntroShowPresentsCard().
Definition at lines 123 and 2029 of file title_intro.c.
mnTitlePaletteFadeClampChannel
Sint32 mnTitlePaletteFadeClampChannel(Sint32 value)
Holds a colour channel's level to 0 to 31.
References Sint32.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at lines 127 and 2067 of file title_intro.c.
mnTitlePaletteFadeClampShiftedChannel
Sint32 mnTitlePaletteFadeClampShiftedChannel(Sint32 value)
Caps a colour component at a channel's brightest level shifted into the high bits. There is no lower bound.
References Sint32.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at lines 128 and 2078 of file title_intro.c.
mnTitleIntroLoadPictureTiles
void mnTitleIntroLoadPictureTiles(void)
Blanks the display, loads the intro's clouds and cards: their colours into the BG palette with colour 0 black, and their tiles, unpacked through the map cell buffer, from BG character block 0.
References syDecompressByteLZ(), syDMAXCopy() and syResourceGetTableEntry().
Referenced by mnTitleIntroRun().
Definition at line 153 of file title_intro.c.
mnTitleWaitOrPress
Bool mnTitleWaitOrPress(Uint32 ticks)
Waits ticks ticks, stirring the random seed each tick; returns 1 at once when a key is pressed, 0 when the wait ends.
References PerWork, syRandom() and sySynch().
Referenced by mnTitleIntroScrollClouds(), mnTitleIntroScrollLighthouse(), mnTitleIntroShowBookTwoCard(), mnTitleIntroShowLighthouse(), mnTitleIntroShowPresentsCard() and mnTitleRunScrollStep().
Definition at line 173 of file title_intro.c.
mnTitleRunScrollStep
Bool mnTitleRunScrollStep(TITLE_SCROLL_STEP *step)
Runs one step of the clouds' scroll, moving BG1 and BG2 each tick by the step's speeds on the ticks its masks allow; returns 0 when a key cuts it short, 1 when it ends.
References BgScrollWork, mnTitleWaitOrPress(), Sint32 and TickCount.
Definition at line 190 of file title_intro.c.
mnTitleIntroScrollClouds
Bool mnTitleIntroScrollClouds(Sint32 pass)
Shows the two layers of clouds and runs one pass's scroll steps over them (a
CLOUDS_PASS), fading in from dark red, at once on the first pass; returns 0
when a key cuts it short.
References BgScrollWork, mnTitlePaletteFadeInit(), mnTitlePaletteFadeSetCurrent(), mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), mnTitleWaitOrPress(), Sint32 and syScreenFadeWait().
Referenced by mnTitleIntroRun().
Definition at line 252 of file title_intro.c.
mnTitleIntroShowPresentsCard
Bool mnTitleIntroShowPresentsCard(void)
Fades in the card Camelot presents on BG3, holds it 150 ticks and fades it
out to dark red; returns 0 when a key cuts it short.
References BgScrollWork, mnTitlePaletteFadeSetCurrent(), mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), mnTitleWaitOrPress() and Sint32.
Referenced by mnTitleIntroRun().
Definition at line 422 of file title_intro.c.
mnTitleIntroShowBookTwoCard
Bool mnTitleIntroShowBookTwoCard(void)
Fades in the card Golden Sun on BG3, blends Book Two in below it from BG0
over 16 steps of 3 ticks, holds the card 150 ticks and fades it out to dark
red; returns 0 when a key cuts it short.
References BgScrollWork, mnTitlePaletteFadeSetCurrent(), mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), mnTitleWaitOrPress() and Sint32.
Referenced by mnTitleIntroRun().
Definition at line 470 of file title_intro.c.
mnTitleIntroScrollLighthouse
Bool mnTitleIntroScrollLighthouse(TITLE_SCROLL *s)
Scrolls the lighthouse picture from one position to another: each step moves it by the scroll's step and waits its ticks, copies in the next row of the picture as one comes into view, and starts the fade to white or back when its countdown reaches 1. Returns 1 when a key cuts the scroll short.
References BgScrollWork, mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), mnTitleWaitOrPress(), Sint32 and syDMAXCopy().
Referenced by mnTitleIntroShowLighthouse().
Definition at line 567 of file title_intro.c.
mnTitlePlaceLogoPiece
void mnTitlePlaceLogoPiece(Sint32 tile, Sint32 x, Uint32 y)
Writes one piece of The Lost Age straight into OAM, in the entry its tile
picks: affine at double size, so that its top left is at (x, y) unscaled,
semi-transparent and in 256 colours.
References Sint32 and syDMAXCopy().
Referenced by mnTitleIntroUpdateLogo().
Definition at line 659 of file title_intro.c.
mnTitleIntroUpdateLogo
void mnTitleIntroUpdateLogo(void)
The event that draws over the lighthouse each tick: the gull flying off
towards it along its path, then The Lost Age closing in, its pictures
coming into focus as it fades up.
References mnTitlePlaceLogoPiece(), Sint32, syDMAXCopy(), syResourceGetTableEntry(), TitleIntroGullPath and TitleIntroGullPictures.
Referenced by mnTitleIntroShowLighthouse().
Definition at line 903 of file title_intro.c.
mnTitleIntroShowLighthouse
Sint32 mnTitleIntroShowLighthouse(void)
Shows the lighthouse picture from white and scrolls down it to its foot,
flashing white once on the way. There a gull flies off towards the lighthouse
and The Lost Age closes in as the picture drifts back up, and it ends back
at the top under a fade to white. A key cuts it short with a fade to black.
Returns 1.
References BgScrollWork, mnTitleIntroScrollLighthouse(), mnTitleIntroUpdateLogo(), mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), mnTitleWaitOrPress(), Sint32, syCloseEvent(), syDecompressByteLZ(), syDMAXCopy(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), sySetEvent() and sySynch().
Referenced by mnTitleIntroRun().
Definition at line 1040 of file title_intro.c.
mnTitleIntroRun
Sint32 mnTitleIntroRun(Sint32 unused)
Plays the title intro: the clouds, Camelot presents, the clouds again,
Golden Sun Book Two, the plunge through the clouds into white, then the
lighthouse in its valley. A key fades it out early, skipping the lighthouse.
Then it clears the screen for what follows and puts back the CPU-load display
it turned off. unused, 1 from the title and 0 before the prologue, is never
read.
References BgScrollWork, CpuLoadDisplayEnabled, mnTitleIntroLoadPictureTiles(), mnTitleIntroScrollClouds(), mnTitleIntroShowBookTwoCard(), mnTitleIntroShowLighthouse(), mnTitleIntroShowPresentsCard(), mnTitlePaletteFadeInit(), mnTitlePaletteFadeSetTarget(), mnTitlePaletteFadeStart(), OamCopyEnabled, result, Sint32, syInitEvent(), syPrintClear(), sySynch(), syVRAMCacheReset() and syWindowLoadGraphics().
Referenced by scInit().
Definition at line 1201 of file title_intro.c.
mnTitleShowTitleScreen
Sint32 mnTitleShowTitleScreen(Sint32 prompt)
Shows the title screen from white: the Golden Sun logo over the valley and
its lighthouse, with, when prompt is set, the "Press Start" prompt pulsing.
It holds 90 seconds with the prompt and 11 without, and A or Start ends it
early, returning 1 (else 0); except in the Japanese edition, the prompt and
the keys wait two seconds.
References BgScrollWork, PerWork, result, Sint32, syDecompressByteLZ(), syDecompressTaggedLZ(), syDMAXCopy(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), syInitEvent(), syOAMAddSpriteAtDepthClamped(), syPrintClear(), syRandom(), syResourceGetTableEntry(), syScreenFadeFromWhite(), syScreenFadeToWhite(), syScreenFadeWait(), sySynch(), syVRAMCacheFindFreeEntry(), syVRAMCacheLoad(), syVRAMCacheReset(), syWindowLoadGraphics(), TitlePromptBlendLevels and TitlePromptTiles.
Referenced by scInit().
Definition at line 1275 of file title_intro.c.
mnTitleBeforeLogosNoOperation
void mnTitleBeforeLogosNoOperation(void)
Unused: an empty entry the stub table keeps.
Definition at line 1408 of file title_intro.c.
mnTitleShowPublisherLogo
Sint32 mnTitleShowPublisherLogo(Sint32 mode)
Shows the publisher's logo with its chime. With mode 0, which is all the title passes, it appears at once and holds two seconds; any other mode, unused, waits a second, fades in, holds three seconds and fades out, faster once skipped. Returns -1 when A or Start skipped it.
References BgScrollWork, OamCopyEnabled, PerWork, result, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syInitEvent(), syPrintClear(), syResourceGetTableEntry(), syScreenFadeFromBlack(), syScreenFadeToBlack(), syScreenFadeWait(), sySoundPlayStub(), sySynch() and syWindowLoadGraphics().
Referenced by scInit().
Definition at line 1420 of file title_intro.c.
mnTitleShowCamelotLogo
Sint32 mnTitleShowCamelotLogo(void)
Shows the Camelot logo for two seconds, cycling the four pictures of its flag. A or Start ends it early.
References BgScrollWork, OamCopyEnabled, PerWork, result, Sint32, syDecompressTaggedLZ(), syDMAXCopy(), syInitEvent(), syPrintClear(), syResourceGetTableEntry(), syScreenFadeFromWhite(), syScreenFadeToBlack(), syScreenFadeWait(), sySynch(), syWindowLoadGraphics() and TickCount.
Referenced by scInit().
Definition at line 1530 of file title_intro.c.
mnTitleAfterIntroNoOperation
void mnTitleAfterIntroNoOperation(void)
Unused: an empty entry the stub table keeps.
Definition at line 1586 of file title_intro.c.
mnTitlePaletteFadeCalculateSteps
void mnTitlePaletteFadeCalculateSteps(Sint16 *current, Sint16 *target, Sint16 *step, Sint32 ticks)
Computes the change per tick of each of the TITLE_PALETTE_FADE_CHANNELS
colour components, from the current components to the target (nothing when
ticks is not positive).
References Sint32 and syIntegerDivide().
Referenced by mnTitlePaletteFadeStart().
Definition at line 1600 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 and syDMAXCopy().
Referenced by mnTitlePaletteFadeInit() and mnTitlePaletteFadeRelease().
Definition at line 1627 of file title_intro.c.
mnTitlePaletteFadeBuildColors
void mnTitlePaletteFadeBuildColors(Uint32 tint, Uint16 *src, Uint16 *dest, Sint32 selectedPalettes)
Tints 512 source colours into destination components (three per colour, each
in the high bits of a halfword). A PALETTE_TINT 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_WARM_DARK 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(), TitlePaletteFadeChannelCurve, TitlePaletteFadeChannelCurveContrast and TitlePaletteFadeChannelCurveLight.
Referenced by mnTitlePaletteFadeInit(), mnTitlePaletteFadeSetCurrent() and mnTitlePaletteFadeSetTarget().
Definition at line 1683 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 mnTitleIntroRun() and mnTitleIntroScrollClouds().
Definition at line 1993 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 line 2011 of file title_intro.c.
mnTitlePaletteFadeSetTarget
void mnTitlePaletteFadeSetTarget(Sint32 tint, Sint32 selectedPalettes)
Sets the fade target by tinting the saved background and/or sprite palettes with the requested tint.
References mnTitlePaletteFadeBuildColors() and Sint32.
Referenced by mnTitleIntroRun(), mnTitleIntroScrollClouds(), mnTitleIntroScrollLighthouse(), mnTitleIntroShowBookTwoCard(), mnTitleIntroShowLighthouse() and mnTitleIntroShowPresentsCard().
Definition at line 2019 of file title_intro.c.
mnTitlePaletteFadeSetBackdrop
void mnTitlePaletteFadeSetBackdrop(Sint32 color)
Unused: replaces the first saved colour, the backdrop.
References Sint32.
Definition at line 2039 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 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 mnTitleIntroRun(), mnTitleIntroScrollClouds(), mnTitleIntroScrollLighthouse(), mnTitleIntroShowBookTwoCard(), mnTitleIntroShowLighthouse() and mnTitleIntroShowPresentsCard().
Definition at line 2051 of file title_intro.c.
Variables in detail
TitlePromptTiles
extern const Uint8 TitlePromptTiles[]
The Title's "Press Start" prompt, byte-LZ compressed, in each language.
Referenced by mnTitleShowTitleScreen().
Definition at line 20 of file title_intro.c.
TitlePaletteFadeChannelCurve
extern Uint16 TitlePaletteFadeChannelCurve[]
Uint16 TitlePaletteFadeChannelCurve[32]
Each curve maps a colour channel's level (0 to 31) to a palette fade component, a level shifted up 10 bits; this one ends at 31 << 10.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at lines 124 and 2087 of file title_intro.c.
TitlePaletteFadeChannelCurveLight
extern Uint16 TitlePaletteFadeChannelCurveLight[]
Uint16 TitlePaletteFadeChannelCurveLight[32]
The lighter curve, which lifts the dark and middle channels.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at lines 125 and 2093 of file title_intro.c.
TitlePaletteFadeChannelCurveContrast
extern Uint16 TitlePaletteFadeChannelCurveContrast[]
Uint16 TitlePaletteFadeChannelCurveContrast[32]
The contrast curve, which darkens the low channels and reaches full at 25.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at lines 126 and 2099 of file title_intro.c.
TitleIntroGullPictures
const Sint16 TitleIntroGullPictures[]
The gull's ticks, rows of five: a first tile, a count of columns, a duration in ticks and an x and y offset. The animation steps a row at a time and stops at the row whose first value is -1.
Referenced by mnTitleIntroUpdateLogo().
Definition at line 735 of file title_intro.c.
TitleIntroGullPath
const Sint16 TitleIntroGullPath[]
The gull's path, rows of three: an x and y position and a duration in ticks, ending in a row of -1.
Referenced by mnTitleIntroUpdateLogo().
Definition at line 777 of file title_intro.c.
TitlePromptBlendLevels
const Uint8 TitlePromptBlendLevels[TICKS_PER_SECOND]
The "Press Start" prompt's blend weight over the title screen through its pulse of a second: up over 16 ticks, held, and down over the last 16.
Referenced by mnTitleShowTitleScreen().
Definition at line 883 of file title_intro.c.