diff --git a/include/functions.h b/include/functions.h index fca5af0368..223d4badbe 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1476,7 +1476,7 @@ void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* p void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play); void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused); void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play); -LightNode* Lights_FindBufSlot(); +LightNode* Lights_FindBufSlot(void); void Lights_FreeNode(LightNode* light); void LightContext_Init(PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); diff --git a/include/macros.h b/include/macros.h index a4923ac060..d572e9ccf6 100644 --- a/include/macros.h +++ b/include/macros.h @@ -146,12 +146,13 @@ extern GraphicsContext* __gfxCtx; #define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5)) -#define SWAP(type, a, b) \ - { \ - type _temp = (a); \ - (a) = (b); \ - (b) = _temp; \ - } +#define SWAP(type, a, b) \ + { \ + type _temp = (a); \ + (a) = (b); \ + (b) = _temp; \ + } \ + (void)0 #define OVERLAY_RELOCATION_OFFSET(overlayEntry) ((uintptr_t)((overlayEntry)->vramStart) - (uintptr_t)((overlayEntry)->loadedRamAddr)) #define VRAM_PTR_SIZE(entry) ((uintptr_t)((entry)->vramEnd) - (uintptr_t)((entry)->vramStart)) diff --git a/include/z64math.h b/include/z64math.h index 70a115966b..62b6432e80 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -104,11 +104,13 @@ typedef struct { #define LERPWEIGHT(val, prev, next) (((val) - (prev)) / ((next) - (prev))) #define F32_LERPWEIGHT(val, prev, next) (((f32)(val) - (f32)(prev)) / ((f32)(next) - (f32)(prev))) -#define VEC3F_LERPIMPDST(dst, v0, v1, t){ \ - (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ - (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ - (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ -} +#define VEC3F_LERPIMPDST(dst, v0, v1, t) \ + { \ + (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ + (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ + (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ + } \ + (void)0 #define IS_ZERO(f) (fabsf(f) < 0.008f) diff --git a/include/z64message.h b/include/z64message.h index 82c84a3f82..2b0387045b 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -34,7 +34,7 @@ typedef enum TextState { #define FONT_CHAR_TEX_WIDTH 16 #define FONT_CHAR_TEX_HEIGHT 16 -//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` +//! TODO: Make this use `sizeof(AnyFontTextureSymbol)` #define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture // TODO: should Font be in its own header or is it fine to have it here? diff --git a/include/z64save.h b/include/z64save.h index d34b5f0d95..0037c5aa58 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -1450,9 +1450,12 @@ typedef enum SunsSongState { #define GET_WEEKEVENTREG_RACE_FLAGS (WEEKEVENTREG(92) & WEEKEVENTREG_RACE_FLAGS) -#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ - WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ - WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)) +#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ + { \ + WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ + WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)); \ + } \ + (void)0 /** * gSaveContext.eventInf diff --git a/include/z64subs.h b/include/z64subs.h index ca90cb232a..cc0e7ba2fb 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -16,7 +16,7 @@ typedef enum { /* 2 */ SUBS_CUTSCENE_SET_FLAG } SubSCutsceneType; -//! @TODO: rename based on func_8013E748 and func_800B8500 +//! TODO: rename based on func_8013E748 and func_800B8500 typedef s32 (*func_8013E748_VerifyFunc)(struct PlayState*, Actor*, void*); typedef s32 (*VerifyActor)(struct PlayState*, Actor*, Actor*, void*); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 0e36f1c54e..6ecbd617a8 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -3837,7 +3837,7 @@ void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v) { 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 1, }; s32 effectIndex; @@ -3892,7 +3892,7 @@ void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* p 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 0, }; s32 effectIndex; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 13ce84ec4f..9890f47414 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -630,7 +630,8 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount frameTable->x = jointIndices->x >= staticIndexMax ? dynamicData[jointIndices->x] : frameData[jointIndices->x]; frameTable->y = jointIndices->y >= staticIndexMax ? dynamicData[jointIndices->y] : frameData[jointIndices->y]; frameTable->z = jointIndices->z >= staticIndexMax ? dynamicData[jointIndices->z] : frameData[jointIndices->z]; - jointIndices++, frameTable++; + jointIndices++; + frameTable++; } } @@ -1577,7 +1578,7 @@ void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHead skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount); // Debug prints here, required to match. - if (1) {}; + if (1) {} if (animation != NULL) { Animation_PlayLoop(skelAnime, animation); diff --git a/src/code/z_snap.c b/src/code/z_snap.c index d64cfbe6e8..e9663b02fc 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -42,9 +42,8 @@ s32 Snap_RecordPictographedActors(PlayState* play) { break; } - if (actor->id) { - ; // Needed to match - } + //! FAKE: + if (1) {} // Actors which may be pictographed anywhere switch (actor->id) { diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 163756e07f..061c01b0aa 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -34,7 +34,7 @@ void osContGetReadData(OSContPad* data) { data->stick_x = readformat.stick_x; data->stick_y = readformat.stick_y; } - }; + } } void __osPackReadData() { diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index aeaaf0f82e..8445f53b05 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -3,7 +3,8 @@ #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ ptr = (void*)osVirtualToPhysical(ptr); \ - } + } \ + (void)0 static OSTask sTmpTask; diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 9fbf5ff645..776191227f 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -39,12 +39,9 @@ void osInitialize(void) { __osSetFpcCsr(0x01000800); __osSetWatchLo(0x04900000); - while (__osSiRawReadIo(0x1FC007FC, &pifdata)) { - ; - } - while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) { - ; - } + while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {} + + while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {} *(struct_exceptionPreamble*)0x80000000 = *((struct_exceptionPreamble*)__osExceptionPreamble); *(struct_exceptionPreamble*)0x80000080 = *((struct_exceptionPreamble*)__osExceptionPreamble); @@ -72,9 +69,7 @@ void osInitialize(void) { } if (__osGetCause() & 0x1000) { - while (1) { - ; - } + while (true) {} } HW_REG(AI_CONTROL_REG, u32) = 1; diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index c6de3c3e4c..77f568a02e 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -21,9 +21,9 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes saveMask = __osDisableInt(); if (__osTimerList->next != __osTimerList) { - if (0) { - ; - } + //! FAKE: + if (1) {} + spC = __osTimerList->next; sp14 = osGetCount(); sp10 = sp14 - __osTimerCounter; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 87f7129dfd..6b112e9529 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -29,7 +29,7 @@ void __osTimerInterrupt(void) { if (__osTimerList->next == __osTimerList) { return; } - while (1) { + while (true) { t = __osTimerList->next; if (t == __osTimerList) { __osSetCompare(0); @@ -84,9 +84,8 @@ OSTime __osInsertTimer(OSTimer* t) { savedMask = __osDisableInt(); for (timep = __osTimerList->next, tim = t->value; timep != __osTimerList && tim > timep->value; - tim -= timep->value, timep = timep->next) { - ; - } + tim -= timep->value, timep = timep->next) {} + t->value = tim; if (timep != __osTimerList) { timep->value -= tim; diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index d8e7edb671..a3608277fe 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -14,9 +14,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { if (ret != CONT_ERR_CONTRFAIL) { __osContPifRam.status = CONT_CMD_READ_BUTTON; - for (i = 0; i < port; i++, *ptr++ = 0) { - ; - } + for (i = 0; i < port; i++, *ptr++ = 0) {} *ptr++ = 1; *ptr++ = 3; diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index 6ec0ed86bd..a1c4f1d276 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -56,7 +56,7 @@ void BgTobira01_Open(BgTobira01* this, PlayState* play) { this->timer++; } else { this->timer--; - }; + } this->timer = CLAMP(this->timer, 0, 60); diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index c1303efab1..f499b7e201 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -444,7 +444,8 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->effects); i++) { this->effects[i].state = DEMO_KANKYO_STATE_INIT; } // clang-format on - if (1) {}; + //! FAKE: + if (1) {} switch (this->actor.params) { case DEMO_KANKYO_TYPE_LOSTWOODS: diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 4e4285b521..fbd8292123 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -351,8 +351,8 @@ s32 func_80B3EC84(EnDai* this) { }; static Vec3f D_80B3FD7C[] = { - { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8, 0.8 }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, - { 1.0f, 0.8, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8, 0.9f }, { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8f, 0.8f }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, + { 1.0f, 0.8f, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8f, 0.9f }, { 1.0f, 1.0f, 1.0f }, }; s32 i; @@ -379,7 +379,10 @@ s32 func_80B3ED88(EnDai* this) { static s16 D_80B3FE00[] = { 1, 2, 3 }; static Vec3f D_80B3FE08[] = { - 1.0f, 1.0f, 1.0f, 1.0f, 1.2f, 1.2f, 1.0f, 0.7f, 0.8f, 1.0f, 1.0f, 1.0f, + { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.2f, 1.2f }, + { 1.0f, 0.7f, 0.8f }, + { 1.0f, 1.0f, 1.0f }, }; s32 i; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index fa161e9fd5..4a3c9b4444 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -7,8 +7,8 @@ struct EnDaiku; typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); -#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF); -#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { /* 0x0 */ ENDAIKU_PARAMS_FF_0, diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index f13b896119..130a06a235 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -7,9 +7,9 @@ struct EnDaiku2; typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); -#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F); -#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F); -#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1); +#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F) +#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F) +#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1) enum { /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index c6672b06e4..59b6677a0a 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -8,13 +8,13 @@ struct EnDekunuts; typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); -#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { - /* 0x0 */ ENDEKUNUTS_GET_FF00_0, - /* 0x1 */ ENDEKUNUTS_GET_FF00_1, - /* 0x2 */ ENDEKUNUTS_GET_FF00_2, - /* 0xFF*/ ENDEKUNUTS_GET_FF00_FF = 0xFF, + /* 0x00 */ ENDEKUNUTS_GET_FF00_0, + /* 0x01 */ ENDEKUNUTS_GET_FF00_1, + /* 0x02 */ ENDEKUNUTS_GET_FF00_2, + /* 0xFF */ ENDEKUNUTS_GET_FF00_FF = 0xFF }; typedef struct EnDekunuts { diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index e967851336..7a8bc5ddb8 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -275,7 +275,9 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { } Matrix_Push(); - if (1) {}; + //! FAKE: + if (1) {} + arg0->unk_24 = (arg0->unk_01 / (f32)arg0->unk_02) * 255.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)arg0->unk_24); diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 2a60cec767..aad29992ae 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -945,7 +945,9 @@ void func_80A73408(EnDno* this, PlayState* play) { if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->animIndex == EN_DNO_ANIM_SHOCK_START)) { - if (0) {}; + //! FAKE: + if (1) {} + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_SHOCK_LOOP, &this->animIndex); } } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index d7fa756368..11240f27b8 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -154,6 +154,7 @@ s32 func_80B3CA20(EnDnp* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } } else if ((this->animIndex == EN_DNP_ANIM_UNUSED_WALK) && (this->animIndex == EN_DNP_ANIM_WALK)) { + //! @bug: Impossible to reach, && should be an || if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } @@ -217,7 +218,8 @@ s32 func_80B3CDA4(EnDnp* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp3C, &sp30); //! FAKE - if (1) {}; + if (1) {} + Math_SmoothStepToS(&this->unk_330, pitch, 3, 0x2AA8, 0x1); return 1; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c93c8e005c..33a819b205 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -113,7 +113,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.targetMode = 6; this->dyna.actor.colChkInfo.health = 1; - this->scale = 0.1; + this->scale = 0.1f; this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor); if (this->switchFlag == 0x7F) { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 65df46284d..28267a485e 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -159,8 +159,8 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc action) { void EnGirlA_InitObjIndex(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; - //! @bug: Condition is impossible, && should be an || if ((params >= SI_MAX) && (params < SI_POTION_RED_1)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 74d4af13d3..35770e38c7 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -934,7 +934,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { func_80169EFC(&play->state); //! FAKE - if (0) {} + if (1) {} if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { gSaveContext.save.time = CLOCK_TIME(6, 0); diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index ca26d5c952..efce38ad86 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -193,7 +193,8 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { } else if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) { u16 sp2E = Player_GetMask(play) + 0x273C; - if (0) {} + //! FAKE: + if (1) {} Message_StartTextbox(play, sp2E, &this->actor); this->unk_288 = sp2E; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 392452c62a..274ddbc493 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -86,41 +86,20 @@ static ColliderCylinderInit sCylinderInit = { { 15, 25, 4, { 0, 0, 0 } }, }; -static Vec3f D_808934C4 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), -}; - -static Vec3f D_808934DC = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static Vec3f D_808934E8 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static s32 pad = 0; - void EnNiw_Init(Actor* thisx, PlayState* play) { + static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), + }; EnNiw* this = THIS; - Vec3f dTemp = D_808934C4; + Vec3f D_808934C4 = { 90000.0f, 90000.0f, 90000.0f }; if (this->actor.params < 0) { // all scene spawned cucco are (-1) this->actor.params = NIW_TYPE_REGULAR; } - Math_Vec3f_Copy(&this->unk2BC, &dTemp); + Math_Vec3f_Copy(&this->unk2BC, &D_808934C4); this->niwType = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -138,9 +117,6 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->niwType == NIW_TYPE_UNK1) { - // @Bug this unused variant is broken and crashes on spawn (EnNiw_Update expects a parent, NULL) - // if modified to change niwType to TYPE_REGULAR here, new size is smaller than normal - // theory: was meant to be a small hand held cucco for grog to show the player Actor_SetScale(&this->actor, (BREG(86) / 10000.0f) + 0.004f); } @@ -450,7 +426,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { } void EnNiw_Held(EnNiw* this, PlayState* play) { - Vec3f vec3fcopy = D_808934DC; + Vec3f D_808934DC = { 90000.0f, 90000.0f, 90000.0f }; s16 rotZ; if (this->heldTimer == 0) { @@ -483,7 +459,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Math_Vec3f_Copy(&this->unk2BC, &vec3fcopy); + Math_Vec3f_Copy(&this->unk2BC, &D_808934DC); this->actor.flags |= ACTOR_FLAG_1; // targetable ON this->actionFunc = EnNiw_Thrown; } @@ -666,7 +642,7 @@ void EnNiw_SetupRunAway(EnNiw* this) { void EnNiw_RunAway(EnNiw* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f tempVec3f = D_808934E8; + Vec3f D_808934E8 = { 90000.0f, 90000.0f, 90000.0f }; s16 temp298; f32 dX; f32 dZ; @@ -682,7 +658,7 @@ void EnNiw_RunAway(EnNiw* this, PlayState* play) { this->targetLimbRots[6] = 0; this->targetLimbRots[5] = 0; this->targetLimbRots[7] = 0; - Math_Vec3f_Copy(&this->unk2BC, &tempVec3f); + Math_Vec3f_Copy(&this->unk2BC, &D_808934E8); EnNiw_SetupIdle(this); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index c1cec3b88b..c603975350 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -79,7 +79,7 @@ typedef struct EnNiw { /* 0x2E8 */ s16 yawTowardsPlayer; /* 0x2EA */ s16 headRotationToggle; /* 0x2EC */ s16 unk2EC; - /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; + /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; /* 0x2F4 */ f32 unusedFloat2F4; // set in EnNiw_Update if Cucco falls off map, never read /* 0x2F8 */ f32 unusedFloat2F8; /* 0x2FC */ f32 unusedFloat2FC; @@ -91,12 +91,13 @@ typedef struct EnNiw { /* 0x35C */ EnNiwFeather feathers[NIW_FEATHER_COUNT]; } EnNiw; // size = 0x7BC -// in init, any value below zero becomes zero -// however, in vanilla, only 0xFFFF (-1) exists in scene spawns, actors can spawn 0x0 -#define NIW_TYPE_VANILLA 0xFFFF -#define NIW_TYPE_REGULAR 0 -#define NIW_TYPE_UNK1 1 -#define NIW_TYPE_HELD 2 // spawns held by the bomber kid in east clock town during hide and seek +typedef enum { + /* -1 */ NIW_TYPE_VANILLA = -1, // Will be converted to 0, in vanilla exists only in scene spawns + /* 0 */ NIW_TYPE_REGULAR, + /* 1 */ NIW_TYPE_UNK1, // This unused variant must be spawned as a child, as it expects a NON-NULL parent. + // Theory: This was meant to be a small hand held cucco for Grog to show the player + /* 2 */ NIW_TYPE_HELD // spawns held by the bomber kid in east clock town during hide and seek +} NiwType; // the attacking cuccos are not here, they are a different actor: [ ovl_En_Attack_Niw ] typedef enum { 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 ac1c3cb8cb..c26a1a2c7e 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -265,8 +265,8 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = THIS; s16 id; - //! @bug Condition is impossible, params cannot be both greater then 1 AND less then 0. if ((this->actor.params > ENOSSAN_PART_TIME_WORKER) && (this->actor.params < ENOSSAN_CURIOSITY_SHOP_MAN)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 809c738a44..145c0507d0 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -16,7 +16,7 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play); void EnPoFusen_Update(Actor* thisx, PlayState* play); void EnPoFusen_Draw(Actor* thisx, PlayState* play); -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); void EnPoFusen_InitNoFuse(EnPoFusen* this); void EnPoFusen_InitFuse(EnPoFusen* this); void EnPoFusen_Pop(EnPoFusen* this, PlayState* play); @@ -146,9 +146,9 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { } /** - * Search for Romani's actor, beacuse it's PoFusen's job to update her actor on pop. + * Search for Romani's actor, beacuse it's PoFusen's job to update her actor when the balloon is popped. */ -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { Actor* actorIter = play->actorCtx.actorLists[ACTORCAT_NPC].first; if (POE_BALLOON_IS_FUSE_TYPE(&this->actor)) { @@ -166,7 +166,7 @@ u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { return false; } -u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { +s32 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { if (this->actionFunc == EnPoFusen_IdleFuse) { return false; } @@ -195,7 +195,6 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { f32 shadowScaleTmp; f32 shadowAlphaTmp; f32 heightOffset; - f32 f255 = 255.0f; this->actor.world.pos = this->actor.home.pos; this->randScaleChange += 0x190; @@ -207,7 +206,7 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { this->actor.world.pos.y += heightOffset; this->actor.shape.rot.z = (Math_SinS(this->randBaseRotChange) * 910.0f); - if ((this->randScaleChange < 0x4000) && (this->randScaleChange >= -0x3FFF)) { + if ((this->randScaleChange < 0x4000) && (this->randScaleChange > -0x4000)) { Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x38E, 0x14, 0xBB8, 0x64); } else { Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x71C, 0x8, 0xBB8, 0x64); @@ -222,7 +221,7 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { shadowScaleTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 10.0f) + 50.0f; shadowAlphaTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 75.0f) + 100.0f; this->actor.shape.shadowScale = shadowScaleTmp; - this->actor.shape.shadowAlpha = (shadowAlphaTmp > f255) ? (u8)f255 : (u8)shadowAlphaTmp; + this->actor.shape.shadowAlpha = CLAMP_MAX(shadowAlphaTmp, 255.0f); } void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 0fa09cf1c5..54ed5babc1 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -251,7 +251,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { return; } - //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro + //! TODO: Neither 0xED02 nor 0xED01 match CLOCK_TIME macro if (((play->sceneId == SCENE_MILK_BAR) && !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 742ea8846b..530b75b0e0 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -86,7 +86,9 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966E0C); break; case WEATHERTAG_TYPE_UNK3: - if (0) {} // this can move to diff locations and still match + //! FAKE: this can move to different locations and still match + if (1) {} + EnWeatherTag_SetupAction(this, func_80966EF0); break; case WEATHERTAG_TYPE_UNK4: diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 00f76dafea..c538457e8d 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -486,7 +486,9 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { break; default: - if (0) {} + //! FAKE: + if (1) {} + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 97c8bb7d94..532daec900 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -151,7 +151,10 @@ void ObjAqua_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); - if (1) {}; + + //! FAKE: + if (1) {} + this->actor.shape.shadowAlpha = 140; this->alpha = 255; if (func_80ACBA60(this, play)) { diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 978fe7f0e1..dd9f84ae0b 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -150,7 +150,7 @@ void ObjChan_CalculatePotPosition(Vec3f* childPosOut, Vec3s* childRotOut, Vec3f* childRotOut->y += childAngle; } -//! @TODO: Possibly takes actor and recasts +//! TODO: Possibly takes actor and recasts void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { ObjChan* this = this2; s32 i; @@ -210,7 +210,7 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { this->actionFunc = ObjChan_ChandelierAction; } -//! @TODO: More descriptive name than Action? +//! TODO: More descriptive name than Action? void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { ObjChan* this = this2; ObjChan* temp; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index af26540670..09fab57d6c 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1703,7 +1703,7 @@ void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { if (this->wheelRot / 0x199A != this->unk_420) { this->unk_420 = this->wheelRot / 0x199A; //! FAKE - if (!&sUmAnims[0]) {} + if (sUmAnims[0].doesMove) {} Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CART_WHEEL); } }