Mercurial > mm7
annotate mm7_4.cpp @ 1043:b725a9cdec0c
m
author | Ritor1 |
---|---|
date | Tue, 21 May 2013 15:17:09 +0600 |
parents | 6afa77761a00 |
children | c94d6a37d298 |
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; | |
287 v15 = v14 | word_721460_xs[j] < x; | |
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; |
519 v19 = v18 | word_721040[i] < X; | |
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; | |
725 v14 = v13 | word_720DB0_xs[v12] < v31; | |
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 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1528 if ( v3 ) | |
1529 v4 = AllocAlignedMem(v3, 640); | |
1530 else | |
1531 v4 = 0; | |
1532 v2->pMemBlocks[0] = v4; | |
1533 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1534 if ( v5 ) | |
1535 v6 = AllocAlignedMem(v5, 640); | |
1536 else | |
1537 v6 = 0; | |
1538 v2->pMemBlocks[1] = v6; | |
1539 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1540 if ( v7 ) | |
1541 v8 = AllocAlignedMem(v7, 640); | |
1542 else | |
1543 v8 = 0; | |
1544 v2->pMemBlocks[2] = v8; | |
1545 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1546 if ( v9 ) | |
1547 v10 = AllocAlignedMem(v9, 640); | |
1548 else | |
1549 v10 = 0; | |
1550 v2->pMemBlocks[3] = v10; | |
1551 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1552 if ( v11 ) | |
1553 v12 = AllocAlignedMem(v11, 640); | |
1554 else | |
1555 v12 = 0; | |
1556 v2->pMemBlocks[4] = v12; | |
1557 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1558 if ( v13 ) | |
1559 v14 = AllocAlignedMem(v13, 640); | |
1560 else | |
1561 v14 = 0; | |
1562 v2->pMemBlocks[5] = v14; | |
1563 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1564 if ( v15 ) | |
1565 v16 = AllocAlignedMem(v15, 640); | |
1566 else | |
1567 v16 = 0; | |
1568 v2->pMemBlocks[6] = v16; | |
1569 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1570 if ( v17 ) | |
1571 v18 = AllocAlignedMem(v17, 640); | |
1572 else | |
1573 v18 = 0; | |
1574 v2->pMemBlocks[7] = v18; | |
1575 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1576 if ( v19 ) | |
1577 v20 = AllocAlignedMem(v19, 640); | |
1578 else | |
1579 v20 = 0; | |
1580 v2->pMemBlocks[8] = v20; | |
1581 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1582 if ( v21 ) | |
1583 v22 = AllocAlignedMem(v21, 640); | |
1584 else | |
1585 v22 = 0; | |
1586 v2->pMemBlocks[9] = v22; | |
1587 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1588 if ( v23 ) | |
1589 v24 = AllocAlignedMem(v23, 640); | |
1590 else | |
1591 v24 = 0; | |
1592 v2->pMemBlocks[10] = v24; | |
1593 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1594 if ( v25 ) | |
1595 v26 = AllocAlignedMem(v25, 640); | |
1596 else | |
1597 v26 = 0; | |
1598 v2->field_8C = 0; | |
1599 v2->pMemBlocks[11] = v26;*/ | |
1600 } | |
1601 | |
1602 //----- (00489810) -------------------------------------------------------- | |
1603 stru12::~stru12() | |
1604 { | |
1605 for (int i = 0; i < 12; ++i) | |
1606 delete pMemBlocks[i]; | |
1607 /*if ( v2 ) | |
1608 stru12_MemoryBlock::dtor(v2, 1); | |
1609 v3 = v1->pMemBlocks[1]; | |
1610 if ( v3 ) | |
1611 stru12_MemoryBlock::dtor(v3, 1); | |
1612 v4 = v1->pMemBlocks[2]; | |
1613 if ( v4 ) | |
1614 stru12_MemoryBlock::dtor(v4, 1); | |
1615 v5 = v1->pMemBlocks[3]; | |
1616 if ( v5 ) | |
1617 stru12_MemoryBlock::dtor(v5, 1); | |
1618 v6 = v1->pMemBlocks[4]; | |
1619 if ( v6 ) | |
1620 stru12_MemoryBlock::dtor(v6, 1); | |
1621 v7 = v1->pMemBlocks[5]; | |
1622 if ( v7 ) | |
1623 stru12_MemoryBlock::dtor(v7, 1); | |
1624 v8 = v1->pMemBlocks[6]; | |
1625 if ( v8 ) | |
1626 stru12_MemoryBlock::dtor(v8, 1); | |
1627 v9 = v1->pMemBlocks[7]; | |
1628 if ( v9 ) | |
1629 stru12_MemoryBlock::dtor(v9, 1); | |
1630 v10 = v1->pMemBlocks[8]; | |
1631 if ( v10 ) | |
1632 stru12_MemoryBlock::dtor(v10, 1); | |
1633 v11 = v1->pMemBlocks[9]; | |
1634 if ( v11 ) | |
1635 stru12_MemoryBlock::dtor(v11, 1); | |
1636 v12 = v1->pMemBlocks[10]; | |
1637 if ( v12 ) | |
1638 stru12_MemoryBlock::dtor(v12, 1); | |
1639 v13 = v1->pMemBlocks[11]; | |
1640 if ( v13 ) | |
1641 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1642 } | |
1643 | |
1644 //----- (004898BF) -------------------------------------------------------- | |
1645 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1646 { | |
1647 stru12_MemoryBlock *v2; // esi@1 | |
1648 void *v3; // ST00_4@1 | |
1649 | |
1650 v2 = this; | |
1651 v3 = this->pBlockBase; | |
1652 this->pAlignedBlock = 0; | |
1653 free(v3); | |
1654 v2->pBlockBase = 0; | |
1655 /*if ( a2 & 1 ) | |
1656 free(v2);*/ | |
1657 } | |
1658 | |
1659 //----- (004898E6) -------------------------------------------------------- | |
1660 void stru12::_4898E6() | |
1661 { | |
1662 void *v1; // eax@1 | |
1663 void *v2; // edx@1 | |
1664 char *v3; // edi@2 | |
1665 double v4; // st7@2 | |
1666 char *v5; // ebx@2 | |
1667 double v6; // st6@3 | |
1668 double v7; // st5@3 | |
1669 double v8; // st4@3 | |
1670 int v9; // esi@3 | |
1671 double v10; // st3@3 | |
1672 float v11; // ST34_4@5 | |
1673 double v12; // st6@10 | |
1674 double v13; // ST0C_8@10 | |
1675 char *v14; // [sp+14h] [bp-44h]@2 | |
1676 char *v15; // [sp+18h] [bp-40h]@2 | |
1677 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1678 char *v17; // [sp+20h] [bp-38h]@2 | |
1679 char *v18; // [sp+24h] [bp-34h]@2 | |
1680 float v19; // [sp+30h] [bp-28h]@3 | |
1681 float v20; // [sp+38h] [bp-20h]@3 | |
1682 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1683 int v22; // [sp+40h] [bp-18h]@1 | |
1684 char *v23; // [sp+44h] [bp-14h]@2 | |
1685 char *v24; // [sp+48h] [bp-10h]@2 | |
1686 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1687 float v26; // [sp+50h] [bp-8h]@3 | |
1688 float v27; // [sp+54h] [bp-4h]@3 | |
1689 | |
731 | 1690 __debugbreak(); |
0 | 1691 v22 = 0; |
1692 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1693 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1694 if ( this->field_8C > 0 ) | |
1695 { | |
1696 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1697 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1698 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1699 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1700 v25 = (int)v1 - (int)v2; | |
1701 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1702 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1703 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1704 v4 = 1.0; | |
1705 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1706 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1707 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1708 do | |
1709 { | |
1710 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1711 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1712 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1713 v7 = pIndoorCamera->fRotationYCosine; | |
1714 v8 = pIndoorCamera->fRotationYSine; | |
1715 v20 = pIndoorCamera->fRotationXCosine; | |
1716 v19 = pIndoorCamera->fRotationXSine; | |
1717 v9 = (int)((char *)v2 + (int)v21); | |
1718 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1719 if ( pIndoorCamera->sRotationX ) | |
1720 { | |
1721 v11 = v10; | |
1722 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1723 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1724 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1725 } | |
1726 else | |
1727 { | |
1728 *(float *)v9 = v10; | |
1729 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1730 *(float *)((char *)v2 + (int)v5) = v6; | |
1731 } | |
1732 if ( *(float *)v9 >= 8.0 ) | |
1733 { | |
1734 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1735 { | |
1736 *(int *)v2 = 0; | |
1737 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1738 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1739 - v12 * *(float *)((char *)v2 + (int)v3); | |
1740 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1741 - v12 * *(float *)((char *)v2 + (int)v5); | |
1742 *(float *)((char *)v2 + (int)v16) = v4 | |
1743 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1744 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1745 v13 = *(float *)v9 + 6.7553994e15; | |
1746 v4 = 1.0; | |
1747 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1748 } | |
1749 else | |
1750 { | |
1751 *(int *)v2 = 2; | |
1752 } | |
1753 } | |
1754 else | |
1755 { | |
1756 *(int *)v2 = 1; | |
1757 } | |
1758 ++v22; | |
1759 v2 = (char *)v2 + 4; | |
1760 } | |
1761 while ( v22 < this->field_8C ); | |
1762 } | |
1763 this->field_8C = 0; | |
1764 } | |
1765 | |
1766 //----- (0048A959) -------------------------------------------------------- | |
1767 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1768 { | |
1769 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1770 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1771 b = (uColor & 0x000000FF) / 255.0f; | |
1772 | |
1773 float h, s, v; | |
1774 RGB2HSV(&h, &s, r, g, b, &v); | |
1775 | |
1776 if ( h_replace != -1.0 ) | |
1777 h = h_replace; | |
1778 if ( s_replace != -1.0 ) | |
1779 s = s_replace; | |
1780 if ( v_replace != -1.0 ) | |
1781 v = v_replace; | |
1782 HSV2RGB(&r, &g, &b, h, s, v); | |
1783 | |
1784 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1785 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1786 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1787 } | |
1788 | |
1789 //----- (0048B561) -------------------------------------------------------- | |
1790 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1791 { | |
1792 //v2 = a2 - 0.5; | |
1793 //v3 = v2 + 6.7553994e15; | |
1025 | 1794 int v4 = floorf((a2 - 0.5f) + 0.5f); |
0 | 1795 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; |
1796 //v5 = v7 + 6.7553994e15; | |
1797 //return LODWORD(v5) | (v4 << 16); | |
1798 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1799 return v5 | (v4 << 16); | |
1800 } | |
1801 | |
1802 //----- (00491E3A) -------------------------------------------------------- | |
1803 void __cdecl sub_491E3A() | |
1804 { | |
1805 Player *v0; // ebx@1 | |
1806 signed int v1; // esi@3 | |
1807 char *v2; // eax@4 | |
1808 unsigned int v3; // eax@7 | |
1809 unsigned int v4; // edx@8 | |
1810 char *v5; // ecx@9 | |
1811 int v6; // edi@17 | |
1812 Texture *v7; // ebx@18 | |
1813 struct IDirect3DTexture2 **v8; // eax@19 | |
1814 struct IDirect3DTexture2 *v9; // eax@20 | |
1815 struct IDirectDrawSurface **v10; // eax@22 | |
1816 struct IDirectDrawSurface *v11; // eax@23 | |
1817 int v12; // eax@26 | |
1818 | |
1819 v0 = pParty->pPlayers; | |
1820 do | |
1821 { | |
203 | 1822 if (SoundSetAction[24][0]) |
0 | 1823 { |
1824 v1 = 0; | |
764 | 1825 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1826 { |
1827 LABEL_7: | |
1828 v3 = 0; | |
1829 } | |
1830 else | |
1831 { | |
1832 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1833 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1834 { |
1835 ++v1; | |
1836 v2 += 120; | |
764 | 1837 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1838 goto LABEL_7; |
1839 } | |
1840 v3 = v1; | |
1841 } | |
764 | 1842 pSoundList->UnloadSound(v3, 1); |
0 | 1843 v4 = 0; |
764 | 1844 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1845 { |
1846 LABEL_12: | |
1847 v4 = 0; | |
1848 } | |
1849 else | |
1850 { | |
1851 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1852 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1853 { |
1854 ++v4; | |
1855 v5 += 120; | |
764 | 1856 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1857 goto LABEL_12; |
1858 } | |
1859 } | |
764 | 1860 pSoundList->UnloadSound(v4, 1); |
0 | 1861 } |
1862 ++v0; | |
1863 } | |
1864 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1865 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1866 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1867 { |
1868 v7 = &pIcons_LOD->pTextures[v6]; | |
1869 do | |
1870 { | |
1871 v7->Release(); | |
1872 v8 = pIcons_LOD->pHardwareTextures; | |
1873 if ( v8 ) | |
1874 { | |
1875 v9 = v8[v6]; | |
1876 if ( v9 ) | |
1877 { | |
1878 v9->Release(); | |
1879 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1880 } | |
1881 } | |
1882 v10 = pIcons_LOD->pHardwareSurfaces; | |
1883 if ( v10 ) | |
1884 { | |
1885 v11 = v10[v6]; | |
1886 if ( v11 ) | |
1887 { | |
1888 v11->Release(); | |
1889 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1890 } | |
1891 } | |
1892 --v6; | |
1893 --v7; | |
1894 } | |
33 | 1895 while ( v6 >= pIcons_LOD->pFacesLock ); |
1896 } | |
1897 v12 = pIcons_LOD->pFacesLock; | |
1898 pIcons_LOD->pFacesLock = 0; | |
0 | 1899 pIcons_LOD->uNumLoadedFiles = v12; |
1900 } | |
1901 // 4ED498: using guessed type char byte_4ED498; | |
1902 | |
1903 //----- (0049387A) -------------------------------------------------------- | |
1904 int CycleCharacter(unsigned int _this) | |
1905 { | |
1906 signed int result; // eax@1 | |
1907 signed int v2; // ecx@2 | |
1908 signed int v3; // ecx@8 | |
1909 | |
1910 result = uActiveCharacter; | |
1911 if ( _this ) | |
1912 { | |
1913 v2 = 0; | |
1914 while ( 1 ) | |
1915 { | |
1916 --result; | |
1917 if ( result < 1 ) | |
1918 result = 4; | |
1919 if ( !pPlayers[result]->uTimeToRecovery ) | |
1920 break; | |
1921 ++v2; | |
1922 if ( v2 >= 4 ) | |
1923 return uActiveCharacter; | |
1924 } | |
1925 } | |
1926 else | |
1927 { | |
1928 v3 = 0; | |
1929 while ( 1 ) | |
1930 { | |
1931 ++result; | |
1932 if ( result > 4 ) | |
1933 result = 1; | |
1934 if ( !pPlayers[result]->uTimeToRecovery ) | |
1935 break; | |
1936 ++v3; | |
1937 if ( v3 >= 4 ) | |
1938 return uActiveCharacter; | |
1939 } | |
1940 } | |
1941 return result; | |
1942 } | |
1943 //----- (004938D1) -------------------------------------------------------- | |
1944 void __fastcall Rest(unsigned int uHoursToSleep) | |
1945 { | |
1946 unsigned int v1; // esi@1 | |
1947 double v2; // st7@3 | |
1948 Player **v3; // esi@3 | |
1949 | |
1950 v1 = uHoursToSleep; | |
1951 if ( uHoursToSleep > 240 ) | |
1952 InitializeActors(); | |
1953 v2 = (double)(7680 * v1) * 0.033333335; | |
1954 pParty->uTimePlayed += (signed __int64)v2; | |
1955 v3 = &pPlayers[1]; | |
1956 do | |
1957 { | |
1958 (*v3)->Recover((signed __int64)v2); | |
1959 ++v3; | |
1960 } | |
1961 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1962 _494035_timed_effects__water_walking_damage__etc(); | |
1963 } | |
1964 | |
1965 //----- (00493938) -------------------------------------------------------- | |
1966 int __cdecl _493938_regenerate() | |
1967 { | |
1968 int v0; // edi@1 | |
1969 signed __int64 v1; // qax@1 | |
1970 int v2; // ecx@1 | |
1971 int result; // eax@1 | |
1972 int v4; // eax@2 | |
1973 int v5; // edi@5 | |
112 | 1974 int *v6; // ecx@5 |
0 | 1975 char v7; // sf@5 |
112 | 1976 int *v8; // ecx@10 |
0 | 1977 int v9; // edi@15 |
1978 signed int v10; // eax@15 | |
1979 __int16 *v11; // edx@16 | |
1980 int v12; // eax@20 | |
1981 int v13; // ebx@20 | |
1982 unsigned int *v14; // esi@21 | |
1983 unsigned int v15; // ecx@21 | |
1984 unsigned int v16; // eax@21 | |
1985 int v17; // edx@21 | |
1986 int v18; // eax@21 | |
1987 signed int v19; // eax@21 | |
1988 signed int v20; // ebx@25 | |
1989 Player *v21; // esi@25 | |
1990 ITEM_EQUIP_TYPE v22; // edi@30 | |
1991 //int v23; // edx@31 | |
1992 signed int v24; // ecx@32 | |
1993 signed int v25; // eax@33 | |
1994 int v26; // eax@35 | |
1995 int v27; // eax@36 | |
1996 int v28; // eax@37 | |
1997 int v29; // eax@40 | |
1998 int v30; // eax@41 | |
1999 signed int v31; // ecx@53 | |
2000 char *v32; // eax@53 | |
2001 char *v33; // edi@82 | |
2002 int v34; // ecx@88 | |
2003 int v35; // eax@88 | |
2004 char *v36; // edi@99 | |
2005 int v37; // edi@104 | |
2006 int v38; // edi@106 | |
2007 int v39; // edi@111 | |
2008 int v40; // ecx@113 | |
2009 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
|
2010 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2011 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2012 int v44; // [sp+210h] [bp-20h]@22 | |
2013 int v45; // [sp+214h] [bp-1Ch]@25 | |
2014 int v46; // [sp+218h] [bp-18h]@25 | |
2015 int v47; // [sp+21Ch] [bp-14h]@25 | |
2016 int v48; // [sp+220h] [bp-10h]@25 | |
2017 int v49; // [sp+224h] [bp-Ch]@24 | |
2018 int v50; // [sp+228h] [bp-8h]@25 | |
2019 int v51; // [sp+22Ch] [bp-4h]@2 | |
2020 | |
2021 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2022 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2023 v2 = (signed int)v1 / 60; | |
2024 result = (signed int)v1 / 60 + 5; | |
2025 if ( v0 >= result ) | |
2026 { | |
2027 v51 = 0; | |
2028 v4 = (v0 - v2) / 5; | |
2029 if (pParty->FlyActive()) | |
2030 { | |
2031 if ( pParty->bFlying ) | |
2032 { | |
569 | 2033 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2034 { // colliding with something in the air - fall down | |
2035 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2036 //__debugbreak(); | |
2037 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2038 v7 = *v6 < v5; |
2039 *v6 -= v5; | |
0 | 2040 if ( v7 ) |
2041 { | |
112 | 2042 *v6 = 0; |
0 | 2043 pParty->uFlags &= 0xFFFFFFBFu; |
2044 pParty->bFlying = 0; | |
2045 v51 = 1; | |
2046 } | |
2047 } | |
2048 } | |
2049 } | |
569 | 2050 |
0 | 2051 if (pParty->WaterWalkActive()) |
2052 { | |
569 | 2053 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2054 { | |
2055 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2056 { // taking on water | |
2057 //__debugbreak(); | |
2058 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2059 v7 = *v8 < v4; |
2060 *v8 -= v4; | |
0 | 2061 if ( v7 ) |
2062 { | |
112 | 2063 *v8 = 0; |
569 | 2064 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2065 v51 = 1; |
2066 } | |
2067 } | |
2068 } | |
2069 } | |
569 | 2070 |
0 | 2071 if (pParty->ImmolationActive()) |
2072 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2073 //SpriteObject::SpriteObject(&a1); |
0 | 2074 v9 = 0; |
2075 a3.z = 0; | |
2076 a3.y = 0; | |
2077 a3.x = 0; | |
2078 a1.stru_24.Reset(); | |
822 | 2079 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2080 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2081 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2082 a1.uType = 1070; |
822 | 2083 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2084 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2085 { | |
2086 LABEL_19: | |
2087 LOWORD(v10) = 0; | |
2088 } | |
2089 else | |
2090 { | |
2091 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 2092 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 2093 { |
2094 ++v10; | |
2095 v11 += 28; | |
2096 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2097 goto LABEL_19; | |
2098 } | |
2099 } | |
2100 a1.uObjectDescID = v10; | |
2101 a1.field_60_distance_related_prolly_lod = 0; | |
2102 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2103 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2104 a1.uAttributes = 0; |
2105 a1.uSectorID = 0; | |
2106 a1.uSpriteFrameID = 0; | |
822 | 2107 a1.spell_caster_pid = v12; |
0 | 2108 a1.uFacing = 0; |
2109 a1.uSoundID = 0; | |
2110 v13 = sub_46A89E((int)v41, 100, 307); | |
2111 if ( v13 > 0 ) | |
2112 { | |
2113 do | |
2114 { | |
2115 v14 = (unsigned int *)&v41[4 * v9]; | |
2116 v15 = *v14; | |
2117 v16 = *v14; | |
2118 a1.vPosition.x = pActors[v16].vPosition.x; | |
2119 v17 = pActors[v16].vPosition.y; | |
2120 a1.vPosition.z = pActors[v16].vPosition.z; | |
2121 v18 = 8 * v15; | |
862 | 2122 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2123 a1.vPosition.y = v17; |
823 | 2124 a1.spell_target_pid = v18; |
0 | 2125 v19 = a1.Create(0, 0, 0, 0); |
862 | 2126 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2127 ++v9; |
2128 } | |
2129 while ( v9 < v13 ); | |
2130 } | |
2131 } | |
2132 v44 = 0; | |
248 | 2133 if (PartyHasDragon()) |
0 | 2134 v44 = 1; |
2135 v49 = 0; | |
2136 LABEL_25: | |
2137 v20 = 0; | |
2138 v21 = &pParty->pPlayers[v49]; | |
2139 v50 = 0; | |
2140 v47 = 0; | |
2141 v45 = 0; | |
2142 v48 = 0; | |
2143 v46 = 0; | |
255 | 2144 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2145 v50 = 1; |
135 | 2146 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2147 v48 = 1; |
2148 v22 = (ITEM_EQUIP_TYPE)0; | |
2149 while ( 1 ) | |
2150 { | |
2151 if ( v21->HasItemEquipped(v22) ) | |
2152 { | |
2153 //v23 = v21->pEquipment.pIndices; | |
2154 auto _idx = v21->pEquipment.pIndices[v22]; | |
2155 v24 = v21->pInventoryItems[_idx].uItemID; | |
2156 if ( v24 > 134 ) | |
2157 { | |
2158 if ( v24 == 529 ) | |
2159 goto LABEL_43; | |
2160 if ( v24 == 535 ) | |
2161 goto LABEL_44; | |
2162 if ( v24 == 515 ) | |
2163 { | |
2164 v47 = 1; | |
2165 } | |
2166 else | |
2167 { | |
2168 if ( v24 == 532 ) | |
2169 goto LABEL_50; | |
2170 } | |
2171 } | |
2172 else | |
2173 { | |
377 | 2174 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2175 if ( v25 <= 50 ) |
2176 { | |
2177 if ( v25 != 50 ) | |
2178 { | |
2179 v26 = v25 - 37; | |
2180 if ( v26 ) | |
2181 { | |
2182 v27 = v26 - 1; | |
2183 if ( !v27 ) | |
2184 goto LABEL_50; | |
2185 v28 = v27 - 6; | |
2186 if ( v28 ) | |
2187 { | |
2188 if ( v28 != 3 ) | |
2189 goto LABEL_51; | |
2190 LABEL_50: | |
2191 v50 = 1; | |
2192 goto LABEL_51; | |
2193 } | |
2194 } | |
2195 } | |
2196 LABEL_44: | |
2197 v20 = 1; | |
2198 goto LABEL_51; | |
2199 } | |
2200 v29 = v25 - 54; | |
2201 if ( !v29 ) | |
2202 goto LABEL_44; | |
2203 v30 = v29 - 1; | |
2204 if ( !v30 ) | |
2205 goto LABEL_50; | |
2206 if ( v30 == 11 ) | |
2207 { | |
2208 LABEL_43: | |
2209 v20 = 1; | |
2210 v50 = 1; | |
2211 goto LABEL_51; | |
2212 } | |
2213 } | |
2214 } | |
2215 LABEL_51: | |
2216 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2217 if ( (signed int)v22 >= 16 ) | |
2218 { | |
2219 if ( v48 ) | |
2220 { | |
2221 v31 = 0; | |
2222 v32 = (char *)v21->pInventoryItems; | |
2223 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2224 { | |
2225 ++v31; | |
2226 v32 += 36; | |
2227 if ( v31 >= 138 ) | |
2228 goto LABEL_59; | |
2229 } | |
2230 v48 = 0; | |
2231 v45 = 1; | |
2232 } | |
2233 LABEL_59: | |
2234 if ( v21->pConditions[17] ) | |
2235 v46 = 1; | |
2236 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2237 { | |
2238 ++v21->sHealth; | |
2239 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2240 v21->sHealth = v21->GetMaxHealth(); | |
2241 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2242 { | |
2243 LODWORD(v21->pConditions[13]) = 0; | |
2244 HIDWORD(v21->pConditions[13]) = 0; | |
2245 } | |
2246 v51 = 1; | |
2247 } | |
2248 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2249 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2250 && !v21->pConditions[14] | |
2251 && !v21->pConditions[16] ) | |
2252 { | |
2253 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2254 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2255 v21->sHealth = v21->GetMaxHealth(); | |
2256 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2257 { | |
2258 LODWORD(v21->pConditions[13]) = 0; | |
2259 HIDWORD(v21->pConditions[13]) = 0; | |
2260 } | |
2261 v51 = 1; | |
2262 } | |
2263 if ( v50 ) | |
2264 { | |
2265 v33 = (char *)&v21->sMana; | |
2266 ++*(int *)v33; | |
2267 if ( v21->sMana > v21->GetMaxMana() ) | |
2268 *(int *)v33 = v21->GetMaxMana(); | |
2269 v51 = 1; | |
2270 } | |
2271 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2272 { | |
2273 v34 = LODWORD(v21->pConditions[13]); | |
2274 --v21->sHealth; | |
2275 v35 = v21->sHealth; | |
2276 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2277 v21->pConditions[13] = pParty->uTimePlayed; | |
2278 if ( v35 < 1 ) | |
2279 { | |
2280 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2281 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2282 { | |
2283 v21->pConditions[13] = pParty->uTimePlayed; | |
2284 } | |
2285 else | |
2286 { | |
2287 if ( !v21->pConditions[14] ) | |
2288 v21->pConditions[14] = pParty->uTimePlayed; | |
2289 } | |
2290 } | |
2291 v51 = 1; | |
2292 } | |
2293 if ( v45 ) | |
2294 { | |
2295 v36 = (char *)&v21->sMana; | |
2296 ++*(int *)v36; | |
2297 if ( v21->sMana > v21->GetMaxMana() ) | |
2298 *(int *)v36 = v21->GetMaxMana(); | |
2299 } | |
2300 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2301 { | |
2302 v37 = v21->sHealth; | |
2303 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2304 v21->sHealth = v37 - 2; | |
2305 v38 = v21->sMana; | |
2306 if ( v38 > v21->GetMaxMana() / 2 ) | |
2307 v21->sMana = v38 - 2; | |
2308 } | |
2309 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2310 { | |
2311 v39 = v21->sHealth; | |
2312 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2313 v21->sHealth = v39 - 1; | |
2314 v40 = v21->sMana; | |
2315 if ( v40 > 0 ) | |
2316 v21->sMana = v40 - 1; | |
2317 } | |
2318 ++v49; | |
2319 if ( v49 >= 4 ) | |
2320 { | |
2321 result = HIDWORD(pParty->uTimePlayed); | |
2322 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2323 if ( !viewparams->bRedrawGameUI ) | |
2324 { | |
2325 result = v51; | |
2326 viewparams->bRedrawGameUI = v51; | |
2327 } | |
2328 return result; | |
2329 } | |
2330 goto LABEL_25; | |
2331 } | |
2332 } | |
2333 } | |
2334 return result; | |
2335 } | |
2336 | |
2337 //----- (00493F79) -------------------------------------------------------- | |
351 | 2338 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2339 { |
2340 signed __int64 v2; // ST2C_8@1 | |
2341 signed __int64 v3; // qax@1 | |
351 | 2342 //signed __int64 v4; // ST1C_8@1 |
0 | 2343 unsigned __int64 v5; // qax@1 |
2344 unsigned int v6; // ebx@1 | |
2345 | |
2346 v2 = (signed __int64)((double)a2 * 0.234375); | |
2347 v3 = v2 / 60 / 60; | |
351 | 2348 //v4 = v3; |
0 | 2349 v5 = (unsigned int)v3 / 0x18; |
2350 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2351 _this->field_0_expire_second = v2 % 60; |
2352 _this->field_4_expire_minute = v2 / 60 % 60; | |
2353 _this->field_8_expire_hour = v3 % 24; | |
2354 _this->field_10_expire_week = v5 / 7 & 3; | |
2355 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2356 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2357 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2358 } |
2359 | |
2360 //----- (00494035) -------------------------------------------------------- | |
2361 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2362 { | |
2363 signed __int64 v0; // qax@1 | |
2364 signed __int64 v1; // ST30_8@1 | |
2365 signed __int64 v2; // ST38_8@1 | |
2366 unsigned __int64 v3; // qax@1 | |
2367 unsigned int v4; // edi@1 | |
2368 //signed int v5; // eax@4 | |
2369 //char *v6; // ecx@5 | |
2370 //Player *v7; // esi@8 | |
2371 //char *v8; // ecx@12 | |
766 | 2372 //Player *pPlayer; // esi@15 |
0 | 2373 //void *v10; // esi@25 |
2374 unsigned int v11; // ecx@27 | |
2375 signed int v12; // edi@29 | |
2376 Player *v13; // ecx@30 | |
2377 Player *v14; // esi@35 | |
2378 double v15; // st7@35 | |
2379 Player **v16; // esi@43 | |
2380 Player *v17; // edi@44 | |
2381 double v18; // st7@44 | |
816 | 2382 //float v19; // ST28_4@48 |
2383 //double v20; // ST38_8@48 | |
0 | 2384 Player *v21; // esi@51 |
2385 signed int v22; // edi@53 | |
2386 int v23; // eax@59 | |
2387 int v24; // ecx@60 | |
2388 int v25; // eax@63 | |
2389 int v26; // ecx@64 | |
2390 int v27; // eax@67 | |
2391 int v28; // ecx@68 | |
2392 int v29; // eax@71 | |
2393 int v30; // ecx@72 | |
2394 int v31; // eax@75 | |
2395 int v32; // ecx@76 | |
2396 int v33; // eax@79 | |
2397 int v34; // ecx@80 | |
2398 int v35; // eax@83 | |
2399 int v36; // ecx@84 | |
2400 int v37; // eax@87 | |
2401 int v38; // ecx@88 | |
2402 int v39; // eax@91 | |
2403 int v40; // ecx@92 | |
2404 int v41; // eax@95 | |
2405 int v42; // ecx@96 | |
2406 bool v43; // ebx@102 | |
2407 //SpellBuff *v44; // edi@104 | |
2408 //signed int v45; // ebp@104 | |
2409 bool v46; // edi@111 | |
2410 //SpellBuff *v47; // esi@113 | |
2411 //Player **v48; // esi@119 | |
2412 //signed int v49; // edi@121 | |
2413 //char *v50; // esi@122 | |
2414 signed int v51; // edx@128 | |
2415 signed int v52; // ecx@130 | |
2416 int v53; // eax@131 | |
2417 Player *v54; // eax@141 | |
766 | 2418 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2419 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2420 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2421 int v58; // [sp-4h] [bp-34h]@33 |
2422 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2423 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2424 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2425 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2426 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2427 signed int a2a; // [sp+18h] [bp-18h]@47 |
2428 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2429 | |
766 | 2430 //a2 = pParty->uCurrentHour; |
0 | 2431 v61 = pParty->uDaysPlayed; |
816 | 2432 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2433 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2434 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2435 v1 = v0; |
2436 v0 /= 60i64; | |
2437 v2 = v0; | |
2438 v3 = (unsigned int)v0 / 24; | |
2439 v4 = (unsigned int)(v3 / 7) >> 2; | |
2440 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2441 pParty->uCurrentMinute = v1 % 60; | |
2442 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2443 pParty->uCurrentHour = v2 % 24; | |
2444 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2445 pParty->uCurrentMonth = v4 % 12; | |
352 | 2446 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2447 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2448 { |
2449 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2450 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2451 | |
2452 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2453 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2454 | |
766 | 2455 ++pParty->days_played_without_rest; |
2456 if (pParty->days_played_without_rest > 1) | |
0 | 2457 { |
2458 for (uint i = 0; i < 4; ++i) | |
766 | 2459 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2460 | |
2461 if (pParty->uNumFoodRations) | |
2462 Party::TakeFood(1); | |
0 | 2463 else |
2464 for (uint i = 0; i < 4; ++i) | |
766 | 2465 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2466 | |
2467 if (pParty->days_played_without_rest > 3) | |
2468 for (uint i = 0; i < 4; ++i) | |
0 | 2469 { |
766 | 2470 auto player = pParty->pPlayers + i; |
2471 | |
2472 player->Zero(); | |
2473 | |
2474 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2475 { |
767 | 2476 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2477 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2478 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2479 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2480 } |
2481 } | |
766 | 2482 } |
2483 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2484 pOutdoor->SetFog(); |
2485 | |
2486 for (uint i = 0; i < 4; ++i) | |
2487 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2488 } | |
766 | 2489 |
0 | 2490 v11 = LODWORD(pParty->uTimePlayed); |
2491 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2492 { | |
2493 v12 = 1; | |
2494 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2495 viewparams->bRedrawGameUI = 1; | |
2496 while ( 1 ) | |
2497 { | |
2498 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2499 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2500 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2501 { |
2502 v58 = 0; | |
2503 } | |
2504 else | |
2505 { | |
2506 v58 = 0; | |
2507 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2508 { | |
2509 v14 = pPlayers[v12]; | |
2510 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2511 v14->ReceiveDamage((signed __int64)v15, 0); | |
2512 if ( pParty->uFlags & 4 ) | |
2513 { | |
783 | 2514 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2515 GameUI_Footer_TimeLeft = 128; | |
0 | 2516 } |
2517 goto LABEL_39; | |
2518 } | |
2519 v13 = pPlayers[v12]; | |
2520 } | |
130 | 2521 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2522 LABEL_39: |
2523 ++v12; | |
2524 if ( v12 > 4 ) | |
2525 { | |
2526 v11 = LODWORD(pParty->uTimePlayed); | |
2527 break; | |
2528 } | |
2529 } | |
2530 } | |
2531 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2532 { | |
2533 viewparams->bRedrawGameUI = 1; | |
2534 pParty->field_6FC = v11 + 128; | |
2535 v16 = &pPlayers[1]; | |
2536 do | |
2537 { | |
2538 v17 = *v16; | |
2539 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2540 v17->ReceiveDamage((signed __int64)v18, 0); | |
2541 if ( pParty->uFlags & 0x200 ) | |
2542 { | |
783 | 2543 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2544 GameUI_Footer_TimeLeft = 128; | |
0 | 2545 } |
2546 ++v16; | |
2547 } | |
2548 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2549 } | |
2550 _493938_regenerate(); | |
2551 v65 = 4; | |
816 | 2552 a2a = pEventTimer->uTimeElapsed; |
2553 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2554 { | |
2555 //v19 = (double)(signed int)prev_time * 0.5; | |
2556 //v20 = v19 + 6.7553994e15; | |
2557 a2a *= 0.5f; | |
2558 if (a2a < 1) | |
0 | 2559 a2a = 1; |
2560 } | |
2561 v62 = &pPlayers[1]; | |
2562 do | |
2563 { | |
2564 v21 = *v62; | |
2565 if ( (*v62)->uTimeToRecovery ) | |
2566 v21->Recover(a2a); | |
2567 v22 = v21->sHealth; | |
2568 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2569 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2570 { | |
2571 if ( v22 >= 1 ) | |
2572 goto LABEL_59; | |
2573 v59 = 0; | |
2574 v56 = 13; | |
2575 } | |
2576 else | |
2577 { | |
2578 v59 = 0; | |
2579 v56 = 14; | |
2580 } | |
2581 v21->SetCondition(v56, v59); | |
2582 LABEL_59: | |
2583 v23 = (int)&v21->field_E0; | |
2584 if ( v21->field_E0 ) | |
2585 { | |
816 | 2586 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2587 if ( v24 > 0 ) |
2588 { | |
2589 *(int *)v23 = v24; | |
2590 } | |
2591 else | |
2592 { | |
2593 *(int *)v23 = 0; | |
2594 viewparams->bRedrawGameUI = 1; | |
2595 } | |
2596 } | |
2597 v25 = (int)&v21->field_E4; | |
2598 if ( v21->field_E4 ) | |
2599 { | |
816 | 2600 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2601 if ( v26 > 0 ) |
2602 { | |
2603 *(int *)v25 = v26; | |
2604 } | |
2605 else | |
2606 { | |
2607 *(int *)v25 = 0; | |
2608 viewparams->bRedrawGameUI = 1; | |
2609 } | |
2610 } | |
2611 v27 = (int)&v21->field_E8; | |
2612 if ( v21->field_E8 ) | |
2613 { | |
816 | 2614 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2615 if ( v28 > 0 ) |
2616 { | |
2617 *(int *)v27 = v28; | |
2618 } | |
2619 else | |
2620 { | |
2621 *(int *)v27 = 0; | |
2622 viewparams->bRedrawGameUI = 1; | |
2623 } | |
2624 } | |
2625 v29 = (int)&v21->field_EC; | |
2626 if ( v21->field_EC ) | |
2627 { | |
816 | 2628 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2629 if ( v30 > 0 ) |
2630 { | |
2631 *(int *)v29 = v30; | |
2632 } | |
2633 else | |
2634 { | |
2635 *(int *)v29 = 0; | |
2636 viewparams->bRedrawGameUI = 1; | |
2637 } | |
2638 } | |
2639 v31 = (int)&v21->field_F0; | |
2640 if ( v21->field_F0 ) | |
2641 { | |
816 | 2642 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2643 if ( v32 > 0 ) |
2644 { | |
2645 *(int *)v31 = v32; | |
2646 } | |
2647 else | |
2648 { | |
2649 *(int *)v31 = 0; | |
2650 viewparams->bRedrawGameUI = 1; | |
2651 } | |
2652 } | |
2653 v33 = (int)&v21->field_F4; | |
2654 if ( v21->field_F4 ) | |
2655 { | |
816 | 2656 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2657 if ( v34 > 0 ) |
2658 { | |
2659 *(int *)v33 = v34; | |
2660 } | |
2661 else | |
2662 { | |
2663 *(int *)v33 = 0; | |
2664 viewparams->bRedrawGameUI = 1; | |
2665 } | |
2666 } | |
2667 v35 = (int)&v21->field_F8; | |
2668 if ( v21->field_F8 ) | |
2669 { | |
816 | 2670 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2671 if ( v36 > 0 ) |
2672 { | |
2673 *(int *)v35 = v36; | |
2674 } | |
2675 else | |
2676 { | |
2677 *(int *)v35 = 0; | |
2678 viewparams->bRedrawGameUI = 1; | |
2679 } | |
2680 } | |
2681 v37 = (int)&v21->field_FC; | |
2682 if ( v21->field_FC ) | |
2683 { | |
816 | 2684 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2685 if ( v38 > 0 ) |
2686 { | |
2687 *(int *)v37 = v38; | |
2688 } | |
2689 else | |
2690 { | |
2691 *(int *)v37 = 0; | |
2692 viewparams->bRedrawGameUI = 1; | |
2693 } | |
2694 } | |
2695 v39 = (int)&v21->field_100; | |
2696 if ( v21->field_100 ) | |
2697 { | |
816 | 2698 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2699 if ( v40 > 0 ) |
2700 { | |
2701 *(int *)v39 = v40; | |
2702 } | |
2703 else | |
2704 { | |
2705 *(int *)v39 = 0; | |
2706 viewparams->bRedrawGameUI = 1; | |
2707 } | |
2708 } | |
2709 v41 = (int)&v21->field_104; | |
2710 if ( v21->field_104 ) | |
2711 { | |
816 | 2712 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2713 if ( v42 > 0 ) |
2714 { | |
2715 *(int *)v41 = v42; | |
2716 } | |
2717 else | |
2718 { | |
2719 *(int *)v41 = 0; | |
2720 viewparams->bRedrawGameUI = 1; | |
2721 } | |
2722 } | |
2723 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2724 --v65; | |
2725 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2726 | |
2727 for (uint k = 0; k < 24; ++k) | |
2728 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2729 | |
2730 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2731 v21->SetCondition(1u, 0); | |
2732 ++v62; | |
2733 } | |
2734 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2735 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2736 | |
2737 for (uint i = 0; i < 20; ++i) | |
2738 { | |
2739 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2740 viewparams->bRedrawGameUI = 1; | |
2741 } | |
2742 | |
2743 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2744 { | |
2745 for (uint i = 0; i < 4; ++i) | |
2746 pParty->pPlayers[i].SetCondition(1, 0); | |
2747 } | |
2748 | |
2749 for (uint i = 0; i < 2; ++i) | |
2750 { | |
2751 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2752 if (pBuf->uExpireTime == 0) | |
2753 continue; | |
2754 | |
2755 if ( !(pBuf->uFlags & 1) ) | |
2756 { | |
2757 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2758 { | |
2759 pBuf->Reset(); | |
2760 if (dword_4EE07C[i] == 7 ) | |
2761 pParty->bFlying = false; | |
2762 } | |
2763 } | |
2764 } | |
2765 | |
2766 v51 = v65; | |
2767 if ( v65 ) | |
2768 goto LABEL_135; | |
151 | 2769 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2770 { |
2771 v52 = (signed int)&pPlayers[1]; | |
2772 while ( 1 ) | |
2773 { | |
2774 v53 = *(int *)v52; | |
2775 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2776 break; | |
2777 v52 += 4; | |
2778 if ( v52 > (signed int)&pPlayers[4] ) | |
2779 goto LABEL_135; | |
2780 } | |
2781 *(int *)(v53 + 16) = 0; | |
2782 *(int *)(v53 + 20) = 0; | |
2783 v51 = 1; | |
2784 LABEL_135: | |
151 | 2785 if ( pCurrentScreen != SCREEN_REST |
0 | 2786 && (!v51 || dword_5C35C0) ) |
981 | 2787 uGameState = GAME_STATE_PARTY_DIED; |
0 | 2788 } |
2789 if ( uActiveCharacter ) | |
2790 { | |
151 | 2791 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2792 { |
2793 v54 = pPlayers[uActiveCharacter]; | |
2794 if ( v54->pConditions[2] | |
2795 || v54->pConditions[12] | |
2796 || v54->pConditions[13] | |
2797 || v54->pConditions[14] | |
2798 || v54->pConditions[15] | |
2799 || v54->pConditions[16] ) | |
2800 { | |
2801 viewparams->bRedrawGameUI = 1; | |
2802 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2803 } | |
2804 } | |
2805 } | |
2806 } | |
2807 | |
2808 //----- (00494820) -------------------------------------------------------- | |
758 | 2809 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2810 { |
2811 signed int v1; // eax@1 | |
2812 | |
2813 v1 = 5; | |
758 | 2814 if ( a1 % 24 >= 5 ) |
0 | 2815 v1 = 29; |
758 | 2816 return v1 - a1 % 24; |
0 | 2817 } |
2818 | |
2819 //----- (00494836) -------------------------------------------------------- | |
2820 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2821 { | |
2822 int v3; // esi@1 | |
2823 int result; // eax@1 | |
2824 stru339_spell_sound *v5; // ebx@1 | |
2825 int *v6; // edi@2 | |
2826 unsigned int v7; // eax@3 | |
2827 int v8; // [sp+Ch] [bp-8h]@3 | |
2828 int v9; // [sp+10h] [bp-4h]@2 | |
2829 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2830 | |
2831 v3 = 0; | |
2832 result = word_4EE088_sound_ids[uSoundID]; | |
2833 v5 = this; | |
2834 a2a = word_4EE088_sound_ids[uSoundID]; | |
2835 if ( result ) | |
2836 { | |
2837 v9 = 0; | |
2838 v6 = this->pSoundsOffsets; | |
2839 do | |
2840 { | |
2841 v7 = a2a++; | |
2842 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2843 if ( !result ) | |
2844 break; | |
2845 a6 += 4; | |
2846 result = v8 + 256; | |
2847 *v6 = v3; | |
2848 v3 += result; | |
2849 ++v9; | |
2850 *(v6 - 2) = result; | |
2851 ++v6; | |
2852 } | |
2853 while ( v9 < 2 ); | |
2854 } | |
2855 return result; | |
2856 } | |
2857 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2858 | |
2859 //----- (00494AED) -------------------------------------------------------- | |
130 | 2860 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2861 { |
2862 unsigned int _uNumFrames; // edx@1 | |
2863 unsigned int result; // eax@1 | |
2864 PlayerFrame *v4; // ecx@2 | |
2865 | |
2866 _uNumFrames = this->uNumFrames; | |
2867 result = 0; | |
2868 if ( (signed int)this->uNumFrames <= 0 ) | |
2869 { | |
2870 LABEL_5: | |
2871 result = 0; | |
2872 } | |
2873 else | |
2874 { | |
2875 v4 = this->pFrames; | |
130 | 2876 while ( v4->expression != expression ) |
0 | 2877 { |
2878 ++result; | |
2879 ++v4; | |
2880 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2881 goto LABEL_5; | |
2882 } | |
2883 } | |
2884 return result; | |
2885 } | |
2886 | |
2887 //----- (00494B10) -------------------------------------------------------- | |
2888 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2889 { | |
2890 unsigned int v3; // esi@1 | |
2891 PlayerFrame *v4; // edi@1 | |
2892 PlayerFrame *v5; // ecx@1 | |
2893 __int16 v6; // dx@2 | |
2894 int v7; // edx@3 | |
2895 char *i; // eax@3 | |
2896 int v9; // ecx@5 | |
2897 PlayerFrame *result; // eax@6 | |
2898 | |
2899 v3 = uFramesetID; | |
2900 v4 = this->pFrames; | |
2901 v5 = &v4[uFramesetID]; | |
2902 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2903 { | |
2904 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2905 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2906 { | |
2907 v9 = *(short *)i; | |
2908 if ( v7 <= v9 ) | |
2909 break; | |
2910 v7 -= v9; | |
2911 ++v3; | |
2912 } | |
2913 result = &v4[v3]; | |
2914 } | |
2915 else | |
2916 { | |
2917 result = &v4[uFramesetID]; | |
2918 } | |
2919 return result; | |
2920 } | |
2921 | |
2922 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2923 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2924 { |
2925 PlayerFrameTable *v4; // edi@1 | |
2926 int v5; // esi@1 | |
2927 int v6; // eax@2 | |
2928 | |
2929 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2930 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2931 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
|
2932 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2933 *pAnimTime = v5; |
0 | 2934 } |
2935 else | |
2936 { | |
2937 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2938 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2939 *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
|
2940 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2941 return &v4->pFrames[*pFramesetID]; |
0 | 2942 } |
2943 | |
2944 //----- (00494BC3) -------------------------------------------------------- | |
2945 void PlayerFrameTable::ToFile() | |
2946 { | |
2947 PlayerFrameTable *v1; // esi@1 | |
2948 FILE *v2; // eax@1 | |
2949 FILE *v3; // edi@1 | |
2950 | |
2951 auto Str = this; | |
2952 | |
2953 v1 = Str; | |
2954 v2 = fopen("data\\dpft.bin", "wb"); | |
2955 v3 = v2; | |
2956 if ( !v2 ) | |
2957 Abortf("Unable to save dpft.bin!"); | |
2958 fwrite(v1, 4u, 1u, v2); | |
2959 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2960 fclose(v3); | |
2961 } | |
2962 | |
2963 //----- (00494C0F) -------------------------------------------------------- | |
2964 void PlayerFrameTable::FromFile(void *pSerialized) | |
2965 { | |
2966 uNumFrames = *(int *)pSerialized; | |
2967 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2968 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2969 } | |
2970 | |
2971 //----- (00494C5A) -------------------------------------------------------- | |
2972 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2973 { | |
2974 PlayerFrameTable *v2; // ebx@1 | |
2975 FILE *v3; // eax@1 | |
2976 int v4; // esi@3 | |
2977 void *v5; // eax@10 | |
2978 FILE *v6; // ST0C_4@12 | |
2979 char *i; // eax@12 | |
2980 __int16 v8; // ax@15 | |
2981 const char *v9; // ST10_4@15 | |
2982 unsigned __int16 v10; // ax@15 | |
2983 const char *v11; // ST0C_4@15 | |
2984 int j; // esi@15 | |
2985 int v13; // eax@17 | |
2986 int v14; // edx@22 | |
2987 int v15; // ecx@23 | |
2988 int v16; // eax@24 | |
2989 signed int k; // eax@27 | |
2990 PlayerFrame *v18; // edx@28 | |
2991 int v19; // esi@28 | |
2992 int l; // ecx@29 | |
2993 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2994 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2995 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2996 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2997 int v26; // [sp+2FCh] [bp-8h]@3 | |
2998 FILE *File; // [sp+300h] [bp-4h]@1 | |
2999 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3000 | |
3001 v2 = this; | |
3002 //TileTable::dtor((TileTable *)this); | |
3003 v3 = fopen(Args, "r"); | |
3004 File = v3; | |
3005 if ( !v3 ) | |
3006 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3007 v4 = 0; | |
3008 v25 = 0; | |
3009 v26 = 1; | |
3010 if ( fgets(&Buf, 490, v3) ) | |
3011 { | |
3012 do | |
3013 { | |
3014 *strchr(&Buf, 10) = 0; | |
703 | 3015 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3016 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3017 { | |
3018 if ( v24.uPropCount < 3 ) | |
0 | 3019 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3020 ++v25; | |
3021 } | |
3022 ++v26; | |
3023 } | |
3024 while ( fgets(&Buf, 490, File) ); | |
3025 v4 = v25; | |
3026 } | |
3027 v2->uNumFrames = v4; | |
3028 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3029 v2->pFrames = (PlayerFrame *)v5; | |
3030 if ( !v5 ) | |
3031 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3032 v6 = File; | |
3033 v2->uNumFrames = 0; | |
3034 fseek(v6, 0, 0); | |
3035 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3036 { | |
3037 *strchr(&Buf, 10) = 0; | |
703 | 3038 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3039 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3040 { |
3041 v8 = atoi(v24.pProperties[0]); | |
3042 v9 = v24.pProperties[1]; | |
130 | 3043 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3044 v10 = atoi(v9); |
3045 v11 = v24.pProperties[2]; | |
3046 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3047 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3048 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3049 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3050 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3051 { |
3052 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3053 { | |
3054 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3055 *(char *)v13 |= 4u; | |
3056 } | |
3057 } | |
3058 ++v2->uNumFrames; | |
3059 } | |
3060 } | |
3061 fclose(File); | |
3062 v14 = 0; | |
3063 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3064 { | |
3065 v15 = 0; | |
3066 do | |
3067 { | |
3068 v16 = (int)&v2->pFrames[v15]; | |
3069 if ( !(*(char *)(v16 + 18) & 4) ) | |
3070 *(char *)(v16 + 8) |= 1u; | |
3071 ++v14; | |
3072 ++v15; | |
3073 } | |
3074 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3075 } | |
3076 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3077 { | |
3078 v18 = v2->pFrames; | |
3079 Argsa = (int)&v18[k]; | |
3080 v19 = *(short *)(Argsa + 4); | |
3081 if ( *(char *)(Argsa + 8) & 1 ) | |
3082 { | |
3083 ++k; | |
3084 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3085 { | |
3086 v19 += *(short *)(l + 4); | |
3087 ++k; | |
3088 } | |
3089 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3090 } | |
3091 ++k; | |
3092 } | |
3093 return 1; | |
3094 } | |
3095 | |
3096 //----- (00494F3A) -------------------------------------------------------- | |
3097 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3098 { | |
3099 IconFrameTable *v2; // esi@1 | |
3100 int v3; // ebx@1 | |
3101 unsigned int uID; // edi@1 | |
3102 unsigned int result; // eax@4 | |
3103 | |
3104 v2 = this; | |
3105 v3 = 0; | |
3106 uID = 0; | |
3107 if ( (signed int)this->uNumIcons <= 0 ) | |
3108 { | |
3109 LABEL_4: | |
3110 result = 0; | |
3111 } | |
3112 else | |
3113 { | |
3114 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3115 { | |
3116 ++uID; | |
3117 ++v3; | |
3118 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3119 goto LABEL_4; | |
3120 } | |
3121 result = uID; | |
3122 } | |
3123 return result; | |
3124 } | |
3125 | |
3126 //----- (00494F70) -------------------------------------------------------- | |
3127 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3128 { | |
3129 IconFrame *v3; // edi@1 | |
3130 IconFrame *v4; // ecx@1 | |
3131 __int16 v5; // dx@2 | |
3132 int v6; // edx@3 | |
3133 unsigned int v7; // eax@3 | |
3134 char *i; // ecx@3 | |
3135 int v9; // esi@5 | |
3136 IconFrame *result; // eax@6 | |
3137 | |
3138 v3 = this->pIcons; | |
3139 v4 = &v3[uIconID]; | |
3140 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3141 { | |
3142 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3143 v7 = uIconID; | |
3144 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3145 { | |
3146 v9 = *(short *)i; | |
3147 if ( v6 <= v9 ) | |
3148 break; | |
3149 v6 -= v9; | |
3150 ++v7; | |
3151 } | |
3152 result = &v3[v7]; | |
3153 } | |
3154 else | |
3155 { | |
3156 result = &v3[uIconID]; | |
3157 } | |
3158 return result; | |
3159 } | |
3160 | |
3161 //----- (00494FBF) -------------------------------------------------------- | |
3162 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3163 { | |
3164 IconFrameTable *v2; // esi@1 | |
3165 unsigned int v3; // edi@3 | |
3166 const char *i; // eax@3 | |
3167 IconFrame *v5; // eax@5 | |
3168 | |
3169 v2 = this; | |
3170 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3171 { | |
3172 v3 = uIconID; | |
3173 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3174 { | |
3175 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3176 v5 = v2->pIcons; | |
3177 if ( !(v5[v3].uFlags & 1) ) | |
3178 break; | |
3179 ++v3; | |
3180 } | |
3181 } | |
3182 } | |
3183 | |
3184 //----- (0049500A) -------------------------------------------------------- | |
3185 void IconFrameTable::ToFile() | |
3186 { | |
3187 IconFrameTable *v1; // esi@1 | |
3188 FILE *v2; // eax@1 | |
3189 FILE *v3; // edi@1 | |
3190 | |
3191 auto Str = this; | |
3192 | |
3193 v1 = Str; | |
3194 v2 = fopen("data\\dift.bin", "wb"); | |
3195 v3 = v2; | |
3196 if ( !v2 ) | |
3197 Abortf("Unable to save dift.bin!"); | |
3198 fwrite(v1, 4u, 1u, v2); | |
3199 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3200 fclose(v3); | |
3201 } | |
3202 | |
3203 //----- (00495056) -------------------------------------------------------- | |
3204 void IconFrameTable::FromFile(void *pSerialized) | |
3205 { | |
3206 uNumIcons = *(int *)pSerialized; | |
3207 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3208 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3209 } | |
3210 | |
3211 //----- (0049509D) -------------------------------------------------------- | |
3212 int IconFrameTable::FromFileTxt(const char *Args) | |
3213 { | |
3214 IconFrameTable *v2; // ebx@1 | |
3215 FILE *v3; // eax@1 | |
3216 int v4; // esi@3 | |
3217 void *v5; // eax@10 | |
3218 FILE *v6; // ST0C_4@12 | |
3219 char *i; // eax@12 | |
3220 const char *v8; // ST00_4@15 | |
3221 int v9; // eax@16 | |
3222 int v10; // edx@20 | |
3223 int v11; // ecx@21 | |
3224 int v12; // eax@22 | |
3225 signed int j; // edx@25 | |
3226 IconFrame *v14; // ecx@26 | |
3227 int v15; // esi@26 | |
3228 int k; // eax@27 | |
3229 signed int result; // eax@11 | |
3230 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3231 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3232 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3233 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3234 int v22; // [sp+2FCh] [bp-8h]@3 | |
3235 FILE *File; // [sp+300h] [bp-4h]@1 | |
3236 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3237 | |
3238 v2 = this; | |
3239 //TileTable::dtor((TileTable *)this); | |
3240 v3 = fopen(Args, "r"); | |
3241 File = v3; | |
3242 if ( !v3 ) | |
3243 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3244 v4 = 0; | |
3245 v21 = 0; | |
3246 v22 = 1; | |
3247 if ( fgets(&Buf, 490, v3) ) | |
3248 { | |
3249 do | |
3250 { | |
3251 *strchr(&Buf, 10) = 0; | |
3252 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3253 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3254 { | |
3255 if ( v20.uPropCount < 3 ) | |
0 | 3256 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3257 ++v21; | |
3258 } | |
3259 ++v22; | |
3260 } | |
3261 while ( fgets(&Buf, 490, File) ); | |
3262 v4 = v21; | |
3263 } | |
3264 v2->uNumIcons = v4; | |
3265 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3266 v2->pIcons = (IconFrame *)v5; | |
3267 if ( v5 ) | |
3268 { | |
3269 v6 = File; | |
3270 v2->uNumIcons = 0; | |
3271 fseek(v6, 0, 0); | |
3272 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3273 { | |
3274 *strchr(&Buf, 10) = 0; | |
3275 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3276 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3277 { |
3278 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3279 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3280 v8 = v20.pProperties[2]; | |
3281 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3282 if ( !_strcmpi(v8, "new") ) | |
3283 { | |
3284 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3285 *(char *)v9 |= 4u; | |
3286 } | |
3287 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3288 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3289 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3290 } | |
3291 } | |
3292 fclose(File); | |
3293 v10 = 0; | |
3294 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3295 { | |
3296 v11 = 0; | |
3297 do | |
3298 { | |
3299 v12 = (int)&v2->pIcons[v11]; | |
3300 if ( !(*(char *)(v12 + 60) & 4) ) | |
3301 *(char *)(v12 + 28) |= 1u; | |
3302 ++v10; | |
3303 ++v11; | |
3304 } | |
3305 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3306 } | |
3307 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3308 { | |
3309 v14 = v2->pIcons; | |
3310 Argsa = (int)&v14[j]; | |
3311 v15 = *(short *)(Argsa + 24); | |
3312 if ( *(char *)(Argsa + 28) & 1 ) | |
3313 { | |
3314 ++j; | |
3315 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3316 { | |
3317 v15 += *(short *)(k + 24); | |
3318 ++j; | |
3319 } | |
3320 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3321 } | |
3322 ++j; | |
3323 } | |
3324 result = 1; | |
3325 } | |
3326 else | |
3327 { | |
3328 fclose(File); | |
3329 result = 0; | |
3330 } | |
3331 return result; | |
3332 } | |
3333 | |
3334 //----- (00495366) -------------------------------------------------------- | |
3335 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3336 { | |
3337 int v2; // edi@1 | |
3338 int v3; // edx@2 | |
3339 int v4; // esi@3 | |
3340 int v5; // ebx@5 | |
3341 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3342 signed int v8; // [sp+10h] [bp-10h]@1 | |
3343 int **v9; // [sp+14h] [bp-Ch]@4 | |
3344 signed int v10; // [sp+18h] [bp-8h]@3 | |
3345 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3346 | |
3347 v2 = a1; | |
3348 v11 = a2; | |
3349 v8 = 0; | |
3350 v7 = 0; | |
3351 if ( dword_AE336C == a1 ) | |
3352 { | |
3353 v3 = dword_AE3370; | |
3354 } | |
3355 else | |
3356 { | |
3357 v4 = a2; | |
3358 dword_AE336C = a1; | |
3359 v10 = 0; | |
3360 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3361 goto LABEL_17; | |
3362 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3363 do | |
3364 { | |
3365 v5 = tolower(*(char *)*v9); | |
3366 if ( v5 == tolower(v2) ) | |
3367 { | |
3368 if ( v8 ) | |
3369 v7 = v10; | |
3370 else | |
3371 v8 = v10; | |
3372 } | |
3373 ++v10; | |
3374 v9 += 2; | |
3375 } | |
3376 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3377 if ( v8 && v8 != v7 ) | |
3378 v3 = v8 + rand() % (v7 - v8); | |
3379 else | |
3380 LABEL_17: | |
3381 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3382 } | |
3383 dword_AE3370 = v3; | |
3384 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3385 } | |
3386 // AE336C: using guessed type int dword_AE336C; | |
3387 // AE3370: using guessed type int dword_AE3370; | |
3388 | |
3389 //----- (00495430) -------------------------------------------------------- | |
607 | 3390 char * GetReputationString( signed int a1 ) |
3391 { | |
566 | 3392 if (a1 >= 25) |
3393 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3394 else if (a1 >= 6) | |
3395 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3396 else if (a1 >= -5) | |
3397 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3398 else if (a1 >= -24) | |
3399 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3400 else |
566 | 3401 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3402 } |
3403 | |
3404 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3405 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3406 { |
3407 unsigned __int8 v6; // bl@1 | |
3408 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3409 //NPCData *v9; // eax@4 |
250 | 3410 //size_t v10; // eax@6 |
0 | 3411 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3412 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3413 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3414 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3415 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3416 //int v16; // edx@10 |
0 | 3417 int v17; // eax@10 |
3418 signed __int64 v18; // qax@18 | |
3419 unsigned int v19; // edi@32 | |
3420 unsigned __int8 *v20; // ebx@32 | |
3421 int v21; // ecx@34 | |
3422 __int16 v22; // ax@34 | |
3423 int v23; // edx@39 | |
3424 int v24; // eax@39 | |
3425 int v25; // eax@45 | |
3426 float *v26; // esi@68 | |
3427 float v27; // ST18_4@68 | |
3428 signed int v28; // eax@68 | |
3429 int v29; // eax@68 | |
3430 float v30; // ST18_4@72 | |
3431 signed int v31; // eax@72 | |
3432 float v32; // ST18_4@74 | |
3433 signed int v33; // eax@74 | |
3434 double v34; // st7@75 | |
3435 float v35; // ST18_4@76 | |
3436 signed int v36; // eax@76 | |
3437 float *v37; // esi@78 | |
3438 float v38; // ST18_4@78 | |
3439 int v39; // eax@78 | |
3440 float v40; // ST18_4@82 | |
3441 int v41; // eax@82 | |
3442 float v42; // ST18_4@83 | |
3443 int v43; // eax@83 | |
3444 float v44; // ST18_4@85 | |
3445 int v45; // eax@85 | |
3446 const char *v46; // eax@86 | |
3447 unsigned int v47; // eax@87 | |
3448 float v48; // ST18_4@97 | |
3449 __int64 v49; // ST14_8@107 | |
3450 int v50; // eax@107 | |
3451 int v51; // eax@108 | |
3452 Player *v52; // eax@109 | |
3453 int v53; // [sp-4h] [bp-13Ch]@107 | |
3454 int v54; // [sp+0h] [bp-138h]@107 | |
3455 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3456 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3457 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3458 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3459 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3460 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3461 //Player *v61; // [sp+124h] [bp-14h]@3 |
3462 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3463 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3464 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3465 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3466 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3467 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3468 |
0 | 3469 |
3470 v6 = uPlayerID; | |
249 | 3471 //Str = lpsz; |
0 | 3472 if ( IsBadStringPtrA(lpsz, 1u) ) |
3473 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 |
0 | 3475 a1[0] = 0; |
3476 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3477 v59 = TargetColor(255, 255, 155); |
249 | 3478 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 NPCData *npc = nullptr; |
0 | 3482 if ( dword_5C35D4 ) |
248 | 3483 { |
463 | 3484 //__debugbreak(); // fix |
459 | 3485 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
|
3486 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 else |
602 | 3488 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3489 //v65 = v9; |
250 | 3490 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3493 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3495 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3496 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3497 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3498 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3499 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3504 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3510 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 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
|
3514 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 v11 = npc->pName; |
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 2: |
0 | 3521 v11 = pPlayer->pName; |
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 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 case 5: |
0 | 3528 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3529 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3530 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3531 { | |
3532 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3533 { | |
3534 if ( v18 < 20 ) | |
3535 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3536 } | |
3537 else | |
3538 { | |
3539 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3540 } | |
3541 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3542 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3543 case 6: |
0 | 3544 if ( pPlayer->uSex ) |
3545 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3546 else | |
3547 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 case 7: |
0 | 3550 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3554 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 case 8: |
0 | 3556 v19 = 0; |
3557 v63 = 0; | |
484 | 3558 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3559 do |
3560 { | |
3561 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3562 { | |
3563 v21 = v63; | |
3564 v22 = word_4EE150[v19]; | |
3565 ++v63; | |
3566 v55[v21] = v22; | |
3567 } | |
3568 ++v19; | |
3569 } | |
3570 while ( v19 < 28 ); | |
3571 if ( v63 ) | |
3572 { | |
3573 v23 = rand() % v63; | |
3574 v24 = dword_A74CDC; | |
3575 if ( dword_A74CDC == -1 ) | |
3576 { | |
3577 v24 = v23; | |
3578 dword_A74CDC = v23; | |
3579 } | |
492 | 3580 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3581 } |
3582 else | |
3583 { | |
3584 v11 = (char *)pNPCTopics[55].pText; | |
3585 } | |
249 | 3586 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3592 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 case 10: |
0 | 3596 if ( pPlayer->uSex ) |
3597 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3598 else | |
3599 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 case 11: |
0 | 3602 v25 = GetPartyReputation(); |
3603 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 v25 = npc->rep; |
0 | 3606 LABEL_46: |
3607 if ( v25 >= 25 ) | |
3608 { | |
3609 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3610 } | |
3611 else | |
3612 { | |
3613 if ( v25 < 6 ) | |
3614 { | |
3615 if ( v25 >= -5 ) | |
3616 { | |
3617 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3618 } | |
3619 else | |
3620 { | |
3621 if ( v25 < -24 ) | |
3622 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3623 else | |
3624 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3625 } | |
3626 } | |
3627 else | |
3628 { | |
3629 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3630 } | |
3631 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3632 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3633 case 13: |
0 | 3634 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3635 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3636 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3637 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3638 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3639 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3640 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3641 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3642 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3644 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3645 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 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
|
3667 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 sprintf(a1, "%lu", pay_percentage); |
250 | 3671 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 sprintf(a1, "%lu", v51); |
0 | 3685 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 goto _continue_strcat; |
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 23: |
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 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3712 switch ( a5 ) |
3713 { | |
3714 case 3: | |
3715 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 v45 = a3->GetValue(); |
0 | 3717 v29 = pPlayer->_4B8213(v45, v44); |
3718 break; | |
3719 case 4: | |
3720 v29 = pPlayer->_4B824B(*v37); | |
3721 break; | |
3722 case 5: | |
3723 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 v43 = a3->GetValue(); |
0 | 3725 v29 = pPlayer->_4B8265(v43, v42); |
3726 break; | |
3727 case 6: | |
3728 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3729 v41 = a3->GetValue(); |
0 | 3730 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3731 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3732 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3733 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3734 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3735 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3736 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3737 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3738 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3739 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3740 v28 = a3->GetValue(); |
749 | 3741 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3742 if ( a5 == 3 ) |
3743 { | |
3744 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 v36 = a3->GetValue(); |
917 | 3746 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3747 if (a3->Broken()) |
0 | 3748 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 goto _continue_sprintf; |
0 | 3750 } |
3751 if ( a5 != 4 ) | |
3752 { | |
3753 if ( a5 == 5 ) | |
3754 { | |
3755 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3756 v33 = a3->GetValue(); |
916 | 3757 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3758 } |
3759 else | |
3760 { | |
3761 if ( a5 == 6 ) | |
3762 { | |
3763 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3764 v31 = a3->GetValue(); |
917 | 3765 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3766 if (a3->Broken()) |
0 | 3767 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3768 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3769 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3770 goto _continue_sprintf; |
0 | 3771 } |
3772 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3773 _continue_sprintf: |
0 | 3774 sprintf(a1, "%lu", v29); |
250 | 3775 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3776 goto _continue_strcat; |
0 | 3777 } |
3778 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3779 |
0 | 3780 v48 = v34; |
916 | 3781 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3784 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3785 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3786 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3788 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3789 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3791 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3792 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 v48 = v34; |
916 | 3797 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3798 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 sub_493F79(&v57, *a6); |
351 | 3806 v54 = v57.field_18_expire_year; |
3807 v53 = v57.field_C_expire_day + 1; | |
3808 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3813 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3818 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3819 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3821 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 default: |
0 | 3823 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 goto _continue_strcat; |
484 | 3827 v49 = pParty->field_3C._s_times[v17-51]; |
3828 | |
0 | 3829 sub_493F79(&v56, v49); |
351 | 3830 v54 = v56.field_18_expire_year; |
3831 v53 = v56.field_C_expire_day + 1; | |
3832 v50 = v56.field_14_exprie_month; | |
0 | 3833 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3834 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3836 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3837 } |
0 | 3838 } |
3839 return pTmpBuf2; | |
3840 } | |
3841 | |
3842 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3843 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3844 { |
734 | 3845 //stru154 *v3; // edi@1 |
3846 //signed int v4; // eax@1 | |
3847 //signed int result; // eax@9 | |
3848 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3849 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3850 float v7; |
0 | 3851 |
3852 v.x = 0.0; | |
3853 v.y = 0.0; | |
3854 v.z = 0.0; | |
734 | 3855 GetFacePlane(a2, a3, &v, &v7); |
3856 | |
3857 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3858 polygonType = POLYGON_VerticalWall; | |
3859 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3860 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3861 polygonType = POLYGON_Floor; | |
0 | 3862 else |
734 | 3863 polygonType = POLYGON_InBetweenFloorAndWall; |
3864 | |
3865 face_plane.vNormal.x = v.x; | |
3866 face_plane.vNormal.y = v.y; | |
3867 face_plane.vNormal.z = v.z; | |
3868 face_plane.dist = v7; | |
0 | 3869 } |
3870 | |
3871 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3872 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3873 { |
734 | 3874 if (fabsf(pNormal->z) < 1e-6f) |
3875 polygonType = POLYGON_VerticalWall; | |
3876 else if (fabsf(pNormal->x) < 1e-6f && | |
3877 fabsf(pNormal->y) < 1e-6f) | |
3878 polygonType = POLYGON_Floor; | |
0 | 3879 else |
734 | 3880 polygonType = POLYGON_InBetweenFloorAndWall; |
3881 | |
3882 face_plane.vNormal.x = pNormal->x; | |
3883 face_plane.dist = dist; | |
3884 face_plane.vNormal.y = pNormal->y; | |
3885 face_plane.vNormal.z = pNormal->z; | |
0 | 3886 } |
3887 | |
3888 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3889 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3890 { |
3891 ODMFace *v5; // ebx@1 | |
734 | 3892 //int v6; // eax@1 |
3893 //unsigned __int16 *v7; // ebx@2 | |
3894 //Vec3_int_ *v8; // eax@3 | |
0 | 3895 Vec3_int_ *v9; // ecx@3 |
734 | 3896 //double v10; // st7@3 |
3897 //int v11; // ecx@3 | |
0 | 3898 Vec3_int_ *v12; // ecx@3 |
734 | 3899 //double v13; // st7@3 |
3900 //double v14; // st6@3 | |
3901 //double v15; // st5@3 | |
3902 //int v16; // ecx@3 | |
0 | 3903 Vec3_int_ *v17; // eax@3 |
734 | 3904 //double v18; // st5@3 |
0 | 3905 Vec3_float_ *v19; // eax@3 |
734 | 3906 //int result; // eax@8 |
3907 //float v21; // ecx@10 | |
3908 //double v22; // st7@10 | |
3909 //double v23; // st6@10 | |
0 | 3910 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3911 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3912 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3913 float v27; // [sp+20h] [bp-48h]@3 | |
3914 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3915 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3916 //float v30; // [sp+30h] [bp-38h]@3 | |
3917 //float v31; // [sp+34h] [bp-34h]@3 | |
3918 //float v32; // [sp+38h] [bp-30h]@3 | |
3919 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3920 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3921 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3922 //float v36; // [sp+50h] [bp-18h]@3 | |
3923 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3924 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3925 //int v39; // [sp+64h] [bp-4h]@1 |
3926 | |
3927 //v39 = 0; | |
0 | 3928 v1.x = 0.0; |
3929 v5 = pFace; | |
734 | 3930 //v6 = pFace->uNumVertices; |
0 | 3931 v1.y = 0.0; |
3932 v1.z = 0.0; | |
734 | 3933 |
3934 if (pFace->uNumVertices >= 2) | |
3935 { | |
3936 int i = 0; | |
3937 while ( i < pFace->uNumVertices - 2 ) | |
3938 { | |
3939 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3940 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3941 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3942 | |
3943 v1.x = v12->x - v9->x; | |
3944 v26 = v17->x - v12->x; | |
3945 v1.y = v12->y - v9->y; | |
3946 v27 = v17->y - v12->y; | |
3947 v1.z = v12->z - v9->z; | |
3948 v28 = v17->z - v12->z; | |
0 | 3949 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3950 v38.x = v19->x; | |
3951 v38.y = v19->y; | |
3952 v38.z = v19->z; | |
734 | 3953 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3954 { | |
3955 v38.Normalize(); | |
3956 | |
3957 pOutNormal->x = v38.x; | |
3958 pOutNormal->y = v38.y; | |
3959 pOutNormal->z = v38.z; | |
3960 | |
3961 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3962 return; | |
3963 } | |
3964 } | |
3965 } | |
3966 | |
3967 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3968 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3969 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3970 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3971 } |
3972 | |
3973 //----- (0049D700) -------------------------------------------------------- | |
3974 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3975 { | |
3976 unsigned int v1; // eax@1 | |
3977 int v2; // ecx@1 | |
3978 unsigned int v3; // eax@1 | |
3979 | |
3980 v1 = uDim; | |
3981 v2 = 0; | |
3982 v3 = v1 - 1; | |
3983 while ( v3 & 1 ) | |
3984 { | |
3985 v3 >>= 1; | |
3986 ++v2; | |
3987 } | |
3988 return v3 == 0 ? v2 : 0; | |
3989 } | |
3990 | |
3991 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3992 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3993 { |
737 | 3994 /*signed __int64 v2; // ST10_8@1 |
0 | 3995 double v3; // st7@1 |
3996 float v4; // ST24_4@1 | |
3997 double v5; // ST10_8@1 | |
3998 int v6; // ST1C_4@1 | |
3999 float v7; // ST24_4@1 | |
4000 double v8; // ST10_8@1 | |
4001 unsigned __int8 v9; // ST20_1@1 | |
4002 float v10; // ST24_4@1 | |
4003 double v11; // ST10_8@1 | |
4004 float v12; // ST24_4@1 | |
737 | 4005 double v13; // ST08_8@1*/ |
4006 | |
4007 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4008 (a2 >> 24) / 255.0f * 255.0f), | |
4009 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4010 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4011 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4012 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4013 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4014 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4015 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4016 /*v2 = a1 >> 24; | |
4017 v3 = (double)v2 / 255.0f; | |
4018 HIDWORD(v2) = 0; | |
0 | 4019 LODWORD(v2) = a2 >> 24; |
737 | 4020 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4021 v5 = v4 + 6.7553994e15; |
4022 v6 = LODWORD(v5); | |
737 | 4023 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4024 v8 = v7 + 6.7553994e15; |
4025 v9 = LOBYTE(v8); | |
737 | 4026 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4027 v11 = v10 + 6.7553994e15; |
737 | 4028 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4029 v13 = v12 + 6.7553994e15; |
737 | 4030 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4031 } |
4032 | |
4033 //----- (004A46E6) -------------------------------------------------------- | |
4034 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4035 { | |
4036 int v5; // eax@1 | |
4037 int z; // eax@1 | |
4038 unsigned int v7; // eax@9 | |
4039 unsigned int v8; // ecx@9 | |
4040 int v9; // eax@9 | |
4041 unsigned int v10; // eax@10 | |
4042 int *v11; // esi@10 | |
4043 int *v12; // edi@10 | |
4044 int v13; // ecx@10 | |
4045 int v14; // edx@10 | |
4046 unsigned int v15; // eax@22 | |
4047 int *v16; // esi@22 | |
4048 int *v17; // edi@22 | |
4049 int v18; // ecx@22 | |
4050 int v19; // edx@22 | |
4051 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4052 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4053 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4054 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4055 | |
4056 v5 = a4; | |
4057 v23 = _z >> 16; | |
4058 z = x + v5; | |
693 | 4059 if ( z >= (signed int)pViewport->uViewportTL_X |
4060 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4061 && y >= (signed int)pViewport->uViewportTL_Y | |
4062 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4063 { | |
4064 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4065 x = pViewport->uViewportTL_X; | |
4066 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4067 z = pViewport->uViewportBR_X; | |
0 | 4068 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4069 v22 = z - x; | |
4070 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4071 v7 = lightColor >> 3; | |
4072 v8 = lightColor & 0xF0; | |
4073 v9 = v7 & 0x1E0000; | |
4074 if ( pRenderer->uTargetGBits == 5 ) | |
4075 { | |
4076 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4077 v11 = (int *)pTarget; | |
4078 v12 = pTargetZ; | |
4079 v13 = v22; | |
4080 v14 = (v10 << 16) | v10; | |
4081 z = (unsigned __int8)pTarget & 2; | |
4082 if ( (unsigned __int8)pTarget & 2 ) | |
4083 { | |
4084 z = (unsigned int)*pTargetZ >> 16; | |
4085 if ( z > v23 ) | |
4086 { | |
4087 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4088 *pTarget = z; | |
4089 } | |
4090 v13 = v22 - 1; | |
4091 v11 = (int *)(pTarget + 1); | |
4092 v12 = pTargetZ + 1; | |
4093 } | |
4094 while ( v13 != 1 ) | |
4095 { | |
4096 if ( v13 < 1 ) | |
4097 return z; | |
4098 z = (unsigned int)*v12 >> 16; | |
4099 if ( z <= v23 ) | |
4100 { | |
4101 v13 -= 2; | |
4102 ++v11; | |
4103 v12 += 2; | |
4104 } | |
4105 else | |
4106 { | |
4107 v12 += 2; | |
4108 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4109 v13 -= 2; | |
4110 *v11 = z; | |
4111 ++v11; | |
4112 } | |
4113 } | |
4114 z = (unsigned int)*v12 >> 16; | |
4115 if ( z > v23 ) | |
4116 { | |
4117 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4118 *(short *)v11 = z; | |
4119 } | |
4120 } | |
4121 else | |
4122 { | |
4123 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4124 v16 = (int *)pTarget; | |
4125 v17 = pTargetZ; | |
4126 v18 = v22; | |
4127 v19 = (v15 << 16) | v15; | |
4128 z = (unsigned __int8)pTarget & 2; | |
4129 if ( (unsigned __int8)pTarget & 2 ) | |
4130 { | |
4131 z = (unsigned int)*pTargetZ >> 16; | |
4132 if ( z > v23 ) | |
4133 { | |
4134 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4135 *pTarget = z; | |
4136 } | |
4137 v18 = v22 - 1; | |
4138 v16 = (int *)(pTarget + 1); | |
4139 v17 = pTargetZ + 1; | |
4140 } | |
4141 while ( v18 != 1 ) | |
4142 { | |
4143 if ( v18 < 1 ) | |
4144 return z; | |
4145 z = (unsigned int)*v17 >> 16; | |
4146 if ( z <= v23 ) | |
4147 { | |
4148 v18 -= 2; | |
4149 ++v16; | |
4150 v17 += 2; | |
4151 } | |
4152 else | |
4153 { | |
4154 v17 += 2; | |
4155 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4156 v18 -= 2; | |
4157 *v16 = z; | |
4158 ++v16; | |
4159 } | |
4160 } | |
4161 z = (unsigned int)*v17 >> 16; | |
4162 if ( z > v23 ) | |
4163 { | |
4164 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4165 *(short *)v16 = z; | |
4166 } | |
4167 } | |
4168 } | |
4169 return z; | |
4170 } | |
4171 | |
4172 //----- (004A57E9) -------------------------------------------------------- | |
4173 void __cdecl Present_ColorKey() | |
4174 { | |
4175 HRESULT v0; // eax@3 | |
4176 HRESULT v1; // eax@3 | |
4177 HRESULT v2; // eax@3 | |
4178 HRESULT v3; // eax@3 | |
4179 HRESULT v4; // eax@3 | |
4180 RECT a2; // [sp+4h] [bp-14h]@3 | |
4181 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4182 | |
4183 if ( !pRenderer->uNumSceneBegins ) | |
4184 { | |
4185 if ( pRenderer->field_40110 ) | |
4186 { | |
693 | 4187 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4188 a2.left = 0; |
4189 a2.top = 0; | |
4190 a2.right = 640; | |
4191 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4192 a2.right = 640; | |
4193 a2.left = 0; | |
693 | 4194 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4195 a2.bottom = 480; |
4196 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4197 0, | |
693 | 4198 pViewport->uViewportBR_Y + 1, |
0 | 4199 pRenderer->pColorKeySurface4, |
4200 &a2, | |
4201 16u)); | |
693 | 4202 a2.right = pViewport->uViewportTL_X; |
4203 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4204 a2.left = 0; |
693 | 4205 a2.top = pViewport->uViewportTL_Y; |
0 | 4206 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4207 0, | |
693 | 4208 pViewport->uViewportTL_Y, |
0 | 4209 pRenderer->pColorKeySurface4, |
4210 &a2, | |
4211 16u)); | |
693 | 4212 a2.left = pViewport->uViewportBR_X; |
4213 a2.top = pViewport->uViewportTL_Y; | |
0 | 4214 a2.right = 640; |
693 | 4215 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4216 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4217 pViewport->uViewportBR_X, |
4218 pViewport->uViewportTL_Y, | |
0 | 4219 pRenderer->pColorKeySurface4, |
4220 &a2, | |
4221 16u)); | |
693 | 4222 a2.right = pViewport->uViewportBR_X; |
4223 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4224 a2.left = pViewport->uViewportTL_X; | |
4225 a2.top = pViewport->uViewportTL_Y; | |
0 | 4226 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4227 pViewport->uViewportTL_X, |
4228 pViewport->uViewportTL_Y, | |
0 | 4229 pRenderer->pColorKeySurface4, |
4230 &a2, | |
4231 17u)); | |
4232 } | |
4233 } | |
4234 } | |
4235 | |
4236 //----- (004A597D) -------------------------------------------------------- | |
4237 void Present_NoColorKey() | |
4238 { | |
4239 //unsigned __int16 *v0; // eax@4 | |
4240 unsigned __int16 *v1; // esi@4 | |
4241 void *v2; // edi@4 | |
4242 //signed int v4; // ebx@4 | |
4243 //signed int v5; // ebx@6 | |
4244 //void *v6; // edi@7 | |
4245 //const void *v7; // esi@7 | |
4246 signed int v8; // ebx@8 | |
4247 int v9; // eax@10 | |
4248 unsigned int v10; // esi@10 | |
4249 unsigned __int32 v11; // edi@10 | |
4250 //int v12; // ecx@10 | |
4251 unsigned int v13; // ebx@10 | |
4252 int v14; // eax@11 | |
4253 int v15; // eax@13 | |
4254 int v16; // eax@14 | |
4255 int v17; // eax@16 | |
4256 HRESULT v18; // eax@22 | |
4257 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4258 int v20; // [sp+88h] [bp-1Ch]@10 | |
4259 int v21; // [sp+8Ch] [bp-18h]@10 | |
4260 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4261 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4262 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4263 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4264 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4265 | |
4266 if ( !pRenderer->uNumSceneBegins ) | |
4267 { | |
4268 if ( pRenderer->field_40110 ) | |
4269 { | |
4270 memset(&Dst, 0, 0x7Cu); | |
4271 Dst.dwSize = 124; | |
168 | 4272 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4273 { |
4274 //v26 = Dst.lpSurface; | |
4275 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4276 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4277 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4278 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4279 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4280 v1 = pRenderer->pTargetSurface; | |
4281 v2 = Dst.lpSurface; | |
4282 | |
4283 | |
4284 /*for (uint y = 0; y < 480; ++y) | |
4285 { | |
4286 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4287 for (uint x = 0; x < 640; ++x) | |
4288 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4289 }*/ | |
4290 | |
4291 auto pSrc = pRenderer->pTargetSurface; | |
4292 auto pDst = (__int16 *)Dst.lpSurface; | |
4293 | |
4294 for (uint y = 0; y < 8; ++y) | |
4295 memcpy(pDst + y * Dst.lPitch / 2, | |
4296 | |
4297 pSrc + y * 640, 640 * sizeof(__int16)); | |
4298 | |
4299 for (uint y = 8; y < 352; ++y) | |
4300 { | |
4301 memcpy(pDst + y * Dst.lPitch / 2, | |
4302 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4303 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4304 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4305 } |
4306 | |
121 | 4307 for (uint y = 352; y < 480; ++y) |
0 | 4308 memcpy(pDst + y * Dst.lPitch / 2, |
4309 pSrc + y * 640, 640 * sizeof(__int16)); | |
4310 | |
4311 | |
693 | 4312 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4313 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4314 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4315 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4316 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4317 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4318 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4319 v21 = 4 * v9 + 1280; | |
4320 | |
121 | 4321 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4322 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4323 v10 = (int)pSrc_x1y1; | |
4324 v11 = (int)pDst_x1y1; | |
693 | 4325 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4326 v13 = v24; |
4327 | |
693 | 4328 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4329 { |
4330 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4331 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4332 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4333 { |
4334 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4335 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4336 } | |
4337 } | |
4338 | |
4339 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4340 | |
4341 /* while ( 1 ) | |
4342 { | |
4343 while ( 1 ) | |
4344 { | |
4345 v14 = *(int *)v10; | |
4346 v10 += 4; | |
4347 if ( v14 == v13 ) | |
4348 break; | |
4349 if ( (short)v14 == (short)v13 ) | |
4350 { | |
4351 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4352 v11 += 4; | |
4353 --uHalfWidth; | |
4354 if ( !uHalfWidth ) | |
4355 goto LABEL_21; | |
4356 } | |
4357 else | |
4358 { | |
4359 v15 = __ROL__(v14, 16); | |
4360 if ( (short)v15 == (short)v13 ) | |
4361 { | |
4362 v17 = __ROR__(v15, 16); | |
4363 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4364 v11 += 4; | |
4365 --uHalfWidth; | |
4366 if ( !uHalfWidth ) | |
4367 goto LABEL_21; | |
4368 } | |
4369 else | |
4370 { | |
4371 v16 = __ROR__(v15, 16); | |
4372 *(int *)v11 = v16; | |
4373 v11 += 4; | |
4374 --uHalfWidth; | |
4375 if ( !uHalfWidth ) | |
4376 goto LABEL_21; | |
4377 } | |
4378 } | |
4379 } | |
4380 v11 += 4; | |
4381 --uHalfWidth; | |
4382 if ( !uHalfWidth ) | |
4383 { | |
4384 LABEL_21: | |
4385 v10 += v21; | |
4386 v11 += v22; | |
4387 uHalfWidth = v20; | |
4388 if ( !--uNumLines ) | |
4389 { | |
4390 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4391 return; | |
4392 } | |
4393 } | |
4394 }*/ | |
4395 } | |
4396 } | |
4397 } | |
4398 } | |
4399 | |
4400 //----- (004A7063) -------------------------------------------------------- | |
4401 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4402 { | |
4403 float v2; // ST1C_4@1 | |
4404 double v3; // ST14_8@1 | |
4405 signed int v4; // ebx@1 | |
4406 float v5; // ST1C_4@1 | |
4407 double v6; // ST14_8@1 | |
4408 signed int v7; // edi@1 | |
4409 double v8; // ST0C_8@1 | |
4410 signed int v9; // esi@1 | |
4411 signed int v10; // ecx@1 | |
4412 double v12; // [sp+8h] [bp-18h]@1 | |
4413 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4414 | |
4415 v2 = (double)(uDiffuse >> 24) * a2; | |
4416 v3 = v2 + 6.7553994e15; | |
4417 v4 = LODWORD(v3); | |
4418 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4419 v6 = v5 + 6.7553994e15; | |
4420 v7 = LODWORD(v6); | |
4421 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4422 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4423 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4424 v9 = LODWORD(v8); | |
4425 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4426 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4427 v10 = LODWORD(v12); | |
4428 if ( v4 > 255 ) | |
4429 v4 = 255; | |
4430 if ( v4 < 0 ) | |
4431 v4 = 0; | |
4432 if ( SHIDWORD(v13) > 255 ) | |
4433 v7 = 255; | |
4434 if ( v7 < 0 ) | |
4435 v7 = 0; | |
4436 if ( (signed int)v13 > 255 ) | |
4437 v9 = 255; | |
4438 if ( v9 < 0 ) | |
4439 v9 = 0; | |
4440 if ( SLODWORD(v12) > 255 ) | |
4441 v10 = 255; | |
4442 if ( v10 < 0 ) | |
4443 v10 = 0; | |
4444 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4445 } | |
4446 | |
4447 //----- (004AD504) -------------------------------------------------------- | |
711 | 4448 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4449 { |
4450 int result; // eax@1 | |
711 | 4451 signed int v2; // ebx@1 |
0 | 4452 BLVFace *v3; // esi@3 |
4453 Texture *v4; // edi@6 | |
4454 int v5; // eax@7 | |
4455 int v6; // edx@7 | |
4456 int v7; // ecx@7 | |
4457 int v8; // ebx@8 | |
4458 int v9; // eax@8 | |
4459 int v10; // ebx@8 | |
4460 unsigned int v11; // ebx@9 | |
4461 int v12; // esi@10 | |
4462 int v13; // eax@13 | |
4463 unsigned __int16 *v14; // eax@13 | |
4464 unsigned int v15; // eax@14 | |
4465 unsigned __int16 *v16; // ebx@14 | |
4466 int v17; // eax@15 | |
4467 int v18; // ebx@15 | |
4468 int v19; // esi@15 | |
4469 int v20; // ecx@15 | |
4470 int v21; // eax@15 | |
4471 stru193_math *v22; // ebx@15 | |
4472 int v23; // eax@15 | |
4473 char *v24; // esi@16 | |
4474 int v25; // eax@18 | |
4475 int v26; // eax@18 | |
4476 int v27; // eax@20 | |
4477 signed int v28; // esi@20 | |
4478 signed int v29; // edx@20 | |
4479 signed int v30; // esi@20 | |
4480 signed int v31; // edi@20 | |
4481 int v32; // esi@20 | |
4482 int v33; // eax@26 | |
4483 int *v34; // esi@27 | |
4484 unsigned __int16 *v35; // edi@27 | |
4485 unsigned int v36; // edx@27 | |
4486 int v37; // ebx@27 | |
4487 char v38; // cl@27 | |
4488 char v39; // ch@27 | |
4489 int v40; // ebx@29 | |
4490 int v41; // edx@29 | |
4491 unsigned int v42; // ebx@30 | |
4492 int v43; // edx@30 | |
4493 int v44; // eax@33 | |
4494 int *v45; // esi@34 | |
4495 unsigned __int16 *v46; // edi@34 | |
4496 unsigned int v47; // edx@34 | |
4497 int v48; // ebx@34 | |
4498 char v49; // cl@34 | |
4499 char v50; // ch@34 | |
4500 int v51; // ebx@36 | |
4501 int v52; // edx@36 | |
4502 unsigned __int16 v53; // bx@37 | |
4503 int v54; // edx@37 | |
4504 int v55; // eax@40 | |
4505 int v56; // eax@41 | |
4506 int *v57; // esi@42 | |
4507 unsigned __int16 *v58; // edi@42 | |
4508 unsigned int v59; // edx@42 | |
4509 int v60; // ebx@42 | |
4510 char v61; // cl@42 | |
4511 char v62; // ch@42 | |
4512 unsigned int v63; // ebx@44 | |
4513 int v64; // edx@44 | |
4514 unsigned int v65; // ebx@44 | |
4515 int v66; // edx@44 | |
4516 unsigned int v67; // ebx@45 | |
4517 int v68; // edx@45 | |
4518 int v69; // ebx@45 | |
4519 int v70; // edx@45 | |
4520 int v71; // eax@48 | |
4521 int *v72; // esi@49 | |
4522 unsigned __int16 *v73; // edi@49 | |
4523 unsigned int v74; // edx@49 | |
4524 int v75; // ebx@49 | |
4525 char v76; // cl@49 | |
4526 char v77; // ch@49 | |
4527 unsigned int v78; // ebx@51 | |
4528 int v79; // edx@51 | |
4529 unsigned int v80; // ebx@51 | |
4530 int v81; // edx@51 | |
4531 unsigned int v82; // ebx@52 | |
4532 int v83; // edx@52 | |
4533 int v84; // ebx@52 | |
4534 int v85; // edx@52 | |
4535 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4536 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4537 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4538 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4539 int v90; // [sp+1Ch] [bp-88h]@20 | |
4540 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4541 int v92; // [sp+24h] [bp-80h]@7 | |
4542 int i; // [sp+28h] [bp-7Ch]@7 | |
4543 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4544 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4545 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4546 int v97; // [sp+38h] [bp-6Ch]@15 | |
4547 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4548 int v99; // [sp+40h] [bp-64h]@9 | |
4549 int v100; // [sp+44h] [bp-60h]@24 | |
4550 int v101; // [sp+48h] [bp-5Ch]@10 | |
4551 int v102; // [sp+4Ch] [bp-58h]@20 | |
4552 int v103; // [sp+50h] [bp-54h]@20 | |
4553 int v104; // [sp+54h] [bp-50h]@9 | |
4554 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4555 int v106; // [sp+5Ch] [bp-48h]@24 | |
4556 int v107; // [sp+60h] [bp-44h]@20 | |
4557 int v108; // [sp+64h] [bp-40h]@20 | |
4558 int v109; // [sp+68h] [bp-3Ch]@20 | |
4559 int v110; // [sp+6Ch] [bp-38h]@15 | |
4560 int v111; // [sp+70h] [bp-34h]@20 | |
4561 int a1; // [sp+74h] [bp-30h]@12 | |
4562 int a2; // [sp+78h] [bp-2Ch]@9 | |
4563 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4564 int v115; // [sp+80h] [bp-24h]@18 | |
4565 int v116; // [sp+84h] [bp-20h]@7 | |
4566 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4567 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4568 int *v119; // [sp+90h] [bp-14h]@13 | |
4569 int v120; // [sp+94h] [bp-10h]@15 | |
4570 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4571 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4572 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4573 | |
4574 result = pRenderer->uTargetSurfacePitch; | |
711 | 4575 v2 = sFaceID; |
0 | 4576 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4577 if ( sFaceID >= 0 ) |
4578 { | |
4579 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4580 { | |
4581 v3 = &pIndoor->pFaces[sFaceID]; | |
4582 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4583 if ( !pRenderer->pRenderD3D ) |
4584 { | |
711 | 4585 result = sub_423B5D(sFaceID); |
0 | 4586 if ( result ) |
4587 { | |
4588 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4589 if ( result ) | |
4590 { | |
4591 result = (int)v3->GetTexture(); | |
4592 v4 = (Texture *)result; | |
4593 v96 = (Texture *)result; | |
4594 if ( result ) | |
4595 { | |
4596 v5 = *(short *)(result + 38); | |
4597 LOBYTE(v3->uAttributes) |= 0x80u; | |
4598 v92 = v5; | |
4599 sub_4AE5F1(v2); | |
4600 ++pBLVRenderParams->field_84; | |
4601 v6 = stru_F8AD28.pDeltaUV[0]; | |
4602 v116 = stru_F8AD28.pDeltaUV[1]; | |
4603 v7 = 0; | |
4604 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4605 { | |
4606 v8 = v116; | |
4607 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4608 v9 = 4 * v7 + 16297672; | |
4609 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4610 } | |
4611 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4612 result = stru_F8A590._viewport_space_y; | |
4613 a2 = stru_F8A590._viewport_space_y; | |
4614 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4615 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4616 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4617 v87 = v4->pLevelOfDetail1; |
4618 v88 = v4->pLevelOfDetail2; | |
4619 v89 = v4->pLevelOfDetail3; | |
4620 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4621 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4622 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4623 { | |
4624 v12 = 2 * stru_F8A590._viewport_space_y; | |
4625 v101 = 2 * stru_F8A590._viewport_space_y; | |
4626 while ( 1 ) | |
4627 { | |
4628 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4629 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4630 if ( LOBYTE(viewparams->field_20) ) | |
4631 { | |
4632 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4633 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4634 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4635 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4636 - pBLVRenderParams->uViewportX]; | |
4637 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4638 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4639 - pBLVRenderParams->uViewportX]; | |
4640 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4641 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4642 - pBLVRenderParams->uViewportX]; | |
4643 v123 = (unsigned int)v16; | |
4644 } | |
4645 else | |
4646 { | |
4647 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4648 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4649 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4650 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4651 } | |
4652 v117 = (unsigned int)v14; | |
4653 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4654 v18 = stru_F81018.field_0.field_10; | |
4655 LOWORD(v17) = 0; | |
4656 v97 = stru_F8AD28.field_0 | v17; | |
4657 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4658 v19 = stru_F81018.field_0.field_4 >> i; | |
4659 v20 = 11 - v18; | |
4660 v116 = stru_F81018.field_0.field_8 >> i; | |
4661 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4662 v22 = stru_5C6E00; | |
4663 v122 = (unsigned __int16 *)v20; | |
323 | 4664 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4665 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4666 v120 = v116 + 4 * v23; |
4667 if ( v123 < v117 ) | |
4668 { | |
4669 v24 = (char *)&stru_F81018.field_34.field_8; | |
4670 v114 = &stru_F81018.field_34.field_8; | |
4671 a1 += 16; | |
4672 while ( 1 ) | |
4673 { | |
4674 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4675 v25 = *((int *)v24 - 2); | |
4676 LOWORD(v25) = 0; | |
4677 v115 = v97; | |
4678 v26 = stru_F8AD28.field_0 | v25; | |
4679 if ( v97 <= (unsigned int)v26 ) | |
4680 v115 = v26; | |
4681 v97 = v26; | |
4682 v27 = *((int *)v24 - 11); | |
4683 v28 = *((int *)v24 - 1); | |
4684 v105 = (&v86)[4 * v27]; | |
4685 v111 = v27 + 16; | |
4686 v29 = v4->uWidthMinus1; | |
4687 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4688 v107 = v29 >> v27; | |
4689 v30 = v28 >> i; | |
4690 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4691 v31 = *v114 >> i; | |
4692 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4693 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4694 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4695 v108 = (signed int)(v116 - v121) >> 4; |
4696 v103 = (v90 - v120) >> 4; | |
4697 v32 = v123 + 32; | |
4698 if ( LOBYTE(viewparams->field_20) ) | |
4699 v32 = v123 + 64; | |
4700 if ( v32 > v117 ) | |
4701 v32 = v117; | |
4702 v118 = v32; | |
4703 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4704 v106 = (signed int)(v32 - v123) >> 1; | |
4705 if ( v110 >> 16 == v100 >> 16 ) | |
4706 { | |
4707 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4708 if ( LOBYTE(viewparams->field_20) ) | |
4709 { | |
4710 v44 = v123; | |
4711 if ( v123 < v118 ) | |
4712 { | |
4713 v45 = v119; | |
4714 v46 = v122; | |
4715 v47 = v121; | |
4716 v48 = v120; | |
4717 v49 = v111; | |
4718 v50 = v109; | |
4719 if ( v106 & 2 ) | |
4720 { | |
4721 *v119 = v115; | |
4722 v45 -= 2; | |
4723 v44 = v123 + 4; | |
4724 goto LABEL_37; | |
4725 } | |
4726 do | |
4727 { | |
4728 v44 += 8; | |
4729 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4730 v52 = v115; | |
4731 LOWORD(v51) = v46[v51]; | |
4732 *v45 = v115; | |
4733 v45[1] = v52; | |
4734 v45[640] = v52; | |
4735 v45[641] = v52; | |
4736 *(short *)(v44 - 8) = v51; | |
4737 *(short *)(v44 - 6) = v51; | |
4738 *(short *)(v44 + 1272) = v51; | |
4739 *(short *)(v44 + 1274) = v51; | |
4740 v45[2] = v52; | |
4741 v45[3] = v52; | |
4742 v45[642] = v52; | |
4743 v45[643] = v52; | |
4744 v121 += v108; | |
4745 v120 += v103; | |
4746 v47 = v121; | |
4747 v48 = v120; | |
4748 LABEL_37: | |
4749 v45 += 4; | |
4750 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4751 v54 = v108; | |
4752 *(short *)(v44 - 4) = v53; | |
4753 *(short *)(v44 - 2) = v53; | |
4754 *(short *)(v44 + 1276) = v53; | |
4755 *(short *)(v44 + 1278) = v53; | |
4756 v121 += v54; | |
4757 v120 += v103; | |
4758 v47 = v121; | |
4759 v48 = v120; | |
4760 } | |
4761 while ( v44 < v118 ); | |
4762 v123 = v44; | |
4763 v119 = v45; | |
4764 } | |
4765 } | |
4766 else | |
4767 { | |
4768 v33 = v123; | |
4769 if ( v123 < v118 ) | |
4770 { | |
4771 v34 = v119; | |
4772 v35 = v122; | |
4773 v36 = v121; | |
4774 v37 = v120; | |
4775 v38 = v111; | |
4776 v39 = v109; | |
4777 if ( v106 & 1 ) | |
4778 { | |
4779 *v119 = v115; | |
4780 --v34; | |
4781 v33 = v123 + 2; | |
4782 goto LABEL_30; | |
4783 } | |
4784 do | |
4785 { | |
4786 v33 += 4; | |
4787 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4788 v41 = v115; | |
4789 LOWORD(v40) = v35[v40]; | |
4790 *v34 = v115; | |
4791 *(short *)(v33 - 4) = v40; | |
4792 v34[1] = v41; | |
4793 v121 += v108; | |
4794 v120 += v103; | |
4795 v36 = v121; | |
4796 v37 = v120; | |
4797 LABEL_30: | |
4798 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4799 v34 += 2; | |
4800 v43 = v108; | |
4801 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4802 v121 += v43; | |
4803 v120 += v103; | |
4804 v36 = v121; | |
4805 v37 = v120; | |
4806 } | |
4807 while ( v33 < v118 ); | |
4808 v123 = v33; | |
4809 v119 = v34; | |
4810 } | |
4811 } | |
4812 } | |
4813 else | |
4814 { | |
4815 v55 = v110 - ((v100 - v110) >> 4); | |
4816 v110 = (v100 - v110) >> 4; | |
4817 v122 = (unsigned __int16 *)v55; | |
4818 if ( LOBYTE(viewparams->field_20) ) | |
4819 { | |
4820 v71 = v123; | |
4821 if ( v123 < v118 ) | |
4822 { | |
4823 v72 = v119; | |
4824 v73 = v94; | |
4825 v74 = v121; | |
4826 v75 = v120; | |
4827 v76 = v111; | |
4828 v77 = v109; | |
4829 if ( v106 & 2 ) | |
4830 { | |
4831 *v119 = v115; | |
4832 v72 += 2; | |
4833 v71 = v123 + 4; | |
4834 goto LABEL_52; | |
4835 } | |
4836 do | |
4837 { | |
4838 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4839 v79 = (int)((char *)v122 + v110); | |
4840 v71 += 8; | |
4841 v122 = (unsigned __int16 *)v79; | |
4842 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4843 v81 = v115; | |
4844 LOWORD(v80) = v73[v80]; | |
4845 *v72 = v115; | |
4846 v72[1] = v81; | |
4847 v72[640] = v81; | |
4848 v72[641] = v81; | |
4849 *(short *)(v71 - 8) = v80; | |
4850 *(short *)(v71 - 6) = v80; | |
4851 *(short *)(v71 + 1272) = v80; | |
4852 *(short *)(v71 + 1274) = v80; | |
4853 v72[2] = v81; | |
4854 v72[3] = v81; | |
4855 v72[642] = v81; | |
4856 v72[643] = v81; | |
4857 v121 += v108; | |
4858 v120 += v103; | |
4859 v74 = v121; | |
4860 v75 = v120; | |
4861 v72 += 4; | |
4862 LABEL_52: | |
4863 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4864 v83 = (int)((char *)v122 + v110); | |
4865 v84 = v105[v82]; | |
4866 v122 = (unsigned __int16 *)v83; | |
4867 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4868 v85 = v108; | |
4869 *(short *)(v71 - 4) = v84; | |
4870 *(short *)(v71 - 2) = v84; | |
4871 *(short *)(v71 + 1276) = v84; | |
4872 *(short *)(v71 + 1278) = v84; | |
4873 v121 += v85; | |
4874 v120 += v103; | |
4875 v74 = v121; | |
4876 v75 = v120; | |
4877 } | |
4878 while ( v71 < v118 ); | |
4879 v123 = v71; | |
4880 v119 = v72; | |
4881 } | |
4882 } | |
4883 else | |
4884 { | |
4885 v56 = v123; | |
4886 if ( v123 < v118 ) | |
4887 { | |
4888 v57 = v119; | |
4889 v58 = v94; | |
4890 v59 = v121; | |
4891 v60 = v120; | |
4892 v61 = v111; | |
4893 v62 = v109; | |
4894 if ( v106 & 1 ) | |
4895 { | |
4896 *v119 = v115; | |
4897 ++v57; | |
4898 v56 = v123 + 2; | |
4899 goto LABEL_45; | |
4900 } | |
4901 do | |
4902 { | |
4903 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4904 v64 = (int)((char *)v122 + v110); | |
4905 v56 += 4; | |
4906 v122 = (unsigned __int16 *)v64; | |
4907 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4908 v66 = v115; | |
4909 LOWORD(v65) = v58[v65]; | |
4910 *v57 = v115; | |
4911 *(short *)(v56 - 4) = v65; | |
4912 v57[1] = v66; | |
4913 v121 += v108; | |
4914 v120 += v103; | |
4915 v59 = v121; | |
4916 v60 = v120; | |
4917 v57 += 2; | |
4918 LABEL_45: | |
4919 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4920 v68 = (int)((char *)v122 + v110); | |
4921 v69 = v105[v67]; | |
4922 v122 = (unsigned __int16 *)v68; | |
4923 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4924 v70 = v108; | |
4925 *(short *)(v56 - 2) = v69; | |
4926 v121 += v70; | |
4927 v120 += v103; | |
4928 v59 = v121; | |
4929 v60 = v120; | |
4930 } | |
4931 while ( v56 < v118 ); | |
4932 v123 = v56; | |
4933 v119 = v57; | |
4934 } | |
4935 } | |
4936 } | |
4937 v114 += 13; | |
4938 v110 = v100; | |
4939 a1 += 16; | |
4940 v4 = v96; | |
4941 v121 = v116; | |
4942 v120 = v90; | |
4943 if ( v123 >= v117 ) | |
4944 break; | |
4945 v24 = (char *)v114; | |
4946 v22 = stru_5C6E00; | |
4947 } | |
4948 } | |
4949 ++a2; | |
4950 v98 += v95; | |
4951 result = a2; | |
4952 v101 += 2; | |
4953 v99 += 640; | |
4954 if ( a2 > stru_F8A590._viewport_space_w ) | |
4955 break; | |
4956 v12 = v101; | |
4957 result = a2; | |
4958 v11 = v98; | |
4959 } | |
4960 } | |
4961 } | |
4962 } | |
4963 } | |
4964 } | |
4965 } | |
4966 } | |
4967 return result; | |
4968 } | |
4969 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4970 | |
4971 //----- (004ADD1D) -------------------------------------------------------- | |
4972 void __fastcall sub_4ADD1D(int uFaceID) | |
4973 { | |
4974 int v1; // edi@1 | |
4975 BLVFace *v2; // esi@3 | |
4976 signed int v3; // ebx@4 | |
4977 Texture *v4; // edi@9 | |
4978 signed int v5; // eax@9 | |
4979 char *v6; // edi@12 | |
4980 signed int v7; // eax@15 | |
4981 unsigned int v8; // eax@16 | |
4982 __int16 v9; // cx@19 | |
4983 unsigned __int8 *v10; // eax@19 | |
4984 unsigned __int16 *v11; // eax@19 | |
4985 int v12; // edi@19 | |
4986 int v13; // ebx@20 | |
4987 stru352 *v14; // esi@20 | |
4988 DWORD v15; // eax@22 | |
4989 signed int v16; // ecx@22 | |
4990 signed int v17; // ST68_4@22 | |
4991 int v18; // eax@22 | |
4992 int v19; // ecx@22 | |
4993 unsigned int v20; // esi@23 | |
4994 int v21; // edi@23 | |
4995 int v22; // eax@23 | |
4996 int *v23; // ebx@24 | |
4997 int v24; // edx@24 | |
4998 int v25; // ebx@25 | |
4999 unsigned __int16 v26; // cx@25 | |
5000 int v27; // edx@26 | |
5001 unsigned __int16 v28; // cx@26 | |
5002 unsigned __int8 v29; // sf@27 | |
5003 unsigned __int8 v30; // of@27 | |
5004 unsigned int v31; // esi@29 | |
5005 int v32; // edi@29 | |
5006 unsigned __int16 *v33; // eax@29 | |
5007 int *v34; // ebx@30 | |
5008 int v35; // edx@30 | |
5009 int v36; // ebx@31 | |
5010 unsigned __int16 v37; // cx@31 | |
5011 int v38; // edx@32 | |
5012 unsigned __int16 v39; // cx@32 | |
5013 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5014 int v41; // [sp-Ch] [bp-68h]@15 | |
5015 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5016 signed int v43; // [sp+14h] [bp-48h]@12 | |
5017 signed int v44; // [sp+14h] [bp-48h]@22 | |
5018 int v45; // [sp+1Ch] [bp-40h]@22 | |
5019 int v46; // [sp+20h] [bp-3Ch]@22 | |
5020 int v47; // [sp+24h] [bp-38h]@19 | |
5021 char v48; // [sp+28h] [bp-34h]@19 | |
5022 int v49; // [sp+2Ch] [bp-30h]@19 | |
5023 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5024 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5025 int v52; // [sp+38h] [bp-24h]@22 | |
5026 int v53; // [sp+3Ch] [bp-20h]@22 | |
5027 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5028 int v55; // [sp+40h] [bp-1Ch]@20 | |
5029 int v56; // [sp+44h] [bp-18h]@20 | |
5030 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5031 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5032 int v59; // [sp+50h] [bp-Ch]@4 | |
5033 int v60; // [sp+50h] [bp-Ch]@19 | |
5034 int v61; // [sp+54h] [bp-8h]@22 | |
5035 int *v62; // [sp+58h] [bp-4h]@23 | |
5036 int *v63; // [sp+58h] [bp-4h]@29 | |
5037 | |
5038 v1 = uFaceID; | |
5039 v42 = pRenderer->uTargetSurfacePitch; | |
5040 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5041 { | |
5042 v2 = &pIndoor->pFaces[uFaceID]; | |
5043 if ( pRenderer->pRenderD3D ) | |
5044 { | |
5045 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5046 v59 = v3; | |
5047 } | |
5048 else | |
5049 { | |
5050 v59 = sub_423B5D(uFaceID); | |
5051 v3 = v59; | |
5052 } | |
5053 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5054 { | |
5055 v4 = v2->GetTexture(); | |
5056 v5 = 0; | |
5057 if ( v4 ) | |
5058 { | |
5059 if ( pRenderer->pRenderD3D ) | |
5060 { | |
5061 if ( v3 > 0 ) | |
5062 { | |
5063 v54 = v3; | |
5064 v43 = v3; | |
5065 v6 = (char *)&array_507D30[0].v; | |
5066 do | |
5067 { | |
5068 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5069 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5070 v6 += 48; | |
5071 --v54; | |
5072 } | |
5073 while ( v54 ); | |
5074 v3 = v59; | |
5075 v5 = v43; | |
5076 } | |
5077 v7 = v5; | |
5078 v41 = stru_F8AD28.field_0; | |
5079 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5080 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5081 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5082 { | |
5083 v40 = v2->GetTexture(); | |
5084 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5085 } | |
5086 else | |
5087 { | |
5088 v40 = v2->GetTexture(); | |
5089 v8 = v2->uBitmapID; | |
5090 } | |
5091 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5092 } | |
5093 else | |
5094 { | |
5095 v49 = v4->uWidthMinus1; | |
5096 v47 = v4->uHeightMinus1 << 16; | |
5097 v9 = 16 - v4->uWidthLn2; | |
710 | 5098 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5099 LOBYTE(v2->uAttributes) |= 0x80u; |
5100 v48 = v9; | |
5101 v50 = v10; | |
5102 sub_4AF412(); | |
5103 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5104 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5105 v12 = stru_F8A590._viewport_space_y; | |
5106 v51 = v11; | |
5107 v60 = stru_F8A590._viewport_space_y; | |
5108 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5109 { | |
5110 v13 = 2 * stru_F8A590._viewport_space_y; | |
5111 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5112 v55 = 2 * stru_F8A590._viewport_space_y; | |
5113 v56 = 640 * stru_F8A590._viewport_space_y; | |
5114 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5115 { | |
5116 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5117 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5118 v15 = GetTickCount(); | |
5119 v16 = v14->field_0; | |
5120 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5121 v45 = v14->field_4 >> 3; | |
5122 v44 = v16 >> 3; | |
5123 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5124 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5125 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5126 v18 = v14->field_28; | |
5127 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5128 LOWORD(v18) = 0; | |
5129 v46 = stru_F8AD28.field_0 | v18; | |
5130 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5131 if ( LOBYTE(viewparams->field_20) ) | |
5132 { | |
5133 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5134 - pBLVRenderParams->uViewportX]; | |
5135 v31 = v44; | |
5136 v32 = v45; | |
5137 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5138 + 2 * v19 | |
5139 - pBLVRenderParams->uViewportX]; | |
5140 if ( v61 & 1 ) | |
5141 { | |
5142 --v61; | |
5143 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5144 + 2 * v19 | |
5145 - pBLVRenderParams->uViewportX | |
5146 - 2]; | |
5147 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5148 - pBLVRenderParams->uViewportX]; | |
5149 v35 = v46; | |
5150 v63 += 2; | |
5151 goto LABEL_32; | |
5152 } | |
5153 while ( 1 ) | |
5154 { | |
5155 v30 = __OFSUB__(v61, 2); | |
5156 v29 = v61 - 2 < 0; | |
5157 v61 -= 2; | |
5158 if ( v29 ^ v30 ) | |
5159 break; | |
5160 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5161 v31 += v52; | |
5162 v37 = v51[v36]; | |
5163 v32 += v53; | |
5164 v34 = v63; | |
5165 v35 = v46; | |
5166 *v33 = v37; | |
5167 v33[1] = v37; | |
5168 v33[640] = v37; | |
5169 v33[641] = v37; | |
5170 v63 += 4; | |
5171 v34[2] = v46; | |
5172 v34[3] = v46; | |
5173 v34[642] = v46; | |
5174 v34[643] = v46; | |
5175 LABEL_32: | |
5176 *v34 = v35; | |
5177 v34[1] = v35; | |
5178 v34[640] = v35; | |
5179 v34[641] = v35; | |
5180 v38 = v49 & (v31 >> 16); | |
5181 v33 += 4; | |
5182 v31 += v52; | |
5183 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5184 v32 += v53; | |
5185 *(v33 - 2) = v39; | |
5186 *(v33 - 1) = v39; | |
5187 v33[638] = v39; | |
5188 v33[639] = v39; | |
5189 } | |
5190 } | |
5191 else | |
5192 { | |
5193 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5194 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5195 v20 = v44; | |
5196 v21 = v45; | |
5197 v22 = (int)v58; | |
5198 if ( v61 & 1 ) | |
5199 { | |
5200 --v61; | |
5201 v22 = (int)(v58 - 1); | |
5202 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5203 v24 = v46; | |
5204 ++v62; | |
5205 goto LABEL_26; | |
5206 } | |
5207 while ( 1 ) | |
5208 { | |
5209 v30 = __OFSUB__(v61, 2); | |
5210 v29 = v61 - 2 < 0; | |
5211 v61 -= 2; | |
5212 if ( v29 ^ v30 ) | |
5213 break; | |
5214 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5215 v20 += v52; | |
5216 v26 = v51[v25]; | |
5217 v21 += v53; | |
5218 v23 = v62; | |
5219 v24 = v46; | |
5220 *(short *)v22 = v26; | |
5221 v62 += 2; | |
5222 v23[1] = v46; | |
5223 LABEL_26: | |
5224 *v23 = v24; | |
5225 v27 = v49 & (v20 >> 16); | |
5226 v22 += 4; | |
5227 v20 += v52; | |
5228 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5229 v21 += v53; | |
5230 *(short *)(v22 - 2) = v28; | |
5231 } | |
5232 } | |
5233 ++v60; | |
5234 ++i; | |
5235 v56 += 640; | |
5236 v55 += 2; | |
5237 if ( v60 > stru_F8A590._viewport_space_w ) | |
5238 break; | |
5239 v13 = v55; | |
5240 v12 = v60; | |
5241 } | |
5242 } | |
5243 } | |
5244 } | |
5245 } | |
5246 } | |
5247 } | |
5248 | |
5249 //----- (004AE1E7) -------------------------------------------------------- | |
5250 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5251 { | |
5252 int v3; // ebx@1 | |
5253 int v4; // edi@1 | |
5254 int v5; // esi@1 | |
5255 signed __int64 v6; // qtt@3 | |
5256 int v7; // esi@3 | |
5257 int v8; // eax@5 | |
5258 int result; // eax@5 | |
5259 int v10; // edx@5 | |
5260 int v11; // [sp+Ch] [bp-8h]@1 | |
5261 int v12; // [sp+1Ch] [bp+8h]@2 | |
5262 | |
5263 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5264 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5265 v11 = a1; | |
5266 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5267 + stru_F8AD28.field_7C | |
5268 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5269 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5270 { | |
5271 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5272 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5273 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5274 } | |
5275 else | |
5276 { | |
5277 v7 = 1073741824; | |
5278 } | |
5279 v8 = stru_F8AD28.vec_9C.z; | |
5280 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5281 + stru_F8AD28.vec_8C.x | |
5282 + v4 * stru_F8AD28.vec_8C.y) | |
5283 * (signed __int64)v7) >> 16) | |
5284 + stru_F8AD28.field_98; | |
5285 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5286 v10 = result + stru_F8AD28.field_A8; | |
5287 stru_F83B80[v11].field_28 = v7; | |
5288 stru_F83B80[v11].field_4 = v10; | |
5289 return result; | |
5290 } | |
5291 | |
5292 //----- (004AE313) -------------------------------------------------------- | |
5293 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5294 { | |
5295 int _dy; // ebx@1 | |
5296 int _dx; // edi@1 | |
5297 int v5; // ecx@1 | |
5298 int v6; // esi@1 | |
5299 int v7; // ST18_4@2 | |
5300 signed __int64 v8; // qtt@3 | |
5301 unsigned int v9; // ecx@3 | |
5302 int result; // eax@8 | |
5303 int v11; // [sp+Ch] [bp-8h]@1 | |
5304 | |
5305 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5306 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5307 ++pBLVRenderParams->field_88; | |
5308 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5309 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5310 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5311 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5312 { | |
5313 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5314 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5315 v9 = v8 / v11; | |
5316 } | |
5317 else | |
5318 { | |
5319 v9 = 0x40000000u; | |
5320 } | |
5321 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5322 p->field_0 = v9; | |
5323 else | |
5324 p->field_0 = stru_F8AD28.field_34; | |
5325 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5326 * (signed __int64)(signed int)v9) >> 16) | |
5327 + stru_F8AD28.field_98 | |
5328 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5329 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5330 * (signed __int64)(signed int)v9) >> 16) | |
5331 + stru_F8AD28.field_A8 | |
5332 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5333 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5334 if ( result < 369620 || bUseLoResSprites ) | |
5335 { | |
5336 if ( result < 184810 ) | |
5337 p->field_10 = result > 92405; | |
5338 else | |
5339 p->field_10 = 2; | |
5340 } | |
5341 else | |
5342 { | |
5343 p->field_10 = 3; | |
5344 } | |
5345 return result; | |
5346 } | |
5347 | |
5348 //----- (004AE491) -------------------------------------------------------- | |
5349 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5350 { | |
5351 signed int v2; // eax@1 | |
5352 signed int v3; // edi@1 | |
5353 int v4; // ecx@1 | |
5354 int v5; // esi@2 | |
5355 int v6; // eax@2 | |
5356 int v7; // ebx@2 | |
5357 unsigned int v8; // ecx@2 | |
5358 int v9; // edx@5 | |
5359 int v10; // edx@7 | |
5360 unsigned int v11; // eax@8 | |
5361 int v13; // [sp+4h] [bp-18h]@2 | |
5362 int v14; // [sp+8h] [bp-14h]@2 | |
5363 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5364 int v16; // [sp+14h] [bp-8h]@1 | |
5365 int v17; // [sp+18h] [bp-4h]@1 | |
5366 | |
5367 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5368 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5369 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5370 v4 = 0; | |
5371 v15 = v2; | |
5372 v16 = 0; | |
5373 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5374 { | |
5375 do | |
5376 { | |
5377 v5 = v16; | |
5378 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5379 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5380 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5381 v7 = v13; | |
5382 v8 = v14; | |
5383 if ( v6 < v13 ) | |
5384 { | |
5385 v6 = v13; | |
5386 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5387 } | |
5388 if ( v6 < v14 ) | |
5389 { | |
5390 v9 = v6; | |
5391 v6 = v14; | |
5392 v8 = v9; | |
5393 } | |
5394 if ( v7 < (signed int)v8 ) | |
5395 { | |
5396 v10 = v8; | |
5397 v8 = v7; | |
5398 v7 = v10; | |
5399 } | |
5400 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5401 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5402 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5403 ++v16; | |
5404 v2 = v15; | |
5405 } | |
5406 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5407 v4 = 0; | |
5408 } | |
5409 if ( stru_F8AD28.field_3E4 != v4 ) | |
5410 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5411 if ( v17 >= v4 ) | |
5412 { | |
5413 if ( v17 > 2031616 ) | |
5414 v17 = 2031616; | |
5415 } | |
5416 else | |
5417 { | |
5418 v17 = v4; | |
5419 } | |
5420 ++pBLVRenderParams->field_8C; | |
5421 return v17; | |
5422 } | |
5423 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5424 | |
5425 //----- (004AE5F1) -------------------------------------------------------- | |
5426 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5427 { | |
5428 BLVFace *v1; // esi@1 | |
5429 BLVFaceExtra *v2; // ebx@1 | |
5430 int v3; // eax@1 | |
5431 int v4; // edi@1 | |
5432 Texture *v5; // edi@1 | |
5433 int v6; // eax@1 | |
5434 unsigned int v7; // eax@1 | |
5435 unsigned int v8; // ecx@1 | |
5436 unsigned int v9; // eax@1 | |
5437 unsigned int v10; // ecx@5 | |
5438 int v11; // edi@10 | |
5439 int v12; // ecx@10 | |
5440 int v13; // eax@10 | |
5441 int v14; // edx@10 | |
5442 int v15; // ebx@12 | |
5443 double v16; // st7@16 | |
5444 int v17; // eax@16 | |
5445 char *v18; // ebx@17 | |
5446 int v19; // ecx@19 | |
5447 int v20; // eax@19 | |
5448 int v21; // edx@21 | |
5449 int v22; // eax@23 | |
5450 int v23; // ST04_4@26 | |
5451 int v24; // edi@26 | |
5452 double v25; // st6@26 | |
5453 int v26; // eax@26 | |
5454 double v27; // st6@26 | |
5455 int v28; // ecx@26 | |
5456 char v29; // al@26 | |
5457 int v30; // edx@28 | |
5458 int v31; // ecx@28 | |
5459 BLVLightMM7 *v32; // ecx@32 | |
5460 int v33; // edi@33 | |
5461 int v34; // edx@33 | |
5462 int v35; // eax@33 | |
5463 int v36; // edi@35 | |
5464 int v37; // edx@37 | |
5465 int v38; // ebx@39 | |
5466 int v39; // edi@42 | |
5467 int v40; // eax@42 | |
5468 char *v41; // ebx@45 | |
5469 signed int v42; // ecx@47 | |
5470 int v43; // edi@47 | |
5471 int v44; // eax@49 | |
5472 int v45; // edx@51 | |
5473 int v46; // eax@53 | |
5474 int v47; // ST04_4@55 | |
5475 int v48; // edi@55 | |
5476 double v49; // st6@55 | |
5477 int v50; // eax@55 | |
5478 double v51; // st6@55 | |
5479 int v52; // eax@55 | |
5480 int v53; // ecx@57 | |
5481 int v54; // ecx@58 | |
5482 int v55; // ecx@59 | |
5483 int v56; // edx@62 | |
5484 int v57; // ecx@62 | |
5485 int v58; // eax@63 | |
5486 int v59; // edx@64 | |
5487 int v60; // ecx@67 | |
5488 int v61; // edx@67 | |
5489 int v62; // eax@68 | |
5490 int v63; // edx@69 | |
5491 signed int v64; // ecx@72 | |
5492 double v65; // st7@75 | |
5493 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5494 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5495 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5496 int v69; // [sp+28h] [bp-18h]@10 | |
5497 int v70; // [sp+2Ch] [bp-14h]@10 | |
5498 int X; // [sp+30h] [bp-10h]@10 | |
5499 int v72; // [sp+34h] [bp-Ch]@10 | |
5500 int v73; // [sp+38h] [bp-8h]@10 | |
5501 int v74; // [sp+3Ch] [bp-4h]@10 | |
5502 | |
5503 v1 = &pIndoor->pFaces[uFaceID]; | |
5504 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5505 v3 = v1->uBitmapID; | |
5506 v4 = v1->uBitmapID; | |
5507 v68 = v2; | |
5508 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5509 v6 = 8 * uFaceID; | |
862 | 5510 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5511 stru_F8AD28.field_0 = v6; |
5512 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5513 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5514 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5515 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5516 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5517 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5518 v7 = GetTickCount(); | |
5519 v8 = v1->uAttributes; | |
5520 v9 = v7 >> 3; | |
5521 if ( v8 & 4 ) | |
5522 { | |
5523 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5524 } | |
5525 else | |
5526 { | |
5527 if ( v8 & 0x20 ) | |
5528 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5529 } | |
5530 v10 = v1->uAttributes; | |
5531 if ( BYTE1(v10) & 8 ) | |
5532 { | |
5533 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5534 } | |
5535 else | |
5536 { | |
5537 if ( v10 & 0x40 ) | |
5538 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5539 } | |
5540 v1->_get_normals(&v67, &v66); | |
5541 stru_F8AD28.vec_14.x = v67.x; | |
5542 stru_F8AD28.vec_14.y = v67.y; | |
5543 stru_F8AD28.vec_14.z = v67.z; | |
5544 stru_F8AD28.vec_20.x = v66.x; | |
5545 stru_F8AD28.vec_20.y = v66.y; | |
5546 stru_F8AD28.vec_20.z = v66.z; | |
5547 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5548 if ( pBLVRenderParams->sPartyRotX ) | |
5549 { | |
5550 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5551 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5552 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5553 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5554 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5555 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5556 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5557 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5558 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5559 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5560 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5561 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5562 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5563 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5564 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5565 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5566 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5567 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5568 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5569 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5570 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5571 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5572 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5573 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5574 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5575 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5576 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5577 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5578 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5579 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5580 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5581 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5582 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5583 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5584 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5585 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5586 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5587 v13 = pBLVRenderParams->vPartyPos.y; | |
5588 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5589 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5590 v14 = pBLVRenderParams->vPartyPos.x; | |
5591 } | |
5592 else | |
5593 { | |
5594 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5595 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5596 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5597 - v70; | |
5598 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5599 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5600 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5601 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5602 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5603 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5604 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5605 - v70; | |
5606 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5607 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5608 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5609 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5610 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5611 - v70; | |
5612 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5613 v14 = pBLVRenderParams->vPartyPos.x; | |
5614 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5615 v13 = pBLVRenderParams->vPartyPos.y; | |
5616 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5617 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5618 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5619 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5620 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5621 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5622 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5623 } | |
5624 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5625 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5626 + stru_F8AD28.plane_4.dist | |
5627 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5628 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5629 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5630 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5631 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5632 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5633 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5634 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5635 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5636 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5637 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5638 v15 = v70; | |
5639 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5640 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5641 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5642 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5643 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5644 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5645 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5646 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5647 stru_F8AD28.field_38 = 0; | |
5648 stru_F8AD28.field_A8 = -(X | |
5649 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5650 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5651 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5652 { | |
5653 stru_F8AD28.field_3E4 = 1; | |
5654 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5655 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5656 stru_F8AD28.field_3F0 = v68->field_1E; | |
5657 stru_F8AD28.field_3F4 = v68->field_20; | |
5658 } | |
5659 else | |
5660 { | |
5661 stru_F8AD28.field_3E4 = 0; | |
5662 } | |
5663 v16 = 0.0039215689; | |
5664 v17 = 116 * v1->uSectorID; | |
5665 v69 = v17; | |
5666 v74 = 0; | |
5667 v73 = 0; | |
5668 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5669 v70 = pMobileLightsStack->uNumLightsActive; | |
5670 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5671 { | |
5672 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5673 do | |
5674 { | |
5675 if ( v74 >= 20 ) | |
5676 break; | |
5677 v19 = *((short *)v18 + 2); | |
5678 v20 = *((short *)v18 - 1); | |
5679 if ( v20 > v1->pBounding.x1 - v19 ) | |
5680 { | |
5681 if ( v20 < v19 + v1->pBounding.x2 ) | |
5682 { | |
5683 v21 = *(short *)v18; | |
5684 if ( v21 > v1->pBounding.y1 - v19 ) | |
5685 { | |
5686 if ( v21 < v19 + v1->pBounding.y2 ) | |
5687 { | |
5688 v22 = *((short *)v18 + 1); | |
5689 if ( v22 > v1->pBounding.z1 - v19 ) | |
5690 { | |
5691 if ( v22 < v19 + v1->pBounding.z2 ) | |
5692 { | |
5693 X = (v1->pFacePlane_old.dist | |
5694 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5695 + v21 * v1->pFacePlane_old.vNormal.y | |
5696 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5697 if ( X <= v19 ) | |
5698 { | |
5699 v23 = X; | |
5700 v24 = v74; | |
5701 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5702 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5703 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5704 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5705 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5706 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5707 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5708 v25 = (double)(signed int)v68 * v16; | |
5709 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5710 v26 = (unsigned __int8)v18[8]; | |
5711 *(float *)(v24 * 4 + 16297992) = v25; | |
5712 v27 = (double)(signed int)v68; | |
5713 v68 = (BLVFaceExtra *)v26; | |
5714 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5715 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5716 v16 = 0.0039215689; | |
5717 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5718 v28 = v74; | |
5719 v29 = v18[9]; | |
5720 ++v74; | |
5721 stru_F8AD28._blv_lights_types[v28] = v29; | |
5722 } | |
5723 } | |
5724 } | |
5725 } | |
5726 } | |
5727 } | |
5728 } | |
5729 ++v73; | |
5730 v18 += 18; | |
5731 v17 = v69; | |
5732 } | |
5733 while ( v73 < v70 ); | |
5734 } | |
5735 v30 = 0; | |
5736 v73 = 0; | |
5737 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5738 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5739 if ( v31 > 0 ) | |
5740 { | |
5741 while ( v74 < 20 ) | |
5742 { | |
5743 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5744 if ( !(v32->uAtributes & 8) ) | |
5745 { | |
5746 v33 = v1->pBounding.x1; | |
5747 v34 = v32->vPosition.x; | |
5748 X = v32->uBrightness; | |
5749 v35 = v32->uRadius; | |
5750 v68 = (BLVFaceExtra *)v32->uRadius; | |
5751 if ( v34 > v33 - v35 ) | |
5752 { | |
5753 if ( v34 < v35 + v1->pBounding.x2 ) | |
5754 { | |
5755 v36 = v32->vPosition.y; | |
5756 if ( v36 > v1->pBounding.y1 - v35 ) | |
5757 { | |
5758 if ( v36 < v35 + v1->pBounding.y2 ) | |
5759 { | |
5760 v37 = v32->vPosition.z; | |
5761 if ( v37 > v1->pBounding.z1 - v35 ) | |
5762 { | |
5763 if ( v37 < v35 + v1->pBounding.z2 ) | |
5764 { | |
5765 v38 = (v1->pFacePlane_old.dist | |
5766 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5767 + v37 * v1->pFacePlane_old.vNormal.z | |
5768 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5769 if ( v38 >= 0 ) | |
5770 { | |
5771 if ( v38 <= v35 && v35 ) | |
5772 { | |
5773 v39 = v74; | |
5774 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5775 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5776 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5777 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5778 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5779 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5780 v68 = (BLVFaceExtra *)v32->uRed; | |
5781 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5782 v68 = (BLVFaceExtra *)v32->uGreen; | |
5783 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5784 v68 = (BLVFaceExtra *)v32->uBlue; | |
5785 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5786 v16 = 0.0039215689; | |
5787 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5788 v40 = v74++; | |
5789 stru_F8AD28._blv_lights_types[v40] = 1; | |
5790 } | |
5791 } | |
5792 } | |
5793 } | |
5794 } | |
5795 } | |
5796 } | |
5797 } | |
5798 } | |
5799 v30 = v73++ + 1; | |
5800 if ( v73 >= v70 ) | |
5801 break; | |
5802 v17 = v69; | |
5803 } | |
5804 } | |
5805 v73 = 0; | |
5806 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5807 { | |
5808 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5809 do | |
5810 { | |
5811 if ( v74 >= 20 ) | |
5812 break; | |
5813 v42 = *((short *)v41 + 2); | |
5814 v43 = *((short *)v41 - 1); | |
5815 if ( v43 > v1->pBounding.x1 - v42 ) | |
5816 { | |
5817 if ( v43 < v42 + v1->pBounding.x2 ) | |
5818 { | |
5819 v44 = *(short *)v41; | |
5820 if ( v44 > v1->pBounding.y1 - v42 ) | |
5821 { | |
5822 if ( v44 < v42 + v1->pBounding.y2 ) | |
5823 { | |
5824 v45 = *((short *)v41 + 1); | |
5825 if ( v45 > v1->pBounding.z1 - v42 ) | |
5826 { | |
5827 if ( v45 < v42 + v1->pBounding.z2 ) | |
5828 { | |
5829 v46 = (v1->pFacePlane_old.dist | |
5830 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5831 + v43 * v1->pFacePlane_old.vNormal.x | |
5832 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5833 v69 = v46; | |
5834 if ( v46 >= 0 ) | |
5835 { | |
5836 if ( v46 <= v42 ) | |
5837 { | |
5838 v47 = v69; | |
5839 v48 = v74; | |
5840 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5841 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5842 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5843 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5844 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5845 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5846 v49 = (double)(signed int)v68 * v16; | |
5847 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5848 v50 = (unsigned __int8)v41[8]; | |
5849 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5850 v51 = (double)(signed int)v68; | |
5851 v68 = (BLVFaceExtra *)v50; | |
5852 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5853 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5854 v16 = 0.0039215689; | |
5855 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5856 v52 = v74++; | |
5857 stru_F8AD28._blv_lights_types[v52] = 1; | |
5858 } | |
5859 } | |
5860 } | |
5861 } | |
5862 } | |
5863 } | |
5864 } | |
5865 } | |
5866 ++v73; | |
5867 v41 += 12; | |
5868 } | |
5869 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5870 } | |
5871 stru_F8AD28.uNumLightsApplied = v74; | |
5872 v53 = v1->pBounding.x2; | |
5873 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5874 { | |
5875 v55 = v1->pBounding.x1; | |
5876 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5877 v54 = 0; | |
5878 else | |
5879 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5880 } | |
5881 else | |
5882 { | |
5883 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5884 } | |
5885 v56 = v1->pBounding.y2; | |
5886 v57 = v54 * v54; | |
5887 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5888 { | |
5889 v59 = v1->pBounding.y1; | |
5890 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5891 v58 = 0; | |
5892 else | |
5893 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5894 } | |
5895 else | |
5896 { | |
5897 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5898 } | |
5899 v60 = v58 * v58 + v57; | |
5900 v61 = v1->pBounding.z2; | |
5901 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5902 { | |
5903 v63 = v1->pBounding.z1; | |
5904 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5905 v62 = 0; | |
5906 else | |
5907 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5908 } | |
5909 else | |
5910 { | |
5911 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5912 } | |
5913 v64 = v62 * v62 + v60; | |
5914 if ( v64 ) | |
295 | 5915 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5916 else |
5917 stru_F8AD28.field_34 = 0; | |
5918 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5919 v65 = (double)(signed int)v68; | |
5920 if ( v65 >= 655.36 ) | |
5921 { | |
5922 if ( v65 >= 26214.4 ) | |
5923 { | |
5924 if ( v65 >= 45875.2 ) | |
5925 { | |
5926 stru_F8AD28.field_44 = 8; | |
5927 stru_F8AD28.field_48 = 3; | |
5928 } | |
5929 else | |
5930 { | |
5931 stru_F8AD28.field_44 = 16; | |
5932 stru_F8AD28.field_48 = 4; | |
5933 } | |
5934 } | |
5935 else | |
5936 { | |
5937 stru_F8AD28.field_44 = 32; | |
5938 stru_F8AD28.field_48 = 5; | |
5939 } | |
5940 } | |
5941 else | |
5942 { | |
5943 stru_F8AD28.field_44 = 64; | |
5944 stru_F8AD28.field_48 = 6; | |
5945 } | |
5946 } | |
5947 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5948 | |
5949 //----- (004AF412) -------------------------------------------------------- | |
5950 int __cdecl sub_4AF412() | |
5951 { | |
5952 int v0; // ST20_4@2 | |
5953 int v1; // ST20_4@2 | |
5954 int v2; // ST20_4@2 | |
5955 int v3; // esi@2 | |
5956 int v4; // ST20_4@2 | |
5957 int v5; // ecx@2 | |
5958 int v6; // ebx@2 | |
5959 int v7; // edi@2 | |
5960 int v8; // edx@2 | |
5961 int v9; // eax@2 | |
5962 int result; // eax@4 | |
5963 | |
5964 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5965 stru_F8AD28.vec_20.y = -65536; | |
5966 stru_F8AD28.plane_4.vNormal.x = 0; | |
5967 stru_F8AD28.plane_4.vNormal.y = 0; | |
5968 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5969 stru_F8AD28.vec_14.x = 65536; | |
5970 stru_F8AD28.vec_14.y = 0; | |
5971 stru_F8AD28.vec_14.z = 0; | |
5972 stru_F8AD28.vec_20.x = 0; | |
5973 stru_F8AD28.vec_20.z = 0; | |
5974 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5975 if ( pBLVRenderParams->sPartyRotX ) | |
5976 { | |
5977 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5978 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5979 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5980 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5981 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5982 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5983 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5984 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5985 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5986 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5987 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5988 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5989 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5990 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5991 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5992 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5993 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5994 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5995 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5996 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5997 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5998 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5999 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6000 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6001 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6002 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6003 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6004 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6005 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6006 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6007 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6008 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6009 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6010 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6011 v6 = pBLVRenderParams->vPartyPos.z; | |
6012 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6013 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6014 v8 = pBLVRenderParams->vPartyPos.y; | |
6015 v9 = pBLVRenderParams->vPartyPos.x; | |
6016 } | |
6017 else | |
6018 { | |
6019 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6020 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6021 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6022 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6023 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6024 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6025 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6026 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6027 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6028 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6029 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6030 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6031 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6032 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6033 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6034 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6035 v8 = pBLVRenderParams->vPartyPos.y; | |
6036 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6037 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6038 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6039 v9 = pBLVRenderParams->vPartyPos.x; | |
6040 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6041 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6042 v6 = pBLVRenderParams->vPartyPos.z; | |
6043 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6044 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6045 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6046 } | |
6047 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6048 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6049 + stru_F8AD28.plane_4.dist | |
6050 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6051 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6052 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6053 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6054 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6055 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6056 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6057 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6058 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6059 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6060 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6061 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6062 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6063 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6064 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6065 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6066 result = 0; | |
6067 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6068 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6069 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6070 stru_F8AD28.field_38 = 0; | |
6071 stru_F8AD28.field_3E4 = 0; | |
6072 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6073 stru_F8AD28.uNumLightsApplied = 0; | |
6074 stru_F8AD28.field_34 = 0; | |
6075 return result; | |
6076 } | |
6077 | |
6078 //----- (004B1447) -------------------------------------------------------- | |
6079 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6080 { | |
6081 signed int v3; // esi@1 | |
6082 char v4; // sf@8 | |
6083 int v5; // eax@8 | |
6084 unsigned __int64 v6; // qax@12 | |
6085 DDM_DLV_Header *v7; // eax@14 | |
6086 Player **v8; // edi@18 | |
6087 Player *result; // eax@19 | |
735 | 6088 //char *v10; // esi@20 |
0 | 6089 |
6090 v3 = 0; | |
6091 if ( a2 ) | |
6092 { | |
6093 if ( a2 != 1 ) | |
6094 { | |
6095 if ( a2 == 2 ) | |
6096 v3 = 2; | |
6097 goto LABEL_13; | |
6098 } | |
6099 v3 = 2; | |
6100 } | |
6101 else | |
6102 { | |
6103 v3 = 1; | |
6104 } | |
6105 if ( pParty->uFine < 4000000 ) | |
6106 { | |
6107 v4 = a3 + pParty->uFine < 0; | |
6108 v5 = a3 + pParty->uFine; | |
6109 pParty->uFine += a3; | |
6110 if ( v4 ) | |
6111 { | |
6112 v5 = 0; | |
6113 pParty->uFine = 0; | |
6114 } | |
6115 if ( v5 > 4000000 ) | |
6116 pParty->uFine = 4000000; | |
6117 } | |
487 | 6118 |
6119 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6120 | |
0 | 6121 LABEL_13: |
463 | 6122 pParty->InTheShopFlags[a1] = 1; |
0 | 6123 if ( v3 ) |
6124 { | |
6125 v7 = &pOutdoor->ddm; | |
6126 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6127 v7 = &pIndoor->dlv; | |
6128 v7->uReputation += v3; | |
6129 if ( v7->uReputation > 10000 ) | |
6130 v7->uReputation = 10000; | |
6131 } | |
6132 v8 = &pPlayers[1]; | |
6133 do | |
6134 { | |
6135 result = *v8; | |
6136 if ( pParty->uFine ) | |
6137 { | |
735 | 6138 //v10 = result->_guilds_member_bits; |
484 | 6139 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6140 if ( !(short)result ) |
735 | 6141 __debugbreak(); |
501 | 6142 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6143 } |
6144 ++v8; | |
6145 } | |
6146 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6147 return result; | |
6148 } | |
6149 | |
6150 //----- (004B1523) -------------------------------------------------------- | |
762 | 6151 void __thiscall sub_4B1523(int *_this) |
0 | 6152 { |
6153 int v1; // esi@1 | |
6154 int v2; // edx@1 | |
6155 unsigned int v3; // eax@2 | |
6156 int v4; // eax@4 | |
6157 LONG v5; // ecx@4 | |
6158 int v6; // eax@10 | |
6159 char *v7; // ST44_4@12 | |
6160 unsigned __int16 v8; // ax@12 | |
6161 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6162 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6163 POINT a2; // [sp+64h] [bp-10h]@1 | |
6164 int v13; // [sp+6Ch] [bp-8h]@4 | |
6165 int v14; // [sp+70h] [bp-4h]@4 | |
6166 | |
6167 v1 = *_this - 399; | |
6168 v2 = (*_this - 400) % 11 + 1; | |
6169 v11 = 4 * (*_this - 400) / 11; | |
6170 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6171 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6172 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6173 else | |
6174 v3 = 30; | |
6175 a1.Hint = 0; | |
6176 a1.uFrameY = v3; | |
6177 a1.uFrameWidth = 328; | |
6178 a1.uFrameHeight = 68; | |
6179 a1.uFrameX = 90; | |
6180 a1.uFrameZ = 417; | |
6181 a1.uFrameW = v3 + 67; | |
6182 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6183 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6184 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6185 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6186 v5 = a2.y; | |
6187 if ( v14 > a2.y ) | |
6188 v5 = v14; | |
6189 if ( v13 > v5 ) | |
6190 v5 = v13; | |
6191 if ( v4 > v5 ) | |
6192 v5 = v4; | |
262 | 6193 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", |
6194 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6195 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6196 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6197 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6198 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6199 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6200 a1.uFrameHeight += v6; | |
6201 if ( (signed int)a1.uFrameHeight < 150 ) | |
6202 a1.uFrameHeight = 150; | |
819 | 6203 a1.uFrameWidth = game_viewport_width; |
0 | 6204 a1.DrawMessageBox(0); |
6205 a1.uFrameWidth -= 12; | |
6206 a1.uFrameHeight -= 12; | |
6207 v7 = pSpellStats->pInfos[v1].pName; | |
6208 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6209 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6210 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6211 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
6212 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6213 a1.uFrameZ = a1.uFrameX + 107; | |
6214 a1.uFrameWidth = 108; | |
6215 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6216 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6217 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6218 } |
6219 | |
6220 //----- (004B1784) -------------------------------------------------------- | |
6221 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6222 { | |
6223 Player *pPlayer; // ebx@1 | |
6224 bool result; // eax@2 | |
6225 unsigned __int16 v2; // ST0C_2@3 | |
6226 int v3; // eax@3 | |
6227 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6228 | |
6229 pPlayer = pPlayers[uActiveCharacter]; | |
6230 if ( pPlayer->CanAct() ) | |
6231 { | |
6232 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6233 result = 1; | |
6234 } | |
6235 else | |
6236 { | |
6237 pDialogueWindow->pNumPresenceButton = 0; | |
6238 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6239 v4.uFrameX = 483; | |
6240 v4.uFrameWidth = 148; | |
6241 v4.uFrameZ = 334; | |
6242 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6243 // "%s is in no condition to %s" | |
6244 // "do anything" | |
949 | 6245 v2 = TargetColor(255, 255, 0x9Bu); |
0 | 6246 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6247 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6248 result = 0; | |
6249 } | |
6250 return result; | |
6251 } | |
6252 // F8B1E0: using guessed type int dword_F8B1E0; | |
6253 | |
6254 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6255 void __cdecl ShowPopupShopItem() |
0 | 6256 { |
6257 POINT *v1; // esi@5 | |
6258 unsigned int v2; // eax@5 | |
6259 int v3; // ecx@5 | |
6260 POINT *v4; // esi@12 | |
6261 int v5; // eax@12 | |
6262 unsigned int v6; // eax@13 | |
6263 ItemGen *v7; // ecx@13 | |
6264 signed int v8; // esi@17 | |
6265 unsigned int v9; // eax@19 | |
475 | 6266 POINT v10; // [sp+8h] [bp-44h]@12 |
6267 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6268 POINT v12; // [sp+18h] [bp-34h]@18 | |
6269 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6270 POINT v14; // [sp+28h] [bp-24h]@17 | |
6271 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6272 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6273 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6274 |
484 | 6275 if ( in_current_building_type <= 0 ) |
0 | 6276 return; |
484 | 6277 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6278 { |
749 | 6279 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6280 { | |
6281 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6282 return; |
749 | 6283 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6284 { |
475 | 6285 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6286 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6287 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6288 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6289 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6290 return; |
907 | 6291 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6292 return; |
6293 } | |
749 | 6294 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6295 return; |
6296 } | |
475 | 6297 v4 = pMouse->GetCursorPos(&v11); |
6298 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6299 if ( !v5 ) |
6300 return; | |
336 | 6301 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6302 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6303 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6304 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6305 GameUI_DrawItemInfo(v7); | |
6306 return; | |
0 | 6307 } |
874 | 6308 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6309 { |
6310 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6311 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6312 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6313 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6314 if ( v5 ) | |
336 | 6315 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6316 } |
6317 } | |
6318 // F8B198: using guessed type int dword_F8B198; | |
6319 // F8B19C: using guessed type int dword_F8B19C; | |
6320 | |
6321 //----- (004B1BDB) -------------------------------------------------------- | |
6322 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6323 { | |
6324 signed __int64 v1; // ST2C_8@1 | |
6325 signed __int64 v2; // qax@1 | |
6326 signed __int64 v3; // ST1C_8@1 | |
6327 unsigned __int64 v4; // qax@1 | |
6328 unsigned int v5; // ebx@1 | |
112 | 6329 Player *v6; // ebx@1 |
0 | 6330 |
6331 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6332 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6333 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6334 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6335 v2 = v1 / 60 / 60; | |
6336 v3 = v2; | |
6337 v4 = (unsigned int)v2 / 0x18; | |
6338 v5 = (unsigned int)(v4 / 7) >> 2; | |
6339 pParty->uCurrentTimeSecond = v1 % 60; | |
6340 pParty->uCurrentMinute = v1 / 60 % 60; | |
6341 pParty->uCurrentHour = v3 % 24; | |
6342 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6343 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6344 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6345 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6346 pParty->RestAndHeal(); |
6347 dword_507B94 = 1; | |
112 | 6348 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6349 do |
6350 { | |
112 | 6351 v6->uTimeToRecovery = 0; |
6352 memset(&v6->uTimeToRecovery, 0, 4u); | |
6353 ++v6; | |
6354 } | |
6355 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6356 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6357 } |
6358 // 507B94: using guessed type int dword_507B94; | |
6359 | |
6360 //----- (004B1D27) -------------------------------------------------------- | |
6361 void __cdecl sub_4B1D27() | |
6362 { | |
6363 int v0; // edx@2 | |
6364 unsigned int v1; // ecx@7 | |
6365 signed int v2; // edi@10 | |
6366 int v3; // esi@10 | |
6367 __int16 v4; // ax@15 | |
6368 signed int v5; // edi@20 | |
6369 int v6; // esi@20 | |
6370 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6371 | |
484 | 6372 if ( in_current_building_type > 0 ) |
0 | 6373 { |
6374 v0 = 3; | |
484 | 6375 if ( in_current_building_type > BildingType_MagicShop ) |
6376 { | |
6377 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6378 { |
6379 if ( !dword_F8B1E4 ) | |
6380 return; | |
6381 } | |
6382 else | |
6383 { | |
484 | 6384 if ( in_current_building_type != BildingType_Temple ) |
0 | 6385 return; |
6386 } | |
336 | 6387 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6388 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6389 return; |
6390 } | |
336 | 6391 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6392 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6393 { |
6394 if ( pParty->uNumGold <= 0x2710 ) | |
6395 { | |
6396 if ( !dword_F8B1E4 ) | |
6397 return; | |
6398 v0 = 4; | |
907 | 6399 PlayHouseSound(v1, (HouseSoundID)v0); |
6400 return; | |
0 | 6401 } |
735 | 6402 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6403 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6404 { | |
6405 v5 = 0; | |
6406 v6 = 1; | |
6407 do | |
6408 { | |
6409 if ( pPlayers[v6]->CanAct() ) | |
6410 v7[v5++] = v6; | |
6411 ++v6; | |
6412 } | |
6413 while ( v6 <= 4 ); | |
6414 if ( v5 ) | |
6415 { | |
6416 qword_A750D8 = 256i64; | |
6417 word_A750E0 = 80; | |
6418 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6419 word_A750E2 = v4; |
6420 return; | |
0 | 6421 } |
6422 } | |
6423 } | |
6424 else | |
6425 { | |
6426 if ( !qword_A750D8 ) | |
6427 { | |
6428 v2 = 0; | |
6429 v3 = 1; | |
6430 do | |
6431 { | |
6432 if ( pPlayers[v3]->CanAct() ) | |
6433 v7[v2++] = v3; | |
6434 ++v3; | |
6435 } | |
6436 while ( v3 <= 4 ); | |
6437 if ( v2 ) | |
6438 { | |
6439 qword_A750D8 = 256i64; | |
6440 word_A750E0 = 80; | |
6441 v4 = LOWORD(v7[rand() % v2]); | |
6442 word_A750E2 = v4; | |
6443 return; | |
6444 } | |
6445 } | |
6446 } | |
6447 } | |
6448 } | |
6449 | |
6450 //----- (004B1ECE) -------------------------------------------------------- | |
6451 void __cdecl sub_4B1ECE() | |
6452 { | |
6453 __int16 *v0; // edi@1 | |
6454 int v1; // ebx@3 | |
6455 Player *v2; // esi@3 | |
6456 int v3; // eax@4 | |
6457 signed int v4; // eax@9 | |
6458 int v5; // ebx@11 | |
89 | 6459 Player *v6; // esi@13 |
6460 ItemGen *v7; // eax@14 | |
0 | 6461 signed int v8; // edi@14 |
89 | 6462 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6463 signed int v10; // [sp+10h] [bp-8h]@13 |
6464 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6465 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6466 |
484 | 6467 contract_approved = 0; |
0 | 6468 v11 = 0; |
6469 uDialogueType = 84; | |
827 | 6470 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6471 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6472 while ( 1 ) | |
6473 { | |
484 | 6474 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6475 { |
6476 v1 = 0; | |
6477 v2 = pParty->pPlayers; | |
6478 do | |
6479 { | |
89 | 6480 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6481 if ( v3 ) |
6482 break; | |
6483 ++v2; | |
6484 ++v1; | |
6485 } | |
6486 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6487 if ( v1 == 4 ) | |
6488 break; | |
6489 } | |
6490 ++v11; | |
6491 v0 += 2; | |
89 | 6492 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6493 break; | |
6494 } | |
6495 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6496 { | |
827 | 6497 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6498 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6499 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6500 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6501 } | |
484 | 6502 if ( contract_approved == 601 ) |
0 | 6503 { |
6504 v5 = 0; | |
89 | 6505 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6506 v9 = 0; |
6507 while ( 1 ) | |
6508 { | |
135 | 6509 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6510 { |
6511 v10 = 0; | |
89 | 6512 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6513 do |
6514 { | |
89 | 6515 v7 = v6->pInventoryItems; |
0 | 6516 v8 = 138; |
6517 do | |
6518 { | |
89 | 6519 if ( v7->uItemID == 601 ) |
0 | 6520 { |
377 | 6521 if ( !v7->uHolderPlayer ) |
89 | 6522 v9 = v7; |
377 | 6523 if ( v7->uHolderPlayer == v5 ) |
0 | 6524 v10 = 1; |
6525 } | |
89 | 6526 ++v7; |
0 | 6527 --v8; |
6528 } | |
6529 while ( v8 ); | |
89 | 6530 ++v6; |
6531 } | |
6532 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6533 if ( !v10 ) |
6534 break; | |
6535 } | |
89 | 6536 ++v12; |
0 | 6537 ++v5; |
89 | 6538 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6539 return; |
6540 } | |
6541 if ( v9 ) | |
377 | 6542 v9->uHolderPlayer = v5; |
0 | 6543 } |
6544 } | |
6545 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6546 // 722B3C: using guessed type int dword_722B3C; | |
6547 // 722B44: using guessed type int dword_722B44; | |
6548 // F8B1A8: using guessed type int dword_F8B1A8; | |
6549 | |
6550 //----- (004B2001) -------------------------------------------------------- | |
459 | 6551 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6552 { | |
6553 //signed int v1; // eax@1 | |
6554 NPCData *pCurrentNPCInfo; // ebp@1 | |
6555 int pEventNumber; // ecx@8 | |
0 | 6556 Player *v4; // esi@20 |
467 | 6557 //int v5; // eax@28 |
6558 //int v6; // eax@31 | |
6559 //int v7; // eax@34 | |
6560 //int v8; // eax@37 | |
6561 //int v9; // eax@40 | |
6562 //unsigned int v10; // eax@43 | |
0 | 6563 char *v12; // eax@53 |
6564 char *v13; // eax@56 | |
6565 char *v14; // eax@57 | |
6566 char *v15; // eax@58 | |
467 | 6567 //unsigned int v16; // ebp@62 |
0 | 6568 char *v17; // ecx@63 |
6569 char *v18; // eax@65 | |
6570 const char *v19; // ecx@68 | |
248 | 6571 //unsigned int v20; // eax@69 |
467 | 6572 signed int pPrice; // ecx@70 |
0 | 6573 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6574 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6575 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6576 //int v25; // [sp-4h] [bp-10h]@49 |
6577 | |
459 | 6578 uDialogueType = uMessageParam + 1; |
6579 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6580 if ( uMessageParam <= 24 ) |
460 | 6581 { |
459 | 6582 switch ( uMessageParam ) |
6583 { | |
6584 case 13: | |
827 | 6585 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6586 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6587 NPCHireableDialogPrepare(); |
459 | 6588 dialogue_show_profession_details = false; |
6589 goto _return; | |
6590 case 19: | |
6591 pEventNumber = pCurrentNPCInfo->evt_A; | |
6592 break; | |
6593 case 20: | |
6594 pEventNumber = pCurrentNPCInfo->evt_B; | |
6595 break; | |
6596 case 21: | |
6597 pEventNumber = pCurrentNPCInfo->evt_C; | |
6598 break; | |
6599 case 22: | |
6600 pEventNumber = pCurrentNPCInfo->evt_D; | |
6601 break; | |
6602 case 23: | |
6603 pEventNumber = pCurrentNPCInfo->evt_E; | |
6604 break; | |
6605 case 24: | |
6606 pEventNumber = pCurrentNPCInfo->evt_F; | |
6607 break; | |
6608 default: | |
467 | 6609 goto _return; |
6610 } | |
6611 /*switch ( pEventNumber ) | |
6612 { | |
6613 case 139: | |
6614 sub_4B1ECE(); | |
6615 goto _return; | |
6616 case 311: | |
6617 sub_4BBA85_bounties(); | |
6618 goto _return; | |
6619 }*/ | |
459 | 6620 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6621 { | |
6622 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6623 { | |
6624 if ( pEventNumber == 139 ) | |
0 | 6625 { |
6626 sub_4B1ECE(); | |
6627 } | |
6628 else | |
6629 { | |
459 | 6630 if ( pEventNumber == 311 ) |
0 | 6631 { |
6632 sub_4BBA85_bounties(); | |
6633 } | |
6634 else | |
6635 { | |
827 | 6636 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6637 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6638 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6639 activeLevelDecoration = NULL; |
0 | 6640 } |
6641 } | |
6642 } | |
6643 else | |
6644 { | |
459 | 6645 dword_F8B1D8 = uMessageParam; |
6646 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6647 } |
6648 } | |
6649 else | |
6650 { | |
459 | 6651 sub_4B3FE5(pEventNumber); |
0 | 6652 } |
6653 goto _return; | |
460 | 6654 } |
459 | 6655 if ( uMessageParam != 76 ) |
6656 { | |
6657 if ( uMessageParam == 77 ) | |
6658 { | |
467 | 6659 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6660 if (dialogue_show_profession_details) |
459 | 6661 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6662 else |
459 | 6663 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6664 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6665 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6666 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6667 current_npc_text = v18; |
0 | 6668 } |
6669 else | |
6670 { | |
459 | 6671 if ( uMessageParam == 79 ) |
0 | 6672 { |
484 | 6673 if ( contract_approved ) |
0 | 6674 { |
267 | 6675 Party::TakeGold(gold_transaction_amount); |
0 | 6676 if ( uActiveCharacter ) |
6677 { | |
492 | 6678 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6679 *(short *)v12 &= 0x3Fu; |
6680 switch ( dword_F8B1B0 ) | |
6681 { | |
6682 case 2: | |
492 | 6683 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6684 *v15 |= 0x40u; |
6685 break; | |
6686 case 3: | |
492 | 6687 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6688 *v14 |= 0x80u; |
6689 break; | |
6690 case 4: | |
492 | 6691 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6692 v13[1] |= 1u; |
6693 break; | |
6694 } | |
187 | 6695 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6696 } |
437 | 6697 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6698 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6699 { |
990 | 6700 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6701 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6702 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6703 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6704 }*/ |
0 | 6705 } |
6706 } | |
6707 else | |
6708 { | |
492 | 6709 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6710 { |
267 | 6711 Party::TakeGold(gold_transaction_amount); |
0 | 6712 v4 = pParty->pPlayers; |
6713 do | |
6714 { | |
492 | 6715 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6716 ++v4; |
6717 } | |
6718 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6719 switch ( dword_F8B1D8 ) | |
6720 { | |
6721 case 19: | |
467 | 6722 pEventNumber = pCurrentNPCInfo->evt_A; |
6723 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6724 pCurrentNPCInfo->evt_A = 0; |
0 | 6725 break; |
6726 case 20: | |
467 | 6727 pEventNumber = pCurrentNPCInfo->evt_B; |
6728 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6729 pCurrentNPCInfo->evt_B = 0; |
0 | 6730 break; |
6731 case 21: | |
467 | 6732 pEventNumber = pCurrentNPCInfo->evt_C; |
6733 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6734 pCurrentNPCInfo->evt_C = 0; |
0 | 6735 break; |
6736 case 22: | |
467 | 6737 pEventNumber = pCurrentNPCInfo->evt_D; |
6738 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6739 pCurrentNPCInfo->evt_D = 0; |
0 | 6740 break; |
6741 case 23: | |
467 | 6742 pEventNumber = pCurrentNPCInfo->evt_E; |
6743 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6744 pCurrentNPCInfo->evt_E = 0; |
0 | 6745 break; |
6746 case 24: | |
467 | 6747 pEventNumber = pCurrentNPCInfo->evt_F; |
6748 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6749 pCurrentNPCInfo->evt_F = 0; | |
0 | 6750 break; |
6751 } | |
437 | 6752 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6753 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6754 { |
990 | 6755 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6756 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6757 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6758 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6759 }*/ |
467 | 6760 //v11 = uActiveCharacter; |
0 | 6761 if ( uActiveCharacter ) |
6762 { | |
467 | 6763 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6764 goto _return; |
6765 } | |
6766 } | |
6767 } | |
6768 } | |
6769 goto _return; | |
6770 } | |
6771 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6772 { | |
467 | 6773 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6774 goto _return; |
6775 } | |
459 | 6776 if ( pCurrentNPCInfo->uProfession != 51 ) |
6777 { | |
467 | 6778 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6779 if ( pParty->uNumGold < pPrice ) | |
6780 { | |
6781 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6782 dialogue_show_profession_details = false; |
0 | 6783 uDialogueType = 13; |
827 | 6784 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6785 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6786 if ( uActiveCharacter ) |
248 | 6787 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6788 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6789 goto _return; | |
6790 } | |
6791 Party::TakeGold(pPrice); | |
0 | 6792 } |
147 | 6793 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6794 pCurrentNPCInfo->uFlags |= 128; |
0 | 6795 pParty->field_709 = 0; |
659 | 6796 Party__CountHirelings(); |
0 | 6797 if ( pParty->pHirelings[0].pName ) |
6798 { | |
459 | 6799 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6800 v24 = pCurrentNPCInfo->pName; | |
0 | 6801 v22 = pParty->pHireling2Name; |
6802 } | |
6803 else | |
6804 { | |
459 | 6805 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6806 v24 = pCurrentNPCInfo->pName; | |
0 | 6807 v22 = pParty->pHireling1Name; |
6808 } | |
6809 strcpy(v22, v24); | |
6810 pParty->field_709 = 0; | |
659 | 6811 Party__CountHirelings(); |
480 | 6812 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6813 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6814 |
6815 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6816 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6817 { |
990 | 6818 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6819 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6820 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6821 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6822 }*/ |
0 | 6823 if ( uActiveCharacter ) |
467 | 6824 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6825 _return: |
460 | 6826 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6827 } |
6828 | |
6829 //----- (004B254D) -------------------------------------------------------- | |
6830 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6831 { | |
955 | 6832 //Player *v1; // esi@1 |
0 | 6833 int v2; // edx@1 |
6834 int v3; // ecx@1 | |
6835 int v4; // edi@1 | |
955 | 6836 int pClassType; // eax@7 |
0 | 6837 int v6; // eax@7 |
6838 int v7; // ebx@7 | |
955 | 6839 //int v8; // ebx@8 |
0 | 6840 signed int v9; // esi@8 |
6841 int v10; // eax@8 | |
6842 char *v11; // ecx@8 | |
6843 int v12; // edi@9 | |
6844 char *v13; // edx@9 | |
6845 signed int v14; // edi@10 | |
6846 unsigned int v16; // eax@29 | |
955 | 6847 //int v17; // eax@36 |
0 | 6848 char v18; // cl@46 |
6849 __int16 v19; // dx@56 | |
6850 int v20; // eax@60 | |
955 | 6851 //char *v21; // [sp-Ch] [bp-38h]@82 |
6852 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6853 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6854 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6855 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6856 //int v26; // [sp-4h] [bp-30h]@38 |
6857 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6858 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6859 int v29; // [sp+10h] [bp-1Ch]@13 | |
6860 int v30; // [sp+14h] [bp-18h]@15 | |
6861 int v31; // [sp+18h] [bp-14h]@16 | |
6862 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6863 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6864 int v34; // [sp+24h] [bp-8h]@7 |
6865 char *v35; // [sp+28h] [bp-4h]@1 | |
6866 | |
484 | 6867 contract_approved = 0; |
0 | 6868 v2 = (_this - 200) % 3; |
6869 v3 = (_this - 200) / 3; | |
6870 v4 = v2; | |
6871 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6872 dword_F8B1AC_award_bit_number = v3; |
0 | 6873 if ( v2 ) |
6874 { | |
6875 if ( v2 == 1 ) | |
6876 { | |
267 | 6877 gold_transaction_amount = 5000; |
0 | 6878 dword_F8B1B0 = 3; |
6879 } | |
6880 else | |
6881 { | |
6882 if ( v2 == 2 ) | |
6883 { | |
267 | 6884 gold_transaction_amount = 8000; |
0 | 6885 dword_F8B1B0 = 4; |
6886 } | |
6887 } | |
6888 } | |
6889 else | |
6890 { | |
267 | 6891 gold_transaction_amount = 2000; |
0 | 6892 dword_F8B1B0 = 2; |
6893 } | |
955 | 6894 pClassType = pPlayers[uActiveCharacter]->classType; |
6895 //v33 = pClassType; | |
6896 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6897 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6898 v7 = a1[0] & 0x3F; |
6899 v34 = v2 + 2; | |
6900 if ( v6 < v2 + 2 ) | |
6901 { | |
955 | 6902 //v8 = v33; |
0 | 6903 v9 = 0; |
955 | 6904 v10 = pClassType - pClassType % 4; |
6905 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6906 do |
6907 { | |
6908 v12 = (unsigned __int8)*v11; | |
6909 v13 = &v28[4 * v9]; | |
6910 *(int *)v13 = 0; | |
6911 if ( v12 < v34 ) | |
6912 { | |
6913 v14 = 1; | |
6914 } | |
6915 else | |
6916 { | |
6917 v14 = 1; | |
6918 *(int *)v13 = 1; | |
6919 } | |
6920 ++v9; | |
6921 v11 += 37; | |
6922 } | |
6923 while ( v9 < 4 ); | |
6924 if ( v29 == v14 ) | |
6925 { | |
6926 v25 = pClassNames[v10 + 1]; | |
6927 } | |
6928 else | |
6929 { | |
955 | 6930 if ( v30 == v14 )//crash |
0 | 6931 { |
6932 if ( v31 == v14 ) | |
6933 { | |
955 | 6934 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6935 return pTmpBuf; |
6936 } | |
6937 v25 = pClassNames[v10 + 2]; | |
6938 } | |
6939 else | |
6940 { | |
6941 if ( v31 != v14 ) | |
6942 { | |
955 | 6943 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
6944 return pTmpBuf; | |
0 | 6945 } |
6946 v25 = pClassNames[v10 + 3]; | |
6947 } | |
6948 } | |
955 | 6949 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6950 return pTmpBuf; |
6951 } | |
955 | 6952 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6953 return (char *)pNPCTopics[122].pText; |
6954 if ( !v7 ) | |
6955 return (char *)pNPCTopics[131].pText; | |
6956 v16 = SkillToMastery(a1[0]); | |
6957 if ( (signed int)v16 > v4 + 1 ) | |
6958 return (char *)pNPCTopics[v4 + 128].pText; | |
6959 if ( v34 != 2 ) | |
6960 { | |
6961 if ( v34 == 3 ) | |
6962 { | |
6963 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6964 { | |
492 | 6965 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6966 { |
6967 case 12: | |
6968 case 13: | |
6969 case 14: | |
6970 case 15: | |
6971 case 16: | |
6972 case 17: | |
6973 case 18: | |
267 | 6974 gold_transaction_amount = 4000; |
0 | 6975 goto LABEL_42; |
6976 case 19: | |
6977 v19 = 114; | |
955 | 6978 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6979 return v35; | |
6980 if ( !gold_transaction_amount ) | |
6981 goto LABEL_79; | |
6982 goto LABEL_42; | |
0 | 6983 case 20: |
6984 v19 = 110; | |
484 | 6985 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6986 return v35; |
955 | 6987 if ( !gold_transaction_amount ) |
6988 goto LABEL_79; | |
6989 goto LABEL_42; | |
0 | 6990 case 22: |
955 | 6991 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
6992 if ( v20 < 50 ) | |
6993 return v35; | |
6994 if ( !gold_transaction_amount ) | |
6995 goto LABEL_79; | |
6996 goto LABEL_42; | |
0 | 6997 case 24: |
267 | 6998 gold_transaction_amount = 2500; |
955 | 6999 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 7000 if ( v20 < 50 ) |
7001 return v35; | |
955 | 7002 if ( !gold_transaction_amount ) |
7003 goto LABEL_79; | |
7004 goto LABEL_42; | |
7005 case 36: | |
7006 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
7007 if ( v20 < 50 ) | |
7008 return v35; | |
7009 if ( !gold_transaction_amount ) | |
7010 goto LABEL_79; | |
7011 goto LABEL_42; | |
0 | 7012 case 21: |
7013 case 23: | |
7014 case 25: | |
7015 case 26: | |
7016 case 29: | |
7017 case 32: | |
7018 case 34: | |
7019 case 35: | |
267 | 7020 gold_transaction_amount = 2500; |
0 | 7021 goto LABEL_42; |
7022 case 8: | |
7023 case 9: | |
7024 case 10: | |
7025 case 11: | |
267 | 7026 gold_transaction_amount = 3000; |
0 | 7027 goto LABEL_42; |
7028 case 7: | |
955 | 7029 gold_transaction_amount = 0; |
7030 if ( !gold_transaction_amount ) | |
7031 goto LABEL_79; | |
7032 goto LABEL_42; | |
7033 default: | |
7034 if ( !gold_transaction_amount ) | |
7035 goto LABEL_79; | |
7036 goto LABEL_42; | |
0 | 7037 } |
955 | 7038 gold_transaction_amount = 0; |
7039 if ( !gold_transaction_amount ) | |
7040 goto LABEL_79; | |
7041 goto LABEL_42; | |
0 | 7042 } |
7043 } | |
7044 else | |
7045 { | |
7046 if ( v34 != 4 ) | |
7047 { | |
955 | 7048 if ( !gold_transaction_amount ) |
7049 goto LABEL_79; | |
7050 goto LABEL_42; | |
0 | 7051 } |
7052 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7053 { | |
492 | 7054 switch ( dword_F8B1AC_award_bit_number ) |
0 | 7055 { |
7056 case 19: | |
955 | 7057 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
7058 { | |
7059 if ( !gold_transaction_amount ) | |
7060 goto LABEL_79; | |
7061 goto LABEL_42; | |
7062 } | |
7063 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
7064 { | |
7065 if ( !gold_transaction_amount ) | |
7066 goto LABEL_79; | |
7067 goto LABEL_42; | |
7068 } | |
7069 return v35; | |
0 | 7070 case 20: |
955 | 7071 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
7072 { | |
7073 if ( !gold_transaction_amount ) | |
7074 goto LABEL_79; | |
7075 goto LABEL_42; | |
7076 } | |
7077 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
7078 { | |
7079 if ( !gold_transaction_amount ) | |
7080 goto LABEL_79; | |
7081 goto LABEL_42; | |
7082 } | |
0 | 7083 return v35; |
7084 case 30: | |
955 | 7085 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 7086 if ( (v18 & 0x3Fu) < 0xA ) |
7087 return v35; | |
955 | 7088 if ( !gold_transaction_amount ) |
7089 goto LABEL_79; | |
7090 goto LABEL_42; | |
7091 case 31: | |
7092 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
7093 if ( (v18 & 0x3Fu) < 0xA ) | |
7094 return v35; | |
7095 if ( !gold_transaction_amount ) | |
7096 goto LABEL_79; | |
7097 goto LABEL_42; | |
0 | 7098 case 21: |
7099 case 23: | |
7100 case 24: | |
7101 case 25: | |
7102 case 26: | |
7103 case 29: | |
7104 case 32: | |
7105 case 34: | |
7106 case 35: | |
267 | 7107 gold_transaction_amount = 6000; |
0 | 7108 goto LABEL_42; |
7109 case 8: | |
7110 case 9: | |
7111 case 10: | |
7112 case 11: | |
267 | 7113 gold_transaction_amount = 7000; |
0 | 7114 goto LABEL_42; |
7115 case 7: | |
7116 break; | |
955 | 7117 default: |
7118 if ( !gold_transaction_amount ) | |
7119 goto LABEL_79; | |
7120 goto LABEL_42; | |
0 | 7121 } |
267 | 7122 gold_transaction_amount = 0; |
955 | 7123 if ( !gold_transaction_amount ) |
7124 goto LABEL_79; | |
7125 goto LABEL_42; | |
0 | 7126 } |
7127 } | |
7128 return v35; | |
7129 } | |
7130 if ( v7 < 4 ) | |
7131 return v35; | |
492 | 7132 if ( dword_F8B1AC_award_bit_number > 27 ) |
7133 { | |
7134 if ( dword_F8B1AC_award_bit_number != 29 | |
7135 && dword_F8B1AC_award_bit_number != 32 | |
7136 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7137 { |
267 | 7138 if ( !gold_transaction_amount ) |
0 | 7139 goto LABEL_79; |
7140 goto LABEL_42; | |
7141 } | |
267 | 7142 gold_transaction_amount = 500; |
955 | 7143 if ( !gold_transaction_amount ) |
7144 goto LABEL_79; | |
7145 goto LABEL_42; | |
0 | 7146 } |
492 | 7147 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7148 { |
7149 gold_transaction_amount = 500; | |
7150 if ( !gold_transaction_amount ) | |
7151 goto LABEL_79; | |
7152 goto LABEL_42; | |
7153 } | |
492 | 7154 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7155 { |
267 | 7156 gold_transaction_amount = 0; |
0 | 7157 goto LABEL_79; |
7158 } | |
492 | 7159 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7160 { |
7161 if ( !gold_transaction_amount ) | |
7162 goto LABEL_79; | |
7163 goto LABEL_42; | |
7164 } | |
492 | 7165 if ( dword_F8B1AC_award_bit_number > 18 ) |
7166 { | |
7167 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7168 { |
7169 if ( !gold_transaction_amount ) | |
7170 goto LABEL_79; | |
7171 goto LABEL_42; | |
7172 } | |
7173 gold_transaction_amount = 500; | |
7174 if ( !gold_transaction_amount ) | |
7175 goto LABEL_79; | |
7176 goto LABEL_42; | |
0 | 7177 } |
267 | 7178 gold_transaction_amount = 1000; |
0 | 7179 LABEL_42: |
267 | 7180 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7181 return (char *)pNPCTopics[124].pText; |
7182 LABEL_79: | |
484 | 7183 contract_approved = 1; |
0 | 7184 if ( v34 == 2 ) |
7185 { | |
955 | 7186 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
7187 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò | |
7188 return pTmpBuf2; | |
0 | 7189 } |
7190 if ( v34 == 3 ) | |
7191 { | |
955 | 7192 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7193 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð | |
7194 return pTmpBuf2; | |
0 | 7195 } |
7196 if ( v34 == 4 ) | |
955 | 7197 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7198 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð | |
0 | 7199 return pTmpBuf2; |
7200 } | |
7201 | |
7202 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7203 const char * ContractSelectText( int pEventCode ) |
7204 { | |
7205 static const int dialogue_base=110; | |
484 | 7206 contract_approved = 0; |
492 | 7207 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7208 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7209 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7210 { | |
492 | 7211 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7212 { | |
7213 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7214 } |
7215 else | |
7216 { | |
267 | 7217 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7218 { |
484 | 7219 contract_approved = 1; |
492 | 7220 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7221 } |
7222 else | |
7223 { | |
492 | 7224 return pNPCTopics[dialogue_base+14].pText; |
0 | 7225 } |
7226 } | |
7227 } | |
7228 else | |
7229 { | |
492 | 7230 return pNPCTopics[dialogue_base+12].pText; |
0 | 7231 } |
7232 } | |
7233 | |
7234 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7235 void SimpleHouseAndBoatsDialog() |
0 | 7236 { |
7237 char *v0; // esi@3 | |
7238 char *v1; // ST1C_4@3 | |
7239 char *v2; // eax@3 | |
7240 const char *v3; // ST1C_4@5 | |
7241 int v4; // eax@5 | |
7242 unsigned int i; // eax@5 | |
7243 NPCData *v6; // esi@6 | |
7244 unsigned __int16 v7; // bx@6 | |
7245 unsigned int v8; // eax@6 | |
7246 int v9; // eax@11 | |
7247 unsigned int v10; // ecx@12 | |
7248 int v11; // eax@12 | |
7249 int v12; // esi@12 | |
7250 char *v13; // eax@12 | |
7251 GUIWindow *v14; // ebx@13 | |
7252 char *v15; // esi@14 | |
7253 GUIButton *v16; // eax@15 | |
7254 unsigned int v17; // ecx@15 | |
7255 int v18; // ecx@17 | |
7256 int v19; // ecx@18 | |
7257 int v20; // ecx@19 | |
7258 int v21; // ecx@20 | |
7259 int v22; // ecx@21 | |
7260 unsigned int v23; // ecx@23 | |
7261 int v24; // ecx@35 | |
7262 int v25; // ecx@36 | |
7263 int v26; // ecx@37 | |
7264 int v27; // ecx@38 | |
7265 int v28; // ecx@39 | |
7266 char *v29; // esi@42 | |
7267 unsigned int v30; // ST20_4@42 | |
7268 int v31; // ST1C_4@42 | |
7269 unsigned int v32; // eax@42 | |
7270 char *v33; // eax@43 | |
7271 int v34; // esi@51 | |
7272 int v35; // eax@51 | |
7273 unsigned int v36; // edi@51 | |
7274 GUIButton *v37; // eax@52 | |
7275 int v38; // eax@52 | |
7276 signed int v39; // ecx@54 | |
7277 int v40; // edi@57 | |
7278 GUIButton *v41; // eax@60 | |
7279 GUIButton *v42; // esi@60 | |
7280 const char *v43; // ebx@60 | |
7281 int v44; // eax@60 | |
7282 unsigned int v45; // ecx@60 | |
7283 unsigned __int16 v46; // ax@60 | |
7284 GUIFont *v47; // ebx@64 | |
7285 int v48; // esi@64 | |
7286 char *v49; // eax@66 | |
7287 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7288 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7289 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7290 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7291 int v55; // [sp+10Ch] [bp-10h]@6 | |
7292 int v56; // [sp+110h] [bp-Ch]@13 | |
7293 char *pInString; // [sp+114h] [bp-8h]@12 | |
7294 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7295 | |
7296 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7297 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7298 { |
7299 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7300 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7301 a1.uFrameX = 493; | |
7302 a1.uFrameWidth = 126; | |
7303 a1.uFrameZ = 366; | |
7304 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7305 a1.uFrameX = 483; | |
7306 a1.uFrameWidth = 148; | |
7307 a1.uFrameZ = 334; | |
434 | 7308 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7309 if ( !v2 ) |
7310 { | |
721 | 7311 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7312 v2 = pTmpBuf; |
7313 } | |
7314 v3 = v2; | |
7315 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7316 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7317 return; | |
0 | 7318 } |
7319 a1.uFrameWidth -= 10; | |
7320 a1.uFrameZ -= 10; | |
459 | 7321 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7322 v6 = v58; |
949 | 7323 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7324 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7325 v8 = v6->uProfession; |
7326 if ( v8 ) | |
264 | 7327 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7328 else |
7329 strcpy(pTmpBuf, v6->pName); | |
7330 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7331 if ( !dword_591080 ) | |
7332 { | |
7333 if ( !uDialogueType ) | |
7334 { | |
7335 v9 = v6->greet; | |
7336 if ( v9 ) | |
7337 { | |
7338 v10 = v6->uFlags; | |
819 | 7339 a1.uFrameWidth = game_viewport_width; |
0 | 7340 a1.uFrameZ = 452; |
7341 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7342 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7343 v12 = v11 + 7; | |
973 | 7344 pRenderer->_4A6A68(8, 352 - (v11 + 7), |
7345 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7346 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); | |
0 | 7347 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); |
7348 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7349 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7350 } | |
7351 } | |
7352 } | |
7353 v14 = pDialogueWindow; | |
7354 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7355 v52.uFrameX = 483; | |
7356 v52.uFrameWidth = 148; | |
7357 v52.uFrameZ = 334; | |
7358 v56 = v52.pStartingPosActiveItem; | |
7359 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7360 { | |
348 | 7361 v15 = "";//(char *)v54; |
0 | 7362 while ( 1 ) |
7363 { | |
7364 v16 = v52.GetControl(v56); | |
832 | 7365 v17 = v16->msg_param; |
0 | 7366 pInString = (char *)v16; |
7367 if ( (signed int)v17 > 24 ) | |
7368 { | |
7369 v24 = v17 - 76; | |
7370 if ( !v24 ) | |
7371 { | |
7372 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7373 goto LABEL_49; | |
7374 } | |
7375 v25 = v24 - 1; | |
7376 if ( !v25 ) | |
7377 { | |
7378 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7379 goto LABEL_49; | |
7380 } | |
7381 v26 = v25 - 2; | |
7382 if ( !v26 ) | |
7383 { | |
7384 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7385 LABEL_44: | |
7386 v15 = v33; | |
7387 LABEL_45: | |
7388 v16 = (GUIButton *)pInString; | |
7389 goto LABEL_49; | |
7390 } | |
7391 v27 = v26 - 3; | |
7392 if ( !v27 ) | |
7393 { | |
459 | 7394 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7395 goto LABEL_44; |
7396 } | |
7397 v28 = v27 - 1; | |
7398 if ( !v28 ) | |
7399 { | |
7400 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7401 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7402 v31 = *(int *)v29; |
949 | 7403 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 7404 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); |
7405 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7406 current_npc_text = pTmpBuf2; |
0 | 7407 v15 = ""; |
7408 goto LABEL_45; | |
7409 } | |
7410 if ( v28 != 10 ) | |
7411 goto LABEL_41; | |
7412 } | |
7413 else | |
7414 { | |
7415 if ( v17 == 24 ) | |
7416 { | |
291 | 7417 v23 = v58->evt_F; |
0 | 7418 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7419 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7420 if ( !v15 ) |
7421 { | |
832 | 7422 v16->msg_param = 0; |
0 | 7423 v15 = ""; |
7424 } | |
7425 goto LABEL_49; | |
7426 } | |
7427 v18 = v17 - 13; | |
7428 if ( v18 ) | |
7429 { | |
7430 v19 = v18 - 6; | |
7431 if ( !v19 ) | |
7432 { | |
291 | 7433 v23 = v58->evt_A; |
0 | 7434 goto LABEL_33; |
7435 } | |
7436 v20 = v19 - 1; | |
7437 if ( !v20 ) | |
7438 { | |
291 | 7439 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7440 if ( !v15 ) |
7441 { | |
832 | 7442 v16->msg_param = 0; |
0 | 7443 v15 = ""; |
7444 } | |
7445 if ( uDialogueType != 84 ) | |
7446 goto LABEL_49; | |
484 | 7447 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7448 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7449 current_npc_text = pTmpBuf2; | |
0 | 7450 goto LABEL_45; |
7451 } | |
7452 v21 = v20 - 1; | |
7453 if ( !v21 ) | |
7454 { | |
291 | 7455 v23 = v58->evt_C; |
0 | 7456 goto LABEL_33; |
7457 } | |
7458 v22 = v21 - 1; | |
7459 if ( !v22 ) | |
7460 { | |
291 | 7461 v23 = v58->evt_D; |
0 | 7462 goto LABEL_33; |
7463 } | |
7464 if ( v22 == 1 ) | |
7465 { | |
291 | 7466 v23 = v58->evt_E; |
0 | 7467 goto LABEL_33; |
7468 } | |
7469 LABEL_41: | |
7470 v15 = ""; | |
7471 goto LABEL_49; | |
7472 } | |
7473 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7474 } | |
7475 LABEL_49: | |
7476 strcpy(v16->pButtonName, v15); | |
7477 ++v56; | |
7478 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7479 { | |
7480 v14 = pDialogueWindow; | |
7481 break; | |
7482 } | |
7483 } | |
7484 } | |
7485 v34 = 0; | |
949 | 7486 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7487 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7488 v36 = v14->pStartingPosActiveItem; |
7489 v55 = v35; | |
7490 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7491 + pDialogueWindow->pStartingPosActiveItem ) | |
7492 { | |
7493 v37 = v14->GetControl(v36); | |
7494 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7495 v14 = pDialogueWindow; | |
7496 v34 += v38; | |
7497 ++v36; | |
7498 } | |
7499 v39 = v14->pNumPresenceButton; | |
7500 if ( v39 ) | |
7501 { | |
7502 v58 = (NPCData *)((174 - v34) / v39); | |
7503 if ( (signed int)v58 > 32 ) | |
7504 v58 = (NPCData *)32; | |
7505 pInString = (char *)2; | |
7506 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7507 v56 = v14->pStartingPosActiveItem; | |
7508 i = v56; | |
7509 if ( (signed int)i < (signed int)(i + v39) ) | |
7510 { | |
7511 while ( 1 ) | |
7512 { | |
7513 v41 = v14->GetControl(i); | |
7514 v42 = v41; | |
7515 v43 = v41->pButtonName; | |
7516 v41->uY = (unsigned int)((char *)v58 + v40); | |
7517 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7518 v45 = v42->uY; | |
7519 v42->uHeight = v44; | |
7520 v40 = v45 + v44 - 1; | |
7521 v42->uW = v40; | |
7522 v46 = v55; | |
7523 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7524 v46 = v54; | |
7525 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7526 v14 = pDialogueWindow; | |
7527 ++pInString; | |
7528 ++v56; | |
7529 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7530 if ( v56 >= (signed int)i ) | |
7531 break; | |
7532 i = v56; | |
7533 } | |
7534 } | |
7535 } | |
827 | 7536 if ( current_npc_text ) |
0 | 7537 { |
7538 w.uFrameWidth = 458; | |
7539 w.uFrameZ = 457; | |
7540 v47 = pFontArrus; | |
827 | 7541 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7542 if ( 352 - v48 < 8 ) |
7543 { | |
7544 v47 = pFontCreate; | |
827 | 7545 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7546 } |
973 | 7547 pRenderer->_4A6A68(8, 352 - v48, |
7548 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7549 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); | |
0 | 7550 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); |
827 | 7551 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7552 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7553 } | |
0 | 7554 } |
7555 | |
7556 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7557 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7558 { |
832 | 7559 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7560 } |
7561 | |
7562 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7563 void sub_4B3A72( int a1 ) |
7564 { | |
7565 int num_buttons; // esi@1 | |
7566 | |
7567 num_buttons = 0; | |
0 | 7568 if ( a1 == 21 ) |
7569 { | |
473 | 7570 CreateButtonInColumn(0, 0x66u); |
7571 num_buttons = 2; | |
7572 CreateButtonInColumn(1, 0x67u); | |
7573 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7574 { | |
7575 num_buttons = 3; | |
7576 CreateButtonInColumn(2, 0x68u); | |
7577 } | |
7578 } | |
972 | 7579 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); |
0 | 7580 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7581 } | |
7582 // F8B1E0: using guessed type int dword_F8B1E0; | |
7583 | |
7584 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7585 void sub_4B3AD4( signed int a1 ) |
7586 { | |
0 | 7587 if ( a1 > 0 ) |
7588 { | |
7589 if ( a1 <= 3 ) | |
7590 { | |
473 | 7591 CreateButtonInColumn(0, 3u); |
7592 CreateButtonInColumn(1, 4u); | |
7593 CreateButtonInColumn(2, 5u); | |
972 | 7594 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
0 | 7595 } |
7596 if ( a1 == 4 ) | |
7597 { | |
473 | 7598 CreateButtonInColumn(0, 3u); |
7599 CreateButtonInColumn(1, 4u); | |
972 | 7600 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); |
473 | 7601 } |
7602 } | |
0 | 7603 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7604 } | |
7605 // F8B1E0: using guessed type int dword_F8B1E0; | |
7606 | |
7607 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7608 void sub_4B3B42( signed int a1 ) |
7609 { | |
0 | 7610 int v1; // ecx@18 |
7611 int v2; // ecx@19 | |
7612 int v3; // ecx@20 | |
7613 signed int v4; // esi@22 | |
7614 signed int v5; // eax@22 | |
7615 unsigned int v6; // edx@24 | |
7616 int v7; // ecx@24 | |
7617 int result; // eax@43 | |
7618 int v9; // [sp-10h] [bp-14h]@28 | |
7619 int v10; // [sp-Ch] [bp-10h]@28 | |
7620 int v11; // [sp-8h] [bp-Ch]@28 | |
7621 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7622 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7623 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7624 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7625 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7626 int v17; // [sp-4h] [bp-8h]@28 | |
7627 | |
7628 if ( a1 > 13 ) | |
7629 { | |
7630 if ( a1 > 22 ) | |
7631 { | |
7632 if ( a1 == 23 ) | |
7633 { | |
473 | 7634 CreateButtonInColumn(0, 0xAu); |
7635 CreateButtonInColumn(1, 0xBu); | |
0 | 7636 v14 = 96; |
7637 LABEL_41: | |
473 | 7638 CreateButtonInColumn(2, v14); |
0 | 7639 v17 = 2; |
7640 v11 = 0; | |
7641 v10 = 1; | |
7642 v9 = 3; | |
7643 goto LABEL_42; | |
7644 } | |
7645 if ( a1 <= 26 ) | |
7646 goto LABEL_43; | |
7647 if ( a1 > 28 ) | |
7648 { | |
7649 if ( a1 != 30 ) | |
7650 goto LABEL_43; | |
473 | 7651 CreateButtonInColumn(0, 0x11u); |
0 | 7652 v16 = 96; |
7653 goto LABEL_37; | |
7654 } | |
473 | 7655 CreateButtonInColumn(0, 0x69u); |
7656 CreateButtonInColumn(1, 0x6Au); | |
7657 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7658 v12 = 108; |
7659 } | |
7660 else | |
7661 { | |
7662 if ( a1 == 22 ) | |
7663 { | |
473 | 7664 CreateButtonInColumn(0, 7u); |
0 | 7665 v16 = 8; |
7666 goto LABEL_37; | |
7667 } | |
7668 v1 = a1 - 14; | |
7669 if ( !v1 ) | |
7670 { | |
473 | 7671 CreateButtonInColumn(0, 0x12u); |
7672 CreateButtonInColumn(1, 0x30u); | |
7673 CreateButtonInColumn(2, 0x31u); | |
7674 CreateButtonInColumn(3, 0x32u); | |
7675 CreateButtonInColumn(4, 0x33u); | |
0 | 7676 v17 = 2; |
7677 v11 = 0; | |
7678 v10 = 1; | |
7679 v9 = 5; | |
7680 goto LABEL_42; | |
7681 } | |
7682 v2 = v1 - 1; | |
7683 if ( v2 ) | |
7684 { | |
7685 v3 = v2 - 2; | |
7686 if ( v3 ) | |
7687 { | |
7688 if ( v3 != 4 ) | |
7689 goto LABEL_43; | |
473 | 7690 CreateButtonInColumn(0, 0xFu); |
7691 CreateButtonInColumn(1, 0x10u); | |
0 | 7692 v4 = 3; |
473 | 7693 CreateButtonInColumn(2, 0x60u); |
336 | 7694 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7695 if ( v5 < 108 || v5 > 120 ) |
7696 goto LABEL_28; | |
7697 v4 = 4; | |
7698 v6 = 101; | |
7699 v7 = 3; | |
7700 } | |
7701 else | |
7702 { | |
7703 v4 = 1; | |
473 | 7704 CreateButtonInColumn(0, 0x63u); |
0 | 7705 if ( !pParty->uFine ) |
7706 { | |
7707 LABEL_28: | |
7708 v17 = 2; | |
7709 v11 = 0; | |
7710 v10 = 1; | |
7711 v9 = v4; | |
7712 LABEL_42: | |
972 | 7713 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); |
0 | 7714 goto LABEL_43; |
7715 } | |
7716 v4 = 2; | |
7717 v7 = 1; | |
7718 v6 = 100; | |
7719 } | |
473 | 7720 CreateButtonInColumn(v7, v6); |
0 | 7721 goto LABEL_28; |
7722 } | |
473 | 7723 CreateButtonInColumn(0, 0x12u); |
7724 CreateButtonInColumn(1, 0x34u); | |
7725 CreateButtonInColumn(2, 0x35u); | |
0 | 7726 v12 = 54; |
7727 } | |
7728 LABEL_39: | |
473 | 7729 CreateButtonInColumn(3, v12); |
0 | 7730 v17 = 2; |
7731 v11 = 0; | |
7732 v10 = 1; | |
7733 v9 = 4; | |
7734 goto LABEL_42; | |
7735 } | |
7736 if ( a1 == 13 ) | |
7737 { | |
473 | 7738 CreateButtonInColumn(0, 0x12u); |
0 | 7739 v16 = 56; |
7740 LABEL_37: | |
473 | 7741 CreateButtonInColumn(1, v16); |
0 | 7742 v17 = 2; |
7743 v11 = 0; | |
7744 v10 = 1; | |
7745 v9 = 2; | |
7746 goto LABEL_42; | |
7747 } | |
7748 switch ( a1 ) | |
7749 { | |
7750 case 1: | |
7751 case 2: | |
7752 case 3: | |
7753 case 4: | |
473 | 7754 CreateButtonInColumn(0, 2u); |
7755 CreateButtonInColumn(1, 0x5Fu); | |
7756 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7757 v12 = 96; |
7758 goto LABEL_39; | |
7759 case 5: | |
473 | 7760 CreateButtonInColumn(0, 0x12u); |
0 | 7761 v13 = 48; |
7762 goto LABEL_9; | |
7763 case 6: | |
473 | 7764 CreateButtonInColumn(0, 0x12u); |
0 | 7765 v13 = 49; |
7766 goto LABEL_9; | |
7767 case 7: | |
473 | 7768 CreateButtonInColumn(0, 0x12u); |
0 | 7769 v13 = 50; |
7770 goto LABEL_9; | |
7771 case 8: | |
473 | 7772 CreateButtonInColumn(0, 0x12u); |
0 | 7773 v13 = 51; |
7774 LABEL_9: | |
473 | 7775 CreateButtonInColumn(1, v13); |
0 | 7776 v14 = 72; |
7777 goto LABEL_41; | |
7778 case 9: | |
473 | 7779 CreateButtonInColumn(0, 0x12u); |
0 | 7780 v15 = 52; |
7781 goto LABEL_13; | |
7782 case 10: | |
473 | 7783 CreateButtonInColumn(0, 0x12u); |
0 | 7784 v15 = 53; |
7785 goto LABEL_13; | |
7786 case 11: | |
473 | 7787 CreateButtonInColumn(0, 0x12u); |
0 | 7788 v15 = 54; |
7789 LABEL_13: | |
473 | 7790 CreateButtonInColumn(1, v15); |
0 | 7791 v14 = 61; |
7792 goto LABEL_41; | |
7793 case 12: | |
473 | 7794 CreateButtonInColumn(0, 0x12u); |
0 | 7795 v16 = 55; |
7796 goto LABEL_37; | |
7797 default: | |
7798 break; | |
7799 } | |
7800 LABEL_43: | |
7801 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7802 } | |
7803 // F8B1E0: using guessed type int dword_F8B1E0; | |
7804 | |
7805 //----- (004B3E1E) -------------------------------------------------------- | |
7806 void __cdecl sub_4B3E1E() | |
7807 { | |
7808 NPCData *v0; // ST40_4@1 | |
7809 signed int v1; // edi@1 | |
165 | 7810 //GUIWindow *v2; // ecx@1 |
0 | 7811 |
167 | 7812 __debugbreak(); |
602 | 7813 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7814 v1 = 0; |
7815 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7816 pDialogueWindow->Release(); | |
165 | 7817 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7818 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7819 { |
832 | 7820 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7821 v1 = 1; |
7822 } | |
832 | 7823 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 7824 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 7825 } |
7826 | |
7827 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7828 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7829 { |
467 | 7830 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7831 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7832 ContractSelectText(pEventCode); |
0 | 7833 pDialogueWindow->Release(); |
492 | 7834 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7835 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7836 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7837 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
972 | 7838 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7839 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7840 } |
7841 // F8B19C: using guessed type int dword_F8B19C; | |
7842 | |
7843 //----- (004B3FE5) -------------------------------------------------------- | |
7844 void __fastcall sub_4B3FE5(int a4) | |
7845 { | |
7846 int v1; // edi@1 | |
7847 char *v2; // edi@1 | |
7848 | |
7849 v1 = a4; | |
7850 uDialogueType = 78; | |
827 | 7851 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7852 _4B254D_SkillMasteryTeacher(a4); |
7853 pDialogueWindow->Release(); | |
7854 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7855 v2 = ""; | |
832 | 7856 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7857 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7858 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7859 if ( contract_approved ) |
0 | 7860 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7861 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 7862 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7863 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7864 } |
7865 // F8B19C: using guessed type int dword_F8B19C; | |
7866 // F8B1A8: using guessed type int dword_F8B1A8; | |
7867 | |
7868 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7869 void NPCHireableDialogPrepare() |
7870 { | |
0 | 7871 signed int v0; // ebx@1 |
7872 NPCData *v1; // edi@1 | |
7873 | |
7874 v0 = 0; | |
459 | 7875 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7876 pDialogueWindow->Release(); |
7877 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7878 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7879 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7880 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7881 0); |
832 | 7882 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7883 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7884 { |
832 | 7885 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7886 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7887 v0 = 1; |
7888 } | |
832 | 7889 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7890 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
972 | 7891 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); |
747 | 7892 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7893 } |
7894 | |
7895 //----- (004B4224) -------------------------------------------------------- | |
423 | 7896 void _4B4224_UpdateNPCTopics( int _this ) |
7897 { | |
7898 int num_menu_buttons; // ebx@1 | |
0 | 7899 int i; // ebp@5 |
423 | 7900 // signed int v4; // ebp@9 |
7901 int v6; // eax@16 | |
7902 int v8; // eax@21 | |
7903 int v10; // eax@26 | |
7904 int v12; // eax@31 | |
7905 int v14; // eax@36 | |
7906 int v16; // eax@41 | |
0 | 7907 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7908 | |
423 | 7909 num_menu_buttons = 0; |
459 | 7910 pDialogueNPCCount = (_this + 1); |
0 | 7911 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7912 { | |
7913 pDialogueWindow->Release(); | |
7914 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7915 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7916 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
7917 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
832 | 7918 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
948 | 7919 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0); |
0 | 7920 } |
7921 else | |
7922 { | |
459 | 7923 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7924 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7925 { |
7926 pDialogueWindow->Release(); | |
7927 } | |
7928 else | |
7929 { | |
7930 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7931 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7932 } |
7933 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7934 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7935 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7936 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7937 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7938 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7939 { |
484 | 7940 sub_4B3B42(in_current_building_type); |
0 | 7941 } |
7942 else | |
7943 { | |
7944 if ( v17->joins ) | |
7945 { | |
423 | 7946 num_menu_buttons = 1; |
858 | 7947 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7948 } |
423 | 7949 if ( v17->evt_A) |
7950 { | |
7951 if ( num_menu_buttons < 4 ) | |
7952 { | |
7953 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7954 if ( v6 == 1 || v6 == 2 ) |
832 | 7955 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7956 } |
7957 } | |
7958 if ( v17->evt_B ) | |
7959 { | |
7960 if ( num_menu_buttons < 4 ) | |
7961 { | |
7962 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7963 if ( v8 == 1 || v8 == 2 ) |
832 | 7964 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7965 } |
7966 } | |
7967 if ( v17->evt_C ) | |
7968 { | |
7969 if ( num_menu_buttons < 4 ) | |
7970 { | |
7971 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7972 if ( v10 == 1 || v10 == 2 ) |
832 | 7973 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7974 } |
7975 } | |
7976 | |
7977 if ( v17->evt_D ) | |
7978 { | |
7979 if ( num_menu_buttons < 4 ) | |
7980 { | |
7981 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7982 if ( v12 == 1 || v12 == 2 ) |
832 | 7983 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7984 } |
7985 } | |
7986 if ( v17->evt_E ) | |
7987 { | |
7988 if ( num_menu_buttons < 4 ) | |
7989 { | |
7990 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7991 if ( v14 == 1 || v14 == 2 ) |
832 | 7992 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7993 } |
7994 } | |
7995 if ( v17->evt_F ) | |
7996 { | |
7997 if ( num_menu_buttons < 4 ) | |
7998 { | |
7999 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8000 if ( v16 == 1 || v16 == 2 ) |
832 | 8001 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 8002 } |
8003 } | |
972 | 8004 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); |
0 | 8005 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8006 } | |
747 | 8007 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 8008 } |
8009 | |
0 | 8010 } |
8011 | |
8012 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 8013 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
8014 { | |
0 | 8015 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8016 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 8017 v4 = pFontLucida->AlignText_Center(450, Str); |
8018 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 8019 } |
8020 | |
8021 //----- (004B46F8) -------------------------------------------------------- | |
8022 int __fastcall sub_4B46F8(int a1) | |
8023 { | |
8024 int v1; // eax@1 | |
8025 int i; // edx@1 | |
8026 | |
8027 v1 = 0; | |
8028 for ( i = 0; i < a1; ++i ) | |
8029 v1 += i + 1; | |
8030 return 1000 * v1; | |
8031 } | |
8032 | |
8033 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8034 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8035 { |
656 | 8036 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8037 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8038 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8039 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8040 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8041 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8042 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8043 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8044 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8045 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8046 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8047 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8048 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8049 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8050 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8051 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8052 //v1 = _this; |
656 | 8053 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8054 //v3 = v1; |
656 | 8055 uDialogueType = newDialogueType; |
8056 if (!speakingNPC->uFlags) | |
8057 { | |
8058 speakingNPC->uFlags = 1; | |
8059 //v3 = uDialogueType; | |
8060 } | |
8061 | |
8062 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8063 { | |
8064 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8065 } | |
8066 else if(newDialogueType == DIALOGUE_76) | |
8067 { | |
8068 if (speakingNPC->Hired()) | |
8069 { | |
8070 v8 = 0; | |
8071 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8072 { | |
8073 v6 = (char *)pNPCStats->pNewNPCData; | |
8074 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8075 { | |
8076 ++v8; | |
8077 v6 += 76; | |
8078 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8079 break; | |
8080 } | |
8081 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8082 v6[8] &= 0x7Fu; | |
8083 } | |
8084 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8085 { | |
8086 v11 = pParty->pHirelings; | |
8087 memset(v11, 0, sizeof(NPCData)); | |
8088 } | |
8089 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8090 { | |
8091 v11 = &pParty->pHirelings[1]; | |
8092 memset(v11, 0, sizeof(NPCData)); | |
8093 } | |
8094 pParty->field_709 = 0; | |
659 | 8095 Party__CountHirelings(); |
656 | 8096 dword_591084 = 0; |
8097 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8098 dword_7241C8 = 0; | |
8099 return; | |
8100 } | |
8101 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8102 { | |
8103 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8104 ShowStatusBarString(v7, 2u); | |
8105 } | |
8106 else | |
8107 { | |
8108 //v9 = v2->uProfession; | |
8109 if ( speakingNPC->uProfession != 51 ) | |
8110 { | |
8111 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8112 if ( pParty->uNumGold < v10 ) | |
8113 { | |
8114 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8115 dialogue_show_profession_details = false; | |
8116 uDialogueType = 13; | |
8117 if ( uActiveCharacter ) | |
8118 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8119 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8120 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8121 if ( !dword_7241C8 ) | |
8122 pGame->Draw(); | |
8123 dword_7241C8 = 0; | |
8124 return; | |
8125 } | |
8126 Party::TakeGold(v10); | |
8127 } | |
8128 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8129 if ( pParty->pHirelings[0].pName ) | |
8130 { | |
8131 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8132 v15 = speakingNPC->pName; | |
8133 v13 = pParty->pHireling2Name; | |
8134 } | |
8135 else | |
8136 { | |
8137 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8138 v15 = speakingNPC->pName; | |
8139 v13 = pParty->pHireling1Name; | |
8140 } | |
8141 strcpy(v13, v15); | |
8142 pParty->field_709 = 0; | |
659 | 8143 Party__CountHirelings(); |
656 | 8144 |
8145 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8146 | |
711 | 8147 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8148 pDialogue_SpeakingActor->uAIState = Removed; |
8149 if ( uActiveCharacter ) | |
8150 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8151 } | |
8152 } | |
8153 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8154 { | |
8155 ArenaFight(); | |
8156 return; | |
8157 } | |
8158 else if(newDialogueType == DIALOGUE_9) | |
8159 { | |
8160 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8161 { | |
8162 if ( speakingNPC->uProfession != 41 ) | |
8163 speakingNPC->bHasUsedTheAbility = 1; | |
8164 | |
8165 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8166 } | |
8167 else | |
8168 { | |
8169 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8170 } | |
8171 } | |
8172 else if(newDialogueType == DIALOGUE_13) | |
8173 { | |
8174 if (!speakingNPC->Hired()) | |
8175 { | |
8176 sub_4B3E1E(); | |
8177 dialogue_show_profession_details = false; | |
8178 } | |
8179 else | |
8180 { | |
8181 v5 = 0; | |
8182 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8183 { | |
8184 v6 = (char *)pNPCStats->pNewNPCData; | |
8185 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8186 { | |
8187 ++v5; | |
8188 v6 += 76; | |
8189 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8190 break; | |
8191 } | |
8192 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8193 v6[8] &= 0x7Fu; | |
8194 } | |
8195 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8196 { | |
8197 v11 = pParty->pHirelings; | |
8198 memset(v11, 0, sizeof(NPCData)); | |
8199 } | |
8200 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8201 { | |
8202 v11 = &pParty->pHirelings[1]; | |
8203 memset(v11, 0, sizeof(NPCData)); | |
8204 } | |
8205 pParty->field_709 = 0; | |
659 | 8206 Party__CountHirelings(); |
656 | 8207 dword_591084 = 0; |
8208 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8209 dword_7241C8 = 0; | |
8210 return; | |
8211 } | |
8212 } | |
8213 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8214 { | |
8215 switch(newDialogueType) | |
8216 { | |
8217 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8218 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8219 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8220 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8221 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8222 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8223 } | |
8224 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8225 sub_4B3FE5(npc_event_id); //200-310 | |
8226 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8227 { //400-410 | |
8228 dword_F8B1D8 = newDialogueType; | |
8229 DrawJoinGuildWindow(npc_event_id - 400); | |
8230 } | |
8231 else | |
8232 { | |
8233 switch ( npc_event_id ) | |
8234 { | |
8235 case 139: | |
8236 sub_4B1ECE(); | |
8237 break; | |
8238 case 311: | |
8239 sub_4BBA85_bounties(); | |
8240 break; | |
8241 case 399: | |
8242 sub_4BBCDD(); | |
8243 break; | |
8244 default: | |
8245 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8246 current_npc_text = 0; |
656 | 8247 EventProcessor(npc_event_id, 0, 1); |
8248 activeLevelDecoration = NULL; | |
8249 break; | |
8250 } | |
8251 } | |
8252 } | |
8253 if ( !dword_7241C8 ) | |
8254 pGame->Draw(); | |
8255 dword_7241C8 = 0; | |
8256 } | |
0 | 8257 |
8258 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8259 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8260 { |
8261 int v6; // edx@8 | |
8262 int v7; // edx@9 | |
8263 int v8; // edx@10 | |
8264 unsigned __int8 v9; // zf@16 | |
8265 char v10; // sf@16 | |
8266 unsigned __int8 v11; // of@16 | |
702 | 8267 bool test; |
0 | 8268 |
907 | 8269 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8270 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8271 return 0; |
907 | 8272 switch( p2DEvents[_2da_idx - 1].uType ) |
8273 { | |
8274 case BildingType_WeaponShop: | |
8275 { | |
8276 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8277 break; | |
8278 } | |
8279 case BildingType_ArmorShop: | |
8280 { | |
8281 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8282 break; | |
8283 } | |
8284 case BildingType_MagicShop: | |
8285 { | |
8286 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8287 break; | |
8288 } | |
8289 case BildingType_AlchemistShop: | |
8290 { | |
8291 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8292 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8293 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8294 break; | |
8295 } | |
8296 default: | |
8297 { | |
8298 test = false; | |
8299 break; | |
8300 } | |
8301 } | |
702 | 8302 return test; |
8303 /* | |
8304 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8305 { |
8306 v11 = __OFSUB__(v5, 2); | |
8307 v9 = v5 == 2; | |
8308 v10 = v5 - 2 < 0; | |
8309 goto LABEL_23; | |
8310 } | |
702 | 8311 if ( p2DEvents[a2 - 1].uType > 2 ) |
8312 { | |
8313 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8314 { |
8315 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8316 return v5 == 16; | |
8317 return 1; | |
8318 } | |
702 | 8319 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8320 return 0; |
702 | 8321 if ( p2DEvents[a2 - 1].uType == 4) |
8322 { | |
8323 if ( v5 < 13 ) | |
8324 return 0; | |
8325 if ( v5 <= 14 ) | |
8326 return 1; | |
8327 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8328 return 0; | |
8329 v11 = __OFSUB__(v3, 771); | |
8330 v9 = v3 == 771; | |
8331 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8332 LABEL_23: |
702 | 8333 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8334 return 0; | |
8335 return 1; | |
8336 } | |
8337 } | |
8338 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8339 { | |
8340 if ( v5 >= 3 ) | |
8341 { | |
8342 v11 = __OFSUB__(v5, 9); | |
8343 v9 = v5 == 9; | |
8344 v10 = v5 - 9 < 0; | |
8345 goto LABEL_23; | |
8346 } | |
0 | 8347 } |
8348 return 0; | |
702 | 8349 */ |
0 | 8350 } |
8351 | |
8352 //----- (004B6478) -------------------------------------------------------- | |
711 | 8353 void sub_4B6478() |
8354 { | |
0 | 8355 GUIWindow *v0; // ebx@1 |
8356 Player *v1; // edi@1 | |
8357 unsigned int v2; // eax@1 | |
8358 signed int v3; // esi@1 | |
8359 int v4; // ebx@1 | |
8360 unsigned int v5; // esi@5 | |
8361 int v6; // edi@6 | |
8362 int result; // eax@13 | |
8363 GUIWindow *v8; // ebx@17 | |
8364 int v9; // eax@17 | |
8365 int v10; // ecx@17 | |
8366 unsigned int v11; // ecx@18 | |
8367 int v12; // eax@20 | |
8368 int v13; // eax@21 | |
8369 GUIButton *v14; // esi@27 | |
8370 int v15; // ecx@27 | |
8371 unsigned int v16; // eax@28 | |
8372 const char *v17; // ebx@29 | |
8373 int v18; // eax@29 | |
8374 unsigned int v19; // ecx@29 | |
8375 int v20; // eax@29 | |
8376 unsigned __int16 v21; // ax@29 | |
8377 unsigned __int16 v22; // ST14_2@36 | |
8378 int v23; // eax@36 | |
8379 const char *v24; // ST18_4@37 | |
8380 unsigned __int16 v25; // ST14_2@37 | |
8381 int v26; // eax@37 | |
8382 int v27; // [sp-4h] [bp-80h]@8 | |
8383 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8384 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8385 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8386 int v31; // [sp+68h] [bp-14h]@1 | |
8387 int v32; // [sp+6Ch] [bp-10h]@1 | |
8388 int v33; // [sp+70h] [bp-Ch]@17 | |
8389 int v34; // [sp+74h] [bp-8h]@17 | |
8390 int v35; // [sp+78h] [bp-4h]@17 | |
8391 | |
336 | 8392 v0 = window_SpeakInHouse; |
8393 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8394 v1 = pPlayers[uActiveCharacter]; |
8395 v28.uFrameX = 483; | |
8396 v28.uFrameWidth = 148; | |
8397 v28.uFrameZ = 334; | |
949 | 8398 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
8399 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
0 | 8400 v2 = 52 * (unsigned int)v0->ptr_1C; |
8401 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8402 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8403 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8404 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8405 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8406 v32 = v4; | |
8407 if ( v4 < v3 / 3 ) | |
8408 { | |
8409 v4 = v3 / 3; | |
8410 v32 = v3 / 3; | |
8411 } | |
749 | 8412 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8413 { |
8414 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8415 { | |
8416 v5 = 0; | |
8417 | |
8418 __debugbreak(); | |
8419 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8420 // or | |
8421 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8422 // or | |
8423 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8424 __debugbreak(); // whacky condition - fix |
0 | 8425 if (false |
8426 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8427 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8428 { |
8429 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8430 } | |
8431 else | |
8432 { | |
8433 if ( pParty->uNumGold < v4 ) | |
8434 { | |
8435 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8436 v27 = 4; | |
8437 } | |
8438 else | |
8439 { | |
8440 Party::TakeGold(v4); | |
8441 *(short *)v6 = 1; | |
8442 v27 = 2; | |
8443 } | |
735 | 8444 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8445 } |
8446 } | |
8447 else | |
8448 { | |
8449 v5 = 0; | |
8450 } | |
437 | 8451 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8452 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8453 { | |
990 | 8454 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 8455 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
8456 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8457 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8458 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8459 }*/ |
8460 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8461 return; // void func |
0 | 8462 } |
484 | 8463 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8464 { |
8465 v24 = pNPCTopics[171].pText; | |
8466 v25 = v31; | |
8467 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8468 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8469 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8470 return ; |
8471 } | |
8472 | |
8473 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8474 return; | |
0 | 8475 v8 = pDialogueWindow; |
8476 v33 = 0; | |
8477 v34 = 0; | |
8478 v29 = pDialogueWindow; | |
8479 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8480 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8481 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8482 if ( v9 >= v10 ) | |
8483 goto LABEL_40; | |
8484 do | |
8485 { | |
832 | 8486 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8487 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8488 { |
8489 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8490 v33 += v12; | |
8491 ++v34; | |
8492 } | |
8493 v13 = v8->pStartingPosActiveItem; | |
8494 ++v35; | |
8495 } | |
8496 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8497 if ( !v34 ) | |
8498 { | |
8499 LABEL_40: | |
135 | 8500 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8501 strcat(pTmpBuf, "\n \n"); |
8502 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8503 v22 = v31; | |
8504 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8505 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8506 return; | |
0 | 8507 } |
8508 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8509 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8510 v32 = (149 - v33) / v34; | |
8511 if ( (149 - v33) / v34 > 32 ) | |
8512 v32 = 32; | |
711 | 8513 |
8514 v35 = v8->pStartingPosActiveItem; | |
0 | 8515 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8516 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8517 { |
8518 v33 = 2; | |
8519 do | |
8520 { | |
8521 v14 = v8->GetControl(v35); | |
832 | 8522 v15 = v14->msg_param - 36; |
135 | 8523 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8524 { |
8525 v16 = 0; | |
8526 if ( !v1->pActiveSkills[v15] ) | |
8527 { | |
8528 v17 = pSkillNames[v15]; | |
8529 v14->uY = v32 + v34; | |
8530 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8531 v19 = v14->uY; | |
8532 v14->uHeight = v18; | |
8533 v20 = v19 + v18 - 1; | |
8534 v14->uW = v20; | |
8535 v34 = v20; | |
8536 v21 = v31; | |
8537 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8538 v21 = v30; | |
8539 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8540 goto LABEL_34; | |
8541 } | |
8542 } | |
8543 else | |
8544 { | |
8545 v16 = 0; | |
8546 } | |
8547 v14->uW = v16; | |
8548 v14->uHeight = v16; | |
8549 v14->uY = v16; | |
8550 LABEL_34: | |
8551 v8 = v29; | |
8552 ++v35; | |
8553 ++v33; | |
711 | 8554 } |
8555 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8556 } | |
8557 return; | |
0 | 8558 } |
8559 | |
8560 //----- (00405CFF) -------------------------------------------------------- | |
8561 void stru262_TurnBased::End(bool bPlaySound) | |
8562 { | |
8563 stru262_TurnBased *v2; // edi@1 | |
8564 int v3; // ebx@1 | |
8565 int v4; // esi@1 | |
8566 unsigned __int8 v5; // zf@1 | |
8567 unsigned __int8 v6; // sf@1 | |
8568 TurnBased_QueueElem *v7; // ecx@2 | |
8569 unsigned __int16 *pAttributes; // ecx@7 | |
8570 size_t v9; // edx@7 | |
8571 unsigned __int16 v10; // ax@8 | |
8572 TurnBased_QueueElem *v11; // ebx@12 | |
8573 ObjectType objType; // eax@13 | |
8574 int objID; // esi@13 | |
8575 int v14; // [sp+Ch] [bp-4h]@11 | |
8576 | |
8577 v2 = this; | |
8578 v3 = 0; | |
8579 v4 = 0; | |
8580 v5 = this->uActorQueueSize == 0; | |
8581 v6 = this->uActorQueueSize < 0; | |
8582 this->field_4 = 0; | |
8583 if ( !(v6 | v5) ) | |
8584 { | |
8585 v7 = this->pQueue; | |
8586 do | |
8587 { | |
848 | 8588 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8589 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8590 ++v4; |
8591 ++v7; | |
8592 } | |
8593 while ( v4 < v2->uActorQueueSize ); | |
8594 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8595 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8596 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8597 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8598 v9 = uNumSpriteObjects; |
0 | 8599 do |
8600 { | |
8601 v10 = *pAttributes; | |
8602 if ( *pAttributes & 4 ) | |
8603 { | |
8604 LOBYTE(v10) = v10 & 0xFB; | |
8605 *pAttributes = v10; | |
8606 } | |
8607 pAttributes += 56; | |
8608 --v9; | |
8609 } | |
8610 while ( v9 ); | |
8611 } | |
8612 v14 = 0; | |
8613 if ( v2->uActorQueueSize > 0 ) | |
8614 { | |
8615 v11 = v2->pQueue; | |
8616 do | |
8617 { | |
848 | 8618 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8619 objID = PID_ID(v11->uPackedID); | |
0 | 8620 if ( objType == OBJECT_Player ) |
8621 { | |
8622 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8623 } | |
8624 else | |
8625 { | |
8626 if ( objType == OBJECT_Actor ) | |
8627 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8628 } | |
8629 ++v14; | |
8630 ++v11; | |
8631 } | |
8632 while ( v14 < v2->uActorQueueSize ); | |
8633 v3 = 0; | |
8634 } | |
8635 pAudioPlayer->StopChannels(-1, -1); | |
8636 if ( bPlaySound != v3 ) | |
8637 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8638 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8639 pEventTimer->StopGameTime(); | |
8640 dword_50C994 = v3; | |
8641 dword_50C998_turnbased_icon_1A = v3; | |
8642 } | |
8643 // 50C994: using guessed type int dword_50C994; | |
8644 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8645 | |
8646 //----- (00405E14) -------------------------------------------------------- | |
8647 void stru262_TurnBased::_405E14() | |
8648 { | |
8649 stru262_TurnBased *v1; // esi@1 | |
8650 int v2; // ecx@1 | |
8651 SpellBuff *v3; // edi@2 | |
8652 Actor *v4; // ebx@3 | |
8653 signed int v5; // edx@20 | |
8654 AIDirection *v6; // esi@21 | |
8655 int v7; // eax@21 | |
8656 int v8; // eax@21 | |
8657 int v9; // eax@22 | |
8658 int v10; // eax@23 | |
8659 int v11; // eax@37 | |
8660 int v12; // eax@44 | |
8661 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8662 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8663 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8664 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8665 int v17; // [sp+5Ch] [bp-10h]@6 |
8666 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8667 int v19; // [sp+64h] [bp-8h]@8 | |
8668 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8669 | |
8670 v1 = this; | |
8671 v2 = 0; | |
8672 v18 = v1; | |
8673 v20 = 0; | |
8674 if ( (signed int)uNumActors > 0 ) | |
8675 { | |
90 | 8676 //v3 = pActors;//[0].pActorBuffs; |
8677 v16 = pActors;//[0].pActorBuffs; | |
8678 v3 = v16->pActorBuffs; | |
0 | 8679 do |
8680 { | |
90 | 8681 v4 = v16; |
8682 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8683 v17 = v2; |
8684 else | |
8685 v17 = 1; | |
8686 v19 = v2; | |
8687 do | |
8688 { | |
8689 if ( v19 != 10 ) | |
8690 { | |
8691 v3->_4585CA(pParty->uTimePlayed); | |
8692 v2 = 0; | |
8693 } | |
8694 ++v19; | |
8695 ++v3; | |
8696 } | |
8697 while ( v19 < 22 ); | |
8698 if ( v17 != v2 | |
8699 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8700 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8701 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8702 if ( !(v4->uAttributes & 0x80) ) | |
8703 { | |
8704 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8705 { | |
8706 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8707 { | |
8708 v5 = v4->uCurrentActionLength; | |
8709 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8710 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8711 { | |
417 | 8712 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8713 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8714 v7 = v4->uAIState; |
8715 memcpy(&v15, v6, sizeof(v15)); | |
8716 v8 = v7 - 4; | |
8717 memcpy(&v14, &v15, sizeof(v14)); | |
8718 if ( v8 ) | |
8719 { | |
8720 v9 = v8 - 1; | |
8721 if ( v9 ) | |
8722 { | |
8723 v10 = v9 - 6; | |
8724 if ( v10 ) | |
8725 { | |
8726 if ( v10 != 8 ) | |
414 | 8727 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8728 } |
8729 } | |
8730 } | |
8731 else | |
8732 { | |
8733 v4->uCurrentActionTime = 0; | |
8734 v4->uCurrentActionLength = 0; | |
8735 v4->uAIState = Dead; | |
8736 v4->UpdateAnimation(); | |
8737 } | |
8738 v1 = v18; | |
8739 v2 = 0; | |
8740 } | |
8741 } | |
8742 } | |
8743 } | |
8744 ++v20; | |
90 | 8745 v3 = v16[1].pActorBuffs; |
8746 ++v16; | |
0 | 8747 } |
8748 while ( (signed int)v20 < (signed int)uNumActors ); | |
8749 } | |
8750 if ( v1->field_4 == 1 ) | |
8751 { | |
8752 v12 = v1->field_8; | |
8753 if ( v12 == 64 ) | |
8754 { | |
8755 v1->_406A63(); | |
8756 } | |
8757 else | |
8758 { | |
8759 if ( v12 > v2 ) | |
8760 { | |
8761 v1->_406B9F(); | |
8762 } | |
8763 else | |
8764 { | |
8765 v1->_406AFE(); | |
8766 v1->field_10 = 100; | |
8767 } | |
8768 } | |
8769 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8770 return; | |
8771 } | |
8772 if ( v1->field_4 == 2 ) | |
8773 { | |
8774 if ( !(v1->field_18 & 1) ) | |
8775 { | |
8776 v11 = v1->field_10; | |
8777 if ( v11 == 100 ) | |
8778 { | |
8779 v1->StartTurn(); | |
8780 LABEL_39: | |
8781 v1->_40652A(); | |
8782 return; | |
8783 } | |
8784 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8785 { | |
8786 v1->_4065B0(); | |
8787 goto LABEL_39; | |
8788 } | |
8789 } | |
8790 v1->NextTurn(); | |
8791 return; | |
8792 } | |
8793 if ( v1->field_4 == 3 ) | |
8794 { | |
8795 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8796 { | |
8797 v1->field_18 &= 0xFFFFFFF7u; | |
8798 v1->field_4 = 1; | |
8799 v1->field_8 = 64; | |
8800 } | |
8801 else | |
8802 { | |
8803 v1->_406FA8(); | |
8804 } | |
8805 } | |
8806 } | |
8807 | |
8808 //----- (0043FDED) -------------------------------------------------------- | |
8809 void PrepareActorRenderList_BLV() | |
8810 { | |
8811 RenderBillboard *v0; // esi@0 | |
8812 unsigned __int16 v3; // ax@3 | |
8813 unsigned int v4; // eax@5 | |
8814 unsigned __int16 v5; // cx@5 | |
8815 int v6; // esi@5 | |
8816 unsigned int v7; // eax@7 | |
8817 int v8; // eax@10 | |
8818 SpriteFrame *v9; // eax@16 | |
8819 SpriteFrame *v10; // ebx@18 | |
8820 //int *v11; // eax@18 | |
8821 int v12; // ecx@28 | |
8822 //IndoorCameraD3D **v14; // eax@36 | |
8823 double v15; // st7@36 | |
8824 float v16; // eax@36 | |
8825 //double v17; // ST30_8@36 | |
8826 signed __int64 v18; // qtt@36 | |
8827 int v19; // ST5C_4@36 | |
8828 signed __int64 v20; // qtt@37 | |
8829 int v21; // ST5C_4@37 | |
8830 signed __int16 v22; // cx@39 | |
8831 int v23; // ST50_4@40 | |
8832 signed int v24; // ecx@40 | |
8833 int v25; // edx@44 | |
8834 __int16 v26; // ax@44 | |
8835 //MonsterDesc *v27; // edx@44 | |
8836 //int v28; // ecx@44 | |
8837 unsigned __int8 v29; // zf@44 | |
8838 unsigned __int8 v30; // sf@44 | |
8839 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8840 int v32; // [sp+1Ch] [bp-38h]@5 | |
8841 int a3; // [sp+20h] [bp-34h]@5 | |
8842 int a2; // [sp+24h] [bp-30h]@5 | |
8843 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8844 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8845 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8846 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8847 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8848 int a6; // [sp+40h] [bp-14h]@34 | |
8849 int v43; // [sp+44h] [bp-10h]@34 | |
8850 int z; // [sp+48h] [bp-Ch]@32 | |
8851 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8852 int x; // [sp+50h] [bp-4h]@32 | |
8853 | |
8854 for (uint i = 0; i < uNumActors; ++i) | |
8855 { | |
8856 auto p = pActors + i; | |
8857 | |
8858 if (p->uAIState == Removed || | |
8859 p->uAIState == Disabled) | |
8860 continue; | |
8861 | |
8862 a5 = p->uSectorID; | |
8863 a2 = p->vPosition.y; | |
8864 a1a = p->vPosition.x; | |
8865 a3 = p->vPosition.z; | |
8866 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8867 LOWORD(v0) = p->uYawAngle; | |
8868 v5 = p->uCurrentActionAnimation; | |
8869 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8870 v32 = v6; | |
8871 if ( pParty->bTurnBasedModeOn ) | |
8872 { | |
8873 if ( v5 == 1 ) | |
8874 { | |
8875 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8876 goto LABEL_10; | |
8877 } | |
8878 } | |
8879 else | |
8880 { | |
8881 if ( v5 == 1 ) | |
8882 { | |
8883 v7 = pBLVRenderParams->field_0_timer_; | |
8884 LABEL_10: | |
8885 v8 = i * 32 + v7; | |
8886 goto LABEL_12; | |
8887 } | |
8888 } | |
8889 v8 = p->uCurrentActionTime; | |
8890 LABEL_12: | |
8891 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8892 v8 = 0; | |
8893 v31 = p->pSpriteIDs[v5]; | |
8894 if (p->uAIState == Resurrected) | |
8895 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8896 else | |
8897 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8898 v41 = 0; | |
8899 v10 = v9; | |
8900 //v11 = (int *)v9->uFlags; | |
8901 if (v9->uFlags & 2) | |
8902 v41 = 2; | |
8903 if (v9->uFlags & 0x40000) | |
8904 v41 |= 0x40u; | |
8905 if (v9->uFlags & 0x20000) | |
8906 LOBYTE(v41) = v41 | 0x80; | |
8907 v0 = (RenderBillboard *)(256 << v6); | |
8908 if ( (unsigned int)v0 & v9->uFlags) | |
8909 v41 |= 4u; | |
8910 if ( v10->uGlowRadius ) | |
8911 { | |
8912 //LOBYTE(v11) = byte_4E94D3; | |
8913 pMobileLightsStack->AddLight( | |
8914 a1a, | |
8915 a2, | |
8916 a3, | |
8917 a5, | |
8918 v10->uGlowRadius, | |
8919 0xFFu, | |
8920 0xFFu, | |
8921 0xFFu, | |
8922 byte_4E94D3); | |
8923 } | |
8924 v12 = 0; | |
8925 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8926 continue; | |
8927 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8928 { | |
8929 ++v12; | |
8930 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8931 goto _continue; | |
8932 } | |
8933 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8934 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8935 continue; | |
8936 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8937 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8938 if (uNumBillboardsToDraw >= 500) | |
8939 break; | |
8940 ++uNumBillboardsToDraw; | |
8941 ++uNumSpritesDrawnThisFrame; | |
8942 p->uAttributes |= 8u; | |
8943 v29 = pRenderer->pRenderD3D == 0; | |
8944 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8945 v0->uPalette = v10->uPaletteIndex; | |
8946 v0->uIndoorSectorID = a5; | |
8947 if ( v29 ) | |
8948 { | |
8949 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8950 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8951 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8952 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8953 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8954 } | |
8955 else | |
8956 { | |
8957 //v14 = &pGame->pIndoorCameraD3D; | |
8958 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8959 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8960 v16 = v0->fov_x; | |
8961 v0->fov_y = v15; | |
8962 //v17 = v16 + 6.7553994e15; | |
8963 LODWORD(v18) = 0; | |
8964 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8965 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8966 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8967 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8968 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8969 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8970 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8971 { | |
8972 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8973 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8974 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8975 goto LABEL_43; |
8976 } | |
8977 } | |
8978 else | |
8979 { | |
8980 v22 = p->pActorBuffs[3].uPower; | |
8981 if ( v22 ) | |
8982 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8983 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8984 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8985 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8986 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8987 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8988 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8989 goto LABEL_44; |
8990 } | |
8991 } | |
8992 LABEL_44: | |
8993 HIWORD(v25) = HIWORD(x); | |
430 | 8994 v0->world_x = a1a; |
8995 v0->world_y = a2; | |
8996 v0->world_z = a3; | |
0 | 8997 v0->uScreenSpaceX = v43; |
8998 v0->uScreenSpaceY = a6; | |
8999 LOWORD(v25) = 0; | |
9000 LOBYTE(v26) = v41; | |
194 | 9001 |
862 | 9002 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 9003 v0->actual_z = HIWORD(x); |
862 | 9004 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 9005 |
0 | 9006 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
9007 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
9008 v0->field_1E = v41; | |
9009 v0->pSpriteFrame = v10; | |
9010 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9011 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9012 { | |
9013 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9014 v0->field_1E = v26; | |
9015 } | |
9016 | |
9017 _continue: | |
9018 ; | |
9019 } | |
9020 } | |
9021 | |
9022 //----- (00444732) -------------------------------------------------------- | |
428 | 9023 char *GetEventHintString(unsigned int uEventID) |
9024 { | |
9025 signed int event_index; // edx@1 | |
9026 int event_pos; // esi@4 | |
0 | 9027 char *result; // eax@6 |
428 | 9028 unsigned int str_index; // eax@9 |
9029 int i; // esi@11 | |
9030 _evt_raw* test_evt; | |
9031 _evt_raw* last_evt; | |
9032 | |
9033 event_index = 0; | |
9034 if ( uLevelEVT_NumEvents <= 0 ) | |
9035 return NULL; | |
9036 | |
9037 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9038 while ( 1 ) |
9039 { | |
428 | 9040 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9041 { | |
9042 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9043 last_evt=test_evt; | |
9044 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9045 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9046 break; |
9047 } | |
428 | 9048 ++event_index; |
9049 if ( event_index >= uLevelEVT_NumEvents ) | |
9050 return NULL; | |
9051 } | |
9052 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9053 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9054 { | |
9055 str_index = EVT_DWORD(test_evt->v5); | |
9056 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9057 } |
9058 else | |
9059 { | |
428 | 9060 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9061 { | |
9062 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9063 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9064 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9065 { | |
9066 str_index = EVT_DWORD(test_evt->v5); | |
9067 if ( str_index < 600 ) | |
9068 return (char *)p2DEvents[str_index - 1].pName; | |
9069 } | |
9070 } | |
9071 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9072 } | |
9073 | |
0 | 9074 return result; |
9075 } | |
9076 | |
9077 //----- (00444839) -------------------------------------------------------- | |
9078 unsigned int __fastcall sub_444839_move_map(unsigned int a1, int a2, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) | |
9079 { | |
9080 unsigned int v9; // ebx@1 | |
9081 int v10; // edi@1 | |
373 | 9082 //signed int v11; // eax@1 |
0 | 9083 unsigned int v12; // eax@6 |
9084 const char *v13; // ST0C_4@6 | |
9085 unsigned int v14; // eax@8 | |
9086 const char *v15; // eax@14 | |
9087 unsigned int v16; // eax@16 | |
9088 unsigned int result; // eax@26 | |
9089 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9090 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9091 char *v20; // [sp-4h] [bp-3Ch]@9 |
9092 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9093 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9094 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9095 | |
9096 v9 = a1; | |
9097 v10 = a2; | |
9098 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9099 dword_59117C_teleportx = x; | |
9100 dword_591178_teleporty = y; | |
9101 dword_591174_teleportz = z; | |
9102 dword_591170_teleport_directiony = directiony; | |
9103 dword_59116C_teleport_directionx = directionx; | |
9104 dword_591168_teleport_speedz = a8; | |
9105 dword_591164_teleport_map_name = (char *)pLocationName; | |
9106 uCurrentHouse_Animation = v9; | |
9107 pEventTimer->Pause(); | |
9108 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9109 |
9110 switch (pParty->alignment) | |
9111 { | |
9112 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9113 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9114 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9115 default: assert(false); | |
9116 } | |
9117 /*v11 = const_2(); | |
0 | 9118 sprintf(pContainer, "evt%02d", v11); |
9119 if ( pParty->uAlignment ) | |
9120 { | |
9121 if ( pParty->uAlignment != 2 ) | |
9122 goto LABEL_6; | |
9123 v19 = "-c"; | |
9124 } | |
9125 else | |
9126 { | |
9127 v19 = "-b"; | |
9128 } | |
373 | 9129 strcat(pContainer, v19);*/ |
9130 | |
9131 //LABEL_6: | |
0 | 9132 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9133 v13 = pHouse_ExitPictures[v10]; | |
9134 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
948 | 9135 pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); |
0 | 9136 if ( v9 ) |
9137 { | |
9138 if ( !v23 ) | |
898 | 9139 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); |
9140 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); | |
0 | 9141 } |
9142 else | |
9143 { | |
9144 if ( !v23 ) | |
9145 { | |
9146 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9147 if ( v14 ) | |
9148 { | |
721 | 9149 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9150 goto LABEL_20; |
9151 } | |
9152 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9153 goto LABEL_19; | |
9154 } | |
9155 } | |
9156 v15 = pLocationName; | |
9157 if ( *pLocationName == 48 ) | |
9158 v15 = pCurrentMapName; | |
9159 v16 = pMapStats->GetMapInfo(v15); | |
9160 if ( v16 ) | |
9161 { | |
721 | 9162 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9163 goto LABEL_20; | |
0 | 9164 } |
9165 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9166 LABEL_19: | |
423 | 9167 strcpy(sHouseName, v21); |
0 | 9168 LABEL_20: |
710 | 9169 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9170 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9171 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9172 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9173 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9174 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9175 result = v23; |
9176 if ( v23 ) | |
9177 uCurrentHouse_Animation = v23; | |
9178 return result; | |
9179 } |