mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Document Camera Special9 (door) angle bug (#1525)
* document special9 angle bug * Update src/code/z_camera.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> --------- Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
7235af2249
commit
7145bc346d
1 changed files with 14 additions and 8 deletions
|
@ -6876,7 +6876,7 @@ s32 Camera_Special9(Camera* camera) {
|
||||||
f32 playerYOffset;
|
f32 playerYOffset;
|
||||||
s32 pad3;
|
s32 pad3;
|
||||||
PosRot* playerPosRot = &camera->playerPosRot;
|
PosRot* playerPosRot = &camera->playerPosRot;
|
||||||
PosRot adjustedPlayerPosRot;
|
PosRot referencePosRot;
|
||||||
f32 yNormal;
|
f32 yNormal;
|
||||||
DoorParams* doorParams = &camera->paramData.doorParams;
|
DoorParams* doorParams = &camera->paramData.doorParams;
|
||||||
Special9ReadOnlyData* roData = &camera->paramData.spec9.roData;
|
Special9ReadOnlyData* roData = &camera->paramData.spec9.roData;
|
||||||
|
@ -6902,11 +6902,11 @@ s32 Camera_Special9(Camera* camera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doorParams->doorActor != NULL) {
|
if (doorParams->doorActor != NULL) {
|
||||||
Actor_GetWorldPosShapeRot(&adjustedPlayerPosRot, doorParams->doorActor);
|
Actor_GetWorldPosShapeRot(&referencePosRot, doorParams->doorActor);
|
||||||
} else {
|
} else {
|
||||||
adjustedPlayerPosRot = *playerPosRot;
|
referencePosRot = *playerPosRot;
|
||||||
adjustedPlayerPosRot.pos.y += playerYOffset + roData->yOffset;
|
referencePosRot.pos.y += playerYOffset + roData->yOffset;
|
||||||
adjustedPlayerPosRot.rot.x = 0;
|
referencePosRot.rot.x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLib_Vec3fDiffToVecGeo(&atEyeOffsetGeo, at, eye);
|
OLib_Vec3fDiffToVecGeo(&atEyeOffsetGeo, at, eye);
|
||||||
|
@ -6919,9 +6919,15 @@ s32 Camera_Special9(Camera* camera) {
|
||||||
case 0:
|
case 0:
|
||||||
camera->stateFlags &= ~(CAM_STATE_1 | CAM_STATE_2);
|
camera->stateFlags &= ~(CAM_STATE_1 | CAM_STATE_2);
|
||||||
camera->animState++;
|
camera->animState++;
|
||||||
rwData->targetYaw = ABS(playerPosRot->rot.y - adjustedPlayerPosRot.rot.y) >= 0x4000
|
|
||||||
? adjustedPlayerPosRot.rot.y - 0x7FFF
|
//! @bug The angle passed to ABS should be cast to s16.
|
||||||
: adjustedPlayerPosRot.rot.y;
|
//! The lack of a cast means that a door which has an angle of around 0x8000 will calculate an incorrect
|
||||||
|
//! angle and use an incorrect `targetYaw`.
|
||||||
|
//! In-game, this means if the player opens a susceptible door at a slanted angle, the camera will not
|
||||||
|
//! appear correctly on the other side after the player has walked through the door.
|
||||||
|
rwData->targetYaw = ABS(playerPosRot->rot.y - referencePosRot.rot.y) >= 0x4000
|
||||||
|
? referencePosRot.rot.y - 0x7FFF
|
||||||
|
: referencePosRot.rot.y;
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case 1:
|
case 1:
|
||||||
doorParams->timer1--;
|
doorParams->timer1--;
|
||||||
|
|
Loading…
Reference in a new issue