mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-21 14:31:17 +00:00
Document/fix Player.bodyPartsPos
usage (#1141)
* Document/fix `Player#bodyPartsPos` usage * `distFromLinksHead` -> `distFromPlayerHat` * Comment on `bodyPartsPos[-1]` * Run formatter * Use `PLAYER_BODYPART_MAX` more * Use hex for `PlayerBodyPart` enum comments
This commit is contained in:
parent
c73053db6f
commit
5cadc5df8a
18 changed files with 166 additions and 120 deletions
|
@ -609,7 +609,7 @@ void func_80A0329C(EnElf* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
func_80A0232C(this, globalCtx);
|
||||
this->unk_28C.y = player->bodyPartsPos[0].y;
|
||||
this->unk_28C.y = player->bodyPartsPos[PLAYER_BODYPART_WAIST].y;
|
||||
func_80A02F2C(this, &this->unk_28C);
|
||||
func_80A03018(this, globalCtx);
|
||||
|
||||
|
@ -758,7 +758,7 @@ void func_80A03814(EnElf* this, GlobalContext* globalCtx) {
|
|||
this->unk_28C.x = Math_CosS(this->unk_2AC) * this->unk_2B8;
|
||||
this->unk_28C.z = Math_SinS(this->unk_2AC) * -this->unk_2B8;
|
||||
this->unk_2AC += this->unk_2B0;
|
||||
func_80A02E30(this, &player->bodyPartsPos[0]);
|
||||
func_80A02E30(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]);
|
||||
this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
||||
EnElf_SpawnSparkles(this, globalCtx, 32);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
|
||||
|
@ -782,7 +782,7 @@ void func_80A03990(EnElf* this, GlobalContext* globalCtx) {
|
|||
this->unk_2B8 = 1.0f;
|
||||
}
|
||||
|
||||
func_80A02E30(this, &player->bodyPartsPos[0]);
|
||||
func_80A02E30(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]);
|
||||
Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_2B4) * SQ(1.0f / 9.0f))) * 0.008f);
|
||||
this->unk_2BC = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
|
||||
EnElf_SpawnSparkles(this, globalCtx, 32);
|
||||
|
@ -837,7 +837,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) {
|
|||
Player* player = GET_PLAYER(globalCtx);
|
||||
Actor* arrowPointedActor;
|
||||
f32 xScale;
|
||||
f32 distFromLinksHead;
|
||||
f32 distFromPlayerHat;
|
||||
|
||||
func_80A0461C(this, globalCtx);
|
||||
func_80A03AB0(this, globalCtx);
|
||||
|
@ -882,17 +882,17 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
distFromLinksHead = Math_Vec3f_DistXYZ(&player->bodyPartsPos[8], &this->actor.world.pos);
|
||||
distFromPlayerHat = Math_Vec3f_DistXYZ(&player->bodyPartsPos[PLAYER_BODYPART_HAT], &this->actor.world.pos);
|
||||
|
||||
switch (this->unk_2A8) {
|
||||
case 7:
|
||||
func_80A02C98(this, &player->bodyPartsPos[8], 1.0f - this->unk_2AE * (1.0f / 30.0f));
|
||||
xScale = Math_Vec3f_DistXYZ(&player->bodyPartsPos[8], &this->actor.world.pos);
|
||||
func_80A02C98(this, &player->bodyPartsPos[PLAYER_BODYPART_HAT], 1.0f - this->unk_2AE * (1.0f / 30.0f));
|
||||
xScale = Math_Vec3f_DistXYZ(&player->bodyPartsPos[PLAYER_BODYPART_HAT], &this->actor.world.pos);
|
||||
|
||||
if (distFromLinksHead < 7.0f) {
|
||||
if (distFromPlayerHat < 7.0f) {
|
||||
this->unk_2C0 = 0;
|
||||
xScale = 0.0f;
|
||||
} else if (distFromLinksHead < 25.0f) {
|
||||
} else if (distFromPlayerHat < 25.0f) {
|
||||
xScale = (xScale - 5.0f) * 0.05f;
|
||||
xScale = 1.0f - xScale;
|
||||
xScale = (1.0f - SQ(xScale)) * 0.008f;
|
||||
|
@ -902,12 +902,12 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) {
|
|||
EnElf_SpawnSparkles(this, globalCtx, 16);
|
||||
break;
|
||||
case 8:
|
||||
func_80A02C98(this, &player->bodyPartsPos[8], 0.2f);
|
||||
this->actor.world.pos = player->bodyPartsPos[8];
|
||||
func_80A02C98(this, &player->bodyPartsPos[PLAYER_BODYPART_HAT], 0.2f);
|
||||
this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_HAT];
|
||||
func_80A029A8(this, 1);
|
||||
break;
|
||||
case 11:
|
||||
nextPos = player->bodyPartsPos[8];
|
||||
nextPos = player->bodyPartsPos[PLAYER_BODYPART_HAT];
|
||||
nextPos.y += 1500.0f * this->actor.scale.y;
|
||||
func_80A02E30(this, &nextPos);
|
||||
EnElf_SpawnSparkles(this, globalCtx, 16);
|
||||
|
@ -948,14 +948,14 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (this->fairyFlags & 2) {
|
||||
if (distFromLinksHead < 30.0f) {
|
||||
if (distFromPlayerHat < 30.0f) {
|
||||
this->fairyFlags ^= 2;
|
||||
}
|
||||
|
||||
func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f);
|
||||
EnElf_SpawnSparkles(this, globalCtx, 16);
|
||||
} else {
|
||||
if (distFromLinksHead > 100.0f) {
|
||||
if (distFromPlayerHat > 100.0f) {
|
||||
this->fairyFlags |= 2;
|
||||
|
||||
if (this->unk_2C7 == 0) {
|
||||
|
@ -1168,8 +1168,8 @@ void func_80A0461C(EnElf* this, GlobalContext* globalCtx) {
|
|||
func_80A01C38(this, temp);
|
||||
|
||||
if (temp == 11) {
|
||||
this->unk_2B8 = Math_Vec3f_DistXZ(&player->bodyPartsPos[8], &this->actor.world.pos);
|
||||
this->unk_2AC = Math_Vec3f_Yaw(&this->actor.world.pos, &player->bodyPartsPos[8]);
|
||||
this->unk_2B8 = Math_Vec3f_DistXZ(&player->bodyPartsPos[PLAYER_BODYPART_HAT], &this->actor.world.pos);
|
||||
this->unk_2AC = Math_Vec3f_Yaw(&this->actor.world.pos, &player->bodyPartsPos[PLAYER_BODYPART_HAT]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1217,9 +1217,11 @@ void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) {
|
|||
naviRefPos = globalCtx->actorCtx.targetCtx.naviRefPos;
|
||||
|
||||
if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) {
|
||||
naviRefPos.x = player->bodyPartsPos[7].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f);
|
||||
naviRefPos.y = player->bodyPartsPos[7].y + 5.0f;
|
||||
naviRefPos.z = player->bodyPartsPos[7].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f);
|
||||
naviRefPos.x =
|
||||
player->bodyPartsPos[PLAYER_BODYPART_HEAD].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f);
|
||||
naviRefPos.y = player->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 5.0f;
|
||||
naviRefPos.z =
|
||||
player->bodyPartsPos[PLAYER_BODYPART_HEAD].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f);
|
||||
}
|
||||
|
||||
this->actor.focus.pos = naviRefPos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue