1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +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

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