Mercurial > mm7
annotate mm7_4.cpp @ 1500:fd6c580a02b7
m
author | Ritor1 |
---|---|
date | Sun, 01 Sep 2013 17:36:29 +0600 |
parents | a27cdb3d753e |
children | 4055b09160ae |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
198 | 5 #include <assert.h> |
0 | 6 |
1262 | 7 #include "Texture.h" |
8 #include "mm7_data.h" | |
1016 | 9 #include "VideoPlayer.h" |
10 #include "Sprites.h" | |
11 #include "BSPModel.h" | |
12 #include "OutdoorCamera.h" | |
13 #include "Mouse.h" | |
14 #include "stru6.h" | |
15 | |
16 #include "LightmapBuilder.h" | |
341 | 17 #include "MM7.h" |
0 | 18 #include "MapInfo.h" |
19 #include "Game.h" | |
20 #include "GUIWindow.h" | |
21 #include "GUIFont.h" | |
22 #include "Party.h" | |
23 #include "AudioPlayer.h" | |
24 #include "Outdoor.h" | |
1277 | 25 #include "Outdoor_stuff.h" |
0 | 26 #include "IndoorCamera.h" |
27 #include "LOD.h" | |
28 #include "Actor.h" | |
29 #include "Allocator.h" | |
30 #include "Events.h" | |
31 #include "Viewport.h" | |
32 #include "FrameTableInc.h" | |
33 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
34 #include "SpriteObject.h" |
0 | 35 #include "ObjectList.h" |
36 #include "DecorationList.h" | |
37 #include "Time.h" | |
38 #include "IconFrameTable.h" | |
39 #include "PlayerFrameTable.h" | |
40 #include "Awards.h" | |
41 #include "TurnEngine.h" | |
42 #include "Events2D.h" | |
43 #include "stru159.h" | |
189 | 44 #include "texts.h" |
0 | 45 #include "Log.h" |
1299 | 46 #include "UI\UIHouses.h" |
1262 | 47 #include "Lights.h" |
0 | 48 |
49 //----- (0046CC4B) -------------------------------------------------------- | |
1459 | 50 void check_event_triggers() |
0 | 51 { |
52 int v0; // eax@1 | |
53 LevelDecoration *v1; // esi@2 | |
54 signed int v2; // edi@2 | |
55 int v3; // ebx@2 | |
56 int v4; // eax@3 | |
57 int v5; // ebx@3 | |
58 unsigned int v6; // ecx@3 | |
59 unsigned int v7; // edx@6 | |
60 unsigned int v8; // edx@8 | |
112 | 61 Actor *v9; // edi@13 |
0 | 62 int v10; // ebx@14 |
63 int v11; // eax@14 | |
64 int v12; // ebx@14 | |
65 unsigned int v13; // ecx@14 | |
66 int v14; // edx@15 | |
67 unsigned int v15; // edx@17 | |
68 unsigned int v16; // edx@19 | |
69 char *v17; // edi@25 | |
70 int v18; // ebx@26 | |
71 int v19; // eax@26 | |
72 int v20; // ebx@26 | |
73 unsigned int v21; // ecx@26 | |
74 int v22; // edx@27 | |
75 unsigned int v23; // edx@29 | |
76 unsigned int v24; // edx@31 | |
77 int v25; // [sp+0h] [bp-24h]@3 | |
78 int v26; // [sp+0h] [bp-24h]@14 | |
79 int v27; // [sp+0h] [bp-24h]@26 | |
80 int v28; // [sp+4h] [bp-20h]@3 | |
81 int v29; // [sp+4h] [bp-20h]@14 | |
82 int v30; // [sp+4h] [bp-20h]@26 | |
83 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
84 int v32; // [sp+Ch] [bp-18h]@2 | |
85 int v33; // [sp+10h] [bp-14h]@2 | |
86 int i; // [sp+14h] [bp-10h]@1 | |
87 int v35; // [sp+18h] [bp-Ch]@2 | |
88 int v36; // [sp+1Ch] [bp-8h]@3 | |
89 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
90 signed int v38; // [sp+20h] [bp-4h]@24 | |
91 | |
92 v0 = 0; | |
1459 | 93 for ( i = 0; i < num_event_triggers; ++i ) |
0 | 94 { |
1459 | 95 v1 = &pLevelDecorations[event_triggers[v0]]; |
0 | 96 v2 = v1->field_18; |
97 v3 = v1->vPosition.y; | |
98 v33 = v1->vPosition.x; | |
99 v32 = v1->vPosition.y; | |
100 v35 = v1->vPosition.z; | |
101 v31 = v1->field_18; | |
1489 | 102 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH) |
0 | 103 { |
104 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
105 v25 = abs(v3 - pParty->vPosition.y); | |
106 v28 = abs(v35 - pParty->vPosition.z); | |
107 v4 = v36; | |
108 v5 = v25; | |
109 v6 = v28; | |
110 if ( v36 < v25 ) | |
111 { | |
112 v4 = v25; | |
113 v5 = v36; | |
114 } | |
115 if ( v4 < v28 ) | |
116 { | |
117 v7 = v4; | |
118 v4 = v28; | |
119 v6 = v7; | |
120 } | |
121 if ( v5 < (signed int)v6 ) | |
122 { | |
123 v8 = v6; | |
124 v6 = v5; | |
125 v5 = v8; | |
126 } | |
127 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 128 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 129 } |
1489 | 130 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) |
0 | 131 { |
132 v37 = 0; | |
133 if ( (signed int)uNumActors > 0 ) | |
134 { | |
1202 | 135 v9 = pActors.data();//[0].vPosition.y; |
0 | 136 do |
137 { | |
112 | 138 v10 = abs(v33 - v9->vPosition.x); |
139 v29 = abs(v32 - v9->vPosition.y); | |
140 v26 = abs(v35 - v9->vPosition.z); | |
0 | 141 v11 = v10; |
142 v12 = v29; | |
143 v13 = v26; | |
144 if ( v11 < v29 ) | |
145 { | |
146 v14 = v11; | |
147 v11 = v29; | |
148 v12 = v14; | |
149 } | |
150 if ( v11 < v26 ) | |
151 { | |
152 v15 = v11; | |
153 v11 = v26; | |
154 v13 = v15; | |
155 } | |
156 if ( v12 < (signed int)v13 ) | |
157 { | |
158 v16 = v13; | |
159 v13 = v12; | |
160 v12 = v16; | |
161 } | |
162 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
163 EventProcessor(v1->field_16_event_id, 0, 1); | |
164 ++v37; | |
112 | 165 ++v9; |
0 | 166 } |
167 while ( v37 < (signed int)uNumActors ); | |
168 } | |
169 } | |
1489 | 170 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) |
0 | 171 { |
172 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
173 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
174 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
175 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 176 do |
177 { | |
178 v18 = abs(v33 - *((int *)v17 - 1)); | |
179 v30 = abs(v32 - *(int *)v17); | |
180 v27 = abs(v35 - *((int *)v17 + 1)); | |
181 v19 = v18; | |
182 v20 = v30; | |
183 v21 = v27; | |
184 if ( v19 < v30 ) | |
185 { | |
186 v22 = v19; | |
187 v19 = v30; | |
188 v20 = v22; | |
189 } | |
190 if ( v19 < v27 ) | |
191 { | |
192 v23 = v19; | |
193 v19 = v27; | |
194 v21 = v23; | |
195 } | |
196 if ( v20 < (signed int)v21 ) | |
197 { | |
198 v24 = v21; | |
199 v21 = v20; | |
200 v20 = v24; | |
201 } | |
202 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
203 EventProcessor(v1->field_16_event_id, 0, 1); | |
204 ++v38; | |
205 v17 += 112; | |
206 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
207 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 208 } |
209 } | |
210 v0 = i + 1; | |
211 } | |
212 } | |
213 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
214 | |
215 //----- (0046D8E3) -------------------------------------------------------- | |
216 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
217 { | |
218 int v4; // ebx@1 | |
219 unsigned int v5; // ecx@1 | |
220 BSPModel *v6; // edi@3 | |
221 ODMFace *v7; // esi@10 | |
222 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
223 signed __int16 *v9; // eax@18 |
0 | 224 int v10; // edx@19 |
225 int v11; // ecx@21 | |
226 int v12; // ecx@23 | |
227 signed int v13; // eax@25 | |
228 int v14; // edx@27 | |
229 int v15; // edx@29 | |
230 int v16; // ST18_4@29 | |
231 signed int v17; // edx@29 | |
232 signed __int64 v18; // qtt@29 | |
233 int v19; // eax@35 | |
234 signed int v20; // ecx@37 | |
235 signed int v22; // ebx@42 | |
236 unsigned int v23; // esi@43 | |
237 int v24; // edx@44 | |
238 int v25; // eax@44 | |
239 int v26; // [sp+Ch] [bp-38h]@7 | |
240 int v27; // [sp+10h] [bp-34h]@21 | |
241 int v28; // [sp+18h] [bp-2Ch]@21 | |
242 int v29; // [sp+1Ch] [bp-28h]@2 | |
243 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
244 signed int v31; // [sp+24h] [bp-20h]@1 | |
245 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
246 int v33; // [sp+2Ch] [bp-18h]@7 | |
247 bool v34; // [sp+30h] [bp-14h]@21 | |
248 bool v35; // [sp+34h] [bp-10h]@23 | |
249 signed int v36; // [sp+38h] [bp-Ch]@17 | |
250 signed int v37; // [sp+38h] [bp-Ch]@21 | |
251 signed int v38; // [sp+38h] [bp-Ch]@42 | |
252 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
253 signed int v40; // [sp+40h] [bp-4h]@1 | |
254 | |
255 dword_720ED0[0] = -1; | |
256 dword_720E80[0] = -1; | |
257 v4 = a1; | |
258 v5 = 0; | |
259 v40 = a2; | |
260 v31 = v4; | |
261 v39 = 1; | |
262 dword_720F20[0] = 10000; | |
263 v32 = 0; | |
264 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
265 { | |
266 v29 = 0; | |
267 do | |
268 { | |
269 v6 = &pOutdoor->pBModels[v29]; | |
270 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
271 { | |
272 if ( v4 >= v6->sMinX ) | |
273 { | |
274 if ( v40 <= v6->sMaxY ) | |
275 { | |
276 if ( v40 >= v6->sMinY ) | |
277 { | |
278 v33 = v5; | |
279 v26 = v6->uNumFaces; | |
280 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
281 { | |
282 v30 = v5; | |
283 while ( 1 ) | |
284 { | |
285 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
286 v8 = v7->uPolygonType; | |
287 if ( (v8 == 5 || v8 == 6) | |
288 && !(BYTE3(v7->uAttributes) & 0x20) | |
289 && v4 <= v7->pBoundingBox.x2 | |
290 && v4 >= v7->pBoundingBox.x1 | |
291 && v40 <= v7->pBoundingBox.y2 | |
292 && v40 >= v7->pBoundingBox.y1 ) | |
293 { | |
294 v36 = v5; | |
295 if ( v7->uNumVertices ) | |
296 { | |
297 v9 = v7->pXInterceptDisplacements; | |
298 do | |
299 { | |
300 v10 = 2 * v36; | |
301 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
302 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
303 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
304 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
305 ++v9; | |
306 } | |
307 while ( v36 < v7->uNumVertices ); | |
308 v4 = v31; | |
309 } | |
310 v27 = 2 * v7->uNumVertices; | |
311 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
312 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
313 v11 = 0; | |
314 v34 = word_720CE0_ys[0] >= v40; | |
315 v37 = 0; | |
316 v28 = 0; | |
317 if ( v27 > 0 ) | |
318 { | |
319 do | |
320 { | |
321 if ( v37 >= 2 ) | |
322 break; | |
323 v12 = v11; | |
324 v4 = v31; | |
325 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
326 if ( v34 != v35 ) | |
327 { | |
328 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
1110 | 329 v14 = v13 | (word_720DB0_xs[v12] < v31); |
0 | 330 if ( v14 != 3 ) |
331 { | |
332 if ( !v14 | |
333 || (v15 = word_720CE0_ys[v12], | |
334 v16 = word_720CE0_ys[v12 + 1] - v15, | |
335 v17 = v40 - v15, | |
336 LODWORD(v18) = v17 << 16, | |
337 HIDWORD(v18) = v17 >> 16, | |
338 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
339 - (signed int)word_720DB0_xs[v12]) | |
340 * v18 | |
341 / v16) >> 16) | |
342 + word_720DB0_xs[v12]) >= v31) ) | |
343 ++v37; | |
344 } | |
345 } | |
346 v11 = v28 + 1; | |
347 v34 = v35; | |
348 ++v28; | |
349 } | |
350 while ( v28 < v27 ); | |
351 if ( v37 == 1 ) | |
352 { | |
353 if ( v39 >= 20 ) | |
354 break; | |
355 if ( v7->uPolygonType == 5 ) | |
356 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
357 else | |
358 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
359 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
360 + HIWORD(v7->zCalc3); | |
361 v20 = v39++; | |
362 dword_720F20[v20] = v19; | |
363 dword_720ED0[v20] = v32; | |
364 dword_720E80[v20] = v33; | |
365 } | |
366 } | |
367 } | |
368 ++v33; | |
369 v30 += 308; | |
370 if ( v33 >= v26 ) | |
371 break; | |
372 v5 = 0; | |
373 } | |
374 } | |
375 } | |
376 } | |
377 } | |
378 } | |
379 ++v32; | |
380 ++v29; | |
381 v5 = 0; | |
382 } | |
383 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
384 if ( !v39 ) | |
385 { | |
386 *(int *)a4 = 0; | |
387 return dword_720F20[0]; | |
388 } | |
389 } | |
390 v22 = 0; | |
391 v38 = v5; | |
1419 | 392 if ( v39 > (signed int)v5 ) |
0 | 393 { |
1419 | 394 v23 = 0; |
395 do | |
396 { | |
397 v24 = dword_720F20[v5 / 4]; | |
398 v25 = *(int *)((char *)dword_720F20.data() + v23); | |
399 if ( v24 == v25 ) | |
400 { | |
401 v22 = v38; | |
402 v23 = v5; | |
403 } | |
404 else if ( v25 > a3 + 15 ) | |
405 { | |
406 if ( v24 < v25 ) | |
407 { | |
408 v22 = v38; | |
409 v23 = v5; | |
410 } | |
411 } | |
412 else if ( v24 > v25 && v24 <= a3 + 15 ) | |
413 { | |
414 v22 = v38; | |
415 v23 = v5; | |
416 } | |
417 ++v38; | |
418 v5 += 4; | |
419 } | |
420 while ( v38 < v39 ); | |
421 if ( v22 ) | |
422 { | |
423 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
424 return dword_720F20[v22]; | |
425 } | |
0 | 426 } |
427 *(int *)a4 = 0; | |
428 return dword_720F20[v22]; | |
429 } | |
430 | |
431 //----- (0046DEF2) -------------------------------------------------------- | |
432 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
433 { | |
434 unsigned int result; // eax@1 | |
435 | |
436 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
437 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 438 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
439 return result; | |
440 } | |
441 | |
442 //----- (0046E0B2) -------------------------------------------------------- | |
1458 | 443 void _46E0B2_collide_against_decorations() |
0 | 444 { |
445 BLVSector *v0; // ebp@1 | |
446 LevelDecoration *v1; // edi@2 | |
447 DecorationDesc *v2; // esi@3 | |
448 int v3; // edx@4 | |
449 int v4; // eax@4 | |
450 int v5; // ecx@6 | |
451 int v6; // ebx@8 | |
452 int v7; // esi@8 | |
453 int v8; // ebx@10 | |
454 int v9; // esi@11 | |
455 int v10; // edi@12 | |
456 int v11; // eax@12 | |
457 int v12; // esi@14 | |
458 unsigned int v13; // eax@17 | |
459 signed int i; // [sp+4h] [bp-14h]@1 | |
460 int v15; // [sp+8h] [bp-10h]@10 | |
461 int v16; // [sp+Ch] [bp-Ch]@10 | |
462 int v17; // [sp+10h] [bp-8h]@10 | |
463 int v18; // [sp+14h] [bp-4h]@8 | |
464 | |
465 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
466 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
467 { | |
468 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1489 | 469 if (!(v1->uFlags & LEVEL_DECORATION_INVISIBLE)) |
0 | 470 { |
471 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 472 if (!v2->CanMoveThrough()) |
0 | 473 { |
474 v3 = v2->uRadius; | |
475 v4 = v1->vPosition.x; | |
476 if ( stru_721530.sMaxX <= v4 + v3 ) | |
477 { | |
478 if ( stru_721530.sMinX >= v4 - v3 ) | |
479 { | |
480 v5 = v1->vPosition.y; | |
481 if ( stru_721530.sMaxY <= v5 + v3 ) | |
482 { | |
483 if ( stru_721530.sMinY >= v5 - v3 ) | |
484 { | |
485 v6 = v2->uDecorationHeight; | |
486 v7 = v1->vPosition.z; | |
487 v18 = v6; | |
488 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
489 { | |
490 if ( stru_721530.sMinZ >= v7 ) | |
491 { | |
492 v16 = v4 - stru_721530.normal.x; | |
493 v15 = v5 - stru_721530.normal.y; | |
494 v8 = stru_721530.prolly_normal_d + v3; | |
495 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
496 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
497 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
498 { | |
499 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
500 if ( v9 > 0 ) | |
501 { | |
502 v10 = v1->vPosition.z; | |
503 v11 = stru_721530.normal.z | |
504 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
505 if ( v11 >= v10 ) | |
506 { | |
507 if ( v11 <= v18 + v10 ) | |
508 { | |
295 | 509 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 510 if ( v12 < 0 ) |
511 v12 = 0; | |
512 if ( v12 < stru_721530.field_7C ) | |
513 { | |
514 stru_721530.field_7C = v12; | |
515 v13 = 8 * v0->pDecorationIDs[i]; | |
516 LOBYTE(v13) = v13 | 5; | |
517 stru_721530.uFaceID = v13; | |
518 } | |
519 } | |
520 } | |
521 } | |
522 } | |
523 } | |
524 } | |
525 } | |
526 } | |
527 } | |
528 } | |
529 } | |
530 } | |
531 } | |
532 } | |
533 | |
534 //----- (00487DA9) -------------------------------------------------------- | |
1458 | 535 void sub_487DA9() |
0 | 536 { |
1413 | 537 for (int i = 0; i < 20000; ++i) |
538 array_77EC08[i].field_108 = 0; | |
0 | 539 } |
540 | |
541 //----- (00487DBE) -------------------------------------------------------- | |
542 void Software_ResetNewEdges() | |
543 { | |
544 int v0; // ecx@1 | |
545 Edge **v1; // eax@1 | |
546 signed int v2; // eax@3 | |
547 | |
548 v0 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
549 v1 = ptr_80CA10.data(); |
0 | 550 do |
551 { | |
552 ++v0; | |
553 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
554 *v1 = 0; | |
555 ++v1; | |
556 } | |
557 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
558 v2 = 2000; | |
559 do | |
560 { | |
561 pSurfs->field_22 = 0; | |
562 --v2; | |
563 } | |
564 while ( v2 ); | |
565 } | |
566 | |
567 //----- (0048A959) -------------------------------------------------------- | |
568 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
569 { | |
570 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
571 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
572 b = (uColor & 0x000000FF) / 255.0f; | |
573 | |
574 float h, s, v; | |
575 RGB2HSV(&h, &s, r, g, b, &v); | |
576 | |
577 if ( h_replace != -1.0 ) | |
578 h = h_replace; | |
579 if ( s_replace != -1.0 ) | |
580 s = s_replace; | |
581 if ( v_replace != -1.0 ) | |
582 v = v_replace; | |
583 HSV2RGB(&r, &g, &b, h, s, v); | |
584 | |
1413 | 585 return (((uint)round(r * 255.0f) & 0xFF) << 16) | |
586 (((uint)round(g * 255.0f) & 0xFF) << 8) | | |
587 (((uint)round(b * 255.0f) & 0xFF)); | |
0 | 588 } |
589 | |
590 //----- (0048B561) -------------------------------------------------------- | |
1029 | 591 int fixpoint_from_float(float val) |
0 | 592 { |
1029 | 593 // float X.Yf -> int XXXX YYYY |
594 int left = floorf((val - 0.5f) + 0.5f); | |
595 int right = floorf((val - left) * 65536.0f); | |
596 return (left << 16) | right; | |
0 | 597 } |
598 | |
599 //----- (00491E3A) -------------------------------------------------------- | |
1459 | 600 void sub_491E3A() |
0 | 601 { |
602 Player *v0; // ebx@1 | |
603 signed int v1; // esi@3 | |
604 char *v2; // eax@4 | |
605 unsigned int v3; // eax@7 | |
606 unsigned int v4; // edx@8 | |
607 char *v5; // ecx@9 | |
608 int v6; // edi@17 | |
609 Texture *v7; // ebx@18 | |
610 struct IDirect3DTexture2 **v8; // eax@19 | |
611 struct IDirect3DTexture2 *v9; // eax@20 | |
612 struct IDirectDrawSurface **v10; // eax@22 | |
613 struct IDirectDrawSurface *v11; // eax@23 | |
614 int v12; // eax@26 | |
615 | |
616 v0 = pParty->pPlayers; | |
617 do | |
618 { | |
203 | 619 if (SoundSetAction[24][0]) |
0 | 620 { |
621 v1 = 0; | |
764 | 622 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 623 { |
624 LABEL_7: | |
625 v3 = 0; | |
626 } | |
627 else | |
628 { | |
629 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 630 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 631 { |
632 ++v1; | |
633 v2 += 120; | |
764 | 634 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 635 goto LABEL_7; |
636 } | |
637 v3 = v1; | |
638 } | |
764 | 639 pSoundList->UnloadSound(v3, 1); |
0 | 640 v4 = 0; |
764 | 641 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 642 { |
643 LABEL_12: | |
644 v4 = 0; | |
645 } | |
646 else | |
647 { | |
648 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 649 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 650 { |
651 ++v4; | |
652 v5 += 120; | |
764 | 653 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 654 goto LABEL_12; |
655 } | |
656 } | |
764 | 657 pSoundList->UnloadSound(v4, 1); |
0 | 658 } |
659 ++v0; | |
660 } | |
661 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
662 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 663 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 664 { |
665 v7 = &pIcons_LOD->pTextures[v6]; | |
666 do | |
667 { | |
668 v7->Release(); | |
669 v8 = pIcons_LOD->pHardwareTextures; | |
670 if ( v8 ) | |
671 { | |
672 v9 = v8[v6]; | |
673 if ( v9 ) | |
674 { | |
675 v9->Release(); | |
676 pIcons_LOD->pHardwareTextures[v6] = 0; | |
677 } | |
678 } | |
679 v10 = pIcons_LOD->pHardwareSurfaces; | |
680 if ( v10 ) | |
681 { | |
682 v11 = v10[v6]; | |
683 if ( v11 ) | |
684 { | |
685 v11->Release(); | |
686 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
687 } | |
688 } | |
689 --v6; | |
690 --v7; | |
691 } | |
33 | 692 while ( v6 >= pIcons_LOD->pFacesLock ); |
693 } | |
694 v12 = pIcons_LOD->pFacesLock; | |
695 pIcons_LOD->pFacesLock = 0; | |
0 | 696 pIcons_LOD->uNumLoadedFiles = v12; |
697 } | |
698 // 4ED498: using guessed type char byte_4ED498; | |
699 | |
700 //----- (00493938) -------------------------------------------------------- | |
1458 | 701 int _493938_regenerate() |
0 | 702 { |
703 int v0; // edi@1 | |
704 signed __int64 v1; // qax@1 | |
705 int v2; // ecx@1 | |
706 int result; // eax@1 | |
707 int v4; // eax@2 | |
708 int v5; // edi@5 | |
112 | 709 int *v6; // ecx@5 |
0 | 710 char v7; // sf@5 |
112 | 711 int *v8; // ecx@10 |
0 | 712 int v9; // edi@15 |
713 signed int v10; // eax@15 | |
714 __int16 *v11; // edx@16 | |
715 int v12; // eax@20 | |
716 int v13; // ebx@20 | |
717 unsigned int *v14; // esi@21 | |
718 unsigned int v15; // ecx@21 | |
719 unsigned int v16; // eax@21 | |
720 int v17; // edx@21 | |
721 int v18; // eax@21 | |
722 signed int v19; // eax@21 | |
723 signed int v20; // ebx@25 | |
724 Player *v21; // esi@25 | |
725 ITEM_EQUIP_TYPE v22; // edi@30 | |
726 //int v23; // edx@31 | |
727 signed int v24; // ecx@32 | |
728 signed int v25; // eax@33 | |
729 int v26; // eax@35 | |
730 int v27; // eax@36 | |
731 int v28; // eax@37 | |
732 int v29; // eax@40 | |
733 int v30; // eax@41 | |
734 signed int v31; // ecx@53 | |
735 char *v32; // eax@53 | |
736 char *v33; // edi@82 | |
737 int v34; // ecx@88 | |
738 int v35; // eax@88 | |
739 char *v36; // edi@99 | |
740 int v37; // edi@104 | |
741 int v38; // edi@106 | |
742 int v39; // edi@111 | |
743 int v40; // ecx@113 | |
744 char v41[400]; // [sp+4h] [bp-22Ch]@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
745 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 746 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
747 int v44; // [sp+210h] [bp-20h]@22 | |
748 int v45; // [sp+214h] [bp-1Ch]@25 | |
749 int v46; // [sp+218h] [bp-18h]@25 | |
750 int v47; // [sp+21Ch] [bp-14h]@25 | |
751 int v48; // [sp+220h] [bp-10h]@25 | |
752 int v49; // [sp+224h] [bp-Ch]@24 | |
753 int v50; // [sp+228h] [bp-8h]@25 | |
754 int v51; // [sp+22Ch] [bp-4h]@2 | |
755 | |
756 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
757 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
758 v2 = (signed int)v1 / 60; | |
759 result = (signed int)v1 / 60 + 5; | |
760 if ( v0 >= result ) | |
761 { | |
762 v51 = 0; | |
763 v4 = (v0 - v2) / 5; | |
764 if (pParty->FlyActive()) | |
765 { | |
766 if ( pParty->bFlying ) | |
767 { | |
569 | 768 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
769 { // colliding with something in the air - fall down | |
770 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
771 //__debugbreak(); | |
1167 | 772 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000]; |
112 | 773 v7 = *v6 < v5; |
774 *v6 -= v5; | |
0 | 775 if ( v7 ) |
776 { | |
112 | 777 *v6 = 0; |
0 | 778 pParty->uFlags &= 0xFFFFFFBFu; |
779 pParty->bFlying = 0; | |
780 v51 = 1; | |
781 } | |
782 } | |
783 } | |
784 } | |
569 | 785 |
0 | 786 if (pParty->WaterWalkActive()) |
787 { | |
569 | 788 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
789 { | |
790 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
791 { // taking on water | |
792 //__debugbreak(); | |
1167 | 793 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 794 v7 = *v8 < v4; |
795 *v8 -= v4; | |
0 | 796 if ( v7 ) |
797 { | |
112 | 798 *v8 = 0; |
569 | 799 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 800 v51 = 1; |
801 } | |
802 } | |
803 } | |
804 } | |
569 | 805 |
0 | 806 if (pParty->ImmolationActive()) |
807 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
808 //SpriteObject::SpriteObject(&a1); |
0 | 809 v9 = 0; |
810 a3.z = 0; | |
811 a3.y = 0; | |
812 a3.x = 0; | |
813 a1.stru_24.Reset(); | |
822 | 814 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
815 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 816 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
817 a1.uType = 1070; |
822 | 818 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 819 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
820 { | |
821 LABEL_19: | |
822 LOWORD(v10) = 0; | |
823 } | |
824 else | |
825 { | |
826 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 827 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 828 { |
829 ++v10; | |
830 v11 += 28; | |
831 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
832 goto LABEL_19; | |
833 } | |
834 } | |
835 a1.uObjectDescID = v10; | |
836 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 837 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 838 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 839 a1.uAttributes = 0; |
840 a1.uSectorID = 0; | |
841 a1.uSpriteFrameID = 0; | |
822 | 842 a1.spell_caster_pid = v12; |
0 | 843 a1.uFacing = 0; |
844 a1.uSoundID = 0; | |
1459 | 845 v13 = _46A89E_immolation_effect((int)v41, 100, 307); |
0 | 846 if ( v13 > 0 ) |
847 { | |
848 do | |
849 { | |
850 v14 = (unsigned int *)&v41[4 * v9]; | |
851 v15 = *v14; | |
852 v16 = *v14; | |
853 a1.vPosition.x = pActors[v16].vPosition.x; | |
854 v17 = pActors[v16].vPosition.y; | |
855 a1.vPosition.z = pActors[v16].vPosition.z; | |
856 v18 = 8 * v15; | |
862 | 857 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 858 a1.vPosition.y = v17; |
823 | 859 a1.spell_target_pid = v18; |
0 | 860 v19 = a1.Create(0, 0, 0, 0); |
862 | 861 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 862 ++v9; |
863 } | |
864 while ( v9 < v13 ); | |
865 } | |
866 } | |
867 v44 = 0; | |
248 | 868 if (PartyHasDragon()) |
0 | 869 v44 = 1; |
870 v49 = 0; | |
871 LABEL_25: | |
872 v20 = 0; | |
873 v21 = &pParty->pPlayers[v49]; | |
874 v50 = 0; | |
875 v47 = 0; | |
876 v45 = 0; | |
877 v48 = 0; | |
878 v46 = 0; | |
255 | 879 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 880 v50 = 1; |
135 | 881 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 882 v48 = 1; |
883 v22 = (ITEM_EQUIP_TYPE)0; | |
884 while ( 1 ) | |
885 { | |
886 if ( v21->HasItemEquipped(v22) ) | |
887 { | |
888 //v23 = v21->pEquipment.pIndices; | |
889 auto _idx = v21->pEquipment.pIndices[v22]; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
890 v24 = v21->pInventoryItemList[_idx].uItemID; |
0 | 891 if ( v24 > 134 ) |
892 { | |
893 if ( v24 == 529 ) | |
894 goto LABEL_43; | |
895 if ( v24 == 535 ) | |
896 goto LABEL_44; | |
897 if ( v24 == 515 ) | |
898 { | |
899 v47 = 1; | |
900 } | |
901 else | |
902 { | |
903 if ( v24 == 532 ) | |
904 goto LABEL_50; | |
905 } | |
906 } | |
907 else | |
908 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
909 v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType; |
0 | 910 if ( v25 <= 50 ) |
911 { | |
912 if ( v25 != 50 ) | |
913 { | |
914 v26 = v25 - 37; | |
915 if ( v26 ) | |
916 { | |
917 v27 = v26 - 1; | |
918 if ( !v27 ) | |
919 goto LABEL_50; | |
920 v28 = v27 - 6; | |
921 if ( v28 ) | |
922 { | |
923 if ( v28 != 3 ) | |
924 goto LABEL_51; | |
925 LABEL_50: | |
926 v50 = 1; | |
927 goto LABEL_51; | |
928 } | |
929 } | |
930 } | |
931 LABEL_44: | |
932 v20 = 1; | |
933 goto LABEL_51; | |
934 } | |
935 v29 = v25 - 54; | |
936 if ( !v29 ) | |
937 goto LABEL_44; | |
938 v30 = v29 - 1; | |
939 if ( !v30 ) | |
940 goto LABEL_50; | |
941 if ( v30 == 11 ) | |
942 { | |
943 LABEL_43: | |
944 v20 = 1; | |
945 v50 = 1; | |
946 goto LABEL_51; | |
947 } | |
948 } | |
949 } | |
950 LABEL_51: | |
951 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
952 if ( (signed int)v22 >= 16 ) | |
953 { | |
954 if ( v48 ) | |
955 { | |
956 v31 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
957 v32 = (char *)v21->pInventoryItemList; |
0 | 958 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) |
959 { | |
960 ++v31; | |
961 v32 += 36; | |
962 if ( v31 >= 138 ) | |
963 goto LABEL_59; | |
964 } | |
965 v48 = 0; | |
966 v45 = 1; | |
967 } | |
968 LABEL_59: | |
969 if ( v21->pConditions[17] ) | |
970 v46 = 1; | |
971 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
972 { | |
973 ++v21->sHealth; | |
974 if ( v21->sHealth > v21->GetMaxHealth() ) | |
975 v21->sHealth = v21->GetMaxHealth(); | |
976 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
977 { | |
978 LODWORD(v21->pConditions[13]) = 0; | |
979 HIDWORD(v21->pConditions[13]) = 0; | |
980 } | |
981 v51 = 1; | |
982 } | |
983 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
984 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
985 && !v21->pConditions[14] | |
986 && !v21->pConditions[16] ) | |
987 { | |
988 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
989 if ( v21->sHealth > v21->GetMaxHealth() ) | |
990 v21->sHealth = v21->GetMaxHealth(); | |
991 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
992 { | |
993 LODWORD(v21->pConditions[13]) = 0; | |
994 HIDWORD(v21->pConditions[13]) = 0; | |
995 } | |
996 v51 = 1; | |
997 } | |
998 if ( v50 ) | |
999 { | |
1000 v33 = (char *)&v21->sMana; | |
1001 ++*(int *)v33; | |
1002 if ( v21->sMana > v21->GetMaxMana() ) | |
1003 *(int *)v33 = v21->GetMaxMana(); | |
1004 v51 = 1; | |
1005 } | |
1006 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
1007 { | |
1008 v34 = LODWORD(v21->pConditions[13]); | |
1009 --v21->sHealth; | |
1010 v35 = v21->sHealth; | |
1011 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
1012 v21->pConditions[13] = pParty->uTimePlayed; | |
1013 if ( v35 < 1 ) | |
1014 { | |
1015 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
1016 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
1017 { | |
1018 v21->pConditions[13] = pParty->uTimePlayed; | |
1019 } | |
1020 else | |
1021 { | |
1022 if ( !v21->pConditions[14] ) | |
1023 v21->pConditions[14] = pParty->uTimePlayed; | |
1024 } | |
1025 } | |
1026 v51 = 1; | |
1027 } | |
1028 if ( v45 ) | |
1029 { | |
1030 v36 = (char *)&v21->sMana; | |
1031 ++*(int *)v36; | |
1032 if ( v21->sMana > v21->GetMaxMana() ) | |
1033 *(int *)v36 = v21->GetMaxMana(); | |
1034 } | |
1035 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
1036 { | |
1037 v37 = v21->sHealth; | |
1038 if ( v37 > v21->GetMaxHealth() / 2 ) | |
1039 v21->sHealth = v37 - 2; | |
1040 v38 = v21->sMana; | |
1041 if ( v38 > v21->GetMaxMana() / 2 ) | |
1042 v21->sMana = v38 - 2; | |
1043 } | |
1044 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
1045 { | |
1046 v39 = v21->sHealth; | |
1047 if ( v39 > v21->GetMaxHealth() / 2 ) | |
1048 v21->sHealth = v39 - 1; | |
1049 v40 = v21->sMana; | |
1050 if ( v40 > 0 ) | |
1051 v21->sMana = v40 - 1; | |
1052 } | |
1053 ++v49; | |
1054 if ( v49 >= 4 ) | |
1055 { | |
1056 result = HIDWORD(pParty->uTimePlayed); | |
1057 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
1058 if ( !viewparams->bRedrawGameUI ) | |
1059 { | |
1060 result = v51; | |
1061 viewparams->bRedrawGameUI = v51; | |
1062 } | |
1063 return result; | |
1064 } | |
1065 goto LABEL_25; | |
1066 } | |
1067 } | |
1068 } | |
1069 return result; | |
1070 } | |
1071 | |
1072 //----- (00493F79) -------------------------------------------------------- | |
1459 | 1073 void init_summoned_item(stru351_summoned_item *_this, __int64 duration) |
0 | 1074 { |
1075 signed __int64 v2; // ST2C_8@1 | |
1076 signed __int64 v3; // qax@1 | |
351 | 1077 //signed __int64 v4; // ST1C_8@1 |
0 | 1078 unsigned __int64 v5; // qax@1 |
1079 unsigned int v6; // ebx@1 | |
1080 | |
1459 | 1081 v2 = (signed __int64)((double)duration * 0.234375); |
0 | 1082 v3 = v2 / 60 / 60; |
351 | 1083 //v4 = v3; |
0 | 1084 v5 = (unsigned int)v3 / 0x18; |
1085 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 1086 _this->field_0_expire_second = v2 % 60; |
1087 _this->field_4_expire_minute = v2 / 60 % 60; | |
1088 _this->field_8_expire_hour = v3 % 24; | |
1089 _this->field_10_expire_week = v5 / 7 & 3; | |
1090 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
1091 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 1092 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 1093 } |
1094 | |
1095 //----- (00494035) -------------------------------------------------------- | |
1031 | 1096 void _494035_timed_effects__water_walking_damage__etc() |
0 | 1097 { |
1098 signed __int64 v0; // qax@1 | |
1099 signed __int64 v1; // ST30_8@1 | |
1100 signed __int64 v2; // ST38_8@1 | |
1101 unsigned __int64 v3; // qax@1 | |
1102 unsigned int v4; // edi@1 | |
1103 //signed int v5; // eax@4 | |
1104 //char *v6; // ecx@5 | |
1105 //Player *v7; // esi@8 | |
1106 //char *v8; // ecx@12 | |
766 | 1107 //Player *pPlayer; // esi@15 |
0 | 1108 //void *v10; // esi@25 |
1109 unsigned int v11; // ecx@27 | |
1110 signed int v12; // edi@29 | |
1424 | 1111 //Player *v13; // ecx@30 |
1112 //Player *v14; // esi@35 | |
1113 //double v15; // st7@35 | |
0 | 1114 Player **v16; // esi@43 |
1115 Player *v17; // edi@44 | |
1116 double v18; // st7@44 | |
816 | 1117 //float v19; // ST28_4@48 |
1118 //double v20; // ST38_8@48 | |
0 | 1119 Player *v21; // esi@51 |
1120 signed int v22; // edi@53 | |
1121 int v23; // eax@59 | |
1122 int v24; // ecx@60 | |
1123 int v25; // eax@63 | |
1124 int v26; // ecx@64 | |
1125 int v27; // eax@67 | |
1126 int v28; // ecx@68 | |
1127 int v29; // eax@71 | |
1128 int v30; // ecx@72 | |
1129 int v31; // eax@75 | |
1130 int v32; // ecx@76 | |
1131 int v33; // eax@79 | |
1132 int v34; // ecx@80 | |
1133 int v35; // eax@83 | |
1134 int v36; // ecx@84 | |
1135 int v37; // eax@87 | |
1136 int v38; // ecx@88 | |
1137 int v39; // eax@91 | |
1138 int v40; // ecx@92 | |
1139 int v41; // eax@95 | |
1140 int v42; // ecx@96 | |
1141 bool v43; // ebx@102 | |
1142 //SpellBuff *v44; // edi@104 | |
1143 //signed int v45; // ebp@104 | |
1144 bool v46; // edi@111 | |
1145 //SpellBuff *v47; // esi@113 | |
1146 //Player **v48; // esi@119 | |
1147 //signed int v49; // edi@121 | |
1148 //char *v50; // esi@122 | |
1149 signed int v51; // edx@128 | |
1150 signed int v52; // ecx@130 | |
1151 int v53; // eax@131 | |
1152 Player *v54; // eax@141 | |
766 | 1153 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 1154 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 1155 //int v57; // [sp-4h] [bp-34h]@18 |
1424 | 1156 //int v58; // [sp-4h] [bp-34h]@33 |
0 | 1157 int v59; // [sp-4h] [bp-34h]@55 |
816 | 1158 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 1159 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
1160 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 1161 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 1162 signed int a2a; // [sp+18h] [bp-18h]@47 |
1163 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
1164 | |
766 | 1165 //a2 = pParty->uCurrentHour; |
0 | 1166 v61 = pParty->uDaysPlayed; |
816 | 1167 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 1168 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
1169 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 1170 v1 = v0; |
1171 v0 /= 60i64; | |
1172 v2 = v0; | |
1173 v3 = (unsigned int)v0 / 24; | |
1174 v4 = (unsigned int)(v3 / 7) >> 2; | |
1175 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
1176 pParty->uCurrentMinute = v1 % 60; | |
1177 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
1178 pParty->uCurrentHour = v2 % 24; | |
1179 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
1180 pParty->uCurrentMonth = v4 % 12; | |
352 | 1181 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 1182 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 1183 { |
1184 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
1185 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
1186 | |
1187 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
1188 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
1189 | |
766 | 1190 ++pParty->days_played_without_rest; |
1191 if (pParty->days_played_without_rest > 1) | |
0 | 1192 { |
1193 for (uint i = 0; i < 4; ++i) | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
1194 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0); |
766 | 1195 |
1196 if (pParty->uNumFoodRations) | |
1197 Party::TakeFood(1); | |
0 | 1198 else |
1199 for (uint i = 0; i < 4; ++i) | |
766 | 1200 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
1201 | |
1202 if (pParty->days_played_without_rest > 3) | |
1203 for (uint i = 0; i < 4; ++i) | |
0 | 1204 { |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
1205 Player* player = pParty->pPlayers + i; |
766 | 1206 |
1207 player->Zero(); | |
1208 | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
1209 if (!player->IsPertified() && !player->IsEradicated() && !player->IsDead()) |
0 | 1210 { |
767 | 1211 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
1212 player->SetCondDeadWithBlockCheck(0); |
767 | 1213 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
1214 player->SetCondInsaneWithBlockCheck(0); |
0 | 1215 } |
1216 } | |
766 | 1217 } |
1218 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 1219 pOutdoor->SetFog(); |
1220 | |
1221 for (uint i = 0; i < 4; ++i) | |
1222 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
1223 } | |
766 | 1224 |
0 | 1225 v11 = LODWORD(pParty->uTimePlayed); |
1424 | 1226 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage error |
0 | 1227 { |
1424 | 1228 //v12 = 1; |
0 | 1229 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; |
1230 viewparams->bRedrawGameUI = 1; | |
1424 | 1231 //while ( 1 ) |
1232 for ( v12 = 1; v12 <= 4; ++v12 ) | |
0 | 1233 { |
1080 | 1234 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 1235 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
1236 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 1237 { |
1424 | 1238 //v58 = 0; |
1239 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); | |
0 | 1240 } |
1241 else | |
1242 { | |
1424 | 1243 //v58 = 0; |
0 | 1244 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) |
1245 { | |
1424 | 1246 //v14 = pPlayers[v12]; |
1247 //v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
1248 pPlayers[v12]->ReceiveDamage((signed __int64)pPlayers[v12]->GetMaxHealth() * 0.1, DMGT_FIRE); | |
0 | 1249 if ( pParty->uFlags & 4 ) |
1250 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1251 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); |
783 | 1252 GameUI_Footer_TimeLeft = 128; |
0 | 1253 } |
1254 } | |
1419 | 1255 else |
1424 | 1256 pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); |
0 | 1257 } |
1424 | 1258 //++v12; |
1259 //if ( v12 > 4 ) | |
1260 //{ | |
1261 //v11 = LODWORD(pParty->uTimePlayed); | |
1262 //break; | |
0 | 1263 } |
1424 | 1264 v11 = LODWORD(pParty->uTimePlayed); |
1265 //} | |
0 | 1266 } |
1267 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
1268 { | |
1269 viewparams->bRedrawGameUI = 1; | |
1270 pParty->field_6FC = v11 + 128; | |
1271 v16 = &pPlayers[1]; | |
1272 do | |
1273 { | |
1274 v17 = *v16; | |
1275 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 1276 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 1277 if ( pParty->uFlags & 0x200 ) |
1278 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1279 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); |
783 | 1280 GameUI_Footer_TimeLeft = 128; |
0 | 1281 } |
1282 ++v16; | |
1283 } | |
1284 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
1285 } | |
1286 _493938_regenerate(); | |
1287 v65 = 4; | |
816 | 1288 a2a = pEventTimer->uTimeElapsed; |
1289 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
1290 { | |
1291 //v19 = (double)(signed int)prev_time * 0.5; | |
1292 //v20 = v19 + 6.7553994e15; | |
1293 a2a *= 0.5f; | |
1294 if (a2a < 1) | |
0 | 1295 a2a = 1; |
1296 } | |
1297 v62 = &pPlayers[1]; | |
1298 do | |
1299 { | |
1300 v21 = *v62; | |
1301 if ( (*v62)->uTimeToRecovery ) | |
1302 v21->Recover(a2a); | |
1303 v22 = v21->sHealth; | |
1304 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
1305 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
1306 { | |
1419 | 1307 if ( v22 < 1 ) |
1308 { | |
1309 v59 = 0; | |
1310 v56 = 13; | |
1311 v21->SetCondition(v56, v59); | |
1312 } | |
0 | 1313 } |
1314 else | |
1315 { | |
1316 v59 = 0; | |
1317 v56 = 14; | |
1419 | 1318 v21->SetCondition(v56, v59); |
0 | 1319 } |
1320 v23 = (int)&v21->field_E0; | |
1321 if ( v21->field_E0 ) | |
1322 { | |
816 | 1323 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 1324 if ( v24 > 0 ) |
1325 { | |
1326 *(int *)v23 = v24; | |
1327 } | |
1328 else | |
1329 { | |
1330 *(int *)v23 = 0; | |
1331 viewparams->bRedrawGameUI = 1; | |
1332 } | |
1333 } | |
1334 v25 = (int)&v21->field_E4; | |
1335 if ( v21->field_E4 ) | |
1336 { | |
816 | 1337 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 1338 if ( v26 > 0 ) |
1339 { | |
1340 *(int *)v25 = v26; | |
1341 } | |
1342 else | |
1343 { | |
1344 *(int *)v25 = 0; | |
1345 viewparams->bRedrawGameUI = 1; | |
1346 } | |
1347 } | |
1348 v27 = (int)&v21->field_E8; | |
1349 if ( v21->field_E8 ) | |
1350 { | |
816 | 1351 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 1352 if ( v28 > 0 ) |
1353 { | |
1354 *(int *)v27 = v28; | |
1355 } | |
1356 else | |
1357 { | |
1358 *(int *)v27 = 0; | |
1359 viewparams->bRedrawGameUI = 1; | |
1360 } | |
1361 } | |
1362 v29 = (int)&v21->field_EC; | |
1363 if ( v21->field_EC ) | |
1364 { | |
816 | 1365 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 1366 if ( v30 > 0 ) |
1367 { | |
1368 *(int *)v29 = v30; | |
1369 } | |
1370 else | |
1371 { | |
1372 *(int *)v29 = 0; | |
1373 viewparams->bRedrawGameUI = 1; | |
1374 } | |
1375 } | |
1376 v31 = (int)&v21->field_F0; | |
1377 if ( v21->field_F0 ) | |
1378 { | |
816 | 1379 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 1380 if ( v32 > 0 ) |
1381 { | |
1382 *(int *)v31 = v32; | |
1383 } | |
1384 else | |
1385 { | |
1386 *(int *)v31 = 0; | |
1387 viewparams->bRedrawGameUI = 1; | |
1388 } | |
1389 } | |
1390 v33 = (int)&v21->field_F4; | |
1391 if ( v21->field_F4 ) | |
1392 { | |
816 | 1393 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 1394 if ( v34 > 0 ) |
1395 { | |
1396 *(int *)v33 = v34; | |
1397 } | |
1398 else | |
1399 { | |
1400 *(int *)v33 = 0; | |
1401 viewparams->bRedrawGameUI = 1; | |
1402 } | |
1403 } | |
1404 v35 = (int)&v21->field_F8; | |
1405 if ( v21->field_F8 ) | |
1406 { | |
816 | 1407 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 1408 if ( v36 > 0 ) |
1409 { | |
1410 *(int *)v35 = v36; | |
1411 } | |
1412 else | |
1413 { | |
1414 *(int *)v35 = 0; | |
1415 viewparams->bRedrawGameUI = 1; | |
1416 } | |
1417 } | |
1418 v37 = (int)&v21->field_FC; | |
1419 if ( v21->field_FC ) | |
1420 { | |
816 | 1421 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 1422 if ( v38 > 0 ) |
1423 { | |
1424 *(int *)v37 = v38; | |
1425 } | |
1426 else | |
1427 { | |
1428 *(int *)v37 = 0; | |
1429 viewparams->bRedrawGameUI = 1; | |
1430 } | |
1431 } | |
1432 v39 = (int)&v21->field_100; | |
1433 if ( v21->field_100 ) | |
1434 { | |
816 | 1435 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 1436 if ( v40 > 0 ) |
1437 { | |
1438 *(int *)v39 = v40; | |
1439 } | |
1440 else | |
1441 { | |
1442 *(int *)v39 = 0; | |
1443 viewparams->bRedrawGameUI = 1; | |
1444 } | |
1445 } | |
1446 v41 = (int)&v21->field_104; | |
1447 if ( v21->field_104 ) | |
1448 { | |
816 | 1449 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 1450 if ( v42 > 0 ) |
1451 { | |
1452 *(int *)v41 = v42; | |
1453 } | |
1454 else | |
1455 { | |
1456 *(int *)v41 = 0; | |
1457 viewparams->bRedrawGameUI = 1; | |
1458 } | |
1459 } | |
1460 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
1461 --v65; | |
1462 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
1463 | |
1464 for (uint k = 0; k < 24; ++k) | |
1340 | 1465 v21->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); |
0 | 1466 |
1467 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
1468 v21->SetCondition(1u, 0); | |
1469 ++v62; | |
1470 } | |
1471 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
1167 | 1472 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 1473 |
1474 for (uint i = 0; i < 20; ++i) | |
1475 { | |
1340 | 1476 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1) |
0 | 1477 viewparams->bRedrawGameUI = 1; |
1478 } | |
1479 | |
1167 | 1480 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 1481 { |
1482 for (uint i = 0; i < 4; ++i) | |
1483 pParty->pPlayers[i].SetCondition(1, 0); | |
1484 } | |
1485 | |
1486 for (uint i = 0; i < 2; ++i) | |
1487 { | |
1488 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
1489 if (pBuf->uExpireTime == 0) | |
1490 continue; | |
1491 | |
1492 if ( !(pBuf->uFlags & 1) ) | |
1493 { | |
1494 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
1495 { | |
1496 pBuf->Reset(); | |
1497 if (dword_4EE07C[i] == 7 ) | |
1498 pParty->bFlying = false; | |
1499 } | |
1500 } | |
1501 } | |
1502 | |
1503 v51 = v65; | |
1504 if ( v65 ) | |
1505 goto LABEL_135; | |
151 | 1506 if ( pCurrentScreen != SCREEN_REST ) |
0 | 1507 { |
1508 v52 = (signed int)&pPlayers[1]; | |
1509 while ( 1 ) | |
1510 { | |
1511 v53 = *(int *)v52; | |
1512 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
1513 break; | |
1514 v52 += 4; | |
1515 if ( v52 > (signed int)&pPlayers[4] ) | |
1516 goto LABEL_135; | |
1517 } | |
1518 *(int *)(v53 + 16) = 0; | |
1519 *(int *)(v53 + 20) = 0; | |
1520 v51 = 1; | |
1521 LABEL_135: | |
151 | 1522 if ( pCurrentScreen != SCREEN_REST |
0 | 1523 && (!v51 || dword_5C35C0) ) |
981 | 1524 uGameState = GAME_STATE_PARTY_DIED; |
0 | 1525 } |
1526 if ( uActiveCharacter ) | |
1527 { | |
151 | 1528 if ( pCurrentScreen != SCREEN_REST ) |
0 | 1529 { |
1530 v54 = pPlayers[uActiveCharacter]; | |
1531 if ( v54->pConditions[2] | |
1532 || v54->pConditions[12] | |
1533 || v54->pConditions[13] | |
1534 || v54->pConditions[14] | |
1535 || v54->pConditions[15] | |
1536 || v54->pConditions[16] ) | |
1537 { | |
1538 viewparams->bRedrawGameUI = 1; | |
1539 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1540 } | |
1541 } | |
1542 } | |
1543 } | |
1544 | |
1545 //----- (00494820) -------------------------------------------------------- | |
758 | 1546 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 1547 { |
1548 signed int v1; // eax@1 | |
1549 | |
1550 v1 = 5; | |
758 | 1551 if ( a1 % 24 >= 5 ) |
0 | 1552 v1 = 29; |
758 | 1553 return v1 - a1 % 24; |
0 | 1554 } |
1555 | |
1556 //----- (00494836) -------------------------------------------------------- | |
1557 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
1558 { | |
1559 int v3; // esi@1 | |
1560 int result; // eax@1 | |
1561 stru339_spell_sound *v5; // ebx@1 | |
1562 int *v6; // edi@2 | |
1563 unsigned int v7; // eax@3 | |
1564 int v8; // [sp+Ch] [bp-8h]@3 | |
1565 int v9; // [sp+10h] [bp-4h]@2 | |
1566 int a2a; // [sp+1Ch] [bp+8h]@1 | |
1567 | |
1568 v3 = 0; | |
1569 result = word_4EE088_sound_ids[uSoundID]; | |
1570 v5 = this; | |
1571 a2a = word_4EE088_sound_ids[uSoundID]; | |
1572 if ( result ) | |
1573 { | |
1574 v9 = 0; | |
1575 v6 = this->pSoundsOffsets; | |
1576 do | |
1577 { | |
1578 v7 = a2a++; | |
1579 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
1580 if ( !result ) | |
1581 break; | |
1582 a6 += 4; | |
1583 result = v8 + 256; | |
1584 *v6 = v3; | |
1585 v3 += result; | |
1586 ++v9; | |
1587 *(v6 - 2) = result; | |
1588 ++v6; | |
1589 } | |
1590 while ( v9 < 2 ); | |
1591 } | |
1592 return result; | |
1593 } | |
1594 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
1595 | |
1596 //----- (00494AED) -------------------------------------------------------- | |
130 | 1597 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 1598 { |
1599 unsigned int _uNumFrames; // edx@1 | |
1600 unsigned int result; // eax@1 | |
1601 PlayerFrame *v4; // ecx@2 | |
1602 | |
1603 _uNumFrames = this->uNumFrames; | |
1604 result = 0; | |
1605 if ( (signed int)this->uNumFrames <= 0 ) | |
1606 { | |
1607 result = 0; | |
1608 } | |
1609 else | |
1610 { | |
1611 v4 = this->pFrames; | |
130 | 1612 while ( v4->expression != expression ) |
0 | 1613 { |
1614 ++result; | |
1615 ++v4; | |
1616 if ( (signed int)result >= (signed int)_uNumFrames ) | |
1419 | 1617 return 0; |
0 | 1618 } |
1619 } | |
1620 return result; | |
1621 } | |
1622 | |
1623 //----- (00494B10) -------------------------------------------------------- | |
1624 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
1625 { | |
1626 unsigned int v3; // esi@1 | |
1627 PlayerFrame *v4; // edi@1 | |
1628 PlayerFrame *v5; // ecx@1 | |
1629 __int16 v6; // dx@2 | |
1630 int v7; // edx@3 | |
1631 char *i; // eax@3 | |
1632 int v9; // ecx@5 | |
1633 PlayerFrame *result; // eax@6 | |
1634 | |
1635 v3 = uFramesetID; | |
1636 v4 = this->pFrames; | |
1637 v5 = &v4[uFramesetID]; | |
1638 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
1639 { | |
1640 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
1641 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
1642 { | |
1643 v9 = *(short *)i; | |
1644 if ( v7 <= v9 ) | |
1645 break; | |
1646 v7 -= v9; | |
1647 ++v3; | |
1648 } | |
1649 result = &v4[v3]; | |
1650 } | |
1651 else | |
1652 { | |
1653 result = &v4[uFramesetID]; | |
1654 } | |
1655 return result; | |
1656 } | |
1657 | |
1658 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1659 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 1660 { |
1661 PlayerFrameTable *v4; // edi@1 | |
1662 int v5; // esi@1 | |
1663 int v6; // eax@2 | |
1664 | |
1665 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1666 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1667 if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime ) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1668 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1669 *pAnimTime = v5; |
0 | 1670 } |
1671 else | |
1672 { | |
1673 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1674 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1675 *pAnimTime = 8 * v5 % v4->pFrames[v6].uAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1676 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1677 return &v4->pFrames[*pFramesetID]; |
0 | 1678 } |
1679 | |
1680 //----- (00494BC3) -------------------------------------------------------- | |
1681 void PlayerFrameTable::ToFile() | |
1682 { | |
1683 PlayerFrameTable *v1; // esi@1 | |
1684 FILE *v2; // eax@1 | |
1685 FILE *v3; // edi@1 | |
1686 | |
1687 auto Str = this; | |
1688 | |
1689 v1 = Str; | |
1690 v2 = fopen("data\\dpft.bin", "wb"); | |
1691 v3 = v2; | |
1692 if ( !v2 ) | |
1693 Abortf("Unable to save dpft.bin!"); | |
1694 fwrite(v1, 4u, 1u, v2); | |
1695 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
1696 fclose(v3); | |
1697 } | |
1698 | |
1699 //----- (00494C0F) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1700 void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 1701 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1702 uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1703 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1704 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1705 uNumFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1706 assert(uNumFrames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1707 assert(!num_mm8_frames); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1708 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1709 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, uNumFrames * sizeof(PlayerFrame), "P Frames"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1710 memcpy(pFrames, (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1711 memcpy(pFrames + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
1712 memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame)); |
0 | 1713 } |
1714 | |
1715 //----- (00494C5A) -------------------------------------------------------- | |
1716 int PlayerFrameTable::FromFileTxt(const char *Args) | |
1717 { | |
1718 PlayerFrameTable *v2; // ebx@1 | |
1719 FILE *v3; // eax@1 | |
1720 int v4; // esi@3 | |
1721 void *v5; // eax@10 | |
1722 FILE *v6; // ST0C_4@12 | |
1723 char *i; // eax@12 | |
1724 __int16 v8; // ax@15 | |
1725 const char *v9; // ST10_4@15 | |
1726 unsigned __int16 v10; // ax@15 | |
1727 const char *v11; // ST0C_4@15 | |
1728 int j; // esi@15 | |
1729 int v13; // eax@17 | |
1730 int v14; // edx@22 | |
1731 int v15; // ecx@23 | |
1732 int v16; // eax@24 | |
1733 signed int k; // eax@27 | |
1734 PlayerFrame *v18; // edx@28 | |
1735 int v19; // esi@28 | |
1736 int l; // ecx@29 | |
1737 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1738 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
1739 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
1740 int v25; // [sp+2F8h] [bp-Ch]@3 | |
1741 int v26; // [sp+2FCh] [bp-8h]@3 | |
1742 FILE *File; // [sp+300h] [bp-4h]@1 | |
1743 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1744 | |
1745 v2 = this; | |
1746 //TileTable::dtor((TileTable *)this); | |
1747 v3 = fopen(Args, "r"); | |
1748 File = v3; | |
1749 if ( !v3 ) | |
1750 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
1751 v4 = 0; | |
1752 v25 = 0; | |
1753 v26 = 1; | |
1754 if ( fgets(&Buf, 490, v3) ) | |
1755 { | |
1756 do | |
1757 { | |
1758 *strchr(&Buf, 10) = 0; | |
703 | 1759 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1760 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
1761 { | |
1762 if ( v24.uPropCount < 3 ) | |
0 | 1763 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
1764 ++v25; | |
1765 } | |
1766 ++v26; | |
1767 } | |
1768 while ( fgets(&Buf, 490, File) ); | |
1769 v4 = v25; | |
1770 } | |
1771 v2->uNumFrames = v4; | |
1772 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
1773 v2->pFrames = (PlayerFrame *)v5; | |
1774 if ( !v5 ) | |
1775 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
1776 v6 = File; | |
1777 v2->uNumFrames = 0; | |
1778 fseek(v6, 0, 0); | |
1779 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1780 { | |
1781 *strchr(&Buf, 10) = 0; | |
703 | 1782 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1783 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 1784 { |
1785 v8 = atoi(v24.pProperties[0]); | |
1786 v9 = v24.pProperties[1]; | |
130 | 1787 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 1788 v10 = atoi(v9); |
1789 v11 = v24.pProperties[2]; | |
1790 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
1791 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
1792 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
1793 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 1794 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 1795 { |
1104 | 1796 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 1797 { |
1798 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
1799 *(char *)v13 |= 4u; | |
1800 } | |
1801 } | |
1802 ++v2->uNumFrames; | |
1803 } | |
1804 } | |
1805 fclose(File); | |
1806 v14 = 0; | |
1807 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
1808 { | |
1809 v15 = 0; | |
1810 do | |
1811 { | |
1812 v16 = (int)&v2->pFrames[v15]; | |
1813 if ( !(*(char *)(v16 + 18) & 4) ) | |
1814 *(char *)(v16 + 8) |= 1u; | |
1815 ++v14; | |
1816 ++v15; | |
1817 } | |
1818 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
1819 } | |
1820 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
1821 { | |
1822 v18 = v2->pFrames; | |
1823 Argsa = (int)&v18[k]; | |
1824 v19 = *(short *)(Argsa + 4); | |
1825 if ( *(char *)(Argsa + 8) & 1 ) | |
1826 { | |
1827 ++k; | |
1828 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
1829 { | |
1830 v19 += *(short *)(l + 4); | |
1831 ++k; | |
1832 } | |
1833 LOWORD(v19) = v18[k].uAnimTime + v19; | |
1834 } | |
1835 ++k; | |
1836 } | |
1837 return 1; | |
1838 } | |
1839 | |
1840 //----- (00495366) -------------------------------------------------------- | |
1841 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
1842 { | |
1843 int v2; // edi@1 | |
1844 int v3; // edx@2 | |
1845 int v4; // esi@3 | |
1846 int v5; // ebx@5 | |
1847 signed int v7; // [sp+Ch] [bp-14h]@1 | |
1848 signed int v8; // [sp+10h] [bp-10h]@1 | |
1849 int **v9; // [sp+14h] [bp-Ch]@4 | |
1850 signed int v10; // [sp+18h] [bp-8h]@3 | |
1851 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
1852 | |
1853 v2 = a1; | |
1854 v11 = a2; | |
1855 v8 = 0; | |
1856 v7 = 0; | |
1857 if ( dword_AE336C == a1 ) | |
1858 { | |
1859 v3 = dword_AE3370; | |
1860 } | |
1861 else | |
1862 { | |
1863 v4 = a2; | |
1864 dword_AE336C = a1; | |
1865 v10 = 0; | |
1866 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
1419 | 1867 { |
1868 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1869 } | |
1870 else | |
1871 { | |
0 | 1872 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); |
1873 do | |
1874 { | |
1875 v5 = tolower(*(char *)*v9); | |
1876 if ( v5 == tolower(v2) ) | |
1877 { | |
1878 if ( v8 ) | |
1879 v7 = v10; | |
1880 else | |
1881 v8 = v10; | |
1882 } | |
1883 ++v10; | |
1884 v9 += 2; | |
1885 } | |
1886 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
1887 if ( v8 && v8 != v7 ) | |
1888 v3 = v8 + rand() % (v7 - v8); | |
1889 else | |
1890 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1419 | 1891 } |
0 | 1892 } |
1893 dword_AE3370 = v3; | |
1894 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
1895 } | |
1459 | 1896 |
0 | 1897 |
1898 //----- (00495430) -------------------------------------------------------- | |
607 | 1899 char * GetReputationString( signed int a1 ) |
1900 { | |
566 | 1901 if (a1 >= 25) |
1902 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
1903 else if (a1 >= 6) | |
1904 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
1905 else if (a1 >= -5) | |
1906 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
1907 else if (a1 >= -24) | |
1908 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 1909 else |
566 | 1910 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 1911 } |
1912 | |
1913 //----- (00495461) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1914 char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 1915 { |
1916 Player *pPlayer; // ebx@3 | |
1453 | 1917 char *pText; // esi@7 |
0 | 1918 int v17; // eax@10 |
1919 signed __int64 v18; // qax@18 | |
1920 unsigned __int8 *v20; // ebx@32 | |
1921 int v21; // ecx@34 | |
1453 | 1922 int pReputation; // eax@45 |
0 | 1923 int v29; // eax@68 |
1924 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 1925 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
0 | 1926 char a1[100]; // [sp+B8h] [bp-80h]@3 |
1927 int v63; // [sp+12Ch] [bp-Ch]@32 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1928 |
1453 | 1929 if ( IsBadStringPtrA(lpsz, 1) ) |
0 | 1930 return "Invalid String Passed"; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1931 |
0 | 1932 a1[0] = 0; |
1453 | 1933 pPlayer = &pParty->pPlayers[uPlayerID]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1934 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1935 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1936 NPCData *npc = nullptr; |
0 | 1937 if ( dword_5C35D4 ) |
1211 | 1938 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1939 else |
602 | 1940 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1941 |
1453 | 1942 //pText = a4; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1943 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1944 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1945 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1946 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1947 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1948 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1949 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1950 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1951 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1952 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1953 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1954 { |
1453 | 1955 case 1://Ïîäðîáíåå |
1956 strcat(pTmpBuf2.data(), npc->pName); | |
1957 dst = strlen(pTmpBuf2.data()); | |
1958 i += 2; | |
1959 break; | |
1960 case 2: | |
1961 strcat(pTmpBuf2.data(), pPlayer->pName); | |
1962 dst = strlen(pTmpBuf2.data()); | |
1963 i += 2; | |
1964 break; | |
1965 case 3: | |
1966 case 4: | |
1967 strcat(pTmpBuf2.data(), a1); | |
1968 dst = strlen(pTmpBuf2.data()); | |
1969 i += 2; | |
1970 break; | |
1971 case 5: | |
1972 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
1973 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
1974 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
1975 { | |
1976 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) | |
0 | 1977 { |
1453 | 1978 if ( v18 < 20 ) |
1979 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
0 | 1980 } |
1981 else | |
1982 { | |
1453 | 1983 pText = pGlobalTXT_LocalizationStrings[395];// "morning" |
1984 } | |
1985 } | |
1986 strcat(pTmpBuf2.data(), pText); | |
1987 dst = strlen(pTmpBuf2.data()); | |
1988 i += 2; | |
1989 break; | |
1990 case 6: | |
1991 if ( pPlayer->uSex ) | |
1992 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
1993 else | |
1994 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
1995 strcat(pTmpBuf2.data(), pText); | |
1996 dst = strlen(pTmpBuf2.data()); | |
1997 i += 2; | |
1998 break; | |
1999 case 7: | |
2000 if ( pPlayer->uSex ) | |
2001 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
2002 else | |
2003 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
2004 strcat(pTmpBuf2.data(), pText); | |
2005 dst = strlen(pTmpBuf2.data()); | |
2006 i += 2; | |
2007 break; | |
2008 case 8: | |
2009 v63 = 0; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
2010 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
2011 for ( uint _i = 0; _i < 28; ++_i ) |
1453 | 2012 { |
2013 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) | |
2014 { | |
2015 v21 = v63; | |
2016 ++v63; | |
2017 v55[v63] = word_4EE150[i]; | |
2018 } | |
2019 } | |
2020 if ( v63 ) | |
2021 { | |
2022 if ( dword_A74CDC == -1 ) | |
2023 dword_A74CDC = rand() % v63; | |
2024 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
2025 } | |
2026 else | |
2027 pText = (char *)pNPCTopics[55].pText; | |
2028 strcat(pTmpBuf2.data(), pText); | |
2029 dst = strlen(pTmpBuf2.data()); | |
2030 i += 2; | |
2031 break; | |
2032 case 9: | |
2033 if ( npc->uSex ) | |
2034 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
2035 else | |
2036 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
2037 strcat(pTmpBuf2.data(), pText); | |
2038 dst = strlen(pTmpBuf2.data()); | |
2039 i += 2; | |
2040 break; | |
2041 case 10: | |
2042 if ( pPlayer->uSex ) | |
2043 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
2044 else | |
2045 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
2046 strcat(pTmpBuf2.data(), pText); | |
2047 dst = strlen(pTmpBuf2.data()); | |
2048 i += 2; | |
2049 break; | |
2050 case 11: | |
2051 pReputation = GetPartyReputation(); | |
2052 if ( pReputation >= 25 ) | |
2053 pText = pGlobalTXT_LocalizationStrings[379]; | |
2054 else//v25 < 25 | |
2055 { | |
2056 if ( pReputation < 6 ) | |
2057 { | |
2058 if ( pReputation >= -5 )//6 >= v25 >= -5 | |
2059 pText = pGlobalTXT_LocalizationStrings[399]; | |
2060 else// v25 < -5 | |
0 | 2061 { |
1453 | 2062 if ( pReputation < -24 )//-24 > v25 |
2063 pText = pGlobalTXT_LocalizationStrings[434]; | |
2064 else// -5 > v25 > -24 | |
2065 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 2066 } |
1453 | 2067 } |
2068 else//25 > v25 > 6 | |
2069 pText = pGlobalTXT_LocalizationStrings[392]; | |
2070 } | |
2071 strcat(pTmpBuf2.data(), pText); | |
2072 dst = strlen(pTmpBuf2.data()); | |
2073 i += 2; | |
2074 break; | |
2075 case 12: | |
2076 pReputation = npc->rep; | |
2077 if ( pReputation >= 25 ) | |
2078 pText = pGlobalTXT_LocalizationStrings[379]; | |
2079 else | |
2080 { | |
2081 if ( pReputation < 6 ) | |
2082 { | |
2083 if ( pReputation >= -5 ) | |
2084 pText = pGlobalTXT_LocalizationStrings[399]; | |
0 | 2085 else |
2086 { | |
1453 | 2087 if ( pReputation < -24 ) |
2088 pText = pGlobalTXT_LocalizationStrings[434]; | |
2089 else | |
2090 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 2091 } |
2092 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2093 else |
1453 | 2094 pText = pGlobalTXT_LocalizationStrings[392]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2095 } |
1453 | 2096 strcat(pTmpBuf2.data(), pText); |
2097 dst = strlen(pTmpBuf2.data()); | |
2098 i += 2; | |
2099 break; | |
2100 case 13: | |
2101 strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); | |
2102 dst = strlen(pTmpBuf2.data()); | |
2103 i += 2; | |
2104 break; | |
2105 case 14: | |
2106 if ( npc->uSex ) | |
2107 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
2108 else | |
2109 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
2110 strcat(pTmpBuf2.data(), pText); | |
2111 dst = strlen(pTmpBuf2.data()); | |
2112 i += 2; | |
2113 break; | |
2114 case 15: | |
2115 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
2116 dst = strlen(pTmpBuf2.data()); | |
2117 i += 2; | |
2118 break; | |
2119 case 16: | |
2120 if ( npc->uSex ) | |
2121 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
2122 else | |
2123 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
2124 strcat(pTmpBuf2.data(), pText); | |
2125 dst = strlen(pTmpBuf2.data()); | |
2126 i += 2; | |
2127 break; | |
2128 case 17://òåêñò íà¸ìíîãî ÍÏÑ | |
2129 { | |
2130 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; | |
2131 if ( !pay_percentage ) | |
2132 pay_percentage = 1; | |
2133 sprintf(a1, "%lu", pay_percentage); | |
2134 strcat(pTmpBuf2.data(), a1); | |
2135 dst = strlen(pTmpBuf2.data()); | |
2136 i += 2; | |
2137 break; | |
2138 } | |
2139 case 18: | |
2140 case 19: | |
2141 case 20: | |
2142 case 21: | |
2143 case 22: | |
2144 case 26: | |
2145 strncpy(a1, lpsz + i + 1, 2); | |
2146 sprintf(a1, "%lu", atoi(a1)); | |
2147 strcat(pTmpBuf2.data(), a1); | |
2148 dst = strlen(pTmpBuf2.data()); | |
2149 i += 2; | |
2150 break; | |
2151 case 23: | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
2152 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
2153 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName; |
1453 | 2154 else |
2155 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
2156 strcat(pTmpBuf2.data(), pText); | |
2157 dst = strlen(pTmpBuf2.data()); | |
2158 i += 2; | |
2159 break; | |
2160 case 24://íàçâàíèå òîâàðà â ïðîäàæå | |
2161 sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); | |
2162 strcat(pTmpBuf2.data(), a1); | |
2163 dst = strlen(pTmpBuf2.data()); | |
2164 i += 2; | |
2165 break; | |
2166 case 25: | |
2167 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
0 | 2168 switch ( a5 ) |
1453 | 2169 { |
2170 case 3: | |
2171 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2172 break; | |
2173 case 4: | |
2174 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2175 break; | |
2176 case 5: | |
2177 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2178 break; | |
2179 case 6: | |
2180 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
2181 break; | |
2182 } | |
2183 sprintfex(a1, "%lu", v29); | |
2184 strcat(pTmpBuf2.data(), a1); | |
2185 dst = strlen(pTmpBuf2.data()); | |
2186 i += 2; | |
2187 break; | |
2188 case 27://òåêñò ïðîäàæè | |
2189 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2190 if ( a5 == 3 ) | |
2191 { | |
2192 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2193 if (a3->Broken()) | |
2194 v29 = 1; | |
2195 sprintfex(a1, "%lu", v29); | |
2196 strcat(pTmpBuf2.data(), a1); | |
2197 dst = strlen(pTmpBuf2.data()); | |
2198 i += 2; | |
0 | 2199 break; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2200 } |
1453 | 2201 if ( a5 != 4 ) |
0 | 2202 { |
1453 | 2203 if ( a5 == 5 ) |
2204 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2205 else | |
2206 { | |
2207 if ( a5 == 6 ) | |
2208 { | |
2209 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
2210 if (a3->Broken()) | |
2211 v29 = 1; | |
2212 if (!v29) | |
2213 v29 = 1; | |
2214 sprintfex(a1, "%lu", v29); | |
2215 strcat(pTmpBuf2.data(), a1); | |
2216 dst = strlen(pTmpBuf2.data()); | |
2217 i += 2; | |
2218 break; | |
2219 } | |
2220 } | |
2221 sprintfex(a1, "%lu", v29); | |
2222 strcat(pTmpBuf2.data(), a1); | |
2223 dst = strlen(pTmpBuf2.data()); | |
2224 i += 2; | |
2225 break; | |
0 | 2226 } |
1453 | 2227 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
2228 strcat(pTmpBuf2.data(), a1); | |
2229 dst = strlen(pTmpBuf2.data()); | |
2230 i += 2; | |
2231 break; | |
2232 case 28://ïðîôåññèÿ | |
2233 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
2234 dst = strlen(pTmpBuf2.data()); | |
2235 i += 2; | |
2236 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2237 case 29: |
1453 | 2238 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
2239 strcat(pTmpBuf2.data(), a1); | |
2240 dst = strlen(pTmpBuf2.data()); | |
2241 i += 2; | |
2242 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2243 case 30: |
1453 | 2244 if ( !a6 ) |
2245 { | |
2246 strcat(pTmpBuf2.data(), a4); | |
2247 dst = strlen(pTmpBuf2.data()); | |
2248 i += 2; | |
2249 break; | |
2250 } | |
1459 | 2251 init_summoned_item(&v56, *a6); |
1453 | 2252 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
2253 strcat(pTmpBuf2.data(), a1); | |
2254 dst = strlen(pTmpBuf2.data()); | |
2255 i += 2; | |
2256 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2257 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2258 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2259 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2260 case 34: |
1453 | 2261 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); |
2262 dst = strlen(pTmpBuf2.data()); | |
2263 i += 2; | |
2264 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2265 default: |
0 | 2266 if ( v17 <= 50 || v17 > 70 ) |
1453 | 2267 { |
2268 strncpy(a1, lpsz + i + 1, 2); | |
2269 sprintf(a1, "%lu", atoi(a1)); | |
2270 strcat(pTmpBuf2.data(), a1); | |
2271 dst = strlen(pTmpBuf2.data()); | |
2272 i += 2; | |
2273 break; | |
2274 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2275 if ( v17 - 51 >= 20 ) |
1453 | 2276 { |
2277 strcat(pTmpBuf2.data(), a4); | |
2278 dst = strlen(pTmpBuf2.data()); | |
2279 i += 2; | |
2280 break; | |
2281 } | |
1459 | 2282 init_summoned_item(&v56, pParty->field_3C._s_times[v17-51]); |
1453 | 2283 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
2284 strcat(pTmpBuf2.data(), a1); | |
2285 dst = strlen(pTmpBuf2.data()); | |
2286 i += 2; | |
2287 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2288 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2289 } |
0 | 2290 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2291 return pTmpBuf2.data(); |
0 | 2292 } |
2293 | |
2294 //----- (0049B04D) -------------------------------------------------------- | |
734 | 2295 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 2296 { |
734 | 2297 //stru154 *v3; // edi@1 |
2298 //signed int v4; // eax@1 | |
2299 //signed int result; // eax@9 | |
2300 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 2301 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 2302 float v7; |
0 | 2303 |
2304 v.x = 0.0; | |
2305 v.y = 0.0; | |
2306 v.z = 0.0; | |
734 | 2307 GetFacePlane(a2, a3, &v, &v7); |
2308 | |
2309 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
2310 polygonType = POLYGON_VerticalWall; | |
2311 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
2312 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
2313 polygonType = POLYGON_Floor; | |
0 | 2314 else |
734 | 2315 polygonType = POLYGON_InBetweenFloorAndWall; |
2316 | |
2317 face_plane.vNormal.x = v.x; | |
2318 face_plane.vNormal.y = v.y; | |
2319 face_plane.vNormal.z = v.z; | |
2320 face_plane.dist = v7; | |
0 | 2321 } |
2322 | |
2323 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 2324 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 2325 { |
734 | 2326 if (fabsf(pNormal->z) < 1e-6f) |
2327 polygonType = POLYGON_VerticalWall; | |
2328 else if (fabsf(pNormal->x) < 1e-6f && | |
2329 fabsf(pNormal->y) < 1e-6f) | |
2330 polygonType = POLYGON_Floor; | |
0 | 2331 else |
734 | 2332 polygonType = POLYGON_InBetweenFloorAndWall; |
2333 | |
2334 face_plane.vNormal.x = pNormal->x; | |
2335 face_plane.dist = dist; | |
2336 face_plane.vNormal.y = pNormal->y; | |
2337 face_plane.vNormal.z = pNormal->z; | |
0 | 2338 } |
2339 | |
2340 //----- (0049B13D) -------------------------------------------------------- | |
734 | 2341 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 2342 { |
2343 ODMFace *v5; // ebx@1 | |
734 | 2344 //int v6; // eax@1 |
2345 //unsigned __int16 *v7; // ebx@2 | |
2346 //Vec3_int_ *v8; // eax@3 | |
0 | 2347 Vec3_int_ *v9; // ecx@3 |
734 | 2348 //double v10; // st7@3 |
2349 //int v11; // ecx@3 | |
0 | 2350 Vec3_int_ *v12; // ecx@3 |
734 | 2351 //double v13; // st7@3 |
2352 //double v14; // st6@3 | |
2353 //double v15; // st5@3 | |
2354 //int v16; // ecx@3 | |
0 | 2355 Vec3_int_ *v17; // eax@3 |
734 | 2356 //double v18; // st5@3 |
0 | 2357 Vec3_float_ *v19; // eax@3 |
734 | 2358 //int result; // eax@8 |
2359 //float v21; // ecx@10 | |
2360 //double v22; // st7@10 | |
2361 //double v23; // st6@10 | |
0 | 2362 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 2363 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 2364 float v26; // [sp+1Ch] [bp-4Ch]@3 |
2365 float v27; // [sp+20h] [bp-48h]@3 | |
2366 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 2367 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
2368 //float v30; // [sp+30h] [bp-38h]@3 | |
2369 //float v31; // [sp+34h] [bp-34h]@3 | |
2370 //float v32; // [sp+38h] [bp-30h]@3 | |
2371 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 2372 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 2373 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
2374 //float v36; // [sp+50h] [bp-18h]@3 | |
2375 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 2376 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 2377 //int v39; // [sp+64h] [bp-4h]@1 |
2378 | |
2379 //v39 = 0; | |
0 | 2380 v1.x = 0.0; |
2381 v5 = pFace; | |
734 | 2382 //v6 = pFace->uNumVertices; |
0 | 2383 v1.y = 0.0; |
2384 v1.z = 0.0; | |
734 | 2385 |
2386 if (pFace->uNumVertices >= 2) | |
2387 { | |
2388 int i = 0; | |
2389 while ( i < pFace->uNumVertices - 2 ) | |
2390 { | |
2391 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
2392 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
2393 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 2394 i++; |
734 | 2395 v1.x = v12->x - v9->x; |
2396 v26 = v17->x - v12->x; | |
2397 v1.y = v12->y - v9->y; | |
2398 v27 = v17->y - v12->y; | |
2399 v1.z = v12->z - v9->z; | |
2400 v28 = v17->z - v12->z; | |
0 | 2401 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
2402 v38.x = v19->x; | |
2403 v38.y = v19->y; | |
2404 v38.z = v19->z; | |
734 | 2405 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
2406 { | |
2407 v38.Normalize(); | |
2408 | |
2409 pOutNormal->x = v38.x; | |
2410 pOutNormal->y = v38.y; | |
2411 pOutNormal->z = v38.z; | |
2412 | |
2413 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
2414 return; | |
2415 } | |
2416 } | |
2417 } | |
2418 | |
2419 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
2420 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
2421 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
2422 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 2423 } |
2424 | |
2425 //----- (0049D700) -------------------------------------------------------- | |
2426 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
2427 { | |
2428 unsigned int v1; // eax@1 | |
2429 int v2; // ecx@1 | |
2430 unsigned int v3; // eax@1 | |
2431 | |
2432 v1 = uDim; | |
2433 v2 = 0; | |
2434 v3 = v1 - 1; | |
2435 while ( v3 & 1 ) | |
2436 { | |
2437 v3 >>= 1; | |
2438 ++v2; | |
2439 } | |
2440 return v3 == 0 ? v2 : 0; | |
2441 } | |
2442 | |
2443 //----- (004A19D8) -------------------------------------------------------- | |
737 | 2444 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 2445 { |
737 | 2446 /*signed __int64 v2; // ST10_8@1 |
0 | 2447 double v3; // st7@1 |
2448 float v4; // ST24_4@1 | |
2449 double v5; // ST10_8@1 | |
2450 int v6; // ST1C_4@1 | |
2451 float v7; // ST24_4@1 | |
2452 double v8; // ST10_8@1 | |
2453 unsigned __int8 v9; // ST20_1@1 | |
2454 float v10; // ST24_4@1 | |
2455 double v11; // ST10_8@1 | |
2456 float v12; // ST24_4@1 | |
737 | 2457 double v13; // ST08_8@1*/ |
2458 | |
2459 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
2460 (a2 >> 24) / 255.0f * 255.0f), | |
2461 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
2462 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
2463 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
2464 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
2465 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
2466 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
2467 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
2468 /*v2 = a1 >> 24; | |
2469 v3 = (double)v2 / 255.0f; | |
2470 HIDWORD(v2) = 0; | |
0 | 2471 LODWORD(v2) = a2 >> 24; |
737 | 2472 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 2473 v5 = v4 + 6.7553994e15; |
2474 v6 = LODWORD(v5); | |
737 | 2475 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 2476 v8 = v7 + 6.7553994e15; |
2477 v9 = LOBYTE(v8); | |
737 | 2478 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 2479 v11 = v10 + 6.7553994e15; |
737 | 2480 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 2481 v13 = v12 + 6.7553994e15; |
737 | 2482 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 2483 } |
2484 | |
2485 //----- (004A46E6) -------------------------------------------------------- | |
2486 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
2487 { | |
2488 int v5; // eax@1 | |
2489 int z; // eax@1 | |
2490 unsigned int v7; // eax@9 | |
2491 unsigned int v8; // ecx@9 | |
2492 int v9; // eax@9 | |
2493 unsigned int v10; // eax@10 | |
2494 int *v11; // esi@10 | |
2495 int *v12; // edi@10 | |
2496 int v13; // ecx@10 | |
2497 int v14; // edx@10 | |
2498 unsigned int v15; // eax@22 | |
2499 int *v16; // esi@22 | |
2500 int *v17; // edi@22 | |
2501 int v18; // ecx@22 | |
2502 int v19; // edx@22 | |
2503 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
2504 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
2505 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
2506 signed int v23; // [sp+20h] [bp+Ch]@1 | |
2507 | |
2508 v5 = a4; | |
2509 v23 = _z >> 16; | |
2510 z = x + v5; | |
693 | 2511 if ( z >= (signed int)pViewport->uViewportTL_X |
2512 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
2513 && y >= (signed int)pViewport->uViewportTL_Y | |
2514 && y <= (signed int)pViewport->uViewportBR_Y ) | |
2515 { | |
2516 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
2517 x = pViewport->uViewportTL_X; | |
2518 if ( z > (signed int)pViewport->uViewportBR_X ) | |
2519 z = pViewport->uViewportBR_X; | |
0 | 2520 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
2521 v22 = z - x; | |
2522 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
2523 v7 = lightColor >> 3; | |
2524 v8 = lightColor & 0xF0; | |
2525 v9 = v7 & 0x1E0000; | |
2526 if ( pRenderer->uTargetGBits == 5 ) | |
2527 { | |
2528 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
2529 v11 = (int *)pTarget; | |
2530 v12 = pTargetZ; | |
2531 v13 = v22; | |
2532 v14 = (v10 << 16) | v10; | |
2533 z = (unsigned __int8)pTarget & 2; | |
2534 if ( (unsigned __int8)pTarget & 2 ) | |
2535 { | |
2536 z = (unsigned int)*pTargetZ >> 16; | |
2537 if ( z > v23 ) | |
2538 { | |
2539 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
2540 *pTarget = z; | |
2541 } | |
2542 v13 = v22 - 1; | |
2543 v11 = (int *)(pTarget + 1); | |
2544 v12 = pTargetZ + 1; | |
2545 } | |
2546 while ( v13 != 1 ) | |
2547 { | |
2548 if ( v13 < 1 ) | |
2549 return z; | |
2550 z = (unsigned int)*v12 >> 16; | |
2551 if ( z <= v23 ) | |
2552 { | |
2553 v13 -= 2; | |
2554 ++v11; | |
2555 v12 += 2; | |
2556 } | |
2557 else | |
2558 { | |
2559 v12 += 2; | |
2560 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
2561 v13 -= 2; | |
2562 *v11 = z; | |
2563 ++v11; | |
2564 } | |
2565 } | |
2566 z = (unsigned int)*v12 >> 16; | |
2567 if ( z > v23 ) | |
2568 { | |
2569 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
2570 *(short *)v11 = z; | |
2571 } | |
2572 } | |
2573 else | |
2574 { | |
2575 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
2576 v16 = (int *)pTarget; | |
2577 v17 = pTargetZ; | |
2578 v18 = v22; | |
2579 v19 = (v15 << 16) | v15; | |
2580 z = (unsigned __int8)pTarget & 2; | |
2581 if ( (unsigned __int8)pTarget & 2 ) | |
2582 { | |
2583 z = (unsigned int)*pTargetZ >> 16; | |
2584 if ( z > v23 ) | |
2585 { | |
2586 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
2587 *pTarget = z; | |
2588 } | |
2589 v18 = v22 - 1; | |
2590 v16 = (int *)(pTarget + 1); | |
2591 v17 = pTargetZ + 1; | |
2592 } | |
2593 while ( v18 != 1 ) | |
2594 { | |
2595 if ( v18 < 1 ) | |
2596 return z; | |
2597 z = (unsigned int)*v17 >> 16; | |
2598 if ( z <= v23 ) | |
2599 { | |
2600 v18 -= 2; | |
2601 ++v16; | |
2602 v17 += 2; | |
2603 } | |
2604 else | |
2605 { | |
2606 v17 += 2; | |
2607 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
2608 v18 -= 2; | |
2609 *v16 = z; | |
2610 ++v16; | |
2611 } | |
2612 } | |
2613 z = (unsigned int)*v17 >> 16; | |
2614 if ( z > v23 ) | |
2615 { | |
2616 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
2617 *(short *)v16 = z; | |
2618 } | |
2619 } | |
2620 } | |
2621 return z; | |
2622 } | |
2623 | |
2624 //----- (004A57E9) -------------------------------------------------------- | |
1458 | 2625 void Present_ColorKey() |
0 | 2626 { |
2627 HRESULT v0; // eax@3 | |
2628 HRESULT v1; // eax@3 | |
2629 HRESULT v2; // eax@3 | |
2630 HRESULT v3; // eax@3 | |
2631 HRESULT v4; // eax@3 | |
2632 RECT a2; // [sp+4h] [bp-14h]@3 | |
2633 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
2634 | |
2635 if ( !pRenderer->uNumSceneBegins ) | |
2636 { | |
2637 if ( pRenderer->field_40110 ) | |
2638 { | |
693 | 2639 a2.bottom = pViewport->uViewportTL_Y; |
0 | 2640 a2.left = 0; |
2641 a2.top = 0; | |
2642 a2.right = 640; | |
2643 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
2644 a2.right = 640; | |
2645 a2.left = 0; | |
693 | 2646 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 2647 a2.bottom = 480; |
2648 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
2649 0, | |
693 | 2650 pViewport->uViewportBR_Y + 1, |
0 | 2651 pRenderer->pColorKeySurface4, |
2652 &a2, | |
2653 16u)); | |
693 | 2654 a2.right = pViewport->uViewportTL_X; |
2655 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 2656 a2.left = 0; |
693 | 2657 a2.top = pViewport->uViewportTL_Y; |
0 | 2658 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
2659 0, | |
693 | 2660 pViewport->uViewportTL_Y, |
0 | 2661 pRenderer->pColorKeySurface4, |
2662 &a2, | |
2663 16u)); | |
693 | 2664 a2.left = pViewport->uViewportBR_X; |
2665 a2.top = pViewport->uViewportTL_Y; | |
0 | 2666 a2.right = 640; |
693 | 2667 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 2668 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2669 pViewport->uViewportBR_X, |
2670 pViewport->uViewportTL_Y, | |
0 | 2671 pRenderer->pColorKeySurface4, |
2672 &a2, | |
2673 16u)); | |
693 | 2674 a2.right = pViewport->uViewportBR_X; |
2675 a2.bottom = pViewport->uViewportBR_Y + 1; | |
2676 a2.left = pViewport->uViewportTL_X; | |
2677 a2.top = pViewport->uViewportTL_Y; | |
0 | 2678 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2679 pViewport->uViewportTL_X, |
2680 pViewport->uViewportTL_Y, | |
0 | 2681 pRenderer->pColorKeySurface4, |
2682 &a2, | |
2683 17u)); | |
2684 } | |
2685 } | |
2686 } | |
2687 | |
2688 //----- (004A597D) -------------------------------------------------------- | |
2689 void Present_NoColorKey() | |
2690 { | |
2691 //unsigned __int16 *v0; // eax@4 | |
2692 unsigned __int16 *v1; // esi@4 | |
2693 void *v2; // edi@4 | |
2694 //signed int v4; // ebx@4 | |
2695 //signed int v5; // ebx@6 | |
2696 //void *v6; // edi@7 | |
2697 //const void *v7; // esi@7 | |
2698 signed int v8; // ebx@8 | |
2699 int v9; // eax@10 | |
2700 unsigned int v10; // esi@10 | |
2701 unsigned __int32 v11; // edi@10 | |
2702 //int v12; // ecx@10 | |
2703 unsigned int v13; // ebx@10 | |
2704 int v14; // eax@11 | |
2705 int v15; // eax@13 | |
2706 int v16; // eax@14 | |
2707 int v17; // eax@16 | |
2708 HRESULT v18; // eax@22 | |
2709 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
2710 int v20; // [sp+88h] [bp-1Ch]@10 | |
2711 int v21; // [sp+8Ch] [bp-18h]@10 | |
2712 __int32 v22; // [sp+90h] [bp-14h]@10 | |
2713 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
2714 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
2715 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
2716 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
2717 | |
2718 if ( !pRenderer->uNumSceneBegins ) | |
2719 { | |
2720 if ( pRenderer->field_40110 ) | |
2721 { | |
2722 memset(&Dst, 0, 0x7Cu); | |
2723 Dst.dwSize = 124; | |
168 | 2724 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2725 { |
2726 //v26 = Dst.lpSurface; | |
2727 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
2728 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
2729 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
2730 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
2731 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
2732 v1 = pRenderer->pTargetSurface; | |
2733 v2 = Dst.lpSurface; | |
2734 | |
2735 | |
2736 /*for (uint y = 0; y < 480; ++y) | |
2737 { | |
2738 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
2739 for (uint x = 0; x < 640; ++x) | |
2740 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
2741 }*/ | |
2742 | |
2743 auto pSrc = pRenderer->pTargetSurface; | |
2744 auto pDst = (__int16 *)Dst.lpSurface; | |
2745 | |
2746 for (uint y = 0; y < 8; ++y) | |
2747 memcpy(pDst + y * Dst.lPitch / 2, | |
2748 | |
2749 pSrc + y * 640, 640 * sizeof(__int16)); | |
2750 | |
2751 for (uint y = 8; y < 352; ++y) | |
2752 { | |
2753 memcpy(pDst + y * Dst.lPitch / 2, | |
2754 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 2755 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
2756 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 2757 } |
2758 | |
121 | 2759 for (uint y = 352; y < 480; ++y) |
0 | 2760 memcpy(pDst + y * Dst.lPitch / 2, |
2761 pSrc + y * 640, 640 * sizeof(__int16)); | |
2762 | |
2763 | |
693 | 2764 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2765 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 2766 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2767 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 2768 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 2769 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
2770 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
2771 v21 = 4 * v9 + 1280; | |
2772 | |
121 | 2773 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 2774 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
2775 v10 = (int)pSrc_x1y1; | |
2776 v11 = (int)pDst_x1y1; | |
693 | 2777 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 2778 v13 = v24; |
2779 | |
693 | 2780 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 2781 { |
2782 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
2783 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 2784 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 2785 { |
2786 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
2787 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
2788 } | |
2789 } | |
2790 | |
2791 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2792 | |
2793 /* while ( 1 ) | |
2794 { | |
2795 while ( 1 ) | |
2796 { | |
2797 v14 = *(int *)v10; | |
2798 v10 += 4; | |
2799 if ( v14 == v13 ) | |
2800 break; | |
2801 if ( (short)v14 == (short)v13 ) | |
2802 { | |
2803 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
2804 v11 += 4; | |
2805 --uHalfWidth; | |
2806 if ( !uHalfWidth ) | |
2807 goto LABEL_21; | |
2808 } | |
2809 else | |
2810 { | |
2811 v15 = __ROL__(v14, 16); | |
2812 if ( (short)v15 == (short)v13 ) | |
2813 { | |
2814 v17 = __ROR__(v15, 16); | |
2815 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
2816 v11 += 4; | |
2817 --uHalfWidth; | |
2818 if ( !uHalfWidth ) | |
2819 goto LABEL_21; | |
2820 } | |
2821 else | |
2822 { | |
2823 v16 = __ROR__(v15, 16); | |
2824 *(int *)v11 = v16; | |
2825 v11 += 4; | |
2826 --uHalfWidth; | |
2827 if ( !uHalfWidth ) | |
2828 goto LABEL_21; | |
2829 } | |
2830 } | |
2831 } | |
2832 v11 += 4; | |
2833 --uHalfWidth; | |
2834 if ( !uHalfWidth ) | |
2835 { | |
2836 LABEL_21: | |
2837 v10 += v21; | |
2838 v11 += v22; | |
2839 uHalfWidth = v20; | |
2840 if ( !--uNumLines ) | |
2841 { | |
2842 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2843 return; | |
2844 } | |
2845 } | |
2846 }*/ | |
2847 } | |
2848 } | |
2849 } | |
2850 } | |
2851 | |
2852 //----- (004A7063) -------------------------------------------------------- | |
1390 | 2853 unsigned int ModulateColor(unsigned int diffuse, float multiplier) |
0 | 2854 { |
1390 | 2855 float alpha = multiplier * ((diffuse >> 24) & 0xFF); |
2856 int a = (int)floorf(alpha + 0.5f); | |
2857 a = max(0, min(255, a)); | |
2858 | |
2859 float red = multiplier * ((diffuse >> 16) & 0xFF); | |
2860 int r = (int)floorf(red + 0.5f); | |
2861 r = max(0, min(255, r)); | |
2862 | |
2863 float green = multiplier * ((diffuse >> 8) & 0xFF); | |
2864 int g = (int)floorf(green + 0.5f); | |
2865 g = max(0, min(255, g)); | |
2866 | |
2867 float blue = multiplier * ((diffuse >> 0) & 0xFF); | |
2868 int b = (int)floorf(blue + 0.5f); | |
2869 b = max(0, min(255, b)); | |
2870 | |
2871 return (a << 24) | (r << 16) | (g << 8) | b; | |
0 | 2872 } |
2873 | |
2874 | |
2875 | |
2876 //----- (004B1447) -------------------------------------------------------- | |
2877 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
2878 { | |
2879 signed int v3; // esi@1 | |
2880 char v4; // sf@8 | |
2881 int v5; // eax@8 | |
2882 unsigned __int64 v6; // qax@12 | |
2883 DDM_DLV_Header *v7; // eax@14 | |
2884 Player **v8; // edi@18 | |
2885 Player *result; // eax@19 | |
735 | 2886 //char *v10; // esi@20 |
0 | 2887 |
2888 v3 = 0; | |
2889 if ( a2 ) | |
2890 { | |
2891 if ( a2 != 1 ) | |
2892 { | |
2893 if ( a2 == 2 ) | |
2894 v3 = 2; | |
2895 goto LABEL_13; | |
2896 } | |
2897 v3 = 2; | |
2898 } | |
2899 else | |
2900 { | |
2901 v3 = 1; | |
2902 } | |
2903 if ( pParty->uFine < 4000000 ) | |
2904 { | |
2905 v4 = a3 + pParty->uFine < 0; | |
2906 v5 = a3 + pParty->uFine; | |
2907 pParty->uFine += a3; | |
2908 if ( v4 ) | |
2909 { | |
2910 v5 = 0; | |
2911 pParty->uFine = 0; | |
2912 } | |
2913 if ( v5 > 4000000 ) | |
2914 pParty->uFine = 4000000; | |
2915 } | |
487 | 2916 |
2917 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
2918 | |
0 | 2919 LABEL_13: |
463 | 2920 pParty->InTheShopFlags[a1] = 1; |
0 | 2921 if ( v3 ) |
2922 { | |
2923 v7 = &pOutdoor->ddm; | |
2924 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2925 v7 = &pIndoor->dlv; | |
2926 v7->uReputation += v3; | |
2927 if ( v7->uReputation > 10000 ) | |
2928 v7->uReputation = 10000; | |
2929 } | |
2930 v8 = &pPlayers[1]; | |
2931 do | |
2932 { | |
2933 result = *v8; | |
2934 if ( pParty->uFine ) | |
2935 { | |
735 | 2936 //v10 = result->_guilds_member_bits; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
2937 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1); |
0 | 2938 if ( !(short)result ) |
735 | 2939 __debugbreak(); |
501 | 2940 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 2941 } |
2942 ++v8; | |
2943 } | |
2944 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
2945 return result; | |
2946 } | |
2947 | |
2948 //----- (004B1523) -------------------------------------------------------- | |
1458 | 2949 void sub_4B1523(int *_this) |
0 | 2950 { |
2951 int v1; // esi@1 | |
2952 int v2; // edx@1 | |
2953 unsigned int v3; // eax@2 | |
2954 int v4; // eax@4 | |
2955 LONG v5; // ecx@4 | |
2956 int v6; // eax@10 | |
2957 char *v7; // ST44_4@12 | |
2958 unsigned __int16 v8; // ax@12 | |
2959 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
2960 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
2961 POINT a2; // [sp+64h] [bp-10h]@1 | |
2962 int v13; // [sp+6Ch] [bp-8h]@4 | |
2963 int v14; // [sp+70h] [bp-4h]@4 | |
2964 | |
2965 v1 = *_this - 399; | |
2966 v2 = (*_this - 400) % 11 + 1; | |
2967 v11 = 4 * (*_this - 400) / 11; | |
1312 | 2968 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used |
0 | 2969 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
2970 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
2971 else | |
2972 v3 = 30; | |
2973 a1.Hint = 0; | |
2974 a1.uFrameY = v3; | |
2975 a1.uFrameWidth = 328; | |
2976 a1.uFrameHeight = 68; | |
2977 a1.uFrameX = 90; | |
2978 a1.uFrameZ = 417; | |
2979 a1.uFrameW = v3 + 67; | |
2980 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
2981 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
2982 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
2983 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
2984 v5 = a2.y; | |
2985 if ( v14 > a2.y ) | |
2986 v5 = v14; | |
2987 if ( v13 > v5 ) | |
2988 v5 = v13; | |
2989 if ( v4 > v5 ) | |
2990 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2991 sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", |
262 | 2992 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
2993 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
2994 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
2995 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
2996 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2997 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 2998 a1.uFrameHeight += v6; |
2999 if ( (signed int)a1.uFrameHeight < 150 ) | |
3000 a1.uFrameHeight = 150; | |
819 | 3001 a1.uFrameWidth = game_viewport_width; |
0 | 3002 a1.DrawMessageBox(0); |
3003 a1.uFrameWidth -= 12; | |
3004 a1.uFrameHeight -= 12; | |
3005 v7 = pSpellStats->pInfos[v1].pName; | |
3006 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
3007 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 3008 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 3009 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3010 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 3011 a1.uFrameZ = a1.uFrameX + 107; |
3012 a1.uFrameWidth = 108; | |
3013 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
1393 | 3014 sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3015 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 3016 } |
3017 | |
3018 //----- (004B1ECE) -------------------------------------------------------- | |
1459 | 3019 void OracleDialogue() |
0 | 3020 { |
3021 __int16 *v0; // edi@1 | |
3022 int v1; // ebx@3 | |
3023 Player *v2; // esi@3 | |
3024 int v3; // eax@4 | |
3025 signed int v4; // eax@9 | |
3026 int v5; // ebx@11 | |
89 | 3027 Player *v6; // esi@13 |
3028 ItemGen *v7; // eax@14 | |
0 | 3029 signed int v8; // edi@14 |
89 | 3030 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 3031 signed int v10; // [sp+10h] [bp-8h]@13 |
3032 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 3033 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 3034 |
484 | 3035 contract_approved = 0; |
0 | 3036 v11 = 0; |
3037 uDialogueType = 84; | |
827 | 3038 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3039 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
0 | 3040 while ( 1 ) |
3041 { | |
484 | 3042 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 3043 { |
3044 v1 = 0; | |
3045 v2 = pParty->pPlayers; | |
3046 do | |
3047 { | |
89 | 3048 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 3049 if ( v3 ) |
3050 break; | |
3051 ++v2; | |
3052 ++v1; | |
3053 } | |
3054 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
3055 if ( v1 == 4 ) | |
3056 break; | |
3057 } | |
3058 ++v11; | |
3059 v0 += 2; | |
89 | 3060 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
3061 break; | |
3062 } | |
3063 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
3064 { | |
827 | 3065 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 3066 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 3067 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 3068 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
3069 } | |
484 | 3070 if ( contract_approved == 601 ) |
0 | 3071 { |
3072 v5 = 0; | |
89 | 3073 v12 = pParty->pPlayers;//[0].uClass; |
0 | 3074 v9 = 0; |
3075 while ( 1 ) | |
3076 { | |
135 | 3077 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 3078 { |
3079 v10 = 0; | |
89 | 3080 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 3081 do |
3082 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
3083 v7 = v6->pInventoryItemList; |
0 | 3084 v8 = 138; |
3085 do | |
3086 { | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1355
diff
changeset
|
3087 if ( v7->uItemID == ITEM_LICH_JAR_FULL ) |
0 | 3088 { |
377 | 3089 if ( !v7->uHolderPlayer ) |
89 | 3090 v9 = v7; |
377 | 3091 if ( v7->uHolderPlayer == v5 ) |
0 | 3092 v10 = 1; |
3093 } | |
89 | 3094 ++v7; |
0 | 3095 --v8; |
3096 } | |
3097 while ( v8 ); | |
89 | 3098 ++v6; |
3099 } | |
3100 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 3101 if ( !v10 ) |
3102 break; | |
3103 } | |
89 | 3104 ++v12; |
0 | 3105 ++v5; |
89 | 3106 if ( v12 > &pParty->pPlayers[3] ) |
0 | 3107 return; |
3108 } | |
3109 if ( v9 ) | |
377 | 3110 v9->uHolderPlayer = v5; |
0 | 3111 } |
3112 } | |
3113 | |
3114 //----- (004B254D) -------------------------------------------------------- | |
1458 | 3115 char * _4B254D_SkillMasteryTeacher(int _this) |
0 | 3116 { |
955 | 3117 //Player *v1; // esi@1 |
0 | 3118 int v2; // edx@1 |
3119 int v3; // ecx@1 | |
3120 int v4; // edi@1 | |
955 | 3121 int pClassType; // eax@7 |
0 | 3122 int v6; // eax@7 |
3123 int v7; // ebx@7 | |
955 | 3124 //int v8; // ebx@8 |
0 | 3125 signed int v9; // esi@8 |
3126 int v10; // eax@8 | |
3127 char *v11; // ecx@8 | |
3128 int v12; // edi@9 | |
3129 char *v13; // edx@9 | |
3130 signed int v14; // edi@10 | |
3131 unsigned int v16; // eax@29 | |
955 | 3132 //int v17; // eax@36 |
0 | 3133 char v18; // cl@46 |
3134 __int16 v19; // dx@56 | |
3135 int v20; // eax@60 | |
955 | 3136 //char *v21; // [sp-Ch] [bp-38h]@82 |
3137 //const char *v22; // [sp-8h] [bp-34h]@21 | |
3138 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
3139 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 3140 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 3141 //int v26; // [sp-4h] [bp-30h]@38 |
3142 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 3143 char v28[4]; // [sp+Ch] [bp-20h]@9 |
3144 int v29; // [sp+10h] [bp-1Ch]@13 | |
3145 int v30; // [sp+14h] [bp-18h]@15 | |
3146 int v31; // [sp+18h] [bp-14h]@16 | |
3147 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 3148 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 3149 int v34; // [sp+24h] [bp-8h]@7 |
3150 char *v35; // [sp+28h] [bp-4h]@1 | |
3151 | |
484 | 3152 contract_approved = 0; |
0 | 3153 v2 = (_this - 200) % 3; |
3154 v3 = (_this - 200) / 3; | |
3155 v4 = v2; | |
3156 v35 = (char *)pNPCTopics[127].pText; | |
492 | 3157 dword_F8B1AC_award_bit_number = v3; |
0 | 3158 if ( v2 ) |
3159 { | |
3160 if ( v2 == 1 ) | |
3161 { | |
267 | 3162 gold_transaction_amount = 5000; |
0 | 3163 dword_F8B1B0 = 3; |
3164 } | |
3165 else | |
3166 { | |
3167 if ( v2 == 2 ) | |
3168 { | |
267 | 3169 gold_transaction_amount = 8000; |
0 | 3170 dword_F8B1B0 = 4; |
3171 } | |
3172 } | |
3173 } | |
3174 else | |
3175 { | |
267 | 3176 gold_transaction_amount = 2000; |
0 | 3177 dword_F8B1B0 = 2; |
3178 } | |
955 | 3179 pClassType = pPlayers[uActiveCharacter]->classType; |
3180 //v33 = pClassType; | |
3181 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
3182 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 3183 v7 = a1[0] & 0x3F; |
3184 v34 = v2 + 2; | |
3185 if ( v6 < v2 + 2 ) | |
3186 { | |
955 | 3187 //v8 = v33; |
0 | 3188 v9 = 0; |
955 | 3189 v10 = pClassType - pClassType % 4; |
3190 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 3191 do |
3192 { | |
3193 v12 = (unsigned __int8)*v11; | |
3194 v13 = &v28[4 * v9]; | |
3195 *(int *)v13 = 0; | |
3196 if ( v12 < v34 ) | |
3197 { | |
3198 v14 = 1; | |
3199 } | |
3200 else | |
3201 { | |
3202 v14 = 1; | |
3203 *(int *)v13 = 1; | |
3204 } | |
3205 ++v9; | |
3206 v11 += 37; | |
3207 } | |
3208 while ( v9 < 4 ); | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3209 __debugbreak(); // warning C4700: uninitialized local variable 'v29' used |
0 | 3210 if ( v29 == v14 ) |
3211 { | |
3212 v25 = pClassNames[v10 + 1]; | |
3213 } | |
3214 else | |
3215 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3216 __debugbreak(); // warning C4700: uninitialized local variable 'v30' used |
955 | 3217 if ( v30 == v14 )//crash |
0 | 3218 { |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3219 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used |
0 | 3220 if ( v31 == v14 ) |
3221 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3222 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3223 return pTmpBuf.data(); |
0 | 3224 } |
3225 v25 = pClassNames[v10 + 2]; | |
3226 } | |
3227 else | |
3228 { | |
3229 if ( v31 != v14 ) | |
3230 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3231 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3232 return pTmpBuf.data(); |
0 | 3233 } |
3234 v25 = pClassNames[v10 + 3]; | |
3235 } | |
3236 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3237 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3238 return pTmpBuf.data(); |
0 | 3239 } |
955 | 3240 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 3241 return (char *)pNPCTopics[122].pText; |
3242 if ( !v7 ) | |
3243 return (char *)pNPCTopics[131].pText; | |
3244 v16 = SkillToMastery(a1[0]); | |
3245 if ( (signed int)v16 > v4 + 1 ) | |
3246 return (char *)pNPCTopics[v4 + 128].pText; | |
3247 if ( v34 != 2 ) | |
3248 { | |
3249 if ( v34 == 3 ) | |
3250 { | |
3251 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
3252 { | |
492 | 3253 switch ( dword_F8B1AC_award_bit_number ) |
0 | 3254 { |
3255 case 12: | |
3256 case 13: | |
3257 case 14: | |
3258 case 15: | |
3259 case 16: | |
3260 case 17: | |
3261 case 18: | |
267 | 3262 gold_transaction_amount = 4000; |
0 | 3263 goto LABEL_42; |
3264 case 19: | |
3265 v19 = 114; | |
955 | 3266 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
3267 return v35; | |
3268 if ( !gold_transaction_amount ) | |
3269 goto LABEL_79; | |
3270 goto LABEL_42; | |
0 | 3271 case 20: |
3272 v19 = 110; | |
484 | 3273 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 3274 return v35; |
955 | 3275 if ( !gold_transaction_amount ) |
3276 goto LABEL_79; | |
3277 goto LABEL_42; | |
0 | 3278 case 22: |
955 | 3279 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
3280 if ( v20 < 50 ) | |
3281 return v35; | |
3282 if ( !gold_transaction_amount ) | |
3283 goto LABEL_79; | |
3284 goto LABEL_42; | |
0 | 3285 case 24: |
267 | 3286 gold_transaction_amount = 2500; |
955 | 3287 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 3288 if ( v20 < 50 ) |
3289 return v35; | |
955 | 3290 if ( !gold_transaction_amount ) |
3291 goto LABEL_79; | |
3292 goto LABEL_42; | |
3293 case 36: | |
3294 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
3295 if ( v20 < 50 ) | |
3296 return v35; | |
3297 if ( !gold_transaction_amount ) | |
3298 goto LABEL_79; | |
3299 goto LABEL_42; | |
0 | 3300 case 21: |
3301 case 23: | |
3302 case 25: | |
3303 case 26: | |
3304 case 29: | |
3305 case 32: | |
3306 case 34: | |
3307 case 35: | |
267 | 3308 gold_transaction_amount = 2500; |
0 | 3309 goto LABEL_42; |
3310 case 8: | |
3311 case 9: | |
3312 case 10: | |
3313 case 11: | |
267 | 3314 gold_transaction_amount = 3000; |
0 | 3315 goto LABEL_42; |
3316 case 7: | |
955 | 3317 gold_transaction_amount = 0; |
3318 if ( !gold_transaction_amount ) | |
3319 goto LABEL_79; | |
3320 goto LABEL_42; | |
3321 default: | |
3322 if ( !gold_transaction_amount ) | |
3323 goto LABEL_79; | |
3324 goto LABEL_42; | |
0 | 3325 } |
955 | 3326 gold_transaction_amount = 0; |
3327 if ( !gold_transaction_amount ) | |
3328 goto LABEL_79; | |
3329 goto LABEL_42; | |
0 | 3330 } |
3331 } | |
3332 else | |
3333 { | |
3334 if ( v34 != 4 ) | |
3335 { | |
955 | 3336 if ( !gold_transaction_amount ) |
3337 goto LABEL_79; | |
3338 goto LABEL_42; | |
0 | 3339 } |
3340 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
3341 { | |
492 | 3342 switch ( dword_F8B1AC_award_bit_number ) |
0 | 3343 { |
3344 case 19: | |
1355 | 3345 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 ) |
955 | 3346 { |
3347 if ( !gold_transaction_amount ) | |
3348 goto LABEL_79; | |
3349 goto LABEL_42; | |
3350 } | |
1355 | 3351 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 ) |
955 | 3352 { |
3353 if ( !gold_transaction_amount ) | |
3354 goto LABEL_79; | |
3355 goto LABEL_42; | |
3356 } | |
3357 return v35; | |
0 | 3358 case 20: |
1355 | 3359 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 ) |
955 | 3360 { |
3361 if ( !gold_transaction_amount ) | |
3362 goto LABEL_79; | |
3363 goto LABEL_42; | |
3364 } | |
1355 | 3365 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 ) |
955 | 3366 { |
3367 if ( !gold_transaction_amount ) | |
3368 goto LABEL_79; | |
3369 goto LABEL_42; | |
3370 } | |
0 | 3371 return v35; |
3372 case 30: | |
955 | 3373 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 3374 if ( (v18 & 0x3Fu) < 0xA ) |
3375 return v35; | |
955 | 3376 if ( !gold_transaction_amount ) |
3377 goto LABEL_79; | |
3378 goto LABEL_42; | |
3379 case 31: | |
3380 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
3381 if ( (v18 & 0x3Fu) < 0xA ) | |
3382 return v35; | |
3383 if ( !gold_transaction_amount ) | |
3384 goto LABEL_79; | |
3385 goto LABEL_42; | |
0 | 3386 case 21: |
3387 case 23: | |
3388 case 24: | |
3389 case 25: | |
3390 case 26: | |
3391 case 29: | |
3392 case 32: | |
3393 case 34: | |
3394 case 35: | |
267 | 3395 gold_transaction_amount = 6000; |
0 | 3396 goto LABEL_42; |
3397 case 8: | |
3398 case 9: | |
3399 case 10: | |
3400 case 11: | |
267 | 3401 gold_transaction_amount = 7000; |
0 | 3402 goto LABEL_42; |
3403 case 7: | |
3404 break; | |
955 | 3405 default: |
3406 if ( !gold_transaction_amount ) | |
3407 goto LABEL_79; | |
3408 goto LABEL_42; | |
0 | 3409 } |
267 | 3410 gold_transaction_amount = 0; |
955 | 3411 if ( !gold_transaction_amount ) |
3412 goto LABEL_79; | |
3413 goto LABEL_42; | |
0 | 3414 } |
3415 } | |
3416 return v35; | |
3417 } | |
3418 if ( v7 < 4 ) | |
3419 return v35; | |
492 | 3420 if ( dword_F8B1AC_award_bit_number > 27 ) |
3421 { | |
3422 if ( dword_F8B1AC_award_bit_number != 29 | |
3423 && dword_F8B1AC_award_bit_number != 32 | |
3424 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 3425 { |
267 | 3426 if ( !gold_transaction_amount ) |
0 | 3427 goto LABEL_79; |
3428 goto LABEL_42; | |
3429 } | |
267 | 3430 gold_transaction_amount = 500; |
955 | 3431 if ( !gold_transaction_amount ) |
3432 goto LABEL_79; | |
3433 goto LABEL_42; | |
0 | 3434 } |
492 | 3435 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 3436 { |
3437 gold_transaction_amount = 500; | |
3438 if ( !gold_transaction_amount ) | |
3439 goto LABEL_79; | |
3440 goto LABEL_42; | |
3441 } | |
492 | 3442 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 3443 { |
267 | 3444 gold_transaction_amount = 0; |
0 | 3445 goto LABEL_79; |
3446 } | |
492 | 3447 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 3448 { |
3449 if ( !gold_transaction_amount ) | |
3450 goto LABEL_79; | |
3451 goto LABEL_42; | |
3452 } | |
492 | 3453 if ( dword_F8B1AC_award_bit_number > 18 ) |
3454 { | |
3455 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 3456 { |
3457 if ( !gold_transaction_amount ) | |
3458 goto LABEL_79; | |
3459 goto LABEL_42; | |
3460 } | |
3461 gold_transaction_amount = 500; | |
3462 if ( !gold_transaction_amount ) | |
3463 goto LABEL_79; | |
3464 goto LABEL_42; | |
0 | 3465 } |
267 | 3466 gold_transaction_amount = 1000; |
0 | 3467 LABEL_42: |
267 | 3468 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 3469 return (char *)pNPCTopics[124].pText; |
3470 LABEL_79: | |
484 | 3471 contract_approved = 1; |
0 | 3472 if ( v34 == 2 ) |
3473 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3474 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 3475 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3476 return pTmpBuf2.data(); |
0 | 3477 } |
3478 if ( v34 == 3 ) | |
3479 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3480 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3481 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3482 return pTmpBuf2.data(); |
0 | 3483 } |
3484 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3485 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3486 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3487 return pTmpBuf2.data(); |
0 | 3488 } |
3489 | |
3490 //----- (004B3E1E) -------------------------------------------------------- | |
1458 | 3491 void sub_4B3E1E() |
0 | 3492 { |
3493 NPCData *v0; // ST40_4@1 | |
3494 signed int v1; // edi@1 | |
165 | 3495 //GUIWindow *v2; // ecx@1 |
0 | 3496 |
167 | 3497 __debugbreak(); |
602 | 3498 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 3499 v1 = 0; |
3500 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
3501 pDialogueWindow->Release(); | |
165 | 3502 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 3503 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 3504 { |
832 | 3505 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 3506 v1 = 1; |
3507 } | |
832 | 3508 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 3509 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 3510 } |
3511 | |
3512 | |
3513 //----- (004B3FE5) -------------------------------------------------------- | |
3514 void __fastcall sub_4B3FE5(int a4) | |
3515 { | |
3516 int v1; // edi@1 | |
3517 char *v2; // edi@1 | |
1411 | 3518 |
3519 __debugbreak(); | |
0 | 3520 v1 = a4; |
3521 uDialogueType = 78; | |
827 | 3522 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 3523 _4B254D_SkillMasteryTeacher(a4); |
3524 pDialogueWindow->Release(); | |
3525 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
3526 v2 = ""; | |
832 | 3527 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 3528 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 3529 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 3530 if ( contract_approved ) |
0 | 3531 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 3532 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 3533 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 3534 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 3535 } |
3536 // F8B19C: using guessed type int dword_F8B19C; | |
3537 // F8B1A8: using guessed type int dword_F8B1A8; | |
3538 | |
3539 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 3540 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
1411 | 3541 { |
0 | 3542 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
3543 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 3544 v4 = pFontLucida->AlignText_Center(450, Str); |
3545 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 3546 } |
3547 | |
3548 //----- (004B46F8) -------------------------------------------------------- | |
1459 | 3549 __int64 GetExperienceRequiredForLevel(int level) |
0 | 3550 { |
1459 | 3551 __int64 v1; // eax@1 |
0 | 3552 int i; // edx@1 |
3553 | |
3554 v1 = 0; | |
1459 | 3555 for ( i = 0; i < level; ++i ) |
0 | 3556 v1 += i + 1; |
3557 return 1000 * v1; | |
3558 } | |
3559 | |
3560 //----- (004BC49B) -------------------------------------------------------- | |
651 | 3561 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 3562 { |
656 | 3563 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3564 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3565 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3566 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3567 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3568 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3569 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3570 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3571 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3572 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3573 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3574 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3575 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3576 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3577 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3578 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3579 //v1 = _this; |
656 | 3580 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3581 //v3 = v1; |
656 | 3582 uDialogueType = newDialogueType; |
3583 if (!speakingNPC->uFlags) | |
3584 { | |
3585 speakingNPC->uFlags = 1; | |
3586 //v3 = uDialogueType; | |
3587 } | |
3588 | |
3589 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
3590 { | |
3591 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
3592 } | |
3593 else if(newDialogueType == DIALOGUE_76) | |
3594 { | |
3595 if (speakingNPC->Hired()) | |
3596 { | |
3597 v8 = 0; | |
3598 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3599 { | |
3600 v6 = (char *)pNPCStats->pNewNPCData; | |
3601 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3602 { | |
3603 ++v8; | |
3604 v6 += 76; | |
3605 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3606 break; | |
3607 } | |
3608 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
3609 v6[8] &= 0x7Fu; | |
3610 } | |
1104 | 3611 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3612 { |
3613 v11 = pParty->pHirelings; | |
3614 memset(v11, 0, sizeof(NPCData)); | |
3615 } | |
1104 | 3616 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3617 { |
3618 v11 = &pParty->pHirelings[1]; | |
3619 memset(v11, 0, sizeof(NPCData)); | |
3620 } | |
3621 pParty->field_709 = 0; | |
1035 | 3622 pParty->CountHirelings(); |
656 | 3623 dword_591084 = 0; |
3624 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3625 dword_7241C8 = 0; | |
3626 return; | |
3627 } | |
3628 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
3629 { | |
3630 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
3631 ShowStatusBarString(v7, 2u); | |
3632 } | |
3633 else | |
3634 { | |
3635 //v9 = v2->uProfession; | |
3636 if ( speakingNPC->uProfession != 51 ) | |
3637 { | |
3638 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
3639 if ( pParty->uNumGold < v10 ) | |
3640 { | |
3641 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
3642 dialogue_show_profession_details = false; | |
3643 uDialogueType = 13; | |
3644 if ( uActiveCharacter ) | |
3645 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
3646 v7 = pGlobalTXT_LocalizationStrings[155]; | |
3647 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
3648 if ( !dword_7241C8 ) | |
3649 pGame->Draw(); | |
3650 dword_7241C8 = 0; | |
3651 return; | |
3652 } | |
3653 Party::TakeGold(v10); | |
3654 } | |
3655 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
3656 if ( pParty->pHirelings[0].pName ) | |
3657 { | |
3658 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
3659 v15 = speakingNPC->pName; | |
3660 v13 = pParty->pHireling2Name; | |
3661 } | |
3662 else | |
3663 { | |
3664 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
3665 v15 = speakingNPC->pName; | |
3666 v13 = pParty->pHireling1Name; | |
3667 } | |
3668 strcpy(v13, v15); | |
3669 pParty->field_709 = 0; | |
1035 | 3670 pParty->CountHirelings(); |
656 | 3671 |
3672 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3673 | |
711 | 3674 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 3675 pDialogue_SpeakingActor->uAIState = Removed; |
3676 if ( uActiveCharacter ) | |
3677 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
3678 } | |
3679 } | |
3680 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
3681 { | |
3682 ArenaFight(); | |
3683 return; | |
3684 } | |
1413 | 3685 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY) |
656 | 3686 { |
1413 | 3687 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) |
656 | 3688 { |
1413 | 3689 if ( speakingNPC->uProfession != GateMaster ) |
656 | 3690 speakingNPC->bHasUsedTheAbility = 1; |
3691 | |
3692 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3693 } | |
3694 else | |
1413 | 3695 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" |
656 | 3696 } |
3697 else if(newDialogueType == DIALOGUE_13) | |
3698 { | |
3699 if (!speakingNPC->Hired()) | |
3700 { | |
3701 sub_4B3E1E(); | |
3702 dialogue_show_profession_details = false; | |
3703 } | |
3704 else | |
3705 { | |
3706 v5 = 0; | |
3707 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3708 { | |
3709 v6 = (char *)pNPCStats->pNewNPCData; | |
3710 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3711 { | |
3712 ++v5; | |
3713 v6 += 76; | |
3714 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3715 break; | |
3716 } | |
3717 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
3718 v6[8] &= 0x7Fu; | |
3719 } | |
1104 | 3720 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3721 { |
3722 v11 = pParty->pHirelings; | |
3723 memset(v11, 0, sizeof(NPCData)); | |
3724 } | |
1104 | 3725 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3726 { |
3727 v11 = &pParty->pHirelings[1]; | |
3728 memset(v11, 0, sizeof(NPCData)); | |
3729 } | |
3730 pParty->field_709 = 0; | |
1035 | 3731 pParty->CountHirelings(); |
656 | 3732 dword_591084 = 0; |
3733 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3734 dword_7241C8 = 0; | |
3735 return; | |
3736 } | |
3737 } | |
3738 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
3739 { | |
3740 switch(newDialogueType) | |
3741 { | |
3742 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
3743 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
3744 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
3745 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
3746 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
3747 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
3748 } | |
3749 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
3750 sub_4B3FE5(npc_event_id); //200-310 | |
3751 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
3752 { //400-410 | |
3753 dword_F8B1D8 = newDialogueType; | |
3754 DrawJoinGuildWindow(npc_event_id - 400); | |
3755 } | |
3756 else | |
3757 { | |
3758 switch ( npc_event_id ) | |
3759 { | |
3760 case 139: | |
1459 | 3761 OracleDialogue(); |
656 | 3762 break; |
3763 case 311: | |
3764 sub_4BBA85_bounties(); | |
3765 break; | |
3766 case 399: | |
1459 | 3767 __debugbreak(); // what kind of dialogue is that? |
656 | 3768 sub_4BBCDD(); |
3769 break; | |
3770 default: | |
3771 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 3772 current_npc_text = 0; |
656 | 3773 EventProcessor(npc_event_id, 0, 1); |
3774 activeLevelDecoration = NULL; | |
3775 break; | |
3776 } | |
3777 } | |
3778 } | |
3779 if ( !dword_7241C8 ) | |
3780 pGame->Draw(); | |
3781 dword_7241C8 = 0; | |
3782 } | |
0 | 3783 |
3784 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 3785 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 3786 { |
3787 int v6; // edx@8 | |
3788 int v7; // edx@9 | |
3789 int v8; // edx@10 | |
3790 unsigned __int8 v9; // zf@16 | |
3791 char v10; // sf@16 | |
3792 unsigned __int8 v11; // of@16 | |
702 | 3793 bool test; |
0 | 3794 |
907 | 3795 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
3796 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 3797 return 0; |
907 | 3798 switch( p2DEvents[_2da_idx - 1].uType ) |
3799 { | |
1411 | 3800 case BuildingType_WeaponShop: |
907 | 3801 { |
3802 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
3803 break; | |
3804 } | |
1411 | 3805 case BuildingType_ArmorShop: |
907 | 3806 { |
3807 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
3808 break; | |
3809 } | |
1411 | 3810 case BuildingType_MagicShop: |
907 | 3811 { |
3812 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
3813 break; | |
3814 } | |
1411 | 3815 case BuildingType_AlchemistShop: |
907 | 3816 { |
3817 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
3818 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
3819 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
3820 break; | |
3821 } | |
3822 default: | |
3823 { | |
3824 test = false; | |
3825 break; | |
3826 } | |
3827 } | |
702 | 3828 return test; |
3829 /* | |
3830 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 3831 { |
3832 v11 = __OFSUB__(v5, 2); | |
3833 v9 = v5 == 2; | |
3834 v10 = v5 - 2 < 0; | |
3835 goto LABEL_23; | |
3836 } | |
702 | 3837 if ( p2DEvents[a2 - 1].uType > 2 ) |
3838 { | |
3839 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 3840 { |
3841 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
3842 return v5 == 16; | |
3843 return 1; | |
3844 } | |
702 | 3845 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 3846 return 0; |
702 | 3847 if ( p2DEvents[a2 - 1].uType == 4) |
3848 { | |
3849 if ( v5 < 13 ) | |
3850 return 0; | |
3851 if ( v5 <= 14 ) | |
3852 return 1; | |
3853 if ( v5 != 17 || (signed int)v3 < 740 ) | |
3854 return 0; | |
3855 v11 = __OFSUB__(v3, 771); | |
3856 v9 = v3 == 771; | |
3857 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 3858 LABEL_23: |
702 | 3859 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
3860 return 0; | |
3861 return 1; | |
3862 } | |
3863 } | |
3864 if ( p2DEvents[a2 - 1].uType == 2 ) | |
3865 { | |
3866 if ( v5 >= 3 ) | |
3867 { | |
3868 v11 = __OFSUB__(v5, 9); | |
3869 v9 = v5 == 9; | |
3870 v10 = v5 - 9 < 0; | |
3871 goto LABEL_23; | |
3872 } | |
0 | 3873 } |
3874 return 0; | |
702 | 3875 */ |
0 | 3876 } |
3877 | |
1209 | 3878 |
0 | 3879 |