1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-13 04:39:36 +00:00

Fix misc 7 (#1149)

* Fixup `Math3D_LineClosestToPoint`

* `gDodongosCavernBossLavaFloorTex` is 32x64

* Name empty-dlist-making functions `_EmptyDList`

* Fix typos

* transitionRate -> morphFrames

* Compare `xyzDistToPlayerSq` to squared values

* Fix hookshot target/post collision header names being swapped

* Fix description of `z_bg_mizu_movebg.c`

* Add scene command comment to `func_80098508` to match other scene command handlers

* Some fixup in `Camera_Demo5`

* `1` -> `ALLOCTYPE_ABSOLUTE` in comment on `ActorContext.absoluteSpace`
This commit is contained in:
Dragorn421 2022-02-20 14:31:31 +01:00 committed by GitHub
parent a9526a3354
commit e51fd73704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 93 additions and 87 deletions

View file

@ -1,7 +1,7 @@
<Root>
<File Name="object_d_hsblock" Segment="6">
<Collision Name="gHookshotPostCol" Offset="0x578"/>
<Collision Name="gHookshotTargetCol" Offset="0x730"/>
<Collision Name="gHookshotTargetCol" Offset="0x578"/>
<Collision Name="gHookshotPostCol" Offset="0x730"/>
<DList Name="gHookshotPostDL" Offset="0x210"/>
<DList Name="gHookshotTargetDL" Offset="0x470"/>
<Texture Name="gHookshotTargetTex" OutName="hookshot_target" Format="i4" Width="64" Height="64" Offset="0x760"/>

View file

@ -6,7 +6,7 @@
<Room Name="ddan_boss_room_0" Offset="0x0"/>
</File>
<File Name="ddan_boss_room_1" Segment="3">
<Texture Name="gDodongosCavernBossLavaFloorTex" OutName="lava_floor" Format="rgba16" Width="64" Height="32" Offset="0x21D8"/>
<Texture Name="gDodongosCavernBossLavaFloorTex" OutName="lava_floor" Format="rgba16" Width="32" Height="64" Offset="0x21D8"/>
<Room Name="ddan_boss_room_1" Offset="0x0"/>
</File>
</Root>

View file

@ -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);

View file

@ -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 {

View file

@ -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 {

View file

@ -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);

View file

@ -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);

View file

@ -1,7 +1,7 @@
#include "global.h"
// unused
Gfx sCircleNullDList[] = {
Gfx sCircleEmptyDList[] = {
gsSPEndDisplayList(),
};

View file

@ -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);

View file

@ -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;

View file

@ -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++) {

View file

@ -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"

View file

@ -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;

View file

@ -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,

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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;
}

View file

@ -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) {

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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,

View file

@ -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) {

View file

@ -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) {

View file

@ -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;
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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 };