Mercurial > mm7
annotate mm7_4.cpp @ 1267:33e360a9b4bf
some fixes in normals
author | Gloval |
---|---|
date | Thu, 13 Jun 2013 23:41:42 +0400 |
parents | 0aeac0b9ca30 |
children | 7569c88d9cb0 8a196c858180 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
198 | 5 #include <assert.h> |
0 | 6 |
1262 | 7 #include "Texture.h" |
8 #include "mm7_data.h" | |
1016 | 9 #include "VideoPlayer.h" |
10 #include "Sprites.h" | |
11 #include "BSPModel.h" | |
12 #include "OutdoorCamera.h" | |
13 #include "Mouse.h" | |
14 #include "stru6.h" | |
15 #include "stru11.h" | |
16 #include "stru12.h" | |
17 | |
18 #include "LightmapBuilder.h" | |
341 | 19 #include "MM7.h" |
0 | 20 #include "MapInfo.h" |
21 #include "Game.h" | |
22 #include "GUIWindow.h" | |
23 #include "GUIFont.h" | |
24 #include "Party.h" | |
25 #include "AudioPlayer.h" | |
26 #include "Outdoor.h" | |
27 #include "IndoorCamera.h" | |
28 #include "LOD.h" | |
29 #include "Actor.h" | |
30 #include "Allocator.h" | |
31 #include "Events.h" | |
32 #include "Viewport.h" | |
33 #include "FrameTableInc.h" | |
34 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
35 #include "SpriteObject.h" |
0 | 36 #include "ObjectList.h" |
37 #include "DecorationList.h" | |
38 #include "Time.h" | |
39 #include "IconFrameTable.h" | |
40 #include "PlayerFrameTable.h" | |
41 #include "Awards.h" | |
42 #include "TurnEngine.h" | |
43 #include "Events2D.h" | |
44 #include "stru159.h" | |
189 | 45 #include "texts.h" |
0 | 46 #include "Log.h" |
629 | 47 #include "UIHouses.h" |
1262 | 48 #include "Lights.h" |
0 | 49 |
50 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 51 void __cdecl check_event_triggers() |
0 | 52 { |
53 int v0; // eax@1 | |
54 LevelDecoration *v1; // esi@2 | |
55 signed int v2; // edi@2 | |
56 int v3; // ebx@2 | |
57 int v4; // eax@3 | |
58 int v5; // ebx@3 | |
59 unsigned int v6; // ecx@3 | |
60 unsigned int v7; // edx@6 | |
61 unsigned int v8; // edx@8 | |
112 | 62 Actor *v9; // edi@13 |
0 | 63 int v10; // ebx@14 |
64 int v11; // eax@14 | |
65 int v12; // ebx@14 | |
66 unsigned int v13; // ecx@14 | |
67 int v14; // edx@15 | |
68 unsigned int v15; // edx@17 | |
69 unsigned int v16; // edx@19 | |
70 char *v17; // edi@25 | |
71 int v18; // ebx@26 | |
72 int v19; // eax@26 | |
73 int v20; // ebx@26 | |
74 unsigned int v21; // ecx@26 | |
75 int v22; // edx@27 | |
76 unsigned int v23; // edx@29 | |
77 unsigned int v24; // edx@31 | |
78 int v25; // [sp+0h] [bp-24h]@3 | |
79 int v26; // [sp+0h] [bp-24h]@14 | |
80 int v27; // [sp+0h] [bp-24h]@26 | |
81 int v28; // [sp+4h] [bp-20h]@3 | |
82 int v29; // [sp+4h] [bp-20h]@14 | |
83 int v30; // [sp+4h] [bp-20h]@26 | |
84 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
85 int v32; // [sp+Ch] [bp-18h]@2 | |
86 int v33; // [sp+10h] [bp-14h]@2 | |
87 int i; // [sp+14h] [bp-10h]@1 | |
88 int v35; // [sp+18h] [bp-Ch]@2 | |
89 int v36; // [sp+1Ch] [bp-8h]@3 | |
90 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
91 signed int v38; // [sp+20h] [bp-4h]@24 | |
92 | |
93 v0 = 0; | |
94 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
95 { | |
96 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
97 v2 = v1->field_18; | |
98 v3 = v1->vPosition.y; | |
99 v33 = v1->vPosition.x; | |
100 v32 = v1->vPosition.y; | |
101 v35 = v1->vPosition.z; | |
102 v31 = v1->field_18; | |
103 if ( v1->field_2 & 1 ) | |
104 { | |
105 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
106 v25 = abs(v3 - pParty->vPosition.y); | |
107 v28 = abs(v35 - pParty->vPosition.z); | |
108 v4 = v36; | |
109 v5 = v25; | |
110 v6 = v28; | |
111 if ( v36 < v25 ) | |
112 { | |
113 v4 = v25; | |
114 v5 = v36; | |
115 } | |
116 if ( v4 < v28 ) | |
117 { | |
118 v7 = v4; | |
119 v4 = v28; | |
120 v6 = v7; | |
121 } | |
122 if ( v5 < (signed int)v6 ) | |
123 { | |
124 v8 = v6; | |
125 v6 = v5; | |
126 v5 = v8; | |
127 } | |
128 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 129 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 130 } |
131 if ( v1->field_2 & 2 ) | |
132 { | |
133 v37 = 0; | |
134 if ( (signed int)uNumActors > 0 ) | |
135 { | |
1202 | 136 v9 = pActors.data();//[0].vPosition.y; |
0 | 137 do |
138 { | |
112 | 139 v10 = abs(v33 - v9->vPosition.x); |
140 v29 = abs(v32 - v9->vPosition.y); | |
141 v26 = abs(v35 - v9->vPosition.z); | |
0 | 142 v11 = v10; |
143 v12 = v29; | |
144 v13 = v26; | |
145 if ( v11 < v29 ) | |
146 { | |
147 v14 = v11; | |
148 v11 = v29; | |
149 v12 = v14; | |
150 } | |
151 if ( v11 < v26 ) | |
152 { | |
153 v15 = v11; | |
154 v11 = v26; | |
155 v13 = v15; | |
156 } | |
157 if ( v12 < (signed int)v13 ) | |
158 { | |
159 v16 = v13; | |
160 v13 = v12; | |
161 v12 = v16; | |
162 } | |
163 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
164 EventProcessor(v1->field_16_event_id, 0, 1); | |
165 ++v37; | |
112 | 166 ++v9; |
0 | 167 } |
168 while ( v37 < (signed int)uNumActors ); | |
169 } | |
170 } | |
171 if ( v1->field_2 & 4 ) | |
172 { | |
173 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
174 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
175 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
176 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 177 do |
178 { | |
179 v18 = abs(v33 - *((int *)v17 - 1)); | |
180 v30 = abs(v32 - *(int *)v17); | |
181 v27 = abs(v35 - *((int *)v17 + 1)); | |
182 v19 = v18; | |
183 v20 = v30; | |
184 v21 = v27; | |
185 if ( v19 < v30 ) | |
186 { | |
187 v22 = v19; | |
188 v19 = v30; | |
189 v20 = v22; | |
190 } | |
191 if ( v19 < v27 ) | |
192 { | |
193 v23 = v19; | |
194 v19 = v27; | |
195 v21 = v23; | |
196 } | |
197 if ( v20 < (signed int)v21 ) | |
198 { | |
199 v24 = v21; | |
200 v21 = v20; | |
201 v20 = v24; | |
202 } | |
203 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
204 EventProcessor(v1->field_16_event_id, 0, 1); | |
205 ++v38; | |
206 v17 += 112; | |
207 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
208 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 209 } |
210 } | |
211 v0 = i + 1; | |
212 } | |
213 } | |
214 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
215 | |
216 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 217 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 218 { |
219 int v13; // ecx@13 | |
220 signed int v14; // ebx@14 | |
221 int v15; // eax@16 | |
729 | 222 //int v16; // edx@19 |
792 | 223 //int v17; // ST18_4@19 |
224 //signed int v18; // edx@19 | |
225 //signed __int64 v19; // qtt@19 | |
0 | 226 int v21; // eax@27 |
792 | 227 //int v22; // ecx@29 |
0 | 228 signed int v28; // eax@45 |
229 int v29; // ebx@47 | |
230 int v30; // edx@49 | |
830 | 231 //int v31; // ST10_4@49 |
232 //signed int v32; // edx@49 | |
0 | 233 signed __int64 v33; // qtt@49 |
830 | 234 //signed int v34; // eax@54 |
235 //signed int v35; // esi@56 | |
236 //int result; // eax@57 | |
0 | 237 int v38; // edx@62 |
792 | 238 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 239 bool v47; // [sp+24h] [bp-1Ch]@43 |
240 bool v48; // [sp+28h] [bp-18h]@10 | |
241 bool v49; // [sp+28h] [bp-18h]@41 | |
242 bool v50; // [sp+2Ch] [bp-14h]@12 | |
243 signed int v53; // [sp+30h] [bp-10h]@10 | |
244 signed int v54; // [sp+30h] [bp-10h]@41 | |
245 signed int v55; // [sp+34h] [bp-Ch]@1 | |
246 | |
730 | 247 //LOG_DECOMPILATION_WARNING(); |
248 | |
249 static int blv_floor_id[50]; // 00721200 | |
250 static int blv_floor_level[50]; // 007212C8 | |
251 | |
252 static __int16 word_721390_ys[104]; // idb | |
253 static __int16 word_721460_xs[104]; // idb | |
0 | 254 |
255 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 256 v55 = 0; |
0 | 257 for (uint i = 0; i < pSector->uNumFloors; ++i) |
258 { | |
259 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
260 if (pFloor->Clickable()) | |
261 continue; | |
262 | |
792 | 263 assert(pFloor->uNumVertices); |
0 | 264 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
265 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
266 { | |
267 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
268 { | |
730 | 269 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
270 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
271 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
272 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 273 } |
730 | 274 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
275 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
276 | |
792 | 277 v50 = word_721390_ys[0] >= y; |
0 | 278 v53 = 0; |
792 | 279 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
280 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 281 { |
282 if (v53 >= 2) | |
283 break; | |
284 | |
285 v48 = v50; | |
286 v50 = word_721390_ys[j + 1] >= y; | |
730 | 287 |
288 v13 = i; | |
792 | 289 if (v48 == v50) |
290 continue; | |
291 | |
292 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
1110 | 293 v15 = v14 | (word_721460_xs[j] < x); |
792 | 294 |
295 if (v15 == 3) | |
296 continue; | |
297 else if (!v15) | |
298 ++v53; | |
299 else | |
0 | 300 { |
792 | 301 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 302 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 303 |
304 if (res + word_721460_xs[j] >= x) | |
729 | 305 ++v53; |
0 | 306 } |
792 | 307 } |
308 | |
309 | |
0 | 310 if ( v53 == 1 ) |
311 { | |
312 if ( v55 >= 50 ) | |
313 break; | |
723 | 314 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 315 { |
725 | 316 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 317 } |
318 else | |
319 { | |
871 | 320 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 321 } |
792 | 322 blv_floor_level[v55] = v21; |
323 blv_floor_id[v55] = pSector->pFloors[i]; | |
324 v55++; | |
0 | 325 } |
792 | 326 } |
327 } | |
328 | |
329 | |
0 | 330 if ( pSector->field_0 & 8 ) |
331 { | |
332 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
333 { | |
334 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
335 if (portal->uPolygonType != POLYGON_Floor) | |
336 continue; | |
337 | |
830 | 338 if (!portal->uNumVertices) |
339 continue; | |
340 | |
723 | 341 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
342 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
343 { | |
0 | 344 for (uint j = 0; j < portal->uNumVertices; ++j) |
345 { | |
730 | 346 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
347 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
348 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
349 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
350 } | |
351 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
352 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 353 v54 = 0; |
830 | 354 v47 = word_721390_ys[0] >= y; |
355 | |
356 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 357 { |
830 | 358 v49 = v47; |
0 | 359 if ( v54 >= 2 ) |
360 break; | |
830 | 361 v47 = word_721390_ys[j + 1] >= y; |
0 | 362 if ( v49 != v47 ) |
363 { | |
830 | 364 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
365 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 366 if ( v29 != 3 ) |
367 { | |
723 | 368 if ( !v29 ) |
729 | 369 ++v54; |
370 else | |
371 { | |
830 | 372 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 373 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 374 if (res + word_721460_xs[j] >= x) |
723 | 375 ++v54; |
729 | 376 } |
0 | 377 } |
378 } | |
379 } | |
380 if ( v54 == 1 ) | |
381 { | |
382 if ( v55 >= 50 ) | |
383 break; | |
830 | 384 blv_floor_level[v55] = -29000; |
385 blv_floor_id[v55] = pSector->pPortals[i]; | |
386 v55++; | |
0 | 387 } |
388 } | |
389 } | |
390 } | |
391 if ( v55 == 1 ) | |
392 { | |
730 | 393 *pFaceID = blv_floor_id[0]; |
725 | 394 return blv_floor_level[0]; |
0 | 395 } |
396 if ( !v55 ) | |
397 return -30000; | |
730 | 398 *pFaceID = blv_floor_id[0]; |
725 | 399 //result = blv_floor_level[0]; |
830 | 400 |
401 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 402 { |
725 | 403 if ( blv_floor_level[0] <= z + 5 ) |
404 { | |
405 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 406 continue; |
725 | 407 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 408 *pFaceID = blv_floor_id[v35]; |
717 | 409 continue; |
410 } | |
725 | 411 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
412 { | |
413 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 414 *pFaceID = blv_floor_id[v35]; |
717 | 415 } |
830 | 416 }*/ |
417 | |
418 | |
419 int result = blv_floor_level[0]; | |
420 for (uint i = 1; i < v55; ++i) | |
421 { | |
422 v38 = blv_floor_level[i]; | |
423 if ( result <= z + 5 ) | |
424 { | |
425 if ( v38 > result && v38 <= z + 5 ) | |
426 { | |
427 result = blv_floor_level[i]; | |
428 *pFaceID = blv_floor_id[i]; | |
429 } | |
430 } | |
431 else if ( v38 < result ) | |
432 { | |
433 result = blv_floor_level[i]; | |
434 *pFaceID = blv_floor_id[i]; | |
435 } | |
436 } | |
437 | |
438 return result; | |
0 | 439 } |
440 | |
441 //----- (0046D49E) -------------------------------------------------------- | |
791 | 442 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 443 { |
723 | 444 BSPModel *pBModel; // esi@4 |
445 ODMFace *pFace; // ecx@11 | |
0 | 446 int v14; // edx@20 |
447 signed int v18; // edx@26 | |
448 int v19; // eax@28 | |
449 int v20; // edx@30 | |
450 int v21; // ST1C_4@30 | |
451 signed int v22; // edx@30 | |
452 signed __int64 v23; // qtt@30 | |
453 int v24; // eax@36 | |
454 signed int v25; // ecx@38 | |
455 int result; // eax@42 | |
456 signed int v27; // ecx@43 | |
457 int v28; // edi@44 | |
458 signed int v29; // edx@44 | |
459 int v30; // esi@45 | |
460 int v31; // eax@45 | |
461 ODMFace *v32; // eax@57 | |
462 int v33; // ecx@59 | |
463 int v36; // [sp+14h] [bp-2Ch]@24 | |
464 int v38; // [sp+1Ch] [bp-24h]@2 | |
465 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 466 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
467 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 468 bool v43; // [sp+30h] [bp-10h]@22 |
469 bool v44; // [sp+34h] [bp-Ch]@24 | |
470 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
471 signed int v48; // [sp+58h] [bp+18h]@22 | |
472 signed int v49; // [sp+58h] [bp+18h]@43 | |
473 | |
474 v46 = 1; | |
475 dword_721160[0] = -1; | |
476 dword_721110[0] = -1; | |
791 | 477 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
1267 | 478 |
479 for ( pBModelNum = 0; pBModelNum < pOutdoor->uNumBModels; ++pBModelNum ) | |
480 { | |
481 pBModel = &pOutdoor->pBModels[pBModelNum]; | |
482 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && | |
483 Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
484 { | |
485 if ( pBModel->uNumFaces > 0 ) | |
723 | 486 { |
487 v39 = 0; | |
488 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
489 { | |
1267 | 490 pFace = &pBModel->pFaces[pFaceNum]; |
723 | 491 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) |
492 && !(pFace->uAttributes & 0x20000000) | |
493 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
494 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 495 { |
1267 | 496 |
723 | 497 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 498 { |
723 | 499 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
500 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
501 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
502 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
503 } | |
504 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
505 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
506 v43 = word_720F70[0] >= Y; | |
507 v48 = 0; | |
508 if ( 2 * pFace->uNumVertices > 0 ) | |
509 { | |
510 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
511 { | |
512 if ( v48 >= 2 ) | |
513 break; | |
514 v36 = word_720F70[i + 1]; | |
515 v44 = word_720F70[i + 1] >= Y; | |
516 if ( v43 != v44 ) | |
0 | 517 { |
723 | 518 v18 = word_721040[i + 1] >= X ? 0 : 2; |
1110 | 519 v19 = v18 | (word_721040[i] < X); |
723 | 520 if ( v19 != 3 ) |
0 | 521 { |
723 | 522 if ( !v19 ) |
740 | 523 ++v48; |
524 else | |
0 | 525 { |
723 | 526 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
527 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
528 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
529 if ( v22 >= X) | |
530 ++v48; | |
0 | 531 } |
532 } | |
533 } | |
723 | 534 v43 = v44; |
535 } | |
536 if ( v48 == 1 ) | |
537 { | |
538 if ( v46 >= 20 ) | |
0 | 539 break; |
723 | 540 if ( pFace->uPolygonType == POLYGON_Floor ) |
541 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
542 else | |
725 | 543 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
544 + HIWORD(pFace->zCalc3); | |
723 | 545 v25 = v46++; |
725 | 546 odm_floor_level[v25] = v24; |
723 | 547 dword_721160[v25] = pBModelNum; |
548 dword_721110[v25] = pFaceNum; | |
0 | 549 } |
550 } | |
551 } | |
1267 | 552 |
723 | 553 } |
554 } | |
555 } | |
0 | 556 } |
557 if ( v46 == 1 ) | |
558 { | |
559 *a6 = 0; | |
725 | 560 return odm_floor_level[0]; |
0 | 561 } |
562 v27 = 0; | |
563 if ( v46 <= 1 ) | |
564 *a6 = 0; | |
723 | 565 else |
566 { | |
725 | 567 //v29 = 1; |
723 | 568 for ( v49 = 1; v49 < v46; ++v49 ) |
569 { | |
725 | 570 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 571 { |
572 v27 = v49; | |
725 | 573 //++v29; |
723 | 574 break; |
575 } | |
725 | 576 if ( odm_floor_level[0] > Z + 5 ) |
577 { | |
578 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
579 { | |
580 //++v29; | |
723 | 581 break; |
582 } | |
583 v27 = v49; | |
725 | 584 //++v29; |
723 | 585 break; |
586 } | |
725 | 587 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 588 { |
589 v27 = v49; | |
725 | 590 //++v29; |
723 | 591 } |
592 } | |
593 if ( !v27 ) | |
594 *a6 = 0; | |
595 else | |
596 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
597 } | |
0 | 598 if ( v27 ) |
599 { | |
600 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 601 *pIsOnWater = false; |
602 if ( v32->Fluid()) | |
603 *pIsOnWater = true; | |
0 | 604 } |
725 | 605 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
606 odm_floor_level[0] = odm_floor_level[v27]; | |
607 return odm_floor_level[0]; | |
0 | 608 } |
609 | |
610 //----- (0046D8E3) -------------------------------------------------------- | |
611 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
612 { | |
613 int v4; // ebx@1 | |
614 unsigned int v5; // ecx@1 | |
615 BSPModel *v6; // edi@3 | |
616 ODMFace *v7; // esi@10 | |
617 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
618 signed __int16 *v9; // eax@18 |
0 | 619 int v10; // edx@19 |
620 int v11; // ecx@21 | |
621 int v12; // ecx@23 | |
622 signed int v13; // eax@25 | |
623 int v14; // edx@27 | |
624 int v15; // edx@29 | |
625 int v16; // ST18_4@29 | |
626 signed int v17; // edx@29 | |
627 signed __int64 v18; // qtt@29 | |
628 int v19; // eax@35 | |
629 signed int v20; // ecx@37 | |
630 signed int v22; // ebx@42 | |
631 unsigned int v23; // esi@43 | |
632 int v24; // edx@44 | |
633 int v25; // eax@44 | |
634 int v26; // [sp+Ch] [bp-38h]@7 | |
635 int v27; // [sp+10h] [bp-34h]@21 | |
636 int v28; // [sp+18h] [bp-2Ch]@21 | |
637 int v29; // [sp+1Ch] [bp-28h]@2 | |
638 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
639 signed int v31; // [sp+24h] [bp-20h]@1 | |
640 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
641 int v33; // [sp+2Ch] [bp-18h]@7 | |
642 bool v34; // [sp+30h] [bp-14h]@21 | |
643 bool v35; // [sp+34h] [bp-10h]@23 | |
644 signed int v36; // [sp+38h] [bp-Ch]@17 | |
645 signed int v37; // [sp+38h] [bp-Ch]@21 | |
646 signed int v38; // [sp+38h] [bp-Ch]@42 | |
647 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
648 signed int v40; // [sp+40h] [bp-4h]@1 | |
649 | |
650 dword_720ED0[0] = -1; | |
651 dword_720E80[0] = -1; | |
652 v4 = a1; | |
653 v5 = 0; | |
654 v40 = a2; | |
655 v31 = v4; | |
656 v39 = 1; | |
657 dword_720F20[0] = 10000; | |
658 v32 = 0; | |
659 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
660 { | |
661 v29 = 0; | |
662 do | |
663 { | |
664 v6 = &pOutdoor->pBModels[v29]; | |
665 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
666 { | |
667 if ( v4 >= v6->sMinX ) | |
668 { | |
669 if ( v40 <= v6->sMaxY ) | |
670 { | |
671 if ( v40 >= v6->sMinY ) | |
672 { | |
673 v33 = v5; | |
674 v26 = v6->uNumFaces; | |
675 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
676 { | |
677 v30 = v5; | |
678 while ( 1 ) | |
679 { | |
680 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
681 v8 = v7->uPolygonType; | |
682 if ( (v8 == 5 || v8 == 6) | |
683 && !(BYTE3(v7->uAttributes) & 0x20) | |
684 && v4 <= v7->pBoundingBox.x2 | |
685 && v4 >= v7->pBoundingBox.x1 | |
686 && v40 <= v7->pBoundingBox.y2 | |
687 && v40 >= v7->pBoundingBox.y1 ) | |
688 { | |
689 v36 = v5; | |
690 if ( v7->uNumVertices ) | |
691 { | |
692 v9 = v7->pXInterceptDisplacements; | |
693 do | |
694 { | |
695 v10 = 2 * v36; | |
696 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
697 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
698 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
699 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
700 ++v9; | |
701 } | |
702 while ( v36 < v7->uNumVertices ); | |
703 v4 = v31; | |
704 } | |
705 v27 = 2 * v7->uNumVertices; | |
706 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
707 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
708 v11 = 0; | |
709 v34 = word_720CE0_ys[0] >= v40; | |
710 v37 = 0; | |
711 v28 = 0; | |
712 if ( v27 > 0 ) | |
713 { | |
714 do | |
715 { | |
716 if ( v37 >= 2 ) | |
717 break; | |
718 v12 = v11; | |
719 v4 = v31; | |
720 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
721 if ( v34 != v35 ) | |
722 { | |
723 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
1110 | 724 v14 = v13 | (word_720DB0_xs[v12] < v31); |
0 | 725 if ( v14 != 3 ) |
726 { | |
727 if ( !v14 | |
728 || (v15 = word_720CE0_ys[v12], | |
729 v16 = word_720CE0_ys[v12 + 1] - v15, | |
730 v17 = v40 - v15, | |
731 LODWORD(v18) = v17 << 16, | |
732 HIDWORD(v18) = v17 >> 16, | |
733 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
734 - (signed int)word_720DB0_xs[v12]) | |
735 * v18 | |
736 / v16) >> 16) | |
737 + word_720DB0_xs[v12]) >= v31) ) | |
738 ++v37; | |
739 } | |
740 } | |
741 v11 = v28 + 1; | |
742 v34 = v35; | |
743 ++v28; | |
744 } | |
745 while ( v28 < v27 ); | |
746 if ( v37 == 1 ) | |
747 { | |
748 if ( v39 >= 20 ) | |
749 break; | |
750 if ( v7->uPolygonType == 5 ) | |
751 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
752 else | |
753 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
754 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
755 + HIWORD(v7->zCalc3); | |
756 v20 = v39++; | |
757 dword_720F20[v20] = v19; | |
758 dword_720ED0[v20] = v32; | |
759 dword_720E80[v20] = v33; | |
760 } | |
761 } | |
762 } | |
763 ++v33; | |
764 v30 += 308; | |
765 if ( v33 >= v26 ) | |
766 break; | |
767 v5 = 0; | |
768 } | |
769 } | |
770 } | |
771 } | |
772 } | |
773 } | |
774 ++v32; | |
775 ++v29; | |
776 v5 = 0; | |
777 } | |
778 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
779 if ( !v39 ) | |
780 { | |
781 *(int *)a4 = 0; | |
782 return dword_720F20[0]; | |
783 } | |
784 } | |
785 v22 = 0; | |
786 v38 = v5; | |
787 if ( v39 <= (signed int)v5 ) | |
788 goto LABEL_54; | |
789 v23 = 0; | |
790 do | |
791 { | |
792 v24 = dword_720F20[v5 / 4]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
793 v25 = *(int *)((char *)dword_720F20.data() + v23); |
0 | 794 if ( v24 == v25 ) |
795 goto LABEL_50; | |
796 if ( v25 > a3 + 15 ) | |
797 { | |
798 if ( v24 >= v25 ) | |
799 goto LABEL_51; | |
800 LABEL_50: | |
801 v22 = v38; | |
802 v23 = v5; | |
803 goto LABEL_51; | |
804 } | |
805 if ( v24 > v25 && v24 <= a3 + 15 ) | |
806 goto LABEL_50; | |
807 LABEL_51: | |
808 ++v38; | |
809 v5 += 4; | |
810 } | |
811 while ( v38 < v39 ); | |
812 if ( v22 ) | |
813 { | |
814 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
815 return dword_720F20[v22]; | |
816 } | |
817 LABEL_54: | |
818 *(int *)a4 = 0; | |
819 return dword_720F20[v22]; | |
820 } | |
821 | |
138 | 822 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
823 // for a right-handed system, that would be an inverse normal | |
0 | 824 //----- (0046DCC8) -------------------------------------------------------- |
138 | 825 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
826 { | |
827 auto grid_x = WorldPosToGridCellX(pos_x); | |
828 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
829 | |
830 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
831 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
832 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
833 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
834 | |
835 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
836 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
837 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
838 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
839 | |
840 float side1_dx, side1_dy, side1_dz, | |
841 side2_dx, side2_dy, side2_dz; | |
842 | |
843 auto dx = abs(pos_x - grid_pos_x1), | |
844 dz = abs(grid_pos_z1 - pos_z); | |
845 if (dz >= dx) | |
846 { | |
847 side1_dy = (double)(x1z1_y - x1z2_y); | |
848 side2_dy = (double)(x2z2_y - x1z2_y); | |
849 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
1267 | 850 side1_dx = (double)(grid_pos_x1 - grid_pos_x2); |
851 side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
852 side1_dz = (double)(grid_pos_z1 - grid_pos_z2); // z1 - z2 yes | |
853 //Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); | |
138 | 854 /* |\ |
855 side1 | \ | |
856 |____\ | |
857 side 2 */ | |
858 } | |
859 else | |
860 { | |
861 side1_dy = (double)(x2z2_y - x2z1_y); | |
862 side2_dy = (double)(x1z1_y - x2z1_y); | |
863 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
1267 | 864 side1_dx = (double)(grid_pos_x2 - grid_pos_x1); |
865 side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1); | |
138 | 866 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); |
867 | |
868 /* side 2 | |
869 _____ | |
870 \ | | |
871 \ | side 1 | |
872 \| */ | |
873 } | |
874 | |
875 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
876 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
877 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
878 | |
879 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
880 if (fabsf(mag) < 1e-6f) | |
881 { | |
882 out->y = 0; | |
883 out->x = 0; | |
884 out->z = 65536; | |
885 } | |
886 else | |
887 { | |
888 float invmag = 1.0 / mag; | |
889 out->x = invmag * nx * 65536.0; | |
890 out->y = invmag * ny * 65536.0; | |
891 out->z = invmag * nz * 65536.0; | |
892 } | |
893 } | |
894 | |
0 | 895 //----- (0046DEF2) -------------------------------------------------------- |
896 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
897 { | |
898 unsigned int result; // eax@1 | |
899 | |
900 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
901 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 902 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
903 return result; | |
904 } | |
905 | |
906 //----- (0046DF1A) -------------------------------------------------------- | |
907 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
908 { | |
909 Actor *v2; // edi@1 | |
910 unsigned __int16 v3; // ax@1 | |
911 int v4; // esi@6 | |
912 int v5; // ecx@8 | |
913 int v6; // eax@10 | |
914 int v7; // edx@12 | |
915 int v8; // ecx@14 | |
916 int v9; // eax@14 | |
917 int v10; // ebx@14 | |
918 int v11; // esi@14 | |
919 int v12; // ebx@15 | |
920 int v13; // ebx@17 | |
921 unsigned int v14; // eax@20 | |
922 signed int result; // eax@21 | |
923 int v16; // [sp+Ch] [bp-10h]@1 | |
924 int v17; // [sp+10h] [bp-Ch]@14 | |
925 int v18; // [sp+14h] [bp-8h]@14 | |
926 int v19; // [sp+18h] [bp-4h]@14 | |
927 | |
928 v16 = a1; | |
929 v2 = &pActors[a1]; | |
930 v3 = v2->uAIState; | |
931 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
932 goto LABEL_25; | |
933 v4 = v2->uActorRadius; | |
934 if ( a2 ) | |
935 v4 = a2; | |
936 v5 = v2->vPosition.x; | |
937 if ( stru_721530.sMaxX > v5 + v4 | |
938 || stru_721530.sMinX < v5 - v4 | |
939 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
940 || stru_721530.sMinY < v6 - v4 | |
941 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
942 || stru_721530.sMinZ < v7 | |
943 || (v8 = v5 - stru_721530.normal.x, | |
944 v9 = v6 - stru_721530.normal.y, | |
945 v10 = stru_721530.prolly_normal_d + v4, | |
946 v17 = stru_721530.prolly_normal_d + v4, | |
947 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
948 v18 = v8, | |
949 v19 = v9, | |
950 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
951 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
952 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
953 { | |
954 LABEL_25: | |
955 result = 0; | |
956 } | |
957 else | |
958 { | |
295 | 959 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 960 if ( v13 < 0 ) |
961 v13 = 0; | |
962 if ( v13 < stru_721530.field_7C ) | |
963 { | |
964 stru_721530.field_7C = v13; | |
965 v14 = 8 * v16; | |
862 | 966 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 967 stru_721530.uFaceID = v14; |
968 } | |
969 result = 1; | |
970 } | |
971 return result; | |
972 } | |
973 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
974 | |
975 //----- (0046E0B2) -------------------------------------------------------- | |
976 void __cdecl _46E0B2_collide_against_decorations() | |
977 { | |
978 BLVSector *v0; // ebp@1 | |
979 LevelDecoration *v1; // edi@2 | |
980 DecorationDesc *v2; // esi@3 | |
981 int v3; // edx@4 | |
982 int v4; // eax@4 | |
983 int v5; // ecx@6 | |
984 int v6; // ebx@8 | |
985 int v7; // esi@8 | |
986 int v8; // ebx@10 | |
987 int v9; // esi@11 | |
988 int v10; // edi@12 | |
989 int v11; // eax@12 | |
990 int v12; // esi@14 | |
991 unsigned int v13; // eax@17 | |
992 signed int i; // [sp+4h] [bp-14h]@1 | |
993 int v15; // [sp+8h] [bp-10h]@10 | |
994 int v16; // [sp+Ch] [bp-Ch]@10 | |
995 int v17; // [sp+10h] [bp-8h]@10 | |
996 int v18; // [sp+14h] [bp-4h]@8 | |
997 | |
998 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
999 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1000 { | |
1001 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1002 if ( !(v1->field_2 & 0x20) ) | |
1003 { | |
1004 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1005 if (!v2->CanMoveThrough()) |
0 | 1006 { |
1007 v3 = v2->uRadius; | |
1008 v4 = v1->vPosition.x; | |
1009 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1010 { | |
1011 if ( stru_721530.sMinX >= v4 - v3 ) | |
1012 { | |
1013 v5 = v1->vPosition.y; | |
1014 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1015 { | |
1016 if ( stru_721530.sMinY >= v5 - v3 ) | |
1017 { | |
1018 v6 = v2->uDecorationHeight; | |
1019 v7 = v1->vPosition.z; | |
1020 v18 = v6; | |
1021 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1022 { | |
1023 if ( stru_721530.sMinZ >= v7 ) | |
1024 { | |
1025 v16 = v4 - stru_721530.normal.x; | |
1026 v15 = v5 - stru_721530.normal.y; | |
1027 v8 = stru_721530.prolly_normal_d + v3; | |
1028 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1029 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1030 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1031 { | |
1032 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1033 if ( v9 > 0 ) | |
1034 { | |
1035 v10 = v1->vPosition.z; | |
1036 v11 = stru_721530.normal.z | |
1037 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1038 if ( v11 >= v10 ) | |
1039 { | |
1040 if ( v11 <= v18 + v10 ) | |
1041 { | |
295 | 1042 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1043 if ( v12 < 0 ) |
1044 v12 = 0; | |
1045 if ( v12 < stru_721530.field_7C ) | |
1046 { | |
1047 stru_721530.field_7C = v12; | |
1048 v13 = 8 * v0->pDecorationIDs[i]; | |
1049 LOBYTE(v13) = v13 | 5; | |
1050 stru_721530.uFaceID = v13; | |
1051 } | |
1052 } | |
1053 } | |
1054 } | |
1055 } | |
1056 } | |
1057 } | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 | |
1067 //----- (0046E26D) -------------------------------------------------------- | |
1068 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1069 { | |
1070 int v2; // edx@5 | |
1071 unsigned __int16 *v3; // eax@5 | |
1072 unsigned __int16 v4; // ax@6 | |
1073 LevelDecoration *v5; // edi@7 | |
1074 DecorationDesc *v6; // esi@8 | |
1075 int v7; // edx@9 | |
1076 int v8; // eax@9 | |
1077 int v9; // ecx@11 | |
1078 int v10; // ebx@13 | |
1079 int v11; // esi@13 | |
1080 int v12; // ebp@15 | |
1081 int v13; // ebx@15 | |
1082 int v14; // esi@16 | |
1083 int v15; // edi@17 | |
1084 int v16; // eax@17 | |
1085 int v17; // esi@19 | |
1086 char v18; // zf@23 | |
1087 int v19; // [sp+0h] [bp-10h]@15 | |
1088 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1089 int v21; // [sp+8h] [bp-8h]@15 | |
1090 int v22; // [sp+Ch] [bp-4h]@13 | |
1091 | |
1092 if ( a1 >= 0 ) | |
1093 { | |
1094 if ( a1 <= 127 ) | |
1095 { | |
1096 if ( a2 >= 0 ) | |
1097 { | |
1098 if ( a2 <= 127 ) | |
1099 { | |
1100 v2 = a1 + (a2 << 7); | |
1101 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1102 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1103 if ( v3 ) | |
1104 { | |
1105 do | |
1106 { | |
1107 v4 = *v3; | |
848 | 1108 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1109 { |
1110 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1111 if ( !(v5->field_2 & 0x20) ) | |
1112 { | |
1113 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1114 if (!v6->CanMoveThrough()) |
0 | 1115 { |
1116 v7 = v6->uRadius; | |
1117 v8 = v5->vPosition.x; | |
1118 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1119 { | |
1120 if ( stru_721530.sMinX >= v8 - v7 ) | |
1121 { | |
1122 v9 = v5->vPosition.y; | |
1123 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1124 { | |
1125 if ( stru_721530.sMinY >= v9 - v7 ) | |
1126 { | |
1127 v10 = v6->uDecorationHeight; | |
1128 v11 = v5->vPosition.z; | |
1129 v22 = v10; | |
1130 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1131 { | |
1132 if ( stru_721530.sMinZ >= v11 ) | |
1133 { | |
1134 v12 = v8 - stru_721530.normal.x; | |
1135 v19 = v9 - stru_721530.normal.y; | |
1136 v13 = stru_721530.prolly_normal_d + v7; | |
1137 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1138 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1139 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1140 { | |
1141 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1142 if ( v14 > 0 ) | |
1143 { | |
1144 v15 = v5->vPosition.z; | |
1145 v16 = stru_721530.normal.z | |
1146 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1147 if ( v16 >= v15 ) | |
1148 { | |
1149 if ( v16 <= v22 + v15 ) | |
1150 { | |
295 | 1151 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1152 if ( v17 < 0 ) |
1153 v17 = 0; | |
1154 if ( v17 < stru_721530.field_7C ) | |
1155 { | |
1156 stru_721530.field_7C = v17; | |
1157 stru_721530.uFaceID = (signed __int16)*v20; | |
1158 } | |
1159 } | |
1160 } | |
1161 } | |
1162 } | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 } | |
1171 } | |
1172 v3 = v20 + 1; | |
1173 v18 = *v20 == 0; | |
1174 ++v20; | |
1175 } | |
1176 while ( !v18 ); | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 | |
1184 //----- (00486F92) -------------------------------------------------------- | |
1185 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1186 { | |
1187 Span *v0; // ebx@1 | |
1188 int v1; // eax@2 | |
1189 Edge *v2; // ecx@3 | |
1190 Edge *v3; // edx@3 | |
1191 Edge *v4; // esi@6 | |
1192 Edge *v5; // eax@7 | |
1193 Edge *v6; // ecx@8 | |
1194 Surf *v7; // esi@11 | |
1195 double v8; // st7@13 | |
1196 Surf *v9; // edi@13 | |
1197 double v10; // st6@13 | |
1198 double v11; // st7@14 | |
1199 signed __int64 v12; // qax@14 | |
1200 stru148 *v13; // eax@15 | |
1201 Span *v14; // ecx@17 | |
1202 double v15; // st7@28 | |
1203 signed __int64 v16; // qax@28 | |
1204 stru148 *v17; // eax@29 | |
1205 Span *v18; // ecx@31 | |
1206 Edge *i; // eax@40 | |
1207 Edge *v20; // ecx@43 | |
1208 Edge *v21; // esi@44 | |
1209 double v22; // st7@45 | |
1210 Edge *v23; // edx@48 | |
1211 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1212 float v25; // [sp+14h] [bp-Ch]@3 | |
1213 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1214 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1215 | |
1216 v0 = pSpans; | |
1217 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1218 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1219 stru_80C9A4.pSurf = &stru_80C980; |
1220 stru_80C980.pPrev = &stru_80C980; | |
1221 stru_80C980.pNext = &stru_80C980; | |
693 | 1222 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1223 stru_80C980.field_8 = 0.0; |
1224 stru_80C980.field_4 = 0.0; | |
1225 stru_80C9D8.pNext = &stru_80C9A4; | |
1226 stru_80C9D8.pPrev = 0; | |
1227 stru_80C9D8.field_8 = 1; | |
1228 stru_80C9A4.pNext = 0; | |
1229 stru_80C9A4.pPrev = &stru_80C9D8; | |
1230 stru_80C9A4.field_8 = 0; | |
1231 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1232 v27 = pViewport->uViewportTL_Y; |
1233 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1234 { |
1235 LABEL_51: | |
1236 v0->field_8 = -1; | |
1237 } | |
1238 else | |
1239 { | |
693 | 1240 v1 = 52 * pViewport->uViewportTL_Y; |
1241 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1242 while ( 1 ) |
1243 { | |
1244 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1245 v3 = &stru_80C9D8; | |
1246 v25 = (double)(signed int)v27; | |
1247 if ( v2 != &defaultEdge ) | |
1248 { | |
1249 do | |
1250 { | |
1251 while ( 1 ) | |
1252 { | |
1253 v4 = v3->pNext; | |
1254 if ( v2->field_0 <= (double)v4->field_0 ) | |
1255 break; | |
1256 v3 = v3->pNext; | |
1257 } | |
1258 v5 = v2->pNext; | |
1259 v2->pNext = v4; | |
1260 v2->pPrev = v3; | |
1261 v3->pNext->pPrev = v2; | |
1262 v3->pNext = v2; | |
1263 v3 = v2; | |
1264 v2 = v5; | |
1265 } | |
1266 while ( v5 != &defaultEdge ); | |
1267 } | |
1268 v6 = stru_80C9D8.pNext; | |
1269 stru_80C980.field_20 = 0; | |
1270 stru_80C980.field_22 = 1; | |
1271 v26 = stru_80C9D8.pNext; | |
1272 if ( stru_80C9D8.pNext ) | |
1273 { | |
1274 while ( 1 ) | |
1275 { | |
1276 v7 = v6->pSurf; | |
1277 if ( v6->field_8 ) | |
1278 { | |
1279 ++v7->field_22; | |
1280 if ( v7->field_22 == 1 ) | |
1281 { | |
1282 v8 = v6->field_0 + 2.0; | |
1283 v9 = stru_80C980.pNext; | |
1284 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1285 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1286 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1287 + stru_80C980.pNext->field_0 ) | |
1288 { | |
1289 do | |
1290 v9 = v9->pNext; | |
1291 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1292 v7->pNext = v9; | |
1293 v7->pPrev = v9->pPrev; | |
1294 v9->pPrev->pNext = v7; | |
1295 v9->pPrev = v7; | |
1296 } | |
1297 else | |
1298 { | |
1299 v11 = v6->field_0 + 0.5; | |
1300 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1301 v0->field_C = v12; | |
1302 if ( (signed __int16)v12 > 0 ) | |
1303 { | |
1304 v0->field_A = v27; | |
1305 v0->field_8 = v9->field_20; | |
1306 v13 = v9->pParent; | |
1307 v0->pParent = v13; | |
1308 if ( v13 ) | |
1309 { | |
1310 if ( v13->prolly_head ) | |
1311 { | |
1312 v14 = v13->prolly_tail; | |
1313 if ( !v14 ) | |
1314 return; | |
1315 v14->pNext = v0; | |
1316 } | |
1317 else | |
1318 { | |
1319 v13->prolly_head = v0; | |
1320 } | |
1321 v13->prolly_tail = v0; | |
1322 } | |
1323 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1324 return; | |
1325 ++v0; | |
1326 ++pOutdoorCamera->uNumSpans; | |
1327 } | |
1328 v6 = v26; | |
1329 v7->field_20 = (signed __int64)v11; | |
1330 v7->pNext = v9; | |
1331 v9->pPrev = v7; | |
1332 stru_80C980.pNext = v7; | |
1333 v7->pPrev = &stru_80C980; | |
1334 } | |
1335 } | |
1336 } | |
1337 else | |
1338 { | |
1339 --v7->field_22; | |
1340 if ( !v7->field_22 ) | |
1341 { | |
1342 if ( stru_80C980.pNext == v7 ) | |
1343 { | |
1344 v15 = v6->field_0 + 0.5; | |
1345 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1346 v0->field_C = v16; | |
1347 if ( (signed __int16)v16 > 0 ) | |
1348 { | |
1349 v0->field_A = v27; | |
1350 v0->field_8 = v7->field_20; | |
1351 v17 = v7->pParent; | |
1352 v0->pParent = v17; | |
1353 if ( v17 ) | |
1354 { | |
1355 if ( v17->prolly_head ) | |
1356 { | |
1357 v18 = v17->prolly_tail; | |
1358 if ( !v18 ) | |
1359 return; | |
1360 v18->pNext = v0; | |
1361 } | |
1362 else | |
1363 { | |
1364 v17->prolly_head = v0; | |
1365 } | |
1366 v17->prolly_tail = v0; | |
1367 } | |
1368 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1369 return; | |
1370 ++v0; | |
1371 ++pOutdoorCamera->uNumSpans; | |
1372 } | |
1373 v7->pNext->field_20 = (signed __int64)v15; | |
1374 v6 = v26; | |
1375 } | |
1376 v7->pNext->pPrev = v7->pPrev; | |
1377 v7->pPrev->pNext = v7->pNext; | |
1378 } | |
1379 } | |
1380 v26 = v6->pNext; | |
1381 if ( !v26 ) | |
1382 break; | |
1383 v6 = v6->pNext; | |
1384 } | |
1385 } | |
1386 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1387 { | |
1388 i->pPrev->pNext = i->pNext; | |
1389 i->pNext->pPrev = i->pPrev; | |
1390 } | |
1391 v20 = stru_80C9D8.pNext; | |
1392 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1393 break; | |
1394 LABEL_50: | |
1395 ++v27; | |
1396 v1 = v24 + 52; | |
1397 v24 += 52; | |
693 | 1398 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1399 goto LABEL_51; |
1400 } | |
1401 while ( 1 ) | |
1402 { | |
1403 v21 = v20->pNext; | |
1404 if ( !v21 ) | |
1405 break; | |
1406 v22 = v20->field_4 + v20->field_0; | |
1407 v20->field_0 = v22; | |
1408 if ( v22 < stru_80C9D8.field_0 ) | |
1409 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1410 while ( 1 ) | |
1411 { | |
1412 v23 = v20->pPrev; | |
1413 if ( v20->field_0 >= (double)v23->field_0 ) | |
1414 break; | |
1415 v23->pNext = v20->pNext; | |
1416 v20->pNext->pPrev = v23; | |
1417 v23->pPrev->pNext = v20; | |
1418 v20->pPrev = v23->pPrev; | |
1419 v20->pNext = v23; | |
1420 v23->pPrev = v20; | |
1421 } | |
1422 v20 = v21; | |
1423 if ( v21 == &stru_80C9A4 ) | |
1424 goto LABEL_50; | |
1425 } | |
1426 } | |
1427 } | |
1428 // 4EC3EC: using guessed type Edge defaultEdge; | |
1429 | |
1430 //----- (00487355) -------------------------------------------------------- | |
1431 bool OutdoorCamera::_487355() | |
1432 { | |
1433 int v0; // esi@1 | |
1434 stru148 *v1; // edi@2 | |
1435 bool result; // eax@3 | |
1436 | |
1437 v0 = 0; | |
1438 if ( pOutdoorCamera->numStru148s > 0 ) | |
1439 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1440 v1 = array_77EC08.data(); |
0 | 1441 do |
1442 { | |
1443 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1444 ++v0; | |
1445 ++v1; | |
1446 } | |
1447 while ( v0 < pOutdoorCamera->numStru148s ); | |
1448 } | |
1449 return result; | |
1450 } | |
1451 | |
1452 //----- (00487DA9) -------------------------------------------------------- | |
1453 void __cdecl sub_487DA9() | |
1454 { | |
1455 char *v0; // eax@1 | |
1456 | |
1457 v0 = &array_77EC08[0].field_108; | |
1458 do | |
1459 { | |
1460 *v0 = 0; | |
1461 v0 += 268; | |
1462 } | |
1463 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1464 } | |
1465 | |
1466 //----- (00487DBE) -------------------------------------------------------- | |
1467 void Software_ResetNewEdges() | |
1468 { | |
1469 int v0; // ecx@1 | |
1470 Edge **v1; // eax@1 | |
1471 signed int v2; // eax@3 | |
1472 | |
1473 v0 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1474 v1 = ptr_80CA10.data(); |
0 | 1475 do |
1476 { | |
1477 ++v0; | |
1478 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1479 *v1 = 0; | |
1480 ++v1; | |
1481 } | |
1482 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1483 v2 = 2000; | |
1484 do | |
1485 { | |
1486 pSurfs->field_22 = 0; | |
1487 --v2; | |
1488 } | |
1489 while ( v2 ); | |
1490 } | |
1491 // 4EC3EC: using guessed type Edge defaultEdge; | |
1492 | |
1493 //----- (0048958E) -------------------------------------------------------- | |
1494 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1495 { | |
1496 stru12_MemoryBlock *v2; // esi@1 | |
1497 void *v3; // eax@1 | |
1498 void *v4; // ecx@1 | |
1499 stru12_MemoryBlock *result; // eax@1 | |
1500 | |
1501 v2 = this; | |
1502 v3 = operator new(8 * a2 + 16); | |
1503 v2->pBlockBase = v3; | |
848 | 1504 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1505 result = v2; |
1506 v2->pAlignedBlock = v4; | |
1507 } | |
1508 | |
1509 //----- (004895B7) -------------------------------------------------------- | |
1510 stru12::stru12(stru11 *pStru11) | |
1511 { | |
1512 stru12 *v2; // esi@1 | |
1513 | |
1514 v2 = this; | |
1515 this->field_44 = 0x41000000u; | |
1516 this->field_4C = 0x46000000u; | |
1517 //this->vdestructor_ptr = stru12::_4898E6; | |
1518 this->field_48 = 0; | |
1519 this->field_50 = 0; | |
1520 this->field_54 = 0x33D6BF95u; | |
1521 this->field_58 = 0; | |
1522 | |
1523 for (int i = 0; i < 12; ++i) | |
1524 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1525 } | |
1526 | |
1527 //----- (00489810) -------------------------------------------------------- | |
1528 stru12::~stru12() | |
1529 { | |
1530 for (int i = 0; i < 12; ++i) | |
1531 delete pMemBlocks[i]; | |
1532 } | |
1533 | |
1534 //----- (004898BF) -------------------------------------------------------- | |
1535 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1536 { | |
1537 stru12_MemoryBlock *v2; // esi@1 | |
1538 void *v3; // ST00_4@1 | |
1539 | |
1540 v2 = this; | |
1541 v3 = this->pBlockBase; | |
1542 this->pAlignedBlock = 0; | |
1543 free(v3); | |
1544 v2->pBlockBase = 0; | |
1545 /*if ( a2 & 1 ) | |
1546 free(v2);*/ | |
1547 } | |
1548 | |
1549 //----- (004898E6) -------------------------------------------------------- | |
1550 void stru12::_4898E6() | |
1551 { | |
1552 void *v1; // eax@1 | |
1553 void *v2; // edx@1 | |
1554 char *v3; // edi@2 | |
1555 double v4; // st7@2 | |
1556 char *v5; // ebx@2 | |
1557 double v6; // st6@3 | |
1558 double v7; // st5@3 | |
1559 double v8; // st4@3 | |
1560 int v9; // esi@3 | |
1561 double v10; // st3@3 | |
1562 float v11; // ST34_4@5 | |
1563 double v12; // st6@10 | |
1564 double v13; // ST0C_8@10 | |
1565 char *v14; // [sp+14h] [bp-44h]@2 | |
1566 char *v15; // [sp+18h] [bp-40h]@2 | |
1567 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1568 char *v17; // [sp+20h] [bp-38h]@2 | |
1569 char *v18; // [sp+24h] [bp-34h]@2 | |
1570 float v19; // [sp+30h] [bp-28h]@3 | |
1571 float v20; // [sp+38h] [bp-20h]@3 | |
1572 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1573 int v22; // [sp+40h] [bp-18h]@1 | |
1574 char *v23; // [sp+44h] [bp-14h]@2 | |
1575 char *v24; // [sp+48h] [bp-10h]@2 | |
1576 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1577 float v26; // [sp+50h] [bp-8h]@3 | |
1578 float v27; // [sp+54h] [bp-4h]@3 | |
1579 | |
731 | 1580 __debugbreak(); |
0 | 1581 v22 = 0; |
1582 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1583 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1584 if ( this->field_8C > 0 ) | |
1585 { | |
1586 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1587 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1588 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1589 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1590 v25 = (int)v1 - (int)v2; | |
1591 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1592 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1593 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1594 v4 = 1.0; | |
1595 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1596 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1597 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1598 do | |
1599 { | |
1600 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1601 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1602 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1603 v7 = pIndoorCamera->fRotationYCosine; | |
1604 v8 = pIndoorCamera->fRotationYSine; | |
1605 v20 = pIndoorCamera->fRotationXCosine; | |
1606 v19 = pIndoorCamera->fRotationXSine; | |
1607 v9 = (int)((char *)v2 + (int)v21); | |
1608 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1609 if ( pIndoorCamera->sRotationX ) | |
1610 { | |
1611 v11 = v10; | |
1612 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1613 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1614 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1615 } | |
1616 else | |
1617 { | |
1618 *(float *)v9 = v10; | |
1619 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1620 *(float *)((char *)v2 + (int)v5) = v6; | |
1621 } | |
1622 if ( *(float *)v9 >= 8.0 ) | |
1623 { | |
1624 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1625 { | |
1626 *(int *)v2 = 0; | |
1627 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1628 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1629 - v12 * *(float *)((char *)v2 + (int)v3); | |
1630 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1631 - v12 * *(float *)((char *)v2 + (int)v5); | |
1632 *(float *)((char *)v2 + (int)v16) = v4 | |
1633 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1634 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1635 v13 = *(float *)v9 + 6.7553994e15; | |
1636 v4 = 1.0; | |
1637 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1638 } | |
1639 else | |
1640 { | |
1641 *(int *)v2 = 2; | |
1642 } | |
1643 } | |
1644 else | |
1645 { | |
1646 *(int *)v2 = 1; | |
1647 } | |
1648 ++v22; | |
1649 v2 = (char *)v2 + 4; | |
1650 } | |
1651 while ( v22 < this->field_8C ); | |
1652 } | |
1653 this->field_8C = 0; | |
1654 } | |
1655 | |
1656 //----- (0048A959) -------------------------------------------------------- | |
1657 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1658 { | |
1659 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1660 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1661 b = (uColor & 0x000000FF) / 255.0f; | |
1662 | |
1663 float h, s, v; | |
1664 RGB2HSV(&h, &s, r, g, b, &v); | |
1665 | |
1666 if ( h_replace != -1.0 ) | |
1667 h = h_replace; | |
1668 if ( s_replace != -1.0 ) | |
1669 s = s_replace; | |
1670 if ( v_replace != -1.0 ) | |
1671 v = v_replace; | |
1672 HSV2RGB(&r, &g, &b, h, s, v); | |
1673 | |
1674 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1675 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1676 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1677 } | |
1678 | |
1679 //----- (0048B561) -------------------------------------------------------- | |
1029 | 1680 int fixpoint_from_float(float val) |
0 | 1681 { |
1029 | 1682 // float X.Yf -> int XXXX YYYY |
1683 int left = floorf((val - 0.5f) + 0.5f); | |
1684 int right = floorf((val - left) * 65536.0f); | |
1685 return (left << 16) | right; | |
0 | 1686 } |
1687 | |
1688 //----- (00491E3A) -------------------------------------------------------- | |
1689 void __cdecl sub_491E3A() | |
1690 { | |
1691 Player *v0; // ebx@1 | |
1692 signed int v1; // esi@3 | |
1693 char *v2; // eax@4 | |
1694 unsigned int v3; // eax@7 | |
1695 unsigned int v4; // edx@8 | |
1696 char *v5; // ecx@9 | |
1697 int v6; // edi@17 | |
1698 Texture *v7; // ebx@18 | |
1699 struct IDirect3DTexture2 **v8; // eax@19 | |
1700 struct IDirect3DTexture2 *v9; // eax@20 | |
1701 struct IDirectDrawSurface **v10; // eax@22 | |
1702 struct IDirectDrawSurface *v11; // eax@23 | |
1703 int v12; // eax@26 | |
1704 | |
1705 v0 = pParty->pPlayers; | |
1706 do | |
1707 { | |
203 | 1708 if (SoundSetAction[24][0]) |
0 | 1709 { |
1710 v1 = 0; | |
764 | 1711 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1712 { |
1713 LABEL_7: | |
1714 v3 = 0; | |
1715 } | |
1716 else | |
1717 { | |
1718 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1719 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1720 { |
1721 ++v1; | |
1722 v2 += 120; | |
764 | 1723 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1724 goto LABEL_7; |
1725 } | |
1726 v3 = v1; | |
1727 } | |
764 | 1728 pSoundList->UnloadSound(v3, 1); |
0 | 1729 v4 = 0; |
764 | 1730 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1731 { |
1732 LABEL_12: | |
1733 v4 = 0; | |
1734 } | |
1735 else | |
1736 { | |
1737 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1738 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1739 { |
1740 ++v4; | |
1741 v5 += 120; | |
764 | 1742 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1743 goto LABEL_12; |
1744 } | |
1745 } | |
764 | 1746 pSoundList->UnloadSound(v4, 1); |
0 | 1747 } |
1748 ++v0; | |
1749 } | |
1750 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1751 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1752 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1753 { |
1754 v7 = &pIcons_LOD->pTextures[v6]; | |
1755 do | |
1756 { | |
1757 v7->Release(); | |
1758 v8 = pIcons_LOD->pHardwareTextures; | |
1759 if ( v8 ) | |
1760 { | |
1761 v9 = v8[v6]; | |
1762 if ( v9 ) | |
1763 { | |
1764 v9->Release(); | |
1765 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1766 } | |
1767 } | |
1768 v10 = pIcons_LOD->pHardwareSurfaces; | |
1769 if ( v10 ) | |
1770 { | |
1771 v11 = v10[v6]; | |
1772 if ( v11 ) | |
1773 { | |
1774 v11->Release(); | |
1775 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1776 } | |
1777 } | |
1778 --v6; | |
1779 --v7; | |
1780 } | |
33 | 1781 while ( v6 >= pIcons_LOD->pFacesLock ); |
1782 } | |
1783 v12 = pIcons_LOD->pFacesLock; | |
1784 pIcons_LOD->pFacesLock = 0; | |
0 | 1785 pIcons_LOD->uNumLoadedFiles = v12; |
1786 } | |
1787 // 4ED498: using guessed type char byte_4ED498; | |
1788 | |
1789 //----- (0049387A) -------------------------------------------------------- | |
1790 int CycleCharacter(unsigned int _this) | |
1791 { | |
1792 signed int result; // eax@1 | |
1793 signed int v2; // ecx@2 | |
1794 signed int v3; // ecx@8 | |
1795 | |
1796 result = uActiveCharacter; | |
1797 if ( _this ) | |
1798 { | |
1799 v2 = 0; | |
1800 while ( 1 ) | |
1801 { | |
1802 --result; | |
1803 if ( result < 1 ) | |
1804 result = 4; | |
1805 if ( !pPlayers[result]->uTimeToRecovery ) | |
1806 break; | |
1807 ++v2; | |
1808 if ( v2 >= 4 ) | |
1809 return uActiveCharacter; | |
1810 } | |
1811 } | |
1812 else | |
1813 { | |
1814 v3 = 0; | |
1815 while ( 1 ) | |
1816 { | |
1817 ++result; | |
1818 if ( result > 4 ) | |
1819 result = 1; | |
1820 if ( !pPlayers[result]->uTimeToRecovery ) | |
1821 break; | |
1822 ++v3; | |
1823 if ( v3 >= 4 ) | |
1824 return uActiveCharacter; | |
1825 } | |
1826 } | |
1827 return result; | |
1828 } | |
1829 //----- (004938D1) -------------------------------------------------------- | |
1830 void __fastcall Rest(unsigned int uHoursToSleep) | |
1831 { | |
1832 unsigned int v1; // esi@1 | |
1833 double v2; // st7@3 | |
1834 Player **v3; // esi@3 | |
1835 | |
1836 v1 = uHoursToSleep; | |
1837 if ( uHoursToSleep > 240 ) | |
1838 InitializeActors(); | |
1839 v2 = (double)(7680 * v1) * 0.033333335; | |
1840 pParty->uTimePlayed += (signed __int64)v2; | |
1841 v3 = &pPlayers[1]; | |
1842 do | |
1843 { | |
1844 (*v3)->Recover((signed __int64)v2); | |
1845 ++v3; | |
1846 } | |
1847 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1848 _494035_timed_effects__water_walking_damage__etc(); | |
1849 } | |
1850 | |
1851 //----- (00493938) -------------------------------------------------------- | |
1852 int __cdecl _493938_regenerate() | |
1853 { | |
1854 int v0; // edi@1 | |
1855 signed __int64 v1; // qax@1 | |
1856 int v2; // ecx@1 | |
1857 int result; // eax@1 | |
1858 int v4; // eax@2 | |
1859 int v5; // edi@5 | |
112 | 1860 int *v6; // ecx@5 |
0 | 1861 char v7; // sf@5 |
112 | 1862 int *v8; // ecx@10 |
0 | 1863 int v9; // edi@15 |
1864 signed int v10; // eax@15 | |
1865 __int16 *v11; // edx@16 | |
1866 int v12; // eax@20 | |
1867 int v13; // ebx@20 | |
1868 unsigned int *v14; // esi@21 | |
1869 unsigned int v15; // ecx@21 | |
1870 unsigned int v16; // eax@21 | |
1871 int v17; // edx@21 | |
1872 int v18; // eax@21 | |
1873 signed int v19; // eax@21 | |
1874 signed int v20; // ebx@25 | |
1875 Player *v21; // esi@25 | |
1876 ITEM_EQUIP_TYPE v22; // edi@30 | |
1877 //int v23; // edx@31 | |
1878 signed int v24; // ecx@32 | |
1879 signed int v25; // eax@33 | |
1880 int v26; // eax@35 | |
1881 int v27; // eax@36 | |
1882 int v28; // eax@37 | |
1883 int v29; // eax@40 | |
1884 int v30; // eax@41 | |
1885 signed int v31; // ecx@53 | |
1886 char *v32; // eax@53 | |
1887 char *v33; // edi@82 | |
1888 int v34; // ecx@88 | |
1889 int v35; // eax@88 | |
1890 char *v36; // edi@99 | |
1891 int v37; // edi@104 | |
1892 int v38; // edi@106 | |
1893 int v39; // edi@111 | |
1894 int v40; // ecx@113 | |
1895 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
|
1896 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 1897 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
1898 int v44; // [sp+210h] [bp-20h]@22 | |
1899 int v45; // [sp+214h] [bp-1Ch]@25 | |
1900 int v46; // [sp+218h] [bp-18h]@25 | |
1901 int v47; // [sp+21Ch] [bp-14h]@25 | |
1902 int v48; // [sp+220h] [bp-10h]@25 | |
1903 int v49; // [sp+224h] [bp-Ch]@24 | |
1904 int v50; // [sp+228h] [bp-8h]@25 | |
1905 int v51; // [sp+22Ch] [bp-4h]@2 | |
1906 | |
1907 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
1908 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
1909 v2 = (signed int)v1 / 60; | |
1910 result = (signed int)v1 / 60 + 5; | |
1911 if ( v0 >= result ) | |
1912 { | |
1913 v51 = 0; | |
1914 v4 = (v0 - v2) / 5; | |
1915 if (pParty->FlyActive()) | |
1916 { | |
1917 if ( pParty->bFlying ) | |
1918 { | |
569 | 1919 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
1920 { // colliding with something in the air - fall down | |
1921 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
1922 //__debugbreak(); | |
1167 | 1923 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 | 1924 v7 = *v6 < v5; |
1925 *v6 -= v5; | |
0 | 1926 if ( v7 ) |
1927 { | |
112 | 1928 *v6 = 0; |
0 | 1929 pParty->uFlags &= 0xFFFFFFBFu; |
1930 pParty->bFlying = 0; | |
1931 v51 = 1; | |
1932 } | |
1933 } | |
1934 } | |
1935 } | |
569 | 1936 |
0 | 1937 if (pParty->WaterWalkActive()) |
1938 { | |
569 | 1939 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
1940 { | |
1941 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
1942 { // taking on water | |
1943 //__debugbreak(); | |
1167 | 1944 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 | 1945 v7 = *v8 < v4; |
1946 *v8 -= v4; | |
0 | 1947 if ( v7 ) |
1948 { | |
112 | 1949 *v8 = 0; |
569 | 1950 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 1951 v51 = 1; |
1952 } | |
1953 } | |
1954 } | |
1955 } | |
569 | 1956 |
0 | 1957 if (pParty->ImmolationActive()) |
1958 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1959 //SpriteObject::SpriteObject(&a1); |
0 | 1960 v9 = 0; |
1961 a3.z = 0; | |
1962 a3.y = 0; | |
1963 a3.x = 0; | |
1964 a1.stru_24.Reset(); | |
822 | 1965 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
1966 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 1967 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1968 a1.uType = 1070; |
822 | 1969 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 1970 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1971 { | |
1972 LABEL_19: | |
1973 LOWORD(v10) = 0; | |
1974 } | |
1975 else | |
1976 { | |
1977 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 1978 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 1979 { |
1980 ++v10; | |
1981 v11 += 28; | |
1982 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
1983 goto LABEL_19; | |
1984 } | |
1985 } | |
1986 a1.uObjectDescID = v10; | |
1987 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 1988 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 1989 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 1990 a1.uAttributes = 0; |
1991 a1.uSectorID = 0; | |
1992 a1.uSpriteFrameID = 0; | |
822 | 1993 a1.spell_caster_pid = v12; |
0 | 1994 a1.uFacing = 0; |
1995 a1.uSoundID = 0; | |
1996 v13 = sub_46A89E((int)v41, 100, 307); | |
1997 if ( v13 > 0 ) | |
1998 { | |
1999 do | |
2000 { | |
2001 v14 = (unsigned int *)&v41[4 * v9]; | |
2002 v15 = *v14; | |
2003 v16 = *v14; | |
2004 a1.vPosition.x = pActors[v16].vPosition.x; | |
2005 v17 = pActors[v16].vPosition.y; | |
2006 a1.vPosition.z = pActors[v16].vPosition.z; | |
2007 v18 = 8 * v15; | |
862 | 2008 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2009 a1.vPosition.y = v17; |
823 | 2010 a1.spell_target_pid = v18; |
0 | 2011 v19 = a1.Create(0, 0, 0, 0); |
862 | 2012 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2013 ++v9; |
2014 } | |
2015 while ( v9 < v13 ); | |
2016 } | |
2017 } | |
2018 v44 = 0; | |
248 | 2019 if (PartyHasDragon()) |
0 | 2020 v44 = 1; |
2021 v49 = 0; | |
2022 LABEL_25: | |
2023 v20 = 0; | |
2024 v21 = &pParty->pPlayers[v49]; | |
2025 v50 = 0; | |
2026 v47 = 0; | |
2027 v45 = 0; | |
2028 v48 = 0; | |
2029 v46 = 0; | |
255 | 2030 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2031 v50 = 1; |
135 | 2032 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2033 v48 = 1; |
2034 v22 = (ITEM_EQUIP_TYPE)0; | |
2035 while ( 1 ) | |
2036 { | |
2037 if ( v21->HasItemEquipped(v22) ) | |
2038 { | |
2039 //v23 = v21->pEquipment.pIndices; | |
2040 auto _idx = v21->pEquipment.pIndices[v22]; | |
2041 v24 = v21->pInventoryItems[_idx].uItemID; | |
2042 if ( v24 > 134 ) | |
2043 { | |
2044 if ( v24 == 529 ) | |
2045 goto LABEL_43; | |
2046 if ( v24 == 535 ) | |
2047 goto LABEL_44; | |
2048 if ( v24 == 515 ) | |
2049 { | |
2050 v47 = 1; | |
2051 } | |
2052 else | |
2053 { | |
2054 if ( v24 == 532 ) | |
2055 goto LABEL_50; | |
2056 } | |
2057 } | |
2058 else | |
2059 { | |
377 | 2060 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2061 if ( v25 <= 50 ) |
2062 { | |
2063 if ( v25 != 50 ) | |
2064 { | |
2065 v26 = v25 - 37; | |
2066 if ( v26 ) | |
2067 { | |
2068 v27 = v26 - 1; | |
2069 if ( !v27 ) | |
2070 goto LABEL_50; | |
2071 v28 = v27 - 6; | |
2072 if ( v28 ) | |
2073 { | |
2074 if ( v28 != 3 ) | |
2075 goto LABEL_51; | |
2076 LABEL_50: | |
2077 v50 = 1; | |
2078 goto LABEL_51; | |
2079 } | |
2080 } | |
2081 } | |
2082 LABEL_44: | |
2083 v20 = 1; | |
2084 goto LABEL_51; | |
2085 } | |
2086 v29 = v25 - 54; | |
2087 if ( !v29 ) | |
2088 goto LABEL_44; | |
2089 v30 = v29 - 1; | |
2090 if ( !v30 ) | |
2091 goto LABEL_50; | |
2092 if ( v30 == 11 ) | |
2093 { | |
2094 LABEL_43: | |
2095 v20 = 1; | |
2096 v50 = 1; | |
2097 goto LABEL_51; | |
2098 } | |
2099 } | |
2100 } | |
2101 LABEL_51: | |
2102 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2103 if ( (signed int)v22 >= 16 ) | |
2104 { | |
2105 if ( v48 ) | |
2106 { | |
2107 v31 = 0; | |
2108 v32 = (char *)v21->pInventoryItems; | |
2109 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2110 { | |
2111 ++v31; | |
2112 v32 += 36; | |
2113 if ( v31 >= 138 ) | |
2114 goto LABEL_59; | |
2115 } | |
2116 v48 = 0; | |
2117 v45 = 1; | |
2118 } | |
2119 LABEL_59: | |
2120 if ( v21->pConditions[17] ) | |
2121 v46 = 1; | |
2122 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2123 { | |
2124 ++v21->sHealth; | |
2125 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2126 v21->sHealth = v21->GetMaxHealth(); | |
2127 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2128 { | |
2129 LODWORD(v21->pConditions[13]) = 0; | |
2130 HIDWORD(v21->pConditions[13]) = 0; | |
2131 } | |
2132 v51 = 1; | |
2133 } | |
2134 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2135 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2136 && !v21->pConditions[14] | |
2137 && !v21->pConditions[16] ) | |
2138 { | |
2139 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2140 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2141 v21->sHealth = v21->GetMaxHealth(); | |
2142 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2143 { | |
2144 LODWORD(v21->pConditions[13]) = 0; | |
2145 HIDWORD(v21->pConditions[13]) = 0; | |
2146 } | |
2147 v51 = 1; | |
2148 } | |
2149 if ( v50 ) | |
2150 { | |
2151 v33 = (char *)&v21->sMana; | |
2152 ++*(int *)v33; | |
2153 if ( v21->sMana > v21->GetMaxMana() ) | |
2154 *(int *)v33 = v21->GetMaxMana(); | |
2155 v51 = 1; | |
2156 } | |
2157 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2158 { | |
2159 v34 = LODWORD(v21->pConditions[13]); | |
2160 --v21->sHealth; | |
2161 v35 = v21->sHealth; | |
2162 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2163 v21->pConditions[13] = pParty->uTimePlayed; | |
2164 if ( v35 < 1 ) | |
2165 { | |
2166 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2167 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2168 { | |
2169 v21->pConditions[13] = pParty->uTimePlayed; | |
2170 } | |
2171 else | |
2172 { | |
2173 if ( !v21->pConditions[14] ) | |
2174 v21->pConditions[14] = pParty->uTimePlayed; | |
2175 } | |
2176 } | |
2177 v51 = 1; | |
2178 } | |
2179 if ( v45 ) | |
2180 { | |
2181 v36 = (char *)&v21->sMana; | |
2182 ++*(int *)v36; | |
2183 if ( v21->sMana > v21->GetMaxMana() ) | |
2184 *(int *)v36 = v21->GetMaxMana(); | |
2185 } | |
2186 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2187 { | |
2188 v37 = v21->sHealth; | |
2189 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2190 v21->sHealth = v37 - 2; | |
2191 v38 = v21->sMana; | |
2192 if ( v38 > v21->GetMaxMana() / 2 ) | |
2193 v21->sMana = v38 - 2; | |
2194 } | |
2195 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2196 { | |
2197 v39 = v21->sHealth; | |
2198 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2199 v21->sHealth = v39 - 1; | |
2200 v40 = v21->sMana; | |
2201 if ( v40 > 0 ) | |
2202 v21->sMana = v40 - 1; | |
2203 } | |
2204 ++v49; | |
2205 if ( v49 >= 4 ) | |
2206 { | |
2207 result = HIDWORD(pParty->uTimePlayed); | |
2208 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2209 if ( !viewparams->bRedrawGameUI ) | |
2210 { | |
2211 result = v51; | |
2212 viewparams->bRedrawGameUI = v51; | |
2213 } | |
2214 return result; | |
2215 } | |
2216 goto LABEL_25; | |
2217 } | |
2218 } | |
2219 } | |
2220 return result; | |
2221 } | |
2222 | |
2223 //----- (00493F79) -------------------------------------------------------- | |
351 | 2224 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2225 { |
2226 signed __int64 v2; // ST2C_8@1 | |
2227 signed __int64 v3; // qax@1 | |
351 | 2228 //signed __int64 v4; // ST1C_8@1 |
0 | 2229 unsigned __int64 v5; // qax@1 |
2230 unsigned int v6; // ebx@1 | |
2231 | |
2232 v2 = (signed __int64)((double)a2 * 0.234375); | |
2233 v3 = v2 / 60 / 60; | |
351 | 2234 //v4 = v3; |
0 | 2235 v5 = (unsigned int)v3 / 0x18; |
2236 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2237 _this->field_0_expire_second = v2 % 60; |
2238 _this->field_4_expire_minute = v2 / 60 % 60; | |
2239 _this->field_8_expire_hour = v3 % 24; | |
2240 _this->field_10_expire_week = v5 / 7 & 3; | |
2241 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2242 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2243 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2244 } |
2245 | |
2246 //----- (00494035) -------------------------------------------------------- | |
1031 | 2247 void _494035_timed_effects__water_walking_damage__etc() |
0 | 2248 { |
2249 signed __int64 v0; // qax@1 | |
2250 signed __int64 v1; // ST30_8@1 | |
2251 signed __int64 v2; // ST38_8@1 | |
2252 unsigned __int64 v3; // qax@1 | |
2253 unsigned int v4; // edi@1 | |
2254 //signed int v5; // eax@4 | |
2255 //char *v6; // ecx@5 | |
2256 //Player *v7; // esi@8 | |
2257 //char *v8; // ecx@12 | |
766 | 2258 //Player *pPlayer; // esi@15 |
0 | 2259 //void *v10; // esi@25 |
2260 unsigned int v11; // ecx@27 | |
2261 signed int v12; // edi@29 | |
2262 Player *v13; // ecx@30 | |
2263 Player *v14; // esi@35 | |
2264 double v15; // st7@35 | |
2265 Player **v16; // esi@43 | |
2266 Player *v17; // edi@44 | |
2267 double v18; // st7@44 | |
816 | 2268 //float v19; // ST28_4@48 |
2269 //double v20; // ST38_8@48 | |
0 | 2270 Player *v21; // esi@51 |
2271 signed int v22; // edi@53 | |
2272 int v23; // eax@59 | |
2273 int v24; // ecx@60 | |
2274 int v25; // eax@63 | |
2275 int v26; // ecx@64 | |
2276 int v27; // eax@67 | |
2277 int v28; // ecx@68 | |
2278 int v29; // eax@71 | |
2279 int v30; // ecx@72 | |
2280 int v31; // eax@75 | |
2281 int v32; // ecx@76 | |
2282 int v33; // eax@79 | |
2283 int v34; // ecx@80 | |
2284 int v35; // eax@83 | |
2285 int v36; // ecx@84 | |
2286 int v37; // eax@87 | |
2287 int v38; // ecx@88 | |
2288 int v39; // eax@91 | |
2289 int v40; // ecx@92 | |
2290 int v41; // eax@95 | |
2291 int v42; // ecx@96 | |
2292 bool v43; // ebx@102 | |
2293 //SpellBuff *v44; // edi@104 | |
2294 //signed int v45; // ebp@104 | |
2295 bool v46; // edi@111 | |
2296 //SpellBuff *v47; // esi@113 | |
2297 //Player **v48; // esi@119 | |
2298 //signed int v49; // edi@121 | |
2299 //char *v50; // esi@122 | |
2300 signed int v51; // edx@128 | |
2301 signed int v52; // ecx@130 | |
2302 int v53; // eax@131 | |
2303 Player *v54; // eax@141 | |
766 | 2304 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2305 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2306 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2307 int v58; // [sp-4h] [bp-34h]@33 |
2308 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2309 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2310 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2311 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2312 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2313 signed int a2a; // [sp+18h] [bp-18h]@47 |
2314 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2315 | |
766 | 2316 //a2 = pParty->uCurrentHour; |
0 | 2317 v61 = pParty->uDaysPlayed; |
816 | 2318 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2319 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2320 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2321 v1 = v0; |
2322 v0 /= 60i64; | |
2323 v2 = v0; | |
2324 v3 = (unsigned int)v0 / 24; | |
2325 v4 = (unsigned int)(v3 / 7) >> 2; | |
2326 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2327 pParty->uCurrentMinute = v1 % 60; | |
2328 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2329 pParty->uCurrentHour = v2 % 24; | |
2330 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2331 pParty->uCurrentMonth = v4 % 12; | |
352 | 2332 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2333 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2334 { |
2335 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2336 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2337 | |
2338 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2339 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2340 | |
766 | 2341 ++pParty->days_played_without_rest; |
2342 if (pParty->days_played_without_rest > 1) | |
0 | 2343 { |
2344 for (uint i = 0; i < 4; ++i) | |
766 | 2345 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2346 | |
2347 if (pParty->uNumFoodRations) | |
2348 Party::TakeFood(1); | |
0 | 2349 else |
2350 for (uint i = 0; i < 4; ++i) | |
766 | 2351 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2352 | |
2353 if (pParty->days_played_without_rest > 3) | |
2354 for (uint i = 0; i < 4; ++i) | |
0 | 2355 { |
766 | 2356 auto player = pParty->pPlayers + i; |
2357 | |
2358 player->Zero(); | |
2359 | |
2360 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2361 { |
767 | 2362 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2363 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2364 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2365 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2366 } |
2367 } | |
766 | 2368 } |
2369 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2370 pOutdoor->SetFog(); |
2371 | |
2372 for (uint i = 0; i < 4; ++i) | |
2373 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2374 } | |
766 | 2375 |
0 | 2376 v11 = LODWORD(pParty->uTimePlayed); |
2377 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2378 { | |
2379 v12 = 1; | |
2380 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2381 viewparams->bRedrawGameUI = 1; | |
2382 while ( 1 ) | |
2383 { | |
1080 | 2384 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 2385 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2386 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2387 { |
2388 v58 = 0; | |
2389 } | |
2390 else | |
2391 { | |
2392 v58 = 0; | |
2393 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2394 { | |
2395 v14 = pPlayers[v12]; | |
2396 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
1036 | 2397 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE); |
0 | 2398 if ( pParty->uFlags & 4 ) |
2399 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2400 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); |
783 | 2401 GameUI_Footer_TimeLeft = 128; |
0 | 2402 } |
2403 goto LABEL_39; | |
2404 } | |
2405 v13 = pPlayers[v12]; | |
2406 } | |
130 | 2407 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2408 LABEL_39: |
2409 ++v12; | |
2410 if ( v12 > 4 ) | |
2411 { | |
2412 v11 = LODWORD(pParty->uTimePlayed); | |
2413 break; | |
2414 } | |
2415 } | |
2416 } | |
2417 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2418 { | |
2419 viewparams->bRedrawGameUI = 1; | |
2420 pParty->field_6FC = v11 + 128; | |
2421 v16 = &pPlayers[1]; | |
2422 do | |
2423 { | |
2424 v17 = *v16; | |
2425 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 2426 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 2427 if ( pParty->uFlags & 0x200 ) |
2428 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2429 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); |
783 | 2430 GameUI_Footer_TimeLeft = 128; |
0 | 2431 } |
2432 ++v16; | |
2433 } | |
2434 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2435 } | |
2436 _493938_regenerate(); | |
2437 v65 = 4; | |
816 | 2438 a2a = pEventTimer->uTimeElapsed; |
2439 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2440 { | |
2441 //v19 = (double)(signed int)prev_time * 0.5; | |
2442 //v20 = v19 + 6.7553994e15; | |
2443 a2a *= 0.5f; | |
2444 if (a2a < 1) | |
0 | 2445 a2a = 1; |
2446 } | |
2447 v62 = &pPlayers[1]; | |
2448 do | |
2449 { | |
2450 v21 = *v62; | |
2451 if ( (*v62)->uTimeToRecovery ) | |
2452 v21->Recover(a2a); | |
2453 v22 = v21->sHealth; | |
2454 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2455 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2456 { | |
2457 if ( v22 >= 1 ) | |
2458 goto LABEL_59; | |
2459 v59 = 0; | |
2460 v56 = 13; | |
2461 } | |
2462 else | |
2463 { | |
2464 v59 = 0; | |
2465 v56 = 14; | |
2466 } | |
2467 v21->SetCondition(v56, v59); | |
2468 LABEL_59: | |
2469 v23 = (int)&v21->field_E0; | |
2470 if ( v21->field_E0 ) | |
2471 { | |
816 | 2472 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2473 if ( v24 > 0 ) |
2474 { | |
2475 *(int *)v23 = v24; | |
2476 } | |
2477 else | |
2478 { | |
2479 *(int *)v23 = 0; | |
2480 viewparams->bRedrawGameUI = 1; | |
2481 } | |
2482 } | |
2483 v25 = (int)&v21->field_E4; | |
2484 if ( v21->field_E4 ) | |
2485 { | |
816 | 2486 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2487 if ( v26 > 0 ) |
2488 { | |
2489 *(int *)v25 = v26; | |
2490 } | |
2491 else | |
2492 { | |
2493 *(int *)v25 = 0; | |
2494 viewparams->bRedrawGameUI = 1; | |
2495 } | |
2496 } | |
2497 v27 = (int)&v21->field_E8; | |
2498 if ( v21->field_E8 ) | |
2499 { | |
816 | 2500 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2501 if ( v28 > 0 ) |
2502 { | |
2503 *(int *)v27 = v28; | |
2504 } | |
2505 else | |
2506 { | |
2507 *(int *)v27 = 0; | |
2508 viewparams->bRedrawGameUI = 1; | |
2509 } | |
2510 } | |
2511 v29 = (int)&v21->field_EC; | |
2512 if ( v21->field_EC ) | |
2513 { | |
816 | 2514 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2515 if ( v30 > 0 ) |
2516 { | |
2517 *(int *)v29 = v30; | |
2518 } | |
2519 else | |
2520 { | |
2521 *(int *)v29 = 0; | |
2522 viewparams->bRedrawGameUI = 1; | |
2523 } | |
2524 } | |
2525 v31 = (int)&v21->field_F0; | |
2526 if ( v21->field_F0 ) | |
2527 { | |
816 | 2528 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2529 if ( v32 > 0 ) |
2530 { | |
2531 *(int *)v31 = v32; | |
2532 } | |
2533 else | |
2534 { | |
2535 *(int *)v31 = 0; | |
2536 viewparams->bRedrawGameUI = 1; | |
2537 } | |
2538 } | |
2539 v33 = (int)&v21->field_F4; | |
2540 if ( v21->field_F4 ) | |
2541 { | |
816 | 2542 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2543 if ( v34 > 0 ) |
2544 { | |
2545 *(int *)v33 = v34; | |
2546 } | |
2547 else | |
2548 { | |
2549 *(int *)v33 = 0; | |
2550 viewparams->bRedrawGameUI = 1; | |
2551 } | |
2552 } | |
2553 v35 = (int)&v21->field_F8; | |
2554 if ( v21->field_F8 ) | |
2555 { | |
816 | 2556 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2557 if ( v36 > 0 ) |
2558 { | |
2559 *(int *)v35 = v36; | |
2560 } | |
2561 else | |
2562 { | |
2563 *(int *)v35 = 0; | |
2564 viewparams->bRedrawGameUI = 1; | |
2565 } | |
2566 } | |
2567 v37 = (int)&v21->field_FC; | |
2568 if ( v21->field_FC ) | |
2569 { | |
816 | 2570 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2571 if ( v38 > 0 ) |
2572 { | |
2573 *(int *)v37 = v38; | |
2574 } | |
2575 else | |
2576 { | |
2577 *(int *)v37 = 0; | |
2578 viewparams->bRedrawGameUI = 1; | |
2579 } | |
2580 } | |
2581 v39 = (int)&v21->field_100; | |
2582 if ( v21->field_100 ) | |
2583 { | |
816 | 2584 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2585 if ( v40 > 0 ) |
2586 { | |
2587 *(int *)v39 = v40; | |
2588 } | |
2589 else | |
2590 { | |
2591 *(int *)v39 = 0; | |
2592 viewparams->bRedrawGameUI = 1; | |
2593 } | |
2594 } | |
2595 v41 = (int)&v21->field_104; | |
2596 if ( v21->field_104 ) | |
2597 { | |
816 | 2598 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2599 if ( v42 > 0 ) |
2600 { | |
2601 *(int *)v41 = v42; | |
2602 } | |
2603 else | |
2604 { | |
2605 *(int *)v41 = 0; | |
2606 viewparams->bRedrawGameUI = 1; | |
2607 } | |
2608 } | |
2609 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2610 --v65; | |
2611 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2612 | |
2613 for (uint k = 0; k < 24; ++k) | |
2614 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2615 | |
2616 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2617 v21->SetCondition(1u, 0); | |
2618 ++v62; | |
2619 } | |
2620 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
1167 | 2621 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 2622 |
2623 for (uint i = 0; i < 20; ++i) | |
2624 { | |
2625 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2626 viewparams->bRedrawGameUI = 1; | |
2627 } | |
2628 | |
1167 | 2629 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 2630 { |
2631 for (uint i = 0; i < 4; ++i) | |
2632 pParty->pPlayers[i].SetCondition(1, 0); | |
2633 } | |
2634 | |
2635 for (uint i = 0; i < 2; ++i) | |
2636 { | |
2637 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2638 if (pBuf->uExpireTime == 0) | |
2639 continue; | |
2640 | |
2641 if ( !(pBuf->uFlags & 1) ) | |
2642 { | |
2643 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2644 { | |
2645 pBuf->Reset(); | |
2646 if (dword_4EE07C[i] == 7 ) | |
2647 pParty->bFlying = false; | |
2648 } | |
2649 } | |
2650 } | |
2651 | |
2652 v51 = v65; | |
2653 if ( v65 ) | |
2654 goto LABEL_135; | |
151 | 2655 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2656 { |
2657 v52 = (signed int)&pPlayers[1]; | |
2658 while ( 1 ) | |
2659 { | |
2660 v53 = *(int *)v52; | |
2661 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2662 break; | |
2663 v52 += 4; | |
2664 if ( v52 > (signed int)&pPlayers[4] ) | |
2665 goto LABEL_135; | |
2666 } | |
2667 *(int *)(v53 + 16) = 0; | |
2668 *(int *)(v53 + 20) = 0; | |
2669 v51 = 1; | |
2670 LABEL_135: | |
151 | 2671 if ( pCurrentScreen != SCREEN_REST |
0 | 2672 && (!v51 || dword_5C35C0) ) |
981 | 2673 uGameState = GAME_STATE_PARTY_DIED; |
0 | 2674 } |
2675 if ( uActiveCharacter ) | |
2676 { | |
151 | 2677 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2678 { |
2679 v54 = pPlayers[uActiveCharacter]; | |
2680 if ( v54->pConditions[2] | |
2681 || v54->pConditions[12] | |
2682 || v54->pConditions[13] | |
2683 || v54->pConditions[14] | |
2684 || v54->pConditions[15] | |
2685 || v54->pConditions[16] ) | |
2686 { | |
2687 viewparams->bRedrawGameUI = 1; | |
2688 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2689 } | |
2690 } | |
2691 } | |
2692 } | |
2693 | |
2694 //----- (00494820) -------------------------------------------------------- | |
758 | 2695 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2696 { |
2697 signed int v1; // eax@1 | |
2698 | |
2699 v1 = 5; | |
758 | 2700 if ( a1 % 24 >= 5 ) |
0 | 2701 v1 = 29; |
758 | 2702 return v1 - a1 % 24; |
0 | 2703 } |
2704 | |
2705 //----- (00494836) -------------------------------------------------------- | |
2706 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2707 { | |
2708 int v3; // esi@1 | |
2709 int result; // eax@1 | |
2710 stru339_spell_sound *v5; // ebx@1 | |
2711 int *v6; // edi@2 | |
2712 unsigned int v7; // eax@3 | |
2713 int v8; // [sp+Ch] [bp-8h]@3 | |
2714 int v9; // [sp+10h] [bp-4h]@2 | |
2715 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2716 | |
2717 v3 = 0; | |
2718 result = word_4EE088_sound_ids[uSoundID]; | |
2719 v5 = this; | |
2720 a2a = word_4EE088_sound_ids[uSoundID]; | |
2721 if ( result ) | |
2722 { | |
2723 v9 = 0; | |
2724 v6 = this->pSoundsOffsets; | |
2725 do | |
2726 { | |
2727 v7 = a2a++; | |
2728 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2729 if ( !result ) | |
2730 break; | |
2731 a6 += 4; | |
2732 result = v8 + 256; | |
2733 *v6 = v3; | |
2734 v3 += result; | |
2735 ++v9; | |
2736 *(v6 - 2) = result; | |
2737 ++v6; | |
2738 } | |
2739 while ( v9 < 2 ); | |
2740 } | |
2741 return result; | |
2742 } | |
2743 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2744 | |
2745 //----- (00494AED) -------------------------------------------------------- | |
130 | 2746 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2747 { |
2748 unsigned int _uNumFrames; // edx@1 | |
2749 unsigned int result; // eax@1 | |
2750 PlayerFrame *v4; // ecx@2 | |
2751 | |
2752 _uNumFrames = this->uNumFrames; | |
2753 result = 0; | |
2754 if ( (signed int)this->uNumFrames <= 0 ) | |
2755 { | |
2756 LABEL_5: | |
2757 result = 0; | |
2758 } | |
2759 else | |
2760 { | |
2761 v4 = this->pFrames; | |
130 | 2762 while ( v4->expression != expression ) |
0 | 2763 { |
2764 ++result; | |
2765 ++v4; | |
2766 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2767 goto LABEL_5; | |
2768 } | |
2769 } | |
2770 return result; | |
2771 } | |
2772 | |
2773 //----- (00494B10) -------------------------------------------------------- | |
2774 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2775 { | |
2776 unsigned int v3; // esi@1 | |
2777 PlayerFrame *v4; // edi@1 | |
2778 PlayerFrame *v5; // ecx@1 | |
2779 __int16 v6; // dx@2 | |
2780 int v7; // edx@3 | |
2781 char *i; // eax@3 | |
2782 int v9; // ecx@5 | |
2783 PlayerFrame *result; // eax@6 | |
2784 | |
2785 v3 = uFramesetID; | |
2786 v4 = this->pFrames; | |
2787 v5 = &v4[uFramesetID]; | |
2788 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2789 { | |
2790 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2791 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2792 { | |
2793 v9 = *(short *)i; | |
2794 if ( v7 <= v9 ) | |
2795 break; | |
2796 v7 -= v9; | |
2797 ++v3; | |
2798 } | |
2799 result = &v4[v3]; | |
2800 } | |
2801 else | |
2802 { | |
2803 result = &v4[uFramesetID]; | |
2804 } | |
2805 return result; | |
2806 } | |
2807 | |
2808 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2809 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2810 { |
2811 PlayerFrameTable *v4; // edi@1 | |
2812 int v5; // esi@1 | |
2813 int v6; // eax@2 | |
2814 | |
2815 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2816 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2817 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
|
2818 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2819 *pAnimTime = v5; |
0 | 2820 } |
2821 else | |
2822 { | |
2823 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2824 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2825 *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
|
2826 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2827 return &v4->pFrames[*pFramesetID]; |
0 | 2828 } |
2829 | |
2830 //----- (00494BC3) -------------------------------------------------------- | |
2831 void PlayerFrameTable::ToFile() | |
2832 { | |
2833 PlayerFrameTable *v1; // esi@1 | |
2834 FILE *v2; // eax@1 | |
2835 FILE *v3; // edi@1 | |
2836 | |
2837 auto Str = this; | |
2838 | |
2839 v1 = Str; | |
2840 v2 = fopen("data\\dpft.bin", "wb"); | |
2841 v3 = v2; | |
2842 if ( !v2 ) | |
2843 Abortf("Unable to save dpft.bin!"); | |
2844 fwrite(v1, 4u, 1u, v2); | |
2845 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2846 fclose(v3); | |
2847 } | |
2848 | |
2849 //----- (00494C0F) -------------------------------------------------------- | |
2850 void PlayerFrameTable::FromFile(void *pSerialized) | |
2851 { | |
2852 uNumFrames = *(int *)pSerialized; | |
2853 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2854 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2855 } | |
2856 | |
2857 //----- (00494C5A) -------------------------------------------------------- | |
2858 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2859 { | |
2860 PlayerFrameTable *v2; // ebx@1 | |
2861 FILE *v3; // eax@1 | |
2862 int v4; // esi@3 | |
2863 void *v5; // eax@10 | |
2864 FILE *v6; // ST0C_4@12 | |
2865 char *i; // eax@12 | |
2866 __int16 v8; // ax@15 | |
2867 const char *v9; // ST10_4@15 | |
2868 unsigned __int16 v10; // ax@15 | |
2869 const char *v11; // ST0C_4@15 | |
2870 int j; // esi@15 | |
2871 int v13; // eax@17 | |
2872 int v14; // edx@22 | |
2873 int v15; // ecx@23 | |
2874 int v16; // eax@24 | |
2875 signed int k; // eax@27 | |
2876 PlayerFrame *v18; // edx@28 | |
2877 int v19; // esi@28 | |
2878 int l; // ecx@29 | |
2879 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2880 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2881 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2882 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2883 int v26; // [sp+2FCh] [bp-8h]@3 | |
2884 FILE *File; // [sp+300h] [bp-4h]@1 | |
2885 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
2886 | |
2887 v2 = this; | |
2888 //TileTable::dtor((TileTable *)this); | |
2889 v3 = fopen(Args, "r"); | |
2890 File = v3; | |
2891 if ( !v3 ) | |
2892 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
2893 v4 = 0; | |
2894 v25 = 0; | |
2895 v26 = 1; | |
2896 if ( fgets(&Buf, 490, v3) ) | |
2897 { | |
2898 do | |
2899 { | |
2900 *strchr(&Buf, 10) = 0; | |
703 | 2901 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2902 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
2903 { | |
2904 if ( v24.uPropCount < 3 ) | |
0 | 2905 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
2906 ++v25; | |
2907 } | |
2908 ++v26; | |
2909 } | |
2910 while ( fgets(&Buf, 490, File) ); | |
2911 v4 = v25; | |
2912 } | |
2913 v2->uNumFrames = v4; | |
2914 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
2915 v2->pFrames = (PlayerFrame *)v5; | |
2916 if ( !v5 ) | |
2917 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
2918 v6 = File; | |
2919 v2->uNumFrames = 0; | |
2920 fseek(v6, 0, 0); | |
2921 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
2922 { | |
2923 *strchr(&Buf, 10) = 0; | |
703 | 2924 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2925 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 2926 { |
2927 v8 = atoi(v24.pProperties[0]); | |
2928 v9 = v24.pProperties[1]; | |
130 | 2929 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 2930 v10 = atoi(v9); |
2931 v11 = v24.pProperties[2]; | |
2932 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
2933 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
2934 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
2935 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 2936 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 2937 { |
1104 | 2938 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 2939 { |
2940 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
2941 *(char *)v13 |= 4u; | |
2942 } | |
2943 } | |
2944 ++v2->uNumFrames; | |
2945 } | |
2946 } | |
2947 fclose(File); | |
2948 v14 = 0; | |
2949 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
2950 { | |
2951 v15 = 0; | |
2952 do | |
2953 { | |
2954 v16 = (int)&v2->pFrames[v15]; | |
2955 if ( !(*(char *)(v16 + 18) & 4) ) | |
2956 *(char *)(v16 + 8) |= 1u; | |
2957 ++v14; | |
2958 ++v15; | |
2959 } | |
2960 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
2961 } | |
2962 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
2963 { | |
2964 v18 = v2->pFrames; | |
2965 Argsa = (int)&v18[k]; | |
2966 v19 = *(short *)(Argsa + 4); | |
2967 if ( *(char *)(Argsa + 8) & 1 ) | |
2968 { | |
2969 ++k; | |
2970 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
2971 { | |
2972 v19 += *(short *)(l + 4); | |
2973 ++k; | |
2974 } | |
2975 LOWORD(v19) = v18[k].uAnimTime + v19; | |
2976 } | |
2977 ++k; | |
2978 } | |
2979 return 1; | |
2980 } | |
2981 | |
2982 //----- (00494F3A) -------------------------------------------------------- | |
2983 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
2984 { | |
2985 IconFrameTable *v2; // esi@1 | |
2986 int v3; // ebx@1 | |
2987 unsigned int uID; // edi@1 | |
2988 unsigned int result; // eax@4 | |
2989 | |
2990 v2 = this; | |
2991 v3 = 0; | |
2992 uID = 0; | |
2993 if ( (signed int)this->uNumIcons <= 0 ) | |
2994 { | |
2995 LABEL_4: | |
2996 result = 0; | |
2997 } | |
2998 else | |
2999 { | |
1104 | 3000 while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) ) |
0 | 3001 { |
3002 ++uID; | |
3003 ++v3; | |
3004 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3005 goto LABEL_4; | |
3006 } | |
3007 result = uID; | |
3008 } | |
3009 return result; | |
3010 } | |
3011 | |
3012 //----- (00494F70) -------------------------------------------------------- | |
3013 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3014 { | |
3015 IconFrame *v3; // edi@1 | |
3016 IconFrame *v4; // ecx@1 | |
3017 __int16 v5; // dx@2 | |
3018 int v6; // edx@3 | |
3019 unsigned int v7; // eax@3 | |
3020 char *i; // ecx@3 | |
3021 int v9; // esi@5 | |
3022 IconFrame *result; // eax@6 | |
3023 | |
3024 v3 = this->pIcons; | |
3025 v4 = &v3[uIconID]; | |
3026 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3027 { | |
3028 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3029 v7 = uIconID; | |
3030 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3031 { | |
3032 v9 = *(short *)i; | |
3033 if ( v6 <= v9 ) | |
3034 break; | |
3035 v6 -= v9; | |
3036 ++v7; | |
3037 } | |
3038 result = &v3[v7]; | |
3039 } | |
3040 else | |
3041 { | |
3042 result = &v3[uIconID]; | |
3043 } | |
3044 return result; | |
3045 } | |
3046 | |
3047 //----- (00494FBF) -------------------------------------------------------- | |
3048 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3049 { | |
3050 IconFrameTable *v2; // esi@1 | |
3051 unsigned int v3; // edi@3 | |
3052 const char *i; // eax@3 | |
3053 IconFrame *v5; // eax@5 | |
3054 | |
3055 v2 = this; | |
3056 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3057 { | |
3058 v3 = uIconID; | |
3059 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3060 { | |
3061 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3062 v5 = v2->pIcons; | |
3063 if ( !(v5[v3].uFlags & 1) ) | |
3064 break; | |
3065 ++v3; | |
3066 } | |
3067 } | |
3068 } | |
3069 | |
3070 //----- (0049500A) -------------------------------------------------------- | |
3071 void IconFrameTable::ToFile() | |
3072 { | |
3073 IconFrameTable *v1; // esi@1 | |
3074 FILE *v2; // eax@1 | |
3075 FILE *v3; // edi@1 | |
3076 | |
3077 auto Str = this; | |
3078 | |
3079 v1 = Str; | |
3080 v2 = fopen("data\\dift.bin", "wb"); | |
3081 v3 = v2; | |
3082 if ( !v2 ) | |
3083 Abortf("Unable to save dift.bin!"); | |
3084 fwrite(v1, 4u, 1u, v2); | |
3085 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3086 fclose(v3); | |
3087 } | |
3088 | |
3089 //----- (00495056) -------------------------------------------------------- | |
3090 void IconFrameTable::FromFile(void *pSerialized) | |
3091 { | |
3092 uNumIcons = *(int *)pSerialized; | |
3093 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3094 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3095 } | |
3096 | |
3097 //----- (0049509D) -------------------------------------------------------- | |
3098 int IconFrameTable::FromFileTxt(const char *Args) | |
3099 { | |
3100 IconFrameTable *v2; // ebx@1 | |
3101 FILE *v3; // eax@1 | |
3102 int v4; // esi@3 | |
3103 void *v5; // eax@10 | |
3104 FILE *v6; // ST0C_4@12 | |
3105 char *i; // eax@12 | |
3106 const char *v8; // ST00_4@15 | |
3107 int v9; // eax@16 | |
3108 int v10; // edx@20 | |
3109 int v11; // ecx@21 | |
3110 int v12; // eax@22 | |
3111 signed int j; // edx@25 | |
3112 IconFrame *v14; // ecx@26 | |
3113 int v15; // esi@26 | |
3114 int k; // eax@27 | |
3115 signed int result; // eax@11 | |
3116 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3117 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3118 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3119 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3120 int v22; // [sp+2FCh] [bp-8h]@3 | |
3121 FILE *File; // [sp+300h] [bp-4h]@1 | |
3122 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3123 | |
3124 v2 = this; | |
3125 //TileTable::dtor((TileTable *)this); | |
3126 v3 = fopen(Args, "r"); | |
3127 File = v3; | |
3128 if ( !v3 ) | |
3129 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3130 v4 = 0; | |
3131 v21 = 0; | |
3132 v22 = 1; | |
3133 if ( fgets(&Buf, 490, v3) ) | |
3134 { | |
3135 do | |
3136 { | |
3137 *strchr(&Buf, 10) = 0; | |
3138 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3139 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3140 { | |
3141 if ( v20.uPropCount < 3 ) | |
0 | 3142 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3143 ++v21; | |
3144 } | |
3145 ++v22; | |
3146 } | |
3147 while ( fgets(&Buf, 490, File) ); | |
3148 v4 = v21; | |
3149 } | |
3150 v2->uNumIcons = v4; | |
3151 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3152 v2->pIcons = (IconFrame *)v5; | |
3153 if ( v5 ) | |
3154 { | |
3155 v6 = File; | |
3156 v2->uNumIcons = 0; | |
3157 fseek(v6, 0, 0); | |
3158 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3159 { | |
3160 *strchr(&Buf, 10) = 0; | |
3161 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3162 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3163 { |
3164 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3165 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3166 v8 = v20.pProperties[2]; | |
3167 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
1104 | 3168 if ( !_stricmp(v8, "new") ) |
0 | 3169 { |
3170 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3171 *(char *)v9 |= 4u; | |
3172 } | |
3173 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3174 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3175 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3176 } | |
3177 } | |
3178 fclose(File); | |
3179 v10 = 0; | |
3180 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3181 { | |
3182 v11 = 0; | |
3183 do | |
3184 { | |
3185 v12 = (int)&v2->pIcons[v11]; | |
3186 if ( !(*(char *)(v12 + 60) & 4) ) | |
3187 *(char *)(v12 + 28) |= 1u; | |
3188 ++v10; | |
3189 ++v11; | |
3190 } | |
3191 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3192 } | |
3193 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3194 { | |
3195 v14 = v2->pIcons; | |
3196 Argsa = (int)&v14[j]; | |
3197 v15 = *(short *)(Argsa + 24); | |
3198 if ( *(char *)(Argsa + 28) & 1 ) | |
3199 { | |
3200 ++j; | |
3201 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3202 { | |
3203 v15 += *(short *)(k + 24); | |
3204 ++j; | |
3205 } | |
3206 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3207 } | |
3208 ++j; | |
3209 } | |
3210 result = 1; | |
3211 } | |
3212 else | |
3213 { | |
3214 fclose(File); | |
3215 result = 0; | |
3216 } | |
3217 return result; | |
3218 } | |
3219 | |
3220 //----- (00495366) -------------------------------------------------------- | |
3221 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3222 { | |
3223 int v2; // edi@1 | |
3224 int v3; // edx@2 | |
3225 int v4; // esi@3 | |
3226 int v5; // ebx@5 | |
3227 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3228 signed int v8; // [sp+10h] [bp-10h]@1 | |
3229 int **v9; // [sp+14h] [bp-Ch]@4 | |
3230 signed int v10; // [sp+18h] [bp-8h]@3 | |
3231 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3232 | |
3233 v2 = a1; | |
3234 v11 = a2; | |
3235 v8 = 0; | |
3236 v7 = 0; | |
3237 if ( dword_AE336C == a1 ) | |
3238 { | |
3239 v3 = dword_AE3370; | |
3240 } | |
3241 else | |
3242 { | |
3243 v4 = a2; | |
3244 dword_AE336C = a1; | |
3245 v10 = 0; | |
3246 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3247 goto LABEL_17; | |
3248 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3249 do | |
3250 { | |
3251 v5 = tolower(*(char *)*v9); | |
3252 if ( v5 == tolower(v2) ) | |
3253 { | |
3254 if ( v8 ) | |
3255 v7 = v10; | |
3256 else | |
3257 v8 = v10; | |
3258 } | |
3259 ++v10; | |
3260 v9 += 2; | |
3261 } | |
3262 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3263 if ( v8 && v8 != v7 ) | |
3264 v3 = v8 + rand() % (v7 - v8); | |
3265 else | |
3266 LABEL_17: | |
3267 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3268 } | |
3269 dword_AE3370 = v3; | |
3270 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3271 } | |
3272 // AE336C: using guessed type int dword_AE336C; | |
3273 // AE3370: using guessed type int dword_AE3370; | |
3274 | |
3275 //----- (00495430) -------------------------------------------------------- | |
607 | 3276 char * GetReputationString( signed int a1 ) |
3277 { | |
566 | 3278 if (a1 >= 25) |
3279 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3280 else if (a1 >= 6) | |
3281 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3282 else if (a1 >= -5) | |
3283 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3284 else if (a1 >= -24) | |
3285 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3286 else |
566 | 3287 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3288 } |
3289 | |
3290 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3291 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3292 { |
3293 unsigned __int8 v6; // bl@1 | |
3294 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3295 //NPCData *v9; // eax@4 |
250 | 3296 //size_t v10; // eax@6 |
0 | 3297 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3298 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3299 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3300 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3301 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3302 //int v16; // edx@10 |
0 | 3303 int v17; // eax@10 |
3304 signed __int64 v18; // qax@18 | |
3305 unsigned int v19; // edi@32 | |
3306 unsigned __int8 *v20; // ebx@32 | |
3307 int v21; // ecx@34 | |
3308 __int16 v22; // ax@34 | |
3309 int v23; // edx@39 | |
3310 int v24; // eax@39 | |
3311 int v25; // eax@45 | |
3312 float *v26; // esi@68 | |
3313 float v27; // ST18_4@68 | |
3314 signed int v28; // eax@68 | |
3315 int v29; // eax@68 | |
3316 float v30; // ST18_4@72 | |
3317 signed int v31; // eax@72 | |
3318 float v32; // ST18_4@74 | |
3319 signed int v33; // eax@74 | |
3320 double v34; // st7@75 | |
3321 float v35; // ST18_4@76 | |
3322 signed int v36; // eax@76 | |
3323 float *v37; // esi@78 | |
3324 float v38; // ST18_4@78 | |
3325 int v39; // eax@78 | |
3326 float v40; // ST18_4@82 | |
3327 int v41; // eax@82 | |
3328 float v42; // ST18_4@83 | |
3329 int v43; // eax@83 | |
3330 float v44; // ST18_4@85 | |
3331 int v45; // eax@85 | |
3332 const char *v46; // eax@86 | |
3333 unsigned int v47; // eax@87 | |
3334 float v48; // ST18_4@97 | |
3335 __int64 v49; // ST14_8@107 | |
3336 int v50; // eax@107 | |
3337 int v51; // eax@108 | |
3338 Player *v52; // eax@109 | |
3339 int v53; // [sp-4h] [bp-13Ch]@107 | |
3340 int v54; // [sp+0h] [bp-138h]@107 | |
3341 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3342 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3343 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3344 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3345 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3346 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3347 //Player *v61; // [sp+124h] [bp-14h]@3 |
3348 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3349 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3350 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3351 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3352 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3353 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3354 |
0 | 3355 |
3356 v6 = uPlayerID; | |
249 | 3357 //Str = lpsz; |
0 | 3358 if ( IsBadStringPtrA(lpsz, 1u) ) |
3359 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3360 |
0 | 3361 a1[0] = 0; |
3362 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3363 v59 = TargetColor(255, 255, 155); |
249 | 3364 //v61 = pPlayer; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3365 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2)); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3366 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3367 NPCData *npc = nullptr; |
0 | 3368 if ( dword_5C35D4 ) |
248 | 3369 { |
463 | 3370 //__debugbreak(); // fix |
1211 | 3371 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
|
3372 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3373 else |
602 | 3374 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3375 //v65 = v9; |
250 | 3376 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3377 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3378 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3379 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3380 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3381 v11 = a4; |
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 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3384 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3385 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3386 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3387 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3388 //while ( 1 ) |
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 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3391 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3392 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3393 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3394 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3395 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3396 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3397 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3398 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3399 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
|
3400 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3401 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3402 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3403 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3404 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3405 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3406 case 2: |
0 | 3407 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3408 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3409 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3410 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3411 v11 = a1; |
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 5: |
0 | 3414 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3415 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3416 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3417 { | |
3418 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3419 { | |
3420 if ( v18 < 20 ) | |
3421 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3422 } | |
3423 else | |
3424 { | |
3425 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3426 } | |
3427 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3428 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3429 case 6: |
0 | 3430 if ( pPlayer->uSex ) |
3431 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3432 else | |
3433 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3434 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3435 case 7: |
0 | 3436 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3437 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3438 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3439 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3440 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3441 case 8: |
0 | 3442 v19 = 0; |
3443 v63 = 0; | |
484 | 3444 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3445 do |
3446 { | |
3447 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3448 { | |
3449 v21 = v63; | |
3450 v22 = word_4EE150[v19]; | |
3451 ++v63; | |
3452 v55[v21] = v22; | |
3453 } | |
3454 ++v19; | |
3455 } | |
3456 while ( v19 < 28 ); | |
3457 if ( v63 ) | |
3458 { | |
3459 v23 = rand() % v63; | |
3460 v24 = dword_A74CDC; | |
3461 if ( dword_A74CDC == -1 ) | |
3462 { | |
3463 v24 = v23; | |
3464 dword_A74CDC = v23; | |
3465 } | |
492 | 3466 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3467 } |
3468 else | |
3469 { | |
3470 v11 = (char *)pNPCTopics[55].pText; | |
3471 } | |
249 | 3472 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3473 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3475 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3476 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 case 10: |
0 | 3482 if ( pPlayer->uSex ) |
3483 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3484 else | |
3485 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3486 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 case 11: |
0 | 3488 v25 = GetPartyReputation(); |
3489 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3490 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 v25 = npc->rep; |
0 | 3492 LABEL_46: |
3493 if ( v25 >= 25 ) | |
3494 { | |
3495 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3496 } | |
3497 else | |
3498 { | |
3499 if ( v25 < 6 ) | |
3500 { | |
3501 if ( v25 >= -5 ) | |
3502 { | |
3503 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3504 } | |
3505 else | |
3506 { | |
3507 if ( v25 < -24 ) | |
3508 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3509 else | |
3510 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3511 } | |
3512 } | |
3513 else | |
3514 { | |
3515 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3516 } | |
3517 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 case 13: |
0 | 3520 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 _continue_strcat: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3535 strcat(pTmpBuf2.data(), v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3536 dst = strlen(pTmpBuf2.data()); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3542 case 16: |
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 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3546 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 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
|
3553 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3554 pay_percentage = 1; |
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 sprintf(a1, "%lu", pay_percentage); |
250 | 3557 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3570 sprintf(a1, "%lu", v51); |
0 | 3571 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3572 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3575 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3576 v47 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3577 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3580 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3584 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3585 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3592 case 25: |
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 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3598 switch ( a5 ) |
3599 { | |
3600 case 3: | |
3601 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 v45 = a3->GetValue(); |
0 | 3603 v29 = pPlayer->_4B8213(v45, v44); |
3604 break; | |
3605 case 4: | |
3606 v29 = pPlayer->_4B824B(*v37); | |
3607 break; | |
3608 case 5: | |
3609 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3610 v43 = a3->GetValue(); |
0 | 3611 v29 = pPlayer->_4B8265(v43, v42); |
3612 break; | |
3613 case 6: | |
3614 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 v41 = a3->GetValue(); |
0 | 3616 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3617 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3618 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3620 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3621 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3622 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3623 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3624 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3625 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3626 v28 = a3->GetValue(); |
749 | 3627 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3628 if ( a5 == 3 ) |
3629 { | |
3630 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3631 v36 = a3->GetValue(); |
917 | 3632 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3633 if (a3->Broken()) |
0 | 3634 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3635 goto _continue_sprintf; |
0 | 3636 } |
3637 if ( a5 != 4 ) | |
3638 { | |
3639 if ( a5 == 5 ) | |
3640 { | |
3641 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3642 v33 = a3->GetValue(); |
916 | 3643 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3644 } |
3645 else | |
3646 { | |
3647 if ( a5 == 6 ) | |
3648 { | |
3649 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 v31 = a3->GetValue(); |
917 | 3651 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3652 if (a3->Broken()) |
0 | 3653 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 goto _continue_sprintf; |
0 | 3657 } |
3658 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 _continue_sprintf: |
0 | 3660 sprintf(a1, "%lu", v29); |
250 | 3661 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 goto _continue_strcat; |
0 | 3663 } |
3664 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 |
0 | 3666 v48 = v34; |
916 | 3667 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 v48 = v34; |
916 | 3683 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 sub_493F79(&v57, *a6); |
351 | 3692 v54 = v57.field_18_expire_year; |
3693 v53 = v57.field_C_expire_day + 1; | |
3694 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 default: |
0 | 3709 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 goto _continue_strcat; |
484 | 3713 v49 = pParty->field_3C._s_times[v17-51]; |
3714 | |
0 | 3715 sub_493F79(&v56, v49); |
351 | 3716 v54 = v56.field_18_expire_year; |
3717 v53 = v56.field_C_expire_day + 1; | |
3718 v50 = v56.field_14_exprie_month; | |
0 | 3719 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3720 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 } |
0 | 3724 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3725 return pTmpBuf2.data(); |
0 | 3726 } |
3727 | |
3728 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3729 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3730 { |
734 | 3731 //stru154 *v3; // edi@1 |
3732 //signed int v4; // eax@1 | |
3733 //signed int result; // eax@9 | |
3734 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3735 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3736 float v7; |
0 | 3737 |
3738 v.x = 0.0; | |
3739 v.y = 0.0; | |
3740 v.z = 0.0; | |
734 | 3741 GetFacePlane(a2, a3, &v, &v7); |
3742 | |
3743 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3744 polygonType = POLYGON_VerticalWall; | |
3745 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3746 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3747 polygonType = POLYGON_Floor; | |
0 | 3748 else |
734 | 3749 polygonType = POLYGON_InBetweenFloorAndWall; |
3750 | |
3751 face_plane.vNormal.x = v.x; | |
3752 face_plane.vNormal.y = v.y; | |
3753 face_plane.vNormal.z = v.z; | |
3754 face_plane.dist = v7; | |
0 | 3755 } |
3756 | |
3757 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3758 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3759 { |
734 | 3760 if (fabsf(pNormal->z) < 1e-6f) |
3761 polygonType = POLYGON_VerticalWall; | |
3762 else if (fabsf(pNormal->x) < 1e-6f && | |
3763 fabsf(pNormal->y) < 1e-6f) | |
3764 polygonType = POLYGON_Floor; | |
0 | 3765 else |
734 | 3766 polygonType = POLYGON_InBetweenFloorAndWall; |
3767 | |
3768 face_plane.vNormal.x = pNormal->x; | |
3769 face_plane.dist = dist; | |
3770 face_plane.vNormal.y = pNormal->y; | |
3771 face_plane.vNormal.z = pNormal->z; | |
0 | 3772 } |
3773 | |
3774 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3775 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3776 { |
3777 ODMFace *v5; // ebx@1 | |
734 | 3778 //int v6; // eax@1 |
3779 //unsigned __int16 *v7; // ebx@2 | |
3780 //Vec3_int_ *v8; // eax@3 | |
0 | 3781 Vec3_int_ *v9; // ecx@3 |
734 | 3782 //double v10; // st7@3 |
3783 //int v11; // ecx@3 | |
0 | 3784 Vec3_int_ *v12; // ecx@3 |
734 | 3785 //double v13; // st7@3 |
3786 //double v14; // st6@3 | |
3787 //double v15; // st5@3 | |
3788 //int v16; // ecx@3 | |
0 | 3789 Vec3_int_ *v17; // eax@3 |
734 | 3790 //double v18; // st5@3 |
0 | 3791 Vec3_float_ *v19; // eax@3 |
734 | 3792 //int result; // eax@8 |
3793 //float v21; // ecx@10 | |
3794 //double v22; // st7@10 | |
3795 //double v23; // st6@10 | |
0 | 3796 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3797 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3798 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3799 float v27; // [sp+20h] [bp-48h]@3 | |
3800 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3801 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3802 //float v30; // [sp+30h] [bp-38h]@3 | |
3803 //float v31; // [sp+34h] [bp-34h]@3 | |
3804 //float v32; // [sp+38h] [bp-30h]@3 | |
3805 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3806 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3807 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3808 //float v36; // [sp+50h] [bp-18h]@3 | |
3809 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3810 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3811 //int v39; // [sp+64h] [bp-4h]@1 |
3812 | |
3813 //v39 = 0; | |
0 | 3814 v1.x = 0.0; |
3815 v5 = pFace; | |
734 | 3816 //v6 = pFace->uNumVertices; |
0 | 3817 v1.y = 0.0; |
3818 v1.z = 0.0; | |
734 | 3819 |
3820 if (pFace->uNumVertices >= 2) | |
3821 { | |
3822 int i = 0; | |
3823 while ( i < pFace->uNumVertices - 2 ) | |
3824 { | |
3825 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3826 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3827 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 3828 i++; |
734 | 3829 v1.x = v12->x - v9->x; |
3830 v26 = v17->x - v12->x; | |
3831 v1.y = v12->y - v9->y; | |
3832 v27 = v17->y - v12->y; | |
3833 v1.z = v12->z - v9->z; | |
3834 v28 = v17->z - v12->z; | |
0 | 3835 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3836 v38.x = v19->x; | |
3837 v38.y = v19->y; | |
3838 v38.z = v19->z; | |
734 | 3839 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3840 { | |
3841 v38.Normalize(); | |
3842 | |
3843 pOutNormal->x = v38.x; | |
3844 pOutNormal->y = v38.y; | |
3845 pOutNormal->z = v38.z; | |
3846 | |
3847 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3848 return; | |
3849 } | |
3850 } | |
3851 } | |
3852 | |
3853 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3854 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3855 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3856 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3857 } |
3858 | |
3859 //----- (0049D700) -------------------------------------------------------- | |
3860 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3861 { | |
3862 unsigned int v1; // eax@1 | |
3863 int v2; // ecx@1 | |
3864 unsigned int v3; // eax@1 | |
3865 | |
3866 v1 = uDim; | |
3867 v2 = 0; | |
3868 v3 = v1 - 1; | |
3869 while ( v3 & 1 ) | |
3870 { | |
3871 v3 >>= 1; | |
3872 ++v2; | |
3873 } | |
3874 return v3 == 0 ? v2 : 0; | |
3875 } | |
3876 | |
3877 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3878 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3879 { |
737 | 3880 /*signed __int64 v2; // ST10_8@1 |
0 | 3881 double v3; // st7@1 |
3882 float v4; // ST24_4@1 | |
3883 double v5; // ST10_8@1 | |
3884 int v6; // ST1C_4@1 | |
3885 float v7; // ST24_4@1 | |
3886 double v8; // ST10_8@1 | |
3887 unsigned __int8 v9; // ST20_1@1 | |
3888 float v10; // ST24_4@1 | |
3889 double v11; // ST10_8@1 | |
3890 float v12; // ST24_4@1 | |
737 | 3891 double v13; // ST08_8@1*/ |
3892 | |
3893 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
3894 (a2 >> 24) / 255.0f * 255.0f), | |
3895 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
3896 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
3897 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
3898 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
3899 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
3900 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
3901 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
3902 /*v2 = a1 >> 24; | |
3903 v3 = (double)v2 / 255.0f; | |
3904 HIDWORD(v2) = 0; | |
0 | 3905 LODWORD(v2) = a2 >> 24; |
737 | 3906 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 3907 v5 = v4 + 6.7553994e15; |
3908 v6 = LODWORD(v5); | |
737 | 3909 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 3910 v8 = v7 + 6.7553994e15; |
3911 v9 = LOBYTE(v8); | |
737 | 3912 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 3913 v11 = v10 + 6.7553994e15; |
737 | 3914 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 3915 v13 = v12 + 6.7553994e15; |
737 | 3916 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 3917 } |
3918 | |
3919 //----- (004A46E6) -------------------------------------------------------- | |
3920 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
3921 { | |
3922 int v5; // eax@1 | |
3923 int z; // eax@1 | |
3924 unsigned int v7; // eax@9 | |
3925 unsigned int v8; // ecx@9 | |
3926 int v9; // eax@9 | |
3927 unsigned int v10; // eax@10 | |
3928 int *v11; // esi@10 | |
3929 int *v12; // edi@10 | |
3930 int v13; // ecx@10 | |
3931 int v14; // edx@10 | |
3932 unsigned int v15; // eax@22 | |
3933 int *v16; // esi@22 | |
3934 int *v17; // edi@22 | |
3935 int v18; // ecx@22 | |
3936 int v19; // edx@22 | |
3937 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
3938 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
3939 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
3940 signed int v23; // [sp+20h] [bp+Ch]@1 | |
3941 | |
3942 v5 = a4; | |
3943 v23 = _z >> 16; | |
3944 z = x + v5; | |
693 | 3945 if ( z >= (signed int)pViewport->uViewportTL_X |
3946 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
3947 && y >= (signed int)pViewport->uViewportTL_Y | |
3948 && y <= (signed int)pViewport->uViewportBR_Y ) | |
3949 { | |
3950 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
3951 x = pViewport->uViewportTL_X; | |
3952 if ( z > (signed int)pViewport->uViewportBR_X ) | |
3953 z = pViewport->uViewportBR_X; | |
0 | 3954 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
3955 v22 = z - x; | |
3956 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
3957 v7 = lightColor >> 3; | |
3958 v8 = lightColor & 0xF0; | |
3959 v9 = v7 & 0x1E0000; | |
3960 if ( pRenderer->uTargetGBits == 5 ) | |
3961 { | |
3962 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
3963 v11 = (int *)pTarget; | |
3964 v12 = pTargetZ; | |
3965 v13 = v22; | |
3966 v14 = (v10 << 16) | v10; | |
3967 z = (unsigned __int8)pTarget & 2; | |
3968 if ( (unsigned __int8)pTarget & 2 ) | |
3969 { | |
3970 z = (unsigned int)*pTargetZ >> 16; | |
3971 if ( z > v23 ) | |
3972 { | |
3973 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
3974 *pTarget = z; | |
3975 } | |
3976 v13 = v22 - 1; | |
3977 v11 = (int *)(pTarget + 1); | |
3978 v12 = pTargetZ + 1; | |
3979 } | |
3980 while ( v13 != 1 ) | |
3981 { | |
3982 if ( v13 < 1 ) | |
3983 return z; | |
3984 z = (unsigned int)*v12 >> 16; | |
3985 if ( z <= v23 ) | |
3986 { | |
3987 v13 -= 2; | |
3988 ++v11; | |
3989 v12 += 2; | |
3990 } | |
3991 else | |
3992 { | |
3993 v12 += 2; | |
3994 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
3995 v13 -= 2; | |
3996 *v11 = z; | |
3997 ++v11; | |
3998 } | |
3999 } | |
4000 z = (unsigned int)*v12 >> 16; | |
4001 if ( z > v23 ) | |
4002 { | |
4003 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4004 *(short *)v11 = z; | |
4005 } | |
4006 } | |
4007 else | |
4008 { | |
4009 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4010 v16 = (int *)pTarget; | |
4011 v17 = pTargetZ; | |
4012 v18 = v22; | |
4013 v19 = (v15 << 16) | v15; | |
4014 z = (unsigned __int8)pTarget & 2; | |
4015 if ( (unsigned __int8)pTarget & 2 ) | |
4016 { | |
4017 z = (unsigned int)*pTargetZ >> 16; | |
4018 if ( z > v23 ) | |
4019 { | |
4020 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4021 *pTarget = z; | |
4022 } | |
4023 v18 = v22 - 1; | |
4024 v16 = (int *)(pTarget + 1); | |
4025 v17 = pTargetZ + 1; | |
4026 } | |
4027 while ( v18 != 1 ) | |
4028 { | |
4029 if ( v18 < 1 ) | |
4030 return z; | |
4031 z = (unsigned int)*v17 >> 16; | |
4032 if ( z <= v23 ) | |
4033 { | |
4034 v18 -= 2; | |
4035 ++v16; | |
4036 v17 += 2; | |
4037 } | |
4038 else | |
4039 { | |
4040 v17 += 2; | |
4041 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4042 v18 -= 2; | |
4043 *v16 = z; | |
4044 ++v16; | |
4045 } | |
4046 } | |
4047 z = (unsigned int)*v17 >> 16; | |
4048 if ( z > v23 ) | |
4049 { | |
4050 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4051 *(short *)v16 = z; | |
4052 } | |
4053 } | |
4054 } | |
4055 return z; | |
4056 } | |
4057 | |
4058 //----- (004A57E9) -------------------------------------------------------- | |
4059 void __cdecl Present_ColorKey() | |
4060 { | |
4061 HRESULT v0; // eax@3 | |
4062 HRESULT v1; // eax@3 | |
4063 HRESULT v2; // eax@3 | |
4064 HRESULT v3; // eax@3 | |
4065 HRESULT v4; // eax@3 | |
4066 RECT a2; // [sp+4h] [bp-14h]@3 | |
4067 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4068 | |
4069 if ( !pRenderer->uNumSceneBegins ) | |
4070 { | |
4071 if ( pRenderer->field_40110 ) | |
4072 { | |
693 | 4073 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4074 a2.left = 0; |
4075 a2.top = 0; | |
4076 a2.right = 640; | |
4077 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4078 a2.right = 640; | |
4079 a2.left = 0; | |
693 | 4080 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4081 a2.bottom = 480; |
4082 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4083 0, | |
693 | 4084 pViewport->uViewportBR_Y + 1, |
0 | 4085 pRenderer->pColorKeySurface4, |
4086 &a2, | |
4087 16u)); | |
693 | 4088 a2.right = pViewport->uViewportTL_X; |
4089 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4090 a2.left = 0; |
693 | 4091 a2.top = pViewport->uViewportTL_Y; |
0 | 4092 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4093 0, | |
693 | 4094 pViewport->uViewportTL_Y, |
0 | 4095 pRenderer->pColorKeySurface4, |
4096 &a2, | |
4097 16u)); | |
693 | 4098 a2.left = pViewport->uViewportBR_X; |
4099 a2.top = pViewport->uViewportTL_Y; | |
0 | 4100 a2.right = 640; |
693 | 4101 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4102 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4103 pViewport->uViewportBR_X, |
4104 pViewport->uViewportTL_Y, | |
0 | 4105 pRenderer->pColorKeySurface4, |
4106 &a2, | |
4107 16u)); | |
693 | 4108 a2.right = pViewport->uViewportBR_X; |
4109 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4110 a2.left = pViewport->uViewportTL_X; | |
4111 a2.top = pViewport->uViewportTL_Y; | |
0 | 4112 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4113 pViewport->uViewportTL_X, |
4114 pViewport->uViewportTL_Y, | |
0 | 4115 pRenderer->pColorKeySurface4, |
4116 &a2, | |
4117 17u)); | |
4118 } | |
4119 } | |
4120 } | |
4121 | |
4122 //----- (004A597D) -------------------------------------------------------- | |
4123 void Present_NoColorKey() | |
4124 { | |
4125 //unsigned __int16 *v0; // eax@4 | |
4126 unsigned __int16 *v1; // esi@4 | |
4127 void *v2; // edi@4 | |
4128 //signed int v4; // ebx@4 | |
4129 //signed int v5; // ebx@6 | |
4130 //void *v6; // edi@7 | |
4131 //const void *v7; // esi@7 | |
4132 signed int v8; // ebx@8 | |
4133 int v9; // eax@10 | |
4134 unsigned int v10; // esi@10 | |
4135 unsigned __int32 v11; // edi@10 | |
4136 //int v12; // ecx@10 | |
4137 unsigned int v13; // ebx@10 | |
4138 int v14; // eax@11 | |
4139 int v15; // eax@13 | |
4140 int v16; // eax@14 | |
4141 int v17; // eax@16 | |
4142 HRESULT v18; // eax@22 | |
4143 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4144 int v20; // [sp+88h] [bp-1Ch]@10 | |
4145 int v21; // [sp+8Ch] [bp-18h]@10 | |
4146 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4147 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4148 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4149 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4150 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4151 | |
4152 if ( !pRenderer->uNumSceneBegins ) | |
4153 { | |
4154 if ( pRenderer->field_40110 ) | |
4155 { | |
4156 memset(&Dst, 0, 0x7Cu); | |
4157 Dst.dwSize = 124; | |
168 | 4158 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4159 { |
4160 //v26 = Dst.lpSurface; | |
4161 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4162 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4163 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4164 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4165 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4166 v1 = pRenderer->pTargetSurface; | |
4167 v2 = Dst.lpSurface; | |
4168 | |
4169 | |
4170 /*for (uint y = 0; y < 480; ++y) | |
4171 { | |
4172 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4173 for (uint x = 0; x < 640; ++x) | |
4174 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4175 }*/ | |
4176 | |
4177 auto pSrc = pRenderer->pTargetSurface; | |
4178 auto pDst = (__int16 *)Dst.lpSurface; | |
4179 | |
4180 for (uint y = 0; y < 8; ++y) | |
4181 memcpy(pDst + y * Dst.lPitch / 2, | |
4182 | |
4183 pSrc + y * 640, 640 * sizeof(__int16)); | |
4184 | |
4185 for (uint y = 8; y < 352; ++y) | |
4186 { | |
4187 memcpy(pDst + y * Dst.lPitch / 2, | |
4188 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4189 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4190 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4191 } |
4192 | |
121 | 4193 for (uint y = 352; y < 480; ++y) |
0 | 4194 memcpy(pDst + y * Dst.lPitch / 2, |
4195 pSrc + y * 640, 640 * sizeof(__int16)); | |
4196 | |
4197 | |
693 | 4198 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4199 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4200 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4201 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4202 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4203 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4204 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4205 v21 = 4 * v9 + 1280; | |
4206 | |
121 | 4207 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4208 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4209 v10 = (int)pSrc_x1y1; | |
4210 v11 = (int)pDst_x1y1; | |
693 | 4211 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4212 v13 = v24; |
4213 | |
693 | 4214 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4215 { |
4216 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4217 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4218 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4219 { |
4220 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4221 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4222 } | |
4223 } | |
4224 | |
4225 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4226 | |
4227 /* while ( 1 ) | |
4228 { | |
4229 while ( 1 ) | |
4230 { | |
4231 v14 = *(int *)v10; | |
4232 v10 += 4; | |
4233 if ( v14 == v13 ) | |
4234 break; | |
4235 if ( (short)v14 == (short)v13 ) | |
4236 { | |
4237 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4238 v11 += 4; | |
4239 --uHalfWidth; | |
4240 if ( !uHalfWidth ) | |
4241 goto LABEL_21; | |
4242 } | |
4243 else | |
4244 { | |
4245 v15 = __ROL__(v14, 16); | |
4246 if ( (short)v15 == (short)v13 ) | |
4247 { | |
4248 v17 = __ROR__(v15, 16); | |
4249 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4250 v11 += 4; | |
4251 --uHalfWidth; | |
4252 if ( !uHalfWidth ) | |
4253 goto LABEL_21; | |
4254 } | |
4255 else | |
4256 { | |
4257 v16 = __ROR__(v15, 16); | |
4258 *(int *)v11 = v16; | |
4259 v11 += 4; | |
4260 --uHalfWidth; | |
4261 if ( !uHalfWidth ) | |
4262 goto LABEL_21; | |
4263 } | |
4264 } | |
4265 } | |
4266 v11 += 4; | |
4267 --uHalfWidth; | |
4268 if ( !uHalfWidth ) | |
4269 { | |
4270 LABEL_21: | |
4271 v10 += v21; | |
4272 v11 += v22; | |
4273 uHalfWidth = v20; | |
4274 if ( !--uNumLines ) | |
4275 { | |
4276 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4277 return; | |
4278 } | |
4279 } | |
4280 }*/ | |
4281 } | |
4282 } | |
4283 } | |
4284 } | |
4285 | |
4286 //----- (004A7063) -------------------------------------------------------- | |
4287 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4288 { | |
4289 float v2; // ST1C_4@1 | |
4290 double v3; // ST14_8@1 | |
4291 signed int v4; // ebx@1 | |
4292 float v5; // ST1C_4@1 | |
4293 double v6; // ST14_8@1 | |
4294 signed int v7; // edi@1 | |
4295 double v8; // ST0C_8@1 | |
4296 signed int v9; // esi@1 | |
4297 signed int v10; // ecx@1 | |
4298 double v12; // [sp+8h] [bp-18h]@1 | |
4299 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4300 | |
4301 v2 = (double)(uDiffuse >> 24) * a2; | |
4302 v3 = v2 + 6.7553994e15; | |
4303 v4 = LODWORD(v3); | |
4304 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4305 v6 = v5 + 6.7553994e15; | |
4306 v7 = LODWORD(v6); | |
4307 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4308 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4309 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4310 v9 = LODWORD(v8); | |
4311 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4312 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4313 v10 = LODWORD(v12); | |
4314 if ( v4 > 255 ) | |
4315 v4 = 255; | |
4316 if ( v4 < 0 ) | |
4317 v4 = 0; | |
4318 if ( SHIDWORD(v13) > 255 ) | |
4319 v7 = 255; | |
4320 if ( v7 < 0 ) | |
4321 v7 = 0; | |
4322 if ( (signed int)v13 > 255 ) | |
4323 v9 = 255; | |
4324 if ( v9 < 0 ) | |
4325 v9 = 0; | |
4326 if ( SLODWORD(v12) > 255 ) | |
4327 v10 = 255; | |
4328 if ( v10 < 0 ) | |
4329 v10 = 0; | |
4330 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4331 } | |
4332 | |
4333 //----- (004AD504) -------------------------------------------------------- | |
711 | 4334 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4335 { |
4336 int result; // eax@1 | |
711 | 4337 signed int v2; // ebx@1 |
0 | 4338 BLVFace *v3; // esi@3 |
4339 Texture *v4; // edi@6 | |
4340 int v5; // eax@7 | |
4341 int v6; // edx@7 | |
4342 int v7; // ecx@7 | |
4343 int v8; // ebx@8 | |
4344 int v9; // eax@8 | |
4345 int v10; // ebx@8 | |
4346 unsigned int v11; // ebx@9 | |
4347 int v12; // esi@10 | |
4348 int v13; // eax@13 | |
4349 unsigned __int16 *v14; // eax@13 | |
4350 unsigned int v15; // eax@14 | |
4351 unsigned __int16 *v16; // ebx@14 | |
4352 int v17; // eax@15 | |
4353 int v18; // ebx@15 | |
4354 int v19; // esi@15 | |
4355 int v20; // ecx@15 | |
4356 int v21; // eax@15 | |
4357 stru193_math *v22; // ebx@15 | |
4358 int v23; // eax@15 | |
4359 char *v24; // esi@16 | |
4360 int v25; // eax@18 | |
4361 int v26; // eax@18 | |
4362 int v27; // eax@20 | |
4363 signed int v28; // esi@20 | |
4364 signed int v29; // edx@20 | |
4365 signed int v30; // esi@20 | |
4366 signed int v31; // edi@20 | |
4367 int v32; // esi@20 | |
4368 int v33; // eax@26 | |
4369 int *v34; // esi@27 | |
4370 unsigned __int16 *v35; // edi@27 | |
4371 unsigned int v36; // edx@27 | |
4372 int v37; // ebx@27 | |
4373 char v38; // cl@27 | |
4374 char v39; // ch@27 | |
4375 int v40; // ebx@29 | |
4376 int v41; // edx@29 | |
4377 unsigned int v42; // ebx@30 | |
4378 int v43; // edx@30 | |
4379 int v44; // eax@33 | |
4380 int *v45; // esi@34 | |
4381 unsigned __int16 *v46; // edi@34 | |
4382 unsigned int v47; // edx@34 | |
4383 int v48; // ebx@34 | |
4384 char v49; // cl@34 | |
4385 char v50; // ch@34 | |
4386 int v51; // ebx@36 | |
4387 int v52; // edx@36 | |
4388 unsigned __int16 v53; // bx@37 | |
4389 int v54; // edx@37 | |
4390 int v55; // eax@40 | |
4391 int v56; // eax@41 | |
4392 int *v57; // esi@42 | |
4393 unsigned __int16 *v58; // edi@42 | |
4394 unsigned int v59; // edx@42 | |
4395 int v60; // ebx@42 | |
4396 char v61; // cl@42 | |
4397 char v62; // ch@42 | |
4398 unsigned int v63; // ebx@44 | |
4399 int v64; // edx@44 | |
4400 unsigned int v65; // ebx@44 | |
4401 int v66; // edx@44 | |
4402 unsigned int v67; // ebx@45 | |
4403 int v68; // edx@45 | |
4404 int v69; // ebx@45 | |
4405 int v70; // edx@45 | |
4406 int v71; // eax@48 | |
4407 int *v72; // esi@49 | |
4408 unsigned __int16 *v73; // edi@49 | |
4409 unsigned int v74; // edx@49 | |
4410 int v75; // ebx@49 | |
4411 char v76; // cl@49 | |
4412 char v77; // ch@49 | |
4413 unsigned int v78; // ebx@51 | |
4414 int v79; // edx@51 | |
4415 unsigned int v80; // ebx@51 | |
4416 int v81; // edx@51 | |
4417 unsigned int v82; // ebx@52 | |
4418 int v83; // edx@52 | |
4419 int v84; // ebx@52 | |
4420 int v85; // edx@52 | |
4421 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4422 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4423 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4424 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4425 int v90; // [sp+1Ch] [bp-88h]@20 | |
4426 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4427 int v92; // [sp+24h] [bp-80h]@7 | |
4428 int i; // [sp+28h] [bp-7Ch]@7 | |
4429 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4430 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4431 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4432 int v97; // [sp+38h] [bp-6Ch]@15 | |
4433 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4434 int v99; // [sp+40h] [bp-64h]@9 | |
4435 int v100; // [sp+44h] [bp-60h]@24 | |
4436 int v101; // [sp+48h] [bp-5Ch]@10 | |
4437 int v102; // [sp+4Ch] [bp-58h]@20 | |
4438 int v103; // [sp+50h] [bp-54h]@20 | |
4439 int v104; // [sp+54h] [bp-50h]@9 | |
4440 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4441 int v106; // [sp+5Ch] [bp-48h]@24 | |
4442 int v107; // [sp+60h] [bp-44h]@20 | |
4443 int v108; // [sp+64h] [bp-40h]@20 | |
4444 int v109; // [sp+68h] [bp-3Ch]@20 | |
4445 int v110; // [sp+6Ch] [bp-38h]@15 | |
4446 int v111; // [sp+70h] [bp-34h]@20 | |
4447 int a1; // [sp+74h] [bp-30h]@12 | |
4448 int a2; // [sp+78h] [bp-2Ch]@9 | |
4449 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4450 int v115; // [sp+80h] [bp-24h]@18 | |
4451 int v116; // [sp+84h] [bp-20h]@7 | |
4452 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4453 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4454 int *v119; // [sp+90h] [bp-14h]@13 | |
4455 int v120; // [sp+94h] [bp-10h]@15 | |
4456 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4457 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4458 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4459 | |
4460 result = pRenderer->uTargetSurfacePitch; | |
711 | 4461 v2 = sFaceID; |
0 | 4462 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4463 if ( sFaceID >= 0 ) |
4464 { | |
4465 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4466 { | |
4467 v3 = &pIndoor->pFaces[sFaceID]; | |
4468 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4469 if ( !pRenderer->pRenderD3D ) |
4470 { | |
711 | 4471 result = sub_423B5D(sFaceID); |
0 | 4472 if ( result ) |
4473 { | |
4474 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4475 if ( result ) | |
4476 { | |
4477 result = (int)v3->GetTexture(); | |
4478 v4 = (Texture *)result; | |
4479 v96 = (Texture *)result; | |
4480 if ( result ) | |
4481 { | |
4482 v5 = *(short *)(result + 38); | |
4483 LOBYTE(v3->uAttributes) |= 0x80u; | |
4484 v92 = v5; | |
4485 sub_4AE5F1(v2); | |
4486 ++pBLVRenderParams->field_84; | |
4487 v6 = stru_F8AD28.pDeltaUV[0]; | |
4488 v116 = stru_F8AD28.pDeltaUV[1]; | |
4489 v7 = 0; | |
4490 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4491 { | |
4492 v8 = v116; | |
4493 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4494 v9 = 4 * v7 + 16297672; | |
4495 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4496 } | |
4497 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4498 result = stru_F8A590._viewport_space_y; | |
4499 a2 = stru_F8A590._viewport_space_y; | |
4500 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4501 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4502 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4503 v87 = v4->pLevelOfDetail1; |
4504 v88 = v4->pLevelOfDetail2; | |
4505 v89 = v4->pLevelOfDetail3; | |
4506 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4507 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4508 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4509 { | |
4510 v12 = 2 * stru_F8A590._viewport_space_y; | |
4511 v101 = 2 * stru_F8A590._viewport_space_y; | |
4512 while ( 1 ) | |
4513 { | |
4514 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4515 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4516 if ( LOBYTE(viewparams->field_20) ) | |
4517 { | |
4518 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4519 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4520 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4521 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4522 - pBLVRenderParams->uViewportX]; | |
4523 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4524 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4525 - pBLVRenderParams->uViewportX]; | |
4526 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4527 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4528 - pBLVRenderParams->uViewportX]; | |
4529 v123 = (unsigned int)v16; | |
4530 } | |
4531 else | |
4532 { | |
4533 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4534 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4535 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4536 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4537 } | |
4538 v117 = (unsigned int)v14; | |
4539 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4540 v18 = stru_F81018.field_0.field_10; | |
4541 LOWORD(v17) = 0; | |
4542 v97 = stru_F8AD28.field_0 | v17; | |
4543 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4544 v19 = stru_F81018.field_0.field_4 >> i; | |
4545 v20 = 11 - v18; | |
4546 v116 = stru_F81018.field_0.field_8 >> i; | |
4547 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4548 v22 = stru_5C6E00; | |
4549 v122 = (unsigned __int16 *)v20; | |
323 | 4550 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4551 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4552 v120 = v116 + 4 * v23; |
4553 if ( v123 < v117 ) | |
4554 { | |
4555 v24 = (char *)&stru_F81018.field_34.field_8; | |
4556 v114 = &stru_F81018.field_34.field_8; | |
4557 a1 += 16; | |
4558 while ( 1 ) | |
4559 { | |
4560 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4561 v25 = *((int *)v24 - 2); | |
4562 LOWORD(v25) = 0; | |
4563 v115 = v97; | |
4564 v26 = stru_F8AD28.field_0 | v25; | |
4565 if ( v97 <= (unsigned int)v26 ) | |
4566 v115 = v26; | |
4567 v97 = v26; | |
4568 v27 = *((int *)v24 - 11); | |
4569 v28 = *((int *)v24 - 1); | |
4570 v105 = (&v86)[4 * v27]; | |
4571 v111 = v27 + 16; | |
4572 v29 = v4->uWidthMinus1; | |
4573 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4574 v107 = v29 >> v27; | |
4575 v30 = v28 >> i; | |
4576 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4577 v31 = *v114 >> i; | |
4578 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4579 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4580 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4581 v108 = (signed int)(v116 - v121) >> 4; |
4582 v103 = (v90 - v120) >> 4; | |
4583 v32 = v123 + 32; | |
4584 if ( LOBYTE(viewparams->field_20) ) | |
4585 v32 = v123 + 64; | |
4586 if ( v32 > v117 ) | |
4587 v32 = v117; | |
4588 v118 = v32; | |
4589 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4590 v106 = (signed int)(v32 - v123) >> 1; | |
4591 if ( v110 >> 16 == v100 >> 16 ) | |
4592 { | |
4593 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4594 if ( LOBYTE(viewparams->field_20) ) | |
4595 { | |
4596 v44 = v123; | |
4597 if ( v123 < v118 ) | |
4598 { | |
4599 v45 = v119; | |
4600 v46 = v122; | |
4601 v47 = v121; | |
4602 v48 = v120; | |
4603 v49 = v111; | |
4604 v50 = v109; | |
4605 if ( v106 & 2 ) | |
4606 { | |
4607 *v119 = v115; | |
4608 v45 -= 2; | |
4609 v44 = v123 + 4; | |
4610 goto LABEL_37; | |
4611 } | |
4612 do | |
4613 { | |
4614 v44 += 8; | |
4615 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4616 v52 = v115; | |
4617 LOWORD(v51) = v46[v51]; | |
4618 *v45 = v115; | |
4619 v45[1] = v52; | |
4620 v45[640] = v52; | |
4621 v45[641] = v52; | |
4622 *(short *)(v44 - 8) = v51; | |
4623 *(short *)(v44 - 6) = v51; | |
4624 *(short *)(v44 + 1272) = v51; | |
4625 *(short *)(v44 + 1274) = v51; | |
4626 v45[2] = v52; | |
4627 v45[3] = v52; | |
4628 v45[642] = v52; | |
4629 v45[643] = v52; | |
4630 v121 += v108; | |
4631 v120 += v103; | |
4632 v47 = v121; | |
4633 v48 = v120; | |
4634 LABEL_37: | |
4635 v45 += 4; | |
4636 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4637 v54 = v108; | |
4638 *(short *)(v44 - 4) = v53; | |
4639 *(short *)(v44 - 2) = v53; | |
4640 *(short *)(v44 + 1276) = v53; | |
4641 *(short *)(v44 + 1278) = v53; | |
4642 v121 += v54; | |
4643 v120 += v103; | |
4644 v47 = v121; | |
4645 v48 = v120; | |
4646 } | |
4647 while ( v44 < v118 ); | |
4648 v123 = v44; | |
4649 v119 = v45; | |
4650 } | |
4651 } | |
4652 else | |
4653 { | |
4654 v33 = v123; | |
4655 if ( v123 < v118 ) | |
4656 { | |
4657 v34 = v119; | |
4658 v35 = v122; | |
4659 v36 = v121; | |
4660 v37 = v120; | |
4661 v38 = v111; | |
4662 v39 = v109; | |
4663 if ( v106 & 1 ) | |
4664 { | |
4665 *v119 = v115; | |
4666 --v34; | |
4667 v33 = v123 + 2; | |
4668 goto LABEL_30; | |
4669 } | |
4670 do | |
4671 { | |
4672 v33 += 4; | |
4673 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4674 v41 = v115; | |
4675 LOWORD(v40) = v35[v40]; | |
4676 *v34 = v115; | |
4677 *(short *)(v33 - 4) = v40; | |
4678 v34[1] = v41; | |
4679 v121 += v108; | |
4680 v120 += v103; | |
4681 v36 = v121; | |
4682 v37 = v120; | |
4683 LABEL_30: | |
4684 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4685 v34 += 2; | |
4686 v43 = v108; | |
4687 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4688 v121 += v43; | |
4689 v120 += v103; | |
4690 v36 = v121; | |
4691 v37 = v120; | |
4692 } | |
4693 while ( v33 < v118 ); | |
4694 v123 = v33; | |
4695 v119 = v34; | |
4696 } | |
4697 } | |
4698 } | |
4699 else | |
4700 { | |
4701 v55 = v110 - ((v100 - v110) >> 4); | |
4702 v110 = (v100 - v110) >> 4; | |
4703 v122 = (unsigned __int16 *)v55; | |
4704 if ( LOBYTE(viewparams->field_20) ) | |
4705 { | |
4706 v71 = v123; | |
4707 if ( v123 < v118 ) | |
4708 { | |
4709 v72 = v119; | |
4710 v73 = v94; | |
4711 v74 = v121; | |
4712 v75 = v120; | |
4713 v76 = v111; | |
4714 v77 = v109; | |
4715 if ( v106 & 2 ) | |
4716 { | |
4717 *v119 = v115; | |
4718 v72 += 2; | |
4719 v71 = v123 + 4; | |
4720 goto LABEL_52; | |
4721 } | |
4722 do | |
4723 { | |
4724 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4725 v79 = (int)((char *)v122 + v110); | |
4726 v71 += 8; | |
4727 v122 = (unsigned __int16 *)v79; | |
4728 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4729 v81 = v115; | |
4730 LOWORD(v80) = v73[v80]; | |
4731 *v72 = v115; | |
4732 v72[1] = v81; | |
4733 v72[640] = v81; | |
4734 v72[641] = v81; | |
4735 *(short *)(v71 - 8) = v80; | |
4736 *(short *)(v71 - 6) = v80; | |
4737 *(short *)(v71 + 1272) = v80; | |
4738 *(short *)(v71 + 1274) = v80; | |
4739 v72[2] = v81; | |
4740 v72[3] = v81; | |
4741 v72[642] = v81; | |
4742 v72[643] = v81; | |
4743 v121 += v108; | |
4744 v120 += v103; | |
4745 v74 = v121; | |
4746 v75 = v120; | |
4747 v72 += 4; | |
4748 LABEL_52: | |
4749 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4750 v83 = (int)((char *)v122 + v110); | |
4751 v84 = v105[v82]; | |
4752 v122 = (unsigned __int16 *)v83; | |
4753 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4754 v85 = v108; | |
4755 *(short *)(v71 - 4) = v84; | |
4756 *(short *)(v71 - 2) = v84; | |
4757 *(short *)(v71 + 1276) = v84; | |
4758 *(short *)(v71 + 1278) = v84; | |
4759 v121 += v85; | |
4760 v120 += v103; | |
4761 v74 = v121; | |
4762 v75 = v120; | |
4763 } | |
4764 while ( v71 < v118 ); | |
4765 v123 = v71; | |
4766 v119 = v72; | |
4767 } | |
4768 } | |
4769 else | |
4770 { | |
4771 v56 = v123; | |
4772 if ( v123 < v118 ) | |
4773 { | |
4774 v57 = v119; | |
4775 v58 = v94; | |
4776 v59 = v121; | |
4777 v60 = v120; | |
4778 v61 = v111; | |
4779 v62 = v109; | |
4780 if ( v106 & 1 ) | |
4781 { | |
4782 *v119 = v115; | |
4783 ++v57; | |
4784 v56 = v123 + 2; | |
4785 goto LABEL_45; | |
4786 } | |
4787 do | |
4788 { | |
4789 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4790 v64 = (int)((char *)v122 + v110); | |
4791 v56 += 4; | |
4792 v122 = (unsigned __int16 *)v64; | |
4793 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4794 v66 = v115; | |
4795 LOWORD(v65) = v58[v65]; | |
4796 *v57 = v115; | |
4797 *(short *)(v56 - 4) = v65; | |
4798 v57[1] = v66; | |
4799 v121 += v108; | |
4800 v120 += v103; | |
4801 v59 = v121; | |
4802 v60 = v120; | |
4803 v57 += 2; | |
4804 LABEL_45: | |
4805 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4806 v68 = (int)((char *)v122 + v110); | |
4807 v69 = v105[v67]; | |
4808 v122 = (unsigned __int16 *)v68; | |
4809 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4810 v70 = v108; | |
4811 *(short *)(v56 - 2) = v69; | |
4812 v121 += v70; | |
4813 v120 += v103; | |
4814 v59 = v121; | |
4815 v60 = v120; | |
4816 } | |
4817 while ( v56 < v118 ); | |
4818 v123 = v56; | |
4819 v119 = v57; | |
4820 } | |
4821 } | |
4822 } | |
4823 v114 += 13; | |
4824 v110 = v100; | |
4825 a1 += 16; | |
4826 v4 = v96; | |
4827 v121 = v116; | |
4828 v120 = v90; | |
4829 if ( v123 >= v117 ) | |
4830 break; | |
4831 v24 = (char *)v114; | |
4832 v22 = stru_5C6E00; | |
4833 } | |
4834 } | |
4835 ++a2; | |
4836 v98 += v95; | |
4837 result = a2; | |
4838 v101 += 2; | |
4839 v99 += 640; | |
4840 if ( a2 > stru_F8A590._viewport_space_w ) | |
4841 break; | |
4842 v12 = v101; | |
4843 result = a2; | |
4844 v11 = v98; | |
4845 } | |
4846 } | |
4847 } | |
4848 } | |
4849 } | |
4850 } | |
4851 } | |
4852 } | |
4853 return result; | |
4854 } | |
4855 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4856 | |
4857 //----- (004ADD1D) -------------------------------------------------------- | |
4858 void __fastcall sub_4ADD1D(int uFaceID) | |
4859 { | |
4860 int v1; // edi@1 | |
4861 BLVFace *v2; // esi@3 | |
4862 signed int v3; // ebx@4 | |
4863 Texture *v4; // edi@9 | |
4864 signed int v5; // eax@9 | |
4865 char *v6; // edi@12 | |
4866 signed int v7; // eax@15 | |
4867 unsigned int v8; // eax@16 | |
4868 __int16 v9; // cx@19 | |
4869 unsigned __int8 *v10; // eax@19 | |
4870 unsigned __int16 *v11; // eax@19 | |
4871 int v12; // edi@19 | |
4872 int v13; // ebx@20 | |
4873 stru352 *v14; // esi@20 | |
4874 DWORD v15; // eax@22 | |
4875 signed int v16; // ecx@22 | |
4876 signed int v17; // ST68_4@22 | |
4877 int v18; // eax@22 | |
4878 int v19; // ecx@22 | |
4879 unsigned int v20; // esi@23 | |
4880 int v21; // edi@23 | |
4881 int v22; // eax@23 | |
4882 int *v23; // ebx@24 | |
4883 int v24; // edx@24 | |
4884 int v25; // ebx@25 | |
4885 unsigned __int16 v26; // cx@25 | |
4886 int v27; // edx@26 | |
4887 unsigned __int16 v28; // cx@26 | |
4888 unsigned __int8 v29; // sf@27 | |
4889 unsigned __int8 v30; // of@27 | |
4890 unsigned int v31; // esi@29 | |
4891 int v32; // edi@29 | |
4892 unsigned __int16 *v33; // eax@29 | |
4893 int *v34; // ebx@30 | |
4894 int v35; // edx@30 | |
4895 int v36; // ebx@31 | |
4896 unsigned __int16 v37; // cx@31 | |
4897 int v38; // edx@32 | |
4898 unsigned __int16 v39; // cx@32 | |
4899 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
4900 int v41; // [sp-Ch] [bp-68h]@15 | |
4901 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
4902 signed int v43; // [sp+14h] [bp-48h]@12 | |
4903 signed int v44; // [sp+14h] [bp-48h]@22 | |
4904 int v45; // [sp+1Ch] [bp-40h]@22 | |
4905 int v46; // [sp+20h] [bp-3Ch]@22 | |
4906 int v47; // [sp+24h] [bp-38h]@19 | |
4907 char v48; // [sp+28h] [bp-34h]@19 | |
4908 int v49; // [sp+2Ch] [bp-30h]@19 | |
4909 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
4910 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
4911 int v52; // [sp+38h] [bp-24h]@22 | |
4912 int v53; // [sp+3Ch] [bp-20h]@22 | |
4913 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
4914 int v55; // [sp+40h] [bp-1Ch]@20 | |
4915 int v56; // [sp+44h] [bp-18h]@20 | |
4916 stru352 *i; // [sp+48h] [bp-14h]@20 | |
4917 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
4918 int v59; // [sp+50h] [bp-Ch]@4 | |
4919 int v60; // [sp+50h] [bp-Ch]@19 | |
4920 int v61; // [sp+54h] [bp-8h]@22 | |
4921 int *v62; // [sp+58h] [bp-4h]@23 | |
4922 int *v63; // [sp+58h] [bp-4h]@29 | |
4923 | |
4924 v1 = uFaceID; | |
4925 v42 = pRenderer->uTargetSurfacePitch; | |
4926 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
4927 { | |
4928 v2 = &pIndoor->pFaces[uFaceID]; | |
4929 if ( pRenderer->pRenderD3D ) | |
4930 { | |
4931 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
4932 v59 = v3; | |
4933 } | |
4934 else | |
4935 { | |
4936 v59 = sub_423B5D(uFaceID); | |
4937 v3 = v59; | |
4938 } | |
4939 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
4940 { | |
4941 v4 = v2->GetTexture(); | |
4942 v5 = 0; | |
4943 if ( v4 ) | |
4944 { | |
4945 if ( pRenderer->pRenderD3D ) | |
4946 { | |
4947 if ( v3 > 0 ) | |
4948 { | |
4949 v54 = v3; | |
4950 v43 = v3; | |
4951 v6 = (char *)&array_507D30[0].v; | |
4952 do | |
4953 { | |
4954 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
4955 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
4956 v6 += 48; | |
4957 --v54; | |
4958 } | |
4959 while ( v54 ); | |
4960 v3 = v59; | |
4961 v5 = v43; | |
4962 } | |
4963 v7 = v5; | |
4964 v41 = stru_F8AD28.field_0; | |
4965 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
4966 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
4967 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
4968 { | |
4969 v40 = v2->GetTexture(); | |
4970 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
4971 } | |
4972 else | |
4973 { | |
4974 v40 = v2->GetTexture(); | |
4975 v8 = v2->uBitmapID; | |
4976 } | |
4977 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
4978 } | |
4979 else | |
4980 { | |
4981 v49 = v4->uWidthMinus1; | |
4982 v47 = v4->uHeightMinus1 << 16; | |
4983 v9 = 16 - v4->uWidthLn2; | |
710 | 4984 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4985 LOBYTE(v2->uAttributes) |= 0x80u; |
4986 v48 = v9; | |
4987 v50 = v10; | |
4988 sub_4AF412(); | |
4989 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
4990 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
4991 v12 = stru_F8A590._viewport_space_y; | |
4992 v51 = v11; | |
4993 v60 = stru_F8A590._viewport_space_y; | |
4994 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4995 { | |
4996 v13 = 2 * stru_F8A590._viewport_space_y; | |
4997 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
4998 v55 = 2 * stru_F8A590._viewport_space_y; | |
4999 v56 = 640 * stru_F8A590._viewport_space_y; | |
5000 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5001 { | |
5002 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5003 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5004 v15 = GetTickCount(); | |
5005 v16 = v14->field_0; | |
5006 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5007 v45 = v14->field_4 >> 3; | |
5008 v44 = v16 >> 3; | |
5009 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5010 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5011 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5012 v18 = v14->field_28; | |
5013 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5014 LOWORD(v18) = 0; | |
5015 v46 = stru_F8AD28.field_0 | v18; | |
5016 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5017 if ( LOBYTE(viewparams->field_20) ) | |
5018 { | |
5019 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5020 - pBLVRenderParams->uViewportX]; | |
5021 v31 = v44; | |
5022 v32 = v45; | |
5023 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5024 + 2 * v19 | |
5025 - pBLVRenderParams->uViewportX]; | |
5026 if ( v61 & 1 ) | |
5027 { | |
5028 --v61; | |
5029 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5030 + 2 * v19 | |
5031 - pBLVRenderParams->uViewportX | |
5032 - 2]; | |
5033 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5034 - pBLVRenderParams->uViewportX]; | |
5035 v35 = v46; | |
5036 v63 += 2; | |
5037 goto LABEL_32; | |
5038 } | |
5039 while ( 1 ) | |
5040 { | |
5041 v30 = __OFSUB__(v61, 2); | |
5042 v29 = v61 - 2 < 0; | |
5043 v61 -= 2; | |
5044 if ( v29 ^ v30 ) | |
5045 break; | |
5046 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5047 v31 += v52; | |
5048 v37 = v51[v36]; | |
5049 v32 += v53; | |
5050 v34 = v63; | |
5051 v35 = v46; | |
5052 *v33 = v37; | |
5053 v33[1] = v37; | |
5054 v33[640] = v37; | |
5055 v33[641] = v37; | |
5056 v63 += 4; | |
5057 v34[2] = v46; | |
5058 v34[3] = v46; | |
5059 v34[642] = v46; | |
5060 v34[643] = v46; | |
5061 LABEL_32: | |
5062 *v34 = v35; | |
5063 v34[1] = v35; | |
5064 v34[640] = v35; | |
5065 v34[641] = v35; | |
5066 v38 = v49 & (v31 >> 16); | |
5067 v33 += 4; | |
5068 v31 += v52; | |
5069 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5070 v32 += v53; | |
5071 *(v33 - 2) = v39; | |
5072 *(v33 - 1) = v39; | |
5073 v33[638] = v39; | |
5074 v33[639] = v39; | |
5075 } | |
5076 } | |
5077 else | |
5078 { | |
5079 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5080 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5081 v20 = v44; | |
5082 v21 = v45; | |
5083 v22 = (int)v58; | |
5084 if ( v61 & 1 ) | |
5085 { | |
5086 --v61; | |
5087 v22 = (int)(v58 - 1); | |
5088 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5089 v24 = v46; | |
5090 ++v62; | |
5091 goto LABEL_26; | |
5092 } | |
5093 while ( 1 ) | |
5094 { | |
5095 v30 = __OFSUB__(v61, 2); | |
5096 v29 = v61 - 2 < 0; | |
5097 v61 -= 2; | |
5098 if ( v29 ^ v30 ) | |
5099 break; | |
5100 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5101 v20 += v52; | |
5102 v26 = v51[v25]; | |
5103 v21 += v53; | |
5104 v23 = v62; | |
5105 v24 = v46; | |
5106 *(short *)v22 = v26; | |
5107 v62 += 2; | |
5108 v23[1] = v46; | |
5109 LABEL_26: | |
5110 *v23 = v24; | |
5111 v27 = v49 & (v20 >> 16); | |
5112 v22 += 4; | |
5113 v20 += v52; | |
5114 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5115 v21 += v53; | |
5116 *(short *)(v22 - 2) = v28; | |
5117 } | |
5118 } | |
5119 ++v60; | |
5120 ++i; | |
5121 v56 += 640; | |
5122 v55 += 2; | |
5123 if ( v60 > stru_F8A590._viewport_space_w ) | |
5124 break; | |
5125 v13 = v55; | |
5126 v12 = v60; | |
5127 } | |
5128 } | |
5129 } | |
5130 } | |
5131 } | |
5132 } | |
5133 } | |
5134 | |
5135 //----- (004AE1E7) -------------------------------------------------------- | |
5136 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5137 { | |
5138 int v3; // ebx@1 | |
5139 int v4; // edi@1 | |
5140 int v5; // esi@1 | |
5141 signed __int64 v6; // qtt@3 | |
5142 int v7; // esi@3 | |
5143 int v8; // eax@5 | |
5144 int result; // eax@5 | |
5145 int v10; // edx@5 | |
5146 int v11; // [sp+Ch] [bp-8h]@1 | |
5147 int v12; // [sp+1Ch] [bp+8h]@2 | |
5148 | |
5149 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5150 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5151 v11 = a1; | |
5152 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5153 + stru_F8AD28.field_7C | |
5154 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5155 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5156 { | |
5157 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5158 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5159 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5160 } | |
5161 else | |
5162 { | |
5163 v7 = 1073741824; | |
5164 } | |
5165 v8 = stru_F8AD28.vec_9C.z; | |
5166 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5167 + stru_F8AD28.vec_8C.x | |
5168 + v4 * stru_F8AD28.vec_8C.y) | |
5169 * (signed __int64)v7) >> 16) | |
5170 + stru_F8AD28.field_98; | |
5171 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5172 v10 = result + stru_F8AD28.field_A8; | |
5173 stru_F83B80[v11].field_28 = v7; | |
5174 stru_F83B80[v11].field_4 = v10; | |
5175 return result; | |
5176 } | |
5177 | |
5178 //----- (004AE313) -------------------------------------------------------- | |
5179 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5180 { | |
5181 int _dy; // ebx@1 | |
5182 int _dx; // edi@1 | |
5183 int v5; // ecx@1 | |
5184 int v6; // esi@1 | |
5185 int v7; // ST18_4@2 | |
5186 signed __int64 v8; // qtt@3 | |
5187 unsigned int v9; // ecx@3 | |
5188 int result; // eax@8 | |
5189 int v11; // [sp+Ch] [bp-8h]@1 | |
5190 | |
5191 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5192 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5193 ++pBLVRenderParams->field_88; | |
5194 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5195 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5196 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5197 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5198 { | |
5199 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5200 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5201 v9 = v8 / v11; | |
5202 } | |
5203 else | |
5204 { | |
5205 v9 = 0x40000000u; | |
5206 } | |
5207 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5208 p->field_0 = v9; | |
5209 else | |
5210 p->field_0 = stru_F8AD28.field_34; | |
5211 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5212 * (signed __int64)(signed int)v9) >> 16) | |
5213 + stru_F8AD28.field_98 | |
5214 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5215 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5216 * (signed __int64)(signed int)v9) >> 16) | |
5217 + stru_F8AD28.field_A8 | |
5218 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5219 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5220 if ( result < 369620 || bUseLoResSprites ) | |
5221 { | |
5222 if ( result < 184810 ) | |
5223 p->field_10 = result > 92405; | |
5224 else | |
5225 p->field_10 = 2; | |
5226 } | |
5227 else | |
5228 { | |
5229 p->field_10 = 3; | |
5230 } | |
5231 return result; | |
5232 } | |
5233 | |
5234 //----- (004AE491) -------------------------------------------------------- | |
5235 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5236 { | |
5237 signed int v2; // eax@1 | |
5238 signed int v3; // edi@1 | |
5239 int v4; // ecx@1 | |
5240 int v5; // esi@2 | |
5241 int v6; // eax@2 | |
5242 int v7; // ebx@2 | |
5243 unsigned int v8; // ecx@2 | |
5244 int v9; // edx@5 | |
5245 int v10; // edx@7 | |
5246 unsigned int v11; // eax@8 | |
5247 int v13; // [sp+4h] [bp-18h]@2 | |
5248 int v14; // [sp+8h] [bp-14h]@2 | |
5249 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5250 int v16; // [sp+14h] [bp-8h]@1 | |
5251 int v17; // [sp+18h] [bp-4h]@1 | |
5252 | |
5253 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5254 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5255 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5256 v4 = 0; | |
5257 v15 = v2; | |
5258 v16 = 0; | |
5259 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5260 { | |
5261 do | |
5262 { | |
5263 v5 = v16; | |
5264 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5265 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5266 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5267 v7 = v13; | |
5268 v8 = v14; | |
5269 if ( v6 < v13 ) | |
5270 { | |
5271 v6 = v13; | |
5272 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5273 } | |
5274 if ( v6 < v14 ) | |
5275 { | |
5276 v9 = v6; | |
5277 v6 = v14; | |
5278 v8 = v9; | |
5279 } | |
5280 if ( v7 < (signed int)v8 ) | |
5281 { | |
5282 v10 = v8; | |
5283 v8 = v7; | |
5284 v7 = v10; | |
5285 } | |
5286 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5287 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5288 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5289 ++v16; | |
5290 v2 = v15; | |
5291 } | |
5292 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5293 v4 = 0; | |
5294 } | |
5295 if ( stru_F8AD28.field_3E4 != v4 ) | |
5296 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5297 if ( v17 >= v4 ) | |
5298 { | |
5299 if ( v17 > 2031616 ) | |
5300 v17 = 2031616; | |
5301 } | |
5302 else | |
5303 { | |
5304 v17 = v4; | |
5305 } | |
5306 ++pBLVRenderParams->field_8C; | |
5307 return v17; | |
5308 } | |
5309 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5310 | |
5311 //----- (004AE5F1) -------------------------------------------------------- | |
5312 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5313 { | |
5314 BLVFace *v1; // esi@1 | |
5315 BLVFaceExtra *v2; // ebx@1 | |
5316 int v3; // eax@1 | |
5317 int v4; // edi@1 | |
5318 Texture *v5; // edi@1 | |
5319 int v6; // eax@1 | |
5320 unsigned int v7; // eax@1 | |
5321 unsigned int v8; // ecx@1 | |
5322 unsigned int v9; // eax@1 | |
5323 unsigned int v10; // ecx@5 | |
5324 int v11; // edi@10 | |
5325 int v12; // ecx@10 | |
5326 int v13; // eax@10 | |
5327 int v14; // edx@10 | |
5328 int v15; // ebx@12 | |
5329 double v16; // st7@16 | |
5330 int v17; // eax@16 | |
5331 char *v18; // ebx@17 | |
5332 int v19; // ecx@19 | |
5333 int v20; // eax@19 | |
5334 int v21; // edx@21 | |
5335 int v22; // eax@23 | |
5336 int v23; // ST04_4@26 | |
5337 int v24; // edi@26 | |
5338 double v25; // st6@26 | |
5339 int v26; // eax@26 | |
5340 double v27; // st6@26 | |
5341 int v28; // ecx@26 | |
5342 char v29; // al@26 | |
5343 int v30; // edx@28 | |
5344 int v31; // ecx@28 | |
5345 BLVLightMM7 *v32; // ecx@32 | |
5346 int v33; // edi@33 | |
5347 int v34; // edx@33 | |
5348 int v35; // eax@33 | |
5349 int v36; // edi@35 | |
5350 int v37; // edx@37 | |
5351 int v38; // ebx@39 | |
5352 int v39; // edi@42 | |
5353 int v40; // eax@42 | |
5354 char *v41; // ebx@45 | |
5355 signed int v42; // ecx@47 | |
5356 int v43; // edi@47 | |
5357 int v44; // eax@49 | |
5358 int v45; // edx@51 | |
5359 int v46; // eax@53 | |
5360 int v47; // ST04_4@55 | |
5361 int v48; // edi@55 | |
5362 double v49; // st6@55 | |
5363 int v50; // eax@55 | |
5364 double v51; // st6@55 | |
5365 int v52; // eax@55 | |
5366 int v53; // ecx@57 | |
5367 int v54; // ecx@58 | |
5368 int v55; // ecx@59 | |
5369 int v56; // edx@62 | |
5370 int v57; // ecx@62 | |
5371 int v58; // eax@63 | |
5372 int v59; // edx@64 | |
5373 int v60; // ecx@67 | |
5374 int v61; // edx@67 | |
5375 int v62; // eax@68 | |
5376 int v63; // edx@69 | |
5377 signed int v64; // ecx@72 | |
5378 double v65; // st7@75 | |
5379 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5380 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5381 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5382 int v69; // [sp+28h] [bp-18h]@10 | |
5383 int v70; // [sp+2Ch] [bp-14h]@10 | |
5384 int X; // [sp+30h] [bp-10h]@10 | |
5385 int v72; // [sp+34h] [bp-Ch]@10 | |
5386 int v73; // [sp+38h] [bp-8h]@10 | |
5387 int v74; // [sp+3Ch] [bp-4h]@10 | |
5388 | |
5389 v1 = &pIndoor->pFaces[uFaceID]; | |
5390 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5391 v3 = v1->uBitmapID; | |
5392 v4 = v1->uBitmapID; | |
5393 v68 = v2; | |
5394 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5395 v6 = 8 * uFaceID; | |
862 | 5396 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5397 stru_F8AD28.field_0 = v6; |
5398 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5399 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5400 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5401 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5402 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5403 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5404 v7 = GetTickCount(); | |
5405 v8 = v1->uAttributes; | |
5406 v9 = v7 >> 3; | |
5407 if ( v8 & 4 ) | |
5408 { | |
5409 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5410 } | |
5411 else | |
5412 { | |
5413 if ( v8 & 0x20 ) | |
5414 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5415 } | |
5416 v10 = v1->uAttributes; | |
5417 if ( BYTE1(v10) & 8 ) | |
5418 { | |
5419 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5420 } | |
5421 else | |
5422 { | |
5423 if ( v10 & 0x40 ) | |
5424 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5425 } | |
5426 v1->_get_normals(&v67, &v66); | |
5427 stru_F8AD28.vec_14.x = v67.x; | |
5428 stru_F8AD28.vec_14.y = v67.y; | |
5429 stru_F8AD28.vec_14.z = v67.z; | |
5430 stru_F8AD28.vec_20.x = v66.x; | |
5431 stru_F8AD28.vec_20.y = v66.y; | |
5432 stru_F8AD28.vec_20.z = v66.z; | |
5433 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5434 if ( pBLVRenderParams->sPartyRotX ) | |
5435 { | |
5436 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5437 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5438 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5439 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5440 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5441 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5442 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5443 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5444 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5445 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5446 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5447 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5448 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5449 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5450 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5451 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5452 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5453 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5454 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5455 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5456 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5457 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5458 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5459 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5460 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5461 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5462 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5463 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5464 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5465 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5466 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5467 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5468 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5469 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5470 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5471 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5472 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5473 v13 = pBLVRenderParams->vPartyPos.y; | |
5474 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5475 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5476 v14 = pBLVRenderParams->vPartyPos.x; | |
5477 } | |
5478 else | |
5479 { | |
5480 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5481 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5482 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5483 - v70; | |
5484 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5485 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5486 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5487 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5488 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5489 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5490 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5491 - v70; | |
5492 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5493 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5494 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5495 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5496 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5497 - v70; | |
5498 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5499 v14 = pBLVRenderParams->vPartyPos.x; | |
5500 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5501 v13 = pBLVRenderParams->vPartyPos.y; | |
5502 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5503 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5504 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5505 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5506 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5507 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5508 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5509 } | |
5510 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5511 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5512 + stru_F8AD28.plane_4.dist | |
5513 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5514 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5515 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5516 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5517 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5518 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5519 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5520 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5521 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5522 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5523 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5524 v15 = v70; | |
5525 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5526 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5527 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5528 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5529 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5530 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5531 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5532 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5533 stru_F8AD28.field_38 = 0; | |
5534 stru_F8AD28.field_A8 = -(X | |
5535 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5536 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5537 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5538 { | |
5539 stru_F8AD28.field_3E4 = 1; | |
5540 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5541 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5542 stru_F8AD28.field_3F0 = v68->field_1E; | |
5543 stru_F8AD28.field_3F4 = v68->field_20; | |
5544 } | |
5545 else | |
5546 { | |
5547 stru_F8AD28.field_3E4 = 0; | |
5548 } | |
5549 v16 = 0.0039215689; | |
5550 v17 = 116 * v1->uSectorID; | |
5551 v69 = v17; | |
5552 v74 = 0; | |
5553 v73 = 0; | |
5554 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5555 v70 = pMobileLightsStack->uNumLightsActive; | |
5556 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5557 { | |
5558 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5559 do | |
5560 { | |
5561 if ( v74 >= 20 ) | |
5562 break; | |
5563 v19 = *((short *)v18 + 2); | |
5564 v20 = *((short *)v18 - 1); | |
5565 if ( v20 > v1->pBounding.x1 - v19 ) | |
5566 { | |
5567 if ( v20 < v19 + v1->pBounding.x2 ) | |
5568 { | |
5569 v21 = *(short *)v18; | |
5570 if ( v21 > v1->pBounding.y1 - v19 ) | |
5571 { | |
5572 if ( v21 < v19 + v1->pBounding.y2 ) | |
5573 { | |
5574 v22 = *((short *)v18 + 1); | |
5575 if ( v22 > v1->pBounding.z1 - v19 ) | |
5576 { | |
5577 if ( v22 < v19 + v1->pBounding.z2 ) | |
5578 { | |
5579 X = (v1->pFacePlane_old.dist | |
5580 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5581 + v21 * v1->pFacePlane_old.vNormal.y | |
5582 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5583 if ( X <= v19 ) | |
5584 { | |
5585 v23 = X; | |
5586 v24 = v74; | |
5587 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5588 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5589 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5590 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5591 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5592 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5593 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5594 v25 = (double)(signed int)v68 * v16; | |
5595 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5596 v26 = (unsigned __int8)v18[8]; | |
5597 *(float *)(v24 * 4 + 16297992) = v25; | |
5598 v27 = (double)(signed int)v68; | |
5599 v68 = (BLVFaceExtra *)v26; | |
5600 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5601 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5602 v16 = 0.0039215689; | |
5603 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5604 v28 = v74; | |
5605 v29 = v18[9]; | |
5606 ++v74; | |
5607 stru_F8AD28._blv_lights_types[v28] = v29; | |
5608 } | |
5609 } | |
5610 } | |
5611 } | |
5612 } | |
5613 } | |
5614 } | |
5615 ++v73; | |
5616 v18 += 18; | |
5617 v17 = v69; | |
5618 } | |
5619 while ( v73 < v70 ); | |
5620 } | |
5621 v30 = 0; | |
5622 v73 = 0; | |
5623 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5624 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5625 if ( v31 > 0 ) | |
5626 { | |
5627 while ( v74 < 20 ) | |
5628 { | |
5629 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5630 if ( !(v32->uAtributes & 8) ) | |
5631 { | |
5632 v33 = v1->pBounding.x1; | |
5633 v34 = v32->vPosition.x; | |
5634 X = v32->uBrightness; | |
5635 v35 = v32->uRadius; | |
5636 v68 = (BLVFaceExtra *)v32->uRadius; | |
5637 if ( v34 > v33 - v35 ) | |
5638 { | |
5639 if ( v34 < v35 + v1->pBounding.x2 ) | |
5640 { | |
5641 v36 = v32->vPosition.y; | |
5642 if ( v36 > v1->pBounding.y1 - v35 ) | |
5643 { | |
5644 if ( v36 < v35 + v1->pBounding.y2 ) | |
5645 { | |
5646 v37 = v32->vPosition.z; | |
5647 if ( v37 > v1->pBounding.z1 - v35 ) | |
5648 { | |
5649 if ( v37 < v35 + v1->pBounding.z2 ) | |
5650 { | |
5651 v38 = (v1->pFacePlane_old.dist | |
5652 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5653 + v37 * v1->pFacePlane_old.vNormal.z | |
5654 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5655 if ( v38 >= 0 ) | |
5656 { | |
5657 if ( v38 <= v35 && v35 ) | |
5658 { | |
5659 v39 = v74; | |
5660 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5661 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5662 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5663 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5664 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5665 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5666 v68 = (BLVFaceExtra *)v32->uRed; | |
5667 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5668 v68 = (BLVFaceExtra *)v32->uGreen; | |
5669 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5670 v68 = (BLVFaceExtra *)v32->uBlue; | |
5671 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5672 v16 = 0.0039215689; | |
5673 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5674 v40 = v74++; | |
5675 stru_F8AD28._blv_lights_types[v40] = 1; | |
5676 } | |
5677 } | |
5678 } | |
5679 } | |
5680 } | |
5681 } | |
5682 } | |
5683 } | |
5684 } | |
5685 v30 = v73++ + 1; | |
5686 if ( v73 >= v70 ) | |
5687 break; | |
5688 v17 = v69; | |
5689 } | |
5690 } | |
5691 v73 = 0; | |
5692 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5693 { | |
5694 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5695 do | |
5696 { | |
5697 if ( v74 >= 20 ) | |
5698 break; | |
5699 v42 = *((short *)v41 + 2); | |
5700 v43 = *((short *)v41 - 1); | |
5701 if ( v43 > v1->pBounding.x1 - v42 ) | |
5702 { | |
5703 if ( v43 < v42 + v1->pBounding.x2 ) | |
5704 { | |
5705 v44 = *(short *)v41; | |
5706 if ( v44 > v1->pBounding.y1 - v42 ) | |
5707 { | |
5708 if ( v44 < v42 + v1->pBounding.y2 ) | |
5709 { | |
5710 v45 = *((short *)v41 + 1); | |
5711 if ( v45 > v1->pBounding.z1 - v42 ) | |
5712 { | |
5713 if ( v45 < v42 + v1->pBounding.z2 ) | |
5714 { | |
5715 v46 = (v1->pFacePlane_old.dist | |
5716 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5717 + v43 * v1->pFacePlane_old.vNormal.x | |
5718 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5719 v69 = v46; | |
5720 if ( v46 >= 0 ) | |
5721 { | |
5722 if ( v46 <= v42 ) | |
5723 { | |
5724 v47 = v69; | |
5725 v48 = v74; | |
5726 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5727 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5728 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5729 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5730 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5731 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5732 v49 = (double)(signed int)v68 * v16; | |
5733 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5734 v50 = (unsigned __int8)v41[8]; | |
5735 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5736 v51 = (double)(signed int)v68; | |
5737 v68 = (BLVFaceExtra *)v50; | |
5738 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5739 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5740 v16 = 0.0039215689; | |
5741 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5742 v52 = v74++; | |
5743 stru_F8AD28._blv_lights_types[v52] = 1; | |
5744 } | |
5745 } | |
5746 } | |
5747 } | |
5748 } | |
5749 } | |
5750 } | |
5751 } | |
5752 ++v73; | |
5753 v41 += 12; | |
5754 } | |
5755 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5756 } | |
5757 stru_F8AD28.uNumLightsApplied = v74; | |
5758 v53 = v1->pBounding.x2; | |
5759 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5760 { | |
5761 v55 = v1->pBounding.x1; | |
5762 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5763 v54 = 0; | |
5764 else | |
5765 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5766 } | |
5767 else | |
5768 { | |
5769 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5770 } | |
5771 v56 = v1->pBounding.y2; | |
5772 v57 = v54 * v54; | |
5773 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5774 { | |
5775 v59 = v1->pBounding.y1; | |
5776 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5777 v58 = 0; | |
5778 else | |
5779 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5780 } | |
5781 else | |
5782 { | |
5783 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5784 } | |
5785 v60 = v58 * v58 + v57; | |
5786 v61 = v1->pBounding.z2; | |
5787 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5788 { | |
5789 v63 = v1->pBounding.z1; | |
5790 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5791 v62 = 0; | |
5792 else | |
5793 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5794 } | |
5795 else | |
5796 { | |
5797 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5798 } | |
5799 v64 = v62 * v62 + v60; | |
5800 if ( v64 ) | |
295 | 5801 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5802 else |
5803 stru_F8AD28.field_34 = 0; | |
5804 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5805 v65 = (double)(signed int)v68; | |
5806 if ( v65 >= 655.36 ) | |
5807 { | |
5808 if ( v65 >= 26214.4 ) | |
5809 { | |
5810 if ( v65 >= 45875.2 ) | |
5811 { | |
5812 stru_F8AD28.field_44 = 8; | |
5813 stru_F8AD28.field_48 = 3; | |
5814 } | |
5815 else | |
5816 { | |
5817 stru_F8AD28.field_44 = 16; | |
5818 stru_F8AD28.field_48 = 4; | |
5819 } | |
5820 } | |
5821 else | |
5822 { | |
5823 stru_F8AD28.field_44 = 32; | |
5824 stru_F8AD28.field_48 = 5; | |
5825 } | |
5826 } | |
5827 else | |
5828 { | |
5829 stru_F8AD28.field_44 = 64; | |
5830 stru_F8AD28.field_48 = 6; | |
5831 } | |
5832 } | |
5833 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5834 | |
5835 //----- (004AF412) -------------------------------------------------------- | |
5836 int __cdecl sub_4AF412() | |
5837 { | |
5838 int v0; // ST20_4@2 | |
5839 int v1; // ST20_4@2 | |
5840 int v2; // ST20_4@2 | |
5841 int v3; // esi@2 | |
5842 int v4; // ST20_4@2 | |
5843 int v5; // ecx@2 | |
5844 int v6; // ebx@2 | |
5845 int v7; // edi@2 | |
5846 int v8; // edx@2 | |
5847 int v9; // eax@2 | |
5848 int result; // eax@4 | |
5849 | |
5850 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5851 stru_F8AD28.vec_20.y = -65536; | |
5852 stru_F8AD28.plane_4.vNormal.x = 0; | |
5853 stru_F8AD28.plane_4.vNormal.y = 0; | |
5854 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5855 stru_F8AD28.vec_14.x = 65536; | |
5856 stru_F8AD28.vec_14.y = 0; | |
5857 stru_F8AD28.vec_14.z = 0; | |
5858 stru_F8AD28.vec_20.x = 0; | |
5859 stru_F8AD28.vec_20.z = 0; | |
5860 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5861 if ( pBLVRenderParams->sPartyRotX ) | |
5862 { | |
5863 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5864 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5865 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5866 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5867 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5868 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5869 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5870 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5871 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5872 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5873 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5874 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5875 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5876 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5877 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5878 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5879 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5880 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5881 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5882 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5883 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5884 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5885 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5886 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5887 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5888 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5889 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5890 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5891 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5892 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5893 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5894 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5895 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5896 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5897 v6 = pBLVRenderParams->vPartyPos.z; | |
5898 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5899 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5900 v8 = pBLVRenderParams->vPartyPos.y; | |
5901 v9 = pBLVRenderParams->vPartyPos.x; | |
5902 } | |
5903 else | |
5904 { | |
5905 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5906 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5907 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5908 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5909 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5910 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5911 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5912 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5913 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5914 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5915 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5916 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5917 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5918 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5919 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5920 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5921 v8 = pBLVRenderParams->vPartyPos.y; | |
5922 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5923 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5924 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5925 v9 = pBLVRenderParams->vPartyPos.x; | |
5926 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5927 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5928 v6 = pBLVRenderParams->vPartyPos.z; | |
5929 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5930 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5931 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5932 } | |
5933 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5934 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
5935 + stru_F8AD28.plane_4.dist | |
5936 + stru_F8AD28.plane_4.vNormal.x * v9 | |
5937 + stru_F8AD28.plane_4.vNormal.z * v6; | |
5938 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5939 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5940 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5941 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5942 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5943 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5944 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5945 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5946 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5947 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
5948 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
5949 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
5950 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5951 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5952 result = 0; | |
5953 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
5954 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
5955 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
5956 stru_F8AD28.field_38 = 0; | |
5957 stru_F8AD28.field_3E4 = 0; | |
5958 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
5959 stru_F8AD28.uNumLightsApplied = 0; | |
5960 stru_F8AD28.field_34 = 0; | |
5961 return result; | |
5962 } | |
5963 | |
5964 //----- (004B1447) -------------------------------------------------------- | |
5965 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
5966 { | |
5967 signed int v3; // esi@1 | |
5968 char v4; // sf@8 | |
5969 int v5; // eax@8 | |
5970 unsigned __int64 v6; // qax@12 | |
5971 DDM_DLV_Header *v7; // eax@14 | |
5972 Player **v8; // edi@18 | |
5973 Player *result; // eax@19 | |
735 | 5974 //char *v10; // esi@20 |
0 | 5975 |
5976 v3 = 0; | |
5977 if ( a2 ) | |
5978 { | |
5979 if ( a2 != 1 ) | |
5980 { | |
5981 if ( a2 == 2 ) | |
5982 v3 = 2; | |
5983 goto LABEL_13; | |
5984 } | |
5985 v3 = 2; | |
5986 } | |
5987 else | |
5988 { | |
5989 v3 = 1; | |
5990 } | |
5991 if ( pParty->uFine < 4000000 ) | |
5992 { | |
5993 v4 = a3 + pParty->uFine < 0; | |
5994 v5 = a3 + pParty->uFine; | |
5995 pParty->uFine += a3; | |
5996 if ( v4 ) | |
5997 { | |
5998 v5 = 0; | |
5999 pParty->uFine = 0; | |
6000 } | |
6001 if ( v5 > 4000000 ) | |
6002 pParty->uFine = 4000000; | |
6003 } | |
487 | 6004 |
6005 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6006 | |
0 | 6007 LABEL_13: |
463 | 6008 pParty->InTheShopFlags[a1] = 1; |
0 | 6009 if ( v3 ) |
6010 { | |
6011 v7 = &pOutdoor->ddm; | |
6012 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6013 v7 = &pIndoor->dlv; | |
6014 v7->uReputation += v3; | |
6015 if ( v7->uReputation > 10000 ) | |
6016 v7->uReputation = 10000; | |
6017 } | |
6018 v8 = &pPlayers[1]; | |
6019 do | |
6020 { | |
6021 result = *v8; | |
6022 if ( pParty->uFine ) | |
6023 { | |
735 | 6024 //v10 = result->_guilds_member_bits; |
484 | 6025 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6026 if ( !(short)result ) |
735 | 6027 __debugbreak(); |
501 | 6028 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6029 } |
6030 ++v8; | |
6031 } | |
6032 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6033 return result; | |
6034 } | |
6035 | |
6036 //----- (004B1523) -------------------------------------------------------- | |
762 | 6037 void __thiscall sub_4B1523(int *_this) |
0 | 6038 { |
6039 int v1; // esi@1 | |
6040 int v2; // edx@1 | |
6041 unsigned int v3; // eax@2 | |
6042 int v4; // eax@4 | |
6043 LONG v5; // ecx@4 | |
6044 int v6; // eax@10 | |
6045 char *v7; // ST44_4@12 | |
6046 unsigned __int16 v8; // ax@12 | |
6047 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6048 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6049 POINT a2; // [sp+64h] [bp-10h]@1 | |
6050 int v13; // [sp+6Ch] [bp-8h]@4 | |
6051 int v14; // [sp+70h] [bp-4h]@4 | |
6052 | |
6053 v1 = *_this - 399; | |
6054 v2 = (*_this - 400) % 11 + 1; | |
6055 v11 = 4 * (*_this - 400) / 11; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6056 sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); |
0 | 6057 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) |
6058 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6059 else | |
6060 v3 = 30; | |
6061 a1.Hint = 0; | |
6062 a1.uFrameY = v3; | |
6063 a1.uFrameWidth = 328; | |
6064 a1.uFrameHeight = 68; | |
6065 a1.uFrameX = 90; | |
6066 a1.uFrameZ = 417; | |
6067 a1.uFrameW = v3 + 67; | |
6068 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6069 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6070 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6071 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6072 v5 = a2.y; | |
6073 if ( v14 > a2.y ) | |
6074 v5 = v14; | |
6075 if ( v13 > v5 ) | |
6076 v5 = v13; | |
6077 if ( v4 > v5 ) | |
6078 v5 = v4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6079 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 | 6080 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" |
6081 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6082 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6083 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6084 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
|
6085 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); |
0 | 6086 a1.uFrameHeight += v6; |
6087 if ( (signed int)a1.uFrameHeight < 150 ) | |
6088 a1.uFrameHeight = 150; | |
819 | 6089 a1.uFrameWidth = game_viewport_width; |
0 | 6090 a1.DrawMessageBox(0); |
6091 a1.uFrameWidth -= 12; | |
6092 a1.uFrameHeight -= 12; | |
6093 v7 = pSpellStats->pInfos[v1].pName; | |
6094 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6095 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6096 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6097 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
|
6098 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); |
0 | 6099 a1.uFrameZ = a1.uFrameX + 107; |
6100 a1.uFrameWidth = 108; | |
6101 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
|
6102 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
|
6103 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); |
0 | 6104 } |
6105 | |
6106 //----- (004B1784) -------------------------------------------------------- | |
6107 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6108 { | |
6109 Player *pPlayer; // ebx@1 | |
6110 bool result; // eax@2 | |
6111 unsigned __int16 v2; // ST0C_2@3 | |
6112 int v3; // eax@3 | |
6113 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6114 | |
6115 pPlayer = pPlayers[uActiveCharacter]; | |
6116 if ( pPlayer->CanAct() ) | |
6117 { | |
6118 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6119 result = 1; | |
6120 } | |
6121 else | |
6122 { | |
6123 pDialogueWindow->pNumPresenceButton = 0; | |
6124 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6125 v4.uFrameX = 483; | |
6126 v4.uFrameWidth = 148; | |
6127 v4.uFrameZ = 334; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6128 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// |
0 | 6129 // "%s is in no condition to %s" |
6130 // "do anything" | |
949 | 6131 v2 = TargetColor(255, 255, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6132 v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6133 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf.data(), 3u); |
0 | 6134 result = 0; |
6135 } | |
6136 return result; | |
6137 } | |
6138 // F8B1E0: using guessed type int dword_F8B1E0; | |
6139 | |
6140 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6141 void __cdecl ShowPopupShopItem() |
0 | 6142 { |
6143 POINT *v1; // esi@5 | |
6144 unsigned int v2; // eax@5 | |
6145 int v3; // ecx@5 | |
6146 POINT *v4; // esi@12 | |
6147 int v5; // eax@12 | |
6148 unsigned int v6; // eax@13 | |
6149 ItemGen *v7; // ecx@13 | |
6150 signed int v8; // esi@17 | |
6151 unsigned int v9; // eax@19 | |
475 | 6152 POINT v10; // [sp+8h] [bp-44h]@12 |
6153 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6154 POINT v12; // [sp+18h] [bp-34h]@18 | |
6155 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6156 POINT v14; // [sp+28h] [bp-24h]@17 | |
6157 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6158 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6159 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6160 |
484 | 6161 if ( in_current_building_type <= 0 ) |
0 | 6162 return; |
484 | 6163 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6164 { |
749 | 6165 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6166 { | |
6167 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6168 return; |
749 | 6169 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6170 { |
475 | 6171 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6172 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6173 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6174 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6175 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6176 return; |
907 | 6177 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6178 return; |
6179 } | |
749 | 6180 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6181 return; |
6182 } | |
475 | 6183 v4 = pMouse->GetCursorPos(&v11); |
6184 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6185 if ( !v5 ) |
6186 return; | |
336 | 6187 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6188 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6189 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6190 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6191 GameUI_DrawItemInfo(v7); | |
6192 return; | |
0 | 6193 } |
874 | 6194 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6195 { |
6196 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6197 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6198 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6199 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6200 if ( v5 ) | |
336 | 6201 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6202 } |
6203 } | |
6204 // F8B198: using guessed type int dword_F8B198; | |
6205 // F8B19C: using guessed type int dword_F8B19C; | |
6206 | |
6207 //----- (004B1BDB) -------------------------------------------------------- | |
6208 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6209 { | |
6210 signed __int64 v1; // ST2C_8@1 | |
6211 signed __int64 v2; // qax@1 | |
6212 signed __int64 v3; // ST1C_8@1 | |
6213 unsigned __int64 v4; // qax@1 | |
6214 unsigned int v5; // ebx@1 | |
112 | 6215 Player *v6; // ebx@1 |
0 | 6216 |
6217 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6218 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6219 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6220 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6221 v2 = v1 / 60 / 60; | |
6222 v3 = v2; | |
6223 v4 = (unsigned int)v2 / 0x18; | |
6224 v5 = (unsigned int)(v4 / 7) >> 2; | |
6225 pParty->uCurrentTimeSecond = v1 % 60; | |
6226 pParty->uCurrentMinute = v1 / 60 % 60; | |
6227 pParty->uCurrentHour = v3 % 24; | |
6228 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6229 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6230 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6231 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6232 pParty->RestAndHeal(); |
6233 dword_507B94 = 1; | |
112 | 6234 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6235 do |
6236 { | |
112 | 6237 v6->uTimeToRecovery = 0; |
6238 memset(&v6->uTimeToRecovery, 0, 4u); | |
6239 ++v6; | |
6240 } | |
6241 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6242 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6243 } |
6244 // 507B94: using guessed type int dword_507B94; | |
6245 | |
6246 //----- (004B1D27) -------------------------------------------------------- | |
6247 void __cdecl sub_4B1D27() | |
6248 { | |
6249 int v0; // edx@2 | |
6250 unsigned int v1; // ecx@7 | |
6251 signed int v2; // edi@10 | |
6252 int v3; // esi@10 | |
6253 __int16 v4; // ax@15 | |
6254 signed int v5; // edi@20 | |
6255 int v6; // esi@20 | |
6256 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6257 | |
484 | 6258 if ( in_current_building_type > 0 ) |
0 | 6259 { |
6260 v0 = 3; | |
484 | 6261 if ( in_current_building_type > BildingType_MagicShop ) |
6262 { | |
6263 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6264 { |
6265 if ( !dword_F8B1E4 ) | |
6266 return; | |
6267 } | |
6268 else | |
6269 { | |
484 | 6270 if ( in_current_building_type != BildingType_Temple ) |
0 | 6271 return; |
6272 } | |
336 | 6273 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6274 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6275 return; |
6276 } | |
336 | 6277 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6278 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6279 { |
6280 if ( pParty->uNumGold <= 0x2710 ) | |
6281 { | |
6282 if ( !dword_F8B1E4 ) | |
6283 return; | |
6284 v0 = 4; | |
907 | 6285 PlayHouseSound(v1, (HouseSoundID)v0); |
6286 return; | |
0 | 6287 } |
735 | 6288 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6289 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6290 { | |
6291 v5 = 0; | |
6292 v6 = 1; | |
6293 do | |
6294 { | |
6295 if ( pPlayers[v6]->CanAct() ) | |
6296 v7[v5++] = v6; | |
6297 ++v6; | |
6298 } | |
6299 while ( v6 <= 4 ); | |
6300 if ( v5 ) | |
6301 { | |
6302 qword_A750D8 = 256i64; | |
6303 word_A750E0 = 80; | |
6304 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6305 word_A750E2 = v4; |
6306 return; | |
0 | 6307 } |
6308 } | |
6309 } | |
6310 else | |
6311 { | |
6312 if ( !qword_A750D8 ) | |
6313 { | |
6314 v2 = 0; | |
6315 v3 = 1; | |
6316 do | |
6317 { | |
6318 if ( pPlayers[v3]->CanAct() ) | |
6319 v7[v2++] = v3; | |
6320 ++v3; | |
6321 } | |
6322 while ( v3 <= 4 ); | |
6323 if ( v2 ) | |
6324 { | |
6325 qword_A750D8 = 256i64; | |
6326 word_A750E0 = 80; | |
6327 v4 = LOWORD(v7[rand() % v2]); | |
6328 word_A750E2 = v4; | |
6329 return; | |
6330 } | |
6331 } | |
6332 } | |
6333 } | |
6334 } | |
6335 | |
6336 //----- (004B1ECE) -------------------------------------------------------- | |
6337 void __cdecl sub_4B1ECE() | |
6338 { | |
6339 __int16 *v0; // edi@1 | |
6340 int v1; // ebx@3 | |
6341 Player *v2; // esi@3 | |
6342 int v3; // eax@4 | |
6343 signed int v4; // eax@9 | |
6344 int v5; // ebx@11 | |
89 | 6345 Player *v6; // esi@13 |
6346 ItemGen *v7; // eax@14 | |
0 | 6347 signed int v8; // edi@14 |
89 | 6348 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6349 signed int v10; // [sp+10h] [bp-8h]@13 |
6350 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6351 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6352 |
484 | 6353 contract_approved = 0; |
0 | 6354 v11 = 0; |
6355 uDialogueType = 84; | |
827 | 6356 current_npc_text = (char *)pNPCTopics[667].pText; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6357 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data(); |
0 | 6358 while ( 1 ) |
6359 { | |
484 | 6360 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6361 { |
6362 v1 = 0; | |
6363 v2 = pParty->pPlayers; | |
6364 do | |
6365 { | |
89 | 6366 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6367 if ( v3 ) |
6368 break; | |
6369 ++v2; | |
6370 ++v1; | |
6371 } | |
6372 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6373 if ( v1 == 4 ) | |
6374 break; | |
6375 } | |
6376 ++v11; | |
6377 v0 += 2; | |
89 | 6378 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6379 break; | |
6380 } | |
6381 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6382 { | |
827 | 6383 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6384 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6385 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6386 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6387 } | |
484 | 6388 if ( contract_approved == 601 ) |
0 | 6389 { |
6390 v5 = 0; | |
89 | 6391 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6392 v9 = 0; |
6393 while ( 1 ) | |
6394 { | |
135 | 6395 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6396 { |
6397 v10 = 0; | |
89 | 6398 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6399 do |
6400 { | |
89 | 6401 v7 = v6->pInventoryItems; |
0 | 6402 v8 = 138; |
6403 do | |
6404 { | |
89 | 6405 if ( v7->uItemID == 601 ) |
0 | 6406 { |
377 | 6407 if ( !v7->uHolderPlayer ) |
89 | 6408 v9 = v7; |
377 | 6409 if ( v7->uHolderPlayer == v5 ) |
0 | 6410 v10 = 1; |
6411 } | |
89 | 6412 ++v7; |
0 | 6413 --v8; |
6414 } | |
6415 while ( v8 ); | |
89 | 6416 ++v6; |
6417 } | |
6418 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6419 if ( !v10 ) |
6420 break; | |
6421 } | |
89 | 6422 ++v12; |
0 | 6423 ++v5; |
89 | 6424 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6425 return; |
6426 } | |
6427 if ( v9 ) | |
377 | 6428 v9->uHolderPlayer = v5; |
0 | 6429 } |
6430 } | |
6431 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6432 // 722B3C: using guessed type int dword_722B3C; | |
6433 // 722B44: using guessed type int dword_722B44; | |
6434 // F8B1A8: using guessed type int dword_F8B1A8; | |
6435 | |
6436 //----- (004B2001) -------------------------------------------------------- | |
459 | 6437 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6438 { | |
6439 //signed int v1; // eax@1 | |
6440 NPCData *pCurrentNPCInfo; // ebp@1 | |
6441 int pEventNumber; // ecx@8 | |
0 | 6442 Player *v4; // esi@20 |
467 | 6443 //int v5; // eax@28 |
6444 //int v6; // eax@31 | |
6445 //int v7; // eax@34 | |
6446 //int v8; // eax@37 | |
6447 //int v9; // eax@40 | |
6448 //unsigned int v10; // eax@43 | |
0 | 6449 char *v12; // eax@53 |
6450 char *v13; // eax@56 | |
6451 char *v14; // eax@57 | |
6452 char *v15; // eax@58 | |
467 | 6453 //unsigned int v16; // ebp@62 |
0 | 6454 char *v17; // ecx@63 |
6455 char *v18; // eax@65 | |
6456 const char *v19; // ecx@68 | |
248 | 6457 //unsigned int v20; // eax@69 |
467 | 6458 signed int pPrice; // ecx@70 |
0 | 6459 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6460 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6461 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6462 //int v25; // [sp-4h] [bp-10h]@49 |
6463 | |
459 | 6464 uDialogueType = uMessageParam + 1; |
1211 | 6465 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
467 | 6466 if ( uMessageParam <= 24 ) |
460 | 6467 { |
459 | 6468 switch ( uMessageParam ) |
6469 { | |
6470 case 13: | |
827 | 6471 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6472 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6473 NPCHireableDialogPrepare(); |
459 | 6474 dialogue_show_profession_details = false; |
6475 goto _return; | |
6476 case 19: | |
6477 pEventNumber = pCurrentNPCInfo->evt_A; | |
6478 break; | |
6479 case 20: | |
6480 pEventNumber = pCurrentNPCInfo->evt_B; | |
6481 break; | |
6482 case 21: | |
6483 pEventNumber = pCurrentNPCInfo->evt_C; | |
6484 break; | |
6485 case 22: | |
6486 pEventNumber = pCurrentNPCInfo->evt_D; | |
6487 break; | |
6488 case 23: | |
6489 pEventNumber = pCurrentNPCInfo->evt_E; | |
6490 break; | |
6491 case 24: | |
6492 pEventNumber = pCurrentNPCInfo->evt_F; | |
6493 break; | |
6494 default: | |
467 | 6495 goto _return; |
6496 } | |
6497 /*switch ( pEventNumber ) | |
6498 { | |
6499 case 139: | |
6500 sub_4B1ECE(); | |
6501 goto _return; | |
6502 case 311: | |
6503 sub_4BBA85_bounties(); | |
6504 goto _return; | |
6505 }*/ | |
459 | 6506 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6507 { | |
6508 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6509 { | |
6510 if ( pEventNumber == 139 ) | |
0 | 6511 { |
6512 sub_4B1ECE(); | |
6513 } | |
6514 else | |
6515 { | |
459 | 6516 if ( pEventNumber == 311 ) |
0 | 6517 { |
6518 sub_4BBA85_bounties(); | |
6519 } | |
6520 else | |
6521 { | |
827 | 6522 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6523 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6524 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6525 activeLevelDecoration = NULL; |
0 | 6526 } |
6527 } | |
6528 } | |
6529 else | |
6530 { | |
459 | 6531 dword_F8B1D8 = uMessageParam; |
6532 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6533 } |
6534 } | |
6535 else | |
6536 { | |
459 | 6537 sub_4B3FE5(pEventNumber); |
0 | 6538 } |
6539 goto _return; | |
460 | 6540 } |
459 | 6541 if ( uMessageParam != 76 ) |
6542 { | |
6543 if ( uMessageParam == 77 ) | |
6544 { | |
467 | 6545 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6546 if (dialogue_show_profession_details) |
459 | 6547 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6548 else |
459 | 6549 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6550 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6551 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6552 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6553 current_npc_text = v18; |
0 | 6554 } |
6555 else | |
6556 { | |
459 | 6557 if ( uMessageParam == 79 ) |
0 | 6558 { |
484 | 6559 if ( contract_approved ) |
0 | 6560 { |
267 | 6561 Party::TakeGold(gold_transaction_amount); |
0 | 6562 if ( uActiveCharacter ) |
6563 { | |
492 | 6564 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6565 *(short *)v12 &= 0x3Fu; |
6566 switch ( dword_F8B1B0 ) | |
6567 { | |
6568 case 2: | |
492 | 6569 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6570 *v15 |= 0x40u; |
6571 break; | |
6572 case 3: | |
492 | 6573 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6574 *v14 |= 0x80u; |
6575 break; | |
6576 case 4: | |
492 | 6577 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6578 v13[1] |= 1u; |
6579 break; | |
6580 } | |
187 | 6581 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6582 } |
437 | 6583 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6584 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6585 { |
990 | 6586 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6587 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6588 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6589 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6590 }*/ |
0 | 6591 } |
6592 } | |
6593 else | |
6594 { | |
492 | 6595 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6596 { |
267 | 6597 Party::TakeGold(gold_transaction_amount); |
0 | 6598 v4 = pParty->pPlayers; |
6599 do | |
6600 { | |
492 | 6601 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6602 ++v4; |
6603 } | |
6604 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6605 switch ( dword_F8B1D8 ) | |
6606 { | |
6607 case 19: | |
467 | 6608 pEventNumber = pCurrentNPCInfo->evt_A; |
6609 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6610 pCurrentNPCInfo->evt_A = 0; |
0 | 6611 break; |
6612 case 20: | |
467 | 6613 pEventNumber = pCurrentNPCInfo->evt_B; |
6614 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6615 pCurrentNPCInfo->evt_B = 0; |
0 | 6616 break; |
6617 case 21: | |
467 | 6618 pEventNumber = pCurrentNPCInfo->evt_C; |
6619 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6620 pCurrentNPCInfo->evt_C = 0; |
0 | 6621 break; |
6622 case 22: | |
467 | 6623 pEventNumber = pCurrentNPCInfo->evt_D; |
6624 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6625 pCurrentNPCInfo->evt_D = 0; |
0 | 6626 break; |
6627 case 23: | |
467 | 6628 pEventNumber = pCurrentNPCInfo->evt_E; |
6629 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6630 pCurrentNPCInfo->evt_E = 0; |
0 | 6631 break; |
6632 case 24: | |
467 | 6633 pEventNumber = pCurrentNPCInfo->evt_F; |
6634 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6635 pCurrentNPCInfo->evt_F = 0; | |
0 | 6636 break; |
6637 } | |
437 | 6638 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6639 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6640 { |
990 | 6641 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6642 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6643 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6644 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6645 }*/ |
467 | 6646 //v11 = uActiveCharacter; |
0 | 6647 if ( uActiveCharacter ) |
6648 { | |
467 | 6649 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6650 goto _return; |
6651 } | |
6652 } | |
6653 } | |
6654 } | |
6655 goto _return; | |
6656 } | |
6657 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6658 { | |
467 | 6659 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6660 goto _return; |
6661 } | |
459 | 6662 if ( pCurrentNPCInfo->uProfession != 51 ) |
6663 { | |
467 | 6664 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6665 if ( pParty->uNumGold < pPrice ) | |
6666 { | |
6667 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6668 dialogue_show_profession_details = false; |
0 | 6669 uDialogueType = 13; |
827 | 6670 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6671 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6672 if ( uActiveCharacter ) |
248 | 6673 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6674 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6675 goto _return; | |
6676 } | |
6677 Party::TakeGold(pPrice); | |
0 | 6678 } |
147 | 6679 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6680 pCurrentNPCInfo->uFlags |= 128; |
0 | 6681 pParty->field_709 = 0; |
1035 | 6682 pParty->CountHirelings(); |
0 | 6683 if ( pParty->pHirelings[0].pName ) |
6684 { | |
459 | 6685 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6686 v24 = pCurrentNPCInfo->pName; | |
0 | 6687 v22 = pParty->pHireling2Name; |
6688 } | |
6689 else | |
6690 { | |
459 | 6691 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6692 v24 = pCurrentNPCInfo->pName; | |
0 | 6693 v22 = pParty->pHireling1Name; |
6694 } | |
6695 strcpy(v22, v24); | |
6696 pParty->field_709 = 0; | |
1035 | 6697 pParty->CountHirelings(); |
480 | 6698 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6699 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6700 |
6701 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6702 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6703 { |
990 | 6704 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6705 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6706 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6707 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6708 }*/ |
0 | 6709 if ( uActiveCharacter ) |
467 | 6710 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6711 _return: |
460 | 6712 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6713 } |
6714 | |
6715 //----- (004B254D) -------------------------------------------------------- | |
6716 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6717 { | |
955 | 6718 //Player *v1; // esi@1 |
0 | 6719 int v2; // edx@1 |
6720 int v3; // ecx@1 | |
6721 int v4; // edi@1 | |
955 | 6722 int pClassType; // eax@7 |
0 | 6723 int v6; // eax@7 |
6724 int v7; // ebx@7 | |
955 | 6725 //int v8; // ebx@8 |
0 | 6726 signed int v9; // esi@8 |
6727 int v10; // eax@8 | |
6728 char *v11; // ecx@8 | |
6729 int v12; // edi@9 | |
6730 char *v13; // edx@9 | |
6731 signed int v14; // edi@10 | |
6732 unsigned int v16; // eax@29 | |
955 | 6733 //int v17; // eax@36 |
0 | 6734 char v18; // cl@46 |
6735 __int16 v19; // dx@56 | |
6736 int v20; // eax@60 | |
955 | 6737 //char *v21; // [sp-Ch] [bp-38h]@82 |
6738 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6739 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6740 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6741 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6742 //int v26; // [sp-4h] [bp-30h]@38 |
6743 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6744 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6745 int v29; // [sp+10h] [bp-1Ch]@13 | |
6746 int v30; // [sp+14h] [bp-18h]@15 | |
6747 int v31; // [sp+18h] [bp-14h]@16 | |
6748 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6749 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6750 int v34; // [sp+24h] [bp-8h]@7 |
6751 char *v35; // [sp+28h] [bp-4h]@1 | |
6752 | |
484 | 6753 contract_approved = 0; |
0 | 6754 v2 = (_this - 200) % 3; |
6755 v3 = (_this - 200) / 3; | |
6756 v4 = v2; | |
6757 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6758 dword_F8B1AC_award_bit_number = v3; |
0 | 6759 if ( v2 ) |
6760 { | |
6761 if ( v2 == 1 ) | |
6762 { | |
267 | 6763 gold_transaction_amount = 5000; |
0 | 6764 dword_F8B1B0 = 3; |
6765 } | |
6766 else | |
6767 { | |
6768 if ( v2 == 2 ) | |
6769 { | |
267 | 6770 gold_transaction_amount = 8000; |
0 | 6771 dword_F8B1B0 = 4; |
6772 } | |
6773 } | |
6774 } | |
6775 else | |
6776 { | |
267 | 6777 gold_transaction_amount = 2000; |
0 | 6778 dword_F8B1B0 = 2; |
6779 } | |
955 | 6780 pClassType = pPlayers[uActiveCharacter]->classType; |
6781 //v33 = pClassType; | |
6782 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6783 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6784 v7 = a1[0] & 0x3F; |
6785 v34 = v2 + 2; | |
6786 if ( v6 < v2 + 2 ) | |
6787 { | |
955 | 6788 //v8 = v33; |
0 | 6789 v9 = 0; |
955 | 6790 v10 = pClassType - pClassType % 4; |
6791 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6792 do |
6793 { | |
6794 v12 = (unsigned __int8)*v11; | |
6795 v13 = &v28[4 * v9]; | |
6796 *(int *)v13 = 0; | |
6797 if ( v12 < v34 ) | |
6798 { | |
6799 v14 = 1; | |
6800 } | |
6801 else | |
6802 { | |
6803 v14 = 1; | |
6804 *(int *)v13 = 1; | |
6805 } | |
6806 ++v9; | |
6807 v11 += 37; | |
6808 } | |
6809 while ( v9 < 4 ); | |
6810 if ( v29 == v14 ) | |
6811 { | |
6812 v25 = pClassNames[v10 + 1]; | |
6813 } | |
6814 else | |
6815 { | |
955 | 6816 if ( v30 == v14 )//crash |
0 | 6817 { |
6818 if ( v31 == v14 ) | |
6819 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6820 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
|
6821 return pTmpBuf.data(); |
0 | 6822 } |
6823 v25 = pClassNames[v10 + 2]; | |
6824 } | |
6825 else | |
6826 { | |
6827 if ( v31 != v14 ) | |
6828 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6829 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
|
6830 return pTmpBuf.data(); |
0 | 6831 } |
6832 v25 = pClassNames[v10 + 3]; | |
6833 } | |
6834 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6835 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6836 return pTmpBuf.data(); |
0 | 6837 } |
955 | 6838 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6839 return (char *)pNPCTopics[122].pText; |
6840 if ( !v7 ) | |
6841 return (char *)pNPCTopics[131].pText; | |
6842 v16 = SkillToMastery(a1[0]); | |
6843 if ( (signed int)v16 > v4 + 1 ) | |
6844 return (char *)pNPCTopics[v4 + 128].pText; | |
6845 if ( v34 != 2 ) | |
6846 { | |
6847 if ( v34 == 3 ) | |
6848 { | |
6849 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6850 { | |
492 | 6851 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6852 { |
6853 case 12: | |
6854 case 13: | |
6855 case 14: | |
6856 case 15: | |
6857 case 16: | |
6858 case 17: | |
6859 case 18: | |
267 | 6860 gold_transaction_amount = 4000; |
0 | 6861 goto LABEL_42; |
6862 case 19: | |
6863 v19 = 114; | |
955 | 6864 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6865 return v35; | |
6866 if ( !gold_transaction_amount ) | |
6867 goto LABEL_79; | |
6868 goto LABEL_42; | |
0 | 6869 case 20: |
6870 v19 = 110; | |
484 | 6871 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6872 return v35; |
955 | 6873 if ( !gold_transaction_amount ) |
6874 goto LABEL_79; | |
6875 goto LABEL_42; | |
0 | 6876 case 22: |
955 | 6877 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
6878 if ( v20 < 50 ) | |
6879 return v35; | |
6880 if ( !gold_transaction_amount ) | |
6881 goto LABEL_79; | |
6882 goto LABEL_42; | |
0 | 6883 case 24: |
267 | 6884 gold_transaction_amount = 2500; |
955 | 6885 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 6886 if ( v20 < 50 ) |
6887 return v35; | |
955 | 6888 if ( !gold_transaction_amount ) |
6889 goto LABEL_79; | |
6890 goto LABEL_42; | |
6891 case 36: | |
6892 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
6893 if ( v20 < 50 ) | |
6894 return v35; | |
6895 if ( !gold_transaction_amount ) | |
6896 goto LABEL_79; | |
6897 goto LABEL_42; | |
0 | 6898 case 21: |
6899 case 23: | |
6900 case 25: | |
6901 case 26: | |
6902 case 29: | |
6903 case 32: | |
6904 case 34: | |
6905 case 35: | |
267 | 6906 gold_transaction_amount = 2500; |
0 | 6907 goto LABEL_42; |
6908 case 8: | |
6909 case 9: | |
6910 case 10: | |
6911 case 11: | |
267 | 6912 gold_transaction_amount = 3000; |
0 | 6913 goto LABEL_42; |
6914 case 7: | |
955 | 6915 gold_transaction_amount = 0; |
6916 if ( !gold_transaction_amount ) | |
6917 goto LABEL_79; | |
6918 goto LABEL_42; | |
6919 default: | |
6920 if ( !gold_transaction_amount ) | |
6921 goto LABEL_79; | |
6922 goto LABEL_42; | |
0 | 6923 } |
955 | 6924 gold_transaction_amount = 0; |
6925 if ( !gold_transaction_amount ) | |
6926 goto LABEL_79; | |
6927 goto LABEL_42; | |
0 | 6928 } |
6929 } | |
6930 else | |
6931 { | |
6932 if ( v34 != 4 ) | |
6933 { | |
955 | 6934 if ( !gold_transaction_amount ) |
6935 goto LABEL_79; | |
6936 goto LABEL_42; | |
0 | 6937 } |
6938 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
6939 { | |
492 | 6940 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6941 { |
6942 case 19: | |
955 | 6943 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
6944 { | |
6945 if ( !gold_transaction_amount ) | |
6946 goto LABEL_79; | |
6947 goto LABEL_42; | |
6948 } | |
6949 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
6950 { | |
6951 if ( !gold_transaction_amount ) | |
6952 goto LABEL_79; | |
6953 goto LABEL_42; | |
6954 } | |
6955 return v35; | |
0 | 6956 case 20: |
955 | 6957 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
6958 { | |
6959 if ( !gold_transaction_amount ) | |
6960 goto LABEL_79; | |
6961 goto LABEL_42; | |
6962 } | |
6963 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
6964 { | |
6965 if ( !gold_transaction_amount ) | |
6966 goto LABEL_79; | |
6967 goto LABEL_42; | |
6968 } | |
0 | 6969 return v35; |
6970 case 30: | |
955 | 6971 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 6972 if ( (v18 & 0x3Fu) < 0xA ) |
6973 return v35; | |
955 | 6974 if ( !gold_transaction_amount ) |
6975 goto LABEL_79; | |
6976 goto LABEL_42; | |
6977 case 31: | |
6978 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
6979 if ( (v18 & 0x3Fu) < 0xA ) | |
6980 return v35; | |
6981 if ( !gold_transaction_amount ) | |
6982 goto LABEL_79; | |
6983 goto LABEL_42; | |
0 | 6984 case 21: |
6985 case 23: | |
6986 case 24: | |
6987 case 25: | |
6988 case 26: | |
6989 case 29: | |
6990 case 32: | |
6991 case 34: | |
6992 case 35: | |
267 | 6993 gold_transaction_amount = 6000; |
0 | 6994 goto LABEL_42; |
6995 case 8: | |
6996 case 9: | |
6997 case 10: | |
6998 case 11: | |
267 | 6999 gold_transaction_amount = 7000; |
0 | 7000 goto LABEL_42; |
7001 case 7: | |
7002 break; | |
955 | 7003 default: |
7004 if ( !gold_transaction_amount ) | |
7005 goto LABEL_79; | |
7006 goto LABEL_42; | |
0 | 7007 } |
267 | 7008 gold_transaction_amount = 0; |
955 | 7009 if ( !gold_transaction_amount ) |
7010 goto LABEL_79; | |
7011 goto LABEL_42; | |
0 | 7012 } |
7013 } | |
7014 return v35; | |
7015 } | |
7016 if ( v7 < 4 ) | |
7017 return v35; | |
492 | 7018 if ( dword_F8B1AC_award_bit_number > 27 ) |
7019 { | |
7020 if ( dword_F8B1AC_award_bit_number != 29 | |
7021 && dword_F8B1AC_award_bit_number != 32 | |
7022 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7023 { |
267 | 7024 if ( !gold_transaction_amount ) |
0 | 7025 goto LABEL_79; |
7026 goto LABEL_42; | |
7027 } | |
267 | 7028 gold_transaction_amount = 500; |
955 | 7029 if ( !gold_transaction_amount ) |
7030 goto LABEL_79; | |
7031 goto LABEL_42; | |
0 | 7032 } |
492 | 7033 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7034 { |
7035 gold_transaction_amount = 500; | |
7036 if ( !gold_transaction_amount ) | |
7037 goto LABEL_79; | |
7038 goto LABEL_42; | |
7039 } | |
492 | 7040 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7041 { |
267 | 7042 gold_transaction_amount = 0; |
0 | 7043 goto LABEL_79; |
7044 } | |
492 | 7045 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7046 { |
7047 if ( !gold_transaction_amount ) | |
7048 goto LABEL_79; | |
7049 goto LABEL_42; | |
7050 } | |
492 | 7051 if ( dword_F8B1AC_award_bit_number > 18 ) |
7052 { | |
7053 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7054 { |
7055 if ( !gold_transaction_amount ) | |
7056 goto LABEL_79; | |
7057 goto LABEL_42; | |
7058 } | |
7059 gold_transaction_amount = 500; | |
7060 if ( !gold_transaction_amount ) | |
7061 goto LABEL_79; | |
7062 goto LABEL_42; | |
0 | 7063 } |
267 | 7064 gold_transaction_amount = 1000; |
0 | 7065 LABEL_42: |
267 | 7066 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7067 return (char *)pNPCTopics[124].pText; |
7068 LABEL_79: | |
484 | 7069 contract_approved = 1; |
0 | 7070 if ( v34 == 2 ) |
7071 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7072 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
955 | 7073 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
|
7074 return pTmpBuf2.data(); |
0 | 7075 } |
7076 if ( v34 == 3 ) | |
7077 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7078 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 7079 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
|
7080 return pTmpBuf2.data(); |
0 | 7081 } |
7082 if ( v34 == 4 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7083 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534], |
955 | 7084 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
|
7085 return pTmpBuf2.data(); |
0 | 7086 } |
7087 | |
7088 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7089 const char * ContractSelectText( int pEventCode ) |
7090 { | |
7091 static const int dialogue_base=110; | |
484 | 7092 contract_approved = 0; |
492 | 7093 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7094 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7095 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7096 { | |
492 | 7097 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7098 { | |
7099 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7100 } |
7101 else | |
7102 { | |
267 | 7103 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7104 { |
484 | 7105 contract_approved = 1; |
492 | 7106 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7107 } |
7108 else | |
7109 { | |
492 | 7110 return pNPCTopics[dialogue_base+14].pText; |
0 | 7111 } |
7112 } | |
7113 } | |
7114 else | |
7115 { | |
492 | 7116 return pNPCTopics[dialogue_base+12].pText; |
0 | 7117 } |
7118 } | |
7119 | |
7120 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7121 void SimpleHouseAndBoatsDialog() |
0 | 7122 { |
7123 char *v0; // esi@3 | |
7124 char *v1; // ST1C_4@3 | |
7125 char *v2; // eax@3 | |
7126 const char *v3; // ST1C_4@5 | |
7127 int v4; // eax@5 | |
7128 unsigned int i; // eax@5 | |
7129 NPCData *v6; // esi@6 | |
7130 unsigned __int16 v7; // bx@6 | |
7131 unsigned int v8; // eax@6 | |
7132 int v9; // eax@11 | |
7133 unsigned int v10; // ecx@12 | |
7134 int v11; // eax@12 | |
7135 int v12; // esi@12 | |
7136 char *v13; // eax@12 | |
7137 GUIWindow *v14; // ebx@13 | |
7138 char *v15; // esi@14 | |
7139 GUIButton *v16; // eax@15 | |
7140 unsigned int v17; // ecx@15 | |
7141 int v18; // ecx@17 | |
7142 int v19; // ecx@18 | |
7143 int v20; // ecx@19 | |
7144 int v21; // ecx@20 | |
7145 int v22; // ecx@21 | |
7146 unsigned int v23; // ecx@23 | |
7147 int v24; // ecx@35 | |
7148 int v25; // ecx@36 | |
7149 int v26; // ecx@37 | |
7150 int v27; // ecx@38 | |
7151 int v28; // ecx@39 | |
7152 char *v29; // esi@42 | |
7153 unsigned int v30; // ST20_4@42 | |
7154 int v31; // ST1C_4@42 | |
7155 unsigned int v32; // eax@42 | |
7156 char *v33; // eax@43 | |
7157 int v34; // esi@51 | |
7158 int v35; // eax@51 | |
7159 unsigned int v36; // edi@51 | |
7160 GUIButton *v37; // eax@52 | |
7161 int v38; // eax@52 | |
7162 signed int v39; // ecx@54 | |
7163 int v40; // edi@57 | |
7164 GUIButton *v41; // eax@60 | |
7165 GUIButton *v42; // esi@60 | |
7166 const char *v43; // ebx@60 | |
7167 int v44; // eax@60 | |
7168 unsigned int v45; // ecx@60 | |
7169 unsigned __int16 v46; // ax@60 | |
7170 GUIFont *v47; // ebx@64 | |
7171 int v48; // esi@64 | |
7172 char *v49; // eax@66 | |
7173 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7174 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7175 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7176 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7177 int v55; // [sp+10Ch] [bp-10h]@6 | |
7178 int v56; // [sp+110h] [bp-Ch]@13 | |
7179 char *pInString; // [sp+114h] [bp-8h]@12 | |
7180 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7181 | |
7182 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7183 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7184 { |
7185 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7186 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7187 a1.uFrameX = 493; | |
7188 a1.uFrameWidth = 126; | |
7189 a1.uFrameZ = 366; | |
7190 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7191 a1.uFrameX = 483; | |
7192 a1.uFrameWidth = 148; | |
7193 a1.uFrameZ = 334; | |
434 | 7194 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7195 if ( !v2 ) |
7196 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7197 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7198 v2 = pTmpBuf.data(); |
0 | 7199 } |
7200 v3 = v2; | |
7201 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7202 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7203 return; | |
0 | 7204 } |
7205 a1.uFrameWidth -= 10; | |
7206 a1.uFrameZ -= 10; | |
1211 | 7207 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
0 | 7208 v6 = v58; |
949 | 7209 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7210 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7211 v8 = v6->uProfession; |
7212 if ( v8 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7213 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7214 else |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7215 strcpy(pTmpBuf.data(), v6->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7216 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u); |
0 | 7217 if ( !dword_591080 ) |
7218 { | |
7219 if ( !uDialogueType ) | |
7220 { | |
7221 v9 = v6->greet; | |
7222 if ( v9 ) | |
7223 { | |
7224 v10 = v6->uFlags; | |
819 | 7225 a1.uFrameWidth = game_viewport_width; |
0 | 7226 a1.uFrameZ = 452; |
7227 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7228 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7229 v12 = v11 + 7; | |
973 | 7230 pRenderer->_4A6A68(8, 352 - (v11 + 7), |
7231 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7232 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); | |
0 | 7233 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); |
7234 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7235 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7236 } | |
7237 } | |
7238 } | |
7239 v14 = pDialogueWindow; | |
7240 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7241 v52.uFrameX = 483; | |
7242 v52.uFrameWidth = 148; | |
7243 v52.uFrameZ = 334; | |
7244 v56 = v52.pStartingPosActiveItem; | |
7245 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7246 { | |
348 | 7247 v15 = "";//(char *)v54; |
0 | 7248 while ( 1 ) |
7249 { | |
7250 v16 = v52.GetControl(v56); | |
832 | 7251 v17 = v16->msg_param; |
0 | 7252 pInString = (char *)v16; |
7253 if ( (signed int)v17 > 24 ) | |
7254 { | |
7255 v24 = v17 - 76; | |
7256 if ( !v24 ) | |
7257 { | |
7258 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7259 goto LABEL_49; | |
7260 } | |
7261 v25 = v24 - 1; | |
7262 if ( !v25 ) | |
7263 { | |
7264 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7265 goto LABEL_49; | |
7266 } | |
7267 v26 = v25 - 2; | |
7268 if ( !v26 ) | |
7269 { | |
7270 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7271 LABEL_44: | |
7272 v15 = v33; | |
7273 LABEL_45: | |
7274 v16 = (GUIButton *)pInString; | |
7275 goto LABEL_49; | |
7276 } | |
7277 v27 = v26 - 3; | |
7278 if ( !v27 ) | |
7279 { | |
459 | 7280 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7281 goto LABEL_44; |
7282 } | |
7283 v28 = v27 - 1; | |
7284 if ( !v28 ) | |
7285 { | |
7286 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7287 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7288 v31 = *(int *)v29; |
949 | 7289 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7290 sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30); |
1217 | 7291 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
|
7292 current_npc_text = pTmpBuf2.data(); |
0 | 7293 v15 = ""; |
7294 goto LABEL_45; | |
7295 } | |
7296 if ( v28 != 10 ) | |
7297 goto LABEL_41; | |
7298 } | |
7299 else | |
7300 { | |
7301 if ( v17 == 24 ) | |
7302 { | |
291 | 7303 v23 = v58->evt_F; |
0 | 7304 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7305 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7306 if ( !v15 ) |
7307 { | |
832 | 7308 v16->msg_param = 0; |
0 | 7309 v15 = ""; |
7310 } | |
7311 goto LABEL_49; | |
7312 } | |
7313 v18 = v17 - 13; | |
7314 if ( v18 ) | |
7315 { | |
7316 v19 = v18 - 6; | |
7317 if ( !v19 ) | |
7318 { | |
291 | 7319 v23 = v58->evt_A; |
0 | 7320 goto LABEL_33; |
7321 } | |
7322 v20 = v19 - 1; | |
7323 if ( !v20 ) | |
7324 { | |
291 | 7325 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7326 if ( !v15 ) |
7327 { | |
832 | 7328 v16->msg_param = 0; |
0 | 7329 v15 = ""; |
7330 } | |
7331 if ( uDialogueType != 84 ) | |
7332 goto LABEL_49; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7333 sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
1217 | 7334 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
|
7335 current_npc_text = pTmpBuf2.data(); |
0 | 7336 goto LABEL_45; |
7337 } | |
7338 v21 = v20 - 1; | |
7339 if ( !v21 ) | |
7340 { | |
291 | 7341 v23 = v58->evt_C; |
0 | 7342 goto LABEL_33; |
7343 } | |
7344 v22 = v21 - 1; | |
7345 if ( !v22 ) | |
7346 { | |
291 | 7347 v23 = v58->evt_D; |
0 | 7348 goto LABEL_33; |
7349 } | |
7350 if ( v22 == 1 ) | |
7351 { | |
291 | 7352 v23 = v58->evt_E; |
0 | 7353 goto LABEL_33; |
7354 } | |
7355 LABEL_41: | |
7356 v15 = ""; | |
7357 goto LABEL_49; | |
7358 } | |
7359 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7360 } | |
7361 LABEL_49: | |
7362 strcpy(v16->pButtonName, v15); | |
7363 ++v56; | |
7364 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7365 { | |
7366 v14 = pDialogueWindow; | |
7367 break; | |
7368 } | |
7369 } | |
7370 } | |
7371 v34 = 0; | |
949 | 7372 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7373 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7374 v36 = v14->pStartingPosActiveItem; |
7375 v55 = v35; | |
7376 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7377 + pDialogueWindow->pStartingPosActiveItem ) | |
7378 { | |
7379 v37 = v14->GetControl(v36); | |
7380 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7381 v14 = pDialogueWindow; | |
7382 v34 += v38; | |
7383 ++v36; | |
7384 } | |
7385 v39 = v14->pNumPresenceButton; | |
7386 if ( v39 ) | |
7387 { | |
7388 v58 = (NPCData *)((174 - v34) / v39); | |
7389 if ( (signed int)v58 > 32 ) | |
7390 v58 = (NPCData *)32; | |
7391 pInString = (char *)2; | |
7392 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7393 v56 = v14->pStartingPosActiveItem; | |
7394 i = v56; | |
7395 if ( (signed int)i < (signed int)(i + v39) ) | |
7396 { | |
7397 while ( 1 ) | |
7398 { | |
7399 v41 = v14->GetControl(i); | |
7400 v42 = v41; | |
7401 v43 = v41->pButtonName; | |
7402 v41->uY = (unsigned int)((char *)v58 + v40); | |
7403 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7404 v45 = v42->uY; | |
7405 v42->uHeight = v44; | |
7406 v40 = v45 + v44 - 1; | |
7407 v42->uW = v40; | |
7408 v46 = v55; | |
7409 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7410 v46 = v54; | |
7411 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7412 v14 = pDialogueWindow; | |
7413 ++pInString; | |
7414 ++v56; | |
7415 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7416 if ( v56 >= (signed int)i ) | |
7417 break; | |
7418 i = v56; | |
7419 } | |
7420 } | |
7421 } | |
827 | 7422 if ( current_npc_text ) |
0 | 7423 { |
7424 w.uFrameWidth = 458; | |
7425 w.uFrameZ = 457; | |
7426 v47 = pFontArrus; | |
827 | 7427 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7428 if ( 352 - v48 < 8 ) |
7429 { | |
7430 v47 = pFontCreate; | |
827 | 7431 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7432 } |
973 | 7433 pRenderer->_4A6A68(8, 352 - v48, |
7434 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7435 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); | |
0 | 7436 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); |
827 | 7437 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7438 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7439 } | |
0 | 7440 } |
7441 | |
7442 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7443 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7444 { |
832 | 7445 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7446 } |
7447 | |
7448 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7449 void sub_4B3A72( int a1 ) |
7450 { | |
7451 int num_buttons; // esi@1 | |
7452 | |
7453 num_buttons = 0; | |
0 | 7454 if ( a1 == 21 ) |
7455 { | |
473 | 7456 CreateButtonInColumn(0, 0x66u); |
7457 num_buttons = 2; | |
7458 CreateButtonInColumn(1, 0x67u); | |
7459 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7460 { | |
7461 num_buttons = 3; | |
7462 CreateButtonInColumn(2, 0x68u); | |
7463 } | |
7464 } | |
972 | 7465 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); |
0 | 7466 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7467 } | |
7468 // F8B1E0: using guessed type int dword_F8B1E0; | |
7469 | |
7470 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7471 void sub_4B3AD4( signed int a1 ) |
7472 { | |
0 | 7473 if ( a1 > 0 ) |
7474 { | |
7475 if ( a1 <= 3 ) | |
7476 { | |
473 | 7477 CreateButtonInColumn(0, 3u); |
7478 CreateButtonInColumn(1, 4u); | |
7479 CreateButtonInColumn(2, 5u); | |
972 | 7480 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
0 | 7481 } |
7482 if ( a1 == 4 ) | |
7483 { | |
473 | 7484 CreateButtonInColumn(0, 3u); |
7485 CreateButtonInColumn(1, 4u); | |
972 | 7486 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); |
473 | 7487 } |
7488 } | |
0 | 7489 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7490 } | |
7491 // F8B1E0: using guessed type int dword_F8B1E0; | |
7492 | |
7493 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7494 void sub_4B3B42( signed int a1 ) |
7495 { | |
0 | 7496 int v1; // ecx@18 |
7497 int v2; // ecx@19 | |
7498 int v3; // ecx@20 | |
7499 signed int v4; // esi@22 | |
7500 signed int v5; // eax@22 | |
7501 unsigned int v6; // edx@24 | |
7502 int v7; // ecx@24 | |
7503 int result; // eax@43 | |
7504 int v9; // [sp-10h] [bp-14h]@28 | |
7505 int v10; // [sp-Ch] [bp-10h]@28 | |
7506 int v11; // [sp-8h] [bp-Ch]@28 | |
7507 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7508 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7509 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7510 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7511 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7512 int v17; // [sp-4h] [bp-8h]@28 | |
7513 | |
7514 if ( a1 > 13 ) | |
7515 { | |
7516 if ( a1 > 22 ) | |
7517 { | |
7518 if ( a1 == 23 ) | |
7519 { | |
473 | 7520 CreateButtonInColumn(0, 0xAu); |
7521 CreateButtonInColumn(1, 0xBu); | |
0 | 7522 v14 = 96; |
7523 LABEL_41: | |
473 | 7524 CreateButtonInColumn(2, v14); |
0 | 7525 v17 = 2; |
7526 v11 = 0; | |
7527 v10 = 1; | |
7528 v9 = 3; | |
7529 goto LABEL_42; | |
7530 } | |
7531 if ( a1 <= 26 ) | |
7532 goto LABEL_43; | |
7533 if ( a1 > 28 ) | |
7534 { | |
7535 if ( a1 != 30 ) | |
7536 goto LABEL_43; | |
473 | 7537 CreateButtonInColumn(0, 0x11u); |
0 | 7538 v16 = 96; |
7539 goto LABEL_37; | |
7540 } | |
473 | 7541 CreateButtonInColumn(0, 0x69u); |
7542 CreateButtonInColumn(1, 0x6Au); | |
7543 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7544 v12 = 108; |
7545 } | |
7546 else | |
7547 { | |
7548 if ( a1 == 22 ) | |
7549 { | |
473 | 7550 CreateButtonInColumn(0, 7u); |
0 | 7551 v16 = 8; |
7552 goto LABEL_37; | |
7553 } | |
7554 v1 = a1 - 14; | |
7555 if ( !v1 ) | |
7556 { | |
473 | 7557 CreateButtonInColumn(0, 0x12u); |
7558 CreateButtonInColumn(1, 0x30u); | |
7559 CreateButtonInColumn(2, 0x31u); | |
7560 CreateButtonInColumn(3, 0x32u); | |
7561 CreateButtonInColumn(4, 0x33u); | |
0 | 7562 v17 = 2; |
7563 v11 = 0; | |
7564 v10 = 1; | |
7565 v9 = 5; | |
7566 goto LABEL_42; | |
7567 } | |
7568 v2 = v1 - 1; | |
7569 if ( v2 ) | |
7570 { | |
7571 v3 = v2 - 2; | |
7572 if ( v3 ) | |
7573 { | |
7574 if ( v3 != 4 ) | |
7575 goto LABEL_43; | |
473 | 7576 CreateButtonInColumn(0, 0xFu); |
7577 CreateButtonInColumn(1, 0x10u); | |
0 | 7578 v4 = 3; |
473 | 7579 CreateButtonInColumn(2, 0x60u); |
336 | 7580 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7581 if ( v5 < 108 || v5 > 120 ) |
7582 goto LABEL_28; | |
7583 v4 = 4; | |
7584 v6 = 101; | |
7585 v7 = 3; | |
7586 } | |
7587 else | |
7588 { | |
7589 v4 = 1; | |
473 | 7590 CreateButtonInColumn(0, 0x63u); |
0 | 7591 if ( !pParty->uFine ) |
7592 { | |
7593 LABEL_28: | |
7594 v17 = 2; | |
7595 v11 = 0; | |
7596 v10 = 1; | |
7597 v9 = v4; | |
7598 LABEL_42: | |
972 | 7599 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); |
0 | 7600 goto LABEL_43; |
7601 } | |
7602 v4 = 2; | |
7603 v7 = 1; | |
7604 v6 = 100; | |
7605 } | |
473 | 7606 CreateButtonInColumn(v7, v6); |
0 | 7607 goto LABEL_28; |
7608 } | |
473 | 7609 CreateButtonInColumn(0, 0x12u); |
7610 CreateButtonInColumn(1, 0x34u); | |
7611 CreateButtonInColumn(2, 0x35u); | |
0 | 7612 v12 = 54; |
7613 } | |
7614 LABEL_39: | |
473 | 7615 CreateButtonInColumn(3, v12); |
0 | 7616 v17 = 2; |
7617 v11 = 0; | |
7618 v10 = 1; | |
7619 v9 = 4; | |
7620 goto LABEL_42; | |
7621 } | |
7622 if ( a1 == 13 ) | |
7623 { | |
473 | 7624 CreateButtonInColumn(0, 0x12u); |
0 | 7625 v16 = 56; |
7626 LABEL_37: | |
473 | 7627 CreateButtonInColumn(1, v16); |
0 | 7628 v17 = 2; |
7629 v11 = 0; | |
7630 v10 = 1; | |
7631 v9 = 2; | |
7632 goto LABEL_42; | |
7633 } | |
7634 switch ( a1 ) | |
7635 { | |
7636 case 1: | |
7637 case 2: | |
7638 case 3: | |
7639 case 4: | |
473 | 7640 CreateButtonInColumn(0, 2u); |
7641 CreateButtonInColumn(1, 0x5Fu); | |
7642 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7643 v12 = 96; |
7644 goto LABEL_39; | |
7645 case 5: | |
473 | 7646 CreateButtonInColumn(0, 0x12u); |
0 | 7647 v13 = 48; |
7648 goto LABEL_9; | |
7649 case 6: | |
473 | 7650 CreateButtonInColumn(0, 0x12u); |
0 | 7651 v13 = 49; |
7652 goto LABEL_9; | |
7653 case 7: | |
473 | 7654 CreateButtonInColumn(0, 0x12u); |
0 | 7655 v13 = 50; |
7656 goto LABEL_9; | |
7657 case 8: | |
473 | 7658 CreateButtonInColumn(0, 0x12u); |
0 | 7659 v13 = 51; |
7660 LABEL_9: | |
473 | 7661 CreateButtonInColumn(1, v13); |
0 | 7662 v14 = 72; |
7663 goto LABEL_41; | |
7664 case 9: | |
473 | 7665 CreateButtonInColumn(0, 0x12u); |
0 | 7666 v15 = 52; |
7667 goto LABEL_13; | |
7668 case 10: | |
473 | 7669 CreateButtonInColumn(0, 0x12u); |
0 | 7670 v15 = 53; |
7671 goto LABEL_13; | |
7672 case 11: | |
473 | 7673 CreateButtonInColumn(0, 0x12u); |
0 | 7674 v15 = 54; |
7675 LABEL_13: | |
473 | 7676 CreateButtonInColumn(1, v15); |
0 | 7677 v14 = 61; |
7678 goto LABEL_41; | |
7679 case 12: | |
473 | 7680 CreateButtonInColumn(0, 0x12u); |
0 | 7681 v16 = 55; |
7682 goto LABEL_37; | |
7683 default: | |
7684 break; | |
7685 } | |
7686 LABEL_43: | |
7687 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7688 } | |
7689 // F8B1E0: using guessed type int dword_F8B1E0; | |
7690 | |
7691 //----- (004B3E1E) -------------------------------------------------------- | |
7692 void __cdecl sub_4B3E1E() | |
7693 { | |
7694 NPCData *v0; // ST40_4@1 | |
7695 signed int v1; // edi@1 | |
165 | 7696 //GUIWindow *v2; // ecx@1 |
0 | 7697 |
167 | 7698 __debugbreak(); |
602 | 7699 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7700 v1 = 0; |
7701 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7702 pDialogueWindow->Release(); | |
165 | 7703 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7704 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7705 { |
832 | 7706 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7707 v1 = 1; |
7708 } | |
832 | 7709 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 7710 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 7711 } |
7712 | |
7713 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7714 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7715 { |
467 | 7716 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7717 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7718 ContractSelectText(pEventCode); |
0 | 7719 pDialogueWindow->Release(); |
492 | 7720 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7721 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7722 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7723 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
972 | 7724 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7725 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7726 } |
7727 // F8B19C: using guessed type int dword_F8B19C; | |
7728 | |
7729 //----- (004B3FE5) -------------------------------------------------------- | |
7730 void __fastcall sub_4B3FE5(int a4) | |
7731 { | |
7732 int v1; // edi@1 | |
7733 char *v2; // edi@1 | |
7734 | |
7735 v1 = a4; | |
7736 uDialogueType = 78; | |
827 | 7737 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7738 _4B254D_SkillMasteryTeacher(a4); |
7739 pDialogueWindow->Release(); | |
7740 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7741 v2 = ""; | |
832 | 7742 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7743 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7744 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7745 if ( contract_approved ) |
0 | 7746 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7747 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 7748 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7749 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7750 } |
7751 // F8B19C: using guessed type int dword_F8B19C; | |
7752 // F8B1A8: using guessed type int dword_F8B1A8; | |
7753 | |
7754 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7755 void NPCHireableDialogPrepare() |
7756 { | |
0 | 7757 signed int v0; // ebx@1 |
7758 NPCData *v1; // edi@1 | |
7759 | |
7760 v0 = 0; | |
1211 | 7761 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 |
0 | 7762 pDialogueWindow->Release(); |
7763 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7764 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7765 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7766 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7767 0); |
832 | 7768 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7769 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7770 { |
832 | 7771 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7772 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7773 v0 = 1; |
7774 } | |
832 | 7775 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7776 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
972 | 7777 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); |
747 | 7778 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7779 } |
7780 | |
7781 //----- (004B4224) -------------------------------------------------------- | |
423 | 7782 void _4B4224_UpdateNPCTopics( int _this ) |
7783 { | |
7784 int num_menu_buttons; // ebx@1 | |
0 | 7785 int i; // ebp@5 |
423 | 7786 // signed int v4; // ebp@9 |
7787 int v6; // eax@16 | |
7788 int v8; // eax@21 | |
7789 int v10; // eax@26 | |
7790 int v12; // eax@31 | |
7791 int v14; // eax@36 | |
7792 int v16; // eax@41 | |
0 | 7793 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7794 | |
423 | 7795 num_menu_buttons = 0; |
459 | 7796 pDialogueNPCCount = (_this + 1); |
0 | 7797 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7798 { | |
7799 pDialogueWindow->Release(); | |
7800 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
|
7801 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7802 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
|
7803 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
|
7804 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
|
7805 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName.data(), 0); |
0 | 7806 } |
7807 else | |
7808 { | |
1211 | 7809 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) )];//+ 1 |
749 | 7810 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7811 { |
7812 pDialogueWindow->Release(); | |
7813 } | |
7814 else | |
7815 { | |
7816 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
1211 | 7817 dword_5913F4[i]->Release(); |
0 | 7818 } |
7819 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7820 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7821 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7822 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7823 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7824 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7825 { |
484 | 7826 sub_4B3B42(in_current_building_type); |
0 | 7827 } |
7828 else | |
7829 { | |
7830 if ( v17->joins ) | |
7831 { | |
423 | 7832 num_menu_buttons = 1; |
858 | 7833 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7834 } |
423 | 7835 if ( v17->evt_A) |
7836 { | |
7837 if ( num_menu_buttons < 4 ) | |
7838 { | |
7839 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7840 if ( v6 == 1 || v6 == 2 ) |
832 | 7841 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7842 } |
7843 } | |
7844 if ( v17->evt_B ) | |
7845 { | |
7846 if ( num_menu_buttons < 4 ) | |
7847 { | |
7848 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7849 if ( v8 == 1 || v8 == 2 ) |
832 | 7850 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7851 } |
7852 } | |
7853 if ( v17->evt_C ) | |
7854 { | |
7855 if ( num_menu_buttons < 4 ) | |
7856 { | |
7857 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7858 if ( v10 == 1 || v10 == 2 ) |
832 | 7859 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7860 } |
7861 } | |
7862 | |
7863 if ( v17->evt_D ) | |
7864 { | |
7865 if ( num_menu_buttons < 4 ) | |
7866 { | |
7867 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7868 if ( v12 == 1 || v12 == 2 ) |
832 | 7869 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7870 } |
7871 } | |
7872 if ( v17->evt_E ) | |
7873 { | |
7874 if ( num_menu_buttons < 4 ) | |
7875 { | |
7876 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7877 if ( v14 == 1 || v14 == 2 ) |
832 | 7878 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7879 } |
7880 } | |
7881 if ( v17->evt_F ) | |
7882 { | |
7883 if ( num_menu_buttons < 4 ) | |
7884 { | |
7885 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7886 if ( v16 == 1 || v16 == 2 ) |
832 | 7887 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7888 } |
7889 } | |
972 | 7890 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); |
0 | 7891 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7892 } | |
747 | 7893 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7894 } |
7895 | |
0 | 7896 } |
7897 | |
7898 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 7899 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
7900 { | |
0 | 7901 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7902 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 7903 v4 = pFontLucida->AlignText_Center(450, Str); |
7904 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 7905 } |
7906 | |
7907 //----- (004B46F8) -------------------------------------------------------- | |
7908 int __fastcall sub_4B46F8(int a1) | |
7909 { | |
7910 int v1; // eax@1 | |
7911 int i; // edx@1 | |
7912 | |
7913 v1 = 0; | |
7914 for ( i = 0; i < a1; ++i ) | |
7915 v1 += i + 1; | |
7916 return 1000 * v1; | |
7917 } | |
7918 | |
7919 //----- (004BC49B) -------------------------------------------------------- | |
651 | 7920 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 7921 { |
656 | 7922 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7923 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7924 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7925 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7926 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7927 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7928 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7929 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7930 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7931 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7932 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7933 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7934 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7935 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7936 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7937 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7938 //v1 = _this; |
656 | 7939 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7940 //v3 = v1; |
656 | 7941 uDialogueType = newDialogueType; |
7942 if (!speakingNPC->uFlags) | |
7943 { | |
7944 speakingNPC->uFlags = 1; | |
7945 //v3 = uDialogueType; | |
7946 } | |
7947 | |
7948 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
7949 { | |
7950 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
7951 } | |
7952 else if(newDialogueType == DIALOGUE_76) | |
7953 { | |
7954 if (speakingNPC->Hired()) | |
7955 { | |
7956 v8 = 0; | |
7957 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7958 { | |
7959 v6 = (char *)pNPCStats->pNewNPCData; | |
7960 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
7961 { | |
7962 ++v8; | |
7963 v6 += 76; | |
7964 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
7965 break; | |
7966 } | |
7967 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
7968 v6[8] &= 0x7Fu; | |
7969 } | |
1104 | 7970 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 7971 { |
7972 v11 = pParty->pHirelings; | |
7973 memset(v11, 0, sizeof(NPCData)); | |
7974 } | |
1104 | 7975 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 7976 { |
7977 v11 = &pParty->pHirelings[1]; | |
7978 memset(v11, 0, sizeof(NPCData)); | |
7979 } | |
7980 pParty->field_709 = 0; | |
1035 | 7981 pParty->CountHirelings(); |
656 | 7982 dword_591084 = 0; |
7983 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7984 dword_7241C8 = 0; | |
7985 return; | |
7986 } | |
7987 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7988 { | |
7989 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
7990 ShowStatusBarString(v7, 2u); | |
7991 } | |
7992 else | |
7993 { | |
7994 //v9 = v2->uProfession; | |
7995 if ( speakingNPC->uProfession != 51 ) | |
7996 { | |
7997 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
7998 if ( pParty->uNumGold < v10 ) | |
7999 { | |
8000 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8001 dialogue_show_profession_details = false; | |
8002 uDialogueType = 13; | |
8003 if ( uActiveCharacter ) | |
8004 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8005 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8006 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8007 if ( !dword_7241C8 ) | |
8008 pGame->Draw(); | |
8009 dword_7241C8 = 0; | |
8010 return; | |
8011 } | |
8012 Party::TakeGold(v10); | |
8013 } | |
8014 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8015 if ( pParty->pHirelings[0].pName ) | |
8016 { | |
8017 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8018 v15 = speakingNPC->pName; | |
8019 v13 = pParty->pHireling2Name; | |
8020 } | |
8021 else | |
8022 { | |
8023 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8024 v15 = speakingNPC->pName; | |
8025 v13 = pParty->pHireling1Name; | |
8026 } | |
8027 strcpy(v13, v15); | |
8028 pParty->field_709 = 0; | |
1035 | 8029 pParty->CountHirelings(); |
656 | 8030 |
8031 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8032 | |
711 | 8033 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8034 pDialogue_SpeakingActor->uAIState = Removed; |
8035 if ( uActiveCharacter ) | |
8036 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8037 } | |
8038 } | |
8039 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8040 { | |
8041 ArenaFight(); | |
8042 return; | |
8043 } | |
8044 else if(newDialogueType == DIALOGUE_9) | |
8045 { | |
8046 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8047 { | |
8048 if ( speakingNPC->uProfession != 41 ) | |
8049 speakingNPC->bHasUsedTheAbility = 1; | |
8050 | |
8051 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8052 } | |
8053 else | |
8054 { | |
8055 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8056 } | |
8057 } | |
8058 else if(newDialogueType == DIALOGUE_13) | |
8059 { | |
8060 if (!speakingNPC->Hired()) | |
8061 { | |
8062 sub_4B3E1E(); | |
8063 dialogue_show_profession_details = false; | |
8064 } | |
8065 else | |
8066 { | |
8067 v5 = 0; | |
8068 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8069 { | |
8070 v6 = (char *)pNPCStats->pNewNPCData; | |
8071 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8072 { | |
8073 ++v5; | |
8074 v6 += 76; | |
8075 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8076 break; | |
8077 } | |
8078 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8079 v6[8] &= 0x7Fu; | |
8080 } | |
1104 | 8081 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 8082 { |
8083 v11 = pParty->pHirelings; | |
8084 memset(v11, 0, sizeof(NPCData)); | |
8085 } | |
1104 | 8086 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 8087 { |
8088 v11 = &pParty->pHirelings[1]; | |
8089 memset(v11, 0, sizeof(NPCData)); | |
8090 } | |
8091 pParty->field_709 = 0; | |
1035 | 8092 pParty->CountHirelings(); |
656 | 8093 dword_591084 = 0; |
8094 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8095 dword_7241C8 = 0; | |
8096 return; | |
8097 } | |
8098 } | |
8099 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8100 { | |
8101 switch(newDialogueType) | |
8102 { | |
8103 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8104 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8105 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8106 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8107 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8108 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8109 } | |
8110 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8111 sub_4B3FE5(npc_event_id); //200-310 | |
8112 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8113 { //400-410 | |
8114 dword_F8B1D8 = newDialogueType; | |
8115 DrawJoinGuildWindow(npc_event_id - 400); | |
8116 } | |
8117 else | |
8118 { | |
8119 switch ( npc_event_id ) | |
8120 { | |
8121 case 139: | |
8122 sub_4B1ECE(); | |
8123 break; | |
8124 case 311: | |
8125 sub_4BBA85_bounties(); | |
8126 break; | |
8127 case 399: | |
8128 sub_4BBCDD(); | |
8129 break; | |
8130 default: | |
8131 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8132 current_npc_text = 0; |
656 | 8133 EventProcessor(npc_event_id, 0, 1); |
8134 activeLevelDecoration = NULL; | |
8135 break; | |
8136 } | |
8137 } | |
8138 } | |
8139 if ( !dword_7241C8 ) | |
8140 pGame->Draw(); | |
8141 dword_7241C8 = 0; | |
8142 } | |
0 | 8143 |
8144 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8145 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8146 { |
8147 int v6; // edx@8 | |
8148 int v7; // edx@9 | |
8149 int v8; // edx@10 | |
8150 unsigned __int8 v9; // zf@16 | |
8151 char v10; // sf@16 | |
8152 unsigned __int8 v11; // of@16 | |
702 | 8153 bool test; |
0 | 8154 |
907 | 8155 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8156 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8157 return 0; |
907 | 8158 switch( p2DEvents[_2da_idx - 1].uType ) |
8159 { | |
8160 case BildingType_WeaponShop: | |
8161 { | |
8162 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8163 break; | |
8164 } | |
8165 case BildingType_ArmorShop: | |
8166 { | |
8167 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8168 break; | |
8169 } | |
8170 case BildingType_MagicShop: | |
8171 { | |
8172 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8173 break; | |
8174 } | |
8175 case BildingType_AlchemistShop: | |
8176 { | |
8177 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8178 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8179 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8180 break; | |
8181 } | |
8182 default: | |
8183 { | |
8184 test = false; | |
8185 break; | |
8186 } | |
8187 } | |
702 | 8188 return test; |
8189 /* | |
8190 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8191 { |
8192 v11 = __OFSUB__(v5, 2); | |
8193 v9 = v5 == 2; | |
8194 v10 = v5 - 2 < 0; | |
8195 goto LABEL_23; | |
8196 } | |
702 | 8197 if ( p2DEvents[a2 - 1].uType > 2 ) |
8198 { | |
8199 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8200 { |
8201 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8202 return v5 == 16; | |
8203 return 1; | |
8204 } | |
702 | 8205 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8206 return 0; |
702 | 8207 if ( p2DEvents[a2 - 1].uType == 4) |
8208 { | |
8209 if ( v5 < 13 ) | |
8210 return 0; | |
8211 if ( v5 <= 14 ) | |
8212 return 1; | |
8213 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8214 return 0; | |
8215 v11 = __OFSUB__(v3, 771); | |
8216 v9 = v3 == 771; | |
8217 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8218 LABEL_23: |
702 | 8219 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8220 return 0; | |
8221 return 1; | |
8222 } | |
8223 } | |
8224 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8225 { | |
8226 if ( v5 >= 3 ) | |
8227 { | |
8228 v11 = __OFSUB__(v5, 9); | |
8229 v9 = v5 == 9; | |
8230 v10 = v5 - 9 < 0; | |
8231 goto LABEL_23; | |
8232 } | |
0 | 8233 } |
8234 return 0; | |
702 | 8235 */ |
0 | 8236 } |
8237 | |
1209 | 8238 |
0 | 8239 |
8240 //----- (00405CFF) -------------------------------------------------------- | |
8241 void stru262_TurnBased::End(bool bPlaySound) | |
8242 { | |
8243 stru262_TurnBased *v2; // edi@1 | |
8244 int v3; // ebx@1 | |
8245 int v4; // esi@1 | |
8246 unsigned __int8 v5; // zf@1 | |
8247 unsigned __int8 v6; // sf@1 | |
8248 TurnBased_QueueElem *v7; // ecx@2 | |
8249 unsigned __int16 *pAttributes; // ecx@7 | |
8250 size_t v9; // edx@7 | |
8251 unsigned __int16 v10; // ax@8 | |
8252 TurnBased_QueueElem *v11; // ebx@12 | |
8253 ObjectType objType; // eax@13 | |
8254 int objID; // esi@13 | |
8255 int v14; // [sp+Ch] [bp-4h]@11 | |
8256 | |
8257 v2 = this; | |
8258 v3 = 0; | |
8259 v4 = 0; | |
8260 v5 = this->uActorQueueSize == 0; | |
8261 v6 = this->uActorQueueSize < 0; | |
8262 this->field_4 = 0; | |
8263 if ( !(v6 | v5) ) | |
8264 { | |
8265 v7 = this->pQueue; | |
8266 do | |
8267 { | |
848 | 8268 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8269 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8270 ++v4; |
8271 ++v7; | |
8272 } | |
8273 while ( v4 < v2->uActorQueueSize ); | |
8274 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8275 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8276 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8277 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8278 v9 = uNumSpriteObjects; |
0 | 8279 do |
8280 { | |
8281 v10 = *pAttributes; | |
8282 if ( *pAttributes & 4 ) | |
8283 { | |
8284 LOBYTE(v10) = v10 & 0xFB; | |
8285 *pAttributes = v10; | |
8286 } | |
8287 pAttributes += 56; | |
8288 --v9; | |
8289 } | |
8290 while ( v9 ); | |
8291 } | |
8292 v14 = 0; | |
8293 if ( v2->uActorQueueSize > 0 ) | |
8294 { | |
8295 v11 = v2->pQueue; | |
8296 do | |
8297 { | |
848 | 8298 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8299 objID = PID_ID(v11->uPackedID); | |
0 | 8300 if ( objType == OBJECT_Player ) |
8301 { | |
8302 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8303 } | |
8304 else | |
8305 { | |
8306 if ( objType == OBJECT_Actor ) | |
8307 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8308 } | |
8309 ++v14; | |
8310 ++v11; | |
8311 } | |
8312 while ( v14 < v2->uActorQueueSize ); | |
8313 v3 = 0; | |
8314 } | |
8315 pAudioPlayer->StopChannels(-1, -1); | |
8316 if ( bPlaySound != v3 ) | |
8317 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8318 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8319 pEventTimer->StopGameTime(); | |
8320 dword_50C994 = v3; | |
8321 dword_50C998_turnbased_icon_1A = v3; | |
8322 } | |
8323 // 50C994: using guessed type int dword_50C994; | |
8324 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8325 | |
8326 //----- (00405E14) -------------------------------------------------------- | |
8327 void stru262_TurnBased::_405E14() | |
8328 { | |
8329 stru262_TurnBased *v1; // esi@1 | |
8330 int v2; // ecx@1 | |
8331 SpellBuff *v3; // edi@2 | |
8332 Actor *v4; // ebx@3 | |
8333 signed int v5; // edx@20 | |
8334 AIDirection *v6; // esi@21 | |
8335 int v7; // eax@21 | |
8336 int v8; // eax@21 | |
8337 int v9; // eax@22 | |
8338 int v10; // eax@23 | |
8339 int v11; // eax@37 | |
8340 int v12; // eax@44 | |
8341 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8342 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8343 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8344 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8345 int v17; // [sp+5Ch] [bp-10h]@6 |
8346 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8347 int v19; // [sp+64h] [bp-8h]@8 | |
8348 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8349 | |
8350 v1 = this; | |
8351 v2 = 0; | |
8352 v18 = v1; | |
8353 v20 = 0; | |
8354 if ( (signed int)uNumActors > 0 ) | |
8355 { | |
90 | 8356 //v3 = pActors;//[0].pActorBuffs; |
1202 | 8357 v16 = pActors.data();//[0].pActorBuffs; |
90 | 8358 v3 = v16->pActorBuffs; |
0 | 8359 do |
8360 { | |
90 | 8361 v4 = v16; |
8362 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8363 v17 = v2; |
8364 else | |
8365 v17 = 1; | |
8366 v19 = v2; | |
8367 do | |
8368 { | |
8369 if ( v19 != 10 ) | |
8370 { | |
8371 v3->_4585CA(pParty->uTimePlayed); | |
8372 v2 = 0; | |
8373 } | |
8374 ++v19; | |
8375 ++v3; | |
8376 } | |
8377 while ( v19 < 22 ); | |
8378 if ( v17 != v2 | |
8379 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8380 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8381 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8382 if ( !(v4->uAttributes & 0x80) ) | |
8383 { | |
8384 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8385 { | |
8386 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8387 { | |
8388 v5 = v4->uCurrentActionLength; | |
8389 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8390 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8391 { | |
417 | 8392 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8393 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8394 v7 = v4->uAIState; |
8395 memcpy(&v15, v6, sizeof(v15)); | |
8396 v8 = v7 - 4; | |
8397 memcpy(&v14, &v15, sizeof(v14)); | |
8398 if ( v8 ) | |
8399 { | |
8400 v9 = v8 - 1; | |
8401 if ( v9 ) | |
8402 { | |
8403 v10 = v9 - 6; | |
8404 if ( v10 ) | |
8405 { | |
8406 if ( v10 != 8 ) | |
414 | 8407 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8408 } |
8409 } | |
8410 } | |
8411 else | |
8412 { | |
8413 v4->uCurrentActionTime = 0; | |
8414 v4->uCurrentActionLength = 0; | |
8415 v4->uAIState = Dead; | |
8416 v4->UpdateAnimation(); | |
8417 } | |
8418 v1 = v18; | |
8419 v2 = 0; | |
8420 } | |
8421 } | |
8422 } | |
8423 } | |
8424 ++v20; | |
90 | 8425 v3 = v16[1].pActorBuffs; |
8426 ++v16; | |
0 | 8427 } |
8428 while ( (signed int)v20 < (signed int)uNumActors ); | |
8429 } | |
8430 if ( v1->field_4 == 1 ) | |
8431 { | |
8432 v12 = v1->field_8; | |
8433 if ( v12 == 64 ) | |
8434 { | |
8435 v1->_406A63(); | |
8436 } | |
8437 else | |
8438 { | |
8439 if ( v12 > v2 ) | |
8440 { | |
8441 v1->_406B9F(); | |
8442 } | |
8443 else | |
8444 { | |
8445 v1->_406AFE(); | |
8446 v1->field_10 = 100; | |
8447 } | |
8448 } | |
8449 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8450 return; | |
8451 } | |
8452 if ( v1->field_4 == 2 ) | |
8453 { | |
8454 if ( !(v1->field_18 & 1) ) | |
8455 { | |
8456 v11 = v1->field_10; | |
8457 if ( v11 == 100 ) | |
8458 { | |
8459 v1->StartTurn(); | |
8460 LABEL_39: | |
8461 v1->_40652A(); | |
8462 return; | |
8463 } | |
8464 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8465 { | |
8466 v1->_4065B0(); | |
8467 goto LABEL_39; | |
8468 } | |
8469 } | |
8470 v1->NextTurn(); | |
8471 return; | |
8472 } | |
8473 if ( v1->field_4 == 3 ) | |
8474 { | |
8475 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8476 { | |
8477 v1->field_18 &= 0xFFFFFFF7u; | |
8478 v1->field_4 = 1; | |
8479 v1->field_8 = 64; | |
8480 } | |
8481 else | |
8482 { | |
8483 v1->_406FA8(); | |
8484 } | |
8485 } | |
8486 } | |
8487 | |
8488 //----- (0043FDED) -------------------------------------------------------- | |
8489 void PrepareActorRenderList_BLV() | |
8490 { | |
8491 RenderBillboard *v0; // esi@0 | |
8492 unsigned __int16 v3; // ax@3 | |
8493 unsigned int v4; // eax@5 | |
8494 unsigned __int16 v5; // cx@5 | |
8495 int v6; // esi@5 | |
8496 unsigned int v7; // eax@7 | |
8497 int v8; // eax@10 | |
8498 SpriteFrame *v9; // eax@16 | |
8499 SpriteFrame *v10; // ebx@18 | |
8500 //int *v11; // eax@18 | |
8501 int v12; // ecx@28 | |
8502 //IndoorCameraD3D **v14; // eax@36 | |
8503 double v15; // st7@36 | |
8504 float v16; // eax@36 | |
8505 //double v17; // ST30_8@36 | |
8506 signed __int64 v18; // qtt@36 | |
8507 int v19; // ST5C_4@36 | |
8508 signed __int64 v20; // qtt@37 | |
8509 int v21; // ST5C_4@37 | |
8510 signed __int16 v22; // cx@39 | |
8511 int v23; // ST50_4@40 | |
8512 signed int v24; // ecx@40 | |
8513 int v25; // edx@44 | |
8514 __int16 v26; // ax@44 | |
8515 //MonsterDesc *v27; // edx@44 | |
8516 //int v28; // ecx@44 | |
8517 unsigned __int8 v29; // zf@44 | |
8518 unsigned __int8 v30; // sf@44 | |
8519 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8520 int v32; // [sp+1Ch] [bp-38h]@5 | |
8521 int a3; // [sp+20h] [bp-34h]@5 | |
8522 int a2; // [sp+24h] [bp-30h]@5 | |
8523 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8524 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8525 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8526 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8527 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8528 int a6; // [sp+40h] [bp-14h]@34 | |
8529 int v43; // [sp+44h] [bp-10h]@34 | |
8530 int z; // [sp+48h] [bp-Ch]@32 | |
8531 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8532 int x; // [sp+50h] [bp-4h]@32 | |
8533 | |
8534 for (uint i = 0; i < uNumActors; ++i) | |
8535 { | |
1202 | 8536 auto p = &pActors[i]; |
0 | 8537 |
8538 if (p->uAIState == Removed || | |
8539 p->uAIState == Disabled) | |
8540 continue; | |
8541 | |
8542 a5 = p->uSectorID; | |
8543 a2 = p->vPosition.y; | |
8544 a1a = p->vPosition.x; | |
8545 a3 = p->vPosition.z; | |
8546 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8547 LOWORD(v0) = p->uYawAngle; | |
8548 v5 = p->uCurrentActionAnimation; | |
8549 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8550 v32 = v6; | |
8551 if ( pParty->bTurnBasedModeOn ) | |
8552 { | |
8553 if ( v5 == 1 ) | |
8554 { | |
8555 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8556 goto LABEL_10; | |
8557 } | |
8558 } | |
8559 else | |
8560 { | |
8561 if ( v5 == 1 ) | |
8562 { | |
8563 v7 = pBLVRenderParams->field_0_timer_; | |
8564 LABEL_10: | |
8565 v8 = i * 32 + v7; | |
8566 goto LABEL_12; | |
8567 } | |
8568 } | |
8569 v8 = p->uCurrentActionTime; | |
8570 LABEL_12: | |
8571 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8572 v8 = 0; | |
8573 v31 = p->pSpriteIDs[v5]; | |
8574 if (p->uAIState == Resurrected) | |
8575 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8576 else | |
8577 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8578 v41 = 0; | |
8579 v10 = v9; | |
8580 //v11 = (int *)v9->uFlags; | |
8581 if (v9->uFlags & 2) | |
8582 v41 = 2; | |
8583 if (v9->uFlags & 0x40000) | |
8584 v41 |= 0x40u; | |
8585 if (v9->uFlags & 0x20000) | |
8586 LOBYTE(v41) = v41 | 0x80; | |
8587 v0 = (RenderBillboard *)(256 << v6); | |
8588 if ( (unsigned int)v0 & v9->uFlags) | |
8589 v41 |= 4u; | |
8590 if ( v10->uGlowRadius ) | |
8591 { | |
8592 //LOBYTE(v11) = byte_4E94D3; | |
8593 pMobileLightsStack->AddLight( | |
8594 a1a, | |
8595 a2, | |
8596 a3, | |
8597 a5, | |
8598 v10->uGlowRadius, | |
8599 0xFFu, | |
8600 0xFFu, | |
8601 0xFFu, | |
8602 byte_4E94D3); | |
8603 } | |
8604 v12 = 0; | |
8605 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8606 continue; | |
8607 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8608 { | |
8609 ++v12; | |
8610 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8611 goto _continue; | |
8612 } | |
8613 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8614 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8615 continue; | |
8616 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8617 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8618 if (uNumBillboardsToDraw >= 500) | |
8619 break; | |
8620 ++uNumBillboardsToDraw; | |
8621 ++uNumSpritesDrawnThisFrame; | |
8622 p->uAttributes |= 8u; | |
8623 v29 = pRenderer->pRenderD3D == 0; | |
8624 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8625 v0->uPalette = v10->uPaletteIndex; | |
8626 v0->uIndoorSectorID = a5; | |
8627 if ( v29 ) | |
8628 { | |
8629 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8630 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8631 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8632 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8633 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8634 } | |
8635 else | |
8636 { | |
8637 //v14 = &pGame->pIndoorCameraD3D; | |
8638 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8639 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8640 v16 = v0->fov_x; | |
8641 v0->fov_y = v15; | |
8642 //v17 = v16 + 6.7553994e15; | |
8643 LODWORD(v18) = 0; | |
8644 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8645 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8646 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8647 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8648 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8649 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8650 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8651 { | |
8652 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8653 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8654 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8655 goto LABEL_43; |
8656 } | |
8657 } | |
8658 else | |
8659 { | |
8660 v22 = p->pActorBuffs[3].uPower; | |
8661 if ( v22 ) | |
8662 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8663 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8664 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8665 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8666 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8667 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8668 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8669 goto LABEL_44; |
8670 } | |
8671 } | |
8672 LABEL_44: | |
8673 HIWORD(v25) = HIWORD(x); | |
430 | 8674 v0->world_x = a1a; |
8675 v0->world_y = a2; | |
8676 v0->world_z = a3; | |
0 | 8677 v0->uScreenSpaceX = v43; |
8678 v0->uScreenSpaceY = a6; | |
8679 LOWORD(v25) = 0; | |
8680 LOBYTE(v26) = v41; | |
194 | 8681 |
862 | 8682 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8683 v0->actual_z = HIWORD(x); |
862 | 8684 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8685 |
0 | 8686 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8687 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8688 v0->field_1E = v41; | |
8689 v0->pSpriteFrame = v10; | |
8690 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8691 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8692 { | |
8693 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8694 v0->field_1E = v26; | |
8695 } | |
8696 | |
8697 _continue: | |
8698 ; | |
8699 } | |
8700 } | |
8701 | |
8702 //----- (00444732) -------------------------------------------------------- | |
428 | 8703 char *GetEventHintString(unsigned int uEventID) |
8704 { | |
8705 signed int event_index; // edx@1 | |
8706 int event_pos; // esi@4 | |
0 | 8707 char *result; // eax@6 |
428 | 8708 unsigned int str_index; // eax@9 |
8709 int i; // esi@11 | |
8710 _evt_raw* test_evt; | |
8711 _evt_raw* last_evt; | |
8712 | |
8713 event_index = 0; | |
8714 if ( uLevelEVT_NumEvents <= 0 ) | |
8715 return NULL; | |
8716 | |
8717 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 8718 while ( 1 ) |
8719 { | |
428 | 8720 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
8721 { | |
8722 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
8723 last_evt=test_evt; | |
8724 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
8725 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 8726 break; |
8727 } | |
428 | 8728 ++event_index; |
8729 if ( event_index >= uLevelEVT_NumEvents ) | |
8730 return NULL; | |
8731 } | |
8732 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8733 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
8734 { | |
8735 str_index = EVT_DWORD(test_evt->v5); | |
8736 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 8737 } |
8738 else | |
8739 { | |
428 | 8740 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
8741 { | |
8742 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
8743 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8744 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
8745 { | |
8746 str_index = EVT_DWORD(test_evt->v5); | |
8747 if ( str_index < 600 ) | |
8748 return (char *)p2DEvents[str_index - 1].pName; | |
8749 } | |
8750 } | |
8751 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
8752 } | |
8753 | |
0 | 8754 return result; |
8755 } |