diff options
| author | AdamKiddle <54328813+AdamKiddle@users.noreply.github.com> | 2020-12-31 20:00:30 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-31 15:00:30 -0500 |
| commit | 600bad1f20e259b70708944b045d3f4407b673bf (patch) | |
| tree | 89016efb7966aa56ad50a52a8d3ead27fc8acfde /src/code | |
| parent | 5a2bd7a035bfe718eaa34a1fcca76a87daae8644 (diff) | |
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
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 53 | ||||
| -rw-r--r-- | src/code/z_en_item00.c | 4 |
2 files changed, 28 insertions, 29 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 70e572b6b..9a4066393 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -815,7 +815,7 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { Actor_SetScale(actor, 0.01f); actor->unk_1F = 3; actor->minVelocityY = -20.0f; - actor->xyzDistFromLinkSq = FLT_MAX; + actor->xyzDistToLinkSq = FLT_MAX; actor->naviEnemyId = 0xFF; actor->uncullZoneForward = 1000.0f; actor->uncullZoneScale = 350.0f; @@ -1105,7 +1105,7 @@ s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) { s16 var = actor->yawTowardsLink - actor->shape.rot.y; if (ABS(var) < arg2) { - f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistFromLink) + SQ(actor->yDistFromLink)); + f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistToLink) + SQ(actor->yDistToLink)); if (xyzDistanceFromLink < arg1) { return 1; @@ -1250,8 +1250,8 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f func_8002E2AC(globalCtx, actor, &sp64, arg5); sp50 = actor->posRot.pos.y; if (func_8004213C(globalCtx, &globalCtx->colCtx, actor->posRot.pos.x, actor->posRot.pos.z, &sp50, &sp54)) { - actor->waterY = sp50 - actor->posRot.pos.y; - if (actor->waterY < 0.0f) { + actor->yDistToWater = sp50 - actor->posRot.pos.y; + if (actor->yDistToWater < 0.0f) { actor->bgCheckFlags &= ~0x60; } else { if (!(actor->bgCheckFlags & 0x20)) { @@ -1269,7 +1269,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f } } else { actor->bgCheckFlags &= ~0x60; - actor->waterY = -32000.0f; + actor->yDistToWater = -32000.0f; } } } @@ -1417,8 +1417,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { if ((yawTempAbs > 0x4000) || (actor->flags & 0x8000000)) { return FLT_MAX; } else { - ret = actor->xyzDistFromLinkSq - - actor->xyzDistFromLinkSq * 0.8f * ((0x4000 - yawTempAbs) * 3.0517578125e-05f); + ret = actor->xyzDistToLinkSq - actor->xyzDistToLinkSq * 0.8f * ((0x4000 - yawTempAbs) * 3.0517578125e-05f); return ret; } } @@ -1427,7 +1426,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { return FLT_MAX; } - return actor->xyzDistFromLinkSq; + return actor->xyzDistToLinkSq; } typedef struct { @@ -1460,7 +1459,7 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { dist = FLT_MAX; } else { - dist = actor->xyzDistFromLinkSq; + dist = actor->xyzDistToLinkSq; } return !func_8002F090(actor, D_80115FF8[actor->unk_1F].unk_4 * dist); @@ -1484,13 +1483,13 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3 // This is convoluted but it seems like it must be a single if statement to match if ((player->actor.flags & 0x100) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || ((actor->unk_10C == 0) && - ((arg3 < fabsf(actor->yDistFromLink)) || (player->targetActorDistance < actor->xzDistFromLink) || - (arg2 < actor->xzDistFromLink)))) { + ((arg3 < fabsf(actor->yDistToLink)) || (player->targetActorDistance < actor->xzDistToLink) || + (arg2 < actor->xzDistToLink)))) { return 0; } player->targetActor = actor; - player->targetActorDistance = actor->xzDistFromLink; + player->targetActorDistance = actor->xzDistToLink; player->exchangeItemId = exchangeItemId; return 1; @@ -1549,7 +1548,7 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) && (getItemId < GI_MAX)) || (!(player->stateFlags1 & 0x20000800))) { - if ((actor->xzDistFromLink < xzRange) && (fabsf(actor->yDistFromLink) < yRange)) { + if ((actor->xzDistToLink < xzRange) && (fabsf(actor->yDistToLink) < yRange)) { yawDiff = actor->yawTowardsLink - player->actor.shape.rot.y; absYawDiff = ABS(yawDiff); if ((getItemId != GI_NONE) || (player->getItemDirection < absYawDiff)) { @@ -1598,8 +1597,8 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { Player* player = PLAYER; - if (actor->xyzDistFromLinkSq < player->unk_6A4) { - player->unk_6A4 = actor->xyzDistFromLinkSq; + if (actor->xyzDistToLinkSq < player->unk_6A4) { + player->unk_6A4 = actor->xyzDistToLinkSq; } } @@ -1669,7 +1668,7 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { s32 sfxId; if (actor->bgCheckFlags & 0x20) { - if (actor->waterY < 20.0f) { + if (actor->yDistToWater < 20.0f) { sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; @@ -2072,9 +2071,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } else { Math_Vec3f_Copy(&actor->pos4, &actor->posRot.pos); - actor->xzDistFromLink = func_8002DB8C(actor, &player->actor); - actor->yDistFromLink = Actor_HeightDiff(actor, &player->actor); - actor->xyzDistFromLinkSq = SQ(actor->xzDistFromLink) + SQ(actor->yDistFromLink); + actor->xzDistToLink = func_8002DB8C(actor, &player->actor); + actor->yDistToLink = Actor_HeightDiff(actor, &player->actor); + actor->xyzDistToLinkSq = SQ(actor->xzDistToLink) + SQ(actor->yDistToLink); actor->yawTowardsLink = func_8002DA78(actor, &player->actor); actor->flags &= ~0x1000000; @@ -2919,10 +2918,10 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla while (actor != NULL) { if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) { - if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && (actor->xyzDistFromLinkSq < 250000.0f) && - (actor->xyzDistFromLinkSq < D_8015BBF4)) { + if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && (actor->xyzDistToLinkSq < 250000.0f) && + (actor->xyzDistToLinkSq < D_8015BBF4)) { actorCtx->targetCtx.unk_90 = actor; - D_8015BBF4 = actor->xyzDistFromLinkSq; + D_8015BBF4 = actor->xyzDistToLinkSq; } if (actor != sp84) { @@ -3468,9 +3467,9 @@ void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) { if (arg2 >= 5) { - func_800AA000(actor->xyzDistFromLinkSq, 0xFF, 0x14, 0x96); + func_800AA000(actor->xyzDistToLinkSq, 0xFF, 0x14, 0x96); } else { - func_800AA000(actor->xyzDistFromLinkSq, 0xB4, 0x14, 0x64); + func_800AA000(actor->xyzDistToLinkSq, 0xB4, 0x14, 0x64); } func_80033DB8(globalCtx, arg2, arg3); @@ -3944,7 +3943,7 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s var1 = (s16)(actor->yawTowardsLink + 0x8000) - player->actor.shape.rot.y; var2 = actor->yawTowardsLink - arg5; - if ((actor->xzDistFromLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { + if ((actor->xzDistToLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { return 1; } else { return 0; @@ -5416,11 +5415,11 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { return 0; } - if ((actor->xyzDistFromLinkSq > 25600.0f) && (actor->unk_10C == 0)) { + if ((actor->xyzDistToLinkSq > 25600.0f) && (actor->unk_10C == 0)) { return 0; } - if (actor->xyzDistFromLinkSq <= 6400.0f) { + if (actor->xyzDistToLinkSq <= 6400.0f) { if (func_8002F2CC(actor, globalCtx, 80.0f)) { actor->textId = func_80037C30(globalCtx, arg2); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index d014a176c..c9fe52f00 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -517,8 +517,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if (!((this->actor.xzDistFromLink <= 30.0f) && (this->actor.yDistFromLink >= -50.0f) && - (this->actor.yDistFromLink <= 50.0f))) { + if (!((this->actor.xzDistToLink <= 30.0f) && (this->actor.yDistToLink >= -50.0f) && + (this->actor.yDistToLink <= 50.0f))) { if (!Actor_HasParent(&this->actor, globalCtx)) { return; } |
