// // Generated By: dol2asm // Translation Unit: d/cc/d_cc_uty // #include "d/cc/d_cc_uty.h" #include "Z2AudioLib/Z2Creature.h" #include "d/a/d_a_player.h" #include "d/d_procname.h" #include "d/s/d_s_play.h" #include "dol2asm.h" #include "f_op/f_op_actor_mng.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(); // // 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, // CUT_VERTICAL 1, // CUT_STAB 1, // CUT_SWEEP 2, // CUT_HORIZONTAL 0, // CUT_HEAD 2, // CUT_LEFT_SWEEP_FINISH 1, // CUT_DOWN_FINISH 0, // CUT_TURN_RIGHT 0, // 0, // CUT_JUMP 2, // 1, // 1, // 1, // 2, // 2, // CUT_AIR 1, // 1, // CUT_LARGE_JUMP_INIT 0, // CUT_LARGE_JUMP 0, // CUT_LARGE_JUMP_FINISH 1, // CUT_RIGHT_SWEEP_FINISH 0, // CUT_TURN_LEFT 0, // CUT_LARGE_TURN_LEFT 0, // CUT_LARGE_TURN_RIGHT 0, // 0, // CUT_FAST_MOVE 0, // 0, // 0, // 0, // CUT_TWIRL 0, // CUT_FAST 0, // CUT_STAB_FINISH 2, // CUT_STAB_COMBO 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::CUT_TYPE_NM_VERTICAL) { bit = 0x1; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_NM_STAB) { bit = 0x2; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_COMBO_STAB) { bit = 0x200; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_NM_RIGHT) { bit = 0x4; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_NM_LEFT) { bit = 0x8; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_FINISH_LEFT) { bit = 0x20; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_FINISH_VERTICAL) { bit = 0x40; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_TURN_RIGHT || link->getCutType() == 9 || link->getCutType() == 43 || link->getCutType() == daPy_py_c::CUT_TYPE_LARGE_TURN_RIGHT) { bit = 0x80; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_TURN_LEFT || link->getCutType() == daPy_py_c::CUT_TYPE_LARGE_TURN_LEFT) { bit = 0x800; } else if (link->getCutType() == daPy_py_c::CUT_TYPE_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* p_obj, int useReboundSE) { dCcD_GObjInf* dObj = static_cast(p_obj); return dObj->getHitSeID(dObj->GetAtSe(), useReboundSE); } /* 80087514-80087594 081E54 0080+00 0/0 0/0 47/47 .text * def_se_set__FP10Z2CreatureP8cCcD_ObjUlP10fopAc_ac_c */ void def_se_set(Z2Creature* p_sound, cCcD_Obj* p_collider, u32 map_info, fopAc_ac_c* p_actor) { if (p_sound != NULL) { int useReboundSE; if (p_actor != NULL && fopAcM_checkStatus(p_actor, 0x280000)) { useReboundSE = false; } else { useReboundSE = true; } p_sound->startCollisionSE(getHitId(p_collider, useReboundSE), 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* p_info) { u8 power = p_info->mpCollider->GetAtAtp(); if (p_info->mPowerType == 0) { if (p_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 (p_info->mPowerType == 6) { if (p_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 (p_info->mPowerType == 4) { if (p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL)) { power = 200; } else if (p_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 (p_info->mPowerType == 5) { if (p_info->mpCollider->ChkAtType(AT_TYPE_ARROW)) { power = 0; } else if (power == 1) { power = 1; } else if (power == 2) { power = 3; } else if (power >= 3) { power = 4; } } else if (p_info->mPowerType == 2) { if (p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL)) { 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 (p_info->mPowerType == 1) { if (p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL) || power >= 4) { power = 200; } else { power *= 10; } } else if (p_info->mPowerType == 3) { if (p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL) || power >= 4) { power = 200; } else if (power == 1) { power = 10; } else if (power == 2) { power = 20; } else if (power >= 3) { power = 40; } } else if (p_info->mPowerType == 7) { if (p_info->mpCollider->ChkAtType(0x420008)) { power = 50; } else if (p_info->mpCollider->ChkAtType(AT_TYPE_ARROW)) { 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 (p_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 (p_info->mPowerType == 9 || p_info->mPowerType == 10) { if (p_info->mpCollider->ChkAtType(AT_TYPE_HOOKSHOT)) { power = 0; } if (p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL)) { 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 (p_info->mPowerType == 11) { if (p_info->mpCollider->ChkAtType(AT_TYPE_HOOKSHOT)) { 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 (p_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* p_info) { if (p_info->mpCollider == NULL) { return NULL; } p_info->mpActor = p_info->mpCollider->GetAc(); p_info->mHitType = 12; p_info->mAttackPower = 0; p_info->mHitBit = 0; if (p_info->mpActor != NULL) { p_info->mAttackPower = at_power_get(p_info); s16 ac_name = fopAcM_GetName(p_info->mpActor); if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { if (p_info->mpCollider->ChkAtType(0x8000) || p_info->mpCollider->ChkAtType(AT_TYPE_IRON_BALL)) { p_info->mHitType = HIT_TYPE_LINK_HEAVY_ATTACK; } else { p_info->mHitType = HIT_TYPE_LINK_NORMAL_ATTACK; p_info->mHitBit = cc_pl_cut_bit_get(); } } else if (ac_name == PROC_NBOMB) { p_info->mHitType = HIT_TYPE_BOMB; p_info->mHitBit = 0x10000000; } else if (ac_name == PROC_BOOMERANG) { p_info->mHitType = HIT_TYPE_BOOMERANG; p_info->mHitBit = 0x40000000; } else if (ac_name == PROC_ARROW) { p_info->mHitType = HIT_TYPE_ARROW; p_info->mHitBit = 0x80000000; } } p_info->mHitStatus = 0; if (p_info->mpCollider->ChkAtType(0x40) || p_info->mpCollider->ChkAtType(AT_TYPE_BOOMERANG) || p_info->mpCollider->ChkAtType(AT_TYPE_SLINGSHOT) || p_info->mpCollider->ChkAtType(AT_TYPE_SHIELD_ATTACK)) { p_info->mHitType = HIT_TYPE_STUN; } else if (p_info->mpCollider->ChkAtType(AT_TYPE_HOOKSHOT)) { p_info->mHitBit = 0x1000; } else { s16 ac_name = fopAcM_GetName(p_info->mpActor); if (ac_name == PROC_ALINK || ac_name == PROC_ALINK) { if (dCcD_GetGObjInf(p_info->mpCollider)->GetAtSpl() == 1) { p_info->mHitStatus = 1; } } else if (p_info->mAttackPower >= 3) { p_info->mHitStatus = 1; } } return p_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 */ // data padding issues (?) #ifdef NONMATCHING fopAc_ac_c* cc_at_check(fopAc_ac_c* p_enemy, dCcU_AtInfo* p_info) { daPy_py_c* link = (daPy_py_c*)dComIfGp_getPlayer(0); p_info->mpActor = at_power_check(p_info); f32 x_diff; f32 z_diff; if (p_info->mpActor != NULL) { cXyz tmp = p_info->mpActor->speed; tmp.y = 0.0f; if (tmp.abs() > 100.0f) { f32 x = p_info->mpActor->speed.x; f32 z = p_info->mpActor->speed.z; p_info->mHitDirection = cM_atan2s(-x, -z) + (s16)cM_rndFX(4000.0f); } else { if (fopAcM_GetName(p_info->mpActor) == PROC_BOOMERANG) { x_diff = p_enemy->current.pos.x - link->current.pos.x; z_diff = p_enemy->current.pos.z - link->current.pos.z; p_info->mHitDirection = cM_atan2s(-x_diff, -z_diff) + (s16)cM_rndFX(10000.0f); } else { x_diff = p_enemy->current.pos.x - p_info->mpActor->current.pos.x; z_diff = p_enemy->current.pos.z - p_info->mpActor->current.pos.z; p_info->mHitDirection = cM_atan2s(-x_diff, -z_diff); } } if (p_info->mHitType == HIT_TYPE_LINK_NORMAL_ATTACK && link->getCutType() == daPy_py_c::CUT_TYPE_HEAD_JUMP) { p_info->mHitDirection = link->shape_angle.y; } if (p_info->mpCollider->ChkAtType(AT_TYPE_HOOKSHOT) && fopAcM_checkStatus(p_enemy, 0x380000)) { p_info->mAttackPower = 0; } if (static_cast(p_info->mpCollider)->GetAtMtrl() == 4) { if (fopAcM_GetName(p_enemy) == PROC_B_GND) { p_info->mAttackPower = 0; } else if (fopAcM_GetName(p_enemy) != PROC_B_ZANT) { p_info->mAttackPower = 100; } } if (p_info->mHitType == HIT_TYPE_LINK_NORMAL_ATTACK) { if (!daPy_py_c::checkNowWolf()) { if (link->checkMasterSwordEquip()) { p_info->mAttackPower *= 2; } if (daPy_py_c::checkWoodSwordEquip()) { p_info->mAttackPower /= 2; } } if (link->getSwordAtUpTime()) { p_info->mAttackPower *= 2; p_info->mHitStatus = 1; } } if (p_info->mAttackPower != 0) { p_enemy->mHealth -= p_info->mAttackPower; } s8 pause_time = 0; if (p_info->mAttackPower != 0 && p_enemy->mHealth <= 0) { p_info->mHitStatus = 2; p_enemy->mHealth = 0; } int uvar8; if (p_info->mpCollider->ChkAtType(AT_TYPE_HOOKSHOT) && !fopAcM_checkStatus(p_enemy, 0x280000)) { uvar8 = 1; } else { uvar8 = 0; } if (p_info->mpSound != NULL) { if (p_info->field_0x18 != 0) { p_info->mpSound->startCollisionSE(getHitId(p_info->mpCollider, uvar8), p_info->field_0x18); } else { p_info->mpSound->startCollisionSE(getHitId(p_info->mpCollider, uvar8), getMapInfo(p_info->mHitStatus)); } } if (p_info->mHitStatus != 0) { pause_time = 5; } else { if (p_info->mAttackPower > 1) { pause_time = 2; } } if (p_info->mpCollider->ChkAtType(AT_TYPE_MIDNA_LOCK) || ((daPy_py_c*)dComIfGp_getPlayer(0))->checkHorseRide()) { // actor is Bulblin or Horseback Ganon if ((fopAcM_GetName(p_enemy) == PROC_E_RD && ((s8*)p_enemy)[0x129a] != 0) || fopAcM_GetName(p_enemy) == PROC_B_GND) { pause_time = 3; } else { pause_time = 0; } } s16 ac_name = fopAcM_GetName(p_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 ((p_info->mHitType == HIT_TYPE_LINK_NORMAL_ATTACK || p_info->mpCollider->ChkAtType(AT_TYPE_THROW_OBJ)) && !link->checkCutJumpCancelTurn()) { if (p_info->mpCollider->ChkAtType(AT_TYPE_THROW_OBJ)) { pause_time = 4; } dScnPly_c::setPauseTimer(pause_time); } } return p_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; }