Mercurial > mm7
annotate mm7_4.cpp @ 1130:d98415be04ca
banker's rounding template
author | Grumpy7 |
---|---|
date | Fri, 31 May 2013 23:38:43 +0200 |
parents | cf6cd674c398 |
children | 29a8defbad9e |
rev | line source |
---|---|
198 | 1 #include <assert.h> |
0 | 2 |
1016 | 3 #include "VideoPlayer.h" |
4 #include "Sprites.h" | |
5 #include "BSPModel.h" | |
6 #include "OutdoorCamera.h" | |
7 #include "Mouse.h" | |
8 #include "stru6.h" | |
9 #include "stru11.h" | |
10 #include "stru12.h" | |
11 | |
12 #include "LightmapBuilder.h" | |
341 | 13 #include "MM7.h" |
0 | 14 #include "MapInfo.h" |
15 #include "Game.h" | |
16 #include "GUIWindow.h" | |
17 #include "GUIFont.h" | |
18 #include "Party.h" | |
19 #include "AudioPlayer.h" | |
20 #include "Outdoor.h" | |
21 #include "IndoorCamera.h" | |
22 #include "LOD.h" | |
23 #include "Actor.h" | |
24 #include "Allocator.h" | |
25 #include "Events.h" | |
26 #include "Viewport.h" | |
27 #include "FrameTableInc.h" | |
28 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
29 #include "SpriteObject.h" |
0 | 30 #include "ObjectList.h" |
31 #include "DecorationList.h" | |
32 #include "Time.h" | |
33 #include "IconFrameTable.h" | |
34 #include "PlayerFrameTable.h" | |
35 #include "Awards.h" | |
36 #include "TurnEngine.h" | |
37 #include "Events2D.h" | |
38 #include "stru159.h" | |
189 | 39 #include "texts.h" |
0 | 40 #include "Log.h" |
629 | 41 #include "UIHouses.h" |
0 | 42 #include "mm7_data.h" |
43 | |
44 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 45 void __cdecl check_event_triggers() |
0 | 46 { |
47 int v0; // eax@1 | |
48 LevelDecoration *v1; // esi@2 | |
49 signed int v2; // edi@2 | |
50 int v3; // ebx@2 | |
51 int v4; // eax@3 | |
52 int v5; // ebx@3 | |
53 unsigned int v6; // ecx@3 | |
54 unsigned int v7; // edx@6 | |
55 unsigned int v8; // edx@8 | |
112 | 56 Actor *v9; // edi@13 |
0 | 57 int v10; // ebx@14 |
58 int v11; // eax@14 | |
59 int v12; // ebx@14 | |
60 unsigned int v13; // ecx@14 | |
61 int v14; // edx@15 | |
62 unsigned int v15; // edx@17 | |
63 unsigned int v16; // edx@19 | |
64 char *v17; // edi@25 | |
65 int v18; // ebx@26 | |
66 int v19; // eax@26 | |
67 int v20; // ebx@26 | |
68 unsigned int v21; // ecx@26 | |
69 int v22; // edx@27 | |
70 unsigned int v23; // edx@29 | |
71 unsigned int v24; // edx@31 | |
72 int v25; // [sp+0h] [bp-24h]@3 | |
73 int v26; // [sp+0h] [bp-24h]@14 | |
74 int v27; // [sp+0h] [bp-24h]@26 | |
75 int v28; // [sp+4h] [bp-20h]@3 | |
76 int v29; // [sp+4h] [bp-20h]@14 | |
77 int v30; // [sp+4h] [bp-20h]@26 | |
78 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
79 int v32; // [sp+Ch] [bp-18h]@2 | |
80 int v33; // [sp+10h] [bp-14h]@2 | |
81 int i; // [sp+14h] [bp-10h]@1 | |
82 int v35; // [sp+18h] [bp-Ch]@2 | |
83 int v36; // [sp+1Ch] [bp-8h]@3 | |
84 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
85 signed int v38; // [sp+20h] [bp-4h]@24 | |
86 | |
87 v0 = 0; | |
88 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
89 { | |
90 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
91 v2 = v1->field_18; | |
92 v3 = v1->vPosition.y; | |
93 v33 = v1->vPosition.x; | |
94 v32 = v1->vPosition.y; | |
95 v35 = v1->vPosition.z; | |
96 v31 = v1->field_18; | |
97 if ( v1->field_2 & 1 ) | |
98 { | |
99 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
100 v25 = abs(v3 - pParty->vPosition.y); | |
101 v28 = abs(v35 - pParty->vPosition.z); | |
102 v4 = v36; | |
103 v5 = v25; | |
104 v6 = v28; | |
105 if ( v36 < v25 ) | |
106 { | |
107 v4 = v25; | |
108 v5 = v36; | |
109 } | |
110 if ( v4 < v28 ) | |
111 { | |
112 v7 = v4; | |
113 v4 = v28; | |
114 v6 = v7; | |
115 } | |
116 if ( v5 < (signed int)v6 ) | |
117 { | |
118 v8 = v6; | |
119 v6 = v5; | |
120 v5 = v8; | |
121 } | |
122 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 123 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 124 } |
125 if ( v1->field_2 & 2 ) | |
126 { | |
127 v37 = 0; | |
128 if ( (signed int)uNumActors > 0 ) | |
129 { | |
112 | 130 v9 = pActors;//[0].vPosition.y; |
0 | 131 do |
132 { | |
112 | 133 v10 = abs(v33 - v9->vPosition.x); |
134 v29 = abs(v32 - v9->vPosition.y); | |
135 v26 = abs(v35 - v9->vPosition.z); | |
0 | 136 v11 = v10; |
137 v12 = v29; | |
138 v13 = v26; | |
139 if ( v11 < v29 ) | |
140 { | |
141 v14 = v11; | |
142 v11 = v29; | |
143 v12 = v14; | |
144 } | |
145 if ( v11 < v26 ) | |
146 { | |
147 v15 = v11; | |
148 v11 = v26; | |
149 v13 = v15; | |
150 } | |
151 if ( v12 < (signed int)v13 ) | |
152 { | |
153 v16 = v13; | |
154 v13 = v12; | |
155 v12 = v16; | |
156 } | |
157 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
158 EventProcessor(v1->field_16_event_id, 0, 1); | |
159 ++v37; | |
112 | 160 ++v9; |
0 | 161 } |
162 while ( v37 < (signed int)uNumActors ); | |
163 } | |
164 } | |
165 if ( v1->field_2 & 4 ) | |
166 { | |
167 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
168 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
169 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
170 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 171 do |
172 { | |
173 v18 = abs(v33 - *((int *)v17 - 1)); | |
174 v30 = abs(v32 - *(int *)v17); | |
175 v27 = abs(v35 - *((int *)v17 + 1)); | |
176 v19 = v18; | |
177 v20 = v30; | |
178 v21 = v27; | |
179 if ( v19 < v30 ) | |
180 { | |
181 v22 = v19; | |
182 v19 = v30; | |
183 v20 = v22; | |
184 } | |
185 if ( v19 < v27 ) | |
186 { | |
187 v23 = v19; | |
188 v19 = v27; | |
189 v21 = v23; | |
190 } | |
191 if ( v20 < (signed int)v21 ) | |
192 { | |
193 v24 = v21; | |
194 v21 = v20; | |
195 v20 = v24; | |
196 } | |
197 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
198 EventProcessor(v1->field_16_event_id, 0, 1); | |
199 ++v38; | |
200 v17 += 112; | |
201 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
202 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 203 } |
204 } | |
205 v0 = i + 1; | |
206 } | |
207 } | |
208 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
209 | |
210 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 211 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 212 { |
213 int v13; // ecx@13 | |
214 signed int v14; // ebx@14 | |
215 int v15; // eax@16 | |
729 | 216 //int v16; // edx@19 |
792 | 217 //int v17; // ST18_4@19 |
218 //signed int v18; // edx@19 | |
219 //signed __int64 v19; // qtt@19 | |
0 | 220 int v21; // eax@27 |
792 | 221 //int v22; // ecx@29 |
0 | 222 signed int v28; // eax@45 |
223 int v29; // ebx@47 | |
224 int v30; // edx@49 | |
830 | 225 //int v31; // ST10_4@49 |
226 //signed int v32; // edx@49 | |
0 | 227 signed __int64 v33; // qtt@49 |
830 | 228 //signed int v34; // eax@54 |
229 //signed int v35; // esi@56 | |
230 //int result; // eax@57 | |
0 | 231 int v38; // edx@62 |
792 | 232 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 233 bool v47; // [sp+24h] [bp-1Ch]@43 |
234 bool v48; // [sp+28h] [bp-18h]@10 | |
235 bool v49; // [sp+28h] [bp-18h]@41 | |
236 bool v50; // [sp+2Ch] [bp-14h]@12 | |
237 signed int v53; // [sp+30h] [bp-10h]@10 | |
238 signed int v54; // [sp+30h] [bp-10h]@41 | |
239 signed int v55; // [sp+34h] [bp-Ch]@1 | |
240 | |
730 | 241 //LOG_DECOMPILATION_WARNING(); |
242 | |
243 static int blv_floor_id[50]; // 00721200 | |
244 static int blv_floor_level[50]; // 007212C8 | |
245 | |
246 static __int16 word_721390_ys[104]; // idb | |
247 static __int16 word_721460_xs[104]; // idb | |
0 | 248 |
249 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 250 v55 = 0; |
0 | 251 for (uint i = 0; i < pSector->uNumFloors; ++i) |
252 { | |
253 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
254 if (pFloor->Clickable()) | |
255 continue; | |
256 | |
792 | 257 assert(pFloor->uNumVertices); |
0 | 258 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
259 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
260 { | |
261 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
262 { | |
730 | 263 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
264 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
265 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
266 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 267 } |
730 | 268 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
269 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
270 | |
792 | 271 v50 = word_721390_ys[0] >= y; |
0 | 272 v53 = 0; |
792 | 273 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
274 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 275 { |
276 if (v53 >= 2) | |
277 break; | |
278 | |
279 v48 = v50; | |
280 v50 = word_721390_ys[j + 1] >= y; | |
730 | 281 |
282 v13 = i; | |
792 | 283 if (v48 == v50) |
284 continue; | |
285 | |
286 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
1110 | 287 v15 = v14 | (word_721460_xs[j] < x); |
792 | 288 |
289 if (v15 == 3) | |
290 continue; | |
291 else if (!v15) | |
292 ++v53; | |
293 else | |
0 | 294 { |
792 | 295 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 296 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 297 |
298 if (res + word_721460_xs[j] >= x) | |
729 | 299 ++v53; |
0 | 300 } |
792 | 301 } |
302 | |
303 | |
0 | 304 if ( v53 == 1 ) |
305 { | |
306 if ( v55 >= 50 ) | |
307 break; | |
723 | 308 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 309 { |
725 | 310 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 311 } |
312 else | |
313 { | |
871 | 314 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 315 } |
792 | 316 blv_floor_level[v55] = v21; |
317 blv_floor_id[v55] = pSector->pFloors[i]; | |
318 v55++; | |
0 | 319 } |
792 | 320 } |
321 } | |
322 | |
323 | |
0 | 324 if ( pSector->field_0 & 8 ) |
325 { | |
326 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
327 { | |
328 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
329 if (portal->uPolygonType != POLYGON_Floor) | |
330 continue; | |
331 | |
830 | 332 if (!portal->uNumVertices) |
333 continue; | |
334 | |
723 | 335 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
336 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
337 { | |
0 | 338 for (uint j = 0; j < portal->uNumVertices; ++j) |
339 { | |
730 | 340 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
341 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
342 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
343 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
344 } | |
345 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
346 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 347 v54 = 0; |
830 | 348 v47 = word_721390_ys[0] >= y; |
349 | |
350 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 351 { |
830 | 352 v49 = v47; |
0 | 353 if ( v54 >= 2 ) |
354 break; | |
830 | 355 v47 = word_721390_ys[j + 1] >= y; |
0 | 356 if ( v49 != v47 ) |
357 { | |
830 | 358 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
359 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 360 if ( v29 != 3 ) |
361 { | |
723 | 362 if ( !v29 ) |
729 | 363 ++v54; |
364 else | |
365 { | |
830 | 366 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 367 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 368 if (res + word_721460_xs[j] >= x) |
723 | 369 ++v54; |
729 | 370 } |
0 | 371 } |
372 } | |
373 } | |
374 if ( v54 == 1 ) | |
375 { | |
376 if ( v55 >= 50 ) | |
377 break; | |
830 | 378 blv_floor_level[v55] = -29000; |
379 blv_floor_id[v55] = pSector->pPortals[i]; | |
380 v55++; | |
0 | 381 } |
382 } | |
383 } | |
384 } | |
385 if ( v55 == 1 ) | |
386 { | |
730 | 387 *pFaceID = blv_floor_id[0]; |
725 | 388 return blv_floor_level[0]; |
0 | 389 } |
390 if ( !v55 ) | |
391 return -30000; | |
730 | 392 *pFaceID = blv_floor_id[0]; |
725 | 393 //result = blv_floor_level[0]; |
830 | 394 |
395 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 396 { |
725 | 397 if ( blv_floor_level[0] <= z + 5 ) |
398 { | |
399 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 400 continue; |
725 | 401 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 402 *pFaceID = blv_floor_id[v35]; |
717 | 403 continue; |
404 } | |
725 | 405 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
406 { | |
407 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 408 *pFaceID = blv_floor_id[v35]; |
717 | 409 } |
830 | 410 }*/ |
411 | |
412 | |
413 int result = blv_floor_level[0]; | |
414 for (uint i = 1; i < v55; ++i) | |
415 { | |
416 v38 = blv_floor_level[i]; | |
417 if ( result <= z + 5 ) | |
418 { | |
419 if ( v38 > result && v38 <= z + 5 ) | |
420 { | |
421 result = blv_floor_level[i]; | |
422 *pFaceID = blv_floor_id[i]; | |
423 } | |
424 } | |
425 else if ( v38 < result ) | |
426 { | |
427 result = blv_floor_level[i]; | |
428 *pFaceID = blv_floor_id[i]; | |
429 } | |
430 } | |
431 | |
432 return result; | |
0 | 433 } |
434 | |
435 //----- (0046D49E) -------------------------------------------------------- | |
791 | 436 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 437 { |
723 | 438 BSPModel *pBModel; // esi@4 |
439 ODMFace *pFace; // ecx@11 | |
0 | 440 int v14; // edx@20 |
441 signed int v18; // edx@26 | |
442 int v19; // eax@28 | |
443 int v20; // edx@30 | |
444 int v21; // ST1C_4@30 | |
445 signed int v22; // edx@30 | |
446 signed __int64 v23; // qtt@30 | |
447 int v24; // eax@36 | |
448 signed int v25; // ecx@38 | |
449 int result; // eax@42 | |
450 signed int v27; // ecx@43 | |
451 int v28; // edi@44 | |
452 signed int v29; // edx@44 | |
453 int v30; // esi@45 | |
454 int v31; // eax@45 | |
455 ODMFace *v32; // eax@57 | |
456 int v33; // ecx@59 | |
457 int v36; // [sp+14h] [bp-2Ch]@24 | |
458 int v38; // [sp+1Ch] [bp-24h]@2 | |
459 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 460 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
461 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 462 bool v43; // [sp+30h] [bp-10h]@22 |
463 bool v44; // [sp+34h] [bp-Ch]@24 | |
464 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
465 signed int v48; // [sp+58h] [bp+18h]@22 | |
466 signed int v49; // [sp+58h] [bp+18h]@43 | |
467 | |
468 v46 = 1; | |
469 dword_721160[0] = -1; | |
470 dword_721110[0] = -1; | |
791 | 471 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 472 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 473 { |
474 *a6 = 0; | |
725 | 475 return odm_floor_level[0]; |
723 | 476 } |
0 | 477 v38 = 0; |
723 | 478 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
479 { | |
480 pBModel = &pOutdoor->pBModels[v38]; | |
481 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
482 { | |
483 if ( (signed int)pBModel->uNumFaces > 0 ) | |
484 { | |
485 v39 = 0; | |
486 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
487 { | |
488 pFace = &pBModel->pFaces[v39]; | |
489 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
490 && !(pFace->uAttributes & 0x20000000) | |
491 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
492 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 493 { |
723 | 494 if ( pFace->uNumVertices ) |
0 | 495 { |
723 | 496 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 497 { |
723 | 498 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
499 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
500 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
501 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
502 } | |
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 } | |
723 | 552 ++v39; |
553 } | |
554 } | |
555 } | |
0 | 556 ++v38; |
557 } | |
558 if ( v46 == 1 ) | |
559 { | |
560 *a6 = 0; | |
725 | 561 return odm_floor_level[0]; |
0 | 562 } |
563 v27 = 0; | |
564 if ( v46 <= 1 ) | |
565 *a6 = 0; | |
723 | 566 else |
567 { | |
725 | 568 //v29 = 1; |
723 | 569 for ( v49 = 1; v49 < v46; ++v49 ) |
570 { | |
725 | 571 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 572 { |
573 v27 = v49; | |
725 | 574 //++v29; |
723 | 575 break; |
576 } | |
725 | 577 if ( odm_floor_level[0] > Z + 5 ) |
578 { | |
579 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
580 { | |
581 //++v29; | |
723 | 582 break; |
583 } | |
584 v27 = v49; | |
725 | 585 //++v29; |
723 | 586 break; |
587 } | |
725 | 588 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 589 { |
590 v27 = v49; | |
725 | 591 //++v29; |
723 | 592 } |
593 } | |
594 if ( !v27 ) | |
595 *a6 = 0; | |
596 else | |
597 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
598 } | |
0 | 599 if ( v27 ) |
600 { | |
601 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 602 *pIsOnWater = false; |
603 if ( v32->Fluid()) | |
604 *pIsOnWater = true; | |
0 | 605 } |
725 | 606 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
607 odm_floor_level[0] = odm_floor_level[v27]; | |
608 return odm_floor_level[0]; | |
0 | 609 } |
610 | |
611 //----- (0046D8E3) -------------------------------------------------------- | |
612 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
613 { | |
614 int v4; // ebx@1 | |
615 unsigned int v5; // ecx@1 | |
616 BSPModel *v6; // edi@3 | |
617 ODMFace *v7; // esi@10 | |
618 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
619 signed __int16 *v9; // eax@18 |
0 | 620 int v10; // edx@19 |
621 int v11; // ecx@21 | |
622 int v12; // ecx@23 | |
623 signed int v13; // eax@25 | |
624 int v14; // edx@27 | |
625 int v15; // edx@29 | |
626 int v16; // ST18_4@29 | |
627 signed int v17; // edx@29 | |
628 signed __int64 v18; // qtt@29 | |
629 int v19; // eax@35 | |
630 signed int v20; // ecx@37 | |
631 signed int v22; // ebx@42 | |
632 unsigned int v23; // esi@43 | |
633 int v24; // edx@44 | |
634 int v25; // eax@44 | |
635 int v26; // [sp+Ch] [bp-38h]@7 | |
636 int v27; // [sp+10h] [bp-34h]@21 | |
637 int v28; // [sp+18h] [bp-2Ch]@21 | |
638 int v29; // [sp+1Ch] [bp-28h]@2 | |
639 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
640 signed int v31; // [sp+24h] [bp-20h]@1 | |
641 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
642 int v33; // [sp+2Ch] [bp-18h]@7 | |
643 bool v34; // [sp+30h] [bp-14h]@21 | |
644 bool v35; // [sp+34h] [bp-10h]@23 | |
645 signed int v36; // [sp+38h] [bp-Ch]@17 | |
646 signed int v37; // [sp+38h] [bp-Ch]@21 | |
647 signed int v38; // [sp+38h] [bp-Ch]@42 | |
648 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
649 signed int v40; // [sp+40h] [bp-4h]@1 | |
650 | |
651 dword_720ED0[0] = -1; | |
652 dword_720E80[0] = -1; | |
653 v4 = a1; | |
654 v5 = 0; | |
655 v40 = a2; | |
656 v31 = v4; | |
657 v39 = 1; | |
658 dword_720F20[0] = 10000; | |
659 v32 = 0; | |
660 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
661 { | |
662 v29 = 0; | |
663 do | |
664 { | |
665 v6 = &pOutdoor->pBModels[v29]; | |
666 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
667 { | |
668 if ( v4 >= v6->sMinX ) | |
669 { | |
670 if ( v40 <= v6->sMaxY ) | |
671 { | |
672 if ( v40 >= v6->sMinY ) | |
673 { | |
674 v33 = v5; | |
675 v26 = v6->uNumFaces; | |
676 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
677 { | |
678 v30 = v5; | |
679 while ( 1 ) | |
680 { | |
681 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
682 v8 = v7->uPolygonType; | |
683 if ( (v8 == 5 || v8 == 6) | |
684 && !(BYTE3(v7->uAttributes) & 0x20) | |
685 && v4 <= v7->pBoundingBox.x2 | |
686 && v4 >= v7->pBoundingBox.x1 | |
687 && v40 <= v7->pBoundingBox.y2 | |
688 && v40 >= v7->pBoundingBox.y1 ) | |
689 { | |
690 v36 = v5; | |
691 if ( v7->uNumVertices ) | |
692 { | |
693 v9 = v7->pXInterceptDisplacements; | |
694 do | |
695 { | |
696 v10 = 2 * v36; | |
697 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
698 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
699 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
700 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
701 ++v9; | |
702 } | |
703 while ( v36 < v7->uNumVertices ); | |
704 v4 = v31; | |
705 } | |
706 v27 = 2 * v7->uNumVertices; | |
707 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
708 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
709 v11 = 0; | |
710 v34 = word_720CE0_ys[0] >= v40; | |
711 v37 = 0; | |
712 v28 = 0; | |
713 if ( v27 > 0 ) | |
714 { | |
715 do | |
716 { | |
717 if ( v37 >= 2 ) | |
718 break; | |
719 v12 = v11; | |
720 v4 = v31; | |
721 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
722 if ( v34 != v35 ) | |
723 { | |
724 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
1110 | 725 v14 = v13 | (word_720DB0_xs[v12] < v31); |
0 | 726 if ( v14 != 3 ) |
727 { | |
728 if ( !v14 | |
729 || (v15 = word_720CE0_ys[v12], | |
730 v16 = word_720CE0_ys[v12 + 1] - v15, | |
731 v17 = v40 - v15, | |
732 LODWORD(v18) = v17 << 16, | |
733 HIDWORD(v18) = v17 >> 16, | |
734 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
735 - (signed int)word_720DB0_xs[v12]) | |
736 * v18 | |
737 / v16) >> 16) | |
738 + word_720DB0_xs[v12]) >= v31) ) | |
739 ++v37; | |
740 } | |
741 } | |
742 v11 = v28 + 1; | |
743 v34 = v35; | |
744 ++v28; | |
745 } | |
746 while ( v28 < v27 ); | |
747 if ( v37 == 1 ) | |
748 { | |
749 if ( v39 >= 20 ) | |
750 break; | |
751 if ( v7->uPolygonType == 5 ) | |
752 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
753 else | |
754 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
755 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
756 + HIWORD(v7->zCalc3); | |
757 v20 = v39++; | |
758 dword_720F20[v20] = v19; | |
759 dword_720ED0[v20] = v32; | |
760 dword_720E80[v20] = v33; | |
761 } | |
762 } | |
763 } | |
764 ++v33; | |
765 v30 += 308; | |
766 if ( v33 >= v26 ) | |
767 break; | |
768 v5 = 0; | |
769 } | |
770 } | |
771 } | |
772 } | |
773 } | |
774 } | |
775 ++v32; | |
776 ++v29; | |
777 v5 = 0; | |
778 } | |
779 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
780 if ( !v39 ) | |
781 { | |
782 *(int *)a4 = 0; | |
783 return dword_720F20[0]; | |
784 } | |
785 } | |
786 v22 = 0; | |
787 v38 = v5; | |
788 if ( v39 <= (signed int)v5 ) | |
789 goto LABEL_54; | |
790 v23 = 0; | |
791 do | |
792 { | |
793 v24 = dword_720F20[v5 / 4]; | |
794 v25 = *(int *)((char *)dword_720F20 + v23); | |
795 if ( v24 == v25 ) | |
796 goto LABEL_50; | |
797 if ( v25 > a3 + 15 ) | |
798 { | |
799 if ( v24 >= v25 ) | |
800 goto LABEL_51; | |
801 LABEL_50: | |
802 v22 = v38; | |
803 v23 = v5; | |
804 goto LABEL_51; | |
805 } | |
806 if ( v24 > v25 && v24 <= a3 + 15 ) | |
807 goto LABEL_50; | |
808 LABEL_51: | |
809 ++v38; | |
810 v5 += 4; | |
811 } | |
812 while ( v38 < v39 ); | |
813 if ( v22 ) | |
814 { | |
815 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
816 return dword_720F20[v22]; | |
817 } | |
818 LABEL_54: | |
819 *(int *)a4 = 0; | |
820 return dword_720F20[v22]; | |
821 } | |
822 | |
138 | 823 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
824 // for a right-handed system, that would be an inverse normal | |
0 | 825 //----- (0046DCC8) -------------------------------------------------------- |
138 | 826 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
827 { | |
828 auto grid_x = WorldPosToGridCellX(pos_x); | |
829 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
830 | |
831 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
832 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
833 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
834 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
835 | |
836 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
837 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
838 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
839 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
840 | |
841 float side1_dx, side1_dy, side1_dz, | |
842 side2_dx, side2_dy, side2_dz; | |
843 | |
844 auto dx = abs(pos_x - grid_pos_x1), | |
845 dz = abs(grid_pos_z1 - pos_z); | |
846 if (dz >= dx) | |
847 { | |
848 side1_dy = (double)(x1z1_y - x1z2_y); | |
849 side2_dy = (double)(x2z2_y - x1z2_y); | |
850 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
851 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
852 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
853 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 854 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 855 /* |\ |
856 side1 | \ | |
857 |____\ | |
858 side 2 */ | |
859 } | |
860 else | |
861 { | |
862 side1_dy = (double)(x2z2_y - x2z1_y); | |
863 side2_dy = (double)(x1z1_y - x2z1_y); | |
864 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
865 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
866 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
867 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
868 | |
869 /* side 2 | |
870 _____ | |
871 \ | | |
872 \ | side 1 | |
873 \| */ | |
874 } | |
875 | |
876 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
877 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
878 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
879 | |
880 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
881 if (fabsf(mag) < 1e-6f) | |
882 { | |
883 out->y = 0; | |
884 out->x = 0; | |
885 out->z = 65536; | |
886 } | |
887 else | |
888 { | |
889 float invmag = 1.0 / mag; | |
890 out->x = invmag * nx * 65536.0; | |
891 out->y = invmag * ny * 65536.0; | |
892 out->z = invmag * nz * 65536.0; | |
893 } | |
894 } | |
895 | |
0 | 896 //----- (0046DEF2) -------------------------------------------------------- |
897 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
898 { | |
899 unsigned int result; // eax@1 | |
900 | |
901 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
902 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 903 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
904 return result; | |
905 } | |
906 | |
907 //----- (0046DF1A) -------------------------------------------------------- | |
908 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
909 { | |
910 Actor *v2; // edi@1 | |
911 unsigned __int16 v3; // ax@1 | |
912 int v4; // esi@6 | |
913 int v5; // ecx@8 | |
914 int v6; // eax@10 | |
915 int v7; // edx@12 | |
916 int v8; // ecx@14 | |
917 int v9; // eax@14 | |
918 int v10; // ebx@14 | |
919 int v11; // esi@14 | |
920 int v12; // ebx@15 | |
921 int v13; // ebx@17 | |
922 unsigned int v14; // eax@20 | |
923 signed int result; // eax@21 | |
924 int v16; // [sp+Ch] [bp-10h]@1 | |
925 int v17; // [sp+10h] [bp-Ch]@14 | |
926 int v18; // [sp+14h] [bp-8h]@14 | |
927 int v19; // [sp+18h] [bp-4h]@14 | |
928 | |
929 v16 = a1; | |
930 v2 = &pActors[a1]; | |
931 v3 = v2->uAIState; | |
932 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
933 goto LABEL_25; | |
934 v4 = v2->uActorRadius; | |
935 if ( a2 ) | |
936 v4 = a2; | |
937 v5 = v2->vPosition.x; | |
938 if ( stru_721530.sMaxX > v5 + v4 | |
939 || stru_721530.sMinX < v5 - v4 | |
940 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
941 || stru_721530.sMinY < v6 - v4 | |
942 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
943 || stru_721530.sMinZ < v7 | |
944 || (v8 = v5 - stru_721530.normal.x, | |
945 v9 = v6 - stru_721530.normal.y, | |
946 v10 = stru_721530.prolly_normal_d + v4, | |
947 v17 = stru_721530.prolly_normal_d + v4, | |
948 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
949 v18 = v8, | |
950 v19 = v9, | |
951 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
952 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
953 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
954 { | |
955 LABEL_25: | |
956 result = 0; | |
957 } | |
958 else | |
959 { | |
295 | 960 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 961 if ( v13 < 0 ) |
962 v13 = 0; | |
963 if ( v13 < stru_721530.field_7C ) | |
964 { | |
965 stru_721530.field_7C = v13; | |
966 v14 = 8 * v16; | |
862 | 967 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 968 stru_721530.uFaceID = v14; |
969 } | |
970 result = 1; | |
971 } | |
972 return result; | |
973 } | |
974 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
975 | |
976 //----- (0046E0B2) -------------------------------------------------------- | |
977 void __cdecl _46E0B2_collide_against_decorations() | |
978 { | |
979 BLVSector *v0; // ebp@1 | |
980 LevelDecoration *v1; // edi@2 | |
981 DecorationDesc *v2; // esi@3 | |
982 int v3; // edx@4 | |
983 int v4; // eax@4 | |
984 int v5; // ecx@6 | |
985 int v6; // ebx@8 | |
986 int v7; // esi@8 | |
987 int v8; // ebx@10 | |
988 int v9; // esi@11 | |
989 int v10; // edi@12 | |
990 int v11; // eax@12 | |
991 int v12; // esi@14 | |
992 unsigned int v13; // eax@17 | |
993 signed int i; // [sp+4h] [bp-14h]@1 | |
994 int v15; // [sp+8h] [bp-10h]@10 | |
995 int v16; // [sp+Ch] [bp-Ch]@10 | |
996 int v17; // [sp+10h] [bp-8h]@10 | |
997 int v18; // [sp+14h] [bp-4h]@8 | |
998 | |
999 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1000 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1001 { | |
1002 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1003 if ( !(v1->field_2 & 0x20) ) | |
1004 { | |
1005 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1006 if (!v2->CanMoveThrough()) |
0 | 1007 { |
1008 v3 = v2->uRadius; | |
1009 v4 = v1->vPosition.x; | |
1010 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1011 { | |
1012 if ( stru_721530.sMinX >= v4 - v3 ) | |
1013 { | |
1014 v5 = v1->vPosition.y; | |
1015 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1016 { | |
1017 if ( stru_721530.sMinY >= v5 - v3 ) | |
1018 { | |
1019 v6 = v2->uDecorationHeight; | |
1020 v7 = v1->vPosition.z; | |
1021 v18 = v6; | |
1022 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1023 { | |
1024 if ( stru_721530.sMinZ >= v7 ) | |
1025 { | |
1026 v16 = v4 - stru_721530.normal.x; | |
1027 v15 = v5 - stru_721530.normal.y; | |
1028 v8 = stru_721530.prolly_normal_d + v3; | |
1029 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1030 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1031 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1032 { | |
1033 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1034 if ( v9 > 0 ) | |
1035 { | |
1036 v10 = v1->vPosition.z; | |
1037 v11 = stru_721530.normal.z | |
1038 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1039 if ( v11 >= v10 ) | |
1040 { | |
1041 if ( v11 <= v18 + v10 ) | |
1042 { | |
295 | 1043 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1044 if ( v12 < 0 ) |
1045 v12 = 0; | |
1046 if ( v12 < stru_721530.field_7C ) | |
1047 { | |
1048 stru_721530.field_7C = v12; | |
1049 v13 = 8 * v0->pDecorationIDs[i]; | |
1050 LOBYTE(v13) = v13 | 5; | |
1051 stru_721530.uFaceID = v13; | |
1052 } | |
1053 } | |
1054 } | |
1055 } | |
1056 } | |
1057 } | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 | |
1068 //----- (0046E26D) -------------------------------------------------------- | |
1069 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1070 { | |
1071 int v2; // edx@5 | |
1072 unsigned __int16 *v3; // eax@5 | |
1073 unsigned __int16 v4; // ax@6 | |
1074 LevelDecoration *v5; // edi@7 | |
1075 DecorationDesc *v6; // esi@8 | |
1076 int v7; // edx@9 | |
1077 int v8; // eax@9 | |
1078 int v9; // ecx@11 | |
1079 int v10; // ebx@13 | |
1080 int v11; // esi@13 | |
1081 int v12; // ebp@15 | |
1082 int v13; // ebx@15 | |
1083 int v14; // esi@16 | |
1084 int v15; // edi@17 | |
1085 int v16; // eax@17 | |
1086 int v17; // esi@19 | |
1087 char v18; // zf@23 | |
1088 int v19; // [sp+0h] [bp-10h]@15 | |
1089 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1090 int v21; // [sp+8h] [bp-8h]@15 | |
1091 int v22; // [sp+Ch] [bp-4h]@13 | |
1092 | |
1093 if ( a1 >= 0 ) | |
1094 { | |
1095 if ( a1 <= 127 ) | |
1096 { | |
1097 if ( a2 >= 0 ) | |
1098 { | |
1099 if ( a2 <= 127 ) | |
1100 { | |
1101 v2 = a1 + (a2 << 7); | |
1102 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1103 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1104 if ( v3 ) | |
1105 { | |
1106 do | |
1107 { | |
1108 v4 = *v3; | |
848 | 1109 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1110 { |
1111 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1112 if ( !(v5->field_2 & 0x20) ) | |
1113 { | |
1114 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1115 if (!v6->CanMoveThrough()) |
0 | 1116 { |
1117 v7 = v6->uRadius; | |
1118 v8 = v5->vPosition.x; | |
1119 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1120 { | |
1121 if ( stru_721530.sMinX >= v8 - v7 ) | |
1122 { | |
1123 v9 = v5->vPosition.y; | |
1124 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1125 { | |
1126 if ( stru_721530.sMinY >= v9 - v7 ) | |
1127 { | |
1128 v10 = v6->uDecorationHeight; | |
1129 v11 = v5->vPosition.z; | |
1130 v22 = v10; | |
1131 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1132 { | |
1133 if ( stru_721530.sMinZ >= v11 ) | |
1134 { | |
1135 v12 = v8 - stru_721530.normal.x; | |
1136 v19 = v9 - stru_721530.normal.y; | |
1137 v13 = stru_721530.prolly_normal_d + v7; | |
1138 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1139 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1140 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1141 { | |
1142 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1143 if ( v14 > 0 ) | |
1144 { | |
1145 v15 = v5->vPosition.z; | |
1146 v16 = stru_721530.normal.z | |
1147 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1148 if ( v16 >= v15 ) | |
1149 { | |
1150 if ( v16 <= v22 + v15 ) | |
1151 { | |
295 | 1152 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1153 if ( v17 < 0 ) |
1154 v17 = 0; | |
1155 if ( v17 < stru_721530.field_7C ) | |
1156 { | |
1157 stru_721530.field_7C = v17; | |
1158 stru_721530.uFaceID = (signed __int16)*v20; | |
1159 } | |
1160 } | |
1161 } | |
1162 } | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 v3 = v20 + 1; | |
1174 v18 = *v20 == 0; | |
1175 ++v20; | |
1176 } | |
1177 while ( !v18 ); | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 } | |
1184 | |
1185 //----- (00486F92) -------------------------------------------------------- | |
1186 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1187 { | |
1188 Span *v0; // ebx@1 | |
1189 int v1; // eax@2 | |
1190 Edge *v2; // ecx@3 | |
1191 Edge *v3; // edx@3 | |
1192 Edge *v4; // esi@6 | |
1193 Edge *v5; // eax@7 | |
1194 Edge *v6; // ecx@8 | |
1195 Surf *v7; // esi@11 | |
1196 double v8; // st7@13 | |
1197 Surf *v9; // edi@13 | |
1198 double v10; // st6@13 | |
1199 double v11; // st7@14 | |
1200 signed __int64 v12; // qax@14 | |
1201 stru148 *v13; // eax@15 | |
1202 Span *v14; // ecx@17 | |
1203 double v15; // st7@28 | |
1204 signed __int64 v16; // qax@28 | |
1205 stru148 *v17; // eax@29 | |
1206 Span *v18; // ecx@31 | |
1207 Edge *i; // eax@40 | |
1208 Edge *v20; // ecx@43 | |
1209 Edge *v21; // esi@44 | |
1210 double v22; // st7@45 | |
1211 Edge *v23; // edx@48 | |
1212 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1213 float v25; // [sp+14h] [bp-Ch]@3 | |
1214 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1215 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1216 | |
1217 v0 = pSpans; | |
1218 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1219 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1220 stru_80C9A4.pSurf = &stru_80C980; |
1221 stru_80C980.pPrev = &stru_80C980; | |
1222 stru_80C980.pNext = &stru_80C980; | |
693 | 1223 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1224 stru_80C980.field_8 = 0.0; |
1225 stru_80C980.field_4 = 0.0; | |
1226 stru_80C9D8.pNext = &stru_80C9A4; | |
1227 stru_80C9D8.pPrev = 0; | |
1228 stru_80C9D8.field_8 = 1; | |
1229 stru_80C9A4.pNext = 0; | |
1230 stru_80C9A4.pPrev = &stru_80C9D8; | |
1231 stru_80C9A4.field_8 = 0; | |
1232 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1233 v27 = pViewport->uViewportTL_Y; |
1234 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1235 { |
1236 LABEL_51: | |
1237 v0->field_8 = -1; | |
1238 } | |
1239 else | |
1240 { | |
693 | 1241 v1 = 52 * pViewport->uViewportTL_Y; |
1242 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1243 while ( 1 ) |
1244 { | |
1245 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1246 v3 = &stru_80C9D8; | |
1247 v25 = (double)(signed int)v27; | |
1248 if ( v2 != &defaultEdge ) | |
1249 { | |
1250 do | |
1251 { | |
1252 while ( 1 ) | |
1253 { | |
1254 v4 = v3->pNext; | |
1255 if ( v2->field_0 <= (double)v4->field_0 ) | |
1256 break; | |
1257 v3 = v3->pNext; | |
1258 } | |
1259 v5 = v2->pNext; | |
1260 v2->pNext = v4; | |
1261 v2->pPrev = v3; | |
1262 v3->pNext->pPrev = v2; | |
1263 v3->pNext = v2; | |
1264 v3 = v2; | |
1265 v2 = v5; | |
1266 } | |
1267 while ( v5 != &defaultEdge ); | |
1268 } | |
1269 v6 = stru_80C9D8.pNext; | |
1270 stru_80C980.field_20 = 0; | |
1271 stru_80C980.field_22 = 1; | |
1272 v26 = stru_80C9D8.pNext; | |
1273 if ( stru_80C9D8.pNext ) | |
1274 { | |
1275 while ( 1 ) | |
1276 { | |
1277 v7 = v6->pSurf; | |
1278 if ( v6->field_8 ) | |
1279 { | |
1280 ++v7->field_22; | |
1281 if ( v7->field_22 == 1 ) | |
1282 { | |
1283 v8 = v6->field_0 + 2.0; | |
1284 v9 = stru_80C980.pNext; | |
1285 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1286 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1287 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1288 + stru_80C980.pNext->field_0 ) | |
1289 { | |
1290 do | |
1291 v9 = v9->pNext; | |
1292 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1293 v7->pNext = v9; | |
1294 v7->pPrev = v9->pPrev; | |
1295 v9->pPrev->pNext = v7; | |
1296 v9->pPrev = v7; | |
1297 } | |
1298 else | |
1299 { | |
1300 v11 = v6->field_0 + 0.5; | |
1301 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1302 v0->field_C = v12; | |
1303 if ( (signed __int16)v12 > 0 ) | |
1304 { | |
1305 v0->field_A = v27; | |
1306 v0->field_8 = v9->field_20; | |
1307 v13 = v9->pParent; | |
1308 v0->pParent = v13; | |
1309 if ( v13 ) | |
1310 { | |
1311 if ( v13->prolly_head ) | |
1312 { | |
1313 v14 = v13->prolly_tail; | |
1314 if ( !v14 ) | |
1315 return; | |
1316 v14->pNext = v0; | |
1317 } | |
1318 else | |
1319 { | |
1320 v13->prolly_head = v0; | |
1321 } | |
1322 v13->prolly_tail = v0; | |
1323 } | |
1324 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1325 return; | |
1326 ++v0; | |
1327 ++pOutdoorCamera->uNumSpans; | |
1328 } | |
1329 v6 = v26; | |
1330 v7->field_20 = (signed __int64)v11; | |
1331 v7->pNext = v9; | |
1332 v9->pPrev = v7; | |
1333 stru_80C980.pNext = v7; | |
1334 v7->pPrev = &stru_80C980; | |
1335 } | |
1336 } | |
1337 } | |
1338 else | |
1339 { | |
1340 --v7->field_22; | |
1341 if ( !v7->field_22 ) | |
1342 { | |
1343 if ( stru_80C980.pNext == v7 ) | |
1344 { | |
1345 v15 = v6->field_0 + 0.5; | |
1346 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1347 v0->field_C = v16; | |
1348 if ( (signed __int16)v16 > 0 ) | |
1349 { | |
1350 v0->field_A = v27; | |
1351 v0->field_8 = v7->field_20; | |
1352 v17 = v7->pParent; | |
1353 v0->pParent = v17; | |
1354 if ( v17 ) | |
1355 { | |
1356 if ( v17->prolly_head ) | |
1357 { | |
1358 v18 = v17->prolly_tail; | |
1359 if ( !v18 ) | |
1360 return; | |
1361 v18->pNext = v0; | |
1362 } | |
1363 else | |
1364 { | |
1365 v17->prolly_head = v0; | |
1366 } | |
1367 v17->prolly_tail = v0; | |
1368 } | |
1369 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1370 return; | |
1371 ++v0; | |
1372 ++pOutdoorCamera->uNumSpans; | |
1373 } | |
1374 v7->pNext->field_20 = (signed __int64)v15; | |
1375 v6 = v26; | |
1376 } | |
1377 v7->pNext->pPrev = v7->pPrev; | |
1378 v7->pPrev->pNext = v7->pNext; | |
1379 } | |
1380 } | |
1381 v26 = v6->pNext; | |
1382 if ( !v26 ) | |
1383 break; | |
1384 v6 = v6->pNext; | |
1385 } | |
1386 } | |
1387 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1388 { | |
1389 i->pPrev->pNext = i->pNext; | |
1390 i->pNext->pPrev = i->pPrev; | |
1391 } | |
1392 v20 = stru_80C9D8.pNext; | |
1393 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1394 break; | |
1395 LABEL_50: | |
1396 ++v27; | |
1397 v1 = v24 + 52; | |
1398 v24 += 52; | |
693 | 1399 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1400 goto LABEL_51; |
1401 } | |
1402 while ( 1 ) | |
1403 { | |
1404 v21 = v20->pNext; | |
1405 if ( !v21 ) | |
1406 break; | |
1407 v22 = v20->field_4 + v20->field_0; | |
1408 v20->field_0 = v22; | |
1409 if ( v22 < stru_80C9D8.field_0 ) | |
1410 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1411 while ( 1 ) | |
1412 { | |
1413 v23 = v20->pPrev; | |
1414 if ( v20->field_0 >= (double)v23->field_0 ) | |
1415 break; | |
1416 v23->pNext = v20->pNext; | |
1417 v20->pNext->pPrev = v23; | |
1418 v23->pPrev->pNext = v20; | |
1419 v20->pPrev = v23->pPrev; | |
1420 v20->pNext = v23; | |
1421 v23->pPrev = v20; | |
1422 } | |
1423 v20 = v21; | |
1424 if ( v21 == &stru_80C9A4 ) | |
1425 goto LABEL_50; | |
1426 } | |
1427 } | |
1428 } | |
1429 // 4EC3EC: using guessed type Edge defaultEdge; | |
1430 | |
1431 //----- (00487355) -------------------------------------------------------- | |
1432 bool OutdoorCamera::_487355() | |
1433 { | |
1434 int v0; // esi@1 | |
1435 stru148 *v1; // edi@2 | |
1436 bool result; // eax@3 | |
1437 | |
1438 v0 = 0; | |
1439 if ( pOutdoorCamera->numStru148s > 0 ) | |
1440 { | |
1441 v1 = array_77EC08; | |
1442 do | |
1443 { | |
1444 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1445 ++v0; | |
1446 ++v1; | |
1447 } | |
1448 while ( v0 < pOutdoorCamera->numStru148s ); | |
1449 } | |
1450 return result; | |
1451 } | |
1452 | |
1453 //----- (00487DA9) -------------------------------------------------------- | |
1454 void __cdecl sub_487DA9() | |
1455 { | |
1456 char *v0; // eax@1 | |
1457 | |
1458 v0 = &array_77EC08[0].field_108; | |
1459 do | |
1460 { | |
1461 *v0 = 0; | |
1462 v0 += 268; | |
1463 } | |
1464 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1465 } | |
1466 | |
1467 //----- (00487DBE) -------------------------------------------------------- | |
1468 void Software_ResetNewEdges() | |
1469 { | |
1470 int v0; // ecx@1 | |
1471 Edge **v1; // eax@1 | |
1472 signed int v2; // eax@3 | |
1473 | |
1474 v0 = 0; | |
1475 v1 = ptr_80CA10; | |
1476 do | |
1477 { | |
1478 ++v0; | |
1479 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1480 *v1 = 0; | |
1481 ++v1; | |
1482 } | |
1483 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1484 v2 = 2000; | |
1485 do | |
1486 { | |
1487 pSurfs->field_22 = 0; | |
1488 --v2; | |
1489 } | |
1490 while ( v2 ); | |
1491 } | |
1492 // 4EC3EC: using guessed type Edge defaultEdge; | |
1493 | |
1494 //----- (0048958E) -------------------------------------------------------- | |
1495 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1496 { | |
1497 stru12_MemoryBlock *v2; // esi@1 | |
1498 void *v3; // eax@1 | |
1499 void *v4; // ecx@1 | |
1500 stru12_MemoryBlock *result; // eax@1 | |
1501 | |
1502 v2 = this; | |
1503 v3 = operator new(8 * a2 + 16); | |
1504 v2->pBlockBase = v3; | |
848 | 1505 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1506 result = v2; |
1507 v2->pAlignedBlock = v4; | |
1508 } | |
1509 | |
1510 //----- (004895B7) -------------------------------------------------------- | |
1511 stru12::stru12(stru11 *pStru11) | |
1512 { | |
1513 stru12 *v2; // esi@1 | |
1514 | |
1515 v2 = this; | |
1516 this->field_44 = 0x41000000u; | |
1517 this->field_4C = 0x46000000u; | |
1518 //this->vdestructor_ptr = stru12::_4898E6; | |
1519 this->field_48 = 0; | |
1520 this->field_50 = 0; | |
1521 this->field_54 = 0x33D6BF95u; | |
1522 this->field_58 = 0; | |
1523 | |
1524 for (int i = 0; i < 12; ++i) | |
1525 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1526 } | |
1527 | |
1528 //----- (00489810) -------------------------------------------------------- | |
1529 stru12::~stru12() | |
1530 { | |
1531 for (int i = 0; i < 12; ++i) | |
1532 delete pMemBlocks[i]; | |
1533 } | |
1534 | |
1535 //----- (004898BF) -------------------------------------------------------- | |
1536 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1537 { | |
1538 stru12_MemoryBlock *v2; // esi@1 | |
1539 void *v3; // ST00_4@1 | |
1540 | |
1541 v2 = this; | |
1542 v3 = this->pBlockBase; | |
1543 this->pAlignedBlock = 0; | |
1544 free(v3); | |
1545 v2->pBlockBase = 0; | |
1546 /*if ( a2 & 1 ) | |
1547 free(v2);*/ | |
1548 } | |
1549 | |
1550 //----- (004898E6) -------------------------------------------------------- | |
1551 void stru12::_4898E6() | |
1552 { | |
1553 void *v1; // eax@1 | |
1554 void *v2; // edx@1 | |
1555 char *v3; // edi@2 | |
1556 double v4; // st7@2 | |
1557 char *v5; // ebx@2 | |
1558 double v6; // st6@3 | |
1559 double v7; // st5@3 | |
1560 double v8; // st4@3 | |
1561 int v9; // esi@3 | |
1562 double v10; // st3@3 | |
1563 float v11; // ST34_4@5 | |
1564 double v12; // st6@10 | |
1565 double v13; // ST0C_8@10 | |
1566 char *v14; // [sp+14h] [bp-44h]@2 | |
1567 char *v15; // [sp+18h] [bp-40h]@2 | |
1568 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1569 char *v17; // [sp+20h] [bp-38h]@2 | |
1570 char *v18; // [sp+24h] [bp-34h]@2 | |
1571 float v19; // [sp+30h] [bp-28h]@3 | |
1572 float v20; // [sp+38h] [bp-20h]@3 | |
1573 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1574 int v22; // [sp+40h] [bp-18h]@1 | |
1575 char *v23; // [sp+44h] [bp-14h]@2 | |
1576 char *v24; // [sp+48h] [bp-10h]@2 | |
1577 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1578 float v26; // [sp+50h] [bp-8h]@3 | |
1579 float v27; // [sp+54h] [bp-4h]@3 | |
1580 | |
731 | 1581 __debugbreak(); |
0 | 1582 v22 = 0; |
1583 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1584 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1585 if ( this->field_8C > 0 ) | |
1586 { | |
1587 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1588 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1589 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1590 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1591 v25 = (int)v1 - (int)v2; | |
1592 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1593 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1594 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1595 v4 = 1.0; | |
1596 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1597 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1598 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1599 do | |
1600 { | |
1601 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1602 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1603 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1604 v7 = pIndoorCamera->fRotationYCosine; | |
1605 v8 = pIndoorCamera->fRotationYSine; | |
1606 v20 = pIndoorCamera->fRotationXCosine; | |
1607 v19 = pIndoorCamera->fRotationXSine; | |
1608 v9 = (int)((char *)v2 + (int)v21); | |
1609 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1610 if ( pIndoorCamera->sRotationX ) | |
1611 { | |
1612 v11 = v10; | |
1613 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1614 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1615 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1616 } | |
1617 else | |
1618 { | |
1619 *(float *)v9 = v10; | |
1620 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1621 *(float *)((char *)v2 + (int)v5) = v6; | |
1622 } | |
1623 if ( *(float *)v9 >= 8.0 ) | |
1624 { | |
1625 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1626 { | |
1627 *(int *)v2 = 0; | |
1628 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1629 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1630 - v12 * *(float *)((char *)v2 + (int)v3); | |
1631 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1632 - v12 * *(float *)((char *)v2 + (int)v5); | |
1633 *(float *)((char *)v2 + (int)v16) = v4 | |
1634 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1635 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1636 v13 = *(float *)v9 + 6.7553994e15; | |
1637 v4 = 1.0; | |
1638 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1639 } | |
1640 else | |
1641 { | |
1642 *(int *)v2 = 2; | |
1643 } | |
1644 } | |
1645 else | |
1646 { | |
1647 *(int *)v2 = 1; | |
1648 } | |
1649 ++v22; | |
1650 v2 = (char *)v2 + 4; | |
1651 } | |
1652 while ( v22 < this->field_8C ); | |
1653 } | |
1654 this->field_8C = 0; | |
1655 } | |
1656 | |
1657 //----- (0048A959) -------------------------------------------------------- | |
1658 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1659 { | |
1660 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1661 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1662 b = (uColor & 0x000000FF) / 255.0f; | |
1663 | |
1664 float h, s, v; | |
1665 RGB2HSV(&h, &s, r, g, b, &v); | |
1666 | |
1667 if ( h_replace != -1.0 ) | |
1668 h = h_replace; | |
1669 if ( s_replace != -1.0 ) | |
1670 s = s_replace; | |
1671 if ( v_replace != -1.0 ) | |
1672 v = v_replace; | |
1673 HSV2RGB(&r, &g, &b, h, s, v); | |
1674 | |
1675 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1676 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1677 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1678 } | |
1679 | |
1680 //----- (0048B561) -------------------------------------------------------- | |
1029 | 1681 int fixpoint_from_float(float val) |
0 | 1682 { |
1029 | 1683 // float X.Yf -> int XXXX YYYY |
1684 int left = floorf((val - 0.5f) + 0.5f); | |
1685 int right = floorf((val - left) * 65536.0f); | |
1686 return (left << 16) | right; | |
0 | 1687 } |
1688 | |
1689 //----- (00491E3A) -------------------------------------------------------- | |
1690 void __cdecl sub_491E3A() | |
1691 { | |
1692 Player *v0; // ebx@1 | |
1693 signed int v1; // esi@3 | |
1694 char *v2; // eax@4 | |
1695 unsigned int v3; // eax@7 | |
1696 unsigned int v4; // edx@8 | |
1697 char *v5; // ecx@9 | |
1698 int v6; // edi@17 | |
1699 Texture *v7; // ebx@18 | |
1700 struct IDirect3DTexture2 **v8; // eax@19 | |
1701 struct IDirect3DTexture2 *v9; // eax@20 | |
1702 struct IDirectDrawSurface **v10; // eax@22 | |
1703 struct IDirectDrawSurface *v11; // eax@23 | |
1704 int v12; // eax@26 | |
1705 | |
1706 v0 = pParty->pPlayers; | |
1707 do | |
1708 { | |
203 | 1709 if (SoundSetAction[24][0]) |
0 | 1710 { |
1711 v1 = 0; | |
764 | 1712 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1713 { |
1714 LABEL_7: | |
1715 v3 = 0; | |
1716 } | |
1717 else | |
1718 { | |
1719 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1720 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1721 { |
1722 ++v1; | |
1723 v2 += 120; | |
764 | 1724 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1725 goto LABEL_7; |
1726 } | |
1727 v3 = v1; | |
1728 } | |
764 | 1729 pSoundList->UnloadSound(v3, 1); |
0 | 1730 v4 = 0; |
764 | 1731 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1732 { |
1733 LABEL_12: | |
1734 v4 = 0; | |
1735 } | |
1736 else | |
1737 { | |
1738 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1739 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1740 { |
1741 ++v4; | |
1742 v5 += 120; | |
764 | 1743 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1744 goto LABEL_12; |
1745 } | |
1746 } | |
764 | 1747 pSoundList->UnloadSound(v4, 1); |
0 | 1748 } |
1749 ++v0; | |
1750 } | |
1751 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1752 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1753 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1754 { |
1755 v7 = &pIcons_LOD->pTextures[v6]; | |
1756 do | |
1757 { | |
1758 v7->Release(); | |
1759 v8 = pIcons_LOD->pHardwareTextures; | |
1760 if ( v8 ) | |
1761 { | |
1762 v9 = v8[v6]; | |
1763 if ( v9 ) | |
1764 { | |
1765 v9->Release(); | |
1766 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1767 } | |
1768 } | |
1769 v10 = pIcons_LOD->pHardwareSurfaces; | |
1770 if ( v10 ) | |
1771 { | |
1772 v11 = v10[v6]; | |
1773 if ( v11 ) | |
1774 { | |
1775 v11->Release(); | |
1776 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1777 } | |
1778 } | |
1779 --v6; | |
1780 --v7; | |
1781 } | |
33 | 1782 while ( v6 >= pIcons_LOD->pFacesLock ); |
1783 } | |
1784 v12 = pIcons_LOD->pFacesLock; | |
1785 pIcons_LOD->pFacesLock = 0; | |
0 | 1786 pIcons_LOD->uNumLoadedFiles = v12; |
1787 } | |
1788 // 4ED498: using guessed type char byte_4ED498; | |
1789 | |
1790 //----- (0049387A) -------------------------------------------------------- | |
1791 int CycleCharacter(unsigned int _this) | |
1792 { | |
1793 signed int result; // eax@1 | |
1794 signed int v2; // ecx@2 | |
1795 signed int v3; // ecx@8 | |
1796 | |
1797 result = uActiveCharacter; | |
1798 if ( _this ) | |
1799 { | |
1800 v2 = 0; | |
1801 while ( 1 ) | |
1802 { | |
1803 --result; | |
1804 if ( result < 1 ) | |
1805 result = 4; | |
1806 if ( !pPlayers[result]->uTimeToRecovery ) | |
1807 break; | |
1808 ++v2; | |
1809 if ( v2 >= 4 ) | |
1810 return uActiveCharacter; | |
1811 } | |
1812 } | |
1813 else | |
1814 { | |
1815 v3 = 0; | |
1816 while ( 1 ) | |
1817 { | |
1818 ++result; | |
1819 if ( result > 4 ) | |
1820 result = 1; | |
1821 if ( !pPlayers[result]->uTimeToRecovery ) | |
1822 break; | |
1823 ++v3; | |
1824 if ( v3 >= 4 ) | |
1825 return uActiveCharacter; | |
1826 } | |
1827 } | |
1828 return result; | |
1829 } | |
1830 //----- (004938D1) -------------------------------------------------------- | |
1831 void __fastcall Rest(unsigned int uHoursToSleep) | |
1832 { | |
1833 unsigned int v1; // esi@1 | |
1834 double v2; // st7@3 | |
1835 Player **v3; // esi@3 | |
1836 | |
1837 v1 = uHoursToSleep; | |
1838 if ( uHoursToSleep > 240 ) | |
1839 InitializeActors(); | |
1840 v2 = (double)(7680 * v1) * 0.033333335; | |
1841 pParty->uTimePlayed += (signed __int64)v2; | |
1842 v3 = &pPlayers[1]; | |
1843 do | |
1844 { | |
1845 (*v3)->Recover((signed __int64)v2); | |
1846 ++v3; | |
1847 } | |
1848 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1849 _494035_timed_effects__water_walking_damage__etc(); | |
1850 } | |
1851 | |
1852 //----- (00493938) -------------------------------------------------------- | |
1853 int __cdecl _493938_regenerate() | |
1854 { | |
1855 int v0; // edi@1 | |
1856 signed __int64 v1; // qax@1 | |
1857 int v2; // ecx@1 | |
1858 int result; // eax@1 | |
1859 int v4; // eax@2 | |
1860 int v5; // edi@5 | |
112 | 1861 int *v6; // ecx@5 |
0 | 1862 char v7; // sf@5 |
112 | 1863 int *v8; // ecx@10 |
0 | 1864 int v9; // edi@15 |
1865 signed int v10; // eax@15 | |
1866 __int16 *v11; // edx@16 | |
1867 int v12; // eax@20 | |
1868 int v13; // ebx@20 | |
1869 unsigned int *v14; // esi@21 | |
1870 unsigned int v15; // ecx@21 | |
1871 unsigned int v16; // eax@21 | |
1872 int v17; // edx@21 | |
1873 int v18; // eax@21 | |
1874 signed int v19; // eax@21 | |
1875 signed int v20; // ebx@25 | |
1876 Player *v21; // esi@25 | |
1877 ITEM_EQUIP_TYPE v22; // edi@30 | |
1878 //int v23; // edx@31 | |
1879 signed int v24; // ecx@32 | |
1880 signed int v25; // eax@33 | |
1881 int v26; // eax@35 | |
1882 int v27; // eax@36 | |
1883 int v28; // eax@37 | |
1884 int v29; // eax@40 | |
1885 int v30; // eax@41 | |
1886 signed int v31; // ecx@53 | |
1887 char *v32; // eax@53 | |
1888 char *v33; // edi@82 | |
1889 int v34; // ecx@88 | |
1890 int v35; // eax@88 | |
1891 char *v36; // edi@99 | |
1892 int v37; // edi@104 | |
1893 int v38; // edi@106 | |
1894 int v39; // edi@111 | |
1895 int v40; // ecx@113 | |
1896 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
|
1897 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 1898 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
1899 int v44; // [sp+210h] [bp-20h]@22 | |
1900 int v45; // [sp+214h] [bp-1Ch]@25 | |
1901 int v46; // [sp+218h] [bp-18h]@25 | |
1902 int v47; // [sp+21Ch] [bp-14h]@25 | |
1903 int v48; // [sp+220h] [bp-10h]@25 | |
1904 int v49; // [sp+224h] [bp-Ch]@24 | |
1905 int v50; // [sp+228h] [bp-8h]@25 | |
1906 int v51; // [sp+22Ch] [bp-4h]@2 | |
1907 | |
1908 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
1909 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
1910 v2 = (signed int)v1 / 60; | |
1911 result = (signed int)v1 / 60 + 5; | |
1912 if ( v0 >= result ) | |
1913 { | |
1914 v51 = 0; | |
1915 v4 = (v0 - v2) / 5; | |
1916 if (pParty->FlyActive()) | |
1917 { | |
1918 if ( pParty->bFlying ) | |
1919 { | |
569 | 1920 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
1921 { // colliding with something in the air - fall down | |
1922 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
1923 //__debugbreak(); | |
1924 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 1925 v7 = *v6 < v5; |
1926 *v6 -= v5; | |
0 | 1927 if ( v7 ) |
1928 { | |
112 | 1929 *v6 = 0; |
0 | 1930 pParty->uFlags &= 0xFFFFFFBFu; |
1931 pParty->bFlying = 0; | |
1932 v51 = 1; | |
1933 } | |
1934 } | |
1935 } | |
1936 } | |
569 | 1937 |
0 | 1938 if (pParty->WaterWalkActive()) |
1939 { | |
569 | 1940 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
1941 { | |
1942 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
1943 { // taking on water | |
1944 //__debugbreak(); | |
1945 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 1946 v7 = *v8 < v4; |
1947 *v8 -= v4; | |
0 | 1948 if ( v7 ) |
1949 { | |
112 | 1950 *v8 = 0; |
569 | 1951 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 1952 v51 = 1; |
1953 } | |
1954 } | |
1955 } | |
1956 } | |
569 | 1957 |
0 | 1958 if (pParty->ImmolationActive()) |
1959 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1960 //SpriteObject::SpriteObject(&a1); |
0 | 1961 v9 = 0; |
1962 a3.z = 0; | |
1963 a3.y = 0; | |
1964 a3.x = 0; | |
1965 a1.stru_24.Reset(); | |
822 | 1966 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
1967 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 1968 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1969 a1.uType = 1070; |
822 | 1970 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 1971 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1972 { | |
1973 LABEL_19: | |
1974 LOWORD(v10) = 0; | |
1975 } | |
1976 else | |
1977 { | |
1978 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 1979 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 1980 { |
1981 ++v10; | |
1982 v11 += 28; | |
1983 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
1984 goto LABEL_19; | |
1985 } | |
1986 } | |
1987 a1.uObjectDescID = v10; | |
1988 a1.field_60_distance_related_prolly_lod = 0; | |
1989 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 1990 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 1991 a1.uAttributes = 0; |
1992 a1.uSectorID = 0; | |
1993 a1.uSpriteFrameID = 0; | |
822 | 1994 a1.spell_caster_pid = v12; |
0 | 1995 a1.uFacing = 0; |
1996 a1.uSoundID = 0; | |
1997 v13 = sub_46A89E((int)v41, 100, 307); | |
1998 if ( v13 > 0 ) | |
1999 { | |
2000 do | |
2001 { | |
2002 v14 = (unsigned int *)&v41[4 * v9]; | |
2003 v15 = *v14; | |
2004 v16 = *v14; | |
2005 a1.vPosition.x = pActors[v16].vPosition.x; | |
2006 v17 = pActors[v16].vPosition.y; | |
2007 a1.vPosition.z = pActors[v16].vPosition.z; | |
2008 v18 = 8 * v15; | |
862 | 2009 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2010 a1.vPosition.y = v17; |
823 | 2011 a1.spell_target_pid = v18; |
0 | 2012 v19 = a1.Create(0, 0, 0, 0); |
862 | 2013 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2014 ++v9; |
2015 } | |
2016 while ( v9 < v13 ); | |
2017 } | |
2018 } | |
2019 v44 = 0; | |
248 | 2020 if (PartyHasDragon()) |
0 | 2021 v44 = 1; |
2022 v49 = 0; | |
2023 LABEL_25: | |
2024 v20 = 0; | |
2025 v21 = &pParty->pPlayers[v49]; | |
2026 v50 = 0; | |
2027 v47 = 0; | |
2028 v45 = 0; | |
2029 v48 = 0; | |
2030 v46 = 0; | |
255 | 2031 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2032 v50 = 1; |
135 | 2033 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2034 v48 = 1; |
2035 v22 = (ITEM_EQUIP_TYPE)0; | |
2036 while ( 1 ) | |
2037 { | |
2038 if ( v21->HasItemEquipped(v22) ) | |
2039 { | |
2040 //v23 = v21->pEquipment.pIndices; | |
2041 auto _idx = v21->pEquipment.pIndices[v22]; | |
2042 v24 = v21->pInventoryItems[_idx].uItemID; | |
2043 if ( v24 > 134 ) | |
2044 { | |
2045 if ( v24 == 529 ) | |
2046 goto LABEL_43; | |
2047 if ( v24 == 535 ) | |
2048 goto LABEL_44; | |
2049 if ( v24 == 515 ) | |
2050 { | |
2051 v47 = 1; | |
2052 } | |
2053 else | |
2054 { | |
2055 if ( v24 == 532 ) | |
2056 goto LABEL_50; | |
2057 } | |
2058 } | |
2059 else | |
2060 { | |
377 | 2061 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2062 if ( v25 <= 50 ) |
2063 { | |
2064 if ( v25 != 50 ) | |
2065 { | |
2066 v26 = v25 - 37; | |
2067 if ( v26 ) | |
2068 { | |
2069 v27 = v26 - 1; | |
2070 if ( !v27 ) | |
2071 goto LABEL_50; | |
2072 v28 = v27 - 6; | |
2073 if ( v28 ) | |
2074 { | |
2075 if ( v28 != 3 ) | |
2076 goto LABEL_51; | |
2077 LABEL_50: | |
2078 v50 = 1; | |
2079 goto LABEL_51; | |
2080 } | |
2081 } | |
2082 } | |
2083 LABEL_44: | |
2084 v20 = 1; | |
2085 goto LABEL_51; | |
2086 } | |
2087 v29 = v25 - 54; | |
2088 if ( !v29 ) | |
2089 goto LABEL_44; | |
2090 v30 = v29 - 1; | |
2091 if ( !v30 ) | |
2092 goto LABEL_50; | |
2093 if ( v30 == 11 ) | |
2094 { | |
2095 LABEL_43: | |
2096 v20 = 1; | |
2097 v50 = 1; | |
2098 goto LABEL_51; | |
2099 } | |
2100 } | |
2101 } | |
2102 LABEL_51: | |
2103 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2104 if ( (signed int)v22 >= 16 ) | |
2105 { | |
2106 if ( v48 ) | |
2107 { | |
2108 v31 = 0; | |
2109 v32 = (char *)v21->pInventoryItems; | |
2110 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2111 { | |
2112 ++v31; | |
2113 v32 += 36; | |
2114 if ( v31 >= 138 ) | |
2115 goto LABEL_59; | |
2116 } | |
2117 v48 = 0; | |
2118 v45 = 1; | |
2119 } | |
2120 LABEL_59: | |
2121 if ( v21->pConditions[17] ) | |
2122 v46 = 1; | |
2123 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2124 { | |
2125 ++v21->sHealth; | |
2126 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2127 v21->sHealth = v21->GetMaxHealth(); | |
2128 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2129 { | |
2130 LODWORD(v21->pConditions[13]) = 0; | |
2131 HIDWORD(v21->pConditions[13]) = 0; | |
2132 } | |
2133 v51 = 1; | |
2134 } | |
2135 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2136 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2137 && !v21->pConditions[14] | |
2138 && !v21->pConditions[16] ) | |
2139 { | |
2140 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2141 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2142 v21->sHealth = v21->GetMaxHealth(); | |
2143 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2144 { | |
2145 LODWORD(v21->pConditions[13]) = 0; | |
2146 HIDWORD(v21->pConditions[13]) = 0; | |
2147 } | |
2148 v51 = 1; | |
2149 } | |
2150 if ( v50 ) | |
2151 { | |
2152 v33 = (char *)&v21->sMana; | |
2153 ++*(int *)v33; | |
2154 if ( v21->sMana > v21->GetMaxMana() ) | |
2155 *(int *)v33 = v21->GetMaxMana(); | |
2156 v51 = 1; | |
2157 } | |
2158 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2159 { | |
2160 v34 = LODWORD(v21->pConditions[13]); | |
2161 --v21->sHealth; | |
2162 v35 = v21->sHealth; | |
2163 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2164 v21->pConditions[13] = pParty->uTimePlayed; | |
2165 if ( v35 < 1 ) | |
2166 { | |
2167 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2168 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2169 { | |
2170 v21->pConditions[13] = pParty->uTimePlayed; | |
2171 } | |
2172 else | |
2173 { | |
2174 if ( !v21->pConditions[14] ) | |
2175 v21->pConditions[14] = pParty->uTimePlayed; | |
2176 } | |
2177 } | |
2178 v51 = 1; | |
2179 } | |
2180 if ( v45 ) | |
2181 { | |
2182 v36 = (char *)&v21->sMana; | |
2183 ++*(int *)v36; | |
2184 if ( v21->sMana > v21->GetMaxMana() ) | |
2185 *(int *)v36 = v21->GetMaxMana(); | |
2186 } | |
2187 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2188 { | |
2189 v37 = v21->sHealth; | |
2190 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2191 v21->sHealth = v37 - 2; | |
2192 v38 = v21->sMana; | |
2193 if ( v38 > v21->GetMaxMana() / 2 ) | |
2194 v21->sMana = v38 - 2; | |
2195 } | |
2196 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2197 { | |
2198 v39 = v21->sHealth; | |
2199 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2200 v21->sHealth = v39 - 1; | |
2201 v40 = v21->sMana; | |
2202 if ( v40 > 0 ) | |
2203 v21->sMana = v40 - 1; | |
2204 } | |
2205 ++v49; | |
2206 if ( v49 >= 4 ) | |
2207 { | |
2208 result = HIDWORD(pParty->uTimePlayed); | |
2209 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2210 if ( !viewparams->bRedrawGameUI ) | |
2211 { | |
2212 result = v51; | |
2213 viewparams->bRedrawGameUI = v51; | |
2214 } | |
2215 return result; | |
2216 } | |
2217 goto LABEL_25; | |
2218 } | |
2219 } | |
2220 } | |
2221 return result; | |
2222 } | |
2223 | |
2224 //----- (00493F79) -------------------------------------------------------- | |
351 | 2225 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2226 { |
2227 signed __int64 v2; // ST2C_8@1 | |
2228 signed __int64 v3; // qax@1 | |
351 | 2229 //signed __int64 v4; // ST1C_8@1 |
0 | 2230 unsigned __int64 v5; // qax@1 |
2231 unsigned int v6; // ebx@1 | |
2232 | |
2233 v2 = (signed __int64)((double)a2 * 0.234375); | |
2234 v3 = v2 / 60 / 60; | |
351 | 2235 //v4 = v3; |
0 | 2236 v5 = (unsigned int)v3 / 0x18; |
2237 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2238 _this->field_0_expire_second = v2 % 60; |
2239 _this->field_4_expire_minute = v2 / 60 % 60; | |
2240 _this->field_8_expire_hour = v3 % 24; | |
2241 _this->field_10_expire_week = v5 / 7 & 3; | |
2242 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2243 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2244 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2245 } |
2246 | |
2247 //----- (00494035) -------------------------------------------------------- | |
1031 | 2248 void _494035_timed_effects__water_walking_damage__etc() |
0 | 2249 { |
2250 signed __int64 v0; // qax@1 | |
2251 signed __int64 v1; // ST30_8@1 | |
2252 signed __int64 v2; // ST38_8@1 | |
2253 unsigned __int64 v3; // qax@1 | |
2254 unsigned int v4; // edi@1 | |
2255 //signed int v5; // eax@4 | |
2256 //char *v6; // ecx@5 | |
2257 //Player *v7; // esi@8 | |
2258 //char *v8; // ecx@12 | |
766 | 2259 //Player *pPlayer; // esi@15 |
0 | 2260 //void *v10; // esi@25 |
2261 unsigned int v11; // ecx@27 | |
2262 signed int v12; // edi@29 | |
2263 Player *v13; // ecx@30 | |
2264 Player *v14; // esi@35 | |
2265 double v15; // st7@35 | |
2266 Player **v16; // esi@43 | |
2267 Player *v17; // edi@44 | |
2268 double v18; // st7@44 | |
816 | 2269 //float v19; // ST28_4@48 |
2270 //double v20; // ST38_8@48 | |
0 | 2271 Player *v21; // esi@51 |
2272 signed int v22; // edi@53 | |
2273 int v23; // eax@59 | |
2274 int v24; // ecx@60 | |
2275 int v25; // eax@63 | |
2276 int v26; // ecx@64 | |
2277 int v27; // eax@67 | |
2278 int v28; // ecx@68 | |
2279 int v29; // eax@71 | |
2280 int v30; // ecx@72 | |
2281 int v31; // eax@75 | |
2282 int v32; // ecx@76 | |
2283 int v33; // eax@79 | |
2284 int v34; // ecx@80 | |
2285 int v35; // eax@83 | |
2286 int v36; // ecx@84 | |
2287 int v37; // eax@87 | |
2288 int v38; // ecx@88 | |
2289 int v39; // eax@91 | |
2290 int v40; // ecx@92 | |
2291 int v41; // eax@95 | |
2292 int v42; // ecx@96 | |
2293 bool v43; // ebx@102 | |
2294 //SpellBuff *v44; // edi@104 | |
2295 //signed int v45; // ebp@104 | |
2296 bool v46; // edi@111 | |
2297 //SpellBuff *v47; // esi@113 | |
2298 //Player **v48; // esi@119 | |
2299 //signed int v49; // edi@121 | |
2300 //char *v50; // esi@122 | |
2301 signed int v51; // edx@128 | |
2302 signed int v52; // ecx@130 | |
2303 int v53; // eax@131 | |
2304 Player *v54; // eax@141 | |
766 | 2305 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2306 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2307 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2308 int v58; // [sp-4h] [bp-34h]@33 |
2309 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2310 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2311 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2312 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2313 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2314 signed int a2a; // [sp+18h] [bp-18h]@47 |
2315 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2316 | |
766 | 2317 //a2 = pParty->uCurrentHour; |
0 | 2318 v61 = pParty->uDaysPlayed; |
816 | 2319 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2320 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2321 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2322 v1 = v0; |
2323 v0 /= 60i64; | |
2324 v2 = v0; | |
2325 v3 = (unsigned int)v0 / 24; | |
2326 v4 = (unsigned int)(v3 / 7) >> 2; | |
2327 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2328 pParty->uCurrentMinute = v1 % 60; | |
2329 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2330 pParty->uCurrentHour = v2 % 24; | |
2331 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2332 pParty->uCurrentMonth = v4 % 12; | |
352 | 2333 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2334 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2335 { |
2336 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2337 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2338 | |
2339 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2340 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2341 | |
766 | 2342 ++pParty->days_played_without_rest; |
2343 if (pParty->days_played_without_rest > 1) | |
0 | 2344 { |
2345 for (uint i = 0; i < 4; ++i) | |
766 | 2346 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2347 | |
2348 if (pParty->uNumFoodRations) | |
2349 Party::TakeFood(1); | |
0 | 2350 else |
2351 for (uint i = 0; i < 4; ++i) | |
766 | 2352 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2353 | |
2354 if (pParty->days_played_without_rest > 3) | |
2355 for (uint i = 0; i < 4; ++i) | |
0 | 2356 { |
766 | 2357 auto player = pParty->pPlayers + i; |
2358 | |
2359 player->Zero(); | |
2360 | |
2361 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2362 { |
767 | 2363 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2364 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2365 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2366 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2367 } |
2368 } | |
766 | 2369 } |
2370 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2371 pOutdoor->SetFog(); |
2372 | |
2373 for (uint i = 0; i < 4; ++i) | |
2374 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2375 } | |
766 | 2376 |
0 | 2377 v11 = LODWORD(pParty->uTimePlayed); |
2378 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2379 { | |
2380 v12 = 1; | |
2381 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2382 viewparams->bRedrawGameUI = 1; | |
2383 while ( 1 ) | |
2384 { | |
1080 | 2385 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 2386 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2387 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2388 { |
2389 v58 = 0; | |
2390 } | |
2391 else | |
2392 { | |
2393 v58 = 0; | |
2394 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2395 { | |
2396 v14 = pPlayers[v12]; | |
2397 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
1036 | 2398 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE); |
0 | 2399 if ( pParty->uFlags & 4 ) |
2400 { | |
783 | 2401 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2402 GameUI_Footer_TimeLeft = 128; | |
0 | 2403 } |
2404 goto LABEL_39; | |
2405 } | |
2406 v13 = pPlayers[v12]; | |
2407 } | |
130 | 2408 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2409 LABEL_39: |
2410 ++v12; | |
2411 if ( v12 > 4 ) | |
2412 { | |
2413 v11 = LODWORD(pParty->uTimePlayed); | |
2414 break; | |
2415 } | |
2416 } | |
2417 } | |
2418 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2419 { | |
2420 viewparams->bRedrawGameUI = 1; | |
2421 pParty->field_6FC = v11 + 128; | |
2422 v16 = &pPlayers[1]; | |
2423 do | |
2424 { | |
2425 v17 = *v16; | |
2426 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 2427 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 2428 if ( pParty->uFlags & 0x200 ) |
2429 { | |
783 | 2430 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2431 GameUI_Footer_TimeLeft = 128; | |
0 | 2432 } |
2433 ++v16; | |
2434 } | |
2435 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2436 } | |
2437 _493938_regenerate(); | |
2438 v65 = 4; | |
816 | 2439 a2a = pEventTimer->uTimeElapsed; |
2440 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2441 { | |
2442 //v19 = (double)(signed int)prev_time * 0.5; | |
2443 //v20 = v19 + 6.7553994e15; | |
2444 a2a *= 0.5f; | |
2445 if (a2a < 1) | |
0 | 2446 a2a = 1; |
2447 } | |
2448 v62 = &pPlayers[1]; | |
2449 do | |
2450 { | |
2451 v21 = *v62; | |
2452 if ( (*v62)->uTimeToRecovery ) | |
2453 v21->Recover(a2a); | |
2454 v22 = v21->sHealth; | |
2455 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2456 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2457 { | |
2458 if ( v22 >= 1 ) | |
2459 goto LABEL_59; | |
2460 v59 = 0; | |
2461 v56 = 13; | |
2462 } | |
2463 else | |
2464 { | |
2465 v59 = 0; | |
2466 v56 = 14; | |
2467 } | |
2468 v21->SetCondition(v56, v59); | |
2469 LABEL_59: | |
2470 v23 = (int)&v21->field_E0; | |
2471 if ( v21->field_E0 ) | |
2472 { | |
816 | 2473 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2474 if ( v24 > 0 ) |
2475 { | |
2476 *(int *)v23 = v24; | |
2477 } | |
2478 else | |
2479 { | |
2480 *(int *)v23 = 0; | |
2481 viewparams->bRedrawGameUI = 1; | |
2482 } | |
2483 } | |
2484 v25 = (int)&v21->field_E4; | |
2485 if ( v21->field_E4 ) | |
2486 { | |
816 | 2487 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2488 if ( v26 > 0 ) |
2489 { | |
2490 *(int *)v25 = v26; | |
2491 } | |
2492 else | |
2493 { | |
2494 *(int *)v25 = 0; | |
2495 viewparams->bRedrawGameUI = 1; | |
2496 } | |
2497 } | |
2498 v27 = (int)&v21->field_E8; | |
2499 if ( v21->field_E8 ) | |
2500 { | |
816 | 2501 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2502 if ( v28 > 0 ) |
2503 { | |
2504 *(int *)v27 = v28; | |
2505 } | |
2506 else | |
2507 { | |
2508 *(int *)v27 = 0; | |
2509 viewparams->bRedrawGameUI = 1; | |
2510 } | |
2511 } | |
2512 v29 = (int)&v21->field_EC; | |
2513 if ( v21->field_EC ) | |
2514 { | |
816 | 2515 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2516 if ( v30 > 0 ) |
2517 { | |
2518 *(int *)v29 = v30; | |
2519 } | |
2520 else | |
2521 { | |
2522 *(int *)v29 = 0; | |
2523 viewparams->bRedrawGameUI = 1; | |
2524 } | |
2525 } | |
2526 v31 = (int)&v21->field_F0; | |
2527 if ( v21->field_F0 ) | |
2528 { | |
816 | 2529 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2530 if ( v32 > 0 ) |
2531 { | |
2532 *(int *)v31 = v32; | |
2533 } | |
2534 else | |
2535 { | |
2536 *(int *)v31 = 0; | |
2537 viewparams->bRedrawGameUI = 1; | |
2538 } | |
2539 } | |
2540 v33 = (int)&v21->field_F4; | |
2541 if ( v21->field_F4 ) | |
2542 { | |
816 | 2543 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2544 if ( v34 > 0 ) |
2545 { | |
2546 *(int *)v33 = v34; | |
2547 } | |
2548 else | |
2549 { | |
2550 *(int *)v33 = 0; | |
2551 viewparams->bRedrawGameUI = 1; | |
2552 } | |
2553 } | |
2554 v35 = (int)&v21->field_F8; | |
2555 if ( v21->field_F8 ) | |
2556 { | |
816 | 2557 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2558 if ( v36 > 0 ) |
2559 { | |
2560 *(int *)v35 = v36; | |
2561 } | |
2562 else | |
2563 { | |
2564 *(int *)v35 = 0; | |
2565 viewparams->bRedrawGameUI = 1; | |
2566 } | |
2567 } | |
2568 v37 = (int)&v21->field_FC; | |
2569 if ( v21->field_FC ) | |
2570 { | |
816 | 2571 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2572 if ( v38 > 0 ) |
2573 { | |
2574 *(int *)v37 = v38; | |
2575 } | |
2576 else | |
2577 { | |
2578 *(int *)v37 = 0; | |
2579 viewparams->bRedrawGameUI = 1; | |
2580 } | |
2581 } | |
2582 v39 = (int)&v21->field_100; | |
2583 if ( v21->field_100 ) | |
2584 { | |
816 | 2585 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2586 if ( v40 > 0 ) |
2587 { | |
2588 *(int *)v39 = v40; | |
2589 } | |
2590 else | |
2591 { | |
2592 *(int *)v39 = 0; | |
2593 viewparams->bRedrawGameUI = 1; | |
2594 } | |
2595 } | |
2596 v41 = (int)&v21->field_104; | |
2597 if ( v21->field_104 ) | |
2598 { | |
816 | 2599 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2600 if ( v42 > 0 ) |
2601 { | |
2602 *(int *)v41 = v42; | |
2603 } | |
2604 else | |
2605 { | |
2606 *(int *)v41 = 0; | |
2607 viewparams->bRedrawGameUI = 1; | |
2608 } | |
2609 } | |
2610 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2611 --v65; | |
2612 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2613 | |
2614 for (uint k = 0; k < 24; ++k) | |
2615 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2616 | |
2617 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2618 v21->SetCondition(1u, 0); | |
2619 ++v62; | |
2620 } | |
2621 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2622 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2623 | |
2624 for (uint i = 0; i < 20; ++i) | |
2625 { | |
2626 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2627 viewparams->bRedrawGameUI = 1; | |
2628 } | |
2629 | |
2630 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2631 { | |
2632 for (uint i = 0; i < 4; ++i) | |
2633 pParty->pPlayers[i].SetCondition(1, 0); | |
2634 } | |
2635 | |
2636 for (uint i = 0; i < 2; ++i) | |
2637 { | |
2638 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2639 if (pBuf->uExpireTime == 0) | |
2640 continue; | |
2641 | |
2642 if ( !(pBuf->uFlags & 1) ) | |
2643 { | |
2644 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2645 { | |
2646 pBuf->Reset(); | |
2647 if (dword_4EE07C[i] == 7 ) | |
2648 pParty->bFlying = false; | |
2649 } | |
2650 } | |
2651 } | |
2652 | |
2653 v51 = v65; | |
2654 if ( v65 ) | |
2655 goto LABEL_135; | |
151 | 2656 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2657 { |
2658 v52 = (signed int)&pPlayers[1]; | |
2659 while ( 1 ) | |
2660 { | |
2661 v53 = *(int *)v52; | |
2662 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2663 break; | |
2664 v52 += 4; | |
2665 if ( v52 > (signed int)&pPlayers[4] ) | |
2666 goto LABEL_135; | |
2667 } | |
2668 *(int *)(v53 + 16) = 0; | |
2669 *(int *)(v53 + 20) = 0; | |
2670 v51 = 1; | |
2671 LABEL_135: | |
151 | 2672 if ( pCurrentScreen != SCREEN_REST |
0 | 2673 && (!v51 || dword_5C35C0) ) |
981 | 2674 uGameState = GAME_STATE_PARTY_DIED; |
0 | 2675 } |
2676 if ( uActiveCharacter ) | |
2677 { | |
151 | 2678 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2679 { |
2680 v54 = pPlayers[uActiveCharacter]; | |
2681 if ( v54->pConditions[2] | |
2682 || v54->pConditions[12] | |
2683 || v54->pConditions[13] | |
2684 || v54->pConditions[14] | |
2685 || v54->pConditions[15] | |
2686 || v54->pConditions[16] ) | |
2687 { | |
2688 viewparams->bRedrawGameUI = 1; | |
2689 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2690 } | |
2691 } | |
2692 } | |
2693 } | |
2694 | |
2695 //----- (00494820) -------------------------------------------------------- | |
758 | 2696 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2697 { |
2698 signed int v1; // eax@1 | |
2699 | |
2700 v1 = 5; | |
758 | 2701 if ( a1 % 24 >= 5 ) |
0 | 2702 v1 = 29; |
758 | 2703 return v1 - a1 % 24; |
0 | 2704 } |
2705 | |
2706 //----- (00494836) -------------------------------------------------------- | |
2707 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2708 { | |
2709 int v3; // esi@1 | |
2710 int result; // eax@1 | |
2711 stru339_spell_sound *v5; // ebx@1 | |
2712 int *v6; // edi@2 | |
2713 unsigned int v7; // eax@3 | |
2714 int v8; // [sp+Ch] [bp-8h]@3 | |
2715 int v9; // [sp+10h] [bp-4h]@2 | |
2716 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2717 | |
2718 v3 = 0; | |
2719 result = word_4EE088_sound_ids[uSoundID]; | |
2720 v5 = this; | |
2721 a2a = word_4EE088_sound_ids[uSoundID]; | |
2722 if ( result ) | |
2723 { | |
2724 v9 = 0; | |
2725 v6 = this->pSoundsOffsets; | |
2726 do | |
2727 { | |
2728 v7 = a2a++; | |
2729 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2730 if ( !result ) | |
2731 break; | |
2732 a6 += 4; | |
2733 result = v8 + 256; | |
2734 *v6 = v3; | |
2735 v3 += result; | |
2736 ++v9; | |
2737 *(v6 - 2) = result; | |
2738 ++v6; | |
2739 } | |
2740 while ( v9 < 2 ); | |
2741 } | |
2742 return result; | |
2743 } | |
2744 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2745 | |
2746 //----- (00494AED) -------------------------------------------------------- | |
130 | 2747 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2748 { |
2749 unsigned int _uNumFrames; // edx@1 | |
2750 unsigned int result; // eax@1 | |
2751 PlayerFrame *v4; // ecx@2 | |
2752 | |
2753 _uNumFrames = this->uNumFrames; | |
2754 result = 0; | |
2755 if ( (signed int)this->uNumFrames <= 0 ) | |
2756 { | |
2757 LABEL_5: | |
2758 result = 0; | |
2759 } | |
2760 else | |
2761 { | |
2762 v4 = this->pFrames; | |
130 | 2763 while ( v4->expression != expression ) |
0 | 2764 { |
2765 ++result; | |
2766 ++v4; | |
2767 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2768 goto LABEL_5; | |
2769 } | |
2770 } | |
2771 return result; | |
2772 } | |
2773 | |
2774 //----- (00494B10) -------------------------------------------------------- | |
2775 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2776 { | |
2777 unsigned int v3; // esi@1 | |
2778 PlayerFrame *v4; // edi@1 | |
2779 PlayerFrame *v5; // ecx@1 | |
2780 __int16 v6; // dx@2 | |
2781 int v7; // edx@3 | |
2782 char *i; // eax@3 | |
2783 int v9; // ecx@5 | |
2784 PlayerFrame *result; // eax@6 | |
2785 | |
2786 v3 = uFramesetID; | |
2787 v4 = this->pFrames; | |
2788 v5 = &v4[uFramesetID]; | |
2789 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2790 { | |
2791 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2792 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2793 { | |
2794 v9 = *(short *)i; | |
2795 if ( v7 <= v9 ) | |
2796 break; | |
2797 v7 -= v9; | |
2798 ++v3; | |
2799 } | |
2800 result = &v4[v3]; | |
2801 } | |
2802 else | |
2803 { | |
2804 result = &v4[uFramesetID]; | |
2805 } | |
2806 return result; | |
2807 } | |
2808 | |
2809 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2810 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2811 { |
2812 PlayerFrameTable *v4; // edi@1 | |
2813 int v5; // esi@1 | |
2814 int v6; // eax@2 | |
2815 | |
2816 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2817 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2818 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
|
2819 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2820 *pAnimTime = v5; |
0 | 2821 } |
2822 else | |
2823 { | |
2824 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2825 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2826 *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
|
2827 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2828 return &v4->pFrames[*pFramesetID]; |
0 | 2829 } |
2830 | |
2831 //----- (00494BC3) -------------------------------------------------------- | |
2832 void PlayerFrameTable::ToFile() | |
2833 { | |
2834 PlayerFrameTable *v1; // esi@1 | |
2835 FILE *v2; // eax@1 | |
2836 FILE *v3; // edi@1 | |
2837 | |
2838 auto Str = this; | |
2839 | |
2840 v1 = Str; | |
2841 v2 = fopen("data\\dpft.bin", "wb"); | |
2842 v3 = v2; | |
2843 if ( !v2 ) | |
2844 Abortf("Unable to save dpft.bin!"); | |
2845 fwrite(v1, 4u, 1u, v2); | |
2846 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2847 fclose(v3); | |
2848 } | |
2849 | |
2850 //----- (00494C0F) -------------------------------------------------------- | |
2851 void PlayerFrameTable::FromFile(void *pSerialized) | |
2852 { | |
2853 uNumFrames = *(int *)pSerialized; | |
2854 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2855 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2856 } | |
2857 | |
2858 //----- (00494C5A) -------------------------------------------------------- | |
2859 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2860 { | |
2861 PlayerFrameTable *v2; // ebx@1 | |
2862 FILE *v3; // eax@1 | |
2863 int v4; // esi@3 | |
2864 void *v5; // eax@10 | |
2865 FILE *v6; // ST0C_4@12 | |
2866 char *i; // eax@12 | |
2867 __int16 v8; // ax@15 | |
2868 const char *v9; // ST10_4@15 | |
2869 unsigned __int16 v10; // ax@15 | |
2870 const char *v11; // ST0C_4@15 | |
2871 int j; // esi@15 | |
2872 int v13; // eax@17 | |
2873 int v14; // edx@22 | |
2874 int v15; // ecx@23 | |
2875 int v16; // eax@24 | |
2876 signed int k; // eax@27 | |
2877 PlayerFrame *v18; // edx@28 | |
2878 int v19; // esi@28 | |
2879 int l; // ecx@29 | |
2880 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2881 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2882 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2883 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2884 int v26; // [sp+2FCh] [bp-8h]@3 | |
2885 FILE *File; // [sp+300h] [bp-4h]@1 | |
2886 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
2887 | |
2888 v2 = this; | |
2889 //TileTable::dtor((TileTable *)this); | |
2890 v3 = fopen(Args, "r"); | |
2891 File = v3; | |
2892 if ( !v3 ) | |
2893 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
2894 v4 = 0; | |
2895 v25 = 0; | |
2896 v26 = 1; | |
2897 if ( fgets(&Buf, 490, v3) ) | |
2898 { | |
2899 do | |
2900 { | |
2901 *strchr(&Buf, 10) = 0; | |
703 | 2902 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2903 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
2904 { | |
2905 if ( v24.uPropCount < 3 ) | |
0 | 2906 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
2907 ++v25; | |
2908 } | |
2909 ++v26; | |
2910 } | |
2911 while ( fgets(&Buf, 490, File) ); | |
2912 v4 = v25; | |
2913 } | |
2914 v2->uNumFrames = v4; | |
2915 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
2916 v2->pFrames = (PlayerFrame *)v5; | |
2917 if ( !v5 ) | |
2918 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
2919 v6 = File; | |
2920 v2->uNumFrames = 0; | |
2921 fseek(v6, 0, 0); | |
2922 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
2923 { | |
2924 *strchr(&Buf, 10) = 0; | |
703 | 2925 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2926 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 2927 { |
2928 v8 = atoi(v24.pProperties[0]); | |
2929 v9 = v24.pProperties[1]; | |
130 | 2930 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 2931 v10 = atoi(v9); |
2932 v11 = v24.pProperties[2]; | |
2933 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
2934 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
2935 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
2936 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 2937 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 2938 { |
1104 | 2939 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 2940 { |
2941 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
2942 *(char *)v13 |= 4u; | |
2943 } | |
2944 } | |
2945 ++v2->uNumFrames; | |
2946 } | |
2947 } | |
2948 fclose(File); | |
2949 v14 = 0; | |
2950 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
2951 { | |
2952 v15 = 0; | |
2953 do | |
2954 { | |
2955 v16 = (int)&v2->pFrames[v15]; | |
2956 if ( !(*(char *)(v16 + 18) & 4) ) | |
2957 *(char *)(v16 + 8) |= 1u; | |
2958 ++v14; | |
2959 ++v15; | |
2960 } | |
2961 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
2962 } | |
2963 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
2964 { | |
2965 v18 = v2->pFrames; | |
2966 Argsa = (int)&v18[k]; | |
2967 v19 = *(short *)(Argsa + 4); | |
2968 if ( *(char *)(Argsa + 8) & 1 ) | |
2969 { | |
2970 ++k; | |
2971 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
2972 { | |
2973 v19 += *(short *)(l + 4); | |
2974 ++k; | |
2975 } | |
2976 LOWORD(v19) = v18[k].uAnimTime + v19; | |
2977 } | |
2978 ++k; | |
2979 } | |
2980 return 1; | |
2981 } | |
2982 | |
2983 //----- (00494F3A) -------------------------------------------------------- | |
2984 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
2985 { | |
2986 IconFrameTable *v2; // esi@1 | |
2987 int v3; // ebx@1 | |
2988 unsigned int uID; // edi@1 | |
2989 unsigned int result; // eax@4 | |
2990 | |
2991 v2 = this; | |
2992 v3 = 0; | |
2993 uID = 0; | |
2994 if ( (signed int)this->uNumIcons <= 0 ) | |
2995 { | |
2996 LABEL_4: | |
2997 result = 0; | |
2998 } | |
2999 else | |
3000 { | |
1104 | 3001 while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) ) |
0 | 3002 { |
3003 ++uID; | |
3004 ++v3; | |
3005 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3006 goto LABEL_4; | |
3007 } | |
3008 result = uID; | |
3009 } | |
3010 return result; | |
3011 } | |
3012 | |
3013 //----- (00494F70) -------------------------------------------------------- | |
3014 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3015 { | |
3016 IconFrame *v3; // edi@1 | |
3017 IconFrame *v4; // ecx@1 | |
3018 __int16 v5; // dx@2 | |
3019 int v6; // edx@3 | |
3020 unsigned int v7; // eax@3 | |
3021 char *i; // ecx@3 | |
3022 int v9; // esi@5 | |
3023 IconFrame *result; // eax@6 | |
3024 | |
3025 v3 = this->pIcons; | |
3026 v4 = &v3[uIconID]; | |
3027 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3028 { | |
3029 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3030 v7 = uIconID; | |
3031 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3032 { | |
3033 v9 = *(short *)i; | |
3034 if ( v6 <= v9 ) | |
3035 break; | |
3036 v6 -= v9; | |
3037 ++v7; | |
3038 } | |
3039 result = &v3[v7]; | |
3040 } | |
3041 else | |
3042 { | |
3043 result = &v3[uIconID]; | |
3044 } | |
3045 return result; | |
3046 } | |
3047 | |
3048 //----- (00494FBF) -------------------------------------------------------- | |
3049 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3050 { | |
3051 IconFrameTable *v2; // esi@1 | |
3052 unsigned int v3; // edi@3 | |
3053 const char *i; // eax@3 | |
3054 IconFrame *v5; // eax@5 | |
3055 | |
3056 v2 = this; | |
3057 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3058 { | |
3059 v3 = uIconID; | |
3060 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3061 { | |
3062 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3063 v5 = v2->pIcons; | |
3064 if ( !(v5[v3].uFlags & 1) ) | |
3065 break; | |
3066 ++v3; | |
3067 } | |
3068 } | |
3069 } | |
3070 | |
3071 //----- (0049500A) -------------------------------------------------------- | |
3072 void IconFrameTable::ToFile() | |
3073 { | |
3074 IconFrameTable *v1; // esi@1 | |
3075 FILE *v2; // eax@1 | |
3076 FILE *v3; // edi@1 | |
3077 | |
3078 auto Str = this; | |
3079 | |
3080 v1 = Str; | |
3081 v2 = fopen("data\\dift.bin", "wb"); | |
3082 v3 = v2; | |
3083 if ( !v2 ) | |
3084 Abortf("Unable to save dift.bin!"); | |
3085 fwrite(v1, 4u, 1u, v2); | |
3086 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3087 fclose(v3); | |
3088 } | |
3089 | |
3090 //----- (00495056) -------------------------------------------------------- | |
3091 void IconFrameTable::FromFile(void *pSerialized) | |
3092 { | |
3093 uNumIcons = *(int *)pSerialized; | |
3094 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3095 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3096 } | |
3097 | |
3098 //----- (0049509D) -------------------------------------------------------- | |
3099 int IconFrameTable::FromFileTxt(const char *Args) | |
3100 { | |
3101 IconFrameTable *v2; // ebx@1 | |
3102 FILE *v3; // eax@1 | |
3103 int v4; // esi@3 | |
3104 void *v5; // eax@10 | |
3105 FILE *v6; // ST0C_4@12 | |
3106 char *i; // eax@12 | |
3107 const char *v8; // ST00_4@15 | |
3108 int v9; // eax@16 | |
3109 int v10; // edx@20 | |
3110 int v11; // ecx@21 | |
3111 int v12; // eax@22 | |
3112 signed int j; // edx@25 | |
3113 IconFrame *v14; // ecx@26 | |
3114 int v15; // esi@26 | |
3115 int k; // eax@27 | |
3116 signed int result; // eax@11 | |
3117 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3118 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3119 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3120 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3121 int v22; // [sp+2FCh] [bp-8h]@3 | |
3122 FILE *File; // [sp+300h] [bp-4h]@1 | |
3123 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3124 | |
3125 v2 = this; | |
3126 //TileTable::dtor((TileTable *)this); | |
3127 v3 = fopen(Args, "r"); | |
3128 File = v3; | |
3129 if ( !v3 ) | |
3130 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3131 v4 = 0; | |
3132 v21 = 0; | |
3133 v22 = 1; | |
3134 if ( fgets(&Buf, 490, v3) ) | |
3135 { | |
3136 do | |
3137 { | |
3138 *strchr(&Buf, 10) = 0; | |
3139 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3140 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3141 { | |
3142 if ( v20.uPropCount < 3 ) | |
0 | 3143 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3144 ++v21; | |
3145 } | |
3146 ++v22; | |
3147 } | |
3148 while ( fgets(&Buf, 490, File) ); | |
3149 v4 = v21; | |
3150 } | |
3151 v2->uNumIcons = v4; | |
3152 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3153 v2->pIcons = (IconFrame *)v5; | |
3154 if ( v5 ) | |
3155 { | |
3156 v6 = File; | |
3157 v2->uNumIcons = 0; | |
3158 fseek(v6, 0, 0); | |
3159 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3160 { | |
3161 *strchr(&Buf, 10) = 0; | |
3162 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3163 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3164 { |
3165 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3166 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3167 v8 = v20.pProperties[2]; | |
3168 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
1104 | 3169 if ( !_stricmp(v8, "new") ) |
0 | 3170 { |
3171 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3172 *(char *)v9 |= 4u; | |
3173 } | |
3174 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3175 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3176 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3177 } | |
3178 } | |
3179 fclose(File); | |
3180 v10 = 0; | |
3181 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3182 { | |
3183 v11 = 0; | |
3184 do | |
3185 { | |
3186 v12 = (int)&v2->pIcons[v11]; | |
3187 if ( !(*(char *)(v12 + 60) & 4) ) | |
3188 *(char *)(v12 + 28) |= 1u; | |
3189 ++v10; | |
3190 ++v11; | |
3191 } | |
3192 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3193 } | |
3194 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3195 { | |
3196 v14 = v2->pIcons; | |
3197 Argsa = (int)&v14[j]; | |
3198 v15 = *(short *)(Argsa + 24); | |
3199 if ( *(char *)(Argsa + 28) & 1 ) | |
3200 { | |
3201 ++j; | |
3202 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3203 { | |
3204 v15 += *(short *)(k + 24); | |
3205 ++j; | |
3206 } | |
3207 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3208 } | |
3209 ++j; | |
3210 } | |
3211 result = 1; | |
3212 } | |
3213 else | |
3214 { | |
3215 fclose(File); | |
3216 result = 0; | |
3217 } | |
3218 return result; | |
3219 } | |
3220 | |
3221 //----- (00495366) -------------------------------------------------------- | |
3222 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3223 { | |
3224 int v2; // edi@1 | |
3225 int v3; // edx@2 | |
3226 int v4; // esi@3 | |
3227 int v5; // ebx@5 | |
3228 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3229 signed int v8; // [sp+10h] [bp-10h]@1 | |
3230 int **v9; // [sp+14h] [bp-Ch]@4 | |
3231 signed int v10; // [sp+18h] [bp-8h]@3 | |
3232 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3233 | |
3234 v2 = a1; | |
3235 v11 = a2; | |
3236 v8 = 0; | |
3237 v7 = 0; | |
3238 if ( dword_AE336C == a1 ) | |
3239 { | |
3240 v3 = dword_AE3370; | |
3241 } | |
3242 else | |
3243 { | |
3244 v4 = a2; | |
3245 dword_AE336C = a1; | |
3246 v10 = 0; | |
3247 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3248 goto LABEL_17; | |
3249 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3250 do | |
3251 { | |
3252 v5 = tolower(*(char *)*v9); | |
3253 if ( v5 == tolower(v2) ) | |
3254 { | |
3255 if ( v8 ) | |
3256 v7 = v10; | |
3257 else | |
3258 v8 = v10; | |
3259 } | |
3260 ++v10; | |
3261 v9 += 2; | |
3262 } | |
3263 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3264 if ( v8 && v8 != v7 ) | |
3265 v3 = v8 + rand() % (v7 - v8); | |
3266 else | |
3267 LABEL_17: | |
3268 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3269 } | |
3270 dword_AE3370 = v3; | |
3271 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3272 } | |
3273 // AE336C: using guessed type int dword_AE336C; | |
3274 // AE3370: using guessed type int dword_AE3370; | |
3275 | |
3276 //----- (00495430) -------------------------------------------------------- | |
607 | 3277 char * GetReputationString( signed int a1 ) |
3278 { | |
566 | 3279 if (a1 >= 25) |
3280 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3281 else if (a1 >= 6) | |
3282 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3283 else if (a1 >= -5) | |
3284 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3285 else if (a1 >= -24) | |
3286 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3287 else |
566 | 3288 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3289 } |
3290 | |
3291 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3292 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3293 { |
3294 unsigned __int8 v6; // bl@1 | |
3295 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3296 //NPCData *v9; // eax@4 |
250 | 3297 //size_t v10; // eax@6 |
0 | 3298 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3299 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3300 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3301 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3302 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3303 //int v16; // edx@10 |
0 | 3304 int v17; // eax@10 |
3305 signed __int64 v18; // qax@18 | |
3306 unsigned int v19; // edi@32 | |
3307 unsigned __int8 *v20; // ebx@32 | |
3308 int v21; // ecx@34 | |
3309 __int16 v22; // ax@34 | |
3310 int v23; // edx@39 | |
3311 int v24; // eax@39 | |
3312 int v25; // eax@45 | |
3313 float *v26; // esi@68 | |
3314 float v27; // ST18_4@68 | |
3315 signed int v28; // eax@68 | |
3316 int v29; // eax@68 | |
3317 float v30; // ST18_4@72 | |
3318 signed int v31; // eax@72 | |
3319 float v32; // ST18_4@74 | |
3320 signed int v33; // eax@74 | |
3321 double v34; // st7@75 | |
3322 float v35; // ST18_4@76 | |
3323 signed int v36; // eax@76 | |
3324 float *v37; // esi@78 | |
3325 float v38; // ST18_4@78 | |
3326 int v39; // eax@78 | |
3327 float v40; // ST18_4@82 | |
3328 int v41; // eax@82 | |
3329 float v42; // ST18_4@83 | |
3330 int v43; // eax@83 | |
3331 float v44; // ST18_4@85 | |
3332 int v45; // eax@85 | |
3333 const char *v46; // eax@86 | |
3334 unsigned int v47; // eax@87 | |
3335 float v48; // ST18_4@97 | |
3336 __int64 v49; // ST14_8@107 | |
3337 int v50; // eax@107 | |
3338 int v51; // eax@108 | |
3339 Player *v52; // eax@109 | |
3340 int v53; // [sp-4h] [bp-13Ch]@107 | |
3341 int v54; // [sp+0h] [bp-138h]@107 | |
3342 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3343 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3344 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3345 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3346 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3347 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3348 //Player *v61; // [sp+124h] [bp-14h]@3 |
3349 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3350 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3351 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3352 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3353 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3354 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3355 |
0 | 3356 |
3357 v6 = uPlayerID; | |
249 | 3358 //Str = lpsz; |
0 | 3359 if ( IsBadStringPtrA(lpsz, 1u) ) |
3360 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3361 |
0 | 3362 a1[0] = 0; |
3363 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3364 v59 = TargetColor(255, 255, 155); |
249 | 3365 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3366 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3367 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3368 NPCData *npc = nullptr; |
0 | 3369 if ( dword_5C35D4 ) |
248 | 3370 { |
463 | 3371 //__debugbreak(); // fix |
459 | 3372 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
|
3373 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3374 else |
602 | 3375 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3376 //v65 = v9; |
250 | 3377 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3378 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3379 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3380 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3381 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3382 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3383 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3384 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3385 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3386 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3387 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3388 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3389 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3390 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3391 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3392 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3393 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3394 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3395 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3396 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3397 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3398 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3399 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3400 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
|
3401 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3402 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3403 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3404 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3405 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3406 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3407 case 2: |
0 | 3408 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3409 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3410 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3411 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3412 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3413 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3414 case 5: |
0 | 3415 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3416 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3417 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3418 { | |
3419 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3420 { | |
3421 if ( v18 < 20 ) | |
3422 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3423 } | |
3424 else | |
3425 { | |
3426 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3427 } | |
3428 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3429 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3430 case 6: |
0 | 3431 if ( pPlayer->uSex ) |
3432 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3433 else | |
3434 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3435 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3436 case 7: |
0 | 3437 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3438 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3439 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3440 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3441 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3442 case 8: |
0 | 3443 v19 = 0; |
3444 v63 = 0; | |
484 | 3445 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3446 do |
3447 { | |
3448 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3449 { | |
3450 v21 = v63; | |
3451 v22 = word_4EE150[v19]; | |
3452 ++v63; | |
3453 v55[v21] = v22; | |
3454 } | |
3455 ++v19; | |
3456 } | |
3457 while ( v19 < 28 ); | |
3458 if ( v63 ) | |
3459 { | |
3460 v23 = rand() % v63; | |
3461 v24 = dword_A74CDC; | |
3462 if ( dword_A74CDC == -1 ) | |
3463 { | |
3464 v24 = v23; | |
3465 dword_A74CDC = v23; | |
3466 } | |
492 | 3467 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3468 } |
3469 else | |
3470 { | |
3471 v11 = (char *)pNPCTopics[55].pText; | |
3472 } | |
249 | 3473 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3475 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3476 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3482 case 10: |
0 | 3483 if ( pPlayer->uSex ) |
3484 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3485 else | |
3486 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3488 case 11: |
0 | 3489 v25 = GetPartyReputation(); |
3490 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 v25 = npc->rep; |
0 | 3493 LABEL_46: |
3494 if ( v25 >= 25 ) | |
3495 { | |
3496 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3497 } | |
3498 else | |
3499 { | |
3500 if ( v25 < 6 ) | |
3501 { | |
3502 if ( v25 >= -5 ) | |
3503 { | |
3504 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3505 } | |
3506 else | |
3507 { | |
3508 if ( v25 < -24 ) | |
3509 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3510 else | |
3511 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3512 } | |
3513 } | |
3514 else | |
3515 { | |
3516 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3517 } | |
3518 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 case 13: |
0 | 3521 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3542 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3543 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3544 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3546 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 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
|
3554 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 sprintf(a1, "%lu", pay_percentage); |
250 | 3558 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3570 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3571 sprintf(a1, "%lu", v51); |
0 | 3572 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3575 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3576 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3577 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3580 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3584 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3585 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3599 switch ( a5 ) |
3600 { | |
3601 case 3: | |
3602 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 v45 = a3->GetValue(); |
0 | 3604 v29 = pPlayer->_4B8213(v45, v44); |
3605 break; | |
3606 case 4: | |
3607 v29 = pPlayer->_4B824B(*v37); | |
3608 break; | |
3609 case 5: | |
3610 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3611 v43 = a3->GetValue(); |
0 | 3612 v29 = pPlayer->_4B8265(v43, v42); |
3613 break; | |
3614 case 6: | |
3615 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3616 v41 = a3->GetValue(); |
0 | 3617 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3618 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3620 goto _continue_sprintf; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3623 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3624 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3625 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3626 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3627 v28 = a3->GetValue(); |
749 | 3628 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3629 if ( a5 == 3 ) |
3630 { | |
3631 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3632 v36 = a3->GetValue(); |
917 | 3633 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3634 if (a3->Broken()) |
0 | 3635 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3636 goto _continue_sprintf; |
0 | 3637 } |
3638 if ( a5 != 4 ) | |
3639 { | |
3640 if ( a5 == 5 ) | |
3641 { | |
3642 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 v33 = a3->GetValue(); |
916 | 3644 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3645 } |
3646 else | |
3647 { | |
3648 if ( a5 == 6 ) | |
3649 { | |
3650 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 v31 = a3->GetValue(); |
917 | 3652 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3653 if (a3->Broken()) |
0 | 3654 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 goto _continue_sprintf; |
0 | 3658 } |
3659 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 _continue_sprintf: |
0 | 3661 sprintf(a1, "%lu", v29); |
250 | 3662 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 goto _continue_strcat; |
0 | 3664 } |
3665 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 |
0 | 3667 v48 = v34; |
916 | 3668 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 goto _continue_sprintf; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 v48 = v34; |
916 | 3684 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 goto _continue_sprintf; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 sub_493F79(&v57, *a6); |
351 | 3693 v54 = v57.field_18_expire_year; |
3694 v53 = v57.field_C_expire_day + 1; | |
3695 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 default: |
0 | 3710 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 goto _continue_strcat; |
484 | 3714 v49 = pParty->field_3C._s_times[v17-51]; |
3715 | |
0 | 3716 sub_493F79(&v56, v49); |
351 | 3717 v54 = v56.field_18_expire_year; |
3718 v53 = v56.field_C_expire_day + 1; | |
3719 v50 = v56.field_14_exprie_month; | |
0 | 3720 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3721 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 } |
0 | 3725 } |
3726 return pTmpBuf2; | |
3727 } | |
3728 | |
3729 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3730 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3731 { |
734 | 3732 //stru154 *v3; // edi@1 |
3733 //signed int v4; // eax@1 | |
3734 //signed int result; // eax@9 | |
3735 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3736 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3737 float v7; |
0 | 3738 |
3739 v.x = 0.0; | |
3740 v.y = 0.0; | |
3741 v.z = 0.0; | |
734 | 3742 GetFacePlane(a2, a3, &v, &v7); |
3743 | |
3744 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3745 polygonType = POLYGON_VerticalWall; | |
3746 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3747 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3748 polygonType = POLYGON_Floor; | |
0 | 3749 else |
734 | 3750 polygonType = POLYGON_InBetweenFloorAndWall; |
3751 | |
3752 face_plane.vNormal.x = v.x; | |
3753 face_plane.vNormal.y = v.y; | |
3754 face_plane.vNormal.z = v.z; | |
3755 face_plane.dist = v7; | |
0 | 3756 } |
3757 | |
3758 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3759 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3760 { |
734 | 3761 if (fabsf(pNormal->z) < 1e-6f) |
3762 polygonType = POLYGON_VerticalWall; | |
3763 else if (fabsf(pNormal->x) < 1e-6f && | |
3764 fabsf(pNormal->y) < 1e-6f) | |
3765 polygonType = POLYGON_Floor; | |
0 | 3766 else |
734 | 3767 polygonType = POLYGON_InBetweenFloorAndWall; |
3768 | |
3769 face_plane.vNormal.x = pNormal->x; | |
3770 face_plane.dist = dist; | |
3771 face_plane.vNormal.y = pNormal->y; | |
3772 face_plane.vNormal.z = pNormal->z; | |
0 | 3773 } |
3774 | |
3775 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3776 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3777 { |
3778 ODMFace *v5; // ebx@1 | |
734 | 3779 //int v6; // eax@1 |
3780 //unsigned __int16 *v7; // ebx@2 | |
3781 //Vec3_int_ *v8; // eax@3 | |
0 | 3782 Vec3_int_ *v9; // ecx@3 |
734 | 3783 //double v10; // st7@3 |
3784 //int v11; // ecx@3 | |
0 | 3785 Vec3_int_ *v12; // ecx@3 |
734 | 3786 //double v13; // st7@3 |
3787 //double v14; // st6@3 | |
3788 //double v15; // st5@3 | |
3789 //int v16; // ecx@3 | |
0 | 3790 Vec3_int_ *v17; // eax@3 |
734 | 3791 //double v18; // st5@3 |
0 | 3792 Vec3_float_ *v19; // eax@3 |
734 | 3793 //int result; // eax@8 |
3794 //float v21; // ecx@10 | |
3795 //double v22; // st7@10 | |
3796 //double v23; // st6@10 | |
0 | 3797 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3798 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3799 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3800 float v27; // [sp+20h] [bp-48h]@3 | |
3801 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3802 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3803 //float v30; // [sp+30h] [bp-38h]@3 | |
3804 //float v31; // [sp+34h] [bp-34h]@3 | |
3805 //float v32; // [sp+38h] [bp-30h]@3 | |
3806 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3807 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3808 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3809 //float v36; // [sp+50h] [bp-18h]@3 | |
3810 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3811 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3812 //int v39; // [sp+64h] [bp-4h]@1 |
3813 | |
3814 //v39 = 0; | |
0 | 3815 v1.x = 0.0; |
3816 v5 = pFace; | |
734 | 3817 //v6 = pFace->uNumVertices; |
0 | 3818 v1.y = 0.0; |
3819 v1.z = 0.0; | |
734 | 3820 |
3821 if (pFace->uNumVertices >= 2) | |
3822 { | |
3823 int i = 0; | |
3824 while ( i < pFace->uNumVertices - 2 ) | |
3825 { | |
3826 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3827 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3828 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 3829 i++; |
734 | 3830 v1.x = v12->x - v9->x; |
3831 v26 = v17->x - v12->x; | |
3832 v1.y = v12->y - v9->y; | |
3833 v27 = v17->y - v12->y; | |
3834 v1.z = v12->z - v9->z; | |
3835 v28 = v17->z - v12->z; | |
0 | 3836 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3837 v38.x = v19->x; | |
3838 v38.y = v19->y; | |
3839 v38.z = v19->z; | |
734 | 3840 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3841 { | |
3842 v38.Normalize(); | |
3843 | |
3844 pOutNormal->x = v38.x; | |
3845 pOutNormal->y = v38.y; | |
3846 pOutNormal->z = v38.z; | |
3847 | |
3848 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3849 return; | |
3850 } | |
3851 } | |
3852 } | |
3853 | |
3854 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3855 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3856 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3857 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3858 } |
3859 | |
3860 //----- (0049D700) -------------------------------------------------------- | |
3861 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3862 { | |
3863 unsigned int v1; // eax@1 | |
3864 int v2; // ecx@1 | |
3865 unsigned int v3; // eax@1 | |
3866 | |
3867 v1 = uDim; | |
3868 v2 = 0; | |
3869 v3 = v1 - 1; | |
3870 while ( v3 & 1 ) | |
3871 { | |
3872 v3 >>= 1; | |
3873 ++v2; | |
3874 } | |
3875 return v3 == 0 ? v2 : 0; | |
3876 } | |
3877 | |
3878 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3879 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3880 { |
737 | 3881 /*signed __int64 v2; // ST10_8@1 |
0 | 3882 double v3; // st7@1 |
3883 float v4; // ST24_4@1 | |
3884 double v5; // ST10_8@1 | |
3885 int v6; // ST1C_4@1 | |
3886 float v7; // ST24_4@1 | |
3887 double v8; // ST10_8@1 | |
3888 unsigned __int8 v9; // ST20_1@1 | |
3889 float v10; // ST24_4@1 | |
3890 double v11; // ST10_8@1 | |
3891 float v12; // ST24_4@1 | |
737 | 3892 double v13; // ST08_8@1*/ |
3893 | |
3894 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
3895 (a2 >> 24) / 255.0f * 255.0f), | |
3896 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
3897 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
3898 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
3899 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
3900 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
3901 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
3902 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
3903 /*v2 = a1 >> 24; | |
3904 v3 = (double)v2 / 255.0f; | |
3905 HIDWORD(v2) = 0; | |
0 | 3906 LODWORD(v2) = a2 >> 24; |
737 | 3907 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 3908 v5 = v4 + 6.7553994e15; |
3909 v6 = LODWORD(v5); | |
737 | 3910 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 3911 v8 = v7 + 6.7553994e15; |
3912 v9 = LOBYTE(v8); | |
737 | 3913 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 3914 v11 = v10 + 6.7553994e15; |
737 | 3915 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 3916 v13 = v12 + 6.7553994e15; |
737 | 3917 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 3918 } |
3919 | |
3920 //----- (004A46E6) -------------------------------------------------------- | |
3921 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
3922 { | |
3923 int v5; // eax@1 | |
3924 int z; // eax@1 | |
3925 unsigned int v7; // eax@9 | |
3926 unsigned int v8; // ecx@9 | |
3927 int v9; // eax@9 | |
3928 unsigned int v10; // eax@10 | |
3929 int *v11; // esi@10 | |
3930 int *v12; // edi@10 | |
3931 int v13; // ecx@10 | |
3932 int v14; // edx@10 | |
3933 unsigned int v15; // eax@22 | |
3934 int *v16; // esi@22 | |
3935 int *v17; // edi@22 | |
3936 int v18; // ecx@22 | |
3937 int v19; // edx@22 | |
3938 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
3939 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
3940 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
3941 signed int v23; // [sp+20h] [bp+Ch]@1 | |
3942 | |
3943 v5 = a4; | |
3944 v23 = _z >> 16; | |
3945 z = x + v5; | |
693 | 3946 if ( z >= (signed int)pViewport->uViewportTL_X |
3947 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
3948 && y >= (signed int)pViewport->uViewportTL_Y | |
3949 && y <= (signed int)pViewport->uViewportBR_Y ) | |
3950 { | |
3951 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
3952 x = pViewport->uViewportTL_X; | |
3953 if ( z > (signed int)pViewport->uViewportBR_X ) | |
3954 z = pViewport->uViewportBR_X; | |
0 | 3955 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
3956 v22 = z - x; | |
3957 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
3958 v7 = lightColor >> 3; | |
3959 v8 = lightColor & 0xF0; | |
3960 v9 = v7 & 0x1E0000; | |
3961 if ( pRenderer->uTargetGBits == 5 ) | |
3962 { | |
3963 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
3964 v11 = (int *)pTarget; | |
3965 v12 = pTargetZ; | |
3966 v13 = v22; | |
3967 v14 = (v10 << 16) | v10; | |
3968 z = (unsigned __int8)pTarget & 2; | |
3969 if ( (unsigned __int8)pTarget & 2 ) | |
3970 { | |
3971 z = (unsigned int)*pTargetZ >> 16; | |
3972 if ( z > v23 ) | |
3973 { | |
3974 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
3975 *pTarget = z; | |
3976 } | |
3977 v13 = v22 - 1; | |
3978 v11 = (int *)(pTarget + 1); | |
3979 v12 = pTargetZ + 1; | |
3980 } | |
3981 while ( v13 != 1 ) | |
3982 { | |
3983 if ( v13 < 1 ) | |
3984 return z; | |
3985 z = (unsigned int)*v12 >> 16; | |
3986 if ( z <= v23 ) | |
3987 { | |
3988 v13 -= 2; | |
3989 ++v11; | |
3990 v12 += 2; | |
3991 } | |
3992 else | |
3993 { | |
3994 v12 += 2; | |
3995 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
3996 v13 -= 2; | |
3997 *v11 = z; | |
3998 ++v11; | |
3999 } | |
4000 } | |
4001 z = (unsigned int)*v12 >> 16; | |
4002 if ( z > v23 ) | |
4003 { | |
4004 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4005 *(short *)v11 = z; | |
4006 } | |
4007 } | |
4008 else | |
4009 { | |
4010 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4011 v16 = (int *)pTarget; | |
4012 v17 = pTargetZ; | |
4013 v18 = v22; | |
4014 v19 = (v15 << 16) | v15; | |
4015 z = (unsigned __int8)pTarget & 2; | |
4016 if ( (unsigned __int8)pTarget & 2 ) | |
4017 { | |
4018 z = (unsigned int)*pTargetZ >> 16; | |
4019 if ( z > v23 ) | |
4020 { | |
4021 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4022 *pTarget = z; | |
4023 } | |
4024 v18 = v22 - 1; | |
4025 v16 = (int *)(pTarget + 1); | |
4026 v17 = pTargetZ + 1; | |
4027 } | |
4028 while ( v18 != 1 ) | |
4029 { | |
4030 if ( v18 < 1 ) | |
4031 return z; | |
4032 z = (unsigned int)*v17 >> 16; | |
4033 if ( z <= v23 ) | |
4034 { | |
4035 v18 -= 2; | |
4036 ++v16; | |
4037 v17 += 2; | |
4038 } | |
4039 else | |
4040 { | |
4041 v17 += 2; | |
4042 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4043 v18 -= 2; | |
4044 *v16 = z; | |
4045 ++v16; | |
4046 } | |
4047 } | |
4048 z = (unsigned int)*v17 >> 16; | |
4049 if ( z > v23 ) | |
4050 { | |
4051 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4052 *(short *)v16 = z; | |
4053 } | |
4054 } | |
4055 } | |
4056 return z; | |
4057 } | |
4058 | |
4059 //----- (004A57E9) -------------------------------------------------------- | |
4060 void __cdecl Present_ColorKey() | |
4061 { | |
4062 HRESULT v0; // eax@3 | |
4063 HRESULT v1; // eax@3 | |
4064 HRESULT v2; // eax@3 | |
4065 HRESULT v3; // eax@3 | |
4066 HRESULT v4; // eax@3 | |
4067 RECT a2; // [sp+4h] [bp-14h]@3 | |
4068 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4069 | |
4070 if ( !pRenderer->uNumSceneBegins ) | |
4071 { | |
4072 if ( pRenderer->field_40110 ) | |
4073 { | |
693 | 4074 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4075 a2.left = 0; |
4076 a2.top = 0; | |
4077 a2.right = 640; | |
4078 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4079 a2.right = 640; | |
4080 a2.left = 0; | |
693 | 4081 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4082 a2.bottom = 480; |
4083 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4084 0, | |
693 | 4085 pViewport->uViewportBR_Y + 1, |
0 | 4086 pRenderer->pColorKeySurface4, |
4087 &a2, | |
4088 16u)); | |
693 | 4089 a2.right = pViewport->uViewportTL_X; |
4090 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4091 a2.left = 0; |
693 | 4092 a2.top = pViewport->uViewportTL_Y; |
0 | 4093 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4094 0, | |
693 | 4095 pViewport->uViewportTL_Y, |
0 | 4096 pRenderer->pColorKeySurface4, |
4097 &a2, | |
4098 16u)); | |
693 | 4099 a2.left = pViewport->uViewportBR_X; |
4100 a2.top = pViewport->uViewportTL_Y; | |
0 | 4101 a2.right = 640; |
693 | 4102 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4103 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4104 pViewport->uViewportBR_X, |
4105 pViewport->uViewportTL_Y, | |
0 | 4106 pRenderer->pColorKeySurface4, |
4107 &a2, | |
4108 16u)); | |
693 | 4109 a2.right = pViewport->uViewportBR_X; |
4110 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4111 a2.left = pViewport->uViewportTL_X; | |
4112 a2.top = pViewport->uViewportTL_Y; | |
0 | 4113 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4114 pViewport->uViewportTL_X, |
4115 pViewport->uViewportTL_Y, | |
0 | 4116 pRenderer->pColorKeySurface4, |
4117 &a2, | |
4118 17u)); | |
4119 } | |
4120 } | |
4121 } | |
4122 | |
4123 //----- (004A597D) -------------------------------------------------------- | |
4124 void Present_NoColorKey() | |
4125 { | |
4126 //unsigned __int16 *v0; // eax@4 | |
4127 unsigned __int16 *v1; // esi@4 | |
4128 void *v2; // edi@4 | |
4129 //signed int v4; // ebx@4 | |
4130 //signed int v5; // ebx@6 | |
4131 //void *v6; // edi@7 | |
4132 //const void *v7; // esi@7 | |
4133 signed int v8; // ebx@8 | |
4134 int v9; // eax@10 | |
4135 unsigned int v10; // esi@10 | |
4136 unsigned __int32 v11; // edi@10 | |
4137 //int v12; // ecx@10 | |
4138 unsigned int v13; // ebx@10 | |
4139 int v14; // eax@11 | |
4140 int v15; // eax@13 | |
4141 int v16; // eax@14 | |
4142 int v17; // eax@16 | |
4143 HRESULT v18; // eax@22 | |
4144 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4145 int v20; // [sp+88h] [bp-1Ch]@10 | |
4146 int v21; // [sp+8Ch] [bp-18h]@10 | |
4147 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4148 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4149 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4150 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4151 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4152 | |
4153 if ( !pRenderer->uNumSceneBegins ) | |
4154 { | |
4155 if ( pRenderer->field_40110 ) | |
4156 { | |
4157 memset(&Dst, 0, 0x7Cu); | |
4158 Dst.dwSize = 124; | |
168 | 4159 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4160 { |
4161 //v26 = Dst.lpSurface; | |
4162 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4163 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4164 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4165 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4166 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4167 v1 = pRenderer->pTargetSurface; | |
4168 v2 = Dst.lpSurface; | |
4169 | |
4170 | |
4171 /*for (uint y = 0; y < 480; ++y) | |
4172 { | |
4173 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4174 for (uint x = 0; x < 640; ++x) | |
4175 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4176 }*/ | |
4177 | |
4178 auto pSrc = pRenderer->pTargetSurface; | |
4179 auto pDst = (__int16 *)Dst.lpSurface; | |
4180 | |
4181 for (uint y = 0; y < 8; ++y) | |
4182 memcpy(pDst + y * Dst.lPitch / 2, | |
4183 | |
4184 pSrc + y * 640, 640 * sizeof(__int16)); | |
4185 | |
4186 for (uint y = 8; y < 352; ++y) | |
4187 { | |
4188 memcpy(pDst + y * Dst.lPitch / 2, | |
4189 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4190 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4191 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4192 } |
4193 | |
121 | 4194 for (uint y = 352; y < 480; ++y) |
0 | 4195 memcpy(pDst + y * Dst.lPitch / 2, |
4196 pSrc + y * 640, 640 * sizeof(__int16)); | |
4197 | |
4198 | |
693 | 4199 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4200 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4201 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4202 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4203 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4204 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4205 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4206 v21 = 4 * v9 + 1280; | |
4207 | |
121 | 4208 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4209 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4210 v10 = (int)pSrc_x1y1; | |
4211 v11 = (int)pDst_x1y1; | |
693 | 4212 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4213 v13 = v24; |
4214 | |
693 | 4215 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4216 { |
4217 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4218 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4219 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4220 { |
4221 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4222 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4223 } | |
4224 } | |
4225 | |
4226 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4227 | |
4228 /* while ( 1 ) | |
4229 { | |
4230 while ( 1 ) | |
4231 { | |
4232 v14 = *(int *)v10; | |
4233 v10 += 4; | |
4234 if ( v14 == v13 ) | |
4235 break; | |
4236 if ( (short)v14 == (short)v13 ) | |
4237 { | |
4238 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4239 v11 += 4; | |
4240 --uHalfWidth; | |
4241 if ( !uHalfWidth ) | |
4242 goto LABEL_21; | |
4243 } | |
4244 else | |
4245 { | |
4246 v15 = __ROL__(v14, 16); | |
4247 if ( (short)v15 == (short)v13 ) | |
4248 { | |
4249 v17 = __ROR__(v15, 16); | |
4250 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4251 v11 += 4; | |
4252 --uHalfWidth; | |
4253 if ( !uHalfWidth ) | |
4254 goto LABEL_21; | |
4255 } | |
4256 else | |
4257 { | |
4258 v16 = __ROR__(v15, 16); | |
4259 *(int *)v11 = v16; | |
4260 v11 += 4; | |
4261 --uHalfWidth; | |
4262 if ( !uHalfWidth ) | |
4263 goto LABEL_21; | |
4264 } | |
4265 } | |
4266 } | |
4267 v11 += 4; | |
4268 --uHalfWidth; | |
4269 if ( !uHalfWidth ) | |
4270 { | |
4271 LABEL_21: | |
4272 v10 += v21; | |
4273 v11 += v22; | |
4274 uHalfWidth = v20; | |
4275 if ( !--uNumLines ) | |
4276 { | |
4277 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4278 return; | |
4279 } | |
4280 } | |
4281 }*/ | |
4282 } | |
4283 } | |
4284 } | |
4285 } | |
4286 | |
4287 //----- (004A7063) -------------------------------------------------------- | |
4288 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4289 { | |
4290 float v2; // ST1C_4@1 | |
4291 double v3; // ST14_8@1 | |
4292 signed int v4; // ebx@1 | |
4293 float v5; // ST1C_4@1 | |
4294 double v6; // ST14_8@1 | |
4295 signed int v7; // edi@1 | |
4296 double v8; // ST0C_8@1 | |
4297 signed int v9; // esi@1 | |
4298 signed int v10; // ecx@1 | |
4299 double v12; // [sp+8h] [bp-18h]@1 | |
4300 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4301 | |
4302 v2 = (double)(uDiffuse >> 24) * a2; | |
4303 v3 = v2 + 6.7553994e15; | |
4304 v4 = LODWORD(v3); | |
4305 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4306 v6 = v5 + 6.7553994e15; | |
4307 v7 = LODWORD(v6); | |
4308 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4309 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4310 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4311 v9 = LODWORD(v8); | |
4312 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4313 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4314 v10 = LODWORD(v12); | |
4315 if ( v4 > 255 ) | |
4316 v4 = 255; | |
4317 if ( v4 < 0 ) | |
4318 v4 = 0; | |
4319 if ( SHIDWORD(v13) > 255 ) | |
4320 v7 = 255; | |
4321 if ( v7 < 0 ) | |
4322 v7 = 0; | |
4323 if ( (signed int)v13 > 255 ) | |
4324 v9 = 255; | |
4325 if ( v9 < 0 ) | |
4326 v9 = 0; | |
4327 if ( SLODWORD(v12) > 255 ) | |
4328 v10 = 255; | |
4329 if ( v10 < 0 ) | |
4330 v10 = 0; | |
4331 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4332 } | |
4333 | |
4334 //----- (004AD504) -------------------------------------------------------- | |
711 | 4335 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4336 { |
4337 int result; // eax@1 | |
711 | 4338 signed int v2; // ebx@1 |
0 | 4339 BLVFace *v3; // esi@3 |
4340 Texture *v4; // edi@6 | |
4341 int v5; // eax@7 | |
4342 int v6; // edx@7 | |
4343 int v7; // ecx@7 | |
4344 int v8; // ebx@8 | |
4345 int v9; // eax@8 | |
4346 int v10; // ebx@8 | |
4347 unsigned int v11; // ebx@9 | |
4348 int v12; // esi@10 | |
4349 int v13; // eax@13 | |
4350 unsigned __int16 *v14; // eax@13 | |
4351 unsigned int v15; // eax@14 | |
4352 unsigned __int16 *v16; // ebx@14 | |
4353 int v17; // eax@15 | |
4354 int v18; // ebx@15 | |
4355 int v19; // esi@15 | |
4356 int v20; // ecx@15 | |
4357 int v21; // eax@15 | |
4358 stru193_math *v22; // ebx@15 | |
4359 int v23; // eax@15 | |
4360 char *v24; // esi@16 | |
4361 int v25; // eax@18 | |
4362 int v26; // eax@18 | |
4363 int v27; // eax@20 | |
4364 signed int v28; // esi@20 | |
4365 signed int v29; // edx@20 | |
4366 signed int v30; // esi@20 | |
4367 signed int v31; // edi@20 | |
4368 int v32; // esi@20 | |
4369 int v33; // eax@26 | |
4370 int *v34; // esi@27 | |
4371 unsigned __int16 *v35; // edi@27 | |
4372 unsigned int v36; // edx@27 | |
4373 int v37; // ebx@27 | |
4374 char v38; // cl@27 | |
4375 char v39; // ch@27 | |
4376 int v40; // ebx@29 | |
4377 int v41; // edx@29 | |
4378 unsigned int v42; // ebx@30 | |
4379 int v43; // edx@30 | |
4380 int v44; // eax@33 | |
4381 int *v45; // esi@34 | |
4382 unsigned __int16 *v46; // edi@34 | |
4383 unsigned int v47; // edx@34 | |
4384 int v48; // ebx@34 | |
4385 char v49; // cl@34 | |
4386 char v50; // ch@34 | |
4387 int v51; // ebx@36 | |
4388 int v52; // edx@36 | |
4389 unsigned __int16 v53; // bx@37 | |
4390 int v54; // edx@37 | |
4391 int v55; // eax@40 | |
4392 int v56; // eax@41 | |
4393 int *v57; // esi@42 | |
4394 unsigned __int16 *v58; // edi@42 | |
4395 unsigned int v59; // edx@42 | |
4396 int v60; // ebx@42 | |
4397 char v61; // cl@42 | |
4398 char v62; // ch@42 | |
4399 unsigned int v63; // ebx@44 | |
4400 int v64; // edx@44 | |
4401 unsigned int v65; // ebx@44 | |
4402 int v66; // edx@44 | |
4403 unsigned int v67; // ebx@45 | |
4404 int v68; // edx@45 | |
4405 int v69; // ebx@45 | |
4406 int v70; // edx@45 | |
4407 int v71; // eax@48 | |
4408 int *v72; // esi@49 | |
4409 unsigned __int16 *v73; // edi@49 | |
4410 unsigned int v74; // edx@49 | |
4411 int v75; // ebx@49 | |
4412 char v76; // cl@49 | |
4413 char v77; // ch@49 | |
4414 unsigned int v78; // ebx@51 | |
4415 int v79; // edx@51 | |
4416 unsigned int v80; // ebx@51 | |
4417 int v81; // edx@51 | |
4418 unsigned int v82; // ebx@52 | |
4419 int v83; // edx@52 | |
4420 int v84; // ebx@52 | |
4421 int v85; // edx@52 | |
4422 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4423 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4424 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4425 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4426 int v90; // [sp+1Ch] [bp-88h]@20 | |
4427 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4428 int v92; // [sp+24h] [bp-80h]@7 | |
4429 int i; // [sp+28h] [bp-7Ch]@7 | |
4430 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4431 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4432 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4433 int v97; // [sp+38h] [bp-6Ch]@15 | |
4434 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4435 int v99; // [sp+40h] [bp-64h]@9 | |
4436 int v100; // [sp+44h] [bp-60h]@24 | |
4437 int v101; // [sp+48h] [bp-5Ch]@10 | |
4438 int v102; // [sp+4Ch] [bp-58h]@20 | |
4439 int v103; // [sp+50h] [bp-54h]@20 | |
4440 int v104; // [sp+54h] [bp-50h]@9 | |
4441 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4442 int v106; // [sp+5Ch] [bp-48h]@24 | |
4443 int v107; // [sp+60h] [bp-44h]@20 | |
4444 int v108; // [sp+64h] [bp-40h]@20 | |
4445 int v109; // [sp+68h] [bp-3Ch]@20 | |
4446 int v110; // [sp+6Ch] [bp-38h]@15 | |
4447 int v111; // [sp+70h] [bp-34h]@20 | |
4448 int a1; // [sp+74h] [bp-30h]@12 | |
4449 int a2; // [sp+78h] [bp-2Ch]@9 | |
4450 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4451 int v115; // [sp+80h] [bp-24h]@18 | |
4452 int v116; // [sp+84h] [bp-20h]@7 | |
4453 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4454 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4455 int *v119; // [sp+90h] [bp-14h]@13 | |
4456 int v120; // [sp+94h] [bp-10h]@15 | |
4457 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4458 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4459 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4460 | |
4461 result = pRenderer->uTargetSurfacePitch; | |
711 | 4462 v2 = sFaceID; |
0 | 4463 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4464 if ( sFaceID >= 0 ) |
4465 { | |
4466 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4467 { | |
4468 v3 = &pIndoor->pFaces[sFaceID]; | |
4469 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4470 if ( !pRenderer->pRenderD3D ) |
4471 { | |
711 | 4472 result = sub_423B5D(sFaceID); |
0 | 4473 if ( result ) |
4474 { | |
4475 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4476 if ( result ) | |
4477 { | |
4478 result = (int)v3->GetTexture(); | |
4479 v4 = (Texture *)result; | |
4480 v96 = (Texture *)result; | |
4481 if ( result ) | |
4482 { | |
4483 v5 = *(short *)(result + 38); | |
4484 LOBYTE(v3->uAttributes) |= 0x80u; | |
4485 v92 = v5; | |
4486 sub_4AE5F1(v2); | |
4487 ++pBLVRenderParams->field_84; | |
4488 v6 = stru_F8AD28.pDeltaUV[0]; | |
4489 v116 = stru_F8AD28.pDeltaUV[1]; | |
4490 v7 = 0; | |
4491 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4492 { | |
4493 v8 = v116; | |
4494 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4495 v9 = 4 * v7 + 16297672; | |
4496 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4497 } | |
4498 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4499 result = stru_F8A590._viewport_space_y; | |
4500 a2 = stru_F8A590._viewport_space_y; | |
4501 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4502 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4503 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4504 v87 = v4->pLevelOfDetail1; |
4505 v88 = v4->pLevelOfDetail2; | |
4506 v89 = v4->pLevelOfDetail3; | |
4507 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4508 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4509 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4510 { | |
4511 v12 = 2 * stru_F8A590._viewport_space_y; | |
4512 v101 = 2 * stru_F8A590._viewport_space_y; | |
4513 while ( 1 ) | |
4514 { | |
4515 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4516 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4517 if ( LOBYTE(viewparams->field_20) ) | |
4518 { | |
4519 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4520 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4521 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4522 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4523 - pBLVRenderParams->uViewportX]; | |
4524 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4525 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4526 - pBLVRenderParams->uViewportX]; | |
4527 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4528 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4529 - pBLVRenderParams->uViewportX]; | |
4530 v123 = (unsigned int)v16; | |
4531 } | |
4532 else | |
4533 { | |
4534 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4535 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4536 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4537 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4538 } | |
4539 v117 = (unsigned int)v14; | |
4540 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4541 v18 = stru_F81018.field_0.field_10; | |
4542 LOWORD(v17) = 0; | |
4543 v97 = stru_F8AD28.field_0 | v17; | |
4544 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4545 v19 = stru_F81018.field_0.field_4 >> i; | |
4546 v20 = 11 - v18; | |
4547 v116 = stru_F81018.field_0.field_8 >> i; | |
4548 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4549 v22 = stru_5C6E00; | |
4550 v122 = (unsigned __int16 *)v20; | |
323 | 4551 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4552 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4553 v120 = v116 + 4 * v23; |
4554 if ( v123 < v117 ) | |
4555 { | |
4556 v24 = (char *)&stru_F81018.field_34.field_8; | |
4557 v114 = &stru_F81018.field_34.field_8; | |
4558 a1 += 16; | |
4559 while ( 1 ) | |
4560 { | |
4561 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4562 v25 = *((int *)v24 - 2); | |
4563 LOWORD(v25) = 0; | |
4564 v115 = v97; | |
4565 v26 = stru_F8AD28.field_0 | v25; | |
4566 if ( v97 <= (unsigned int)v26 ) | |
4567 v115 = v26; | |
4568 v97 = v26; | |
4569 v27 = *((int *)v24 - 11); | |
4570 v28 = *((int *)v24 - 1); | |
4571 v105 = (&v86)[4 * v27]; | |
4572 v111 = v27 + 16; | |
4573 v29 = v4->uWidthMinus1; | |
4574 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4575 v107 = v29 >> v27; | |
4576 v30 = v28 >> i; | |
4577 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4578 v31 = *v114 >> i; | |
4579 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4580 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4581 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4582 v108 = (signed int)(v116 - v121) >> 4; |
4583 v103 = (v90 - v120) >> 4; | |
4584 v32 = v123 + 32; | |
4585 if ( LOBYTE(viewparams->field_20) ) | |
4586 v32 = v123 + 64; | |
4587 if ( v32 > v117 ) | |
4588 v32 = v117; | |
4589 v118 = v32; | |
4590 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4591 v106 = (signed int)(v32 - v123) >> 1; | |
4592 if ( v110 >> 16 == v100 >> 16 ) | |
4593 { | |
4594 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4595 if ( LOBYTE(viewparams->field_20) ) | |
4596 { | |
4597 v44 = v123; | |
4598 if ( v123 < v118 ) | |
4599 { | |
4600 v45 = v119; | |
4601 v46 = v122; | |
4602 v47 = v121; | |
4603 v48 = v120; | |
4604 v49 = v111; | |
4605 v50 = v109; | |
4606 if ( v106 & 2 ) | |
4607 { | |
4608 *v119 = v115; | |
4609 v45 -= 2; | |
4610 v44 = v123 + 4; | |
4611 goto LABEL_37; | |
4612 } | |
4613 do | |
4614 { | |
4615 v44 += 8; | |
4616 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4617 v52 = v115; | |
4618 LOWORD(v51) = v46[v51]; | |
4619 *v45 = v115; | |
4620 v45[1] = v52; | |
4621 v45[640] = v52; | |
4622 v45[641] = v52; | |
4623 *(short *)(v44 - 8) = v51; | |
4624 *(short *)(v44 - 6) = v51; | |
4625 *(short *)(v44 + 1272) = v51; | |
4626 *(short *)(v44 + 1274) = v51; | |
4627 v45[2] = v52; | |
4628 v45[3] = v52; | |
4629 v45[642] = v52; | |
4630 v45[643] = v52; | |
4631 v121 += v108; | |
4632 v120 += v103; | |
4633 v47 = v121; | |
4634 v48 = v120; | |
4635 LABEL_37: | |
4636 v45 += 4; | |
4637 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4638 v54 = v108; | |
4639 *(short *)(v44 - 4) = v53; | |
4640 *(short *)(v44 - 2) = v53; | |
4641 *(short *)(v44 + 1276) = v53; | |
4642 *(short *)(v44 + 1278) = v53; | |
4643 v121 += v54; | |
4644 v120 += v103; | |
4645 v47 = v121; | |
4646 v48 = v120; | |
4647 } | |
4648 while ( v44 < v118 ); | |
4649 v123 = v44; | |
4650 v119 = v45; | |
4651 } | |
4652 } | |
4653 else | |
4654 { | |
4655 v33 = v123; | |
4656 if ( v123 < v118 ) | |
4657 { | |
4658 v34 = v119; | |
4659 v35 = v122; | |
4660 v36 = v121; | |
4661 v37 = v120; | |
4662 v38 = v111; | |
4663 v39 = v109; | |
4664 if ( v106 & 1 ) | |
4665 { | |
4666 *v119 = v115; | |
4667 --v34; | |
4668 v33 = v123 + 2; | |
4669 goto LABEL_30; | |
4670 } | |
4671 do | |
4672 { | |
4673 v33 += 4; | |
4674 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4675 v41 = v115; | |
4676 LOWORD(v40) = v35[v40]; | |
4677 *v34 = v115; | |
4678 *(short *)(v33 - 4) = v40; | |
4679 v34[1] = v41; | |
4680 v121 += v108; | |
4681 v120 += v103; | |
4682 v36 = v121; | |
4683 v37 = v120; | |
4684 LABEL_30: | |
4685 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4686 v34 += 2; | |
4687 v43 = v108; | |
4688 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4689 v121 += v43; | |
4690 v120 += v103; | |
4691 v36 = v121; | |
4692 v37 = v120; | |
4693 } | |
4694 while ( v33 < v118 ); | |
4695 v123 = v33; | |
4696 v119 = v34; | |
4697 } | |
4698 } | |
4699 } | |
4700 else | |
4701 { | |
4702 v55 = v110 - ((v100 - v110) >> 4); | |
4703 v110 = (v100 - v110) >> 4; | |
4704 v122 = (unsigned __int16 *)v55; | |
4705 if ( LOBYTE(viewparams->field_20) ) | |
4706 { | |
4707 v71 = v123; | |
4708 if ( v123 < v118 ) | |
4709 { | |
4710 v72 = v119; | |
4711 v73 = v94; | |
4712 v74 = v121; | |
4713 v75 = v120; | |
4714 v76 = v111; | |
4715 v77 = v109; | |
4716 if ( v106 & 2 ) | |
4717 { | |
4718 *v119 = v115; | |
4719 v72 += 2; | |
4720 v71 = v123 + 4; | |
4721 goto LABEL_52; | |
4722 } | |
4723 do | |
4724 { | |
4725 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4726 v79 = (int)((char *)v122 + v110); | |
4727 v71 += 8; | |
4728 v122 = (unsigned __int16 *)v79; | |
4729 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4730 v81 = v115; | |
4731 LOWORD(v80) = v73[v80]; | |
4732 *v72 = v115; | |
4733 v72[1] = v81; | |
4734 v72[640] = v81; | |
4735 v72[641] = v81; | |
4736 *(short *)(v71 - 8) = v80; | |
4737 *(short *)(v71 - 6) = v80; | |
4738 *(short *)(v71 + 1272) = v80; | |
4739 *(short *)(v71 + 1274) = v80; | |
4740 v72[2] = v81; | |
4741 v72[3] = v81; | |
4742 v72[642] = v81; | |
4743 v72[643] = v81; | |
4744 v121 += v108; | |
4745 v120 += v103; | |
4746 v74 = v121; | |
4747 v75 = v120; | |
4748 v72 += 4; | |
4749 LABEL_52: | |
4750 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4751 v83 = (int)((char *)v122 + v110); | |
4752 v84 = v105[v82]; | |
4753 v122 = (unsigned __int16 *)v83; | |
4754 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4755 v85 = v108; | |
4756 *(short *)(v71 - 4) = v84; | |
4757 *(short *)(v71 - 2) = v84; | |
4758 *(short *)(v71 + 1276) = v84; | |
4759 *(short *)(v71 + 1278) = v84; | |
4760 v121 += v85; | |
4761 v120 += v103; | |
4762 v74 = v121; | |
4763 v75 = v120; | |
4764 } | |
4765 while ( v71 < v118 ); | |
4766 v123 = v71; | |
4767 v119 = v72; | |
4768 } | |
4769 } | |
4770 else | |
4771 { | |
4772 v56 = v123; | |
4773 if ( v123 < v118 ) | |
4774 { | |
4775 v57 = v119; | |
4776 v58 = v94; | |
4777 v59 = v121; | |
4778 v60 = v120; | |
4779 v61 = v111; | |
4780 v62 = v109; | |
4781 if ( v106 & 1 ) | |
4782 { | |
4783 *v119 = v115; | |
4784 ++v57; | |
4785 v56 = v123 + 2; | |
4786 goto LABEL_45; | |
4787 } | |
4788 do | |
4789 { | |
4790 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4791 v64 = (int)((char *)v122 + v110); | |
4792 v56 += 4; | |
4793 v122 = (unsigned __int16 *)v64; | |
4794 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4795 v66 = v115; | |
4796 LOWORD(v65) = v58[v65]; | |
4797 *v57 = v115; | |
4798 *(short *)(v56 - 4) = v65; | |
4799 v57[1] = v66; | |
4800 v121 += v108; | |
4801 v120 += v103; | |
4802 v59 = v121; | |
4803 v60 = v120; | |
4804 v57 += 2; | |
4805 LABEL_45: | |
4806 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4807 v68 = (int)((char *)v122 + v110); | |
4808 v69 = v105[v67]; | |
4809 v122 = (unsigned __int16 *)v68; | |
4810 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4811 v70 = v108; | |
4812 *(short *)(v56 - 2) = v69; | |
4813 v121 += v70; | |
4814 v120 += v103; | |
4815 v59 = v121; | |
4816 v60 = v120; | |
4817 } | |
4818 while ( v56 < v118 ); | |
4819 v123 = v56; | |
4820 v119 = v57; | |
4821 } | |
4822 } | |
4823 } | |
4824 v114 += 13; | |
4825 v110 = v100; | |
4826 a1 += 16; | |
4827 v4 = v96; | |
4828 v121 = v116; | |
4829 v120 = v90; | |
4830 if ( v123 >= v117 ) | |
4831 break; | |
4832 v24 = (char *)v114; | |
4833 v22 = stru_5C6E00; | |
4834 } | |
4835 } | |
4836 ++a2; | |
4837 v98 += v95; | |
4838 result = a2; | |
4839 v101 += 2; | |
4840 v99 += 640; | |
4841 if ( a2 > stru_F8A590._viewport_space_w ) | |
4842 break; | |
4843 v12 = v101; | |
4844 result = a2; | |
4845 v11 = v98; | |
4846 } | |
4847 } | |
4848 } | |
4849 } | |
4850 } | |
4851 } | |
4852 } | |
4853 } | |
4854 return result; | |
4855 } | |
4856 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4857 | |
4858 //----- (004ADD1D) -------------------------------------------------------- | |
4859 void __fastcall sub_4ADD1D(int uFaceID) | |
4860 { | |
4861 int v1; // edi@1 | |
4862 BLVFace *v2; // esi@3 | |
4863 signed int v3; // ebx@4 | |
4864 Texture *v4; // edi@9 | |
4865 signed int v5; // eax@9 | |
4866 char *v6; // edi@12 | |
4867 signed int v7; // eax@15 | |
4868 unsigned int v8; // eax@16 | |
4869 __int16 v9; // cx@19 | |
4870 unsigned __int8 *v10; // eax@19 | |
4871 unsigned __int16 *v11; // eax@19 | |
4872 int v12; // edi@19 | |
4873 int v13; // ebx@20 | |
4874 stru352 *v14; // esi@20 | |
4875 DWORD v15; // eax@22 | |
4876 signed int v16; // ecx@22 | |
4877 signed int v17; // ST68_4@22 | |
4878 int v18; // eax@22 | |
4879 int v19; // ecx@22 | |
4880 unsigned int v20; // esi@23 | |
4881 int v21; // edi@23 | |
4882 int v22; // eax@23 | |
4883 int *v23; // ebx@24 | |
4884 int v24; // edx@24 | |
4885 int v25; // ebx@25 | |
4886 unsigned __int16 v26; // cx@25 | |
4887 int v27; // edx@26 | |
4888 unsigned __int16 v28; // cx@26 | |
4889 unsigned __int8 v29; // sf@27 | |
4890 unsigned __int8 v30; // of@27 | |
4891 unsigned int v31; // esi@29 | |
4892 int v32; // edi@29 | |
4893 unsigned __int16 *v33; // eax@29 | |
4894 int *v34; // ebx@30 | |
4895 int v35; // edx@30 | |
4896 int v36; // ebx@31 | |
4897 unsigned __int16 v37; // cx@31 | |
4898 int v38; // edx@32 | |
4899 unsigned __int16 v39; // cx@32 | |
4900 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
4901 int v41; // [sp-Ch] [bp-68h]@15 | |
4902 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
4903 signed int v43; // [sp+14h] [bp-48h]@12 | |
4904 signed int v44; // [sp+14h] [bp-48h]@22 | |
4905 int v45; // [sp+1Ch] [bp-40h]@22 | |
4906 int v46; // [sp+20h] [bp-3Ch]@22 | |
4907 int v47; // [sp+24h] [bp-38h]@19 | |
4908 char v48; // [sp+28h] [bp-34h]@19 | |
4909 int v49; // [sp+2Ch] [bp-30h]@19 | |
4910 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
4911 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
4912 int v52; // [sp+38h] [bp-24h]@22 | |
4913 int v53; // [sp+3Ch] [bp-20h]@22 | |
4914 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
4915 int v55; // [sp+40h] [bp-1Ch]@20 | |
4916 int v56; // [sp+44h] [bp-18h]@20 | |
4917 stru352 *i; // [sp+48h] [bp-14h]@20 | |
4918 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
4919 int v59; // [sp+50h] [bp-Ch]@4 | |
4920 int v60; // [sp+50h] [bp-Ch]@19 | |
4921 int v61; // [sp+54h] [bp-8h]@22 | |
4922 int *v62; // [sp+58h] [bp-4h]@23 | |
4923 int *v63; // [sp+58h] [bp-4h]@29 | |
4924 | |
4925 v1 = uFaceID; | |
4926 v42 = pRenderer->uTargetSurfacePitch; | |
4927 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
4928 { | |
4929 v2 = &pIndoor->pFaces[uFaceID]; | |
4930 if ( pRenderer->pRenderD3D ) | |
4931 { | |
4932 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
4933 v59 = v3; | |
4934 } | |
4935 else | |
4936 { | |
4937 v59 = sub_423B5D(uFaceID); | |
4938 v3 = v59; | |
4939 } | |
4940 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
4941 { | |
4942 v4 = v2->GetTexture(); | |
4943 v5 = 0; | |
4944 if ( v4 ) | |
4945 { | |
4946 if ( pRenderer->pRenderD3D ) | |
4947 { | |
4948 if ( v3 > 0 ) | |
4949 { | |
4950 v54 = v3; | |
4951 v43 = v3; | |
4952 v6 = (char *)&array_507D30[0].v; | |
4953 do | |
4954 { | |
4955 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
4956 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
4957 v6 += 48; | |
4958 --v54; | |
4959 } | |
4960 while ( v54 ); | |
4961 v3 = v59; | |
4962 v5 = v43; | |
4963 } | |
4964 v7 = v5; | |
4965 v41 = stru_F8AD28.field_0; | |
4966 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
4967 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
4968 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
4969 { | |
4970 v40 = v2->GetTexture(); | |
4971 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
4972 } | |
4973 else | |
4974 { | |
4975 v40 = v2->GetTexture(); | |
4976 v8 = v2->uBitmapID; | |
4977 } | |
4978 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
4979 } | |
4980 else | |
4981 { | |
4982 v49 = v4->uWidthMinus1; | |
4983 v47 = v4->uHeightMinus1 << 16; | |
4984 v9 = 16 - v4->uWidthLn2; | |
710 | 4985 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4986 LOBYTE(v2->uAttributes) |= 0x80u; |
4987 v48 = v9; | |
4988 v50 = v10; | |
4989 sub_4AF412(); | |
4990 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
4991 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
4992 v12 = stru_F8A590._viewport_space_y; | |
4993 v51 = v11; | |
4994 v60 = stru_F8A590._viewport_space_y; | |
4995 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4996 { | |
4997 v13 = 2 * stru_F8A590._viewport_space_y; | |
4998 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
4999 v55 = 2 * stru_F8A590._viewport_space_y; | |
5000 v56 = 640 * stru_F8A590._viewport_space_y; | |
5001 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5002 { | |
5003 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5004 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5005 v15 = GetTickCount(); | |
5006 v16 = v14->field_0; | |
5007 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5008 v45 = v14->field_4 >> 3; | |
5009 v44 = v16 >> 3; | |
5010 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5011 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5012 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5013 v18 = v14->field_28; | |
5014 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5015 LOWORD(v18) = 0; | |
5016 v46 = stru_F8AD28.field_0 | v18; | |
5017 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5018 if ( LOBYTE(viewparams->field_20) ) | |
5019 { | |
5020 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5021 - pBLVRenderParams->uViewportX]; | |
5022 v31 = v44; | |
5023 v32 = v45; | |
5024 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5025 + 2 * v19 | |
5026 - pBLVRenderParams->uViewportX]; | |
5027 if ( v61 & 1 ) | |
5028 { | |
5029 --v61; | |
5030 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5031 + 2 * v19 | |
5032 - pBLVRenderParams->uViewportX | |
5033 - 2]; | |
5034 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5035 - pBLVRenderParams->uViewportX]; | |
5036 v35 = v46; | |
5037 v63 += 2; | |
5038 goto LABEL_32; | |
5039 } | |
5040 while ( 1 ) | |
5041 { | |
5042 v30 = __OFSUB__(v61, 2); | |
5043 v29 = v61 - 2 < 0; | |
5044 v61 -= 2; | |
5045 if ( v29 ^ v30 ) | |
5046 break; | |
5047 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5048 v31 += v52; | |
5049 v37 = v51[v36]; | |
5050 v32 += v53; | |
5051 v34 = v63; | |
5052 v35 = v46; | |
5053 *v33 = v37; | |
5054 v33[1] = v37; | |
5055 v33[640] = v37; | |
5056 v33[641] = v37; | |
5057 v63 += 4; | |
5058 v34[2] = v46; | |
5059 v34[3] = v46; | |
5060 v34[642] = v46; | |
5061 v34[643] = v46; | |
5062 LABEL_32: | |
5063 *v34 = v35; | |
5064 v34[1] = v35; | |
5065 v34[640] = v35; | |
5066 v34[641] = v35; | |
5067 v38 = v49 & (v31 >> 16); | |
5068 v33 += 4; | |
5069 v31 += v52; | |
5070 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5071 v32 += v53; | |
5072 *(v33 - 2) = v39; | |
5073 *(v33 - 1) = v39; | |
5074 v33[638] = v39; | |
5075 v33[639] = v39; | |
5076 } | |
5077 } | |
5078 else | |
5079 { | |
5080 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5081 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5082 v20 = v44; | |
5083 v21 = v45; | |
5084 v22 = (int)v58; | |
5085 if ( v61 & 1 ) | |
5086 { | |
5087 --v61; | |
5088 v22 = (int)(v58 - 1); | |
5089 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5090 v24 = v46; | |
5091 ++v62; | |
5092 goto LABEL_26; | |
5093 } | |
5094 while ( 1 ) | |
5095 { | |
5096 v30 = __OFSUB__(v61, 2); | |
5097 v29 = v61 - 2 < 0; | |
5098 v61 -= 2; | |
5099 if ( v29 ^ v30 ) | |
5100 break; | |
5101 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5102 v20 += v52; | |
5103 v26 = v51[v25]; | |
5104 v21 += v53; | |
5105 v23 = v62; | |
5106 v24 = v46; | |
5107 *(short *)v22 = v26; | |
5108 v62 += 2; | |
5109 v23[1] = v46; | |
5110 LABEL_26: | |
5111 *v23 = v24; | |
5112 v27 = v49 & (v20 >> 16); | |
5113 v22 += 4; | |
5114 v20 += v52; | |
5115 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5116 v21 += v53; | |
5117 *(short *)(v22 - 2) = v28; | |
5118 } | |
5119 } | |
5120 ++v60; | |
5121 ++i; | |
5122 v56 += 640; | |
5123 v55 += 2; | |
5124 if ( v60 > stru_F8A590._viewport_space_w ) | |
5125 break; | |
5126 v13 = v55; | |
5127 v12 = v60; | |
5128 } | |
5129 } | |
5130 } | |
5131 } | |
5132 } | |
5133 } | |
5134 } | |
5135 | |
5136 //----- (004AE1E7) -------------------------------------------------------- | |
5137 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5138 { | |
5139 int v3; // ebx@1 | |
5140 int v4; // edi@1 | |
5141 int v5; // esi@1 | |
5142 signed __int64 v6; // qtt@3 | |
5143 int v7; // esi@3 | |
5144 int v8; // eax@5 | |
5145 int result; // eax@5 | |
5146 int v10; // edx@5 | |
5147 int v11; // [sp+Ch] [bp-8h]@1 | |
5148 int v12; // [sp+1Ch] [bp+8h]@2 | |
5149 | |
5150 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5151 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5152 v11 = a1; | |
5153 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5154 + stru_F8AD28.field_7C | |
5155 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5156 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5157 { | |
5158 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5159 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5160 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5161 } | |
5162 else | |
5163 { | |
5164 v7 = 1073741824; | |
5165 } | |
5166 v8 = stru_F8AD28.vec_9C.z; | |
5167 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5168 + stru_F8AD28.vec_8C.x | |
5169 + v4 * stru_F8AD28.vec_8C.y) | |
5170 * (signed __int64)v7) >> 16) | |
5171 + stru_F8AD28.field_98; | |
5172 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5173 v10 = result + stru_F8AD28.field_A8; | |
5174 stru_F83B80[v11].field_28 = v7; | |
5175 stru_F83B80[v11].field_4 = v10; | |
5176 return result; | |
5177 } | |
5178 | |
5179 //----- (004AE313) -------------------------------------------------------- | |
5180 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5181 { | |
5182 int _dy; // ebx@1 | |
5183 int _dx; // edi@1 | |
5184 int v5; // ecx@1 | |
5185 int v6; // esi@1 | |
5186 int v7; // ST18_4@2 | |
5187 signed __int64 v8; // qtt@3 | |
5188 unsigned int v9; // ecx@3 | |
5189 int result; // eax@8 | |
5190 int v11; // [sp+Ch] [bp-8h]@1 | |
5191 | |
5192 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5193 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5194 ++pBLVRenderParams->field_88; | |
5195 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5196 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5197 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5198 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5199 { | |
5200 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5201 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5202 v9 = v8 / v11; | |
5203 } | |
5204 else | |
5205 { | |
5206 v9 = 0x40000000u; | |
5207 } | |
5208 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5209 p->field_0 = v9; | |
5210 else | |
5211 p->field_0 = stru_F8AD28.field_34; | |
5212 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5213 * (signed __int64)(signed int)v9) >> 16) | |
5214 + stru_F8AD28.field_98 | |
5215 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5216 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5217 * (signed __int64)(signed int)v9) >> 16) | |
5218 + stru_F8AD28.field_A8 | |
5219 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5220 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5221 if ( result < 369620 || bUseLoResSprites ) | |
5222 { | |
5223 if ( result < 184810 ) | |
5224 p->field_10 = result > 92405; | |
5225 else | |
5226 p->field_10 = 2; | |
5227 } | |
5228 else | |
5229 { | |
5230 p->field_10 = 3; | |
5231 } | |
5232 return result; | |
5233 } | |
5234 | |
5235 //----- (004AE491) -------------------------------------------------------- | |
5236 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5237 { | |
5238 signed int v2; // eax@1 | |
5239 signed int v3; // edi@1 | |
5240 int v4; // ecx@1 | |
5241 int v5; // esi@2 | |
5242 int v6; // eax@2 | |
5243 int v7; // ebx@2 | |
5244 unsigned int v8; // ecx@2 | |
5245 int v9; // edx@5 | |
5246 int v10; // edx@7 | |
5247 unsigned int v11; // eax@8 | |
5248 int v13; // [sp+4h] [bp-18h]@2 | |
5249 int v14; // [sp+8h] [bp-14h]@2 | |
5250 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5251 int v16; // [sp+14h] [bp-8h]@1 | |
5252 int v17; // [sp+18h] [bp-4h]@1 | |
5253 | |
5254 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5255 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5256 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5257 v4 = 0; | |
5258 v15 = v2; | |
5259 v16 = 0; | |
5260 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5261 { | |
5262 do | |
5263 { | |
5264 v5 = v16; | |
5265 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5266 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5267 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5268 v7 = v13; | |
5269 v8 = v14; | |
5270 if ( v6 < v13 ) | |
5271 { | |
5272 v6 = v13; | |
5273 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5274 } | |
5275 if ( v6 < v14 ) | |
5276 { | |
5277 v9 = v6; | |
5278 v6 = v14; | |
5279 v8 = v9; | |
5280 } | |
5281 if ( v7 < (signed int)v8 ) | |
5282 { | |
5283 v10 = v8; | |
5284 v8 = v7; | |
5285 v7 = v10; | |
5286 } | |
5287 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5288 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5289 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5290 ++v16; | |
5291 v2 = v15; | |
5292 } | |
5293 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5294 v4 = 0; | |
5295 } | |
5296 if ( stru_F8AD28.field_3E4 != v4 ) | |
5297 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5298 if ( v17 >= v4 ) | |
5299 { | |
5300 if ( v17 > 2031616 ) | |
5301 v17 = 2031616; | |
5302 } | |
5303 else | |
5304 { | |
5305 v17 = v4; | |
5306 } | |
5307 ++pBLVRenderParams->field_8C; | |
5308 return v17; | |
5309 } | |
5310 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5311 | |
5312 //----- (004AE5F1) -------------------------------------------------------- | |
5313 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5314 { | |
5315 BLVFace *v1; // esi@1 | |
5316 BLVFaceExtra *v2; // ebx@1 | |
5317 int v3; // eax@1 | |
5318 int v4; // edi@1 | |
5319 Texture *v5; // edi@1 | |
5320 int v6; // eax@1 | |
5321 unsigned int v7; // eax@1 | |
5322 unsigned int v8; // ecx@1 | |
5323 unsigned int v9; // eax@1 | |
5324 unsigned int v10; // ecx@5 | |
5325 int v11; // edi@10 | |
5326 int v12; // ecx@10 | |
5327 int v13; // eax@10 | |
5328 int v14; // edx@10 | |
5329 int v15; // ebx@12 | |
5330 double v16; // st7@16 | |
5331 int v17; // eax@16 | |
5332 char *v18; // ebx@17 | |
5333 int v19; // ecx@19 | |
5334 int v20; // eax@19 | |
5335 int v21; // edx@21 | |
5336 int v22; // eax@23 | |
5337 int v23; // ST04_4@26 | |
5338 int v24; // edi@26 | |
5339 double v25; // st6@26 | |
5340 int v26; // eax@26 | |
5341 double v27; // st6@26 | |
5342 int v28; // ecx@26 | |
5343 char v29; // al@26 | |
5344 int v30; // edx@28 | |
5345 int v31; // ecx@28 | |
5346 BLVLightMM7 *v32; // ecx@32 | |
5347 int v33; // edi@33 | |
5348 int v34; // edx@33 | |
5349 int v35; // eax@33 | |
5350 int v36; // edi@35 | |
5351 int v37; // edx@37 | |
5352 int v38; // ebx@39 | |
5353 int v39; // edi@42 | |
5354 int v40; // eax@42 | |
5355 char *v41; // ebx@45 | |
5356 signed int v42; // ecx@47 | |
5357 int v43; // edi@47 | |
5358 int v44; // eax@49 | |
5359 int v45; // edx@51 | |
5360 int v46; // eax@53 | |
5361 int v47; // ST04_4@55 | |
5362 int v48; // edi@55 | |
5363 double v49; // st6@55 | |
5364 int v50; // eax@55 | |
5365 double v51; // st6@55 | |
5366 int v52; // eax@55 | |
5367 int v53; // ecx@57 | |
5368 int v54; // ecx@58 | |
5369 int v55; // ecx@59 | |
5370 int v56; // edx@62 | |
5371 int v57; // ecx@62 | |
5372 int v58; // eax@63 | |
5373 int v59; // edx@64 | |
5374 int v60; // ecx@67 | |
5375 int v61; // edx@67 | |
5376 int v62; // eax@68 | |
5377 int v63; // edx@69 | |
5378 signed int v64; // ecx@72 | |
5379 double v65; // st7@75 | |
5380 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5381 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5382 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5383 int v69; // [sp+28h] [bp-18h]@10 | |
5384 int v70; // [sp+2Ch] [bp-14h]@10 | |
5385 int X; // [sp+30h] [bp-10h]@10 | |
5386 int v72; // [sp+34h] [bp-Ch]@10 | |
5387 int v73; // [sp+38h] [bp-8h]@10 | |
5388 int v74; // [sp+3Ch] [bp-4h]@10 | |
5389 | |
5390 v1 = &pIndoor->pFaces[uFaceID]; | |
5391 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5392 v3 = v1->uBitmapID; | |
5393 v4 = v1->uBitmapID; | |
5394 v68 = v2; | |
5395 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5396 v6 = 8 * uFaceID; | |
862 | 5397 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5398 stru_F8AD28.field_0 = v6; |
5399 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5400 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5401 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5402 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5403 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5404 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5405 v7 = GetTickCount(); | |
5406 v8 = v1->uAttributes; | |
5407 v9 = v7 >> 3; | |
5408 if ( v8 & 4 ) | |
5409 { | |
5410 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5411 } | |
5412 else | |
5413 { | |
5414 if ( v8 & 0x20 ) | |
5415 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5416 } | |
5417 v10 = v1->uAttributes; | |
5418 if ( BYTE1(v10) & 8 ) | |
5419 { | |
5420 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5421 } | |
5422 else | |
5423 { | |
5424 if ( v10 & 0x40 ) | |
5425 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5426 } | |
5427 v1->_get_normals(&v67, &v66); | |
5428 stru_F8AD28.vec_14.x = v67.x; | |
5429 stru_F8AD28.vec_14.y = v67.y; | |
5430 stru_F8AD28.vec_14.z = v67.z; | |
5431 stru_F8AD28.vec_20.x = v66.x; | |
5432 stru_F8AD28.vec_20.y = v66.y; | |
5433 stru_F8AD28.vec_20.z = v66.z; | |
5434 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5435 if ( pBLVRenderParams->sPartyRotX ) | |
5436 { | |
5437 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5438 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5439 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5440 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5441 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5442 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5443 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5444 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5445 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5446 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5447 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5448 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5449 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5450 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5451 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5452 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5453 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5454 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5455 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5456 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5457 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5458 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5459 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5460 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5461 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5462 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5463 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5464 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5465 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5466 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5467 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5468 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5469 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5470 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5471 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5472 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5473 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5474 v13 = pBLVRenderParams->vPartyPos.y; | |
5475 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5476 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5477 v14 = pBLVRenderParams->vPartyPos.x; | |
5478 } | |
5479 else | |
5480 { | |
5481 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5482 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5483 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5484 - v70; | |
5485 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5486 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5487 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5488 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5489 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5490 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5491 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5492 - v70; | |
5493 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5494 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5495 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5496 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5497 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5498 - v70; | |
5499 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5500 v14 = pBLVRenderParams->vPartyPos.x; | |
5501 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5502 v13 = pBLVRenderParams->vPartyPos.y; | |
5503 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5504 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5505 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5506 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5507 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5508 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5509 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5510 } | |
5511 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5512 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5513 + stru_F8AD28.plane_4.dist | |
5514 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5515 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5516 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5517 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5518 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5519 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5520 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5521 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5522 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5523 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5524 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5525 v15 = v70; | |
5526 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5527 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5528 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5529 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5530 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5531 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5532 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5533 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5534 stru_F8AD28.field_38 = 0; | |
5535 stru_F8AD28.field_A8 = -(X | |
5536 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5537 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5538 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5539 { | |
5540 stru_F8AD28.field_3E4 = 1; | |
5541 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5542 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5543 stru_F8AD28.field_3F0 = v68->field_1E; | |
5544 stru_F8AD28.field_3F4 = v68->field_20; | |
5545 } | |
5546 else | |
5547 { | |
5548 stru_F8AD28.field_3E4 = 0; | |
5549 } | |
5550 v16 = 0.0039215689; | |
5551 v17 = 116 * v1->uSectorID; | |
5552 v69 = v17; | |
5553 v74 = 0; | |
5554 v73 = 0; | |
5555 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5556 v70 = pMobileLightsStack->uNumLightsActive; | |
5557 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5558 { | |
5559 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5560 do | |
5561 { | |
5562 if ( v74 >= 20 ) | |
5563 break; | |
5564 v19 = *((short *)v18 + 2); | |
5565 v20 = *((short *)v18 - 1); | |
5566 if ( v20 > v1->pBounding.x1 - v19 ) | |
5567 { | |
5568 if ( v20 < v19 + v1->pBounding.x2 ) | |
5569 { | |
5570 v21 = *(short *)v18; | |
5571 if ( v21 > v1->pBounding.y1 - v19 ) | |
5572 { | |
5573 if ( v21 < v19 + v1->pBounding.y2 ) | |
5574 { | |
5575 v22 = *((short *)v18 + 1); | |
5576 if ( v22 > v1->pBounding.z1 - v19 ) | |
5577 { | |
5578 if ( v22 < v19 + v1->pBounding.z2 ) | |
5579 { | |
5580 X = (v1->pFacePlane_old.dist | |
5581 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5582 + v21 * v1->pFacePlane_old.vNormal.y | |
5583 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5584 if ( X <= v19 ) | |
5585 { | |
5586 v23 = X; | |
5587 v24 = v74; | |
5588 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5589 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5590 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5591 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5592 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5593 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5594 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5595 v25 = (double)(signed int)v68 * v16; | |
5596 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5597 v26 = (unsigned __int8)v18[8]; | |
5598 *(float *)(v24 * 4 + 16297992) = v25; | |
5599 v27 = (double)(signed int)v68; | |
5600 v68 = (BLVFaceExtra *)v26; | |
5601 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5602 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5603 v16 = 0.0039215689; | |
5604 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5605 v28 = v74; | |
5606 v29 = v18[9]; | |
5607 ++v74; | |
5608 stru_F8AD28._blv_lights_types[v28] = v29; | |
5609 } | |
5610 } | |
5611 } | |
5612 } | |
5613 } | |
5614 } | |
5615 } | |
5616 ++v73; | |
5617 v18 += 18; | |
5618 v17 = v69; | |
5619 } | |
5620 while ( v73 < v70 ); | |
5621 } | |
5622 v30 = 0; | |
5623 v73 = 0; | |
5624 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5625 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5626 if ( v31 > 0 ) | |
5627 { | |
5628 while ( v74 < 20 ) | |
5629 { | |
5630 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5631 if ( !(v32->uAtributes & 8) ) | |
5632 { | |
5633 v33 = v1->pBounding.x1; | |
5634 v34 = v32->vPosition.x; | |
5635 X = v32->uBrightness; | |
5636 v35 = v32->uRadius; | |
5637 v68 = (BLVFaceExtra *)v32->uRadius; | |
5638 if ( v34 > v33 - v35 ) | |
5639 { | |
5640 if ( v34 < v35 + v1->pBounding.x2 ) | |
5641 { | |
5642 v36 = v32->vPosition.y; | |
5643 if ( v36 > v1->pBounding.y1 - v35 ) | |
5644 { | |
5645 if ( v36 < v35 + v1->pBounding.y2 ) | |
5646 { | |
5647 v37 = v32->vPosition.z; | |
5648 if ( v37 > v1->pBounding.z1 - v35 ) | |
5649 { | |
5650 if ( v37 < v35 + v1->pBounding.z2 ) | |
5651 { | |
5652 v38 = (v1->pFacePlane_old.dist | |
5653 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5654 + v37 * v1->pFacePlane_old.vNormal.z | |
5655 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5656 if ( v38 >= 0 ) | |
5657 { | |
5658 if ( v38 <= v35 && v35 ) | |
5659 { | |
5660 v39 = v74; | |
5661 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5662 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5663 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5664 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5665 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5666 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5667 v68 = (BLVFaceExtra *)v32->uRed; | |
5668 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5669 v68 = (BLVFaceExtra *)v32->uGreen; | |
5670 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5671 v68 = (BLVFaceExtra *)v32->uBlue; | |
5672 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5673 v16 = 0.0039215689; | |
5674 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5675 v40 = v74++; | |
5676 stru_F8AD28._blv_lights_types[v40] = 1; | |
5677 } | |
5678 } | |
5679 } | |
5680 } | |
5681 } | |
5682 } | |
5683 } | |
5684 } | |
5685 } | |
5686 v30 = v73++ + 1; | |
5687 if ( v73 >= v70 ) | |
5688 break; | |
5689 v17 = v69; | |
5690 } | |
5691 } | |
5692 v73 = 0; | |
5693 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5694 { | |
5695 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5696 do | |
5697 { | |
5698 if ( v74 >= 20 ) | |
5699 break; | |
5700 v42 = *((short *)v41 + 2); | |
5701 v43 = *((short *)v41 - 1); | |
5702 if ( v43 > v1->pBounding.x1 - v42 ) | |
5703 { | |
5704 if ( v43 < v42 + v1->pBounding.x2 ) | |
5705 { | |
5706 v44 = *(short *)v41; | |
5707 if ( v44 > v1->pBounding.y1 - v42 ) | |
5708 { | |
5709 if ( v44 < v42 + v1->pBounding.y2 ) | |
5710 { | |
5711 v45 = *((short *)v41 + 1); | |
5712 if ( v45 > v1->pBounding.z1 - v42 ) | |
5713 { | |
5714 if ( v45 < v42 + v1->pBounding.z2 ) | |
5715 { | |
5716 v46 = (v1->pFacePlane_old.dist | |
5717 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5718 + v43 * v1->pFacePlane_old.vNormal.x | |
5719 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5720 v69 = v46; | |
5721 if ( v46 >= 0 ) | |
5722 { | |
5723 if ( v46 <= v42 ) | |
5724 { | |
5725 v47 = v69; | |
5726 v48 = v74; | |
5727 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5728 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5729 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5730 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5731 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5732 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5733 v49 = (double)(signed int)v68 * v16; | |
5734 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5735 v50 = (unsigned __int8)v41[8]; | |
5736 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5737 v51 = (double)(signed int)v68; | |
5738 v68 = (BLVFaceExtra *)v50; | |
5739 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5740 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5741 v16 = 0.0039215689; | |
5742 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5743 v52 = v74++; | |
5744 stru_F8AD28._blv_lights_types[v52] = 1; | |
5745 } | |
5746 } | |
5747 } | |
5748 } | |
5749 } | |
5750 } | |
5751 } | |
5752 } | |
5753 ++v73; | |
5754 v41 += 12; | |
5755 } | |
5756 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5757 } | |
5758 stru_F8AD28.uNumLightsApplied = v74; | |
5759 v53 = v1->pBounding.x2; | |
5760 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5761 { | |
5762 v55 = v1->pBounding.x1; | |
5763 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5764 v54 = 0; | |
5765 else | |
5766 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5767 } | |
5768 else | |
5769 { | |
5770 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5771 } | |
5772 v56 = v1->pBounding.y2; | |
5773 v57 = v54 * v54; | |
5774 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5775 { | |
5776 v59 = v1->pBounding.y1; | |
5777 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5778 v58 = 0; | |
5779 else | |
5780 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5781 } | |
5782 else | |
5783 { | |
5784 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5785 } | |
5786 v60 = v58 * v58 + v57; | |
5787 v61 = v1->pBounding.z2; | |
5788 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5789 { | |
5790 v63 = v1->pBounding.z1; | |
5791 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5792 v62 = 0; | |
5793 else | |
5794 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5795 } | |
5796 else | |
5797 { | |
5798 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5799 } | |
5800 v64 = v62 * v62 + v60; | |
5801 if ( v64 ) | |
295 | 5802 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5803 else |
5804 stru_F8AD28.field_34 = 0; | |
5805 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5806 v65 = (double)(signed int)v68; | |
5807 if ( v65 >= 655.36 ) | |
5808 { | |
5809 if ( v65 >= 26214.4 ) | |
5810 { | |
5811 if ( v65 >= 45875.2 ) | |
5812 { | |
5813 stru_F8AD28.field_44 = 8; | |
5814 stru_F8AD28.field_48 = 3; | |
5815 } | |
5816 else | |
5817 { | |
5818 stru_F8AD28.field_44 = 16; | |
5819 stru_F8AD28.field_48 = 4; | |
5820 } | |
5821 } | |
5822 else | |
5823 { | |
5824 stru_F8AD28.field_44 = 32; | |
5825 stru_F8AD28.field_48 = 5; | |
5826 } | |
5827 } | |
5828 else | |
5829 { | |
5830 stru_F8AD28.field_44 = 64; | |
5831 stru_F8AD28.field_48 = 6; | |
5832 } | |
5833 } | |
5834 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5835 | |
5836 //----- (004AF412) -------------------------------------------------------- | |
5837 int __cdecl sub_4AF412() | |
5838 { | |
5839 int v0; // ST20_4@2 | |
5840 int v1; // ST20_4@2 | |
5841 int v2; // ST20_4@2 | |
5842 int v3; // esi@2 | |
5843 int v4; // ST20_4@2 | |
5844 int v5; // ecx@2 | |
5845 int v6; // ebx@2 | |
5846 int v7; // edi@2 | |
5847 int v8; // edx@2 | |
5848 int v9; // eax@2 | |
5849 int result; // eax@4 | |
5850 | |
5851 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5852 stru_F8AD28.vec_20.y = -65536; | |
5853 stru_F8AD28.plane_4.vNormal.x = 0; | |
5854 stru_F8AD28.plane_4.vNormal.y = 0; | |
5855 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5856 stru_F8AD28.vec_14.x = 65536; | |
5857 stru_F8AD28.vec_14.y = 0; | |
5858 stru_F8AD28.vec_14.z = 0; | |
5859 stru_F8AD28.vec_20.x = 0; | |
5860 stru_F8AD28.vec_20.z = 0; | |
5861 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5862 if ( pBLVRenderParams->sPartyRotX ) | |
5863 { | |
5864 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5865 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5866 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5867 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5868 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5869 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5870 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5871 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5872 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5873 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5874 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5875 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5876 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5877 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5878 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5879 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5880 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5881 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5882 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5883 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5884 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5885 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5886 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5887 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5888 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5889 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5890 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5891 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5892 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5893 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5894 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5895 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5896 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5897 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5898 v6 = pBLVRenderParams->vPartyPos.z; | |
5899 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5900 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5901 v8 = pBLVRenderParams->vPartyPos.y; | |
5902 v9 = pBLVRenderParams->vPartyPos.x; | |
5903 } | |
5904 else | |
5905 { | |
5906 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5907 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5908 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5909 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5910 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5911 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5912 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5913 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5914 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5915 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5916 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5917 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5918 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5919 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5920 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5921 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5922 v8 = pBLVRenderParams->vPartyPos.y; | |
5923 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5924 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5925 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5926 v9 = pBLVRenderParams->vPartyPos.x; | |
5927 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5928 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5929 v6 = pBLVRenderParams->vPartyPos.z; | |
5930 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5931 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5932 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5933 } | |
5934 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5935 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
5936 + stru_F8AD28.plane_4.dist | |
5937 + stru_F8AD28.plane_4.vNormal.x * v9 | |
5938 + stru_F8AD28.plane_4.vNormal.z * v6; | |
5939 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5940 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5941 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5942 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5943 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5944 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5945 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5946 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5947 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5948 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
5949 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
5950 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
5951 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5952 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5953 result = 0; | |
5954 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
5955 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
5956 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
5957 stru_F8AD28.field_38 = 0; | |
5958 stru_F8AD28.field_3E4 = 0; | |
5959 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
5960 stru_F8AD28.uNumLightsApplied = 0; | |
5961 stru_F8AD28.field_34 = 0; | |
5962 return result; | |
5963 } | |
5964 | |
5965 //----- (004B1447) -------------------------------------------------------- | |
5966 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
5967 { | |
5968 signed int v3; // esi@1 | |
5969 char v4; // sf@8 | |
5970 int v5; // eax@8 | |
5971 unsigned __int64 v6; // qax@12 | |
5972 DDM_DLV_Header *v7; // eax@14 | |
5973 Player **v8; // edi@18 | |
5974 Player *result; // eax@19 | |
735 | 5975 //char *v10; // esi@20 |
0 | 5976 |
5977 v3 = 0; | |
5978 if ( a2 ) | |
5979 { | |
5980 if ( a2 != 1 ) | |
5981 { | |
5982 if ( a2 == 2 ) | |
5983 v3 = 2; | |
5984 goto LABEL_13; | |
5985 } | |
5986 v3 = 2; | |
5987 } | |
5988 else | |
5989 { | |
5990 v3 = 1; | |
5991 } | |
5992 if ( pParty->uFine < 4000000 ) | |
5993 { | |
5994 v4 = a3 + pParty->uFine < 0; | |
5995 v5 = a3 + pParty->uFine; | |
5996 pParty->uFine += a3; | |
5997 if ( v4 ) | |
5998 { | |
5999 v5 = 0; | |
6000 pParty->uFine = 0; | |
6001 } | |
6002 if ( v5 > 4000000 ) | |
6003 pParty->uFine = 4000000; | |
6004 } | |
487 | 6005 |
6006 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6007 | |
0 | 6008 LABEL_13: |
463 | 6009 pParty->InTheShopFlags[a1] = 1; |
0 | 6010 if ( v3 ) |
6011 { | |
6012 v7 = &pOutdoor->ddm; | |
6013 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6014 v7 = &pIndoor->dlv; | |
6015 v7->uReputation += v3; | |
6016 if ( v7->uReputation > 10000 ) | |
6017 v7->uReputation = 10000; | |
6018 } | |
6019 v8 = &pPlayers[1]; | |
6020 do | |
6021 { | |
6022 result = *v8; | |
6023 if ( pParty->uFine ) | |
6024 { | |
735 | 6025 //v10 = result->_guilds_member_bits; |
484 | 6026 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6027 if ( !(short)result ) |
735 | 6028 __debugbreak(); |
501 | 6029 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6030 } |
6031 ++v8; | |
6032 } | |
6033 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6034 return result; | |
6035 } | |
6036 | |
6037 //----- (004B1523) -------------------------------------------------------- | |
762 | 6038 void __thiscall sub_4B1523(int *_this) |
0 | 6039 { |
6040 int v1; // esi@1 | |
6041 int v2; // edx@1 | |
6042 unsigned int v3; // eax@2 | |
6043 int v4; // eax@4 | |
6044 LONG v5; // ecx@4 | |
6045 int v6; // eax@10 | |
6046 char *v7; // ST44_4@12 | |
6047 unsigned __int16 v8; // ax@12 | |
6048 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6049 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6050 POINT a2; // [sp+64h] [bp-10h]@1 | |
6051 int v13; // [sp+6Ch] [bp-8h]@4 | |
6052 int v14; // [sp+70h] [bp-4h]@4 | |
6053 | |
6054 v1 = *_this - 399; | |
6055 v2 = (*_this - 400) % 11 + 1; | |
6056 v11 = 4 * (*_this - 400) / 11; | |
6057 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6058 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6059 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6060 else | |
6061 v3 = 30; | |
6062 a1.Hint = 0; | |
6063 a1.uFrameY = v3; | |
6064 a1.uFrameWidth = 328; | |
6065 a1.uFrameHeight = 68; | |
6066 a1.uFrameX = 90; | |
6067 a1.uFrameZ = 417; | |
6068 a1.uFrameW = v3 + 67; | |
6069 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6070 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6071 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6072 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6073 v5 = a2.y; | |
6074 if ( v14 > a2.y ) | |
6075 v5 = v14; | |
6076 if ( v13 > v5 ) | |
6077 v5 = v13; | |
6078 if ( v4 > v5 ) | |
6079 v5 = v4; | |
262 | 6080 sprintf(pTmpBuf2, "%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", |
6081 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6082 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6083 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6084 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6085 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6086 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6087 a1.uFrameHeight += v6; | |
6088 if ( (signed int)a1.uFrameHeight < 150 ) | |
6089 a1.uFrameHeight = 150; | |
819 | 6090 a1.uFrameWidth = game_viewport_width; |
0 | 6091 a1.DrawMessageBox(0); |
6092 a1.uFrameWidth -= 12; | |
6093 a1.uFrameHeight -= 12; | |
6094 v7 = pSpellStats->pInfos[v1].pName; | |
6095 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6096 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6097 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6098 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
6099 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6100 a1.uFrameZ = a1.uFrameX + 107; | |
6101 a1.uFrameWidth = 108; | |
6102 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6103 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6104 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6105 } |
6106 | |
6107 //----- (004B1784) -------------------------------------------------------- | |
6108 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6109 { | |
6110 Player *pPlayer; // ebx@1 | |
6111 bool result; // eax@2 | |
6112 unsigned __int16 v2; // ST0C_2@3 | |
6113 int v3; // eax@3 | |
6114 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6115 | |
6116 pPlayer = pPlayers[uActiveCharacter]; | |
6117 if ( pPlayer->CanAct() ) | |
6118 { | |
6119 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6120 result = 1; | |
6121 } | |
6122 else | |
6123 { | |
6124 pDialogueWindow->pNumPresenceButton = 0; | |
6125 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6126 v4.uFrameX = 483; | |
6127 v4.uFrameWidth = 148; | |
6128 v4.uFrameZ = 334; | |
6129 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6130 // "%s is in no condition to %s" | |
6131 // "do anything" | |
949 | 6132 v2 = TargetColor(255, 255, 0x9Bu); |
0 | 6133 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6134 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6135 result = 0; | |
6136 } | |
6137 return result; | |
6138 } | |
6139 // F8B1E0: using guessed type int dword_F8B1E0; | |
6140 | |
6141 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6142 void __cdecl ShowPopupShopItem() |
0 | 6143 { |
6144 POINT *v1; // esi@5 | |
6145 unsigned int v2; // eax@5 | |
6146 int v3; // ecx@5 | |
6147 POINT *v4; // esi@12 | |
6148 int v5; // eax@12 | |
6149 unsigned int v6; // eax@13 | |
6150 ItemGen *v7; // ecx@13 | |
6151 signed int v8; // esi@17 | |
6152 unsigned int v9; // eax@19 | |
475 | 6153 POINT v10; // [sp+8h] [bp-44h]@12 |
6154 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6155 POINT v12; // [sp+18h] [bp-34h]@18 | |
6156 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6157 POINT v14; // [sp+28h] [bp-24h]@17 | |
6158 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6159 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6160 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6161 |
484 | 6162 if ( in_current_building_type <= 0 ) |
0 | 6163 return; |
484 | 6164 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6165 { |
749 | 6166 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6167 { | |
6168 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6169 return; |
749 | 6170 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6171 { |
475 | 6172 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6173 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6174 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6175 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6176 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6177 return; |
907 | 6178 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6179 return; |
6180 } | |
749 | 6181 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6182 return; |
6183 } | |
475 | 6184 v4 = pMouse->GetCursorPos(&v11); |
6185 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6186 if ( !v5 ) |
6187 return; | |
336 | 6188 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6189 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6190 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6191 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6192 GameUI_DrawItemInfo(v7); | |
6193 return; | |
0 | 6194 } |
874 | 6195 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6196 { |
6197 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6198 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6199 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6200 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6201 if ( v5 ) | |
336 | 6202 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6203 } |
6204 } | |
6205 // F8B198: using guessed type int dword_F8B198; | |
6206 // F8B19C: using guessed type int dword_F8B19C; | |
6207 | |
6208 //----- (004B1BDB) -------------------------------------------------------- | |
6209 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6210 { | |
6211 signed __int64 v1; // ST2C_8@1 | |
6212 signed __int64 v2; // qax@1 | |
6213 signed __int64 v3; // ST1C_8@1 | |
6214 unsigned __int64 v4; // qax@1 | |
6215 unsigned int v5; // ebx@1 | |
112 | 6216 Player *v6; // ebx@1 |
0 | 6217 |
6218 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6219 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6220 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6221 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6222 v2 = v1 / 60 / 60; | |
6223 v3 = v2; | |
6224 v4 = (unsigned int)v2 / 0x18; | |
6225 v5 = (unsigned int)(v4 / 7) >> 2; | |
6226 pParty->uCurrentTimeSecond = v1 % 60; | |
6227 pParty->uCurrentMinute = v1 / 60 % 60; | |
6228 pParty->uCurrentHour = v3 % 24; | |
6229 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6230 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6231 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6232 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6233 pParty->RestAndHeal(); |
6234 dword_507B94 = 1; | |
112 | 6235 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6236 do |
6237 { | |
112 | 6238 v6->uTimeToRecovery = 0; |
6239 memset(&v6->uTimeToRecovery, 0, 4u); | |
6240 ++v6; | |
6241 } | |
6242 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6243 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6244 } |
6245 // 507B94: using guessed type int dword_507B94; | |
6246 | |
6247 //----- (004B1D27) -------------------------------------------------------- | |
6248 void __cdecl sub_4B1D27() | |
6249 { | |
6250 int v0; // edx@2 | |
6251 unsigned int v1; // ecx@7 | |
6252 signed int v2; // edi@10 | |
6253 int v3; // esi@10 | |
6254 __int16 v4; // ax@15 | |
6255 signed int v5; // edi@20 | |
6256 int v6; // esi@20 | |
6257 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6258 | |
484 | 6259 if ( in_current_building_type > 0 ) |
0 | 6260 { |
6261 v0 = 3; | |
484 | 6262 if ( in_current_building_type > BildingType_MagicShop ) |
6263 { | |
6264 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6265 { |
6266 if ( !dword_F8B1E4 ) | |
6267 return; | |
6268 } | |
6269 else | |
6270 { | |
484 | 6271 if ( in_current_building_type != BildingType_Temple ) |
0 | 6272 return; |
6273 } | |
336 | 6274 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6275 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6276 return; |
6277 } | |
336 | 6278 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6279 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6280 { |
6281 if ( pParty->uNumGold <= 0x2710 ) | |
6282 { | |
6283 if ( !dword_F8B1E4 ) | |
6284 return; | |
6285 v0 = 4; | |
907 | 6286 PlayHouseSound(v1, (HouseSoundID)v0); |
6287 return; | |
0 | 6288 } |
735 | 6289 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6290 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6291 { | |
6292 v5 = 0; | |
6293 v6 = 1; | |
6294 do | |
6295 { | |
6296 if ( pPlayers[v6]->CanAct() ) | |
6297 v7[v5++] = v6; | |
6298 ++v6; | |
6299 } | |
6300 while ( v6 <= 4 ); | |
6301 if ( v5 ) | |
6302 { | |
6303 qword_A750D8 = 256i64; | |
6304 word_A750E0 = 80; | |
6305 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6306 word_A750E2 = v4; |
6307 return; | |
0 | 6308 } |
6309 } | |
6310 } | |
6311 else | |
6312 { | |
6313 if ( !qword_A750D8 ) | |
6314 { | |
6315 v2 = 0; | |
6316 v3 = 1; | |
6317 do | |
6318 { | |
6319 if ( pPlayers[v3]->CanAct() ) | |
6320 v7[v2++] = v3; | |
6321 ++v3; | |
6322 } | |
6323 while ( v3 <= 4 ); | |
6324 if ( v2 ) | |
6325 { | |
6326 qword_A750D8 = 256i64; | |
6327 word_A750E0 = 80; | |
6328 v4 = LOWORD(v7[rand() % v2]); | |
6329 word_A750E2 = v4; | |
6330 return; | |
6331 } | |
6332 } | |
6333 } | |
6334 } | |
6335 } | |
6336 | |
6337 //----- (004B1ECE) -------------------------------------------------------- | |
6338 void __cdecl sub_4B1ECE() | |
6339 { | |
6340 __int16 *v0; // edi@1 | |
6341 int v1; // ebx@3 | |
6342 Player *v2; // esi@3 | |
6343 int v3; // eax@4 | |
6344 signed int v4; // eax@9 | |
6345 int v5; // ebx@11 | |
89 | 6346 Player *v6; // esi@13 |
6347 ItemGen *v7; // eax@14 | |
0 | 6348 signed int v8; // edi@14 |
89 | 6349 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6350 signed int v10; // [sp+10h] [bp-8h]@13 |
6351 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6352 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6353 |
484 | 6354 contract_approved = 0; |
0 | 6355 v11 = 0; |
6356 uDialogueType = 84; | |
827 | 6357 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6358 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6359 while ( 1 ) | |
6360 { | |
484 | 6361 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6362 { |
6363 v1 = 0; | |
6364 v2 = pParty->pPlayers; | |
6365 do | |
6366 { | |
89 | 6367 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6368 if ( v3 ) |
6369 break; | |
6370 ++v2; | |
6371 ++v1; | |
6372 } | |
6373 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6374 if ( v1 == 4 ) | |
6375 break; | |
6376 } | |
6377 ++v11; | |
6378 v0 += 2; | |
89 | 6379 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6380 break; | |
6381 } | |
6382 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6383 { | |
827 | 6384 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6385 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6386 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6387 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6388 } | |
484 | 6389 if ( contract_approved == 601 ) |
0 | 6390 { |
6391 v5 = 0; | |
89 | 6392 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6393 v9 = 0; |
6394 while ( 1 ) | |
6395 { | |
135 | 6396 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6397 { |
6398 v10 = 0; | |
89 | 6399 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6400 do |
6401 { | |
89 | 6402 v7 = v6->pInventoryItems; |
0 | 6403 v8 = 138; |
6404 do | |
6405 { | |
89 | 6406 if ( v7->uItemID == 601 ) |
0 | 6407 { |
377 | 6408 if ( !v7->uHolderPlayer ) |
89 | 6409 v9 = v7; |
377 | 6410 if ( v7->uHolderPlayer == v5 ) |
0 | 6411 v10 = 1; |
6412 } | |
89 | 6413 ++v7; |
0 | 6414 --v8; |
6415 } | |
6416 while ( v8 ); | |
89 | 6417 ++v6; |
6418 } | |
6419 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6420 if ( !v10 ) |
6421 break; | |
6422 } | |
89 | 6423 ++v12; |
0 | 6424 ++v5; |
89 | 6425 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6426 return; |
6427 } | |
6428 if ( v9 ) | |
377 | 6429 v9->uHolderPlayer = v5; |
0 | 6430 } |
6431 } | |
6432 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6433 // 722B3C: using guessed type int dword_722B3C; | |
6434 // 722B44: using guessed type int dword_722B44; | |
6435 // F8B1A8: using guessed type int dword_F8B1A8; | |
6436 | |
6437 //----- (004B2001) -------------------------------------------------------- | |
459 | 6438 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6439 { | |
6440 //signed int v1; // eax@1 | |
6441 NPCData *pCurrentNPCInfo; // ebp@1 | |
6442 int pEventNumber; // ecx@8 | |
0 | 6443 Player *v4; // esi@20 |
467 | 6444 //int v5; // eax@28 |
6445 //int v6; // eax@31 | |
6446 //int v7; // eax@34 | |
6447 //int v8; // eax@37 | |
6448 //int v9; // eax@40 | |
6449 //unsigned int v10; // eax@43 | |
0 | 6450 char *v12; // eax@53 |
6451 char *v13; // eax@56 | |
6452 char *v14; // eax@57 | |
6453 char *v15; // eax@58 | |
467 | 6454 //unsigned int v16; // ebp@62 |
0 | 6455 char *v17; // ecx@63 |
6456 char *v18; // eax@65 | |
6457 const char *v19; // ecx@68 | |
248 | 6458 //unsigned int v20; // eax@69 |
467 | 6459 signed int pPrice; // ecx@70 |
0 | 6460 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6461 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6462 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6463 //int v25; // [sp-4h] [bp-10h]@49 |
6464 | |
459 | 6465 uDialogueType = uMessageParam + 1; |
6466 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6467 if ( uMessageParam <= 24 ) |
460 | 6468 { |
459 | 6469 switch ( uMessageParam ) |
6470 { | |
6471 case 13: | |
827 | 6472 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6473 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6474 NPCHireableDialogPrepare(); |
459 | 6475 dialogue_show_profession_details = false; |
6476 goto _return; | |
6477 case 19: | |
6478 pEventNumber = pCurrentNPCInfo->evt_A; | |
6479 break; | |
6480 case 20: | |
6481 pEventNumber = pCurrentNPCInfo->evt_B; | |
6482 break; | |
6483 case 21: | |
6484 pEventNumber = pCurrentNPCInfo->evt_C; | |
6485 break; | |
6486 case 22: | |
6487 pEventNumber = pCurrentNPCInfo->evt_D; | |
6488 break; | |
6489 case 23: | |
6490 pEventNumber = pCurrentNPCInfo->evt_E; | |
6491 break; | |
6492 case 24: | |
6493 pEventNumber = pCurrentNPCInfo->evt_F; | |
6494 break; | |
6495 default: | |
467 | 6496 goto _return; |
6497 } | |
6498 /*switch ( pEventNumber ) | |
6499 { | |
6500 case 139: | |
6501 sub_4B1ECE(); | |
6502 goto _return; | |
6503 case 311: | |
6504 sub_4BBA85_bounties(); | |
6505 goto _return; | |
6506 }*/ | |
459 | 6507 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6508 { | |
6509 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6510 { | |
6511 if ( pEventNumber == 139 ) | |
0 | 6512 { |
6513 sub_4B1ECE(); | |
6514 } | |
6515 else | |
6516 { | |
459 | 6517 if ( pEventNumber == 311 ) |
0 | 6518 { |
6519 sub_4BBA85_bounties(); | |
6520 } | |
6521 else | |
6522 { | |
827 | 6523 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6524 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6525 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6526 activeLevelDecoration = NULL; |
0 | 6527 } |
6528 } | |
6529 } | |
6530 else | |
6531 { | |
459 | 6532 dword_F8B1D8 = uMessageParam; |
6533 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6534 } |
6535 } | |
6536 else | |
6537 { | |
459 | 6538 sub_4B3FE5(pEventNumber); |
0 | 6539 } |
6540 goto _return; | |
460 | 6541 } |
459 | 6542 if ( uMessageParam != 76 ) |
6543 { | |
6544 if ( uMessageParam == 77 ) | |
6545 { | |
467 | 6546 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6547 if (dialogue_show_profession_details) |
459 | 6548 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6549 else |
459 | 6550 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6551 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6552 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6553 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6554 current_npc_text = v18; |
0 | 6555 } |
6556 else | |
6557 { | |
459 | 6558 if ( uMessageParam == 79 ) |
0 | 6559 { |
484 | 6560 if ( contract_approved ) |
0 | 6561 { |
267 | 6562 Party::TakeGold(gold_transaction_amount); |
0 | 6563 if ( uActiveCharacter ) |
6564 { | |
492 | 6565 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6566 *(short *)v12 &= 0x3Fu; |
6567 switch ( dword_F8B1B0 ) | |
6568 { | |
6569 case 2: | |
492 | 6570 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6571 *v15 |= 0x40u; |
6572 break; | |
6573 case 3: | |
492 | 6574 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6575 *v14 |= 0x80u; |
6576 break; | |
6577 case 4: | |
492 | 6578 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6579 v13[1] |= 1u; |
6580 break; | |
6581 } | |
187 | 6582 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6583 } |
437 | 6584 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6585 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6586 { |
990 | 6587 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6588 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6589 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6590 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6591 }*/ |
0 | 6592 } |
6593 } | |
6594 else | |
6595 { | |
492 | 6596 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6597 { |
267 | 6598 Party::TakeGold(gold_transaction_amount); |
0 | 6599 v4 = pParty->pPlayers; |
6600 do | |
6601 { | |
492 | 6602 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6603 ++v4; |
6604 } | |
6605 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6606 switch ( dword_F8B1D8 ) | |
6607 { | |
6608 case 19: | |
467 | 6609 pEventNumber = pCurrentNPCInfo->evt_A; |
6610 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6611 pCurrentNPCInfo->evt_A = 0; |
0 | 6612 break; |
6613 case 20: | |
467 | 6614 pEventNumber = pCurrentNPCInfo->evt_B; |
6615 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6616 pCurrentNPCInfo->evt_B = 0; |
0 | 6617 break; |
6618 case 21: | |
467 | 6619 pEventNumber = pCurrentNPCInfo->evt_C; |
6620 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6621 pCurrentNPCInfo->evt_C = 0; |
0 | 6622 break; |
6623 case 22: | |
467 | 6624 pEventNumber = pCurrentNPCInfo->evt_D; |
6625 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6626 pCurrentNPCInfo->evt_D = 0; |
0 | 6627 break; |
6628 case 23: | |
467 | 6629 pEventNumber = pCurrentNPCInfo->evt_E; |
6630 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6631 pCurrentNPCInfo->evt_E = 0; |
0 | 6632 break; |
6633 case 24: | |
467 | 6634 pEventNumber = pCurrentNPCInfo->evt_F; |
6635 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6636 pCurrentNPCInfo->evt_F = 0; | |
0 | 6637 break; |
6638 } | |
437 | 6639 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6640 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6641 { |
990 | 6642 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6643 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6644 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6645 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6646 }*/ |
467 | 6647 //v11 = uActiveCharacter; |
0 | 6648 if ( uActiveCharacter ) |
6649 { | |
467 | 6650 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6651 goto _return; |
6652 } | |
6653 } | |
6654 } | |
6655 } | |
6656 goto _return; | |
6657 } | |
6658 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6659 { | |
467 | 6660 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6661 goto _return; |
6662 } | |
459 | 6663 if ( pCurrentNPCInfo->uProfession != 51 ) |
6664 { | |
467 | 6665 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6666 if ( pParty->uNumGold < pPrice ) | |
6667 { | |
6668 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6669 dialogue_show_profession_details = false; |
0 | 6670 uDialogueType = 13; |
827 | 6671 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6672 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6673 if ( uActiveCharacter ) |
248 | 6674 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6675 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6676 goto _return; | |
6677 } | |
6678 Party::TakeGold(pPrice); | |
0 | 6679 } |
147 | 6680 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6681 pCurrentNPCInfo->uFlags |= 128; |
0 | 6682 pParty->field_709 = 0; |
1035 | 6683 pParty->CountHirelings(); |
0 | 6684 if ( pParty->pHirelings[0].pName ) |
6685 { | |
459 | 6686 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6687 v24 = pCurrentNPCInfo->pName; | |
0 | 6688 v22 = pParty->pHireling2Name; |
6689 } | |
6690 else | |
6691 { | |
459 | 6692 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6693 v24 = pCurrentNPCInfo->pName; | |
0 | 6694 v22 = pParty->pHireling1Name; |
6695 } | |
6696 strcpy(v22, v24); | |
6697 pParty->field_709 = 0; | |
1035 | 6698 pParty->CountHirelings(); |
480 | 6699 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6700 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6701 |
6702 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6703 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6704 { |
990 | 6705 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6706 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6707 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6708 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6709 }*/ |
0 | 6710 if ( uActiveCharacter ) |
467 | 6711 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6712 _return: |
460 | 6713 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6714 } |
6715 | |
6716 //----- (004B254D) -------------------------------------------------------- | |
6717 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6718 { | |
955 | 6719 //Player *v1; // esi@1 |
0 | 6720 int v2; // edx@1 |
6721 int v3; // ecx@1 | |
6722 int v4; // edi@1 | |
955 | 6723 int pClassType; // eax@7 |
0 | 6724 int v6; // eax@7 |
6725 int v7; // ebx@7 | |
955 | 6726 //int v8; // ebx@8 |
0 | 6727 signed int v9; // esi@8 |
6728 int v10; // eax@8 | |
6729 char *v11; // ecx@8 | |
6730 int v12; // edi@9 | |
6731 char *v13; // edx@9 | |
6732 signed int v14; // edi@10 | |
6733 unsigned int v16; // eax@29 | |
955 | 6734 //int v17; // eax@36 |
0 | 6735 char v18; // cl@46 |
6736 __int16 v19; // dx@56 | |
6737 int v20; // eax@60 | |
955 | 6738 //char *v21; // [sp-Ch] [bp-38h]@82 |
6739 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6740 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6741 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6742 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6743 //int v26; // [sp-4h] [bp-30h]@38 |
6744 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6745 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6746 int v29; // [sp+10h] [bp-1Ch]@13 | |
6747 int v30; // [sp+14h] [bp-18h]@15 | |
6748 int v31; // [sp+18h] [bp-14h]@16 | |
6749 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6750 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6751 int v34; // [sp+24h] [bp-8h]@7 |
6752 char *v35; // [sp+28h] [bp-4h]@1 | |
6753 | |
484 | 6754 contract_approved = 0; |
0 | 6755 v2 = (_this - 200) % 3; |
6756 v3 = (_this - 200) / 3; | |
6757 v4 = v2; | |
6758 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6759 dword_F8B1AC_award_bit_number = v3; |
0 | 6760 if ( v2 ) |
6761 { | |
6762 if ( v2 == 1 ) | |
6763 { | |
267 | 6764 gold_transaction_amount = 5000; |
0 | 6765 dword_F8B1B0 = 3; |
6766 } | |
6767 else | |
6768 { | |
6769 if ( v2 == 2 ) | |
6770 { | |
267 | 6771 gold_transaction_amount = 8000; |
0 | 6772 dword_F8B1B0 = 4; |
6773 } | |
6774 } | |
6775 } | |
6776 else | |
6777 { | |
267 | 6778 gold_transaction_amount = 2000; |
0 | 6779 dword_F8B1B0 = 2; |
6780 } | |
955 | 6781 pClassType = pPlayers[uActiveCharacter]->classType; |
6782 //v33 = pClassType; | |
6783 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6784 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6785 v7 = a1[0] & 0x3F; |
6786 v34 = v2 + 2; | |
6787 if ( v6 < v2 + 2 ) | |
6788 { | |
955 | 6789 //v8 = v33; |
0 | 6790 v9 = 0; |
955 | 6791 v10 = pClassType - pClassType % 4; |
6792 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6793 do |
6794 { | |
6795 v12 = (unsigned __int8)*v11; | |
6796 v13 = &v28[4 * v9]; | |
6797 *(int *)v13 = 0; | |
6798 if ( v12 < v34 ) | |
6799 { | |
6800 v14 = 1; | |
6801 } | |
6802 else | |
6803 { | |
6804 v14 = 1; | |
6805 *(int *)v13 = 1; | |
6806 } | |
6807 ++v9; | |
6808 v11 += 37; | |
6809 } | |
6810 while ( v9 < 4 ); | |
6811 if ( v29 == v14 ) | |
6812 { | |
6813 v25 = pClassNames[v10 + 1]; | |
6814 } | |
6815 else | |
6816 { | |
955 | 6817 if ( v30 == v14 )//crash |
0 | 6818 { |
6819 if ( v31 == v14 ) | |
6820 { | |
955 | 6821 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6822 return pTmpBuf; |
6823 } | |
6824 v25 = pClassNames[v10 + 2]; | |
6825 } | |
6826 else | |
6827 { | |
6828 if ( v31 != v14 ) | |
6829 { | |
955 | 6830 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
6831 return pTmpBuf; | |
0 | 6832 } |
6833 v25 = pClassNames[v10 + 3]; | |
6834 } | |
6835 } | |
955 | 6836 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6837 return pTmpBuf; |
6838 } | |
955 | 6839 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6840 return (char *)pNPCTopics[122].pText; |
6841 if ( !v7 ) | |
6842 return (char *)pNPCTopics[131].pText; | |
6843 v16 = SkillToMastery(a1[0]); | |
6844 if ( (signed int)v16 > v4 + 1 ) | |
6845 return (char *)pNPCTopics[v4 + 128].pText; | |
6846 if ( v34 != 2 ) | |
6847 { | |
6848 if ( v34 == 3 ) | |
6849 { | |
6850 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6851 { | |
492 | 6852 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6853 { |
6854 case 12: | |
6855 case 13: | |
6856 case 14: | |
6857 case 15: | |
6858 case 16: | |
6859 case 17: | |
6860 case 18: | |
267 | 6861 gold_transaction_amount = 4000; |
0 | 6862 goto LABEL_42; |
6863 case 19: | |
6864 v19 = 114; | |
955 | 6865 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6866 return v35; | |
6867 if ( !gold_transaction_amount ) | |
6868 goto LABEL_79; | |
6869 goto LABEL_42; | |
0 | 6870 case 20: |
6871 v19 = 110; | |
484 | 6872 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6873 return v35; |
955 | 6874 if ( !gold_transaction_amount ) |
6875 goto LABEL_79; | |
6876 goto LABEL_42; | |
0 | 6877 case 22: |
955 | 6878 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
6879 if ( v20 < 50 ) | |
6880 return v35; | |
6881 if ( !gold_transaction_amount ) | |
6882 goto LABEL_79; | |
6883 goto LABEL_42; | |
0 | 6884 case 24: |
267 | 6885 gold_transaction_amount = 2500; |
955 | 6886 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 6887 if ( v20 < 50 ) |
6888 return v35; | |
955 | 6889 if ( !gold_transaction_amount ) |
6890 goto LABEL_79; | |
6891 goto LABEL_42; | |
6892 case 36: | |
6893 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
6894 if ( v20 < 50 ) | |
6895 return v35; | |
6896 if ( !gold_transaction_amount ) | |
6897 goto LABEL_79; | |
6898 goto LABEL_42; | |
0 | 6899 case 21: |
6900 case 23: | |
6901 case 25: | |
6902 case 26: | |
6903 case 29: | |
6904 case 32: | |
6905 case 34: | |
6906 case 35: | |
267 | 6907 gold_transaction_amount = 2500; |
0 | 6908 goto LABEL_42; |
6909 case 8: | |
6910 case 9: | |
6911 case 10: | |
6912 case 11: | |
267 | 6913 gold_transaction_amount = 3000; |
0 | 6914 goto LABEL_42; |
6915 case 7: | |
955 | 6916 gold_transaction_amount = 0; |
6917 if ( !gold_transaction_amount ) | |
6918 goto LABEL_79; | |
6919 goto LABEL_42; | |
6920 default: | |
6921 if ( !gold_transaction_amount ) | |
6922 goto LABEL_79; | |
6923 goto LABEL_42; | |
0 | 6924 } |
955 | 6925 gold_transaction_amount = 0; |
6926 if ( !gold_transaction_amount ) | |
6927 goto LABEL_79; | |
6928 goto LABEL_42; | |
0 | 6929 } |
6930 } | |
6931 else | |
6932 { | |
6933 if ( v34 != 4 ) | |
6934 { | |
955 | 6935 if ( !gold_transaction_amount ) |
6936 goto LABEL_79; | |
6937 goto LABEL_42; | |
0 | 6938 } |
6939 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
6940 { | |
492 | 6941 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6942 { |
6943 case 19: | |
955 | 6944 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
6945 { | |
6946 if ( !gold_transaction_amount ) | |
6947 goto LABEL_79; | |
6948 goto LABEL_42; | |
6949 } | |
6950 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
6951 { | |
6952 if ( !gold_transaction_amount ) | |
6953 goto LABEL_79; | |
6954 goto LABEL_42; | |
6955 } | |
6956 return v35; | |
0 | 6957 case 20: |
955 | 6958 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
6959 { | |
6960 if ( !gold_transaction_amount ) | |
6961 goto LABEL_79; | |
6962 goto LABEL_42; | |
6963 } | |
6964 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
6965 { | |
6966 if ( !gold_transaction_amount ) | |
6967 goto LABEL_79; | |
6968 goto LABEL_42; | |
6969 } | |
0 | 6970 return v35; |
6971 case 30: | |
955 | 6972 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 6973 if ( (v18 & 0x3Fu) < 0xA ) |
6974 return v35; | |
955 | 6975 if ( !gold_transaction_amount ) |
6976 goto LABEL_79; | |
6977 goto LABEL_42; | |
6978 case 31: | |
6979 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
6980 if ( (v18 & 0x3Fu) < 0xA ) | |
6981 return v35; | |
6982 if ( !gold_transaction_amount ) | |
6983 goto LABEL_79; | |
6984 goto LABEL_42; | |
0 | 6985 case 21: |
6986 case 23: | |
6987 case 24: | |
6988 case 25: | |
6989 case 26: | |
6990 case 29: | |
6991 case 32: | |
6992 case 34: | |
6993 case 35: | |
267 | 6994 gold_transaction_amount = 6000; |
0 | 6995 goto LABEL_42; |
6996 case 8: | |
6997 case 9: | |
6998 case 10: | |
6999 case 11: | |
267 | 7000 gold_transaction_amount = 7000; |
0 | 7001 goto LABEL_42; |
7002 case 7: | |
7003 break; | |
955 | 7004 default: |
7005 if ( !gold_transaction_amount ) | |
7006 goto LABEL_79; | |
7007 goto LABEL_42; | |
0 | 7008 } |
267 | 7009 gold_transaction_amount = 0; |
955 | 7010 if ( !gold_transaction_amount ) |
7011 goto LABEL_79; | |
7012 goto LABEL_42; | |
0 | 7013 } |
7014 } | |
7015 return v35; | |
7016 } | |
7017 if ( v7 < 4 ) | |
7018 return v35; | |
492 | 7019 if ( dword_F8B1AC_award_bit_number > 27 ) |
7020 { | |
7021 if ( dword_F8B1AC_award_bit_number != 29 | |
7022 && dword_F8B1AC_award_bit_number != 32 | |
7023 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7024 { |
267 | 7025 if ( !gold_transaction_amount ) |
0 | 7026 goto LABEL_79; |
7027 goto LABEL_42; | |
7028 } | |
267 | 7029 gold_transaction_amount = 500; |
955 | 7030 if ( !gold_transaction_amount ) |
7031 goto LABEL_79; | |
7032 goto LABEL_42; | |
0 | 7033 } |
492 | 7034 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7035 { |
7036 gold_transaction_amount = 500; | |
7037 if ( !gold_transaction_amount ) | |
7038 goto LABEL_79; | |
7039 goto LABEL_42; | |
7040 } | |
492 | 7041 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7042 { |
267 | 7043 gold_transaction_amount = 0; |
0 | 7044 goto LABEL_79; |
7045 } | |
492 | 7046 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7047 { |
7048 if ( !gold_transaction_amount ) | |
7049 goto LABEL_79; | |
7050 goto LABEL_42; | |
7051 } | |
492 | 7052 if ( dword_F8B1AC_award_bit_number > 18 ) |
7053 { | |
7054 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7055 { |
7056 if ( !gold_transaction_amount ) | |
7057 goto LABEL_79; | |
7058 goto LABEL_42; | |
7059 } | |
7060 gold_transaction_amount = 500; | |
7061 if ( !gold_transaction_amount ) | |
7062 goto LABEL_79; | |
7063 goto LABEL_42; | |
0 | 7064 } |
267 | 7065 gold_transaction_amount = 1000; |
0 | 7066 LABEL_42: |
267 | 7067 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7068 return (char *)pNPCTopics[124].pText; |
7069 LABEL_79: | |
484 | 7070 contract_approved = 1; |
0 | 7071 if ( v34 == 2 ) |
7072 { | |
955 | 7073 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
7074 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò | |
7075 return pTmpBuf2; | |
0 | 7076 } |
7077 if ( v34 == 3 ) | |
7078 { | |
955 | 7079 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7080 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð | |
7081 return pTmpBuf2; | |
0 | 7082 } |
7083 if ( v34 == 4 ) | |
955 | 7084 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7085 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð | |
0 | 7086 return pTmpBuf2; |
7087 } | |
7088 | |
7089 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7090 const char * ContractSelectText( int pEventCode ) |
7091 { | |
7092 static const int dialogue_base=110; | |
484 | 7093 contract_approved = 0; |
492 | 7094 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7095 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7096 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7097 { | |
492 | 7098 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7099 { | |
7100 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7101 } |
7102 else | |
7103 { | |
267 | 7104 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7105 { |
484 | 7106 contract_approved = 1; |
492 | 7107 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7108 } |
7109 else | |
7110 { | |
492 | 7111 return pNPCTopics[dialogue_base+14].pText; |
0 | 7112 } |
7113 } | |
7114 } | |
7115 else | |
7116 { | |
492 | 7117 return pNPCTopics[dialogue_base+12].pText; |
0 | 7118 } |
7119 } | |
7120 | |
7121 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7122 void SimpleHouseAndBoatsDialog() |
0 | 7123 { |
7124 char *v0; // esi@3 | |
7125 char *v1; // ST1C_4@3 | |
7126 char *v2; // eax@3 | |
7127 const char *v3; // ST1C_4@5 | |
7128 int v4; // eax@5 | |
7129 unsigned int i; // eax@5 | |
7130 NPCData *v6; // esi@6 | |
7131 unsigned __int16 v7; // bx@6 | |
7132 unsigned int v8; // eax@6 | |
7133 int v9; // eax@11 | |
7134 unsigned int v10; // ecx@12 | |
7135 int v11; // eax@12 | |
7136 int v12; // esi@12 | |
7137 char *v13; // eax@12 | |
7138 GUIWindow *v14; // ebx@13 | |
7139 char *v15; // esi@14 | |
7140 GUIButton *v16; // eax@15 | |
7141 unsigned int v17; // ecx@15 | |
7142 int v18; // ecx@17 | |
7143 int v19; // ecx@18 | |
7144 int v20; // ecx@19 | |
7145 int v21; // ecx@20 | |
7146 int v22; // ecx@21 | |
7147 unsigned int v23; // ecx@23 | |
7148 int v24; // ecx@35 | |
7149 int v25; // ecx@36 | |
7150 int v26; // ecx@37 | |
7151 int v27; // ecx@38 | |
7152 int v28; // ecx@39 | |
7153 char *v29; // esi@42 | |
7154 unsigned int v30; // ST20_4@42 | |
7155 int v31; // ST1C_4@42 | |
7156 unsigned int v32; // eax@42 | |
7157 char *v33; // eax@43 | |
7158 int v34; // esi@51 | |
7159 int v35; // eax@51 | |
7160 unsigned int v36; // edi@51 | |
7161 GUIButton *v37; // eax@52 | |
7162 int v38; // eax@52 | |
7163 signed int v39; // ecx@54 | |
7164 int v40; // edi@57 | |
7165 GUIButton *v41; // eax@60 | |
7166 GUIButton *v42; // esi@60 | |
7167 const char *v43; // ebx@60 | |
7168 int v44; // eax@60 | |
7169 unsigned int v45; // ecx@60 | |
7170 unsigned __int16 v46; // ax@60 | |
7171 GUIFont *v47; // ebx@64 | |
7172 int v48; // esi@64 | |
7173 char *v49; // eax@66 | |
7174 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7175 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7176 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7177 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7178 int v55; // [sp+10Ch] [bp-10h]@6 | |
7179 int v56; // [sp+110h] [bp-Ch]@13 | |
7180 char *pInString; // [sp+114h] [bp-8h]@12 | |
7181 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7182 | |
7183 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7184 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7185 { |
7186 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7187 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7188 a1.uFrameX = 493; | |
7189 a1.uFrameWidth = 126; | |
7190 a1.uFrameZ = 366; | |
7191 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7192 a1.uFrameX = 483; | |
7193 a1.uFrameWidth = 148; | |
7194 a1.uFrameZ = 334; | |
434 | 7195 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7196 if ( !v2 ) |
7197 { | |
721 | 7198 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7199 v2 = pTmpBuf; |
7200 } | |
7201 v3 = v2; | |
7202 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7203 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7204 return; | |
0 | 7205 } |
7206 a1.uFrameWidth -= 10; | |
7207 a1.uFrameZ -= 10; | |
459 | 7208 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7209 v6 = v58; |
949 | 7210 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7211 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7212 v8 = v6->uProfession; |
7213 if ( v8 ) | |
264 | 7214 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7215 else |
7216 strcpy(pTmpBuf, v6->pName); | |
7217 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7218 if ( !dword_591080 ) | |
7219 { | |
7220 if ( !uDialogueType ) | |
7221 { | |
7222 v9 = v6->greet; | |
7223 if ( v9 ) | |
7224 { | |
7225 v10 = v6->uFlags; | |
819 | 7226 a1.uFrameWidth = game_viewport_width; |
0 | 7227 a1.uFrameZ = 452; |
7228 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7229 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7230 v12 = v11 + 7; | |
973 | 7231 pRenderer->_4A6A68(8, 352 - (v11 + 7), |
7232 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7233 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); | |
0 | 7234 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); |
7235 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7236 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7237 } | |
7238 } | |
7239 } | |
7240 v14 = pDialogueWindow; | |
7241 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7242 v52.uFrameX = 483; | |
7243 v52.uFrameWidth = 148; | |
7244 v52.uFrameZ = 334; | |
7245 v56 = v52.pStartingPosActiveItem; | |
7246 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7247 { | |
348 | 7248 v15 = "";//(char *)v54; |
0 | 7249 while ( 1 ) |
7250 { | |
7251 v16 = v52.GetControl(v56); | |
832 | 7252 v17 = v16->msg_param; |
0 | 7253 pInString = (char *)v16; |
7254 if ( (signed int)v17 > 24 ) | |
7255 { | |
7256 v24 = v17 - 76; | |
7257 if ( !v24 ) | |
7258 { | |
7259 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7260 goto LABEL_49; | |
7261 } | |
7262 v25 = v24 - 1; | |
7263 if ( !v25 ) | |
7264 { | |
7265 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7266 goto LABEL_49; | |
7267 } | |
7268 v26 = v25 - 2; | |
7269 if ( !v26 ) | |
7270 { | |
7271 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7272 LABEL_44: | |
7273 v15 = v33; | |
7274 LABEL_45: | |
7275 v16 = (GUIButton *)pInString; | |
7276 goto LABEL_49; | |
7277 } | |
7278 v27 = v26 - 3; | |
7279 if ( !v27 ) | |
7280 { | |
459 | 7281 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7282 goto LABEL_44; |
7283 } | |
7284 v28 = v27 - 1; | |
7285 if ( !v28 ) | |
7286 { | |
7287 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7288 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7289 v31 = *(int *)v29; |
949 | 7290 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1033 | 7291 sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30); |
7292 sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7293 current_npc_text = pTmpBuf2; |
0 | 7294 v15 = ""; |
7295 goto LABEL_45; | |
7296 } | |
7297 if ( v28 != 10 ) | |
7298 goto LABEL_41; | |
7299 } | |
7300 else | |
7301 { | |
7302 if ( v17 == 24 ) | |
7303 { | |
291 | 7304 v23 = v58->evt_F; |
0 | 7305 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7306 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7307 if ( !v15 ) |
7308 { | |
832 | 7309 v16->msg_param = 0; |
0 | 7310 v15 = ""; |
7311 } | |
7312 goto LABEL_49; | |
7313 } | |
7314 v18 = v17 - 13; | |
7315 if ( v18 ) | |
7316 { | |
7317 v19 = v18 - 6; | |
7318 if ( !v19 ) | |
7319 { | |
291 | 7320 v23 = v58->evt_A; |
0 | 7321 goto LABEL_33; |
7322 } | |
7323 v20 = v19 - 1; | |
7324 if ( !v20 ) | |
7325 { | |
291 | 7326 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7327 if ( !v15 ) |
7328 { | |
832 | 7329 v16->msg_param = 0; |
0 | 7330 v15 = ""; |
7331 } | |
7332 if ( uDialogueType != 84 ) | |
7333 goto LABEL_49; | |
484 | 7334 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7335 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7336 current_npc_text = pTmpBuf2; | |
0 | 7337 goto LABEL_45; |
7338 } | |
7339 v21 = v20 - 1; | |
7340 if ( !v21 ) | |
7341 { | |
291 | 7342 v23 = v58->evt_C; |
0 | 7343 goto LABEL_33; |
7344 } | |
7345 v22 = v21 - 1; | |
7346 if ( !v22 ) | |
7347 { | |
291 | 7348 v23 = v58->evt_D; |
0 | 7349 goto LABEL_33; |
7350 } | |
7351 if ( v22 == 1 ) | |
7352 { | |
291 | 7353 v23 = v58->evt_E; |
0 | 7354 goto LABEL_33; |
7355 } | |
7356 LABEL_41: | |
7357 v15 = ""; | |
7358 goto LABEL_49; | |
7359 } | |
7360 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7361 } | |
7362 LABEL_49: | |
7363 strcpy(v16->pButtonName, v15); | |
7364 ++v56; | |
7365 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7366 { | |
7367 v14 = pDialogueWindow; | |
7368 break; | |
7369 } | |
7370 } | |
7371 } | |
7372 v34 = 0; | |
949 | 7373 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7374 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7375 v36 = v14->pStartingPosActiveItem; |
7376 v55 = v35; | |
7377 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7378 + pDialogueWindow->pStartingPosActiveItem ) | |
7379 { | |
7380 v37 = v14->GetControl(v36); | |
7381 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7382 v14 = pDialogueWindow; | |
7383 v34 += v38; | |
7384 ++v36; | |
7385 } | |
7386 v39 = v14->pNumPresenceButton; | |
7387 if ( v39 ) | |
7388 { | |
7389 v58 = (NPCData *)((174 - v34) / v39); | |
7390 if ( (signed int)v58 > 32 ) | |
7391 v58 = (NPCData *)32; | |
7392 pInString = (char *)2; | |
7393 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7394 v56 = v14->pStartingPosActiveItem; | |
7395 i = v56; | |
7396 if ( (signed int)i < (signed int)(i + v39) ) | |
7397 { | |
7398 while ( 1 ) | |
7399 { | |
7400 v41 = v14->GetControl(i); | |
7401 v42 = v41; | |
7402 v43 = v41->pButtonName; | |
7403 v41->uY = (unsigned int)((char *)v58 + v40); | |
7404 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7405 v45 = v42->uY; | |
7406 v42->uHeight = v44; | |
7407 v40 = v45 + v44 - 1; | |
7408 v42->uW = v40; | |
7409 v46 = v55; | |
7410 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7411 v46 = v54; | |
7412 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7413 v14 = pDialogueWindow; | |
7414 ++pInString; | |
7415 ++v56; | |
7416 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7417 if ( v56 >= (signed int)i ) | |
7418 break; | |
7419 i = v56; | |
7420 } | |
7421 } | |
7422 } | |
827 | 7423 if ( current_npc_text ) |
0 | 7424 { |
7425 w.uFrameWidth = 458; | |
7426 w.uFrameZ = 457; | |
7427 v47 = pFontArrus; | |
827 | 7428 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7429 if ( 352 - v48 < 8 ) |
7430 { | |
7431 v47 = pFontCreate; | |
827 | 7432 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7433 } |
973 | 7434 pRenderer->_4A6A68(8, 352 - v48, |
7435 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7436 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); | |
0 | 7437 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); |
827 | 7438 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7439 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7440 } | |
0 | 7441 } |
7442 | |
7443 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7444 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7445 { |
832 | 7446 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7447 } |
7448 | |
7449 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7450 void sub_4B3A72( int a1 ) |
7451 { | |
7452 int num_buttons; // esi@1 | |
7453 | |
7454 num_buttons = 0; | |
0 | 7455 if ( a1 == 21 ) |
7456 { | |
473 | 7457 CreateButtonInColumn(0, 0x66u); |
7458 num_buttons = 2; | |
7459 CreateButtonInColumn(1, 0x67u); | |
7460 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7461 { | |
7462 num_buttons = 3; | |
7463 CreateButtonInColumn(2, 0x68u); | |
7464 } | |
7465 } | |
972 | 7466 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); |
0 | 7467 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7468 } | |
7469 // F8B1E0: using guessed type int dword_F8B1E0; | |
7470 | |
7471 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7472 void sub_4B3AD4( signed int a1 ) |
7473 { | |
0 | 7474 if ( a1 > 0 ) |
7475 { | |
7476 if ( a1 <= 3 ) | |
7477 { | |
473 | 7478 CreateButtonInColumn(0, 3u); |
7479 CreateButtonInColumn(1, 4u); | |
7480 CreateButtonInColumn(2, 5u); | |
972 | 7481 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
0 | 7482 } |
7483 if ( a1 == 4 ) | |
7484 { | |
473 | 7485 CreateButtonInColumn(0, 3u); |
7486 CreateButtonInColumn(1, 4u); | |
972 | 7487 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); |
473 | 7488 } |
7489 } | |
0 | 7490 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7491 } | |
7492 // F8B1E0: using guessed type int dword_F8B1E0; | |
7493 | |
7494 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7495 void sub_4B3B42( signed int a1 ) |
7496 { | |
0 | 7497 int v1; // ecx@18 |
7498 int v2; // ecx@19 | |
7499 int v3; // ecx@20 | |
7500 signed int v4; // esi@22 | |
7501 signed int v5; // eax@22 | |
7502 unsigned int v6; // edx@24 | |
7503 int v7; // ecx@24 | |
7504 int result; // eax@43 | |
7505 int v9; // [sp-10h] [bp-14h]@28 | |
7506 int v10; // [sp-Ch] [bp-10h]@28 | |
7507 int v11; // [sp-8h] [bp-Ch]@28 | |
7508 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7509 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7510 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7511 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7512 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7513 int v17; // [sp-4h] [bp-8h]@28 | |
7514 | |
7515 if ( a1 > 13 ) | |
7516 { | |
7517 if ( a1 > 22 ) | |
7518 { | |
7519 if ( a1 == 23 ) | |
7520 { | |
473 | 7521 CreateButtonInColumn(0, 0xAu); |
7522 CreateButtonInColumn(1, 0xBu); | |
0 | 7523 v14 = 96; |
7524 LABEL_41: | |
473 | 7525 CreateButtonInColumn(2, v14); |
0 | 7526 v17 = 2; |
7527 v11 = 0; | |
7528 v10 = 1; | |
7529 v9 = 3; | |
7530 goto LABEL_42; | |
7531 } | |
7532 if ( a1 <= 26 ) | |
7533 goto LABEL_43; | |
7534 if ( a1 > 28 ) | |
7535 { | |
7536 if ( a1 != 30 ) | |
7537 goto LABEL_43; | |
473 | 7538 CreateButtonInColumn(0, 0x11u); |
0 | 7539 v16 = 96; |
7540 goto LABEL_37; | |
7541 } | |
473 | 7542 CreateButtonInColumn(0, 0x69u); |
7543 CreateButtonInColumn(1, 0x6Au); | |
7544 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7545 v12 = 108; |
7546 } | |
7547 else | |
7548 { | |
7549 if ( a1 == 22 ) | |
7550 { | |
473 | 7551 CreateButtonInColumn(0, 7u); |
0 | 7552 v16 = 8; |
7553 goto LABEL_37; | |
7554 } | |
7555 v1 = a1 - 14; | |
7556 if ( !v1 ) | |
7557 { | |
473 | 7558 CreateButtonInColumn(0, 0x12u); |
7559 CreateButtonInColumn(1, 0x30u); | |
7560 CreateButtonInColumn(2, 0x31u); | |
7561 CreateButtonInColumn(3, 0x32u); | |
7562 CreateButtonInColumn(4, 0x33u); | |
0 | 7563 v17 = 2; |
7564 v11 = 0; | |
7565 v10 = 1; | |
7566 v9 = 5; | |
7567 goto LABEL_42; | |
7568 } | |
7569 v2 = v1 - 1; | |
7570 if ( v2 ) | |
7571 { | |
7572 v3 = v2 - 2; | |
7573 if ( v3 ) | |
7574 { | |
7575 if ( v3 != 4 ) | |
7576 goto LABEL_43; | |
473 | 7577 CreateButtonInColumn(0, 0xFu); |
7578 CreateButtonInColumn(1, 0x10u); | |
0 | 7579 v4 = 3; |
473 | 7580 CreateButtonInColumn(2, 0x60u); |
336 | 7581 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7582 if ( v5 < 108 || v5 > 120 ) |
7583 goto LABEL_28; | |
7584 v4 = 4; | |
7585 v6 = 101; | |
7586 v7 = 3; | |
7587 } | |
7588 else | |
7589 { | |
7590 v4 = 1; | |
473 | 7591 CreateButtonInColumn(0, 0x63u); |
0 | 7592 if ( !pParty->uFine ) |
7593 { | |
7594 LABEL_28: | |
7595 v17 = 2; | |
7596 v11 = 0; | |
7597 v10 = 1; | |
7598 v9 = v4; | |
7599 LABEL_42: | |
972 | 7600 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); |
0 | 7601 goto LABEL_43; |
7602 } | |
7603 v4 = 2; | |
7604 v7 = 1; | |
7605 v6 = 100; | |
7606 } | |
473 | 7607 CreateButtonInColumn(v7, v6); |
0 | 7608 goto LABEL_28; |
7609 } | |
473 | 7610 CreateButtonInColumn(0, 0x12u); |
7611 CreateButtonInColumn(1, 0x34u); | |
7612 CreateButtonInColumn(2, 0x35u); | |
0 | 7613 v12 = 54; |
7614 } | |
7615 LABEL_39: | |
473 | 7616 CreateButtonInColumn(3, v12); |
0 | 7617 v17 = 2; |
7618 v11 = 0; | |
7619 v10 = 1; | |
7620 v9 = 4; | |
7621 goto LABEL_42; | |
7622 } | |
7623 if ( a1 == 13 ) | |
7624 { | |
473 | 7625 CreateButtonInColumn(0, 0x12u); |
0 | 7626 v16 = 56; |
7627 LABEL_37: | |
473 | 7628 CreateButtonInColumn(1, v16); |
0 | 7629 v17 = 2; |
7630 v11 = 0; | |
7631 v10 = 1; | |
7632 v9 = 2; | |
7633 goto LABEL_42; | |
7634 } | |
7635 switch ( a1 ) | |
7636 { | |
7637 case 1: | |
7638 case 2: | |
7639 case 3: | |
7640 case 4: | |
473 | 7641 CreateButtonInColumn(0, 2u); |
7642 CreateButtonInColumn(1, 0x5Fu); | |
7643 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7644 v12 = 96; |
7645 goto LABEL_39; | |
7646 case 5: | |
473 | 7647 CreateButtonInColumn(0, 0x12u); |
0 | 7648 v13 = 48; |
7649 goto LABEL_9; | |
7650 case 6: | |
473 | 7651 CreateButtonInColumn(0, 0x12u); |
0 | 7652 v13 = 49; |
7653 goto LABEL_9; | |
7654 case 7: | |
473 | 7655 CreateButtonInColumn(0, 0x12u); |
0 | 7656 v13 = 50; |
7657 goto LABEL_9; | |
7658 case 8: | |
473 | 7659 CreateButtonInColumn(0, 0x12u); |
0 | 7660 v13 = 51; |
7661 LABEL_9: | |
473 | 7662 CreateButtonInColumn(1, v13); |
0 | 7663 v14 = 72; |
7664 goto LABEL_41; | |
7665 case 9: | |
473 | 7666 CreateButtonInColumn(0, 0x12u); |
0 | 7667 v15 = 52; |
7668 goto LABEL_13; | |
7669 case 10: | |
473 | 7670 CreateButtonInColumn(0, 0x12u); |
0 | 7671 v15 = 53; |
7672 goto LABEL_13; | |
7673 case 11: | |
473 | 7674 CreateButtonInColumn(0, 0x12u); |
0 | 7675 v15 = 54; |
7676 LABEL_13: | |
473 | 7677 CreateButtonInColumn(1, v15); |
0 | 7678 v14 = 61; |
7679 goto LABEL_41; | |
7680 case 12: | |
473 | 7681 CreateButtonInColumn(0, 0x12u); |
0 | 7682 v16 = 55; |
7683 goto LABEL_37; | |
7684 default: | |
7685 break; | |
7686 } | |
7687 LABEL_43: | |
7688 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7689 } | |
7690 // F8B1E0: using guessed type int dword_F8B1E0; | |
7691 | |
7692 //----- (004B3E1E) -------------------------------------------------------- | |
7693 void __cdecl sub_4B3E1E() | |
7694 { | |
7695 NPCData *v0; // ST40_4@1 | |
7696 signed int v1; // edi@1 | |
165 | 7697 //GUIWindow *v2; // ecx@1 |
0 | 7698 |
167 | 7699 __debugbreak(); |
602 | 7700 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7701 v1 = 0; |
7702 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7703 pDialogueWindow->Release(); | |
165 | 7704 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7705 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7706 { |
832 | 7707 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7708 v1 = 1; |
7709 } | |
832 | 7710 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 7711 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 7712 } |
7713 | |
7714 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7715 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7716 { |
467 | 7717 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7718 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7719 ContractSelectText(pEventCode); |
0 | 7720 pDialogueWindow->Release(); |
492 | 7721 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7722 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7723 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7724 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
972 | 7725 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7726 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7727 } |
7728 // F8B19C: using guessed type int dword_F8B19C; | |
7729 | |
7730 //----- (004B3FE5) -------------------------------------------------------- | |
7731 void __fastcall sub_4B3FE5(int a4) | |
7732 { | |
7733 int v1; // edi@1 | |
7734 char *v2; // edi@1 | |
7735 | |
7736 v1 = a4; | |
7737 uDialogueType = 78; | |
827 | 7738 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7739 _4B254D_SkillMasteryTeacher(a4); |
7740 pDialogueWindow->Release(); | |
7741 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7742 v2 = ""; | |
832 | 7743 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7744 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7745 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7746 if ( contract_approved ) |
0 | 7747 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7748 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 7749 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7750 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7751 } |
7752 // F8B19C: using guessed type int dword_F8B19C; | |
7753 // F8B1A8: using guessed type int dword_F8B1A8; | |
7754 | |
7755 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7756 void NPCHireableDialogPrepare() |
7757 { | |
0 | 7758 signed int v0; // ebx@1 |
7759 NPCData *v1; // edi@1 | |
7760 | |
7761 v0 = 0; | |
459 | 7762 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7763 pDialogueWindow->Release(); |
7764 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7765 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7766 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7767 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7768 0); |
832 | 7769 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7770 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7771 { |
832 | 7772 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7773 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7774 v0 = 1; |
7775 } | |
832 | 7776 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7777 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
972 | 7778 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); |
747 | 7779 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7780 } |
7781 | |
7782 //----- (004B4224) -------------------------------------------------------- | |
423 | 7783 void _4B4224_UpdateNPCTopics( int _this ) |
7784 { | |
7785 int num_menu_buttons; // ebx@1 | |
0 | 7786 int i; // ebp@5 |
423 | 7787 // signed int v4; // ebp@9 |
7788 int v6; // eax@16 | |
7789 int v8; // eax@21 | |
7790 int v10; // eax@26 | |
7791 int v12; // eax@31 | |
7792 int v14; // eax@36 | |
7793 int v16; // eax@41 | |
0 | 7794 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7795 | |
423 | 7796 num_menu_buttons = 0; |
459 | 7797 pDialogueNPCCount = (_this + 1); |
0 | 7798 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7799 { | |
7800 pDialogueWindow->Release(); | |
7801 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7802 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7803 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
7804 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
832 | 7805 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
948 | 7806 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0); |
0 | 7807 } |
7808 else | |
7809 { | |
459 | 7810 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7811 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7812 { |
7813 pDialogueWindow->Release(); | |
7814 } | |
7815 else | |
7816 { | |
7817 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7818 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7819 } |
7820 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7821 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7822 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7823 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7824 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7825 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7826 { |
484 | 7827 sub_4B3B42(in_current_building_type); |
0 | 7828 } |
7829 else | |
7830 { | |
7831 if ( v17->joins ) | |
7832 { | |
423 | 7833 num_menu_buttons = 1; |
858 | 7834 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7835 } |
423 | 7836 if ( v17->evt_A) |
7837 { | |
7838 if ( num_menu_buttons < 4 ) | |
7839 { | |
7840 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7841 if ( v6 == 1 || v6 == 2 ) |
832 | 7842 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7843 } |
7844 } | |
7845 if ( v17->evt_B ) | |
7846 { | |
7847 if ( num_menu_buttons < 4 ) | |
7848 { | |
7849 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7850 if ( v8 == 1 || v8 == 2 ) |
832 | 7851 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7852 } |
7853 } | |
7854 if ( v17->evt_C ) | |
7855 { | |
7856 if ( num_menu_buttons < 4 ) | |
7857 { | |
7858 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7859 if ( v10 == 1 || v10 == 2 ) |
832 | 7860 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7861 } |
7862 } | |
7863 | |
7864 if ( v17->evt_D ) | |
7865 { | |
7866 if ( num_menu_buttons < 4 ) | |
7867 { | |
7868 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7869 if ( v12 == 1 || v12 == 2 ) |
832 | 7870 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7871 } |
7872 } | |
7873 if ( v17->evt_E ) | |
7874 { | |
7875 if ( num_menu_buttons < 4 ) | |
7876 { | |
7877 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7878 if ( v14 == 1 || v14 == 2 ) |
832 | 7879 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7880 } |
7881 } | |
7882 if ( v17->evt_F ) | |
7883 { | |
7884 if ( num_menu_buttons < 4 ) | |
7885 { | |
7886 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7887 if ( v16 == 1 || v16 == 2 ) |
832 | 7888 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7889 } |
7890 } | |
972 | 7891 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); |
0 | 7892 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7893 } | |
747 | 7894 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7895 } |
7896 | |
0 | 7897 } |
7898 | |
7899 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 7900 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
7901 { | |
0 | 7902 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7903 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 7904 v4 = pFontLucida->AlignText_Center(450, Str); |
7905 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 7906 } |
7907 | |
7908 //----- (004B46F8) -------------------------------------------------------- | |
7909 int __fastcall sub_4B46F8(int a1) | |
7910 { | |
7911 int v1; // eax@1 | |
7912 int i; // edx@1 | |
7913 | |
7914 v1 = 0; | |
7915 for ( i = 0; i < a1; ++i ) | |
7916 v1 += i + 1; | |
7917 return 1000 * v1; | |
7918 } | |
7919 | |
7920 //----- (004BC49B) -------------------------------------------------------- | |
651 | 7921 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 7922 { |
656 | 7923 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7924 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7925 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7926 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7927 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7928 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7929 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7930 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7931 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7932 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7933 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7934 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7935 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7936 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7937 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7938 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7939 //v1 = _this; |
656 | 7940 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7941 //v3 = v1; |
656 | 7942 uDialogueType = newDialogueType; |
7943 if (!speakingNPC->uFlags) | |
7944 { | |
7945 speakingNPC->uFlags = 1; | |
7946 //v3 = uDialogueType; | |
7947 } | |
7948 | |
7949 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
7950 { | |
7951 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
7952 } | |
7953 else if(newDialogueType == DIALOGUE_76) | |
7954 { | |
7955 if (speakingNPC->Hired()) | |
7956 { | |
7957 v8 = 0; | |
7958 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7959 { | |
7960 v6 = (char *)pNPCStats->pNewNPCData; | |
7961 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
7962 { | |
7963 ++v8; | |
7964 v6 += 76; | |
7965 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
7966 break; | |
7967 } | |
7968 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
7969 v6[8] &= 0x7Fu; | |
7970 } | |
1104 | 7971 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 7972 { |
7973 v11 = pParty->pHirelings; | |
7974 memset(v11, 0, sizeof(NPCData)); | |
7975 } | |
1104 | 7976 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 7977 { |
7978 v11 = &pParty->pHirelings[1]; | |
7979 memset(v11, 0, sizeof(NPCData)); | |
7980 } | |
7981 pParty->field_709 = 0; | |
1035 | 7982 pParty->CountHirelings(); |
656 | 7983 dword_591084 = 0; |
7984 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7985 dword_7241C8 = 0; | |
7986 return; | |
7987 } | |
7988 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7989 { | |
7990 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
7991 ShowStatusBarString(v7, 2u); | |
7992 } | |
7993 else | |
7994 { | |
7995 //v9 = v2->uProfession; | |
7996 if ( speakingNPC->uProfession != 51 ) | |
7997 { | |
7998 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
7999 if ( pParty->uNumGold < v10 ) | |
8000 { | |
8001 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8002 dialogue_show_profession_details = false; | |
8003 uDialogueType = 13; | |
8004 if ( uActiveCharacter ) | |
8005 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8006 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8007 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8008 if ( !dword_7241C8 ) | |
8009 pGame->Draw(); | |
8010 dword_7241C8 = 0; | |
8011 return; | |
8012 } | |
8013 Party::TakeGold(v10); | |
8014 } | |
8015 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8016 if ( pParty->pHirelings[0].pName ) | |
8017 { | |
8018 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8019 v15 = speakingNPC->pName; | |
8020 v13 = pParty->pHireling2Name; | |
8021 } | |
8022 else | |
8023 { | |
8024 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8025 v15 = speakingNPC->pName; | |
8026 v13 = pParty->pHireling1Name; | |
8027 } | |
8028 strcpy(v13, v15); | |
8029 pParty->field_709 = 0; | |
1035 | 8030 pParty->CountHirelings(); |
656 | 8031 |
8032 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8033 | |
711 | 8034 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8035 pDialogue_SpeakingActor->uAIState = Removed; |
8036 if ( uActiveCharacter ) | |
8037 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8038 } | |
8039 } | |
8040 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8041 { | |
8042 ArenaFight(); | |
8043 return; | |
8044 } | |
8045 else if(newDialogueType == DIALOGUE_9) | |
8046 { | |
8047 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8048 { | |
8049 if ( speakingNPC->uProfession != 41 ) | |
8050 speakingNPC->bHasUsedTheAbility = 1; | |
8051 | |
8052 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8053 } | |
8054 else | |
8055 { | |
8056 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8057 } | |
8058 } | |
8059 else if(newDialogueType == DIALOGUE_13) | |
8060 { | |
8061 if (!speakingNPC->Hired()) | |
8062 { | |
8063 sub_4B3E1E(); | |
8064 dialogue_show_profession_details = false; | |
8065 } | |
8066 else | |
8067 { | |
8068 v5 = 0; | |
8069 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8070 { | |
8071 v6 = (char *)pNPCStats->pNewNPCData; | |
8072 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8073 { | |
8074 ++v5; | |
8075 v6 += 76; | |
8076 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8077 break; | |
8078 } | |
8079 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8080 v6[8] &= 0x7Fu; | |
8081 } | |
1104 | 8082 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 8083 { |
8084 v11 = pParty->pHirelings; | |
8085 memset(v11, 0, sizeof(NPCData)); | |
8086 } | |
1104 | 8087 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 8088 { |
8089 v11 = &pParty->pHirelings[1]; | |
8090 memset(v11, 0, sizeof(NPCData)); | |
8091 } | |
8092 pParty->field_709 = 0; | |
1035 | 8093 pParty->CountHirelings(); |
656 | 8094 dword_591084 = 0; |
8095 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8096 dword_7241C8 = 0; | |
8097 return; | |
8098 } | |
8099 } | |
8100 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8101 { | |
8102 switch(newDialogueType) | |
8103 { | |
8104 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8105 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8106 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8107 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8108 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8109 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8110 } | |
8111 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8112 sub_4B3FE5(npc_event_id); //200-310 | |
8113 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8114 { //400-410 | |
8115 dword_F8B1D8 = newDialogueType; | |
8116 DrawJoinGuildWindow(npc_event_id - 400); | |
8117 } | |
8118 else | |
8119 { | |
8120 switch ( npc_event_id ) | |
8121 { | |
8122 case 139: | |
8123 sub_4B1ECE(); | |
8124 break; | |
8125 case 311: | |
8126 sub_4BBA85_bounties(); | |
8127 break; | |
8128 case 399: | |
8129 sub_4BBCDD(); | |
8130 break; | |
8131 default: | |
8132 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8133 current_npc_text = 0; |
656 | 8134 EventProcessor(npc_event_id, 0, 1); |
8135 activeLevelDecoration = NULL; | |
8136 break; | |
8137 } | |
8138 } | |
8139 } | |
8140 if ( !dword_7241C8 ) | |
8141 pGame->Draw(); | |
8142 dword_7241C8 = 0; | |
8143 } | |
0 | 8144 |
8145 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8146 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8147 { |
8148 int v6; // edx@8 | |
8149 int v7; // edx@9 | |
8150 int v8; // edx@10 | |
8151 unsigned __int8 v9; // zf@16 | |
8152 char v10; // sf@16 | |
8153 unsigned __int8 v11; // of@16 | |
702 | 8154 bool test; |
0 | 8155 |
907 | 8156 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8157 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8158 return 0; |
907 | 8159 switch( p2DEvents[_2da_idx - 1].uType ) |
8160 { | |
8161 case BildingType_WeaponShop: | |
8162 { | |
8163 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8164 break; | |
8165 } | |
8166 case BildingType_ArmorShop: | |
8167 { | |
8168 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8169 break; | |
8170 } | |
8171 case BildingType_MagicShop: | |
8172 { | |
8173 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8174 break; | |
8175 } | |
8176 case BildingType_AlchemistShop: | |
8177 { | |
8178 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8179 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8180 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8181 break; | |
8182 } | |
8183 default: | |
8184 { | |
8185 test = false; | |
8186 break; | |
8187 } | |
8188 } | |
702 | 8189 return test; |
8190 /* | |
8191 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8192 { |
8193 v11 = __OFSUB__(v5, 2); | |
8194 v9 = v5 == 2; | |
8195 v10 = v5 - 2 < 0; | |
8196 goto LABEL_23; | |
8197 } | |
702 | 8198 if ( p2DEvents[a2 - 1].uType > 2 ) |
8199 { | |
8200 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8201 { |
8202 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8203 return v5 == 16; | |
8204 return 1; | |
8205 } | |
702 | 8206 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8207 return 0; |
702 | 8208 if ( p2DEvents[a2 - 1].uType == 4) |
8209 { | |
8210 if ( v5 < 13 ) | |
8211 return 0; | |
8212 if ( v5 <= 14 ) | |
8213 return 1; | |
8214 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8215 return 0; | |
8216 v11 = __OFSUB__(v3, 771); | |
8217 v9 = v3 == 771; | |
8218 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8219 LABEL_23: |
702 | 8220 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8221 return 0; | |
8222 return 1; | |
8223 } | |
8224 } | |
8225 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8226 { | |
8227 if ( v5 >= 3 ) | |
8228 { | |
8229 v11 = __OFSUB__(v5, 9); | |
8230 v9 = v5 == 9; | |
8231 v10 = v5 - 9 < 0; | |
8232 goto LABEL_23; | |
8233 } | |
0 | 8234 } |
8235 return 0; | |
702 | 8236 */ |
0 | 8237 } |
8238 | |
8239 //----- (004B6478) -------------------------------------------------------- | |
711 | 8240 void sub_4B6478() |
8241 { | |
0 | 8242 GUIWindow *v0; // ebx@1 |
8243 Player *v1; // edi@1 | |
8244 unsigned int v2; // eax@1 | |
8245 signed int v3; // esi@1 | |
8246 int v4; // ebx@1 | |
8247 unsigned int v5; // esi@5 | |
8248 int v6; // edi@6 | |
8249 int result; // eax@13 | |
8250 GUIWindow *v8; // ebx@17 | |
8251 int v9; // eax@17 | |
8252 int v10; // ecx@17 | |
8253 unsigned int v11; // ecx@18 | |
8254 int v12; // eax@20 | |
8255 int v13; // eax@21 | |
8256 GUIButton *v14; // esi@27 | |
8257 int v15; // ecx@27 | |
8258 unsigned int v16; // eax@28 | |
8259 const char *v17; // ebx@29 | |
8260 int v18; // eax@29 | |
8261 unsigned int v19; // ecx@29 | |
8262 int v20; // eax@29 | |
8263 unsigned __int16 v21; // ax@29 | |
8264 unsigned __int16 v22; // ST14_2@36 | |
8265 int v23; // eax@36 | |
8266 const char *v24; // ST18_4@37 | |
8267 unsigned __int16 v25; // ST14_2@37 | |
8268 int v26; // eax@37 | |
8269 int v27; // [sp-4h] [bp-80h]@8 | |
8270 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8271 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8272 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8273 int v31; // [sp+68h] [bp-14h]@1 | |
8274 int v32; // [sp+6Ch] [bp-10h]@1 | |
8275 int v33; // [sp+70h] [bp-Ch]@17 | |
8276 int v34; // [sp+74h] [bp-8h]@17 | |
8277 int v35; // [sp+78h] [bp-4h]@17 | |
8278 | |
336 | 8279 v0 = window_SpeakInHouse; |
8280 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8281 v1 = pPlayers[uActiveCharacter]; |
8282 v28.uFrameX = 483; | |
8283 v28.uFrameWidth = 148; | |
8284 v28.uFrameZ = 334; | |
949 | 8285 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
8286 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
0 | 8287 v2 = 52 * (unsigned int)v0->ptr_1C; |
8288 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8289 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8290 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8291 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8292 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8293 v32 = v4; | |
8294 if ( v4 < v3 / 3 ) | |
8295 { | |
8296 v4 = v3 / 3; | |
8297 v32 = v3 / 3; | |
8298 } | |
749 | 8299 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8300 { |
8301 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8302 { | |
8303 v5 = 0; | |
8304 | |
8305 __debugbreak(); | |
8306 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8307 // or | |
8308 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8309 // or | |
8310 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8311 __debugbreak(); // whacky condition - fix |
0 | 8312 if (false |
8313 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8314 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8315 { |
8316 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8317 } | |
8318 else | |
8319 { | |
8320 if ( pParty->uNumGold < v4 ) | |
8321 { | |
8322 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8323 v27 = 4; | |
8324 } | |
8325 else | |
8326 { | |
8327 Party::TakeGold(v4); | |
8328 *(short *)v6 = 1; | |
8329 v27 = 2; | |
8330 } | |
735 | 8331 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8332 } |
8333 } | |
8334 else | |
8335 { | |
8336 v5 = 0; | |
8337 } | |
437 | 8338 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8339 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8340 { | |
990 | 8341 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 8342 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
8343 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8344 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8345 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8346 }*/ |
8347 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8348 return; // void func |
0 | 8349 } |
484 | 8350 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8351 { |
8352 v24 = pNPCTopics[171].pText; | |
8353 v25 = v31; | |
8354 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8355 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8356 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8357 return ; |
8358 } | |
8359 | |
8360 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8361 return; | |
0 | 8362 v8 = pDialogueWindow; |
8363 v33 = 0; | |
8364 v34 = 0; | |
8365 v29 = pDialogueWindow; | |
8366 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8367 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8368 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8369 if ( v9 >= v10 ) | |
8370 goto LABEL_40; | |
8371 do | |
8372 { | |
832 | 8373 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8374 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8375 { |
8376 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8377 v33 += v12; | |
8378 ++v34; | |
8379 } | |
8380 v13 = v8->pStartingPosActiveItem; | |
8381 ++v35; | |
8382 } | |
8383 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8384 if ( !v34 ) | |
8385 { | |
8386 LABEL_40: | |
135 | 8387 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8388 strcat(pTmpBuf, "\n \n"); |
8389 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8390 v22 = v31; | |
8391 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8392 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8393 return; | |
0 | 8394 } |
8395 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8396 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8397 v32 = (149 - v33) / v34; | |
8398 if ( (149 - v33) / v34 > 32 ) | |
8399 v32 = 32; | |
711 | 8400 |
8401 v35 = v8->pStartingPosActiveItem; | |
0 | 8402 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8403 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8404 { |
8405 v33 = 2; | |
8406 do | |
8407 { | |
8408 v14 = v8->GetControl(v35); | |
832 | 8409 v15 = v14->msg_param - 36; |
135 | 8410 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8411 { |
8412 v16 = 0; | |
8413 if ( !v1->pActiveSkills[v15] ) | |
8414 { | |
8415 v17 = pSkillNames[v15]; | |
8416 v14->uY = v32 + v34; | |
8417 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8418 v19 = v14->uY; | |
8419 v14->uHeight = v18; | |
8420 v20 = v19 + v18 - 1; | |
8421 v14->uW = v20; | |
8422 v34 = v20; | |
8423 v21 = v31; | |
8424 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8425 v21 = v30; | |
8426 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8427 goto LABEL_34; | |
8428 } | |
8429 } | |
8430 else | |
8431 { | |
8432 v16 = 0; | |
8433 } | |
8434 v14->uW = v16; | |
8435 v14->uHeight = v16; | |
8436 v14->uY = v16; | |
8437 LABEL_34: | |
8438 v8 = v29; | |
8439 ++v35; | |
8440 ++v33; | |
711 | 8441 } |
8442 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8443 } | |
8444 return; | |
0 | 8445 } |
8446 | |
8447 //----- (00405CFF) -------------------------------------------------------- | |
8448 void stru262_TurnBased::End(bool bPlaySound) | |
8449 { | |
8450 stru262_TurnBased *v2; // edi@1 | |
8451 int v3; // ebx@1 | |
8452 int v4; // esi@1 | |
8453 unsigned __int8 v5; // zf@1 | |
8454 unsigned __int8 v6; // sf@1 | |
8455 TurnBased_QueueElem *v7; // ecx@2 | |
8456 unsigned __int16 *pAttributes; // ecx@7 | |
8457 size_t v9; // edx@7 | |
8458 unsigned __int16 v10; // ax@8 | |
8459 TurnBased_QueueElem *v11; // ebx@12 | |
8460 ObjectType objType; // eax@13 | |
8461 int objID; // esi@13 | |
8462 int v14; // [sp+Ch] [bp-4h]@11 | |
8463 | |
8464 v2 = this; | |
8465 v3 = 0; | |
8466 v4 = 0; | |
8467 v5 = this->uActorQueueSize == 0; | |
8468 v6 = this->uActorQueueSize < 0; | |
8469 this->field_4 = 0; | |
8470 if ( !(v6 | v5) ) | |
8471 { | |
8472 v7 = this->pQueue; | |
8473 do | |
8474 { | |
848 | 8475 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8476 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8477 ++v4; |
8478 ++v7; | |
8479 } | |
8480 while ( v4 < v2->uActorQueueSize ); | |
8481 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8482 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8483 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8484 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8485 v9 = uNumSpriteObjects; |
0 | 8486 do |
8487 { | |
8488 v10 = *pAttributes; | |
8489 if ( *pAttributes & 4 ) | |
8490 { | |
8491 LOBYTE(v10) = v10 & 0xFB; | |
8492 *pAttributes = v10; | |
8493 } | |
8494 pAttributes += 56; | |
8495 --v9; | |
8496 } | |
8497 while ( v9 ); | |
8498 } | |
8499 v14 = 0; | |
8500 if ( v2->uActorQueueSize > 0 ) | |
8501 { | |
8502 v11 = v2->pQueue; | |
8503 do | |
8504 { | |
848 | 8505 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8506 objID = PID_ID(v11->uPackedID); | |
0 | 8507 if ( objType == OBJECT_Player ) |
8508 { | |
8509 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8510 } | |
8511 else | |
8512 { | |
8513 if ( objType == OBJECT_Actor ) | |
8514 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8515 } | |
8516 ++v14; | |
8517 ++v11; | |
8518 } | |
8519 while ( v14 < v2->uActorQueueSize ); | |
8520 v3 = 0; | |
8521 } | |
8522 pAudioPlayer->StopChannels(-1, -1); | |
8523 if ( bPlaySound != v3 ) | |
8524 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8525 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8526 pEventTimer->StopGameTime(); | |
8527 dword_50C994 = v3; | |
8528 dword_50C998_turnbased_icon_1A = v3; | |
8529 } | |
8530 // 50C994: using guessed type int dword_50C994; | |
8531 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8532 | |
8533 //----- (00405E14) -------------------------------------------------------- | |
8534 void stru262_TurnBased::_405E14() | |
8535 { | |
8536 stru262_TurnBased *v1; // esi@1 | |
8537 int v2; // ecx@1 | |
8538 SpellBuff *v3; // edi@2 | |
8539 Actor *v4; // ebx@3 | |
8540 signed int v5; // edx@20 | |
8541 AIDirection *v6; // esi@21 | |
8542 int v7; // eax@21 | |
8543 int v8; // eax@21 | |
8544 int v9; // eax@22 | |
8545 int v10; // eax@23 | |
8546 int v11; // eax@37 | |
8547 int v12; // eax@44 | |
8548 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8549 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8550 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8551 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8552 int v17; // [sp+5Ch] [bp-10h]@6 |
8553 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8554 int v19; // [sp+64h] [bp-8h]@8 | |
8555 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8556 | |
8557 v1 = this; | |
8558 v2 = 0; | |
8559 v18 = v1; | |
8560 v20 = 0; | |
8561 if ( (signed int)uNumActors > 0 ) | |
8562 { | |
90 | 8563 //v3 = pActors;//[0].pActorBuffs; |
8564 v16 = pActors;//[0].pActorBuffs; | |
8565 v3 = v16->pActorBuffs; | |
0 | 8566 do |
8567 { | |
90 | 8568 v4 = v16; |
8569 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8570 v17 = v2; |
8571 else | |
8572 v17 = 1; | |
8573 v19 = v2; | |
8574 do | |
8575 { | |
8576 if ( v19 != 10 ) | |
8577 { | |
8578 v3->_4585CA(pParty->uTimePlayed); | |
8579 v2 = 0; | |
8580 } | |
8581 ++v19; | |
8582 ++v3; | |
8583 } | |
8584 while ( v19 < 22 ); | |
8585 if ( v17 != v2 | |
8586 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8587 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8588 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8589 if ( !(v4->uAttributes & 0x80) ) | |
8590 { | |
8591 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8592 { | |
8593 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8594 { | |
8595 v5 = v4->uCurrentActionLength; | |
8596 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8597 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8598 { | |
417 | 8599 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8600 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8601 v7 = v4->uAIState; |
8602 memcpy(&v15, v6, sizeof(v15)); | |
8603 v8 = v7 - 4; | |
8604 memcpy(&v14, &v15, sizeof(v14)); | |
8605 if ( v8 ) | |
8606 { | |
8607 v9 = v8 - 1; | |
8608 if ( v9 ) | |
8609 { | |
8610 v10 = v9 - 6; | |
8611 if ( v10 ) | |
8612 { | |
8613 if ( v10 != 8 ) | |
414 | 8614 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8615 } |
8616 } | |
8617 } | |
8618 else | |
8619 { | |
8620 v4->uCurrentActionTime = 0; | |
8621 v4->uCurrentActionLength = 0; | |
8622 v4->uAIState = Dead; | |
8623 v4->UpdateAnimation(); | |
8624 } | |
8625 v1 = v18; | |
8626 v2 = 0; | |
8627 } | |
8628 } | |
8629 } | |
8630 } | |
8631 ++v20; | |
90 | 8632 v3 = v16[1].pActorBuffs; |
8633 ++v16; | |
0 | 8634 } |
8635 while ( (signed int)v20 < (signed int)uNumActors ); | |
8636 } | |
8637 if ( v1->field_4 == 1 ) | |
8638 { | |
8639 v12 = v1->field_8; | |
8640 if ( v12 == 64 ) | |
8641 { | |
8642 v1->_406A63(); | |
8643 } | |
8644 else | |
8645 { | |
8646 if ( v12 > v2 ) | |
8647 { | |
8648 v1->_406B9F(); | |
8649 } | |
8650 else | |
8651 { | |
8652 v1->_406AFE(); | |
8653 v1->field_10 = 100; | |
8654 } | |
8655 } | |
8656 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8657 return; | |
8658 } | |
8659 if ( v1->field_4 == 2 ) | |
8660 { | |
8661 if ( !(v1->field_18 & 1) ) | |
8662 { | |
8663 v11 = v1->field_10; | |
8664 if ( v11 == 100 ) | |
8665 { | |
8666 v1->StartTurn(); | |
8667 LABEL_39: | |
8668 v1->_40652A(); | |
8669 return; | |
8670 } | |
8671 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8672 { | |
8673 v1->_4065B0(); | |
8674 goto LABEL_39; | |
8675 } | |
8676 } | |
8677 v1->NextTurn(); | |
8678 return; | |
8679 } | |
8680 if ( v1->field_4 == 3 ) | |
8681 { | |
8682 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8683 { | |
8684 v1->field_18 &= 0xFFFFFFF7u; | |
8685 v1->field_4 = 1; | |
8686 v1->field_8 = 64; | |
8687 } | |
8688 else | |
8689 { | |
8690 v1->_406FA8(); | |
8691 } | |
8692 } | |
8693 } | |
8694 | |
8695 //----- (0043FDED) -------------------------------------------------------- | |
8696 void PrepareActorRenderList_BLV() | |
8697 { | |
8698 RenderBillboard *v0; // esi@0 | |
8699 unsigned __int16 v3; // ax@3 | |
8700 unsigned int v4; // eax@5 | |
8701 unsigned __int16 v5; // cx@5 | |
8702 int v6; // esi@5 | |
8703 unsigned int v7; // eax@7 | |
8704 int v8; // eax@10 | |
8705 SpriteFrame *v9; // eax@16 | |
8706 SpriteFrame *v10; // ebx@18 | |
8707 //int *v11; // eax@18 | |
8708 int v12; // ecx@28 | |
8709 //IndoorCameraD3D **v14; // eax@36 | |
8710 double v15; // st7@36 | |
8711 float v16; // eax@36 | |
8712 //double v17; // ST30_8@36 | |
8713 signed __int64 v18; // qtt@36 | |
8714 int v19; // ST5C_4@36 | |
8715 signed __int64 v20; // qtt@37 | |
8716 int v21; // ST5C_4@37 | |
8717 signed __int16 v22; // cx@39 | |
8718 int v23; // ST50_4@40 | |
8719 signed int v24; // ecx@40 | |
8720 int v25; // edx@44 | |
8721 __int16 v26; // ax@44 | |
8722 //MonsterDesc *v27; // edx@44 | |
8723 //int v28; // ecx@44 | |
8724 unsigned __int8 v29; // zf@44 | |
8725 unsigned __int8 v30; // sf@44 | |
8726 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8727 int v32; // [sp+1Ch] [bp-38h]@5 | |
8728 int a3; // [sp+20h] [bp-34h]@5 | |
8729 int a2; // [sp+24h] [bp-30h]@5 | |
8730 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8731 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8732 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8733 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8734 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8735 int a6; // [sp+40h] [bp-14h]@34 | |
8736 int v43; // [sp+44h] [bp-10h]@34 | |
8737 int z; // [sp+48h] [bp-Ch]@32 | |
8738 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8739 int x; // [sp+50h] [bp-4h]@32 | |
8740 | |
8741 for (uint i = 0; i < uNumActors; ++i) | |
8742 { | |
8743 auto p = pActors + i; | |
8744 | |
8745 if (p->uAIState == Removed || | |
8746 p->uAIState == Disabled) | |
8747 continue; | |
8748 | |
8749 a5 = p->uSectorID; | |
8750 a2 = p->vPosition.y; | |
8751 a1a = p->vPosition.x; | |
8752 a3 = p->vPosition.z; | |
8753 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8754 LOWORD(v0) = p->uYawAngle; | |
8755 v5 = p->uCurrentActionAnimation; | |
8756 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8757 v32 = v6; | |
8758 if ( pParty->bTurnBasedModeOn ) | |
8759 { | |
8760 if ( v5 == 1 ) | |
8761 { | |
8762 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8763 goto LABEL_10; | |
8764 } | |
8765 } | |
8766 else | |
8767 { | |
8768 if ( v5 == 1 ) | |
8769 { | |
8770 v7 = pBLVRenderParams->field_0_timer_; | |
8771 LABEL_10: | |
8772 v8 = i * 32 + v7; | |
8773 goto LABEL_12; | |
8774 } | |
8775 } | |
8776 v8 = p->uCurrentActionTime; | |
8777 LABEL_12: | |
8778 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8779 v8 = 0; | |
8780 v31 = p->pSpriteIDs[v5]; | |
8781 if (p->uAIState == Resurrected) | |
8782 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8783 else | |
8784 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8785 v41 = 0; | |
8786 v10 = v9; | |
8787 //v11 = (int *)v9->uFlags; | |
8788 if (v9->uFlags & 2) | |
8789 v41 = 2; | |
8790 if (v9->uFlags & 0x40000) | |
8791 v41 |= 0x40u; | |
8792 if (v9->uFlags & 0x20000) | |
8793 LOBYTE(v41) = v41 | 0x80; | |
8794 v0 = (RenderBillboard *)(256 << v6); | |
8795 if ( (unsigned int)v0 & v9->uFlags) | |
8796 v41 |= 4u; | |
8797 if ( v10->uGlowRadius ) | |
8798 { | |
8799 //LOBYTE(v11) = byte_4E94D3; | |
8800 pMobileLightsStack->AddLight( | |
8801 a1a, | |
8802 a2, | |
8803 a3, | |
8804 a5, | |
8805 v10->uGlowRadius, | |
8806 0xFFu, | |
8807 0xFFu, | |
8808 0xFFu, | |
8809 byte_4E94D3); | |
8810 } | |
8811 v12 = 0; | |
8812 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8813 continue; | |
8814 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8815 { | |
8816 ++v12; | |
8817 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8818 goto _continue; | |
8819 } | |
8820 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8821 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8822 continue; | |
8823 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8824 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8825 if (uNumBillboardsToDraw >= 500) | |
8826 break; | |
8827 ++uNumBillboardsToDraw; | |
8828 ++uNumSpritesDrawnThisFrame; | |
8829 p->uAttributes |= 8u; | |
8830 v29 = pRenderer->pRenderD3D == 0; | |
8831 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8832 v0->uPalette = v10->uPaletteIndex; | |
8833 v0->uIndoorSectorID = a5; | |
8834 if ( v29 ) | |
8835 { | |
8836 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8837 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8838 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8839 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8840 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8841 } | |
8842 else | |
8843 { | |
8844 //v14 = &pGame->pIndoorCameraD3D; | |
8845 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8846 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8847 v16 = v0->fov_x; | |
8848 v0->fov_y = v15; | |
8849 //v17 = v16 + 6.7553994e15; | |
8850 LODWORD(v18) = 0; | |
8851 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8852 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8853 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8854 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8855 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8856 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8857 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8858 { | |
8859 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8860 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8861 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8862 goto LABEL_43; |
8863 } | |
8864 } | |
8865 else | |
8866 { | |
8867 v22 = p->pActorBuffs[3].uPower; | |
8868 if ( v22 ) | |
8869 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8870 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8871 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8872 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8873 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8874 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8875 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8876 goto LABEL_44; |
8877 } | |
8878 } | |
8879 LABEL_44: | |
8880 HIWORD(v25) = HIWORD(x); | |
430 | 8881 v0->world_x = a1a; |
8882 v0->world_y = a2; | |
8883 v0->world_z = a3; | |
0 | 8884 v0->uScreenSpaceX = v43; |
8885 v0->uScreenSpaceY = a6; | |
8886 LOWORD(v25) = 0; | |
8887 LOBYTE(v26) = v41; | |
194 | 8888 |
862 | 8889 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8890 v0->actual_z = HIWORD(x); |
862 | 8891 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8892 |
0 | 8893 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8894 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8895 v0->field_1E = v41; | |
8896 v0->pSpriteFrame = v10; | |
8897 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8898 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8899 { | |
8900 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8901 v0->field_1E = v26; | |
8902 } | |
8903 | |
8904 _continue: | |
8905 ; | |
8906 } | |
8907 } | |
8908 | |
8909 //----- (00444732) -------------------------------------------------------- | |
428 | 8910 char *GetEventHintString(unsigned int uEventID) |
8911 { | |
8912 signed int event_index; // edx@1 | |
8913 int event_pos; // esi@4 | |
0 | 8914 char *result; // eax@6 |
428 | 8915 unsigned int str_index; // eax@9 |
8916 int i; // esi@11 | |
8917 _evt_raw* test_evt; | |
8918 _evt_raw* last_evt; | |
8919 | |
8920 event_index = 0; | |
8921 if ( uLevelEVT_NumEvents <= 0 ) | |
8922 return NULL; | |
8923 | |
8924 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 8925 while ( 1 ) |
8926 { | |
428 | 8927 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
8928 { | |
8929 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
8930 last_evt=test_evt; | |
8931 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
8932 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 8933 break; |
8934 } | |
428 | 8935 ++event_index; |
8936 if ( event_index >= uLevelEVT_NumEvents ) | |
8937 return NULL; | |
8938 } | |
8939 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8940 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
8941 { | |
8942 str_index = EVT_DWORD(test_evt->v5); | |
8943 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 8944 } |
8945 else | |
8946 { | |
428 | 8947 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
8948 { | |
8949 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
8950 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8951 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
8952 { | |
8953 str_index = EVT_DWORD(test_evt->v5); | |
8954 if ( str_index < 600 ) | |
8955 return (char *)p2DEvents[str_index - 1].pName; | |
8956 } | |
8957 } | |
8958 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
8959 } | |
8960 | |
0 | 8961 return result; |
8962 } |