comparison mm7_2.cpp @ 913:a8a3efd631de

CharacterUI_DrawPaperdollWithRingOverlay clean
author Ritor1
date Mon, 22 Apr 2013 21:29:21 +0600
parents 8cd0b155bebe
children 897b10712a1a
comparison
equal deleted inserted replaced
912:22abf110163e 913:a8a3efd631de
9461 } 9461 }
9462 9462
9463 //----- (00468F8A) -------------------------------------------------------- 9463 //----- (00468F8A) --------------------------------------------------------
9464 void __cdecl OnPaperdollLeftClick() 9464 void __cdecl OnPaperdollLeftClick()
9465 { 9465 {
9466 Player *v0; // ebx@1
9467 int v1; // ecx@1 9466 int v1; // ecx@1
9468 unsigned int v2; // edi@1 9467 unsigned int v2; // edi@1
9469 unsigned int v3; // edx@4 9468 unsigned int v3; // edx@4
9470 unsigned int v4; // esi@5 9469 unsigned int v4; // esi@5
9471 unsigned __int16 v5; // ax@7 9470 unsigned __int16 v5; // ax@7
9501 unsigned int v35; // eax@91 9500 unsigned int v35; // eax@91
9502 int v36; // esi@93 9501 int v36; // esi@93
9503 int v37; // edi@93 9502 int v37; // edi@93
9504 ItemGen *v38; // edi@93 9503 ItemGen *v38; // edi@93
9505 __int16 v39; // dx@99 9504 __int16 v39; // dx@99
9506 signed int v40; // [sp-1Ch] [bp-68h]@80
9507 unsigned int v41; // [sp-18h] [bp-64h]@80
9508 signed int v42; // [sp-14h] [bp-60h]@80
9509 signed int v43; // [sp-10h] [bp-5Ch]@80
9510 int v44; // [sp-Ch] [bp-58h]@80
9511 unsigned int v45; // [sp-8h] [bp-54h]@80
9512 int v46; // [sp-4h] [bp-50h]@80
9513 ItemGen _this; // [sp+Ch] [bp-40h]@1 9505 ItemGen _this; // [sp+Ch] [bp-40h]@1
9514 unsigned int v48; // [sp+30h] [bp-1Ch]@88 9506 unsigned int v48; // [sp+30h] [bp-1Ch]@88
9515 unsigned int v49; // [sp+34h] [bp-18h]@57 9507 unsigned int v49; // [sp+34h] [bp-18h]@57
9516 unsigned int v50; // [sp+38h] [bp-14h]@50 9508 unsigned int v50; // [sp+38h] [bp-14h]@50
9517 int v51; // [sp+3Ch] [bp-10h]@1 9509 int v51; // [sp+3Ch] [bp-10h]@1
9519 int v53; // [sp+44h] [bp-8h]@1 9511 int v53; // [sp+44h] [bp-8h]@1
9520 unsigned int v54; // [sp+48h] [bp-4h]@1 9512 unsigned int v54; // [sp+48h] [bp-4h]@1
9521 9513
9522 v51 = 0; 9514 v51 = 0;
9523 _this.Reset(); 9515 _this.Reset();
9524 v0 = pPlayers[uActiveCharacter]; 9516 //v0 = pPlayers[uActiveCharacter];
9525 v1 = v0->pEquipment.uMainHand; 9517 v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand;
9526 v2 = v0->pEquipment.uShield; 9518 v2 = pPlayers[uActiveCharacter]->pEquipment.uShield;
9527 v54 = v0->pEquipment.uShield; 9519 v54 = pPlayers[uActiveCharacter]->pEquipment.uShield;
9528 v53 = v1; 9520 v53 = v1;
9529 if ( v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uEquipType == 1 ) 9521 if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uEquipType == 1 )
9530 v51 = v1; 9522 v51 = v1;
9531 v3 = pParty->pPickedItem.uItemID; 9523 v3 = pParty->pPickedItem.uItemID;
9532 if ( pParty->pPickedItem.uItemID ) 9524 if ( pParty->pPickedItem.uItemID )
9533 { 9525 {
9534 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; 9526 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
9535 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; 9527 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType;
9536 if ( v4 == 4 ) 9528 if ( v4 == 4 )
9537 { 9529 {
9538 if ( v2 ) 9530 if ( v2 )
9539 { 9531 {
9540 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); 9532 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
9541 if ( (signed int)SkillToMastery(v5) < 3 ) 9533 if ( (signed int)SkillToMastery(v5) < 3 )
9542 { 9534 {
9543 v0->PlaySound(SPEECH_39, 0); 9535 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9544 return; 9536 return;
9545 } 9537 }
9546 v3 = pParty->pPickedItem.uItemID; 9538 v3 = pParty->pPickedItem.uItemID;
9547 } 9539 }
9548 } 9540 }
9549 else 9541 else
9550 { 9542 {
9551 if ( (v4 == 8 || v4 == 1 || v4 == 2) 9543 if ( (v4 == 8 || v4 == 1 || v4 == 2)
9552 && v1 9544 && v1
9553 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 ) 9545 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 )
9554 { 9546 {
9555 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); 9547 LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
9556 if ( (signed int)SkillToMastery(v5) < 3 ) 9548 if ( (signed int)SkillToMastery(v5) < 3 )
9557 { 9549 {
9558 v0->PlaySound(SPEECH_39, 0); 9550 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9559 return; 9551 return;
9560 } 9552 }
9561 } 9553 }
9562 } 9554 }
9563 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) 9555 if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) )
9564 { 9556 {
9565 9557
9566 v0->PlaySound(SPEECH_39, 0); 9558 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9567 return; 9559 return;
9568 } 9560 }
9569 if ( pParty->pPickedItem.uItemID == 604 ) 9561 if ( pParty->pPickedItem.uItemID == 604 )
9570 { 9562 {
9571 sub_467E7F_EquipBody(3u); 9563 sub_467E7F_EquipBody(3);
9572 WetsuitOn(uActiveCharacter); 9564 WetsuitOn(uActiveCharacter);
9573 return; 9565 return;
9574 } 9566 }
9575 v6 = v52; 9567 v6 = v52;
9576 switch ( v52 ) 9568 switch ( v52 )
9581 case 6u: 9573 case 6u:
9582 case 7u: 9574 case 7u:
9583 case 8u: 9575 case 8u:
9584 case 9u: 9576 case 9u:
9585 case 0xBu: 9577 case 0xBu:
9586 if ( !v0->HasSkill(v4) ) 9578 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
9587 { 9579 {
9588 v0->PlaySound(SPEECH_39, 0); 9580 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9589 return; 9581 return;
9590 } 9582 }
9591 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) 9583 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
9592 { 9584 {
9593 v46 = 0; 9585 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9594 v45 = 0;
9595 v44 = 0;
9596 v43 = 0;
9597 v42 = -1;
9598 v41 = 0;
9599 v40 = 0;
9600 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9601 return; 9586 return;
9602 } 9587 }
9603 sub_467E7F_EquipBody(v6); 9588 sub_467E7F_EquipBody(v6);
9604 if ( pParty->pPickedItem.uItemID == 604 ) 9589 if ( pParty->pPickedItem.uItemID == 604 )
9605 WetsuitOff(uActiveCharacter); 9590 WetsuitOff(uActiveCharacter);
9606 return; 9591 return;
9607 case 0xAu: 9592 case 0xAu:
9608 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 9593 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
9609 { 9594 {
9610 v46 = 0; 9595 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9611 v45 = 0;
9612 v44 = 0;
9613 v43 = 0;
9614 v42 = -1;
9615 v41 = 0;
9616 v40 = 0;
9617 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9618 return; 9596 return;
9619 } 9597 }
9620 v52 = 10; 9598 v52 = 10;
9621 v7 = (int)&v0->pEquipment.uRings; 9599 v7 = (int)&pPlayers[uActiveCharacter]->pEquipment.uRings;
9622 while ( 1 ) 9600 while ( 1 )
9623 { 9601 {
9624 if ( !*(int *)v7 ) 9602 if ( !*(int *)v7 )
9625 { 9603 {
9626 v8 = v0->FindFreeInventorySlot(); 9604 v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
9627 if ( (v8 & 0x80000000u) == 0 ) 9605 if ( (v8 & 0x80000000u) == 0 )
9628 { 9606 {
9629 v9 = v52; 9607 v9 = v52;
9630 pParty->pPickedItem.uBodyAnchor = v52 + 1; 9608 pParty->pPickedItem.uBodyAnchor = v52 + 1;
9631 memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8])); 9609 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8]));
9632 *(&v0->pEquipment.uShield + v9) = v8 + 1; 9610 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1;
9633 pMouse->RemoveHoldingItem(); 9611 pMouse->RemoveHoldingItem();
9634 break; 9612 break;
9635 } 9613 }
9636 } 9614 }
9637 ++v52; 9615 ++v52;
9639 if ( (signed int)v52 > 15 ) 9617 if ( (signed int)v52 > 15 )
9640 break; 9618 break;
9641 } 9619 }
9642 if ( v52 == 16 ) 9620 if ( v52 == 16 )
9643 { 9621 {
9644 v52 = v0->pEquipment.uRings[6] - 1; 9622 v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[6] - 1;
9645 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9623 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9646 v10 = (int)((char *)v0 + 36 * v52); 9624 v10 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v52);
9647 *(char *)(v10 + 556) = 0; 9625 *(char *)(v10 + 556) = 0;
9648 pParty->pPickedItem.Reset(); 9626 pParty->pPickedItem.Reset();
9649 pParty->SetHoldingItem((ItemGen *)(v10 + 532)); 9627 pParty->SetHoldingItem((ItemGen *)(v10 + 532));
9650 _this.uBodyAnchor = 16; 9628 _this.uBodyAnchor = 16;
9651 v11 = v52 + 1; 9629 v11 = v52 + 1;
9652 memcpy((void *)(v10 + 532), &_this, 0x24u); 9630 memcpy((void *)(v10 + 532), &_this, 0x24u);
9653 v0->pEquipment.uRings[6] = v11; 9631 pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v11;
9654 } 9632 }
9655 return; 9633 return;
9656 case 4u: 9634 case 4u:
9657 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 9635 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
9658 { 9636 {
9659 v46 = 0; 9637 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9660 v45 = 0;
9661 v44 = 0;
9662 v43 = 0;
9663 v42 = -1;
9664 v41 = 0;
9665 v40 = 0;
9666 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9667 return; 9638 return;
9668 } 9639 }
9669 if ( !v0->HasSkill(v4) ) 9640 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
9670 { 9641 {
9671 v0->PlaySound(SPEECH_39, 0); 9642 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9672 return; 9643 return;
9673 } 9644 }
9674 if ( v54 ) 9645 if ( v54 )
9675 { 9646 {
9676 --v54; 9647 --v54;
9677 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9648 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9678 v12 = (int)((char *)v0 + 36 * v54); 9649 v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54);
9679 *(char *)(v12 + 556) = 0; 9650 *(char *)(v12 + 556) = 0;
9680 pParty->pPickedItem.Reset(); 9651 pParty->pPickedItem.Reset();
9681 pParty->SetHoldingItem((ItemGen *)(v12 + 532)); 9652 pParty->SetHoldingItem((ItemGen *)(v12 + 532));
9682 _this.uBodyAnchor = 1; 9653 _this.uBodyAnchor = 1;
9683 v13 = v54 + 1; 9654 v13 = v54 + 1;
9684 v14 = v51 == 0; 9655 v14 = v51 == 0;
9685 memcpy((void *)(v12 + 532), &_this, 0x24u); 9656 memcpy((void *)(v12 + 532), &_this, 0x24u);
9686 v0->pEquipment.uShield = v13; 9657 pPlayers[uActiveCharacter]->pEquipment.uShield = v13;
9687 if ( v14 ) 9658 if ( v14 )
9688 return; 9659 return;
9689 } 9660 }
9690 else 9661 else
9691 { 9662 {
9692 v52 = v0->FindFreeInventorySlot(); 9663 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
9693 if ( (v52 & 0x80000000u) != 0 ) 9664 if ( (v52 & 0x80000000u) != 0 )
9694 return; 9665 return;
9695 if ( !v51 ) 9666 if ( !v51 )
9696 { 9667 {
9697 pParty->pPickedItem.uBodyAnchor = 1; 9668 pParty->pPickedItem.uBodyAnchor = 1;
9698 v17 = v52 + 1; 9669 v17 = v52 + 1;
9699 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 9670 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
9700 v0->pEquipment.uShield = v17; 9671 pPlayers[uActiveCharacter]->pEquipment.uShield = v17;
9701 pMouse->RemoveHoldingItem(); 9672 pMouse->RemoveHoldingItem();
9702 return; 9673 return;
9703 } 9674 }
9704 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9675 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9705 v15 = (int)((char *)v0 + 36 * (v53 - 1)); 9676 v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v53 - 1));
9706 *(char *)(v15 + 556) = 0; 9677 *(char *)(v15 + 556) = 0;
9707 pParty->pPickedItem.Reset(); 9678 pParty->pPickedItem.Reset();
9708 pParty->SetHoldingItem((ItemGen *)(v15 + 532)); 9679 pParty->SetHoldingItem((ItemGen *)(v15 + 532));
9709 _this.uBodyAnchor = 1; 9680 _this.uBodyAnchor = 1;
9710 v16 = v52 + 1; 9681 v16 = v52 + 1;
9711 memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52])); 9682 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
9712 v0->pEquipment.uShield = v16; 9683 pPlayers[uActiveCharacter]->pEquipment.uShield = v16;
9713 } 9684 }
9714 v0->pEquipment.uMainHand = 0; 9685 pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0;
9715 return; 9686 return;
9716 case 0u: 9687 case 0u:
9717 case 0xCu: 9688 case 0xCu:
9718 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) 9689 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
9719 && pParty->pPickedItem.uItemID != 64 9690 && pParty->pPickedItem.uItemID != 64
9720 && pParty->pPickedItem.uItemID != 65 ) 9691 && pParty->pPickedItem.uItemID != 65 )
9721 { 9692 {
9722 v46 = 0; 9693 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9723 v45 = 0;
9724 v44 = 0;
9725 v43 = 0;
9726 v42 = -1;
9727 v41 = 0;
9728 v40 = 0;
9729 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9730 return; 9694 return;
9731 } 9695 }
9732 if ( !v0->HasSkill(v4) ) 9696 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
9733 { 9697 {
9734 v0->PlaySound(SPEECH_39, 0); 9698 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9735 return; 9699 return;
9736 } 9700 }
9737 v50 = 0; 9701 v50 = 0;
9738 if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) 9702 if ( v4 == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0)
9739 || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) 9703 || v4 == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 )
9740 { 9704 {
9741 if (pAsyncMouse) 9705 if (pAsyncMouse)
9742 { 9706 {
9743 v18 = *((int *)pAsyncMouse + 6); 9707 v18 = *((int *)pAsyncMouse + 6);
9744 v19 = *((int *)pAsyncMouse + 7); 9708 v19 = *((int *)pAsyncMouse + 7);
9755 { 9719 {
9756 if ( v54 ) 9720 if ( v54 )
9757 { 9721 {
9758 --v54; 9722 --v54;
9759 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9723 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9760 v20 = (int)((char *)v0 + 36 * v54); 9724 v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54);
9761 *(char *)(v20 + 556) = 0; 9725 *(char *)(v20 + 556) = 0;
9762 pParty->pPickedItem.Reset(); 9726 pParty->pPickedItem.Reset();
9763 pParty->SetHoldingItem((ItemGen *)(v20 + 532)); 9727 pParty->SetHoldingItem((ItemGen *)(v20 + 532));
9764 _this.uBodyAnchor = 1; 9728 _this.uBodyAnchor = 1;
9765 v21 = v54 + 1; 9729 v21 = v54 + 1;
9766 v14 = v52 == 12; 9730 v14 = v52 == 12;
9767 memcpy((void *)(v20 + 532), &_this, 0x24u); 9731 memcpy((void *)(v20 + 532), &_this, 0x24u);
9768 v0->pEquipment.uShield = v21; 9732 pPlayers[uActiveCharacter]->pEquipment.uShield = v21;
9769 if ( !v14 ) 9733 if ( !v14 )
9770 return; 9734 return;
9771 v22 = _this.uItemID; 9735 v22 = _this.uItemID;
9772 v50 = v22; 9736 v50 = v22;
9773 if ( v50 ) 9737 if ( v50 )
9777 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), 9741 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
9778 uActiveCharacter - 1 + 9); 9742 uActiveCharacter - 1 + 9);
9779 } 9743 }
9780 break; 9744 break;
9781 } 9745 }
9782 v23 = v0->FindFreeInventorySlot(); 9746 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
9783 if ( (v23 & 0x80000000u) != 0 ) 9747 if ( (v23 & 0x80000000u) != 0 )
9784 return; 9748 return;
9785 pParty->pPickedItem.uBodyAnchor = 1; 9749 pParty->pPickedItem.uBodyAnchor = 1;
9786 v50 = (unsigned int)&v0->pInventoryItems[v23]; 9750 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23];
9787 memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23])); 9751 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23]));
9788 v0->pEquipment.uShield = v23 + 1; 9752 pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1;
9789 pMouse->RemoveHoldingItem(); 9753 pMouse->RemoveHoldingItem();
9790 if ( v52 != 12 ) 9754 if ( v52 != 12 )
9791 return; 9755 return;
9792 v22 = *(int *)v50; 9756 v22 = *(int *)v50;
9793 v50 = v22; 9757 v50 = v22;
9801 } 9765 }
9802 } 9766 }
9803 } 9767 }
9804 if ( !v53 ) 9768 if ( !v53 )
9805 { 9769 {
9806 v26 = v0->FindFreeInventorySlot(); 9770 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
9807 if ( (v26 & 0x80000000u) != 0 ) 9771 if ( (v26 & 0x80000000u) != 0 )
9808 return; 9772 return;
9809 pParty->pPickedItem.uBodyAnchor = 2; 9773 pParty->pPickedItem.uBodyAnchor = 2;
9810 v50 = (unsigned int)&v0->pInventoryItems[v26]; 9774 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26];
9811 memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26])); 9775 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26]));
9812 v0->pEquipment.uMainHand = v26 + 1; 9776 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1;
9813 pMouse->RemoveHoldingItem(); 9777 pMouse->RemoveHoldingItem();
9814 if ( v52 != 12 ) 9778 if ( v52 != 12 )
9815 return; 9779 return;
9816 v22 = *(int *)v50; 9780 v22 = *(int *)v50;
9817 v50 = v22; 9781 v50 = v22;
9824 } 9788 }
9825 break; 9789 break;
9826 } 9790 }
9827 --v53; 9791 --v53;
9828 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9792 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9829 v24 = (int)((char *)v0 + 36 * v53); 9793 v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53);
9830 *(char *)(v24 + 556) = 0; 9794 *(char *)(v24 + 556) = 0;
9831 pParty->pPickedItem.Reset(); 9795 pParty->pPickedItem.Reset();
9832 pParty->SetHoldingItem((ItemGen *)(v24 + 532)); 9796 pParty->SetHoldingItem((ItemGen *)(v24 + 532));
9833 _this.uBodyAnchor = 2; 9797 _this.uBodyAnchor = 2;
9834 v25 = v53 + 1; 9798 v25 = v53 + 1;
9835 v14 = v52 == 12; 9799 v14 = v52 == 12;
9836 memcpy((void *)(v24 + 532), &_this, 0x24u); 9800 memcpy((void *)(v24 + 532), &_this, 0x24u);
9837 v0->pEquipment.uMainHand = v25; 9801 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25;
9838 if ( v14 ) 9802 if ( v14 )
9839 v50 = _this.uItemID; 9803 v50 = _this.uItemID;
9840 if ( v51 ) 9804 if ( v51 )
9841 v0->pEquipment.uShield = 0; 9805 pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
9842 if ( v50 ) 9806 if ( v50 )
9843 { 9807 {
9844 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 9808 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
9845 stru_A750F8[uActiveCharacter - 1]._494836( 9809 stru_A750F8[uActiveCharacter - 1]._494836(
9846 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), 9810 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
9848 } 9812 }
9849 break; 9813 break;
9850 case 1u: 9814 case 1u:
9851 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 9815 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
9852 { 9816 {
9853 v46 = 0; 9817 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9854 v45 = 0;
9855 v44 = 0;
9856 v43 = 0;
9857 v42 = -1;
9858 v41 = 0;
9859 v40 = 0;
9860 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9861 return; 9818 return;
9862 } 9819 }
9863 if ( !v0->HasSkill(v4) ) 9820 if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
9864 { 9821 {
9865 v0->PlaySound(SPEECH_39, 0); 9822 pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
9866 return; 9823 return;
9867 } 9824 }
9868 if ( v53 ) 9825 if ( v53 )
9869 { 9826 {
9870 if ( v54 ) 9827 if ( v54 )
9871 { 9828 {
9872 v46 = 0; 9829 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9873 v45 = 0;
9874 v44 = 0;
9875 v43 = 0;
9876 v42 = -1;
9877 v41 = 0;
9878 v40 = 0;
9879 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9880 return; 9830 return;
9881 } 9831 }
9882 --v53; 9832 --v53;
9883 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9833 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9884 v27 = (int)((char *)v0 + 36 * v53); 9834 v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53);
9885 *(char *)(v27 + 556) = 0; 9835 *(char *)(v27 + 556) = 0;
9886 pParty->pPickedItem.Reset(); 9836 pParty->pPickedItem.Reset();
9887 pParty->SetHoldingItem((ItemGen *)(v27 + 532)); 9837 pParty->SetHoldingItem((ItemGen *)(v27 + 532));
9888 _this.uBodyAnchor = 2; 9838 _this.uBodyAnchor = 2;
9889 v28 = v53 + 1; 9839 v28 = v53 + 1;
9890 memcpy((void *)(v27 + 532), &_this, 0x24u); 9840 memcpy((void *)(v27 + 532), &_this, 0x24u);
9891 v0->pEquipment.uMainHand = v28; 9841 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28;
9892 } 9842 }
9893 else 9843 else
9894 { 9844 {
9895 v52 = v0->FindFreeInventorySlot(); 9845 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
9896 if ( (v52 & 0x80000000u) == 0 ) 9846 if ( (v52 & 0x80000000u) == 0 )
9897 { 9847 {
9898 if ( v54 ) 9848 if ( v54 )
9899 { 9849 {
9900 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 9850 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
9901 v29 = (int)((char *)v0 + 36 * (v54 - 1)); 9851 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v54 - 1));
9902 *(char *)(v29 + 556) = 0; 9852 *(char *)(v29 + 556) = 0;
9903 pParty->pPickedItem.Reset(); 9853 pParty->pPickedItem.Reset();
9904 pParty->SetHoldingItem((ItemGen *)(v29 + 532)); 9854 pParty->SetHoldingItem((ItemGen *)(v29 + 532));
9905 _this.uBodyAnchor = 2; 9855 _this.uBodyAnchor = 2;
9906 v30 = v52 + 1; 9856 v30 = v52 + 1;
9907 memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52])); 9857 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
9908 v0->pEquipment.uShield = 0; 9858 pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
9909 v0->pEquipment.uMainHand = v30; 9859 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30;
9910 } 9860 }
9911 else 9861 else
9912 { 9862 {
9913 pParty->pPickedItem.uBodyAnchor = 2; 9863 pParty->pPickedItem.uBodyAnchor = 2;
9914 v31 = v52 + 1; 9864 v31 = v52 + 1;
9915 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 9865 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
9916 v0->pEquipment.uMainHand = v31; 9866 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31;
9917 pMouse->RemoveHoldingItem(); 9867 pMouse->RemoveHoldingItem();
9918 } 9868 }
9919 } 9869 }
9920 } 9870 }
9921 return; 9871 return;
9922 default: 9872 default:
9923 v0->UseItem_DrinkPotion_etc(uActiveCharacter, 0); 9873 pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);
9924 return; 9874 return;
9925 } 9875 }
9926 return; 9876 return;
9927 } 9877 }
9928 if (pAsyncMouse) 9878 if (pAsyncMouse)
9939 } 9889 }
9940 v34 = pRenderer->pActiveZBuffer[v32 + pSRZBufferLineOffsets[v33]] & 0xFFFF; 9890 v34 = pRenderer->pActiveZBuffer[v32 + pSRZBufferLineOffsets[v33]] & 0xFFFF;
9941 if ( v34 ) 9891 if ( v34 )
9942 { 9892 {
9943 v36 = v34 - 1; 9893 v36 = v34 - 1;
9944 v37 = (int)((char *)v0 + 36 * v36); 9894 v37 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v36);
9945 v50 = v37; 9895 v50 = v37;
9946 v38 = (ItemGen *)(v37 + 532); 9896 v38 = (ItemGen *)(v37 + 532);
9947 v14 = v38->uItemID == 604; 9897 v14 = v38->uItemID == 604;
9948 v52 = pItemsTable->pItems[v38->uItemID].uEquipType; 9898 v52 = pItemsTable->pItems[v38->uItemID].uEquipType;
9949 if ( v14 ) 9899 if ( v14 )
9950 { 9900 {
9951 if ( bUnderwater ) 9901 if ( bUnderwater )
9952 { 9902 {
9953 v46 = 0; 9903 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
9954 v45 = 0;
9955 v44 = 0;
9956 v43 = 0;
9957 v42 = -1;
9958 v41 = 0;
9959 v40 = 0;
9960 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
9961 return; 9904 return;
9962 } 9905 }
9963 WetsuitOff(uActiveCharacter); 9906 WetsuitOff(uActiveCharacter);
9964 } 9907 }
9965 if ( unk_50C9A0 ) 9908 if ( unk_50C9A0 )
9981 else 9924 else
9982 { 9925 {
9983 if ( !ptr_50C9A4 ) 9926 if ( !ptr_50C9A4 )
9984 { 9927 {
9985 pParty->SetHoldingItem(v38); 9928 pParty->SetHoldingItem(v38);
9986 *(&v0->uBirthYear + *(char *)(v50 + 556)) = 0; 9929 *(&pPlayers[uActiveCharacter]->uBirthYear + *(char *)(v50 + 556)) = 0;
9987 v38->Reset(); 9930 v38->Reset();
9988 } 9931 }
9989 } 9932 }
9990 } 9933 }
9991 else 9934 else
9992 { 9935 {
9993 v35 = v0->pEquipment.uBow; 9936 v35 = pPlayers[uActiveCharacter]->pEquipment.uBow;
9994 if ( v35 ) 9937 if ( v35 )
9995 { 9938 {
9996 auto _a = (ItemGen *)&v0->pInventoryItems[v35-1]; 9939 auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35-1];
9997 pParty->SetHoldingItem(_a); 9940 pParty->SetHoldingItem(_a);
9998 _a->Reset(); 9941 _a->Reset();
9999 v0->pEquipment.uBow = 0; 9942 pPlayers[uActiveCharacter]->pEquipment.uBow = 0;
10000 } 9943 }
10001 } 9944 }
10002 } 9945 }
10003 9946
10004 //----- (0046A0A1) -------------------------------------------------------- 9947 //----- (0046A0A1) --------------------------------------------------------