diff --git a/include/d/d_menu_ring.h b/include/d/d_menu_ring.h index 74624eac80..953b19ba1a 100644 --- a/include/d/d_menu_ring.h +++ b/include/d/d_menu_ring.h @@ -74,6 +74,9 @@ public: void clacEllipsePlotAverage(int, f32, f32); bool dpdMove(); u8 openExplain(u8); +#if TARGET_PC + void updateSlotImage(u8 slot); +#endif virtual void draw() { _draw(); } virtual ~dMenu_Ring_c(); diff --git a/src/d/d_menu_ring.cpp b/src/d/d_menu_ring.cpp index 05dc71bd5f..9d472df52f 100644 --- a/src/d/d_menu_ring.cpp +++ b/src/d/d_menu_ring.cpp @@ -28,6 +28,9 @@ #include #include +#if TARGET_PC +#include "dusk/randomizer/game/tools.h" +#endif #if TARGET_PC #include "dusk/game_clock.h" @@ -1248,6 +1251,12 @@ void dMenu_Ring_c::setActiveCursor() { // If the player is a wolf or somehow manages to access an item slot with no item, error Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); } +#if TARGET_PC + else if (randomizer_IsActive() && mItemSlots[mCurrentSlot] == 0x15 && mDoCPd_c::getTrigRight(PAD_1)) { + setNextWarashibeItem(); + updateSlotImage(0x15); + } +#endif } } @@ -2199,3 +2208,33 @@ u8 dMenu_Ring_c::openExplain(u8 param_0) { static const u32 i_expID[2] = {0x4DF, 0x4E1}; return mpItemExplain->openExplainTx(i_nameID[idx], i_expID[idx]); } + +#if TARGET_PC +void dMenu_Ring_c::updateSlotImage(u8 slot) { + for (int i = 0; i < mTotalItemTexToAlloc; i++) { + if (mItemSlots[i] == slot) { + u8 item = dComIfGs_getItem(mItemSlots[i], false); + + s32 i_textureNum = + dMeter2Info_readItemTexture(item, mpItemBuf[i][0], NULL, mpItemBuf[i][1], NULL, + mpItemBuf[i][2], NULL, NULL, NULL, -1); + for (int k = 0; k < i_textureNum; k++) { + // Delete old texture so we aren't leaking memory + if (mpItemTex[i][k] != NULL) { + JKR_DELETE(mpItemTex[i][k]); + } + + mpItemTex[i][k] = JKR_NEW J2DPicture(mpItemBuf[i][k]); + mpItemTex[i][k]->setBasePosition(J2DBasePosition_4); + } + dMeter2Info_setItemColor(item, mpItemTex[i][0], mpItemTex[i][1], mpItemTex[i][2], NULL); + u8 texScale = dItem_data::getTexScale(item); + f32 fVar1 = (texScale / 100.0f); + f32 fVar2 = (mpItemBuf[i][0]->width / 48.0f); + fVar1 = fVar2 * fVar1; + mItemSlotParam1[i] = fVar1; + mItemSlotParam2[i] = (mpItemBuf[i][0]->height / 48.0f * (texScale / 100.0f)); + } + } +} +#endif \ No newline at end of file