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