Mercurial > mm7
changeset 1581:a5fdf6cf8d74
Слияние
author | Ritor1 |
---|---|
date | Tue, 10 Sep 2013 23:45:55 +0600 |
parents | 1264fce1a17f (current diff) 5a65334a5d58 (diff) |
children | d3d539924e5e |
files | |
diffstat | 10 files changed, 389 insertions(+), 398 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.h Tue Sep 10 23:42:03 2013 +0600 +++ b/Items.h Tue Sep 10 23:45:55 2013 +0600 @@ -61,12 +61,30 @@ 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_CURE_WOUNDS = 222, + ITEM_POTION_CURE_DISEASE = 225, + ITEM_POTION_AWAKEN = 227, + ITEM_POTION_HASTE = 228, + ITEM_POTION_RECHARGE_ITEM = 233, + ITEM_POTION_HARDEN_ITEM = 236, + ITEM_POTION_CURE_INSANITY = 239, + ITEM_POTION_MIGHT_BOOST = 240, + ITEM_POTION_ACCURACY_BOOST = 245, + ITEM_POTION_FLAMING_POTION = 246, + ITEM_POTION_SWIFT_POTION = 250, + ITEM_POTION_BODY_RESISTANE = 261, + ITEM_POTION_STONE_TO_FLESH = 262, + 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,
--- a/Log.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/Log.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -26,8 +26,8 @@ va_end(args); DWORD w; - WriteConsole(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr); - WriteConsole(hStdOut, L"\r\n", 2, &w, nullptr); + WriteConsoleW(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr); + WriteConsoleW(hStdOut, L"\r\n", 2, &w, nullptr); } //----- (004BE386) -------------------------------------------------------- void __fastcall log_error(const char *pMessage)
--- a/Render.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/Render.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -6453,7 +6453,7 @@ Error("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); //v10 = *pOutSurface; //v11 = 0; - if ( bMipMaps ) + if (bMipMaps) { Dst._450DDE(); //v20 = 0; @@ -6472,7 +6472,7 @@ if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) { - Dst.sub_451007_scale_image_bicubic( + /*Dst.sub_451007_scale_image_bicubic( pHWLTexture->pPixels, pHWLTexture->uWidth, pHWLTexture->uHeight, @@ -6482,7 +6482,7 @@ desc.dwHeight, desc.lPitch >> 1, 0, - 0); + 0);*/ ErrD3D(pNextSurf->Unlock(0)); //bMipMaps = 0x4D86ACu; } @@ -6701,8 +6701,11 @@ auto ecx0 = this; v3 = 0; - if ( ecx0->pRenderD3D ) - { + + if (!this->pRenderD3D) + __debugbreak(); // sw render + + //{ v4 = a3; if ( a3 <= 1.0 ) { @@ -6713,6 +6716,7 @@ { v4 = 1.0; } + __debugbreak(); // banker's rounding again a3 = v4 * 255.0; v39 = a3 + 6.7553994e15; LODWORD(v40) = LODWORD(v39); @@ -6774,7 +6778,7 @@ ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); - } + /*} else { v40 = (1.0 - a3) * 65536.0; @@ -6800,7 +6804,7 @@ if ( pRenderer->uTargetGBits == 6 ) { - v17 = _42690D_colors_cvt(this_); + v17 = sr_42690D_colors_cvt(this_); v18 = (65536 - LODWORD(a3)) * (v17 & 0x1F); this_ = (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (unsigned __int16)(v17 & 0xF800) & 0xF800FFFF | v18 & 0x1F0000 | (65536 - LODWORD(a3)) * (v17 & 0x7E0) & 0x7E00000u) >> 16); v19 = v40; @@ -6831,7 +6835,7 @@ } else { - v24 = _4268E3_smthn_to_a1r5g5b5(this_); + v24 = sr_4268E3_smthn_to_a1r5g5b5(this_); v25 = (65536 - LODWORD(a3)) * (v24 & 0x1F); this_ = (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16 << 16) | (((65536 - LODWORD(a3)) * (v24 & 0x7C00) & 0x7C000000 | v25 & 0x1F0000 | (65536 - LODWORD(a3)) * (v24 & 0x3E0) & 0x3E00000u) >> 16); @@ -6860,7 +6864,7 @@ } while ( v32 != 1 ); } - } + }*/ return result; }
--- a/SpriteObject.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/SpriteObject.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -82,11 +82,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -107,11 +107,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -132,11 +132,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16; + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16; + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -157,11 +157,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -182,11 +182,11 @@ pSpriteObjects[v6].vVelocity.z = 0; if ( a4 ) { - v13 = (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - a5a = (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; - pSpriteObjects[v6].vVelocity.x = (unsigned int)(v13 * a4) >> 16; - pSpriteObjects[v6].vVelocity.y = (unsigned int)(a5a * a4) >> 16; - pSpriteObjects[v6].vVelocity.z = (unsigned int)(stru_5C6E00->Sin(pitch) * a4) >> 16; + v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)); + a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)); + pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4); + pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4); + pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4); } else { @@ -331,9 +331,9 @@ if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) ) v1->vVelocity.z = 0; - v1->vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.x) >> 16); - v1->vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.y) >> 16); - v1->vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.z) >> 16); + v1->vVelocity.x = fixpoint_sub0(58500, v1->vVelocity.x); + v1->vVelocity.y = fixpoint_sub0(58500, v1->vVelocity.y); + v1->vVelocity.z = fixpoint_sub0(58500, v1->vVelocity.z); if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 ) { @@ -620,12 +620,12 @@ int v18; // eax@52 int v19; // ecx@52 Vec3_short_ *v20; // ecx@53 - int v21; // ecx@57 + //int v21; // ecx@57 __int16 v22; // ax@57 int v23; // edi@62 - int v24; // edi@62 - int v25; // eax@62 - unsigned __int64 v26; // qax@62 + //int v24; // edi@62 + //int v25; // eax@62 + //unsigned __int64 v26; // qax@62 unsigned __int8 v27; // sf@64 unsigned __int8 v28; // of@64 __int16 v29; // di@67 @@ -641,7 +641,7 @@ int v39; // [sp+80h] [bp-10h]@33 Actor *v39b; int v40; // [sp+84h] [bp-Ch]@28 - int v41; // [sp+88h] [bp-8h]@34 + //int v41; // [sp+88h] [bp-8h]@34 int v42; // [sp+8Ch] [bp-4h]@4 //uLayingItemID_ = uLayingItemID; @@ -791,7 +791,7 @@ pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); - pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); + pSpriteObject->uSectorID = stru_721530.uSectorID; stru_721530.field_70 += stru_721530.field_7C; if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) return; @@ -801,15 +801,8 @@ v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); - v42 = stru_5C6E00->Cos(v23); - v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v24 = v23; - pSpriteObject->vVelocity.x = (unsigned int)(v42 * v40) >> 16; - v25 = stru_5C6E00->Sin(v23); - v42 = v25; - v26 = v25 * (signed __int64)v40; - v41 = v26 >> 16; - pSpriteObject->vVelocity.y = WORD1(v26); + pSpriteObject->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v23), v40); + pSpriteObject->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v23), v40); } else { @@ -823,25 +816,17 @@ + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; if ( (stru_721530.speed >> 3) > v42 ) v42 = stru_721530.speed >> 3; - v40 = v16->pFacePlane_old.vNormal.x; - v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v41 = v16->pFacePlane_old.vNormal.y; - v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - v39 = v16->pFacePlane_old.vNormal.z; - v39 = (unsigned __int64)(v42 * (signed __int64)v39) >> 16; - pSpriteObject->vVelocity.x += 2 * v40; - pSpriteObject->vVelocity.y += 2 * v41; + pSpriteObject->vVelocity.x += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.x); + pSpriteObject->vVelocity.y += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.y); + v39 = fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.z); if ( v16->pFacePlane_old.vNormal.z <= 32000 ) { v22 = 2 * v39; } else { - v21 = v39; - v40 = 32000; pSpriteObject->vVelocity.z += v39; - v41 = (unsigned __int64)(v40 * (signed __int64)v21) >> 16; - v22 = (unsigned int)(v40 * v21) >> 16; + v22 = fixpoint_sub0(32000, v39); } pSpriteObject->vVelocity.z += v22; if ( BYTE3(v16->uAttributes) & 0x10 ) @@ -876,20 +861,12 @@ LABEL_63: //v2 = v37; LABEL_64: - v41 = pSpriteObject->vVelocity.x; - v40 = 58500; - v41 = (unsigned __int64)(58500i64 * v41) >> 16; - pSpriteObject->vVelocity.x = v41; - v41 = pSpriteObject->vVelocity.y; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; - v40 = 58500; - pSpriteObject->vVelocity.y = v41; - v41 = pSpriteObject->vVelocity.z; - v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; + pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); ++uFaceID; v28 = __OFSUB__(uFaceID, 100); v27 = uFaceID - 100 < 0; - pSpriteObject->vVelocity.z = v41; if ( !(v27 ^ v28) ) return; v8 = 0; @@ -916,18 +893,10 @@ pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); v8 = 0; } - v42 = pSpriteObject->vVelocity.x; - uFaceID = 58500; - v42 = (unsigned __int64)(58500i64 * v42) >> 16; - pSpriteObject->vVelocity.x = v42; - v42 = pSpriteObject->vVelocity.y; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; - uFaceID = 58500; - pSpriteObject->vVelocity.y = v42; - v42 = pSpriteObject->vVelocity.z; - v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; + pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x); + pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y); + pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z); v9 = pSpriteObject->vVelocity.x; - pSpriteObject->vVelocity.z = v42; if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) { pSpriteObject->vVelocity.z = v8;
--- a/UI/UIPopup.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/UI/UIPopup.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -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; }
--- a/_deleted.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/_deleted.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -12319,7 +12319,6 @@ } return 0; } - //----- (0046271C) -------------------------------------------------------- void CreateDefaultBLVLevel() { @@ -12344,6 +12343,37 @@ ofn.lpTemplateName = 0; ofn.lpstrFileTitle = pTmpBuf.data(); } +//----- (004268E3) -------------------------------------------------------- +int __fastcall sr_4268E3_smthn_to_a1r5g5b5(unsigned int uColor) +{ + unsigned int v1; // eax@1 + unsigned int v2; // edx@1 + int v3; // eax@1 + int v4; // edx@1 + unsigned int v5; // ecx@1 + + v1 = uColor >> 9; + v2 = uColor >> 6; + LOWORD(v1) = (uColor >> 9) & 0x7C00; + LOWORD(v2) = (uColor >> 6) & 0x3E0; + v3 = v2 | v1; + v4 = (unsigned __int8)uColor >> 3; + v5 = uColor >> 16; + LOWORD(v5) = v5 & 0x8000; + return v5 | v4 | v3; +} +//----- (0042690D) -------------------------------------------------------- +int __fastcall sr_42690D_colors_cvt(unsigned int a1) +{ + unsigned int v1; // eax@1 + unsigned int v2; // edx@1 + + v1 = a1 >> 8; + v2 = a1 >> 5; + LOWORD(v1) = (a1 >> 8) & 0xF800; + LOWORD(v2) = (a1 >> 5) & 0x7E0; + return ((unsigned __int8)a1 >> 3) | v2 | v1; +} const wchar_t *UIMessage2String(UIMessageType msg) {
--- a/mm7_5.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/mm7_5.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -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 v10; // eax@10 + //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,213 +4938,229 @@ int v25; // eax@80 int v26; // eax@84 ItemGen *v27; // esi@98 - unsigned int v28; // eax@98 - ItemGen *v29; // edi@98 - unsigned int v30; // ecx@103 + //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 - int v34; // eax@126 - unsigned int v35; // ecx@127 + //unsigned __int64 v32; // qax@113 + //unsigned int v33; // ecx@117 + //int v34; // eax@126 + //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 - int v47; // [sp+6Ch] [bp-24h]@25 - POINT y; // [sp+70h] [bp-20h]@2 + //unsigned int pX; // [sp+68h] [bp-28h]@2 + //int v47; // [sp+6Ch] [bp-24h]@25 + //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; - if ( pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE ) + + --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); + + auto item = &player->pInventoryItemList[item_pid]; + if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) { -LABEL_116: - GameUI_DrawItemInfo(&v0->pInventoryItemList[v10]); +__show_item_desc: + GameUI_DrawItemInfo(item); 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_POTION_RECHARGE_ITEM) { - 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 (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle + item->uItemID < ITEM_POTION_CATALYST && // cant recharge + item->uItemID > ITEM_POTION_REJUVENATION) // all potions { - 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 ) - goto LABEL_116; - v27 = &v0->pInventoryItemList[pOut.z]; - v28 = v27->uItemID; - v51 = pItemsTable->pItems[v27->uItemID].uEquipType; - v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); - if ( pParty->pPickedItem.uItemID != 233 ) - { - if ( pParty->pPickedItem.uItemID == 236 ) - { - v35 = v27->uAttributes; - if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) - { - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - return; - } - LOWORD(v35) = v35 | 0x210; - v27->uAttributes = v35; - } - else - { - if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) - { - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - return; - } - if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) - { - v27->UpdateTempBonus(pParty->uTimePlayed); - v33 = v27->uItemID; - if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 - || (pOut.y = v27->uAttributes, pOut.y & 2) - || v27->uSpecEnchantmentType - || v27->uEnchantmentType - || v51 && v51 != 1 && v51 != 2 - || (signed int)v33 >= 500 ) - { - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - return; - } - v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; - a2.y = (int)v29 << 7; - v31 = (double)(signed int)((int)v29 << 7); - v27->uSpecEnchantmentType = v34; - } - else - { - 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) - || v27->uSpecEnchantmentType - || v27->uEnchantmentType - || v51 && v51 != 1 && v51 != 2 - || (signed int)v30 >= 500 ) - { - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - return; - } - a2.y = (int)v29 << 7; - v27->uSpecEnchantmentType = 40; - 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; - HIDWORD(v27->uExpireTime) = HIDWORD(v32); - v27->uAttributes = v32; - } - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - return; - } - v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v36 < 0.0 ) - v36 = 0.0; - if ( v51 != 12 ) + if (pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_WAND) // can recharge only wands { 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); - v27->uMaxCharges = v37; - v27->uNumCharges = (unsigned __int8)v37; - pMouse->RemoveHoldingItem(); - dword_50CDCC = 1; - 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; + } + goto __show_item_desc; + } + + 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 + pItemsTable->pItems[item->uItemID].uEquipType < EQUIP_OFF_HAND || + pItemsTable->pItems[item->uItemID].uEquipType > EQUIP_WAND) + goto __invalid_item; + + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_ENCHANTED; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; } - v14 = v13 - 222; - v15 = pParty->pPickedItem.uItemID - 222; - v47 = v14; - y.y = 0; - if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) + goto __show_item_desc; + } + + 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 || + pItemsTable->pItems[item->uItemID].uEquipType >= 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; + } + goto __show_item_desc; + } + + + + if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || + pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || + player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) + { + 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 != 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 __show_item_desc; + } + + // 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 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; - v10 = pOut.z; + v16 = pItemsTable->potion_data[v15][v14 + 2]; } v51 = v16; - if ( v45 ) + if ( v9 ) { - if ( v16 < 225 || v16 > 227 ) + if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN ) { - if ( v16 < 228 || v16 > 239 ) + if ( v16 < ITEM_POTION_HASTE || v16 > ITEM_POTION_CURE_INSANITY ) { - if ( v16 < 240 || v16 > 261 ) + if ( v16 < ITEM_POTION_MIGHT_BOOST || v16 > ITEM_POTION_BODY_RESISTANE ) { - if ( v16 >= 262 && pOut.y != 4 ) + if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_level != 4 ) { LABEL_53: v51 = 4; @@ -5149,7 +5169,7 @@ } else { - if ( pOut.y <= 2 ) + if ( alchemy_level <= 2 ) { LABEL_38: v51 = 3; @@ -5159,7 +5179,7 @@ } else { - if ( pOut.y == 1 ) + if ( alchemy_level == 1 ) { LABEL_35: v51 = 2; @@ -5170,70 +5190,63 @@ } else { - if ( v16 >= 225 && v16 <= 227 ) + if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN ) { v51 = 1; goto LABEL_54; } - if ( v16 >= 228 && v16 <= 239 ) + if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY ) goto LABEL_35; - if ( v16 >= 240 && v16 <= 261 ) + if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE ) goto LABEL_38; - if ( v16 >= 262 ) + if ( v16 >= ITEM_POTION_STONE_TO_FLESH ) 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 = item_pid + 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; - goto LABEL_116; - } + goto __show_item_desc;; 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 +5255,79 @@ { 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; - v20 = v47 + 50 * v15; - v0->pInventoryItemList[pOut.z].uItemID = v51; - v0->pInventoryItemList[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + v0->pInventoryItemList[pOut.z].uEnchantmentType) + player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; + v20 = v14 + 50 * v15; + 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; + goto __show_item_desc; } - 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; + + // end alchemy + + player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; switch ( pParty->pPickedItem.uItemID ) { case 0xC8u: @@ -5319,39 +5335,46 @@ 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; } + return; + + +__invalid_item: + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; } //----- (00417AD4) -------------------------------------------------------- @@ -5395,6 +5418,5 @@ } break; } - assert(false); - return 0; + Error("Invalid player class: %u", uPlayerClass); } \ No newline at end of file
--- a/mm7_6.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/mm7_6.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -209,38 +209,6 @@ return result; } -//----- (004268E3) -------------------------------------------------------- -int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor) -{ - unsigned int v1; // eax@1 - unsigned int v2; // edx@1 - int v3; // eax@1 - int v4; // edx@1 - unsigned int v5; // ecx@1 - - v1 = uColor >> 9; - v2 = uColor >> 6; - LOWORD(v1) = (uColor >> 9) & 0x7C00; - LOWORD(v2) = (uColor >> 6) & 0x3E0; - v3 = v2 | v1; - v4 = (unsigned __int8)uColor >> 3; - v5 = uColor >> 16; - LOWORD(v5) = v5 & 0x8000; - return v5 | v4 | v3; -} - -//----- (0042690D) -------------------------------------------------------- -int __fastcall _42690D_colors_cvt(unsigned int a1) -{ - unsigned int v1; // eax@1 - unsigned int v2; // edx@1 - - v1 = a1 >> 8; - v2 = a1 >> 5; - LOWORD(v1) = (a1 >> 8) & 0xF800; - LOWORD(v2) = (a1 >> 5) & 0x7E0; - return ((unsigned __int8)a1 >> 3) | v2 | v1; -} //----- (00426A5A) -------------------------------------------------------- void stru319::LootActor(Actor *pActor) @@ -1824,7 +1792,7 @@ } //----- (0042FC4E) -------------------------------------------------------- -void ProcessInputActions() +void ProcessInputActions() { char v4; // al@9 char v8; // bl@100 @@ -2139,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; } @@ -2151,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: @@ -2196,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:
--- a/mm7_data.cpp Tue Sep 10 23:42:03 2013 +0600 +++ b/mm7_data.cpp Tue Sep 10 23:45:55 2013 +0600 @@ -374,7 +374,7 @@ char aPending[777]; // idb char aCanTFindS[777]; // idb -std::array<char, 7> aSbwb00; // weak +//std::array<char, 7> aSbwb00; // weak char aW[2]; // idb char aA[2]; // idb char aSD[777]; // idb @@ -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
--- a/mm7_data.h Tue Sep 10 23:42:03 2013 +0600 +++ b/mm7_data.h Tue Sep 10 23:45:55 2013 +0600 @@ -334,7 +334,7 @@ extern __int16 word_4E1D3A[]; // weak -extern std::array<char, 7> aSbwb00; // weak +//extern std::array<char, 7> aSbwb00; // weak extern char aW[2]; // idb extern char aA[2]; // idb extern char aSD[]; // idb @@ -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); @@ -1122,8 +1121,6 @@ bool PortalFrustrum(int pNumVertices, struct BspRenderer_PortalViewportData *a2, struct BspRenderer_PortalViewportData *near_portal, int uFaceID); int sr_424CD7(unsigned int uVertexID); // idb int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb -int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor); // idb -int __fastcall _42690D_colors_cvt(unsigned int a1); void __fastcall GivePartyExp(unsigned int pEXPNum); bool __fastcall sub_427769_spell(unsigned int uSpellID); void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6);