Alchemy
Loading...
Searching...
No Matches

credits.c File Reference

Go to the source code of this file.

Data Structures

struct  DisplayScrollObject
 One eight-byte OAM entry in the credits' private sprite buffer. More...

Macros

#define CREDITS_LINE_PIXELS   192
#define CREDITS_VISIBLE_ROWS   16
#define CREDITS_COLUMNS   6
#define CREDITS_RING_ROWS   32
#define CREDITS_LINE_TILES   24
#define CREDITS_RING_TILES   (CREDITS_RING_ROWS * CREDITS_LINE_TILES)
#define CREDITS_RING_BYTES   (CREDITS_RING_TILES * TILE_SIZE_4BPP)
#define CREDITS_BUFFER_BYTES   0x900
#define CREDITS_RASTER_STRIDE   256
#define CREDITS_DECODER_HEAP_SLOT   49
#define CREDITS_BORDER_SPRITES   24
#define CREDITS_OAM_ENTRIES   128
#define SCROLL_OBJECTS   (*(struct DisplayScrollObject **)&gFlashNumRemainingBytes)
#define CREDITS_LAST_LINE_POSITION   (*(s16 *)&gFlash)
#define CREDITS_END_OF_TEXT   (*(s16 *)&gFlash_Handler0)
#define CREDITS_STAFF_TITLE   "GOLDEN SUN STAFF CREDITS"
#define CREDITS_FACES_SUBTITLE   " & Faces"
#define CREDITS_SOUND_DIRECTION_LABEL   "Sound Director"
#define CREDITS_GRAPHICS_SUPPORT_LABEL   "Graphic Supports"
#define CREDITS_ARTWORK_LABEL   "Artwork"

Typedefs

typedef s32(*) PackedDecoder(const u8 *source, void *destination, u32 fill)

Functions

void Graphics_ClearCharacterBlockAndPalette (s32 alternate)
 Fills 30 KB of 256-color tiles with color 1 and clears 128 palette colors.
void Graphics_LoadCharacterBlockAndPalette (u32 resourceId, s32 alternate)
 Loads a credits backdrop into one of the two tile/palette halves.
void DisplayScroll_BuildHblankWordTable (u32 *destination)
 Builds the 512 tilemap words surrounding a sliding credits backdrop: blank margins, 240 consecutive tile pairs, then a zero-filled tail.
void DisplayScroll_StepPositionEveryFourFrames (void)
 A VBlank task of the credits slideshow: drifts both backdrops together, keeping their horizontal offsets aligned throughout the crossfade.
s32 DisplayScroll_RunSlideshow (void)
 Crossfades the credits backdrop sequence through alternating tile banks while the staff names scroll over it, then restores the display for the following screen.
 STATIC_ASSERT (sizeof(struct DisplayScrollObject)==8)
void DisplayScroll_UpdateObjects (void)
 A VBlank task scheduled by DisplayScroll_InitObjectTable: maps the visible sixteen rows onto the tile ring and uploads their sprites.
void DisplayScroll_RenderEnteringLine (void)
 A main-loop task scheduled by DisplayScroll_InitObjectTable: renders each entering line sixteen rows ahead of the visible top, into the hidden half of the tile ring.
void DisplayScroll_InitObjectTable (void)
 Allocates the credits sprites, builds the blank border and text rows, clears the tile ring and schedules scrolling and line rendering.
s32 DisplayScroll_DrawLine (const u8 *text, s32 firstTile, s32 alignment)
 Centers, right-aligns or left-aligns one credits line in a 192-pixel row.

Variables

const u32 gDisplayScroll_SlideResources []
 Battle backgrounds shown in the credits; 0 clears the display.
u16 gFlash_Handler3
 Credits scroll position in pixels, in the low half of a flash work cell.
static const u8 sBlankCreditLine [] = ""
 Blank credits line.
const void * gDisplayScroll_LineTable []
 Credits text, one row per line, terminated by 0.

Macro Definition Documentation

◆ CREDITS_LINE_PIXELS

#define CREDITS_LINE_PIXELS   192

Definition at line 40 of file credits.c.

Referenced by DisplayScroll_DrawLine().

◆ CREDITS_VISIBLE_ROWS

#define CREDITS_VISIBLE_ROWS   16

◆ CREDITS_COLUMNS

#define CREDITS_COLUMNS   6

Definition at line 42 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_UpdateObjects().

◆ CREDITS_RING_ROWS

#define CREDITS_RING_ROWS   32

◆ CREDITS_LINE_TILES

#define CREDITS_LINE_TILES   24

◆ CREDITS_RING_TILES

#define CREDITS_RING_TILES   (CREDITS_RING_ROWS * CREDITS_LINE_TILES)

Definition at line 45 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_UpdateObjects().

◆ CREDITS_RING_BYTES

#define CREDITS_RING_BYTES   (CREDITS_RING_TILES * TILE_SIZE_4BPP)

Definition at line 46 of file credits.c.

Referenced by DisplayScroll_InitObjectTable().

◆ CREDITS_BUFFER_BYTES

#define CREDITS_BUFFER_BYTES   0x900

Definition at line 47 of file credits.c.

Referenced by DisplayScroll_DrawLine().

◆ CREDITS_RASTER_STRIDE

#define CREDITS_RASTER_STRIDE   256

Definition at line 48 of file credits.c.

Referenced by DisplayScroll_DrawLine().

◆ CREDITS_DECODER_HEAP_SLOT

#define CREDITS_DECODER_HEAP_SLOT   49

Definition at line 49 of file credits.c.

Referenced by Graphics_LoadCharacterBlockAndPalette().

◆ CREDITS_BORDER_SPRITES

#define CREDITS_BORDER_SPRITES   24

Definition at line 50 of file credits.c.

Referenced by DisplayScroll_UpdateObjects().

◆ CREDITS_OAM_ENTRIES

#define CREDITS_OAM_ENTRIES   128

Definition at line 51 of file credits.c.

Referenced by DisplayScroll_InitObjectTable().

◆ SCROLL_OBJECTS

#define SCROLL_OBJECTS   (*(struct DisplayScrollObject **)&gFlashNumRemainingBytes)

Definition at line 287 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_UpdateObjects().

◆ CREDITS_LAST_LINE_POSITION

#define CREDITS_LAST_LINE_POSITION   (*(s16 *)&gFlash)

Definition at line 289 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_RenderEnteringLine().

◆ CREDITS_END_OF_TEXT

#define CREDITS_END_OF_TEXT   (*(s16 *)&gFlash_Handler0)

◆ CREDITS_STAFF_TITLE

#define CREDITS_STAFF_TITLE   "GOLDEN SUN STAFF CREDITS"

Definition at line 304 of file credits.c.

◆ CREDITS_FACES_SUBTITLE

#define CREDITS_FACES_SUBTITLE   " & Faces"

Definition at line 305 of file credits.c.

◆ CREDITS_SOUND_DIRECTION_LABEL

#define CREDITS_SOUND_DIRECTION_LABEL   "Sound Director"

Definition at line 306 of file credits.c.

◆ CREDITS_GRAPHICS_SUPPORT_LABEL

#define CREDITS_GRAPHICS_SUPPORT_LABEL   "Graphic Supports"

Definition at line 307 of file credits.c.

◆ CREDITS_ARTWORK_LABEL

#define CREDITS_ARTWORK_LABEL   "Artwork"

Definition at line 308 of file credits.c.

Typedef Documentation

◆ PackedDecoder

typedef s32(*) PackedDecoder(const u8 *source, void *destination, u32 fill)

Definition at line 78 of file credits.c.

Function Documentation

◆ Graphics_ClearCharacterBlockAndPalette()

void Graphics_ClearCharacterBlockAndPalette ( s32 alternate)

Fills 30 KB of 256-color tiles with color 1 and clears 128 palette colors.

Called by the credits slideshow before loading a backdrop into a half.

Parameters
alternate0 selects the first half (VRAM 0x06000000, palette 0-127). 1 selects the second half (VRAM 0x06008000, palette 128-255, fill 129).

Definition at line 57 of file credits.c.

Referenced by DisplayScroll_RunSlideshow(), Graphics_ClearCharacterBlockAndPalette(), and Graphics_LoadCharacterBlockAndPalette().

◆ Graphics_LoadCharacterBlockAndPalette()

void Graphics_LoadCharacterBlockAndPalette ( u32 resourceId,
s32 alternate )

Loads a credits backdrop into one of the two tile/palette halves.

A zero resource clears that half; the second half offsets its palette indices. Called by DisplayScroll_RunSlideshow for each picture.

Definition at line 122 of file credits.c.

Referenced by DisplayScroll_RunSlideshow(), and Graphics_LoadCharacterBlockAndPalette().

◆ DisplayScroll_BuildHblankWordTable()

void DisplayScroll_BuildHblankWordTable ( u32 * destination)

Builds the 512 tilemap words surrounding a sliding credits backdrop: blank margins, 240 consecutive tile pairs, then a zero-filled tail.

Called by DisplayScroll_RunSlideshow.

Definition at line 159 of file credits.c.

Referenced by DisplayScroll_BuildHblankWordTable(), and DisplayScroll_RunSlideshow().

◆ DisplayScroll_StepPositionEveryFourFrames()

void DisplayScroll_StepPositionEveryFourFrames ( void )

A VBlank task of the credits slideshow: drifts both backdrops together, keeping their horizontal offsets aligned throughout the crossfade.

Definition at line 191 of file credits.c.

Referenced by DisplayScroll_RunSlideshow(), and DisplayScroll_StepPositionEveryFourFrames().

◆ DisplayScroll_RunSlideshow()

s32 DisplayScroll_RunSlideshow ( void )

Crossfades the credits backdrop sequence through alternating tile banks while the staff names scroll over it, then restores the display for the following screen.

Reached through the scroll far-call table at the end of the game.

Definition at line 204 of file credits.c.

Referenced by DisplayScroll_RunSlideshow().

◆ STATIC_ASSERT()

STATIC_ASSERT ( sizeof(struct DisplayScrollObject) = =8)

◆ DisplayScroll_UpdateObjects()

void DisplayScroll_UpdateObjects ( void )

A VBlank task scheduled by DisplayScroll_InitObjectTable: maps the visible sixteen rows onto the tile ring and uploads their sprites.

Advances one pixel every fourth frame until the end-of-text latch stops the scroll.

Definition at line 933 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_UpdateObjects().

◆ DisplayScroll_RenderEnteringLine()

void DisplayScroll_RenderEnteringLine ( void )

A main-loop task scheduled by DisplayScroll_InitObjectTable: renders each entering line sixteen rows ahead of the visible top, into the hidden half of the tile ring.

A null table entry latches the end-of-text state.

Definition at line 961 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_RenderEnteringLine().

◆ DisplayScroll_InitObjectTable()

void DisplayScroll_InitObjectTable ( void )

Allocates the credits sprites, builds the blank border and text rows, clears the tile ring and schedules scrolling and line rendering.

Called by DisplayScroll_RunSlideshow; the credits keep their state in borrowed flash-library cells (see the graphics README).

Definition at line 983 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_RunSlideshow().

◆ DisplayScroll_DrawLine()

s32 DisplayScroll_DrawLine ( const u8 * text,
s32 firstTile,
s32 alignment )

Centers, right-aligns or left-aligns one credits line in a 192-pixel row.

Rasterizes its glyphs and shadow, packs 4-bit pixels and uploads 24 tiles beginning at firstTile. Called by the line-rendering task and, for the blank rows, by DisplayScroll_InitObjectTable. Returns -1 at the null end marker, otherwise zero.

Definition at line 1041 of file credits.c.

Referenced by DisplayScroll_DrawLine(), DisplayScroll_InitObjectTable(), and DisplayScroll_RenderEnteringLine().

Variable Documentation

◆ gDisplayScroll_SlideResources

const u32 gDisplayScroll_SlideResources[]

Battle backgrounds shown in the credits; 0 clears the display.

Definition at line 82 of file credits.c.

Referenced by DisplayScroll_RunSlideshow().

◆ gFlash_Handler3

◆ sBlankCreditLine

const u8 sBlankCreditLine[] = ""
static

Blank credits line.

Definition at line 294 of file credits.c.

◆ gDisplayScroll_LineTable

const void* gDisplayScroll_LineTable[]

Credits text, one row per line, terminated by 0.

Definition at line 313 of file credits.c.

Referenced by DisplayScroll_InitObjectTable(), and DisplayScroll_RenderEnteringLine().