diff --git a/data/data_59E8E0.s b/data/data_59E8E0.s index 156a4a80..00856e56 100644 --- a/data/data_59E8E0.s +++ b/data/data_59E8E0.s @@ -260,8 +260,8 @@ gUnknown_085A638C: @ 0x085A638C gUnknown_085A643C: @ 0x085A643C .incbin "baserom.gba", 0x5A643C, 0x40 - .global gUnknown_085A647C -gUnknown_085A647C: @ 0x085A647C + .global Tsa_PlayerRankFog +Tsa_PlayerRankFog: @ 0x085A647C .incbin "baserom.gba", 0x5A647C, 0x804 .global Img_DanceringFx diff --git a/data/data_A01CC4.s b/data/data_A01CC4.s index 4b0be01d..dd863760 100644 --- a/data/data_A01CC4.s +++ b/data/data_A01CC4.s @@ -184,8 +184,8 @@ gPal_08A07C58: @ 0x08A07C58 Img_ChapterIntroFog: @ 0x08A07DD8 .incbin "baserom.gba", 0xA07DD8, 0x1C84 - .global gUnknown_08A09A5C -gUnknown_08A09A5C: @ 0x08A09A5C + .global Pal_PlayerRankFog +Pal_PlayerRankFog: @ 0x08A09A5C .incbin "baserom.gba", 0xA09A5C, 0x3F0 .global gGfx_08A09E4C diff --git a/data/data_A3E4D4.s b/data/data_A3E4D4.s index 740b7f0e..42e79e98 100644 --- a/data/data_A3E4D4.s +++ b/data/data_A3E4D4.s @@ -2,20 +2,20 @@ .incbin "baserom.gba", 0xA3EFB4, 0x75C - .global gPal_CharacterEndingMenu -gPal_CharacterEndingMenu: @ 0x08A3F710 + .global Pal_CharacterEndingMenu +Pal_CharacterEndingMenu: @ 0x08A3F710 .incbin "baserom.gba", 0xA3F710, 0x40 - .global gGfx_CharacterEndingMenu -gGfx_CharacterEndingMenu: @ 0x08A3F750 + .global Img_CharacterEndingMenu +Img_CharacterEndingMenu: @ 0x08A3F750 .incbin "baserom.gba", 0xA3F750, 0x89C - .global gUnknown_08A3FFEC -gUnknown_08A3FFEC: @ 0x08A3FFEC + .global Tsa_CharacterEnding_TopBorder +Tsa_CharacterEnding_TopBorder: @ 0x08A3FFEC .incbin "baserom.gba", 0xA3FFEC, 0x7C - .global gUnknown_08A40068 -gUnknown_08A40068: @ 0x08A40068 + .global Tsa_CharacterEnding_BottomBorder +Tsa_CharacterEnding_BottomBorder: @ 0x08A40068 .incbin "baserom.gba", 0xA40068, 0x7C .global gTsa_SoloEndingNameplate @@ -34,24 +34,24 @@ gTsa_PairedEndingNameplates: @ 0x08A4034C gTsa_PairedEndingWindow: @ 0x08A40470 .incbin "baserom.gba", 0xA40470, 0x144 - .global gPal_FinScreen -gPal_FinScreen: @ 0x08A405B4 + .global Pal_FinScreen +Pal_FinScreen: @ 0x08A405B4 .incbin "baserom.gba", 0xA405B4, 0x20 - .global gGfx_FinScreen -gGfx_FinScreen: @ 0x08A405D4 + .global Img_FinScreen +Img_FinScreen: @ 0x08A405D4 .incbin "baserom.gba", 0xA405D4, 0x3FC - .global gTsa_FinScreen -gTsa_FinScreen: @ 0x08A409D0 + .global Tsa_FinScreen +Tsa_FinScreen: @ 0x08A409D0 .incbin "baserom.gba", 0xA409D0, 0x104 - .global gUnknown_08A40AD4 -gUnknown_08A40AD4: @ 0x08A40AD4 + .global Pal_08A40AD4 +Pal_08A40AD4: @ 0x08A40AD4 .incbin "baserom.gba", 0xA40AD4, 0x40 - .global gUnknown_08A40B14 -gUnknown_08A40B14: @ 0x08A40B14 + .global Tsa_08A40B14 +Tsa_08A40B14: @ 0x08A40B14 .incbin "baserom.gba", 0xA40B14, 0x4B4 .global Pal_StaffReelEnt_08A40FC8 diff --git a/include/constants/chapters.h b/include/constants/chapters.h index 1c01a8fa..7c41a260 100644 --- a/include/constants/chapters.h +++ b/include/constants/chapters.h @@ -1,6 +1,93 @@ #pragma once -enum chapter_idx { - // todo - CHAPTER_IDX_PROLOGUE = 0, +enum chapter_idx +{ + CHAPTER_L_PROLOGUE = 0x00, // The Fall of Renais + CHAPTER_L_1 = 0x01, // Ch1: Escape! + CHAPTER_L_2 = 0x02, // Ch2: The Protected + CHAPTER_L_3 = 0x03, // Ch3: The Bandits of Borgo + CHAPTER_L_4 = 0x04, // Ch4: Ancient Horrors + CHAPTER_L_5X = 0x05, // Ch5x: Unbroken Heart + CHAPTER_L_5 = 0x06, // Ch5: The Empire's Reach + CHAPTER_L_6 = 0x07, // Ch6: Victims of War + CHAPTER_L_7 = 0x08, // Ch7: Waterside Renvall + CHAPTER_L_8 = 0x09, // Ch8: It's a Trap! + + CHAPTER_E_9 = 0x0A, // Ch9: Distant Blade + CHAPTER_E_10 = 0x0B, // Ch10: Revolt at Carcino + CHAPTER_E_12 = 0x0C, // Ch12: Village of Silence + CHAPTER_E_13 = 0x0D, // Ch13: Hamill Canyon + CHAPTER_E_14 = 0x0E, // Ch14: Queen of White Dunes + CHAPTER_E_15 = 0x0F, // Ch15: Scorched Sand + CHAPTER_E_16 = 0x10, // Ch16: Ruled by Madness + CHAPTER_E_17 = 0x11, // Ch17: River of Regrets + CHAPTER_E_18 = 0x12, // Ch18: Two Faces of Evil + CHAPTER_E_19 = 0x13, // Ch19: Last Hope + CHAPTER_E_20 = 0x14, // Ch20: Darkling Woods + CHAPTER_E_21 = 0x15, // Ch21: Sacred Stone + CHAPTER_E_21X = 0x16, // Ch21x: Sacred Stone + + CHAPTER_I_9 = 0x17, // Ch9: Fort Rigwald + CHAPTER_I_10 = 0x18, // Ch10: Turning Traitor + CHAPTER_I_12 = 0x19, // Ch12: Landing at Taizel + CHAPTER_I_13 = 0x1A, // Ch13: Fluorspar's Oath + CHAPTER_I_14 = 0x1B, // Ch14: Father and Son + CHAPTER_I_15 = 0x1C, // Ch15: Scorched Sand + CHAPTER_I_16 = 0x1D, // Ch16: Ruled by Madness + CHAPTER_I_17 = 0x1E, // Ch17: River of Regrets + CHAPTER_I_18 = 0x1F, // Ch18: Two Faces of Evil + CHAPTER_I_19 = 0x20, // Ch19: Last Hope + CHAPTER_I_20 = 0x21, // Ch20: Darkling Woods + CHAPTER_I_21 = 0x22, // Ch21: Sacred Stone + CHAPTER_I_21X = 0x23, // Ch21x: Sacred Stone + + CHAPTER_T_01 = 0x24, // Tower of Valni 1 + CHAPTER_T_02 = 0x25, // Tower of Valni 2 + CHAPTER_T_03 = 0x26, // Tower of Valni 3 + CHAPTER_T_04 = 0x27, // Tower of Valni 4 + CHAPTER_T_05 = 0x28, // Tower of Valni 5 + CHAPTER_T_06 = 0x29, // Tower of Valni 6 + CHAPTER_T_07 = 0x2A, // Tower of Valni 7 + CHAPTER_T_08 = 0x2B, // Tower of Valni 8 + + CHAPTER_2C = 0x2C, + CHAPTER_2D = 0x2D, + + CHAPTER_R_01 = 0x2E, // Lagdou Ruins 1 + CHAPTER_R_02 = 0x2F, // Lagdou Ruins 2 + CHAPTER_R_03 = 0x30, // Lagdou Ruins 3 + CHAPTER_R_04 = 0x31, // Lagdou Ruins 4 + CHAPTER_R_05 = 0x32, // Lagdou Ruins 5 + CHAPTER_R_06 = 0x33, // Lagdou Ruins 6 + CHAPTER_R_07 = 0x34, // Lagdou Ruins 7 + CHAPTER_R_08 = 0x35, // Lagdou Ruins 8 + CHAPTER_R_09 = 0x36, // Lagdou Ruins 9 + CHAPTER_R_10 = 0x37, // Lagdou Ruins 10 + + CHAPTER_CASTLE_FRELIA = 0x38, + CHAPTER_MALKAEN_COAST = 0x39, + + CHAPTER_3A = 0x3A, + CHAPTER_3B = 0x3B, + CHAPTER_3C = 0x3C, + + CHAPTER_E_11 = 0x3D, // Ch11: Creeping Darkness + CHAPTER_I_11 = 0x3E, // Ch11: Phantom Ship + + CHAPTER_3F = 0x3F, + CHAPTER_40 = 0x40, + CHAPTER_41 = 0x41, + CHAPTER_42 = 0x42, + CHAPTER_43 = 0x43, + CHAPTER_44 = 0x44, + CHAPTER_45 = 0x45, + CHAPTER_46 = 0x46, + CHAPTER_47 = 0x47, + CHAPTER_48 = 0x48, + CHAPTER_49 = 0x49, + CHAPTER_4A = 0x4A, + CHAPTER_4B = 0x4B, + CHAPTER_4C = 0x4C, + CHAPTER_4D = 0x4D, + CHAPTER_4E = 0x4E, }; diff --git a/include/constants/songs.h b/include/constants/songs.h index 7f917c1c..8a377372 100644 --- a/include/constants/songs.h +++ b/include/constants/songs.h @@ -40,6 +40,8 @@ enum song_idx { SONG_43 = 0x43, SONG_44 = 0x44, SONG_45 = 0x45, + SONG_BGM_ED_AFTER = 0x046, + SONG_BGM_ED_STAFF_2 = 0x056, SONG_5A = 0x5A, SONG_5B = 0x5B, SONG_5C = 0x5C, diff --git a/include/ending_details.h b/include/ending_details.h index 6efeccaf..55db37da 100644 --- a/include/ending_details.h +++ b/include/ending_details.h @@ -1,14 +1,16 @@ #ifndef GUARD_ENDINGDETAILS_H #define GUARD_ENDINGDETAILS_H -enum { +enum +{ CHARACTER_ENDING_NONE = 0, CHARACTER_ENDING_SOLO = 1, CHARACTER_ENDING_PAIRED = 2, }; -enum { +enum +{ DEFEAT_DIED = 0, DEFEAT_WOUNDED_PARTEDWAYS = 1, // unused in FE8 DEFEAT_WOUNDED_REMAINED = 2, @@ -17,84 +19,100 @@ enum { DEFEAT_TYPE_5 = 5, }; -struct EndingTitleEnt { +#define DEFEAT_SKIRMISH_FLAG_BIT 15 +#define DEFEAT_SKIRMISH_MASK (1 << DEFEAT_SKIRMISH_FLAG_BIT) + +#define SetDefeatDetails(defeatLocation, defeatSkirmish) ((defeatLocation) | ((defeatSkirmish) << DEFEAT_SKIRMISH_FLAG_BIT)) +#define GetDefeatLocation(defeatDetails) ((defeatDetails) & ~DEFEAT_SKIRMISH_MASK) +#define IsSkirmishDefeat(defeatDetails) ((defeatDetails) & DEFEAT_SKIRMISH_MASK) + +struct EndingTitleEnt +{ /* 00 */ u8 pid; /* 04 */ int titleTextId; }; -struct EndingDefeatEnt { +struct EndingDefeatEnt +{ /* 00 */ u8 pid; /* 01 */ u8 defeatType; }; -struct CharacterEndingEnt { +struct CharacterEndingEnt +{ /* 00 */ u8 type; /* 01 */ u8 pidA; /* 02 */ u8 pidB; /* 04 */ int textId; }; -struct CharacterEndingProc { +struct CharacterEndingProc +{ /* 00 */ PROC_HEADER; - /* 29 */ u8 _pad[0x2E - 0x29]; - /* 2E */ u16 unk_2e; - /* 30 */ struct CharacterEndingEnt* unk_30; - /* 34 */ struct CharacterEndingEnt* unk_34; - /* 38 */ struct Unit* unitA; - /* 3C */ struct Unit* unitB; - /* 40 */ u32 unk_40[8]; // flags for characters who have already been shown in an ending + /* 29 */ STRUCT_PAD(0x29, 0x2E); + /* 2E */ u16 unk_2e; // unused? Initialized and unreferenced after + /* 30 */ struct CharacterEndingEnt * pCharacterEnding; + /* 34 */ struct CharacterEndingEnt * pCharacterEndingBkp; + /* 38 */ struct Unit * unitA; + /* 3C */ struct Unit * unitB; + /* 40 */ u32 pidShownFlags[8]; // flags for characters who have already been shown in an ending }; -struct EndingBattleDisplayProc { +struct EndingBattleDisplayProc +{ /* 00 */ PROC_HEADER; - /* 2C */ struct Unit* units[2]; - /* 34 */ int unk_34; - /* 38 */ struct CharacterEndingEnt* pCharacterEnding; + /* 2C */ struct Unit * units[2]; + /* 34 */ int timer; + /* 38 */ struct CharacterEndingEnt * pCharacterEnding; /* 3C */ u16 battleAmounts[2]; /* 40 */ u16 winAmounts[2]; /* 44 */ u16 lossAmounts[2]; }; -struct EndingBattleTextProc { +struct EndingBattleTextProc +{ /* 00 */ PROC_HEADER; - /* 2C */ struct CharacterEndingEnt* pCharacterEnding; - /* 30 */ struct Unit* unitA; - /* 34 */ struct Unit* unitB; - /* 38 */ u32 unk_38; + /* 2C */ struct CharacterEndingEnt * pCharacterEnding; + /* 30 */ struct Unit * unitA; + /* 34 */ struct Unit * unitB; + /* 38 */ STRUCT_PAD(0x38, 0x3C); /* 3C */ int pauseTimer; /* 40 */ int defaultPauseDelay; - /* 44 */ const char* str; - /* 48 */ struct Text* Text; + /* 44 */ const char * str; + /* 48 */ struct Text * text; }; -struct FinScreenProc { +struct FinScreenProc +{ /* 00 */ PROC_HEADER; - /* 29 */ u8 _pad[0x4c-0x29]; - /* 4C */ u16 unk_4c; - /* 4E */ u8 _pad2[0x58-0x4e]; - /* 58 */ int unk_58; + /* 29 */ STRUCT_PAD(0x29, 0x4C); + /* 4C */ u16 blendTimer; + /* 4E */ STRUCT_PAD(0x4E, 0x58); + /* 58 */ int timer; }; -struct EndingTurnRecordProc { +struct EndingTurnRecordProc +{ /* 00 */ PROC_HEADER; - /* 2C */ int unk_2c; - /* 30 */ int unk_30; - /* 34 */ int unk_34; - /* 38 */ u8 unk_38; - /* 39 */ u8 unk_39; - /* 3A */ u8 _pad[0x4c-0x3a]; + /* 2C */ int chapterId; + /* 30 */ int yPos; + /* 34 */ int yScrollAmt; + /* 38 */ u8 chapterStatsIdx; + /* 39 */ u8 displayId; + /* 3A */ STRUCT_PAD(0x3A, 0x4C); /* 4C */ s16 unk_4c; }; -struct UnkProc { +struct UnkProc +{ /* 00 */ PROC_HEADER; - /* 29 */ u8 _pad[0x40-0x29]; + /* 29 */ STRUCT_PAD(0x29, 0x40); /* 40 */ u8 unk_40[12]; // size unknown /* 4C */ u16 unk_4c[5]; }; @@ -114,10 +132,10 @@ extern char * CONST_DATA gpDefeatedEndingLocString; // ??? SetupCharacterEndingGfx(???); // ??? sub_80B6810(???); // ??? sub_80B689C(???); -// ??? sub_80B6920(???); +// ??? InitCharacterEndingText(???); // ??? CharacterEnding_Init(???); -// ??? sub_80B69D4(???); -// ??? sub_80B6A10(???); +// ??? CharacterEnding_80B69D4(???); +// ??? GetUnitForCharacterEnding(???); // ??? GetUnitASupporterPid(???); // ??? DoesUnitHavePairedEnding(???); // ??? LoadNextCharacterEnding(???); @@ -126,19 +144,19 @@ extern char * CONST_DATA gpDefeatedEndingLocString; // ??? CharacterEnding_End(???); // ??? CharacterEnding_Unused_80B6C74(???); void StartCharacterEndings(ProcPtr parent); -// ??? sub_80B6CA8(???); +// ??? CharacterEnding_LoadUnitBattleStats(???); // ??? SoloEndingBattleDisp_Init(???); // ??? SoloEndingBattleDisp_Loop(???); -// ??? StartSoloEndingBattleDisplay(???); -// ??? sub_80B6F34(???); -// ??? sub_80B71DC(???); -// ??? sub_80B723C(???); -// ??? sub_80B7274(???); -// ??? StartPairedEndingBattleDisplay(???); +void StartSoloEndingBattleDisplay(struct CharacterEndingEnt *, struct Unit *, struct CharacterEndingProc *); +// ??? PairedEndingBattleDisp_Init(???); +// ??? PairedEndingBattleDisp_Loop_SlideIn(???); +// ??? PairedEndingBattleDisp_InitBlend(???); +// ??? PairedEndingBattleDisp_Loop_Blend(???); +void StartPairedEndingBattleDisplay(struct CharacterEndingEnt *, struct Unit *, struct Unit *, struct CharacterEndingProc *); // ??? EndingBattleInitText(???); // ??? EndingBattleText_Loop(???); -// ??? StartEndingBattleText(???); -// ??? EndEndingBattleText(???); +void StartEndingBattleText(struct CharacterEndingEnt *, struct Unit *, struct Unit *, struct CharacterEndingProc *); +void EndEndingBattleText(void); // ??? SetupFinScreenGfx(???); // ??? Fin_Init(???); // ??? Fin_Loop_KeyListener(???); @@ -148,13 +166,13 @@ void StartCharacterEndings(ProcPtr parent); void StartFinScreen(ProcPtr); // ??? sub_80B75AC(???); // ??? sub_80B7614(???); -// ??? sub_80B7648(???); -// ??? sub_80B770C(???); -// ??? sub_80B7800(???); -// ??? sub_80B7B30(???); +// ??? TurnRecord_Init(???); +// ??? TurnRecord_SetupText(???); +// ??? HandleTurnRecordText(???); +// ??? TurnRecord_Loop_Main(???); // ??? sub_80B7BD8(???); -// ??? sub_80B8014(???); -// ??? sub_80B8168(???); +// ??? TurnRecord_SetupGfx(???); +// ??? TurnRecord_End(???); void StartEndingTurnRecordScreen(ProcPtr parent); #endif // GUARD_ENDINGDETAILS_H diff --git a/include/face.h b/include/face.h index efca46c7..59743ef6 100644 --- a/include/face.h +++ b/include/face.h @@ -145,7 +145,7 @@ int FaceBlinkProc_GenBlinkInterval(struct FaceBlinkProc* proc); void sub_80064D4(struct FaceProc* proc, int unk); void sub_80064DC(int slot, int unk); struct FaceProc* StartFace2(int slot, int fid, int x, int y, int disp); -void sub_8006618(int slot, int x, int y); +void SetFacePosition(int slot, int x, int y); void sub_800662C(struct UnkFaceProc* proc); void sub_8006650(struct UnkFaceProc* proc); void sub_80066A8(struct UnkFaceProc* proc); diff --git a/include/variables.h b/include/variables.h index e175fb25..7630a9d9 100644 --- a/include/variables.h +++ b/include/variables.h @@ -461,7 +461,7 @@ extern u16 CONST_DATA Tsa_EventWarp[]; extern u8 gUnknown_085A638C[]; extern u16 gUnknown_085A643C[]; -extern u8 gUnknown_085A647C[]; // tsa +extern u8 Tsa_PlayerRankFog[]; // tsa extern u16 CONST_DATA Img_DanceringFx[]; extern u16 CONST_DATA Tsa_DanceringFx[]; @@ -833,7 +833,7 @@ extern u16 gPal_08A07AD8[]; // pal // extern ??? gUnknown_08A07C0A extern u16 gPal_08A07C58[]; // pal extern u16 CONST_DATA Img_ChapterIntroFog[]; -extern u16 gUnknown_08A09A5C[]; // pal +extern u16 Pal_PlayerRankFog[]; // pal extern u8 gGfx_08A09E4C[]; // gfx // extern ??? gUnknown_08A0A4E8 extern u8 gTsa_08A0A9F8[]; // tsa @@ -997,19 +997,19 @@ extern u16 gUnknown_08A37300[]; // pal // extern ??? gUnknown_08A3CB50 // extern ??? gCGDataTable -extern u16 gPal_CharacterEndingMenu[]; -extern u8 gGfx_CharacterEndingMenu[]; -extern u8 gUnknown_08A3FFEC[]; // tsa -extern u8 gUnknown_08A40068[]; // tsa +extern u16 Pal_CharacterEndingMenu[]; +extern u8 Img_CharacterEndingMenu[]; +extern u8 Tsa_CharacterEnding_TopBorder[]; // tsa +extern u8 Tsa_CharacterEnding_BottomBorder[]; // tsa extern u8 gTsa_SoloEndingNameplate[]; extern u8 gTsa_SoloEndingWindow[]; extern u8 gTsa_PairedEndingNameplates[]; extern u8 gTsa_PairedEndingWindow[]; -extern u16 gPal_FinScreen[]; -extern u8 gGfx_FinScreen[]; -extern u8 gTsa_FinScreen[]; -extern u16 gUnknown_08A40AD4[]; // pal -extern u8 gUnknown_08A40B14[]; // tsa +extern u16 Pal_FinScreen[]; +extern u8 Img_FinScreen[]; +extern u8 Tsa_FinScreen[]; +extern u16 Pal_08A40AD4[]; // pal +extern u8 Tsa_08A40B14[]; // tsa extern u16 Pal_StaffReelEnt_08A40FC8[]; extern u8 Img_StaffReelEnt_08A40FE8[]; extern u8 Img_StaffReelEnt_08A41B30[]; diff --git a/src/ending_details.c b/src/ending_details.c index 6cd928b9..9a12056e 100644 --- a/src/ending_details.c +++ b/src/ending_details.c @@ -13,9 +13,15 @@ #include "bmtrade.h" #include "worldmap.h" #include "savemenu.h" -#include "ending_details.h" #include "sysutil.h" +#include "scene.h" + +#include "ending_details.h" + +#include "constants/chapters.h" #include "constants/characters.h" +#include "constants/msg.h" +#include "constants/songs.h" EWRAM_OVERLAY(gameending) u16 gEndingDetailBuf[0x3D0] = {}; EWRAM_OVERLAY(gameending) u16 gEndingTmScratchA[0x800 / 2] = {}; @@ -26,194 +32,199 @@ EWRAM_OVERLAY(gameending) struct Text gEndingDetailTexts[19] = {}; char * CONST_DATA gpDefeatedEndingLocString = (char *)gEndingTmScratchA; -struct CharacterEndingEnt CONST_DATA gCharacterEndings_Eirika[] = { - { CHARACTER_ENDING_PAIRED, CHARACTER_SETH, CHARACTER_NATASHA, 0x0000081F, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SETH, CHARACTER_NONE, 0x000007D8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_FRANZ, CHARACTER_AMELIA, 0x00000820, }, - { CHARACTER_ENDING_SOLO, CHARACTER_FRANZ, CHARACTER_NONE, 0x000007DC, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GILLIAM, CHARACTER_SYRENE, 0x00000821, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GILLIAM, CHARACTER_NONE, 0x000007DA, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MOULDER, CHARACTER_NONE, 0x000007DE, }, - { CHARACTER_ENDING_SOLO, CHARACTER_VANESSA, CHARACTER_NONE, 0x000007E0, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_ROSS, CHARACTER_AMELIA, 0x00000832, }, - { CHARACTER_ENDING_SOLO, CHARACTER_ROSS, CHARACTER_NONE, 0x000007E2, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GARCIA, CHARACTER_ROSS, 0x00000824, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GARCIA, CHARACTER_NONE, 0x000007E8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_COLM, CHARACTER_NEIMI, 0x00000825, }, - { CHARACTER_ENDING_SOLO, CHARACTER_COLM, CHARACTER_NONE, 0x000007E6, }, - { CHARACTER_ENDING_SOLO, CHARACTER_NEIMI, CHARACTER_NONE, 0x000007E4, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_ARTUR, CHARACTER_LUTE, 0x00000826, }, - { CHARACTER_ENDING_SOLO, CHARACTER_ARTUR, CHARACTER_NONE, 0x000007FA, }, - { CHARACTER_ENDING_SOLO, CHARACTER_LUTE, CHARACTER_NONE, 0x000007EC, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_MARISA, 0x00000830, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_GERIK, 0x00000834, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_NATASHA, 0x00000828, }, - { CHARACTER_ENDING_SOLO, CHARACTER_JOSHUA, CHARACTER_NONE, 0x00000812, }, - { CHARACTER_ENDING_SOLO, CHARACTER_NATASHA, CHARACTER_NONE, 0x000007EE, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_FORDE, CHARACTER_VANESSA, 0x00000823, }, - { CHARACTER_ENDING_SOLO, CHARACTER_FORDE, CHARACTER_NONE, 0x000007F4, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_FORDE, 0x00000829, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_SYRENE, 0x00000837, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_LUTE, 0x00000827, }, - { CHARACTER_ENDING_SOLO, CHARACTER_KYLE, CHARACTER_NONE, 0x000007F6, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_TANA, CHARACTER_CORMAG, 0x0000082A, }, - { CHARACTER_ENDING_SOLO, CHARACTER_TANA, CHARACTER_NONE, 0x00000816, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_LARACHEL, 0x0000082B, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_VANESSA, 0x00000822, }, - { CHARACTER_ENDING_SOLO, CHARACTER_INNES, CHARACTER_NONE, 0x000007EA, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_SYRENE, CHARACTER_VANESSA, 0x00000835, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SYRENE, CHARACTER_NONE, 0x00000814, }, - { CHARACTER_ENDING_SOLO, CHARACTER_AMELIA, CHARACTER_NONE, 0x000007F8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_DUESSEL, CHARACTER_AMELIA, 0x00000838, }, - { CHARACTER_ENDING_SOLO, CHARACTER_DUESSEL, CHARACTER_NONE, 0x0000080C, }, - { CHARACTER_ENDING_SOLO, CHARACTER_KNOLL, CHARACTER_NONE, 0x00000810, }, - { CHARACTER_ENDING_SOLO, CHARACTER_CORMAG, CHARACTER_NONE, 0x000007F0, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_LARACHEL, CHARACTER_DOZLA, 0x00000831, }, - { CHARACTER_ENDING_SOLO, CHARACTER_LARACHEL, CHARACTER_NONE, 0x00000806, }, - { CHARACTER_ENDING_SOLO, CHARACTER_DOZLA, CHARACTER_NONE, 0x00000808, }, - { CHARACTER_ENDING_SOLO, CHARACTER_RENNAC, CHARACTER_NONE, 0x0000080A, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_TETHYS, 0x0000082C, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_MARISA, 0x0000082D, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GERIK, CHARACTER_NONE, 0x000007FC, }, - { CHARACTER_ENDING_SOLO, CHARACTER_TETHYS, CHARACTER_NONE, 0x000007FE, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EWAN, CHARACTER_AMELIA, 0x00000833, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EWAN, CHARACTER_NONE, 0x00000804, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MARISA, CHARACTER_NONE, 0x00000800, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_SALEH, CHARACTER_EWAN, 0x0000082F, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SALEH, CHARACTER_NONE, 0x00000802, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_MYRRH, CHARACTER_SALEH, 0x0000082E, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MYRRH, CHARACTER_NONE, 0x0000080E, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_EIRIKA, 0x00000817, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_MYRRH, 0x0000081C, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_LARACHEL, 0x0000081D, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_TANA, 0x0000081E, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EPHRAIM, CHARACTER_NONE, 0x000007F2, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SETH, 0x00000818, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SALEH, 0x00000819, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_TANA, 0x0000081A, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_FORDE, 0x0000081B, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_INNES, 0x00000836, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EIRIKA, CHARACTER_NONE, 0x000007D6, }, +struct CharacterEndingEnt CONST_DATA gCharacterEndings_Eirika[] = +{ + { CHARACTER_ENDING_PAIRED, CHARACTER_SETH, CHARACTER_NATASHA, MSG_81F, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SETH, CHARACTER_NONE, MSG_7D8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_FRANZ, CHARACTER_AMELIA, MSG_820, }, + { CHARACTER_ENDING_SOLO, CHARACTER_FRANZ, CHARACTER_NONE, MSG_7DC, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GILLIAM, CHARACTER_SYRENE, MSG_821, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GILLIAM, CHARACTER_NONE, MSG_7DA, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MOULDER, CHARACTER_NONE, MSG_7DE, }, + { CHARACTER_ENDING_SOLO, CHARACTER_VANESSA, CHARACTER_NONE, MSG_7E0, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_ROSS, CHARACTER_AMELIA, MSG_832, }, + { CHARACTER_ENDING_SOLO, CHARACTER_ROSS, CHARACTER_NONE, MSG_7E2, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GARCIA, CHARACTER_ROSS, MSG_824, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GARCIA, CHARACTER_NONE, MSG_7E8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_COLM, CHARACTER_NEIMI, MSG_825, }, + { CHARACTER_ENDING_SOLO, CHARACTER_COLM, CHARACTER_NONE, MSG_7E6, }, + { CHARACTER_ENDING_SOLO, CHARACTER_NEIMI, CHARACTER_NONE, MSG_7E4, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_ARTUR, CHARACTER_LUTE, MSG_826, }, + { CHARACTER_ENDING_SOLO, CHARACTER_ARTUR, CHARACTER_NONE, MSG_7FA, }, + { CHARACTER_ENDING_SOLO, CHARACTER_LUTE, CHARACTER_NONE, MSG_7EC, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_MARISA, MSG_830, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_GERIK, MSG_834, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_NATASHA, MSG_828, }, + { CHARACTER_ENDING_SOLO, CHARACTER_JOSHUA, CHARACTER_NONE, MSG_812, }, + { CHARACTER_ENDING_SOLO, CHARACTER_NATASHA, CHARACTER_NONE, MSG_7EE, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_FORDE, CHARACTER_VANESSA, MSG_823, }, + { CHARACTER_ENDING_SOLO, CHARACTER_FORDE, CHARACTER_NONE, MSG_7F4, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_FORDE, MSG_829, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_SYRENE, MSG_837, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_LUTE, MSG_827, }, + { CHARACTER_ENDING_SOLO, CHARACTER_KYLE, CHARACTER_NONE, MSG_7F6, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_TANA, CHARACTER_CORMAG, MSG_82A, }, + { CHARACTER_ENDING_SOLO, CHARACTER_TANA, CHARACTER_NONE, MSG_816, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_LARACHEL, MSG_82B, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_VANESSA, MSG_822, }, + { CHARACTER_ENDING_SOLO, CHARACTER_INNES, CHARACTER_NONE, MSG_7EA, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_SYRENE, CHARACTER_VANESSA, MSG_835, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SYRENE, CHARACTER_NONE, MSG_814, }, + { CHARACTER_ENDING_SOLO, CHARACTER_AMELIA, CHARACTER_NONE, MSG_7F8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_DUESSEL, CHARACTER_AMELIA, MSG_838, }, + { CHARACTER_ENDING_SOLO, CHARACTER_DUESSEL, CHARACTER_NONE, MSG_80C, }, + { CHARACTER_ENDING_SOLO, CHARACTER_KNOLL, CHARACTER_NONE, MSG_810, }, + { CHARACTER_ENDING_SOLO, CHARACTER_CORMAG, CHARACTER_NONE, MSG_7F0, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_LARACHEL, CHARACTER_DOZLA, MSG_831, }, + { CHARACTER_ENDING_SOLO, CHARACTER_LARACHEL, CHARACTER_NONE, MSG_806, }, + { CHARACTER_ENDING_SOLO, CHARACTER_DOZLA, CHARACTER_NONE, MSG_808, }, + { CHARACTER_ENDING_SOLO, CHARACTER_RENNAC, CHARACTER_NONE, MSG_80A, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_TETHYS, MSG_82C, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_MARISA, MSG_82D, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GERIK, CHARACTER_NONE, MSG_7FC, }, + { CHARACTER_ENDING_SOLO, CHARACTER_TETHYS, CHARACTER_NONE, MSG_7FE, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EWAN, CHARACTER_AMELIA, MSG_833, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EWAN, CHARACTER_NONE, MSG_804, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MARISA, CHARACTER_NONE, MSG_800, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_SALEH, CHARACTER_EWAN, MSG_82F, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SALEH, CHARACTER_NONE, MSG_802, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_MYRRH, CHARACTER_SALEH, MSG_82E, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MYRRH, CHARACTER_NONE, MSG_80E, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_EIRIKA, MSG_817, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_MYRRH, MSG_81C, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_LARACHEL, MSG_81D, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_TANA, MSG_81E, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EPHRAIM, CHARACTER_NONE, MSG_7F2, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SETH, MSG_818, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SALEH, MSG_819, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_TANA, MSG_81A, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_FORDE, MSG_81B, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_INNES, MSG_836, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EIRIKA, CHARACTER_NONE, MSG_7D6, }, { CHARACTER_ENDING_NONE }, }; -struct CharacterEndingEnt CONST_DATA gCharacterEndings_Ephraim[] = { - { CHARACTER_ENDING_PAIRED, CHARACTER_SETH, CHARACTER_NATASHA, 0x0000081F, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SETH, CHARACTER_NONE, 0x000007D8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_FRANZ, CHARACTER_AMELIA, 0x00000820, }, - { CHARACTER_ENDING_SOLO, CHARACTER_FRANZ, CHARACTER_NONE, 0x000007DC, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GILLIAM, CHARACTER_SYRENE, 0x00000821, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GILLIAM, CHARACTER_NONE, 0x000007DA, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MOULDER, CHARACTER_NONE, 0x000007DE, }, - { CHARACTER_ENDING_SOLO, CHARACTER_VANESSA, CHARACTER_NONE, 0x000007E0, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_ROSS, CHARACTER_AMELIA, 0x00000832, }, - { CHARACTER_ENDING_SOLO, CHARACTER_ROSS, CHARACTER_NONE, 0x000007E2, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GARCIA, CHARACTER_ROSS, 0x00000824, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GARCIA, CHARACTER_NONE, 0x000007E8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_COLM, CHARACTER_NEIMI, 0x00000825, }, - { CHARACTER_ENDING_SOLO, CHARACTER_COLM, CHARACTER_NONE, 0x000007E6, }, - { CHARACTER_ENDING_SOLO, CHARACTER_NEIMI, CHARACTER_NONE, 0x000007E4, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_ARTUR, CHARACTER_LUTE, 0x00000826, }, - { CHARACTER_ENDING_SOLO, CHARACTER_ARTUR, CHARACTER_NONE, 0x000007FA, }, - { CHARACTER_ENDING_SOLO, CHARACTER_LUTE, CHARACTER_NONE, 0x000007EC, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_MARISA, 0x00000830, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_GERIK, 0x00000834, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_NATASHA, 0x00000828, }, - { CHARACTER_ENDING_SOLO, CHARACTER_JOSHUA, CHARACTER_NONE, 0x00000812, }, - { CHARACTER_ENDING_SOLO, CHARACTER_NATASHA, CHARACTER_NONE, 0x000007EE, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_FORDE, CHARACTER_VANESSA, 0x00000823, }, - { CHARACTER_ENDING_SOLO, CHARACTER_FORDE, CHARACTER_NONE, 0x000007F4, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_FORDE, 0x00000829, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_SYRENE, 0x00000837, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_LUTE, 0x00000827, }, - { CHARACTER_ENDING_SOLO, CHARACTER_KYLE, CHARACTER_NONE, 0x000007F6, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_TANA, CHARACTER_CORMAG, 0x0000082A, }, - { CHARACTER_ENDING_SOLO, CHARACTER_TANA, CHARACTER_NONE, 0x00000816, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_LARACHEL, 0x0000082B, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_VANESSA, 0x00000822, }, - { CHARACTER_ENDING_SOLO, CHARACTER_INNES, CHARACTER_NONE, 0x000007EA, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_SYRENE, CHARACTER_VANESSA, 0x00000835, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SYRENE, CHARACTER_NONE, 0x00000814, }, - { CHARACTER_ENDING_SOLO, CHARACTER_AMELIA, CHARACTER_NONE, 0x000007F8, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_DUESSEL, CHARACTER_AMELIA, 0x00000838, }, - { CHARACTER_ENDING_SOLO, CHARACTER_DUESSEL, CHARACTER_NONE, 0x0000080C, }, - { CHARACTER_ENDING_SOLO, CHARACTER_KNOLL, CHARACTER_NONE, 0x00000810, }, - { CHARACTER_ENDING_SOLO, CHARACTER_CORMAG, CHARACTER_NONE, 0x000007F0, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_LARACHEL, CHARACTER_DOZLA, 0x00000831, }, - { CHARACTER_ENDING_SOLO, CHARACTER_LARACHEL, CHARACTER_NONE, 0x00000806, }, - { CHARACTER_ENDING_SOLO, CHARACTER_DOZLA, CHARACTER_NONE, 0x00000808, }, - { CHARACTER_ENDING_SOLO, CHARACTER_RENNAC, CHARACTER_NONE, 0x0000080A, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_TETHYS, 0x0000082C, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_MARISA, 0x0000082D, }, - { CHARACTER_ENDING_SOLO, CHARACTER_GERIK, CHARACTER_NONE, 0x000007FC, }, - { CHARACTER_ENDING_SOLO, CHARACTER_TETHYS, CHARACTER_NONE, 0x000007FE, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EWAN, CHARACTER_AMELIA, 0x00000833, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EWAN, CHARACTER_NONE, 0x00000804, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MARISA, CHARACTER_NONE, 0x00000800, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_SALEH, CHARACTER_EWAN, 0x0000082F, }, - { CHARACTER_ENDING_SOLO, CHARACTER_SALEH, CHARACTER_NONE, 0x00000802, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_MYRRH, CHARACTER_SALEH, 0x0000082E, }, - { CHARACTER_ENDING_SOLO, CHARACTER_MYRRH, CHARACTER_NONE, 0x0000080E, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SETH, 0x00000818, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SALEH, 0x00000819, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_TANA, 0x0000081A, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_FORDE, 0x0000081B, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_INNES, 0x00000836, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EIRIKA, CHARACTER_NONE, 0x000007D6, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_EIRIKA, 0x00000817, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_MYRRH, 0x0000081C, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_LARACHEL, 0x0000081D, }, - { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_TANA, 0x0000081E, }, - { CHARACTER_ENDING_SOLO, CHARACTER_EPHRAIM, CHARACTER_NONE, 0x000007F2, }, +struct CharacterEndingEnt CONST_DATA gCharacterEndings_Ephraim[] = +{ + { CHARACTER_ENDING_PAIRED, CHARACTER_SETH, CHARACTER_NATASHA, MSG_81F, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SETH, CHARACTER_NONE, MSG_7D8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_FRANZ, CHARACTER_AMELIA, MSG_820, }, + { CHARACTER_ENDING_SOLO, CHARACTER_FRANZ, CHARACTER_NONE, MSG_7DC, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GILLIAM, CHARACTER_SYRENE, MSG_821, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GILLIAM, CHARACTER_NONE, MSG_7DA, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MOULDER, CHARACTER_NONE, MSG_7DE, }, + { CHARACTER_ENDING_SOLO, CHARACTER_VANESSA, CHARACTER_NONE, MSG_7E0, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_ROSS, CHARACTER_AMELIA, MSG_832, }, + { CHARACTER_ENDING_SOLO, CHARACTER_ROSS, CHARACTER_NONE, MSG_7E2, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GARCIA, CHARACTER_ROSS, MSG_824, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GARCIA, CHARACTER_NONE, MSG_7E8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_COLM, CHARACTER_NEIMI, MSG_825, }, + { CHARACTER_ENDING_SOLO, CHARACTER_COLM, CHARACTER_NONE, MSG_7E6, }, + { CHARACTER_ENDING_SOLO, CHARACTER_NEIMI, CHARACTER_NONE, MSG_7E4, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_ARTUR, CHARACTER_LUTE, MSG_826, }, + { CHARACTER_ENDING_SOLO, CHARACTER_ARTUR, CHARACTER_NONE, MSG_7FA, }, + { CHARACTER_ENDING_SOLO, CHARACTER_LUTE, CHARACTER_NONE, MSG_7EC, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_MARISA, MSG_830, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_GERIK, MSG_834, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_JOSHUA, CHARACTER_NATASHA, MSG_828, }, + { CHARACTER_ENDING_SOLO, CHARACTER_JOSHUA, CHARACTER_NONE, MSG_812, }, + { CHARACTER_ENDING_SOLO, CHARACTER_NATASHA, CHARACTER_NONE, MSG_7EE, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_FORDE, CHARACTER_VANESSA, MSG_823, }, + { CHARACTER_ENDING_SOLO, CHARACTER_FORDE, CHARACTER_NONE, MSG_7F4, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_FORDE, MSG_829, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_SYRENE, MSG_837, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_KYLE, CHARACTER_LUTE, MSG_827, }, + { CHARACTER_ENDING_SOLO, CHARACTER_KYLE, CHARACTER_NONE, MSG_7F6, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_TANA, CHARACTER_CORMAG, MSG_82A, }, + { CHARACTER_ENDING_SOLO, CHARACTER_TANA, CHARACTER_NONE, MSG_816, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_LARACHEL, MSG_82B, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_INNES, CHARACTER_VANESSA, MSG_822, }, + { CHARACTER_ENDING_SOLO, CHARACTER_INNES, CHARACTER_NONE, MSG_7EA, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_SYRENE, CHARACTER_VANESSA, MSG_835, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SYRENE, CHARACTER_NONE, MSG_814, }, + { CHARACTER_ENDING_SOLO, CHARACTER_AMELIA, CHARACTER_NONE, MSG_7F8, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_DUESSEL, CHARACTER_AMELIA, MSG_838, }, + { CHARACTER_ENDING_SOLO, CHARACTER_DUESSEL, CHARACTER_NONE, MSG_80C, }, + { CHARACTER_ENDING_SOLO, CHARACTER_KNOLL, CHARACTER_NONE, MSG_810, }, + { CHARACTER_ENDING_SOLO, CHARACTER_CORMAG, CHARACTER_NONE, MSG_7F0, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_LARACHEL, CHARACTER_DOZLA, MSG_831, }, + { CHARACTER_ENDING_SOLO, CHARACTER_LARACHEL, CHARACTER_NONE, MSG_806, }, + { CHARACTER_ENDING_SOLO, CHARACTER_DOZLA, CHARACTER_NONE, MSG_808, }, + { CHARACTER_ENDING_SOLO, CHARACTER_RENNAC, CHARACTER_NONE, MSG_80A, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_TETHYS, MSG_82C, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_GERIK, CHARACTER_MARISA, MSG_82D, }, + { CHARACTER_ENDING_SOLO, CHARACTER_GERIK, CHARACTER_NONE, MSG_7FC, }, + { CHARACTER_ENDING_SOLO, CHARACTER_TETHYS, CHARACTER_NONE, MSG_7FE, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EWAN, CHARACTER_AMELIA, MSG_833, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EWAN, CHARACTER_NONE, MSG_804, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MARISA, CHARACTER_NONE, MSG_800, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_SALEH, CHARACTER_EWAN, MSG_82F, }, + { CHARACTER_ENDING_SOLO, CHARACTER_SALEH, CHARACTER_NONE, MSG_802, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_MYRRH, CHARACTER_SALEH, MSG_82E, }, + { CHARACTER_ENDING_SOLO, CHARACTER_MYRRH, CHARACTER_NONE, MSG_80E, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SETH, MSG_818, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_SALEH, MSG_819, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_TANA, MSG_81A, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_FORDE, MSG_81B, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EIRIKA, CHARACTER_INNES, MSG_836, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EIRIKA, CHARACTER_NONE, MSG_7D6, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_EIRIKA, MSG_817, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_MYRRH, MSG_81C, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_LARACHEL, MSG_81D, }, + { CHARACTER_ENDING_PAIRED, CHARACTER_EPHRAIM, CHARACTER_TANA, MSG_81E, }, + { CHARACTER_ENDING_SOLO, CHARACTER_EPHRAIM, CHARACTER_NONE, MSG_7F2, }, { CHARACTER_ENDING_NONE }, }; -struct CharacterEndingEnt* CONST_DATA gCharacterEndingsByRoute[] = { +struct CharacterEndingEnt * CONST_DATA gCharacterEndingsByRoute[] = +{ gCharacterEndings_Eirika, gCharacterEndings_Ephraim, }; -struct EndingTitleEnt CONST_DATA gCharacterEndingTitleLut[] = { - { CHARACTER_SETH, 0x000007D7 }, - { CHARACTER_FRANZ, 0x000007DB }, - { CHARACTER_GILLIAM, 0x000007D9 }, - { CHARACTER_MOULDER, 0x000007DD }, - { CHARACTER_VANESSA, 0x000007DF }, - { CHARACTER_ROSS, 0x000007E1 }, - { CHARACTER_GARCIA, 0x000007E7 }, - { CHARACTER_COLM, 0x000007E5 }, - { CHARACTER_NEIMI, 0x000007E3 }, - { CHARACTER_ARTUR, 0x000007F9 }, - { CHARACTER_LUTE, 0x000007EB }, - { CHARACTER_JOSHUA, 0x00000811 }, - { CHARACTER_NATASHA, 0x000007ED }, - { CHARACTER_FORDE, 0x000007F3 }, - { CHARACTER_KYLE, 0x000007F5 }, - { CHARACTER_TANA, 0x00000815 }, - { CHARACTER_INNES, 0x000007E9 }, - { CHARACTER_SYRENE, 0x00000813 }, - { CHARACTER_AMELIA, 0x000007F7 }, - { CHARACTER_DUESSEL, 0x0000080B }, - { CHARACTER_KNOLL, 0x0000080F }, - { CHARACTER_CORMAG, 0x000007EF }, - { CHARACTER_LARACHEL, 0x00000805 }, - { CHARACTER_DOZLA, 0x00000807 }, - { CHARACTER_RENNAC, 0x00000809 }, - { CHARACTER_GERIK, 0x000007FB }, - { CHARACTER_TETHYS, 0x000007FD }, - { CHARACTER_EWAN, 0x00000803 }, - { CHARACTER_MARISA, 0x000007FF }, - { CHARACTER_SALEH, 0x00000801 }, - { CHARACTER_MYRRH, 0x0000080D }, - { CHARACTER_EPHRAIM, 0x000007F1 }, - { CHARACTER_EIRIKA, 0x000007D5 }, +struct EndingTitleEnt CONST_DATA gCharacterEndingTitleLut[] = +{ + { CHARACTER_SETH, MSG_7D7 }, + { CHARACTER_FRANZ, MSG_7DB }, + { CHARACTER_GILLIAM, MSG_7D9 }, + { CHARACTER_MOULDER, MSG_7DD }, + { CHARACTER_VANESSA, MSG_7DF }, + { CHARACTER_ROSS, MSG_7E1 }, + { CHARACTER_GARCIA, MSG_7E7 }, + { CHARACTER_COLM, MSG_7E5 }, + { CHARACTER_NEIMI, MSG_7E3 }, + { CHARACTER_ARTUR, MSG_7F9 }, + { CHARACTER_LUTE, MSG_7EB }, + { CHARACTER_JOSHUA, MSG_811 }, + { CHARACTER_NATASHA, MSG_7ED }, + { CHARACTER_FORDE, MSG_7F3 }, + { CHARACTER_KYLE, MSG_7F5 }, + { CHARACTER_TANA, MSG_815 }, + { CHARACTER_INNES, MSG_7E9 }, + { CHARACTER_SYRENE, MSG_813 }, + { CHARACTER_AMELIA, MSG_7F7 }, + { CHARACTER_DUESSEL, MSG_80B }, + { CHARACTER_KNOLL, MSG_80F }, + { CHARACTER_CORMAG, MSG_7EF }, + { CHARACTER_LARACHEL, MSG_805 }, + { CHARACTER_DOZLA, MSG_807 }, + { CHARACTER_RENNAC, MSG_809 }, + { CHARACTER_GERIK, MSG_7FB }, + { CHARACTER_TETHYS, MSG_7FD }, + { CHARACTER_EWAN, MSG_803 }, + { CHARACTER_MARISA, MSG_7FF }, + { CHARACTER_SALEH, MSG_801 }, + { CHARACTER_MYRRH, MSG_80D }, + { CHARACTER_EPHRAIM, MSG_7F1 }, + { CHARACTER_EIRIKA, MSG_7D5 }, { CHARACTER_NONE }, }; -struct EndingDefeatEnt CONST_DATA gCharacterEndingDefeatLut[] = { +struct EndingDefeatEnt CONST_DATA gCharacterEndingDefeatLut[] = +{ { CHARACTER_EIRIKA, DEFEAT_DIED, }, { CHARACTER_EPHRAIM, DEFEAT_DIED, }, { CHARACTER_SETH, DEFEAT_WOUNDED_REMAINED, }, @@ -251,67 +262,70 @@ struct EndingDefeatEnt CONST_DATA gCharacterEndingDefeatLut[] = { { CHARACTER_NONE }, }; -u16 * CONST_DATA gSoloEndingBattleDispConf[] = { +u16 * CONST_DATA gSoloEndingBattleDispConf[] = +{ gEndingTmScratchA, gEndingTmScratchB, gEndingTmScratchC, gEndingTmScratchD, }; -extern struct Text gEndingDetailTexts[]; -struct Text* gUnknown_08A3D358 = gEndingDetailTexts; - -// forward declarations -void StartSoloEndingBattleDisplay(struct CharacterEndingEnt*, struct Unit*, struct CharacterEndingProc*); -void StartPairedEndingBattleDisplay(struct CharacterEndingEnt*, struct Unit*, struct Unit*, struct CharacterEndingProc*); -void StartEndingBattleText(struct CharacterEndingEnt*, struct Unit*, struct Unit*, struct CharacterEndingProc*); -void EndEndingBattleText(void); +struct Text * CONST_DATA gpCharacterEndingTexts = gEndingDetailTexts; //! FE8U = 0x080B6674 -char* PrepareUnitDefeatLocationString(u16 textIdA, u16 defeatedChapter, u16 textIdB, char* str) { - const char* locationStr; +char * PrepareUnitDefeatLocationString(u16 textIdA, u16 defeatDetails, u16 textIdB, char * str) +{ + const char * locationStr; u8 count = 0; str = AppendString(GetStringFromIndex(textIdA), str); - str = AppendCharacter(1, str); + str = AppendCharacter(CHFE_L_NL, str); - if (defeatedChapter & 0x8000) { - defeatedChapter &= 0x7FFF; - locationStr = GetWorldMapNodeName(defeatedChapter); - } else { - const s8* it; // TODO: should this be char*? + if (IsSkirmishDefeat(defeatDetails)) + { + defeatDetails = GetDefeatLocation(defeatDetails); + locationStr = GetWorldMapNodeName(defeatDetails); + } + else + { + const signed char * it; - defeatedChapter &= 0x7FFF; + defeatDetails = GetDefeatLocation(defeatDetails); - for (it = GetStringFromIndex(GetROMChapterStruct(defeatedChapter)->chapTitleTextId); *it != 0; it++) { - if (*it != 0x21) { + for (it = GetStringFromIndex(GetROMChapterStruct(defeatDetails)->chapTitleTextId); *it != CHFE_L_X; it++) + { + if (*it != '!') + { continue; } - if (*(it+1) != 0x00) { + if (*(it + 1) != CHFE_L_X) + { continue; } count++; } - locationStr = GetStringFromIndex(GetROMChapterStruct(defeatedChapter)->chapTitleTextId); + locationStr = GetStringFromIndex(GetROMChapterStruct(defeatDetails)->chapTitleTextId); } str = AppendString(locationStr, str); - str = AppendString(GetStringFromIndex(textIdB) + count, str); return str; } //! FE8U = 0x080B6720 -int GetPidTitleTextId(int pid) { - struct EndingTitleEnt* ent; - - for (ent = gCharacterEndingTitleLut; ent->pid != 0; ent++) { - if (ent->pid == pid) { +int GetPidTitleTextId(int pid) +{ + struct EndingTitleEnt * ent; + + for (ent = gCharacterEndingTitleLut; ent->pid != 0; ent++) + { + if (ent->pid == pid) + { return ent->titleTextId; } } @@ -320,42 +334,48 @@ int GetPidTitleTextId(int pid) { } //! FE8U = 0x080B6744 -int GetPidDefeatType(int pid) { - struct EndingDefeatEnt* ent; - - for (ent = gCharacterEndingDefeatLut; ent->pid != 0; ent++) { - if (ent->pid == pid) { +int GetPidDefeatType(int pid) +{ + struct EndingDefeatEnt * ent; + + for (ent = gCharacterEndingDefeatLut; ent->pid != 0; ent++) + { + if (ent->pid == pid) + { return ent->defeatType; } } - return 0; + return DEFEAT_DIED; } //! FE8U = 0x080B6768 -char* GetPidDefeatedEndingString(int pid) { - struct UnitUsageStats* bwl; +char * GetPidDefeatedEndingString(int pid) +{ + struct UnitUsageStats * bwl; int defeatDetails; - char* str = gpDefeatedEndingLocString; + char * str = gpDefeatedEndingLocString; int type = GetPidDefeatType(pid); - if (type == DEFEAT_TYPE_4) { + if (type == DEFEAT_TYPE_4) + { CheckPermanentFlag(0x7d); pid = 0x100; } bwl = GetPidStats(pid); - defeatDetails = bwl->deathLoc | (bwl->deathSkirm << 0xf); + defeatDetails = SetDefeatDetails(bwl->deathLoc, bwl->deathSkirm); - switch (type) { + switch (type) + { case DEFEAT_DIED: // "Died at ." - PrepareUnitDefeatLocationString(0x7D1, defeatDetails, 0x22, str); + PrepareUnitDefeatLocationString(MSG_7D1, defeatDetails, MSG_022, str); break; case DEFEAT_WOUNDED_REMAINED: // Wounded at , but remained until the end." - PrepareUnitDefeatLocationString(0x7D3, defeatDetails, 0x7D4, str); + PrepareUnitDefeatLocationString(MSG_7D3, defeatDetails, MSG_7D4, str); break; case DEFEAT_TYPE_5: @@ -366,70 +386,76 @@ char* GetPidDefeatedEndingString(int pid) { } //! FE8U = 0x080B67E8 -void SetupCharacterEndingGfx(void) { - Decompress(gGfx_CharacterEndingMenu, (void *)0x06004C00); - Decompress(Img_CommGameBgScreen, (void *)0x06008000); +void SetupCharacterEndingGfx(void) +{ + Decompress(Img_CharacterEndingMenu, BG_CHR_ADDR(0x260)); + Decompress(Img_CommGameBgScreen, BG_CHR_ADDR(0x400)); return; } //! FE8U = 0x080B6810 -void sub_80B6810(void) { +void sub_80B6810(void) +{ int offset; int i; u16 * tm; - ApplyPalettes(gPal_CharacterEndingMenu, 0xC, 2); - ApplyPalettes(Pal_CommGameBgScreenInShop, 0xE, 2); + ApplyPalettes(Pal_CharacterEndingMenu, 12, 2); + ApplyPalettes(Pal_CommGameBgScreenInShop, 14, 2); tm = gBG3TilemapBuffer; - offset = (((0x8000 - (u32)GetBackgroundTileDataOffset(3)) * 0x8000) >> 0x14) + 0xe000; + offset = (((0x8000 - (u32)GetBackgroundTileDataOffset(BG_3)) * 0x8000) >> 0x14) + 0xe000; for (i = 0; i < 0x280; i++) { *tm++ = i + offset; } - CallARM_FillTileRect(gBG2TilemapBuffer, gUnknown_08A3FFEC, 0x0000C260); - - CallARM_FillTileRect(gBG2TilemapBuffer + 0x240, gUnknown_08A40068, 0x0000C260); + CallARM_FillTileRect(gBG2TilemapBuffer, Tsa_CharacterEnding_TopBorder, TILEREF(0x260, 12)); + CallARM_FillTileRect(gBG2TilemapBuffer + TILEMAP_INDEX(0, 18), Tsa_CharacterEnding_BottomBorder, TILEREF(0x260, 12)); - BG_EnableSyncByMask(0xc); + BG_EnableSyncByMask(BG2_SYNC_BIT | BG3_SYNC_BIT); return; } //! FE8U = 0x080B689C -void sub_80B689C(int a, int b) { +void sub_80B689C(int a, int b) +{ BG_Fill(gBG1TilemapBuffer, 0); - sub_80AC844(gSoloEndingBattleDispConf[2], 0, 1, 2, a, b + 2, 0x1e, 0x10); - sub_80AC844(gSoloEndingBattleDispConf[1], 0, 1, 1, a, b + 2, 0x1e, 0x12); - sub_80AC844(gSoloEndingBattleDispConf[0], 0, 0, 0, a, b, 0x1e, 0x14); + sub_80AC844(gSoloEndingBattleDispConf[2], 0, 1, BG_2, a, b + 2, 30, 16); + sub_80AC844(gSoloEndingBattleDispConf[1], 0, 1, BG_1, a, b + 2, 30, 18); + sub_80AC844(gSoloEndingBattleDispConf[0], 0, 0, BG_0, a, b, 30, 20); - BG_EnableSyncByMask(7); + BG_EnableSyncByMask(BG0_SYNC_BIT | BG1_SYNC_BIT | BG2_SYNC_BIT); return; } //! FE8U = 0x080B6920 -void sub_80B6920(void) { +void InitCharacterEndingText(void) +{ int i; ResetText(); - for (i = 0; i < 2; i++) { - InitText(gUnknown_08A3D358 + 5 + i, 15); - InitText(gUnknown_08A3D358 + 7 + i, 10); + for (i = 0; i < 2; i++) + { + InitText(gpCharacterEndingTexts + 5 + i, 15); + InitText(gpCharacterEndingTexts + 7 + i, 10); } - for (i = 0; i < 5; i++) { - InitText(gUnknown_08A3D358 + i, 26); + for (i = 0; i < 5; i++) + { + InitText(gpCharacterEndingTexts + i, 26); } return; } //! FE8U = 0x080B696C -void CharacterEnding_Init(struct CharacterEndingProc* proc) { +void CharacterEnding_Init(struct CharacterEndingProc * proc) +{ SetupBackgrounds(NULL); ResetFaces(); SetupCharacterEndingGfx(); @@ -437,26 +463,28 @@ void CharacterEnding_Init(struct CharacterEndingProc* proc) { proc->unk_2e = 0; - CpuFill16(0, proc->unk_40, sizeof(proc->unk_40)); + CpuFill16(0, proc->pidShownFlags, sizeof(proc->pidShownFlags)); - switch (gPlaySt.chapterModeIndex) { + switch (gPlaySt.chapterModeIndex) + { case CHAPTER_MODE_COMMON: case CHAPTER_MODE_EIRIKA: - proc->unk_30 = gCharacterEndingsByRoute[0]; + proc->pCharacterEnding = gCharacterEndingsByRoute[0]; break; case CHAPTER_MODE_EPHRAIM: - proc->unk_30 = gCharacterEndingsByRoute[1]; + proc->pCharacterEnding = gCharacterEndingsByRoute[1]; break; } - proc->unk_34 = proc->unk_30; + proc->pCharacterEndingBkp = proc->pCharacterEnding; return; } //! FE8U = 0x080B69D4 -void sub_80B69D4(void) { +void CharacterEnding_80B69D4(void) +{ BG_Fill(gBG0TilemapBuffer, 0); BG_Fill(gBG1TilemapBuffer, 0); BG_Fill(gBG2TilemapBuffer, 0); @@ -466,27 +494,32 @@ void sub_80B69D4(void) { EndEndingBattleText(); sub_80B6810(); - BG_EnableSyncByMask(7); + BG_EnableSyncByMask(BG0_SYNC_BIT | BG1_SYNC_BIT | BG2_SYNC_BIT); return; } //! FE8U = 0x080B6A10 -struct Unit* sub_80B6A10(int pid) { +struct Unit * GetUnitForCharacterEnding(int pid) +{ int i; - for (i = FACTION_BLUE + 1; i < FACTION_GREEN; i++) { - struct Unit* unit = GetUnit(i); + for (i = FACTION_BLUE + 1; i < FACTION_GREEN; i++) + { + struct Unit * unit = GetUnit(i); - if (!UNIT_IS_VALID(unit)) { + if (!UNIT_IS_VALID(unit)) + { continue; } - if (unit->pCharacterData->number != pid) { + if (unit->pCharacterData->number != pid) + { continue; } - if (unit->state & US_BIT16) { + if (unit->state & US_BIT16) + { return NULL; } @@ -497,15 +530,19 @@ struct Unit* sub_80B6A10(int pid) { } //! FE8U = 0x080B6A4C -int GetUnitASupporterPid(struct Unit* unit) { +int GetUnitASupporterPid(struct Unit * unit) +{ int i; - if (unit == NULL) { + if (unit == NULL) + { return 0; } - for (i = 0; i < UNIT_SUPPORT_MAX_COUNT; i++) { - if (GetUnitSupportLevel(unit, i) == SUPPORT_LEVEL_A) { + for (i = 0; i < UNIT_SUPPORT_MAX_COUNT; i++) + { + if (GetUnitSupportLevel(unit, i) == SUPPORT_LEVEL_A) + { return GetUnitSupporterCharacter(unit, i); } } @@ -514,114 +551,136 @@ int GetUnitASupporterPid(struct Unit* unit) { } //! FE8U = 0x080B6A80 -s8 DoesUnitHavePairedEnding(struct CharacterEndingEnt* pairingEnt, struct Unit* unit) { +bool DoesUnitHavePairedEnding(struct CharacterEndingEnt * pairingEnt, struct Unit * unit) +{ int pidA = unit->pCharacterData->number; int pidB = GetUnitASupporterPid(unit); - if (pidB == 0) { - return 0; + if (pidB == 0) + { + return false; } - if (GetUnitFromCharId(pidA)->state & US_DEAD) { - return 0; + if (GetUnitFromCharId(pidA)->state & US_DEAD) + { + return false; } - if (GetUnitFromCharId(pidB)->state & US_DEAD) { - return 0; + if (GetUnitFromCharId(pidB)->state & US_DEAD) + { + return false; } - for (; pairingEnt->pidA != 0; pairingEnt++) { - if (pairingEnt->pidA == pidA && pairingEnt->pidB == pidB) { - return 1; + for (; pairingEnt->pidA != 0; pairingEnt++) + { + if (pairingEnt->pidA == pidA && pairingEnt->pidB == pidB) + { + return true; } - if (pairingEnt->pidA == pidB && pairingEnt->pidB == pidA) { - return 1; + if (pairingEnt->pidA == pidB && pairingEnt->pidB == pidA) + { + return true; } } - return 0; + return false; } //! FE8U = 0x080B6AE0 -void LoadNextCharacterEnding(struct CharacterEndingProc* proc) { +void LoadNextCharacterEnding(struct CharacterEndingProc * proc) +{ proc->unitB = NULL; proc->unitA = NULL; - for (;; proc->unk_30++) { - if (proc->unk_30->type == CHARACTER_ENDING_NONE) { + for (;; proc->pCharacterEnding++) + { + if (proc->pCharacterEnding->type == CHARACTER_ENDING_NONE) + { Proc_Goto(proc, 100); return; } - if ((*&proc->unk_40[proc->unk_30->pidA >> 5] >> (proc->unk_30->pidA & 0x1f)) & 1) { + if ((*&proc->pidShownFlags[proc->pCharacterEnding->pidA >> 5] >> (proc->pCharacterEnding->pidA & 0x1f)) & 1) + { continue; } - if (proc->unk_30->pidB != 0) { - if ((*&proc->unk_40[proc->unk_30->pidB >> 5] >> (proc->unk_30->pidB & 0x1f)) & 1) { + if (proc->pCharacterEnding->pidB != 0) + { + if ((*&proc->pidShownFlags[proc->pCharacterEnding->pidB >> 5] >> (proc->pCharacterEnding->pidB & 0x1f)) & 1) + { continue; } } - proc->unitA = sub_80B6A10(proc->unk_30->pidA); + proc->unitA = GetUnitForCharacterEnding(proc->pCharacterEnding->pidA); - if (proc->unitA == NULL) { + if (proc->unitA == NULL) + { continue; } - switch (proc->unk_30->type) { + switch (proc->pCharacterEnding->type) + { case CHARACTER_ENDING_SOLO: - if (DoesUnitHavePairedEnding(proc->unk_34, proc->unitA)) { + if (DoesUnitHavePairedEnding(proc->pCharacterEndingBkp, proc->unitA)) + { continue; } break; case CHARACTER_ENDING_PAIRED: - proc->unitB = sub_80B6A10(proc->unk_30->pidB); + proc->unitB = GetUnitForCharacterEnding(proc->pCharacterEnding->pidB); - if (proc->unitB == NULL) { + if (proc->unitB == NULL) + { continue; } - if (GetUnitASupporterPid(proc->unitA) != proc->unk_30->pidB) { + if (GetUnitASupporterPid(proc->unitA) != proc->pCharacterEnding->pidB) + { continue; } - if (proc->unitA->state & US_DEAD) { + if (proc->unitA->state & US_DEAD) + { continue; } - if (proc->unitB->state & US_DEAD) { + if (proc->unitB->state & US_DEAD) + { continue; } break; } - *&proc->unk_40[(proc->unk_30->pidA >> 5)] |= 1 << (proc->unk_30->pidA & 0x1f); + *&proc->pidShownFlags[(proc->pCharacterEnding->pidA >> 5)] |= 1 << (proc->pCharacterEnding->pidA & 0x1f); - if (proc->unk_30->pidB == 0) { + if (proc->pCharacterEnding->pidB == 0) + { return; } - *&proc->unk_40[proc->unk_30->pidB >> 5] |= 1 << (proc->unk_30->pidB & 0x1f); + *&proc->pidShownFlags[proc->pCharacterEnding->pidB >> 5] |= 1 << (proc->pCharacterEnding->pidB & 0x1f); return; } } //! FE8U = 0x080B6BD8 -void CharacterEnding_StartBattleDisplay(struct CharacterEndingProc* proc) { - - switch (proc->unk_30->type) { +void CharacterEnding_StartBattleDisplay(struct CharacterEndingProc * proc) +{ + switch (proc->pCharacterEnding->type) + { case CHARACTER_ENDING_SOLO: - StartSoloEndingBattleDisplay(proc->unk_30, proc->unitA, proc); + StartSoloEndingBattleDisplay(proc->pCharacterEnding, proc->unitA, proc); break; case CHARACTER_ENDING_PAIRED: - StartPairedEndingBattleDisplay(proc->unk_30, proc->unitA, proc->unitB, proc); + StartPairedEndingBattleDisplay(proc->pCharacterEnding, proc->unitA, proc->unitB, proc); break; } @@ -629,49 +688,52 @@ void CharacterEnding_StartBattleDisplay(struct CharacterEndingProc* proc) { } //! FE8U = 0x080B6C00 -void CharacterEnding_StartBattleDisplayText(struct CharacterEndingProc* proc) { - StartEndingBattleText(proc->unk_30, proc->unitA, proc->unitB, proc); +void CharacterEnding_StartBattleDisplayText(struct CharacterEndingProc * proc) +{ + StartEndingBattleText(proc->pCharacterEnding, proc->unitA, proc->unitB, proc); return; } //! FE8U = 0x080B6C14 -void CharacterEnding_End(void) { +void CharacterEnding_End(void) +{ SetupBackgrounds(NULL); ResetDialogueScreen(); EndEndingBattleText(); - SetBlendConfig(3, 0, 0, 0x10); - + SetBlendDarken(0x10); SetBlendTargetA(1, 1, 1, 1, 1); SetBlendTargetB(0, 0, 0, 0, 0); - gLCDControlBuffer.dispcnt.bg0_on = 1; - gLCDControlBuffer.dispcnt.bg1_on = 1; - gLCDControlBuffer.dispcnt.bg2_on = 1; - gLCDControlBuffer.dispcnt.bg3_on = 1; - gLCDControlBuffer.dispcnt.obj_on = 1; + SetDispEnable(1, 1, 1, 1, 1); return; } //! FE8U = 0x080B6C74 -void CharacterEnding_Unused_80B6C74(struct CharacterEndingProc* proc) { - proc->unk_30++; +void CharacterEnding_Unused_80B6C74(struct CharacterEndingProc * proc) +{ + proc->pCharacterEnding++; - if (proc->unk_30->type == CHARACTER_ENDING_NONE) { + if (proc->pCharacterEnding->type == CHARACTER_ENDING_NONE) + { Proc_Goto(proc, 100); } return; } -struct ProcCmd CONST_DATA gProcScr_CharacterEndings[] = { - PROC_SLEEP(0), +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_CharacterEndings[] = +{ + PROC_YIELD, + PROC_CALL(CharacterEnding_Init), PROC_CALL(LoadNextCharacterEnding), PROC_LABEL(0), - PROC_CALL(sub_80B69D4), + PROC_CALL(CharacterEnding_80B69D4), PROC_CALL_ARG(NewFadeIn, 4), PROC_WHILE(FadeInExists), @@ -700,22 +762,28 @@ PROC_LABEL(100), PROC_END, }; +// clang-format on + //! FE8U = 0x080B6C94 -void StartCharacterEndings(ProcPtr parent) { +void StartCharacterEndings(ProcPtr parent) +{ Proc_StartBlocking(gProcScr_CharacterEndings, parent); return; } //! FE8U = 0x080B6CA8 -void sub_80B6CA8(struct EndingBattleDisplayProc* proc) { +void CharacterEnding_LoadUnitBattleStats(struct EndingBattleDisplayProc * proc) +{ int i; - for (i = 0; i < 2; i++) { - struct UnitUsageStats* bwl; + for (i = 0; i < 2; i++) + { + struct UnitUsageStats * bwl; - struct Unit* unit = proc->units[i]; + struct Unit * unit = proc->units[i]; - if (unit == NULL) { + if (unit == NULL) + { continue; } @@ -730,87 +798,102 @@ void sub_80B6CA8(struct EndingBattleDisplayProc* proc) { } //! FE8U = 0x080B6D24 -void SoloEndingBattleDisp_Init(struct EndingBattleDisplayProc* proc) { - const char* str; +void SoloEndingBattleDisp_Init(struct EndingBattleDisplayProc * proc) +{ + const char * str; - sub_80B6920(); + InitCharacterEndingText(); - sub_80B6CA8(proc); + CharacterEnding_LoadUnitBattleStats(proc); BG_Fill(gSoloEndingBattleDispConf[0], 0); BG_Fill(gSoloEndingBattleDispConf[1], 0); BG_Fill(gSoloEndingBattleDispConf[2], 0); Decompress(gTsa_SoloEndingWindow, gGenericBuffer); - CallARM_FillTileRect(gSoloEndingBattleDispConf[2], gGenericBuffer, 0x0000C260); + CallARM_FillTileRect(gSoloEndingBattleDispConf[2], gGenericBuffer, TILEREF(0x260, 12)); Decompress(gTsa_SoloEndingNameplate, gGenericBuffer); - CallARM_FillTileRect(gSoloEndingBattleDispConf[1], gGenericBuffer, 0x0000C260); + CallARM_FillTileRect(gSoloEndingBattleDispConf[1], gGenericBuffer, TILEREF(0x260, 12)); str = GetStringFromIndex(GetPidTitleTextId(proc->pCharacterEnding->pidA)); - PutDrawText(gUnknown_08A3D358 + 5, gSoloEndingBattleDispConf[0] + 0x61, 0, GetStringTextCenteredPos(0x78, str), 0, str); + PutDrawText(gpCharacterEndingTexts + 5, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 3), TEXT_COLOR_SYSTEM_WHITE, GetStringTextCenteredPos(120, str), 0, str); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x31, 3, 0, 0, GetStringFromIndex(0x51F)); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x31, 3, 0x20, 0, GetStringFromIndex(0x520)); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x31, 3, 0x40, 0, GetStringFromIndex(0x521)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_51F)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 32, 0, GetStringFromIndex(MSG_520)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 64, 0, GetStringFromIndex(MSG_521)); - PutNumber(gSoloEndingBattleDispConf[0] + 0x31 + CountDigits(proc->battleAmounts[0]), 2, proc->battleAmounts[0]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x35 + CountDigits(proc->winAmounts[0]), 2, proc->winAmounts[0]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x39 + CountDigits(proc->lossAmounts[0]), 2, proc->lossAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1) + CountDigits(proc->battleAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->battleAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(21, 1) + CountDigits(proc->winAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->winAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(25, 1) + CountDigits(proc->lossAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->lossAmounts[0]); - StartFace2(0, gCharacterData[proc->pCharacterEnding->pidA - 1].portraitId, 0x1a0, 0x38, 0x502); + StartFace2(0, gCharacterData[proc->pCharacterEnding->pidA - 1].portraitId, 416, 56, FACE_DISP_KIND(FACE_96x80) | FACE_DISP_HLAYER(4) | FACE_DISP_BLEND); - if (proc->units[0]->state & US_DEAD) { + if (proc->units[0]->state & US_DEAD) + { ArchivePalette(0x16); WriteFadedPaletteFromArchive(0xc0, 0xc0, 0xc0, 0x400000); } - proc->unk_34 = 0; + proc->timer = 0; SetDefaultColorEffects(); return; } -u8 CONST_DATA gUnknown_08A3D40C[] = { - 0x00, 0x03, 0x06, 0x08, 0x0A, - 0x0C, 0x0E, 0x10, 0x12, 0x14, - 0x15, 0x16, 0x17, 0x18, 0x19, - 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, +// clang-format off + +u8 CONST_DATA gCharEndingSlideOffsetLut[] = +{ + 0, 3, 6, 8, 10, + 12, 14, 16, 18, 20, + 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, }; +// clang-format on + //! FE8U = 0x080B6ED0 -void SoloEndingBattleDisp_Loop(struct EndingBattleDisplayProc* proc) { - int a = 30; +void SoloEndingBattleDisp_Loop(struct EndingBattleDisplayProc * proc) +{ + int xBase = 30; - int b = gUnknown_08A3D40C[proc->unk_34]; - proc->unk_34++; + int xOffset = gCharEndingSlideOffsetLut[proc->timer]; + proc->timer++; - a -= b; + xBase -= xOffset; - sub_8006618(0, (a * 8 + 176) & 0x1FF, 0x38); + SetFacePosition(0, (xBase * 8 + 176) & 0x1FF, 56); - sub_80B689C(a, 0); + sub_80B689C(xBase, 0); - if (b == 30) { + if (xOffset == 30) + { Proc_Break(proc); } return; } -struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Solo[] = { - PROC_SLEEP(0), - PROC_CALL(SoloEndingBattleDisp_Init), +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Solo[] = +{ + PROC_YIELD, + PROC_CALL(SoloEndingBattleDisp_Init), PROC_REPEAT(SoloEndingBattleDisp_Loop), PROC_END, }; +// clang-format on + //! FE8U = 0x080B6F14 -void StartSoloEndingBattleDisplay(struct CharacterEndingEnt* endingEnt, struct Unit* unit, struct CharacterEndingProc* parent) { - struct EndingBattleDisplayProc* proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Solo, parent); +void StartSoloEndingBattleDisplay(struct CharacterEndingEnt * endingEnt, struct Unit * unit, struct CharacterEndingProc * parent) +{ + struct EndingBattleDisplayProc * proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Solo, parent); proc->units[0] = unit; proc->units[1] = NULL; @@ -821,71 +904,73 @@ void StartSoloEndingBattleDisplay(struct CharacterEndingEnt* endingEnt, struct U } //! FE8U = 0x080B6F34 -void sub_80B6F34(struct EndingBattleDisplayProc* proc) { - const char* str; +void PairedEndingBattleDisp_Init(struct EndingBattleDisplayProc * proc) +{ + const char * str; - sub_80B6920(); + InitCharacterEndingText(); - sub_80B6CA8(proc); + CharacterEnding_LoadUnitBattleStats(proc); BG_Fill(gSoloEndingBattleDispConf[0], 0); BG_Fill(gSoloEndingBattleDispConf[1], 0); BG_Fill(gSoloEndingBattleDispConf[2], 0); Decompress(gTsa_PairedEndingWindow, gGenericBuffer); - CallARM_FillTileRect(gSoloEndingBattleDispConf[2], gGenericBuffer, 0x0000C260); + CallARM_FillTileRect(gSoloEndingBattleDispConf[2], gGenericBuffer, TILEREF(0x260, 12)); Decompress(gTsa_PairedEndingNameplates, gGenericBuffer); - CallARM_FillTileRect(gSoloEndingBattleDispConf[1], gGenericBuffer, 0x0000C260); + CallARM_FillTileRect(gSoloEndingBattleDispConf[1], gGenericBuffer, TILEREF(0x260, 12)); str = GetStringFromIndex(GetPidTitleTextId(proc->pCharacterEnding->pidA)); + PutDrawText(gpCharacterEndingTexts + 5, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 3), TEXT_COLOR_SYSTEM_WHITE, GetStringTextCenteredPos(120, str), 0, str); - PutDrawText(gUnknown_08A3D358 + 5, gSoloEndingBattleDispConf[0] + 0x61, 0, GetStringTextCenteredPos(0x78, str), 0, str); + PutDrawText(gpCharacterEndingTexts + 7, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_51F)); + PutDrawText(gpCharacterEndingTexts + 7, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 32, 0, GetStringFromIndex(MSG_520)); + PutDrawText(gpCharacterEndingTexts + 7, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1), TEXT_COLOR_SYSTEM_GOLD, 64, 0, GetStringFromIndex(MSG_521)); - PutDrawText(gUnknown_08A3D358 + 7, gSoloEndingBattleDispConf[0] + 0x31, 3, 0, 0, GetStringFromIndex(0x51F)); - PutDrawText(gUnknown_08A3D358 + 7, gSoloEndingBattleDispConf[0] + 0x31, 3, 0x20, 0, GetStringFromIndex(0x520)); - PutDrawText(gUnknown_08A3D358 + 7, gSoloEndingBattleDispConf[0] + 0x31, 3, 0x40, 0, GetStringFromIndex(0x521)); - - PutNumber(gSoloEndingBattleDispConf[0] + 0x31 + CountDigits(proc->battleAmounts[0]), 2, proc->battleAmounts[0]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x35 + CountDigits(proc->winAmounts[0]), 2, proc->winAmounts[0]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x39 + CountDigits(proc->lossAmounts[0]), 2, proc->lossAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(17, 1) + CountDigits(proc->battleAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->battleAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(21, 1) + CountDigits(proc->winAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->winAmounts[0]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(25, 1) + CountDigits(proc->lossAmounts[0]), TEXT_COLOR_SYSTEM_BLUE, proc->lossAmounts[0]); str = GetStringFromIndex(GetPidTitleTextId(proc->pCharacterEnding->pidB)); - PutDrawText(gUnknown_08A3D358 + 6, gSoloEndingBattleDispConf[0] + 0x22E, 0, GetStringTextCenteredPos(0x78, str), 0, str); + PutDrawText(gpCharacterEndingTexts + 6, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(14, 17), TEXT_COLOR_SYSTEM_WHITE, GetStringTextCenteredPos(120, str), 0, str); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x221, 3, 0, 0, GetStringFromIndex(0x51F)); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x221, 3, 0x20, 0, GetStringFromIndex(0x520)); - PutDrawText(gUnknown_08A3D358 + 8, gSoloEndingBattleDispConf[0] + 0x221, 3, 0x40, 0, GetStringFromIndex(0x521)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 17), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_51F)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 17), TEXT_COLOR_SYSTEM_GOLD, 32, 0, GetStringFromIndex(MSG_520)); + PutDrawText(gpCharacterEndingTexts + 8, gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 17), TEXT_COLOR_SYSTEM_GOLD, 64, 0, GetStringFromIndex(MSG_521)); - PutNumber(gSoloEndingBattleDispConf[0] + 0x221 + CountDigits(proc->battleAmounts[1]), 2, proc->battleAmounts[1]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x225 + CountDigits(proc->winAmounts[1]), 2, proc->winAmounts[1]); - PutNumber(gSoloEndingBattleDispConf[0] + 0x229 + CountDigits(proc->lossAmounts[1]), 2, proc->lossAmounts[1]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(1, 17) + CountDigits(proc->battleAmounts[1]), TEXT_COLOR_SYSTEM_BLUE, proc->battleAmounts[1]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(5, 17) + CountDigits(proc->winAmounts[1]), TEXT_COLOR_SYSTEM_BLUE, proc->winAmounts[1]); + PutNumber(gSoloEndingBattleDispConf[0] + TILEMAP_INDEX(9, 17) + CountDigits(proc->lossAmounts[1]), TEXT_COLOR_SYSTEM_BLUE, proc->lossAmounts[1]); - proc->unk_34 = 0; + proc->timer = 0; SetDefaultColorEffects(); - StartFace2(0, gCharacterData[proc->pCharacterEnding->pidA - 1].portraitId, 0x130, 0x30, 0x503); - StartFace2(1, gCharacterData[proc->pCharacterEnding->pidB - 1].portraitId, 0x1a0, 0x30, 0x502); + StartFace2(0, gCharacterData[proc->pCharacterEnding->pidA - 1].portraitId, 304, 48, FACE_DISP_KIND(FACE_96x80_FLIPPED) | FACE_DISP_FLIPPED | FACE_DISP_HLAYER(4) | FACE_DISP_BLEND); + StartFace2(1, gCharacterData[proc->pCharacterEnding->pidB - 1].portraitId, 416, 48, FACE_DISP_KIND(FACE_96x80) | FACE_DISP_HLAYER(4) | FACE_DISP_BLEND); return; } //! FE8U = 0x080B71DC -void sub_80B71DC(struct EndingBattleDisplayProc* proc) { - int a = 30; +void PairedEndingBattleDisp_Loop_SlideIn(struct EndingBattleDisplayProc * proc) +{ + int xBase = 30; - int b = gUnknown_08A3D40C[proc->unk_34]; - proc->unk_34++; + int xOffset = gCharEndingSlideOffsetLut[proc->timer]; + proc->timer++; - a -= b; + xBase -= xOffset; - sub_8006618(0, (a * 8 + 0x40) & 0x1FF, 0x30); - sub_8006618(1, (a * 8 + 0xb0) & 0x1FF, 0x30); + SetFacePosition(0, (xBase * 8 + 64) & 0x1FF, 48); + SetFacePosition(1, (xBase * 8 + 176) & 0x1FF, 48); - sub_80B689C(a, 0); + sub_80B689C(xBase, 0); - if (b == 30) { + if (xOffset == 30) + { Proc_Break(proc); } @@ -893,11 +978,11 @@ void sub_80B71DC(struct EndingBattleDisplayProc* proc) { } //! FE8U = 0x080B723C -void sub_80B723C(struct EndingBattleDisplayProc* proc) { - proc->unk_34 = 0; - - SetBlendConfig(1, 0x10, 0, 0); +void PairedEndingBattleDisp_InitBlend(struct EndingBattleDisplayProc * proc) +{ + proc->timer = 0; + SetBlendAlpha(0x10, 0); SetBlendTargetA(0, 0, 0, 0, 0); SetBlendTargetB(0, 0, 1, 0, 0); @@ -905,36 +990,45 @@ void sub_80B723C(struct EndingBattleDisplayProc* proc) { } //! FE8U = 0x080B7274 -void sub_80B7274(struct EndingBattleDisplayProc* proc) { - int var = proc->unk_34 >> 2; +void PairedEndingBattleDisp_Loop_Blend(struct EndingBattleDisplayProc * proc) +{ + int bldAmt = proc->timer >> 2; - proc->unk_34++; + proc->timer++; - SetBlendConfig(1, 0x10 - var, var, 0); + SetBlendAlpha(0x10 - bldAmt, bldAmt); - if (var == 8) { + if (bldAmt == 8) + { Proc_Break(proc); } + return; } -struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Paired[] = { - PROC_SLEEP(0), +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Paired[] = +{ + PROC_YIELD, - PROC_CALL(sub_80B6F34), - PROC_REPEAT(sub_80B71DC), + PROC_CALL(PairedEndingBattleDisp_Init), + PROC_REPEAT(PairedEndingBattleDisp_Loop_SlideIn), PROC_SLEEP(16), - PROC_CALL(sub_80B723C), - PROC_REPEAT(sub_80B7274), + PROC_CALL(PairedEndingBattleDisp_InitBlend), + PROC_REPEAT(PairedEndingBattleDisp_Loop_Blend), PROC_END, }; +// clang-format on + //! FE8U = 0x080B72A4 -void StartPairedEndingBattleDisplay(struct CharacterEndingEnt* endingEnt, struct Unit* unitA, struct Unit* unitB, struct CharacterEndingProc* parent) { - struct EndingBattleDisplayProc* proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Paired, parent); +void StartPairedEndingBattleDisplay(struct CharacterEndingEnt * endingEnt, struct Unit * unitA, struct Unit * unitB, struct CharacterEndingProc * parent) +{ + struct EndingBattleDisplayProc * proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Paired, parent); proc->units[0] = unitA; proc->units[1] = unitB; @@ -945,30 +1039,34 @@ void StartPairedEndingBattleDisplay(struct CharacterEndingEnt* endingEnt, struct } //! FE8U = 0x080B72C4 -void EndingBattleInitText(struct EndingBattleTextProc* proc) { +void EndingBattleInitText(struct EndingBattleTextProc * proc) +{ int i; - proc->Text = gUnknown_08A3D358; + proc->text = gpCharacterEndingTexts; proc->defaultPauseDelay = 4; proc->pauseTimer = 4; - Text_SetCursor(proc->Text, 0); - Text_SetColor(proc->Text, 0); + Text_SetCursor(proc->text, 0); + Text_SetColor(proc->text, TEXT_COLOR_SYSTEM_WHITE); - for (i = 0; i < 5; i++) { - int offset = 0xc0 + i * 0x40; + for (i = 0; i < 5; i++) + { + int y = TILEMAP_INDEX(0, 6 + i * 2); - ClearText(gUnknown_08A3D358 + i); - PutText(gUnknown_08A3D358 + i, gBG0TilemapBuffer + 2 + offset); + ClearText(gpCharacterEndingTexts + i); + PutText(gpCharacterEndingTexts + i, gBG0TilemapBuffer + 2 + y); } - BG_EnableSyncByMask(1); + BG_EnableSyncByMask(BG0_SYNC_BIT); - if (proc->unitA->state & US_DEAD) { + if (proc->unitA->state & US_DEAD) + { proc->str = GetPidDefeatedEndingString(proc->unitA->pCharacterData->number); - if (proc->str != 0) { + if (proc->str != NULL) + { return; } } @@ -979,63 +1077,67 @@ void EndingBattleInitText(struct EndingBattleTextProc* proc) { } //! FE8U = 0x080B734C -void EndingBattleText_Loop(struct EndingBattleTextProc* proc) { - if ((gKeyStatusPtr->newKeys & START_BUTTON) && (CheckGameEndFlag() != 0)) { +void EndingBattleText_Loop(struct EndingBattleTextProc * proc) +{ + if ((gKeyStatusPtr->newKeys & START_BUTTON) && (CheckGameEndFlag() != 0)) + { Proc_Break(proc); Proc_Goto(proc->proc_parent, 100); return; } - if (proc->pauseTimer != 0) { + if (proc->pauseTimer != 0) + { proc->pauseTimer--; return; } SetTextFont(NULL); - switch (*proc->str) { - case 0x00: // [X] + switch (*proc->str) + { + case CHFE_L_X: // [X] Proc_Break(proc); break; - case 0x01: // [NL] + case CHFE_L_NL: // [NL] proc->str++; - proc->Text++; + proc->text++; proc->pauseTimer += 16; - Text_SetCursor(proc->Text, 0); - Text_SetColor(proc->Text, 0); + Text_SetCursor(proc->text, 0); + Text_SetColor(proc->text, 0); break; - case 0x04: // [....] + case CHFE_L_Pause8: // [....] proc->pauseTimer = 8; proc->str++; break; - case 0x05: // [.....] + case CHFE_L_Pause16: // [.....] proc->pauseTimer = 16; proc->str++; break; - case 0x06: // [......] + case CHFE_L_Pause32: // [......] proc->pauseTimer = 32; proc->str++; break; - case 0x07: // [.......] + case CHFE_L_Pause64: // [.......] proc->pauseTimer = 64; proc->str++; break; - case 0x02: // [NL2] - case 0x03: // [A] + case CHFE_L_2NL: // [NL2] + case CHFE_L_A: // [A] default: - proc->str = Text_DrawCharacter(proc->Text, proc->str); + proc->str = Text_DrawCharacter(proc->text, proc->str); } // TODO: Is this a bug? Seems to overwrite any pauses with the default delay of 4 frames... @@ -1044,17 +1146,24 @@ void EndingBattleText_Loop(struct EndingBattleTextProc* proc) { return; } -struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Text[] = { - PROC_SLEEP(0), +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_EndingBattleDisplay_Text[] = +{ + PROC_YIELD, + PROC_CALL(EndingBattleInitText), PROC_REPEAT(EndingBattleText_Loop), PROC_END, }; +// clang-format on + //! FE8U = 0x080B742C -void StartEndingBattleText(struct CharacterEndingEnt* pairingEnt, struct Unit* unitA, struct Unit* unitB, struct CharacterEndingProc* parent) { - struct EndingBattleTextProc* proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Text, parent); +void StartEndingBattleText(struct CharacterEndingEnt * pairingEnt, struct Unit * unitA, struct Unit * unitB, struct CharacterEndingProc * parent) +{ + struct EndingBattleTextProc * proc = Proc_StartBlocking(gProcScr_EndingBattleDisplay_Text, parent); proc->pCharacterEnding = pairingEnt; proc->unitA = unitA; proc->unitB = unitB; @@ -1063,45 +1172,49 @@ void StartEndingBattleText(struct CharacterEndingEnt* pairingEnt, struct Unit* u } //! FE8U = 0x080B744C -void EndEndingBattleText(void) { +void EndEndingBattleText(void) +{ Proc_EndEach(gProcScr_EndingBattleDisplay_Text); return; } //! FE8U = 0x080B745C -void SetupFinScreenGfx(void) { - ApplyPalette(gPal_FinScreen, 0xE); +void SetupFinScreenGfx(void) +{ + ApplyPalette(Pal_FinScreen, 14); - Decompress(gGfx_FinScreen, (void *)0x06001000); + Decompress(Img_FinScreen, BG_CHR_ADDR(0x80)); + Decompress(Tsa_FinScreen, gGenericBuffer); + CallARM_FillTileRect(gBG2TilemapBuffer, gGenericBuffer, TILEREF(0x80, 14)); - Decompress(gTsa_FinScreen, gGenericBuffer); - CallARM_FillTileRect(gBG2TilemapBuffer, gGenericBuffer, 0x0000E080); - - BG_EnableSyncByMask(4); + BG_EnableSyncByMask(BG2_SYNC_BIT); return; } //! FE8U = 0x080B74B0 -void Fin_Init(struct FinScreenProc* proc) { - proc->unk_4c = 0; - proc->unk_58 = 0; +void Fin_Init(struct FinScreenProc * proc) +{ + proc->blendTimer = 0; + proc->timer = 0; - SetupBackgrounds(0); + SetupBackgrounds(NULL); SetupFinScreenGfx(); - StartBgmFadeIn(0x56, 7, 0); + StartBgmFadeIn(SONG_BGM_ED_STAFF_2, 7, 0); SetDefaultColorEffects(); return; } //! FE8U = 0x080B74D8 -void Fin_Loop_KeyListener(struct FinScreenProc* proc) { - proc->unk_58++; +void Fin_Loop_KeyListener(struct FinScreenProc * proc) +{ + proc->timer++; - if (gKeyStatusPtr->newKeys & (A_BUTTON | START_BUTTON)) { + if (gKeyStatusPtr->newKeys & (A_BUTTON | START_BUTTON)) + { Proc_Break(proc); } @@ -1109,12 +1222,13 @@ void Fin_Loop_KeyListener(struct FinScreenProc* proc) { } //! FE8U = 0x080B7500 -void sub_80B7500(struct FinScreenProc* proc) { - SetBlendConfig(1, 0, 0x10, 0); +void sub_80B7500(struct FinScreenProc * proc) +{ + SetBlendAlpha(0, 0x10); SetBlendTargetA(0, 0, 1, 0, 0); SetBlendTargetB(0, 0, 0, 1, 0); - proc->unk_4c = 0; + proc->blendTimer = 0; SetupFinScreenGfx(); @@ -1122,31 +1236,37 @@ void sub_80B7500(struct FinScreenProc* proc) { } //! FE8U = 0x080B7540 -void sub_80B7540(struct FinScreenProc* proc) { - int b; +void sub_80B7540(struct FinScreenProc * proc) +{ + int blendAmt; - s16 a = proc->unk_4c; - proc->unk_4c++; + s16 timer = proc->blendTimer; + proc->blendTimer++; - b = a >> 2; - SetBlendConfig(1, b, 0x10, 0); + blendAmt = timer >> 2; + SetBlendAlpha(blendAmt, 0x10); - if (b == 16) { + if (blendAmt == 16) + { Proc_Break(proc); - proc->unk_4c = 0; + proc->blendTimer = 0; } return; } //! FE8U = 0x080B7574 -void Fin_End(void) { - SetBlendConfig(3, 0, 0, 0x10); +void Fin_End(void) +{ + SetBlendDarken(0x10); SetBlendTargetA(1, 1, 1, 1, 1); return; } -struct ProcCmd CONST_DATA gProcScr_FinScreen[] = { +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_FinScreen[] = +{ PROC_SLEEP(30), PROC_CALL(Fin_Init), @@ -1181,127 +1301,153 @@ PROC_LABEL(100), PROC_END, }; +// clang-format on + //! FE8U = 0x080B7598 -void StartFinScreen(ProcPtr parent) { +void StartFinScreen(ProcPtr parent) +{ Proc_StartBlocking(gProcScr_FinScreen, parent); return; } // === TODO: File split here? +// clang-format off + // Sprites -u16 CONST_DATA gUnknown_08A3D540[] = { +u16 CONST_DATA Sprite_08A3D540[] = +{ 5, - 0x4000, 0x8000, 0x0000, - 0x4000, 0x8020, 0x0004, - 0x4000, 0x8040, 0x0008, - 0x4000, 0x8060, 0x000C, - 0x8000, 0x0080, 0x0010, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, 0, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x4), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(64), OAM2_CHR(0x8), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(96), OAM2_CHR(0xC), + OAM0_SHAPE_8x16, OAM1_SIZE_8x16 + OAM1_X(128), OAM2_CHR(0x10), }; -u16 CONST_DATA gUnknown_08A3D560[] = { +u16 CONST_DATA Sprite_08A3D560[] = +{ 2, - 0x4000, 0x8000, 0x0040, - 0x4000, 0x8020, 0x0044, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x40), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x44), }; -u16 CONST_DATA gUnknown_08A3D56E[] = { +u16 CONST_DATA Sprite_08A3D56E[] = +{ 2, - 0x4000, 0x8000, 0x0048, - 0x4000, 0x8020, 0x004C, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x48), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x4C), }; -u16 CONST_DATA gUnknown_08A3D57C[] = { +u16 CONST_DATA Sprite_08A3D57C[] = +{ 2, - 0x4000, 0x8000, 0x0050, - 0x4000, 0x8020, 0x0054, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x50), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x54), }; -u16 CONST_DATA gUnknown_08A3D58A[] = { +u16 CONST_DATA Sprite_08A3D58A[] = +{ 2, - 0x4000, 0x8000, 0x0058, - 0x4000, 0x8020, 0x005C, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x58), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x5C), }; -u16 CONST_DATA gUnknown_08A3D598[] = { +u16 CONST_DATA Sprite_08A3D598[] = +{ 2, - 0x4000, 0x8000, 0x0088, - 0x4000, 0x8020, 0x008C, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x88), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x8C), }; -u16 CONST_DATA gUnknown_08A3D5A6[] = { +u16 CONST_DATA Sprite_08A3D5A6[] = +{ 2, - 0x4000, 0x8000, 0x0080, - 0x4000, 0x8020, 0x0084, + OAM0_SHAPE_32x16, OAM1_SIZE_32x16, OAM2_CHR(0x80), + OAM0_SHAPE_32x16, OAM1_SIZE_32x16 + OAM1_X(32), OAM2_CHR(0x84), }; -u16 CONST_DATA gUnknown_08A3D5B4[] = { +u16 CONST_DATA Sprite_08A3D5B4[] = +{ 2, - 0x4000, 0x4000, 0x001B, - 0x0000, 0x0020, 0x001F, + OAM0_SHAPE_32x8, OAM1_SIZE_32x8, OAM2_CHR(0x1B), + OAM0_SHAPE_8x8, OAM1_SIZE_8x8 + OAM1_X(32), OAM2_CHR(0x1F), }; -u16 CONST_DATA gSprite_08A3D5C2[] = { +u16 CONST_DATA gSprite_08A3D5C2[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xC0), }; -u16 CONST_DATA gSprite_08A3D5CA[] = { +u16 CONST_DATA gSprite_08A3D5CA[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xC4), }; -u16 CONST_DATA gSprite_08A3D5D2[] = { +u16 CONST_DATA gSprite_08A3D5D2[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xC8), }; -u16 CONST_DATA gSprite_08A3D5DA[] = { +u16 CONST_DATA gSprite_08A3D5DA[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xCC), }; -u16 CONST_DATA gSprite_08A3D5E2[] = { +u16 CONST_DATA gSprite_08A3D5E2[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xD0), }; -u16 CONST_DATA gSprite_08A3D5EA[] = { +u16 CONST_DATA gSprite_08A3D5EA[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0xD4), }; -u16 CONST_DATA gSprite_08A3D5F2[] = { +u16 CONST_DATA gSprite_08A3D5F2[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x140), }; -u16 CONST_DATA gSprite_08A3D5FA[] = { +u16 CONST_DATA gSprite_08A3D5FA[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x144), }; -u16 CONST_DATA gSprite_08A3D602[] = { +u16 CONST_DATA gSprite_08A3D602[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x148), }; -u16 CONST_DATA gSprite_08A3D60A[] = { +u16 CONST_DATA gSprite_08A3D60A[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x14C), }; -u16 CONST_DATA gSprite_08A3D612[] = { +u16 CONST_DATA gSprite_08A3D612[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x150), }; -u16 CONST_DATA gSprite_08A3D61A[] = { +u16 CONST_DATA gSprite_08A3D61A[] = +{ 1, OAM0_SHAPE_32x32, OAM1_SIZE_32x32, OAM2_CHR(0x154), }; -u16* CONST_DATA gUnknown_08A3D624[] = { +u16 * CONST_DATA SpriteArray_08A3D624[] = +{ gSprite_08A3D5EA, gSprite_08A3D5E2, gSprite_08A3D5DA, @@ -1310,7 +1456,8 @@ u16* CONST_DATA gUnknown_08A3D624[] = { gSprite_08A3D5C2, }; -u16* CONST_DATA gUnknown_08A3D63C[] = { +u16 * CONST_DATA SpriteArray_08A3D63C[] = +{ gSprite_08A3D61A, gSprite_08A3D612, gSprite_08A3D60A, @@ -1319,20 +1466,19 @@ u16* CONST_DATA gUnknown_08A3D63C[] = { gSprite_08A3D5F2, }; +// clang-format on + //! FE8U = 0x080B75AC -void sub_80B75AC(struct EndingTurnRecordProc* proc) { - gLCDControlBuffer.dispcnt.bg0_on = 1; - gLCDControlBuffer.dispcnt.bg1_on = 1; - gLCDControlBuffer.dispcnt.bg2_on = 0; - gLCDControlBuffer.dispcnt.bg3_on = 1; - gLCDControlBuffer.dispcnt.obj_on = 1; +void sub_80B75AC(struct EndingTurnRecordProc * proc) +{ + SetDispEnable(1, 1, 0, 1, 1); - ApplyPalette(gUnknown_08A09A5C, 5); + ApplyPalette(Pal_PlayerRankFog, 5); - Decompress(Img_ChapterIntroFog, (void *)0x06004000); - CallARM_FillTileRect(gBG2TilemapBuffer, gUnknown_085A647C, 0x5200); + Decompress(Img_ChapterIntroFog, BG_CHR_ADDR(0x200)); + CallARM_FillTileRect(gBG2TilemapBuffer, Tsa_PlayerRankFog, TILEREF(0x200, 5)); - BG_EnableSyncByMask(4); + BG_EnableSyncByMask(BG2_SYNC_BIT); proc->unk_4c = 0; @@ -1340,7 +1486,8 @@ void sub_80B75AC(struct EndingTurnRecordProc* proc) { } //! FE8U = 0x080B7614 -void sub_80B7614(struct EndingTurnRecordProc* proc) { +void sub_80B7614(struct EndingTurnRecordProc * proc) +{ int x; int y; @@ -1349,238 +1496,247 @@ void sub_80B7614(struct EndingTurnRecordProc* proc) { y = proc->unk_4c; x = y * 3; - BG_SetPosition(2, x / 8, y / 4); + BG_SetPosition(BG_2, x / 8, y / 4); return; } -struct ProcCmd CONST_DATA gProcScr_08A3D654[] = { - PROC_SLEEP(0), +// clang-format off + +struct ProcCmd CONST_DATA gProcScr_08A3D654[] = +{ + PROC_YIELD, + PROC_CALL(sub_80B75AC), PROC_REPEAT(sub_80B7614), PROC_END, }; +// clang-format on + //! FE8U = 0x080B7648 -void sub_80B7648(struct EndingTurnRecordProc* proc) { - proc->unk_30 = 0; - proc->unk_34 = 32; - proc->unk_39 = 0; - proc->unk_2c = 0; - proc->unk_38 = GetNextChapterStatsSlot(); - - gLCDControlBuffer.dispcnt.bg0_on = 0; - gLCDControlBuffer.dispcnt.bg1_on = 0; - gLCDControlBuffer.dispcnt.bg2_on = 0; - gLCDControlBuffer.dispcnt.bg3_on = 0; - gLCDControlBuffer.dispcnt.obj_on = 0; +void TurnRecord_Init(struct EndingTurnRecordProc * proc) +{ + proc->yPos = 0; + proc->yScrollAmt = 32; + proc->displayId = 0; + proc->chapterId = 0; + proc->chapterStatsIdx = GetNextChapterStatsSlot(); - SetPrimaryHBlankHandler(NULL); + SetDispEnable(0, 0, 0, 0, 0); - SetupBackgrounds(0); + SetPrimaryHBlankHandler(NULL); + SetupBackgrounds(NULL); // ?? - gLCDControlBuffer.dispcnt.bg0_on = 0; - gLCDControlBuffer.dispcnt.bg1_on = 0; - gLCDControlBuffer.dispcnt.bg2_on = 0; - gLCDControlBuffer.dispcnt.bg3_on = 0; - gLCDControlBuffer.dispcnt.obj_on = 0; + SetDispEnable(0, 0, 0, 0, 0); SetDefaultColorEffects(); ResetText(); - gLCDControlBuffer.dispcnt.win0_on = 0; - gLCDControlBuffer.dispcnt.win1_on = 0; - gLCDControlBuffer.dispcnt.objWin_on = 0; + SetWinEnable(0, 0, 0); - ApplyPalettes(gUnknown_08A40AD4, 0xE, 2); - CallARM_FillTileRect(gBG3TilemapBuffer, gUnknown_08A40B14, 0xe000); + ApplyPalettes(Pal_08A40AD4, 14, 2); + CallARM_FillTileRect(gBG3TilemapBuffer, Tsa_08A40B14, TILEREF(0, 14)); - BG_EnableSyncByMask(8); + BG_EnableSyncByMask(BG3_SYNC_BIT); return; } -struct Text* CONST_DATA gpEndingDetailTexts = gEndingDetailTexts; +struct Text * CONST_DATA gpTurnRecordTexts = gEndingDetailTexts; //! FE8U = 0x080B770C -void sub_80B770C(void) { +void TurnRecord_SetupText(void) +{ int i; - BG_SetPosition(1, 0, -136); - - gLCDControlBuffer.dispcnt.win0_on = 1; - gLCDControlBuffer.dispcnt.win1_on = 0; - gLCDControlBuffer.dispcnt.objWin_on = 0; - - gLCDControlBuffer.win0_left = 0; - gLCDControlBuffer.win0_top = 24; - gLCDControlBuffer.win0_right = 240; - gLCDControlBuffer.win0_bottom = 136; + BG_SetPosition(BG_1, 0, -136); - gLCDControlBuffer.wincnt.win0_enableBg0 = 1; - gLCDControlBuffer.wincnt.win0_enableBg1 = 1; - gLCDControlBuffer.wincnt.win0_enableBg2 = 1; - gLCDControlBuffer.wincnt.win0_enableBg3 = 1; - gLCDControlBuffer.wincnt.win0_enableObj = 1; + SetWinEnable(1, 0, 0); + SetWin0Box(0, 24, 240, 136); + SetWin0Layers(1, 1, 1, 1, 1); + SetWOutLayers(0, 0, 1, 1, 1); - gLCDControlBuffer.wincnt.wout_enableBg0 = 0; - gLCDControlBuffer.wincnt.wout_enableBg1 = 0; - gLCDControlBuffer.wincnt.wout_enableBg2 = 1; - gLCDControlBuffer.wincnt.wout_enableBg3 = 1; - gLCDControlBuffer.wincnt.wout_enableObj = 1; - - for (i = 0; i < 9; i++) { - InitText(gpEndingDetailTexts + i, 5); - InitText(gpEndingDetailTexts + 9 + i, 13); + for (i = 0; i < 9; i++) + { + InitText(gpTurnRecordTexts + 0 + i, 5); + InitText(gpTurnRecordTexts + 9 + i, 13); } - InitText(gpEndingDetailTexts + 18, 4); - InitText(gpEndingDetailTexts + 19, 2); + InitText(gpTurnRecordTexts + 18, 4); + InitText(gpTurnRecordTexts + 19, 2); - Text_DrawString(gpEndingDetailTexts + 18, GetStringFromIndex(0x15D)); + Text_DrawString(gpTurnRecordTexts + 18, GetStringFromIndex(MSG_15D)); - Text_SetColor(gpEndingDetailTexts + 19, 3); - Text_DrawString(gpEndingDetailTexts + 19, GetStringFromIndex(0x157)); + Text_SetColor(gpTurnRecordTexts + 19, TEXT_COLOR_SYSTEM_GOLD); + Text_DrawString(gpTurnRecordTexts + 19, GetStringFromIndex(MSG_157)); return; } //! FE8U = 0x080B7800 -int sub_80B7800(struct ChapterStats* param_1, int param_2) { - int var = 3; - int r4; +int HandleTurnRecordText(struct ChapterStats * chapterStats, int displayId) +{ int r6; - int r7; - int uVar10; - int r9; - int sl; - int sp0C; - s8 sp10 = 0; + int y; + int chapterTurn; + int textIndex; + + int x = 3; + s8 chapterIncrement = 0; // Number of chapters to advance over in caller func - sp0C = param_2 % 9; - r7 = (param_2 * 2) & 0x1f; - r6 = r7 * 0x20; + textIndex = displayId % 9; + y = (displayId * 2) & 0x1f; + r6 = y * 0x20; - TileMap_FillRect(gBG1TilemapBuffer + TILEMAP_INDEX(0, r7), 0x1f, 1, 0); - BG_EnableSyncByMask(2); + TileMap_FillRect(gBG1TilemapBuffer + TILEMAP_INDEX(0, y), 31, 1, 0); + BG_EnableSyncByMask(BG1_SYNC_BIT); - ClearText(gpEndingDetailTexts + sp0C); - ClearText(gpEndingDetailTexts + 9 + sp0C); + ClearText(gpTurnRecordTexts + 0 + textIndex); + ClearText(gpTurnRecordTexts + 9 + textIndex); - if ((u32)param_1 == -1) { - r4 = GetGameTotalTurnCount(); + if ((u32)chapterStats == -1) + { + int gameTotalTurns = GetGameTotalTurnCount(); - PutDrawText(gpEndingDetailTexts + 9 + sp0C, gBG1TilemapBuffer + ({r6 + 0xC;}), 3, 0, 0, GetStringFromIndex(0x15f)); - PutNumber(gBG1TilemapBuffer + ({r6 + 0x17;}), 2, r4); - PutText(gpEndingDetailTexts + 18, gBG1TilemapBuffer + ({r6 + 0x18;})); + PutDrawText(gpTurnRecordTexts + 9 + textIndex, gBG1TilemapBuffer + ({r6 + 0xC;}), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_15F)); + PutNumber(gBG1TilemapBuffer + ({r6 + 0x17;}), TEXT_COLOR_SYSTEM_BLUE, gameTotalTurns); + PutText(gpTurnRecordTexts + 18, gBG1TilemapBuffer + ({r6 + 0x18;})); return 0; } - if (param_1) { - sl = param_1->chapter_index; - r9 = GetROMChapterStruct(sl)->prepScreenNumber >> 1; - switch (sl) { - case 0: - PutDrawText(gpEndingDetailTexts + sp0C, gBG1TilemapBuffer + TILEMAP_INDEX(var, r7), 3, 0, 0, GetStringFromIndex(0x15a)); // TODO: msgid "Prologue" + if (chapterStats) + { + int chapterIndex = chapterStats->chapter_index; + int r9 = GetROMChapterStruct(chapterIndex)->prepScreenNumber >> 1; + + switch (chapterIndex) + { + case CHAPTER_L_PROLOGUE: + PutDrawText(gpTurnRecordTexts + textIndex, gBG1TilemapBuffer + TILEMAP_INDEX(x, y), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_15A)); // TODO: msgid "Prologue" break; - case 21: - case 22: - case 34: - case 35: - PutDrawText(gpEndingDetailTexts + sp0C, gBG1TilemapBuffer + TILEMAP_INDEX(var, r7), 3, 0, 0, GetStringFromIndex(0x159)); // TODO: msgid "Final[.]" + case CHAPTER_E_21: + case CHAPTER_E_21X: + case CHAPTER_I_21: + case CHAPTER_I_21X: + PutDrawText(gpTurnRecordTexts + textIndex, gBG1TilemapBuffer + TILEMAP_INDEX(x, y), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_159)); // TODO: msgid "Final[.]" break; - case 5: - PutText(gpEndingDetailTexts + 0x13, gBG1TilemapBuffer + TILEMAP_INDEX(var, r7)); - PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (1 + var), r7), 2, r9); - PutDrawText(gpEndingDetailTexts + sp0C, gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (2 + var), r7), 2, 0, 0, GetStringFromIndex(0x158)); + case CHAPTER_L_5X: + PutText(gpTurnRecordTexts + 19, gBG1TilemapBuffer + TILEMAP_INDEX(x, y)); + PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (1 + x), y), TEXT_COLOR_SYSTEM_BLUE, r9); + PutDrawText(gpTurnRecordTexts + textIndex, gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (2 + x), y), TEXT_COLOR_SYSTEM_BLUE, 0, 0, GetStringFromIndex(MSG_158)); break; default: - PutDrawText(gpEndingDetailTexts + sp0C, gBG1TilemapBuffer + TILEMAP_INDEX(var, r7), 3, 0, 0, GetStringFromIndex(0x0157)); - PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (1 + var), r7), 2, r9); + PutDrawText(gpTurnRecordTexts + textIndex, gBG1TilemapBuffer + TILEMAP_INDEX(x, y), TEXT_COLOR_SYSTEM_GOLD, 0, 0, GetStringFromIndex(MSG_157)); + PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(CountDigits(r9) + (1 + x), y), TEXT_COLOR_SYSTEM_BLUE, r9); break; } - switch (sl) { - case 21: - case 22: - case 34: - case 35: - uVar10 = param_1->chapter_turn; - ++param_1; - uVar10 += param_1->chapter_turn; - sp10 = 1; + switch (chapterIndex) + { + case CHAPTER_E_21: + case CHAPTER_E_21X: + case CHAPTER_I_21: + case CHAPTER_I_21X: + // Compute the combined total turn count for both parts of final chapter + chapterTurn = chapterStats->chapter_turn; + ++chapterStats; + chapterTurn += chapterStats->chapter_turn; + chapterIncrement = 1; break; default: - uVar10 = param_1->chapter_turn; + chapterTurn = chapterStats->chapter_turn; break; } - PutDrawText(gpEndingDetailTexts + 9 + sp0C, gBG1TilemapBuffer + TILEMAP_INDEX(5 + var, r7), 0, 0, 0, GetStringFromIndex(GetROMChapterStruct(sl)->chapTitleTextId)); - PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(0x14 + var, r7), 2, uVar10); - PutText(gpEndingDetailTexts + 18, gBG1TilemapBuffer + TILEMAP_INDEX(0x15 + var, r7)); + PutDrawText(gpTurnRecordTexts + 9 + textIndex, gBG1TilemapBuffer + TILEMAP_INDEX(5 + x, y), TEXT_COLOR_SYSTEM_WHITE, 0, 0, GetStringFromIndex(GetROMChapterStruct(chapterIndex)->chapTitleTextId)); + PutNumber(gBG1TilemapBuffer + TILEMAP_INDEX(20 + x, y), TEXT_COLOR_SYSTEM_BLUE, chapterTurn); + PutText(gpTurnRecordTexts + 18, gBG1TilemapBuffer + TILEMAP_INDEX(21 + x, y)); } - return sp10; + return chapterIncrement; } //! FE8U = 0x080B7B30 -void sub_80B7B30(struct EndingTurnRecordProc* proc) { - int pos = proc->unk_30 >> 6; - - BG_SetPosition(1, 0, pos - 136); - - if ((pos & 0xf) == 0) { - if (proc->unk_39 == (pos / 16)) { - if (proc->unk_2c >= proc->unk_38) { - int unk = proc->unk_2c - proc->unk_38; - - if (unk == 1) { - sub_80B7800((void *)-1, proc->unk_39); - } else if (unk >= 3) { +void TurnRecord_Loop_Main(struct EndingTurnRecordProc * proc) +{ + int y = proc->yPos >> 6; + + BG_SetPosition(BG_1, 0, y - 136); + + if ((y & 15) == 0) + { + if (proc->displayId == (y / 16)) + { + if (proc->chapterId >= proc->chapterStatsIdx) + { + int unk = proc->chapterId - proc->chapterStatsIdx; + + if (unk == 1) + { + HandleTurnRecordText((void *)-1, proc->displayId); + } + else if (unk >= 3) + { Proc_Break(proc); - } else { - sub_80B7800(NULL, proc->unk_39); } - } else { - proc->unk_2c += sub_80B7800(GetChapterStats(proc->unk_2c), proc->unk_39); + else + { + HandleTurnRecordText(NULL, proc->displayId); + } + } + else + { + proc->chapterId += HandleTurnRecordText(GetChapterStats(proc->chapterId), proc->displayId); } - proc->unk_2c++; - proc->unk_39++; + proc->chapterId++; + proc->displayId++; } } - if (gKeyStatusPtr->heldKeys & A_BUTTON) { - proc->unk_30 += proc->unk_34; + if (gKeyStatusPtr->heldKeys & A_BUTTON) + { + // Double scrolling speed if holding the A Button + proc->yPos += proc->yScrollAmt; } - proc->unk_30 += proc->unk_34; + proc->yPos += proc->yScrollAmt; return; } +/** + * Unused / unrelated to this file. Appears to be leftover from FE6/FE7. + * Seems to be used in a parallel worker proc for drawing the "Player Rank" + * sprites in FE6. + */ //! FE8U = 0x080B7BD8 -void sub_80B7BD8(struct UnkProc* proc) { +void sub_80B7BD8(struct UnkProc * proc) +{ int i; - PutSpriteExt(2, 0x18, 0x14, gUnknown_08A3D540, 0x9480); - PutSpriteExt(2, 0x10, 0x80, gUnknown_08A3D5B4, 0x6480); + PutSpriteExt(2, 24, 20, Sprite_08A3D540, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(9)); + PutSpriteExt(2, 16, 128, Sprite_08A3D5B4, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(6)); - if (gPlaySt.chapterStateBits & PLAY_FLAG_EXTRA_MAP) { - PutSpriteExt(2, 0x10, 0x38, gUnknown_08A3D560, 0x8480); - PutSpriteExt(2, 0x80, 0x38, gUnknown_08A3D56E, 0x8480); - PutSpriteExt(2, 0x10, 0x58, gUnknown_08A3D58A, 0x8480); - PutSpriteExt(2, 0x80, 0x58, gUnknown_08A3D5A6, 0x7480); + if (gPlaySt.chapterStateBits & PLAY_FLAG_EXTRA_MAP) + { + PutSpriteExt(2, 16, 56, Sprite_08A3D560, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 128, 56, Sprite_08A3D56E, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 16, 88, Sprite_08A3D58A, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 128, 88, Sprite_08A3D5A6, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(7)); - for (i = 0; i < 3; i++) { - if (proc->unk_4c[i] > 0x10) { + for (i = 0; i < 3; i++) + { + if (proc->unk_4c[i] > 0x10) + { SetObjAffine( i, Div(+COS(0) * 16, proc->unk_4c[i]), @@ -1591,15 +1747,16 @@ void sub_80B7BD8(struct UnkProc* proc) { PutSpriteExt( 2, - (i & 1) * 0x70 + 0x50 + i * 0x200, - (i >> 1) * 0x20 + 0x130, - gUnknown_08A3D624[proc->unk_40[i]], - ((i + 10) & 0xf) * 0x1000 + 0x480 + (i & 1) * 112 + 80 + i * 512, + (i >> 1) * 32 + 304, + SpriteArray_08A3D624[proc->unk_40[i]], + OAM2_PAL(i + 10) + OAM2_CHR(0x80) + OAM2_LAYER(1) ); } } - if (proc->unk_4c[i] > 0x10) { + if (proc->unk_4c[i] > 0x10) + { SetObjAffine( i, Div(+COS(0) * 16, proc->unk_4c[i]), @@ -1607,24 +1764,29 @@ void sub_80B7BD8(struct UnkProc* proc) { Div(+SIN(0) * 16, proc->unk_4c[i]), Div(+COS(0) * 16, 0x100) ); + PutSpriteExt( 2, - (i & 1) * 0x70 + 0x50 + i * 0x200, - (i >> 1) * 0x20 + 0x130, - gUnknown_08A3D63C[proc->unk_40[i]], - 0xF480 + (i & 1) * 112 + 80 + i * 512, + (i >> 1) * 32 + 304, + SpriteArray_08A3D63C[proc->unk_40[i]], + OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(15) ); } - } else { - PutSpriteExt(2, 0x10, 0x30, gUnknown_08A3D560, 0x8480); - PutSpriteExt(2, 0x80, 0x30, gUnknown_08A3D56E, 0x8480); - PutSpriteExt(2, 0x10, 0x48, gUnknown_08A3D598, 0x8480); - PutSpriteExt(2, 0x80, 0x48, gUnknown_08A3D57C, 0x8480); - PutSpriteExt(2, 0x10, 0x60, gUnknown_08A3D58A, 0x8480); - PutSpriteExt(2, 0x80, 0x60, gUnknown_08A3D5A6, 0x7480); - - for (i = 0; i < 5; i++) { - if (proc->unk_4c[i] > 0x10) { + } + else + { + PutSpriteExt(2, 16, 48, Sprite_08A3D560, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 128, 48, Sprite_08A3D56E, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 16, 72, Sprite_08A3D598, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 128, 72, Sprite_08A3D57C, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 16, 96, Sprite_08A3D58A, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(8)); + PutSpriteExt(2, 128, 96, Sprite_08A3D5A6, OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(7)); + + for (i = 0; i < 5; i++) + { + if (proc->unk_4c[i] > 0x10) + { SetObjAffine( i, Div(+COS(0) * 16, proc->unk_4c[i]), @@ -1635,15 +1797,16 @@ void sub_80B7BD8(struct UnkProc* proc) { PutSpriteExt( 2, - (i & 1) * 0x70 + 0x50 + i * 0x200, - (i >> 1) * 0x18 + 0x128, - gUnknown_08A3D624[proc->unk_40[i]], - ((i + 10) & 0xf) * 0x1000 + 0x480 + (i & 1) * 112 + 80 + i * 512, + (i >> 1) * 24 + 296, + SpriteArray_08A3D624[proc->unk_40[i]], + OAM2_PAL(i + 10) + OAM2_CHR(0x80) + OAM2_LAYER(1) ); } } - if (proc->unk_4c[i] > 0x10) { + if (proc->unk_4c[i] > 0x10) + { SetObjAffine( i, Div(+COS(0) * 16, proc->unk_4c[i]), @@ -1651,20 +1814,23 @@ void sub_80B7BD8(struct UnkProc* proc) { Div(+SIN(0) * 16, proc->unk_4c[i]), Div(+COS(0) * 16, 0x100) ); + PutSpriteExt( 2, - (i & 1) * 0x70 + 0x50 + (i * 0x200), - (i >> 1) * 0x18 + 0x128, - gUnknown_08A3D63C[proc->unk_40[i]], - 0xF480 + (i & 1) * 112 + 80 + (i * 512), + (i >> 1) * 24 + 296, + SpriteArray_08A3D63C[proc->unk_40[i]], + OAM2_CHR(0x80) + OAM2_LAYER(1) + OAM2_PAL(15) ); } } + return; } //! FE8U = 0x080B8014 -void sub_80B8014(void) { +void TurnRecord_SetupGfx(void) +{ BG_Fill(gBG2TilemapBuffer, 0); BG_Fill(gBG3TilemapBuffer, 0); @@ -1673,90 +1839,98 @@ void sub_80B8014(void) { gLCDControlBuffer.bg2cnt.priority = 2; gLCDControlBuffer.bg3cnt.priority = 3; - gLCDControlBuffer.dispcnt.bg0_on = 1; - gLCDControlBuffer.dispcnt.bg1_on = 1; - gLCDControlBuffer.dispcnt.bg2_on = 1; - gLCDControlBuffer.dispcnt.bg3_on = 1; - gLCDControlBuffer.dispcnt.obj_on = 1; + SetDispEnable(1, 1, 1, 1, 1); - BG_SetPosition(2, 0, 0); - BG_SetPosition(3, 0, 0); + BG_SetPosition(BG_2, 0, 0); + BG_SetPosition(BG_3, 0, 0); SetBlendTargetA(0, 0, 1, 0, 0); SetBlendTargetB(0, 0, 0, 1, 0); SetBlendBackdropA(0); SetBlendBackdropB(0); - SetBlendConfig(1, 6, 0x10, 0); + SetBlendAlpha(6, 0x10); - Decompress(Img_SaveMenuBG, (void *)(GetBackgroundTileDataOffset(3) + 0x6000000)); + Decompress(Img_SaveMenuBG, (void *)(BG_VRAM + (GetBackgroundTileDataOffset(BG_3)))); ApplyPalettes(Pal_SaveMenuBG, 8, 8); - CallARM_FillTileRect(gBG3TilemapBuffer, Tsa_SaveMenuBG, 0x8000); + CallARM_FillTileRect(gBG3TilemapBuffer, Tsa_SaveMenuBG, TILEREF(0, 8)); - Decompress(Img_MainMenuBgFog, (void *)(GetBackgroundTileDataOffset(2) + 0x06004C00)); + Decompress(Img_MainMenuBgFog, BG_CHR_ADDR(0x260) + GetBackgroundTileDataOffset(BG_2)); Decompress(Tsa_MainMenuBgFog, gGenericBuffer); ApplyPalette(Pal_MainMenuBgFog, 7); - CallARM_FillTileRect(gBG2TilemapBuffer, gGenericBuffer, 0x00007260); + CallARM_FillTileRect(gBG2TilemapBuffer, gGenericBuffer, TILEREF(0x260, 7)); + + BG_EnableSyncByMask(BG2_SYNC_BIT | BG3_SYNC_BIT); - BG_EnableSyncByMask(0xc); sub_80AB760(gEndingDetailBuf); - StartBgm(0x46, 0); + StartBgm(SONG_BGM_ED_AFTER, 0); return; } //! FE8U = 0x080B8168 -int sub_80B8168(void) { +int TurnRecord_End(void) +{ sub_80AB77C(); // return; // BUG } -struct ProcCmd CONST_DATA gProcScr_EndingTurnRecord[] = { - PROC_SLEEP(0), - PROC_CALL(sub_80B7648), +// clang-format off - PROC_CALL(sub_80B770C), - PROC_CALL(sub_80B8014), +struct ProcCmd CONST_DATA gProcScr_EndingTurnRecord[] = +{ + PROC_YIELD, + PROC_CALL(TurnRecord_Init), + + PROC_CALL(TurnRecord_SetupText), + PROC_CALL(TurnRecord_SetupGfx), PROC_CALL_ARG(NewFadeIn, 4), PROC_WHILE(FadeInExists), - PROC_REPEAT(sub_80B7B30), + PROC_REPEAT(TurnRecord_Loop_Main), PROC_SLEEP(120), PROC_CALL_ARG(NewFadeOut, 4), PROC_WHILE(FadeOutExists), - PROC_CALL(sub_80B8168), + PROC_CALL(TurnRecord_End), PROC_SLEEP(60), PROC_END, }; +// clang-format on + //! FE8U = 0x080B8174 -void StartEndingTurnRecordScreen(ProcPtr parent) { +void StartEndingTurnRecordScreen(ProcPtr parent) +{ Proc_StartBlocking(gProcScr_EndingTurnRecord, parent); return; } //! FE8U = 0x080B8188 -void sub_80B8188(int unusedA, int unusedB, int unusedC) { +void sub_80B8188(int unusedA, int unusedB, int unusedC) +{ return; } //! FE8U = 0x080B818C -void nullsub_7(void) { +void nullsub_7(void) +{ return; } //! FE8U = 0x080B8190 -void sub_80B8190(u16* dst, u16* src, u8 coeff) { +void sub_80B8190(u16 * dst, u16 * src, u8 coeff) +{ int i; - for (i = 0; i < 0x10; i++) { - *dst = ((((*src & 0x1f) * coeff) >> 5) & 0x1f) + - ((((*src & 0x3e0) * coeff) >> 5) & 0x3e0) + - ((((*src & 0x7c00) * coeff) >> 5) & 0x7c00); + for (i = 0; i < 0x10; i++) + { + *dst = ((((*src & RED_MASK) * coeff) >> 5) & RED_MASK) + + ((((*src & GREEN_MASK) * coeff) >> 5) & GREEN_MASK) + + ((((*src & BLUE_MASK) * coeff) >> 5) & BLUE_MASK); dst++; src++; } @@ -1767,12 +1941,14 @@ void sub_80B8190(u16* dst, u16* src, u8 coeff) { } //! FE8U = 0x080B81FC -void nullsub_5(int unused) { +void nullsub_5(int unused) +{ return; } //! FE8U = 0x080B8200 -void sub_80B8200(void) { +void sub_80B8200(void) +{ Sound_FadeOutBGM(4); return; } diff --git a/src/face.c b/src/face.c index 6da847ac..0077d46a 100644 --- a/src/face.c +++ b/src/face.c @@ -1380,7 +1380,7 @@ struct FaceProc* StartFace2(int slot, int fid, int x, int y, int disp) { } //! FE8U = 0x08006618 -void sub_8006618(int slot, int x, int y) { +void SetFacePosition(int slot, int x, int y) { gFaces[slot]->xPos = x; gFaces[slot]->yPos = y; diff --git a/src/prep_itemscreen.c b/src/prep_itemscreen.c index 0dde4f59..1ac012f9 100644 --- a/src/prep_itemscreen.c +++ b/src/prep_itemscreen.c @@ -1508,7 +1508,7 @@ void UpdatePrepItemScreenFace(int slot, struct Unit* unit, u16 x, u16 y, u16 dis } } else { if (unit != NULL) { - sub_8006618(slot, (s16)x, (s16)y); + SetFacePosition(slot, (s16)x, (s16)y); SetFaceDisplayBitsById(slot, disp); } }