# HG changeset patch # User Nomad # Date 1378750141 -7200 # Node ID 43d3536a20f7b712a02174de9f50cff47cf46a17 # Parent 2d9c8f609a3c2de61db0951cf1412277c3535673 OnInventoryItemRightClick diff -r 2d9c8f609a3c -r 43d3536a20f7 Items.h --- a/Items.h Mon Sep 09 17:17:53 2013 +0200 +++ b/Items.h Mon Sep 09 20:09:01 2013 +0200 @@ -61,12 +61,22 @@ ITEM_WAND_FIRE = 135, ITEM_WAND_STUN = 138, ITEM_WAND_INCENERATION = 0x9F, + ITEM_REAGENT_WIDOWSWEEP_BERRIES = 200, ITEM_TROLL_BLOOD = 0xCA, ITEM_DRAGON_EYE = 0xCC, ITEM_HARPY_FEATHER = 0xCF, ITEM_DEVIL_ICHOR = 0xD6, ITEM_OOZE_ECTOPLASM_BOTTLE = 0xD9, - ITEM_POTION_BOTTLE = 0xDC, + ITEM_REAGENT_PHILOSOPHERS_STONE = 219, + ITEM_POTION_BOTTLE = 220, + ITEM_POTION_CATALYST = 221, + ITEM_POTION_RECHARGE_ITEM = 233, + ITEM_POTION_HARDEN_ITEM = 236, + ITEM_POTION_ACCURACY_BOOST = 245, + ITEM_POTION_FLAMING_POTION = 246, + ITEM_POTION_SWIFT_POTION = 250, + ITEM_POTION_SLAYING_POTION = 263, + ITEM_POTION_REJUVENATION = 271, ITEM_SPELLBOOK_TORCHLIGHT = 400,//0x190 ITEM_SPELLBOOK_FIRE_STRIKE = 401,//0x191, ITEM_SPELLBOOK_AIR_FEATHER_FALL = 0x19C, diff -r 2d9c8f609a3c -r 43d3536a20f7 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Mon Sep 09 17:17:53 2013 +0200 +++ b/UI/UIPopup.cpp Mon Sep 09 20:09:01 2013 +0200 @@ -1929,7 +1929,7 @@ { case SCREEN_CASTING: { - identify_item(); + OnInventoryItemRightClick(); break; } @@ -2097,7 +2097,7 @@ { if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) { - identify_item(); + OnInventoryItemRightClick(); } else if ( (signed int)pY >= 345 ) break; @@ -2112,7 +2112,7 @@ else { if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory - identify_item(); + OnInventoryItemRightClick(); } break; } diff -r 2d9c8f609a3c -r 43d3536a20f7 mm7_5.cpp --- a/mm7_5.cpp Mon Sep 09 17:17:53 2013 +0200 +++ b/mm7_5.cpp Mon Sep 09 20:09:01 2013 +0200 @@ -3242,11 +3242,14 @@ } //----- (004356FF) -------------------------------------------------------- -void back_to_game() +void back_to_game() { dword_507BF0_is_there_popup_onscreen = 0; dword_4E455C = 1; - dword_50CDCC = 0; + + extern int no_rightlick_in_inventory; + no_rightlick_in_inventory = false; + if ( pGUIWindow_ScrollWindow ) free_book_subwindow(); if ( !pCurrentScreen && !pGUIWindow_Settings ) @@ -4903,23 +4906,24 @@ } +int no_rightlick_in_inventory = false; // 0050CDCC //----- (00416196) -------------------------------------------------------- -void identify_item() +void OnInventoryItemRightClick() { - Player *v0; // esi@2 - POINT *v1; // edi@2 - signed int v2; // ecx@5 - signed int v3; // eax@5 - int v4; // eax@5 - char v5; // sf@5 - int v6; // eax@5 + //Player *v0; // esi@2 + //POINT *v1; // edi@2 + //signed int v2; // ecx@5 + //signed int v3; // eax@5 + //int v4; // eax@5 + //char v5; // sf@5 + //int v6; // eax@5 int v7; // eax@7 - unsigned __int16 v8; // ax@10 + //unsigned __int16 v8; // ax@10 int v9; // edi@10 int v10; // eax@10 - int v11; // edx@13 - LONG v12; // edx@23 - signed int v13; // edx@23 + //int v11; // edx@13 + //LONG v12; // edx@23 + //signed int v13; // edx@23 int v14; // edx@25 unsigned int v15; // edi@25 signed int v16; // edx@27 @@ -4934,140 +4938,147 @@ int v25; // eax@80 int v26; // eax@84 ItemGen *v27; // esi@98 - unsigned int v28; // eax@98 + //unsigned int v28; // eax@98 ItemGen *v29; // edi@98 unsigned int v30; // ecx@103 double v31; // st7@112 unsigned __int64 v32; // qax@113 - unsigned int v33; // ecx@117 + //unsigned int v33; // ecx@117 int v34; // eax@126 - unsigned int v35; // ecx@127 + //unsigned int v35; // ecx@127 double v36; // st7@132 signed __int64 v37; // qax@135 - unsigned int v38; // eax@138 + //unsigned int v38; // eax@138 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 - int *v40; // [sp-Ch] [bp-9Ch]@83 - int *v41; // [sp-8h] [bp-98h]@83 - int *v42; // [sp-4h] [bp-94h]@83 + //int *v40; // [sp-Ch] [bp-9Ch]@83 + //int *v41; // [sp-8h] [bp-98h]@83 + //int *v42; // [sp-4h] [bp-94h]@83 GUIWindow v43; // [sp+Ch] [bp-84h]@137 - unsigned int pY; // [sp+60h] [bp-30h]@2 + //unsigned int pY; // [sp+60h] [bp-30h]@2 int v45; // [sp+64h] [bp-2Ch]@10 - unsigned int pX; // [sp+68h] [bp-28h]@2 + //unsigned int pX; // [sp+68h] [bp-28h]@2 int v47; // [sp+6Ch] [bp-24h]@25 - POINT y; // [sp+70h] [bp-20h]@2 + //POINT y; // [sp+70h] [bp-20h]@2 POINT a2; // [sp+78h] [bp-18h]@2 - Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 + //Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 unsigned int v51; // [sp+8Ch] [bp-4h]@23 - if ( dword_50CDCC ) + if (no_rightlick_in_inventory) + return; + + if (a2.x <= 13 || a2.x >= 462) return; - v0 = pPlayers[uActiveCharacter]; - v1 = pMouse->GetCursorPos(&a2); - pOut.z = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&y)->y]] & 0xFFFF; - pMouse->GetClickPos(&pX, &pY); - if ( !pOut.z ) + + auto player = pPlayers[uActiveCharacter]; + + pMouse->GetCursorPos(&a2); + int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; + //pMouse->GetClickPos(&pX, &pY); + if (!item_pid) { - if ( (signed int)pX <= 13 - || (signed int)pX >= 462 - || (v2 = pX - 14, - v3 = pY - 17, - pX = v2, - pY = v3, - v4 = 14 * (v3 >> 5), - v2 >>= 5, - v5 = v2 + v4 < 0, - v6 = v2 + v4, - pOut.z = v6, - v5) - || v6 > 126 - || (v7 = v0->GetItemIDAtInventoryIndex(&pOut.z)) == 0 ) + int inventory_mouse_x = a2.x - 14; + int inventory_mouse_y = a2.y - 17; + + int mouse_cell_x = inventory_mouse_x / 32; + int mouse_cell_y = inventory_mouse_y / 32; + + if (mouse_cell_x + mouse_cell_y < 0) + return; + + int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; + if (inventory_idx > 126) return; - pOut.z = v7; + + v7 = player->GetItemIDAtInventoryIndex(&inventory_idx); + if (v7 == 0) + return; + + item_pid = v7; } - if ( !v0->CanAct() ) + + if (!player->CanAct()) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]); v43.Hint = pTmpBuf.data(); v43.uFrameWidth = 384; v43.uFrameHeight = 180; + if (a2.x <= 320 ) + v43.uFrameX = a2.x + 30; + else + v43.uFrameX = a2.x - 414; v43.uFrameY = 40; - if ( pMouse->GetCursorPos(&a2)->x <= 320 ) - v38 = pMouse->GetCursorPos(&a2)->x + 30; - else - v38 = pMouse->GetCursorPos(&a2)->x - 414; - v43.uFrameX = v38; v43.DrawMessageBox(0); return; } - --pOut.z; - LOBYTE(v8) = v0->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); - v9 = v8 & 0x3F; - v45 = v8 & 0x3F; - pOut.y = SkillToMastery(v8); - v10 = pOut.z; + + --item_pid; + int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); + v9 = alchemy_level & 0x3F; + //v45 = alchemy_level & 0x3F; + int alchemy_skill = SkillToMastery(alchemy_level); + v10 = item_pid; if ( pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE ) { LABEL_116: - GameUI_DrawItemInfo(&v0->pInventoryItemList[v10]); + GameUI_DrawItemInfo(&player->pInventoryItemList[v10]); return; } - if ( (signed int)pParty->pPickedItem.uItemID < 200 - || (signed int)pParty->pPickedItem.uItemID > 219 - || (v11 = (int)((char *)v0 + 36 * pOut.z), *(int *)(v11 + 532) != 220) ) + + if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || + pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || + player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) { - if ( (signed int)pParty->pPickedItem.uItemID < 221 - || (signed int)pParty->pPickedItem.uItemID > 271 - || (v12 = (LONG)((char *)v0 + 36 * pOut.z), a2.y = v12, v13 = *(int *)(v12 + 532), v51 = v13, v13 < 221) - || v13 > 271 ) + if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || + pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || + player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || + player->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_REJUVENATION) { - if ( pParty->pPickedItem.uItemID != 236 - && ((signed int)pParty->pPickedItem.uItemID < 246 || (signed int)pParty->pPickedItem.uItemID > 250) - && pParty->pPickedItem.uItemID != 263 - && pParty->pPickedItem.uItemID != 233 ) + if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && + (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && + pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && + pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) goto LABEL_116; - v27 = &v0->pInventoryItemList[pOut.z]; - v28 = v27->uItemID; + + int a2_y; + v27 = &player->pInventoryItemList[item_pid]; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); - if ( pParty->pPickedItem.uItemID != 233 ) + if ( pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM ) { - if ( pParty->pPickedItem.uItemID == 236 ) + if ( pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM ) { - v35 = v27->uAttributes; - if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) + if (v27->IsBroken() || v51 < EQUIP_OFF_HAND || v51 > EQUIP_WAND || v27->uItemID >= ITEM_ARTIFACT_PUCK ) { pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = true; return; } - LOWORD(v35) = v35 | 0x210; - v27->uAttributes = v35; + v27->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_ENCHANTED; } else { - if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) + if (pParty->pPickedItem.uItemID <= ITEM_POTION_ACCURACY_BOOST ) { pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = true; return; } - if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) + if (pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION) { v27->UpdateTempBonus(pParty->uTimePlayed); - v33 = v27->uItemID; - if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 - || (pOut.y = v27->uAttributes, pOut.y & 2) + if ( (signed int)v27->uItemID >= 64 && (signed int)v27->uItemID <= 65 + || (alchemy_skill = v27->uAttributes, alchemy_skill & 2) || v27->uSpecEnchantmentType || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 - || (signed int)v33 >= 500 ) + || (signed int)v27->uItemID >= 500 ) { pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; - a2.y = (int)v29 << 7; + a2_y = (int)v29 << 7; v31 = (double)(signed int)((int)v29 << 7); v27->uSpecEnchantmentType = v34; } @@ -5076,30 +5087,30 @@ if ( pParty->pPickedItem.uItemID != 263 || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) && (signed int)v30 <= 65 - || (pOut.y = v27->uAttributes, pOut.y & 2) + || (alchemy_skill = v27->uAttributes, alchemy_skill & 2) || v27->uSpecEnchantmentType || v27->uEnchantmentType || v51 && v51 != 1 && v51 != 2 || (signed int)v30 >= 500 ) { pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } - a2.y = (int)v29 << 7; + a2_y = (int)v29 << 7; v27->uSpecEnchantmentType = 40; - v31 = (double)a2.y; + v31 = (double)a2_y; } v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); LODWORD(v27->uExpireTime) = v32; - LODWORD(v32) = pOut.y; - LOBYTE(v32) = LOBYTE(pOut.y) | 0x18; + LODWORD(v32) = alchemy_skill; + LOBYTE(v32) = LOBYTE(alchemy_skill) | 0x18; HIDWORD(v27->uExpireTime) = HIDWORD(v32); v27->uAttributes = v32; } _50C9A8_item_enchantment_timer = 256; pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; @@ -5110,29 +5121,29 @@ pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return; } - a2.y = v27->uMaxCharges; - v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); + a2_y = v27->uMaxCharges; + v37 = (signed __int64)((double)a2_y - v36 * (double)a2_y); v27->uMaxCharges = v37; v27->uNumCharges = (unsigned __int8)v37; pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } - v14 = v13 - 222; + v14 = player->pInventoryItemList[item_pid].uItemID - 222; v15 = pParty->pPickedItem.uItemID - 222; v47 = v14; - y.y = 0; - if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) + + if ( pParty->pPickedItem.uItemID == 221 || player->pInventoryItemList[item_pid].uItemID == 221 ) { v16 = 5; } else { v16 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; - v10 = pOut.z; + v10 = item_pid; } v51 = v16; - if ( v45 ) + if ( v9 ) { if ( v16 < 225 || v16 > 227 ) { @@ -5140,7 +5151,7 @@ { if ( v16 < 240 || v16 > 261 ) { - if ( v16 >= 262 && pOut.y != 4 ) + if ( v16 >= 262 && alchemy_level != 4 ) { LABEL_53: v51 = 4; @@ -5149,7 +5160,7 @@ } else { - if ( pOut.y <= 2 ) + if ( alchemy_level <= 2 ) { LABEL_38: v51 = 3; @@ -5159,7 +5170,7 @@ } else { - if ( pOut.y == 1 ) + if ( alchemy_level == 1 ) { LABEL_35: v51 = 2; @@ -5183,57 +5194,54 @@ goto LABEL_53; } LABEL_54: - pOut.y = 0; - pOut.x = v10 + 1; - v17 = (int)v0->pInventoryMatrix; - while ( *(int *)v17 != pOut.x ) + int pOut_y = 0; + int pOut_x = v10 + 1; + v17 = (int)player->pInventoryMatrix; + while ( *(int *)v17 != pOut_x ) { - ++pOut.y; + ++pOut_y; v17 += 4; - if ( pOut.y >= 126 ) + if ( pOut_y >= 126 ) { - v18 = y.y; + v18 = pOut_y; goto LABEL_59; } } - v18 = pOut.y; + v18 = pOut_y; LABEL_59: if ( !v51 ) { LABEL_115: - v10 = pOut.z; + v10 = item_pid; goto LABEL_116; } if ( v51 == 1 ) { - v0->RemoveItemAtInventoryIndex(v18); + player->RemoveItemAtInventoryIndex(v18); v26 = rand(); - v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); + player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - v42 = (int *)&a2.y; - v41 = (int *)&y.y; - v40 = (int *)&pOut; v39.z = pParty->vPosition.z + pParty->sEyelevel; } else { if ( v51 == 2 ) { - v0->RemoveItemAtInventoryIndex(v18); + player->RemoveItemAtInventoryIndex(v18); v25 = rand(); - v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); + player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); v23 = 1; } else { if ( v51 == 3 ) { - v0->RemoveItemAtInventoryIndex(v18); + player->RemoveItemAtInventoryIndex(v18); v24 = rand(); - v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); + player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); v23 = 5; } else @@ -5242,76 +5250,77 @@ { if ( v51 != 5 ) { - v19 = v0->AddItem(-1, 0xDCu); + v19 = player->AddItem(-1, 0xDCu); if ( v19 ) // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; - v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; + player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; v20 = v47 + 50 * v15; - v0->pInventoryItemList[pOut.z].uItemID = v51; - v0->pInventoryItemList[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + v0->pInventoryItemList[pOut.z].uEnchantmentType) + player->pInventoryItemList[item_pid].uItemID = v51; + player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + player->pInventoryItemList[item_pid].uEnchantmentType) / 2; - v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 + player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: - v22 = (int)((char *)v0 + 36 * pOut.z); + v22 = (int)((char *)player + 36 * item_pid); if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) { pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } - v0->PlaySound(SPEECH_16, 0); + player->PlaySound(SPEECH_16, 0); dword_4E455C = 0; pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } - if ( v45 ) + if ( v9 ) { - if ( *(int *)(a2.y + 532) == 221 ) - *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; + if ( *(int *)(player + 36 * item_pid + 532) == 221 ) + *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; else - *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; - v21 = v0->AddItem(-1, 0xDCu); + *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; + v21 = player->AddItem(-1, 0xDCu); if ( v21 ) //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; - v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; + player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; goto LABEL_74; } goto LABEL_115; } - v0->RemoveItemAtInventoryIndex(v18); - v0->SetCondition(0x10u, 0); + player->RemoveItemAtInventoryIndex(v18); + player->SetCondition(0x10u, 0); v23 = 0; } } - v0->ItemsEnchant(v23); + player->ItemsEnchant(v23); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - v42 = (int *)&a2.y; - v41 = (int *)&y.y; - v40 = (int *)&pOut; v39.z = pParty->vPosition.z + pParty->sEyelevel; } - *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); - sub_42F7EB_DropItemAt(0x41Bu, pOut.x, y.y, a2.y, 0, 1, 0, 0, 0); + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); if ( dword_4E455C ) { - if ( v0->CanAct() ) - v0->PlaySound(SPEECH_17, 0); + if ( player->CanAct() ) + player->PlaySound(SPEECH_17, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); dword_4E455C = 0; } pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; return; } - *(int *)(v11 + 536) = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; + + player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; switch ( pParty->pPickedItem.uItemID ) { case 0xC8u: @@ -5319,37 +5328,37 @@ case 0xCAu: case 0xCBu: case 0xCCu: - v0->pInventoryItemList[pOut.z].uItemID = 222; + player->pInventoryItemList[item_pid].uItemID = 222; break; case 0xCDu: case 0xCEu: case 0xCFu: case 0xD0u: case 0xD1u: - v0->pInventoryItemList[pOut.z].uItemID = 223; + player->pInventoryItemList[item_pid].uItemID = 223; break; case 0xD2u: case 0xD3u: case 0xD4u: case 0xD5u: case 0xD6u: - v0->pInventoryItemList[pOut.z].uItemID = 224; + player->pInventoryItemList[item_pid].uItemID = 224; break; case 0xD7u: case 0xD8u: case 0xD9u: case 0xDAu: case 0xDBu: - v0->pInventoryItemList[pOut.z].uItemID = 221; + player->pInventoryItemList[item_pid].uItemID = 221; break; default: break; } pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; + no_rightlick_in_inventory = 1; if ( dword_4E455C ) { - v0->PlaySound(SPEECH_16, 0); + player->PlaySound(SPEECH_16, 0); dword_4E455C = 0; } } @@ -5395,6 +5404,5 @@ } break; } - assert(false); - return 0; + Error("Invalid player class: %u", uPlayerClass); } \ No newline at end of file diff -r 2d9c8f609a3c -r 43d3536a20f7 mm7_6.cpp --- a/mm7_6.cpp Mon Sep 09 17:17:53 2013 +0200 +++ b/mm7_6.cpp Mon Sep 09 20:09:01 2013 +0200 @@ -1792,7 +1792,7 @@ } //----- (0042FC4E) -------------------------------------------------------- -void ProcessInputActions() +void ProcessInputActions() { char v4; // al@9 char v8; // bl@100 @@ -2107,7 +2107,7 @@ pMessageQueue_50CBD0->uNumMessages = 1; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0; ++pMessageQueue_50CBD0->uNumMessages; break; } @@ -2119,10 +2119,7 @@ case INPUT_CharCycle: if ( pCurrentScreen == SCREEN_SPELL_BOOK ) break; - /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40 - dword_50C9EC[3 * dword_50C9E8 + 1] = 0; - dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8;*/ + pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); break; case INPUT_LookUp: @@ -2164,22 +2161,9 @@ } break; case INPUT_ZoomIn: - /*if ( dword_50C9E8 >= 40 ) - break; - dword_50C9EC[3 * dword_50C9E8] = 367; - dword_50C9EC[3 * dword_50C9E8 + 1] = 0; - dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8;*/ pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); break; case INPUT_ZoomOut: - /*if ( dword_50C9E8 < 40 ) - { - dword_50C9EC[3 * dword_50C9E8] = 368; - dword_50C9EC[3 * dword_50C9E8 + 1] = 0; - dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8; - }*/ pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); break; case INPUT_AlwaysRun: diff -r 2d9c8f609a3c -r 43d3536a20f7 mm7_data.cpp --- a/mm7_data.cpp Mon Sep 09 17:17:53 2013 +0200 +++ b/mm7_data.cpp Mon Sep 09 20:09:01 2013 +0200 @@ -1006,7 +1006,6 @@ //int dword_50C9E8; // idb //int dword_50C9EC[120]; // weak int dword_50CDC8; -int dword_50CDCC; // weak int bProcessorIsNotIntel; // weak Vec3_int_ layingitem_vel_50FDFC; char pStartingMapName[32]; // idb diff -r 2d9c8f609a3c -r 43d3536a20f7 mm7_data.h --- a/mm7_data.h Mon Sep 09 17:17:53 2013 +0200 +++ b/mm7_data.h Mon Sep 09 20:09:01 2013 +0200 @@ -654,7 +654,6 @@ //extern int dword_50C9E8; // idb //extern int dword_50C9EC[]; // 50C9EC extern int dword_50CDC8; -extern int dword_50CDCC; // weak extern int bProcessorIsNotIntel; // weak extern Vec3_int_ layingitem_vel_50FDFC; extern char pStartingMapName[32]; // idb @@ -1094,7 +1093,7 @@ void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); -void identify_item(); +void OnInventoryItemRightClick(); void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); void UI_OnMouseLeftClick(int *pXY); // idb unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos);