comparison Player.cpp @ 281:ccf14ac29caf

Слияние
author Ritor1
date Sun, 17 Feb 2013 20:41:39 +0600
parents f66106b5d144 c879446b4a22
children 87ab1603c937
comparison
equal deleted inserted replaced
280:f66106b5d144 281:ccf14ac29caf
255 while ( 1 ) 255 while ( 1 )
256 { 256 {
257 result = v2->uOffHand; 257 result = v2->uOffHand;
258 if ( v2->uOffHand ) 258 if ( v2->uOffHand )
259 { 259 {
260 result = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * result + 5]; 260 result = *(int *)&this->pInventoryItems[result-1];
261 if ( result ) 261 if ( result )
262 { 262 {
263 if ( result != 64 && result != 65 ) 263 if ( result != 64 && result != 65 )
264 break; 264 break;
265 } 265 }
1761 void *v9; // edx@4 1761 void *v9; // edx@4
1762 unsigned int uSlota; // [sp+14h] [bp+4h]@1 1762 unsigned int uSlota; // [sp+14h] [bp+4h]@1
1763 1763
1764 pIndices = &this->pInventoryIndices[uSlot]; 1764 pIndices = &this->pInventoryIndices[uSlot];
1765 1765
1766 __debugbreak(); // the following indexing is invalid 1766 v3 = &this->pInventoryItems[*pIndices-1];
1767 v3 = (ItemGen *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *pIndices + 5];
1768 v4 = v3->uItemID; 1767 v4 = v3->uItemID;
1769 v3->Reset(); 1768 v3->Reset();
1770 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); 1769 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
1771 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); 1770 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
1772 uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); 1771 uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24);
2391 pIcons_LOD->_40F9C5(); 2390 pIcons_LOD->_40F9C5();
2392 } 2391 }
2393 goto LABEL_15; 2392 goto LABEL_15;
2394 } 2393 }
2395 } 2394 }
2396 memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); 2395 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u);
2397 pItem->Reset(); 2396 pItem->Reset();
2398 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); 2397 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
2399 v19->PlaySound(SPEECH_60, 0); 2398 v19->PlaySound(SPEECH_60, 0);
2400 if ( !v21 ) 2399 if ( !v21 )
2401 { 2400 {
2786 v34 = v4; 2785 v34 = v4;
2787 goto LABEL_62; 2786 goto LABEL_62;
2788 } 2787 }
2789 if ( HasItemEquipped(EQUIP_TWO_HANDED) ) 2788 if ( HasItemEquipped(EQUIP_TWO_HANDED) )
2790 { 2789 {
2791 v6 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uMainHand + 5]; 2790 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1];
2792 v7 = v6->uItemID; 2791 v7 = v6->uItemID;
2793 v8 = v6->uItemID; 2792 v8 = v6->uItemID;
2794 v9 = pItemsTable->pItems[v8].uDamageDice; 2793 v9 = pItemsTable->pItems[v8].uDamageDice;
2795 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) 2794 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand )
2796 ++v9; 2795 ++v9;
2858 v29 = 0; 2857 v29 = 0;
2859 if ( !a3 ) 2858 if ( !a3 )
2860 { 2859 {
2861 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) 2860 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) )
2862 { 2861 {
2863 v15 = (ItemGen *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v5->pEquipment.uOffHand + 5]; 2862 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1];
2864 v16 = v15->uItemID; 2863 v16 = v15->uItemID;
2865 v17 = v15->uItemID; 2864 v17 = v15->uItemID;
2866 if ( pItemsTable->pItems[v17].uEquipType != 4 ) 2865 if ( pItemsTable->pItems[v17].uEquipType != 4 )
2867 { 2866 {
2868 v31 = pItemsTable->pItems[v17].uDamageRoll; 2867 v31 = pItemsTable->pItems[v17].uDamageRoll;
2951 int v5; // edi@4 2950 int v5; // edi@4
2952 int v6; // edi@4 2951 int v6; // edi@4
2953 int v7; // edi@4 2952 int v7; // edi@4
2954 2953
2955 v1 = this; 2954 v1 = this;
2956 v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; 2955 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
2957 if ( v2 < 64 || v2 > 65 ) 2956 if ( v2 < 64 || v2 > 65 )
2958 { 2957 {
2959 v4 = GetActualAccuracy(); 2958 v4 = GetActualAccuracy();
2960 v5 = _48EA1B_get_static_effect(v4); 2959 v5 = _48EA1B_get_static_effect(v4);
2961 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; 2960 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5;
3041 v2 = this; 3040 v2 = this;
3042 v14 = this; 3041 v14 = this;
3043 result = HasItemEquipped(EQUIP_BOW); 3042 result = HasItemEquipped(EQUIP_BOW);
3044 if ( !result ) 3043 if ( !result )
3045 return result; 3044 return result;
3046 v4 = (ItemGen *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2->pEquipment.uBow + 5]; 3045 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1];
3047 v5 = v4->uItemID; 3046 v5 = v4->uItemID;
3048 v6 = v4->uItemID; 3047 v6 = v4->uItemID;
3049 v15 = pItemsTable->pItems[v6].uDamageRoll; 3048 v15 = pItemsTable->pItems[v6].uDamageRoll;
3050 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) 3049 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 )
3051 { 3050 {
3112 signed int v9; // esi@9 3111 signed int v9; // esi@9
3113 3112
3114 static char player__getmeleedamagestring_static_buff[40]; // idb 3113 static char player__getmeleedamagestring_static_buff[40]; // idb
3115 3114
3116 v1 = this; 3115 v1 = this;
3117 v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; 3116 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
3118 if ( v2 < 64 || v2 > 65 ) 3117 if ( v2 < 64 || v2 > 65 )
3119 { 3118 {
3120 v3 = GetMeleeDamageMinimal(); 3119 v3 = GetMeleeDamageMinimal();
3121 v4 = GetMeleeDamageMaximal(); 3120 v4 = GetMeleeDamageMaximal();
3122 } 3121 }
3138 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); 3137 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4);
3139 } 3138 }
3140 v8 = v1->pEquipment.uMainHand; 3139 v8 = v1->pEquipment.uMainHand;
3141 if ( v8 ) 3140 if ( v8 )
3142 { 3141 {
3143 v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; 3142 v9 = *(int *)&v1->pInventoryItems[v8-1];
3144 if ( v9 >= 135 ) 3143 if ( v9 >= 135 )
3145 { 3144 {
3146 if ( v9 <= 159 ) 3145 if ( v9 <= 159 )
3147 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); 3146 strcpy(v6, pGlobalTXT_LocalizationStrings[595]);
3148 } 3147 }
3164 signed int v9; // esi@11 3163 signed int v9; // esi@11
3165 3164
3166 static char player__getrangeddamagestring_static_buff[40]; // idb 3165 static char player__getrangeddamagestring_static_buff[40]; // idb
3167 3166
3168 v1 = this; 3167 v1 = this;
3169 v2 = *(int *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * this->pEquipment.uMainHand + 5]; 3168 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1];
3170 if ( v2 < 64 || v2 > 65 ) 3169 if ( v2 < 64 || v2 > 65 )
3171 { 3170 {
3172 v3 = GetRangedDamageMin(); 3171 v3 = GetRangedDamageMin();
3173 v4 = GetRangedDamageMax(); 3172 v4 = GetRangedDamageMax();
3174 } 3173 }
3198 strcpy(player__getrangeddamagestring_static_buff, "N/A"); 3197 strcpy(player__getrangeddamagestring_static_buff, "N/A");
3199 } 3198 }
3200 v8 = v1->pEquipment.uMainHand; 3199 v8 = v1->pEquipment.uMainHand;
3201 if ( v8 ) 3200 if ( v8 )
3202 { 3201 {
3203 v9 = *(int *)&v1->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; 3202 v9 = *(int *)&v1->pInventoryItems[v8-1];
3204 if ( v9 >= 135 ) 3203 if ( v9 >= 135 )
3205 { 3204 {
3206 if ( v9 <= 159 ) 3205 if ( v9 <= 159 )
3207 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); 3206 strcpy(v5, pGlobalTXT_LocalizationStrings[595]);
3208 } 3207 }
3862 v20 = this->pInventoryIndices; 3861 v20 = this->pInventoryIndices;
3863 do 3862 do
3864 { 3863 {
3865 if ( *v20 > 0 ) 3864 if ( *v20 > 0 )
3866 { 3865 {
3867 v21 = *(int *)&v5->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *v20 + 5]; 3866 v21 = *(int *)&v5->pInventoryItems[*v20-1];
3868 if ( v21 > 0 ) 3867 if ( v21 > 0 )
3869 { 3868 {
3870 if ( v21 <= 134 ) 3869 if ( v21 <= 134 )
3871 v46[v4++] = v19; 3870 v46[v4++] = v19;
3872 } 3871 }
4142 v46 = 0; 4141 v46 = 0;
4143 if ( a2 ) 4142 if ( a2 )
4144 { 4143 {
4145 if ( !HasItemEquipped(EQUIP_BOW) ) 4144 if ( !HasItemEquipped(EQUIP_BOW) )
4146 goto LABEL_17; 4145 goto LABEL_17;
4147 v5 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBow + 5]; 4146 v5 = (int)&v4->pInventoryItems[v4->pEquipment.uBow-1];
4148 v46 = v5; 4147 v46 = v5;
4149 v3 = (char *)&pItemsTable->pItems[*(int *)v5].pIconName; 4148 v3 = (char *)&pItemsTable->pItems[*(int *)v5].pIconName;
4150 v6 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; 4149 v6 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]];
4151 goto LABEL_4; 4150 goto LABEL_4;
4152 } 4151 }
4161 goto LABEL_17; 4160 goto LABEL_17;
4162 } 4161 }
4163 } 4162 }
4164 if ( HasItemEquipped(EQUIP_TWO_HANDED) ) 4163 if ( HasItemEquipped(EQUIP_TWO_HANDED) )
4165 { 4164 {
4166 v8 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uMainHand + 5]; 4165 v8 = (int)&v4->pInventoryItems[v4->pEquipment.uMainHand-1];
4167 v46 = v8; 4166 v46 = v8;
4168 v9 = *(int *)v8; 4167 v9 = *(int *)v8;
4169 v3 = (char *)&pItemsTable->pItems[v9].pIconName; 4168 v3 = (char *)&pItemsTable->pItems[v9].pIconName;
4170 if ( v3[28] == 12 ) 4169 if ( v3[28] == 12 )
4171 v10 = *(&pSpellDatas[0].field_A + 10 * *((int *)&pSpellDatas[66].field_8 + v9)); 4170 v10 = *(&pSpellDatas[0].field_A + 10 * *((int *)&pSpellDatas[66].field_8 + v9));
4173 v10 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]]; 4172 v10 = (unsigned __int16)word_4EDED8[(unsigned __int8)v3[29]];
4174 v47 = v10; 4173 v47 = v10;
4175 } 4174 }
4176 if ( HasItemEquipped((ITEM_EQUIP_TYPE)0) ) 4175 if ( HasItemEquipped((ITEM_EQUIP_TYPE)0) )
4177 { 4176 {
4178 v12 = (int)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uOffHand + 5]; 4177 v12 = (int)&v4->pInventoryItems[v4->pEquipment.uOffHand-1];
4179 v42 = (unsigned __int16)word_4EDED8[pItemsTable->pItems[*(int *)v12].uSkillType]; 4178 v42 = (unsigned __int16)word_4EDED8[pItemsTable->pItems[*(int *)v12].uSkillType];
4180 if ( (signed int)v42 > v47 ) 4179 if ( (signed int)v42 > v47 )
4181 { 4180 {
4182 v13 = *(int *)v12; 4181 v13 = *(int *)v12;
4183 v46 = v12; 4182 v46 = v12;
4187 v2 = 0; 4186 v2 = 0;
4188 } 4187 }
4189 LABEL_17: 4188 LABEL_17:
4190 if ( HasItemEquipped(EQUIP_ARMOUR) ) 4189 if ( HasItemEquipped(EQUIP_ARMOUR) )
4191 { 4190 {
4192 v14 = pItemsTable->pItems[*(int *)&v4->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4->pEquipment.uBody + 5]].uSkillType; 4191 v14 = pItemsTable->pItems[*(int *)&v4->pInventoryItems[v4->pEquipment.uBody-1]].uSkillType;
4193 SkillToMastery(v4->pActiveSkills[9]); 4192 SkillToMastery(v4->pActiveSkills[9]);
4194 v15 = (unsigned __int16)word_4EDED8[v14]; 4193 v15 = (unsigned __int16)word_4EDED8[v14];
4195 v35 = 1.0; 4194 v35 = 1.0;
4196 v43 = v15; 4195 v43 = v15;
4197 if ( v14 == 9 ) 4196 if ( v14 == 9 )
4870 if ( (signed int)attr < 29 ) 4869 if ( (signed int)attr < 29 )
4871 return v5 + v62 + v61; 4870 return v5 + v62 + v61;
4872 if ( (signed int)attr <= 30 ) 4871 if ( (signed int)attr <= 30 )
4873 { 4872 {
4874 if ( HasItemEquipped(EQUIP_BOW) ) 4873 if ( HasItemEquipped(EQUIP_BOW) )
4875 v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]].uDamageMod; 4874 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod;
4876 return v5 + v62 + v61; 4875 return v5 + v62 + v61;
4877 } 4876 }
4878 if ( attr == 31 ) 4877 if ( attr == 31 )
4879 { 4878 {
4880 if ( !HasItemEquipped(EQUIP_BOW) ) 4879 if ( !HasItemEquipped(EQUIP_BOW) )
4881 return v5 + v62 + v61; 4880 return v5 + v62 + v61;
4882 v57 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]; 4881 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1];
4883 v5 = pItemsTable->pItems[v57].uDamageMod; 4882 v5 = pItemsTable->pItems[v57].uDamageMod;
4884 v56 = pItemsTable->pItems[v57].uDamageDice; 4883 v56 = pItemsTable->pItems[v57].uDamageDice;
4885 goto LABEL_366; 4884 goto LABEL_366;
4886 } 4885 }
4887 if ( attr == 32 ) 4886 if ( attr == 32 )
4888 { 4887 {
4889 if ( !HasItemEquipped(EQUIP_BOW) ) 4888 if ( !HasItemEquipped(EQUIP_BOW) )
4890 return v5 + v62 + v61; 4889 return v5 + v62 + v61;
4891 v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uBow + 5]; 4890 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1];
4892 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; 4891 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll;
4893 LABEL_365: 4892 LABEL_365:
4894 v56 = pItemsTable->pItems[v20].uDamageMod; 4893 v56 = pItemsTable->pItems[v20].uDamageMod;
4895 LABEL_366: 4894 LABEL_366:
4896 v5 += v56; 4895 v5 += v56;
5519 { 5518 {
5520 v17 = this->GetEquippedItemEquipType(1u); 5519 v17 = this->GetEquippedItemEquipType(1u);
5521 if ( v17 >= 0 ) 5520 if ( v17 >= 0 )
5522 { 5521 {
5523 if ( v17 <= 2 ) 5522 if ( v17 <= 2 )
5524 v5 = pItemsTable->pItems[*(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uMainHand + 5]].uDamageMod; 5523 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod;
5525 } 5524 }
5526 } 5525 }
5527 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 ) 5526 if ( a3 || !v6->HasItemEquipped((ITEM_EQUIP_TYPE)0) || (v19 = v18->GetEquippedItemEquipType(0), v19 < 0) || v19 > 2 )
5528 return v5 + v62 + v61; 5527 return v5 + v62 + v61;
5529 v20 = *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6->pEquipment.uOffHand + 5]; 5528 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1];
5530 goto LABEL_365; 5529 goto LABEL_365;
5531 } 5530 }
5532 if ( attr == 27 ) 5531 if ( attr == 27 )
5533 { 5532 {
5534 if ( IsUnarmed() == 1 ) 5533 if ( IsUnarmed() == 1 )