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