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