From c3fdf89c3abd7e85da56edb2b0e8ee3b775131ca Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 8 Sep 2025 17:47:54 -0400 Subject: [PATCH] d_a_arrow OK for demo --- configure.py | 6 +-- include/d/actor/d_a_arrow.h | 2 + include/d/d_com_inf_game.h | 2 +- src/d/actor/d_a_arrow.cpp | 66 +++++++++++++++++++----------- src/d/actor/d_a_arrow_lighteff.cpp | 8 ++++ 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/configure.py b/configure.py index 6bf17d362..ea4cd98b4 100755 --- a/configure.py +++ b/configure.py @@ -557,7 +557,7 @@ config.libs = [ Object(Matching, "d/d_snap.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_point_wind.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_agb.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_arrow.cpp"), + Object(Matching, "d/actor/d_a_arrow.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_bg.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_bomb.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_bomb2.cpp"), @@ -1493,8 +1493,8 @@ config.libs = [ ActorRel(Matching, "d_a_am"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_am2"), ActorRel(Matching, "d_a_amiprop"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_arrow_iceeff"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_arrow_lighteff"), + ActorRel(Matching, "d_a_arrow_iceeff"), + ActorRel(Matching, "d_a_arrow_lighteff"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_beam"), ActorRel(NonMatching, "d_a_boko"), ActorRel(Matching, "d_a_canon"), diff --git a/include/d/actor/d_a_arrow.h b/include/d/actor/d_a_arrow.h index 1729d688a..44edd4320 100644 --- a/include/d/actor/d_a_arrow.h +++ b/include/d/actor/d_a_arrow.h @@ -83,8 +83,10 @@ public: /* 0x602 */ s16 field_0x602; /* 0x604 */ s16 field_0x604; /* 0x606 */ u8 field_0x606[0x608 - 0x606]; +#if VERSION > VERSION_DEMO /* 0x608 */ s16 mSparkleTimer; /* 0x60C */ JPABaseEmitter* mpSparkleEmitter; +#endif /* 0x610 */ fpc_ProcID mHitActorProcID; /* 0x614 */ s32 mHitJointIndex; /* 0x618 */ cXyz field_0x618; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index a41bb814d..9c4106c78 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -287,7 +287,7 @@ public: fopAc_ac_c* getPlayer(int idx) { return mPlayerInfo[idx].mpPlayer; } void setPlayer(int idx, fopAc_ac_c* player) { mPlayerInfo[idx].mpPlayer = player; } - s8 getPlayerCameraID(int idx) { return mPlayerInfo[idx].mCameraID; } + int getPlayerCameraID(int idx) { return mPlayerInfo[idx].mCameraID; } void setPlayerInfo(int idx, fopAc_ac_c* player, int cam) { mPlayerInfo[idx].mpPlayer = player; mPlayerInfo[idx].mCameraID = cam; diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index b2f9cfb83..6d1568014 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -177,11 +177,12 @@ void daArrow_c::setBlur() { if (!blurEmitter) { return; } - s32 alpha = blurEmitter->getGlobalAlpha(); - if (alpha - 50 <= 0) { + int alpha = blurEmitter->getGlobalAlpha(); + alpha -= 50; + if (alpha <= 0) { mBlurFollowCb.remove(); } else { - blurEmitter->setGlobalAlpha(alpha - 50); + blurEmitter->setGlobalAlpha(alpha); } mDoMtx_stack_c::transS(current.pos); @@ -383,7 +384,10 @@ bool daArrow_c::check_water_in() { if (mArrowType == TYPE_FIRE) { mInWaterTimer = 1; dComIfGp_particle_setP1(dPa_name::ID_COMMON_035A, &waterHitPos); - if (!field_0x6e4) { +#if VERSION > VERSION_DEMO + if (!field_0x6e4) +#endif + { dKy_arrowcol_chg_on(¤t.pos, 0); } } else if (mArrowType == TYPE_ICE) { @@ -392,13 +396,19 @@ bool daArrow_c::check_water_in() { PROC_ARROW_ICEEFF, fopAcM_GetID(this), mArrowType, &waterHitPos, current.roomNo, ¤t.angle ); - if (!field_0x6e4) { +#if VERSION > VERSION_DEMO + if (!field_0x6e4) +#endif + { dKy_arrowcol_chg_on(¤t.pos, 1); } } else if (mArrowType == TYPE_LIGHT) { dComIfGp_particle_setP1(dPa_name::ID_COMMON_02A1, &waterHitPos); fopAcM_seStartCurrent(this, JA_SE_OBJ_LIGHT_ARW_EFF, 0); - if (!field_0x6e4) { +#if VERSION > VERSION_DEMO + if (!field_0x6e4) +#endif + { dKy_arrowcol_chg_on(¤t.pos, 2); } mInWaterTimer = 1; @@ -451,7 +461,7 @@ daArrow_c* daArrow_c::changeArrowType() { if (mArrowType != origArrowType) { m_keep_type = mArrowType; - daArrow_c* newNockedArrow = (daArrow_c*)fopAcM_fastCreate(PROC_ARROW, 0, ¤t.pos, current.roomNo); + daArrow_c* newNockedArrow = (daArrow_c*)fopAcM_fastCreate(PROC_ARROW, 0, ¤t.pos, fopAcM_GetRoomNo(this)); if (!newNockedArrow) { mArrowType = origArrowType; m_keep_type = origArrowType; @@ -522,12 +532,10 @@ void daArrow_c::setKeepMatrix() { mDoMtx_stack_c::transS(0.7f, -0.07f, -0.2f); mDoMtx_stack_c::XYZrotM(0x238E, 0x2CDF, 0x29BE); mDoMtx_stack_c::revConcat(zelda->getRightHandMatrix()); - mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); - MtxP mtx = mDoMtx_stack_c::get(); + mpModel->setBaseTRMtx(mtx); current.pos.set(mtx[0][3], mtx[1][3], mtx[2][3]); - - mDoMtx_MtxToRot(mDoMtx_stack_c::get(), &shape_angle); + mDoMtx_MtxToRot(mtx, &shape_angle); current.angle.y = shape_angle.y; current.angle.x = -shape_angle.x; } else { @@ -539,12 +547,10 @@ void daArrow_c::setKeepMatrix() { // Z rotation must be an int literal to pass a signed short as normal. mDoMtx_stack_c::XYZrotM((248.5f*65536)/360, 0x238E, -0x6333); mDoMtx_stack_c::revConcat(player->getLeftHandMatrix()); - mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); - MtxP mtx = mDoMtx_stack_c::get(); + mpModel->setBaseTRMtx(mtx); current.pos.set(mtx[0][3], mtx[1][3], mtx[2][3]); - - mDoMtx_MtxToRot(mDoMtx_stack_c::get(), &shape_angle); + mDoMtx_MtxToRot(mtx, &shape_angle); current.angle.y = shape_angle.y; current.angle.x = -shape_angle.x; } @@ -655,7 +661,10 @@ BOOL daArrow_c::procMove() { field_0x6a8 = hitPos; current.pos = hitPos - (speed * 0.25f); - if (!field_0x6e4) { + #if VERSION > VERSION_DEMO + if (!field_0x6e4) + #endif + { dKy_arrowcol_chg_on(¤t.pos, 2); } @@ -664,7 +673,7 @@ BOOL daArrow_c::procMove() { fopAcM_SetParam(this, 2); field_0x604 = 0x28; - dComIfG_Bgsp()->GetTriPla(mLinChk); + dComIfG_Bgsp()->GetTriPla(mLinChk.GetBgIndex(), mLinChk.GetPolyIndex()); csXyz temp10; temp10.x = cM_atan2s(speed.y, speed.absXZ()); @@ -736,9 +745,8 @@ BOOL daArrow_c::procMove() { setStopActorMatrix(); } } else if (dComIfG_Bgsp()->LineCross(&mLinChk)) { - cXyz* linEnd = mLinChk.GetLinP()->GetEndP(); - field_0x6a8 = *linEnd; - current.pos = *linEnd - (speed * 0.25f); + field_0x6a8 = *mLinChk.GetCrossP(); + current.pos = *mLinChk.GetCrossP() - (speed * 0.25f); if (!check_water_in()) { s32 temp8; @@ -756,7 +764,12 @@ BOOL daArrow_c::procMove() { temp8 = -1; } - if (temp8 >= 0 && !field_0x6e4) { + if ( + temp8 >= 0 +#if VERSION > VERSION_DEMO + && !field_0x6e4 +#endif + ) { dKy_arrowcol_chg_on(¤t.pos, temp8); } @@ -915,8 +928,7 @@ BOOL daArrow_c::procStop_BG() { if (field_0x604 > 0) { field_0x604--; - f32 temp4 = (field_0x604*(1/40.0f)) * 1024.0f * (field_0x604*(1/40.0f)) * cM_ssin(field_0x604*0x52FB); - shape_angle.x = field_0x6e6.x + temp4; + shape_angle.x = field_0x6e6.x + cM_ssin(field_0x604*0x52FB) * ((field_0x604*(1/40.0f)) * 1024.0f * (field_0x604*(1/40.0f))); shape_angle.y = field_0x6e6.y; temp2 = TRUE; } else if (field_0x600) { @@ -971,10 +983,12 @@ BOOL daArrow_c::procStop_BG() { return TRUE; } } - + +#if VERSION > VERSION_DEMO if (mbSetByZelda) { field_0x600 = true; } +#endif return TRUE; } @@ -1072,13 +1086,16 @@ BOOL daArrow_c::createInit() { field_0x6e4 = false; mbHasLightEff = false; mbLinkReflect = false; +#if VERSION > VERSION_DEMO field_0x604 = 0; +#endif return TRUE; } /* 800D74FC-800D7820 .text _execute__9daArrow_cFv */ BOOL daArrow_c::_execute() { +#if VERSION > VERSION_DEMO if (mbSetByZelda) { if (!mbLinkReflect) { if (daPy_getPlayerLinkActorClass()->checkPlayerGuard()) { @@ -1134,6 +1151,7 @@ BOOL daArrow_c::_execute() { return TRUE; } } +#endif if (field_0x602 == m_count) { field_0x600 = true; diff --git a/src/d/actor/d_a_arrow_lighteff.cpp b/src/d/actor/d_a_arrow_lighteff.cpp index cfc94d246..4b0046bfa 100644 --- a/src/d/actor/d_a_arrow_lighteff.cpp +++ b/src/d/actor/d_a_arrow_lighteff.cpp @@ -235,9 +235,13 @@ static BOOL daArrow_Lighteff_Delete(void* i_this) { } bool daArrow_Lighteff_c::_draw() { +#if VERSION == VERSION_DEMO + if(field_0x2E9 != 0) { +#else if(field_0x2E9 == 0) { return true; } +#endif J3DModelData* modelData = field_0x298->getModelData(); if(mDoGph_gInf_c::isMonotone()) { @@ -255,6 +259,10 @@ bool daArrow_Lighteff_c::_draw() { dComIfGd_setList(); +#if VERSION == VERSION_DEMO + } +#endif + return true; }