Skip to content

Commit

Permalink
d_a_title matching on JPN and PAL
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jul 14, 2024
1 parent ee2fef6 commit ebfca99
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 28 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ def JSystemLib(lib_name, objects):
ActorRel(NonMatching, "d_a_tag_kf1"),
ActorRel(Matching, "d_a_tag_ret", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(Matching, "d_a_tag_volcano"),
ActorRel(NonMatching, "d_a_title", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(Matching, "d_a_title", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_tn"),
ActorRel(Matching, "d_a_toge", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_tori_flag"),
Expand Down
104 changes: 77 additions & 27 deletions src/d/actor/d_a_title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "stdio.h"

// These are just guesses
// Note: For VERSION_PAL the "TlogoE0" string literal is modified at runtime.
#define ARCNAME VERSION_SELECT("Tlogo", "TlogoE", "TlogoE0")

namespace {
Expand All @@ -40,10 +41,29 @@ namespace {

// TODO: Figure out magic numbers
static const Attr_c L_attr = {
0.0f, 0.0f, 0.9f, 0.1f,
-57.0f, -3.0f, 1.0f, 1.0f,
120.0f, 10.0f, 120.0f, 10.0f,
85.0f, 5.0f,
0.0f,
0.0f,
0.9f,
0.1f,
-57.0f,
#if VERSION == VERSION_JPN
-19.0f,
#else
-3.0f,
#endif
1.0f,
1.0f,
120.0f,
10.0f,
120.0f,
10.0f,
#if VERSION == VERSION_JPN
78.0f,
8.0f,
#else
85.0f,
5.0f,
#endif
};

inline const Attr_c & attr() { return L_attr; }
Expand All @@ -54,49 +74,49 @@ void daTitle_proc_c::proc_init3D() {
m_solid_heap = mDoExt_createSolidHeapFromGameToCurrent(0x40000U, 0x20);

J3DModelData* modelData_ship = (J3DModelData*)dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BDL_TITLE_SHIP, TLOGOE_BDL_TITLE_SHIP, TLOGOE0_BDL_TITLE_SHIP));
JUT_ASSERT(0xFC, modelData_ship != NULL);
JUT_ASSERT(VERSION_SELECT(0xD1, 0xFC, 0xFC), modelData_ship != NULL);

mModel_ship = mDoExt_J3DModel__create(modelData_ship, 0x80000U, 0x37441423U);
JUT_ASSERT(0x101, mModel_ship != NULL);
JUT_ASSERT(VERSION_SELECT(0xD6, 0x101, 0x101), mModel_ship != NULL);

J3DModelData* modelData_sub = (J3DModelData*)dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BDL_SUBTITLE_START_ANIM, TLOGOE_BDL_SUBTITLE_START_ANIM_E, TLOGOE0_BDL_SUBTITLE_START_ANIM_E));
JUT_ASSERT(0x105, modelData_sub != NULL);
JUT_ASSERT(VERSION_SELECT(0xDA, 0x105, 0x105), modelData_sub != NULL);

mModel_subtitle = mDoExt_J3DModel__create(modelData_sub, 0x80000U, 0x37441422U);
JUT_ASSERT(0x10A, mModel_subtitle != NULL);
JUT_ASSERT(VERSION_SELECT(0xDF, 0x10A, 0x10A), mModel_subtitle != NULL);

J3DModelData* modelData_kirari = (J3DModelData*)dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BDL_SUBTITLE_KIRARI, TLOGOE_BDL_SUBTITLE_KIRARI_E, TLOGOE0_BDL_SUBTITLE_KIRARI_E));
JUT_ASSERT(0x10E, modelData_kirari != NULL);
JUT_ASSERT(VERSION_SELECT(0xE3, 0x10E, 0x10E), modelData_kirari != NULL);

mModel_kirari = mDoExt_J3DModel__create(modelData_kirari, 0x80000U, 0x37441422U);
JUT_ASSERT(0x113, mModel_kirari != NULL);
JUT_ASSERT(VERSION_SELECT(0xE8, 0x113, 0x113), mModel_kirari != NULL);

J3DAnmTransform* bck_ship = static_cast<J3DAnmTransform*>(dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BCK_TITLE_SHIP, TLOGOE_BCK_TITLE_SHIP, TLOGOE0_BCK_TITLE_SHIP)));
JUT_ASSERT(0x118, bck_ship != NULL);
JUT_ASSERT(VERSION_SELECT(0xED, 0x118, 0x118), bck_ship != NULL);

BOOL ok_bck = mBckShip.init(modelData_ship, bck_ship, TRUE, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false);
JUT_ASSERT(0x11F, ok_bck != FALSE);
JUT_ASSERT(VERSION_SELECT(0xF4, 0x11F, 0x11F), ok_bck != FALSE);

J3DAnmColor* bpk_ship = static_cast<J3DAnmColor*>(dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BPK_TITLE_SHIP, TLOGOE_BPK_TITLE_SHIP, TLOGOE0_BPK_TITLE_SHIP)));
JUT_ASSERT(0x124, bpk_ship != NULL);
JUT_ASSERT(VERSION_SELECT(0xF9, 0x124, 0x124), bpk_ship != NULL);

BOOL ok_bpk = mBpkShip.init(modelData_ship, bpk_ship, TRUE, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false, 0);
JUT_ASSERT(0x12A, ok_bpk != FALSE);
JUT_ASSERT(VERSION_SELECT(0xFF, 0x12A, 0x12A), ok_bpk != FALSE);

mBpkShip.setFrame(0.0f);
mBpkShip.setPlaySpeed(1.0f);

J3DAnmTextureSRTKey* btk_sub = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BTK_SUBTITLE_START_ANIM, TLOGOE_BTK_SUBTITLE_START_ANIM_E, TLOGOE0_BTK_SUBTITLE_START_ANIM_E)));
JUT_ASSERT(0x131, btk_sub != NULL);
JUT_ASSERT(VERSION_SELECT(0x106, 0x131, 0x131), btk_sub != NULL);

BOOL ok_btk_subtitle = mBtkSub.init(modelData_sub, btk_sub, TRUE, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, false, 0);
JUT_ASSERT(0x138, ok_btk_subtitle != FALSE);
JUT_ASSERT(VERSION_SELECT(0x10D, 0x138, 0x138), ok_btk_subtitle != FALSE);

J3DAnmTextureSRTKey* btk_kirari = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(ARCNAME, VERSION_SELECT(TLOGO_BTK_SUBTITLE_KIRARI, TLOGOE_BTK_SUBTITLE_KIRARI_E, TLOGOE0_BTK_SUBTITLE_KIRARI_E)));
JUT_ASSERT(0x13D, btk_kirari != NULL);
JUT_ASSERT(VERSION_SELECT(0x112, 0x13D, 0x13D), btk_kirari != NULL);

BOOL ok_btk_kirari = mBtkKirari.init(modelData_kirari, btk_kirari, TRUE, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false, 0);
JUT_ASSERT(0x144, ok_btk_kirari != FALSE);
JUT_ASSERT(VERSION_SELECT(0x119, 0x144, 0x144), ok_btk_kirari != FALSE);

mDoExt_restoreCurrentHeap();
set_mtx();
Expand All @@ -105,17 +125,17 @@ void daTitle_proc_c::proc_init3D() {
/* 00000638-00000900 .text proc_init2D__14daTitle_proc_cFv */
void daTitle_proc_c::proc_init2D() {
m_exp_heap = fopMsgM_createExpHeap(0x30000U);
JUT_ASSERT(0x14D, m_exp_heap != NULL);
JUT_ASSERT(VERSION_SELECT(0x122, 0x14D, 0x14D), m_exp_heap != NULL);

JKRHeap* oldHeap = mDoExt_setCurrentHeap(m_exp_heap);

m_Screen = new J2DScreen();
JUT_ASSERT(0x153, m_Screen != NULL);
JUT_ASSERT(VERSION_SELECT(0x128, 0x153, 0x153), m_Screen != NULL);

dRes_info_c* resInfo = dComIfG_getObjectResInfo(ARCNAME);
JUT_ASSERT(0x155, resInfo != NULL);
JUT_ASSERT(VERSION_SELECT(0x12A, 0x155, 0x155), resInfo != NULL);

m_Screen->set("title_logo_e.blo", resInfo->getArchive());
m_Screen->set(VERSION_SELECT("title_logo.blo", "title_logo_e.blo", "title_logo_e.blo"), resInfo->getArchive());

m0A0[2] = m_Screen->search('pres');
m0A0[3] = m_Screen->search('nint');
Expand Down Expand Up @@ -235,7 +255,19 @@ void daTitle_proc_c::calc_2d_alpha() {
} else {
fopMsgM_setNowAlpha(&pane[0], 1.0f);
}

#if VERSION == VERSION_JPN
if (m018 <= 75) {
fopMsgM_setNowAlpha(&pane[1], 0.0f);
} else if (m018 <= 130) {
f32 f1 = m018 - 75;
fopMsgM_setNowAlpha(&pane[1], f1 / 55);
} else {
fopMsgM_setNowAlpha(&pane[1], 1.0f);
}
#else
fopMsgM_setNowAlpha(&pane[1], 0.0f);
#endif

if (m018 == 80) {
if (daTitle_Kirakira_Sound_flag == true) {
Expand Down Expand Up @@ -287,7 +319,7 @@ void daTitle_proc_c::calc_2d_alpha() {
}

fopMsgM_setNowAlpha(&pane[0], 1.0f);
fopMsgM_setNowAlpha(&pane[1], 0.0f);
fopMsgM_setNowAlpha(&pane[1], VERSION_SELECT(1.0f, 0.0f, 0.0f));

if (mpEmitter2 != NULL) {
mpEmitter2->becomeInvalidEmitter();
Expand Down Expand Up @@ -386,23 +418,31 @@ void daTitle_proc_c::proc_execute() {
void daTitle_proc_c::model_draw() {
dComIfGd_setList2D();

#if VERSION != VERSION_JPN
if (mBtkSub.getFrame() != 0.0f) {
#endif
mBtkKirari.entry(mModel_kirari->getModelData());
mDoExt_modelUpdateDL(mModel_kirari);
mBtkKirari.remove(mModel_kirari->getModelData());

mBtkSub.entry(mModel_subtitle->getModelData());
mDoExt_modelUpdateDL(mModel_subtitle);
mBtkSub.remove(mModel_subtitle->getModelData());
#if VERSION != VERSION_JPN
}
#endif

#if VERSION != VERSION_JPN
if (mBpkShip.getFrame() != 0.0f) {
#endif
mBckShip.entry(mModel_ship->getModelData());
mBpkShip.entry(mModel_ship->getModelData());
mDoExt_modelUpdateDL(mModel_ship);
mBpkShip.remove(mModel_ship->getModelData());
mBckShip.remove(mModel_ship->getModelData());
#if VERSION != VERSION_JPN
}
#endif

dComIfGd_setList();
}
Expand All @@ -429,6 +469,11 @@ daTitle_c::~daTitle_c() {
s32 daTitle_c::create() {
fopAcM_SetupActor(this, daTitle_c);

#if VERSION == VERSION_PAL
// Use sprintf to modify the supposedly read-only "TlogoE0" string literal.
sprintf(ARCNAME, "TlogoE%d\0", dComIfGs_getPalLanguage());
#endif

s32 phase_state = dComIfG_resLoad(&mPhs, ARCNAME);

if (phase_state == cPhs_COMPLEATE_e) {
Expand Down Expand Up @@ -461,15 +506,20 @@ BOOL daTitle_c::execute() {
mpTitleProc->setEnterMode();
} else if(mpTitleProc->getEnterMode() == 3) {
scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID());
JUT_ASSERT(0x2EF, stageProc != NULL);
JUT_ASSERT(VERSION_SELECT(0x2B1, 0x2EF, 0x2EF), stageProc != NULL);

if (!m29C && fopScnM_ChangeReq(stageProc, PROC_NAME_SCENE, 0, 5)) {
mDoAud_seStart(JA_SE_OP_ENTER_GAME);
m29C = true;
}
} else if (!mDoRst::isReset() && dComIfGp_isEnableNextStage()) {
} else if (
#if VERSION != VERSION_JPN
!mDoRst::isReset() &&
#endif
dComIfGp_isEnableNextStage()
) {
scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID());
JUT_ASSERT(0x2FC, stageProc != NULL);
JUT_ASSERT(VERSION_SELECT(0x2BD, 0x2FC, 0x2FC), stageProc != NULL);

if (!m29C) {
s16 procName = fpcM_GetName(stageProc) == PROC_OPENING_SCENE ? PROC_OPEN2_SCENE : PROC_TITLE_SCENE;
Expand Down

0 comments on commit ebfca99

Please sign in to comment.