diff --git a/include/d/d_path.h b/include/d/d_path.h index f5644553d..c791a10b4 100644 --- a/include/d/d_path.h +++ b/include/d/d_path.h @@ -4,27 +4,29 @@ #include "d/d_bg_s.h" #include "dolphin/types.h" -struct dPath__Point { +struct dPnt { /* 0x00 */ u8 mArg0; /* 0x01 */ u8 mArg1; /* 0x02 */ u8 mArg2; /* 0x03 */ u8 mArg3; - /* 0x04 */ cXyz mPos; + /* 0x04 */ cXyz m_position; }; struct dPath { /* 0x00 */ u16 m_num; - /* 0x02 */ u16 mNextPathId; + /* 0x02 */ u16 m_nextID; /* 0x04 */ u8 mArg0; - /* 0x05 */ u8 mLoops; + /* 0x05 */ u8 m_closed; /* 0x06 */ u8 field4_0x6; /* 0x07 */ u8 field5_0x7; - /* 0x08 */ dPath__Point* mpPnt; + /* 0x08 */ dPnt* m_points; }; -dPath__Point* dPath_GetPnt(dPath*, int); +inline BOOL dPath_ChkClose(dPath* i_path) { return i_path->m_closed & 1; } + dPath* dPath_GetRoomPath(int, int); dPath* dPath_GetNextRoomPath(dPath*, int); +dPnt* dPath_GetPnt(dPath*, int); bool dPath_GetPolyRoomPathVec(cBgS_PolyInfo&, cXyz*, int*); #endif /* D_PATH_H */ diff --git a/include/d/d_stage.h b/include/d/d_stage.h index d604b820b..0e5e7aba3 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -26,6 +26,7 @@ enum StageType { /* 0x08 */ dStageType_UNKNOWN_8_e, }; +// Virt class stage_vrbox_info_class { public: /* 0x00 */ u32 field_0x00; @@ -260,6 +261,7 @@ struct stage_sound_data { /* 0x1A */ u8 field_0x1a; }; // Size: 0x1C +// SOND struct dStage_SoundInfo_c { /* 0x0 */ int num; /* 0x4 */ stage_sound_data* m_entries; @@ -271,12 +273,11 @@ public: /* 0x4 */ f32 mSeaLevel; }; +// PPNT / RPPN +struct dPnt; struct dStage_dPnt_c { - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 field_0x1; - /* 0x2 */ u8 field_0x2; - /* 0x3 */ u8 field_0x3; - /* 0x4 */ cXyz m_position; + /* 0x0 */ int num; + /* 0x4 */ u32 m_pnt_offset; }; // Size: 0x10 struct dStage_FloorInfo_entry_c { diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index 9b5021806..1715a7e2a 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -977,11 +977,11 @@ static void path_check(bk_class* i_this, u8 r19) { sp18.y += 100.0f; cXyz spc; - dPath__Point* pnt = i_this->ppd->mpPnt; + dPnt* pnt = i_this->ppd->m_points; for (int i = 0; i < i_this->ppd->m_num; i++, pnt++) { - spc.x = pnt->mPos.x; - spc.y = pnt->mPos.y + 100.0f; - spc.z = pnt->mPos.z; + spc.x = pnt->m_position.x; + spc.y = pnt->m_position.y + 100.0f; + spc.z = pnt->m_position.z; linChk.Set(&sp18, &spc, i_actor); if (!dComIfG_Bgsp()->LineCross(&linChk)) { sp90[i] = 1; @@ -993,14 +993,14 @@ static void path_check(bk_class* i_this, u8 r19) { f32 f0 = 0.0f; bool r6 = false; for (int i2 = 0; i2 < 100; i2++, f0 += 50.0f) { - pnt = i_this->ppd->mpPnt; + pnt = i_this->ppd->m_points; for (int j = 0; j < i_this->ppd->m_num; j++, pnt++) { if (sp90[j] == 0) { continue; } - f32 distX = i_this->current.pos.x - pnt->mPos.x; - f32 distY = i_this->current.pos.y - pnt->mPos.y; - f32 distZ = i_this->current.pos.z - pnt->mPos.z; + f32 distX = i_this->current.pos.x - pnt->m_position.x; + f32 distY = i_this->current.pos.y - pnt->m_position.y; + f32 distZ = i_this->current.pos.z - pnt->m_position.z; if (std::sqrtf(distX*distX + distY*distY + distZ*distZ) < f0) { if (r19) { i_this->m1216 = j; @@ -1062,22 +1062,22 @@ static void jyunkai(bk_class* i_this) { if (i_this->m1215 != 0) { i_this->m1216 += i_this->m1217; if (i_this->m1216 >= (s8)i_this->ppd->m_num) { - if (i_this->ppd->mLoops & 1) { + if (dPath_ChkClose(i_this->ppd)) { i_this->m1216 = 0; } else { i_this->m1217 = -1; i_this->m1216 = i_this->ppd->m_num - 2; } - if ((i_this->ppd->mNextPathId & 0xFFFF) != 0xFFFF) { - i_this->ppd = dPath_GetRoomPath(i_this->ppd->mNextPathId, fopAcM_GetRoomNo(i_this)); + if ((i_this->ppd->m_nextID & 0xFFFF) != 0xFFFF) { + i_this->ppd = dPath_GetRoomPath(i_this->ppd->m_nextID, fopAcM_GetRoomNo(i_this)); JUT_ASSERT(VERSION_SELECT(2907, 2924, 2924), i_this->ppd != NULL); } } else if (i_this->m1216 < 0) { i_this->m1217 = 1; i_this->m1216 = 1; } - dPath__Point* point = &i_this->ppd->mpPnt[i_this->m1216]; - i_this->m0320 = point->mPos; + dPnt* point = &i_this->ppd->m_points[i_this->m1216]; + i_this->m0320 = point->m_position; } else { way_pos_check(i_this, &i_this->m0320); } @@ -1104,7 +1104,7 @@ static void jyunkai(bk_class* i_this) { if (i_this->m1215 != 0 && (i_this->m0B30 != 0 || i_this->m11F3 != 0)) { if (std::sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f) { - if (i_this->ppd->mpPnt[i_this->m1216].mArg3 == 3) { + if (i_this->ppd->m_points[i_this->m1216].mArg3 == 3) { wait_set(i_this); i_this->dr.m004 = 2; } else { @@ -1541,8 +1541,8 @@ static void stand2(bk_class* i_this) { } break; case 52: { - dPath__Point* pnt = &i_this->ppd->mpPnt[i_this->m1216]; - i_this->m0320 = pnt->mPos; + dPnt* pnt = &i_this->ppd->m_points[i_this->m1216]; + i_this->m0320 = pnt->m_position; sp24 = i_this->m0320 - i_this->current.pos; goto temp_568; } @@ -1619,9 +1619,9 @@ static void path_run(bk_class* i_this) { i_this->dr.m004 = 1; // Fall-through case 1: - dPath__Point* point = &i_this->ppd->mpPnt[i_this->m1216]; - f32 x = point->mPos.x + i_this->m0320.x; - f32 z = point->mPos.z + i_this->m0320.z; + dPnt* point = &i_this->ppd->m_points[i_this->m1216]; + f32 x = point->m_position.x + i_this->m0320.x; + f32 z = point->m_position.z + i_this->m0320.z; cXyz sp0C; sp0C.x = x - i_this->current.pos.x; sp0C.z = z - i_this->current.pos.z; @@ -1848,7 +1848,7 @@ static void fight_run(bk_class* i_this) { anm_init(i_this, BK_BCK_BK_JUMP1, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f, BK_BAS_BK_JUMP1); i_this->speed.y = 65.0f + cM_rndF(10.0f + REG8_F(7)) + REG8_F(8); if ((i_this->m02DD & 0xC) == 0) { - s16 temp = cM_rndFX(3000.0f + REG6_F(13));; + s16 temp = cM_rndFX(3000.0f + REG6_F(13)); i_this->current.angle.y += temp; } fopAcM_monsSeStart(i_this, JA_SE_CV_BK_JUMP, 0); @@ -3815,18 +3815,18 @@ static void waki_set(bk_class* i_this) { cXyz sp2C; u8 sp38[0x100]; - dPath__Point* pnt; + dPnt* pnt; int i; int pnt_idx; sp2C = camera->mLookat.mCenter - camera->mLookat.mEye; cXyz sp20; s16 r27_1 = cM_atan2s(sp2C.x, sp2C.z); - pnt = i_this->ppd->mpPnt; + pnt = i_this->ppd->m_points; for (int i = 0; i < i_this->ppd->m_num; i++, pnt++) { - sp2C.x = pnt->mPos.x - camera->mLookat.mEye.x; - sp2C.y = pnt->mPos.y - camera->mLookat.mEye.y; - sp2C.z = pnt->mPos.z - camera->mLookat.mEye.z; + sp2C.x = pnt->m_position.x - camera->mLookat.mEye.x; + sp2C.y = pnt->m_position.y - camera->mLookat.mEye.y; + sp2C.z = pnt->m_position.z - camera->mLookat.mEye.z; cMtx_YrotS(*calc_mtx, -r27_1); MtxPosition(&sp2C, &sp20); if (sp20.z < 0.0f) { @@ -3841,12 +3841,12 @@ static void waki_set(bk_class* i_this) { int r27 = -1; int r24 = 0; for (; r24 < 100; r24++, f29 += 100.0f) { - pnt = i_this->ppd->mpPnt; + pnt = i_this->ppd->m_points; for (pnt_idx = 0; pnt_idx < i_this->ppd->m_num; pnt_idx++, pnt++) { if (sp38[pnt_idx] == 0) { continue; } - sp2C.x = player->current.pos.x - pnt->mPos.x; - sp2C.y = player->current.pos.y - pnt->mPos.y; - sp2C.z = player->current.pos.z - pnt->mPos.z; + sp2C.x = player->current.pos.x - pnt->m_position.x; + sp2C.y = player->current.pos.y - pnt->m_position.y; + sp2C.z = player->current.pos.z - pnt->m_position.z; if (sp2C.abs() < f29) { r27 = pnt_idx; r23 = true; @@ -3862,12 +3862,12 @@ static void waki_set(bk_class* i_this) { r23 = false; r24 = 0; for (; r24 < 100; r24++, f29 += 100.0f) { - pnt = i_this->ppd->mpPnt; + pnt = i_this->ppd->m_points; for (pnt_idx = 0; pnt_idx < i_this->ppd->m_num; pnt_idx++, pnt++) { if (sp38[pnt_idx] == 0) { continue; } - sp2C.x = player->current.pos.x - pnt->mPos.x; - sp2C.y = player->current.pos.y - pnt->mPos.y; - sp2C.z = player->current.pos.z - pnt->mPos.z; + sp2C.x = player->current.pos.x - pnt->m_position.x; + sp2C.y = player->current.pos.y - pnt->m_position.y; + sp2C.z = player->current.pos.z - pnt->m_position.z; if (sp2C.abs() > f29 && sp2C.abs() < f29 + 200.0f && r27 != pnt_idx) { r23 = true; break; @@ -3880,7 +3880,7 @@ static void waki_set(bk_class* i_this) { if (r23 && r27 >= 0) { fopAcM_prm_class* params = fopAcM_CreateAppend(); - params->mPos = pnt->mPos; + params->mPos = pnt->m_position; params->mAngle.x = 0; params->mAngle.z = pnt_idx; if (r27 > pnt_idx) { diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp index 3c67740ac..b4f24ebeb 100644 --- a/src/d/actor/d_a_kytag02.cpp +++ b/src/d/actor/d_a_kytag02.cpp @@ -26,9 +26,9 @@ dPath* set_next_path_info(kytag02_class* i_this, dPath* path) { /* 000000F0-0000017C .text get_railwind_vec__FP5dPathi */ cXyz get_railwind_vec(dPath* path, int i_no) { /* Nonmatching */ - dPath__Point* pnt = path->mpPnt; - cXyz p0 = pnt[i_no].mPos; - cXyz p1 = pnt[i_no + 1].mPos; + dPnt* pnt = path->m_points; + cXyz p0 = pnt[i_no].m_position; + cXyz p1 = pnt[i_no + 1].m_position; cXyz ret; dKyr_get_vectle_calc(&p0, &p1, &ret); return ret; @@ -49,8 +49,8 @@ dPath* get_nearpos_rail(kytag02_class* i_this, dPath* i_path, cXyz* pos, int* i_ while (true) { for (s32 i = 0; i < path->m_num; i++) { - f32 dx = path->mpPnt[i].mPos.x - pos->x; - f32 dz = path->mpPnt[i].mPos.z - pos->z; + f32 dx = path->m_points[i].m_position.x - pos->x; + f32 dz = path->m_points[i].m_position.z - pos->z; f32 dist = std::sqrtf(dx*dx + dz*dz); if (best > dist) { bestPath = path; @@ -59,7 +59,7 @@ dPath* get_nearpos_rail(kytag02_class* i_this, dPath* i_path, cXyz* pos, int* i_ } } - if (path->mNextPathId == 0xFFFF) + if (path->m_nextID == 0xFFFF) break; path = set_next_path_info(i_this, path); } @@ -78,7 +78,7 @@ void windtag_move(kytag02_class* i_this) { dPath* path = get_nearpos_rail(i_this, i_this->mpPath, &player->current.pos, &i_no); i_this->mWindVec = get_railwind_vec(path, i_no); g_env_light.mWind.mpWindVecOverride = &i_this->mWindVec; - dPath__Point* pnt = &path->mpPnt[i_no]; + dPnt* pnt = &path->m_points[i_no]; u32 strength = (s32)pnt->mArg3 != 0xFF ? pnt->mArg3 : path->mArg0; g_env_light.mWind.mWindStrengthOverride = (f32)strength / 100.0f; } diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index 3e5a519b1..68a9c9fcd 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -456,8 +456,8 @@ void daNpc_Btsw2_c::pathMove() { } else { pathPntIdx = 0; } - dPath__Point* pnt = &mpPath->mpPnt[pathPntIdx]; - cXyz targetPos(pnt->mPos.x, pnt->mPos.y, pnt->mPos.z); + dPnt* pnt = &mpPath->m_points[pathPntIdx]; + cXyz targetPos(pnt->m_position.x, pnt->m_position.y, pnt->m_position.z); s16 targetAngle = cLib_targetAngleY(¤t.pos, &targetPos); cLib_addCalcAngleS2(¤t.angle.y, targetAngle, l_HIO.m32, l_HIO.m30); cXyz sp48 = targetPos - current.pos; diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 925878835..448ba49d1 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1156,9 +1156,9 @@ namespace daObjMovebox { } mpPath = dPath_GetRoomPath(pathId, home.roomNo); - dPath__Point* pnt = dPath_GetPnt(mpPath, pntIdx); - home.pos = pnt->mPos; - current.pos = pnt->mPos; + dPnt* pnt = dPath_GetPnt(mpPath, pntIdx); + home.pos = pnt->m_position; + current.pos = pnt->m_position; } } @@ -1183,7 +1183,7 @@ namespace daObjMovebox { s32 pntIdx; for (pntIdx = 0; pntIdx < numPnts; pntIdx++) { - cXyz pntPos = dPath_GetPnt(mpPath, pntIdx)->mPos; + cXyz pntPos = dPath_GetPnt(mpPath, pntIdx)->m_position; if (current.pos.abs2(pntPos) < 9.0f) { break; } diff --git a/src/d/actor/d_a_pw.cpp b/src/d/actor/d_a_pw.cpp index 034c99469..fd71f499a 100644 --- a/src/d/actor/d_a_pw.cpp +++ b/src/d/actor/d_a_pw.cpp @@ -344,9 +344,9 @@ void action_dousa(pw_class* i_this) { if (i_this->mPathIndex != 0xFF && i_this->mpPath != NULL) { i_this->speedF = 5.0f; move_sound(i_this); - dPath__Point* pnt = &i_this->mpPath->mpPnt[i_this->mPathPntIdx]; - f32 delta_x = pnt->mPos.x - i_this->current.pos.x; - f32 delta_z = pnt->mPos.z - i_this->current.pos.z; + dPnt* pnt = &i_this->mpPath->m_points[i_this->mPathPntIdx]; + f32 delta_x = pnt->m_position.x - i_this->current.pos.x; + f32 delta_z = pnt->m_position.z - i_this->current.pos.z; i_this->m38C = cM_atan2s(delta_x, delta_z); f32 dist_xz = std::sqrtf(delta_x*delta_x + delta_z*delta_z); if (dist_xz < 80.0f) { diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index d0b30d9c2..91c346272 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -931,7 +931,7 @@ void daShip_c::setYPos() { /* 00002824-00002CC4 .text checkOutRange__8daShip_cFv */ BOOL daShip_c::checkOutRange() { - dPath__Point* pnt; + dPnt* pnt; dPath* path; cXyz* closestPoint; cXyz* nextPoint; @@ -951,7 +951,7 @@ BOOL daShip_c::checkOutRange() { bVar5 = dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_SEA_e; path = dPath_GetRoomPath(m034B, -1); while (path) { - pnt = path->mpPnt; + pnt = path->m_points; if (path->m_num < 3) { path = dPath_GetNextRoomPath(path, -1); pathIndex++; @@ -972,32 +972,32 @@ BOOL daShip_c::checkOutRange() { float minDist = FLOAT_MAX; for (int i = 0; i < path->m_num; pnt++, i++) { - float dx = current.pos.x - pnt->mPos.x; - float dz = current.pos.z - pnt->mPos.z; + float dx = current.pos.x - pnt->m_position.x; + float dz = current.pos.z - pnt->m_position.z; float distXZ = dx * dx + dz * dz; if (minDist > distXZ) { closestIndex = i; minDist = distXZ; - closestPoint = &pnt->mPos; + closestPoint = &pnt->m_position; } } lastIndex = path->m_num - 1; if (closestIndex == lastIndex) { - nextPoint = &path->mpPnt->mPos; + nextPoint = &path->m_points->m_position; } else { - nextPoint = &(path->mpPnt + closestIndex + 1)->mPos; + nextPoint = &(path->m_points + closestIndex + 1)->m_position; } if (closestIndex == 0) { - prevPoint = &(path->mpPnt + lastIndex)->mPos; + prevPoint = &(path->m_points + lastIndex)->m_position; } else { - prevPoint = &(path->mpPnt + closestIndex - 1)->mPos; + prevPoint = &(path->m_points + closestIndex - 1)->m_position; } s16 angleNext = cM_atan2s(nextPoint->x - closestPoint->x, nextPoint->z - closestPoint->z); diff --git a/src/d/actor/d_a_tag_island.cpp b/src/d/actor/d_a_tag_island.cpp index d558387c6..91bd9e811 100644 --- a/src/d/actor/d_a_tag_island.cpp +++ b/src/d/actor/d_a_tag_island.cpp @@ -314,9 +314,9 @@ void daTag_Island_c::demoProcCom_ikada() { ikada->mCurPathP0 = ikada->mInitPos; ikada->current.pos = ikada->mCurPathP0; ikada->mCurPathPoint = 0; - ikada->m02CC = ikada->mpPath->mpPnt[ikada->mCurPathPoint].mPos; - ikada->mCurPathP1 = ikada->mpPath->mpPnt[ikada->mCurPathPoint + 1].mPos; - ikada->mPathPosTarget = ikada->mpPath->mpPnt[ikada->mCurPathPoint].mPos; + ikada->m02CC = ikada->mpPath->m_points[ikada->mCurPathPoint].m_position; + ikada->mCurPathP1 = ikada->mpPath->m_points[ikada->mCurPathPoint + 1].m_position; + ikada->mPathPosTarget = ikada->mpPath->m_points[ikada->mCurPathPoint].m_position; } } diff --git a/src/d/actor/d_a_wind_tag.cpp b/src/d/actor/d_a_wind_tag.cpp index acd739de7..04ee663a1 100644 --- a/src/d/actor/d_a_wind_tag.cpp +++ b/src/d/actor/d_a_wind_tag.cpp @@ -147,8 +147,8 @@ void daWindTag::daWindTag_c::CreateInit() { if (mpPath != NULL) { mPathPointDir = 1; mCurPathPoint = 1; - mTargetPos = mpPath->mpPnt[mCurPathPoint].mPos; - current.pos = mpPath->mpPnt[0].mPos; + mTargetPos = mpPath->m_points[mCurPathPoint].m_position; + current.pos = mpPath->m_points[0].m_position; speedF = 10.0f + ((fopAcM_GetParam(this) >> 16) & 0x1F); } else { mPathId = 0xFF; @@ -277,7 +277,7 @@ void daWindTag::daWindTag_c::set_next_pnt() { return; mCurPathPoint += mPathPointDir; - if (mpPath->mLoops & 1) { + if (dPath_ChkClose(mpPath)) { if (mCurPathPoint > mpPath->m_num - 1) { mCurPathPoint = 0; } else if (mCurPathPoint < 0) { @@ -293,7 +293,7 @@ void daWindTag::daWindTag_c::set_next_pnt() { } } - mTargetPos = mpPath->mpPnt[mCurPathPoint].mPos; + mTargetPos = mpPath->m_points[mCurPathPoint].m_position; } /* 00001700-00001814 .text _draw__Q29daWindTag11daWindTag_cFv */ diff --git a/src/d/d_envse.cpp b/src/d/d_envse.cpp index 2ff9fa85c..f0d5f60db 100644 --- a/src/d/d_envse.cpp +++ b/src/d/d_envse.cpp @@ -33,24 +33,24 @@ void dEnvSe_getNearPathPos(cXyz* r30, cXyz* r31, dPath* r26) { cXyz sp30[2]; f32 sp8; f32 f31 = FLOAT_MAX; - dPath__Point* point = r26->mpPnt; + dPnt* point = r26->m_points; cM3dGLin lin; for (i = 0; i < r26->m_num; point++, i++) { - sp8 = r31->abs2(point->mPos); + sp8 = r31->abs2(point->m_position); if (f31 > sp8) { f31 = sp8; nearIdx = i; } } - point = &r26->mpPnt[nearIdx]; + point = &r26->m_points[nearIdx]; if (nearIdx != 0) { - lin.set(point[-1].mPos, point[0].mPos); + lin.set(point[-1].m_position, point[0].m_position); spc[0] = cM3d_Len3dSqPntAndSegLine(&lin, r31, &sp30[0], &sp8); } if (nearIdx != r26->m_num-1) { - lin.set(point[0].mPos, point[1].mPos); + lin.set(point[0].m_position, point[1].m_position); spc[1] = cM3d_Len3dSqPntAndSegLine(&lin, r31, &sp30[1], &sp8); } @@ -68,7 +68,7 @@ void dEnvSe_getNearPathPos(cXyz* r30, cXyz* r31, dPath* r26) { if (spc[1]) { *r30 = sp30[1]; } else { - *r30 = point[0].mPos;; + *r30 = point[0].m_position; } } } diff --git a/src/d/d_lib.cpp b/src/d/d_lib.cpp index 5060d4f24..3d98e5044 100644 --- a/src/d/d_lib.cpp +++ b/src/d/d_lib.cpp @@ -206,8 +206,8 @@ void dLib_pathMove(cXyz* pos, s8* pPntNo, dPath* pPath, f32 speed, int (*pCallBa } else { pnt_next_no = 0; } - cXyz pnt_pos = pPath->mpPnt[pnt_no].mPos; - cXyz pnt_next_pos = pPath->mpPnt[pnt_next_no].mPos; + cXyz pnt_pos = pPath->m_points[pnt_no].m_position; + cXyz pnt_next_pos = pPath->m_points[pnt_next_no].m_position; cXyz move = (pnt_next_pos - pnt_pos).normZP(); if (pCallBack == NULL) { diff --git a/src/d/d_magma.cpp b/src/d/d_magma.cpp index 487ab31e7..837be2d6f 100644 --- a/src/d/d_magma.cpp +++ b/src/d/d_magma.cpp @@ -126,9 +126,9 @@ void dMagma_ballPath_c::setup(f32 offsY, u8 pathNo, int roomNo) { /* Nonmatching */ dPath* path = dPath_GetRoomPath(pathNo, roomNo); s32 ptNo = (s32)cM_rndF(path->m_num - 1); - dPath__Point* pt = &path->mpPnt[ptNo]; - mPos.x = pt->mPos.x + cM_rndFX(pt->mArg3 * 100.0f); - mPos.z = pt->mPos.z + cM_rndFX(pt->mArg3 * 100.0f); + dPnt* pt = &path->m_points[ptNo]; + mPos.x = pt->m_position.x + cM_rndFX(pt->mArg3 * 100.0f); + mPos.z = pt->m_position.z + cM_rndFX(pt->mArg3 * 100.0f); mScale = cM_rndF(1.0f) + 1.0f; mBaseY = offsY - cM_rndF(20.0f); mWave = cM_rndF(8.0f) * 4096.0f; @@ -424,7 +424,7 @@ dMagma_floor_c* dMagma_packet_c::newFloor(cXyz& p0, cXyz& p1, int i_roomNo, s16 if (path == NULL) return NULL; - dPath__Point* pnt = path->mpPnt; + dPnt* pnt = path->m_points; for (s32 j = 0; j < path->m_num; j++) param += (s32)(pnt->mArg3 * 4.0f); // bug? forgot to increment pnt } diff --git a/src/d/d_npc.cpp b/src/d/d_npc.cpp index a6f13afd1..074aba545 100644 --- a/src/d/d_npc.cpp +++ b/src/d/d_npc.cpp @@ -184,7 +184,7 @@ cXyz dNpc_PathRun_c::getPoint(u8 pointIdx) { cXyz point(0.0f, 0.0f, 0.0f); if(mPath != 0 && pointIdx < mPath->m_num) { - point = mPath->mpPnt[pointIdx].mPos; + point = mPath->m_points[pointIdx].m_position; } return point; @@ -195,19 +195,19 @@ bool dNpc_PathRun_c::chkPointPass(cXyz currPos, bool goingForwards) { bool passed = false; if (mPath) { cXyz target; - target.x = mPath->mpPnt[mCurrPointIndex].mPos.x; - target.z = mPath->mpPnt[mCurrPointIndex].mPos.z; + target.x = mPath->m_points[mCurrPointIndex].m_position.x; + target.z = mPath->m_points[mCurrPointIndex].m_position.z; f32 deltaX; f32 deltaZ; if (mCurrPointIndex == 0) { - deltaX = mPath->mpPnt[1].mPos.x - mPath->mpPnt[0].mPos.x; - deltaZ = mPath->mpPnt[1].mPos.z - mPath->mpPnt[0].mPos.z; + deltaX = mPath->m_points[1].m_position.x - mPath->m_points[0].m_position.x; + deltaZ = mPath->m_points[1].m_position.z - mPath->m_points[0].m_position.z; } else if (mCurrPointIndex == mPath->m_num - 1) { - deltaX = mPath->mpPnt[mPath->m_num - 1].mPos.x - mPath->mpPnt[mPath->m_num - 2].mPos.x; - deltaZ = mPath->mpPnt[mPath->m_num - 1].mPos.z - mPath->mpPnt[mPath->m_num - 2].mPos.z; + deltaX = mPath->m_points[mPath->m_num - 1].m_position.x - mPath->m_points[mPath->m_num - 2].m_position.x; + deltaZ = mPath->m_points[mPath->m_num - 1].m_position.z - mPath->m_points[mPath->m_num - 2].m_position.z; } else { - deltaX = mPath->mpPnt[mCurrPointIndex + 1].mPos.x - mPath->mpPnt[mCurrPointIndex - 1].mPos.x; - deltaZ = mPath->mpPnt[mCurrPointIndex + 1].mPos.z - mPath->mpPnt[mCurrPointIndex - 1].mPos.z; + deltaX = mPath->m_points[mCurrPointIndex + 1].m_position.x - mPath->m_points[mCurrPointIndex - 1].m_position.x; + deltaZ = mPath->m_points[mCurrPointIndex + 1].m_position.z - mPath->m_points[mCurrPointIndex - 1].m_position.z; } f32 f29 = cM_ssin(cM_atan2s(deltaX, deltaZ)) * (f32)0x7FFF; @@ -258,7 +258,7 @@ bool dNpc_PathRun_c::incIdxAuto() { bool hitEnd = true; if(mPath != 0) { - if(mPath->mLoops & 1) { + if(dPath_ChkClose(mPath)) { mCurrPointIndex += 1; if(mCurrPointIndex >= mPath->m_num) { mCurrPointIndex = 0; @@ -311,7 +311,7 @@ bool dNpc_PathRun_c::decIdxAuto() { bool hitEnd = true; if(mPath != 0) { - if(mPath->mLoops & 1) { + if(dPath_ChkClose(mPath)) { mCurrPointIndex -= 1; if(mCurrPointIndex >= mPath->m_num) { mCurrPointIndex = mPath->m_num - 1; @@ -405,7 +405,7 @@ u8 dNpc_PathRun_c::maxPoint() { u8 dNpc_PathRun_c::pointArg(u8 idx) { u8 arg = 0; if(mPath != 0 && idx < (u8)mPath->m_num) { - arg = mPath->mpPnt[idx].mArg3; + arg = mPath->m_points[idx].mArg3; } return arg; diff --git a/src/d/d_path.cpp b/src/d/d_path.cpp index 10596350f..fd92df6db 100644 --- a/src/d/d_path.cpp +++ b/src/d/d_path.cpp @@ -8,14 +8,14 @@ #include "JSystem/JUtility/JUTAssert.h" /* 80080018-8008010C .text dPath_GetPnt__FP5dPathi */ -dPath__Point* dPath_GetPnt(dPath* path, int pnt_index) { +dPnt* dPath_GetPnt(dPath* path, int pnt_index) { JUT_ASSERT(30, path != NULL); JUT_ASSERT(31, 0 <= pnt_index && pnt_index < path->m_num); - if (path == NULL || path->mpPnt == NULL || 0 > pnt_index || pnt_index >= path->m_num) + if (path == NULL || path->m_points == NULL || 0 > pnt_index || pnt_index >= path->m_num) return NULL; else - return &path->mpPnt[pnt_index]; + return &path->m_points[pnt_index]; } /* 8008010C-80080218 .text dPath_GetRoomPath__Fii */ @@ -49,7 +49,7 @@ dPath* dPath_GetNextRoomPath(dPath* path, int room_no) { pd = pRoom->getPath2Inf(); } - s32 next_id = path->mNextPathId; + s32 next_id = path->m_nextID; if (pd == NULL || (next_id & 0xFFFF) == 0xFFFF) { return NULL; } else { @@ -85,16 +85,15 @@ bool dPath_GetPolyRoomPathVec(cBgS_PolyInfo& polyInfo, cXyz* pDstPos, int* pDstA if (pnt_no == 0xFF || pnt_no < 0 || pnt_no >= path->m_num) return FALSE; - dPath__Point *point = &path->mpPnt[pnt_no]; - dPath__Point *next_point; + dPnt *point = &path->m_points[pnt_no]; + dPnt *next_point; if (pnt_no == path->m_num - 1) - next_point = &path->mpPnt[0]; + next_point = &path->m_points[0]; else - next_point = &path->mpPnt[pnt_no + 1]; - pDstPos->x = next_point->mPos.x - point->mPos.x; - pDstPos->y = next_point->mPos.y - point->mPos.y; - pDstPos->z = next_point->mPos.z - point->mPos.z; + next_point = &path->m_points[pnt_no + 1]; + pDstPos->x = next_point->m_position.x - point->m_position.x; + pDstPos->y = next_point->m_position.y - point->m_position.y; + pDstPos->z = next_point->m_position.z - point->m_position.z; *pDstArg0 = path->mArg0; return TRUE; } - diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 9eeb12eab..45fc7e8fa 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -1758,7 +1758,7 @@ int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { i_stage->setPathInfo(pStagePath); for (s32 i = 0; i < pStagePath->num; pPath++, i++) - pPath->mpPnt = (dPath__Point*)((u32)*((int*)i_stage->getPntInf()+1) + (u32)pPath->mpPnt); // TODO clean this up + pPath->m_points = (dPnt*)((u32)pPath->m_points + i_stage->getPntInf()->m_pnt_offset); return 1; } @@ -1775,7 +1775,7 @@ int dStage_rpatInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { i_stage->setPath2Info(pStagePath); for (s32 i = 0; i < pStagePath->num; pPath++, i++) - pPath->mpPnt = (dPath__Point*)((u32)*((int*)i_stage->getPnt2Inf()+1) + (u32)pPath->mpPnt); // TODO clean this up + pPath->m_points = (dPnt*)((u32)pPath->m_points + i_stage->getPnt2Inf()->m_pnt_offset); return 1; }