From 00a5edea71a605e7bdad78892b2863000e53624e Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 18 Jan 2021 16:04:04 -0500 Subject: Actor Struct Changes (and a few related things) (#617) * reformat header * type -> category * done for now i think * some more stuff * first -> head * focus * flag comment * ground -> floor * remove asm, name wrapper funcs * name func, format * review * targetPriority, format * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0305ec2c2" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0305ec2c2" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * comment * review * feet flags * horse shadow --- src/code/code_800430A0.c | 6 +- src/code/code_80043480.c | 18 +- src/code/z_actor.c | 779 ++++++++++++++++++++++--------------------- src/code/z_bgcheck.c | 10 +- src/code/z_camera.c | 184 +++++----- src/code/z_collision_check.c | 22 +- src/code/z_en_a_keep.c | 47 ++- src/code/z_en_item00.c | 114 +++---- src/code/z_horse.c | 41 ++- src/code/z_map_exp.c | 10 +- src/code/z_path.c | 4 +- src/code/z_play.c | 16 +- src/code/z_player_call.c | 2 +- src/code/z_player_lib.c | 25 +- src/code/z_skelanime.c | 6 +- 15 files changed, 643 insertions(+), 641 deletions(-) (limited to 'src/code') diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index 9673fc86a..1b2f73c48 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -22,9 +22,9 @@ void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { colCtx->dyna.bgActors[bgId].curTransform.rot.x, colCtx->dyna.bgActors[bgId].curTransform.rot.y, colCtx->dyna.bgActors[bgId].curTransform.rot.z, colCtx->dyna.bgActors[bgId].curTransform.pos.x, colCtx->dyna.bgActors[bgId].curTransform.pos.y, colCtx->dyna.bgActors[bgId].curTransform.pos.z); - SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &actor->posRot.pos, &tempPos); + SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &actor->world.pos, &tempPos); SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); - actor->posRot.pos = pos; + actor->world.pos = pos; if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) { @@ -52,7 +52,7 @@ void func_800432A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { } actor->shape.rot.y += rot; - actor->posRot.rot.y += rot; + actor->world.rot.y += rot; } } diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c index 900dd9683..fe8097eb9 100644 --- a/src/code/code_80043480.c +++ b/src/code/code_80043480.c @@ -20,8 +20,8 @@ void func_800434B8(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 2; } -void func_800434C8(CollisionContext* colCtx, s32 floorPolySource) { - DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorPolySource); +void func_800434C8(CollisionContext* colCtx, s32 floorBgId) { + DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorBgId); if (dynaActor != NULL) { func_800434B8(dynaActor); @@ -32,8 +32,8 @@ void func_800434F8(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 4; } -void func_80043508(CollisionContext* colCtx, s32 floorPolySource) { - DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorPolySource); +void func_80043508(CollisionContext* colCtx, s32 floorBgId) { + DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorBgId); if (dynaActor != NULL) { func_800434F8(dynaActor); @@ -93,9 +93,9 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* actor, s16 arg2, s16 sign = (0.0f <= actor->unk_150) ? 1.0f : -1.0f; a2 = (f32)arg2 - 0.1f; - posA.x = actor->actor.posRot.pos.x + (a2 * cos); - posA.y = actor->actor.posRot.pos.y + arg4; - posA.z = actor->actor.posRot.pos.z - (a2 * sin); + posA.x = actor->actor.world.pos.x + (a2 * cos); + posA.y = actor->actor.world.pos.y + arg4; + posA.z = actor->actor.world.pos.z - (a2 * sin); a3 = (f32)arg3 - 0.1f; posB.x = sign * a3 * sin + posA.x; @@ -105,8 +105,8 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* actor, s16 arg2, s16 actor, 0.0f)) { return false; } - posA.x = (actor->actor.posRot.pos.x * 2) - posA.x; - posA.z = (actor->actor.posRot.pos.z * 2) - posA.z; + posA.x = (actor->actor.world.pos.x * 2) - posA.x; + posA.z = (actor->actor.world.pos.z * 2) - posA.z; posB.x = sign * a3 * sin + posA.x; posB.z = sign * a3 * cos + posA.z; if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId, diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 40799d352..e1c68a76d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -5,20 +5,20 @@ #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "objects/gameplay_keep/gameplay_keep.h" -void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3) { - shape->unk_08 = arg1; - shape->shadowDrawFunc = shadowDrawFunc; - shape->unk_10 = arg3; - shape->unk_14 = -1; +void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc* shadowDraw, f32 shadowScale) { + shape->yOffset = yOffset; + shape->shadowDraw = shadowDraw; + shape->shadowScale = shadowScale; + shape->shadowAlpha = 255; } -void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { +void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; if (actor->floorPoly != NULL) { - temp1 = actor->posRot.pos.y - actor->groundY; + temp1 = actor->world.pos.y - actor->floorHeight; if (temp1 >= -50.0f && temp1 < 500.0f) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1553); @@ -33,19 +33,19 @@ void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* if (color != NULL) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->r, color->g, color->b, - (u32)(actor->shape.unk_14 * temp2) & 0xFF); + (u32)(actor->shape.shadowAlpha * temp2) & 0xFF); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(actor->shape.unk_14 * temp2) & 0xFF); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(actor->shape.shadowAlpha * temp2) & 0xFF); } - func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->groundY, actor->posRot.pos.z, &sp60); + func_80038A28(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &sp60); Matrix_Put(&sp60); if (dlist != D_04049210) { Matrix_RotateY(actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); } - temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.unk_10; + temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale; Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), @@ -57,21 +57,21 @@ void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* } } -void ActorShadow_DrawFunc_Circle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - func_8002B200(actor, lights, globalCtx, &D_04049210, NULL); +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + ActorShadow_Draw(actor, lights, globalCtx, D_04049210, NULL); } -Color_RGBA8 D_80115F80 = { 255, 255, 255, 255 }; +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + static Color_RGBA8 white = { 255, 255, 255, 255 }; -void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - func_8002B200(actor, lights, globalCtx, &D_04049210, &D_80115F80); + ActorShadow_Draw(actor, lights, globalCtx, D_04049210, &white); } -void ActorShadow_DrawFunc_Squiggly(Actor* actor, Lights* lights, GlobalContext* globalCtx) { - func_8002B200(actor, lights, globalCtx, D_04049AD0, NULL); +void ActorShadow_DrawHorse(Actor* actor, Lights* lights, GlobalContext* globalCtx) { + ActorShadow_Draw(actor, lights, globalCtx, D_04049AD0, NULL); } -void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { +void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { s32 pad1; f32 sp58; s32 pad2[2]; @@ -97,7 +97,7 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, #ifdef NON_MATCHING // saved register, stack usage and minor ordering differences -void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx) { MtxF spE8; f32 spE0[2]; s32 i; @@ -118,20 +118,20 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* s32 phi_s1; s32 phi_s2; - temp_f20 = actor->posRot.pos.y - actor->groundY; + temp_f20 = actor->world.pos.y - actor->floorHeight; if (temp_f20 > 20.0f) { - temp_10 = actor->shape.unk_10; - temp_14 = actor->shape.unk_14; - actor->shape.unk_10 *= 0.3f; - actor->shape.unk_14 *= ((temp_f20 - 20.0f) * 0.02f) > 1.0f ? 1.0f : ((temp_f20 - 20.0f) * 0.02f); - ActorShadow_DrawFunc_Circle(actor, lights, globalCtx); - actor->shape.unk_10 = temp_10; - actor->shape.unk_14 = temp_14; + temp_10 = actor->shape.shadowScale; + temp_14 = actor->shape.shadowAlpha; + actor->shape.shadowScale *= 0.3f; + actor->shape.shadowAlpha *= ((temp_f20 - 20.0f) * 0.02f) > 1.0f ? 1.0f : ((temp_f20 - 20.0f) * 0.02f); + ActorShadow_DrawCircle(actor, lights, globalCtx); + actor->shape.shadowScale = temp_10; + actor->shape.shadowAlpha = temp_14; } if (temp_f20 < 200.0f) { - phi_s7 = &actor->unk_CC[0]; + phi_s7 = &actor->shape.feetPos[FOOT_LEFT]; spAC = &spE0[0]; temp_s6 = lights->numLights; temp_s6 -= 2; @@ -139,14 +139,14 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1741); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); - actor->shape.unk_15 = 0; + actor->shape.feetFloorFlags = 0; for (i = 0; i < 2; i++) { phi_s7->y += 50.0f; *spAC = func_800BFCB8(globalCtx, &spE8, phi_s7); phi_s7->y -= 50.0f; - actor->shape.unk_15 *= 2; + actor->shape.feetFloorFlags *= 2; phi_f2 = phi_s7->y - *spAC; @@ -154,21 +154,21 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* phi_s0 = &lights->l.l[0]; if (phi_f2 <= 0.0f) { - actor->shape.unk_15++; + actor->shape.feetFloorFlags++; } if (30.0f < phi_f2) { phi_f2 = 30.0f; } - temp_f24 = actor->shape.unk_14 * (1.0f - (phi_f2 * (1.0f / 30))); + temp_f24 = actor->shape.shadowAlpha * (1.0f - (phi_f2 * (1.0f / 30))); if (30.0f < phi_f2) { phi_f2 = 30.0f; } temp_f20_2 = 1.0f - (phi_f2 * (1.0f / 70)); - temp_f22_2 = (actor->shape.unk_10 * temp_f20_2) * actor->scale.x; + temp_f22_2 = (actor->shape.shadowScale * temp_f20_2) * actor->scale.x; phi_s2 = 0; @@ -176,7 +176,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* if (phi_s0->l.dir[1] > 0) { temp_lo = ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2]); if (temp_lo > 0) { - func_8002B66C(globalCtx, phi_s0, &spE8, temp_lo, temp_f24, temp_f22_2, temp_f20_2); + ActorShadow_DrawFoot(globalCtx, phi_s0, &spE8, temp_lo, temp_f24, temp_f22_2, temp_f20_2); phi_s2 += temp_lo; } } @@ -188,7 +188,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* temp_a3 = (ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2])) - (phi_s2 * 8); if (temp_a3 > 0) { - func_8002B66C(globalCtx, phi_s0, &spE8, temp_a3, temp_f24, temp_f22_2, temp_f20_2); + ActorShadow_DrawFoot(globalCtx, phi_s0, &spE8, temp_a3, temp_f24, temp_f22_2, temp_f20_2); } } phi_s0++; @@ -200,24 +200,25 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, Lights* lights, GlobalContext* } if (!(actor->bgCheckFlags & 1)) { - actor->shape.unk_15 = 0; - } else if (actor->shape.unk_15 == 3) { - temp_f0 = actor->unk_CC[0].y - actor->unk_CC[1].y; - actor->shape.unk_15 = ((spE0[0] + temp_f0) < (spE0[1] - temp_f0)) ? 2 : 1; + actor->shape.feetFloorFlags = 0; + } else if (actor->shape.feetFloorFlags == 3) { + temp_f0 = actor->shape.feetPos[FOOT_LEFT].y - actor->shape.feetPos[FOOT_RIGHT].y; + actor->shape.feetFloorFlags = ((spE0[0] + temp_f0) < (spE0[1] - temp_f0)) ? 2 : 1; } CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1831); } } #else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/ActorShadow_DrawFunc_Teardrop.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/ActorShadow_DrawFeet.s") #endif -void func_8002BDB0(Actor* actor, s32 arg1, s32 arg2, Vec3f* arg3, s32 arg4, Vec3f* arg5) { - if (arg1 == arg2) { - Matrix_MultVec3f(arg3, &actor->unk_CC[0]); - } else if (arg1 == arg4) { - Matrix_MultVec3f(arg5, &actor->unk_CC[1]); +void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, + Vec3f* rightFootPos) { + if (limbIndex == leftFootIndex) { + Matrix_MultVec3f(leftFootPos, &actor->shape.feetPos[FOOT_LEFT]); + } else if (limbIndex == rightFootIndex) { + Matrix_MultVec3f(rightFootPos, &actor->shape.feetPos[FOOT_RIGHT]); } } @@ -253,7 +254,7 @@ void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 targetCtx->arr_50[index].unk_0C = targetCtx->unk_44; } -void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globalCtx) { +void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, GlobalContext* globalCtx) { TargetContextEntry* entry; NaviColor* naviColor; s32 i; @@ -262,7 +263,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globa targetCtx->unk_44 = 500.0f; targetCtx->unk_48 = 0x100; - naviColor = &sNaviColorList[actorType]; + naviColor = &sNaviColorList[actorCategory]; entry = &targetCtx->arr_50[0]; for (i = 0; i < ARRAY_COUNT(targetCtx->arr_50); i++) { @@ -274,11 +275,11 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globa } } -void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorType, GlobalContext* globalCtx) { - NaviColor* naviColor = &sNaviColorList[actorType]; - targetCtx->naviRefPos.x = actor->posRot2.pos.x; - targetCtx->naviRefPos.y = actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y); - targetCtx->naviRefPos.z = actor->posRot2.pos.z; +void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, GlobalContext* globalCtx) { + NaviColor* naviColor = &sNaviColorList[actorCategory]; + targetCtx->naviRefPos.x = actor->focus.pos.x; + targetCtx->naviRefPos.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); + targetCtx->naviRefPos.z = actor->focus.pos.z; targetCtx->naviInner.r = naviColor->inner.r; targetCtx->naviInner.g = naviColor->inner.g; targetCtx->naviInner.b = naviColor->inner.b; @@ -297,8 +298,8 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global targetCtx->unk_90 = NULL; targetCtx->unk_4B = 0; targetCtx->unk_4C = 0; - func_8002BF60(targetCtx, actor, actor->type, globalCtx); - func_8002BE98(targetCtx, actor->type, globalCtx); + func_8002BF60(targetCtx, actor, actor->category, globalCtx); + func_8002BE98(targetCtx, actor->category, globalCtx); } void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { @@ -332,7 +333,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { } if (actor != NULL) { - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->posRot2.pos); + Math_Vec3f_Copy(&targetCtx->targetCenterPos, &actor->focus.pos); var1 = (500.0f - targetCtx->unk_44) / 420.0f; } else { targetCtx->unk_48 -= 120; @@ -400,12 +401,12 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { actor = targetCtx->unk_94; if ((actor != NULL) && !(actor->flags & 0x8000000)) { - NaviColor* naviColor = &sNaviColorList[actor->type]; + NaviColor* naviColor = &sNaviColorList[actor->category]; POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x7); - Matrix_Translate(actor->posRot2.pos.x, actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y) + 17.0f, - actor->posRot2.pos.z, MTXMODE_NEW); + Matrix_Translate(actor->focus.pos.x, actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y) + 17.0f, + actor->focus.pos.z, MTXMODE_NEW); Matrix_RotateY((f32)((u16)(globalCtx->gameplayFrames * 3000)) * (M_PI / 32768), MTXMODE_APPLY); Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY); @@ -421,7 +422,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { s32 pad; Actor* unkActor; - s32 actorType; + s32 actorCategory; Vec3f sp50; f32 sp4C; f32 temp1; @@ -449,14 +450,14 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl } if (unkActor != NULL) { - actorType = unkActor->type; + actorCategory = unkActor->category; } else { - actorType = player->actor.type; + actorCategory = player->actor.category; } - if ((unkActor != targetCtx->arrowPointedActor) || (actorType != targetCtx->activeType)) { + if ((unkActor != targetCtx->arrowPointedActor) || (actorCategory != targetCtx->activeCategory)) { targetCtx->arrowPointedActor = unkActor; - targetCtx->activeType = actorType; + targetCtx->activeCategory = actorCategory; targetCtx->unk_40 = 1.0f; } @@ -466,18 +467,18 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if (Math_StepToF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) { temp1 = 0.25f / targetCtx->unk_40; - temp2 = unkActor->posRot.pos.x - targetCtx->naviRefPos.x; - temp3 = (unkActor->posRot.pos.y + (unkActor->unk_4C * unkActor->scale.y)) - targetCtx->naviRefPos.y; - temp4 = unkActor->posRot.pos.z - targetCtx->naviRefPos.z; + temp2 = unkActor->world.pos.x - targetCtx->naviRefPos.x; + temp3 = (unkActor->world.pos.y + (unkActor->targetArrowOffset * unkActor->scale.y)) - targetCtx->naviRefPos.y; + temp4 = unkActor->world.pos.z - targetCtx->naviRefPos.z; targetCtx->naviRefPos.x += temp2 * temp1; targetCtx->naviRefPos.y += temp3 * temp1; targetCtx->naviRefPos.z += temp4 * temp1; } else { - func_8002BF60(targetCtx, unkActor, actorType, globalCtx); + func_8002BF60(targetCtx, unkActor, actorCategory, globalCtx); } if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) { - func_8002BE04(globalCtx, &actorArg->posRot2.pos, &sp50, &sp4C); + func_8002BE04(globalCtx, &actorArg->focus.pos, &sp50, &sp4C); if (((sp50.z <= 0.0f) || (1.0f <= fabsf(sp50.x * sp4C))) || (1.0f <= fabsf(sp50.y * sp4C))) { actorArg = NULL; } @@ -485,7 +486,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl if (actorArg != NULL) { if (actorArg != targetCtx->targetedActor) { - func_8002BE98(targetCtx, actorArg->type, globalCtx); + func_8002BE98(targetCtx, actorArg->category, globalCtx); targetCtx->targetedActor = actorArg; if (actorArg->id == ACTOR_EN_BOOM) { @@ -496,9 +497,9 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl func_80078884(lockOnSfxId); } - targetCtx->targetCenterPos.x = actorArg->posRot.pos.x; - targetCtx->targetCenterPos.y = actorArg->posRot.pos.y - (actorArg->shape.unk_08 * actorArg->scale.y); - targetCtx->targetCenterPos.z = actorArg->posRot.pos.z; + targetCtx->targetCenterPos.x = actorArg->world.pos.x; + targetCtx->targetCenterPos.y = actorArg->world.pos.y - (actorArg->shape.yOffset * actorArg->scale.y); + targetCtx->targetCenterPos.z = actorArg->world.pos.z; if (targetCtx->unk_4B == 0) { temp5 = (500.0f - targetCtx->unk_44) * 3.0f; @@ -775,26 +776,26 @@ void Actor_Kill(Actor* actor) { actor->flags &= ~0x1; } -void Actor_InitPosRot(Actor* actor) { - actor->posRot = actor->initPosRot; +void Actor_SetWorldToHome(Actor* actor) { + actor->world = actor->home; } -void Actor_SetHeight(Actor* actor, f32 offset) { - actor->posRot2.pos.x = actor->posRot.pos.x; - actor->posRot2.pos.y = actor->posRot.pos.y + offset; - actor->posRot2.pos.z = actor->posRot.pos.z; +void Actor_SetFocus(Actor* actor, f32 yOffset) { + actor->focus.pos.x = actor->world.pos.x; + actor->focus.pos.y = actor->world.pos.y + yOffset; + actor->focus.pos.z = actor->world.pos.z; - actor->posRot2.rot.x = actor->posRot.rot.x; - actor->posRot2.rot.y = actor->posRot.rot.y; - actor->posRot2.rot.z = actor->posRot.rot.z; + actor->focus.rot.x = actor->world.rot.x; + actor->focus.rot.y = actor->world.rot.y; + actor->focus.rot.z = actor->world.rot.z; } -void func_8002D5F4(Actor* actor) { - actor->posRot.rot = actor->shape.rot; +void Actor_SetWorldRotToShape(Actor* actor) { + actor->world.rot = actor->shape.rot; } -void func_8002D610(Actor* actor) { - actor->shape.rot = actor->posRot.rot; +void Actor_SetShapeRotToWorld(Actor* actor) { + actor->shape.rot = actor->world.rot; } void Actor_SetScale(Actor* actor, f32 scale) { @@ -808,20 +809,20 @@ void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) { } void Actor_Init(Actor* actor, GlobalContext* globalCtx) { - Actor_InitPosRot(actor); - func_8002D610(actor); - Actor_SetHeight(actor, 0.0f); - Math_Vec3f_Copy(&actor->pos4, &actor->posRot.pos); + Actor_SetWorldToHome(actor); + Actor_SetShapeRotToWorld(actor); + Actor_SetFocus(actor, 0.0f); + Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos); Actor_SetScale(actor, 0.01f); - actor->unk_1F = 3; + actor->targetMode = 3; actor->minVelocityY = -20.0f; - actor->xyzDistToLinkSq = FLT_MAX; + actor->xyzDistToPlayerSq = FLT_MAX; actor->naviEnemyId = 0xFF; actor->uncullZoneForward = 1000.0f; actor->uncullZoneScale = 350.0f; actor->uncullZoneDownward = 700.0f; CollisionCheck_InitInfo(&actor->colChkInfo); - actor->floorPolySource = BGCHECK_SCENE; + actor->floorBgId = BGCHECK_SCENE; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_SetObjectDependency(globalCtx, actor); @@ -848,14 +849,14 @@ void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) { void func_8002D7EC(Actor* actor) { f32 speedRate = R_UPDATE_RATE * 0.5f; - actor->posRot.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x; - actor->posRot.pos.y += (actor->velocity.y * speedRate) + actor->colChkInfo.displacement.y; - actor->posRot.pos.z += (actor->velocity.z * speedRate) + actor->colChkInfo.displacement.z; + actor->world.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x; + actor->world.pos.y += (actor->velocity.y * speedRate) + actor->colChkInfo.displacement.y; + actor->world.pos.z += (actor->velocity.z * speedRate) + actor->colChkInfo.displacement.z; } void func_8002D868(Actor* actor) { - actor->velocity.x = Math_SinS(actor->posRot.rot.y) * actor->speedXZ; - actor->velocity.z = Math_CosS(actor->posRot.rot.y) * actor->speedXZ; + actor->velocity.x = Math_SinS(actor->world.rot.y) * actor->speedXZ; + actor->velocity.z = Math_CosS(actor->world.rot.y) * actor->speedXZ; actor->velocity.y += actor->gravity; if (actor->velocity.y < actor->minVelocityY) { @@ -869,10 +870,10 @@ void Actor_MoveForward(Actor* actor) { } void func_8002D908(Actor* actor) { - f32 sp24 = Math_CosS(actor->posRot.rot.x) * actor->speedXZ; - actor->velocity.x = Math_SinS(actor->posRot.rot.y) * sp24; - actor->velocity.y = Math_SinS(actor->posRot.rot.x) * actor->speedXZ; - actor->velocity.z = Math_CosS(actor->posRot.rot.y) * sp24; + f32 sp24 = Math_CosS(actor->world.rot.x) * actor->speedXZ; + actor->velocity.x = Math_SinS(actor->world.rot.y) * sp24; + actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ; + actor->velocity.z = Math_CosS(actor->world.rot.y) * sp24; } void func_8002D97C(Actor* actor) { @@ -881,56 +882,56 @@ void func_8002D97C(Actor* actor) { } void func_8002D9A4(Actor* actor, f32 arg1) { - actor->speedXZ = Math_CosS(actor->posRot.rot.x) * arg1; - actor->velocity.y = -Math_SinS(actor->posRot.rot.x) * arg1; + actor->speedXZ = Math_CosS(actor->world.rot.x) * arg1; + actor->velocity.y = -Math_SinS(actor->world.rot.x) * arg1; } void func_8002D9F8(Actor* actor, SkelAnime* skelAnime) { Vec3f sp1C; SkelAnime_UpdateTranslation(skelAnime, &sp1C, actor->shape.rot.y); - actor->posRot.pos.x += sp1C.x * actor->scale.x; - actor->posRot.pos.y += sp1C.y * actor->scale.y; - actor->posRot.pos.z += sp1C.z * actor->scale.z; + actor->world.pos.x += sp1C.x * actor->scale.x; + actor->world.pos.y += sp1C.y * actor->scale.y; + actor->world.pos.z += sp1C.z * actor->scale.z; } -s16 func_8002DA78(Actor* actorA, Actor* actorB) { - return Math_Vec3f_Yaw(&actorA->posRot.pos, &actorB->posRot.pos); +s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Yaw(&actorA->world.pos, &actorB->world.pos); } -s16 func_8002DA9C(Actor* actorA, Actor* actorB) { - return Math_Vec3f_Yaw(&actorA->posRot2.pos, &actorB->posRot2.pos); +s16 Actor_FocusYawTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Yaw(&actorA->focus.pos, &actorB->focus.pos); } -s16 func_8002DAC0(Actor* actor, Vec3f* arg1) { - return Math_Vec3f_Yaw(&actor->posRot.pos, arg1); +s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_Yaw(&actor->world.pos, refPoint); } -s16 func_8002DAE0(Actor* actorA, Actor* actorB) { - return Math_Vec3f_Pitch(&actorA->posRot.pos, &actorB->posRot.pos); +s16 Actor_WorldPitchTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Pitch(&actorA->world.pos, &actorB->world.pos); } -s16 func_8002DB04(Actor* actorA, Actor* actorB) { - return Math_Vec3f_Pitch(&actorA->posRot2.pos, &actorB->posRot2.pos); +s16 Actor_FocusPitchTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Pitch(&actorA->focus.pos, &actorB->focus.pos); } -s16 func_8002DB28(Actor* actor, Vec3f* arg1) { - return Math_Vec3f_Pitch(&actor->posRot.pos, arg1); +s16 Actor_WorldPitchTowardPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_Pitch(&actor->world.pos, refPoint); } -f32 func_8002DB48(Actor* actorA, Actor* actorB) { - return Math_Vec3f_DistXYZ(&actorA->posRot.pos, &actorB->posRot.pos); +f32 Actor_WorldDistXYZToActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_DistXYZ(&actorA->world.pos, &actorB->world.pos); } -f32 func_8002DB6C(Actor* actor, Vec3f* arg1) { - return Math_Vec3f_DistXYZ(&actor->posRot.pos, arg1); +f32 Actor_WorldDistXYZToPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_DistXYZ(&actor->world.pos, refPoint); } -f32 func_8002DB8C(Actor* actorA, Actor* actorB) { - return Math_Vec3f_DistXZ(&actorA->posRot.pos, &actorB->posRot.pos); +f32 Actor_WorldDistXZToActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_DistXZ(&actorA->world.pos, &actorB->world.pos); } -f32 func_8002DBB0(Actor* actor, Vec3f* arg1) { - return Math_Vec3f_DistXZ(&actor->posRot.pos, arg1); +f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_DistXZ(&actor->world.pos, refPoint); } void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) { @@ -941,16 +942,16 @@ void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) { cosRot2Y = Math_CosS(actor->shape.rot.y); sinRot2Y = Math_SinS(actor->shape.rot.y); - deltaX = arg2->x - actor->posRot.pos.x; - deltaZ = arg2->z - actor->posRot.pos.z; + deltaX = arg2->x - actor->world.pos.x; + deltaZ = arg2->z - actor->world.pos.z; result->x = (deltaX * cosRot2Y) - (deltaZ * sinRot2Y); result->z = (deltaX * sinRot2Y) + (deltaZ * cosRot2Y); - result->y = arg2->y - actor->posRot.pos.y; + result->y = arg2->y - actor->world.pos.y; } f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) { - return actorB->posRot.pos.y - actorA->posRot.pos.y; + return actorB->world.pos.y - actorA->world.pos.y; } f32 Player_GetHeight(Player* player) { @@ -1002,7 +1003,7 @@ s32 func_8002DDF4(GlobalContext* globalCtx) { void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { ArmsHook* hookshot; - hookshot = (ArmsHook*)Actor_Find(&globalCtx->actorCtx, ACTOR_ARMS_HOOK, ACTORTYPE_ITEMACTION); + hookshot = (ArmsHook*)Actor_Find(&globalCtx->actorCtx, ACTOR_ARMS_HOOK, ACTORCAT_ITEMACTION); hookshot->grabbed = actorB; hookshot->grabbedDistDiff.x = 0.0f; hookshot->grabbedDistDiff.y = 0.0f; @@ -1062,7 +1063,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->yawTowardsLink + 0x8000) - player->actor.shape.rot.y; + s16 var = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; if (ABS(var) < arg1) { return 1; @@ -1072,7 +1073,7 @@ s32 func_8002DFC8(Actor* actor, s16 arg1, GlobalContext* globalCtx) { } s32 func_8002E020(Actor* actorA, Actor* actorB, s16 arg2) { - s16 var = (s16)(func_8002DA78(actorA, actorB) + 0x8000) - actorB->shape.rot.y; + s16 var = (s16)(Actor_WorldYawTowardActor(actorA, actorB) + 0x8000) - actorB->shape.rot.y; if (ABS(var) < arg2) { return 1; @@ -1082,7 +1083,7 @@ s32 func_8002E020(Actor* actorA, Actor* actorB, s16 arg2) { } s32 func_8002E084(Actor* actor, s16 arg1) { - s16 var = actor->yawTowardsLink - actor->shape.rot.y; + s16 var = actor->yawTowardsPlayer - actor->shape.rot.y; if (ABS(var) < arg1) { return 1; @@ -1092,7 +1093,7 @@ s32 func_8002E084(Actor* actor, s16 arg1) { } s32 func_8002E0D0(Actor* actorA, Actor* actorB, s16 arg2) { - s16 var = func_8002DA78(actorA, actorB) - actorA->shape.rot.y; + s16 var = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y; if (ABS(var) < arg2) { return 1; @@ -1102,10 +1103,10 @@ s32 func_8002E0D0(Actor* actorA, Actor* actorB, s16 arg2) { } s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) { - s16 var = actor->yawTowardsLink - actor->shape.rot.y; + s16 var = actor->yawTowardsPlayer - actor->shape.rot.y; if (ABS(var) < arg2) { - f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistToLink) + SQ(actor->yDistToLink)); + f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer)); if (xyzDistanceFromLink < arg1) { return 1; @@ -1116,8 +1117,8 @@ s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) { } s32 func_8002E1A8(Actor* actorA, Actor* actorB, f32 arg2, s16 arg3) { - if (func_8002DB48(actorA, actorB) < arg2) { - s16 var = func_8002DA78(actorA, actorB) - actorA->shape.rot.y; + if (Actor_WorldDistXYZToActor(actorA, actorB) < arg2) { + s16 var = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y; if (ABS(var) < arg3) { return 1; @@ -1142,40 +1143,41 @@ s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) { return 1; } -CollisionPoly* D_8015BBA0; -s32 D_8015BBA4; +CollisionPoly* sCurCeilingPoly; +s32 sCurCeilingBgId; s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) { - f32 sp34; - s32 bgId; + f32 floorHeightDiff; + s32 floorBgId; arg2->y += 50.0f; - actor->groundY = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &bgId, actor, arg2); + actor->floorHeight = + BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); actor->bgCheckFlags &= ~0x0086; - if (actor->groundY <= BGCHECK_Y_MIN) { + if (actor->floorHeight <= BGCHECK_Y_MIN) { return func_8002E234(actor, BGCHECK_Y_MIN, arg3); } - sp34 = actor->groundY - actor->posRot.pos.y; - actor->floorPolySource = bgId; + floorHeightDiff = actor->floorHeight - actor->world.pos.y; + actor->floorBgId = floorBgId; - if (sp34 >= 0.0f) { + if (floorHeightDiff >= 0.0f) { // actor is on or below the ground actor->bgCheckFlags |= 0x80; if (actor->bgCheckFlags & 0x10) { - if (bgId != D_8015BBA4) { - if (sp34 > 15.0f) { + if (floorBgId != sCurCeilingBgId) { + if (floorHeightDiff > 15.0f) { actor->bgCheckFlags |= 0x100; } } else { - actor->posRot.pos.x = actor->pos4.x; - actor->posRot.pos.z = actor->pos4.z; + actor->world.pos.x = actor->prevPos.x; + actor->world.pos.z = actor->prevPos.z; } } - actor->posRot.pos.y = actor->groundY; + actor->world.pos.y = actor->floorHeight; if (actor->velocity.y <= 0.0f) { if (!(actor->bgCheckFlags & 0x1)) { @@ -1187,81 +1189,81 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) } actor->bgCheckFlags |= 0x1; - func_80043334(&globalCtx->colCtx, actor, actor->floorPolySource); + func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); } - } else { - if ((actor->bgCheckFlags & 0x1) && (sp34 >= -11.0f)) { - func_80043334(&globalCtx->colCtx, actor, actor->floorPolySource); + } else { // actor is above ground + if ((actor->bgCheckFlags & 0x1) && (floorHeightDiff >= -11.0f)) { + func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); } - return func_8002E234(actor, sp34, arg3); + return func_8002E234(actor, floorHeightDiff, arg3); } return 1; } -void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f32 arg4, s32 arg5) { +void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f32 arg4, s32 arg5) { f32 sp74; s32 pad; Vec3f sp64; s32 bgId; - CollisionPoly* sp5C; + CollisionPoly* wallPoly; f32 sp58; WaterBox* waterBox; - f32 sp50; + f32 waterBoxYSurface; Vec3f ripplePos; - sp74 = actor->posRot.pos.y - actor->pos4.y; + sp74 = actor->world.pos.y - actor->prevPos.y; - if ((actor->floorPolySource != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { - func_800433A4(&globalCtx->colCtx, actor->floorPolySource, actor); + if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { + func_800433A4(&globalCtx->colCtx, actor->floorBgId, actor); } if (arg5 & 1) { - if ((!(arg5 & 0x80) && BgCheck_EntitySphVsWall3(&globalCtx->colCtx, &sp64, &actor->posRot.pos, &actor->pos4, + if ((!(arg5 & 0x80) && BgCheck_EntitySphVsWall3(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, arg3, &actor->wallPoly, &bgId, actor, arg2)) || - ((arg5 & 0x80) && BgCheck_EntitySphVsWall4(&globalCtx->colCtx, &sp64, &actor->posRot.pos, &actor->pos4, + ((arg5 & 0x80) && BgCheck_EntitySphVsWall4(&globalCtx->colCtx, &sp64, &actor->world.pos, &actor->prevPos, arg3, &actor->wallPoly, &bgId, actor, arg2))) { - sp5C = actor->wallPoly; - Math_Vec3f_Copy(&actor->posRot.pos, &sp64); - actor->wallPolyRot = Math_Atan2S(sp5C->normal.z, sp5C->normal.x); + wallPoly = actor->wallPoly; + Math_Vec3f_Copy(&actor->world.pos, &sp64); + actor->wallYaw = Math_Atan2S(wallPoly->normal.z, wallPoly->normal.x); actor->bgCheckFlags |= 8; - actor->wallPolySource = bgId; + actor->wallBgId = bgId; } else { actor->bgCheckFlags &= ~8; } } - sp64.x = actor->posRot.pos.x; - sp64.z = actor->posRot.pos.z; + sp64.x = actor->world.pos.x; + sp64.z = actor->world.pos.z; if (arg5 & 2) { - sp64.y = actor->pos4.y + 10.0f; - if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp58, &sp64, (arg4 + sp74) - 10.0f, &D_8015BBA0, - &D_8015BBA4, actor)) { + sp64.y = actor->prevPos.y + 10.0f; + if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp58, &sp64, (arg4 + sp74) - 10.0f, &sCurCeilingPoly, + &sCurCeilingBgId, actor)) { actor->bgCheckFlags |= 0x10; - actor->posRot.pos.y = (sp58 + sp74) - 10.0f; + actor->world.pos.y = (sp58 + sp74) - 10.0f; } else { actor->bgCheckFlags &= ~0x10; } } if (arg5 & 4) { - sp64.y = actor->pos4.y; + sp64.y = actor->prevPos.y; func_8002E2AC(globalCtx, actor, &sp64, arg5); - sp50 = actor->posRot.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->posRot.pos.x, actor->posRot.pos.z, &sp50, - &waterBox)) { - actor->yDistToWater = sp50 - actor->posRot.pos.y; + waterBoxYSurface = actor->world.pos.y; + if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->world.pos.x, actor->world.pos.z, + &waterBoxYSurface, &waterBox)) { + actor->yDistToWater = waterBoxYSurface - actor->world.pos.y; if (actor->yDistToWater < 0.0f) { actor->bgCheckFlags &= ~0x60; } else { if (!(actor->bgCheckFlags & 0x20)) { actor->bgCheckFlags |= 0x40; if (!(arg5 & 0x40)) { - ripplePos.x = actor->posRot.pos.x; - ripplePos.y = sp50; - ripplePos.z = actor->posRot.pos.z; + ripplePos.x = actor->world.pos.x; + ripplePos.y = waterBoxYSurface; + ripplePos.z = actor->world.pos.z; EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 0); EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 4); EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 8); @@ -1343,7 +1345,7 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { globalCtx->view.eye.y, globalCtx->view.eye.z); } - hilite = func_8002EABC(&actor->posRot.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EABC(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); if (flag != 0) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); @@ -1369,7 +1371,7 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { lightDir.y = globalCtx->envCtx.unk_2B; lightDir.z = globalCtx->envCtx.unk_2C; - hilite = func_8002EB44(&actor->posRot.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + hilite = func_8002EB44(&actor->world.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); if (flag != 0) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); @@ -1385,22 +1387,22 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { } } -PosRot* func_8002EEE4(PosRot* arg0, Actor* actor) { - *arg0 = actor->posRot2; +PosRot* Actor_GetFocus(PosRot* dest, Actor* actor) { + *dest = actor->focus; - return arg0; + return dest; } -PosRot* func_8002EF14(PosRot* arg0, Actor* actor) { - *arg0 = actor->posRot; +PosRot* Actor_GetWorld(PosRot* dest, Actor* actor) { + *dest = actor->world; - return arg0; + return dest; } -PosRot* func_8002EF44(PosRot* arg0, Actor* actor) { +PosRot* Actor_GetWorldPosShapeRot(PosRot* arg0, Actor* actor) { PosRot sp1C; - Math_Vec3f_Copy(&sp1C.pos, &actor->posRot.pos); + Math_Vec3f_Copy(&sp1C.pos, &actor->world.pos); sp1C.rot = actor->shape.rot; *arg0 = sp1C; @@ -1412,14 +1414,15 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { s16 yawTempAbs; f32 ret; - yawTemp = (s16)(actor->yawTowardsLink - 0x8000) - arg2; + yawTemp = (s16)(actor->yawTowardsPlayer - 0x8000) - arg2; yawTempAbs = ABS(yawTemp); if (player->unk_664 != NULL) { if ((yawTempAbs > 0x4000) || (actor->flags & 0x8000000)) { return FLT_MAX; } else { - ret = actor->xyzDistToLinkSq - actor->xyzDistToLinkSq * 0.8f * ((0x4000 - yawTempAbs) * 3.0517578125e-05f); + ret = actor->xyzDistToPlayerSq - + actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawTempAbs) * 3.0517578125e-05f); return ret; } } @@ -1428,7 +1431,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { return FLT_MAX; } - return actor->xyzDistToLinkSq; + return actor->xyzDistToPlayerSq; } typedef struct { @@ -1446,7 +1449,7 @@ TargetRangeParams D_80115FF8[] = { }; u32 func_8002F090(Actor* actor, f32 arg1) { - return arg1 < D_80115FF8[actor->unk_1F].rangeSq; + return arg1 < D_80115FF8[actor->targetMode].rangeSq; } s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { @@ -1459,16 +1462,16 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { } if (!flag) { - var = (s16)(actor->yawTowardsLink - 0x8000) - player->actor.shape.rot.y; + var = (s16)(actor->yawTowardsPlayer - 0x8000) - player->actor.shape.rot.y; abs_var = ABS(var); if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { dist = FLT_MAX; } else { - dist = actor->xyzDistToLinkSq; + dist = actor->xyzDistToPlayerSq; } - return !func_8002F090(actor, D_80115FF8[actor->unk_1F].leashScale * dist); + return !func_8002F090(actor, D_80115FF8[actor->targetMode].leashScale * dist); } return 0; @@ -1488,14 +1491,14 @@ 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->yDistToLink)) || (player->targetActorDistance < actor->xzDistToLink) || - (arg2 < actor->xzDistToLink)))) { + (!actor->isTargeted && + ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || + (arg2 < actor->xzDistToPlayer)))) { return 0; } player->targetActor = actor; - player->targetActorDistance = actor->xzDistToLink; + player->targetActorDistance = actor->xzDistToPlayer; player->exchangeItemId = exchangeItemId; return 1; @@ -1510,7 +1513,7 @@ s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) { } s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) { - f32 var1 = 50.0f + actor->colChkInfo.unk_10; + f32 var1 = 50.0f + actor->colChkInfo.cylRadius; return func_8002F2CC(actor, globalCtx, var1); } @@ -1532,7 +1535,7 @@ void func_8002F374(GlobalContext* globalCtx, Actor* actor, s16* arg2, s16* arg3) Vec3f sp1C; f32 sp18; - func_8002BE04(globalCtx, &actor->posRot2.pos, &sp1C, &sp18); + func_8002BE04(globalCtx, &actor->focus.pos, &sp1C, &sp18); *arg2 = sp1C.x * sp18 * 160.0f + 160.0f; *arg3 = sp1C.y * sp18 * -120.0f + 120.0f; } @@ -1554,8 +1557,8 @@ 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->xzDistToLink < xzRange) && (fabsf(actor->yDistToLink) < yRange)) { - yawDiff = actor->yawTowardsLink - player->actor.shape.rot.y; + if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { + yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; absYawDiff = ABS(yawDiff); if ((getItemId != GI_NONE) || (player->getItemDirection < absYawDiff)) { player->getItemId = getItemId; @@ -1603,8 +1606,8 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { Player* player = PLAYER; - if (actor->xyzDistToLinkSq < player->unk_6A4) { - player->unk_6A4 = actor->xyzDistToLinkSq; + if (actor->xyzDistToPlayerSq < player->unk_6A4) { + player->unk_6A4 = actor->xyzDistToPlayerSq; } } @@ -1680,7 +1683,7 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) { sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; } } else { - sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, actor->floorPoly, actor->floorPolySource); + sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, actor->floorPoly, actor->floorBgId); } func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); @@ -1982,7 +1985,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorCtx->absoluteSpace = NULL; Actor_SpawnEntry(actorCtx, actorEntry, globalCtx); - func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorList[ACTORTYPE_PLAYER].first, globalCtx); + func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, globalCtx); func_8002FA60(globalCtx); } @@ -2029,8 +2032,8 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { if (KREG(0) == -100) { refActor = &PLAYER->actor; KREG(0) = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->posRot.pos.x, - refActor->posRot.pos.y + 100.0f, refActor->posRot.pos.z, 0, 0, 0, 1); + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, + refActor->world.pos.y + 100.0f, refActor->world.pos.z, 0, 0, 0, 1); } sp80 = &D_80116068[0]; @@ -2043,13 +2046,13 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp74 = player->targetActor; } - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, sp80++) { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, sp80++) { unkCondition = (*sp80 & player->stateFlags1); - actor = actorCtx->actorList[i].first; + actor = actorCtx->actorLists[i].head; while (actor != NULL) { - if (actor->posRot.pos.y < -25000.0f) { - actor->posRot.pos.y = -25000.0f; + if (actor->world.pos.y < -25000.0f) { + actor->world.pos.y = -25000.0f; } actor->sfx = 0; @@ -2077,28 +2080,28 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actor->next; } } else { - Math_Vec3f_Copy(&actor->pos4, &actor->posRot.pos); - actor->xzDistToLink = func_8002DB8C(actor, &player->actor); - actor->yDistToLink = Actor_HeightDiff(actor, &player->actor); - actor->xyzDistToLinkSq = SQ(actor->xzDistToLink) + SQ(actor->yDistToLink); + Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos); + actor->xzDistToPlayer = Actor_WorldDistXZToActor(actor, &player->actor); + actor->yDistToPlayer = Actor_HeightDiff(actor, &player->actor); + actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer); - actor->yawTowardsLink = func_8002DA78(actor, &player->actor); + actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor); actor->flags &= ~0x1000000; if ((DECR(actor->freezeTimer) == 0) && (actor->flags & 0x50)) { if (actor == player->unk_664) { - actor->unk_10C = 1; + actor->isTargeted = true; } else { - actor->unk_10C = 0; + actor->isTargeted = false; } - if ((actor->unk_10D != 0) && (player->unk_664 == NULL)) { - actor->unk_10D = 0; + if ((actor->targetPriority != 0) && (player->unk_664 == NULL)) { + actor->targetPriority = 0; } Actor_SetObjectDependency(globalCtx, actor); - if (actor->dmgEffectTimer != 0) { - actor->dmgEffectTimer--; + if (actor->colorFilterTimer != 0) { + actor->colorFilterTimer--; } actor->update(actor, globalCtx); func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); @@ -2110,7 +2113,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - if (i == ACTORTYPE_BG) { + if (i == ACTORCAT_BG) { DynaPoly_Setup(globalCtx, &globalCtx->colCtx.dyna); } } @@ -2169,17 +2172,17 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->posRot.pos); + Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->world.pos); Lights_Draw(lights, globalCtx->state.gfxCtx); if (actor->flags & 0x1000) { - func_800D1694(actor->posRot.pos.x + globalCtx->mainCamera.skyboxOffset.x, - actor->posRot.pos.y + - (f32)((actor->shape.unk_08 * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), - actor->posRot.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); + func_800D1694(actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, + actor->world.pos.y + + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), + actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); } else { - func_800D1694(actor->posRot.pos.x, actor->posRot.pos.y + (actor->shape.unk_08 * actor->scale.y), - actor->posRot.pos.z, &actor->shape.rot); + func_800D1694(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), + actor->world.pos.z, &actor->shape.rot); } Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); @@ -2188,36 +2191,36 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - if (actor->dmgEffectTimer != 0) { + if (actor->colorFilterTimer != 0) { Color_RGBA8 sp2C = { 0, 0, 0, 255 }; - 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; + if (actor->colorFilterParams & 0x8000) { + sp2C.r = sp2C.g = sp2C.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7; + } else if (actor->colorFilterParams & 0x4000) { + sp2C.r = ((actor->colorFilterParams & 0x1F00) >> 5) | 7; } else { - sp2C.b = ((actor->dmgEffectParams & 0x1F00) >> 5) | 7; + sp2C.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7; } - if (actor->dmgEffectParams & 0x2000) { - func_80026860(globalCtx, &sp2C, actor->dmgEffectTimer, actor->dmgEffectParams & 0xFF); + if (actor->colorFilterParams & 0x2000) { + func_80026860(globalCtx, &sp2C, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } else { - func_80026400(globalCtx, &sp2C, actor->dmgEffectTimer, actor->dmgEffectParams & 0xFF); + func_80026400(globalCtx, &sp2C, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } } actor->draw(actor, globalCtx); - if (actor->dmgEffectTimer != 0) { - if (actor->dmgEffectParams & 0x2000) { + if (actor->colorFilterTimer != 0) { + if (actor->colorFilterParams & 0x2000) { func_80026A6C(globalCtx); } else { func_80026608(globalCtx); } } - if (actor->shape.shadowDrawFunc != NULL) { - actor->shape.shadowDrawFunc(actor, lights, globalCtx); + if (actor->shape.shadowDraw != NULL) { + actor->shape.shadowDraw(actor, lights, globalCtx); } CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6119); @@ -2358,10 +2361,10 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6336); - actorListEntry = &actorCtx->actorList[0]; + actorListEntry = &actorCtx->actorLists[0]; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, actorListEntry++) { - actor = actorListEntry->first; + for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, actorListEntry++) { + actor = actorListEntry->head; while (actor != NULL) { ActorOverlay* overlayEntry = actor->overlayEntry; @@ -2373,7 +2376,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { HREG(66) = i; if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &actor->posRot.pos, &actor->projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } @@ -2391,7 +2394,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - actor->isDrawn = 0; + actor->isDrawn = false; if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) { @@ -2406,7 +2409,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } else { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { Actor_Draw(globalCtx, actor); - actor->isDrawn = 1; + actor->isDrawn = true; } } } @@ -2454,8 +2457,8 @@ void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { - actor = actorCtx->actorList[i].first; + for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { + actor = actorCtx->actorLists[i].head; while (actor != NULL) { if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); @@ -2465,14 +2468,14 @@ void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { } } -u8 sEnemyActorTypes[] = { ACTORTYPE_ENEMY, ACTORTYPE_BOSS }; +u8 sEnemyActorCategories[] = { ACTORCAT_ENEMY, ACTORCAT_BOSS }; void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s32 duration) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(sEnemyActorTypes); i++) { - actor = actorCtx->actorList[sEnemyActorTypes[i]].first; + for (i = 0; i < ARRAY_COUNT(sEnemyActorCategories); i++) { + actor = actorCtx->actorLists[sEnemyActorCategories[i]].head; while (actor != NULL) { actor->freezeTimer = duration; actor = actor->next; @@ -2484,8 +2487,8 @@ void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { - actor = actorCtx->actorList[i].first; + for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { + actor = actorCtx->actorLists[i].head; while (actor != NULL) { if ((actor->room >= 0) && (actor->room != globalCtx->roomCtx.curRoom.num) && (actor->room != globalCtx->roomCtx.prevRoom.num)) { @@ -2513,11 +2516,11 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { - actor = actorCtx->actorList[i].first; + for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { + actor = actorCtx->actorLists[i].head; while (actor != NULL) { Actor_Delete(actorCtx, actor, globalCtx); - actor = actorCtx->actorList[i].first; + actor = actorCtx->actorLists[i].head; } } @@ -2537,57 +2540,57 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { } /** - * Adds a given actor instance at the front of the actor list of the specified type. - * Also sets the actor instance as being of that type. + * Adds a given actor instance at the front of the actor list of the specified category. + * Also sets the actor instance as being of that category. */ -void Actor_AddToTypeList(ActorContext* actorCtx, Actor* actorToAdd, u8 actorType) { - Actor* prevFirstActor; +void Actor_AddToCategory(ActorContext* actorCtx, Actor* actorToAdd, u8 actorCategory) { + Actor* prevHead; - actorToAdd->type = actorType; + actorToAdd->category = actorCategory; actorCtx->total++; - actorCtx->actorList[actorType].length++; - prevFirstActor = actorCtx->actorList[actorType].first; + actorCtx->actorLists[actorCategory].length++; + prevHead = actorCtx->actorLists[actorCategory].head; - if (prevFirstActor != NULL) { - prevFirstActor->prev = actorToAdd; + if (prevHead != NULL) { + prevHead->prev = actorToAdd; } - actorCtx->actorList[actorType].first = actorToAdd; - actorToAdd->next = prevFirstActor; + actorCtx->actorLists[actorCategory].head = actorToAdd; + actorToAdd->next = prevHead; } /** * Removes a given actor instance from its actor list. * Also sets the temp clear flag of the current room if the actor removed was the last enemy loaded. */ -Actor* Actor_RemoveFromTypeList(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) { - Actor* newFirstActor; +Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) { + Actor* newHead; actorCtx->total--; - actorCtx->actorList[actorToRemove->type].length--; + actorCtx->actorLists[actorToRemove->category].length--; if (actorToRemove->prev != NULL) { actorToRemove->prev->next = actorToRemove->next; } else { - actorCtx->actorList[actorToRemove->type].first = actorToRemove->next; + actorCtx->actorLists[actorToRemove->category].head = actorToRemove->next; } - newFirstActor = actorToRemove->next; + newHead = actorToRemove->next; - if (newFirstActor != NULL) { - newFirstActor->prev = actorToRemove->prev; + if (newHead != NULL) { + newHead->prev = actorToRemove->prev; } actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && (actorToRemove->type == ACTORTYPE_ENEMY) && - (actorCtx->actorList[ACTORTYPE_ENEMY].length == 0)) { + if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); } - return newFirstActor; + return newHead; } void Actor_FreeOverlay(ActorOverlay* actorOverlay) { @@ -2722,7 +2725,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); if ((objBankIndex < 0) || - ((actorInit->type == ACTORTYPE_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) { + ((actorInit->category == ACTORCAT_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) { // Translates to: "NO DATA BANK!! (profilep->bank=%d)" osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objBankIndex, actorInit->objectId); @@ -2768,15 +2771,15 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId actor->update = actorInit->update; actor->draw = actorInit->draw; actor->room = globalCtx->roomCtx.curRoom.num; - actor->initPosRot.pos.x = posX; - actor->initPosRot.pos.y = posY; - actor->initPosRot.pos.z = posZ; - actor->initPosRot.rot.x = rotX; - actor->initPosRot.rot.y = rotY; - actor->initPosRot.rot.z = rotZ; + actor->home.pos.x = posX; + actor->home.pos.y = posY; + actor->home.pos.z = posZ; + actor->home.rot.x = rotX; + actor->home.rot.y = rotY; + actor->home.rot.z = rotZ; actor->params = params; - Actor_AddToTypeList(actorCtx, actor, actorInit->type); + Actor_AddToCategory(actorCtx, actor, actorInit->category); temp = gSegments[6]; Actor_Init(actor, globalCtx); @@ -2838,7 +2841,7 @@ Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalCo Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) { char* name; Player* player; - Actor* newFirstActor; + Actor* newHead; ActorOverlay* overlayEntry; player = PLAYER; @@ -2871,7 +2874,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC func_800F89E8(&actor->projectedPos); Actor_Destroy(actor, globalCtx); - newFirstActor = Actor_RemoveFromTypeList(globalCtx, actorCtx, actor); + newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor); ZeldaArena_FreeDebug(actor, "../z_actor.c", 7242); @@ -2893,7 +2896,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC Actor_FreeOverlay(overlayEntry); } - return newFirstActor; + return newHead; } s32 func_80032880(GlobalContext* globalCtx, Actor* actor) { @@ -2912,7 +2915,7 @@ f32 D_8015BBF4; s32 D_8015BBF8; s16 D_8015BBFC; -void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorType) { +void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorCategory) { f32 var; Actor* actor; Actor* sp84; @@ -2920,27 +2923,27 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla UNK_TYPE sp7C; Vec3f sp70; - actor = actorCtx->actorList[actorType].first; + actor = actorCtx->actorLists[actorCategory].head; sp84 = player->unk_664; while (actor != NULL) { if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) { - if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && (actor->xyzDistToLinkSq < 250000.0f) && - (actor->xyzDistToLinkSq < D_8015BBF4)) { + if ((actorCategory == ACTORCAT_ENEMY) && ((actor->flags & 5) == 5) && + (actor->xyzDistToPlayerSq < 250000.0f) && (actor->xyzDistToPlayerSq < D_8015BBF4)) { actorCtx->targetCtx.unk_90 = actor; - D_8015BBF4 = actor->xyzDistToLinkSq; + D_8015BBF4 = actor->xyzDistToPlayerSq; } if (actor != sp84) { var = func_8002EFC0(actor, player, D_8015BBFC); if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(globalCtx, actor) && - (!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.posRot2.pos, &actor->posRot2.pos, - &sp70, &sp80, 1, 1, 1, 1, &sp7C) || + (!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.focus.pos, &actor->focus.pos, &sp70, + &sp80, 1, 1, 1, 1, &sp7C) || SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp80, sp7C))) { - if (actor->unk_10D != 0) { - if (actor->unk_10D < D_8015BBF8) { + if (actor->targetPriority != 0) { + if (actor->targetPriority < D_8015BBF8) { D_8015BBEC = actor; - D_8015BBF8 = actor->unk_10D; + D_8015BBF8 = actor->targetPriority; } } else { D_8015BBE8 = actor; @@ -2955,8 +2958,8 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla } u8 D_801160A0[] = { - ACTORTYPE_BOSS, ACTORTYPE_ENEMY, ACTORTYPE_BG, ACTORTYPE_EXPLOSIVES, ACTORTYPE_NPC, ACTORTYPE_ITEMACTION, - ACTORTYPE_CHEST, ACTORTYPE_SWITCH, ACTORTYPE_PROP, ACTORTYPE_MISC, ACTORTYPE_DOOR, ACTORTYPE_SWITCH, + ACTORCAT_BOSS, ACTORCAT_ENEMY, ACTORCAT_BG, ACTORCAT_EXPLOSIVE, ACTORCAT_NPC, ACTORCAT_ITEMACTION, + ACTORCAT_CHEST, ACTORCAT_SWITCH, ACTORCAT_PROP, ACTORCAT_MISC, ACTORCAT_DOOR, ACTORCAT_SWITCH, }; Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player) { @@ -2996,10 +2999,10 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a } /** - * Finds the first actor instance of a specified id and type if there is one. + * Finds the first actor instance of a specified ID and category if there is one. */ -Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorType) { - Actor* actor = actorCtx->actorList[actorType].first; +Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory) { + Actor* actor = actorCtx->actorLists[actorCategory].head; while (actor != NULL) { if (actorId == actor->id) { @@ -3013,7 +3016,7 @@ Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorType) { void func_80032C7C(GlobalContext* globalCtx, Actor* actor) { globalCtx->actorCtx.unk_00 = 5; - Audio_PlaySoundAtPosition(globalCtx, &actor->posRot.pos, 20, NA_SE_EN_LAST_DAMAGE); + Audio_PlaySoundAtPosition(globalCtx, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); } s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { @@ -3156,7 +3159,7 @@ void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3 s32 i; var = (Rand_ZeroOne() - 0.5f) * 6.28f; - pos.y = actor->groundY; + pos.y = actor->floorHeight; accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f; for (i = arg4; i >= 0; i--) { @@ -3202,7 +3205,7 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1 } Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) { - if ((collider->acFlags & AC_HIT) && (collider->ac->type == ACTORTYPE_EXPLOSIVES)) { + if ((collider->acFlags & AC_HIT) && (collider->ac->category == ACTORCAT_EXPLOSIVE)) { collider->acFlags &= ~AC_HIT; return collider->ac; } @@ -3211,13 +3214,13 @@ Actor* Actor_GetCollidedExplosive(GlobalContext* globalCtx, Collider* collider) } Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { - Actor* actor = globalCtx->actorCtx.actorList[ACTORTYPE_EXPLOSIVES].first; + Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (actor != NULL) { if ((actor == explosiveActor) || (actor->params != 1)) { actor = actor->next; } else { - if (func_8002DB48(explosiveActor, actor) <= (actor->shape.rot.z * 10) + 80.0f) { + if (Actor_WorldDistXYZToActor(explosiveActor, actor) <= (actor->shape.rot.z * 10) + 80.0f) { return actor; } else { actor = actor->next; @@ -3229,12 +3232,12 @@ Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { } /** - * Dynamically changes the type of a given actor instance. - * This is done by moving it to the corresponding type list and setting its type variable accordingly. + * Dynamically changes the category of a given actor instance. + * This is done by moving it to the corresponding category list and setting its category variable accordingly. */ -void Actor_ChangeType(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorType) { - Actor_RemoveFromTypeList(globalCtx, actorCtx, actor); - Actor_AddToTypeList(actorCtx, actor, actorType); +void Actor_ChangeCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { + Actor_RemoveFromCategory(globalCtx, actorCtx, actor); + Actor_AddToCategory(actorCtx, actor, actorCategory); } typedef struct { @@ -3253,27 +3256,27 @@ Actor* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg2) { Vec3f sp84; Actor* actor; - actor = globalCtx->actorCtx.actorList[ACTORTYPE_ITEMACTION].first; + actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (actor != NULL) { if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) { actor = actor->next; } else { itemActor = (Actor_80033780*)actor; - if ((arg2 < Math_Vec3f_DistXYZ(&refActor->posRot.pos, &itemActor->actor.posRot.pos)) || + if ((arg2 < Math_Vec3f_DistXYZ(&refActor->world.pos, &itemActor->actor.world.pos)) || (itemActor->unk_210 == 0)) { actor = actor->next; } else { - deltaX = Math_SinS(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f); + deltaX = Math_SinS(itemActor->actor.world.rot.y) * (itemActor->actor.speedXZ * 10.0f); deltaY = itemActor->actor.velocity.y + (itemActor->actor.gravity * 10.0f); - deltaZ = Math_CosS(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f); + deltaZ = Math_CosS(itemActor->actor.world.rot.y) * (itemActor->actor.speedXZ * 10.0f); - spA8.x = itemActor->actor.posRot.pos.x + deltaX; - spA8.y = itemActor->actor.posRot.pos.y + deltaY; - spA8.z = itemActor->actor.posRot.pos.z + deltaZ; + spA8.x = itemActor->actor.world.pos.x + deltaX; + spA8.y = itemActor->actor.world.pos.y + deltaY; + spA8.z = itemActor->actor.world.pos.z + deltaZ; - if (CollisionCheck_CylSideVsLineSeg(refActor->colChkInfo.unk_10, refActor->colChkInfo.unk_12, 0.0f, - &refActor->posRot.pos, &itemActor->actor.posRot.pos, &spA8, &sp90, - &sp84)) { + if (CollisionCheck_CylSideVsLineSeg(refActor->colChkInfo.cylRadius, refActor->colChkInfo.cylHeight, + 0.0f, &refActor->world.pos, &itemActor->actor.world.pos, &spA8, + &sp90, &sp84)) { return &itemActor->actor; } else { actor = actor->next; @@ -3372,14 +3375,14 @@ s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) { f32 sp3C; Vec3f sp30; - Math_Vec3f_Copy(&sp30, &actor->posRot.pos); + Math_Vec3f_Copy(&sp30, &actor->world.pos); sp44 = actor->bgCheckFlags; sp40 = Math_SinS(arg3) * arg2; sp3C = Math_CosS(arg3) * arg2; - actor->posRot.pos.x += sp40; - actor->posRot.pos.z += sp3C; - func_8002E4B4(globalCtx, actor, 0.0f, 0.0f, 0.0f, 4); - Math_Vec3f_Copy(&actor->posRot.pos, &sp30); + actor->world.pos.x += sp40; + actor->world.pos.z += sp3C; + Actor_UpdateBgCheckInfo(globalCtx, actor, 0.0f, 0.0f, 0.0f, 4); + Math_Vec3f_Copy(&actor->world.pos, &sp30); ret = actor->bgCheckFlags & 1; actor->bgCheckFlags = sp44; @@ -3390,7 +3393,7 @@ s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) { s32 func_80033A84(GlobalContext* globalCtx, Actor* actor) { Player* player = PLAYER; - if ((player->stateFlags1 & 0x10) && (actor->unk_10C != 0)) { + if ((player->stateFlags1 & 0x10) && actor->isTargeted) { return 1; } else { return 0; @@ -3400,7 +3403,7 @@ s32 func_80033A84(GlobalContext* globalCtx, Actor* actor) { s32 func_80033AB8(GlobalContext* globalCtx, Actor* actor) { Player* player = PLAYER; - if ((player->stateFlags1 & 0x10) && (actor->unk_10C == 0)) { + if ((player->stateFlags1 & 0x10) && !actor->isTargeted) { return 1; } else { return 0; @@ -3475,9 +3478,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->xyzDistToLinkSq, 0xFF, 0x14, 0x96); + func_800AA000(actor->xyzDistToPlayerSq, 0xFF, 0x14, 0x96); } else { - func_800AA000(actor->xyzDistToLinkSq, 0xB4, 0x14, 0x64); + func_800AA000(actor->xyzDistToPlayerSq, 0xB4, 0x14, 0x64); } func_80033DB8(globalCtx, arg2, arg3); @@ -3568,8 +3571,8 @@ void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { Audio_PlayActorSound2(actor, NA_SE_EN_LIGHT_ARROW_HIT); } - actor->dmgEffectParams = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4; - actor->dmgEffectTimer = arg4; + actor->colorFilterParams = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4; + actor->colorFilterTimer = arg4; } Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) { @@ -3665,13 +3668,13 @@ void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 temp1; Vec3f sp30; - sp30.x = actor->posRot.pos.x; - sp30.y = actor->posRot.pos.y + arg1->unk_14; - sp30.z = actor->posRot.pos.z; + sp30.x = actor->world.pos.x; + sp30.y = actor->world.pos.y + arg1->unk_14; + sp30.z = actor->world.pos.z; sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18); sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18); - sp40 = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18) - actor->shape.rot.y; + sp40 = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18) - actor->shape.rot.y; temp1 = CLAMP(sp40, -arg2, arg2); Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1); @@ -3721,13 +3724,13 @@ s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, return 4; } - if (arg2 < Math_Vec3f_DistXYZ(&actor->posRot.pos, &arg1->unk_18)) { + if (arg2 < Math_Vec3f_DistXYZ(&actor->world.pos, &arg1->unk_18)) { arg1->unk_04 = 0; arg1->unk_06 = 0; return 1; } - var = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18); + var = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18); abs_var = ABS((s16)((f32)var - actor->shape.rot.y)); if (arg3 >= abs_var) { arg1->unk_04 = 0; @@ -3840,9 +3843,9 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { f32 var; if ((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) { - var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &globalCtx->view.eye) * 0.25f; + var = Math_Vec3f_DistXYZ(&actor->world.pos, &globalCtx->view.eye) * 0.25f; } else { - var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &player->actor.posRot.pos); + var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); } if (arg3 < var) { @@ -3908,7 +3911,8 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { break; } - func_8002E4B4(globalCtx, actor, actor->colChkInfo.unk_12, actor->colChkInfo.unk_10, actor->colChkInfo.unk_10, 0x1D); + Actor_UpdateBgCheckInfo(globalCtx, actor, actor->colChkInfo.cylHeight, actor->colChkInfo.cylRadius, + actor->colChkInfo.cylRadius, 0x1D); return ret; } @@ -3922,17 +3926,18 @@ u8 func_800353E8(GlobalContext* globalCtx) { } /** - * Finds the first actor instance of a specified id and type within a given range from an actor if there is one. - * If the id provided is -1, this will look for any actor of the specified type rather than a specific id. + * Finds the first actor instance of a specified ID and category within a given range from + * an actor if there is one. If the ID provided is -1, this will look for any actor of the + * specified category rather than a specific ID. */ -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorType, f32 range) { - Actor* actor = globalCtx->actorCtx.actorList[actorType].first; +Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorCategory, f32 range) { + Actor* actor = globalCtx->actorCtx.actorLists[actorCategory].head; while (actor != NULL) { if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) { actor = actor->next; } else { - if (func_8002DB48(refActor, actor) <= range) { + if (Actor_WorldDistXYZToActor(refActor, actor) <= range) { return actor; } else { actor = actor->next; @@ -3948,10 +3953,10 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s s16 var1; s16 var2; - var1 = (s16)(actor->yawTowardsLink + 0x8000) - player->actor.shape.rot.y; - var2 = actor->yawTowardsLink - arg5; + var1 = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; + var2 = actor->yawTowardsPlayer - arg5; - if ((actor->xzDistToLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { + if ((actor->xzDistToPlayer <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { return 1; } else { return 0; @@ -4009,29 +4014,29 @@ u8 Actor_ApplyDamage(Actor* actor) { void func_80035650(Actor* actor, ColliderInfo* colInfo, s32 freezeFlag) { if (colInfo->acHitInfo == NULL) { - actor->unk_116 = 0x00; + actor->dropFlag = 0x00; } else if (freezeFlag && (colInfo->acHitInfo->toucher.dmgFlags & 0x10060000)) { actor->freezeTimer = colInfo->acHitInfo->toucher.damage; - actor->unk_116 = 0x00; + actor->dropFlag = 0x00; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x0800) { - actor->unk_116 = 0x01; + actor->dropFlag = 0x01; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x1000) { - actor->unk_116 = 0x02; + actor->dropFlag = 0x02; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x4000) { - actor->unk_116 = 0x04; + actor->dropFlag = 0x04; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x8000) { - actor->unk_116 = 0x08; + actor->dropFlag = 0x08; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x10000) { - actor->unk_116 = 0x10; + actor->dropFlag = 0x10; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x2000) { - actor->unk_116 = 0x20; + actor->dropFlag = 0x20; } else if (colInfo->acHitInfo->toucher.dmgFlags & 0x80000) { if (freezeFlag) { actor->freezeTimer = colInfo->acHitInfo->toucher.damage; } - actor->unk_116 = 0x40; + actor->dropFlag = 0x40; } else { - actor->unk_116 = 0x00; + actor->dropFlag = 0x00; } } @@ -4040,7 +4045,7 @@ void func_8003573C(Actor* actor, ColliderJntSph* jntSph, s32 freezeFlag) { s32 flag; s32 i; - actor->unk_116 = 0x00; + actor->dropFlag = 0x00; for (i = jntSph->count - 1; i >= 0; i--) { curColInfo = &jntSph->elements[i].info; @@ -4069,7 +4074,7 @@ void func_8003573C(Actor* actor, ColliderJntSph* jntSph, s32 freezeFlag) { } else { flag = 0x00; } - actor->unk_116 |= flag; + actor->dropFlag |= flag; } } @@ -5416,18 +5421,18 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { return 0; } - var = actor->yawTowardsLink - actor->shape.rot.y; + var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { return 0; } - if ((actor->xyzDistToLinkSq > 25600.0f) && (actor->unk_10C == 0)) { + if ((actor->xyzDistToPlayerSq > 25600.0f) && !actor->isTargeted) { return 0; } - if (actor->xyzDistToLinkSq <= 6400.0f) { + if (actor->xyzDistToPlayerSq <= 6400.0f) { if (func_8002F2CC(actor, globalCtx, 80.0f)) { actor->textId = func_80037C30(globalCtx, arg2); } @@ -5453,8 +5458,8 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) { s16 sp34; s16 var; - sp36 = Math_Vec3f_Pitch(&actor->posRot2.pos, arg1); - sp34 = Math_Vec3f_Yaw(&actor->posRot2.pos, arg1) - actor->posRot.rot.y; + sp36 = Math_Vec3f_Pitch(&actor->focus.pos, arg1); + sp34 = Math_Vec3f_Yaw(&actor->focus.pos, arg1) - actor->world.rot.y; Math_SmoothStepToS(&arg2->x, sp36, 6, 2000, 1); arg2->x = (arg2->x < -6000) ? -6000 : ((arg2->x > 6000) ? 6000 : arg2->x); @@ -5479,11 +5484,11 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar s16 var; s16 abs_var; - actor->posRot2.pos = actor->posRot.pos; - actor->posRot2.pos.y += arg4; + actor->focus.pos = actor->world.pos; + actor->focus.pos.y += arg4; if (!(((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE))) { - var = actor->yawTowardsLink - actor->shape.rot.y; + var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); @@ -5494,7 +5499,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar if (((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE)) { sp2C = globalCtx->view.eye; } else { - sp2C = player->actor.posRot2.pos; + sp2C = player->actor.focus.pos; } func_80037FC8(actor, &sp2C, arg2, arg3); @@ -5509,10 +5514,10 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar s16 var; s16 abs_var; - actor->posRot2.pos = arg4; + actor->focus.pos = arg4; if (!(((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE))) { - var = actor->yawTowardsLink - actor->shape.rot.y; + var = actor->yawTowardsPlayer - actor->shape.rot.y; abs_var = ABS(var); if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); @@ -5523,7 +5528,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar if (((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) && (gSaveContext.entranceIndex == 0x00EE)) { sp24 = globalCtx->view.eye; } else { - sp24 = player->actor.posRot2.pos; + sp24 = player->actor.focus.pos; } func_80037FC8(actor, &sp24, arg2, arg3); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 775db6cde..d5f03badc 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -2507,10 +2507,10 @@ void BgActor_SetActor(BgActor* bgActor, Actor* actor, CollisionHeader* colHeader bgActor->prevTransform.scale = actor->scale; bgActor->prevTransform.rot = actor->shape.rot; bgActor->prevTransform.rot.x--; - bgActor->prevTransform.pos = actor->posRot.pos; + bgActor->prevTransform.pos = actor->world.pos; bgActor->curTransform.scale = actor->scale; bgActor->curTransform.rot = actor->shape.rot; - bgActor->curTransform.pos = actor->posRot.pos; + bgActor->curTransform.pos = actor->world.pos; } /** @@ -2742,8 +2742,8 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 actor = dyna->bgActors[bgId].actor; dyna->bgActors[bgId].dynaLookup.polyStartIndex = *polyStartIndex; dyna->bgActors[bgId].vtxStartIndex = *vtxStartIndex; - pos = actor->posRot.pos; - pos.y += actor->shape.unk_08 * actor->scale.y; + pos = actor->world.pos; + pos.y += actor->shape.yOffset * actor->scale.y; ScaleRotPos_SetValue(&dyna->bgActors[bgId].curTransform, &actor->scale, &actor->shape.rot, &pos); @@ -4494,7 +4494,7 @@ void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* col StaticLookup* lookup; player = PLAYER; - lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.posRot.pos); + lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos); if (AREG(23) != 0) { BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->floor, 0, 0, 255); } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 22b5ff338..3c3666a72 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -459,7 +459,7 @@ s32 Camera_GetDataIdxForPoly(Camera* camera, u32* bgId, CollisionPoly* poly) { PosRot playerPosRot; s32 ret; - func_8002EF44(&playerPosRot, &camera->player->actor); // unused. + Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); // unused. camDataIdx = SurfaceType_GetCamDataIndex(&camera->globalCtx->colCtx, poly, *bgId); if (func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) { @@ -481,7 +481,7 @@ Vec3s* Camera_GetCamBgDataUnderPlayer(Camera* camera, u16* dataCnt) { s32 bgId; PosRot playerPosShape; - func_8002EF44(&playerPosShape, &camera->player->actor); + Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); playerPosShape.pos.y += Player_GetHeight(camera->player); if (BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) { @@ -503,7 +503,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { WaterBox* waterBox; s32 ret; - func_8002EF44(&playerPosShape, &camera->player->actor); + Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor); *waterY = playerPosShape.pos.y; if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, @@ -538,7 +538,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) { f32 waterY; WaterBox* waterBox; - func_8002EF44(&playerPosRot, &camera->player->actor); + Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); waterY = playerPosRot.pos.y; if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, chkPos->x, chkPos->z, &waterY, @@ -1184,7 +1184,7 @@ s32 Camera_CalcAtForHorse(Camera* camera, VecSph* eyeAtDir, f32 yOffset, f32* yP playerHeight = Player_GetHeight(camera->player); player = camera->player; - func_8002EF44(&horsePosRot, player->rideActor); + Actor_GetWorldPosShapeRot(&horsePosRot, player->rideActor); if (EN_HORSE_CHECK_5((EnHorse*)player->rideActor)) { horsePosRot.pos.y -= 49.f; @@ -2171,7 +2171,7 @@ s32 Camera_Jump1(Camera* camera) { VecSph eyeDiffSph; VecSph eyeDiffTarget; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerPosRot2; + PosRot playerhead; s16 tangle; Jump1* jump1 = (Jump1*)camera->paramData; Jump1Anim* anim = &jump1->anim; @@ -2196,8 +2196,8 @@ s32 Camera_Jump1(Camera* camera) { Camera_CopyPREGToModeValues(camera); } - // playerPosRot2 never gets used. - func_8002EEE4(&playerPosRot2, &camera->player->actor); + // playerhead never gets used. + Actor_GetFocus(&playerhead, &camera->player->actor); OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye); OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext); @@ -2506,7 +2506,7 @@ s32 Camera_Jump3(Camera* camera) { f32 phi_f0; f32 phi_f2; f32 playerHeight; - PosRot playerPosRot2; + PosRot playerhead; f32 yNormal; f32 temp_f18; s32 modeSwitch; @@ -2514,7 +2514,7 @@ s32 Camera_Jump3(Camera* camera) { Jump3Anim* anim = &jump3->anim; playerHeight = Player_GetHeight(camera->player); - func_8002EEE4(&playerPosRot2, &camera->player->actor); + Actor_GetFocus(&playerhead, &camera->player->actor); modeSwitch = false; if (((camera->waterYPos - eye->y) < OREG(44) || (camera->animState == 0))) { @@ -2611,10 +2611,10 @@ s32 Camera_Jump3(Camera* camera) { } if (!(phi_f0 < 10.0f)) { - if (camera->waterYPos <= playerPosRot2.pos.y) { - phi_f2 = playerPosRot2.pos.y - camera->waterYPos; + if (camera->waterYPos <= playerhead.pos.y) { + phi_f2 = playerhead.pos.y - camera->waterYPos; } else { - phi_f2 = -(playerPosRot2.pos.y - camera->waterYPos); + phi_f2 = -(playerhead.pos.y - camera->waterYPos); } if (!(phi_f2 < 50.0f)) { camera->pitchUpdateRateInv = 100.0f; @@ -2829,7 +2829,7 @@ s32 Camera_Battle1(Camera* camera) { camera->atLERPStepScale = Camera_ClampLERPScale(camera, isOffGround ? batt1->atLERPScaleOffGround : batt1->atLERPScaleOnGround); } - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); if (anim->target != camera->target) { osSyncPrintf("camera: battle: change target %d -> " VT_FGCOL(BLUE) "%d" VT_RST "\n", anim->target->id, camera->target->id); @@ -3108,17 +3108,17 @@ s32 Camera_KeepOn1(Camera* camera) { switch (camera->paramFlags & 0x18) { case 8: - if ((camera->player->actor.type == 2) && (camera->player->interactRangeActor == camera->target)) { + if ((camera->player->actor.category == 2) && (camera->player->interactRangeActor == camera->target)) { PosRot sp54; - func_8002EEE4(&sp54, &camera->player->actor); + Actor_GetFocus(&sp54, &camera->player->actor); spC8.r = 60.0f; spC8.yaw = camera->playerPosRot.rot.y; spC8.pitch = 0x2EE0; Camera_Vec3fVecSphGeoAdd(&camera->targetPosRot.pos, &sp54.pos, &spC8); } else { - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); } - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); if (anim->unk_0C != camera->target) { anim->unk_0C = camera->target; camera->atLERPStepScale = 0.0f; @@ -3324,8 +3324,8 @@ s32 Camera_KeepOn3(Camera* camera) { playerHeight += keep3->yOffset; OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye); OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext); - func_8002EEE4(&camera->targetPosRot, camera->target); - func_8002EEE4(&playerPosRot, &camera->player->actor); + Actor_GetFocus(&camera->targetPosRot, camera->target); + Actor_GetFocus(&playerPosRot, &camera->player->actor); playerHeadPos = camPlayerPosRot->pos; playerHeadPos.y += playerHeight; OLib_Vec3fDiffToVecSphGeo(&targetToPlayerDir, &playerHeadPos, &camera->targetPosRot.pos); @@ -3470,7 +3470,7 @@ s32 Camera_KeepOn4(Camera* camera) { s16 angleCnt; s32 i; - player = (Player*)camera->globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].first; + player = (Player*)camera->globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].head; if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) { if (camera->globalCtx->view.unk_124 == 0) { @@ -3634,7 +3634,7 @@ s32 Camera_KeepOn4(Camera* camera) { } else if ((keep4->unk_1C & 8) && camera->target != NULL) { PosRot sp60; - func_8002EF44(&sp60, camera->target); + Actor_GetWorldPosShapeRot(&sp60, camera->target); spA2 = DEGF_TO_BINANG(keep4->unk_08) - sp60.rot.x; spA0 = BINANG_SUB(BINANG_ROT180(sp60.rot.y), spA8.yaw) > 0 ? BINANG_ROT180(sp60.rot.y) + DEGF_TO_BINANG(keep4->unk_0C) @@ -3644,7 +3644,7 @@ s32 Camera_KeepOn4(Camera* camera) { } else if ((keep4->unk_1C & 0x80) && camera->target != NULL) { PosRot sp4C; - func_8002EF14(&sp4C, camera->target); + Actor_GetWorld(&sp4C, camera->target); spA2 = DEGF_TO_BINANG(keep4->unk_08); sp9E = Camera_XZAngle(&sp4C.pos, &playerPosRot->pos); spA0 = (BINANG_SUB(sp9E, spA8.yaw) > 0) ? sp9E + DEGF_TO_BINANG(keep4->unk_0C) @@ -3786,7 +3786,7 @@ s32 Camera_KeepOn0(Camera* camera) { return true; } - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at); OLib_Vec3fDiffToVecSphGeo(&eyeTargetPosOffset, eye, &camera->targetPosRot.pos); @@ -4144,7 +4144,7 @@ s32 Camera_Subj3(Camera* camera) { Vec3f* pad2; f32 playerHeight; - func_8002EEE4(&sp60, &camera->player->actor); + Actor_GetFocus(&sp60, &camera->player->actor); playerHeight = Player_GetHeight(camera->player); if (camera->globalCtx->view.unk_124 == 0) { @@ -4280,7 +4280,7 @@ s32 Camera_Subj4(Camera* camera) { return true; } - func_8002EF44(&sp6C, &camera->player->actor); + Actor_GetWorldPosShapeRot(&sp6C, &camera->player->actor); OLib_Vec3fDiffToVecSphGeo(&sp5C, at, eye); sCameraInterfaceFlags = subj4->interfaceFlags; @@ -4333,7 +4333,7 @@ s32 Camera_Subj4(Camera* camera) { return false; } - func_8002EF44(&sp6C, &camera->player->actor); + Actor_GetWorldPosShapeRot(&sp6C, &camera->player->actor); Math3D_LineClosestToPoint(&anim->unk_00, &sp6C.pos, eyeNext); at->x = eyeNext->x + anim->unk_00.b.x; at->y = eyeNext->y + anim->unk_00.b.y; @@ -4358,8 +4358,8 @@ s32 Camera_Subj4(Camera* camera) { } anim->unk_28 = temp_f16; - camera->player->actor.posRot.pos = *eyeNext; - camera->player->actor.posRot.pos.y = camera->playerGroundY; + camera->player->actor.world.pos = *eyeNext; + camera->player->actor.world.pos.y = camera->playerGroundY; camera->player->actor.shape.rot.y = sp64.yaw; temp_f16 = ((240.0f * temp_f16) * (anim->unk_24 * 0.416667f)); temp_a0 = temp_f16 + anim->unk_30; @@ -4478,7 +4478,7 @@ s32 Camera_Unique1(Camera* camera) { VecSph eyeAtOffset; VecSph eyeNextAtOffset; PosRot* playerPosRot = &camera->playerPosRot; - PosRot playerPosRot2; + PosRot playerhead; Unique1* uniq1 = (Unique1*)camera->paramData; Unique1Anim* anim = &uniq1->anim; s32 pad; @@ -4522,7 +4522,7 @@ s32 Camera_Unique1(Camera* camera) { camera->animState++; } - func_8002EEE4(&playerPosRot2, &camera->player->actor); // unused + Actor_GetFocus(&playerhead, &camera->player->actor); // unused camera->yawUpdateRateInv = Camera_LERPCeilF(100.0f, camera->yawUpdateRateInv, OREG(25) * 0.01f, 0.1f); camera->pitchUpdateRateInv = Camera_LERPCeilF(100.0f, camera->pitchUpdateRateInv, OREG(25) * 0.01f, 0.1f); @@ -5001,8 +5001,8 @@ s32 Camera_Unique9(Camera* camera) { s16 atInitFlags; s16 eyeInitFlags; s16 pad2; - PosRot targetPosRot2; - PosRot playerPosRot2; + PosRot targethead; + PosRot playerhead; PosRot playerPosRot; Vec3f* eyeNext = &camera->eyeNext; Vec3f* at = &camera->at; @@ -5028,7 +5028,7 @@ s32 Camera_Unique9(Camera* camera) { sCameraInterfaceFlags = uniq9->interfaceFlags; - func_8002EF14(&playerPosRot, &camera->player->actor); + Actor_GetWorld(&playerPosRot, &camera->player->actor); if (camera->animState == 0) { camera->animState++; @@ -5094,11 +5094,11 @@ s32 Camera_Unique9(Camera* camera) { } } else if (atInitFlags == 4 || atInitFlags == 0x84) { if (camera->target != NULL && camera->target->update != NULL) { - func_8002EEE4(&targetPosRot2, camera->target); - func_8002EEE4(&playerPosRot2, &camera->player->actor); - playerPosRot2.pos.x = playerPosRot.pos.x; - playerPosRot2.pos.z = playerPosRot.pos.z; - OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targetPosRot2.pos, &playerPosRot2.pos); + Actor_GetFocus(&targethead, camera->target); + Actor_GetFocus(&playerhead, &camera->player->actor); + playerhead.pos.x = playerPosRot.pos.x; + playerhead.pos.z = playerPosRot.pos.z; + OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos); if (atInitFlags & (s16)0x8080) { scratchSph.pitch = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.x); scratchSph.yaw = DEGF_TO_BINANG(anim->curKeyFrame->atTargetInit.y); @@ -5108,7 +5108,7 @@ s32 Camera_Unique9(Camera* camera) { } scratchSph.yaw += playerTargetOffset.yaw; scratchSph.pitch += playerTargetOffset.pitch; - Camera_Vec3fVecSphGeoAdd(&anim->atTarget, &targetPosRot2.pos, &scratchSph); + Camera_Vec3fVecSphGeoAdd(&anim->atTarget, &targethead.pos, &scratchSph); } else { if (camera->target == NULL) { osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: demo C: actor is not valid\n" VT_RST); @@ -5130,14 +5130,14 @@ s32 Camera_Unique9(Camera* camera) { if (focusActor != NULL) { if ((atInitFlags & 0xF) == 1) { - // posRot2 - func_8002EEE4(&atFocusPosRot, focusActor); + // head + Actor_GetFocus(&atFocusPosRot, focusActor); } else if ((atInitFlags & 0xF) == 2) { - // posRot - func_8002EF14(&atFocusPosRot, focusActor); + // world + Actor_GetWorld(&atFocusPosRot, focusActor); } else { - // posRot, shape rot - func_8002EF44(&atFocusPosRot, focusActor); + // world, shape rot + Actor_GetWorldPosShapeRot(&atFocusPosRot, focusActor); } if (atInitFlags & (s16)0x8080) { @@ -5181,13 +5181,13 @@ s32 Camera_Unique9(Camera* camera) { if (eyeInitFlags == 0x400 || eyeInitFlags == (s16)0x8400 || eyeInitFlags == 0x500 || eyeInitFlags == (s16)0x8500) { if (camera->target != NULL && camera->target->update != NULL) { - func_8002EEE4(&targetPosRot2, camera->target); - func_8002EEE4(&playerPosRot2, &camera->player->actor); - playerPosRot2.pos.x = playerPosRot.pos.x; - playerPosRot2.pos.z = playerPosRot.pos.z; - OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targetPosRot2.pos, &playerPosRot2.pos); + Actor_GetFocus(&targethead, camera->target); + Actor_GetFocus(&playerhead, &camera->player->actor); + playerhead.pos.x = playerPosRot.pos.x; + playerhead.pos.z = playerPosRot.pos.z; + OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos); if (eyeInitFlags == 0x400 || eyeInitFlags == (s16)0x8400) { - eyeLookAtPos = targetPosRot2.pos; + eyeLookAtPos = targethead.pos; } else { eyeLookAtPos = anim->atTarget; } @@ -5224,14 +5224,14 @@ s32 Camera_Unique9(Camera* camera) { if (focusActor != NULL) { if ((eyeInitFlags & 0xF00) == 0x100) { - // posRot2 - func_8002EEE4(&eyeFocusPosRot, focusActor); + // head + Actor_GetFocus(&eyeFocusPosRot, focusActor); } else if ((eyeInitFlags & 0xF00) == 0x200) { - // posRot - func_8002EF14(&eyeFocusPosRot, focusActor); + // world + Actor_GetWorld(&eyeFocusPosRot, focusActor); } else { - // posRot, shapeRot - func_8002EF44(&eyeFocusPosRot, focusActor); + // world, shapeRot + Actor_GetWorldPosShapeRot(&eyeFocusPosRot, focusActor); } if (eyeInitFlags & (s16)0x8080) { @@ -5436,10 +5436,10 @@ s32 Camera_Unique9(Camera* camera) { if (anim->curKeyFrame->actionFlags & 0x40) { // Set the player's position - camera->player->actor.posRot.pos.x = anim->playerPos.x; - camera->player->actor.posRot.pos.z = anim->playerPos.z; + camera->player->actor.world.pos.x = anim->playerPos.x; + camera->player->actor.world.pos.z = anim->playerPos.z; if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { - camera->player->actor.posRot.pos.y = anim->playerPos.y; + camera->player->actor.world.pos.y = anim->playerPos.y; } } else { anim->playerPos.x = playerPosRot.pos.x; @@ -5555,7 +5555,7 @@ s32 Camera_Demo1(Camera* camera) { // if the camera is set to be relative to the player, move the interpolated points // relative to the player's position if (camera->player != NULL && camera->player->actor.update != NULL) { - func_8002EF14(&curPlayerPosRot, &camera->player->actor); + Actor_GetWorld(&curPlayerPosRot, &camera->player->actor); Camera_RotateAroundPoint(&curPlayerPosRot, &csEyeUpdate, eyeNext); Camera_RotateAroundPoint(&curPlayerPosRot, &csAtUpdate, at); } else { @@ -5811,8 +5811,8 @@ s32 Camera_Demo5(Camera* camera) { VecSph playerTargetGeo; VecSph eyePlayerGeo; VecSph sp78; - PosRot playerPosRot2; - PosRot targetPosRot2; + PosRot playerhead; + PosRot targethead; Player* player; s16 sp4A; s32 pad; @@ -5820,7 +5820,7 @@ s32 Camera_Demo5(Camera* camera) { s16 t; s32 pad2; - func_8002EEE4(&playerPosRot2, &camera->player->actor); + Actor_GetFocus(&playerhead, &camera->player->actor); player = camera->player; sCameraInterfaceFlags = 0x3200; if ((camera->target == NULL) || (camera->target->update == NULL)) { @@ -5830,14 +5830,14 @@ s32 Camera_Demo5(Camera* camera) { camera->target = NULL; return true; } - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos); - D_8011D3AC = camera->target->type; + D_8011D3AC = camera->target->category; func_8002F374(camera->globalCtx, camera->target, &sp78.yaw, &sp78.pitch); eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye); - OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerPosRot2.pos, &camera->eyeNext); + OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext); sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw; - if (camera->target->type == ACTORTYPE_PLAYER) { + if (camera->target->category == ACTORCAT_PLAYER) { // camera is targeting a(the) player actor if (eyePlayerGeo.r > 30.0f) { D_8011D6AC[1].timerInit = camera->timer - 1; @@ -5925,7 +5925,7 @@ s32 Camera_Demo5(Camera* camera) { camera->timer += D_8011D8DC[1].timerInit + D_8011D8DC[2].timerInit; } } - } else if (camera->target->type == ACTORTYPE_DOOR) { + } else if (camera->target->category == ACTORCAT_DOOR) { // the target is a door. D_8011D954[0].timerInit = camera->timer - 5; sp4A = 0; @@ -5945,10 +5945,10 @@ s32 Camera_Demo5(Camera* camera) { temp_v0 = Rand_ZeroOne() * (sp90 * -0.2f); D_8011D954[1].rollTargetInit = temp_v0; D_8011D954[0].rollTargetInit = temp_v0; - func_8002EEE4(&targetPosRot2, camera->target); - targetPosRot2.pos.x += 50.0f * Math_SinS(BINANG_ROT180(sp4A)); - targetPosRot2.pos.z += 50.0f * Math_CosS(BINANG_ROT180(sp4A)); - if (Camera_BGCheck(camera, &playerPosRot2.pos, &targetPosRot2.pos)) { + Actor_GetFocus(&targethead, camera->target); + targethead.pos.x += 50.0f * Math_SinS(BINANG_ROT180(sp4A)); + targethead.pos.z += 50.0f * Math_CosS(BINANG_ROT180(sp4A)); + if (Camera_BGCheck(camera, &playerhead.pos, &targethead.pos)) { D_8011D954[1].actionFlags = 0xC1; D_8011D954[2].actionFlags = 0x8F; } else { @@ -5971,8 +5971,8 @@ s32 Camera_Demo5(Camera* camera) { } Player_GetHeight(camera->player); D_8011D9F4[0].timerInit = camera->timer; - func_8002EEE4(&targetPosRot2, camera->target); - if (Camera_BGCheck(camera, &playerPosRot2.pos, &targetPosRot2.pos)) { + Actor_GetFocus(&targethead, camera->target); + if (Camera_BGCheck(camera, &playerhead.pos, &targethead.pos)) { D_8011D9F4[1].timerInit = 4; D_8011D9F4[1].actionFlags = 0x8F; } else { @@ -6006,8 +6006,8 @@ s32 Camera_Demo5(Camera* camera) { // env frozen player->actor.freezeTimer = camera->timer; } else { - sp4A = playerPosRot2.rot.y - playerTargetGeo.yaw; - if (camera->target->type == ACTORTYPE_PLAYER) { + sp4A = playerhead.rot.y - playerTargetGeo.yaw; + if (camera->target->category == ACTORCAT_PLAYER) { pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; if (player->stateFlags1 & 0x800) { // holding object over head. @@ -6063,7 +6063,7 @@ s32 Camera_Demo6(Camera* camera) { // initalizes the camera state. anim->animTimer = 0; camera->fov = 60.0f; - func_8002EF14(&focusPosRot, camFocus); + Actor_GetWorld(&focusPosRot, camFocus); camera->at.x = focusPosRot.pos.x; camera->at.y = focusPosRot.pos.y + 20.0f; camera->at.z = focusPosRot.pos.z; @@ -6078,7 +6078,7 @@ s32 Camera_Demo6(Camera* camera) { case 1: if (stateTimers[camera->animState] < anim->animTimer) { func_8002DF54(camera->globalCtx, &camera->player->actor, 8); - func_8002EF14(&focusPosRot, camFocus); + Actor_GetWorld(&focusPosRot, camFocus); anim->atTarget.x = focusPosRot.pos.x; anim->atTarget.y = focusPosRot.pos.y - 20.0f; anim->atTarget.z = focusPosRot.pos.z; @@ -6103,7 +6103,7 @@ s32 Camera_Demo6(Camera* camera) { } anim->animTimer++; - func_8002EF14(&focusPosRot, camFocus); + Actor_GetWorld(&focusPosRot, camFocus); return true; } @@ -6198,13 +6198,13 @@ s32 Camera_Demo9(Camera* camera) { Camera_RotateAroundPoint(cam0PlayerPosRot, &csAtUpdate, &newAt); } else if (demo9OnePoint->onePointDemo.actionParameters == 4) { // rotate around the current camera's player - func_8002EF14(&focusPosRot, &camera->player->actor); + Actor_GetWorld(&focusPosRot, &camera->player->actor); Camera_RotateAroundPoint(&focusPosRot, &csEyeUpdate, &newEye); Camera_RotateAroundPoint(&focusPosRot, &csAtUpdate, &newAt); } else if (demo9OnePoint->onePointDemo.actionParameters == 8) { // rotate around the current camera's target if (camera->target != NULL && camera->target->update != NULL) { - func_8002EF14(&focusPosRot, camera->target); + Actor_GetWorld(&focusPosRot, camera->target); Camera_RotateAroundPoint(&focusPosRot, &csEyeUpdate, &newEye); Camera_RotateAroundPoint(&focusPosRot, &csAtUpdate, &newAt); } else { @@ -6297,7 +6297,7 @@ s32 Camera_Special0(Camera* camera) { return true; } - func_8002EEE4(&camera->targetPosRot, camera->target); + Actor_GetFocus(&camera->targetPosRot, camera->target); Camera_LERPCeilVec3f(&camera->targetPosRot.pos, &camera->at, spec0->lerpAtScale, spec0->lerpAtScale, 0.1f); camera->posOffset.x = camera->at.x - playerPosRot->pos.x; @@ -6343,7 +6343,7 @@ s32 Camera_Special4(Camera* camera) { return false; } else { camera->roll = -0x1F4; - func_8002EF14(&curTargetPosRot, camera->target); + Actor_GetWorld(&curTargetPosRot, camera->target); camera->at = curTargetPosRot.pos; camera->at.y -= 150.0f; @@ -6401,7 +6401,7 @@ s32 Camera_Special5(Camera* camera) { OLib_Vec3fDiffToVecSphGeo(&sp64, at, eye); OLib_Vec3fDiffToVecSphGeo(&sp5C, at, eyeNext); - func_8002EF14(&spA8, camera->target); + Actor_GetWorld(&spA8, camera->target); sCameraInterfaceFlags = spec5->interfaceFlags; @@ -6647,7 +6647,7 @@ s32 Camera_Special9(Camera* camera) { } if (spec9->doorParams.doorActor != NULL) { - func_8002EF44(&adjustedPlayerPosRot, spec9->doorParams.doorActor); + Actor_GetWorldPosShapeRot(&adjustedPlayerPosRot, spec9->doorParams.doorActor); } else { adjustedPlayerPosRot = *playerPosRot; adjustedPlayerPosRot.pos.y += playerYOffset + params->yOffset; @@ -6894,7 +6894,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) { Vec3f* at = &camera->at; Vec3f* eyeNext = &camera->eyeNext; - func_8002EF44(&playerPosShape, &player->actor); + Actor_GetWorldPosShapeRot(&playerPosShape, &player->actor); playerYOffset = Player_GetHeight(player); camera->player = player; camera->playerPosRot = playerPosShape; @@ -7333,7 +7333,7 @@ Vec3s* Camera_Update(Vec3s* outVec, Camera* camera) { sUpdateCameraDirection = false; if (camera->player != NULL) { - func_8002EF44(&curPlayerPosRot, &camera->player->actor); + Actor_GetWorldPosShapeRot(&curPlayerPosRot, &camera->player->actor); camera->xzSpeed = playerXZSpeed = OLib_Vec3fDistXZ(&curPlayerPosRot.pos, &camera->playerPosRot.pos); camera->speedRatio = OLib_ClampMaxDist(playerXZSpeed / (func_8002DCE4(camera->player) * PCT(OREG(8))), 1.0f); @@ -7558,7 +7558,7 @@ Vec3s* Camera_Update(Vec3s* outVec, Camera* camera) { */ void Camera_Finish(Camera* camera) { Camera* defaultCam = camera->globalCtx->cameraPtrs[0]; - Player* player = (Player*)camera->globalCtx->actorCtx.actorList[2].first; + Player* player = (Player*)camera->globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].head; if (camera->timer == 0) { Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamIdx, 7); @@ -7966,7 +7966,7 @@ s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCa if (camera->data2 != 0) { camera->player = player; - func_8002EF44(&playerPosRot, &player->actor); + Actor_GetWorldPosShapeRot(&playerPosRot, &player->actor); camera->playerPosRot = playerPosRot; camera->nextCamDataIdx = -1; @@ -8042,7 +8042,7 @@ s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera) { func_80043B60(dstCamera); if (dstCamera->player != NULL) { - func_8002EF14(&dstCamera->playerPosRot, &dstCamera->player->actor); + Actor_GetWorld(&dstCamera->playerPosRot, &dstCamera->player->actor); dstCamera->posOffset.x = dstCamera->at.x - dstCamera->playerPosRot.pos.x; dstCamera->posOffset.y = dstCamera->at.y - dstCamera->playerPosRot.pos.y; dstCamera->posOffset.z = dstCamera->at.z - dstCamera->playerPosRot.pos.z; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index be884c444..30f71cda2 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1632,7 +1632,7 @@ void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Colli * Plays a hit sound effect for AT colliders attached to Player based on the AC element's elemType. */ s32 CollisionCheck_SwordHitAudio(Collider* at, ColliderInfo* acInfo) { - if (at->actor != NULL && at->actor->type == ACTORTYPE_PLAYER) { + if (at->actor != NULL && at->actor->category == ACTORCAT_PLAYER) { if (acInfo->elemType == ELEMTYPE_UNK0) { Audio_PlaySoundGeneral(NA_SE_IT_SWORD_STRIKE, &at->actor->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -2962,8 +2962,8 @@ void CollisionCheck_ResetDamage(CollisionCheckInfo* info) { */ void CollisionCheck_SetInfoNoDamageTable(CollisionCheckInfo* info, CollisionCheckInfoInit* init) { info->health = init->health; - info->unk_10 = init->unk_02; - info->unk_12 = init->unk_04; + info->cylRadius = init->cylRadius; + info->cylHeight = init->cylHeight; info->mass = init->mass; } @@ -2973,8 +2973,8 @@ void CollisionCheck_SetInfoNoDamageTable(CollisionCheckInfo* info, CollisionChec void CollisionCheck_SetInfo(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit* init) { info->health = init->health; info->damageTable = damageTable; - info->unk_10 = init->unk_02; - info->unk_12 = init->unk_04; + info->cylRadius = init->cylRadius; + info->cylHeight = init->cylHeight; info->mass = init->mass; } @@ -2984,9 +2984,9 @@ void CollisionCheck_SetInfo(CollisionCheckInfo* info, DamageTable* damageTable, void CollisionCheck_SetInfo2(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit2* init) { info->health = init->health; info->damageTable = damageTable; - info->unk_10 = init->unk_02; - info->unk_12 = init->unk_04; - info->unk_14 = init->unk_06; + info->cylRadius = init->cylRadius; + info->cylHeight = init->cylHeight; + info->cylYShift = init->cylYShift; info->mass = init->mass; } @@ -3218,9 +3218,9 @@ s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* * Moves the ColliderCylinder's position to the actor's position */ void Collider_UpdateCylinder(Actor* actor, ColliderCylinder* collider) { - collider->dim.pos.x = actor->posRot.pos.x; - collider->dim.pos.y = actor->posRot.pos.y; - collider->dim.pos.z = actor->posRot.pos.z; + collider->dim.pos.x = actor->world.pos.x; + collider->dim.pos.y = actor->world.pos.y; + collider->dim.pos.z = actor->world.pos.z; } /** diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 3e62d46cb..7f65ff5eb 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -23,7 +23,7 @@ void func_8001D5C8(EnAObj* this, s16 params); const ActorInit En_A_Obj_InitVars = { ACTOR_EN_A_OBJ, - ACTORTYPE_PROP, + ACTORCAT_PROP, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(EnAObj), @@ -108,9 +108,9 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { sp28 = 12.0f; } - ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, sp28); + ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, sp28); - thisx->posRot2.pos = thisx->posRot.pos; + thisx->focus.pos = thisx->world.pos; this->dyna.bgId = BGACTOR_NEG_ONE; this->dyna.unk_160 = 0; this->dyna.unk_15C = DPM_UNK; @@ -121,13 +121,13 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: this->dyna.bgId = 1; - Actor_ChangeType(globalCtx, &globalCtx->actorCtx, thisx, ACTORTYPE_BG); + Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); func_8001D5C8(this, thisx->params); break; case A_OBJ_BLOCK_SMALL_ROT: case A_OBJ_BLOCK_LARGE_ROT: this->dyna.bgId = 3; - Actor_ChangeType(globalCtx, &globalCtx->actorCtx, thisx, ACTORTYPE_BG); + Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG); func_8001D310(this, thisx->params); break; case A_OBJ_UNKNOWN_6: @@ -146,14 +146,14 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { case A_OBJ_SIGNPOST_ARROW: thisx->textId = (this->textId & 0xFF) | 0x300; // clang-format off - thisx->flags |= 0x1 | 0x8; thisx->unk_4C = 500.0f; + thisx->flags |= 0x1 | 0x8; thisx->targetArrowOffset = 500.0f; // clang-format on this->unk_178 = 45.0f; func_8001D234(this, thisx->params); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; - thisx->unk_1F = 0; + thisx->targetMode = 0; break; case A_OBJ_KNOB: thisx->gravity = -1.5f; @@ -201,7 +201,7 @@ void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) { s16 var; if (this->dyna.actor.textId != 0) { - var = this->dyna.actor.yawTowardsLink - this->dyna.actor.shape.rot.y; + var = this->dyna.actor.yawTowardsPlayer - 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); @@ -215,8 +215,8 @@ void func_8001D25C(EnAObj* this, GlobalContext* globalCtx) { void func_8001D310(EnAObj* this, s16 params) { this->unk_16E = 0; this->unk_168 = 10; - this->dyna.actor.posRot.rot.y = 0; - this->dyna.actor.shape.rot = this->dyna.actor.posRot.rot; + this->dyna.actor.world.rot.y = 0; + this->dyna.actor.shape.rot = this->dyna.actor.world.rot; EnAObj_SetupAction(this, func_8001D360); } @@ -226,13 +226,13 @@ void func_8001D360(EnAObj* this, GlobalContext* globalCtx) { this->unk_16E++; this->unk_170 = 20; - if ((s16)(this->dyna.actor.yawTowardsLink + 0x4000) < 0) { + if ((s16)(this->dyna.actor.yawTowardsPlayer + 0x4000) < 0) { this->unk_174 = -1000; } else { this->unk_174 = 1000; } - if (this->dyna.actor.yawTowardsLink < 0) { + if (this->dyna.actor.yawTowardsPlayer < 0) { this->unk_172 = -this->unk_174; } else { this->unk_172 = this->unk_174; @@ -248,12 +248,12 @@ void func_8001D360(EnAObj* this, GlobalContext* globalCtx) { this->dyna.actor.gravity = -1.0f; if (this->unk_170 == 0) { - this->dyna.actor.posRot.pos = this->dyna.actor.initPosRot.pos; + this->dyna.actor.world.pos = this->dyna.actor.home.pos; this->unk_16E = 0; this->unk_168 = 10; this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.gravity = 0.0f; - this->dyna.actor.shape.rot = this->dyna.actor.posRot.rot; + this->dyna.actor.shape.rot = this->dyna.actor.world.rot; } } } @@ -265,14 +265,13 @@ void func_8001D480(EnAObj* this, s16 params) { void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); - this->dyna.actor.shape.rot.x = this->dyna.actor.shape.rot.x + (this->dyna.actor.posRot.rot.x >> 1); - this->dyna.actor.shape.rot.z = this->dyna.actor.shape.rot.z + (this->dyna.actor.posRot.rot.z >> 1); + this->dyna.actor.shape.rot.x = this->dyna.actor.shape.rot.x + (this->dyna.actor.world.rot.x >> 1); + this->dyna.actor.shape.rot.z = this->dyna.actor.shape.rot.z + (this->dyna.actor.world.rot.z >> 1); if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 0x8)) { if (1) { // Necessary to match - this->dyna.actor.posRot.rot.y = - ((this->dyna.actor.wallPolyRot - this->dyna.actor.posRot.rot.y) + this->dyna.actor.wallPolyRot) - - 0x8000; + this->dyna.actor.world.rot.y = + ((this->dyna.actor.wallYaw - this->dyna.actor.world.rot.y) + this->dyna.actor.wallYaw) - 0x8000; } this->dyna.actor.bgCheckFlags &= ~0x8; } @@ -296,7 +295,7 @@ void func_8001D5C8(EnAObj* this, s16 params) { void func_8001D608(EnAObj* this, GlobalContext* globalCtx) { this->dyna.actor.speedXZ += this->dyna.unk_150; - this->dyna.actor.posRot.rot.y = this->dyna.unk_158; + this->dyna.actor.world.rot.y = this->dyna.unk_158; this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f); Math_SmoothStepToF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); @@ -317,14 +316,14 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.actor.gravity != 0.0f) { if (this->dyna.actor.params != A_OBJ_KNOB) { - func_8002E4B4(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D); } else { - func_8002E4B4(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D); } } - this->dyna.actor.posRot2.pos = this->dyna.actor.posRot.pos; - this->dyna.actor.posRot2.pos.y += this->unk_178; + this->dyna.actor.focus.pos = this->dyna.actor.world.pos; + this->dyna.actor.focus.pos.y += this->unk_178; switch (this->dyna.actor.params) { case A_OBJ_SIGNPOST_OBLONG: diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index af464beeb..4058748f8 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -18,7 +18,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx); const ActorInit En_Item00_InitVars = { ACTOR_EN_ITEM00, - ACTORTYPE_MISC, + ACTORCAT_MISC, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(EnItem00), @@ -96,7 +96,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.02f; break; case ITEM00_HEART: - this->actor.initPosRot.rot.z = Rand_CenteredFloat(65535.0f); + this->actor.home.rot.z = Rand_CenteredFloat(65535.0f); sp34 = 430.0f; Actor_SetScale(&this->actor, 0.02f); this->unk_15C = 0.02f; @@ -157,7 +157,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.5f; sp34 = 0.0f; sp30 = 0.6f; - this->actor.posRot.rot.x = 0x4000; + this->actor.world.rot.x = 0x4000; break; case ITEM00_SHIELD_HYLIAN: this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); @@ -166,7 +166,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.5f; sp34 = 0.0f; sp30 = 0.6f; - this->actor.posRot.rot.x = 0x4000; + this->actor.world.rot.x = 0x4000; break; case ITEM00_TUNIC_ZORA: case ITEM00_TUNIC_GORON: @@ -176,14 +176,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15C = 0.5f; sp34 = 0.0f; sp30 = 0.6f; - this->actor.posRot.rot.x = 0x4000; + this->actor.world.rot.x = 0x4000; break; } this->unk_156 = 0; - ActorShape_Init(&this->actor.shape, sp34, ActorShadow_DrawFunc_Circle, sp30); - this->actor.shape.unk_14 = 0xB4; - this->actor.posRot2.pos = this->actor.posRot.pos; + ActorShape_Init(&this->actor.shape, sp34, ActorShadow_DrawCircle, sp30); + this->actor.shape.shadowAlpha = 0xB4; + this->actor.focus.pos = this->actor.world.pos; this->unk_152 = 0; if (!spawnParam8000) { @@ -286,20 +286,20 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { } else { if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { if (this->unk_15A == -1) { - if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) { + if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500)) { this->unk_15A = -2; } } else { - if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) { + if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.world.rot.x - 0x4000, 2, 3000, 1500)) { this->unk_15A = -1; } } - Math_SmoothStepToS(&this->actor.posRot.rot.x, 0, 2, 2500, 500); + Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500); } } if (this->actor.params == ITEM00_HEART_PIECE) { - this->actor.shape.unk_08 = Math_SinS(this->actor.shape.rot.y) * 150.0f + 850.0f; + this->actor.shape.yOffset = Math_SinS(this->actor.shape.rot.y) * 150.0f + 850.0f; } Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -332,9 +332,9 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { } if (globalCtx->gameplayFrames & 1) { - pos.x = this->actor.posRot.pos.x + Rand_CenteredFloat(10.0f); - pos.y = this->actor.posRot.pos.y + Rand_CenteredFloat(10.0f); - pos.z = this->actor.posRot.pos.z + Rand_CenteredFloat(10.0f); + pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); + pos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f); + pos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f); EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514); } @@ -364,20 +364,20 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { if (this->actor.velocity.y < -1.5f) { this->actor.velocity.y = -1.5f; } - this->actor.initPosRot.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f); - this->actor.posRot.pos.x += - Math_CosS(this->actor.yawTowardsLink) * (-3.0f * Math_CosS(this->actor.initPosRot.rot.z)); - this->actor.posRot.pos.z += - Math_SinS(this->actor.yawTowardsLink) * (-3.0f * Math_CosS(this->actor.initPosRot.rot.z)); + this->actor.home.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f); + this->actor.world.pos.x += + Math_CosS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)); + this->actor.world.pos.z += + Math_SinS(this->actor.yawTowardsPlayer) * (-3.0f * Math_CosS(this->actor.home.rot.z)); } } if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; } else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { - this->actor.posRot.rot.x -= 700; + this->actor.world.rot.x -= 700; this->actor.shape.rot.y += 400; - this->actor.shape.rot.x = this->actor.posRot.rot.x - 0x4000; + this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000; } if (this->actor.velocity.y <= 2.0f) { @@ -390,9 +390,9 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } if (!(globalCtx->gameplayFrames & 1)) { - pos.x = this->actor.posRot.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f; - pos.y = this->actor.posRot.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f; - pos.z = this->actor.posRot.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f; + pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f; + pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f; + pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f; EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514); } @@ -421,7 +421,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { return; } - this->actor.posRot.pos = player->actor.posRot.pos; + this->actor.world.pos = player->actor.world.pos; if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; @@ -429,10 +429,10 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = 0; } - this->actor.posRot.pos.y += 40.0f + Math_SinS(this->unk_15A * 15000) * (this->unk_15A * 0.3f); + this->actor.world.pos.y += 40.0f + Math_SinS(this->unk_15A * 15000) * (this->unk_15A * 0.3f); if (LINK_IS_ADULT) { - this->actor.posRot.pos.y += 20.0f; + this->actor.world.pos.y += 20.0f; } } @@ -475,9 +475,9 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) { dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor; if ((dynaActor != NULL) && (dynaActor->update != NULL) && - ((dynaActor->posRot.pos.x != dynaActor->pos4.x) || - (dynaActor->posRot.pos.y != dynaActor->pos4.y) || - (dynaActor->posRot.pos.z != dynaActor->pos4.z))) { + ((dynaActor->world.pos.x != dynaActor->prevPos.x) || + (dynaActor->world.pos.y != dynaActor->prevPos.y) || + (dynaActor->world.pos.z != dynaActor->prevPos.z))) { D_80157D94++; break; } @@ -490,9 +490,9 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } if (sp3A || D_80157D94) { - func_8002E4B4(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); - if (this->actor.groundY <= -10000.0f) { + if (this->actor.floorHeight <= -10000.0f) { Actor_Kill(&this->actor); return; } @@ -505,11 +505,11 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) || (this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) { f32 newUnkBC = Math_CosS(this->actor.shape.rot.x) * 37.0f; - this->actor.shape.unk_08 = newUnkBC; + this->actor.shape.yOffset = newUnkBC; if (newUnkBC >= 0.0f) { - this->actor.shape.unk_08 = this->actor.shape.unk_08; + this->actor.shape.yOffset = this->actor.shape.yOffset; } else { - this->actor.shape.unk_08 = -this->actor.shape.unk_08; + this->actor.shape.yOffset = -this->actor.shape.yOffset; } } @@ -517,8 +517,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if (!((this->actor.xzDistToLink <= 30.0f) && (this->actor.yDistToLink >= -50.0f) && - (this->actor.yDistToLink <= 50.0f))) { + if (!((this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) && + (this->actor.yDistToPlayer <= 50.0f))) { if (!Actor_HasParent(&this->actor, globalCtx)) { return; } @@ -890,7 +890,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; - spawnedActor->actor.posRot.rot.y = Rand_CenteredFloat(65536.0f); + spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f); Actor_SetScale(&spawnedActor->actor, 0.0f); EnItem00_SetupAction(spawnedActor, func_8001E304); spawnedActor->unk_15A = 220; @@ -931,7 +931,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p spawnedActor->actor.velocity.y = 0.0f; spawnedActor->actor.speedXZ = 0.0f; spawnedActor->actor.gravity = param4000 ? 0.0f : -0.9f; - spawnedActor->actor.posRot.rot.y = Rand_CenteredFloat(65536.0f); + spawnedActor->actor.world.rot.y = Rand_CenteredFloat(65536.0f); spawnedActor->actor.flags |= 0x0010; } } @@ -953,31 +953,31 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 params = params & 0x7FFF; if (fromActor != NULL) { - if (fromActor->unk_116) { - if (fromActor->unk_116 & 0x01) { + if (fromActor->dropFlag) { + if (fromActor->dropFlag & 0x01) { params = 1 * 0x10; - dropTableIndex = 0xB; - } else if (fromActor->unk_116 & 0x02) { + dropTableIndex = 11; + } else if (fromActor->dropFlag & 0x02) { params = 1 * 0x10; - dropTableIndex = 0x6; - } else if (fromActor->unk_116 & 0x04) { + dropTableIndex = 6; + } else if (fromActor->dropFlag & 0x04) { params = 6 * 0x10; - dropTableIndex = 0x9; - } else if (fromActor->unk_116 & 0x08) { + dropTableIndex = 9; + } else if (fromActor->dropFlag & 0x08) { params = 3 * 0x10; - dropTableIndex = 0xB; - } else if (fromActor->unk_116 & 0x10) { + dropTableIndex = 11; + } else if (fromActor->dropFlag & 0x10) { params = 6 * 0x10; - dropTableIndex = 0xC; - } else if (fromActor->unk_116 & 0x20) { + dropTableIndex = 12; + } else if (fromActor->dropFlag & 0x20) { params = 0 * 0x10; - dropTableIndex = 0x0; - } else if (fromActor->unk_116 & 0x40) { + dropTableIndex = 0; + } else if (fromActor->dropFlag & 0x40) { params = 0 * 0x10; - dropTableIndex = 0x1; + dropTableIndex = 1; } } - if (fromActor->unk_116 & 0x20) { + if (fromActor->dropFlag & 0x20) { dropId = ITEM00_RUPEE_PURPLE; } else { dropId = D_80115574[params + dropTableIndex]; @@ -1043,7 +1043,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 spawnedActor->actor.velocity.y = 8.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; - spawnedActor->actor.posRot.rot.y = Rand_ZeroOne() * 40000.0f; + spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f; Actor_SetScale(&spawnedActor->actor, 0.0f); EnItem00_SetupAction(spawnedActor, func_8001E304); spawnedActor->actor.flags |= 0x0010; diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 076d69d2b..fd6cb3cbb 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -48,10 +48,9 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { }; if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))) { - player->rideActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.posRot.pos.x, - player->actor.posRot.pos.y, player->actor.posRot.pos.z, player->actor.shape.rot.x, - player->actor.shape.rot.y, player->actor.shape.rot.z, 9); + player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x, + player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, + player->actor.shape.rot.y, player->actor.shape.rot.z, 9); if (player->rideActor == NULL) { __assert("player->ride.actor != NULL", "../z_horse.c", 343); } @@ -167,7 +166,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { } player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, - spawnPos.z, 0, player->actor.posRot.rot.y, 0, 7); + spawnPos.z, 0, player->actor.world.rot.y, 0, 7); if (player->rideActor == NULL) { __assert("player->ride.actor != NULL", "../z_horse.c", 561); } @@ -203,14 +202,14 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { (((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) { - D_8011F9B8[i].pos.x = player->actor.posRot.pos.x; - D_8011F9B8[i].pos.y = player->actor.posRot.pos.y; - D_8011F9B8[i].pos.z = player->actor.posRot.pos.z; + D_8011F9B8[i].pos.x = player->actor.world.pos.x; + D_8011F9B8[i].pos.y = player->actor.world.pos.y; + D_8011F9B8[i].pos.z = player->actor.world.pos.z; } player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, - player->actor.posRot.rot.y, 0, D_8011F9B8[i].type); + player->actor.world.rot.y, 0, D_8011F9B8[i].type); if (player->rideActor == NULL) { __assert("player->ride.actor != NULL", "../z_horse.c", 628); } @@ -233,20 +232,20 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { __assert("player->ride.actor != NULL", "../z_horse.c", 667); } - player->actor.posRot.pos.x = D_8011F9B8[i].pos.x; - player->actor.posRot.pos.y = D_8011F9B8[i].pos.y; - player->actor.posRot.pos.z = D_8011F9B8[i].pos.z; + player->actor.world.pos.x = D_8011F9B8[i].pos.x; + player->actor.world.pos.y = D_8011F9B8[i].pos.y; + player->actor.world.pos.z = D_8011F9B8[i].pos.z; player->actor.shape.rot.x = player->actor.shape.rot.z = 0; player->actor.shape.rot.y = D_8011F9B8[i].angle; func_8002DECC(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); - sp54.x = player->actor.posRot.pos.x - 200.0f; - sp54.y = player->actor.posRot.pos.y + 100.0f; - sp54.z = player->actor.posRot.pos.z; + sp54.x = player->actor.world.pos.x - 200.0f; + sp54.y = player->actor.world.pos.y + 100.0f; + sp54.z = player->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.posRot.pos, &sp54); + Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.world.pos, &sp54); } else { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, @@ -284,15 +283,15 @@ void func_8006DC68(GlobalContext* globalCtx, Player* player) { } void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2) { - s16 x = Math_Vec3f_Yaw(&actor->posRot.pos, arg1) - actor->posRot.rot.y; + s16 x = Math_Vec3f_Yaw(&actor->world.pos, arg1) - actor->world.rot.y; if (x > arg2) { - actor->posRot.rot.y += arg2; + actor->world.rot.y += arg2; } else if (x < -arg2) { - actor->posRot.rot.y -= arg2; + actor->world.rot.y -= arg2; } else { - actor->posRot.rot.y += x; + actor->world.rot.y += x; } - actor->shape.rot.y = actor->posRot.rot.y; + actor->shape.rot.y = actor->world.rot.y; } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index e81b087fc..fab39d42b 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -11,8 +11,8 @@ s16 sEntranceIconMapIndex = 0; void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) { Player* player = PLAYER; - sPlayerInitialPosX = player->actor.posRot.pos.x; - sPlayerInitialPosZ = player->actor.posRot.pos.z; + sPlayerInitialPosX = player->actor.world.pos.x; + sPlayerInitialPosZ = player->actor.world.pos.z; sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400); } @@ -326,8 +326,8 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); - tempX = player->actor.posRot.pos.x; - tempZ = player->actor.posRot.pos.z; + tempX = player->actor.world.pos.x; + tempZ = player->actor.world.pos.z; tempX /= R_COMPASS_SCALE_X; tempZ /= R_COMPASS_SCALE_Y; Matrix_Translate((R_COMPASS_OFFSET_X + tempX) / 10.0f, (R_COMPASS_OFFSET_Y - tempZ) / 10.0f, 0.0f, MTXMODE_NEW); @@ -531,7 +531,7 @@ void Map_Update(GlobalContext* globalCtx) { } for (floor = 0; floor < 8; floor++) { - if (player->actor.posRot.pos.y > gMapData->floorCoordY[mapIndex][floor]) { + if (player->actor.world.pos.y > gMapData->floorCoordY[mapIndex][floor]) { break; } } diff --git a/src/code/z_path.c b/src/code/z_path.c index 0f50fe02a..8ff42c07a 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -24,8 +24,8 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) { pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos = &pointPos[waypoint]; - dx = pointPos->x - actor->posRot.pos.x; - dz = pointPos->z - actor->posRot.pos.z; + dx = pointPos->x - actor->world.pos.x; + dz = pointPos->z - actor->world.pos.z; *yaw = Math_FAtan2F(dx, dz) * (32768 / M_PI); diff --git a/src/code/z_play.c b/src/code/z_play.c index fba0e5a4c..06a5f82d9 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1594,9 +1594,9 @@ s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3 player = camera->player; if (player != NULL) { - camera->posOffset.x = at->x - player->actor.posRot.pos.x; - camera->posOffset.y = at->y - player->actor.posRot.pos.y; - camera->posOffset.z = at->z - player->actor.posRot.pos.z; + camera->posOffset.x = at->x - player->actor.world.pos.x; + camera->posOffset.y = at->y - player->actor.world.pos.y; + camera->posOffset.z = at->z - player->actor.world.pos.z; } else { camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f; } @@ -1622,9 +1622,9 @@ s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Ve player = camera->player; if (player != NULL) { - camera->posOffset.x = at->x - player->actor.posRot.pos.x; - camera->posOffset.y = at->y - player->actor.posRot.pos.y; - camera->posOffset.z = at->z - player->actor.posRot.pos.z; + camera->posOffset.x = at->x - player->actor.world.pos.x; + camera->posOffset.y = at->y - player->actor.world.pos.y; + camera->posOffset.z = at->z - player->actor.world.pos.z; } else { camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f; } @@ -1748,7 +1748,7 @@ void Gameplay_SetupRespawnPoint(GlobalContext* globalCtx, s32 respawnMode, s32 p roomIndex = globalCtx->roomCtx.curRoom.num; entranceIndex = gSaveContext.entranceIndex; Gameplay_SetRespawnData(globalCtx, respawnMode, entranceIndex, roomIndex, playerParams, - &player->actor.posRot.pos, player->actor.shape.rot.y); + &player->actor.world.pos, player->actor.shape.rot.y); } } @@ -1797,7 +1797,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) { TransitionActorEntry* transitionActor; s32 frontRoom; - if (actor->type != ACTORTYPE_DOOR) { + if (actor->category != ACTORCAT_DOOR) { return 0; } diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 616f1e4b3..d6ed609d2 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -19,7 +19,7 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx); const ActorInit Player_InitVars = { ACTOR_PLAYER, - ACTORTYPE_PLAYER, + ACTORCAT_PLAYER, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(Player), diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 248998e21..e4d9141ed 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -389,7 +389,7 @@ void func_8008EDF0(Player* this) { void func_8008EE08(Player* this) { if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & 0x8A00000) || - (!(this->stateFlags1 & 0xC0000) && ((this->actor.posRot.pos.y - this->actor.groundY) < 100.0f))) { + (!(this->stateFlags1 & 0xC0000) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { this->stateFlags1 &= ~0x400F8000; } else if (!(this->stateFlags1 & 0x2C0000)) { this->stateFlags1 |= 0x80000; @@ -1215,11 +1215,11 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (this->actor.scale.y >= 0.0f) { if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) { if (this->stateFlags1 & 0x200) { - Matrix_MultVec3f(&D_80126128, &hookedActor->posRot.pos); + Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos); Matrix_RotateRPY(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); Matrix_Get(&sp14C); - func_800D20CC(&sp14C, &hookedActor->posRot.rot, 0); - hookedActor->shape.rot = hookedActor->posRot.rot; + func_800D20CC(&sp14C, &hookedActor->world.rot, 0); + hookedActor->shape.rot = hookedActor->world.rot; } else if (this->stateFlags1 & 0x800) { Vec3s spB8; @@ -1227,10 +1227,9 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* func_800D20CC(&sp14C, &spB8, 0); if (hookedActor->flags & 0x20000) { - hookedActor->posRot.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x; + hookedActor->world.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x; } else { - hookedActor->posRot.rot.y = hookedActor->shape.rot.y = - this->actor.shape.rot.y + this->unk_3BC.y; + hookedActor->world.rot.y = hookedActor->shape.rot.y = this->actor.shape.rot.y + this->unk_3BC.y; } } } else { @@ -1298,11 +1297,11 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* MtxF sp44; s32 pad; - Matrix_MultVec3f(&D_80126190, &heldActor->posRot.pos); + Matrix_MultVec3f(&D_80126190, &heldActor->world.pos); Matrix_RotateRPY(0, -0x4000, -0x4000, MTXMODE_APPLY); Matrix_Get(&sp44); - func_800D20CC(&sp44, &heldActor->posRot.rot, 0); - heldActor->shape.rot = heldActor->posRot.rot; + func_800D20CC(&sp44, &heldActor->world.rot, 0); + heldActor->shape.rot = heldActor->world.rot; if (func_8002DD78(this) != 0) { Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); @@ -1322,7 +1321,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } if (this->unk_862 == 0) { - Math_Vec3f_Copy(&heldActor->posRot.pos, &sGetItemRefPos); + Math_Vec3f_Copy(&heldActor->world.pos, &sGetItemRefPos); } } } @@ -1337,11 +1336,11 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_Get(&this->shieldMf); } } else if (limbIndex == PLAYER_LIMB_HEAD) { - Matrix_MultVec3f(&D_801260D4, &this->actor.posRot2.pos); + Matrix_MultVec3f(&D_801260D4, &this->actor.focus.pos); } else { Vec3f* vec = &D_801261E0[(0, gSaveContext.linkAge)]; - func_8002BDB0(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, vec, PLAYER_LIMB_R_FOOT, vec); + Actor_SetFeetPos(&this->actor, limbIndex, PLAYER_LIMB_L_FOOT, vec, PLAYER_LIMB_R_FOOT, vec); } } } diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index f0752a3e5..30451a159 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1054,9 +1054,9 @@ void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* da Vec3f diff; SkelAnime_UpdateTranslation(entry->skelAnime, &diff, actor->shape.rot.y); - actor->posRot.pos.x += diff.x * actor->scale.x; - actor->posRot.pos.y += diff.y * actor->scale.y * entry->unk_08; - actor->posRot.pos.z += diff.z * actor->scale.z; + actor->world.pos.x += diff.x * actor->scale.x; + actor->world.pos.y += diff.y * actor->scale.y * entry->unk_08; + actor->world.pos.z += diff.z * actor->scale.z; } /** -- cgit v1.2.3