diff --git a/include/z64actor.h b/include/z64actor.h index 7a0377b433..083ea379ee 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -107,16 +107,15 @@ typedef struct { typedef struct Actor { /* 0x000 */ s16 id; // Actor Id /* 0x002 */ u8 type; // Actor Type. Refer to the corresponding enum for values - /* 0x003 */ s8 room; // Room number the actor is part of. FF denotes that the actor won't despawn on a room change + /* 0x003 */ s8 room; // Room number the actor is in. -1 denotes that the actor won't despawn on a room change /* 0x004 */ u32 flags; // Flags used for various purposes - /* 0x008 */ PosRot initPosRot; // Contains Initial Rotation when Object is Spawned + /* 0x008 */ PosRot initPosRot; // Initial position/rotation when spawned. Is sometimes used for other purposes /* 0x01C */ s16 params; // original name: "args_data"; Configurable variable set by an actor's spawn data /* 0x01E */ s8 objBankIndex; // original name: "bank"; Object bank index of this actor's object dependency /* 0x01F */ s8 unk_1F; - /* 0x020 */ u16 soundEffect; // Plays sound effect relative to actor's location (if within range of camera?) - /* 0x022 */ u16 unk_22; - /* 0x024 */ PosRot posRot; // Current coordinates - /* 0x038 */ PosRot posRot2; // Related to camera + /* 0x020 */ u16 sfx; // Plays sound effect relative to actor's location (if within range of camera?) + /* 0x024 */ PosRot posRot; // position/rotation in the world + /* 0x038 */ PosRot posRot2; /* 0x04C */ f32 unk_4C; /* 0x050 */ Vec3f scale; // Sets x,y,z scaling factor. Typically, a factor of 0.01 is used for each axis /* 0x05C */ Vec3f velocity; @@ -127,52 +126,42 @@ typedef struct Actor { /* 0x078 */ CollisionPoly* floorPoly; // Floor polygon an actor is over/touching /* 0x07C */ u8 wallPolySource; // Complex Poly Surface Source. 0x32 = Scene /* 0x07D */ u8 floorPolySource; // Complex Poly Surface Source. 0x32 = Scene. related to 0x80/88 - /* 0x07E */ s16 wallPolyRot; // Rotation of the wall poly - /* 0x080 */ f32 unk_80; // Floor poly height? - /* 0x084 */ f32 unk_84; + /* 0x07E */ s16 wallPolyRot; // Rotation of the wall poly an actor is touching + /* 0x080 */ f32 groundY; + /* 0x084 */ f32 waterY; /* 0x088 */ u16 bgCheckFlags; - /* 0x08A */ s16 rotTowardsLinkY; // Rotation y (give item, possibly next facing dir?/face toward link?) - /* 0x08C */ f32 waterSurfaceDist; - /* 0x090 */ f32 xzDistanceFromLink; - /* 0x094 */ f32 yDistanceFromLink; + /* 0x08A */ s16 yawTowardsLink; + /* 0x08C */ f32 xyzDistFromLinkSq; + /* 0x090 */ f32 xzDistFromLink; + /* 0x094 */ f32 yDistFromLink; /* 0x098 */ CollisionCheckInfo colChkInfo; /* 0x0B4 */ ActorShape shape; /* 0x0CC */ Vec3f unk_CC[2]; - /* 0x0E4 */ Vec3f unk_E4; // Stores result of some vector transformation involving actor xyz vector, and a matrix at Global Context + 11D60 + /* 0x0E4 */ Vec3f unk_E4; // Stores result of some vector transformation involving actor xyz vector and mf_11D60 /* 0x0F0 */ f32 unk_F0; // Related to above /* 0x0F4 */ f32 unk_F4; /* 0x0F8 */ f32 unk_F8; /* 0x0FC */ f32 unk_FC; - /* 0x100 */ Vec3f pos4; // Final Coordinates last frame (collision, NTSC 1.0 f 8002F8E0) + /* 0x100 */ Vec3f pos4; /* 0x10C */ u8 unk_10C; // Z-Target related /* 0x10D */ u8 unk_10D; // Z-Target related - /* 0x10E */ u16 textId; // Text id to pass to link/display when interacting with an actor (navi text, probably others) - /* 0x110 */ u16 freeze; // Used for the "Redead Freeze" attack. Also used in func_80059EC8 - /* 0x112 */ u16 unk_112; // Damage color effect, first 12 bits controls color which can only be blue red and white, last 4 bits unknown, can't be 0 - /* 0x114 */ u8 unk_114; // Damage color effect timer, decremented toward 0 every frame - /* 0x115 */ u8 activelyDrawn; // Indicates whether the actor is currently being drawn (but not through lens). 01 for yes, 00 for no - /* 0x116 */ u8 unk_116; // Set within a routine that deals with collision + /* 0x10E */ u16 textId; // Text id to pass to link/display when interacting with an actor + /* 0x110 */ u16 freeze; + /* 0x112 */ u16 dmgEffectParams; // Specifies damage effect color (white/red/blue) and if opaque or translucent + /* 0x114 */ u8 dmgEffectTimer; + /* 0x115 */ u8 activelyDrawn; // Indicates whether the actor is currently being drawn (but not through lens) + /* 0x116 */ u8 unk_116; /* 0x117 */ u8 naviEnemyId; // Sets what 0600 dialog to display when talking to navi. Default 0xFF - - /* 0x118 */ struct Actor* attachedA; // Interfacing Actor? - // e.g. Link holding chu, Chu instance stores ptr to Link instance here; - // Anju having Link's ptr when giving an item - // Volvagia Hole stores Volvagia Flying here - - /* 0x11C */ struct Actor* attachedB; // Attached to Actor - // e.g. Link holding chu, Link instance stores ptr to Bombchu instance here - + /* 0x118 */ struct Actor* attachedA; // Attached By? + /* 0x11C */ struct Actor* attachedB; // Attached To? /* 0x120 */ struct Actor* prev; // Previous Actor of this type /* 0x124 */ struct Actor* next; // Next Actor of this type - - /* 0x128 */ ActorFunc init; // Initialization Routine. Mandatory - /* 0x12C */ ActorFunc destroy; // Destruction Routine - /* 0x130 */ ActorFunc update; // Main Update Routine, called every frame the actor is to be updated - /* 0x134 */ ActorFunc draw; // Draw Routine, writes necessary display lists - + /* 0x128 */ ActorFunc init; // Initialization Routine. Called by Actor_Init or Actor_UpdateAll + /* 0x12C */ ActorFunc destroy; // Destruction Routine. Called by Actor_Destroy + /* 0x130 */ ActorFunc update; // Update Routine. Called by Actor_UpdateAll + /* 0x134 */ ActorFunc draw; // Draw Routine. Called by Actor_Draw /* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor /* 0x13C */ char dbgPad[0x10]; // Padding that only exists in the debug rom - /* From here on, the structure and size varies for each actor */ } Actor; // size = 0x14C typedef struct { @@ -218,6 +207,7 @@ typedef struct { } struct_80032E24; struct Player; + typedef void (*PlayerActionFunc)(struct Player*, struct GlobalContext*); typedef struct Player { diff --git a/src/code/mempak.c b/src/code/mempak.c index 0c71f8756a..b81a50125a 100644 --- a/src/code/mempak.c +++ b/src/code/mempak.c @@ -8,7 +8,8 @@ u16 sMempakCompanyCode = 1; u32 sMempakGameCode = 1; // "ZELDA DEMO TOOL " -u8 sMempakGameName[0x10] = { 0x33, 0x1E, 0x25, 0x1D, 0x1A, 0x0F, 0x1D, 0x1E, 0x26, 0x28, 0x0F, 0x2D, 0x28, 0x28, 0x25, 0x0F }; +u8 sMempakGameName[0x10] = { 0x33, 0x1E, 0x25, 0x1D, 0x1A, 0x0F, 0x1D, 0x1E, + 0x26, 0x28, 0x0F, 0x2D, 0x28, 0x28, 0x25, 0x0F }; u8 sMempakExtName[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; s32 Mempak_Init(s32 controllerNb) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index d7af214e5c..e6ea5ff888 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -19,7 +19,7 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global Gfx* dispRefs[4]; if (actor->floorPoly != NULL) { - temp1 = actor->posRot.pos.y - actor->unk_80; + temp1 = actor->posRot.pos.y - actor->groundY; if (temp1 >= -50.0f && temp1 < 500.0f) { gfxCtx = globalCtx->state.gfxCtx; @@ -40,7 +40,7 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, (u32)(actor->shape.unk_14 * temp2) & 0xFF); } - func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->unk_80, actor->posRot.pos.z, &sp60); + func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->groundY, actor->posRot.pos.z, &sp60); Matrix_Put(&sp60); if (dlist != D_04049210) { @@ -122,7 +122,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa s32 phi_s1; s32 phi_s2; - temp_f20 = actor->posRot.pos.y - actor->unk_80; + temp_f20 = actor->posRot.pos.y - actor->groundY; if (temp_f20 > 20.0f) { temp_10 = actor->shape.unk_10; @@ -839,7 +839,7 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { Actor_SetScale(actor, 0.01f); actor->unk_1F = 3; actor->minVelocityY = -20.0f; - actor->waterSurfaceDist = FLT_MAX; + actor->xyzDistFromLinkSq = FLT_MAX; actor->naviEnemyId = 0xFF; actor->unk_F4 = 1000.0f; actor->unk_F8 = 350.0f; @@ -1091,7 +1091,7 @@ void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) { s32 func_8002DFC8(Actor* actor, s16 arg1, GlobalContext* globalCtx) { Player* player = PLAYER; - s16 var = (s16)(actor->rotTowardsLinkY + 0x8000) - player->actor.shape.rot.y; + s16 var = (s16)(actor->yawTowardsLink + 0x8000) - player->actor.shape.rot.y; if (ABS(var) < arg1) { return 1; @@ -1111,7 +1111,7 @@ s32 func_8002E020(Actor* actorA, Actor* actorB, s16 arg2) { } s32 func_8002E084(Actor* actor, s16 arg1) { - s16 var = actor->rotTowardsLinkY - actor->shape.rot.y; + s16 var = actor->yawTowardsLink - actor->shape.rot.y; if (ABS(var) < arg1) { return 1; @@ -1131,10 +1131,10 @@ s32 func_8002E0D0(Actor* actorA, Actor* actorB, s16 arg2) { } s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) { - s16 var = actor->rotTowardsLinkY - actor->shape.rot.y; + s16 var = actor->yawTowardsLink - actor->shape.rot.y; if (ABS(var) < arg2) { - f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistanceFromLink) + SQ(actor->yDistanceFromLink)); + f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistFromLink) + SQ(actor->yDistFromLink)); if (xyzDistanceFromLink < arg1) { return 1; @@ -1180,14 +1180,14 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) arg2->y += 50.0f; - actor->unk_80 = func_8003CA0C(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &sp30, actor, arg2); + actor->groundY = func_8003CA0C(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &sp30, actor, arg2); actor->bgCheckFlags &= ~0x0086; - if (actor->unk_80 <= -32000.0f) { + if (actor->groundY <= -32000.0f) { return func_8002E234(actor, -32000.0f, arg3); } - sp34 = actor->unk_80 - actor->posRot.pos.y; + sp34 = actor->groundY - actor->posRot.pos.y; actor->floorPolySource = sp30; if (sp34 >= 0.0f) { @@ -1204,7 +1204,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) } } - actor->posRot.pos.y = actor->unk_80; + actor->posRot.pos.y = actor->groundY; if (actor->velocity.y <= 0.0f) { if (!(actor->bgCheckFlags & 0x1)) { @@ -1279,8 +1279,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->unk_84 = sp50 - actor->posRot.pos.y; - if (actor->unk_84 < 0.0f) { + actor->waterY = sp50 - actor->posRot.pos.y; + if (actor->waterY < 0.0f) { actor->bgCheckFlags &= ~0x60; } else { if (!(actor->bgCheckFlags & 0x20)) { @@ -1298,7 +1298,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f } } else { actor->bgCheckFlags &= ~0x60; - actor->unk_84 = -32000.0f; + actor->waterY = -32000.0f; } } } @@ -1445,14 +1445,15 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { s16 var; s16 abs_var; - var = (s16)(actor->rotTowardsLinkY - 0x8000) - arg2; + var = (s16)(actor->yawTowardsLink - 0x8000) - arg2; abs_var = ABS(var); if (player->unk_664 != NULL) { if ((abs_var > 0x4000) || (actor->flags & 0x8000000)) { return FLT_MAX; } else { - return actor->waterSurfaceDist - actor->waterSurfaceDist * 0.8f * ((0x4000 - abs_var) * 3.0517578125e-05f); + return actor->xyzDistFromLinkSq - + actor->xyzDistFromLinkSq * 0.8f * ((0x4000 - abs_var) * 3.0517578125e-05f); } } @@ -1460,7 +1461,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { return FLT_MAX; } - return actor->waterSurfaceDist; + return actor->xyzDistFromLinkSq; } #else extern f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2); @@ -1491,13 +1492,13 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { } if (!flag) { - var = (s16)(actor->rotTowardsLinkY - 0x8000) - player->actor.shape.rot.y; + var = (s16)(actor->yawTowardsLink - 0x8000) - player->actor.shape.rot.y; abs_var = ABS(var); if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { dist = FLT_MAX; } else { - dist = actor->waterSurfaceDist; + dist = actor->xyzDistFromLinkSq; } return !func_8002F090(actor, D_80115FF8[actor->unk_1F].unk_4 * dist); @@ -1521,13 +1522,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) || ((arg4 != 0) && func_8008E988(globalCtx)) || ((actor->unk_10C == 0) && - ((arg3 < fabsf(actor->yDistanceFromLink)) || (player->targetActorDistance < actor->xzDistanceFromLink) || - (arg2 < actor->xzDistanceFromLink)))) { + ((arg3 < fabsf(actor->yDistFromLink)) || (player->targetActorDistance < actor->xzDistFromLink) || + (arg2 < actor->xzDistFromLink)))) { return 0; } player->naviTargetActor = actor; - player->targetActorDistance = actor->xzDistanceFromLink; + player->targetActorDistance = actor->xzDistFromLink; player->exchangeItemId = arg4; return 1; @@ -1585,8 +1586,8 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR if ((((player->heldActor != NULL) || (actor == player->naviTargetActor)) && (getItemId > 0) && (getItemId < 0x7E)) || (!(player->stateFlags1 & 0x20000800))) { - if ((actor->xzDistanceFromLink < xzRange) && (fabsf(actor->yDistanceFromLink) < yRange)) { - var = actor->rotTowardsLinkY - player->actor.shape.rot.y; + if ((actor->xzDistFromLink < xzRange) && (fabsf(actor->yDistFromLink) < yRange)) { + var = actor->yawTowardsLink - player->actor.shape.rot.y; abs_var = ABS(var); if ((getItemId != 0) || (player->getItemDirection < abs_var)) { player->getItemId = getItemId; @@ -1634,8 +1635,8 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { Player* player = PLAYER; - if (actor->waterSurfaceDist < player->unk_6A4) { - player->unk_6A4 = actor->waterSurfaceDist; + if (actor->xyzDistFromLinkSq < player->unk_6A4) { + player->unk_6A4 = actor->xyzDistFromLinkSq; } } @@ -1704,7 +1705,7 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { s32 sfxId; if (actor->bgCheckFlags & 0x20) { - if (actor->unk_84 < 20.0f) { + if (actor->waterY < 20.0f) { sfxId = NA_SE_PL_WALK_WATER0; } else { sfxId = NA_SE_PL_WALK_WATER1; @@ -1718,37 +1719,37 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { } void func_8002F8F0(Actor* actor, u16 sfxId) { - actor->soundEffect = sfxId; + actor->sfx = sfxId; actor->flags |= 0x80000; actor->flags &= ~0x10300000; } void func_8002F91C(Actor* actor, u16 sfxId) { - actor->soundEffect = sfxId; + actor->sfx = sfxId; actor->flags |= 0x100000; actor->flags &= ~0x10280000; } void func_8002F948(Actor* actor, u16 sfxId) { - actor->soundEffect = sfxId; + actor->sfx = sfxId; actor->flags |= 0x200000; actor->flags &= ~0x10180000; } void func_8002F974(Actor* actor, u16 sfxId) { actor->flags &= ~0x10380000; - actor->soundEffect = sfxId; + actor->sfx = sfxId; } void func_8002F994(Actor* actor, s32 sfxId) { actor->flags |= 0x10000000; actor->flags &= ~0x00380000; if (sfxId < NA_SE_PL_LAND_GRASS) { - actor->soundEffect = NA_SE_PL_WALK_DIRT; + actor->sfx = NA_SE_PL_WALK_DIRT; } else if (sfxId < NA_SE_PL_DIVE_BUBBLE) { - actor->soundEffect = NA_SE_PL_WALK_CONCRETE; + actor->sfx = NA_SE_PL_WALK_CONCRETE; } else { - actor->soundEffect = NA_SE_PL_WALK_SAND; + actor->sfx = NA_SE_PL_WALK_SAND; } } @@ -2085,7 +2086,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->posRot.pos.y = -25000.0f; } - actor->soundEffect = 0; + actor->sfx = 0; if (actor->init != NULL) { if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { @@ -2111,11 +2112,11 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } else { Math_Vec3f_Copy(&actor->pos4, &actor->posRot.pos); - actor->xzDistanceFromLink = func_8002DB8C(actor, &player->actor); - actor->yDistanceFromLink = Actor_HeightDiff(actor, &player->actor); - actor->waterSurfaceDist = SQ(actor->xzDistanceFromLink) + SQ(actor->yDistanceFromLink); + actor->xzDistFromLink = func_8002DB8C(actor, &player->actor); + actor->yDistFromLink = Actor_HeightDiff(actor, &player->actor); + actor->xyzDistFromLinkSq = SQ(actor->xzDistFromLink) + SQ(actor->yDistFromLink); - actor->rotTowardsLinkY = func_8002DA78(actor, &player->actor); + actor->yawTowardsLink = func_8002DA78(actor, &player->actor); actor->flags &= ~0x1000000; if ((DECR(actor->freeze) == 0) && (actor->flags & 0x50)) { @@ -2130,8 +2131,8 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } Actor_SetObjectDependency(globalCtx, actor); - if (actor->unk_114 != 0) { - actor->unk_114--; + if (actor->dmgEffectTimer != 0) { + actor->dmgEffectTimer--; } actor->update(actor, globalCtx); func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); @@ -2226,28 +2227,28 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); gSPSegment(gfxCtx->polyXlu.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - if (actor->unk_114 != 0) { + if (actor->dmgEffectTimer != 0) { // Must be inline data to match Color_RGBA8 sp2C = { 0x00, 0x00, 0x00, 0xFF }; - if (actor->unk_112 & 0x8000) { - sp2C.r = sp2C.g = sp2C.b = ((actor->unk_112 & 0x1F00) >> 5) | 7; - } else if (actor->unk_112 & 0x4000) { - sp2C.r = ((actor->unk_112 & 0x1F00) >> 5) | 7; + if (actor->dmgEffectParams & 0x8000) { + sp2C.r = sp2C.g = sp2C.b = ((actor->dmgEffectParams & 0x1F00) >> 5) | 7; + } else if (actor->dmgEffectParams & 0x4000) { + sp2C.r = ((actor->dmgEffectParams & 0x1F00) >> 5) | 7; } else { - sp2C.b = ((actor->unk_112 & 0x1F00) >> 5) | 7; + sp2C.b = ((actor->dmgEffectParams & 0x1F00) >> 5) | 7; } - if (actor->unk_112 & 0x2000) { - func_80026860(globalCtx, &sp2C, actor->unk_114, actor->unk_112 & 0xFF); + if (actor->dmgEffectParams & 0x2000) { + func_80026860(globalCtx, &sp2C, actor->dmgEffectTimer, actor->dmgEffectParams & 0xFF); } else { - func_80026400(globalCtx, &sp2C, actor->unk_114, actor->unk_112 & 0xFF); + func_80026400(globalCtx, &sp2C, actor->dmgEffectTimer, actor->dmgEffectParams & 0xFF); } } actor->draw(actor, globalCtx); - if (actor->unk_114 != 0) { - if (actor->unk_112 & 0x2000) { + if (actor->dmgEffectTimer != 0) { + if (actor->dmgEffectParams & 0x2000) { func_80026A6C(globalCtx); } else { func_80026608(globalCtx); @@ -2265,15 +2266,15 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { void func_80030ED8(Actor* actor) { if (actor->flags & 0x80000) { - Audio_PlaySoundGeneral(actor->soundEffect, &actor->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(actor->sfx, &actor->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else if (actor->flags & 0x100000) { - func_80078884(actor->soundEffect); + func_80078884(actor->sfx); } else if (actor->flags & 0x200000) { - func_800788CC(actor->soundEffect); + func_800788CC(actor->sfx); } else if (actor->flags & 0x10000000) { - func_800F4C58(&D_801333D4, 0x2021, (s8)(actor->soundEffect - 1)); + func_800F4C58(&D_801333D4, 0x2021, (s8)(actor->sfx - 1)); } else { - func_80078914(&actor->unk_E4, actor->soundEffect); + func_80078914(&actor->unk_E4, actor->sfx); } } @@ -2421,7 +2422,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { - if (actor->soundEffect != 0) { + if (actor->sfx != 0) { func_80030ED8(actor); } } @@ -2968,10 +2969,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->waterSurfaceDist < 250000.0f) && - (actor->waterSurfaceDist < D_8015BBF4)) { + if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && (actor->xyzDistFromLinkSq < 250000.0f) && + (actor->xyzDistFromLinkSq < D_8015BBF4)) { actorCtx->targetCtx.unk_90 = actor; - D_8015BBF4 = actor->waterSurfaceDist; + D_8015BBF4 = actor->xyzDistFromLinkSq; } if (actor != sp84) { @@ -3199,7 +3200,7 @@ void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3 s32 i; var = (Math_Rand_ZeroOne() - 0.5f) * 6.28f; - sp9C.y = actor->unk_80; + sp9C.y = actor->groundY; sp84.y += (Math_Rand_ZeroOne() - 0.5f) * 0.2f; for (i = arg4; i >= 0; i--) { @@ -3517,9 +3518,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->waterSurfaceDist, 0xFF, 0x14, 0x96); + func_800AA000(actor->xyzDistFromLinkSq, 0xFF, 0x14, 0x96); } else { - func_800AA000(actor->waterSurfaceDist, 0xB4, 0x14, 0x64); + func_800AA000(actor->xyzDistFromLinkSq, 0xB4, 0x14, 0x64); } func_80033DB8(globalCtx, arg2, arg3); @@ -3613,8 +3614,8 @@ void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { Audio_PlayActorSound2(actor, NA_SE_EN_LIGHT_ARROW_HIT); } - actor->unk_112 = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4; - actor->unk_114 = arg4; + actor->dmgEffectParams = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4; + actor->dmgEffectTimer = arg4; } Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) { @@ -4004,11 +4005,10 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s s16 var1; s16 var2; - var1 = (s16)(actor->rotTowardsLinkY + 0x8000) - player->actor.shape.rot.y; - var2 = actor->rotTowardsLinkY - arg5; + var1 = (s16)(actor->yawTowardsLink + 0x8000) - player->actor.shape.rot.y; + var2 = actor->yawTowardsLink - arg5; - if ((actor->xzDistanceFromLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && - (arg3 >= ABS(var2))) { + if ((actor->xzDistFromLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { return 1; } else { return 0; @@ -5473,18 +5473,18 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { return 0; } - var = actor->rotTowardsLinkY - actor->shape.rot.y; + var = actor->yawTowardsLink - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { return 0; } - if ((actor->waterSurfaceDist > 25600.0f) && (actor->unk_10C == 0)) { + if ((actor->xyzDistFromLinkSq > 25600.0f) && (actor->unk_10C == 0)) { return 0; } - if (actor->waterSurfaceDist <= 6400.0f) { + if (actor->xyzDistFromLinkSq <= 6400.0f) { if (func_8002F2CC(actor, globalCtx, 80.0f)) { actor->textId = func_80037C30(globalCtx, arg2); } @@ -5540,7 +5540,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->posRot2.pos.y += arg4; if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE))) { - var = actor->rotTowardsLinkY - actor->shape.rot.y; + var = actor->yawTowardsLink - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); @@ -5569,7 +5569,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->posRot2.pos = arg4; if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entranceIndex == 0x00EE))) { - var = actor->rotTowardsLinkY - actor->shape.rot.y; + var = actor->yawTowardsLink - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 3d2a6b1fe2..e6f3e3d6a4 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -213,7 +213,7 @@ void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) { s16 var; if (this->dyna.actor.textId != 0) { - var = this->dyna.actor.rotTowardsLinkY - this->dyna.actor.shape.rot.y; + var = this->dyna.actor.yawTowardsLink - this->dyna.actor.shape.rot.y; if ((ABS(var) < 0x2800) || ((this->dyna.actor.params == 0xA) && (ABS(var) > 0x5800))) { if (func_8002F194(&this->dyna.actor, globalCtx)) { EnAObj_SetupAction(this, func_8001D204); @@ -238,13 +238,13 @@ void func_8001D360(EnAObj* this, GlobalContext* globalCtx) { this->unk_16E++; this->unk_170 = 20; - if ((s16)(this->dyna.actor.rotTowardsLinkY + 0x4000) < 0) { + if ((s16)(this->dyna.actor.yawTowardsLink + 0x4000) < 0) { this->unk_174 = -1000; } else { this->unk_174 = 1000; } - if (this->dyna.actor.rotTowardsLinkY < 0) { + if (this->dyna.actor.yawTowardsLink < 0) { this->unk_172 = -this->unk_174; } else { this->unk_172 = this->unk_174; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 54f7bfe5f4..7e9606d402 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -413,9 +413,9 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } this->actor.initPosRot.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f); this->actor.posRot.pos.x += - Math_Coss(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); + Math_Coss(this->actor.yawTowardsLink) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); this->actor.posRot.pos.z += - Math_Sins(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); + Math_Sins(this->actor.yawTowardsLink) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); } } @@ -539,7 +539,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (sp3A || D_80157D94) { func_8002E4B4(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); - if (this->actor.unk_80 <= -10000.0f) { + if (this->actor.groundY <= -10000.0f) { Actor_Kill(&this->actor); return; } @@ -564,8 +564,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if (!((this->actor.xzDistanceFromLink <= 30.0f) && (this->actor.yDistanceFromLink >= -50.0f) && - (this->actor.yDistanceFromLink <= 50.0f))) { + if (!((this->actor.xzDistFromLink <= 30.0f) && (this->actor.yDistFromLink >= -50.0f) && + (this->actor.yDistFromLink <= 50.0f))) { if (!func_8002F410(&this->actor, globalCtx)) { return; } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index ad81bbbfd2..71721b63c7 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -225,7 +225,7 @@ void func_8008EDF0(Player* player) { void func_8008EE08(Player* player) { if ((player->actor.bgCheckFlags & 1) || (player->stateFlags1 & 0x8A00000) || - ((player->stateFlags1 & 0xC0000) == 0 && (player->actor.posRot.pos.y - player->actor.unk_80) < 100.0f)) { + ((player->stateFlags1 & 0xC0000) == 0 && (player->actor.posRot.pos.y - player->actor.groundY) < 100.0f)) { player->stateFlags1 &= 0xBFF07FFF; } else if ((player->stateFlags1 & 0x2C0000) == 0) { player->stateFlags1 |= 0x80000; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 2fbf15fab3..1b49acf281 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -167,7 +167,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { Player* player = PLAYER; if (BgBdanObjects_GetContactRu1(this, 0)) { - if (this->dyna.actor.xzDistanceFromLink < 250.0f) { + if (this->dyna.actor.xzDistFromLink < 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.xzDistanceFromLink < 120.0f) { + if (this->dyna.actor.xzDistFromLink < 120.0f) { this->actionFunc = func_8086C7D0; func_800800F8(globalCtx, 0xC12, -0x63, &this->dyna.actor, 0); } diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 159c6eb84c..fdf5e67213 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -260,7 +260,7 @@ void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) { if (this->unk_1C8 <= 0.1f) { func_8086D730(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); + func_800AA000(this->actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA); } } } @@ -322,7 +322,7 @@ void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) { if (this->unk_1C8 <= 0.6f) { func_8086D9F8(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); + func_800AA000(this->actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA); } } @@ -337,7 +337,7 @@ void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) { if (this->unk_1C8 <= 0.1f) { func_8086DB24(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); - func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); + func_800AA000(this->actor.xyzDistFromLinkSq, 0x78, 0x14, 0xA); } } } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index d2232ef1fe..934fd1c059 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -140,8 +140,8 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { } sp5C.x += 80.0f + Math_Rand_ZeroOne() * 10.0f; sp50.x -= 80.0f + Math_Rand_ZeroOne() * 10.0f; - sp5C.y = this->dyna.actor.unk_80 + 20.0f + Math_Rand_ZeroOne(); - sp50.y = this->dyna.actor.unk_80 + 20.0f + Math_Rand_ZeroOne(); + sp5C.y = this->dyna.actor.groundY + 20.0f + Math_Rand_ZeroOne(); + sp50.y = this->dyna.actor.groundY + 20.0f + Math_Rand_ZeroOne(); func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1); func_80033480(globalCtx, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1); @@ -155,7 +155,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { sp5C = this->dyna.actor.posRot.pos; sp5C.z += 560.0f + Math_Rand_ZeroOne() * 5.0f; sp5C.x += (Math_Rand_ZeroOne() - 0.5f) * 160.0f; - sp5C.y = Math_Rand_ZeroOne() * 3.0f + (this->dyna.actor.unk_80 + 20.0f); + sp5C.y = Math_Rand_ZeroOne() * 3.0f + (this->dyna.actor.groundY + 20.0f); func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1); func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908); diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 929526cb9d..6c0b8ffae8 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -117,8 +117,8 @@ void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->velocity.y = 0.5f; } - thisx->unk_80 = thisx->initPosRot.pos.y - 225.0f; - this->unk_16A = (thisx->unk_80 + 50.0f) - 25.0f; + thisx->groundY = thisx->initPosRot.pos.y - 225.0f; + this->unk_16A = (thisx->groundY + 50.0f) - 25.0f; this->colliderCylinder.dim.radius = 10; this->colliderCylinder.dim.height = 40; @@ -335,7 +335,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { vector.y = (this->dyna.actor.posRot.pos.y + 1.0f) + 25.0f; vector.z = this->dyna.actor.posRot.pos.z; - tempf20 = this->dyna.actor.unk_80; + tempf20 = this->dyna.actor.groundY; for (i = 0; i < 3; i++) { temp = diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 9c193a38e3..218de660d0 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -79,8 +79,8 @@ void func_808933BC(BgJyaAmishutter* this) { } void func_808933CC(BgJyaAmishutter* this) { - if (this->actor.xzDistanceFromLink < 60.0f) { - if (fabsf(this->actor.yDistanceFromLink) < 30.0f) { + if (this->actor.xzDistFromLink < 60.0f) { + if (fabsf(this->actor.yDistFromLink) < 30.0f) { func_80893428(this); } } @@ -104,7 +104,7 @@ void func_808934B0(BgJyaAmishutter* this) { } void func_808934C0(BgJyaAmishutter* this) { - if (this->actor.xzDistanceFromLink > 300.0f) { + if (this->actor.xzDistFromLink > 300.0f) { func_808934FC(this); } } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 1d6b2cf304..99ef9cc3dd 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -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.waterSurfaceDist < 40000.0f && Flags_GetEnv(globalCtx, 5)) { + if (this->actor.xyzDistFromLinkSq < 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 (!func_8008E988(globalCtx) && !(player->stateFlags1 & 0x8800000) && - this->actor.xzDistanceFromLink <= 15.0f && -50.0f <= this->actor.yDistanceFromLink && - this->actor.yDistanceFromLink <= 15.0f) { + this->actor.xzDistFromLink <= 15.0f && -50.0f <= this->actor.yDistFromLink && + this->actor.yDistFromLink <= 15.0f) { player->stateFlags1 |= 0x80000000; this->actor.unk_1F = 1; } else { @@ -145,10 +145,10 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { Player* player; - if (this->actor.yDistanceFromLink <= 0.0f && 15.0f < this->actor.xzDistanceFromLink) { + if (this->actor.yDistFromLink <= 0.0f && 15.0f < this->actor.xzDistFromLink) { player = PLAYER; - player->actor.posRot.pos.x = Math_Sins(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.x; - player->actor.posRot.pos.z = Math_Coss(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.z; + 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; } } diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 732a3fb8fb..f9653468da 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -151,7 +151,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { // "...all I can do is look at Death Mountain." } - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; if (func_8002F194(&this->actor, globalCtx) != 0) { if (this->actor.textId == 0x5056) { // "To get a good view..." EnAni_SetupAction(this, func_809B04F0); @@ -160,14 +160,14 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { } else { EnAni_SetupAction(this, func_809B04F0); } - } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistanceFromLink < 150.0f && - -80.0f < this->actor.yDistanceFromLink) { + } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistFromLink < 150.0f && + -80.0f < this->actor.yDistFromLink) { 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.xzDistanceFromLink < 350.0f) { + } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistFromLink < 350.0f) { EnAni_SetText(this, globalCtx, textId); } } @@ -177,7 +177,7 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { s16 yawDiff; u16 textId; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; if (func_8002F194(&this->actor, globalCtx) != 0) { if (this->actor.textId == 0x5056) { // "To get a good view..." EnAni_SetupAction(this, func_809B0524); @@ -186,14 +186,14 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) { } else { EnAni_SetupAction(this, func_809B0524); } - } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistanceFromLink < 150.0f && - -80.0f < this->actor.yDistanceFromLink) { + } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistFromLink < 150.0f && + -80.0f < this->actor.yDistFromLink) { 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.xzDistanceFromLink < 350.0f) { + } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistFromLink < 350.0f) { if ((gSaveContext.eventChkInf[2] & 0x8000) == 0) { textId = 0x5052; // "...Something is happening on Death Mountain!" } else { diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 2a30d4b3f5..7a2a267ff9 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -53,7 +53,7 @@ void EnAnubiceTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { this->anubis = Actor_SpawnAttached(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, this->actor.posRot.pos.x, - this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, this->actor.rotTowardsLinkY, 0, 0); + this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, this->actor.yawTowardsLink, 0, 0); if (this->anubis != NULL) { this->actionFunc = EnAnubiceTag_ManageAnubis; @@ -79,12 +79,12 @@ void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { return; } - if (this->actor.xzDistanceFromLink < (200.0f + this->triggerRange)) { + if (this->actor.xzDistFromLink < (200.0f + this->triggerRange)) { if (anubis->unk_260 == 0) { if (anubis->unk_262 == 0) { anubis->unk_25E = 1; - offset.x = -Math_Sins(this->actor.rotTowardsLinkY) * this->actor.xzDistanceFromLink; - offset.z = -Math_Coss(this->actor.rotTowardsLinkY) * this->actor.xzDistanceFromLink; + offset.x = -Math_Sins(this->actor.yawTowardsLink) * this->actor.xzDistFromLink; + offset.z = -Math_Coss(this->actor.yawTowardsLink) * this->actor.xzDistFromLink; Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.x, (this->actor.posRot.pos.x + offset.x), 0.3f, 10.0f); Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.z, (this->actor.posRot.pos.z + offset.z), 0.3f, 10.0f); return; diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index a6cfcb2dfa..1ff245b0ed 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -41,7 +41,7 @@ void EnArowTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) { EnArowTrap* this = THIS; - if (this->actor.xzDistanceFromLink <= 400) { + if (this->actor.xzDistFromLink <= 400) { this->attackTimer--; if (this->attackTimer == 0) { diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 95b2abb344..c025fa487d 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -163,7 +163,7 @@ void func_809DF494(EnCow* this, GlobalContext* globalCtx) { SkelAnime_GetFrameCount(&D_060001CC.genericHeader), 2, 1.0f); } - if ((this->actor.xzDistanceFromLink < 150.0f) && (!(this->unk_276 & 2))) { + if ((this->actor.xzDistFromLink < 150.0f) && (!(this->unk_276 & 2))) { this->unk_276 |= 2; if (this->skelAnime.animCurrentSeg == &D_060001CC) { this->unk_278 = 0; @@ -252,8 +252,8 @@ void func_809DF96C(EnCow* this, GlobalContext* globalCtx) { this->unk_276 &= ~0x4; DREG(53) = 0; } else { - if ((this->actor.xzDistanceFromLink < 150.0f) && - (ABS((s16)(this->actor.rotTowardsLinkY - this->actor.shape.rot.y)) < 0x61A8)) { + if ((this->actor.xzDistFromLink < 150.0f) && + (ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) < 0x61A8)) { DREG(53) = 0; this->actionFunc = func_809DF8FC; this->actor.flags |= 0x10000; @@ -279,8 +279,8 @@ void func_809DFA84(EnCow* this, GlobalContext* globalCtx) { SkelAnime_GetFrameCount(&D_06004348.genericHeader), 2, 1.0f); } - if ((this->actor.xzDistanceFromLink < 150.0f) && - (ABS((s16)(this->actor.rotTowardsLinkY - this->actor.shape.rot.y)) >= 0x61A9) && (!(this->unk_276 & 2))) { + if ((this->actor.xzDistFromLink < 150.0f) && + (ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) >= 0x61A9) && (!(this->unk_276 & 2))) { this->unk_276 |= 2; if (this->skelAnime.animCurrentSeg == &D_06004348) { this->unk_278 = 0; @@ -311,7 +311,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx) { } } this->actionFunc(this, globalCtx); - if ((thisx->xzDistanceFromLink < 150.0f) && + if ((thisx->xzDistFromLink < 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; diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index a27ea54789..92cc4177c9 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -140,7 +140,7 @@ void func_809ECA50(EnDha* this, GlobalContext* globalCtx) { } else { playerPos.y += 56.0f; } - if (this->actor.xzDistanceFromLink <= 100.0f) { + if (this->actor.xzDistFromLink <= 100.0f) { this->unk_1D0.y = 0; this->unk_1D0.z = this->unk_1D0.y; this->unk_1D6.x = this->unk_1D0.y; diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 50847b16f9..c4f5925147 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -351,16 +351,16 @@ void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) { return; } - if (this->actor.xzDistanceFromLink > 400.0f) { + if (this->actor.xzDistFromLink > 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.xzDistanceFromLink > 100.0f) { + } else if (this->actor.xzDistFromLink > 100.0f) { this->nextBehavior = DOG_RUN; speed = 4.0f; - } else if (this->actor.xzDistanceFromLink < 40.0f) { + } else if (this->actor.xzDistFromLink < 40.0f) { if (this->nextBehavior != DOG_BOW && this->nextBehavior != DOG_BOW_2) { this->nextBehavior = DOG_BOW; } @@ -372,16 +372,16 @@ void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) { Math_SmoothScaleMaxF(&this->actor.speedXZ, speed, 0.6f, 1.0f); - if (!(this->actor.xzDistanceFromLink > 400.0f)) { - Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY, 10, 1000, 1); + if (!(this->actor.xzDistFromLink > 400.0f)) { + Math_SmoothScaleMaxMinS(&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.xzDistanceFromLink < 200.0f) { + if (this->actor.xzDistFromLink < 200.0f) { Math_SmoothScaleMaxF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f); - Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, (this->actor.rotTowardsLinkY ^ 0x8000), 10, 1000, 1); + Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, (this->actor.yawTowardsLink ^ 0x8000), 10, 1000, 1); } else { this->actionFunc = EnDog_FaceLink; } @@ -394,12 +394,12 @@ 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.xzDistanceFromLink) { + if (200.0f <= this->actor.xzDistFromLink) { this->nextBehavior = DOG_WALK; Math_SmoothScaleMaxF(&this->actor.speedXZ, 1.0f, 0.6f, 1.0f); - rotTowardLink = this->actor.rotTowardsLinkY; + rotTowardLink = this->actor.yawTowardsLink; prevRotY = this->actor.posRot.rot.y; Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, rotTowardLink, 10, 1000, 1); @@ -419,10 +419,10 @@ void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { } void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { - this->unusedAngle = (this->actor.rotTowardsLinkY - this->actor.shape.rot.y); + 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.xzDistanceFromLink < 200.0f)) { + if ((gSaveContext.dogParams != 0) && (this->actor.xzDistFromLink < 200.0f)) { this->nextBehavior = DOG_RUN; this->actionFunc = EnDog_RunAway; } diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 1355933ed4..c9c3551ea2 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -225,10 +225,10 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { this->actionFunc = EnDs_Talk; } } else { - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; this->actor.textId = 0x5048; - if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistanceFromLink < 200.0f)) { + if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistFromLink < 200.0f)) { func_8002F298(this, globalCtx, 100.0f, 8); this->unk_1E8 |= 1; } diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index f7ed2d8789..87d633843c 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -347,10 +347,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.yDistanceFromLink, 20.0f, 30.0f); + yDelta = CLAMP(-this->actor.yDistFromLink, 20.0f, 30.0f); xzDelta = -10.0f; } else { - yDelta = CLAMP(-this->actor.yDistanceFromLink, 25.0f, 45.0f); + yDelta = CLAMP(-this->actor.yDistFromLink, 25.0f, 45.0f); xzDelta = -70.0f; } this->actor.posRot.pos.y = player->actor.posRot.pos.y + yDelta; @@ -424,7 +424,7 @@ void EnFloormas_SetupFreeze(EnFloormas* this) { void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { if (this->actor.scale.x > 0.004f) { // split - this->actor.shape.rot.y = this->actor.rotTowardsLinkY + 0x8000; + this->actor.shape.rot.y = this->actor.yawTowardsLink + 0x8000; EnFloormas_SetupSplit((EnFloormas*)this->actor.attachedB); EnFloormas_SetupSplit((EnFloormas*)this->actor.attachedA); EnFloormas_SetupSplit(this); @@ -439,11 +439,11 @@ void EnFloormas_Die(EnFloormas* this, GlobalContext* globalCtx) { void EnFloormas_BigDecideAction(EnFloormas* this, GlobalContext* globalCtx) { if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { // within 400 units of link and within 90 degrees rotation of him - if (this->actor.xzDistanceFromLink < 400.0f && !func_8002E084(&this->actor, 0x4000)) { - this->actionTarget = this->actor.rotTowardsLinkY; + if (this->actor.xzDistFromLink < 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.xzDistanceFromLink < 280.0f && func_8002E084(&this->actor, 0x2000)) { + } else if (this->actor.xzDistFromLink < 280.0f && func_8002E084(&this->actor, 0x2000)) { EnFloormas_SetupHover(this, globalCtx); } else { EnFloormas_SetupStand(this); @@ -478,15 +478,15 @@ void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK); } - if ((this->actor.xzDistanceFromLink < 320.0f) && (func_8002E084(&this->actor, 0x4000))) { + if ((this->actor.xzDistFromLink < 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.xzDistanceFromLink < 400.0f) && !func_8002E084(&this->actor, 0x4000)) { + } else if ((this->actor.xzDistFromLink < 400.0f) && !func_8002E084(&this->actor, 0x4000)) { // set target rotation to link. - this->actionTarget = this->actor.rotTowardsLinkY; + this->actionTarget = this->actor.yawTowardsLink; EnFloormas_SetupTurn(this); } else if (this->actionTimer == 0) { EnFloormas_SetupBigStopWalk(this); @@ -507,12 +507,12 @@ void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK); } - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 3, 0x71C); + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 0x71C); - if ((this->actor.xzDistanceFromLink < 280.0f) && func_8002E084(&this->actor, 0x2000) && + if ((this->actor.xzDistFromLink < 280.0f) && func_8002E084(&this->actor, 0x2000) && !(this->actor.bgCheckFlags & 8)) { EnFloormas_SetupHover(this, globalCtx); - } else if (this->actor.xzDistanceFromLink > 400.0f) { + } else if (this->actor.xzDistFromLink > 400.0f) { EnFloormas_SetupBigWalk(this); } } @@ -553,7 +553,7 @@ void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) { } this->actor.shape.rot.x += 0x140; this->actor.posRot.pos.y += 10.0f; - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 3, 2730); + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 2730); Math_ApproxS(&this->zOffset, 1200, 100); } @@ -563,7 +563,7 @@ void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) { pos.x = this->actor.posRot.pos.x; pos.z = this->actor.posRot.pos.z; - pos.y = this->actor.unk_80; + pos.y = this->actor.groundY; pos2.y = 2.0f; pos2.x = Math_Sins(this->actor.shape.rot.y + 0x6000) * 7.0f; @@ -591,9 +591,9 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { Math_ApproxF(&this->actor.speedXZ, 15.0f, SQ(this->actor.speedXZ) * (1.0f / 3.0f)); Math_ApproxUpdateScaledS(&this->actor.shape.rot.x, -0x1680, 0x140); - distFromGround = this->actor.posRot.pos.y - this->actor.unk_80; + distFromGround = this->actor.posRot.pos.y - this->actor.groundY; if (distFromGround < 10.0f) { - this->actor.posRot.pos.y = this->actor.unk_80 + 10.0f; + this->actor.posRot.pos.y = this->actor.groundY + 10.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } @@ -632,7 +632,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { Math_ApproxF(&this->actor.speedXZ, 0.0f, 2.0f); } - if ((this->actor.speedXZ > 0.0f) && ((this->actor.posRot.pos.y - this->actor.unk_80) < 12.0f)) { + if ((this->actor.speedXZ > 0.0f) && ((this->actor.posRot.pos.y - this->actor.groundY) < 12.0f)) { EnFloormas_Slide(this, globalCtx); } @@ -685,8 +685,8 @@ 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.xzDistanceFromLink < 120.0f) { - Math_ApproxUpdateScaledS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY + 0x8000, 0x38E); + } else if (this->actor.xzDistFromLink < 120.0f) { + Math_ApproxUpdateScaledS(&this->actor.shape.rot.y, this->actor.yawTowardsLink + 0x8000, 0x38E); } } @@ -720,8 +720,8 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_SetupSlaveJumpAtMaster(this); } } else { - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 3, 0x71C); - if (this->actor.xzDistanceFromLink < 80.0f) { + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 3, 0x71C); + if (this->actor.xzDistFromLink < 80.0f) { EnFloormas_SetupJumpAtLink(this); } } @@ -740,7 +740,7 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); if (this->skelAnime.animCurrentFrame < 20.0f) { - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 2, 0xE38); + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38); } else if (func_800A56C8(&this->skelAnime, 20.0f)) { this->actor.speedXZ = 5.0f; this->actor.velocity.y = 7.0f; @@ -749,7 +749,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.yDistanceFromLink < -10.0f) && this->collider.base.maskA & 2 && + } else if ((this->actor.yDistFromLink < -10.0f) && this->collider.base.maskA & 2 && (&player->actor == this->collider.base.oc)) { globalCtx->unk_11D4C(globalCtx, player); EnFloormas_SetupGrabLink(this, player); @@ -776,10 +776,10 @@ void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { } if (LINK_IS_CHILD) { - yDelta = CLAMP(-this->actor.yDistanceFromLink, 20.0f, 30.0f); + yDelta = CLAMP(-this->actor.yDistFromLink, 20.0f, 30.0f); xzDelta = -10.0f; } else { - yDelta = CLAMP(-this->actor.yDistanceFromLink, 25.0f, 45.0f); + yDelta = CLAMP(-this->actor.yDistFromLink, 25.0f, 45.0f); xzDelta = -30.0f; } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 1dfb17d72b..d75156c715 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -110,9 +110,9 @@ s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFu return true; } this->actor.textId = textID; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; - if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistanceFromLink < 100.0f)) { + if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistFromLink < 100.0f)) { func_8002F2CC(&this->actor, globalCtx, 100.0f); } else { this->behaviorFlags |= FU_RESET_LOOK_ANGLE; @@ -217,7 +217,7 @@ void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) { static s16 yawDiff; Player* player = PLAYER; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; if ((gSaveContext.eventChkInf[5] & 0x800)) { func_80A1D94C(this, globalCtx, 0x508E, func_80A1DBA0); } else if (player->stateFlags2 & 0x1000000) { @@ -228,7 +228,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.xzDistanceFromLink < 100.0f) { + if (this->actor.xzDistFromLink < 100.0f) { this->actor.textId = 0x5034; func_8002F2CC(&this->actor, globalCtx, 100.0f); player->stateFlags2 |= 0x800000; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 294eda2d9c..700221781a 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -132,7 +132,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.xzDistanceFromLink < 100.0f) { + } else if (this->actor.xzDistFromLink < 100.0f) { func_8002F2CC(&this->actor, globalCtx, 100.0f); } } diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 6845c80007..a1c6c9a8c7 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -405,9 +405,9 @@ void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { player->actor.textId = 0x200F; // "I don't want that!" } } else { - yawDiffTemp = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiffTemp = this->actor.yawTowardsLink - this->actor.shape.rot.y; yawDiff = ABS(yawDiffTemp); - if (!(120.0f < this->actor.xzDistanceFromLink) && (yawDiff < 0x4300)) { + if (!(120.0f < this->actor.xzDistFromLink) && (yawDiff < 0x4300)) { func_8002F298(&this->actor, globalCtx, 100.0f, 1); } } @@ -653,7 +653,7 @@ void func_80A5455C(EnHeishi2* this, GlobalContext* globalCtx) { pos.x = Math_Rand_CenteredFloat(20.0f) + this->unk_274.x; pos.y = Math_Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f); pos.z = Math_Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f); - rotY = Math_Rand_CenteredFloat(7000.0f) + thisx->rotTowardsLinkY; + rotY = Math_Rand_CenteredFloat(7000.0f) + thisx->yawTowardsLink; bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); if (bomb != NULL) { bomb->actor.speedXZ = Math_Rand_CenteredFloat(5.0f) + 10.0f; @@ -733,8 +733,8 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) { } if (((this->initParams != 2) && (this->initParams != 5)) || - ((yawDiff = ABS((s16)(this->actor.rotTowardsLinkY - this->actor.shape.rot.y)), - !(this->actor.xzDistanceFromLink > 120.0f)) && + ((yawDiff = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)), + !(this->actor.xzDistFromLink > 120.0f)) && (yawDiff < 0x4300))) { func_8002F2F4(&this->actor, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 978c9fb1a6..bb93d38ee5 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -102,7 +102,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) player = PLAYER; SkelAnime_FrameUpdateMatrix(&this->skelAnime); - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; yawDiffNew = ABS(yawDiff); if (yawDiffNew < 0x4300) { if (gSaveContext.nightFlag == 0) { @@ -117,7 +117,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) sightRange = 100.0f; } } - if ((this->actor.xzDistanceFromLink < sightRange) && + if ((this->actor.xzDistFromLink < 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!" @@ -174,7 +174,7 @@ void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { this->actionFunc = EnHeishi3_ResetAnimationToIdle; this->actor.speedXZ = 0.0f; } else { - Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY, 5, 3000, 0); + Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink, 5, 3000, 0); } } diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index aeaa0eb99d..6a944e9a5b 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -209,7 +209,7 @@ void EnHintnuts_SetupFreeze(EnHintnuts* this) { SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060029BC); this->actor.flags &= ~1; func_8003426C(&this->actor, 0, 0xFF, 0, 100); - this->actor.unk_114 = 1; + this->actor.dmgEffectTimer = 1; this->animFlagAndTimer = 0; Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_FAINT); if (sPuzzleCounter == -3) { @@ -247,20 +247,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.xzDistanceFromLink < 120.0f)) { + if (!hasSlowPlaybackSpeed && (this->actor.xzDistFromLink < 120.0f)) { EnHintnuts_SetupBurrow(this); } else if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { - if (this->actor.xzDistanceFromLink < 120.0f) { + if (this->actor.xzDistFromLink < 120.0f) { EnHintnuts_SetupBurrow(this); - } else if ((this->animFlagAndTimer == 0) && (320.0f < this->actor.xzDistanceFromLink)) { + } else if ((this->animFlagAndTimer == 0) && (320.0f < this->actor.xzDistFromLink)) { EnHintnuts_SetupLookAround(this); } else { EnHintnuts_SetupStand(this); } } - if (hasSlowPlaybackSpeed && 160.0f < this->actor.xzDistanceFromLink && - fabsf(this->actor.yDistanceFromLink) < 120.0f && - ((this->animFlagAndTimer == 0) || (this->actor.xzDistanceFromLink < 480.0f))) { + if (hasSlowPlaybackSpeed && 160.0f < this->actor.xzDistFromLink && fabsf(this->actor.yDistFromLink) < 120.0f && + ((this->animFlagAndTimer == 0) || (this->actor.xzDistFromLink < 480.0f))) { this->skelAnime.animPlaybackSpeed = 1.0f; } } @@ -270,7 +269,7 @@ void EnHintnuts_LookAround(EnHintnuts* this, GlobalContext* globalCtx) { if (func_800A56C8(&this->skelAnime, 0.0f) != 0 && this->animFlagAndTimer != 0) { this->animFlagAndTimer--; } - if ((this->actor.xzDistanceFromLink < 120.0f) || (this->animFlagAndTimer == 0)) { + if ((this->actor.xzDistFromLink < 120.0f) || (this->animFlagAndTimer == 0)) { EnHintnuts_SetupBurrow(this); } } @@ -281,9 +280,9 @@ void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { this->animFlagAndTimer--; } if (!(this->animFlagAndTimer & 0x1000)) { - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 2, 0xE38); + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38); } - if (this->actor.xzDistanceFromLink < 120.0f || this->animFlagAndTimer == 0x1000) { + if (this->actor.xzDistFromLink < 120.0f || this->animFlagAndTimer == 0x1000) { EnHintnuts_SetupBurrow(this); } else if (this->animFlagAndTimer == 0) { EnHintnuts_SetupThrowScrubProjectile(this); @@ -293,8 +292,8 @@ void EnHintnuts_Stand(EnHintnuts* this, GlobalContext* globalCtx) { void EnHintnuts_ThrowNut(EnHintnuts* this, GlobalContext* globalCtx) { Vec3f nutPos; - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 2, 0xE38); - if (this->actor.xzDistanceFromLink < 120.0f) { + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38); + if (this->actor.xzDistFromLink < 120.0f) { EnHintnuts_SetupBurrow(this); } else if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnHintnuts_SetupStand(this); @@ -330,10 +329,10 @@ void EnHintnuts_Burrow(EnHintnuts* this, GlobalContext* globalCtx) { void EnHintnuts_BeginRun(EnHintnuts* this, GlobalContext* globalCtx) { if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { - this->unk_196 = this->actor.rotTowardsLinkY + 0x8000; + this->unk_196 = this->actor.yawTowardsLink + 0x8000; EnHintnuts_SetupRun(this); } - Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 2, 0xE38); + Math_SmoothScaleMaxS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 2, 0xE38); } void EnHintnuts_BeginFreeze(EnHintnuts* this, GlobalContext* globalCtx) { @@ -349,7 +348,7 @@ void EnHintnuts_CheckProximity(EnHintnuts* this, GlobalContext* globalCtx) { } else { this->actor.flags &= ~0x10000; } - if (this->actor.xzDistanceFromLink < 130.0f) { + if (this->actor.xzDistFromLink < 130.0f) { this->actor.textId = this->textIdCopy; func_8002F2F4(&this->actor, globalCtx); } @@ -379,15 +378,15 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { this->unk_196 = this->actor.wallPolyRot; } else if (this->animFlagAndTimer == 0) { diffRotInit = func_8002DAC0(&this->actor, &this->actor.initPosRot.pos); - diffRot = diffRotInit - this->actor.rotTowardsLinkY; + diffRot = diffRotInit - this->actor.yawTowardsLink; if (ABS(diffRot) >= 0x2001) { this->unk_196 = diffRotInit; } else { phi_f0 = (0.0f <= (f32)diffRot) ? 1.0f : -1.0f; - this->unk_196 = (s16)((phi_f0 * -8192.0f) + (f32)this->actor.rotTowardsLinkY); + this->unk_196 = (s16)((phi_f0 * -8192.0f) + (f32)this->actor.yawTowardsLink); } } else { - this->unk_196 = (s16)(this->actor.rotTowardsLinkY + 0x8000); + this->unk_196 = (s16)(this->actor.yawTowardsLink + 0x8000); } } @@ -410,7 +409,7 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); - Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 0x3, 0x400, 0x100); + Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0x3, 0x400, 0x100); if (func_8010BDBC(&globalCtx->msgCtx) == 5) { EnHintnuts_SetupLeave(this, globalCtx); } @@ -429,7 +428,7 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { temp_a1 = this->actor.wallPolyRot; } else { - temp_a1 = this->actor.rotTowardsLinkY - func_8005A9F4(globalCtx->cameraPtrs[globalCtx->activeCamera]) - 0x8000; + temp_a1 = this->actor.yawTowardsLink - func_8005A9F4(globalCtx->cameraPtrs[globalCtx->activeCamera]) - 0x8000; if (ABS(temp_a1) >= 0x4001) { temp_a1 = func_8005A9F4(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; } else { @@ -452,7 +451,7 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { } void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { - this->actor.unk_114 = 1; + this->actor.dmgEffectTimer = 1; SkelAnime_FrameUpdateMatrix(&this->skelAnime); if (func_800A56C8(&this->skelAnime, 0.0f) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_FAINT); @@ -473,7 +472,7 @@ void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx) { this->actor.flags |= 1; this->actor.flags &= ~0x10; this->actor.colChkInfo.health = sColChkInfoInit.health; - this->actor.unk_114 = 0; + this->actor.dmgEffectTimer = 0; EnHintnuts_SetupWait(this); } } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index fd405ce6b0..19b4d83dd0 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -176,7 +176,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal Player* player = PLAYER; s16 sp32; s16 sp30; - f32 xzDistanceFromLink; + f32 xzDistFromLink; 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.xzDistanceFromLink < 265.0f)) { + if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistFromLink < 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; } - xzDistanceFromLink = this->actor.xzDistanceFromLink; - this->actor.xzDistanceFromLink = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos); + xzDistFromLink = this->actor.xzDistFromLink; + this->actor.xzDistFromLink = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos); if (func_8002F2CC(&this->actor, globalCtx, unkf) == 0) { - this->actor.xzDistanceFromLink = xzDistanceFromLink; + this->actor.xzDistFromLink = xzDistFromLink; return 0; } - this->actor.xzDistanceFromLink = xzDistanceFromLink; + this->actor.xzDistFromLink = xzDistFromLink; this->actor.textId = callback1(globalCtx, this); return 0; @@ -415,8 +415,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.yDistanceFromLink) + 1.0f; - xzRange = this->actor.xzDistanceFromLink + 1.0f; + yRange = fabsf(this->actor.yDistFromLink) + 1.0f; + xzRange = this->actor.xzDistFromLink + 1.0f; func_8002F434(&this->actor, globalCtx, getItemID, xzRange, yRange); } } diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 348fa631c0..4ff73aaef1 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -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.xzDistanceFromLink < 30.0f + (f32)this->collider.dim.radius) { + } else if (this->actor.xzDistFromLink < 30.0f + (f32)this->collider.dim.radius) { player->stateFlags2 |= 0x800000; } } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 02251adbdc..3e76df129c 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -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.xzDistanceFromLink < 30.0f + (f32)this->collider.dim.radius) { + } else if (this->actor.xzDistFromLink < 30.0f + (f32)this->collider.dim.radius) { player->stateFlags2 |= 0x800000; } } diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 170fb00814..60a3038052 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -101,14 +101,14 @@ void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { s16 yawDiff; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; EnMs_SetOfferText(&this->actor, globalCtx); if (func_8002F194(&this->actor, globalCtx) != 0) { // if talk is initiated this->actionFunc = EnMs_Talk; return; } - if ((this->actor.xzDistanceFromLink < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range + if ((this->actor.xzDistFromLink < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range func_8002F2CC(&this->actor, globalCtx, 90.0f); } } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 9d27234d10..a2655c4803 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -172,7 +172,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->xzDistanceFromLink > 32.0f) { + } else if (thisx->xzDistFromLink > 32.0f) { this->unk_34C = 1; } } @@ -444,7 +444,7 @@ void func_80AEB4A8(EnRu1* this, GlobalContext* globalCtx, s16 arg2, s16 arg3) { Actor* thisx = &this->actor; sp24.x = thisx->posRot.pos.x; - sp24.y = thisx->posRot.pos.y + thisx->unk_84; + sp24.y = thisx->posRot.pos.y + thisx->waterY; sp24.z = thisx->posRot.pos.z; func_80029444(globalCtx, &sp24, 100, arg2, arg3); } @@ -471,7 +471,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->unk_84; + pos.y = thisx->posRot.pos.y + thisx->waterY; pos.z = thisx->posRot.pos.z; func_8002949C(globalCtx, &pos, 0, 0, 1, 0); @@ -1017,19 +1017,19 @@ void func_80AECC84(EnRu1* this, GlobalContext* globalCtx) { void func_80AECCB0(EnRu1* this, GlobalContext* globalCtx) { Actor* thisx = &this->actor; Vec3f* pos; - s16 rotTowardsLinkY; + s16 yawTowardsLink; f32 spawnX; f32 spawnY; f32 spawnZ; s32 pad[2]; - rotTowardsLinkY = thisx->rotTowardsLinkY; + yawTowardsLink = thisx->yawTowardsLink; pos = &thisx->posRot.pos; - spawnX = ((kREG(1) + 12.0f) * Math_Sins(rotTowardsLinkY)) + pos->x; + spawnX = ((kREG(1) + 12.0f) * Math_Sins(yawTowardsLink)) + pos->x; spawnY = pos->y; - spawnZ = ((kREG(1) + 12.0f) * Math_Coss(rotTowardsLinkY)) + pos->z; + spawnZ = ((kREG(1) + 12.0f) * Math_Coss(yawTowardsLink)) + pos->z; this->unk_278 = Actor_SpawnAttached(&globalCtx->actorCtx, this, globalCtx, ACTOR_DOOR_WARP1, spawnX, spawnY, spawnZ, - 0, rotTowardsLinkY, 0, 5); + 0, yawTowardsLink, 0, 5); } void func_80AECDA0(EnRu1* this, GlobalContext* globalCtx) { @@ -1118,8 +1118,8 @@ void func_80AED0C8(EnRu1* this, GlobalContext* globalCtx) { void func_80AED0D8(EnRu1* this, GlobalContext* globalCtx) { this->action = 17; this->drawConfig = 1; - this->actor.posRot.rot.y = this->actor.rotTowardsLinkY; - this->actor.shape.rot.y = this->actor.rotTowardsLinkY; + this->actor.posRot.rot.y = this->actor.yawTowardsLink; + this->actor.shape.rot.y = this->actor.yawTowardsLink; func_80AECCB0(this, globalCtx); } @@ -1159,7 +1159,7 @@ void func_80AED218(EnRu1* this, UNK_TYPE arg1) { SkelAnime_ChangeAnim(&this->skelAnime, &D_06002990, 1.0f, 0, SkelAnime_GetFrameCount(&D_06002990.genericHeader), 2, -8.0f); this->action = 21; - this->unk_27C = this->actor.xzDistanceFromLink; + this->unk_27C = this->actor.xzDistFromLink; } } @@ -1257,7 +1257,7 @@ s32 func_80AED624(EnRu1* this, GlobalContext* globalCtx) { Actor_Kill(thisx); return 0; } else if (((this->roomNum1 != curRoomNum) || (this->roomNum2 != curRoomNum)) && - (thisx->unk_84 > kREG(16) + 50.0f) && (this->action != 33)) { + (thisx->waterY > kREG(16) + 50.0f) && (this->action != 33)) { this->action = 33; this->drawConfig = 2; this->unk_2A8 = 0xFF; @@ -1486,7 +1486,7 @@ void func_80AEE050(EnRu1* this) { this->unk_350 = 1; func_80AEE02C(this); this->unk_35C = 0; - this->unk_358 = (this->actor.unk_84 - 10.0f) * 0.5f; + this->unk_358 = (this->actor.waterY - 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; @@ -1615,7 +1615,7 @@ void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { func_8002F580(this, globalCtx); this->action = 27; func_80AEADD8(this); - } else if (thisx->unk_84 > 0.0f) { + } else if (thisx->waterY > 0.0f) { this->action = 29; this->unk_350 = 0; } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index df67814d23..7e7f22c957 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -107,7 +107,7 @@ void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) { s32 i; - if (this->actor.unk_84 > 0) { + if (this->actor.waterY > 0) { for (i = 0; i < 10; i++) { func_800293E4(globalCtx, &this->actor.posRot.pos, 10.0f, 10.0f, 30.0f, 0.25f); } @@ -138,7 +138,7 @@ void EnSb_SetupWaitOpen(EnSb* this) { void EnSb_SetupLunge(EnSb* this) { f32 frames = SkelAnime_GetFrameCount(&D_06000124.genericHeader); - f32 playbackSpeed = this->actor.unk_84 > 0.0f ? 1.0f : 0.0f; + f32 playbackSpeed = this->actor.waterY > 0.0f ? 1.0f : 0.0f; SkelAnime_ChangeAnim(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frames, 2, 0); this->behavior = SHELLBLADE_LUNGE; @@ -161,7 +161,7 @@ void EnSb_SetupCooldown(EnSb* this, s32 changeSpeed) { } this->behavior = SHELLBLADE_WAIT_CLOSED; if (changeSpeed) { - if (this->actor.unk_84 > 0.0f) { + if (this->actor.waterY > 0.0f) { this->actor.speedXZ = -5.0f; if (this->actor.velocity.y < 0.0f) { this->actor.velocity.y = 2.1f; @@ -179,9 +179,9 @@ void EnSb_SetupCooldown(EnSb* this, s32 changeSpeed) { void EnSb_WaitClosed(EnSb* this, GlobalContext* globalCtx) { // always face toward link - Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 0xA, 0x7D0, 0x0); + Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0); - if ((this->actor.xzDistanceFromLink <= 160.0f) && (this->actor.xzDistanceFromLink > 40.0f)) { + if ((this->actor.xzDistFromLink <= 160.0f) && (this->actor.xzDistFromLink > 40.0f)) { EnSb_SetupOpen(this); } } @@ -193,8 +193,8 @@ void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { this->timer = 15; EnSb_SetupWaitOpen(this); } else { - Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 0xA, 0x7D0, 0x0); - if ((this->actor.xzDistanceFromLink > 160.0f) || (this->actor.xzDistanceFromLink <= 40.0f)) { + Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0); + if ((this->actor.xzDistFromLink > 160.0f) || (this->actor.xzDistFromLink <= 40.0f)) { EnSb_SetupWaitClosed(this); } } @@ -203,9 +203,9 @@ void EnSb_Open(EnSb* this, GlobalContext* globalCtx) { void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { s16 timer = this->timer; - Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.rotTowardsLinkY, 0xA, 0x7D0, 0x0); + Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 0xA, 0x7D0, 0x0); - if ((this->actor.xzDistanceFromLink > 160.0f) || (this->actor.xzDistanceFromLink <= 40.0f)) { + if ((this->actor.xzDistFromLink > 160.0f) || (this->actor.xzDistFromLink <= 40.0f)) { EnSb_SetupWaitClosed(this); } @@ -213,7 +213,7 @@ void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { this->timer = timer - 1; } else { this->timer = 0; - this->attackYaw = this->actor.rotTowardsLinkY; + this->attackYaw = this->actor.yawTowardsLink; this->actionFunc = EnSb_TurnAround; } } @@ -226,7 +226,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.unk_84 > 0.0f) { + if (this->actor.waterY > 0.0f) { this->actor.velocity.y = 3.0f; this->actor.speedXZ = 5.0f; this->actor.gravity = -0.35f; @@ -246,7 +246,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { Math_ApproxF(&this->actor.speedXZ, 0.0f, 0.2f); if ((this->actor.velocity.y <= -0.1f) || ((this->actor.bgCheckFlags & 2))) { - if (!(this->actor.unk_84 > 0.0f)) { + if (!(this->actor.waterY > 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } this->actor.bgCheckFlags = this->actor.bgCheckFlags & ~2; @@ -267,7 +267,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { if (this->bouncesLeft != 0) { this->bouncesLeft--; this->timer = 1; - if (this->actor.unk_84 > 0.0f) { + if (this->actor.waterY > 0.0f) { this->actor.velocity.y = 3.0f; this->actor.speedXZ = 5.0f; this->actor.gravity = -0.35f; @@ -361,7 +361,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { case 15: // explosions, arrow, hammer, ice arrow, light arrow, spirit arrow, shadow arrow if (EnSb_IsVulnerable(this)) { hitY = this->collider.body.bumper.unk_06.y - this->actor.posRot.pos.y; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) { Actor_ApplyDamage(&this->actor); func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50); @@ -379,7 +379,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { case 13: // all sword damage if (EnSb_IsVulnerable(this)) { hitY = this->collider.body.bumper.unk_06.y - this->actor.posRot.pos.y; - yawDiff = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y; if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) { Actor_ApplyDamage(&this->actor); func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50); @@ -417,7 +417,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; if (this->isDead) { - if (this->actor.unk_84 > 0.0f) { + if (this->actor.waterY > 0.0f) { this->actor.params = 4; } else { this->actor.params = 1; @@ -461,7 +461,7 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL, EnSb_PostLimbDraw, &this->actor); if (this->fire != 0) { - this->actor.unk_114++; + this->actor.dmgEffectTimer++; fireDecr = this->fire - 1; // this is intended to draw flames after being burned, but the condition is never met to run this code // fire gets set to 4 when burned, decrements to 3 and fails the "& 1" check and never stores the decrement diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index a97351abe6..046165b043 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -8,7 +8,6 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx); void EnSkj_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx); void EnSkj_Draw(Actor* thisx, GlobalContext* globalCtx); - /* const ActorInit En_Skj_InitVars = { ACTOR_EN_SKJ, diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index c7b535e894..cff40b3036 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -229,7 +229,7 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) { s16 v0; s16 v1; - if (this->actor.waterSurfaceDist > 10000.f) { + if (this->actor.xyzDistFromLinkSq > 10000.f) { return 0; } @@ -237,7 +237,7 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) { v0 -= this->h_21E; v0 -= this->headRot; - v1 = this->actor.rotTowardsLinkY - v0; + v1 = this->actor.yawTowardsLink - v0; if (ABS(v1) < 0x1554) { return 1; } else { @@ -263,7 +263,7 @@ s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx) { continue; } - dy = prop->posRot.pos.y - this->actor.unk_80; + dy = prop->posRot.pos.y - this->actor.groundY; dxz = func_8002DB8C(&this->actor, prop); if (dxz > 40.f || dy > 10.f) { prop = prop->next; @@ -282,7 +282,7 @@ void EnTk_CheckCurrentSpot(EnTk* this) { f32 dy; if (this->currentSpot != NULL) { - dy = this->currentSpot->posRot.pos.y - this->actor.unk_80; + dy = this->currentSpot->posRot.pos.y - this->actor.groundY; dxz = func_8002DB8C(&this->actor, this->currentSpot); if (dxz > 40.f || dy > 10.f) { this->currentSpot = NULL; @@ -538,7 +538,7 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { if (this->h_1E0 != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; - v1 = this->actor.rotTowardsLinkY - v1; + v1 = this->actor.yawTowardsLink - v1; if (this->h_1E0 == 2) { EnTk_DigAnim(this, globalCtx); @@ -552,7 +552,7 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { } else if (EnTk_CheckFacingPlayer(this) != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; - v1 = this->actor.rotTowardsLinkY - v1; + v1 = this->actor.yawTowardsLink - v1; this->actionCountdown = 0; func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.f, func_80B1C54C, @@ -560,7 +560,7 @@ void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { } else if (func_8002F194(&this->actor, globalCtx) != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; - v1 = this->actor.rotTowardsLinkY - v1; + v1 = this->actor.yawTowardsLink - v1; this->actionCountdown = 0; this->h_1E0 = 1; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index d957cb2170..a7dbe4c3d3 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -138,7 +138,7 @@ void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) actorPos = &this->actor.posRot.pos; spC8 = *actorPos; - spC8.y += this->actor.unk_84; + spC8.y += this->actor.waterY; func_8002949C(globalCtx, &spC8, 0, 0, 0, 400); @@ -177,7 +177,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { s32 pad; Player* player = PLAYER; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.unk_84 > 15.0f)) { + if ((this->actor.bgCheckFlags & 0x20) && (this->actor.waterY > 15.0f)) { EnTuboTrap_SpawnWaterFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, globalCtx); @@ -239,7 +239,7 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); } - if (this->actor.xzDistanceFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) { + if (this->actor.xzDistFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) { Actor_ChangeType(globalCtx, &globalCtx->actorCtx, this, ACTORTYPE_ENEMY); this->actor.flags |= 1; targetHeight = 40.0f + -10.0f * gSaveContext.linkAge; @@ -261,7 +261,7 @@ void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { if (fabsf(this->actor.posRot.pos.y - this->targetY) < 10.0f) { this->actor.speedXZ = 10.0f; - this->actor.posRot.rot.y = this->actor.rotTowardsLinkY; + this->actor.posRot.rot.y = this->actor.yawTowardsLink; this->actionFunc = EnTuboTrap_Fly; } } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 0487ba8d71..5d2f05b924 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -132,7 +132,7 @@ void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { this->timer = 0x82; this->actor.velocity.y = 0.0f; this->actor.posRot.pos.y = player->actor.posRot.pos.y; - this->actor.unk_80 = player->actor.unk_80; + this->actor.groundY = player->actor.groundY; this->actor.draw = EnWallmas_Draw; this->actionFunc = EnWallmas_WaitToDrop; } @@ -147,7 +147,7 @@ void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { this->unk_2c4 = player->actor.posRot.pos.y; this->actor.posRot.pos.y = player->actor.posRot.pos.y + 300.0f; this->actor.posRot.rot.y = player->actor.shape.rot.y + 0x8000; - this->actor.unk_80 = player->actor.unk_80; + this->actor.groundY = player->actor.groundY; this->actor.flags |= 1; this->actor.flags &= ~0x20; this->actionFunc = EnWallmas_Drop; @@ -234,7 +234,7 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - this->unk_2c4 = this->actor.yDistanceFromLink; + this->unk_2c4 = this->actor.yDistFromLink; func_8002DF38(globalCtx, &this->actor, 0x25); func_800800F8(globalCtx, 0x251C, 0x270F, &this->actor, 0); } @@ -272,7 +272,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { player = PLAYER; playerPos = &player->actor.posRot.pos; this->actor.posRot.pos = *playerPos; - this->actor.unk_80 = player->actor.unk_80; + this->actor.groundY = player->actor.groundY; this->actor.floorPoly = player->actor.floorPoly; if (this->timer != 0) { @@ -298,8 +298,8 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) { Player* player = PLAYER; if (!func_8008E988(globalCtx) && (player->stateFlags2 & 0x10) == 0 && (player->invincibilityTimer >= 0) && - (this->actor.xzDistanceFromLink < 30.0f) && (this->actor.yDistanceFromLink < -5.0f) && - (-(f32)(player->unk_4DA + 0xA) < this->actor.yDistanceFromLink)) { + (this->actor.xzDistFromLink < 30.0f) && (this->actor.yDistFromLink < -5.0f) && + (-(f32)(player->unk_4DA + 0xA) < this->actor.yDistFromLink)) { EnWallmas_SetupTakePlayer(this, globalCtx); } } @@ -315,7 +315,7 @@ void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { EnWallmas_SetupWalk(this); } - Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY + 0x8000, 0xB6); + Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink + 0x8000, 0xB6); } void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { @@ -323,7 +323,7 @@ void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { EnWallmas_SetupJumpToCeiling(this); } - Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, (s16)((s32)this->actor.rotTowardsLinkY + 0x8000), 0xB6); + Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, (s16)((s32)this->actor.yawTowardsLink + 0x8000), 0xB6); if ((func_800A56C8(&this->skelAnime, 0.0f) != 0) || (func_800A56C8(&this->skelAnime, 12.0f) != 0) || (func_800A56C8(&this->skelAnime, 24.0f) != 0) || (func_800A56C8(&this->skelAnime, 36.0f) != 0)) { @@ -349,7 +349,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_UP); } - if (this->actor.yDistanceFromLink < -900.0f) { + if (this->actor.yDistFromLink < -900.0f) { if (this->actor.params == WMT_FLAG) { Actor_Kill(&this->actor); return; @@ -571,7 +571,7 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { func_80094044(globalCtx->state.gfxCtx); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0x00, 0x00, 0x00, 0xFF); - func_80038A28(this->actor.floorPoly, this->actor.posRot.pos.x, this->actor.unk_80, this->actor.posRot.pos.z, &mf); + func_80038A28(this->actor.floorPoly, this->actor.posRot.pos.x, this->actor.groundY, this->actor.posRot.pos.z, &mf); Matrix_Mult(&mf, MTXMODE_NEW); if ((this->actionFunc != EnWallmas_WaitToDrop) && (this->actionFunc != EnWallmas_ReturnToCeiling) && diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index e229d5e5f2..ccc8818535 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -192,7 +192,7 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { func_800F5C64(0x51); } else { if (1) {}; // necessary to match - rotDiff = ABS(this->actor.rotTowardsLinkY - this->actor.shape.rot.y); + rotDiff = ABS(this->actor.yawTowardsLink - this->actor.shape.rot.y); if (rotDiff < 0x238E) { if (!(player->actor.posRot.pos.y < this->actor.posRot.pos.y)) { func_8002F2F4(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 18acf46de8..f24bf2c1b8 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -124,7 +124,7 @@ void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } else { this->collider.base.acFlags &= ~0x2; - if (this->actor.xzDistanceFromLink < 800.0f) { + if (this->actor.xzDistFromLink < 800.0f) { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); }