Mercurial > mm7
changeset 222:8113753ed2ae
more item init fixing
author | Gloval |
---|---|
date | Sun, 17 Feb 2013 11:29:10 +0400 |
parents | 821fd955c379 |
children | 1bd823f52e3a |
files | AudioPlayer.cpp Items.cpp Items.h Player.cpp mm7_1.cpp mm7_5.cpp mm7_6.cpp |
diffstat | 7 files changed, 800 insertions(+), 480 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/AudioPlayer.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -2066,7 +2066,7 @@ int Data; // [sp+Ch] [bp-8h]@1 HKEY hKey; // [sp+10h] [bp-4h]@1 char v6; // [sp+1Ch] [bp+8h]@0 - + v6=0; //to fix hKey = 0; cbData = 4; Data = 0;
--- a/Items.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/Items.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -248,8 +248,8 @@ char v4; // cl@3 int v5; // esi@3 char *v6; // esi@21 - char *v7; // eax@21 - char *v8; // ecx@22 + unsigned char *v7; // eax@21 + unsigned char *v8; // ecx@22 char *v9; // eax@26 char v10; // dl@27 int v11; // ecx@27 @@ -345,7 +345,14 @@ signed int v101; // [sp+20h] [bp-4h]@200 signed int v102; // [sp+20h] [bp-4h]@234 signed int v103; // [sp+20h] [bp-4h]@288 - + int i,j; + char* test_string; + char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; //v1 = this; pMapStats = new MapStats; @@ -368,234 +375,516 @@ pStorylineText->Initialize(); pStdItemsTXT_Raw = 0; - v2 = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0); - pStdItemsTXT_Raw = v2; - strtok(v2, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - Str = (char *)&pEnchantments[0].pParam; - v79 = 24; - do - { - v3 = strtok(0, "\r") + 1; - v97 = 0; - v88 = 0; - do - { - v4 = *v3; - v5 = 0; - while ( v4 != 9 && v4 ) - { - ++v5; - v4 = v3[v5]; - } - v72 = (int)&v3[v5]; - if ( !v3[v5] ) - v88 = 1; - v3[v5] = 0; - if ( v5 ) - { - if ( v97 ) - { - if ( v97 == 1 ) - { - *(unsigned int *)Str = (int)RemoveQuotes(v3); - } - else - { - if ( v97 > 1 ) - Str[v97 + 6] = atoi(v3); - } - } - else - { - *((char **)Str + 1) = RemoveQuotes(v3); - } - } - else - { - if ( !v97 ) - v88 = 1; - } - ++v97; - v3 = (char *)(v72 + 1); - } - while ( v97 <= 10 && !v88 ); - Str += 20; - --v79; - } - while ( v79 ); - v6 = (char *)&field_116D8[3]; - memset(&field_116D8[3], 0, 0x24u); - v7 = &pEnchantments[0].field_8[4]; - v73 = 9; - do - { - v8 = v7; - Stra = 24; - do - { - *(unsigned int *)v6 += (unsigned __int8)*v8; - v8 += 20; - --Stra; - } - while ( Stra ); - v6 += 4; - ++v7; - --v73; - } - while ( v73 ); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - Strb = 17856; - do - { - v9 = strtok(0, "\r") + 1; - v98 = 0; - v89 = 0; - do - { - v10 = *v9; - v11 = 0; - while ( v10 != 9 && v10 ) - { - ++v11; - v10 = v9[v11]; - } - v12 = (int)&v9[v11]; - if ( !v9[v11] ) - v89 = 1; - *(unsigned char *)v12 = 0; - if ( v11 && v98 > 1 ) - *(&pItems[0].uItemID + v98 + Strb) = atoi(v9); - ++v98; - v9 = (char *)(v12 + 1); - } - while ( v98 < 4 && !v89 ); - Strb += 2; - } - while ( Strb < 17868 ); + pStdItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0); + strtok(pStdItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + //Standard Bonuses by Group + for (i=0;i<24;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + pEnchantments[i].pBonusStat=RemoveQuotes(test_string); + break; + case 1: + pEnchantments[i].pOfName= RemoveQuotes(test_string); + break; + default: + pEnchantments[i].to_item[decode_step-2]=atoi(test_string); + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<11)&&!break_loop); + } + //Value Mod= (+100 / Plus of Item)? + + memset(&pEnchantmentsSumm, 0, 36); + for(i=0;i<9;++i) + { + for (j=0;j<24;++j) + pEnchantmentsSumm[i]+=pEnchantments[j].to_item[i]; + } + + //Bonus range for Standard by Level + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + for(i=0;i<6;++i) //counted from 1 + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (decode_step==2) + bonus_ranges[i].minR = atoi(test_string); + else if (decode_step==3) + bonus_ranges[i].maxR =atoi(test_string); + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<4)&&!break_loop); + } + + pSpcItemsTXT_Raw = 0; - v13 = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0); - pSpcItemsTXT_Raw = v13; - strtok(v13, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - v80 = (char *)&pSpecialEnchantments[0].pParam; - Strc = 72; - do - { - v99 = 0; - v14 = (int)(strtok(0, "\r") + 1); - v90 = 0; - do - { - v15 = *(unsigned char *)v14; - v16 = 0; - while ( v15 != 9 && v15 ) - { - ++v16; - v15 = *(unsigned char *)(v16 + v14); - } - v74 = v16 + v14; - if ( !*(unsigned char *)(v16 + v14) ) - v90 = 1; - *(unsigned char *)(v16 + v14) = 0; - if ( v16 ) - { - if ( v99 ) - { - if ( v99 == 1 ) - { - *(char **)v80 = RemoveQuotes((char *)v14); - } - else - { - if ( v99 <= 1 ) - { - v17 = v99 == 14; - } - else - { - v17 = v99 == 14; - if ( v99 < 14 ) - { - v80[v99 + 6] = atoi((const char *)v14); - goto LABEL_63; - } - } - if ( v17 ) - { - v18 = atoi((const char *)v14); - *((unsigned int *)v80 + 5) = v18; - if ( !v18 ) - *((unsigned int *)v80 + 5) = atoi((const char *)(v14 + 1)); - } - else - { - if ( v99 == 15 ) - v80[24] = tolower(*(unsigned char *)v14) - 97; - } - } - } - else - { - *((char **)v80 + 1) = RemoveQuotes((char *)v14); - } - } - else - { - if ( !v99 ) - v90 = 1; - } -LABEL_63: - ++v99; - v14 = v74 + 1; - } - while ( v99 <= 15 && !v90 ); - v80 += 28; - --Strc; - } - while ( Strc ); - v19 = field_11738; - memset(field_11738, 0, 0x60u); - v20 = &pSpecialEnchantments[0].field_8[4]; - Strd = 12; - v21 = 71; - field_11798 = 71; - do - { - v83 = 0; - if ( v21 > 0 ) - { - v22 = v20; - do - { - *v19 += (unsigned __int8)*v22; - ++v83; - v21 = field_11798; - v22 += 28; - } - while ( v83 < v21 ); - } - ++v19; - ++v20; - --Strd; - } - while ( Strd ); + pSpcItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0); + strtok(pSpcItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + for (i=0;i<72;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(test_string); + break; + case 1: + pSpecialEnchantments[i].pNameAdd= RemoveQuotes(test_string); + break; + case 14: + int res; + res=atoi(test_string); + if(!res) + { + ++test_string; + while (*test_string==' ')//fix X 2 case + ++test_string; + res=atoi(test_string); + } + pSpecialEnchantments[i].iValue=res; + break; + case 15: + pSpecialEnchantments[i].iTreasureLevel= tolower(*test_string) - 97;; + break; + default: + pSpecialEnchantments[i].to_item_apply[decode_step-2]=atoi(test_string); + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<16)&&!break_loop); + } + + pSpecialEnchantments_count = 71; + memset(&pSpecialEnchantmentsSumm, 0, 96); + for(i=0;i<12;++i) + { + for (j=0;j<pSpecialEnchantments_count;++j) + pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; + } + + + Initialize2DA(); - pItemsTXT_Raw = 0; - v23 = (char *)pEvents_LOD->LoadRaw("items.txt", 0); - pItemsTXT_Raw = v23; - strtok(v23, "\r"); - v24 = 0; - strtok(0, "\r"); - pItems[0].uItemID = 0; + + pItemsTXT_Raw = NULL; + pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0); + strtok(pItemsTXT_Raw, "\r"); + strtok(NULL, "\r"); + uAllItemsCount = 0; + item_counter = 0; + while (true) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: //Item # + item_counter=atoi(test_string); + uAllItemsCount=item_counter; + break; + case 1: //Pic File + pItems[item_counter].pIconName = RemoveQuotes(test_string); + break; + case 2: //Name + pItems[item_counter].pName = RemoveQuotes(test_string); + break; + case 3: //Value + pItems[item_counter].uValue=atoi(test_string); + break; + case 4: //Equip Stat + { + if ( !_strcmpi(test_string, "weapon") ) + { + pItems[item_counter].uEquipType = 0; + break; + } + if ( !_strcmpi(test_string, "weapon2") ) + { + pItems[item_counter].uEquipType = 1; + break; + } + if ( !_strcmpi(test_string, "weapon1or2") ) + { + pItems[item_counter].uEquipType = 0; + break; + } + if ( !(_strcmpi(test_string, "missile")&&_strcmpi(test_string, "bow"))) + { + pItems[item_counter].uEquipType = 2; + break; + } + if ( !_strcmpi(test_string, "armor") ) + { + pItems[item_counter].uEquipType = 3; + break; + } + if ( !_strcmpi(test_string, "shield") ) + { + pItems[item_counter].uEquipType = 4; + break; + } + if ( !_strcmpi(test_string, "helm") ) + { + pItems[item_counter].uEquipType = 5; + break; + } + if ( !_strcmpi(test_string, "belt") ) + { + pItems[item_counter].uEquipType = 6; + break; + } + if ( !_strcmpi(test_string, "cloak") ) + { + pItems[item_counter].uEquipType = 7; + break; + } + if ( !_strcmpi(test_string, "gauntlets") ) + { + pItems[item_counter].uEquipType = 8; + break; + } + if ( !_strcmpi(test_string, "boots") ) + { + pItems[item_counter].uEquipType = 9; + break; + } + if ( !_strcmpi(test_string, "ring") ) + { + pItems[item_counter].uEquipType = 10; + break; + } + if ( !_strcmpi(test_string, "amulet") ) + { + pItems[item_counter].uEquipType = 11; + break; + } + if ( !_strcmpi(test_string, "weaponw") ) + { + pItems[item_counter].uEquipType = 12; + break; + } + if ( !(_strcmpi(test_string, "herb")&&_strcmpi(test_string, "reagent"))) + { + pItems[item_counter].uEquipType = 13; + break; + } + if ( !_strcmpi(test_string, "bottle") ) + { + pItems[item_counter].uEquipType = 14; + break; + } + if ( !_strcmpi(test_string, "sscroll") ) + { + pItems[item_counter].uEquipType = 15; + break; + } + if ( !_strcmpi(test_string, "book") ) + { + pItems[item_counter].uEquipType = 16; + break; + } + if ( !_strcmpi(test_string, "mscroll") ) + { + pItems[item_counter].uEquipType = 17; + break; + } + if ( !_strcmpi(test_string, "gold") ) + { + pItems[item_counter].uEquipType = 18; + break; + } + if ( !_strcmpi(test_string, "gem") ) + { + pItems[item_counter].uEquipType = 19; + break; + } + pItems[item_counter].uEquipType = 20; + break; + } + case 5: //Skill Group + { + if ( !_strcmpi(test_string, "staff") ) + { + pItems[item_counter].uSkillType = 0; + break; + } + if ( !_strcmpi(test_string, "sword") ) + { + pItems[item_counter].uSkillType = 1; + break; + } + if ( !_strcmpi(test_string, "dagger") ) + { + pItems[item_counter].uSkillType = 2; + break; + } + if ( !_strcmpi(test_string, "axe") ) + { + pItems[item_counter].uSkillType = 3; + break; + } + if ( !_strcmpi(test_string, "spear") ) + { + pItems[item_counter].uSkillType = 4; + break; + } + if ( !_strcmpi(test_string, "bow") ) + { + pItems[item_counter].uSkillType = 5; + break; + } + if ( !_strcmpi(test_string, "mace") ) + { + pItems[item_counter].uSkillType = 6; + break; + } + if ( !_strcmpi(test_string, "blaster") ) + { + pItems[item_counter].uSkillType = 7; + break; + } + if ( !_strcmpi(test_string, "shield") ) + { + pItems[item_counter].uSkillType = 8; + break; + } + if ( !_strcmpi(test_string, "leather") ) + { + pItems[item_counter].uSkillType = 9; + break; + } + if ( !_strcmpi(test_string, "chain") ) + { + pItems[item_counter].uSkillType = 10; + break; + } + if ( !_strcmpi(test_string, "plate") ) + { + pItems[item_counter].uSkillType = 11; + break; + } + if ( !_strcmpi(test_string, "club") ) + { + pItems[item_counter].uSkillType = 37; + break; + } + pItems[item_counter].uSkillType = 38; + break; + } + case 6: //Mod1 + { + int ii; + char* test_char; + int tst_len; + tst_len=strlen(test_string); + pItems[item_counter].uDamageDice=0; + pItems[item_counter].uDamageRoll=0; + test_char=test_string; + for (ii=0; ii<tst_len; ++ii) + { + if (tolower(*test_char)=='d') + { + *test_char=0; + pItems[item_counter].uDamageDice=atoi(test_string); + pItems[item_counter].uDamageRoll=atoi(test_char+1); + *test_char='d'; + break; + } + ++test_char; + } + test_char=test_string; + if ((ii==tst_len)&&(tolower(*test_char)=='s')) + { + pItems[item_counter].uDamageDice=atoi(test_char+1); + pItems[item_counter].uDamageRoll=1; + } + break; + } + case 7: //Mod2 + pItems[item_counter].uDamageMod=atoi(test_string); + break; + case 8: //material + { + if ( !_strcmpi(test_string, "artifact") ) + { + pItems[item_counter].uMaterial = 1; + break; + } + if ( !_strcmpi(test_string, "relic") ) + { + pItems[item_counter].uMaterial = 2; + break; + } + if ( !_strcmpi(test_string, "special") ) + { + pItems[item_counter].uMaterial = 3; + break; + } + pItems[item_counter].uMaterial = 0; + break;} + case 9: //ID/Rep/St + pItems[item_counter].uItemID_Rep_St=atoi(test_string); + break; + case 10: //Not identified name + pItems[item_counter].pUnidentifiedName = RemoveQuotes(test_string); + break; + case 11: //Sprite Index + pItems[item_counter].uSpriteID=atoi(test_string); + break; + case 12: //VarA + pItems[item_counter]._additional_value=0; + pItems[item_counter]._bonus_type=0; + if (pItems[item_counter].uMaterial==3) + { + for(int ii=0; ii<24; ++ii) + { + if (stricmp(test_string,pEnchantments[ii].pBonusStat)) + { + pItems[item_counter]._bonus_type=ii+1; + break; + } + } + if (!pItems[item_counter]._bonus_type) + { + for(int ii=0; ii<72; ++ii) + { + if (stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement)) + { + pItems[item_counter]._additional_value=ii+1; + } + } + } + } + + break; + case 13: //VarB + if ((pItems[item_counter].uMaterial==3)&&(pItems[item_counter]._bonus_type)) + { + char b_s=atoi(test_string); + if (b_s) + pItems[item_counter]._bonus_strength=b_s; + else + pItems[item_counter]._bonus_strength=1; + } + else + pItems[item_counter]._bonus_strength=0; + break; + case 14: //Equip X + pItems[item_counter].uEquipX=atoi(test_string); + break; + case 15: //Equip Y + pItems[item_counter].uEquipY=atoi(test_string); + break; + case 16: //Notes + pItems[item_counter].pDescription = RemoveQuotes(test_string); + break; + + } + } + else + { + if (!decode_step) + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<17)&&!break_loop); + ++item_counter; + if (item_counter>799) + break; + } + +/* while ( 2 ) { v100 = 0; @@ -925,7 +1214,7 @@ if ( v30[37] == 3 ) { v85 = 0; - Strf = (const char **)&pEnchantments[0].pParam; + Strf = (const char **)&pEnchantments[0].pOfName; while ( _strcmpi(*Strf, v25) ) { ++v85; @@ -938,7 +1227,7 @@ if ( !v81[39] ) { v86 = 0; - Strg = (const char **)&pSpecialEnchantments[0].pParam; + Strg = (const char **)&pSpecialEnchantments[0].pNameAdd; while ( _strcmpi(*Strg, v25) ) { ++v86; @@ -995,16 +1284,17 @@ continue; break; } - pRndItemsTXT_Raw = 0; - pItems[0].uItemID = v24; - v33 = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0); - v34 = "\r"; - pRndItemsTXT_Raw = v33; - strtok(v33, "\r"); - v35 = 0; + */ + + pRndItemsTXT_Raw = NULL; + uAllItemsCount = item_counter; + pRndItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0); + strtok(pRndItemsTXT_Raw, "\r"); strtok(0, "\r"); strtok(0, "\r"); strtok(0, "\r"); + + v35 = 0; do { v101 = 0; @@ -1030,22 +1320,22 @@ switch ( v101 ) { case 2: - pItems[v35].field_2C = atoi(v36); + // pItems[v35].field_2C = atoi(v36); break; case 3: - pItems[v35].field_2D = atoi(v36); + // pItems[v35].field_2D = atoi(v36); break; case 4: - pItems[v35].field_2E = atoi(v36); + // pItems[v35].field_2E = atoi(v36); break; case 5: - pItems[v35].field_2F = atoi(v36); + // pItems[v35].field_2F = atoi(v36); break; case 6: - *((unsigned char *)&pItems[0].uItemID + 16 * (3 * v35 + 3)) = atoi(v36); + //*((unsigned char *)&pItems[0].uItemID + 16 * (3 * v35 + 3)) = atoi(v36); break; case 7: - BYTE1(pItems[v35 + 1].uItemID) = atoi(v36); + // BYTE1(pItems[v35 + 1].uItemID) = atoi(v36); break; } } @@ -1066,6 +1356,8 @@ ++v35; } while ( v35 < 619 ); + + if ( pRndItemsTXT_Raw ) { pAllocator->FreeChunk(pRndItemsTXT_Raw); @@ -1091,6 +1383,7 @@ --v77; } while ( v77 ); + v42 = 0; strtok(0, "\r"); strtok(0, "\r"); @@ -1238,6 +1531,9 @@ ++v87; } while ( v87 < 3 ); + + + pSkillDescTXT_Raw = 0; pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); strtok(pSkillDescTXT_Raw, "\r"); @@ -1293,6 +1589,8 @@ ++v46; } while ( v46 < 37 ); + + pStatsTXT_Raw = 0; pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0); strtok(pStatsTXT_Raw, "\r"); @@ -1301,7 +1599,7 @@ { v51 = 0; v95 = 0; - v52 = strtok(0, v34) + 1; + v52 = strtok(0, pStatsTXT_Raw) + 1; do { v53 = *v52; @@ -1411,6 +1709,8 @@ ++Stri; } while ( Stri < 26 ); + + pClassTXT_Raw = 0; pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0); strtok(pClassTXT_Raw, v34); @@ -1491,18 +1791,18 @@ //----- (00453B3C) -------------------------------------------------------- void ItemsTable::LoadPotions() -{ - - CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 - char* test_string; - unsigned int uRow; - unsigned int uColumn; - unsigned __int8 potion_value; + { - if ( pPotionsTXT_Raw ) - pAllocator->FreeChunk(pPotionsTXT_Raw); - pPotionsTXT_Raw = NULL; - pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); + CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_value; + + if ( pPotionsTXT_Raw ) + pAllocator->FreeChunk(pPotionsTXT_Raw); + pPotionsTXT_Raw = NULL; + pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); while ( 1 ) { @@ -1513,142 +1813,140 @@ } if ( !strcmp(test_string, "222") ) break; - + test_string = strtok(NULL, "\t\r\n"); } - while ( 1 ) - { - test_string = strtok(NULL, "\t\r\n"); - - if ( !test_string ) + while ( 1 ) { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; } -if ( !strcmp(test_string, "222") ) - break; - } - for (uRow = 0;uRow < 50; ++uRow) - { - int skip_count; - for (skip_count = 0;skip_count < 6; ++skip_count) - { - if ( !strtok(NULL, "\r\t\n") ) - break; - } - if ( skip_count != 6 ) - break; - for (uColumn = 0; uColumn < 50; ++uColumn) + for (uRow = 0;uRow < 50; ++uRow) { - test_string = strtok(NULL, "\r\t\n"); - if ( !test_string ) - break; - potion_value = atoi(test_string); - char c=*test_string; - if ( !potion_value ) - { - if ( tolower(c) == 'e' ) - potion_value = atoi(test_string + 1); - else - potion_value = 0; - } - this->potion_data[uRow][uColumn]=potion_value; - } - if ( uColumn != 50 ) - break; - strtok(NULL, "\r\t\n"); - } + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) + { + if ( !strtok(NULL, "\r\t\n") ) + break; + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_value = atoi(test_string); + char c=*test_string; + if ( !potion_value ) + { + if ( tolower(c) == 'e' ) + potion_value = atoi(test_string + 1); + else + potion_value = 0; + } + this->potion_data[uRow][uColumn]=potion_value; + } + if ( uColumn != 50 ) + break; + strtok(NULL, "\r\t\n"); + } - if ( uRow != 50 ) - { - wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); - MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - } - if ( pPotionsTXT_Raw ) - { - pAllocator->FreeChunk(pPotionsTXT_Raw); - pPotionsTXT_Raw = 0; - } -} + if ( uRow != 50 ) + { + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + } + if ( pPotionsTXT_Raw ) + { + pAllocator->FreeChunk(pPotionsTXT_Raw); + pPotionsTXT_Raw = 0; + } + } //----- (00453CE5) -------------------------------------------------------- void ItemsTable::LoadPotionNotes() -{ - - CHAR Text[90]; - char* test_string; - unsigned int uRow; - unsigned int uColumn; - unsigned __int8 potion_note; + { + + CHAR Text[90]; + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_note; + + if ( pPotionNotesTXT_Raw ) + pAllocator->FreeChunk(pPotionNotesTXT_Raw); + pPotionNotesTXT_Raw = NULL; + pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); + test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); + while ( 1 ) + { + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + test_string = strtok(NULL, "\t\r\n"); + } + while ( 1 ) + { + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + } - if ( pPotionNotesTXT_Raw ) - pAllocator->FreeChunk(pPotionNotesTXT_Raw); - pPotionNotesTXT_Raw = NULL; - pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); - test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); - while ( 1 ) - { - - if ( !test_string ) - { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; - } - if ( !strcmp(test_string, "222") ) - break; - test_string = strtok(NULL, "\t\r\n"); - } - while ( 1 ) - { - test_string = strtok(NULL, "\t\r\n"); - - if ( !test_string ) - { - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - return; - } - if ( !strcmp(test_string, "222") ) - break; - } - - for (uRow = 0;uRow < 50; ++uRow) - { - int skip_count; - for (skip_count = 0;skip_count < 6; ++skip_count) - { - if ( !strtok(NULL, "\r\t\n") ) - break; - } - if ( skip_count != 6 ) - break; - for (uColumn = 0; uColumn < 50; ++uColumn) - { - test_string = strtok(NULL, "\r\t\n"); - if ( !test_string ) - break; - potion_note = atoi(test_string); - char c=*test_string; - if ( !potion_note ) - { - if ( tolower(c) == 'e' ) - potion_note = atoi(test_string + 1); - else - potion_note = 0; - } - this->potion_note[uRow][uColumn]=potion_note; - } - if ( uColumn != 50 ) - break; - strtok(NULL, "\r\t\n"); - } - - if ( uRow != 50 ) - { - wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); - MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); - } -} + for (uRow = 0;uRow < 50; ++uRow) + { + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) + { + if ( !strtok(NULL, "\r\t\n") ) + break; + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_note = atoi(test_string); + char c=*test_string; + if ( !potion_note ) + { + if ( tolower(c) == 'e' ) + potion_note = atoi(test_string + 1); + else + potion_note = 0; + } + this->potion_note[uRow][uColumn]=potion_note; + } + if ( uColumn != 50 ) + break; + strtok(NULL, "\r\t\n"); + } + if ( uRow != 50 ) + { + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + } + } //----- (00456442) -------------------------------------------------------- @@ -1677,7 +1975,7 @@ } else { - v3 = *(unsigned int *)&pItemsTable->pEnchantments[23].field_8[28 * v4 + 8]; + v3 = *(unsigned int *)&pItemsTable->pEnchantments[23].to_item[28 * v4 + 8]; if ( (unsigned int)v3 > 0xA ) return uBaseValue + v3; result = uBaseValue * v3; @@ -1773,12 +2071,12 @@ sprintf( item__getname_buffer, "%s %s", - *(unsigned int *)&pItemsTable->pEnchantments[22].field_8[28 * v7 + 8], + *(unsigned int *)&pItemsTable->pEnchantments[22].to_item[28 * v7 + 8], pItemsTable->pItems[v1->uItemID].pName); return v4; } strcat(item__getname_buffer, " "); - v9 = *(const char **)&pItemsTable->pEnchantments[22].field_8[28 * v1->uAdditionalValue + 8]; + v9 = *(const char **)&pItemsTable->pEnchantments[22].to_item[28 * v1->uAdditionalValue + 8]; } strcat(item__getname_buffer, v9); } @@ -2068,7 +2366,7 @@ if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) ) v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; - if ( BYTE2(pItemsTable->pItems[v4->uItemID + 1].uItemID) ) + if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) v4->uAttributes = 0; else v4->uAttributes = 1; @@ -2115,9 +2413,9 @@ v26 = rand() % v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; v27 = v4->uItemID; v4->_bonus_type = 0; - for ( i = v5->pEnchantments[0].field_8[v5->pItems[v27].uEquipType + 1]; + for ( i = v5->pEnchantments[0].to_item[v5->pItems[v27].uEquipType + 1]; i < v26; - i += v5->pEnchantments[v4->_bonus_type].field_8[v5->pItems[v29].uEquipType + 1] ) + i += v5->pEnchantments[v4->_bonus_type].to_item[v5->pItems[v29].uEquipType + 1] ) { v29 = v4->uItemID; ++v4->_bonus_type; @@ -2143,7 +2441,7 @@ memset(&Dst, 0, 0xC80u); v39 = 0; a2b = 0; - if ( v5->field_11798 > 0 ) + if ( v5->pSpecialEnchantments_count > 0 ) { v52 = -16 - (uint)v5; v58 = (int *)&Dst; @@ -2162,8 +2460,8 @@ if ( !*(unsigned char *)v40 || v43 == 1 ) { LABEL_117: - v39 += *((unsigned char *)&v5->pItems[0].uItemID + v40 + v52 + v5->pItems[v4->uItemID].uEquipType); - if ( *((unsigned char *)&v5->pItems[0].uItemID + v40 + v52 + v5->pItems[v4->uItemID].uEquipType) ) + v39 += *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType); + if ( *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType) ) { v44 = v58; ++v58; @@ -2191,12 +2489,12 @@ ++a2b; v40 += 28; } - while ( a2b < v5->field_11798 ); + while ( a2b < v5->pSpecialEnchantments_count ); } v45 = rand(); v4->uAdditionalValue = *(uint *)Dst; v46 = v45 % v39 + 1; - a2c = *((unsigned char *)&v5->pItems[0].uItemID + 28 * (*(uint *)Dst + 1389) + v5->pItems[v4->uItemID].uEquipType); + a2c = *((unsigned char *)&v5->uAllItemsCount + 28 * (*(uint *)Dst + 1389) + v5->pItems[v4->uItemID].uEquipType); if ( a2c < v46 ) { for ( j = (int *)&Dst; ; j = (int *)v59 ) @@ -2206,7 +2504,7 @@ v59 = v49; v50 = *(unsigned int *)v49; v4->uAdditionalValue = v50; - a2c += *((unsigned char *)&v5->pItems[0].uItemID + 28 * (v50 + 1389) + v5->pItems[v48].uEquipType); + a2c += *((unsigned char *)&v5->uAllItemsCount + 28 * (v50 + 1389) + v5->pItems[v48].uEquipType); if ( a2c >= v46 ) break; }
--- a/Items.h Sat Feb 16 18:46:59 2013 +0400 +++ b/Items.h Sun Feb 17 11:29:10 2013 +0400 @@ -123,33 +123,37 @@ /* 175 */ #pragma pack(push, 1) struct ItemDesc -{ - unsigned int uItemID; - char *pIconName; - char *pName; - char *pUnidentifiedName; - char *pDescription; - unsigned int uValue; - unsigned __int16 uSpriteID; - __int16 field_1A; - unsigned __int16 uEquipX; - unsigned __int16 uEquipY; - unsigned __int8 uEquipType; - unsigned __int8 uSkillType; - unsigned __int8 uDamageDice; - unsigned __int8 uDamageRoll; - unsigned __int8 uDamageMod; - unsigned __int8 uMaterial; - char _additional_value; - char _bonus_type; - char _bonus_strength; +{ //Item # |Pic File|Name|Value|Equip Stat|Skill Group|Mod1|Mod2|material| + ///ID/Rep/St|Not identified name|Sprite Index|VarA|VarB|Equip X|Equip Y|Notes + char *pIconName; //0 4 + char *pName; //4 8 + char *pUnidentifiedName; //8 c + char *pDescription; //0c 10 + unsigned int uValue; //10 14 + unsigned __int16 uSpriteID; //14 18 + __int16 field_1A; //16 + unsigned __int16 uEquipX; //18 1c + unsigned __int16 uEquipY; //1a 1e + unsigned __int8 uEquipType; //1c 20 + unsigned __int8 uSkillType; //1d 21 + unsigned __int8 uDamageDice; //1e 22 + unsigned __int8 uDamageRoll; //1f 23 + unsigned __int8 uDamageMod; //20 24 + unsigned __int8 uMaterial; //21 25 + char _additional_value; //22 26 + char _bonus_type; //23 27 + char _bonus_strength; //24 28 + char field_25; // + char field_26; + char field_27; + char field_28; char field_29; - char field_2A; - char field_2B; + char field_2a; + char field_2b; char field_2C; - char field_2D; - char field_2E; - char field_2F; + unsigned char uItemID_Rep_St; //2d + char field_2e; + char field_2f; }; #pragma pack(pop) @@ -158,26 +162,46 @@ /* 177 */ #pragma pack(push, 1) struct ItemEnchantment -{ - char *pName; - char *pParam; - char field_8[12]; -}; + { //Bonus|Sta|Of Name|Arm|Shld|Helm|Belt|Cape|Gaunt|Boot|Ring|Amul + char *pBonusStat; + char *pOfName; +/* union{ + struct { + unsigned char to_arm; + unsigned char to_shld; + unsigned char to_helm; + unsigned char to_belt; + unsigned char to_cape; + unsigned char to_gaunt; + unsigned char to_boot; + unsigned char to_ring; + unsigned char to_amul; + }; */ + unsigned char to_item[12]; + // }; + }; #pragma pack(pop) /* 178 */ #pragma pack(push, 1) struct ItemSpecialEnchantment -{ - char *pName; - char *pParam; - char field_8[12]; - int field_14; - int field_18; +{ //Bonus Stat|Name Add|W1|W2|Miss|Arm|Shld|Helm|Belt|Cape|Gaunt|Boot|Ring|Amul|Value|Lvl|Description fo special Bonuses and values + + char *pBonusStatement; + char *pNameAdd; + char to_item_apply[12]; + int iValue; + int iTreasureLevel; }; #pragma pack(pop) - +#pragma pack(push, 1) +struct BonusRange +{ + unsigned int minR; + unsigned int maxR; +}; +#pragma pack(pop) /* 176 */ #pragma pack(push, 1) @@ -192,30 +216,28 @@ bool _456D5E_is_some_material(ItemGen *pItem); char *Release(); - - ItemDesc pItems[638]; - char align1[18]; - unsigned __int8 potion_data[50][50]; //int8!!!! not int16 as in decomp code. hexrays wrong!! - unsigned __int8 potion_note[50][50]; - char align2[2758]; - ItemEnchantment pEnchantments[24]; - ItemSpecialEnchantment pSpecialEnchantments[72]; + int uAllItemsCount; + ItemDesc pItems[800]; //4-9604h + ItemEnchantment pEnchantments[24]; //9604h + ItemSpecialEnchantment pSpecialEnchantments[72]; //97E4h char field_9FC0[5000]; char field_B348[5000]; char field_C6D0[5000]; char field_DA58[5000]; - char field_EDE0[5000]; - char field_10168[5000]; - char field_114F0[388]; - char *pItemsTXT_Raw; + char field_EDE0[184]; + unsigned __int16 potion_data[50][50]; // 77B2h*2=EF64h -102ECh + unsigned __int16 potion_note[50][50]; // 8176h*2=102ECh -11674h + char *pItemsTXT_Raw; //11674h char *pRndItemsTXT_Raw; - char *pStdItemsTXT_Raw; - char *pSpcItemsTXT_Raw; + char *pStdItemsTXT_Raw; //1167Ch + char *pSpcItemsTXT_Raw; //11680h int field_11684[6]; char field_1169C[60]; - int field_116D8[24]; - int field_11738[24]; - int field_11798; + int field_116D8[3]; + unsigned int pEnchantmentsSumm[9]; //116E4h -11708h + BonusRange bonus_ranges[6]; //45C2h*4 =11708h + int pSpecialEnchantmentsSumm[24]; //11738h + int pSpecialEnchantments_count; //11798h char field_1179C; }; #pragma pack(pop)
--- a/Player.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/Player.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -2345,7 +2345,7 @@ v20 = thos; v2 = pItem->uItemID; - if ( !BYTE2(pItemsTable->pItems[v2 + 1].uItemID) ) + if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) pItem->uAttributes |= 1u; ///v15 = 0; //v16 = 1;
--- a/mm7_1.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/mm7_1.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -2780,7 +2780,7 @@ goto LABEL_65; } v60 = _this->_bonus_strength; - v55 = *((int *)&pItemsTable->pEnchantments[23].pName + 7 * v26); + v55 = *((int *)&pItemsTable->pEnchantments[23].pBonusStat + 7 * v26); v50 = pGlobalTXT_LocalizationStrings[210]; v46 = "%s: %s"; }
--- a/mm7_5.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/mm7_5.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -15891,10 +15891,10 @@ v0->pInventoryItems[pOut.z]._bonus_type = (pParty->pPickedItem._bonus_type + v0->pInventoryItems[pOut.z]._bonus_type) / 2; - v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->field_10168[2 * v20 + 388]); + v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: v22 = (int)((char *)v0 + 36 * pOut.z); - if ( !BYTE2(pItemsTable->pItems[*(int *)(v22 + 532) + 1].uItemID) ) + if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) *(int *)(v22 + 552) |= 1u; if ( !dword_4E455C ) goto LABEL_92;
--- a/mm7_6.cpp Sat Feb 16 18:46:59 2013 +0400 +++ b/mm7_6.cpp Sun Feb 17 11:29:10 2013 +0400 @@ -5267,10 +5267,10 @@ { v314 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( j = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5354,9 +5354,9 @@ { v275 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( k = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5368,19 +5368,19 @@ v256 = pItemsTable->field_116D8[18]; goto LABEL_611; } - v277 = pItemsTable->field_11798; + v277 = pItemsTable->pSpecialEnchantments_count; v278 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pName); + v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); if ( !v279 || v279 == 1 ) { - v280 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4] + v278 * 28); LODWORD(v725) += v280; @@ -5399,7 +5399,7 @@ v282 = rand() % SLODWORD(v725); v283 = v679; *(int *)(v245 + 12) = v679; - v284 = pItemsTable->pSpecialEnchantments[v283].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; v285 = v282 + 1; if ( v284 < v285 ) { @@ -5409,7 +5409,7 @@ v732 = v287; v288 = *(int *)v287; *(int *)(v245 + 12) = v288; - v284 += pItemsTable->pSpecialEnchantments[v288].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; if ( v284 >= v285 ) break; @@ -5452,9 +5452,9 @@ { v252 = rand() % pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; *(int *)(v245 + 4) = 0; - for ( m = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; ; - m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1] ) { ++*(int *)(v245 + 4); @@ -5466,19 +5466,19 @@ v256 = pItemsTable->field_116D8[20]; goto LABEL_611; } - v257 = pItemsTable->field_11798; + v257 = pItemsTable->pSpecialEnchantments_count; v258 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pName); + v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); if ( !v259 || v259 == 1 ) { - v260 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4] + v258 * 28); LODWORD(v725) += v260; @@ -5497,7 +5497,7 @@ v262 = rand() % SLODWORD(v725); v263 = v679; *(int *)(v245 + 12) = v679; - v264 = pItemsTable->pSpecialEnchantments[v263].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; v265 = v262 + 1; if ( v264 < v265 ) { @@ -5507,7 +5507,7 @@ v732 = v267; v268 = *(int *)v267; *(int *)(v245 + 12) = v268; - v264 += pItemsTable->pSpecialEnchantments[v268].field_8[pItemsTable->pItems[*(int *)v245].uEquipType + v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; if ( v264 >= v265 ) break; @@ -5550,20 +5550,20 @@ } if ( rand() % 100 >= 80 ) { - v297 = pItemsTable->field_11798; + v297 = pItemsTable->pSpecialEnchantments_count; v294 = _this; v298 = 0; v725 = 0.0; HIDWORD(v733) = 0; - if ( pItemsTable->field_11798 > 0 ) + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { v730 = (int)&v679; do { - v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pName); + v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); if ( !v299 || v299 == 1 ) { - v300 = *(&pItemsTable->pSpecialEnchantments[0].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4] + v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] + v298 * 28); LODWORD(v725) += v300; if ( v300 ) @@ -5581,7 +5581,7 @@ v302 = rand() % SLODWORD(v725); v303 = v679; v294->uAdditionalValue = v679; - v304 = pItemsTable->pSpecialEnchantments[v303].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; + v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; v305 = v302 + 1; if ( v304 < v305 ) { @@ -5591,7 +5591,7 @@ v732 = v307; v308 = *(int *)v307; v294->uAdditionalValue = v308; - v304 += pItemsTable->pSpecialEnchantments[v308].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; + v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; if ( v304 >= v305 ) break; } @@ -5604,9 +5604,9 @@ v294 = _this; v295 = v293 % pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; _this->_bonus_type = 0; - for ( kk = pItemsTable->pEnchantments[0].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; + for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1]; ; - kk += pItemsTable->pEnchantments[v294->_bonus_type].field_8[pItemsTable->pItems[v294->uItemID].uEquipType + kk += pItemsTable->pEnchantments[v294->_bonus_type].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1] ) { ++v294->_bonus_type; @@ -8575,14 +8575,14 @@ if ( !(a1a.uAttributes & 0x10) ) { v13 = 0; - if ( (signed int)pItemsTable->pItems[0].uItemID > 0 ) + if ( (signed int)pItemsTable->uAllItemsCount > 0 ) { v14 = (char *)&pItemsTable->pItems[0].uSpriteID; while ( *(short *)v14 != v9 ) { ++v13; v14 += 48; - if ( (signed int)v13 >= (signed int)pItemsTable->pItems[0].uItemID ) + if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) goto LABEL_16; } a1a.stru_24.uItemID = v13;