Mercurial > mm7
comparison Items.cpp @ 468:8822405efad2
Слияние
author | Ritor1 |
---|---|
date | Mon, 25 Feb 2013 11:10:57 +0600 |
parents | f7b91ef98ab2 |
children | fcdaa804074f |
comparison
equal
deleted
inserted
replaced
467:5d2667144526 | 468:8822405efad2 |
---|---|
3 | 3 |
4 #include "Items.h" | 4 #include "Items.h" |
5 #include "MapInfo.h" | 5 #include "MapInfo.h" |
6 #include "FrameTableInc.h" | 6 #include "FrameTableInc.h" |
7 #include "Allocator.h" | 7 #include "Allocator.h" |
8 #include "GUIWindow.h" | |
9 #include "Events2D.h" | |
10 #include "Chest.h" | |
8 #include "LOD.h" | 11 #include "LOD.h" |
9 #include "Monsters.h" | 12 #include "Monsters.h" |
10 #include "Party.h" | 13 #include "Party.h" |
11 #include "FactionTable.h" | 14 #include "FactionTable.h" |
12 #include "StorylineTextTable.h" | 15 #include "StorylineTextTable.h" |
13 #include "texts.h" | 16 #include "texts.h" |
14 #include "mm7_data.h" | 17 #include "mm7_data.h" |
15 | 18 |
16 | 19 |
17 | 20 |
21 struct ITEM_VARIATION | |
22 { | |
23 unsigned __int16 treasure_level; | |
24 unsigned __int16 item_class[4]; | |
25 }; | |
26 | |
27 | |
28 char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12}; | |
29 | |
30 ITEM_VARIATION shopWeap_variation_ord[15] ={ | |
31 { 0, { 0, 0, 0, 0 }}, | |
32 { 1, { 23, 27, 20, 20 }}, | |
33 { 1, { 23, 24, 28, 20 }}, | |
34 { 2, { 23, 24, 25, 20 }}, | |
35 { 2, { 27, 27, 26, 26 }}, | |
36 { 4, { 24, 30, 25, 27 }}, | |
37 { 4, { 24, 30, 25, 27 }}, | |
38 { 3, { 30, 24, 20, 20 }}, | |
39 { 2, { 20, 20, 20, 20 }}, | |
40 { 3, { 27, 27, 26, 26 }}, | |
41 { 3, { 28, 28, 25, 25 }}, | |
42 { 2, { 23, 23, 24, 24 }}, | |
43 { 3, { 23, 23, 26, 26 }}, | |
44 { 2, { 30, 26, 26, 26 }}, | |
45 { 2, { 28, 25, 28, 29 }}}; | |
46 | |
47 ITEM_VARIATION shopArmr_variation_ord[30] ={ | |
48 { 1, { 35, 35, 38, 38 }}, | |
49 { 1, { 31, 31, 31, 34 }}, | |
50 { 1, { 35, 35, 38, 38 }}, | |
51 { 1, { 31, 31, 32, 34 }}, | |
52 { 2, { 35, 35, 38, 38 }}, | |
53 { 2, { 31, 32, 32, 33 }}, | |
54 { 2, { 35, 35, 38, 38 }}, | |
55 { 2, { 31, 31, 32, 32 }}, | |
56 { 4, { 35, 35, 38, 38 }}, | |
57 { 4, { 31, 32, 33, 34 }}, | |
58 { 4, { 35, 35, 38, 38 }}, | |
59 { 4, { 31, 32, 33, 34 }}, | |
60 { 3, { 35, 35, 38, 38 }}, | |
61 { 3, { 31, 31, 31, 31 }}, | |
62 { 2, { 35, 35, 38, 38 }}, | |
63 { 2, { 31, 32, 34, 34 }}, | |
64 { 3, { 35, 35, 38, 38 }}, | |
65 { 3, { 31, 31, 32, 32 }}, | |
66 { 3, { 35, 35, 38, 38 }}, | |
67 { 3, { 32, 32, 32, 33 }}, | |
68 { 3, { 35, 35, 38, 38 }}, | |
69 { 3, { 31, 31, 31, 32 }}, | |
70 { 3, { 35, 35, 38, 38 }}, | |
71 { 3, { 33, 31, 32, 34 }}, | |
72 { 3, { 35, 35, 38, 38 }}, | |
73 { 3, { 33, 31, 32, 34 }}, | |
74 { 4, { 35, 35, 38, 38 }}, | |
75 { 4, { 33, 31, 32, 34 }}}; | |
76 | |
77 | |
78 | |
79 unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2}; | |
80 unsigned __int16 shopAlch_treasure_lvl[13]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; | |
81 | |
82 ITEM_VARIATION shopWeap_variation_spc[15]={ | |
83 { 0, { 0, 0, 0, 0 }}, | |
84 { 2, { 25, 30, 20, 20}}, | |
85 { 2, { 23, 24, 28, 20}}, | |
86 { 3, { 23, 24, 25, 20}}, | |
87 { 3, { 27, 27, 26, 26}}, | |
88 { 5, { 23, 26, 28, 27}}, | |
89 { 5, { 23, 26, 28, 27}}, | |
90 { 4, { 30, 24, 20, 20}}, | |
91 { 3, { 20, 20, 20, 20}}, | |
92 { 4, { 27, 27, 26, 26}}, | |
93 { 4, { 28, 28, 25, 25}}, | |
94 { 4, { 23, 23, 24, 24}}, | |
95 { 4, { 24, 24, 27, 20}}, | |
96 { 4, { 30, 26, 26, 26}}, | |
97 { 4, { 28, 25, 28, 29}}}; | |
98 | |
99 | |
100 | |
101 unsigned __int16 shopMagicSpc_treasure_lvl[14]= {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; | |
18 | 102 |
19 | 103 |
20 ItemGen *ptr_50C9A4; | 104 ItemGen *ptr_50C9A4; |
21 | 105 |
22 struct ItemsTable *pItemsTable; // 005D29E0 | 106 struct ItemsTable *pItemsTable; // 005D29E0 |
137 } | 221 } |
138 | 222 |
139 //----- (00458260) -------------------------------------------------------- | 223 //----- (00458260) -------------------------------------------------------- |
140 void ItemGen::UpdateTempBonus(__int64 uTimePlayed) | 224 void ItemGen::UpdateTempBonus(__int64 uTimePlayed) |
141 { | 225 { |
142 unsigned int v2; // eax@1 | 226 if ( this->uAttributes & ITEM_TEMP_BONUS ) |
143 | |
144 v2 = this->uAttributes; | |
145 if ( v2 & ITEM_TEMP_BONUS ) | |
146 { | 227 { |
147 if ( uTimePlayed > (signed __int64)this->uExpireTime ) | 228 if ( uTimePlayed > (signed __int64)this->uExpireTime ) |
148 { | 229 { |
149 this->uEncantmentType = 0; | 230 this->uEncantmentType = 0; |
150 LOBYTE(v2) = v2 & 0xF7; | |
151 this->uSpecEnchantmentType = 0; | 231 this->uSpecEnchantmentType = 0; |
152 this->uAttributes = v2; | 232 this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS); |
153 } | 233 } |
154 } | 234 } |
155 } | 235 } |
156 | 236 |
157 //----- (0045814E) -------------------------------------------------------- | 237 //----- (0045814E) -------------------------------------------------------- |
1311 } | 1391 } |
1312 | 1392 |
1313 | 1393 |
1314 //----- (00456442) -------------------------------------------------------- | 1394 //----- (00456442) -------------------------------------------------------- |
1315 unsigned int ItemGen::GetValue() | 1395 unsigned int ItemGen::GetValue() |
1316 { | 1396 { |
1317 ItemGen *v1; // esi@1 | 1397 unsigned int uBaseValue; // edi@1 |
1318 unsigned int uBaseValue; // edi@1 | 1398 unsigned int bonus; |
1319 int v3; // eax@4 | 1399 |
1320 int v4; // esi@5 | 1400 uBaseValue = pItemsTable->pItems[this->uItemID].uValue; |
1321 unsigned int result; // eax@7 | 1401 if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) |
1322 | 1402 return uBaseValue; |
1323 v1 = this; | 1403 if (uEncantmentType ) |
1324 uBaseValue = pItemsTable->pItems[this->uItemID].uValue; | 1404 return uBaseValue + 100 * _bonus_strength;; |
1325 if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) | 1405 if (uSpecEnchantmentType ) |
1326 return uBaseValue; | 1406 { |
1327 if ( v1->uEncantmentType ) | 1407 bonus = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType].iTreasureLevel; |
1328 { | 1408 if ( bonus > 10 ) |
1329 v3 = 100 * v1->_bonus_strength; | 1409 return uBaseValue + bonus; |
1330 return uBaseValue + v3; | 1410 else |
1331 } | 1411 return uBaseValue * bonus; |
1332 v4 = v1->uSpecEnchantmentType; | 1412 } |
1333 if ( !v4 ) | 1413 return uBaseValue; |
1334 { | 1414 } |
1335 result = uBaseValue; | |
1336 } | |
1337 else | |
1338 { | |
1339 v3 = pItemsTable->pSpecialEnchantments[v4].iTreasureLevel; | |
1340 if ( (unsigned int)v3 > 0xA ) | |
1341 return uBaseValue + v3; | |
1342 result = uBaseValue * v3; | |
1343 } | |
1344 return result; | |
1345 } | |
1346 | 1415 |
1347 //----- (00456499) -------------------------------------------------------- | 1416 //----- (00456499) -------------------------------------------------------- |
1348 const char *ItemGen::GetDisplayName() | 1417 const char *ItemGen::GetDisplayName() |
1349 { | 1418 { |
1350 if (Identified()) | 1419 if (Identified()) |
1812 } | 1881 } |
1813 | 1882 |
1814 //----- (004505CC) -------------------------------------------------------- | 1883 //----- (004505CC) -------------------------------------------------------- |
1815 bool ItemGen::GenerateArtifact() | 1884 bool ItemGen::GenerateArtifact() |
1816 { | 1885 { |
1817 ItemGen *v1; // edi@1 | |
1818 signed int uNumArtifactsNotFound; // esi@1 | 1886 signed int uNumArtifactsNotFound; // esi@1 |
1819 int v3; // eax@1 | 1887 int artifacts_list[32]; |
1820 bool result; // eax@6 | 1888 |
1821 int artifacts_list[32]; // [sp+8h] [bp-A0h]@3 | |
1822 char Dst[32]; // [sp+88h] [bp-20h]@1 | |
1823 | |
1824 auto a2 = this; | |
1825 v1 = a2; | |
1826 memset(artifacts_list, 0,sizeof(artifacts_list)); | 1889 memset(artifacts_list, 0,sizeof(artifacts_list)); |
1827 uNumArtifactsNotFound = 0; | 1890 uNumArtifactsNotFound = 0; |
1828 | 1891 |
1829 for (int i=500;i<529;++i) | 1892 for (int i=500;i<529;++i) |
1830 if ( !pParty->field_3C.pIsArtifactFound[i] ) | 1893 if ( !pParty->field_3C.pIsArtifactFound[i] ) |
1839 } | 1902 } |
1840 else | 1903 else |
1841 return false; | 1904 return false; |
1842 | 1905 |
1843 } | 1906 } |
1907 //----- (004B8E3D) -------------------------------------------------------- | |
1908 void GenerateStandartShopItems() | |
1909 { | |
1910 signed int item_count; | |
1911 signed int shop_index; | |
1912 int treasure_lvl; | |
1913 int item_class; | |
1914 int mdf; | |
1915 | |
1916 shop_index = (signed int)window_SpeakInHouse->ptr_1C; | |
1917 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] ) | |
1918 { | |
1919 for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count ) | |
1920 { | |
1921 if (shop_index<=14) //weapon shop | |
1922 { | |
1923 treasure_lvl = shopWeap_variation_ord[shop_index].treasure_level; | |
1924 item_class =shopWeap_variation_ord[shop_index].item_class[rand() % 4]; | |
1925 } | |
1926 else if (shop_index<=28) //armor shop | |
1927 { | |
1928 mdf =0; | |
1929 if (item_count > 3) | |
1930 ++mdf;// rechek offsets | |
1931 treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level; | |
1932 item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4]; | |
1933 } | |
1934 else if (shop_index<=41) //magic shop | |
1935 { | |
1936 treasure_lvl = shopMagic_treasure_lvl[shop_index-28]; | |
1937 item_class = 22; //misc | |
1938 } | |
1939 else if (shop_index<=53) //alchemist shop | |
1940 { | |
1941 if (item_count<6) | |
1942 { | |
1943 pParty->StandartItemsInShops[shop_index][item_count].Reset(); | |
1944 pParty->StandartItemsInShops[shop_index][item_count].uItemID = 220; //potion bottle | |
1945 continue; | |
1946 } | |
1947 else | |
1948 { | |
1949 treasure_lvl = shopAlch_treasure_lvl[shop_index-41]; | |
1950 item_class = 45; //reagent | |
1951 } | |
1952 } | |
1953 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->StandartItemsInShops[shop_index][item_count]); | |
1954 pParty->StandartItemsInShops[shop_index][item_count].SetIdentified(); //identified | |
1955 } | |
1956 } | |
1957 pParty->InTheShopFlags[shop_index] = 0; | |
1958 } | |
1959 | |
1960 //----- (004B8F94) -------------------------------------------------------- | |
1961 void GenerateSpecialShopItems() | |
1962 { | |
1963 /*GUIWindow *v0; // edi@1 | |
1964 signed int v1; // ebp@1 | |
1965 int v2; // ebx@1 | |
1966 signed int v3; // esi@1 | |
1967 int v4; // eax@3 | |
1968 int v5; // ebx@3 | |
1969 int v6; // ecx@3 | |
1970 bool v7; // eax@5 | |
1971 bool v8; // ST1C_4@5 | |
1972 int v9; // eax@5 | |
1973 int v10; // eax@10 | |
1974 void *result; // eax@15 | |
1975 signed int v12; // [sp-4h] [bp-18h]@7*/ | |
1976 | |
1977 signed int item_count; | |
1978 signed int shop_index; | |
1979 int treasure_lvl; | |
1980 int item_class; | |
1981 int mdf; | |
1982 | |
1983 shop_index = (signed int)window_SpeakInHouse->ptr_1C; | |
1984 if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] ) | |
1985 { | |
1986 for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count ) | |
1987 { | |
1988 if (shop_index<=14) //weapon shop | |
1989 { | |
1990 treasure_lvl = shopWeap_variation_spc[shop_index].treasure_level; | |
1991 item_class = shopWeap_variation_spc[shop_index].item_class[rand() % 4]; | |
1992 } | |
1993 else if (shop_index<=28) //armor shop | |
1994 { | |
1995 mdf =0; | |
1996 if (item_count > 3) | |
1997 ++mdf; | |
1998 treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level; | |
1999 item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4]; | |
2000 } | |
2001 else if (shop_index<=41) //magic shop | |
2002 { | |
2003 treasure_lvl = shopMagicSpc_treasure_lvl[shop_index-28]; | |
2004 item_class = 22; //misc | |
2005 } | |
2006 else if (shop_index<=53) //alchemist shop | |
2007 { | |
2008 if (item_count<6) | |
2009 { | |
2010 pParty->SpecialItemsInShop[shop_index][item_count].Reset(); | |
2011 pParty->SpecialItemsInShop[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool | |
2012 continue; | |
2013 } | |
2014 else | |
2015 { | |
2016 treasure_lvl = shopAlch_treasure_lvl[shop_index-41]; | |
2017 item_class = 44; //potion | |
2018 } | |
2019 } | |
2020 pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShop[shop_index][item_count]); | |
2021 pParty->SpecialItemsInShop[shop_index][item_count].SetIdentified(); //identified | |
2022 } | |
2023 } | |
2024 pParty->InTheShopFlags[shop_index] = 0; | |
2025 | |
2026 | |
2027 | |
2028 /* | |
2029 | |
2030 v0 = window_SpeakInHouse; | |
2031 v1 = 0; | |
2032 v2 = (int)&window_SpeakInHouse->ptr_1C; | |
2033 v3 = (signed int)window_SpeakInHouse->ptr_1C; | |
2034 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) | |
2035 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | |
2036 { | |
2037 while ( v3 > 14 ) | |
2038 { | |
2039 if ( v3 <= 28 ) | |
2040 { | |
2041 v7 = v1 > 3; | |
2042 v8 = v7; | |
2043 v9 = 5 * (v7 + 2 * v3 - 30); | |
2044 v3 = (signed int)v0->ptr_1C; | |
2045 v5 = word_4F06D8[v9]; | |
2046 v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4]; | |
2047 goto LABEL_13; | |
2048 } | |
2049 if ( v3 <= 41 ) | |
2050 { | |
2051 v5 = word_4F07B6[v3]; | |
2052 v12 = 22; | |
2053 goto LABEL_12; | |
2054 } | |
2055 if ( v3 <= 53 ) | |
2056 { | |
2057 if ( v1 >= 6 ) | |
2058 { | |
2059 v5 = word_4F07B6[v3 + 1]; | |
2060 v12 = 44; | |
2061 LABEL_12: | |
2062 v6 = v12; | |
2063 LABEL_13: | |
2064 pItemsTable->GenerateItem(v5, v6,&pParty->SpecialItemsInShop[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); | |
2065 v0 = window_SpeakInHouse; | |
2066 v2 = (int)&window_SpeakInHouse->ptr_1C; | |
2067 // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1; | |
2068 pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1; | |
2069 goto LABEL_14; | |
2070 } | |
2071 // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; | |
2072 auto _a =&pParty->SpecialItemsInShop[v3][v1]; | |
2073 _a->Reset(); | |
2074 // v2 = (int)&v0->ptr_1C; | |
2075 //v10 = rand(); | |
2076 // v0 = window_SpeakInHouse; | |
2077 // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; | |
2078 pParty->SpecialItemsInShop[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740; | |
2079 } | |
2080 LABEL_14: | |
2081 v3 = *(int *)v2; | |
2082 ++v1; | |
2083 //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] ) | |
2084 if ( v1 >= (unsigned __int8)uItemsAmountPerShopType[p2DEvents[*(int *)v2 - 1].uType] ) | |
2085 goto LABEL_15; | |
2086 } | |
2087 v4 = 5 * v3; | |
2088 v3 = (signed int)v0->ptr_1C; | |
2089 v5 = word_4F063E[v4]; | |
2090 v6 = word_4F063E[5 * v3 + rand() % 4 + 1]; | |
2091 goto LABEL_13; | |
2092 } | |
2093 LABEL_15: | |
2094 result = v0->ptr_1C; | |
2095 pParty->InTheShopFlags[(int)v0->ptr_1C] = 0;*/ | |
2096 } | |
2097 | |
2098 | |
2099 //----- (00450218) -------------------------------------------------------- | |
2100 void __cdecl sub_450218_prolly_generate_chests_loot() | |
2101 { | |
2102 unsigned int v0; // eax@1 | |
2103 Chest *v1; // ebx@1 | |
2104 MapInfo *v2; // esi@1 | |
2105 ItemGen *v3; // ebx@2 | |
2106 int v4; // ebp@4 | |
2107 int v5; // edi@4 | |
2108 int v6; // esi@4 | |
2109 int v7; // eax@4 | |
2110 signed int v8; // esi@4 | |
2111 int v9; // edx@4 | |
2112 int v10; // esi@8 | |
2113 int v11; // ebp@25 | |
2114 int v12; // esi@25 | |
2115 signed int v13; // ebp@27 | |
2116 ItemGen *v14; // edi@28 | |
2117 signed int v15; // edx@32 | |
2118 signed __int64 v16; // qtt@32 | |
2119 int v17; // esi@34 | |
2120 signed int v18; // [sp+10h] [bp-18h]@1 | |
2121 int v19; // [sp+14h] [bp-14h]@4 | |
2122 MapInfo *v20; // [sp+18h] [bp-10h]@1 | |
2123 Chest *v21; // [sp+1Ch] [bp-Ch]@1 | |
2124 int v22; // [sp+20h] [bp-8h]@26 | |
2125 signed int v23; // [sp+24h] [bp-4h]@2 | |
2126 | |
2127 v18 = rand() % 100; | |
2128 v0 = pMapStats->GetMapInfo(pCurrentMapName); | |
2129 v1 = pChests; | |
2130 v2 = &pMapStats->pInfos[v0]; | |
2131 v21 = pChests; | |
2132 v20 = &pMapStats->pInfos[v0]; | |
2133 do | |
2134 { | |
2135 v3 = v1->mm7__vector_pItems; | |
2136 v23 = 140; | |
2137 do | |
2138 { | |
2139 if ( (v3->uItemID & 0x80000000u) == 0 ) | |
2140 goto LABEL_56; | |
2141 v4 = rand() % 5 + 1; | |
2142 v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; | |
2143 v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; | |
2144 v7 = rand(); | |
2145 v8 = v6 - v5 + 1; | |
2146 v9 = v5 + v7 % v8; | |
2147 v19 = v5 + v7 % v8; | |
2148 if ( v9 < 7 ) | |
2149 { | |
2150 if ( v18 < 20 ) | |
2151 { | |
2152 v3->Reset(); | |
2153 goto LABEL_25; | |
2154 } | |
2155 if ( v18 < 60 ) | |
2156 { | |
2157 v10 = 0; | |
2158 v3->Reset(); | |
2159 if ( v19 == 1 ) | |
2160 { | |
2161 v10 = rand() % 51 + 50; | |
2162 } | |
2163 else | |
2164 { | |
2165 if ( v19 != 2 ) | |
2166 { | |
2167 if ( v19 == 3 ) | |
2168 { | |
2169 v10 = rand() % 301 + 200; | |
2170 } | |
2171 else | |
2172 { | |
2173 if ( v19 != 4 ) | |
2174 { | |
2175 if ( v19 == 5 ) | |
2176 { | |
2177 v10 = rand() % 1001 + 1000; | |
2178 LABEL_15: | |
2179 v3->uItemID = 199; | |
2180 } | |
2181 else | |
2182 { | |
2183 if ( v19 == 6 ) | |
2184 { | |
2185 v10 = rand() % 3001 + 2000; | |
2186 goto LABEL_15; | |
2187 } | |
2188 } | |
2189 LABEL_23: | |
2190 v3->SetIdentified(); | |
2191 v3->uSpecEnchantmentType = v10; | |
2192 LABEL_25: | |
2193 v11 = v4 - 1; | |
2194 v12 = 0; | |
2195 if ( v11 > 0 ) | |
2196 { | |
2197 v22 = v11; | |
2198 while ( 1 ) | |
2199 { | |
2200 v13 = v12; | |
2201 if ( v12 >= 140 ) | |
2202 goto LABEL_52; | |
2203 v14 = &v21->mm7__vector_pItems[v12]; | |
2204 while ( v14->uItemID ) | |
2205 { | |
2206 ++v13; | |
2207 ++v14; | |
2208 if ( v13 >= 140 ) | |
2209 goto LABEL_52; | |
2210 } | |
2211 v16 = rand(); | |
2212 v15 = v16 % 100; | |
2213 v18 = v16 % 100; | |
2214 if ( v15 < 20 ) | |
2215 goto LABEL_52; | |
2216 if ( v15 >= 60 ) | |
2217 { | |
2218 pItemsTable->GenerateItem(v19, 0, v14); | |
2219 goto LABEL_51; | |
2220 } | |
2221 v17 = 0; | |
2222 v14->Reset(); | |
2223 if ( v19 == 1 ) | |
2224 { | |
2225 v17 = rand() % 51 + 50; | |
2226 goto LABEL_48; | |
2227 } | |
2228 if ( v19 == 2 ) | |
2229 { | |
2230 v17 = rand() % 101 + 100; | |
2231 LABEL_48: | |
2232 v14->uItemID = 197; | |
2233 goto LABEL_49; | |
2234 } | |
2235 if ( v19 == 3 ) | |
2236 { | |
2237 v17 = rand() % 301 + 200; | |
2238 goto LABEL_44; | |
2239 } | |
2240 if ( v19 == 4 ) | |
2241 { | |
2242 v17 = rand() % 501 + 500; | |
2243 LABEL_44: | |
2244 v14->uItemID = 198; | |
2245 goto LABEL_49; | |
2246 } | |
2247 if ( v19 == 5 ) | |
2248 break; | |
2249 if ( v19 == 6 ) | |
2250 { | |
2251 v17 = rand() % 3001 + 2000; | |
2252 LABEL_41: | |
2253 v14->uItemID = 199; | |
2254 } | |
2255 LABEL_49: | |
2256 v14->uSpecEnchantmentType = v17; | |
2257 LABEL_51: | |
2258 v12 = v13 + 1; | |
2259 LABEL_52: | |
2260 --v22; | |
2261 if ( !v22 ) | |
2262 goto LABEL_55; | |
2263 } | |
2264 v17 = rand() % 1001 + 1000; | |
2265 goto LABEL_41; | |
2266 } | |
2267 goto LABEL_55; | |
2268 } | |
2269 v10 = rand() % 501 + 500; | |
2270 } | |
2271 v3->uItemID = 198; | |
2272 goto LABEL_23; | |
2273 } | |
2274 v10 = rand() % 101 + 100; | |
2275 } | |
2276 v3->uItemID = 197; | |
2277 goto LABEL_23; | |
2278 } | |
2279 pItemsTable->GenerateItem(v9, 0, v3); | |
2280 goto LABEL_25; | |
2281 } | |
2282 v3->GenerateArtifact(); | |
2283 LABEL_55: | |
2284 v2 = v20; | |
2285 LABEL_56: | |
2286 ++v3; | |
2287 --v23; | |
2288 } | |
2289 while ( v23 ); | |
2290 v1 = v21 + 1; | |
2291 ++v21; | |
2292 } | |
2293 while ( (signed int)v21 < (signed int)&uNumChests ); | |
2294 } | |
2295 | |
2296 | |
2297 | |
2298 | |
1844 // 4505CC: using guessed type int var_A0[32]; | 2299 // 4505CC: using guessed type int var_A0[32]; |
2300 //----- (004B3703) -------------------------------------------------------- | |
2301 int sub_4B3703( int _this ) | |
2302 { | |
2303 signed int v1; // edi@1 | |
2304 int v2; // eax@1 | |
2305 int v3; // ecx@1 | |
2306 signed int v4; // ebx@1 | |
2307 int v5; // ecx@2 | |
2308 int v6; // ecx@3 | |
2309 int v7; // ecx@4 | |
2310 int v8; // ecx@5 | |
2311 int v9; // ecx@6 | |
2312 signed int v10; // ebx@13 | |
2313 signed int v11; // edi@14 | |
2314 signed int v12; // esi@15 | |
2315 unsigned int v13; // ecx@16 | |
2316 int v14; // ecx@16 | |
2317 int v15; // ecx@17 | |
2318 int v16; // ecx@19 | |
2319 int v17; // ecx@20 | |
2320 int v18; // ecx@21 | |
2321 signed int v19; // esi@32 | |
2322 char *v20; // ecx@33 | |
2323 int v21; // ecx@34 | |
2324 int v22; // ecx@36 | |
2325 int v23; // ecx@37 | |
2326 int v24; // ecx@38 | |
2327 int v25; // ecx@39 | |
2328 int v26; // ecx@40 | |
2329 int v27; // ecx@41 | |
2330 int *v28; // esi@54 | |
2331 unsigned int v29; // edx@56 | |
2332 char *v30; // ecx@65 | |
2333 int v31; // ecx@106 | |
2334 int result; // eax@107 | |
2335 int v33; // [sp-4h] [bp-2Ch]@23 | |
2336 int v34; // [sp-4h] [bp-2Ch]@43 | |
2337 int v35[5]; // [sp+Ch] [bp-1Ch]@8 | |
2338 int a2; // [sp+20h] [bp-8h]@1 | |
2339 int v37; // [sp+24h] [bp-4h]@1 | |
2340 | |
2341 //need fixing | |
2342 __debugbreak(); | |
2343 v1 = 0; | |
2344 v2 = 0; | |
2345 v3 = _this - 1; | |
2346 a2 = 0; | |
2347 v37 = 0; | |
2348 dword_F8B1DC = 0; | |
2349 v4 = 2; | |
2350 if ( !v3 ) | |
2351 { | |
2352 while ( 1 ) | |
2353 { | |
2354 v19 = 1; | |
2355 do | |
2356 { | |
2357 v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19; | |
2358 /*if ( v1 ) | |
2359 v21 = word_4F063E[(signed int)v20]; | |
2360 else | |
2361 v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];*/ | |
2362 v22 = v21 - 23; | |
2363 if ( v22 ) | |
2364 { | |
2365 v23 = v22 - 1; | |
2366 if ( v23 ) | |
2367 { | |
2368 v24 = v23 - 1; | |
2369 if ( v24 ) | |
2370 { | |
2371 v25 = v24 - 1; | |
2372 if ( v25 ) | |
2373 { | |
2374 v26 = v25 - 1; | |
2375 if ( v26 ) | |
2376 { | |
2377 v27 = v26 - 1; | |
2378 if ( v27 ) | |
2379 { | |
2380 if ( v27 != v4 ) | |
2381 goto LABEL_51; | |
2382 v34 = 36; | |
2383 } | |
2384 else | |
2385 { | |
2386 v34 = 42; | |
2387 } | |
2388 } | |
2389 else | |
2390 { | |
2391 v34 = 41; | |
2392 } | |
2393 } | |
2394 else | |
2395 { | |
2396 v34 = 40; | |
2397 } | |
2398 } | |
2399 else | |
2400 { | |
2401 v34 = 39; | |
2402 } | |
2403 } | |
2404 else | |
2405 { | |
2406 v34 = 38; | |
2407 } | |
2408 } | |
2409 else | |
2410 { | |
2411 v34 = 37; | |
2412 } | |
2413 v37 = sub_4BE571(v34, v35, v37, 5); | |
2414 v2 = dword_F8B1DC; | |
2415 v4 = 2; | |
2416 LABEL_51: | |
2417 ++v19; | |
2418 } | |
2419 while ( v19 <= 4 ); | |
2420 ++v1; | |
2421 if ( v1 >= v4 ) | |
2422 goto LABEL_53; | |
2423 } | |
2424 } | |
2425 v5 = (int)(v3 - 1); | |
2426 if ( !v5 ) | |
2427 { | |
2428 v10 = 0; | |
2429 while ( 1 ) | |
2430 { | |
2431 v11 = 0; | |
2432 do | |
2433 { | |
2434 v12 = 1; | |
2435 do | |
2436 { | |
2437 v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30; | |
2438 v14 = v12 + 4 * v13 + v13; | |
2439 /* if ( v10 ) | |
2440 v15 = word_4F06D8[v14]; | |
2441 else | |
2442 v15 = word_4F0498[v14];*/ | |
2443 v16 = v15 - 31; | |
2444 if ( v16 ) | |
2445 { | |
2446 v17 = v16 - 1; | |
2447 if ( v17 ) | |
2448 { | |
2449 v18 = v17 - 1; | |
2450 if ( v18 ) | |
2451 { | |
2452 if ( v18 != 1 ) | |
2453 goto LABEL_28; | |
2454 v33 = 44; | |
2455 } | |
2456 else | |
2457 { | |
2458 v33 = 47; | |
2459 } | |
2460 } | |
2461 else | |
2462 { | |
2463 v33 = 46; | |
2464 } | |
2465 } | |
2466 else | |
2467 { | |
2468 v33 = 45; | |
2469 } | |
2470 v37 = sub_4BE571(v33, v35, v37, 5); | |
2471 v2 = dword_F8B1DC; | |
2472 LABEL_28: | |
2473 ++v12; | |
2474 } | |
2475 while ( v12 <= 4 ); | |
2476 ++v11; | |
2477 } | |
2478 while ( v11 < 2 ); | |
2479 ++v10; | |
2480 if ( v10 >= 2 ) | |
2481 goto LABEL_53; | |
2482 } | |
2483 } | |
2484 v6 = v5 - 1; | |
2485 if ( v6 ) | |
2486 { | |
2487 v7 = v6 - 1; | |
2488 if ( v7 ) | |
2489 { | |
2490 v8 = v7 - 17; | |
2491 if ( v8 ) | |
2492 { | |
2493 v9 = v8 - 2; | |
2494 if ( v9 ) | |
2495 { | |
2496 if ( v9 == 7 ) | |
2497 { | |
2498 v37 = 2; | |
2499 v35[0] = 69; | |
2500 v35[1] = 60; | |
2501 } | |
2502 } | |
2503 else | |
2504 { | |
2505 v37 = 3; | |
2506 v35[0] = 67; | |
2507 v35[1] = 66; | |
2508 v35[2] = 58; | |
2509 } | |
2510 } | |
2511 else | |
2512 { | |
2513 v37 = 3; | |
2514 v35[0] = 70; | |
2515 v35[1] = 65; | |
2516 v35[2] = 62; | |
2517 } | |
2518 } | |
2519 else | |
2520 { | |
2521 v37 = 2; | |
2522 v35[0] = 71; | |
2523 v35[1] = 68; | |
2524 } | |
2525 } | |
2526 else | |
2527 { | |
2528 v37 = 2; | |
2529 v35[0] = 57; | |
2530 v35[1] = 59; | |
2531 } | |
2532 LABEL_53: | |
2533 if ( v37 > 0 ) | |
2534 { | |
2535 v28 = v35; | |
2536 while ( 1 ) | |
2537 { | |
2538 v29 = *v28; | |
2539 if ( *v28 <= 47 ) | |
2540 break; | |
2541 if ( (signed int)v29 <= 66 ) | |
2542 { | |
2543 if ( v29 == 66 ) | |
2544 { | |
2545 v30 = pSkillNames[30]; | |
2546 goto LABEL_106; | |
2547 } | |
2548 if ( v29 == 57 ) | |
2549 { | |
2550 v30 = pSkillNames[21]; | |
2551 goto LABEL_106; | |
2552 } | |
2553 if ( v29 == 58 ) | |
2554 { | |
2555 v30 = pSkillNames[22]; | |
2556 goto LABEL_106; | |
2557 } | |
2558 if ( v29 == 60 ) | |
2559 { | |
2560 v30 = pSkillNames[24]; | |
2561 goto LABEL_106; | |
2562 } | |
2563 if ( v29 == 62 ) | |
2564 { | |
2565 v30 = pSkillNames[26]; | |
2566 goto LABEL_106; | |
2567 } | |
2568 if ( v29 == 65 ) | |
2569 { | |
2570 v30 = pSkillNames[29]; | |
2571 goto LABEL_106; | |
2572 } | |
2573 goto LABEL_100; | |
2574 } | |
2575 switch ( v29 ) | |
2576 { | |
2577 case 0x43u: | |
2578 v30 = pSkillNames[31]; | |
2579 break; | |
2580 case 0x44u: | |
2581 v30 = pSkillNames[32]; | |
2582 break; | |
2583 case 0x45u: | |
2584 v30 = pSkillNames[33]; | |
2585 break; | |
2586 case 0x46u: | |
2587 v30 = pSkillNames[34]; | |
2588 break; | |
2589 default: | |
2590 if ( v29 != 71 ) | |
2591 goto LABEL_100; | |
2592 v30 = pSkillNames[35]; | |
2593 break; | |
2594 } | |
2595 LABEL_106: | |
2596 pShopOptions[v2] = v30; | |
2597 v31 = a2++; | |
2598 dword_F8B1DC = v2 + 1; | |
2599 sub_4B36CC(v31, v29); | |
2600 ++v28; | |
2601 if ( a2 >= v37 ) | |
2602 goto LABEL_107; | |
2603 v2 = dword_F8B1DC; | |
2604 } | |
2605 if ( *v28 == 47 ) | |
2606 { | |
2607 v30 = pSkillNames[11]; | |
2608 goto LABEL_106; | |
2609 } | |
2610 if ( (signed int)v29 > 40 ) | |
2611 { | |
2612 if ( v29 == 41 ) | |
2613 { | |
2614 v30 = pSkillNames[5]; | |
2615 goto LABEL_106; | |
2616 } | |
2617 if ( v29 == 42 ) | |
2618 { | |
2619 v30 = pSkillNames[6]; | |
2620 goto LABEL_106; | |
2621 } | |
2622 if ( v29 == 44 ) | |
2623 { | |
2624 v30 = pSkillNames[8]; | |
2625 goto LABEL_106; | |
2626 } | |
2627 if ( v29 == 45 ) | |
2628 { | |
2629 v30 = pSkillNames[9]; | |
2630 goto LABEL_106; | |
2631 } | |
2632 if ( v29 == 46 ) | |
2633 { | |
2634 v30 = pSkillNames[10]; | |
2635 goto LABEL_106; | |
2636 } | |
2637 } | |
2638 else | |
2639 { | |
2640 if ( v29 == 40 ) | |
2641 { | |
2642 v30 = pSkillNames[4]; | |
2643 goto LABEL_106; | |
2644 } | |
2645 if ( v29 == 5 ) | |
2646 { | |
2647 v30 = pSkillNames[23]; | |
2648 goto LABEL_106; | |
2649 } | |
2650 if ( v29 == 36 ) | |
2651 { | |
2652 v30 = pSkillNames[0]; | |
2653 goto LABEL_106; | |
2654 } | |
2655 if ( v29 == 37 ) | |
2656 { | |
2657 v30 = pSkillNames[1]; | |
2658 goto LABEL_106; | |
2659 } | |
2660 if ( v29 == 38 ) | |
2661 { | |
2662 v30 = pSkillNames[2]; | |
2663 goto LABEL_106; | |
2664 } | |
2665 if ( v29 == 39 ) | |
2666 { | |
2667 v30 = pSkillNames[3]; | |
2668 goto LABEL_106; | |
2669 } | |
2670 } | |
2671 LABEL_100: | |
2672 v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!" | |
2673 goto LABEL_106; | |
2674 } | |
2675 LABEL_107: | |
2676 pDialogueWindow->_41D08F(a2, 1, 0, 2); | |
2677 result = pDialogueWindow->pNumPresenceButton; | |
2678 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
2679 return result; | |
2680 } |