Add OoT actor structs and enums (#55)

* add oot structs

* revert formatting

* fix comment thing

* fix accidental renames

* slight fix

* naviEnemyId -> hintId

* fix headers
This commit is contained in:
Zelllll
2021-02-28 21:52:12 -06:00
committed by GitHub
parent 5c761c33f0
commit fb1ed529ad
586 changed files with 888 additions and 870 deletions
+3 -3
View File
@@ -8,10 +8,10 @@ void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) {
s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
s0->base.params = (s0->base.params & 0xFF) - 9;
Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar);
Actor_SetDrawParams(&s0->base.shape, 0, (actor_shadow_draw_func)func_800B3FC0, 12);
Actor_SetDrawParams(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
Collision_InitCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
Collision_CylinderMoveToActor((Actor*)s0, &s0->collision);
s0->base.unkA0.mass = 255;
s0->base.colChkInfo.mass = 255;
s0->update = (ActorFunc)EnAObj_Update1;
}
@@ -26,7 +26,7 @@ void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt) {
if (func_800B84D0((Actor*)this, ctxt) != 0) {
this->update = (ActorFunc)EnAObj_Update2;
} else {
v0 = this->base.rotTowardsLinkY - this->base.shape.rot.y;
v0 = this->base.yawTowardsPlayer - this->base.shape.rot.y;
v1 = (v0 < 0)? -v0 : v0;
if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
func_800B863C((Actor*)this, ctxt);
+3 -3
View File
@@ -38,10 +38,10 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
bgCtxt->dyna.actorMeshArr[index].currParams.pos.y,
bgCtxt->dyna.actorMeshArr[index].currParams.pos.z);
Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->currPosRot.pos, &posWithInv);
Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos);
actor->currPosRot.pos = newPos;
actor->world.pos = newPos;
}
void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* actor) {
@@ -56,7 +56,7 @@ void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* a
}
actor->shape.rot.y += angleChange;
actor->currPosRot.rot.y += angleChange;
actor->world.rot.y += angleChange;
}
void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) {
+14 -14
View File
@@ -2,11 +2,11 @@
#include <global.h>
void BcCheck3_BgActorInit(DynaPolyActor* actor, UNK_TYPE4 param_2) {
actor->dynaPolyId = -1;
actor->bgId = -1;
actor->unk148 = 0;
actor->unk14C = 0;
actor->unk154 = param_2;
actor->dynaFlags = 0;
actor->unk_158 = 0;
}
void BgCheck3_LoadMesh(GlobalContext* ctxt, DynaPolyActor* actor, BgMeshHeader* meshHeader) {
@@ -14,19 +14,19 @@ void BgCheck3_LoadMesh(GlobalContext* ctxt, DynaPolyActor* actor, BgMeshHeader*
header = NULL;
BgCheck_RelocateMeshHeader(meshHeader, &header);
actor->dynaPolyId = BgCheck_AddActorMesh(ctxt, &ctxt->colCtx.dyna, actor, header);
actor->bgId = BgCheck_AddActorMesh(ctxt, &ctxt->colCtx.dyna, actor, header);
}
void BgCheck3_ResetFlags(DynaPolyActor* actor) {
actor->dynaFlags = 0;
actor->unk_158 = 0;
}
void func_800CAE88(DynaPolyActor* actor) {
actor->dynaFlags |= 1;
actor->unk_158 |= 1;
}
void func_800CAE9C(DynaPolyActor* actor) {
actor->dynaFlags |= 2;
actor->unk_158 |= 2;
}
void func_800CAEB0(CollisionContext* bgCtxt, s32 index) {
@@ -39,7 +39,7 @@ void func_800CAEB0(CollisionContext* bgCtxt, s32 index) {
}
void func_800CAEE0(DynaPolyActor* actor) {
actor->dynaFlags |= 4;
actor->unk_158 |= 4;
}
void func_800CAEF4(CollisionContext* bgCtxt, s32 index) {
@@ -52,15 +52,15 @@ void func_800CAEF4(CollisionContext* bgCtxt, s32 index) {
}
void func_800CAF24(DynaPolyActor* actor) {
actor->dynaFlags |= 8;
actor->unk_158 |= 8;
}
void func_800CAF38(DynaPolyActor* actor) {
actor->dynaFlags |= 0x10;
actor->unk_158 |= 0x10;
}
s32 func_800CAF4C(DynaPolyActor* actor) {
if (actor->dynaFlags & 1) {
if (actor->unk_158 & 1) {
return 1;
} else {
return 0;
@@ -68,7 +68,7 @@ s32 func_800CAF4C(DynaPolyActor* actor) {
}
s32 func_800CAF70(DynaPolyActor* actor) {
if (actor->dynaFlags & 2) {
if (actor->unk_158 & 2) {
return 1;
} else {
return 0;
@@ -76,7 +76,7 @@ s32 func_800CAF70(DynaPolyActor* actor) {
}
s32 func_800CAF94(DynaPolyActor* actor) {
if (actor->dynaFlags & 4) {
if (actor->unk_158 & 4) {
return 1;
} else {
return 0;
@@ -84,7 +84,7 @@ s32 func_800CAF94(DynaPolyActor* actor) {
}
s32 func_800CAFB8(DynaPolyActor* actor) {
if (actor->dynaFlags & 8) {
if (actor->unk_158 & 8) {
return 1;
} else {
return 0;
@@ -92,7 +92,7 @@ s32 func_800CAFB8(DynaPolyActor* actor) {
}
s32 func_800CAFDC(DynaPolyActor* actor) {
if (actor->dynaFlags & 0x10) {
if (actor->unk_158 & 0x10) {
return 1;
} else {
return 0;
+9 -9
View File
@@ -31,8 +31,8 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
s16 targetYaw;
s16 yawDiffFromTarget;
targetPitch = Math_Vec3f_Pitch(&actor->topPosRot.pos,param_2);
targetYaw = Math_Vec3f_Yaw(&actor->topPosRot.pos,param_2) - actor->currPosRot.rot.y;
targetPitch = Math_Vec3f_Pitch(&actor->focus.pos,param_2);
targetYaw = Math_Vec3f_Yaw(&actor->focus.pos,param_2) - actor->world.rot.y;
Math_SmoothScaleMaxMinS(&param_3->x, targetPitch, 6, 2000, 1);
param_3->x = (param_3->x < -6000)? -6000 : ((6000 < param_3->x)? 6000 : param_3->x);
@@ -58,11 +58,11 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
actor->topPosRot.pos = actor->currPosRot.pos;
actor->topPosRot.pos.y += param_5;
actor->focus.pos = actor->world.pos;
actor->focus.pos.y += param_5;
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->rotTowardsLinkY - actor->shape.rot.y;
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
@@ -73,7 +73,7 @@ s32 func_800E9138(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state != 0) || (D_801D0D50 != 0)) {
local_14 = ctxt->view.eye;
} else {
local_14 = player->topPosRot.pos;
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
@@ -86,10 +86,10 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
Vec3f local_14;
player = (ctxt->actorCtx).actorList[2].first;
actor->topPosRot.pos = param_5;
actor->focus.pos = param_5;
if (((ctxt->csCtx).state == 0) && (D_801D0D50 == 0)) {
sVar3 = actor->rotTowardsLinkY - actor->shape.rot.y;
sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y;
// TODO is this shifting because of a missing cast?
if (0x42ff < (sVar3 < 0? ((-sVar3 << 0x10) >> 0x10) : ((sVar3 << 0x10) >> 0x10))) {
func_800E8F08(param_3,param_4);
@@ -100,7 +100,7 @@ s32 func_800E9250(GlobalContext* ctxt, Actor* actor, Vec3s* param_3, Vec3s* para
if (((ctxt->csCtx).state != 0) || (D_801D0D50 != 0)) {
local_14 = ctxt->view.eye;
} else {
local_14 = player->topPosRot.pos;
local_14 = player->focus.pos;
}
func_800E8FA4(actor,&local_14,param_3,param_4);
+50 -50
View File
@@ -7,11 +7,11 @@
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//Actor_PrintLists.asm")
void Actor_SetDrawParams(ActorShape* iParm1, f32 yDisplacement, actor_shadow_draw_func func, f32 scale) {
iParm1->yDisplacement = yDisplacement;
iParm1->shadowDrawFunc = func;
iParm1->scale = scale;
iParm1->alphaScale = 255;
void Actor_SetDrawParams(ActorShape* actorShape, f32 yOffset, ActorShadowFunc func, f32 scale) {
actorShape->yOffset = yOffset;
actorShape->shadowDraw = func;
actorShape->shadowScale = scale;
actorShape->shadowAlpha = 255;
}
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//Actor_PostDraw.asm")
@@ -50,8 +50,8 @@ void Actor_TargetContextInit(TargetContext* targetCtxt, Actor* actor, GlobalCont
targetCtxt->unk4B = 0;
targetCtxt->unk4C = 0;
targetCtxt->unk40 = 0;
func_800B5040(targetCtxt, actor, actor->type, ctxt);
func_800B4F78(targetCtxt, actor->type, ctxt);
func_800B5040(targetCtxt, actor, actor->category, ctxt);
func_800B4F78(targetCtxt, actor->category, ctxt);
}
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//func_800B5208.asm")
@@ -186,24 +186,24 @@ void Actor_MarkForDeath(Actor* actor) {
}
void Actor_InitCurrPosition(Actor* actor) {
actor->currPosRot = actor->initPosRot;
actor->world = actor->home;
}
void Actor_SetHeight(Actor* actor, f32 height) {
actor->topPosRot.pos.x = actor->currPosRot.pos.x;
actor->topPosRot.pos.y = actor->currPosRot.pos.y + height;
actor->topPosRot.pos.z = actor->currPosRot.pos.z;
actor->topPosRot.rot.x = actor->currPosRot.rot.x;
actor->topPosRot.rot.y = actor->currPosRot.rot.y;
actor->topPosRot.rot.z = actor->currPosRot.rot.z;
actor->focus.pos.x = actor->world.pos.x;
actor->focus.pos.y = actor->world.pos.y + height;
actor->focus.pos.z = actor->world.pos.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 Actor_SetRotationFromDrawRotation(Actor* actor) {
actor->currPosRot.rot = actor->shape.rot;
actor->world.rot = actor->shape.rot;
}
void Actor_InitDrawRotation(Actor* actor) {
actor->shape.rot = actor->currPosRot.rot;
actor->shape.rot = actor->world.rot;
}
void Actor_SetScale(Actor* actor, f32 scale) {
@@ -222,18 +222,18 @@ void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) {
Actor_InitCurrPosition(actor);
Actor_InitDrawRotation(actor);
Actor_SetHeight(actor, 0);
Math_Vec3f_Copy(&actor->lastPos, &actor->currPosRot.pos);
Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos);
Actor_SetScale(actor, 0.01);
actor->unk1F = 3;
actor->targetMode = 3;
actor->minYVelocity = -20.0f;
actor->meshAttachedTo = 0x32;
actor->sqrdDistToLink = D_801DCA54;
func_800E7494(&actor->unkA0);
actor->unkFC = 1000.0f;
actor->unk100 = 350.0f;
actor->unk104 = 700.0f;
func_800E7494(&actor->colChkInfo);
actor->uncullZoneForward = 1000.0f;
actor->uncullZoneScale = 350.0f;
actor->uncullZoneDownward = 700.0f;
actor->naviMsgId = 255;
@@ -263,9 +263,9 @@ void Actor_SetMovementScale(s32 scale) {
#ifdef NON_MATCHING
void Actor_ApplyMovement(Actor* actor) {
actor->currPosRot.pos.x += ((actor->velocity.x * actorMovementScale) + actor->unkA0.displacement.x);
actor->currPosRot.pos.y += ((actor->velocity.y * actorMovementScale) + actor->unkA0.displacement.y);
actor->currPosRot.pos.z += ((actor->velocity.z * actorMovementScale) + actor->unkA0.displacement.z);
actor->world.pos.x += ((actor->velocity.x * actorMovementScale) + actor->colChkInfo.displacement.x);
actor->world.pos.y += ((actor->velocity.y * actorMovementScale) + actor->colChkInfo.displacement.y);
actor->world.pos.z += ((actor->velocity.z * actorMovementScale) + actor->colChkInfo.displacement.z);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//Actor_ApplyMovement.asm")
@@ -273,9 +273,9 @@ void Actor_ApplyMovement(Actor* actor) {
#ifdef NON_MATCHING
void Actor_SetVelocityYRotationAndGravity(Actor* actor) {
actor->velocity.x = actor->speedXZ * Math_Sins(actor->currPosRot.rot.x);
actor->velocity.x = actor->speedXZ * Math_Sins(actor->world.rot.x);
actor->velocity.y = actor->velocity.y + actor->gravity;
actor->velocity.z = actor->speedXZ * Math_Coss(actor->currPosRot.rot.x);
actor->velocity.z = actor->speedXZ * Math_Coss(actor->world.rot.x);
if (actor->velocity.y < actor->minYVelocity) {
actor->velocity.y = actor->minYVelocity;
@@ -291,10 +291,10 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
}
void Actor_SetVelocityXYRotation(Actor* actor) {
f32 velX = Math_Coss(actor->currPosRot.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->currPosRot.rot.y) * velX;
actor->velocity.y = Math_Sins(actor->currPosRot.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->currPosRot.rot.y) * velX;
f32 velX = Math_Coss(actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
actor->velocity.y = Math_Sins(actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
}
void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
@@ -303,10 +303,10 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
}
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
f32 velX = Math_Coss(-actor->currPosRot.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->currPosRot.rot.y) * velX;
actor->velocity.y = Math_Sins(-actor->currPosRot.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->currPosRot.rot.y) * velX;
f32 velX = Math_Coss(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
actor->velocity.y = Math_Sins(-actor->world.rot.x) * actor->speedXZ;
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
}
void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) {
@@ -319,43 +319,43 @@ void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) {
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//func_800B6C58.asm")
s16 Actor_YawBetweenActors(Actor* from, Actor* to) {
return Math_Vec3f_Yaw(&from->currPosRot.pos, &to->currPosRot.pos);
return Math_Vec3f_Yaw(&from->world.pos, &to->world.pos);
}
s16 Actor_YawBetweenActorsTop(Actor* from, Actor* to) {
return Math_Vec3f_Yaw(&from->topPosRot.pos, &to->topPosRot.pos);
return Math_Vec3f_Yaw(&from->focus.pos, &to->focus.pos);
}
s16 Actor_YawToPoint(Actor* actor, Vec3f* point) {
return Math_Vec3f_Yaw(&actor->currPosRot.pos, point);
return Math_Vec3f_Yaw(&actor->world.pos, point);
}
s16 Actor_PitchBetweenActors(Actor* from, Actor* to) {
return Math_Vec3f_Pitch(&from->currPosRot.pos, &to->currPosRot.pos);
return Math_Vec3f_Pitch(&from->world.pos, &to->world.pos);
}
s16 Actor_PitchBetweenActorsTop(Actor* from, Actor* to) {
return Math_Vec3f_Pitch(&from->topPosRot.pos, &to->topPosRot.pos);
return Math_Vec3f_Pitch(&from->focus.pos, &to->focus.pos);
}
s16 Actor_PitchToPoint(Actor* actor, Vec3f* point) {
return Math_Vec3f_Pitch(&actor->currPosRot.pos, point);
return Math_Vec3f_Pitch(&actor->world.pos, point);
}
f32 Actor_DistanceBetweenActors(Actor* actor1, Actor* actor2) {
return Math_Vec3f_DistXYZ(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
return Math_Vec3f_DistXYZ(&actor1->world.pos, &actor2->world.pos);
}
f32 Actor_DistanceToPoint(Actor* actor, Vec3f* point) {
return Math_Vec3f_DistXYZ(&actor->currPosRot.pos, point);
return Math_Vec3f_DistXYZ(&actor->world.pos, point);
}
f32 Actor_XZDistanceBetweenActors(Actor* actor1, Actor* actor2) {
return Math_Vec3f_DistXZ(&actor1->currPosRot.pos, &actor2->currPosRot.pos);
return Math_Vec3f_DistXZ(&actor1->world.pos, &actor2->world.pos);
}
f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point) {
return Math_Vec3f_DistXZ(&actor->currPosRot.pos, point);
return Math_Vec3f_DistXZ(&actor->world.pos, point);
}
void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f* point) {
@@ -366,15 +366,15 @@ void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f*
cos_rot_y = Math_Coss(actor->shape.rot.y);
sin_rot_y = Math_Sins(actor->shape.rot.y);
imm_x = point->x - actor->currPosRot.pos.x;
imm_z = point->z - actor->currPosRot.pos.z;
imm_x = point->x - actor->world.pos.x;
imm_z = point->z - actor->world.pos.z;
offset->x = ((imm_x * cos_rot_y) - (imm_z * sin_rot_y));
offset->z = ((imm_z * cos_rot_y) + (imm_x * sin_rot_y));
offset->y = point->y - actor->currPosRot.pos.y;
offset->y = point->y - actor->world.pos.y;
}
f32 Actor_YDistance(Actor* actor1, Actor* actor2) {
return actor2->currPosRot.pos.y - actor1->currPosRot.pos.y;
return actor2->world.pos.y - actor1->world.pos.y;
}
#pragma GLOBAL_ASM("asm/non_matchings/z_actor//func_800B6F20.asm")
@@ -425,7 +425,7 @@ s32 Actor_IsActorFacedByActor(Actor* actor, Actor* other, s16 tolerance) {
s32 Actor_IsActorFacingLink(Actor* actor, s16 angle) {
s16 dist;
dist = actor->rotTowardsLinkY - actor->shape.rot.y;
dist = actor->yawTowardsPlayer - actor->shape.rot.y;
if (ABS(dist) < angle) {
return 1;
}
+2 -2
View File
@@ -107,8 +107,8 @@ s32 Scene_FindSceneObjectIndex(SceneContext* sceneCtxt, s16 objectId) {
return -1;
}
s32 Scene_IsObjectLoaded(SceneContext* iParm1, s32 index) {
if (iParm1->objects[index].id > 0) {
s32 Scene_IsObjectLoaded(SceneContext* actorShape, s32 index) {
if (actorShape->objects[index].id > 0) {
return 1;
} else {
return 0;
+3 -3
View File
@@ -1072,9 +1072,9 @@ void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType
Vec3f pos;
func_80137748(entry->skelAnime, &pos, actor->shape.rot.y);
actor->currPosRot.pos.x += (pos.x * actor->scale.x) * entry->unk08;
actor->currPosRot.pos.y += (pos.y * actor->scale.y) * entry->unk08;
actor->currPosRot.pos.z += (pos.z * actor->scale.z) * entry->unk08;
actor->world.pos.x += (pos.x * actor->scale.x) * entry->unk08;
actor->world.pos.y += (pos.y * actor->scale.y) * entry->unk08;
actor->world.pos.z += (pos.z * actor->scale.z) * entry->unk08;
}
void func_80135EE8(GlobalContext* globalCtx, AnimationContext* animationCtx) {