1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-12 19:04:38 +00:00

Merge branch 'master' into doc_pause_menu

This commit is contained in:
Dragorn421 2022-12-19 11:18:54 +01:00
commit f8e8e58d00
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
254 changed files with 2585 additions and 2399 deletions

View file

@ -1714,12 +1714,18 @@ void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4)
func_8002F758(play, actor, arg2, arg3, arg4, 0);
}
void func_8002F7DC(Actor* actor, u16 sfxId) {
Audio_PlaySfxGeneral(sfxId, &actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
/**
* Play a sound effect at the player's position
*/
void Player_PlaySfx(Player* player, u16 sfxId) {
Audio_PlaySfxGeneral(sfxId, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
void Audio_PlayActorSfx2(Actor* actor, u16 sfxId) {
/**
* Play a sound effect at the actor's position
*/
void Actor_PlaySfx(Actor* actor, u16 sfxId) {
func_80078914(&actor->projectedPos, sfxId);
}
@ -1783,7 +1789,7 @@ s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId,
if (SurfaceType_GetFloorType(&play->colCtx, poly, bgId) == FLOOR_TYPE_8) {
play->roomCtx.unk_74[0] = 1;
CollisionCheck_BlueBlood(play, NULL, pos);
Audio_PlayActorSfx2(actor, NA_SE_IT_WALL_HIT_BUYO);
Actor_PlaySfx(actor, NA_SE_IT_WALL_HIT_BUYO);
return true;
}
@ -3664,7 +3670,7 @@ void func_8003424C(PlayState* play, Vec3f* arg1) {
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 bufFlag, s16 duration) {
if ((colorFlag == COLORFILTER_COLORFLAG_GRAY) && !(colorIntensityMax & COLORFILTER_INTENSITY_FLAG)) {
Audio_PlayActorSfx2(actor, NA_SE_EN_LIGHT_ARROW_HIT);
Actor_PlaySfx(actor, NA_SE_EN_LIGHT_ARROW_HIT);
}
actor->colorFilterParams = colorFlag | bufFlag | ((colorIntensityMax & 0xF8) << 5) | duration;

View file

@ -5189,6 +5189,9 @@ s32 Camera_Unique8(Camera* camera) {
return Camera_Noop(camera);
}
/**
* OnePoint Cutscene
*/
s32 Camera_Unique9(Camera* camera) {
Vec3f atTarget;
Vec3f eyeTarget;
@ -5248,7 +5251,7 @@ s32 Camera_Unique9(Camera* camera) {
if (rwData->keyFrameTimer == 0) {
rwData->isNewKeyFrame = true;
rwData->curKeyFrameIdx++;
if (rwData->curKeyFrameIdx < ONEPOINT_CS_INFO(camera)->keyFrameCnt) {
if (rwData->curKeyFrameIdx < ONEPOINT_CS_INFO(camera)->keyFrameCount) {
rwData->curKeyFrame = &ONEPOINT_CS_INFO(camera)->keyFrames[rwData->curKeyFrameIdx];
rwData->keyFrameTimer = rwData->curKeyFrame->timerInit;
@ -5558,7 +5561,7 @@ s32 Camera_Unique9(Camera* camera) {
scratchGeo.yaw = Camera_LERPCeilS(rwData->atEyeOffsetTarget.yaw, eyeNextAtOffset.yaw,
rwData->curKeyFrame->lerpStepScale, 1);
Camera_AddVecGeoToVec3f(eyeNext, at, &scratchGeo);
goto setAtFOVRoll;
goto setAtFovRoll;
case ONEPOINT_CS_ACTION_ID_3:
// linear interplation of eye/at/fov/roll using the step scale using eyeTarget
@ -5571,7 +5574,7 @@ s32 Camera_Unique9(Camera* camera) {
FALLTHROUGH;
case ONEPOINT_CS_ACTION_ID_11:
case ONEPOINT_CS_ACTION_ID_12:
setAtFOVRoll:
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);
camera->at.y = Camera_LERPCeilF(rwData->atTarget.y, camera->at.y, rwData->curKeyFrame->lerpStepScale, 1.0f);
@ -5618,15 +5621,15 @@ s32 Camera_Unique9(Camera* camera) {
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;
s32 camId = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
Camera_ChangeModeFlags(camera->play->cameraPtrs[camId], CAM_MODE_NORMAL, 1);
}
FALLTHROUGH;
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];
s32 camId = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId;
Camera* cam = camera->play->cameraPtrs[camId];
*eye = *eyeNext;
Camera_Copy(cam, camera);
@ -6015,7 +6018,7 @@ s32 Camera_Demo4(Camera* camera) {
}
/**
* Sets up a cutscene for Camera_Uniq9
* Sets up a OnePoint attention cutscene
*/
s32 Camera_Demo5(Camera* camera) {
f32 eyeTargetDist;
@ -6037,6 +6040,7 @@ s32 Camera_Demo5(Camera* camera) {
Actor_GetFocus(&playerhead, &camera->player->actor);
player = camera->player;
sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_LARGE, CAM_HUD_VISIBILITY_NOTHING_ALT, 0);
if ((camera->target == NULL) || (camera->target->update == NULL)) {
if (camera->target == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: attention: target is not valid, stop!\n" VT_RST);
@ -6044,6 +6048,7 @@ s32 Camera_Demo5(Camera* camera) {
camera->target = NULL;
return true;
}
Actor_GetFocus(&camera->targetPosRot, camera->target);
OLib_Vec3fDiffToVecGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos);
D_8011D3AC = camera->target->category;
@ -6051,6 +6056,7 @@ s32 Camera_Demo5(Camera* camera) {
eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye);
OLib_Vec3fDiffToVecGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext);
sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw;
if (camera->target->category == ACTORCAT_PLAYER) {
// camera is targeting a(the) player actor
if (eyePlayerGeo.r > 30.0f) {
@ -6058,9 +6064,9 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D6AC[1].atTargetInit.z = Rand_ZeroOne() * 10.0f;
D_8011D6AC[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f;
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D6AC;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D6AC);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D6AC);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt--;
ONEPOINT_CS_INFO(camera)->keyFrameCount--;
} else {
camera->timer += D_8011D6AC[2].timerInit;
}
@ -6068,9 +6074,9 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D724[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f;
D_8011D724[1].timerInit = camera->timer - 1;
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D724;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D724);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D724);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt--;
ONEPOINT_CS_INFO(camera)->keyFrameCount--;
} else {
camera->timer += D_8011D724[2].timerInit;
}
@ -6078,9 +6084,9 @@ s32 Camera_Demo5(Camera* camera) {
} else if (playerTargetGeo.r < 30.0f) {
// distance between player and target is less than 30 units.
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D79C;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D79C);
if ((targetScreenPosX < 0x15) || (targetScreenPosX >= 0x12C) || (targetScreenPosY < 0x29) ||
(targetScreenPosY >= 0xC8)) {
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D79C);
if ((targetScreenPosX <= 20) || (targetScreenPosX >= SCREEN_WIDTH - 20) || (targetScreenPosY <= 40) ||
(targetScreenPosY >= SCREEN_HEIGHT - 40)) {
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;
@ -6093,7 +6099,7 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D79C[1].timerInit = camera->timer - 1;
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2;
ONEPOINT_CS_INFO(camera)->keyFrameCount -= 2;
} else {
camera->timer += D_8011D79C[2].timerInit + D_8011D79C[3].timerInit;
}
@ -6102,9 +6108,9 @@ s32 Camera_Demo5(Camera* camera) {
// and the distance fromthe camera's current position to the player is less than 30 units
D_8011D83C[0].timerInit = camera->timer;
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D83C;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D83C);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D83C);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt--;
ONEPOINT_CS_INFO(camera)->keyFrameCount--;
} else {
camera->timer += D_8011D83C[1].timerInit;
}
@ -6112,13 +6118,13 @@ s32 Camera_Demo5(Camera* camera) {
// The distance between the camera's current position and the target is less than 700 units
// and the angle between the camera's position and the player, and the player to the target
// is less than ~76.9 degrees
if (targetScreenPosX >= 0x15 && targetScreenPosX < 0x12C && targetScreenPosY >= 0x29 &&
targetScreenPosY < 0xC8 && eyePlayerGeo.r > 30.0f) {
if ((targetScreenPosX > 20) && (targetScreenPosX < SCREEN_WIDTH - 20) && (targetScreenPosY > 40) &&
(targetScreenPosY < SCREEN_HEIGHT - 40) && (eyePlayerGeo.r > 30.0f)) {
D_8011D88C[0].timerInit = camera->timer;
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D88C;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D88C);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D88C);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt--;
ONEPOINT_CS_INFO(camera)->keyFrameCount--;
} else {
camera->timer += D_8011D88C[1].timerInit;
}
@ -6134,9 +6140,9 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D8DC[0].timerInit = camera->timer;
D_8011D8DC[1].timerInit = (s16)(eyeTargetDist * 0.005f) + 8;
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D8DC;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D8DC);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D8DC);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2;
ONEPOINT_CS_INFO(camera)->keyFrameCount -= 2;
} else {
camera->timer += D_8011D8DC[1].timerInit + D_8011D8DC[2].timerInit;
}
@ -6171,9 +6177,9 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D954[2].timerInit = (s16)(eyeTargetDist * 0.004f) + 6;
}
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D954;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D954);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D954);
if (camera->parentCamId != CAM_ID_MAIN) {
ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2;
ONEPOINT_CS_INFO(camera)->keyFrameCount -= 2;
} else {
camera->timer += D_8011D954[2].timerInit + D_8011D954[3].timerInit;
}
@ -6196,13 +6202,13 @@ s32 Camera_Demo5(Camera* camera) {
D_8011D9F4[1].timerInit = t + 8;
}
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4);
ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D9F4);
if (camera->parentCamId != CAM_ID_MAIN) {
if (camera->play->state.frames & 1) {
D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit;
D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit;
}
ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2;
ONEPOINT_CS_INFO(camera)->keyFrameCount -= 2;
} else {
camera->timer += D_8011D9F4[1].timerInit + D_8011D9F4[2].timerInit;
D_8011D9F4[0].rollTargetInit = D_8011D9F4[1].rollTargetInit = 0;
@ -6240,7 +6246,9 @@ s32 Camera_Demo5(Camera* camera) {
sDemo5PrevAction12Frame = camera->play->state.frames;
Camera_ChangeSettingFlags(camera, CAM_SET_CS_C, (4 | 1));
Camera_Unique9(camera);
return true;
}
@ -7133,7 +7141,7 @@ void func_80057FC4(Camera* camera) {
void Camera_Stub80058140(Camera* camera) {
}
void Camera_InitPlayerSettings(Camera* camera, Player* player) {
void Camera_InitDataUsingPlayer(Camera* camera, Player* player) {
PosRot playerPosShape;
VecGeo eyeNextAtOffset;
s32 bgId;

View file

@ -2669,7 +2669,7 @@ Vec3f D_8011D678[] = {
};
/*******************************************************
* OnePoint initalization values for Demo5
* OnePoint initalization values for Attention Cutscenes (Demo5)
********************************************************/
s32 sDemo5PrevSfxFrame = -200;

View file

@ -1347,7 +1347,7 @@ s32 Cutscene_Command_CameraEyePoints(PlayState* play, CutsceneContext* csCtx, u8
if (csCtx->unk_1A != 0) {
csCtx->unk_18 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0);
Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_CS_0);
Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE);
Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId));
@ -1384,7 +1384,7 @@ s32 Cutscene_Command_CameraLookAtPoints(PlayState* play, CutsceneContext* csCtx,
if (csCtx->unk_1B != 0) {
D_8015FCC0 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0);
Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_CS_0);
Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE);
Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId));
@ -1428,7 +1428,7 @@ s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu
subCam->player = NULL;
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE);
Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0);
Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_FREE0);
sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f;
Camera_SetViewParam(subCam, CAM_VIEW_ROLL, &sp28);
sp3C.x = csCtx->subCamLookAtPoints->pos.x;
@ -1437,8 +1437,8 @@ s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu
sp30.x = csCtx->subCamEyePoints->pos.x;
sp30.y = csCtx->subCamEyePoints->pos.y;
sp30.z = csCtx->subCamEyePoints->pos.z;
Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30);
Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
Play_SetCameraAtEye(play, csCtx->subCamId, &sp3C, &sp30);
Play_SetCameraFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
}
}
}
@ -1471,15 +1471,15 @@ s32 Cutscene_Command_08(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu
subCam->player = NULL;
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE);
Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0);
Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_FREE0);
sp3C.x = csCtx->subCamLookAtPoints->pos.x;
sp3C.y = csCtx->subCamLookAtPoints->pos.y;
sp3C.z = csCtx->subCamLookAtPoints->pos.z;
sp30.x = csCtx->subCamEyePoints->pos.x;
sp30.y = csCtx->subCamEyePoints->pos.y;
sp30.z = csCtx->subCamEyePoints->pos.z;
Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30);
Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
Play_SetCameraAtEye(play, csCtx->subCamId, &sp3C, &sp30);
Play_SetCameraFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
}
}
}

View file

@ -888,7 +888,7 @@ void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s
initParams.scale = scale;
if (actor != NULL) {
Audio_PlayActorSfx2(actor, NA_SE_PL_FREEZE_S);
Actor_PlaySfx(actor, NA_SE_PL_FREEZE_S);
}
EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams);
@ -914,7 +914,7 @@ void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s
initParams.scale = scale;
if (actor != NULL) {
Audio_PlayActorSfx2(actor, NA_SE_PL_FREEZE_S);
Actor_PlaySfx(actor, NA_SE_PL_FREEZE_S);
}
EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams);
@ -993,7 +993,7 @@ void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 sc
initParams.bodyPart = bodyPart;
if (actor != NULL) {
Audio_PlayActorSfx2(actor, NA_SE_EV_FLAME_IGNITION);
Actor_PlaySfx(actor, NA_SE_EV_FLAME_IGNITION);
}
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);
@ -1014,7 +1014,7 @@ void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 sc
initParams.bodyPart = bodyPart;
if (actor != NULL) {
Audio_PlayActorSfx2(actor, NA_SE_EV_FLAME_IGNITION);
Actor_PlaySfx(actor, NA_SE_EV_FLAME_IGNITION);
}
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);

View file

@ -301,7 +301,7 @@ void EnAObj_Block(EnAObj* this, PlayState* play) {
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f);
if (this->dyna.actor.speedXZ != 0.0f) {
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
}
this->dyna.unk_154 = 0.0f;

View file

@ -227,7 +227,7 @@ void func_8006D684(PlayState* play, Player* player) {
sp54.y = player->actor.world.pos.y + 100.0f;
sp54.z = player->actor.world.pos.z;
Play_CameraSetAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54);
Play_SetCameraAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54);
} else {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y,
D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type);

File diff suppressed because it is too large Load diff

View file

@ -411,7 +411,7 @@ void Play_Init(GameState* thisx) {
}
player = GET_PLAYER(this);
Camera_InitPlayerSettings(&this->mainCamera, player);
Camera_InitDataUsingPlayer(&this->mainCamera, player);
Camera_ChangeMode(&this->mainCamera, CAM_MODE_NORMAL);
playerStartBgCamIndex = player->actor.params & 0xFF;
@ -1469,28 +1469,28 @@ void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest) {
}
s16 Play_CreateSubCamera(PlayState* this) {
s16 i;
s16 camId;
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
if (this->cameraPtrs[i] == NULL) {
for (camId = CAM_ID_SUB_FIRST; camId < NUM_CAMS; camId++) {
if (this->cameraPtrs[camId] == NULL) {
break;
}
}
if (i == NUM_CAMS) {
if (camId == NUM_CAMS) {
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: fulled sub camera system area\n" VT_RST);
return CAM_ID_NONE;
}
osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " create new sub camera [%d] " VT_BGCOL(
CYAN) " " VT_RST "\n",
i);
camId);
this->cameraPtrs[i] = &this->subCameras[i - CAM_ID_SUB_FIRST];
Camera_Init(this->cameraPtrs[i], &this->view, &this->colCtx, this);
this->cameraPtrs[i]->camId = i;
this->cameraPtrs[camId] = &this->subCameras[camId - CAM_ID_SUB_FIRST];
Camera_Init(this->cameraPtrs[camId], &this->view, &this->colCtx, this);
this->cameraPtrs[camId]->camId = camId;
return i;
return camId;
}
s16 Play_GetActiveCamId(PlayState* this) {
@ -1543,15 +1543,15 @@ Camera* Play_GetCamera(PlayState* this, s16 camId) {
return this->cameraPtrs[camIdx];
}
s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
s32 ret = 0;
s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
s32 successBits = 0;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
Camera* camera = this->cameraPtrs[camIdx];
Player* player;
ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
ret <<= 1;
ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
successBits |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
successBits <<= 1;
successBits |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
@ -1566,20 +1566,20 @@ s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
camera->atLERPStepScale = 0.01f;
return ret;
return successBits;
}
s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
s32 ret = 0;
s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
s32 successBits = 0;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
Camera* camera = this->cameraPtrs[camIdx];
Player* player;
ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
ret <<= 1;
ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
ret <<= 1;
ret |= Camera_SetViewParam(camera, CAM_VIEW_UP, up);
successBits |= Camera_SetViewParam(camera, CAM_VIEW_AT, at);
successBits <<= 1;
successBits |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye);
successBits <<= 1;
successBits |= Camera_SetViewParam(camera, CAM_VIEW_UP, up);
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
@ -1594,14 +1594,14 @@ s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec
camera->atLERPStepScale = 0.01f;
return ret;
return successBits;
}
s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) {
s32 ret = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1;
s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov) {
s32 successBits = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1;
if (1) {}
return ret;
return successBits;
}
s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) {
@ -1620,43 +1620,52 @@ void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) {
Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]);
}
s32 func_800C0808(PlayState* this, s16 camId, Player* player, s16 setting) {
/**
* Initializes camera data centered around Player, and applies the requested setting.
*/
s32 Play_InitCameraDataUsingPlayer(PlayState* this, s16 camId, Player* player, s16 setting) {
Camera* camera;
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
camera = this->cameraPtrs[camIdx];
Camera_InitPlayerSettings(camera, player);
Camera_InitDataUsingPlayer(camera, player);
return Camera_ChangeSetting(camera, setting);
}
s32 Play_CameraChangeSetting(PlayState* this, s16 camId, s16 setting) {
s32 Play_ChangeCameraSetting(PlayState* this, s16 camId, s16 setting) {
return Camera_ChangeSetting(Play_GetCamera(this, camId), setting);
}
void func_800C08AC(PlayState* this, s16 camId, s16 arg2) {
/**
* Smoothly return control from a sub camera to the main camera by moving the subCamera's eye, at, fov through
* interpolation from the initial subCam viewParams to the target mainCam viewParams over `duration`.
* Setting the `duration` to 0 or less will instantly return control to the main camera.
* This will also clear every sub camera.
*/
void Play_ReturnToMainCam(PlayState* this, s16 camId, s16 duration) {
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
s16 i;
s16 subCamId;
Play_ClearCamera(this, camIdx);
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
if (this->cameraPtrs[i] != NULL) {
for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) {
if (this->cameraPtrs[subCamId] != NULL) {
osSyncPrintf(
VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST,
i);
Play_ClearCamera(this, i);
subCamId);
Play_ClearCamera(this, subCamId);
}
}
if (arg2 <= 0) {
if (duration <= 0) {
Play_ChangeCameraStatus(this, CAM_ID_MAIN, CAM_STAT_ACTIVE);
this->cameraPtrs[CAM_ID_MAIN]->childCamId = this->cameraPtrs[CAM_ID_MAIN]->parentCamId = CAM_ID_MAIN;
} else {
OnePointCutscene_Init(this, 1020, arg2, NULL, CAM_ID_MAIN);
OnePointCutscene_Init(this, 1020, duration, NULL, CAM_ID_MAIN);
}
}
s16 Play_CameraGetUID(PlayState* this, s16 camId) {
s16 Play_GetCameraUID(PlayState* this, s16 camId) {
Camera* camera = this->cameraPtrs[camId];
if (camera != NULL) {
@ -1666,12 +1675,16 @@ s16 Play_CameraGetUID(PlayState* this, s16 camId) {
}
}
s16 func_800C09D8(PlayState* this, s16 camId, s16 arg2) {
// Unused, purpose is unclear (also unused and unclear in MM)
s16 func_800C09D8(PlayState* this, s16 camId, s16 uid) {
Camera* camera = this->cameraPtrs[camId];
if (camera != NULL) {
return 0;
} else if (camera->uid != arg2) {
}
//! @bug this code is only reached if `camera` is NULL.
if (camera->uid != uid) {
return 0;
} else if (camera->status != CAM_STAT_ACTIVE) {
return 2;

View file

@ -1244,7 +1244,7 @@ void Scene_DrawConfigLostWoods(PlayState* play) {
if ((play->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) {
if (play->roomCtx.unk_74[1] == 50) {
func_8002F7DC(&GET_PLAYER(play)->actor, NA_SE_EV_CHICKEN_CRY_M);
Player_PlaySfx(GET_PLAYER(play), NA_SE_EV_CHICKEN_CRY_M);
play->roomCtx.unk_74[0] = 1;
}
play->roomCtx.unk_74[1]++;