From 7748957998ba508a63ac3c261aa61cc634cadbc3 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sun, 3 Dec 2023 22:39:52 -0500 Subject: [PATCH] d_a_ghostship OK --- configure.py | 2 +- include/d/actor/d_a_ghostship.h | 2 +- src/d/actor/d_a_ghostship.cpp | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/configure.py b/configure.py index 54292f008..445fe6d6e 100644 --- a/configure.py +++ b/configure.py @@ -1619,7 +1619,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_wz"), ActorRel(NonMatching, "d_a_ygcwp"), ActorRel(NonMatching, "d_a_yougan"), - ActorRel(NonMatching, "d_a_ghostship", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(Matching, "d_a_ghostship", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_movie_player"), ] diff --git a/include/d/actor/d_a_ghostship.h b/include/d/actor/d_a_ghostship.h index 2cd8a3cb7..e68478bcc 100644 --- a/include/d/actor/d_a_ghostship.h +++ b/include/d/actor/d_a_ghostship.h @@ -25,7 +25,7 @@ public: void modeWaitInit(); void modeWait(); void modeRealize(); - bool _pathMove(cXyz*, cXyz*, cXyz*); + BOOL _pathMove(cXyz*, cXyz*, cXyz*); void modePathMoveInit(); void modePathMove(); void modeProcCall(); diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 59db2edf6..da85a9ada 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -67,8 +67,8 @@ BOOL daGhostship_c::_createHeap() { } /* 0000032C-00000368 .text pathMove_CB__FP4cXyzP4cXyzP4cXyzPv */ -static int pathMove_CB(cXyz* curPos, cXyz* curPntPos, cXyz* nextPntPos, void* i_this) { - static_cast(i_this)->_pathMove(curPos, curPntPos, nextPntPos); +static BOOL pathMove_CB(cXyz* curPos, cXyz* curPntPos, cXyz* nextPntPos, void* i_this) { + return static_cast(i_this)->_pathMove(curPos, curPntPos, nextPntPos); } /* 00000368-000003B8 .text __ct__17daGhostship_HIO_cFv */ @@ -107,25 +107,26 @@ void daGhostship_c::modeRealize() { } /* 000004E0-00000770 .text _pathMove__13daGhostship_cFP4cXyzP4cXyzP4cXyz */ -bool daGhostship_c::_pathMove(cXyz* curPos, cXyz* p_curPntPos, cXyz* p_nextPntPos) { - /* Nonmatching */ +BOOL daGhostship_c::_pathMove(cXyz* curPos, cXyz* p_curPntPos, cXyz* p_nextPntPos) { mCurPntPos = *p_curPntPos; mCurPntPos.y = current.pos.y; mNextPntPos = *p_nextPntPos; mNextPntPos.y = current.pos.y; - cXyz dist = mNextPntPos - mCurPntPos; - if(!dist.normalizeRS()) { - return true; + cXyz delta = mNextPntPos - mCurPntPos; + if(!delta.normalizeRS()) { + return TRUE; } - f32 step = speedF * fabsf(cM_scos(cLib_addCalcAngleS(¤t.angle.y, cM_atan2s(dist.x, dist.z), 8, 0x200, 8))); + s16 targetAngleY = cM_atan2s(delta.x, delta.z); + s16 angleLeftToTarget = cLib_addCalcAngleS(¤t.angle.y, targetAngleY, 8, 0x200, 8); + f32 step = speedF * fabsf(cM_scos(angleLeftToTarget)); cLib_chasePosXZ(curPos, mNextPntPos, step); if((*curPos - mNextPntPos).absXZ() < step * (g_regHIO.mChild[12].mFloatRegs[5] + 1.0f) || (*curPos - mNextPntPos).absXZ() == 0.0f) { - return true; + return TRUE; } - return false; + return FALSE; } /* 00000770-0000077C .text modePathMoveInit__13daGhostship_cFv */