From e5ecdfd5599e53127e372b31546c158371eb1e93 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Jan 2022 21:48:04 +0100 Subject: [PATCH] Misc. doc/cleanup 5 (#1096) * `0` -> `CHEST_ANIM_SHORT` in `GET_ITEM` z_player macro * fix typos in z_en_skj Co-authored-by: Yanis42 * `unkSkjStruct` -> `EnSkjUnkStruct` * Use `EFFECT_SS_` enum in all `EffectSs_Spawn` calls * Decimal for all `EffectSs_Spawn` priorities * Use `OBJECT_INVALID` more * `Object_IsLoaded` returns a boolean * Add `@bug` in `DmaMgr_SendRequestImpl` about passing partially uninitialized struct * Fix typo `forc_structure_alignment` -> "force" * Move `CMD_F` to `z64cutscene_commands.h` since it is specifically for cutscene data * Use `ALIGN16` macro more * Use `ALIGN256` macro more * Add `@bug` on two messed up 8-bytes-aligns * Set `gSaveContext.nightFlag` to 0/1 instead of false/true * Use `IS_DAY` macro more * Run formatter Co-authored-by: Yanis42 --- include/command_macros_base.h | 6 ---- include/ultra64/types.h | 2 +- include/z64cutscene_commands.h | 6 ++++ src/boot/z_std_dma.c | 1 + src/code/audio_load.c | 2 +- src/code/z_effect_soft_sprite_old_init.c | 6 ++-- src/code/z_kankyo.c | 12 ++++---- src/code/z_scene.c | 6 ++-- src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 2 +- .../z_bg_spot00_hanebasi.c | 5 ++-- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 +-- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 30 +++++++++---------- src/overlays/actors/ovl_En_Skj/z_en_skj.h | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 2 +- .../actors/ovl_player_actor/z_player.c | 6 ++-- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 20 +++++++------ 20 files changed, 61 insertions(+), 59 deletions(-) diff --git a/include/command_macros_base.h b/include/command_macros_base.h index 6fa0e86385..0ceaa130dd 100644 --- a/include/command_macros_base.h +++ b/include/command_macros_base.h @@ -16,12 +16,6 @@ #define CMD_W(a) (a) -#ifdef __GNUC__ -#define CMD_F(a) {.f = (a)} -#else -#define CMD_F(a) {(a)} -#endif - #define CMD_PTR(a) (u32)(a) #endif diff --git a/include/ultra64/types.h b/include/ultra64/types.h index 6874a5209a..a90792a552 100644 --- a/include/ultra64/types.h +++ b/include/ultra64/types.h @@ -30,7 +30,7 @@ typedef union { u16 intPart[4][4]; u16 fracPart[4][4]; }; - long long int forc_structure_alignment; + long long int force_structure_alignment; } Mtx; typedef float MtxF_t[4][4]; diff --git a/include/z64cutscene_commands.h b/include/z64cutscene_commands.h index b9e62f7fe7..de99ed3d11 100644 --- a/include/z64cutscene_commands.h +++ b/include/z64cutscene_commands.h @@ -4,6 +4,12 @@ #include "command_macros_base.h" #include "z64cutscene.h" +#ifdef __GNUC__ +#define CMD_F(a) {.f = (a)} +#else +#define CMD_F(a) {(a)} +#endif + /** * ARGS * s32 totalEntries (e), s32 endFrame (n) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index a1f42d4c37..45a6deaf62 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -337,6 +337,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) || (size & 1)) { + //! @bug `req` is passed to `DmaMgr_Error` without rom, ram and size being set DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です"); } diff --git a/src/code/audio_load.c b/src/code/audio_load.c index e4b1299db9..d19fdc853a 100644 --- a/src/code/audio_load.c +++ b/src/code/audio_load.c @@ -1409,7 +1409,7 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, u32 size, s } else if (nChunks == 1) { asyncLoad->chunkSize = size; } else { - asyncLoad->chunkSize = (((s32)size / nChunks) + 0xFF) & ~0xFF; + asyncLoad->chunkSize = ALIGN256((s32)size / nChunks); if (asyncLoad->chunkSize < 0x100) { asyncLoad->chunkSize = 0x100; } diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index adc22e7621..8d052a8bf1 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -252,7 +252,7 @@ void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f initParams.envColor = *envColor; initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); - EffectSs_Spawn(globalCtx, 1, 128, &initParams); + EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); } void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, @@ -271,7 +271,7 @@ void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life)); - EffectSs_Spawn(globalCtx, 1, 128, &initParams); + EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams); } // EffectSsBomb Spawn Functions @@ -833,7 +833,7 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; initParams.life = life; - EffectSs_Spawn(globalCtx, 0x1A, 0x80, &initParams); + EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams); } void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index e71139e343..d49cae5b8a 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -238,9 +238,9 @@ void Environment_Init(GlobalContext* globalCtx2, EnvironmentContext* envCtx, s32 gSaveContext.sunsSongState = SUNSSONG_INACTIVE; if (((void)0, gSaveContext.dayTime) > 0xC000 || ((void)0, gSaveContext.dayTime) < 0x4555) { - ((void)0, gSaveContext.nightFlag = true); + ((void)0, gSaveContext.nightFlag = 1); } else { - ((void)0, gSaveContext.nightFlag = false); + ((void)0, gSaveContext.nightFlag = 0); } globalCtx->state.gfxCtx->callback = Environment_GraphCallback; @@ -820,7 +820,7 @@ void Environment_PrintDebugInfo(GlobalContext* globalCtx, Gfx** gfx) { GfxPrint_SetColor(&printer, 55, 255, 255, 64); GfxPrint_SetPos(&printer, 22, 6); - if (gSaveContext.nightFlag) { + if (!IS_DAY) { GfxPrint_Printf(&printer, "%s", "YORU"); // "night" } else { GfxPrint_Printf(&printer, "%s", "HIRU"); // "day" @@ -881,7 +881,7 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li if ((envCtx->unk_1A == 0) && !FrameAdvance_IsEnabled(globalCtx) && (globalCtx->transitionMode == 0 || ((void)0, gSaveContext.gameMode) != 0)) { - if (!((void)0, gSaveContext.nightFlag) || gTimeIncrement >= 0x190) { + if (IS_DAY || gTimeIncrement >= 0x190) { gSaveContext.dayTime += gTimeIncrement; } else { gSaveContext.dayTime += gTimeIncrement * 2; // time moves twice as fast at night @@ -900,9 +900,9 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li time = gSaveContext.dayTime; if (time > 0xC000 || time < 0x4555) { - gSaveContext.nightFlag = true; + gSaveContext.nightFlag = 1; } else { - gSaveContext.nightFlag = false; + gSaveContext.nightFlag = 0; } if (SREG(0) != 0 || CREG(2) != 0) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 6948d09cc7..e7d1128068 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -113,9 +113,9 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) { s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) { if (objectCtx->status[bankIndex].id > 0) { - return 1; + return true; } else { - return 0; + return false; } } @@ -232,7 +232,7 @@ void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x07: Special Files void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) { - if (cmd->specialFiles.keepObjectId != 0) { + if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId); gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); } diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 4ec6a44aa9..508d77e0d5 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -68,7 +68,7 @@ void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { - if (globalCtx->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && !gSaveContext.nightFlag) { + if (globalCtx->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && IS_DAY) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~0x10; if (!Gameplay_InCsMode(globalCtx)) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 5b5005c1fc..1fd6d1aaa7 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -254,7 +254,7 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL); } if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOX)) > 0) && - (Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx))) { + Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx)) { gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->boxObjIdx].segment); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); Matrix_Put(&mtx); diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index e5ba9ebcd7..6637aa996e 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -142,7 +142,7 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* glob !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || (gSaveContext.eventChkInf[8] & 1)) { if (this->dyna.actor.shape.rot.x != 0) { - if (Flags_GetEnv(globalCtx, 0) || ((gSaveContext.sceneSetupIndex < 4) && (gSaveContext.nightFlag == 0))) { + if (Flags_GetEnv(globalCtx, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = 0; child->destAngle = 0; @@ -151,8 +151,7 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, GlobalContext* glob if (this) {} // required to match } - if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT && - (gSaveContext.nightFlag != 0)) { + if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT && !IS_DAY) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = -0x4000; child->destAngle = -0xFE0; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index aadb57affb..857adbd2ab 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -78,7 +78,7 @@ void EnGuest_Update(Actor* thisx, GlobalContext* globalCtx) { EnGuest* this = (EnGuest*)thisx; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex) != 0) { + if (Object_IsLoaded(&globalCtx->objectCtx, this->osAnimeBankIndex)) { this->actor.flags &= ~ACTOR_FLAG_4; Actor_ProcessInitChain(&this->actor, sInitChain); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index f30bfce89b..8f3a67a80c 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -827,7 +827,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { if (this->type == HORSE_HNI) { - if (this->actor.world.rot.z == 0 || gSaveContext.nightFlag) { + if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); return; } @@ -839,7 +839,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); return; } - } else if (!Flags_GetEventChkInf(0x18) && !DREG(1) && gSaveContext.nightFlag) { + } else if (!Flags_GetEventChkInf(0x18) && !DREG(1) && !IS_DAY) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 54a011ab45..88ee0f7a50 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -202,7 +202,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, &this->cloneCollider, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (globalCtx->sceneNum == SCENE_SPOT20) { - if (this->actor.world.rot.z == 0 || gSaveContext.nightFlag) { + if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 2b087a1a52..0ff3b6bc56 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -908,7 +908,7 @@ void EnPoh_UpdateVisibility(EnPoh* this) { void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx) { EnPoh* this = (EnPoh*)thisx; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx) != 0) { + if (Object_IsLoaded(&globalCtx->objectCtx, this->objectIdx)) { this->actor.objBankIndex = this->objectIdx; this->actor.update = EnPoh_UpdateLiving; Actor_SetObjectDependency(globalCtx, &this->actor); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 3255195f0f..8788fadc02 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -115,7 +115,7 @@ typedef enum { } SkullKidStumpSide; typedef enum { - /* 0 */ SKULL_KID_OCRAINA_WAIT, + /* 0 */ SKULL_KID_OCARINA_WAIT, /* 1 */ SKULL_KID_OCARINA_PLAY_NOTES, /* 2 */ SKULL_KID_OCARINA_LEAVE_GAME } SkullKidOcarinaGameState; @@ -155,10 +155,10 @@ typedef enum { typedef struct { u8 unk0; EnSkj* skullkid; -} unkSkjStruct; +} EnSkjUnkStruct; -static unkSkjStruct sSmallStumpSkullKid = { 0, NULL }; -static unkSkjStruct sOcarinaMinigameSkullKids[] = { { 0, NULL }, { 0, NULL } }; +static EnSkjUnkStruct sSmallStumpSkullKid = { 0, NULL }; +static EnSkjUnkStruct sOcarinaMinigameSkullKids[] = { { 0, NULL }, { 0, NULL } }; const ActorInit En_Skj_InitVars = { ACTOR_EN_SKJ, @@ -438,7 +438,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(thisx, 0.01f); this->actor.textId = this->textId = 0; this->multiuseTimer = 0; - this->backfilpFlag = 0; + this->backflipFlag = 0; this->needlesToShoot = 3; this->hitsUntilDodge = 3; this->actor.speedXZ = 0.0f; @@ -615,7 +615,7 @@ s32 EnSkj_CollisionCheck(EnSkj* this, GlobalContext* globalCtx) { return 1; } } else { - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_Backflip(this); return 1; } @@ -660,7 +660,7 @@ void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx) { alpha -= 20; - if (this->backfilpFlag != 0) { + if (this->backflipFlag != 0) { if (alpha > 255) { alpha = 0; } @@ -712,7 +712,7 @@ void EnSkj_SetupResetFight(EnSkj* this) { void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { if (this->actor.params == 0) { if (!(gSaveContext.itemGetInf[1] & 0x40) && (this->actor.xzDistToPlayer < 200.0f)) { - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_Backflip(this); } else if (sSmallStumpSkullKid.unk0 != 0) { Player* player = GET_PLAYER(globalCtx); @@ -837,7 +837,7 @@ void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = (yawDistToPlayer < 0) ? -(1.0f + phi_f14) : (1.0f + phi_f14); } else if (func_80AFEDF8(this, globalCtx) != 0) { - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_Backflip(this); } else { EnSkj_SetupResetFight(this); @@ -856,7 +856,7 @@ void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx) { } void EnSkj_SetupSpawnDeathEffect(EnSkj* this) { - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_SetupAction(this, SKJ_ACTION_SPAWN_DEATH_EFFECT); } @@ -1172,7 +1172,7 @@ void EnSkj_SetupWaitForMaskTextClear(EnSkj* this) { void EnSkj_WaitForMaskTextClear(EnSkj* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) { func_8002DF54(globalCtx, &this->actor, 7); - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_Backflip(this); } } @@ -1277,7 +1277,7 @@ void EnSkj_LeaveOcarinaGame(EnSkj* this, GlobalContext* globalCtx) { sOcarinaMinigameSkullKids[paramsDecr].unk0 = 0; sOcarinaMinigameSkullKids[paramsDecr].skullkid = NULL; - this->backfilpFlag = 1; + this->backflipFlag = 1; EnSkj_Backflip(this); } @@ -1306,7 +1306,7 @@ void EnSkj_Update(Actor* thisx, GlobalContext* globalCtx) { this->hitsUntilDodge = 3; } - if ((this->backfilpFlag != 0) && (this->alpha == 0)) { + if ((this->backflipFlag != 0) && (this->alpha == 0)) { if (this->action == 9) { dropPos.x = this->actor.world.pos.x; dropPos.y = this->actor.world.pos.y; @@ -1432,7 +1432,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { switch (globalCtx->msgCtx.msgMode) { case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT: if (sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid != NULL) { - sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCRAINA_WAIT; + sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; } if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { if (sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid != NULL) { @@ -1444,7 +1444,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { break; case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT: if (sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid != NULL) { - sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCRAINA_WAIT; + sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT; } if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) { Message_UpdateOcarinaGame(globalCtx); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.h b/src/overlays/actors/ovl_En_Skj/z_en_skj.h index 29bd8e8f07..09b806de66 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.h +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.h @@ -23,7 +23,7 @@ typedef struct EnSkj { /* 0x02CE */ s16 dodgeResetTimer; /* 0x02D0 */ u8 animIndex; /* 0x02D1 */ u8 action; - /* 0x02D2 */ u8 backfilpFlag; + /* 0x02D2 */ u8 backflipFlag; /* 0x02D3 */ u8 unk_2D3; // Is set to zero when walking to trade for skull mask and set to 1 when dying /* 0x02D4 */ u8 needlesToShoot; /* 0x02D5 */ u8 hitsUntilDodge; // Upon reaching zero will always backflip to avoid stun lock diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index e4be14197c..ee7a4791f1 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -145,7 +145,7 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(&this->actor); } else if (!LINK_IS_ADULT) { Actor_Kill(&this->actor); - } else if (globalCtx->sceneNum == SCENE_MALON_STABLE && gSaveContext.nightFlag) { + } else if (globalCtx->sceneNum == SCENE_MALON_STABLE && !IS_DAY) { Actor_Kill(&this->actor); osSyncPrintf(VT_FGCOL(CYAN) " 夜はいない \n" VT_RST); } else { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 6df36934cb..d526b624bd 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -29,13 +29,13 @@ typedef struct { } GetItemEntry; // size = 0x06 #define GET_ITEM(itemId, objectId, drawId, textId, field, chestAnim) \ - { itemId, field, (chestAnim != 0 ? 1 : -1) * (drawId + 1), textId, objectId } + { itemId, field, (chestAnim != CHEST_ANIM_SHORT ? 1 : -1) * (drawId + 1), textId, objectId } #define CHEST_ANIM_SHORT 0 #define CHEST_ANIM_LONG 1 #define GET_ITEM_NONE \ - { ITEM_NONE, 0, 0, 0, 0 } + { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } typedef enum { /* 0x00 */ KNOB_ANIM_ADULT_L, @@ -4643,7 +4643,7 @@ void func_8083AE40(Player* this, s16 objectId) { s32 pad; u32 size; - if (objectId != 0) { + if (objectId != OBJECT_INVALID) { this->giObjectLoading = true; osCreateMesgQueue(&this->giObjectLoadQueue, &this->giObjectLoadMsg, 1); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 8e295a81d9..5375f30af1 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2517,12 +2517,13 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->unk_204 = -314.0f; + //! @bug messed up alignment, should match `ALIGN64` pauseCtx->playerSegment = (void*)(((u32)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); size1 = func_80091738(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime); osSyncPrintf("プレイヤー size1=%x\n", size1); - pauseCtx->iconItemSegment = (void*)(((u32)pauseCtx->playerSegment + size1 + 0xF) & ~0xF); + pauseCtx->iconItemSegment = (void*)ALIGN16((u32)pauseCtx->playerSegment + size1); size0 = (u32)_icon_item_staticSegmentRomEnd - (u32)_icon_item_staticSegmentRomStart; osSyncPrintf("icon_item size0=%x\n", size0); @@ -2537,14 +2538,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { } } - pauseCtx->iconItem24Segment = (void*)(((u32)pauseCtx->iconItemSegment + size0 + 0xF) & ~0xF); + pauseCtx->iconItem24Segment = (void*)ALIGN16((u32)pauseCtx->iconItemSegment + size0); size = (u32)_icon_item_24_staticSegmentRomEnd - (u32)_icon_item_24_staticSegmentRomStart; osSyncPrintf("icon_item24 size=%x\n", size); DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (u32)_icon_item_24_staticSegmentRomStart, size, "../z_kaleido_scope_PAL.c", 3675); - pauseCtx->iconItemAltSegment = (void*)(((u32)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF); + pauseCtx->iconItemAltSegment = (void*)ALIGN16((u32)pauseCtx->iconItem24Segment + size); switch (globalCtx->sceneNum) { case SCENE_YDAN: @@ -2585,7 +2586,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { break; } - pauseCtx->iconItemLangSegment = (void*)(((u32)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF); + pauseCtx->iconItemLangSegment = (void*)ALIGN16((u32)pauseCtx->iconItemAltSegment + size2); if (gSaveContext.language == LANGUAGE_ENG) { size = (u32)_icon_item_nes_staticSegmentRomEnd - (u32)_icon_item_nes_staticSegmentRomStart; @@ -2604,7 +2605,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { "../z_kaleido_scope_PAL.c", 3753); } - pauseCtx->nameSegment = (void*)(((u32)pauseCtx->iconItemLangSegment + size + 0xF) & ~0xF); + pauseCtx->nameSegment = (void*)ALIGN16((u32)pauseCtx->iconItemLangSegment + size); osSyncPrintf("サイズ=%x\n", size2 + size1 + size0 + size); osSyncPrintf("item_name I_N_PT=%x\n", 0x800); @@ -2630,7 +2631,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { } } - sPreRenderCvg = (void*)(((u32)pauseCtx->nameSegment + 0x400 + 0xA00 + 0xF) & ~0xF); + sPreRenderCvg = (void*)ALIGN16((u32)pauseCtx->nameSegment + 0x400 + 0xA00); PreRender_Init(&sPlayerPreRender); PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); @@ -3128,25 +3129,26 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { pauseCtx->unk_204 = -434.0f; Interface_ChangeAlpha(1); + //! @bug messed up alignment, should match `ALIGN64` pauseCtx->iconItemSegment = (void*)(((u32)globalCtx->objectCtx.spaceStart + 0x30) & ~0x3F); size0 = (u32)_icon_item_staticSegmentRomEnd - (u32)_icon_item_staticSegmentRomStart; osSyncPrintf("icon_item size0=%x\n", size0); DmaMgr_SendRequest1(pauseCtx->iconItemSegment, (u32)_icon_item_staticSegmentRomStart, size0, "../z_kaleido_scope_PAL.c", 4356); - pauseCtx->iconItem24Segment = (void*)(((u32)pauseCtx->iconItemSegment + size0 + 0xF) & ~0xF); + pauseCtx->iconItem24Segment = (void*)ALIGN16((u32)pauseCtx->iconItemSegment + size0); size = (u32)_icon_item_24_staticSegmentRomEnd - (u32)_icon_item_24_staticSegmentRomStart; osSyncPrintf("icon_item24 size=%x\n", size); DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (u32)_icon_item_24_staticSegmentRomStart, size, "../z_kaleido_scope_PAL.c", 4363); - pauseCtx->iconItemAltSegment = (void*)(((u32)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF); + pauseCtx->iconItemAltSegment = (void*)ALIGN16((u32)pauseCtx->iconItem24Segment + size); size2 = (u32)_icon_item_gameover_staticSegmentRomEnd - (u32)_icon_item_gameover_staticSegmentRomStart; osSyncPrintf("icon_item_dungeon gameover-size2=%x\n", size2); DmaMgr_SendRequest1(pauseCtx->iconItemAltSegment, (u32)_icon_item_gameover_staticSegmentRomStart, size2, "../z_kaleido_scope_PAL.c", 4370); - pauseCtx->iconItemLangSegment = (void*)(((u32)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF); + pauseCtx->iconItemLangSegment = (void*)ALIGN16((u32)pauseCtx->iconItemAltSegment + size2); if (gSaveContext.language == LANGUAGE_ENG) { size = (u32)_icon_item_nes_staticSegmentRomEnd - (u32)_icon_item_nes_staticSegmentRomStart;