Skip to content

Conversation

@Echopixel
Copy link

Fixes #2464 - Adding a check to also lookup the model inside the chest if CUSTOM_KEY_MODELS is true seems to be all this needed. I tested the case where they're not shuffled with unique key models enabled and it looks correct now.
image

…e keys seen by the LoT are incorrectly rendered as generic small keys. [OoTRandomizer#2464]
@fenhl fenhl added Type: Enhancement New feature or request Component: ASM/C Changes some internals of the ASM/C libraries Status: Needs Review Someone should be looking at it Status: Needs Testing Probably should be tested Status: Under Consideration Developers are considering whether to accept or decline the feature described labels Sep 25, 2025
@fenhl
Copy link
Collaborator

fenhl commented Sep 25, 2025

One more thing to test: How does it behave when opening the rupee chest?

@Echopixel
Copy link
Author

One more thing to test: How does it behave when opening the rupee chest?

Nice catch, yeah, it's still not quite right. Instead of the model it renders a basic key sprite when you grab the loser chest
image

Will investigate more for that unless anyone already knows what handles that rendering

@fenhl fenhl added Status: Help Wanted Extra attention is needed Status: Waiting for Author Changes or response requested labels Sep 25, 2025
@Echopixel
Copy link
Author

Echopixel commented Sep 26, 2025

So I poked at it a little more knowing I'd probably get stuck, but looking through the decomp I think this function in z_en_ex_item.c where it checks if EXITEM_SMALL_KEY_CHEST and if so calls EnExItem_DrawKey(this, play, 0); is where this last render is happening.

Also seems like the chest game in en_changer is the only place that uses that ex item type to determine to do this specific texture draw, so maybe if we can replace that with a draw_model call if it's EXITEM_SMALL_KEY_CHEST && CUSTOM_KEY_MODELS might work or override the EnExItem_DrawKey function and call that if it's chest game chest key chest and custom key models is enabled. Granted, I don't know how to do any of that yet since I'm trying to learn, so probably need a SME to assist assuming this is even the right direction to go.

void EnExItem_Draw(Actor* thisx, PlayState* play) {
    s32 pad;
    EnExItem* this = (EnExItem*)thisx;
    s32 magicType;

    Actor_SetScale(&this->actor, this->scale);
    switch (this->type) {
        case EXITEM_BOMB_BAG_BOWLING:
        case EXITEM_BOMBCHUS_BOWLING:
        case EXITEM_BOMBS_BOWLING:
        case EXITEM_BOMB_BAG_COUNTER:
        case EXITEM_BOMBCHUS_COUNTER:
        case EXITEM_BOMBS_COUNTER:
        case EXITEM_BULLET_BAG:
            EnExItem_DrawItems(this, play);
            break;
        case EXITEM_HEART_PIECE_BOWLING:
        case EXITEM_HEART_PIECE_COUNTER:
            EnExItem_DrawHeartPiece(this, play);
            break;
        case EXITEM_PURPLE_RUPEE_BOWLING:
        case EXITEM_PURPLE_RUPEE_COUNTER:
        case EXITEM_GREEN_RUPEE_CHEST:
        case EXITEM_BLUE_RUPEE_CHEST:
        case EXITEM_RED_RUPEE_CHEST:
        case EXITEM_13:
        case EXITEM_14:
            EnExItem_DrawRupee(this, play);
            break;
        case EXITEM_SMALL_KEY_CHEST:
            EnExItem_DrawKey(this, play, 0);
            break;
        case EXITEM_MAGIC_FIRE:
        case EXITEM_MAGIC_WIND:
        case EXITEM_MAGIC_DARK:
            magicType = this->type - EXITEM_MAGIC_FIRE;
            EnExItem_DrawMagic(this, play, magicType);
            break;
    }
}

void EnExItem_DrawKey(EnExItem* this, PlayState* play, s32 index) {
    static void* keySegments[] = { gDropKeySmallTex };

    OPEN_DISPS(play->state.gfxCtx, "../z_en_ex_item.c", 880);

    Gfx_SetupDL_41Opa(play->state.gfxCtx);
    MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_ex_item.c", 887);
    gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(keySegments[index]));
    gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);

    CLOSE_DISPS(play->state.gfxCtx, "../z_en_ex_item.c", 893);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: ASM/C Changes some internals of the ASM/C libraries Status: Help Wanted Extra attention is needed Status: Needs Review Someone should be looking at it Status: Needs Testing Probably should be tested Status: Under Consideration Developers are considering whether to accept or decline the feature described Status: Waiting for Author Changes or response requested Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Treasure Box Shop Key Model

2 participants