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