d_camera / m_Do_ext / d_particle + minor various wip (#210)

This commit is contained in:
TakaRikka
2022-10-03 15:26:26 -07:00
committed by GitHub
parent 0309490521
commit 4913395dbd
267 changed files with 5153 additions and 8112 deletions
+93 -86
View File
@@ -6,103 +6,110 @@
#include "d/d_path.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Types:
//
struct dSv_info_c {
/* 80035360 */ void isSwitch(int, int) const;
};
struct dStage_roomControl_c {
/* 80024384 */ void getStatusRoomDt(int);
};
struct dPath {};
struct cBgS_PolyInfo {};
struct dBgS {
/* 80074FE0 */ void GetRoomPathId(cBgS_PolyInfo const&);
/* 80075030 */ void GetRoomPathPntNo(cBgS_PolyInfo const&);
/* 80075100 */ void GetRoomId(cBgS_PolyInfo const&);
};
struct cXyz {};
//
// Forward References:
//
extern "C" void dPath_GetPnt__FPC5dPathi();
extern "C" void dPath_GetRoomPath__Fii();
extern "C" void dPath_GetNextRoomPath__FPC5dPathi();
extern "C" void dPath_GetPolyRoomPathVec__FRC13cBgS_PolyInfoP4cXyzPi();
//
// External References:
//
extern "C" void getStatusRoomDt__20dStage_roomControl_cFi();
extern "C" void isSwitch__10dSv_info_cCFii();
extern "C" void GetRoomPathId__4dBgSFRC13cBgS_PolyInfo();
extern "C" void GetRoomPathPntNo__4dBgSFRC13cBgS_PolyInfo();
extern "C" void GetRoomId__4dBgSFRC13cBgS_PolyInfo();
extern "C" void _savegpr_26();
extern "C" void _restgpr_26();
extern "C" extern u8 g_dComIfG_gameInfo[122384];
//
// Declarations:
//
#include "d/com/d_com_inf_game.h"
/* 800517B0-800517EC 04C0F0 003C+00 0/0 7/7 63/63 .text dPath_GetPnt__FPC5dPathi */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dPath_GetPnt(dPath const* param_0, int param_1) {
nofralloc
#include "asm/d/d_path/dPath_GetPnt__FPC5dPathi.s"
dStage_dPnt_c* dPath_GetPnt(dPath const* path, int pnt_index) {
if (path == NULL || path->m_points == NULL || pnt_index < 0 || pnt_index >= path->m_num) {
return NULL;
}
return &path->m_points[pnt_index];
}
#pragma pop
/* 800517EC-80051898 04C12C 00AC+00 1/1 12/12 82/82 .text dPath_GetRoomPath__Fii */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm u16* dPath_GetRoomPath(int param_0, int param_1) {
nofralloc
#include "asm/d/d_path/dPath_GetRoomPath__Fii.s"
dPath* dPath_GetRoomPath(int path_index, int room_no) {
dStage_dPath_c* path;
if (room_no == -1) {
path = i_dComIfGp_getStage()->getPath2Inf();
} else {
dStage_roomStatus_c* roomSt = dComIfGp_roomControl_getStatusRoomDt(room_no);
if (roomSt == NULL) {
return NULL;
}
path = roomSt->mRoomDt.getPath2Inf();
}
if (path == NULL || path_index < 0 || path_index >= path->m_num) {
return NULL;
}
return &path->m_path[path_index];
}
#pragma pop
/* 80051898-8005195C 04C1D8 00C4+00 0/0 1/1 3/3 .text dPath_GetNextRoomPath__FPC5dPathi
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dPath_GetNextRoomPath(dPath const* param_0, int param_1) {
nofralloc
#include "asm/d/d_path/dPath_GetNextRoomPath__FPC5dPathi.s"
}
#pragma pop
dPath* dPath_GetNextRoomPath(dPath const* p_path, int room_no) {
dStage_dPath_c* path;
/* ############################################################################################## */
/* 80452000-80452008 000600 0004+04 1/1 0/0 0/0 .sdata2 @3685 */
SECTION_SDATA2 static f32 lit_3685[1 + 1 /* padding */] = {
0.0f,
/* padding */
0.0f,
};
if (room_no == -1) {
path = i_dComIfGp_getStage()->getPath2Inf();
} else {
dStage_roomStatus_c* roomSt = dComIfGp_roomControl_getStatusRoomDt(room_no);
if (roomSt == NULL) {
return NULL;
}
path = roomSt->mRoomDt.getPath2Inf();
}
int next_id = p_path->m_nextID;
if (path == NULL || next_id == 0xFFFF) {
return NULL;
}
if (next_id < 0 || next_id >= path->m_num) {
return NULL;
}
return &path->m_path[next_id];
}
/* 8005195C-80051AC0 04C29C 0164+00 0/0 1/1 4/4 .text
* dPath_GetPolyRoomPathVec__FRC13cBgS_PolyInfoP4cXyzPi */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& param_0, cXyz* param_1, int* param_2) {
nofralloc
#include "asm/d/d_path/dPath_GetPolyRoomPathVec__FRC13cBgS_PolyInfoP4cXyzPi.s"
int dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) {
int roomId = dComIfG_Bgsp().GetRoomId(poly);
int roomPathId = dComIfG_Bgsp().GetRoomPathId(poly);
p_pathVec->x = 0.0f;
p_pathVec->y = 0.0f;
p_pathVec->z = 0.0f;
*param_2 = 0;
if (roomId == -1) {
return 0;
}
dPath* path = dPath_GetRoomPath(roomPathId, roomId);
if (path == NULL) {
return 0;
}
if (path->field_0x6 != 0xFF && dComIfGs_isSwitch(path->field_0x6, roomId)) {
return 0;
}
int pnt_no = dComIfG_Bgsp().GetRoomPathPntNo(poly);
if (pnt_no == 0xFF || pnt_no < 0 || pnt_no >= path->m_num) {
return 0;
}
dStage_dPnt_c* pnt_start = path->m_points;
dStage_dPnt_c* pnt_end = &pnt_start[pnt_no];
dStage_dPnt_c* pnt_begin;
if (pnt_no == path->m_num - 1) {
pnt_begin = pnt_start;
} else {
pnt_begin = &pnt_start[pnt_no + 1];
}
p_pathVec->x = pnt_begin->m_position.x - pnt_end->m_position.x;
p_pathVec->y = pnt_begin->m_position.y - pnt_end->m_position.y;
p_pathVec->z = pnt_begin->m_position.z - pnt_end->m_position.z;
*param_2 = path->field_0x4;
return 1;
}
#pragma pop