1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-15 20:35:13 +00:00

OnePointDemo ActionFlags Macros (#1451)

* actionflags

* more macros

* distinguish enums better

* PR Suggestions

* Update src/code/z_camera_data.inc.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_camera_data.inc.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
engineer124 2022-12-11 22:18:36 -05:00 committed by GitHub
parent 2e9e895bf9
commit da06e9a701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 3803 additions and 401 deletions

View file

@ -5464,9 +5464,9 @@ s32 Camera_Unique9(Camera* camera) {
rwData->rollTarget = CAM_DEG_TO_BINANG(rwData->curKeyFrame->rollTargetInit);
}
action = rwData->curKeyFrame->actionFlags & 0x1F;
action = ONEPOINT_CS_GET_ACTION(rwData->curKeyFrame);
switch (action) {
case 15:
case ONEPOINT_CS_ACTION_ID_15:
// static copy to at/eye/fov/roll
*at = rwData->atTarget;
*eyeNext = rwData->eyeTarget;
@ -5474,7 +5474,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->roll = rwData->rollTarget;
camera->stateFlags |= CAM_STATE_10;
break;
case 21:
case ONEPOINT_CS_ACTION_ID_21:
// same as 15, but with unk_38 ?
if (rwData->unk_38 == 0) {
rwData->unk_38 = 1;
@ -5487,7 +5488,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->fov = rwData->fovTarget;
camera->roll = rwData->rollTarget;
break;
case 16:
case ONEPOINT_CS_ACTION_ID_16:
// same as 21, but don't unset CAM_STATE_3 on stateFlags
if (rwData->unk_38 == 0) {
rwData->unk_38 = 1;
@ -5500,7 +5502,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->fov = rwData->fovTarget;
camera->roll = rwData->rollTarget;
break;
case 1:
case ONEPOINT_CS_ACTION_ID_1:
// linear interpolation of eye/at using the geographic coordinates
OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
OLib_Vec3fDiffToVecGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
@ -5512,7 +5515,8 @@ s32 Camera_Unique9(Camera* camera) {
eyeNextAtOffset.yaw + ((s16)(rwData->atEyeOffsetTarget.yaw - eyeNextAtOffset.yaw) * invKeyFrameTimer);
Camera_AddVecGeoToVec3f(&eyeTarget, at, &scratchGeo);
goto setEyeNext;
case 2:
case ONEPOINT_CS_ACTION_ID_2:
// linear interpolation of eye/at using the eyeTarget
invKeyFrameTimer = 1.0f / rwData->keyFrameTimer;
eyeTarget.x = F32_LERPIMP(camera->eyeNext.x, rwData->eyeTarget.x, invKeyFrameTimer);
@ -5527,8 +5531,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->eyeNext.z =
Camera_LERPFloorF(eyeTarget.z, camera->eyeNext.z, rwData->curKeyFrame->lerpStepScale, 1.0f);
FALLTHROUGH;
case 9:
case 10:
case ONEPOINT_CS_ACTION_ID_9:
case ONEPOINT_CS_ACTION_ID_10:
// linear interpolation of at/fov/roll
invKeyFrameTimer = 1.0f / rwData->keyFrameTimer;
atTarget.x = F32_LERPIMP(camera->at.x, rwData->atTarget.x, invKeyFrameTimer);
@ -5542,7 +5546,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->roll = Camera_LERPFloorS(BINANG_LERPIMPINV(camera->roll, rwData->rollTarget, rwData->keyFrameTimer),
camera->roll, rwData->curKeyFrame->lerpStepScale, 0xA);
break;
case 4:
case ONEPOINT_CS_ACTION_ID_4:
// linear interpolation of eye/at/fov/roll using the step scale, and spherical coordinates
OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
OLib_Vec3fDiffToVecGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
@ -5554,7 +5559,8 @@ s32 Camera_Unique9(Camera* camera) {
rwData->curKeyFrame->lerpStepScale, 1);
Camera_AddVecGeoToVec3f(eyeNext, at, &scratchGeo);
goto setAtFOVRoll;
case 3:
case ONEPOINT_CS_ACTION_ID_3:
// linear interplation of eye/at/fov/roll using the step scale using eyeTarget
camera->eyeNext.x =
Camera_LERPCeilF(rwData->eyeTarget.x, camera->eyeNext.x, rwData->curKeyFrame->lerpStepScale, 1.0f);
@ -5563,8 +5569,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->eyeNext.z =
Camera_LERPCeilF(rwData->eyeTarget.z, camera->eyeNext.z, rwData->curKeyFrame->lerpStepScale, 1.0f);
FALLTHROUGH;
case 11:
case 12:
case ONEPOINT_CS_ACTION_ID_11:
case ONEPOINT_CS_ACTION_ID_12:
setAtFOVRoll:
// linear interpolation of at/fov/roll using the step scale.
camera->at.x = Camera_LERPCeilF(rwData->atTarget.x, camera->at.x, rwData->curKeyFrame->lerpStepScale, 1.0f);
@ -5573,7 +5579,8 @@ s32 Camera_Unique9(Camera* camera) {
camera->fov = Camera_LERPCeilF(rwData->fovTarget, camera->fov, rwData->curKeyFrame->lerpStepScale, 1.0f);
camera->roll = Camera_LERPCeilS(rwData->rollTarget, camera->roll, rwData->curKeyFrame->lerpStepScale, 1);
break;
case 13:
case ONEPOINT_CS_ACTION_ID_13:
// linear interpolation of at, with rotation around eyeTargetInit.y
camera->at.x = Camera_LERPCeilF(rwData->atTarget.x, camera->at.x, rwData->curKeyFrame->lerpStepScale, 1.0f);
camera->at.y += camera->playerPosDelta.y * rwData->curKeyFrame->lerpStepScale;
@ -5603,18 +5610,20 @@ s32 Camera_Unique9(Camera* camera) {
camera->fov, rwData->curKeyFrame->lerpStepScale, 1.0f);
camera->roll = Camera_LERPCeilS(rwData->rollTarget, camera->roll, rwData->curKeyFrame->lerpStepScale, 1);
break;
case 24:
case ONEPOINT_CS_ACTION_ID_24:
// Set current keyframe to the roll target?
rwData->curKeyFrameIdx = rwData->rollTarget;
break;
case 19: {
case ONEPOINT_CS_ACTION_ID_19: {
// Change the parent camera (or default)'s mode to normal
s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
}
FALLTHROUGH;
case 18: {
case ONEPOINT_CS_ACTION_ID_18: {
// copy the current camera to the parent (or default)'s camera.
s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera* cam = camera->play->cameraPtrs[camIdx];
@ -5632,11 +5641,11 @@ s32 Camera_Unique9(Camera* camera) {
*eye = *eyeNext;
if (rwData->curKeyFrame->actionFlags & 0x80) {
if (rwData->curKeyFrame->actionFlags & ONEPOINT_CS_ACTION_FLAG_BGCHECK) {
Camera_BGCheck(camera, at, eye);
}
if (rwData->curKeyFrame->actionFlags & 0x40) {
if (rwData->curKeyFrame->actionFlags & ONEPOINT_CS_ACTION_FLAG_40) {
// Set the player's position
camera->player->actor.world.pos.x = rwData->playerPos.x;
camera->player->actor.world.pos.z = rwData->playerPos.z;
@ -6072,7 +6081,7 @@ s32 Camera_Demo5(Camera* camera) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D79C);
if ((targetScreenPosX < 0x15) || (targetScreenPosX >= 0x12C) || (targetScreenPosY < 0x29) ||
(targetScreenPosY >= 0xC8)) {
D_8011D79C[0].actionFlags = 0x41;
D_8011D79C[0].actionFlags = ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false);
D_8011D79C[0].atTargetInit.y = -30.0f;
D_8011D79C[0].atTargetInit.x = 0.0f;
D_8011D79C[0].atTargetInit.z = 0.0f;
@ -6156,8 +6165,8 @@ s32 Camera_Demo5(Camera* camera) {
targethead.pos.x += 50.0f * Math_SinS(sp4A - 0x7FFF);
targethead.pos.z += 50.0f * Math_CosS(sp4A - 0x7FFF);
if (Camera_BGCheck(camera, &playerhead.pos, &targethead.pos)) {
D_8011D954[1].actionFlags = 0xC1;
D_8011D954[2].actionFlags = 0x8F;
D_8011D954[1].actionFlags = ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true);
D_8011D954[2].actionFlags = ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true);
} else {
D_8011D954[2].timerInit = (s16)(eyeTargetDist * 0.004f) + 6;
}
@ -6181,7 +6190,7 @@ s32 Camera_Demo5(Camera* camera) {
Actor_GetFocus(&targethead, camera->target);
if (Camera_BGCheck(camera, &playerhead.pos, &targethead.pos)) {
D_8011D9F4[1].timerInit = 4;
D_8011D9F4[1].actionFlags = 0x8F;
D_8011D9F4[1].actionFlags = ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true);
} else {
t = eyeTargetDist * 0.005f;
D_8011D9F4[1].timerInit = t + 8;