mirror of
https://github.com/zeldaret/tww.git
synced 2024-11-26 23:01:24 +00:00
cleanup daPy_sightPacket_c inlines, match setHookshotSight
This commit is contained in:
parent
a3560350c7
commit
55ad93af06
@ -9,7 +9,7 @@
|
||||
#include "d/d_drawlist.h"
|
||||
#include "d/d_bg_w.h"
|
||||
#include "d/actor/d_a_player.h"
|
||||
#include "d/res/res_link.h"
|
||||
#include "d/res/res_link.h" // IWYU pragma: export
|
||||
#include "d/res/res_lkanm.h"
|
||||
|
||||
class mDoExt_MtxCalcOldFrame;
|
||||
@ -37,28 +37,23 @@ public:
|
||||
void onDrawFlg() { mDrawFlag = true; }
|
||||
void offDrawFlg() { mDrawFlag = false; }
|
||||
bool getLockFlg() { return mLockFlag; }
|
||||
void onLockFlg() { mLockFlag = true; }
|
||||
void onLockFlg() {
|
||||
mLockFlag = true;
|
||||
mFrame = 0;
|
||||
}
|
||||
void offLockFlg() { mLockFlag = false; }
|
||||
void setPos(const cXyz* i_pos) { mPos = *i_pos; }
|
||||
void setSightTex(void* sightTex) { mpSightTex = sightTex; }
|
||||
void setLockTex(void* lockTex) { mpLockTex = lockTex; }
|
||||
void setImage(ResTIMG* image) { mpImg = image; }
|
||||
u8 checkSEFrame() { return mFrame; }
|
||||
bool checkSEFrame() {
|
||||
// This implementation might be incomplete, debug map says it's 0x18 bytes but this line is only 0x10 bytes.
|
||||
return mFrame == 0;
|
||||
}
|
||||
void incFrame() {
|
||||
if(getLockFlg()) {
|
||||
mFrame++;
|
||||
if(checkSEFrame() == 26) {
|
||||
mFrame = 0;
|
||||
}
|
||||
|
||||
if(checkSEFrame() == 0) {
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
onLockFlg();
|
||||
mFrame++;
|
||||
if(mFrame == 26) {
|
||||
mFrame = 0;
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
* a function from this file.
|
||||
*/
|
||||
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
#include "d/actor/d_a_hookshot.h"
|
||||
#include "d/actor/d_a_player_HIO.h"
|
||||
#include "d/actor/d_a_player_main.h"
|
||||
@ -32,7 +33,59 @@ void daPy_lk_c::setHookshotModel() {
|
||||
|
||||
/* 8014ACCC-8014B02C .text setHookshotSight__9daPy_lk_cFv */
|
||||
void daPy_lk_c::setHookshotSight() {
|
||||
/* Nonmatching */
|
||||
cXyz sp50(
|
||||
cM_ssin(shape_angle.y) * cM_scos(mBodyAngle.x),
|
||||
-cM_ssin(mBodyAngle.x),
|
||||
cM_scos(shape_angle.y) * cM_scos(mBodyAngle.x)
|
||||
);
|
||||
cXyz sp44;
|
||||
cXyz sp38;
|
||||
sp38 = mHookshotRootPos + sp50 * 1500.0f;
|
||||
sp44 = mHookshotRootPos - sp50 * 60.0f;
|
||||
mRopeLinChk.Set(&sp44, &sp38, this);
|
||||
daHookshot_c* hookshot = (daHookshot_c*)mActorKeepEquip.getActor();
|
||||
BOOL r30 = dComIfG_Bgsp()->LineCross(&mRopeLinChk);
|
||||
mSightPacket.onDrawFlg();
|
||||
if (r30 || hookshot->mCps.ChkAtHit()) {
|
||||
BOOL r3;
|
||||
if (r30 && mHookshotRootPos.abs2(current.pos) > mRopeLinChk.GetCross().abs2(current.pos)) {
|
||||
mSightPacket.setPos(&mHookshotRootPos);
|
||||
r3 = FALSE;
|
||||
} else if (!r30) {
|
||||
mSightPacket.setPos(&hookshot->m2CC);
|
||||
r3 = TRUE;
|
||||
} else if (!hookshot->mCps.ChkAtHit()) {
|
||||
mSightPacket.setPos(&mRopeLinChk.GetCross());
|
||||
r3 = FALSE;
|
||||
} else if (mRopeLinChk.GetCross().abs2(mHookshotRootPos) > hookshot->m2CC.abs2(mHookshotRootPos)) {
|
||||
mSightPacket.setPos(&hookshot->m2CC);
|
||||
r3 = TRUE;
|
||||
} else {
|
||||
mSightPacket.setPos(&mRopeLinChk.GetCross());
|
||||
r3 = FALSE;
|
||||
}
|
||||
|
||||
if (
|
||||
(r3 && hookshot->m2B0) ||
|
||||
(!r3 && dComIfG_Bgsp()->ChkPolyHSStick(mRopeLinChk))
|
||||
) {
|
||||
if(mSightPacket.getLockFlg()) {
|
||||
mSightPacket.incFrame();
|
||||
if(mSightPacket.checkSEFrame()) {
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mSightPacket.onLockFlg();
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
} else {
|
||||
mSightPacket.offLockFlg();
|
||||
}
|
||||
} else {
|
||||
mSightPacket.setPos(&sp38);
|
||||
mSightPacket.offLockFlg();
|
||||
}
|
||||
}
|
||||
|
||||
/* 8014B02C-8014B05C .text freeHookshotItem__9daPy_lk_cFv */
|
||||
|
@ -142,7 +142,17 @@ BOOL daPy_lk_c::procRopeSubject() {
|
||||
|
||||
if(grapple->setTargetPos(&sight, &m3600, &m3604)) {
|
||||
mSightPacket.onDrawFlg();
|
||||
mSightPacket.incFrame();
|
||||
if(mSightPacket.getLockFlg()) {
|
||||
mSightPacket.incFrame();
|
||||
|
||||
if(mSightPacket.checkSEFrame()) {
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mSightPacket.onLockFlg();
|
||||
mDoAud_seStart(JA_SE_INDICATOR_1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mSightPacket.offLockFlg();
|
||||
|
Loading…
Reference in New Issue
Block a user