Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
cutscene.c File Reference

Functions

cutscene_tinitCutscene (cutsceneCb cbFunc, cnfsFileIdx_t nextIconIdx, uint8_t soundBank)
 Required to begin a cutscene.
 
void removeAllStyles (cutscene_t *cutscene)
 Removes all styles. Unlikely to be used by anybody else since you add all your styles at the start of the game.
 
void addCutsceneStyle (cutscene_t *cutscene, paletteColor_t textColor, cnfsFileIdx_t spriteIdx, cnfsFileIdx_t textBoxIdx, char *title, uint8_t numSpriteVariations, bool stageLeft, bool drawSprite, bool drawTextbox)
 Adds a cutscene style to an internally managed list.
 
void setMidiParams (cutscene_t *cutscene, uint8_t styleIdx, uint8_t instrument, int8_t octaveOvset, uint16_t noteLength, bool slowAttack)
 Set the Midi Params object.
 
void setSongPitches (cutscene_t *cutscene, int16_t songPitches[8])
 Set the Song Pitches object.
 
void addCutsceneLine (cutscene_t *cutscene, uint8_t styleIdx, char *body, bool flipHorizontal, int8_t spriteVariation, cutsceneCb cbFunc)
 Adds a dialogue line to the cutscene.
 
void updateCutscene (cutscene_t *cutscene, int16_t btnState)
 The update function of the cutscene must be called regularly from your game loop.
 
void drawCutscene (cutscene_t *cutscene, font_t *font)
 The draw function of the cutscene must be called regularly from your draw loop. Update should typically be called before draw.
 
void deinitCutscene (cutscene_t *cutscene)
 Frees data. Required to call where your mode exits or when done with cutscene_t. Remember you may recycle one cutscene_t for many cutscenes and deinit during Mode Exit.
 

Function Documentation

◆ initCutscene()

cutscene_t * initCutscene ( cutsceneCb cbFunc,
cnfsFileIdx_t nextIconIdx,
uint8_t soundBank )

Required to begin a cutscene.

Parameters
cbFuncA callback which is called when this cutscene concludes. Use it to unpause your game loop.
nextIconIdxThe file index of the first of four frames of the nextIcon graphic.
soundBank0 for general midi, 1 for MAGFest, 2 for MegaManX
Returns
cutscene_t*

◆ removeAllStyles()

void removeAllStyles ( cutscene_t * cutscene)

Removes all styles. Unlikely to be used by anybody else since you add all your styles at the start of the game.

Parameters
cutscenePointer to the cutscene_t

◆ addCutsceneStyle()

void addCutsceneStyle ( cutscene_t * cutscene,
paletteColor_t textColor,
cnfsFileIdx_t spriteIdx,
cnfsFileIdx_t textBoxIdx,
char * title,
uint8_t numSpriteVariations,
bool stageLeft,
bool drawSprite,
bool drawTextbox )

Adds a cutscene style to an internally managed list.

Parameters
cutscenePointer to the cutscene_t
textColorThe color to draw text
spriteIdxThe file index of the first pose of a character
textBoxIdxThe file index of the textbox sprite
titleThe text drawn for a character's name
numSpriteVariationsThe number of sprites/poses of this character
stageLeftIf false then this character will slide on and off the right side of the screen. True for left side.
drawSpriteIf true, then the character pose is drawn. Use false to draw nothing.
drawTextboxIf true, then the textbox sprite is drawn behind the text. Use false to draw just the text with no textbox.

◆ setMidiParams()

void setMidiParams ( cutscene_t * cutscene,
uint8_t styleIdx,
uint8_t instrument,
int8_t octaveOvset,
uint16_t noteLength,
bool slowAttack )

Set the Midi Params object.

Parameters
cutscenePointer to the cutscene_t
styleIdxAn index into the styles list
instrumentAn instrument program #
octaveOvsetThe number of octaves to transpose the sounds up or down. Zero for no transposition.
noteLengthVaguely the note length, but not precisely.
slowAttackSet to true to make this character sound really loose. Set to false to sound snappy.

◆ setSongPitches()

void setSongPitches ( cutscene_t * cutscene,
int16_t songPitches[8] )

Set the Song Pitches object.

Parameters
cutscenePointer to the cutscene_t
songPitchesNo less than four midi pitches and no more than 8 that may play well against other background music. Any -1's will be ignored in the array.

◆ addCutsceneLine()

void addCutsceneLine ( cutscene_t * cutscene,
uint8_t styleIdx,
char * body,
bool flipHorizontal,
int8_t spriteVariation,
cutsceneCb cbFunc )

Adds a dialogue line to the cutscene.

Parameters
cutscenePointer to the cutscene
styleIdxIndex into the styles list
bodyThe dialogue text to draw
flipHorizontaltrue to flip the character pose horizontally
spriteVariationThe specific pose sprite, counted up from the main pose sprite.
cbFuncA callback function to fire when A is pressed on this line. Leave NULL to fire nothing.

◆ updateCutscene()

void updateCutscene ( cutscene_t * cutscene,
int16_t btnState )

The update function of the cutscene must be called regularly from your game loop.

Parameters
cutscenePointer to the cutscene_t
btnStateButton state

◆ drawCutscene()

void drawCutscene ( cutscene_t * cutscene,
font_t * font )

The draw function of the cutscene must be called regularly from your draw loop. Update should typically be called before draw.

Parameters
cutscenePointer to the cutscene_t
fontFont to draw the character name and dialogue text

◆ deinitCutscene()

void deinitCutscene ( cutscene_t * cutscene)

Frees data. Required to call where your mode exits or when done with cutscene_t. Remember you may recycle one cutscene_t for many cutscenes and deinit during Mode Exit.

Parameters
cutscene