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