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