Mercurial > mm7
changeset 1729:f44b6e02e81c
pop-up window in character(paperdill) window, alchemy
author | Ritor1 |
---|---|
date | Wed, 25 Sep 2013 17:29:14 +0600 |
parents | 7b6b4ce8da76 |
children | 79b9306f573a |
files | Player.h UI/UIPopup.cpp UI/UIShops.cpp mm7_5.cpp mm7_6.cpp mm7_data.h |
diffstat | 6 files changed, 586 insertions(+), 629 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.h Wed Sep 25 12:54:34 2013 +0600 +++ b/Player.h Wed Sep 25 17:29:14 2013 +0600 @@ -55,7 +55,7 @@ SPEECH_12 = 12, SPEECH_14 = 14, SPEECH_NoRoom = 15, // when placing to inventory - SPEECH_16 = 16, + SPEECH_DO_POTION_FINE = 16, SPEECH_17 = 17, SPEECH_18 = 18, SPEECH_19 = 19,
--- a/UI/UIPopup.cpp Wed Sep 25 12:54:34 2013 +0600 +++ b/UI/UIPopup.cpp Wed Sep 25 17:29:14 2013 +0600 @@ -24,6 +24,7 @@ #include "..\texts.h" #include "..\mm7_data.h" +#include "..\Events.h" static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually @@ -1285,36 +1286,14 @@ //----- (00416D62) -------------------------------------------------------- void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this) { - signed int pPlayerNum; // eax@12 - //char *v2; // eax@32 - //void *v3; // ecx@52 - unsigned int v4; // eax@59 - int v5; // esi@62 - //signed int v6; // esi@64 - //signed int v7; // esi@69 - unsigned int v10; // eax@76 - //char v11; // zf@83 - GUIButton *pButton; // esi@84 - unsigned int v13; // ecx@85 - char *pStr; // edi@85 - //signed int pControlID; // eax@92 - int v16; // eax@95 - int v17; // eax@96 - PLAYER_SKILL_TYPE v18; // eax@98 - char *pStr2; // eax@99 - unsigned int v20; // eax@108 - unsigned int pSkillId; // eax@109 - const char *pSkillInfo; // eax@111 - //char *v23; // ebx@112 - char *pHint; // edx@113 - unsigned int pColor; // eax@113 - GUIWindow pWindow; // [sp+4h] [bp-74h]@32 - //double v27; // [sp+58h] [bp-20h]@33 - struct tagPOINT Point; // [sp+60h] [bp-18h]@6 - //char *v29; // [sp+68h] [bp-10h]@33 - //float v30; // [sp+6Ch] [bp-Ch]@33 - unsigned int pX; // [sp+70h] [bp-8h]@3 - unsigned int pY; // [sp+74h] [bp-4h]@3 + int v5; // esi@62 + GUIButton *pButton; // esi@84 + char *pStr; // edi@85 + char *pHint; // edx@113 + GUIWindow popup_window; // [sp+4h] [bp-74h]@32 + struct tagPOINT Point; // [sp+60h] [bp-18h]@6 + unsigned int pX; // [sp+70h] [bp-8h]@3 + unsigned int pY; // [sp+74h] [bp-4h]@3 if ( pCurrentScreen == SCREEN_VIDEO ) return; @@ -1355,7 +1334,7 @@ { case SCREEN_CASTING: { - OnInventoryItemRightClick(); + Inventory_ItemPopupAndAlchemy(); break; } case SCREEN_CHEST: @@ -1363,24 +1342,20 @@ if ( !pPlayers[uActiveCharacter]->CanAct() ) { sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы - pWindow.Hint = pTmpBuf.data(); - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 180; - pWindow.uFrameY = 40; + popup_window.Hint = pTmpBuf.data(); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 180; + popup_window.uFrameY = 40; if ( (signed int)pX <= 320 ) - v10 = pX + 30; + popup_window.uFrameX = pX + 30; else - v10 = pX - 414; - pWindow.uFrameX = v10; - pWindow.DrawMessageBox(0); + popup_window.uFrameX = pX - 414; + popup_window.DrawMessageBox(0); } else { if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) - { - v10 = pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF)-1]; - GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[v10 - 1]); - } + GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); } break; } @@ -1390,16 +1365,16 @@ break; if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) { - pWindow.ptr_1C = (void *)((signed int)pX / 118); + popup_window.ptr_1C = (void *)((signed int)pX / 118); if ( (signed int)pX / 118 < 4 )//portaits zone { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; pAudioPlayer->StopChannels(-1, -1); - GameUI_CharacterQuickRecord_Draw(&pWindow, pPlayers[(int)pWindow.ptr_1C + 1]); + GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); } } else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) @@ -1408,13 +1383,13 @@ { if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; pAudioPlayer->StopChannels(-1, -1); - pWindow._41D73D_draw_buff_tooltip(); + popup_window._41D73D_draw_buff_tooltip(); } else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone { @@ -1432,25 +1407,24 @@ } else//minimap zone { - pWindow.Hint = (char *)GameUI_GetMinimapHintText(); - pWindow.uFrameWidth = 256; - pWindow.uFrameX = 130; - pWindow.uFrameY = 140; - pWindow.uFrameHeight = 64; + popup_window.Hint = (char *)GameUI_GetMinimapHintText(); + popup_window.uFrameWidth = 256; + popup_window.uFrameX = 130; + popup_window.uFrameY = 140; + popup_window.uFrameHeight = 64; pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); + popup_window.DrawMessageBox(0); } } else//game zone { - pWindow.Hint = 0; - pWindow.uFrameWidth = 320; - pWindow.uFrameHeight = 320; - v4 = pX - 350; + popup_window.Hint = 0; + popup_window.uFrameWidth = 320; + popup_window.uFrameHeight = 320; + popup_window.uFrameX = pX - 350; if ( (signed int)pX <= 320 ) - v4 = pX + 30; - pWindow.uFrameX = v4; - pWindow.uFrameY = 40; + popup_window.uFrameX = pX + 30; + popup_window.uFrameY = 40; if ( pRenderer->pRenderD3D ) LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); else @@ -1459,14 +1433,14 @@ { if ( pRenderer->uNumSceneBegins ) { - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &pWindow); + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); } else { pRenderer->BeginScene(); - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &pWindow); + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); pRenderer->EndScene(); } } @@ -1485,14 +1459,14 @@ if ( !dword_506364 || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y - || ((pWindow.Hint = (char *)GetMapBookHintText()) == 0) ) + || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) break; - pWindow.uFrameWidth = (pFontArrus->GetLineWidth(pWindow.Hint) + 32) + 0.5f; - pWindow.uFrameX = pX + 5; - pWindow.uFrameY = pY + 5; - pWindow.uFrameHeight = 64; + popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; + popup_window.uFrameX = pX + 5; + popup_window.uFrameY = pY + 5; + popup_window.uFrameHeight = 64; pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); + popup_window.DrawMessageBox(0); break; } case SCREEN_CHARACTERS: @@ -1500,7 +1474,7 @@ case SCREEN_CHEST_INVENTORY: { if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) - OnInventoryItemRightClick(); + Inventory_ItemPopupAndAlchemy(); else if ( (signed int)pY >= 345 ) break; else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats @@ -1508,110 +1482,539 @@ else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills CharacterUI_SkillsTab_ShowHint(); else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory - OnInventoryItemRightClick(); + Inventory_ItemPopupAndAlchemy(); break; } case SCREEN_SPELL_BOOK: - { - if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); - break; - } - case SCREEN_HOUSE: + { + if ( dword_507B00_spell_info_to_draw_in_popup ) + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); + break; + } + case SCREEN_HOUSE: + { + if ( (signed int)pY < 345 && (signed int)pX < 469 ) + ShowPopupShopItem(); + break; + } + case SCREEN_PARTY_CREATION: + { + popup_window.Hint = 0; + pStr = 0; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) + { + if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ + && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) { - if ( (signed int)pY < 345 && (signed int)pX < 469 ) - ShowPopupShopItem(); - break; - } - case SCREEN_PARTY_CREATION: + switch ( pButton->msg ) + { + case UIMSG_0: //stats info + popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; + pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; + break; + case UIMSG_PlayerCreationClickPlus: //Plus button info + pStr = pGlobalTXT_LocalizationStrings[670];//Добавить + popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" + break; + case UIMSG_PlayerCreationClickMinus: //Minus button info + pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть + popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" + break; + case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info + pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + break; + case UIMSG_PlayerCreationSelectClass: //Available Class Info + popup_window.Hint = pClassDescriptions[pButton->msg_param]; + pStr = pClassNames[pButton->msg_param]; + break; + case UIMSG_PlayerCreationClickOK: //OK Info + popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. + pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК + break; + case UIMSG_PlayerCreationClickReset: //Clear info + popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. + pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить + break; + case UIMSG_PlayerCreation_SelectAttribute: // Character info + pStr = pParty->pPlayers[pButton->msg_param].pName; + popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; + break; + } + if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info + { + pY = 0; + if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) { - pWindow.Hint = 0; - pStr = 0; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) - { - if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ - && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) - { - switch ( pButton->msg ) - { - case UIMSG_0: //stats info - pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; - pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; - break; - case UIMSG_PlayerCreationClickPlus: //Plus button info - pStr = pGlobalTXT_LocalizationStrings[670];//Добавить - pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" - break; - case UIMSG_PlayerCreationClickMinus: //Minus button info - pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть - pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" - break; - case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info - v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4); - pStr = pSkillNames[v18]; - pWindow.Hint = pSkillDesc[v18]; - break; - case UIMSG_PlayerCreationSelectClass: //Available Class Info - pWindow.Hint = pClassDescriptions[pButton->msg_param]; - pStr = pClassNames[pButton->msg_param]; - break; - case UIMSG_PlayerCreationClickOK: //OK Info - pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. - pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК - break; - case UIMSG_PlayerCreationClickReset: //Clear info - pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. - pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить - break; - case UIMSG_PlayerCreation_SelectAttribute: // Character info - pStr = pParty->pPlayers[pButton->msg_param].pName; - pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; - break; - } - if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info - { - pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48); - pY = 0; - if ( (signed int)pSkillId < 37 ) - { - pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId); - strcpy(pTmpBuf2.data(), pSkillInfo); - pWindow.Hint = pTmpBuf2.data(); - pStr = pSkillNames[pSkillId]; - } - } - } - } - if ( pWindow.Hint ) - { - pHint = (char*)pWindow.Hint; - pWindow.Hint = 0; - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 256; - pWindow.uFrameX = 128; - pWindow.uFrameY = 40; - pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pWindow.DrawMessageBox(0); - pWindow.uFrameX += 12; - pWindow.uFrameWidth -= 24; - pWindow.uFrameY += 12; - pWindow.uFrameHeight -= 12; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pColor = TargetColor(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" - pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); - pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); - } - break; + strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); + popup_window.Hint = pTmpBuf2.data(); + pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; } - default: + } + } + } + if ( popup_window.Hint ) + { + pHint = (char*)popup_window.Hint; + popup_window.Hint = 0; + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = 40; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", TargetColor(0xFF, 0xFF, 0x9B), pStr); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); + } + break; + } + default: + break; + } + dword_507BF0_is_there_popup_onscreen = 1; + viewparams->bRedrawGameUI = 1; +} +int no_rightlick_in_inventory = false; // 0050CDCC +//----- (00416196) -------------------------------------------------------- +void Inventory_ItemPopupAndAlchemy() +{ + int v14; // edx@25 + unsigned int v15; // edi@25 + signed int v16; // edx@27 + int v17; // eax@54 + unsigned int v18; // edx@57 + int v19; // eax@65 + int v20; // edi@67 + int v21; // eax@72 + int v22; // ecx@74 + int v23; // edx@78 + int v24; // eax@79 + int v25; // eax@80 + int v26; // eax@84 + ItemGen *v27; // esi@98 + double v31; // st7@112 + double v36; // st7@132 + signed __int64 v37; // qax@135 + Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 + GUIWindow message_window; // [sp+Ch] [bp-84h]@137 + int v45; // [sp+64h] [bp-2Ch]@10 + POINT a2; // [sp+78h] [bp-18h]@2 + unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 + + if (no_rightlick_in_inventory) + return; + + pMouse->GetCursorPos(&a2); + int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1; + auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; + + if (a2.x <= 13 || a2.x >= 462) + { + GameUI_DrawItemInfo(item); + return; + } + + if (!item_pid) + { + 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; + + if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) + return; + + item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); + } +//check character condition(проверка состояния персонажа) + if (!pPlayers[uActiveCharacter]->CanAct()) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + message_window.Hint = pTmpBuf.data(); + message_window.uFrameWidth = 384; + message_window.uFrameHeight = 180; + if (a2.x <= 320 ) + message_window.uFrameX = a2.x + 30; + else + message_window.uFrameX = a2.x - 414; + message_window.uFrameY = 40; + message_window.DrawMessageBox(0); + return; + } + + int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; + int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)) - 1; + +// for potion bottle(простая бутылка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) + { + GameUI_DrawItemInfo(item); + return; + } +//for recharge potion(зелье перезарядка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle + item->uItemID < ITEM_POTION_CATALYST && // cant recharge + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + + v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; + if ( v36 < 0.0 ) + v36 = 0.0; + v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); + item->uMaxCharges = v37; + item->uNumCharges = v37; + + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// for harden potion(зелье закалка) + else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle + item->uItemID < ITEM_POTION_CATALYST && // cant harden + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->IsBroken() || // cant harden broken items + item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts + item->GetItemEquipType() < EQUIP_OFF_HAND || + item->GetItemEquipType() > EQUIP_WAND) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// several potions(несколько зелий) + else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && + pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || + pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle + item->uItemID < ITEM_POTION_CATALYST && // cant enchant + item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || + item->uItemID >= ITEM_ARTIFACT_PUCK || + item->IsBroken() || + item->uSpecEnchantmentType || + item->uEnchantmentType || + item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->UpdateTempBonus(pParty->uTimePlayed); + if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + item->uSpecEnchantmentType = 40; // of Slaying + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + else + { + static int _4E2904_enchantment_by_potion_lut[] = + { + 164, 93, 22, + 164, 93, 22, + 11, 5, 13, 7, 59 + }; + item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + + v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; + v27->uAttributes = alchemy_skill_level | 0x18; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } + // use reagents(применение реагентов) + if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); + switch ( pParty->pPickedItem.uItemID ) + { + case 200: + case 201: + case 202: + case 203: + case 204: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; + break; + case 205: + case 206: + case 207: + case 208: + case 209: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; + break; + case 210: + case 211: + case 212: + case 213: + case 214: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; + break; + case 215: + case 216: + case 217: + case 218: + case 219: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; + break; + default: + break; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + } + return; + } + +//potions mixing(смешивание двух зелий) + if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || + pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) + { + if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || + pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) + { + 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) + GameUI_DrawItemInfo(item); + return; + } + + // src not reagent, dst not bottle + // src potion, dst potion + + v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; + v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; + + if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) + v16 = 5; + else + v16 = pItemsTable->potion_data[v15][v14 + 2]; + damage_level = v16; + if ( alchemy_skill_points ) + { + if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN )//< 225 >227 + { + if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 >= v16 <= 239 + { + if ( alchemy_skill_points == 1 ) + damage_level = 2; + } + if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 >= v16 <= 261 + { + if ( alchemy_skill_points <= 2 ) + damage_level = 3; + } + if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_points != 4 )//>= 262 + damage_level = 4; + } + } + else + { + if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 + damage_level = 1; + if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 + damage_level = 2; + if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 + damage_level = 3; + if ( v16 >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 + damage_level = 4; + } + int pOut_y = 0; + int pOut_x = item_pid + 1; + v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; + while ( *(int *)v17 != pOut_x ) + { + ++pOut_y; + v17 += 4; + if ( pOut_y >= 126 ) + { + v18 = pOut_y; + goto LABEL_59; + } + } + v18 = pOut_y; +LABEL_59: + if ( !damage_level ) + { + GameUI_DrawItemInfo(item); + return; + } + if ( damage_level == 1 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v26 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + } + else + { + if ( damage_level == 2 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v25 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); + v23 = 1; + } + else + { + if ( damage_level == 3 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + v24 = rand(); + pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); + v23 = 5; + } + else + { + if ( damage_level != 4 ) + { + if ( damage_level != 5 ) { - break; + v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); + if ( v19 ) + pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; + v20 = v14 + 50 * v15; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = damage_level; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) + / 2; + pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 + v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) + *(int *)(v22 + 552) |= 1u; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; } + if ( alchemy_skill_points ) + { + if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 ) + *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; + else + *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; + v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); + if ( v21 ) + //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; + pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; + v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) + *(int *)(v22 + 552) |= 1u; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; } - dword_507BF0_is_there_popup_onscreen = 1; - viewparams->bRedrawGameUI = 1; - } \ No newline at end of file + GameUI_DrawItemInfo(item); + return; + } + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); + pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); + v23 = 0; + } + } + pPlayers[uActiveCharacter]->ItemsEnchant(v23); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + } + 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 ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; +}
--- a/UI/UIShops.cpp Wed Sep 25 12:54:34 2013 +0600 +++ b/UI/UIShops.cpp Wed Sep 25 17:29:14 2013 +0600 @@ -1352,8 +1352,8 @@ dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } - v66 = pMouse->GetCursorPos(&v98); - pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; + pMouse->GetCursorPos(&v98); + pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) { v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
--- a/mm7_5.cpp Wed Sep 25 12:54:34 2013 +0600 +++ b/mm7_5.cpp Wed Sep 25 17:29:14 2013 +0600 @@ -4904,452 +4904,6 @@ DrawCopyrightWindow(); } - -int no_rightlick_in_inventory = false; // 0050CDCC -//----- (00416196) -------------------------------------------------------- -void OnInventoryItemRightClick() -{ - int v7; // eax@7 - int v9; // edi@10 - int v14; // edx@25 - unsigned int v15; // edi@25 - signed int v16; // edx@27 - int v17; // eax@54 - unsigned int v18; // edx@57 - int v19; // eax@65 - int v20; // edi@67 - int v21; // eax@72 - int v22; // ecx@74 - int v23; // edx@78 - int v24; // eax@79 - int v25; // eax@80 - int v26; // eax@84 - ItemGen *v27; // esi@98 - double v31; // st7@112 - double v36; // st7@132 - signed __int64 v37; // qax@135 - Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 - GUIWindow v43; // [sp+Ch] [bp-84h]@137 - int v45; // [sp+64h] [bp-2Ch]@10 - POINT a2; // [sp+78h] [bp-18h]@2 - unsigned int v51; // [sp+8Ch] [bp-4h]@23 - - if (no_rightlick_in_inventory) - return; - - pMouse->GetCursorPos(&a2); - if (a2.x <= 13 || a2.x >= 462) - return; - - int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - if (!item_pid) - { - 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; - - v7 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); - if (v7 == 0) - return; - - item_pid = v7; - } - - if (!pPlayers[uActiveCharacter]->CanAct()) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы - 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; - v43.DrawMessageBox(0); - return; - } - - --item_pid; - int alchemy_level = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); - v9 = alchemy_level & 0x3F; - //v45 = alchemy_level & 0x3F; - int alchemy_skill = SkillToMastery(alchemy_level); - - auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; - if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) - { - GameUI_DrawItemInfo(item); - return; - } - - if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle - item->uItemID < ITEM_POTION_CATALYST && // cant recharge - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - - v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v36 < 0.0 ) - v36 = 0.0; - v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); - item->uMaxCharges = v37; - item->uNumCharges = v37; - - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - GameUI_DrawItemInfo(item); - return; - } - - else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle - item->uItemID < ITEM_POTION_CATALYST && // cant harden - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->IsBroken() || // cant harden broken items - item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - item->GetItemEquipType() < EQUIP_OFF_HAND || - item->GetItemEquipType() > EQUIP_WAND) - goto __invalid_item; - - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - GameUI_DrawItemInfo(item); - return; - } - - else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && - pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || - pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle - item->uItemID < ITEM_POTION_CATALYST && // cant enchant - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || - item->uItemID >= ITEM_ARTIFACT_PUCK || - item->IsBroken() || - item->uSpecEnchantmentType || - item->uEnchantmentType || - item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows - goto __invalid_item; - - item->UpdateTempBonus(pParty->uTimePlayed); - if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - item->uSpecEnchantmentType = 40; // of Slaying - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - else - { - static int _4E2904_enchantment_by_potion_lut[] = - { - 164, 93, 22, - 164, 93, 22, - 11, 5, 13, 7, 59 - }; - item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - - v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; - v27->uAttributes = alchemy_skill | 0x18; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - GameUI_DrawItemInfo(item); - return; - } - - - - if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || - pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) - { - if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || - pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) - { - 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) - GameUI_DrawItemInfo(item); - return; - } - - // src not reagent, dst not bottle - // src potion, dst potion - - v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; - v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; - - if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || - item->uItemID == ITEM_POTION_CATALYST ) - { - v16 = 5; - } - else - { - v16 = pItemsTable->potion_data[v15][v14 + 2]; - } - v51 = v16; - if ( v9 ) - { - if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN ) - { - if ( v16 < ITEM_POTION_HASTE || v16 > ITEM_POTION_CURE_INSANITY ) - { - if ( v16 < ITEM_POTION_MIGHT_BOOST || v16 > ITEM_POTION_BODY_RESISTANE ) - { - if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_level != 4 ) - { -LABEL_53: - v51 = 4; - goto LABEL_54; - } - } - else - { - if ( alchemy_level <= 2 ) - { -LABEL_38: - v51 = 3; - goto LABEL_54; - } - } - } - else - { - if ( alchemy_level == 1 ) - { -LABEL_35: - v51 = 2; - goto LABEL_54; - } - } - } - } - else - { - if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN ) - { - v51 = 1; - goto LABEL_54; - } - if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY ) - goto LABEL_35; - if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE ) - goto LABEL_38; - if ( v16 >= ITEM_POTION_STONE_TO_FLESH ) - goto LABEL_53; - } -LABEL_54: - int pOut_y = 0; - int pOut_x = item_pid + 1; - v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; - while ( *(int *)v17 != pOut_x ) - { - ++pOut_y; - v17 += 4; - if ( pOut_y >= 126 ) - { - v18 = pOut_y; - goto LABEL_59; - } - } - v18 = pOut_y; -LABEL_59: - if ( !v51 ) - GameUI_DrawItemInfo(item); - return; - if ( v51 == 1 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v26 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - if ( v51 == 2 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v25 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); - v23 = 1; - } - else - { - if ( v51 == 3 ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - v24 = rand(); - pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); - v23 = 5; - } - else - { - if ( v51 != 4 ) - { - if ( v51 != 5 ) - { - v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); - if ( v19 ) - // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; - pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; - v20 = v14 + 50 * v15; - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = v51; - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) - / 2; - pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 -LABEL_74: - v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid); - if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) - *(int *)(v22 + 552) |= 1u; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( v9 ) - { - if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 ) - *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; - else - *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; - v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu); - if ( v21 ) - //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; - pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; - goto LABEL_74; - } - GameUI_DrawItemInfo(item); - return; - } - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18); - pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); - v23 = 0; - } - } - pPlayers[uActiveCharacter]->ItemsEnchant(v23); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - 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 ( pPlayers[uActiveCharacter]->CanAct() ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - - // end alchemy - - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice(); - switch ( pParty->pPickedItem.uItemID ) - { - case 0xC8u: - case 0xC9u: - case 0xCAu: - case 0xCBu: - case 0xCCu: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; - break; - case 0xCDu: - case 0xCEu: - case 0xCFu: - case 0xD0u: - case 0xD1u: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; - break; - case 0xD2u: - case 0xD3u: - case 0xD4u: - case 0xD5u: - case 0xD6u: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; - break; - case 0xD7u: - case 0xD8u: - case 0xD9u: - case 0xDAu: - case 0xDBu: - pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; - break; - default: - break; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - if ( dword_4E455C ) - { - pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - } - return; - - -__invalid_item: - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; -} - //----- (00417AD4) -------------------------------------------------------- unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) {
--- a/mm7_6.cpp Wed Sep 25 12:54:34 2013 +0600 +++ b/mm7_6.cpp Wed Sep 25 17:29:14 2013 +0600 @@ -1545,7 +1545,7 @@ { if ( pItemsTable->uAllItemsCount ) { - for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i ) + for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) { if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) pSpellObject.stru_24.uItemID = i;
--- a/mm7_data.h Wed Sep 25 12:54:34 2013 +0600 +++ b/mm7_data.h Wed Sep 25 17:29:14 2013 +0600 @@ -1073,7 +1073,7 @@ void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); -void OnInventoryItemRightClick(); +void Inventory_ItemPopupAndAlchemy(); 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);