diff --git a/include/audiothread_cmd.h b/include/audiothread_cmd.h index 3ec2cdeba3..ab0ea1c176 100644 --- a/include/audiothread_cmd.h +++ b/include/audiothread_cmd.h @@ -428,7 +428,7 @@ typedef enum { /** * Unmute all sequence players * - * @param restartNotes (s32) if set to 1, then notes with the `MUTE_BEHAVIOR_STOP_SAMPLES` flag set + * @param restartNotes (s32) if set to 1, then notes with the `MUTE_BEHAVIOR_STOP_SAMPLES` flag set * are marked as finished for all seqPlayers */ #define AUDIOCMD_GLOBAL_UNMUTE(restartNotes) \ diff --git a/include/z64animation.h b/include/z64animation.h index 1851defc55..2be8a5a21d 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -88,7 +88,7 @@ typedef enum { /* 1 */ ANIMTAPER_ACCEL } AnimationTapers; -// This flag seems like it was intended to be paired with `ANIM_FLAG_UPDATE_Y` to control +// This flag seems like it was intended to be paired with `ANIM_FLAG_UPDATE_Y` to control // XZ movement based on the current animation. // However, this flag is not checked by the Skelanime system. XZ movement will always occur // regardless of the current state of this flag, as long as the "Actor Move" Anim Task is in use. @@ -102,16 +102,16 @@ typedef enum { #define ANIM_FLAG_UPDATE_Y (1 << 1) // (player-only) Related to scaling an animation from/to child/adult -#define ANIM_FLAG_PLAYER_2 (1 << 2) +#define ANIM_FLAG_PLAYER_2 (1 << 2) // (player-only) Call AnimTaskQueue_AddActorMove -#define ANIM_FLAG_PLAYER_SETMOVE (1 << 3) +#define ANIM_FLAG_PLAYER_SETMOVE (1 << 3) // #define ANIM_FLAG_NO_MOVE (1 << 4) // (player-only) -#define ANIM_FLAG_PLAYER_7 (1 << 7) +#define ANIM_FLAG_PLAYER_7 (1 << 7) typedef struct SkelAnime { /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton diff --git a/include/z64player.h b/include/z64player.h index 6f62392515..979afd744a 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -786,7 +786,7 @@ typedef struct Player { /* 0x0450 */ Vec3f unk_450; /* 0x045C */ Vec3f unk_45C; /* 0x0468 */ char unk_468[0x002]; - /* 0x046A */ union { + /* 0x046A */ union { s16 haltActorsDuringCsAction; // If true, halt actors belonging to certain categories during a `csAction` s16 slidingDoorBgCamIndex; // `BgCamIndex` used during a sliding door cutscene } cv; // "Cutscene Variable": context dependent variable that has different meanings depending on what function is called @@ -848,11 +848,11 @@ typedef struct Player { /* 0x0847 */ s8 controlStickSpinAngles[4]; // Stores a modified version of the control stick angle for the last 4 frames. Used for checking spins. /* 0x084B */ s8 controlStickDirections[4]; // Stores the control stick direction (relative to shape yaw) for the last 4 frames. See `PlayerStickDirection`. - /* 0x084F */ union { + /* 0x084F */ union { s8 actionVar1; } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running - /* 0x0850 */ union { + /* 0x0850 */ union { s16 actionVar2; } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running diff --git a/include/z64transition_instances.h b/include/z64transition_instances.h index c8fd3f16c2..1d08ab34ba 100644 --- a/include/z64transition_instances.h +++ b/include/z64transition_instances.h @@ -88,7 +88,7 @@ typedef struct { /* 0x060 */ Mtx lookAt; /* 0x0A0 */ void* texture; /* 0x0A8 */ Mtx modelView[2][3]; -} TransitionCircle; // size = 0x228; +} TransitionCircle; // size = 0x228 typedef struct { /* 0x000 */ Color_RGBA8_u32 color; @@ -99,6 +99,6 @@ typedef struct { /* 0x018 */ Mtx projection; /* 0x058 */ s32 frame; /* 0x060 */ Mtx modelView[2][3]; -} TransitionTriforce; // size = 0x1E0; +} TransitionTriforce; // size = 0x1E0 #endif diff --git a/src/code/PreRender.c b/src/code/PreRender.c index df71d059ef..e960acfec2 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -659,11 +659,12 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { } } - // The background color is determined by averaging the penultimate minimum and maximum pixels, and subtracting the + // The background color is determined by adding the penultimate minimum and maximum pixels, and subtracting the // ForeGround color: - // BackGround = (pMax + pMin) - (ForeGround) * 2 + // BackGround = (pMax + pMin) - ForeGround // OutputColor = cvg * ForeGround + (1.0 - cvg) * BackGround + // = ForeGround + (1.0 - cvg) * (BackGround - ForeGround) invCvg = 7 - buffCvg[7]; outR = buffR[7] + ((s32)(invCvg * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3); outG = buffG[7] + ((s32)(invCvg * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3); diff --git a/src/code/fault.c b/src/code/fault.c index 7d8e62fef1..16f1a183f7 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -35,7 +35,7 @@ * - End Screen * This page informs you that there are no more pages to display. * - * To navigate the pages, START and A may be used to advance to the next page, and L toggles whether to + * To navigate the pages, DPad-Right or A may be used to advance to the next page, and L toggles whether to * automatically scroll to the next page after some time has passed. * DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen. * DPad-Down disables sending fault pages over osSyncPrintf. @@ -911,6 +911,8 @@ void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_ } while (input->press.button == 0); // Move to next page + //! @bug DPad-Right does not move to the next page, unlike when on any other page + // START moving to the next page is unique to this page. if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->cur.button, BTN_A)) { return; } diff --git a/src/code/graph.c b/src/code/graph.c index 33b523ea2b..92df90d8ff 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -462,6 +462,7 @@ void Graph_ThreadEntry(void* arg0) { if (gameState == NULL) { #if OOT_DEBUG char faultMsg[0x50]; + PRINTF("確保失敗\n"); // "Failure to secure" sprintf(faultMsg, "CLASS SIZE= %d bytes", size); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 391407644d..80d4c210d1 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1785,7 +1785,7 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, // Note: the viewport x and y values are overwritten below, before usage static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0, (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 }; - static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172); + static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, -84); static Vec3f lightDir = { 89.8f, 0.0f, 89.8f }; u8 playerSwordAndShield[2]; Gfx* opaRef; diff --git a/src/code/z_view.c b/src/code/z_view.c index 7ed1247424..850979368d 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -380,6 +380,7 @@ s32 View_ApplyPerspective(View* view) { if (QREG(88) & 2) { s32 i; MtxF mf; + Matrix_MtxToMtxF(view->viewingPtr, &mf); PRINTF("viewing\n"); diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 5b183b9724..acba75f76a 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -310,7 +310,7 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play) { } EffectSsGSplash_Spawn(play, &this->dyna.actor.world.pos, NULL, NULL, 1, 700); - this->collider.elements->dim.worldSphere.radius = 45; + this->collider.elements[0].dim.worldSphere.radius = 45; this->actionFunc = BgSpot06Objects_LockPullOutward; Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 893360582f..289fee6a8a 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -102,6 +102,8 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->scalingFactor = 20.0f; break; default: + //! @bug Actor_Kill should be used, not free. + //! Note this also frees with a function for the wrong memory arena. SYSTEM_ARENA_FREE(this, "../z_eff_dust.c", 202); break; } diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 63875b009c..2c05b09977 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -1248,10 +1248,10 @@ void EnBb_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } this->actor.focus.pos = this->actor.world.pos; - this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; - this->collider.elements->dim.worldSphere.center.y = + this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); - this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; + this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->action > BB_KILL) && ((this->actor.speed != 0.0f) || (this->action == BB_GREEN))) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 23c7bb6db5..54248862c1 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -165,7 +165,7 @@ void EnBigokuta_Init(Actor* thisx, PlayState* play) { Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->element); - this->collider.elements->dim.worldSphere.radius = this->collider.elements->dim.modelSphere.radius; + this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.modelSphere.radius; for (i = 0; i < ARRAY_COUNT(sCylinderInit); i++) { Collider_InitCylinder(play, &this->cylinder[i]); @@ -694,14 +694,14 @@ void func_809BE568(EnBigokuta* this) { f32 sin = Math_SinS(this->actor.shape.rot.y); f32 cos = Math_CosS(this->actor.shape.rot.y); - this->collider.elements->dim.worldSphere.center.x = - (this->collider.elements->dim.modelSphere.center.z * sin) + - (this->actor.world.pos.x + (this->collider.elements->dim.modelSphere.center.x * cos)); - this->collider.elements->dim.worldSphere.center.z = - (this->actor.world.pos.z + (this->collider.elements->dim.modelSphere.center.z * cos)) - - (this->collider.elements->dim.modelSphere.center.x * sin); - this->collider.elements->dim.worldSphere.center.y = - this->collider.elements->dim.modelSphere.center.y + this->actor.world.pos.y; + this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x + + (this->collider.elements[0].dim.modelSphere.center.x * cos) + + (this->collider.elements[0].dim.modelSphere.center.z * sin); + this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z + + (this->collider.elements[0].dim.modelSphere.center.z * cos) - + (this->collider.elements[0].dim.modelSphere.center.x * sin); + this->collider.elements[0].dim.worldSphere.center.y = + this->actor.world.pos.y + this->collider.elements[0].dim.modelSphere.center.y; for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { this->cylinder[i].dim.pos.x = diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 99e9775ea4..58bd6d52e0 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -198,7 +198,7 @@ void EnBrob_Stunned(EnBrob* this, PlayState* play) { } else if (this->skelAnime.curFrame < 8.0f) { this->modelOffsetY -= 1250.0f; } - this->dyna.actor.colorFilterTimer = 0x50; + this->dyna.actor.colorFilterTimer = 80; } void EnBrob_MoveDown(EnBrob* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 0f6569d869..13a545dc1d 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -155,7 +155,7 @@ typedef struct { /* 0x1C */ void (*buyEventFunc)(PlayState*, EnGirlA*); } ShopItemEntry; // size = 0x20 -static ShopItemEntry shopItemEntries[] = { +static ShopItemEntry sShopItemEntries[] = { // SI_DEKU_NUTS_5 { OBJECT_GI_NUTS, GID_DEKU_NUTS, func_8002ED80, 15, 5, 0x00B2, 0x007F, GI_DEKU_NUTS_5_2, EnGirlA_CanBuy_DekuNuts, EnGirlA_ItemGive_DekuNuts, EnGirlA_BuyEvent_ShieldDiscount }, @@ -389,7 +389,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { return; } - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, shopItemEntries[params].objID); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sShopItemEntries[params].objID); if (this->requiredObjectSlot < 0) { Actor_Kill(&this->actor); @@ -895,7 +895,7 @@ void EnGirlA_Noop(EnGirlA* this, PlayState* play) { } void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { - ShopItemEntry* tmp = &shopItemEntries[this->actor.params]; + ShopItemEntry* tmp = &sShopItemEntries[this->actor.params]; s32 params = this->actor.params; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_MASK_OF_TRUTH)) { @@ -954,7 +954,7 @@ void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this) { if (EnGirlA_TryChangeShopItem(this)) { EnGirlA_InitItem(this, play); - itemEntry = &shopItemEntries[this->actor.params]; + itemEntry = &sShopItemEntries[this->actor.params]; this->actor.textId = itemEntry->itemDescTextId; } else { this->isInvisible = false; @@ -979,7 +979,7 @@ s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) { void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; - ShopItemEntry* itemEntry = &shopItemEntries[params]; + ShopItemEntry* itemEntry = &sShopItemEntries[params]; if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_4; diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 373d28ca90..c02946ac22 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -80,7 +80,7 @@ void EnHeishi4_Init(Actor* thisx, PlayState* play) { this->collider.dim.radius = 15; this->collider.dim.height = 70; switch (this->type) { - case HEISHI4_AT_KAKRIKO_ENTRANCE: + case HEISHI4_AT_KAKARIKO_ENTRANCE: case HEISHI4_AT_IMPAS_HOUSE: this->actionFunc = func_80A56328; break; @@ -304,7 +304,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) { } if (MaskReaction_GetTextId(play, sMaskReactionSets[reactionOffset]) != 0) { if (this->unk_2B4 == 0) { - if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { + if ((this->type == HEISHI4_AT_KAKARIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->actionFunc = func_80A563BC; return; } @@ -315,7 +315,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) { } } else { if (this->unk_2B4 != 0) { - if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { + if ((this->type == HEISHI4_AT_KAKARIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->actionFunc = func_80A563BC; return; } @@ -326,7 +326,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) { } } if (Actor_TalkOfferAccepted(&this->actor, play)) { - if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { + if ((this->type == HEISHI4_AT_KAKARIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) { this->unk_284 = 1; this->actionFunc = func_80A563BC; return; diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 2c3677adca..0bc2fc99d4 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -5,7 +5,7 @@ #include "global.h" typedef enum { - /* 0x00 */ HEISHI4_AT_KAKRIKO_ENTRANCE, + /* 0x00 */ HEISHI4_AT_KAKARIKO_ENTRANCE, /* 0x04 */ HEISHI4_AT_IMPAS_HOUSE = 4, /* 0x07 */ HEISHI4_AT_MARKET_DYING = 7, /* 0x08 */ HEISHI4_AT_MARKET_NIGHT diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index a662e02403..b6942de606 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -111,7 +111,7 @@ void EnNwc_ChickFall(EnNwcChick* chick, EnNwc* this, PlayState* play) { void EnNwc_UpdateChicks(EnNwc* this, PlayState* play) { static EnNwcChickFunc chickActionFuncs[] = { EnNwc_ChickNoop, EnNwc_ChickFall }; EnNwcChick* chick = this->chicks; - ColliderJntSphElement* element = this->collider.elements; + ColliderJntSphElement* element = &this->collider.elements[0]; Vec3f prevChickPos; s32 i; f32 test; diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 73282570e3..cf99f6eca4 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -150,7 +150,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; this->timer = 0; this->collider.base.acFlags |= AC_HARD; - this->collider.elements->dim.modelSphere.radius = this->collider.elements->dim.worldSphere.radius = 8; + this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = 8; EnTp_Head_SetupWait(this); this->actor.focus.pos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index 37771a389c..de1bc675fc 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -15,7 +15,7 @@ typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yRot; -} EnfHGPainting; // size = 0x10; +} EnfHGPainting; // size = 0x10 typedef enum { /* 0 */ INTRO_WAIT, diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.h b/src/overlays/actors/ovl_Fishing/z_fishing.h index 40b7f908b1..57a7569fec 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.h +++ b/src/overlays/actors/ovl_Fishing/z_fishing.h @@ -9,7 +9,7 @@ struct Fishing; typedef struct Fishing { /* 0x0000 */ Actor actor; /* 0x014C */ char unk_14C[0x004]; - /* 0x0150 */ u8 isLoach; + /* 0x0150 */ u8 isLoach; /* 0x0151 */ u8 lilyTimer; // if near lily and >0, lily moves. Move more if >20 /* 0x0152 */ u8 unk_152; /* 0x0154 */ s16 unk_154;