Mercurial > mm7
annotate mm7_4.cpp @ 1461:845907a747d3
Merge
author | Gloval |
---|---|
date | Wed, 21 Aug 2013 20:59:16 +0400 |
parents | ff2118028c71 2ca62c9e7b3c |
children | 7ef4b64f6329 |
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; | |
102 if ( v1->field_2 & 1 ) | |
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 } |
130 if ( v1->field_2 & 2 ) | |
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 } | |
170 if ( v1->field_2 & 4 ) | |
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]]; | |
469 if ( !(v1->field_2 & 0x20) ) | |
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) -------------------------------------------------------- | |
1700 void PlayerFrameTable::FromFile(void *pSerialized) | |
1701 { | |
1702 uNumFrames = *(int *)pSerialized; | |
1703 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
1704 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
1705 } | |
1706 | |
1707 //----- (00494C5A) -------------------------------------------------------- | |
1708 int PlayerFrameTable::FromFileTxt(const char *Args) | |
1709 { | |
1710 PlayerFrameTable *v2; // ebx@1 | |
1711 FILE *v3; // eax@1 | |
1712 int v4; // esi@3 | |
1713 void *v5; // eax@10 | |
1714 FILE *v6; // ST0C_4@12 | |
1715 char *i; // eax@12 | |
1716 __int16 v8; // ax@15 | |
1717 const char *v9; // ST10_4@15 | |
1718 unsigned __int16 v10; // ax@15 | |
1719 const char *v11; // ST0C_4@15 | |
1720 int j; // esi@15 | |
1721 int v13; // eax@17 | |
1722 int v14; // edx@22 | |
1723 int v15; // ecx@23 | |
1724 int v16; // eax@24 | |
1725 signed int k; // eax@27 | |
1726 PlayerFrame *v18; // edx@28 | |
1727 int v19; // esi@28 | |
1728 int l; // ecx@29 | |
1729 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1730 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
1731 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
1732 int v25; // [sp+2F8h] [bp-Ch]@3 | |
1733 int v26; // [sp+2FCh] [bp-8h]@3 | |
1734 FILE *File; // [sp+300h] [bp-4h]@1 | |
1735 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1736 | |
1737 v2 = this; | |
1738 //TileTable::dtor((TileTable *)this); | |
1739 v3 = fopen(Args, "r"); | |
1740 File = v3; | |
1741 if ( !v3 ) | |
1742 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
1743 v4 = 0; | |
1744 v25 = 0; | |
1745 v26 = 1; | |
1746 if ( fgets(&Buf, 490, v3) ) | |
1747 { | |
1748 do | |
1749 { | |
1750 *strchr(&Buf, 10) = 0; | |
703 | 1751 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1752 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
1753 { | |
1754 if ( v24.uPropCount < 3 ) | |
0 | 1755 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
1756 ++v25; | |
1757 } | |
1758 ++v26; | |
1759 } | |
1760 while ( fgets(&Buf, 490, File) ); | |
1761 v4 = v25; | |
1762 } | |
1763 v2->uNumFrames = v4; | |
1764 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
1765 v2->pFrames = (PlayerFrame *)v5; | |
1766 if ( !v5 ) | |
1767 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
1768 v6 = File; | |
1769 v2->uNumFrames = 0; | |
1770 fseek(v6, 0, 0); | |
1771 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1772 { | |
1773 *strchr(&Buf, 10) = 0; | |
703 | 1774 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 1775 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 1776 { |
1777 v8 = atoi(v24.pProperties[0]); | |
1778 v9 = v24.pProperties[1]; | |
130 | 1779 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 1780 v10 = atoi(v9); |
1781 v11 = v24.pProperties[2]; | |
1782 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
1783 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
1784 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
1785 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 1786 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 1787 { |
1104 | 1788 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 1789 { |
1790 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
1791 *(char *)v13 |= 4u; | |
1792 } | |
1793 } | |
1794 ++v2->uNumFrames; | |
1795 } | |
1796 } | |
1797 fclose(File); | |
1798 v14 = 0; | |
1799 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
1800 { | |
1801 v15 = 0; | |
1802 do | |
1803 { | |
1804 v16 = (int)&v2->pFrames[v15]; | |
1805 if ( !(*(char *)(v16 + 18) & 4) ) | |
1806 *(char *)(v16 + 8) |= 1u; | |
1807 ++v14; | |
1808 ++v15; | |
1809 } | |
1810 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
1811 } | |
1812 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
1813 { | |
1814 v18 = v2->pFrames; | |
1815 Argsa = (int)&v18[k]; | |
1816 v19 = *(short *)(Argsa + 4); | |
1817 if ( *(char *)(Argsa + 8) & 1 ) | |
1818 { | |
1819 ++k; | |
1820 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
1821 { | |
1822 v19 += *(short *)(l + 4); | |
1823 ++k; | |
1824 } | |
1825 LOWORD(v19) = v18[k].uAnimTime + v19; | |
1826 } | |
1827 ++k; | |
1828 } | |
1829 return 1; | |
1830 } | |
1831 | |
1832 //----- (00495366) -------------------------------------------------------- | |
1833 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
1834 { | |
1835 int v2; // edi@1 | |
1836 int v3; // edx@2 | |
1837 int v4; // esi@3 | |
1838 int v5; // ebx@5 | |
1839 signed int v7; // [sp+Ch] [bp-14h]@1 | |
1840 signed int v8; // [sp+10h] [bp-10h]@1 | |
1841 int **v9; // [sp+14h] [bp-Ch]@4 | |
1842 signed int v10; // [sp+18h] [bp-8h]@3 | |
1843 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
1844 | |
1845 v2 = a1; | |
1846 v11 = a2; | |
1847 v8 = 0; | |
1848 v7 = 0; | |
1849 if ( dword_AE336C == a1 ) | |
1850 { | |
1851 v3 = dword_AE3370; | |
1852 } | |
1853 else | |
1854 { | |
1855 v4 = a2; | |
1856 dword_AE336C = a1; | |
1857 v10 = 0; | |
1858 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
1419 | 1859 { |
1860 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1861 } | |
1862 else | |
1863 { | |
0 | 1864 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); |
1865 do | |
1866 { | |
1867 v5 = tolower(*(char *)*v9); | |
1868 if ( v5 == tolower(v2) ) | |
1869 { | |
1870 if ( v8 ) | |
1871 v7 = v10; | |
1872 else | |
1873 v8 = v10; | |
1874 } | |
1875 ++v10; | |
1876 v9 += 2; | |
1877 } | |
1878 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
1879 if ( v8 && v8 != v7 ) | |
1880 v3 = v8 + rand() % (v7 - v8); | |
1881 else | |
1882 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
1419 | 1883 } |
0 | 1884 } |
1885 dword_AE3370 = v3; | |
1886 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
1887 } | |
1459 | 1888 |
0 | 1889 |
1890 //----- (00495430) -------------------------------------------------------- | |
607 | 1891 char * GetReputationString( signed int a1 ) |
1892 { | |
566 | 1893 if (a1 >= 25) |
1894 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
1895 else if (a1 >= 6) | |
1896 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
1897 else if (a1 >= -5) | |
1898 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
1899 else if (a1 >= -24) | |
1900 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 1901 else |
566 | 1902 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 1903 } |
1904 | |
1905 //----- (00495461) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
1906 char *BuildDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 1907 { |
1908 Player *pPlayer; // ebx@3 | |
1453 | 1909 char *pText; // esi@7 |
0 | 1910 int v17; // eax@10 |
1911 signed __int64 v18; // qax@18 | |
1912 unsigned __int8 *v20; // ebx@32 | |
1913 int v21; // ecx@34 | |
1453 | 1914 int pReputation; // eax@45 |
0 | 1915 int v29; // eax@68 |
1916 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 1917 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
0 | 1918 char a1[100]; // [sp+B8h] [bp-80h]@3 |
1919 int v63; // [sp+12Ch] [bp-Ch]@32 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1920 |
1453 | 1921 if ( IsBadStringPtrA(lpsz, 1) ) |
0 | 1922 return "Invalid String Passed"; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1923 |
0 | 1924 a1[0] = 0; |
1453 | 1925 pPlayer = &pParty->pPlayers[uPlayerID]; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1926 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1927 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1928 NPCData *npc = nullptr; |
0 | 1929 if ( dword_5C35D4 ) |
1211 | 1930 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
|
1931 else |
602 | 1932 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1933 |
1453 | 1934 //pText = a4; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1935 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1936 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1937 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1938 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1939 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1940 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1941 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1942 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1943 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
|
1944 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1945 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
1946 { |
1453 | 1947 case 1://Ïîäðîáíåå |
1948 strcat(pTmpBuf2.data(), npc->pName); | |
1949 dst = strlen(pTmpBuf2.data()); | |
1950 i += 2; | |
1951 break; | |
1952 case 2: | |
1953 strcat(pTmpBuf2.data(), pPlayer->pName); | |
1954 dst = strlen(pTmpBuf2.data()); | |
1955 i += 2; | |
1956 break; | |
1957 case 3: | |
1958 case 4: | |
1959 strcat(pTmpBuf2.data(), a1); | |
1960 dst = strlen(pTmpBuf2.data()); | |
1961 i += 2; | |
1962 break; | |
1963 case 5: | |
1964 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; | |
1965 pText = pGlobalTXT_LocalizationStrings[397];// "evening" | |
1966 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
1967 { | |
1968 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 ) | |
0 | 1969 { |
1453 | 1970 if ( v18 < 20 ) |
1971 pText = pGlobalTXT_LocalizationStrings[396];// "day" | |
0 | 1972 } |
1973 else | |
1974 { | |
1453 | 1975 pText = pGlobalTXT_LocalizationStrings[395];// "morning" |
1976 } | |
1977 } | |
1978 strcat(pTmpBuf2.data(), pText); | |
1979 dst = strlen(pTmpBuf2.data()); | |
1980 i += 2; | |
1981 break; | |
1982 case 6: | |
1983 if ( pPlayer->uSex ) | |
1984 pText = pGlobalTXT_LocalizationStrings[387];// "lady" | |
1985 else | |
1986 pText = pGlobalTXT_LocalizationStrings[385];// "sir" | |
1987 strcat(pTmpBuf2.data(), pText); | |
1988 dst = strlen(pTmpBuf2.data()); | |
1989 i += 2; | |
1990 break; | |
1991 case 7: | |
1992 if ( pPlayer->uSex ) | |
1993 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
1994 else | |
1995 pText = pGlobalTXT_LocalizationStrings[386];// "Sir" | |
1996 strcat(pTmpBuf2.data(), pText); | |
1997 dst = strlen(pTmpBuf2.data()); | |
1998 i += 2; | |
1999 break; | |
2000 case 8: | |
2001 v63 = 0; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
2002 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits; |
1453 | 2003 for ( uint i = 0; i < 28; ++i ) |
2004 { | |
2005 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) ) | |
2006 { | |
2007 v21 = v63; | |
2008 ++v63; | |
2009 v55[v63] = word_4EE150[i]; | |
2010 } | |
2011 } | |
2012 if ( v63 ) | |
2013 { | |
2014 if ( dword_A74CDC == -1 ) | |
2015 dword_A74CDC = rand() % v63; | |
2016 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; | |
2017 } | |
2018 else | |
2019 pText = (char *)pNPCTopics[55].pText; | |
2020 strcat(pTmpBuf2.data(), pText); | |
2021 dst = strlen(pTmpBuf2.data()); | |
2022 i += 2; | |
2023 break; | |
2024 case 9: | |
2025 if ( npc->uSex ) | |
2026 pText = pGlobalTXT_LocalizationStrings[384];// "her" | |
2027 else | |
2028 pText = pGlobalTXT_LocalizationStrings[383];// "his" | |
2029 strcat(pTmpBuf2.data(), pText); | |
2030 dst = strlen(pTmpBuf2.data()); | |
2031 i += 2; | |
2032 break; | |
2033 case 10: | |
2034 if ( pPlayer->uSex ) | |
2035 pText = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
2036 else | |
2037 pText = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
2038 strcat(pTmpBuf2.data(), pText); | |
2039 dst = strlen(pTmpBuf2.data()); | |
2040 i += 2; | |
2041 break; | |
2042 case 11: | |
2043 pReputation = GetPartyReputation(); | |
2044 if ( pReputation >= 25 ) | |
2045 pText = pGlobalTXT_LocalizationStrings[379]; | |
2046 else//v25 < 25 | |
2047 { | |
2048 if ( pReputation < 6 ) | |
2049 { | |
2050 if ( pReputation >= -5 )//6 >= v25 >= -5 | |
2051 pText = pGlobalTXT_LocalizationStrings[399]; | |
2052 else// v25 < -5 | |
0 | 2053 { |
1453 | 2054 if ( pReputation < -24 )//-24 > v25 |
2055 pText = pGlobalTXT_LocalizationStrings[434]; | |
2056 else// -5 > v25 > -24 | |
2057 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 2058 } |
1453 | 2059 } |
2060 else//25 > v25 > 6 | |
2061 pText = pGlobalTXT_LocalizationStrings[392]; | |
2062 } | |
2063 strcat(pTmpBuf2.data(), pText); | |
2064 dst = strlen(pTmpBuf2.data()); | |
2065 i += 2; | |
2066 break; | |
2067 case 12: | |
2068 pReputation = npc->rep; | |
2069 if ( pReputation >= 25 ) | |
2070 pText = pGlobalTXT_LocalizationStrings[379]; | |
2071 else | |
2072 { | |
2073 if ( pReputation < 6 ) | |
2074 { | |
2075 if ( pReputation >= -5 ) | |
2076 pText = pGlobalTXT_LocalizationStrings[399]; | |
0 | 2077 else |
2078 { | |
1453 | 2079 if ( pReputation < -24 ) |
2080 pText = pGlobalTXT_LocalizationStrings[434]; | |
2081 else | |
2082 pText = pGlobalTXT_LocalizationStrings[402]; | |
0 | 2083 } |
2084 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2085 else |
1453 | 2086 pText = pGlobalTXT_LocalizationStrings[392]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2087 } |
1453 | 2088 strcat(pTmpBuf2.data(), pText); |
2089 dst = strlen(pTmpBuf2.data()); | |
2090 i += 2; | |
2091 break; | |
2092 case 13: | |
2093 strcat(pTmpBuf2.data(), sub_495366(pPlayer->pName[0], pPlayer->uSex)); | |
2094 dst = strlen(pTmpBuf2.data()); | |
2095 i += 2; | |
2096 break; | |
2097 case 14: | |
2098 if ( npc->uSex ) | |
2099 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
2100 else | |
2101 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
2102 strcat(pTmpBuf2.data(), pText); | |
2103 dst = strlen(pTmpBuf2.data()); | |
2104 i += 2; | |
2105 break; | |
2106 case 15: | |
2107 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter" | |
2108 dst = strlen(pTmpBuf2.data()); | |
2109 i += 2; | |
2110 break; | |
2111 case 16: | |
2112 if ( npc->uSex ) | |
2113 pText = pGlobalTXT_LocalizationStrings[391];// "sister" | |
2114 else | |
2115 pText = pGlobalTXT_LocalizationStrings[390];// "brother" | |
2116 strcat(pTmpBuf2.data(), pText); | |
2117 dst = strlen(pTmpBuf2.data()); | |
2118 i += 2; | |
2119 break; | |
2120 case 17://òåêñò íà¸ìíîãî ÍÏÑ | |
2121 { | |
2122 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; | |
2123 if ( !pay_percentage ) | |
2124 pay_percentage = 1; | |
2125 sprintf(a1, "%lu", pay_percentage); | |
2126 strcat(pTmpBuf2.data(), a1); | |
2127 dst = strlen(pTmpBuf2.data()); | |
2128 i += 2; | |
2129 break; | |
2130 } | |
2131 case 18: | |
2132 case 19: | |
2133 case 20: | |
2134 case 21: | |
2135 case 22: | |
2136 case 26: | |
2137 strncpy(a1, lpsz + i + 1, 2); | |
2138 sprintf(a1, "%lu", atoi(a1)); | |
2139 strcat(pTmpBuf2.data(), a1); | |
2140 dst = strlen(pTmpBuf2.data()); | |
2141 i += 2; | |
2142 break; | |
2143 case 23: | |
2144 if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) | |
2145 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())].pName; | |
2146 else | |
2147 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown" | |
2148 strcat(pTmpBuf2.data(), pText); | |
2149 dst = strlen(pTmpBuf2.data()); | |
2150 i += 2; | |
2151 break; | |
2152 case 24://íàçâàíèå òîâàðà â ïðîäàæå | |
2153 sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); | |
2154 strcat(pTmpBuf2.data(), a1); | |
2155 dst = strlen(pTmpBuf2.data()); | |
2156 i += 2; | |
2157 break; | |
2158 case 25: | |
2159 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
0 | 2160 switch ( a5 ) |
1453 | 2161 { |
2162 case 3: | |
2163 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2164 break; | |
2165 case 4: | |
2166 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2167 break; | |
2168 case 5: | |
2169 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2170 break; | |
2171 case 6: | |
2172 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
2173 break; | |
2174 } | |
2175 sprintfex(a1, "%lu", v29); | |
2176 strcat(pTmpBuf2.data(), a1); | |
2177 dst = strlen(pTmpBuf2.data()); | |
2178 i += 2; | |
2179 break; | |
2180 case 27://òåêñò ïðîäàæè | |
2181 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2182 if ( a5 == 3 ) | |
2183 { | |
2184 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2185 if (a3->Broken()) | |
2186 v29 = 1; | |
2187 sprintfex(a1, "%lu", v29); | |
2188 strcat(pTmpBuf2.data(), a1); | |
2189 dst = strlen(pTmpBuf2.data()); | |
2190 i += 2; | |
0 | 2191 break; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2192 } |
1453 | 2193 if ( a5 != 4 ) |
0 | 2194 { |
1453 | 2195 if ( a5 == 5 ) |
2196 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier); | |
2197 else | |
2198 { | |
2199 if ( a5 == 6 ) | |
2200 { | |
2201 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2; | |
2202 if (a3->Broken()) | |
2203 v29 = 1; | |
2204 if (!v29) | |
2205 v29 = 1; | |
2206 sprintfex(a1, "%lu", v29); | |
2207 strcat(pTmpBuf2.data(), a1); | |
2208 dst = strlen(pTmpBuf2.data()); | |
2209 i += 2; | |
2210 break; | |
2211 } | |
2212 } | |
2213 sprintfex(a1, "%lu", v29); | |
2214 strcat(pTmpBuf2.data(), a1); | |
2215 dst = strlen(pTmpBuf2.data()); | |
2216 i += 2; | |
2217 break; | |
0 | 2218 } |
1453 | 2219 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
2220 strcat(pTmpBuf2.data(), a1); | |
2221 dst = strlen(pTmpBuf2.data()); | |
2222 i += 2; | |
2223 break; | |
2224 case 28://ïðîôåññèÿ | |
2225 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle); | |
2226 dst = strlen(pTmpBuf2.data()); | |
2227 i += 2; | |
2228 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2229 case 29: |
1453 | 2230 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier)); |
2231 strcat(pTmpBuf2.data(), a1); | |
2232 dst = strlen(pTmpBuf2.data()); | |
2233 i += 2; | |
2234 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2235 case 30: |
1453 | 2236 if ( !a6 ) |
2237 { | |
2238 strcat(pTmpBuf2.data(), a4); | |
2239 dst = strlen(pTmpBuf2.data()); | |
2240 i += 2; | |
2241 break; | |
2242 } | |
1459 | 2243 init_summoned_item(&v56, *a6); |
1453 | 2244 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
2245 strcat(pTmpBuf2.data(), a1); | |
2246 dst = strlen(pTmpBuf2.data()); | |
2247 i += 2; | |
2248 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2249 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2250 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2251 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2252 case 34: |
1453 | 2253 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName); |
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 default: |
0 | 2258 if ( v17 <= 50 || v17 > 70 ) |
1453 | 2259 { |
2260 strncpy(a1, lpsz + i + 1, 2); | |
2261 sprintf(a1, "%lu", atoi(a1)); | |
2262 strcat(pTmpBuf2.data(), a1); | |
2263 dst = strlen(pTmpBuf2.data()); | |
2264 i += 2; | |
2265 break; | |
2266 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2267 if ( v17 - 51 >= 20 ) |
1453 | 2268 { |
2269 strcat(pTmpBuf2.data(), a4); | |
2270 dst = strlen(pTmpBuf2.data()); | |
2271 i += 2; | |
2272 break; | |
2273 } | |
1459 | 2274 init_summoned_item(&v56, pParty->field_3C._s_times[v17-51]); |
1453 | 2275 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year); |
2276 strcat(pTmpBuf2.data(), a1); | |
2277 dst = strlen(pTmpBuf2.data()); | |
2278 i += 2; | |
2279 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2280 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
2281 } |
0 | 2282 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2283 return pTmpBuf2.data(); |
0 | 2284 } |
2285 | |
2286 //----- (0049B04D) -------------------------------------------------------- | |
734 | 2287 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 2288 { |
734 | 2289 //stru154 *v3; // edi@1 |
2290 //signed int v4; // eax@1 | |
2291 //signed int result; // eax@9 | |
2292 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 2293 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 2294 float v7; |
0 | 2295 |
2296 v.x = 0.0; | |
2297 v.y = 0.0; | |
2298 v.z = 0.0; | |
734 | 2299 GetFacePlane(a2, a3, &v, &v7); |
2300 | |
2301 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
2302 polygonType = POLYGON_VerticalWall; | |
2303 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
2304 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
2305 polygonType = POLYGON_Floor; | |
0 | 2306 else |
734 | 2307 polygonType = POLYGON_InBetweenFloorAndWall; |
2308 | |
2309 face_plane.vNormal.x = v.x; | |
2310 face_plane.vNormal.y = v.y; | |
2311 face_plane.vNormal.z = v.z; | |
2312 face_plane.dist = v7; | |
0 | 2313 } |
2314 | |
2315 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 2316 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 2317 { |
734 | 2318 if (fabsf(pNormal->z) < 1e-6f) |
2319 polygonType = POLYGON_VerticalWall; | |
2320 else if (fabsf(pNormal->x) < 1e-6f && | |
2321 fabsf(pNormal->y) < 1e-6f) | |
2322 polygonType = POLYGON_Floor; | |
0 | 2323 else |
734 | 2324 polygonType = POLYGON_InBetweenFloorAndWall; |
2325 | |
2326 face_plane.vNormal.x = pNormal->x; | |
2327 face_plane.dist = dist; | |
2328 face_plane.vNormal.y = pNormal->y; | |
2329 face_plane.vNormal.z = pNormal->z; | |
0 | 2330 } |
2331 | |
2332 //----- (0049B13D) -------------------------------------------------------- | |
734 | 2333 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 2334 { |
2335 ODMFace *v5; // ebx@1 | |
734 | 2336 //int v6; // eax@1 |
2337 //unsigned __int16 *v7; // ebx@2 | |
2338 //Vec3_int_ *v8; // eax@3 | |
0 | 2339 Vec3_int_ *v9; // ecx@3 |
734 | 2340 //double v10; // st7@3 |
2341 //int v11; // ecx@3 | |
0 | 2342 Vec3_int_ *v12; // ecx@3 |
734 | 2343 //double v13; // st7@3 |
2344 //double v14; // st6@3 | |
2345 //double v15; // st5@3 | |
2346 //int v16; // ecx@3 | |
0 | 2347 Vec3_int_ *v17; // eax@3 |
734 | 2348 //double v18; // st5@3 |
0 | 2349 Vec3_float_ *v19; // eax@3 |
734 | 2350 //int result; // eax@8 |
2351 //float v21; // ecx@10 | |
2352 //double v22; // st7@10 | |
2353 //double v23; // st6@10 | |
0 | 2354 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 2355 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 2356 float v26; // [sp+1Ch] [bp-4Ch]@3 |
2357 float v27; // [sp+20h] [bp-48h]@3 | |
2358 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 2359 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
2360 //float v30; // [sp+30h] [bp-38h]@3 | |
2361 //float v31; // [sp+34h] [bp-34h]@3 | |
2362 //float v32; // [sp+38h] [bp-30h]@3 | |
2363 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 2364 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 2365 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
2366 //float v36; // [sp+50h] [bp-18h]@3 | |
2367 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 2368 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 2369 //int v39; // [sp+64h] [bp-4h]@1 |
2370 | |
2371 //v39 = 0; | |
0 | 2372 v1.x = 0.0; |
2373 v5 = pFace; | |
734 | 2374 //v6 = pFace->uNumVertices; |
0 | 2375 v1.y = 0.0; |
2376 v1.z = 0.0; | |
734 | 2377 |
2378 if (pFace->uNumVertices >= 2) | |
2379 { | |
2380 int i = 0; | |
2381 while ( i < pFace->uNumVertices - 2 ) | |
2382 { | |
2383 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
2384 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
2385 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 2386 i++; |
734 | 2387 v1.x = v12->x - v9->x; |
2388 v26 = v17->x - v12->x; | |
2389 v1.y = v12->y - v9->y; | |
2390 v27 = v17->y - v12->y; | |
2391 v1.z = v12->z - v9->z; | |
2392 v28 = v17->z - v12->z; | |
0 | 2393 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
2394 v38.x = v19->x; | |
2395 v38.y = v19->y; | |
2396 v38.z = v19->z; | |
734 | 2397 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
2398 { | |
2399 v38.Normalize(); | |
2400 | |
2401 pOutNormal->x = v38.x; | |
2402 pOutNormal->y = v38.y; | |
2403 pOutNormal->z = v38.z; | |
2404 | |
2405 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
2406 return; | |
2407 } | |
2408 } | |
2409 } | |
2410 | |
2411 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
2412 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
2413 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
2414 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 2415 } |
2416 | |
2417 //----- (0049D700) -------------------------------------------------------- | |
2418 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
2419 { | |
2420 unsigned int v1; // eax@1 | |
2421 int v2; // ecx@1 | |
2422 unsigned int v3; // eax@1 | |
2423 | |
2424 v1 = uDim; | |
2425 v2 = 0; | |
2426 v3 = v1 - 1; | |
2427 while ( v3 & 1 ) | |
2428 { | |
2429 v3 >>= 1; | |
2430 ++v2; | |
2431 } | |
2432 return v3 == 0 ? v2 : 0; | |
2433 } | |
2434 | |
2435 //----- (004A19D8) -------------------------------------------------------- | |
737 | 2436 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 2437 { |
737 | 2438 /*signed __int64 v2; // ST10_8@1 |
0 | 2439 double v3; // st7@1 |
2440 float v4; // ST24_4@1 | |
2441 double v5; // ST10_8@1 | |
2442 int v6; // ST1C_4@1 | |
2443 float v7; // ST24_4@1 | |
2444 double v8; // ST10_8@1 | |
2445 unsigned __int8 v9; // ST20_1@1 | |
2446 float v10; // ST24_4@1 | |
2447 double v11; // ST10_8@1 | |
2448 float v12; // ST24_4@1 | |
737 | 2449 double v13; // ST08_8@1*/ |
2450 | |
2451 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
2452 (a2 >> 24) / 255.0f * 255.0f), | |
2453 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
2454 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
2455 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
2456 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
2457 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
2458 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
2459 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
2460 /*v2 = a1 >> 24; | |
2461 v3 = (double)v2 / 255.0f; | |
2462 HIDWORD(v2) = 0; | |
0 | 2463 LODWORD(v2) = a2 >> 24; |
737 | 2464 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 2465 v5 = v4 + 6.7553994e15; |
2466 v6 = LODWORD(v5); | |
737 | 2467 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 2468 v8 = v7 + 6.7553994e15; |
2469 v9 = LOBYTE(v8); | |
737 | 2470 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 2471 v11 = v10 + 6.7553994e15; |
737 | 2472 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 2473 v13 = v12 + 6.7553994e15; |
737 | 2474 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 2475 } |
2476 | |
2477 //----- (004A46E6) -------------------------------------------------------- | |
2478 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
2479 { | |
2480 int v5; // eax@1 | |
2481 int z; // eax@1 | |
2482 unsigned int v7; // eax@9 | |
2483 unsigned int v8; // ecx@9 | |
2484 int v9; // eax@9 | |
2485 unsigned int v10; // eax@10 | |
2486 int *v11; // esi@10 | |
2487 int *v12; // edi@10 | |
2488 int v13; // ecx@10 | |
2489 int v14; // edx@10 | |
2490 unsigned int v15; // eax@22 | |
2491 int *v16; // esi@22 | |
2492 int *v17; // edi@22 | |
2493 int v18; // ecx@22 | |
2494 int v19; // edx@22 | |
2495 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
2496 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
2497 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
2498 signed int v23; // [sp+20h] [bp+Ch]@1 | |
2499 | |
2500 v5 = a4; | |
2501 v23 = _z >> 16; | |
2502 z = x + v5; | |
693 | 2503 if ( z >= (signed int)pViewport->uViewportTL_X |
2504 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
2505 && y >= (signed int)pViewport->uViewportTL_Y | |
2506 && y <= (signed int)pViewport->uViewportBR_Y ) | |
2507 { | |
2508 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
2509 x = pViewport->uViewportTL_X; | |
2510 if ( z > (signed int)pViewport->uViewportBR_X ) | |
2511 z = pViewport->uViewportBR_X; | |
0 | 2512 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
2513 v22 = z - x; | |
2514 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
2515 v7 = lightColor >> 3; | |
2516 v8 = lightColor & 0xF0; | |
2517 v9 = v7 & 0x1E0000; | |
2518 if ( pRenderer->uTargetGBits == 5 ) | |
2519 { | |
2520 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
2521 v11 = (int *)pTarget; | |
2522 v12 = pTargetZ; | |
2523 v13 = v22; | |
2524 v14 = (v10 << 16) | v10; | |
2525 z = (unsigned __int8)pTarget & 2; | |
2526 if ( (unsigned __int8)pTarget & 2 ) | |
2527 { | |
2528 z = (unsigned int)*pTargetZ >> 16; | |
2529 if ( z > v23 ) | |
2530 { | |
2531 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
2532 *pTarget = z; | |
2533 } | |
2534 v13 = v22 - 1; | |
2535 v11 = (int *)(pTarget + 1); | |
2536 v12 = pTargetZ + 1; | |
2537 } | |
2538 while ( v13 != 1 ) | |
2539 { | |
2540 if ( v13 < 1 ) | |
2541 return z; | |
2542 z = (unsigned int)*v12 >> 16; | |
2543 if ( z <= v23 ) | |
2544 { | |
2545 v13 -= 2; | |
2546 ++v11; | |
2547 v12 += 2; | |
2548 } | |
2549 else | |
2550 { | |
2551 v12 += 2; | |
2552 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
2553 v13 -= 2; | |
2554 *v11 = z; | |
2555 ++v11; | |
2556 } | |
2557 } | |
2558 z = (unsigned int)*v12 >> 16; | |
2559 if ( z > v23 ) | |
2560 { | |
2561 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
2562 *(short *)v11 = z; | |
2563 } | |
2564 } | |
2565 else | |
2566 { | |
2567 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
2568 v16 = (int *)pTarget; | |
2569 v17 = pTargetZ; | |
2570 v18 = v22; | |
2571 v19 = (v15 << 16) | v15; | |
2572 z = (unsigned __int8)pTarget & 2; | |
2573 if ( (unsigned __int8)pTarget & 2 ) | |
2574 { | |
2575 z = (unsigned int)*pTargetZ >> 16; | |
2576 if ( z > v23 ) | |
2577 { | |
2578 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
2579 *pTarget = z; | |
2580 } | |
2581 v18 = v22 - 1; | |
2582 v16 = (int *)(pTarget + 1); | |
2583 v17 = pTargetZ + 1; | |
2584 } | |
2585 while ( v18 != 1 ) | |
2586 { | |
2587 if ( v18 < 1 ) | |
2588 return z; | |
2589 z = (unsigned int)*v17 >> 16; | |
2590 if ( z <= v23 ) | |
2591 { | |
2592 v18 -= 2; | |
2593 ++v16; | |
2594 v17 += 2; | |
2595 } | |
2596 else | |
2597 { | |
2598 v17 += 2; | |
2599 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
2600 v18 -= 2; | |
2601 *v16 = z; | |
2602 ++v16; | |
2603 } | |
2604 } | |
2605 z = (unsigned int)*v17 >> 16; | |
2606 if ( z > v23 ) | |
2607 { | |
2608 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
2609 *(short *)v16 = z; | |
2610 } | |
2611 } | |
2612 } | |
2613 return z; | |
2614 } | |
2615 | |
2616 //----- (004A57E9) -------------------------------------------------------- | |
1458 | 2617 void Present_ColorKey() |
0 | 2618 { |
2619 HRESULT v0; // eax@3 | |
2620 HRESULT v1; // eax@3 | |
2621 HRESULT v2; // eax@3 | |
2622 HRESULT v3; // eax@3 | |
2623 HRESULT v4; // eax@3 | |
2624 RECT a2; // [sp+4h] [bp-14h]@3 | |
2625 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
2626 | |
2627 if ( !pRenderer->uNumSceneBegins ) | |
2628 { | |
2629 if ( pRenderer->field_40110 ) | |
2630 { | |
693 | 2631 a2.bottom = pViewport->uViewportTL_Y; |
0 | 2632 a2.left = 0; |
2633 a2.top = 0; | |
2634 a2.right = 640; | |
2635 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
2636 a2.right = 640; | |
2637 a2.left = 0; | |
693 | 2638 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 2639 a2.bottom = 480; |
2640 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
2641 0, | |
693 | 2642 pViewport->uViewportBR_Y + 1, |
0 | 2643 pRenderer->pColorKeySurface4, |
2644 &a2, | |
2645 16u)); | |
693 | 2646 a2.right = pViewport->uViewportTL_X; |
2647 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 2648 a2.left = 0; |
693 | 2649 a2.top = pViewport->uViewportTL_Y; |
0 | 2650 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
2651 0, | |
693 | 2652 pViewport->uViewportTL_Y, |
0 | 2653 pRenderer->pColorKeySurface4, |
2654 &a2, | |
2655 16u)); | |
693 | 2656 a2.left = pViewport->uViewportBR_X; |
2657 a2.top = pViewport->uViewportTL_Y; | |
0 | 2658 a2.right = 640; |
693 | 2659 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 2660 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2661 pViewport->uViewportBR_X, |
2662 pViewport->uViewportTL_Y, | |
0 | 2663 pRenderer->pColorKeySurface4, |
2664 &a2, | |
2665 16u)); | |
693 | 2666 a2.right = pViewport->uViewportBR_X; |
2667 a2.bottom = pViewport->uViewportBR_Y + 1; | |
2668 a2.left = pViewport->uViewportTL_X; | |
2669 a2.top = pViewport->uViewportTL_Y; | |
0 | 2670 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 2671 pViewport->uViewportTL_X, |
2672 pViewport->uViewportTL_Y, | |
0 | 2673 pRenderer->pColorKeySurface4, |
2674 &a2, | |
2675 17u)); | |
2676 } | |
2677 } | |
2678 } | |
2679 | |
2680 //----- (004A597D) -------------------------------------------------------- | |
2681 void Present_NoColorKey() | |
2682 { | |
2683 //unsigned __int16 *v0; // eax@4 | |
2684 unsigned __int16 *v1; // esi@4 | |
2685 void *v2; // edi@4 | |
2686 //signed int v4; // ebx@4 | |
2687 //signed int v5; // ebx@6 | |
2688 //void *v6; // edi@7 | |
2689 //const void *v7; // esi@7 | |
2690 signed int v8; // ebx@8 | |
2691 int v9; // eax@10 | |
2692 unsigned int v10; // esi@10 | |
2693 unsigned __int32 v11; // edi@10 | |
2694 //int v12; // ecx@10 | |
2695 unsigned int v13; // ebx@10 | |
2696 int v14; // eax@11 | |
2697 int v15; // eax@13 | |
2698 int v16; // eax@14 | |
2699 int v17; // eax@16 | |
2700 HRESULT v18; // eax@22 | |
2701 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
2702 int v20; // [sp+88h] [bp-1Ch]@10 | |
2703 int v21; // [sp+8Ch] [bp-18h]@10 | |
2704 __int32 v22; // [sp+90h] [bp-14h]@10 | |
2705 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
2706 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
2707 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
2708 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
2709 | |
2710 if ( !pRenderer->uNumSceneBegins ) | |
2711 { | |
2712 if ( pRenderer->field_40110 ) | |
2713 { | |
2714 memset(&Dst, 0, 0x7Cu); | |
2715 Dst.dwSize = 124; | |
168 | 2716 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 2717 { |
2718 //v26 = Dst.lpSurface; | |
2719 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
2720 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
2721 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
2722 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
2723 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
2724 v1 = pRenderer->pTargetSurface; | |
2725 v2 = Dst.lpSurface; | |
2726 | |
2727 | |
2728 /*for (uint y = 0; y < 480; ++y) | |
2729 { | |
2730 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
2731 for (uint x = 0; x < 640; ++x) | |
2732 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
2733 }*/ | |
2734 | |
2735 auto pSrc = pRenderer->pTargetSurface; | |
2736 auto pDst = (__int16 *)Dst.lpSurface; | |
2737 | |
2738 for (uint y = 0; y < 8; ++y) | |
2739 memcpy(pDst + y * Dst.lPitch / 2, | |
2740 | |
2741 pSrc + y * 640, 640 * sizeof(__int16)); | |
2742 | |
2743 for (uint y = 8; y < 352; ++y) | |
2744 { | |
2745 memcpy(pDst + y * Dst.lPitch / 2, | |
2746 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 2747 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
2748 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 2749 } |
2750 | |
121 | 2751 for (uint y = 352; y < 480; ++y) |
0 | 2752 memcpy(pDst + y * Dst.lPitch / 2, |
2753 pSrc + y * 640, 640 * sizeof(__int16)); | |
2754 | |
2755 | |
693 | 2756 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2757 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 2758 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 2759 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 2760 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 2761 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
2762 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
2763 v21 = 4 * v9 + 1280; | |
2764 | |
121 | 2765 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 2766 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
2767 v10 = (int)pSrc_x1y1; | |
2768 v11 = (int)pDst_x1y1; | |
693 | 2769 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 2770 v13 = v24; |
2771 | |
693 | 2772 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 2773 { |
2774 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
2775 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 2776 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 2777 { |
2778 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
2779 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
2780 } | |
2781 } | |
2782 | |
2783 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2784 | |
2785 /* while ( 1 ) | |
2786 { | |
2787 while ( 1 ) | |
2788 { | |
2789 v14 = *(int *)v10; | |
2790 v10 += 4; | |
2791 if ( v14 == v13 ) | |
2792 break; | |
2793 if ( (short)v14 == (short)v13 ) | |
2794 { | |
2795 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
2796 v11 += 4; | |
2797 --uHalfWidth; | |
2798 if ( !uHalfWidth ) | |
2799 goto LABEL_21; | |
2800 } | |
2801 else | |
2802 { | |
2803 v15 = __ROL__(v14, 16); | |
2804 if ( (short)v15 == (short)v13 ) | |
2805 { | |
2806 v17 = __ROR__(v15, 16); | |
2807 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
2808 v11 += 4; | |
2809 --uHalfWidth; | |
2810 if ( !uHalfWidth ) | |
2811 goto LABEL_21; | |
2812 } | |
2813 else | |
2814 { | |
2815 v16 = __ROR__(v15, 16); | |
2816 *(int *)v11 = v16; | |
2817 v11 += 4; | |
2818 --uHalfWidth; | |
2819 if ( !uHalfWidth ) | |
2820 goto LABEL_21; | |
2821 } | |
2822 } | |
2823 } | |
2824 v11 += 4; | |
2825 --uHalfWidth; | |
2826 if ( !uHalfWidth ) | |
2827 { | |
2828 LABEL_21: | |
2829 v10 += v21; | |
2830 v11 += v22; | |
2831 uHalfWidth = v20; | |
2832 if ( !--uNumLines ) | |
2833 { | |
2834 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
2835 return; | |
2836 } | |
2837 } | |
2838 }*/ | |
2839 } | |
2840 } | |
2841 } | |
2842 } | |
2843 | |
2844 //----- (004A7063) -------------------------------------------------------- | |
1390 | 2845 unsigned int ModulateColor(unsigned int diffuse, float multiplier) |
0 | 2846 { |
1390 | 2847 float alpha = multiplier * ((diffuse >> 24) & 0xFF); |
2848 int a = (int)floorf(alpha + 0.5f); | |
2849 a = max(0, min(255, a)); | |
2850 | |
2851 float red = multiplier * ((diffuse >> 16) & 0xFF); | |
2852 int r = (int)floorf(red + 0.5f); | |
2853 r = max(0, min(255, r)); | |
2854 | |
2855 float green = multiplier * ((diffuse >> 8) & 0xFF); | |
2856 int g = (int)floorf(green + 0.5f); | |
2857 g = max(0, min(255, g)); | |
2858 | |
2859 float blue = multiplier * ((diffuse >> 0) & 0xFF); | |
2860 int b = (int)floorf(blue + 0.5f); | |
2861 b = max(0, min(255, b)); | |
2862 | |
2863 return (a << 24) | (r << 16) | (g << 8) | b; | |
0 | 2864 } |
2865 | |
2866 | |
2867 | |
2868 //----- (004B1447) -------------------------------------------------------- | |
2869 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
2870 { | |
2871 signed int v3; // esi@1 | |
2872 char v4; // sf@8 | |
2873 int v5; // eax@8 | |
2874 unsigned __int64 v6; // qax@12 | |
2875 DDM_DLV_Header *v7; // eax@14 | |
2876 Player **v8; // edi@18 | |
2877 Player *result; // eax@19 | |
735 | 2878 //char *v10; // esi@20 |
0 | 2879 |
2880 v3 = 0; | |
2881 if ( a2 ) | |
2882 { | |
2883 if ( a2 != 1 ) | |
2884 { | |
2885 if ( a2 == 2 ) | |
2886 v3 = 2; | |
2887 goto LABEL_13; | |
2888 } | |
2889 v3 = 2; | |
2890 } | |
2891 else | |
2892 { | |
2893 v3 = 1; | |
2894 } | |
2895 if ( pParty->uFine < 4000000 ) | |
2896 { | |
2897 v4 = a3 + pParty->uFine < 0; | |
2898 v5 = a3 + pParty->uFine; | |
2899 pParty->uFine += a3; | |
2900 if ( v4 ) | |
2901 { | |
2902 v5 = 0; | |
2903 pParty->uFine = 0; | |
2904 } | |
2905 if ( v5 > 4000000 ) | |
2906 pParty->uFine = 4000000; | |
2907 } | |
487 | 2908 |
2909 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
2910 | |
0 | 2911 LABEL_13: |
463 | 2912 pParty->InTheShopFlags[a1] = 1; |
0 | 2913 if ( v3 ) |
2914 { | |
2915 v7 = &pOutdoor->ddm; | |
2916 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
2917 v7 = &pIndoor->dlv; | |
2918 v7->uReputation += v3; | |
2919 if ( v7->uReputation > 10000 ) | |
2920 v7->uReputation = 10000; | |
2921 } | |
2922 v8 = &pPlayers[1]; | |
2923 do | |
2924 { | |
2925 result = *v8; | |
2926 if ( pParty->uFine ) | |
2927 { | |
735 | 2928 //v10 = result->_guilds_member_bits; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1453
diff
changeset
|
2929 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_achieved_awards_bits, 1); |
0 | 2930 if ( !(short)result ) |
735 | 2931 __debugbreak(); |
501 | 2932 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 2933 } |
2934 ++v8; | |
2935 } | |
2936 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
2937 return result; | |
2938 } | |
2939 | |
2940 //----- (004B1523) -------------------------------------------------------- | |
1458 | 2941 void sub_4B1523(int *_this) |
0 | 2942 { |
2943 int v1; // esi@1 | |
2944 int v2; // edx@1 | |
2945 unsigned int v3; // eax@2 | |
2946 int v4; // eax@4 | |
2947 LONG v5; // ecx@4 | |
2948 int v6; // eax@10 | |
2949 char *v7; // ST44_4@12 | |
2950 unsigned __int16 v8; // ax@12 | |
2951 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
2952 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
2953 POINT a2; // [sp+64h] [bp-10h]@1 | |
2954 int v13; // [sp+6Ch] [bp-8h]@4 | |
2955 int v14; // [sp+70h] [bp-4h]@4 | |
2956 | |
2957 v1 = *_this - 399; | |
2958 v2 = (*_this - 400) % 11 + 1; | |
2959 v11 = 4 * (*_this - 400) / 11; | |
1312 | 2960 // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used |
0 | 2961 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
2962 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
2963 else | |
2964 v3 = 30; | |
2965 a1.Hint = 0; | |
2966 a1.uFrameY = v3; | |
2967 a1.uFrameWidth = 328; | |
2968 a1.uFrameHeight = 68; | |
2969 a1.uFrameX = 90; | |
2970 a1.uFrameZ = 417; | |
2971 a1.uFrameW = v3 + 67; | |
2972 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
2973 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
2974 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
2975 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
2976 v5 = a2.y; | |
2977 if ( v14 > a2.y ) | |
2978 v5 = v14; | |
2979 if ( v13 > v5 ) | |
2980 v5 = v13; | |
2981 if ( v4 > v5 ) | |
2982 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2983 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 | 2984 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
2985 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
2986 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
2987 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
2988 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
|
2989 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 2990 a1.uFrameHeight += v6; |
2991 if ( (signed int)a1.uFrameHeight < 150 ) | |
2992 a1.uFrameHeight = 150; | |
819 | 2993 a1.uFrameWidth = game_viewport_width; |
0 | 2994 a1.DrawMessageBox(0); |
2995 a1.uFrameWidth -= 12; | |
2996 a1.uFrameHeight -= 12; | |
2997 v7 = pSpellStats->pInfos[v1].pName; | |
2998 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
2999 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 3000 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 3001 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
|
3002 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 3003 a1.uFrameZ = a1.uFrameX + 107; |
3004 a1.uFrameWidth = 108; | |
3005 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
1393 | 3006 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
|
3007 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 3008 } |
3009 | |
3010 //----- (004B1ECE) -------------------------------------------------------- | |
1459 | 3011 void OracleDialogue() |
0 | 3012 { |
3013 __int16 *v0; // edi@1 | |
3014 int v1; // ebx@3 | |
3015 Player *v2; // esi@3 | |
3016 int v3; // eax@4 | |
3017 signed int v4; // eax@9 | |
3018 int v5; // ebx@11 | |
89 | 3019 Player *v6; // esi@13 |
3020 ItemGen *v7; // eax@14 | |
0 | 3021 signed int v8; // edi@14 |
89 | 3022 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 3023 signed int v10; // [sp+10h] [bp-8h]@13 |
3024 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 3025 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 3026 |
484 | 3027 contract_approved = 0; |
0 | 3028 v11 = 0; |
3029 uDialogueType = 84; | |
827 | 3030 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3031 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
0 | 3032 while ( 1 ) |
3033 { | |
484 | 3034 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 3035 { |
3036 v1 = 0; | |
3037 v2 = pParty->pPlayers; | |
3038 do | |
3039 { | |
89 | 3040 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 3041 if ( v3 ) |
3042 break; | |
3043 ++v2; | |
3044 ++v1; | |
3045 } | |
3046 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
3047 if ( v1 == 4 ) | |
3048 break; | |
3049 } | |
3050 ++v11; | |
3051 v0 += 2; | |
89 | 3052 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
3053 break; | |
3054 } | |
3055 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
3056 { | |
827 | 3057 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 3058 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 3059 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 3060 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
3061 } | |
484 | 3062 if ( contract_approved == 601 ) |
0 | 3063 { |
3064 v5 = 0; | |
89 | 3065 v12 = pParty->pPlayers;//[0].uClass; |
0 | 3066 v9 = 0; |
3067 while ( 1 ) | |
3068 { | |
135 | 3069 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 3070 { |
3071 v10 = 0; | |
89 | 3072 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 3073 do |
3074 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1372
diff
changeset
|
3075 v7 = v6->pInventoryItemList; |
0 | 3076 v8 = 138; |
3077 do | |
3078 { | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1355
diff
changeset
|
3079 if ( v7->uItemID == ITEM_LICH_JAR_FULL ) |
0 | 3080 { |
377 | 3081 if ( !v7->uHolderPlayer ) |
89 | 3082 v9 = v7; |
377 | 3083 if ( v7->uHolderPlayer == v5 ) |
0 | 3084 v10 = 1; |
3085 } | |
89 | 3086 ++v7; |
0 | 3087 --v8; |
3088 } | |
3089 while ( v8 ); | |
89 | 3090 ++v6; |
3091 } | |
3092 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 3093 if ( !v10 ) |
3094 break; | |
3095 } | |
89 | 3096 ++v12; |
0 | 3097 ++v5; |
89 | 3098 if ( v12 > &pParty->pPlayers[3] ) |
0 | 3099 return; |
3100 } | |
3101 if ( v9 ) | |
377 | 3102 v9->uHolderPlayer = v5; |
0 | 3103 } |
3104 } | |
3105 | |
3106 //----- (004B254D) -------------------------------------------------------- | |
1458 | 3107 char * _4B254D_SkillMasteryTeacher(int _this) |
0 | 3108 { |
955 | 3109 //Player *v1; // esi@1 |
0 | 3110 int v2; // edx@1 |
3111 int v3; // ecx@1 | |
3112 int v4; // edi@1 | |
955 | 3113 int pClassType; // eax@7 |
0 | 3114 int v6; // eax@7 |
3115 int v7; // ebx@7 | |
955 | 3116 //int v8; // ebx@8 |
0 | 3117 signed int v9; // esi@8 |
3118 int v10; // eax@8 | |
3119 char *v11; // ecx@8 | |
3120 int v12; // edi@9 | |
3121 char *v13; // edx@9 | |
3122 signed int v14; // edi@10 | |
3123 unsigned int v16; // eax@29 | |
955 | 3124 //int v17; // eax@36 |
0 | 3125 char v18; // cl@46 |
3126 __int16 v19; // dx@56 | |
3127 int v20; // eax@60 | |
955 | 3128 //char *v21; // [sp-Ch] [bp-38h]@82 |
3129 //const char *v22; // [sp-8h] [bp-34h]@21 | |
3130 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
3131 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 3132 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 3133 //int v26; // [sp-4h] [bp-30h]@38 |
3134 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 3135 char v28[4]; // [sp+Ch] [bp-20h]@9 |
3136 int v29; // [sp+10h] [bp-1Ch]@13 | |
3137 int v30; // [sp+14h] [bp-18h]@15 | |
3138 int v31; // [sp+18h] [bp-14h]@16 | |
3139 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 3140 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 3141 int v34; // [sp+24h] [bp-8h]@7 |
3142 char *v35; // [sp+28h] [bp-4h]@1 | |
3143 | |
484 | 3144 contract_approved = 0; |
0 | 3145 v2 = (_this - 200) % 3; |
3146 v3 = (_this - 200) / 3; | |
3147 v4 = v2; | |
3148 v35 = (char *)pNPCTopics[127].pText; | |
492 | 3149 dword_F8B1AC_award_bit_number = v3; |
0 | 3150 if ( v2 ) |
3151 { | |
3152 if ( v2 == 1 ) | |
3153 { | |
267 | 3154 gold_transaction_amount = 5000; |
0 | 3155 dword_F8B1B0 = 3; |
3156 } | |
3157 else | |
3158 { | |
3159 if ( v2 == 2 ) | |
3160 { | |
267 | 3161 gold_transaction_amount = 8000; |
0 | 3162 dword_F8B1B0 = 4; |
3163 } | |
3164 } | |
3165 } | |
3166 else | |
3167 { | |
267 | 3168 gold_transaction_amount = 2000; |
0 | 3169 dword_F8B1B0 = 2; |
3170 } | |
955 | 3171 pClassType = pPlayers[uActiveCharacter]->classType; |
3172 //v33 = pClassType; | |
3173 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
3174 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 3175 v7 = a1[0] & 0x3F; |
3176 v34 = v2 + 2; | |
3177 if ( v6 < v2 + 2 ) | |
3178 { | |
955 | 3179 //v8 = v33; |
0 | 3180 v9 = 0; |
955 | 3181 v10 = pClassType - pClassType % 4; |
3182 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 3183 do |
3184 { | |
3185 v12 = (unsigned __int8)*v11; | |
3186 v13 = &v28[4 * v9]; | |
3187 *(int *)v13 = 0; | |
3188 if ( v12 < v34 ) | |
3189 { | |
3190 v14 = 1; | |
3191 } | |
3192 else | |
3193 { | |
3194 v14 = 1; | |
3195 *(int *)v13 = 1; | |
3196 } | |
3197 ++v9; | |
3198 v11 += 37; | |
3199 } | |
3200 while ( v9 < 4 ); | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3201 __debugbreak(); // warning C4700: uninitialized local variable 'v29' used |
0 | 3202 if ( v29 == v14 ) |
3203 { | |
3204 v25 = pClassNames[v10 + 1]; | |
3205 } | |
3206 else | |
3207 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3208 __debugbreak(); // warning C4700: uninitialized local variable 'v30' used |
955 | 3209 if ( v30 == v14 )//crash |
0 | 3210 { |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1393
diff
changeset
|
3211 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used |
0 | 3212 if ( v31 == v14 ) |
3213 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3214 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
|
3215 return pTmpBuf.data(); |
0 | 3216 } |
3217 v25 = pClassNames[v10 + 2]; | |
3218 } | |
3219 else | |
3220 { | |
3221 if ( v31 != v14 ) | |
3222 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3223 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
|
3224 return pTmpBuf.data(); |
0 | 3225 } |
3226 v25 = pClassNames[v10 + 3]; | |
3227 } | |
3228 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3229 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3230 return pTmpBuf.data(); |
0 | 3231 } |
955 | 3232 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 3233 return (char *)pNPCTopics[122].pText; |
3234 if ( !v7 ) | |
3235 return (char *)pNPCTopics[131].pText; | |
3236 v16 = SkillToMastery(a1[0]); | |
3237 if ( (signed int)v16 > v4 + 1 ) | |
3238 return (char *)pNPCTopics[v4 + 128].pText; | |
3239 if ( v34 != 2 ) | |
3240 { | |
3241 if ( v34 == 3 ) | |
3242 { | |
3243 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
3244 { | |
492 | 3245 switch ( dword_F8B1AC_award_bit_number ) |
0 | 3246 { |
3247 case 12: | |
3248 case 13: | |
3249 case 14: | |
3250 case 15: | |
3251 case 16: | |
3252 case 17: | |
3253 case 18: | |
267 | 3254 gold_transaction_amount = 4000; |
0 | 3255 goto LABEL_42; |
3256 case 19: | |
3257 v19 = 114; | |
955 | 3258 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
3259 return v35; | |
3260 if ( !gold_transaction_amount ) | |
3261 goto LABEL_79; | |
3262 goto LABEL_42; | |
0 | 3263 case 20: |
3264 v19 = 110; | |
484 | 3265 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 3266 return v35; |
955 | 3267 if ( !gold_transaction_amount ) |
3268 goto LABEL_79; | |
3269 goto LABEL_42; | |
0 | 3270 case 22: |
955 | 3271 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
3272 if ( v20 < 50 ) | |
3273 return v35; | |
3274 if ( !gold_transaction_amount ) | |
3275 goto LABEL_79; | |
3276 goto LABEL_42; | |
0 | 3277 case 24: |
267 | 3278 gold_transaction_amount = 2500; |
955 | 3279 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 3280 if ( v20 < 50 ) |
3281 return v35; | |
955 | 3282 if ( !gold_transaction_amount ) |
3283 goto LABEL_79; | |
3284 goto LABEL_42; | |
3285 case 36: | |
3286 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
3287 if ( v20 < 50 ) | |
3288 return v35; | |
3289 if ( !gold_transaction_amount ) | |
3290 goto LABEL_79; | |
3291 goto LABEL_42; | |
0 | 3292 case 21: |
3293 case 23: | |
3294 case 25: | |
3295 case 26: | |
3296 case 29: | |
3297 case 32: | |
3298 case 34: | |
3299 case 35: | |
267 | 3300 gold_transaction_amount = 2500; |
0 | 3301 goto LABEL_42; |
3302 case 8: | |
3303 case 9: | |
3304 case 10: | |
3305 case 11: | |
267 | 3306 gold_transaction_amount = 3000; |
0 | 3307 goto LABEL_42; |
3308 case 7: | |
955 | 3309 gold_transaction_amount = 0; |
3310 if ( !gold_transaction_amount ) | |
3311 goto LABEL_79; | |
3312 goto LABEL_42; | |
3313 default: | |
3314 if ( !gold_transaction_amount ) | |
3315 goto LABEL_79; | |
3316 goto LABEL_42; | |
0 | 3317 } |
955 | 3318 gold_transaction_amount = 0; |
3319 if ( !gold_transaction_amount ) | |
3320 goto LABEL_79; | |
3321 goto LABEL_42; | |
0 | 3322 } |
3323 } | |
3324 else | |
3325 { | |
3326 if ( v34 != 4 ) | |
3327 { | |
955 | 3328 if ( !gold_transaction_amount ) |
3329 goto LABEL_79; | |
3330 goto LABEL_42; | |
0 | 3331 } |
3332 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
3333 { | |
492 | 3334 switch ( dword_F8B1AC_award_bit_number ) |
0 | 3335 { |
3336 case 19: | |
1355 | 3337 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x22u, 1) == 1 ) |
955 | 3338 { |
3339 if ( !gold_transaction_amount ) | |
3340 goto LABEL_79; | |
3341 goto LABEL_42; | |
3342 } | |
1355 | 3343 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Au, 1) == 1 ) |
955 | 3344 { |
3345 if ( !gold_transaction_amount ) | |
3346 goto LABEL_79; | |
3347 goto LABEL_42; | |
3348 } | |
3349 return v35; | |
0 | 3350 case 20: |
1355 | 3351 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x23u, 1) == 1 ) |
955 | 3352 { |
3353 if ( !gold_transaction_amount ) | |
3354 goto LABEL_79; | |
3355 goto LABEL_42; | |
3356 } | |
1355 | 3357 if ( pPlayers[uActiveCharacter]->ProfessionOrGuildFlagsCorrect(0x1Bu, 1) == 1 ) |
955 | 3358 { |
3359 if ( !gold_transaction_amount ) | |
3360 goto LABEL_79; | |
3361 goto LABEL_42; | |
3362 } | |
0 | 3363 return v35; |
3364 case 30: | |
955 | 3365 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 3366 if ( (v18 & 0x3Fu) < 0xA ) |
3367 return v35; | |
955 | 3368 if ( !gold_transaction_amount ) |
3369 goto LABEL_79; | |
3370 goto LABEL_42; | |
3371 case 31: | |
3372 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
3373 if ( (v18 & 0x3Fu) < 0xA ) | |
3374 return v35; | |
3375 if ( !gold_transaction_amount ) | |
3376 goto LABEL_79; | |
3377 goto LABEL_42; | |
0 | 3378 case 21: |
3379 case 23: | |
3380 case 24: | |
3381 case 25: | |
3382 case 26: | |
3383 case 29: | |
3384 case 32: | |
3385 case 34: | |
3386 case 35: | |
267 | 3387 gold_transaction_amount = 6000; |
0 | 3388 goto LABEL_42; |
3389 case 8: | |
3390 case 9: | |
3391 case 10: | |
3392 case 11: | |
267 | 3393 gold_transaction_amount = 7000; |
0 | 3394 goto LABEL_42; |
3395 case 7: | |
3396 break; | |
955 | 3397 default: |
3398 if ( !gold_transaction_amount ) | |
3399 goto LABEL_79; | |
3400 goto LABEL_42; | |
0 | 3401 } |
267 | 3402 gold_transaction_amount = 0; |
955 | 3403 if ( !gold_transaction_amount ) |
3404 goto LABEL_79; | |
3405 goto LABEL_42; | |
0 | 3406 } |
3407 } | |
3408 return v35; | |
3409 } | |
3410 if ( v7 < 4 ) | |
3411 return v35; | |
492 | 3412 if ( dword_F8B1AC_award_bit_number > 27 ) |
3413 { | |
3414 if ( dword_F8B1AC_award_bit_number != 29 | |
3415 && dword_F8B1AC_award_bit_number != 32 | |
3416 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 3417 { |
267 | 3418 if ( !gold_transaction_amount ) |
0 | 3419 goto LABEL_79; |
3420 goto LABEL_42; | |
3421 } | |
267 | 3422 gold_transaction_amount = 500; |
955 | 3423 if ( !gold_transaction_amount ) |
3424 goto LABEL_79; | |
3425 goto LABEL_42; | |
0 | 3426 } |
492 | 3427 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 3428 { |
3429 gold_transaction_amount = 500; | |
3430 if ( !gold_transaction_amount ) | |
3431 goto LABEL_79; | |
3432 goto LABEL_42; | |
3433 } | |
492 | 3434 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 3435 { |
267 | 3436 gold_transaction_amount = 0; |
0 | 3437 goto LABEL_79; |
3438 } | |
492 | 3439 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 3440 { |
3441 if ( !gold_transaction_amount ) | |
3442 goto LABEL_79; | |
3443 goto LABEL_42; | |
3444 } | |
492 | 3445 if ( dword_F8B1AC_award_bit_number > 18 ) |
3446 { | |
3447 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 3448 { |
3449 if ( !gold_transaction_amount ) | |
3450 goto LABEL_79; | |
3451 goto LABEL_42; | |
3452 } | |
3453 gold_transaction_amount = 500; | |
3454 if ( !gold_transaction_amount ) | |
3455 goto LABEL_79; | |
3456 goto LABEL_42; | |
0 | 3457 } |
267 | 3458 gold_transaction_amount = 1000; |
0 | 3459 LABEL_42: |
267 | 3460 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 3461 return (char *)pNPCTopics[124].pText; |
3462 LABEL_79: | |
484 | 3463 contract_approved = 1; |
0 | 3464 if ( v34 == 2 ) |
3465 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3466 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 3467 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
|
3468 return pTmpBuf2.data(); |
0 | 3469 } |
3470 if ( v34 == 3 ) | |
3471 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3472 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3473 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
|
3474 return pTmpBuf2.data(); |
0 | 3475 } |
3476 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3477 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 3478 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
|
3479 return pTmpBuf2.data(); |
0 | 3480 } |
3481 | |
3482 //----- (004B3E1E) -------------------------------------------------------- | |
1458 | 3483 void sub_4B3E1E() |
0 | 3484 { |
3485 NPCData *v0; // ST40_4@1 | |
3486 signed int v1; // edi@1 | |
165 | 3487 //GUIWindow *v2; // ecx@1 |
0 | 3488 |
167 | 3489 __debugbreak(); |
602 | 3490 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 3491 v1 = 0; |
3492 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
3493 pDialogueWindow->Release(); | |
165 | 3494 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 3495 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 3496 { |
832 | 3497 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 3498 v1 = 1; |
3499 } | |
832 | 3500 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 3501 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 3502 } |
3503 | |
3504 | |
3505 //----- (004B3FE5) -------------------------------------------------------- | |
3506 void __fastcall sub_4B3FE5(int a4) | |
3507 { | |
3508 int v1; // edi@1 | |
3509 char *v2; // edi@1 | |
1411 | 3510 |
3511 __debugbreak(); | |
0 | 3512 v1 = a4; |
3513 uDialogueType = 78; | |
827 | 3514 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 3515 _4B254D_SkillMasteryTeacher(a4); |
3516 pDialogueWindow->Release(); | |
3517 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
3518 v2 = ""; | |
832 | 3519 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 3520 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 3521 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 3522 if ( contract_approved ) |
0 | 3523 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 3524 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 3525 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 3526 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 3527 } |
3528 // F8B19C: using guessed type int dword_F8B19C; | |
3529 // F8B1A8: using guessed type int dword_F8B1A8; | |
3530 | |
3531 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 3532 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
1411 | 3533 { |
0 | 3534 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
3535 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 3536 v4 = pFontLucida->AlignText_Center(450, Str); |
3537 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 3538 } |
3539 | |
3540 //----- (004B46F8) -------------------------------------------------------- | |
1459 | 3541 __int64 GetExperienceRequiredForLevel(int level) |
0 | 3542 { |
1459 | 3543 __int64 v1; // eax@1 |
0 | 3544 int i; // edx@1 |
3545 | |
3546 v1 = 0; | |
1459 | 3547 for ( i = 0; i < level; ++i ) |
0 | 3548 v1 += i + 1; |
3549 return 1000 * v1; | |
3550 } | |
3551 | |
3552 //----- (004BC49B) -------------------------------------------------------- | |
651 | 3553 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 3554 { |
656 | 3555 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3556 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3557 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3558 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3559 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3560 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3561 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3562 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3563 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3564 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3565 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3566 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3567 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3568 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3569 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3570 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3571 //v1 = _this; |
656 | 3572 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
3573 //v3 = v1; |
656 | 3574 uDialogueType = newDialogueType; |
3575 if (!speakingNPC->uFlags) | |
3576 { | |
3577 speakingNPC->uFlags = 1; | |
3578 //v3 = uDialogueType; | |
3579 } | |
3580 | |
3581 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
3582 { | |
3583 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
3584 } | |
3585 else if(newDialogueType == DIALOGUE_76) | |
3586 { | |
3587 if (speakingNPC->Hired()) | |
3588 { | |
3589 v8 = 0; | |
3590 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3591 { | |
3592 v6 = (char *)pNPCStats->pNewNPCData; | |
3593 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3594 { | |
3595 ++v8; | |
3596 v6 += 76; | |
3597 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3598 break; | |
3599 } | |
3600 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
3601 v6[8] &= 0x7Fu; | |
3602 } | |
1104 | 3603 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3604 { |
3605 v11 = pParty->pHirelings; | |
3606 memset(v11, 0, sizeof(NPCData)); | |
3607 } | |
1104 | 3608 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3609 { |
3610 v11 = &pParty->pHirelings[1]; | |
3611 memset(v11, 0, sizeof(NPCData)); | |
3612 } | |
3613 pParty->field_709 = 0; | |
1035 | 3614 pParty->CountHirelings(); |
656 | 3615 dword_591084 = 0; |
3616 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3617 dword_7241C8 = 0; | |
3618 return; | |
3619 } | |
3620 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
3621 { | |
3622 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
3623 ShowStatusBarString(v7, 2u); | |
3624 } | |
3625 else | |
3626 { | |
3627 //v9 = v2->uProfession; | |
3628 if ( speakingNPC->uProfession != 51 ) | |
3629 { | |
3630 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
3631 if ( pParty->uNumGold < v10 ) | |
3632 { | |
3633 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
3634 dialogue_show_profession_details = false; | |
3635 uDialogueType = 13; | |
3636 if ( uActiveCharacter ) | |
3637 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
3638 v7 = pGlobalTXT_LocalizationStrings[155]; | |
3639 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
3640 if ( !dword_7241C8 ) | |
3641 pGame->Draw(); | |
3642 dword_7241C8 = 0; | |
3643 return; | |
3644 } | |
3645 Party::TakeGold(v10); | |
3646 } | |
3647 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
3648 if ( pParty->pHirelings[0].pName ) | |
3649 { | |
3650 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
3651 v15 = speakingNPC->pName; | |
3652 v13 = pParty->pHireling2Name; | |
3653 } | |
3654 else | |
3655 { | |
3656 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
3657 v15 = speakingNPC->pName; | |
3658 v13 = pParty->pHireling1Name; | |
3659 } | |
3660 strcpy(v13, v15); | |
3661 pParty->field_709 = 0; | |
1035 | 3662 pParty->CountHirelings(); |
656 | 3663 |
3664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3665 | |
711 | 3666 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 3667 pDialogue_SpeakingActor->uAIState = Removed; |
3668 if ( uActiveCharacter ) | |
3669 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
3670 } | |
3671 } | |
3672 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
3673 { | |
3674 ArenaFight(); | |
3675 return; | |
3676 } | |
1413 | 3677 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY) |
656 | 3678 { |
1413 | 3679 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0) |
656 | 3680 { |
1413 | 3681 if ( speakingNPC->uProfession != GateMaster ) |
656 | 3682 speakingNPC->bHasUsedTheAbility = 1; |
3683 | |
3684 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3685 } | |
3686 else | |
1413 | 3687 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!" |
656 | 3688 } |
3689 else if(newDialogueType == DIALOGUE_13) | |
3690 { | |
3691 if (!speakingNPC->Hired()) | |
3692 { | |
3693 sub_4B3E1E(); | |
3694 dialogue_show_profession_details = false; | |
3695 } | |
3696 else | |
3697 { | |
3698 v5 = 0; | |
3699 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
3700 { | |
3701 v6 = (char *)pNPCStats->pNewNPCData; | |
3702 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
3703 { | |
3704 ++v5; | |
3705 v6 += 76; | |
3706 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
3707 break; | |
3708 } | |
3709 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
3710 v6[8] &= 0x7Fu; | |
3711 } | |
1104 | 3712 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 3713 { |
3714 v11 = pParty->pHirelings; | |
3715 memset(v11, 0, sizeof(NPCData)); | |
3716 } | |
1104 | 3717 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 3718 { |
3719 v11 = &pParty->pHirelings[1]; | |
3720 memset(v11, 0, sizeof(NPCData)); | |
3721 } | |
3722 pParty->field_709 = 0; | |
1035 | 3723 pParty->CountHirelings(); |
656 | 3724 dword_591084 = 0; |
3725 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
3726 dword_7241C8 = 0; | |
3727 return; | |
3728 } | |
3729 } | |
3730 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
3731 { | |
3732 switch(newDialogueType) | |
3733 { | |
3734 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
3735 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
3736 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
3737 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
3738 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
3739 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
3740 } | |
3741 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
3742 sub_4B3FE5(npc_event_id); //200-310 | |
3743 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
3744 { //400-410 | |
3745 dword_F8B1D8 = newDialogueType; | |
3746 DrawJoinGuildWindow(npc_event_id - 400); | |
3747 } | |
3748 else | |
3749 { | |
3750 switch ( npc_event_id ) | |
3751 { | |
3752 case 139: | |
1459 | 3753 OracleDialogue(); |
656 | 3754 break; |
3755 case 311: | |
3756 sub_4BBA85_bounties(); | |
3757 break; | |
3758 case 399: | |
1459 | 3759 __debugbreak(); // what kind of dialogue is that? |
656 | 3760 sub_4BBCDD(); |
3761 break; | |
3762 default: | |
3763 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 3764 current_npc_text = 0; |
656 | 3765 EventProcessor(npc_event_id, 0, 1); |
3766 activeLevelDecoration = NULL; | |
3767 break; | |
3768 } | |
3769 } | |
3770 } | |
3771 if ( !dword_7241C8 ) | |
3772 pGame->Draw(); | |
3773 dword_7241C8 = 0; | |
3774 } | |
0 | 3775 |
3776 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 3777 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 3778 { |
3779 int v6; // edx@8 | |
3780 int v7; // edx@9 | |
3781 int v8; // edx@10 | |
3782 unsigned __int8 v9; // zf@16 | |
3783 char v10; // sf@16 | |
3784 unsigned __int8 v11; // of@16 | |
702 | 3785 bool test; |
0 | 3786 |
907 | 3787 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
3788 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 3789 return 0; |
907 | 3790 switch( p2DEvents[_2da_idx - 1].uType ) |
3791 { | |
1411 | 3792 case BuildingType_WeaponShop: |
907 | 3793 { |
3794 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
3795 break; | |
3796 } | |
1411 | 3797 case BuildingType_ArmorShop: |
907 | 3798 { |
3799 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
3800 break; | |
3801 } | |
1411 | 3802 case BuildingType_MagicShop: |
907 | 3803 { |
3804 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
3805 break; | |
3806 } | |
1411 | 3807 case BuildingType_AlchemistShop: |
907 | 3808 { |
3809 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
3810 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
3811 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
3812 break; | |
3813 } | |
3814 default: | |
3815 { | |
3816 test = false; | |
3817 break; | |
3818 } | |
3819 } | |
702 | 3820 return test; |
3821 /* | |
3822 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 3823 { |
3824 v11 = __OFSUB__(v5, 2); | |
3825 v9 = v5 == 2; | |
3826 v10 = v5 - 2 < 0; | |
3827 goto LABEL_23; | |
3828 } | |
702 | 3829 if ( p2DEvents[a2 - 1].uType > 2 ) |
3830 { | |
3831 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 3832 { |
3833 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
3834 return v5 == 16; | |
3835 return 1; | |
3836 } | |
702 | 3837 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 3838 return 0; |
702 | 3839 if ( p2DEvents[a2 - 1].uType == 4) |
3840 { | |
3841 if ( v5 < 13 ) | |
3842 return 0; | |
3843 if ( v5 <= 14 ) | |
3844 return 1; | |
3845 if ( v5 != 17 || (signed int)v3 < 740 ) | |
3846 return 0; | |
3847 v11 = __OFSUB__(v3, 771); | |
3848 v9 = v3 == 771; | |
3849 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 3850 LABEL_23: |
702 | 3851 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
3852 return 0; | |
3853 return 1; | |
3854 } | |
3855 } | |
3856 if ( p2DEvents[a2 - 1].uType == 2 ) | |
3857 { | |
3858 if ( v5 >= 3 ) | |
3859 { | |
3860 v11 = __OFSUB__(v5, 9); | |
3861 v9 = v5 == 9; | |
3862 v10 = v5 - 9 < 0; | |
3863 goto LABEL_23; | |
3864 } | |
0 | 3865 } |
3866 return 0; | |
702 | 3867 */ |
0 | 3868 } |
3869 | |
1209 | 3870 |
0 | 3871 |