diff --git a/include/d/actor/d_a_npc_md.h b/include/d/actor/d_a_npc_md.h index 795e7549d..d4de6db59 100644 --- a/include/d/actor/d_a_npc_md.h +++ b/include/d/actor/d_a_npc_md.h @@ -201,9 +201,11 @@ public: class daNpc_Md_c : public daPy_npc_c { public: enum ActionStatus { - ACTION_STARTING = 0, - ACTION_ONGOING = 1, - ACTION_ENDING = -1, + ACTION_STARTING = 0, + ACTION_ONGOING_1 = 1, + ACTION_ONGOING_2 = 2, + ACTION_ONGOING_3 = 3, + ACTION_ENDING = -1, }; typedef BOOL (daNpc_Md_c::*ActionFunc)(void*); @@ -223,28 +225,34 @@ public: void noCarryAction() { cLib_onBit(m30F0, 0x800UL); } void offNoCarryAction() { cLib_offBit(m30F0, 0x800UL); } bool isNoCarryAction() { return cLib_checkBit(m30F0, 0x800UL); } + void onShipRide() { cLib_onBit(m30F0, 0x1000UL); } + void offShipRide() { cLib_offBit(m30F0, 0x1000UL); } + bool isShipRide() { return cLib_checkBit(m30F0, 0x1000UL); } void onLightHit() { cLib_onBit(m30F0, 0x2000UL); } void offLightHit() { cLib_offBit(m30F0, 0x2000UL); } bool isLightHit() { return cLib_checkBit(m30F0, 0x2000UL); } void onLightBodyHit() { cLib_onBit(m30F0, 0x8000UL); } void offLightBodyHit() { cLib_offBit(m30F0, 0x8000UL); } + bool isLightBodyHit() { return cLib_checkBit(m30F0, 0x8000UL); } bool isOldLightBodyHit() { return cLib_checkBit(m30F0, 0x8000UL); } void onDefaultTalkXY() { cLib_onBit(m30F0, 0x10000UL); } void offDefaultTalkXY() { cLib_offBit(m30F0, 0x10000UL); } bool isDefaultTalkXY() { return cLib_checkBit(m30F0, 0x10000UL); } - void setTypeEdaichi() { m3138 = 4; } - void setTypeM_Dai() { m3138 = 5; } - void setTypeM_DaiB() { m3138 = 6; } - void setTypeShipRide() { m3138 = 7; } - void isTypeAdanmae() {} - void isTypeAtorizk() {} - void isTypeM_Dra09() {} - void isTypeSea() {} - bool isTypeEdaichi() { return m3138 == 4; } - bool isTypeM_Dai() { return m3138 == 5; } - bool isTypeM_DaiB() { return m3138 == 6; } - bool isTypeShipRide() { return m3138 == 7; } + void setOldLightBodyHit() {} // 0x20000? + + void setTypeEdaichi() { mType = 4; } + void setTypeM_Dai() { mType = 5; } + void setTypeM_DaiB() { mType = 6; } + void setTypeShipRide() { mType = 7; } + bool isTypeAtorizk() { return mType == 0; } + bool isTypeAdanmae() { return mType == 1; } + bool isTypeM_Dra09() { return mType == 2; } + bool isTypeSea() { return mType == 3; } + bool isTypeEdaichi() { return mType == 4; } + bool isTypeM_Dai() { return mType == 5; } + bool isTypeM_DaiB() { return mType == 6; } + bool isTypeShipRide() { return mType == 7; } s16 getHead_x() { return mJntCtrl.getHead_x(); } s16 getHead_y() { return mJntCtrl.getHead_y(); } @@ -284,34 +292,22 @@ public: } } + void getFlyingTimer() {} + void setFlyingTimer(s16) {} void calcFlyingTimer() {} void checkBitEffectStatus(u8) {} void checkStatus(u32) {} + void setStatus(u32) {} void clearJntAng() {} void clearStatus() {} void clearStatus(u32) {} - void getFlyingTimer() {} void getTalkType() {} - void isLightBodyHit() {} - void isMirror() {} - void isShipRide() {} - void offFlying() {} - void offMirror() {} - void offPlayerRoom() {} - void offShipRide() {} - void onFlying() {} - void onMirror() {} - void onPlayerRoom() {} - void onShipRide() {} + void setTalkType(u8) {} void setBitEffectStatus(u8) {} void setBitStatus(u32) {} void setEffectStatus(u8) {} - void setFlyingTimer(s16) {} - void setOldLightBodyHit() {} void setPiyo2TalkCNT(u8) {} void setRunRate(f32) {} - void setStatus(u32) {} - void setTalkType(u8) {} daNpc_Md_c() {} ~daNpc_Md_c(); @@ -322,9 +318,9 @@ public: BOOL createHeap(); BOOL setAction(ActionFunc*, ActionFunc, void*); void npcAction(void*); - void setNpcAction(ActionFunc, void*); + void setNpcAction(ActionFunc, void* = NULL); void playerAction(void*); - void setPlayerAction(ActionFunc, void*); + void setPlayerAction(ActionFunc, void* = NULL); s16 getStickAngY(int); int calcStickPos(s16, cXyz*); BOOL flyCheck(); @@ -475,11 +471,18 @@ public: static bool m_playerRoom; static bool isFlying() { return m_flying; } + static void onFlying() { m_flying = true; } + static void offFlying() { m_flying = false; } + static bool isMirror() { return m_mirror; } + static void onMirror() { m_mirror = true; } + static void offMirror() { m_mirror = false; } static bool isSeaTalk() { return m_seaTalk; } static void onSeaTalk() { m_seaTalk = true; } static void offSeaTalk() { m_seaTalk = false; } static s16 getMaxFlyingTimer(); static bool isPlayerRoom() { return m_playerRoom; } + static void onPlayerRoom() { m_playerRoom = true; } + static void offPlayerRoom() { m_playerRoom = false; } public: /* 0x04EC */ request_of_phase_process_class mPhs; @@ -553,7 +556,7 @@ public: /* 0x3135 */ u8 m3135[0x3136 - 0x3135]; /* 0x3136 */ u8 m3136; /* 0x3137 */ u8 m3137; - /* 0x3138 */ u8 m3138; + /* 0x3138 */ u8 mType; /* 0x3139 */ s8 mCurEvent; /* 0x313A */ u8 m313A; /* 0x313B */ u8 m313B[0x313C - 0x313B]; diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 56dc92da8..5b2a182e5 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -1656,7 +1656,11 @@ public: onNoResetFlg0(daPyFlg0_SHIP_DROP); m3550 = param_1; } - void checkCarryActionNow() const {} + bool checkCarryActionNow() const { + return mCurProc == daPyProc_GRAB_PUT_e || + mCurProc == daPyProc_GRAB_UP_e || + mCurProc == daPyProc_GRAB_THROW_e; + } bool checkNoControll() const { return dComIfGp_getPlayer(0) != this; } void clearDamageWait() {} void exchangeGrabActor(fopAc_ac_c*) {} diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 73117321f..49dae1fef 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -624,6 +624,10 @@ inline void fopAcM_monsSeStart(fopAc_ac_c* actor, u32 i_seNum, u32 param_2) { mDoAud_monsSeStart(i_seNum, &actor->mEyePos, fopAcM_GetID(actor), 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } +inline void fopAcM_monsSeStart(fopAc_ac_c* actor, u32 i_seNum, Vec* i_sePos, u32 param_2) { + mDoAud_monsSeStart(i_seNum, i_sePos, fopAcM_GetID(actor), param_2); +} + void fopDwTg_ToDrawQ(create_tag_class*, int); void fopDwTg_DrawQTo(create_tag_class*); @@ -635,8 +639,6 @@ inline void fopAcM_offDraw(fopAc_ac_c* actor) { fopDwTg_DrawQTo(&actor->mDwTg); } -inline void fopAcM_monsSeStart(fopAc_ac_c*, unsigned long, Vec*, unsigned long) {} -inline void fopAcM_getNameString(fopAc_ac_c*, char*) {} inline void fopAcM_orderOtherEvent(fopAc_ac_c* ac, char* event, u16 flag) { fopAcM_orderOtherEvent2(ac, event, flag); } diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 5cec781a4..55fe94e7b 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -158,6 +158,10 @@ inline void mDoAud_monsSeInit() { mDoAud_zelAudio_c::getInterface()->monsSeInit(); } +inline void mDoAud_monsSeStart(u32 i_seNum, Vec* param_1, u32 param_2, u32 param_3) { + mDoAud_zelAudio_c::getInterface()->monsSeStart(i_seNum, param_1, param_2, param_3, 0); +} + inline void mDoAud_monsSeStart(u32 i_seNum, Vec* param_1, u32 param_2, u32 param_3, s8 i_reverb) { mDoAud_zelAudio_c::getInterface()->monsSeStart(i_seNum, param_1, param_2, param_3, i_reverb); } diff --git a/src/JAZelAudio/JAIZelBasic.cpp b/src/JAZelAudio/JAIZelBasic.cpp index 76dbad9ff..0ac858fbe 100644 --- a/src/JAZelAudio/JAIZelBasic.cpp +++ b/src/JAZelAudio/JAIZelBasic.cpp @@ -1002,8 +1002,8 @@ void JAIZelBasic::setCameraGroupInfo(u8 param_1) { setScene(0x12, mIslandRoomNo, 1, -1); load1stDynamicWave(); load2ndDynamicWave(); - this->field_0x021e = 0; - this->field_0x022d = 1; + field_0x021e = 0; + field_0x022d = 1; } else { OSReport("[JAIZelBasic::setCameraGroupInfo] Inner Edge -> Outer Edge\n"); } diff --git a/src/d/actor/d_a_bomb2.cpp b/src/d/actor/d_a_bomb2.cpp index 1603d69e1..b3684bff6 100644 --- a/src/d/actor/d_a_bomb2.cpp +++ b/src/d/actor/d_a_bomb2.cpp @@ -661,7 +661,7 @@ namespace daBomb2 { hitNormal *= attr().field_0x44; mWindVec.abs2(); fopAc_ac_c* hitActor = mSph.GetTgHitAc(); - if (hitActor && fpcM_GetProfName(hitActor) == PROC_PLAYER) { + if (hitActor && fopAcM_GetProfName(hitActor) == PROC_PLAYER) { s16 hitObjAngleY = cM_atan2s(hitNormal.x, hitNormal.z); f32 f2 = cM_scos(hitActor->shape_angle.y - hitObjAngleY); if (f2 > 0.0f) { diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index 9c36e607a..3b077ea4d 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -1133,7 +1133,7 @@ void daBomb_c::set_wind_vec() { hitNormal *= 50.0f; mWindVec.abs2(); fopAc_ac_c* hitActor = mSph.GetTgHitAc(); - if (hitActor && fpcM_GetProfName(hitActor) == PROC_PLAYER) { + if (hitActor && fopAcM_GetProfName(hitActor) == PROC_PLAYER) { s16 hitObjAngleY = cM_atan2s(hitNormal.x, hitNormal.z); f32 f2 = cM_scos(hitActor->shape_angle.y - hitObjAngleY); if (f2 > 0.0f) { diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index ab5a4b6b6..4dd8d2725 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -330,7 +330,7 @@ static s16 daNpc_Md_XyCheckCB(void* i_this, int param_1) { /* 000006FC-000007FC .text XyCheckCB__10daNpc_Md_cFi */ s16 daNpc_Md_c::XyCheckCB(int equippedItemIdx) { u8 selectItemNo = dComIfGp_getSelectItem(equippedItemIdx); - if (m3138 == 3) { + if (isTypeSea()) { if (selectItemNo == dItem_WIND_WAKER_e) { return TRUE; } @@ -339,7 +339,7 @@ s16 daNpc_Md_c::XyCheckCB(int equippedItemIdx) { return TRUE; } } - } else if (m3138 == 5 || m3138 == 4) { + } else if (isTypeM_Dai() || isTypeEdaichi()) { if (selectItemNo == GOLDEN_FEATHER && !dComIfGs_isEventBit(0x3B80)) { return TRUE; } @@ -380,8 +380,8 @@ s32 daNpc_Md_c::create() { fopAcM_SetupActor(this, daNpc_Md_c); - m3138 = fopAcM_GetParam(this) >> 0x08; - if (m3138 == -2) { + mType = fopAcM_GetParam(this) >> 0x08; + if (mType == -2) { dComIfGs_onEventBit(0x1620); } else { if (dComIfGs_isCollect(0, 2)) { @@ -447,7 +447,7 @@ s32 daNpc_Md_c::create() { return cPhs_ERROR_e; } - if (m3138 == 5) { + if (isTypeM_Dai()) { u8 flag = dComIfGs_getPlayerPriestFlag(); if (flag == 2) { s8 roomNo = dComIfGs_getPlayerPriestRoomNo(); @@ -749,10 +749,9 @@ static char* hairName[] = { /* 0000240C-00002F80 .text createHeap__10daNpc_Md_cFv */ BOOL daNpc_Md_c::createHeap() { - /* Nonmatching */ char wait_anim_name[32]; char arm_wait_anim_name[32]; - if (m3138 == 7) { + if (isTypeShipRide()) { strcpy(wait_anim_name, "md_shipwait.bck"); strcpy(arm_wait_anim_name, "mdarm_shipwait.bck"); } else { @@ -835,7 +834,7 @@ BOOL daNpc_Md_c::createHeap() { mpArmMorf->getModel()->setUserArea((u32)this); - if (m3138 != 7) { + if (!isTypeShipRide()) { modelData = (J3DModelData*)dComIfG_getObjectRes(mModelArcName, "mdwing.bdl"); JUT_ASSERT(2083, modelData != 0); @@ -922,12 +921,12 @@ BOOL daNpc_Md_c::setAction(ActionFunc* pCurrActionFunc, ActionFunc newActionFunc /* 00003050-00003124 .text npcAction__10daNpc_Md_cFPv */ void daNpc_Md_c::npcAction(void* arg) { - if (!mCurrNpcActionFunc) { + if (mCurrNpcActionFunc == NULL) { speedF = 0.0f; if (m3104 == 0x20) { - setNpcAction(&daNpc_Md_c::mwaitNpcAction, NULL); + setNpcAction(&daNpc_Md_c::mwaitNpcAction); } else { - setNpcAction(&daNpc_Md_c::waitNpcAction, NULL); + setNpcAction(&daNpc_Md_c::waitNpcAction); } } @@ -943,10 +942,9 @@ void daNpc_Md_c::setNpcAction(ActionFunc actionFunc, void* arg) { /* 00003194-00003360 .text playerAction__10daNpc_Md_cFPv */ void daNpc_Md_c::playerAction(void* arg) { - /* Nonmatching */ - if (!mCurrPlayerActionFunc) { + if (mCurrPlayerActionFunc == NULL) { speedF = 0.0f; - setPlayerAction(&daNpc_Md_c::waitPlayerAction, NULL); + setPlayerAction(&daNpc_Md_c::waitPlayerAction); } if (mAcch.ChkGroundHit() && isOldLightBodyHit()) { @@ -1036,10 +1034,10 @@ BOOL daNpc_Md_c::flyCheck() { if (!CPad_CHECK_TRIG_A(0)) { return FALSE; } - if (isOldLightBodyHit()) { - setPlayerAction(&daNpc_Md_c::mkamaePlayerAction, NULL); + if (isLightBodyHit()) { + setPlayerAction(&daNpc_Md_c::mkamaePlayerAction); } else { - setPlayerAction(&daNpc_Md_c::flyPlayerAction, NULL); + setPlayerAction(&daNpc_Md_c::flyPlayerAction); } return TRUE; } @@ -1088,7 +1086,7 @@ void daNpc_Md_c::returnLinkPlayer() { /* 000037C4-00003824 .text shipRideCheck__10daNpc_Md_cFv */ BOOL daNpc_Md_c::shipRideCheck() { if (isTypeShipRide()) { - setNpcAction(&daNpc_Md_c::shipNpcAction, NULL); + setNpcAction(&daNpc_Md_c::shipNpcAction); return TRUE; } return FALSE; @@ -1207,7 +1205,7 @@ void daNpc_Md_c::NpcCall(int* r31) { } else { f32 temp = 2.0f*l_HIO.m0C4; if (dist2 >= temp*temp) { - setNpcAction(&daNpc_Md_c::searchNpcAction, NULL); + setNpcAction(&daNpc_Md_c::searchNpcAction); } *r31 = 1; } @@ -1215,7 +1213,7 @@ void daNpc_Md_c::NpcCall(int* r31) { /* 00003E74-00003FE0 .text checkCollision__10daNpc_Md_cFi */ BOOL daNpc_Md_c::checkCollision(int r30) { - if ((m3138 == 5 || m3138 == 4) && mCyl1.ChkTgHit()) { + if ((isTypeM_Dai() || isTypeEdaichi()) && mCyl1.ChkTgHit()) { fopAc_ac_c* hit_actor = mCyl1.GetTgHitAc(); if (hit_actor) { cXyz sp3C = current.pos - hit_actor->current.pos; @@ -1228,7 +1226,7 @@ BOOL daNpc_Md_c::checkCollision(int r30) { sp08 = cM_atan2s(sp3C.x, sp3C.z); } if (r30 != 0) { - setPlayerAction(&daNpc_Md_c::hitPlayerAction, NULL); + setPlayerAction(&daNpc_Md_c::hitPlayerAction); } else { setNpcAction(&daNpc_Md_c::hitNpcAction, &sp08); } @@ -1241,17 +1239,37 @@ BOOL daNpc_Md_c::checkCollision(int r30) { /* 00003FE0-00004040 .text restartPoint__10daNpc_Md_cFs */ void daNpc_Md_c::restartPoint(s16 i_point) { setPointRestart(i_point, 2); - setNpcAction(&daNpc_Md_c::waitNpcAction, NULL); + setNpcAction(&daNpc_Md_c::waitNpcAction); } /* 00004040-00004174 .text isTagCheckOK__10daNpc_Md_cFv */ BOOL daNpc_Md_c::isTagCheckOK() { - /* Nonmatching */ + BOOL ret = FALSE; + if (chkNpcAction(&daNpc_Md_c::waitNpcAction) || chkNpcAction(&daNpc_Md_c::searchNpcAction) || chkNpcAction(&daNpc_Md_c::searchNpcAction)) { + ret = TRUE; + } else if (chkNpcAction(&daNpc_Md_c::carryNpcAction) && !daPy_getPlayerLinkActorClass()->checkCarryActionNow()) { + ret = TRUE; + } + return ret; } /* 00004174-00004230 .text setMessageAnimation__10daNpc_Md_cFUc */ -void daNpc_Md_c::setMessageAnimation(u8) { - /* Nonmatching */ +void daNpc_Md_c::setMessageAnimation(u8 msgAnmAtr) { + if (fopAcM_checkCarryNow(this)) { + return; + } + if (!dComIfGp_event_runCheck()) { + return; + } + int staffIdx = dComIfGp_evmng_getMyStaffId(l_staff_name); + if (staffIdx != -1) { + if (strcmp(dComIfGp_evmng_getMyActName(staffIdx), "WAIT") == 0) { + int anmType = getAnmType(msgAnmAtr); + if (anmType >= 0) { + setAnm(anmType); + } + } + } } /* 00004230-0000433C .text waitGroundCheck__10daNpc_Md_cFv */ @@ -1385,7 +1403,7 @@ BOOL daNpc_Md_c::piyo2NpcAction(void*) { /* 00007824-0000786C .text deleteNpcAction__10daNpc_Md_cFPv */ BOOL daNpc_Md_c::deleteNpcAction(void*) { if (mActionStatus == ACTION_STARTING) { - mActionStatus++; // ACTION_ONGOING + mActionStatus++; // ACTION_ONGOING_1 } else if (mActionStatus != ACTION_ENDING) { fopAcM_delete(this); } @@ -1428,8 +1446,34 @@ BOOL daNpc_Md_c::searchNpcAction(void*) { } /* 00008CEC-00008E54 .text hitNpcAction__10daNpc_Md_cFPv */ -BOOL daNpc_Md_c::hitNpcAction(void*) { - /* Nonmatching */ +BOOL daNpc_Md_c::hitNpcAction(void* r29) { + if (mActionStatus == ACTION_STARTING) { + setDamageFogTimer(5*30); + // Bug: Reverb is being passed to JAIZelBasic::monsSeStart as argument r7 when it should be argument r8. + // The fopAcM_monsSeStart inline does not support passing reverb, but the programmer didn't realize this. + fopAcM_monsSeStart(this, JA_SE_CV_MD_CRASH, ¤t.pos, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + s16 angle = 0; + if (r29 != NULL) { + angle = *(s16*)r29; + } + current.angle.y = angle; + speedF = 10.0f; + speed.y = 20.0f; + mAttentionInfo.mFlags &= ~fopAc_Attn_ACTION_CARRY_e; + mAcchCir[1].SetWall(60.0f, 20.0f); + cLib_offBit(m30F0, 0x01UL | 0x04UL); + cLib_onBit(m30F0, 0x02UL); + m30F8 = 120.0f; + setAnm(0xD); + mActionStatus++; // ACTION_ONGOING_1 + } else if (mActionStatus != ACTION_ENDING) { + if (mAcch.ChkGroundHit()) { + speedF = 0.0f; + setNpcAction(&daNpc_Md_c::land03NpcAction); + } + setAttention(true); + } + return TRUE; } /* 00008E54-00008FFC .text setNormalSpeedF__10daNpc_Md_cFfffff */ @@ -1469,7 +1513,7 @@ BOOL daNpc_Md_c::waitPlayerAction(void*) { m310C = 0.0f; m3114 = 0; m3116 = 0; - mActionStatus += 1; // ACTION_ONGOING + mActionStatus++; // ACTION_ONGOING_1 } else if (mActionStatus != ACTION_ENDING && !flyCheck()) { dAttention_c& attention = dComIfGp_getAttention(); if (g_mDoCPd_cpadInfo[0].mMainStickValue >= l_HIO.m104 || attention.Lockon()) { @@ -1491,7 +1535,7 @@ BOOL daNpc_Md_c::waitPlayerAction(void*) { if (g_mDoCPd_cpadInfo[0].mMainStickValue >= l_HIO.m108) { if (temp == 0) { current.angle.y = stickAngle; - setPlayerAction(&daNpc_Md_c::walkPlayerAction, NULL); + setPlayerAction(&daNpc_Md_c::walkPlayerAction); } } } else { @@ -1533,7 +1577,52 @@ BOOL daNpc_Md_c::landPlayerAction(void*) { /* 0000A698-0000A8D0 .text mkamaePlayerAction__10daNpc_Md_cFPv */ BOOL daNpc_Md_c::mkamaePlayerAction(void*) { - /* Nonmatching */ + if (mActionStatus == ACTION_STARTING) { + cLib_offBit(m30F0, 0x01UL | 0x02UL | 0x04UL | 0x10UL); + setAnm(0x1F); + shape_angle.x = 0; + shape_angle.z = 0; + mGravity = l_HIO.m0F4; + mMaxFallSpeed = -100.0f; + speedF = 0.0f; + speed.y = 0.0f; + mAcchCir[1].SetWall(60.0f, 20.0f); + mActionStatus++; // ACTION_ONGOING_1 + } else if (mActionStatus == ACTION_ENDING) { + offMirror(); + } else { + if (mActionStatus == ACTION_ONGOING_1) { + if (m312A != 0) { + speedF = 0.0f; + setAnm(0x20); + onMirror(); + mActionStatus++; // ACTION_ONGOING_2 + } + } else if (mActionStatus == ACTION_ONGOING_2) { + if (mirrorCancelCheck() || !isLightBodyHit()) { + setAnm(0x21); + m312A = 0; + offMirror(); + mActionStatus++; // ACTION_ONGOING_3 + } else { + dAttention_c& attention = dComIfGp_getAttention(); + if (g_mDoCPd_cpadInfo[0].mMainStickValue >= l_HIO.m104 || attention.Lockon()) { + m311A = getStickAngY(FALSE); + m310C = g_mDoCPd_cpadInfo[0].mMainStickValue; + } else { + m311A = 0; + m310C = 0.0f; + } + lookBackWaist(m311A, m310C); + } + } else if (m312A != 0) { + setPlayerAction(&daNpc_Md_c::waitPlayerAction); + } + + setAttention(true); + } + + return TRUE; } /* 0000A8D0-0000A9BC .text carryPlayerAction__10daNpc_Md_cFPv */ @@ -2004,7 +2093,7 @@ BOOL daNpc_Md_c::talk(int r4) { } } } else if (msgStatus == fopMsgStts_MSG_TYPING_e) { - if (m313A == 0 && !fopAcM_checkCarryNow(this) && !cLib_checkBit(m30F0, 0x1000UL) && mMsgId != 0x05AC) { + if (m313A == 0 && !fopAcM_checkCarryNow(this) && !isShipRide() && mMsgId != 0x05AC) { int anmType = getAnmType(msgAnmAtr); if (anmType >= 0) { setAnm(anmType); @@ -2016,7 +2105,7 @@ BOOL daNpc_Md_c::talk(int r4) { return TRUE; } - if (!fopAcM_checkCarryNow(this) && !cLib_checkBit(m30F0, 0x1000UL) && mMsgId != 0x05AC) { + if (!fopAcM_checkCarryNow(this) && !isShipRide() && mMsgId != 0x05AC) { if (m313A == 1 && msgAnmAtr == 0x14 && m312A != 0) { setAnm(0x1B); m313A = 1; @@ -2332,7 +2421,7 @@ BOOL daNpc_Md_c::setAnm(int anmIdx) { dNpc_Md_setAnm(mpArmMorf, m30FC, prm->loopMode, morf, speed, armAnm->m00, armAnm->m20, mModelArcName); ret = FALSE; } else { - if (m3138 != 7) { + if (!isTypeShipRide()) { dNpc_Md_setAnm(mpWingMorf, prm->loopMode, morf, speed, wingAnmTbl[prm->armAnmTblIdx - 0x80].m00, mModelArcName); } ret = TRUE; @@ -2408,7 +2497,9 @@ void daNpc_Md_c::chkArea(cXyz*) { /* 0000D8FC-0000D950 .text carryCheck__10daNpc_Md_cFv */ void daNpc_Md_c::carryCheck() { - /* Nonmatching */ + if (fopAcM_checkCarryNow(this)) { + setNpcAction(&daNpc_Md_c::carryNpcAction); + } } /* 0000D950-0000DAD4 .text eventOrder__10daNpc_Md_cFv */ @@ -2702,9 +2793,9 @@ u16 daNpc_Md_c::next_msgStatus(u32* pCurrMsgNo) { /* 0000E410-0000E64C .text getMsg__10daNpc_Md_cFv */ u32 daNpc_Md_c::getMsg() { u32 msgNo = 0; - if (cLib_checkBit(m30F0, 0x1000UL)) { + if (isShipRide()) { msgNo = 0x19EF; - } else if (m3138 == 0) { + } else if (isTypeAtorizk()) { if (dComIfGs_isEventBit(dSv_evtBit_c::MEDLI_GAVE_FATHERS_LETTER)) { msgNo = 0x17DC; } else if (dComIfGs_getClearCount() != 0) { @@ -2712,7 +2803,7 @@ u32 daNpc_Md_c::getMsg() { } else { msgNo = 0x17D5; } - } else if (m3138 == 1) { + } else if (isTypeAdanmae()) { if (cLib_checkBit(m30F0, 0x40UL)) { if (m312D == 0x10) { static const u32 l_msg_num[] = { @@ -2730,13 +2821,13 @@ u32 daNpc_Md_c::getMsg() { } else { msgNo = 0x17E6; } - } else if (m3138 == 2) { + } else if (isTypeM_Dra09()) { if (dComIfGs_isEventBit(0x1101)) { msgNo = 0x17E5; } else { msgNo = 0x17DD; } - } else if (m3138 == 3) { + } else if (isTypeSea()) { if (isXYTalk()) { if (isDefaultTalkXY()) { if (dComIfGs_isEventBit(0x2E40)) { @@ -2765,7 +2856,7 @@ u32 daNpc_Md_c::getMsg() { msgNo = 0x19C9; } } - } else if (m3138 == 5 || m3138 == 4) { + } else if (isTypeM_Dai() || isTypeEdaichi()) { msgNo = 0x1A02; } return msgNo; @@ -2813,7 +2904,7 @@ BOOL daNpc_Md_c::init() { /* 0000F4E0-0000F8EC .text draw__10daNpc_Md_cFv */ BOOL daNpc_Md_c::draw() { - if (cLib_checkBit(m30F0, 0x1000UL)) { + if (isShipRide()) { if (dComIfGp_getShipActor() && dComIfGp_getShipActor()->checkHeadNoDraw()) { return TRUE; } @@ -2855,7 +2946,7 @@ BOOL daNpc_Md_c::draw() { g_env_light.setLightTevColorType(mpHarpModel, &mTevStr); mDoExt_modelUpdateDL(mpHarpModel); - if (cLib_checkBit(m30F0, 0x2000UL)) { + if (isLightHit()) { mLightBtkAnm.entry(mpHarpLightModel->getModelData()); mDoExt_modelUpdateDL(mpHarpLightModel); mLightBtkAnm.remove(mpHarpLightModel->getModelData()); @@ -2873,7 +2964,7 @@ BOOL daNpc_Md_c::draw() { dComIfGd_getXluList()->entryImm(&m0B70, 0x1F); } - if (!cLib_checkBit(m30F0, 0x1000UL) && !fopAcM_checkStatus(this, fopAcStts_CARRY_e) && cLib_checkBit(m30F0, 0x20000UL)) { + if (!isShipRide() && !fopAcM_checkStatus(this, fopAcStts_CARRY_e) && cLib_checkBit(m30F0, 0x20000UL)) { cXyz shadowPos(current.pos.x, current.pos.y + 150.0f, current.pos.z); mShadowId = dComIfGd_setShadow( mShadowId, 0, mpMorf->getModel(), &shadowPos, 800.0f, 20.0f, diff --git a/src/d/actor/d_a_tag_volcano.cpp b/src/d/actor/d_a_tag_volcano.cpp index 1e73e6a0f..7eb7f9dae 100644 --- a/src/d/actor/d_a_tag_volcano.cpp +++ b/src/d/actor/d_a_tag_volcano.cpp @@ -10,7 +10,7 @@ namespace daTagvolcano { namespace { struct Attr_c { - /* 0x00 */ u32 field_0x00; + /* 0x00 */ u16 field_0x00; }; static const Attr_c L_attr = { diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index ed7a273c6..ae23b0993 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -483,19 +483,19 @@ void dDlst_2DM_c::draw() { GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); GXBegin(GX_QUADS, GX_VTXFMT0, 4); - GXPosition3s16(mX0, mY0, 0.0f); + GXPosition3s16(mX0, mY0, 0); GXTexCoord2s16(tex0_s0, tex0_t0); GXTexCoord2s16(tex1_s0, tex1_t0); - GXPosition3s16(mX1, mY0, 0.0f); + GXPosition3s16(mX1, mY0, 0); GXTexCoord2s16(tex0_s1, tex0_t0); GXTexCoord2s16(tex1_s1, tex1_t0); - GXPosition3s16(mX1, mY1, 0.0f); + GXPosition3s16(mX1, mY1, 0); GXTexCoord2s16(tex0_s1, tex0_t1); GXTexCoord2s16(tex1_s1, tex1_t1); - GXPosition3s16(mX0, mY1, 0.0f); + GXPosition3s16(mX0, mY1, 0); GXTexCoord2s16(tex0_s0, tex0_t1); GXTexCoord2s16(tex1_s0, tex1_t1); GXEnd(); @@ -560,12 +560,12 @@ void dDlst_2Dm_c::draw() { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX1, GX_DIRECT); - GXLoadTexObj(&this->mTex[0].mTexObj, GX_TEXMAP0); - if (this->mTex[0].mbHasTlut) - GXLoadTlut(&this->mTex[0].mTlutObj, GXGetTexObjTlut(&mTex[0].mTexObj)); - GXLoadTexObj(&this->mTex[1].mTexObj, GX_TEXMAP1); - if (this->mTex[1].mbHasTlut != 0) - GXLoadTlut(&this->mTex[1].mTlutObj, GXGetTexObjTlut(&mTex[1].mTexObj)); + GXLoadTexObj(&mTex[0].mTexObj, GX_TEXMAP0); + if (mTex[0].mbHasTlut) + GXLoadTlut(&mTex[0].mTlutObj, GXGetTexObjTlut(&mTex[0].mTexObj)); + GXLoadTexObj(&mTex[1].mTexObj, GX_TEXMAP1); + if (mTex[1].mbHasTlut != 0) + GXLoadTlut(&mTex[1].mTlutObj, GXGetTexObjTlut(&mTex[1].mTexObj)); GXSetNumChans(0); GXSetTevColor(GX_TEVREG0, mC0); @@ -595,19 +595,19 @@ void dDlst_2Dm_c::draw() { GXSetCurrentMtx(GX_PNMTX0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); - GXPosition3s16(mX0, mY0, 0.0f); + GXPosition3s16(mX0, mY0, 0); GXTexCoord2s16(tex0_s0, tex0_t0); GXTexCoord2s16(tex1_s0, tex1_t0); - GXPosition3s16(mX1, mY0, 0.0f); + GXPosition3s16(mX1, mY0, 0); GXTexCoord2s16(tex0_s1, tex0_t0); GXTexCoord2s16(tex1_s1, tex1_t0); - GXPosition3s16(mX1, mY1, 0.0f); + GXPosition3s16(mX1, mY1, 0); GXTexCoord2s16(tex0_s1, tex0_t1); GXTexCoord2s16(tex1_s1, tex1_t1); - GXPosition3s16(mX0, mY1, 0.0f); + GXPosition3s16(mX0, mY1, 0); GXTexCoord2s16(tex0_s0, tex0_t1); GXTexCoord2s16(tex1_s0, tex1_t1); GXEnd(); diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 81bfe967f..12dab0984 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -1365,7 +1365,7 @@ s32 fopAcM_otoCheck(fopAc_ac_c* actor, f32 param_2) { /* 800282F8-8002833C .text fopAcM_getProcNameString__FP10fopAc_ac_c */ const char * fopAcM_getProcNameString(fopAc_ac_c* i_this) { - const char * pProcNameString = dStage_getName2(fpcM_GetProfName(i_this), i_this->mSubtype); + const char * pProcNameString = dStage_getName2(fopAcM_GetProfName(i_this), i_this->mSubtype); if (pProcNameString != NULL) return pProcNameString; return "UNKOWN"; @@ -1435,6 +1435,9 @@ void fopAcM_setGbaName(fopAc_ac_c* i_this, u8 itemNo, u8 gbaName0, u8 gbaName1) i_this->mGbaName = gbaName0; } +// Unused function, only exists in debug. +void fopAcM_getNameString(fopAc_ac_c*, char*) {} + /* 80028724-800287D8 .text fpoAcM_absolutePos__FP10fopAc_ac_cP4cXyzP4cXyz */ void fpoAcM_absolutePos(fopAc_ac_c* i_this, cXyz* relPos, cXyz* absPos) { *absPos = i_this->current.pos;