Mercurial > mm7
annotate mm7_4.cpp @ 764:90bcfb56c8f9
sound cleaning
author | Gloval |
---|---|
date | Sat, 23 Mar 2013 21:39:21 +0400 |
parents | f24fb0d64a5c |
children | 777c42590ffc |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
198 | 3 #include <assert.h> |
0 | 4 |
341 | 5 #include "MM7.h" |
6 | |
0 | 7 #include "MapInfo.h" |
8 #include "Game.h" | |
9 #include "GUIWindow.h" | |
10 #include "GUIButton.h" | |
11 #include "GUIFont.h" | |
12 #include "Party.h" | |
13 #include "AudioPlayer.h" | |
14 #include "Outdoor.h" | |
15 #include "IndoorCamera.h" | |
16 #include "Overlays.h" | |
17 #include "Monsters.h" | |
18 #include "Arcomage.h" | |
19 #include "LOD.h" | |
20 #include "Actor.h" | |
21 #include "Allocator.h" | |
22 #include "Events.h" | |
23 #include "Viewport.h" | |
24 #include "FrameTableInc.h" | |
25 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
26 #include "SpriteObject.h" |
0 | 27 #include "ObjectList.h" |
28 #include "Chest.h" | |
29 #include "PaletteManager.h" | |
30 #include "DecorationList.h" | |
31 #include "SaveLoad.h" | |
32 #include "stru123.h" | |
33 #include "stru287.h" | |
34 #include "Time.h" | |
35 #include "IconFrameTable.h" | |
36 #include "GUIProgressBar.h" | |
37 #include "Bink_Smacker.h" | |
38 #include "TileFrameTable.h" | |
39 #include "PlayerFrameTable.h" | |
40 #include "Awards.h" | |
41 #include "Autonotes.h" | |
42 #include "stru160.h" | |
43 #include "stru279.h" | |
44 #include "TurnEngine.h" | |
45 #include "FactionTable.h" | |
46 #include "StorylineTextTable.h" | |
47 #include "Random.h" | |
48 #include "stru277.h" | |
49 #include "stru298.h" | |
50 #include "stru12.h" | |
51 #include "stru351.h" | |
52 #include "Events2D.h" | |
53 #include "stru159.h" | |
189 | 54 #include "texts.h" |
0 | 55 #include "Log.h" |
629 | 56 #include "UIHouses.h" |
0 | 57 |
58 #include "mm7_data.h" | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 //----- (0046CC4B) -------------------------------------------------------- | |
75 void __cdecl _46CC4B_check_event_triggers() | |
76 { | |
77 int v0; // eax@1 | |
78 LevelDecoration *v1; // esi@2 | |
79 signed int v2; // edi@2 | |
80 int v3; // ebx@2 | |
81 int v4; // eax@3 | |
82 int v5; // ebx@3 | |
83 unsigned int v6; // ecx@3 | |
84 unsigned int v7; // edx@6 | |
85 unsigned int v8; // edx@8 | |
112 | 86 Actor *v9; // edi@13 |
0 | 87 int v10; // ebx@14 |
88 int v11; // eax@14 | |
89 int v12; // ebx@14 | |
90 unsigned int v13; // ecx@14 | |
91 int v14; // edx@15 | |
92 unsigned int v15; // edx@17 | |
93 unsigned int v16; // edx@19 | |
94 char *v17; // edi@25 | |
95 int v18; // ebx@26 | |
96 int v19; // eax@26 | |
97 int v20; // ebx@26 | |
98 unsigned int v21; // ecx@26 | |
99 int v22; // edx@27 | |
100 unsigned int v23; // edx@29 | |
101 unsigned int v24; // edx@31 | |
102 int v25; // [sp+0h] [bp-24h]@3 | |
103 int v26; // [sp+0h] [bp-24h]@14 | |
104 int v27; // [sp+0h] [bp-24h]@26 | |
105 int v28; // [sp+4h] [bp-20h]@3 | |
106 int v29; // [sp+4h] [bp-20h]@14 | |
107 int v30; // [sp+4h] [bp-20h]@26 | |
108 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
109 int v32; // [sp+Ch] [bp-18h]@2 | |
110 int v33; // [sp+10h] [bp-14h]@2 | |
111 int i; // [sp+14h] [bp-10h]@1 | |
112 int v35; // [sp+18h] [bp-Ch]@2 | |
113 int v36; // [sp+1Ch] [bp-8h]@3 | |
114 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
115 signed int v38; // [sp+20h] [bp-4h]@24 | |
116 | |
117 v0 = 0; | |
118 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
119 { | |
120 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
121 v2 = v1->field_18; | |
122 v3 = v1->vPosition.y; | |
123 v33 = v1->vPosition.x; | |
124 v32 = v1->vPosition.y; | |
125 v35 = v1->vPosition.z; | |
126 v31 = v1->field_18; | |
127 if ( v1->field_2 & 1 ) | |
128 { | |
129 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
130 v25 = abs(v3 - pParty->vPosition.y); | |
131 v28 = abs(v35 - pParty->vPosition.z); | |
132 v4 = v36; | |
133 v5 = v25; | |
134 v6 = v28; | |
135 if ( v36 < v25 ) | |
136 { | |
137 v4 = v25; | |
138 v5 = v36; | |
139 } | |
140 if ( v4 < v28 ) | |
141 { | |
142 v7 = v4; | |
143 v4 = v28; | |
144 v6 = v7; | |
145 } | |
146 if ( v5 < (signed int)v6 ) | |
147 { | |
148 v8 = v6; | |
149 v6 = v5; | |
150 v5 = v8; | |
151 } | |
152 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
153 EventProcessor(v1->field_16_event_id, 8 * i | 5, 1); | |
154 } | |
155 if ( v1->field_2 & 2 ) | |
156 { | |
157 v37 = 0; | |
158 if ( (signed int)uNumActors > 0 ) | |
159 { | |
112 | 160 v9 = pActors;//[0].vPosition.y; |
0 | 161 do |
162 { | |
112 | 163 v10 = abs(v33 - v9->vPosition.x); |
164 v29 = abs(v32 - v9->vPosition.y); | |
165 v26 = abs(v35 - v9->vPosition.z); | |
0 | 166 v11 = v10; |
167 v12 = v29; | |
168 v13 = v26; | |
169 if ( v11 < v29 ) | |
170 { | |
171 v14 = v11; | |
172 v11 = v29; | |
173 v12 = v14; | |
174 } | |
175 if ( v11 < v26 ) | |
176 { | |
177 v15 = v11; | |
178 v11 = v26; | |
179 v13 = v15; | |
180 } | |
181 if ( v12 < (signed int)v13 ) | |
182 { | |
183 v16 = v13; | |
184 v13 = v12; | |
185 v12 = v16; | |
186 } | |
187 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
188 EventProcessor(v1->field_16_event_id, 0, 1); | |
189 ++v37; | |
112 | 190 ++v9; |
0 | 191 } |
192 while ( v37 < (signed int)uNumActors ); | |
193 } | |
194 } | |
195 if ( v1->field_2 & 4 ) | |
196 { | |
197 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
198 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
199 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
200 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 201 do |
202 { | |
203 v18 = abs(v33 - *((int *)v17 - 1)); | |
204 v30 = abs(v32 - *(int *)v17); | |
205 v27 = abs(v35 - *((int *)v17 + 1)); | |
206 v19 = v18; | |
207 v20 = v30; | |
208 v21 = v27; | |
209 if ( v19 < v30 ) | |
210 { | |
211 v22 = v19; | |
212 v19 = v30; | |
213 v20 = v22; | |
214 } | |
215 if ( v19 < v27 ) | |
216 { | |
217 v23 = v19; | |
218 v19 = v27; | |
219 v21 = v23; | |
220 } | |
221 if ( v20 < (signed int)v21 ) | |
222 { | |
223 v24 = v21; | |
224 v21 = v20; | |
225 v20 = v24; | |
226 } | |
227 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
228 EventProcessor(v1->field_16_event_id, 0, 1); | |
229 ++v38; | |
230 v17 += 112; | |
231 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
232 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 233 } |
234 } | |
235 v0 = i + 1; | |
236 } | |
237 } | |
238 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
239 | |
240 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 241 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 242 { |
243 int v13; // ecx@13 | |
244 signed int v14; // ebx@14 | |
245 int v15; // eax@16 | |
729 | 246 //int v16; // edx@19 |
0 | 247 int v17; // ST18_4@19 |
248 signed int v18; // edx@19 | |
249 signed __int64 v19; // qtt@19 | |
250 int v21; // eax@27 | |
251 int v22; // ecx@29 | |
252 signed int v28; // eax@45 | |
253 int v29; // ebx@47 | |
254 int v30; // edx@49 | |
255 int v31; // ST10_4@49 | |
256 signed int v32; // edx@49 | |
257 signed __int64 v33; // qtt@49 | |
258 signed int v34; // eax@54 | |
259 signed int v35; // esi@56 | |
260 int result; // eax@57 | |
261 int v38; // edx@62 | |
262 int v44; // [sp+20h] [bp-20h]@10 | |
263 bool v47; // [sp+24h] [bp-1Ch]@43 | |
264 bool v48; // [sp+28h] [bp-18h]@10 | |
265 bool v49; // [sp+28h] [bp-18h]@41 | |
266 bool v50; // [sp+2Ch] [bp-14h]@12 | |
267 signed int v53; // [sp+30h] [bp-10h]@10 | |
268 signed int v54; // [sp+30h] [bp-10h]@41 | |
269 signed int v55; // [sp+34h] [bp-Ch]@1 | |
270 | |
730 | 271 //LOG_DECOMPILATION_WARNING(); |
272 | |
273 static int blv_floor_id[50]; // 00721200 | |
274 static int blv_floor_level[50]; // 007212C8 | |
275 | |
276 static __int16 word_721390_ys[104]; // idb | |
277 static __int16 word_721460_xs[104]; // idb | |
0 | 278 |
279 auto pSector = &pIndoor->pSectors[uSectorID]; | |
723 | 280 v55 = 1; |
0 | 281 for (uint i = 0; i < pSector->uNumFloors; ++i) |
282 { | |
283 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
284 if (pFloor->Clickable()) | |
285 continue; | |
286 | |
287 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && | |
288 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
289 { | |
290 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
291 { | |
730 | 292 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
293 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
294 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
295 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 296 } |
297 v44 = 2 * pFloor->uNumVertices; | |
730 | 298 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
299 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
300 | |
301 v48 = word_721390_ys[0] >= y; | |
0 | 302 v53 = 0; |
303 if ( pFloor->uNumVertices > 0 ) | |
304 { | |
723 | 305 for ( int i = 0; i < v44; i++ ) |
0 | 306 { |
307 if ( v53 >= 2 ) | |
308 break; | |
730 | 309 v50 = word_721390_ys[i + 1] >= y; |
310 | |
311 v13 = i; | |
312 if ( v48 != v50 ) | |
0 | 313 { |
730 | 314 v14 = word_721460_xs[i + 1] >= x ? 0 : 2; |
315 v15 = v14 | word_721460_xs[i] < x; | |
729 | 316 |
317 if ( !v15) | |
318 ++v53; | |
319 else | |
320 { | |
730 | 321 //v16 = word_721390_ys[i]; |
322 v17 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
323 v18 = y - word_721390_ys[i]; | |
729 | 324 LODWORD(v19) = v18 << 16; |
325 HIDWORD(v19) = v18 >> 16; | |
730 | 326 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x) |
729 | 327 ++v53; |
328 } | |
329 /*if ( v15 != 3 ) | |
0 | 330 { |
723 | 331 if ( !v15 ) |
332 { | |
730 | 333 LODWORD(v19) = (y - word_721390_ys[i]) << 16; |
334 HIDWORD(v19) = (y - word_721390_ys[i]) >> 16; | |
335 v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]); | |
723 | 336 if ( v16 >= x) |
337 ++v53; | |
338 } | |
729 | 339 }*/ |
0 | 340 } |
341 v48 = v50; | |
723 | 342 } |
0 | 343 if ( v53 == 1 ) |
344 { | |
345 if ( v55 >= 50 ) | |
346 break; | |
723 | 347 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 348 { |
725 | 349 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 350 } |
351 else | |
352 { | |
725 | 353 v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) |
0 | 354 + HIWORD(pFloor->zCalc3); |
355 } | |
356 v22 = v55++; | |
725 | 357 blv_floor_level[v22] = v21; |
730 | 358 blv_floor_id[v22] = pSector->pFloors[i]; |
0 | 359 } |
360 } | |
361 } | |
362 } | |
363 if ( pSector->field_0 & 8 ) | |
364 { | |
365 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
366 { | |
367 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
368 if (portal->uPolygonType != POLYGON_Floor) | |
369 continue; | |
370 | |
723 | 371 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
372 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
373 { | |
0 | 374 for (uint j = 0; j < portal->uNumVertices; ++j) |
375 { | |
730 | 376 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
377 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
378 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
379 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
380 } | |
381 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
382 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 383 v54 = 0; |
730 | 384 v49 = word_721390_ys[0] >= y; |
435 | 385 if ( portal->uNumVertices > 0 ) |
0 | 386 { |
723 | 387 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) |
0 | 388 { |
389 if ( v54 >= 2 ) | |
390 break; | |
730 | 391 v47 = word_721390_ys[i + 1] >= y; |
0 | 392 if ( v49 != v47 ) |
393 { | |
730 | 394 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; |
395 v29 = v28 | word_721460_xs[i] < x; | |
0 | 396 if ( v29 != 3 ) |
397 { | |
723 | 398 if ( !v29 ) |
729 | 399 ++v54; |
400 else | |
401 { | |
730 | 402 //v30 = word_721390_ys[v27]; |
403 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
404 v32 = y - word_721390_ys[i]; | |
729 | 405 LODWORD(v33) = v32 << 16; |
406 HIDWORD(v33) = v32 >> 16; | |
730 | 407 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x) |
723 | 408 ++v54; |
729 | 409 } |
0 | 410 } |
411 } | |
412 v49 = v47; | |
413 } | |
414 if ( v54 == 1 ) | |
415 { | |
416 if ( v55 >= 50 ) | |
417 break; | |
418 v34 = v55++; | |
725 | 419 blv_floor_level[v34] = -29000; |
730 | 420 blv_floor_id[v34] = pSector->pPortals[i]; |
0 | 421 } |
422 } | |
423 } | |
424 } | |
425 } | |
426 if ( v55 == 1 ) | |
427 { | |
730 | 428 *pFaceID = blv_floor_id[0]; |
725 | 429 return blv_floor_level[0]; |
0 | 430 } |
431 if ( !v55 ) | |
432 return -30000; | |
730 | 433 *pFaceID = blv_floor_id[0]; |
725 | 434 //result = blv_floor_level[0]; |
0 | 435 if ( v55 > 1 ) |
436 { | |
717 | 437 for ( v35 = 1; v35 < v55; ++v35 ) |
0 | 438 { |
725 | 439 if ( blv_floor_level[0] <= z + 5 ) |
440 { | |
441 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 442 continue; |
725 | 443 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 444 *pFaceID = blv_floor_id[v35]; |
717 | 445 continue; |
446 } | |
725 | 447 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
448 { | |
449 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 450 *pFaceID = blv_floor_id[v35]; |
717 | 451 } |
452 } | |
0 | 453 } |
725 | 454 return blv_floor_level[0]; |
0 | 455 } |
456 | |
457 //----- (0046D49E) -------------------------------------------------------- | |
723 | 458 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7) |
0 | 459 { |
723 | 460 BSPModel *pBModel; // esi@4 |
461 ODMFace *pFace; // ecx@11 | |
0 | 462 int v14; // edx@20 |
463 signed int v18; // edx@26 | |
464 int v19; // eax@28 | |
465 int v20; // edx@30 | |
466 int v21; // ST1C_4@30 | |
467 signed int v22; // edx@30 | |
468 signed __int64 v23; // qtt@30 | |
469 int v24; // eax@36 | |
470 signed int v25; // ecx@38 | |
471 int result; // eax@42 | |
472 signed int v27; // ecx@43 | |
473 int v28; // edi@44 | |
474 signed int v29; // edx@44 | |
475 int v30; // esi@45 | |
476 int v31; // eax@45 | |
477 ODMFace *v32; // eax@57 | |
478 int v33; // ecx@59 | |
479 int v36; // [sp+14h] [bp-2Ch]@24 | |
480 int v38; // [sp+1Ch] [bp-24h]@2 | |
481 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 482 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
483 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 484 bool v43; // [sp+30h] [bp-10h]@22 |
485 bool v44; // [sp+34h] [bp-Ch]@24 | |
486 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
487 signed int v48; // [sp+58h] [bp+18h]@22 | |
488 signed int v49; // [sp+58h] [bp+18h]@43 | |
489 | |
490 v46 = 1; | |
491 dword_721160[0] = -1; | |
492 dword_721110[0] = -1; | |
725 | 493 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7); |
0 | 494 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 495 { |
496 *a6 = 0; | |
725 | 497 return odm_floor_level[0]; |
723 | 498 } |
0 | 499 v38 = 0; |
723 | 500 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
501 { | |
502 pBModel = &pOutdoor->pBModels[v38]; | |
503 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
504 { | |
505 if ( (signed int)pBModel->uNumFaces > 0 ) | |
506 { | |
507 v39 = 0; | |
508 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
509 { | |
510 pFace = &pBModel->pFaces[v39]; | |
511 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
512 && !(pFace->uAttributes & 0x20000000) | |
513 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
514 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 515 { |
723 | 516 if ( pFace->uNumVertices ) |
0 | 517 { |
723 | 518 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 519 { |
723 | 520 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
521 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
522 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
523 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
524 } | |
525 } | |
526 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
527 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
528 v43 = word_720F70[0] >= Y; | |
529 v48 = 0; | |
530 if ( 2 * pFace->uNumVertices > 0 ) | |
531 { | |
532 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
533 { | |
534 if ( v48 >= 2 ) | |
535 break; | |
536 v36 = word_720F70[i + 1]; | |
537 v44 = word_720F70[i + 1] >= Y; | |
538 if ( v43 != v44 ) | |
0 | 539 { |
723 | 540 v18 = word_721040[i + 1] >= X ? 0 : 2; |
541 v19 = v18 | word_721040[i] < X; | |
542 if ( v19 != 3 ) | |
0 | 543 { |
723 | 544 if ( !v19 ) |
740 | 545 ++v48; |
546 else | |
0 | 547 { |
723 | 548 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
549 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
550 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
551 if ( v22 >= X) | |
552 ++v48; | |
0 | 553 } |
554 } | |
555 } | |
723 | 556 v43 = v44; |
557 } | |
558 if ( v48 == 1 ) | |
559 { | |
560 if ( v46 >= 20 ) | |
0 | 561 break; |
723 | 562 if ( pFace->uPolygonType == POLYGON_Floor ) |
563 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
564 else | |
725 | 565 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
566 + HIWORD(pFace->zCalc3); | |
723 | 567 v25 = v46++; |
725 | 568 odm_floor_level[v25] = v24; |
723 | 569 dword_721160[v25] = pBModelNum; |
570 dword_721110[v25] = pFaceNum; | |
0 | 571 } |
572 } | |
573 } | |
723 | 574 ++v39; |
575 } | |
576 } | |
577 } | |
0 | 578 ++v38; |
579 } | |
580 if ( v46 == 1 ) | |
581 { | |
582 *a6 = 0; | |
725 | 583 return odm_floor_level[0]; |
0 | 584 } |
585 v27 = 0; | |
586 if ( v46 <= 1 ) | |
587 *a6 = 0; | |
723 | 588 else |
589 { | |
725 | 590 //v29 = 1; |
723 | 591 for ( v49 = 1; v49 < v46; ++v49 ) |
592 { | |
725 | 593 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 594 { |
595 v27 = v49; | |
725 | 596 //++v29; |
723 | 597 break; |
598 } | |
725 | 599 if ( odm_floor_level[0] > Z + 5 ) |
600 { | |
601 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
602 { | |
603 //++v29; | |
723 | 604 break; |
605 } | |
606 v27 = v49; | |
725 | 607 //++v29; |
723 | 608 break; |
609 } | |
725 | 610 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 611 { |
612 v27 = v49; | |
725 | 613 //++v29; |
723 | 614 } |
615 } | |
616 if ( !v27 ) | |
617 *a6 = 0; | |
618 else | |
619 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
620 } | |
0 | 621 if ( v27 ) |
622 { | |
623 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
624 *a5 = 0; | |
625 if ( v32->uAttributes & 0x10 ) | |
626 *a5 = 1; | |
627 } | |
725 | 628 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
629 odm_floor_level[0] = odm_floor_level[v27]; | |
630 return odm_floor_level[0]; | |
0 | 631 } |
632 | |
633 //----- (0046D8E3) -------------------------------------------------------- | |
634 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
635 { | |
636 int v4; // ebx@1 | |
637 unsigned int v5; // ecx@1 | |
638 BSPModel *v6; // edi@3 | |
639 ODMFace *v7; // esi@10 | |
640 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
641 signed __int16 *v9; // eax@18 |
0 | 642 int v10; // edx@19 |
643 int v11; // ecx@21 | |
644 int v12; // ecx@23 | |
645 signed int v13; // eax@25 | |
646 int v14; // edx@27 | |
647 int v15; // edx@29 | |
648 int v16; // ST18_4@29 | |
649 signed int v17; // edx@29 | |
650 signed __int64 v18; // qtt@29 | |
651 int v19; // eax@35 | |
652 signed int v20; // ecx@37 | |
653 signed int v22; // ebx@42 | |
654 unsigned int v23; // esi@43 | |
655 int v24; // edx@44 | |
656 int v25; // eax@44 | |
657 int v26; // [sp+Ch] [bp-38h]@7 | |
658 int v27; // [sp+10h] [bp-34h]@21 | |
659 int v28; // [sp+18h] [bp-2Ch]@21 | |
660 int v29; // [sp+1Ch] [bp-28h]@2 | |
661 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
662 signed int v31; // [sp+24h] [bp-20h]@1 | |
663 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
664 int v33; // [sp+2Ch] [bp-18h]@7 | |
665 bool v34; // [sp+30h] [bp-14h]@21 | |
666 bool v35; // [sp+34h] [bp-10h]@23 | |
667 signed int v36; // [sp+38h] [bp-Ch]@17 | |
668 signed int v37; // [sp+38h] [bp-Ch]@21 | |
669 signed int v38; // [sp+38h] [bp-Ch]@42 | |
670 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
671 signed int v40; // [sp+40h] [bp-4h]@1 | |
672 | |
673 dword_720ED0[0] = -1; | |
674 dword_720E80[0] = -1; | |
675 v4 = a1; | |
676 v5 = 0; | |
677 v40 = a2; | |
678 v31 = v4; | |
679 v39 = 1; | |
680 dword_720F20[0] = 10000; | |
681 v32 = 0; | |
682 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
683 { | |
684 v29 = 0; | |
685 do | |
686 { | |
687 v6 = &pOutdoor->pBModels[v29]; | |
688 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
689 { | |
690 if ( v4 >= v6->sMinX ) | |
691 { | |
692 if ( v40 <= v6->sMaxY ) | |
693 { | |
694 if ( v40 >= v6->sMinY ) | |
695 { | |
696 v33 = v5; | |
697 v26 = v6->uNumFaces; | |
698 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
699 { | |
700 v30 = v5; | |
701 while ( 1 ) | |
702 { | |
703 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
704 v8 = v7->uPolygonType; | |
705 if ( (v8 == 5 || v8 == 6) | |
706 && !(BYTE3(v7->uAttributes) & 0x20) | |
707 && v4 <= v7->pBoundingBox.x2 | |
708 && v4 >= v7->pBoundingBox.x1 | |
709 && v40 <= v7->pBoundingBox.y2 | |
710 && v40 >= v7->pBoundingBox.y1 ) | |
711 { | |
712 v36 = v5; | |
713 if ( v7->uNumVertices ) | |
714 { | |
715 v9 = v7->pXInterceptDisplacements; | |
716 do | |
717 { | |
718 v10 = 2 * v36; | |
719 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
720 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
721 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
722 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
723 ++v9; | |
724 } | |
725 while ( v36 < v7->uNumVertices ); | |
726 v4 = v31; | |
727 } | |
728 v27 = 2 * v7->uNumVertices; | |
729 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
730 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
731 v11 = 0; | |
732 v34 = word_720CE0_ys[0] >= v40; | |
733 v37 = 0; | |
734 v28 = 0; | |
735 if ( v27 > 0 ) | |
736 { | |
737 do | |
738 { | |
739 if ( v37 >= 2 ) | |
740 break; | |
741 v12 = v11; | |
742 v4 = v31; | |
743 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
744 if ( v34 != v35 ) | |
745 { | |
746 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
747 v14 = v13 | word_720DB0_xs[v12] < v31; | |
748 if ( v14 != 3 ) | |
749 { | |
750 if ( !v14 | |
751 || (v15 = word_720CE0_ys[v12], | |
752 v16 = word_720CE0_ys[v12 + 1] - v15, | |
753 v17 = v40 - v15, | |
754 LODWORD(v18) = v17 << 16, | |
755 HIDWORD(v18) = v17 >> 16, | |
756 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
757 - (signed int)word_720DB0_xs[v12]) | |
758 * v18 | |
759 / v16) >> 16) | |
760 + word_720DB0_xs[v12]) >= v31) ) | |
761 ++v37; | |
762 } | |
763 } | |
764 v11 = v28 + 1; | |
765 v34 = v35; | |
766 ++v28; | |
767 } | |
768 while ( v28 < v27 ); | |
769 if ( v37 == 1 ) | |
770 { | |
771 if ( v39 >= 20 ) | |
772 break; | |
773 if ( v7->uPolygonType == 5 ) | |
774 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
775 else | |
776 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
777 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
778 + HIWORD(v7->zCalc3); | |
779 v20 = v39++; | |
780 dword_720F20[v20] = v19; | |
781 dword_720ED0[v20] = v32; | |
782 dword_720E80[v20] = v33; | |
783 } | |
784 } | |
785 } | |
786 ++v33; | |
787 v30 += 308; | |
788 if ( v33 >= v26 ) | |
789 break; | |
790 v5 = 0; | |
791 } | |
792 } | |
793 } | |
794 } | |
795 } | |
796 } | |
797 ++v32; | |
798 ++v29; | |
799 v5 = 0; | |
800 } | |
801 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
802 if ( !v39 ) | |
803 { | |
804 *(int *)a4 = 0; | |
805 return dword_720F20[0]; | |
806 } | |
807 } | |
808 v22 = 0; | |
809 v38 = v5; | |
810 if ( v39 <= (signed int)v5 ) | |
811 goto LABEL_54; | |
812 v23 = 0; | |
813 do | |
814 { | |
815 v24 = dword_720F20[v5 / 4]; | |
816 v25 = *(int *)((char *)dword_720F20 + v23); | |
817 if ( v24 == v25 ) | |
818 goto LABEL_50; | |
819 if ( v25 > a3 + 15 ) | |
820 { | |
821 if ( v24 >= v25 ) | |
822 goto LABEL_51; | |
823 LABEL_50: | |
824 v22 = v38; | |
825 v23 = v5; | |
826 goto LABEL_51; | |
827 } | |
828 if ( v24 > v25 && v24 <= a3 + 15 ) | |
829 goto LABEL_50; | |
830 LABEL_51: | |
831 ++v38; | |
832 v5 += 4; | |
833 } | |
834 while ( v38 < v39 ); | |
835 if ( v22 ) | |
836 { | |
837 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
838 return dword_720F20[v22]; | |
839 } | |
840 LABEL_54: | |
841 *(int *)a4 = 0; | |
842 return dword_720F20[v22]; | |
843 } | |
844 | |
138 | 845 |
846 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal | |
847 // for a right-handed system, that would be an inverse normal | |
0 | 848 //----- (0046DCC8) -------------------------------------------------------- |
138 | 849 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
850 { | |
851 auto grid_x = WorldPosToGridCellX(pos_x); | |
852 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
853 | |
854 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
855 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
856 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
857 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
858 | |
859 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
860 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
861 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
862 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
863 | |
864 float side1_dx, side1_dy, side1_dz, | |
865 side2_dx, side2_dy, side2_dz; | |
866 | |
867 auto dx = abs(pos_x - grid_pos_x1), | |
868 dz = abs(grid_pos_z1 - pos_z); | |
869 if (dz >= dx) | |
870 { | |
871 side1_dy = (double)(x1z1_y - x1z2_y); | |
872 side2_dy = (double)(x2z2_y - x1z2_y); | |
873 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
874 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
875 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
876 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 877 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 878 /* |\ |
879 side1 | \ | |
880 |____\ | |
881 side 2 */ | |
882 } | |
883 else | |
884 { | |
885 side1_dy = (double)(x2z2_y - x2z1_y); | |
886 side2_dy = (double)(x1z1_y - x2z1_y); | |
887 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
888 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
889 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
890 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
891 | |
892 /* side 2 | |
893 _____ | |
894 \ | | |
895 \ | side 1 | |
896 \| */ | |
897 } | |
898 | |
899 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
900 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
901 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
902 | |
903 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
904 if (fabsf(mag) < 1e-6f) | |
905 { | |
906 out->y = 0; | |
907 out->x = 0; | |
908 out->z = 65536; | |
909 } | |
910 else | |
911 { | |
912 float invmag = 1.0 / mag; | |
913 out->x = invmag * nx * 65536.0; | |
914 out->y = invmag * ny * 65536.0; | |
915 out->z = invmag * nz * 65536.0; | |
916 } | |
917 } | |
918 | |
0 | 919 |
920 //----- (0046DEF2) -------------------------------------------------------- | |
921 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
922 { | |
923 unsigned int result; // eax@1 | |
924 | |
925 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
926 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 927 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
928 return result; | |
929 } | |
930 | |
931 //----- (0046DF1A) -------------------------------------------------------- | |
932 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
933 { | |
934 Actor *v2; // edi@1 | |
935 unsigned __int16 v3; // ax@1 | |
936 int v4; // esi@6 | |
937 int v5; // ecx@8 | |
938 int v6; // eax@10 | |
939 int v7; // edx@12 | |
940 int v8; // ecx@14 | |
941 int v9; // eax@14 | |
942 int v10; // ebx@14 | |
943 int v11; // esi@14 | |
944 int v12; // ebx@15 | |
945 int v13; // ebx@17 | |
946 unsigned int v14; // eax@20 | |
947 signed int result; // eax@21 | |
948 int v16; // [sp+Ch] [bp-10h]@1 | |
949 int v17; // [sp+10h] [bp-Ch]@14 | |
950 int v18; // [sp+14h] [bp-8h]@14 | |
951 int v19; // [sp+18h] [bp-4h]@14 | |
952 | |
953 v16 = a1; | |
954 v2 = &pActors[a1]; | |
955 v3 = v2->uAIState; | |
956 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
957 goto LABEL_25; | |
958 v4 = v2->uActorRadius; | |
959 if ( a2 ) | |
960 v4 = a2; | |
961 v5 = v2->vPosition.x; | |
962 if ( stru_721530.sMaxX > v5 + v4 | |
963 || stru_721530.sMinX < v5 - v4 | |
964 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
965 || stru_721530.sMinY < v6 - v4 | |
966 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
967 || stru_721530.sMinZ < v7 | |
968 || (v8 = v5 - stru_721530.normal.x, | |
969 v9 = v6 - stru_721530.normal.y, | |
970 v10 = stru_721530.prolly_normal_d + v4, | |
971 v17 = stru_721530.prolly_normal_d + v4, | |
972 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
973 v18 = v8, | |
974 v19 = v9, | |
975 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
976 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
977 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
978 { | |
979 LABEL_25: | |
980 result = 0; | |
981 } | |
982 else | |
983 { | |
295 | 984 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 985 if ( v13 < 0 ) |
986 v13 = 0; | |
987 if ( v13 < stru_721530.field_7C ) | |
988 { | |
989 stru_721530.field_7C = v13; | |
990 v14 = 8 * v16; | |
991 LOBYTE(v14) = 8 * v16 | 3; | |
992 stru_721530.uFaceID = v14; | |
993 } | |
994 result = 1; | |
995 } | |
996 return result; | |
997 } | |
998 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
999 | |
1000 //----- (0046E0B2) -------------------------------------------------------- | |
1001 void __cdecl _46E0B2_collide_against_decorations() | |
1002 { | |
1003 BLVSector *v0; // ebp@1 | |
1004 LevelDecoration *v1; // edi@2 | |
1005 DecorationDesc *v2; // esi@3 | |
1006 int v3; // edx@4 | |
1007 int v4; // eax@4 | |
1008 int v5; // ecx@6 | |
1009 int v6; // ebx@8 | |
1010 int v7; // esi@8 | |
1011 int v8; // ebx@10 | |
1012 int v9; // esi@11 | |
1013 int v10; // edi@12 | |
1014 int v11; // eax@12 | |
1015 int v12; // esi@14 | |
1016 unsigned int v13; // eax@17 | |
1017 signed int i; // [sp+4h] [bp-14h]@1 | |
1018 int v15; // [sp+8h] [bp-10h]@10 | |
1019 int v16; // [sp+Ch] [bp-Ch]@10 | |
1020 int v17; // [sp+10h] [bp-8h]@10 | |
1021 int v18; // [sp+14h] [bp-4h]@8 | |
1022 | |
1023 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1024 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1025 { | |
1026 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1027 if ( !(v1->field_2 & 0x20) ) | |
1028 { | |
1029 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1030 if (!v2->CanMoveThrough()) |
0 | 1031 { |
1032 v3 = v2->uRadius; | |
1033 v4 = v1->vPosition.x; | |
1034 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1035 { | |
1036 if ( stru_721530.sMinX >= v4 - v3 ) | |
1037 { | |
1038 v5 = v1->vPosition.y; | |
1039 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1040 { | |
1041 if ( stru_721530.sMinY >= v5 - v3 ) | |
1042 { | |
1043 v6 = v2->uDecorationHeight; | |
1044 v7 = v1->vPosition.z; | |
1045 v18 = v6; | |
1046 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1047 { | |
1048 if ( stru_721530.sMinZ >= v7 ) | |
1049 { | |
1050 v16 = v4 - stru_721530.normal.x; | |
1051 v15 = v5 - stru_721530.normal.y; | |
1052 v8 = stru_721530.prolly_normal_d + v3; | |
1053 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1054 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1055 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1056 { | |
1057 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1058 if ( v9 > 0 ) | |
1059 { | |
1060 v10 = v1->vPosition.z; | |
1061 v11 = stru_721530.normal.z | |
1062 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1063 if ( v11 >= v10 ) | |
1064 { | |
1065 if ( v11 <= v18 + v10 ) | |
1066 { | |
295 | 1067 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1068 if ( v12 < 0 ) |
1069 v12 = 0; | |
1070 if ( v12 < stru_721530.field_7C ) | |
1071 { | |
1072 stru_721530.field_7C = v12; | |
1073 v13 = 8 * v0->pDecorationIDs[i]; | |
1074 LOBYTE(v13) = v13 | 5; | |
1075 stru_721530.uFaceID = v13; | |
1076 } | |
1077 } | |
1078 } | |
1079 } | |
1080 } | |
1081 } | |
1082 } | |
1083 } | |
1084 } | |
1085 } | |
1086 } | |
1087 } | |
1088 } | |
1089 } | |
1090 } | |
1091 | |
1092 //----- (0046E26D) -------------------------------------------------------- | |
1093 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1094 { | |
1095 int v2; // edx@5 | |
1096 unsigned __int16 *v3; // eax@5 | |
1097 unsigned __int16 v4; // ax@6 | |
1098 LevelDecoration *v5; // edi@7 | |
1099 DecorationDesc *v6; // esi@8 | |
1100 int v7; // edx@9 | |
1101 int v8; // eax@9 | |
1102 int v9; // ecx@11 | |
1103 int v10; // ebx@13 | |
1104 int v11; // esi@13 | |
1105 int v12; // ebp@15 | |
1106 int v13; // ebx@15 | |
1107 int v14; // esi@16 | |
1108 int v15; // edi@17 | |
1109 int v16; // eax@17 | |
1110 int v17; // esi@19 | |
1111 char v18; // zf@23 | |
1112 int v19; // [sp+0h] [bp-10h]@15 | |
1113 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1114 int v21; // [sp+8h] [bp-8h]@15 | |
1115 int v22; // [sp+Ch] [bp-4h]@13 | |
1116 | |
1117 if ( a1 >= 0 ) | |
1118 { | |
1119 if ( a1 <= 127 ) | |
1120 { | |
1121 if ( a2 >= 0 ) | |
1122 { | |
1123 if ( a2 <= 127 ) | |
1124 { | |
1125 v2 = a1 + (a2 << 7); | |
1126 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1127 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1128 if ( v3 ) | |
1129 { | |
1130 do | |
1131 { | |
1132 v4 = *v3; | |
141 | 1133 if ( (v4 & 7) == OBJECT_Decoration) |
0 | 1134 { |
1135 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1136 if ( !(v5->field_2 & 0x20) ) | |
1137 { | |
1138 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1139 if (!v6->CanMoveThrough()) |
0 | 1140 { |
1141 v7 = v6->uRadius; | |
1142 v8 = v5->vPosition.x; | |
1143 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1144 { | |
1145 if ( stru_721530.sMinX >= v8 - v7 ) | |
1146 { | |
1147 v9 = v5->vPosition.y; | |
1148 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1149 { | |
1150 if ( stru_721530.sMinY >= v9 - v7 ) | |
1151 { | |
1152 v10 = v6->uDecorationHeight; | |
1153 v11 = v5->vPosition.z; | |
1154 v22 = v10; | |
1155 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1156 { | |
1157 if ( stru_721530.sMinZ >= v11 ) | |
1158 { | |
1159 v12 = v8 - stru_721530.normal.x; | |
1160 v19 = v9 - stru_721530.normal.y; | |
1161 v13 = stru_721530.prolly_normal_d + v7; | |
1162 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1163 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1164 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1165 { | |
1166 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1167 if ( v14 > 0 ) | |
1168 { | |
1169 v15 = v5->vPosition.z; | |
1170 v16 = stru_721530.normal.z | |
1171 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1172 if ( v16 >= v15 ) | |
1173 { | |
1174 if ( v16 <= v22 + v15 ) | |
1175 { | |
295 | 1176 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1177 if ( v17 < 0 ) |
1178 v17 = 0; | |
1179 if ( v17 < stru_721530.field_7C ) | |
1180 { | |
1181 stru_721530.field_7C = v17; | |
1182 stru_721530.uFaceID = (signed __int16)*v20; | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 } | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 } | |
1197 v3 = v20 + 1; | |
1198 v18 = *v20 == 0; | |
1199 ++v20; | |
1200 } | |
1201 while ( !v18 ); | |
1202 } | |
1203 } | |
1204 } | |
1205 } | |
1206 } | |
1207 } | |
1208 | |
1209 //----- (00486F92) -------------------------------------------------------- | |
1210 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1211 { | |
1212 Span *v0; // ebx@1 | |
1213 int v1; // eax@2 | |
1214 Edge *v2; // ecx@3 | |
1215 Edge *v3; // edx@3 | |
1216 Edge *v4; // esi@6 | |
1217 Edge *v5; // eax@7 | |
1218 Edge *v6; // ecx@8 | |
1219 Surf *v7; // esi@11 | |
1220 double v8; // st7@13 | |
1221 Surf *v9; // edi@13 | |
1222 double v10; // st6@13 | |
1223 double v11; // st7@14 | |
1224 signed __int64 v12; // qax@14 | |
1225 stru148 *v13; // eax@15 | |
1226 Span *v14; // ecx@17 | |
1227 double v15; // st7@28 | |
1228 signed __int64 v16; // qax@28 | |
1229 stru148 *v17; // eax@29 | |
1230 Span *v18; // ecx@31 | |
1231 Edge *i; // eax@40 | |
1232 Edge *v20; // ecx@43 | |
1233 Edge *v21; // esi@44 | |
1234 double v22; // st7@45 | |
1235 Edge *v23; // edx@48 | |
1236 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1237 float v25; // [sp+14h] [bp-Ch]@3 | |
1238 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1239 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1240 | |
1241 v0 = pSpans; | |
1242 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1243 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1244 stru_80C9A4.pSurf = &stru_80C980; |
1245 stru_80C980.pPrev = &stru_80C980; | |
1246 stru_80C980.pNext = &stru_80C980; | |
693 | 1247 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1248 stru_80C980.field_8 = 0.0; |
1249 stru_80C980.field_4 = 0.0; | |
1250 stru_80C9D8.pNext = &stru_80C9A4; | |
1251 stru_80C9D8.pPrev = 0; | |
1252 stru_80C9D8.field_8 = 1; | |
1253 stru_80C9A4.pNext = 0; | |
1254 stru_80C9A4.pPrev = &stru_80C9D8; | |
1255 stru_80C9A4.field_8 = 0; | |
1256 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1257 v27 = pViewport->uViewportTL_Y; |
1258 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1259 { |
1260 LABEL_51: | |
1261 v0->field_8 = -1; | |
1262 } | |
1263 else | |
1264 { | |
693 | 1265 v1 = 52 * pViewport->uViewportTL_Y; |
1266 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1267 while ( 1 ) |
1268 { | |
1269 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1270 v3 = &stru_80C9D8; | |
1271 v25 = (double)(signed int)v27; | |
1272 if ( v2 != &defaultEdge ) | |
1273 { | |
1274 do | |
1275 { | |
1276 while ( 1 ) | |
1277 { | |
1278 v4 = v3->pNext; | |
1279 if ( v2->field_0 <= (double)v4->field_0 ) | |
1280 break; | |
1281 v3 = v3->pNext; | |
1282 } | |
1283 v5 = v2->pNext; | |
1284 v2->pNext = v4; | |
1285 v2->pPrev = v3; | |
1286 v3->pNext->pPrev = v2; | |
1287 v3->pNext = v2; | |
1288 v3 = v2; | |
1289 v2 = v5; | |
1290 } | |
1291 while ( v5 != &defaultEdge ); | |
1292 } | |
1293 v6 = stru_80C9D8.pNext; | |
1294 stru_80C980.field_20 = 0; | |
1295 stru_80C980.field_22 = 1; | |
1296 v26 = stru_80C9D8.pNext; | |
1297 if ( stru_80C9D8.pNext ) | |
1298 { | |
1299 while ( 1 ) | |
1300 { | |
1301 v7 = v6->pSurf; | |
1302 if ( v6->field_8 ) | |
1303 { | |
1304 ++v7->field_22; | |
1305 if ( v7->field_22 == 1 ) | |
1306 { | |
1307 v8 = v6->field_0 + 2.0; | |
1308 v9 = stru_80C980.pNext; | |
1309 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1310 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1311 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1312 + stru_80C980.pNext->field_0 ) | |
1313 { | |
1314 do | |
1315 v9 = v9->pNext; | |
1316 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1317 v7->pNext = v9; | |
1318 v7->pPrev = v9->pPrev; | |
1319 v9->pPrev->pNext = v7; | |
1320 v9->pPrev = v7; | |
1321 } | |
1322 else | |
1323 { | |
1324 v11 = v6->field_0 + 0.5; | |
1325 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1326 v0->field_C = v12; | |
1327 if ( (signed __int16)v12 > 0 ) | |
1328 { | |
1329 v0->field_A = v27; | |
1330 v0->field_8 = v9->field_20; | |
1331 v13 = v9->pParent; | |
1332 v0->pParent = v13; | |
1333 if ( v13 ) | |
1334 { | |
1335 if ( v13->prolly_head ) | |
1336 { | |
1337 v14 = v13->prolly_tail; | |
1338 if ( !v14 ) | |
1339 return; | |
1340 v14->pNext = v0; | |
1341 } | |
1342 else | |
1343 { | |
1344 v13->prolly_head = v0; | |
1345 } | |
1346 v13->prolly_tail = v0; | |
1347 } | |
1348 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1349 return; | |
1350 ++v0; | |
1351 ++pOutdoorCamera->uNumSpans; | |
1352 } | |
1353 v6 = v26; | |
1354 v7->field_20 = (signed __int64)v11; | |
1355 v7->pNext = v9; | |
1356 v9->pPrev = v7; | |
1357 stru_80C980.pNext = v7; | |
1358 v7->pPrev = &stru_80C980; | |
1359 } | |
1360 } | |
1361 } | |
1362 else | |
1363 { | |
1364 --v7->field_22; | |
1365 if ( !v7->field_22 ) | |
1366 { | |
1367 if ( stru_80C980.pNext == v7 ) | |
1368 { | |
1369 v15 = v6->field_0 + 0.5; | |
1370 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1371 v0->field_C = v16; | |
1372 if ( (signed __int16)v16 > 0 ) | |
1373 { | |
1374 v0->field_A = v27; | |
1375 v0->field_8 = v7->field_20; | |
1376 v17 = v7->pParent; | |
1377 v0->pParent = v17; | |
1378 if ( v17 ) | |
1379 { | |
1380 if ( v17->prolly_head ) | |
1381 { | |
1382 v18 = v17->prolly_tail; | |
1383 if ( !v18 ) | |
1384 return; | |
1385 v18->pNext = v0; | |
1386 } | |
1387 else | |
1388 { | |
1389 v17->prolly_head = v0; | |
1390 } | |
1391 v17->prolly_tail = v0; | |
1392 } | |
1393 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1394 return; | |
1395 ++v0; | |
1396 ++pOutdoorCamera->uNumSpans; | |
1397 } | |
1398 v7->pNext->field_20 = (signed __int64)v15; | |
1399 v6 = v26; | |
1400 } | |
1401 v7->pNext->pPrev = v7->pPrev; | |
1402 v7->pPrev->pNext = v7->pNext; | |
1403 } | |
1404 } | |
1405 v26 = v6->pNext; | |
1406 if ( !v26 ) | |
1407 break; | |
1408 v6 = v6->pNext; | |
1409 } | |
1410 } | |
1411 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1412 { | |
1413 i->pPrev->pNext = i->pNext; | |
1414 i->pNext->pPrev = i->pPrev; | |
1415 } | |
1416 v20 = stru_80C9D8.pNext; | |
1417 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1418 break; | |
1419 LABEL_50: | |
1420 ++v27; | |
1421 v1 = v24 + 52; | |
1422 v24 += 52; | |
693 | 1423 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1424 goto LABEL_51; |
1425 } | |
1426 while ( 1 ) | |
1427 { | |
1428 v21 = v20->pNext; | |
1429 if ( !v21 ) | |
1430 break; | |
1431 v22 = v20->field_4 + v20->field_0; | |
1432 v20->field_0 = v22; | |
1433 if ( v22 < stru_80C9D8.field_0 ) | |
1434 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1435 while ( 1 ) | |
1436 { | |
1437 v23 = v20->pPrev; | |
1438 if ( v20->field_0 >= (double)v23->field_0 ) | |
1439 break; | |
1440 v23->pNext = v20->pNext; | |
1441 v20->pNext->pPrev = v23; | |
1442 v23->pPrev->pNext = v20; | |
1443 v20->pPrev = v23->pPrev; | |
1444 v20->pNext = v23; | |
1445 v23->pPrev = v20; | |
1446 } | |
1447 v20 = v21; | |
1448 if ( v21 == &stru_80C9A4 ) | |
1449 goto LABEL_50; | |
1450 } | |
1451 } | |
1452 } | |
1453 // 4EC3EC: using guessed type Edge defaultEdge; | |
1454 | |
1455 | |
1456 | |
1457 //----- (00487355) -------------------------------------------------------- | |
1458 bool OutdoorCamera::_487355() | |
1459 { | |
1460 int v0; // esi@1 | |
1461 stru148 *v1; // edi@2 | |
1462 bool result; // eax@3 | |
1463 | |
1464 v0 = 0; | |
1465 if ( pOutdoorCamera->numStru148s > 0 ) | |
1466 { | |
1467 v1 = array_77EC08; | |
1468 do | |
1469 { | |
1470 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1471 ++v0; | |
1472 ++v1; | |
1473 } | |
1474 while ( v0 < pOutdoorCamera->numStru148s ); | |
1475 } | |
1476 return result; | |
1477 } | |
1478 | |
1479 | |
1480 | |
1481 //----- (00487DA9) -------------------------------------------------------- | |
1482 void __cdecl sub_487DA9() | |
1483 { | |
1484 char *v0; // eax@1 | |
1485 | |
1486 v0 = &array_77EC08[0].field_108; | |
1487 do | |
1488 { | |
1489 *v0 = 0; | |
1490 v0 += 268; | |
1491 } | |
1492 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1493 } | |
1494 | |
1495 //----- (00487DBE) -------------------------------------------------------- | |
1496 void Software_ResetNewEdges() | |
1497 { | |
1498 int v0; // ecx@1 | |
1499 Edge **v1; // eax@1 | |
1500 signed int v2; // eax@3 | |
1501 | |
1502 v0 = 0; | |
1503 v1 = ptr_80CA10; | |
1504 do | |
1505 { | |
1506 ++v0; | |
1507 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1508 *v1 = 0; | |
1509 ++v1; | |
1510 } | |
1511 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1512 v2 = 2000; | |
1513 do | |
1514 { | |
1515 pSurfs->field_22 = 0; | |
1516 --v2; | |
1517 } | |
1518 while ( v2 ); | |
1519 } | |
1520 // 4EC3EC: using guessed type Edge defaultEdge; | |
1521 | |
1522 | |
1523 | |
1524 | |
1525 | |
1526 //----- (0048958E) -------------------------------------------------------- | |
1527 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1528 { | |
1529 stru12_MemoryBlock *v2; // esi@1 | |
1530 void *v3; // eax@1 | |
1531 void *v4; // ecx@1 | |
1532 stru12_MemoryBlock *result; // eax@1 | |
1533 | |
1534 v2 = this; | |
1535 v3 = operator new(8 * a2 + 16); | |
1536 v2->pBlockBase = v3; | |
1537 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
1538 result = v2; | |
1539 v2->pAlignedBlock = v4; | |
1540 } | |
1541 | |
1542 //----- (004895B7) -------------------------------------------------------- | |
1543 stru12::stru12(stru11 *pStru11) | |
1544 { | |
1545 stru12 *v2; // esi@1 | |
1546 | |
1547 v2 = this; | |
1548 this->field_44 = 0x41000000u; | |
1549 this->field_4C = 0x46000000u; | |
1550 //this->vdestructor_ptr = stru12::_4898E6; | |
1551 this->field_48 = 0; | |
1552 this->field_50 = 0; | |
1553 this->field_54 = 0x33D6BF95u; | |
1554 this->field_58 = 0; | |
1555 | |
1556 for (int i = 0; i < 12; ++i) | |
1557 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1558 /* | |
1559 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1560 if ( v3 ) | |
1561 v4 = AllocAlignedMem(v3, 640); | |
1562 else | |
1563 v4 = 0; | |
1564 v2->pMemBlocks[0] = v4; | |
1565 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1566 if ( v5 ) | |
1567 v6 = AllocAlignedMem(v5, 640); | |
1568 else | |
1569 v6 = 0; | |
1570 v2->pMemBlocks[1] = v6; | |
1571 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1572 if ( v7 ) | |
1573 v8 = AllocAlignedMem(v7, 640); | |
1574 else | |
1575 v8 = 0; | |
1576 v2->pMemBlocks[2] = v8; | |
1577 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1578 if ( v9 ) | |
1579 v10 = AllocAlignedMem(v9, 640); | |
1580 else | |
1581 v10 = 0; | |
1582 v2->pMemBlocks[3] = v10; | |
1583 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1584 if ( v11 ) | |
1585 v12 = AllocAlignedMem(v11, 640); | |
1586 else | |
1587 v12 = 0; | |
1588 v2->pMemBlocks[4] = v12; | |
1589 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1590 if ( v13 ) | |
1591 v14 = AllocAlignedMem(v13, 640); | |
1592 else | |
1593 v14 = 0; | |
1594 v2->pMemBlocks[5] = v14; | |
1595 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1596 if ( v15 ) | |
1597 v16 = AllocAlignedMem(v15, 640); | |
1598 else | |
1599 v16 = 0; | |
1600 v2->pMemBlocks[6] = v16; | |
1601 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1602 if ( v17 ) | |
1603 v18 = AllocAlignedMem(v17, 640); | |
1604 else | |
1605 v18 = 0; | |
1606 v2->pMemBlocks[7] = v18; | |
1607 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1608 if ( v19 ) | |
1609 v20 = AllocAlignedMem(v19, 640); | |
1610 else | |
1611 v20 = 0; | |
1612 v2->pMemBlocks[8] = v20; | |
1613 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1614 if ( v21 ) | |
1615 v22 = AllocAlignedMem(v21, 640); | |
1616 else | |
1617 v22 = 0; | |
1618 v2->pMemBlocks[9] = v22; | |
1619 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1620 if ( v23 ) | |
1621 v24 = AllocAlignedMem(v23, 640); | |
1622 else | |
1623 v24 = 0; | |
1624 v2->pMemBlocks[10] = v24; | |
1625 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1626 if ( v25 ) | |
1627 v26 = AllocAlignedMem(v25, 640); | |
1628 else | |
1629 v26 = 0; | |
1630 v2->field_8C = 0; | |
1631 v2->pMemBlocks[11] = v26;*/ | |
1632 } | |
1633 | |
1634 //----- (00489810) -------------------------------------------------------- | |
1635 stru12::~stru12() | |
1636 { | |
1637 for (int i = 0; i < 12; ++i) | |
1638 delete pMemBlocks[i]; | |
1639 /*if ( v2 ) | |
1640 stru12_MemoryBlock::dtor(v2, 1); | |
1641 v3 = v1->pMemBlocks[1]; | |
1642 if ( v3 ) | |
1643 stru12_MemoryBlock::dtor(v3, 1); | |
1644 v4 = v1->pMemBlocks[2]; | |
1645 if ( v4 ) | |
1646 stru12_MemoryBlock::dtor(v4, 1); | |
1647 v5 = v1->pMemBlocks[3]; | |
1648 if ( v5 ) | |
1649 stru12_MemoryBlock::dtor(v5, 1); | |
1650 v6 = v1->pMemBlocks[4]; | |
1651 if ( v6 ) | |
1652 stru12_MemoryBlock::dtor(v6, 1); | |
1653 v7 = v1->pMemBlocks[5]; | |
1654 if ( v7 ) | |
1655 stru12_MemoryBlock::dtor(v7, 1); | |
1656 v8 = v1->pMemBlocks[6]; | |
1657 if ( v8 ) | |
1658 stru12_MemoryBlock::dtor(v8, 1); | |
1659 v9 = v1->pMemBlocks[7]; | |
1660 if ( v9 ) | |
1661 stru12_MemoryBlock::dtor(v9, 1); | |
1662 v10 = v1->pMemBlocks[8]; | |
1663 if ( v10 ) | |
1664 stru12_MemoryBlock::dtor(v10, 1); | |
1665 v11 = v1->pMemBlocks[9]; | |
1666 if ( v11 ) | |
1667 stru12_MemoryBlock::dtor(v11, 1); | |
1668 v12 = v1->pMemBlocks[10]; | |
1669 if ( v12 ) | |
1670 stru12_MemoryBlock::dtor(v12, 1); | |
1671 v13 = v1->pMemBlocks[11]; | |
1672 if ( v13 ) | |
1673 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1674 } | |
1675 | |
1676 //----- (004898BF) -------------------------------------------------------- | |
1677 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1678 { | |
1679 stru12_MemoryBlock *v2; // esi@1 | |
1680 void *v3; // ST00_4@1 | |
1681 | |
1682 v2 = this; | |
1683 v3 = this->pBlockBase; | |
1684 this->pAlignedBlock = 0; | |
1685 free(v3); | |
1686 v2->pBlockBase = 0; | |
1687 /*if ( a2 & 1 ) | |
1688 free(v2);*/ | |
1689 } | |
1690 | |
1691 //----- (004898E6) -------------------------------------------------------- | |
1692 void stru12::_4898E6() | |
1693 { | |
1694 void *v1; // eax@1 | |
1695 void *v2; // edx@1 | |
1696 char *v3; // edi@2 | |
1697 double v4; // st7@2 | |
1698 char *v5; // ebx@2 | |
1699 double v6; // st6@3 | |
1700 double v7; // st5@3 | |
1701 double v8; // st4@3 | |
1702 int v9; // esi@3 | |
1703 double v10; // st3@3 | |
1704 float v11; // ST34_4@5 | |
1705 double v12; // st6@10 | |
1706 double v13; // ST0C_8@10 | |
1707 char *v14; // [sp+14h] [bp-44h]@2 | |
1708 char *v15; // [sp+18h] [bp-40h]@2 | |
1709 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1710 char *v17; // [sp+20h] [bp-38h]@2 | |
1711 char *v18; // [sp+24h] [bp-34h]@2 | |
1712 float v19; // [sp+30h] [bp-28h]@3 | |
1713 float v20; // [sp+38h] [bp-20h]@3 | |
1714 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1715 int v22; // [sp+40h] [bp-18h]@1 | |
1716 char *v23; // [sp+44h] [bp-14h]@2 | |
1717 char *v24; // [sp+48h] [bp-10h]@2 | |
1718 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1719 float v26; // [sp+50h] [bp-8h]@3 | |
1720 float v27; // [sp+54h] [bp-4h]@3 | |
1721 | |
731 | 1722 __debugbreak(); |
0 | 1723 v22 = 0; |
1724 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1725 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1726 if ( this->field_8C > 0 ) | |
1727 { | |
1728 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1729 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1730 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1731 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1732 v25 = (int)v1 - (int)v2; | |
1733 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1734 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1735 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1736 v4 = 1.0; | |
1737 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1738 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1739 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1740 do | |
1741 { | |
1742 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1743 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1744 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1745 v7 = pIndoorCamera->fRotationYCosine; | |
1746 v8 = pIndoorCamera->fRotationYSine; | |
1747 v20 = pIndoorCamera->fRotationXCosine; | |
1748 v19 = pIndoorCamera->fRotationXSine; | |
1749 v9 = (int)((char *)v2 + (int)v21); | |
1750 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1751 if ( pIndoorCamera->sRotationX ) | |
1752 { | |
1753 v11 = v10; | |
1754 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1755 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1756 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1757 } | |
1758 else | |
1759 { | |
1760 *(float *)v9 = v10; | |
1761 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1762 *(float *)((char *)v2 + (int)v5) = v6; | |
1763 } | |
1764 if ( *(float *)v9 >= 8.0 ) | |
1765 { | |
1766 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1767 { | |
1768 *(int *)v2 = 0; | |
1769 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1770 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1771 - v12 * *(float *)((char *)v2 + (int)v3); | |
1772 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1773 - v12 * *(float *)((char *)v2 + (int)v5); | |
1774 *(float *)((char *)v2 + (int)v16) = v4 | |
1775 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1776 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1777 v13 = *(float *)v9 + 6.7553994e15; | |
1778 v4 = 1.0; | |
1779 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1780 } | |
1781 else | |
1782 { | |
1783 *(int *)v2 = 2; | |
1784 } | |
1785 } | |
1786 else | |
1787 { | |
1788 *(int *)v2 = 1; | |
1789 } | |
1790 ++v22; | |
1791 v2 = (char *)v2 + 4; | |
1792 } | |
1793 while ( v22 < this->field_8C ); | |
1794 } | |
1795 this->field_8C = 0; | |
1796 } | |
1797 | |
1798 | |
1799 | |
1800 | |
1801 | |
1802 //----- (0048A959) -------------------------------------------------------- | |
1803 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1804 { | |
1805 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1806 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1807 b = (uColor & 0x000000FF) / 255.0f; | |
1808 | |
1809 float h, s, v; | |
1810 RGB2HSV(&h, &s, r, g, b, &v); | |
1811 | |
1812 if ( h_replace != -1.0 ) | |
1813 h = h_replace; | |
1814 if ( s_replace != -1.0 ) | |
1815 s = s_replace; | |
1816 if ( v_replace != -1.0 ) | |
1817 v = v_replace; | |
1818 HSV2RGB(&r, &g, &b, h, s, v); | |
1819 | |
1820 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1821 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1822 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1823 } | |
1824 | |
1825 | |
1826 //----- (0048B561) -------------------------------------------------------- | |
1827 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1828 { | |
1829 //v2 = a2 - 0.5; | |
1830 //v3 = v2 + 6.7553994e15; | |
1831 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1832 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1833 //v5 = v7 + 6.7553994e15; | |
1834 //return LODWORD(v5) | (v4 << 16); | |
1835 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1836 return v5 | (v4 << 16); | |
1837 } | |
1838 | |
1839 | |
1840 | |
1841 | |
1842 | |
1843 | |
1844 //----- (00491E3A) -------------------------------------------------------- | |
1845 void __cdecl sub_491E3A() | |
1846 { | |
1847 Player *v0; // ebx@1 | |
1848 signed int v1; // esi@3 | |
1849 char *v2; // eax@4 | |
1850 unsigned int v3; // eax@7 | |
1851 unsigned int v4; // edx@8 | |
1852 char *v5; // ecx@9 | |
1853 int v6; // edi@17 | |
1854 Texture *v7; // ebx@18 | |
1855 struct IDirect3DTexture2 **v8; // eax@19 | |
1856 struct IDirect3DTexture2 *v9; // eax@20 | |
1857 struct IDirectDrawSurface **v10; // eax@22 | |
1858 struct IDirectDrawSurface *v11; // eax@23 | |
1859 int v12; // eax@26 | |
1860 | |
1861 v0 = pParty->pPlayers; | |
1862 do | |
1863 { | |
203 | 1864 if (SoundSetAction[24][0]) |
0 | 1865 { |
1866 v1 = 0; | |
764 | 1867 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1868 { |
1869 LABEL_7: | |
1870 v3 = 0; | |
1871 } | |
1872 else | |
1873 { | |
1874 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1875 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1876 { |
1877 ++v1; | |
1878 v2 += 120; | |
764 | 1879 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1880 goto LABEL_7; |
1881 } | |
1882 v3 = v1; | |
1883 } | |
764 | 1884 pSoundList->UnloadSound(v3, 1); |
0 | 1885 v4 = 0; |
764 | 1886 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1887 { |
1888 LABEL_12: | |
1889 v4 = 0; | |
1890 } | |
1891 else | |
1892 { | |
1893 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1894 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1895 { |
1896 ++v4; | |
1897 v5 += 120; | |
764 | 1898 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1899 goto LABEL_12; |
1900 } | |
1901 } | |
764 | 1902 pSoundList->UnloadSound(v4, 1); |
0 | 1903 } |
1904 ++v0; | |
1905 } | |
1906 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1907 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1908 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1909 { |
1910 v7 = &pIcons_LOD->pTextures[v6]; | |
1911 do | |
1912 { | |
1913 v7->Release(); | |
1914 v8 = pIcons_LOD->pHardwareTextures; | |
1915 if ( v8 ) | |
1916 { | |
1917 v9 = v8[v6]; | |
1918 if ( v9 ) | |
1919 { | |
1920 v9->Release(); | |
1921 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1922 } | |
1923 } | |
1924 v10 = pIcons_LOD->pHardwareSurfaces; | |
1925 if ( v10 ) | |
1926 { | |
1927 v11 = v10[v6]; | |
1928 if ( v11 ) | |
1929 { | |
1930 v11->Release(); | |
1931 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1932 } | |
1933 } | |
1934 --v6; | |
1935 --v7; | |
1936 } | |
33 | 1937 while ( v6 >= pIcons_LOD->pFacesLock ); |
1938 } | |
1939 v12 = pIcons_LOD->pFacesLock; | |
1940 pIcons_LOD->pFacesLock = 0; | |
0 | 1941 pIcons_LOD->uNumLoadedFiles = v12; |
1942 } | |
1943 // 4ED498: using guessed type char byte_4ED498; | |
1944 | |
706 | 1945 |
0 | 1946 |
1947 | |
1948 //----- (0049387A) -------------------------------------------------------- | |
1949 int CycleCharacter(unsigned int _this) | |
1950 { | |
1951 signed int result; // eax@1 | |
1952 signed int v2; // ecx@2 | |
1953 signed int v3; // ecx@8 | |
1954 | |
1955 result = uActiveCharacter; | |
1956 if ( _this ) | |
1957 { | |
1958 v2 = 0; | |
1959 while ( 1 ) | |
1960 { | |
1961 --result; | |
1962 if ( result < 1 ) | |
1963 result = 4; | |
1964 if ( !pPlayers[result]->uTimeToRecovery ) | |
1965 break; | |
1966 ++v2; | |
1967 if ( v2 >= 4 ) | |
1968 return uActiveCharacter; | |
1969 } | |
1970 } | |
1971 else | |
1972 { | |
1973 v3 = 0; | |
1974 while ( 1 ) | |
1975 { | |
1976 ++result; | |
1977 if ( result > 4 ) | |
1978 result = 1; | |
1979 if ( !pPlayers[result]->uTimeToRecovery ) | |
1980 break; | |
1981 ++v3; | |
1982 if ( v3 >= 4 ) | |
1983 return uActiveCharacter; | |
1984 } | |
1985 } | |
1986 return result; | |
1987 } | |
1988 | |
1989 //----- (004938D1) -------------------------------------------------------- | |
1990 void __fastcall Rest(unsigned int uHoursToSleep) | |
1991 { | |
1992 unsigned int v1; // esi@1 | |
1993 double v2; // st7@3 | |
1994 Player **v3; // esi@3 | |
1995 | |
1996 v1 = uHoursToSleep; | |
1997 if ( uHoursToSleep > 240 ) | |
1998 InitializeActors(); | |
1999 v2 = (double)(7680 * v1) * 0.033333335; | |
2000 pParty->uTimePlayed += (signed __int64)v2; | |
2001 v3 = &pPlayers[1]; | |
2002 do | |
2003 { | |
2004 (*v3)->Recover((signed __int64)v2); | |
2005 ++v3; | |
2006 } | |
2007 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
2008 _494035_timed_effects__water_walking_damage__etc(); | |
2009 } | |
2010 | |
2011 //----- (00493938) -------------------------------------------------------- | |
2012 int __cdecl _493938_regenerate() | |
2013 { | |
2014 int v0; // edi@1 | |
2015 signed __int64 v1; // qax@1 | |
2016 int v2; // ecx@1 | |
2017 int result; // eax@1 | |
2018 int v4; // eax@2 | |
2019 int v5; // edi@5 | |
112 | 2020 int *v6; // ecx@5 |
0 | 2021 char v7; // sf@5 |
112 | 2022 int *v8; // ecx@10 |
0 | 2023 int v9; // edi@15 |
2024 signed int v10; // eax@15 | |
2025 __int16 *v11; // edx@16 | |
2026 int v12; // eax@20 | |
2027 int v13; // ebx@20 | |
2028 unsigned int *v14; // esi@21 | |
2029 unsigned int v15; // ecx@21 | |
2030 unsigned int v16; // eax@21 | |
2031 int v17; // edx@21 | |
2032 int v18; // eax@21 | |
2033 signed int v19; // eax@21 | |
2034 signed int v20; // ebx@25 | |
2035 Player *v21; // esi@25 | |
2036 ITEM_EQUIP_TYPE v22; // edi@30 | |
2037 //int v23; // edx@31 | |
2038 signed int v24; // ecx@32 | |
2039 signed int v25; // eax@33 | |
2040 int v26; // eax@35 | |
2041 int v27; // eax@36 | |
2042 int v28; // eax@37 | |
2043 int v29; // eax@40 | |
2044 int v30; // eax@41 | |
2045 signed int v31; // ecx@53 | |
2046 char *v32; // eax@53 | |
2047 char *v33; // edi@82 | |
2048 int v34; // ecx@88 | |
2049 int v35; // eax@88 | |
2050 char *v36; // edi@99 | |
2051 int v37; // edi@104 | |
2052 int v38; // edi@106 | |
2053 int v39; // edi@111 | |
2054 int v40; // ecx@113 | |
2055 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
|
2056 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2057 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2058 int v44; // [sp+210h] [bp-20h]@22 | |
2059 int v45; // [sp+214h] [bp-1Ch]@25 | |
2060 int v46; // [sp+218h] [bp-18h]@25 | |
2061 int v47; // [sp+21Ch] [bp-14h]@25 | |
2062 int v48; // [sp+220h] [bp-10h]@25 | |
2063 int v49; // [sp+224h] [bp-Ch]@24 | |
2064 int v50; // [sp+228h] [bp-8h]@25 | |
2065 int v51; // [sp+22Ch] [bp-4h]@2 | |
2066 | |
2067 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2068 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2069 v2 = (signed int)v1 / 60; | |
2070 result = (signed int)v1 / 60 + 5; | |
2071 if ( v0 >= result ) | |
2072 { | |
2073 v51 = 0; | |
2074 v4 = (v0 - v2) / 5; | |
2075 if (pParty->FlyActive()) | |
2076 { | |
2077 if ( pParty->bFlying ) | |
2078 { | |
569 | 2079 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2080 { // colliding with something in the air - fall down | |
2081 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2082 //__debugbreak(); | |
2083 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2084 v7 = *v6 < v5; |
2085 *v6 -= v5; | |
0 | 2086 if ( v7 ) |
2087 { | |
112 | 2088 *v6 = 0; |
0 | 2089 pParty->uFlags &= 0xFFFFFFBFu; |
2090 pParty->bFlying = 0; | |
2091 v51 = 1; | |
2092 } | |
2093 } | |
2094 } | |
2095 } | |
569 | 2096 |
0 | 2097 if (pParty->WaterWalkActive()) |
2098 { | |
569 | 2099 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2100 { | |
2101 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2102 { // taking on water | |
2103 //__debugbreak(); | |
2104 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2105 v7 = *v8 < v4; |
2106 *v8 -= v4; | |
0 | 2107 if ( v7 ) |
2108 { | |
112 | 2109 *v8 = 0; |
569 | 2110 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2111 v51 = 1; |
2112 } | |
2113 } | |
2114 } | |
2115 } | |
569 | 2116 |
0 | 2117 if (pParty->ImmolationActive()) |
2118 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2119 //SpriteObject::SpriteObject(&a1); |
0 | 2120 v9 = 0; |
2121 a3.z = 0; | |
2122 a3.y = 0; | |
2123 a3.x = 0; | |
2124 a1.stru_24.Reset(); | |
2125 a1.field_4C = pParty->pPartyBuffs[10].uPower; | |
2126 a1.field_50 = pParty->ImmolationSkillLevel(); | |
2127 v10 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2128 a1.uType = 1070; |
0 | 2129 a1.field_48 = 8; |
2130 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2131 { | |
2132 LABEL_19: | |
2133 LOWORD(v10) = 0; | |
2134 } | |
2135 else | |
2136 { | |
2137 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2138 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2139 { |
2140 ++v10; | |
2141 v11 += 28; | |
2142 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2143 goto LABEL_19; | |
2144 } | |
2145 } | |
2146 a1.uObjectDescID = v10; | |
2147 a1.field_60_distance_related_prolly_lod = 0; | |
2148 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2149 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2150 a1.uAttributes = 0; |
2151 a1.uSectorID = 0; | |
2152 a1.uSpriteFrameID = 0; | |
303 | 2153 a1.field_58_pid = v12; |
0 | 2154 a1.uFacing = 0; |
2155 a1.uSoundID = 0; | |
2156 v13 = sub_46A89E((int)v41, 100, 307); | |
2157 if ( v13 > 0 ) | |
2158 { | |
2159 do | |
2160 { | |
2161 v14 = (unsigned int *)&v41[4 * v9]; | |
2162 v15 = *v14; | |
2163 v16 = *v14; | |
2164 a1.vPosition.x = pActors[v16].vPosition.x; | |
2165 v17 = pActors[v16].vPosition.y; | |
2166 a1.vPosition.z = pActors[v16].vPosition.z; | |
2167 v18 = 8 * v15; | |
2168 LOBYTE(v18) = 8 * v15 | 3; | |
2169 a1.vPosition.y = v17; | |
2170 a1.field_5C = v18; | |
2171 v19 = a1.Create(0, 0, 0, 0); | |
2172 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
2173 ++v9; | |
2174 } | |
2175 while ( v9 < v13 ); | |
2176 } | |
2177 } | |
2178 v44 = 0; | |
248 | 2179 if (PartyHasDragon()) |
0 | 2180 v44 = 1; |
2181 v49 = 0; | |
2182 LABEL_25: | |
2183 v20 = 0; | |
2184 v21 = &pParty->pPlayers[v49]; | |
2185 v50 = 0; | |
2186 v47 = 0; | |
2187 v45 = 0; | |
2188 v48 = 0; | |
2189 v46 = 0; | |
255 | 2190 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2191 v50 = 1; |
135 | 2192 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2193 v48 = 1; |
2194 v22 = (ITEM_EQUIP_TYPE)0; | |
2195 while ( 1 ) | |
2196 { | |
2197 if ( v21->HasItemEquipped(v22) ) | |
2198 { | |
2199 //v23 = v21->pEquipment.pIndices; | |
2200 auto _idx = v21->pEquipment.pIndices[v22]; | |
2201 v24 = v21->pInventoryItems[_idx].uItemID; | |
2202 if ( v24 > 134 ) | |
2203 { | |
2204 if ( v24 == 529 ) | |
2205 goto LABEL_43; | |
2206 if ( v24 == 535 ) | |
2207 goto LABEL_44; | |
2208 if ( v24 == 515 ) | |
2209 { | |
2210 v47 = 1; | |
2211 } | |
2212 else | |
2213 { | |
2214 if ( v24 == 532 ) | |
2215 goto LABEL_50; | |
2216 } | |
2217 } | |
2218 else | |
2219 { | |
377 | 2220 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2221 if ( v25 <= 50 ) |
2222 { | |
2223 if ( v25 != 50 ) | |
2224 { | |
2225 v26 = v25 - 37; | |
2226 if ( v26 ) | |
2227 { | |
2228 v27 = v26 - 1; | |
2229 if ( !v27 ) | |
2230 goto LABEL_50; | |
2231 v28 = v27 - 6; | |
2232 if ( v28 ) | |
2233 { | |
2234 if ( v28 != 3 ) | |
2235 goto LABEL_51; | |
2236 LABEL_50: | |
2237 v50 = 1; | |
2238 goto LABEL_51; | |
2239 } | |
2240 } | |
2241 } | |
2242 LABEL_44: | |
2243 v20 = 1; | |
2244 goto LABEL_51; | |
2245 } | |
2246 v29 = v25 - 54; | |
2247 if ( !v29 ) | |
2248 goto LABEL_44; | |
2249 v30 = v29 - 1; | |
2250 if ( !v30 ) | |
2251 goto LABEL_50; | |
2252 if ( v30 == 11 ) | |
2253 { | |
2254 LABEL_43: | |
2255 v20 = 1; | |
2256 v50 = 1; | |
2257 goto LABEL_51; | |
2258 } | |
2259 } | |
2260 } | |
2261 LABEL_51: | |
2262 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2263 if ( (signed int)v22 >= 16 ) | |
2264 { | |
2265 if ( v48 ) | |
2266 { | |
2267 v31 = 0; | |
2268 v32 = (char *)v21->pInventoryItems; | |
2269 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2270 { | |
2271 ++v31; | |
2272 v32 += 36; | |
2273 if ( v31 >= 138 ) | |
2274 goto LABEL_59; | |
2275 } | |
2276 v48 = 0; | |
2277 v45 = 1; | |
2278 } | |
2279 LABEL_59: | |
2280 if ( v21->pConditions[17] ) | |
2281 v46 = 1; | |
2282 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2283 { | |
2284 ++v21->sHealth; | |
2285 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2286 v21->sHealth = v21->GetMaxHealth(); | |
2287 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2288 { | |
2289 LODWORD(v21->pConditions[13]) = 0; | |
2290 HIDWORD(v21->pConditions[13]) = 0; | |
2291 } | |
2292 v51 = 1; | |
2293 } | |
2294 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2295 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2296 && !v21->pConditions[14] | |
2297 && !v21->pConditions[16] ) | |
2298 { | |
2299 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2300 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2301 v21->sHealth = v21->GetMaxHealth(); | |
2302 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2303 { | |
2304 LODWORD(v21->pConditions[13]) = 0; | |
2305 HIDWORD(v21->pConditions[13]) = 0; | |
2306 } | |
2307 v51 = 1; | |
2308 } | |
2309 if ( v50 ) | |
2310 { | |
2311 v33 = (char *)&v21->sMana; | |
2312 ++*(int *)v33; | |
2313 if ( v21->sMana > v21->GetMaxMana() ) | |
2314 *(int *)v33 = v21->GetMaxMana(); | |
2315 v51 = 1; | |
2316 } | |
2317 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2318 { | |
2319 v34 = LODWORD(v21->pConditions[13]); | |
2320 --v21->sHealth; | |
2321 v35 = v21->sHealth; | |
2322 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2323 v21->pConditions[13] = pParty->uTimePlayed; | |
2324 if ( v35 < 1 ) | |
2325 { | |
2326 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2327 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2328 { | |
2329 v21->pConditions[13] = pParty->uTimePlayed; | |
2330 } | |
2331 else | |
2332 { | |
2333 if ( !v21->pConditions[14] ) | |
2334 v21->pConditions[14] = pParty->uTimePlayed; | |
2335 } | |
2336 } | |
2337 v51 = 1; | |
2338 } | |
2339 if ( v45 ) | |
2340 { | |
2341 v36 = (char *)&v21->sMana; | |
2342 ++*(int *)v36; | |
2343 if ( v21->sMana > v21->GetMaxMana() ) | |
2344 *(int *)v36 = v21->GetMaxMana(); | |
2345 } | |
2346 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2347 { | |
2348 v37 = v21->sHealth; | |
2349 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2350 v21->sHealth = v37 - 2; | |
2351 v38 = v21->sMana; | |
2352 if ( v38 > v21->GetMaxMana() / 2 ) | |
2353 v21->sMana = v38 - 2; | |
2354 } | |
2355 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2356 { | |
2357 v39 = v21->sHealth; | |
2358 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2359 v21->sHealth = v39 - 1; | |
2360 v40 = v21->sMana; | |
2361 if ( v40 > 0 ) | |
2362 v21->sMana = v40 - 1; | |
2363 } | |
2364 ++v49; | |
2365 if ( v49 >= 4 ) | |
2366 { | |
2367 result = HIDWORD(pParty->uTimePlayed); | |
2368 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2369 if ( !viewparams->bRedrawGameUI ) | |
2370 { | |
2371 result = v51; | |
2372 viewparams->bRedrawGameUI = v51; | |
2373 } | |
2374 return result; | |
2375 } | |
2376 goto LABEL_25; | |
2377 } | |
2378 } | |
2379 } | |
2380 return result; | |
2381 } | |
2382 | |
2383 | |
2384 | |
2385 //----- (00493F79) -------------------------------------------------------- | |
351 | 2386 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2387 { |
2388 signed __int64 v2; // ST2C_8@1 | |
2389 signed __int64 v3; // qax@1 | |
351 | 2390 //signed __int64 v4; // ST1C_8@1 |
0 | 2391 unsigned __int64 v5; // qax@1 |
2392 unsigned int v6; // ebx@1 | |
2393 | |
2394 v2 = (signed __int64)((double)a2 * 0.234375); | |
2395 v3 = v2 / 60 / 60; | |
351 | 2396 //v4 = v3; |
0 | 2397 v5 = (unsigned int)v3 / 0x18; |
2398 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2399 _this->field_0_expire_second = v2 % 60; |
2400 _this->field_4_expire_minute = v2 / 60 % 60; | |
2401 _this->field_8_expire_hour = v3 % 24; | |
2402 _this->field_10_expire_week = v5 / 7 & 3; | |
2403 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2404 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2405 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2406 } |
2407 | |
2408 | |
2409 | |
2410 | |
2411 | |
2412 //----- (00494035) -------------------------------------------------------- | |
2413 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2414 { | |
2415 signed __int64 v0; // qax@1 | |
2416 signed __int64 v1; // ST30_8@1 | |
2417 signed __int64 v2; // ST38_8@1 | |
2418 unsigned __int64 v3; // qax@1 | |
2419 unsigned int v4; // edi@1 | |
2420 //signed int v5; // eax@4 | |
2421 //char *v6; // ecx@5 | |
2422 //Player *v7; // esi@8 | |
2423 //char *v8; // ecx@12 | |
2424 Player *pPlayer; // esi@15 | |
2425 //void *v10; // esi@25 | |
2426 unsigned int v11; // ecx@27 | |
2427 signed int v12; // edi@29 | |
2428 Player *v13; // ecx@30 | |
2429 Player *v14; // esi@35 | |
2430 double v15; // st7@35 | |
2431 Player **v16; // esi@43 | |
2432 Player *v17; // edi@44 | |
2433 double v18; // st7@44 | |
2434 float v19; // ST28_4@48 | |
2435 double v20; // ST38_8@48 | |
2436 Player *v21; // esi@51 | |
2437 signed int v22; // edi@53 | |
2438 int v23; // eax@59 | |
2439 int v24; // ecx@60 | |
2440 int v25; // eax@63 | |
2441 int v26; // ecx@64 | |
2442 int v27; // eax@67 | |
2443 int v28; // ecx@68 | |
2444 int v29; // eax@71 | |
2445 int v30; // ecx@72 | |
2446 int v31; // eax@75 | |
2447 int v32; // ecx@76 | |
2448 int v33; // eax@79 | |
2449 int v34; // ecx@80 | |
2450 int v35; // eax@83 | |
2451 int v36; // ecx@84 | |
2452 int v37; // eax@87 | |
2453 int v38; // ecx@88 | |
2454 int v39; // eax@91 | |
2455 int v40; // ecx@92 | |
2456 int v41; // eax@95 | |
2457 int v42; // ecx@96 | |
2458 bool v43; // ebx@102 | |
2459 //SpellBuff *v44; // edi@104 | |
2460 //signed int v45; // ebp@104 | |
2461 bool v46; // edi@111 | |
2462 //SpellBuff *v47; // esi@113 | |
2463 //Player **v48; // esi@119 | |
2464 //signed int v49; // edi@121 | |
2465 //char *v50; // esi@122 | |
2466 signed int v51; // edx@128 | |
2467 signed int v52; // ecx@130 | |
2468 int v53; // eax@131 | |
2469 Player *v54; // eax@141 | |
2470 unsigned int v55; // [sp-8h] [bp-38h]@18 | |
2471 unsigned int v56; // [sp-8h] [bp-38h]@55 | |
2472 int v57; // [sp-4h] [bp-34h]@18 | |
2473 int v58; // [sp-4h] [bp-34h]@33 | |
2474 int v59; // [sp-4h] [bp-34h]@55 | |
2475 unsigned int v60; // [sp+10h] [bp-20h]@1 | |
2476 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
2477 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
2478 unsigned int a2; // [sp+18h] [bp-18h]@1 | |
2479 signed int a2a; // [sp+18h] [bp-18h]@47 | |
2480 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2481 | |
2482 a2 = pParty->uCurrentHour; | |
2483 v61 = pParty->uDaysPlayed; | |
2484 v60 = pEventTimer->uTimeElapsed; | |
2485 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; | |
2486 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2487 v1 = v0; | |
2488 v0 /= 60i64; | |
2489 v2 = v0; | |
2490 v3 = (unsigned int)v0 / 24; | |
2491 v4 = (unsigned int)(v3 / 7) >> 2; | |
2492 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2493 pParty->uCurrentMinute = v1 % 60; | |
2494 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2495 pParty->uCurrentHour = v2 % 24; | |
2496 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2497 pParty->uCurrentMonth = v4 % 12; | |
352 | 2498 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
0 | 2499 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) |
2500 { | |
2501 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2502 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2503 | |
2504 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2505 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2506 | |
2507 ++pParty->field_764; | |
2508 if ( pParty->field_764 > 1u ) | |
2509 { | |
2510 for (uint i = 0; i < 4; ++i) | |
2511 pParty->pPlayers[i].SetCondition(1, 0); | |
2512 | |
2513 if ( pParty->uNumFoodRations ) | |
2514 { | |
2515 Party::TakeFood(1u); | |
2516 } | |
2517 else | |
2518 { | |
2519 for (uint i = 0; i < 4; ++i) | |
2520 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; | |
2521 } | |
2522 if ( pParty->field_764 > 3u ) | |
2523 { | |
2524 pPlayer = pParty->pPlayers; | |
2525 do | |
2526 { | |
2527 pPlayer->Zero(); | |
2528 if ( !(pPlayer->pConditions[15] | pPlayer->pConditions[16] | pPlayer->pConditions[14]) ) | |
2529 { | |
2530 if ( rand() % 100 < 5 * (unsigned __int8)pParty->field_764 ) | |
2531 { | |
2532 v57 = 0; | |
2533 v55 = 14; | |
2534 LABEL_21: | |
2535 pPlayer->SetCondition(v55, v57); | |
2536 goto LABEL_22; | |
2537 } | |
2538 if ( rand() % 100 < 10 * (unsigned __int8)pParty->field_764 ) | |
2539 { | |
2540 v57 = 0; | |
2541 v55 = 5; | |
2542 goto LABEL_21; | |
2543 } | |
2544 } | |
2545 LABEL_22: | |
2546 ++pPlayer; | |
2547 } | |
2548 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); | |
2549 } | |
2550 } | |
2551 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2552 pOutdoor->SetFog(); | |
2553 | |
2554 for (uint i = 0; i < 4; ++i) | |
2555 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2556 } | |
2557 v11 = LODWORD(pParty->uTimePlayed); | |
2558 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2559 { | |
2560 v12 = 1; | |
2561 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2562 viewparams->bRedrawGameUI = 1; | |
2563 while ( 1 ) | |
2564 { | |
2565 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2566 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2567 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2568 { |
2569 v58 = 0; | |
2570 } | |
2571 else | |
2572 { | |
2573 v58 = 0; | |
2574 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2575 { | |
2576 v14 = pPlayers[v12]; | |
2577 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2578 v14->ReceiveDamage((signed __int64)v15, 0); | |
2579 if ( pParty->uFlags & 4 ) | |
2580 { | |
2581 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[660]); | |
2582 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
2583 } | |
2584 goto LABEL_39; | |
2585 } | |
2586 v13 = pPlayers[v12]; | |
2587 } | |
130 | 2588 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2589 LABEL_39: |
2590 ++v12; | |
2591 if ( v12 > 4 ) | |
2592 { | |
2593 v11 = LODWORD(pParty->uTimePlayed); | |
2594 break; | |
2595 } | |
2596 } | |
2597 } | |
2598 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2599 { | |
2600 viewparams->bRedrawGameUI = 1; | |
2601 pParty->field_6FC = v11 + 128; | |
2602 v16 = &pPlayers[1]; | |
2603 do | |
2604 { | |
2605 v17 = *v16; | |
2606 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2607 v17->ReceiveDamage((signed __int64)v18, 0); | |
2608 if ( pParty->uFlags & 0x200 ) | |
2609 { | |
2610 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[661]); | |
2611 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
2612 } | |
2613 ++v16; | |
2614 } | |
2615 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2616 } | |
2617 _493938_regenerate(); | |
2618 v65 = 4; | |
2619 a2a = v60; | |
2620 if ( pParty->uFlags2 & 2 ) | |
2621 { | |
2622 v19 = (double)(signed int)v60 * 0.5; | |
2623 v20 = v19 + 6.7553994e15; | |
2624 a2a = LODWORD(v20); | |
2625 if ( SLODWORD(v20) <= 0 ) | |
2626 a2a = 1; | |
2627 } | |
2628 v62 = &pPlayers[1]; | |
2629 do | |
2630 { | |
2631 v21 = *v62; | |
2632 if ( (*v62)->uTimeToRecovery ) | |
2633 v21->Recover(a2a); | |
2634 v22 = v21->sHealth; | |
2635 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2636 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2637 { | |
2638 if ( v22 >= 1 ) | |
2639 goto LABEL_59; | |
2640 v59 = 0; | |
2641 v56 = 13; | |
2642 } | |
2643 else | |
2644 { | |
2645 v59 = 0; | |
2646 v56 = 14; | |
2647 } | |
2648 v21->SetCondition(v56, v59); | |
2649 LABEL_59: | |
2650 v23 = (int)&v21->field_E0; | |
2651 if ( v21->field_E0 ) | |
2652 { | |
2653 v24 = *(int *)v23 - v60; | |
2654 if ( v24 > 0 ) | |
2655 { | |
2656 *(int *)v23 = v24; | |
2657 } | |
2658 else | |
2659 { | |
2660 *(int *)v23 = 0; | |
2661 viewparams->bRedrawGameUI = 1; | |
2662 } | |
2663 } | |
2664 v25 = (int)&v21->field_E4; | |
2665 if ( v21->field_E4 ) | |
2666 { | |
2667 v26 = *(int *)v25 - v60; | |
2668 if ( v26 > 0 ) | |
2669 { | |
2670 *(int *)v25 = v26; | |
2671 } | |
2672 else | |
2673 { | |
2674 *(int *)v25 = 0; | |
2675 viewparams->bRedrawGameUI = 1; | |
2676 } | |
2677 } | |
2678 v27 = (int)&v21->field_E8; | |
2679 if ( v21->field_E8 ) | |
2680 { | |
2681 v28 = *(int *)v27 - v60; | |
2682 if ( v28 > 0 ) | |
2683 { | |
2684 *(int *)v27 = v28; | |
2685 } | |
2686 else | |
2687 { | |
2688 *(int *)v27 = 0; | |
2689 viewparams->bRedrawGameUI = 1; | |
2690 } | |
2691 } | |
2692 v29 = (int)&v21->field_EC; | |
2693 if ( v21->field_EC ) | |
2694 { | |
2695 v30 = *(int *)v29 - v60; | |
2696 if ( v30 > 0 ) | |
2697 { | |
2698 *(int *)v29 = v30; | |
2699 } | |
2700 else | |
2701 { | |
2702 *(int *)v29 = 0; | |
2703 viewparams->bRedrawGameUI = 1; | |
2704 } | |
2705 } | |
2706 v31 = (int)&v21->field_F0; | |
2707 if ( v21->field_F0 ) | |
2708 { | |
2709 v32 = *(int *)v31 - v60; | |
2710 if ( v32 > 0 ) | |
2711 { | |
2712 *(int *)v31 = v32; | |
2713 } | |
2714 else | |
2715 { | |
2716 *(int *)v31 = 0; | |
2717 viewparams->bRedrawGameUI = 1; | |
2718 } | |
2719 } | |
2720 v33 = (int)&v21->field_F4; | |
2721 if ( v21->field_F4 ) | |
2722 { | |
2723 v34 = *(int *)v33 - v60; | |
2724 if ( v34 > 0 ) | |
2725 { | |
2726 *(int *)v33 = v34; | |
2727 } | |
2728 else | |
2729 { | |
2730 *(int *)v33 = 0; | |
2731 viewparams->bRedrawGameUI = 1; | |
2732 } | |
2733 } | |
2734 v35 = (int)&v21->field_F8; | |
2735 if ( v21->field_F8 ) | |
2736 { | |
2737 v36 = *(int *)v35 - v60; | |
2738 if ( v36 > 0 ) | |
2739 { | |
2740 *(int *)v35 = v36; | |
2741 } | |
2742 else | |
2743 { | |
2744 *(int *)v35 = 0; | |
2745 viewparams->bRedrawGameUI = 1; | |
2746 } | |
2747 } | |
2748 v37 = (int)&v21->field_FC; | |
2749 if ( v21->field_FC ) | |
2750 { | |
2751 v38 = *(int *)v37 - v60; | |
2752 if ( v38 > 0 ) | |
2753 { | |
2754 *(int *)v37 = v38; | |
2755 } | |
2756 else | |
2757 { | |
2758 *(int *)v37 = 0; | |
2759 viewparams->bRedrawGameUI = 1; | |
2760 } | |
2761 } | |
2762 v39 = (int)&v21->field_100; | |
2763 if ( v21->field_100 ) | |
2764 { | |
2765 v40 = *(int *)v39 - v60; | |
2766 if ( v40 > 0 ) | |
2767 { | |
2768 *(int *)v39 = v40; | |
2769 } | |
2770 else | |
2771 { | |
2772 *(int *)v39 = 0; | |
2773 viewparams->bRedrawGameUI = 1; | |
2774 } | |
2775 } | |
2776 v41 = (int)&v21->field_104; | |
2777 if ( v21->field_104 ) | |
2778 { | |
2779 v42 = *(int *)v41 - v60; | |
2780 if ( v42 > 0 ) | |
2781 { | |
2782 *(int *)v41 = v42; | |
2783 } | |
2784 else | |
2785 { | |
2786 *(int *)v41 = 0; | |
2787 viewparams->bRedrawGameUI = 1; | |
2788 } | |
2789 } | |
2790 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2791 --v65; | |
2792 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2793 | |
2794 for (uint k = 0; k < 24; ++k) | |
2795 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2796 | |
2797 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2798 v21->SetCondition(1u, 0); | |
2799 ++v62; | |
2800 } | |
2801 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2802 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2803 | |
2804 for (uint i = 0; i < 20; ++i) | |
2805 { | |
2806 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2807 viewparams->bRedrawGameUI = 1; | |
2808 } | |
2809 | |
2810 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2811 { | |
2812 for (uint i = 0; i < 4; ++i) | |
2813 pParty->pPlayers[i].SetCondition(1, 0); | |
2814 } | |
2815 | |
2816 for (uint i = 0; i < 2; ++i) | |
2817 { | |
2818 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2819 if (pBuf->uExpireTime == 0) | |
2820 continue; | |
2821 | |
2822 if ( !(pBuf->uFlags & 1) ) | |
2823 { | |
2824 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2825 { | |
2826 pBuf->Reset(); | |
2827 if (dword_4EE07C[i] == 7 ) | |
2828 pParty->bFlying = false; | |
2829 } | |
2830 } | |
2831 } | |
2832 | |
2833 v51 = v65; | |
2834 if ( v65 ) | |
2835 goto LABEL_135; | |
151 | 2836 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2837 { |
2838 v52 = (signed int)&pPlayers[1]; | |
2839 while ( 1 ) | |
2840 { | |
2841 v53 = *(int *)v52; | |
2842 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2843 break; | |
2844 v52 += 4; | |
2845 if ( v52 > (signed int)&pPlayers[4] ) | |
2846 goto LABEL_135; | |
2847 } | |
2848 *(int *)(v53 + 16) = 0; | |
2849 *(int *)(v53 + 20) = 0; | |
2850 v51 = 1; | |
2851 LABEL_135: | |
151 | 2852 if ( pCurrentScreen != SCREEN_REST |
0 | 2853 && (!v51 || dword_5C35C0) ) |
2854 uGameState = 8; | |
2855 } | |
2856 if ( uActiveCharacter ) | |
2857 { | |
151 | 2858 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2859 { |
2860 v54 = pPlayers[uActiveCharacter]; | |
2861 if ( v54->pConditions[2] | |
2862 || v54->pConditions[12] | |
2863 || v54->pConditions[13] | |
2864 || v54->pConditions[14] | |
2865 || v54->pConditions[15] | |
2866 || v54->pConditions[16] ) | |
2867 { | |
2868 viewparams->bRedrawGameUI = 1; | |
2869 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2870 } | |
2871 } | |
2872 } | |
2873 } | |
2874 | |
2875 //----- (00494820) -------------------------------------------------------- | |
758 | 2876 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2877 { |
2878 signed int v1; // eax@1 | |
2879 | |
2880 v1 = 5; | |
758 | 2881 if ( a1 % 24 >= 5 ) |
0 | 2882 v1 = 29; |
758 | 2883 return v1 - a1 % 24; |
0 | 2884 } |
2885 | |
2886 //----- (00494836) -------------------------------------------------------- | |
2887 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2888 { | |
2889 int v3; // esi@1 | |
2890 int result; // eax@1 | |
2891 stru339_spell_sound *v5; // ebx@1 | |
2892 int *v6; // edi@2 | |
2893 unsigned int v7; // eax@3 | |
2894 int v8; // [sp+Ch] [bp-8h]@3 | |
2895 int v9; // [sp+10h] [bp-4h]@2 | |
2896 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2897 | |
2898 v3 = 0; | |
2899 result = word_4EE088_sound_ids[uSoundID]; | |
2900 v5 = this; | |
2901 a2a = word_4EE088_sound_ids[uSoundID]; | |
2902 if ( result ) | |
2903 { | |
2904 v9 = 0; | |
2905 v6 = this->pSoundsOffsets; | |
2906 do | |
2907 { | |
2908 v7 = a2a++; | |
2909 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2910 if ( !result ) | |
2911 break; | |
2912 a6 += 4; | |
2913 result = v8 + 256; | |
2914 *v6 = v3; | |
2915 v3 += result; | |
2916 ++v9; | |
2917 *(v6 - 2) = result; | |
2918 ++v6; | |
2919 } | |
2920 while ( v9 < 2 ); | |
2921 } | |
2922 return result; | |
2923 } | |
2924 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2925 | |
2926 | |
2927 | |
2928 //----- (00494AED) -------------------------------------------------------- | |
130 | 2929 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2930 { |
2931 unsigned int _uNumFrames; // edx@1 | |
2932 unsigned int result; // eax@1 | |
2933 PlayerFrame *v4; // ecx@2 | |
2934 | |
2935 _uNumFrames = this->uNumFrames; | |
2936 result = 0; | |
2937 if ( (signed int)this->uNumFrames <= 0 ) | |
2938 { | |
2939 LABEL_5: | |
2940 result = 0; | |
2941 } | |
2942 else | |
2943 { | |
2944 v4 = this->pFrames; | |
130 | 2945 while ( v4->expression != expression ) |
0 | 2946 { |
2947 ++result; | |
2948 ++v4; | |
2949 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2950 goto LABEL_5; | |
2951 } | |
2952 } | |
2953 return result; | |
2954 } | |
2955 | |
2956 //----- (00494B10) -------------------------------------------------------- | |
2957 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2958 { | |
2959 unsigned int v3; // esi@1 | |
2960 PlayerFrame *v4; // edi@1 | |
2961 PlayerFrame *v5; // ecx@1 | |
2962 __int16 v6; // dx@2 | |
2963 int v7; // edx@3 | |
2964 char *i; // eax@3 | |
2965 int v9; // ecx@5 | |
2966 PlayerFrame *result; // eax@6 | |
2967 | |
2968 v3 = uFramesetID; | |
2969 v4 = this->pFrames; | |
2970 v5 = &v4[uFramesetID]; | |
2971 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2972 { | |
2973 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2974 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2975 { | |
2976 v9 = *(short *)i; | |
2977 if ( v7 <= v9 ) | |
2978 break; | |
2979 v7 -= v9; | |
2980 ++v3; | |
2981 } | |
2982 result = &v4[v3]; | |
2983 } | |
2984 else | |
2985 { | |
2986 result = &v4[uFramesetID]; | |
2987 } | |
2988 return result; | |
2989 } | |
2990 | |
2991 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2992 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2993 { |
2994 PlayerFrameTable *v4; // edi@1 | |
2995 int v5; // esi@1 | |
2996 int v6; // eax@2 | |
2997 | |
2998 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2999 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3000 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
|
3001 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3002 *pAnimTime = v5; |
0 | 3003 } |
3004 else | |
3005 { | |
3006 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3007 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3008 *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
|
3009 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3010 return &v4->pFrames[*pFramesetID]; |
0 | 3011 } |
3012 | |
3013 //----- (00494BC3) -------------------------------------------------------- | |
3014 void PlayerFrameTable::ToFile() | |
3015 { | |
3016 PlayerFrameTable *v1; // esi@1 | |
3017 FILE *v2; // eax@1 | |
3018 FILE *v3; // edi@1 | |
3019 | |
3020 auto Str = this; | |
3021 | |
3022 v1 = Str; | |
3023 v2 = fopen("data\\dpft.bin", "wb"); | |
3024 v3 = v2; | |
3025 if ( !v2 ) | |
3026 Abortf("Unable to save dpft.bin!"); | |
3027 fwrite(v1, 4u, 1u, v2); | |
3028 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
3029 fclose(v3); | |
3030 } | |
3031 | |
3032 //----- (00494C0F) -------------------------------------------------------- | |
3033 void PlayerFrameTable::FromFile(void *pSerialized) | |
3034 { | |
3035 uNumFrames = *(int *)pSerialized; | |
3036 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
3037 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
3038 } | |
3039 | |
3040 //----- (00494C5A) -------------------------------------------------------- | |
3041 int PlayerFrameTable::FromFileTxt(const char *Args) | |
3042 { | |
3043 PlayerFrameTable *v2; // ebx@1 | |
3044 FILE *v3; // eax@1 | |
3045 int v4; // esi@3 | |
3046 void *v5; // eax@10 | |
3047 FILE *v6; // ST0C_4@12 | |
3048 char *i; // eax@12 | |
3049 __int16 v8; // ax@15 | |
3050 const char *v9; // ST10_4@15 | |
3051 unsigned __int16 v10; // ax@15 | |
3052 const char *v11; // ST0C_4@15 | |
3053 int j; // esi@15 | |
3054 int v13; // eax@17 | |
3055 int v14; // edx@22 | |
3056 int v15; // ecx@23 | |
3057 int v16; // eax@24 | |
3058 signed int k; // eax@27 | |
3059 PlayerFrame *v18; // edx@28 | |
3060 int v19; // esi@28 | |
3061 int l; // ecx@29 | |
3062 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3063 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3064 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3065 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3066 int v26; // [sp+2FCh] [bp-8h]@3 | |
3067 FILE *File; // [sp+300h] [bp-4h]@1 | |
3068 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3069 | |
3070 v2 = this; | |
3071 //TileTable::dtor((TileTable *)this); | |
3072 v3 = fopen(Args, "r"); | |
3073 File = v3; | |
3074 if ( !v3 ) | |
3075 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3076 v4 = 0; | |
3077 v25 = 0; | |
3078 v26 = 1; | |
3079 if ( fgets(&Buf, 490, v3) ) | |
3080 { | |
3081 do | |
3082 { | |
3083 *strchr(&Buf, 10) = 0; | |
703 | 3084 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3085 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3086 { | |
3087 if ( v24.uPropCount < 3 ) | |
0 | 3088 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3089 ++v25; | |
3090 } | |
3091 ++v26; | |
3092 } | |
3093 while ( fgets(&Buf, 490, File) ); | |
3094 v4 = v25; | |
3095 } | |
3096 v2->uNumFrames = v4; | |
3097 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3098 v2->pFrames = (PlayerFrame *)v5; | |
3099 if ( !v5 ) | |
3100 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3101 v6 = File; | |
3102 v2->uNumFrames = 0; | |
3103 fseek(v6, 0, 0); | |
3104 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3105 { | |
3106 *strchr(&Buf, 10) = 0; | |
703 | 3107 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3108 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3109 { |
3110 v8 = atoi(v24.pProperties[0]); | |
3111 v9 = v24.pProperties[1]; | |
130 | 3112 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3113 v10 = atoi(v9); |
3114 v11 = v24.pProperties[2]; | |
3115 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3116 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3117 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3118 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3119 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3120 { |
3121 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3122 { | |
3123 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3124 *(char *)v13 |= 4u; | |
3125 } | |
3126 } | |
3127 ++v2->uNumFrames; | |
3128 } | |
3129 } | |
3130 fclose(File); | |
3131 v14 = 0; | |
3132 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3133 { | |
3134 v15 = 0; | |
3135 do | |
3136 { | |
3137 v16 = (int)&v2->pFrames[v15]; | |
3138 if ( !(*(char *)(v16 + 18) & 4) ) | |
3139 *(char *)(v16 + 8) |= 1u; | |
3140 ++v14; | |
3141 ++v15; | |
3142 } | |
3143 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3144 } | |
3145 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3146 { | |
3147 v18 = v2->pFrames; | |
3148 Argsa = (int)&v18[k]; | |
3149 v19 = *(short *)(Argsa + 4); | |
3150 if ( *(char *)(Argsa + 8) & 1 ) | |
3151 { | |
3152 ++k; | |
3153 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3154 { | |
3155 v19 += *(short *)(l + 4); | |
3156 ++k; | |
3157 } | |
3158 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3159 } | |
3160 ++k; | |
3161 } | |
3162 return 1; | |
3163 } | |
3164 | |
3165 //----- (00494F3A) -------------------------------------------------------- | |
3166 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3167 { | |
3168 IconFrameTable *v2; // esi@1 | |
3169 int v3; // ebx@1 | |
3170 unsigned int uID; // edi@1 | |
3171 unsigned int result; // eax@4 | |
3172 | |
3173 v2 = this; | |
3174 v3 = 0; | |
3175 uID = 0; | |
3176 if ( (signed int)this->uNumIcons <= 0 ) | |
3177 { | |
3178 LABEL_4: | |
3179 result = 0; | |
3180 } | |
3181 else | |
3182 { | |
3183 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3184 { | |
3185 ++uID; | |
3186 ++v3; | |
3187 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3188 goto LABEL_4; | |
3189 } | |
3190 result = uID; | |
3191 } | |
3192 return result; | |
3193 } | |
3194 | |
3195 //----- (00494F70) -------------------------------------------------------- | |
3196 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3197 { | |
3198 IconFrame *v3; // edi@1 | |
3199 IconFrame *v4; // ecx@1 | |
3200 __int16 v5; // dx@2 | |
3201 int v6; // edx@3 | |
3202 unsigned int v7; // eax@3 | |
3203 char *i; // ecx@3 | |
3204 int v9; // esi@5 | |
3205 IconFrame *result; // eax@6 | |
3206 | |
3207 v3 = this->pIcons; | |
3208 v4 = &v3[uIconID]; | |
3209 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3210 { | |
3211 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3212 v7 = uIconID; | |
3213 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3214 { | |
3215 v9 = *(short *)i; | |
3216 if ( v6 <= v9 ) | |
3217 break; | |
3218 v6 -= v9; | |
3219 ++v7; | |
3220 } | |
3221 result = &v3[v7]; | |
3222 } | |
3223 else | |
3224 { | |
3225 result = &v3[uIconID]; | |
3226 } | |
3227 return result; | |
3228 } | |
3229 | |
3230 //----- (00494FBF) -------------------------------------------------------- | |
3231 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3232 { | |
3233 IconFrameTable *v2; // esi@1 | |
3234 unsigned int v3; // edi@3 | |
3235 const char *i; // eax@3 | |
3236 IconFrame *v5; // eax@5 | |
3237 | |
3238 v2 = this; | |
3239 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3240 { | |
3241 v3 = uIconID; | |
3242 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3243 { | |
3244 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3245 v5 = v2->pIcons; | |
3246 if ( !(v5[v3].uFlags & 1) ) | |
3247 break; | |
3248 ++v3; | |
3249 } | |
3250 } | |
3251 } | |
3252 | |
3253 //----- (0049500A) -------------------------------------------------------- | |
3254 void IconFrameTable::ToFile() | |
3255 { | |
3256 IconFrameTable *v1; // esi@1 | |
3257 FILE *v2; // eax@1 | |
3258 FILE *v3; // edi@1 | |
3259 | |
3260 auto Str = this; | |
3261 | |
3262 v1 = Str; | |
3263 v2 = fopen("data\\dift.bin", "wb"); | |
3264 v3 = v2; | |
3265 if ( !v2 ) | |
3266 Abortf("Unable to save dift.bin!"); | |
3267 fwrite(v1, 4u, 1u, v2); | |
3268 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3269 fclose(v3); | |
3270 } | |
3271 | |
3272 //----- (00495056) -------------------------------------------------------- | |
3273 void IconFrameTable::FromFile(void *pSerialized) | |
3274 { | |
3275 uNumIcons = *(int *)pSerialized; | |
3276 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3277 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3278 } | |
3279 | |
3280 //----- (0049509D) -------------------------------------------------------- | |
3281 int IconFrameTable::FromFileTxt(const char *Args) | |
3282 { | |
3283 IconFrameTable *v2; // ebx@1 | |
3284 FILE *v3; // eax@1 | |
3285 int v4; // esi@3 | |
3286 void *v5; // eax@10 | |
3287 FILE *v6; // ST0C_4@12 | |
3288 char *i; // eax@12 | |
3289 const char *v8; // ST00_4@15 | |
3290 int v9; // eax@16 | |
3291 int v10; // edx@20 | |
3292 int v11; // ecx@21 | |
3293 int v12; // eax@22 | |
3294 signed int j; // edx@25 | |
3295 IconFrame *v14; // ecx@26 | |
3296 int v15; // esi@26 | |
3297 int k; // eax@27 | |
3298 signed int result; // eax@11 | |
3299 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3300 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3301 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3302 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3303 int v22; // [sp+2FCh] [bp-8h]@3 | |
3304 FILE *File; // [sp+300h] [bp-4h]@1 | |
3305 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3306 | |
3307 v2 = this; | |
3308 //TileTable::dtor((TileTable *)this); | |
3309 v3 = fopen(Args, "r"); | |
3310 File = v3; | |
3311 if ( !v3 ) | |
3312 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3313 v4 = 0; | |
3314 v21 = 0; | |
3315 v22 = 1; | |
3316 if ( fgets(&Buf, 490, v3) ) | |
3317 { | |
3318 do | |
3319 { | |
3320 *strchr(&Buf, 10) = 0; | |
3321 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3322 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3323 { | |
3324 if ( v20.uPropCount < 3 ) | |
0 | 3325 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3326 ++v21; | |
3327 } | |
3328 ++v22; | |
3329 } | |
3330 while ( fgets(&Buf, 490, File) ); | |
3331 v4 = v21; | |
3332 } | |
3333 v2->uNumIcons = v4; | |
3334 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3335 v2->pIcons = (IconFrame *)v5; | |
3336 if ( v5 ) | |
3337 { | |
3338 v6 = File; | |
3339 v2->uNumIcons = 0; | |
3340 fseek(v6, 0, 0); | |
3341 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3342 { | |
3343 *strchr(&Buf, 10) = 0; | |
3344 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3345 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3346 { |
3347 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3348 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3349 v8 = v20.pProperties[2]; | |
3350 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3351 if ( !_strcmpi(v8, "new") ) | |
3352 { | |
3353 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3354 *(char *)v9 |= 4u; | |
3355 } | |
3356 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3357 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3358 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3359 } | |
3360 } | |
3361 fclose(File); | |
3362 v10 = 0; | |
3363 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3364 { | |
3365 v11 = 0; | |
3366 do | |
3367 { | |
3368 v12 = (int)&v2->pIcons[v11]; | |
3369 if ( !(*(char *)(v12 + 60) & 4) ) | |
3370 *(char *)(v12 + 28) |= 1u; | |
3371 ++v10; | |
3372 ++v11; | |
3373 } | |
3374 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3375 } | |
3376 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3377 { | |
3378 v14 = v2->pIcons; | |
3379 Argsa = (int)&v14[j]; | |
3380 v15 = *(short *)(Argsa + 24); | |
3381 if ( *(char *)(Argsa + 28) & 1 ) | |
3382 { | |
3383 ++j; | |
3384 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3385 { | |
3386 v15 += *(short *)(k + 24); | |
3387 ++j; | |
3388 } | |
3389 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3390 } | |
3391 ++j; | |
3392 } | |
3393 result = 1; | |
3394 } | |
3395 else | |
3396 { | |
3397 fclose(File); | |
3398 result = 0; | |
3399 } | |
3400 return result; | |
3401 } | |
3402 | |
3403 | |
3404 | |
3405 //----- (00495366) -------------------------------------------------------- | |
3406 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3407 { | |
3408 int v2; // edi@1 | |
3409 int v3; // edx@2 | |
3410 int v4; // esi@3 | |
3411 int v5; // ebx@5 | |
3412 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3413 signed int v8; // [sp+10h] [bp-10h]@1 | |
3414 int **v9; // [sp+14h] [bp-Ch]@4 | |
3415 signed int v10; // [sp+18h] [bp-8h]@3 | |
3416 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3417 | |
3418 v2 = a1; | |
3419 v11 = a2; | |
3420 v8 = 0; | |
3421 v7 = 0; | |
3422 if ( dword_AE336C == a1 ) | |
3423 { | |
3424 v3 = dword_AE3370; | |
3425 } | |
3426 else | |
3427 { | |
3428 v4 = a2; | |
3429 dword_AE336C = a1; | |
3430 v10 = 0; | |
3431 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3432 goto LABEL_17; | |
3433 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3434 do | |
3435 { | |
3436 v5 = tolower(*(char *)*v9); | |
3437 if ( v5 == tolower(v2) ) | |
3438 { | |
3439 if ( v8 ) | |
3440 v7 = v10; | |
3441 else | |
3442 v8 = v10; | |
3443 } | |
3444 ++v10; | |
3445 v9 += 2; | |
3446 } | |
3447 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3448 if ( v8 && v8 != v7 ) | |
3449 v3 = v8 + rand() % (v7 - v8); | |
3450 else | |
3451 LABEL_17: | |
3452 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3453 } | |
3454 dword_AE3370 = v3; | |
3455 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3456 } | |
3457 // AE336C: using guessed type int dword_AE336C; | |
3458 // AE3370: using guessed type int dword_AE3370; | |
3459 | |
3460 //----- (00495430) -------------------------------------------------------- | |
607 | 3461 char * GetReputationString( signed int a1 ) |
3462 { | |
566 | 3463 if (a1 >= 25) |
3464 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3465 else if (a1 >= 6) | |
3466 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3467 else if (a1 >= -5) | |
3468 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3469 else if (a1 >= -24) | |
3470 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3471 else |
566 | 3472 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3473 } |
3474 | |
3475 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3476 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3477 { |
3478 unsigned __int8 v6; // bl@1 | |
3479 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 //NPCData *v9; // eax@4 |
250 | 3481 //size_t v10; // eax@6 |
0 | 3482 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3483 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3484 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3485 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3486 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 //int v16; // edx@10 |
0 | 3488 int v17; // eax@10 |
3489 signed __int64 v18; // qax@18 | |
3490 unsigned int v19; // edi@32 | |
3491 unsigned __int8 *v20; // ebx@32 | |
3492 int v21; // ecx@34 | |
3493 __int16 v22; // ax@34 | |
3494 int v23; // edx@39 | |
3495 int v24; // eax@39 | |
3496 int v25; // eax@45 | |
3497 float *v26; // esi@68 | |
3498 float v27; // ST18_4@68 | |
3499 signed int v28; // eax@68 | |
3500 int v29; // eax@68 | |
3501 float v30; // ST18_4@72 | |
3502 signed int v31; // eax@72 | |
3503 float v32; // ST18_4@74 | |
3504 signed int v33; // eax@74 | |
3505 double v34; // st7@75 | |
3506 float v35; // ST18_4@76 | |
3507 signed int v36; // eax@76 | |
3508 float *v37; // esi@78 | |
3509 float v38; // ST18_4@78 | |
3510 int v39; // eax@78 | |
3511 float v40; // ST18_4@82 | |
3512 int v41; // eax@82 | |
3513 float v42; // ST18_4@83 | |
3514 int v43; // eax@83 | |
3515 float v44; // ST18_4@85 | |
3516 int v45; // eax@85 | |
3517 const char *v46; // eax@86 | |
3518 unsigned int v47; // eax@87 | |
3519 float v48; // ST18_4@97 | |
3520 __int64 v49; // ST14_8@107 | |
3521 int v50; // eax@107 | |
3522 int v51; // eax@108 | |
3523 Player *v52; // eax@109 | |
3524 int v53; // [sp-4h] [bp-13Ch]@107 | |
3525 int v54; // [sp+0h] [bp-138h]@107 | |
3526 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3527 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3528 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3529 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3530 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3532 //Player *v61; // [sp+124h] [bp-14h]@3 |
3533 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3534 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 |
0 | 3540 |
3541 v6 = uPlayerID; | |
249 | 3542 //Str = lpsz; |
0 | 3543 if ( IsBadStringPtrA(lpsz, 1u) ) |
3544 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 |
0 | 3546 a1[0] = 0; |
3547 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3548 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3549 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 NPCData *npc = nullptr; |
0 | 3553 if ( dword_5C35D4 ) |
248 | 3554 { |
463 | 3555 //__debugbreak(); // fix |
459 | 3556 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
|
3557 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 else |
602 | 3559 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 //v65 = v9; |
250 | 3561 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3570 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3571 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3572 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3575 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3576 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3577 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3580 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3584 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
|
3585 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 case 2: |
0 | 3592 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 case 5: |
0 | 3599 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3600 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3601 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3602 { | |
3603 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3604 { | |
3605 if ( v18 < 20 ) | |
3606 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3607 } | |
3608 else | |
3609 { | |
3610 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3611 } | |
3612 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3613 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 case 6: |
0 | 3615 if ( pPlayer->uSex ) |
3616 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3617 else | |
3618 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3620 case 7: |
0 | 3621 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3622 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3623 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3624 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3625 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3626 case 8: |
0 | 3627 v19 = 0; |
3628 v63 = 0; | |
484 | 3629 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3630 do |
3631 { | |
3632 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3633 { | |
3634 v21 = v63; | |
3635 v22 = word_4EE150[v19]; | |
3636 ++v63; | |
3637 v55[v21] = v22; | |
3638 } | |
3639 ++v19; | |
3640 } | |
3641 while ( v19 < 28 ); | |
3642 if ( v63 ) | |
3643 { | |
3644 v23 = rand() % v63; | |
3645 v24 = dword_A74CDC; | |
3646 if ( dword_A74CDC == -1 ) | |
3647 { | |
3648 v24 = v23; | |
3649 dword_A74CDC = v23; | |
3650 } | |
492 | 3651 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3652 } |
3653 else | |
3654 { | |
3655 v11 = (char *)pNPCTopics[55].pText; | |
3656 } | |
249 | 3657 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 case 10: |
0 | 3667 if ( pPlayer->uSex ) |
3668 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3669 else | |
3670 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 case 11: |
0 | 3673 v25 = GetPartyReputation(); |
3674 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 v25 = npc->rep; |
0 | 3677 LABEL_46: |
3678 if ( v25 >= 25 ) | |
3679 { | |
3680 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3681 } | |
3682 else | |
3683 { | |
3684 if ( v25 < 6 ) | |
3685 { | |
3686 if ( v25 >= -5 ) | |
3687 { | |
3688 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3689 } | |
3690 else | |
3691 { | |
3692 if ( v25 < -24 ) | |
3693 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3694 else | |
3695 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3696 } | |
3697 } | |
3698 else | |
3699 { | |
3700 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3701 } | |
3702 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 case 13: |
0 | 3705 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3725 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3726 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3727 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3728 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3729 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3730 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3731 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3732 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3733 goto _continue_strcat; |
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 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3736 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3737 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
|
3738 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3739 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3740 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3741 sprintf(a1, "%lu", pay_percentage); |
250 | 3742 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3744 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3748 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3752 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3753 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3754 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3755 sprintf(a1, "%lu", v51); |
0 | 3756 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3757 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3758 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3759 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3760 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3761 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3762 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3763 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3764 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3765 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3766 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3767 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3768 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3769 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3770 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3771 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3772 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3773 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3774 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3775 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3776 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3777 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3778 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3779 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3781 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3783 switch ( a5 ) |
3784 { | |
3785 case 3: | |
3786 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 v45 = a3->GetValue(); |
0 | 3788 v29 = pPlayer->_4B8213(v45, v44); |
3789 break; | |
3790 case 4: | |
3791 v29 = pPlayer->_4B824B(*v37); | |
3792 break; | |
3793 case 5: | |
3794 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 v43 = a3->GetValue(); |
0 | 3796 v29 = pPlayer->_4B8265(v43, v42); |
3797 break; | |
3798 case 6: | |
3799 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 v41 = a3->GetValue(); |
0 | 3801 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3802 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3810 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 v28 = a3->GetValue(); |
749 | 3812 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3813 if ( a5 == 3 ) |
3814 { | |
3815 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 v36 = a3->GetValue(); |
0 | 3817 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3818 if (a3->Broken()) |
0 | 3819 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 goto _continue_sprintf; |
0 | 3821 } |
3822 if ( a5 != 4 ) | |
3823 { | |
3824 if ( a5 == 5 ) | |
3825 { | |
3826 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 v33 = a3->GetValue(); |
0 | 3828 v29 = pPlayer->_4B81C3(v33, v32); |
3829 } | |
3830 else | |
3831 { | |
3832 if ( a5 == 6 ) | |
3833 { | |
3834 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 v31 = a3->GetValue(); |
0 | 3836 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3837 if (a3->Broken()) |
0 | 3838 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3839 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3840 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3841 goto _continue_sprintf; |
0 | 3842 } |
3843 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3844 _continue_sprintf: |
0 | 3845 sprintf(a1, "%lu", v29); |
250 | 3846 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3847 goto _continue_strcat; |
0 | 3848 } |
3849 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3850 |
0 | 3851 v48 = v34; |
3852 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3853 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3854 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3855 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3856 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3857 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3858 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3859 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3860 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3861 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3862 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3863 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3864 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3865 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3866 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3867 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3868 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3869 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3870 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3871 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3872 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3873 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3874 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3875 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3876 sub_493F79(&v57, *a6); |
351 | 3877 v54 = v57.field_18_expire_year; |
3878 v53 = v57.field_C_expire_day + 1; | |
3879 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3880 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3881 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3882 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3883 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3884 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3885 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3886 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3887 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3888 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3889 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3890 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3891 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3892 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3893 default: |
0 | 3894 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3895 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3896 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3897 goto _continue_strcat; |
484 | 3898 v49 = pParty->field_3C._s_times[v17-51]; |
3899 | |
0 | 3900 sub_493F79(&v56, v49); |
351 | 3901 v54 = v56.field_18_expire_year; |
3902 v53 = v56.field_C_expire_day + 1; | |
3903 v50 = v56.field_14_exprie_month; | |
0 | 3904 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3905 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3906 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3907 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3908 } |
0 | 3909 } |
3910 return pTmpBuf2; | |
3911 } | |
3912 | |
706 | 3913 |
3914 | |
0 | 3915 |
3916 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3917 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3918 { |
734 | 3919 //stru154 *v3; // edi@1 |
3920 //signed int v4; // eax@1 | |
3921 //signed int result; // eax@9 | |
3922 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3923 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3924 float v7; |
0 | 3925 |
3926 v.x = 0.0; | |
3927 v.y = 0.0; | |
3928 v.z = 0.0; | |
734 | 3929 GetFacePlane(a2, a3, &v, &v7); |
3930 | |
3931 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3932 polygonType = POLYGON_VerticalWall; | |
3933 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3934 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3935 polygonType = POLYGON_Floor; | |
0 | 3936 else |
734 | 3937 polygonType = POLYGON_InBetweenFloorAndWall; |
3938 | |
3939 face_plane.vNormal.x = v.x; | |
3940 face_plane.vNormal.y = v.y; | |
3941 face_plane.vNormal.z = v.z; | |
3942 face_plane.dist = v7; | |
0 | 3943 } |
3944 | |
3945 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3946 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3947 { |
734 | 3948 if (fabsf(pNormal->z) < 1e-6f) |
3949 polygonType = POLYGON_VerticalWall; | |
3950 else if (fabsf(pNormal->x) < 1e-6f && | |
3951 fabsf(pNormal->y) < 1e-6f) | |
3952 polygonType = POLYGON_Floor; | |
0 | 3953 else |
734 | 3954 polygonType = POLYGON_InBetweenFloorAndWall; |
3955 | |
3956 face_plane.vNormal.x = pNormal->x; | |
3957 face_plane.dist = dist; | |
3958 face_plane.vNormal.y = pNormal->y; | |
3959 face_plane.vNormal.z = pNormal->z; | |
0 | 3960 } |
3961 | |
3962 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3963 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3964 { |
3965 ODMFace *v5; // ebx@1 | |
734 | 3966 //int v6; // eax@1 |
3967 //unsigned __int16 *v7; // ebx@2 | |
3968 //Vec3_int_ *v8; // eax@3 | |
0 | 3969 Vec3_int_ *v9; // ecx@3 |
734 | 3970 //double v10; // st7@3 |
3971 //int v11; // ecx@3 | |
0 | 3972 Vec3_int_ *v12; // ecx@3 |
734 | 3973 //double v13; // st7@3 |
3974 //double v14; // st6@3 | |
3975 //double v15; // st5@3 | |
3976 //int v16; // ecx@3 | |
0 | 3977 Vec3_int_ *v17; // eax@3 |
734 | 3978 //double v18; // st5@3 |
0 | 3979 Vec3_float_ *v19; // eax@3 |
734 | 3980 //int result; // eax@8 |
3981 //float v21; // ecx@10 | |
3982 //double v22; // st7@10 | |
3983 //double v23; // st6@10 | |
0 | 3984 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3985 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3986 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3987 float v27; // [sp+20h] [bp-48h]@3 | |
3988 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3989 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3990 //float v30; // [sp+30h] [bp-38h]@3 | |
3991 //float v31; // [sp+34h] [bp-34h]@3 | |
3992 //float v32; // [sp+38h] [bp-30h]@3 | |
3993 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3994 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3995 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3996 //float v36; // [sp+50h] [bp-18h]@3 | |
3997 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3998 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3999 //int v39; // [sp+64h] [bp-4h]@1 |
4000 | |
4001 //v39 = 0; | |
0 | 4002 v1.x = 0.0; |
4003 v5 = pFace; | |
734 | 4004 //v6 = pFace->uNumVertices; |
0 | 4005 v1.y = 0.0; |
4006 v1.z = 0.0; | |
734 | 4007 |
4008 if (pFace->uNumVertices >= 2) | |
4009 { | |
4010 int i = 0; | |
4011 while ( i < pFace->uNumVertices - 2 ) | |
4012 { | |
4013 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
4014 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
4015 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
4016 | |
4017 v1.x = v12->x - v9->x; | |
4018 v26 = v17->x - v12->x; | |
4019 v1.y = v12->y - v9->y; | |
4020 v27 = v17->y - v12->y; | |
4021 v1.z = v12->z - v9->z; | |
4022 v28 = v17->z - v12->z; | |
0 | 4023 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
4024 v38.x = v19->x; | |
4025 v38.y = v19->y; | |
4026 v38.z = v19->z; | |
734 | 4027 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
4028 { | |
4029 v38.Normalize(); | |
4030 | |
4031 pOutNormal->x = v38.x; | |
4032 pOutNormal->y = v38.y; | |
4033 pOutNormal->z = v38.z; | |
4034 | |
4035 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
4036 return; | |
4037 } | |
4038 } | |
4039 } | |
4040 | |
4041 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
4042 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
4043 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
4044 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 4045 } |
4046 | |
4047 | |
4048 | |
4049 | |
4050 | |
4051 //----- (0049D700) -------------------------------------------------------- | |
4052 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
4053 { | |
4054 unsigned int v1; // eax@1 | |
4055 int v2; // ecx@1 | |
4056 unsigned int v3; // eax@1 | |
4057 | |
4058 v1 = uDim; | |
4059 v2 = 0; | |
4060 v3 = v1 - 1; | |
4061 while ( v3 & 1 ) | |
4062 { | |
4063 v3 >>= 1; | |
4064 ++v2; | |
4065 } | |
4066 return v3 == 0 ? v2 : 0; | |
4067 } | |
4068 | |
4069 | |
4070 | |
4071 | |
4072 | |
4073 | |
4074 | |
4075 | |
4076 | |
4077 | |
4078 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4079 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4080 { |
737 | 4081 /*signed __int64 v2; // ST10_8@1 |
0 | 4082 double v3; // st7@1 |
4083 float v4; // ST24_4@1 | |
4084 double v5; // ST10_8@1 | |
4085 int v6; // ST1C_4@1 | |
4086 float v7; // ST24_4@1 | |
4087 double v8; // ST10_8@1 | |
4088 unsigned __int8 v9; // ST20_1@1 | |
4089 float v10; // ST24_4@1 | |
4090 double v11; // ST10_8@1 | |
4091 float v12; // ST24_4@1 | |
737 | 4092 double v13; // ST08_8@1*/ |
4093 | |
4094 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4095 (a2 >> 24) / 255.0f * 255.0f), | |
4096 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4097 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4098 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4099 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4100 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4101 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4102 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4103 /*v2 = a1 >> 24; | |
4104 v3 = (double)v2 / 255.0f; | |
4105 HIDWORD(v2) = 0; | |
0 | 4106 LODWORD(v2) = a2 >> 24; |
737 | 4107 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4108 v5 = v4 + 6.7553994e15; |
4109 v6 = LODWORD(v5); | |
737 | 4110 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4111 v8 = v7 + 6.7553994e15; |
4112 v9 = LOBYTE(v8); | |
737 | 4113 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4114 v11 = v10 + 6.7553994e15; |
737 | 4115 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4116 v13 = v12 + 6.7553994e15; |
737 | 4117 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4118 } |
4119 | |
4120 | |
4121 | |
4122 //----- (004A46E6) -------------------------------------------------------- | |
4123 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4124 { | |
4125 int v5; // eax@1 | |
4126 int z; // eax@1 | |
4127 unsigned int v7; // eax@9 | |
4128 unsigned int v8; // ecx@9 | |
4129 int v9; // eax@9 | |
4130 unsigned int v10; // eax@10 | |
4131 int *v11; // esi@10 | |
4132 int *v12; // edi@10 | |
4133 int v13; // ecx@10 | |
4134 int v14; // edx@10 | |
4135 unsigned int v15; // eax@22 | |
4136 int *v16; // esi@22 | |
4137 int *v17; // edi@22 | |
4138 int v18; // ecx@22 | |
4139 int v19; // edx@22 | |
4140 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4141 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4142 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4143 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4144 | |
4145 v5 = a4; | |
4146 v23 = _z >> 16; | |
4147 z = x + v5; | |
693 | 4148 if ( z >= (signed int)pViewport->uViewportTL_X |
4149 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4150 && y >= (signed int)pViewport->uViewportTL_Y | |
4151 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4152 { | |
4153 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4154 x = pViewport->uViewportTL_X; | |
4155 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4156 z = pViewport->uViewportBR_X; | |
0 | 4157 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4158 v22 = z - x; | |
4159 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4160 v7 = lightColor >> 3; | |
4161 v8 = lightColor & 0xF0; | |
4162 v9 = v7 & 0x1E0000; | |
4163 if ( pRenderer->uTargetGBits == 5 ) | |
4164 { | |
4165 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4166 v11 = (int *)pTarget; | |
4167 v12 = pTargetZ; | |
4168 v13 = v22; | |
4169 v14 = (v10 << 16) | v10; | |
4170 z = (unsigned __int8)pTarget & 2; | |
4171 if ( (unsigned __int8)pTarget & 2 ) | |
4172 { | |
4173 z = (unsigned int)*pTargetZ >> 16; | |
4174 if ( z > v23 ) | |
4175 { | |
4176 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4177 *pTarget = z; | |
4178 } | |
4179 v13 = v22 - 1; | |
4180 v11 = (int *)(pTarget + 1); | |
4181 v12 = pTargetZ + 1; | |
4182 } | |
4183 while ( v13 != 1 ) | |
4184 { | |
4185 if ( v13 < 1 ) | |
4186 return z; | |
4187 z = (unsigned int)*v12 >> 16; | |
4188 if ( z <= v23 ) | |
4189 { | |
4190 v13 -= 2; | |
4191 ++v11; | |
4192 v12 += 2; | |
4193 } | |
4194 else | |
4195 { | |
4196 v12 += 2; | |
4197 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4198 v13 -= 2; | |
4199 *v11 = z; | |
4200 ++v11; | |
4201 } | |
4202 } | |
4203 z = (unsigned int)*v12 >> 16; | |
4204 if ( z > v23 ) | |
4205 { | |
4206 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4207 *(short *)v11 = z; | |
4208 } | |
4209 } | |
4210 else | |
4211 { | |
4212 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4213 v16 = (int *)pTarget; | |
4214 v17 = pTargetZ; | |
4215 v18 = v22; | |
4216 v19 = (v15 << 16) | v15; | |
4217 z = (unsigned __int8)pTarget & 2; | |
4218 if ( (unsigned __int8)pTarget & 2 ) | |
4219 { | |
4220 z = (unsigned int)*pTargetZ >> 16; | |
4221 if ( z > v23 ) | |
4222 { | |
4223 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4224 *pTarget = z; | |
4225 } | |
4226 v18 = v22 - 1; | |
4227 v16 = (int *)(pTarget + 1); | |
4228 v17 = pTargetZ + 1; | |
4229 } | |
4230 while ( v18 != 1 ) | |
4231 { | |
4232 if ( v18 < 1 ) | |
4233 return z; | |
4234 z = (unsigned int)*v17 >> 16; | |
4235 if ( z <= v23 ) | |
4236 { | |
4237 v18 -= 2; | |
4238 ++v16; | |
4239 v17 += 2; | |
4240 } | |
4241 else | |
4242 { | |
4243 v17 += 2; | |
4244 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4245 v18 -= 2; | |
4246 *v16 = z; | |
4247 ++v16; | |
4248 } | |
4249 } | |
4250 z = (unsigned int)*v17 >> 16; | |
4251 if ( z > v23 ) | |
4252 { | |
4253 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4254 *(short *)v16 = z; | |
4255 } | |
4256 } | |
4257 } | |
4258 return z; | |
4259 } | |
4260 | |
4261 | |
4262 //----- (004A57E9) -------------------------------------------------------- | |
4263 void __cdecl Present_ColorKey() | |
4264 { | |
4265 HRESULT v0; // eax@3 | |
4266 HRESULT v1; // eax@3 | |
4267 HRESULT v2; // eax@3 | |
4268 HRESULT v3; // eax@3 | |
4269 HRESULT v4; // eax@3 | |
4270 RECT a2; // [sp+4h] [bp-14h]@3 | |
4271 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4272 | |
4273 if ( !pRenderer->uNumSceneBegins ) | |
4274 { | |
4275 if ( pRenderer->field_40110 ) | |
4276 { | |
693 | 4277 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4278 a2.left = 0; |
4279 a2.top = 0; | |
4280 a2.right = 640; | |
4281 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4282 a2.right = 640; | |
4283 a2.left = 0; | |
693 | 4284 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4285 a2.bottom = 480; |
4286 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4287 0, | |
693 | 4288 pViewport->uViewportBR_Y + 1, |
0 | 4289 pRenderer->pColorKeySurface4, |
4290 &a2, | |
4291 16u)); | |
693 | 4292 a2.right = pViewport->uViewportTL_X; |
4293 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4294 a2.left = 0; |
693 | 4295 a2.top = pViewport->uViewportTL_Y; |
0 | 4296 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4297 0, | |
693 | 4298 pViewport->uViewportTL_Y, |
0 | 4299 pRenderer->pColorKeySurface4, |
4300 &a2, | |
4301 16u)); | |
693 | 4302 a2.left = pViewport->uViewportBR_X; |
4303 a2.top = pViewport->uViewportTL_Y; | |
0 | 4304 a2.right = 640; |
693 | 4305 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4306 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4307 pViewport->uViewportBR_X, |
4308 pViewport->uViewportTL_Y, | |
0 | 4309 pRenderer->pColorKeySurface4, |
4310 &a2, | |
4311 16u)); | |
693 | 4312 a2.right = pViewport->uViewportBR_X; |
4313 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4314 a2.left = pViewport->uViewportTL_X; | |
4315 a2.top = pViewport->uViewportTL_Y; | |
0 | 4316 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4317 pViewport->uViewportTL_X, |
4318 pViewport->uViewportTL_Y, | |
0 | 4319 pRenderer->pColorKeySurface4, |
4320 &a2, | |
4321 17u)); | |
4322 } | |
4323 } | |
4324 } | |
4325 | |
4326 //----- (004A597D) -------------------------------------------------------- | |
4327 void Present_NoColorKey() | |
4328 { | |
4329 //unsigned __int16 *v0; // eax@4 | |
4330 unsigned __int16 *v1; // esi@4 | |
4331 void *v2; // edi@4 | |
4332 //signed int v4; // ebx@4 | |
4333 //signed int v5; // ebx@6 | |
4334 //void *v6; // edi@7 | |
4335 //const void *v7; // esi@7 | |
4336 signed int v8; // ebx@8 | |
4337 int v9; // eax@10 | |
4338 unsigned int v10; // esi@10 | |
4339 unsigned __int32 v11; // edi@10 | |
4340 //int v12; // ecx@10 | |
4341 unsigned int v13; // ebx@10 | |
4342 int v14; // eax@11 | |
4343 int v15; // eax@13 | |
4344 int v16; // eax@14 | |
4345 int v17; // eax@16 | |
4346 HRESULT v18; // eax@22 | |
4347 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4348 int v20; // [sp+88h] [bp-1Ch]@10 | |
4349 int v21; // [sp+8Ch] [bp-18h]@10 | |
4350 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4351 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4352 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4353 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4354 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4355 | |
4356 if ( !pRenderer->uNumSceneBegins ) | |
4357 { | |
4358 if ( pRenderer->field_40110 ) | |
4359 { | |
4360 memset(&Dst, 0, 0x7Cu); | |
4361 Dst.dwSize = 124; | |
168 | 4362 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4363 { |
4364 //v26 = Dst.lpSurface; | |
4365 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4366 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4367 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4368 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4369 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4370 v1 = pRenderer->pTargetSurface; | |
4371 v2 = Dst.lpSurface; | |
4372 | |
4373 | |
4374 /*for (uint y = 0; y < 480; ++y) | |
4375 { | |
4376 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4377 for (uint x = 0; x < 640; ++x) | |
4378 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4379 }*/ | |
4380 | |
4381 auto pSrc = pRenderer->pTargetSurface; | |
4382 auto pDst = (__int16 *)Dst.lpSurface; | |
4383 | |
4384 for (uint y = 0; y < 8; ++y) | |
4385 memcpy(pDst + y * Dst.lPitch / 2, | |
4386 | |
4387 pSrc + y * 640, 640 * sizeof(__int16)); | |
4388 | |
4389 for (uint y = 8; y < 352; ++y) | |
4390 { | |
4391 memcpy(pDst + y * Dst.lPitch / 2, | |
4392 pSrc + y * 640, 8 * sizeof(__int16)); | |
4393 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2, | |
4394 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
4395 } | |
4396 | |
121 | 4397 for (uint y = 352; y < 480; ++y) |
0 | 4398 memcpy(pDst + y * Dst.lPitch / 2, |
4399 pSrc + y * 640, 640 * sizeof(__int16)); | |
4400 | |
4401 | |
693 | 4402 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4403 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4404 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4405 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4406 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4407 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4408 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4409 v21 = 4 * v9 + 1280; | |
4410 | |
121 | 4411 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4412 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4413 v10 = (int)pSrc_x1y1; | |
4414 v11 = (int)pDst_x1y1; | |
693 | 4415 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4416 v13 = v24; |
4417 | |
693 | 4418 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4419 { |
4420 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4421 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4422 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4423 { |
4424 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4425 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4426 } | |
4427 } | |
4428 | |
4429 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4430 | |
4431 /* while ( 1 ) | |
4432 { | |
4433 while ( 1 ) | |
4434 { | |
4435 v14 = *(int *)v10; | |
4436 v10 += 4; | |
4437 if ( v14 == v13 ) | |
4438 break; | |
4439 if ( (short)v14 == (short)v13 ) | |
4440 { | |
4441 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4442 v11 += 4; | |
4443 --uHalfWidth; | |
4444 if ( !uHalfWidth ) | |
4445 goto LABEL_21; | |
4446 } | |
4447 else | |
4448 { | |
4449 v15 = __ROL__(v14, 16); | |
4450 if ( (short)v15 == (short)v13 ) | |
4451 { | |
4452 v17 = __ROR__(v15, 16); | |
4453 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4454 v11 += 4; | |
4455 --uHalfWidth; | |
4456 if ( !uHalfWidth ) | |
4457 goto LABEL_21; | |
4458 } | |
4459 else | |
4460 { | |
4461 v16 = __ROR__(v15, 16); | |
4462 *(int *)v11 = v16; | |
4463 v11 += 4; | |
4464 --uHalfWidth; | |
4465 if ( !uHalfWidth ) | |
4466 goto LABEL_21; | |
4467 } | |
4468 } | |
4469 } | |
4470 v11 += 4; | |
4471 --uHalfWidth; | |
4472 if ( !uHalfWidth ) | |
4473 { | |
4474 LABEL_21: | |
4475 v10 += v21; | |
4476 v11 += v22; | |
4477 uHalfWidth = v20; | |
4478 if ( !--uNumLines ) | |
4479 { | |
4480 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4481 return; | |
4482 } | |
4483 } | |
4484 }*/ | |
4485 } | |
4486 } | |
4487 } | |
4488 } | |
4489 | |
4490 | |
4491 | |
4492 //----- (004A7063) -------------------------------------------------------- | |
4493 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4494 { | |
4495 float v2; // ST1C_4@1 | |
4496 double v3; // ST14_8@1 | |
4497 signed int v4; // ebx@1 | |
4498 float v5; // ST1C_4@1 | |
4499 double v6; // ST14_8@1 | |
4500 signed int v7; // edi@1 | |
4501 double v8; // ST0C_8@1 | |
4502 signed int v9; // esi@1 | |
4503 signed int v10; // ecx@1 | |
4504 double v12; // [sp+8h] [bp-18h]@1 | |
4505 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4506 | |
4507 v2 = (double)(uDiffuse >> 24) * a2; | |
4508 v3 = v2 + 6.7553994e15; | |
4509 v4 = LODWORD(v3); | |
4510 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4511 v6 = v5 + 6.7553994e15; | |
4512 v7 = LODWORD(v6); | |
4513 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4514 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4515 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4516 v9 = LODWORD(v8); | |
4517 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4518 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4519 v10 = LODWORD(v12); | |
4520 if ( v4 > 255 ) | |
4521 v4 = 255; | |
4522 if ( v4 < 0 ) | |
4523 v4 = 0; | |
4524 if ( SHIDWORD(v13) > 255 ) | |
4525 v7 = 255; | |
4526 if ( v7 < 0 ) | |
4527 v7 = 0; | |
4528 if ( (signed int)v13 > 255 ) | |
4529 v9 = 255; | |
4530 if ( v9 < 0 ) | |
4531 v9 = 0; | |
4532 if ( SLODWORD(v12) > 255 ) | |
4533 v10 = 255; | |
4534 if ( v10 < 0 ) | |
4535 v10 = 0; | |
4536 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4537 } | |
4538 | |
4539 | |
4540 | |
4541 | |
4542 | |
4543 | |
4544 | |
4545 | |
4546 //----- (004AD504) -------------------------------------------------------- | |
711 | 4547 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4548 { |
4549 int result; // eax@1 | |
711 | 4550 signed int v2; // ebx@1 |
0 | 4551 BLVFace *v3; // esi@3 |
4552 Texture *v4; // edi@6 | |
4553 int v5; // eax@7 | |
4554 int v6; // edx@7 | |
4555 int v7; // ecx@7 | |
4556 int v8; // ebx@8 | |
4557 int v9; // eax@8 | |
4558 int v10; // ebx@8 | |
4559 unsigned int v11; // ebx@9 | |
4560 int v12; // esi@10 | |
4561 int v13; // eax@13 | |
4562 unsigned __int16 *v14; // eax@13 | |
4563 unsigned int v15; // eax@14 | |
4564 unsigned __int16 *v16; // ebx@14 | |
4565 int v17; // eax@15 | |
4566 int v18; // ebx@15 | |
4567 int v19; // esi@15 | |
4568 int v20; // ecx@15 | |
4569 int v21; // eax@15 | |
4570 stru193_math *v22; // ebx@15 | |
4571 int v23; // eax@15 | |
4572 char *v24; // esi@16 | |
4573 int v25; // eax@18 | |
4574 int v26; // eax@18 | |
4575 int v27; // eax@20 | |
4576 signed int v28; // esi@20 | |
4577 signed int v29; // edx@20 | |
4578 signed int v30; // esi@20 | |
4579 signed int v31; // edi@20 | |
4580 int v32; // esi@20 | |
4581 int v33; // eax@26 | |
4582 int *v34; // esi@27 | |
4583 unsigned __int16 *v35; // edi@27 | |
4584 unsigned int v36; // edx@27 | |
4585 int v37; // ebx@27 | |
4586 char v38; // cl@27 | |
4587 char v39; // ch@27 | |
4588 int v40; // ebx@29 | |
4589 int v41; // edx@29 | |
4590 unsigned int v42; // ebx@30 | |
4591 int v43; // edx@30 | |
4592 int v44; // eax@33 | |
4593 int *v45; // esi@34 | |
4594 unsigned __int16 *v46; // edi@34 | |
4595 unsigned int v47; // edx@34 | |
4596 int v48; // ebx@34 | |
4597 char v49; // cl@34 | |
4598 char v50; // ch@34 | |
4599 int v51; // ebx@36 | |
4600 int v52; // edx@36 | |
4601 unsigned __int16 v53; // bx@37 | |
4602 int v54; // edx@37 | |
4603 int v55; // eax@40 | |
4604 int v56; // eax@41 | |
4605 int *v57; // esi@42 | |
4606 unsigned __int16 *v58; // edi@42 | |
4607 unsigned int v59; // edx@42 | |
4608 int v60; // ebx@42 | |
4609 char v61; // cl@42 | |
4610 char v62; // ch@42 | |
4611 unsigned int v63; // ebx@44 | |
4612 int v64; // edx@44 | |
4613 unsigned int v65; // ebx@44 | |
4614 int v66; // edx@44 | |
4615 unsigned int v67; // ebx@45 | |
4616 int v68; // edx@45 | |
4617 int v69; // ebx@45 | |
4618 int v70; // edx@45 | |
4619 int v71; // eax@48 | |
4620 int *v72; // esi@49 | |
4621 unsigned __int16 *v73; // edi@49 | |
4622 unsigned int v74; // edx@49 | |
4623 int v75; // ebx@49 | |
4624 char v76; // cl@49 | |
4625 char v77; // ch@49 | |
4626 unsigned int v78; // ebx@51 | |
4627 int v79; // edx@51 | |
4628 unsigned int v80; // ebx@51 | |
4629 int v81; // edx@51 | |
4630 unsigned int v82; // ebx@52 | |
4631 int v83; // edx@52 | |
4632 int v84; // ebx@52 | |
4633 int v85; // edx@52 | |
4634 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4635 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4636 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4637 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4638 int v90; // [sp+1Ch] [bp-88h]@20 | |
4639 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4640 int v92; // [sp+24h] [bp-80h]@7 | |
4641 int i; // [sp+28h] [bp-7Ch]@7 | |
4642 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4643 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4644 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4645 int v97; // [sp+38h] [bp-6Ch]@15 | |
4646 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4647 int v99; // [sp+40h] [bp-64h]@9 | |
4648 int v100; // [sp+44h] [bp-60h]@24 | |
4649 int v101; // [sp+48h] [bp-5Ch]@10 | |
4650 int v102; // [sp+4Ch] [bp-58h]@20 | |
4651 int v103; // [sp+50h] [bp-54h]@20 | |
4652 int v104; // [sp+54h] [bp-50h]@9 | |
4653 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4654 int v106; // [sp+5Ch] [bp-48h]@24 | |
4655 int v107; // [sp+60h] [bp-44h]@20 | |
4656 int v108; // [sp+64h] [bp-40h]@20 | |
4657 int v109; // [sp+68h] [bp-3Ch]@20 | |
4658 int v110; // [sp+6Ch] [bp-38h]@15 | |
4659 int v111; // [sp+70h] [bp-34h]@20 | |
4660 int a1; // [sp+74h] [bp-30h]@12 | |
4661 int a2; // [sp+78h] [bp-2Ch]@9 | |
4662 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4663 int v115; // [sp+80h] [bp-24h]@18 | |
4664 int v116; // [sp+84h] [bp-20h]@7 | |
4665 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4666 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4667 int *v119; // [sp+90h] [bp-14h]@13 | |
4668 int v120; // [sp+94h] [bp-10h]@15 | |
4669 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4670 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4671 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4672 | |
4673 result = pRenderer->uTargetSurfacePitch; | |
711 | 4674 v2 = sFaceID; |
0 | 4675 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4676 if ( sFaceID >= 0 ) |
4677 { | |
4678 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4679 { | |
4680 v3 = &pIndoor->pFaces[sFaceID]; | |
4681 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4682 if ( !pRenderer->pRenderD3D ) |
4683 { | |
711 | 4684 result = sub_423B5D(sFaceID); |
0 | 4685 if ( result ) |
4686 { | |
4687 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4688 if ( result ) | |
4689 { | |
4690 result = (int)v3->GetTexture(); | |
4691 v4 = (Texture *)result; | |
4692 v96 = (Texture *)result; | |
4693 if ( result ) | |
4694 { | |
4695 v5 = *(short *)(result + 38); | |
4696 LOBYTE(v3->uAttributes) |= 0x80u; | |
4697 v92 = v5; | |
4698 sub_4AE5F1(v2); | |
4699 ++pBLVRenderParams->field_84; | |
4700 v6 = stru_F8AD28.pDeltaUV[0]; | |
4701 v116 = stru_F8AD28.pDeltaUV[1]; | |
4702 v7 = 0; | |
4703 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4704 { | |
4705 v8 = v116; | |
4706 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4707 v9 = 4 * v7 + 16297672; | |
4708 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4709 } | |
4710 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4711 result = stru_F8A590._viewport_space_y; | |
4712 a2 = stru_F8A590._viewport_space_y; | |
4713 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4714 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4715 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4716 v87 = v4->pLevelOfDetail1; |
4717 v88 = v4->pLevelOfDetail2; | |
4718 v89 = v4->pLevelOfDetail3; | |
4719 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4720 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4721 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4722 { | |
4723 v12 = 2 * stru_F8A590._viewport_space_y; | |
4724 v101 = 2 * stru_F8A590._viewport_space_y; | |
4725 while ( 1 ) | |
4726 { | |
4727 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4728 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4729 if ( LOBYTE(viewparams->field_20) ) | |
4730 { | |
4731 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4732 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4733 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4734 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4735 - pBLVRenderParams->uViewportX]; | |
4736 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4737 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4738 - pBLVRenderParams->uViewportX]; | |
4739 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4740 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4741 - pBLVRenderParams->uViewportX]; | |
4742 v123 = (unsigned int)v16; | |
4743 } | |
4744 else | |
4745 { | |
4746 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4747 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4748 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4749 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4750 } | |
4751 v117 = (unsigned int)v14; | |
4752 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4753 v18 = stru_F81018.field_0.field_10; | |
4754 LOWORD(v17) = 0; | |
4755 v97 = stru_F8AD28.field_0 | v17; | |
4756 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4757 v19 = stru_F81018.field_0.field_4 >> i; | |
4758 v20 = 11 - v18; | |
4759 v116 = stru_F81018.field_0.field_8 >> i; | |
4760 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4761 v22 = stru_5C6E00; | |
4762 v122 = (unsigned __int16 *)v20; | |
323 | 4763 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4764 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4765 v120 = v116 + 4 * v23; |
4766 if ( v123 < v117 ) | |
4767 { | |
4768 v24 = (char *)&stru_F81018.field_34.field_8; | |
4769 v114 = &stru_F81018.field_34.field_8; | |
4770 a1 += 16; | |
4771 while ( 1 ) | |
4772 { | |
4773 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4774 v25 = *((int *)v24 - 2); | |
4775 LOWORD(v25) = 0; | |
4776 v115 = v97; | |
4777 v26 = stru_F8AD28.field_0 | v25; | |
4778 if ( v97 <= (unsigned int)v26 ) | |
4779 v115 = v26; | |
4780 v97 = v26; | |
4781 v27 = *((int *)v24 - 11); | |
4782 v28 = *((int *)v24 - 1); | |
4783 v105 = (&v86)[4 * v27]; | |
4784 v111 = v27 + 16; | |
4785 v29 = v4->uWidthMinus1; | |
4786 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4787 v107 = v29 >> v27; | |
4788 v30 = v28 >> i; | |
4789 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4790 v31 = *v114 >> i; | |
4791 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4792 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4793 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4794 v108 = (signed int)(v116 - v121) >> 4; |
4795 v103 = (v90 - v120) >> 4; | |
4796 v32 = v123 + 32; | |
4797 if ( LOBYTE(viewparams->field_20) ) | |
4798 v32 = v123 + 64; | |
4799 if ( v32 > v117 ) | |
4800 v32 = v117; | |
4801 v118 = v32; | |
4802 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4803 v106 = (signed int)(v32 - v123) >> 1; | |
4804 if ( v110 >> 16 == v100 >> 16 ) | |
4805 { | |
4806 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4807 if ( LOBYTE(viewparams->field_20) ) | |
4808 { | |
4809 v44 = v123; | |
4810 if ( v123 < v118 ) | |
4811 { | |
4812 v45 = v119; | |
4813 v46 = v122; | |
4814 v47 = v121; | |
4815 v48 = v120; | |
4816 v49 = v111; | |
4817 v50 = v109; | |
4818 if ( v106 & 2 ) | |
4819 { | |
4820 *v119 = v115; | |
4821 v45 -= 2; | |
4822 v44 = v123 + 4; | |
4823 goto LABEL_37; | |
4824 } | |
4825 do | |
4826 { | |
4827 v44 += 8; | |
4828 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4829 v52 = v115; | |
4830 LOWORD(v51) = v46[v51]; | |
4831 *v45 = v115; | |
4832 v45[1] = v52; | |
4833 v45[640] = v52; | |
4834 v45[641] = v52; | |
4835 *(short *)(v44 - 8) = v51; | |
4836 *(short *)(v44 - 6) = v51; | |
4837 *(short *)(v44 + 1272) = v51; | |
4838 *(short *)(v44 + 1274) = v51; | |
4839 v45[2] = v52; | |
4840 v45[3] = v52; | |
4841 v45[642] = v52; | |
4842 v45[643] = v52; | |
4843 v121 += v108; | |
4844 v120 += v103; | |
4845 v47 = v121; | |
4846 v48 = v120; | |
4847 LABEL_37: | |
4848 v45 += 4; | |
4849 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4850 v54 = v108; | |
4851 *(short *)(v44 - 4) = v53; | |
4852 *(short *)(v44 - 2) = v53; | |
4853 *(short *)(v44 + 1276) = v53; | |
4854 *(short *)(v44 + 1278) = v53; | |
4855 v121 += v54; | |
4856 v120 += v103; | |
4857 v47 = v121; | |
4858 v48 = v120; | |
4859 } | |
4860 while ( v44 < v118 ); | |
4861 v123 = v44; | |
4862 v119 = v45; | |
4863 } | |
4864 } | |
4865 else | |
4866 { | |
4867 v33 = v123; | |
4868 if ( v123 < v118 ) | |
4869 { | |
4870 v34 = v119; | |
4871 v35 = v122; | |
4872 v36 = v121; | |
4873 v37 = v120; | |
4874 v38 = v111; | |
4875 v39 = v109; | |
4876 if ( v106 & 1 ) | |
4877 { | |
4878 *v119 = v115; | |
4879 --v34; | |
4880 v33 = v123 + 2; | |
4881 goto LABEL_30; | |
4882 } | |
4883 do | |
4884 { | |
4885 v33 += 4; | |
4886 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4887 v41 = v115; | |
4888 LOWORD(v40) = v35[v40]; | |
4889 *v34 = v115; | |
4890 *(short *)(v33 - 4) = v40; | |
4891 v34[1] = v41; | |
4892 v121 += v108; | |
4893 v120 += v103; | |
4894 v36 = v121; | |
4895 v37 = v120; | |
4896 LABEL_30: | |
4897 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4898 v34 += 2; | |
4899 v43 = v108; | |
4900 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4901 v121 += v43; | |
4902 v120 += v103; | |
4903 v36 = v121; | |
4904 v37 = v120; | |
4905 } | |
4906 while ( v33 < v118 ); | |
4907 v123 = v33; | |
4908 v119 = v34; | |
4909 } | |
4910 } | |
4911 } | |
4912 else | |
4913 { | |
4914 v55 = v110 - ((v100 - v110) >> 4); | |
4915 v110 = (v100 - v110) >> 4; | |
4916 v122 = (unsigned __int16 *)v55; | |
4917 if ( LOBYTE(viewparams->field_20) ) | |
4918 { | |
4919 v71 = v123; | |
4920 if ( v123 < v118 ) | |
4921 { | |
4922 v72 = v119; | |
4923 v73 = v94; | |
4924 v74 = v121; | |
4925 v75 = v120; | |
4926 v76 = v111; | |
4927 v77 = v109; | |
4928 if ( v106 & 2 ) | |
4929 { | |
4930 *v119 = v115; | |
4931 v72 += 2; | |
4932 v71 = v123 + 4; | |
4933 goto LABEL_52; | |
4934 } | |
4935 do | |
4936 { | |
4937 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4938 v79 = (int)((char *)v122 + v110); | |
4939 v71 += 8; | |
4940 v122 = (unsigned __int16 *)v79; | |
4941 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4942 v81 = v115; | |
4943 LOWORD(v80) = v73[v80]; | |
4944 *v72 = v115; | |
4945 v72[1] = v81; | |
4946 v72[640] = v81; | |
4947 v72[641] = v81; | |
4948 *(short *)(v71 - 8) = v80; | |
4949 *(short *)(v71 - 6) = v80; | |
4950 *(short *)(v71 + 1272) = v80; | |
4951 *(short *)(v71 + 1274) = v80; | |
4952 v72[2] = v81; | |
4953 v72[3] = v81; | |
4954 v72[642] = v81; | |
4955 v72[643] = v81; | |
4956 v121 += v108; | |
4957 v120 += v103; | |
4958 v74 = v121; | |
4959 v75 = v120; | |
4960 v72 += 4; | |
4961 LABEL_52: | |
4962 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4963 v83 = (int)((char *)v122 + v110); | |
4964 v84 = v105[v82]; | |
4965 v122 = (unsigned __int16 *)v83; | |
4966 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4967 v85 = v108; | |
4968 *(short *)(v71 - 4) = v84; | |
4969 *(short *)(v71 - 2) = v84; | |
4970 *(short *)(v71 + 1276) = v84; | |
4971 *(short *)(v71 + 1278) = v84; | |
4972 v121 += v85; | |
4973 v120 += v103; | |
4974 v74 = v121; | |
4975 v75 = v120; | |
4976 } | |
4977 while ( v71 < v118 ); | |
4978 v123 = v71; | |
4979 v119 = v72; | |
4980 } | |
4981 } | |
4982 else | |
4983 { | |
4984 v56 = v123; | |
4985 if ( v123 < v118 ) | |
4986 { | |
4987 v57 = v119; | |
4988 v58 = v94; | |
4989 v59 = v121; | |
4990 v60 = v120; | |
4991 v61 = v111; | |
4992 v62 = v109; | |
4993 if ( v106 & 1 ) | |
4994 { | |
4995 *v119 = v115; | |
4996 ++v57; | |
4997 v56 = v123 + 2; | |
4998 goto LABEL_45; | |
4999 } | |
5000 do | |
5001 { | |
5002 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5003 v64 = (int)((char *)v122 + v110); | |
5004 v56 += 4; | |
5005 v122 = (unsigned __int16 *)v64; | |
5006 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
5007 v66 = v115; | |
5008 LOWORD(v65) = v58[v65]; | |
5009 *v57 = v115; | |
5010 *(short *)(v56 - 4) = v65; | |
5011 v57[1] = v66; | |
5012 v121 += v108; | |
5013 v120 += v103; | |
5014 v59 = v121; | |
5015 v60 = v120; | |
5016 v57 += 2; | |
5017 LABEL_45: | |
5018 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5019 v68 = (int)((char *)v122 + v110); | |
5020 v69 = v105[v67]; | |
5021 v122 = (unsigned __int16 *)v68; | |
5022 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
5023 v70 = v108; | |
5024 *(short *)(v56 - 2) = v69; | |
5025 v121 += v70; | |
5026 v120 += v103; | |
5027 v59 = v121; | |
5028 v60 = v120; | |
5029 } | |
5030 while ( v56 < v118 ); | |
5031 v123 = v56; | |
5032 v119 = v57; | |
5033 } | |
5034 } | |
5035 } | |
5036 v114 += 13; | |
5037 v110 = v100; | |
5038 a1 += 16; | |
5039 v4 = v96; | |
5040 v121 = v116; | |
5041 v120 = v90; | |
5042 if ( v123 >= v117 ) | |
5043 break; | |
5044 v24 = (char *)v114; | |
5045 v22 = stru_5C6E00; | |
5046 } | |
5047 } | |
5048 ++a2; | |
5049 v98 += v95; | |
5050 result = a2; | |
5051 v101 += 2; | |
5052 v99 += 640; | |
5053 if ( a2 > stru_F8A590._viewport_space_w ) | |
5054 break; | |
5055 v12 = v101; | |
5056 result = a2; | |
5057 v11 = v98; | |
5058 } | |
5059 } | |
5060 } | |
5061 } | |
5062 } | |
5063 } | |
5064 } | |
5065 } | |
5066 return result; | |
5067 } | |
5068 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5069 | |
5070 //----- (004ADD1D) -------------------------------------------------------- | |
5071 void __fastcall sub_4ADD1D(int uFaceID) | |
5072 { | |
5073 int v1; // edi@1 | |
5074 BLVFace *v2; // esi@3 | |
5075 signed int v3; // ebx@4 | |
5076 Texture *v4; // edi@9 | |
5077 signed int v5; // eax@9 | |
5078 char *v6; // edi@12 | |
5079 signed int v7; // eax@15 | |
5080 unsigned int v8; // eax@16 | |
5081 __int16 v9; // cx@19 | |
5082 unsigned __int8 *v10; // eax@19 | |
5083 unsigned __int16 *v11; // eax@19 | |
5084 int v12; // edi@19 | |
5085 int v13; // ebx@20 | |
5086 stru352 *v14; // esi@20 | |
5087 DWORD v15; // eax@22 | |
5088 signed int v16; // ecx@22 | |
5089 signed int v17; // ST68_4@22 | |
5090 int v18; // eax@22 | |
5091 int v19; // ecx@22 | |
5092 unsigned int v20; // esi@23 | |
5093 int v21; // edi@23 | |
5094 int v22; // eax@23 | |
5095 int *v23; // ebx@24 | |
5096 int v24; // edx@24 | |
5097 int v25; // ebx@25 | |
5098 unsigned __int16 v26; // cx@25 | |
5099 int v27; // edx@26 | |
5100 unsigned __int16 v28; // cx@26 | |
5101 unsigned __int8 v29; // sf@27 | |
5102 unsigned __int8 v30; // of@27 | |
5103 unsigned int v31; // esi@29 | |
5104 int v32; // edi@29 | |
5105 unsigned __int16 *v33; // eax@29 | |
5106 int *v34; // ebx@30 | |
5107 int v35; // edx@30 | |
5108 int v36; // ebx@31 | |
5109 unsigned __int16 v37; // cx@31 | |
5110 int v38; // edx@32 | |
5111 unsigned __int16 v39; // cx@32 | |
5112 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5113 int v41; // [sp-Ch] [bp-68h]@15 | |
5114 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5115 signed int v43; // [sp+14h] [bp-48h]@12 | |
5116 signed int v44; // [sp+14h] [bp-48h]@22 | |
5117 int v45; // [sp+1Ch] [bp-40h]@22 | |
5118 int v46; // [sp+20h] [bp-3Ch]@22 | |
5119 int v47; // [sp+24h] [bp-38h]@19 | |
5120 char v48; // [sp+28h] [bp-34h]@19 | |
5121 int v49; // [sp+2Ch] [bp-30h]@19 | |
5122 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5123 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5124 int v52; // [sp+38h] [bp-24h]@22 | |
5125 int v53; // [sp+3Ch] [bp-20h]@22 | |
5126 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5127 int v55; // [sp+40h] [bp-1Ch]@20 | |
5128 int v56; // [sp+44h] [bp-18h]@20 | |
5129 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5130 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5131 int v59; // [sp+50h] [bp-Ch]@4 | |
5132 int v60; // [sp+50h] [bp-Ch]@19 | |
5133 int v61; // [sp+54h] [bp-8h]@22 | |
5134 int *v62; // [sp+58h] [bp-4h]@23 | |
5135 int *v63; // [sp+58h] [bp-4h]@29 | |
5136 | |
5137 v1 = uFaceID; | |
5138 v42 = pRenderer->uTargetSurfacePitch; | |
5139 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5140 { | |
5141 v2 = &pIndoor->pFaces[uFaceID]; | |
5142 if ( pRenderer->pRenderD3D ) | |
5143 { | |
5144 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5145 v59 = v3; | |
5146 } | |
5147 else | |
5148 { | |
5149 v59 = sub_423B5D(uFaceID); | |
5150 v3 = v59; | |
5151 } | |
5152 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5153 { | |
5154 v4 = v2->GetTexture(); | |
5155 v5 = 0; | |
5156 if ( v4 ) | |
5157 { | |
5158 if ( pRenderer->pRenderD3D ) | |
5159 { | |
5160 if ( v3 > 0 ) | |
5161 { | |
5162 v54 = v3; | |
5163 v43 = v3; | |
5164 v6 = (char *)&array_507D30[0].v; | |
5165 do | |
5166 { | |
5167 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5168 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5169 v6 += 48; | |
5170 --v54; | |
5171 } | |
5172 while ( v54 ); | |
5173 v3 = v59; | |
5174 v5 = v43; | |
5175 } | |
5176 v7 = v5; | |
5177 v41 = stru_F8AD28.field_0; | |
5178 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5179 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5180 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5181 { | |
5182 v40 = v2->GetTexture(); | |
5183 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5184 } | |
5185 else | |
5186 { | |
5187 v40 = v2->GetTexture(); | |
5188 v8 = v2->uBitmapID; | |
5189 } | |
5190 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5191 } | |
5192 else | |
5193 { | |
5194 v49 = v4->uWidthMinus1; | |
5195 v47 = v4->uHeightMinus1 << 16; | |
5196 v9 = 16 - v4->uWidthLn2; | |
710 | 5197 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5198 LOBYTE(v2->uAttributes) |= 0x80u; |
5199 v48 = v9; | |
5200 v50 = v10; | |
5201 sub_4AF412(); | |
5202 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5203 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5204 v12 = stru_F8A590._viewport_space_y; | |
5205 v51 = v11; | |
5206 v60 = stru_F8A590._viewport_space_y; | |
5207 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5208 { | |
5209 v13 = 2 * stru_F8A590._viewport_space_y; | |
5210 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5211 v55 = 2 * stru_F8A590._viewport_space_y; | |
5212 v56 = 640 * stru_F8A590._viewport_space_y; | |
5213 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5214 { | |
5215 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5216 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5217 v15 = GetTickCount(); | |
5218 v16 = v14->field_0; | |
5219 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5220 v45 = v14->field_4 >> 3; | |
5221 v44 = v16 >> 3; | |
5222 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5223 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5224 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5225 v18 = v14->field_28; | |
5226 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5227 LOWORD(v18) = 0; | |
5228 v46 = stru_F8AD28.field_0 | v18; | |
5229 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5230 if ( LOBYTE(viewparams->field_20) ) | |
5231 { | |
5232 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5233 - pBLVRenderParams->uViewportX]; | |
5234 v31 = v44; | |
5235 v32 = v45; | |
5236 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5237 + 2 * v19 | |
5238 - pBLVRenderParams->uViewportX]; | |
5239 if ( v61 & 1 ) | |
5240 { | |
5241 --v61; | |
5242 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5243 + 2 * v19 | |
5244 - pBLVRenderParams->uViewportX | |
5245 - 2]; | |
5246 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5247 - pBLVRenderParams->uViewportX]; | |
5248 v35 = v46; | |
5249 v63 += 2; | |
5250 goto LABEL_32; | |
5251 } | |
5252 while ( 1 ) | |
5253 { | |
5254 v30 = __OFSUB__(v61, 2); | |
5255 v29 = v61 - 2 < 0; | |
5256 v61 -= 2; | |
5257 if ( v29 ^ v30 ) | |
5258 break; | |
5259 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5260 v31 += v52; | |
5261 v37 = v51[v36]; | |
5262 v32 += v53; | |
5263 v34 = v63; | |
5264 v35 = v46; | |
5265 *v33 = v37; | |
5266 v33[1] = v37; | |
5267 v33[640] = v37; | |
5268 v33[641] = v37; | |
5269 v63 += 4; | |
5270 v34[2] = v46; | |
5271 v34[3] = v46; | |
5272 v34[642] = v46; | |
5273 v34[643] = v46; | |
5274 LABEL_32: | |
5275 *v34 = v35; | |
5276 v34[1] = v35; | |
5277 v34[640] = v35; | |
5278 v34[641] = v35; | |
5279 v38 = v49 & (v31 >> 16); | |
5280 v33 += 4; | |
5281 v31 += v52; | |
5282 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5283 v32 += v53; | |
5284 *(v33 - 2) = v39; | |
5285 *(v33 - 1) = v39; | |
5286 v33[638] = v39; | |
5287 v33[639] = v39; | |
5288 } | |
5289 } | |
5290 else | |
5291 { | |
5292 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5293 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5294 v20 = v44; | |
5295 v21 = v45; | |
5296 v22 = (int)v58; | |
5297 if ( v61 & 1 ) | |
5298 { | |
5299 --v61; | |
5300 v22 = (int)(v58 - 1); | |
5301 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5302 v24 = v46; | |
5303 ++v62; | |
5304 goto LABEL_26; | |
5305 } | |
5306 while ( 1 ) | |
5307 { | |
5308 v30 = __OFSUB__(v61, 2); | |
5309 v29 = v61 - 2 < 0; | |
5310 v61 -= 2; | |
5311 if ( v29 ^ v30 ) | |
5312 break; | |
5313 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5314 v20 += v52; | |
5315 v26 = v51[v25]; | |
5316 v21 += v53; | |
5317 v23 = v62; | |
5318 v24 = v46; | |
5319 *(short *)v22 = v26; | |
5320 v62 += 2; | |
5321 v23[1] = v46; | |
5322 LABEL_26: | |
5323 *v23 = v24; | |
5324 v27 = v49 & (v20 >> 16); | |
5325 v22 += 4; | |
5326 v20 += v52; | |
5327 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5328 v21 += v53; | |
5329 *(short *)(v22 - 2) = v28; | |
5330 } | |
5331 } | |
5332 ++v60; | |
5333 ++i; | |
5334 v56 += 640; | |
5335 v55 += 2; | |
5336 if ( v60 > stru_F8A590._viewport_space_w ) | |
5337 break; | |
5338 v13 = v55; | |
5339 v12 = v60; | |
5340 } | |
5341 } | |
5342 } | |
5343 } | |
5344 } | |
5345 } | |
5346 } | |
5347 | |
5348 //----- (004AE1E7) -------------------------------------------------------- | |
5349 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5350 { | |
5351 int v3; // ebx@1 | |
5352 int v4; // edi@1 | |
5353 int v5; // esi@1 | |
5354 signed __int64 v6; // qtt@3 | |
5355 int v7; // esi@3 | |
5356 int v8; // eax@5 | |
5357 int result; // eax@5 | |
5358 int v10; // edx@5 | |
5359 int v11; // [sp+Ch] [bp-8h]@1 | |
5360 int v12; // [sp+1Ch] [bp+8h]@2 | |
5361 | |
5362 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5363 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5364 v11 = a1; | |
5365 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5366 + stru_F8AD28.field_7C | |
5367 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5368 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5369 { | |
5370 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5371 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5372 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5373 } | |
5374 else | |
5375 { | |
5376 v7 = 1073741824; | |
5377 } | |
5378 v8 = stru_F8AD28.vec_9C.z; | |
5379 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5380 + stru_F8AD28.vec_8C.x | |
5381 + v4 * stru_F8AD28.vec_8C.y) | |
5382 * (signed __int64)v7) >> 16) | |
5383 + stru_F8AD28.field_98; | |
5384 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5385 v10 = result + stru_F8AD28.field_A8; | |
5386 stru_F83B80[v11].field_28 = v7; | |
5387 stru_F83B80[v11].field_4 = v10; | |
5388 return result; | |
5389 } | |
5390 | |
5391 //----- (004AE313) -------------------------------------------------------- | |
5392 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5393 { | |
5394 int _dy; // ebx@1 | |
5395 int _dx; // edi@1 | |
5396 int v5; // ecx@1 | |
5397 int v6; // esi@1 | |
5398 int v7; // ST18_4@2 | |
5399 signed __int64 v8; // qtt@3 | |
5400 unsigned int v9; // ecx@3 | |
5401 int result; // eax@8 | |
5402 int v11; // [sp+Ch] [bp-8h]@1 | |
5403 | |
5404 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5405 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5406 ++pBLVRenderParams->field_88; | |
5407 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5408 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5409 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5410 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5411 { | |
5412 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5413 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5414 v9 = v8 / v11; | |
5415 } | |
5416 else | |
5417 { | |
5418 v9 = 0x40000000u; | |
5419 } | |
5420 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5421 p->field_0 = v9; | |
5422 else | |
5423 p->field_0 = stru_F8AD28.field_34; | |
5424 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5425 * (signed __int64)(signed int)v9) >> 16) | |
5426 + stru_F8AD28.field_98 | |
5427 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5428 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5429 * (signed __int64)(signed int)v9) >> 16) | |
5430 + stru_F8AD28.field_A8 | |
5431 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5432 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5433 if ( result < 369620 || bUseLoResSprites ) | |
5434 { | |
5435 if ( result < 184810 ) | |
5436 p->field_10 = result > 92405; | |
5437 else | |
5438 p->field_10 = 2; | |
5439 } | |
5440 else | |
5441 { | |
5442 p->field_10 = 3; | |
5443 } | |
5444 return result; | |
5445 } | |
5446 | |
5447 //----- (004AE491) -------------------------------------------------------- | |
5448 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5449 { | |
5450 signed int v2; // eax@1 | |
5451 signed int v3; // edi@1 | |
5452 int v4; // ecx@1 | |
5453 int v5; // esi@2 | |
5454 int v6; // eax@2 | |
5455 int v7; // ebx@2 | |
5456 unsigned int v8; // ecx@2 | |
5457 int v9; // edx@5 | |
5458 int v10; // edx@7 | |
5459 unsigned int v11; // eax@8 | |
5460 int v13; // [sp+4h] [bp-18h]@2 | |
5461 int v14; // [sp+8h] [bp-14h]@2 | |
5462 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5463 int v16; // [sp+14h] [bp-8h]@1 | |
5464 int v17; // [sp+18h] [bp-4h]@1 | |
5465 | |
5466 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5467 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5468 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5469 v4 = 0; | |
5470 v15 = v2; | |
5471 v16 = 0; | |
5472 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5473 { | |
5474 do | |
5475 { | |
5476 v5 = v16; | |
5477 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5478 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5479 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5480 v7 = v13; | |
5481 v8 = v14; | |
5482 if ( v6 < v13 ) | |
5483 { | |
5484 v6 = v13; | |
5485 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5486 } | |
5487 if ( v6 < v14 ) | |
5488 { | |
5489 v9 = v6; | |
5490 v6 = v14; | |
5491 v8 = v9; | |
5492 } | |
5493 if ( v7 < (signed int)v8 ) | |
5494 { | |
5495 v10 = v8; | |
5496 v8 = v7; | |
5497 v7 = v10; | |
5498 } | |
5499 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5500 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5501 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5502 ++v16; | |
5503 v2 = v15; | |
5504 } | |
5505 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5506 v4 = 0; | |
5507 } | |
5508 if ( stru_F8AD28.field_3E4 != v4 ) | |
5509 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5510 if ( v17 >= v4 ) | |
5511 { | |
5512 if ( v17 > 2031616 ) | |
5513 v17 = 2031616; | |
5514 } | |
5515 else | |
5516 { | |
5517 v17 = v4; | |
5518 } | |
5519 ++pBLVRenderParams->field_8C; | |
5520 return v17; | |
5521 } | |
5522 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5523 | |
5524 | |
5525 | |
5526 | |
5527 //----- (004AE5F1) -------------------------------------------------------- | |
5528 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5529 { | |
5530 BLVFace *v1; // esi@1 | |
5531 BLVFaceExtra *v2; // ebx@1 | |
5532 int v3; // eax@1 | |
5533 int v4; // edi@1 | |
5534 Texture *v5; // edi@1 | |
5535 int v6; // eax@1 | |
5536 unsigned int v7; // eax@1 | |
5537 unsigned int v8; // ecx@1 | |
5538 unsigned int v9; // eax@1 | |
5539 unsigned int v10; // ecx@5 | |
5540 int v11; // edi@10 | |
5541 int v12; // ecx@10 | |
5542 int v13; // eax@10 | |
5543 int v14; // edx@10 | |
5544 int v15; // ebx@12 | |
5545 double v16; // st7@16 | |
5546 int v17; // eax@16 | |
5547 char *v18; // ebx@17 | |
5548 int v19; // ecx@19 | |
5549 int v20; // eax@19 | |
5550 int v21; // edx@21 | |
5551 int v22; // eax@23 | |
5552 int v23; // ST04_4@26 | |
5553 int v24; // edi@26 | |
5554 double v25; // st6@26 | |
5555 int v26; // eax@26 | |
5556 double v27; // st6@26 | |
5557 int v28; // ecx@26 | |
5558 char v29; // al@26 | |
5559 int v30; // edx@28 | |
5560 int v31; // ecx@28 | |
5561 BLVLightMM7 *v32; // ecx@32 | |
5562 int v33; // edi@33 | |
5563 int v34; // edx@33 | |
5564 int v35; // eax@33 | |
5565 int v36; // edi@35 | |
5566 int v37; // edx@37 | |
5567 int v38; // ebx@39 | |
5568 int v39; // edi@42 | |
5569 int v40; // eax@42 | |
5570 char *v41; // ebx@45 | |
5571 signed int v42; // ecx@47 | |
5572 int v43; // edi@47 | |
5573 int v44; // eax@49 | |
5574 int v45; // edx@51 | |
5575 int v46; // eax@53 | |
5576 int v47; // ST04_4@55 | |
5577 int v48; // edi@55 | |
5578 double v49; // st6@55 | |
5579 int v50; // eax@55 | |
5580 double v51; // st6@55 | |
5581 int v52; // eax@55 | |
5582 int v53; // ecx@57 | |
5583 int v54; // ecx@58 | |
5584 int v55; // ecx@59 | |
5585 int v56; // edx@62 | |
5586 int v57; // ecx@62 | |
5587 int v58; // eax@63 | |
5588 int v59; // edx@64 | |
5589 int v60; // ecx@67 | |
5590 int v61; // edx@67 | |
5591 int v62; // eax@68 | |
5592 int v63; // edx@69 | |
5593 signed int v64; // ecx@72 | |
5594 double v65; // st7@75 | |
5595 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5596 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5597 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5598 int v69; // [sp+28h] [bp-18h]@10 | |
5599 int v70; // [sp+2Ch] [bp-14h]@10 | |
5600 int X; // [sp+30h] [bp-10h]@10 | |
5601 int v72; // [sp+34h] [bp-Ch]@10 | |
5602 int v73; // [sp+38h] [bp-8h]@10 | |
5603 int v74; // [sp+3Ch] [bp-4h]@10 | |
5604 | |
5605 v1 = &pIndoor->pFaces[uFaceID]; | |
5606 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5607 v3 = v1->uBitmapID; | |
5608 v4 = v1->uBitmapID; | |
5609 v68 = v2; | |
5610 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5611 v6 = 8 * uFaceID; | |
5612 LOBYTE(v6) = 8 * uFaceID | 6; | |
5613 stru_F8AD28.field_0 = v6; | |
5614 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5615 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5616 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5617 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5618 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5619 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5620 v7 = GetTickCount(); | |
5621 v8 = v1->uAttributes; | |
5622 v9 = v7 >> 3; | |
5623 if ( v8 & 4 ) | |
5624 { | |
5625 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5626 } | |
5627 else | |
5628 { | |
5629 if ( v8 & 0x20 ) | |
5630 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5631 } | |
5632 v10 = v1->uAttributes; | |
5633 if ( BYTE1(v10) & 8 ) | |
5634 { | |
5635 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5636 } | |
5637 else | |
5638 { | |
5639 if ( v10 & 0x40 ) | |
5640 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5641 } | |
5642 v1->_get_normals(&v67, &v66); | |
5643 stru_F8AD28.vec_14.x = v67.x; | |
5644 stru_F8AD28.vec_14.y = v67.y; | |
5645 stru_F8AD28.vec_14.z = v67.z; | |
5646 stru_F8AD28.vec_20.x = v66.x; | |
5647 stru_F8AD28.vec_20.y = v66.y; | |
5648 stru_F8AD28.vec_20.z = v66.z; | |
5649 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5650 if ( pBLVRenderParams->sPartyRotX ) | |
5651 { | |
5652 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5653 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5654 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5655 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5656 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5657 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5658 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5659 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5660 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5661 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5662 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5663 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5664 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5665 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5666 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5667 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5668 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5669 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5670 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5671 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5672 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5673 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5674 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5675 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5676 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5677 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5678 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5679 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5680 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5681 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5682 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5683 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5684 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5685 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5686 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5687 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5688 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5689 v13 = pBLVRenderParams->vPartyPos.y; | |
5690 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5691 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5692 v14 = pBLVRenderParams->vPartyPos.x; | |
5693 } | |
5694 else | |
5695 { | |
5696 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5697 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5698 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5699 - v70; | |
5700 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5701 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5702 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5703 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5704 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5705 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5706 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5707 - v70; | |
5708 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5709 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5710 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5711 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5712 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5713 - v70; | |
5714 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5715 v14 = pBLVRenderParams->vPartyPos.x; | |
5716 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5717 v13 = pBLVRenderParams->vPartyPos.y; | |
5718 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5719 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5720 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5721 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5722 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5723 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5724 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5725 } | |
5726 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5727 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5728 + stru_F8AD28.plane_4.dist | |
5729 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5730 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5731 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5732 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5733 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5734 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5735 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5736 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5737 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5738 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5739 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5740 v15 = v70; | |
5741 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5742 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5743 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5744 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5745 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5746 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5747 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5748 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5749 stru_F8AD28.field_38 = 0; | |
5750 stru_F8AD28.field_A8 = -(X | |
5751 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5752 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5753 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5754 { | |
5755 stru_F8AD28.field_3E4 = 1; | |
5756 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5757 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5758 stru_F8AD28.field_3F0 = v68->field_1E; | |
5759 stru_F8AD28.field_3F4 = v68->field_20; | |
5760 } | |
5761 else | |
5762 { | |
5763 stru_F8AD28.field_3E4 = 0; | |
5764 } | |
5765 v16 = 0.0039215689; | |
5766 v17 = 116 * v1->uSectorID; | |
5767 v69 = v17; | |
5768 v74 = 0; | |
5769 v73 = 0; | |
5770 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5771 v70 = pMobileLightsStack->uNumLightsActive; | |
5772 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5773 { | |
5774 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5775 do | |
5776 { | |
5777 if ( v74 >= 20 ) | |
5778 break; | |
5779 v19 = *((short *)v18 + 2); | |
5780 v20 = *((short *)v18 - 1); | |
5781 if ( v20 > v1->pBounding.x1 - v19 ) | |
5782 { | |
5783 if ( v20 < v19 + v1->pBounding.x2 ) | |
5784 { | |
5785 v21 = *(short *)v18; | |
5786 if ( v21 > v1->pBounding.y1 - v19 ) | |
5787 { | |
5788 if ( v21 < v19 + v1->pBounding.y2 ) | |
5789 { | |
5790 v22 = *((short *)v18 + 1); | |
5791 if ( v22 > v1->pBounding.z1 - v19 ) | |
5792 { | |
5793 if ( v22 < v19 + v1->pBounding.z2 ) | |
5794 { | |
5795 X = (v1->pFacePlane_old.dist | |
5796 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5797 + v21 * v1->pFacePlane_old.vNormal.y | |
5798 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5799 if ( X <= v19 ) | |
5800 { | |
5801 v23 = X; | |
5802 v24 = v74; | |
5803 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5804 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5805 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5806 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5807 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5808 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5809 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5810 v25 = (double)(signed int)v68 * v16; | |
5811 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5812 v26 = (unsigned __int8)v18[8]; | |
5813 *(float *)(v24 * 4 + 16297992) = v25; | |
5814 v27 = (double)(signed int)v68; | |
5815 v68 = (BLVFaceExtra *)v26; | |
5816 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5817 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5818 v16 = 0.0039215689; | |
5819 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5820 v28 = v74; | |
5821 v29 = v18[9]; | |
5822 ++v74; | |
5823 stru_F8AD28._blv_lights_types[v28] = v29; | |
5824 } | |
5825 } | |
5826 } | |
5827 } | |
5828 } | |
5829 } | |
5830 } | |
5831 ++v73; | |
5832 v18 += 18; | |
5833 v17 = v69; | |
5834 } | |
5835 while ( v73 < v70 ); | |
5836 } | |
5837 v30 = 0; | |
5838 v73 = 0; | |
5839 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5840 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5841 if ( v31 > 0 ) | |
5842 { | |
5843 while ( v74 < 20 ) | |
5844 { | |
5845 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5846 if ( !(v32->uAtributes & 8) ) | |
5847 { | |
5848 v33 = v1->pBounding.x1; | |
5849 v34 = v32->vPosition.x; | |
5850 X = v32->uBrightness; | |
5851 v35 = v32->uRadius; | |
5852 v68 = (BLVFaceExtra *)v32->uRadius; | |
5853 if ( v34 > v33 - v35 ) | |
5854 { | |
5855 if ( v34 < v35 + v1->pBounding.x2 ) | |
5856 { | |
5857 v36 = v32->vPosition.y; | |
5858 if ( v36 > v1->pBounding.y1 - v35 ) | |
5859 { | |
5860 if ( v36 < v35 + v1->pBounding.y2 ) | |
5861 { | |
5862 v37 = v32->vPosition.z; | |
5863 if ( v37 > v1->pBounding.z1 - v35 ) | |
5864 { | |
5865 if ( v37 < v35 + v1->pBounding.z2 ) | |
5866 { | |
5867 v38 = (v1->pFacePlane_old.dist | |
5868 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5869 + v37 * v1->pFacePlane_old.vNormal.z | |
5870 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5871 if ( v38 >= 0 ) | |
5872 { | |
5873 if ( v38 <= v35 && v35 ) | |
5874 { | |
5875 v39 = v74; | |
5876 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5877 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5878 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5879 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5880 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5881 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5882 v68 = (BLVFaceExtra *)v32->uRed; | |
5883 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5884 v68 = (BLVFaceExtra *)v32->uGreen; | |
5885 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5886 v68 = (BLVFaceExtra *)v32->uBlue; | |
5887 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5888 v16 = 0.0039215689; | |
5889 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5890 v40 = v74++; | |
5891 stru_F8AD28._blv_lights_types[v40] = 1; | |
5892 } | |
5893 } | |
5894 } | |
5895 } | |
5896 } | |
5897 } | |
5898 } | |
5899 } | |
5900 } | |
5901 v30 = v73++ + 1; | |
5902 if ( v73 >= v70 ) | |
5903 break; | |
5904 v17 = v69; | |
5905 } | |
5906 } | |
5907 v73 = 0; | |
5908 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5909 { | |
5910 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5911 do | |
5912 { | |
5913 if ( v74 >= 20 ) | |
5914 break; | |
5915 v42 = *((short *)v41 + 2); | |
5916 v43 = *((short *)v41 - 1); | |
5917 if ( v43 > v1->pBounding.x1 - v42 ) | |
5918 { | |
5919 if ( v43 < v42 + v1->pBounding.x2 ) | |
5920 { | |
5921 v44 = *(short *)v41; | |
5922 if ( v44 > v1->pBounding.y1 - v42 ) | |
5923 { | |
5924 if ( v44 < v42 + v1->pBounding.y2 ) | |
5925 { | |
5926 v45 = *((short *)v41 + 1); | |
5927 if ( v45 > v1->pBounding.z1 - v42 ) | |
5928 { | |
5929 if ( v45 < v42 + v1->pBounding.z2 ) | |
5930 { | |
5931 v46 = (v1->pFacePlane_old.dist | |
5932 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5933 + v43 * v1->pFacePlane_old.vNormal.x | |
5934 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5935 v69 = v46; | |
5936 if ( v46 >= 0 ) | |
5937 { | |
5938 if ( v46 <= v42 ) | |
5939 { | |
5940 v47 = v69; | |
5941 v48 = v74; | |
5942 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5943 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5944 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5945 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5946 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5947 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5948 v49 = (double)(signed int)v68 * v16; | |
5949 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5950 v50 = (unsigned __int8)v41[8]; | |
5951 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5952 v51 = (double)(signed int)v68; | |
5953 v68 = (BLVFaceExtra *)v50; | |
5954 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5955 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5956 v16 = 0.0039215689; | |
5957 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5958 v52 = v74++; | |
5959 stru_F8AD28._blv_lights_types[v52] = 1; | |
5960 } | |
5961 } | |
5962 } | |
5963 } | |
5964 } | |
5965 } | |
5966 } | |
5967 } | |
5968 ++v73; | |
5969 v41 += 12; | |
5970 } | |
5971 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5972 } | |
5973 stru_F8AD28.uNumLightsApplied = v74; | |
5974 v53 = v1->pBounding.x2; | |
5975 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5976 { | |
5977 v55 = v1->pBounding.x1; | |
5978 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5979 v54 = 0; | |
5980 else | |
5981 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5982 } | |
5983 else | |
5984 { | |
5985 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5986 } | |
5987 v56 = v1->pBounding.y2; | |
5988 v57 = v54 * v54; | |
5989 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5990 { | |
5991 v59 = v1->pBounding.y1; | |
5992 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5993 v58 = 0; | |
5994 else | |
5995 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5996 } | |
5997 else | |
5998 { | |
5999 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
6000 } | |
6001 v60 = v58 * v58 + v57; | |
6002 v61 = v1->pBounding.z2; | |
6003 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
6004 { | |
6005 v63 = v1->pBounding.z1; | |
6006 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
6007 v62 = 0; | |
6008 else | |
6009 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
6010 } | |
6011 else | |
6012 { | |
6013 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
6014 } | |
6015 v64 = v62 * v62 + v60; | |
6016 if ( v64 ) | |
295 | 6017 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 6018 else |
6019 stru_F8AD28.field_34 = 0; | |
6020 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
6021 v65 = (double)(signed int)v68; | |
6022 if ( v65 >= 655.36 ) | |
6023 { | |
6024 if ( v65 >= 26214.4 ) | |
6025 { | |
6026 if ( v65 >= 45875.2 ) | |
6027 { | |
6028 stru_F8AD28.field_44 = 8; | |
6029 stru_F8AD28.field_48 = 3; | |
6030 } | |
6031 else | |
6032 { | |
6033 stru_F8AD28.field_44 = 16; | |
6034 stru_F8AD28.field_48 = 4; | |
6035 } | |
6036 } | |
6037 else | |
6038 { | |
6039 stru_F8AD28.field_44 = 32; | |
6040 stru_F8AD28.field_48 = 5; | |
6041 } | |
6042 } | |
6043 else | |
6044 { | |
6045 stru_F8AD28.field_44 = 64; | |
6046 stru_F8AD28.field_48 = 6; | |
6047 } | |
6048 } | |
6049 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
6050 | |
6051 //----- (004AF412) -------------------------------------------------------- | |
6052 int __cdecl sub_4AF412() | |
6053 { | |
6054 int v0; // ST20_4@2 | |
6055 int v1; // ST20_4@2 | |
6056 int v2; // ST20_4@2 | |
6057 int v3; // esi@2 | |
6058 int v4; // ST20_4@2 | |
6059 int v5; // ecx@2 | |
6060 int v6; // ebx@2 | |
6061 int v7; // edi@2 | |
6062 int v8; // edx@2 | |
6063 int v9; // eax@2 | |
6064 int result; // eax@4 | |
6065 | |
6066 stru_F8AD28.plane_4.vNormal.z = -65536; | |
6067 stru_F8AD28.vec_20.y = -65536; | |
6068 stru_F8AD28.plane_4.vNormal.x = 0; | |
6069 stru_F8AD28.plane_4.vNormal.y = 0; | |
6070 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
6071 stru_F8AD28.vec_14.x = 65536; | |
6072 stru_F8AD28.vec_14.y = 0; | |
6073 stru_F8AD28.vec_14.z = 0; | |
6074 stru_F8AD28.vec_20.x = 0; | |
6075 stru_F8AD28.vec_20.z = 0; | |
6076 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
6077 if ( pBLVRenderParams->sPartyRotX ) | |
6078 { | |
6079 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6080 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6081 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6082 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6083 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6084 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6085 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6086 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6087 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6088 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6089 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6090 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6091 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6092 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6093 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6094 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6095 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6096 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6097 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6098 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6099 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6100 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6101 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6102 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6103 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6104 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6105 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6106 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6107 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6108 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6109 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6110 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6111 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6112 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6113 v6 = pBLVRenderParams->vPartyPos.z; | |
6114 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6115 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6116 v8 = pBLVRenderParams->vPartyPos.y; | |
6117 v9 = pBLVRenderParams->vPartyPos.x; | |
6118 } | |
6119 else | |
6120 { | |
6121 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6122 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6123 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6124 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6125 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6126 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6127 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6128 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6129 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6130 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6131 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6132 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6133 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6134 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6135 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6136 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6137 v8 = pBLVRenderParams->vPartyPos.y; | |
6138 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6139 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6140 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6141 v9 = pBLVRenderParams->vPartyPos.x; | |
6142 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6143 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6144 v6 = pBLVRenderParams->vPartyPos.z; | |
6145 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6146 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6147 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6148 } | |
6149 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6150 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6151 + stru_F8AD28.plane_4.dist | |
6152 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6153 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6154 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6155 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6156 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6157 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6158 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6159 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6160 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6161 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6162 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6163 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6164 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6165 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6166 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6167 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6168 result = 0; | |
6169 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6170 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6171 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6172 stru_F8AD28.field_38 = 0; | |
6173 stru_F8AD28.field_3E4 = 0; | |
6174 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6175 stru_F8AD28.uNumLightsApplied = 0; | |
6176 stru_F8AD28.field_34 = 0; | |
6177 return result; | |
6178 } | |
6179 | |
6180 | |
6181 | |
6182 | |
6183 | |
6184 | |
6185 //----- (004B1447) -------------------------------------------------------- | |
6186 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6187 { | |
6188 signed int v3; // esi@1 | |
6189 char v4; // sf@8 | |
6190 int v5; // eax@8 | |
6191 unsigned __int64 v6; // qax@12 | |
6192 DDM_DLV_Header *v7; // eax@14 | |
6193 Player **v8; // edi@18 | |
6194 Player *result; // eax@19 | |
735 | 6195 //char *v10; // esi@20 |
0 | 6196 |
6197 v3 = 0; | |
6198 if ( a2 ) | |
6199 { | |
6200 if ( a2 != 1 ) | |
6201 { | |
6202 if ( a2 == 2 ) | |
6203 v3 = 2; | |
6204 goto LABEL_13; | |
6205 } | |
6206 v3 = 2; | |
6207 } | |
6208 else | |
6209 { | |
6210 v3 = 1; | |
6211 } | |
6212 if ( pParty->uFine < 4000000 ) | |
6213 { | |
6214 v4 = a3 + pParty->uFine < 0; | |
6215 v5 = a3 + pParty->uFine; | |
6216 pParty->uFine += a3; | |
6217 if ( v4 ) | |
6218 { | |
6219 v5 = 0; | |
6220 pParty->uFine = 0; | |
6221 } | |
6222 if ( v5 > 4000000 ) | |
6223 pParty->uFine = 4000000; | |
6224 } | |
487 | 6225 |
6226 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6227 | |
0 | 6228 LABEL_13: |
463 | 6229 pParty->InTheShopFlags[a1] = 1; |
0 | 6230 if ( v3 ) |
6231 { | |
6232 v7 = &pOutdoor->ddm; | |
6233 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6234 v7 = &pIndoor->dlv; | |
6235 v7->uReputation += v3; | |
6236 if ( v7->uReputation > 10000 ) | |
6237 v7->uReputation = 10000; | |
6238 } | |
6239 v8 = &pPlayers[1]; | |
6240 do | |
6241 { | |
6242 result = *v8; | |
6243 if ( pParty->uFine ) | |
6244 { | |
735 | 6245 //v10 = result->_guilds_member_bits; |
484 | 6246 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6247 if ( !(short)result ) |
735 | 6248 __debugbreak(); |
501 | 6249 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6250 } |
6251 ++v8; | |
6252 } | |
6253 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6254 return result; | |
6255 } | |
6256 | |
6257 //----- (004B1523) -------------------------------------------------------- | |
6258 char *__thiscall sub_4B1523(int *_this) | |
6259 { | |
6260 int v1; // esi@1 | |
6261 int v2; // edx@1 | |
6262 unsigned int v3; // eax@2 | |
6263 int v4; // eax@4 | |
6264 LONG v5; // ecx@4 | |
6265 int v6; // eax@10 | |
6266 char *v7; // ST44_4@12 | |
6267 unsigned __int16 v8; // ax@12 | |
6268 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6269 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6270 POINT a2; // [sp+64h] [bp-10h]@1 | |
6271 int v13; // [sp+6Ch] [bp-8h]@4 | |
6272 int v14; // [sp+70h] [bp-4h]@4 | |
6273 | |
6274 v1 = *_this - 399; | |
6275 v2 = (*_this - 400) % 11 + 1; | |
6276 v11 = 4 * (*_this - 400) / 11; | |
6277 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6278 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6279 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6280 else | |
6281 v3 = 30; | |
6282 a1.Hint = 0; | |
6283 a1.uFrameY = v3; | |
6284 a1.uFrameWidth = 328; | |
6285 a1.uFrameHeight = 68; | |
6286 a1.uFrameX = 90; | |
6287 a1.uFrameZ = 417; | |
6288 a1.uFrameW = v3 + 67; | |
6289 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6290 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6291 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6292 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6293 v5 = a2.y; | |
6294 if ( v14 > a2.y ) | |
6295 v5 = v14; | |
6296 if ( v13 > v5 ) | |
6297 v5 = v13; | |
6298 if ( v4 > v5 ) | |
6299 v5 = v4; | |
262 | 6300 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", |
6301 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6302 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6303 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6304 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6305 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6306 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6307 a1.uFrameHeight += v6; | |
6308 if ( (signed int)a1.uFrameHeight < 150 ) | |
6309 a1.uFrameHeight = 150; | |
6310 a1.uFrameWidth = 460; | |
6311 a1.DrawMessageBox(0); | |
6312 a1.uFrameWidth -= 12; | |
6313 a1.uFrameHeight -= 12; | |
6314 v7 = pSpellStats->pInfos[v1].pName; | |
6315 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6316 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6317 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6318 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6319 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6320 a1.uFrameZ = a1.uFrameX + 107; | |
6321 a1.uFrameWidth = 108; | |
6322 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6323 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
262 | 6324 return a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6325 } |
6326 | |
6327 | |
6328 //----- (004B1784) -------------------------------------------------------- | |
6329 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6330 { | |
6331 Player *pPlayer; // ebx@1 | |
6332 bool result; // eax@2 | |
6333 unsigned __int16 v2; // ST0C_2@3 | |
6334 int v3; // eax@3 | |
6335 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6336 | |
6337 pPlayer = pPlayers[uActiveCharacter]; | |
6338 if ( pPlayer->CanAct() ) | |
6339 { | |
6340 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6341 result = 1; | |
6342 } | |
6343 else | |
6344 { | |
6345 pDialogueWindow->pNumPresenceButton = 0; | |
6346 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6347 v4.uFrameX = 483; | |
6348 v4.uFrameWidth = 148; | |
6349 v4.uFrameZ = 334; | |
6350 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6351 // "%s is in no condition to %s" | |
6352 // "do anything" | |
758 | 6353 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6354 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6355 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6356 result = 0; | |
6357 } | |
6358 return result; | |
6359 } | |
6360 // F8B1E0: using guessed type int dword_F8B1E0; | |
6361 | |
6362 | |
463 | 6363 //view item details in shop? |
0 | 6364 //----- (004B1A2D) -------------------------------------------------------- |
6365 void __cdecl sub_4B1A2D() | |
6366 { | |
358 | 6367 //Player *v0; // edi@1 |
0 | 6368 POINT *v1; // esi@5 |
6369 unsigned int v2; // eax@5 | |
6370 int v3; // ecx@5 | |
6371 POINT *v4; // esi@12 | |
6372 int v5; // eax@12 | |
6373 unsigned int v6; // eax@13 | |
6374 ItemGen *v7; // ecx@13 | |
6375 signed int v8; // esi@17 | |
6376 unsigned int v9; // eax@19 | |
475 | 6377 POINT v10; // [sp+8h] [bp-44h]@12 |
6378 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6379 POINT v12; // [sp+18h] [bp-34h]@18 | |
6380 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6381 POINT v14; // [sp+28h] [bp-24h]@17 | |
6382 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6383 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6384 POINT a2; // [sp+40h] [bp-Ch]@5 |
6385 int v18; // [sp+48h] [bp-4h]@5 | |
6386 | |
358 | 6387 //v0 = pPlayers[uActiveCharacter]; |
484 | 6388 if ( in_current_building_type <= 0 ) |
0 | 6389 return; |
484 | 6390 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6391 { |
749 | 6392 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6393 { | |
6394 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6395 return; |
749 | 6396 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6397 { |
475 | 6398 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6399 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
6400 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
6401 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 6402 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 6403 return; |
358 | 6404 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 6405 LABEL_15: |
6406 GameUI_DrawItemInfo(v7); | |
6407 return; | |
6408 } | |
749 | 6409 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6410 return; |
6411 } | |
475 | 6412 v4 = pMouse->GetCursorPos(&v11); |
6413 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6414 v18 = v5; |
6415 if ( !v5 ) | |
6416 return; | |
336 | 6417 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6418 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6419 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
439 | 6420 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 6421 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 6422 goto LABEL_15; |
6423 } | |
749 | 6424 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS ) |
0 | 6425 { |
6426 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6427 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6428 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6429 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
6430 if ( v18 ) | |
336 | 6431 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6432 } |
6433 } | |
6434 // F8B198: using guessed type int dword_F8B198; | |
6435 // F8B19C: using guessed type int dword_F8B19C; | |
6436 | |
6437 //----- (004B1BDB) -------------------------------------------------------- | |
6438 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6439 { | |
6440 signed __int64 v1; // ST2C_8@1 | |
6441 signed __int64 v2; // qax@1 | |
6442 signed __int64 v3; // ST1C_8@1 | |
6443 unsigned __int64 v4; // qax@1 | |
6444 unsigned int v5; // ebx@1 | |
112 | 6445 Player *v6; // ebx@1 |
0 | 6446 |
6447 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6448 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6449 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6450 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6451 v2 = v1 / 60 / 60; | |
6452 v3 = v2; | |
6453 v4 = (unsigned int)v2 / 0x18; | |
6454 v5 = (unsigned int)(v4 / 7) >> 2; | |
6455 pParty->uCurrentTimeSecond = v1 % 60; | |
6456 pParty->uCurrentMinute = v1 / 60 % 60; | |
6457 pParty->uCurrentHour = v3 % 24; | |
6458 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6459 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6460 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6461 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6462 pParty->RestAndHeal(); |
6463 dword_507B94 = 1; | |
112 | 6464 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6465 do |
6466 { | |
112 | 6467 v6->uTimeToRecovery = 0; |
6468 memset(&v6->uTimeToRecovery, 0, 4u); | |
6469 ++v6; | |
6470 } | |
6471 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6472 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6473 } |
6474 // 507B94: using guessed type int dword_507B94; | |
6475 | |
6476 //----- (004B1D27) -------------------------------------------------------- | |
6477 void __cdecl sub_4B1D27() | |
6478 { | |
6479 int v0; // edx@2 | |
6480 unsigned int v1; // ecx@7 | |
6481 signed int v2; // edi@10 | |
6482 int v3; // esi@10 | |
6483 __int16 v4; // ax@15 | |
6484 signed int v5; // edi@20 | |
6485 int v6; // esi@20 | |
6486 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6487 | |
484 | 6488 if ( in_current_building_type > 0 ) |
0 | 6489 { |
6490 v0 = 3; | |
484 | 6491 if ( in_current_building_type > BildingType_MagicShop ) |
6492 { | |
6493 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6494 { |
6495 if ( !dword_F8B1E4 ) | |
6496 return; | |
6497 } | |
6498 else | |
6499 { | |
484 | 6500 if ( in_current_building_type != BildingType_Temple ) |
0 | 6501 return; |
6502 } | |
336 | 6503 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 6504 LABEL_28: |
735 | 6505 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6506 return; |
6507 } | |
336 | 6508 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6509 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6510 { |
6511 if ( pParty->uNumGold <= 0x2710 ) | |
6512 { | |
6513 if ( !dword_F8B1E4 ) | |
6514 return; | |
6515 v0 = 4; | |
6516 goto LABEL_28; | |
6517 } | |
735 | 6518 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6519 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6520 { | |
6521 v5 = 0; | |
6522 v6 = 1; | |
6523 do | |
6524 { | |
6525 if ( pPlayers[v6]->CanAct() ) | |
6526 v7[v5++] = v6; | |
6527 ++v6; | |
6528 } | |
6529 while ( v6 <= 4 ); | |
6530 if ( v5 ) | |
6531 { | |
6532 qword_A750D8 = 256i64; | |
6533 word_A750E0 = 80; | |
6534 v4 = LOWORD(v7[rand() % v5]); | |
6535 goto LABEL_16; | |
6536 } | |
6537 } | |
6538 } | |
6539 else | |
6540 { | |
6541 if ( !qword_A750D8 ) | |
6542 { | |
6543 v2 = 0; | |
6544 v3 = 1; | |
6545 do | |
6546 { | |
6547 if ( pPlayers[v3]->CanAct() ) | |
6548 v7[v2++] = v3; | |
6549 ++v3; | |
6550 } | |
6551 while ( v3 <= 4 ); | |
6552 if ( v2 ) | |
6553 { | |
6554 qword_A750D8 = 256i64; | |
6555 word_A750E0 = 80; | |
6556 v4 = LOWORD(v7[rand() % v2]); | |
6557 LABEL_16: | |
6558 word_A750E2 = v4; | |
6559 return; | |
6560 } | |
6561 } | |
6562 } | |
6563 } | |
6564 } | |
6565 | |
629 | 6566 |
0 | 6567 |
6568 //----- (004B1ECE) -------------------------------------------------------- | |
6569 void __cdecl sub_4B1ECE() | |
6570 { | |
6571 __int16 *v0; // edi@1 | |
6572 int v1; // ebx@3 | |
6573 Player *v2; // esi@3 | |
6574 int v3; // eax@4 | |
6575 signed int v4; // eax@9 | |
6576 int v5; // ebx@11 | |
89 | 6577 Player *v6; // esi@13 |
6578 ItemGen *v7; // eax@14 | |
0 | 6579 signed int v8; // edi@14 |
89 | 6580 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6581 signed int v10; // [sp+10h] [bp-8h]@13 |
6582 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6583 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6584 |
484 | 6585 contract_approved = 0; |
0 | 6586 v11 = 0; |
6587 uDialogueType = 84; | |
6588 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
6589 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; | |
6590 while ( 1 ) | |
6591 { | |
484 | 6592 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6593 { |
6594 v1 = 0; | |
6595 v2 = pParty->pPlayers; | |
6596 do | |
6597 { | |
89 | 6598 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6599 if ( v3 ) |
6600 break; | |
6601 ++v2; | |
6602 ++v1; | |
6603 } | |
6604 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6605 if ( v1 == 4 ) | |
6606 break; | |
6607 } | |
6608 ++v11; | |
6609 v0 += 2; | |
89 | 6610 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6611 break; | |
6612 } | |
6613 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6614 { | |
651 | 6615 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6616 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6617 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6618 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6619 } | |
484 | 6620 if ( contract_approved == 601 ) |
0 | 6621 { |
6622 v5 = 0; | |
89 | 6623 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6624 v9 = 0; |
6625 while ( 1 ) | |
6626 { | |
135 | 6627 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6628 { |
6629 v10 = 0; | |
89 | 6630 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6631 do |
6632 { | |
89 | 6633 v7 = v6->pInventoryItems; |
0 | 6634 v8 = 138; |
6635 do | |
6636 { | |
89 | 6637 if ( v7->uItemID == 601 ) |
0 | 6638 { |
377 | 6639 if ( !v7->uHolderPlayer ) |
89 | 6640 v9 = v7; |
377 | 6641 if ( v7->uHolderPlayer == v5 ) |
0 | 6642 v10 = 1; |
6643 } | |
89 | 6644 ++v7; |
0 | 6645 --v8; |
6646 } | |
6647 while ( v8 ); | |
89 | 6648 ++v6; |
6649 } | |
6650 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6651 if ( !v10 ) |
6652 break; | |
6653 } | |
89 | 6654 ++v12; |
0 | 6655 ++v5; |
89 | 6656 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6657 return; |
6658 } | |
6659 if ( v9 ) | |
377 | 6660 v9->uHolderPlayer = v5; |
0 | 6661 } |
6662 } | |
503 | 6663 |
0 | 6664 // 4F08EC: using guessed type int dword_4F08EC[]; |
6665 // 722B3C: using guessed type int dword_722B3C; | |
6666 // 722B44: using guessed type int dword_722B44; | |
6667 // F8B1A8: using guessed type int dword_F8B1A8; | |
6668 | |
6669 //----- (004B2001) -------------------------------------------------------- | |
459 | 6670 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6671 { | |
6672 //signed int v1; // eax@1 | |
6673 NPCData *pCurrentNPCInfo; // ebp@1 | |
6674 int pEventNumber; // ecx@8 | |
0 | 6675 Player *v4; // esi@20 |
467 | 6676 //int v5; // eax@28 |
6677 //int v6; // eax@31 | |
6678 //int v7; // eax@34 | |
6679 //int v8; // eax@37 | |
6680 //int v9; // eax@40 | |
6681 //unsigned int v10; // eax@43 | |
0 | 6682 char *v12; // eax@53 |
6683 char *v13; // eax@56 | |
6684 char *v14; // eax@57 | |
6685 char *v15; // eax@58 | |
467 | 6686 //unsigned int v16; // ebp@62 |
0 | 6687 char *v17; // ecx@63 |
6688 char *v18; // eax@65 | |
6689 const char *v19; // ecx@68 | |
248 | 6690 //unsigned int v20; // eax@69 |
467 | 6691 signed int pPrice; // ecx@70 |
0 | 6692 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6693 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6694 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6695 //int v25; // [sp-4h] [bp-10h]@49 |
6696 | |
459 | 6697 uDialogueType = uMessageParam + 1; |
6698 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6699 if ( uMessageParam <= 24 ) |
460 | 6700 { |
459 | 6701 switch ( uMessageParam ) |
6702 { | |
6703 case 13: | |
6704 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
6705 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6706 NPCHireableDialogPrepare(); |
459 | 6707 dialogue_show_profession_details = false; |
6708 goto _return; | |
6709 case 19: | |
6710 pEventNumber = pCurrentNPCInfo->evt_A; | |
6711 break; | |
6712 case 20: | |
6713 pEventNumber = pCurrentNPCInfo->evt_B; | |
6714 break; | |
6715 case 21: | |
6716 pEventNumber = pCurrentNPCInfo->evt_C; | |
6717 break; | |
6718 case 22: | |
6719 pEventNumber = pCurrentNPCInfo->evt_D; | |
6720 break; | |
6721 case 23: | |
6722 pEventNumber = pCurrentNPCInfo->evt_E; | |
6723 break; | |
6724 case 24: | |
6725 pEventNumber = pCurrentNPCInfo->evt_F; | |
6726 break; | |
6727 default: | |
467 | 6728 goto _return; |
6729 } | |
6730 /*switch ( pEventNumber ) | |
6731 { | |
6732 case 139: | |
6733 sub_4B1ECE(); | |
6734 goto _return; | |
6735 case 311: | |
6736 sub_4BBA85_bounties(); | |
6737 goto _return; | |
6738 }*/ | |
459 | 6739 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6740 { | |
6741 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6742 { | |
6743 if ( pEventNumber == 139 ) | |
0 | 6744 { |
6745 sub_4B1ECE(); | |
6746 } | |
6747 else | |
6748 { | |
459 | 6749 if ( pEventNumber == 311 ) |
0 | 6750 { |
6751 sub_4BBA85_bounties(); | |
6752 } | |
6753 else | |
6754 { | |
6755 ptr_F8B1E8 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6756 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6757 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6758 activeLevelDecoration = NULL; |
0 | 6759 } |
6760 } | |
6761 } | |
6762 else | |
6763 { | |
459 | 6764 dword_F8B1D8 = uMessageParam; |
6765 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6766 } |
6767 } | |
6768 else | |
6769 { | |
459 | 6770 sub_4B3FE5(pEventNumber); |
0 | 6771 } |
6772 goto _return; | |
460 | 6773 } |
459 | 6774 if ( uMessageParam != 76 ) |
6775 { | |
6776 if ( uMessageParam == 77 ) | |
6777 { | |
467 | 6778 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6779 if (dialogue_show_profession_details) |
459 | 6780 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6781 else |
459 | 6782 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
0 | 6783 ptr_F8B1E8 = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6784 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6785 dialogue_show_profession_details = ~dialogue_show_profession_details; |
0 | 6786 ptr_F8B1E8 = v18; |
6787 } | |
6788 else | |
6789 { | |
459 | 6790 if ( uMessageParam == 79 ) |
0 | 6791 { |
484 | 6792 if ( contract_approved ) |
0 | 6793 { |
267 | 6794 Party::TakeGold(gold_transaction_amount); |
0 | 6795 if ( uActiveCharacter ) |
6796 { | |
492 | 6797 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6798 *(short *)v12 &= 0x3Fu; |
6799 switch ( dword_F8B1B0 ) | |
6800 { | |
6801 case 2: | |
492 | 6802 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6803 *v15 |= 0x40u; |
6804 break; | |
6805 case 3: | |
492 | 6806 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6807 *v14 |= 0x80u; |
6808 break; | |
6809 case 4: | |
492 | 6810 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6811 v13[1] |= 1u; |
6812 break; | |
6813 } | |
187 | 6814 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6815 } |
437 | 6816 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6817 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6818 { |
6819 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6820 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6821 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6822 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6823 }*/ |
0 | 6824 } |
6825 } | |
6826 else | |
6827 { | |
492 | 6828 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6829 { |
267 | 6830 Party::TakeGold(gold_transaction_amount); |
0 | 6831 v4 = pParty->pPlayers; |
6832 do | |
6833 { | |
492 | 6834 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6835 ++v4; |
6836 } | |
6837 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6838 switch ( dword_F8B1D8 ) | |
6839 { | |
6840 case 19: | |
467 | 6841 pEventNumber = pCurrentNPCInfo->evt_A; |
6842 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6843 pCurrentNPCInfo->evt_A = 0; |
0 | 6844 break; |
6845 case 20: | |
467 | 6846 pEventNumber = pCurrentNPCInfo->evt_B; |
6847 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6848 pCurrentNPCInfo->evt_B = 0; |
0 | 6849 break; |
6850 case 21: | |
467 | 6851 pEventNumber = pCurrentNPCInfo->evt_C; |
6852 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6853 pCurrentNPCInfo->evt_C = 0; |
0 | 6854 break; |
6855 case 22: | |
467 | 6856 pEventNumber = pCurrentNPCInfo->evt_D; |
6857 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6858 pCurrentNPCInfo->evt_D = 0; |
0 | 6859 break; |
6860 case 23: | |
467 | 6861 pEventNumber = pCurrentNPCInfo->evt_E; |
6862 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6863 pCurrentNPCInfo->evt_E = 0; |
0 | 6864 break; |
6865 case 24: | |
467 | 6866 pEventNumber = pCurrentNPCInfo->evt_F; |
6867 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6868 pCurrentNPCInfo->evt_F = 0; | |
0 | 6869 break; |
6870 } | |
437 | 6871 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6872 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6873 { |
6874 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6875 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6876 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6877 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6878 }*/ |
467 | 6879 //v11 = uActiveCharacter; |
0 | 6880 if ( uActiveCharacter ) |
6881 { | |
467 | 6882 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6883 goto _return; |
6884 } | |
6885 } | |
6886 } | |
6887 } | |
6888 goto _return; | |
6889 } | |
6890 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6891 { | |
467 | 6892 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6893 goto _return; |
6894 } | |
459 | 6895 if ( pCurrentNPCInfo->uProfession != 51 ) |
6896 { | |
467 | 6897 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6898 if ( pParty->uNumGold < pPrice ) | |
6899 { | |
6900 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6901 dialogue_show_profession_details = false; |
0 | 6902 uDialogueType = 13; |
459 | 6903 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6904 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); |
0 | 6905 if ( uActiveCharacter ) |
248 | 6906 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6907 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6908 goto _return; | |
6909 } | |
6910 Party::TakeGold(pPrice); | |
0 | 6911 } |
147 | 6912 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6913 pCurrentNPCInfo->uFlags |= 128; |
0 | 6914 pParty->field_709 = 0; |
659 | 6915 Party__CountHirelings(); |
0 | 6916 if ( pParty->pHirelings[0].pName ) |
6917 { | |
459 | 6918 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6919 v24 = pCurrentNPCInfo->pName; | |
0 | 6920 v22 = pParty->pHireling2Name; |
6921 } | |
6922 else | |
6923 { | |
459 | 6924 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6925 v24 = pCurrentNPCInfo->pName; | |
0 | 6926 v22 = pParty->pHireling1Name; |
6927 } | |
6928 strcpy(v22, v24); | |
6929 pParty->field_709 = 0; | |
659 | 6930 Party__CountHirelings(); |
480 | 6931 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6932 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6933 |
6934 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6935 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6936 { |
6937 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6938 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6939 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6940 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6941 }*/ |
0 | 6942 if ( uActiveCharacter ) |
467 | 6943 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6944 _return: |
460 | 6945 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6946 } |
6947 | |
6948 | |
6949 //----- (004B254D) -------------------------------------------------------- | |
6950 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6951 { | |
6952 Player *v1; // esi@1 | |
6953 int v2; // edx@1 | |
6954 int v3; // ecx@1 | |
6955 int v4; // edi@1 | |
6956 int v5; // eax@7 | |
6957 int v6; // eax@7 | |
6958 int v7; // ebx@7 | |
6959 int v8; // ebx@8 | |
6960 signed int v9; // esi@8 | |
6961 int v10; // eax@8 | |
6962 char *v11; // ecx@8 | |
6963 int v12; // edi@9 | |
6964 char *v13; // edx@9 | |
6965 signed int v14; // edi@10 | |
6966 unsigned int v16; // eax@29 | |
6967 int v17; // eax@36 | |
6968 char v18; // cl@46 | |
6969 __int16 v19; // dx@56 | |
6970 int v20; // eax@60 | |
6971 char *v21; // [sp-Ch] [bp-38h]@82 | |
6972 const char *v22; // [sp-8h] [bp-34h]@21 | |
6973 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6974 char *v24; // [sp-8h] [bp-34h]@82 | |
6975 char *v25; // [sp-4h] [bp-30h]@14 | |
6976 int v26; // [sp-4h] [bp-30h]@38 | |
6977 int v27; // [sp-4h] [bp-30h]@82 | |
6978 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6979 int v29; // [sp+10h] [bp-1Ch]@13 | |
6980 int v30; // [sp+14h] [bp-18h]@15 | |
6981 int v31; // [sp+18h] [bp-14h]@16 | |
6982 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6983 int v33; // [sp+20h] [bp-Ch]@7 | |
6984 int v34; // [sp+24h] [bp-8h]@7 | |
6985 char *v35; // [sp+28h] [bp-4h]@1 | |
6986 | |
6987 v1 = pPlayers[uActiveCharacter]; | |
484 | 6988 contract_approved = 0; |
0 | 6989 v2 = (_this - 200) % 3; |
6990 v3 = (_this - 200) / 3; | |
6991 v4 = v2; | |
6992 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6993 dword_F8B1AC_award_bit_number = v3; |
0 | 6994 if ( v2 ) |
6995 { | |
6996 if ( v2 == 1 ) | |
6997 { | |
267 | 6998 gold_transaction_amount = 5000; |
0 | 6999 dword_F8B1B0 = 3; |
7000 } | |
7001 else | |
7002 { | |
7003 if ( v2 == 2 ) | |
7004 { | |
267 | 7005 gold_transaction_amount = 8000; |
0 | 7006 dword_F8B1B0 = 4; |
7007 } | |
7008 } | |
7009 } | |
7010 else | |
7011 { | |
267 | 7012 gold_transaction_amount = 2000; |
0 | 7013 dword_F8B1B0 = 2; |
7014 } | |
135 | 7015 v5 = v1->classType; |
0 | 7016 v33 = v5; |
7017 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
7018 *(int *)a1 = v1->pActiveSkills[v3]; | |
7019 v7 = a1[0] & 0x3F; | |
7020 v34 = v2 + 2; | |
7021 if ( v6 < v2 + 2 ) | |
7022 { | |
7023 v8 = v33; | |
7024 v9 = 0; | |
7025 v10 = v33 - v33 % 4; | |
7026 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
7027 do | |
7028 { | |
7029 v12 = (unsigned __int8)*v11; | |
7030 v13 = &v28[4 * v9]; | |
7031 *(int *)v13 = 0; | |
7032 if ( v12 < v34 ) | |
7033 { | |
7034 v14 = 1; | |
7035 } | |
7036 else | |
7037 { | |
7038 v14 = 1; | |
7039 *(int *)v13 = 1; | |
7040 } | |
7041 ++v9; | |
7042 v11 += 37; | |
7043 } | |
7044 while ( v9 < 4 ); | |
7045 if ( v29 == v14 ) | |
7046 { | |
7047 v25 = pClassNames[v10 + 1]; | |
7048 } | |
7049 else | |
7050 { | |
7051 if ( v30 == v14 ) | |
7052 { | |
7053 if ( v31 == v14 ) | |
7054 { | |
7055 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
7056 return pTmpBuf; | |
7057 } | |
7058 v25 = pClassNames[v10 + 2]; | |
7059 } | |
7060 else | |
7061 { | |
7062 if ( v31 != v14 ) | |
7063 { | |
7064 v25 = pClassNames[v8]; | |
7065 v22 = pGlobalTXT_LocalizationStrings[632]; | |
7066 goto LABEL_23; | |
7067 } | |
7068 v25 = pClassNames[v10 + 3]; | |
7069 } | |
7070 } | |
7071 v22 = pGlobalTXT_LocalizationStrings[633]; | |
7072 LABEL_23: | |
7073 sprintf(pTmpBuf, v22, v25); | |
7074 return pTmpBuf; | |
7075 } | |
7076 if ( !v1->CanAct() ) | |
7077 return (char *)pNPCTopics[122].pText; | |
7078 if ( !v7 ) | |
7079 return (char *)pNPCTopics[131].pText; | |
7080 v16 = SkillToMastery(a1[0]); | |
7081 if ( (signed int)v16 > v4 + 1 ) | |
7082 return (char *)pNPCTopics[v4 + 128].pText; | |
7083 if ( v34 != 2 ) | |
7084 { | |
7085 if ( v34 == 3 ) | |
7086 { | |
7087 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
7088 { | |
492 | 7089 v17 = dword_F8B1AC_award_bit_number; |
7090 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7091 { |
7092 default: | |
7093 goto LABEL_41; | |
7094 case 12: | |
7095 case 13: | |
7096 case 14: | |
7097 case 15: | |
7098 case 16: | |
7099 case 17: | |
7100 case 18: | |
267 | 7101 gold_transaction_amount = 4000; |
0 | 7102 goto LABEL_42; |
7103 case 19: | |
7104 v19 = 114; | |
7105 goto LABEL_57; | |
7106 case 20: | |
7107 v19 = 110; | |
7108 LABEL_57: | |
484 | 7109 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7110 return v35; |
7111 goto LABEL_40; | |
7112 case 22: | |
7113 v20 = v1->GetBaseWillpower(); | |
7114 goto LABEL_61; | |
7115 case 24: | |
267 | 7116 gold_transaction_amount = 2500; |
0 | 7117 v20 = v1->GetBaseEndurance(); |
7118 goto LABEL_61; | |
7119 case 36: | |
7120 v20 = v1->GetBaseIntelligence(); | |
7121 LABEL_61: | |
7122 if ( v20 < 50 ) | |
7123 return v35; | |
7124 goto LABEL_40; | |
7125 case 21: | |
7126 case 23: | |
7127 case 25: | |
7128 case 26: | |
7129 case 29: | |
7130 case 32: | |
7131 case 34: | |
7132 case 35: | |
267 | 7133 gold_transaction_amount = 2500; |
0 | 7134 goto LABEL_42; |
7135 case 8: | |
7136 case 9: | |
7137 case 10: | |
7138 case 11: | |
267 | 7139 gold_transaction_amount = 3000; |
0 | 7140 goto LABEL_42; |
7141 case 7: | |
7142 goto LABEL_67; | |
7143 } | |
7144 goto LABEL_67; | |
7145 } | |
7146 } | |
7147 else | |
7148 { | |
7149 if ( v34 != 4 ) | |
7150 { | |
7151 LABEL_40: | |
492 | 7152 v17 = dword_F8B1AC_award_bit_number; |
0 | 7153 goto LABEL_41; |
7154 } | |
7155 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7156 { | |
492 | 7157 v17 = dword_F8B1AC_award_bit_number; |
7158 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7159 { |
7160 case 19: | |
7161 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7162 goto LABEL_40; | |
7163 v26 = 1; | |
7164 v23 = 26; | |
7165 goto LABEL_39; | |
7166 default: | |
7167 goto LABEL_41; | |
7168 case 20: | |
7169 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7170 goto LABEL_40; | |
7171 v26 = 1; | |
7172 v23 = 27; | |
7173 LABEL_39: | |
7174 if ( v1->_49327B(v23, v26) == 1 ) | |
7175 goto LABEL_40; | |
7176 return v35; | |
7177 case 30: | |
7178 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7179 goto LABEL_47; | |
7180 case 31: | |
7181 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7182 LABEL_47: | |
7183 if ( (v18 & 0x3Fu) < 0xA ) | |
7184 return v35; | |
7185 goto LABEL_41; | |
7186 case 21: | |
7187 case 23: | |
7188 case 24: | |
7189 case 25: | |
7190 case 26: | |
7191 case 29: | |
7192 case 32: | |
7193 case 34: | |
7194 case 35: | |
267 | 7195 gold_transaction_amount = 6000; |
0 | 7196 goto LABEL_42; |
7197 case 8: | |
7198 case 9: | |
7199 case 10: | |
7200 case 11: | |
267 | 7201 gold_transaction_amount = 7000; |
0 | 7202 goto LABEL_42; |
7203 case 7: | |
7204 break; | |
7205 } | |
7206 LABEL_67: | |
267 | 7207 gold_transaction_amount = 0; |
0 | 7208 goto LABEL_41; |
7209 } | |
7210 } | |
7211 return v35; | |
7212 } | |
7213 if ( v7 < 4 ) | |
7214 return v35; | |
492 | 7215 v17 = dword_F8B1AC_award_bit_number; |
7216 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7217 { | |
7218 if ( dword_F8B1AC_award_bit_number != 29 | |
7219 && dword_F8B1AC_award_bit_number != 32 | |
7220 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7221 { |
7222 LABEL_41: | |
267 | 7223 if ( !gold_transaction_amount ) |
0 | 7224 goto LABEL_79; |
7225 goto LABEL_42; | |
7226 } | |
7227 LABEL_87: | |
267 | 7228 gold_transaction_amount = 500; |
0 | 7229 goto LABEL_41; |
7230 } | |
492 | 7231 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7232 goto LABEL_87; |
492 | 7233 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7234 { |
267 | 7235 gold_transaction_amount = 0; |
0 | 7236 goto LABEL_79; |
7237 } | |
492 | 7238 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7239 goto LABEL_41; |
492 | 7240 if ( dword_F8B1AC_award_bit_number > 18 ) |
7241 { | |
7242 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7243 goto LABEL_41; |
7244 goto LABEL_87; | |
7245 } | |
267 | 7246 gold_transaction_amount = 1000; |
0 | 7247 LABEL_42: |
267 | 7248 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7249 return (char *)pNPCTopics[124].pText; |
7250 LABEL_79: | |
484 | 7251 contract_approved = 1; |
0 | 7252 if ( v34 == 2 ) |
7253 { | |
267 | 7254 v27 = gold_transaction_amount; |
0 | 7255 v24 = pSkillNames[v17]; |
7256 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7257 goto LABEL_90; | |
7258 } | |
7259 if ( v34 == 3 ) | |
7260 { | |
267 | 7261 v27 = gold_transaction_amount; |
0 | 7262 v24 = pSkillNames[v17]; |
7263 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7264 goto LABEL_90; | |
7265 } | |
7266 if ( v34 == 4 ) | |
7267 { | |
267 | 7268 v27 = gold_transaction_amount; |
0 | 7269 v24 = pSkillNames[v17]; |
7270 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7271 LABEL_90: | |
7272 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); | |
7273 } | |
7274 return pTmpBuf2; | |
7275 } | |
7276 | |
7277 | |
7278 | |
7279 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7280 const char * ContractSelectText( int pEventCode ) |
7281 { | |
7282 static const int dialogue_base=110; | |
484 | 7283 contract_approved = 0; |
492 | 7284 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7285 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7286 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7287 { | |
492 | 7288 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7289 { | |
7290 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7291 } |
7292 else | |
7293 { | |
267 | 7294 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7295 { |
484 | 7296 contract_approved = 1; |
492 | 7297 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7298 } |
7299 else | |
7300 { | |
492 | 7301 return pNPCTopics[dialogue_base+14].pText; |
0 | 7302 } |
7303 } | |
7304 } | |
7305 else | |
7306 { | |
492 | 7307 return pNPCTopics[dialogue_base+12].pText; |
0 | 7308 } |
7309 } | |
7310 | |
7311 | |
7312 //----- (004B2A74) -------------------------------------------------------- | |
459 | 7313 char __cdecl SimpleHouseAndBoatsDialog() |
0 | 7314 { |
7315 char *v0; // esi@3 | |
7316 char *v1; // ST1C_4@3 | |
7317 char *v2; // eax@3 | |
7318 const char *v3; // ST1C_4@5 | |
7319 int v4; // eax@5 | |
7320 unsigned int i; // eax@5 | |
7321 NPCData *v6; // esi@6 | |
7322 unsigned __int16 v7; // bx@6 | |
7323 unsigned int v8; // eax@6 | |
7324 int v9; // eax@11 | |
7325 unsigned int v10; // ecx@12 | |
7326 int v11; // eax@12 | |
7327 int v12; // esi@12 | |
7328 char *v13; // eax@12 | |
7329 GUIWindow *v14; // ebx@13 | |
7330 char *v15; // esi@14 | |
7331 GUIButton *v16; // eax@15 | |
7332 unsigned int v17; // ecx@15 | |
7333 int v18; // ecx@17 | |
7334 int v19; // ecx@18 | |
7335 int v20; // ecx@19 | |
7336 int v21; // ecx@20 | |
7337 int v22; // ecx@21 | |
7338 unsigned int v23; // ecx@23 | |
7339 int v24; // ecx@35 | |
7340 int v25; // ecx@36 | |
7341 int v26; // ecx@37 | |
7342 int v27; // ecx@38 | |
7343 int v28; // ecx@39 | |
7344 char *v29; // esi@42 | |
7345 unsigned int v30; // ST20_4@42 | |
7346 int v31; // ST1C_4@42 | |
7347 unsigned int v32; // eax@42 | |
7348 char *v33; // eax@43 | |
7349 int v34; // esi@51 | |
7350 int v35; // eax@51 | |
7351 unsigned int v36; // edi@51 | |
7352 GUIButton *v37; // eax@52 | |
7353 int v38; // eax@52 | |
7354 signed int v39; // ecx@54 | |
7355 int v40; // edi@57 | |
7356 GUIButton *v41; // eax@60 | |
7357 GUIButton *v42; // esi@60 | |
7358 const char *v43; // ebx@60 | |
7359 int v44; // eax@60 | |
7360 unsigned int v45; // ecx@60 | |
7361 unsigned __int16 v46; // ax@60 | |
7362 GUIFont *v47; // ebx@64 | |
7363 int v48; // esi@64 | |
7364 char *v49; // eax@66 | |
7365 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7366 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7367 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7368 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7369 int v55; // [sp+10Ch] [bp-10h]@6 | |
7370 int v56; // [sp+110h] [bp-Ch]@13 | |
7371 char *pInString; // [sp+114h] [bp-8h]@12 | |
7372 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7373 | |
7374 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7375 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7376 { |
7377 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7378 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7379 a1.uFrameX = 493; | |
7380 a1.uFrameWidth = 126; | |
7381 a1.uFrameZ = 366; | |
7382 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7383 a1.uFrameX = 483; | |
7384 a1.uFrameWidth = 148; | |
7385 a1.uFrameZ = 334; | |
434 | 7386 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7387 if ( !v2 ) |
7388 { | |
721 | 7389 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7390 v2 = pTmpBuf; |
7391 } | |
7392 v3 = v2; | |
7393 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
7394 LOBYTE(i) = (unsigned int)a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); | |
7395 return i; | |
7396 } | |
7397 a1.uFrameWidth -= 10; | |
7398 a1.uFrameZ -= 10; | |
459 | 7399 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7400 v6 = v58; |
7401 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7402 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7403 v8 = v6->uProfession; | |
7404 if ( v8 ) | |
264 | 7405 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7406 else |
7407 strcpy(pTmpBuf, v6->pName); | |
7408 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7409 if ( !dword_591080 ) | |
7410 { | |
7411 if ( !uDialogueType ) | |
7412 { | |
7413 v9 = v6->greet; | |
7414 if ( v9 ) | |
7415 { | |
7416 v10 = v6->uFlags; | |
7417 a1.uFrameWidth = 460; | |
7418 a1.uFrameZ = 452; | |
7419 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7420 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7421 v12 = v11 + 7; | |
7422 pRenderer->_4A6A68( | |
7423 8u, | |
7424 352 - (v11 + 7), | |
7425 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7426 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7427 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7428 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7429 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7430 } | |
7431 } | |
7432 } | |
7433 v14 = pDialogueWindow; | |
7434 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7435 v52.uFrameX = 483; | |
7436 v52.uFrameWidth = 148; | |
7437 v52.uFrameZ = 334; | |
7438 v56 = v52.pStartingPosActiveItem; | |
7439 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7440 { | |
348 | 7441 v15 = "";//(char *)v54; |
0 | 7442 while ( 1 ) |
7443 { | |
7444 v16 = v52.GetControl(v56); | |
7445 v17 = v16->uControlParam; | |
7446 pInString = (char *)v16; | |
7447 if ( (signed int)v17 > 24 ) | |
7448 { | |
7449 v24 = v17 - 76; | |
7450 if ( !v24 ) | |
7451 { | |
7452 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7453 goto LABEL_49; | |
7454 } | |
7455 v25 = v24 - 1; | |
7456 if ( !v25 ) | |
7457 { | |
7458 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7459 goto LABEL_49; | |
7460 } | |
7461 v26 = v25 - 2; | |
7462 if ( !v26 ) | |
7463 { | |
7464 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7465 LABEL_44: | |
7466 v15 = v33; | |
7467 LABEL_45: | |
7468 v16 = (GUIButton *)pInString; | |
7469 goto LABEL_49; | |
7470 } | |
7471 v27 = v26 - 3; | |
7472 if ( !v27 ) | |
7473 { | |
459 | 7474 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7475 goto LABEL_44; |
7476 } | |
7477 v28 = v27 - 1; | |
7478 if ( !v28 ) | |
7479 { | |
7480 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7481 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7482 v31 = *(int *)v29; | |
7483 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7484 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7485 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
7486 ptr_F8B1E8 = pTmpBuf2; | |
7487 v15 = ""; | |
7488 goto LABEL_45; | |
7489 } | |
7490 if ( v28 != 10 ) | |
7491 goto LABEL_41; | |
7492 } | |
7493 else | |
7494 { | |
7495 if ( v17 == 24 ) | |
7496 { | |
291 | 7497 v23 = v58->evt_F; |
0 | 7498 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7499 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7500 if ( !v15 ) |
7501 { | |
7502 v16->uControlParam = 0; | |
7503 v15 = ""; | |
7504 } | |
7505 goto LABEL_49; | |
7506 } | |
7507 v18 = v17 - 13; | |
7508 if ( v18 ) | |
7509 { | |
7510 v19 = v18 - 6; | |
7511 if ( !v19 ) | |
7512 { | |
291 | 7513 v23 = v58->evt_A; |
0 | 7514 goto LABEL_33; |
7515 } | |
7516 v20 = v19 - 1; | |
7517 if ( !v20 ) | |
7518 { | |
291 | 7519 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7520 if ( !v15 ) |
7521 { | |
7522 v16->uControlParam = 0; | |
7523 v15 = ""; | |
7524 } | |
7525 if ( uDialogueType != 84 ) | |
7526 goto LABEL_49; | |
484 | 7527 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 7528 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
7529 ptr_F8B1E8 = pTmpBuf2; | |
7530 goto LABEL_45; | |
7531 } | |
7532 v21 = v20 - 1; | |
7533 if ( !v21 ) | |
7534 { | |
291 | 7535 v23 = v58->evt_C; |
0 | 7536 goto LABEL_33; |
7537 } | |
7538 v22 = v21 - 1; | |
7539 if ( !v22 ) | |
7540 { | |
291 | 7541 v23 = v58->evt_D; |
0 | 7542 goto LABEL_33; |
7543 } | |
7544 if ( v22 == 1 ) | |
7545 { | |
291 | 7546 v23 = v58->evt_E; |
0 | 7547 goto LABEL_33; |
7548 } | |
7549 LABEL_41: | |
7550 v15 = ""; | |
7551 goto LABEL_49; | |
7552 } | |
7553 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7554 } | |
7555 LABEL_49: | |
7556 strcpy(v16->pButtonName, v15); | |
7557 ++v56; | |
7558 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7559 { | |
7560 v14 = pDialogueWindow; | |
7561 break; | |
7562 } | |
7563 } | |
7564 } | |
7565 v34 = 0; | |
7566 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7567 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7568 v36 = v14->pStartingPosActiveItem; | |
7569 v55 = v35; | |
7570 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7571 + pDialogueWindow->pStartingPosActiveItem ) | |
7572 { | |
7573 v37 = v14->GetControl(v36); | |
7574 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7575 v14 = pDialogueWindow; | |
7576 v34 += v38; | |
7577 ++v36; | |
7578 } | |
7579 v39 = v14->pNumPresenceButton; | |
7580 if ( v39 ) | |
7581 { | |
7582 v58 = (NPCData *)((174 - v34) / v39); | |
7583 if ( (signed int)v58 > 32 ) | |
7584 v58 = (NPCData *)32; | |
7585 pInString = (char *)2; | |
7586 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7587 v56 = v14->pStartingPosActiveItem; | |
7588 i = v56; | |
7589 if ( (signed int)i < (signed int)(i + v39) ) | |
7590 { | |
7591 while ( 1 ) | |
7592 { | |
7593 v41 = v14->GetControl(i); | |
7594 v42 = v41; | |
7595 v43 = v41->pButtonName; | |
7596 v41->uY = (unsigned int)((char *)v58 + v40); | |
7597 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7598 v45 = v42->uY; | |
7599 v42->uHeight = v44; | |
7600 v40 = v45 + v44 - 1; | |
7601 v42->uW = v40; | |
7602 v46 = v55; | |
7603 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7604 v46 = v54; | |
7605 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7606 v14 = pDialogueWindow; | |
7607 ++pInString; | |
7608 ++v56; | |
7609 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7610 if ( v56 >= (signed int)i ) | |
7611 break; | |
7612 i = v56; | |
7613 } | |
7614 } | |
7615 } | |
7616 if ( ptr_F8B1E8 ) | |
7617 { | |
7618 w.uFrameWidth = 458; | |
7619 w.uFrameZ = 457; | |
7620 v47 = pFontArrus; | |
7621 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7622 if ( 352 - v48 < 8 ) | |
7623 { | |
7624 v47 = pFontCreate; | |
7625 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7626 } | |
7627 pRenderer->_4A6A68( | |
7628 8u, | |
7629 352 - v48, | |
7630 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7631 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7632 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
7633 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); | |
7634 LOBYTE(i) = a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); | |
7635 } | |
7636 return i; | |
7637 } | |
7638 | |
7639 | |
7640 | |
7641 | |
7642 | |
7643 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7644 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
7645 { | |
7646 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); | |
0 | 7647 } |
7648 | |
7649 | |
7650 | |
7651 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7652 void sub_4B3A72( int a1 ) |
7653 { | |
7654 int num_buttons; // esi@1 | |
7655 | |
7656 num_buttons = 0; | |
0 | 7657 if ( a1 == 21 ) |
7658 { | |
473 | 7659 CreateButtonInColumn(0, 0x66u); |
7660 num_buttons = 2; | |
7661 CreateButtonInColumn(1, 0x67u); | |
7662 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7663 { | |
7664 num_buttons = 3; | |
7665 CreateButtonInColumn(2, 0x68u); | |
7666 } | |
7667 } | |
7668 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7669 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7670 } | |
7671 // F8B1E0: using guessed type int dword_F8B1E0; | |
7672 | |
7673 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7674 void sub_4B3AD4( signed int a1 ) |
7675 { | |
0 | 7676 if ( a1 > 0 ) |
7677 { | |
7678 if ( a1 <= 3 ) | |
7679 { | |
473 | 7680 CreateButtonInColumn(0, 3u); |
7681 CreateButtonInColumn(1, 4u); | |
7682 CreateButtonInColumn(2, 5u); | |
7683 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7684 } |
7685 if ( a1 == 4 ) | |
7686 { | |
473 | 7687 CreateButtonInColumn(0, 3u); |
7688 CreateButtonInColumn(1, 4u); | |
7689 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7690 } | |
7691 } | |
0 | 7692 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7693 } | |
7694 // F8B1E0: using guessed type int dword_F8B1E0; | |
7695 | |
7696 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7697 void sub_4B3B42( signed int a1 ) |
7698 { | |
0 | 7699 int v1; // ecx@18 |
7700 int v2; // ecx@19 | |
7701 int v3; // ecx@20 | |
7702 signed int v4; // esi@22 | |
7703 signed int v5; // eax@22 | |
7704 unsigned int v6; // edx@24 | |
7705 int v7; // ecx@24 | |
7706 int result; // eax@43 | |
7707 int v9; // [sp-10h] [bp-14h]@28 | |
7708 int v10; // [sp-Ch] [bp-10h]@28 | |
7709 int v11; // [sp-8h] [bp-Ch]@28 | |
7710 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7711 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7712 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7713 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7714 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7715 int v17; // [sp-4h] [bp-8h]@28 | |
7716 | |
7717 if ( a1 > 13 ) | |
7718 { | |
7719 if ( a1 > 22 ) | |
7720 { | |
7721 if ( a1 == 23 ) | |
7722 { | |
473 | 7723 CreateButtonInColumn(0, 0xAu); |
7724 CreateButtonInColumn(1, 0xBu); | |
0 | 7725 v14 = 96; |
7726 LABEL_41: | |
473 | 7727 CreateButtonInColumn(2, v14); |
0 | 7728 v17 = 2; |
7729 v11 = 0; | |
7730 v10 = 1; | |
7731 v9 = 3; | |
7732 goto LABEL_42; | |
7733 } | |
7734 if ( a1 <= 26 ) | |
7735 goto LABEL_43; | |
7736 if ( a1 > 28 ) | |
7737 { | |
7738 if ( a1 != 30 ) | |
7739 goto LABEL_43; | |
473 | 7740 CreateButtonInColumn(0, 0x11u); |
0 | 7741 v16 = 96; |
7742 goto LABEL_37; | |
7743 } | |
473 | 7744 CreateButtonInColumn(0, 0x69u); |
7745 CreateButtonInColumn(1, 0x6Au); | |
7746 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7747 v12 = 108; |
7748 } | |
7749 else | |
7750 { | |
7751 if ( a1 == 22 ) | |
7752 { | |
473 | 7753 CreateButtonInColumn(0, 7u); |
0 | 7754 v16 = 8; |
7755 goto LABEL_37; | |
7756 } | |
7757 v1 = a1 - 14; | |
7758 if ( !v1 ) | |
7759 { | |
473 | 7760 CreateButtonInColumn(0, 0x12u); |
7761 CreateButtonInColumn(1, 0x30u); | |
7762 CreateButtonInColumn(2, 0x31u); | |
7763 CreateButtonInColumn(3, 0x32u); | |
7764 CreateButtonInColumn(4, 0x33u); | |
0 | 7765 v17 = 2; |
7766 v11 = 0; | |
7767 v10 = 1; | |
7768 v9 = 5; | |
7769 goto LABEL_42; | |
7770 } | |
7771 v2 = v1 - 1; | |
7772 if ( v2 ) | |
7773 { | |
7774 v3 = v2 - 2; | |
7775 if ( v3 ) | |
7776 { | |
7777 if ( v3 != 4 ) | |
7778 goto LABEL_43; | |
473 | 7779 CreateButtonInColumn(0, 0xFu); |
7780 CreateButtonInColumn(1, 0x10u); | |
0 | 7781 v4 = 3; |
473 | 7782 CreateButtonInColumn(2, 0x60u); |
336 | 7783 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7784 if ( v5 < 108 || v5 > 120 ) |
7785 goto LABEL_28; | |
7786 v4 = 4; | |
7787 v6 = 101; | |
7788 v7 = 3; | |
7789 } | |
7790 else | |
7791 { | |
7792 v4 = 1; | |
473 | 7793 CreateButtonInColumn(0, 0x63u); |
0 | 7794 if ( !pParty->uFine ) |
7795 { | |
7796 LABEL_28: | |
7797 v17 = 2; | |
7798 v11 = 0; | |
7799 v10 = 1; | |
7800 v9 = v4; | |
7801 LABEL_42: | |
7802 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7803 goto LABEL_43; | |
7804 } | |
7805 v4 = 2; | |
7806 v7 = 1; | |
7807 v6 = 100; | |
7808 } | |
473 | 7809 CreateButtonInColumn(v7, v6); |
0 | 7810 goto LABEL_28; |
7811 } | |
473 | 7812 CreateButtonInColumn(0, 0x12u); |
7813 CreateButtonInColumn(1, 0x34u); | |
7814 CreateButtonInColumn(2, 0x35u); | |
0 | 7815 v12 = 54; |
7816 } | |
7817 LABEL_39: | |
473 | 7818 CreateButtonInColumn(3, v12); |
0 | 7819 v17 = 2; |
7820 v11 = 0; | |
7821 v10 = 1; | |
7822 v9 = 4; | |
7823 goto LABEL_42; | |
7824 } | |
7825 if ( a1 == 13 ) | |
7826 { | |
473 | 7827 CreateButtonInColumn(0, 0x12u); |
0 | 7828 v16 = 56; |
7829 LABEL_37: | |
473 | 7830 CreateButtonInColumn(1, v16); |
0 | 7831 v17 = 2; |
7832 v11 = 0; | |
7833 v10 = 1; | |
7834 v9 = 2; | |
7835 goto LABEL_42; | |
7836 } | |
7837 switch ( a1 ) | |
7838 { | |
7839 case 1: | |
7840 case 2: | |
7841 case 3: | |
7842 case 4: | |
473 | 7843 CreateButtonInColumn(0, 2u); |
7844 CreateButtonInColumn(1, 0x5Fu); | |
7845 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7846 v12 = 96; |
7847 goto LABEL_39; | |
7848 case 5: | |
473 | 7849 CreateButtonInColumn(0, 0x12u); |
0 | 7850 v13 = 48; |
7851 goto LABEL_9; | |
7852 case 6: | |
473 | 7853 CreateButtonInColumn(0, 0x12u); |
0 | 7854 v13 = 49; |
7855 goto LABEL_9; | |
7856 case 7: | |
473 | 7857 CreateButtonInColumn(0, 0x12u); |
0 | 7858 v13 = 50; |
7859 goto LABEL_9; | |
7860 case 8: | |
473 | 7861 CreateButtonInColumn(0, 0x12u); |
0 | 7862 v13 = 51; |
7863 LABEL_9: | |
473 | 7864 CreateButtonInColumn(1, v13); |
0 | 7865 v14 = 72; |
7866 goto LABEL_41; | |
7867 case 9: | |
473 | 7868 CreateButtonInColumn(0, 0x12u); |
0 | 7869 v15 = 52; |
7870 goto LABEL_13; | |
7871 case 10: | |
473 | 7872 CreateButtonInColumn(0, 0x12u); |
0 | 7873 v15 = 53; |
7874 goto LABEL_13; | |
7875 case 11: | |
473 | 7876 CreateButtonInColumn(0, 0x12u); |
0 | 7877 v15 = 54; |
7878 LABEL_13: | |
473 | 7879 CreateButtonInColumn(1, v15); |
0 | 7880 v14 = 61; |
7881 goto LABEL_41; | |
7882 case 12: | |
473 | 7883 CreateButtonInColumn(0, 0x12u); |
0 | 7884 v16 = 55; |
7885 goto LABEL_37; | |
7886 default: | |
7887 break; | |
7888 } | |
7889 LABEL_43: | |
7890 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7891 } | |
7892 // F8B1E0: using guessed type int dword_F8B1E0; | |
7893 | |
7894 //----- (004B3E1E) -------------------------------------------------------- | |
7895 void __cdecl sub_4B3E1E() | |
7896 { | |
7897 NPCData *v0; // ST40_4@1 | |
7898 signed int v1; // edi@1 | |
165 | 7899 //GUIWindow *v2; // ecx@1 |
0 | 7900 |
167 | 7901 __debugbreak(); |
602 | 7902 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7903 v1 = 0; |
7904 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7905 pDialogueWindow->Release(); | |
165 | 7906 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7907 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7908 { |
165 | 7909 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7910 v1 = 1; |
7911 } | |
165 | 7912 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7913 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7914 } | |
7915 | |
7916 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7917 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7918 { |
467 | 7919 uDialogueType = 81;//enum JoinGuildDialog |
492 | 7920 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
7921 ContractSelectText(pEventCode); | |
0 | 7922 pDialogueWindow->Release(); |
492 | 7923 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 7924 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 7925 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7926 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 7927 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); |
0 | 7928 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7929 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7930 } |
7931 // F8B19C: using guessed type int dword_F8B19C; | |
7932 | |
7933 //----- (004B3FE5) -------------------------------------------------------- | |
7934 void __fastcall sub_4B3FE5(int a4) | |
7935 { | |
7936 int v1; // edi@1 | |
7937 char *v2; // edi@1 | |
7938 | |
7939 v1 = a4; | |
7940 uDialogueType = 78; | |
7941 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
7942 _4B254D_SkillMasteryTeacher(a4); | |
7943 pDialogueWindow->Release(); | |
7944 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7945 v2 = ""; | |
492 | 7946 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 7947 pGlobalTXT_LocalizationStrings[34], |
526 | 7948 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7949 0); |
7950 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 7951 if ( contract_approved ) |
0 | 7952 v2 = pGlobalTXT_LocalizationStrings[535]; |
7953 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); | |
7954 pDialogueWindow->_41D08F(1, 1, 0, 2); | |
747 | 7955 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7956 } |
7957 // F8B19C: using guessed type int dword_F8B19C; | |
7958 // F8B1A8: using guessed type int dword_F8B1A8; | |
7959 | |
7960 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7961 void NPCHireableDialogPrepare() |
7962 { | |
0 | 7963 signed int v0; // ebx@1 |
7964 NPCData *v1; // edi@1 | |
7965 | |
7966 v0 = 0; | |
459 | 7967 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7968 pDialogueWindow->Release(); |
7969 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
607 | 7970 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
7971 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 7972 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7973 0); |
7974 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 7975 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7976 { |
607 | 7977 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
7978 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 7979 v0 = 1; |
7980 } | |
607 | 7981 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
7982 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" | |
0 | 7983 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7984 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7985 } |
7986 | |
7987 | |
7988 //----- (004B4224) -------------------------------------------------------- | |
423 | 7989 void _4B4224_UpdateNPCTopics( int _this ) |
7990 { | |
7991 int num_menu_buttons; // ebx@1 | |
0 | 7992 int i; // ebp@5 |
423 | 7993 // signed int v4; // ebp@9 |
7994 int v6; // eax@16 | |
7995 int v8; // eax@21 | |
7996 int v10; // eax@26 | |
7997 int v12; // eax@31 | |
7998 int v14; // eax@36 | |
7999 int v16; // eax@41 | |
0 | 8000 NPCData *v17; // [sp+10h] [bp-4h]@4 |
8001 | |
423 | 8002 num_menu_buttons = 0; |
459 | 8003 pDialogueNPCCount = (_this + 1); |
0 | 8004 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
8005 { | |
8006 pDialogueWindow->Release(); | |
8007 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
423 | 8008 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
8009 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, | |
0 | 8010 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 8011 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 8012 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
8013 sHouseName, | |
8014 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 8015 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 8016 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); |
0 | 8017 } |
8018 else | |
8019 { | |
459 | 8020 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 8021 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 8022 { |
8023 pDialogueWindow->Release(); | |
8024 } | |
8025 else | |
8026 { | |
8027 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 8028 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 8029 } |
8030 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
423 | 8031 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 8032 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 8033 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8034 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8035 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 8036 { |
484 | 8037 sub_4B3B42(in_current_building_type); |
0 | 8038 } |
8039 else | |
8040 { | |
8041 if ( v17->joins ) | |
8042 { | |
423 | 8043 num_menu_buttons = 1; |
0 | 8044 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); |
8045 } | |
423 | 8046 if ( v17->evt_A) |
8047 { | |
8048 if ( num_menu_buttons < 4 ) | |
8049 { | |
8050 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 8051 if ( v6 == 1 || v6 == 2 ) |
423 | 8052 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
8053 } | |
8054 } | |
8055 if ( v17->evt_B ) | |
8056 { | |
8057 if ( num_menu_buttons < 4 ) | |
8058 { | |
8059 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 8060 if ( v8 == 1 || v8 == 2 ) |
423 | 8061 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
8062 } | |
8063 } | |
8064 if ( v17->evt_C ) | |
8065 { | |
8066 if ( num_menu_buttons < 4 ) | |
8067 { | |
8068 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 8069 if ( v10 == 1 || v10 == 2 ) |
423 | 8070 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
8071 } | |
8072 } | |
8073 | |
8074 if ( v17->evt_D ) | |
8075 { | |
8076 if ( num_menu_buttons < 4 ) | |
8077 { | |
8078 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 8079 if ( v12 == 1 || v12 == 2 ) |
423 | 8080 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
8081 } | |
8082 } | |
8083 if ( v17->evt_E ) | |
8084 { | |
8085 if ( num_menu_buttons < 4 ) | |
8086 { | |
8087 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 8088 if ( v14 == 1 || v14 == 2 ) |
423 | 8089 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
8090 } | |
8091 } | |
8092 if ( v17->evt_F ) | |
8093 { | |
8094 if ( num_menu_buttons < 4 ) | |
8095 { | |
8096 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8097 if ( v16 == 1 || v16 == 2 ) |
423 | 8098 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
8099 } | |
8100 } | |
8101 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 8102 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8103 } | |
747 | 8104 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 8105 } |
8106 | |
0 | 8107 } |
8108 | |
8109 | |
8110 | |
8111 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8112 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8113 { |
0 | 8114 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8115 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8116 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8117 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8118 } |
8119 | |
8120 //----- (004B46F8) -------------------------------------------------------- | |
8121 int __fastcall sub_4B46F8(int a1) | |
8122 { | |
8123 int v1; // eax@1 | |
8124 int i; // edx@1 | |
8125 | |
8126 v1 = 0; | |
8127 for ( i = 0; i < a1; ++i ) | |
8128 v1 += i + 1; | |
8129 return 1000 * v1; | |
8130 } | |
8131 | |
8132 | |
8133 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8134 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8135 { |
656 | 8136 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8137 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8138 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8139 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8140 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8141 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8142 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8143 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8144 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8145 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8146 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8147 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8148 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8149 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8150 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8151 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8152 //v1 = _this; |
656 | 8153 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8154 //v3 = v1; |
656 | 8155 uDialogueType = newDialogueType; |
8156 if (!speakingNPC->uFlags) | |
8157 { | |
8158 speakingNPC->uFlags = 1; | |
8159 //v3 = uDialogueType; | |
8160 } | |
8161 | |
8162 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8163 { | |
8164 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8165 } | |
8166 else if(newDialogueType == DIALOGUE_76) | |
8167 { | |
8168 if (speakingNPC->Hired()) | |
8169 { | |
8170 v8 = 0; | |
8171 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8172 { | |
8173 v6 = (char *)pNPCStats->pNewNPCData; | |
8174 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8175 { | |
8176 ++v8; | |
8177 v6 += 76; | |
8178 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8179 break; | |
8180 } | |
8181 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8182 v6[8] &= 0x7Fu; | |
8183 } | |
8184 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8185 { | |
8186 v11 = pParty->pHirelings; | |
8187 memset(v11, 0, sizeof(NPCData)); | |
8188 } | |
8189 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8190 { | |
8191 v11 = &pParty->pHirelings[1]; | |
8192 memset(v11, 0, sizeof(NPCData)); | |
8193 } | |
8194 pParty->field_709 = 0; | |
659 | 8195 Party__CountHirelings(); |
656 | 8196 dword_591084 = 0; |
8197 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8198 dword_7241C8 = 0; | |
8199 return; | |
8200 } | |
8201 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8202 { | |
8203 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8204 ShowStatusBarString(v7, 2u); | |
8205 } | |
8206 else | |
8207 { | |
8208 //v9 = v2->uProfession; | |
8209 if ( speakingNPC->uProfession != 51 ) | |
8210 { | |
8211 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8212 if ( pParty->uNumGold < v10 ) | |
8213 { | |
8214 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8215 dialogue_show_profession_details = false; | |
8216 uDialogueType = 13; | |
8217 if ( uActiveCharacter ) | |
8218 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8219 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8220 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8221 if ( !dword_7241C8 ) | |
8222 pGame->Draw(); | |
8223 dword_7241C8 = 0; | |
8224 return; | |
8225 } | |
8226 Party::TakeGold(v10); | |
8227 } | |
8228 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8229 if ( pParty->pHirelings[0].pName ) | |
8230 { | |
8231 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8232 v15 = speakingNPC->pName; | |
8233 v13 = pParty->pHireling2Name; | |
8234 } | |
8235 else | |
8236 { | |
8237 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8238 v15 = speakingNPC->pName; | |
8239 v13 = pParty->pHireling1Name; | |
8240 } | |
8241 strcpy(v13, v15); | |
8242 pParty->field_709 = 0; | |
659 | 8243 Party__CountHirelings(); |
656 | 8244 |
8245 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8246 | |
711 | 8247 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8248 pDialogue_SpeakingActor->uAIState = Removed; |
8249 if ( uActiveCharacter ) | |
8250 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8251 } | |
8252 } | |
8253 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8254 { | |
8255 ArenaFight(); | |
8256 return; | |
8257 } | |
8258 else if(newDialogueType == DIALOGUE_9) | |
8259 { | |
8260 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8261 { | |
8262 if ( speakingNPC->uProfession != 41 ) | |
8263 speakingNPC->bHasUsedTheAbility = 1; | |
8264 | |
8265 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8266 } | |
8267 else | |
8268 { | |
8269 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8270 } | |
8271 } | |
8272 else if(newDialogueType == DIALOGUE_13) | |
8273 { | |
8274 if (!speakingNPC->Hired()) | |
8275 { | |
8276 sub_4B3E1E(); | |
8277 dialogue_show_profession_details = false; | |
8278 } | |
8279 else | |
8280 { | |
8281 v5 = 0; | |
8282 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8283 { | |
8284 v6 = (char *)pNPCStats->pNewNPCData; | |
8285 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8286 { | |
8287 ++v5; | |
8288 v6 += 76; | |
8289 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8290 break; | |
8291 } | |
8292 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8293 v6[8] &= 0x7Fu; | |
8294 } | |
8295 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8296 { | |
8297 v11 = pParty->pHirelings; | |
8298 memset(v11, 0, sizeof(NPCData)); | |
8299 } | |
8300 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8301 { | |
8302 v11 = &pParty->pHirelings[1]; | |
8303 memset(v11, 0, sizeof(NPCData)); | |
8304 } | |
8305 pParty->field_709 = 0; | |
659 | 8306 Party__CountHirelings(); |
656 | 8307 dword_591084 = 0; |
8308 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8309 dword_7241C8 = 0; | |
8310 return; | |
8311 } | |
8312 } | |
8313 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8314 { | |
8315 switch(newDialogueType) | |
8316 { | |
8317 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8318 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8319 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8320 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8321 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8322 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8323 } | |
8324 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8325 sub_4B3FE5(npc_event_id); //200-310 | |
8326 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8327 { //400-410 | |
8328 dword_F8B1D8 = newDialogueType; | |
8329 DrawJoinGuildWindow(npc_event_id - 400); | |
8330 } | |
8331 else | |
8332 { | |
8333 switch ( npc_event_id ) | |
8334 { | |
8335 case 139: | |
8336 sub_4B1ECE(); | |
8337 break; | |
8338 case 311: | |
8339 sub_4BBA85_bounties(); | |
8340 break; | |
8341 case 399: | |
8342 sub_4BBCDD(); | |
8343 break; | |
8344 default: | |
8345 activeLevelDecoration = (LevelDecoration*)1; | |
8346 ptr_F8B1E8 = 0; | |
8347 EventProcessor(npc_event_id, 0, 1); | |
8348 activeLevelDecoration = NULL; | |
8349 break; | |
8350 } | |
8351 } | |
8352 } | |
8353 if ( !dword_7241C8 ) | |
8354 pGame->Draw(); | |
8355 dword_7241C8 = 0; | |
8356 } | |
0 | 8357 |
8358 | |
8359 | |
8360 //----- (004BDAAF) -------------------------------------------------------- | |
8361 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
8362 { | |
8363 int v2; // edx@1 | |
8364 unsigned int v3; // esi@1 | |
8365 unsigned int v4; // eax@1 | |
8366 signed int v5; // edi@1 | |
8367 int v6; // edx@8 | |
8368 int v7; // edx@9 | |
8369 int v8; // edx@10 | |
8370 unsigned __int8 v9; // zf@16 | |
8371 char v10; // sf@16 | |
8372 unsigned __int8 v11; // of@16 | |
702 | 8373 bool test; |
0 | 8374 |
8375 auto a2 = _2da_idx; | |
8376 //v2 = p2DEvents_minus1___00[26 * a2]; | |
8377 v2 = p2DEvents[a2 - 1].uType; | |
8378 v3 = a1->uItemID; | |
8379 v4 = a1->uItemID; | |
8380 v5 = pItemsTable->pItems[v4].uEquipType; | |
8381 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 8382 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 8383 return 0; |
702 | 8384 switch( p2DEvents[a2 - 1].uType ) |
8385 { | |
8386 case BildingType_WeaponShop: | |
8387 { | |
8388 test = v5 <= 2; | |
8389 break; | |
8390 } | |
8391 case BildingType_ArmorShop: | |
8392 { | |
8393 test = v5 >= 3; | |
8394 break; | |
8395 } | |
8396 case BildingType_MagicShop: | |
8397 { | |
8398 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
8399 break; | |
8400 } | |
8401 case BildingType_AlchemistShop: | |
8402 { | |
8403 __debugbreak(); // need to test | |
8404 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
8405 break; | |
8406 } | |
8407 default: | |
8408 { | |
8409 test = 0; | |
8410 break; | |
8411 } | |
8412 } | |
8413 | |
8414 return test; | |
8415 /* | |
8416 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8417 { |
8418 v11 = __OFSUB__(v5, 2); | |
8419 v9 = v5 == 2; | |
8420 v10 = v5 - 2 < 0; | |
8421 goto LABEL_23; | |
8422 } | |
702 | 8423 if ( p2DEvents[a2 - 1].uType > 2 ) |
8424 { | |
8425 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8426 { |
8427 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8428 return v5 == 16; | |
8429 return 1; | |
8430 } | |
702 | 8431 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8432 return 0; |
702 | 8433 if ( p2DEvents[a2 - 1].uType == 4) |
8434 { | |
8435 if ( v5 < 13 ) | |
8436 return 0; | |
8437 if ( v5 <= 14 ) | |
8438 return 1; | |
8439 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8440 return 0; | |
8441 v11 = __OFSUB__(v3, 771); | |
8442 v9 = v3 == 771; | |
8443 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8444 LABEL_23: |
702 | 8445 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8446 return 0; | |
8447 return 1; | |
8448 } | |
8449 } | |
8450 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8451 { | |
8452 if ( v5 >= 3 ) | |
8453 { | |
8454 v11 = __OFSUB__(v5, 9); | |
8455 v9 = v5 == 9; | |
8456 v10 = v5 - 9 < 0; | |
8457 goto LABEL_23; | |
8458 } | |
0 | 8459 } |
8460 return 0; | |
702 | 8461 */ |
0 | 8462 } |
8463 | |
8464 | |
8465 | |
8466 | |
8467 //----- (004B6478) -------------------------------------------------------- | |
711 | 8468 void sub_4B6478() |
8469 { | |
0 | 8470 GUIWindow *v0; // ebx@1 |
8471 Player *v1; // edi@1 | |
8472 unsigned int v2; // eax@1 | |
8473 signed int v3; // esi@1 | |
8474 int v4; // ebx@1 | |
8475 unsigned int v5; // esi@5 | |
8476 int v6; // edi@6 | |
8477 int result; // eax@13 | |
8478 GUIWindow *v8; // ebx@17 | |
8479 int v9; // eax@17 | |
8480 int v10; // ecx@17 | |
8481 unsigned int v11; // ecx@18 | |
8482 int v12; // eax@20 | |
8483 int v13; // eax@21 | |
8484 GUIButton *v14; // esi@27 | |
8485 int v15; // ecx@27 | |
8486 unsigned int v16; // eax@28 | |
8487 const char *v17; // ebx@29 | |
8488 int v18; // eax@29 | |
8489 unsigned int v19; // ecx@29 | |
8490 int v20; // eax@29 | |
8491 unsigned __int16 v21; // ax@29 | |
8492 unsigned __int16 v22; // ST14_2@36 | |
8493 int v23; // eax@36 | |
8494 const char *v24; // ST18_4@37 | |
8495 unsigned __int16 v25; // ST14_2@37 | |
8496 int v26; // eax@37 | |
8497 int v27; // [sp-4h] [bp-80h]@8 | |
8498 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8499 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8500 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8501 int v31; // [sp+68h] [bp-14h]@1 | |
8502 int v32; // [sp+6Ch] [bp-10h]@1 | |
8503 int v33; // [sp+70h] [bp-Ch]@17 | |
8504 int v34; // [sp+74h] [bp-8h]@17 | |
8505 int v35; // [sp+78h] [bp-4h]@17 | |
8506 | |
336 | 8507 v0 = window_SpeakInHouse; |
8508 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8509 v1 = pPlayers[uActiveCharacter]; |
8510 v28.uFrameX = 483; | |
8511 v28.uFrameWidth = 148; | |
8512 v28.uFrameZ = 334; | |
8513 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8514 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8515 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8516 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8517 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8518 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8519 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8520 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8521 v32 = v4; | |
8522 if ( v4 < v3 / 3 ) | |
8523 { | |
8524 v4 = v3 / 3; | |
8525 v32 = v3 / 3; | |
8526 } | |
749 | 8527 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8528 { |
8529 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8530 { | |
8531 v5 = 0; | |
8532 | |
8533 __debugbreak(); | |
8534 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8535 // or | |
8536 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8537 // or | |
8538 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8539 __debugbreak(); // whacky condition - fix |
0 | 8540 if (false |
8541 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8542 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8543 { |
8544 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8545 } | |
8546 else | |
8547 { | |
8548 if ( pParty->uNumGold < v4 ) | |
8549 { | |
8550 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8551 v27 = 4; | |
8552 } | |
8553 else | |
8554 { | |
8555 Party::TakeGold(v4); | |
8556 *(short *)v6 = 1; | |
8557 v27 = 2; | |
8558 } | |
735 | 8559 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8560 } |
8561 } | |
8562 else | |
8563 { | |
8564 v5 = 0; | |
8565 } | |
437 | 8566 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8567 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8568 { | |
8569 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8570 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8571 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8572 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8573 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8574 }*/ |
8575 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8576 return; // void func |
0 | 8577 } |
484 | 8578 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8579 { |
8580 v24 = pNPCTopics[171].pText; | |
8581 v25 = v31; | |
8582 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8583 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8584 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8585 return ; |
8586 } | |
8587 | |
8588 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8589 return; | |
0 | 8590 v8 = pDialogueWindow; |
8591 v33 = 0; | |
8592 v34 = 0; | |
8593 v29 = pDialogueWindow; | |
8594 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8595 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8596 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8597 if ( v9 >= v10 ) | |
8598 goto LABEL_40; | |
8599 do | |
8600 { | |
8601 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 8602 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8603 { |
8604 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8605 v33 += v12; | |
8606 ++v34; | |
8607 } | |
8608 v13 = v8->pStartingPosActiveItem; | |
8609 ++v35; | |
8610 } | |
8611 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8612 if ( !v34 ) | |
8613 { | |
8614 LABEL_40: | |
135 | 8615 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8616 strcat(pTmpBuf, "\n \n"); |
8617 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8618 v22 = v31; | |
8619 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8620 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8621 return; | |
0 | 8622 } |
8623 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8624 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8625 v32 = (149 - v33) / v34; | |
8626 if ( (149 - v33) / v34 > 32 ) | |
8627 v32 = 32; | |
711 | 8628 |
8629 v35 = v8->pStartingPosActiveItem; | |
0 | 8630 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8631 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8632 { |
8633 v33 = 2; | |
8634 do | |
8635 { | |
8636 v14 = v8->GetControl(v35); | |
8637 v15 = v14->uControlParam - 36; | |
135 | 8638 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8639 { |
8640 v16 = 0; | |
8641 if ( !v1->pActiveSkills[v15] ) | |
8642 { | |
8643 v17 = pSkillNames[v15]; | |
8644 v14->uY = v32 + v34; | |
8645 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8646 v19 = v14->uY; | |
8647 v14->uHeight = v18; | |
8648 v20 = v19 + v18 - 1; | |
8649 v14->uW = v20; | |
8650 v34 = v20; | |
8651 v21 = v31; | |
8652 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8653 v21 = v30; | |
8654 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8655 goto LABEL_34; | |
8656 } | |
8657 } | |
8658 else | |
8659 { | |
8660 v16 = 0; | |
8661 } | |
8662 v14->uW = v16; | |
8663 v14->uHeight = v16; | |
8664 v14->uY = v16; | |
8665 LABEL_34: | |
8666 v8 = v29; | |
8667 ++v35; | |
8668 ++v33; | |
711 | 8669 } |
8670 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8671 } | |
8672 return; | |
0 | 8673 } |
8674 | |
8675 | |
8676 | |
8677 //----- (004B6943) -------------------------------------------------------- | |
8678 void __cdecl TravelByTransport() | |
8679 { | |
8680 GUIWindow *v0; // ebx@1 | |
8681 Player *v1; // esi@1 | |
8682 signed int v2; // edi@1 | |
8683 unsigned int v3; // eax@1 | |
8684 signed int v4; // ebx@1 | |
727 | 8685 stru365_travel_info *v5; // esi@7 |
0 | 8686 int v6; // eax@9 |
8687 int v7; // eax@9 | |
8688 int v8; // eax@12 | |
8689 int v9; // edi@12 | |
8690 int v10; // edx@12 | |
8691 int v11; // ecx@12 | |
8692 signed int v12; // esi@13 | |
8693 signed int v13; // edi@14 | |
8694 DWORD v14; // eax@26 | |
8695 DWORD v15; // edi@26 | |
8696 GUIWindow *v16; // ebx@36 | |
8697 int v17; // esi@36 | |
8698 int v18; // eax@36 | |
8699 int v19; // ecx@36 | |
8700 int v20; // esi@36 | |
8701 int v21; // eax@36 | |
8702 void *v22; // eax@39 | |
727 | 8703 int v23; // esi@39 |
0 | 8704 GUIButton *v24; // ebx@39 |
8705 signed int v25; // eax@41 | |
727 | 8706 //int v26; // esi@44 |
0 | 8707 const char *v27; // eax@46 |
8708 char *v28; // eax@62 | |
8709 int v29; // eax@62 | |
8710 unsigned int v30; // ecx@62 | |
8711 char *v31; // eax@63 | |
652 | 8712 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 |
8713 /*int v33; // [sp-38h] [bp-2C8h]@62 | |
0 | 8714 int v34; // [sp-34h] [bp-2C4h]@62 |
8715 int v35; // [sp-30h] [bp-2C0h]@62 | |
8716 int v36; // [sp-2Ch] [bp-2BCh]@62 | |
8717 int v37; // [sp-28h] [bp-2B8h]@62 | |
8718 int v38; // [sp-24h] [bp-2B4h]@62 | |
8719 int v39; // [sp-20h] [bp-2B0h]@62 | |
8720 int v40; // [sp-1Ch] [bp-2ACh]@62 | |
8721 int v41; // [sp-18h] [bp-2A8h]@62 | |
8722 int v42; // [sp-14h] [bp-2A4h]@62 | |
8723 char *v43; // [sp-10h] [bp-2A0h]@62 | |
8724 char *v44; // [sp-Ch] [bp-29Ch]@62 | |
8725 unsigned int v45; // [sp-8h] [bp-298h]@62 | |
8726 char *v46; // [sp-4h] [bp-294h]@62 | |
652 | 8727 const char *v47[5]; // [sp+0h] [bp-290h]@7*/ |
8728 char v48[100]; // [sp+14h] [bp-27Ch]@37 | |
8729 char v49[100]; // [sp+78h] [bp-218h]@68 | |
8730 char v50[100]; // [sp+DCh] [bp-1B4h]@68 | |
8731 char v51[100]; // [sp+140h] [bp-150h]@68 | |
8732 char Dest[100]; // [sp+1A4h] [bp-ECh]@36 | |
0 | 8733 GUIWindow v53; // [sp+208h] [bp-88h]@1 |
8734 int v54; // [sp+25Ch] [bp-34h]@36 | |
8735 int v55; // [sp+260h] [bp-30h]@36 | |
8736 unsigned int v56; // [sp+264h] [bp-2Ch]@1 | |
652 | 8737 int v57; // [sp+268h] [bp-28h]@1 |
727 | 8738 int v58; // [sp+26Ch] [bp-24h]@36 |
0 | 8739 GUIWindow *v59; // [sp+270h] [bp-20h]@1 |
8740 unsigned int v60; // [sp+274h] [bp-1Ch]@36 | |
727 | 8741 //Player *v61; // [sp+278h] [bp-18h]@1 |
0 | 8742 int v62; // [sp+27Ch] [bp-14h]@36 |
8743 int v63; // [sp+280h] [bp-10h]@14 | |
8744 char *a1; // [sp+284h] [bp-Ch]@37 | |
8745 unsigned int s1; // [sp+288h] [bp-8h]@1 | |
8746 int v66; // [sp+28Ch] [bp-4h]@48 | |
8747 | |
336 | 8748 v0 = window_SpeakInHouse; |
8749 memcpy(&v53, window_SpeakInHouse, sizeof(v53)); | |
0 | 8750 v2 = 255; |
727 | 8751 //v61 = pPlayers[uActiveCharacter]; |
8752 v1 = pPlayers[uActiveCharacter]; | |
0 | 8753 v53.uFrameX = 483; |
8754 v53.uFrameWidth = 148; | |
8755 v53.uFrameZ = 334; | |
652 | 8756 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
0 | 8757 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); |
8758 v3 = 52 * (unsigned int)v0->ptr_1C; | |
8759 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); | |
8760 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); | |
8761 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); | |
8762 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8763 s1 = v4 * (100 - v1->GetMerchant()) / 100; | |
8764 if ( (signed int)s1 < v4 / 3 ) | |
8765 s1 = v4 / 3; | |
749 | 8766 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
0 | 8767 { |
8768 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8769 { | |
8770 v16 = pDialogueWindow; | |
727 | 8771 v58 = -1; |
0 | 8772 v62 = 0; |
8773 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
8774 v59 = pDialogueWindow; | |
8775 v54 = v17; | |
652 | 8776 strcpy(Dest, ""); |
8777 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold | |
0 | 8778 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); |
8779 v19 = v16->pNumPresenceButton; | |
8780 v20 = v18 + v17 + 146; | |
8781 v21 = v16->pStartingPosActiveItem; | |
8782 v63 = v20; | |
8783 v55 = v20; | |
8784 v60 = v21; | |
8785 if ( v21 >= v21 + v19 ) | |
8786 goto LABEL_71; | |
8787 s1 = 2; | |
652 | 8788 a1 = v48; |
0 | 8789 while ( 1 ) |
8790 { | |
652 | 8791 int v47 = v60; |
336 | 8792 v22 = window_SpeakInHouse->ptr_1C; |
727 | 8793 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; |
8794 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 | |
8795 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land | |
0 | 8796 v24 = v16->GetControl(v60); |
8797 if ( v23 != v58 | |
727 | 8798 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), |
0 | 8799 v25 |
727 | 8800 && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) |
8801 { | |
8802 v58 = v23; | |
0 | 8803 v27 = (const char *)v56; |
8804 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) | |
652 | 8805 v27 = (const char *)v57; |
8806 //v32.uRedbookTrackID = v27; | |
690 | 8807 sprintf(a1, "\f%05d", v27); |
727 | 8808 v66 = array_4F09B0[v23].uTravelTime; |
336 | 8809 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 8810 { |
652 | 8811 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 8812 v66 -= 2; |
652 | 8813 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 8814 v66 -= 3; |
652 | 8815 //v47 = Pirate; |
8816 if ( CheckHiredNPCSpeciality(Pirate) ) | |
8817 v66 -= 2; | |
0 | 8818 } |
8819 else | |
8820 { | |
652 | 8821 //v47 = Horseman; |
8822 if ( CheckHiredNPCSpeciality(Horseman) ) | |
8823 v66 -= 2; | |
8824 } | |
8825 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 8826 --v66; |
8827 if ( v66 < 1 ) | |
8828 v66 = 1; | |
727 | 8829 if ( v23 != v2 ) |
0 | 8830 { |
727 | 8831 memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); |
652 | 8832 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s |
8833 v66, v32.pName); | |
0 | 8834 strcat(a1, pTmpBuf); |
8835 v28 = a1; | |
8836 a1 += 100; | |
8837 ++v62; | |
8838 ++s1; | |
8839 strcat(v28, "\n \n"); | |
8840 v24->uY = v63; | |
8841 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0); | |
8842 v30 = v24->uY; | |
8843 v24->uHeight = v29; | |
8844 v2 = 255; | |
8845 v24->uW = v30 + v29 - 1; | |
8846 v63 += v54 + v29; | |
8847 } | |
8848 } | |
8849 else | |
8850 { | |
8851 v31 = a1; | |
8852 ++v62; | |
8853 ++s1; | |
8854 a1 += 100; | |
8855 strcpy(v31, ""); | |
8856 if ( v24 ) | |
8857 { | |
8858 v24->uW = 0; | |
8859 v24->uHeight = 0; | |
8860 v24->uY = 0; | |
8861 } | |
8862 } | |
8863 ++v60; | |
8864 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem ) | |
8865 break; | |
8866 v16 = v59; | |
8867 } | |
8868 if ( v63 != v55 ) | |
8869 { | |
652 | 8870 /*v47[1] = &Dest; |
0 | 8871 v47[0] = &v51; |
8872 v46 = &v50; | |
8873 v45 = (unsigned int)&v49; | |
8874 v44 = &v48; | |
652 | 8875 v43 = pTmpBuf2;*/ |
8876 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); | |
0 | 8877 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); |
8878 } | |
8879 else | |
8880 { | |
8881 LABEL_71: | |
652 | 8882 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, |
8883 v57, pGlobalTXT_LocalizationStrings[561], 3); | |
0 | 8884 pAudioPlayer->StopChannels(-1, -1); |
8885 } | |
8886 } | |
8887 } | |
8888 else | |
8889 { | |
749 | 8890 if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 ) |
0 | 8891 { |
8892 if ( pParty->uNumGold < s1 ) | |
8893 { | |
8894 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
735 | 8895 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
437 | 8896 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 8897 return; |
8898 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8899 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
437 | 8900 goto LABEL_33;*/ |
8901 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
0 | 8902 } |
8903 Party::TakeGold(s1); | |
652 | 8904 //v47[1] = (const char *)7; |
727 | 8905 v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; |
8906 if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) | |
8907 { | |
8908 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) | |
0 | 8909 { |
8910 SaveGame(1, 0); | |
727 | 8911 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); |
8912 v8 = v5->field_18; | |
8913 v9 = v5->field_14; | |
8914 v10 = v5->field_10; | |
0 | 8915 dword_6BE364_game_settings_1 |= 1u; |
8916 _5B65B8_npcdata_hiword_house_or_other = 0; | |
8917 dword_5B65BC = 0; | |
8918 _5B65B4_npcdata_loword_house_or_other = v8; | |
8919 v11 = *((int *)v5 + 3); | |
8920 uGameState = 2; | |
8921 _5B65A8_npcdata_uflags_or_other = v11; | |
8922 _5B65AC_npcdata_fame_or_other = v10; | |
8923 _5B65B0_npcdata_rep_or_other = v9; | |
8924 dword_5B65C0 = v11 | v10 | v9 | v8; | |
8925 } | |
8926 else | |
8927 { | |
727 | 8928 v6 = v5->field_C; |
0 | 8929 pParty->sRotationX = 0; |
8930 pParty->vPosition.x = v6; | |
727 | 8931 v7 = v5->field_10; |
0 | 8932 pIndoorCamera->sRotationY = 0; |
8933 pParty->uFlags |= 2u; | |
8934 pParty->vPosition.y = v7; | |
727 | 8935 pParty->vPosition.z = v5->field_14; |
0 | 8936 pParty->uFallStartY = pParty->vPosition.z; |
727 | 8937 pParty->sRotationY = v5->field_18; |
0 | 8938 } |
758 | 8939 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
727 | 8940 v12 = v5->uTravelTime; |
652 | 8941 int _v47; |
336 | 8942 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 8943 { |
652 | 8944 v63 = SPEECH_SetSail; |
0 | 8945 v13 = 2500; |
652 | 8946 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 8947 v12 -= 2; |
652 | 8948 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 8949 v12 -= 3; |
652 | 8950 //_v47 = 45; |
8951 if ( CheckHiredNPCSpeciality(Pirate) ) | |
8952 v12 -= 2; | |
0 | 8953 } |
8954 else | |
8955 { | |
652 | 8956 v63 = SPEECH_CarriageReady; |
0 | 8957 v13 = 1500; |
652 | 8958 //_v47 = 35; |
8959 if ( CheckHiredNPCSpeciality(Horseman) ) | |
8960 v12 -= 2; | |
8961 } | |
8962 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 8963 --v12; |
8964 if ( v12 < 1 ) | |
8965 v12 = 1; | |
8966 RestAndHeal(1440 * v12); | |
727 | 8967 v1->PlaySound((PlayerSpeech)v63, 0); |
0 | 8968 v14 = GetTickCount(); |
8969 v15 = v14 + v13; | |
8970 if ( v15 < v14 ) | |
8971 v15 = v14; | |
8972 while ( GetTickCount() < v15 ) | |
8973 sqrt(3.1415926); | |
8974 while ( sub_4BD8B5() ) | |
8975 ; | |
437 | 8976 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
8977 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 8978 { |
8979 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8980 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
8981 LABEL_33: | |
8982 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
8983 ++pMessageQueue_50CBD0->uNumMessages; | |
8984 return; | |
437 | 8985 }*/ |
0 | 8986 } |
8987 else | |
8988 { | |
747 | 8989 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
0 | 8990 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
8991 } | |
8992 } | |
8993 } | |
8994 } | |
8995 | |
8996 | |
8997 | |
8998 | |
8999 | |
9000 //----- (00405CFF) -------------------------------------------------------- | |
9001 void stru262_TurnBased::End(bool bPlaySound) | |
9002 { | |
9003 stru262_TurnBased *v2; // edi@1 | |
9004 int v3; // ebx@1 | |
9005 int v4; // esi@1 | |
9006 unsigned __int8 v5; // zf@1 | |
9007 unsigned __int8 v6; // sf@1 | |
9008 TurnBased_QueueElem *v7; // ecx@2 | |
9009 unsigned __int16 *pAttributes; // ecx@7 | |
9010 size_t v9; // edx@7 | |
9011 unsigned __int16 v10; // ax@8 | |
9012 TurnBased_QueueElem *v11; // ebx@12 | |
9013 ObjectType objType; // eax@13 | |
9014 int objID; // esi@13 | |
9015 int v14; // [sp+Ch] [bp-4h]@11 | |
9016 | |
9017 v2 = this; | |
9018 v3 = 0; | |
9019 v4 = 0; | |
9020 v5 = this->uActorQueueSize == 0; | |
9021 v6 = this->uActorQueueSize < 0; | |
9022 this->field_4 = 0; | |
9023 if ( !(v6 | v5) ) | |
9024 { | |
9025 v7 = this->pQueue; | |
9026 do | |
9027 { | |
9028 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
9029 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
9030 ++v4; | |
9031 ++v7; | |
9032 } | |
9033 while ( v4 < v2->uActorQueueSize ); | |
9034 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9035 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9036 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9037 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9038 v9 = uNumSpriteObjects; |
0 | 9039 do |
9040 { | |
9041 v10 = *pAttributes; | |
9042 if ( *pAttributes & 4 ) | |
9043 { | |
9044 LOBYTE(v10) = v10 & 0xFB; | |
9045 *pAttributes = v10; | |
9046 } | |
9047 pAttributes += 56; | |
9048 --v9; | |
9049 } | |
9050 while ( v9 ); | |
9051 } | |
9052 v14 = 0; | |
9053 if ( v2->uActorQueueSize > 0 ) | |
9054 { | |
9055 v11 = v2->pQueue; | |
9056 do | |
9057 { | |
9058 objType = (ObjectType)(v11->uPackedID & 7); | |
9059 objID = v11->uPackedID >> 3; | |
9060 if ( objType == OBJECT_Player ) | |
9061 { | |
9062 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9063 } | |
9064 else | |
9065 { | |
9066 if ( objType == OBJECT_Actor ) | |
9067 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9068 } | |
9069 ++v14; | |
9070 ++v11; | |
9071 } | |
9072 while ( v14 < v2->uActorQueueSize ); | |
9073 v3 = 0; | |
9074 } | |
9075 pAudioPlayer->StopChannels(-1, -1); | |
9076 if ( bPlaySound != v3 ) | |
9077 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
9078 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
9079 pEventTimer->StopGameTime(); | |
9080 dword_50C994 = v3; | |
9081 dword_50C998_turnbased_icon_1A = v3; | |
9082 } | |
9083 // 50C994: using guessed type int dword_50C994; | |
9084 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
9085 | |
9086 //----- (00405E14) -------------------------------------------------------- | |
9087 void stru262_TurnBased::_405E14() | |
9088 { | |
9089 stru262_TurnBased *v1; // esi@1 | |
9090 int v2; // ecx@1 | |
9091 SpellBuff *v3; // edi@2 | |
9092 Actor *v4; // ebx@3 | |
9093 signed int v5; // edx@20 | |
9094 AIDirection *v6; // esi@21 | |
9095 int v7; // eax@21 | |
9096 int v8; // eax@21 | |
9097 int v9; // eax@22 | |
9098 int v10; // eax@23 | |
9099 int v11; // eax@37 | |
9100 int v12; // eax@44 | |
9101 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
9102 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
9103 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 9104 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 9105 int v17; // [sp+5Ch] [bp-10h]@6 |
9106 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
9107 int v19; // [sp+64h] [bp-8h]@8 | |
9108 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
9109 | |
9110 v1 = this; | |
9111 v2 = 0; | |
9112 v18 = v1; | |
9113 v20 = 0; | |
9114 if ( (signed int)uNumActors > 0 ) | |
9115 { | |
90 | 9116 //v3 = pActors;//[0].pActorBuffs; |
9117 v16 = pActors;//[0].pActorBuffs; | |
9118 v3 = v16->pActorBuffs; | |
0 | 9119 do |
9120 { | |
90 | 9121 v4 = v16; |
9122 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 9123 v17 = v2; |
9124 else | |
9125 v17 = 1; | |
9126 v19 = v2; | |
9127 do | |
9128 { | |
9129 if ( v19 != 10 ) | |
9130 { | |
9131 v3->_4585CA(pParty->uTimePlayed); | |
9132 v2 = 0; | |
9133 } | |
9134 ++v19; | |
9135 ++v3; | |
9136 } | |
9137 while ( v19 < 22 ); | |
9138 if ( v17 != v2 | |
9139 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
9140 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
9141 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
9142 if ( !(v4->uAttributes & 0x80) ) | |
9143 { | |
9144 if ( !v4->pActorBuffs[5].uExpireTime ) | |
9145 { | |
9146 if ( !v4->pActorBuffs[6].uExpireTime ) | |
9147 { | |
9148 v5 = v4->uCurrentActionLength; | |
9149 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
9150 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
9151 { | |
417 | 9152 v17 = ai_near_actors_targets_pid[v20]; |
9153 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 9154 v7 = v4->uAIState; |
9155 memcpy(&v15, v6, sizeof(v15)); | |
9156 v8 = v7 - 4; | |
9157 memcpy(&v14, &v15, sizeof(v14)); | |
9158 if ( v8 ) | |
9159 { | |
9160 v9 = v8 - 1; | |
9161 if ( v9 ) | |
9162 { | |
9163 v10 = v9 - 6; | |
9164 if ( v10 ) | |
9165 { | |
9166 if ( v10 != 8 ) | |
414 | 9167 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 9168 } |
9169 } | |
9170 } | |
9171 else | |
9172 { | |
9173 v4->uCurrentActionTime = 0; | |
9174 v4->uCurrentActionLength = 0; | |
9175 v4->uAIState = Dead; | |
9176 v4->UpdateAnimation(); | |
9177 } | |
9178 v1 = v18; | |
9179 v2 = 0; | |
9180 } | |
9181 } | |
9182 } | |
9183 } | |
9184 ++v20; | |
90 | 9185 v3 = v16[1].pActorBuffs; |
9186 ++v16; | |
0 | 9187 } |
9188 while ( (signed int)v20 < (signed int)uNumActors ); | |
9189 } | |
9190 if ( v1->field_4 == 1 ) | |
9191 { | |
9192 v12 = v1->field_8; | |
9193 if ( v12 == 64 ) | |
9194 { | |
9195 v1->_406A63(); | |
9196 } | |
9197 else | |
9198 { | |
9199 if ( v12 > v2 ) | |
9200 { | |
9201 v1->_406B9F(); | |
9202 } | |
9203 else | |
9204 { | |
9205 v1->_406AFE(); | |
9206 v1->field_10 = 100; | |
9207 } | |
9208 } | |
9209 v1->field_8 -= pEventTimer->uTimeElapsed; | |
9210 return; | |
9211 } | |
9212 if ( v1->field_4 == 2 ) | |
9213 { | |
9214 if ( !(v1->field_18 & 1) ) | |
9215 { | |
9216 v11 = v1->field_10; | |
9217 if ( v11 == 100 ) | |
9218 { | |
9219 v1->StartTurn(); | |
9220 LABEL_39: | |
9221 v1->_40652A(); | |
9222 return; | |
9223 } | |
9224 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
9225 { | |
9226 v1->_4065B0(); | |
9227 goto LABEL_39; | |
9228 } | |
9229 } | |
9230 v1->NextTurn(); | |
9231 return; | |
9232 } | |
9233 if ( v1->field_4 == 3 ) | |
9234 { | |
9235 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
9236 { | |
9237 v1->field_18 &= 0xFFFFFFF7u; | |
9238 v1->field_4 = 1; | |
9239 v1->field_8 = 64; | |
9240 } | |
9241 else | |
9242 { | |
9243 v1->_406FA8(); | |
9244 } | |
9245 } | |
9246 } | |
9247 | |
9248 | |
9249 | |
9250 | |
9251 //----- (0043FDED) -------------------------------------------------------- | |
9252 void PrepareActorRenderList_BLV() | |
9253 { | |
9254 RenderBillboard *v0; // esi@0 | |
9255 unsigned __int16 v3; // ax@3 | |
9256 unsigned int v4; // eax@5 | |
9257 unsigned __int16 v5; // cx@5 | |
9258 int v6; // esi@5 | |
9259 unsigned int v7; // eax@7 | |
9260 int v8; // eax@10 | |
9261 SpriteFrame *v9; // eax@16 | |
9262 SpriteFrame *v10; // ebx@18 | |
9263 //int *v11; // eax@18 | |
9264 int v12; // ecx@28 | |
9265 //IndoorCameraD3D **v14; // eax@36 | |
9266 double v15; // st7@36 | |
9267 float v16; // eax@36 | |
9268 //double v17; // ST30_8@36 | |
9269 signed __int64 v18; // qtt@36 | |
9270 int v19; // ST5C_4@36 | |
9271 signed __int64 v20; // qtt@37 | |
9272 int v21; // ST5C_4@37 | |
9273 signed __int16 v22; // cx@39 | |
9274 int v23; // ST50_4@40 | |
9275 signed int v24; // ecx@40 | |
9276 int v25; // edx@44 | |
9277 __int16 v26; // ax@44 | |
9278 //MonsterDesc *v27; // edx@44 | |
9279 //int v28; // ecx@44 | |
9280 unsigned __int8 v29; // zf@44 | |
9281 unsigned __int8 v30; // sf@44 | |
9282 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
9283 int v32; // [sp+1Ch] [bp-38h]@5 | |
9284 int a3; // [sp+20h] [bp-34h]@5 | |
9285 int a2; // [sp+24h] [bp-30h]@5 | |
9286 int a1a; // [sp+28h] [bp-2Ch]@5 | |
9287 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
9288 int a5a; // [sp+2Ch] [bp-28h]@36 | |
9289 int a5b; // [sp+2Ch] [bp-28h]@40 | |
9290 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
9291 int a6; // [sp+40h] [bp-14h]@34 | |
9292 int v43; // [sp+44h] [bp-10h]@34 | |
9293 int z; // [sp+48h] [bp-Ch]@32 | |
9294 signed int y; // [sp+4Ch] [bp-8h]@32 | |
9295 int x; // [sp+50h] [bp-4h]@32 | |
9296 | |
9297 for (uint i = 0; i < uNumActors; ++i) | |
9298 { | |
9299 auto p = pActors + i; | |
9300 | |
9301 if (p->uAIState == Removed || | |
9302 p->uAIState == Disabled) | |
9303 continue; | |
9304 | |
9305 a5 = p->uSectorID; | |
9306 a2 = p->vPosition.y; | |
9307 a1a = p->vPosition.x; | |
9308 a3 = p->vPosition.z; | |
9309 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
9310 LOWORD(v0) = p->uYawAngle; | |
9311 v5 = p->uCurrentActionAnimation; | |
9312 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
9313 v32 = v6; | |
9314 if ( pParty->bTurnBasedModeOn ) | |
9315 { | |
9316 if ( v5 == 1 ) | |
9317 { | |
9318 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
9319 goto LABEL_10; | |
9320 } | |
9321 } | |
9322 else | |
9323 { | |
9324 if ( v5 == 1 ) | |
9325 { | |
9326 v7 = pBLVRenderParams->field_0_timer_; | |
9327 LABEL_10: | |
9328 v8 = i * 32 + v7; | |
9329 goto LABEL_12; | |
9330 } | |
9331 } | |
9332 v8 = p->uCurrentActionTime; | |
9333 LABEL_12: | |
9334 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
9335 v8 = 0; | |
9336 v31 = p->pSpriteIDs[v5]; | |
9337 if (p->uAIState == Resurrected) | |
9338 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
9339 else | |
9340 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
9341 v41 = 0; | |
9342 v10 = v9; | |
9343 //v11 = (int *)v9->uFlags; | |
9344 if (v9->uFlags & 2) | |
9345 v41 = 2; | |
9346 if (v9->uFlags & 0x40000) | |
9347 v41 |= 0x40u; | |
9348 if (v9->uFlags & 0x20000) | |
9349 LOBYTE(v41) = v41 | 0x80; | |
9350 v0 = (RenderBillboard *)(256 << v6); | |
9351 if ( (unsigned int)v0 & v9->uFlags) | |
9352 v41 |= 4u; | |
9353 if ( v10->uGlowRadius ) | |
9354 { | |
9355 //LOBYTE(v11) = byte_4E94D3; | |
9356 pMobileLightsStack->AddLight( | |
9357 a1a, | |
9358 a2, | |
9359 a3, | |
9360 a5, | |
9361 v10->uGlowRadius, | |
9362 0xFFu, | |
9363 0xFFu, | |
9364 0xFFu, | |
9365 byte_4E94D3); | |
9366 } | |
9367 v12 = 0; | |
9368 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
9369 continue; | |
9370 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
9371 { | |
9372 ++v12; | |
9373 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
9374 goto _continue; | |
9375 } | |
9376 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
9377 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
9378 continue; | |
9379 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
9380 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
9381 if (uNumBillboardsToDraw >= 500) | |
9382 break; | |
9383 ++uNumBillboardsToDraw; | |
9384 ++uNumSpritesDrawnThisFrame; | |
9385 p->uAttributes |= 8u; | |
9386 v29 = pRenderer->pRenderD3D == 0; | |
9387 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
9388 v0->uPalette = v10->uPaletteIndex; | |
9389 v0->uIndoorSectorID = a5; | |
9390 if ( v29 ) | |
9391 { | |
9392 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
9393 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
9394 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9395 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 9396 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
9397 } | |
9398 else | |
9399 { | |
9400 //v14 = &pGame->pIndoorCameraD3D; | |
9401 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
9402 v15 = pGame->pIndoorCameraD3D->fov_y; | |
9403 v16 = v0->fov_x; | |
9404 v0->fov_y = v15; | |
9405 //v17 = v16 + 6.7553994e15; | |
9406 LODWORD(v18) = 0; | |
9407 HIDWORD(v18) = floorf(v16 + 0.5f); | |
9408 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9409 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 9410 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
9411 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9412 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 9413 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
9414 { | |
9415 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
9416 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9417 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 9418 goto LABEL_43; |
9419 } | |
9420 } | |
9421 else | |
9422 { | |
9423 v22 = p->pActorBuffs[3].uPower; | |
9424 if ( v22 ) | |
9425 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9426 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 9427 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9428 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9429 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 9430 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9431 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 9432 goto LABEL_44; |
9433 } | |
9434 } | |
9435 LABEL_44: | |
9436 HIWORD(v25) = HIWORD(x); | |
430 | 9437 v0->world_x = a1a; |
9438 v0->world_y = a2; | |
9439 v0->world_z = a3; | |
0 | 9440 v0->uScreenSpaceX = v43; |
9441 v0->uScreenSpaceY = a6; | |
9442 LOWORD(v25) = 0; | |
9443 LOBYTE(v26) = v41; | |
194 | 9444 |
9445 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
9446 v0->actual_z = HIWORD(x); | |
9447 v0->object_pid = v8 * i | OBJECT_Actor; | |
9448 | |
0 | 9449 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
9450 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
9451 v0->field_1E = v41; | |
9452 v0->pSpriteFrame = v10; | |
9453 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9454 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9455 { | |
9456 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9457 v0->field_1E = v26; | |
9458 } | |
9459 | |
9460 _continue: | |
9461 ; | |
9462 } | |
9463 } | |
9464 | |
9465 | |
9466 | |
9467 | |
9468 //----- (00444732) -------------------------------------------------------- | |
428 | 9469 char *GetEventHintString(unsigned int uEventID) |
9470 { | |
9471 signed int event_index; // edx@1 | |
9472 int event_pos; // esi@4 | |
0 | 9473 char *result; // eax@6 |
428 | 9474 unsigned int str_index; // eax@9 |
9475 int i; // esi@11 | |
9476 _evt_raw* test_evt; | |
9477 _evt_raw* last_evt; | |
9478 | |
9479 event_index = 0; | |
9480 if ( uLevelEVT_NumEvents <= 0 ) | |
9481 return NULL; | |
9482 | |
9483 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9484 while ( 1 ) |
9485 { | |
428 | 9486 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9487 { | |
9488 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9489 last_evt=test_evt; | |
9490 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9491 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9492 break; |
9493 } | |
428 | 9494 ++event_index; |
9495 if ( event_index >= uLevelEVT_NumEvents ) | |
9496 return NULL; | |
9497 } | |
9498 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9499 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9500 { | |
9501 str_index = EVT_DWORD(test_evt->v5); | |
9502 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9503 } |
9504 else | |
9505 { | |
428 | 9506 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9507 { | |
9508 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9509 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9510 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9511 { | |
9512 str_index = EVT_DWORD(test_evt->v5); | |
9513 if ( str_index < 600 ) | |
9514 return (char *)p2DEvents[str_index - 1].pName; | |
9515 } | |
9516 } | |
9517 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9518 } | |
9519 | |
0 | 9520 return result; |
9521 } | |
9522 | |
9523 | |
9524 | |
9525 | |
9526 //----- (00444839) -------------------------------------------------------- | |
9527 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) | |
9528 { | |
9529 unsigned int v9; // ebx@1 | |
9530 int v10; // edi@1 | |
373 | 9531 //signed int v11; // eax@1 |
0 | 9532 unsigned int v12; // eax@6 |
9533 const char *v13; // ST0C_4@6 | |
9534 unsigned int v14; // eax@8 | |
9535 const char *v15; // eax@14 | |
9536 unsigned int v16; // eax@16 | |
9537 unsigned int result; // eax@26 | |
9538 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9539 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9540 char *v20; // [sp-4h] [bp-3Ch]@9 |
9541 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9542 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9543 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9544 | |
9545 v9 = a1; | |
9546 v10 = a2; | |
9547 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9548 dword_59117C_teleportx = x; | |
9549 dword_591178_teleporty = y; | |
9550 dword_591174_teleportz = z; | |
9551 dword_591170_teleport_directiony = directiony; | |
9552 dword_59116C_teleport_directionx = directionx; | |
9553 dword_591168_teleport_speedz = a8; | |
9554 dword_591164_teleport_map_name = (char *)pLocationName; | |
9555 uCurrentHouse_Animation = v9; | |
9556 pEventTimer->Pause(); | |
9557 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9558 |
9559 switch (pParty->alignment) | |
9560 { | |
9561 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9562 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9563 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9564 default: assert(false); | |
9565 } | |
9566 /*v11 = const_2(); | |
0 | 9567 sprintf(pContainer, "evt%02d", v11); |
9568 if ( pParty->uAlignment ) | |
9569 { | |
9570 if ( pParty->uAlignment != 2 ) | |
9571 goto LABEL_6; | |
9572 v19 = "-c"; | |
9573 } | |
9574 else | |
9575 { | |
9576 v19 = "-b"; | |
9577 } | |
373 | 9578 strcat(pContainer, v19);*/ |
9579 | |
9580 //LABEL_6: | |
0 | 9581 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9582 v13 = pHouse_ExitPictures[v10]; | |
9583 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9584 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9585 if ( v9 ) | |
9586 { | |
9587 if ( !v23 ) | |
9588 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 9589 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 9590 } |
9591 else | |
9592 { | |
9593 if ( !v23 ) | |
9594 { | |
9595 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9596 if ( v14 ) | |
9597 { | |
721 | 9598 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9599 goto LABEL_20; |
9600 } | |
9601 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9602 goto LABEL_19; | |
9603 } | |
9604 } | |
9605 v15 = pLocationName; | |
9606 if ( *pLocationName == 48 ) | |
9607 v15 = pCurrentMapName; | |
9608 v16 = pMapStats->GetMapInfo(v15); | |
9609 if ( v16 ) | |
9610 { | |
721 | 9611 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9612 goto LABEL_20; | |
0 | 9613 } |
9614 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9615 LABEL_19: | |
423 | 9616 strcpy(sHouseName, v21); |
0 | 9617 LABEL_20: |
710 | 9618 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9619 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9620 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9621 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9622 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9623 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9624 result = v23; |
9625 if ( v23 ) | |
9626 uCurrentHouse_Animation = v23; | |
9627 return result; | |
9628 } | |
9629 |