1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

En_Tite OK (#555)

* EnTite_Update matching

* Fixes to update

* made good progress, func_80B1A2A0 is in a good place to be matching soon

* Merge stuff

* func_80B19E94 done, func_80B18CC4 done

* EnTite_Destroy and EnTite_Init done

* Commenting out sDamageTable and EnTite_Init until all the data matches

* Some more small functions done

* more progress

* func_80B19918 done

* func_80B18E7C done

* func_80B19524 done

* more progress

* EnTite_Draw equiv but nonmatching, file otherwise done

* Found some unstaged changed on old laptop

* Draw matching: File fully matching!

* Documentation

* finished documentation

* deleted data files

* update spec

* fixed waterY -> yDistToWater rename after merge

* ran format.sh

* fixing accidental renames in camera

* Fixed some obvious number/comment formatting issues

* Removed unecessary prototypes

* merge

* running format.sh

* suggestions

* more pr comment changes

* format to push

* one more change

* more renames (see pr comments)

* merge

* renames

* format.sh

* fix renames

* function comment formatting

* merge + format

* endless merge fixes

* merge fixes until  die

* yet again a merge fix

* pr suggestions
This commit is contained in:
AdamKiddle 2020-12-31 20:00:30 +00:00 committed by GitHub
parent 5a2bd7a035
commit 600bad1f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
147 changed files with 1431 additions and 3642 deletions

View file

@ -167,7 +167,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (BgBdanObjects_GetContactRu1(this, 0)) {
if (this->dyna.actor.xzDistFromLink < 250.0f) {
if (this->dyna.actor.xzDistToLink < 250.0f) {
BgBdanObjects_SetContactRu1(this, 1);
this->unk_16A = 0x14;
func_800800F8(globalCtx, 0xBFE, -0x63, &this->dyna.actor, 0);
@ -322,7 +322,7 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
if (func_8004356C(&this->dyna.actor)) {
if (this->dyna.actor.xzDistFromLink < 120.0f) {
if (this->dyna.actor.xzDistToLink < 120.0f) {
this->actionFunc = func_8086C7D0;
func_800800F8(globalCtx, 0xC12, -0x63, &this->dyna.actor, 0);
}

View file

@ -262,7 +262,7 @@ void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (this->unk_1C8 <= 0.1f) {
func_8086D730(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 0x78, 0x14, 0xA);
}
}
}
@ -324,7 +324,7 @@ void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (this->unk_1C8 <= 0.6f) {
func_8086D9F8(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 0x78, 0x14, 0xA);
}
}
@ -339,7 +339,7 @@ void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) {
if (this->unk_1C8 <= 0.1f) {
func_8086DB24(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH);
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 0x78, 0x14, 0xA);
}
}
}

View file

@ -192,7 +192,7 @@ void func_8086ED70(BgBombwall* this, GlobalContext* globalCtx) {
this->collider.base.acFlags &= ~2;
func_8086EDFC(this, globalCtx);
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
} else if (this->dyna.actor.xzDistFromLink < 600.0f) {
} else if (this->dyna.actor.xzDistToLink < 600.0f) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}

View file

@ -137,7 +137,7 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) {
Vec3f center;
s16 i;
if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistFromLinkSq < 4900.0f))) {
if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToLinkSq < 4900.0f))) {
osSyncPrintf("OTC O 1\n");
for (i = 0; i < ARRAY_COUNT(D_80876A68); i++) {

View file

@ -56,7 +56,7 @@ extern ColHeader D_060131C4;
static s16 sSkullOfTruthRotY = 0x100;
static u8 sPuzzleState = 1;
static f32 sStatueDistFromLink = 0;
static f32 sStatueDistToLink = 0;
static s16 sStatueRotY;
@ -113,7 +113,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == BGHAKAGATE_STATUE) {
DynaPolyInfo_Alloc(&D_060131C4, &colHeader);
this->vTimer = 0;
sStatueDistFromLink = 0.0f;
sStatueDistToLink = 0.0f;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
this->actionFunc = BgHakaGate_StatueInactive;
} else {
@ -172,7 +172,7 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) {
if (this->dyna.unk_150 != 0.0f) {
if (this->vTimer == 0) {
this->vInitTurnAngle = this->dyna.actor.shape.rot.y - this->dyna.actor.yawTowardsLink;
sStatueDistFromLink = this->dyna.actor.xzDistFromLink;
sStatueDistToLink = this->dyna.actor.xzDistToLink;
forceDirection = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f;
linkDirection = ((s16)(this->dyna.actor.yawTowardsLink - player->actor.shape.rot.y) > 0) ? -1 : 1;
this->vTurnDirection = linkDirection * forceDirection;
@ -203,15 +203,15 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) {
turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10);
turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection;
this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f);
if ((player->stateFlags2 & 0x10) && (sStatueDistFromLink > 0.0f)) {
if ((player->stateFlags2 & 0x10) && (sStatueDistToLink > 0.0f)) {
player->actor.posRot.pos.x =
this->dyna.actor.initPosRot.pos.x +
(Math_SinS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistFromLink);
(Math_SinS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistToLink);
player->actor.posRot.pos.z =
this->dyna.actor.initPosRot.pos.z +
(Math_CosS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistFromLink);
(Math_CosS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistToLink);
} else {
sStatueDistFromLink = 0.0f;
sStatueDistToLink = 0.0f;
}
sStatueRotY = this->dyna.actor.shape.rot.y;
if (turnFinished) {
@ -227,7 +227,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) {
}
void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) {
if ((sStatueDistFromLink > 1.0f) && (sStatueRotY != 0)) {
if ((sStatueDistToLink > 1.0f) && (sStatueRotY != 0)) {
Player* player = PLAYER;
f32 radialDist;
f32 angDist;
@ -242,7 +242,7 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) {
if ((radialDist > 110.0f) || (fabsf(angDist) > 40.0f)) {
s16 yawDiff = sSkullOfTruthRotY - sStatueRotY;
sStatueDistFromLink = 0.0f;
sStatueDistToLink = 0.0f;
if (ABS(yawDiff) < 0x80) {
Flags_SetSwitch(globalCtx, this->switchFlag);
sPuzzleState = SKULL_OF_TRUTH_FOUND;

View file

@ -197,7 +197,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) {
thisx->velocity.z = Rand_CenteredFloat(8.0f);
BgHeavyBlock_SetPieceRandRot(this, 1.0f);
Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_BROKEN);
func_800AA000(thisx->xzDistFromLink, 0x96, 0xA, 8);
func_800AA000(thisx->xzDistToLink, 0x96, 0xA, 8);
}
}

View file

@ -300,7 +300,7 @@ void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) {
Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0);
Quake_SetCountdown(quakeIndex, 20);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 255, 20, 150);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 255, 20, 150);
func_80888638(&this->dyna.actor, globalCtx);
osSyncPrintf("A(%d)\n", this->dyna.actor.params);
}

View file

@ -114,7 +114,7 @@ void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx) {
}
void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx) {
if (this->dyna.actor.xzDistFromLink < 60.0f) {
if (this->dyna.actor.xzDistToLink < 60.0f) {
this->shiverTimer = 10;
this->actionFunc = BgIceTurara_Shiver;
}

View file

@ -79,8 +79,8 @@ void func_808933BC(BgJyaAmishutter* this) {
}
void func_808933CC(BgJyaAmishutter* this) {
if (this->actor.xzDistFromLink < 60.0f) {
if (fabsf(this->actor.yDistFromLink) < 30.0f) {
if (this->actor.xzDistToLink < 60.0f) {
if (fabsf(this->actor.yDistToLink) < 30.0f) {
func_80893428(this);
}
}
@ -104,7 +104,7 @@ void func_808934B0(BgJyaAmishutter* this) {
}
void func_808934C0(BgJyaAmishutter* this) {
if (this->actor.xzDistFromLink > 300.0f) {
if (this->actor.xzDistToLink > 300.0f) {
func_808934FC(this);
}
}

View file

@ -410,7 +410,7 @@ void BgMizuBwall_Idle(BgMizuBwall* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WALL_BROKEN);
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->actionFunc = BgMizuBwall_Break;
} else if (this->dyna.actor.xzDistFromLink < 600.0f) {
} else if (this->dyna.actor.xzDistToLink < 600.0f) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}

View file

@ -122,7 +122,7 @@ void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) {
if ((this->dyna.actor.posRot.pos.x == this->closedPos.x) &&
(this->dyna.actor.posRot.pos.y == this->closedPos.y) &&
(this->dyna.actor.posRot.pos.z == this->closedPos.z)) {
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 0x78, 0x14, 0xA);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
this->actionFunc = BgMizuShutter_WaitForSwitch;
}

View file

@ -161,7 +161,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) {
if (this->bounceCount == 0) {
this->fallCount++;
func_800788CC(NA_SE_EV_STONE_BOUND);
func_800AA000(SQ(thisx->yDistFromLink), 0xFF, 0x14, 0x96);
func_800AA000(SQ(thisx->yDistToLink), 0xFF, 0x14, 0x96);
}
thisx->posRot.pos.y =
403.0f - (thisx->posRot.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y);

View file

@ -228,7 +228,7 @@ void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) {
}
this->timer = 45;
this->actionFunc = BgPoEvent_BlockShake;
} else if (this->dyna.actor.xzDistFromLink > 50.0f) {
} else if (this->dyna.actor.xzDistToLink > 50.0f) {
if (this->type != 1) {
sPuzzleState |= (1 << this->index);
} else {
@ -505,9 +505,9 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) {
DECR(this->timer);
if (((this->timer == 0) || ((thisx->xzDistFromLink < 150.0f) && (thisx->yDistFromLink < 50.0f)) ||
(func_8002DD78(player) && (thisx->xzDistFromLink < 320.0f) &&
((this->index != 2) ? (thisx->yDistFromLink < 100.0f) : (thisx->yDistFromLink < 0.0f)) &&
if (((this->timer == 0) || ((thisx->xzDistToLink < 150.0f) && (thisx->yDistToLink < 50.0f)) ||
(func_8002DD78(player) && (thisx->xzDistToLink < 320.0f) &&
((this->index != 2) ? (thisx->yDistToLink < 100.0f) : (thisx->yDistToLink < 0.0f)) &&
func_8002DFC8(thisx, 0x2000, globalCtx))) &&
((thisx->parent != NULL) || (thisx->child != NULL))) {
/*The third condition in the || is checking if

View file

@ -151,7 +151,7 @@ void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx) {
void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += this->dyna.actor.gravity;
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 180, 20, 100);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 180, 20, 100);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
if (this->unk_169 != globalCtx->roomCtx.curRoom.num) {
func_800788CC(NA_SE_EN_PO_LAUGH);

View file

@ -164,7 +164,7 @@ void BgSpot08Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) {
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 40, NA_SE_EV_WALL_BROKEN);
func_80078884(NA_SE_SY_CORRECT_CHIME);
Actor_Kill(&this->dyna.actor);
} else if (this->dyna.actor.xzDistFromLink < 800.0f) {
} else if (this->dyna.actor.xzDistToLink < 800.0f) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}

View file

@ -345,15 +345,14 @@ void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) {
s32 yawDiff;
s32 absYawDiff;
if (this->actor.xzDistFromLink < 130.0f && this->actor.yDistFromLink < 160.0f &&
this->actor.yDistFromLink >= -10.0f) {
if (this->actor.xzDistToLink < 130.0f && this->actor.yDistToLink < 160.0f && this->actor.yDistToLink >= -10.0f) {
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
absYawDiff = ABS(yawDiff);
adjustedYawDiff = absYawDiff - 0x3FFF;
if (adjustedYawDiff > 0) {
sinValue = Math_SinS(adjustedYawDiff) * this->actor.xzDistFromLink;
sinValue = Math_SinS(adjustedYawDiff) * this->actor.xzDistToLink;
if (sinValue >= 0.0f) {
player->actor.posRot.pos.x += sinValue * this->sinRotation;

View file

@ -117,7 +117,7 @@ void BgSpot17Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot17Bakudankabe* this = THIS;
if (this->dyna.actor.xzDistFromLink < 650.0f && func_80033684(globalCtx, &this->dyna.actor) != NULL) {
if (this->dyna.actor.xzDistToLink < 650.0f && func_80033684(globalCtx, &this->dyna.actor) != NULL) {
func_808B6BC0(this, globalCtx);
Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F));
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 40, NA_SE_EV_WALL_BROKEN);

View file

@ -85,7 +85,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) {
u32 openGrotto = false;
if ((this->actor.params & 0x200) == 0) {
// opening with song of storms
if (this->actor.xyzDistFromLinkSq < 40000.0f && Flags_GetEnv(globalCtx, 5)) {
if (this->actor.xyzDistToLinkSq < 40000.0f && Flags_GetEnv(globalCtx, 5)) {
openGrotto = true;
this->actor.flags &= ~0x10;
}
@ -129,8 +129,8 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) {
DoorAna_SetupAction(this, DoorAna_GrabLink);
} else {
if (!Player_InCsMode(globalCtx) && !(player->stateFlags1 & 0x8800000) &&
this->actor.xzDistFromLink <= 15.0f && -50.0f <= this->actor.yDistFromLink &&
this->actor.yDistFromLink <= 15.0f) {
this->actor.xzDistToLink <= 15.0f && -50.0f <= this->actor.yDistToLink &&
this->actor.yDistToLink <= 15.0f) {
player->stateFlags1 |= 0x80000000;
this->actor.unk_1F = 1;
} else {
@ -145,7 +145,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) {
void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) {
Player* player;
if (this->actor.yDistFromLink <= 0.0f && 15.0f < this->actor.xzDistFromLink) {
if (this->actor.yDistToLink <= 0.0f && 15.0f < this->actor.xzDistToLink) {
player = PLAYER;
player->actor.posRot.pos.x = Math_SinS(this->actor.yawTowardsLink) * 15.0f + this->actor.posRot.pos.x;
player->actor.posRot.pos.z = Math_CosS(this->actor.yawTowardsLink) * 15.0f + this->actor.posRot.pos.z;

View file

@ -466,7 +466,7 @@ void func_80996F98(DoorShutter* this, GlobalContext* globalCtx) {
void func_80997004(DoorShutter* this, GlobalContext* globalCtx) {
if (DECR(this->unk_16E) == 0 && globalCtx->roomCtx.status == 0 && func_80996D14(this, globalCtx) != 0) {
if (((this->doorType == SHUTTER_BOSS) ? 20.0f : 50.0f) < this->dyna.actor.xzDistFromLink) {
if (((this->doorType == SHUTTER_BOSS) ? 20.0f : 50.0f) < this->dyna.actor.xzDistToLink) {
if (DoorShutter_SetupDoor(this, globalCtx)) {
this->dyna.actor.velocity.y = 30.0f;
}
@ -551,7 +551,7 @@ void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) {
Quake_SetSpeed(quakeId, -32536);
Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
Quake_SetCountdown(quakeId, 10);
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 0xB4, 0x14, 0x64);
func_800AA000(this->dyna.actor.xyzDistToLinkSq, 0xB4, 0x14, 0x64);
func_80997220(this, globalCtx);
}
}

View file

@ -159,14 +159,14 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
} else {
EnAni_SetupAction(this, func_809B04F0);
}
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistFromLink < 150.0f &&
-80.0f < this->actor.yDistFromLink) {
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToLink < 150.0f &&
-80.0f < this->actor.yDistToLink) {
if (gSaveContext.itemGetInf[1] & 0x20) {
EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..."
} else {
EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento."
}
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistFromLink < 350.0f) {
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToLink < 350.0f) {
EnAni_SetText(this, globalCtx, textId);
}
}
@ -185,14 +185,14 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
} else {
EnAni_SetupAction(this, func_809B0524);
}
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistFromLink < 150.0f &&
-80.0f < this->actor.yDistFromLink) {
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToLink < 150.0f &&
-80.0f < this->actor.yDistToLink) {
if ((gSaveContext.itemGetInf[1] & 0x20) != 0) {
EnAni_SetText(this, globalCtx, 0x5056); // "To get a good view..."
} else {
EnAni_SetText(this, globalCtx, 0x5055); // "...I'll give you this as a memento."
}
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistFromLink < 350.0f) {
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToLink < 350.0f) {
if ((gSaveContext.eventChkInf[2] & 0x8000) == 0) {
textId = 0x5052; // "...Something is happening on Death Mountain!"
} else {

View file

@ -79,12 +79,12 @@ void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) {
return;
}
if (this->actor.xzDistFromLink < (200.0f + this->triggerRange)) {
if (this->actor.xzDistToLink < (200.0f + this->triggerRange)) {
if (anubis->unk_260 == 0) {
if (anubis->unk_262 == 0) {
anubis->unk_25E = 1;
offset.x = -Math_SinS(this->actor.yawTowardsLink) * this->actor.xzDistFromLink;
offset.z = -Math_CosS(this->actor.yawTowardsLink) * this->actor.xzDistFromLink;
offset.x = -Math_SinS(this->actor.yawTowardsLink) * this->actor.xzDistToLink;
offset.z = -Math_CosS(this->actor.yawTowardsLink) * this->actor.xzDistToLink;
Math_ApproachF(&anubis->actor.posRot.pos.x, (this->actor.posRot.pos.x + offset.x), 0.3f, 10.0f);
Math_ApproachF(&anubis->actor.posRot.pos.z, (this->actor.posRot.pos.z + offset.z), 0.3f, 10.0f);
return;

View file

@ -41,7 +41,7 @@ void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
EnArowTrap* this = THIS;
if (this->actor.xzDistFromLink <= 400) {
if (this->actor.xzDistToLink <= 400) {
this->attackTimer--;
if (this->attackTimer == 0) {

View file

@ -346,7 +346,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->actor.bgCheckFlags & 0x20) && (this->actionFunc != func_809B5C18)) {
Math_Vec3f_Copy(&sp30, &this->actor.posRot.pos);
sp30.y += this->actor.waterY;
sp30.y += this->actor.yDistToWater;
EffectSsGSplash_Spawn(globalCtx, &sp30, 0, 0, 0, 0x190);
this->unk_2DC = 0.0f;
this->actor.gravity = 0.0f;
@ -357,7 +357,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
}
tmpf1 = 20.0f;
if (this->actor.xyzDistFromLinkSq < SQ(tmpf1)) {
if (this->actor.xyzDistToLinkSq < SQ(tmpf1)) {
cucco = (EnNiw*)this->actor.parent;
if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (cucco != NULL) &&
(cucco->timer9 == 0) && (player->invincibilityTimer == 0)) {

View file

@ -470,7 +470,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
if (this->charge && (this->targetActor == NULL)) {
this->vMoveAngleY = this->actor.posRot.rot.y;
if (this->actor.xzDistFromLink < 200.0f) {
if (this->actor.xzDistToLink < 200.0f) {
Animation_PlayLoop(&this->skelAnime, &D_06000184);
this->vMoveAngleY = this->actor.yawTowardsLink;
}
@ -484,7 +484,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->vMoveAngleY = Math_SinF(this->bobPhase) * 65535.0f;
}
}
if ((this->actor.xzDistFromLink < 150.0f) && (this->actionState != BBBLUE_NORMAL)) {
if ((this->actor.xzDistToLink < 150.0f) && (this->actionState != BBBLUE_NORMAL)) {
if (!this->charge) {
Animation_PlayLoop(&this->skelAnime, &D_06000184);
this->maxSpeed = (Rand_ZeroOne() * 1.5f) + 6.0f;
@ -492,7 +492,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) {
this->vMoveAngleY = this->actor.yawTowardsLink;
this->actionState = this->charge = true; // Sets actionState to BBBLUE_AGGRO
}
} else if (this->actor.xzDistFromLink < 200.0f) {
} else if (this->actor.xzDistToLink < 200.0f) {
this->vMoveAngleY = this->actor.yawTowardsLink;
}
if (this->targetActor == NULL) {

View file

@ -86,7 +86,7 @@ void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->dyna.actor.xzDistFromLink < 120.0f) {
if (this->dyna.actor.xzDistToLink < 120.0f) {
EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink);
}
player->stateFlags2 |= 0x04000000;

View file

@ -147,7 +147,7 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) {
if (this->explosionCollider.list->dim.modelSphere.radius == 0) {
this->actor.flags |= 0x20;
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
}
this->explosionCollider.list->dim.worldSphere.radius += this->actor.shape.rot.z + 8;
@ -215,7 +215,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(thisx, 0.01f);
}
if ((thisx->xzDistFromLink >= 20.0f) || (ABS(thisx->yDistFromLink) >= 80.0f)) {
if ((thisx->xzDistToLink >= 20.0f) || (ABS(thisx->yDistToLink) >= 80.0f)) {
this->bumpOn = true;
}
@ -314,7 +314,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMB_EXPLOSION)) {
if (thisx->waterY >= 20.0f) {
if (thisx->yDistToWater >= 20.0f) {
EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true,
DEADSOUND_REPEAT_MODE_OFF, 10);
Actor_Kill(thisx);

View file

@ -107,7 +107,7 @@ void EnBomBowMan_WaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) {
} else {
yawDiff = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y));
if (!(this->actor.xzDistFromLink > 120.0f) && (yawDiff < 0x4300)) {
if (!(this->actor.xzDistToLink > 120.0f) && (yawDiff < 0x4300)) {
func_8002F2CC(&this->actor, globalCtx, 120.0f);
}
}
@ -269,7 +269,7 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) {
}
} else {
yawDiff = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y));
if (!(this->actor.xzDistFromLink > 120.0f) && (yawDiff < 0x4300)) {
if (!(this->actor.xzDistToLink > 120.0f) && (yawDiff < 0x4300)) {
func_8002F2CC(&this->actor, globalCtx, 120.0f);
}
}

View file

@ -241,7 +241,7 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) {
if (this->explosionCollider.list->dim.modelSphere.radius == 0) {
this->actor.flags |= 0x20;
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
}
this->explosionCollider.list->dim.modelSphere.radius += 8;
@ -304,7 +304,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if ((!this->bumpOn) && (!Actor_HasParent(thisx, globalCtx)) &&
((thisx->xzDistFromLink >= 20.0f) || (ABS(thisx->yDistFromLink) >= 80.0f))) {
((thisx->xzDistToLink >= 20.0f) || (ABS(thisx->yDistToLink) >= 80.0f))) {
this->bumpOn = true;
}
@ -426,7 +426,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMBFLOWER_EXPLOSION)) {
if (thisx->waterY >= 20.0f) {
if (thisx->yDistToWater >= 20.0f) {
EffectSsDeadSound_SpawnStationary(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, true,
DEADSOUND_REPEAT_MODE_OFF, 10);
Actor_Kill(thisx);

View file

@ -261,10 +261,10 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == 6) && (this->swordDownTimer <= 0) &&
((Math3D_Dist2DSq(player->actor.posRot.pos.x, player->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
this->actor.initPosRot.pos.z) < SQ(120.0f)) ||
(this->actor.xzDistFromLink < 60.0f))) {
(this->actor.xzDistToLink < 60.0f))) {
EnButte_SetupFollowLink(this);
this->unk_257 = 2;
} else if (this->actor.xzDistFromLink < 120.0) {
} else if (this->actor.xzDistToLink < 120.0) {
this->unk_257 = 1;
} else {
this->unk_257 = 0;
@ -400,7 +400,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.update != NULL) {
Actor_MoveForward(&this->actor);
Math_StepToF(&this->actor.posRot.pos.y, this->posYTarget, 0.6f);
if (this->actor.xyzDistFromLinkSq < 5000.0f) {
if (this->actor.xyzDistToLinkSq < 5000.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
Actor_SetHeight(&this->actor, this->actor.shape.unk_08 * this->actor.scale.y);

View file

@ -278,8 +278,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
switch (this->unk_221) {
case 3:
Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f);
if ((this->unk_224 == 0) && (this->actor.xzDistFromLink < 200.0f) &&
(ABS(this->actor.yDistFromLink) < 50.0f) && func_8002E084(&this->actor, 0x1C70)) {
if ((this->unk_224 == 0) && (this->actor.xzDistToLink < 200.0f) && (ABS(this->actor.yDistToLink) < 50.0f) &&
func_8002E084(&this->actor, 0x1C70)) {
func_809CF72C(this);
} else {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_236 + this->unk_238, 1,
@ -291,7 +291,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
if (sp64 == 0) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1,
this->actor.speedXZ * 1000.0f, 0);
if ((this->actor.xzDistFromLink < 90.0f) && (this->actor.yDistFromLink < 50.0f) &&
if ((this->actor.xzDistToLink < 90.0f) && (this->actor.yDistToLink < 50.0f) &&
func_8002E084(&this->actor, 0x1554) &&
func_800339B8(&this->actor, globalCtx, 71.24802f, this->actor.yawTowardsLink)) {
func_809CF8F0(this);
@ -300,7 +300,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_236 + this->unk_238, 1,
this->actor.speedXZ * 1000.0f, 0);
}
if ((this->unk_224 == 0) || (ABS(this->actor.yDistFromLink) > 60.0f) || (player2->stateFlags1 & 0x6000)) {
if ((this->unk_224 == 0) || (ABS(this->actor.yDistToLink) > 60.0f) || (player2->stateFlags1 & 0x6000)) {
this->unk_221 = 3;
this->unk_224 = 150;
this->unk_250 = 0.0f;
@ -667,7 +667,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) {
this->unk_248 = 0.0f;
}
}
if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xzDistFromLink <= 400.0f) &&
if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xzDistToLink <= 400.0f) &&
(this->actor.bgCheckFlags & 1)) {
if (this->unk_220 == 5) {
this->unk_23C = 0;

View file

@ -108,9 +108,9 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) {
s16 tmp32;
s32 tmp33;
if ((thisx->xzDistFromLink <= 70.0f) || (this->collider.base.atFlags & 2) || (this->collider.base.acFlags & 2) ||
if ((thisx->xzDistToLink <= 70.0f) || (this->collider.base.atFlags & 2) || (this->collider.base.acFlags & 2) ||
(this->colliderQuad.base.atFlags & 2)) {
if ((thisx->xzDistFromLink <= 70.0f) || (&player->actor == this->collider.base.at) ||
if ((thisx->xzDistToLink <= 70.0f) || (&player->actor == this->collider.base.at) ||
(&player->actor == this->collider.base.ac) || (&player->actor == this->colliderQuad.base.at)) {
tmp33 = player->invincibilityTimer & 0xFF;
tmp32 = thisx->posRot.rot.y;

View file

@ -161,7 +161,7 @@ void func_809DF494(EnCow* this, GlobalContext* globalCtx) {
Animation_GetLastFrame(&D_060001CC), 2, 1.0f);
}
if ((this->actor.xzDistFromLink < 150.0f) && (!(this->unk_276 & 2))) {
if ((this->actor.xzDistToLink < 150.0f) && (!(this->unk_276 & 2))) {
this->unk_276 |= 2;
if (this->skelAnime.animation == &D_060001CC) {
this->unk_278 = 0;
@ -250,7 +250,7 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) {
this->unk_276 &= ~0x4;
DREG(53) = 0;
} else {
if ((this->actor.xzDistFromLink < 150.0f) &&
if ((this->actor.xzDistToLink < 150.0f) &&
(ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) < 0x61A8)) {
DREG(53) = 0;
this->actionFunc = func_809DF8FC;
@ -277,7 +277,7 @@ void func_809DFA84(EnCow* this, GlobalContext* globalCtx) {
Animation_GetLastFrame(&D_06004348), 2, 1.0f);
}
if ((this->actor.xzDistFromLink < 150.0f) &&
if ((this->actor.xzDistToLink < 150.0f) &&
(ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) >= 0x61A9) && (!(this->unk_276 & 2))) {
this->unk_276 |= 2;
if (this->skelAnime.animation == &D_06004348) {
@ -307,7 +307,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
this->actionFunc(this, globalCtx);
if ((thisx->xzDistFromLink < 150.0f) &&
if ((thisx->xzDistToLink < 150.0f) &&
(ABS(Math_Vec3f_Yaw(&thisx->posRot.pos, &player->actor.posRot.pos)) < 0xC000)) {
targetX = Math_Vec3f_Pitch(&thisx->posRot2.pos, &player->actor.posRot2.pos);
targetY = Math_Vec3f_Yaw(&thisx->posRot2.pos, &player->actor.posRot2.pos) - thisx->shape.rot.y;

View file

@ -204,7 +204,7 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_CRY);
}
if (this->actor.waterY > -40.0f) {
if (this->actor.yDistToWater > -40.0f) {
this->aimRotX = -0x1000;
} else if (this->actor.posRot.pos.y < (this->actor.initPosRot.pos.y - 50.0f)) {
this->aimRotX = -0x800 - (Rand_ZeroOne() * 0x800);
@ -229,8 +229,8 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
if (this->timer != 0) {
this->timer--;
}
if ((this->timer == 0) && (this->actor.xzDistFromLink < 300.0f) && !(player->stateFlags1 & 0x00800000) &&
(this->actor.waterY < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
if ((this->timer == 0) && (this->actor.xzDistToLink < 300.0f) && !(player->stateFlags1 & 0x00800000) &&
(this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
func_809E0384(this);
}
}
@ -261,12 +261,12 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) {
Math_ApproachS(&this->actor.shape.rot.x, -0x1000, 2, 0x100);
}
if ((yaw != 0) || (this->actor.xzDistFromLink > 80.0f)) {
if ((yaw != 0) || (this->actor.xzDistToLink > 80.0f)) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 4, 0xC00);
}
if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & 2) ||
(this->actor.bgCheckFlags & 9) || (player->stateFlags1 & 0x00800000) || (this->actor.waterY > -40.0f)) {
(this->actor.bgCheckFlags & 9) || (player->stateFlags1 & 0x00800000) || (this->actor.yDistToWater > -40.0f)) {
if (this->collider.base.atFlags & 2) {
this->collider.base.atFlags &= ~2;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK);

View file

@ -209,7 +209,7 @@ void EnDh_Walk(EnDh* this, GlobalContext* globalCtx) {
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_LAUGH);
}
if (this->actor.xzDistFromLink <= 100.0f) {
if (this->actor.xzDistToLink <= 100.0f) {
this->actor.speedXZ = 0.0f;
if (func_8002E084(&this->actor, 60 * 0x10000 / 360)) {
EnDh_SetupAttack(this);
@ -252,7 +252,7 @@ void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) {
if (SkelAnime_Update(&this->skelAnime)) {
this->actionState++;
} else if ((this->actor.xzDistFromLink > 100.0f) || !func_8002E084(&this->actor, 60 * 0x10000 / 360)) {
} else if ((this->actor.xzDistToLink > 100.0f) || !func_8002E084(&this->actor, 60 * 0x10000 / 360)) {
Animation_Change(&this->skelAnime, &D_06004658, -1.0f, this->skelAnime.curFrame, 0.0f, 2, -4.0f);
this->actionState = 4;
this->collider2.base.atFlags = this->collider2.list[0].body.toucherFlags = 0;
@ -283,7 +283,7 @@ void EnDh_Attack(EnDh* this, GlobalContext* globalCtx) {
}
break;
case 3:
if ((this->actor.xzDistFromLink <= 100.0f) && (func_8002E084(&this->actor, 60 * 0x10000 / 360) != 0)) {
if ((this->actor.xzDistToLink <= 100.0f) && (func_8002E084(&this->actor, 60 * 0x10000 / 360) != 0)) {
Animation_Change(&this->skelAnime, &D_06004658, 1.0f, 20.0f, Animation_GetLastFrame(&D_06004658), 2,
-6.0f);
this->actionState = 0;
@ -364,7 +364,7 @@ void EnDh_Damage(EnDh* this, GlobalContext* globalCtx) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
if (this->retreat) {
EnDh_SetupRetreat(this, globalCtx);
} else if ((this->actor.xzDistFromLink <= 105.0f) && func_8002E084(&this->actor, 60 * 0x10000 / 360)) {
} else if ((this->actor.xzDistToLink <= 105.0f) && func_8002E084(&this->actor, 60 * 0x10000 / 360)) {
f32 frames = Animation_GetLastFrame(&D_06004658);
EnDh_SetupAttack(this);

View file

@ -137,7 +137,7 @@ void func_809ECA50(EnDha* this, GlobalContext* globalCtx) {
} else {
playerPos.y += 56.0f;
}
if (this->actor.xzDistFromLink <= 100.0f) {
if (this->actor.xzDistToLink <= 100.0f) {
this->unk_1D6.x = this->unk_1D0.z = this->unk_1D0.y = 0;
if (Math_Vec3f_DistXYZ(&playerPos, &this->unk_1DC) <= 12.0f) {
if (this->unk_1CC == 0) {

View file

@ -321,7 +321,7 @@ void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) {
} else {
this->actor.flags &= ~0x10000;
}
if (this->actor.xzDistFromLink < 130.0f) {
if (this->actor.xzDistToLink < 130.0f) {
func_8002F2F4(&this->actor, globalCtx);
}
}

View file

@ -452,7 +452,7 @@ void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) {
if (Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < 400.0f) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1, 0x1F4, 0);
this->actor.flags |= 1;
if ((this->actor.xzDistFromLink < 100.0f) && (yawDiff < 0x1388) && (this->actor.yDistFromLink < 60.0f)) {
if ((this->actor.xzDistToLink < 100.0f) && (yawDiff < 0x1388) && (this->actor.yDistToLink < 60.0f)) {
EnDodongo_SetupBreatheFire(this);
}
} else {

View file

@ -351,16 +351,16 @@ void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) {
return;
}
if (this->actor.xzDistFromLink > 400.0f) {
if (this->actor.xzDistToLink > 400.0f) {
if (this->nextBehavior != DOG_SIT && this->nextBehavior != DOG_SIT_2) {
this->nextBehavior = DOG_BOW;
}
gSaveContext.dogParams = 0;
speed = 0.0f;
} else if (this->actor.xzDistFromLink > 100.0f) {
} else if (this->actor.xzDistToLink > 100.0f) {
this->nextBehavior = DOG_RUN;
speed = 4.0f;
} else if (this->actor.xzDistFromLink < 40.0f) {
} else if (this->actor.xzDistToLink < 40.0f) {
if (this->nextBehavior != DOG_BOW && this->nextBehavior != DOG_BOW_2) {
this->nextBehavior = DOG_BOW;
}
@ -372,14 +372,14 @@ void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->actor.speedXZ, speed, 0.6f, 1.0f);
if (!(this->actor.xzDistFromLink > 400.0f)) {
if (!(this->actor.xzDistToLink > 400.0f)) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 10, 1000, 1);
this->actor.shape.rot = this->actor.posRot.rot;
}
}
void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) {
if (this->actor.xzDistFromLink < 200.0f) {
if (this->actor.xzDistToLink < 200.0f) {
Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f);
Math_SmoothStepToS(&this->actor.posRot.rot.y, (this->actor.yawTowardsLink ^ 0x8000), 10, 1000, 1);
} else {
@ -394,7 +394,7 @@ void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) {
f32 absAngleDiff;
// if the dog is more than 200 units away from Link, turn to face him then wait
if (200.0f <= this->actor.xzDistFromLink) {
if (200.0f <= this->actor.xzDistToLink) {
this->nextBehavior = DOG_WALK;
Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.6f, 1.0f);
@ -422,7 +422,7 @@ void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) {
this->unusedAngle = (this->actor.yawTowardsLink - this->actor.shape.rot.y);
// If another dog is following Link and he gets within 200 units of waiting dog, run away
if ((gSaveContext.dogParams != 0) && (this->actor.xzDistFromLink < 200.0f)) {
if ((gSaveContext.dogParams != 0) && (this->actor.xzDistToLink < 200.0f)) {
this->nextBehavior = DOG_RUN;
this->actionFunc = EnDog_RunAway;
}

View file

@ -219,7 +219,7 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) {
player->doorDirection = (sp2C.z >= 0.0f) ? 1.0f : -1.0f;
player->doorActor = &this->actor;
}
} else if (doorType == DOOR_AJAR && this->actor.xzDistFromLink > DOOR_AJAR_OPEN_RANGE) {
} else if (doorType == DOOR_AJAR && this->actor.xzDistToLink > DOOR_AJAR_OPEN_RANGE) {
this->actionFunc = EnDoor_AjarOpen;
}
}
@ -240,13 +240,13 @@ void EnDoor_Check(EnDoor* this, GlobalContext* globalCtx) {
}
void EnDoor_AjarWait(EnDoor* this, GlobalContext* globalCtx) {
if (this->actor.xzDistFromLink < DOOR_AJAR_SLAM_RANGE) {
if (this->actor.xzDistToLink < DOOR_AJAR_SLAM_RANGE) {
this->actionFunc = EnDoor_AjarClose;
}
}
void EnDoor_AjarOpen(EnDoor* this, GlobalContext* globalCtx) {
if (this->actor.xzDistFromLink < DOOR_AJAR_SLAM_RANGE) {
if (this->actor.xzDistToLink < DOOR_AJAR_SLAM_RANGE) {
this->actionFunc = EnDoor_AjarClose;
} else if (Math_ScaledStepToS(&this->actor.posRot.rot.y, -0x1800, 0x100)) {
this->actionFunc = EnDoor_AjarWait;

View file

@ -228,7 +228,7 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
this->actor.textId = 0x5048;
if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistFromLink < 200.0f)) {
if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToLink < 200.0f)) {
func_8002F298(this, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM);
this->unk_1E8 |= 1;
}

View file

@ -249,13 +249,13 @@ void func_80A020A4(EnElf* this, GlobalContext* globalCtx) {
}
void func_80A0214C(EnElf* this, GlobalContext* globalCtx) {
f32 xzDistFromLink;
f32 xzDistToLink;
if (this->unk_2C0 > 0) {
this->unk_2C0--;
} else {
xzDistFromLink = this->actor.xzDistFromLink;
if (xzDistFromLink < 50.0f) {
xzDistToLink = this->actor.xzDistToLink;
if (xzDistToLink < 50.0f) {
if (Rand_ZeroOne() < 0.2f) {
this->unk_2A8 = 2;
this->unk_2AC = 0x400;
@ -267,16 +267,16 @@ void func_80A0214C(EnElf* this, GlobalContext* globalCtx) {
this->unk_2C0 = 10;
}
} else {
if (xzDistFromLink > 150.0f) {
xzDistFromLink = 150.0f;
if (xzDistToLink > 150.0f) {
xzDistToLink = 150.0f;
}
xzDistFromLink = ((xzDistFromLink - 50.0f) * 0.95f) + 0.05f;
xzDistToLink = ((xzDistToLink - 50.0f) * 0.95f) + 0.05f;
if (Rand_ZeroOne() < xzDistFromLink) {
if (Rand_ZeroOne() < xzDistToLink) {
this->unk_2A8 = 3;
this->unk_2AC = 0x200;
this->unk_2B8 = (xzDistFromLink * 2.0f) + 1.0f;
this->unk_2B8 = (xzDistToLink * 2.0f) + 1.0f;
this->func_2C8 = func_80A01FE0;
this->unk_2C0 = (s16)Rand_ZeroFloat(16.0f) + 0x10;
} else {

View file

@ -1,5 +1,6 @@
#include "z_en_encount1.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Tite/z_en_tite.h"
#define FLAGS 0x08000010
@ -111,7 +112,7 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) {
floorType = func_80041D4C(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorPolySource);
if ((floorType != 4) && (floorType != 7) && (floorType != 12)) {
this->numLeeverSpawns = 0;
} else if (!(this->reduceLeevers && (this->actor.xzDistFromLink > 1300.0f))) {
} else if (!(this->reduceLeevers && (this->actor.xzDistToLink > 1300.0f))) {
spawnLimit = 5;
if (this->reduceLeevers) {
spawnLimit = 3;
@ -185,7 +186,7 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) {
if (this->timer == 0) {
this->timer = 10;
if ((fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) > 100.0f) ||
(this->actor.xzDistFromLink > this->spawnRange)) {
(this->actor.xzDistToLink > this->spawnRange)) {
this->outOfRangeTimer++;
} else {
this->outOfRangeTimer = 0;
@ -199,7 +200,7 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) {
}
spawnPos.y = floorY;
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TITE, spawnPos.x,
spawnPos.y, spawnPos.z, 0, 0, 0, -1) != NULL) { // Red tektite
spawnPos.y, spawnPos.z, 0, 0, 0, TEKTITE_RED) != NULL) { // Red tektite
this->curNumSpawn++;
this->totalNumSpawn++;
} else {
@ -228,7 +229,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt
if (globalCtx->sceneNum != SCENE_SPOT00) {
if ((fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) > 100.0f) ||
(this->actor.xzDistFromLink > this->spawnRange)) {
(this->actor.xzDistToLink > this->spawnRange)) {
this->outOfRangeTimer++;
return;
}
@ -271,8 +272,8 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt
if (floorY <= -32000.0f) {
break;
}
if ((player->actor.waterY != -32000.0f) &&
(floorY < (player->actor.posRot.pos.y - player->actor.waterY))) {
if ((player->actor.yDistToWater != -32000.0f) &&
(floorY < (player->actor.posRot.pos.y - player->actor.yDistToWater))) {
break;
}
spawnPos.y = floorY;

View file

@ -250,9 +250,9 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) {
Vec3f pos;
s32 pad;
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.waterY > 15.0f)) {
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) {
pos = this->actor.posRot.pos;
pos.y += this->actor.waterY;
pos.y += this->actor.yDistToWater;
this->actor.velocity.y = -1.0f;
this->actor.gravity = -0.2f;
EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 800);
@ -283,7 +283,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, GlobalContext* globalCtx) {
this->timer = 20;
this->actionFunc = EnExRuppy_Kill;
if (1) {}
} else if (this->actor.xyzDistFromLinkSq < SQ(localConst)) {
} else if (this->actor.xyzDistToLinkSq < SQ(localConst)) {
Rupees_ChangeBy(this->rupeeValue);
func_80078884(NA_SE_SY_GET_RUPY);
divingGame->unk_2A4++;
@ -320,7 +320,7 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) {
if (this->type == 2) {
distToBlowUp = 30.0f;
}
if (this->actor.xyzDistFromLinkSq < SQ(distToBlowUp)) {
if (this->actor.xyzDistToLinkSq < SQ(distToBlowUp)) {
parent = (EnExRuppyParentActor*)this->actor.parent;
if (parent != NULL) {
if (parent->actor.update != NULL) {
@ -349,7 +349,7 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) {
void EnExRuppy_WaitAsCollectible(EnExRuppy* this, GlobalContext* globalCtx) {
f32 localConst = 30.0f;
if (this->actor.xyzDistFromLinkSq < SQ(localConst)) {
if (this->actor.xyzDistToLinkSq < SQ(localConst)) {
func_80078884(NA_SE_SY_GET_RUPY);
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, (sEnExRuppyCollectibleTypes[this->colorIdx] | 0x8000));
Actor_Kill(&this->actor);

View file

@ -165,8 +165,8 @@ s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) {
if (this->actionFunc == EnFd_Reappear || this->actionFunc == EnFd_SpinAndGrow ||
this->actionFunc == EnFd_JumpToGround || this->actionFunc == EnFd_WaitForCore) {
return false;
} else if (globalCtx->actorCtx.unk_02 != 0 && this->actor.xzDistFromLink < 300.0f &&
this->actor.yDistFromLink < 60.0f) {
} else if (globalCtx->actorCtx.unk_02 != 0 && this->actor.xzDistToLink < 300.0f &&
this->actor.yDistToLink < 60.0f) {
return true;
} else {
return false;
@ -436,7 +436,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) {
if (DECR(this->spinTimer) != 0) {
this->actor.shape.rot.y += (this->runDir * 0x2000);
if (this->spinTimer == 30 && this->invincibilityTimer == 0) {
if (this->actor.xzDistFromLink > 160.0f) {
if (this->actor.xzDistToLink > 160.0f) {
// orange flames
EnFd_SpawnChildFire(this, globalCtx, 8, 0);
} else {

View file

@ -188,7 +188,7 @@ void EnFirefly_SetupRebound(EnFirefly* this) {
void EnFirefly_SetupDiveAttack(EnFirefly* this) {
this->timer = Rand_S16Offset(70, 100);
this->skelAnime.playSpeed = 1.0f;
this->targetPitch = ((this->actor.yDistFromLink > 0.0f) ? -0xC00 : 0xC00) + 0x1554;
this->targetPitch = ((this->actor.yDistToLink > 0.0f) ? -0xC00 : 0xC00) + 0x1554;
this->actionFunc = EnFirefly_DiveAttack;
}
@ -358,8 +358,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 8) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallPolyRot, 2, 0xC00, 0x300);
}
if ((this->timer == 0) && (this->actor.xzDistFromLink < 200.0f) &&
(Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
if ((this->timer == 0) && (this->actor.xzDistToLink < 200.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
EnFirefly_SetupDiveAttack(this);
}
}
@ -424,7 +423,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &preyPos) + 0x1554, 2, 0x400, 0x100);
} else {
this->skelAnime.playSpeed = 1.5f;
if (this->actor.xzDistFromLink > 80.0f) {
if (this->actor.xzDistToLink > 80.0f) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xC00, 0x300);
}
if (this->actor.bgCheckFlags & 1) {
@ -523,7 +522,7 @@ void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) {
this->timer = 1;
}
if (this->actor.xzDistFromLink < 120.0f) {
if (this->actor.xzDistToLink < 120.0f) {
EnFirefly_SetupDisturbDiveAttack(this);
}
}

View file

@ -318,10 +318,10 @@ void EnFloormas_SetupGrabLink(EnFloormas* this, Player* player) {
this->actor.velocity.y = 0.0f;
EnFloormas_MakeInvulnerable(this);
if (LINK_IS_CHILD) {
yDelta = CLAMP(-this->actor.yDistFromLink, 20.0f, 30.0f);
yDelta = CLAMP(-this->actor.yDistToLink, 20.0f, 30.0f);
xzDelta = -10.0f;
} else {
yDelta = CLAMP(-this->actor.yDistFromLink, 25.0f, 45.0f);
yDelta = CLAMP(-this->actor.yDistToLink, 25.0f, 45.0f);
xzDelta = -70.0f;
}
this->actor.posRot.pos.y = player->actor.posRot.pos.y + yDelta;
@ -410,11 +410,11 @@ void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) {
void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) {
if (SkelAnime_Update(&this->skelAnime)) {
// within 400 units of link and within 90 degrees rotation of him
if (this->actor.xzDistFromLink < 400.0f && !func_8002E084(&this->actor, 0x4000)) {
if (this->actor.xzDistToLink < 400.0f && !func_8002E084(&this->actor, 0x4000)) {
this->actionTarget = this->actor.yawTowardsLink;
EnFloormas_SetupTurn(this);
// within 280 units of link and within 45 degrees rotation of him
} else if (this->actor.xzDistFromLink < 280.0f && func_8002E084(&this->actor, 0x2000)) {
} else if (this->actor.xzDistToLink < 280.0f && func_8002E084(&this->actor, 0x2000)) {
EnFloormas_SetupHover(this, globalCtx);
} else {
EnFloormas_SetupStand(this);
@ -449,13 +449,13 @@ void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK);
}
if ((this->actor.xzDistFromLink < 320.0f) && (func_8002E084(&this->actor, 0x4000))) {
if ((this->actor.xzDistToLink < 320.0f) && (func_8002E084(&this->actor, 0x4000))) {
EnFloormas_SetupRun(this);
} else if (this->actor.bgCheckFlags & 8) {
// set target rotation to the colliding wall's rotation
this->actionTarget = this->actor.wallPolyRot;
EnFloormas_SetupTurn(this);
} else if ((this->actor.xzDistFromLink < 400.0f) && !func_8002E084(&this->actor, 0x4000)) {
} else if ((this->actor.xzDistToLink < 400.0f) && !func_8002E084(&this->actor, 0x4000)) {
// set target rotation to link.
this->actionTarget = this->actor.yawTowardsLink;
EnFloormas_SetupTurn(this);
@ -480,10 +480,9 @@ void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 0x71C);
if ((this->actor.xzDistFromLink < 280.0f) && func_8002E084(&this->actor, 0x2000) &&
!(this->actor.bgCheckFlags & 8)) {
if ((this->actor.xzDistToLink < 280.0f) && func_8002E084(&this->actor, 0x2000) && !(this->actor.bgCheckFlags & 8)) {
EnFloormas_SetupHover(this, globalCtx);
} else if (this->actor.xzDistFromLink > 400.0f) {
} else if (this->actor.xzDistToLink > 400.0f) {
EnFloormas_SetupBigWalk(this);
}
}
@ -655,7 +654,7 @@ void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) {
} else if (this->actor.bgCheckFlags & 8) {
this->actionTarget = this->actor.wallPolyRot;
EnFloormas_SetupTurn(this);
} else if (this->actor.xzDistFromLink < 120.0f) {
} else if (this->actor.xzDistToLink < 120.0f) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink + 0x8000, 0x38E);
}
}
@ -691,7 +690,7 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) {
}
} else {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 0x71C);
if (this->actor.xzDistFromLink < 80.0f) {
if (this->actor.xzDistToLink < 80.0f) {
EnFloormas_SetupJumpAtLink(this);
}
}
@ -719,7 +718,7 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND);
EnFloormas_SetupLand(this);
} else if ((this->actor.yDistFromLink < -10.0f) && (this->collider.base.maskA & 2) &&
} else if ((this->actor.yDistToLink < -10.0f) && (this->collider.base.maskA & 2) &&
(&player->actor == this->collider.base.oc)) {
globalCtx->grabPlayer(globalCtx, player);
EnFloormas_SetupGrabLink(this, player);
@ -746,10 +745,10 @@ void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) {
}
if (LINK_IS_CHILD) {
yDelta = CLAMP(-this->actor.yDistFromLink, 20.0f, 30.0f);
yDelta = CLAMP(-this->actor.yDistToLink, 20.0f, 30.0f);
xzDelta = -10.0f;
} else {
yDelta = CLAMP(-this->actor.yDistFromLink, 25.0f, 45.0f);
yDelta = CLAMP(-this->actor.yDistToLink, 25.0f, 45.0f);
xzDelta = -30.0f;
}

View file

@ -111,7 +111,7 @@ s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFu
this->actor.textId = textID;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistFromLink < 100.0f)) {
if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistToLink < 100.0f)) {
func_8002F2CC(&this->actor, globalCtx, 100.0f);
} else {
this->behaviorFlags |= FU_RESET_LOOK_ANGLE;
@ -225,7 +225,7 @@ void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) {
} else if (func_8002F194(&this->actor, globalCtx) != 0) {
this->actionFunc = func_80A1DBA0;
} else if (ABS(yawDiff) < 0x2301) {
if (this->actor.xzDistFromLink < 100.0f) {
if (this->actor.xzDistToLink < 100.0f) {
this->actor.textId = 0x5034;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
player->stateFlags2 |= 0x800000;

View file

@ -85,7 +85,7 @@ s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) {
u32 bgId;
Vec3f collisionPos;
if (this->actor.xzDistFromLink > 300.0f) {
if (this->actor.xzDistToLink > 300.0f) {
return false;
}

View file

@ -219,7 +219,7 @@ void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
this->actor.shape.rot.y += 0x800;
if (this->actor.xyzDistFromLinkSq < 900.0f) {
if (this->actor.xyzDistToLinkSq < 900.0f) {
Rupees_ChangeBy(5);
sCollectedCount++;
func_80078884(NA_SE_SY_GET_RUPY);

View file

@ -220,13 +220,13 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
}
if (func_800354B4(globalCtx, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) {
thisx->shape.rot.y = thisx->posRot.rot.y = thisx->yawTowardsLink;
if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (thisx->xzDistFromLink < 90.0f)) {
if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (thisx->xzDistToLink < 90.0f)) {
EnGeldB_SetupJump(this);
return true;
} else if (player->swordAnimation == 0x11) {
EnGeldB_SetupSpinDodge(this, globalCtx);
return true;
} else if ((thisx->xzDistFromLink < 90.0f) && (globalCtx->gameplayFrames & 1)) {
} else if ((thisx->xzDistToLink < 90.0f) && (globalCtx->gameplayFrames & 1)) {
EnGeldB_SetupBlock(this);
return true;
} else {
@ -255,7 +255,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
} else {
s16 angleToFacingLink = player->actor.shape.rot.y - thisx->shape.rot.y;
if ((thisx->xzDistFromLink <= 45.0f) && !func_80033AB8(globalCtx, thisx) &&
if ((thisx->xzDistToLink <= 45.0f) && !func_80033AB8(globalCtx, thisx) &&
((globalCtx->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) {
EnGeldB_SetupSlash(this);
return true;
@ -282,7 +282,7 @@ void EnGeldB_SetupWait(EnGeldB* this) {
void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) {
if ((this->invisible && !Flags_GetSwitch(globalCtx, this->actor.initPosRot.rot.z)) ||
this->actor.xzDistFromLink > 300.0f) {
this->actor.xzDistToLink > 300.0f) {
this->actor.shape.rot.y = this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->actor.posRot.pos.y = this->actor.groundY + 120.0f;
} else {
@ -369,12 +369,12 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) {
return;
}
angleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
if ((this->actor.xzDistFromLink < 100.0f) && (player->swordState != 0) && (ABS(angleToLink) >= 0x1F40)) {
if ((this->actor.xzDistToLink < 100.0f) && (player->swordState != 0) && (ABS(angleToLink) >= 0x1F40)) {
this->actor.shape.rot.y = this->actor.posRot.rot.y = this->actor.yawTowardsLink;
EnGeldB_SetupCircle(this);
} else if (--this->timer == 0) {
if (func_8002E084(&this->actor, 30 * 0x10000 / 360)) {
if ((210.0f > this->actor.xzDistFromLink) && (this->actor.xzDistFromLink > 150.0f) &&
if ((210.0f > this->actor.xzDistToLink) && (this->actor.xzDistToLink > 150.0f) &&
(Rand_ZeroOne() < 0.3f)) {
if (func_80033AB8(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
(ABS(angleToLink) < 0x38E0)) {
@ -416,9 +416,9 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 1, 0x2EE, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
if (this->actor.xzDistFromLink <= 40.0f) {
if (this->actor.xzDistToLink <= 40.0f) {
Math_SmoothStepToF(&this->actor.speedXZ, -8.0f, 1.0f, 1.5f, 0.0f);
} else if (this->actor.xzDistFromLink > 55.0f) {
} else if (this->actor.xzDistToLink > 55.0f) {
Math_SmoothStepToF(&this->actor.speedXZ, 8.0f, 1.0f, 1.5f, 0.0f);
} else {
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 6.65f, 0.0f);
@ -426,7 +426,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
this->skelAnime.playSpeed = this->actor.speedXZ * 0.125f;
facingAngletoLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
facingAngletoLink = ABS(facingAngletoLink);
if ((this->actor.xzDistFromLink < 150.0f) && (player->swordState != 0) && (facingAngletoLink >= 0x1F40)) {
if ((this->actor.xzDistToLink < 150.0f) && (player->swordState != 0) && (facingAngletoLink >= 0x1F40)) {
this->actor.shape.rot.y = this->actor.posRot.rot.y = this->actor.yawTowardsLink;
if (Rand_ZeroOne() > 0.7f) {
EnGeldB_SetupCircle(this);
@ -444,9 +444,9 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
} else {
EnGeldB_SetupReady(this);
}
} else if (this->actor.xzDistFromLink < 90.0f) {
} else if (this->actor.xzDistToLink < 90.0f) {
if (!func_80033AB8(globalCtx, &this->actor) &&
(Rand_ZeroOne() > 0.03f || (this->actor.xzDistFromLink <= 45.0f && facingAngletoLink < 0x38E0))) {
(Rand_ZeroOne() > 0.03f || (this->actor.xzDistToLink <= 45.0f && facingAngletoLink < 0x38E0))) {
EnGeldB_SetupSlash(this);
} else if (func_80033AB8(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
EnGeldB_SetupRollBack(this);
@ -455,7 +455,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
}
}
if (!EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
if ((210.0f > this->actor.xzDistFromLink) && (this->actor.xzDistFromLink > 150.0f) &&
if ((210.0f > this->actor.xzDistToLink) && (this->actor.xzDistToLink > 150.0f) &&
func_8002E084(&this->actor, 0x71C)) {
if (func_80033A84(globalCtx, &this->actor)) {
if (Rand_ZeroOne() > 0.5f) {
@ -610,9 +610,9 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
}
}
}
if (this->actor.xzDistFromLink <= 45.0f) {
if (this->actor.xzDistToLink <= 45.0f) {
Math_SmoothStepToF(&this->approachRate, -4.0f, 1.0f, 1.5f, 0.0f);
} else if (this->actor.xzDistFromLink > 40.0f) {
} else if (this->actor.xzDistToLink > 40.0f) {
Math_SmoothStepToF(&this->approachRate, 4.0f, 1.0f, 1.5f, 0.0f);
} else {
Math_SmoothStepToF(&this->approachRate, 0.0f, 1.0f, 6.65f, 0.0f);
@ -641,7 +641,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
if ((Math_CosS(angleBehindLink - this->actor.shape.rot.y) < -0.85f) &&
!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistFromLink <= 45.0f)) {
!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistToLink <= 45.0f)) {
EnGeldB_SetupSlash(this);
} else if (--this->timer == 0) {
if (func_80033AB8(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
@ -704,9 +704,9 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
return;
}
}
if (this->actor.xzDistFromLink <= 45.0f) {
if (this->actor.xzDistToLink <= 45.0f) {
Math_SmoothStepToF(&this->approachRate, -4.0f, 1.0f, 1.5f, 0.0f);
} else if (this->actor.xzDistFromLink > 40.0f) {
} else if (this->actor.xzDistToLink > 40.0f) {
Math_SmoothStepToF(&this->approachRate, 4.0f, 1.0f, 1.5f, 0.0f);
} else {
Math_SmoothStepToF(&this->approachRate, 0.0f, 1.0f, 6.65f, 0.0f);
@ -736,7 +736,7 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
if (this->timer == 0) {
this->actor.shape.rot.y = this->actor.yawTowardsLink;
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if (!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistFromLink <= 70.0f)) {
if (!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistToLink <= 70.0f)) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupRollBack(this);
@ -787,7 +787,7 @@ void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) {
if (angleToLink > 0x4000) {
this->lookTimer = 20;
}
} else if (Rand_ZeroOne() > 0.7f || (this->actor.xzDistFromLink >= 120.0f)) {
} else if (Rand_ZeroOne() > 0.7f || (this->actor.xzDistToLink >= 120.0f)) {
EnGeldB_SetupReady(this);
this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f;
} else {
@ -861,7 +861,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
this->lookTimer = 46;
} else if (this->spinAttackState != 0) {
EnGeldB_SetupRollBack(this);
} else if (Rand_ZeroOne() > 0.7f || (this->actor.xzDistFromLink >= 120.0f)) {
} else if (Rand_ZeroOne() > 0.7f || (this->actor.xzDistToLink >= 120.0f)) {
EnGeldB_SetupReady(this);
this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f;
} else {
@ -901,8 +901,8 @@ void EnGeldB_SetupRollBack(EnGeldB* this) {
void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx) {
if (SkelAnime_Update(&this->skelAnime)) {
if (!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistFromLink < 170.0f) &&
(this->actor.xzDistFromLink > 140.0f) && (Rand_ZeroOne() < 0.2f)) {
if (!func_80033AB8(globalCtx, &this->actor) && (this->actor.xzDistToLink < 170.0f) &&
(this->actor.xzDistToLink > 140.0f) && (Rand_ZeroOne() < 0.2f)) {
EnGeldB_SetupSpinAttack(this);
} else if (globalCtx->gameplayFrames & 1) {
EnGeldB_SetupSidestep(this, globalCtx);
@ -980,10 +980,10 @@ void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) {
if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0) &&
SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) {
angleToWall = this->actor.wallPolyRot - this->actor.shape.rot.y;
if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistFromLink < 90.0f)) {
if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToLink < 90.0f)) {
EnGeldB_SetupJump(this);
} else if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if ((this->actor.xzDistFromLink <= 45.0f) && !func_80033AB8(globalCtx, &this->actor) &&
if ((this->actor.xzDistToLink <= 45.0f) && !func_80033AB8(globalCtx, &this->actor) &&
(globalCtx->gameplayFrames & 7)) {
EnGeldB_SetupSlash(this);
} else {
@ -1052,8 +1052,8 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
}
if (SkelAnime_Update(&this->skelAnime)) {
angleToLink = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistFromLink < 40.0f) &&
(ABS(this->actor.yDistFromLink) < 50.0f)) {
if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistToLink < 40.0f) &&
(ABS(this->actor.yDistToLink) < 50.0f)) {
if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (player->swordAnimation == 0x11) {
EnGeldB_SetupSpinDodge(this, globalCtx);
@ -1080,7 +1080,7 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupSpinDodge(this, globalCtx);
} else if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if ((globalCtx->gameplayFrames & 1)) {
if ((this->actor.xzDistFromLink < 100.0f) && (Rand_ZeroOne() > 0.7f)) {
if ((this->actor.xzDistToLink < 100.0f) && (Rand_ZeroOne() > 0.7f)) {
EnGeldB_SetupJump(this);
} else {
EnGeldB_SetupRollBack(this);
@ -1158,9 +1158,9 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
} else {
this->actor.posRot.rot.y = this->actor.shape.rot.y - 0x3E80;
}
if (this->actor.xzDistFromLink <= 45.0f) {
if (this->actor.xzDistToLink <= 45.0f) {
Math_SmoothStepToF(&this->approachRate, -4.0f, 1.0f, 1.5f, 0.0f);
} else if (this->actor.xzDistFromLink > 40.0f) {
} else if (this->actor.xzDistToLink > 40.0f) {
Math_SmoothStepToF(&this->approachRate, 4.0f, 1.0f, 1.5f, 0.0f);
} else {
Math_SmoothStepToF(&this->approachRate, 0.0f, 1.0f, 6.65f, 0.0f);
@ -1194,10 +1194,10 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
s16 angleFacingPlayer2 = player2->actor.shape.rot.y - this->actor.shape.rot.y;
this->actor.posRot.rot.y = this->actor.shape.rot.y;
if ((this->actor.xzDistFromLink <= 45.0f) && (!func_80033AB8(globalCtx, &this->actor)) &&
if ((this->actor.xzDistToLink <= 45.0f) && (!func_80033AB8(globalCtx, &this->actor)) &&
(!(globalCtx->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) {
EnGeldB_SetupSlash(this);
} else if ((210.0f > this->actor.xzDistFromLink) && (this->actor.xzDistFromLink > 150.0f) &&
} else if ((210.0f > this->actor.xzDistToLink) && (this->actor.xzDistToLink > 150.0f) &&
!(globalCtx->gameplayFrames & 1)) {
if (func_80033AB8(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
(ABS(angleFacingPlayer2) < 0x38E0)) {

View file

@ -356,7 +356,7 @@ s32 func_80A4CB78(EnGoroiwa* this, GlobalContext* globalCtx) {
this->actor.posRot.pos.y += this->actor.velocity.y;
if (this->actor.velocity.y < 0.0f && this->actor.posRot.pos.y <= nextPointY) {
if (this->unk_1C6 == 0) {
if (this->actor.xzDistFromLink < 600.0f) {
if (this->actor.xzDistToLink < 600.0f) {
quakeIdx = Quake_Add(ACTIVE_CAM, 3);
Quake_SetSpeed(quakeIdx, -0x3CB0);
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
@ -716,7 +716,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
break;
}
func_80A4CED8(this, globalCtx);
if (this->actor.xzDistFromLink < 300.0f) {
if (this->actor.xzDistToLink < 300.0f) {
func_80A4BCA0(this);
if (this->unk_1D3 & 1 && this->collisionTimer <= 0) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);

View file

@ -100,7 +100,7 @@ void func_80A4E470(EnGs* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
bREG(15) = 0;
if (this->actor.xzDistFromLink <= 100.0f) {
if (this->actor.xzDistToLink <= 100.0f) {
bREG(15) = 1;
if (this->unk_19D == 0) {
player->stateFlags2 |= 0x800000;
@ -337,7 +337,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) {
}
Actor_MoveForward(&this->actor);
if (this->actor.yDistFromLink < -12000.0f) {
if (this->actor.yDistToLink < -12000.0f) {
Actor_Kill(&this->actor);
}
}

View file

@ -130,7 +130,7 @@ void func_80A5046C(EnGuest* this) {
void func_80A50518(EnGuest* this, GlobalContext* globalCtx) {
if (func_8002F194(&this->actor, globalCtx) != 0) {
this->actionFunc = func_80A5057C;
} else if (this->actor.xzDistFromLink < 100.0f) {
} else if (this->actor.xzDistToLink < 100.0f) {
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}
}

View file

@ -243,7 +243,7 @@ void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->bodyTurnSpeed, 3000.0f, 1.0f, 300.0f);
Math_ApproachZeroF(&this->headAngle, 0.5f, 2000.0f);
if (this->actor.xzDistFromLink < 70.0f) {
if (this->actor.xzDistToLink < 70.0f) {
this->actionFunc = EnHeishi1_SetupTurnTowardLink;
}
}
@ -376,7 +376,7 @@ void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx) {
void EnHeishi1_WaitNight(EnHeishi1* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->actor.xzDistFromLink < 100.0f) {
if (this->actor.xzDistToLink < 100.0f) {
func_8010B680(globalCtx, 0x702D, &this->actor);
func_80078884(NA_SE_SY_FOUND);
// "Discovered!"
@ -440,9 +440,9 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) {
EffectSsSolderSrchBall_Spawn(globalCtx, &searchBallPos, &searchBallVel, &searchBallAccel, 2,
&this->linkDetected);
if (this->actor.xzDistFromLink < 60.0f) {
if (this->actor.xzDistToLink < 60.0f) {
this->linkDetected = true;
} else if (this->actor.xzDistFromLink < 70.0f) {
} else if (this->actor.xzDistToLink < 70.0f) {
// this case probably exists to detect link making a jump sound
// from slightly further away than the previous 60 unit check
if (player->actor.velocity.y > -4.0f) {

View file

@ -411,7 +411,7 @@ void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) {
} else {
yawDiffTemp = this->actor.yawTowardsLink - this->actor.shape.rot.y;
yawDiff = ABS(yawDiffTemp);
if (!(120.0f < this->actor.xzDistFromLink) && (yawDiff < 0x4300)) {
if (!(120.0f < this->actor.xzDistToLink) && (yawDiff < 0x4300)) {
func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_LETTER_ZELDA);
}
}
@ -737,7 +737,7 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) {
if (((this->initParams != 2) && (this->initParams != 5)) ||
((yawDiff = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)),
!(this->actor.xzDistFromLink > 120.0f)) &&
!(this->actor.xzDistToLink > 120.0f)) &&
(yawDiff < 0x4300))) {
func_8002F2F4(&this->actor, globalCtx);
}

View file

@ -118,7 +118,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx)
sightRange = 100.0f;
}
}
if ((this->actor.xzDistFromLink < sightRange) &&
if ((this->actor.xzDistToLink < sightRange) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 100.0f) && (sPlayerCaught == 0)) {
sPlayerCaught = 1;
func_8010B680(globalCtx, 0x702D, &this->actor); // "Hey you! Stop! You, kid, over there!"

View file

@ -246,19 +246,19 @@ void EnHintnuts_Wait(EnHintnuts* this, GlobalContext* globalCtx) {
boundedCurrentFrame = boundedCurrentFrameTemp;
}
this->collider.dim.height = (((boundedCurrentFrame - 9.0f) * 9.0f) + 5.0f);
if (!hasSlowPlaybackSpeed && (this->actor.xzDistFromLink < 120.0f)) {
if (!hasSlowPlaybackSpeed && (this->actor.xzDistToLink < 120.0f)) {
EnHintnuts_SetupBurrow(this);
} else if (SkelAnime_Update(&this->skelAnime) != 0) {
if (this->actor.xzDistFromLink < 120.0f) {
if (this->actor.xzDistToLink < 120.0f) {
EnHintnuts_SetupBurrow(this);
} else if ((this->animFlagAndTimer == 0) && (320.0f < this->actor.xzDistFromLink)) {
} else if ((this->animFlagAndTimer == 0) && (320.0f < this->actor.xzDistToLink)) {
EnHintnuts_SetupLookAround(this);
} else {
EnHintnuts_SetupStand(this);
}
}
if (hasSlowPlaybackSpeed && 160.0f < this->actor.xzDistFromLink && fabsf(this->actor.yDistFromLink) < 120.0f &&
((this->animFlagAndTimer == 0) || (this->actor.xzDistFromLink < 480.0f))) {
if (hasSlowPlaybackSpeed && 160.0f < this->actor.xzDistToLink && fabsf(this->actor.yDistToLink) < 120.0f &&
((this->animFlagAndTimer == 0) || (this->actor.xzDistToLink < 480.0f))) {
this->skelAnime.playSpeed = 1.0f;
}
}
@ -268,7 +268,7 @@ void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, 0.0f) != 0 && this->animFlagAndTimer != 0) {
this->animFlagAndTimer--;
}
if ((this->actor.xzDistFromLink < 120.0f) || (this->animFlagAndTimer == 0)) {
if ((this->actor.xzDistToLink < 120.0f) || (this->animFlagAndTimer == 0)) {
EnHintnuts_SetupBurrow(this);
}
}
@ -281,7 +281,7 @@ void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) {
if (!(this->animFlagAndTimer & 0x1000)) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38);
}
if (this->actor.xzDistFromLink < 120.0f || this->animFlagAndTimer == 0x1000) {
if (this->actor.xzDistToLink < 120.0f || this->animFlagAndTimer == 0x1000) {
EnHintnuts_SetupBurrow(this);
} else if (this->animFlagAndTimer == 0) {
EnHintnuts_SetupThrowScrubProjectile(this);
@ -292,7 +292,7 @@ void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) {
Vec3f nutPos;
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38);
if (this->actor.xzDistFromLink < 120.0f) {
if (this->actor.xzDistToLink < 120.0f) {
EnHintnuts_SetupBurrow(this);
} else if (SkelAnime_Update(&this->skelAnime) != 0) {
EnHintnuts_SetupStand(this);
@ -346,7 +346,7 @@ void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) {
} else {
this->actor.flags &= ~0x10000;
}
if (this->actor.xzDistFromLink < 130.0f) {
if (this->actor.xzDistToLink < 130.0f) {
this->actor.textId = this->textIdCopy;
func_8002F2F4(&this->actor, globalCtx);
}

View file

@ -206,10 +206,10 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) {
// Vertical Planes
void func_80A591C0(EnHoll* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
f32 absY = fabsf(this->actor.yDistFromLink);
f32 absY = fabsf(this->actor.yDistToLink);
s32 transitionActorIdx;
if (this->actor.xzDistFromLink < 500.0f && absY < 700.0f) {
if (this->actor.xzDistToLink < 500.0f && absY < 700.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
if (absY < 95.0f) {
globalCtx->unk_11E18 = 0xFF;
@ -241,7 +241,7 @@ void func_80A593A4(EnHoll* this, GlobalContext* globalCtx) {
s32 side;
s32 transitionActorIdx;
if ((this->actor.xzDistFromLink < 120.0f) && (absY = fabsf(this->actor.yDistFromLink), absY < 200.0f)) {
if ((this->actor.xzDistToLink < 120.0f) && (absY = fabsf(this->actor.yDistToLink), absY < 200.0f)) {
if (absY < 50.0f) {
globalCtx->unk_11E18 = 0xFF;
} else {
@ -249,7 +249,7 @@ void func_80A593A4(EnHoll* this, GlobalContext* globalCtx) {
}
if (absY > 50.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
side = (0.0f < this->actor.yDistFromLink) ? 0 : 1;
side = (0.0f < this->actor.yDistToLink) ? 0 : 1;
this->actor.room = globalCtx->transitionActorList[transitionActorIdx].sides[side].room;
if (this->actor.room != globalCtx->roomCtx.curRoom.num &&
func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) {
@ -269,11 +269,11 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) {
s8 side;
s32 transitionActorIdx;
if (this->actor.xzDistFromLink < 120.0f) {
absY = fabsf(this->actor.yDistFromLink);
if (this->actor.xzDistToLink < 120.0f) {
absY = fabsf(this->actor.yDistToLink);
if (absY < 200.0f && absY > 50.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
side = (0.0f < this->actor.yDistFromLink) ? 0 : 1;
side = (0.0f < this->actor.yDistToLink) ? 0 : 1;
this->actor.room = globalCtx->transitionActorList[transitionActorIdx].sides[side].room;
if (this->actor.room != globalCtx->roomCtx.curRoom.num &&
func_8009728C(globalCtx, &globalCtx->roomCtx, this->actor.room) != 0) {

View file

@ -99,7 +99,7 @@ s32 func_80A6E53C(EnHs* this, GlobalContext* globalCtx, u16 textId, EnHsActionFu
this->actor.textId = textId;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistFromLink < 100.0f)) {
if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToLink < 100.0f)) {
this->unk_2A8 |= 1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}
@ -208,7 +208,7 @@ void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) {
} else {
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
this->actor.textId = 0x10B1;
if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistFromLink < 100.0f)) {
if ((ABS(yawDiff) <= 0x2150) && (this->actor.xzDistToLink < 100.0f)) {
func_8002F298(&this->actor, globalCtx, 100.0f, 7);
}
}

View file

@ -69,7 +69,7 @@ s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2Action
this->actor.textId = textId;
if (ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) < 0x2151 &&
this->actor.xzDistFromLink < 100.0f) {
this->actor.xzDistToLink < 100.0f) {
this->unk_2A8 |= 0x1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}

View file

@ -161,7 +161,7 @@ void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx) {
u32 EnIceHono_LinkCloseAndFacing(EnIceHono* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->actor.xzDistFromLink < 60.0f) {
if (this->actor.xzDistToLink < 60.0f) {
Vec3f tempPos;
tempPos.x = Math_SinS(this->actor.yawTowardsLink + 0x8000) * 40.0f + player->actor.posRot.pos.x;
tempPos.y = player->actor.posRot.pos.y;
@ -186,7 +186,7 @@ void EnIceHono_CapturableFlame(EnIceHono* this, GlobalContext* globalCtx) {
func_8002F434(&this->actor, globalCtx, 0x7E, 60.0f, 100.0f);
}
if (this->actor.xzDistFromLink < 200.0f) {
if (this->actor.xzDistToLink < 200.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
func_8002F8F0(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG);

View file

@ -266,14 +266,13 @@ void func_80A7492C(EnIk* this, GlobalContext* globalCtx) {
s32 phi_a0 = (this->unk_2FB == 0) ? 0xAAA : 0x3FFC;
s16 yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistFromLink < 100.0f) &&
(ABS(this->actor.yDistFromLink) < 150.0f)) {
if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistToLink < 100.0f) && (ABS(this->actor.yDistToLink) < 150.0f)) {
if ((globalCtx->gameplayFrames & 1)) {
func_80A74E2C(this);
} else {
func_80A751C8(this);
}
} else if ((ABS(yawDiff) <= 0x4000) && (ABS(this->actor.yDistFromLink) < 150.0f)) {
} else if ((ABS(yawDiff) <= 0x4000) && (ABS(this->actor.yDistToLink) < 150.0f)) {
func_80A74AAC(this);
} else {
func_80A74AAC(this);
@ -325,8 +324,8 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) {
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((ABS(yawDiff) <= temp_t0) && (this->actor.xzDistFromLink < 100.0f)) {
if (ABS(this->actor.yDistFromLink) < 150.0f) {
if ((ABS(yawDiff) <= temp_t0) && (this->actor.xzDistToLink < 100.0f)) {
if (ABS(this->actor.yDistToLink) < 150.0f) {
if ((globalCtx->gameplayFrames & 1)) {
func_80A74E2C(this);
} else {
@ -376,7 +375,7 @@ void func_80A74EBC(EnIk* this, GlobalContext* globalCtx) {
sp2C.y = this->actor.posRot.pos.y;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND);
Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5);
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
func_80062CD4(globalCtx, &sp2C);
}
@ -518,7 +517,7 @@ void func_80A7567C(EnIk* this, GlobalContext* globalCtx) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shieldCollider.base);
if (SkelAnime_Update(&this->skelAnime)) {
if ((ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) <= 0x4000) &&
(this->actor.xzDistFromLink < 100.0f) && (ABS(this->actor.yDistFromLink) < 150.0f)) {
(this->actor.xzDistToLink < 100.0f) && (ABS(this->actor.yDistToLink) < 150.0f)) {
if ((globalCtx->gameplayFrames & 1)) {
func_80A74E2C(this);
} else {

View file

@ -80,7 +80,7 @@ s32 func_80A7BE6C(EnInsect* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Vec3f pos;
if (this->actor.xzDistFromLink < 32.0f) {
if (this->actor.xzDistToLink < 32.0f) {
pos.x = Math_SinS(this->actor.yawTowardsLink + 0x8000) * 16.0f + player->actor.posRot.pos.x;
pos.y = player->actor.posRot.pos.y;
pos.z = Math_CosS(this->actor.yawTowardsLink + 0x8000) * 16.0f + player->actor.posRot.pos.z;
@ -248,7 +248,7 @@ void func_80A7C3F4(EnInsect* this, GlobalContext* globalCtx) {
func_80A7CBC8(this);
} else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) {
func_80A7CE60(this);
} else if (this->actor.xzDistFromLink < 40.0f) {
} else if (this->actor.xzDistToLink < 40.0f) {
func_80A7C818(this);
}
}
@ -291,7 +291,7 @@ void func_80A7C5EC(EnInsect* this, GlobalContext* globalCtx) {
func_80A7CBC8(this);
} else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) {
func_80A7CE60(this);
} else if (this->actor.xzDistFromLink < 40.0f) {
} else if (this->actor.xzDistToLink < 40.0f) {
func_80A7C818(this);
}
}
@ -309,7 +309,7 @@ void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx) {
s16 pad3;
s16 frames;
s16 yaw;
s16 sp38 = this->actor.xzDistFromLink < 40.0f;
s16 sp38 = this->actor.xzDistToLink < 40.0f;
Math_SmoothStepToF(&this->actor.speedXZ, 1.8f, 0.1f, 0.5f, 0.0f);
@ -445,7 +445,7 @@ void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.02f);
}
this->actor.velocity.y = 0.0f;
this->actor.posRot.pos.y += this->actor.waterY;
this->actor.posRot.pos.y += this->actor.yDistToWater;
this->skelAnime.playSpeed = CLAMP(this->unk_31A * 0.018f, 0.1f, 1.9f);
SkelAnime_Update(&this->skelAnime);
@ -487,7 +487,7 @@ void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx) {
if (Rand_ZeroOne() < 0.03f) {
sp40.x = this->actor.posRot.pos.x;
sp40.y = this->actor.posRot.pos.y + this->actor.waterY;
sp40.y = this->actor.posRot.pos.y + this->actor.yDistToWater;
sp40.z = this->actor.posRot.pos.z;
EffectSsGRipple_Spawn(globalCtx, &sp40, 20, 100, 4);
EffectSsGRipple_Spawn(globalCtx, &sp40, 40, 200, 8);
@ -523,7 +523,7 @@ void func_80A7D26C(EnInsect* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += 200;
Actor_SetScale(&this->actor, CLAMP_MIN(this->actor.scale.x - 0.00005f, 0.001f));
if (this->actor.waterY > 5.0f && this->actor.waterY < 30.0f && Rand_ZeroOne() < 0.3f) {
if (this->actor.yDistToWater > 5.0f && this->actor.yDistToWater < 30.0f && Rand_ZeroOne() < 0.3f) {
EffectSsBubble_Spawn(globalCtx, &this->actor.posRot.pos, -5.0f, 5.0f, 5.0f, (Rand_ZeroOne() * 0.04f) + 0.02f);
}
@ -759,7 +759,7 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) {
} else {
func_80A7CA64(this);
}
} else if (this->actor.xzDistFromLink < 50.0f && this->actionFunc != func_80A7CAD0) {
} else if (this->actor.xzDistToLink < 50.0f && this->actionFunc != func_80A7CAD0) {
if (!(this->unk_314 & 0x20) && this->unk_31C < 180) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}

View file

@ -340,13 +340,13 @@ void EnIshi_Wait(EnIshi* this, GlobalContext* globalCtx) {
sFragmentSpawnFuncs[type](this, globalCtx);
sDustSpawnFuncs[type](this, globalCtx);
Actor_Kill(&this->actor);
} else if (this->actor.xzDistFromLink < 600.0f) {
} else if (this->actor.xzDistToLink < 600.0f) {
Collider_CylinderUpdate(&this->actor, &this->collider);
this->collider.base.acFlags &= ~2;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistFromLink < 400.0f) {
if (this->actor.xzDistToLink < 400.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistFromLink < 90.0f) {
if (this->actor.xzDistToLink < 90.0f) {
if (type == ROCK_LARGE) {
func_8002F434(&this->actor, globalCtx, 0, 80.0f, 20.0f);
} else {
@ -411,14 +411,14 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) {
Quake_SetSpeed(quakeIdx, -0x3CB0);
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
Quake_SetCountdown(quakeIdx, 7);
func_800AA000(this->actor.xyzDistFromLinkSq, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xyzDistToLinkSq, 0xFF, 0x14, 0x96);
}
Actor_Kill(&this->actor);
return;
}
if (this->actor.bgCheckFlags & 0x40) {
contactPos.x = this->actor.posRot.pos.x;
contactPos.y = this->actor.posRot.pos.y + this->actor.waterY;
contactPos.y = this->actor.posRot.pos.y + this->actor.yDistToWater;
contactPos.z = this->actor.posRot.pos.z;
EffectSsGSplash_Spawn(globalCtx, &contactPos, 0, 0, 0, 350);
if (type == ROCK_SMALL) {

View file

@ -76,7 +76,7 @@ u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) {
this->actor.textId = textId;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if (ABS(yawDiff) <= 0x1800 && this->actor.xzDistFromLink < 100.0f) {
if (ABS(yawDiff) <= 0x1800 && this->actor.xzDistToLink < 100.0f) {
this->unk_284 |= 1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}

View file

@ -201,7 +201,7 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) {
}
yawTowardsLink = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if (!(this->actor.xzDistFromLink > 120.0f)) {
if (!(this->actor.xzDistToLink > 120.0f)) {
absyawTowardsLink = ABS(yawTowardsLink);
if (absyawTowardsLink < 0x4300) {
@ -216,7 +216,7 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) {
this->actionFunc = func_80A8F8D0;
return;
}
if (this->actor.xzDistFromLink < 80.0f) {
if (this->actor.xzDistToLink < 80.0f) {
player->stateFlags2 |= 0x800000;
}
}

View file

@ -106,7 +106,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) {
this->unk_194++;
if ((BREG(1) != 0) && (this->actor.xzDistFromLink < this->maxSpawnDistance.x) &&
if ((BREG(1) != 0) && (this->actor.xzDistToLink < this->maxSpawnDistance.x) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < this->maxSpawnDistance.y)) {
this->actor.draw = func_80A90948;
@ -123,7 +123,7 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) {
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ SAVE 終了 ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag);
this->actionFunc = func_80A904D8;
} else if ((this->actor.xzDistFromLink < this->maxSpawnDistance.x) &&
} else if ((this->actor.xzDistToLink < this->maxSpawnDistance.x) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < this->maxSpawnDistance.y) &&
(gSaveContext.eventChkInf[9] & 0x1000)) {
@ -206,7 +206,7 @@ void EnKakasi2_Update(Actor* thisx, GlobalContext* globalCtx) {
if (BREG(0) != 0) {
if (BREG(5) != 0) {
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->actor.player_distance ☆☆☆☆☆ %f\n" VT_RST,
this->actor.xzDistFromLink);
this->actor.xzDistToLink);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->hosei.x ☆☆☆☆☆ %f\n" VT_RST, this->maxSpawnDistance.x);
osSyncPrintf("\n\n");
}

View file

@ -219,7 +219,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
}
angleTowardsLink = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if (!(this->actor.xzDistFromLink > 120.0f)) {
if (!(this->actor.xzDistToLink > 120.0f)) {
absAngleTowardsLink = ABS(angleTowardsLink);
if (absAngleTowardsLink < 0x4300) {
@ -235,7 +235,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
this->actionFunc = func_80A915B8;
return;
}
if (this->actor.xzDistFromLink < 80.0f) {
if (this->actor.xzDistToLink < 80.0f) {
player->stateFlags2 |= 0x800000;
}
} else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) {
@ -250,7 +250,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
this->actionFunc = func_80A9187C;
return;
}
if (this->actor.xzDistFromLink < 80.0f) {
if (this->actor.xzDistToLink < 80.0f) {
player->stateFlags2 |= 0x800000;
}
}

View file

@ -387,7 +387,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
Collider_CylinderUpdate(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistFromLink > 500.0f) {
if (this->actor.xzDistToLink > 500.0f) {
this->actor.flags |= 1;
this->partFlags = 0xFFFF;
}
@ -412,7 +412,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
f32 tempX;
f32 tempY;
f32 tempZ;
f32 tempWaterY;
f32 tempYDistToWater;
u8 onGround;
Actor_MoveForward(&this->actor);
@ -422,7 +422,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
tempY = this->actor.posRot.pos.y;
tempZ = this->actor.posRot.pos.z;
tempBgFlags = this->actor.bgCheckFlags;
tempWaterY = this->actor.waterY;
tempYDistToWater = this->actor.yDistToWater;
this->actor.posRot.pos.z += ((this->actor.posRot.pos.y - this->actor.groundY) * -50.0f) / 100.0f;
func_8002E4B4(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 4);
@ -432,7 +432,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.posRot.pos.y = tempY;
this->actor.posRot.pos.z = tempZ;
this->actor.bgCheckFlags = tempBgFlags;
this->actor.waterY = tempWaterY;
this->actor.yDistToWater = tempYDistToWater;
osSyncPrintf(VT_RST);
onGround = (this->actor.bgCheckFlags & 1);
@ -480,13 +480,13 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actionState = ENKANBAN_WATER;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_DROP_WATER);
this->bounceX = this->bounceZ = 0;
this->actor.posRot.pos.y += this->actor.waterY;
this->actor.posRot.pos.y += this->actor.yDistToWater;
EffectSsGSplash_Spawn(globalCtx, &this->actor.posRot.pos, NULL, NULL, 0, (this->partCount * 20) + 300);
EffectSsGRipple_Spawn(globalCtx, &this->actor.posRot.pos, 150, 650, 0);
EffectSsGRipple_Spawn(globalCtx, &this->actor.posRot.pos, 300, 800, 5);
this->actor.velocity.y = 0.0f;
this->actor.gravity = 0.0f;
osSyncPrintf(" WAT Y = %f\n", this->actor.waterY);
osSyncPrintf(" WAT Y = %f\n", this->actor.yDistToWater);
osSyncPrintf(" POS Y = %f\n", this->actor.posRot.pos.y);
osSyncPrintf(" GROUND Y = %f\n", this->actor.groundY);
break;
@ -572,7 +572,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
s32 rippleScale;
if ((player->actor.speedXZ > 0.0f) && (player->actor.posRot.pos.y < this->actor.posRot.pos.y) &&
(this->actor.xyzDistFromLinkSq < 2500.0f)) {
(this->actor.xyzDistToLinkSq < 2500.0f)) {
Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 1.0f, 0.2f);
if (this->actor.speedXZ > 1.0f) {
this->actor.speedXZ = 1.0f;
@ -624,8 +624,8 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
EffectSsGRipple_Spawn(globalCtx, &this->actor.posRot.pos, rippleScale, rippleScale + 500, 0);
}
} else if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xyzDistFromLinkSq < SQ(100.0f))) {
f32 hammerStrength = (100.0f - sqrtf(this->actor.xyzDistFromLinkSq)) * 0.05f;
} else if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xyzDistToLinkSq < SQ(100.0f))) {
f32 hammerStrength = (100.0f - sqrtf(this->actor.xyzDistToLinkSq)) * 0.05f;
this->actionState = ENKANBAN_AIR;
this->actor.gravity = -1.0f;

View file

@ -210,7 +210,7 @@ void EnKarebaba_Grow(EnKarebaba* this, GlobalContext* globalCtx) {
}
void EnKarebaba_Idle(EnKarebaba* this, GlobalContext* globalCtx) {
if (this->actor.xzDistFromLink < 200.0f && fabsf(this->actor.yDistFromLink) < 30.0f) {
if (this->actor.xzDistToLink < 200.0f && fabsf(this->actor.yDistToLink) < 30.0f) {
EnKarebaba_SetupAwaken(this);
}
}

View file

@ -306,17 +306,17 @@ void func_80A9B8D8(EnKusa* this, GlobalContext* globalCtx) {
func_80A9BEAC(this);
this->actor.flags |= 0x800;
} else {
if (!(this->collider.base.maskA & 8) && (this->actor.xzDistFromLink > 12.0f)) {
if (!(this->collider.base.maskA & 8) && (this->actor.xzDistToLink > 12.0f)) {
this->collider.base.maskA |= 8;
}
if (this->actor.xzDistFromLink < 600.0f) {
if (this->actor.xzDistToLink < 600.0f) {
Collider_CylinderUpdate(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistFromLink < 400.0f) {
if (this->actor.xzDistToLink < 400.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistFromLink < 100.0f) {
if (this->actor.xzDistToLink < 100.0f) {
func_8002F580(&this->actor, globalCtx);
}
}
@ -377,7 +377,7 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
} else {
if (this->actor.bgCheckFlags & 0x40) {
contactPos.x = this->actor.posRot.pos.x;
contactPos.y = this->actor.posRot.pos.y + this->actor.waterY;
contactPos.y = this->actor.posRot.pos.y + this->actor.yDistToWater;
contactPos.z = this->actor.posRot.pos.z;
EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 400);
EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0);

View file

@ -176,7 +176,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
Player* player = PLAYER;
s16 sp32;
s16 sp30;
f32 xzDistFromLink;
f32 xzDistToLink;
f32 yaw;
if (func_8002F194(&this->actor, globalCtx) != 0) {
@ -191,7 +191,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
yaw = Math_Vec3f_Yaw(&this->actor.initPosRot.pos, &player->actor.posRot.pos);
yaw -= this->actor.shape.rot.y;
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistFromLink < 265.0f)) {
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToLink < 265.0f)) {
this->actor.flags &= ~1;
return 0;
}
@ -203,13 +203,13 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal
return 0;
}
xzDistFromLink = this->actor.xzDistFromLink;
this->actor.xzDistFromLink = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos);
xzDistToLink = this->actor.xzDistToLink;
this->actor.xzDistToLink = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos);
if (func_8002F2CC(&this->actor, globalCtx, unkf) == 0) {
this->actor.xzDistFromLink = xzDistFromLink;
this->actor.xzDistToLink = xzDistToLink;
return 0;
}
this->actor.xzDistFromLink = xzDistFromLink;
this->actor.xzDistToLink = xzDistToLink;
this->actor.textId = callback1(globalCtx, this);
return 0;
@ -417,8 +417,8 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) {
this->actionFunc = EnKz_StartTimer;
} else {
getItemID = this->isTrading == true ? GI_FROG : GI_TUNIC_ZORA;
yRange = fabsf(this->actor.yDistFromLink) + 1.0f;
xzRange = this->actor.xzDistFromLink + 1.0f;
yRange = fabsf(this->actor.yDistToLink) + 1.0f;
xzRange = this->actor.xzDistToLink + 1.0f;
func_8002F434(&this->actor, globalCtx, getItemID, xzRange, yRange);
}
}

View file

@ -342,7 +342,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) {
this->unk_1E8.unk_00 = 1;
this->actor.flags |= 0x10000;
this->actionFunc = func_80AA106C;
} else if (this->actor.xzDistFromLink < 30.0f + (f32)this->collider.dim.radius) {
} else if (this->actor.xzDistToLink < 30.0f + (f32)this->collider.dim.radius) {
player->stateFlags2 |= 0x800000;
}
}

View file

@ -267,7 +267,7 @@ void func_80AA204C(EnMa2* this, GlobalContext* globalCtx) {
player->stateFlags2 |= 0x2000000;
func_8010BD58(globalCtx, 0x23);
this->actionFunc = func_80AA20E4;
} else if (this->actor.xzDistFromLink < 30.0f + (f32)this->collider.dim.radius) {
} else if (this->actor.xzDistToLink < 30.0f + (f32)this->collider.dim.radius) {
player->stateFlags2 |= 0x800000;
}
}

View file

@ -528,12 +528,12 @@ void func_80AA71AC(EnMb* this, GlobalContext* globalCtx) {
this->unk_32A--;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y, 1, 0x3E8, 0);
}
yDist = this->actor.yDistFromLink;
yDist = this->actor.yDistToLink;
yDistAbs = ABS(yDist);
if ((yDistAbs <= 20.0f) && func_80AA652C(this, globalCtx)) {
yawDiff = this->actor.shape.rot.y - this->actor.yawTowardsLink;
yawDiffAbs = ABS(yawDiff);
if ((yawDiffAbs <= 0x4000) || (func_8002DDE4(globalCtx) != 0) && (this->actor.xzDistFromLink < 160.0f)) {
if ((yawDiffAbs <= 0x4000) || (func_8002DDE4(globalCtx) != 0) && (this->actor.xzDistToLink < 160.0f)) {
func_80AA66A0(this, globalCtx);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE);
func_80AA6AC8(this);
@ -597,8 +597,8 @@ void func_80AA74BC(EnMb* this, GlobalContext* globalCtx) {
if (this->unk_32E == 0) {
yawDiff = this->actor.shape.rot.y - this->actor.yawTowardsLink;
if ((ABS(this->actor.yDistFromLink) <= 20.0f) && (func_80AA652C(this, globalCtx) != 0) &&
(ABS(yawDiff) <= 0x4000) && (this->actor.xzDistFromLink <= 200.0f)) {
if ((ABS(this->actor.yDistToLink) <= 20.0f) && (func_80AA652C(this, globalCtx) != 0) &&
(ABS(yawDiff) <= 0x4000) && (this->actor.xzDistToLink <= 200.0f)) {
func_80AA6AC8(this);
} else {
endFrame = Animation_GetLastFrame(&D_06002C10);
@ -607,7 +607,7 @@ void func_80AA74BC(EnMb* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_SPEAR_NORM);
}
} else if (this->actor.xzDistFromLink <= 160.0f) {
} else if (this->actor.xzDistToLink <= 160.0f) {
this->actor.speedXZ = -5.0f;
} else {
this->actor.speedXZ = 0.0f;
@ -692,7 +692,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) {
}
}
func_8002F71C(globalCtx, &this->actor, ((650.0f - this->actor.xzDistFromLink) * 0.04f) + 4.0f,
func_8002F71C(globalCtx, &this->actor, ((650.0f - this->actor.xzDistToLink) * 0.04f) + 4.0f,
this->actor.posRot.rot.y, 8.0f);
player->invincibilityTimer = oldInvincibilityTimer;
@ -709,7 +709,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) {
sp74 = this->effSpawnPos;
sp74.y = this->actor.groundY;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MONBLIN_HAM_LAND);
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
EffectSsBlast_SpawnWhiteShockwave(globalCtx, &sp74, &sp68, &sp68);
func_80033480(globalCtx, &sp74, 2.0f, 3, 0x12C, 0xB4, 1);
Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5);
@ -884,7 +884,7 @@ void func_80AA8378(EnMb* this, GlobalContext* globalCtx) {
if (this->unk_32E != 0) {
Animation_PlayOnce(&this->skelAnime, &D_0600E18C);
this->unk_32E = 0;
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
Camera_AddQuake(&globalCtx->mainCamera, 2, 25, 5);
} else {
func_80AA6898(this);
@ -943,7 +943,7 @@ void func_80AA8514(EnMb* this, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
}
} else if (((s32)this->skelAnime.curFrame == 15) || ((s32)this->skelAnime.curFrame == 22)) {
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
func_80033260(globalCtx, &this->actor, &effPosition, 50.0f, 0xA, 3.0f, 0x190, 0x3C, 0);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN);
Camera_AddQuake(&globalCtx->mainCamera, 2, 0x19, 5);
@ -974,7 +974,7 @@ void func_80AA87D8(EnMb* this, GlobalContext* globalCtx) {
(Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < this->unk_364)) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1, 750, 0);
this->actor.flags |= 1;
if ((this->actor.xzDistFromLink < 500.0f) && (yawDiff <= 0x1387)) {
if ((this->actor.xzDistToLink < 500.0f) && (yawDiff <= 0x1387)) {
func_80AA6AC8(this);
}
} else {
@ -1030,11 +1030,11 @@ void func_80AA8AEC(EnMb* this, GlobalContext* globalCtx) {
}
this->unk_330 = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->waypointPos);
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->unk_330, 1, 0x5DC, 0);
yDistAbs = (this->actor.yDistFromLink >= 0.0f) ? this->actor.yDistFromLink : -this->actor.yDistFromLink;
yDistAbs = (this->actor.yDistToLink >= 0.0f) ? this->actor.yDistToLink : -this->actor.yDistToLink;
if (yDistAbs <= 20.0f && func_80AA652C(this, globalCtx) != 0) {
yawDiff = (this->actor.shape.rot.y - this->actor.yawTowardsLink);
yawDiffAbs = ABS(yawDiff);
if (yawDiffAbs <= 0x4000 || func_8002DDE4(globalCtx) != 0 && this->actor.xzDistFromLink < 160.0f) {
if (yawDiffAbs <= 0x4000 || func_8002DDE4(globalCtx) != 0 && this->actor.xzDistToLink < 160.0f) {
func_80AA66A0(this, globalCtx);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_VOICE);
func_80AA6AC8(this);

View file

@ -482,7 +482,7 @@ void func_80AAB158(EnMd* this, GlobalContext* globalCtx) {
s16 temp2;
s16 yawDiff;
if (this->actor.xzDistFromLink < 170.0f) {
if (this->actor.xzDistToLink < 170.0f) {
yawDiff = (f32)this->actor.yawTowardsLink - this->actor.shape.rot.y;
absYawDiff = ABS(yawDiff);
@ -707,7 +707,7 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) {
return;
}
if (this->actor.xzDistFromLink < (30.0f + this->collider.dim.radius)) {
if (this->actor.xzDistToLink < (30.0f + this->collider.dim.radius)) {
player->stateFlags2 |= 0x800000;
}
}

View file

@ -107,7 +107,7 @@ void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) {
return;
}
if ((this->actor.xzDistFromLink < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range
if ((this->actor.xzDistToLink < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range
func_8002F2CC(&this->actor, globalCtx, 90.0f);
}
}

View file

@ -426,7 +426,7 @@ void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) {
void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->actor.xzDistFromLink < 30.0f && fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 5.0f) {
if (this->actor.xzDistToLink < 30.0f && fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 5.0f) {
this->timer6 = 100;
this->actor.gravity = -2.0f;
this->actionFunc = func_80AB7290;
@ -697,13 +697,13 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 0x20) {
this->actor.gravity = 0.0f;
if (this->actor.waterY > 15.0f) {
if (this->actor.yDistToWater > 15.0f) {
this->actor.posRot.pos.y += 2.0f;
}
if (this->timer4 == 0) {
this->timer4 = 30;
Math_Vec3f_Copy(&pos, &this->actor.posRot.pos);
pos.y += this->actor.waterY;
pos.y += this->actor.yDistToWater;
EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30);
}
if (this->actor.bgCheckFlags & 8) {
@ -1008,12 +1008,12 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
return;
}
if (thisx->bgCheckFlags & 0x20 && thisx->waterY > 15.0f && this->actionFunc != func_80AB6F04 &&
if (thisx->bgCheckFlags & 0x20 && thisx->yDistToWater > 15.0f && this->actionFunc != func_80AB6F04 &&
thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) {
thisx->velocity.y = 0.0f;
thisx->gravity = 0.0f;
Math_Vec3f_Copy(&pos, &thisx->posRot);
pos.y += thisx->waterY;
pos.y += thisx->yDistToWater;
this->timer4 = 30;
EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400);
this->timer5 = 0;
@ -1027,7 +1027,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
if (D_80AB85E0 == 0 && this->unk_2A4 <= 0 && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) {
this->timer6 = 100;
if (thisx->xzDistFromLink > 10.0f) {
if (thisx->xzDistToLink > 10.0f) {
D_80AB85E0 = 1;
this->timer5 = this->timer4 = this->unk_29E = 0;
thisx->speedXZ = 0.0f;
@ -1049,7 +1049,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
dist = 20.0f;
if (this->unk_2A8 != 0 && thisx->xyzDistFromLinkSq < SQ(dist) && player->invincibilityTimer == 0) {
if (this->unk_2A8 != 0 && thisx->xyzDistToLinkSq < SQ(dist) && player->invincibilityTimer == 0) {
func_8002F6D4(globalCtx, &this->actor, 2.0f, thisx->posRot.rot.y, 0.0f, 0x10);
}

View file

@ -120,9 +120,9 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) {
if ((this->unk_152 != 6) || (gSaveContext.scarecrowSpawnSongSet)) {
if (player->stateFlags2 & 0x1000000) {
// "North! ! ! ! !"
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 北!!!!! ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistFromLink);
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 北!!!!! ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistToLink);
}
if ((this->actor.xzDistFromLink < (90.0f + this->unk_15C)) &&
if ((this->actor.xzDistToLink < (90.0f + this->unk_15C)) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 80.0f)) {
if (player->stateFlags2 & 0x2000000) {
unk_152 = this->unk_152;
@ -132,7 +132,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) {
player->stateFlags2 |= 0x800000;
func_8010BD58(globalCtx, unk_152 + 0x22);
this->actionFunc = func_80ABF0CC;
} else if ((this->actor.xzDistFromLink < (50.0f + this->unk_15C) &&
} else if ((this->actor.xzDistToLink < (50.0f + this->unk_15C) &&
((fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 40.0f)))) {
this->unk_15A = 0;
player->unk_6A8 = &this->actor;
@ -194,7 +194,7 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) {
this->actor.flags &= ~1;
} else if (((this->unk_150 != 4) || !(gSaveContext.eventChkInf[4] & 0x800)) &&
((this->unk_150 != 6) || !(gSaveContext.eventChkInf[1] & 0x2000)) &&
(this->actor.xzDistFromLink < (90.0f + this->unk_15C)) &&
(this->actor.xzDistToLink < (90.0f + this->unk_15C)) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 80.0f)) {
if (player->stateFlags2 & 0x1000000) {
switch (this->unk_150) {
@ -219,7 +219,7 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) {
}
player->stateFlags2 |= 0x800000;
this->actionFunc = func_80ABF4C8;
} else if ((this->actor.xzDistFromLink < (50.0f + this->unk_15C)) &&
} else if ((this->actor.xzDistToLink < (50.0f + this->unk_15C)) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 40.0f)) {
this->unk_15A = 0;
player->stateFlags2 |= 0x800000;
@ -287,7 +287,7 @@ void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) {
} else {
yawDiff = this->actor.yawTowardsLink - this->actor.posRot.rot.y;
this->unk_15A++;
if (!(this->actor.xzDistFromLink > 120.0f)) {
if (!(this->actor.xzDistToLink > 120.0f)) {
if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) {
// "This poem is dedicated to the memory of the dearly departed members of the Royal Family."
this->actor.textId = 0x5021;

View file

@ -176,7 +176,7 @@ void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) {
if (this->actionFunc != EnOkuta_Shoot) {
this->timer = this->numShots;
}
this->jumpHeight = this->actor.yDistFromLink + 20.0f;
this->jumpHeight = this->actor.yDistToLink + 20.0f;
this->jumpHeight = CLAMP_MIN(this->jumpHeight, 10.0f);
if (this->jumpHeight > 50.0f) {
EnOkuta_SpawnSplash(this, globalCtx);
@ -232,7 +232,7 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx) {
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y;
if ((this->actor.xzDistFromLink < 480.0f) && (this->actor.xzDistFromLink > 200.0f)) {
if ((this->actor.xzDistToLink < 480.0f) && (this->actor.xzDistToLink > 200.0f)) {
EnOkuta_SetupAppear(this, globalCtx);
}
}
@ -241,7 +241,7 @@ void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) {
s32 pad;
if (SkelAnime_Update(&this->skelAnime)) {
if (this->actor.xzDistFromLink < 160.0f) {
if (this->actor.xzDistToLink < 160.0f) {
EnOkuta_SetupHide(this);
} else {
EnOkuta_SetupWaitToShoot(this);
@ -295,12 +295,12 @@ void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, 0.5f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_FLOAT);
}
if (this->actor.xzDistFromLink < 160.0f || this->actor.xzDistFromLink > 560.0f) {
if (this->actor.xzDistToLink < 160.0f || this->actor.xzDistToLink > 560.0f) {
EnOkuta_SetupHide(this);
} else {
temp_v0_2 = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 0x71C, 0x38E);
phi_v1 = ABS(temp_v0_2);
if ((phi_v1 < 0x38E) && (this->timer == 0) && (this->actor.yDistFromLink < 200.0f)) {
if ((phi_v1 < 0x38E) && (this->timer == 0) && (this->actor.yDistToLink < 200.0f)) {
EnOkuta_SetupShoot(this, globalCtx);
}
}
@ -334,7 +334,7 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND);
}
}
if (this->actor.xzDistFromLink < 160.0f) {
if (this->actor.xzDistToLink < 160.0f) {
EnOkuta_SetupHide(this);
}
}

View file

@ -188,7 +188,7 @@ void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) {
Vec3f velocity = { 0.0f, 8.0f, 0.0f };
Vec3f accel = { 0.0f, -1.5f, 0.0f };
if (sqrt(this->actor.xyzDistFromLinkSq) <= 40.0f) {
if (sqrt(this->actor.xyzDistToLinkSq) <= 40.0f) {
u8 prevInvincibilityTimer = player->invincibilityTimer;
if (player->invincibilityTimer <= 0) {
if (player->invincibilityTimer <= -40) {
@ -198,7 +198,7 @@ void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) {
globalCtx->damagePlayer(globalCtx, -8);
}
}
func_8002F71C(globalCtx, this->actor.parent, (650.0f - this->actor.parent->xzDistFromLink) * 0.04f + 4.0f,
func_8002F71C(globalCtx, this->actor.parent, (650.0f - this->actor.parent->xzDistToLink) * 0.04f + 4.0f,
this->actor.parent->posRot.rot.y, 8.0f);
player->invincibilityTimer = prevInvincibilityTimer;
this->timer = 1;

View file

@ -125,7 +125,7 @@ void EnPoDesert_UpdateSpeedModifier(EnPoDesert* this) {
void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) {
func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
if (this->actor.xzDistFromLink < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.unk_03)) {
if (this->actor.xzDistToLink < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.unk_03)) {
if (this->currentPathPoint == 2) {
if (Gameplay_InCsMode(globalCtx)) {
this->actor.shape.rot.y += 0x800;

View file

@ -194,7 +194,7 @@ void EnPoField_SetupCirclePlayer(EnPoField* this, GlobalContext* globalCtx) {
Animation_PlayLoop(&this->skelAnime, &D_06000924);
this->collider.base.acFlags |= 1;
this->scaleModifier = this->actor.xzDistFromLink;
this->scaleModifier = this->actor.xzDistToLink;
Math_Vec3f_Copy(&this->actor.initPosRot.pos, &player->actor.posRot.pos);
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
if (this->actionFunc != EnPoField_Damage) {
@ -336,11 +336,11 @@ f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
f32 speed = ((player->stateFlags1 & 0x800000) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f;
if (this->actor.xzDistFromLink < 300.0f) {
if (this->actor.xzDistToLink < 300.0f) {
this->actor.speedXZ = speed * 1.5f + 2.0f;
} else if (this->actor.xzDistFromLink < 400.0f) {
} else if (this->actor.xzDistToLink < 400.0f) {
this->actor.speedXZ = speed * 1.25f + 2.0f;
} else if (this->actor.xzDistFromLink < 500.0f) {
} else if (this->actor.xzDistToLink < 500.0f) {
this->actor.speedXZ = speed + 2.0f;
} else {
this->actor.speedXZ = 12.0f;
@ -475,7 +475,7 @@ void EnPoField_Flee(EnPoField* this, GlobalContext* globalCtx) {
temp_f6 = Math_SinS(this->actionTimer * 0x800) * 3.0f;
this->actor.posRot.pos.x -= temp_f6 * Math_CosS(this->actor.shape.rot.y);
this->actor.posRot.pos.z += temp_f6 * Math_SinS(this->actor.shape.rot.y);
if (this->actionTimer == 0 || this->actor.xzDistFromLink > 1500.0f) {
if (this->actionTimer == 0 || this->actor.xzDistToLink > 1500.0f) {
EnPoField_SetupDisappear(this);
} else {
EnPoField_CorrectYPos(this, globalCtx);

View file

@ -154,7 +154,7 @@ void EnPoRelay_Idle(EnPoRelay* this, GlobalContext* globalCtx) {
if (func_8002F194(&this->actor, globalCtx) != 0) {
this->actor.flags &= ~0x10000;
this->actionFunc = EnPoRelay_Talk;
} else if (this->actor.xzDistFromLink < 250.0f) {
} else if (this->actor.xzDistToLink < 250.0f) {
this->actor.flags |= 0x10000;
this->actor.textId = this->textId;
func_8002F2CC(&this->actor, globalCtx, 250.0f);
@ -210,16 +210,16 @@ void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) {
(Math3D_PointInSquare2D(1580.0f, 2090.0f, -3030.0f, -2500.0f, player->actor.posRot.pos.x,
player->actor.posRot.pos.z) != 0)) {
speed = (this->hookshotSlotFull) ? player->actor.speedXZ * 1.4f : player->actor.speedXZ * 1.2f;
} else if (this->actor.xzDistFromLink < 150.0f) {
} else if (this->actor.xzDistToLink < 150.0f) {
speed = (this->hookshotSlotFull) ? player->actor.speedXZ * 1.2f : player->actor.speedXZ;
} else if (this->actor.xzDistFromLink < 300.0f) {
} else if (this->actor.xzDistToLink < 300.0f) {
speed = (this->hookshotSlotFull) ? player->actor.speedXZ : player->actor.speedXZ * 0.8f;
} else if (this->hookshotSlotFull) {
speed = 4.5f;
} else {
speed = 3.5f;
}
multiplier = 250.0f - this->actor.xzDistFromLink;
multiplier = 250.0f - this->actor.xzDistToLink;
multiplier = CLAMP_MIN(multiplier, 0.0f);
speed += multiplier * 0.02f + 1.0f;
Math_ApproachF(&this->actor.speedXZ, speed, 0.5f, 1.5f);

View file

@ -305,7 +305,7 @@ void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) {
}
sp20 = this->unk_294;
} else if (this->unk_195 != 0) {
sp20 = this->actor.parent->xzDistFromLink;
sp20 = this->actor.parent->xzDistToLink;
}
this->actor.posRot.pos.x = (Math_SinS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.posRot.pos.x;
this->actor.posRot.pos.z = (Math_CosS(this->actor.shape.rot.y + 0x8000) * sp20) + player->actor.posRot.pos.z;
@ -556,7 +556,7 @@ void func_80ADA4A8(EnPoSisters* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) {
this->unk_19A--;
}
if (this->unk_19A == 0 || this->actor.xzDistFromLink < 200.0f) {
if (this->unk_19A == 0 || this->actor.xzDistToLink < 200.0f) {
func_80AD93C4(this);
}
}
@ -567,7 +567,7 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) {
this->unk_19A--;
}
if (this->actor.xzDistFromLink < 200.0f && fabsf(this->actor.yDistFromLink + 5.0f) < 30.0f) {
if (this->actor.xzDistToLink < 200.0f && fabsf(this->actor.yDistToLink + 5.0f) < 30.0f) {
func_80AD943C(this);
} else if (this->unk_19A == 0 && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f) != 0) {
func_80AD9368(this);
@ -593,9 +593,9 @@ void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) {
} else {
Math_ScaledStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 0x71C);
}
if (this->actor.xzDistFromLink < 160.0f && fabsf(this->actor.yDistFromLink + 5.0f) < 30.0f) {
if (this->actor.xzDistToLink < 160.0f && fabsf(this->actor.yDistToLink + 5.0f) < 30.0f) {
func_80AD944C(this);
} else if (this->actor.xzDistFromLink > 240.0f) {
} else if (this->actor.xzDistToLink > 240.0f) {
func_80AD93C4(this);
}
}
@ -686,7 +686,7 @@ void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->unk_199 |= 2;
func_80AD9718(this);
} else if (this->unk_19A == 0 && 240.0f < this->actor.xzDistFromLink) {
} else if (this->unk_19A == 0 && 240.0f < this->actor.xzDistToLink) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
func_80AD93C4(this);
}
@ -785,7 +785,7 @@ void func_80ADB17C(EnPoSisters* this, GlobalContext* globalCtx) {
void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->actor.xzDistFromLink < 130.0f) {
if (this->actor.xzDistToLink < 130.0f) {
func_80AD9DF0(this, globalCtx);
}
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
@ -978,7 +978,7 @@ void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) {
void func_80ADBBF4(EnPoSisters* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 1820);
if (this->actor.xzDistFromLink < 240.0f && fabsf(this->actor.yDistFromLink + 5.0f) < 30.0f) {
if (this->actor.xzDistToLink < 240.0f && fabsf(this->actor.yDistToLink + 5.0f) < 30.0f) {
func_80AD93C4(this);
}
}

View file

@ -437,7 +437,7 @@ void func_80ADEAC4(EnPoh* this, GlobalContext* globalCtx) {
this->unk_198--;
}
EnPoh_MoveTowardsPlayerHeight(this, globalCtx);
if (this->actor.xzDistFromLink < 200.0f) {
if (this->actor.xzDistToLink < 200.0f) {
func_80ADE1BC(this);
} else if (this->unk_198 == 0) {
EnPoh_SetupIdle(this);
@ -455,7 +455,7 @@ void EnPoh_Idle(EnPoh* this, GlobalContext* globalCtx) {
}
func_80ADEA5C(this);
EnPoh_MoveTowardsPlayerHeight(this, globalCtx);
if (this->actor.xzDistFromLink < 200.0f && this->unk_198 < 19) {
if (this->actor.xzDistToLink < 200.0f && this->unk_198 < 19) {
func_80ADE1BC(this);
} else if (this->unk_198 == 0) {
if (Rand_ZeroOne() < 0.1f) {
@ -487,9 +487,9 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 0x71C);
}
EnPoh_MoveTowardsPlayerHeight(this, globalCtx);
if (this->actor.xzDistFromLink > 280.0f) {
if (this->actor.xzDistToLink > 280.0f) {
EnPoh_SetupIdle(this);
} else if (this->unk_198 == 0 && this->actor.xzDistFromLink < 140.0f &&
} else if (this->unk_198 == 0 && this->actor.xzDistToLink < 140.0f &&
func_8002DFC8(&this->actor, 0x2AAA, globalCtx) == 0) {
EnPoh_SetupAttack(this);
}
@ -538,7 +538,7 @@ void func_80ADEF38(EnPoh* this, GlobalContext* globalCtx) {
} else if (this->skelAnime.curFrame > 10.0f) {
this->lightColor.a = ((this->skelAnime.curFrame - 10.0f) * 0.05f) * 255.0f;
}
if (this->skelAnime.playSpeed < 0.5f && this->actor.xzDistFromLink < 280.0f) {
if (this->skelAnime.playSpeed < 0.5f && this->actor.xzDistToLink < 280.0f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_APPEAR);
this->skelAnime.playSpeed = 1.0f;
}
@ -617,7 +617,7 @@ void func_80ADF5E0(EnPoh* this, GlobalContext* globalCtx) {
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, this->unk_19C, 1820) != 0) {
EnPoh_SetupIdle(this);
}
if (this->actor.xzDistFromLink < 200.0f) {
if (this->actor.xzDistToLink < 200.0f) {
func_80ADE1BC(this);
}
EnPoh_MoveTowardsPlayerHeight(this, globalCtx);
@ -657,7 +657,7 @@ void func_80ADF894(EnPoh* this, GlobalContext* globalCtx) {
this->actor.posRot.pos.z += multiplier * Math_SinS(this->actor.shape.rot.y);
Math_ScaledStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink + 0x8000, 0x71C);
EnPoh_MoveTowardsPlayerHeight(this, globalCtx);
if (this->unk_198 == 0 || this->actor.xzDistFromLink > 250.0f) {
if (this->unk_198 == 0 || this->actor.xzDistToLink > 250.0f) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
EnPoh_SetupIdle(this);
}

View file

@ -216,7 +216,7 @@ void func_80AE2744(EnRd* this, GlobalContext* globalCtx) {
}
this->unk_305 = 0;
if ((this->actor.xzDistFromLink <= 150.0f) && func_8002DDE4(globalCtx)) {
if ((this->actor.xzDistToLink <= 150.0f) && func_8002DDE4(globalCtx)) {
if ((this->actor.params != 2) && (this->unk_305 == 0)) {
func_80AE37BC(this);
} else {
@ -298,7 +298,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) {
player->actor.freezeTimer = 40;
func_8008EEAC(globalCtx, &this->actor);
PLAYER->unk_684 = &this->actor;
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
}
this->unk_306 = 0x3C;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM);
@ -447,7 +447,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
Animation_PlayLoop(&this->skelAnime, &D_06004268);
this->unk_304++;
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(this->actor.xzDistFromLink, 0xFF, 1, 0xC);
func_800AA000(this->actor.xzDistToLink, 0xFF, 1, 0xC);
this->unk_319 = 0x14;
case 0:
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x5DC, 0);
@ -481,7 +481,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
if (this->unk_319 == 0) {
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(this->actor.xzDistFromLink, 0xF0, 1, 0xC);
func_800AA000(this->actor.xzDistToLink, 0xF0, 1, 0xC);
this->unk_319 = 0x14;
func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92);
}
@ -520,7 +520,7 @@ void func_80AE3834(EnRd* this, GlobalContext* globalCtx) {
if (ABS(temp_v0) < 0x2008) {
if (!(this->unk_312 & 0x80)) {
player->actor.freezeTimer = 60;
func_800AA000(this->actor.xzDistFromLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
func_8008EEAC(globalCtx, &this->actor);
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM);

View file

@ -212,7 +212,7 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) {
if ((surfaceType != 4) && (surfaceType != 7)) {
this->actor.speedXZ = 0.0f;
this->actionfunc = func_80AE5688;
} else if ((this->unk_272 == 0) || (this->actor.xzDistFromLink < 30.0f) || (this->actor.xzDistFromLink > 400.0f) ||
} else if ((this->unk_272 == 0) || (this->actor.xzDistToLink < 30.0f) || (this->actor.xzDistToLink > 400.0f) ||
(this->actor.bgCheckFlags & 8)) {
this->actionfunc = func_80AE5688;
} else if (this->unk_274 == 0) {
@ -240,15 +240,15 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) {
surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorPolySource);
if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistFromLink > 400.0f) ||
if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistToLink > 400.0f) ||
(this->actor.bgCheckFlags & 8)) {
this->actionfunc = func_80AE5688;
} else {
if ((this->actor.xzDistFromLink < 70.0f) && (this->unk_270 == 0)) {
if ((this->actor.xzDistToLink < 70.0f) && (this->unk_270 == 0)) {
this->unk_270 = 30;
}
speed = (this->actor.xzDistFromLink - 20.0f) / ((Rand_ZeroOne() * 50.0f) + 150.0f);
speed = (this->actor.xzDistToLink - 20.0f) / ((Rand_ZeroOne() * 50.0f) + 150.0f);
this->actor.speedXZ += speed * 1.8f;
if (this->actor.speedXZ >= 3.0f) {
this->actor.speedXZ = 3.0f;

View file

@ -515,9 +515,9 @@ void EnRr_UpdateBodySegments(EnRr* this, GlobalContext* globalCtx) {
void EnRr_Approach(EnRr* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x1F4, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
if ((this->actionTimer == 0) && (this->actor.xzDistFromLink < 160.0f)) {
if ((this->actionTimer == 0) && (this->actor.xzDistToLink < 160.0f)) {
EnRr_SetupReach(this);
} else if ((this->actor.xzDistFromLink < 400.0f) && (this->actor.speedXZ == 0.0f)) {
} else if ((this->actor.xzDistToLink < 400.0f) && (this->actor.speedXZ == 0.0f)) {
EnRr_SetSpeed(this, 2.0f);
}
}
@ -563,7 +563,7 @@ void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) {
void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
func_800AA000(this->actor.xyzDistFromLinkSq, 120, 2, 120);
func_800AA000(this->actor.xyzDistToLinkSq, 120, 2, 120);
if ((this->frameCount % 8) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIKE_EAT);
}

View file

@ -171,7 +171,7 @@ void func_80AEAC54(EnRu1* this, GlobalContext* globalCtx) {
Collider_CylinderUpdate(thisx, collider2);
if (this->unk_34C != 0) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider2);
} else if (thisx->xzDistFromLink > 32.0f) {
} else if (thisx->xzDistToLink > 32.0f) {
this->unk_34C = 1;
}
}
@ -443,7 +443,7 @@ void EnRu1_SpawnRipple(EnRu1* this, GlobalContext* globalCtx, s16 radiusMax, s16
Actor* thisx = &this->actor;
pos.x = thisx->posRot.pos.x;
pos.y = thisx->posRot.pos.y + thisx->waterY;
pos.y = thisx->posRot.pos.y + thisx->yDistToWater;
pos.z = thisx->posRot.pos.z;
EffectSsGRipple_Spawn(globalCtx, &pos, 100, radiusMax, life);
}
@ -467,7 +467,7 @@ void func_80AEB680(EnRu1* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor;
pos.x = thisx->posRot.pos.x;
pos.y = thisx->posRot.pos.y + thisx->waterY;
pos.y = thisx->posRot.pos.y + thisx->yDistToWater;
pos.z = thisx->posRot.pos.z;
EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 1, 0);
@ -1148,7 +1148,7 @@ void func_80AED218(EnRu1* this, UNK_TYPE arg1) {
} else if (func_80AED084(this, 5)) {
Animation_Change(&this->skelAnime, &D_06002990, 1.0f, 0, Animation_GetLastFrame(&D_06002990), 2, -8.0f);
this->action = 21;
this->unk_27C = this->actor.xzDistFromLink;
this->unk_27C = this->actor.xzDistToLink;
}
}
@ -1247,7 +1247,7 @@ s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) {
Actor_Kill(thisx);
return 0;
} else if (((this->roomNum1 != curRoomNum) || (this->roomNum2 != curRoomNum)) &&
(thisx->waterY > kREG(16) + 50.0f) && (this->action != 33)) {
(thisx->yDistToWater > kREG(16) + 50.0f) && (this->action != 33)) {
this->action = 33;
this->drawConfig = 2;
this->unk_2A8 = 0xFF;
@ -1476,7 +1476,7 @@ void func_80AEE050(EnRu1* this) {
this->unk_350 = 1;
func_80AEE02C(this);
this->unk_35C = 0;
this->unk_358 = (this->actor.waterY - 10.0f) * 0.5f;
this->unk_358 = (this->actor.yDistToWater - 10.0f) * 0.5f;
this->unk_354 = this->actor.posRot.pos.y + thisx->unk_358; // thisx only used here
} else {
this->actor.gravity = 0.0f;
@ -1605,7 +1605,7 @@ void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) {
func_8002F580(this, globalCtx);
this->action = 27;
func_80AEADD8(this);
} else if (thisx->waterY > 0.0f) {
} else if (thisx->yDistToWater > 0.0f) {
this->action = 29;
this->unk_350 = 0;
}

View file

@ -107,7 +107,7 @@ void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) {
s32 i;
if (this->actor.waterY > 0) {
if (this->actor.yDistToWater > 0) {
for (i = 0; i < 10; i++) {
EffectSsBubble_Spawn(globalCtx, &this->actor.posRot.pos, 10.0f, 10.0f, 30.0f, 0.25f);
}
@ -135,7 +135,7 @@ void EnSb_SetupWaitOpen(EnSb* this) {
void EnSb_SetupLunge(EnSb* this) {
f32 frameCount = Animation_GetLastFrame(&D_06000124);
f32 playbackSpeed = this->actor.waterY > 0.0f ? 1.0f : 0.0f;
f32 playbackSpeed = this->actor.yDistToWater > 0.0f ? 1.0f : 0.0f;
Animation_Change(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frameCount, 2, 0);
this->behavior = SHELLBLADE_LUNGE;
@ -157,7 +157,7 @@ void EnSb_SetupCooldown(EnSb* this, s32 changeSpeed) {
}
this->behavior = SHELLBLADE_WAIT_CLOSED;
if (changeSpeed) {
if (this->actor.waterY > 0.0f) {
if (this->actor.yDistToWater > 0.0f) {
this->actor.speedXZ = -5.0f;
if (this->actor.velocity.y < 0.0f) {
this->actor.velocity.y = 2.1f;
@ -177,7 +177,7 @@ void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) {
// always face toward link
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0);
if ((this->actor.xzDistFromLink <= 160.0f) && (this->actor.xzDistFromLink > 40.0f)) {
if ((this->actor.xzDistToLink <= 160.0f) && (this->actor.xzDistToLink > 40.0f)) {
EnSb_SetupOpen(this);
}
}
@ -190,7 +190,7 @@ void EnSb_Open(EnSb* this, GlobalContext* globalCtx) {
EnSb_SetupWaitOpen(this);
} else {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0);
if ((this->actor.xzDistFromLink > 160.0f) || (this->actor.xzDistFromLink <= 40.0f)) {
if ((this->actor.xzDistToLink > 160.0f) || (this->actor.xzDistToLink <= 40.0f)) {
EnSb_SetupWaitClosed(this);
}
}
@ -201,7 +201,7 @@ void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0);
if ((this->actor.xzDistFromLink > 160.0f) || (this->actor.xzDistFromLink <= 40.0f)) {
if ((this->actor.xzDistToLink > 160.0f) || (this->actor.xzDistToLink <= 40.0f)) {
EnSb_SetupWaitClosed(this);
}
@ -222,7 +222,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) {
if (this->actor.shape.rot.y == invertedYaw) {
this->actor.posRot.rot.y = this->attackYaw;
if (this->actor.waterY > 0.0f) {
if (this->actor.yDistToWater > 0.0f) {
this->actor.velocity.y = 3.0f;
this->actor.speedXZ = 5.0f;
this->actor.gravity = -0.35f;
@ -242,7 +242,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) {
void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f);
if ((this->actor.velocity.y <= -0.1f) || ((this->actor.bgCheckFlags & 2))) {
if (!(this->actor.waterY > 0.0f)) {
if (!(this->actor.yDistToWater > 0.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND);
}
this->actor.bgCheckFlags = this->actor.bgCheckFlags & ~2;
@ -263,7 +263,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) {
if (this->bouncesLeft != 0) {
this->bouncesLeft--;
this->timer = 1;
if (this->actor.waterY > 0.0f) {
if (this->actor.yDistToWater > 0.0f) {
this->actor.velocity.y = 3.0f;
this->actor.speedXZ = 5.0f;
this->actor.gravity = -0.35f;
@ -413,7 +413,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
if (this->isDead) {
if (this->actor.waterY > 0.0f) {
if (this->actor.yDistToWater > 0.0f) {
this->actor.params = 4;
} else {
this->actor.params = 1;

View file

@ -347,7 +347,7 @@ s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) {
return true;
}
if (this->actor.xzDistFromLink > 160.0f) {
if (this->actor.xzDistToLink > 160.0f) {
return false;
}

View file

@ -651,7 +651,7 @@ s32 EnSt_IsCloseToPlayer(EnSt* this, GlobalContext* globalCtx) {
if (this->takeDamageSpinTimer != 0) {
// skull is spinning from damage.
return false;
} else if (this->actor.xzDistFromLink > 160.0f) {
} else if (this->actor.xzDistToLink > 160.0f) {
// player is more than 160 xz units from the skulltulla
return false;
}

View file

@ -261,7 +261,7 @@ s32 func_80B142F4(EnTa* this, GlobalContext* globalCtx, u16 textId) {
this->actor.textId = textId;
if ((ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) <= 0x4300) &&
(this->actor.xzDistFromLink < 100.0f)) {
(this->actor.xzDistToLink < 100.0f)) {
this->unk_2E0 |= 1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}

File diff suppressed because it is too large Load diff

26
src/overlays/actors/ovl_En_Tite/z_en_tite.h Normal file → Executable file
View file

@ -6,9 +6,33 @@
struct EnTite;
typedef void (*EnTiteActionFunc)(struct EnTite*, GlobalContext*);
typedef enum {
/* -2 */ TEKTITE_BLUE = -2,
/* -1 */ TEKTITE_RED
} EnTiteType;
typedef struct EnTite {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x22C];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[25];
/* 0x0226 */ Vec3s morphTable[25];
/* 0x02BC */ u8 action;
/* 0x02BD */ u8 flipState;
/* 0x02C0 */ EnTiteActionFunc actionFunc;
/* 0x02C4 */ struct_80032E24 unk_2C4; // Data for EnPart which is spawned at death
/* 0x02DC */ s32 unk_2DC; // flags related to bgCheck drawn effects
/* 0x02E0 */ s16 actionVar1; // Usage depends on current action function
/* 0x02E2 */ u8 actionVar2; // Usage depends on current action function
/* 0x02E3 */ u8 spawnIceTimer;
/* 0x02E4 */ u8 damageEffect;
/* 0x02E8 */ ColliderJntSph collider;
/* 0x0308 */ ColliderJntSphItem colliderItem;
/* 0x0348 */ Vec3f frontLeftFootPos;
/* 0x0354 */ Vec3f frontRightFootPos;
/* 0x0360 */ Vec3f backRightFootPos;
/* 0x036C */ Vec3f backLeftFootPos;
} EnTite; // size = 0x0378
extern const ActorInit En_Tite_InitVars;

View file

@ -215,7 +215,7 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) {
s16 v0;
s16 v1;
if (this->actor.xyzDistFromLinkSq > 10000.0f) {
if (this->actor.xyzDistToLinkSq > 10000.0f) {
return 0;
}

View file

@ -237,7 +237,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->skelAnime.playSpeed = 0.0f;
this->actor.posRot.pos.x = (Math_SinS(this->actor.posRot.rot.y) * 25.0f) + sSpawnPoint.x;
this->actor.posRot.pos.z = (Math_CosS(this->actor.posRot.rot.y) * 25.0f) + sSpawnPoint.z;
if ((this->actor.xzDistFromLink <= 120.0f) || func_80033A84(globalCtx, &this->actor) ||
if ((this->actor.xzDistToLink <= 120.0f) || func_80033A84(globalCtx, &this->actor) ||
(attackItem != NULL)) {
if (attackItem != NULL) {
sDodgeRollState = 1;
@ -363,13 +363,13 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
if (func_800354B4(globalCtx, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.posRot.rot.y)) {
// Loads arguments in wrong order. Probably related to static variables problem.
if ((player->swordAnimation == STAB_1H) && (this->actor.xzDistFromLink < 90.0f)) {
if ((player->swordAnimation == STAB_1H) && (this->actor.xzDistToLink < 90.0f)) {
// Handles the reaction to a one-handed stab. If the conditions are satisfied,
// Dark Link jumps on Link's sword. Otherwise he backflips away.
if ((this->swordState == 0) && (sCounterState == 0) && (player->invincibilityTimer == 0) &&
(player->swordAnimation == STAB_1H) && (this->actor.xzDistFromLink <= 85.0f) &&
(player->swordAnimation == STAB_1H) && (this->actor.xzDistToLink <= 85.0f) &&
func_80033A84(globalCtx, &this->actor)) {
sStickTilt = 0.0f;
@ -421,26 +421,26 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
sStickAngle = this->actor.yawTowardsLink;
sp50 = 0.0f;
if ((90.0f >= this->actor.xzDistFromLink) && (this->actor.xzDistFromLink > 70.0f) &&
if ((90.0f >= this->actor.xzDistToLink) && (this->actor.xzDistToLink > 70.0f) &&
(ABS(sp5A) >= 0x7800) &&
((this->actor.unk_10C != 0) || !(player->stateFlags1 & 0x00400000))) {
EnTorch2_SwingSword(globalCtx, input, this);
} else if (((this->actor.xzDistFromLink <= 70.0f) ||
((this->actor.xzDistFromLink <= 80.0f + sp50) && (player->swordState != 0))) &&
} else if (((this->actor.xzDistToLink <= 70.0f) ||
((this->actor.xzDistToLink <= 80.0f + sp50) && (player->swordState != 0))) &&
(this->swordState == 0)) {
if (!EnTorch2_SwingSword(globalCtx, input, this) && (this->swordState == 0) &&
(sCounterState == 0)) {
EnTorch2_Backflip(this, input, &this->actor);
}
} else if (this->actor.xzDistFromLink <= 50 + sp50) {
} else if (this->actor.xzDistToLink <= 50 + sp50) {
sStickTilt = 127.0f;
sStickAngle = this->actor.yawTowardsLink;
if (this->actor.unk_10C == 0) {
Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0);
}
} else if (this->actor.xzDistFromLink > 100.0f + sp50) {
} else if (this->actor.xzDistToLink > 100.0f + sp50) {
if ((player->swordState == 0) || (player->swordAnimation < SPIN_ATTACK_1H) ||
(player->swordAnimation > BIG_SPIN_2H) || (this->actor.xzDistFromLink >= 280.0f)) {
(player->swordAnimation > BIG_SPIN_2H) || (this->actor.xzDistToLink >= 280.0f)) {
sStickTilt = 127.0f;
sStickAngle = this->actor.yawTowardsLink;
if (this->actor.unk_10C == 0) {
@ -546,7 +546,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
input->cur.button = BTN_R;
}
if ((sActionState == ENTORCH2_ATTACK) && (this->actor.xzDistFromLink <= 610.0f) && sZTargetFlag) {
if ((sActionState == ENTORCH2_ATTACK) && (this->actor.xzDistToLink <= 610.0f) && sZTargetFlag) {
input->cur.button |= BTN_Z;
}
@ -655,9 +655,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
if (gSaveContext.health < 0x50) {
staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 3;
}
if (this->actor.xzDistFromLink > 80.0f) {
if (this->actor.xzDistToLink > 80.0f) {
this->linearVelocity = 1.2f;
} else if (this->actor.xzDistFromLink < 70.0f) {
} else if (this->actor.xzDistToLink < 70.0f) {
this->linearVelocity = -1.5f;
} else {
this->linearVelocity = 1.0f;
@ -670,9 +670,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
}
if (player->linearVelocity == -18.0f) {
if (this->actor.xzDistFromLink > 80.0f) {
if (this->actor.xzDistToLink > 80.0f) {
player->linearVelocity = 1.2f;
} else if (this->actor.xzDistFromLink < 70.0f) {
} else if (this->actor.xzDistToLink < 70.0f) {
player->linearVelocity = -1.5f;
} else {
player->linearVelocity = 1.0f;

View file

@ -124,7 +124,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx)
Vec3f* actorPos = &this->actor.posRot.pos;
pos = *actorPos;
pos.y += this->actor.waterY;
pos.y += this->actor.yDistToWater;
EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400);
@ -160,7 +160,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Player* player2 = PLAYER;
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.waterY > 15.0f)) {
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) {
EnTuboTrap_SpawnEffectsInWater(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_BOMB_DROP_WATER);
EnTuboTrap_DropCollectible(this, globalCtx);
@ -219,7 +219,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) {
osSyncPrintf("\n\n");
}
if (this->actor.xzDistFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) {
if (this->actor.xzDistToLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) {
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_ENEMY);
this->actor.flags |= 1;
targetHeight = 40.0f + -10.0f * gSaveContext.linkAge;

View file

@ -150,10 +150,10 @@ void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) {
pitch = 0x1B91;
}
dist = this->beamSightRange - this->actor.xzDistFromLink;
dist = this->beamSightRange - this->actor.xzDistToLink;
if (this->actor.xzDistFromLink <= this->beamSightRange && ABS(headRot) <= 0x2710 && pitch >= 0xE38 &&
this->actor.yDistFromLink <= 80.0f && this->actor.yDistFromLink >= -160.0f) {
if (this->actor.xzDistToLink <= this->beamSightRange && ABS(headRot) <= 0x2710 && pitch >= 0xE38 &&
this->actor.yDistToLink <= 80.0f && this->actor.yDistToLink >= -160.0f) {
Math_SmoothStepToS(&this->beamRot, pitch, 10, 0xFA0, 0);
if (Math_SmoothStepToS(&this->headRotY, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1,
(ABS((s16)(dist * 180.0f)) / 3) + 0xFA0, 0) <= 5460) {

Some files were not shown because too many files have changed in this diff Show more