From d5074c3e77f6a374c3623d08f71bbaa1c772ed6c Mon Sep 17 00:00:00 2001 From: aMannus Date: Wed, 24 Aug 2022 22:18:24 +0200 Subject: [PATCH] Fixes double def and split second wrong colors --- soh/src/code/z_player_lib.c | 3 ++- soh/src/overlays/actors/ovl_player_actor/z_player.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 203585331..cfc1dc6f4 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1170,7 +1170,8 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - if (this->getItemEntry.drawFunc != NULL && CVar_GetS32("gRandoMatchKeyColors", 0)) { + if (this->getItemEntry.drawFunc != NULL && + (CVar_GetS32("gRandoMatchKeyColors", 0) || this->getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) { this->getItemEntry.drawFunc(globalCtx, &this->getItemEntry); } else { GetItem_Draw(globalCtx, drawIdPlusOne - 1); diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index cb23a1b89..a3ad987be 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -12667,6 +12667,14 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { this->stateFlags1 &= ~PLAYER_STATE1_29; func_80852FFC(globalCtx, NULL, 8); } + + // Set unk_862 to 0 early to not have the game draw non-custom colored models for a split second. + // This unk is what the game normally uses to decide what item to draw when holding up an item above Link's head. + // Only do this when the item actually has a custom draw function. + if (this->getItemEntry.drawFunc != NULL) { + this->unk_862 = 0; + } + this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; }