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 22:52:12 -05: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) {
+25 -25
View File
@@ -14,7 +14,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx);
const ActorInit Arms_Hook_InitVars = {
ACTOR_ARMS_HOOK,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
GAMEPLAY_KEEP,
sizeof(ArmsHook),
@@ -50,7 +50,7 @@ void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
Collision_InitQuadDefault(globalCtx, &this->collider);
Collision_InitQuadWithData(globalCtx, &this->collider, &this->actor, &D_808C1BC0);
ArmsHook_SetupAction(this, ArmsHook_Wait);
this->unk1E0 = this->actor.currPosRot.pos;
this->unk1E0 = this->actor.world.pos;
}
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@@ -100,7 +100,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
((player->stateFlags1 & 0x4000080))) {
this->timer = 0;
ArmsHook_DetachHookFromActor(this);
Math_Vec3f_Copy(&this->actor.currPosRot.pos, &player->unk368);
Math_Vec3f_Copy(&this->actor.world.pos, &player->unk368);
return 1;
}
}
@@ -110,7 +110,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
actor->flags |= 0x2000;
this->grabbed = actor;
Math_Vec3f_Diff(&actor->currPosRot.pos, &this->actor.currPosRot.pos, &this->unk1FC);
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->unk1FC);
}
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
@@ -158,7 +158,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
if (this->actor.child != NULL) {
f32 sp94 = Actor_DistanceBetweenActors(this, grabbed);
f32 sp90 = sqrtf(SQ(this->unk1FC.x) + SQ(this->unk1FC.y) + SQ(this->unk1FC.z));
Math_Vec3f_Diff(&grabbed->currPosRot.pos, &this->unk1FC, &this->actor.currPosRot.pos);
Math_Vec3f_Diff(&grabbed->world.pos, &this->unk1FC, &this->actor.world.pos);
if (50.0f < (sp94 - sp90)) {
ArmsHook_DetachHookFromActor(this);
grabbed = NULL;
@@ -171,7 +171,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
f32 velocity;
bodyDistDiff =
Math_Vec3f_DistXYZAndStoreDiff(&player->unk368, &this->actor.currPosRot.pos, &bodyDistDiffVec);
Math_Vec3f_DistXYZAndStoreDiff(&player->unk368, &this->actor.world.pos, &bodyDistDiffVec);
if (bodyDistDiff < 30.0f) {
velocity = 0.0f;
phi_f16 = 0.0f;
@@ -198,13 +198,13 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
}
if (this->actor.child == NULL) {
Math_Vec3f_Sum(&player->unk368, &newPos, &this->actor.currPosRot.pos);
Math_Vec3f_Sum(&player->unk368, &newPos, &this->actor.world.pos);
if (grabbed != NULL) {
Math_Vec3f_Sum(&this->actor.currPosRot.pos, &this->unk1FC, &grabbed->currPosRot.pos);
Math_Vec3f_Sum(&this->actor.world.pos, &this->unk1FC, &grabbed->world.pos);
}
} else {
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->base.velocity);
player->base.currPosRot.rot.x =
player->base.world.rot.x =
atans_flip(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
}
if (phi_f16 < 50.0f) {
@@ -212,47 +212,47 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
if (phi_f16 == 0.0f) {
ArmsHook_SetupAction(this, ArmsHook_Wait);
if (ArmsHook_AttachToPlayer(this, player)) {
Math_Vec3f_Diff(&this->actor.currPosRot.pos, &player->base.currPosRot.pos, &player->base.velocity);
Math_Vec3f_Diff(&this->actor.world.pos, &player->base.world.pos, &player->base.velocity);
player->base.velocity.y -= 20.0f;
}
}
}
} else {
BgPolygon* poly;
u32 dynaPolyID;
u32 bgId;
Vec3f sp78;
Vec3f prevFrameDiff;
Vec3f sp60;
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
Math_Vec3f_Diff(&this->actor.currPosRot.pos, &this->actor.lastPos, &prevFrameDiff);
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
Math_Vec3f_Sum(&this->unk1E0, &prevFrameDiff, &this->unk1E0);
this->actor.shape.rot.x = atans_flip(this->actor.speedXZ, -this->actor.velocity.y);
sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x);
sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y);
sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z);
if (func_800C55C4(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID) != 0 &&
(func_800B90AC(globalCtx, &this->actor, poly, dynaPolyID, &sp78) == 0 ||
func_800C576C(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &dynaPolyID) != 0)) {
if (func_800C55C4(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &bgId) != 0 &&
(func_800B90AC(globalCtx, &this->actor, poly, bgId, &sp78) == 0 ||
func_800C576C(&globalCtx->colCtx, &sp60, &this->unk1E0, &sp78, &poly, 1, 1, 1, 1, &bgId) != 0)) {
f32 sp5C = poly->normal.x * (1 / SHT_MAX);
f32 sp58 = poly->normal.z * (1 / SHT_MAX);
Math_Vec3f_Copy(&this->actor.currPosRot.pos, &sp78);
this->actor.currPosRot.pos.x += 10.0f * sp5C;
this->actor.currPosRot.pos.z += 10.0f * sp58;
Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
this->actor.world.pos.x += 10.0f * sp5C;
this->actor.world.pos.z += 10.0f * sp58;
this->timer = 1;
if (func_800C9CEC(&globalCtx->colCtx, poly, dynaPolyID)) {
if (func_800C9CEC(&globalCtx->colCtx, poly, bgId)) {
{
DynaPolyActor* dynaPolyActor;
if (dynaPolyID != 0x32 &&
(dynaPolyActor = BgCheck_GetActorOfMesh(&globalCtx->colCtx, dynaPolyID)) != NULL) {
if (bgId != 0x32 &&
(dynaPolyActor = BgCheck_GetActorOfMesh(&globalCtx->colCtx, bgId)) != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
}
func_808C1154(this);
func_8019F1C0(&this->actor.projectedPos, 0x1829);
} else {
func_800E8668(globalCtx, &this->actor.currPosRot.pos);
func_800E8668(globalCtx, &this->actor.world.pos);
func_8019F1C0(&this->actor.projectedPos, 0x1813);
}
} else {
@@ -305,9 +305,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPMatrix(sp44->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(sp44->polyOpa.p++, D_0601D960);
SysMatrix_InsertTranslation(this->actor.currPosRot.pos.x, this->actor.currPosRot.pos.y,
this->actor.currPosRot.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk368, &this->actor.currPosRot.pos, &sp68);
SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk368, &this->actor.world.pos, &sp68);
sp48 = SQ(sp68.x) + SQ(sp68.z);
sp4C = sqrtf(sp48);
SysMatrix_InsertYRotation_s(atans(sp68.x, sp68.z), MTXMODE_APPLY);
@@ -12,7 +12,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Arrow_Fire_InitVars = {
ACTOR_ARROW_FIRE,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
GAMEPLAY_KEEP,
sizeof(ArrowFire),
@@ -12,7 +12,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Arrow_Ice_InitVars = {
ACTOR_ARROW_ICE,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
GAMEPLAY_KEEP,
sizeof(ArrowIce),
@@ -12,7 +12,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Arrow_Light_InitVars = {
ACTOR_ARROW_LIGHT,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
GAMEPLAY_KEEP,
sizeof(ArrowLight),
@@ -12,7 +12,7 @@ void BgAstrBombwall_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Astr_Bombwall_InitVars = {
ACTOR_BG_ASTR_BOMBWALL,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
OBJECT_ASTR_OBJ,
sizeof(BgAstrBombwall),
@@ -12,7 +12,7 @@ void BgBotihasira_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Botihasira_InitVars = {
ACTOR_BG_BOTIHASIRA,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
OBJECT_BOTIHASIRA,
sizeof(BgBotihasira),
@@ -10,7 +10,7 @@ void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Breakwall_InitVars = {
ACTOR_BG_BREAKWALL,
ACTORTYPE_ITEMACTION,
ACTORCAT_ITEMACTION,
FLAGS,
GAMEPLAY_KEEP,
sizeof(BgBreakwall),
@@ -12,7 +12,7 @@ void BgCraceMovebg_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Crace_Movebg_InitVars = {
ACTOR_BG_CRACE_MOVEBG,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
OBJECT_CRACE_OBJECT,
sizeof(BgCraceMovebg),
@@ -12,7 +12,7 @@ void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Ctower_Gear_InitVars = {
ACTOR_BG_CTOWER_GEAR,
ACTORTYPE_PROP,
ACTORCAT_PROP,
FLAGS,
OBJECT_CTOWER_ROT,
sizeof(BgCtowerGear),
@@ -12,7 +12,7 @@ void BgCtowerRot_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Ctower_Rot_InitVars = {
ACTOR_BG_CTOWER_ROT,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
OBJECT_CTOWER_ROT,
sizeof(BgCtowerRot),
@@ -11,7 +11,7 @@ void BgDanpeiMovebg_Update(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Danpei_Movebg_InitVars = {
ACTOR_BG_DANPEI_MOVEBG,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
GAMEPLAY_KEEP,
sizeof(BgDanpeiMovebg),
@@ -12,7 +12,7 @@ void BgDblueBalance_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Dblue_Balance_InitVars = {
ACTOR_BG_DBLUE_BALANCE,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
OBJECT_DBLUE_OBJECT,
sizeof(BgDblueBalance),
@@ -12,7 +12,7 @@ void BgDblueElevator_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Dblue_Elevator_InitVars = {
ACTOR_BG_DBLUE_ELEVATOR,
ACTORTYPE_BG,
ACTORCAT_BG,
FLAGS,
OBJECT_DBLUE_OBJECT,
sizeof(BgDblueElevator),

Some files were not shown because too many files have changed in this diff Show More