diff --git a/assets/xml/objects/object_d_hsblock.xml b/assets/xml/objects/object_d_hsblock.xml index b9111b38ba..4bb50c2b4f 100644 --- a/assets/xml/objects/object_d_hsblock.xml +++ b/assets/xml/objects/object_d_hsblock.xml @@ -1,7 +1,7 @@ - - + + diff --git a/assets/xml/scenes/dungeons/ddan_boss.xml b/assets/xml/scenes/dungeons/ddan_boss.xml index 03eb73ea30..2b61024906 100644 --- a/assets/xml/scenes/dungeons/ddan_boss.xml +++ b/assets/xml/scenes/dungeons/ddan_boss.xml @@ -6,7 +6,7 @@ - + diff --git a/include/functions.h b/include/functions.h index 7fc36b1a47..f260cc29cc 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1684,7 +1684,7 @@ f32 Math_CosF(f32 angle); s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint); -void Math3D_LineClosestToPoint(Linef* line, Vec3f* pos, Vec3f* closestPoint); +void Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoint); s32 Math3D_PlaneVsPlaneVsLineClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* point, Vec3f* closestPoint); void Math3D_LineSplitRatio(Vec3f* v0, Vec3f* v1, f32 ratio, Vec3f* ret); diff --git a/include/z64.h b/include/z64.h index a96b3becc6..0c07a192ba 100644 --- a/include/z64.h +++ b/include/z64.h @@ -263,7 +263,7 @@ typedef struct { } flags; /* 0x0128 */ TitleCardContext titleCtx; /* 0x0138 */ char unk_138[0x04]; - /* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays of alloc type 1 + /* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ALLOCTYPE_ABSOLUTE } ActorContext; // size = 0x140 typedef struct { diff --git a/include/z64camera.h b/include/z64camera.h index 8bfd447daf..86f96579a1 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -789,7 +789,7 @@ typedef struct { { flags, CAM_DATA_FLAGS } typedef struct { - /* 0x00 */ Linef unk_00; + /* 0x00 */ InfiniteLine unk_00; /* 0x18 */ f32 unk_18; /* 0x1C */ f32 unk_1C; /* 0x20 */ f32 unk_20; @@ -913,7 +913,7 @@ typedef struct { typedef struct { /* 0x00 */ Vec3f initalPos; /* 0x0C */ s16 animTimer; - /* 0x10 */ Linef sceneCamPosPlayerLine; + /* 0x10 */ InfiniteLine sceneCamPosPlayerLine; } Unique0Anim; // size = 0x28 typedef struct { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index d442b7c4a0..d0b286c19b 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -114,25 +114,27 @@ s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Ve * Determines the closest point on the line `line` to `pos`, by forming a line perpendicular from * `point` to `line` closest point is placed in `closestPoint` */ -void Math3D_LineClosestToPoint(Linef* line, Vec3f* pos, Vec3f* closestPoint) { - f32 dirVectorSize; +void Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoint) { + f32 dirVectorLengthSq; f32 t; - dirVectorSize = Math3D_Vec3fMagnitudeSq(&line->b); - if (IS_ZERO(dirVectorSize)) { + dirVectorLengthSq = Math3D_Vec3fMagnitudeSq(&line->dir); + if (IS_ZERO(dirVectorLengthSq)) { osSyncPrintf(VT_COL(YELLOW, BLACK)); // "Math3D_lineVsPosSuisenCross(): No straight line length" osSyncPrintf("Math3D_lineVsPosSuisenCross():直線の長さがありません\n"); osSyncPrintf("cross = pos を返します。\n"); // "Returns cross = pos." osSyncPrintf(VT_RST); Math_Vec3f_Copy(closestPoint, pos); + //! @bug Missing early return } - t = (((pos->x - line->a.x) * line->b.x) + ((pos->y - line->a.y) * line->b.y) + ((pos->z - line->a.z) * line->b.z)) / - dirVectorSize; - closestPoint->x = (line->b.x * t) + line->a.x; - closestPoint->y = (line->b.y * t) + line->a.y; - closestPoint->z = (line->b.z * t) + line->a.z; + t = (((pos->x - line->point.x) * line->dir.x) + ((pos->y - line->point.y) * line->dir.y) + + ((pos->z - line->point.z) * line->dir.z)) / + dirVectorLengthSq; + closestPoint->x = (line->dir.x * t) + line->point.x; + closestPoint->y = (line->dir.y * t) + line->point.y; + closestPoint->z = (line->dir.z * t) + line->point.z; } void Math3D_FindPointOnPlaneIntersect(f32 planeAAxis1Norm, f32 planeAAxis2Norm, f32 planeBAxis1Norm, @@ -195,10 +197,10 @@ s32 Math3D_PlaneVsPlaneNewLine(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeA */ s32 Math3D_PlaneVsPlaneVsLineClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* point, Vec3f* closestPoint) { - static Linef planeIntersect; + static InfiniteLine planeIntersect; if (!Math3D_PlaneVsPlaneNewLine(planeAA, planeAB, planeAC, planeADist, planeBA, planeBB, planeBC, planeBDist, - (InfiniteLine*)&planeIntersect)) { + &planeIntersect)) { return false; } Math3D_LineClosestToPoint(&planeIntersect, point, closestPoint); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 70dc59a70e..ac4eac6fc6 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -4291,23 +4291,23 @@ s32 Camera_Subj4(Camera* camera) { sCameraInterfaceFlags = subj4->interfaceFlags; if (camera->animState == 0) { spA4 = Camera_GetCamBgDataUnderPlayer(camera, &spAA); - Camera_Vec3sToVec3f(&anim->unk_00.a, &spA4[1]); + Camera_Vec3sToVec3f(&anim->unk_00.point, &spA4[1]); Camera_Vec3sToVec3f(&sp98, &spA4[spAA - 2]); sp64.r = 10.0f; // 0x238C ~ 50 degrees sp64.pitch = 0x238C; - sp64.yaw = Camera_XZAngle(&sp98, &anim->unk_00.a); - sp88 = OLib_Vec3fDist(&playerPosRot->pos, &anim->unk_00.a); + sp64.yaw = Camera_XZAngle(&sp98, &anim->unk_00.point); + sp88 = OLib_Vec3fDist(&playerPosRot->pos, &anim->unk_00.point); if (OLib_Vec3fDist(&playerPosRot->pos, &sp98) < sp88) { - anim->unk_00.b.x = anim->unk_00.a.x - sp98.x; - anim->unk_00.b.y = anim->unk_00.a.y - sp98.y; - anim->unk_00.b.z = anim->unk_00.a.z - sp98.z; - anim->unk_00.a = sp98; + anim->unk_00.dir.x = anim->unk_00.point.x - sp98.x; + anim->unk_00.dir.y = anim->unk_00.point.y - sp98.y; + anim->unk_00.dir.z = anim->unk_00.point.z - sp98.z; + anim->unk_00.point = sp98; } else { - anim->unk_00.b.x = sp98.x - anim->unk_00.a.x; - anim->unk_00.b.y = sp98.y - anim->unk_00.a.y; - anim->unk_00.b.z = sp98.z - anim->unk_00.a.z; + anim->unk_00.dir.x = sp98.x - anim->unk_00.point.x; + anim->unk_00.dir.y = sp98.y - anim->unk_00.point.y; + anim->unk_00.dir.z = sp98.z - anim->unk_00.point.z; sp64.yaw = BINANG_ROT180(sp64.yaw); } anim->unk_30 = sp64.yaw; @@ -4340,9 +4340,9 @@ s32 Camera_Subj4(Camera* camera) { 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; - at->z = eyeNext->z + anim->unk_00.b.z; + at->x = eyeNext->x + anim->unk_00.dir.x; + at->y = eyeNext->y + anim->unk_00.dir.y; + at->z = eyeNext->z + anim->unk_00.dir.z; *eye = *eyeNext; sp64.yaw = anim->unk_30; sp64.r = 5.0f; @@ -4792,9 +4792,9 @@ s32 Camera_Unique0(Camera* camera) { func_80043B60(camera); camera->unk_14C &= ~4; sceneCamData = Camera_GetCamBGData(camera); - Camera_Vec3sToVec3f(&anim->sceneCamPosPlayerLine.a, &BGCAM_POS(sceneCamData)); + Camera_Vec3sToVec3f(&anim->sceneCamPosPlayerLine.point, &BGCAM_POS(sceneCamData)); - *eye = camera->eyeNext = anim->sceneCamPosPlayerLine.a; + *eye = camera->eyeNext = anim->sceneCamPosPlayerLine.point; sceneCamRot = BGCAM_ROT(sceneCamData); fov = BGCAM_FOV(sceneCamData); if (fov != -1) { @@ -4807,7 +4807,7 @@ s32 Camera_Unique0(Camera* camera) { atPlayerOffset.r = OLib_Vec3fDist(&playerPosWithOffset, eye); atPlayerOffset.yaw = sceneCamRot.y; atPlayerOffset.pitch = -sceneCamRot.x; - OLib_VecSphGeoToVec3f(&anim->sceneCamPosPlayerLine.b, &atPlayerOffset); + OLib_VecSphGeoToVec3f(&anim->sceneCamPosPlayerLine.dir, &atPlayerOffset); Math3D_LineClosestToPoint(&anim->sceneCamPosPlayerLine, &playerPosRot->pos, &camera->at); anim->initalPos = playerPosRot->pos; camera->animState++; @@ -5814,12 +5814,14 @@ s32 Camera_Demo5(Camera* camera) { f32 sp90; VecSph playerTargetGeo; VecSph eyePlayerGeo; - VecSph sp78; + s16 targetScreenPosX; + s16 targetScreenPosY; + s32 pad1; PosRot playerhead; PosRot targethead; Player* player; s16 sp4A; - s32 pad; + s32 framesDiff; s32 temp_v0; s16 t; s32 pad2; @@ -5837,7 +5839,7 @@ s32 Camera_Demo5(Camera* camera) { Actor_GetFocus(&camera->targetPosRot, camera->target); OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos); D_8011D3AC = camera->target->category; - Actor_GetScreenPos(camera->globalCtx, camera->target, &sp78.yaw, &sp78.pitch); + Actor_GetScreenPos(camera->globalCtx, camera->target, &targetScreenPosX, &targetScreenPosY); eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye); OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext); sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw; @@ -5869,7 +5871,8 @@ s32 Camera_Demo5(Camera* camera) { // 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 ((sp78.yaw < 0x15) || (sp78.yaw >= 0x12C) || (sp78.pitch < 0x29) || (sp78.pitch >= 0xC8)) { + if ((targetScreenPosX < 0x15) || (targetScreenPosX >= 0x12C) || (targetScreenPosY < 0x29) || + (targetScreenPosY >= 0xC8)) { D_8011D79C[0].actionFlags = 0x41; D_8011D79C[0].atTargetInit.y = -30.0f; D_8011D79C[0].atTargetInit.x = 0.0f; @@ -5901,7 +5904,8 @@ 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 (sp78.yaw >= 0x15 && sp78.yaw < 0x12C && sp78.pitch >= 0x29 && sp78.pitch < 0xC8 && eyePlayerGeo.r > 30.0f) { + if (targetScreenPosX >= 0x15 && targetScreenPosX < 0x12C && targetScreenPosY >= 0x29 && + targetScreenPosY < 0xC8 && 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); @@ -5997,8 +6001,8 @@ s32 Camera_Demo5(Camera* camera) { } } - pad = sDemo5PrevSfxFrame - camera->globalCtx->state.frames; - if ((pad >= 0x33) || (pad < -0x32)) { + framesDiff = sDemo5PrevSfxFrame - camera->globalCtx->state.frames; + if ((framesDiff > 50) || (framesDiff < -50)) { func_80078884(camera->data1); } @@ -6012,11 +6016,11 @@ s32 Camera_Demo5(Camera* camera) { } else { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { - pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; + framesDiff = camera->globalCtx->state.frames - sDemo5PrevAction12Frame; if (player->stateFlags1 & PLAYER_STATE1_11) { // holding object over head. func_8002DF54(camera->globalCtx, camera->target, 8); - } else if (ABS(pad) > 3000) { + } else if (ABS(framesDiff) > 3000) { func_8002DF54(camera->globalCtx, camera->target, 12); } else { func_8002DF54(camera->globalCtx, camera->target, 69); diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 54b64d2ede..add4b9dbe7 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,7 +1,7 @@ #include "global.h" // unused -Gfx sCircleNullDList[] = { +Gfx sCircleEmptyDList[] = { gsSPEndDisplayList(), }; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index f6cf5c7a82..584f7b3e18 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -76,7 +76,7 @@ void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx) { if (0) {} - i++; // abmient light is total number of lights + 1 + i++; // ambient light is total number of lights + 1 gSPLight(POLY_OPA_DISP++, &lights->l.a, i); gSPLight(POLY_XLU_DISP++, &lights->l.a, i); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index e7d1128068..7204dda46a 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -182,6 +182,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { return 0; } +// Scene Command 0x00: Spawn List void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) { ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index e2c51a7a83..116a6ebf75 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -104,7 +104,7 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { Vec3f center; s16 i; - if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < 4900.0f))) { + if (this->isFalling || ((globalCtx->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { osSyncPrintf("OTC O 1\n"); for (i = 0; i < ARRAY_COUNT(D_80876A68); i++) { diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 058b55c4bf..7fca47e1a8 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -1,7 +1,7 @@ /* * File: z_bg_mizu_movebg.c * Overlay: ovl_Bg_Mizu_Movebg - * Description: Kakariko Village Well Water + * Description: Water Temple Moving Objects */ #include "z_bg_mizu_movebg.h" diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 4af6111d5e..ce96103163 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3959,7 +3959,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { if (hitWithBottle == false) { // if ganondorf is 250 units away from link, at least 3 volleys are required - if ((ganondorf->actor.xyzDistToPlayerSq > 62500.0f) && (this->unk_1A4 < 3)) { + if ((ganondorf->actor.xyzDistToPlayerSq > SQ(250.0f)) && (this->unk_1A4 < 3)) { this->unk_1C2 = 1; } else if (Rand_ZeroOne() < 0.7f) { this->unk_1C2 = 1; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 48fa61db56..f7d746dde6 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -1473,7 +1473,7 @@ Gfx* BossGanondrof_GetClearPixelDList(GraphicsContext* gfxCtx) { return dList; } -Gfx* BossGanondrof_GetNullDList(GraphicsContext* gfxCtx) { +Gfx* BossGanondrof_EmptyDList(GraphicsContext* gfxCtx) { Gfx* dList = (Gfx*)Graph_Alloc(gfxCtx, sizeof(Gfx) * 1); Gfx* dListHead = dList; @@ -1511,7 +1511,7 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->work[GND_BODY_DECAY_FLAG]) { gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetClearPixelDList(globalCtx->state.gfxCtx)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_GetNullDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x08, BossGanondrof_EmptyDList(globalCtx->state.gfxCtx)); } SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, BossGanondrof_OverrideLimbDraw, diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 5a3a3a2b55..c2ac64a69f 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -215,7 +215,7 @@ void DemoEc_InitSkelAnime(DemoEc* this, GlobalContext* globalCtx, FlexSkeletonHe SkelAnime_InitFlex(globalCtx, &this->skelAnime, SEGMENTED_TO_VIRTUAL(skeletonHeader), NULL, NULL, NULL, 0); } -void DemoEc_ChangeAnimation(DemoEc* this, AnimationHeader* animation, u8 mode, f32 transitionRate, s32 reverse) { +void DemoEc_ChangeAnimation(DemoEc* this, AnimationHeader* animation, u8 mode, f32 morphFrames, s32 reverse) { f32 frameCount; f32 startFrame; AnimationHeader* anim; @@ -235,7 +235,7 @@ void DemoEc_ChangeAnimation(DemoEc* this, AnimationHeader* animation, u8 mode, f playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, anim, playbackSpeed, startFrame, frameCount, mode, transitionRate); + Animation_Change(&this->skelAnime, anim, playbackSpeed, startFrame, frameCount, mode, morphFrames); } Gfx* DemoEc_AllocColorDList(GraphicsContext* gfxCtx, u8* color) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 701e2c3cd6..36666b91fc 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -275,8 +275,7 @@ void func_80985200(DemoIm* this, GlobalContext* globalCtx, s32 actionIdx) { } } -void DemoIm_ChangeAnim(DemoIm* this, AnimationHeader* animHeaderSeg, u8 animMode, f32 transitionRate, - s32 playBackwards) { +void DemoIm_ChangeAnim(DemoIm* this, AnimationHeader* animHeaderSeg, u8 animMode, f32 morphFrames, s32 playBackwards) { f32 frameCount = Animation_GetLastFrame(animHeaderSeg); f32 playbackSpeed; f32 startFrame; @@ -292,7 +291,7 @@ void DemoIm_ChangeAnim(DemoIm* this, AnimationHeader* animHeaderSeg, u8 animMode playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, startFrame, endFrame, animMode, transitionRate); + Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, startFrame, endFrame, animMode, morphFrames); } void func_80985310(DemoIm* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 255b868d10..8f570ed4e6 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -194,7 +194,7 @@ void func_8098E6EC(DemoSa* this, GlobalContext* globalCtx, s32 actionIdx) { } } -void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 transitionRate, s32 arg4) { +void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 morphFrames, s32 arg4) { s32 pad[2]; f32 frameCount = Animation_GetLastFrame(animHeaderSeg); f32 playbackSpeed; @@ -211,7 +211,7 @@ void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 tr playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, unk0, fc, arg2, transitionRate); + Animation_Change(&this->skelAnime, animHeaderSeg, playbackSpeed, unk0, fc, arg2, morphFrames); } void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 6b61cf1656..40bf7ea481 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -97,7 +97,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { if (!(this->actor.params & 0x200)) { // opening with song of storms - if (this->actor.xyzDistToPlayerSq < 40000.0f && Flags_GetEnv(globalCtx, 5)) { + if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && Flags_GetEnv(globalCtx, 5)) { openGrotto = true; this->actor.flags &= ~ACTOR_FLAG_4; } diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 7659321937..c29630a0a5 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -232,7 +232,7 @@ void EnDivingGame_Talk(EnDivingGame* this, GlobalContext* globalCtx) { void EnDivingGame_HandlePlayChoice(EnDivingGame* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (this->unk_292 == Message_GetState(&globalCtx->msgCtx) && - Message_ShouldAdvance(globalCtx)) { // Did player selected an answer? + Message_ShouldAdvance(globalCtx)) { // Did the player select an answer? switch (globalCtx->msgCtx.choiceIndex) { case 0: // Yes if (gSaveContext.rupees >= 20) { diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index f32ef133a2..ac548a1432 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -237,7 +237,7 @@ void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); this->actor.shape.rot.y += 0x800; - if (this->actor.xyzDistToPlayerSq < 900.0f) { + if (this->actor.xyzDistToPlayerSq < SQ(30.0f)) { Rupees_ChangeBy(5); sCollectedCount++; func_80078884(NA_SE_SY_GET_RUPY); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index a3bea0770a..3148a72817 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -417,7 +417,7 @@ void func_80A3F0E4(EnGo* this) { } s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { - f32 xyzDist; + f32 xyzDistSq; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Camera* camera = globalCtx->cameraPtrs[MAIN_CAM]; @@ -425,13 +425,13 @@ s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { return 0; } - xyzDist = (this->actor.scale.x / 0.01f) * 10000.0f; + xyzDistSq = (this->actor.scale.x / 0.01f) * 10000.0f; if ((this->actor.params & 0xF0) == 0x90) { Camera_ChangeSetting(camera, CAM_SET_DIRECTED_YAW); - xyzDist *= 4.8f; + xyzDistSq *= 4.8f; } - if (fabsf(this->actor.xyzDistToPlayerSq) > xyzDist) { + if (fabsf(this->actor.xyzDistToPlayerSq) > xyzDistSq) { if (camera->setting == CAM_SET_DIRECTED_YAW) { Camera_ChangeSetting(camera, CAM_SET_NORMAL0); } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 6ccfc57782..3418e15d15 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -86,7 +86,7 @@ void EnHeishi1_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(YELLOW) " れえるでぇたぁ☆☆☆☆☆☆☆☆ %d\n" VT_RST, this->path); osSyncPrintf(VT_FGCOL(MAGENTA) " anime_frame_speed ☆☆☆☆☆☆ %f\n" VT_RST, this->animSpeed); // "interpolation frame" - osSyncPrintf(VT_FGCOL(MAGENTA) " 補間フレーム☆☆☆☆☆☆☆☆☆ %f\n" VT_RST, this->transitionRate); + osSyncPrintf(VT_FGCOL(MAGENTA) " 補間フレーム☆☆☆☆☆☆☆☆☆ %f\n" VT_RST, this->animMorphFrames); // "targeted movement speed value between points" osSyncPrintf(VT_FGCOL(MAGENTA) " point間の移動スピード目標値 ☆ %f\n" VT_RST, this->moveSpeedTarget); // "maximum movement speed value between points" @@ -133,7 +133,7 @@ void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiWalkAnim); Animation_Change(&this->skelAnime, &gEnHeishiWalkAnim, this->animSpeed, 0.0f, (s16)frameCount, ANIMMODE_LOOP, - this->transitionRate); + this->animMorphFrames); this->bodyTurnSpeed = 0.0f; this->moveSpeed = 0.0f; this->headDirection = Rand_ZeroFloat(1.99f); @@ -245,7 +245,7 @@ void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, this->animSpeed, 0.0f, (s16)frameCount, ANIMMODE_LOOP, - this->transitionRate); + this->animMorphFrames); this->headBehaviorDecided = false; this->headDirection = Rand_ZeroFloat(1.99f); rand = Rand_ZeroFloat(50.0f); diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h index 8219a8d3b6..98c863fd3d 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h @@ -31,7 +31,7 @@ typedef struct EnHeishi1 { union { struct { /* 0x0284 */ f32 animSpeed; - /* 0x0288 */ f32 transitionRate; + /* 0x0288 */ f32 animMorphFrames; /* 0x028C */ f32 moveSpeedTarget; /* 0x0290 */ f32 moveSpeedMax; /* 0x0294 */ f32 bodyTurnSpeedTarget; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index be8da1469e..55eca2aaf6 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -582,7 +582,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { s32 rippleScale; if ((player->actor.speedXZ > 0.0f) && (player->actor.world.pos.y < this->actor.world.pos.y) && - (this->actor.xyzDistToPlayerSq < 2500.0f)) { + (this->actor.xyzDistToPlayerSq < SQ(50.0f))) { Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 1.0f, 0.2f); if (this->actor.speedXZ > 1.0f) { this->actor.speedXZ = 1.0f; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index d409764bd1..77e30304eb 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -282,7 +282,7 @@ void EnNb_SetInitialCsPosRot(EnNb* this, GlobalContext* globalCtx, s32 npcAction } } -void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 transitionRate, s32 arg4) { +void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 morphFrames, s32 arg4) { f32 frameCount = Animation_GetLastFrame(animation); f32 playbackSpeed; f32 unk0; @@ -298,7 +298,7 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 tr playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, mode, transitionRate); + Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, mode, morphFrames); } void EnNb_SetChamberAnim(EnNb* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 47f360195e..b40409de93 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -537,7 +537,7 @@ void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { } } -Gfx* func_80ABB0A0(GraphicsContext* gfxCtx) { +Gfx* EnNiwLady_EmptyDList(GraphicsContext* gfxCtx) { Gfx* dList; dList = Graph_Alloc(gfxCtx, sizeof(Gfx)); @@ -576,7 +576,7 @@ void EnNiwLady_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->faceState])); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80ABB0A0(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnNiwLady_EmptyDList(globalCtx->state.gfxCtx)); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiwLady_OverrideLimbDraw, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 1834d17e29..03f321cdcd 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -188,7 +188,7 @@ void func_80ABCE38(EnNy* this) { } void func_80ABCE50(EnNy* this, GlobalContext* globalCtx) { - if (this->actor.xyzDistToPlayerSq <= 25600.0f) { + if (this->actor.xyzDistToPlayerSq <= SQ(160.0f)) { func_80ABCD94(this); } } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index d6d0137cb8..cc2d13635a 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -2373,7 +2373,7 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(GlobalContext* globalCtx, s32 limbI return 0; } -Gfx* EnOssan_EndDList(GraphicsContext* gfxCtx) { +Gfx* EnOssan_EmptyDList(GraphicsContext* gfxCtx) { Gfx* disp = Graph_Alloc(gfxCtx, sizeof(Gfx)); gSPEndDisplayList(disp); @@ -2398,7 +2398,7 @@ void EnOssan_DrawKokiriShopkeeper(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 0, 130, 70, 255)); gSPSegment(POLY_OPA_DISP++, 0x09, EnOssan_SetEnvColor(globalCtx->state.gfxCtx, 110, 170, 20, 255)); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(globalCtx->state.gfxCtx)); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnOssan_OverrideLimbDrawKokiriShopkeeper, NULL, this); @@ -2445,7 +2445,7 @@ void EnOssan_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EndDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnOssan_EmptyDList(globalCtx->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sZoraShopkeeperEyeTextures[this->eyeTextureIdx])); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 3b756e4e51..b66b74b333 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -356,7 +356,7 @@ void func_80AEB220(EnRu1* this, GlobalContext* globalCtx) { } } -void func_80AEB264(EnRu1* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { +void func_80AEB264(EnRu1* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { s32 pad[2]; AnimationHeader* animHeader = SEGMENTED_TO_VIRTUAL(animation); f32 frameCount = Animation_GetLastFrame(animHeader); @@ -374,7 +374,7 @@ void func_80AEB264(EnRu1* this, AnimationHeader* animation, u8 arg2, f32 transit playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animHeader, playbackSpeed, unk0, fc, arg2, transitionRate); + Animation_Change(&this->skelAnime, animHeader, playbackSpeed, unk0, fc, arg2, morphFrames); } s32 EnRu1_UpdateSkelAnime(EnRu1* this) { diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index db0f0a9e5a..d42ca65a21 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -212,7 +212,7 @@ void func_80AF2868(EnRu2* this, GlobalContext* globalCtx, u32 npcActionIdx) { } } -void func_80AF28E8(EnRu2* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { +void func_80AF28E8(EnRu2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { f32 frameCount = Animation_GetLastFrame(animation); f32 playbackSpeed; f32 unk0; @@ -228,7 +228,7 @@ void func_80AF28E8(EnRu2* this, AnimationHeader* animation, u8 arg2, f32 transit playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); + Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } void func_80AF2978(EnRu2* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 462c41dee1..4d8de55c19 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -210,7 +210,7 @@ s32 EnTk_CheckFacingPlayer(EnTk* this) { s16 v0; s16 v1; - if (this->actor.xyzDistToPlayerSq > 10000.0f) { + if (this->actor.xyzDistToPlayerSq > SQ(100.0f)) { return 0; } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 161d0cc306..1ea57073a2 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -564,7 +564,7 @@ void func_80B4FCCC(EnZl2* this, GlobalContext* globalCtx) { gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[unk_274].segment); } -void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { +void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { f32 frameCount = Animation_GetLastFrame(animation); f32 playbackSpeed; f32 unk0; @@ -580,7 +580,7 @@ void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 transit playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); + Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } void func_80B4FD90(EnZl2* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index dd04567c32..212b063741 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -746,7 +746,7 @@ void func_80B54DE0(EnZl3* this, GlobalContext* globalCtx) { gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[idx].segment); } -void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 transitionRate, s32 arg4) { +void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { f32 frameCount = Animation_GetLastFrame(animation); f32 playbackSpeed; f32 unk0; @@ -762,7 +762,7 @@ void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 transit playbackSpeed = -1.0f; } - Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, transitionRate); + Animation_Change(&this->skelAnime, animation, playbackSpeed, unk0, fc, arg2, morphFrames); } void func_80B54EA4(EnZl3* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index 26dc98e73a..b255867c65 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -42,7 +42,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2000, ICHAIN_STOP), }; -static CollisionHeader* sCollisionHeaders[] = { &gHookshotTargetCol, &gHookshotTargetCol, &gHookshotPostCol }; +static CollisionHeader* sCollisionHeaders[] = { &gHookshotPostCol, &gHookshotPostCol, &gHookshotTargetCol }; static Color_RGB8 sFireTempleColor = { 165, 125, 55 };