mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-11 02:53:16 -04:00
Work on d_resorce, d_vibration, d_tresure and others (#347)
* Work on d_resorce * Work on d_a_tag_TWgate * Work on d_meter_map * d_tresure OK * Work on d_vibration * Work on d_a_npc * Work on d_a_npc * Work on d_a_npc
This commit is contained in:
+69
-115
@@ -8,65 +8,28 @@
|
||||
#include "d/map/d_map_path_dmap.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "d/d_path.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void createWork__7dTres_cFv();
|
||||
extern "C" void create__7dTres_cFv();
|
||||
extern "C" void remove__7dTres_cFv();
|
||||
extern "C" void reset__7dTres_cFv();
|
||||
extern "C" void addData__7dTres_cFPQ27dTres_c10list_classSc();
|
||||
extern "C" void checkTreasureBox__7dTres_cFPQ27dTres_c6data_s();
|
||||
extern "C" void onStatus__7dTres_cFUcii();
|
||||
extern "C" void offStatus__7dTres_cFUcii();
|
||||
extern "C" void getBossIconFloorNo__7dTres_cFPi();
|
||||
extern "C" void getFirstData__7dTres_cFUc();
|
||||
extern "C" void getNextData__7dTres_cFPQ27dTres_c15typeGroupData_c();
|
||||
extern "C" void getNextData__7dTres_cFPCQ27dTres_c15typeGroupData_c();
|
||||
extern "C" void setPosition__7dTres_cFiUcPC3Veci();
|
||||
extern "C" void getTypeGroupNoToType__7dTres_cFUc();
|
||||
extern "C" void getTypeToTypeGroupNo__7dTres_cFUc();
|
||||
extern "C" u8 const typeToTypeGroup__7dTres_c[34 + 6 /* padding */];
|
||||
extern "C" u8 mTypeGroupListAll__7dTres_c[204 + 4 /* padding */];
|
||||
extern "C" u8 mTypeGroupData__7dTres_c[4];
|
||||
extern "C" u8 mNum__7dTres_c[2 + 2 /* padding */];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void mDoMtx_YrotS__FPA4_fs();
|
||||
extern "C" void isDungeonItem__12dSv_memBit_cCFi();
|
||||
extern "C" void isSwitch__10dSv_info_cCFii();
|
||||
extern "C" void correctionOriginPos__10dMapInfo_nFScP3Vec();
|
||||
extern "C" void calcFloorNo__10dMapInfo_cFfbi();
|
||||
extern "C" void dPath_GetRoomPath__Fii();
|
||||
extern "C" void* __nwa__FUl();
|
||||
extern "C" void __construct_new_array();
|
||||
extern "C" void _savegpr_26();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _restgpr_26();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_28();
|
||||
extern "C" u8 now__14mDoMtx_stack_c[48];
|
||||
extern "C" extern bool data_80450680;
|
||||
extern bool data_80450680;
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80450F98-80450F9C 000498 0004+00 2/2 0/0 0/0 .sbss mTypeGroupData__7dTres_c */
|
||||
dTres_c::typeGroupData_c* dTres_c::mTypeGroupData;
|
||||
|
||||
/* 8009BBD8-8009BC18 096518 0040+00 0/0 1/1 0/0 .text createWork__7dTres_cFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm int dTres_c::createWork() {
|
||||
nofralloc
|
||||
#include "asm/d/d_tresure/createWork__7dTres_cFv.s"
|
||||
int dTres_c::createWork() {
|
||||
mTypeGroupData = new dTres_c::typeGroupData_c[0x40];
|
||||
return 1;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 8009BC18-8009BC60 096558 0048+00 0/0 1/1 0/0 .text create__7dTres_cFv */
|
||||
void dTres_c::create() {
|
||||
@@ -82,7 +45,7 @@ void dTres_c::remove() {
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80425438-80425508 052158 00CC+04 6/6 3/3 0/0 .bss mTypeGroupListAll__7dTres_c */
|
||||
dTres_c::list_class dTres_c::mTypeGroupListAll[17];
|
||||
dTres_c::type_group_list dTres_c::mTypeGroupListAll[17];
|
||||
|
||||
/* 80450F9C-80450FA0 00049C 0002+02 2/2 0/0 0/0 .sbss mNum__7dTres_c */
|
||||
u16 dTres_c::mNum;
|
||||
@@ -103,88 +66,92 @@ void dTres_c::reset() {
|
||||
|
||||
/* 8009BCB4-8009BE28 0965F4 0174+00 0/0 1/1 0/0 .text addData__7dTres_cFPQ27dTres_c10list_classSc
|
||||
*/
|
||||
#ifdef NONMATCHING
|
||||
void dTres_c::addData(dTres_c::list_class* p_list, s8 roomNo) {
|
||||
if (dStage_stagInfo_GetSTType(i_dComIfGp_getStage()->getStagInfo()) != ST_BOSS_ROOM) {
|
||||
reset();
|
||||
|
||||
typeGroupData_c* listData = p_list->field_0x4;
|
||||
data_s* listData = p_list->field_0x4->getDataPointer();
|
||||
typeGroupData_c* groupData = &mTypeGroupData[mNum];
|
||||
for (int i = 0; i < (int)p_list->field_0x0; i++) {
|
||||
groupData->mData = listData->mData;
|
||||
groupData->mData.mRoomNo = roomNo;
|
||||
groupData->mData.mStatus = 0;
|
||||
for (int i = 0; i < p_list->field_0x0; i++, listData++, groupData++) {
|
||||
*(data_s*)groupData = *listData;
|
||||
groupData->mRoomNo = roomNo;
|
||||
groupData->mStatus = 0;
|
||||
|
||||
u8 typeGroupNo = getTypeToTypeGroupNo(groupData->mData.mType);
|
||||
u32 typeGroupNo = getTypeToTypeGroupNo(groupData->mType);
|
||||
groupData->setNextDataPointer(NULL);
|
||||
groupData->setTypeGroupNo(typeGroupNo);
|
||||
|
||||
list_class* typeGroupList = mTypeGroupListAll + typeGroupNo;
|
||||
type_group_list* typeGroupList = mTypeGroupListAll + typeGroupNo;
|
||||
if (typeGroupList->field_0x0 == NULL) {
|
||||
typeGroupList->field_0x0 = groupData;
|
||||
}
|
||||
|
||||
if (mTypeGroupListAll[i].field_0x4 != NULL) {
|
||||
mTypeGroupListAll[i].field_0x4->setNextDataPointer(groupData);
|
||||
if (typeGroupList->field_0x4 != NULL) {
|
||||
typeGroupList->field_0x4->setNextDataPointer(groupData);
|
||||
}
|
||||
mTypeGroupListAll[i].field_0x4 = groupData;
|
||||
mTypeGroupListAll[i].mNumber++;
|
||||
typeGroupList->field_0x4 = groupData;
|
||||
typeGroupList->mNumber++;
|
||||
|
||||
if ((s32)groupData->mData.mType == 0xFF) {
|
||||
checkTreasureBox(&groupData->mData);
|
||||
switch (groupData->mType) {
|
||||
case 0xFF:
|
||||
checkTreasureBox(groupData);
|
||||
break;
|
||||
}
|
||||
|
||||
mNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void dTres_c::addData(dTres_c::list_class* param_0, s8 param_1) {
|
||||
nofralloc
|
||||
#include "asm/d/d_tresure/addData__7dTres_cFPQ27dTres_c10list_classSc.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80452BE8-80452BEC 0011E8 0004+00 1/1 0/0 0/0 .sdata2 @3839 */
|
||||
SECTION_SDATA2 static f32 lit_3839 = 182.04444885253906f;
|
||||
|
||||
/* 80452BEC-80452BF0 0011EC 0004+00 1/1 0/0 0/0 .sdata2 @3840 */
|
||||
SECTION_SDATA2 static u8 lit_3840[4] = {
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
};
|
||||
|
||||
/* 80452BF0-80452BF8 0011F0 0008+00 1/1 0/0 0/0 .sdata2 @3841 */
|
||||
SECTION_SDATA2 static f64 lit_3841 = 0.5;
|
||||
|
||||
/* 80452BF8-80452C00 0011F8 0008+00 1/1 0/0 0/0 .sdata2 @3842 */
|
||||
SECTION_SDATA2 static f64 lit_3842 = 3.0;
|
||||
|
||||
/* 80452C00-80452C08 001200 0008+00 1/1 0/0 0/0 .sdata2 @3843 */
|
||||
SECTION_SDATA2 static u8 lit_3843[8] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/* 80452C08-80452C10 001208 0008+00 1/1 0/0 0/0 .sdata2 @3845 */
|
||||
SECTION_SDATA2 static f64 lit_3845 = 4503601774854144.0 /* cast s32 to float */;
|
||||
|
||||
/* 8009BE28-8009C168 096768 0340+00 1/1 0/0 0/0 .text
|
||||
* checkTreasureBox__7dTres_cFPQ27dTres_c6data_s */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void dTres_c::checkTreasureBox(dTres_c::data_s* param_0) {
|
||||
nofralloc
|
||||
#include "asm/d/d_tresure/checkTreasureBox__7dTres_cFPQ27dTres_c6data_s.s"
|
||||
void dTres_c::checkTreasureBox(dTres_c::data_s* param_0) {
|
||||
if (param_0->mSwBit != 0xff && param_0->mArg1 != 0xff){
|
||||
dPath* path = dPath_GetRoomPath(param_0->mArg1, -1);
|
||||
|
||||
if (path == NULL) return;
|
||||
|
||||
if (param_0->mArg2 == 0) {
|
||||
s16 sVar5 = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int sStack_62;
|
||||
if (dComIfGs_isSwitch(param_0->mSwBit + i, param_0->mRoomNo) != 0) {
|
||||
sStack_62 = (1 << i);
|
||||
} else {
|
||||
sStack_62 = 0;
|
||||
}
|
||||
sVar5 += sStack_62;
|
||||
}
|
||||
if (sVar5 != 0) {
|
||||
s16 uStack_34 = cM_deg2s((sVar5 - 1) * 0x18 + 12);
|
||||
cXyz cStack_48(path->m_points[0].m_position);
|
||||
cXyz cStack_54(path->m_points[path->m_num - 1].m_position);
|
||||
f32 dVar7 = cStack_48.absXZ(cStack_54);
|
||||
cXyz local_60(0.0f, 0.0f, dVar7);
|
||||
mDoMtx_stack_c::YrotS(uStack_34);
|
||||
mDoMtx_stack_c::multVec(&local_60, &local_60);
|
||||
local_60 += cStack_48;
|
||||
local_60.y = cStack_54.y;
|
||||
param_0->mPos = local_60;
|
||||
} else {
|
||||
param_0->mPos = path->m_points[0].m_position;
|
||||
}
|
||||
dMapInfo_n::correctionOriginPos(param_0->mRoomNo, ¶m_0->mPos);
|
||||
} else {
|
||||
dStage_dPnt_c* point;
|
||||
if (dComIfGs_isSwitch(param_0->mSwBit, param_0->mRoomNo)) {
|
||||
point = &path->m_points[path->m_num - 1];
|
||||
} else {
|
||||
point = &path->m_points[0];
|
||||
}
|
||||
|
||||
param_0->mPos = point->m_position;
|
||||
dMapInfo_n::correctionOriginPos(param_0->mRoomNo, ¶m_0->mPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 8009C168-8009C1F0 096AA8 0088+00 0/0 0/0 3/3 .text onStatus__7dTres_cFUcii */
|
||||
void dTres_c::onStatus(u8 listIdx, int param_1, int flag) {
|
||||
@@ -203,10 +170,9 @@ void dTres_c::onStatus(u8 listIdx, int param_1, int flag) {
|
||||
}
|
||||
|
||||
/* 8009C1F0-8009C27C 096B30 008C+00 0/0 0/0 3/3 .text offStatus__7dTres_cFUcii */
|
||||
#ifdef NONMATCHING
|
||||
void dTres_c::offStatus(u8 listIdx, int param_1, int flag) {
|
||||
typeGroupData_c* groupData = getFirstData(listIdx);
|
||||
int typeGroupNo = getTypeGroupNumber(listIdx);
|
||||
s32 typeGroupNo = getTypeGroupNumber(listIdx);
|
||||
|
||||
for (int i = 0; i < typeGroupNo; i++) {
|
||||
if (param_1 == groupData->getNo()) {
|
||||
@@ -218,16 +184,6 @@ void dTres_c::offStatus(u8 listIdx, int param_1, int flag) {
|
||||
groupData = getNextData(groupData);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void dTres_c::offStatus(u8 param_0, int param_1, int param_2) {
|
||||
nofralloc
|
||||
#include "asm/d/d_tresure/offStatus__7dTres_cFUcii.s"
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/* 8009C27C-8009C360 096BBC 00E4+00 0/0 1/1 0/0 .text getBossIconFloorNo__7dTres_cFPi */
|
||||
int dTres_c::getBossIconFloorNo(int* o_floorNo) {
|
||||
@@ -265,8 +221,7 @@ dTres_c::typeGroupData_c* dTres_c::getFirstData(u8 listIdx) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// this is wrong, fix later
|
||||
return (dTres_c::typeGroupData_c*)mTypeGroupListAll[listIdx].field_0x0;
|
||||
return mTypeGroupListAll[listIdx].field_0x0;
|
||||
}
|
||||
|
||||
/* 8009C39C-8009C3B4 096CDC 0018+00 2/2 3/3 0/0 .text
|
||||
@@ -314,12 +269,11 @@ void dTres_c::setPosition(int dataNo, u8 listIdx, Vec const* i_pos, int i_roomNo
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8037B0D8-8037B100 007738 0022+06 2/2 0/0 0/0 .rodata typeToTypeGroup__7dTres_c */
|
||||
SECTION_RODATA u8 const dTres_c::typeToTypeGroup[17][2] = {
|
||||
u8 const dTres_c::typeToTypeGroup[17][2] = {
|
||||
{0xFF, 0x00}, {0x00, 0x01}, {0x01, 0x02}, {0x02, 0x03}, {0x03, 0x04}, {0x04, 0x05},
|
||||
{0x05, 0x06}, {0x06, 0x07}, {0x07, 0x08}, {0x80, 0x09}, {0x81, 0x0A}, {0x82, 0x0B},
|
||||
{0x83, 0x0C}, {0x84, 0x0D}, {0x85, 0x0E}, {0x87, 0x0F}, {0x88, 0x10},
|
||||
};
|
||||
COMPILER_STRIP_GATE(0x8037B0D8, &dTres_c::typeToTypeGroup);
|
||||
|
||||
/* 8009C49C-8009C4B0 096DDC 0014+00 0/0 1/1 0/0 .text getTypeGroupNoToType__7dTres_cFUc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user