mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-06 07:56:32 +00:00
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
This commit is contained in:
parent
20206fba0d
commit
00a5edea71
697 changed files with 8157 additions and 7942 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue