From b45a089e15d79821b07be020db628e01a49b1fd2 Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:56:59 -0700 Subject: some J3D/misc cleanup (#2628) * some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup --- src/d/d_stage.cpp | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/d/d_stage.cpp') diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 39ab1353a1..74c25ebacf 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -78,7 +78,7 @@ static void dStage_KeepDoorInfoProc(dStage_dt_c* i_stage, stage_tgsc_class* i_dr DoorInfo.mNum = 0; return; } - if (i_drtg->num >= (int)ARRAY_SIZE(DoorInfo.mDrTgData) || i_drtg->num < 0) { + if (i_drtg->num >= ARRAY_SIZE(DoorInfo.mDrTgData) || i_drtg->num < 0) { DoorInfo.mNum = 0; return; } @@ -1182,7 +1182,7 @@ static int createRoomScene(int param_0) { } *ptr = param_0; - if (!fopScnM_CreateReq(PROC_ROOM_SCENE, 0x7FFF, 0, (u32)ptr)) { + if (!fopScnM_CreateReq(PROC_ROOM_SCENE, 0x7FFF, 0, (uintptr_t)ptr)) { JKRHeap::free(ptr, NULL); return 0; } @@ -1205,14 +1205,14 @@ int dStage_roomControl_c::loadRoom(int roomCount, u8* rooms, bool param_2) { return 0; } - for (int roomNo = 0; roomNo < ARRAY_SIZE(mStatus); roomNo++) { + for (int roomNo = 0; roomNo < ARRAY_SIZEU(mStatus); roomNo++) { if (checkStatusFlag(roomNo, 0x02 | 0x04)) { return 0; } } BOOL r26 = TRUE; - for (int roomNo = 0; roomNo < (int)ARRAY_SIZE(mStatus); roomNo++) { + for (int roomNo = 0; roomNo < ARRAY_SIZE(mStatus); roomNo++) { if (dStage_roomControl_c::checkStatusFlag(roomNo, 0x01)) { if (!stayRoomCheck(roomCount, rooms, roomNo)) { onStatusFlag(roomNo, 0xc); @@ -1500,7 +1500,7 @@ static void dummy0() { dStage_objectNameInf* dStage_searchName(char const* objName) { dStage_objectNameInf* obj = l_objectName; - for (u32 i = 0; i < ARRAY_SIZE(l_objectName); i++) { + for (u32 i = 0; i < ARRAY_SIZEU(l_objectName); i++) { if (!strcmp(obj->mName, objName)) { return obj; } @@ -1517,7 +1517,7 @@ static const char* dStage_getName(s16 procName, s8 subtype) { dStage_objectNameInf* obj = l_objectName; char* tmp = NULL; - for (int i = 0; i < ARRAY_SIZE(l_objectName); i++) { + for (int i = 0; i < ARRAY_SIZEU(l_objectName); i++) { if (obj->mProcName == procName) { if (obj->mSubtype == subtype) { return obj->mName; @@ -2088,8 +2088,8 @@ static int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int entryNum, i_stage->setPathInfo(path_c); for (int i = 0; i < path_c->m_num; i++) { - if ((u32)path->m_points < 0x80000000) { - path->m_points = (dPnt*)((u32)path->m_points + i_stage->getPntInf()->m_pnt_offset); + if ((uintptr_t)path->m_points < 0x80000000) { + path->m_points = (dPnt*)((uintptr_t)path->m_points + i_stage->getPntInf()->m_pnt_offset); } path++; } @@ -2112,10 +2112,10 @@ static int dStage_rpatInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, vo i_stage->setPath2Info(pStagePath); for (s32 i = 0; i < pStagePath->m_num; pPath++, i++, (void)0) { - if ((u32)pPath->m_points >= 0x80000000) { + if ((uintptr_t)pPath->m_points >= 0x80000000) { continue; } - pPath->m_points = (dPnt*)((u32)pPath->m_points + i_stage->getPnt2Inf()->m_pnt_offset); + pPath->m_points = (dPnt*)((uintptr_t)pPath->m_points + i_stage->getPnt2Inf()->m_pnt_offset); } return 1; } @@ -2266,7 +2266,7 @@ static void dStage_dt_c_offsetToPtr(void* i_data) { for (int i = 0; i < file->m_chunkCount; i++) { JUT_ASSERT(3381, p_tno->m_offset != 0); if (p_tno->m_offset != 0 && p_tno->m_offset < 0x80000000) { - p_tno->m_offset += (u32)i_data; + p_tno->m_offset += (uintptr_t)i_data; } p_tno++; } @@ -2351,10 +2351,10 @@ static void readMult(dStage_dt_c* i_stage, dStage_Multi_c* multi, bool useOldRes if (dzs != NULL) { dStage_dt_c_offsetToPtr(dzs); i_stage->setRoomNo(info->mRoomNo); - dStage_dt_c_decode(dzs, i_stage, l_roomFuncTable, ARRAY_SIZE(l_roomFuncTable)); - dStage_setLayerTagName(l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable), + dStage_dt_c_decode(dzs, i_stage, l_roomFuncTable, ARRAY_SIZEU(l_roomFuncTable)); + dStage_setLayerTagName(l_layerFuncTable, ARRAY_SIZEU(l_layerFuncTable), dComIfG_play_c::getLayerNo(0)); - dStage_dt_c_decode(dzs, i_stage, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); + dStage_dt_c_decode(dzs, i_stage, l_layerFuncTable, ARRAY_SIZEU(l_layerFuncTable)); } info++; @@ -2453,7 +2453,7 @@ static void layerMemoryInfoLoader(void* i_data, dStage_dt_c* i_stage, int param_ {"MEC0", dStage_mecoInfoInit}, }; - dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); + dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable, ARRAY_SIZEU(l_layerFuncTable)); } /* 80026940-800269B4 021280 0074+00 1/1 0/0 0/0 .text @@ -2463,7 +2463,7 @@ static void dStage_dt_c_stageInitLoader(void* i_data, dStage_dt_c* i_stage) { dStage_dt_c_offsetToPtr(i_data); i_stage->init(); - dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZEU(l_funcTable)); layerMemoryInfoLoader(i_data, i_stage, -1); } @@ -2484,20 +2484,20 @@ static void layerTableLoader(void* i_data, dStage_dt_c* i_stage, int roomNo) { newRoomNo = dComIfGp_getStartStageRoomNo(); } - dStage_setLayerTagName(l_layerFuncTableA, ARRAY_SIZE(l_layerFuncTableA), + dStage_setLayerTagName(l_layerFuncTableA, ARRAY_SIZEU(l_layerFuncTableA), dComIfG_play_c::getLayerNo(0)); - dStage_dt_c_decode(i_data, i_stage, l_layerFuncTableA, ARRAY_SIZE(l_layerFuncTableA)); + dStage_dt_c_decode(i_data, i_stage, l_layerFuncTableA, ARRAY_SIZEU(l_layerFuncTableA)); dStage_Elst_c* elst = dComIfGp_getStage()->getElst(); if (elst != NULL && newRoomNo >= 0 && elst->m_entryNum > newRoomNo) { dStage_Elst_dt_c* d = elst->m_entries; int layer = dComIfG_play_c::getLayerNo(0); - dStage_setLayerTagName(l_envLayerFuncTable, ARRAY_SIZE(l_envLayerFuncTable), + dStage_setLayerTagName(l_envLayerFuncTable, ARRAY_SIZEU(l_envLayerFuncTable), d[newRoomNo].m_layerTable[layer]); - dStage_dt_c_decode(i_data, i_stage, l_envLayerFuncTable, ARRAY_SIZE(l_envLayerFuncTable)); + dStage_dt_c_decode(i_data, i_stage, l_envLayerFuncTable, ARRAY_SIZEU(l_envLayerFuncTable)); } else { - dStage_setLayerTagName(l_envLayerFuncTable, ARRAY_SIZE(l_envLayerFuncTable), 0); - dStage_dt_c_decode(i_data, i_stage, l_envLayerFuncTable, ARRAY_SIZE(l_envLayerFuncTable)); + dStage_setLayerTagName(l_envLayerFuncTable, ARRAY_SIZEU(l_envLayerFuncTable), 0); + dStage_dt_c_decode(i_data, i_stage, l_envLayerFuncTable, ARRAY_SIZEU(l_envLayerFuncTable)); } } @@ -2513,7 +2513,7 @@ static void layerActorLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { }; dStage_setLayerTagName(l_layerFuncTable, 4, dComIfG_play_c::getLayerNo(0)); - dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); + dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable, ARRAY_SIZEU(l_layerFuncTable)); } /* 80026B58-80026BBC 021498 0064+00 1/1 0/0 0/0 .text dStage_dt_c_stageLoader__FPvP11dStage_dt_c @@ -2535,7 +2535,7 @@ static void dStage_dt_c_stageLoader(void* i_data, dStage_dt_c* i_stage) { {"REVT", dStage_stEventInfoInit}, {"SOND", dStage_soundInfoInitCL}, }; - dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZEU(l_funcTable)); layerTableLoader(i_data, i_stage, -1); layerActorLoader(i_data, i_stage, -1); } @@ -2555,7 +2555,7 @@ void dStage_dt_c_roomLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { dStage_dt_c_offsetToPtr(i_data); i_stage->init(); - dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZEU(l_funcTable)); layerTableLoader(i_data, i_stage, param_2); } @@ -2569,7 +2569,7 @@ void dStage_dt_c_roomReLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { {"TGDR", dStage_tgscInfoInit}, {"REVT", dStage_mapEventInfoInit}, }; - dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZEU(l_funcTable)); layerActorLoader(i_data, i_stage, param_2); } @@ -2585,7 +2585,7 @@ void dStage_dt_c_fieldMapLoader(void* i_data, dStage_dt_c* i_stage) { JUT_ASSERT(4428, i_data != 0); dStage_dt_c_offsetToPtr(i_data); - dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZEU(l_funcTable)); } /* ############################################################################################## */ -- cgit v1.2.3