mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-05 12:53:36 -04:00
Cleanup the 3 path/point structs
This commit is contained in:
+34
-34
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user