// // Generated By: dol2asm // Translation Unit: d/cc/d_cc_uty // #include "d/cc/d_cc_uty.h" #include "SSystem/SComponent/c_math.h" #include "d/d_procname.h" #include "d/s/d_s_play.h" #include "dol2asm.h" #include "dolphin/types.h" // // Forward References: // extern "C" void pl_cut_LRC__Fi(); extern "C" void cc_pl_cut_bit_get__Fv(); extern "C" static void getMapInfo__FSc(); extern "C" static void getHitId__FP8cCcD_Obji(); extern "C" void def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c(); extern "C" static void at_power_get__FP11dCcU_AtInfo(); extern "C" void at_power_check__FP11dCcU_AtInfo(); extern "C" void cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo(); extern "C" bool checkCutJumpCancelTurn__9daPy_py_cCFv(); // // External References: // extern "C" void getHitSeID__12dCcD_GObjInfFUci(); extern "C" void dCcD_GetGObjInf__FP8cCcD_Obj(); extern "C" void checkMasterSwordEquip__9daPy_py_cFv(); extern "C" void GetAc__8cCcD_ObjFv(); extern "C" void cM_atan2s__Fff(); extern "C" void cM_rndFX__Ff(); extern "C" void _savegpr_25(); extern "C" void _restgpr_25(); extern "C" extern u8 struct_80451124[4]; // // Declarations: // bool daPy_py_c::checkWoodSwordEquip() { return dComIfGs_getSelectEquipSword() == WOOD_STICK; } BOOL daPy_py_c::checkNowWolf() { return dComIfGp_getLinkPlayer()->i_checkWolf(); } /* ############################################################################################## */ /* 803AC418-803AC500 009538 00E8+00 1/1 0/0 0/0 .data plCutLRC */ SECTION_DATA static int plCutLRC[58] = { 0, 0, 1, 1, 2, 0, 2, 1, 0, 0, 0, 2, 1, 1, 1, 2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, }; /* 800873B0-800873D4 081CF0 0024+00 0/0 0/0 3/3 .text pl_cut_LRC__Fi */ int pl_cut_LRC(int index) { if (index >= 58) { return 0; } return plCutLRC[index]; } /* 800873D4-800874C4 081D14 00F0+00 1/1 0/0 14/14 .text cc_pl_cut_bit_get__Fv */ u16 cc_pl_cut_bit_get() { daPy_py_c* link = (daPy_py_c*)dComIfGp_getPlayer(0); u16 bit = 0; if (link->getCutType() == daPy_py_c::TYPE_CUT_VERTICAL) { bit = 0x1; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_STAB) { bit = 0x2; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_STAB_COMBO) { bit = 0x200; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_SWEEP) { bit = 0x4; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_HORIZONTAL) { bit = 0x8; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_LEFT_SWEEP_FINISH) { bit = 0x20; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_DOWN_FINISH) { bit = 0x40; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_TURN_RIGHT || link->getCutType() == 9 || link->getCutType() == 43 || link->getCutType() == daPy_py_c::TYPE_CUT_LARGE_TURN_RIGHT) { bit = 0x80; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_TURN_LEFT || link->getCutType() == daPy_py_c::TYPE_CUT_LARGE_TURN_LEFT) { bit = 0x800; } else if (link->getCutType() == daPy_py_c::TYPE_CUT_JUMP) { bit = 0x100; } else if (link->getCutType() == 40 || link->getCutType() == 41) { bit = 0x400; } return bit; } /* 800874C4-800874F0 081E04 002C+00 1/1 0/0 0/0 .text getMapInfo__FSc */ static int getMapInfo(s8 param_0) { int map_info = 30; if (param_0 == 1) { map_info = 31; } else if (param_0 == 2) { map_info = 32; } return map_info; } /* 800874F0-80087514 081E30 0024+00 2/2 0/0 0/0 .text getHitId__FP8cCcD_Obji */ static u32 getHitId(cCcD_Obj* obj, int param_1) { dCcD_GObjInf* dObj = static_cast(obj); return dObj->getHitSeID(dObj->GetAtSe(), param_1); } /* 80087514-80087594 081E54 0080+00 0/0 0/0 47/47 .text * def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c */ void def_se_set(Z2Creature* sound, cCcD_Obj* collider, u32 map_info, fopAc_ac_c* actor) { if (sound != NULL) { int tmp; if (actor != NULL && fopAcM_checkStatus(actor, 0x280000)) { tmp = 0; } else { tmp = 1; } sound->startCollisionSE(getHitId(collider, tmp), map_info); } } /* 80087594-80087A58 081ED4 04C4+00 1/1 0/0 0/0 .text at_power_get__FP11dCcU_AtInfo */ static u8 at_power_get(dCcU_AtInfo* info) { u8 power = info->mpCollider->GetAtAtp(); if (info->mPowerType == 0) { if (info->mpCollider->ChkAtType(0x10000000)) { power = 0; } else if (power == 1) { power = 1; } else if (power == 2) { power = 10; } else if (power == 3) { power *= 10; } else if (power == 6) { power = 80; } else if (power >= 4) { power = 200; } } else if (info->mPowerType == 6) { if (info->mpCollider->ChkAtType(0x10000000)) { power = 0; } else if (power == 1) { power = 1; } else if (power == 2) { power = 10; } else if (power == 6) { power = 80; } else if (power >= 3) { power *= 10; } } else if (info->mPowerType == 4) { if (info->mpCollider->ChkAtType(0x400000)) { power = 200; } else if (info->mpCollider->ChkAtType(0x10000000)) { power = 0; } else if (power == 1) { power = 1; } else if (power == 2) { power = 10; } else if (power >= 3) { power *= 10; } else if (power == 6) { power = 80; } else if (power >= 4) { power = 200; } } else if (info->mPowerType == 5) { if (info->mpCollider->ChkAtType(0x2000)) { power = 0; } else if (power == 1) { power = 1; } else if (power == 2) { power = 3; } else if (power >= 3) { power = 4; } } else if (info->mPowerType == 2) { if (info->mpCollider->ChkAtType(0x400000)) { power = 200; } else if (power == 1) { power = 1; } else if (power == 2) { power = 10; } else if (power == 3) { power = 20; } else if (power == 6) { power = 80; } else if (power >= 4) { power = 200; } } else if (info->mPowerType == 1) { if (info->mpCollider->ChkAtType(0x400000) || power >= 4) { power = 200; } else { power *= 10; } } else if (info->mPowerType == 3) { if (info->mpCollider->ChkAtType(0x400000) || power >= 4) { power = 200; } else if (power == 1) { power = 10; } else if (power == 2) { power = 20; } else if (power >= 3) { power = 40; } } else if (info->mPowerType == 7) { if (info->mpCollider->ChkAtType(0x420008)) { power = 50; } else if (info->mpCollider->ChkAtType(0x2000)) { power = 27; } else if (power == 1) { power = 1; } else if (power == 2) { power = 10; } else if (power == 3) { power *= 10; } else if (power == 6) { power = 80; } else if (power >= 4) { power = 200; } } else if (info->mPowerType == 8) { if (power == 1) { power = 3; } else if (power == 2) { power = 10; } else if (power == 6) { power = 80; } else if (power >= 3) { power *= 10; } } else if (info->mPowerType == 9 || info->mPowerType == 10) { if (info->mpCollider->ChkAtType(0x4000)) { power = 0; } if (info->mpCollider->ChkAtType(0x400000)) { power = 19; } if (power == 1) { power = 4; } else if (power == 2) { power = 8; } else if (power == 3) { power *= 10; } else if (power == 6) { power = 80; } else if (power >= 4) { power = 200; } } else if (info->mPowerType == 11) { if (info->mpCollider->ChkAtType(0x4000)) { power = 0; } if (power == 1) { power = 10; } else if (power == 2) { power = 20; } else if (power == 3) { power = 30; } else if (power >= 4) { power = 100; } } else if (info->mPowerType == 12) { if (power == 1) { power = 10; } else if (power == 2) { power = 20; } else if (power == 3) { power = 30; } else if (power >= 4) { power = 100; } } return power; } /* 80087A58-80087C04 082398 01AC+00 1/1 0/0 38/38 .text at_power_check__FP11dCcU_AtInfo */ fopAc_ac_c* at_power_check(dCcU_AtInfo* info) { if (info->mpCollider == NULL) { return NULL; } info->mpActor = info->mpCollider->GetAc(); info->mHitType = 12; info->mAttackPower = 0; info->mHitBit = 0; if (info->mpActor != NULL) { info->mAttackPower = at_power_get(info); s16 ac_name = fopAcM_GetName(info->mpActor); if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { if (info->mpCollider->ChkAtType(0x8000) || info->mpCollider->ChkAtType(0x400000)) { info->mHitType = 9; } else { info->mHitType = 1; info->mHitBit = cc_pl_cut_bit_get(); } } else if (ac_name == PROC_NBOMB) { info->mHitType = 2; info->mHitBit = 0x10000000; } else if (ac_name == PROC_BOOMERANG) { info->mHitType = 10; info->mHitBit = 0x40000000; } else if (ac_name == PROC_ARROW) { info->mHitType = 15; info->mHitBit = 0x80000000; } } info->mHitStatus = 0; if (info->mpCollider->ChkAtType(0x40) || info->mpCollider->ChkAtType(0x10000) || info->mpCollider->ChkAtType(0x80) || info->mpCollider->ChkAtType(0x10)) { info->mHitType = 0x10; } else if (info->mpCollider->ChkAtType(0x4000)) { info->mHitBit = 0x1000; } else { s16 ac_name = fopAcM_GetName(info->mpActor); if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { if (dCcD_GetGObjInf(info->mpCollider)->GetAtSpl() == 1) { info->mHitStatus = 1; } } else if (info->mAttackPower >= 3) { info->mHitStatus = 1; } } return info->mpActor; } /* ############################################################################################## */ /* 80452798-804527A0 000D98 0004+04 1/1 0/0 0/0 .sdata2 @4212 */ SECTION_SDATA2 static f32 lit_4212[1 + 1 /* padding */] = { 0.0f, /* padding */ 0.0f, }; /* 804527A0-804527A8 000DA0 0008+00 1/1 0/0 0/0 .sdata2 @4213 */ SECTION_SDATA2 static f64 lit_4213 = 0.5; /* 804527A8-804527B0 000DA8 0008+00 1/1 0/0 0/0 .sdata2 @4214 */ SECTION_SDATA2 static f64 lit_4214 = 3.0; /* 804527B0-804527B8 000DB0 0008+00 1/1 0/0 0/0 .sdata2 @4215 */ SECTION_SDATA2 static u8 lit_4215[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* 804527B8-804527BC 000DB8 0004+00 1/1 0/0 0/0 .sdata2 @4216 */ SECTION_SDATA2 static f32 lit_4216 = 100.0f; /* 804527BC-804527C0 000DBC 0004+00 1/1 0/0 0/0 .sdata2 @4217 */ SECTION_SDATA2 static f32 lit_4217 = 4000.0f; /* 804527C0-804527C8 000DC0 0004+04 1/1 0/0 0/0 .sdata2 @4218 */ SECTION_SDATA2 static f32 lit_4218[1 + 1 /* padding */] = { 10000.0f, /* padding */ 0.0f, }; /* 80087C04-80088134 082544 0530+00 0/0 0/0 84/84 .text cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo */ // reg issues #ifdef NONMATCHING fopAc_ac_c* cc_at_check(fopAc_ac_c* enemy, dCcU_AtInfo* info) { daPy_py_c* link = (daPy_py_c*)dComIfGp_getPlayer(0); info->mpActor = at_power_check(info); if (info->mpActor != NULL) { cXyz tmp = info->mpActor->mSpeed; tmp.y = 0.0f; if (tmp.abs() > 100.0f) { f32 x = info->mpActor->mSpeed.x; f32 z = info->mpActor->mSpeed.z; info->mHitDirection = cM_atan2s(-x, -z) + (s16)cM_rndFX(4000.0f); } else { if (fopAcM_GetName(info->mpActor) == PROC_BOOMERANG) { f32 x_diff = enemy->mCurrent.mPosition.x - link->mCurrent.mPosition.x; f32 z_diff = enemy->mCurrent.mPosition.z - link->mCurrent.mPosition.z; info->mHitDirection = cM_atan2s(-x_diff, -z_diff) + (s16)cM_rndFX(10000.0f); } else { f32 x_diff = enemy->mCurrent.mPosition.x - info->mpActor->mCurrent.mPosition.x; f32 z_diff = enemy->mCurrent.mPosition.z - info->mpActor->mCurrent.mPosition.z; info->mHitDirection = cM_atan2s(-x_diff, -z_diff); } } if (info->mHitType == 1 && link->getCutType() == daPy_py_c::TYPE_CUT_HEAD) { info->mHitDirection = link->mCollisionRot.y; } if (info->mpCollider->ChkAtType(0x4000) && fopAcM_checkStatus(enemy, 0x380000)) { info->mAttackPower = 0; } if (static_cast(info->mpCollider)->GetAtMtrl() == 4) { if (fopAcM_GetName(enemy) == PROC_B_GND) { info->mAttackPower = 0; } else if (fopAcM_GetName(enemy) != PROC_B_ZANT) { info->mAttackPower = 100; } } if (info->mHitType == 1) { if (!daPy_py_c::checkNowWolf()) { if (link->checkMasterSwordEquip()) { info->mAttackPower *= 2; } if (daPy_py_c::checkWoodSwordEquip()) { // probably supposed to be some sort of division info->mAttackPower = info->mAttackPower >> 1; } } if (link->getSwordAtUpTime()) { info->mAttackPower *= 2; info->mHitStatus = 1; } } if (info->mAttackPower != 0) { enemy->field_0x562 -= info->mAttackPower; } s8 pause_time = 0; if (info->mAttackPower != 0 && enemy->field_0x562 <= 0) { info->mHitStatus = 2; enemy->field_0x562 = 0; } int uvar8; if (info->mpCollider->ChkAtType(0x4000) && !fopAcM_checkStatus(enemy, 0x280000)) { uvar8 = 1; } else { uvar8 = 0; } if (info->mpSound != NULL) { if (info->field_0x18 != 0) { info->mpSound->startCollisionSE(getHitId(info->mpCollider, uvar8), info->field_0x18); } else { info->mpSound->startCollisionSE(getHitId(info->mpCollider, uvar8), getMapInfo(info->mHitStatus)); } } if (info->mHitStatus != 0) { pause_time = 5; } else { if (info->mAttackPower > 1) { pause_time = 2; } } if (info->mpCollider->ChkAtType(0x8000000) || ((daPy_py_c*)dComIfGp_getPlayer(0))->checkHorseRide()) { // actor is Bulblin or Horseback Ganon // add bulblin class later if ((fopAcM_GetName(enemy) == PROC_E_RD && *(char*)((char*)&enemy + 0x1292) != 0) || fopAcM_GetName(enemy) == PROC_B_GND) { pause_time = 3; } else { pause_time = 0; } } s16 ac_name = fopAcM_GetName(enemy); // actor is Stalkin, Chu, Keese, Shadow Keese, Shadow Vermin, Baby Gohma, or Rat if (ac_name == PROC_E_BS || ac_name == PROC_E_SM2 || ac_name == PROC_E_BA || ac_name == PROC_E_YK || ac_name == PROC_E_YG || ac_name == PROC_E_GM || ac_name == PROC_E_MS) { pause_time = 0; } if (info->mHitType == 1 || info->mpCollider->ChkAtType(0x8)) { if (!link->checkCutJumpCancelTurn() && info->mpCollider->ChkAtType(0x8)) { pause_time = 4; } dScnPly_c::setPauseTimer(pause_time); } } return info->mpActor; } #else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm fopAc_ac_c* cc_at_check(fopAc_ac_c* param_0, dCcU_AtInfo* param_1) { nofralloc #include "asm/d/cc/d_cc_uty/cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo.s" } #pragma pop #endif /* 80088134-8008813C 082A74 0008+00 0/0 1/0 0/0 .text checkCutJumpCancelTurn__9daPy_py_cCFv */ int daPy_py_c::checkCutJumpCancelTurn() const { return 0; }