Mercurial > mm7
annotate mm7_4.cpp @ 1255:7e5e328454c7
zero size array warning in guifont silenced
author | Grumpy7 |
---|---|
date | Tue, 11 Jun 2013 23:10:30 +0200 |
parents | b9747d9e9b4e |
children | 0aeac0b9ca30 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
198 | 5 #include <assert.h> |
0 | 6 |
1016 | 7 #include "VideoPlayer.h" |
8 #include "Sprites.h" | |
9 #include "BSPModel.h" | |
10 #include "OutdoorCamera.h" | |
11 #include "Mouse.h" | |
12 #include "stru6.h" | |
13 #include "stru11.h" | |
14 #include "stru12.h" | |
15 | |
16 #include "LightmapBuilder.h" | |
341 | 17 #include "MM7.h" |
0 | 18 #include "MapInfo.h" |
19 #include "Game.h" | |
20 #include "GUIWindow.h" | |
21 #include "GUIFont.h" | |
22 #include "Party.h" | |
23 #include "AudioPlayer.h" | |
24 #include "Outdoor.h" | |
25 #include "IndoorCamera.h" | |
26 #include "LOD.h" | |
27 #include "Actor.h" | |
28 #include "Allocator.h" | |
29 #include "Events.h" | |
30 #include "Viewport.h" | |
31 #include "FrameTableInc.h" | |
32 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
33 #include "SpriteObject.h" |
0 | 34 #include "ObjectList.h" |
35 #include "DecorationList.h" | |
36 #include "Time.h" | |
37 #include "IconFrameTable.h" | |
38 #include "PlayerFrameTable.h" | |
39 #include "Awards.h" | |
40 #include "TurnEngine.h" | |
41 #include "Events2D.h" | |
42 #include "stru159.h" | |
189 | 43 #include "texts.h" |
0 | 44 #include "Log.h" |
629 | 45 #include "UIHouses.h" |
0 | 46 |
47 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 48 void __cdecl check_event_triggers() |
0 | 49 { |
50 int v0; // eax@1 | |
51 LevelDecoration *v1; // esi@2 | |
52 signed int v2; // edi@2 | |
53 int v3; // ebx@2 | |
54 int v4; // eax@3 | |
55 int v5; // ebx@3 | |
56 unsigned int v6; // ecx@3 | |
57 unsigned int v7; // edx@6 | |
58 unsigned int v8; // edx@8 | |
112 | 59 Actor *v9; // edi@13 |
0 | 60 int v10; // ebx@14 |
61 int v11; // eax@14 | |
62 int v12; // ebx@14 | |
63 unsigned int v13; // ecx@14 | |
64 int v14; // edx@15 | |
65 unsigned int v15; // edx@17 | |
66 unsigned int v16; // edx@19 | |
67 char *v17; // edi@25 | |
68 int v18; // ebx@26 | |
69 int v19; // eax@26 | |
70 int v20; // ebx@26 | |
71 unsigned int v21; // ecx@26 | |
72 int v22; // edx@27 | |
73 unsigned int v23; // edx@29 | |
74 unsigned int v24; // edx@31 | |
75 int v25; // [sp+0h] [bp-24h]@3 | |
76 int v26; // [sp+0h] [bp-24h]@14 | |
77 int v27; // [sp+0h] [bp-24h]@26 | |
78 int v28; // [sp+4h] [bp-20h]@3 | |
79 int v29; // [sp+4h] [bp-20h]@14 | |
80 int v30; // [sp+4h] [bp-20h]@26 | |
81 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
82 int v32; // [sp+Ch] [bp-18h]@2 | |
83 int v33; // [sp+10h] [bp-14h]@2 | |
84 int i; // [sp+14h] [bp-10h]@1 | |
85 int v35; // [sp+18h] [bp-Ch]@2 | |
86 int v36; // [sp+1Ch] [bp-8h]@3 | |
87 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
88 signed int v38; // [sp+20h] [bp-4h]@24 | |
89 | |
90 v0 = 0; | |
91 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
92 { | |
93 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
94 v2 = v1->field_18; | |
95 v3 = v1->vPosition.y; | |
96 v33 = v1->vPosition.x; | |
97 v32 = v1->vPosition.y; | |
98 v35 = v1->vPosition.z; | |
99 v31 = v1->field_18; | |
100 if ( v1->field_2 & 1 ) | |
101 { | |
102 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
103 v25 = abs(v3 - pParty->vPosition.y); | |
104 v28 = abs(v35 - pParty->vPosition.z); | |
105 v4 = v36; | |
106 v5 = v25; | |
107 v6 = v28; | |
108 if ( v36 < v25 ) | |
109 { | |
110 v4 = v25; | |
111 v5 = v36; | |
112 } | |
113 if ( v4 < v28 ) | |
114 { | |
115 v7 = v4; | |
116 v4 = v28; | |
117 v6 = v7; | |
118 } | |
119 if ( v5 < (signed int)v6 ) | |
120 { | |
121 v8 = v6; | |
122 v6 = v5; | |
123 v5 = v8; | |
124 } | |
125 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 126 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 127 } |
128 if ( v1->field_2 & 2 ) | |
129 { | |
130 v37 = 0; | |
131 if ( (signed int)uNumActors > 0 ) | |
132 { | |
1202 | 133 v9 = pActors.data();//[0].vPosition.y; |
0 | 134 do |
135 { | |
112 | 136 v10 = abs(v33 - v9->vPosition.x); |
137 v29 = abs(v32 - v9->vPosition.y); | |
138 v26 = abs(v35 - v9->vPosition.z); | |
0 | 139 v11 = v10; |
140 v12 = v29; | |
141 v13 = v26; | |
142 if ( v11 < v29 ) | |
143 { | |
144 v14 = v11; | |
145 v11 = v29; | |
146 v12 = v14; | |
147 } | |
148 if ( v11 < v26 ) | |
149 { | |
150 v15 = v11; | |
151 v11 = v26; | |
152 v13 = v15; | |
153 } | |
154 if ( v12 < (signed int)v13 ) | |
155 { | |
156 v16 = v13; | |
157 v13 = v12; | |
158 v12 = v16; | |
159 } | |
160 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
161 EventProcessor(v1->field_16_event_id, 0, 1); | |
162 ++v37; | |
112 | 163 ++v9; |
0 | 164 } |
165 while ( v37 < (signed int)uNumActors ); | |
166 } | |
167 } | |
168 if ( v1->field_2 & 4 ) | |
169 { | |
170 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
171 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
172 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
173 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 174 do |
175 { | |
176 v18 = abs(v33 - *((int *)v17 - 1)); | |
177 v30 = abs(v32 - *(int *)v17); | |
178 v27 = abs(v35 - *((int *)v17 + 1)); | |
179 v19 = v18; | |
180 v20 = v30; | |
181 v21 = v27; | |
182 if ( v19 < v30 ) | |
183 { | |
184 v22 = v19; | |
185 v19 = v30; | |
186 v20 = v22; | |
187 } | |
188 if ( v19 < v27 ) | |
189 { | |
190 v23 = v19; | |
191 v19 = v27; | |
192 v21 = v23; | |
193 } | |
194 if ( v20 < (signed int)v21 ) | |
195 { | |
196 v24 = v21; | |
197 v21 = v20; | |
198 v20 = v24; | |
199 } | |
200 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
201 EventProcessor(v1->field_16_event_id, 0, 1); | |
202 ++v38; | |
203 v17 += 112; | |
204 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
205 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 206 } |
207 } | |
208 v0 = i + 1; | |
209 } | |
210 } | |
211 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
212 | |
213 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 214 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 215 { |
216 int v13; // ecx@13 | |
217 signed int v14; // ebx@14 | |
218 int v15; // eax@16 | |
729 | 219 //int v16; // edx@19 |
792 | 220 //int v17; // ST18_4@19 |
221 //signed int v18; // edx@19 | |
222 //signed __int64 v19; // qtt@19 | |
0 | 223 int v21; // eax@27 |
792 | 224 //int v22; // ecx@29 |
0 | 225 signed int v28; // eax@45 |
226 int v29; // ebx@47 | |
227 int v30; // edx@49 | |
830 | 228 //int v31; // ST10_4@49 |
229 //signed int v32; // edx@49 | |
0 | 230 signed __int64 v33; // qtt@49 |
830 | 231 //signed int v34; // eax@54 |
232 //signed int v35; // esi@56 | |
233 //int result; // eax@57 | |
0 | 234 int v38; // edx@62 |
792 | 235 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 236 bool v47; // [sp+24h] [bp-1Ch]@43 |
237 bool v48; // [sp+28h] [bp-18h]@10 | |
238 bool v49; // [sp+28h] [bp-18h]@41 | |
239 bool v50; // [sp+2Ch] [bp-14h]@12 | |
240 signed int v53; // [sp+30h] [bp-10h]@10 | |
241 signed int v54; // [sp+30h] [bp-10h]@41 | |
242 signed int v55; // [sp+34h] [bp-Ch]@1 | |
243 | |
730 | 244 //LOG_DECOMPILATION_WARNING(); |
245 | |
246 static int blv_floor_id[50]; // 00721200 | |
247 static int blv_floor_level[50]; // 007212C8 | |
248 | |
249 static __int16 word_721390_ys[104]; // idb | |
250 static __int16 word_721460_xs[104]; // idb | |
0 | 251 |
252 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 253 v55 = 0; |
0 | 254 for (uint i = 0; i < pSector->uNumFloors; ++i) |
255 { | |
256 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
257 if (pFloor->Clickable()) | |
258 continue; | |
259 | |
792 | 260 assert(pFloor->uNumVertices); |
0 | 261 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
262 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
263 { | |
264 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
265 { | |
730 | 266 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
267 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
268 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
269 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 270 } |
730 | 271 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
272 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
273 | |
792 | 274 v50 = word_721390_ys[0] >= y; |
0 | 275 v53 = 0; |
792 | 276 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
277 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 278 { |
279 if (v53 >= 2) | |
280 break; | |
281 | |
282 v48 = v50; | |
283 v50 = word_721390_ys[j + 1] >= y; | |
730 | 284 |
285 v13 = i; | |
792 | 286 if (v48 == v50) |
287 continue; | |
288 | |
289 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
1110 | 290 v15 = v14 | (word_721460_xs[j] < x); |
792 | 291 |
292 if (v15 == 3) | |
293 continue; | |
294 else if (!v15) | |
295 ++v53; | |
296 else | |
0 | 297 { |
792 | 298 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 299 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 300 |
301 if (res + word_721460_xs[j] >= x) | |
729 | 302 ++v53; |
0 | 303 } |
792 | 304 } |
305 | |
306 | |
0 | 307 if ( v53 == 1 ) |
308 { | |
309 if ( v55 >= 50 ) | |
310 break; | |
723 | 311 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 312 { |
725 | 313 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 314 } |
315 else | |
316 { | |
871 | 317 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 318 } |
792 | 319 blv_floor_level[v55] = v21; |
320 blv_floor_id[v55] = pSector->pFloors[i]; | |
321 v55++; | |
0 | 322 } |
792 | 323 } |
324 } | |
325 | |
326 | |
0 | 327 if ( pSector->field_0 & 8 ) |
328 { | |
329 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
330 { | |
331 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
332 if (portal->uPolygonType != POLYGON_Floor) | |
333 continue; | |
334 | |
830 | 335 if (!portal->uNumVertices) |
336 continue; | |
337 | |
723 | 338 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
339 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
340 { | |
0 | 341 for (uint j = 0; j < portal->uNumVertices; ++j) |
342 { | |
730 | 343 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
344 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
345 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
346 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
347 } | |
348 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
349 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 350 v54 = 0; |
830 | 351 v47 = word_721390_ys[0] >= y; |
352 | |
353 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 354 { |
830 | 355 v49 = v47; |
0 | 356 if ( v54 >= 2 ) |
357 break; | |
830 | 358 v47 = word_721390_ys[j + 1] >= y; |
0 | 359 if ( v49 != v47 ) |
360 { | |
830 | 361 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
362 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 363 if ( v29 != 3 ) |
364 { | |
723 | 365 if ( !v29 ) |
729 | 366 ++v54; |
367 else | |
368 { | |
830 | 369 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 370 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 371 if (res + word_721460_xs[j] >= x) |
723 | 372 ++v54; |
729 | 373 } |
0 | 374 } |
375 } | |
376 } | |
377 if ( v54 == 1 ) | |
378 { | |
379 if ( v55 >= 50 ) | |
380 break; | |
830 | 381 blv_floor_level[v55] = -29000; |
382 blv_floor_id[v55] = pSector->pPortals[i]; | |
383 v55++; | |
0 | 384 } |
385 } | |
386 } | |
387 } | |
388 if ( v55 == 1 ) | |
389 { | |
730 | 390 *pFaceID = blv_floor_id[0]; |
725 | 391 return blv_floor_level[0]; |
0 | 392 } |
393 if ( !v55 ) | |
394 return -30000; | |
730 | 395 *pFaceID = blv_floor_id[0]; |
725 | 396 //result = blv_floor_level[0]; |
830 | 397 |
398 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 399 { |
725 | 400 if ( blv_floor_level[0] <= z + 5 ) |
401 { | |
402 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 403 continue; |
725 | 404 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 405 *pFaceID = blv_floor_id[v35]; |
717 | 406 continue; |
407 } | |
725 | 408 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
409 { | |
410 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 411 *pFaceID = blv_floor_id[v35]; |
717 | 412 } |
830 | 413 }*/ |
414 | |
415 | |
416 int result = blv_floor_level[0]; | |
417 for (uint i = 1; i < v55; ++i) | |
418 { | |
419 v38 = blv_floor_level[i]; | |
420 if ( result <= z + 5 ) | |
421 { | |
422 if ( v38 > result && v38 <= z + 5 ) | |
423 { | |
424 result = blv_floor_level[i]; | |
425 *pFaceID = blv_floor_id[i]; | |
426 } | |
427 } | |
428 else if ( v38 < result ) | |
429 { | |
430 result = blv_floor_level[i]; | |
431 *pFaceID = blv_floor_id[i]; | |
432 } | |
433 } | |
434 | |
435 return result; | |
0 | 436 } |
437 | |
438 //----- (0046D49E) -------------------------------------------------------- | |
791 | 439 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 440 { |
723 | 441 BSPModel *pBModel; // esi@4 |
442 ODMFace *pFace; // ecx@11 | |
0 | 443 int v14; // edx@20 |
444 signed int v18; // edx@26 | |
445 int v19; // eax@28 | |
446 int v20; // edx@30 | |
447 int v21; // ST1C_4@30 | |
448 signed int v22; // edx@30 | |
449 signed __int64 v23; // qtt@30 | |
450 int v24; // eax@36 | |
451 signed int v25; // ecx@38 | |
452 int result; // eax@42 | |
453 signed int v27; // ecx@43 | |
454 int v28; // edi@44 | |
455 signed int v29; // edx@44 | |
456 int v30; // esi@45 | |
457 int v31; // eax@45 | |
458 ODMFace *v32; // eax@57 | |
459 int v33; // ecx@59 | |
460 int v36; // [sp+14h] [bp-2Ch]@24 | |
461 int v38; // [sp+1Ch] [bp-24h]@2 | |
462 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 463 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
464 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 465 bool v43; // [sp+30h] [bp-10h]@22 |
466 bool v44; // [sp+34h] [bp-Ch]@24 | |
467 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
468 signed int v48; // [sp+58h] [bp+18h]@22 | |
469 signed int v49; // [sp+58h] [bp+18h]@43 | |
470 | |
471 v46 = 1; | |
472 dword_721160[0] = -1; | |
473 dword_721110[0] = -1; | |
791 | 474 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 475 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 476 { |
477 *a6 = 0; | |
725 | 478 return odm_floor_level[0]; |
723 | 479 } |
0 | 480 v38 = 0; |
723 | 481 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
482 { | |
483 pBModel = &pOutdoor->pBModels[v38]; | |
484 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
485 { | |
486 if ( (signed int)pBModel->uNumFaces > 0 ) | |
487 { | |
488 v39 = 0; | |
489 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
490 { | |
491 pFace = &pBModel->pFaces[v39]; | |
492 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
493 && !(pFace->uAttributes & 0x20000000) | |
494 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
495 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 496 { |
723 | 497 if ( pFace->uNumVertices ) |
0 | 498 { |
723 | 499 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 500 { |
723 | 501 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
502 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
503 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
504 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
505 } | |
506 } | |
507 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
508 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
509 v43 = word_720F70[0] >= Y; | |
510 v48 = 0; | |
511 if ( 2 * pFace->uNumVertices > 0 ) | |
512 { | |
513 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
514 { | |
515 if ( v48 >= 2 ) | |
516 break; | |
517 v36 = word_720F70[i + 1]; | |
518 v44 = word_720F70[i + 1] >= Y; | |
519 if ( v43 != v44 ) | |
0 | 520 { |
723 | 521 v18 = word_721040[i + 1] >= X ? 0 : 2; |
1110 | 522 v19 = v18 | (word_721040[i] < X); |
723 | 523 if ( v19 != 3 ) |
0 | 524 { |
723 | 525 if ( !v19 ) |
740 | 526 ++v48; |
527 else | |
0 | 528 { |
723 | 529 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
530 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
531 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
532 if ( v22 >= X) | |
533 ++v48; | |
0 | 534 } |
535 } | |
536 } | |
723 | 537 v43 = v44; |
538 } | |
539 if ( v48 == 1 ) | |
540 { | |
541 if ( v46 >= 20 ) | |
0 | 542 break; |
723 | 543 if ( pFace->uPolygonType == POLYGON_Floor ) |
544 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
545 else | |
725 | 546 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
547 + HIWORD(pFace->zCalc3); | |
723 | 548 v25 = v46++; |
725 | 549 odm_floor_level[v25] = v24; |
723 | 550 dword_721160[v25] = pBModelNum; |
551 dword_721110[v25] = pFaceNum; | |
0 | 552 } |
553 } | |
554 } | |
723 | 555 ++v39; |
556 } | |
557 } | |
558 } | |
0 | 559 ++v38; |
560 } | |
561 if ( v46 == 1 ) | |
562 { | |
563 *a6 = 0; | |
725 | 564 return odm_floor_level[0]; |
0 | 565 } |
566 v27 = 0; | |
567 if ( v46 <= 1 ) | |
568 *a6 = 0; | |
723 | 569 else |
570 { | |
725 | 571 //v29 = 1; |
723 | 572 for ( v49 = 1; v49 < v46; ++v49 ) |
573 { | |
725 | 574 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 575 { |
576 v27 = v49; | |
725 | 577 //++v29; |
723 | 578 break; |
579 } | |
725 | 580 if ( odm_floor_level[0] > Z + 5 ) |
581 { | |
582 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
583 { | |
584 //++v29; | |
723 | 585 break; |
586 } | |
587 v27 = v49; | |
725 | 588 //++v29; |
723 | 589 break; |
590 } | |
725 | 591 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 592 { |
593 v27 = v49; | |
725 | 594 //++v29; |
723 | 595 } |
596 } | |
597 if ( !v27 ) | |
598 *a6 = 0; | |
599 else | |
600 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
601 } | |
0 | 602 if ( v27 ) |
603 { | |
604 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 605 *pIsOnWater = false; |
606 if ( v32->Fluid()) | |
607 *pIsOnWater = true; | |
0 | 608 } |
725 | 609 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
610 odm_floor_level[0] = odm_floor_level[v27]; | |
611 return odm_floor_level[0]; | |
0 | 612 } |
613 | |
614 //----- (0046D8E3) -------------------------------------------------------- | |
615 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
616 { | |
617 int v4; // ebx@1 | |
618 unsigned int v5; // ecx@1 | |
619 BSPModel *v6; // edi@3 | |
620 ODMFace *v7; // esi@10 | |
621 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
622 signed __int16 *v9; // eax@18 |
0 | 623 int v10; // edx@19 |
624 int v11; // ecx@21 | |
625 int v12; // ecx@23 | |
626 signed int v13; // eax@25 | |
627 int v14; // edx@27 | |
628 int v15; // edx@29 | |
629 int v16; // ST18_4@29 | |
630 signed int v17; // edx@29 | |
631 signed __int64 v18; // qtt@29 | |
632 int v19; // eax@35 | |
633 signed int v20; // ecx@37 | |
634 signed int v22; // ebx@42 | |
635 unsigned int v23; // esi@43 | |
636 int v24; // edx@44 | |
637 int v25; // eax@44 | |
638 int v26; // [sp+Ch] [bp-38h]@7 | |
639 int v27; // [sp+10h] [bp-34h]@21 | |
640 int v28; // [sp+18h] [bp-2Ch]@21 | |
641 int v29; // [sp+1Ch] [bp-28h]@2 | |
642 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
643 signed int v31; // [sp+24h] [bp-20h]@1 | |
644 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
645 int v33; // [sp+2Ch] [bp-18h]@7 | |
646 bool v34; // [sp+30h] [bp-14h]@21 | |
647 bool v35; // [sp+34h] [bp-10h]@23 | |
648 signed int v36; // [sp+38h] [bp-Ch]@17 | |
649 signed int v37; // [sp+38h] [bp-Ch]@21 | |
650 signed int v38; // [sp+38h] [bp-Ch]@42 | |
651 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
652 signed int v40; // [sp+40h] [bp-4h]@1 | |
653 | |
654 dword_720ED0[0] = -1; | |
655 dword_720E80[0] = -1; | |
656 v4 = a1; | |
657 v5 = 0; | |
658 v40 = a2; | |
659 v31 = v4; | |
660 v39 = 1; | |
661 dword_720F20[0] = 10000; | |
662 v32 = 0; | |
663 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
664 { | |
665 v29 = 0; | |
666 do | |
667 { | |
668 v6 = &pOutdoor->pBModels[v29]; | |
669 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
670 { | |
671 if ( v4 >= v6->sMinX ) | |
672 { | |
673 if ( v40 <= v6->sMaxY ) | |
674 { | |
675 if ( v40 >= v6->sMinY ) | |
676 { | |
677 v33 = v5; | |
678 v26 = v6->uNumFaces; | |
679 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
680 { | |
681 v30 = v5; | |
682 while ( 1 ) | |
683 { | |
684 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
685 v8 = v7->uPolygonType; | |
686 if ( (v8 == 5 || v8 == 6) | |
687 && !(BYTE3(v7->uAttributes) & 0x20) | |
688 && v4 <= v7->pBoundingBox.x2 | |
689 && v4 >= v7->pBoundingBox.x1 | |
690 && v40 <= v7->pBoundingBox.y2 | |
691 && v40 >= v7->pBoundingBox.y1 ) | |
692 { | |
693 v36 = v5; | |
694 if ( v7->uNumVertices ) | |
695 { | |
696 v9 = v7->pXInterceptDisplacements; | |
697 do | |
698 { | |
699 v10 = 2 * v36; | |
700 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
701 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
702 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
703 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
704 ++v9; | |
705 } | |
706 while ( v36 < v7->uNumVertices ); | |
707 v4 = v31; | |
708 } | |
709 v27 = 2 * v7->uNumVertices; | |
710 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
711 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
712 v11 = 0; | |
713 v34 = word_720CE0_ys[0] >= v40; | |
714 v37 = 0; | |
715 v28 = 0; | |
716 if ( v27 > 0 ) | |
717 { | |
718 do | |
719 { | |
720 if ( v37 >= 2 ) | |
721 break; | |
722 v12 = v11; | |
723 v4 = v31; | |
724 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
725 if ( v34 != v35 ) | |
726 { | |
727 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
1110 | 728 v14 = v13 | (word_720DB0_xs[v12] < v31); |
0 | 729 if ( v14 != 3 ) |
730 { | |
731 if ( !v14 | |
732 || (v15 = word_720CE0_ys[v12], | |
733 v16 = word_720CE0_ys[v12 + 1] - v15, | |
734 v17 = v40 - v15, | |
735 LODWORD(v18) = v17 << 16, | |
736 HIDWORD(v18) = v17 >> 16, | |
737 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
738 - (signed int)word_720DB0_xs[v12]) | |
739 * v18 | |
740 / v16) >> 16) | |
741 + word_720DB0_xs[v12]) >= v31) ) | |
742 ++v37; | |
743 } | |
744 } | |
745 v11 = v28 + 1; | |
746 v34 = v35; | |
747 ++v28; | |
748 } | |
749 while ( v28 < v27 ); | |
750 if ( v37 == 1 ) | |
751 { | |
752 if ( v39 >= 20 ) | |
753 break; | |
754 if ( v7->uPolygonType == 5 ) | |
755 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
756 else | |
757 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
758 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
759 + HIWORD(v7->zCalc3); | |
760 v20 = v39++; | |
761 dword_720F20[v20] = v19; | |
762 dword_720ED0[v20] = v32; | |
763 dword_720E80[v20] = v33; | |
764 } | |
765 } | |
766 } | |
767 ++v33; | |
768 v30 += 308; | |
769 if ( v33 >= v26 ) | |
770 break; | |
771 v5 = 0; | |
772 } | |
773 } | |
774 } | |
775 } | |
776 } | |
777 } | |
778 ++v32; | |
779 ++v29; | |
780 v5 = 0; | |
781 } | |
782 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
783 if ( !v39 ) | |
784 { | |
785 *(int *)a4 = 0; | |
786 return dword_720F20[0]; | |
787 } | |
788 } | |
789 v22 = 0; | |
790 v38 = v5; | |
791 if ( v39 <= (signed int)v5 ) | |
792 goto LABEL_54; | |
793 v23 = 0; | |
794 do | |
795 { | |
796 v24 = dword_720F20[v5 / 4]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
797 v25 = *(int *)((char *)dword_720F20.data() + v23); |
0 | 798 if ( v24 == v25 ) |
799 goto LABEL_50; | |
800 if ( v25 > a3 + 15 ) | |
801 { | |
802 if ( v24 >= v25 ) | |
803 goto LABEL_51; | |
804 LABEL_50: | |
805 v22 = v38; | |
806 v23 = v5; | |
807 goto LABEL_51; | |
808 } | |
809 if ( v24 > v25 && v24 <= a3 + 15 ) | |
810 goto LABEL_50; | |
811 LABEL_51: | |
812 ++v38; | |
813 v5 += 4; | |
814 } | |
815 while ( v38 < v39 ); | |
816 if ( v22 ) | |
817 { | |
818 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
819 return dword_720F20[v22]; | |
820 } | |
821 LABEL_54: | |
822 *(int *)a4 = 0; | |
823 return dword_720F20[v22]; | |
824 } | |
825 | |
138 | 826 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
827 // for a right-handed system, that would be an inverse normal | |
0 | 828 //----- (0046DCC8) -------------------------------------------------------- |
138 | 829 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
830 { | |
831 auto grid_x = WorldPosToGridCellX(pos_x); | |
832 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
833 | |
834 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
835 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
836 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
837 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
838 | |
839 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
840 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
841 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
842 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
843 | |
844 float side1_dx, side1_dy, side1_dz, | |
845 side2_dx, side2_dy, side2_dz; | |
846 | |
847 auto dx = abs(pos_x - grid_pos_x1), | |
848 dz = abs(grid_pos_z1 - pos_z); | |
849 if (dz >= dx) | |
850 { | |
851 side1_dy = (double)(x1z1_y - x1z2_y); | |
852 side2_dy = (double)(x2z2_y - x1z2_y); | |
853 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
854 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
855 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
856 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 857 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 858 /* |\ |
859 side1 | \ | |
860 |____\ | |
861 side 2 */ | |
862 } | |
863 else | |
864 { | |
865 side1_dy = (double)(x2z2_y - x2z1_y); | |
866 side2_dy = (double)(x1z1_y - x2z1_y); | |
867 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
868 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
869 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
870 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
871 | |
872 /* side 2 | |
873 _____ | |
874 \ | | |
875 \ | side 1 | |
876 \| */ | |
877 } | |
878 | |
879 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
880 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
881 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
882 | |
883 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
884 if (fabsf(mag) < 1e-6f) | |
885 { | |
886 out->y = 0; | |
887 out->x = 0; | |
888 out->z = 65536; | |
889 } | |
890 else | |
891 { | |
892 float invmag = 1.0 / mag; | |
893 out->x = invmag * nx * 65536.0; | |
894 out->y = invmag * ny * 65536.0; | |
895 out->z = invmag * nz * 65536.0; | |
896 } | |
897 } | |
898 | |
0 | 899 //----- (0046DEF2) -------------------------------------------------------- |
900 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
901 { | |
902 unsigned int result; // eax@1 | |
903 | |
904 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
905 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 906 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
907 return result; | |
908 } | |
909 | |
910 //----- (0046DF1A) -------------------------------------------------------- | |
911 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
912 { | |
913 Actor *v2; // edi@1 | |
914 unsigned __int16 v3; // ax@1 | |
915 int v4; // esi@6 | |
916 int v5; // ecx@8 | |
917 int v6; // eax@10 | |
918 int v7; // edx@12 | |
919 int v8; // ecx@14 | |
920 int v9; // eax@14 | |
921 int v10; // ebx@14 | |
922 int v11; // esi@14 | |
923 int v12; // ebx@15 | |
924 int v13; // ebx@17 | |
925 unsigned int v14; // eax@20 | |
926 signed int result; // eax@21 | |
927 int v16; // [sp+Ch] [bp-10h]@1 | |
928 int v17; // [sp+10h] [bp-Ch]@14 | |
929 int v18; // [sp+14h] [bp-8h]@14 | |
930 int v19; // [sp+18h] [bp-4h]@14 | |
931 | |
932 v16 = a1; | |
933 v2 = &pActors[a1]; | |
934 v3 = v2->uAIState; | |
935 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
936 goto LABEL_25; | |
937 v4 = v2->uActorRadius; | |
938 if ( a2 ) | |
939 v4 = a2; | |
940 v5 = v2->vPosition.x; | |
941 if ( stru_721530.sMaxX > v5 + v4 | |
942 || stru_721530.sMinX < v5 - v4 | |
943 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
944 || stru_721530.sMinY < v6 - v4 | |
945 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
946 || stru_721530.sMinZ < v7 | |
947 || (v8 = v5 - stru_721530.normal.x, | |
948 v9 = v6 - stru_721530.normal.y, | |
949 v10 = stru_721530.prolly_normal_d + v4, | |
950 v17 = stru_721530.prolly_normal_d + v4, | |
951 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
952 v18 = v8, | |
953 v19 = v9, | |
954 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
955 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
956 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
957 { | |
958 LABEL_25: | |
959 result = 0; | |
960 } | |
961 else | |
962 { | |
295 | 963 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 964 if ( v13 < 0 ) |
965 v13 = 0; | |
966 if ( v13 < stru_721530.field_7C ) | |
967 { | |
968 stru_721530.field_7C = v13; | |
969 v14 = 8 * v16; | |
862 | 970 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 971 stru_721530.uFaceID = v14; |
972 } | |
973 result = 1; | |
974 } | |
975 return result; | |
976 } | |
977 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
978 | |
979 //----- (0046E0B2) -------------------------------------------------------- | |
980 void __cdecl _46E0B2_collide_against_decorations() | |
981 { | |
982 BLVSector *v0; // ebp@1 | |
983 LevelDecoration *v1; // edi@2 | |
984 DecorationDesc *v2; // esi@3 | |
985 int v3; // edx@4 | |
986 int v4; // eax@4 | |
987 int v5; // ecx@6 | |
988 int v6; // ebx@8 | |
989 int v7; // esi@8 | |
990 int v8; // ebx@10 | |
991 int v9; // esi@11 | |
992 int v10; // edi@12 | |
993 int v11; // eax@12 | |
994 int v12; // esi@14 | |
995 unsigned int v13; // eax@17 | |
996 signed int i; // [sp+4h] [bp-14h]@1 | |
997 int v15; // [sp+8h] [bp-10h]@10 | |
998 int v16; // [sp+Ch] [bp-Ch]@10 | |
999 int v17; // [sp+10h] [bp-8h]@10 | |
1000 int v18; // [sp+14h] [bp-4h]@8 | |
1001 | |
1002 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1003 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1004 { | |
1005 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1006 if ( !(v1->field_2 & 0x20) ) | |
1007 { | |
1008 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1009 if (!v2->CanMoveThrough()) |
0 | 1010 { |
1011 v3 = v2->uRadius; | |
1012 v4 = v1->vPosition.x; | |
1013 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1014 { | |
1015 if ( stru_721530.sMinX >= v4 - v3 ) | |
1016 { | |
1017 v5 = v1->vPosition.y; | |
1018 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1019 { | |
1020 if ( stru_721530.sMinY >= v5 - v3 ) | |
1021 { | |
1022 v6 = v2->uDecorationHeight; | |
1023 v7 = v1->vPosition.z; | |
1024 v18 = v6; | |
1025 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1026 { | |
1027 if ( stru_721530.sMinZ >= v7 ) | |
1028 { | |
1029 v16 = v4 - stru_721530.normal.x; | |
1030 v15 = v5 - stru_721530.normal.y; | |
1031 v8 = stru_721530.prolly_normal_d + v3; | |
1032 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1033 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1034 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1035 { | |
1036 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1037 if ( v9 > 0 ) | |
1038 { | |
1039 v10 = v1->vPosition.z; | |
1040 v11 = stru_721530.normal.z | |
1041 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1042 if ( v11 >= v10 ) | |
1043 { | |
1044 if ( v11 <= v18 + v10 ) | |
1045 { | |
295 | 1046 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1047 if ( v12 < 0 ) |
1048 v12 = 0; | |
1049 if ( v12 < stru_721530.field_7C ) | |
1050 { | |
1051 stru_721530.field_7C = v12; | |
1052 v13 = 8 * v0->pDecorationIDs[i]; | |
1053 LOBYTE(v13) = v13 | 5; | |
1054 stru_721530.uFaceID = v13; | |
1055 } | |
1056 } | |
1057 } | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 | |
1071 //----- (0046E26D) -------------------------------------------------------- | |
1072 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1073 { | |
1074 int v2; // edx@5 | |
1075 unsigned __int16 *v3; // eax@5 | |
1076 unsigned __int16 v4; // ax@6 | |
1077 LevelDecoration *v5; // edi@7 | |
1078 DecorationDesc *v6; // esi@8 | |
1079 int v7; // edx@9 | |
1080 int v8; // eax@9 | |
1081 int v9; // ecx@11 | |
1082 int v10; // ebx@13 | |
1083 int v11; // esi@13 | |
1084 int v12; // ebp@15 | |
1085 int v13; // ebx@15 | |
1086 int v14; // esi@16 | |
1087 int v15; // edi@17 | |
1088 int v16; // eax@17 | |
1089 int v17; // esi@19 | |
1090 char v18; // zf@23 | |
1091 int v19; // [sp+0h] [bp-10h]@15 | |
1092 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1093 int v21; // [sp+8h] [bp-8h]@15 | |
1094 int v22; // [sp+Ch] [bp-4h]@13 | |
1095 | |
1096 if ( a1 >= 0 ) | |
1097 { | |
1098 if ( a1 <= 127 ) | |
1099 { | |
1100 if ( a2 >= 0 ) | |
1101 { | |
1102 if ( a2 <= 127 ) | |
1103 { | |
1104 v2 = a1 + (a2 << 7); | |
1105 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1106 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1107 if ( v3 ) | |
1108 { | |
1109 do | |
1110 { | |
1111 v4 = *v3; | |
848 | 1112 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1113 { |
1114 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1115 if ( !(v5->field_2 & 0x20) ) | |
1116 { | |
1117 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1118 if (!v6->CanMoveThrough()) |
0 | 1119 { |
1120 v7 = v6->uRadius; | |
1121 v8 = v5->vPosition.x; | |
1122 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1123 { | |
1124 if ( stru_721530.sMinX >= v8 - v7 ) | |
1125 { | |
1126 v9 = v5->vPosition.y; | |
1127 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1128 { | |
1129 if ( stru_721530.sMinY >= v9 - v7 ) | |
1130 { | |
1131 v10 = v6->uDecorationHeight; | |
1132 v11 = v5->vPosition.z; | |
1133 v22 = v10; | |
1134 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1135 { | |
1136 if ( stru_721530.sMinZ >= v11 ) | |
1137 { | |
1138 v12 = v8 - stru_721530.normal.x; | |
1139 v19 = v9 - stru_721530.normal.y; | |
1140 v13 = stru_721530.prolly_normal_d + v7; | |
1141 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1142 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1143 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1144 { | |
1145 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1146 if ( v14 > 0 ) | |
1147 { | |
1148 v15 = v5->vPosition.z; | |
1149 v16 = stru_721530.normal.z | |
1150 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1151 if ( v16 >= v15 ) | |
1152 { | |
1153 if ( v16 <= v22 + v15 ) | |
1154 { | |
295 | 1155 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1156 if ( v17 < 0 ) |
1157 v17 = 0; | |
1158 if ( v17 < stru_721530.field_7C ) | |
1159 { | |
1160 stru_721530.field_7C = v17; | |
1161 stru_721530.uFaceID = (signed __int16)*v20; | |
1162 } | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 v3 = v20 + 1; | |
1177 v18 = *v20 == 0; | |
1178 ++v20; | |
1179 } | |
1180 while ( !v18 ); | |
1181 } | |
1182 } | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 | |
1188 //----- (00486F92) -------------------------------------------------------- | |
1189 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1190 { | |
1191 Span *v0; // ebx@1 | |
1192 int v1; // eax@2 | |
1193 Edge *v2; // ecx@3 | |
1194 Edge *v3; // edx@3 | |
1195 Edge *v4; // esi@6 | |
1196 Edge *v5; // eax@7 | |
1197 Edge *v6; // ecx@8 | |
1198 Surf *v7; // esi@11 | |
1199 double v8; // st7@13 | |
1200 Surf *v9; // edi@13 | |
1201 double v10; // st6@13 | |
1202 double v11; // st7@14 | |
1203 signed __int64 v12; // qax@14 | |
1204 stru148 *v13; // eax@15 | |
1205 Span *v14; // ecx@17 | |
1206 double v15; // st7@28 | |
1207 signed __int64 v16; // qax@28 | |
1208 stru148 *v17; // eax@29 | |
1209 Span *v18; // ecx@31 | |
1210 Edge *i; // eax@40 | |
1211 Edge *v20; // ecx@43 | |
1212 Edge *v21; // esi@44 | |
1213 double v22; // st7@45 | |
1214 Edge *v23; // edx@48 | |
1215 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1216 float v25; // [sp+14h] [bp-Ch]@3 | |
1217 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1218 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1219 | |
1220 v0 = pSpans; | |
1221 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1222 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1223 stru_80C9A4.pSurf = &stru_80C980; |
1224 stru_80C980.pPrev = &stru_80C980; | |
1225 stru_80C980.pNext = &stru_80C980; | |
693 | 1226 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1227 stru_80C980.field_8 = 0.0; |
1228 stru_80C980.field_4 = 0.0; | |
1229 stru_80C9D8.pNext = &stru_80C9A4; | |
1230 stru_80C9D8.pPrev = 0; | |
1231 stru_80C9D8.field_8 = 1; | |
1232 stru_80C9A4.pNext = 0; | |
1233 stru_80C9A4.pPrev = &stru_80C9D8; | |
1234 stru_80C9A4.field_8 = 0; | |
1235 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1236 v27 = pViewport->uViewportTL_Y; |
1237 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1238 { |
1239 LABEL_51: | |
1240 v0->field_8 = -1; | |
1241 } | |
1242 else | |
1243 { | |
693 | 1244 v1 = 52 * pViewport->uViewportTL_Y; |
1245 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1246 while ( 1 ) |
1247 { | |
1248 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1249 v3 = &stru_80C9D8; | |
1250 v25 = (double)(signed int)v27; | |
1251 if ( v2 != &defaultEdge ) | |
1252 { | |
1253 do | |
1254 { | |
1255 while ( 1 ) | |
1256 { | |
1257 v4 = v3->pNext; | |
1258 if ( v2->field_0 <= (double)v4->field_0 ) | |
1259 break; | |
1260 v3 = v3->pNext; | |
1261 } | |
1262 v5 = v2->pNext; | |
1263 v2->pNext = v4; | |
1264 v2->pPrev = v3; | |
1265 v3->pNext->pPrev = v2; | |
1266 v3->pNext = v2; | |
1267 v3 = v2; | |
1268 v2 = v5; | |
1269 } | |
1270 while ( v5 != &defaultEdge ); | |
1271 } | |
1272 v6 = stru_80C9D8.pNext; | |
1273 stru_80C980.field_20 = 0; | |
1274 stru_80C980.field_22 = 1; | |
1275 v26 = stru_80C9D8.pNext; | |
1276 if ( stru_80C9D8.pNext ) | |
1277 { | |
1278 while ( 1 ) | |
1279 { | |
1280 v7 = v6->pSurf; | |
1281 if ( v6->field_8 ) | |
1282 { | |
1283 ++v7->field_22; | |
1284 if ( v7->field_22 == 1 ) | |
1285 { | |
1286 v8 = v6->field_0 + 2.0; | |
1287 v9 = stru_80C980.pNext; | |
1288 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1289 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1290 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1291 + stru_80C980.pNext->field_0 ) | |
1292 { | |
1293 do | |
1294 v9 = v9->pNext; | |
1295 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1296 v7->pNext = v9; | |
1297 v7->pPrev = v9->pPrev; | |
1298 v9->pPrev->pNext = v7; | |
1299 v9->pPrev = v7; | |
1300 } | |
1301 else | |
1302 { | |
1303 v11 = v6->field_0 + 0.5; | |
1304 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1305 v0->field_C = v12; | |
1306 if ( (signed __int16)v12 > 0 ) | |
1307 { | |
1308 v0->field_A = v27; | |
1309 v0->field_8 = v9->field_20; | |
1310 v13 = v9->pParent; | |
1311 v0->pParent = v13; | |
1312 if ( v13 ) | |
1313 { | |
1314 if ( v13->prolly_head ) | |
1315 { | |
1316 v14 = v13->prolly_tail; | |
1317 if ( !v14 ) | |
1318 return; | |
1319 v14->pNext = v0; | |
1320 } | |
1321 else | |
1322 { | |
1323 v13->prolly_head = v0; | |
1324 } | |
1325 v13->prolly_tail = v0; | |
1326 } | |
1327 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1328 return; | |
1329 ++v0; | |
1330 ++pOutdoorCamera->uNumSpans; | |
1331 } | |
1332 v6 = v26; | |
1333 v7->field_20 = (signed __int64)v11; | |
1334 v7->pNext = v9; | |
1335 v9->pPrev = v7; | |
1336 stru_80C980.pNext = v7; | |
1337 v7->pPrev = &stru_80C980; | |
1338 } | |
1339 } | |
1340 } | |
1341 else | |
1342 { | |
1343 --v7->field_22; | |
1344 if ( !v7->field_22 ) | |
1345 { | |
1346 if ( stru_80C980.pNext == v7 ) | |
1347 { | |
1348 v15 = v6->field_0 + 0.5; | |
1349 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1350 v0->field_C = v16; | |
1351 if ( (signed __int16)v16 > 0 ) | |
1352 { | |
1353 v0->field_A = v27; | |
1354 v0->field_8 = v7->field_20; | |
1355 v17 = v7->pParent; | |
1356 v0->pParent = v17; | |
1357 if ( v17 ) | |
1358 { | |
1359 if ( v17->prolly_head ) | |
1360 { | |
1361 v18 = v17->prolly_tail; | |
1362 if ( !v18 ) | |
1363 return; | |
1364 v18->pNext = v0; | |
1365 } | |
1366 else | |
1367 { | |
1368 v17->prolly_head = v0; | |
1369 } | |
1370 v17->prolly_tail = v0; | |
1371 } | |
1372 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1373 return; | |
1374 ++v0; | |
1375 ++pOutdoorCamera->uNumSpans; | |
1376 } | |
1377 v7->pNext->field_20 = (signed __int64)v15; | |
1378 v6 = v26; | |
1379 } | |
1380 v7->pNext->pPrev = v7->pPrev; | |
1381 v7->pPrev->pNext = v7->pNext; | |
1382 } | |
1383 } | |
1384 v26 = v6->pNext; | |
1385 if ( !v26 ) | |
1386 break; | |
1387 v6 = v6->pNext; | |
1388 } | |
1389 } | |
1390 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1391 { | |
1392 i->pPrev->pNext = i->pNext; | |
1393 i->pNext->pPrev = i->pPrev; | |
1394 } | |
1395 v20 = stru_80C9D8.pNext; | |
1396 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1397 break; | |
1398 LABEL_50: | |
1399 ++v27; | |
1400 v1 = v24 + 52; | |
1401 v24 += 52; | |
693 | 1402 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1403 goto LABEL_51; |
1404 } | |
1405 while ( 1 ) | |
1406 { | |
1407 v21 = v20->pNext; | |
1408 if ( !v21 ) | |
1409 break; | |
1410 v22 = v20->field_4 + v20->field_0; | |
1411 v20->field_0 = v22; | |
1412 if ( v22 < stru_80C9D8.field_0 ) | |
1413 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1414 while ( 1 ) | |
1415 { | |
1416 v23 = v20->pPrev; | |
1417 if ( v20->field_0 >= (double)v23->field_0 ) | |
1418 break; | |
1419 v23->pNext = v20->pNext; | |
1420 v20->pNext->pPrev = v23; | |
1421 v23->pPrev->pNext = v20; | |
1422 v20->pPrev = v23->pPrev; | |
1423 v20->pNext = v23; | |
1424 v23->pPrev = v20; | |
1425 } | |
1426 v20 = v21; | |
1427 if ( v21 == &stru_80C9A4 ) | |
1428 goto LABEL_50; | |
1429 } | |
1430 } | |
1431 } | |
1432 // 4EC3EC: using guessed type Edge defaultEdge; | |
1433 | |
1434 //----- (00487355) -------------------------------------------------------- | |
1435 bool OutdoorCamera::_487355() | |
1436 { | |
1437 int v0; // esi@1 | |
1438 stru148 *v1; // edi@2 | |
1439 bool result; // eax@3 | |
1440 | |
1441 v0 = 0; | |
1442 if ( pOutdoorCamera->numStru148s > 0 ) | |
1443 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1444 v1 = array_77EC08.data(); |
0 | 1445 do |
1446 { | |
1447 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1448 ++v0; | |
1449 ++v1; | |
1450 } | |
1451 while ( v0 < pOutdoorCamera->numStru148s ); | |
1452 } | |
1453 return result; | |
1454 } | |
1455 | |
1456 //----- (00487DA9) -------------------------------------------------------- | |
1457 void __cdecl sub_487DA9() | |
1458 { | |
1459 char *v0; // eax@1 | |
1460 | |
1461 v0 = &array_77EC08[0].field_108; | |
1462 do | |
1463 { | |
1464 *v0 = 0; | |
1465 v0 += 268; | |
1466 } | |
1467 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1468 } | |
1469 | |
1470 //----- (00487DBE) -------------------------------------------------------- | |
1471 void Software_ResetNewEdges() | |
1472 { | |
1473 int v0; // ecx@1 | |
1474 Edge **v1; // eax@1 | |
1475 signed int v2; // eax@3 | |
1476 | |
1477 v0 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1478 v1 = ptr_80CA10.data(); |
0 | 1479 do |
1480 { | |
1481 ++v0; | |
1482 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1483 *v1 = 0; | |
1484 ++v1; | |
1485 } | |
1486 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1487 v2 = 2000; | |
1488 do | |
1489 { | |
1490 pSurfs->field_22 = 0; | |
1491 --v2; | |
1492 } | |
1493 while ( v2 ); | |
1494 } | |
1495 // 4EC3EC: using guessed type Edge defaultEdge; | |
1496 | |
1497 //----- (0048958E) -------------------------------------------------------- | |
1498 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1499 { | |
1500 stru12_MemoryBlock *v2; // esi@1 | |
1501 void *v3; // eax@1 | |
1502 void *v4; // ecx@1 | |
1503 stru12_MemoryBlock *result; // eax@1 | |
1504 | |
1505 v2 = this; | |
1506 v3 = operator new(8 * a2 + 16); | |
1507 v2->pBlockBase = v3; | |
848 | 1508 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1509 result = v2; |
1510 v2->pAlignedBlock = v4; | |
1511 } | |
1512 | |
1513 //----- (004895B7) -------------------------------------------------------- | |
1514 stru12::stru12(stru11 *pStru11) | |
1515 { | |
1516 stru12 *v2; // esi@1 | |
1517 | |
1518 v2 = this; | |
1519 this->field_44 = 0x41000000u; | |
1520 this->field_4C = 0x46000000u; | |
1521 //this->vdestructor_ptr = stru12::_4898E6; | |
1522 this->field_48 = 0; | |
1523 this->field_50 = 0; | |
1524 this->field_54 = 0x33D6BF95u; | |
1525 this->field_58 = 0; | |
1526 | |
1527 for (int i = 0; i < 12; ++i) | |
1528 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1529 } | |
1530 | |
1531 //----- (00489810) -------------------------------------------------------- | |
1532 stru12::~stru12() | |
1533 { | |
1534 for (int i = 0; i < 12; ++i) | |
1535 delete pMemBlocks[i]; | |
1536 } | |
1537 | |
1538 //----- (004898BF) -------------------------------------------------------- | |
1539 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1540 { | |
1541 stru12_MemoryBlock *v2; // esi@1 | |
1542 void *v3; // ST00_4@1 | |
1543 | |
1544 v2 = this; | |
1545 v3 = this->pBlockBase; | |
1546 this->pAlignedBlock = 0; | |
1547 free(v3); | |
1548 v2->pBlockBase = 0; | |
1549 /*if ( a2 & 1 ) | |
1550 free(v2);*/ | |
1551 } | |
1552 | |
1553 //----- (004898E6) -------------------------------------------------------- | |
1554 void stru12::_4898E6() | |
1555 { | |
1556 void *v1; // eax@1 | |
1557 void *v2; // edx@1 | |
1558 char *v3; // edi@2 | |
1559 double v4; // st7@2 | |
1560 char *v5; // ebx@2 | |
1561 double v6; // st6@3 | |
1562 double v7; // st5@3 | |
1563 double v8; // st4@3 | |
1564 int v9; // esi@3 | |
1565 double v10; // st3@3 | |
1566 float v11; // ST34_4@5 | |
1567 double v12; // st6@10 | |
1568 double v13; // ST0C_8@10 | |
1569 char *v14; // [sp+14h] [bp-44h]@2 | |
1570 char *v15; // [sp+18h] [bp-40h]@2 | |
1571 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1572 char *v17; // [sp+20h] [bp-38h]@2 | |
1573 char *v18; // [sp+24h] [bp-34h]@2 | |
1574 float v19; // [sp+30h] [bp-28h]@3 | |
1575 float v20; // [sp+38h] [bp-20h]@3 | |
1576 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1577 int v22; // [sp+40h] [bp-18h]@1 | |
1578 char *v23; // [sp+44h] [bp-14h]@2 | |
1579 char *v24; // [sp+48h] [bp-10h]@2 | |
1580 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1581 float v26; // [sp+50h] [bp-8h]@3 | |
1582 float v27; // [sp+54h] [bp-4h]@3 | |
1583 | |
731 | 1584 __debugbreak(); |
0 | 1585 v22 = 0; |
1586 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1587 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1588 if ( this->field_8C > 0 ) | |
1589 { | |
1590 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1591 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1592 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1593 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1594 v25 = (int)v1 - (int)v2; | |
1595 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1596 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1597 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1598 v4 = 1.0; | |
1599 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1600 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1601 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1602 do | |
1603 { | |
1604 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1605 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1606 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1607 v7 = pIndoorCamera->fRotationYCosine; | |
1608 v8 = pIndoorCamera->fRotationYSine; | |
1609 v20 = pIndoorCamera->fRotationXCosine; | |
1610 v19 = pIndoorCamera->fRotationXSine; | |
1611 v9 = (int)((char *)v2 + (int)v21); | |
1612 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1613 if ( pIndoorCamera->sRotationX ) | |
1614 { | |
1615 v11 = v10; | |
1616 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1617 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1618 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1619 } | |
1620 else | |
1621 { | |
1622 *(float *)v9 = v10; | |
1623 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1624 *(float *)((char *)v2 + (int)v5) = v6; | |
1625 } | |
1626 if ( *(float *)v9 >= 8.0 ) | |
1627 { | |
1628 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1629 { | |
1630 *(int *)v2 = 0; | |
1631 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1632 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1633 - v12 * *(float *)((char *)v2 + (int)v3); | |
1634 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1635 - v12 * *(float *)((char *)v2 + (int)v5); | |
1636 *(float *)((char *)v2 + (int)v16) = v4 | |
1637 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1638 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1639 v13 = *(float *)v9 + 6.7553994e15; | |
1640 v4 = 1.0; | |
1641 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1642 } | |
1643 else | |
1644 { | |
1645 *(int *)v2 = 2; | |
1646 } | |
1647 } | |
1648 else | |
1649 { | |
1650 *(int *)v2 = 1; | |
1651 } | |
1652 ++v22; | |
1653 v2 = (char *)v2 + 4; | |
1654 } | |
1655 while ( v22 < this->field_8C ); | |
1656 } | |
1657 this->field_8C = 0; | |
1658 } | |
1659 | |
1660 //----- (0048A959) -------------------------------------------------------- | |
1661 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1662 { | |
1663 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1664 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1665 b = (uColor & 0x000000FF) / 255.0f; | |
1666 | |
1667 float h, s, v; | |
1668 RGB2HSV(&h, &s, r, g, b, &v); | |
1669 | |
1670 if ( h_replace != -1.0 ) | |
1671 h = h_replace; | |
1672 if ( s_replace != -1.0 ) | |
1673 s = s_replace; | |
1674 if ( v_replace != -1.0 ) | |
1675 v = v_replace; | |
1676 HSV2RGB(&r, &g, &b, h, s, v); | |
1677 | |
1678 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1679 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1680 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1681 } | |
1682 | |
1683 //----- (0048B561) -------------------------------------------------------- | |
1029 | 1684 int fixpoint_from_float(float val) |
0 | 1685 { |
1029 | 1686 // float X.Yf -> int XXXX YYYY |
1687 int left = floorf((val - 0.5f) + 0.5f); | |
1688 int right = floorf((val - left) * 65536.0f); | |
1689 return (left << 16) | right; | |
0 | 1690 } |
1691 | |
1692 //----- (00491E3A) -------------------------------------------------------- | |
1693 void __cdecl sub_491E3A() | |
1694 { | |
1695 Player *v0; // ebx@1 | |
1696 signed int v1; // esi@3 | |
1697 char *v2; // eax@4 | |
1698 unsigned int v3; // eax@7 | |
1699 unsigned int v4; // edx@8 | |
1700 char *v5; // ecx@9 | |
1701 int v6; // edi@17 | |
1702 Texture *v7; // ebx@18 | |
1703 struct IDirect3DTexture2 **v8; // eax@19 | |
1704 struct IDirect3DTexture2 *v9; // eax@20 | |
1705 struct IDirectDrawSurface **v10; // eax@22 | |
1706 struct IDirectDrawSurface *v11; // eax@23 | |
1707 int v12; // eax@26 | |
1708 | |
1709 v0 = pParty->pPlayers; | |
1710 do | |
1711 { | |
203 | 1712 if (SoundSetAction[24][0]) |
0 | 1713 { |
1714 v1 = 0; | |
764 | 1715 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1716 { |
1717 LABEL_7: | |
1718 v3 = 0; | |
1719 } | |
1720 else | |
1721 { | |
1722 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1723 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1724 { |
1725 ++v1; | |
1726 v2 += 120; | |
764 | 1727 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1728 goto LABEL_7; |
1729 } | |
1730 v3 = v1; | |
1731 } | |
764 | 1732 pSoundList->UnloadSound(v3, 1); |
0 | 1733 v4 = 0; |
764 | 1734 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1735 { |
1736 LABEL_12: | |
1737 v4 = 0; | |
1738 } | |
1739 else | |
1740 { | |
1741 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1742 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1743 { |
1744 ++v4; | |
1745 v5 += 120; | |
764 | 1746 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1747 goto LABEL_12; |
1748 } | |
1749 } | |
764 | 1750 pSoundList->UnloadSound(v4, 1); |
0 | 1751 } |
1752 ++v0; | |
1753 } | |
1754 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1755 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1756 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1757 { |
1758 v7 = &pIcons_LOD->pTextures[v6]; | |
1759 do | |
1760 { | |
1761 v7->Release(); | |
1762 v8 = pIcons_LOD->pHardwareTextures; | |
1763 if ( v8 ) | |
1764 { | |
1765 v9 = v8[v6]; | |
1766 if ( v9 ) | |
1767 { | |
1768 v9->Release(); | |
1769 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1770 } | |
1771 } | |
1772 v10 = pIcons_LOD->pHardwareSurfaces; | |
1773 if ( v10 ) | |
1774 { | |
1775 v11 = v10[v6]; | |
1776 if ( v11 ) | |
1777 { | |
1778 v11->Release(); | |
1779 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1780 } | |
1781 } | |
1782 --v6; | |
1783 --v7; | |
1784 } | |
33 | 1785 while ( v6 >= pIcons_LOD->pFacesLock ); |
1786 } | |
1787 v12 = pIcons_LOD->pFacesLock; | |
1788 pIcons_LOD->pFacesLock = 0; | |
0 | 1789 pIcons_LOD->uNumLoadedFiles = v12; |
1790 } | |
1791 // 4ED498: using guessed type char byte_4ED498; | |
1792 | |
1793 //----- (0049387A) -------------------------------------------------------- | |
1794 int CycleCharacter(unsigned int _this) | |
1795 { | |
1796 signed int result; // eax@1 | |
1797 signed int v2; // ecx@2 | |
1798 signed int v3; // ecx@8 | |
1799 | |
1800 result = uActiveCharacter; | |
1801 if ( _this ) | |
1802 { | |
1803 v2 = 0; | |
1804 while ( 1 ) | |
1805 { | |
1806 --result; | |
1807 if ( result < 1 ) | |
1808 result = 4; | |
1809 if ( !pPlayers[result]->uTimeToRecovery ) | |
1810 break; | |
1811 ++v2; | |
1812 if ( v2 >= 4 ) | |
1813 return uActiveCharacter; | |
1814 } | |
1815 } | |
1816 else | |
1817 { | |
1818 v3 = 0; | |
1819 while ( 1 ) | |
1820 { | |
1821 ++result; | |
1822 if ( result > 4 ) | |
1823 result = 1; | |
1824 if ( !pPlayers[result]->uTimeToRecovery ) | |
1825 break; | |
1826 ++v3; | |
1827 if ( v3 >= 4 ) | |
1828 return uActiveCharacter; | |
1829 } | |
1830 } | |
1831 return result; | |
1832 } | |
1833 //----- (004938D1) -------------------------------------------------------- | |
1834 void __fastcall Rest(unsigned int uHoursToSleep) | |
1835 { | |
1836 unsigned int v1; // esi@1 | |
1837 double v2; // st7@3 | |
1838 Player **v3; // esi@3 | |
1839 | |
1840 v1 = uHoursToSleep; | |
1841 if ( uHoursToSleep > 240 ) | |
1842 InitializeActors(); | |
1843 v2 = (double)(7680 * v1) * 0.033333335; | |
1844 pParty->uTimePlayed += (signed __int64)v2; | |
1845 v3 = &pPlayers[1]; | |
1846 do | |
1847 { | |
1848 (*v3)->Recover((signed __int64)v2); | |
1849 ++v3; | |
1850 } | |
1851 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1852 _494035_timed_effects__water_walking_damage__etc(); | |
1853 } | |
1854 | |
1855 //----- (00493938) -------------------------------------------------------- | |
1856 int __cdecl _493938_regenerate() | |
1857 { | |
1858 int v0; // edi@1 | |
1859 signed __int64 v1; // qax@1 | |
1860 int v2; // ecx@1 | |
1861 int result; // eax@1 | |
1862 int v4; // eax@2 | |
1863 int v5; // edi@5 | |
112 | 1864 int *v6; // ecx@5 |
0 | 1865 char v7; // sf@5 |
112 | 1866 int *v8; // ecx@10 |
0 | 1867 int v9; // edi@15 |
1868 signed int v10; // eax@15 | |
1869 __int16 *v11; // edx@16 | |
1870 int v12; // eax@20 | |
1871 int v13; // ebx@20 | |
1872 unsigned int *v14; // esi@21 | |
1873 unsigned int v15; // ecx@21 | |
1874 unsigned int v16; // eax@21 | |
1875 int v17; // edx@21 | |
1876 int v18; // eax@21 | |
1877 signed int v19; // eax@21 | |
1878 signed int v20; // ebx@25 | |
1879 Player *v21; // esi@25 | |
1880 ITEM_EQUIP_TYPE v22; // edi@30 | |
1881 //int v23; // edx@31 | |
1882 signed int v24; // ecx@32 | |
1883 signed int v25; // eax@33 | |
1884 int v26; // eax@35 | |
1885 int v27; // eax@36 | |
1886 int v28; // eax@37 | |
1887 int v29; // eax@40 | |
1888 int v30; // eax@41 | |
1889 signed int v31; // ecx@53 | |
1890 char *v32; // eax@53 | |
1891 char *v33; // edi@82 | |
1892 int v34; // ecx@88 | |
1893 int v35; // eax@88 | |
1894 char *v36; // edi@99 | |
1895 int v37; // edi@104 | |
1896 int v38; // edi@106 | |
1897 int v39; // edi@111 | |
1898 int v40; // ecx@113 | |
1899 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
|
1900 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 1901 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
1902 int v44; // [sp+210h] [bp-20h]@22 | |
1903 int v45; // [sp+214h] [bp-1Ch]@25 | |
1904 int v46; // [sp+218h] [bp-18h]@25 | |
1905 int v47; // [sp+21Ch] [bp-14h]@25 | |
1906 int v48; // [sp+220h] [bp-10h]@25 | |
1907 int v49; // [sp+224h] [bp-Ch]@24 | |
1908 int v50; // [sp+228h] [bp-8h]@25 | |
1909 int v51; // [sp+22Ch] [bp-4h]@2 | |
1910 | |
1911 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
1912 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
1913 v2 = (signed int)v1 / 60; | |
1914 result = (signed int)v1 / 60 + 5; | |
1915 if ( v0 >= result ) | |
1916 { | |
1917 v51 = 0; | |
1918 v4 = (v0 - v2) / 5; | |
1919 if (pParty->FlyActive()) | |
1920 { | |
1921 if ( pParty->bFlying ) | |
1922 { | |
569 | 1923 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
1924 { // colliding with something in the air - fall down | |
1925 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
1926 //__debugbreak(); | |
1167 | 1927 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000]; |
112 | 1928 v7 = *v6 < v5; |
1929 *v6 -= v5; | |
0 | 1930 if ( v7 ) |
1931 { | |
112 | 1932 *v6 = 0; |
0 | 1933 pParty->uFlags &= 0xFFFFFFBFu; |
1934 pParty->bFlying = 0; | |
1935 v51 = 1; | |
1936 } | |
1937 } | |
1938 } | |
1939 } | |
569 | 1940 |
0 | 1941 if (pParty->WaterWalkActive()) |
1942 { | |
569 | 1943 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
1944 { | |
1945 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
1946 { // taking on water | |
1947 //__debugbreak(); | |
1167 | 1948 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 1949 v7 = *v8 < v4; |
1950 *v8 -= v4; | |
0 | 1951 if ( v7 ) |
1952 { | |
112 | 1953 *v8 = 0; |
569 | 1954 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 1955 v51 = 1; |
1956 } | |
1957 } | |
1958 } | |
1959 } | |
569 | 1960 |
0 | 1961 if (pParty->ImmolationActive()) |
1962 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1963 //SpriteObject::SpriteObject(&a1); |
0 | 1964 v9 = 0; |
1965 a3.z = 0; | |
1966 a3.y = 0; | |
1967 a3.x = 0; | |
1968 a1.stru_24.Reset(); | |
822 | 1969 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
1970 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 1971 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1972 a1.uType = 1070; |
822 | 1973 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 1974 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1975 { | |
1976 LABEL_19: | |
1977 LOWORD(v10) = 0; | |
1978 } | |
1979 else | |
1980 { | |
1981 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 1982 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 1983 { |
1984 ++v10; | |
1985 v11 += 28; | |
1986 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
1987 goto LABEL_19; | |
1988 } | |
1989 } | |
1990 a1.uObjectDescID = v10; | |
1991 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 1992 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 1993 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 1994 a1.uAttributes = 0; |
1995 a1.uSectorID = 0; | |
1996 a1.uSpriteFrameID = 0; | |
822 | 1997 a1.spell_caster_pid = v12; |
0 | 1998 a1.uFacing = 0; |
1999 a1.uSoundID = 0; | |
2000 v13 = sub_46A89E((int)v41, 100, 307); | |
2001 if ( v13 > 0 ) | |
2002 { | |
2003 do | |
2004 { | |
2005 v14 = (unsigned int *)&v41[4 * v9]; | |
2006 v15 = *v14; | |
2007 v16 = *v14; | |
2008 a1.vPosition.x = pActors[v16].vPosition.x; | |
2009 v17 = pActors[v16].vPosition.y; | |
2010 a1.vPosition.z = pActors[v16].vPosition.z; | |
2011 v18 = 8 * v15; | |
862 | 2012 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2013 a1.vPosition.y = v17; |
823 | 2014 a1.spell_target_pid = v18; |
0 | 2015 v19 = a1.Create(0, 0, 0, 0); |
862 | 2016 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2017 ++v9; |
2018 } | |
2019 while ( v9 < v13 ); | |
2020 } | |
2021 } | |
2022 v44 = 0; | |
248 | 2023 if (PartyHasDragon()) |
0 | 2024 v44 = 1; |
2025 v49 = 0; | |
2026 LABEL_25: | |
2027 v20 = 0; | |
2028 v21 = &pParty->pPlayers[v49]; | |
2029 v50 = 0; | |
2030 v47 = 0; | |
2031 v45 = 0; | |
2032 v48 = 0; | |
2033 v46 = 0; | |
255 | 2034 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2035 v50 = 1; |
135 | 2036 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2037 v48 = 1; |
2038 v22 = (ITEM_EQUIP_TYPE)0; | |
2039 while ( 1 ) | |
2040 { | |
2041 if ( v21->HasItemEquipped(v22) ) | |
2042 { | |
2043 //v23 = v21->pEquipment.pIndices; | |
2044 auto _idx = v21->pEquipment.pIndices[v22]; | |
2045 v24 = v21->pInventoryItems[_idx].uItemID; | |
2046 if ( v24 > 134 ) | |
2047 { | |
2048 if ( v24 == 529 ) | |
2049 goto LABEL_43; | |
2050 if ( v24 == 535 ) | |
2051 goto LABEL_44; | |
2052 if ( v24 == 515 ) | |
2053 { | |
2054 v47 = 1; | |
2055 } | |
2056 else | |
2057 { | |
2058 if ( v24 == 532 ) | |
2059 goto LABEL_50; | |
2060 } | |
2061 } | |
2062 else | |
2063 { | |
377 | 2064 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2065 if ( v25 <= 50 ) |
2066 { | |
2067 if ( v25 != 50 ) | |
2068 { | |
2069 v26 = v25 - 37; | |
2070 if ( v26 ) | |
2071 { | |
2072 v27 = v26 - 1; | |
2073 if ( !v27 ) | |
2074 goto LABEL_50; | |
2075 v28 = v27 - 6; | |
2076 if ( v28 ) | |
2077 { | |
2078 if ( v28 != 3 ) | |
2079 goto LABEL_51; | |
2080 LABEL_50: | |
2081 v50 = 1; | |
2082 goto LABEL_51; | |
2083 } | |
2084 } | |
2085 } | |
2086 LABEL_44: | |
2087 v20 = 1; | |
2088 goto LABEL_51; | |
2089 } | |
2090 v29 = v25 - 54; | |
2091 if ( !v29 ) | |
2092 goto LABEL_44; | |
2093 v30 = v29 - 1; | |
2094 if ( !v30 ) | |
2095 goto LABEL_50; | |
2096 if ( v30 == 11 ) | |
2097 { | |
2098 LABEL_43: | |
2099 v20 = 1; | |
2100 v50 = 1; | |
2101 goto LABEL_51; | |
2102 } | |
2103 } | |
2104 } | |
2105 LABEL_51: | |
2106 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2107 if ( (signed int)v22 >= 16 ) | |
2108 { | |
2109 if ( v48 ) | |
2110 { | |
2111 v31 = 0; | |
2112 v32 = (char *)v21->pInventoryItems; | |
2113 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2114 { | |
2115 ++v31; | |
2116 v32 += 36; | |
2117 if ( v31 >= 138 ) | |
2118 goto LABEL_59; | |
2119 } | |
2120 v48 = 0; | |
2121 v45 = 1; | |
2122 } | |
2123 LABEL_59: | |
2124 if ( v21->pConditions[17] ) | |
2125 v46 = 1; | |
2126 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2127 { | |
2128 ++v21->sHealth; | |
2129 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2130 v21->sHealth = v21->GetMaxHealth(); | |
2131 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2132 { | |
2133 LODWORD(v21->pConditions[13]) = 0; | |
2134 HIDWORD(v21->pConditions[13]) = 0; | |
2135 } | |
2136 v51 = 1; | |
2137 } | |
2138 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2139 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2140 && !v21->pConditions[14] | |
2141 && !v21->pConditions[16] ) | |
2142 { | |
2143 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2144 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2145 v21->sHealth = v21->GetMaxHealth(); | |
2146 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2147 { | |
2148 LODWORD(v21->pConditions[13]) = 0; | |
2149 HIDWORD(v21->pConditions[13]) = 0; | |
2150 } | |
2151 v51 = 1; | |
2152 } | |
2153 if ( v50 ) | |
2154 { | |
2155 v33 = (char *)&v21->sMana; | |
2156 ++*(int *)v33; | |
2157 if ( v21->sMana > v21->GetMaxMana() ) | |
2158 *(int *)v33 = v21->GetMaxMana(); | |
2159 v51 = 1; | |
2160 } | |
2161 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2162 { | |
2163 v34 = LODWORD(v21->pConditions[13]); | |
2164 --v21->sHealth; | |
2165 v35 = v21->sHealth; | |
2166 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2167 v21->pConditions[13] = pParty->uTimePlayed; | |
2168 if ( v35 < 1 ) | |
2169 { | |
2170 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2171 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2172 { | |
2173 v21->pConditions[13] = pParty->uTimePlayed; | |
2174 } | |
2175 else | |
2176 { | |
2177 if ( !v21->pConditions[14] ) | |
2178 v21->pConditions[14] = pParty->uTimePlayed; | |
2179 } | |
2180 } | |
2181 v51 = 1; | |
2182 } | |
2183 if ( v45 ) | |
2184 { | |
2185 v36 = (char *)&v21->sMana; | |
2186 ++*(int *)v36; | |
2187 if ( v21->sMana > v21->GetMaxMana() ) | |
2188 *(int *)v36 = v21->GetMaxMana(); | |
2189 } | |
2190 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2191 { | |
2192 v37 = v21->sHealth; | |
2193 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2194 v21->sHealth = v37 - 2; | |
2195 v38 = v21->sMana; | |
2196 if ( v38 > v21->GetMaxMana() / 2 ) | |
2197 v21->sMana = v38 - 2; | |
2198 } | |
2199 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2200 { | |
2201 v39 = v21->sHealth; | |
2202 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2203 v21->sHealth = v39 - 1; | |
2204 v40 = v21->sMana; | |
2205 if ( v40 > 0 ) | |
2206 v21->sMana = v40 - 1; | |
2207 } | |
2208 ++v49; | |
2209 if ( v49 >= 4 ) | |
2210 { | |
2211 result = HIDWORD(pParty->uTimePlayed); | |
2212 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2213 if ( !viewparams->bRedrawGameUI ) | |
2214 { | |
2215 result = v51; | |
2216 viewparams->bRedrawGameUI = v51; | |
2217 } | |
2218 return result; | |
2219 } | |
2220 goto LABEL_25; | |
2221 } | |
2222 } | |
2223 } | |
2224 return result; | |
2225 } | |
2226 | |
2227 //----- (00493F79) -------------------------------------------------------- | |
351 | 2228 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2229 { |
2230 signed __int64 v2; // ST2C_8@1 | |
2231 signed __int64 v3; // qax@1 | |
351 | 2232 //signed __int64 v4; // ST1C_8@1 |
0 | 2233 unsigned __int64 v5; // qax@1 |
2234 unsigned int v6; // ebx@1 | |
2235 | |
2236 v2 = (signed __int64)((double)a2 * 0.234375); | |
2237 v3 = v2 / 60 / 60; | |
351 | 2238 //v4 = v3; |
0 | 2239 v5 = (unsigned int)v3 / 0x18; |
2240 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2241 _this->field_0_expire_second = v2 % 60; |
2242 _this->field_4_expire_minute = v2 / 60 % 60; | |
2243 _this->field_8_expire_hour = v3 % 24; | |
2244 _this->field_10_expire_week = v5 / 7 & 3; | |
2245 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2246 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2247 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2248 } |
2249 | |
2250 //----- (00494035) -------------------------------------------------------- | |
1031 | 2251 void _494035_timed_effects__water_walking_damage__etc() |
0 | 2252 { |
2253 signed __int64 v0; // qax@1 | |
2254 signed __int64 v1; // ST30_8@1 | |
2255 signed __int64 v2; // ST38_8@1 | |
2256 unsigned __int64 v3; // qax@1 | |
2257 unsigned int v4; // edi@1 | |
2258 //signed int v5; // eax@4 | |
2259 //char *v6; // ecx@5 | |
2260 //Player *v7; // esi@8 | |
2261 //char *v8; // ecx@12 | |
766 | 2262 //Player *pPlayer; // esi@15 |
0 | 2263 //void *v10; // esi@25 |
2264 unsigned int v11; // ecx@27 | |
2265 signed int v12; // edi@29 | |
2266 Player *v13; // ecx@30 | |
2267 Player *v14; // esi@35 | |
2268 double v15; // st7@35 | |
2269 Player **v16; // esi@43 | |
2270 Player *v17; // edi@44 | |
2271 double v18; // st7@44 | |
816 | 2272 //float v19; // ST28_4@48 |
2273 //double v20; // ST38_8@48 | |
0 | 2274 Player *v21; // esi@51 |
2275 signed int v22; // edi@53 | |
2276 int v23; // eax@59 | |
2277 int v24; // ecx@60 | |
2278 int v25; // eax@63 | |
2279 int v26; // ecx@64 | |
2280 int v27; // eax@67 | |
2281 int v28; // ecx@68 | |
2282 int v29; // eax@71 | |
2283 int v30; // ecx@72 | |
2284 int v31; // eax@75 | |
2285 int v32; // ecx@76 | |
2286 int v33; // eax@79 | |
2287 int v34; // ecx@80 | |
2288 int v35; // eax@83 | |
2289 int v36; // ecx@84 | |
2290 int v37; // eax@87 | |
2291 int v38; // ecx@88 | |
2292 int v39; // eax@91 | |
2293 int v40; // ecx@92 | |
2294 int v41; // eax@95 | |
2295 int v42; // ecx@96 | |
2296 bool v43; // ebx@102 | |
2297 //SpellBuff *v44; // edi@104 | |
2298 //signed int v45; // ebp@104 | |
2299 bool v46; // edi@111 | |
2300 //SpellBuff *v47; // esi@113 | |
2301 //Player **v48; // esi@119 | |
2302 //signed int v49; // edi@121 | |
2303 //char *v50; // esi@122 | |
2304 signed int v51; // edx@128 | |
2305 signed int v52; // ecx@130 | |
2306 int v53; // eax@131 | |
2307 Player *v54; // eax@141 | |
766 | 2308 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2309 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2310 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2311 int v58; // [sp-4h] [bp-34h]@33 |
2312 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2313 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2314 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2315 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2316 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2317 signed int a2a; // [sp+18h] [bp-18h]@47 |
2318 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2319 | |
766 | 2320 //a2 = pParty->uCurrentHour; |
0 | 2321 v61 = pParty->uDaysPlayed; |
816 | 2322 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2323 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2324 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2325 v1 = v0; |
2326 v0 /= 60i64; | |
2327 v2 = v0; | |
2328 v3 = (unsigned int)v0 / 24; | |
2329 v4 = (unsigned int)(v3 / 7) >> 2; | |
2330 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2331 pParty->uCurrentMinute = v1 % 60; | |
2332 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2333 pParty->uCurrentHour = v2 % 24; | |
2334 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2335 pParty->uCurrentMonth = v4 % 12; | |
352 | 2336 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2337 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2338 { |
2339 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2340 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2341 | |
2342 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2343 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2344 | |
766 | 2345 ++pParty->days_played_without_rest; |
2346 if (pParty->days_played_without_rest > 1) | |
0 | 2347 { |
2348 for (uint i = 0; i < 4; ++i) | |
766 | 2349 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2350 | |
2351 if (pParty->uNumFoodRations) | |
2352 Party::TakeFood(1); | |
0 | 2353 else |
2354 for (uint i = 0; i < 4; ++i) | |
766 | 2355 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2356 | |
2357 if (pParty->days_played_without_rest > 3) | |
2358 for (uint i = 0; i < 4; ++i) | |
0 | 2359 { |
766 | 2360 auto player = pParty->pPlayers + i; |
2361 | |
2362 player->Zero(); | |
2363 | |
2364 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2365 { |
767 | 2366 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2367 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2368 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2369 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2370 } |
2371 } | |
766 | 2372 } |
2373 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2374 pOutdoor->SetFog(); |
2375 | |
2376 for (uint i = 0; i < 4; ++i) | |
2377 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2378 } | |
766 | 2379 |
0 | 2380 v11 = LODWORD(pParty->uTimePlayed); |
2381 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2382 { | |
2383 v12 = 1; | |
2384 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2385 viewparams->bRedrawGameUI = 1; | |
2386 while ( 1 ) | |
2387 { | |
1080 | 2388 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 2389 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2390 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2391 { |
2392 v58 = 0; | |
2393 } | |
2394 else | |
2395 { | |
2396 v58 = 0; | |
2397 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2398 { | |
2399 v14 = pPlayers[v12]; | |
2400 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
1036 | 2401 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE); |
0 | 2402 if ( pParty->uFlags & 4 ) |
2403 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2404 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); |
783 | 2405 GameUI_Footer_TimeLeft = 128; |
0 | 2406 } |
2407 goto LABEL_39; | |
2408 } | |
2409 v13 = pPlayers[v12]; | |
2410 } | |
130 | 2411 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2412 LABEL_39: |
2413 ++v12; | |
2414 if ( v12 > 4 ) | |
2415 { | |
2416 v11 = LODWORD(pParty->uTimePlayed); | |
2417 break; | |
2418 } | |
2419 } | |
2420 } | |
2421 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2422 { | |
2423 viewparams->bRedrawGameUI = 1; | |
2424 pParty->field_6FC = v11 + 128; | |
2425 v16 = &pPlayers[1]; | |
2426 do | |
2427 { | |
2428 v17 = *v16; | |
2429 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 2430 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 2431 if ( pParty->uFlags & 0x200 ) |
2432 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2433 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); |
783 | 2434 GameUI_Footer_TimeLeft = 128; |
0 | 2435 } |
2436 ++v16; | |
2437 } | |
2438 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2439 } | |
2440 _493938_regenerate(); | |
2441 v65 = 4; | |
816 | 2442 a2a = pEventTimer->uTimeElapsed; |
2443 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2444 { | |
2445 //v19 = (double)(signed int)prev_time * 0.5; | |
2446 //v20 = v19 + 6.7553994e15; | |
2447 a2a *= 0.5f; | |
2448 if (a2a < 1) | |
0 | 2449 a2a = 1; |
2450 } | |
2451 v62 = &pPlayers[1]; | |
2452 do | |
2453 { | |
2454 v21 = *v62; | |
2455 if ( (*v62)->uTimeToRecovery ) | |
2456 v21->Recover(a2a); | |
2457 v22 = v21->sHealth; | |
2458 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2459 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2460 { | |
2461 if ( v22 >= 1 ) | |
2462 goto LABEL_59; | |
2463 v59 = 0; | |
2464 v56 = 13; | |
2465 } | |
2466 else | |
2467 { | |
2468 v59 = 0; | |
2469 v56 = 14; | |
2470 } | |
2471 v21->SetCondition(v56, v59); | |
2472 LABEL_59: | |
2473 v23 = (int)&v21->field_E0; | |
2474 if ( v21->field_E0 ) | |
2475 { | |
816 | 2476 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2477 if ( v24 > 0 ) |
2478 { | |
2479 *(int *)v23 = v24; | |
2480 } | |
2481 else | |
2482 { | |
2483 *(int *)v23 = 0; | |
2484 viewparams->bRedrawGameUI = 1; | |
2485 } | |
2486 } | |
2487 v25 = (int)&v21->field_E4; | |
2488 if ( v21->field_E4 ) | |
2489 { | |
816 | 2490 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2491 if ( v26 > 0 ) |
2492 { | |
2493 *(int *)v25 = v26; | |
2494 } | |
2495 else | |
2496 { | |
2497 *(int *)v25 = 0; | |
2498 viewparams->bRedrawGameUI = 1; | |
2499 } | |
2500 } | |
2501 v27 = (int)&v21->field_E8; | |
2502 if ( v21->field_E8 ) | |
2503 { | |
816 | 2504 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2505 if ( v28 > 0 ) |
2506 { | |
2507 *(int *)v27 = v28; | |
2508 } | |
2509 else | |
2510 { | |
2511 *(int *)v27 = 0; | |
2512 viewparams->bRedrawGameUI = 1; | |
2513 } | |
2514 } | |
2515 v29 = (int)&v21->field_EC; | |
2516 if ( v21->field_EC ) | |
2517 { | |
816 | 2518 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2519 if ( v30 > 0 ) |
2520 { | |
2521 *(int *)v29 = v30; | |
2522 } | |
2523 else | |
2524 { | |
2525 *(int *)v29 = 0; | |
2526 viewparams->bRedrawGameUI = 1; | |
2527 } | |
2528 } | |
2529 v31 = (int)&v21->field_F0; | |
2530 if ( v21->field_F0 ) | |
2531 { | |
816 | 2532 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2533 if ( v32 > 0 ) |
2534 { | |
2535 *(int *)v31 = v32; | |
2536 } | |
2537 else | |
2538 { | |
2539 *(int *)v31 = 0; | |
2540 viewparams->bRedrawGameUI = 1; | |
2541 } | |
2542 } | |
2543 v33 = (int)&v21->field_F4; | |
2544 if ( v21->field_F4 ) | |
2545 { | |
816 | 2546 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2547 if ( v34 > 0 ) |
2548 { | |
2549 *(int *)v33 = v34; | |
2550 } | |
2551 else | |
2552 { | |
2553 *(int *)v33 = 0; | |
2554 viewparams->bRedrawGameUI = 1; | |
2555 } | |
2556 } | |
2557 v35 = (int)&v21->field_F8; | |
2558 if ( v21->field_F8 ) | |
2559 { | |
816 | 2560 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2561 if ( v36 > 0 ) |
2562 { | |
2563 *(int *)v35 = v36; | |
2564 } | |
2565 else | |
2566 { | |
2567 *(int *)v35 = 0; | |
2568 viewparams->bRedrawGameUI = 1; | |
2569 } | |
2570 } | |
2571 v37 = (int)&v21->field_FC; | |
2572 if ( v21->field_FC ) | |
2573 { | |
816 | 2574 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2575 if ( v38 > 0 ) |
2576 { | |
2577 *(int *)v37 = v38; | |
2578 } | |
2579 else | |
2580 { | |
2581 *(int *)v37 = 0; | |
2582 viewparams->bRedrawGameUI = 1; | |
2583 } | |
2584 } | |
2585 v39 = (int)&v21->field_100; | |
2586 if ( v21->field_100 ) | |
2587 { | |
816 | 2588 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2589 if ( v40 > 0 ) |
2590 { | |
2591 *(int *)v39 = v40; | |
2592 } | |
2593 else | |
2594 { | |
2595 *(int *)v39 = 0; | |
2596 viewparams->bRedrawGameUI = 1; | |
2597 } | |
2598 } | |
2599 v41 = (int)&v21->field_104; | |
2600 if ( v21->field_104 ) | |
2601 { | |
816 | 2602 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2603 if ( v42 > 0 ) |
2604 { | |
2605 *(int *)v41 = v42; | |
2606 } | |
2607 else | |
2608 { | |
2609 *(int *)v41 = 0; | |
2610 viewparams->bRedrawGameUI = 1; | |
2611 } | |
2612 } | |
2613 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2614 --v65; | |
2615 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2616 | |
2617 for (uint k = 0; k < 24; ++k) | |
2618 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2619 | |
2620 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2621 v21->SetCondition(1u, 0); | |
2622 ++v62; | |
2623 } | |
2624 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
1167 | 2625 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 2626 |
2627 for (uint i = 0; i < 20; ++i) | |
2628 { | |
2629 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2630 viewparams->bRedrawGameUI = 1; | |
2631 } | |
2632 | |
1167 | 2633 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 2634 { |
2635 for (uint i = 0; i < 4; ++i) | |
2636 pParty->pPlayers[i].SetCondition(1, 0); | |
2637 } | |
2638 | |
2639 for (uint i = 0; i < 2; ++i) | |
2640 { | |
2641 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2642 if (pBuf->uExpireTime == 0) | |
2643 continue; | |
2644 | |
2645 if ( !(pBuf->uFlags & 1) ) | |
2646 { | |
2647 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2648 { | |
2649 pBuf->Reset(); | |
2650 if (dword_4EE07C[i] == 7 ) | |
2651 pParty->bFlying = false; | |
2652 } | |
2653 } | |
2654 } | |
2655 | |
2656 v51 = v65; | |
2657 if ( v65 ) | |
2658 goto LABEL_135; | |
151 | 2659 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2660 { |
2661 v52 = (signed int)&pPlayers[1]; | |
2662 while ( 1 ) | |
2663 { | |
2664 v53 = *(int *)v52; | |
2665 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2666 break; | |
2667 v52 += 4; | |
2668 if ( v52 > (signed int)&pPlayers[4] ) | |
2669 goto LABEL_135; | |
2670 } | |
2671 *(int *)(v53 + 16) = 0; | |
2672 *(int *)(v53 + 20) = 0; | |
2673 v51 = 1; | |
2674 LABEL_135: | |
151 | 2675 if ( pCurrentScreen != SCREEN_REST |
0 | 2676 && (!v51 || dword_5C35C0) ) |
981 | 2677 uGameState = GAME_STATE_PARTY_DIED; |
0 | 2678 } |
2679 if ( uActiveCharacter ) | |
2680 { | |
151 | 2681 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2682 { |
2683 v54 = pPlayers[uActiveCharacter]; | |
2684 if ( v54->pConditions[2] | |
2685 || v54->pConditions[12] | |
2686 || v54->pConditions[13] | |
2687 || v54->pConditions[14] | |
2688 || v54->pConditions[15] | |
2689 || v54->pConditions[16] ) | |
2690 { | |
2691 viewparams->bRedrawGameUI = 1; | |
2692 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2693 } | |
2694 } | |
2695 } | |
2696 } | |
2697 | |
2698 //----- (00494820) -------------------------------------------------------- | |
758 | 2699 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2700 { |
2701 signed int v1; // eax@1 | |
2702 | |
2703 v1 = 5; | |
758 | 2704 if ( a1 % 24 >= 5 ) |
0 | 2705 v1 = 29; |
758 | 2706 return v1 - a1 % 24; |
0 | 2707 } |
2708 | |
2709 //----- (00494836) -------------------------------------------------------- | |
2710 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2711 { | |
2712 int v3; // esi@1 | |
2713 int result; // eax@1 | |
2714 stru339_spell_sound *v5; // ebx@1 | |
2715 int *v6; // edi@2 | |
2716 unsigned int v7; // eax@3 | |
2717 int v8; // [sp+Ch] [bp-8h]@3 | |
2718 int v9; // [sp+10h] [bp-4h]@2 | |
2719 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2720 | |
2721 v3 = 0; | |
2722 result = word_4EE088_sound_ids[uSoundID]; | |
2723 v5 = this; | |
2724 a2a = word_4EE088_sound_ids[uSoundID]; | |
2725 if ( result ) | |
2726 { | |
2727 v9 = 0; | |
2728 v6 = this->pSoundsOffsets; | |
2729 do | |
2730 { | |
2731 v7 = a2a++; | |
2732 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2733 if ( !result ) | |
2734 break; | |
2735 a6 += 4; | |
2736 result = v8 + 256; | |
2737 *v6 = v3; | |
2738 v3 += result; | |
2739 ++v9; | |
2740 *(v6 - 2) = result; | |
2741 ++v6; | |
2742 } | |
2743 while ( v9 < 2 ); | |
2744 } | |
2745 return result; | |
2746 } | |
2747 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2748 | |
2749 //----- (00494AED) -------------------------------------------------------- | |
130 | 2750 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2751 { |
2752 unsigned int _uNumFrames; // edx@1 | |
2753 unsigned int result; // eax@1 | |
2754 PlayerFrame *v4; // ecx@2 | |
2755 | |
2756 _uNumFrames = this->uNumFrames; | |
2757 result = 0; | |
2758 if ( (signed int)this->uNumFrames <= 0 ) | |
2759 { | |
2760 LABEL_5: | |
2761 result = 0; | |
2762 } | |
2763 else | |
2764 { | |
2765 v4 = this->pFrames; | |
130 | 2766 while ( v4->expression != expression ) |
0 | 2767 { |
2768 ++result; | |
2769 ++v4; | |
2770 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2771 goto LABEL_5; | |
2772 } | |
2773 } | |
2774 return result; | |
2775 } | |
2776 | |
2777 //----- (00494B10) -------------------------------------------------------- | |
2778 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2779 { | |
2780 unsigned int v3; // esi@1 | |
2781 PlayerFrame *v4; // edi@1 | |
2782 PlayerFrame *v5; // ecx@1 | |
2783 __int16 v6; // dx@2 | |
2784 int v7; // edx@3 | |
2785 char *i; // eax@3 | |
2786 int v9; // ecx@5 | |
2787 PlayerFrame *result; // eax@6 | |
2788 | |
2789 v3 = uFramesetID; | |
2790 v4 = this->pFrames; | |
2791 v5 = &v4[uFramesetID]; | |
2792 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2793 { | |
2794 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2795 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2796 { | |
2797 v9 = *(short *)i; | |
2798 if ( v7 <= v9 ) | |
2799 break; | |
2800 v7 -= v9; | |
2801 ++v3; | |
2802 } | |
2803 result = &v4[v3]; | |
2804 } | |
2805 else | |
2806 { | |
2807 result = &v4[uFramesetID]; | |
2808 } | |
2809 return result; | |
2810 } | |
2811 | |
2812 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2813 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2814 { |
2815 PlayerFrameTable *v4; // edi@1 | |
2816 int v5; // esi@1 | |
2817 int v6; // eax@2 | |
2818 | |
2819 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2820 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2821 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
|
2822 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2823 *pAnimTime = v5; |
0 | 2824 } |
2825 else | |
2826 { | |
2827 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2828 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2829 *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
|
2830 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2831 return &v4->pFrames[*pFramesetID]; |
0 | 2832 } |
2833 | |
2834 //----- (00494BC3) -------------------------------------------------------- | |
2835 void PlayerFrameTable::ToFile() | |
2836 { | |
2837 PlayerFrameTable *v1; // esi@1 | |
2838 FILE *v2; // eax@1 | |
2839 FILE *v3; // edi@1 | |
2840 | |
2841 auto Str = this; | |
2842 | |
2843 v1 = Str; | |
2844 v2 = fopen("data\\dpft.bin", "wb"); | |
2845 v3 = v2; | |
2846 if ( !v2 ) | |
2847 Abortf("Unable to save dpft.bin!"); | |
2848 fwrite(v1, 4u, 1u, v2); | |
2849 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2850 fclose(v3); | |
2851 } | |
2852 | |
2853 //----- (00494C0F) -------------------------------------------------------- | |
2854 void PlayerFrameTable::FromFile(void *pSerialized) | |
2855 { | |
2856 uNumFrames = *(int *)pSerialized; | |
2857 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2858 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2859 } | |
2860 | |
2861 //----- (00494C5A) -------------------------------------------------------- | |
2862 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2863 { | |
2864 PlayerFrameTable *v2; // ebx@1 | |
2865 FILE *v3; // eax@1 | |
2866 int v4; // esi@3 | |
2867 void *v5; // eax@10 | |
2868 FILE *v6; // ST0C_4@12 | |
2869 char *i; // eax@12 | |
2870 __int16 v8; // ax@15 | |
2871 const char *v9; // ST10_4@15 | |
2872 unsigned __int16 v10; // ax@15 | |
2873 const char *v11; // ST0C_4@15 | |
2874 int j; // esi@15 | |
2875 int v13; // eax@17 | |
2876 int v14; // edx@22 | |
2877 int v15; // ecx@23 | |
2878 int v16; // eax@24 | |
2879 signed int k; // eax@27 | |
2880 PlayerFrame *v18; // edx@28 | |
2881 int v19; // esi@28 | |
2882 int l; // ecx@29 | |
2883 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2884 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2885 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2886 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2887 int v26; // [sp+2FCh] [bp-8h]@3 | |
2888 FILE *File; // [sp+300h] [bp-4h]@1 | |
2889 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
2890 | |
2891 v2 = this; | |
2892 //TileTable::dtor((TileTable *)this); | |
2893 v3 = fopen(Args, "r"); | |
2894 File = v3; | |
2895 if ( !v3 ) | |
2896 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
2897 v4 = 0; | |
2898 v25 = 0; | |
2899 v26 = 1; | |
2900 if ( fgets(&Buf, 490, v3) ) | |
2901 { | |
2902 do | |
2903 { | |
2904 *strchr(&Buf, 10) = 0; | |
703 | 2905 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2906 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
2907 { | |
2908 if ( v24.uPropCount < 3 ) | |
0 | 2909 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
2910 ++v25; | |
2911 } | |
2912 ++v26; | |
2913 } | |
2914 while ( fgets(&Buf, 490, File) ); | |
2915 v4 = v25; | |
2916 } | |
2917 v2->uNumFrames = v4; | |
2918 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
2919 v2->pFrames = (PlayerFrame *)v5; | |
2920 if ( !v5 ) | |
2921 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
2922 v6 = File; | |
2923 v2->uNumFrames = 0; | |
2924 fseek(v6, 0, 0); | |
2925 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
2926 { | |
2927 *strchr(&Buf, 10) = 0; | |
703 | 2928 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2929 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 2930 { |
2931 v8 = atoi(v24.pProperties[0]); | |
2932 v9 = v24.pProperties[1]; | |
130 | 2933 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 2934 v10 = atoi(v9); |
2935 v11 = v24.pProperties[2]; | |
2936 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
2937 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
2938 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
2939 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 2940 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 2941 { |
1104 | 2942 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 2943 { |
2944 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
2945 *(char *)v13 |= 4u; | |
2946 } | |
2947 } | |
2948 ++v2->uNumFrames; | |
2949 } | |
2950 } | |
2951 fclose(File); | |
2952 v14 = 0; | |
2953 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
2954 { | |
2955 v15 = 0; | |
2956 do | |
2957 { | |
2958 v16 = (int)&v2->pFrames[v15]; | |
2959 if ( !(*(char *)(v16 + 18) & 4) ) | |
2960 *(char *)(v16 + 8) |= 1u; | |
2961 ++v14; | |
2962 ++v15; | |
2963 } | |
2964 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
2965 } | |
2966 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
2967 { | |
2968 v18 = v2->pFrames; | |
2969 Argsa = (int)&v18[k]; | |
2970 v19 = *(short *)(Argsa + 4); | |
2971 if ( *(char *)(Argsa + 8) & 1 ) | |
2972 { | |
2973 ++k; | |
2974 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
2975 { | |
2976 v19 += *(short *)(l + 4); | |
2977 ++k; | |
2978 } | |
2979 LOWORD(v19) = v18[k].uAnimTime + v19; | |
2980 } | |
2981 ++k; | |
2982 } | |
2983 return 1; | |
2984 } | |
2985 | |
2986 //----- (00494F3A) -------------------------------------------------------- | |
2987 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
2988 { | |
2989 IconFrameTable *v2; // esi@1 | |
2990 int v3; // ebx@1 | |
2991 unsigned int uID; // edi@1 | |
2992 unsigned int result; // eax@4 | |
2993 | |
2994 v2 = this; | |
2995 v3 = 0; | |
2996 uID = 0; | |
2997 if ( (signed int)this->uNumIcons <= 0 ) | |
2998 { | |
2999 LABEL_4: | |
3000 result = 0; | |
3001 } | |
3002 else | |
3003 { | |
1104 | 3004 while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) ) |
0 | 3005 { |
3006 ++uID; | |
3007 ++v3; | |
3008 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3009 goto LABEL_4; | |
3010 } | |
3011 result = uID; | |
3012 } | |
3013 return result; | |
3014 } | |
3015 | |
3016 //----- (00494F70) -------------------------------------------------------- | |
3017 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3018 { | |
3019 IconFrame *v3; // edi@1 | |
3020 IconFrame *v4; // ecx@1 | |
3021 __int16 v5; // dx@2 | |
3022 int v6; // edx@3 | |
3023 unsigned int v7; // eax@3 | |
3024 char *i; // ecx@3 | |
3025 int v9; // esi@5 | |
3026 IconFrame *result; // eax@6 | |
3027 | |
3028 v3 = this->pIcons; | |
3029 v4 = &v3[uIconID]; | |
3030 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3031 { | |
3032 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3033 v7 = uIconID; | |
3034 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3035 { | |
3036 v9 = *(short *)i; | |
3037 if ( v6 <= v9 ) | |
3038 break; | |
3039 v6 -= v9; | |
3040 ++v7; | |
3041 } | |
3042 result = &v3[v7]; | |
3043 } | |
3044 else | |
3045 { | |
3046 result = &v3[uIconID]; | |
3047 } | |
3048 return result; | |
3049 } | |
3050 | |
3051 //----- (00494FBF) -------------------------------------------------------- | |
3052 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3053 { | |
3054 IconFrameTable *v2; // esi@1 | |
3055 unsigned int v3; // edi@3 | |
3056 const char *i; // eax@3 | |
3057 IconFrame *v5; // eax@5 | |
3058 | |
3059 v2 = this; | |
3060 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3061 { | |
3062 v3 = uIconID; | |
3063 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3064 { | |
3065 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3066 v5 = v2->pIcons; | |
3067 if ( !(v5[v3].uFlags & 1) ) | |
3068 break; | |
3069 ++v3; | |
3070 } | |
3071 } | |
3072 } | |
3073 | |
3074 //----- (0049500A) -------------------------------------------------------- | |
3075 void IconFrameTable::ToFile() | |
3076 { | |
3077 IconFrameTable *v1; // esi@1 | |
3078 FILE *v2; // eax@1 | |
3079 FILE *v3; // edi@1 | |
3080 | |
3081 auto Str = this; | |
3082 | |
3083 v1 = Str; | |
3084 v2 = fopen("data\\dift.bin", "wb"); | |
3085 v3 = v2; | |
3086 if ( !v2 ) | |
3087 Abortf("Unable to save dift.bin!"); | |
3088 fwrite(v1, 4u, 1u, v2); | |
3089 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3090 fclose(v3); | |
3091 } | |
3092 | |
3093 //----- (00495056) -------------------------------------------------------- | |
3094 void IconFrameTable::FromFile(void *pSerialized) | |
3095 { | |
3096 uNumIcons = *(int *)pSerialized; | |
3097 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3098 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3099 } | |
3100 | |
3101 //----- (0049509D) -------------------------------------------------------- | |
3102 int IconFrameTable::FromFileTxt(const char *Args) | |
3103 { | |
3104 IconFrameTable *v2; // ebx@1 | |
3105 FILE *v3; // eax@1 | |
3106 int v4; // esi@3 | |
3107 void *v5; // eax@10 | |
3108 FILE *v6; // ST0C_4@12 | |
3109 char *i; // eax@12 | |
3110 const char *v8; // ST00_4@15 | |
3111 int v9; // eax@16 | |
3112 int v10; // edx@20 | |
3113 int v11; // ecx@21 | |
3114 int v12; // eax@22 | |
3115 signed int j; // edx@25 | |
3116 IconFrame *v14; // ecx@26 | |
3117 int v15; // esi@26 | |
3118 int k; // eax@27 | |
3119 signed int result; // eax@11 | |
3120 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3121 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3122 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3123 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3124 int v22; // [sp+2FCh] [bp-8h]@3 | |
3125 FILE *File; // [sp+300h] [bp-4h]@1 | |
3126 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3127 | |
3128 v2 = this; | |
3129 //TileTable::dtor((TileTable *)this); | |
3130 v3 = fopen(Args, "r"); | |
3131 File = v3; | |
3132 if ( !v3 ) | |
3133 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3134 v4 = 0; | |
3135 v21 = 0; | |
3136 v22 = 1; | |
3137 if ( fgets(&Buf, 490, v3) ) | |
3138 { | |
3139 do | |
3140 { | |
3141 *strchr(&Buf, 10) = 0; | |
3142 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3143 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3144 { | |
3145 if ( v20.uPropCount < 3 ) | |
0 | 3146 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3147 ++v21; | |
3148 } | |
3149 ++v22; | |
3150 } | |
3151 while ( fgets(&Buf, 490, File) ); | |
3152 v4 = v21; | |
3153 } | |
3154 v2->uNumIcons = v4; | |
3155 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3156 v2->pIcons = (IconFrame *)v5; | |
3157 if ( v5 ) | |
3158 { | |
3159 v6 = File; | |
3160 v2->uNumIcons = 0; | |
3161 fseek(v6, 0, 0); | |
3162 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3163 { | |
3164 *strchr(&Buf, 10) = 0; | |
3165 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3166 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3167 { |
3168 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3169 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3170 v8 = v20.pProperties[2]; | |
3171 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
1104 | 3172 if ( !_stricmp(v8, "new") ) |
0 | 3173 { |
3174 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3175 *(char *)v9 |= 4u; | |
3176 } | |
3177 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3178 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3179 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3180 } | |
3181 } | |
3182 fclose(File); | |
3183 v10 = 0; | |
3184 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3185 { | |
3186 v11 = 0; | |
3187 do | |
3188 { | |
3189 v12 = (int)&v2->pIcons[v11]; | |
3190 if ( !(*(char *)(v12 + 60) & 4) ) | |
3191 *(char *)(v12 + 28) |= 1u; | |
3192 ++v10; | |
3193 ++v11; | |
3194 } | |
3195 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3196 } | |
3197 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3198 { | |
3199 v14 = v2->pIcons; | |
3200 Argsa = (int)&v14[j]; | |
3201 v15 = *(short *)(Argsa + 24); | |
3202 if ( *(char *)(Argsa + 28) & 1 ) | |
3203 { | |
3204 ++j; | |
3205 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3206 { | |
3207 v15 += *(short *)(k + 24); | |
3208 ++j; | |
3209 } | |
3210 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3211 } | |
3212 ++j; | |
3213 } | |
3214 result = 1; | |
3215 } | |
3216 else | |
3217 { | |
3218 fclose(File); | |
3219 result = 0; | |
3220 } | |
3221 return result; | |
3222 } | |
3223 | |
3224 //----- (00495366) -------------------------------------------------------- | |
3225 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3226 { | |
3227 int v2; // edi@1 | |
3228 int v3; // edx@2 | |
3229 int v4; // esi@3 | |
3230 int v5; // ebx@5 | |
3231 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3232 signed int v8; // [sp+10h] [bp-10h]@1 | |
3233 int **v9; // [sp+14h] [bp-Ch]@4 | |
3234 signed int v10; // [sp+18h] [bp-8h]@3 | |
3235 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3236 | |
3237 v2 = a1; | |
3238 v11 = a2; | |
3239 v8 = 0; | |
3240 v7 = 0; | |
3241 if ( dword_AE336C == a1 ) | |
3242 { | |
3243 v3 = dword_AE3370; | |
3244 } | |
3245 else | |
3246 { | |
3247 v4 = a2; | |
3248 dword_AE336C = a1; | |
3249 v10 = 0; | |
3250 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3251 goto LABEL_17; | |
3252 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3253 do | |
3254 { | |
3255 v5 = tolower(*(char *)*v9); | |
3256 if ( v5 == tolower(v2) ) | |
3257 { | |
3258 if ( v8 ) | |
3259 v7 = v10; | |
3260 else | |
3261 v8 = v10; | |
3262 } | |
3263 ++v10; | |
3264 v9 += 2; | |
3265 } | |
3266 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3267 if ( v8 && v8 != v7 ) | |
3268 v3 = v8 + rand() % (v7 - v8); | |
3269 else | |
3270 LABEL_17: | |
3271 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3272 } | |
3273 dword_AE3370 = v3; | |
3274 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3275 } | |
3276 // AE336C: using guessed type int dword_AE336C; | |
3277 // AE3370: using guessed type int dword_AE3370; | |
3278 | |
3279 //----- (00495430) -------------------------------------------------------- | |
607 | 3280 char * GetReputationString( signed int a1 ) |
3281 { | |
566 | 3282 if (a1 >= 25) |
3283 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3284 else if (a1 >= 6) | |
3285 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3286 else if (a1 >= -5) | |
3287 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3288 else if (a1 >= -24) | |
3289 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3290 else |
566 | 3291 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3292 } |
3293 | |
3294 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3295 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3296 { |
3297 unsigned __int8 v6; // bl@1 | |
3298 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3299 //NPCData *v9; // eax@4 |
250 | 3300 //size_t v10; // eax@6 |
0 | 3301 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3302 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3303 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3304 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3305 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3306 //int v16; // edx@10 |
0 | 3307 int v17; // eax@10 |
3308 signed __int64 v18; // qax@18 | |
3309 unsigned int v19; // edi@32 | |
3310 unsigned __int8 *v20; // ebx@32 | |
3311 int v21; // ecx@34 | |
3312 __int16 v22; // ax@34 | |
3313 int v23; // edx@39 | |
3314 int v24; // eax@39 | |
3315 int v25; // eax@45 | |
3316 float *v26; // esi@68 | |
3317 float v27; // ST18_4@68 | |
3318 signed int v28; // eax@68 | |
3319 int v29; // eax@68 | |
3320 float v30; // ST18_4@72 | |
3321 signed int v31; // eax@72 | |
3322 float v32; // ST18_4@74 | |
3323 signed int v33; // eax@74 | |
3324 double v34; // st7@75 | |
3325 float v35; // ST18_4@76 | |
3326 signed int v36; // eax@76 | |
3327 float *v37; // esi@78 | |
3328 float v38; // ST18_4@78 | |
3329 int v39; // eax@78 | |
3330 float v40; // ST18_4@82 | |
3331 int v41; // eax@82 | |
3332 float v42; // ST18_4@83 | |
3333 int v43; // eax@83 | |
3334 float v44; // ST18_4@85 | |
3335 int v45; // eax@85 | |
3336 const char *v46; // eax@86 | |
3337 unsigned int v47; // eax@87 | |
3338 float v48; // ST18_4@97 | |
3339 __int64 v49; // ST14_8@107 | |
3340 int v50; // eax@107 | |
3341 int v51; // eax@108 | |
3342 Player *v52; // eax@109 | |
3343 int v53; // [sp-4h] [bp-13Ch]@107 | |
3344 int v54; // [sp+0h] [bp-138h]@107 | |
3345 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3346 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3347 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3348 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3349 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3350 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3351 //Player *v61; // [sp+124h] [bp-14h]@3 |
3352 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3353 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3354 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3355 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3356 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3357 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3358 |
0 | 3359 |
3360 v6 = uPlayerID; | |
249 | 3361 //Str = lpsz; |
0 | 3362 if ( IsBadStringPtrA(lpsz, 1u) ) |
3363 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3364 |
0 | 3365 a1[0] = 0; |
3366 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3367 v59 = TargetColor(255, 255, 155); |
249 | 3368 //v61 = pPlayer; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3369 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3370 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3371 NPCData *npc = nullptr; |
0 | 3372 if ( dword_5C35D4 ) |
248 | 3373 { |
463 | 3374 //__debugbreak(); // fix |
1211 | 3375 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
|
3376 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3377 else |
602 | 3378 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3379 //v65 = v9; |
250 | 3380 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3381 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3382 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3383 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3384 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3385 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3386 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3387 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3388 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3389 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3390 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3391 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3392 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3393 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3394 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3395 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3396 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3397 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3398 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3399 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3400 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3401 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3402 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3403 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
|
3404 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3405 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3406 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3407 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3408 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3409 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3410 case 2: |
0 | 3411 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3412 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3413 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3414 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3415 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3416 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3417 case 5: |
0 | 3418 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3419 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3420 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3421 { | |
3422 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3423 { | |
3424 if ( v18 < 20 ) | |
3425 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3426 } | |
3427 else | |
3428 { | |
3429 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3430 } | |
3431 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3432 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3433 case 6: |
0 | 3434 if ( pPlayer->uSex ) |
3435 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3436 else | |
3437 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3438 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3439 case 7: |
0 | 3440 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3441 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3442 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3443 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3444 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3445 case 8: |
0 | 3446 v19 = 0; |
3447 v63 = 0; | |
484 | 3448 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3449 do |
3450 { | |
3451 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3452 { | |
3453 v21 = v63; | |
3454 v22 = word_4EE150[v19]; | |
3455 ++v63; | |
3456 v55[v21] = v22; | |
3457 } | |
3458 ++v19; | |
3459 } | |
3460 while ( v19 < 28 ); | |
3461 if ( v63 ) | |
3462 { | |
3463 v23 = rand() % v63; | |
3464 v24 = dword_A74CDC; | |
3465 if ( dword_A74CDC == -1 ) | |
3466 { | |
3467 v24 = v23; | |
3468 dword_A74CDC = v23; | |
3469 } | |
492 | 3470 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3471 } |
3472 else | |
3473 { | |
3474 v11 = (char *)pNPCTopics[55].pText; | |
3475 } | |
249 | 3476 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3482 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3483 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3484 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3485 case 10: |
0 | 3486 if ( pPlayer->uSex ) |
3487 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3488 else | |
3489 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3490 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 case 11: |
0 | 3492 v25 = GetPartyReputation(); |
3493 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3495 v25 = npc->rep; |
0 | 3496 LABEL_46: |
3497 if ( v25 >= 25 ) | |
3498 { | |
3499 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3500 } | |
3501 else | |
3502 { | |
3503 if ( v25 < 6 ) | |
3504 { | |
3505 if ( v25 >= -5 ) | |
3506 { | |
3507 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3508 } | |
3509 else | |
3510 { | |
3511 if ( v25 < -24 ) | |
3512 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3513 else | |
3514 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3515 } | |
3516 } | |
3517 else | |
3518 { | |
3519 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3520 } | |
3521 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 case 13: |
0 | 3524 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 _continue_strcat: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3539 strcat(pTmpBuf2.data(), v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3540 dst = strlen(pTmpBuf2.data()); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3542 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3543 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3544 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3546 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3554 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 sprintf(a1, "%lu", pay_percentage); |
250 | 3561 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3570 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3571 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3572 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 sprintf(a1, "%lu", v51); |
0 | 3575 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3576 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3577 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3580 v47 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3584 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3585 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3592 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3602 switch ( a5 ) |
3603 { | |
3604 case 3: | |
3605 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3606 v45 = a3->GetValue(); |
0 | 3607 v29 = pPlayer->_4B8213(v45, v44); |
3608 break; | |
3609 case 4: | |
3610 v29 = pPlayer->_4B824B(*v37); | |
3611 break; | |
3612 case 5: | |
3613 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 v43 = a3->GetValue(); |
0 | 3615 v29 = pPlayer->_4B8265(v43, v42); |
3616 break; | |
3617 case 6: | |
3618 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 v41 = a3->GetValue(); |
0 | 3620 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3621 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3622 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3623 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3624 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3625 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3626 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3627 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3628 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3629 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3630 v28 = a3->GetValue(); |
749 | 3631 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3632 if ( a5 == 3 ) |
3633 { | |
3634 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3635 v36 = a3->GetValue(); |
917 | 3636 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3637 if (a3->Broken()) |
0 | 3638 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3639 goto _continue_sprintf; |
0 | 3640 } |
3641 if ( a5 != 4 ) | |
3642 { | |
3643 if ( a5 == 5 ) | |
3644 { | |
3645 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 v33 = a3->GetValue(); |
916 | 3647 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3648 } |
3649 else | |
3650 { | |
3651 if ( a5 == 6 ) | |
3652 { | |
3653 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 v31 = a3->GetValue(); |
917 | 3655 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3656 if (a3->Broken()) |
0 | 3657 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 goto _continue_sprintf; |
0 | 3661 } |
3662 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 _continue_sprintf: |
0 | 3664 sprintf(a1, "%lu", v29); |
250 | 3665 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 goto _continue_strcat; |
0 | 3667 } |
3668 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 |
0 | 3670 v48 = v34; |
916 | 3671 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 v48 = v34; |
916 | 3687 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 sub_493F79(&v57, *a6); |
351 | 3696 v54 = v57.field_18_expire_year; |
3697 v53 = v57.field_C_expire_day + 1; | |
3698 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 default: |
0 | 3713 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 goto _continue_strcat; |
484 | 3717 v49 = pParty->field_3C._s_times[v17-51]; |
3718 | |
0 | 3719 sub_493F79(&v56, v49); |
351 | 3720 v54 = v56.field_18_expire_year; |
3721 v53 = v56.field_C_expire_day + 1; | |
3722 v50 = v56.field_14_exprie_month; | |
0 | 3723 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3724 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3725 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3726 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3727 } |
0 | 3728 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3729 return pTmpBuf2.data(); |
0 | 3730 } |
3731 | |
3732 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3733 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3734 { |
734 | 3735 //stru154 *v3; // edi@1 |
3736 //signed int v4; // eax@1 | |
3737 //signed int result; // eax@9 | |
3738 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3739 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3740 float v7; |
0 | 3741 |
3742 v.x = 0.0; | |
3743 v.y = 0.0; | |
3744 v.z = 0.0; | |
734 | 3745 GetFacePlane(a2, a3, &v, &v7); |
3746 | |
3747 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3748 polygonType = POLYGON_VerticalWall; | |
3749 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3750 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3751 polygonType = POLYGON_Floor; | |
0 | 3752 else |
734 | 3753 polygonType = POLYGON_InBetweenFloorAndWall; |
3754 | |
3755 face_plane.vNormal.x = v.x; | |
3756 face_plane.vNormal.y = v.y; | |
3757 face_plane.vNormal.z = v.z; | |
3758 face_plane.dist = v7; | |
0 | 3759 } |
3760 | |
3761 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3762 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3763 { |
734 | 3764 if (fabsf(pNormal->z) < 1e-6f) |
3765 polygonType = POLYGON_VerticalWall; | |
3766 else if (fabsf(pNormal->x) < 1e-6f && | |
3767 fabsf(pNormal->y) < 1e-6f) | |
3768 polygonType = POLYGON_Floor; | |
0 | 3769 else |
734 | 3770 polygonType = POLYGON_InBetweenFloorAndWall; |
3771 | |
3772 face_plane.vNormal.x = pNormal->x; | |
3773 face_plane.dist = dist; | |
3774 face_plane.vNormal.y = pNormal->y; | |
3775 face_plane.vNormal.z = pNormal->z; | |
0 | 3776 } |
3777 | |
3778 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3779 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3780 { |
3781 ODMFace *v5; // ebx@1 | |
734 | 3782 //int v6; // eax@1 |
3783 //unsigned __int16 *v7; // ebx@2 | |
3784 //Vec3_int_ *v8; // eax@3 | |
0 | 3785 Vec3_int_ *v9; // ecx@3 |
734 | 3786 //double v10; // st7@3 |
3787 //int v11; // ecx@3 | |
0 | 3788 Vec3_int_ *v12; // ecx@3 |
734 | 3789 //double v13; // st7@3 |
3790 //double v14; // st6@3 | |
3791 //double v15; // st5@3 | |
3792 //int v16; // ecx@3 | |
0 | 3793 Vec3_int_ *v17; // eax@3 |
734 | 3794 //double v18; // st5@3 |
0 | 3795 Vec3_float_ *v19; // eax@3 |
734 | 3796 //int result; // eax@8 |
3797 //float v21; // ecx@10 | |
3798 //double v22; // st7@10 | |
3799 //double v23; // st6@10 | |
0 | 3800 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3801 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3802 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3803 float v27; // [sp+20h] [bp-48h]@3 | |
3804 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3805 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3806 //float v30; // [sp+30h] [bp-38h]@3 | |
3807 //float v31; // [sp+34h] [bp-34h]@3 | |
3808 //float v32; // [sp+38h] [bp-30h]@3 | |
3809 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3810 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3811 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3812 //float v36; // [sp+50h] [bp-18h]@3 | |
3813 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3814 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3815 //int v39; // [sp+64h] [bp-4h]@1 |
3816 | |
3817 //v39 = 0; | |
0 | 3818 v1.x = 0.0; |
3819 v5 = pFace; | |
734 | 3820 //v6 = pFace->uNumVertices; |
0 | 3821 v1.y = 0.0; |
3822 v1.z = 0.0; | |
734 | 3823 |
3824 if (pFace->uNumVertices >= 2) | |
3825 { | |
3826 int i = 0; | |
3827 while ( i < pFace->uNumVertices - 2 ) | |
3828 { | |
3829 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3830 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3831 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 3832 i++; |
734 | 3833 v1.x = v12->x - v9->x; |
3834 v26 = v17->x - v12->x; | |
3835 v1.y = v12->y - v9->y; | |
3836 v27 = v17->y - v12->y; | |
3837 v1.z = v12->z - v9->z; | |
3838 v28 = v17->z - v12->z; | |
0 | 3839 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3840 v38.x = v19->x; | |
3841 v38.y = v19->y; | |
3842 v38.z = v19->z; | |
734 | 3843 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3844 { | |
3845 v38.Normalize(); | |
3846 | |
3847 pOutNormal->x = v38.x; | |
3848 pOutNormal->y = v38.y; | |
3849 pOutNormal->z = v38.z; | |
3850 | |
3851 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3852 return; | |
3853 } | |
3854 } | |
3855 } | |
3856 | |
3857 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3858 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3859 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3860 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3861 } |
3862 | |
3863 //----- (0049D700) -------------------------------------------------------- | |
3864 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3865 { | |
3866 unsigned int v1; // eax@1 | |
3867 int v2; // ecx@1 | |
3868 unsigned int v3; // eax@1 | |
3869 | |
3870 v1 = uDim; | |
3871 v2 = 0; | |
3872 v3 = v1 - 1; | |
3873 while ( v3 & 1 ) | |
3874 { | |
3875 v3 >>= 1; | |
3876 ++v2; | |
3877 } | |
3878 return v3 == 0 ? v2 : 0; | |
3879 } | |
3880 | |
3881 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3882 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3883 { |
737 | 3884 /*signed __int64 v2; // ST10_8@1 |
0 | 3885 double v3; // st7@1 |
3886 float v4; // ST24_4@1 | |
3887 double v5; // ST10_8@1 | |
3888 int v6; // ST1C_4@1 | |
3889 float v7; // ST24_4@1 | |
3890 double v8; // ST10_8@1 | |
3891 unsigned __int8 v9; // ST20_1@1 | |
3892 float v10; // ST24_4@1 | |
3893 double v11; // ST10_8@1 | |
3894 float v12; // ST24_4@1 | |
737 | 3895 double v13; // ST08_8@1*/ |
3896 | |
3897 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
3898 (a2 >> 24) / 255.0f * 255.0f), | |
3899 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
3900 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
3901 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
3902 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
3903 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
3904 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
3905 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
3906 /*v2 = a1 >> 24; | |
3907 v3 = (double)v2 / 255.0f; | |
3908 HIDWORD(v2) = 0; | |
0 | 3909 LODWORD(v2) = a2 >> 24; |
737 | 3910 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 3911 v5 = v4 + 6.7553994e15; |
3912 v6 = LODWORD(v5); | |
737 | 3913 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 3914 v8 = v7 + 6.7553994e15; |
3915 v9 = LOBYTE(v8); | |
737 | 3916 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 3917 v11 = v10 + 6.7553994e15; |
737 | 3918 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 3919 v13 = v12 + 6.7553994e15; |
737 | 3920 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 3921 } |
3922 | |
3923 //----- (004A46E6) -------------------------------------------------------- | |
3924 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
3925 { | |
3926 int v5; // eax@1 | |
3927 int z; // eax@1 | |
3928 unsigned int v7; // eax@9 | |
3929 unsigned int v8; // ecx@9 | |
3930 int v9; // eax@9 | |
3931 unsigned int v10; // eax@10 | |
3932 int *v11; // esi@10 | |
3933 int *v12; // edi@10 | |
3934 int v13; // ecx@10 | |
3935 int v14; // edx@10 | |
3936 unsigned int v15; // eax@22 | |
3937 int *v16; // esi@22 | |
3938 int *v17; // edi@22 | |
3939 int v18; // ecx@22 | |
3940 int v19; // edx@22 | |
3941 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
3942 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
3943 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
3944 signed int v23; // [sp+20h] [bp+Ch]@1 | |
3945 | |
3946 v5 = a4; | |
3947 v23 = _z >> 16; | |
3948 z = x + v5; | |
693 | 3949 if ( z >= (signed int)pViewport->uViewportTL_X |
3950 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
3951 && y >= (signed int)pViewport->uViewportTL_Y | |
3952 && y <= (signed int)pViewport->uViewportBR_Y ) | |
3953 { | |
3954 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
3955 x = pViewport->uViewportTL_X; | |
3956 if ( z > (signed int)pViewport->uViewportBR_X ) | |
3957 z = pViewport->uViewportBR_X; | |
0 | 3958 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
3959 v22 = z - x; | |
3960 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
3961 v7 = lightColor >> 3; | |
3962 v8 = lightColor & 0xF0; | |
3963 v9 = v7 & 0x1E0000; | |
3964 if ( pRenderer->uTargetGBits == 5 ) | |
3965 { | |
3966 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
3967 v11 = (int *)pTarget; | |
3968 v12 = pTargetZ; | |
3969 v13 = v22; | |
3970 v14 = (v10 << 16) | v10; | |
3971 z = (unsigned __int8)pTarget & 2; | |
3972 if ( (unsigned __int8)pTarget & 2 ) | |
3973 { | |
3974 z = (unsigned int)*pTargetZ >> 16; | |
3975 if ( z > v23 ) | |
3976 { | |
3977 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
3978 *pTarget = z; | |
3979 } | |
3980 v13 = v22 - 1; | |
3981 v11 = (int *)(pTarget + 1); | |
3982 v12 = pTargetZ + 1; | |
3983 } | |
3984 while ( v13 != 1 ) | |
3985 { | |
3986 if ( v13 < 1 ) | |
3987 return z; | |
3988 z = (unsigned int)*v12 >> 16; | |
3989 if ( z <= v23 ) | |
3990 { | |
3991 v13 -= 2; | |
3992 ++v11; | |
3993 v12 += 2; | |
3994 } | |
3995 else | |
3996 { | |
3997 v12 += 2; | |
3998 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
3999 v13 -= 2; | |
4000 *v11 = z; | |
4001 ++v11; | |
4002 } | |
4003 } | |
4004 z = (unsigned int)*v12 >> 16; | |
4005 if ( z > v23 ) | |
4006 { | |
4007 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4008 *(short *)v11 = z; | |
4009 } | |
4010 } | |
4011 else | |
4012 { | |
4013 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4014 v16 = (int *)pTarget; | |
4015 v17 = pTargetZ; | |
4016 v18 = v22; | |
4017 v19 = (v15 << 16) | v15; | |
4018 z = (unsigned __int8)pTarget & 2; | |
4019 if ( (unsigned __int8)pTarget & 2 ) | |
4020 { | |
4021 z = (unsigned int)*pTargetZ >> 16; | |
4022 if ( z > v23 ) | |
4023 { | |
4024 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4025 *pTarget = z; | |
4026 } | |
4027 v18 = v22 - 1; | |
4028 v16 = (int *)(pTarget + 1); | |
4029 v17 = pTargetZ + 1; | |
4030 } | |
4031 while ( v18 != 1 ) | |
4032 { | |
4033 if ( v18 < 1 ) | |
4034 return z; | |
4035 z = (unsigned int)*v17 >> 16; | |
4036 if ( z <= v23 ) | |
4037 { | |
4038 v18 -= 2; | |
4039 ++v16; | |
4040 v17 += 2; | |
4041 } | |
4042 else | |
4043 { | |
4044 v17 += 2; | |
4045 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4046 v18 -= 2; | |
4047 *v16 = z; | |
4048 ++v16; | |
4049 } | |
4050 } | |
4051 z = (unsigned int)*v17 >> 16; | |
4052 if ( z > v23 ) | |
4053 { | |
4054 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4055 *(short *)v16 = z; | |
4056 } | |
4057 } | |
4058 } | |
4059 return z; | |
4060 } | |
4061 | |
4062 //----- (004A57E9) -------------------------------------------------------- | |
4063 void __cdecl Present_ColorKey() | |
4064 { | |
4065 HRESULT v0; // eax@3 | |
4066 HRESULT v1; // eax@3 | |
4067 HRESULT v2; // eax@3 | |
4068 HRESULT v3; // eax@3 | |
4069 HRESULT v4; // eax@3 | |
4070 RECT a2; // [sp+4h] [bp-14h]@3 | |
4071 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4072 | |
4073 if ( !pRenderer->uNumSceneBegins ) | |
4074 { | |
4075 if ( pRenderer->field_40110 ) | |
4076 { | |
693 | 4077 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4078 a2.left = 0; |
4079 a2.top = 0; | |
4080 a2.right = 640; | |
4081 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4082 a2.right = 640; | |
4083 a2.left = 0; | |
693 | 4084 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4085 a2.bottom = 480; |
4086 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4087 0, | |
693 | 4088 pViewport->uViewportBR_Y + 1, |
0 | 4089 pRenderer->pColorKeySurface4, |
4090 &a2, | |
4091 16u)); | |
693 | 4092 a2.right = pViewport->uViewportTL_X; |
4093 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4094 a2.left = 0; |
693 | 4095 a2.top = pViewport->uViewportTL_Y; |
0 | 4096 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4097 0, | |
693 | 4098 pViewport->uViewportTL_Y, |
0 | 4099 pRenderer->pColorKeySurface4, |
4100 &a2, | |
4101 16u)); | |
693 | 4102 a2.left = pViewport->uViewportBR_X; |
4103 a2.top = pViewport->uViewportTL_Y; | |
0 | 4104 a2.right = 640; |
693 | 4105 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4106 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4107 pViewport->uViewportBR_X, |
4108 pViewport->uViewportTL_Y, | |
0 | 4109 pRenderer->pColorKeySurface4, |
4110 &a2, | |
4111 16u)); | |
693 | 4112 a2.right = pViewport->uViewportBR_X; |
4113 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4114 a2.left = pViewport->uViewportTL_X; | |
4115 a2.top = pViewport->uViewportTL_Y; | |
0 | 4116 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4117 pViewport->uViewportTL_X, |
4118 pViewport->uViewportTL_Y, | |
0 | 4119 pRenderer->pColorKeySurface4, |
4120 &a2, | |
4121 17u)); | |
4122 } | |
4123 } | |
4124 } | |
4125 | |
4126 //----- (004A597D) -------------------------------------------------------- | |
4127 void Present_NoColorKey() | |
4128 { | |
4129 //unsigned __int16 *v0; // eax@4 | |
4130 unsigned __int16 *v1; // esi@4 | |
4131 void *v2; // edi@4 | |
4132 //signed int v4; // ebx@4 | |
4133 //signed int v5; // ebx@6 | |
4134 //void *v6; // edi@7 | |
4135 //const void *v7; // esi@7 | |
4136 signed int v8; // ebx@8 | |
4137 int v9; // eax@10 | |
4138 unsigned int v10; // esi@10 | |
4139 unsigned __int32 v11; // edi@10 | |
4140 //int v12; // ecx@10 | |
4141 unsigned int v13; // ebx@10 | |
4142 int v14; // eax@11 | |
4143 int v15; // eax@13 | |
4144 int v16; // eax@14 | |
4145 int v17; // eax@16 | |
4146 HRESULT v18; // eax@22 | |
4147 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4148 int v20; // [sp+88h] [bp-1Ch]@10 | |
4149 int v21; // [sp+8Ch] [bp-18h]@10 | |
4150 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4151 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4152 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4153 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4154 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4155 | |
4156 if ( !pRenderer->uNumSceneBegins ) | |
4157 { | |
4158 if ( pRenderer->field_40110 ) | |
4159 { | |
4160 memset(&Dst, 0, 0x7Cu); | |
4161 Dst.dwSize = 124; | |
168 | 4162 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4163 { |
4164 //v26 = Dst.lpSurface; | |
4165 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4166 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4167 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4168 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4169 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4170 v1 = pRenderer->pTargetSurface; | |
4171 v2 = Dst.lpSurface; | |
4172 | |
4173 | |
4174 /*for (uint y = 0; y < 480; ++y) | |
4175 { | |
4176 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4177 for (uint x = 0; x < 640; ++x) | |
4178 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4179 }*/ | |
4180 | |
4181 auto pSrc = pRenderer->pTargetSurface; | |
4182 auto pDst = (__int16 *)Dst.lpSurface; | |
4183 | |
4184 for (uint y = 0; y < 8; ++y) | |
4185 memcpy(pDst + y * Dst.lPitch / 2, | |
4186 | |
4187 pSrc + y * 640, 640 * sizeof(__int16)); | |
4188 | |
4189 for (uint y = 8; y < 352; ++y) | |
4190 { | |
4191 memcpy(pDst + y * Dst.lPitch / 2, | |
4192 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4193 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4194 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4195 } |
4196 | |
121 | 4197 for (uint y = 352; y < 480; ++y) |
0 | 4198 memcpy(pDst + y * Dst.lPitch / 2, |
4199 pSrc + y * 640, 640 * sizeof(__int16)); | |
4200 | |
4201 | |
693 | 4202 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4203 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4204 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4205 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4206 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4207 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4208 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4209 v21 = 4 * v9 + 1280; | |
4210 | |
121 | 4211 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4212 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4213 v10 = (int)pSrc_x1y1; | |
4214 v11 = (int)pDst_x1y1; | |
693 | 4215 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4216 v13 = v24; |
4217 | |
693 | 4218 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4219 { |
4220 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4221 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4222 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4223 { |
4224 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4225 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4226 } | |
4227 } | |
4228 | |
4229 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4230 | |
4231 /* while ( 1 ) | |
4232 { | |
4233 while ( 1 ) | |
4234 { | |
4235 v14 = *(int *)v10; | |
4236 v10 += 4; | |
4237 if ( v14 == v13 ) | |
4238 break; | |
4239 if ( (short)v14 == (short)v13 ) | |
4240 { | |
4241 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4242 v11 += 4; | |
4243 --uHalfWidth; | |
4244 if ( !uHalfWidth ) | |
4245 goto LABEL_21; | |
4246 } | |
4247 else | |
4248 { | |
4249 v15 = __ROL__(v14, 16); | |
4250 if ( (short)v15 == (short)v13 ) | |
4251 { | |
4252 v17 = __ROR__(v15, 16); | |
4253 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4254 v11 += 4; | |
4255 --uHalfWidth; | |
4256 if ( !uHalfWidth ) | |
4257 goto LABEL_21; | |
4258 } | |
4259 else | |
4260 { | |
4261 v16 = __ROR__(v15, 16); | |
4262 *(int *)v11 = v16; | |
4263 v11 += 4; | |
4264 --uHalfWidth; | |
4265 if ( !uHalfWidth ) | |
4266 goto LABEL_21; | |
4267 } | |
4268 } | |
4269 } | |
4270 v11 += 4; | |
4271 --uHalfWidth; | |
4272 if ( !uHalfWidth ) | |
4273 { | |
4274 LABEL_21: | |
4275 v10 += v21; | |
4276 v11 += v22; | |
4277 uHalfWidth = v20; | |
4278 if ( !--uNumLines ) | |
4279 { | |
4280 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4281 return; | |
4282 } | |
4283 } | |
4284 }*/ | |
4285 } | |
4286 } | |
4287 } | |
4288 } | |
4289 | |
4290 //----- (004A7063) -------------------------------------------------------- | |
4291 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4292 { | |
4293 float v2; // ST1C_4@1 | |
4294 double v3; // ST14_8@1 | |
4295 signed int v4; // ebx@1 | |
4296 float v5; // ST1C_4@1 | |
4297 double v6; // ST14_8@1 | |
4298 signed int v7; // edi@1 | |
4299 double v8; // ST0C_8@1 | |
4300 signed int v9; // esi@1 | |
4301 signed int v10; // ecx@1 | |
4302 double v12; // [sp+8h] [bp-18h]@1 | |
4303 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4304 | |
4305 v2 = (double)(uDiffuse >> 24) * a2; | |
4306 v3 = v2 + 6.7553994e15; | |
4307 v4 = LODWORD(v3); | |
4308 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4309 v6 = v5 + 6.7553994e15; | |
4310 v7 = LODWORD(v6); | |
4311 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4312 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4313 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4314 v9 = LODWORD(v8); | |
4315 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4316 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4317 v10 = LODWORD(v12); | |
4318 if ( v4 > 255 ) | |
4319 v4 = 255; | |
4320 if ( v4 < 0 ) | |
4321 v4 = 0; | |
4322 if ( SHIDWORD(v13) > 255 ) | |
4323 v7 = 255; | |
4324 if ( v7 < 0 ) | |
4325 v7 = 0; | |
4326 if ( (signed int)v13 > 255 ) | |
4327 v9 = 255; | |
4328 if ( v9 < 0 ) | |
4329 v9 = 0; | |
4330 if ( SLODWORD(v12) > 255 ) | |
4331 v10 = 255; | |
4332 if ( v10 < 0 ) | |
4333 v10 = 0; | |
4334 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4335 } | |
4336 | |
4337 //----- (004AD504) -------------------------------------------------------- | |
711 | 4338 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4339 { |
4340 int result; // eax@1 | |
711 | 4341 signed int v2; // ebx@1 |
0 | 4342 BLVFace *v3; // esi@3 |
4343 Texture *v4; // edi@6 | |
4344 int v5; // eax@7 | |
4345 int v6; // edx@7 | |
4346 int v7; // ecx@7 | |
4347 int v8; // ebx@8 | |
4348 int v9; // eax@8 | |
4349 int v10; // ebx@8 | |
4350 unsigned int v11; // ebx@9 | |
4351 int v12; // esi@10 | |
4352 int v13; // eax@13 | |
4353 unsigned __int16 *v14; // eax@13 | |
4354 unsigned int v15; // eax@14 | |
4355 unsigned __int16 *v16; // ebx@14 | |
4356 int v17; // eax@15 | |
4357 int v18; // ebx@15 | |
4358 int v19; // esi@15 | |
4359 int v20; // ecx@15 | |
4360 int v21; // eax@15 | |
4361 stru193_math *v22; // ebx@15 | |
4362 int v23; // eax@15 | |
4363 char *v24; // esi@16 | |
4364 int v25; // eax@18 | |
4365 int v26; // eax@18 | |
4366 int v27; // eax@20 | |
4367 signed int v28; // esi@20 | |
4368 signed int v29; // edx@20 | |
4369 signed int v30; // esi@20 | |
4370 signed int v31; // edi@20 | |
4371 int v32; // esi@20 | |
4372 int v33; // eax@26 | |
4373 int *v34; // esi@27 | |
4374 unsigned __int16 *v35; // edi@27 | |
4375 unsigned int v36; // edx@27 | |
4376 int v37; // ebx@27 | |
4377 char v38; // cl@27 | |
4378 char v39; // ch@27 | |
4379 int v40; // ebx@29 | |
4380 int v41; // edx@29 | |
4381 unsigned int v42; // ebx@30 | |
4382 int v43; // edx@30 | |
4383 int v44; // eax@33 | |
4384 int *v45; // esi@34 | |
4385 unsigned __int16 *v46; // edi@34 | |
4386 unsigned int v47; // edx@34 | |
4387 int v48; // ebx@34 | |
4388 char v49; // cl@34 | |
4389 char v50; // ch@34 | |
4390 int v51; // ebx@36 | |
4391 int v52; // edx@36 | |
4392 unsigned __int16 v53; // bx@37 | |
4393 int v54; // edx@37 | |
4394 int v55; // eax@40 | |
4395 int v56; // eax@41 | |
4396 int *v57; // esi@42 | |
4397 unsigned __int16 *v58; // edi@42 | |
4398 unsigned int v59; // edx@42 | |
4399 int v60; // ebx@42 | |
4400 char v61; // cl@42 | |
4401 char v62; // ch@42 | |
4402 unsigned int v63; // ebx@44 | |
4403 int v64; // edx@44 | |
4404 unsigned int v65; // ebx@44 | |
4405 int v66; // edx@44 | |
4406 unsigned int v67; // ebx@45 | |
4407 int v68; // edx@45 | |
4408 int v69; // ebx@45 | |
4409 int v70; // edx@45 | |
4410 int v71; // eax@48 | |
4411 int *v72; // esi@49 | |
4412 unsigned __int16 *v73; // edi@49 | |
4413 unsigned int v74; // edx@49 | |
4414 int v75; // ebx@49 | |
4415 char v76; // cl@49 | |
4416 char v77; // ch@49 | |
4417 unsigned int v78; // ebx@51 | |
4418 int v79; // edx@51 | |
4419 unsigned int v80; // ebx@51 | |
4420 int v81; // edx@51 | |
4421 unsigned int v82; // ebx@52 | |
4422 int v83; // edx@52 | |
4423 int v84; // ebx@52 | |
4424 int v85; // edx@52 | |
4425 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4426 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4427 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4428 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4429 int v90; // [sp+1Ch] [bp-88h]@20 | |
4430 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4431 int v92; // [sp+24h] [bp-80h]@7 | |
4432 int i; // [sp+28h] [bp-7Ch]@7 | |
4433 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4434 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4435 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4436 int v97; // [sp+38h] [bp-6Ch]@15 | |
4437 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4438 int v99; // [sp+40h] [bp-64h]@9 | |
4439 int v100; // [sp+44h] [bp-60h]@24 | |
4440 int v101; // [sp+48h] [bp-5Ch]@10 | |
4441 int v102; // [sp+4Ch] [bp-58h]@20 | |
4442 int v103; // [sp+50h] [bp-54h]@20 | |
4443 int v104; // [sp+54h] [bp-50h]@9 | |
4444 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4445 int v106; // [sp+5Ch] [bp-48h]@24 | |
4446 int v107; // [sp+60h] [bp-44h]@20 | |
4447 int v108; // [sp+64h] [bp-40h]@20 | |
4448 int v109; // [sp+68h] [bp-3Ch]@20 | |
4449 int v110; // [sp+6Ch] [bp-38h]@15 | |
4450 int v111; // [sp+70h] [bp-34h]@20 | |
4451 int a1; // [sp+74h] [bp-30h]@12 | |
4452 int a2; // [sp+78h] [bp-2Ch]@9 | |
4453 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4454 int v115; // [sp+80h] [bp-24h]@18 | |
4455 int v116; // [sp+84h] [bp-20h]@7 | |
4456 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4457 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4458 int *v119; // [sp+90h] [bp-14h]@13 | |
4459 int v120; // [sp+94h] [bp-10h]@15 | |
4460 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4461 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4462 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4463 | |
4464 result = pRenderer->uTargetSurfacePitch; | |
711 | 4465 v2 = sFaceID; |
0 | 4466 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4467 if ( sFaceID >= 0 ) |
4468 { | |
4469 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4470 { | |
4471 v3 = &pIndoor->pFaces[sFaceID]; | |
4472 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4473 if ( !pRenderer->pRenderD3D ) |
4474 { | |
711 | 4475 result = sub_423B5D(sFaceID); |
0 | 4476 if ( result ) |
4477 { | |
4478 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4479 if ( result ) | |
4480 { | |
4481 result = (int)v3->GetTexture(); | |
4482 v4 = (Texture *)result; | |
4483 v96 = (Texture *)result; | |
4484 if ( result ) | |
4485 { | |
4486 v5 = *(short *)(result + 38); | |
4487 LOBYTE(v3->uAttributes) |= 0x80u; | |
4488 v92 = v5; | |
4489 sub_4AE5F1(v2); | |
4490 ++pBLVRenderParams->field_84; | |
4491 v6 = stru_F8AD28.pDeltaUV[0]; | |
4492 v116 = stru_F8AD28.pDeltaUV[1]; | |
4493 v7 = 0; | |
4494 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4495 { | |
4496 v8 = v116; | |
4497 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4498 v9 = 4 * v7 + 16297672; | |
4499 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4500 } | |
4501 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4502 result = stru_F8A590._viewport_space_y; | |
4503 a2 = stru_F8A590._viewport_space_y; | |
4504 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4505 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4506 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4507 v87 = v4->pLevelOfDetail1; |
4508 v88 = v4->pLevelOfDetail2; | |
4509 v89 = v4->pLevelOfDetail3; | |
4510 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4511 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4512 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4513 { | |
4514 v12 = 2 * stru_F8A590._viewport_space_y; | |
4515 v101 = 2 * stru_F8A590._viewport_space_y; | |
4516 while ( 1 ) | |
4517 { | |
4518 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4519 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4520 if ( LOBYTE(viewparams->field_20) ) | |
4521 { | |
4522 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4523 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4524 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4525 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4526 - pBLVRenderParams->uViewportX]; | |
4527 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4528 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4529 - pBLVRenderParams->uViewportX]; | |
4530 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4531 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4532 - pBLVRenderParams->uViewportX]; | |
4533 v123 = (unsigned int)v16; | |
4534 } | |
4535 else | |
4536 { | |
4537 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4538 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4539 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4540 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4541 } | |
4542 v117 = (unsigned int)v14; | |
4543 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4544 v18 = stru_F81018.field_0.field_10; | |
4545 LOWORD(v17) = 0; | |
4546 v97 = stru_F8AD28.field_0 | v17; | |
4547 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4548 v19 = stru_F81018.field_0.field_4 >> i; | |
4549 v20 = 11 - v18; | |
4550 v116 = stru_F81018.field_0.field_8 >> i; | |
4551 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4552 v22 = stru_5C6E00; | |
4553 v122 = (unsigned __int16 *)v20; | |
323 | 4554 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4555 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4556 v120 = v116 + 4 * v23; |
4557 if ( v123 < v117 ) | |
4558 { | |
4559 v24 = (char *)&stru_F81018.field_34.field_8; | |
4560 v114 = &stru_F81018.field_34.field_8; | |
4561 a1 += 16; | |
4562 while ( 1 ) | |
4563 { | |
4564 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4565 v25 = *((int *)v24 - 2); | |
4566 LOWORD(v25) = 0; | |
4567 v115 = v97; | |
4568 v26 = stru_F8AD28.field_0 | v25; | |
4569 if ( v97 <= (unsigned int)v26 ) | |
4570 v115 = v26; | |
4571 v97 = v26; | |
4572 v27 = *((int *)v24 - 11); | |
4573 v28 = *((int *)v24 - 1); | |
4574 v105 = (&v86)[4 * v27]; | |
4575 v111 = v27 + 16; | |
4576 v29 = v4->uWidthMinus1; | |
4577 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4578 v107 = v29 >> v27; | |
4579 v30 = v28 >> i; | |
4580 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4581 v31 = *v114 >> i; | |
4582 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4583 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4584 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4585 v108 = (signed int)(v116 - v121) >> 4; |
4586 v103 = (v90 - v120) >> 4; | |
4587 v32 = v123 + 32; | |
4588 if ( LOBYTE(viewparams->field_20) ) | |
4589 v32 = v123 + 64; | |
4590 if ( v32 > v117 ) | |
4591 v32 = v117; | |
4592 v118 = v32; | |
4593 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4594 v106 = (signed int)(v32 - v123) >> 1; | |
4595 if ( v110 >> 16 == v100 >> 16 ) | |
4596 { | |
4597 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4598 if ( LOBYTE(viewparams->field_20) ) | |
4599 { | |
4600 v44 = v123; | |
4601 if ( v123 < v118 ) | |
4602 { | |
4603 v45 = v119; | |
4604 v46 = v122; | |
4605 v47 = v121; | |
4606 v48 = v120; | |
4607 v49 = v111; | |
4608 v50 = v109; | |
4609 if ( v106 & 2 ) | |
4610 { | |
4611 *v119 = v115; | |
4612 v45 -= 2; | |
4613 v44 = v123 + 4; | |
4614 goto LABEL_37; | |
4615 } | |
4616 do | |
4617 { | |
4618 v44 += 8; | |
4619 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4620 v52 = v115; | |
4621 LOWORD(v51) = v46[v51]; | |
4622 *v45 = v115; | |
4623 v45[1] = v52; | |
4624 v45[640] = v52; | |
4625 v45[641] = v52; | |
4626 *(short *)(v44 - 8) = v51; | |
4627 *(short *)(v44 - 6) = v51; | |
4628 *(short *)(v44 + 1272) = v51; | |
4629 *(short *)(v44 + 1274) = v51; | |
4630 v45[2] = v52; | |
4631 v45[3] = v52; | |
4632 v45[642] = v52; | |
4633 v45[643] = v52; | |
4634 v121 += v108; | |
4635 v120 += v103; | |
4636 v47 = v121; | |
4637 v48 = v120; | |
4638 LABEL_37: | |
4639 v45 += 4; | |
4640 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4641 v54 = v108; | |
4642 *(short *)(v44 - 4) = v53; | |
4643 *(short *)(v44 - 2) = v53; | |
4644 *(short *)(v44 + 1276) = v53; | |
4645 *(short *)(v44 + 1278) = v53; | |
4646 v121 += v54; | |
4647 v120 += v103; | |
4648 v47 = v121; | |
4649 v48 = v120; | |
4650 } | |
4651 while ( v44 < v118 ); | |
4652 v123 = v44; | |
4653 v119 = v45; | |
4654 } | |
4655 } | |
4656 else | |
4657 { | |
4658 v33 = v123; | |
4659 if ( v123 < v118 ) | |
4660 { | |
4661 v34 = v119; | |
4662 v35 = v122; | |
4663 v36 = v121; | |
4664 v37 = v120; | |
4665 v38 = v111; | |
4666 v39 = v109; | |
4667 if ( v106 & 1 ) | |
4668 { | |
4669 *v119 = v115; | |
4670 --v34; | |
4671 v33 = v123 + 2; | |
4672 goto LABEL_30; | |
4673 } | |
4674 do | |
4675 { | |
4676 v33 += 4; | |
4677 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4678 v41 = v115; | |
4679 LOWORD(v40) = v35[v40]; | |
4680 *v34 = v115; | |
4681 *(short *)(v33 - 4) = v40; | |
4682 v34[1] = v41; | |
4683 v121 += v108; | |
4684 v120 += v103; | |
4685 v36 = v121; | |
4686 v37 = v120; | |
4687 LABEL_30: | |
4688 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4689 v34 += 2; | |
4690 v43 = v108; | |
4691 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4692 v121 += v43; | |
4693 v120 += v103; | |
4694 v36 = v121; | |
4695 v37 = v120; | |
4696 } | |
4697 while ( v33 < v118 ); | |
4698 v123 = v33; | |
4699 v119 = v34; | |
4700 } | |
4701 } | |
4702 } | |
4703 else | |
4704 { | |
4705 v55 = v110 - ((v100 - v110) >> 4); | |
4706 v110 = (v100 - v110) >> 4; | |
4707 v122 = (unsigned __int16 *)v55; | |
4708 if ( LOBYTE(viewparams->field_20) ) | |
4709 { | |
4710 v71 = v123; | |
4711 if ( v123 < v118 ) | |
4712 { | |
4713 v72 = v119; | |
4714 v73 = v94; | |
4715 v74 = v121; | |
4716 v75 = v120; | |
4717 v76 = v111; | |
4718 v77 = v109; | |
4719 if ( v106 & 2 ) | |
4720 { | |
4721 *v119 = v115; | |
4722 v72 += 2; | |
4723 v71 = v123 + 4; | |
4724 goto LABEL_52; | |
4725 } | |
4726 do | |
4727 { | |
4728 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4729 v79 = (int)((char *)v122 + v110); | |
4730 v71 += 8; | |
4731 v122 = (unsigned __int16 *)v79; | |
4732 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4733 v81 = v115; | |
4734 LOWORD(v80) = v73[v80]; | |
4735 *v72 = v115; | |
4736 v72[1] = v81; | |
4737 v72[640] = v81; | |
4738 v72[641] = v81; | |
4739 *(short *)(v71 - 8) = v80; | |
4740 *(short *)(v71 - 6) = v80; | |
4741 *(short *)(v71 + 1272) = v80; | |
4742 *(short *)(v71 + 1274) = v80; | |
4743 v72[2] = v81; | |
4744 v72[3] = v81; | |
4745 v72[642] = v81; | |
4746 v72[643] = v81; | |
4747 v121 += v108; | |
4748 v120 += v103; | |
4749 v74 = v121; | |
4750 v75 = v120; | |
4751 v72 += 4; | |
4752 LABEL_52: | |
4753 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4754 v83 = (int)((char *)v122 + v110); | |
4755 v84 = v105[v82]; | |
4756 v122 = (unsigned __int16 *)v83; | |
4757 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4758 v85 = v108; | |
4759 *(short *)(v71 - 4) = v84; | |
4760 *(short *)(v71 - 2) = v84; | |
4761 *(short *)(v71 + 1276) = v84; | |
4762 *(short *)(v71 + 1278) = v84; | |
4763 v121 += v85; | |
4764 v120 += v103; | |
4765 v74 = v121; | |
4766 v75 = v120; | |
4767 } | |
4768 while ( v71 < v118 ); | |
4769 v123 = v71; | |
4770 v119 = v72; | |
4771 } | |
4772 } | |
4773 else | |
4774 { | |
4775 v56 = v123; | |
4776 if ( v123 < v118 ) | |
4777 { | |
4778 v57 = v119; | |
4779 v58 = v94; | |
4780 v59 = v121; | |
4781 v60 = v120; | |
4782 v61 = v111; | |
4783 v62 = v109; | |
4784 if ( v106 & 1 ) | |
4785 { | |
4786 *v119 = v115; | |
4787 ++v57; | |
4788 v56 = v123 + 2; | |
4789 goto LABEL_45; | |
4790 } | |
4791 do | |
4792 { | |
4793 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4794 v64 = (int)((char *)v122 + v110); | |
4795 v56 += 4; | |
4796 v122 = (unsigned __int16 *)v64; | |
4797 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4798 v66 = v115; | |
4799 LOWORD(v65) = v58[v65]; | |
4800 *v57 = v115; | |
4801 *(short *)(v56 - 4) = v65; | |
4802 v57[1] = v66; | |
4803 v121 += v108; | |
4804 v120 += v103; | |
4805 v59 = v121; | |
4806 v60 = v120; | |
4807 v57 += 2; | |
4808 LABEL_45: | |
4809 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4810 v68 = (int)((char *)v122 + v110); | |
4811 v69 = v105[v67]; | |
4812 v122 = (unsigned __int16 *)v68; | |
4813 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4814 v70 = v108; | |
4815 *(short *)(v56 - 2) = v69; | |
4816 v121 += v70; | |
4817 v120 += v103; | |
4818 v59 = v121; | |
4819 v60 = v120; | |
4820 } | |
4821 while ( v56 < v118 ); | |
4822 v123 = v56; | |
4823 v119 = v57; | |
4824 } | |
4825 } | |
4826 } | |
4827 v114 += 13; | |
4828 v110 = v100; | |
4829 a1 += 16; | |
4830 v4 = v96; | |
4831 v121 = v116; | |
4832 v120 = v90; | |
4833 if ( v123 >= v117 ) | |
4834 break; | |
4835 v24 = (char *)v114; | |
4836 v22 = stru_5C6E00; | |
4837 } | |
4838 } | |
4839 ++a2; | |
4840 v98 += v95; | |
4841 result = a2; | |
4842 v101 += 2; | |
4843 v99 += 640; | |
4844 if ( a2 > stru_F8A590._viewport_space_w ) | |
4845 break; | |
4846 v12 = v101; | |
4847 result = a2; | |
4848 v11 = v98; | |
4849 } | |
4850 } | |
4851 } | |
4852 } | |
4853 } | |
4854 } | |
4855 } | |
4856 } | |
4857 return result; | |
4858 } | |
4859 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4860 | |
4861 //----- (004ADD1D) -------------------------------------------------------- | |
4862 void __fastcall sub_4ADD1D(int uFaceID) | |
4863 { | |
4864 int v1; // edi@1 | |
4865 BLVFace *v2; // esi@3 | |
4866 signed int v3; // ebx@4 | |
4867 Texture *v4; // edi@9 | |
4868 signed int v5; // eax@9 | |
4869 char *v6; // edi@12 | |
4870 signed int v7; // eax@15 | |
4871 unsigned int v8; // eax@16 | |
4872 __int16 v9; // cx@19 | |
4873 unsigned __int8 *v10; // eax@19 | |
4874 unsigned __int16 *v11; // eax@19 | |
4875 int v12; // edi@19 | |
4876 int v13; // ebx@20 | |
4877 stru352 *v14; // esi@20 | |
4878 DWORD v15; // eax@22 | |
4879 signed int v16; // ecx@22 | |
4880 signed int v17; // ST68_4@22 | |
4881 int v18; // eax@22 | |
4882 int v19; // ecx@22 | |
4883 unsigned int v20; // esi@23 | |
4884 int v21; // edi@23 | |
4885 int v22; // eax@23 | |
4886 int *v23; // ebx@24 | |
4887 int v24; // edx@24 | |
4888 int v25; // ebx@25 | |
4889 unsigned __int16 v26; // cx@25 | |
4890 int v27; // edx@26 | |
4891 unsigned __int16 v28; // cx@26 | |
4892 unsigned __int8 v29; // sf@27 | |
4893 unsigned __int8 v30; // of@27 | |
4894 unsigned int v31; // esi@29 | |
4895 int v32; // edi@29 | |
4896 unsigned __int16 *v33; // eax@29 | |
4897 int *v34; // ebx@30 | |
4898 int v35; // edx@30 | |
4899 int v36; // ebx@31 | |
4900 unsigned __int16 v37; // cx@31 | |
4901 int v38; // edx@32 | |
4902 unsigned __int16 v39; // cx@32 | |
4903 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
4904 int v41; // [sp-Ch] [bp-68h]@15 | |
4905 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
4906 signed int v43; // [sp+14h] [bp-48h]@12 | |
4907 signed int v44; // [sp+14h] [bp-48h]@22 | |
4908 int v45; // [sp+1Ch] [bp-40h]@22 | |
4909 int v46; // [sp+20h] [bp-3Ch]@22 | |
4910 int v47; // [sp+24h] [bp-38h]@19 | |
4911 char v48; // [sp+28h] [bp-34h]@19 | |
4912 int v49; // [sp+2Ch] [bp-30h]@19 | |
4913 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
4914 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
4915 int v52; // [sp+38h] [bp-24h]@22 | |
4916 int v53; // [sp+3Ch] [bp-20h]@22 | |
4917 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
4918 int v55; // [sp+40h] [bp-1Ch]@20 | |
4919 int v56; // [sp+44h] [bp-18h]@20 | |
4920 stru352 *i; // [sp+48h] [bp-14h]@20 | |
4921 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
4922 int v59; // [sp+50h] [bp-Ch]@4 | |
4923 int v60; // [sp+50h] [bp-Ch]@19 | |
4924 int v61; // [sp+54h] [bp-8h]@22 | |
4925 int *v62; // [sp+58h] [bp-4h]@23 | |
4926 int *v63; // [sp+58h] [bp-4h]@29 | |
4927 | |
4928 v1 = uFaceID; | |
4929 v42 = pRenderer->uTargetSurfacePitch; | |
4930 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
4931 { | |
4932 v2 = &pIndoor->pFaces[uFaceID]; | |
4933 if ( pRenderer->pRenderD3D ) | |
4934 { | |
4935 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
4936 v59 = v3; | |
4937 } | |
4938 else | |
4939 { | |
4940 v59 = sub_423B5D(uFaceID); | |
4941 v3 = v59; | |
4942 } | |
4943 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
4944 { | |
4945 v4 = v2->GetTexture(); | |
4946 v5 = 0; | |
4947 if ( v4 ) | |
4948 { | |
4949 if ( pRenderer->pRenderD3D ) | |
4950 { | |
4951 if ( v3 > 0 ) | |
4952 { | |
4953 v54 = v3; | |
4954 v43 = v3; | |
4955 v6 = (char *)&array_507D30[0].v; | |
4956 do | |
4957 { | |
4958 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
4959 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
4960 v6 += 48; | |
4961 --v54; | |
4962 } | |
4963 while ( v54 ); | |
4964 v3 = v59; | |
4965 v5 = v43; | |
4966 } | |
4967 v7 = v5; | |
4968 v41 = stru_F8AD28.field_0; | |
4969 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
4970 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
4971 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
4972 { | |
4973 v40 = v2->GetTexture(); | |
4974 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
4975 } | |
4976 else | |
4977 { | |
4978 v40 = v2->GetTexture(); | |
4979 v8 = v2->uBitmapID; | |
4980 } | |
4981 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
4982 } | |
4983 else | |
4984 { | |
4985 v49 = v4->uWidthMinus1; | |
4986 v47 = v4->uHeightMinus1 << 16; | |
4987 v9 = 16 - v4->uWidthLn2; | |
710 | 4988 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4989 LOBYTE(v2->uAttributes) |= 0x80u; |
4990 v48 = v9; | |
4991 v50 = v10; | |
4992 sub_4AF412(); | |
4993 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
4994 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
4995 v12 = stru_F8A590._viewport_space_y; | |
4996 v51 = v11; | |
4997 v60 = stru_F8A590._viewport_space_y; | |
4998 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4999 { | |
5000 v13 = 2 * stru_F8A590._viewport_space_y; | |
5001 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5002 v55 = 2 * stru_F8A590._viewport_space_y; | |
5003 v56 = 640 * stru_F8A590._viewport_space_y; | |
5004 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5005 { | |
5006 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5007 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5008 v15 = GetTickCount(); | |
5009 v16 = v14->field_0; | |
5010 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5011 v45 = v14->field_4 >> 3; | |
5012 v44 = v16 >> 3; | |
5013 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5014 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5015 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5016 v18 = v14->field_28; | |
5017 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5018 LOWORD(v18) = 0; | |
5019 v46 = stru_F8AD28.field_0 | v18; | |
5020 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5021 if ( LOBYTE(viewparams->field_20) ) | |
5022 { | |
5023 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5024 - pBLVRenderParams->uViewportX]; | |
5025 v31 = v44; | |
5026 v32 = v45; | |
5027 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5028 + 2 * v19 | |
5029 - pBLVRenderParams->uViewportX]; | |
5030 if ( v61 & 1 ) | |
5031 { | |
5032 --v61; | |
5033 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5034 + 2 * v19 | |
5035 - pBLVRenderParams->uViewportX | |
5036 - 2]; | |
5037 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5038 - pBLVRenderParams->uViewportX]; | |
5039 v35 = v46; | |
5040 v63 += 2; | |
5041 goto LABEL_32; | |
5042 } | |
5043 while ( 1 ) | |
5044 { | |
5045 v30 = __OFSUB__(v61, 2); | |
5046 v29 = v61 - 2 < 0; | |
5047 v61 -= 2; | |
5048 if ( v29 ^ v30 ) | |
5049 break; | |
5050 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5051 v31 += v52; | |
5052 v37 = v51[v36]; | |
5053 v32 += v53; | |
5054 v34 = v63; | |
5055 v35 = v46; | |
5056 *v33 = v37; | |
5057 v33[1] = v37; | |
5058 v33[640] = v37; | |
5059 v33[641] = v37; | |
5060 v63 += 4; | |
5061 v34[2] = v46; | |
5062 v34[3] = v46; | |
5063 v34[642] = v46; | |
5064 v34[643] = v46; | |
5065 LABEL_32: | |
5066 *v34 = v35; | |
5067 v34[1] = v35; | |
5068 v34[640] = v35; | |
5069 v34[641] = v35; | |
5070 v38 = v49 & (v31 >> 16); | |
5071 v33 += 4; | |
5072 v31 += v52; | |
5073 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5074 v32 += v53; | |
5075 *(v33 - 2) = v39; | |
5076 *(v33 - 1) = v39; | |
5077 v33[638] = v39; | |
5078 v33[639] = v39; | |
5079 } | |
5080 } | |
5081 else | |
5082 { | |
5083 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5084 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5085 v20 = v44; | |
5086 v21 = v45; | |
5087 v22 = (int)v58; | |
5088 if ( v61 & 1 ) | |
5089 { | |
5090 --v61; | |
5091 v22 = (int)(v58 - 1); | |
5092 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5093 v24 = v46; | |
5094 ++v62; | |
5095 goto LABEL_26; | |
5096 } | |
5097 while ( 1 ) | |
5098 { | |
5099 v30 = __OFSUB__(v61, 2); | |
5100 v29 = v61 - 2 < 0; | |
5101 v61 -= 2; | |
5102 if ( v29 ^ v30 ) | |
5103 break; | |
5104 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5105 v20 += v52; | |
5106 v26 = v51[v25]; | |
5107 v21 += v53; | |
5108 v23 = v62; | |
5109 v24 = v46; | |
5110 *(short *)v22 = v26; | |
5111 v62 += 2; | |
5112 v23[1] = v46; | |
5113 LABEL_26: | |
5114 *v23 = v24; | |
5115 v27 = v49 & (v20 >> 16); | |
5116 v22 += 4; | |
5117 v20 += v52; | |
5118 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5119 v21 += v53; | |
5120 *(short *)(v22 - 2) = v28; | |
5121 } | |
5122 } | |
5123 ++v60; | |
5124 ++i; | |
5125 v56 += 640; | |
5126 v55 += 2; | |
5127 if ( v60 > stru_F8A590._viewport_space_w ) | |
5128 break; | |
5129 v13 = v55; | |
5130 v12 = v60; | |
5131 } | |
5132 } | |
5133 } | |
5134 } | |
5135 } | |
5136 } | |
5137 } | |
5138 | |
5139 //----- (004AE1E7) -------------------------------------------------------- | |
5140 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5141 { | |
5142 int v3; // ebx@1 | |
5143 int v4; // edi@1 | |
5144 int v5; // esi@1 | |
5145 signed __int64 v6; // qtt@3 | |
5146 int v7; // esi@3 | |
5147 int v8; // eax@5 | |
5148 int result; // eax@5 | |
5149 int v10; // edx@5 | |
5150 int v11; // [sp+Ch] [bp-8h]@1 | |
5151 int v12; // [sp+1Ch] [bp+8h]@2 | |
5152 | |
5153 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5154 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5155 v11 = a1; | |
5156 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5157 + stru_F8AD28.field_7C | |
5158 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5159 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5160 { | |
5161 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5162 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5163 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5164 } | |
5165 else | |
5166 { | |
5167 v7 = 1073741824; | |
5168 } | |
5169 v8 = stru_F8AD28.vec_9C.z; | |
5170 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5171 + stru_F8AD28.vec_8C.x | |
5172 + v4 * stru_F8AD28.vec_8C.y) | |
5173 * (signed __int64)v7) >> 16) | |
5174 + stru_F8AD28.field_98; | |
5175 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5176 v10 = result + stru_F8AD28.field_A8; | |
5177 stru_F83B80[v11].field_28 = v7; | |
5178 stru_F83B80[v11].field_4 = v10; | |
5179 return result; | |
5180 } | |
5181 | |
5182 //----- (004AE313) -------------------------------------------------------- | |
5183 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5184 { | |
5185 int _dy; // ebx@1 | |
5186 int _dx; // edi@1 | |
5187 int v5; // ecx@1 | |
5188 int v6; // esi@1 | |
5189 int v7; // ST18_4@2 | |
5190 signed __int64 v8; // qtt@3 | |
5191 unsigned int v9; // ecx@3 | |
5192 int result; // eax@8 | |
5193 int v11; // [sp+Ch] [bp-8h]@1 | |
5194 | |
5195 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5196 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5197 ++pBLVRenderParams->field_88; | |
5198 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5199 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5200 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5201 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5202 { | |
5203 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5204 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5205 v9 = v8 / v11; | |
5206 } | |
5207 else | |
5208 { | |
5209 v9 = 0x40000000u; | |
5210 } | |
5211 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5212 p->field_0 = v9; | |
5213 else | |
5214 p->field_0 = stru_F8AD28.field_34; | |
5215 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5216 * (signed __int64)(signed int)v9) >> 16) | |
5217 + stru_F8AD28.field_98 | |
5218 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5219 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5220 * (signed __int64)(signed int)v9) >> 16) | |
5221 + stru_F8AD28.field_A8 | |
5222 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5223 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5224 if ( result < 369620 || bUseLoResSprites ) | |
5225 { | |
5226 if ( result < 184810 ) | |
5227 p->field_10 = result > 92405; | |
5228 else | |
5229 p->field_10 = 2; | |
5230 } | |
5231 else | |
5232 { | |
5233 p->field_10 = 3; | |
5234 } | |
5235 return result; | |
5236 } | |
5237 | |
5238 //----- (004AE491) -------------------------------------------------------- | |
5239 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5240 { | |
5241 signed int v2; // eax@1 | |
5242 signed int v3; // edi@1 | |
5243 int v4; // ecx@1 | |
5244 int v5; // esi@2 | |
5245 int v6; // eax@2 | |
5246 int v7; // ebx@2 | |
5247 unsigned int v8; // ecx@2 | |
5248 int v9; // edx@5 | |
5249 int v10; // edx@7 | |
5250 unsigned int v11; // eax@8 | |
5251 int v13; // [sp+4h] [bp-18h]@2 | |
5252 int v14; // [sp+8h] [bp-14h]@2 | |
5253 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5254 int v16; // [sp+14h] [bp-8h]@1 | |
5255 int v17; // [sp+18h] [bp-4h]@1 | |
5256 | |
5257 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5258 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5259 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5260 v4 = 0; | |
5261 v15 = v2; | |
5262 v16 = 0; | |
5263 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5264 { | |
5265 do | |
5266 { | |
5267 v5 = v16; | |
5268 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5269 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5270 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5271 v7 = v13; | |
5272 v8 = v14; | |
5273 if ( v6 < v13 ) | |
5274 { | |
5275 v6 = v13; | |
5276 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5277 } | |
5278 if ( v6 < v14 ) | |
5279 { | |
5280 v9 = v6; | |
5281 v6 = v14; | |
5282 v8 = v9; | |
5283 } | |
5284 if ( v7 < (signed int)v8 ) | |
5285 { | |
5286 v10 = v8; | |
5287 v8 = v7; | |
5288 v7 = v10; | |
5289 } | |
5290 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5291 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5292 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5293 ++v16; | |
5294 v2 = v15; | |
5295 } | |
5296 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5297 v4 = 0; | |
5298 } | |
5299 if ( stru_F8AD28.field_3E4 != v4 ) | |
5300 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5301 if ( v17 >= v4 ) | |
5302 { | |
5303 if ( v17 > 2031616 ) | |
5304 v17 = 2031616; | |
5305 } | |
5306 else | |
5307 { | |
5308 v17 = v4; | |
5309 } | |
5310 ++pBLVRenderParams->field_8C; | |
5311 return v17; | |
5312 } | |
5313 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5314 | |
5315 //----- (004AE5F1) -------------------------------------------------------- | |
5316 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5317 { | |
5318 BLVFace *v1; // esi@1 | |
5319 BLVFaceExtra *v2; // ebx@1 | |
5320 int v3; // eax@1 | |
5321 int v4; // edi@1 | |
5322 Texture *v5; // edi@1 | |
5323 int v6; // eax@1 | |
5324 unsigned int v7; // eax@1 | |
5325 unsigned int v8; // ecx@1 | |
5326 unsigned int v9; // eax@1 | |
5327 unsigned int v10; // ecx@5 | |
5328 int v11; // edi@10 | |
5329 int v12; // ecx@10 | |
5330 int v13; // eax@10 | |
5331 int v14; // edx@10 | |
5332 int v15; // ebx@12 | |
5333 double v16; // st7@16 | |
5334 int v17; // eax@16 | |
5335 char *v18; // ebx@17 | |
5336 int v19; // ecx@19 | |
5337 int v20; // eax@19 | |
5338 int v21; // edx@21 | |
5339 int v22; // eax@23 | |
5340 int v23; // ST04_4@26 | |
5341 int v24; // edi@26 | |
5342 double v25; // st6@26 | |
5343 int v26; // eax@26 | |
5344 double v27; // st6@26 | |
5345 int v28; // ecx@26 | |
5346 char v29; // al@26 | |
5347 int v30; // edx@28 | |
5348 int v31; // ecx@28 | |
5349 BLVLightMM7 *v32; // ecx@32 | |
5350 int v33; // edi@33 | |
5351 int v34; // edx@33 | |
5352 int v35; // eax@33 | |
5353 int v36; // edi@35 | |
5354 int v37; // edx@37 | |
5355 int v38; // ebx@39 | |
5356 int v39; // edi@42 | |
5357 int v40; // eax@42 | |
5358 char *v41; // ebx@45 | |
5359 signed int v42; // ecx@47 | |
5360 int v43; // edi@47 | |
5361 int v44; // eax@49 | |
5362 int v45; // edx@51 | |
5363 int v46; // eax@53 | |
5364 int v47; // ST04_4@55 | |
5365 int v48; // edi@55 | |
5366 double v49; // st6@55 | |
5367 int v50; // eax@55 | |
5368 double v51; // st6@55 | |
5369 int v52; // eax@55 | |
5370 int v53; // ecx@57 | |
5371 int v54; // ecx@58 | |
5372 int v55; // ecx@59 | |
5373 int v56; // edx@62 | |
5374 int v57; // ecx@62 | |
5375 int v58; // eax@63 | |
5376 int v59; // edx@64 | |
5377 int v60; // ecx@67 | |
5378 int v61; // edx@67 | |
5379 int v62; // eax@68 | |
5380 int v63; // edx@69 | |
5381 signed int v64; // ecx@72 | |
5382 double v65; // st7@75 | |
5383 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5384 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5385 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5386 int v69; // [sp+28h] [bp-18h]@10 | |
5387 int v70; // [sp+2Ch] [bp-14h]@10 | |
5388 int X; // [sp+30h] [bp-10h]@10 | |
5389 int v72; // [sp+34h] [bp-Ch]@10 | |
5390 int v73; // [sp+38h] [bp-8h]@10 | |
5391 int v74; // [sp+3Ch] [bp-4h]@10 | |
5392 | |
5393 v1 = &pIndoor->pFaces[uFaceID]; | |
5394 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5395 v3 = v1->uBitmapID; | |
5396 v4 = v1->uBitmapID; | |
5397 v68 = v2; | |
5398 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5399 v6 = 8 * uFaceID; | |
862 | 5400 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5401 stru_F8AD28.field_0 = v6; |
5402 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5403 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5404 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5405 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5406 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5407 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5408 v7 = GetTickCount(); | |
5409 v8 = v1->uAttributes; | |
5410 v9 = v7 >> 3; | |
5411 if ( v8 & 4 ) | |
5412 { | |
5413 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5414 } | |
5415 else | |
5416 { | |
5417 if ( v8 & 0x20 ) | |
5418 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5419 } | |
5420 v10 = v1->uAttributes; | |
5421 if ( BYTE1(v10) & 8 ) | |
5422 { | |
5423 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5424 } | |
5425 else | |
5426 { | |
5427 if ( v10 & 0x40 ) | |
5428 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5429 } | |
5430 v1->_get_normals(&v67, &v66); | |
5431 stru_F8AD28.vec_14.x = v67.x; | |
5432 stru_F8AD28.vec_14.y = v67.y; | |
5433 stru_F8AD28.vec_14.z = v67.z; | |
5434 stru_F8AD28.vec_20.x = v66.x; | |
5435 stru_F8AD28.vec_20.y = v66.y; | |
5436 stru_F8AD28.vec_20.z = v66.z; | |
5437 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5438 if ( pBLVRenderParams->sPartyRotX ) | |
5439 { | |
5440 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5441 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5442 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5443 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5444 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5445 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5446 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5447 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5448 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5449 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5450 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5451 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5452 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5453 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5454 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5455 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5456 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5457 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5458 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5459 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5460 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5461 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5462 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5463 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5464 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5465 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5466 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5467 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5468 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5469 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5470 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5471 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5472 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5473 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5474 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5475 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5476 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5477 v13 = pBLVRenderParams->vPartyPos.y; | |
5478 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5479 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5480 v14 = pBLVRenderParams->vPartyPos.x; | |
5481 } | |
5482 else | |
5483 { | |
5484 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5485 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5486 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5487 - v70; | |
5488 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5489 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5490 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5491 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5492 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5493 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5494 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5495 - v70; | |
5496 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5497 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5498 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5499 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5500 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5501 - v70; | |
5502 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5503 v14 = pBLVRenderParams->vPartyPos.x; | |
5504 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5505 v13 = pBLVRenderParams->vPartyPos.y; | |
5506 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5507 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5508 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5509 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5510 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5511 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5512 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5513 } | |
5514 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5515 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5516 + stru_F8AD28.plane_4.dist | |
5517 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5518 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5519 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5520 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5521 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5522 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5523 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5524 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5525 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5526 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5527 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5528 v15 = v70; | |
5529 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5530 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5531 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5532 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5533 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5534 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5535 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5536 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5537 stru_F8AD28.field_38 = 0; | |
5538 stru_F8AD28.field_A8 = -(X | |
5539 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5540 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5541 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5542 { | |
5543 stru_F8AD28.field_3E4 = 1; | |
5544 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5545 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5546 stru_F8AD28.field_3F0 = v68->field_1E; | |
5547 stru_F8AD28.field_3F4 = v68->field_20; | |
5548 } | |
5549 else | |
5550 { | |
5551 stru_F8AD28.field_3E4 = 0; | |
5552 } | |
5553 v16 = 0.0039215689; | |
5554 v17 = 116 * v1->uSectorID; | |
5555 v69 = v17; | |
5556 v74 = 0; | |
5557 v73 = 0; | |
5558 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5559 v70 = pMobileLightsStack->uNumLightsActive; | |
5560 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5561 { | |
5562 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5563 do | |
5564 { | |
5565 if ( v74 >= 20 ) | |
5566 break; | |
5567 v19 = *((short *)v18 + 2); | |
5568 v20 = *((short *)v18 - 1); | |
5569 if ( v20 > v1->pBounding.x1 - v19 ) | |
5570 { | |
5571 if ( v20 < v19 + v1->pBounding.x2 ) | |
5572 { | |
5573 v21 = *(short *)v18; | |
5574 if ( v21 > v1->pBounding.y1 - v19 ) | |
5575 { | |
5576 if ( v21 < v19 + v1->pBounding.y2 ) | |
5577 { | |
5578 v22 = *((short *)v18 + 1); | |
5579 if ( v22 > v1->pBounding.z1 - v19 ) | |
5580 { | |
5581 if ( v22 < v19 + v1->pBounding.z2 ) | |
5582 { | |
5583 X = (v1->pFacePlane_old.dist | |
5584 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5585 + v21 * v1->pFacePlane_old.vNormal.y | |
5586 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5587 if ( X <= v19 ) | |
5588 { | |
5589 v23 = X; | |
5590 v24 = v74; | |
5591 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5592 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5593 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5594 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5595 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5596 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5597 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5598 v25 = (double)(signed int)v68 * v16; | |
5599 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5600 v26 = (unsigned __int8)v18[8]; | |
5601 *(float *)(v24 * 4 + 16297992) = v25; | |
5602 v27 = (double)(signed int)v68; | |
5603 v68 = (BLVFaceExtra *)v26; | |
5604 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5605 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5606 v16 = 0.0039215689; | |
5607 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5608 v28 = v74; | |
5609 v29 = v18[9]; | |
5610 ++v74; | |
5611 stru_F8AD28._blv_lights_types[v28] = v29; | |
5612 } | |
5613 } | |
5614 } | |
5615 } | |
5616 } | |
5617 } | |
5618 } | |
5619 ++v73; | |
5620 v18 += 18; | |
5621 v17 = v69; | |
5622 } | |
5623 while ( v73 < v70 ); | |
5624 } | |
5625 v30 = 0; | |
5626 v73 = 0; | |
5627 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5628 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5629 if ( v31 > 0 ) | |
5630 { | |
5631 while ( v74 < 20 ) | |
5632 { | |
5633 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5634 if ( !(v32->uAtributes & 8) ) | |
5635 { | |
5636 v33 = v1->pBounding.x1; | |
5637 v34 = v32->vPosition.x; | |
5638 X = v32->uBrightness; | |
5639 v35 = v32->uRadius; | |
5640 v68 = (BLVFaceExtra *)v32->uRadius; | |
5641 if ( v34 > v33 - v35 ) | |
5642 { | |
5643 if ( v34 < v35 + v1->pBounding.x2 ) | |
5644 { | |
5645 v36 = v32->vPosition.y; | |
5646 if ( v36 > v1->pBounding.y1 - v35 ) | |
5647 { | |
5648 if ( v36 < v35 + v1->pBounding.y2 ) | |
5649 { | |
5650 v37 = v32->vPosition.z; | |
5651 if ( v37 > v1->pBounding.z1 - v35 ) | |
5652 { | |
5653 if ( v37 < v35 + v1->pBounding.z2 ) | |
5654 { | |
5655 v38 = (v1->pFacePlane_old.dist | |
5656 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5657 + v37 * v1->pFacePlane_old.vNormal.z | |
5658 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5659 if ( v38 >= 0 ) | |
5660 { | |
5661 if ( v38 <= v35 && v35 ) | |
5662 { | |
5663 v39 = v74; | |
5664 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5665 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5666 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5667 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5668 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5669 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5670 v68 = (BLVFaceExtra *)v32->uRed; | |
5671 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5672 v68 = (BLVFaceExtra *)v32->uGreen; | |
5673 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5674 v68 = (BLVFaceExtra *)v32->uBlue; | |
5675 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5676 v16 = 0.0039215689; | |
5677 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5678 v40 = v74++; | |
5679 stru_F8AD28._blv_lights_types[v40] = 1; | |
5680 } | |
5681 } | |
5682 } | |
5683 } | |
5684 } | |
5685 } | |
5686 } | |
5687 } | |
5688 } | |
5689 v30 = v73++ + 1; | |
5690 if ( v73 >= v70 ) | |
5691 break; | |
5692 v17 = v69; | |
5693 } | |
5694 } | |
5695 v73 = 0; | |
5696 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5697 { | |
5698 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5699 do | |
5700 { | |
5701 if ( v74 >= 20 ) | |
5702 break; | |
5703 v42 = *((short *)v41 + 2); | |
5704 v43 = *((short *)v41 - 1); | |
5705 if ( v43 > v1->pBounding.x1 - v42 ) | |
5706 { | |
5707 if ( v43 < v42 + v1->pBounding.x2 ) | |
5708 { | |
5709 v44 = *(short *)v41; | |
5710 if ( v44 > v1->pBounding.y1 - v42 ) | |
5711 { | |
5712 if ( v44 < v42 + v1->pBounding.y2 ) | |
5713 { | |
5714 v45 = *((short *)v41 + 1); | |
5715 if ( v45 > v1->pBounding.z1 - v42 ) | |
5716 { | |
5717 if ( v45 < v42 + v1->pBounding.z2 ) | |
5718 { | |
5719 v46 = (v1->pFacePlane_old.dist | |
5720 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5721 + v43 * v1->pFacePlane_old.vNormal.x | |
5722 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5723 v69 = v46; | |
5724 if ( v46 >= 0 ) | |
5725 { | |
5726 if ( v46 <= v42 ) | |
5727 { | |
5728 v47 = v69; | |
5729 v48 = v74; | |
5730 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5731 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5732 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5733 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5734 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5735 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5736 v49 = (double)(signed int)v68 * v16; | |
5737 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5738 v50 = (unsigned __int8)v41[8]; | |
5739 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5740 v51 = (double)(signed int)v68; | |
5741 v68 = (BLVFaceExtra *)v50; | |
5742 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5743 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5744 v16 = 0.0039215689; | |
5745 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5746 v52 = v74++; | |
5747 stru_F8AD28._blv_lights_types[v52] = 1; | |
5748 } | |
5749 } | |
5750 } | |
5751 } | |
5752 } | |
5753 } | |
5754 } | |
5755 } | |
5756 ++v73; | |
5757 v41 += 12; | |
5758 } | |
5759 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5760 } | |
5761 stru_F8AD28.uNumLightsApplied = v74; | |
5762 v53 = v1->pBounding.x2; | |
5763 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5764 { | |
5765 v55 = v1->pBounding.x1; | |
5766 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5767 v54 = 0; | |
5768 else | |
5769 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5770 } | |
5771 else | |
5772 { | |
5773 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5774 } | |
5775 v56 = v1->pBounding.y2; | |
5776 v57 = v54 * v54; | |
5777 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5778 { | |
5779 v59 = v1->pBounding.y1; | |
5780 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5781 v58 = 0; | |
5782 else | |
5783 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5784 } | |
5785 else | |
5786 { | |
5787 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5788 } | |
5789 v60 = v58 * v58 + v57; | |
5790 v61 = v1->pBounding.z2; | |
5791 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5792 { | |
5793 v63 = v1->pBounding.z1; | |
5794 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5795 v62 = 0; | |
5796 else | |
5797 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5798 } | |
5799 else | |
5800 { | |
5801 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5802 } | |
5803 v64 = v62 * v62 + v60; | |
5804 if ( v64 ) | |
295 | 5805 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5806 else |
5807 stru_F8AD28.field_34 = 0; | |
5808 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5809 v65 = (double)(signed int)v68; | |
5810 if ( v65 >= 655.36 ) | |
5811 { | |
5812 if ( v65 >= 26214.4 ) | |
5813 { | |
5814 if ( v65 >= 45875.2 ) | |
5815 { | |
5816 stru_F8AD28.field_44 = 8; | |
5817 stru_F8AD28.field_48 = 3; | |
5818 } | |
5819 else | |
5820 { | |
5821 stru_F8AD28.field_44 = 16; | |
5822 stru_F8AD28.field_48 = 4; | |
5823 } | |
5824 } | |
5825 else | |
5826 { | |
5827 stru_F8AD28.field_44 = 32; | |
5828 stru_F8AD28.field_48 = 5; | |
5829 } | |
5830 } | |
5831 else | |
5832 { | |
5833 stru_F8AD28.field_44 = 64; | |
5834 stru_F8AD28.field_48 = 6; | |
5835 } | |
5836 } | |
5837 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5838 | |
5839 //----- (004AF412) -------------------------------------------------------- | |
5840 int __cdecl sub_4AF412() | |
5841 { | |
5842 int v0; // ST20_4@2 | |
5843 int v1; // ST20_4@2 | |
5844 int v2; // ST20_4@2 | |
5845 int v3; // esi@2 | |
5846 int v4; // ST20_4@2 | |
5847 int v5; // ecx@2 | |
5848 int v6; // ebx@2 | |
5849 int v7; // edi@2 | |
5850 int v8; // edx@2 | |
5851 int v9; // eax@2 | |
5852 int result; // eax@4 | |
5853 | |
5854 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5855 stru_F8AD28.vec_20.y = -65536; | |
5856 stru_F8AD28.plane_4.vNormal.x = 0; | |
5857 stru_F8AD28.plane_4.vNormal.y = 0; | |
5858 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5859 stru_F8AD28.vec_14.x = 65536; | |
5860 stru_F8AD28.vec_14.y = 0; | |
5861 stru_F8AD28.vec_14.z = 0; | |
5862 stru_F8AD28.vec_20.x = 0; | |
5863 stru_F8AD28.vec_20.z = 0; | |
5864 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5865 if ( pBLVRenderParams->sPartyRotX ) | |
5866 { | |
5867 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5868 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5869 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5870 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5871 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5872 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5873 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5874 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5875 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5876 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5877 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5878 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5879 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5880 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5881 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5882 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5883 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5884 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5885 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5886 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5887 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5888 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5889 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5890 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5891 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5892 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5893 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5894 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5895 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5896 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5897 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5898 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5899 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5900 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5901 v6 = pBLVRenderParams->vPartyPos.z; | |
5902 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5903 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5904 v8 = pBLVRenderParams->vPartyPos.y; | |
5905 v9 = pBLVRenderParams->vPartyPos.x; | |
5906 } | |
5907 else | |
5908 { | |
5909 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5910 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5911 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5912 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5913 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5914 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5915 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5916 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5917 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5918 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5919 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5920 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5921 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5922 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5923 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5924 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5925 v8 = pBLVRenderParams->vPartyPos.y; | |
5926 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5927 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5928 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5929 v9 = pBLVRenderParams->vPartyPos.x; | |
5930 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5931 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5932 v6 = pBLVRenderParams->vPartyPos.z; | |
5933 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5934 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5935 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5936 } | |
5937 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5938 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
5939 + stru_F8AD28.plane_4.dist | |
5940 + stru_F8AD28.plane_4.vNormal.x * v9 | |
5941 + stru_F8AD28.plane_4.vNormal.z * v6; | |
5942 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5943 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5944 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5945 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5946 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5947 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5948 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5949 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5950 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5951 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
5952 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
5953 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
5954 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5955 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5956 result = 0; | |
5957 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
5958 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
5959 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
5960 stru_F8AD28.field_38 = 0; | |
5961 stru_F8AD28.field_3E4 = 0; | |
5962 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
5963 stru_F8AD28.uNumLightsApplied = 0; | |
5964 stru_F8AD28.field_34 = 0; | |
5965 return result; | |
5966 } | |
5967 | |
5968 //----- (004B1447) -------------------------------------------------------- | |
5969 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
5970 { | |
5971 signed int v3; // esi@1 | |
5972 char v4; // sf@8 | |
5973 int v5; // eax@8 | |
5974 unsigned __int64 v6; // qax@12 | |
5975 DDM_DLV_Header *v7; // eax@14 | |
5976 Player **v8; // edi@18 | |
5977 Player *result; // eax@19 | |
735 | 5978 //char *v10; // esi@20 |
0 | 5979 |
5980 v3 = 0; | |
5981 if ( a2 ) | |
5982 { | |
5983 if ( a2 != 1 ) | |
5984 { | |
5985 if ( a2 == 2 ) | |
5986 v3 = 2; | |
5987 goto LABEL_13; | |
5988 } | |
5989 v3 = 2; | |
5990 } | |
5991 else | |
5992 { | |
5993 v3 = 1; | |
5994 } | |
5995 if ( pParty->uFine < 4000000 ) | |
5996 { | |
5997 v4 = a3 + pParty->uFine < 0; | |
5998 v5 = a3 + pParty->uFine; | |
5999 pParty->uFine += a3; | |
6000 if ( v4 ) | |
6001 { | |
6002 v5 = 0; | |
6003 pParty->uFine = 0; | |
6004 } | |
6005 if ( v5 > 4000000 ) | |
6006 pParty->uFine = 4000000; | |
6007 } | |
487 | 6008 |
6009 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6010 | |
0 | 6011 LABEL_13: |
463 | 6012 pParty->InTheShopFlags[a1] = 1; |
0 | 6013 if ( v3 ) |
6014 { | |
6015 v7 = &pOutdoor->ddm; | |
6016 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6017 v7 = &pIndoor->dlv; | |
6018 v7->uReputation += v3; | |
6019 if ( v7->uReputation > 10000 ) | |
6020 v7->uReputation = 10000; | |
6021 } | |
6022 v8 = &pPlayers[1]; | |
6023 do | |
6024 { | |
6025 result = *v8; | |
6026 if ( pParty->uFine ) | |
6027 { | |
735 | 6028 //v10 = result->_guilds_member_bits; |
484 | 6029 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6030 if ( !(short)result ) |
735 | 6031 __debugbreak(); |
501 | 6032 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6033 } |
6034 ++v8; | |
6035 } | |
6036 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6037 return result; | |
6038 } | |
6039 | |
6040 //----- (004B1523) -------------------------------------------------------- | |
762 | 6041 void __thiscall sub_4B1523(int *_this) |
0 | 6042 { |
6043 int v1; // esi@1 | |
6044 int v2; // edx@1 | |
6045 unsigned int v3; // eax@2 | |
6046 int v4; // eax@4 | |
6047 LONG v5; // ecx@4 | |
6048 int v6; // eax@10 | |
6049 char *v7; // ST44_4@12 | |
6050 unsigned __int16 v8; // ax@12 | |
6051 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6052 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6053 POINT a2; // [sp+64h] [bp-10h]@1 | |
6054 int v13; // [sp+6Ch] [bp-8h]@4 | |
6055 int v14; // [sp+70h] [bp-4h]@4 | |
6056 | |
6057 v1 = *_this - 399; | |
6058 v2 = (*_this - 400) % 11 + 1; | |
6059 v11 = 4 * (*_this - 400) / 11; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6060 sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); |
0 | 6061 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
6062 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6063 else | |
6064 v3 = 30; | |
6065 a1.Hint = 0; | |
6066 a1.uFrameY = v3; | |
6067 a1.uFrameWidth = 328; | |
6068 a1.uFrameHeight = 68; | |
6069 a1.uFrameX = 90; | |
6070 a1.uFrameZ = 417; | |
6071 a1.uFrameW = v3 + 67; | |
6072 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6073 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6074 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6075 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6076 v5 = a2.y; | |
6077 if ( v14 > a2.y ) | |
6078 v5 = v14; | |
6079 if ( v13 > v5 ) | |
6080 v5 = v13; | |
6081 if ( v4 > v5 ) | |
6082 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6083 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 | 6084 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
6085 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6086 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6087 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6088 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
|
6089 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 6090 a1.uFrameHeight += v6; |
6091 if ( (signed int)a1.uFrameHeight < 150 ) | |
6092 a1.uFrameHeight = 150; | |
819 | 6093 a1.uFrameWidth = game_viewport_width; |
0 | 6094 a1.DrawMessageBox(0); |
6095 a1.uFrameWidth -= 12; | |
6096 a1.uFrameHeight -= 12; | |
6097 v7 = pSpellStats->pInfos[v1].pName; | |
6098 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6099 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6100 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6101 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
|
6102 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 6103 a1.uFrameZ = a1.uFrameX + 107; |
6104 a1.uFrameWidth = 108; | |
6105 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6106 sprintf(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6107 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 6108 } |
6109 | |
6110 //----- (004B1784) -------------------------------------------------------- | |
6111 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6112 { | |
6113 Player *pPlayer; // ebx@1 | |
6114 bool result; // eax@2 | |
6115 unsigned __int16 v2; // ST0C_2@3 | |
6116 int v3; // eax@3 | |
6117 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6118 | |
6119 pPlayer = pPlayers[uActiveCharacter]; | |
6120 if ( pPlayer->CanAct() ) | |
6121 { | |
6122 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6123 result = 1; | |
6124 } | |
6125 else | |
6126 { | |
6127 pDialogueWindow->pNumPresenceButton = 0; | |
6128 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6129 v4.uFrameX = 483; | |
6130 v4.uFrameWidth = 148; | |
6131 v4.uFrameZ = 334; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6132 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// |
0 | 6133 // "%s is in no condition to %s" |
6134 // "do anything" | |
949 | 6135 v2 = TargetColor(255, 255, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6136 v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6137 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf.data(), 3u); |
0 | 6138 result = 0; |
6139 } | |
6140 return result; | |
6141 } | |
6142 // F8B1E0: using guessed type int dword_F8B1E0; | |
6143 | |
6144 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6145 void __cdecl ShowPopupShopItem() |
0 | 6146 { |
6147 POINT *v1; // esi@5 | |
6148 unsigned int v2; // eax@5 | |
6149 int v3; // ecx@5 | |
6150 POINT *v4; // esi@12 | |
6151 int v5; // eax@12 | |
6152 unsigned int v6; // eax@13 | |
6153 ItemGen *v7; // ecx@13 | |
6154 signed int v8; // esi@17 | |
6155 unsigned int v9; // eax@19 | |
475 | 6156 POINT v10; // [sp+8h] [bp-44h]@12 |
6157 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6158 POINT v12; // [sp+18h] [bp-34h]@18 | |
6159 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6160 POINT v14; // [sp+28h] [bp-24h]@17 | |
6161 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6162 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6163 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6164 |
484 | 6165 if ( in_current_building_type <= 0 ) |
0 | 6166 return; |
484 | 6167 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6168 { |
749 | 6169 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6170 { | |
6171 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6172 return; |
749 | 6173 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6174 { |
475 | 6175 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6176 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6177 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6178 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6179 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6180 return; |
907 | 6181 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6182 return; |
6183 } | |
749 | 6184 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6185 return; |
6186 } | |
475 | 6187 v4 = pMouse->GetCursorPos(&v11); |
6188 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6189 if ( !v5 ) |
6190 return; | |
336 | 6191 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6192 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6193 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6194 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6195 GameUI_DrawItemInfo(v7); | |
6196 return; | |
0 | 6197 } |
874 | 6198 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6199 { |
6200 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6201 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6202 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6203 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6204 if ( v5 ) | |
336 | 6205 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6206 } |
6207 } | |
6208 // F8B198: using guessed type int dword_F8B198; | |
6209 // F8B19C: using guessed type int dword_F8B19C; | |
6210 | |
6211 //----- (004B1BDB) -------------------------------------------------------- | |
6212 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6213 { | |
6214 signed __int64 v1; // ST2C_8@1 | |
6215 signed __int64 v2; // qax@1 | |
6216 signed __int64 v3; // ST1C_8@1 | |
6217 unsigned __int64 v4; // qax@1 | |
6218 unsigned int v5; // ebx@1 | |
112 | 6219 Player *v6; // ebx@1 |
0 | 6220 |
6221 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6222 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6223 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6224 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6225 v2 = v1 / 60 / 60; | |
6226 v3 = v2; | |
6227 v4 = (unsigned int)v2 / 0x18; | |
6228 v5 = (unsigned int)(v4 / 7) >> 2; | |
6229 pParty->uCurrentTimeSecond = v1 % 60; | |
6230 pParty->uCurrentMinute = v1 / 60 % 60; | |
6231 pParty->uCurrentHour = v3 % 24; | |
6232 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6233 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6234 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6235 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6236 pParty->RestAndHeal(); |
6237 dword_507B94 = 1; | |
112 | 6238 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6239 do |
6240 { | |
112 | 6241 v6->uTimeToRecovery = 0; |
6242 memset(&v6->uTimeToRecovery, 0, 4u); | |
6243 ++v6; | |
6244 } | |
6245 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6246 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6247 } |
6248 // 507B94: using guessed type int dword_507B94; | |
6249 | |
6250 //----- (004B1D27) -------------------------------------------------------- | |
6251 void __cdecl sub_4B1D27() | |
6252 { | |
6253 int v0; // edx@2 | |
6254 unsigned int v1; // ecx@7 | |
6255 signed int v2; // edi@10 | |
6256 int v3; // esi@10 | |
6257 __int16 v4; // ax@15 | |
6258 signed int v5; // edi@20 | |
6259 int v6; // esi@20 | |
6260 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6261 | |
484 | 6262 if ( in_current_building_type > 0 ) |
0 | 6263 { |
6264 v0 = 3; | |
484 | 6265 if ( in_current_building_type > BildingType_MagicShop ) |
6266 { | |
6267 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6268 { |
6269 if ( !dword_F8B1E4 ) | |
6270 return; | |
6271 } | |
6272 else | |
6273 { | |
484 | 6274 if ( in_current_building_type != BildingType_Temple ) |
0 | 6275 return; |
6276 } | |
336 | 6277 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6278 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6279 return; |
6280 } | |
336 | 6281 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6282 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6283 { |
6284 if ( pParty->uNumGold <= 0x2710 ) | |
6285 { | |
6286 if ( !dword_F8B1E4 ) | |
6287 return; | |
6288 v0 = 4; | |
907 | 6289 PlayHouseSound(v1, (HouseSoundID)v0); |
6290 return; | |
0 | 6291 } |
735 | 6292 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6293 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6294 { | |
6295 v5 = 0; | |
6296 v6 = 1; | |
6297 do | |
6298 { | |
6299 if ( pPlayers[v6]->CanAct() ) | |
6300 v7[v5++] = v6; | |
6301 ++v6; | |
6302 } | |
6303 while ( v6 <= 4 ); | |
6304 if ( v5 ) | |
6305 { | |
6306 qword_A750D8 = 256i64; | |
6307 word_A750E0 = 80; | |
6308 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6309 word_A750E2 = v4; |
6310 return; | |
0 | 6311 } |
6312 } | |
6313 } | |
6314 else | |
6315 { | |
6316 if ( !qword_A750D8 ) | |
6317 { | |
6318 v2 = 0; | |
6319 v3 = 1; | |
6320 do | |
6321 { | |
6322 if ( pPlayers[v3]->CanAct() ) | |
6323 v7[v2++] = v3; | |
6324 ++v3; | |
6325 } | |
6326 while ( v3 <= 4 ); | |
6327 if ( v2 ) | |
6328 { | |
6329 qword_A750D8 = 256i64; | |
6330 word_A750E0 = 80; | |
6331 v4 = LOWORD(v7[rand() % v2]); | |
6332 word_A750E2 = v4; | |
6333 return; | |
6334 } | |
6335 } | |
6336 } | |
6337 } | |
6338 } | |
6339 | |
6340 //----- (004B1ECE) -------------------------------------------------------- | |
6341 void __cdecl sub_4B1ECE() | |
6342 { | |
6343 __int16 *v0; // edi@1 | |
6344 int v1; // ebx@3 | |
6345 Player *v2; // esi@3 | |
6346 int v3; // eax@4 | |
6347 signed int v4; // eax@9 | |
6348 int v5; // ebx@11 | |
89 | 6349 Player *v6; // esi@13 |
6350 ItemGen *v7; // eax@14 | |
0 | 6351 signed int v8; // edi@14 |
89 | 6352 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6353 signed int v10; // [sp+10h] [bp-8h]@13 |
6354 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6355 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6356 |
484 | 6357 contract_approved = 0; |
0 | 6358 v11 = 0; |
6359 uDialogueType = 84; | |
827 | 6360 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6361 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
0 | 6362 while ( 1 ) |
6363 { | |
484 | 6364 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6365 { |
6366 v1 = 0; | |
6367 v2 = pParty->pPlayers; | |
6368 do | |
6369 { | |
89 | 6370 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6371 if ( v3 ) |
6372 break; | |
6373 ++v2; | |
6374 ++v1; | |
6375 } | |
6376 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6377 if ( v1 == 4 ) | |
6378 break; | |
6379 } | |
6380 ++v11; | |
6381 v0 += 2; | |
89 | 6382 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6383 break; | |
6384 } | |
6385 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6386 { | |
827 | 6387 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6388 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6389 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6390 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6391 } | |
484 | 6392 if ( contract_approved == 601 ) |
0 | 6393 { |
6394 v5 = 0; | |
89 | 6395 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6396 v9 = 0; |
6397 while ( 1 ) | |
6398 { | |
135 | 6399 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6400 { |
6401 v10 = 0; | |
89 | 6402 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6403 do |
6404 { | |
89 | 6405 v7 = v6->pInventoryItems; |
0 | 6406 v8 = 138; |
6407 do | |
6408 { | |
89 | 6409 if ( v7->uItemID == 601 ) |
0 | 6410 { |
377 | 6411 if ( !v7->uHolderPlayer ) |
89 | 6412 v9 = v7; |
377 | 6413 if ( v7->uHolderPlayer == v5 ) |
0 | 6414 v10 = 1; |
6415 } | |
89 | 6416 ++v7; |
0 | 6417 --v8; |
6418 } | |
6419 while ( v8 ); | |
89 | 6420 ++v6; |
6421 } | |
6422 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6423 if ( !v10 ) |
6424 break; | |
6425 } | |
89 | 6426 ++v12; |
0 | 6427 ++v5; |
89 | 6428 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6429 return; |
6430 } | |
6431 if ( v9 ) | |
377 | 6432 v9->uHolderPlayer = v5; |
0 | 6433 } |
6434 } | |
6435 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6436 // 722B3C: using guessed type int dword_722B3C; | |
6437 // 722B44: using guessed type int dword_722B44; | |
6438 // F8B1A8: using guessed type int dword_F8B1A8; | |
6439 | |
6440 //----- (004B2001) -------------------------------------------------------- | |
459 | 6441 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6442 { | |
6443 //signed int v1; // eax@1 | |
6444 NPCData *pCurrentNPCInfo; // ebp@1 | |
6445 int pEventNumber; // ecx@8 | |
0 | 6446 Player *v4; // esi@20 |
467 | 6447 //int v5; // eax@28 |
6448 //int v6; // eax@31 | |
6449 //int v7; // eax@34 | |
6450 //int v8; // eax@37 | |
6451 //int v9; // eax@40 | |
6452 //unsigned int v10; // eax@43 | |
0 | 6453 char *v12; // eax@53 |
6454 char *v13; // eax@56 | |
6455 char *v14; // eax@57 | |
6456 char *v15; // eax@58 | |
467 | 6457 //unsigned int v16; // ebp@62 |
0 | 6458 char *v17; // ecx@63 |
6459 char *v18; // eax@65 | |
6460 const char *v19; // ecx@68 | |
248 | 6461 //unsigned int v20; // eax@69 |
467 | 6462 signed int pPrice; // ecx@70 |
0 | 6463 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6464 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6465 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6466 //int v25; // [sp-4h] [bp-10h]@49 |
6467 | |
459 | 6468 uDialogueType = uMessageParam + 1; |
1211 | 6469 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
467 | 6470 if ( uMessageParam <= 24 ) |
460 | 6471 { |
459 | 6472 switch ( uMessageParam ) |
6473 { | |
6474 case 13: | |
827 | 6475 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6476 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6477 NPCHireableDialogPrepare(); |
459 | 6478 dialogue_show_profession_details = false; |
6479 goto _return; | |
6480 case 19: | |
6481 pEventNumber = pCurrentNPCInfo->evt_A; | |
6482 break; | |
6483 case 20: | |
6484 pEventNumber = pCurrentNPCInfo->evt_B; | |
6485 break; | |
6486 case 21: | |
6487 pEventNumber = pCurrentNPCInfo->evt_C; | |
6488 break; | |
6489 case 22: | |
6490 pEventNumber = pCurrentNPCInfo->evt_D; | |
6491 break; | |
6492 case 23: | |
6493 pEventNumber = pCurrentNPCInfo->evt_E; | |
6494 break; | |
6495 case 24: | |
6496 pEventNumber = pCurrentNPCInfo->evt_F; | |
6497 break; | |
6498 default: | |
467 | 6499 goto _return; |
6500 } | |
6501 /*switch ( pEventNumber ) | |
6502 { | |
6503 case 139: | |
6504 sub_4B1ECE(); | |
6505 goto _return; | |
6506 case 311: | |
6507 sub_4BBA85_bounties(); | |
6508 goto _return; | |
6509 }*/ | |
459 | 6510 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6511 { | |
6512 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6513 { | |
6514 if ( pEventNumber == 139 ) | |
0 | 6515 { |
6516 sub_4B1ECE(); | |
6517 } | |
6518 else | |
6519 { | |
459 | 6520 if ( pEventNumber == 311 ) |
0 | 6521 { |
6522 sub_4BBA85_bounties(); | |
6523 } | |
6524 else | |
6525 { | |
827 | 6526 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6527 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6528 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6529 activeLevelDecoration = NULL; |
0 | 6530 } |
6531 } | |
6532 } | |
6533 else | |
6534 { | |
459 | 6535 dword_F8B1D8 = uMessageParam; |
6536 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6537 } |
6538 } | |
6539 else | |
6540 { | |
459 | 6541 sub_4B3FE5(pEventNumber); |
0 | 6542 } |
6543 goto _return; | |
460 | 6544 } |
459 | 6545 if ( uMessageParam != 76 ) |
6546 { | |
6547 if ( uMessageParam == 77 ) | |
6548 { | |
467 | 6549 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6550 if (dialogue_show_profession_details) |
459 | 6551 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6552 else |
459 | 6553 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6554 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6555 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6556 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6557 current_npc_text = v18; |
0 | 6558 } |
6559 else | |
6560 { | |
459 | 6561 if ( uMessageParam == 79 ) |
0 | 6562 { |
484 | 6563 if ( contract_approved ) |
0 | 6564 { |
267 | 6565 Party::TakeGold(gold_transaction_amount); |
0 | 6566 if ( uActiveCharacter ) |
6567 { | |
492 | 6568 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6569 *(short *)v12 &= 0x3Fu; |
6570 switch ( dword_F8B1B0 ) | |
6571 { | |
6572 case 2: | |
492 | 6573 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6574 *v15 |= 0x40u; |
6575 break; | |
6576 case 3: | |
492 | 6577 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6578 *v14 |= 0x80u; |
6579 break; | |
6580 case 4: | |
492 | 6581 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6582 v13[1] |= 1u; |
6583 break; | |
6584 } | |
187 | 6585 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6586 } |
437 | 6587 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6588 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6589 { |
990 | 6590 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6591 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6592 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6593 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6594 }*/ |
0 | 6595 } |
6596 } | |
6597 else | |
6598 { | |
492 | 6599 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6600 { |
267 | 6601 Party::TakeGold(gold_transaction_amount); |
0 | 6602 v4 = pParty->pPlayers; |
6603 do | |
6604 { | |
492 | 6605 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6606 ++v4; |
6607 } | |
6608 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6609 switch ( dword_F8B1D8 ) | |
6610 { | |
6611 case 19: | |
467 | 6612 pEventNumber = pCurrentNPCInfo->evt_A; |
6613 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6614 pCurrentNPCInfo->evt_A = 0; |
0 | 6615 break; |
6616 case 20: | |
467 | 6617 pEventNumber = pCurrentNPCInfo->evt_B; |
6618 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6619 pCurrentNPCInfo->evt_B = 0; |
0 | 6620 break; |
6621 case 21: | |
467 | 6622 pEventNumber = pCurrentNPCInfo->evt_C; |
6623 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6624 pCurrentNPCInfo->evt_C = 0; |
0 | 6625 break; |
6626 case 22: | |
467 | 6627 pEventNumber = pCurrentNPCInfo->evt_D; |
6628 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6629 pCurrentNPCInfo->evt_D = 0; |
0 | 6630 break; |
6631 case 23: | |
467 | 6632 pEventNumber = pCurrentNPCInfo->evt_E; |
6633 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6634 pCurrentNPCInfo->evt_E = 0; |
0 | 6635 break; |
6636 case 24: | |
467 | 6637 pEventNumber = pCurrentNPCInfo->evt_F; |
6638 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6639 pCurrentNPCInfo->evt_F = 0; | |
0 | 6640 break; |
6641 } | |
437 | 6642 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6643 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6644 { |
990 | 6645 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6646 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6647 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6648 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6649 }*/ |
467 | 6650 //v11 = uActiveCharacter; |
0 | 6651 if ( uActiveCharacter ) |
6652 { | |
467 | 6653 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6654 goto _return; |
6655 } | |
6656 } | |
6657 } | |
6658 } | |
6659 goto _return; | |
6660 } | |
6661 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6662 { | |
467 | 6663 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6664 goto _return; |
6665 } | |
459 | 6666 if ( pCurrentNPCInfo->uProfession != 51 ) |
6667 { | |
467 | 6668 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6669 if ( pParty->uNumGold < pPrice ) | |
6670 { | |
6671 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6672 dialogue_show_profession_details = false; |
0 | 6673 uDialogueType = 13; |
827 | 6674 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6675 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6676 if ( uActiveCharacter ) |
248 | 6677 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6678 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6679 goto _return; | |
6680 } | |
6681 Party::TakeGold(pPrice); | |
0 | 6682 } |
147 | 6683 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6684 pCurrentNPCInfo->uFlags |= 128; |
0 | 6685 pParty->field_709 = 0; |
1035 | 6686 pParty->CountHirelings(); |
0 | 6687 if ( pParty->pHirelings[0].pName ) |
6688 { | |
459 | 6689 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6690 v24 = pCurrentNPCInfo->pName; | |
0 | 6691 v22 = pParty->pHireling2Name; |
6692 } | |
6693 else | |
6694 { | |
459 | 6695 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6696 v24 = pCurrentNPCInfo->pName; | |
0 | 6697 v22 = pParty->pHireling1Name; |
6698 } | |
6699 strcpy(v22, v24); | |
6700 pParty->field_709 = 0; | |
1035 | 6701 pParty->CountHirelings(); |
480 | 6702 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6703 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6704 |
6705 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6706 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6707 { |
990 | 6708 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6709 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6710 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6711 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6712 }*/ |
0 | 6713 if ( uActiveCharacter ) |
467 | 6714 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6715 _return: |
460 | 6716 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6717 } |
6718 | |
6719 //----- (004B254D) -------------------------------------------------------- | |
6720 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6721 { | |
955 | 6722 //Player *v1; // esi@1 |
0 | 6723 int v2; // edx@1 |
6724 int v3; // ecx@1 | |
6725 int v4; // edi@1 | |
955 | 6726 int pClassType; // eax@7 |
0 | 6727 int v6; // eax@7 |
6728 int v7; // ebx@7 | |
955 | 6729 //int v8; // ebx@8 |
0 | 6730 signed int v9; // esi@8 |
6731 int v10; // eax@8 | |
6732 char *v11; // ecx@8 | |
6733 int v12; // edi@9 | |
6734 char *v13; // edx@9 | |
6735 signed int v14; // edi@10 | |
6736 unsigned int v16; // eax@29 | |
955 | 6737 //int v17; // eax@36 |
0 | 6738 char v18; // cl@46 |
6739 __int16 v19; // dx@56 | |
6740 int v20; // eax@60 | |
955 | 6741 //char *v21; // [sp-Ch] [bp-38h]@82 |
6742 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6743 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6744 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6745 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6746 //int v26; // [sp-4h] [bp-30h]@38 |
6747 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6748 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6749 int v29; // [sp+10h] [bp-1Ch]@13 | |
6750 int v30; // [sp+14h] [bp-18h]@15 | |
6751 int v31; // [sp+18h] [bp-14h]@16 | |
6752 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6753 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6754 int v34; // [sp+24h] [bp-8h]@7 |
6755 char *v35; // [sp+28h] [bp-4h]@1 | |
6756 | |
484 | 6757 contract_approved = 0; |
0 | 6758 v2 = (_this - 200) % 3; |
6759 v3 = (_this - 200) / 3; | |
6760 v4 = v2; | |
6761 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6762 dword_F8B1AC_award_bit_number = v3; |
0 | 6763 if ( v2 ) |
6764 { | |
6765 if ( v2 == 1 ) | |
6766 { | |
267 | 6767 gold_transaction_amount = 5000; |
0 | 6768 dword_F8B1B0 = 3; |
6769 } | |
6770 else | |
6771 { | |
6772 if ( v2 == 2 ) | |
6773 { | |
267 | 6774 gold_transaction_amount = 8000; |
0 | 6775 dword_F8B1B0 = 4; |
6776 } | |
6777 } | |
6778 } | |
6779 else | |
6780 { | |
267 | 6781 gold_transaction_amount = 2000; |
0 | 6782 dword_F8B1B0 = 2; |
6783 } | |
955 | 6784 pClassType = pPlayers[uActiveCharacter]->classType; |
6785 //v33 = pClassType; | |
6786 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6787 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6788 v7 = a1[0] & 0x3F; |
6789 v34 = v2 + 2; | |
6790 if ( v6 < v2 + 2 ) | |
6791 { | |
955 | 6792 //v8 = v33; |
0 | 6793 v9 = 0; |
955 | 6794 v10 = pClassType - pClassType % 4; |
6795 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6796 do |
6797 { | |
6798 v12 = (unsigned __int8)*v11; | |
6799 v13 = &v28[4 * v9]; | |
6800 *(int *)v13 = 0; | |
6801 if ( v12 < v34 ) | |
6802 { | |
6803 v14 = 1; | |
6804 } | |
6805 else | |
6806 { | |
6807 v14 = 1; | |
6808 *(int *)v13 = 1; | |
6809 } | |
6810 ++v9; | |
6811 v11 += 37; | |
6812 } | |
6813 while ( v9 < 4 ); | |
6814 if ( v29 == v14 ) | |
6815 { | |
6816 v25 = pClassNames[v10 + 1]; | |
6817 } | |
6818 else | |
6819 { | |
955 | 6820 if ( v30 == v14 )//crash |
0 | 6821 { |
6822 if ( v31 == v14 ) | |
6823 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6824 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
|
6825 return pTmpBuf.data(); |
0 | 6826 } |
6827 v25 = pClassNames[v10 + 2]; | |
6828 } | |
6829 else | |
6830 { | |
6831 if ( v31 != v14 ) | |
6832 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6833 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
|
6834 return pTmpBuf.data(); |
0 | 6835 } |
6836 v25 = pClassNames[v10 + 3]; | |
6837 } | |
6838 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6839 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6840 return pTmpBuf.data(); |
0 | 6841 } |
955 | 6842 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6843 return (char *)pNPCTopics[122].pText; |
6844 if ( !v7 ) | |
6845 return (char *)pNPCTopics[131].pText; | |
6846 v16 = SkillToMastery(a1[0]); | |
6847 if ( (signed int)v16 > v4 + 1 ) | |
6848 return (char *)pNPCTopics[v4 + 128].pText; | |
6849 if ( v34 != 2 ) | |
6850 { | |
6851 if ( v34 == 3 ) | |
6852 { | |
6853 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6854 { | |
492 | 6855 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6856 { |
6857 case 12: | |
6858 case 13: | |
6859 case 14: | |
6860 case 15: | |
6861 case 16: | |
6862 case 17: | |
6863 case 18: | |
267 | 6864 gold_transaction_amount = 4000; |
0 | 6865 goto LABEL_42; |
6866 case 19: | |
6867 v19 = 114; | |
955 | 6868 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6869 return v35; | |
6870 if ( !gold_transaction_amount ) | |
6871 goto LABEL_79; | |
6872 goto LABEL_42; | |
0 | 6873 case 20: |
6874 v19 = 110; | |
484 | 6875 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6876 return v35; |
955 | 6877 if ( !gold_transaction_amount ) |
6878 goto LABEL_79; | |
6879 goto LABEL_42; | |
0 | 6880 case 22: |
955 | 6881 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
6882 if ( v20 < 50 ) | |
6883 return v35; | |
6884 if ( !gold_transaction_amount ) | |
6885 goto LABEL_79; | |
6886 goto LABEL_42; | |
0 | 6887 case 24: |
267 | 6888 gold_transaction_amount = 2500; |
955 | 6889 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 6890 if ( v20 < 50 ) |
6891 return v35; | |
955 | 6892 if ( !gold_transaction_amount ) |
6893 goto LABEL_79; | |
6894 goto LABEL_42; | |
6895 case 36: | |
6896 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
6897 if ( v20 < 50 ) | |
6898 return v35; | |
6899 if ( !gold_transaction_amount ) | |
6900 goto LABEL_79; | |
6901 goto LABEL_42; | |
0 | 6902 case 21: |
6903 case 23: | |
6904 case 25: | |
6905 case 26: | |
6906 case 29: | |
6907 case 32: | |
6908 case 34: | |
6909 case 35: | |
267 | 6910 gold_transaction_amount = 2500; |
0 | 6911 goto LABEL_42; |
6912 case 8: | |
6913 case 9: | |
6914 case 10: | |
6915 case 11: | |
267 | 6916 gold_transaction_amount = 3000; |
0 | 6917 goto LABEL_42; |
6918 case 7: | |
955 | 6919 gold_transaction_amount = 0; |
6920 if ( !gold_transaction_amount ) | |
6921 goto LABEL_79; | |
6922 goto LABEL_42; | |
6923 default: | |
6924 if ( !gold_transaction_amount ) | |
6925 goto LABEL_79; | |
6926 goto LABEL_42; | |
0 | 6927 } |
955 | 6928 gold_transaction_amount = 0; |
6929 if ( !gold_transaction_amount ) | |
6930 goto LABEL_79; | |
6931 goto LABEL_42; | |
0 | 6932 } |
6933 } | |
6934 else | |
6935 { | |
6936 if ( v34 != 4 ) | |
6937 { | |
955 | 6938 if ( !gold_transaction_amount ) |
6939 goto LABEL_79; | |
6940 goto LABEL_42; | |
0 | 6941 } |
6942 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
6943 { | |
492 | 6944 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6945 { |
6946 case 19: | |
955 | 6947 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
6948 { | |
6949 if ( !gold_transaction_amount ) | |
6950 goto LABEL_79; | |
6951 goto LABEL_42; | |
6952 } | |
6953 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
6954 { | |
6955 if ( !gold_transaction_amount ) | |
6956 goto LABEL_79; | |
6957 goto LABEL_42; | |
6958 } | |
6959 return v35; | |
0 | 6960 case 20: |
955 | 6961 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
6962 { | |
6963 if ( !gold_transaction_amount ) | |
6964 goto LABEL_79; | |
6965 goto LABEL_42; | |
6966 } | |
6967 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
6968 { | |
6969 if ( !gold_transaction_amount ) | |
6970 goto LABEL_79; | |
6971 goto LABEL_42; | |
6972 } | |
0 | 6973 return v35; |
6974 case 30: | |
955 | 6975 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 6976 if ( (v18 & 0x3Fu) < 0xA ) |
6977 return v35; | |
955 | 6978 if ( !gold_transaction_amount ) |
6979 goto LABEL_79; | |
6980 goto LABEL_42; | |
6981 case 31: | |
6982 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
6983 if ( (v18 & 0x3Fu) < 0xA ) | |
6984 return v35; | |
6985 if ( !gold_transaction_amount ) | |
6986 goto LABEL_79; | |
6987 goto LABEL_42; | |
0 | 6988 case 21: |
6989 case 23: | |
6990 case 24: | |
6991 case 25: | |
6992 case 26: | |
6993 case 29: | |
6994 case 32: | |
6995 case 34: | |
6996 case 35: | |
267 | 6997 gold_transaction_amount = 6000; |
0 | 6998 goto LABEL_42; |
6999 case 8: | |
7000 case 9: | |
7001 case 10: | |
7002 case 11: | |
267 | 7003 gold_transaction_amount = 7000; |
0 | 7004 goto LABEL_42; |
7005 case 7: | |
7006 break; | |
955 | 7007 default: |
7008 if ( !gold_transaction_amount ) | |
7009 goto LABEL_79; | |
7010 goto LABEL_42; | |
0 | 7011 } |
267 | 7012 gold_transaction_amount = 0; |
955 | 7013 if ( !gold_transaction_amount ) |
7014 goto LABEL_79; | |
7015 goto LABEL_42; | |
0 | 7016 } |
7017 } | |
7018 return v35; | |
7019 } | |
7020 if ( v7 < 4 ) | |
7021 return v35; | |
492 | 7022 if ( dword_F8B1AC_award_bit_number > 27 ) |
7023 { | |
7024 if ( dword_F8B1AC_award_bit_number != 29 | |
7025 && dword_F8B1AC_award_bit_number != 32 | |
7026 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7027 { |
267 | 7028 if ( !gold_transaction_amount ) |
0 | 7029 goto LABEL_79; |
7030 goto LABEL_42; | |
7031 } | |
267 | 7032 gold_transaction_amount = 500; |
955 | 7033 if ( !gold_transaction_amount ) |
7034 goto LABEL_79; | |
7035 goto LABEL_42; | |
0 | 7036 } |
492 | 7037 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7038 { |
7039 gold_transaction_amount = 500; | |
7040 if ( !gold_transaction_amount ) | |
7041 goto LABEL_79; | |
7042 goto LABEL_42; | |
7043 } | |
492 | 7044 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7045 { |
267 | 7046 gold_transaction_amount = 0; |
0 | 7047 goto LABEL_79; |
7048 } | |
492 | 7049 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7050 { |
7051 if ( !gold_transaction_amount ) | |
7052 goto LABEL_79; | |
7053 goto LABEL_42; | |
7054 } | |
492 | 7055 if ( dword_F8B1AC_award_bit_number > 18 ) |
7056 { | |
7057 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7058 { |
7059 if ( !gold_transaction_amount ) | |
7060 goto LABEL_79; | |
7061 goto LABEL_42; | |
7062 } | |
7063 gold_transaction_amount = 500; | |
7064 if ( !gold_transaction_amount ) | |
7065 goto LABEL_79; | |
7066 goto LABEL_42; | |
0 | 7067 } |
267 | 7068 gold_transaction_amount = 1000; |
0 | 7069 LABEL_42: |
267 | 7070 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7071 return (char *)pNPCTopics[124].pText; |
7072 LABEL_79: | |
484 | 7073 contract_approved = 1; |
0 | 7074 if ( v34 == 2 ) |
7075 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7076 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 7077 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
|
7078 return pTmpBuf2.data(); |
0 | 7079 } |
7080 if ( v34 == 3 ) | |
7081 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7082 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 7083 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
|
7084 return pTmpBuf2.data(); |
0 | 7085 } |
7086 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7087 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 7088 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
|
7089 return pTmpBuf2.data(); |
0 | 7090 } |
7091 | |
7092 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7093 const char * ContractSelectText( int pEventCode ) |
7094 { | |
7095 static const int dialogue_base=110; | |
484 | 7096 contract_approved = 0; |
492 | 7097 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7098 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7099 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7100 { | |
492 | 7101 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7102 { | |
7103 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7104 } |
7105 else | |
7106 { | |
267 | 7107 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7108 { |
484 | 7109 contract_approved = 1; |
492 | 7110 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7111 } |
7112 else | |
7113 { | |
492 | 7114 return pNPCTopics[dialogue_base+14].pText; |
0 | 7115 } |
7116 } | |
7117 } | |
7118 else | |
7119 { | |
492 | 7120 return pNPCTopics[dialogue_base+12].pText; |
0 | 7121 } |
7122 } | |
7123 | |
7124 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7125 void SimpleHouseAndBoatsDialog() |
0 | 7126 { |
7127 char *v0; // esi@3 | |
7128 char *v1; // ST1C_4@3 | |
7129 char *v2; // eax@3 | |
7130 const char *v3; // ST1C_4@5 | |
7131 int v4; // eax@5 | |
7132 unsigned int i; // eax@5 | |
7133 NPCData *v6; // esi@6 | |
7134 unsigned __int16 v7; // bx@6 | |
7135 unsigned int v8; // eax@6 | |
7136 int v9; // eax@11 | |
7137 unsigned int v10; // ecx@12 | |
7138 int v11; // eax@12 | |
7139 int v12; // esi@12 | |
7140 char *v13; // eax@12 | |
7141 GUIWindow *v14; // ebx@13 | |
7142 char *v15; // esi@14 | |
7143 GUIButton *v16; // eax@15 | |
7144 unsigned int v17; // ecx@15 | |
7145 int v18; // ecx@17 | |
7146 int v19; // ecx@18 | |
7147 int v20; // ecx@19 | |
7148 int v21; // ecx@20 | |
7149 int v22; // ecx@21 | |
7150 unsigned int v23; // ecx@23 | |
7151 int v24; // ecx@35 | |
7152 int v25; // ecx@36 | |
7153 int v26; // ecx@37 | |
7154 int v27; // ecx@38 | |
7155 int v28; // ecx@39 | |
7156 char *v29; // esi@42 | |
7157 unsigned int v30; // ST20_4@42 | |
7158 int v31; // ST1C_4@42 | |
7159 unsigned int v32; // eax@42 | |
7160 char *v33; // eax@43 | |
7161 int v34; // esi@51 | |
7162 int v35; // eax@51 | |
7163 unsigned int v36; // edi@51 | |
7164 GUIButton *v37; // eax@52 | |
7165 int v38; // eax@52 | |
7166 signed int v39; // ecx@54 | |
7167 int v40; // edi@57 | |
7168 GUIButton *v41; // eax@60 | |
7169 GUIButton *v42; // esi@60 | |
7170 const char *v43; // ebx@60 | |
7171 int v44; // eax@60 | |
7172 unsigned int v45; // ecx@60 | |
7173 unsigned __int16 v46; // ax@60 | |
7174 GUIFont *v47; // ebx@64 | |
7175 int v48; // esi@64 | |
7176 char *v49; // eax@66 | |
7177 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7178 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7179 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7180 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7181 int v55; // [sp+10Ch] [bp-10h]@6 | |
7182 int v56; // [sp+110h] [bp-Ch]@13 | |
7183 char *pInString; // [sp+114h] [bp-8h]@12 | |
7184 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7185 | |
7186 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7187 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7188 { |
7189 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7190 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7191 a1.uFrameX = 493; | |
7192 a1.uFrameWidth = 126; | |
7193 a1.uFrameZ = 366; | |
7194 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7195 a1.uFrameX = 483; | |
7196 a1.uFrameWidth = 148; | |
7197 a1.uFrameZ = 334; | |
434 | 7198 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7199 if ( !v2 ) |
7200 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7201 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7202 v2 = pTmpBuf.data(); |
0 | 7203 } |
7204 v3 = v2; | |
7205 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7206 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7207 return; | |
0 | 7208 } |
7209 a1.uFrameWidth -= 10; | |
7210 a1.uFrameZ -= 10; | |
1211 | 7211 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
0 | 7212 v6 = v58; |
949 | 7213 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7214 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7215 v8 = v6->uProfession; |
7216 if ( v8 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7217 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7218 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7219 strcpy(pTmpBuf.data(), v6->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7220 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u); |
0 | 7221 if ( !dword_591080 ) |
7222 { | |
7223 if ( !uDialogueType ) | |
7224 { | |
7225 v9 = v6->greet; | |
7226 if ( v9 ) | |
7227 { | |
7228 v10 = v6->uFlags; | |
819 | 7229 a1.uFrameWidth = game_viewport_width; |
0 | 7230 a1.uFrameZ = 452; |
7231 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7232 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7233 v12 = v11 + 7; | |
973 | 7234 pRenderer->_4A6A68(8, 352 - (v11 + 7), |
7235 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7236 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); | |
0 | 7237 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); |
7238 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7239 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7240 } | |
7241 } | |
7242 } | |
7243 v14 = pDialogueWindow; | |
7244 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7245 v52.uFrameX = 483; | |
7246 v52.uFrameWidth = 148; | |
7247 v52.uFrameZ = 334; | |
7248 v56 = v52.pStartingPosActiveItem; | |
7249 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7250 { | |
348 | 7251 v15 = "";//(char *)v54; |
0 | 7252 while ( 1 ) |
7253 { | |
7254 v16 = v52.GetControl(v56); | |
832 | 7255 v17 = v16->msg_param; |
0 | 7256 pInString = (char *)v16; |
7257 if ( (signed int)v17 > 24 ) | |
7258 { | |
7259 v24 = v17 - 76; | |
7260 if ( !v24 ) | |
7261 { | |
7262 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7263 goto LABEL_49; | |
7264 } | |
7265 v25 = v24 - 1; | |
7266 if ( !v25 ) | |
7267 { | |
7268 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7269 goto LABEL_49; | |
7270 } | |
7271 v26 = v25 - 2; | |
7272 if ( !v26 ) | |
7273 { | |
7274 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7275 LABEL_44: | |
7276 v15 = v33; | |
7277 LABEL_45: | |
7278 v16 = (GUIButton *)pInString; | |
7279 goto LABEL_49; | |
7280 } | |
7281 v27 = v26 - 3; | |
7282 if ( !v27 ) | |
7283 { | |
459 | 7284 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7285 goto LABEL_44; |
7286 } | |
7287 v28 = v27 - 1; | |
7288 if ( !v28 ) | |
7289 { | |
7290 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7291 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7292 v31 = *(int *)v29; |
949 | 7293 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7294 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30); |
1217 | 7295 sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7296 current_npc_text = pTmpBuf2.data(); |
0 | 7297 v15 = ""; |
7298 goto LABEL_45; | |
7299 } | |
7300 if ( v28 != 10 ) | |
7301 goto LABEL_41; | |
7302 } | |
7303 else | |
7304 { | |
7305 if ( v17 == 24 ) | |
7306 { | |
291 | 7307 v23 = v58->evt_F; |
0 | 7308 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7309 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7310 if ( !v15 ) |
7311 { | |
832 | 7312 v16->msg_param = 0; |
0 | 7313 v15 = ""; |
7314 } | |
7315 goto LABEL_49; | |
7316 } | |
7317 v18 = v17 - 13; | |
7318 if ( v18 ) | |
7319 { | |
7320 v19 = v18 - 6; | |
7321 if ( !v19 ) | |
7322 { | |
291 | 7323 v23 = v58->evt_A; |
0 | 7324 goto LABEL_33; |
7325 } | |
7326 v20 = v19 - 1; | |
7327 if ( !v20 ) | |
7328 { | |
291 | 7329 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7330 if ( !v15 ) |
7331 { | |
832 | 7332 v16->msg_param = 0; |
0 | 7333 v15 = ""; |
7334 } | |
7335 if ( uDialogueType != 84 ) | |
7336 goto LABEL_49; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7337 sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
1217 | 7338 sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7339 current_npc_text = pTmpBuf2.data(); |
0 | 7340 goto LABEL_45; |
7341 } | |
7342 v21 = v20 - 1; | |
7343 if ( !v21 ) | |
7344 { | |
291 | 7345 v23 = v58->evt_C; |
0 | 7346 goto LABEL_33; |
7347 } | |
7348 v22 = v21 - 1; | |
7349 if ( !v22 ) | |
7350 { | |
291 | 7351 v23 = v58->evt_D; |
0 | 7352 goto LABEL_33; |
7353 } | |
7354 if ( v22 == 1 ) | |
7355 { | |
291 | 7356 v23 = v58->evt_E; |
0 | 7357 goto LABEL_33; |
7358 } | |
7359 LABEL_41: | |
7360 v15 = ""; | |
7361 goto LABEL_49; | |
7362 } | |
7363 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7364 } | |
7365 LABEL_49: | |
7366 strcpy(v16->pButtonName, v15); | |
7367 ++v56; | |
7368 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7369 { | |
7370 v14 = pDialogueWindow; | |
7371 break; | |
7372 } | |
7373 } | |
7374 } | |
7375 v34 = 0; | |
949 | 7376 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7377 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7378 v36 = v14->pStartingPosActiveItem; |
7379 v55 = v35; | |
7380 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7381 + pDialogueWindow->pStartingPosActiveItem ) | |
7382 { | |
7383 v37 = v14->GetControl(v36); | |
7384 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7385 v14 = pDialogueWindow; | |
7386 v34 += v38; | |
7387 ++v36; | |
7388 } | |
7389 v39 = v14->pNumPresenceButton; | |
7390 if ( v39 ) | |
7391 { | |
7392 v58 = (NPCData *)((174 - v34) / v39); | |
7393 if ( (signed int)v58 > 32 ) | |
7394 v58 = (NPCData *)32; | |
7395 pInString = (char *)2; | |
7396 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7397 v56 = v14->pStartingPosActiveItem; | |
7398 i = v56; | |
7399 if ( (signed int)i < (signed int)(i + v39) ) | |
7400 { | |
7401 while ( 1 ) | |
7402 { | |
7403 v41 = v14->GetControl(i); | |
7404 v42 = v41; | |
7405 v43 = v41->pButtonName; | |
7406 v41->uY = (unsigned int)((char *)v58 + v40); | |
7407 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7408 v45 = v42->uY; | |
7409 v42->uHeight = v44; | |
7410 v40 = v45 + v44 - 1; | |
7411 v42->uW = v40; | |
7412 v46 = v55; | |
7413 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7414 v46 = v54; | |
7415 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7416 v14 = pDialogueWindow; | |
7417 ++pInString; | |
7418 ++v56; | |
7419 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7420 if ( v56 >= (signed int)i ) | |
7421 break; | |
7422 i = v56; | |
7423 } | |
7424 } | |
7425 } | |
827 | 7426 if ( current_npc_text ) |
0 | 7427 { |
7428 w.uFrameWidth = 458; | |
7429 w.uFrameZ = 457; | |
7430 v47 = pFontArrus; | |
827 | 7431 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7432 if ( 352 - v48 < 8 ) |
7433 { | |
7434 v47 = pFontCreate; | |
827 | 7435 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7436 } |
973 | 7437 pRenderer->_4A6A68(8, 352 - v48, |
7438 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7439 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); | |
0 | 7440 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); |
827 | 7441 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7442 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7443 } | |
0 | 7444 } |
7445 | |
7446 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7447 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7448 { |
832 | 7449 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7450 } |
7451 | |
7452 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7453 void sub_4B3A72( int a1 ) |
7454 { | |
7455 int num_buttons; // esi@1 | |
7456 | |
7457 num_buttons = 0; | |
0 | 7458 if ( a1 == 21 ) |
7459 { | |
473 | 7460 CreateButtonInColumn(0, 0x66u); |
7461 num_buttons = 2; | |
7462 CreateButtonInColumn(1, 0x67u); | |
7463 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7464 { | |
7465 num_buttons = 3; | |
7466 CreateButtonInColumn(2, 0x68u); | |
7467 } | |
7468 } | |
972 | 7469 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); |
0 | 7470 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7471 } | |
7472 // F8B1E0: using guessed type int dword_F8B1E0; | |
7473 | |
7474 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7475 void sub_4B3AD4( signed int a1 ) |
7476 { | |
0 | 7477 if ( a1 > 0 ) |
7478 { | |
7479 if ( a1 <= 3 ) | |
7480 { | |
473 | 7481 CreateButtonInColumn(0, 3u); |
7482 CreateButtonInColumn(1, 4u); | |
7483 CreateButtonInColumn(2, 5u); | |
972 | 7484 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
0 | 7485 } |
7486 if ( a1 == 4 ) | |
7487 { | |
473 | 7488 CreateButtonInColumn(0, 3u); |
7489 CreateButtonInColumn(1, 4u); | |
972 | 7490 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); |
473 | 7491 } |
7492 } | |
0 | 7493 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7494 } | |
7495 // F8B1E0: using guessed type int dword_F8B1E0; | |
7496 | |
7497 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7498 void sub_4B3B42( signed int a1 ) |
7499 { | |
0 | 7500 int v1; // ecx@18 |
7501 int v2; // ecx@19 | |
7502 int v3; // ecx@20 | |
7503 signed int v4; // esi@22 | |
7504 signed int v5; // eax@22 | |
7505 unsigned int v6; // edx@24 | |
7506 int v7; // ecx@24 | |
7507 int result; // eax@43 | |
7508 int v9; // [sp-10h] [bp-14h]@28 | |
7509 int v10; // [sp-Ch] [bp-10h]@28 | |
7510 int v11; // [sp-8h] [bp-Ch]@28 | |
7511 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7512 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7513 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7514 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7515 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7516 int v17; // [sp-4h] [bp-8h]@28 | |
7517 | |
7518 if ( a1 > 13 ) | |
7519 { | |
7520 if ( a1 > 22 ) | |
7521 { | |
7522 if ( a1 == 23 ) | |
7523 { | |
473 | 7524 CreateButtonInColumn(0, 0xAu); |
7525 CreateButtonInColumn(1, 0xBu); | |
0 | 7526 v14 = 96; |
7527 LABEL_41: | |
473 | 7528 CreateButtonInColumn(2, v14); |
0 | 7529 v17 = 2; |
7530 v11 = 0; | |
7531 v10 = 1; | |
7532 v9 = 3; | |
7533 goto LABEL_42; | |
7534 } | |
7535 if ( a1 <= 26 ) | |
7536 goto LABEL_43; | |
7537 if ( a1 > 28 ) | |
7538 { | |
7539 if ( a1 != 30 ) | |
7540 goto LABEL_43; | |
473 | 7541 CreateButtonInColumn(0, 0x11u); |
0 | 7542 v16 = 96; |
7543 goto LABEL_37; | |
7544 } | |
473 | 7545 CreateButtonInColumn(0, 0x69u); |
7546 CreateButtonInColumn(1, 0x6Au); | |
7547 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7548 v12 = 108; |
7549 } | |
7550 else | |
7551 { | |
7552 if ( a1 == 22 ) | |
7553 { | |
473 | 7554 CreateButtonInColumn(0, 7u); |
0 | 7555 v16 = 8; |
7556 goto LABEL_37; | |
7557 } | |
7558 v1 = a1 - 14; | |
7559 if ( !v1 ) | |
7560 { | |
473 | 7561 CreateButtonInColumn(0, 0x12u); |
7562 CreateButtonInColumn(1, 0x30u); | |
7563 CreateButtonInColumn(2, 0x31u); | |
7564 CreateButtonInColumn(3, 0x32u); | |
7565 CreateButtonInColumn(4, 0x33u); | |
0 | 7566 v17 = 2; |
7567 v11 = 0; | |
7568 v10 = 1; | |
7569 v9 = 5; | |
7570 goto LABEL_42; | |
7571 } | |
7572 v2 = v1 - 1; | |
7573 if ( v2 ) | |
7574 { | |
7575 v3 = v2 - 2; | |
7576 if ( v3 ) | |
7577 { | |
7578 if ( v3 != 4 ) | |
7579 goto LABEL_43; | |
473 | 7580 CreateButtonInColumn(0, 0xFu); |
7581 CreateButtonInColumn(1, 0x10u); | |
0 | 7582 v4 = 3; |
473 | 7583 CreateButtonInColumn(2, 0x60u); |
336 | 7584 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7585 if ( v5 < 108 || v5 > 120 ) |
7586 goto LABEL_28; | |
7587 v4 = 4; | |
7588 v6 = 101; | |
7589 v7 = 3; | |
7590 } | |
7591 else | |
7592 { | |
7593 v4 = 1; | |
473 | 7594 CreateButtonInColumn(0, 0x63u); |
0 | 7595 if ( !pParty->uFine ) |
7596 { | |
7597 LABEL_28: | |
7598 v17 = 2; | |
7599 v11 = 0; | |
7600 v10 = 1; | |
7601 v9 = v4; | |
7602 LABEL_42: | |
972 | 7603 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); |
0 | 7604 goto LABEL_43; |
7605 } | |
7606 v4 = 2; | |
7607 v7 = 1; | |
7608 v6 = 100; | |
7609 } | |
473 | 7610 CreateButtonInColumn(v7, v6); |
0 | 7611 goto LABEL_28; |
7612 } | |
473 | 7613 CreateButtonInColumn(0, 0x12u); |
7614 CreateButtonInColumn(1, 0x34u); | |
7615 CreateButtonInColumn(2, 0x35u); | |
0 | 7616 v12 = 54; |
7617 } | |
7618 LABEL_39: | |
473 | 7619 CreateButtonInColumn(3, v12); |
0 | 7620 v17 = 2; |
7621 v11 = 0; | |
7622 v10 = 1; | |
7623 v9 = 4; | |
7624 goto LABEL_42; | |
7625 } | |
7626 if ( a1 == 13 ) | |
7627 { | |
473 | 7628 CreateButtonInColumn(0, 0x12u); |
0 | 7629 v16 = 56; |
7630 LABEL_37: | |
473 | 7631 CreateButtonInColumn(1, v16); |
0 | 7632 v17 = 2; |
7633 v11 = 0; | |
7634 v10 = 1; | |
7635 v9 = 2; | |
7636 goto LABEL_42; | |
7637 } | |
7638 switch ( a1 ) | |
7639 { | |
7640 case 1: | |
7641 case 2: | |
7642 case 3: | |
7643 case 4: | |
473 | 7644 CreateButtonInColumn(0, 2u); |
7645 CreateButtonInColumn(1, 0x5Fu); | |
7646 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7647 v12 = 96; |
7648 goto LABEL_39; | |
7649 case 5: | |
473 | 7650 CreateButtonInColumn(0, 0x12u); |
0 | 7651 v13 = 48; |
7652 goto LABEL_9; | |
7653 case 6: | |
473 | 7654 CreateButtonInColumn(0, 0x12u); |
0 | 7655 v13 = 49; |
7656 goto LABEL_9; | |
7657 case 7: | |
473 | 7658 CreateButtonInColumn(0, 0x12u); |
0 | 7659 v13 = 50; |
7660 goto LABEL_9; | |
7661 case 8: | |
473 | 7662 CreateButtonInColumn(0, 0x12u); |
0 | 7663 v13 = 51; |
7664 LABEL_9: | |
473 | 7665 CreateButtonInColumn(1, v13); |
0 | 7666 v14 = 72; |
7667 goto LABEL_41; | |
7668 case 9: | |
473 | 7669 CreateButtonInColumn(0, 0x12u); |
0 | 7670 v15 = 52; |
7671 goto LABEL_13; | |
7672 case 10: | |
473 | 7673 CreateButtonInColumn(0, 0x12u); |
0 | 7674 v15 = 53; |
7675 goto LABEL_13; | |
7676 case 11: | |
473 | 7677 CreateButtonInColumn(0, 0x12u); |
0 | 7678 v15 = 54; |
7679 LABEL_13: | |
473 | 7680 CreateButtonInColumn(1, v15); |
0 | 7681 v14 = 61; |
7682 goto LABEL_41; | |
7683 case 12: | |
473 | 7684 CreateButtonInColumn(0, 0x12u); |
0 | 7685 v16 = 55; |
7686 goto LABEL_37; | |
7687 default: | |
7688 break; | |
7689 } | |
7690 LABEL_43: | |
7691 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7692 } | |
7693 // F8B1E0: using guessed type int dword_F8B1E0; | |
7694 | |
7695 //----- (004B3E1E) -------------------------------------------------------- | |
7696 void __cdecl sub_4B3E1E() | |
7697 { | |
7698 NPCData *v0; // ST40_4@1 | |
7699 signed int v1; // edi@1 | |
165 | 7700 //GUIWindow *v2; // ecx@1 |
0 | 7701 |
167 | 7702 __debugbreak(); |
602 | 7703 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7704 v1 = 0; |
7705 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7706 pDialogueWindow->Release(); | |
165 | 7707 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7708 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7709 { |
832 | 7710 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7711 v1 = 1; |
7712 } | |
832 | 7713 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 7714 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 7715 } |
7716 | |
7717 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7718 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7719 { |
467 | 7720 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7721 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7722 ContractSelectText(pEventCode); |
0 | 7723 pDialogueWindow->Release(); |
492 | 7724 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7725 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7726 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7727 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
972 | 7728 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7729 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7730 } |
7731 // F8B19C: using guessed type int dword_F8B19C; | |
7732 | |
7733 //----- (004B3FE5) -------------------------------------------------------- | |
7734 void __fastcall sub_4B3FE5(int a4) | |
7735 { | |
7736 int v1; // edi@1 | |
7737 char *v2; // edi@1 | |
7738 | |
7739 v1 = a4; | |
7740 uDialogueType = 78; | |
827 | 7741 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7742 _4B254D_SkillMasteryTeacher(a4); |
7743 pDialogueWindow->Release(); | |
7744 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7745 v2 = ""; | |
832 | 7746 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7747 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7748 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7749 if ( contract_approved ) |
0 | 7750 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7751 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 7752 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7753 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7754 } |
7755 // F8B19C: using guessed type int dword_F8B19C; | |
7756 // F8B1A8: using guessed type int dword_F8B1A8; | |
7757 | |
7758 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7759 void NPCHireableDialogPrepare() |
7760 { | |
0 | 7761 signed int v0; // ebx@1 |
7762 NPCData *v1; // edi@1 | |
7763 | |
7764 v0 = 0; | |
1211 | 7765 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
0 | 7766 pDialogueWindow->Release(); |
7767 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7768 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7769 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7770 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7771 0); |
832 | 7772 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7773 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7774 { |
832 | 7775 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7776 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7777 v0 = 1; |
7778 } | |
832 | 7779 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7780 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
972 | 7781 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); |
747 | 7782 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7783 } |
7784 | |
7785 //----- (004B4224) -------------------------------------------------------- | |
423 | 7786 void _4B4224_UpdateNPCTopics( int _this ) |
7787 { | |
7788 int num_menu_buttons; // ebx@1 | |
0 | 7789 int i; // ebp@5 |
423 | 7790 // signed int v4; // ebp@9 |
7791 int v6; // eax@16 | |
7792 int v8; // eax@21 | |
7793 int v10; // eax@26 | |
7794 int v12; // eax@31 | |
7795 int v14; // eax@36 | |
7796 int v16; // eax@41 | |
0 | 7797 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7798 | |
423 | 7799 num_menu_buttons = 0; |
459 | 7800 pDialogueNPCCount = (_this + 1); |
0 | 7801 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7802 { | |
7803 pDialogueWindow->Release(); | |
7804 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7805 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7806 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7807 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName.data(), pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7808 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName.data(), 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7809 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName.data(), 0); |
0 | 7810 } |
7811 else | |
7812 { | |
1211 | 7813 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) )];//+ 1 |
749 | 7814 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7815 { |
7816 pDialogueWindow->Release(); | |
7817 } | |
7818 else | |
7819 { | |
7820 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
1211 | 7821 dword_5913F4[i]->Release(); |
0 | 7822 } |
7823 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7824 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7825 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7826 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7827 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7828 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7829 { |
484 | 7830 sub_4B3B42(in_current_building_type); |
0 | 7831 } |
7832 else | |
7833 { | |
7834 if ( v17->joins ) | |
7835 { | |
423 | 7836 num_menu_buttons = 1; |
858 | 7837 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7838 } |
423 | 7839 if ( v17->evt_A) |
7840 { | |
7841 if ( num_menu_buttons < 4 ) | |
7842 { | |
7843 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7844 if ( v6 == 1 || v6 == 2 ) |
832 | 7845 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7846 } |
7847 } | |
7848 if ( v17->evt_B ) | |
7849 { | |
7850 if ( num_menu_buttons < 4 ) | |
7851 { | |
7852 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7853 if ( v8 == 1 || v8 == 2 ) |
832 | 7854 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7855 } |
7856 } | |
7857 if ( v17->evt_C ) | |
7858 { | |
7859 if ( num_menu_buttons < 4 ) | |
7860 { | |
7861 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7862 if ( v10 == 1 || v10 == 2 ) |
832 | 7863 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7864 } |
7865 } | |
7866 | |
7867 if ( v17->evt_D ) | |
7868 { | |
7869 if ( num_menu_buttons < 4 ) | |
7870 { | |
7871 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7872 if ( v12 == 1 || v12 == 2 ) |
832 | 7873 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7874 } |
7875 } | |
7876 if ( v17->evt_E ) | |
7877 { | |
7878 if ( num_menu_buttons < 4 ) | |
7879 { | |
7880 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7881 if ( v14 == 1 || v14 == 2 ) |
832 | 7882 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7883 } |
7884 } | |
7885 if ( v17->evt_F ) | |
7886 { | |
7887 if ( num_menu_buttons < 4 ) | |
7888 { | |
7889 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7890 if ( v16 == 1 || v16 == 2 ) |
832 | 7891 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7892 } |
7893 } | |
972 | 7894 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); |
0 | 7895 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7896 } | |
747 | 7897 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7898 } |
7899 | |
0 | 7900 } |
7901 | |
7902 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 7903 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
7904 { | |
0 | 7905 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7906 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 7907 v4 = pFontLucida->AlignText_Center(450, Str); |
7908 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 7909 } |
7910 | |
7911 //----- (004B46F8) -------------------------------------------------------- | |
7912 int __fastcall sub_4B46F8(int a1) | |
7913 { | |
7914 int v1; // eax@1 | |
7915 int i; // edx@1 | |
7916 | |
7917 v1 = 0; | |
7918 for ( i = 0; i < a1; ++i ) | |
7919 v1 += i + 1; | |
7920 return 1000 * v1; | |
7921 } | |
7922 | |
7923 //----- (004BC49B) -------------------------------------------------------- | |
651 | 7924 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 7925 { |
656 | 7926 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7927 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7928 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7929 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7930 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7931 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7932 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7933 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7934 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7935 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7936 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7937 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7938 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7939 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7940 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7941 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7942 //v1 = _this; |
656 | 7943 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7944 //v3 = v1; |
656 | 7945 uDialogueType = newDialogueType; |
7946 if (!speakingNPC->uFlags) | |
7947 { | |
7948 speakingNPC->uFlags = 1; | |
7949 //v3 = uDialogueType; | |
7950 } | |
7951 | |
7952 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
7953 { | |
7954 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
7955 } | |
7956 else if(newDialogueType == DIALOGUE_76) | |
7957 { | |
7958 if (speakingNPC->Hired()) | |
7959 { | |
7960 v8 = 0; | |
7961 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7962 { | |
7963 v6 = (char *)pNPCStats->pNewNPCData; | |
7964 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
7965 { | |
7966 ++v8; | |
7967 v6 += 76; | |
7968 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
7969 break; | |
7970 } | |
7971 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
7972 v6[8] &= 0x7Fu; | |
7973 } | |
1104 | 7974 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 7975 { |
7976 v11 = pParty->pHirelings; | |
7977 memset(v11, 0, sizeof(NPCData)); | |
7978 } | |
1104 | 7979 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 7980 { |
7981 v11 = &pParty->pHirelings[1]; | |
7982 memset(v11, 0, sizeof(NPCData)); | |
7983 } | |
7984 pParty->field_709 = 0; | |
1035 | 7985 pParty->CountHirelings(); |
656 | 7986 dword_591084 = 0; |
7987 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7988 dword_7241C8 = 0; | |
7989 return; | |
7990 } | |
7991 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7992 { | |
7993 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
7994 ShowStatusBarString(v7, 2u); | |
7995 } | |
7996 else | |
7997 { | |
7998 //v9 = v2->uProfession; | |
7999 if ( speakingNPC->uProfession != 51 ) | |
8000 { | |
8001 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8002 if ( pParty->uNumGold < v10 ) | |
8003 { | |
8004 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8005 dialogue_show_profession_details = false; | |
8006 uDialogueType = 13; | |
8007 if ( uActiveCharacter ) | |
8008 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8009 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8010 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8011 if ( !dword_7241C8 ) | |
8012 pGame->Draw(); | |
8013 dword_7241C8 = 0; | |
8014 return; | |
8015 } | |
8016 Party::TakeGold(v10); | |
8017 } | |
8018 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8019 if ( pParty->pHirelings[0].pName ) | |
8020 { | |
8021 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8022 v15 = speakingNPC->pName; | |
8023 v13 = pParty->pHireling2Name; | |
8024 } | |
8025 else | |
8026 { | |
8027 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8028 v15 = speakingNPC->pName; | |
8029 v13 = pParty->pHireling1Name; | |
8030 } | |
8031 strcpy(v13, v15); | |
8032 pParty->field_709 = 0; | |
1035 | 8033 pParty->CountHirelings(); |
656 | 8034 |
8035 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8036 | |
711 | 8037 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8038 pDialogue_SpeakingActor->uAIState = Removed; |
8039 if ( uActiveCharacter ) | |
8040 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8041 } | |
8042 } | |
8043 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8044 { | |
8045 ArenaFight(); | |
8046 return; | |
8047 } | |
8048 else if(newDialogueType == DIALOGUE_9) | |
8049 { | |
8050 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8051 { | |
8052 if ( speakingNPC->uProfession != 41 ) | |
8053 speakingNPC->bHasUsedTheAbility = 1; | |
8054 | |
8055 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8056 } | |
8057 else | |
8058 { | |
8059 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8060 } | |
8061 } | |
8062 else if(newDialogueType == DIALOGUE_13) | |
8063 { | |
8064 if (!speakingNPC->Hired()) | |
8065 { | |
8066 sub_4B3E1E(); | |
8067 dialogue_show_profession_details = false; | |
8068 } | |
8069 else | |
8070 { | |
8071 v5 = 0; | |
8072 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8073 { | |
8074 v6 = (char *)pNPCStats->pNewNPCData; | |
8075 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8076 { | |
8077 ++v5; | |
8078 v6 += 76; | |
8079 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8080 break; | |
8081 } | |
8082 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8083 v6[8] &= 0x7Fu; | |
8084 } | |
1104 | 8085 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 8086 { |
8087 v11 = pParty->pHirelings; | |
8088 memset(v11, 0, sizeof(NPCData)); | |
8089 } | |
1104 | 8090 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 8091 { |
8092 v11 = &pParty->pHirelings[1]; | |
8093 memset(v11, 0, sizeof(NPCData)); | |
8094 } | |
8095 pParty->field_709 = 0; | |
1035 | 8096 pParty->CountHirelings(); |
656 | 8097 dword_591084 = 0; |
8098 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8099 dword_7241C8 = 0; | |
8100 return; | |
8101 } | |
8102 } | |
8103 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8104 { | |
8105 switch(newDialogueType) | |
8106 { | |
8107 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8108 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8109 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8110 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8111 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8112 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8113 } | |
8114 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8115 sub_4B3FE5(npc_event_id); //200-310 | |
8116 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8117 { //400-410 | |
8118 dword_F8B1D8 = newDialogueType; | |
8119 DrawJoinGuildWindow(npc_event_id - 400); | |
8120 } | |
8121 else | |
8122 { | |
8123 switch ( npc_event_id ) | |
8124 { | |
8125 case 139: | |
8126 sub_4B1ECE(); | |
8127 break; | |
8128 case 311: | |
8129 sub_4BBA85_bounties(); | |
8130 break; | |
8131 case 399: | |
8132 sub_4BBCDD(); | |
8133 break; | |
8134 default: | |
8135 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8136 current_npc_text = 0; |
656 | 8137 EventProcessor(npc_event_id, 0, 1); |
8138 activeLevelDecoration = NULL; | |
8139 break; | |
8140 } | |
8141 } | |
8142 } | |
8143 if ( !dword_7241C8 ) | |
8144 pGame->Draw(); | |
8145 dword_7241C8 = 0; | |
8146 } | |
0 | 8147 |
8148 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8149 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8150 { |
8151 int v6; // edx@8 | |
8152 int v7; // edx@9 | |
8153 int v8; // edx@10 | |
8154 unsigned __int8 v9; // zf@16 | |
8155 char v10; // sf@16 | |
8156 unsigned __int8 v11; // of@16 | |
702 | 8157 bool test; |
0 | 8158 |
907 | 8159 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8160 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8161 return 0; |
907 | 8162 switch( p2DEvents[_2da_idx - 1].uType ) |
8163 { | |
8164 case BildingType_WeaponShop: | |
8165 { | |
8166 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8167 break; | |
8168 } | |
8169 case BildingType_ArmorShop: | |
8170 { | |
8171 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8172 break; | |
8173 } | |
8174 case BildingType_MagicShop: | |
8175 { | |
8176 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8177 break; | |
8178 } | |
8179 case BildingType_AlchemistShop: | |
8180 { | |
8181 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8182 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8183 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8184 break; | |
8185 } | |
8186 default: | |
8187 { | |
8188 test = false; | |
8189 break; | |
8190 } | |
8191 } | |
702 | 8192 return test; |
8193 /* | |
8194 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8195 { |
8196 v11 = __OFSUB__(v5, 2); | |
8197 v9 = v5 == 2; | |
8198 v10 = v5 - 2 < 0; | |
8199 goto LABEL_23; | |
8200 } | |
702 | 8201 if ( p2DEvents[a2 - 1].uType > 2 ) |
8202 { | |
8203 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8204 { |
8205 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8206 return v5 == 16; | |
8207 return 1; | |
8208 } | |
702 | 8209 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8210 return 0; |
702 | 8211 if ( p2DEvents[a2 - 1].uType == 4) |
8212 { | |
8213 if ( v5 < 13 ) | |
8214 return 0; | |
8215 if ( v5 <= 14 ) | |
8216 return 1; | |
8217 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8218 return 0; | |
8219 v11 = __OFSUB__(v3, 771); | |
8220 v9 = v3 == 771; | |
8221 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8222 LABEL_23: |
702 | 8223 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8224 return 0; | |
8225 return 1; | |
8226 } | |
8227 } | |
8228 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8229 { | |
8230 if ( v5 >= 3 ) | |
8231 { | |
8232 v11 = __OFSUB__(v5, 9); | |
8233 v9 = v5 == 9; | |
8234 v10 = v5 - 9 < 0; | |
8235 goto LABEL_23; | |
8236 } | |
0 | 8237 } |
8238 return 0; | |
702 | 8239 */ |
0 | 8240 } |
8241 | |
1209 | 8242 |
0 | 8243 |
8244 //----- (00405CFF) -------------------------------------------------------- | |
8245 void stru262_TurnBased::End(bool bPlaySound) | |
8246 { | |
8247 stru262_TurnBased *v2; // edi@1 | |
8248 int v3; // ebx@1 | |
8249 int v4; // esi@1 | |
8250 unsigned __int8 v5; // zf@1 | |
8251 unsigned __int8 v6; // sf@1 | |
8252 TurnBased_QueueElem *v7; // ecx@2 | |
8253 unsigned __int16 *pAttributes; // ecx@7 | |
8254 size_t v9; // edx@7 | |
8255 unsigned __int16 v10; // ax@8 | |
8256 TurnBased_QueueElem *v11; // ebx@12 | |
8257 ObjectType objType; // eax@13 | |
8258 int objID; // esi@13 | |
8259 int v14; // [sp+Ch] [bp-4h]@11 | |
8260 | |
8261 v2 = this; | |
8262 v3 = 0; | |
8263 v4 = 0; | |
8264 v5 = this->uActorQueueSize == 0; | |
8265 v6 = this->uActorQueueSize < 0; | |
8266 this->field_4 = 0; | |
8267 if ( !(v6 | v5) ) | |
8268 { | |
8269 v7 = this->pQueue; | |
8270 do | |
8271 { | |
848 | 8272 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8273 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8274 ++v4; |
8275 ++v7; | |
8276 } | |
8277 while ( v4 < v2->uActorQueueSize ); | |
8278 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8279 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8280 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8281 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8282 v9 = uNumSpriteObjects; |
0 | 8283 do |
8284 { | |
8285 v10 = *pAttributes; | |
8286 if ( *pAttributes & 4 ) | |
8287 { | |
8288 LOBYTE(v10) = v10 & 0xFB; | |
8289 *pAttributes = v10; | |
8290 } | |
8291 pAttributes += 56; | |
8292 --v9; | |
8293 } | |
8294 while ( v9 ); | |
8295 } | |
8296 v14 = 0; | |
8297 if ( v2->uActorQueueSize > 0 ) | |
8298 { | |
8299 v11 = v2->pQueue; | |
8300 do | |
8301 { | |
848 | 8302 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8303 objID = PID_ID(v11->uPackedID); | |
0 | 8304 if ( objType == OBJECT_Player ) |
8305 { | |
8306 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8307 } | |
8308 else | |
8309 { | |
8310 if ( objType == OBJECT_Actor ) | |
8311 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8312 } | |
8313 ++v14; | |
8314 ++v11; | |
8315 } | |
8316 while ( v14 < v2->uActorQueueSize ); | |
8317 v3 = 0; | |
8318 } | |
8319 pAudioPlayer->StopChannels(-1, -1); | |
8320 if ( bPlaySound != v3 ) | |
8321 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8322 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8323 pEventTimer->StopGameTime(); | |
8324 dword_50C994 = v3; | |
8325 dword_50C998_turnbased_icon_1A = v3; | |
8326 } | |
8327 // 50C994: using guessed type int dword_50C994; | |
8328 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8329 | |
8330 //----- (00405E14) -------------------------------------------------------- | |
8331 void stru262_TurnBased::_405E14() | |
8332 { | |
8333 stru262_TurnBased *v1; // esi@1 | |
8334 int v2; // ecx@1 | |
8335 SpellBuff *v3; // edi@2 | |
8336 Actor *v4; // ebx@3 | |
8337 signed int v5; // edx@20 | |
8338 AIDirection *v6; // esi@21 | |
8339 int v7; // eax@21 | |
8340 int v8; // eax@21 | |
8341 int v9; // eax@22 | |
8342 int v10; // eax@23 | |
8343 int v11; // eax@37 | |
8344 int v12; // eax@44 | |
8345 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8346 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8347 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8348 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8349 int v17; // [sp+5Ch] [bp-10h]@6 |
8350 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8351 int v19; // [sp+64h] [bp-8h]@8 | |
8352 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8353 | |
8354 v1 = this; | |
8355 v2 = 0; | |
8356 v18 = v1; | |
8357 v20 = 0; | |
8358 if ( (signed int)uNumActors > 0 ) | |
8359 { | |
90 | 8360 //v3 = pActors;//[0].pActorBuffs; |
1202 | 8361 v16 = pActors.data();//[0].pActorBuffs; |
90 | 8362 v3 = v16->pActorBuffs; |
0 | 8363 do |
8364 { | |
90 | 8365 v4 = v16; |
8366 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8367 v17 = v2; |
8368 else | |
8369 v17 = 1; | |
8370 v19 = v2; | |
8371 do | |
8372 { | |
8373 if ( v19 != 10 ) | |
8374 { | |
8375 v3->_4585CA(pParty->uTimePlayed); | |
8376 v2 = 0; | |
8377 } | |
8378 ++v19; | |
8379 ++v3; | |
8380 } | |
8381 while ( v19 < 22 ); | |
8382 if ( v17 != v2 | |
8383 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8384 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8385 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8386 if ( !(v4->uAttributes & 0x80) ) | |
8387 { | |
8388 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8389 { | |
8390 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8391 { | |
8392 v5 = v4->uCurrentActionLength; | |
8393 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8394 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8395 { | |
417 | 8396 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8397 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8398 v7 = v4->uAIState; |
8399 memcpy(&v15, v6, sizeof(v15)); | |
8400 v8 = v7 - 4; | |
8401 memcpy(&v14, &v15, sizeof(v14)); | |
8402 if ( v8 ) | |
8403 { | |
8404 v9 = v8 - 1; | |
8405 if ( v9 ) | |
8406 { | |
8407 v10 = v9 - 6; | |
8408 if ( v10 ) | |
8409 { | |
8410 if ( v10 != 8 ) | |
414 | 8411 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8412 } |
8413 } | |
8414 } | |
8415 else | |
8416 { | |
8417 v4->uCurrentActionTime = 0; | |
8418 v4->uCurrentActionLength = 0; | |
8419 v4->uAIState = Dead; | |
8420 v4->UpdateAnimation(); | |
8421 } | |
8422 v1 = v18; | |
8423 v2 = 0; | |
8424 } | |
8425 } | |
8426 } | |
8427 } | |
8428 ++v20; | |
90 | 8429 v3 = v16[1].pActorBuffs; |
8430 ++v16; | |
0 | 8431 } |
8432 while ( (signed int)v20 < (signed int)uNumActors ); | |
8433 } | |
8434 if ( v1->field_4 == 1 ) | |
8435 { | |
8436 v12 = v1->field_8; | |
8437 if ( v12 == 64 ) | |
8438 { | |
8439 v1->_406A63(); | |
8440 } | |
8441 else | |
8442 { | |
8443 if ( v12 > v2 ) | |
8444 { | |
8445 v1->_406B9F(); | |
8446 } | |
8447 else | |
8448 { | |
8449 v1->_406AFE(); | |
8450 v1->field_10 = 100; | |
8451 } | |
8452 } | |
8453 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8454 return; | |
8455 } | |
8456 if ( v1->field_4 == 2 ) | |
8457 { | |
8458 if ( !(v1->field_18 & 1) ) | |
8459 { | |
8460 v11 = v1->field_10; | |
8461 if ( v11 == 100 ) | |
8462 { | |
8463 v1->StartTurn(); | |
8464 LABEL_39: | |
8465 v1->_40652A(); | |
8466 return; | |
8467 } | |
8468 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8469 { | |
8470 v1->_4065B0(); | |
8471 goto LABEL_39; | |
8472 } | |
8473 } | |
8474 v1->NextTurn(); | |
8475 return; | |
8476 } | |
8477 if ( v1->field_4 == 3 ) | |
8478 { | |
8479 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8480 { | |
8481 v1->field_18 &= 0xFFFFFFF7u; | |
8482 v1->field_4 = 1; | |
8483 v1->field_8 = 64; | |
8484 } | |
8485 else | |
8486 { | |
8487 v1->_406FA8(); | |
8488 } | |
8489 } | |
8490 } | |
8491 | |
8492 //----- (0043FDED) -------------------------------------------------------- | |
8493 void PrepareActorRenderList_BLV() | |
8494 { | |
8495 RenderBillboard *v0; // esi@0 | |
8496 unsigned __int16 v3; // ax@3 | |
8497 unsigned int v4; // eax@5 | |
8498 unsigned __int16 v5; // cx@5 | |
8499 int v6; // esi@5 | |
8500 unsigned int v7; // eax@7 | |
8501 int v8; // eax@10 | |
8502 SpriteFrame *v9; // eax@16 | |
8503 SpriteFrame *v10; // ebx@18 | |
8504 //int *v11; // eax@18 | |
8505 int v12; // ecx@28 | |
8506 //IndoorCameraD3D **v14; // eax@36 | |
8507 double v15; // st7@36 | |
8508 float v16; // eax@36 | |
8509 //double v17; // ST30_8@36 | |
8510 signed __int64 v18; // qtt@36 | |
8511 int v19; // ST5C_4@36 | |
8512 signed __int64 v20; // qtt@37 | |
8513 int v21; // ST5C_4@37 | |
8514 signed __int16 v22; // cx@39 | |
8515 int v23; // ST50_4@40 | |
8516 signed int v24; // ecx@40 | |
8517 int v25; // edx@44 | |
8518 __int16 v26; // ax@44 | |
8519 //MonsterDesc *v27; // edx@44 | |
8520 //int v28; // ecx@44 | |
8521 unsigned __int8 v29; // zf@44 | |
8522 unsigned __int8 v30; // sf@44 | |
8523 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8524 int v32; // [sp+1Ch] [bp-38h]@5 | |
8525 int a3; // [sp+20h] [bp-34h]@5 | |
8526 int a2; // [sp+24h] [bp-30h]@5 | |
8527 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8528 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8529 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8530 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8531 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8532 int a6; // [sp+40h] [bp-14h]@34 | |
8533 int v43; // [sp+44h] [bp-10h]@34 | |
8534 int z; // [sp+48h] [bp-Ch]@32 | |
8535 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8536 int x; // [sp+50h] [bp-4h]@32 | |
8537 | |
8538 for (uint i = 0; i < uNumActors; ++i) | |
8539 { | |
1202 | 8540 auto p = &pActors[i]; |
0 | 8541 |
8542 if (p->uAIState == Removed || | |
8543 p->uAIState == Disabled) | |
8544 continue; | |
8545 | |
8546 a5 = p->uSectorID; | |
8547 a2 = p->vPosition.y; | |
8548 a1a = p->vPosition.x; | |
8549 a3 = p->vPosition.z; | |
8550 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8551 LOWORD(v0) = p->uYawAngle; | |
8552 v5 = p->uCurrentActionAnimation; | |
8553 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8554 v32 = v6; | |
8555 if ( pParty->bTurnBasedModeOn ) | |
8556 { | |
8557 if ( v5 == 1 ) | |
8558 { | |
8559 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8560 goto LABEL_10; | |
8561 } | |
8562 } | |
8563 else | |
8564 { | |
8565 if ( v5 == 1 ) | |
8566 { | |
8567 v7 = pBLVRenderParams->field_0_timer_; | |
8568 LABEL_10: | |
8569 v8 = i * 32 + v7; | |
8570 goto LABEL_12; | |
8571 } | |
8572 } | |
8573 v8 = p->uCurrentActionTime; | |
8574 LABEL_12: | |
8575 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8576 v8 = 0; | |
8577 v31 = p->pSpriteIDs[v5]; | |
8578 if (p->uAIState == Resurrected) | |
8579 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8580 else | |
8581 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8582 v41 = 0; | |
8583 v10 = v9; | |
8584 //v11 = (int *)v9->uFlags; | |
8585 if (v9->uFlags & 2) | |
8586 v41 = 2; | |
8587 if (v9->uFlags & 0x40000) | |
8588 v41 |= 0x40u; | |
8589 if (v9->uFlags & 0x20000) | |
8590 LOBYTE(v41) = v41 | 0x80; | |
8591 v0 = (RenderBillboard *)(256 << v6); | |
8592 if ( (unsigned int)v0 & v9->uFlags) | |
8593 v41 |= 4u; | |
8594 if ( v10->uGlowRadius ) | |
8595 { | |
8596 //LOBYTE(v11) = byte_4E94D3; | |
8597 pMobileLightsStack->AddLight( | |
8598 a1a, | |
8599 a2, | |
8600 a3, | |
8601 a5, | |
8602 v10->uGlowRadius, | |
8603 0xFFu, | |
8604 0xFFu, | |
8605 0xFFu, | |
8606 byte_4E94D3); | |
8607 } | |
8608 v12 = 0; | |
8609 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8610 continue; | |
8611 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8612 { | |
8613 ++v12; | |
8614 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8615 goto _continue; | |
8616 } | |
8617 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8618 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8619 continue; | |
8620 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8621 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8622 if (uNumBillboardsToDraw >= 500) | |
8623 break; | |
8624 ++uNumBillboardsToDraw; | |
8625 ++uNumSpritesDrawnThisFrame; | |
8626 p->uAttributes |= 8u; | |
8627 v29 = pRenderer->pRenderD3D == 0; | |
8628 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8629 v0->uPalette = v10->uPaletteIndex; | |
8630 v0->uIndoorSectorID = a5; | |
8631 if ( v29 ) | |
8632 { | |
8633 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8634 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8635 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8636 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8637 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8638 } | |
8639 else | |
8640 { | |
8641 //v14 = &pGame->pIndoorCameraD3D; | |
8642 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8643 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8644 v16 = v0->fov_x; | |
8645 v0->fov_y = v15; | |
8646 //v17 = v16 + 6.7553994e15; | |
8647 LODWORD(v18) = 0; | |
8648 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8649 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8650 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8651 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8652 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8653 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8654 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8655 { | |
8656 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8657 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8658 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8659 goto LABEL_43; |
8660 } | |
8661 } | |
8662 else | |
8663 { | |
8664 v22 = p->pActorBuffs[3].uPower; | |
8665 if ( v22 ) | |
8666 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8667 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8668 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8669 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8670 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8671 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8672 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8673 goto LABEL_44; |
8674 } | |
8675 } | |
8676 LABEL_44: | |
8677 HIWORD(v25) = HIWORD(x); | |
430 | 8678 v0->world_x = a1a; |
8679 v0->world_y = a2; | |
8680 v0->world_z = a3; | |
0 | 8681 v0->uScreenSpaceX = v43; |
8682 v0->uScreenSpaceY = a6; | |
8683 LOWORD(v25) = 0; | |
8684 LOBYTE(v26) = v41; | |
194 | 8685 |
862 | 8686 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8687 v0->actual_z = HIWORD(x); |
862 | 8688 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8689 |
0 | 8690 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8691 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8692 v0->field_1E = v41; | |
8693 v0->pSpriteFrame = v10; | |
8694 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8695 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8696 { | |
8697 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8698 v0->field_1E = v26; | |
8699 } | |
8700 | |
8701 _continue: | |
8702 ; | |
8703 } | |
8704 } | |
8705 | |
8706 //----- (00444732) -------------------------------------------------------- | |
428 | 8707 char *GetEventHintString(unsigned int uEventID) |
8708 { | |
8709 signed int event_index; // edx@1 | |
8710 int event_pos; // esi@4 | |
0 | 8711 char *result; // eax@6 |
428 | 8712 unsigned int str_index; // eax@9 |
8713 int i; // esi@11 | |
8714 _evt_raw* test_evt; | |
8715 _evt_raw* last_evt; | |
8716 | |
8717 event_index = 0; | |
8718 if ( uLevelEVT_NumEvents <= 0 ) | |
8719 return NULL; | |
8720 | |
8721 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 8722 while ( 1 ) |
8723 { | |
428 | 8724 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
8725 { | |
8726 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
8727 last_evt=test_evt; | |
8728 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
8729 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 8730 break; |
8731 } | |
428 | 8732 ++event_index; |
8733 if ( event_index >= uLevelEVT_NumEvents ) | |
8734 return NULL; | |
8735 } | |
8736 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8737 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
8738 { | |
8739 str_index = EVT_DWORD(test_evt->v5); | |
8740 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 8741 } |
8742 else | |
8743 { | |
428 | 8744 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
8745 { | |
8746 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
8747 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8748 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
8749 { | |
8750 str_index = EVT_DWORD(test_evt->v5); | |
8751 if ( str_index < 600 ) | |
8752 return (char *)p2DEvents[str_index - 1].pName; | |
8753 } | |
8754 } | |
8755 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
8756 } | |
8757 | |
0 | 8758 return result; |
8759 } |