diff --git a/config/MarioClub_us/dol_slices.yml b/config/MarioClub_us/dol_slices.yml index 7a74706..86b201c 100644 --- a/config/MarioClub_us/dol_slices.yml +++ b/config/MarioClub_us/dol_slices.yml @@ -1169,6 +1169,13 @@ src/Osako/MenuBackground.cpp: .sbss: [0x80416a88, 0x80416a90] .sdata2: [0x8041bb10, 0x8041bb18] +src/Osako/MenuTitleLine.cpp: + .text: [0x80219158, 0x802194d4] + .rodata: [0x8037ebf8, 0x8037ed08] + .data: [0x8039d578, 0x8039d5a8] + .sbss: [0x80416a90, 0x80416a98] + .sdata2: [0x8041bb18, 0x8041bb20] + src/Osako/GIRecord.cpp: .text: [0x802194d4, 0x802195f0] diff --git a/config/Release_eu/dol_slices.yml b/config/Release_eu/dol_slices.yml index d509676..5894c45 100644 --- a/config/Release_eu/dol_slices.yml +++ b/config/Release_eu/dol_slices.yml @@ -1116,6 +1116,13 @@ src/Osako/MenuBackground.cpp: .sbss: [0x803d5cd0, 0x803d5cd8] .sdata2: [0x803d9d10, 0x803d9d18] +src/Osako/MenuTitleLine.cpp: + .text: [0x801e7210, 0x801e758c] + .rodata: [0x80341828, 0x80341938] + .data: [0x8035cf98, 0x8035cfc8] + .sbss: [0x803d5cd8, 0x803d5ce0] + .sdata2: [0x803d9d18, 0x803d9d20] + src/Osako/GIRecord.cpp: .text: [0x801e758c, 0x801e76a8] diff --git a/include/JSystem/J2D/J2DPane.h b/include/JSystem/J2D/J2DPane.h index e3bea4f..81a9f3b 100644 --- a/include/JSystem/J2D/J2DPane.h +++ b/include/JSystem/J2D/J2DPane.h @@ -160,7 +160,7 @@ struct J2DPane J2DPane(J2DPane *parent, JSURandomInputStream *input, u8 version); virtual ~J2DPane(); // _08 - virtual u16 getTypeID() const { return J2DPaneType_Pane; } // _0C (weak) + virtual u16 getTypeID() const { return J2DPaneType_Pane; } // _0C (weak) virtual void move(f32 x, f32 y); // _10 virtual void add(f32 x, f32 y); // _14 virtual void resize(f32, f32); // _18 diff --git a/include/Osako/MenuTitleLine.h b/include/Osako/MenuTitleLine.h index 8fefb78..ec8b31b 100644 --- a/include/Osako/MenuTitleLine.h +++ b/include/Osako/MenuTitleLine.h @@ -9,7 +9,26 @@ class MenuTitleLine public: enum Title { + mcHowManyPlayers, + mcCharacterSelect, + mcSelectMode, + mcVsCoop, + mcCourseSelect, + mcBattleSelect, + mcCupSelect, + mcMapSelect, + mcGhostCheck, + mcGhostLoad, + mcGhostSave, + mcTitleMax + }; + // Fabricated + enum Animation { + mcAnim0, + mcAnimDrop, + mcAnim2, + mcAnimLift }; // Global @@ -32,9 +51,16 @@ public: private: static MenuTitleLine *mspMenuTitleLine; // 0x80416a90 - u8 _0[4 - 0]; + Animation mAnmType; Title mTitle; J2DScreen mScreen; // 08 - 120 J2DScreen - u8 _120[0x160 - 0x120]; -}; // Size: 0x160 + J2DPicture *mPicture; // might be J2DPictureEx? + J2DPicture *mGhostPicture; + J2DAnmTransform *mTransform; + J2DAnmTextureSRTKey *mTexSRTKey; + s16 mTransFrame; + s16 mKeyFrame; + ResTIMG *mImages[mcTitleMax]; +}; // Size: 0x160 + #endif // MENUTITLELINE_H diff --git a/src/Osako/MenuTitleLine.cpp b/src/Osako/MenuTitleLine.cpp new file mode 100644 index 0000000..5907e4e --- /dev/null +++ b/src/Osako/MenuTitleLine.cpp @@ -0,0 +1,111 @@ +#include +#include "Osako/MenuTitleLine.h" + +static const char *scaFileName[] = { + "HowManyDrivers.bti", + "SelectCharacter.bti", + "SelectMode.bti", + "VsCoop.bti", + "SelectCourse.bti", + "SelectBattle.bti", + "SelectCup.bti", + "SelectMap.bti", + "Mozi_GDCheck.bti", + "Mozi_GhostData_Load.bti", + "Mozi_GhostData_Save.bti" +}; + +MenuTitleLine *MenuTitleLine::mspMenuTitleLine; + +MenuTitleLine::MenuTitleLine(JKRArchive *archive) +{ + mTransFrame = 0; + mKeyFrame = 0; + mAnmType = mcAnim0; + mScreen.setPriority("menu_title_line.blo", 0x1020000, archive); + + void *bck = JKRGetNameResource("menu_title_line.bck", archive); + void *btk = JKRGetNameResource("menu_title_line.btk", archive); + + mTransform = (J2DAnmTransform *)J2DAnmLoaderDataBase::load(bck); + mTexSRTKey = (J2DAnmTextureSRTKey *)J2DAnmLoaderDataBase::load(btk); + + mScreen.setAnimation(mTransform); + mScreen.setAnimation(mTexSRTKey); + + for (int i = 0; i < mcTitleMax; i++) + mImages[i] = (ResTIMG *)JKRFileLoader::getGlbResource(scaFileName[i], archive); + + mPicture = (J2DPicture *)mScreen.search('T_Mozi'); + mGhostPicture = (J2DPicture *)mScreen.search('T_Mozi1'); + mPicture->show(); + mGhostPicture->hide(); + mTitle = mcHowManyPlayers; + mPicture->changeTexture(mImages[mTitle], 0); +} + +void MenuTitleLine::drop(Title nextTitle) +{ + if (mTitle != nextTitle) { + mTitle = nextTitle; + switch (mTitle) + { + case mcHowManyPlayers: + case mcCharacterSelect: + case mcSelectMode: + case mcVsCoop: + case mcCourseSelect: + case mcBattleSelect: + case mcCupSelect: + case mcMapSelect: + mPicture->changeTexture(mImages[mTitle], 0); + mPicture->show(); + mGhostPicture->hide(); + break; + case mcGhostCheck: + case mcGhostLoad: + case mcGhostSave: + mGhostPicture->changeTexture(mImages[mTitle], 0); + mPicture->hide(); + mGhostPicture->show(); + break; + } + } + + mAnmType = mcAnimDrop; +} + +void MenuTitleLine::lift() +{ + mAnmType = mcAnimLift; +} + +void MenuTitleLine::calc() +{ + mTransform->setFrame(mTransFrame); + mTexSRTKey->setFrame(mKeyFrame); + + switch (mAnmType) + { + case 1: + if (++mTransFrame >= 11) + { + mAnmType = mcAnim2; + mTransFrame = 10; + } + break; + case 3: + if (--mTransFrame < 0) + { + mAnmType = mcAnim0; + mTransFrame = 0; + } + break; + } + + if (++mKeyFrame >= 540) + { + mKeyFrame = 0; + } + mScreen.animation(); +} \ No newline at end of file diff --git a/src/Osako/not matched/MenuTitleLine.cpp b/src/Osako/not matched/MenuTitleLine.cpp deleted file mode 100644 index e69de29..0000000