mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-25 07:22:55 -04:00
d_a_hookshot equivalent
This commit is contained in:
+1
-1
@@ -531,7 +531,7 @@ config.libs = [
|
||||
Object(Matching, "d/actor/d_a_esa.cpp"),
|
||||
Object(NonMatching, "d/actor/d_a_grid.cpp"),
|
||||
Object(NonMatching, "d/actor/d_a_himo2.cpp"),
|
||||
Object(NonMatching, "d/actor/d_a_hookshot.cpp"),
|
||||
Object(Equivalent, "d/actor/d_a_hookshot.cpp"), # weak func order
|
||||
Object(Matching, "d/actor/d_a_ib.cpp", extra_cflags=['-pragma "nosyminline on"']),
|
||||
Object(NonMatching, "d/actor/d_a_item.cpp"),
|
||||
Object(Matching, "d/actor/d_a_itembase.cpp"),
|
||||
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
/* 0x2A0 */ bool m2A0;
|
||||
/* 0x2A1 */ u8 m2A1;
|
||||
/* 0x2A2 */ bool mShipRideFlg;
|
||||
/* 0x2A3 */ u8 m2A3;
|
||||
/* 0x2A3 */ bool m2A3;
|
||||
/* 0x2A4 */ s16 m2A4;
|
||||
/* 0x2A6 */ u16 m2A6;
|
||||
/* 0x2A8 */ int mChainCnt;
|
||||
|
||||
@@ -635,7 +635,7 @@ fopAc_ac_c* fopAcM_findObject4EventCB(fopAc_ac_c* p_actor, void* p_data);
|
||||
|
||||
fopAc_ac_c* fopAcM_searchFromName4Event(char* name, s16 eventID);
|
||||
|
||||
s32 fopAcM_getWaterY(const cXyz*, f32*);
|
||||
BOOL fopAcM_getWaterY(const cXyz*, f32*);
|
||||
void fpoAcM_relativePos(fopAc_ac_c* actor, cXyz* p_inPos, cXyz* p_outPos);
|
||||
|
||||
void fopAcM_setGbaName(fopAc_ac_c* i_this, u8 itemNo, u8 gbaName0, u8 gbaName1);
|
||||
|
||||
@@ -755,7 +755,7 @@ BOOL daBomb_c::procExplode_init() {
|
||||
camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
|
||||
camera->mCamera.ForceLockOff(fopAcM_GetID(this));
|
||||
|
||||
s32 temp;
|
||||
BOOL temp;
|
||||
if(chk_state(STATE_8)) {
|
||||
f32 temp2;
|
||||
temp = fopAcM_getWaterY(¤t.pos, &temp2);
|
||||
@@ -766,15 +766,15 @@ BOOL daBomb_c::procExplode_init() {
|
||||
gndCheck.SetPos(&temp3);
|
||||
|
||||
if(dComIfG_Bgsp()->GroundCross(&gndCheck) > temp2 || current.pos.y > temp2 + 50.0f) {
|
||||
temp = 0;
|
||||
temp = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
temp = 0;
|
||||
temp = FALSE;
|
||||
}
|
||||
|
||||
if(temp == 0) {
|
||||
if(!temp) {
|
||||
eff_explode();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#include "SSystem/SComponent/c_counter.h"
|
||||
#include "d/actor/d_a_player_main.h"
|
||||
#include "d/actor/d_a_ship.h" // IWYU pragma: keep
|
||||
#include "d/d_procname.h"
|
||||
|
||||
#include "weak_data_1811.h" // IWYU pragma: keep
|
||||
@@ -185,10 +186,10 @@ BOOL daHookshot_c::procWait() {
|
||||
mSightCps.CalcAtVec();
|
||||
dComIfG_Ccsp()->Set(&mSightCps);
|
||||
// Using the inline breaks the match.
|
||||
// dComIfG_Ccsp()->SetMass(&mCps, 1);
|
||||
// dComIfG_Ccsp()->SetMass(&mSightCps, 1);
|
||||
g_dComIfG_gameInfo.play.mCcS.SetMass(&mSightCps, 1);
|
||||
|
||||
m2A3 = 0;
|
||||
m2A3 = false;
|
||||
mCurrProcFunc = &daHookshot_c::procShot;
|
||||
}
|
||||
} else {
|
||||
@@ -210,22 +211,264 @@ BOOL daHookshot_c::procWait() {
|
||||
|
||||
/* 800F1990-800F2144 .text procShot__12daHookshot_cFv */
|
||||
BOOL daHookshot_c::procShot() {
|
||||
/* Nonmatching */
|
||||
if (fopAcM_GetParam(this) == Mode_Return) {
|
||||
mCurrProcFunc = &daHookshot_c::procReturn;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (mSightCps.ChkAtHit()) {
|
||||
fopAc_ac_c* hit_ac = mSightCps.GetAtHitAc();
|
||||
if (hit_ac) {
|
||||
mCarryActorID = fopAcM_GetID(hit_ac);
|
||||
if (fopAcM_CheckStatus(hit_ac, fopAcStts_UNK80000_e)) {
|
||||
fopAcM_setHookCarryNow(hit_ac);
|
||||
mCarryOffset = hit_ac->current.pos - current.pos;
|
||||
fopAcM_seStartCurrent(this, JA_SE_LK_HS_SPIKE, 0);
|
||||
dComIfGp_getVibration().StartShock(4, -0x21, cXyz(0.0f, 1.0f, 0.0f));
|
||||
} else if (fopAcM_CheckStatus(hit_ac, fopAcStts_UNK200000_e)) {
|
||||
current.pos = *mSightCps.GetAtHitPosP();
|
||||
mCarryOffset = current.pos - hit_ac->current.pos;
|
||||
m2A4 = hit_ac->shape_angle.y;
|
||||
mHookAngle.x = shape_angle.x;
|
||||
mHookAngle.y = shape_angle.y;
|
||||
mHookAngle.z = 0;
|
||||
mMoveVec = cXyz::Zero;
|
||||
fopAcM_SetParam(this, Mode_Pull);
|
||||
mShipRideFlg = false;
|
||||
mCurrProcFunc = &daHookshot_c::procPlayerPull;
|
||||
fopAcM_seStartCurrent(this, JA_SE_LK_HS_SPIKE, 0);
|
||||
dComIfGp_getVibration().StartShock(4, -0x21, cXyz(0.0f, 1.0f, 0.0f));
|
||||
return TRUE;
|
||||
} else if (mSightCps.ChkAtShieldHit()) {
|
||||
fopAcM_seStartCurrent(this, JA_SE_LK_HS_REBOUND, 0x20);
|
||||
}
|
||||
}
|
||||
fopAcM_SetParam(this, Mode_Return);
|
||||
mCurrProcFunc = &daHookshot_c::procReturn;
|
||||
} else if (m2A3 || current.pos.abs(daPy_getPlayerLinkActorClass()->getHookshotRootPos()) >= 1500.0f) {
|
||||
if (m2A3) {
|
||||
if (m2A6 == dPa_name::ID_SCENE_825F) {
|
||||
dComIfGp_particle_setP1(m2A6, ¤t.pos);
|
||||
} else {
|
||||
dComIfGp_particle_setP1(m2A6, ¤t.pos, &m2BA);
|
||||
}
|
||||
fopAcM_seStartCurrent(this, JA_SE_LK_HS_REBOUND, mMtrlSndId);
|
||||
}
|
||||
fopAcM_SetParam(this, Mode_Return);
|
||||
mCurrProcFunc = &daHookshot_c::procReturn;
|
||||
} else {
|
||||
cXyz sp8C = current.pos + (mMoveVec * 15.0f);
|
||||
mLinChk.Set(¤t.pos, &sp8C, this);
|
||||
if (dComIfG_Bgsp()->LineCross(&mLinChk)) {
|
||||
sp8C = mLinChk.GetLinP()->GetEnd();
|
||||
if (dComIfG_Bgsp()->ChkPolyHSStick(mLinChk)) {
|
||||
fopAcM_SetParam(this, Mode_Pull);
|
||||
mShipRideFlg = false;
|
||||
mCurrProcFunc = &daHookshot_c::procPlayerPull;
|
||||
|
||||
cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mLinChk);
|
||||
mHookAngle.x = cM_atan2s(plane->GetNP()->y, plane->GetNP()->absXZ());
|
||||
mHookAngle.y = cM_atan2s(-plane->GetNP()->x, -plane->GetNP()->z);
|
||||
mHookAngle.z = 0;
|
||||
mMoveVec = cXyz::Zero;
|
||||
|
||||
fopAcM_seStartCurrent(this, JA_SE_LK_HS_SPIKE, dComIfG_Bgsp()->GetMtrlSndId(mLinChk));
|
||||
dComIfGp_getVibration().StartShock(4, -0x21, cXyz(0.0f, 1.0f, 0.0f));
|
||||
} else {
|
||||
cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mLinChk);
|
||||
cM3d_CalcVecZAngle(*plane->GetNP(), &m2BA);
|
||||
if (
|
||||
strcmp(dComIfGp_getStartStageName(), "kazeB") == 0 &&
|
||||
(
|
||||
(sp8C.y < 950.0f && dComIfG_Bgsp()->GetTriPla(mLinChk)->GetNP()->y >= 0.5f) ||
|
||||
dComIfG_Bgsp()->GetAttributeCode(mLinChk) == dBgS_Attr_SAND_e
|
||||
)
|
||||
) {
|
||||
m2A6 = dPa_name::ID_SCENE_825F;
|
||||
} else {
|
||||
m2A6 = dPa_name::ID_COMMON_PURPLE_HIT;
|
||||
}
|
||||
mMtrlSndId = dComIfG_Bgsp()->GetMtrlSndId(mLinChk);
|
||||
m2A3 = true;
|
||||
}
|
||||
}
|
||||
|
||||
mSightCps.SetStartEnd(current.pos, sp8C);
|
||||
mSightCps.SetR(5.0f);
|
||||
mSightCps.CalcAtVec();
|
||||
dComIfG_Ccsp()->Set(&mSightCps);
|
||||
// Using the inline breaks the match.
|
||||
// dComIfG_Ccsp()->SetMass(&mSightCps, 1);
|
||||
g_dComIfG_gameInfo.play.mCcS.SetMass(&mSightCps, 1);
|
||||
current.pos = sp8C;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 800F2144-800F247C .text procPlayerPull__12daHookshot_cFv */
|
||||
BOOL daHookshot_c::procPlayerPull() {
|
||||
/* Nonmatching */
|
||||
fopAc_ac_c* carry_actor = NULL;
|
||||
if (mCarryActorID != fpcM_ERROR_PROCESS_ID_e) {
|
||||
carry_actor = fopAcM_SearchByID(mCarryActorID);
|
||||
if (carry_actor == NULL || fopAcM_GetParam(this) == Mode_Return) {
|
||||
mCurrProcFunc = &daHookshot_c::procReturn;
|
||||
mCarryActorID = fpcM_ERROR_PROCESS_ID_e;
|
||||
return TRUE;
|
||||
}
|
||||
if (carry_actor->shape_angle.y != m2A4) {
|
||||
mDoMtx_stack_c::YrotS(carry_actor->shape_angle.y - m2A4);
|
||||
cXyz sp4C;
|
||||
mDoMtx_stack_c::multVec(&mCarryOffset, &sp4C);
|
||||
mCarryOffset = sp4C;
|
||||
m2A4 = carry_actor->shape_angle.y;
|
||||
}
|
||||
current.pos = carry_actor->current.pos + mCarryOffset;
|
||||
} else {
|
||||
if (fopAcM_GetParam(this) == Mode_Return || !dComIfG_Bgsp()->ChkPolySafe(mLinChk)) {
|
||||
mCurrProcFunc = &daHookshot_c::procReturn;
|
||||
return TRUE;
|
||||
}
|
||||
if (dComIfG_Bgsp()->ChkMoveBG(mLinChk)) {
|
||||
dComIfG_Bgsp()->MoveBgTransPos(mLinChk, true, ¤t.pos, &mHookAngle, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
cXyz sp40 = current.pos - daPy_getPlayerLinkActorClass()->getHookshotRootPos();
|
||||
f32 f1 = sp40.abs();
|
||||
int r5 = f1 / 7.0f;
|
||||
if (r5 >= 1) {
|
||||
r5 = (r5 > mChainCnt ? r5 - mChainCnt : 0);
|
||||
int iVar6;
|
||||
if (mChainCnt <= 9) {
|
||||
iVar6 = r5 + mChainCnt;
|
||||
} else {
|
||||
iVar6 = r5 + 9;
|
||||
}
|
||||
mChainCnt -= iVar6;
|
||||
mMoveVec = sp40 * ((iVar6 * 7.0f) / f1);
|
||||
} else {
|
||||
mChainCnt = 0;
|
||||
}
|
||||
|
||||
if (mChainCnt <= 0) {
|
||||
if (carry_actor && carry_actor == dComIfGp_getShipActor()) {
|
||||
mShipRideFlg = true;
|
||||
}
|
||||
procWait_init(TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 800F247C-800F26EC .text procReturn__12daHookshot_cFv */
|
||||
BOOL daHookshot_c::procReturn() {
|
||||
/* Nonmatching */
|
||||
fopAc_ac_c* carry_actor;
|
||||
if (mCarryActorID != fpcM_ERROR_PROCESS_ID_e) {
|
||||
carry_actor = fopAcM_SearchByID(mCarryActorID);
|
||||
if (carry_actor == NULL || !fopAcM_checkHookCarryNow(carry_actor)) {
|
||||
mCarryActorID = fpcM_ERROR_PROCESS_ID_e;
|
||||
carry_actor = NULL;
|
||||
}
|
||||
} else {
|
||||
carry_actor = NULL;
|
||||
}
|
||||
|
||||
if (mChainCnt <= 9) {
|
||||
if (carry_actor) {
|
||||
fopAcM_cancelHookCarryNow(carry_actor);
|
||||
}
|
||||
procWait_init(TRUE);
|
||||
procWait();
|
||||
} else {
|
||||
cXyz sp4C = current.pos - daPy_getPlayerLinkActorClass()->getHookshotRootPos();
|
||||
f32 f1 = sp4C.abs();
|
||||
if ((int)(f1 / 7.0f) <= 9) {
|
||||
if (carry_actor != NULL) {
|
||||
fopAcM_cancelHookCarryNow(carry_actor);
|
||||
}
|
||||
procWait_init(TRUE);
|
||||
procWait();
|
||||
} else {
|
||||
mChainCnt -= 9;
|
||||
current.pos -= sp4C * (63.0f / f1);
|
||||
|
||||
if (carry_actor) {
|
||||
carry_actor->current.pos = current.pos + mCarryOffset;
|
||||
cXyz sp40(
|
||||
carry_actor->current.pos.x,
|
||||
carry_actor->current.pos.y + 100.0f,
|
||||
carry_actor->current.pos.z
|
||||
);
|
||||
sp40.y += 100.0f;
|
||||
mGndChk.SetPos(&sp40);
|
||||
f32 ground_y = dComIfG_Bgsp()->GroundCross(&mGndChk);
|
||||
if (ground_y > carry_actor->current.pos.y) {
|
||||
carry_actor->current.pos.y = ground_y;
|
||||
mCarryOffset.y = ground_y - current.pos.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 800F26EC-800F2B54 .text execute__12daHookshot_cFv */
|
||||
BOOL daHookshot_c::execute() {
|
||||
/* Nonmatching */
|
||||
daPy_lk_c* link = daPy_getPlayerLinkActorClass();
|
||||
|
||||
if (fopAcM_GetParam(this) != Mode_Wait) {
|
||||
mDoAud_seStart(JA_SE_LK_HS_CHAIN, &link->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
|
||||
if (fopAcM_GetParam(this) != Mode_Shot) {
|
||||
mDoAud_seStart(JA_SE_LK_HS_WIND_UP, &link->current.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
|
||||
}
|
||||
}
|
||||
|
||||
if (mCurrProcFunc != NULL) {
|
||||
(this->*mCurrProcFunc)();
|
||||
}
|
||||
|
||||
eyePos = attention_info.position = current.pos;
|
||||
cXyz sp3C;
|
||||
sp3C = current.pos - link->getHookshotRootPos();
|
||||
mChainCnt = sp3C.abs() / 7.0f;
|
||||
|
||||
if (fopAcM_GetParam(this) != Mode_Pull || mChainCnt > 18) {
|
||||
shape_angle.x = cM_atan2s(-sp3C.y, sp3C.absXZ());
|
||||
shape_angle.y = cM_atan2s(sp3C.x, sp3C.z);
|
||||
} else {
|
||||
shape_angle.x = link->shape_angle.x;
|
||||
shape_angle.y = link->shape_angle.y;
|
||||
}
|
||||
|
||||
if (fopAcM_GetParam(this) != Mode_Wait && !m2A0) {
|
||||
mDoMtx_stack_c::transS(current.pos);
|
||||
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, 0);
|
||||
mDoMtx_stack_c::YrotM(-0x4000);
|
||||
MTXCopy(mDoMtx_stack_c::get(), mMtx);
|
||||
} else {
|
||||
m2A0 = false;
|
||||
}
|
||||
|
||||
int roomNo = dComIfGp_roomControl_getStayNo();
|
||||
tevStr.mRoomNo = roomNo;
|
||||
mStts.SetRoomId(roomNo);
|
||||
current.roomNo = roomNo;
|
||||
|
||||
if (fopAcM_GetParam(this) != Mode_Wait) {
|
||||
m2A1 = link->setItemWaterEffect(this, m2A1, 0);
|
||||
}
|
||||
|
||||
if (fopAcM_GetParam(this) == Mode_Shot) {
|
||||
speedF = current.pos.abs(old.pos);
|
||||
} else if (fopAcM_GetParam(this) == Mode_Return || fopAcM_GetParam(this) == Mode_Pull) {
|
||||
speedF = -current.pos.abs(old.pos);
|
||||
} else {
|
||||
speedF = 0.0f;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 800F2B54-800F2B74 .text daHookshot_Execute__FP12daHookshot_c */
|
||||
@@ -241,9 +484,9 @@ static BOOL daHookshot_IsDelete(daHookshot_c* i_this) {
|
||||
/* 800F2B7C-800F2BF0 .text hookshot_delete__12daHookshot_cFv */
|
||||
BOOL daHookshot_c::hookshot_delete() {
|
||||
if (mCarryActorID != fpcM_ERROR_PROCESS_ID_e) {
|
||||
fopAc_ac_c* hooked_actor = fopAcM_SearchByID(mCarryActorID);
|
||||
if (hooked_actor && fopAcM_CheckStatus(hooked_actor, fopAcStts_HOOK_CARRY_e)) {
|
||||
fopAcM_cancelHookCarryNow(hooked_actor);
|
||||
fopAc_ac_c* carry_actor = fopAcM_SearchByID(mCarryActorID);
|
||||
if (carry_actor && fopAcM_CheckStatus(carry_actor, fopAcStts_HOOK_CARRY_e)) {
|
||||
fopAcM_cancelHookCarryNow(carry_actor);
|
||||
mCarryActorID = fpcM_ERROR_PROCESS_ID_e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1262,7 +1262,7 @@ u32 daPy_lk_c::setItemWaterEffect(fopAc_ac_c* i_actor, int param_1, int param_2)
|
||||
static JGeometry::TVec3<f32> direction(0.0f, 1.0f, 0.0f);
|
||||
|
||||
f32 waterY;
|
||||
if (fopAcM_getWaterY(&i_actor->current.pos, &waterY) != 0 && ((param_1 != 0 && i_actor->current.pos.y > waterY) || (param_1 == 0 && waterY >= i_actor->current.pos.y))) {
|
||||
if (fopAcM_getWaterY(&i_actor->current.pos, &waterY) && ((param_1 != 0 && i_actor->current.pos.y > waterY) || (param_1 == 0 && waterY >= i_actor->current.pos.y))) {
|
||||
param_1 ^= 1;
|
||||
if (param_1 == 0 && param_2 == 0) {
|
||||
return param_1;
|
||||
|
||||
@@ -1408,9 +1408,9 @@ fopAc_ac_c* fopAcM_searchFromName(char* pProcName, u32 paramMask, u32 parameter)
|
||||
}
|
||||
|
||||
/* 80028448-80028560 .text fopAcM_getWaterY__FPC4cXyzPf */
|
||||
s32 fopAcM_getWaterY(const cXyz* pPos, f32* pDstWaterY) {
|
||||
BOOL fopAcM_getWaterY(const cXyz* pPos, f32* pDstWaterY) {
|
||||
static dBgS_WtrChk water_check;
|
||||
s32 ret = 0;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
*pDstWaterY = C_BG_MIN_HEIGHT;
|
||||
|
||||
@@ -1423,14 +1423,14 @@ s32 fopAcM_getWaterY(const cXyz* pPos, f32* pDstWaterY) {
|
||||
bool hit = dComIfG_Bgsp()->WaterChk(&water_check);
|
||||
if (hit) {
|
||||
*pDstWaterY = water_check.GetHeight();
|
||||
ret = 1;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
if (daSea_ChkArea(pPos->x, pPos->z)) {
|
||||
f32 waveY = daSea_calcWave(pPos->x, pPos->z);
|
||||
if (waveY > *pDstWaterY)
|
||||
*pDstWaterY = waveY;
|
||||
ret = 1;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user