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