// // Generated by dtk // Translation Unit: d_a_agbsw0.cpp // #include "d/dolzel_rel.h" // IWYU pragma: keep #include "global.h" #include "d/actor/d_a_agbsw0.h" #include "f_op/f_op_actor_mng.h" #include "d/d_com_inf_game.h" #include "d/d_item_data.h" #include "d/d_map.h" #include "d/d_kankyo_wether.h" #include "d/actor/d_a_agb.h" #include "d/actor/d_a_player_main.h" #include "d/actor/d_a_bomb.h" #include "m_Do/m_Do_gba_com.h" #include "d/actor/d_a_ghostship.h" #include "d/actor/d_a_npc_os.h" #include "d/actor/d_a_npc_md.h" #include "d/actor/d_a_npc_cb1.h" #include "d/actor/d_a_boko.h" static dCcD_SrcCyl l_cyl_src = { // dCcD_SrcGObjInf { /* Flags */ 0, /* SrcObjAt Type */ 0, /* SrcObjAt Atp */ 0, /* SrcObjAt SPrm */ 0, /* SrcObjTg Type */ AT_TYPE_BOMB, /* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e, /* SrcObjCo SPrm */ 0, /* SrcGObjAt Se */ 0, /* SrcGObjAt HitMark */ 0, /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ 0, /* SrcGObjTg Se */ 0, /* SrcGObjTg HitMark */ 0, /* SrcGObjTg Spl */ 0, /* SrcGObjTg Mtrl */ 0, /* SrcGObjTg SPrm */ dCcG_TgSPrm_NoHitMark_e, /* SrcGObjCo SPrm */ 0, }, // cM3dGCylS {{ /* Center */ {0.0f, 0.0f, 0.0f}, /* Radius */ 100.0f, /* Height */ 100.0f, }}, }; /* 00004838-00004B2C .text draw__10daAgbsw0_cFv */ BOOL daAgbsw0_c::draw() { u8 toCheck = getSw0(); u8 type = getType(); s16 conditionNo = getParamNo(); if(!mDoGaC_GbaLink()) { return true; } if(type == daAgbsw0Type_A2_e) { if(toCheck != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, toCheck)) { return true; } } else { if(fopAcM_isSwitch(this, toCheck)) { return true; } } } if(MoveCheck(conditionNo)) { return true; } } else { if(type == daAgbsw0Type_M_e) { if(toCheck != 0xFF && !fopAcM_isSwitch(this, toCheck)) { return true; } } else if (type == daAgbsw0Type_R_e) { if(toCheck != 0xFF && fopAcM_isSwitch(this, toCheck)) { return true; } } else if(type == daAgbsw0Type_UNK_0xD_e) { if(!dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e) || dComIfGs_isEventBit(dSv_event_flag_c::UNK_2D01)) { return true; } } else if(type == daAgbsw0Type_UNK_0xE_e) { if(!dComIfGs_isEventBit(dSv_event_flag_c::UNK_1820) || dComIfGs_getTriforceNum() == 8) { return true; } } else { return true; } } if(type == daAgbsw0Type_A2_e || (type == daAgbsw0Type_R_e && field_0x299 == 1)) { s8 roomNo = fopAcM_GetHomeRoomNo(this); dMap_drawPoint(7, current.pos.x, current.pos.y, current.pos.z, roomNo, -0x8000, 0, 0, 0); } else if(type == daAgbsw0Type_M_e || type == daAgbsw0Type_UNK_0xD_e || type == daAgbsw0Type_UNK_0xE_e) { u8 iconType; s32 iconRot; u8 temp; if(conditionNo == 0) { iconType = 8; iconRot = 0x8000; temp = 0; } else if(conditionNo <= 8) { iconType = 9; iconRot = (u16)((4 - (conditionNo - 1)) * 0x2000); temp = 0; } else if(conditionNo < 0x19) { iconType = 10; iconRot = 0x8000; temp = conditionNo - 9; } else if(conditionNo == 0x22) { iconType = 0x15; iconRot = 0x8000; temp = 0; } else { iconType = 0xB; iconRot = 0x8000; temp = 0; } s8 roomNo = fopAcM_GetHomeRoomNo(this); dMap_drawPoint(iconType, current.pos.x, current.pos.y, current.pos.z, roomNo, iconRot, temp, 0, 0); } return true; } /* 00004F80-00005458 .text create__10daAgbsw0_cFv */ cPhs_State daAgbsw0_c::create() { u8 type = getType(); u8 sw0 = getSw0(); s16 paramNo = getParamNo(); if(type == daAgbsw0Type_R_e) { if(paramNo < 0 && paramNo >= -3) { type = daAgbsw0Type_B_e; current.angle.z = type; current.angle.x = -paramNo; } } else if(type == daAgbsw0Type_M_e) { if(paramNo >= 0x1A && paramNo < 0x22) { type = daAgbsw0Type_UNK_0xD_e; current.angle.z = type; current.angle.x = paramNo - 0x19; } else if(paramNo == 0x22) { type = daAgbsw0Type_UNK_0xE_e; current.angle.z = type; } } if(type == daAgbsw0Type_AT_e) { if(sw0 < 0x20 && getParamNo() != 0 && dComIfGs_isTbox(sw0)) { return cPhs_ERROR_e; } } else if(type == daAgbsw0Type_B_e) { if(((paramNo == 1 || paramNo == 3) && sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) || (paramNo == 2 && sw0 < 0x20 && dComIfGs_isTbox(sw0))) { return cPhs_ERROR_e; } } else if(type == daAgbsw0Type_D_e) { u8 sw1 = getSw1(); if((sw1 == 0xFF || (sw0 != 0xFF && fopAcM_isSwitch(this, sw0))) || (sw1 != 0xFF && fopAcM_isSwitch(this, sw1))) { return cPhs_ERROR_e; } } else if(type == daAgbsw0Type_T_e || type == daAgbsw0Type_S_e || type == daAgbsw0Type_R_e) { if(sw0 == 0xFF || (sw0 != 0xFF && fopAcM_isSwitch(this, sw0))) { return cPhs_ERROR_e; } } else if(type == daAgbsw0Type_UNK_0xD_e) { if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_2D01)) { return cPhs_ERROR_e; } } else if(type == daAgbsw0Type_UNK_0xE_e) { if(dComIfGs_getTriforceNum() == 8) { return cPhs_ERROR_e; } } else if(type != daAgbsw0Type_M_e && type != daAgbsw0Type_MW_e) { if(sw0 != 0xFF && getParamNo() != 0 && fopAcM_isSwitch(this, sw0)) { return cPhs_ERROR_e; } } if(type == daAgbsw0Type_B_e && getMsgNo() == 0xFFFF) { u16 msgNo = 0xE; // Debug map indicates fpcM_SetParam was used here instead of fopAcM_SetParam. fpcM_SetParam(this, (fopAcM_GetParam(this) & 0xFFFF0000) | msgNo); } if(type != daAgbsw0Type_MW_e && type != daAgbsw0Type_T_e && type != daAgbsw0Type_S_e && type != daAgbsw0Type_UNK_0xE_e && getMsgNo() == 0xFFFF) { return cPhs_ERROR_e; } else { if ( (type == daAgbsw0Type_R_e || type == daAgbsw0Type_D_e) && (paramNo < 0 || paramNo > 0x1E || paramNo == 7 || paramNo == 8 || paramNo == 0x15) ) { return cPhs_ERROR_e; } else { if(scale.x == scale.z) { mNonCircular = false; } else { mNonCircular = true; } if(type == daAgbsw0Type_S_e) { scale.x *= 8000.0f; scale.y *= 8000.0f; scale.z *= 8000.0f; } else { scale.x *= 200.0f; scale.y *= 200.0f; scale.z *= 200.0f; } mOrigScaleX = scale.x; mOrigScaleZ = scale.z; shape_angle.x = 0; shape_angle.y = current.angle.y; shape_angle.z = 0; field_0x298 = 0; field_0x299 = 0; mTimer = 0; l_cyl_src.mCylAttr.mCyl.mRadius = scale.x; l_cyl_src.mCylAttr.mCyl.mHeight = scale.y; mStts.Init(0, 0xFF, this); mCyl.Set(l_cyl_src); mCyl.SetC(current.pos); mCyl.SetStts(&mStts); if(type == daAgbsw0Type_S_e) { if(paramNo > 0) { mTimer = paramNo * 30 & 0xFFFF; } } else if(type == daAgbsw0Type_B_e && paramNo == 4) { field_0x299 = 1; mTimer = 1; } } } return cPhs_COMPLEATE_e; } BOOL daAgbsw0_c::execute() { typedef BOOL (daAgbsw0_c::*exeSubFunc)(); static exeSubFunc ExeSubTable[] = { &daAgbsw0_c::ExeSubA, &daAgbsw0_c::ExeSubAT, &daAgbsw0_c::ExeSubM, &daAgbsw0_c::ExeSubA2, &daAgbsw0_c::ExeSubF2, &daAgbsw0_c::ExeSubF, &daAgbsw0_c::ExeSubT, &daAgbsw0_c::ExeSubMW, &daAgbsw0_c::ExeSubS, &daAgbsw0_c::ExeSubR, &daAgbsw0_c::ExeSubB, &daAgbsw0_c::ExeSubD, &daAgbsw0_c::ExeSubFA, &daAgbsw0_c::ExeSubM2, &daAgbsw0_c::ExeSubM3 }; return (this->*ExeSubTable[getType()])(); } void daAgbsw0_c::deleteSub() { daAgb_c* agb = dComIfGp_getAgb(); u32 type = getType(); if(agb) { if(type == daAgbsw0Type_B_e) { if(getParamNo() == 3) { agb->offBombDeny(); } else if(getParamNo() == 4) { daAgb_c::mFlags.field_0x3_5 = 0; daAgbsw0_c::mFigureDispose = 0; daAgbsw0_c::mFigureBeat = 0; } else if(getParamNo() == 5) { agb->field_0x67d = false; } else { agb->field_0x67b = false; } } else if(type == daAgbsw0Type_F2_e) { if(field_0x299 == 1) { agb->resetCursor(false); } } else if(type == daAgbsw0Type_D_e) { agb->resetCursor(true); } } if(( type == daAgbsw0Type_A_e || type == daAgbsw0Type_AT_e || type == daAgbsw0Type_M_e || type == daAgbsw0Type_A2_e || type == daAgbsw0Type_F2_e || type == daAgbsw0Type_R_e || type >= daAgbsw0Type_FA_e ) && mDoGaC_GbaLink() && field_0x298 == 1) { agb_mail_struct info; info.msgNo = 0xFFFF; info.swToSet = 0xFF; info.swToCheck = 0xFF; info.stageNo = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()); info.roomNo = fopAcM_GetHomeRoomNo(this); info.reactType = 0; info.sfx = 0; mDoGaC_SendEntry(5, *(u32*)&info); } } agb_mail_struct daAgbsw0_c::mMail; u32 daAgbsw0_c::mSE; /* 00000078-00000344 .text ExeSubA__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubA() { u32 sw0 = getSw0(); s16 conditionNo = getParamNo(); if(sw0 != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { #if VERSION <= VERSION_JPN if(mDoGac_SendStatusCheck(5)) { #else if(!mDoGac_SendStatusCheck(5)) { #endif return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } return true; } } else { if(fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } } } if(MoveCheck(conditionNo)) { #if VERSION > VERSION_JPN if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } #endif return true; } if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 1, getSw1(), 0xFF, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } return true; } /* 00000344-0000066C .text ExeSubAT__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubAT() { u32 flag = getSw0(); s16 conditionNo = getParamNo(); if(flag < 0x20) { if(conditionNo == 0) { if(!dComIfGs_isTbox(flag)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { #if VERSION <= VERSION_JPN if(mDoGac_SendStatusCheck(5)) { #else if(!mDoGac_SendStatusCheck(5)) { #endif return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } return true; } } else { if(dComIfGs_isTbox(flag)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } } if(MoveCheck(conditionNo)) { return true; } } else if(dComIfGs_isOceanSvBit(fopAcM_GetHomeRoomNo(this), 0xF)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } } fopAcM_delete(this); return true; } if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { if(flag < 0x20) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 2, getSw1(), 0xFF, 0); } else { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 2, 0xFF, 0xFF, 0); } field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } return true; } /* 0000066C-00000940 .text ExeSubA2__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubA2() { u32 sw0 = getSw0(); s16 conditionNo = getParamNo(); if(sw0 != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } return true; } } else { if(fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } } } if(MoveCheck(conditionNo)) { #if VERSION > VERSION_JPN if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } #endif return true; } else { if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && (agb->isFree() || agb->getFollowTarget() == 0) && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 4, getSw1(), sw0, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } } return true; } /* 00000940-00000AB4 .text ExeSubF__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubF() { u32 sw0 = getSw0(); s16 conditionNo = getParamNo(); if(sw0 != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, sw0)) { return true; } } else { if(fopAcM_isSwitch(this, sw0)) { fopAcM_delete(this); return true; } } } else { fopAcM_delete(this); return true; } if(MoveCheck(conditionNo)) { return true; } if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && agb->isActive() && !agb->isFree() && agb->getFollowTarget() == 0 && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 6, getSw1(), sw0, 0); } } return true; } /* 00000AB4-00000E48 .text ExeSubF2__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubF2() { u32 sw0 = getSw0(); s16 conditionNo = getParamNo(); daAgb_c* agb = dComIfGp_getAgb(); if(sw0 != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, sw0)) { return true; } } else { if(fopAcM_isSwitch(this, sw0)) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } fopAcM_delete(this); return true; } } } else { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } fopAcM_delete(this); return true; } if(MoveCheck(conditionNo)) { return true; } if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5) && agb) { fopAc_ac_c* player = dComIfGp_getPlayer(0); if(field_0x299 == 0) { if(agb->isActive() && !agb->isFree() && agb->getFollowTarget() == 0 && HitCheck(agb)) { MailSend(0x5A00, 6, 0xFF, 0xFF, 0); agb->onFree(); agb->onHold(); agb->home.pos.x = agb->current.pos.x = current.pos.x; agb->home.pos.y = agb->current.pos.y = current.pos.y + 50.0f; agb->home.pos.z = agb->current.pos.z = current.pos.z; agb->shape_angle.x = 0x3FFF; agb->field_0x67f = true; mOrigScaleX = scale.x; mOrigScaleZ = scale.z; scale.z = 50.0f; scale.x = 50.0f; field_0x299 += 1; } } else if(field_0x299 == 1) { if(agb->isActive() && HitCheck(player->current.pos, 60.0f)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 5, getSw1(), sw0, 0); agb->resetCursor(false); field_0x299 += 1; } else { if(HitCheck(agb)) { MailSend(0x5A00, 1, 0xFF, 0xFF, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } } return true; } /* 00000E48-00000FE4 .text ExeSubM__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubM() { u32 sw0 = getSw0(); if(sw0 != 0xFF && !fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { MailSend(-1, 0, 0xFF, 0xFF, 0); } } field_0x298 = 0; } return true; } else { if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && agb->isActive() && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0x3, 0xFF, 0xFF, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } return true; } } /* 00000FE4-00001198 .text ExeSubM2__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubM2() { if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_2D01)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } else { if(!dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e)) { return true; } else { if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && agb->isActive() && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0x3, 0xFF, 0xFF, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } return true; } } /* 00001198-00001368 .text ExeSubM3__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubM3() { if(dComIfGs_getTriforceNum() == 8) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } else { if(!dComIfGs_isEventBit(dSv_event_flag_c::UNK_1820)) { return true; } else { if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && agb->isActive() && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { #if VERSION <= VERSION_JPN u16 gbaMsgNo = TriforceCheck(); #else u16 gbaMsgNo = TriforceCheck(agb); #endif MailSend(BigLittleChange(gbaMsgNo) >> 0x10, 0xF, 0xFF, 0xFF, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } return true; } } #if VERSION <= VERSION_JPN u32 daAgbsw0_c::TriforceCheck() #else /* 00001368-000017B0 .text TriforceCheck__10daAgbsw0_cFP7daAgb_c */ u32 daAgbsw0_c::TriforceCheck(daAgb_c* agb) #endif { for(int i = 0; i < 8; i++) { if(dComIfGs_isCollectMapTriforce(i + 1) && !dComIfGs_isTriforce(i)) { return dComIfGs_isEventBit(dSv_event_flag_c::UNK_3E02) ? 0x304 : 0x303; } } for(int i = 1; i < 9; i++) { if(dComIfGs_isGetCollectMap(i) && !dComIfGs_isCollectMapTriforce(i)) { if(398 <= (u32)dComIfGs_getRupee()) { return 0x305; } else { f32 rnd = cM_rndF(3.0f); if(rnd <= 1.0) { return 0x306; } else if(rnd <= 2.0) { return 0x307; } else { return 0x308; } } } } if(!dComIfGs_isGetCollectMap(1)) { return 0x309; } if(!dComIfGs_isGetCollectMap(2) && dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e)) { if(dComIfGs_checkGetItem(dItemNo_CABANA_DEED_e)) { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_PrivateOasis_e ? 0x30A : 0x30B; } else { u8 num = dComIfGs_checkGetItemNum(dItemNo_JOY_PENDANT_e); return num >= 0x14 ? 0x30C : 0x30D; } } if(!dComIfGs_isGetCollectMap(3)) { if(dComIfGs_checkGetItem(dItemNo_BAIT_BAG_e)) { if(dComIfGs_checkBaitItem(dItemNo_HYOI_PEAR_e)) { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_BirdsPeakRock_e ? 0x311 : 0x310; } else { return 0x30F; } } return 0x30E; } if(!dComIfGs_isGetCollectMap(4) && dComIfGs_checkGetItem(dItemNo_HOOKSHOT_e)) { if(dComIfGs_isOpenCollectMap(0x24)) { s32 hour = dKy_getdaytime_hour(); if(hour < 6 || hour >= 0x13) { u32 moonType = dKy_moon_type_chk(); #if VERSION <= VERSION_JPN int roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif switch(moonType) { case 1: if(roomNo != 0x24) { return 0x314; } break; case 2: if(roomNo != 0x22) { return 0x315; } break; case 3: if(roomNo != 0xA) { return 0x316; } break; case 4: if(roomNo != 0x31) { return 0x317; } break; case 5: if(roomNo != 0x15) { return 0x318; } break; case 6: if(roomNo != 0x17) { return 0x319; } break; case 0: default: if(roomNo != 0x5) { return 0x31A; } break; } return 0x31B; } else { return 0x313; } } else { return 0x312; } } if(!dComIfGs_isGetCollectMap(5)) { if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_3E80)) { #if VERSION <= VERSION_JPN if (!dComIfGs_isGetCollectMap(0x1C)) { return 0x31E; } else if (!dComIfGs_isCompleteCollectMap(0x1C)) { return 0x323; } else if (!dComIfGs_isCompleteCollectMap(0x1D)) { return 0x31F; } else if (!dComIfGs_isCompleteCollectMap(0x1F)) { return 0x320; } else { return 0x321; } #else return 0x31E; #endif } else { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_NeedleRockIsle_e ? 0x31C : 0x31D; } } if(!dComIfGs_isCollect(2, 0)) { if(dComIfGs_checkGetItem(dItemNo_MAGIC_ARROW_e)) { return 0x328; } else { return dComIfGs_isTact(1) ? 0x32A : 0x329; } } if(!dComIfGs_isGetCollectMap(6)) { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_OutsetIsland_e ? 0x325 : 0x324; } if(!dComIfGs_isGetCollectMap(7)) { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_StoneWatcherIsland_e ? 0x327 : 0x326; } if(dComIfGs_checkGetItem(dItemNo_HOOKSHOT_e)) { #if VERSION <= VERSION_JPN s8 roomNo = dComIfGp_roomControl_getStayNo(); #else int roomNo = agb->field_0x66d; #endif return roomNo == dIsleRoom_OverlookIsland_e ? 0x32C : 0x32D; } return 0x32B; } u16 daAgbsw0_c::BeatedMsg[] = { 0x0005, 0x0011, 0x0012, 0x0031, 0x004F, 0x0058, }; u16 daAgbsw0_c::DisposedMsg[] = { 0x0059, 0x005C, }; /* 000017B0-00001AD0 .text ExeSubMW__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubMW() { u8 sw0 = getSw0(); if((sw0 != 0xFF && !fopAcM_isSwitch(this, sw0)) || !mDoGaC_GbaLink()) { return true; } else { #if VERSION == VERSION_PAL if (dComIfGp_getAgb()->field_0x67d || daPy_getPlayerLinkActorClass()->checkNoControll() || dComIfGp_checkPlayerStatus0(0, daPyStts0_CRAWL_e) || ( daPy_getPlayerActorClass()->checkPlayerFly() && !dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e) && !dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) ) ) { return TRUE; } #endif static bool se_flag = 0; eyePos = current.pos; attention_info.position = current.pos; if(eventInfo.checkCommandDemoAccrpt()) { if(!se_flag) { fopAcM_seStart(this, JA_SE_CV_CHI_MEGAHORN, 0); se_flag = 1; } dComIfGp_evmng_getMyStaffId("AGB_SW0"); fopAc_ac_c* player = dComIfGp_getPlayer(0); cXyz diff = eyePos - player->current.pos; f32 dist = diff.absXZ(); if(dist < 0.001f) { eyePos.x += cM_ssin(player->shape_angle.y) * 10.0f; eyePos.z += cM_scos(player->shape_angle.y) * 10.0f; } if(dComIfGp_evmng_endCheck("DEFAULT_AGB_LOOK_ATTENTION")) { dComIfGp_event_reset(); if(sw0 == 0xFF || getParamNo() == -1) { fopAcM_delete(this); } else { fopAcM_offSwitch(this, sw0); } } } else { fopAcM_orderOtherEvent2(this, "DEFAULT_AGB_LOOK_ATTENTION", dEvtFlag_TALK_e); } } return true; } /* 00001AD0-00001CC8 .text ExeSubT__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubT() { u8 sw0 = getSw0(); if(sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) { if(mTimer == 0) { if(mDoGaC_GbaLink()) { if(dComIfGp_event_runCheck() || !mDoGac_SendStatusCheck(5)) { return true; } else { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0x7, 0xFF, 0xFF, 0); } } fopAcM_delete(this); } else { mTimer -= 1; } return true; } else { if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(0xF)) { if(mCyl.ChkTgHit() && mCyl.GetTgHitAc() && fopAcM_GetName(mCyl.GetTgHitAc()) == fpcNm_BOMB_e && ((daBomb_c*)mCyl.GetTgHitAc())->chk_state(daBomb_c::STATE_8)) { mSE = BigLittleChange(0x12); mDoGac_SendDataSet(&mSE, 4, 0xF, 0); fopAcM_onSwitch(this, sw0); if(getMsgNo() == 0xFFFF) { fopAcM_delete(this); return true; } mTimer = 30; } else { dComIfG_Ccsp()->Set(&mCyl); } } } } return true; } /* 00001CC8-00001FAC .text ExeSubS__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubS() { u8 sw0 = getSw0(); u8 sw1 = getSw1(); if(sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) { fopAcM_delete(this); return true; } else { #if VERSION > VERSION_JPN if(strcmp(dComIfGp_getStartStageName(), "M_NewD2") == 0 && fopAcM_GetHomeRoomNo(this) == 0xC && dComIfGs_isTbox(0xC)) { fopAcM_delete(this); return true; } else #endif if(field_0x299 == 0 && mDoGaC_GbaLink()) { daAgb_c* agb = dComIfGp_getAgb(); if(getParamNo() < 0) { if(agb && agb->isActive() && (agb->isFree() || agb->getFollowTarget() != 1) && HitCheck(agb)) { if(getMsgNo() == 0xFFFF) { fopAcM_onSwitch(this, sw0); if(sw1 != 0xFF) { fopAcM_onSwitch(this, sw1); } fopAcM_delete(this); return true; } else { if(mDoGac_SendStatusCheck(5)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0x9, sw1, sw0, 0); field_0x299 = 1; } } } } else if(mTimer == 0) { if(getMsgNo() == 0xFFFF) { fopAcM_onSwitch(this, sw0); if(sw1 != 0xFF) { fopAcM_onSwitch(this, sw1); } fopAcM_delete(this); return true; } else { if(mDoGac_SendStatusCheck(5)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0x9, sw1, sw0, 0); field_0x299 = 1; } } } else { fopAc_ac_c* player = dComIfGp_getPlayer(0); if(agb && HitCheck(player->current.pos, 60.0f)) { mTimer -= 1; } } } } return true; } /* 00001FAC-000021EC .text ExeSubR__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubR() { u8 sw0 = getSw0(); daAgb_c* agb = dComIfGp_getAgb(); if(mDoGaC_GbaLink() && mDoGac_SendStatusCheck(5)) { if(sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) { s32 itemNo = getParamNo(); if(itemNo < 0 || dItemNo_TRIPLE_HEART_e < itemNo) { itemNo = 0; } if(itemNo != dItemNo_RECOVER_FAIRY_e) { current.pos.y += scale.y / 2.0f; } fopAcM_fastCreateItem(¤t.pos, itemNo, fopAcM_GetHomeRoomNo(this), NULL, NULL, 0.0f, cM_rndF(10.0f) + 40.0f, -7.0f); fopAcM_seStart(agb, JA_SE_CV_CHI_MEGAHORN, 0); MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; fopAcM_delete(this); return TRUE; } else if(agb && agb->isActive()) { if(agb->isFree() && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0xA, 0xFF, getSw0(), 0); field_0x299 = 1; field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } field_0x299 = 0; } } } return TRUE; } /* 000021EC-00002A28 .text ExeSubB__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubB() { u8 sw0 = getSw0(); s16 restriction = getParamNo(); daAgb_c* agb = dComIfGp_getAgb(); fopAc_ac_c* player = dComIfGp_getPlayer(0); if(restriction == 4) { if(!dComIfGs_isEventBit(dSv_event_flag_c::UNK_2E08)) { if(HitCheck(player->current.pos, 60.0f)) { dComIfGs_onEventBit(dSv_event_flag_c::UNK_2E08); } } if(agb) { if(HitCheck(agb)) { daAgb_c::mFlags.field_0x3_5 = 1; } else { daAgb_c::mFlags.field_0x3_5 = 0; } if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { if(field_0x299 == mFigureBeat) { MailSend(BigLittleChange(BeatedMsg[field_0x299 - 1]) >> 0x10, 0xB, 0xFF, 0xFF, 0); if(field_0x299 < 6) { field_0x299 += 1; } else { mFigureBeat = 5; } } if((u32)mTimer == mFigureDispose) { MailSend(BigLittleChange(DisposedMsg[mTimer - 1]) >> 0x10, 0xB, 0xFF, 0xFF, 0); if((u32)mTimer < 2) { mTimer += 1; } else { mFigureDispose = 1; } } } } else { mFigureDispose = 0; mFigureBeat = 0; field_0x299 = 1; mTimer = 1; } } } else if(restriction == 5) { if(agb) { if(HitCheck(player->current.pos, 60.0f)) { agb->field_0x67d = true; agb->field_0x662 = getMsgNo(); field_0x298 = 1; } else { if(field_0x298 == 1) { agb->field_0x67d = false; field_0x298 = 0; } } } } else if(restriction == 6) { if(HitCheck(player->current.pos, 60.0f)) { fopAcM_delete(this); return true; } else { if(agb && agb->isFree() && HitCheck(agb)) { f32 xzDiff = fopAcM_searchActorDistanceXZ(agb, this); cXyz posDiff = current.pos - agb->current.pos; if(!mNonCircular) { f32 rad = scale.x; if(xzDiff < rad - 100.0f) { if(agb->current.pos.y < current.pos.y + scale.y / 2.0f) { agb->home.pos.y = current.pos.y - 6.0f; } else { agb->home.pos.y = current.pos.y + scale.y + 6.0f; } } else { agb->home.pos.x = current.pos.x - (posDiff.x * (rad + 1.0f) / xzDiff); agb->home.pos.z = current.pos.z - (posDiff.z * (scale.z + 1.0f) / xzDiff); } } else { cXyz rel; fpoAcM_relativePos(this, &agb->current.pos, &rel); rel.y = rel.y - scale.y / 2.0f + 5.0f; f32 x_diff = scale.x - std::abs(rel.x); f32 y_diff = (scale.y / 2.0f) - std::abs(rel.y) + 50.0f; //some register oddity here f32 z_diff = scale.z - std::abs(rel.z); if(y_diff < x_diff && y_diff < z_diff) { if(agb->current.pos.y < current.pos.y + scale.y / 2.0f) { agb->home.pos.y = current.pos.y - 6.0f; } else { agb->home.pos.y = current.pos.y + scale.y + 6.0f; } } else { if(x_diff < z_diff) { if(rel.x >= 0.0f) { agb->home.pos.x = (current.pos.x - posDiff.x) + (x_diff + 1.0f) * cM_scos(shape_angle.y); agb->home.pos.z = (current.pos.z - posDiff.z) - (x_diff + 1.0f) * cM_ssin(shape_angle.y); } else { agb->home.pos.x = (current.pos.x - posDiff.x) - (x_diff + 1.0f) * cM_scos(shape_angle.y); agb->home.pos.z = (current.pos.z - posDiff.z) + (x_diff + 1.0f) * cM_ssin(shape_angle.y); } } else if(rel.z >= 0.0f) { agb->home.pos.x = (current.pos.x - posDiff.x) + (z_diff + 1.0f) * cM_ssin(shape_angle.y); agb->home.pos.z = (current.pos.z - posDiff.z) + (z_diff + 1.0f) * cM_scos(shape_angle.y); } else { agb->home.pos.x = (current.pos.x - posDiff.x) - (z_diff + 1.0f) * cM_ssin(shape_angle.y); agb->home.pos.z = (current.pos.z - posDiff.z) - (z_diff + 1.0f) * cM_scos(shape_angle.y); } } } } } } else if((restriction != 2 && sw0 != 0xFF && fopAcM_isSwitch(this, sw0)) || (restriction == 2 && sw0 < 0x20 && dComIfGs_isTbox(sw0))) { if(agb) { if(restriction == 3) { agb->offBombDeny(); } else if(restriction != 6) { agb->field_0x67b = false; } } fopAcM_delete(this); return true; } else { if(agb) { if(restriction == 3) { if(HitCheck(player->current.pos, 60.0f)) { agb->onBombDeny(); agb->setDenyMessage(getMsgNo()); field_0x298 = 1; } else { if(field_0x298 == 1) { agb->offBombDeny(); field_0x298 = 0; } } } else { if(HitCheck(agb)) { agb->field_0x67b = true; agb->field_0x65e = getMsgNo(); field_0x298 = 1; } else { if(field_0x298 == 1) { agb->field_0x67b = false; field_0x298 = 0; } } } } } return true; } /* 00002A28-00002D90 .text ExeSubD__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubD() { u8 sw0 = getSw0(); daAgb_c* agb = dComIfGp_getAgb(); if(sw0 != 0xFF && fopAcM_isSwitch(this, sw0) && field_0x299 == 0) { if(agb) { agb->resetCursor(true); } fopAcM_delete(this); return true; } else { if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5) && agb) { fopAc_ac_c* player = dComIfGp_getPlayer(0); if(field_0x299 == 0) { if(agb->isActive() && agb->isFree() && HitCheck(agb)) { MailSend(0x5F00, 0xC, 0xFF, 0xFF, 0x19); agb->onHold(); agb->field_0x675 = true; f32 x = current.pos.x; agb->current.pos.x = x; agb->home.pos.x = x; f32 y = current.pos.y; agb->current.pos.y = y; agb->home.pos.y = y; f32 z = current.pos.z; agb->current.pos.z = z; agb->home.pos.z = z; agb->shape_angle.x = -0x3FFF; agb->field_0x67f = true; mOrigScaleX = scale.x; mOrigScaleZ = scale.z; scale.z = 50.0f; scale.x = 50.0f; field_0x299 += 1; } } else if(field_0x299 == 1) { if(agb->isActive() && HitCheck(player->current.pos, 60.0f)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0xC, getSw1(), 0xFF, 0x1B); agb->shape_angle.x = 0x3FFF; agb->home.pos.y += 50.0f; agb->current.pos.y = agb->home.pos.y; agb->field_0x676 = true; field_0x299 += 1; } } else if(field_0x299 == 2 && fopAcM_isSwitch(this, getSw1())) { s32 itemNo = getParamNo(); if(itemNo != dItemNo_RECOVER_FAIRY_e) { current.pos.y += scale.y / 2; } if(0 <= itemNo && itemNo < 0x1F && itemNo != dItemNo_HEART_PIECE_e && itemNo != dItemNo_HEART_CONTAINER_e && itemNo != dItemNo_SMALL_KEY_e) { s8 roomNo = fopAcM_GetHomeRoomNo(this); f32 rnd = cM_rndF(10.0f) + 40.0f; fopAcM_fastCreateItem(¤t.pos, itemNo, roomNo, NULL, NULL, 0.0f, rnd, -7.0f); MailSend(-1, 0, 0xFF, 0xFF, 0x11); } if(agb) { agb->resetCursor(true); } fopAcM_delete(this); return true; } } } else { if(field_0x299 != 0 && field_0x299 < 3) { scale.x = mOrigScaleX; scale.z = mOrigScaleZ; field_0x299 = 0; } } } return true; } /* 00002D90-000030DC .text ExeSubFA__10daAgbsw0_cFv */ BOOL daAgbsw0_c::ExeSubFA() { u8 sw0 = getSw0(); s16 conditionNo = getParamNo(); if(sw0 != 0xFF) { if(conditionNo == 0) { if(!fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { #if VERSION <= VERSION_JPN if(mDoGac_SendStatusCheck(5)) { #else if(!mDoGac_SendStatusCheck(5)) { #endif return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } return true; } } else { if(fopAcM_isSwitch(this, sw0)) { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } } } else { if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } fopAcM_delete(this); return true; } if(MoveCheck(conditionNo)) { #if VERSION > VERSION_JPN if(field_0x298 == 1) { if(mDoGaC_GbaLink()) { if(!mDoGac_SendStatusCheck(5)) { return true; } MailSend(-1, 0, 0xFF, 0xFF, 0); } field_0x298 = 0; } #endif return true; } else { if(mDoGaC_GbaLink()) { if(mDoGac_SendStatusCheck(5)) { daAgb_c* agb = dComIfGp_getAgb(); if(agb && (agb->isFree() || agb->getFollowTarget() == 0) && HitCheck(agb)) { MailSend(BigLittleChange(getMsgNo()) >> 0x10, 0xD, getSw1(), sw0, 0); field_0x298 = 1; } else { if(field_0x298 == 1) { MailSend(-1, 0, 0xFF, 0xFF, 0); field_0x298 = 0; } } } } } return true; } /* 000030DC-0000320C .text HitCheck__10daAgbsw0_cFP10fopAc_ac_c */ BOOL daAgbsw0_c::HitCheck(fopAc_ac_c* param_1) { if(mNonCircular == false) { f32 y_diff = param_1->current.pos.y - current.pos.y; if(-10.0f <= y_diff && y_diff <= scale.y) { f32 x_diff = std::abs(param_1->current.pos.x - current.pos.x); if(x_diff < scale.x) { f32 z_diff = fabs(param_1->current.pos.z - current.pos.z); if(z_diff < scale.x && SQUARE(x_diff) + SQUARE(z_diff) < SQUARE(scale.x)) { return true; } } } } else { cXyz pos; fpoAcM_relativePos(this, ¶m_1->current.pos, &pos); if(-10.0f <= pos.y && pos.y <= scale.y && std::abs(pos.x) < scale.x && std::abs(pos.z) < scale.z) { return true; } } return false; } /* 0000320C-00003344 .text HitCheck__10daAgbsw0_cF4cXyzf */ BOOL daAgbsw0_c::HitCheck(cXyz param_1, f32 param_2) { if(mNonCircular == false) { f32 y_diff = param_1.y - current.pos.y; if(-param_2 <= y_diff && y_diff <= scale.y) { f32 x_diff = fabs(param_1.x - current.pos.x); if(x_diff < scale.x) { f32 z_diff = fabs(param_1.z - current.pos.z); if(z_diff < scale.x && SQUARE(x_diff) + SQUARE(z_diff) < SQUARE(scale.x)) { return true; } } } } else { cXyz pos; fpoAcM_relativePos(this, ¶m_1, &pos); if(-param_2 <= pos.y && pos.y <= scale.y && (f32)fabs(pos.x) < scale.x && (f32)fabs(pos.z) < scale.z) { return true; } } return false; } /* 00003344-0000476C .text MoveCheck__10daAgbsw0_cFs */ BOOL daAgbsw0_c::MoveCheck(s16 conditionNo) { switch(conditionNo) { case 1: if(dComIfGs_isEventBit(dSv_event_flag_c::MET_KORL)) { return FALSE; } break; case 2: if(dComIfGs_isSymbol(dSymbol_NAYRU_e)) { return FALSE; } break; case 3: if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_1E40)) { return FALSE; } break; case 4: if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_1820)) { return FALSE; } break; case 5: { daGhostship_c* gship = (daGhostship_c*)fopAcM_searchFromName("Ayush", 0, 0); if(gship && gship->checkInShip()) { return FALSE; } break; } case 6: if(dComIfGs_isEventBit(dSv_event_flag_c::UNLOCK_TINGLE_BALLOON_DISCOUNT)) { return FALSE; } break; case 7: if(dComIfGs_isEventBit(dSv_event_flag_c::UNLOCK_TING_DISCOUNT)) { return FALSE; } break; case 8: if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_1708)) { return FALSE; } break; case 9: if(dComIfGs_isStageTbox(dSv_save_c::STAGE_DRC, 0xF)) { return FALSE; } break; case 0xA: if(dComIfGs_isStageTbox(dSv_save_c::STAGE_FW, 0xF)) { return FALSE; } break; case 0xB: if(dComIfGs_isStageTbox(dSv_save_c::STAGE_TOTG, 0xF)) { return FALSE; } break; case 0xC: if(dComIfGs_isStageTbox(dSv_save_c::STAGE_WT, 0xF)) { return FALSE; } break; case 0xD: if(dComIfGs_isStageTbox(dSv_save_c::STAGE_ET, 0xF)) { return FALSE; } break; case 0x11: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_BOW_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_BOW_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_BOW_e ) { return FALSE; } break; case 0x12: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_BOOMERANG_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_BOOMERANG_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_BOOMERANG_e ) { return FALSE; } break; case 0x13: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_DEKU_LEAF_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_DEKU_LEAF_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_DEKU_LEAF_e ) { return FALSE; } break; case 0x14: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_GRAPPLING_HOOK_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_GRAPPLING_HOOK_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_GRAPPLING_HOOK_e ) { return FALSE; } break; case 0x15: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_BOMB_BAG_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_BOMB_BAG_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_BOMB_BAG_e ) { return FALSE; } break; case 0x16: if( dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_HOOKSHOT_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_HOOKSHOT_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_HOOKSHOT_e ) { return FALSE; } break; case 0x17: if(dComIfGs_checkGetItem(dItemNo_MAGIC_ARMOR_e)) { return FALSE; } break; case 0x18: if(dComIfGs_isCollect(2, 0)) { return FALSE; } break; case 0x19: if(dComIfGs_getLife() < dComIfGs_getMaxLife()) { return FALSE; } break; case 0x1A: if(dComIfGs_getItem(dInvSlot_BOW_e) != dItemNo_NONE_e && dComIfGs_getArrowNum() < dComIfGs_getArrowMax()) { return FALSE; } break; case 0x1B: if(dComIfGs_checkGetItem(dItemNo_BOMB_BAG_e) && dComIfGs_getBombNum() < dComIfGs_getBombMax()) { return FALSE; } break; case 0x1C: if(dComIfGs_getLife() < 8) { return FALSE; } break; case 0x1D: // @bug They meant to call this function if(dComIfGs_getMaxMagic() != 0 && dComIfGs_getMagic == 0) { return FALSE; } break; case 0x1E: if(dComIfGs_getItem(dInvSlot_BOW_e) != dItemNo_NONE_e && dComIfGs_getArrowNum() == 0) { return FALSE; } break; case 0x1F: if(dComIfGs_checkGetItem(dItemNo_BOMB_BAG_e) && dComIfGs_getBombNum() == 0) { return FALSE; } break; case 0x20: if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_1708) && dComIfGs_getItem(dInvSlot_BOW_e) != dItemNo_NONE_e && dComIfGs_getArrowNum() == 0) { return FALSE; } break; case 0x21: if(dComIfGs_isEventBit(dSv_event_flag_c::UNK_1708) && dComIfGs_checkGetItem(dItemNo_BOMB_BAG_e) && dComIfGs_getBombNum() == 0) { return FALSE; } break; case 0x22: if((u32)dComIfGs_getRupee() <= 10) { return FALSE; } break; case 0x23: if(dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e)) { return FALSE; } break; case 0x24: if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e)) { return FALSE; } break; case 0x25: if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_BOMB_BAG_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_BOMB_BAG_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_BOMB_BAG_e) { return FALSE; } break; case 0x26: if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && dComIfGp_getSelectItem(dItemBtn_X_e) != dItemNo_GRAPPLING_HOOK_e && dComIfGp_getSelectItem(dItemBtn_Y_e) != dItemNo_GRAPPLING_HOOK_e && dComIfGp_getSelectItem(dItemBtn_Z_e) != dItemNo_GRAPPLING_HOOK_e) { return FALSE; } break; case 0x27: if(dComIfGs_getKeyNum() == 0) { return FALSE; } break; case 0x28: if(!dComIfGs_isDungeonItemBossKey()) { return FALSE; } break; case 0x29: if(dComIfGs_checkGetItem(dItemNo_GRAPPLING_HOOK_e)) { return FALSE; } break; case 0x2A: if(dComIfGs_checkGetItem(dItemNo_BOOMERANG_e)) { return FALSE; } break; case 0x2B: if(dComIfGs_checkGetItem(dItemNo_BOMB_BAG_e)) { return FALSE; } break; case 0x2C: if(dComIfGs_getItem(dInvSlot_BOW_e) != dItemNo_NONE_e) { return FALSE; } break; case 0x2D: if(!daPy_getPlayerLinkActorClass()->checkGrabWeapon(daBoko_c::Type_MACHETE_e)) { return FALSE; } break; case 0x2E: if(daPy_getPlayerLinkActorClass()->checkGrabWeapon(daBoko_c::Type_MACHETE_e)) { return FALSE; } break; case 0x2F: if(dComIfGs_isSymbol(dSymbol_DIN_e) && !dComIfGs_isEventBit(dSv_event_flag_c::UNLOCK_TING_DISCOUNT)) { return FALSE; } break; case 0x30: if(dComIfGs_isSymbol(dSymbol_DIN_e) && !dComIfGs_isEventBit(dSv_event_flag_c::UNLOCK_TINGLE_BALLOON_DISCOUNT)) { return FALSE; } break; case 0x31: if(!dComIfGs_isEventBit(dSv_event_flag_c::UNK_1708)) { return FALSE; } break; case 0x32: if(dComIfGs_isTact(0)) { return FALSE; } break; case 0x33: if(!dComIfGs_isTact(0)) { return FALSE; } break; case 0x34: if(!dKyw_get_windsdir()) { return FALSE; } break; case 0x35: if(dKyw_get_windsdir()) { return FALSE; } break; case 0x36: if(dKyw_get_windsdir() == 4) { return FALSE; } break; case 0x37: if(!dKyw_get_windsdir() == 4) { return FALSE; } break; case 0x38: if(dKyw_get_windsdir() == 2) { return FALSE; } break; case 0x39: if(!dKyw_get_windsdir() == 2) { return FALSE; } break; case 0x3A: if(dKyw_get_windsdir() == 6) { return FALSE; } break; case 0x3B: if(!dKyw_get_windsdir() == 6) { return FALSE; } break; case 0x3C: if(mFigureDispose == 1) { return FALSE; } break; case 0x3D: if(mFigureDispose == 2) { return FALSE; } break; case 0x3E: if(mFigureBeat == 1) { return FALSE; } break; case 0x3F: if(mFigureBeat == 2) { return FALSE; } break; case 0x40: if(mFigureBeat == 3) { return FALSE; } break; case 0x41: if(mFigureBeat == 4) { return FALSE; } break; case 0x42: for (int i = 0; i < 3; i++) { if(daNpc_Os_c::isPlayerRoom(i)) { return FALSE; } } break; case 0x43: for (int i = 0; i < 3; i++) { if(daNpc_Os_c::isPlayerRoom(i)) { return true; } } return FALSE; case 0x44: if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_OS_e) { return FALSE; } break; case 0x45: if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_OS_e) { return FALSE; } break; case 0x46: if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_MD_e) { return FALSE; } break; case 0x47: if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_MD_e) { return FALSE; } break; case 0x48: if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_CB1_e) { return FALSE; } break; case 0x49: if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_CB1_e) { return FALSE; } break; case 0x4A: if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_KAM_e) { return FALSE; } break; case 0x4B: if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_KAM_e) { return FALSE; } break; case 0x4C: if(dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e)) { return FALSE; } break; case 0x4D: if(!dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e)) { return FALSE; } break; case 0x4E: if(dComIfGs_checkGetItem(dItemNo_MIRROR_SHIELD_e)) { return FALSE; } break; case 0x4F: if(!dComIfGs_checkGetItem(dItemNo_MIRROR_SHIELD_e)) { return FALSE; } break; case 0x50: if(daNpc_Md_c::isPlayerRoom()) { return FALSE; } break; case 0x51: if(!daNpc_Md_c::isPlayerRoom()) { return FALSE; } break; case 0x52: if(dComIfGs_checkGetItem(dItemNo_HOOKSHOT_e)) { return FALSE; } break; case 0x53: if(!dComIfGs_checkGetItem(dItemNo_HOOKSHOT_e)) { return FALSE; } break; case 0x54: if(daNpc_Cb1_c::isPlayerRoom()) { return FALSE; } break; case 0x55: if(!daNpc_Cb1_c::isPlayerRoom()) { return FALSE; } break; case 0x56: if(!dComIfGs_isEventBit(dSv_event_flag_c::UNK_2E08)) { return FALSE; } break; case 0x57: if(!dComIfGs_isCollect(2, 0)) { return FALSE; } break; case 0x58: if(!dComIfGs_checkGetItem(dItemNo_IRON_BOOTS_e)) { return FALSE; } break; case 0x59: if(dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_2_e) || dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_3_e)) { return FALSE; } break; case 0x5A: if(!dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_2_e) && !dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_3_e)) { return FALSE; } break; case 0x5B: if(dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_3_e)) { return FALSE; } break; case 0x5C: if(!dComIfGs_checkGetItem(dItemNo_MASTER_SWORD_3_e)) { return FALSE; } break; case 0x5D: if((u32)dComIfGs_getRupee() >= 500) { for (int i = 1; i < 9; i++) { if(dComIfGs_isGetCollectMap(i) && !dComIfGs_isCollectMapTriforce(i)) { return FALSE; } } } break; case 0x5E: if((u32)dComIfGs_getRupee() < 500) { for (int i = 1; i < 9; i++) { if(dComIfGs_isGetCollectMap(i) && !dComIfGs_isCollectMapTriforce(i)) { return FALSE; } } } break; case 0x5F: if(!dComIfGs_isGetCollectMap(1)) { return FALSE; } break; case 0x60: if(dComIfGs_isGetCollectMap(1) && dComIfGs_isCollectMapTriforce(1) && !dComIfGs_isTriforce(0)) { return FALSE; } break; case 0x61: if(dComIfGs_isTriforce(0)) { return FALSE; } break; case 0x62: if(!dComIfGs_isGetCollectMap(2)) { return FALSE; } break; case 0x63: if(dComIfGs_isGetCollectMap(2) && dComIfGs_isCollectMapTriforce(2) && !dComIfGs_isTriforce(1)) { return FALSE; } break; case 0x64: if(dComIfGs_isTriforce(1)) { return FALSE; } break; case 0x65: if(!dComIfGs_isGetCollectMap(3)) { return FALSE; } break; case 0x66: if(dComIfGs_isGetCollectMap(3) && dComIfGs_isCollectMapTriforce(3) && !dComIfGs_isTriforce(2)) { return FALSE; } break; case 0x67: if(dComIfGs_isTriforce(2)) { return FALSE; } break; case 0x68: if(!dComIfGs_isGetCollectMap(4)) { return FALSE; } break; case 0x69: if(dComIfGs_isGetCollectMap(4) && dComIfGs_isCollectMapTriforce(4) && !dComIfGs_isTriforce(3)) { return FALSE; } break; case 0x6A: if(dComIfGs_isTriforce(3)) { return FALSE; } break; case 0x6B: if(!dComIfGs_isGetCollectMap(5)) { return FALSE; } break; case 0x6C: if(dComIfGs_isGetCollectMap(5) && dComIfGs_isCollectMapTriforce(5) && !dComIfGs_isTriforce(4)) { return FALSE; } break; case 0x6D: if(dComIfGs_isTriforce(4)) { return FALSE; } break; case 0x6E: if(!dComIfGs_isGetCollectMap(6)) { return FALSE; } break; case 0x6F: if(dComIfGs_isGetCollectMap(6) && dComIfGs_isCollectMapTriforce(6) && !dComIfGs_isTriforce(5)) { return FALSE; } break; case 0x70: if(dComIfGs_isTriforce(5)) { return FALSE; } break; case 0x71: if(!dComIfGs_isGetCollectMap(7)) { return FALSE; } break; case 0x72: if(dComIfGs_isGetCollectMap(7) && dComIfGs_isCollectMapTriforce(7) && !dComIfGs_isTriforce(6)) { return FALSE; } break; case 0x73: if(dComIfGs_isTriforce(6)) { return FALSE; } break; case 0x74: if(!dComIfGs_isGetCollectMap(8)) { return FALSE; } break; case 0x75: if(dComIfGs_isGetCollectMap(8) && dComIfGs_isCollectMapTriforce(8) && !dComIfGs_isTriforce(7)) { return FALSE; } break; case 0x76: if(dComIfGs_isTriforce(7)) { return FALSE; } break; case 0x77: if(daPy_dmEcallBack_c::checkCurse()) { return FALSE; } break; case 0x78: if(!daPy_dmEcallBack_c::checkCurse()) { return FALSE; } break; case 0x79: if(daPy_getPlayerActorClass()->checkConfuse()) { return FALSE; } break; case 0x7A: if(!daPy_getPlayerActorClass()->checkConfuse()) { return FALSE; } break; case 0x7B: if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_MD_e && daNpc_Md_c::isFlying()) { return FALSE; } break; case 0x7C: if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_MD_e || !daNpc_Md_c::isFlying()) { return FALSE; } break; case 0x7F: // Potential bug: This seems to check if the current player is Medli, but that Makar is flying? if(fopAcM_GetName(dComIfGp_getPlayer(0)) == fpcNm_NPC_MD_e && daNpc_Cb1_c::isFlying()) { return FALSE; } break; case 0x80: // Potential bug: This seems to check if the current player is Medli, but that Makar is flying? if(fopAcM_GetName(dComIfGp_getPlayer(0)) != fpcNm_NPC_MD_e || !daNpc_Cb1_c::isFlying()) { return FALSE; } break; case 0x7D: if(!fopAcM_isSwitch(this, 0x7C)) { return FALSE; } break; case 0x7E: if(dComIfGs_checkGetItem(dItemNo_SKULL_HAMMER_e) && !dComIfGs_isEventBit(dSv_event_flag_c::UNK_2D01)) { return FALSE; } break; #if VERSION > VERSION_JPN case 0x82: if(field_0x29B == 0) { if(daNpc_Md_c::isPlayerRoom()) { field_0x29B = 1; } } else if(!daNpc_Md_c::isPlayerRoom()) { return FALSE; } break; case 0x83: if(field_0x29B == 0) { if(daNpc_Cb1_c::isPlayerRoom()) { field_0x29B = 1; } } else if(!daNpc_Cb1_c::isPlayerRoom()) { return FALSE; } break; #endif default: return FALSE; } return TRUE; } /* 0000477C-00004818 .text MailSend__10daAgbsw0_cFUsUcUcUcUc */ void daAgbsw0_c::MailSend(u16 msgNo, u8 reactType, u8 toCheck, u8 toSet, u8 sfx) { mMail.msgNo = msgNo; mMail.swToSet = toSet; mMail.swToCheck = toCheck; mMail.stageNo = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()); mMail.roomNo = fopAcM_GetHomeRoomNo(this); mMail.reactType = reactType; mMail.sfx = sfx; mDoGac_SendDataSet((u32*)&mMail, 8, 5, 0); } /* 00004818-00004838 .text daAgbsw0_Draw__FP10daAgbsw0_c */ static BOOL daAgbsw0_Draw(daAgbsw0_c* i_this) { return i_this->draw(); } /* 00004B2C-00004CF8 .text daAgbsw0_Execute__FP10daAgbsw0_c */ static BOOL daAgbsw0_Execute(daAgbsw0_c* i_this) { return i_this->execute(); } /* 00004CF8-00004D00 .text daAgbsw0_IsDelete__FP10daAgbsw0_c */ static BOOL daAgbsw0_IsDelete(daAgbsw0_c*) { return TRUE; } /* 00004D00-00004E98 .text daAgbsw0_Delete__FP10daAgbsw0_c */ static BOOL daAgbsw0_Delete(daAgbsw0_c* i_this) { // Based on the sizes of daAgbsw0_Delete and deleteSub in the debug map, it's possible that // daAgbsw0_Delete should have a small amount of logic instead of deleteSub having all of it, // but it's unclear which specific parts of the logic that should be. i_this->deleteSub(); return true; } /* 00004E98-00004F80 .text daAgbsw0_Create__FP10fopAc_ac_c */ static cPhs_State daAgbsw0_Create(fopAc_ac_c* i_this) { fopAcM_ct(i_this, daAgbsw0_c); return static_cast(i_this)->create(); } static actor_method_class l_daAgbsw0_Method = { (process_method_func)daAgbsw0_Create, (process_method_func)daAgbsw0_Delete, (process_method_func)daAgbsw0_Execute, (process_method_func)daAgbsw0_IsDelete, (process_method_func)daAgbsw0_Draw, }; actor_process_profile_definition g_profile_AGBSW0 = { /* Layer ID */ fpcLy_CURRENT_e, /* List ID */ 0x0007, /* List Prio */ fpcPi_CURRENT_e, /* Proc Name */ fpcNm_AGBSW0_e, /* Proc SubMtd */ &g_fpcLf_Method.base, /* Size */ sizeof(daAgbsw0_c), /* Size Other */ 0, /* Parameters */ 0, /* Leaf SubMtd */ &g_fopAc_Method.base, /* Draw Prio */ fpcDwPi_AGBSW0_e, /* Actor SubMtd */ &l_daAgbsw0_Method, /* Status */ fopAcStts_UNK40000_e, /* Group */ fopAc_ACTOR_e, /* Cull Type */ fopAc_CULLBOX_0_e, };