Skip to Content
The Alchemy Project

src/menu/credits.c

The staff credits: the battle backdrops behind them, the lines that scroll past, and the scrolling images with their border strips. More…

Structures

NameDescription
structDISPLAY_SCROLL_OBJECTOne eight-byte OAM entry in the credits' sprite buffer.

Macros

NameDescription
#defineCREDITS_LINE_PIXELS 192Credits text uses six 32-pixel sprites across each 192-pixel line, drawn into a ring of 32 lines of sprite tiles.
#defineCREDITS_VISIBLE_ROWS 16
#defineCREDITS_COLUMNS 6
#defineCREDITS_RING_ROWS 32
#defineCREDITS_LINE_TILES 24A line's 4bpp tiles, 192 / 8.
#defineCREDITS_RING_TILES (CREDITS_RING_ROWS * CREDITS_LINE_TILES)
#defineCREDITS_RING_BYTES (CREDITS_RING_TILES * TILE_SIZE_4BPP)
#defineCREDITS_BUFFER_BYTES 2304A line's raster: nine rows of 256 one-byte pixels, the ninth for the shadow below the eighth.
#defineCREDITS_RASTER_STRIDE 256
#defineCREDITS_BORDER_SPRITES 24OAM entries 0 to 23: the opaque strips above and below the text.
#defineCREDITS_OAM_ENTRIES 128The whole OAM: the borders, 96 text sprites and 8 parked off screen.
#defineCREDITS_BORDER_TILE_BYTES (8 * TILE_SIZE_4BPP)The border sprites' one 32x16 picture, solid in colour 1, after the ring.
#defineCREDITS_LINE_BYTES (CREDITS_LINE_TILES * TILE_SIZE_4BPP)One ring line's tiles: the top or bottom half of a drawn line.
#defineCREDITS_PAGE_MARK ((const void *)255)The line table's page mark, which ends a stretch of the credits: the scroll stops on it, and a page's start is found by counting these marks.
#defineCREDITS_MAX_LINES 500
#defineCREDITS_TICKS_AFTER_END 375
#defineCREDITS_RING_LINE (line)The ring line a scroll line is drawn into, sixteen rows below the top.
#defineFLAG_CREDITS_LINE_DRAWN FLAG_SCENE_TEMP(0x00)The scene flag that says a credits line was drawn before, so the next one starts from its shadow row.
#defineCREDITS_TEXT_TOP 16The text sprites' rows start below the top strip, and their 192 pixels stand in the middle of the screen.
#defineCREDITS_TEXT_LEFT ((DISPLAY_WIDTH - CREDITS_LINE_PIXELS) / 2)
#defineCREDITS_PARKED 192The x and the y at which the eight spare sprites wait, (192, 192), below the screen.
#defineCREDITS_TEXT_COLOR 15A line's letters are drawn in colour 15, each with its shadow a pixel below and to the right in colour 1, the strips' black.
#defineCREDITS_SHADOW_COLOR 1
#defineCREDITS_GLYPH_LEFT_PIXEL_BIT 0x80A glyph of the credits' font is eight rows of a byte each, its leftmost pixel the top bit.
#defineCRAWL_MESSAGE_PIXELS (2 * 8)A message of the story crawl takes two scroll lines of 8 pixels.
#defineENDING_IMAGE_COLUMNS 15The ending's scrolling images: a map buffer of 15 columns, each a strip of 4 KB copied into its own 2 KB screen block, 31 rows of 64 bytes at a time.
#defineENDING_IMAGE_STRIP_BYTES 4096
#defineENDING_IMAGE_SCREEN_BYTES BG_SCREEN_SIZE
#defineENDING_IMAGE_ROWS 31
#defineENDING_IMAGE_ROW_BYTES 64
#defineENDING_IMAGE_WRAP (offset) ((offset) & (ENDING_IMAGE_SCREEN_BYTES - 1))A row's offset wrapped into its screen block.
#defineENDING_IMAGE_FADE_FRAMES (BLEND_WEIGHT_MAX * 4)The fade-in's frames, four to each blend step.
#defineENDING_IMAGE_ROW_OFFSET (scroll)The map offset of the row of eight pixels a 16.16 scroll stands at.
#defineENDING_IMAGE_MAP_BYTES (ENDING_IMAGE_COLUMNS * ENDING_IMAGE_STRIP_BYTES)The map buffer: every column's strip.
#defineENDING_IMAGE_SCROLL_TIMEOUT (5 * TICKS_PER_SECOND)mnEndingImageWaitForScroll gives up after five seconds.
#defineENDING_IMAGE_STRIP_SPRITES 24The image's border strips: eight sprites across at y 120, 136 and 152.
#defineBACKDROP_COLORS 128A backdrop or image resource begins with its 128 colours, the palette half it takes; its packed tiles follow.
#defineBACKDROP_PALETTE_BYTES (BACKDROP_COLORS * 2)
#defineBACKDROP_TILES 480A battle backdrop's 480 tiles of 256 colours, 256 by 120 pixels.
#defineBACKDROP_TILE_BYTES (BACKDROP_TILES * 64)
#defineBACKDROP_CHANNEL_WEIGHT 5The credits grey a backdrop's colours: a channel becomes the colour's brightness (2 red + 4 green + blue) and BACKDROP_CHANNEL_WEIGHT parts of itself, over BACKDROP_GREY_PARTS.
#defineBACKDROP_GREY_PARTS 16
#defineCREDITS_BG3_SCREEN_BLOCK 15The two images' screen blocks, each holding the same tilemap: BG3's, over character block 0, and BG2's, over character block 2.
#defineCREDITS_BG2_SCREEN_BLOCK 31
#defineTILEMAP_PAIR (left, right) (((right) << 16) | (left))A tilemap word: two map entries side by side, left in its low half.
#defineTILEMAP_ROW_WORDS (BG_SCREEN_WIDTH / 2)A tilemap row's words.
#defineCREDITS_BLANK_TILE 511The tile the margins show: the character block's last, which lies in the screen block's own zeroed tail and so is clear.
#defineOBJ_TILE_ROW (tile, row)A credits tile's row of 4 bytes in object VRAM.
#defineCREDITS_SUBTITLE "DIE VERGESSENE EPOCHE"L'ÂGE PERDU: the French font draws  at 0x7f
#defineRODRIGUEZ "Rodriguez"

Typedefs

NameDescription
typedef Sint32 (*PACKED_DECODER )(const Uint8 *source, void *destination, Uint32 fill);

Enumerations

NameDescription
enumCRAWL_STOP { CRAWL_SCROLLING, CRAWL_STOP_FOR_SLIDE, CRAWL_STOP_END, CRAWL … }DisplayScrollBusy while the story crawl runs: what its last line stopped it on.
enumCREDITS_ALIGNMENT { CREDITS_ALIGN_LEFT, CREDITS_ALIGN_CENTER, CREDITS_ALIGN_RIGH … }Where mnCreditsDrawLine places a line in its 192 pixels.

Functions

NameDescription
Sint32mnDisplayScrollDrawMessageLine (Sint32 msg, Sint32 slot, Sint32 align)Draws one line of the credits' scrolling text into object tiles from slot on.
voidmnCreditsInitCrawlSprites (void)Allocates the story crawl's sprites, builds its border and text rows, and adds mnCreditsUpdateCrawlSprites and mnCreditsDrawEnteringCrawlLine, as The Broken Seal's mnCreditsInitTextSprites starts its credits.
voidmnCreditsInitTextSpritesAtPage (Sint32 credits)Starts the scrolling credits at a page, as mnCreditsInitCrawlSprites starts them at the top: counts the line table's 255 page marks up to the page asked for (at most CREDITS_MAX_LINES lines, stopping at the end) and sets the scroll there, then builds the sprite table and its tiles, adds mnCreditsUpdateTextSprites and mnCreditsDrawEnteringLine to the event table and draws the first 32 lines blank.
voidmnCreditsStopTextSprites (void)Ends the scrolling credits: blanks the tile ring, removes their two events and clears the sprites.
Sint32mnCreditsDrawLine (const Uint8 *text, Sint32 firstTile, Sint32 alignment)Centers, right-aligns or left-aligns one credits line in a 192-pixel row, with its shadow, and writes it as tiles from firstTile.
voidmnEndingImageInitStrips (void)Allocates the 24 sprite entries of the scrolling image's border strips, fills their tiles with colour 1 and adds mnEndingImageDrawStrips to draw them; the entries are written as words, as The Broken Seal's mnCreditsInitCrawlSprites writes its strips.
voidmnCreditsClearBuffer (Sint32 alternate)Fills a backdrop's 256-colour tiles with its half's first colour, an opaque black for the next crossfade, and clears the half's 128 palette colours. alternate is 0 for the first half (character block 0, colours 0 to 127), 1 for the second (character block 2, colours 128 to 255).
voidmnCreditsLoadBackground (Uint32 resourceId, Sint32 alternate)Loads a backdrop resource (its 128 colours, then its packed tiles) into one half of BG VRAM and queues its palette for the next VBlank, as The Broken Seal does, but greyed by BACKDROP_CHANNEL_WEIGHT and BACKDROP_GREY_PARTS.
voidmnCreditsBuildBackgroundTilemap (Uint32 *dest)Builds a backdrop's tilemap, as The Broken Seal does: two blank rows, the backdrop's 480 tiles in order over fifteen rows, three blank rows, then a zeroed tail.
voidmnCreditsScrollBackgrounds (void)A VBlank event of the credits: drifts both images together, keeping their horizontal offsets aligned throughout the crossfade.
Sint32mnCreditsRun (Sint32 mode)Runs the title's story crawl or the staff credits over the greyed battle backdrops.
voidmnCreditsUpdateCrawlSprites (void)A tick-pass event added by mnCreditsInitCrawlSprites, as The Broken Seal's mnCreditsUpdateTextSprites: maps the visible sixteen rows of the story crawl onto the tile ring and uploads their sprites.
voidmnCreditsDrawEnteringCrawlLine (void)A VBlank event added by mnCreditsInitCrawlSprites: draws each line of the story crawl (MsgIntroCrawl) as it enters, two scroll lines a message.
voidmnCreditsUpdateTextSprites (void)A VBlank event added by mnCreditsInitTextSpritesAtPage: maps the visible sixteen rows onto the tile ring and uploads their sprites.
voidmnCreditsDrawEnteringLine (void)An event added by mnCreditsInitTextSpritesAtPage: draws each line entering the credits sixteen rows ahead of the visible top.
voidmnCreditsReservedNoOperation (void)Unused: an empty function nothing calls.
voidmnEndingImageSetTargetRow (Uint16 row)Sets the row the ending's scrolling image moves to, in pixels from its top, at most EndingImageSpeed a tick.
voidmnEndingImageCopyMap (const Uint8 *src, Uint8 *dest, Sint32 pos)Copies 15 columns of a scrolling image's map into a wrapping 2 KB tilemap by DMA, 31 rows of 64 bytes each, from the row the position selects, and records the position in the three scroll words.
voidmnEndingImageScroll (void)The ending image's VBlank event: fades the new image in over 64 frames, moves the row toward EndingImageTargetRow by at most EndingImageSpeed, eases the 16.16 scroll after it, and copies the map strip that scrolls into view.
voidmnEndingImageStart (void)Starts the ending's images (the epilogue scene calls it first): resets the event table and the scroll, adds mnEndingImageScroll, sets up BG2, BG3 and blending, and builds the border strips.
static inline voidCopyScrollMap (const Uint8 *src, Uint8 *dest, Sint32 pos)mnEndingImageCopyMap's body as mnEndingImageShow inlines it: the same copy, written with each column's strip and tilemap found from its number.
voidmnEndingImageShow (Sint32 resource, Uint8 *map, Sint32 pos)Shows a scrolling image on the hidden one of the two BG character blocks.
voidmnEndingImageWaitForScroll (void)Waits, for at most 300 ticks, until the scroll reaches its row.
voidmnEndingImageDrawStrips (void)A VBlank event added by mnEndingImageInitStrips: queues the 24 border strip sprites.
voidmnEndingImageLowerTopStrip (Sint32 enable)Moves the top strip's eight sprites to y 120 when enable is set, and to y 0 otherwise.

Variables

NameDescription
extern const Uint32DisplayScrollSlideResources []The backdrops the slideshow fades between, in turn; 0 ends the list, and the table has room for 25.
extern const void *DisplayScrollLineTable []The staff credits, one line each, ending in 0.
extern const Uint8mnCreditsDecodeBackgroundCode []mnCreditsDecodeBackground, the ARM decoder RAM_CODE_LOAD copies into a heap block to run (credits_background_decode.s).
extern Uint8CreditsDecodeBackgroundCodeSize []mnCreditsDecodeBackgroundCode's bytes, as its address.
extern const Uint8CreditsGlyphWidths []The credits font's advance widths, by character code from 0x20.
extern const Uint8DisplayScrollFont []The credits' font, the glyphs mnCreditsDrawLine draws a line's tiles from.
extern const Uint8EndingImageDecodeCode []The ARM decoder of the ending's scrolling images, which mnEndingImageShow copies into a heap block with RAM_CODE_LOAD to run there (credits_background_decode.s).
extern Uint8EndingImageDecodeCodeSize []EndingImageDecodeCode's bytes, as its address.
const Uint32DisplayScrollUnusedSlideResources []Unused: the slideshow backdrops, ending in 0.
static const Uint8BlankCreditLine []An empty credits line, between the names.

Description

The staff credits: the battle backdrops behind them, the lines that scroll past, and the scrolling images with their border strips.

One object, as The Broken Seal's credits.c is, with its slides and lines at its end; the background decoders linked before it are assembly (credits_background_decode.s, the backdrops' decoder and then the ending images').

Macros in detail

CREDITS_LINE_PIXELS

#define CREDITS_LINE_PIXELS 192

Credits text uses six 32-pixel sprites across each 192-pixel line, drawn into a ring of 32 lines of sprite tiles.

Referenced by mnCreditsDrawLine().

Definition at line 57 of file credits.c.

CREDITS_VISIBLE_ROWS

#define CREDITS_VISIBLE_ROWS 16

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 58 of file credits.c.

CREDITS_COLUMNS

#define CREDITS_COLUMNS 6

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 59 of file credits.c.

CREDITS_RING_ROWS

#define CREDITS_RING_ROWS 32

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsStopTextSprites(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 60 of file credits.c.

CREDITS_LINE_TILES

#define CREDITS_LINE_TILES 24

A line's 4bpp tiles, 192 / 8.

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsStopTextSprites(), mnCreditsUpdateCrawlSprites(), mnCreditsUpdateTextSprites() and mnDisplayScrollDrawMessageLine().

Definition at line 61 of file credits.c.

CREDITS_RING_TILES

#define CREDITS_RING_TILES (CREDITS_RING_ROWS * CREDITS_LINE_TILES)

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 62 of file credits.c.

CREDITS_RING_BYTES

#define CREDITS_RING_BYTES (CREDITS_RING_TILES * TILE_SIZE_4BPP)

Referenced by mnCreditsInitCrawlSprites() and mnCreditsInitTextSpritesAtPage().

Definition at line 63 of file credits.c.

CREDITS_BUFFER_BYTES

#define CREDITS_BUFFER_BYTES 2304

A line's raster: nine rows of 256 one-byte pixels, the ninth for the shadow below the eighth.

Referenced by mnCreditsDrawLine() and mnDisplayScrollDrawMessageLine().

Definition at line 66 of file credits.c.

CREDITS_RASTER_STRIDE

#define CREDITS_RASTER_STRIDE 256

Referenced by mnCreditsDrawLine().

Definition at line 67 of file credits.c.

CREDITS_BORDER_SPRITES

#define CREDITS_BORDER_SPRITES 24

OAM entries 0 to 23: the opaque strips above and below the text.

Referenced by mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 69 of file credits.c.

CREDITS_OAM_ENTRIES

#define CREDITS_OAM_ENTRIES 128

The whole OAM: the borders, 96 text sprites and 8 parked off screen.

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage() and mnCreditsStopTextSprites().

Definition at line 71 of file credits.c.

CREDITS_BORDER_TILE_BYTES

#define CREDITS_BORDER_TILE_BYTES (8 * TILE_SIZE_4BPP)

The border sprites' one 32x16 picture, solid in colour 1, after the ring.

Referenced by mnCreditsInitCrawlSprites() and mnCreditsInitTextSpritesAtPage().

Definition at line 73 of file credits.c.

CREDITS_LINE_BYTES

#define CREDITS_LINE_BYTES (CREDITS_LINE_TILES * TILE_SIZE_4BPP)

One ring line's tiles: the top or bottom half of a drawn line.

Referenced by mnDisplayScrollDrawMessageLine().

Definition at line 75 of file credits.c.

CREDITS_PAGE_MARK

#define CREDITS_PAGE_MARK ((const void *)255)

The line table's page mark, which ends a stretch of the credits: the scroll stops on it, and a page's start is found by counting these marks. Then how far mnCreditsInitTextSpritesAtPage counts for one, and the ticks the credits run on after a mark.

Referenced by DisplayScrollLineTable, mnCreditsDrawEnteringLine() and mnCreditsInitTextSpritesAtPage().

Definition at line 80 of file credits.c.

CREDITS_MAX_LINES

#define CREDITS_MAX_LINES 500

Referenced by mnCreditsInitTextSpritesAtPage().

Definition at line 81 of file credits.c.

CREDITS_TICKS_AFTER_END

#define CREDITS_TICKS_AFTER_END 375

Referenced by mnCreditsRun().

Definition at line 82 of file credits.c.

CREDITS_RING_LINE

#define CREDITS_RING_LINE(line)

The ring line a scroll line is drawn into, sixteen rows below the top.

Referenced by mnCreditsDrawEnteringCrawlLine() and mnCreditsDrawEnteringLine().

Definition at line 84 of file credits.c.

FLAG_CREDITS_LINE_DRAWN

#define FLAG_CREDITS_LINE_DRAWN FLAG_SCENE_TEMP(0x00)

The scene flag that says a credits line was drawn before, so the next one starts from its shadow row.

Referenced by mnCreditsDrawLine().

Definition at line 89 of file credits.c.

CREDITS_TEXT_TOP

#define CREDITS_TEXT_TOP 16

The text sprites' rows start below the top strip, and their 192 pixels stand in the middle of the screen.

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 92 of file credits.c.

CREDITS_TEXT_LEFT

#define CREDITS_TEXT_LEFT ((DISPLAY_WIDTH - CREDITS_LINE_PIXELS) / 2)

Referenced by mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsUpdateCrawlSprites() and mnCreditsUpdateTextSprites().

Definition at line 93 of file credits.c.

CREDITS_PARKED

#define CREDITS_PARKED 192

The x and the y at which the eight spare sprites wait, (192, 192), below the screen.

Referenced by mnCreditsInitCrawlSprites() and mnCreditsInitTextSpritesAtPage().

Definition at line 96 of file credits.c.

CREDITS_TEXT_COLOR

#define CREDITS_TEXT_COLOR 15

A line's letters are drawn in colour 15, each with its shadow a pixel below and to the right in colour 1, the strips' black.

Referenced by mnCreditsDrawLine().

Definition at line 99 of file credits.c.

CREDITS_SHADOW_COLOR

#define CREDITS_SHADOW_COLOR 1

Referenced by mnCreditsDrawLine().

Definition at line 100 of file credits.c.

CREDITS_GLYPH_LEFT_PIXEL_BIT

#define CREDITS_GLYPH_LEFT_PIXEL_BIT 0x80

A glyph of the credits' font is eight rows of a byte each, its leftmost pixel the top bit.

Referenced by mnCreditsDrawLine().

Definition at line 103 of file credits.c.

CRAWL_MESSAGE_PIXELS

#define CRAWL_MESSAGE_PIXELS (2 * 8)

A message of the story crawl takes two scroll lines of 8 pixels.

Referenced by mnCreditsDrawEnteringCrawlLine().

Definition at line 105 of file credits.c.

ENDING_IMAGE_COLUMNS

#define ENDING_IMAGE_COLUMNS 15

The ending's scrolling images: a map buffer of 15 columns, each a strip of 4 KB copied into its own 2 KB screen block, 31 rows of 64 bytes at a time.

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 129 of file credits.c.

ENDING_IMAGE_STRIP_BYTES

#define ENDING_IMAGE_STRIP_BYTES 4096

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 130 of file credits.c.

ENDING_IMAGE_SCREEN_BYTES

#define ENDING_IMAGE_SCREEN_BYTES BG_SCREEN_SIZE

Referenced by CopyScrollMap(), mnEndingImageCopyMap(), mnEndingImageScroll() and mnEndingImageShow().

Definition at line 131 of file credits.c.

ENDING_IMAGE_ROWS

#define ENDING_IMAGE_ROWS 31

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 132 of file credits.c.

ENDING_IMAGE_ROW_BYTES

#define ENDING_IMAGE_ROW_BYTES 64

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 133 of file credits.c.

ENDING_IMAGE_WRAP

#define ENDING_IMAGE_WRAP(offset) ((offset) & (ENDING_IMAGE_SCREEN_BYTES - 1))

A row's offset wrapped into its screen block.

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 135 of file credits.c.

ENDING_IMAGE_FADE_FRAMES

#define ENDING_IMAGE_FADE_FRAMES (BLEND_WEIGHT_MAX * 4)

The fade-in's frames, four to each blend step.

Referenced by mnEndingImageScroll().

Definition at line 137 of file credits.c.

ENDING_IMAGE_ROW_OFFSET

#define ENDING_IMAGE_ROW_OFFSET(scroll)

The map offset of the row of eight pixels a 16.16 scroll stands at.

Referenced by CopyScrollMap(), mnEndingImageCopyMap() and mnEndingImageScroll().

Definition at line 139 of file credits.c.

ENDING_IMAGE_MAP_BYTES

#define ENDING_IMAGE_MAP_BYTES (ENDING_IMAGE_COLUMNS * ENDING_IMAGE_STRIP_BYTES)

The map buffer: every column's strip.

Referenced by mnEndingImageShow().

Definition at line 142 of file credits.c.

ENDING_IMAGE_SCROLL_TIMEOUT

#define ENDING_IMAGE_SCROLL_TIMEOUT (5 * TICKS_PER_SECOND)

mnEndingImageWaitForScroll gives up after five seconds.

Referenced by mnEndingImageWaitForScroll().

Definition at line 144 of file credits.c.

ENDING_IMAGE_STRIP_SPRITES

#define ENDING_IMAGE_STRIP_SPRITES 24

The image's border strips: eight sprites across at y 120, 136 and 152.

Referenced by mnEndingImageDrawStrips() and mnEndingImageInitStrips().

Definition at line 146 of file credits.c.

BACKDROP_COLORS

#define BACKDROP_COLORS 128

A backdrop or image resource begins with its 128 colours, the palette half it takes; its packed tiles follow.

Referenced by mnCreditsLoadBackground().

Definition at line 150 of file credits.c.

BACKDROP_PALETTE_BYTES

#define BACKDROP_PALETTE_BYTES (BACKDROP_COLORS * 2)

Referenced by mnCreditsClearBuffer(), mnCreditsLoadBackground() and mnEndingImageShow().

Definition at line 151 of file credits.c.

BACKDROP_TILES

#define BACKDROP_TILES 480

A battle backdrop's 480 tiles of 256 colours, 256 by 120 pixels.

Referenced by mnCreditsBuildBackgroundTilemap().

Definition at line 153 of file credits.c.

BACKDROP_TILE_BYTES

#define BACKDROP_TILE_BYTES (BACKDROP_TILES * 64)

Referenced by mnCreditsClearBuffer().

Definition at line 154 of file credits.c.

BACKDROP_CHANNEL_WEIGHT

#define BACKDROP_CHANNEL_WEIGHT 5

The credits grey a backdrop's colours: a channel becomes the colour's brightness (2 red + 4 green + blue) and BACKDROP_CHANNEL_WEIGHT parts of itself, over BACKDROP_GREY_PARTS. The weights add to 12, so a grey keeps three quarters of its level.

Referenced by mnCreditsLoadBackground().

Definition at line 159 of file credits.c.

BACKDROP_GREY_PARTS

#define BACKDROP_GREY_PARTS 16

Referenced by mnCreditsLoadBackground().

Definition at line 160 of file credits.c.

CREDITS_BG3_SCREEN_BLOCK

#define CREDITS_BG3_SCREEN_BLOCK 15

The two images' screen blocks, each holding the same tilemap: BG3's, over character block 0, and BG2's, over character block 2.

Referenced by mnCreditsRun() and mnEndingImageStart().

Definition at line 164 of file credits.c.

CREDITS_BG2_SCREEN_BLOCK

#define CREDITS_BG2_SCREEN_BLOCK 31

Referenced by mnCreditsRun() and mnEndingImageStart().

Definition at line 165 of file credits.c.

TILEMAP_PAIR

#define TILEMAP_PAIR(left, right) (((right) << 16) | (left))

A tilemap word: two map entries side by side, left in its low half.

Referenced by mnCreditsBuildBackgroundTilemap().

Definition at line 167 of file credits.c.

TILEMAP_ROW_WORDS

#define TILEMAP_ROW_WORDS (BG_SCREEN_WIDTH / 2)

A tilemap row's words.

Referenced by mnCreditsBuildBackgroundTilemap().

Definition at line 169 of file credits.c.

CREDITS_BLANK_TILE

#define CREDITS_BLANK_TILE 511

The tile the margins show: the character block's last, which lies in the screen block's own zeroed tail and so is clear.

Referenced by mnCreditsBuildBackgroundTilemap().

Definition at line 172 of file credits.c.

OBJ_TILE_ROW

#define OBJ_TILE_ROW(tile, row)

A credits tile's row of 4 bytes in object VRAM.

Referenced by mnCreditsDrawLine().

Definition at line 833 of file credits.c.

CREDITS_SUBTITLE

#define CREDITS_SUBTITLE "DIE VERGESSENE EPOCHE"

#define CREDITS_SUBTITLE "LA EDAD PERDIDA"

#define CREDITS_SUBTITLE "L'\177GE PERDU"

#define CREDITS_SUBTITLE "L'ERA PERDUTA"

L'ÂGE PERDU: the French font draws  at 0x7f

Definition at lines 1417, 1419, 1421 and 1423 of file credits.c.

RODRIGUEZ

#define RODRIGUEZ "Rodriguez"

#define RODRIGUEZ "Rodr'guez"

Definition at lines 1428 and 1430 of file credits.c.

Typedefs in detail

PACKED_DECODER

typedef Sint32 (*PACKED_DECODER)(const Uint8 *source, void *destination, Uint32 fill);

Referenced by mnCreditsLoadBackground().

Definition at line 18 of file credits.c.

Enumerations in detail

CRAWL_STOP

enum CRAWL_STOP

DisplayScrollBusy while the story crawl runs: what its last line stopped it on. A crawl line of dashes draws nothing and stops the crawl, the dashes past the first saying how (mnTextDrawMessageToCanvas).

EnumeratorValueDescription
CRAWL_SCROLLING0
CRAWL_STOP_FOR_SLIDE1"--": the crawl waits for the next slide, which A or B releases
CRAWL_STOP_END2"---", the crawl's last line: the crawl ends
CRAWL_STOP_LONG3"----", which no crawl line has

Definition at line 110 of file credits.c.

CREDITS_ALIGNMENT

enum CREDITS_ALIGNMENT

Where mnCreditsDrawLine places a line in its 192 pixels.

EnumeratorValueDescription
CREDITS_ALIGN_LEFT0
CREDITS_ALIGN_CENTER1
CREDITS_ALIGN_RIGHT2

Definition at line 120 of file credits.c.

Functions in detail

mnDisplayScrollDrawMessageLine

Sint32 mnDisplayScrollDrawMessageLine(Sint32 msg, Sint32 slot, Sint32 align)

Draws one line of the credits' scrolling text into object tiles from slot on.

Draws one line of the credits' scrolling text: the message is drawn into a canvas of one byte a pixel, packed to two pixels a byte, and copied into object tiles from slot on, its top half then its bottom half.

References mnTextDrawMessageToCanvasStub(), Sint32, syHeapAllocateEWRAM(), syHeapRelease() and syWordsClear().

Referenced by mnCreditsDrawEnteringCrawlLine().

Definition at lines 31 and 570 of file credits.c.

mnCreditsInitCrawlSprites

void mnCreditsInitCrawlSprites(void)

Allocates the story crawl's sprites, builds its border and text rows, and adds mnCreditsUpdateCrawlSprites and mnCreditsDrawEnteringCrawlLine, as The Broken Seal's mnCreditsInitTextSprites starts its credits.

References DisplayScrollBusy, DisplayScrollLastPosition, DisplayScrollLineTable, DisplayScrollObjects, DisplayScrollPosition, mnCreditsDrawEnteringCrawlLine(), mnCreditsDrawLine(), mnCreditsUpdateCrawlSprites(), syDMAXCopy(), syHeapAllocateEWRAM() and sySetEvent().

Referenced by mnCreditsRun().

Definition at lines 34 and 479 of file credits.c.

mnCreditsInitTextSpritesAtPage

void mnCreditsInitTextSpritesAtPage(Sint32 credits)

void mnCreditsInitTextSpritesAtPage(Sint32 page)

Starts the scrolling credits at a page, as mnCreditsInitCrawlSprites starts them at the top: counts the line table's 255 page marks up to the page asked for (at most CREDITS_MAX_LINES lines, stopping at the end) and sets the scroll there, then builds the sprite table and its tiles, adds mnCreditsUpdateTextSprites and mnCreditsDrawEnteringLine to the event table and draws the first 32 lines blank.

References DisplayScrollBusy, DisplayScrollLastPosition, DisplayScrollLineTable, DisplayScrollObjects, DisplayScrollPosition, mnCreditsDrawEnteringLine(), mnCreditsDrawLine(), mnCreditsUpdateTextSprites(), Sint32, syDMAXCopy(), syHeapAllocateEWRAM() and sySetEvent().

Referenced by mnCreditsRun().

Definition at lines 35 and 704 of file credits.c.

mnCreditsStopTextSprites

void mnCreditsStopTextSprites(void)

Ends the scrolling credits: blanks the tile ring, removes their two events and clears the sprites.

References DisplayScrollLineTable, DisplayScrollObjects, mnCreditsDrawEnteringLine(), mnCreditsDrawLine(), mnCreditsUpdateTextSprites(), Sint32, syCloseEvent() and syDMAXCopy().

Referenced by mnCreditsRun().

Definition at lines 36 and 814 of file credits.c.

mnCreditsDrawLine

Sint32 mnCreditsDrawLine(const Uint8 *text, Sint32 firstTile, Sint32 alignment)

Centers, right-aligns or left-aligns one credits line in a 192-pixel row, with its shadow, and writes it as tiles from firstTile. Returns -1 at the end of the text.

References CreditsGlyphWidths, DisplayScrollFont, Sint32, syGameFlagGet(), syGameFlagSet(), syHeapAllocateEWRAM(), syHeapRelease() and syWordsCopy().

Referenced by mnCreditsDrawEnteringLine(), mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage() and mnCreditsStopTextSprites().

Definition at lines 37 and 839 of file credits.c.

mnEndingImageInitStrips

void mnEndingImageInitStrips(void)

Allocates the 24 sprite entries of the scrolling image's border strips, fills their tiles with colour 1 and adds mnEndingImageDrawStrips to draw them; the entries are written as words, as The Broken Seal's mnCreditsInitCrawlSprites writes its strips.

References EndingImageStrips, mnEndingImageDrawStrips(), Sint32, syHeapAllocateEWRAM(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnEndingImageStart().

Definition at lines 47 and 1290 of file credits.c.

mnCreditsClearBuffer

void mnCreditsClearBuffer(Sint32 alternate)

Fills a backdrop's 256-colour tiles with its half's first colour, an opaque black for the next crossfade, and clears the half's 128 palette colours. alternate is 0 for the first half (character block 0, colours 0 to 127), 1 for the second (character block 2, colours 128 to 255).

References Sint32.

Referenced by mnCreditsLoadBackground(), mnCreditsRun() and mnEndingImageStart().

Definition at line 178 of file credits.c.

mnCreditsLoadBackground

void mnCreditsLoadBackground(Uint32 resourceId, Sint32 alternate)

Loads a backdrop resource (its 128 colours, then its packed tiles) into one half of BG VRAM and queues its palette for the next VBlank, as The Broken Seal does, but greyed by BACKDROP_CHANNEL_WEIGHT and BACKDROP_GREY_PARTS. A zero resource clears that half instead. The tiles are unpacked by mnCreditsDecodeBackground, run from a heap block, and the grey colours are built in CreditsGreyColors: the credits have no buffer of their own for them, and borrow the cells of the SDK's flash library, which IdentifyFlash sets again before the flash code reads them.

References CreditsDecodeBackgroundCodeSize, CreditsGreyColors, mnCreditsClearBuffer(), mnCreditsDecodeBackgroundCode, Sint32, syHeapRelease() and syResourceGetTableEntry().

Referenced by mnCreditsRun().

Definition at line 209 of file credits.c.

mnCreditsBuildBackgroundTilemap

void mnCreditsBuildBackgroundTilemap(Uint32 *dest)

Builds a backdrop's tilemap, as The Broken Seal does: two blank rows, the backdrop's 480 tiles in order over fifteen rows, three blank rows, then a zeroed tail.

References Sint32.

Referenced by mnCreditsRun() and mnEndingImageStart().

Definition at line 264 of file credits.c.

mnCreditsScrollBackgrounds

void mnCreditsScrollBackgrounds(void)

A VBlank event of the credits: drifts both images together, keeping their horizontal offsets aligned throughout the crossfade.

References BgScrollWork and FrameCount.

Referenced by mnCreditsRun().

Definition at line 288 of file credits.c.

mnCreditsRun

Sint32 mnCreditsRun(Sint32 mode)

Runs the title's story crawl or the staff credits over the greyed battle backdrops. The story crawl (CREDITS_MODE_STORY_CRAWL) cross-fades a new backdrop each time the crawl stops for one, until Start or the crawl's end; any other mode scrolls the staff credits from page mode - CREDITS_MODE_FIRST_PAGE and returns once they have run out.

References CpuLoadDisplayEnabled, CreditsPendingSlides, DebugTextEnabled, DisplayScrollBusy, DisplayScrollSlideResources, IdleSleepEnabled, mnCreditsBuildBackgroundTilemap(), mnCreditsClearBuffer(), mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage(), mnCreditsLoadBackground(), mnCreditsScrollBackgrounds(), mnCreditsStopTextSprites(), OamCopyEnabled, PerWork, Sint32, syInitEvent(), syPrintClear(), sySetEvent(), sySynch() and syWindowLoadGraphics().

Referenced by scInit().

Definition at line 302 of file credits.c.

mnCreditsUpdateCrawlSprites

void mnCreditsUpdateCrawlSprites(void)

A tick-pass event added by mnCreditsInitCrawlSprites, as The Broken Seal's mnCreditsUpdateTextSprites: maps the visible sixteen rows of the story crawl onto the tile ring and uploads their sprites. While a slide waits, A or B releases the next one (CreditsPendingSlides); the crawl advances a pixel every fourth tick, and every tick but those while B is held.

References CreditsPendingSlides, DisplayScrollBusy, DisplayScrollObjects, DisplayScrollPosition, FrameCount, PerWork, Sint32 and syDMAXCopy().

Referenced by mnCreditsInitCrawlSprites().

Definition at line 402 of file credits.c.

mnCreditsDrawEnteringCrawlLine

void mnCreditsDrawEnteringCrawlLine(void)

A VBlank event added by mnCreditsInitCrawlSprites: draws each line of the story crawl (MsgIntroCrawl) as it enters, two scroll lines a message.

References DisplayScrollBusy, DisplayScrollLastPosition, DisplayScrollPosition, mnDisplayScrollDrawMessageLine() and Sint32.

Referenced by mnCreditsInitCrawlSprites().

Definition at line 454 of file credits.c.

mnCreditsUpdateTextSprites

void mnCreditsUpdateTextSprites(void)

A VBlank event added by mnCreditsInitTextSpritesAtPage: maps the visible sixteen rows onto the tile ring and uploads their sprites.

References DisplayScrollObjects, DisplayScrollPosition, FrameCount, Sint32 and syDMAXCopy().

Referenced by mnCreditsInitTextSpritesAtPage() and mnCreditsStopTextSprites().

Definition at line 626 of file credits.c.

mnCreditsDrawEnteringLine

void mnCreditsDrawEnteringLine(void)

An event added by mnCreditsInitTextSpritesAtPage: draws each line entering the credits sixteen rows ahead of the visible top. A page mark stops the scroll, and blank rows follow it while DisplayScrollBusy counts the ticks since.

References DisplayScrollBusy, DisplayScrollLastPosition, DisplayScrollLineTable, DisplayScrollPosition, mnCreditsDrawLine() and Sint32.

Referenced by mnCreditsInitTextSpritesAtPage() and mnCreditsStopTextSprites().

Definition at line 662 of file credits.c.

mnCreditsReservedNoOperation

void mnCreditsReservedNoOperation(void)

Unused: an empty function nothing calls.

Definition at line 972 of file credits.c.

mnEndingImageSetTargetRow

void mnEndingImageSetTargetRow(Uint16 row)

Sets the row the ending's scrolling image moves to, in pixels from its top, at most EndingImageSpeed a tick.

References EndingImageTargetRow.

Referenced by scInit().

Definition at line 978 of file credits.c.

mnEndingImageCopyMap

void mnEndingImageCopyMap(const Uint8 *src, Uint8 *dest, Sint32 pos)

Copies 15 columns of a scrolling image's map into a wrapping 2 KB tilemap by DMA, 31 rows of 64 bytes each, from the row the position selects, and records the position in the three scroll words. The scrolling image scene's callback (mnEndingImageScroll) and its image loader (mnEndingImageShow, through its inline copy) call it.

References EndingImageMapScroll, EndingImageRow, EndingImageScroll, EndingImageTargetRow, Sint32 and syDMAXCopy().

Definition at line 988 of file credits.c.

mnEndingImageScroll

void mnEndingImageScroll(void)

The ending image's VBlank event: fades the new image in over 64 frames, moves the row toward EndingImageTargetRow by at most EndingImageSpeed, eases the 16.16 scroll after it, and copies the map strip that scrolls into view.

References BgScrollWork, EndingImageBlock, EndingImageFadeFrames, EndingImageMap, EndingImageMapScroll, EndingImageRow, EndingImageScroll, EndingImageSpeed, EndingImageTargetRow, Sint32 and syDMAXCopy().

Referenced by mnEndingImageStart().

Definition at line 1020 of file credits.c.

mnEndingImageStart

void mnEndingImageStart(void)

Starts the ending's images (the epilogue scene calls it first): resets the event table and the scroll, adds mnEndingImageScroll, sets up BG2, BG3 and blending, and builds the border strips.

References CpuLoadDisplayEnabled, DebugTextEnabled, EndingImageBlock, EndingImageMap, EndingImageMapScroll, EndingImageRow, EndingImageScroll, EndingImageSpeed, EndingImageTargetRow, IdleSleepEnabled, mnCreditsBuildBackgroundTilemap(), mnCreditsClearBuffer(), mnEndingImageInitStrips(), mnEndingImageScroll(), syInitEvent() and sySetEvent().

Referenced by scInit().

Definition at line 1130 of file credits.c.

CopyScrollMap

static inline void CopyScrollMap(const Uint8 *src, Uint8 *dest, Sint32 pos)

mnEndingImageCopyMap's body as mnEndingImageShow inlines it: the same copy, written with each column's strip and tilemap found from its number.

References EndingImageMapScroll, EndingImageRow, EndingImageScroll, EndingImageTargetRow, Sint32 and syDMAXCopy().

Referenced by mnEndingImageShow().

Definition at line 1167 of file credits.c.

mnEndingImageShow

void mnEndingImageShow(Sint32 resource, Uint8 *map, Sint32 pos)

Shows a scrolling image on the hidden one of the two BG character blocks. With no resource it fills the map buffer with a plain tile word and clears the palette half; otherwise it clears the block's first 2 KB, expands resource's map into the buffer with EndingImageDecodeCode copied to the heap (the fill word marks the second block's tiles), and queues the resource's 128-colour palette. Then it copies the map at position into the tilemap (CopyScrollMap), flips the block and restarts the fade-in counter.

References CopyScrollMap(), EndingImageBlock, EndingImageDecodeCode, EndingImageDecodeCodeSize, EndingImageFadeFrames, EndingImageMap, Sint32, syHeapRelease() and syResourceGetTableEntry().

Referenced by scFieldEndingImageShow().

Definition at line 1203 of file credits.c.

mnEndingImageWaitForScroll

void mnEndingImageWaitForScroll(void)

Waits, for at most 300 ticks, until the scroll reaches its row.

References EndingImageRow, EndingImageScroll, Sint32 and sySynch().

Referenced by scInit().

Definition at line 1259 of file credits.c.

mnEndingImageDrawStrips

void mnEndingImageDrawStrips(void)

A VBlank event added by mnEndingImageInitStrips: queues the 24 border strip sprites.

References EndingImageStrips, Sint32 and syOAMAddSpriteAtDepthClamped().

Referenced by mnEndingImageInitStrips().

Definition at line 1277 of file credits.c.

mnEndingImageLowerTopStrip

void mnEndingImageLowerTopStrip(Sint32 enable)

Moves the top strip's eight sprites to y 120 when enable is set, and to y 0 otherwise.

References EndingImageStrips and Sint32.

Referenced by scInit().

Definition at line 1326 of file credits.c.

Variables in detail

DisplayScrollSlideResources

extern const Uint32 DisplayScrollSlideResources[]

const Uint32 DisplayScrollSlideResources[25]

The backdrops the slideshow fades between, in turn; 0 ends the list, and the table has room for 25.

Referenced by mnCreditsRun().

Definition at lines 29 and 1388 of file credits.c.

DisplayScrollLineTable

extern const void *DisplayScrollLineTable[]

const void *DisplayScrollLineTable[]

The staff credits, one line each, ending in 0.

References BlankCreditLine.

Referenced by mnCreditsDrawEnteringLine(), mnCreditsInitCrawlSprites(), mnCreditsInitTextSpritesAtPage() and mnCreditsStopTextSprites().

Definition at lines 32 and 1434 of file credits.c.

mnCreditsDecodeBackgroundCode

extern const Uint8 mnCreditsDecodeBackgroundCode[]

mnCreditsDecodeBackground, the ARM decoder RAM_CODE_LOAD copies into a heap block to run (credits_background_decode.s).

Referenced by mnCreditsLoadBackground().

Definition at line 40 of file credits.c.

CreditsDecodeBackgroundCodeSize

extern Uint8 CreditsDecodeBackgroundCodeSize[]

mnCreditsDecodeBackgroundCode's bytes, as its address.

Referenced by mnCreditsLoadBackground().

Definition at line 42 of file credits.c.

DisplayScrollFont

extern const Uint8 DisplayScrollFont[]

The credits' font, the glyphs mnCreditsDrawLine draws a line's tiles from.

Referenced by mnCreditsDrawLine().

Definition at line 45 of file credits.c.

EndingImageDecodeCode

extern const Uint8 EndingImageDecodeCode[]

The ARM decoder of the ending's scrolling images, which mnEndingImageShow copies into a heap block with RAM_CODE_LOAD to run there (credits_background_decode.s).

Referenced by mnEndingImageShow().

Definition at line 51 of file credits.c.

EndingImageDecodeCodeSize

extern Uint8 EndingImageDecodeCodeSize[]

EndingImageDecodeCode's bytes, as its address.

Referenced by mnEndingImageShow().

Definition at line 53 of file credits.c.

DisplayScrollUnusedSlideResources

const Uint32 DisplayScrollUnusedSlideResources[]

Unused: the slideshow backdrops, ending in 0.

Definition at line 1351 of file credits.c.

BlankCreditLine

static const Uint8 BlankCreditLine[]

An empty credits line, between the names.

Referenced by DisplayScrollLineTable.

Definition at line 1414 of file credits.c.

On this page

StructuresMacrosTypedefsEnumerationsFunctionsVariablesDescriptionMacros in detailCREDITS_LINE_PIXELSCREDITS_VISIBLE_ROWSCREDITS_COLUMNSCREDITS_RING_ROWSCREDITS_LINE_TILESCREDITS_RING_TILESCREDITS_RING_BYTESCREDITS_BUFFER_BYTESCREDITS_RASTER_STRIDECREDITS_BORDER_SPRITESCREDITS_OAM_ENTRIESCREDITS_BORDER_TILE_BYTESCREDITS_LINE_BYTESCREDITS_PAGE_MARKCREDITS_MAX_LINESCREDITS_TICKS_AFTER_ENDCREDITS_RING_LINEFLAG_CREDITS_LINE_DRAWNCREDITS_TEXT_TOPCREDITS_TEXT_LEFTCREDITS_PARKEDCREDITS_TEXT_COLORCREDITS_SHADOW_COLORCREDITS_GLYPH_LEFT_PIXEL_BITCRAWL_MESSAGE_PIXELSENDING_IMAGE_COLUMNSENDING_IMAGE_STRIP_BYTESENDING_IMAGE_SCREEN_BYTESENDING_IMAGE_ROWSENDING_IMAGE_ROW_BYTESENDING_IMAGE_WRAPENDING_IMAGE_FADE_FRAMESENDING_IMAGE_ROW_OFFSETENDING_IMAGE_MAP_BYTESENDING_IMAGE_SCROLL_TIMEOUTENDING_IMAGE_STRIP_SPRITESBACKDROP_COLORSBACKDROP_PALETTE_BYTESBACKDROP_TILESBACKDROP_TILE_BYTESBACKDROP_CHANNEL_WEIGHTBACKDROP_GREY_PARTSCREDITS_BG3_SCREEN_BLOCKCREDITS_BG2_SCREEN_BLOCKTILEMAP_PAIRTILEMAP_ROW_WORDSCREDITS_BLANK_TILEOBJ_TILE_ROWCREDITS_SUBTITLERODRIGUEZTypedefs in detailPACKED_DECODEREnumerations in detailCRAWL_STOPCREDITS_ALIGNMENTFunctions in detailmnDisplayScrollDrawMessageLinemnCreditsInitCrawlSpritesmnCreditsInitTextSpritesAtPagemnCreditsStopTextSpritesmnCreditsDrawLinemnEndingImageInitStripsmnCreditsClearBuffermnCreditsLoadBackgroundmnCreditsBuildBackgroundTilemapmnCreditsScrollBackgroundsmnCreditsRunmnCreditsUpdateCrawlSpritesmnCreditsDrawEnteringCrawlLinemnCreditsUpdateTextSpritesmnCreditsDrawEnteringLinemnCreditsReservedNoOperationmnEndingImageSetTargetRowmnEndingImageCopyMapmnEndingImageScrollmnEndingImageStartCopyScrollMapmnEndingImageShowmnEndingImageWaitForScrollmnEndingImageDrawStripsmnEndingImageLowerTopStripVariables in detailDisplayScrollSlideResourcesDisplayScrollLineTablemnCreditsDecodeBackgroundCodeCreditsDecodeBackgroundCodeSizeDisplayScrollFontEndingImageDecodeCodeEndingImageDecodeCodeSizeDisplayScrollUnusedSlideResourcesBlankCreditLine