match MenuTitleLine.cpp

This commit is contained in:
SwareJonge 2023-11-19 01:50:53 +01:00
parent 0b17cf4ffd
commit 37c75c7c22
6 changed files with 155 additions and 4 deletions

View File

@ -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]

View File

@ -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]

View File

@ -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

View File

@ -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

111
src/Osako/MenuTitleLine.cpp Normal file
View File

@ -0,0 +1,111 @@
#include <JSystem/J2D/J2DAnmLoader.h>
#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();
}