Title Cards from MM (#165)

* backport mm title cards

* fix build issues

* fix build issues

* cleanup

* accidental left-over from merge

* fixed wrong ifdef

* remove place title cards from the spec when using MM title cards
This commit is contained in:
Yanis
2025-11-04 13:59:30 +01:00
committed by GitHub
parent dc0d327417
commit 90ca9c6ff9
18 changed files with 372 additions and 18 deletions

View File

@@ -86,4 +86,15 @@
*/
#define ENABLE_CUTSCENE_IMPROVEMENTS true
/**
* Enable MM Title Cards
*/
#define ENABLE_MM_TITLE_CARDS true
#define TC_TEXT_POS_X 25
#define TC_TEXT_POS_Y 67
#define TC_GRADIENT_WIDTH 60
#define TC_GRADIENT_HEIGHT 28
#define TC_ALPHA_FADE_OUT_INCR 40
#define TC_ALPHA_FADE_IN_INCR 30
#endif

View File

@@ -3,12 +3,18 @@
#include "view.h"
#include "versions.h"
#include "config.h"
#include "color.h"
#include "font.h"
struct OcarinaStaff;
struct Actor;
struct PlayState;
#if ENABLE_MM_TITLE_CARDS
struct TitleCardInfo;
#endif
typedef enum TextBoxIcon {
/* 0 */ TEXTBOX_ICON_TRIANGLE,
/* 1 */ TEXTBOX_ICON_SQUARE,
@@ -108,7 +114,14 @@ typedef enum MessageMode {
/* 0x34 */ MSGMODE_TEXT_AWAIT_NEXT,
/* 0x35 */ MSGMODE_TEXT_DONE,
/* 0x36 */ MSGMODE_TEXT_CLOSING,
/* 0x37 */ MSGMODE_PAUSED // Causes the message system to do nothing until external code sets a new message mode or calls a public function
/* 0x37 */ MSGMODE_PAUSED, // Causes the message system to do nothing until external code sets a new message mode or calls a public function
#if ENABLE_MM_TITLE_CARDS
MSGMODE_SCENE_TITLE_CARD_FADE_IN_BACKGROUND,
MSGMODE_SCENE_TITLE_CARD_FADE_IN_TEXT,
MSGMODE_SCENE_TITLE_CARD_DISPLAYING,
MSGMODE_SCENE_TITLE_CARD_FADE_OUT_TEXT,
MSGMODE_SCENE_TITLE_CARD_FADE_OUT_BACKGROUND,
#endif
} MessageMode;
typedef enum TextState {
@@ -188,6 +201,9 @@ typedef struct MessageContext {
/* 0xE40C */ s16 disableWarpSongs; // disables ability to warp with warp songs
/* 0xE40E */ s16 disableSunsSong; // disables Suns Song effect from occurring after song is played
/* 0xE410 */ u8 lastOcarinaButtonIndex;
#if ENABLE_MM_TITLE_CARDS
struct TitleCardInfo* titleCardInfo;
#endif
} MessageContext; // size = 0xE418
void Message_UpdateOcarinaMemoryGame(struct PlayState* play);
@@ -203,6 +219,11 @@ void Message_Update(struct PlayState* play);
void Message_SetTables(void);
void Message_Init(struct PlayState* play);
#if ENABLE_MM_TITLE_CARDS
void Message_SetTitleCardInfo(struct PlayState* play, struct TitleCardInfo* info);
void Message_DisplaySceneTitleCard(struct PlayState* play);
#endif
extern s16 gOcarinaSongItemMap[];
#endif

View File

@@ -9,6 +9,7 @@
#include "z_math.h"
#include "path.h"
#include "config.h"
#include "color.h"
#include "command_macros_base.h"
@@ -262,6 +263,27 @@ typedef struct {
} ActorCsCamInfo; // size = 0x8
#endif
#if ENABLE_MM_TITLE_CARDS
typedef struct SCmdTitleCard {
/* 0x0 */ u8 code;
/* 0x1 */ u8 data1;
/* 0x4 */ void* segment;
} SCmdTitleCard; // size = 0x8
typedef struct TitleCardInfo {
u16 textId;
Color_RGBA8 rgba; // MM default: R: 140, G: 40, B: 160, A: 255
u8 nextHudVisibility;
u8 duration; // MM default: 30
u8 textDelayTimer; // MM default: 0
Vec2s textPos; // HackerOoT default: X: 25, Y: 67
u8 gradientWidth; // HackerOoT default: 60
u8 gradientHeight; // HackerOoT default: 28
u8 alphaFadeOutIncr; // HackerOoT default: -40
u8 alphaFadeInIncr; // HackerOoT default: 30
} TitleCardInfo;
#endif
typedef union SceneCmd {
SCmdBase base;
SCmdPlayerEntryList playerEntryList;
@@ -299,6 +321,9 @@ typedef union SceneCmd {
SCmdCsCameraList actorCsCamList;
SCmdCutsceneList cutsceneList;
#endif
#if ENABLE_MM_TITLE_CARDS
SCmdTitleCard titleCard;
#endif
} SceneCmd; // size = 0x8
typedef BAD_RETURN(s32) (*SceneCmdHandlerFunc)(struct PlayState*, SceneCmd*);
@@ -486,6 +511,9 @@ typedef enum SceneCommandTypeID {
#if ENABLE_CUTSCENE_IMPROVEMENTS
SCENE_CMD_ID_ACTOR_CUTSCENE_LIST,
SCENE_CMD_ID_ACTOR_CUTSCENE_CAM_LIST,
#endif
#if ENABLE_MM_TITLE_CARDS
SCENE_CMD_ID_TITLE_CARD,
#endif
/* 0x1A */ SCENE_CMD_ID_MAX
} SceneCommandTypeID;
@@ -587,6 +615,11 @@ typedef enum SceneCommandTypeID {
{ SCENE_CMD_ID_ACTOR_CUTSCENE_CAM_LIST, numCams, CMD_PTR(camList) }
#endif
#if ENABLE_MM_TITLE_CARDS
#define SCENE_CMD_TITLE_CARD(titleCardInfo) \
{ SCENE_CMD_ID_TITLE_CARD, 0, CMD_PTR(titleCardInfo) }
#endif
s32 Scene_ExecuteCommands(struct PlayState* play, SceneCmd* sceneCmd);
void Scene_ResetTransitionActorList(struct GameState* state, TransitionActorList* transitionActors);