annotate Items.cpp @ 52:ac65389dc211

21.01.13
author Ritor1
date Mon, 21 Jan 2013 01:06:55 +0600
parents 9c0607679772
children 038a4d09406f
rev   line source
0
Ritor1
parents:
diff changeset
1 #include <stdlib.h>
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 #include "Items.h"
Ritor1
parents:
diff changeset
4 #include "MapInfo.h"
Ritor1
parents:
diff changeset
5 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
6 #include "Allocator.h"
Ritor1
parents:
diff changeset
7 #include "LOD.h"
Ritor1
parents:
diff changeset
8 #include "Monsters.h"
Ritor1
parents:
diff changeset
9 #include "Party.h"
Ritor1
parents:
diff changeset
10 #include "FactionTable.h"
Ritor1
parents:
diff changeset
11 #include "StorylineTextTable.h"
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13 #include "mm7_data.h"
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19 ItemGen *ptr_50C9A4;
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21 struct ItemsTable *pItemsTable;
Ritor1
parents:
diff changeset
22
Ritor1
parents:
diff changeset
23
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26
Ritor1
parents:
diff changeset
27 //----- (00439DF3) --------------------------------------------------------
Ritor1
parents:
diff changeset
28 int ItemGen::_439DF3_get_additional_damage(int *a2, int *a3)
Ritor1
parents:
diff changeset
29 {
Ritor1
parents:
diff changeset
30 int *v3; // edi@1
Ritor1
parents:
diff changeset
31 ItemGen *v4; // ebx@1
Ritor1
parents:
diff changeset
32 signed int v5; // esi@1
Ritor1
parents:
diff changeset
33 unsigned int v7; // ecx@5
Ritor1
parents:
diff changeset
34 signed int v8; // ebx@7
Ritor1
parents:
diff changeset
35 int v9; // edx@22
Ritor1
parents:
diff changeset
36 int v10; // eax@24
Ritor1
parents:
diff changeset
37 int v11; // edx@25
Ritor1
parents:
diff changeset
38 int v12; // ebx@28
Ritor1
parents:
diff changeset
39 int v13; // ebx@29
Ritor1
parents:
diff changeset
40 int v14; // ebx@30
Ritor1
parents:
diff changeset
41 int v15; // ebx@31
Ritor1
parents:
diff changeset
42 int v16; // ebx@32
Ritor1
parents:
diff changeset
43 signed int v17; // [sp-4h] [bp-10h]@24
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45 auto a1 = this;
Ritor1
parents:
diff changeset
46 v3 = a2;
Ritor1
parents:
diff changeset
47 v4 = a1;
Ritor1
parents:
diff changeset
48 v5 = 0;
Ritor1
parents:
diff changeset
49 *a2 = 0;
Ritor1
parents:
diff changeset
50 if ( !a1->uItemID )
Ritor1
parents:
diff changeset
51 return 0;
Ritor1
parents:
diff changeset
52 UpdateTempBonus(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
53 if ( v4->uItemID == 501 )
Ritor1
parents:
diff changeset
54 {
Ritor1
parents:
diff changeset
55 LABEL_45:
Ritor1
parents:
diff changeset
56 *v3 = 1;
Ritor1
parents:
diff changeset
57 v10 = rand();
Ritor1
parents:
diff changeset
58 v17 = 10;
Ritor1
parents:
diff changeset
59 return v10 % v17 + 6;
Ritor1
parents:
diff changeset
60 }
Ritor1
parents:
diff changeset
61 if ( v4->uItemID == 507 )
Ritor1
parents:
diff changeset
62 {
Ritor1
parents:
diff changeset
63 *v3 = 0;
Ritor1
parents:
diff changeset
64 v11 = rand() % 16;
Ritor1
parents:
diff changeset
65 return v11 + 3;
Ritor1
parents:
diff changeset
66 }
Ritor1
parents:
diff changeset
67 v7 = 3;
Ritor1
parents:
diff changeset
68 if ( v4->uItemID == 510 )
Ritor1
parents:
diff changeset
69 {
Ritor1
parents:
diff changeset
70 *v3 = 2;
Ritor1
parents:
diff changeset
71 v9 = rand() % 4;
Ritor1
parents:
diff changeset
72 return v9 + 9;
Ritor1
parents:
diff changeset
73 }
Ritor1
parents:
diff changeset
74 if ( v4->uItemID == 517 )
Ritor1
parents:
diff changeset
75 goto LABEL_36;
Ritor1
parents:
diff changeset
76 v8 = v4->uAdditionalValue;
Ritor1
parents:
diff changeset
77 if ( v8 > 46 )
Ritor1
parents:
diff changeset
78 {
Ritor1
parents:
diff changeset
79 LABEL_42:
Ritor1
parents:
diff changeset
80 v5 = 0;
Ritor1
parents:
diff changeset
81 goto LABEL_37;
Ritor1
parents:
diff changeset
82 }
Ritor1
parents:
diff changeset
83 if ( v8 == 46 )
Ritor1
parents:
diff changeset
84 {
Ritor1
parents:
diff changeset
85 *v3 = 0;
Ritor1
parents:
diff changeset
86 return rand() % 11 + 10;
Ritor1
parents:
diff changeset
87 }
Ritor1
parents:
diff changeset
88 if ( v8 > 11 )
Ritor1
parents:
diff changeset
89 {
Ritor1
parents:
diff changeset
90 v12 = v8 - 12;
Ritor1
parents:
diff changeset
91 if ( !v12 )
Ritor1
parents:
diff changeset
92 {
Ritor1
parents:
diff changeset
93 *v3 = 0;
Ritor1
parents:
diff changeset
94 return GetDiceResult(v7, 6u);
Ritor1
parents:
diff changeset
95 }
Ritor1
parents:
diff changeset
96 v13 = v12 - 1;
Ritor1
parents:
diff changeset
97 if ( !v13 )
Ritor1
parents:
diff changeset
98 {
Ritor1
parents:
diff changeset
99 *v3 = 8;
Ritor1
parents:
diff changeset
100 return 5;
Ritor1
parents:
diff changeset
101 }
Ritor1
parents:
diff changeset
102 v14 = v13 - 1;
Ritor1
parents:
diff changeset
103 if ( v14 )
Ritor1
parents:
diff changeset
104 {
Ritor1
parents:
diff changeset
105 v15 = v14 - 1;
Ritor1
parents:
diff changeset
106 if ( v15 )
Ritor1
parents:
diff changeset
107 {
Ritor1
parents:
diff changeset
108 v16 = v15 - 1;
Ritor1
parents:
diff changeset
109 if ( !v16 || v16 == 25 )
Ritor1
parents:
diff changeset
110 {
Ritor1
parents:
diff changeset
111 *v3 = 10;
Ritor1
parents:
diff changeset
112 *a3 = 1;
Ritor1
parents:
diff changeset
113 return v5;
Ritor1
parents:
diff changeset
114 }
Ritor1
parents:
diff changeset
115 goto LABEL_42;
Ritor1
parents:
diff changeset
116 }
Ritor1
parents:
diff changeset
117 *v3 = 2;
Ritor1
parents:
diff changeset
118 return 12;
Ritor1
parents:
diff changeset
119 }
Ritor1
parents:
diff changeset
120 LABEL_36:
Ritor1
parents:
diff changeset
121 v5 = 8;
Ritor1
parents:
diff changeset
122 LABEL_37:
Ritor1
parents:
diff changeset
123 *v3 = v5;
Ritor1
parents:
diff changeset
124 return v5;
Ritor1
parents:
diff changeset
125 }
Ritor1
parents:
diff changeset
126 if ( v8 == 11 )
Ritor1
parents:
diff changeset
127 {
Ritor1
parents:
diff changeset
128 *v3 = 0;
Ritor1
parents:
diff changeset
129 v7 = 2;
Ritor1
parents:
diff changeset
130 return GetDiceResult(v7, 6u);
Ritor1
parents:
diff changeset
131 }
Ritor1
parents:
diff changeset
132 if ( v8 == 4 )
Ritor1
parents:
diff changeset
133 {
Ritor1
parents:
diff changeset
134 *v3 = 2;
Ritor1
parents:
diff changeset
135 v11 = rand() % 2;
Ritor1
parents:
diff changeset
136 return v11 + 3;
Ritor1
parents:
diff changeset
137 }
Ritor1
parents:
diff changeset
138 if ( v8 == 5 )
Ritor1
parents:
diff changeset
139 {
Ritor1
parents:
diff changeset
140 *v3 = 2;
Ritor1
parents:
diff changeset
141 v10 = rand();
Ritor1
parents:
diff changeset
142 v17 = 3;
Ritor1
parents:
diff changeset
143 return v10 % v17 + 6;
Ritor1
parents:
diff changeset
144 }
Ritor1
parents:
diff changeset
145 if ( v8 == 6 )
Ritor1
parents:
diff changeset
146 {
Ritor1
parents:
diff changeset
147 *v3 = 2;
Ritor1
parents:
diff changeset
148 v9 = rand() % 4;
Ritor1
parents:
diff changeset
149 return v9 + 9;
Ritor1
parents:
diff changeset
150 }
Ritor1
parents:
diff changeset
151 if ( v8 == 7 )
Ritor1
parents:
diff changeset
152 {
Ritor1
parents:
diff changeset
153 *v3 = 1;
Ritor1
parents:
diff changeset
154 return rand() % 4 + 2;
Ritor1
parents:
diff changeset
155 }
Ritor1
parents:
diff changeset
156 if ( v8 == 8 )
Ritor1
parents:
diff changeset
157 {
Ritor1
parents:
diff changeset
158 *v3 = 1;
Ritor1
parents:
diff changeset
159 return rand() % 7 + 4;
Ritor1
parents:
diff changeset
160 }
Ritor1
parents:
diff changeset
161 if ( v8 == 9 )
Ritor1
parents:
diff changeset
162 goto LABEL_45;
Ritor1
parents:
diff changeset
163 if ( v8 != 10 )
Ritor1
parents:
diff changeset
164 goto LABEL_42;
Ritor1
parents:
diff changeset
165 *v3 = 0;
Ritor1
parents:
diff changeset
166 v7 = 1;
Ritor1
parents:
diff changeset
167 return GetDiceResult(v7, 6u);
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169
Ritor1
parents:
diff changeset
170
Ritor1
parents:
diff changeset
171 //----- (00402F07) --------------------------------------------------------
Ritor1
parents:
diff changeset
172 void ItemGen::Reset()
Ritor1
parents:
diff changeset
173 {
Ritor1
parents:
diff changeset
174 this->field_1A = 0;
Ritor1
parents:
diff changeset
175 this->uAttributes = 0;
Ritor1
parents:
diff changeset
176 this->uNumCharges = 0;
Ritor1
parents:
diff changeset
177 this->uAdditionalValue = 0;
Ritor1
parents:
diff changeset
178 this->_bonus_strength = 0;
Ritor1
parents:
diff changeset
179 this->_bonus_type = 0;
Ritor1
parents:
diff changeset
180 this->uItemID = 0;
Ritor1
parents:
diff changeset
181 this->uBodyAnchor = 0;
Ritor1
parents:
diff changeset
182 this->uExpireTime = 0i64;
Ritor1
parents:
diff changeset
183 }
Ritor1
parents:
diff changeset
184
Ritor1
parents:
diff changeset
185 //----- (00458260) --------------------------------------------------------
Ritor1
parents:
diff changeset
186 void ItemGen::UpdateTempBonus(__int64 uTimePlayed)
Ritor1
parents:
diff changeset
187 {
Ritor1
parents:
diff changeset
188 unsigned int v2; // eax@1
Ritor1
parents:
diff changeset
189
Ritor1
parents:
diff changeset
190 v2 = this->uAttributes;
Ritor1
parents:
diff changeset
191 if ( v2 & ITEM_TEMP_BONUS )
Ritor1
parents:
diff changeset
192 {
Ritor1
parents:
diff changeset
193 if ( uTimePlayed > (signed __int64)this->uExpireTime )
Ritor1
parents:
diff changeset
194 {
Ritor1
parents:
diff changeset
195 this->_bonus_type = 0;
Ritor1
parents:
diff changeset
196 LOBYTE(v2) = v2 & 0xF7;
Ritor1
parents:
diff changeset
197 this->uAdditionalValue = 0;
Ritor1
parents:
diff changeset
198 this->uAttributes = v2;
Ritor1
parents:
diff changeset
199 }
Ritor1
parents:
diff changeset
200 }
Ritor1
parents:
diff changeset
201 }
Ritor1
parents:
diff changeset
202
Ritor1
parents:
diff changeset
203 //----- (0045814E) --------------------------------------------------------
Ritor1
parents:
diff changeset
204 char *ItemsTable::Release()
Ritor1
parents:
diff changeset
205 {
Ritor1
parents:
diff changeset
206 ItemsTable *v1; // edi@1
Ritor1
parents:
diff changeset
207 char *result; // eax@23
Ritor1
parents:
diff changeset
208
Ritor1
parents:
diff changeset
209 v1 = this;
Ritor1
parents:
diff changeset
210 if ( pMonstersTXT_Raw )
Ritor1
parents:
diff changeset
211 pAllocator->FreeChunk(pMonstersTXT_Raw);
Ritor1
parents:
diff changeset
212 if ( pMonsterPlacementTXT_Raw )
Ritor1
parents:
diff changeset
213 pAllocator->FreeChunk(pMonsterPlacementTXT_Raw);
Ritor1
parents:
diff changeset
214 if ( pSkillDescTXT_Raw )
Ritor1
parents:
diff changeset
215 pAllocator->FreeChunk(pSkillDescTXT_Raw);
Ritor1
parents:
diff changeset
216 if ( v1->pSpcItemsTXT_Raw )
Ritor1
parents:
diff changeset
217 pAllocator->FreeChunk(v1->pSpcItemsTXT_Raw);
Ritor1
parents:
diff changeset
218 if ( v1->pStdItemsTXT_Raw )
Ritor1
parents:
diff changeset
219 pAllocator->FreeChunk(v1->pStdItemsTXT_Raw);
Ritor1
parents:
diff changeset
220 if ( v1->pRndItemsTXT_Raw )
Ritor1
parents:
diff changeset
221 pAllocator->FreeChunk(v1->pRndItemsTXT_Raw);
Ritor1
parents:
diff changeset
222 if ( v1->pItemsTXT_Raw )
Ritor1
parents:
diff changeset
223 pAllocator->FreeChunk(v1->pItemsTXT_Raw);
Ritor1
parents:
diff changeset
224 if ( pHostileTXT_Raw )
Ritor1
parents:
diff changeset
225 pAllocator->FreeChunk(pHostileTXT_Raw);
Ritor1
parents:
diff changeset
226 if ( pHistoryTXT_Raw )
Ritor1
parents:
diff changeset
227 pAllocator->FreeChunk(pHistoryTXT_Raw);
Ritor1
parents:
diff changeset
228 if ( pPotionsTXT_Raw )
Ritor1
parents:
diff changeset
229 pAllocator->FreeChunk(pPotionsTXT_Raw);
Ritor1
parents:
diff changeset
230 if ( pPotionNotesTXT_Raw )
Ritor1
parents:
diff changeset
231 pAllocator->FreeChunk(pPotionNotesTXT_Raw);
Ritor1
parents:
diff changeset
232 v1->pSpcItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
233 pSkillDescTXT_Raw = 0;
Ritor1
parents:
diff changeset
234 v1->pStdItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
235 v1->pRndItemsTXT_Raw = pSkillDescTXT_Raw;
Ritor1
parents:
diff changeset
236 result = pSkillDescTXT_Raw;
Ritor1
parents:
diff changeset
237 v1->pItemsTXT_Raw = pSkillDescTXT_Raw;
Ritor1
parents:
diff changeset
238 return result;
Ritor1
parents:
diff changeset
239 }
Ritor1
parents:
diff changeset
240
Ritor1
parents:
diff changeset
241
Ritor1
parents:
diff changeset
242 //----- (00456D84) --------------------------------------------------------
Ritor1
parents:
diff changeset
243 void ItemsTable::Initialize()
Ritor1
parents:
diff changeset
244 {
Ritor1
parents:
diff changeset
245 //ItemsTable *v1; // edi@1
Ritor1
parents:
diff changeset
246 char *v2; // eax@1
Ritor1
parents:
diff changeset
247 char *v3; // eax@2
Ritor1
parents:
diff changeset
248 char v4; // cl@3
Ritor1
parents:
diff changeset
249 int v5; // esi@3
Ritor1
parents:
diff changeset
250 char *v6; // esi@21
Ritor1
parents:
diff changeset
251 char *v7; // eax@21
Ritor1
parents:
diff changeset
252 char *v8; // ecx@22
Ritor1
parents:
diff changeset
253 char *v9; // eax@26
Ritor1
parents:
diff changeset
254 char v10; // dl@27
Ritor1
parents:
diff changeset
255 int v11; // ecx@27
Ritor1
parents:
diff changeset
256 int v12; // esi@31
Ritor1
parents:
diff changeset
257 char *v13; // eax@39
Ritor1
parents:
diff changeset
258 int v14; // esi@40
Ritor1
parents:
diff changeset
259 char v15; // cl@41
Ritor1
parents:
diff changeset
260 int v16; // eax@41
Ritor1
parents:
diff changeset
261 char v17; // zf@53
Ritor1
parents:
diff changeset
262 int v18; // eax@57
Ritor1
parents:
diff changeset
263 int *v19; // esi@66
Ritor1
parents:
diff changeset
264 char *v20; // edx@66
Ritor1
parents:
diff changeset
265 int v21; // eax@66
Ritor1
parents:
diff changeset
266 char *v22; // ecx@68
Ritor1
parents:
diff changeset
267 char *v23; // eax@71
Ritor1
parents:
diff changeset
268 int v24; // esi@71
Ritor1
parents:
diff changeset
269 char *v25; // ebx@72
Ritor1
parents:
diff changeset
270 char v26; // cl@73
Ritor1
parents:
diff changeset
271 int v27; // eax@73
Ritor1
parents:
diff changeset
272 char *v28; // ST3C_4@160
Ritor1
parents:
diff changeset
273 char *v29; // ST3C_4@163
Ritor1
parents:
diff changeset
274 char *v30; // eax@175
Ritor1
parents:
diff changeset
275 char *v31; // eax@188
Ritor1
parents:
diff changeset
276 char v32; // al@190
Ritor1
parents:
diff changeset
277 char *v33; // eax@199
Ritor1
parents:
diff changeset
278 const char *v34; // ebx@199
Ritor1
parents:
diff changeset
279 int v35; // esi@199
Ritor1
parents:
diff changeset
280 char *v36; // eax@200
Ritor1
parents:
diff changeset
281 char v37; // dl@201
Ritor1
parents:
diff changeset
282 int v38; // ecx@201
Ritor1
parents:
diff changeset
283 char *v39; // esi@229
Ritor1
parents:
diff changeset
284 char *v40; // eax@229
Ritor1
parents:
diff changeset
285 char *v41; // ecx@230
Ritor1
parents:
diff changeset
286 char *v42; // esi@233
Ritor1
parents:
diff changeset
287 char *v43; // eax@234
Ritor1
parents:
diff changeset
288 char v44; // dl@235
Ritor1
parents:
diff changeset
289 int v45; // ecx@235
Ritor1
parents:
diff changeset
290 signed int v46; // edi@287
Ritor1
parents:
diff changeset
291 char *v47; // ecx@288
Ritor1
parents:
diff changeset
292 char v48; // dl@289
Ritor1
parents:
diff changeset
293 int v49; // eax@289
Ritor1
parents:
diff changeset
294 int v50; // esi@293
Ritor1
parents:
diff changeset
295 signed int v51; // edi@312
Ritor1
parents:
diff changeset
296 char *v52; // ecx@312
Ritor1
parents:
diff changeset
297 char v53; // dl@313
Ritor1
parents:
diff changeset
298 int v54; // eax@313
Ritor1
parents:
diff changeset
299 int v55; // esi@317
Ritor1
parents:
diff changeset
300 signed int v56; // edi@348
Ritor1
parents:
diff changeset
301 char *v57; // eax@348
Ritor1
parents:
diff changeset
302 char v58; // dl@349
Ritor1
parents:
diff changeset
303 int v59; // ecx@349
Ritor1
parents:
diff changeset
304 int v60; // esi@353
Ritor1
parents:
diff changeset
305 char *Str; // [sp+Ch] [bp-18h]@1
Ritor1
parents:
diff changeset
306 signed int Stra; // [sp+Ch] [bp-18h]@22
Ritor1
parents:
diff changeset
307 signed int Strb; // [sp+Ch] [bp-18h]@25
Ritor1
parents:
diff changeset
308 signed int Strc; // [sp+Ch] [bp-18h]@39
Ritor1
parents:
diff changeset
309 signed int Strd; // [sp+Ch] [bp-18h]@66
Ritor1
parents:
diff changeset
310 signed int Stre; // [sp+Ch] [bp-18h]@156
Ritor1
parents:
diff changeset
311 const char **Strf; // [sp+Ch] [bp-18h]@176
Ritor1
parents:
diff changeset
312 const char **Strg; // [sp+Ch] [bp-18h]@182
Ritor1
parents:
diff changeset
313 signed int Strh; // [sp+Ch] [bp-18h]@230
Ritor1
parents:
diff changeset
314 signed int Stri; // [sp+Ch] [bp-18h]@311
Ritor1
parents:
diff changeset
315 char **Strj; // [sp+Ch] [bp-18h]@347
Ritor1
parents:
diff changeset
316 int v72; // [sp+10h] [bp-14h]@7
Ritor1
parents:
diff changeset
317 signed int v73; // [sp+10h] [bp-14h]@21
Ritor1
parents:
diff changeset
318 int v74; // [sp+10h] [bp-14h]@45
Ritor1
parents:
diff changeset
319 int v75; // [sp+10h] [bp-14h]@77
Ritor1
parents:
diff changeset
320 int v76; // [sp+10h] [bp-14h]@205
Ritor1
parents:
diff changeset
321 signed int v77; // [sp+10h] [bp-14h]@229
Ritor1
parents:
diff changeset
322 int v78; // [sp+10h] [bp-14h]@239
Ritor1
parents:
diff changeset
323 signed int v79; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
324 char *v80; // [sp+14h] [bp-10h]@39
Ritor1
parents:
diff changeset
325 char *v81; // [sp+14h] [bp-10h]@175
Ritor1
parents:
diff changeset
326 char *v82; // [sp+14h] [bp-10h]@188
Ritor1
parents:
diff changeset
327 int v83; // [sp+18h] [bp-Ch]@67
Ritor1
parents:
diff changeset
328 size_t v84; // [sp+18h] [bp-Ch]@156
Ritor1
parents:
diff changeset
329 signed int v85; // [sp+18h] [bp-Ch]@176
Ritor1
parents:
diff changeset
330 signed int v86; // [sp+18h] [bp-Ch]@182
Ritor1
parents:
diff changeset
331 signed int v87; // [sp+18h] [bp-Ch]@233
Ritor1
parents:
diff changeset
332 signed int v88; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
333 signed int v89; // [sp+1Ch] [bp-8h]@26
Ritor1
parents:
diff changeset
334 signed int v90; // [sp+1Ch] [bp-8h]@40
Ritor1
parents:
diff changeset
335 signed int v91; // [sp+1Ch] [bp-8h]@72
Ritor1
parents:
diff changeset
336 signed int v92; // [sp+1Ch] [bp-8h]@200
Ritor1
parents:
diff changeset
337 signed int v93; // [sp+1Ch] [bp-8h]@234
Ritor1
parents:
diff changeset
338 signed int v94; // [sp+1Ch] [bp-8h]@288
Ritor1
parents:
diff changeset
339 signed int v95; // [sp+1Ch] [bp-8h]@312
Ritor1
parents:
diff changeset
340 signed int v96; // [sp+1Ch] [bp-8h]@348
Ritor1
parents:
diff changeset
341 signed int v97; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
342 signed int v98; // [sp+20h] [bp-4h]@26
Ritor1
parents:
diff changeset
343 signed int v99; // [sp+20h] [bp-4h]@40
Ritor1
parents:
diff changeset
344 signed int v100; // [sp+20h] [bp-4h]@72
Ritor1
parents:
diff changeset
345 signed int v101; // [sp+20h] [bp-4h]@200
Ritor1
parents:
diff changeset
346 signed int v102; // [sp+20h] [bp-4h]@234
Ritor1
parents:
diff changeset
347 signed int v103; // [sp+20h] [bp-4h]@288
Ritor1
parents:
diff changeset
348
Ritor1
parents:
diff changeset
349 //v1 = this;
Ritor1
parents:
diff changeset
350
Ritor1
parents:
diff changeset
351 pMapStats = new MapStats;
Ritor1
parents:
diff changeset
352 pMapStats->Initialize();
Ritor1
parents:
diff changeset
353
Ritor1
parents:
diff changeset
354 pMonsterStats = new MonsterStats;
Ritor1
parents:
diff changeset
355 pMonsterStats->Initialize();
Ritor1
parents:
diff changeset
356 pMonsterStats->InitializePlacements();
Ritor1
parents:
diff changeset
357
Ritor1
parents:
diff changeset
358 pSpellStats = new SpellStats;
Ritor1
parents:
diff changeset
359 pSpellStats->Initialize();
Ritor1
parents:
diff changeset
360
Ritor1
parents:
diff changeset
361 LoadPotions();
Ritor1
parents:
diff changeset
362 LoadPotionNotes();
Ritor1
parents:
diff changeset
363
Ritor1
parents:
diff changeset
364 pFactionTable = new FactionTable;
Ritor1
parents:
diff changeset
365 pFactionTable->Initialize();
Ritor1
parents:
diff changeset
366
Ritor1
parents:
diff changeset
367 pStorylineText = new StorylineText;
Ritor1
parents:
diff changeset
368 pStorylineText->Initialize();
Ritor1
parents:
diff changeset
369
Ritor1
parents:
diff changeset
370 pStdItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
371 v2 = (char *)pEvents_LOD->LoadRaw("stditems.txt", 0);
Ritor1
parents:
diff changeset
372 pStdItemsTXT_Raw = v2;
Ritor1
parents:
diff changeset
373 strtok(v2, "\r");
Ritor1
parents:
diff changeset
374 strtok(0, "\r");
Ritor1
parents:
diff changeset
375 strtok(0, "\r");
Ritor1
parents:
diff changeset
376 strtok(0, "\r");
Ritor1
parents:
diff changeset
377 Str = (char *)&pEnchantments[0].pParam;
Ritor1
parents:
diff changeset
378 v79 = 24;
Ritor1
parents:
diff changeset
379 do
Ritor1
parents:
diff changeset
380 {
Ritor1
parents:
diff changeset
381 v3 = strtok(0, "\r") + 1;
Ritor1
parents:
diff changeset
382 v97 = 0;
Ritor1
parents:
diff changeset
383 v88 = 0;
Ritor1
parents:
diff changeset
384 do
Ritor1
parents:
diff changeset
385 {
Ritor1
parents:
diff changeset
386 v4 = *v3;
Ritor1
parents:
diff changeset
387 v5 = 0;
Ritor1
parents:
diff changeset
388 while ( v4 != 9 && v4 )
Ritor1
parents:
diff changeset
389 {
Ritor1
parents:
diff changeset
390 ++v5;
Ritor1
parents:
diff changeset
391 v4 = v3[v5];
Ritor1
parents:
diff changeset
392 }
Ritor1
parents:
diff changeset
393 v72 = (int)&v3[v5];
Ritor1
parents:
diff changeset
394 if ( !v3[v5] )
Ritor1
parents:
diff changeset
395 v88 = 1;
Ritor1
parents:
diff changeset
396 v3[v5] = 0;
Ritor1
parents:
diff changeset
397 if ( v5 )
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 if ( v97 )
Ritor1
parents:
diff changeset
400 {
Ritor1
parents:
diff changeset
401 if ( v97 == 1 )
Ritor1
parents:
diff changeset
402 {
Ritor1
parents:
diff changeset
403 *(unsigned int *)Str = (int)RemoveQuotes(v3);
Ritor1
parents:
diff changeset
404 }
Ritor1
parents:
diff changeset
405 else
Ritor1
parents:
diff changeset
406 {
Ritor1
parents:
diff changeset
407 if ( v97 > 1 )
Ritor1
parents:
diff changeset
408 Str[v97 + 6] = atoi(v3);
Ritor1
parents:
diff changeset
409 }
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411 else
Ritor1
parents:
diff changeset
412 {
Ritor1
parents:
diff changeset
413 *((char **)Str + 1) = RemoveQuotes(v3);
Ritor1
parents:
diff changeset
414 }
Ritor1
parents:
diff changeset
415 }
Ritor1
parents:
diff changeset
416 else
Ritor1
parents:
diff changeset
417 {
Ritor1
parents:
diff changeset
418 if ( !v97 )
Ritor1
parents:
diff changeset
419 v88 = 1;
Ritor1
parents:
diff changeset
420 }
Ritor1
parents:
diff changeset
421 ++v97;
Ritor1
parents:
diff changeset
422 v3 = (char *)(v72 + 1);
Ritor1
parents:
diff changeset
423 }
Ritor1
parents:
diff changeset
424 while ( v97 <= 10 && !v88 );
Ritor1
parents:
diff changeset
425 Str += 20;
Ritor1
parents:
diff changeset
426 --v79;
Ritor1
parents:
diff changeset
427 }
Ritor1
parents:
diff changeset
428 while ( v79 );
Ritor1
parents:
diff changeset
429 v6 = (char *)&field_116D8[3];
Ritor1
parents:
diff changeset
430 memset(&field_116D8[3], 0, 0x24u);
Ritor1
parents:
diff changeset
431 v7 = &pEnchantments[0].field_8[4];
Ritor1
parents:
diff changeset
432 v73 = 9;
Ritor1
parents:
diff changeset
433 do
Ritor1
parents:
diff changeset
434 {
Ritor1
parents:
diff changeset
435 v8 = v7;
Ritor1
parents:
diff changeset
436 Stra = 24;
Ritor1
parents:
diff changeset
437 do
Ritor1
parents:
diff changeset
438 {
Ritor1
parents:
diff changeset
439 *(unsigned int *)v6 += (unsigned __int8)*v8;
Ritor1
parents:
diff changeset
440 v8 += 20;
Ritor1
parents:
diff changeset
441 --Stra;
Ritor1
parents:
diff changeset
442 }
Ritor1
parents:
diff changeset
443 while ( Stra );
Ritor1
parents:
diff changeset
444 v6 += 4;
Ritor1
parents:
diff changeset
445 ++v7;
Ritor1
parents:
diff changeset
446 --v73;
Ritor1
parents:
diff changeset
447 }
Ritor1
parents:
diff changeset
448 while ( v73 );
Ritor1
parents:
diff changeset
449 strtok(0, "\r");
Ritor1
parents:
diff changeset
450 strtok(0, "\r");
Ritor1
parents:
diff changeset
451 strtok(0, "\r");
Ritor1
parents:
diff changeset
452 strtok(0, "\r");
Ritor1
parents:
diff changeset
453 strtok(0, "\r");
Ritor1
parents:
diff changeset
454 Strb = 17856;
Ritor1
parents:
diff changeset
455 do
Ritor1
parents:
diff changeset
456 {
Ritor1
parents:
diff changeset
457 v9 = strtok(0, "\r") + 1;
Ritor1
parents:
diff changeset
458 v98 = 0;
Ritor1
parents:
diff changeset
459 v89 = 0;
Ritor1
parents:
diff changeset
460 do
Ritor1
parents:
diff changeset
461 {
Ritor1
parents:
diff changeset
462 v10 = *v9;
Ritor1
parents:
diff changeset
463 v11 = 0;
Ritor1
parents:
diff changeset
464 while ( v10 != 9 && v10 )
Ritor1
parents:
diff changeset
465 {
Ritor1
parents:
diff changeset
466 ++v11;
Ritor1
parents:
diff changeset
467 v10 = v9[v11];
Ritor1
parents:
diff changeset
468 }
Ritor1
parents:
diff changeset
469 v12 = (int)&v9[v11];
Ritor1
parents:
diff changeset
470 if ( !v9[v11] )
Ritor1
parents:
diff changeset
471 v89 = 1;
Ritor1
parents:
diff changeset
472 *(unsigned char *)v12 = 0;
Ritor1
parents:
diff changeset
473 if ( v11 && v98 > 1 )
Ritor1
parents:
diff changeset
474 *(&pItems[0].uItemID + v98 + Strb) = atoi(v9);
Ritor1
parents:
diff changeset
475 ++v98;
Ritor1
parents:
diff changeset
476 v9 = (char *)(v12 + 1);
Ritor1
parents:
diff changeset
477 }
Ritor1
parents:
diff changeset
478 while ( v98 < 4 && !v89 );
Ritor1
parents:
diff changeset
479 Strb += 2;
Ritor1
parents:
diff changeset
480 }
Ritor1
parents:
diff changeset
481 while ( Strb < 17868 );
Ritor1
parents:
diff changeset
482 pSpcItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
483 v13 = (char *)pEvents_LOD->LoadRaw("spcitems.txt", 0);
Ritor1
parents:
diff changeset
484 pSpcItemsTXT_Raw = v13;
Ritor1
parents:
diff changeset
485 strtok(v13, "\r");
Ritor1
parents:
diff changeset
486 strtok(0, "\r");
Ritor1
parents:
diff changeset
487 strtok(0, "\r");
Ritor1
parents:
diff changeset
488 strtok(0, "\r");
Ritor1
parents:
diff changeset
489 v80 = (char *)&pSpecialEnchantments[0].pParam;
Ritor1
parents:
diff changeset
490 Strc = 72;
Ritor1
parents:
diff changeset
491 do
Ritor1
parents:
diff changeset
492 {
Ritor1
parents:
diff changeset
493 v99 = 0;
Ritor1
parents:
diff changeset
494 v14 = (int)(strtok(0, "\r") + 1);
Ritor1
parents:
diff changeset
495 v90 = 0;
Ritor1
parents:
diff changeset
496 do
Ritor1
parents:
diff changeset
497 {
Ritor1
parents:
diff changeset
498 v15 = *(unsigned char *)v14;
Ritor1
parents:
diff changeset
499 v16 = 0;
Ritor1
parents:
diff changeset
500 while ( v15 != 9 && v15 )
Ritor1
parents:
diff changeset
501 {
Ritor1
parents:
diff changeset
502 ++v16;
Ritor1
parents:
diff changeset
503 v15 = *(unsigned char *)(v16 + v14);
Ritor1
parents:
diff changeset
504 }
Ritor1
parents:
diff changeset
505 v74 = v16 + v14;
Ritor1
parents:
diff changeset
506 if ( !*(unsigned char *)(v16 + v14) )
Ritor1
parents:
diff changeset
507 v90 = 1;
Ritor1
parents:
diff changeset
508 *(unsigned char *)(v16 + v14) = 0;
Ritor1
parents:
diff changeset
509 if ( v16 )
Ritor1
parents:
diff changeset
510 {
Ritor1
parents:
diff changeset
511 if ( v99 )
Ritor1
parents:
diff changeset
512 {
Ritor1
parents:
diff changeset
513 if ( v99 == 1 )
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 *(char **)v80 = RemoveQuotes((char *)v14);
Ritor1
parents:
diff changeset
516 }
Ritor1
parents:
diff changeset
517 else
Ritor1
parents:
diff changeset
518 {
Ritor1
parents:
diff changeset
519 if ( v99 <= 1 )
Ritor1
parents:
diff changeset
520 {
Ritor1
parents:
diff changeset
521 v17 = v99 == 14;
Ritor1
parents:
diff changeset
522 }
Ritor1
parents:
diff changeset
523 else
Ritor1
parents:
diff changeset
524 {
Ritor1
parents:
diff changeset
525 v17 = v99 == 14;
Ritor1
parents:
diff changeset
526 if ( v99 < 14 )
Ritor1
parents:
diff changeset
527 {
Ritor1
parents:
diff changeset
528 v80[v99 + 6] = atoi((const char *)v14);
Ritor1
parents:
diff changeset
529 goto LABEL_63;
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531 }
Ritor1
parents:
diff changeset
532 if ( v17 )
Ritor1
parents:
diff changeset
533 {
Ritor1
parents:
diff changeset
534 v18 = atoi((const char *)v14);
Ritor1
parents:
diff changeset
535 *((unsigned int *)v80 + 5) = v18;
Ritor1
parents:
diff changeset
536 if ( !v18 )
Ritor1
parents:
diff changeset
537 *((unsigned int *)v80 + 5) = atoi((const char *)(v14 + 1));
Ritor1
parents:
diff changeset
538 }
Ritor1
parents:
diff changeset
539 else
Ritor1
parents:
diff changeset
540 {
Ritor1
parents:
diff changeset
541 if ( v99 == 15 )
Ritor1
parents:
diff changeset
542 v80[24] = tolower(*(unsigned char *)v14) - 97;
Ritor1
parents:
diff changeset
543 }
Ritor1
parents:
diff changeset
544 }
Ritor1
parents:
diff changeset
545 }
Ritor1
parents:
diff changeset
546 else
Ritor1
parents:
diff changeset
547 {
Ritor1
parents:
diff changeset
548 *((char **)v80 + 1) = RemoveQuotes((char *)v14);
Ritor1
parents:
diff changeset
549 }
Ritor1
parents:
diff changeset
550 }
Ritor1
parents:
diff changeset
551 else
Ritor1
parents:
diff changeset
552 {
Ritor1
parents:
diff changeset
553 if ( !v99 )
Ritor1
parents:
diff changeset
554 v90 = 1;
Ritor1
parents:
diff changeset
555 }
Ritor1
parents:
diff changeset
556 LABEL_63:
Ritor1
parents:
diff changeset
557 ++v99;
Ritor1
parents:
diff changeset
558 v14 = v74 + 1;
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560 while ( v99 <= 15 && !v90 );
Ritor1
parents:
diff changeset
561 v80 += 28;
Ritor1
parents:
diff changeset
562 --Strc;
Ritor1
parents:
diff changeset
563 }
Ritor1
parents:
diff changeset
564 while ( Strc );
Ritor1
parents:
diff changeset
565 v19 = field_11738;
Ritor1
parents:
diff changeset
566 memset(field_11738, 0, 0x60u);
Ritor1
parents:
diff changeset
567 v20 = &pSpecialEnchantments[0].field_8[4];
Ritor1
parents:
diff changeset
568 Strd = 12;
Ritor1
parents:
diff changeset
569 v21 = 71;
Ritor1
parents:
diff changeset
570 field_11798 = 71;
Ritor1
parents:
diff changeset
571 do
Ritor1
parents:
diff changeset
572 {
Ritor1
parents:
diff changeset
573 v83 = 0;
Ritor1
parents:
diff changeset
574 if ( v21 > 0 )
Ritor1
parents:
diff changeset
575 {
Ritor1
parents:
diff changeset
576 v22 = v20;
Ritor1
parents:
diff changeset
577 do
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 *v19 += (unsigned __int8)*v22;
Ritor1
parents:
diff changeset
580 ++v83;
Ritor1
parents:
diff changeset
581 v21 = field_11798;
Ritor1
parents:
diff changeset
582 v22 += 28;
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 while ( v83 < v21 );
Ritor1
parents:
diff changeset
585 }
Ritor1
parents:
diff changeset
586 ++v19;
Ritor1
parents:
diff changeset
587 ++v20;
Ritor1
parents:
diff changeset
588 --Strd;
Ritor1
parents:
diff changeset
589 }
Ritor1
parents:
diff changeset
590 while ( Strd );
Ritor1
parents:
diff changeset
591 Initialize2DA();
Ritor1
parents:
diff changeset
592 pItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
593 v23 = (char *)pEvents_LOD->LoadRaw("items.txt", 0);
Ritor1
parents:
diff changeset
594 pItemsTXT_Raw = v23;
Ritor1
parents:
diff changeset
595 strtok(v23, "\r");
Ritor1
parents:
diff changeset
596 v24 = 0;
Ritor1
parents:
diff changeset
597 strtok(0, "\r");
Ritor1
parents:
diff changeset
598 pItems[0].uItemID = 0;
Ritor1
parents:
diff changeset
599 while ( 2 )
Ritor1
parents:
diff changeset
600 {
Ritor1
parents:
diff changeset
601 v100 = 0;
Ritor1
parents:
diff changeset
602 v25 = strtok(0, "\r") + 1;
Ritor1
parents:
diff changeset
603 v91 = 0;
Ritor1
parents:
diff changeset
604 while ( 2 )
Ritor1
parents:
diff changeset
605 {
Ritor1
parents:
diff changeset
606 v26 = *v25;
Ritor1
parents:
diff changeset
607 v27 = 0;
Ritor1
parents:
diff changeset
608 while ( v26 != 9 && v26 )
Ritor1
parents:
diff changeset
609 {
Ritor1
parents:
diff changeset
610 ++v27;
Ritor1
parents:
diff changeset
611 v26 = v25[v27];
Ritor1
parents:
diff changeset
612 }
Ritor1
parents:
diff changeset
613 v75 = (int)&v25[v27];
Ritor1
parents:
diff changeset
614 if ( !v25[v27] )
Ritor1
parents:
diff changeset
615 v91 = 1;
Ritor1
parents:
diff changeset
616 v25[v27] = 0;
Ritor1
parents:
diff changeset
617 if ( v27 )
Ritor1
parents:
diff changeset
618 {
Ritor1
parents:
diff changeset
619 switch ( v100 )
Ritor1
parents:
diff changeset
620 {
Ritor1
parents:
diff changeset
621 case 0:
Ritor1
parents:
diff changeset
622 v24 = atoi(v25);
Ritor1
parents:
diff changeset
623 break;
Ritor1
parents:
diff changeset
624 case 1:
Ritor1
parents:
diff changeset
625 pItems[v24].pIconName = (char *)RemoveQuotes(v25);
Ritor1
parents:
diff changeset
626 break;
Ritor1
parents:
diff changeset
627 case 2:
Ritor1
parents:
diff changeset
628 pItems[v24].pName = (char *)RemoveQuotes(v25);
Ritor1
parents:
diff changeset
629 break;
Ritor1
parents:
diff changeset
630 case 3:
Ritor1
parents:
diff changeset
631 pItems[v24].uValue = atoi(v25);
Ritor1
parents:
diff changeset
632 break;
Ritor1
parents:
diff changeset
633 case 4:
Ritor1
parents:
diff changeset
634 if ( !_strcmpi(v25, "weapon") )
Ritor1
parents:
diff changeset
635 goto LABEL_89;
Ritor1
parents:
diff changeset
636 if ( _strcmpi(v25, "weapon2") )
Ritor1
parents:
diff changeset
637 {
Ritor1
parents:
diff changeset
638 if ( _strcmpi(v25, "weapon1or2") )
Ritor1
parents:
diff changeset
639 {
Ritor1
parents:
diff changeset
640 if ( _strcmpi(v25, "missile") && _strcmpi(v25, "bow") )
Ritor1
parents:
diff changeset
641 {
Ritor1
parents:
diff changeset
642 if ( _strcmpi(v25, "armor") )
Ritor1
parents:
diff changeset
643 {
Ritor1
parents:
diff changeset
644 if ( _strcmpi(v25, "shield") )
Ritor1
parents:
diff changeset
645 {
Ritor1
parents:
diff changeset
646 if ( _strcmpi(v25, "helm") )
Ritor1
parents:
diff changeset
647 {
Ritor1
parents:
diff changeset
648 if ( _strcmpi(v25, "belt") )
Ritor1
parents:
diff changeset
649 {
Ritor1
parents:
diff changeset
650 if ( _strcmpi(v25, "cloak") )
Ritor1
parents:
diff changeset
651 {
Ritor1
parents:
diff changeset
652 if ( _strcmpi(v25, "gauntlets") )
Ritor1
parents:
diff changeset
653 {
Ritor1
parents:
diff changeset
654 if ( _strcmpi(v25, "boots") )
Ritor1
parents:
diff changeset
655 {
Ritor1
parents:
diff changeset
656 if ( _strcmpi(v25, "ring") )
Ritor1
parents:
diff changeset
657 {
Ritor1
parents:
diff changeset
658 if ( _strcmpi(v25, "amulet") )
Ritor1
parents:
diff changeset
659 {
Ritor1
parents:
diff changeset
660 if ( _strcmpi(v25, "weaponw") )
Ritor1
parents:
diff changeset
661 {
Ritor1
parents:
diff changeset
662 if ( _strcmpi(v25, "herb") && _strcmpi(v25, "reagent") )
Ritor1
parents:
diff changeset
663 {
Ritor1
parents:
diff changeset
664 if ( _strcmpi(v25, "bottle") )
Ritor1
parents:
diff changeset
665 {
Ritor1
parents:
diff changeset
666 if ( _strcmpi(v25, "sscroll") )
Ritor1
parents:
diff changeset
667 {
Ritor1
parents:
diff changeset
668 if ( _strcmpi(v25, "book") )
Ritor1
parents:
diff changeset
669 {
Ritor1
parents:
diff changeset
670 if ( _strcmpi(v25, "mscroll") )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 if ( _strcmpi(v25, "gold") )
Ritor1
parents:
diff changeset
673 {
Ritor1
parents:
diff changeset
674 if ( _strcmpi(v25, "gem") )
Ritor1
parents:
diff changeset
675 pItems[v24].uEquipType = 20;
Ritor1
parents:
diff changeset
676 else
Ritor1
parents:
diff changeset
677 pItems[v24].uEquipType = 19;
Ritor1
parents:
diff changeset
678 }
Ritor1
parents:
diff changeset
679 else
Ritor1
parents:
diff changeset
680 {
Ritor1
parents:
diff changeset
681 pItems[v24].uEquipType = 18;
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683 }
Ritor1
parents:
diff changeset
684 else
Ritor1
parents:
diff changeset
685 {
Ritor1
parents:
diff changeset
686 pItems[v24].uEquipType = 17;
Ritor1
parents:
diff changeset
687 }
Ritor1
parents:
diff changeset
688 }
Ritor1
parents:
diff changeset
689 else
Ritor1
parents:
diff changeset
690 {
Ritor1
parents:
diff changeset
691 pItems[v24].uEquipType = 16;
Ritor1
parents:
diff changeset
692 }
Ritor1
parents:
diff changeset
693 }
Ritor1
parents:
diff changeset
694 else
Ritor1
parents:
diff changeset
695 {
Ritor1
parents:
diff changeset
696 pItems[v24].uEquipType = 15;
Ritor1
parents:
diff changeset
697 }
Ritor1
parents:
diff changeset
698 }
Ritor1
parents:
diff changeset
699 else
Ritor1
parents:
diff changeset
700 {
Ritor1
parents:
diff changeset
701 pItems[v24].uEquipType = 14;
Ritor1
parents:
diff changeset
702 }
Ritor1
parents:
diff changeset
703 }
Ritor1
parents:
diff changeset
704 else
Ritor1
parents:
diff changeset
705 {
Ritor1
parents:
diff changeset
706 pItems[v24].uEquipType = 13;
Ritor1
parents:
diff changeset
707 }
Ritor1
parents:
diff changeset
708 }
Ritor1
parents:
diff changeset
709 else
Ritor1
parents:
diff changeset
710 {
Ritor1
parents:
diff changeset
711 pItems[v24].uEquipType = 12;
Ritor1
parents:
diff changeset
712 }
Ritor1
parents:
diff changeset
713 }
Ritor1
parents:
diff changeset
714 else
Ritor1
parents:
diff changeset
715 {
Ritor1
parents:
diff changeset
716 pItems[v24].uEquipType = 11;
Ritor1
parents:
diff changeset
717 }
Ritor1
parents:
diff changeset
718 }
Ritor1
parents:
diff changeset
719 else
Ritor1
parents:
diff changeset
720 {
Ritor1
parents:
diff changeset
721 pItems[v24].uEquipType = 10;
Ritor1
parents:
diff changeset
722 }
Ritor1
parents:
diff changeset
723 }
Ritor1
parents:
diff changeset
724 else
Ritor1
parents:
diff changeset
725 {
Ritor1
parents:
diff changeset
726 pItems[v24].uEquipType = 9;
Ritor1
parents:
diff changeset
727 }
Ritor1
parents:
diff changeset
728 }
Ritor1
parents:
diff changeset
729 else
Ritor1
parents:
diff changeset
730 {
Ritor1
parents:
diff changeset
731 pItems[v24].uEquipType = 8;
Ritor1
parents:
diff changeset
732 }
Ritor1
parents:
diff changeset
733 }
Ritor1
parents:
diff changeset
734 else
Ritor1
parents:
diff changeset
735 {
Ritor1
parents:
diff changeset
736 pItems[v24].uEquipType = 7;
Ritor1
parents:
diff changeset
737 }
Ritor1
parents:
diff changeset
738 }
Ritor1
parents:
diff changeset
739 else
Ritor1
parents:
diff changeset
740 {
Ritor1
parents:
diff changeset
741 pItems[v24].uEquipType = 6;
Ritor1
parents:
diff changeset
742 }
Ritor1
parents:
diff changeset
743 }
Ritor1
parents:
diff changeset
744 else
Ritor1
parents:
diff changeset
745 {
Ritor1
parents:
diff changeset
746 pItems[v24].uEquipType = 5;
Ritor1
parents:
diff changeset
747 }
Ritor1
parents:
diff changeset
748 }
Ritor1
parents:
diff changeset
749 else
Ritor1
parents:
diff changeset
750 {
Ritor1
parents:
diff changeset
751 pItems[v24].uEquipType = 4;
Ritor1
parents:
diff changeset
752 }
Ritor1
parents:
diff changeset
753 }
Ritor1
parents:
diff changeset
754 else
Ritor1
parents:
diff changeset
755 {
Ritor1
parents:
diff changeset
756 pItems[v24].uEquipType = 3;
Ritor1
parents:
diff changeset
757 }
Ritor1
parents:
diff changeset
758 }
Ritor1
parents:
diff changeset
759 else
Ritor1
parents:
diff changeset
760 {
Ritor1
parents:
diff changeset
761 pItems[v24].uEquipType = 2;
Ritor1
parents:
diff changeset
762 }
Ritor1
parents:
diff changeset
763 }
Ritor1
parents:
diff changeset
764 else
Ritor1
parents:
diff changeset
765 {
Ritor1
parents:
diff changeset
766 LABEL_89:
Ritor1
parents:
diff changeset
767 pItems[v24].uEquipType = 0;
Ritor1
parents:
diff changeset
768 }
Ritor1
parents:
diff changeset
769 }
Ritor1
parents:
diff changeset
770 else
Ritor1
parents:
diff changeset
771 {
Ritor1
parents:
diff changeset
772 pItems[v24].uEquipType = 1;
Ritor1
parents:
diff changeset
773 }
Ritor1
parents:
diff changeset
774 break;
Ritor1
parents:
diff changeset
775 case 5:
Ritor1
parents:
diff changeset
776 if ( _strcmpi(v25, "staff") )
Ritor1
parents:
diff changeset
777 {
Ritor1
parents:
diff changeset
778 if ( _strcmpi(v25, "sword") )
Ritor1
parents:
diff changeset
779 {
Ritor1
parents:
diff changeset
780 if ( _strcmpi(v25, "dagger") )
Ritor1
parents:
diff changeset
781 {
Ritor1
parents:
diff changeset
782 if ( _strcmpi(v25, "axe") )
Ritor1
parents:
diff changeset
783 {
Ritor1
parents:
diff changeset
784 if ( _strcmpi(v25, "spear") )
Ritor1
parents:
diff changeset
785 {
Ritor1
parents:
diff changeset
786 if ( _strcmpi(v25, "bow") )
Ritor1
parents:
diff changeset
787 {
Ritor1
parents:
diff changeset
788 if ( _strcmpi(v25, "mace") )
Ritor1
parents:
diff changeset
789 {
Ritor1
parents:
diff changeset
790 if ( _strcmpi(v25, "blaster") )
Ritor1
parents:
diff changeset
791 {
Ritor1
parents:
diff changeset
792 if ( _strcmpi(v25, "shield") )
Ritor1
parents:
diff changeset
793 {
Ritor1
parents:
diff changeset
794 if ( _strcmpi(v25, "leather") )
Ritor1
parents:
diff changeset
795 {
Ritor1
parents:
diff changeset
796 if ( _strcmpi(v25, "chain") )
Ritor1
parents:
diff changeset
797 {
Ritor1
parents:
diff changeset
798 if ( _strcmpi(v25, "plate") )
Ritor1
parents:
diff changeset
799 {
Ritor1
parents:
diff changeset
800 if ( _strcmpi(v25, "club") )
Ritor1
parents:
diff changeset
801 pItems[v24].uSkillType = 38;
Ritor1
parents:
diff changeset
802 else
Ritor1
parents:
diff changeset
803 pItems[v24].uSkillType = 37;
Ritor1
parents:
diff changeset
804 }
Ritor1
parents:
diff changeset
805 else
Ritor1
parents:
diff changeset
806 {
Ritor1
parents:
diff changeset
807 pItems[v24].uSkillType = 11;
Ritor1
parents:
diff changeset
808 }
Ritor1
parents:
diff changeset
809 }
Ritor1
parents:
diff changeset
810 else
Ritor1
parents:
diff changeset
811 {
Ritor1
parents:
diff changeset
812 pItems[v24].uSkillType = 10;
Ritor1
parents:
diff changeset
813 }
Ritor1
parents:
diff changeset
814 }
Ritor1
parents:
diff changeset
815 else
Ritor1
parents:
diff changeset
816 {
Ritor1
parents:
diff changeset
817 pItems[v24].uSkillType = 9;
Ritor1
parents:
diff changeset
818 }
Ritor1
parents:
diff changeset
819 }
Ritor1
parents:
diff changeset
820 else
Ritor1
parents:
diff changeset
821 {
Ritor1
parents:
diff changeset
822 pItems[v24].uSkillType = 8;
Ritor1
parents:
diff changeset
823 }
Ritor1
parents:
diff changeset
824 }
Ritor1
parents:
diff changeset
825 else
Ritor1
parents:
diff changeset
826 {
Ritor1
parents:
diff changeset
827 pItems[v24].uSkillType = 7;
Ritor1
parents:
diff changeset
828 }
Ritor1
parents:
diff changeset
829 }
Ritor1
parents:
diff changeset
830 else
Ritor1
parents:
diff changeset
831 {
Ritor1
parents:
diff changeset
832 pItems[v24].uSkillType = 6;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834 }
Ritor1
parents:
diff changeset
835 else
Ritor1
parents:
diff changeset
836 {
Ritor1
parents:
diff changeset
837 pItems[v24].uSkillType = 5;
Ritor1
parents:
diff changeset
838 }
Ritor1
parents:
diff changeset
839 }
Ritor1
parents:
diff changeset
840 else
Ritor1
parents:
diff changeset
841 {
Ritor1
parents:
diff changeset
842 pItems[v24].uSkillType = 4;
Ritor1
parents:
diff changeset
843 }
Ritor1
parents:
diff changeset
844 }
Ritor1
parents:
diff changeset
845 else
Ritor1
parents:
diff changeset
846 {
Ritor1
parents:
diff changeset
847 pItems[v24].uSkillType = 3;
Ritor1
parents:
diff changeset
848 }
Ritor1
parents:
diff changeset
849 }
Ritor1
parents:
diff changeset
850 else
Ritor1
parents:
diff changeset
851 {
Ritor1
parents:
diff changeset
852 pItems[v24].uSkillType = 2;
Ritor1
parents:
diff changeset
853 }
Ritor1
parents:
diff changeset
854 }
Ritor1
parents:
diff changeset
855 else
Ritor1
parents:
diff changeset
856 {
Ritor1
parents:
diff changeset
857 pItems[v24].uSkillType = 1;
Ritor1
parents:
diff changeset
858 }
Ritor1
parents:
diff changeset
859 }
Ritor1
parents:
diff changeset
860 else
Ritor1
parents:
diff changeset
861 {
Ritor1
parents:
diff changeset
862 pItems[v24].uSkillType = 0;
Ritor1
parents:
diff changeset
863 }
Ritor1
parents:
diff changeset
864 break;
Ritor1
parents:
diff changeset
865 case 6:
Ritor1
parents:
diff changeset
866 Stre = 0;
Ritor1
parents:
diff changeset
867 v84 = strlen(v25);
Ritor1
parents:
diff changeset
868 if ( (signed int)v84 > 0 )
Ritor1
parents:
diff changeset
869 {
Ritor1
parents:
diff changeset
870 while ( tolower((unsigned __int8)v25[Stre]) != 'd' )
Ritor1
parents:
diff changeset
871 {
Ritor1
parents:
diff changeset
872 ++Stre;
Ritor1
parents:
diff changeset
873 if ( Stre >= (signed int)v84 )
Ritor1
parents:
diff changeset
874 goto LABEL_161;
Ritor1
parents:
diff changeset
875 }
Ritor1
parents:
diff changeset
876 v25[Stre] = 0;
Ritor1
parents:
diff changeset
877 v28 = (char *)&pItems[v24];
Ritor1
parents:
diff changeset
878 v28[34] = atoi(v25);
Ritor1
parents:
diff changeset
879 v28[35] = atoi(&v25[Stre + 1]);
Ritor1
parents:
diff changeset
880 v25[Stre] = 'd';
Ritor1
parents:
diff changeset
881 }
Ritor1
parents:
diff changeset
882 LABEL_161:
Ritor1
parents:
diff changeset
883 if ( Stre == v84 && tolower((unsigned __int8)*v25) != 115 )
Ritor1
parents:
diff changeset
884 {
Ritor1
parents:
diff changeset
885 v29 = (char *)&pItems[v24];
Ritor1
parents:
diff changeset
886 v29[34] = atoi(v25);
Ritor1
parents:
diff changeset
887 v29[35] = 1;
Ritor1
parents:
diff changeset
888 }
Ritor1
parents:
diff changeset
889 break;
Ritor1
parents:
diff changeset
890 case 7:
Ritor1
parents:
diff changeset
891 pItems[v24].uDamageMod = atoi(v25);
Ritor1
parents:
diff changeset
892 break;
Ritor1
parents:
diff changeset
893 case 8:
Ritor1
parents:
diff changeset
894 if ( _strcmpi(v25, "artifact") )
Ritor1
parents:
diff changeset
895 {
Ritor1
parents:
diff changeset
896 if ( _strcmpi(v25, "relic") )
Ritor1
parents:
diff changeset
897 {
Ritor1
parents:
diff changeset
898 if ( _strcmpi(v25, "special") )
Ritor1
parents:
diff changeset
899 pItems[v24].uMaterial = 0;
Ritor1
parents:
diff changeset
900 else
Ritor1
parents:
diff changeset
901 pItems[v24].uMaterial = 3;
Ritor1
parents:
diff changeset
902 }
Ritor1
parents:
diff changeset
903 else
Ritor1
parents:
diff changeset
904 {
Ritor1
parents:
diff changeset
905 pItems[v24].uMaterial = 2;
Ritor1
parents:
diff changeset
906 }
Ritor1
parents:
diff changeset
907 }
Ritor1
parents:
diff changeset
908 else
Ritor1
parents:
diff changeset
909 {
Ritor1
parents:
diff changeset
910 pItems[v24].uMaterial = 1;
Ritor1
parents:
diff changeset
911 }
Ritor1
parents:
diff changeset
912 break;
Ritor1
parents:
diff changeset
913 case 9:
Ritor1
parents:
diff changeset
914 BYTE2(pItems[v24 + 1].uItemID) = atoi(v25);
Ritor1
parents:
diff changeset
915 break;
Ritor1
parents:
diff changeset
916 case 10:
Ritor1
parents:
diff changeset
917 pItems[v24].pUnidentifiedName = (char *)RemoveQuotes(v25);
Ritor1
parents:
diff changeset
918 break;
Ritor1
parents:
diff changeset
919 case 11:
Ritor1
parents:
diff changeset
920 pItems[v24].uSpriteID = atoi(v25);
Ritor1
parents:
diff changeset
921 break;
Ritor1
parents:
diff changeset
922 case 12:
Ritor1
parents:
diff changeset
923 v30 = (char *)&pItems[v24];
Ritor1
parents:
diff changeset
924 v81 = v30;
Ritor1
parents:
diff changeset
925 if ( v30[37] == 3 )
Ritor1
parents:
diff changeset
926 {
Ritor1
parents:
diff changeset
927 v85 = 0;
Ritor1
parents:
diff changeset
928 Strf = (const char **)&pEnchantments[0].pParam;
Ritor1
parents:
diff changeset
929 while ( _strcmpi(*Strf, v25) )
Ritor1
parents:
diff changeset
930 {
Ritor1
parents:
diff changeset
931 ++v85;
Ritor1
parents:
diff changeset
932 Strf += 5;
Ritor1
parents:
diff changeset
933 if ( v85 >= 24 )
Ritor1
parents:
diff changeset
934 goto LABEL_181;
Ritor1
parents:
diff changeset
935 }
Ritor1
parents:
diff changeset
936 v81[39] = v85 + 1;
Ritor1
parents:
diff changeset
937 LABEL_181:
Ritor1
parents:
diff changeset
938 if ( !v81[39] )
Ritor1
parents:
diff changeset
939 {
Ritor1
parents:
diff changeset
940 v86 = 0;
Ritor1
parents:
diff changeset
941 Strg = (const char **)&pSpecialEnchantments[0].pParam;
Ritor1
parents:
diff changeset
942 while ( _strcmpi(*Strg, v25) )
Ritor1
parents:
diff changeset
943 {
Ritor1
parents:
diff changeset
944 ++v86;
Ritor1
parents:
diff changeset
945 Strg += 7;
Ritor1
parents:
diff changeset
946 if ( v86 >= 72 )
Ritor1
parents:
diff changeset
947 goto LABEL_196;
Ritor1
parents:
diff changeset
948 }
Ritor1
parents:
diff changeset
949 v81[38] = v86 + 1;
Ritor1
parents:
diff changeset
950 }
Ritor1
parents:
diff changeset
951 }
Ritor1
parents:
diff changeset
952 else
Ritor1
parents:
diff changeset
953 {
Ritor1
parents:
diff changeset
954 v30[38] = 0;
Ritor1
parents:
diff changeset
955 v30[39] = 0;
Ritor1
parents:
diff changeset
956 }
Ritor1
parents:
diff changeset
957 break;
Ritor1
parents:
diff changeset
958 case 13:
Ritor1
parents:
diff changeset
959 v31 = (char *)&pItems[v24];
Ritor1
parents:
diff changeset
960 v82 = v31;
Ritor1
parents:
diff changeset
961 if ( v31[37] == 3 && v31[39] )
Ritor1
parents:
diff changeset
962 {
Ritor1
parents:
diff changeset
963 v32 = atoi(v25);
Ritor1
parents:
diff changeset
964 v82[40] = v32;
Ritor1
parents:
diff changeset
965 if ( !v32 )
Ritor1
parents:
diff changeset
966 v82[40] = 1;
Ritor1
parents:
diff changeset
967 }
Ritor1
parents:
diff changeset
968 else
Ritor1
parents:
diff changeset
969 {
Ritor1
parents:
diff changeset
970 v31[40] = 0;
Ritor1
parents:
diff changeset
971 }
Ritor1
parents:
diff changeset
972 break;
Ritor1
parents:
diff changeset
973 case 14:
Ritor1
parents:
diff changeset
974 pItems[v24].uEquipX = atoi(v25);
Ritor1
parents:
diff changeset
975 break;
Ritor1
parents:
diff changeset
976 case 15:
Ritor1
parents:
diff changeset
977 pItems[v24].uEquipY = atoi(v25);
Ritor1
parents:
diff changeset
978 break;
Ritor1
parents:
diff changeset
979 case 16:
Ritor1
parents:
diff changeset
980 pItems[v24].pDescription = (char *)RemoveQuotes(v25);
Ritor1
parents:
diff changeset
981 break;
Ritor1
parents:
diff changeset
982 default:
Ritor1
parents:
diff changeset
983 break;
Ritor1
parents:
diff changeset
984 }
Ritor1
parents:
diff changeset
985 }
Ritor1
parents:
diff changeset
986 LABEL_196:
Ritor1
parents:
diff changeset
987 ++v100;
Ritor1
parents:
diff changeset
988 v25 = (char *)(v75 + 1);
Ritor1
parents:
diff changeset
989 if ( v100 <= 16 && !v91 )
Ritor1
parents:
diff changeset
990 continue;
Ritor1
parents:
diff changeset
991 break;
Ritor1
parents:
diff changeset
992 }
Ritor1
parents:
diff changeset
993 ++v24;
Ritor1
parents:
diff changeset
994 if ( v24 < 800 )
Ritor1
parents:
diff changeset
995 continue;
Ritor1
parents:
diff changeset
996 break;
Ritor1
parents:
diff changeset
997 }
Ritor1
parents:
diff changeset
998 pRndItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
999 pItems[0].uItemID = v24;
Ritor1
parents:
diff changeset
1000 v33 = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0);
Ritor1
parents:
diff changeset
1001 v34 = "\r";
Ritor1
parents:
diff changeset
1002 pRndItemsTXT_Raw = v33;
Ritor1
parents:
diff changeset
1003 strtok(v33, "\r");
Ritor1
parents:
diff changeset
1004 v35 = 0;
Ritor1
parents:
diff changeset
1005 strtok(0, "\r");
Ritor1
parents:
diff changeset
1006 strtok(0, "\r");
Ritor1
parents:
diff changeset
1007 strtok(0, "\r");
Ritor1
parents:
diff changeset
1008 do
Ritor1
parents:
diff changeset
1009 {
Ritor1
parents:
diff changeset
1010 v101 = 0;
Ritor1
parents:
diff changeset
1011 v36 = strtok(0, "\r") + 1;
Ritor1
parents:
diff changeset
1012 v92 = 0;
Ritor1
parents:
diff changeset
1013 do
Ritor1
parents:
diff changeset
1014 {
Ritor1
parents:
diff changeset
1015 v37 = *v36;
Ritor1
parents:
diff changeset
1016 v38 = 0;
Ritor1
parents:
diff changeset
1017 while ( v37 != 9 && v37 )
Ritor1
parents:
diff changeset
1018 {
Ritor1
parents:
diff changeset
1019 ++v38;
Ritor1
parents:
diff changeset
1020 v37 = v36[v38];
Ritor1
parents:
diff changeset
1021 }
Ritor1
parents:
diff changeset
1022 v76 = (int)&v36[v38];
Ritor1
parents:
diff changeset
1023 if ( !v36[v38] )
Ritor1
parents:
diff changeset
1024 v92 = 1;
Ritor1
parents:
diff changeset
1025 *(unsigned char *)v76 = 0;
Ritor1
parents:
diff changeset
1026 if ( v38 )
Ritor1
parents:
diff changeset
1027 {
Ritor1
parents:
diff changeset
1028 if ( v101 )
Ritor1
parents:
diff changeset
1029 {
Ritor1
parents:
diff changeset
1030 switch ( v101 )
Ritor1
parents:
diff changeset
1031 {
Ritor1
parents:
diff changeset
1032 case 2:
Ritor1
parents:
diff changeset
1033 pItems[v35].field_2C = atoi(v36);
Ritor1
parents:
diff changeset
1034 break;
Ritor1
parents:
diff changeset
1035 case 3:
Ritor1
parents:
diff changeset
1036 pItems[v35].field_2D = atoi(v36);
Ritor1
parents:
diff changeset
1037 break;
Ritor1
parents:
diff changeset
1038 case 4:
Ritor1
parents:
diff changeset
1039 pItems[v35].field_2E = atoi(v36);
Ritor1
parents:
diff changeset
1040 break;
Ritor1
parents:
diff changeset
1041 case 5:
Ritor1
parents:
diff changeset
1042 pItems[v35].field_2F = atoi(v36);
Ritor1
parents:
diff changeset
1043 break;
Ritor1
parents:
diff changeset
1044 case 6:
Ritor1
parents:
diff changeset
1045 *((unsigned char *)&pItems[0].uItemID + 16 * (3 * v35 + 3)) = atoi(v36);
Ritor1
parents:
diff changeset
1046 break;
Ritor1
parents:
diff changeset
1047 case 7:
Ritor1
parents:
diff changeset
1048 BYTE1(pItems[v35 + 1].uItemID) = atoi(v36);
Ritor1
parents:
diff changeset
1049 break;
Ritor1
parents:
diff changeset
1050 }
Ritor1
parents:
diff changeset
1051 }
Ritor1
parents:
diff changeset
1052 else
Ritor1
parents:
diff changeset
1053 {
Ritor1
parents:
diff changeset
1054 v35 = atoi(v36);
Ritor1
parents:
diff changeset
1055 }
Ritor1
parents:
diff changeset
1056 }
Ritor1
parents:
diff changeset
1057 else
Ritor1
parents:
diff changeset
1058 {
Ritor1
parents:
diff changeset
1059 if ( !v101 )
Ritor1
parents:
diff changeset
1060 v92 = 1;
Ritor1
parents:
diff changeset
1061 }
Ritor1
parents:
diff changeset
1062 ++v101;
Ritor1
parents:
diff changeset
1063 v36 = (char *)(v76 + 1);
Ritor1
parents:
diff changeset
1064 }
Ritor1
parents:
diff changeset
1065 while ( v101 <= 7 && !v92 );
Ritor1
parents:
diff changeset
1066 ++v35;
Ritor1
parents:
diff changeset
1067 }
Ritor1
parents:
diff changeset
1068 while ( v35 < 619 );
Ritor1
parents:
diff changeset
1069 if ( pRndItemsTXT_Raw )
Ritor1
parents:
diff changeset
1070 {
Ritor1
parents:
diff changeset
1071 pAllocator->FreeChunk(pRndItemsTXT_Raw);
Ritor1
parents:
diff changeset
1072 pRndItemsTXT_Raw = 0;
Ritor1
parents:
diff changeset
1073 }
Ritor1
parents:
diff changeset
1074 v39 = (char *)field_11684;
Ritor1
parents:
diff changeset
1075 memset(field_11684, 0, 0x18u);
Ritor1
parents:
diff changeset
1076 v40 = &pItems[0].field_2C;
Ritor1
parents:
diff changeset
1077 v77 = 6;
Ritor1
parents:
diff changeset
1078 do
Ritor1
parents:
diff changeset
1079 {
Ritor1
parents:
diff changeset
1080 v41 = v40;
Ritor1
parents:
diff changeset
1081 Strh = 800;
Ritor1
parents:
diff changeset
1082 do
Ritor1
parents:
diff changeset
1083 {
Ritor1
parents:
diff changeset
1084 *(unsigned int *)v39 += (unsigned __int8)*v41;
Ritor1
parents:
diff changeset
1085 v41 += 48;
Ritor1
parents:
diff changeset
1086 --Strh;
Ritor1
parents:
diff changeset
1087 }
Ritor1
parents:
diff changeset
1088 while ( Strh );
Ritor1
parents:
diff changeset
1089 v39 += 4;
Ritor1
parents:
diff changeset
1090 ++v40;
Ritor1
parents:
diff changeset
1091 --v77;
Ritor1
parents:
diff changeset
1092 }
Ritor1
parents:
diff changeset
1093 while ( v77 );
Ritor1
parents:
diff changeset
1094 v42 = 0;
Ritor1
parents:
diff changeset
1095 strtok(0, "\r");
Ritor1
parents:
diff changeset
1096 strtok(0, "\r");
Ritor1
parents:
diff changeset
1097 strtok(0, "\r");
Ritor1
parents:
diff changeset
1098 strtok(0, "\r");
Ritor1
parents:
diff changeset
1099 strtok(0, "\r");
Ritor1
parents:
diff changeset
1100 v87 = 0;
Ritor1
parents:
diff changeset
1101 do
Ritor1
parents:
diff changeset
1102 {
Ritor1
parents:
diff changeset
1103 v43 = strtok(v42, "\r") + 1;
Ritor1
parents:
diff changeset
1104 v102 = (signed int)v42;
Ritor1
parents:
diff changeset
1105 v93 = (signed int)v42;
Ritor1
parents:
diff changeset
1106 do
Ritor1
parents:
diff changeset
1107 {
Ritor1
parents:
diff changeset
1108 v44 = *v43;
Ritor1
parents:
diff changeset
1109 v45 = 0;
Ritor1
parents:
diff changeset
1110 while ( v44 != 9 && v44 )
Ritor1
parents:
diff changeset
1111 {
Ritor1
parents:
diff changeset
1112 ++v45;
Ritor1
parents:
diff changeset
1113 v44 = v43[v45];
Ritor1
parents:
diff changeset
1114 }
Ritor1
parents:
diff changeset
1115 v78 = (int)&v43[v45];
Ritor1
parents:
diff changeset
1116 if ( !v43[v45] )
Ritor1
parents:
diff changeset
1117 v93 = 1;
Ritor1
parents:
diff changeset
1118 v42 = 0;
Ritor1
parents:
diff changeset
1119 *(unsigned char *)v78 = 0;
Ritor1
parents:
diff changeset
1120 if ( v45 )
Ritor1
parents:
diff changeset
1121 {
Ritor1
parents:
diff changeset
1122 switch ( v102 )
Ritor1
parents:
diff changeset
1123 {
Ritor1
parents:
diff changeset
1124 case 2:
Ritor1
parents:
diff changeset
1125 if ( v87 )
Ritor1
parents:
diff changeset
1126 {
Ritor1
parents:
diff changeset
1127 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1128 {
Ritor1
parents:
diff changeset
1129 *(unsigned int *)&field_1169C[24] = atoi(v43);
Ritor1
parents:
diff changeset
1130 }
Ritor1
parents:
diff changeset
1131 else
Ritor1
parents:
diff changeset
1132 {
Ritor1
parents:
diff changeset
1133 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1134 *(unsigned int *)&field_1169C[48] = atoi(v43);
Ritor1
parents:
diff changeset
1135 }
Ritor1
parents:
diff changeset
1136 }
Ritor1
parents:
diff changeset
1137 else
Ritor1
parents:
diff changeset
1138 {
Ritor1
parents:
diff changeset
1139 *(unsigned int *)&field_1169C[0] = atoi(v43);
Ritor1
parents:
diff changeset
1140 }
Ritor1
parents:
diff changeset
1141 break;
Ritor1
parents:
diff changeset
1142 case 3:
Ritor1
parents:
diff changeset
1143 if ( v87 )
Ritor1
parents:
diff changeset
1144 {
Ritor1
parents:
diff changeset
1145 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1146 {
Ritor1
parents:
diff changeset
1147 *(unsigned int *)&field_1169C[28] = atoi(v43);
Ritor1
parents:
diff changeset
1148 }
Ritor1
parents:
diff changeset
1149 else
Ritor1
parents:
diff changeset
1150 {
Ritor1
parents:
diff changeset
1151 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1152 *(unsigned int *)&field_1169C[52] = atoi(v43);
Ritor1
parents:
diff changeset
1153 }
Ritor1
parents:
diff changeset
1154 }
Ritor1
parents:
diff changeset
1155 else
Ritor1
parents:
diff changeset
1156 {
Ritor1
parents:
diff changeset
1157 *(unsigned int *)&field_1169C[4] = atoi(v43);
Ritor1
parents:
diff changeset
1158 }
Ritor1
parents:
diff changeset
1159 break;
Ritor1
parents:
diff changeset
1160 case 4:
Ritor1
parents:
diff changeset
1161 if ( v87 )
Ritor1
parents:
diff changeset
1162 {
Ritor1
parents:
diff changeset
1163 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1164 {
Ritor1
parents:
diff changeset
1165 *(unsigned int *)&field_1169C[32] = atoi(v43);
Ritor1
parents:
diff changeset
1166 }
Ritor1
parents:
diff changeset
1167 else
Ritor1
parents:
diff changeset
1168 {
Ritor1
parents:
diff changeset
1169 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1170 *(unsigned int *)&field_1169C[56] = atoi(v43);
Ritor1
parents:
diff changeset
1171 }
Ritor1
parents:
diff changeset
1172 }
Ritor1
parents:
diff changeset
1173 else
Ritor1
parents:
diff changeset
1174 {
Ritor1
parents:
diff changeset
1175 *(unsigned int *)&field_1169C[8] = atoi(v43);
Ritor1
parents:
diff changeset
1176 }
Ritor1
parents:
diff changeset
1177 break;
Ritor1
parents:
diff changeset
1178 case 5:
Ritor1
parents:
diff changeset
1179 if ( v87 )
Ritor1
parents:
diff changeset
1180 {
Ritor1
parents:
diff changeset
1181 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1182 {
Ritor1
parents:
diff changeset
1183 *(unsigned int *)&field_1169C[36] = atoi(v43);
Ritor1
parents:
diff changeset
1184 }
Ritor1
parents:
diff changeset
1185 else
Ritor1
parents:
diff changeset
1186 {
Ritor1
parents:
diff changeset
1187 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1188 field_116D8[0] = atoi(v43);
Ritor1
parents:
diff changeset
1189 }
Ritor1
parents:
diff changeset
1190 }
Ritor1
parents:
diff changeset
1191 else
Ritor1
parents:
diff changeset
1192 {
Ritor1
parents:
diff changeset
1193 *(unsigned int *)&field_1169C[12] = atoi(v43);
Ritor1
parents:
diff changeset
1194 }
Ritor1
parents:
diff changeset
1195 break;
Ritor1
parents:
diff changeset
1196 case 6:
Ritor1
parents:
diff changeset
1197 if ( v87 )
Ritor1
parents:
diff changeset
1198 {
Ritor1
parents:
diff changeset
1199 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1200 {
Ritor1
parents:
diff changeset
1201 *(unsigned int *)&field_1169C[40] = atoi(v43);
Ritor1
parents:
diff changeset
1202 }
Ritor1
parents:
diff changeset
1203 else
Ritor1
parents:
diff changeset
1204 {
Ritor1
parents:
diff changeset
1205 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1206 field_116D8[1] = atoi(v43);
Ritor1
parents:
diff changeset
1207 }
Ritor1
parents:
diff changeset
1208 }
Ritor1
parents:
diff changeset
1209 else
Ritor1
parents:
diff changeset
1210 {
Ritor1
parents:
diff changeset
1211 *(unsigned int *)&field_1169C[16] = atoi(v43);
Ritor1
parents:
diff changeset
1212 }
Ritor1
parents:
diff changeset
1213 break;
Ritor1
parents:
diff changeset
1214 case 7:
Ritor1
parents:
diff changeset
1215 if ( v87 )
Ritor1
parents:
diff changeset
1216 {
Ritor1
parents:
diff changeset
1217 if ( v87 == 1 )
Ritor1
parents:
diff changeset
1218 {
Ritor1
parents:
diff changeset
1219 *(unsigned int *)&field_1169C[44] = atoi(v43);
Ritor1
parents:
diff changeset
1220 }
Ritor1
parents:
diff changeset
1221 else
Ritor1
parents:
diff changeset
1222 {
Ritor1
parents:
diff changeset
1223 if ( v87 == 2 )
Ritor1
parents:
diff changeset
1224 field_116D8[2] = atoi(v43);
Ritor1
parents:
diff changeset
1225 }
Ritor1
parents:
diff changeset
1226 }
Ritor1
parents:
diff changeset
1227 else
Ritor1
parents:
diff changeset
1228 {
Ritor1
parents:
diff changeset
1229 *(unsigned int *)&field_1169C[20] = atoi(v43);
Ritor1
parents:
diff changeset
1230 }
Ritor1
parents:
diff changeset
1231 break;
Ritor1
parents:
diff changeset
1232 }
Ritor1
parents:
diff changeset
1233 }
Ritor1
parents:
diff changeset
1234 ++v102;
Ritor1
parents:
diff changeset
1235 v43 = (char *)(v78 + 1);
Ritor1
parents:
diff changeset
1236 }
Ritor1
parents:
diff changeset
1237 while ( v102 <= 7 && !v93 );
Ritor1
parents:
diff changeset
1238 ++v87;
Ritor1
parents:
diff changeset
1239 }
Ritor1
parents:
diff changeset
1240 while ( v87 < 3 );
Ritor1
parents:
diff changeset
1241 pSkillDescTXT_Raw = 0;
Ritor1
parents:
diff changeset
1242 pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0);
Ritor1
parents:
diff changeset
1243 strtok(pSkillDescTXT_Raw, "\r");
Ritor1
parents:
diff changeset
1244 v46 = 0;
Ritor1
parents:
diff changeset
1245 do
Ritor1
parents:
diff changeset
1246 {
Ritor1
parents:
diff changeset
1247 v103 = 0;
Ritor1
parents:
diff changeset
1248 v94 = 0;
Ritor1
parents:
diff changeset
1249 v47 = strtok(0, "\r") + 1;
Ritor1
parents:
diff changeset
1250 do
Ritor1
parents:
diff changeset
1251 {
Ritor1
parents:
diff changeset
1252 v48 = *v47;
Ritor1
parents:
diff changeset
1253 v49 = 0;
Ritor1
parents:
diff changeset
1254 while ( v48 != 9 && v48 )
Ritor1
parents:
diff changeset
1255 {
Ritor1
parents:
diff changeset
1256 ++v49;
Ritor1
parents:
diff changeset
1257 v48 = v47[v49];
Ritor1
parents:
diff changeset
1258 }
Ritor1
parents:
diff changeset
1259 v50 = (int)&v47[v49];
Ritor1
parents:
diff changeset
1260 if ( !v47[v49] )
Ritor1
parents:
diff changeset
1261 v94 = 1;
Ritor1
parents:
diff changeset
1262 *(unsigned char *)v50 = 0;
Ritor1
parents:
diff changeset
1263 if ( v49 )
Ritor1
parents:
diff changeset
1264 {
Ritor1
parents:
diff changeset
1265 switch ( v103 )
Ritor1
parents:
diff changeset
1266 {
Ritor1
parents:
diff changeset
1267 case 1:
Ritor1
parents:
diff changeset
1268 pSkillDesc[v46] = (char *)RemoveQuotes(v47);
Ritor1
parents:
diff changeset
1269 break;
Ritor1
parents:
diff changeset
1270 case 2:
Ritor1
parents:
diff changeset
1271 pNormalSkillDesc[v46] = (char *)RemoveQuotes(v47);
Ritor1
parents:
diff changeset
1272 break;
Ritor1
parents:
diff changeset
1273 case 3:
Ritor1
parents:
diff changeset
1274 pExpertSkillDesc[v46] = (char *)RemoveQuotes(v47);
Ritor1
parents:
diff changeset
1275 break;
Ritor1
parents:
diff changeset
1276 case 4:
Ritor1
parents:
diff changeset
1277 pMasterSkillDesc[v46] = (char *)RemoveQuotes(v47);
Ritor1
parents:
diff changeset
1278 break;
Ritor1
parents:
diff changeset
1279 case 5:
Ritor1
parents:
diff changeset
1280 pGrandSkillDesc[v46] = (char *)RemoveQuotes(v47);
Ritor1
parents:
diff changeset
1281 break;
Ritor1
parents:
diff changeset
1282 }
Ritor1
parents:
diff changeset
1283 }
Ritor1
parents:
diff changeset
1284 else
Ritor1
parents:
diff changeset
1285 {
Ritor1
parents:
diff changeset
1286 if ( !v103 )
Ritor1
parents:
diff changeset
1287 v94 = 1;
Ritor1
parents:
diff changeset
1288 }
Ritor1
parents:
diff changeset
1289 ++v103;
Ritor1
parents:
diff changeset
1290 v47 = (char *)(v50 + 1);
Ritor1
parents:
diff changeset
1291 }
Ritor1
parents:
diff changeset
1292 while ( v103 <= 5 && !v94 );
Ritor1
parents:
diff changeset
1293 ++v46;
Ritor1
parents:
diff changeset
1294 }
Ritor1
parents:
diff changeset
1295 while ( v46 < 37 );
Ritor1
parents:
diff changeset
1296 pStatsTXT_Raw = 0;
Ritor1
parents:
diff changeset
1297 pStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("stats.txt", 0);
Ritor1
parents:
diff changeset
1298 strtok(pStatsTXT_Raw, "\r");
Ritor1
parents:
diff changeset
1299 Stri = 0;
Ritor1
parents:
diff changeset
1300 do
Ritor1
parents:
diff changeset
1301 {
Ritor1
parents:
diff changeset
1302 v51 = 0;
Ritor1
parents:
diff changeset
1303 v95 = 0;
Ritor1
parents:
diff changeset
1304 v52 = strtok(0, v34) + 1;
Ritor1
parents:
diff changeset
1305 do
Ritor1
parents:
diff changeset
1306 {
Ritor1
parents:
diff changeset
1307 v53 = *v52;
Ritor1
parents:
diff changeset
1308 v54 = 0;
Ritor1
parents:
diff changeset
1309 if ( *v52 != 9 )
Ritor1
parents:
diff changeset
1310 {
Ritor1
parents:
diff changeset
1311 do
Ritor1
parents:
diff changeset
1312 {
Ritor1
parents:
diff changeset
1313 if ( !v53 )
Ritor1
parents:
diff changeset
1314 break;
Ritor1
parents:
diff changeset
1315 ++v54;
Ritor1
parents:
diff changeset
1316 v53 = v52[v54];
Ritor1
parents:
diff changeset
1317 }
Ritor1
parents:
diff changeset
1318 while ( v53 != 9 );
Ritor1
parents:
diff changeset
1319 v34 = "\r";
Ritor1
parents:
diff changeset
1320 }
Ritor1
parents:
diff changeset
1321 v55 = (int)&v52[v54];
Ritor1
parents:
diff changeset
1322 if ( !v52[v54] )
Ritor1
parents:
diff changeset
1323 v95 = 1;
Ritor1
parents:
diff changeset
1324 *(unsigned char *)v55 = 0;
Ritor1
parents:
diff changeset
1325 if ( v54 )
Ritor1
parents:
diff changeset
1326 {
Ritor1
parents:
diff changeset
1327 if ( v51 )
Ritor1
parents:
diff changeset
1328 {
Ritor1
parents:
diff changeset
1329 switch ( Stri )
Ritor1
parents:
diff changeset
1330 {
Ritor1
parents:
diff changeset
1331 case 0:
Ritor1
parents:
diff changeset
1332 case 1:
Ritor1
parents:
diff changeset
1333 case 2:
Ritor1
parents:
diff changeset
1334 case 3:
Ritor1
parents:
diff changeset
1335 case 4:
Ritor1
parents:
diff changeset
1336 case 5:
Ritor1
parents:
diff changeset
1337 case 6:
Ritor1
parents:
diff changeset
1338 pAttributeDescriptions[Stri] = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1339 break;
Ritor1
parents:
diff changeset
1340 case 7:
Ritor1
parents:
diff changeset
1341 pHealthPointsAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1342 break;
Ritor1
parents:
diff changeset
1343 case 8:
Ritor1
parents:
diff changeset
1344 pArmourClassAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1345 break;
Ritor1
parents:
diff changeset
1346 case 9:
Ritor1
parents:
diff changeset
1347 pSpellPointsAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1348 break;
Ritor1
parents:
diff changeset
1349 case 10:
Ritor1
parents:
diff changeset
1350 pPlayerConditionAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1351 break;
Ritor1
parents:
diff changeset
1352 case 11:
Ritor1
parents:
diff changeset
1353 pFastSpellAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1354 break;
Ritor1
parents:
diff changeset
1355 case 12:
Ritor1
parents:
diff changeset
1356 pPlayerAgeAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1357 break;
Ritor1
parents:
diff changeset
1358 case 13:
Ritor1
parents:
diff changeset
1359 pPlayerLevelAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1360 break;
Ritor1
parents:
diff changeset
1361 case 14:
Ritor1
parents:
diff changeset
1362 pPlayerExperienceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1363 break;
Ritor1
parents:
diff changeset
1364 case 15:
Ritor1
parents:
diff changeset
1365 pAttackBonusAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1366 break;
Ritor1
parents:
diff changeset
1367 case 16:
Ritor1
parents:
diff changeset
1368 pAttackDamageAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1369 break;
Ritor1
parents:
diff changeset
1370 case 17:
Ritor1
parents:
diff changeset
1371 pMissleBonusAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1372 break;
Ritor1
parents:
diff changeset
1373 case 18:
Ritor1
parents:
diff changeset
1374 pMissleDamageAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1375 break;
Ritor1
parents:
diff changeset
1376 case 19:
Ritor1
parents:
diff changeset
1377 pFireResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1378 break;
Ritor1
parents:
diff changeset
1379 case 20:
Ritor1
parents:
diff changeset
1380 pAirResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1381 break;
Ritor1
parents:
diff changeset
1382 case 21:
Ritor1
parents:
diff changeset
1383 pWaterResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1384 break;
Ritor1
parents:
diff changeset
1385 case 22:
Ritor1
parents:
diff changeset
1386 pEarthResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1387 break;
Ritor1
parents:
diff changeset
1388 case 23:
Ritor1
parents:
diff changeset
1389 pMindResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1390 break;
Ritor1
parents:
diff changeset
1391 case 24:
Ritor1
parents:
diff changeset
1392 pBodyResistanceAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1393 break;
Ritor1
parents:
diff changeset
1394 case 25:
Ritor1
parents:
diff changeset
1395 pSkillPointsAttributeDescription = (char *)RemoveQuotes(v52);
Ritor1
parents:
diff changeset
1396 break;
Ritor1
parents:
diff changeset
1397 default:
Ritor1
parents:
diff changeset
1398 break;
Ritor1
parents:
diff changeset
1399 }
Ritor1
parents:
diff changeset
1400 }
Ritor1
parents:
diff changeset
1401 }
Ritor1
parents:
diff changeset
1402 else
Ritor1
parents:
diff changeset
1403 {
Ritor1
parents:
diff changeset
1404 if ( !v51 )
Ritor1
parents:
diff changeset
1405 v95 = 1;
Ritor1
parents:
diff changeset
1406 }
Ritor1
parents:
diff changeset
1407 ++v51;
Ritor1
parents:
diff changeset
1408 v52 = (char *)(v55 + 1);
Ritor1
parents:
diff changeset
1409 }
Ritor1
parents:
diff changeset
1410 while ( v51 < 2 && !v95 );
Ritor1
parents:
diff changeset
1411 ++Stri;
Ritor1
parents:
diff changeset
1412 }
Ritor1
parents:
diff changeset
1413 while ( Stri < 26 );
Ritor1
parents:
diff changeset
1414 pClassTXT_Raw = 0;
Ritor1
parents:
diff changeset
1415 pClassTXT_Raw = (char *)pEvents_LOD->LoadRaw("class.txt", 0);
Ritor1
parents:
diff changeset
1416 strtok(pClassTXT_Raw, v34);
Ritor1
parents:
diff changeset
1417 Strj = pClassDescriptions;
Ritor1
parents:
diff changeset
1418 do
Ritor1
parents:
diff changeset
1419 {
Ritor1
parents:
diff changeset
1420 v56 = 0;
Ritor1
parents:
diff changeset
1421 v57 = strtok(0, v34) + 1;
Ritor1
parents:
diff changeset
1422 v96 = 0;
Ritor1
parents:
diff changeset
1423 do
Ritor1
parents:
diff changeset
1424 {
Ritor1
parents:
diff changeset
1425 v58 = *v57;
Ritor1
parents:
diff changeset
1426 v59 = 0;
Ritor1
parents:
diff changeset
1427 if ( *v57 != 9 )
Ritor1
parents:
diff changeset
1428 {
Ritor1
parents:
diff changeset
1429 do
Ritor1
parents:
diff changeset
1430 {
Ritor1
parents:
diff changeset
1431 if ( !v58 )
Ritor1
parents:
diff changeset
1432 break;
Ritor1
parents:
diff changeset
1433 ++v59;
Ritor1
parents:
diff changeset
1434 v58 = v57[v59];
Ritor1
parents:
diff changeset
1435 }
Ritor1
parents:
diff changeset
1436 while ( v58 != 9 );
Ritor1
parents:
diff changeset
1437 v34 = "\r";
Ritor1
parents:
diff changeset
1438 }
Ritor1
parents:
diff changeset
1439 v60 = (int)&v57[v59];
Ritor1
parents:
diff changeset
1440 if ( !v57[v59] )
Ritor1
parents:
diff changeset
1441 v96 = 1;
Ritor1
parents:
diff changeset
1442 *(unsigned char *)v60 = 0;
Ritor1
parents:
diff changeset
1443 if ( v59 )
Ritor1
parents:
diff changeset
1444 {
Ritor1
parents:
diff changeset
1445 if ( v56 )
Ritor1
parents:
diff changeset
1446 *Strj = (char *)RemoveQuotes(v57);
Ritor1
parents:
diff changeset
1447 }
Ritor1
parents:
diff changeset
1448 else
Ritor1
parents:
diff changeset
1449 {
Ritor1
parents:
diff changeset
1450 if ( !v56 )
Ritor1
parents:
diff changeset
1451 v96 = 1;
Ritor1
parents:
diff changeset
1452 }
Ritor1
parents:
diff changeset
1453 ++v56;
Ritor1
parents:
diff changeset
1454 v57 = (char *)(v60 + 1);
Ritor1
parents:
diff changeset
1455 }
Ritor1
parents:
diff changeset
1456 while ( v56 < 2 && !v96 );
Ritor1
parents:
diff changeset
1457 ++Strj;
Ritor1
parents:
diff changeset
1458 }
Ritor1
parents:
diff changeset
1459 while ( (signed int)Strj <= (signed int)&pClassDescriptions[35] );
Ritor1
parents:
diff changeset
1460 }
Ritor1
parents:
diff changeset
1461
Ritor1
parents:
diff changeset
1462 //----- (00456D17) --------------------------------------------------------
Ritor1
parents:
diff changeset
1463 void ItemsTable::SetSpecialBonus(ItemGen *pItem)
Ritor1
parents:
diff changeset
1464 {
Ritor1
parents:
diff changeset
1465 ItemDesc *v2; // eax@1
Ritor1
parents:
diff changeset
1466
Ritor1
parents:
diff changeset
1467 v2 = &this->pItems[pItem->uItemID];
Ritor1
parents:
diff changeset
1468 if ( v2->uMaterial == 3 )
Ritor1
parents:
diff changeset
1469 {
Ritor1
parents:
diff changeset
1470 pItem->_bonus_type = v2->_bonus_type;
Ritor1
parents:
diff changeset
1471 pItem->uAdditionalValue = v2->_additional_value;
Ritor1
parents:
diff changeset
1472 pItem->_bonus_strength = v2->_bonus_strength;
Ritor1
parents:
diff changeset
1473 }
Ritor1
parents:
diff changeset
1474 }
Ritor1
parents:
diff changeset
1475
Ritor1
parents:
diff changeset
1476 //----- (00456D43) --------------------------------------------------------
Ritor1
parents:
diff changeset
1477 bool ItemsTable::_456D43_is_material_equals_3(ItemGen *pItem)
Ritor1
parents:
diff changeset
1478 {
Ritor1
parents:
diff changeset
1479 return this->pItems[pItem->uItemID].uMaterial == 3;
Ritor1
parents:
diff changeset
1480 }
Ritor1
parents:
diff changeset
1481
Ritor1
parents:
diff changeset
1482 //----- (00456D5E) --------------------------------------------------------
Ritor1
parents:
diff changeset
1483 bool ItemsTable::_456D5E_is_some_material(ItemGen *pItem)
Ritor1
parents:
diff changeset
1484 {
Ritor1
parents:
diff changeset
1485 unsigned __int8 v2; // al@1
Ritor1
parents:
diff changeset
1486
Ritor1
parents:
diff changeset
1487 v2 = this->pItems[pItem->uItemID].uMaterial;
Ritor1
parents:
diff changeset
1488 return v2 == 3 || v2 == 1 || v2 == 2;
Ritor1
parents:
diff changeset
1489 }
Ritor1
parents:
diff changeset
1490
Ritor1
parents:
diff changeset
1491
Ritor1
parents:
diff changeset
1492 //----- (00453B3C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1493 void ItemsTable::LoadPotions()
Ritor1
parents:
diff changeset
1494 {
Ritor1
parents:
diff changeset
1495 char *i; // eax@3
Ritor1
parents:
diff changeset
1496 signed int v2; // esi@11
Ritor1
parents:
diff changeset
1497 char *v3; // eax@16
Ritor1
parents:
diff changeset
1498 char *v4; // edi@16
Ritor1
parents:
diff changeset
1499 __int16 v5; // ax@17
Ritor1
parents:
diff changeset
1500 char *v6; // esi@17
Ritor1
parents:
diff changeset
1501 CHAR Text; // [sp+Ch] [bp-6Ch]@26
Ritor1
parents:
diff changeset
1502 ItemsTable *v8; // [sp+68h] [bp-10h]@1
Ritor1
parents:
diff changeset
1503 int v9; // [sp+6Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
1504 int v10; // [sp+70h] [bp-8h]@10
Ritor1
parents:
diff changeset
1505 char *v11; // [sp+74h] [bp-4h]@4
Ritor1
parents:
diff changeset
1506
Ritor1
parents:
diff changeset
1507 v8 = this;
Ritor1
parents:
diff changeset
1508 if ( pPotionsTXT_Raw )
Ritor1
parents:
diff changeset
1509 pAllocator->FreeChunk(pPotionsTXT_Raw);
Ritor1
parents:
diff changeset
1510 pPotionsTXT_Raw = 0;
Ritor1
parents:
diff changeset
1511 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0);
Ritor1
parents:
diff changeset
1512 for ( i = strtok(pPotionsTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") )
Ritor1
parents:
diff changeset
1513 {
Ritor1
parents:
diff changeset
1514 v11 = i;
Ritor1
parents:
diff changeset
1515 if ( !strcmp(i, "222") )
Ritor1
parents:
diff changeset
1516 break;
Ritor1
parents:
diff changeset
1517 if ( !v11 )
Ritor1
parents:
diff changeset
1518 {
Ritor1
parents:
diff changeset
1519 LABEL_20:
Ritor1
parents:
diff changeset
1520 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", 0x10u);
Ritor1
parents:
diff changeset
1521 return;
Ritor1
parents:
diff changeset
1522 }
Ritor1
parents:
diff changeset
1523 }
Ritor1
parents:
diff changeset
1524 while ( 1 )
Ritor1
parents:
diff changeset
1525 {
Ritor1
parents:
diff changeset
1526 v11 = strtok(0, "\t\r\n");
Ritor1
parents:
diff changeset
1527 if ( !strcmp(v11, "222") )
Ritor1
parents:
diff changeset
1528 break;
Ritor1
parents:
diff changeset
1529 if ( !v11 )
Ritor1
parents:
diff changeset
1530 goto LABEL_20;
Ritor1
parents:
diff changeset
1531 }
Ritor1
parents:
diff changeset
1532 v9 = 0;
Ritor1
parents:
diff changeset
1533 v10 = 30642;
Ritor1
parents:
diff changeset
1534 do
Ritor1
parents:
diff changeset
1535 {
Ritor1
parents:
diff changeset
1536 v11 = 0;
Ritor1
parents:
diff changeset
1537 v2 = 0;
Ritor1
parents:
diff changeset
1538 do
Ritor1
parents:
diff changeset
1539 {
Ritor1
parents:
diff changeset
1540 if ( !strtok(0, "\r\t\n") )
Ritor1
parents:
diff changeset
1541 break;
Ritor1
parents:
diff changeset
1542 ++v2;
Ritor1
parents:
diff changeset
1543 }
Ritor1
parents:
diff changeset
1544 while ( v2 < 6 );
Ritor1
parents:
diff changeset
1545 if ( v2 != 6 )
Ritor1
parents:
diff changeset
1546 break;
Ritor1
parents:
diff changeset
1547 v11 = 0;
Ritor1
parents:
diff changeset
1548 do
Ritor1
parents:
diff changeset
1549 {
Ritor1
parents:
diff changeset
1550 v3 = strtok(0, "\r\t\n");
Ritor1
parents:
diff changeset
1551 v4 = v3;
Ritor1
parents:
diff changeset
1552 if ( !v3 )
Ritor1
parents:
diff changeset
1553 break;
Ritor1
parents:
diff changeset
1554 v5 = atoi(v3);
Ritor1
parents:
diff changeset
1555 v6 = (char *)v8 + 2 * (uint)&v11[v10];
Ritor1
parents:
diff changeset
1556 *(_WORD *)v6 = v5;
Ritor1
parents:
diff changeset
1557 if ( !v5 )
Ritor1
parents:
diff changeset
1558 {
Ritor1
parents:
diff changeset
1559 if ( tolower((unsigned __int8)*v4) == 101 )
Ritor1
parents:
diff changeset
1560 *(_WORD *)v6 = atoi(v4 + 1);
Ritor1
parents:
diff changeset
1561 else
Ritor1
parents:
diff changeset
1562 *(_WORD *)v6 = 0;
Ritor1
parents:
diff changeset
1563 }
Ritor1
parents:
diff changeset
1564 ++v11;
Ritor1
parents:
diff changeset
1565 }
Ritor1
parents:
diff changeset
1566 while ( (signed int)v11 < 50 );
Ritor1
parents:
diff changeset
1567 if ( v11 != (char *)50 )
Ritor1
parents:
diff changeset
1568 break;
Ritor1
parents:
diff changeset
1569 strtok(0, "\r\t\n");
Ritor1
parents:
diff changeset
1570 v10 += 50;
Ritor1
parents:
diff changeset
1571 ++v9;
Ritor1
parents:
diff changeset
1572 }
Ritor1
parents:
diff changeset
1573 while ( v10 < 33142 );
Ritor1
parents:
diff changeset
1574 if ( v9 != 50 )
Ritor1
parents:
diff changeset
1575 {
Ritor1
parents:
diff changeset
1576 wsprintfA(&Text, "Error Parsing Potion Table at Row: %d Column: %d", v9, v11);
Ritor1
parents:
diff changeset
1577 MessageBoxA(0, &Text, "Parsing Error", 0x10u);
Ritor1
parents:
diff changeset
1578 }
Ritor1
parents:
diff changeset
1579 if ( pPotionsTXT_Raw )
Ritor1
parents:
diff changeset
1580 {
Ritor1
parents:
diff changeset
1581 pAllocator->FreeChunk(pPotionsTXT_Raw);
Ritor1
parents:
diff changeset
1582 pPotionsTXT_Raw = 0;
Ritor1
parents:
diff changeset
1583 }
Ritor1
parents:
diff changeset
1584 }
Ritor1
parents:
diff changeset
1585
Ritor1
parents:
diff changeset
1586 //----- (00453CE5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1587 void ItemsTable::LoadPotionNotes()
Ritor1
parents:
diff changeset
1588 {
Ritor1
parents:
diff changeset
1589 char *i; // eax@3
Ritor1
parents:
diff changeset
1590 signed int v2; // esi@11
Ritor1
parents:
diff changeset
1591 char *v3; // eax@16
Ritor1
parents:
diff changeset
1592 char *v4; // edi@16
Ritor1
parents:
diff changeset
1593 __int16 v5; // ax@17
Ritor1
parents:
diff changeset
1594 char *v6; // esi@17
Ritor1
parents:
diff changeset
1595 CHAR *v7; // [sp-Ch] [bp-84h]@20
Ritor1
parents:
diff changeset
1596 const CHAR *v8; // [sp-8h] [bp-80h]@20
Ritor1
parents:
diff changeset
1597 UINT v9; // [sp-4h] [bp-7Ch]@20
Ritor1
parents:
diff changeset
1598 CHAR Text; // [sp+Ch] [bp-6Ch]@26
Ritor1
parents:
diff changeset
1599 ItemsTable *v11; // [sp+68h] [bp-10h]@1
Ritor1
parents:
diff changeset
1600 int v12; // [sp+6Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
1601 int v13; // [sp+70h] [bp-8h]@10
Ritor1
parents:
diff changeset
1602 char *v14; // [sp+74h] [bp-4h]@4
Ritor1
parents:
diff changeset
1603
Ritor1
parents:
diff changeset
1604 v11 = this;
Ritor1
parents:
diff changeset
1605 if ( pPotionNotesTXT_Raw )
Ritor1
parents:
diff changeset
1606 pAllocator->FreeChunk(pPotionNotesTXT_Raw);
Ritor1
parents:
diff changeset
1607 pPotionNotesTXT_Raw = 0;
Ritor1
parents:
diff changeset
1608 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0);
Ritor1
parents:
diff changeset
1609 for ( i = strtok(pPotionNotesTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") )
Ritor1
parents:
diff changeset
1610 {
Ritor1
parents:
diff changeset
1611 v14 = i;
Ritor1
parents:
diff changeset
1612 if ( !strcmp(i, "222") )
Ritor1
parents:
diff changeset
1613 break;
Ritor1
parents:
diff changeset
1614 if ( !v14 )
Ritor1
parents:
diff changeset
1615 {
Ritor1
parents:
diff changeset
1616 LABEL_20:
Ritor1
parents:
diff changeset
1617 v9 = 16;
Ritor1
parents:
diff changeset
1618 v8 = "Load Error";
Ritor1
parents:
diff changeset
1619 v7 = "Error Pre-Parsing Potion Table";
Ritor1
parents:
diff changeset
1620 LABEL_27:
Ritor1
parents:
diff changeset
1621 MessageBoxA(0, v7, v8, v9);
Ritor1
parents:
diff changeset
1622 return;
Ritor1
parents:
diff changeset
1623 }
Ritor1
parents:
diff changeset
1624 }
Ritor1
parents:
diff changeset
1625 while ( 1 )
Ritor1
parents:
diff changeset
1626 {
Ritor1
parents:
diff changeset
1627 v14 = strtok(0, "\t\r\n");
Ritor1
parents:
diff changeset
1628 if ( !strcmp(v14, "222") )
Ritor1
parents:
diff changeset
1629 break;
Ritor1
parents:
diff changeset
1630 if ( !v14 )
Ritor1
parents:
diff changeset
1631 goto LABEL_20;
Ritor1
parents:
diff changeset
1632 }
Ritor1
parents:
diff changeset
1633 v12 = 0;
Ritor1
parents:
diff changeset
1634 v13 = 33142;
Ritor1
parents:
diff changeset
1635 do
Ritor1
parents:
diff changeset
1636 {
Ritor1
parents:
diff changeset
1637 v14 = 0;
Ritor1
parents:
diff changeset
1638 v2 = 0;
Ritor1
parents:
diff changeset
1639 do
Ritor1
parents:
diff changeset
1640 {
Ritor1
parents:
diff changeset
1641 if ( !strtok(0, "\r\t\n") )
Ritor1
parents:
diff changeset
1642 break;
Ritor1
parents:
diff changeset
1643 ++v2;
Ritor1
parents:
diff changeset
1644 }
Ritor1
parents:
diff changeset
1645 while ( v2 < 6 );
Ritor1
parents:
diff changeset
1646 if ( v2 != 6 )
Ritor1
parents:
diff changeset
1647 break;
Ritor1
parents:
diff changeset
1648 v14 = 0;
Ritor1
parents:
diff changeset
1649 do
Ritor1
parents:
diff changeset
1650 {
Ritor1
parents:
diff changeset
1651 v3 = strtok(0, "\r\t\n");
Ritor1
parents:
diff changeset
1652 v4 = v3;
Ritor1
parents:
diff changeset
1653 if ( !v3 )
Ritor1
parents:
diff changeset
1654 break;
Ritor1
parents:
diff changeset
1655 v5 = atoi(v3);
Ritor1
parents:
diff changeset
1656 v6 = (char *)v11 + 2 * (unsigned int)&v14[v13];
Ritor1
parents:
diff changeset
1657 *(unsigned short *)v6 = v5;
Ritor1
parents:
diff changeset
1658 if ( !v5 )
Ritor1
parents:
diff changeset
1659 {
Ritor1
parents:
diff changeset
1660 if ( tolower((unsigned __int8)*v4) == 101 )
Ritor1
parents:
diff changeset
1661 *(unsigned short *)v6 = atoi(v4 + 1);
Ritor1
parents:
diff changeset
1662 else
Ritor1
parents:
diff changeset
1663 *(unsigned short *)v6 = 0;
Ritor1
parents:
diff changeset
1664 }
Ritor1
parents:
diff changeset
1665 ++v14;
Ritor1
parents:
diff changeset
1666 }
Ritor1
parents:
diff changeset
1667 while ( (signed int)v14 < 50 );
Ritor1
parents:
diff changeset
1668 if ( v14 != (char *)50 )
Ritor1
parents:
diff changeset
1669 break;
Ritor1
parents:
diff changeset
1670 strtok(0, "\r\t\n");
Ritor1
parents:
diff changeset
1671 v13 += 50;
Ritor1
parents:
diff changeset
1672 ++v12;
Ritor1
parents:
diff changeset
1673 }
Ritor1
parents:
diff changeset
1674 while ( v13 < 35642 );
Ritor1
parents:
diff changeset
1675 if ( v12 != 50 )
Ritor1
parents:
diff changeset
1676 {
Ritor1
parents:
diff changeset
1677 wsprintfA(&Text, "Error Parsing Potion Autonote Table at Row: %d Column: %d", v12, v14);
Ritor1
parents:
diff changeset
1678 v9 = 16;
Ritor1
parents:
diff changeset
1679 v8 = "Parsing Error";
Ritor1
parents:
diff changeset
1680 v7 = &Text;
Ritor1
parents:
diff changeset
1681 goto LABEL_27;
Ritor1
parents:
diff changeset
1682 }
Ritor1
parents:
diff changeset
1683 }
Ritor1
parents:
diff changeset
1684
Ritor1
parents:
diff changeset
1685
Ritor1
parents:
diff changeset
1686 //----- (00456442) --------------------------------------------------------
Ritor1
parents:
diff changeset
1687 unsigned int ItemGen::GetValue()
Ritor1
parents:
diff changeset
1688 {
Ritor1
parents:
diff changeset
1689 ItemGen *v1; // esi@1
Ritor1
parents:
diff changeset
1690 unsigned int uBaseValue; // edi@1
Ritor1
parents:
diff changeset
1691 int v3; // eax@4
Ritor1
parents:
diff changeset
1692 int v4; // esi@5
Ritor1
parents:
diff changeset
1693 unsigned int result; // eax@7
Ritor1
parents:
diff changeset
1694
Ritor1
parents:
diff changeset
1695 v1 = this;
Ritor1
parents:
diff changeset
1696 uBaseValue = pItemsTable->pItems[this->uItemID].uValue;
Ritor1
parents:
diff changeset
1697 if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->_456D5E_is_some_material(this) )
Ritor1
parents:
diff changeset
1698 goto LABEL_12;
Ritor1
parents:
diff changeset
1699 if ( v1->_bonus_type )
Ritor1
parents:
diff changeset
1700 {
Ritor1
parents:
diff changeset
1701 v3 = 100 * v1->_bonus_strength;
Ritor1
parents:
diff changeset
1702 return uBaseValue + v3;
Ritor1
parents:
diff changeset
1703 }
Ritor1
parents:
diff changeset
1704 v4 = v1->uAdditionalValue;
Ritor1
parents:
diff changeset
1705 if ( !v4 )
Ritor1
parents:
diff changeset
1706 {
Ritor1
parents:
diff changeset
1707 LABEL_12:
Ritor1
parents:
diff changeset
1708 result = uBaseValue;
Ritor1
parents:
diff changeset
1709 }
Ritor1
parents:
diff changeset
1710 else
Ritor1
parents:
diff changeset
1711 {
Ritor1
parents:
diff changeset
1712 v3 = *(unsigned int *)&pItemsTable->pEnchantments[23].field_8[28 * v4 + 8];
Ritor1
parents:
diff changeset
1713 if ( (unsigned int)v3 > 0xA )
Ritor1
parents:
diff changeset
1714 return uBaseValue + v3;
Ritor1
parents:
diff changeset
1715 result = uBaseValue * v3;
Ritor1
parents:
diff changeset
1716 }
Ritor1
parents:
diff changeset
1717 return result;
Ritor1
parents:
diff changeset
1718 }
Ritor1
parents:
diff changeset
1719
Ritor1
parents:
diff changeset
1720 //----- (00456499) --------------------------------------------------------
Ritor1
parents:
diff changeset
1721 const char *ItemGen::GetDisplayName()
Ritor1
parents:
diff changeset
1722 {
Ritor1
parents:
diff changeset
1723 const char *result; // eax@2
Ritor1
parents:
diff changeset
1724
Ritor1
parents:
diff changeset
1725 if ( this->uAttributes & ITEM_IDENTIFIED )
Ritor1
parents:
diff changeset
1726 result = GetIdentifiedName();
Ritor1
parents:
diff changeset
1727 else
Ritor1
parents:
diff changeset
1728 result = pItemsTable->pItems[uItemID].pUnidentifiedName;
Ritor1
parents:
diff changeset
1729 return result;
Ritor1
parents:
diff changeset
1730 }
Ritor1
parents:
diff changeset
1731
Ritor1
parents:
diff changeset
1732 //----- (004564B3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1733 const char *ItemGen::GetIdentifiedName()
Ritor1
parents:
diff changeset
1734 {
Ritor1
parents:
diff changeset
1735 ItemGen *v1; // esi@1
Ritor1
parents:
diff changeset
1736 unsigned int v2; // eax@1
Ritor1
parents:
diff changeset
1737 unsigned __int8 v3; // cl@1
Ritor1
parents:
diff changeset
1738 char *v4; // edi@4
Ritor1
parents:
diff changeset
1739 char v5; // al@6
Ritor1
parents:
diff changeset
1740 const char *v6; // esi@8
Ritor1
parents:
diff changeset
1741 int v7; // eax@15
Ritor1
parents:
diff changeset
1742 const char *v9; // [sp-Ch] [bp-14h]@14
Ritor1
parents:
diff changeset
1743 const char *v10; // [sp-8h] [bp-10h]@4
Ritor1
parents:
diff changeset
1744 char *v11; // [sp-4h] [bp-Ch]@4
Ritor1
parents:
diff changeset
1745
Ritor1
parents:
diff changeset
1746 v1 = this;
Ritor1
parents:
diff changeset
1747 v2 = this->uItemID;
Ritor1
parents:
diff changeset
1748 v3 = pItemsTable->pItems[v2].uEquipType;
Ritor1
parents:
diff changeset
1749 if ( v3 >= EQUIP_REAGENT && (v3 <= EQUIP_POTION || v3 == EQUIP_GOLD) )
Ritor1
parents:
diff changeset
1750 {
Ritor1
parents:
diff changeset
1751 v11 = pItemsTable->pItems[v2].pName;
Ritor1
parents:
diff changeset
1752 v4 = item__getname_buffer;
Ritor1
parents:
diff changeset
1753 v10 = "%s";
Ritor1
parents:
diff changeset
1754 LABEL_10:
Ritor1
parents:
diff changeset
1755 sprintf(v4, v10, v11);
Ritor1
parents:
diff changeset
1756 return v4;
Ritor1
parents:
diff changeset
1757 }
Ritor1
parents:
diff changeset
1758 v4 = item__getname_buffer;
Ritor1
parents:
diff changeset
1759 sprintf(item__getname_buffer, "%s", pItemsTable->pItems[v2].pName);
Ritor1
parents:
diff changeset
1760 if ( v1->uItemID == 601 )
Ritor1
parents:
diff changeset
1761 {
Ritor1
parents:
diff changeset
1762 v5 = v1->field_1A;
Ritor1
parents:
diff changeset
1763 if ( (unsigned __int8)v5 >= 1u )
Ritor1
parents:
diff changeset
1764 {
Ritor1
parents:
diff changeset
1765 if ( (unsigned __int8)v5 <= 4u )
Ritor1
parents:
diff changeset
1766 {
Ritor1
parents:
diff changeset
1767 v6 = pPlayers[(unsigned __int8)v5]->pName;
Ritor1
parents:
diff changeset
1768 strlen(pPlayers[(unsigned __int8)v5]->pName);
Ritor1
parents:
diff changeset
1769 v11 = (char *)v6;
Ritor1
parents:
diff changeset
1770 if ( v6[strlen(v6) - 1] == 115 )
Ritor1
parents:
diff changeset
1771 v10 = pGlobalTXT_LocalizationStrings[655];
Ritor1
parents:
diff changeset
1772 else
Ritor1
parents:
diff changeset
1773 v10 = pGlobalTXT_LocalizationStrings[654];
Ritor1
parents:
diff changeset
1774 goto LABEL_10;
Ritor1
parents:
diff changeset
1775 }
Ritor1
parents:
diff changeset
1776 }
Ritor1
parents:
diff changeset
1777 }
Ritor1
parents:
diff changeset
1778 if ( !pItemsTable->_456D5E_is_some_material(v1) )
Ritor1
parents:
diff changeset
1779 {
Ritor1
parents:
diff changeset
1780 if ( v1->_bonus_type )
Ritor1
parents:
diff changeset
1781 {
Ritor1
parents:
diff changeset
1782 strcat(item__getname_buffer, " ");
Ritor1
parents:
diff changeset
1783 v9 = (const char *)*((unsigned int *)&pItemsTable->pItems[799].uEquipType + 5 * v1->_bonus_type);
Ritor1
parents:
diff changeset
1784 }
Ritor1
parents:
diff changeset
1785 else
Ritor1
parents:
diff changeset
1786 {
Ritor1
parents:
diff changeset
1787 v7 = v1->uAdditionalValue;
Ritor1
parents:
diff changeset
1788 if ( !v7 )
Ritor1
parents:
diff changeset
1789 return v4;
Ritor1
parents:
diff changeset
1790 if ( v7 == 16
Ritor1
parents:
diff changeset
1791 || v7 == 39
Ritor1
parents:
diff changeset
1792 || v7 == 40
Ritor1
parents:
diff changeset
1793 || v7 == 45
Ritor1
parents:
diff changeset
1794 || v7 == 56
Ritor1
parents:
diff changeset
1795 || v7 == 57
Ritor1
parents:
diff changeset
1796 || v7 == 58
Ritor1
parents:
diff changeset
1797 || v7 == 60
Ritor1
parents:
diff changeset
1798 || v7 == 61
Ritor1
parents:
diff changeset
1799 || v7 == 59
Ritor1
parents:
diff changeset
1800 || v7 == 63
Ritor1
parents:
diff changeset
1801 || v7 == 64
Ritor1
parents:
diff changeset
1802 || v7 == 67
Ritor1
parents:
diff changeset
1803 || v7 == 68 )
Ritor1
parents:
diff changeset
1804 {
Ritor1
parents:
diff changeset
1805 sprintf(
Ritor1
parents:
diff changeset
1806 item__getname_buffer,
Ritor1
parents:
diff changeset
1807 "%s %s",
Ritor1
parents:
diff changeset
1808 *(unsigned int *)&pItemsTable->pEnchantments[22].field_8[28 * v7 + 8],
Ritor1
parents:
diff changeset
1809 pItemsTable->pItems[v1->uItemID].pName);
Ritor1
parents:
diff changeset
1810 return v4;
Ritor1
parents:
diff changeset
1811 }
Ritor1
parents:
diff changeset
1812 strcat(item__getname_buffer, " ");
Ritor1
parents:
diff changeset
1813 v9 = *(const char **)&pItemsTable->pEnchantments[22].field_8[28 * v1->uAdditionalValue + 8];
Ritor1
parents:
diff changeset
1814 }
Ritor1
parents:
diff changeset
1815 strcat(item__getname_buffer, v9);
Ritor1
parents:
diff changeset
1816 }
Ritor1
parents:
diff changeset
1817 return v4;
Ritor1
parents:
diff changeset
1818 }
Ritor1
parents:
diff changeset
1819
Ritor1
parents:
diff changeset
1820
Ritor1
parents:
diff changeset
1821 //----- (00456620) --------------------------------------------------------
Ritor1
parents:
diff changeset
1822 void ItemsTable::GenerateItem(int a2, int a3, ItemGen *pItem)
Ritor1
parents:
diff changeset
1823 {
Ritor1
parents:
diff changeset
1824 ItemGen *v4; // esi@1
Ritor1
parents:
diff changeset
1825 ItemsTable *v5; // edi@1
Ritor1
parents:
diff changeset
1826 int v6; // ebx@3
Ritor1
parents:
diff changeset
1827 int *v7; // ecx@33
Ritor1
parents:
diff changeset
1828 int v8; // eax@34
Ritor1
parents:
diff changeset
1829 int v9; // eax@39
Ritor1
parents:
diff changeset
1830 int v10; // ebx@43
Ritor1
parents:
diff changeset
1831 int v11; // ecx@47
Ritor1
parents:
diff changeset
1832 unsigned int *v12; // edx@48
Ritor1
parents:
diff changeset
1833 unsigned int v13; // eax@49
Ritor1
parents:
diff changeset
1834 signed int v14; // ebx@52
Ritor1
parents:
diff changeset
1835 int v15; // eax@53
Ritor1
parents:
diff changeset
1836 signed int v16; // eax@55
Ritor1
parents:
diff changeset
1837 int v17; // ebx@57
Ritor1
parents:
diff changeset
1838 int v18; // edx@62
Ritor1
parents:
diff changeset
1839 signed int v19; // ebx@70
Ritor1
parents:
diff changeset
1840 unsigned __int8 v20; // al@81
Ritor1
parents:
diff changeset
1841 int v21; // eax@84
Ritor1
parents:
diff changeset
1842 int v22; // ebx@85
Ritor1
parents:
diff changeset
1843 int v23; // eax@86
Ritor1
parents:
diff changeset
1844 int v24; // ebx@86
Ritor1
parents:
diff changeset
1845 int v25; // edx@86
Ritor1
parents:
diff changeset
1846 int v26; // edx@89
Ritor1
parents:
diff changeset
1847 unsigned int v27; // eax@89
Ritor1
parents:
diff changeset
1848 int i; // ebx@89
Ritor1
parents:
diff changeset
1849 unsigned int v29; // ecx@90
Ritor1
parents:
diff changeset
1850 int v30; // ebx@91
Ritor1
parents:
diff changeset
1851 int v31; // eax@91
Ritor1
parents:
diff changeset
1852 int v32; // ecx@91
Ritor1
parents:
diff changeset
1853 int v33; // eax@91
Ritor1
parents:
diff changeset
1854 int v34; // eax@97
Ritor1
parents:
diff changeset
1855 unsigned __int8 v35; // sf@97
Ritor1
parents:
diff changeset
1856 unsigned __int8 v36; // of@97
Ritor1
parents:
diff changeset
1857 int v37; // ebx@98
Ritor1
parents:
diff changeset
1858 int v38; // edx@99
Ritor1
parents:
diff changeset
1859 signed int v39; // ebx@101
Ritor1
parents:
diff changeset
1860 int v40; // ecx@102
Ritor1
parents:
diff changeset
1861 char v41; // zf@107
Ritor1
parents:
diff changeset
1862 char v42; // al@108
Ritor1
parents:
diff changeset
1863 char v43; // al@111
Ritor1
parents:
diff changeset
1864 int *v44; // edx@118
Ritor1
parents:
diff changeset
1865 int v45; // eax@120
Ritor1
parents:
diff changeset
1866 int v46; // edx@120
Ritor1
parents:
diff changeset
1867 int *j; // eax@121
Ritor1
parents:
diff changeset
1868 unsigned int v48; // ecx@123
Ritor1
parents:
diff changeset
1869 int v49; // eax@123
Ritor1
parents:
diff changeset
1870 int v50; // eax@123
Ritor1
parents:
diff changeset
1871 unsigned char Dst[0xC80]; // [sp+Ch] [bp-C88h]@33
Ritor1
parents:
diff changeset
1872 int v52; // [sp+C8Ch] [bp-8h]@33
Ritor1
parents:
diff changeset
1873 int v53; // [sp+C90h] [bp-4h]@1
Ritor1
parents:
diff changeset
1874 int v54; // [sp+C9Ch] [bp+8h]@3
Ritor1
parents:
diff changeset
1875 int v55; // [sp+CA0h] [bp+Ch]@34
Ritor1
parents:
diff changeset
1876 signed int v56; // [sp+CA0h] [bp+Ch]@55
Ritor1
parents:
diff changeset
1877 int v57; // [sp+CA0h] [bp+Ch]@62
Ritor1
parents:
diff changeset
1878 int *v58; // [sp+CA0h] [bp+Ch]@102
Ritor1
parents:
diff changeset
1879 int v59; // [sp+CA0h] [bp+Ch]@123
Ritor1
parents:
diff changeset
1880 signed int a2a; // [sp+CA4h] [bp+10h]@33
Ritor1
parents:
diff changeset
1881 int a2b; // [sp+CA4h] [bp+10h]@101
Ritor1
parents:
diff changeset
1882 int a2c; // [sp+CA4h] [bp+10h]@120
Ritor1
parents:
diff changeset
1883
Ritor1
parents:
diff changeset
1884 v53 = -1;
Ritor1
parents:
diff changeset
1885 v4 = pItem;
Ritor1
parents:
diff changeset
1886 v5 = this;
Ritor1
parents:
diff changeset
1887 if ( !pItem )
Ritor1
parents:
diff changeset
1888 v4 = (ItemGen *)pAllocator->AllocNamedChunk(pItem, 0x24u, "newItemGen");
Ritor1
parents:
diff changeset
1889 memset(v4, 0, 0x24u);
Ritor1
parents:
diff changeset
1890 v6 = a2 - 1;
Ritor1
parents:
diff changeset
1891 v54 = a2 - 1;
Ritor1
parents:
diff changeset
1892 if ( a3 )
Ritor1
parents:
diff changeset
1893 {
Ritor1
parents:
diff changeset
1894 switch ( a3 )
Ritor1
parents:
diff changeset
1895 {
Ritor1
parents:
diff changeset
1896 case 20:
Ritor1
parents:
diff changeset
1897 a3 = EQUIP_ONE_OR_TWO_HANDS;
Ritor1
parents:
diff changeset
1898 break;
Ritor1
parents:
diff changeset
1899 case 21:
Ritor1
parents:
diff changeset
1900 a3 = 3;
Ritor1
parents:
diff changeset
1901 break;
Ritor1
parents:
diff changeset
1902 case 22:
Ritor1
parents:
diff changeset
1903 v53 = 38;
Ritor1
parents:
diff changeset
1904 break;
Ritor1
parents:
diff changeset
1905 case 23:
Ritor1
parents:
diff changeset
1906 v53 = 1;
Ritor1
parents:
diff changeset
1907 break;
Ritor1
parents:
diff changeset
1908 case 24:
Ritor1
parents:
diff changeset
1909 v53 = 2;
Ritor1
parents:
diff changeset
1910 break;
Ritor1
parents:
diff changeset
1911 case 25:
Ritor1
parents:
diff changeset
1912 v53 = 3;
Ritor1
parents:
diff changeset
1913 break;
Ritor1
parents:
diff changeset
1914 case 26:
Ritor1
parents:
diff changeset
1915 v53 = 4;
Ritor1
parents:
diff changeset
1916 break;
Ritor1
parents:
diff changeset
1917 case 27:
Ritor1
parents:
diff changeset
1918 v53 = 5;
Ritor1
parents:
diff changeset
1919 break;
Ritor1
parents:
diff changeset
1920 case 28:
Ritor1
parents:
diff changeset
1921 v53 = 6;
Ritor1
parents:
diff changeset
1922 break;
Ritor1
parents:
diff changeset
1923 case 30:
Ritor1
parents:
diff changeset
1924 v53 = 0;
Ritor1
parents:
diff changeset
1925 break;
Ritor1
parents:
diff changeset
1926 case 31:
Ritor1
parents:
diff changeset
1927 v53 = 9;
Ritor1
parents:
diff changeset
1928 break;
Ritor1
parents:
diff changeset
1929 case 32:
Ritor1
parents:
diff changeset
1930 v53 = 10;
Ritor1
parents:
diff changeset
1931 break;
Ritor1
parents:
diff changeset
1932 case 33:
Ritor1
parents:
diff changeset
1933 v53 = 0xBu;
Ritor1
parents:
diff changeset
1934 break;
Ritor1
parents:
diff changeset
1935 case 34:
Ritor1
parents:
diff changeset
1936 a3 = 4;
Ritor1
parents:
diff changeset
1937 break;
Ritor1
parents:
diff changeset
1938 case 35:
Ritor1
parents:
diff changeset
1939 a3 = 5;
Ritor1
parents:
diff changeset
1940 break;
Ritor1
parents:
diff changeset
1941 case 36:
Ritor1
parents:
diff changeset
1942 a3 = 6;
Ritor1
parents:
diff changeset
1943 break;
Ritor1
parents:
diff changeset
1944 case 37:
Ritor1
parents:
diff changeset
1945 a3 = 7;
Ritor1
parents:
diff changeset
1946 break;
Ritor1
parents:
diff changeset
1947 case 38:
Ritor1
parents:
diff changeset
1948 a3 = 8;
Ritor1
parents:
diff changeset
1949 break;
Ritor1
parents:
diff changeset
1950 case 39:
Ritor1
parents:
diff changeset
1951 a3 = EQUIP_BOOTS;
Ritor1
parents:
diff changeset
1952 break;
Ritor1
parents:
diff changeset
1953 case 40:
Ritor1
parents:
diff changeset
1954 a3 = EQUIP_RING;
Ritor1
parents:
diff changeset
1955 break;
Ritor1
parents:
diff changeset
1956 case 41:
Ritor1
parents:
diff changeset
1957 a3 = 0xBu;
Ritor1
parents:
diff changeset
1958 break;
Ritor1
parents:
diff changeset
1959 case 42:
Ritor1
parents:
diff changeset
1960 a3 = EQUIP_C;
Ritor1
parents:
diff changeset
1961 break;
Ritor1
parents:
diff changeset
1962 case 43:
Ritor1
parents:
diff changeset
1963 a3 = EQUIP_F;
Ritor1
parents:
diff changeset
1964 break;
Ritor1
parents:
diff changeset
1965 case 44:
Ritor1
parents:
diff changeset
1966 a3 = EQUIP_POTION;
Ritor1
parents:
diff changeset
1967 break;
Ritor1
parents:
diff changeset
1968 case 45:
Ritor1
parents:
diff changeset
1969 a3 = EQUIP_REAGENT;
Ritor1
parents:
diff changeset
1970 break;
Ritor1
parents:
diff changeset
1971 case 46:
Ritor1
parents:
diff changeset
1972 a3 = EQUIP_GEM;
Ritor1
parents:
diff changeset
1973 break;
Ritor1
parents:
diff changeset
1974 case 29:
Ritor1
parents:
diff changeset
1975 v53 = 37;
Ritor1
parents:
diff changeset
1976 break;
Ritor1
parents:
diff changeset
1977 default:
Ritor1
parents:
diff changeset
1978 --a3;
Ritor1
parents:
diff changeset
1979 break;
Ritor1
parents:
diff changeset
1980 }
Ritor1
parents:
diff changeset
1981 memset(&Dst, 0, 0xC80u);
Ritor1
parents:
diff changeset
1982 v52 = 0;
Ritor1
parents:
diff changeset
1983 v7 = (int *)&Dst;
Ritor1
parents:
diff changeset
1984 a2a = 1;
Ritor1
parents:
diff changeset
1985 if ( v53 == -1 )
Ritor1
parents:
diff changeset
1986 {
Ritor1
parents:
diff changeset
1987 v53 = (int)&v5->pItems[1].uEquipType;
Ritor1
parents:
diff changeset
1988 v9 = (int)(&v5->pItems[1].field_2C + v6);
Ritor1
parents:
diff changeset
1989 do
Ritor1
parents:
diff changeset
1990 {
Ritor1
parents:
diff changeset
1991 if ( *(unsigned char *)v53 == a3 )
Ritor1
parents:
diff changeset
1992 {
Ritor1
parents:
diff changeset
1993 *v7 = a2a;
Ritor1
parents:
diff changeset
1994 ++v7;
Ritor1
parents:
diff changeset
1995 v52 += *(unsigned char *)v9;
Ritor1
parents:
diff changeset
1996 }
Ritor1
parents:
diff changeset
1997 ++a2a;
Ritor1
parents:
diff changeset
1998 v53 += 48;
Ritor1
parents:
diff changeset
1999 v9 += 48;
Ritor1
parents:
diff changeset
2000 }
Ritor1
parents:
diff changeset
2001 while ( a2a < 500 );
Ritor1
parents:
diff changeset
2002 }
Ritor1
parents:
diff changeset
2003 else
Ritor1
parents:
diff changeset
2004 {
Ritor1
parents:
diff changeset
2005 v55 = (int)&v5->pItems[1].uSkillType;
Ritor1
parents:
diff changeset
2006 v8 = (int)(&v5->pItems[1].field_2C + v6);
Ritor1
parents:
diff changeset
2007 do
Ritor1
parents:
diff changeset
2008 {
Ritor1
parents:
diff changeset
2009 if ( *(unsigned char *)v55 == v53 )
Ritor1
parents:
diff changeset
2010 {
Ritor1
parents:
diff changeset
2011 *v7 = a2a;
Ritor1
parents:
diff changeset
2012 ++v7;
Ritor1
parents:
diff changeset
2013 v52 += *(unsigned char *)v8;
Ritor1
parents:
diff changeset
2014 }
Ritor1
parents:
diff changeset
2015 ++a2a;
Ritor1
parents:
diff changeset
2016 v55 += 48;
Ritor1
parents:
diff changeset
2017 v8 += 48;
Ritor1
parents:
diff changeset
2018 }
Ritor1
parents:
diff changeset
2019 while ( a2a < 500 );
Ritor1
parents:
diff changeset
2020 }
Ritor1
parents:
diff changeset
2021 v10 = 0;
Ritor1
parents:
diff changeset
2022 if ( v52 )
Ritor1
parents:
diff changeset
2023 v10 = rand() % v52;
Ritor1
parents:
diff changeset
2024 v4->uItemID = *(uint *)Dst;
Ritor1
parents:
diff changeset
2025 if ( !Dst )
Ritor1
parents:
diff changeset
2026 v4->uItemID = 1;
Ritor1
parents:
diff changeset
2027 v11 = *(&v5->pItems[v4->uItemID].field_2C + v54);
Ritor1
parents:
diff changeset
2028 if ( v11 < v10 )
Ritor1
parents:
diff changeset
2029 {
Ritor1
parents:
diff changeset
2030 v12 = (uint *)Dst;
Ritor1
parents:
diff changeset
2031 do
Ritor1
parents:
diff changeset
2032 {
Ritor1
parents:
diff changeset
2033 ++v12;
Ritor1
parents:
diff changeset
2034 v13 = *v12;
Ritor1
parents:
diff changeset
2035 v4->uItemID = *v12;
Ritor1
parents:
diff changeset
2036 v11 += *(&v5->pItems[v13].field_2C + v54);
Ritor1
parents:
diff changeset
2037 }
Ritor1
parents:
diff changeset
2038 while ( v11 < v10 );
Ritor1
parents:
diff changeset
2039 }
Ritor1
parents:
diff changeset
2040 if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE )
Ritor1
parents:
diff changeset
2041 {
Ritor1
parents:
diff changeset
2042 v4->_bonus_type = 0;
Ritor1
parents:
diff changeset
2043 v14 = 2;
Ritor1
parents:
diff changeset
2044 do
Ritor1
parents:
diff changeset
2045 {
Ritor1
parents:
diff changeset
2046 v4->_bonus_type += rand() % 4 + 1;
Ritor1
parents:
diff changeset
2047 v15 = v4->_bonus_type;
Ritor1
parents:
diff changeset
2048 --v14;
Ritor1
parents:
diff changeset
2049 }
Ritor1
parents:
diff changeset
2050 while ( v14 );
Ritor1
parents:
diff changeset
2051 LABEL_72:
Ritor1
parents:
diff changeset
2052 v4->_bonus_type = v15 * (v54 + 1);
Ritor1
parents:
diff changeset
2053 goto LABEL_73;
Ritor1
parents:
diff changeset
2054 }
Ritor1
parents:
diff changeset
2055 }
Ritor1
parents:
diff changeset
2056 else
Ritor1
parents:
diff changeset
2057 {
Ritor1
parents:
diff changeset
2058 v16 = 0;
Ritor1
parents:
diff changeset
2059 v56 = 0;
Ritor1
parents:
diff changeset
2060 do
Ritor1
parents:
diff changeset
2061 v56 += pParty->field_7BA[v16++];
Ritor1
parents:
diff changeset
2062 while ( v16 < 29 );
Ritor1
parents:
diff changeset
2063 v17 = rand() % 29;
Ritor1
parents:
diff changeset
2064 if ( v54 == 5 && rand() % 100 < 5 && !pParty->field_7BA[v17] && v56 < 13 )
Ritor1
parents:
diff changeset
2065 {
Ritor1
parents:
diff changeset
2066 pParty->field_7BA[v17] = 1;
Ritor1
parents:
diff changeset
2067 v4->uAttributes = 0;
Ritor1
parents:
diff changeset
2068 v4->uItemID = v17 + 500;
Ritor1
parents:
diff changeset
2069 v5->SetSpecialBonus(v4);
Ritor1
parents:
diff changeset
2070 return;
Ritor1
parents:
diff changeset
2071 }
Ritor1
parents:
diff changeset
2072 v57 = 0;
Ritor1
parents:
diff changeset
2073 v18 = rand() % v5->field_11684[v54];
Ritor1
parents:
diff changeset
2074 v4->uItemID = 0;
Ritor1
parents:
diff changeset
2075 if ( v18 > 0 )
Ritor1
parents:
diff changeset
2076 {
Ritor1
parents:
diff changeset
2077 do
Ritor1
parents:
diff changeset
2078 v57 += *(&v5->pItems[v4->uItemID++ + 1].field_2C + v54);
Ritor1
parents:
diff changeset
2079 while ( v57 < v18 );
Ritor1
parents:
diff changeset
2080 }
Ritor1
parents:
diff changeset
2081 if ( !v18 )
Ritor1
parents:
diff changeset
2082 v4->uItemID = 1;
Ritor1
parents:
diff changeset
2083 if ( !v4->uItemID )
Ritor1
parents:
diff changeset
2084 v4->uItemID = 1;
Ritor1
parents:
diff changeset
2085 if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE )
Ritor1
parents:
diff changeset
2086 {
Ritor1
parents:
diff changeset
2087 v4->_bonus_type = 0;
Ritor1
parents:
diff changeset
2088 v19 = 2;
Ritor1
parents:
diff changeset
2089 do
Ritor1
parents:
diff changeset
2090 {
Ritor1
parents:
diff changeset
2091 v4->_bonus_type += rand() % 4 + 1;
Ritor1
parents:
diff changeset
2092 v15 = v4->_bonus_type;
Ritor1
parents:
diff changeset
2093 --v19;
Ritor1
parents:
diff changeset
2094 }
Ritor1
parents:
diff changeset
2095 while ( v19 );
Ritor1
parents:
diff changeset
2096 goto LABEL_72;
Ritor1
parents:
diff changeset
2097 }
Ritor1
parents:
diff changeset
2098 }
Ritor1
parents:
diff changeset
2099 LABEL_73:
Ritor1
parents:
diff changeset
2100 if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
Ritor1
parents:
diff changeset
2101 && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) )
Ritor1
parents:
diff changeset
2102 v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
Ritor1
parents:
diff changeset
2103 if ( BYTE2(pItemsTable->pItems[v4->uItemID + 1].uItemID) )
Ritor1
parents:
diff changeset
2104 v4->uAttributes = 0;
Ritor1
parents:
diff changeset
2105 else
Ritor1
parents:
diff changeset
2106 v4->uAttributes = 1;
Ritor1
parents:
diff changeset
2107 if ( v5->pItems[v4->uItemID].uEquipType != EQUIP_POTION )
Ritor1
parents:
diff changeset
2108 {
Ritor1
parents:
diff changeset
2109 v4->uAdditionalValue = 0;
Ritor1
parents:
diff changeset
2110 v4->_bonus_type = 0;
Ritor1
parents:
diff changeset
2111 }
Ritor1
parents:
diff changeset
2112 v20 = v5->pItems[v4->uItemID].uEquipType;
Ritor1
parents:
diff changeset
2113 if ( v20 <= EQUIP_BOW )
Ritor1
parents:
diff changeset
2114 {
Ritor1
parents:
diff changeset
2115 v37 = (int)&v5->field_1169C[4 * v54 + 48];
Ritor1
parents:
diff changeset
2116 if ( !*(unsigned int *)v37 )
Ritor1
parents:
diff changeset
2117 return;
Ritor1
parents:
diff changeset
2118 v38 = rand() % 100;
Ritor1
parents:
diff changeset
2119 v36 = __OFSUB__(v38, *(unsigned int *)v37);
Ritor1
parents:
diff changeset
2120 v35 = v38 - *(unsigned int *)v37 < 0;
Ritor1
parents:
diff changeset
2121 }
Ritor1
parents:
diff changeset
2122 else
Ritor1
parents:
diff changeset
2123 {
Ritor1
parents:
diff changeset
2124 if ( v20 > EQUIP_AMULET )
Ritor1
parents:
diff changeset
2125 {
Ritor1
parents:
diff changeset
2126 if ( v20 == EQUIP_C )
Ritor1
parents:
diff changeset
2127 {
Ritor1
parents:
diff changeset
2128 v21 = rand() % 6 + pItemsTable->pItems[v4->uItemID].uDamageMod + 1;
Ritor1
parents:
diff changeset
2129 v4->uNumCharges = v21;
Ritor1
parents:
diff changeset
2130 v4->uMaxCharges = v21;
Ritor1
parents:
diff changeset
2131 }
Ritor1
parents:
diff changeset
2132 return;
Ritor1
parents:
diff changeset
2133 }
Ritor1
parents:
diff changeset
2134 v22 = (int)&v5->field_1169C[4 * v54];
Ritor1
parents:
diff changeset
2135 if ( !*(unsigned int *)v22 )
Ritor1
parents:
diff changeset
2136 return;
Ritor1
parents:
diff changeset
2137 v23 = rand();
Ritor1
parents:
diff changeset
2138 v24 = *(unsigned int *)v22;
Ritor1
parents:
diff changeset
2139 v25 = v23 % 100;
Ritor1
parents:
diff changeset
2140 if ( v23 % 100 < v24 )
Ritor1
parents:
diff changeset
2141 goto LABEL_127;
Ritor1
parents:
diff changeset
2142 if ( !*(unsigned int *)&v5->field_1169C[4 * v54 + 24] )
Ritor1
parents:
diff changeset
2143 return;
Ritor1
parents:
diff changeset
2144 if ( v25 < v24 )
Ritor1
parents:
diff changeset
2145 {
Ritor1
parents:
diff changeset
2146 LABEL_127:
Ritor1
parents:
diff changeset
2147 v26 = rand() % v5->field_116D8[v5->pItems[v4->uItemID].uEquipType];
Ritor1
parents:
diff changeset
2148 v27 = v4->uItemID;
Ritor1
parents:
diff changeset
2149 v4->_bonus_type = 0;
Ritor1
parents:
diff changeset
2150 for ( i = v5->pEnchantments[0].field_8[v5->pItems[v27].uEquipType + 1];
Ritor1
parents:
diff changeset
2151 i < v26;
Ritor1
parents:
diff changeset
2152 i += v5->pEnchantments[v4->_bonus_type].field_8[v5->pItems[v29].uEquipType + 1] )
Ritor1
parents:
diff changeset
2153 {
Ritor1
parents:
diff changeset
2154 v29 = v4->uItemID;
Ritor1
parents:
diff changeset
2155 ++v4->_bonus_type;
Ritor1
parents:
diff changeset
2156 }
Ritor1
parents:
diff changeset
2157 ++v4->_bonus_type;
Ritor1
parents:
diff changeset
2158 v30 = v5->field_116D8[2 * v54 + 12];
Ritor1
parents:
diff changeset
2159 v31 = rand();
Ritor1
parents:
diff changeset
2160 v32 = v4->_bonus_type - 1;
Ritor1
parents:
diff changeset
2161 v33 = v31 % (v5->field_116D8[2 * v54 + 13] - v30 + 1) + v30;
Ritor1
parents:
diff changeset
2162 v4->_bonus_strength = v33;
Ritor1
parents:
diff changeset
2163 if ( v32 == 21 || v32 == 22 || v32 == 23 )
Ritor1
parents:
diff changeset
2164 v4->_bonus_strength = v33 >> 1;
Ritor1
parents:
diff changeset
2165 if ( v4->_bonus_strength <= 0 )
Ritor1
parents:
diff changeset
2166 v4->_bonus_strength = 1;
Ritor1
parents:
diff changeset
2167 return;
Ritor1
parents:
diff changeset
2168 }
Ritor1
parents:
diff changeset
2169 v34 = v24 + *(unsigned int *)&v5->field_1169C[4 * v54 + 24];
Ritor1
parents:
diff changeset
2170 v36 = __OFSUB__(v25, v34);
Ritor1
parents:
diff changeset
2171 v35 = v25 - v34 < 0;
Ritor1
parents:
diff changeset
2172 }
Ritor1
parents:
diff changeset
2173 if ( !(v35 ^ v36) )
Ritor1
parents:
diff changeset
2174 return;
Ritor1
parents:
diff changeset
2175 memset(&Dst, 0, 0xC80u);
Ritor1
parents:
diff changeset
2176 v39 = 0;
Ritor1
parents:
diff changeset
2177 a2b = 0;
Ritor1
parents:
diff changeset
2178 if ( v5->field_11798 > 0 )
Ritor1
parents:
diff changeset
2179 {
Ritor1
parents:
diff changeset
2180 v52 = -16 - (uint)v5;
Ritor1
parents:
diff changeset
2181 v58 = (int *)&Dst;
Ritor1
parents:
diff changeset
2182 v40 = (int)&v5->pSpecialEnchantments[1];
Ritor1
parents:
diff changeset
2183 do
Ritor1
parents:
diff changeset
2184 {
Ritor1
parents:
diff changeset
2185 switch ( v54 )
Ritor1
parents:
diff changeset
2186 {
Ritor1
parents:
diff changeset
2187 case 2:
Ritor1
parents:
diff changeset
2188 if ( !*(unsigned char *)v40 )
Ritor1
parents:
diff changeset
2189 goto LABEL_117;
Ritor1
parents:
diff changeset
2190 v41 = *(unsigned char *)v40 == 1;
Ritor1
parents:
diff changeset
2191 break;
Ritor1
parents:
diff changeset
2192 case 3:
Ritor1
parents:
diff changeset
2193 v43 = *(unsigned char *)v40;
Ritor1
parents:
diff changeset
2194 if ( !*(unsigned char *)v40 || v43 == 1 )
Ritor1
parents:
diff changeset
2195 {
Ritor1
parents:
diff changeset
2196 LABEL_117:
Ritor1
parents:
diff changeset
2197 v39 += *((unsigned char *)&v5->pItems[0].uItemID + v40 + v52 + v5->pItems[v4->uItemID].uEquipType);
Ritor1
parents:
diff changeset
2198 if ( *((unsigned char *)&v5->pItems[0].uItemID + v40 + v52 + v5->pItems[v4->uItemID].uEquipType) )
Ritor1
parents:
diff changeset
2199 {
Ritor1
parents:
diff changeset
2200 v44 = v58;
Ritor1
parents:
diff changeset
2201 ++v58;
Ritor1
parents:
diff changeset
2202 *v44 = a2b;
Ritor1
parents:
diff changeset
2203 }
Ritor1
parents:
diff changeset
2204 goto LABEL_119;
Ritor1
parents:
diff changeset
2205 }
Ritor1
parents:
diff changeset
2206 v41 = v43 == 2;
Ritor1
parents:
diff changeset
2207 break;
Ritor1
parents:
diff changeset
2208 case 4:
Ritor1
parents:
diff changeset
2209 v42 = *(unsigned char *)v40;
Ritor1
parents:
diff changeset
2210 if ( *(unsigned char *)v40 == 1 || v42 == 2 )
Ritor1
parents:
diff changeset
2211 goto LABEL_117;
Ritor1
parents:
diff changeset
2212 v41 = v42 == 3;
Ritor1
parents:
diff changeset
2213 break;
Ritor1
parents:
diff changeset
2214 default:
Ritor1
parents:
diff changeset
2215 if ( v54 != 5 )
Ritor1
parents:
diff changeset
2216 goto LABEL_119;
Ritor1
parents:
diff changeset
2217 v41 = *(unsigned char *)v40 == 3;
Ritor1
parents:
diff changeset
2218 break;
Ritor1
parents:
diff changeset
2219 }
Ritor1
parents:
diff changeset
2220 if ( v41 )
Ritor1
parents:
diff changeset
2221 goto LABEL_117;
Ritor1
parents:
diff changeset
2222 LABEL_119:
Ritor1
parents:
diff changeset
2223 ++a2b;
Ritor1
parents:
diff changeset
2224 v40 += 28;
Ritor1
parents:
diff changeset
2225 }
Ritor1
parents:
diff changeset
2226 while ( a2b < v5->field_11798 );
Ritor1
parents:
diff changeset
2227 }
Ritor1
parents:
diff changeset
2228 v45 = rand();
Ritor1
parents:
diff changeset
2229 v4->uAdditionalValue = *(uint *)Dst;
Ritor1
parents:
diff changeset
2230 v46 = v45 % v39 + 1;
Ritor1
parents:
diff changeset
2231 a2c = *((unsigned char *)&v5->pItems[0].uItemID + 28 * (*(uint *)Dst + 1389) + v5->pItems[v4->uItemID].uEquipType);
Ritor1
parents:
diff changeset
2232 if ( a2c < v46 )
Ritor1
parents:
diff changeset
2233 {
Ritor1
parents:
diff changeset
2234 for ( j = (int *)&Dst; ; j = (int *)v59 )
Ritor1
parents:
diff changeset
2235 {
Ritor1
parents:
diff changeset
2236 v48 = v4->uItemID;
Ritor1
parents:
diff changeset
2237 v49 = (int)(j + 1);
Ritor1
parents:
diff changeset
2238 v59 = v49;
Ritor1
parents:
diff changeset
2239 v50 = *(unsigned int *)v49;
Ritor1
parents:
diff changeset
2240 v4->uAdditionalValue = v50;
Ritor1
parents:
diff changeset
2241 a2c += *((unsigned char *)&v5->pItems[0].uItemID + 28 * (v50 + 1389) + v5->pItems[v48].uEquipType);
Ritor1
parents:
diff changeset
2242 if ( a2c >= v46 )
Ritor1
parents:
diff changeset
2243 break;
Ritor1
parents:
diff changeset
2244 }
Ritor1
parents:
diff changeset
2245 }
Ritor1
parents:
diff changeset
2246 ++v4->uAdditionalValue;
Ritor1
parents:
diff changeset
2247 }
Ritor1
parents:
diff changeset
2248
Ritor1
parents:
diff changeset
2249 //----- (004505CC) --------------------------------------------------------
Ritor1
parents:
diff changeset
2250 bool ItemGen::GenerateArtifact()
Ritor1
parents:
diff changeset
2251 {
Ritor1
parents:
diff changeset
2252 ItemGen *v1; // edi@1
Ritor1
parents:
diff changeset
2253 signed int uNumArtifactsNotFound; // esi@1
Ritor1
parents:
diff changeset
2254 int v3; // eax@1
Ritor1
parents:
diff changeset
2255 bool result; // eax@6
Ritor1
parents:
diff changeset
2256 int v5[32]; // [sp+8h] [bp-A0h]@3
Ritor1
parents:
diff changeset
2257 char Dst[32]; // [sp+88h] [bp-20h]@1
Ritor1
parents:
diff changeset
2258
Ritor1
parents:
diff changeset
2259 auto a2 = this;
Ritor1
parents:
diff changeset
2260 v1 = a2;
Ritor1
parents:
diff changeset
2261 memset(Dst, 0, 0x20u);
Ritor1
parents:
diff changeset
2262 uNumArtifactsNotFound = 0;
Ritor1
parents:
diff changeset
2263 v3 = 500;
Ritor1
parents:
diff changeset
2264 do
Ritor1
parents:
diff changeset
2265 {
Ritor1
parents:
diff changeset
2266 if ( !pParty->field_3C.pIsArtifactFound[v3] )
Ritor1
parents:
diff changeset
2267 v5[uNumArtifactsNotFound++] = v3;
Ritor1
parents:
diff changeset
2268 ++v3;
Ritor1
parents:
diff changeset
2269 }
Ritor1
parents:
diff changeset
2270 while ( v3 < 529 );
Ritor1
parents:
diff changeset
2271 v1->Reset();
Ritor1
parents:
diff changeset
2272 if ( uNumArtifactsNotFound )
Ritor1
parents:
diff changeset
2273 {
Ritor1
parents:
diff changeset
2274 v1->uItemID = v5[rand() % uNumArtifactsNotFound];
Ritor1
parents:
diff changeset
2275 pItemsTable->SetSpecialBonus(v1);
Ritor1
parents:
diff changeset
2276 result = 1;
Ritor1
parents:
diff changeset
2277 }
Ritor1
parents:
diff changeset
2278 else
Ritor1
parents:
diff changeset
2279 {
Ritor1
parents:
diff changeset
2280 result = 0;
Ritor1
parents:
diff changeset
2281 }
Ritor1
parents:
diff changeset
2282 return result;
Ritor1
parents:
diff changeset
2283 }
Ritor1
parents:
diff changeset
2284 // 4505CC: using guessed type int var_A0[32];