From f1d27bf6531fd6579d09dcf3078ee97c57b6fff1 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 3 Oct 2021 05:17:09 +0200 Subject: [PATCH] Fix/cleanup/rephrase miscellaneous stuff (#983) * Add parens around params usage in VEC_SET macro * Remove unnecessary space character in a xml * Use defines instead of magic values in head/tail magic comments * Use `OS_USEC_TO_CYCLES` to make a time look better in `Graph_TaskSet00` * `0x25800` -> `sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])` * `0x803DA800` -> `0x80400000 - frame buffer size` * Use `OS_VI_` defines instead of hex * Add empty line after some variable declarations * Remove unused `extern CutsceneData` in `z_bg_dy_yoseizo.c` * `Matrix_MtxFToYXZRotS` does not use `MTXMODE_` * Use `MTXMODE_` more * Remove `ASCII_TO_U32`, use `'IS64'` * Add explicit `!= NULL` in some ternaries * Use `INV_CONTENT`, `AMMO` macros more * Use `PLAYER_AP_` enum more to compare to `Player#heldItemActionParam` * Get rid of lowercase hex (outside libultra) * `gWindMill*` -> `gWindmill*` * Format and small fix enums in `z_boss_mo.h` * Use `CHECK_BTN_ANY` more * Fix xz/xy mistake in comment in tektite * Rephrase comments mentioning "the devs" in a more neutral way * Clean-up some objectively useless parens * Fix some negative values written as u16 instead of s16 in ichains * `SKJ_ACTON_` -> `SKJ_ACTION_` * Run formatter * Fix unk_ offset of `TransformUpdateIndex#unk_10` -> `unk_0E` * Remove comments using in-game text * Remove `U` suffix from integer literals * Revert "Remove `ASCII_TO_U32`, use `'IS64'`" This reverts commit c801337dde9fe5e8b7a7ecf85ad3629bf5b87aaf. * Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)` * Add empty line after decl x2 * Revert "Use `PLAYER_STR_*` to compare to `CUR_UPG_VALUE(UPG_STRENGTH)`" This reverts commit d80bdb32da449edc74e02b8ab3f5a2c532e74bdb. * Make `CUR_UPG_VALUE(UPG_STRENGTH)` compare to integers (eventually needs its own enum) * Only use `PLAYER_SHIELD_` enum with `Player#currentShield` * Only use `PLAYER_TUNIC_` enum with `Player#currentTunic` --- assets/xml/objects/gameplay_field_keep.xml | 2 +- assets/xml/objects/object_fu.xml | 4 +- include/z64.h | 10 +-- include/z64animation.h | 2 +- include/z64math.h | 2 +- src/boot/idle.c | 2 +- src/boot/is_debug.c | 15 ++-- src/boot/logutils.c | 6 +- src/boot/stackcheck.c | 2 +- src/boot/z_std_dma.c | 11 +-- src/code/__osMalloc.c | 2 +- src/code/audio_effects.c | 2 +- src/code/audio_playback.c | 22 ++--- src/code/audio_sound_params.c | 30 +++---- src/code/code_800C3C20.c | 2 +- src/code/code_800EC960.c | 40 ++++----- src/code/debug_malloc.c | 2 +- src/code/fault.c | 81 +++++++++++-------- src/code/fault_drawer.c | 26 +++--- src/code/graph.c | 4 +- src/code/main.c | 6 +- src/code/sched.c | 8 +- src/code/sys_cfb.c | 6 +- src/code/z_actor.c | 16 ++-- src/code/z_kaleido_manager.c | 4 +- src/code/z_play.c | 2 +- src/code/z_player_lib.c | 5 +- src/code/z_sram.c | 8 +- src/code/z_vismono.c | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 7 -- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 4 +- .../ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c | 6 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 6 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 6 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 2 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 6 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 6 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 2 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h | 58 ++++++------- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 2 +- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 2 +- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 10 +-- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 2 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 2 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 2 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 7 +- .../actors/ovl_En_Dodojr/z_en_dodojr.c | 3 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 4 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 13 ++- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 4 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.h | 4 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 4 +- .../actors/ovl_En_Heishi1/z_en_heishi1.c | 2 +- .../actors/ovl_En_Heishi3/z_en_heishi3.c | 6 +- .../actors/ovl_En_Hintnuts/z_en_hintnuts.c | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 2 - src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 2 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 18 ++--- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 13 ++- src/overlays/actors/ovl_En_Sda/z_en_sda.c | 4 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 28 +++---- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 6 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 2 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 4 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 12 +-- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 2 +- .../ovl_kaleido_scope/z_kaleido_debug.c | 24 +++--- .../actors/ovl_player_actor/z_player.c | 5 +- .../z_eff_ss_fhg_flash.c | 2 +- 82 files changed, 327 insertions(+), 323 deletions(-) diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml index 63dbdfa040..f9ef4c3d3b 100644 --- a/assets/xml/objects/gameplay_field_keep.xml +++ b/assets/xml/objects/gameplay_field_keep.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml index 7692c41f27..31a8779e99 100644 --- a/assets/xml/objects/object_fu.xml +++ b/assets/xml/objects/object_fu.xml @@ -31,8 +31,8 @@ - - + + diff --git a/include/z64.h b/include/z64.h index 000e591d14..3978c52edb 100644 --- a/include/z64.h +++ b/include/z64.h @@ -67,13 +67,13 @@ typedef struct { } GameInfo; // size = 0x15D4 typedef struct { - /* 0x00000 */ u16 headMagic; // 1234 + /* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC /* 0x00008 */ Gfx polyOpaBuffer[0x17E0]; /* 0x0BF08 */ Gfx polyXluBuffer[0x800]; /* 0x0FF08 */ Gfx overlayBuffer[0x400]; /* 0x11F08 */ Gfx workBuffer[0x80]; /* 0x11308 */ Gfx unusedBuffer[0x20]; - /* 0x12408 */ u16 tailMagic; // 5678 + /* 0x12408 */ u16 tailMagic; // GFXPOOL_TAIL_MAGIC } GfxPool; // size = 0x12410 typedef struct { @@ -1658,15 +1658,15 @@ typedef struct { /* 0x0050 */ s32 viHeight; /* 0x0054 */ s32 viWidth; /* 0x0058 */ s32 unk_58; // Right adjustment? - /* 0x005c */ s32 unk_5C; // Left adjustment? + /* 0x005C */ s32 unk_5C; // Left adjustment? /* 0x0060 */ s32 unk_60; // Bottom adjustment? /* 0x0064 */ s32 unk_64; // Top adjustment? /* 0x0068 */ s32 viModeBase; // enum: {0, 1, 2, 3} - /* 0x006c */ s32 viTvType; + /* 0x006C */ s32 viTvType; /* 0x0070 */ u32 unk_70; // bool /* 0x0074 */ u32 unk_74; // bool /* 0x0078 */ u32 unk_78; // bool - /* 0x007c */ u32 unk_7C; // bool + /* 0x007C */ u32 unk_7C; // bool /* 0x0080 */ u32 viFeatures; /* 0x0084 */ u32 unk_84; } ViMode; diff --git a/include/z64animation.h b/include/z64animation.h index e96eb0afe5..ee705413b3 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -212,7 +212,7 @@ typedef struct { /* 0x0004 */ TransformData* transformData; /* 0x0008 */ s16* copyValues; /* 0x000C */ s16 unk_0C; - /* 0x000E */ s16 unk_10; + /* 0x000E */ s16 unk_0E; } TransformUpdateIndex; // size = 0x10 typedef struct { diff --git a/include/z64math.h b/include/z64math.h index 69776904f6..4ceea2bb63 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -3,7 +3,7 @@ #include "ultra64.h" -#define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z +#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) typedef struct { f32 x, y; diff --git a/src/boot/idle.c b/src/boot/idle.c index 080fdcfb35..d5cbe8d69b 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -51,7 +51,7 @@ void Idle_ThreadEntry(void* arg) { osCreateViManager(OS_PRIORITY_VIMGR); - gViConfigFeatures = 0x42; + gViConfigFeatures = OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON; gViConfigXScale = 1.0f; gViConfigYScale = 1.0f; diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 2b4fb87d86..13ce544b36 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -2,7 +2,7 @@ OSPiHandle* sISVHandle; // official name : is_Handle -#define gISVDbgPrnAdrs ((ISVDbg*)0xb3ff0000) +#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000) #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) void isPrintfInit(void) { @@ -55,8 +55,8 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) { osEPiReadIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, &data); start = data; end = start + count; - if (end >= 0xffe0) { - end -= 0xffe0; + if (end >= 0xFFE0) { + end -= 0xFFE0; if (pos < end || start < pos) { return 1; } @@ -66,15 +66,16 @@ void* is_proutSyncPrintf(void* arg, const char* str, u32 count) { } } while (count) { - u32 addr = (u32)&gISVDbgPrnAdrs->data + (start & 0xffffffc); + u32 addr = (u32)&gISVDbgPrnAdrs->data + (start & 0xFFFFFFC); s32 shift = ((3 - (start & 3)) * 8); + if (*str) { osEPiReadIo(sISVHandle, addr, &data); - osEPiWriteIo(sISVHandle, addr, (*str << shift) | (data & ~(0xff << shift))); + osEPiWriteIo(sISVHandle, addr, (*str << shift) | (data & ~(0xFF << shift))); start++; - if (start >= 0xffe0) { - start -= 0xffe0; + if (start >= 0xFFE0) { + start -= 0xFFE0; } } count--; diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 3daac5a40b..27aafa1df7 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -44,7 +44,7 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) { } i++; - if (i > 0xf) { + if (i > 0xF) { break; } } @@ -54,13 +54,13 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) { while (true) { if (i < rest) { u8 a = *(addr + i); - osSyncPrintf("%c", (a >= 0x20 && a < 0x7f) ? a : '.'); + osSyncPrintf("%c", (a >= 0x20 && a < 0x7F) ? a : '.'); } else { osSyncPrintf(" "); } i++; - if (i > 0xf) { + if (i > 0xF) { break; } } diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index a44adf2540..f11e16b52b 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -99,7 +99,7 @@ StackStatus StackCheck_GetState(StackEntry* entry) { } osSyncPrintf("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free, - entry->name ? entry->name : "(null)"); + entry->name != NULL ? entry->name : "(null)"); osSyncPrintf(VT_RST); if (ret != STACK_STATUS_OK) { diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 2235cf6cce..6a648ed5ce 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -1699,7 +1699,8 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons osSyncPrintf("%c", 7); osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("DMA致命的エラー(%s)\nROM:%X RAM:%X SIZE:%X %s\n", - errorDesc ? errorDesc : (errorName ? errorName : "???"), vrom, ram, size, file ? file : "???"); + errorDesc != NULL ? errorDesc : (errorName != NULL ? errorName : "???"), vrom, ram, size, + file != NULL ? file : "???"); if (req->filename) { osSyncPrintf("DMA ERROR: %s %d", req->filename, req->line); @@ -1714,10 +1715,10 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons } else if (sDmaMgrCurFileName) { sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine); } else { - sprintf(buff1, "DMA ERROR: %s", errorName ? errorName : "???"); + sprintf(buff1, "DMA ERROR: %s", errorName != NULL ? errorName : "???"); } - sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file ? file : "???"); + sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file != NULL ? file : "???"); Fault_AddHungupAndCrashImpl(buff1, buff2); } @@ -1733,7 +1734,7 @@ const char* DmaMgr_GetFileNameImpl(u32 vrom) { iter++; name++; } - //! @bug Since the devs forgot to return in case the file isn't found, the return value will be a pointer to the end + //! @bug Since there is no return, in case the file isn't found, the return value will be a pointer to the end // of gDmaDataTable } @@ -1860,7 +1861,7 @@ void DmaMgr_ThreadEntry(void* arg0) { s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) { static s32 sDmaMgrQueueFullLogged = 0; - if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000U) || + if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) || (size & 1)) { DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です"); } diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c index 113e1444f0..b27392753e 100644 --- a/src/code/__osMalloc.c +++ b/src/code/__osMalloc.c @@ -708,7 +708,7 @@ void __osDisplayArena(Arena* arena) { if (!iter->isFree) { osSyncPrintf(" [%016llu:%2d:%s:%d]", OS_CYCLES_TO_NSEC(iter->time), iter->threadId, - iter->filename ? iter->filename : "**NULL**", iter->line); + iter->filename != NULL ? iter->filename : "**NULL**", iter->line); } osSyncPrintf("\n"); diff --git a/src/code/audio_effects.c b/src/code/audio_effects.c index 73b5c9d1ab..afe2bee38b 100644 --- a/src/code/audio_effects.c +++ b/src/code/audio_effects.c @@ -86,7 +86,7 @@ f32 Audio_GetPortamentoFreqScale(Portamento* p) { f32 result; p->cur += p->speed; - loResCur = (p->cur >> 8) & 0xff; + loResCur = (p->cur >> 8) & 0xFF; if (loResCur >= 127) { loResCur = 127; diff --git a/src/code/audio_playback.c b/src/code/audio_playback.c index 970aaf8f2e..bc4eea75a2 100644 --- a/src/code/audio_playback.c +++ b/src/code/audio_playback.c @@ -32,16 +32,16 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { sub->bitField0.s.usesHeadsetPanEffects = sp24.usesHeadsetPanEffects; if (stereoHeadsetEffects && gAudioContext.soundMode == 1) { smallPanIndex = pan >> 1; - if (smallPanIndex > 0x3f) { - smallPanIndex = 0x3f; + if (smallPanIndex > 0x3F) { + smallPanIndex = 0x3F; } sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex]; - sub->headsetPanRight = gHeadsetPanQuantization[0x3f - smallPanIndex]; + sub->headsetPanRight = gHeadsetPanQuantization[0x3F - smallPanIndex]; sub->bitField1.s.usesHeadsetPanEffects2 = true; volLeft = gHeadsetPanVolume[pan]; - volRight = gHeadsetPanVolume[0x7f - pan]; + volRight = gHeadsetPanVolume[0x7F - pan]; } else if (stereoHeadsetEffects && gAudioContext.soundMode == 0) { strongLeft = strongRight = 0; sub->headsetPanRight = 0; @@ -49,7 +49,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { sub->bitField1.s.usesHeadsetPanEffects2 = false; volLeft = gStereoPanVolume[pan]; - volRight = gStereoPanVolume[0x7f - pan]; + volRight = gStereoPanVolume[0x7F - pan]; if (pan < 0x20) { strongLeft = 1; } else if (pan > 0x60) { @@ -85,7 +85,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { sub->bitField0.s.stereoStrongRight = sp24.strongRight; sub->bitField0.s.stereoStrongLeft = sp24.strongLeft; volLeft = gDefaultPanVolume[pan]; - volRight = gDefaultPanVolume[0x7f - pan]; + volRight = gDefaultPanVolume[0x7F - pan]; } vel = 0.0f > vel ? 0.0f : vel; @@ -169,7 +169,7 @@ void Audio_ProcessNotes(void) { noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i]; playbackState = ¬e->playbackState; if (playbackState->parentLayer != NO_LAYER) { - if ((u32)playbackState->parentLayer < 0x7FFFFFFFU) { + if ((u32)playbackState->parentLayer < 0x7FFFFFFF) { continue; } @@ -349,7 +349,7 @@ Drum* Audio_GetDrum(s32 bankId, s32 drumId) { gAudioContext.audioErrorFlags = ((bankId << 8) + drumId) + 0x4000000; return NULL; } - if ((u32)gAudioContext.ctlEntries[bankId].drums < 0x80000000U) { + if ((u32)gAudioContext.ctlEntries[bankId].drums < 0x80000000) { return NULL; } drum = gAudioContext.ctlEntries[bankId].drums[drumId]; @@ -378,7 +378,7 @@ AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId) { return NULL; } - if ((u32)gAudioContext.ctlEntries[bankId].soundEffects < 0x80000000U) { + if ((u32)gAudioContext.ctlEntries[bankId].soundEffects < 0x80000000) { return NULL; } @@ -570,7 +570,7 @@ void Audio_InitSyntheticWave(Note* note, SequenceChannelLayer* seqLayer) { s32 waveSampleCountIndex; s32 waveId = seqLayer->instOrWave; - if (waveId == 0xff) { + if (waveId == 0xFF) { waveId = seqLayer->seqChannel->instOrWave; } @@ -761,7 +761,7 @@ void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer) { Audio_NoteInit(note); instId = seqLayer->instOrWave; - if (instId == 0xff) { + if (instId == 0xFF) { instId = seqLayer->seqChannel->instOrWave; } sub->sound.audioBankSound = seqLayer->sound; diff --git a/src/code/audio_sound_params.c b/src/code/audio_sound_params.c index a0ce296309..2b90e5b987 100644 --- a/src/code/audio_sound_params.c +++ b/src/code/audio_sound_params.c @@ -109,7 +109,7 @@ SoundParams sPlayerBankParams[] = { { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x80 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2000 }, { 0x30, 0xc00 }, { 0x30, 0x400 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2000 }, { 0x30, 0xC00 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x40 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x80 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 }, { 0x20, 0x0 }, @@ -121,7 +121,7 @@ SoundParams sPlayerBankParams[] = { { 0x40, 0x0 }, { 0x40, 0x0 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, { 0x30, 0x440 }, - { 0x30, 0xc00 }, { 0x30, 0x80 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, + { 0x30, 0xC00 }, { 0x30, 0x80 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x800 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, @@ -137,7 +137,7 @@ SoundParams sItemBankParams[] = { { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x80 }, { 0x30, 0x40 }, { 0x30, 0x400 }, { 0x20, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x60, 0x43 }, - { 0x30, 0x1 }, { 0x30, 0x401 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x2 }, { 0xa0, 0x2 }, + { 0x30, 0x1 }, { 0x30, 0x401 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x2 }, { 0xA0, 0x2 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x60, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x60, 0x81 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x8003 }, { 0x60, 0x8003 }, { 0x60, 0x8003 }, { 0x30, 0x4000 }, { 0x30, 0x4000 }, { 0x30, 0x40 }, { 0x80, 0x3 }, { 0x80, 0x3 }, @@ -148,26 +148,26 @@ SoundParams sItemBankParams[] = { SoundParams sEnvBankParams[] = { { 0x70, 0x640 }, { 0x80, 0x40 }, { 0x30, 0x0 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x40, 0x40 }, - { 0x30, 0x480 }, { 0x38, 0x2 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x80, 0x2 }, { 0xa0, 0x3 }, + { 0x30, 0x480 }, { 0x38, 0x2 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x80, 0x2 }, { 0xA0, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x2 }, { 0x30, 0x40 }, { 0x30, 0x40 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x82 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x38, 0x0 }, { 0x28, 0x0 }, { 0x60, 0x0 }, { 0x70, 0x3 }, - { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x2008 }, { 0x20, 0x2 }, { 0x30, 0x0 }, + { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x2008 }, { 0x20, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x800 }, { 0x30, 0x8800 }, { 0x30, 0x8000 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x80 }, - { 0x60, 0x42 }, { 0x10, 0x0 }, { 0xa0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x10 }, { 0x30, 0x3 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0xa0, 0x3 }, + { 0x60, 0x42 }, { 0x10, 0x0 }, { 0xA0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x10 }, { 0x30, 0x3 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0xA0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x400 }, { 0x30, 0x400 }, { 0x70, 0x13 }, { 0x60, 0x8000 }, { 0x30, 0x8000 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2003 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2010 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0xc2 }, { 0x70, 0x2 }, + { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x40, 0x0 }, { 0x30, 0xC2 }, { 0x70, 0x2 }, { 0x60, 0x2 }, { 0x30, 0x0 }, { 0x60, 0x1 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x90, 0x3 }, { 0x90, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x3800 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x803 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x40, 0x0 }, { 0x1c, 0x0 }, + { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x40, 0x0 }, { 0x1C, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x200 }, { 0x30, 0x800 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, @@ -179,23 +179,23 @@ SoundParams sEnvBankParams[] = { { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x60, 0x3 }, { 0x30, 0x80 }, { 0x30, 0x2000 }, { 0x30, 0x0 }, { 0x30, 0x1 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0xc0 }, { 0x30, 0x2 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0xC0 }, { 0x30, 0x2 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 }, { 0x30, 0x4083 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x80, 0x0 }, { 0x60, 0x0 }, { 0x90, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x60, 0xc3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xa0, 0x800 }, { 0x30, 0x0 }, + { 0x60, 0xC3 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x30, 0x3 }, { 0x30, 0x0 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0xA0, 0x800 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x2 }, { 0x30, 0x0 }, { 0x30, 0x3 }, { 0x20, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, }; SoundParams sSystemBankParams[] = { - { 0xc0, 0x0 }, { 0xc0, 0x0 }, { 0xb0, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x50, 0x0 }, + { 0xC0, 0x0 }, { 0xC0, 0x0 }, { 0xB0, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x50, 0x0 }, { 0x30, 0x20 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x20, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x28, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, - { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x18, 0x0 }, { 0x2c, 0x0 }, { 0x2c, 0x0 }, { 0x20, 0x0 }, + { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x18, 0x0 }, { 0x2C, 0x0 }, { 0x2C, 0x0 }, { 0x20, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x20, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x60, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, { 0x30, 0x0 }, diff --git a/src/code/code_800C3C20.c b/src/code/code_800C3C20.c index 65402c3e2c..72596fbf22 100644 --- a/src/code/code_800C3C20.c +++ b/src/code/code_800C3C20.c @@ -7,7 +7,7 @@ u8 D_8012D200[] = { void func_800C3C20(void) { s32 i; - for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFFu; i++) { + for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFF; i++) { func_800F87A0(D_8012D200[i]); } } diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index d3ab8cda46..92b7020cf3 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -140,42 +140,42 @@ u8 D_80130658[0x70] = { s8 sSpecReverbs[20] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; D_801306DC_s D_801306DC[20] = { - { 0xc0ff, 0xc0fe, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3, + { 0xC0FF, 0XC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3, 0, 2, 4, 1, 2, 5, 16, 3, 2, 10, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, - { 0xc0fb, 0xc0fa, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, + { 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, - { 0xc001, 0x4000, { 0, 2, 0, 0, 3, 0, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, - { 0xc005, 0x4000, { 0, 2, 1, 0, 3, 32, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, - { 0xc01f, - 0xc000, + { 0xC001, 0x4000, { 0, 2, 0, 0, 3, 0, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, + { 0xC005, 0x4000, { 0, 2, 1, 0, 3, 32, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } }, + { 0xC01F, + 0xC000, { 0, 2, 0, 0, 3, 47, 1, 2, 13, 1, 3, 0, 1, 4, 1, 1, 5, 16, 2, 2, 16, 2, 3, 0, 2, 4, 1, 2, 5, 32, 3, 2, 14, 3, 3, 0, 3, 4, 0, 3, 5, 44, 4, 2, 11, 4, 3, 63, 4, 4, 1, 4, 5, 44, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc0fb, 0xc0fa, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } }, { 0x8001, 0x0, { 0, 2, 1, 0, 3, 32, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc001, 0xc000, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 0xFF } }, - { 0xc02f, 0xc02e, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC001, 0xC000, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 0xFF } }, + { 0xC02F, 0xC02E, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 15, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 14, 3, 3, 127, 3, 4, 0, 3, 5, 16, 5, 2, 4, 5, 3, 127, 5, 4, 0, 5, 5, 16, 0xFF } }, - { 0xc07f, 0xc07e, { 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, 32, + { 0xC07F, 0xC07E, { 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 11, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 12, 3, 3, 127, 3, 4, 0, 3, 5, 16, 4, 2, 6, 4, 3, 0, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 0, 5, 4, 0, 5, 5, 16, 6, 2, 1, 6, 3, 0, 6, 4, 0, 6, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc01f, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 0, 1, 3, 80, 1, 4, 1, 1, 5, 8, 2, 2, 10, 2, 3, 80, 2, 4, 1, 2, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC01F, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 0, 1, 3, 80, 1, 4, 1, 1, 5, 8, 2, 2, 10, 2, 3, 80, 2, 4, 1, 2, 5, 48, 3, 2, 6, 3, 3, 0, 3, 4, 0, 3, 5, 0, 4, 2, 11, 4, 3, 96, 4, 4, 0, 4, 5, 32, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, - { 0xc003, 0xc000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, + { 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } }, }; u32 sOcarinaAllowedBtnMask = 0x800F; diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index ac67e507b7..60c7607cb5 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -83,7 +83,7 @@ void* DebugArena_Calloc(u32 num, u32 size) { } void DebugArena_Display(void) { - // "Zelda heap display" (devs forgot to change "Zelda" to "Debug" apparently) + // "Zelda heap display" ("Zelda" should probably have been changed to "Debug") osSyncPrintf("ゼルダヒープ表示\n"); __osDisplayArena(&sDebugArena); } diff --git a/src/code/fault.c b/src/code/fault.c index 91e5175523..aaf9237b28 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -39,6 +39,7 @@ extern FaultThreadStruct gFaultStruct; void Fault_SleepImpl(u32 duration) { u64 value = (duration * OS_CPU_COUNTER) / 1000ull; + Sleep_Cycles(value); } @@ -102,6 +103,7 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) { u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1) { FaultClientContext a; + a.callback = callback; a.param0 = param0; a.param1 = param1; @@ -118,6 +120,7 @@ void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* pa { FaultClient* iter = sFaultStructPtr->clients; + while (iter != NULL) { if (iter == client) { alreadyExists = true; @@ -186,6 +189,7 @@ void Fault_AddAddrConvClient(FaultAddrConvClient* client, void* callback, void* { FaultAddrConvClient* iter = sFaultStructPtr->addrConvClients; + while (iter != NULL) { if (iter == client) { alreadyExists = true; @@ -347,9 +351,9 @@ void Fault_DrawCornerRec(u16 color) { void Fault_PrintFReg(s32 idx, f32* value) { u32 raw = *(u32*)value; - s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f; + s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F; - if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) { + if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) { FaultDrawer_Printf("F%02d:%14.7e ", idx, *value); } else { FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw); @@ -358,9 +362,9 @@ void Fault_PrintFReg(s32 idx, f32* value) { void Fault_LogFReg(s32 idx, f32* value) { u32 raw = *(u32*)value; - s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f; + s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F; - if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) { + if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) { osSyncPrintf("F%02d:%14.7e ", idx, *value); } else { osSyncPrintf("F%02d: %08x(16) ", idx, *(u32*)value); @@ -370,6 +374,7 @@ void Fault_LogFReg(s32 idx, f32* value) { void Fault_PrintFPCR(u32 value) { s32 i; u32 flag = 0x20000; + FaultDrawer_Printf("FPCSR:%08xH ", value); for (i = 0; i < 6; i++) { if (value & flag) { @@ -384,6 +389,7 @@ void Fault_PrintFPCR(u32 value) { void Fault_LogFPCR(u32 value) { s32 i; u32 flag = 0x20000; + osSyncPrintf("FPCSR:%08xH ", value); for (i = 0; i < 6; i++) { if (value & flag) { @@ -396,11 +402,12 @@ void Fault_LogFPCR(u32 value) { void Fault_PrintThreadContext(OSThread* t) { __OSThreadContext* ctx; - s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10; + if (causeStrIdx == 0x17) { causeStrIdx = 0x10; } - if (causeStrIdx == 0x1f) { + if (causeStrIdx == 0x1F) { causeStrIdx = 0x11; } @@ -433,10 +440,10 @@ void Fault_PrintThreadContext(OSThread* t) { Fault_PrintFReg(6, &ctx->fp6.f.f_even); FaultDrawer_Printf("\n"); Fault_PrintFReg(8, &ctx->fp8.f.f_even); - Fault_PrintFReg(0xa, &ctx->fp10.f.f_even); + Fault_PrintFReg(0xA, &ctx->fp10.f.f_even); FaultDrawer_Printf("\n"); - Fault_PrintFReg(0xc, &ctx->fp12.f.f_even); - Fault_PrintFReg(0xe, &ctx->fp14.f.f_even); + Fault_PrintFReg(0xC, &ctx->fp12.f.f_even); + Fault_PrintFReg(0xE, &ctx->fp14.f.f_even); FaultDrawer_Printf("\n"); Fault_PrintFReg(0x10, &ctx->fp16.f.f_even); Fault_PrintFReg(0x12, &ctx->fp18.f.f_even); @@ -445,21 +452,22 @@ void Fault_PrintThreadContext(OSThread* t) { Fault_PrintFReg(0x16, &ctx->fp22.f.f_even); FaultDrawer_Printf("\n"); Fault_PrintFReg(0x18, &ctx->fp24.f.f_even); - Fault_PrintFReg(0x1a, &ctx->fp26.f.f_even); + Fault_PrintFReg(0x1A, &ctx->fp26.f.f_even); FaultDrawer_Printf("\n"); - Fault_PrintFReg(0x1c, &ctx->fp28.f.f_even); - Fault_PrintFReg(0x1e, &ctx->fp30.f.f_even); + Fault_PrintFReg(0x1C, &ctx->fp28.f.f_even); + Fault_PrintFReg(0x1E, &ctx->fp30.f.f_even); FaultDrawer_Printf("\n"); FaultDrawer_SetCharPad(0, 0); } void Fault_LogThreadContext(OSThread* t) { __OSThreadContext* ctx; - s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10; + if (causeStrIdx == 0x17) { causeStrIdx = 0x10; } - if (causeStrIdx == 0x1f) { + if (causeStrIdx == 0x1F) { causeStrIdx = 0x11; } @@ -488,10 +496,10 @@ void Fault_LogThreadContext(OSThread* t) { Fault_LogFReg(6, &ctx->fp6.f.f_even); osSyncPrintf("\n"); Fault_LogFReg(8, &ctx->fp8.f.f_even); - Fault_LogFReg(0xa, &ctx->fp10.f.f_even); + Fault_LogFReg(0xA, &ctx->fp10.f.f_even); osSyncPrintf("\n"); - Fault_LogFReg(0xc, &ctx->fp12.f.f_even); - Fault_LogFReg(0xe, &ctx->fp14.f.f_even); + Fault_LogFReg(0xC, &ctx->fp12.f.f_even); + Fault_LogFReg(0xE, &ctx->fp14.f.f_even); osSyncPrintf("\n"); Fault_LogFReg(0x10, &ctx->fp16.f.f_even); Fault_LogFReg(0x12, &ctx->fp18.f.f_even); @@ -500,17 +508,18 @@ void Fault_LogThreadContext(OSThread* t) { Fault_LogFReg(0x16, &ctx->fp22.f.f_even); osSyncPrintf("\n"); Fault_LogFReg(0x18, &ctx->fp24.f.f_even); - Fault_LogFReg(0x1a, &ctx->fp26.f.f_even); + Fault_LogFReg(0x1A, &ctx->fp26.f.f_even); osSyncPrintf("\n"); - Fault_LogFReg(0x1c, &ctx->fp28.f.f_even); - Fault_LogFReg(0x1e, &ctx->fp30.f.f_even); + Fault_LogFReg(0x1C, &ctx->fp28.f.f_even); + Fault_LogFReg(0x1E, &ctx->fp30.f.f_even); osSyncPrintf("\n"); } OSThread* Fault_FindFaultedThread() { OSThread* iter = __osGetActiveQueue(); + while (iter->priority != -1) { - if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) { + if (iter->priority > 0 && iter->priority < 0x7F && (iter->flags & 3)) { return iter; } iter = iter->tlnext; @@ -520,10 +529,11 @@ OSThread* Fault_FindFaultedThread() { void Fault_Wait5Seconds(void) { OSTime start[2]; // to make the function allocate 0x28 bytes of stack instead of 0x20 + start[0] = osGetTime(); do { Fault_Sleep(0x10); - } while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000) + 1); // 0xdf84759 + } while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000) + 1); sFaultStructPtr->faultActive = true; } @@ -684,8 +694,8 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { if (alignedAddr < (u32*)0x80000000) { alignedAddr = (u32*)0x80000000; } - if (alignedAddr > (u32*)0x807fff00) { - alignedAddr = (u32*)0x807fff00; + if (alignedAddr > (u32*)0x807FFF00) { + alignedAddr = (u32*)0x807FFF00; } alignedAddr = (u32*)((u32)alignedAddr & ~3); @@ -693,7 +703,7 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { Fault_FillScreenBlack(); FaultDrawer_SetCharPad(-2, 0); - FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title ? title : "PrintDump", alignedAddr); + FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title != NULL ? title : "PrintDump", alignedAddr); if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) { for (y = 0x1C; y != 0xE2; y += 9) { FaultDrawer_DrawText(0x18, y, "%06x", writeAddr); @@ -717,8 +727,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) { if (addr < 0x80000000) { addr = 0x80000000; } - if (addr > 0x807fff00) { - addr = 0x807fff00; + if (addr > 0x807FFF00) { + addr = 0x807FFF00; } addr &= ~0xF; @@ -884,7 +894,7 @@ void Fault_ResumeThread(OSThread* t) { t->context.cause = 0; t->context.fpcsr = 0; t->context.pc += 4; - *(u32*)t->context.pc = 0xd; + *(u32*)t->context.pc = 0xD; osWritebackDCache(t->context.pc, 4); osInvalICache(t->context.pc, 4); osStartThread(t); @@ -892,9 +902,10 @@ void Fault_ResumeThread(OSThread* t) { void Fault_CommitFB() { u16* fb; + osViSetYScale(1.0f); osViSetMode(&osViModeNtscLan1); - osViSetSpecialFeatures(0x42); // gama_disable|dither_fliter_enable_aa_mode3_disable + osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); osViBlack(false); if (sFaultStructPtr->fb) { @@ -902,7 +913,7 @@ void Fault_CommitFB() { } else { fb = (u16*)osViGetNextFramebuffer(); if ((u32)fb == 0x80000000) { - fb = (u16*)((osMemSize | 0x80000000) - 0x25800); + fb = (u16*)((osMemSize | 0x80000000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])); } } @@ -972,7 +983,7 @@ void Fault_ThreadEntry(void* arg) { } } while (faultedThread == NULL); - __osSetFpcCsr(__osGetFpcCsr() & -0xf81); + __osSetFpcCsr(__osGetFpcCsr() & -0xF81); sFaultStructPtr->faultedThread = faultedThread; while (!sFaultStructPtr->faultHandlerEnabled) { @@ -1045,11 +1056,11 @@ void Fault_Init(void) { void Fault_HangupFaultClient(const char* arg0, const char* arg1) { osSyncPrintf("HungUp on Thread %d\n", osGetThreadId(0)); - osSyncPrintf("%s\n", arg0 ? arg0 : "(NULL)"); - osSyncPrintf("%s\n", arg1 ? arg1 : "(NULL)"); + osSyncPrintf("%s\n", arg0 != NULL ? arg0 : "(NULL)"); + osSyncPrintf("%s\n", arg1 != NULL ? arg1 : "(NULL)"); FaultDrawer_Printf("HungUp on Thread %d\n", osGetThreadId(0)); - FaultDrawer_Printf("%s\n", arg0 ? arg0 : "(NULL)"); - FaultDrawer_Printf("%s\n", arg1 ? arg1 : "(NULL)"); + FaultDrawer_Printf("%s\n", arg0 != NULL ? arg0 : "(NULL)"); + FaultDrawer_Printf("%s\n", arg1 != NULL ? arg1 : "(NULL)"); } void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1) { diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 036247d8aa..fd0bf02d3d 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -35,18 +35,18 @@ const u32 sFaultDrawerFont[] = { }; FaultDrawer sFaultDrawerDefault = { - (u16*)0x803DA800, // fb - SCREEN_WIDTH, // w - SCREEN_HEIGHT, // h - 16, // yStart - 223, // yEnd - 22, // xStart - 297, // xEnd - GPACK_RGBA5551(255, 255, 255, 255), // foreColor - GPACK_RGBA5551(0, 0, 0, 0), // backColor - 22, // cursorX - 16, // cursorY - sFaultDrawerFont, // font + (u16*)(0x80400000 - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])), // fb + SCREEN_WIDTH, // w + SCREEN_HEIGHT, // h + 16, // yStart + 223, // yEnd + 22, // xStart + 297, // xEnd + GPACK_RGBA5551(255, 255, 255, 255), // foreColor + GPACK_RGBA5551(0, 0, 0, 0), // backColor + 22, // cursorX + 16, // cursorY + sFaultDrawerFont, // font 8, 8, 0, @@ -302,5 +302,5 @@ void FaultDrawer_WritebackFBDCache() { void FaultDrawer_SetDefault() { bcopy(&sFaultDrawerDefault, &sFaultDrawerStruct, sizeof(FaultDrawer)); - sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - 0x25800); + sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH])); } diff --git a/src/code/graph.c b/src/code/graph.c index aa35b5287c..be788f5f5b 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -156,7 +156,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { D_8016A528 = osGetTime() - sGraphSetTaskTime - D_8016A558; - osSetTimer(&timer, 140625000, 0, &gfxCtx->queue, (OSMesg)666); + osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666); osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK); osStopTimer(&timer); @@ -322,7 +322,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1]; if (pool->headMagic != GFXPOOL_HEAD_MAGIC) { - //! @bug (?) : devs might've forgotten "problem = true;" + //! @bug (?) : "problem = true;" may be missing osSyncPrintf("%c", 7); // "Dynamic area head is destroyed" osSyncPrintf(VT_COL(RED, WHITE) "ダイナミック領域先頭が破壊されています\n" VT_RST); diff --git a/src/code/main.c b/src/code/main.c index 932114df52..7afc300816 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -56,7 +56,7 @@ void Main(void* arg) { // "System heap initalization" osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); SystemHeap_Init(sysHeap, gSystemHeapSize); // initializes the system heap - if (osMemSize >= 0x800000U) { + if (osMemSize >= 0x800000) { debugHeap = SysCfb_GetFbEnd(); debugHeapSize = (s32)(0x80600000 - debugHeap); } else { @@ -74,7 +74,7 @@ void Main(void* arg) { Main_LogSystemHeap(); - osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c); + osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3C); StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr"); IrqMgr_Init(&gIrqMgr, &sGraphStackInfo, Z_PRIORITY_IRQMGR, 1); @@ -85,7 +85,7 @@ void Main(void* arg) { IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ); StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio"); - AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xa, &gSchedContext, &gIrqMgr); + AudioMgr_Init(&gAudioMgr, sAudioStack + sizeof(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr); StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr"); PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, &sIrqMgrStack); diff --git a/src/code/sched.c b/src/code/sched.c index c478114f64..ef582449c2 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -46,10 +46,10 @@ void Sched_SwapFrameBuffer(CfbInfo* cfbInfo) { HREG(95) = 0xD; } if (HREG(80) == 0xD && HREG(81) == 2) { - osViSetSpecialFeatures(HREG(82) != 0 ? 1 : 2); - osViSetSpecialFeatures(HREG(83) != 0 ? 0x40 : 0x80); - osViSetSpecialFeatures(HREG(84) != 0 ? 0x4 : 0x8); - osViSetSpecialFeatures(HREG(85) != 0 ? 0x10 : 0x20); + osViSetSpecialFeatures(HREG(82) != 0 ? OS_VI_GAMMA_ON : OS_VI_GAMMA_OFF); + osViSetSpecialFeatures(HREG(83) != 0 ? OS_VI_DITHER_FILTER_ON : OS_VI_DITHER_FILTER_OFF); + osViSetSpecialFeatures(HREG(84) != 0 ? OS_VI_GAMMA_DITHER_ON : OS_VI_GAMMA_DITHER_OFF); + osViSetSpecialFeatures(HREG(85) != 0 ? OS_VI_DIVOT_ON : OS_VI_DIVOT_OFF); } } cfbInfo->unk_10 = 0; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 4e81327eaf..3c65b7aec3 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -7,7 +7,7 @@ void SysCfb_Init(s32 n64dd) { u32 screenSize; u32 tmpFbEnd; - if (osMemSize >= 0x800000U) { + if (osMemSize >= 0x800000) { // "8MB or more memory is installed" osSyncPrintf("8Mバイト以上のメモリが搭載されています\n"); tmpFbEnd = 0x8044BE80; @@ -19,7 +19,7 @@ void SysCfb_Init(s32 n64dd) { osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024)); sSysCfbEnd = tmpFbEnd; } - } else if (osMemSize >= 0x400000U) { + } else if (osMemSize >= 0x400000) { osSyncPrintf("RAM4M mode\n"); sSysCfbEnd = 0x80400000; } else { @@ -27,7 +27,7 @@ void SysCfb_Init(s32 n64dd) { } screenSize = SCREEN_WIDTH * SCREEN_HEIGHT; - sSysCfbEnd &= ~0x3f; + sSysCfbEnd &= ~0x3F; // "The final address used by the system is %08x" osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd); sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 72a46b90b5..9890f0fd33 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2694,7 +2694,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); if ((objBankIndex < 0) || - ((actorInit->category == ACTORCAT_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) { + ((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num))) { // "No data bank!! (profilep->bank=%d)" osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objBankIndex, actorInit->objectId); @@ -4372,7 +4372,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1079; } else { - retTextId = 0x104e; + retTextId = 0x104E; } } break; @@ -4402,7 +4402,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { } } else { if (Flags_GetEventChkInf(0x5C)) { - retTextId = 0x107b; + retTextId = 0x107B; } else { retTextId = 0x1051; } @@ -4462,7 +4462,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { break; case 17: if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { - if (Flags_GetInfTable(0x6c)) { + if (Flags_GetInfTable(0x6C)) { retTextId = 0x7008; } else { retTextId = 0x7007; @@ -4524,7 +4524,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7046; } else { - Flags_GetInfTable(0xc2); + Flags_GetInfTable(0xC2); retTextId = 0x7018; } break; @@ -4547,7 +4547,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7048; } else { - Flags_GetInfTable(0xca); + Flags_GetInfTable(0xCA); retTextId = 0x701D; } break; @@ -4555,7 +4555,7 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7049; } else { - Flags_GetInfTable(0xcc); + Flags_GetInfTable(0xCC); retTextId = 0x701F; } break; @@ -5044,7 +5044,7 @@ void func_80036E50(u16 textId, s16 arg1) { } return; case 34: - if (textId == 0x403c) { + if (textId == 0x403C) { Flags_SetInfTable(0xD6); } return; diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 1e74f49fd9..dc1ba816d9 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -76,7 +76,7 @@ void KaleidoManager_Destroy() { sKaleidoAreaPtr = NULL; } -// NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work +// NOTE: this function looks messed up and probably doesn't work how it was intended to void* KaleidoManager_GetRamAddr(void* vram) { KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl; KaleidoMgrOverlay* ovl = iter; @@ -90,7 +90,7 @@ void* KaleidoManager_GetRamAddr(void* vram) { ovl = iter; goto KaleidoManager_GetRamAddr_end; } - //! @bug Devs probably forgot iter++ here + //! @bug Probably missing iter++ here } osSyncPrintf("異常\n"); // "Abnormal" diff --git a/src/code/z_play.c b/src/code/z_play.c index 6d45532ae4..7933d67f7e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -244,7 +244,7 @@ void Gameplay_Init(GameState* thisx) { gSaveContext.cutsceneIndex = 0; } - if (gSaveContext.nextDayTime != 0xFFFFU) { + if (gSaveContext.nextDayTime != 0xFFFF) { gSaveContext.dayTime = gSaveContext.nextDayTime; gSaveContext.skyboxTime = gSaveContext.nextDayTime; } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 8ce8553506..8c9eec2a08 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -683,10 +683,10 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, if (LINK_IS_ADULT) { s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH); - if (strengthUpgrade >= PLAYER_STR_SILVER_G) { + if (strengthUpgrade >= 2) { // silver or gold gauntlets gDPPipeSync(POLY_OPA_DISP++); - color = &sGauntletColors[strengthUpgrade - PLAYER_STR_SILVER_G]; + color = &sGauntletColors[strengthUpgrade - 2]; gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0); gSPDisplayList(POLY_OPA_DISP++, D_06025218); @@ -697,6 +697,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, if (boots != 0) { Gfx** bootDLists = sBootDListGroups[boots - 1]; + gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]); gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]); } diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 356ffee17e..44287017b2 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -461,7 +461,7 @@ void Sram_WriteSave(SramContext* sramCtx) { j = 0; for (offset = 0; offset < CHECKSUM_SIZE; offset++) { - if (++j == 0x20U) { + if (++j == 0x20) { j = 0; } checksum += *ptr++; @@ -473,7 +473,7 @@ void Sram_WriteSave(SramContext* sramCtx) { checksum = 0; for (offset = 0; offset < CHECKSUM_SIZE; offset++) { - if (++j == 0x20U) { + if (++j == 0x20) { j = 0; } checksum += *ptr++; @@ -486,7 +486,7 @@ void Sram_WriteSave(SramContext* sramCtx) { checksum = 0; for (offset = 0; offset < CHECKSUM_SIZE; offset++) { - if (++j == 0x20U) { + if (++j == 0x20) { j = 0; } checksum += *ptr++; @@ -715,7 +715,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { for (offset = 0; offset < CHECKSUM_SIZE; offset++) { osSyncPrintf("%x ", *ptr); checksum += *ptr++; - if (++j == 0x20u) { + if (++j == 0x20) { osSyncPrintf("\n"); j = 0; } diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 1b34c09440..9de42d9663 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,7 +1,7 @@ #include "global.h" // (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture) -// Did the devs forget to update this? 1+1+1+80*(7+2+2+3)+1+1 makes more sense +// This may not have been kept up-to-date with the code, 1+1+1+80*(7+2+2+3)+1+1 makes more sense #define DLSIZE (1 + 3 + 1 + 1 + 80 * (7 + 2 + 2 + 3) + 1) // framebuffer diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index e001ab6120..ab1a18e732 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -68,13 +68,6 @@ const ActorInit Bg_Dy_Yoseizo_InitVars = { NULL, }; -extern CutsceneData D_02000130; -extern CutsceneData D_02000160; -extern CutsceneData D_02001020; -extern CutsceneData D_020013E0; -extern CutsceneData D_02001F40; -extern CutsceneData D_020025D0; - void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; BgDyYoseizo* this = THIS; diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index 67a5db0d25..fe7d710247 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -193,8 +193,8 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { if (D_8087D958.x > 30.0f) { D_8087D958.x = 30.0f; } - Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 0x8000), 0); - Matrix_RotateAxis(this->counter * (191 * M_PI / 3750), &D_8087D964, 1); + Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 0x8000), MTXMODE_NEW); + Matrix_RotateAxis(this->counter * (191 * M_PI / 3750), &D_8087D964, MTXMODE_APPLY); Matrix_MultVec3f(&D_8087D958, &vec); this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + vec.x; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + vec.y; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 7fa0dd63ec..0ad8d98cd1 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -132,9 +132,9 @@ void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 255); } - Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); + Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 331), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index ca51a07e59..6d26562a50 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -65,9 +65,9 @@ void BgMizuShutter_Init(BgMizuShutter* thisx, GlobalContext* globalCtx) { this->closedPos = this->dyna.actor.world.pos; this->timer = 0; this->timerMax = TIMER_PARAM * 20; - Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 0x8000), 0); - Matrix_RotateX(this->dyna.actor.world.rot.x * (M_PI / 0x8000), 1); - Matrix_RotateZ(this->dyna.actor.world.rot.z * (M_PI / 0x8000), 1); + Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 0x8000), MTXMODE_NEW); + Matrix_RotateX(this->dyna.actor.world.rot.x * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateZ(this->dyna.actor.world.rot.z * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_MultVec3f(&sDisplacements[SIZE_PARAM], &this->openPos); this->openPos.x += this->dyna.actor.world.pos.x; this->openPos.y += this->dyna.actor.world.pos.y; 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 031666567d..81050c6a3f 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 @@ -115,9 +115,9 @@ void BgMoriHineri_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_808A39FC(BgMoriHineri* this, GlobalContext* globalCtx) { CollisionHeader* colHeader; - if ((Object_IsLoaded(&globalCtx->objectCtx, this->moriHineriObjIdx)) && - (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIdx)) && - ((this->boxObjIdx < 0) || (Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx)))) { + if (Object_IsLoaded(&globalCtx->objectCtx, this->moriHineriObjIdx) && + Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIdx) && + ((this->boxObjIdx < 0) || Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx))) { this->dyna.actor.objBankIndex = this->moriHineriObjIdx; if (this->dyna.actor.params >= 4) { this->dyna.actor.params -= 4; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 61ab80954b..eefec054ff 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -69,7 +69,7 @@ static BgSpot18ObjInitFunc D_808B910C[] = { }; static InitChainEntry sInitChain1[] = { - ICHAIN_F32(minVelocityY, 65526, ICHAIN_CONTINUE), ICHAIN_F32(gravity, 65532, ICHAIN_CONTINUE), + ICHAIN_F32(minVelocityY, -10, ICHAIN_CONTINUE), ICHAIN_F32(gravity, -4, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1400, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 6ca2592906..55c5694e26 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1757,7 +1757,7 @@ void BossFd_DrawMane(GlobalContext* globalCtx, BossFd* this, Vec3f* manePos, Vec Matrix_RotateY((maneRot + maneIndex)->y + phi_f20, MTXMODE_APPLY); Matrix_RotateX(-((maneRot + maneIndex)->x + phi_f22), MTXMODE_APPLY); Matrix_Scale(maneScale[maneIndex] * (0.01f - (i * 0.0008f)), maneScale[maneIndex] * (0.01f - (i * 0.0008f)), - 0.01f, 1); + 0.01f, MTXMODE_APPLY); Matrix_RotateX(-M_PI / 2.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_fd.c", 4480), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1869,7 +1869,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { MTXMODE_NEW); Matrix_RotateY(this->bodySegsRot[segIndex].y, MTXMODE_APPLY); Matrix_RotateX(-this->bodySegsRot[segIndex].x, MTXMODE_APPLY); - Matrix_Translate(0.0f, 0.0f, 35.0f, 1); + Matrix_Translate(0.0f, 0.0f, 35.0f, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (i < this->skinSegments) { Matrix_Scale(1.0f + (Math_SinS((this->work[BFD_LEAD_BODY_SEG] * 5000.0f) + (i * 7000.0f)) * @@ -1897,7 +1897,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { if (i >= 14) { f32 sp84 = 1.0f - ((i - 14) * 0.2f); - Matrix_Scale(sp84, sp84, 1.0f, 1); + Matrix_Scale(sp84, sp84, 1.0f, MTXMODE_APPLY); spD4 = 0.1f * sp84; temp_float = 0.1f * sp84; } diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index b7b4df40ce..de03c779ca 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -903,7 +903,7 @@ void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { s32 pad; Vec3f sp28; - Matrix_RotateY(((this->actor.shape.rot.y / (f32)0x8000) * M_PI) + 0.5f, 0); + Matrix_RotateY(((this->actor.shape.rot.y / (f32)0x8000) * M_PI) + 0.5f, MTXMODE_NEW); sp28.x = 0.0f; sp28.y = 0.0f; sp28.z = 1.0f; @@ -1619,7 +1619,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { temp_f12 = this->unk_1B8.z - player->actor.world.pos.z; temp_a0_2 = Math_Atan2S(temp_f12, temp_f14) - player->actor.shape.rot.y; if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) && - (player->swordState != 0) && (player->heldItemActionParam == 3)) { + (player->swordState != 0) && (player->heldItemActionParam == PLAYER_AP_SWORD_MASTER)) { func_80064520(globalCtx, &globalCtx->csCtx); this->unk_39E = Gameplay_CreateSubCamera(globalCtx); Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); @@ -3035,7 +3035,7 @@ void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalC gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, 0); + Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, MTXMODE_NEW); Matrix_Scale(1.65f, 1.0f, 1.65f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 6457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index c9d34c1084..a68a1e5f1e 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -1493,7 +1493,7 @@ void BossGanondrof_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("STOP TIMER = %d ==============\n", this->actor.freezeTimer); horse = (EnfHG*)this->actor.child; if (this->flyMode == GND_FLY_PAINTING) { - Matrix_RotateY((horse->turnRot * 3.1416f) / (f32)0x8000, 1); + Matrix_RotateY((horse->turnRot * 3.1416f) / (f32)0x8000, MTXMODE_APPLY); } osSyncPrintf("YP %f\n", this->actor.world.pos.y); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index d676d447e9..881dbe2223 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -9,45 +9,45 @@ struct BossMo; typedef void (*BossMoActionFunc)(struct BossMo*, GlobalContext*); typedef enum { - /* 0 */ MO_TENT_ACTION_STATE, - /* 1 */ MO_TENT_MOVE_TIMER, - /* 2 */ MO_TENT_VAR_TIMER, - /* 3 */ MO_TENT_UNK_TIMER, - /* 4 */ MO_TENT_INVINC_TIMER, - /* 5 */ MO_TENT_BASE_TEX1_X, - /* 6 */ MO_TENT_BASE_TEX1_Y, - /* 7 */ MO_TENT_BASE_TEX2_X, - /* 8 */ MO_TENT_BASE_TEX2_Y, + /* 0 */ MO_TENT_ACTION_STATE, + /* 1 */ MO_TENT_MOVE_TIMER, + /* 2 */ MO_TENT_VAR_TIMER, + /* 3 */ MO_TENT_UNK_TIMER, + /* 4 */ MO_TENT_INVINC_TIMER, + /* 5 */ MO_TENT_BASE_TEX1_X, + /* 6 */ MO_TENT_BASE_TEX1_Y, + /* 7 */ MO_TENT_BASE_TEX2_X, + /* 8 */ MO_TENT_BASE_TEX2_Y, /* 9 */ MO_TENT_SHORT_MAX } BossMoTentS16Var; typedef enum { - /* 0 */ MO_CORE_ACTION_STATE, - /* 1 */ MO_CORE_MOVE_TIMER, - /* 2 */ MO_CORE_VAR_TIMER, - /* 3 */ MO_CORE_DMG_FLASH_TIMER, - /* 4 */ MO_CORE_INVINC_TIMER, - /* 5 */ MO_CORE_SHORT_5, - /* 6 */ MO_CORE_POS_IN_TENT, - /* 7 */ MO_CORE_DRAW_SHADOW, - /* 8 */ MO_CORE_WAIT_IN_WATER, - /* 9 */ MO_CORE_SHORT_MAX + /* 0 */ MO_CORE_ACTION_STATE, + /* 1 */ MO_CORE_MOVE_TIMER, + /* 2 */ MO_CORE_VAR_TIMER, + /* 3 */ MO_CORE_DMG_FLASH_TIMER, + /* 4 */ MO_CORE_INVINC_TIMER, + /* 5 */ MO_CORE_SHORT_5, + /* 6 */ MO_CORE_POS_IN_TENT, + /* 7 */ MO_CORE_DRAW_SHADOW, + /* 8 */ MO_CORE_WAIT_IN_WATER, + /* 9 */ MO_CORE_SHORT_MAX } BossMoCoreS16Var; typedef enum { - /* 0 */ MO_TENT_SWING_LAG_X, - /* 1 */ MO_TENT_SWING_SIZE_X, - /* 2 */ MO_TENT_SWING_RATE_X, - /* 3 */ MO_TENT_SWING_LAG_Z, - /* 4 */ MO_TENT_SWING_SIZE_Z, - /* 5 */ MO_TENT_SWING_RATE_Z, - /* 6 */ MO_TENT_MAX_STRETCH, - /* 7 */ MO_TENT_FLOAT_MAX + /* 0 */ MO_TENT_SWING_LAG_X, + /* 1 */ MO_TENT_SWING_SIZE_X, + /* 2 */ MO_TENT_SWING_RATE_X, + /* 3 */ MO_TENT_SWING_LAG_Z, + /* 4 */ MO_TENT_SWING_SIZE_Z, + /* 5 */ MO_TENT_SWING_RATE_Z, + /* 6 */ MO_TENT_MAX_STRETCH, + /* 7 */ MO_TENT_FLOAT_MAX } BossMoTentF32Var; typedef enum { - /* 0 */ MO_CORE_INTRO_WATER_ALPHA, - /* 7 */ MO_CORE_FLOAT_MAX + /* 0 */ MO_CORE_INTRO_WATER_ALPHA, + /* 1 */ MO_CORE_FLOAT_MAX } BossMoCoreF32Var; #define MO_SHORT_MAX MAX((s32)MO_TENT_SHORT_MAX, (s32)MO_CORE_SHORT_MAX) diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index df630315c9..24d0b60ed0 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -3951,7 +3951,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { this->actor.world.pos = player2->bodyPartsPos[15]; this->actor.world.pos.y = -2000.0f; - Matrix_MtxFToYXZRotS(&player2->shieldMf, &blastDir, MTXMODE_NEW); + Matrix_MtxFToYXZRotS(&player2->shieldMf, &blastDir, 0); blastDir.x = -blastDir.x; blastDir.y = blastDir.y + 0x8000; Math_ApproachS(&this->magicDir.x, blastDir.x, 0xA, 0x800); diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index ec45bee8a7..23a2ef1183 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -411,7 +411,7 @@ void DemoEc_UpdateWindmillMan(DemoEc* this, GlobalContext* globalCtx) { } void DemoEc_DrawWindmillMan(DemoEc* this, GlobalContext* globalCtx) { - DemoEc_DrawSkeleton(this, globalCtx, &gWindmillManEyeClosedTex, &gWindMillManMouthAngryTex, NULL, NULL); + DemoEc_DrawSkeleton(this, globalCtx, &gWindmillManEyeClosedTex, &gWindmillManMouthAngryTex, NULL, NULL); } void DemoEc_InitKokiriBoy(DemoEc* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 2cd32560ca..2d0df2ed4c 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -663,7 +663,7 @@ void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) { Matrix_Push(); - Matrix_RotateAxis(spC0, &spA8, 1); + Matrix_RotateAxis(spC0, &spA8, MTXMODE_APPLY); Matrix_Translate(sp9C.x, sp9C.y, sp9C.z, MTXMODE_APPLY); Matrix_ToMtx(spB4, "../z_demo_gt_part1.c", 474); unk198 = this->unk_198; @@ -1285,7 +1285,7 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) { Matrix_Push(); - Matrix_RotateAxis(sp70, &sp54, 1); + Matrix_RotateAxis(sp70, &sp54, MTXMODE_APPLY); Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); Matrix_ToMtx(sp60, "../z_demo_gt_part4_1.c", 232); @@ -1404,7 +1404,7 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) { Matrix_Push(); - Matrix_RotateAxis(sp70, &sp54, 1); + Matrix_RotateAxis(sp70, &sp54, MTXMODE_APPLY); Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY); Matrix_ToMtx(sp60, "../z_demo_gt_part4_2.c", 227); @@ -1500,7 +1500,7 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) { Matrix_Push(); - Matrix_RotateAxis(sp74, &sp58, 1); + Matrix_RotateAxis(sp74, &sp58, MTXMODE_APPLY); Matrix_Translate(sp4C.x, sp4C.y, sp4C.z, MTXMODE_APPLY); Matrix_ToMtx(sp64, "../z_demo_gt_part4_3.c", 291); @@ -1683,7 +1683,7 @@ void DemoGt_Draw8(DemoGt* this, GlobalContext* globalCtx) { Matrix_Push(); - Matrix_RotateAxis(sp68, &sp50, 1); + Matrix_RotateAxis(sp68, &sp50, MTXMODE_APPLY); Matrix_Translate(sp44.x, sp44.y, sp44.z, MTXMODE_APPLY); Matrix_ToMtx(sp5C, "../z_demo_gt_part6.c", 153); diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 122b9d8659..fb59c2e298 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -717,7 +717,7 @@ void func_8098652C(DemoIm* this, GlobalContext* globalCtx) { } void func_80986570(DemoIm* this, GlobalContext* globalCtx) { - if ((Animation_OnFrame(&this->skelAnime, 7.0f)) && (this->actor.bgCheckFlags & 1)) { + if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & 1)) { u32 sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 83fca32de9..cb4fae34d6 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -105,7 +105,7 @@ s32 ElfMsg_KillCheck(ElfMsg* this, GlobalContext* globalCtx) { } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && (Flags_GetClear(globalCtx, this->actor.room))) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { LOG_STRING("共倒れ", "../z_elf_msg.c", 172); // "Mutual destruction" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 43c8027951..a04484310c 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -82,7 +82,7 @@ s32 ElfMsg2_KillCheck(ElfMsg2* this, GlobalContext* globalCtx) { } Actor_Kill(&this->actor); return 1; - } else if ((this->actor.world.rot.y == -1) && (Flags_GetClear(globalCtx, this->actor.room))) { + } else if ((this->actor.world.rot.y == -1) && Flags_GetClear(globalCtx, this->actor.room)) { LOG_STRING("共倒れ2", "../z_elf_msg2.c", 182); // "Mutual destruction 2" if (((this->actor.params >> 8) & 0x3F) != 0x3F) { Flags_SetSwitch(globalCtx, ((this->actor.params >> 8) & 0x3F)); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 5517d16a5b..6cc87927e7 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -144,7 +144,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) { u16 textId2; textId2 = Text_GetFaceReaction(globalCtx, 0xA); - textId = textId2 & 0xffff; + textId = textId2 & 0xFFFF; if (!textId) {} diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 4def28e67e..9de7ee88eb 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -54,7 +54,7 @@ static ColliderQuadInit sColliderInit = { }; static InitChainEntry sInitChain[] = { - ICHAIN_F32(minVelocityY, 65386, ICHAIN_STOP), + ICHAIN_F32(minVelocityY, -150, ICHAIN_STOP), }; void EnArrow_SetupAction(EnArrow* this, EnArrowActionFunc actionFunc) { diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index fc06602eb6..f2a2ac5163 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -150,7 +150,7 @@ void func_809C5BA8(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* glob if (!(sp74 < 0.001f)) { EnBomChu_CrossProduct(&this->unk_160, &sp84, &sp78); - Matrix_RotateAxis(sp74, &sp78, 0); + Matrix_RotateAxis(sp74, &sp78, MTXMODE_NEW); Matrix_MultVec3f(&this->unk_16C, &sp78); this->unk_16C = sp78; EnBomChu_CrossProduct(&this->unk_16C, &sp84, &this->unk_154); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 0574c49ddd..e0c3d5ea06 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -271,7 +271,8 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) { EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]); } - if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == 6) && (this->swordDownTimer <= 0) && + if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == PLAYER_AP_STICK) && + (this->swordDownTimer <= 0) && ((Math3D_Dist2DSq(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z) < SQ(120.0f)) || (this->actor.xzDistToPlayer < 60.0f))) { @@ -336,8 +337,8 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { distSqFromHome = Math3D_Dist2DSq(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z); - if (!((player->heldItemActionParam == 6) && (fabsf(player->actor.speedXZ) < 1.8f) && (this->swordDownTimer <= 0) && - (distSqFromHome < SQ(320.0f)))) { + if (!((player->heldItemActionParam == PLAYER_AP_STICK) && (fabsf(player->actor.speedXZ) < 1.8f) && + (this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) { EnButte_SetupFlyAround(this); } else if (distSqFromHome > SQ(240.0f)) { distSqFromSword = Math3D_Dist2DSq(player->swordInfo[0].tip.x, player->swordInfo[0].tip.z, diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index cb15209b7a..c3459331d8 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -626,7 +626,8 @@ s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f }; if (limbIndex == 1) { - Matrix_Scale((this->rootScale * 0.5f) + 1.0f, this->rootScale + 1.0f, (this->rootScale * 0.5f) + 1.0f, 1); + Matrix_Scale((this->rootScale * 0.5f) + 1.0f, this->rootScale + 1.0f, (this->rootScale * 0.5f) + 1.0f, + MTXMODE_APPLY); } if (limbIndex == 4) { diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index ab9ae3f159..4f8525057a 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -465,7 +465,7 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { } else if (this->actor.parent != NULL) { this->actor.parent->world.pos = this->mouthPos; ((EnBombf*)this->actor.parent)->timer++; - //! @bug The devs forgot an explosive could also be a bombchu, which leads to a serious bug. ->timer (0x1F8) is + //! @bug An explosive can also be a bombchu, not always a bomb, which leads to a serious bug. ->timer (0x1F8) is //! outside the bounds of the bombchu actor, and the memory it writes to happens to be one of the pointers in //! the next arena node. When this value is written to, massive memory corruption occurs. } diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index c5a9c86f22..80d81f1ab2 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -88,7 +88,7 @@ u16 func_809FDC38(GlobalContext* globalCtx, Actor* actor) { if (reaction != 0) { return reaction; } - if (CUR_UPG_VALUE(UPG_STRENGTH)) { + if (CUR_UPG_VALUE(UPG_STRENGTH) != 0) { if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x301E; } else { diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index cd9f860bd1..1fd23ed577 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -725,7 +725,7 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 165, 255, 75, 0); } gDPPipeSync(POLY_XLU_DISP++); - Matrix_RotateZ((this->actor.shape.rot.z / (f32)0x8000) * 3.1416f, 1); + Matrix_RotateZ((this->actor.shape.rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1801), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomEnergyBallDL); @@ -745,7 +745,7 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gPhantomWarpDL); } else { osSyncPrintf("FF DRAW 1\n"); - Matrix_Translate(0.0f, -100.0f, 0.0f, 1); + Matrix_Translate(0.0f, -100.0f, 0.0f, MTXMODE_APPLY); func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 30, 0); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 82dc61e61e..7344a449a1 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -506,9 +506,8 @@ void EnFloormas_BigStopWalk(EnFloormas* this, GlobalContext* globalCtx) { void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if ((((Animation_OnFrame(&this->skelAnime, 0.0f)) || (Animation_OnFrame(&this->skelAnime, 12.0f))) || - (Animation_OnFrame(&this->skelAnime, 24.0f))) || - (Animation_OnFrame(&this->skelAnime, 36.0f))) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || + Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK); } @@ -680,7 +679,7 @@ void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); DECR(this->smActionTimer); - if ((Animation_OnFrame(&this->skelAnime, 0.0f)) || (Animation_OnFrame(&this->skelAnime, 18.0f))) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } @@ -699,7 +698,7 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { s32 isAgainstWall; SkelAnime_Update(&this->skelAnime); - if ((Animation_OnFrame(&this->skelAnime, 0.0f)) || (Animation_OnFrame(&this->skelAnime, 18.0f))) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } isAgainstWall = this->actor.bgCheckFlags & 8; @@ -1093,8 +1092,8 @@ void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if (limbIndex == 2) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); - Matrix_RotateY(DEGTORAD(60.0f), 1); - Matrix_RotateZ(DEGTORAD(15.0f), 1); + Matrix_RotateY(DEGTORAD(60.0f), MTXMODE_APPLY); + Matrix_RotateZ(DEGTORAD(15.0f), MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2299), G_MTX_LOAD); gSPDisplayList((*gfx)++, gWallmasterFingerDL); diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index de2a0f62ea..11d262f31b 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -138,8 +138,6 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) { if (textID == 0) { textID = (gSaveContext.eventChkInf[6] & 0x80) ? 0x5033 : 0x5032; - // 0x5032: "Go around!..I'm so happy!..I'm trying to come up with a musical theme inspired by this windmill..." - // 0x5033: "Go around, go around, go around... What? It's going way too fast!" } // if actor flags & 0x100 is set and textID is 0x5033, change animation @@ -299,7 +297,7 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) { static void* sEyesSegments[] = { gWindmillManEyeClosedTex, gWindmillManEyeAngryTex }; - static void* sMouthSegments[] = { gWindMillManMouthOpenTex, gWindMillManMouthAngryTex }; + static void* sMouthSegments[] = { gWindmillManMouthOpenTex, gWindmillManMouthAngryTex }; s32 pad; EnFu* this = THIS; diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index 7ac3d47f3d..20fd2350ad 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -98,7 +98,7 @@ void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("ORGAN DRAW 1\n"); func_80093D18(globalCtx->state.gfxCtx); - if ((thisx->params == 1) && (dorf->organFadeTimer != 0xff)) { + if ((thisx->params == 1) && (dorf->organFadeTimer != 255)) { gSPSegment(POLY_OPA_DISP++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); gSPSegment(POLY_OPA_DISP++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); } else { diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index f42eb5d8b3..7275a93764 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -261,7 +261,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) { switch (thisx->textId) { case 0x300A: if (globalCtx->msgCtx.choiceIndex == 0) { - if (CUR_UPG_VALUE(UPG_STRENGTH) || (gSaveContext.infTable[14] & 0x800)) { + if (CUR_UPG_VALUE(UPG_STRENGTH) != 0 || (gSaveContext.infTable[14] & 0x800)) { thisx->textId = 0x300B; } else { thisx->textId = 0x300C; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index c62d10ec3f..2aef4b1685 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -43,8 +43,8 @@ typedef struct EnGo { /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ struct_80034A14_arg1 unk_1E0; /* 0x0208 */ char unk_208[0x4]; - /* 0x020c */ s16 unk_20C; - /* 0x020e */ s16 unk_20E; + /* 0x020C */ s16 unk_20C; + /* 0x020E */ s16 unk_20E; /* 0x0210 */ s16 unk_210; /* 0x0212 */ s16 unk_212; /* 0x0214 */ s16 unk_214; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index d7eccc3d2b..a66ca80b4a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -358,7 +358,7 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) { // Ask question to DMT Goron by bomb flower if (this->actor.textId == 0x300A) { if (globalCtx->msgCtx.choiceIndex == 0) { - this->actor.textId = CUR_UPG_VALUE(UPG_STRENGTH) ? 0x300B : 0x300C; + this->actor.textId = CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x300B : 0x300C; } else { this->actor.textId = 0x300D; } @@ -456,7 +456,7 @@ u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) { } else if (CHECK_QUEST_ITEM(QUEST_GORON_RUBY)) { return 0x3027; } else { - return CUR_UPG_VALUE(UPG_STRENGTH) + return CUR_UPG_VALUE(UPG_STRENGTH) != 0 ? 0x302C : !Flags_GetSwitch(globalCtx, 0x1B) ? 0x3017 : gSaveContext.infTable[15] & 0x100 ? 0x3019 : 0x3018; } diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 74ae488e37..c1d2a82449 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -426,7 +426,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { searchBallPos.z = this->actor.world.pos.z; Matrix_Push(); - Matrix_RotateY(((this->actor.shape.rot.y + this->headAngle) / 32768.0f) * M_PI, 0); + Matrix_RotateY(((this->actor.shape.rot.y + this->headAngle) / 32768.0f) * M_PI, MTXMODE_NEW); searchBallMult.z = 30.0f; Matrix_MultVec3f(&searchBallMult, &searchBallVel); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 5627963bad..628d0d9944 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -133,7 +133,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) if ((this->actor.xzDistToPlayer < sightRange) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) && (sPlayerCaught == 0)) { sPlayerCaught = 1; - func_8010B680(globalCtx, 0x702D, &this->actor); // "Hey you! Stop! You, kid, over there!" + func_8010B680(globalCtx, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" func_8002DF54(globalCtx, &this->actor, 1); @@ -161,7 +161,7 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) } } sPlayerCaught = 1; - func_8010B680(globalCtx, 0x702D, &this->actor); // "Hey you! Stop! You, kid, over there!" + func_8010B680(globalCtx, 0x702D, &this->actor); func_80078884(NA_SE_SY_FOUND); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST); // "Discovered!" func_8002DF54(globalCtx, &this->actor, 1); @@ -181,7 +181,7 @@ void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) { void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if ((Animation_OnFrame(&this->skelAnime, 1.0f) != 0) || (Animation_OnFrame(&this->skelAnime, 17.0f) != 0)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_KNIGHT_WALK); } if (this->caughtTimer == 0) { diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 8f9791b308..c802237243 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -403,7 +403,7 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (this->animFlagAndTimer != 0) { this->animFlagAndTimer--; } - if ((Animation_OnFrame(&this->skelAnime, 0.0f)) || (Animation_OnFrame(&this->skelAnime, 6.0f))) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK); } if (this->actor.bgCheckFlags & 8) { diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index cf786f1606..30c35e9e87 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -96,7 +96,6 @@ void EnOkarinaTag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80ABF28C; break; case 5: - // "This poem is dedicated to the memory of the dearly departed members of the Royal Family." this->actor.textId = 0x5021; this->actionFunc = func_80ABF708; break; @@ -288,7 +287,6 @@ void func_80ABF708(EnOkarinaTag* this, GlobalContext* globalCtx) { this->unk_15A++; if (!(this->actor.xzDistToPlayer > 120.0f)) { if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { - // "This poem is dedicated to the memory of the dearly departed members of the Royal Family." this->actor.textId = 0x5021; } yawDiffNew = ABS(yawDiff); 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 625d1d0a23..ee4fb5e87d 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -513,7 +513,7 @@ void EnOssan_TalkGoronShopkeeper(GlobalContext* globalCtx) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { if (gSaveContext.eventChkInf[2] & 0x20) { func_8010B720(globalCtx, 0x3028); - } else if (CUR_UPG_VALUE(UPG_STRENGTH)) { + } else if (CUR_UPG_VALUE(UPG_STRENGTH) != 0) { func_8010B720(globalCtx, 0x302D); } else { func_8010B720(globalCtx, 0x300F); diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 92efb1c44a..2ce394e772 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -891,7 +891,7 @@ s32 EnPoField_OverrideLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** d } } if (this->actionFunc == EnPoField_Disappear && limbIndex == 7) { - Matrix_Scale(this->actionTimer / 16.0f, this->actionTimer / 16.0f, this->actionTimer / 16.0f, 1); + Matrix_Scale(this->actionTimer / 16.0f, this->actionTimer / 16.0f, this->actionTimer / 16.0f, MTXMODE_APPLY); } return false; } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 6c3b78608f..f940b3544d 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -274,7 +274,7 @@ void EnRr_SetupGrabPlayer(EnRr* this, Player* player) { u8 EnRr_GetMessage(u8 shield, u8 tunic) { u8 messageIndex = 0; - if ((shield == PLAYER_SHIELD_DEKU) || (shield == PLAYER_SHIELD_HYLIAN)) { + if ((shield == 1 /* Deku shield */) || (shield == 2 /* Hylian shield */)) { messageIndex = RR_MESSAGE_SHIELD; } if ((tunic == 2 /* Goron tunic */) || (tunic == 3 /* Zora tunic */)) { @@ -296,15 +296,15 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { this->segPhaseVelTarget = 2500.0f; this->wobbleSizeTarget = 2048.0f; tunic = 0; - shield = PLAYER_SHIELD_NONE; - if (CUR_EQUIP_VALUE(EQUIP_SHIELD) != PLAYER_SHIELD_MIRROR) { + shield = 0; + if (CUR_EQUIP_VALUE(EQUIP_SHIELD) != 3 /* Mirror shield */) { shield = Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD); - if (shield != PLAYER_SHIELD_NONE) { + if (shield != 0) { this->eatenShield = shield; this->retreat = true; } } - if (CUR_EQUIP_VALUE(EQUIP_TUNIC) != 1 /* Kokiri tunic*/) { + if (CUR_EQUIP_VALUE(EQUIP_TUNIC) != 1 /* Kokiri tunic */) { tunic = Inventory_DeleteEquipment(globalCtx, EQUIP_TUNIC); if (tunic != 0) { this->eatenTunic = tunic; @@ -668,18 +668,18 @@ void EnRr_Death(EnRr* this, GlobalContext* globalCtx) { dropPos.y = this->actor.world.pos.y; dropPos.z = this->actor.world.pos.z; switch (this->eatenShield) { - case PLAYER_SHIELD_DEKU: + case 1: Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_DEKU); break; - case PLAYER_SHIELD_HYLIAN: + case 2: Item_DropCollectible(globalCtx, &dropPos, ITEM00_SHIELD_HYLIAN); break; } switch (this->eatenTunic) { - case PLAYER_TUNIC_GORON + 1: + case 2: Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_GORON); break; - case PLAYER_TUNIC_ZORA + 1: + case 3: Item_DropCollectible(globalCtx, &dropPos, ITEM00_TUNIC_ZORA); break; } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 5a2fa3b77e..1a76577ce0 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -573,9 +573,8 @@ void func_80AEBB3C(EnRu1* this) { void func_80AEBB78(EnRu1* this) { SkelAnime* skelAnime = &this->skelAnime; - if ((((Animation_OnFrame(skelAnime, 4.0f)) || (Animation_OnFrame(skelAnime, 13.0f))) || - (Animation_OnFrame(skelAnime, 22.0f))) || - (Animation_OnFrame(skelAnime, 31.0f))) { + if (Animation_OnFrame(skelAnime, 4.0f) || Animation_OnFrame(skelAnime, 13.0f) || + Animation_OnFrame(skelAnime, 22.0f) || Animation_OnFrame(skelAnime, 31.0f)) { func_80078914(&this->actor.projectedPos, NA_SE_PL_SWIM); } } @@ -832,7 +831,7 @@ void func_80AEC650(EnRu1* this) { s32 pad[2]; if (this->unk_280 == 0) { - if ((Animation_OnFrame(&this->skelAnime, 2.0f)) || (Animation_OnFrame(&this->skelAnime, 7.0f))) { + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_DIRT); } } @@ -1893,9 +1892,9 @@ void func_80AEF3A8(EnRu1* this, GlobalContext* globalCtx) { void func_80AEF40C(EnRu1* this) { SkelAnime* skelAnime = &this->skelAnime; - if ((Animation_OnFrame(skelAnime, 2.0f)) || (Animation_OnFrame(skelAnime, 7.0f)) || - (Animation_OnFrame(skelAnime, 12.0f)) || (Animation_OnFrame(skelAnime, 18.0f)) || - (Animation_OnFrame(skelAnime, 25.0f)) || (Animation_OnFrame(skelAnime, 33.0f))) { + if (Animation_OnFrame(skelAnime, 2.0f) || Animation_OnFrame(skelAnime, 7.0f) || + Animation_OnFrame(skelAnime, 12.0f) || Animation_OnFrame(skelAnime, 18.0f) || + Animation_OnFrame(skelAnime, 25.0f) || Animation_OnFrame(skelAnime, 33.0f)) { func_80078914(&this->actor.projectedPos, NA_SE_PL_WALK_DIRT); } } diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index 717ca6d33b..ef5891aa7f 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -291,7 +291,7 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext *shadowTextureTemp32 = 0; } } - Matrix_RotateX((BREG(50) + 70) / 100.0f, 0); + Matrix_RotateX((BREG(50) + 70) / 100.0f, MTXMODE_NEW); for (i = 0; i < 18; i++) { if (D_80AFA16C[i] >= 0) { D_80AFA660[D_80AFA16C[i]] = player->bodyPartsPos[i]; @@ -321,7 +321,7 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext sp64[i].y = (((KREG(82) / 100.0f) + 4.0f) * sp188.y) + sp16C.y; sp64[i].z = (((KREG(82) / 100.0f) + 4.0f) * sp188.z) + sp16C.z; } - Matrix_RotateX((BREG(50) + 70) / 100.0f, 0); + Matrix_RotateX((BREG(50) + 70) / 100.0f, MTXMODE_NEW); for (i = 0; i < 22; i++) { sp194.x = sp64[i].x - player->actor.world.pos.x; sp194.y = sp64[i].y - player->actor.world.pos.y + KREG(80) + 16.0f; 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 ad04148ce4..b35b9e2791 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -126,13 +126,13 @@ typedef enum { /* 00 */ SKJ_ACTION_FADE, /* 01 */ SKJ_ACTION_WAIT_TO_SHOOT_NEEDLE, /* 02 */ SKJ_ACTION_SARIA_SONG_IDLE, - /* 03 */ SKJ_ACTON_WAIT_FOR_DEATH_ANIM, + /* 03 */ SKJ_ACTION_WAIT_FOR_DEATH_ANIM, /* 04 */ SKJ_ACTION_PICK_NEXT_FIHGT_ACTION, - /* 05 */ SKJ_ACTON_WAIT_FOR_LAND_ANIM, - /* 06 */ SKJ_ACTON_RESET_FIGHT, - /* 07 */ SKJ_ACTON_FIGHT, - /* 08 */ SKJ_ACTON_NEEDLE_RECOVER, - /* 09 */ SKJ_ACTON_SPAWN_DEATH_EFFECT, + /* 05 */ SKJ_ACTION_WAIT_FOR_LAND_ANIM, + /* 06 */ SKJ_ACTION_RESET_FIGHT, + /* 07 */ SKJ_ACTION_FIGHT, + /* 08 */ SKJ_ACTION_NEEDLE_RECOVER, + /* 09 */ SKJ_ACTION_SPAWN_DEATH_EFFECT, /* 10 */ SKJ_ACTION_SARIA_SONG_WAIT_IN_RANGE, /* 11 */ SKJ_ACTION_SARIA_SONG_WAIT_FOR_SONG, /* 12 */ SKJ_ACTION_SARIA_SONG_AFTER_SONG, @@ -307,9 +307,9 @@ void EnSkj_SetupAction(EnSkj* this, u8 action) { switch (action) { case SKJ_ACTION_FADE: - case SKJ_ACTON_WAIT_FOR_DEATH_ANIM: + case SKJ_ACTION_WAIT_FOR_DEATH_ANIM: case SKJ_ACTION_PICK_NEXT_FIHGT_ACTION: - case SKJ_ACTON_SPAWN_DEATH_EFFECT: + case SKJ_ACTION_SPAWN_DEATH_EFFECT: case SKJ_ACTION_SARIA_SONG_START_TRADE: case SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING: case SKJ_ACTION_SARIA_SONG_WAIT_FOR_LANDING_ANIM: @@ -739,7 +739,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_SetupDie(EnSkj* this) { EnSkj_ChangeAnim(this, SKJ_ANIM_DIE); - EnSkj_SetupAction(this, SKJ_ACTON_WAIT_FOR_DEATH_ANIM); + EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_DEATH_ANIM); } void EnSkj_WaitForDeathAnim(EnSkj* this, GlobalContext* globalCtx) { @@ -772,7 +772,7 @@ void func_80AFF2A0(EnSkj* this) { EnSkj_CalculateCenter(this); this->actor.speedXZ = 0.0f; EnSkj_ChangeAnim(this, SKJ_ANIM_LAND); - EnSkj_SetupAction(this, SKJ_ACTON_WAIT_FOR_LAND_ANIM); + EnSkj_SetupAction(this, SKJ_ACTION_WAIT_FOR_LAND_ANIM); } void EnSkj_WaitForLandAnim(EnSkj* this, GlobalContext* globalCtx) { @@ -788,7 +788,7 @@ void func_80AFF334(EnSkj* this) { this->battleExitTimer = 400; this->unk_2EC = 600.0f; EnSkj_ChangeAnim(this, SKJ_ANIM_LOOK_LEFT_RIGHT); - EnSkj_SetupAction(this, SKJ_ACTON_RESET_FIGHT); + EnSkj_SetupAction(this, SKJ_ACTION_RESET_FIGHT); } void EnSkj_ResetFight(EnSkj* this, GlobalContext* globalCtx) { @@ -806,7 +806,7 @@ void EnSkj_SetupStand(EnSkj* this) { this->unk_2F0 = 0.0f; this->unk_2EC = 600.0f; EnSkj_ChangeAnim(this, SKJ_ANIM_FIGHTING_STANCE); - EnSkj_SetupAction(this, SKJ_ACTON_FIGHT); + EnSkj_SetupAction(this, SKJ_ACTION_FIGHT); } void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { @@ -854,7 +854,7 @@ void EnSkj_Fight(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_SetupNeedleRecover(EnSkj* this) { Animation_Reverse(&this->skelAnime); - EnSkj_SetupAction(this, SKJ_ACTON_NEEDLE_RECOVER); + EnSkj_SetupAction(this, SKJ_ACTION_NEEDLE_RECOVER); } void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx) { @@ -865,7 +865,7 @@ void EnSkj_NeedleRecover(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_SetupSpawnDeathEffect(EnSkj* this) { this->backfilpFlag = 1; - EnSkj_SetupAction(this, SKJ_ACTON_SPAWN_DEATH_EFFECT); + EnSkj_SetupAction(this, SKJ_ACTION_SPAWN_DEATH_EFFECT); } void EnSkj_SpawnDeathEffect(EnSkj* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index a0ff1156d6..25a0769d36 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -153,8 +153,8 @@ static DamageTable sDamageTable[] = { static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, 0x45, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE), - ICHAIN_F32(minVelocityY, 65496, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(gravity, 64536, ICHAIN_STOP), + ICHAIN_F32(minVelocityY, -40, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; static AnimationHeader* D_80B1B634[] = { @@ -402,7 +402,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); } } - // if landed, kill XY speed and play appropriate sounds + // if landed, kill XZ speed and play appropriate sounds if (this->actor.params == TEKTITE_BLUE) { if (this->actor.bgCheckFlags & 0x40) { this->actor.speedXZ = 0.0f; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 7cf85f2301..6f244c5e68 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -574,7 +574,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { pad54 = input->prev.button ^ input->cur.button; input->press.button = input->cur.button & pad54; - if (input->cur.button & BTN_R) { + if (CHECK_BTN_ANY(input->cur.button, BTN_R)) { input->cur.button = ((sCounterState == 0) && (this->swordState == 0)) ? BTN_R : input->cur.button ^ BTN_R; } input->rel.button = input->prev.button & pad54; diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index a174813b67..beb4437a39 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -549,7 +549,7 @@ void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, this->beamTexScroll)); Matrix_Translate(this->beamPos1.x, this->beamPos1.y, this->beamPos1.z, MTXMODE_NEW); Matrix_RotateRPY(this->beamRot.x, this->beamRot.y, this->beamRot.z, MTXMODE_APPLY); - Matrix_Scale(this->beamScale.x * 0.1f, this->beamScale.x * 0.1f, this->beamScale.z * 0.0015f, 1); + Matrix_Scale(this->beamScale.x * 0.1f, this->beamScale.x * 0.1f, this->beamScale.z * 0.0015f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vm.c", 1063), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBeamosLaserDL); diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 41b9a9ea15..51eb30d627 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -257,7 +257,7 @@ void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx) { void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterHoverAnim, -5.0f); - this->timer = -0x1e; + this->timer = -0x1E; this->actionFunc = EnWallmas_TakePlayer; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; @@ -351,8 +351,8 @@ void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, (s16)((s32)this->actor.yawTowardsPlayer + 0x8000), 0xB6); - if ((Animation_OnFrame(&this->skelAnime, 0.0f) != 0) || (Animation_OnFrame(&this->skelAnime, 12.0f) != 0) || - (Animation_OnFrame(&this->skelAnime, 24.0f) != 0) || (Animation_OnFrame(&this->skelAnime, 36.0f) != 0)) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || + Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK); } } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 52bc37aa39..dea87be627 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -370,7 +370,7 @@ void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { u32 sfxId; s32 pad2; - if ((Animation_OnFrame(&this->skelAnime, 11.0f)) || (Animation_OnFrame(&this->skelAnime, 23.0f))) { + if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { if (this->actor.bgCheckFlags & 1) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index dc46a05687..4d21be0d78 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -1438,7 +1438,7 @@ void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { u32 sfxId; SkelAnime* skelAnime = &this->skelAnime; - if ((Animation_OnFrame(skelAnime, 6.0f)) || (Animation_OnFrame(skelAnime, 0.0f))) { + if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { if (this->actor.bgCheckFlags & 1) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 596dc4f9b2..2191689dd0 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -1256,10 +1256,10 @@ s32 EnZl4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if (limbIndex == 17) { sp1C = this->unk_1E0.unk_08; - Matrix_Translate(900.0f, 0.0f, 0.0f, 1); + Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateX((sp1C.y / (f32)0x8000) * M_PI, MTXMODE_APPLY); Matrix_RotateZ((sp1C.x / (f32)0x8000) * M_PI, MTXMODE_APPLY); - Matrix_Translate(-900.0f, 0.0f, 0.0f, 1); + Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == 10) { sp1C = this->unk_1E0.unk_0E; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 4b1d60784e..3ed4a636a5 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -211,12 +211,12 @@ void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + (118.0f * this->actor.scale.y), - this->actor.world.pos.z, 0); - Matrix_RotateY(this->actor.shape.rot.y * (M_PI / 0x8000), 1); - Matrix_RotateX(this->actor.shape.rot.x * (M_PI / 0x8000), 1); - Matrix_RotateZ(this->actor.shape.rot.z * (M_PI / 0x8000), 1); - Matrix_Translate(0, -(this->actor.scale.y * 118.0f), 0, 1); - Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); + this->actor.world.pos.z, MTXMODE_NEW); + Matrix_RotateY(this->actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateX(this->actor.shape.rot.x * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateZ(this->actor.shape.rot.z * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_Translate(0, -(this->actor.scale.y * 118.0f), 0, MTXMODE_APPLY); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_comb.c", 394), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index cea3632d77..185fb03470 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -657,7 +657,7 @@ void ObjOshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_oshihiki.c", 1289); if (ObjOshihiki_MoveWithBlockUnder(this, globalCtx)) { - Matrix_Translate(this->underDistX * 10.0f, 0.0f, this->underDistZ * 10.0f, 1); + Matrix_Translate(this->underDistX * 10.0f, 0.0f, this->underDistZ * 10.0f, MTXMODE_APPLY); } this->stateFlags &= ~PUSHBLOCK_MOVE_UNDER; func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 01c9cbe5d0..6c33ac13ed 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -177,7 +177,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (dmgFlags & 0x20820) { interactionType = 1; } - } else if (player->heldItemActionParam == 6) { + } else if (player->heldItemActionParam == PLAYER_AP_STICK) { Math_Vec3f_Diff(&player->swordInfo[0].tip, &this->actor.world.pos, &tipToFlame); tipToFlame.y -= 67.0f; if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) { diff --git a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_debug.c index 352ed0206d..8156fc0737 100644 --- a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_debug.c @@ -319,21 +319,21 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { heldDBtnTimer = 16; } - if (dBtnInput & BTN_DDOWN) { + if (CHECK_BTN_ANY(dBtnInput, BTN_DDOWN)) { if ((u32)++curRow > 10) { curRow = 0; } curSection = sRowFirstSections[curRow]; - } else if (dBtnInput & BTN_DUP) { + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DUP)) { if (--curRow < 0) { curRow = 22; } curSection = sRowFirstSections[curRow]; - } else if (dBtnInput & BTN_DLEFT) { + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DLEFT)) { if (--curSection < 0) { curSection = 0x5C; } - } else if (dBtnInput & BTN_DRIGHT) { + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DRIGHT)) { if (++curSection > 0x5C) { curSection = 0; } @@ -415,17 +415,17 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) { } if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - if (i != gSaveContext.inventory.items[SLOT(gAmmoItems[i])]) { - gSaveContext.inventory.items[SLOT(gAmmoItems[i])] = gAmmoItems[i]; + if (i != INV_CONTENT(gAmmoItems[i])) { + INV_CONTENT(gAmmoItems[i]) = gAmmoItems[i]; } - gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])]++; - if (gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] > 99) { - gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] = 99; + AMMO(gAmmoItems[i])++; + if (AMMO(gAmmoItems[i]) > 99) { + AMMO(gAmmoItems[i]) = 99; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])]--; - if (gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] < 0) { - gSaveContext.inventory.ammo[SLOT(gAmmoItems[i])] = 0; + AMMO(gAmmoItems[i])--; + if (AMMO(gAmmoItems[i]) < 0) { + AMMO(gAmmoItems[i]) = 0; } } } else if (i == SLOT_OCARINA) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index d6b037a267..c72f212bed 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3573,7 +3573,7 @@ void func_8083819C(Player* this, GlobalContext* globalCtx) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1); Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD); - func_8010B680(globalCtx, 0x305F, NULL); // "Your shield is gone!" + func_8010B680(globalCtx, 0x305F, NULL); } } @@ -4120,7 +4120,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { doorActor = this->doorActor; if (this->doorType <= PLAYER_DOORTYPE_AJAR) { - doorActor->textId = 0xD0; // "It won't open!" + doorActor->textId = 0xD0; func_80853148(globalCtx, doorActor); return 0; } @@ -5970,6 +5970,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } } else { s32 strength = Player_GetStrength(); + if ((interactedActor->id == ACTOR_EN_ISHI) && ((interactedActor->params & 0xF) == 1) && (strength < PLAYER_STR_SILVER_G)) { return 0; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 532471a5c2..732cba7187 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -95,7 +95,7 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS OPEN_DISPS(gfxCtx, "../z_eff_fhg_flash.c", 268); - Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, 0); + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSegments[6] = VIRTUAL_TO_PHYSICAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object);