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