comparison UI/UICharacter.cpp @ 1365:b691c96d8e06

Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
author Grumpy7
date Mon, 15 Jul 2013 02:34:52 +0200
parents 61010a655c94
children b51332ab228f
comparison
equal deleted inserted replaced
1364:9014784ae84f 1365:b691c96d8e06
2638 unsigned int v3; // edx@4 2638 unsigned int v3; // edx@4
2639 unsigned int pSkillType; // esi@5 2639 unsigned int pSkillType; // esi@5
2640 unsigned __int16 v5; // ax@7 2640 unsigned __int16 v5; // ax@7
2641 unsigned int v6; // edi@19 2641 unsigned int v6; // edi@19
2642 int v7; // esi@27 2642 int v7; // esi@27
2643 unsigned int v8; // eax@29 2643 int v8; // eax@29
2644 int v9; // edx@32 2644 int v9; // edx@32
2645 int v10; // esi@34 2645 int v10; // esi@34
2646 int v11; // eax@34 2646 int v11; // eax@34
2647 int v12; // esi@38 2647 int v12; // esi@38
2648 int v13; // eax@38 2648 int v13; // eax@38
2653 unsigned int v18; // ecx@55 2653 unsigned int v18; // ecx@55
2654 unsigned int v19; // eax@55 2654 unsigned int v19; // eax@55
2655 int v20; // esi@60 2655 int v20; // esi@60
2656 int v21; // eax@60 2656 int v21; // eax@60
2657 unsigned int v22; // eax@61 2657 unsigned int v22; // eax@61
2658 unsigned int v23; // eax@62 2658 int v23; // eax@62
2659 int v24; // esi@65 2659 int v24; // esi@65
2660 int v25; // eax@65 2660 int v25; // eax@65
2661 unsigned int v26; // eax@69 2661 int v26; // eax@69
2662 int v27; // esi@81 2662 int v27; // esi@81
2663 int v28; // eax@81 2663 int v28; // eax@81
2664 int v29; // esi@84 2664 int v29; // esi@84
2665 int v30; // eax@84 2665 int v30; // eax@84
2666 int v31; // eax@85 2666 int v31; // eax@85
2675 ItemGen _this; // [sp+Ch] [bp-40h]@1 2675 ItemGen _this; // [sp+Ch] [bp-40h]@1
2676 unsigned int v48; // [sp+30h] [bp-1Ch]@88 2676 unsigned int v48; // [sp+30h] [bp-1Ch]@88
2677 unsigned int v49; // [sp+34h] [bp-18h]@57 2677 unsigned int v49; // [sp+34h] [bp-18h]@57
2678 unsigned int v50; // [sp+38h] [bp-14h]@50 2678 unsigned int v50; // [sp+38h] [bp-14h]@50
2679 int v51; // [sp+3Ch] [bp-10h]@1 2679 int v51; // [sp+3Ch] [bp-10h]@1
2680 unsigned int v52; // [sp+40h] [bp-Ch]@5 2680 int v52; // [sp+40h] [bp-Ch]@5
2681 //int v53; // [sp+44h] [bp-8h]@1 2681 //int v53; // [sp+44h] [bp-8h]@1
2682 //unsigned int v54; // [sp+48h] [bp-4h]@1 2682 //unsigned int v54; // [sp+48h] [bp-4h]@1
2683 2683
2684 v51 = 0; 2684 v51 = 0;
2685 _this.Reset(); 2685 _this.Reset();
2770 while ( 1 ) 2770 while ( 1 )
2771 { 2771 {
2772 if ( !*(int *)v7 ) 2772 if ( !*(int *)v7 )
2773 { 2773 {
2774 v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); 2774 v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
2775 if ( (v8 & 0x80000000u) == 0 ) 2775 if ( v8 >= 0 )
2776 { 2776 {
2777 v9 = v52; 2777 v9 = v52;
2778 pParty->pPickedItem.uBodyAnchor = v52 + 1; 2778 pParty->pPickedItem.uBodyAnchor = v52 + 1;
2779 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8])); 2779 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8]));
2780 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1; 2780 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1;
2829 return; 2829 return;
2830 } 2830 }
2831 else 2831 else
2832 { 2832 {
2833 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); 2833 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
2834 if ( (v52 & 0x80000000u) != 0 ) 2834 if ( v52 < 0 )
2835 return; 2835 return;
2836 if ( !v51 ) 2836 if ( !v51 )
2837 { 2837 {
2838 pParty->pPickedItem.uBodyAnchor = 1; 2838 pParty->pPickedItem.uBodyAnchor = 1;
2839 v17 = v52 + 1; 2839 v17 = v52 + 1;
2904 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); 2904 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9);
2905 } 2905 }
2906 break; 2906 break;
2907 } 2907 }
2908 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); 2908 v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
2909 if ( (v23 & 0x80000000u) != 0 ) 2909 if ( v23 < 0 )
2910 return; 2910 return;
2911 pParty->pPickedItem.uBodyAnchor = 1; 2911 pParty->pPickedItem.uBodyAnchor = 1;
2912 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23]; 2912 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23];
2913 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23])); 2913 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23]));
2914 pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; 2914 pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1;
2927 } 2927 }
2928 } 2928 }
2929 if ( !v1 ) 2929 if ( !v1 )
2930 { 2930 {
2931 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); 2931 v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
2932 if ( (v26 & 0x80000000u) != 0 ) 2932 if ( v26 < 0 )
2933 return; 2933 return;
2934 pParty->pPickedItem.uBodyAnchor = 2; 2934 pParty->pPickedItem.uBodyAnchor = 2;
2935 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26]; 2935 v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26];
2936 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26])); 2936 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26]));
2937 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; 2937 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1;
2998 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28; 2998 pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28;
2999 } 2999 }
3000 else 3000 else
3001 { 3001 {
3002 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); 3002 v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
3003 if ( (v52 & 0x80000000u) == 0 ) 3003 if ( v52 >= 0 )
3004 { 3004 {
3005 if ( v2 ) 3005 if ( v2 )
3006 { 3006 {
3007 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 3007 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
3008 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v2 - 1)); 3008 v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v2 - 1));