d_a_obj_cb almost matching (#2265)

* d_a_obj_cb almost matching

* d_a_obj_bubblePillar OK

* Work on d_a_obj_fchain

* d_a_obj_gb OK

* daTimeFire_c OK

* d_a_obj_toaru_maki OK

* d_a_obj_ten OK
This commit is contained in:
hatal175
2024-12-17 01:16:19 +02:00
committed by GitHub
parent ee992eb80c
commit c5ab943cfc
23 changed files with 2329 additions and 2572 deletions
+206 -232
View File
@@ -4,170 +4,123 @@
*/
#include "d/actor/d_a_obj_gb.h"
#include "dol2asm.h"
//
// Forward References:
//
extern "C" static void daObj_Gb_Draw__FP12obj_gb_class();
extern "C" static void daObj_Gb_Execute__FP12obj_gb_class();
extern "C" void __dt__4cXyzFv();
extern "C" static bool daObj_Gb_IsDelete__FP12obj_gb_class();
extern "C" static void daObj_Gb_Delete__FP12obj_gb_class();
extern "C" static void useHeapInit__FP10fopAc_ac_c();
extern "C" void __dt__12J3DFrameCtrlFv();
extern "C" static void daObj_Gb_Create__FP10fopAc_ac_c();
extern "C" void __ct__4cXyzFv();
extern "C" extern char const* const d_a_obj_gb__stringBase0;
//
// External References:
//
extern "C" void mDoMtx_YrotS__FPA4_fs();
extern "C" void mDoMtx_YrotM__FPA4_fs();
extern "C" void transM__14mDoMtx_stack_cFfff();
extern "C" void scaleM__14mDoMtx_stack_cFfff();
extern "C" void play__14mDoExt_baseAnmFv();
extern "C" void init__13mDoExt_btkAnmFP16J3DMaterialTableP19J3DAnmTextureSRTKeyiifss();
extern "C" void entry__13mDoExt_btkAnmFP16J3DMaterialTablef();
extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss();
extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef();
extern "C" void mDoExt_modelUpdateDL__FP8J3DModel();
extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl();
extern "C" void __ct__10fopAc_ac_cFv();
extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl();
extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc();
extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc();
extern "C" void isSwitch__10dSv_info_cCFii();
extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci();
extern "C" void Release__4cBgSFP9dBgW_Base();
extern "C" void Regist__4dBgSFP9dBgW_BaseP10fopAc_ac_c();
extern "C" void Set__4cBgWFP6cBgD_tUlPA3_A4_f();
extern "C" void __ct__4dBgWFv();
extern "C" void Move__4dBgWFv();
extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c();
extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c();
extern "C" void dKy_bg_MAxx_proc__FPv();
extern "C" void cM_rndF__Ff();
extern "C" void cLib_addCalc2__FPffff();
extern "C" void MtxPosition__FP4cXyzP4cXyz();
extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc();
extern "C" void seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc();
extern "C" void* __nw__FUl();
extern "C" void __dl__FPv();
extern "C" void init__12J3DFrameCtrlFs();
extern "C" void __construct_array();
extern "C" void _savegpr_25();
extern "C" void _savegpr_26();
extern "C" void _savegpr_28();
extern "C" void _savegpr_29();
extern "C" void _restgpr_25();
extern "C" void _restgpr_26();
extern "C" void _restgpr_28();
extern "C" void _restgpr_29();
extern "C" u8 now__14mDoMtx_stack_c[48];
extern "C" extern u8 g_dComIfG_gameInfo[122384];
extern "C" extern void* calc_mtx[1 + 1 /* padding */];
extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */];
//
// Declarations:
//
#include "SSystem/SComponent/c_lib.h"
#include "SSystem/SComponent/c_math.h"
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
/* 80BF6318-80BF63F8 000078 00E0+00 1/0 0/0 0/0 .text daObj_Gb_Draw__FP12obj_gb_class */
static void daObj_Gb_Draw(obj_gb_class* param_0) {
// NONMATCHING
static int daObj_Gb_Draw(obj_gb_class* i_this) {
g_env_light.settingTevStruct(0x10, &i_this->current.pos, &i_this->tevStr);
g_env_light.setLightTevColorType_MAJI(i_this->mModel, &i_this->tevStr);
J3DModelData* modelData = (J3DModelData*)i_this->mModel->getModelData();
for (u16 i = 0; i <= 1; i++) {
J3DMaterial* material = (J3DMaterial*)modelData->getMaterialNodePointer(i);
material->getTevKColor(1)->a = i_this->mColorAlpha;
}
dKy_bg_MAxx_proc(i_this->mModel);
i_this->mBtk->entry(modelData);
i_this->mBrk->entry(modelData);
mDoExt_modelUpdateDL(i_this->mModel);
return 1;
}
/* ############################################################################################## */
/* 80BF6DBC-80BF6DC0 000000 0004+00 2/2 0/0 0/0 .rodata @3890 */
SECTION_RODATA static f32 const lit_3890 = 0.5f;
COMPILER_STRIP_GATE(0x80BF6DBC, &lit_3890);
/* 80BF6DC0-80BF6DC4 000004 0004+00 1/2 0/0 0/0 .rodata @3891 */
SECTION_RODATA static f32 const lit_3891 = 1.0f;
COMPILER_STRIP_GATE(0x80BF6DC0, &lit_3891);
/* 80BF6DC4-80BF6DC8 000008 0004+00 0/1 0/0 0/0 .rodata @3892 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_3892 = -1.0f;
COMPILER_STRIP_GATE(0x80BF6DC4, &lit_3892);
#pragma pop
/* 80BF6DC8-80BF6DCC 00000C 0004+00 0/1 0/0 0/0 .rodata @3893 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_3893 = 29.0f;
COMPILER_STRIP_GATE(0x80BF6DC8, &lit_3893);
#pragma pop
/* 80BF6DCC-80BF6DD0 000010 0004+00 1/3 0/0 0/0 .rodata @3894 */
SECTION_RODATA static u8 const lit_3894[4] = {
0x00,
0x00,
0x00,
0x00,
};
COMPILER_STRIP_GATE(0x80BF6DCC, &lit_3894);
/* 80BF6DD0-80BF6DD4 000014 0004+00 0/1 0/0 0/0 .rodata @3895 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_3895 = -200.0f;
COMPILER_STRIP_GATE(0x80BF6DD0, &lit_3895);
#pragma pop
/* 80BF6DEC-80BF6DEC 000030 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
#pragma force_active on
SECTION_DEAD static char const* const stringBase_80BF6DEC = "D_MN09B";
#pragma pop
/* 80BF63F8-80BF678C 000158 0394+00 2/1 0/0 0/0 .text daObj_Gb_Execute__FP12obj_gb_class
*/
static void daObj_Gb_Execute(obj_gb_class* param_0) {
// NONMATCHING
}
/* 80BF678C-80BF67C8 0004EC 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */
// cXyz::~cXyz() {
extern "C" void __dt__4cXyzFv() {
// NONMATCHING
static int daObj_Gb_Execute(obj_gb_class* i_this) {
fopAc_ac_c* player = dComIfGp_getPlayer(0);
cXyz acStack_30;
cXyz cStack_3c;
i_this->field_0x58e++;
for (int i = 0; i < 2; i++) {
if (i_this->field_0x58a[i] != 0) {
i_this->field_0x58a[i]--;
}
}
switch(i_this->mIsFinalBattle) {
case 0:
if (i_this->field_0x57c == 0) {
for (int i = 0; i < 20; i++) {
if (i_this->mBrkFrame < 0.5f) {
Z2GetAudioMgr()->seStart(Z2SE_OBJ_GANON_BARRIER_APPR, &i_this->field_0x594[i],
0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
}
Z2GetAudioMgr()->seStartLevel(Z2SE_OBJ_GANON_BARRIER, &i_this->field_0x594[i], 0, 0,
1.0f, 1.0f, -1.0f, -1.0f, 0);
}
} else {
if (i_this->mBrkFrame < 0.5f) {
Z2GetAudioMgr()->seStart(Z2SE_OBJ_GANON_BARRIER_APPR, &i_this->current.pos, 0, 0,
1.0f, 1.0f, -1.0f, -1.0f, 0);
}
Z2GetAudioMgr()->seStartLevel(Z2SE_OBJ_GANON_BARRIER, &i_this->current.pos, 0, 0, 1.0f,
1.0f, -1.0f, -1.0f, 0);
}
cLib_addCalc2(&i_this->mBrkFrame, 29.0f, 1.0f, 1.0f);
if (strcmp(dComIfGp_getStartStageName(), "D_MN09B") != 0) {
if (dComIfGs_isSwitch(i_this->mSw2, fopAcM_GetRoomNo(i_this)) ||
!dComIfGs_isSwitch(i_this->mSw1, fopAcM_GetRoomNo(i_this)))
{
i_this->mIsFinalBattle = 1;
}
}
break;
case 1:
cLib_addCalc2(&i_this->mBrkFrame, 0, 1.0f, 1.0f);
if (!dComIfGs_isSwitch(i_this->mSw2, fopAcM_GetRoomNo(i_this)) &&
dComIfGs_isSwitch(i_this->mSw1, fopAcM_GetRoomNo(i_this)))
{
i_this->mIsFinalBattle = 0;
}
break;
}
mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z);
mDoMtx_stack_c::YrotM(i_this->current.angle.y);
if (i_this->field_0x57c == 0) {
mDoMtx_stack_c::scaleM(i_this->scale.x, i_this->scale.y, i_this->scale.x);
} else {
mDoMtx_stack_c::scaleM(i_this->scale.x, i_this->scale.y, 1.0f);
}
i_this->mModel->setBaseTRMtx(mDoMtx_stack_c::get());
i_this->mBtk->play();
i_this->mBrk->setFrame(i_this->mBrkFrame);
if (i_this->mBrkFrame < 1.0f) {
mDoMtx_stack_c::transM(0.0f, -200.0f, 0.0f);
mDoMtx_stack_c::scaleM(1.0f, 0.0f, 1.0f);
}
MTXCopy(mDoMtx_stack_c::get(), i_this->mBgMtx);
i_this->mpBgW->Move();
return 1;
}
/* 80BF67C8-80BF67D0 000528 0008+00 1/0 0/0 0/0 .text daObj_Gb_IsDelete__FP12obj_gb_class
*/
static bool daObj_Gb_IsDelete(obj_gb_class* param_0) {
return true;
static int daObj_Gb_IsDelete(obj_gb_class* param_0) {
return 1;
}
/* ############################################################################################## */
/* 80BF6DEC-80BF6DEC 000030 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
#pragma force_active on
SECTION_DEAD static char const* const stringBase_80BF6DF4 = "Obj_gb";
#pragma pop
/* 80BF67D0-80BF682C 000530 005C+00 1/0 0/0 0/0 .text daObj_Gb_Delete__FP12obj_gb_class
*/
static void daObj_Gb_Delete(obj_gb_class* param_0) {
// NONMATCHING
static int daObj_Gb_Delete(obj_gb_class* i_this) {
fopAcM_GetID(i_this);
dComIfG_resDelete(&i_this->mPhase, "Obj_gb");
if (i_this->mpBgW != NULL) {
dComIfG_Bgsp().Release(i_this->mpBgW);
}
return 1;
}
/* ############################################################################################## */
/* 80BF6DFC-80BF6E08 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */
SECTION_DATA static u8 cNullVec__6Z2Calc[12] = {
static u8 cNullVec__6Z2Calc[12] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/* 80BF6E08-80BF6E1C 00000C 0004+10 0/0 0/0 0/0 .data @1787 */
#pragma push
#pragma force_active on
SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = {
static u32 lit_1787[1 + 4 /* padding */] = {
0x02000201,
/* padding */
0x40080000,
@@ -178,44 +131,132 @@ SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = {
#pragma pop
/* 80BF6E1C-80BF6E24 000020 0008+00 0/1 0/0 0/0 .data bmd$3914 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 bmd[8] = {
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07,
static int bmd[2] = {
6, 7,
};
#pragma pop
/* 80BF6E24-80BF6E2C 000028 0008+00 0/1 0/0 0/0 .data brk$3915 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 brk[8] = {
0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0B,
static int brk[2] = {
10, 11,
};
#pragma pop
/* 80BF6E2C-80BF6E34 000030 0008+00 0/1 0/0 0/0 .data btk$3916 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 btk[8] = {
0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0F,
static int btk[2] = {
14, 15,
};
#pragma pop
/* 80BF6E34-80BF6E3C 000038 0008+00 0/1 0/0 0/0 .data dzb$3917 */
#pragma push
#pragma force_active on
SECTION_DATA static u8 dzb[8] = {
0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13,
static int dzb[2] = {
18, 19,
};
#pragma pop
/* 80BF682C-80BF6A98 00058C 026C+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */
static int useHeapInit(fopAc_ac_c* actor) {
obj_gb_class* i_this = (obj_gb_class*)actor;
J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("Obj_gb", bmd[i_this->field_0x57c]);
JUT_ASSERT(324, modelData != 0);
i_this->mModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284);
if (i_this->mModel == NULL) {
return 0;
}
i_this->mBtk = new mDoExt_btkAnm();
if (i_this->mBtk == NULL) {
return 0;
}
J3DAnmTextureSRTKey* anmTexture = (J3DAnmTextureSRTKey*) dComIfG_getObjectRes(
"Obj_gb", btk[i_this->field_0x57c]);
if (i_this->mBtk->init(i_this->mModel->getModelData(), anmTexture, 1, 2, 1.0f, 0, -1) == 0) {
return 0;
}
i_this->mBrk = new mDoExt_brkAnm();
if (i_this->mBrk== NULL) {
return 0;
}
J3DAnmTevRegKey* anmTevKey = (J3DAnmTevRegKey*)dComIfG_getObjectRes(
"Obj_gb", brk[i_this->field_0x57c]);
if (i_this->mBrk->init(i_this->mModel->getModelData(), anmTevKey, 1, 2, 0.0f, 0, -1) == 0) {
return 0;
}
i_this->mpBgW = new dBgW();
if (i_this->mpBgW == NULL) {
return 0;
}
cBgD_t* pbGd = (cBgD_t*)dComIfG_getObjectRes(
"Obj_gb", dzb[i_this->field_0x57c]);
return i_this->mpBgW->Set(pbGd, 1, &i_this->mBgMtx) == 1 ? 0 : 1;
}
/* 80BF6AE0-80BF6DB0 000840 02D0+00 1/0 0/0 0/0 .text daObj_Gb_Create__FP10fopAc_ac_c */
static int daObj_Gb_Create(fopAc_ac_c* actor) {
fopAcM_SetupActor(actor, obj_gb_class);
obj_gb_class* i_this = (obj_gb_class*)actor;
int rv = dComIfG_resLoad(&i_this->mPhase, "Obj_gb");
if (rv == cPhs_COMPLEATE_e) {
OS_REPORT("OBJ_GB PARAM %x\n", fopAcM_GetParam(i_this));
i_this->field_0x57c = fopAcM_GetParam(i_this);
if (i_this->field_0x57c == 0xff) {
i_this->field_0x57c = 0;
}
u8 local_47 = (fopAcM_GetParam(i_this) >> 8) & 0xff;
if (local_47 == 0xff) {
if (i_this->field_0x57c == 0) {
local_47 = 100;
} else {
local_47 = 10;
}
}
if (i_this->field_0x57c == 0) {
i_this->scale.x = local_47 * 0.01f;
} else {
i_this->scale.x = local_47 * 0.5f;
}
i_this->scale.y = ((fopAcM_GetParam(i_this) >> 16) & 0xff) * 0.333333f * 0.5f;
i_this->mColorAlpha = fopAcM_GetParam(i_this) >> 24;
i_this->mSw1 = i_this->current.angle.x & 0xff;
i_this->mSw2 = (i_this->current.angle.x & 0xff00) >> 8;
i_this->shape_angle.x = 0;
i_this->current.angle.x = 0;
OS_REPORT("OBJ_GB//////////////OBJ_GB SET 1 !!\n");
int heapSize;
if (i_this->field_0x57c == 0) {
heapSize = 0x1c40;
} else {
heapSize = 0x1320;
}
if (fopAcM_entrySolidHeap(i_this, useHeapInit, heapSize) == 0) {
OS_REPORT("//////////////OBJ_GB SET NON !!\n");
return cPhs_ERROR_e;
}
OS_REPORT("//////////////OBJ_GB SET 2 !!\n");
if (i_this->mpBgW != NULL) {
if (dComIfG_Bgsp().Regist(i_this->mpBgW, i_this) != 0) {
return cPhs_ERROR_e;
}
}
i_this->field_0x58e = cM_rndF(65536.0f);
if (strcmp(dComIfGp_getStartStageName(), "D_MN09B") != 0) {
i_this->mIsFinalBattle = 1;
}
s16 local_44 = 0;
cXyz cStack_30(0.0f, 0.0f, i_this->scale.x * 1000.0f);
for (int i = 0; i < 20; i++, local_44 += 0xccc) {
cMtx_YrotS(*calc_mtx, local_44);
MtxPosition(&cStack_30, &i_this->field_0x594[i]);
i_this->field_0x594[i] += i_this->current.pos;
}
daObj_Gb_Execute(i_this);
}
return rv;
}
/* 80BF6E3C-80BF6E5C -00001 0020+00 1/0 0/0 0/0 .data l_daObj_Gb_Method */
static actor_method_class l_daObj_Gb_Method = {
(process_method_func)daObj_Gb_Create__FP10fopAc_ac_c,
(process_method_func)daObj_Gb_Delete__FP12obj_gb_class,
(process_method_func)daObj_Gb_Execute__FP12obj_gb_class,
(process_method_func)daObj_Gb_IsDelete__FP12obj_gb_class,
(process_method_func)daObj_Gb_Draw__FP12obj_gb_class,
(process_method_func)daObj_Gb_Create,
(process_method_func)daObj_Gb_Delete,
(process_method_func)daObj_Gb_Execute,
(process_method_func)daObj_Gb_IsDelete,
(process_method_func)daObj_Gb_Draw,
};
/* 80BF6E5C-80BF6E8C -00001 0030+00 0/0 0/0 1/0 .data g_profile_OBJ_GB */
@@ -236,71 +277,4 @@ extern actor_process_profile_definition g_profile_OBJ_GB = {
fopAc_CULLBOX_CUSTOM_e, // cullType
};
/* 80BF6E8C-80BF6E98 000090 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */
SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = {
(void*)NULL /* RTTI */,
(void*)NULL,
(void*)__dt__12J3DFrameCtrlFv,
};
/* 80BF682C-80BF6A98 00058C 026C+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */
static void useHeapInit(fopAc_ac_c* param_0) {
// NONMATCHING
}
/* 80BF6A98-80BF6AE0 0007F8 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */
// J3DFrameCtrl::~J3DFrameCtrl() {
extern "C" void __dt__12J3DFrameCtrlFv() {
// NONMATCHING
}
/* ############################################################################################## */
/* 80BF6DD4-80BF6DD8 000018 0004+00 0/1 0/0 0/0 .rodata @4083 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_4083 = 1.0f / 100.0f;
COMPILER_STRIP_GATE(0x80BF6DD4, &lit_4083);
#pragma pop
/* 80BF6DD8-80BF6DDC 00001C 0004+00 0/1 0/0 0/0 .rodata @4084 */
#pragma push
#pragma force_active on
SECTION_RODATA static u32 const lit_4084 = 0x3EAAAA9F;
COMPILER_STRIP_GATE(0x80BF6DD8, &lit_4084);
#pragma pop
/* 80BF6DDC-80BF6DE0 000020 0004+00 0/1 0/0 0/0 .rodata @4085 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_4085 = 65536.0f;
COMPILER_STRIP_GATE(0x80BF6DDC, &lit_4085);
#pragma pop
/* 80BF6DE0-80BF6DE4 000024 0004+00 0/1 0/0 0/0 .rodata @4086 */
#pragma push
#pragma force_active on
SECTION_RODATA static f32 const lit_4086 = 1000.0f;
COMPILER_STRIP_GATE(0x80BF6DE0, &lit_4086);
#pragma pop
/* 80BF6DE4-80BF6DEC 000028 0008+00 0/1 0/0 0/0 .rodata @4088 */
#pragma push
#pragma force_active on
SECTION_RODATA static u8 const lit_4088[8] = {
0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
COMPILER_STRIP_GATE(0x80BF6DE4, &lit_4088);
#pragma pop
/* 80BF6AE0-80BF6DB0 000840 02D0+00 1/0 0/0 0/0 .text daObj_Gb_Create__FP10fopAc_ac_c */
static void daObj_Gb_Create(fopAc_ac_c* param_0) {
// NONMATCHING
}
/* 80BF6DB0-80BF6DB4 000B10 0004+00 1/1 0/0 0/0 .text __ct__4cXyzFv */
// cXyz::cXyz() {
extern "C" void __ct__4cXyzFv() {
/* empty function */
}
/* 80BF6DEC-80BF6DEC 000030 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */