ebiP2TitleLight.cpp

This commit is contained in:
PikHacker 2023-01-16 14:49:30 -05:00
parent 783d409e01
commit 2b9e73f6e4
6 changed files with 53 additions and 123 deletions

View File

@ -234,7 +234,7 @@ setCameraMtx__Q33ebi5title14TTitleLightMgrFPA4_f:
/* 803C2214 003BF154 38 21 00 50 */ addi r1, r1, 0x50
/* 803C2218 003BF158 4E 80 00 20 */ blr
__sinit_ebiP2TitleLight_cpp: # static initializer
.fn __sinit_ebiP2TitleLight_cpp, local
/* 803C221C 003BF15C 3C 80 80 51 */ lis r4, __float_nan@ha
/* 803C2220 003BF160 38 00 FF FF */ li r0, -1
/* 803C2224 003BF164 C0 04 48 B0 */ lfs f0, __float_nan@l(r4)
@ -245,3 +245,4 @@ __sinit_ebiP2TitleLight_cpp: # static initializer
/* 803C2238 003BF178 D0 03 00 04 */ stfs f0, 4(r3)
/* 803C223C 003BF17C D0 03 00 08 */ stfs f0, 8(r3)
/* 803C2240 003BF180 4E 80 00 20 */ blr
.endfn __sinit_ebiP2TitleLight_cpp

View File

@ -68,7 +68,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAS/JASAudioThread.cpp">JAS/JASAudioThread.cpp</a> | 7496 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/dsp/osdsp_task.c">dsp/osdsp_task.c</a> | 7502 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DModelData.cpp">J3D/J3DModelData.cpp</a> | 7504 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JKR/JKRFileLoader.cpp">JKR/JKRFileLoader.cpp</a> | 7745 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JStudio/jstudio-math.cpp">JStudio/jstudio-math.cpp</a> | 8166 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/control.cpp">control.cpp</a> | 8560 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAU/JAUData.cpp">JAU/JAUData.cpp</a> | 9036 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAL/JALCalc.cpp">JAL/JALCalc.cpp</a> | 9063 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAU/JAUData.cpp">JAU/JAUData.cpp</a> | 9034 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAL/JALCalc.cpp">JAL/JALCalc.cpp</a> | 9063 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/J3D/J3DMaterialAnm.cpp">J3D/J3DMaterialAnm.cpp</a> | 9386 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAS/JASDriverIF.cpp">JAS/JASDriverIF.cpp</a> | 9475 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JUT/JUTXfb.cpp">JUT/JUTXfb.cpp</a> | 9537 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JAS/JASBasicWaveBank.cpp">JAS/JASBasicWaveBank.cpp</a> | 9689 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JPA/JPAExtraShape.cpp">JPA/JPAExtraShape.cpp</a> | 9733 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/JSystem/JPA/JPAResourceLoader.cpp">JPA/JPAResourceLoader.cpp</a> | 9800 |
@ -92,7 +92,7 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiUtility.cpp">ebiUtility.cpp</a> | 3779 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiGeometry.cpp">ebiGeometry.cpp</a> | 5821 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiP2TitleLight.cpp">ebiP2TitleLight.cpp</a> | 6193 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiP2TitleCoordMgr.cpp">ebiP2TitleCoordMgr.cpp</a> | 9326 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiP2TitleLight.cpp">ebiP2TitleLight.cpp</a> | 5999 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiP2TitleCoordMgr.cpp">ebiP2TitleCoordMgr.cpp</a> | 9326 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiScreenPushStart.cpp">ebiScreenPushStart.cpp</a> | 10505 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiCardEReader.cpp">ebiCardEReader.cpp</a> | 13664 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/ebiFileSelectMgr.cpp">ebiFileSelectMgr.cpp</a> | 14258 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/efx2dEffect.cpp">efx2dEffect.cpp</a> | 17805 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/efxObject.cpp">efxObject.cpp</a> | 18283 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectEbisawaU/particle2dMgr.cpp">particle2dMgr.cpp</a> | 18589 |

View File

@ -48,7 +48,7 @@ struct LightObj : public CNode {
f32 m_cutoffAngle; // _44
u8 m_distAttnFn; // _48, GXDistAttnFn
u8 m_spotFn; // _49, GXSpotFn
f32 _4C; // _4C, kScale?
f32 m_kScale; // _4C
f32 m_sphereRadius; // _50
u8 _54; // _54
};

View File

@ -141,8 +141,8 @@ struct TTitleLightMgr : public LightMgr {
// _00 = VTBL
// _00-_50 = LightMgr
LightObj _50; // _50
LightObj _A8; // _A8
LightObj m_lightObjMain; // _50
LightObj m_lightObjSpec; // _A8
TTitleLightSetting m_setting; // _100
};

View File

@ -1,4 +1,6 @@
#include "types.h"
#include "ebi/title/TTitle.h"
#include "stream.h"
#include "nans.h"
/*
Generated from dpostproc
@ -49,51 +51,17 @@ namespace title {
* Address: 803C1F58
* Size: 000094
*/
void TTitleLightMgr::loadSettingFile(JKRArchive*, char*)
void TTitleLightMgr::loadSettingFile(JKRArchive* arc, char* path)
{
/*
stwu r1, -0x430(r1)
mflr r0
stw r0, 0x434(r1)
stw r31, 0x42c(r1)
mr r31, r3
mr r3, r4
lwz r12, 0(r4)
mr r4, r5
lwz r12, 0x14(r12)
mtctr r12
bctrl
cmplwi r3, 0
beq lbl_803C1FD8
mr r4, r3
addi r3, r1, 8
li r5, -1
bl __ct__9RamStreamFPvi
li r0, 1
cmpwi r0, 1
stw r0, 0x14(r1)
bne lbl_803C1FB4
li r0, 0
stw r0, 0x41c(r1)
void* file = arc->getResource(path);
if (file) {
RamStream stream(file, -1);
stream.resetPosition(true, 1);
lbl_803C1FB4:
addi r3, r31, 0x100
addi r4, r1, 8
bl read__10ParametersFR6Stream
addi r3, r31, 0x1b0
addi r4, r1, 8
bl read__10ParametersFR6Stream
addi r3, r31, 0x3c8
addi r4, r1, 8
bl read__10ParametersFR6Stream
lbl_803C1FD8:
lwz r0, 0x434(r1)
lwz r31, 0x42c(r1)
mtlr r0
addi r1, r1, 0x430
blr
*/
m_setting.m_ambParms.read(stream);
m_setting.m_mainParms.read(stream);
m_setting.m_specParms.read(stream);
}
}
/*
@ -103,6 +71,30 @@ blr
*/
void TTitleLightMgr::setParam_()
{
m_ambientLight.m_color
= Color4(m_setting.m_ambParms.m_red, m_setting.m_ambParms.m_green, m_setting.m_ambParms.m_blue, m_setting.m_ambParms.m_alpha);
m_lightObjMain.m_color
= Color4(m_setting.m_mainParms.m_tl04, m_setting.m_mainParms.m_tl05, m_setting.m_mainParms.m_tl06, m_setting.m_mainParms.m_tl07);
m_lightObjMain.m_position = Vector3f(m_setting.m_mainParms.m_tl50, m_setting.m_mainParms.m_tl51, m_setting.m_mainParms.m_tl52);
Vector3f temp(m_setting.m_mainParms.m_tl53, m_setting.m_mainParms.m_tl54, m_setting.m_mainParms.m_tl55);
_normalise(temp);
m_lightObjMain.m_elevation = temp;
m_lightObjMain.m_refDistance = m_setting.m_mainParms.m_tl56;
m_lightObjMain.m_refBrightness = m_setting.m_mainParms.m_tl57;
m_lightObjMain.m_cutoffAngle = m_setting.m_mainParms.m_tl58;
m_lightObjMain.m_distAttnFn = 1;
m_lightObjMain.m_spotFn = 3;
m_lightObjSpec.m_color
= Color4(m_setting.m_specParms.m_sp04, m_setting.m_specParms.m_sp05, m_setting.m_specParms.m_sp06, m_setting.m_specParms.m_sp07);
Vector3f temp2(m_setting.m_specParms.m_sp53, m_setting.m_specParms.m_sp54, m_setting.m_specParms.m_sp55);
_normalise(temp2);
m_lightObjSpec.m_elevation = temp2;
m_lightObjSpec.m_kScale = m_setting.m_specParms.m_sp56;
/*
lwz r6, 0x19c(r3)
lwz r5, 0x174(r3)
@ -219,70 +211,21 @@ blr
* Address: 803C2168
* Size: 000020
*/
void TTitleLightMgr::update()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
bl setParam___Q33ebi5title14TTitleLightMgrFv
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
void TTitleLightMgr::update() { setParam_(); }
/*
* --INFO--
* Address: 803C2188
* Size: 000094
*/
void TTitleLightMgr::setCameraMtx(float (*)[4])
void TTitleLightMgr::setCameraMtx(Mtx mtx)
{
/*
stwu r1, -0x50(r1)
mflr r0
stw r0, 0x54(r1)
stw r31, 0x4c(r1)
mr r31, r3
mr r3, r4
addi r4, r1, 0x10
bl PSMTXCopy
lbz r7, 0x30(r31)
addi r4, r1, 0xc
lbz r6, 0x31(r31)
li r3, 4
lbz r5, 0x32(r31)
lbz r0, 0x33(r31)
stb r7, 8(r1)
stb r6, 9(r1)
stb r5, 0xa(r1)
stb r0, 0xb(r1)
lwz r0, 8(r1)
stw r0, 0xc(r1)
bl GXSetChanAmbColor
lwz r31, 0x44(r31)
b lbl_803C2200
Matrixf mtx2;
PSMTXCopy(mtx, mtx2.m_matrix.mtxView);
GXColor col = m_ambientLight.m_color.toGXColor();
GXSetChanAmbColor(GX_COLOR0A0, col);
lbl_803C21E4:
mr r3, r31
addi r4, r1, 0x10
lwz r12, 0(r31)
lwz r12, 0x14(r12)
mtctr r12
bctrl
lwz r31, 4(r31)
lbl_803C2200:
cmplwi r31, 0
bne lbl_803C21E4
lwz r0, 0x54(r1)
lwz r31, 0x4c(r1)
mtlr r0
addi r1, r1, 0x50
blr
*/
FOREACH_NODE(LightObj, m_lightObjChain.m_child, node) { node->set(mtx2); }
}
} // namespace title
@ -293,18 +236,4 @@ blr
* Address: 803C221C
* Size: 000028
*/
void __sinit_ebiP2TitleLight_cpp()
{
/*
lis r4, __float_nan@ha
li r0, -1
lfs f0, __float_nan@l(r4)
lis r3, lbl_804E79D8@ha
stw r0, lbl_805160C8@sda21(r13)
stfsu f0, lbl_804E79D8@l(r3)
stfs f0, lbl_805160CC@sda21(r13)
stfs f0, 4(r3)
stfs f0, 8(r3)
blr
*/
}
void __sinit_ebiP2TitleLight_cpp() { }

View File

@ -21,8 +21,8 @@ Mgr::Mgr()
m_mainLight->m_elevation = Vector3f(0.0f, -1.0f, 0.0f);
registLightObj(m_mainLight);
m_specLight = new LightObj("スペキュラ-ライト", GX_LIGHT7, TYPE_4, JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF));
m_specLight->_4C = 40.0f;
m_specLight = new LightObj("スペキュラ-ライト", GX_LIGHT7, TYPE_4, JUtility::TColor(0xFF, 0xFF, 0xFF, 0xFF));
m_specLight->m_kScale = 40.0f;
registLightObj(m_specLight);
m_ambientLight.m_color = Color4(0x32, 0x32, 0x32, 0xFF);