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