mirror of
https://github.com/zeldaret/ss
synced 2026-09-01 17:39:55 -04:00
@@ -1,3 +1,93 @@
|
||||
#include "d/t/d_t_action.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/a/obj/d_a_obj_bomb.h"
|
||||
#include "d/d_player.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "toBeSorted/area_math.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(ACTION_TAG, dTgAction_c, fProfile::ACTION_TAG, 0x20, 0, 0);
|
||||
|
||||
int dTgAction_c::create() {
|
||||
mEnableFlag1 = (params >> 6) & 0xFF;
|
||||
mEnableFlag2 = (params >> 14) & 0xFF;
|
||||
mType = (params >> 0) & 0x3F;
|
||||
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, 0.f);
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dTgAction_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
void dTgAction_c::setActiveArea(f32 scale) {
|
||||
if (mScaleIncrease < 0.1f) {
|
||||
mScaleIncrease = scale;
|
||||
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, mScaleIncrease);
|
||||
}
|
||||
}
|
||||
|
||||
void dTgAction_c::resetActiveArea() {
|
||||
if (mScaleIncrease > 0.f) {
|
||||
mScaleIncrease = 0.f;
|
||||
matrixCreateFromPosRotYScale(mActiveMtx, position, rotation.y, mScale, nullptr, 0.f);
|
||||
field_0x134 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int dTgAction_c::actorExecute() {
|
||||
dAcPy_c *player = getLinkPtr();
|
||||
bool enabled = !checkActive1() && checkActive2();
|
||||
|
||||
// Check For Bomb within area
|
||||
if (enabled && mType == WATER_RELATED) {
|
||||
s32 numRefs = player->getBeetleActorReferencesSize();
|
||||
for (s32 i = 0; i < numRefs; i++) {
|
||||
dAcObjBase_c *pObj = player->checkBeetleActorReferences(i);
|
||||
if (pObj == nullptr) {
|
||||
break;
|
||||
}
|
||||
if (pObj->profile_name == fProfile::BOMB) {
|
||||
if (checkIfVec3fInMatrix(mActiveMtx, pObj->GetPosition())) {
|
||||
reinterpret_cast<dAcBomb_c *>(pObj)->On_0xA3C(0x20000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check For Player Within Area
|
||||
if (enabled && checkIfVec3fInMatrix(mActiveMtx, player->GetPosition())) {
|
||||
if (mType == FORCE_FADE_RESTART) {
|
||||
player->onFlags_0x358(0x10000000);
|
||||
setActiveArea(50.f);
|
||||
} else if (mType == PREVENT_RESPAWN) {
|
||||
player->onForceOrPreventActionFlags(0x80);
|
||||
} else if (mType == FORCE_AUTO_JUMP) {
|
||||
player->onForceOrPreventActionFlags(0x200000);
|
||||
} else if (mType == PREVENT_LOFTWING_CALL) {
|
||||
player->onForceOrPreventActionFlags(0x20000);
|
||||
setActiveArea(50.f);
|
||||
} else if (mType == WATER_RELATED) {
|
||||
player->onForceOrPreventActionFlags(0x400000);
|
||||
setActiveArea(15.f);
|
||||
} else if (mType == SHOW_DASH_PROMPT) {
|
||||
if (mAng::abs(player->rotation.y - rotation.y) < (0x2000 + field_0x134)) {
|
||||
player->onForceOrPreventActionFlags(0x20000000);
|
||||
setActiveArea(50.f);
|
||||
field_0x134.set(0x38E);
|
||||
} else {
|
||||
resetActiveArea();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resetActiveArea();
|
||||
}
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
int dTgAction_c::draw() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
@@ -431,8 +431,8 @@ bool dAcBase_c::getDistanceAndAngleToActor(
|
||||
angleToActorX.set(cLib::targetAngleX(position, actor->position));
|
||||
|
||||
if ((distSquared <= distThresh * distThresh)) {
|
||||
if ((labs(mAng(rotation.y.diff(angleToActorY))) <= yAngle) &&
|
||||
(labs(mAng(rotation.x.diff(angleToActorX))) <= xAngle)) {
|
||||
if (mAng::abs((s32)(rotation.y - angleToActorY)) <= yAngle &&
|
||||
mAng::abs((s32)(rotation.x - angleToActorX)) <= xAngle) {
|
||||
isWithinRange = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user