Mercurial > mm7
annotate mm7_4.cpp @ 746:852ec78d9548
Слияние
author | Ritor1 |
---|---|
date | Fri, 22 Mar 2013 23:46:32 +0600 |
parents | 0b7a55e955f2 225d92620998 |
children | 585490c29945 |
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 //----- (00487E1D) -------------------------------------------------------- | |
1526 TileTable::~TileTable() | |
1527 { | |
1528 if ( this->pTiles ) | |
1529 { | |
1530 pAllocator->FreeChunk(this->pTiles); | |
1531 pTiles = nullptr; | |
1532 } | |
1533 uNumTiles = 0; | |
1534 } | |
1535 | |
1536 //----- (00487E3B) -------------------------------------------------------- | |
1537 TileDesc *TileTable::GetTileById(unsigned int uTileID) | |
1538 { | |
86 | 1539 /*TileDesc *result; // eax@3 |
0 | 1540 |
1541 if ( (uTileID & 0x80000000u) != 0 || (signed int)uTileID > (signed int)(this->uNumTiles - 1) ) | |
1542 result = this->pTiles; | |
1543 else | |
1544 result = &this->pTiles[uTileID]; | |
86 | 1545 return result;*/ |
1546 | |
630 | 1547 assert(uTileID < uNumTiles); |
1548 return &pTiles[uTileID]; | |
0 | 1549 } |
1550 | |
1551 //----- (00487E58) -------------------------------------------------------- | |
630 | 1552 void TileTable::InitializeTileset(Tileset tileset) |
0 | 1553 { |
1554 TileTable *v2; // edi@1 | |
1555 int v3; // ebx@1 | |
1556 TileDesc *v4; // eax@2 | |
1557 signed int i; // [sp+8h] [bp-4h]@1 | |
1558 | |
1559 v2 = this; | |
1560 v3 = 0; | |
1561 for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 ) | |
1562 { | |
1563 v4 = &v2->pTiles[v3]; | |
630 | 1564 if (v4->tileset == tileset && v4->pTileName[0] ) |
0 | 1565 { |
1566 v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName); | |
1567 if ( v2->pTiles[v3].uBitmapID != -1 ) | |
1568 pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id1); | |
1569 } | |
1570 ++i; | |
1571 } | |
1572 } | |
1573 | |
1574 //----- (00487ED6) -------------------------------------------------------- | |
1575 int TileTable::method_487ED6(signed int a1, int a2) | |
1576 { | |
1577 int v3; // esi@1 | |
1578 TileTable *v4; // edi@1 | |
1579 int v5; // edx@3 | |
1580 int v6; // edx@11 | |
1581 unsigned int v8; // [sp-4h] [bp-10h]@4 | |
1582 | |
1583 v3 = 0; | |
1584 v4 = this; | |
1585 if ( a1 > 8 ) | |
1586 { | |
1587 v8 = 0; | |
1588 return v4->GetTileId(a1, v8); | |
1589 } | |
1590 if ( a2 || (v5 = rand() % 50, v5 < 20) ) | |
1591 { | |
1592 v8 = 0; | |
1593 return v4->GetTileId(a1, v8); | |
1594 } | |
1595 if ( v5 < 30 ) | |
1596 { | |
1597 v8 = 1; | |
1598 return v4->GetTileId(a1, v8); | |
1599 } | |
1600 if ( v5 < 40 ) | |
1601 { | |
1602 v8 = 2; | |
1603 return v4->GetTileId(a1, v8); | |
1604 } | |
1605 if ( v5 < 48 ) | |
1606 { | |
1607 v8 = 3; | |
1608 return v4->GetTileId(a1, v8); | |
1609 } | |
1610 v6 = rand() % 8; | |
1611 if ( !v6 ) | |
1612 { | |
1613 v8 = 4; | |
1614 return v4->GetTileId(a1, v8); | |
1615 } | |
1616 if ( v6 == 1 ) | |
1617 { | |
1618 v8 = 5; | |
1619 return v4->GetTileId(a1, v8); | |
1620 } | |
1621 if ( v6 == 2 ) | |
1622 { | |
1623 v8 = 6; | |
1624 return v4->GetTileId(a1, v8); | |
1625 } | |
1626 if ( v6 == 3 ) | |
1627 { | |
1628 v8 = 7; | |
1629 return v4->GetTileId(a1, v8); | |
1630 } | |
1631 if ( v6 == 4 ) | |
1632 { | |
1633 v8 = 8; | |
1634 return v4->GetTileId(a1, v8); | |
1635 } | |
1636 if ( v6 == 5 ) | |
1637 { | |
1638 v8 = 9; | |
1639 return v4->GetTileId(a1, v8); | |
1640 } | |
1641 if ( v6 == 6 ) | |
1642 { | |
1643 v8 = 10; | |
1644 return v4->GetTileId(a1, v8); | |
1645 } | |
1646 if ( v6 == 7 ) | |
1647 { | |
1648 v8 = 11; | |
1649 return v4->GetTileId(a1, v8); | |
1650 } | |
1651 return v3; | |
1652 } | |
1653 | |
1654 //----- (00487F84) -------------------------------------------------------- | |
1655 unsigned int TileTable::GetTileId(unsigned int uTerrainType, unsigned int uSection) | |
1656 { | |
1657 unsigned int v3; // edx@1 | |
1658 unsigned int result; // eax@1 | |
1659 unsigned __int16 *v5; // ecx@2 | |
1660 | |
1661 v3 = this->uNumTiles; | |
1662 result = 0; | |
1663 if ( (signed int)this->uNumTiles <= 0 ) | |
1664 { | |
1665 LABEL_6: | |
1666 result = 0; | |
1667 } | |
1668 else | |
1669 { | |
1670 v5 = &this->pTiles->uSection; | |
1671 while ( (signed __int16)*(v5 - 1) != uTerrainType || (signed __int16)*v5 != uSection ) | |
1672 { | |
1673 ++result; | |
1674 v5 += 13; | |
1675 if ( (signed int)result >= (signed int)v3 ) | |
1676 goto LABEL_6; | |
1677 } | |
1678 } | |
1679 return result; | |
1680 } | |
1681 | |
1682 //----- (00487FB4) -------------------------------------------------------- | |
1683 void TileTable::ToFile() | |
1684 { | |
1685 TileTable *v1; // esi@1 | |
1686 FILE *v2; // eax@1 | |
1687 FILE *v3; // edi@1 | |
1688 | |
1689 auto Str = this; | |
1690 | |
1691 v1 = Str; | |
1692 v2 = fopen("data\\dtile.bin", "wb"); | |
1693 v3 = v2; | |
1694 if ( !v2 ) | |
1695 Abortf("Unable to save dtile.bin!"); | |
1696 fwrite(v1, 4u, 1u, v2); | |
1697 fwrite(v1->pTiles, 0x1Au, v1->uNumTiles, v3); | |
1698 fclose(v3); | |
1699 } | |
1700 | |
1701 //----- (00488000) -------------------------------------------------------- | |
1702 void TileTable::FromFile(void *pSerialized) | |
1703 { | |
1704 uNumTiles = *(int *)pSerialized; | |
1705 pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, 26 * uNumTiles, "Tile Descrip"); | |
1706 memcpy(pTiles, (char *)pSerialized + 4, 26 * uNumTiles); | |
1707 } | |
1708 | |
1709 //----- (00488047) -------------------------------------------------------- | |
1710 int TileTable::FromFileTxt(const char *pFilename) | |
1711 { | |
1712 TileTable *v2; // ebp@1 | |
1713 FILE *v3; // eax@1 | |
1714 unsigned int v4; // ebx@3 | |
1715 void *v5; // eax@9 | |
1716 unsigned __int16 v6; // ax@14 | |
1717 const char *v7; // ST14_4@14 | |
1718 unsigned __int16 v8; // ax@14 | |
1719 const char *v9; // esi@14 | |
1720 int v10; // eax@17 | |
1721 int v11; // eax@20 | |
1722 int v12; // eax@22 | |
1723 int v13; // eax@24 | |
1724 int v14; // eax@26 | |
1725 int v15; // eax@28 | |
1726 int v16; // eax@30 | |
1727 int v17; // eax@32 | |
1728 int v18; // eax@34 | |
1729 int v19; // eax@36 | |
1730 int v20; // eax@38 | |
1731 int v21; // eax@40 | |
1732 int v22; // eax@42 | |
1733 int v23; // eax@44 | |
1734 int v24; // eax@46 | |
1735 int v25; // eax@48 | |
1736 int v26; // eax@50 | |
1737 int v27; // eax@52 | |
1738 int v28; // eax@54 | |
1739 int v29; // eax@56 | |
1740 int v30; // eax@58 | |
1741 int v31; // eax@60 | |
1742 int v32; // eax@62 | |
1743 int v33; // eax@64 | |
1744 int v34; // eax@66 | |
1745 const char *v35; // esi@67 | |
1746 int v36; // eax@70 | |
1747 int v37; // eax@73 | |
1748 int v38; // eax@75 | |
1749 int v39; // eax@77 | |
1750 int v40; // eax@79 | |
1751 int v41; // eax@81 | |
1752 int v42; // eax@83 | |
1753 int v43; // eax@85 | |
1754 int v44; // eax@87 | |
1755 int v45; // eax@89 | |
1756 int v46; // eax@91 | |
1757 int v47; // eax@93 | |
1758 int v48; // eax@108 | |
1759 int v49; // eax@110 | |
1760 int v50; // eax@112 | |
1761 int v51; // eax@114 | |
1762 int v52; // eax@116 | |
1763 int v53; // eax@118 | |
1764 int v54; // eax@120 | |
1765 int v55; // eax@122 | |
1766 int v56; // eax@124 | |
1767 int v57; // eax@126 | |
1768 int v58; // eax@128 | |
1769 int v59; // eax@130 | |
1770 int v60; // eax@132 | |
1771 int v61; // eax@134 | |
1772 int v62; // eax@136 | |
1773 int v63; // eax@138 | |
1774 int v64; // eax@140 | |
1775 int v65; // eax@142 | |
1776 int v66; // eax@144 | |
1777 int v67; // eax@146 | |
1778 int v68; // eax@148 | |
1779 int v69; // eax@150 | |
1780 int v70; // eax@151 | |
1781 int j; // edi@152 | |
1782 const char *v72; // esi@153 | |
1783 int v73; // eax@154 | |
1784 int v74; // eax@156 | |
1785 int v75; // eax@160 | |
1786 int v76; // eax@162 | |
1787 int v77; // eax@164 | |
1788 int v78; // eax@166 | |
1789 int v79; // eax@168 | |
1790 int v80; // eax@170 | |
1791 FILE *i; // [sp-10h] [bp-304h]@3 | |
1792 FILE *File; // [sp+4h] [bp-2F0h]@1 | |
1793 FrameTableTxtLine v84; // [sp+8h] [bp-2ECh]@4 | |
1794 FrameTableTxtLine v85; // [sp+84h] [bp-270h]@4 | |
1795 char Buf; // [sp+100h] [bp-1F4h]@4 | |
1796 | |
1797 v2 = this; | |
1798 v3 = fopen(pFilename, "r"); | |
1799 File = v3; | |
1800 if ( !v3 ) | |
1801 Abortf("TileTable::load - Unable to open file: %s."); | |
1802 v4 = 0; | |
1803 for ( i = v3; fgets(&Buf, 490, i); i = File ) | |
1804 { | |
1805 *strchr(&Buf, 10) = 0; | |
703 | 1806 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); |
701 | 1807 if ( v84.uPropCount && *v84.pProperties[0] != 47 ) |
0 | 1808 ++v4; |
1809 } | |
1810 v2->uNumTiles = v4; | |
1811 v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip"); | |
1812 v2->pTiles = (TileDesc *)v5; | |
1813 if ( !v5 ) | |
1814 Abortf("TileTable::Load - Out of Memory!"); | |
1815 memset(v5, 0, 26 * v2->uNumTiles); | |
1816 v2->uNumTiles = 0; | |
1817 fseek(File, 0, 0); | |
1818 if ( fgets(&Buf, 490, File) ) | |
1819 { | |
1820 while ( 1 ) | |
1821 { | |
1822 *strchr(&Buf, 10) = 0; | |
703 | 1823 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); |
701 | 1824 if ( v84.uPropCount ) |
0 | 1825 { |
1826 if ( *v84.pProperties[0] != 47 ) | |
1827 break; | |
1828 } | |
1829 LABEL_173: | |
1830 if ( !fgets(&Buf, 490, File) ) | |
1831 goto LABEL_174; | |
1832 } | |
1833 strcpy(v2->pTiles[v2->uNumTiles].pTileName, v84.pProperties[0]); | |
1834 v6 = atoi(v84.pProperties[1]); | |
1835 v7 = v84.pProperties[2]; | |
1836 v2->pTiles[v2->uNumTiles].uTileID = v6; | |
1837 v8 = atoi(v7); | |
1838 v9 = v84.pProperties[3]; | |
1839 v2->pTiles[v2->uNumTiles].uBitmapID = v8; | |
630 | 1840 v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass; |
0 | 1841 if ( _strcmpi(v9, "TTtype_NULL") ) |
1842 { | |
1843 if ( _strcmpi(v9, "TTtype_Start") ) | |
1844 { | |
1845 if ( _strcmpi(v9, "TTtype_Grass") ) | |
1846 { | |
1847 if ( _strcmpi(v9, "TTtype_Cracked") ) | |
1848 { | |
1849 if ( _strcmpi(v9, "TTtype_Snow") ) | |
1850 { | |
1851 if ( _strcmpi(v9, "TTtype_Sand") ) | |
1852 { | |
1853 if ( _strcmpi(v9, "TTtype_Volcano") ) | |
1854 { | |
1855 if ( _strcmpi(v9, "TTtype_Dirt") ) | |
1856 { | |
1857 if ( _strcmpi(v9, "TTtype_Water") ) | |
1858 { | |
1859 if ( _strcmpi(v9, "TTtype_Tropical") ) | |
1860 { | |
1861 if ( _strcmpi(v9, "TTtype_Swamp") ) | |
1862 { | |
1863 if ( _strcmpi(v9, "TTtype_City") ) | |
1864 { | |
1865 if ( _strcmpi(v9, "TTtype_RoadGrassCobble") ) | |
1866 { | |
1867 if ( _strcmpi(v9, "TTtype_RoadGrassDirt") ) | |
1868 { | |
1869 if ( _strcmpi(v9, "TTtype_RoadCrackedCobble") ) | |
1870 { | |
1871 if ( _strcmpi(v9, "TTtype_RoadCrackedDirt") ) | |
1872 { | |
1873 if ( _strcmpi(v9, "TTtype_RoadSandCobble") ) | |
1874 { | |
1875 if ( _strcmpi(v9, "TTtype_RoadSandDirt") ) | |
1876 { | |
1877 if ( _strcmpi(v9, "TTtype_RoadVolcanoCobble") ) | |
1878 { | |
1879 if ( _strcmpi(v9, "TTtype_RoadVolcanoDirt") ) | |
1880 { | |
1881 if ( _strcmpi(v9, "TTtype_RoadSwampCobble") ) | |
1882 { | |
1883 if ( _strcmpi(v9, "TTtype_RoadSwampDirt") ) | |
1884 { | |
1885 if ( _strcmpi(v9, "TTtype_RoadTropicalCobble") ) | |
1886 { | |
1887 if ( _strcmpi(v9, "TTtype_RoadTropicalDirt") ) | |
1888 { | |
1889 if ( _strcmpi(v9, "TTtype_RoadSnowCobble") ) | |
1890 { | |
1891 if ( _strcmpi(v9, "TTtype_RoadSnowDirt") ) | |
1892 { | |
1893 if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) | |
1894 { | |
630 | 1895 v34 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1896 *(char *)v34 |= 0x1Cu; |
1897 } | |
1898 } | |
1899 else | |
1900 { | |
630 | 1901 v33 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1902 *(char *)v33 |= 0xDu; |
1903 } | |
1904 } | |
1905 else | |
1906 { | |
630 | 1907 v32 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1908 *(char *)v32 |= 0xCu; |
1909 } | |
1910 } | |
1911 else | |
1912 { | |
630 | 1913 v31 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1914 *(char *)v31 |= 0x1Bu; |
1915 } | |
1916 } | |
1917 else | |
1918 { | |
630 | 1919 v30 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1920 *(char *)v30 |= 0x1Au; |
1921 } | |
1922 } | |
1923 else | |
1924 { | |
630 | 1925 v29 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1926 *(char *)v29 |= 0x19u; |
1927 } | |
1928 } | |
1929 else | |
1930 { | |
630 | 1931 v28 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1932 *(char *)v28 |= 0x18u; |
1933 } | |
1934 } | |
1935 else | |
1936 { | |
630 | 1937 v27 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1938 *(char *)v27 |= 0x11u; |
1939 } | |
1940 } | |
1941 else | |
1942 { | |
630 | 1943 v26 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1944 *(char *)v26 |= 0x10u; |
1945 } | |
1946 } | |
1947 else | |
1948 { | |
630 | 1949 v25 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1950 *(char *)v25 |= 0xFu; |
1951 } | |
1952 } | |
1953 else | |
1954 { | |
630 | 1955 v24 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1956 *(char *)v24 |= 0xEu; |
1957 } | |
1958 } | |
1959 else | |
1960 { | |
630 | 1961 v23 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1962 *(char *)v23 |= 0x17u; |
1963 } | |
1964 } | |
1965 else | |
1966 { | |
630 | 1967 v22 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1968 *(char *)v22 |= 0x16u; |
1969 } | |
1970 } | |
1971 else | |
1972 { | |
630 | 1973 v21 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1974 *(char *)v21 |= 0xBu; |
1975 } | |
1976 } | |
1977 else | |
1978 { | |
630 | 1979 v20 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1980 *(char *)v20 |= 0xAu; |
1981 } | |
1982 } | |
1983 else | |
1984 { | |
630 | 1985 v19 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1986 *(char *)v19 |= 9u; |
1987 } | |
1988 } | |
1989 else | |
1990 { | |
630 | 1991 v18 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1992 *(char *)v18 |= 7u; |
1993 } | |
1994 } | |
1995 else | |
1996 { | |
630 | 1997 v17 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1998 *(char *)v17 |= 8u; |
1999 } | |
2000 } | |
2001 else | |
2002 { | |
630 | 2003 v16 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2004 *(char *)v16 |= 5u; |
2005 } | |
2006 } | |
2007 else | |
2008 { | |
630 | 2009 v15 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2010 *(char *)v15 |= 4u; |
2011 } | |
2012 } | |
2013 else | |
2014 { | |
630 | 2015 v14 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2016 *(char *)v14 |= 3u; |
2017 } | |
2018 } | |
2019 else | |
2020 { | |
630 | 2021 v13 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2022 *(char *)v13 |= 2u; |
2023 } | |
2024 } | |
2025 else | |
2026 { | |
630 | 2027 v12 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2028 *(char *)v12 |= 1u; |
2029 } | |
2030 } | |
2031 else | |
2032 { | |
630 | 2033 v11 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2034 *(char *)v11 |= 6u; |
2035 } | |
2036 } | |
2037 } | |
2038 else | |
2039 { | |
2040 v10 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2041 *(char *)v10 |= 0xFEu; | |
2042 } | |
2043 } | |
2044 else | |
2045 { | |
630 | 2046 LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1; |
0 | 2047 } |
2048 v35 = v84.pProperties[4]; | |
2049 v2->pTiles[v2->uNumTiles].uSection = 0; | |
2050 v2->pTiles[v2->uNumTiles].uAttributes = 0; | |
2051 if ( !_strcmpi(v35, "TTsect_NULL") ) | |
2052 { | |
2053 LOBYTE(v2->pTiles[v2->uNumTiles].uSection) = -1; | |
2054 LABEL_152: | |
701 | 2055 for ( j = 5; j < v84.uPropCount; ++j ) |
0 | 2056 { |
2057 v72 = v84.pProperties[j]; | |
2058 if ( _strcmpi(v84.pProperties[j], "TTattr_Burn") ) | |
2059 { | |
2060 if ( _strcmpi(v72, "TTattr_Water") ) | |
2061 { | |
2062 if ( _strcmpi(v72, "TTattr_Water2") ) | |
2063 { | |
2064 if ( _strcmpi(v72, "TTattr_Block") ) | |
2065 { | |
2066 if ( _strcmpi(v72, "TTattr_Repulse") ) | |
2067 { | |
2068 if ( _strcmpi(v72, "TTattr_Flat") ) | |
2069 { | |
2070 if ( _strcmpi(v72, "TTattr_Wave") ) | |
2071 { | |
2072 if ( _strcmpi(v72, "TTattr_NoDraw") ) | |
2073 { | |
2074 if ( !_strcmpi(v72, "TTattr_Transition") ) | |
2075 { | |
2076 v80 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2077 *(short *)v80 |= 0x200u; | |
2078 } | |
2079 } | |
2080 else | |
2081 { | |
2082 v79 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2083 *(char *)v79 |= 0x40u; | |
2084 } | |
2085 } | |
2086 else | |
2087 { | |
2088 v78 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2089 *(char *)v78 |= 0x20u; | |
2090 } | |
2091 } | |
2092 else | |
2093 { | |
2094 v77 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2095 *(char *)v77 |= 0x10u; | |
2096 } | |
2097 } | |
2098 else | |
2099 { | |
2100 v76 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2101 *(char *)v76 |= 8u; | |
2102 } | |
2103 } | |
2104 else | |
2105 { | |
2106 v75 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2107 *(char *)v75 |= 4u; | |
2108 } | |
2109 } | |
2110 else | |
2111 { | |
2112 HIBYTE(v2->pTiles[v2->uNumTiles].uAttributes) |= 1u; | |
2113 } | |
2114 } | |
2115 else | |
2116 { | |
2117 v74 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2118 *(char *)v74 |= 2u; | |
2119 } | |
2120 } | |
2121 else | |
2122 { | |
2123 v73 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2124 *(char *)v73 |= 1u; | |
2125 } | |
2126 } | |
2127 ++v2->uNumTiles; | |
2128 goto LABEL_173; | |
2129 } | |
2130 if ( !_strcmpi(v35, "TTsect_Start") ) | |
2131 { | |
2132 v36 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2133 *(char *)v36 |= 0xFEu; | |
2134 goto LABEL_152; | |
2135 } | |
2136 if ( !_strcmpi(v35, "TTsect_Base1") ) | |
2137 goto LABEL_152; | |
2138 if ( !_strcmpi(v35, "TTsect_Base2") ) | |
2139 { | |
2140 v37 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2141 *(char *)v37 |= 1u; | |
2142 goto LABEL_152; | |
2143 } | |
2144 if ( !_strcmpi(v35, "TTsect_Base3") ) | |
2145 { | |
2146 v38 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2147 *(char *)v38 |= 2u; | |
2148 goto LABEL_152; | |
2149 } | |
2150 if ( !_strcmpi(v35, "TTsect_Base4") ) | |
2151 { | |
2152 v39 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2153 *(char *)v39 |= 3u; | |
2154 goto LABEL_152; | |
2155 } | |
2156 if ( !_strcmpi(v35, "TTsect_Special1") ) | |
2157 { | |
2158 v40 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2159 *(char *)v40 |= 4u; | |
2160 goto LABEL_152; | |
2161 } | |
2162 if ( !_strcmpi(v35, "TTsect_Special2") ) | |
2163 { | |
2164 v41 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2165 *(char *)v41 |= 5u; | |
2166 goto LABEL_152; | |
2167 } | |
2168 if ( !_strcmpi(v35, "TTsect_Special3") ) | |
2169 { | |
2170 v42 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2171 *(char *)v42 |= 6u; | |
2172 goto LABEL_152; | |
2173 } | |
2174 if ( !_strcmpi(v35, "TTsect_Special4") ) | |
2175 { | |
2176 v43 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2177 *(char *)v43 |= 7u; | |
2178 goto LABEL_152; | |
2179 } | |
2180 if ( !_strcmpi(v35, "TTsect_Special5") ) | |
2181 { | |
2182 v44 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2183 *(char *)v44 |= 8u; | |
2184 goto LABEL_152; | |
2185 } | |
2186 if ( !_strcmpi(v35, "TTsect_Special6") ) | |
2187 { | |
2188 v45 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2189 *(char *)v45 |= 9u; | |
2190 goto LABEL_152; | |
2191 } | |
2192 if ( !_strcmpi(v35, "TTsect_Special7") ) | |
2193 { | |
2194 v46 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2195 *(char *)v46 |= 0xAu; | |
2196 goto LABEL_152; | |
2197 } | |
2198 if ( !_strcmpi(v35, "TTsect_Special8") ) | |
2199 { | |
2200 v47 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2201 *(char *)v47 |= 0xBu; | |
2202 goto LABEL_152; | |
2203 } | |
2204 if ( !_strcmpi(v35, "TTsect_NE1") ) | |
2205 goto LABEL_130; | |
2206 if ( !_strcmpi(v35, "TTsect_NW1") ) | |
2207 goto LABEL_134; | |
2208 if ( !_strcmpi(v35, "TTsect_SE1") ) | |
2209 goto LABEL_130; | |
2210 if ( !_strcmpi(v35, "TTsect_SW1") ) | |
2211 goto LABEL_134; | |
2212 if ( !_strcmpi(v35, "TTsect_E1") ) | |
2213 goto LABEL_138; | |
2214 if ( !_strcmpi(v35, "TTsect_W1") ) | |
2215 goto LABEL_140; | |
2216 if ( !_strcmpi(v35, "TTsect_N1") ) | |
2217 goto LABEL_142; | |
2218 if ( !_strcmpi(v35, "TTsect_S1") ) | |
2219 goto LABEL_144; | |
2220 if ( !_strcmpi(v35, "TTsect_XNE1") ) | |
2221 goto LABEL_146; | |
2222 if ( _strcmpi(v35, "TTsect_XNW1") ) | |
2223 { | |
2224 if ( !_strcmpi(v35, "TTsect_XSE1") ) | |
2225 goto LABEL_146; | |
2226 if ( _strcmpi(v35, "TTsect_XSW1") ) | |
2227 { | |
2228 if ( !_strcmpi(v35, "TTsect_CROS") ) | |
2229 { | |
2230 LABEL_151: | |
2231 v70 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2232 *(short *)v70 |= 0x200u; | |
2233 goto LABEL_152; | |
2234 } | |
2235 if ( !_strcmpi(v35, "TTsect_NS") ) | |
2236 { | |
2237 v48 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2238 *(char *)v48 |= 1u; | |
2239 goto LABEL_151; | |
2240 } | |
2241 if ( !_strcmpi(v35, "TTsect_EW") ) | |
2242 { | |
2243 v49 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2244 *(char *)v49 |= 2u; | |
2245 goto LABEL_151; | |
2246 } | |
2247 if ( !_strcmpi(v35, "TTsect_N_E") ) | |
2248 { | |
2249 v50 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2250 *(char *)v50 |= 3u; | |
2251 goto LABEL_151; | |
2252 } | |
2253 if ( !_strcmpi(v35, "TTsect_N_W") ) | |
2254 { | |
2255 v51 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2256 *(char *)v51 |= 4u; | |
2257 goto LABEL_151; | |
2258 } | |
2259 if ( !_strcmpi(v35, "TTsect_S_E") ) | |
2260 { | |
2261 v52 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2262 *(char *)v52 |= 5u; | |
2263 goto LABEL_151; | |
2264 } | |
2265 if ( !_strcmpi(v35, "TTsect_S_W") ) | |
2266 { | |
2267 v53 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2268 *(char *)v53 |= 6u; | |
2269 goto LABEL_151; | |
2270 } | |
2271 if ( !_strcmpi(v35, "TTsect_NS_E") ) | |
2272 { | |
2273 v54 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2274 *(char *)v54 |= 7u; | |
2275 goto LABEL_151; | |
2276 } | |
2277 if ( !_strcmpi(v35, "TTsect_NS_W") ) | |
2278 { | |
2279 v55 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2280 *(char *)v55 |= 8u; | |
2281 goto LABEL_151; | |
2282 } | |
2283 if ( !_strcmpi(v35, "TTsect_EW_N") ) | |
2284 { | |
2285 v56 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2286 *(char *)v56 |= 9u; | |
2287 goto LABEL_151; | |
2288 } | |
2289 if ( !_strcmpi(v35, "TTsect_EW_S") ) | |
2290 { | |
2291 v57 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2292 *(char *)v57 |= 0xAu; | |
2293 goto LABEL_151; | |
2294 } | |
2295 if ( !_strcmpi(v35, "TTsect_NCAP") ) | |
2296 { | |
2297 v58 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2298 *(char *)v58 |= 0xBu; | |
2299 goto LABEL_151; | |
2300 } | |
2301 if ( !_strcmpi(v35, "TTsect_ECAP") ) | |
2302 { | |
2303 LABEL_130: | |
2304 v59 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2305 *(char *)v59 |= 0xCu; | |
2306 goto LABEL_151; | |
2307 } | |
2308 if ( !_strcmpi(v35, "TTsect_SCAP") ) | |
2309 { | |
2310 v60 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2311 *(char *)v60 |= 0xDu; | |
2312 goto LABEL_151; | |
2313 } | |
2314 if ( !_strcmpi(v35, "TTsect_WCAP") ) | |
2315 { | |
2316 LABEL_134: | |
2317 v61 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2318 *(char *)v61 |= 0xEu; | |
2319 goto LABEL_151; | |
2320 } | |
2321 if ( !_strcmpi(v35, "TTsect_DN") ) | |
2322 { | |
2323 v62 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2324 *(char *)v62 |= 0xFu; | |
2325 goto LABEL_151; | |
2326 } | |
2327 if ( !_strcmpi(v35, "TTsect_DS") ) | |
2328 { | |
2329 LABEL_138: | |
2330 v63 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2331 *(char *)v63 |= 0x10u; | |
2332 goto LABEL_151; | |
2333 } | |
2334 if ( !_strcmpi(v35, "TTsect_DW") ) | |
2335 { | |
2336 LABEL_140: | |
2337 v64 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2338 *(char *)v64 |= 0x11u; | |
2339 goto LABEL_151; | |
2340 } | |
2341 if ( !_strcmpi(v35, "TTsect_DE") ) | |
2342 { | |
2343 LABEL_142: | |
2344 v65 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2345 *(char *)v65 |= 0x12u; | |
2346 goto LABEL_151; | |
2347 } | |
2348 if ( !_strcmpi(v35, "TTsect_DSW") ) | |
2349 { | |
2350 LABEL_144: | |
2351 v66 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2352 *(char *)v66 |= 0x13u; | |
2353 goto LABEL_151; | |
2354 } | |
2355 if ( !_strcmpi(v35, "TTsect_DNE") ) | |
2356 { | |
2357 LABEL_146: | |
2358 v67 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2359 *(char *)v67 |= 0x14u; | |
2360 goto LABEL_151; | |
2361 } | |
2362 if ( !_strcmpi(v35, "TTsect_DSE") ) | |
2363 { | |
2364 v68 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2365 *(char *)v68 |= 0x15u; | |
2366 goto LABEL_151; | |
2367 } | |
2368 if ( _strcmpi(v35, "TTsect_DNW") ) | |
2369 goto LABEL_152; | |
2370 } | |
2371 } | |
2372 v69 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2373 *(char *)v69 |= 0x16u; | |
2374 goto LABEL_151; | |
2375 } | |
2376 LABEL_174: | |
2377 fclose(File); | |
2378 return 1; | |
2379 } | |
2380 | |
2381 | |
2382 | |
2383 //----- (0048958E) -------------------------------------------------------- | |
2384 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
2385 { | |
2386 stru12_MemoryBlock *v2; // esi@1 | |
2387 void *v3; // eax@1 | |
2388 void *v4; // ecx@1 | |
2389 stru12_MemoryBlock *result; // eax@1 | |
2390 | |
2391 v2 = this; | |
2392 v3 = operator new(8 * a2 + 16); | |
2393 v2->pBlockBase = v3; | |
2394 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
2395 result = v2; | |
2396 v2->pAlignedBlock = v4; | |
2397 } | |
2398 | |
2399 //----- (004895B7) -------------------------------------------------------- | |
2400 stru12::stru12(stru11 *pStru11) | |
2401 { | |
2402 stru12 *v2; // esi@1 | |
2403 | |
2404 v2 = this; | |
2405 this->field_44 = 0x41000000u; | |
2406 this->field_4C = 0x46000000u; | |
2407 //this->vdestructor_ptr = stru12::_4898E6; | |
2408 this->field_48 = 0; | |
2409 this->field_50 = 0; | |
2410 this->field_54 = 0x33D6BF95u; | |
2411 this->field_58 = 0; | |
2412 | |
2413 for (int i = 0; i < 12; ++i) | |
2414 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
2415 /* | |
2416 v3 = (stru12_MemoryBlock *)operator new(8u); | |
2417 if ( v3 ) | |
2418 v4 = AllocAlignedMem(v3, 640); | |
2419 else | |
2420 v4 = 0; | |
2421 v2->pMemBlocks[0] = v4; | |
2422 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
2423 if ( v5 ) | |
2424 v6 = AllocAlignedMem(v5, 640); | |
2425 else | |
2426 v6 = 0; | |
2427 v2->pMemBlocks[1] = v6; | |
2428 v7 = (stru12_MemoryBlock *)operator new(8u); | |
2429 if ( v7 ) | |
2430 v8 = AllocAlignedMem(v7, 640); | |
2431 else | |
2432 v8 = 0; | |
2433 v2->pMemBlocks[2] = v8; | |
2434 v9 = (stru12_MemoryBlock *)operator new(8u); | |
2435 if ( v9 ) | |
2436 v10 = AllocAlignedMem(v9, 640); | |
2437 else | |
2438 v10 = 0; | |
2439 v2->pMemBlocks[3] = v10; | |
2440 v11 = (stru12_MemoryBlock *)operator new(8u); | |
2441 if ( v11 ) | |
2442 v12 = AllocAlignedMem(v11, 640); | |
2443 else | |
2444 v12 = 0; | |
2445 v2->pMemBlocks[4] = v12; | |
2446 v13 = (stru12_MemoryBlock *)operator new(8u); | |
2447 if ( v13 ) | |
2448 v14 = AllocAlignedMem(v13, 640); | |
2449 else | |
2450 v14 = 0; | |
2451 v2->pMemBlocks[5] = v14; | |
2452 v15 = (stru12_MemoryBlock *)operator new(8u); | |
2453 if ( v15 ) | |
2454 v16 = AllocAlignedMem(v15, 640); | |
2455 else | |
2456 v16 = 0; | |
2457 v2->pMemBlocks[6] = v16; | |
2458 v17 = (stru12_MemoryBlock *)operator new(8u); | |
2459 if ( v17 ) | |
2460 v18 = AllocAlignedMem(v17, 640); | |
2461 else | |
2462 v18 = 0; | |
2463 v2->pMemBlocks[7] = v18; | |
2464 v19 = (stru12_MemoryBlock *)operator new(8u); | |
2465 if ( v19 ) | |
2466 v20 = AllocAlignedMem(v19, 640); | |
2467 else | |
2468 v20 = 0; | |
2469 v2->pMemBlocks[8] = v20; | |
2470 v21 = (stru12_MemoryBlock *)operator new(8u); | |
2471 if ( v21 ) | |
2472 v22 = AllocAlignedMem(v21, 640); | |
2473 else | |
2474 v22 = 0; | |
2475 v2->pMemBlocks[9] = v22; | |
2476 v23 = (stru12_MemoryBlock *)operator new(8u); | |
2477 if ( v23 ) | |
2478 v24 = AllocAlignedMem(v23, 640); | |
2479 else | |
2480 v24 = 0; | |
2481 v2->pMemBlocks[10] = v24; | |
2482 v25 = (stru12_MemoryBlock *)operator new(8u); | |
2483 if ( v25 ) | |
2484 v26 = AllocAlignedMem(v25, 640); | |
2485 else | |
2486 v26 = 0; | |
2487 v2->field_8C = 0; | |
2488 v2->pMemBlocks[11] = v26;*/ | |
2489 } | |
2490 | |
2491 //----- (00489810) -------------------------------------------------------- | |
2492 stru12::~stru12() | |
2493 { | |
2494 for (int i = 0; i < 12; ++i) | |
2495 delete pMemBlocks[i]; | |
2496 /*if ( v2 ) | |
2497 stru12_MemoryBlock::dtor(v2, 1); | |
2498 v3 = v1->pMemBlocks[1]; | |
2499 if ( v3 ) | |
2500 stru12_MemoryBlock::dtor(v3, 1); | |
2501 v4 = v1->pMemBlocks[2]; | |
2502 if ( v4 ) | |
2503 stru12_MemoryBlock::dtor(v4, 1); | |
2504 v5 = v1->pMemBlocks[3]; | |
2505 if ( v5 ) | |
2506 stru12_MemoryBlock::dtor(v5, 1); | |
2507 v6 = v1->pMemBlocks[4]; | |
2508 if ( v6 ) | |
2509 stru12_MemoryBlock::dtor(v6, 1); | |
2510 v7 = v1->pMemBlocks[5]; | |
2511 if ( v7 ) | |
2512 stru12_MemoryBlock::dtor(v7, 1); | |
2513 v8 = v1->pMemBlocks[6]; | |
2514 if ( v8 ) | |
2515 stru12_MemoryBlock::dtor(v8, 1); | |
2516 v9 = v1->pMemBlocks[7]; | |
2517 if ( v9 ) | |
2518 stru12_MemoryBlock::dtor(v9, 1); | |
2519 v10 = v1->pMemBlocks[8]; | |
2520 if ( v10 ) | |
2521 stru12_MemoryBlock::dtor(v10, 1); | |
2522 v11 = v1->pMemBlocks[9]; | |
2523 if ( v11 ) | |
2524 stru12_MemoryBlock::dtor(v11, 1); | |
2525 v12 = v1->pMemBlocks[10]; | |
2526 if ( v12 ) | |
2527 stru12_MemoryBlock::dtor(v12, 1); | |
2528 v13 = v1->pMemBlocks[11]; | |
2529 if ( v13 ) | |
2530 stru12_MemoryBlock::dtor(v13, 1);*/ | |
2531 } | |
2532 | |
2533 //----- (004898BF) -------------------------------------------------------- | |
2534 stru12_MemoryBlock::~stru12_MemoryBlock() | |
2535 { | |
2536 stru12_MemoryBlock *v2; // esi@1 | |
2537 void *v3; // ST00_4@1 | |
2538 | |
2539 v2 = this; | |
2540 v3 = this->pBlockBase; | |
2541 this->pAlignedBlock = 0; | |
2542 free(v3); | |
2543 v2->pBlockBase = 0; | |
2544 /*if ( a2 & 1 ) | |
2545 free(v2);*/ | |
2546 } | |
2547 | |
2548 //----- (004898E6) -------------------------------------------------------- | |
2549 void stru12::_4898E6() | |
2550 { | |
2551 void *v1; // eax@1 | |
2552 void *v2; // edx@1 | |
2553 char *v3; // edi@2 | |
2554 double v4; // st7@2 | |
2555 char *v5; // ebx@2 | |
2556 double v6; // st6@3 | |
2557 double v7; // st5@3 | |
2558 double v8; // st4@3 | |
2559 int v9; // esi@3 | |
2560 double v10; // st3@3 | |
2561 float v11; // ST34_4@5 | |
2562 double v12; // st6@10 | |
2563 double v13; // ST0C_8@10 | |
2564 char *v14; // [sp+14h] [bp-44h]@2 | |
2565 char *v15; // [sp+18h] [bp-40h]@2 | |
2566 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
2567 char *v17; // [sp+20h] [bp-38h]@2 | |
2568 char *v18; // [sp+24h] [bp-34h]@2 | |
2569 float v19; // [sp+30h] [bp-28h]@3 | |
2570 float v20; // [sp+38h] [bp-20h]@3 | |
2571 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
2572 int v22; // [sp+40h] [bp-18h]@1 | |
2573 char *v23; // [sp+44h] [bp-14h]@2 | |
2574 char *v24; // [sp+48h] [bp-10h]@2 | |
2575 int v25; // [sp+4Ch] [bp-Ch]@2 | |
2576 float v26; // [sp+50h] [bp-8h]@3 | |
2577 float v27; // [sp+54h] [bp-4h]@3 | |
2578 | |
731 | 2579 __debugbreak(); |
0 | 2580 v22 = 0; |
2581 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
2582 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
2583 if ( this->field_8C > 0 ) | |
2584 { | |
2585 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
2586 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
2587 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
2588 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
2589 v25 = (int)v1 - (int)v2; | |
2590 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
2591 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
2592 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
2593 v4 = 1.0; | |
2594 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
2595 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
2596 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
2597 do | |
2598 { | |
2599 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
2600 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
2601 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
2602 v7 = pIndoorCamera->fRotationYCosine; | |
2603 v8 = pIndoorCamera->fRotationYSine; | |
2604 v20 = pIndoorCamera->fRotationXCosine; | |
2605 v19 = pIndoorCamera->fRotationXSine; | |
2606 v9 = (int)((char *)v2 + (int)v21); | |
2607 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
2608 if ( pIndoorCamera->sRotationX ) | |
2609 { | |
2610 v11 = v10; | |
2611 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
2612 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
2613 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
2614 } | |
2615 else | |
2616 { | |
2617 *(float *)v9 = v10; | |
2618 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
2619 *(float *)((char *)v2 + (int)v5) = v6; | |
2620 } | |
2621 if ( *(float *)v9 >= 8.0 ) | |
2622 { | |
2623 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
2624 { | |
2625 *(int *)v2 = 0; | |
2626 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
2627 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
2628 - v12 * *(float *)((char *)v2 + (int)v3); | |
2629 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
2630 - v12 * *(float *)((char *)v2 + (int)v5); | |
2631 *(float *)((char *)v2 + (int)v16) = v4 | |
2632 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
2633 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
2634 v13 = *(float *)v9 + 6.7553994e15; | |
2635 v4 = 1.0; | |
2636 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
2637 } | |
2638 else | |
2639 { | |
2640 *(int *)v2 = 2; | |
2641 } | |
2642 } | |
2643 else | |
2644 { | |
2645 *(int *)v2 = 1; | |
2646 } | |
2647 ++v22; | |
2648 v2 = (char *)v2 + 4; | |
2649 } | |
2650 while ( v22 < this->field_8C ); | |
2651 } | |
2652 this->field_8C = 0; | |
2653 } | |
2654 | |
2655 | |
2656 | |
2657 | |
2658 | |
2659 //----- (0048A959) -------------------------------------------------------- | |
2660 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
2661 { | |
2662 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
2663 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
2664 b = (uColor & 0x000000FF) / 255.0f; | |
2665 | |
2666 float h, s, v; | |
2667 RGB2HSV(&h, &s, r, g, b, &v); | |
2668 | |
2669 if ( h_replace != -1.0 ) | |
2670 h = h_replace; | |
2671 if ( s_replace != -1.0 ) | |
2672 s = s_replace; | |
2673 if ( v_replace != -1.0 ) | |
2674 v = v_replace; | |
2675 HSV2RGB(&r, &g, &b, h, s, v); | |
2676 | |
2677 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
2678 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
2679 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
2680 } | |
2681 | |
2682 | |
2683 //----- (0048B561) -------------------------------------------------------- | |
2684 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
2685 { | |
2686 //v2 = a2 - 0.5; | |
2687 //v3 = v2 + 6.7553994e15; | |
2688 int v4 = floorf(a2 - 0.5f + 0.5f); | |
2689 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
2690 //v5 = v7 + 6.7553994e15; | |
2691 //return LODWORD(v5) | (v4 << 16); | |
2692 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
2693 return v5 | (v4 << 16); | |
2694 } | |
2695 | |
2696 | |
2697 | |
2698 | |
2699 | |
2700 | |
2701 //----- (00491E3A) -------------------------------------------------------- | |
2702 void __cdecl sub_491E3A() | |
2703 { | |
2704 Player *v0; // ebx@1 | |
2705 signed int v1; // esi@3 | |
2706 char *v2; // eax@4 | |
2707 unsigned int v3; // eax@7 | |
2708 unsigned int v4; // edx@8 | |
2709 char *v5; // ecx@9 | |
2710 int v6; // edi@17 | |
2711 Texture *v7; // ebx@18 | |
2712 struct IDirect3DTexture2 **v8; // eax@19 | |
2713 struct IDirect3DTexture2 *v9; // eax@20 | |
2714 struct IDirectDrawSurface **v10; // eax@22 | |
2715 struct IDirectDrawSurface *v11; // eax@23 | |
2716 int v12; // eax@26 | |
2717 | |
2718 v0 = pParty->pPlayers; | |
2719 do | |
2720 { | |
203 | 2721 if (SoundSetAction[24][0]) |
0 | 2722 { |
2723 v1 = 0; | |
2724 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
2725 { | |
2726 LABEL_7: | |
2727 v3 = 0; | |
2728 } | |
2729 else | |
2730 { | |
2731 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 2732 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 2733 { |
2734 ++v1; | |
2735 v2 += 120; | |
2736 if ( v1 >= (signed int)pSoundList->uNumSounds ) | |
2737 goto LABEL_7; | |
2738 } | |
2739 v3 = v1; | |
2740 } | |
2741 pSoundList->_4A9DCD(v3, 1); | |
2742 v4 = 0; | |
2743 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
2744 { | |
2745 LABEL_12: | |
2746 v4 = 0; | |
2747 } | |
2748 else | |
2749 { | |
2750 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 2751 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 2752 { |
2753 ++v4; | |
2754 v5 += 120; | |
2755 if ( (signed int)v4 >= (signed int)pSoundList->uNumSounds ) | |
2756 goto LABEL_12; | |
2757 } | |
2758 } | |
2759 pSoundList->_4A9DCD(v4, 1); | |
2760 } | |
2761 ++v0; | |
2762 } | |
2763 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
2764 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 2765 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 2766 { |
2767 v7 = &pIcons_LOD->pTextures[v6]; | |
2768 do | |
2769 { | |
2770 v7->Release(); | |
2771 v8 = pIcons_LOD->pHardwareTextures; | |
2772 if ( v8 ) | |
2773 { | |
2774 v9 = v8[v6]; | |
2775 if ( v9 ) | |
2776 { | |
2777 v9->Release(); | |
2778 pIcons_LOD->pHardwareTextures[v6] = 0; | |
2779 } | |
2780 } | |
2781 v10 = pIcons_LOD->pHardwareSurfaces; | |
2782 if ( v10 ) | |
2783 { | |
2784 v11 = v10[v6]; | |
2785 if ( v11 ) | |
2786 { | |
2787 v11->Release(); | |
2788 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
2789 } | |
2790 } | |
2791 --v6; | |
2792 --v7; | |
2793 } | |
33 | 2794 while ( v6 >= pIcons_LOD->pFacesLock ); |
2795 } | |
2796 v12 = pIcons_LOD->pFacesLock; | |
2797 pIcons_LOD->pFacesLock = 0; | |
0 | 2798 pIcons_LOD->uNumLoadedFiles = v12; |
2799 } | |
2800 // 4ED498: using guessed type char byte_4ED498; | |
2801 | |
706 | 2802 |
0 | 2803 |
2804 | |
2805 //----- (0049387A) -------------------------------------------------------- | |
2806 int CycleCharacter(unsigned int _this) | |
2807 { | |
2808 signed int result; // eax@1 | |
2809 signed int v2; // ecx@2 | |
2810 signed int v3; // ecx@8 | |
2811 | |
2812 result = uActiveCharacter; | |
2813 if ( _this ) | |
2814 { | |
2815 v2 = 0; | |
2816 while ( 1 ) | |
2817 { | |
2818 --result; | |
2819 if ( result < 1 ) | |
2820 result = 4; | |
2821 if ( !pPlayers[result]->uTimeToRecovery ) | |
2822 break; | |
2823 ++v2; | |
2824 if ( v2 >= 4 ) | |
2825 return uActiveCharacter; | |
2826 } | |
2827 } | |
2828 else | |
2829 { | |
2830 v3 = 0; | |
2831 while ( 1 ) | |
2832 { | |
2833 ++result; | |
2834 if ( result > 4 ) | |
2835 result = 1; | |
2836 if ( !pPlayers[result]->uTimeToRecovery ) | |
2837 break; | |
2838 ++v3; | |
2839 if ( v3 >= 4 ) | |
2840 return uActiveCharacter; | |
2841 } | |
2842 } | |
2843 return result; | |
2844 } | |
2845 | |
2846 //----- (004938D1) -------------------------------------------------------- | |
2847 void __fastcall Rest(unsigned int uHoursToSleep) | |
2848 { | |
2849 unsigned int v1; // esi@1 | |
2850 double v2; // st7@3 | |
2851 Player **v3; // esi@3 | |
2852 | |
2853 v1 = uHoursToSleep; | |
2854 if ( uHoursToSleep > 240 ) | |
2855 InitializeActors(); | |
2856 v2 = (double)(7680 * v1) * 0.033333335; | |
2857 pParty->uTimePlayed += (signed __int64)v2; | |
2858 v3 = &pPlayers[1]; | |
2859 do | |
2860 { | |
2861 (*v3)->Recover((signed __int64)v2); | |
2862 ++v3; | |
2863 } | |
2864 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
2865 _494035_timed_effects__water_walking_damage__etc(); | |
2866 } | |
2867 | |
2868 //----- (00493938) -------------------------------------------------------- | |
2869 int __cdecl _493938_regenerate() | |
2870 { | |
2871 int v0; // edi@1 | |
2872 signed __int64 v1; // qax@1 | |
2873 int v2; // ecx@1 | |
2874 int result; // eax@1 | |
2875 int v4; // eax@2 | |
2876 int v5; // edi@5 | |
112 | 2877 int *v6; // ecx@5 |
0 | 2878 char v7; // sf@5 |
112 | 2879 int *v8; // ecx@10 |
0 | 2880 int v9; // edi@15 |
2881 signed int v10; // eax@15 | |
2882 __int16 *v11; // edx@16 | |
2883 int v12; // eax@20 | |
2884 int v13; // ebx@20 | |
2885 unsigned int *v14; // esi@21 | |
2886 unsigned int v15; // ecx@21 | |
2887 unsigned int v16; // eax@21 | |
2888 int v17; // edx@21 | |
2889 int v18; // eax@21 | |
2890 signed int v19; // eax@21 | |
2891 signed int v20; // ebx@25 | |
2892 Player *v21; // esi@25 | |
2893 ITEM_EQUIP_TYPE v22; // edi@30 | |
2894 //int v23; // edx@31 | |
2895 signed int v24; // ecx@32 | |
2896 signed int v25; // eax@33 | |
2897 int v26; // eax@35 | |
2898 int v27; // eax@36 | |
2899 int v28; // eax@37 | |
2900 int v29; // eax@40 | |
2901 int v30; // eax@41 | |
2902 signed int v31; // ecx@53 | |
2903 char *v32; // eax@53 | |
2904 char *v33; // edi@82 | |
2905 int v34; // ecx@88 | |
2906 int v35; // eax@88 | |
2907 char *v36; // edi@99 | |
2908 int v37; // edi@104 | |
2909 int v38; // edi@106 | |
2910 int v39; // edi@111 | |
2911 int v40; // ecx@113 | |
2912 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
|
2913 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2914 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2915 int v44; // [sp+210h] [bp-20h]@22 | |
2916 int v45; // [sp+214h] [bp-1Ch]@25 | |
2917 int v46; // [sp+218h] [bp-18h]@25 | |
2918 int v47; // [sp+21Ch] [bp-14h]@25 | |
2919 int v48; // [sp+220h] [bp-10h]@25 | |
2920 int v49; // [sp+224h] [bp-Ch]@24 | |
2921 int v50; // [sp+228h] [bp-8h]@25 | |
2922 int v51; // [sp+22Ch] [bp-4h]@2 | |
2923 | |
2924 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2925 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2926 v2 = (signed int)v1 / 60; | |
2927 result = (signed int)v1 / 60 + 5; | |
2928 if ( v0 >= result ) | |
2929 { | |
2930 v51 = 0; | |
2931 v4 = (v0 - v2) / 5; | |
2932 if (pParty->FlyActive()) | |
2933 { | |
2934 if ( pParty->bFlying ) | |
2935 { | |
569 | 2936 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2937 { // colliding with something in the air - fall down | |
2938 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2939 //__debugbreak(); | |
2940 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2941 v7 = *v6 < v5; |
2942 *v6 -= v5; | |
0 | 2943 if ( v7 ) |
2944 { | |
112 | 2945 *v6 = 0; |
0 | 2946 pParty->uFlags &= 0xFFFFFFBFu; |
2947 pParty->bFlying = 0; | |
2948 v51 = 1; | |
2949 } | |
2950 } | |
2951 } | |
2952 } | |
569 | 2953 |
0 | 2954 if (pParty->WaterWalkActive()) |
2955 { | |
569 | 2956 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2957 { | |
2958 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2959 { // taking on water | |
2960 //__debugbreak(); | |
2961 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2962 v7 = *v8 < v4; |
2963 *v8 -= v4; | |
0 | 2964 if ( v7 ) |
2965 { | |
112 | 2966 *v8 = 0; |
569 | 2967 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2968 v51 = 1; |
2969 } | |
2970 } | |
2971 } | |
2972 } | |
569 | 2973 |
0 | 2974 if (pParty->ImmolationActive()) |
2975 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2976 //SpriteObject::SpriteObject(&a1); |
0 | 2977 v9 = 0; |
2978 a3.z = 0; | |
2979 a3.y = 0; | |
2980 a3.x = 0; | |
2981 a1.stru_24.Reset(); | |
2982 a1.field_4C = pParty->pPartyBuffs[10].uPower; | |
2983 a1.field_50 = pParty->ImmolationSkillLevel(); | |
2984 v10 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2985 a1.uType = 1070; |
0 | 2986 a1.field_48 = 8; |
2987 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2988 { | |
2989 LABEL_19: | |
2990 LOWORD(v10) = 0; | |
2991 } | |
2992 else | |
2993 { | |
2994 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2995 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2996 { |
2997 ++v10; | |
2998 v11 += 28; | |
2999 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
3000 goto LABEL_19; | |
3001 } | |
3002 } | |
3003 a1.uObjectDescID = v10; | |
3004 a1.field_60_distance_related_prolly_lod = 0; | |
3005 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 3006 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 3007 a1.uAttributes = 0; |
3008 a1.uSectorID = 0; | |
3009 a1.uSpriteFrameID = 0; | |
303 | 3010 a1.field_58_pid = v12; |
0 | 3011 a1.uFacing = 0; |
3012 a1.uSoundID = 0; | |
3013 v13 = sub_46A89E((int)v41, 100, 307); | |
3014 if ( v13 > 0 ) | |
3015 { | |
3016 do | |
3017 { | |
3018 v14 = (unsigned int *)&v41[4 * v9]; | |
3019 v15 = *v14; | |
3020 v16 = *v14; | |
3021 a1.vPosition.x = pActors[v16].vPosition.x; | |
3022 v17 = pActors[v16].vPosition.y; | |
3023 a1.vPosition.z = pActors[v16].vPosition.z; | |
3024 v18 = 8 * v15; | |
3025 LOBYTE(v18) = 8 * v15 | 3; | |
3026 a1.vPosition.y = v17; | |
3027 a1.field_5C = v18; | |
3028 v19 = a1.Create(0, 0, 0, 0); | |
3029 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
3030 ++v9; | |
3031 } | |
3032 while ( v9 < v13 ); | |
3033 } | |
3034 } | |
3035 v44 = 0; | |
248 | 3036 if (PartyHasDragon()) |
0 | 3037 v44 = 1; |
3038 v49 = 0; | |
3039 LABEL_25: | |
3040 v20 = 0; | |
3041 v21 = &pParty->pPlayers[v49]; | |
3042 v50 = 0; | |
3043 v47 = 0; | |
3044 v45 = 0; | |
3045 v48 = 0; | |
3046 v46 = 0; | |
255 | 3047 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 3048 v50 = 1; |
135 | 3049 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 3050 v48 = 1; |
3051 v22 = (ITEM_EQUIP_TYPE)0; | |
3052 while ( 1 ) | |
3053 { | |
3054 if ( v21->HasItemEquipped(v22) ) | |
3055 { | |
3056 //v23 = v21->pEquipment.pIndices; | |
3057 auto _idx = v21->pEquipment.pIndices[v22]; | |
3058 v24 = v21->pInventoryItems[_idx].uItemID; | |
3059 if ( v24 > 134 ) | |
3060 { | |
3061 if ( v24 == 529 ) | |
3062 goto LABEL_43; | |
3063 if ( v24 == 535 ) | |
3064 goto LABEL_44; | |
3065 if ( v24 == 515 ) | |
3066 { | |
3067 v47 = 1; | |
3068 } | |
3069 else | |
3070 { | |
3071 if ( v24 == 532 ) | |
3072 goto LABEL_50; | |
3073 } | |
3074 } | |
3075 else | |
3076 { | |
377 | 3077 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 3078 if ( v25 <= 50 ) |
3079 { | |
3080 if ( v25 != 50 ) | |
3081 { | |
3082 v26 = v25 - 37; | |
3083 if ( v26 ) | |
3084 { | |
3085 v27 = v26 - 1; | |
3086 if ( !v27 ) | |
3087 goto LABEL_50; | |
3088 v28 = v27 - 6; | |
3089 if ( v28 ) | |
3090 { | |
3091 if ( v28 != 3 ) | |
3092 goto LABEL_51; | |
3093 LABEL_50: | |
3094 v50 = 1; | |
3095 goto LABEL_51; | |
3096 } | |
3097 } | |
3098 } | |
3099 LABEL_44: | |
3100 v20 = 1; | |
3101 goto LABEL_51; | |
3102 } | |
3103 v29 = v25 - 54; | |
3104 if ( !v29 ) | |
3105 goto LABEL_44; | |
3106 v30 = v29 - 1; | |
3107 if ( !v30 ) | |
3108 goto LABEL_50; | |
3109 if ( v30 == 11 ) | |
3110 { | |
3111 LABEL_43: | |
3112 v20 = 1; | |
3113 v50 = 1; | |
3114 goto LABEL_51; | |
3115 } | |
3116 } | |
3117 } | |
3118 LABEL_51: | |
3119 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
3120 if ( (signed int)v22 >= 16 ) | |
3121 { | |
3122 if ( v48 ) | |
3123 { | |
3124 v31 = 0; | |
3125 v32 = (char *)v21->pInventoryItems; | |
3126 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
3127 { | |
3128 ++v31; | |
3129 v32 += 36; | |
3130 if ( v31 >= 138 ) | |
3131 goto LABEL_59; | |
3132 } | |
3133 v48 = 0; | |
3134 v45 = 1; | |
3135 } | |
3136 LABEL_59: | |
3137 if ( v21->pConditions[17] ) | |
3138 v46 = 1; | |
3139 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3140 { | |
3141 ++v21->sHealth; | |
3142 if ( v21->sHealth > v21->GetMaxHealth() ) | |
3143 v21->sHealth = v21->GetMaxHealth(); | |
3144 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
3145 { | |
3146 LODWORD(v21->pConditions[13]) = 0; | |
3147 HIDWORD(v21->pConditions[13]) = 0; | |
3148 } | |
3149 v51 = 1; | |
3150 } | |
3151 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
3152 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
3153 && !v21->pConditions[14] | |
3154 && !v21->pConditions[16] ) | |
3155 { | |
3156 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
3157 if ( v21->sHealth > v21->GetMaxHealth() ) | |
3158 v21->sHealth = v21->GetMaxHealth(); | |
3159 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
3160 { | |
3161 LODWORD(v21->pConditions[13]) = 0; | |
3162 HIDWORD(v21->pConditions[13]) = 0; | |
3163 } | |
3164 v51 = 1; | |
3165 } | |
3166 if ( v50 ) | |
3167 { | |
3168 v33 = (char *)&v21->sMana; | |
3169 ++*(int *)v33; | |
3170 if ( v21->sMana > v21->GetMaxMana() ) | |
3171 *(int *)v33 = v21->GetMaxMana(); | |
3172 v51 = 1; | |
3173 } | |
3174 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3175 { | |
3176 v34 = LODWORD(v21->pConditions[13]); | |
3177 --v21->sHealth; | |
3178 v35 = v21->sHealth; | |
3179 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
3180 v21->pConditions[13] = pParty->uTimePlayed; | |
3181 if ( v35 < 1 ) | |
3182 { | |
3183 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3184 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
3185 { | |
3186 v21->pConditions[13] = pParty->uTimePlayed; | |
3187 } | |
3188 else | |
3189 { | |
3190 if ( !v21->pConditions[14] ) | |
3191 v21->pConditions[14] = pParty->uTimePlayed; | |
3192 } | |
3193 } | |
3194 v51 = 1; | |
3195 } | |
3196 if ( v45 ) | |
3197 { | |
3198 v36 = (char *)&v21->sMana; | |
3199 ++*(int *)v36; | |
3200 if ( v21->sMana > v21->GetMaxMana() ) | |
3201 *(int *)v36 = v21->GetMaxMana(); | |
3202 } | |
3203 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3204 { | |
3205 v37 = v21->sHealth; | |
3206 if ( v37 > v21->GetMaxHealth() / 2 ) | |
3207 v21->sHealth = v37 - 2; | |
3208 v38 = v21->sMana; | |
3209 if ( v38 > v21->GetMaxMana() / 2 ) | |
3210 v21->sMana = v38 - 2; | |
3211 } | |
3212 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3213 { | |
3214 v39 = v21->sHealth; | |
3215 if ( v39 > v21->GetMaxHealth() / 2 ) | |
3216 v21->sHealth = v39 - 1; | |
3217 v40 = v21->sMana; | |
3218 if ( v40 > 0 ) | |
3219 v21->sMana = v40 - 1; | |
3220 } | |
3221 ++v49; | |
3222 if ( v49 >= 4 ) | |
3223 { | |
3224 result = HIDWORD(pParty->uTimePlayed); | |
3225 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
3226 if ( !viewparams->bRedrawGameUI ) | |
3227 { | |
3228 result = v51; | |
3229 viewparams->bRedrawGameUI = v51; | |
3230 } | |
3231 return result; | |
3232 } | |
3233 goto LABEL_25; | |
3234 } | |
3235 } | |
3236 } | |
3237 return result; | |
3238 } | |
3239 | |
3240 | |
3241 | |
3242 //----- (00493F79) -------------------------------------------------------- | |
351 | 3243 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 3244 { |
3245 signed __int64 v2; // ST2C_8@1 | |
3246 signed __int64 v3; // qax@1 | |
351 | 3247 //signed __int64 v4; // ST1C_8@1 |
0 | 3248 unsigned __int64 v5; // qax@1 |
3249 unsigned int v6; // ebx@1 | |
3250 | |
3251 v2 = (signed __int64)((double)a2 * 0.234375); | |
3252 v3 = v2 / 60 / 60; | |
351 | 3253 //v4 = v3; |
0 | 3254 v5 = (unsigned int)v3 / 0x18; |
3255 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 3256 _this->field_0_expire_second = v2 % 60; |
3257 _this->field_4_expire_minute = v2 / 60 % 60; | |
3258 _this->field_8_expire_hour = v3 % 24; | |
3259 _this->field_10_expire_week = v5 / 7 & 3; | |
3260 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
3261 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 3262 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 3263 } |
3264 | |
3265 | |
3266 | |
3267 | |
3268 | |
3269 //----- (00494035) -------------------------------------------------------- | |
3270 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
3271 { | |
3272 signed __int64 v0; // qax@1 | |
3273 signed __int64 v1; // ST30_8@1 | |
3274 signed __int64 v2; // ST38_8@1 | |
3275 unsigned __int64 v3; // qax@1 | |
3276 unsigned int v4; // edi@1 | |
3277 //signed int v5; // eax@4 | |
3278 //char *v6; // ecx@5 | |
3279 //Player *v7; // esi@8 | |
3280 //char *v8; // ecx@12 | |
3281 Player *pPlayer; // esi@15 | |
3282 //void *v10; // esi@25 | |
3283 unsigned int v11; // ecx@27 | |
3284 signed int v12; // edi@29 | |
3285 Player *v13; // ecx@30 | |
3286 Player *v14; // esi@35 | |
3287 double v15; // st7@35 | |
3288 Player **v16; // esi@43 | |
3289 Player *v17; // edi@44 | |
3290 double v18; // st7@44 | |
3291 float v19; // ST28_4@48 | |
3292 double v20; // ST38_8@48 | |
3293 Player *v21; // esi@51 | |
3294 signed int v22; // edi@53 | |
3295 int v23; // eax@59 | |
3296 int v24; // ecx@60 | |
3297 int v25; // eax@63 | |
3298 int v26; // ecx@64 | |
3299 int v27; // eax@67 | |
3300 int v28; // ecx@68 | |
3301 int v29; // eax@71 | |
3302 int v30; // ecx@72 | |
3303 int v31; // eax@75 | |
3304 int v32; // ecx@76 | |
3305 int v33; // eax@79 | |
3306 int v34; // ecx@80 | |
3307 int v35; // eax@83 | |
3308 int v36; // ecx@84 | |
3309 int v37; // eax@87 | |
3310 int v38; // ecx@88 | |
3311 int v39; // eax@91 | |
3312 int v40; // ecx@92 | |
3313 int v41; // eax@95 | |
3314 int v42; // ecx@96 | |
3315 bool v43; // ebx@102 | |
3316 //SpellBuff *v44; // edi@104 | |
3317 //signed int v45; // ebp@104 | |
3318 bool v46; // edi@111 | |
3319 //SpellBuff *v47; // esi@113 | |
3320 //Player **v48; // esi@119 | |
3321 //signed int v49; // edi@121 | |
3322 //char *v50; // esi@122 | |
3323 signed int v51; // edx@128 | |
3324 signed int v52; // ecx@130 | |
3325 int v53; // eax@131 | |
3326 Player *v54; // eax@141 | |
3327 unsigned int v55; // [sp-8h] [bp-38h]@18 | |
3328 unsigned int v56; // [sp-8h] [bp-38h]@55 | |
3329 int v57; // [sp-4h] [bp-34h]@18 | |
3330 int v58; // [sp-4h] [bp-34h]@33 | |
3331 int v59; // [sp-4h] [bp-34h]@55 | |
3332 unsigned int v60; // [sp+10h] [bp-20h]@1 | |
3333 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
3334 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
3335 unsigned int a2; // [sp+18h] [bp-18h]@1 | |
3336 signed int a2a; // [sp+18h] [bp-18h]@47 | |
3337 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
3338 | |
3339 a2 = pParty->uCurrentHour; | |
3340 v61 = pParty->uDaysPlayed; | |
3341 v60 = pEventTimer->uTimeElapsed; | |
3342 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; | |
3343 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
3344 v1 = v0; | |
3345 v0 /= 60i64; | |
3346 v2 = v0; | |
3347 v3 = (unsigned int)v0 / 24; | |
3348 v4 = (unsigned int)(v3 / 7) >> 2; | |
3349 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
3350 pParty->uCurrentMinute = v1 % 60; | |
3351 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
3352 pParty->uCurrentHour = v2 % 24; | |
3353 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
3354 pParty->uCurrentMonth = v4 % 12; | |
352 | 3355 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
0 | 3356 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) |
3357 { | |
3358 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
3359 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
3360 | |
3361 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
3362 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
3363 | |
3364 ++pParty->field_764; | |
3365 if ( pParty->field_764 > 1u ) | |
3366 { | |
3367 for (uint i = 0; i < 4; ++i) | |
3368 pParty->pPlayers[i].SetCondition(1, 0); | |
3369 | |
3370 if ( pParty->uNumFoodRations ) | |
3371 { | |
3372 Party::TakeFood(1u); | |
3373 } | |
3374 else | |
3375 { | |
3376 for (uint i = 0; i < 4; ++i) | |
3377 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; | |
3378 } | |
3379 if ( pParty->field_764 > 3u ) | |
3380 { | |
3381 pPlayer = pParty->pPlayers; | |
3382 do | |
3383 { | |
3384 pPlayer->Zero(); | |
3385 if ( !(pPlayer->pConditions[15] | pPlayer->pConditions[16] | pPlayer->pConditions[14]) ) | |
3386 { | |
3387 if ( rand() % 100 < 5 * (unsigned __int8)pParty->field_764 ) | |
3388 { | |
3389 v57 = 0; | |
3390 v55 = 14; | |
3391 LABEL_21: | |
3392 pPlayer->SetCondition(v55, v57); | |
3393 goto LABEL_22; | |
3394 } | |
3395 if ( rand() % 100 < 10 * (unsigned __int8)pParty->field_764 ) | |
3396 { | |
3397 v57 = 0; | |
3398 v55 = 5; | |
3399 goto LABEL_21; | |
3400 } | |
3401 } | |
3402 LABEL_22: | |
3403 ++pPlayer; | |
3404 } | |
3405 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); | |
3406 } | |
3407 } | |
3408 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
3409 pOutdoor->SetFog(); | |
3410 | |
3411 for (uint i = 0; i < 4; ++i) | |
3412 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
3413 } | |
3414 v11 = LODWORD(pParty->uTimePlayed); | |
3415 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
3416 { | |
3417 v12 = 1; | |
3418 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
3419 viewparams->bRedrawGameUI = 1; | |
3420 while ( 1 ) | |
3421 { | |
3422 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 3423 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
3424 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 3425 { |
3426 v58 = 0; | |
3427 } | |
3428 else | |
3429 { | |
3430 v58 = 0; | |
3431 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
3432 { | |
3433 v14 = pPlayers[v12]; | |
3434 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
3435 v14->ReceiveDamage((signed __int64)v15, 0); | |
3436 if ( pParty->uFlags & 4 ) | |
3437 { | |
3438 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[660]); | |
3439 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
3440 } | |
3441 goto LABEL_39; | |
3442 } | |
3443 v13 = pPlayers[v12]; | |
3444 } | |
130 | 3445 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 3446 LABEL_39: |
3447 ++v12; | |
3448 if ( v12 > 4 ) | |
3449 { | |
3450 v11 = LODWORD(pParty->uTimePlayed); | |
3451 break; | |
3452 } | |
3453 } | |
3454 } | |
3455 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
3456 { | |
3457 viewparams->bRedrawGameUI = 1; | |
3458 pParty->field_6FC = v11 + 128; | |
3459 v16 = &pPlayers[1]; | |
3460 do | |
3461 { | |
3462 v17 = *v16; | |
3463 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
3464 v17->ReceiveDamage((signed __int64)v18, 0); | |
3465 if ( pParty->uFlags & 0x200 ) | |
3466 { | |
3467 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[661]); | |
3468 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
3469 } | |
3470 ++v16; | |
3471 } | |
3472 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
3473 } | |
3474 _493938_regenerate(); | |
3475 v65 = 4; | |
3476 a2a = v60; | |
3477 if ( pParty->uFlags2 & 2 ) | |
3478 { | |
3479 v19 = (double)(signed int)v60 * 0.5; | |
3480 v20 = v19 + 6.7553994e15; | |
3481 a2a = LODWORD(v20); | |
3482 if ( SLODWORD(v20) <= 0 ) | |
3483 a2a = 1; | |
3484 } | |
3485 v62 = &pPlayers[1]; | |
3486 do | |
3487 { | |
3488 v21 = *v62; | |
3489 if ( (*v62)->uTimeToRecovery ) | |
3490 v21->Recover(a2a); | |
3491 v22 = v21->sHealth; | |
3492 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
3493 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
3494 { | |
3495 if ( v22 >= 1 ) | |
3496 goto LABEL_59; | |
3497 v59 = 0; | |
3498 v56 = 13; | |
3499 } | |
3500 else | |
3501 { | |
3502 v59 = 0; | |
3503 v56 = 14; | |
3504 } | |
3505 v21->SetCondition(v56, v59); | |
3506 LABEL_59: | |
3507 v23 = (int)&v21->field_E0; | |
3508 if ( v21->field_E0 ) | |
3509 { | |
3510 v24 = *(int *)v23 - v60; | |
3511 if ( v24 > 0 ) | |
3512 { | |
3513 *(int *)v23 = v24; | |
3514 } | |
3515 else | |
3516 { | |
3517 *(int *)v23 = 0; | |
3518 viewparams->bRedrawGameUI = 1; | |
3519 } | |
3520 } | |
3521 v25 = (int)&v21->field_E4; | |
3522 if ( v21->field_E4 ) | |
3523 { | |
3524 v26 = *(int *)v25 - v60; | |
3525 if ( v26 > 0 ) | |
3526 { | |
3527 *(int *)v25 = v26; | |
3528 } | |
3529 else | |
3530 { | |
3531 *(int *)v25 = 0; | |
3532 viewparams->bRedrawGameUI = 1; | |
3533 } | |
3534 } | |
3535 v27 = (int)&v21->field_E8; | |
3536 if ( v21->field_E8 ) | |
3537 { | |
3538 v28 = *(int *)v27 - v60; | |
3539 if ( v28 > 0 ) | |
3540 { | |
3541 *(int *)v27 = v28; | |
3542 } | |
3543 else | |
3544 { | |
3545 *(int *)v27 = 0; | |
3546 viewparams->bRedrawGameUI = 1; | |
3547 } | |
3548 } | |
3549 v29 = (int)&v21->field_EC; | |
3550 if ( v21->field_EC ) | |
3551 { | |
3552 v30 = *(int *)v29 - v60; | |
3553 if ( v30 > 0 ) | |
3554 { | |
3555 *(int *)v29 = v30; | |
3556 } | |
3557 else | |
3558 { | |
3559 *(int *)v29 = 0; | |
3560 viewparams->bRedrawGameUI = 1; | |
3561 } | |
3562 } | |
3563 v31 = (int)&v21->field_F0; | |
3564 if ( v21->field_F0 ) | |
3565 { | |
3566 v32 = *(int *)v31 - v60; | |
3567 if ( v32 > 0 ) | |
3568 { | |
3569 *(int *)v31 = v32; | |
3570 } | |
3571 else | |
3572 { | |
3573 *(int *)v31 = 0; | |
3574 viewparams->bRedrawGameUI = 1; | |
3575 } | |
3576 } | |
3577 v33 = (int)&v21->field_F4; | |
3578 if ( v21->field_F4 ) | |
3579 { | |
3580 v34 = *(int *)v33 - v60; | |
3581 if ( v34 > 0 ) | |
3582 { | |
3583 *(int *)v33 = v34; | |
3584 } | |
3585 else | |
3586 { | |
3587 *(int *)v33 = 0; | |
3588 viewparams->bRedrawGameUI = 1; | |
3589 } | |
3590 } | |
3591 v35 = (int)&v21->field_F8; | |
3592 if ( v21->field_F8 ) | |
3593 { | |
3594 v36 = *(int *)v35 - v60; | |
3595 if ( v36 > 0 ) | |
3596 { | |
3597 *(int *)v35 = v36; | |
3598 } | |
3599 else | |
3600 { | |
3601 *(int *)v35 = 0; | |
3602 viewparams->bRedrawGameUI = 1; | |
3603 } | |
3604 } | |
3605 v37 = (int)&v21->field_FC; | |
3606 if ( v21->field_FC ) | |
3607 { | |
3608 v38 = *(int *)v37 - v60; | |
3609 if ( v38 > 0 ) | |
3610 { | |
3611 *(int *)v37 = v38; | |
3612 } | |
3613 else | |
3614 { | |
3615 *(int *)v37 = 0; | |
3616 viewparams->bRedrawGameUI = 1; | |
3617 } | |
3618 } | |
3619 v39 = (int)&v21->field_100; | |
3620 if ( v21->field_100 ) | |
3621 { | |
3622 v40 = *(int *)v39 - v60; | |
3623 if ( v40 > 0 ) | |
3624 { | |
3625 *(int *)v39 = v40; | |
3626 } | |
3627 else | |
3628 { | |
3629 *(int *)v39 = 0; | |
3630 viewparams->bRedrawGameUI = 1; | |
3631 } | |
3632 } | |
3633 v41 = (int)&v21->field_104; | |
3634 if ( v21->field_104 ) | |
3635 { | |
3636 v42 = *(int *)v41 - v60; | |
3637 if ( v42 > 0 ) | |
3638 { | |
3639 *(int *)v41 = v42; | |
3640 } | |
3641 else | |
3642 { | |
3643 *(int *)v41 = 0; | |
3644 viewparams->bRedrawGameUI = 1; | |
3645 } | |
3646 } | |
3647 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
3648 --v65; | |
3649 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
3650 | |
3651 for (uint k = 0; k < 24; ++k) | |
3652 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
3653 | |
3654 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
3655 v21->SetCondition(1u, 0); | |
3656 ++v62; | |
3657 } | |
3658 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
3659 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
3660 | |
3661 for (uint i = 0; i < 20; ++i) | |
3662 { | |
3663 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
3664 viewparams->bRedrawGameUI = 1; | |
3665 } | |
3666 | |
3667 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
3668 { | |
3669 for (uint i = 0; i < 4; ++i) | |
3670 pParty->pPlayers[i].SetCondition(1, 0); | |
3671 } | |
3672 | |
3673 for (uint i = 0; i < 2; ++i) | |
3674 { | |
3675 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
3676 if (pBuf->uExpireTime == 0) | |
3677 continue; | |
3678 | |
3679 if ( !(pBuf->uFlags & 1) ) | |
3680 { | |
3681 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
3682 { | |
3683 pBuf->Reset(); | |
3684 if (dword_4EE07C[i] == 7 ) | |
3685 pParty->bFlying = false; | |
3686 } | |
3687 } | |
3688 } | |
3689 | |
3690 v51 = v65; | |
3691 if ( v65 ) | |
3692 goto LABEL_135; | |
151 | 3693 if ( pCurrentScreen != SCREEN_REST ) |
0 | 3694 { |
3695 v52 = (signed int)&pPlayers[1]; | |
3696 while ( 1 ) | |
3697 { | |
3698 v53 = *(int *)v52; | |
3699 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
3700 break; | |
3701 v52 += 4; | |
3702 if ( v52 > (signed int)&pPlayers[4] ) | |
3703 goto LABEL_135; | |
3704 } | |
3705 *(int *)(v53 + 16) = 0; | |
3706 *(int *)(v53 + 20) = 0; | |
3707 v51 = 1; | |
3708 LABEL_135: | |
151 | 3709 if ( pCurrentScreen != SCREEN_REST |
0 | 3710 && (!v51 || dword_5C35C0) ) |
3711 uGameState = 8; | |
3712 } | |
3713 if ( uActiveCharacter ) | |
3714 { | |
151 | 3715 if ( pCurrentScreen != SCREEN_REST ) |
0 | 3716 { |
3717 v54 = pPlayers[uActiveCharacter]; | |
3718 if ( v54->pConditions[2] | |
3719 || v54->pConditions[12] | |
3720 || v54->pConditions[13] | |
3721 || v54->pConditions[14] | |
3722 || v54->pConditions[15] | |
3723 || v54->pConditions[16] ) | |
3724 { | |
3725 viewparams->bRedrawGameUI = 1; | |
3726 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
3727 } | |
3728 } | |
3729 } | |
3730 } | |
3731 | |
3732 //----- (00494820) -------------------------------------------------------- | |
3733 unsigned int __fastcall sub_494820(unsigned int a1) | |
3734 { | |
3735 signed int v1; // eax@1 | |
3736 | |
3737 v1 = 5; | |
3738 if ( a1 % 0x18 >= 5 ) | |
3739 v1 = 29; | |
3740 return v1 - a1 % 0x18; | |
3741 } | |
3742 | |
3743 //----- (00494836) -------------------------------------------------------- | |
3744 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
3745 { | |
3746 int v3; // esi@1 | |
3747 int result; // eax@1 | |
3748 stru339_spell_sound *v5; // ebx@1 | |
3749 int *v6; // edi@2 | |
3750 unsigned int v7; // eax@3 | |
3751 int v8; // [sp+Ch] [bp-8h]@3 | |
3752 int v9; // [sp+10h] [bp-4h]@2 | |
3753 int a2a; // [sp+1Ch] [bp+8h]@1 | |
3754 | |
3755 v3 = 0; | |
3756 result = word_4EE088_sound_ids[uSoundID]; | |
3757 v5 = this; | |
3758 a2a = word_4EE088_sound_ids[uSoundID]; | |
3759 if ( result ) | |
3760 { | |
3761 v9 = 0; | |
3762 v6 = this->pSoundsOffsets; | |
3763 do | |
3764 { | |
3765 v7 = a2a++; | |
3766 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
3767 if ( !result ) | |
3768 break; | |
3769 a6 += 4; | |
3770 result = v8 + 256; | |
3771 *v6 = v3; | |
3772 v3 += result; | |
3773 ++v9; | |
3774 *(v6 - 2) = result; | |
3775 ++v6; | |
3776 } | |
3777 while ( v9 < 2 ); | |
3778 } | |
3779 return result; | |
3780 } | |
3781 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
3782 | |
3783 | |
3784 | |
3785 //----- (00494AED) -------------------------------------------------------- | |
130 | 3786 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 3787 { |
3788 unsigned int _uNumFrames; // edx@1 | |
3789 unsigned int result; // eax@1 | |
3790 PlayerFrame *v4; // ecx@2 | |
3791 | |
3792 _uNumFrames = this->uNumFrames; | |
3793 result = 0; | |
3794 if ( (signed int)this->uNumFrames <= 0 ) | |
3795 { | |
3796 LABEL_5: | |
3797 result = 0; | |
3798 } | |
3799 else | |
3800 { | |
3801 v4 = this->pFrames; | |
130 | 3802 while ( v4->expression != expression ) |
0 | 3803 { |
3804 ++result; | |
3805 ++v4; | |
3806 if ( (signed int)result >= (signed int)_uNumFrames ) | |
3807 goto LABEL_5; | |
3808 } | |
3809 } | |
3810 return result; | |
3811 } | |
3812 | |
3813 //----- (00494B10) -------------------------------------------------------- | |
3814 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
3815 { | |
3816 unsigned int v3; // esi@1 | |
3817 PlayerFrame *v4; // edi@1 | |
3818 PlayerFrame *v5; // ecx@1 | |
3819 __int16 v6; // dx@2 | |
3820 int v7; // edx@3 | |
3821 char *i; // eax@3 | |
3822 int v9; // ecx@5 | |
3823 PlayerFrame *result; // eax@6 | |
3824 | |
3825 v3 = uFramesetID; | |
3826 v4 = this->pFrames; | |
3827 v5 = &v4[uFramesetID]; | |
3828 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
3829 { | |
3830 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
3831 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
3832 { | |
3833 v9 = *(short *)i; | |
3834 if ( v7 <= v9 ) | |
3835 break; | |
3836 v7 -= v9; | |
3837 ++v3; | |
3838 } | |
3839 result = &v4[v3]; | |
3840 } | |
3841 else | |
3842 { | |
3843 result = &v4[uFramesetID]; | |
3844 } | |
3845 return result; | |
3846 } | |
3847 | |
3848 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3849 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 3850 { |
3851 PlayerFrameTable *v4; // edi@1 | |
3852 int v5; // esi@1 | |
3853 int v6; // eax@2 | |
3854 | |
3855 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3856 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3857 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
|
3858 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3859 *pAnimTime = v5; |
0 | 3860 } |
3861 else | |
3862 { | |
3863 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3864 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3865 *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
|
3866 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3867 return &v4->pFrames[*pFramesetID]; |
0 | 3868 } |
3869 | |
3870 //----- (00494BC3) -------------------------------------------------------- | |
3871 void PlayerFrameTable::ToFile() | |
3872 { | |
3873 PlayerFrameTable *v1; // esi@1 | |
3874 FILE *v2; // eax@1 | |
3875 FILE *v3; // edi@1 | |
3876 | |
3877 auto Str = this; | |
3878 | |
3879 v1 = Str; | |
3880 v2 = fopen("data\\dpft.bin", "wb"); | |
3881 v3 = v2; | |
3882 if ( !v2 ) | |
3883 Abortf("Unable to save dpft.bin!"); | |
3884 fwrite(v1, 4u, 1u, v2); | |
3885 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
3886 fclose(v3); | |
3887 } | |
3888 | |
3889 //----- (00494C0F) -------------------------------------------------------- | |
3890 void PlayerFrameTable::FromFile(void *pSerialized) | |
3891 { | |
3892 uNumFrames = *(int *)pSerialized; | |
3893 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
3894 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
3895 } | |
3896 | |
3897 //----- (00494C5A) -------------------------------------------------------- | |
3898 int PlayerFrameTable::FromFileTxt(const char *Args) | |
3899 { | |
3900 PlayerFrameTable *v2; // ebx@1 | |
3901 FILE *v3; // eax@1 | |
3902 int v4; // esi@3 | |
3903 void *v5; // eax@10 | |
3904 FILE *v6; // ST0C_4@12 | |
3905 char *i; // eax@12 | |
3906 __int16 v8; // ax@15 | |
3907 const char *v9; // ST10_4@15 | |
3908 unsigned __int16 v10; // ax@15 | |
3909 const char *v11; // ST0C_4@15 | |
3910 int j; // esi@15 | |
3911 int v13; // eax@17 | |
3912 int v14; // edx@22 | |
3913 int v15; // ecx@23 | |
3914 int v16; // eax@24 | |
3915 signed int k; // eax@27 | |
3916 PlayerFrame *v18; // edx@28 | |
3917 int v19; // esi@28 | |
3918 int l; // ecx@29 | |
3919 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3920 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3921 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3922 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3923 int v26; // [sp+2FCh] [bp-8h]@3 | |
3924 FILE *File; // [sp+300h] [bp-4h]@1 | |
3925 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3926 | |
3927 v2 = this; | |
3928 //TileTable::dtor((TileTable *)this); | |
3929 v3 = fopen(Args, "r"); | |
3930 File = v3; | |
3931 if ( !v3 ) | |
3932 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3933 v4 = 0; | |
3934 v25 = 0; | |
3935 v26 = 1; | |
3936 if ( fgets(&Buf, 490, v3) ) | |
3937 { | |
3938 do | |
3939 { | |
3940 *strchr(&Buf, 10) = 0; | |
703 | 3941 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3942 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3943 { | |
3944 if ( v24.uPropCount < 3 ) | |
0 | 3945 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3946 ++v25; | |
3947 } | |
3948 ++v26; | |
3949 } | |
3950 while ( fgets(&Buf, 490, File) ); | |
3951 v4 = v25; | |
3952 } | |
3953 v2->uNumFrames = v4; | |
3954 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3955 v2->pFrames = (PlayerFrame *)v5; | |
3956 if ( !v5 ) | |
3957 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3958 v6 = File; | |
3959 v2->uNumFrames = 0; | |
3960 fseek(v6, 0, 0); | |
3961 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3962 { | |
3963 *strchr(&Buf, 10) = 0; | |
703 | 3964 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3965 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3966 { |
3967 v8 = atoi(v24.pProperties[0]); | |
3968 v9 = v24.pProperties[1]; | |
130 | 3969 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3970 v10 = atoi(v9); |
3971 v11 = v24.pProperties[2]; | |
3972 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3973 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3974 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3975 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3976 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3977 { |
3978 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3979 { | |
3980 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3981 *(char *)v13 |= 4u; | |
3982 } | |
3983 } | |
3984 ++v2->uNumFrames; | |
3985 } | |
3986 } | |
3987 fclose(File); | |
3988 v14 = 0; | |
3989 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3990 { | |
3991 v15 = 0; | |
3992 do | |
3993 { | |
3994 v16 = (int)&v2->pFrames[v15]; | |
3995 if ( !(*(char *)(v16 + 18) & 4) ) | |
3996 *(char *)(v16 + 8) |= 1u; | |
3997 ++v14; | |
3998 ++v15; | |
3999 } | |
4000 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
4001 } | |
4002 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
4003 { | |
4004 v18 = v2->pFrames; | |
4005 Argsa = (int)&v18[k]; | |
4006 v19 = *(short *)(Argsa + 4); | |
4007 if ( *(char *)(Argsa + 8) & 1 ) | |
4008 { | |
4009 ++k; | |
4010 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
4011 { | |
4012 v19 += *(short *)(l + 4); | |
4013 ++k; | |
4014 } | |
4015 LOWORD(v19) = v18[k].uAnimTime + v19; | |
4016 } | |
4017 ++k; | |
4018 } | |
4019 return 1; | |
4020 } | |
4021 | |
4022 //----- (00494F3A) -------------------------------------------------------- | |
4023 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
4024 { | |
4025 IconFrameTable *v2; // esi@1 | |
4026 int v3; // ebx@1 | |
4027 unsigned int uID; // edi@1 | |
4028 unsigned int result; // eax@4 | |
4029 | |
4030 v2 = this; | |
4031 v3 = 0; | |
4032 uID = 0; | |
4033 if ( (signed int)this->uNumIcons <= 0 ) | |
4034 { | |
4035 LABEL_4: | |
4036 result = 0; | |
4037 } | |
4038 else | |
4039 { | |
4040 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
4041 { | |
4042 ++uID; | |
4043 ++v3; | |
4044 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
4045 goto LABEL_4; | |
4046 } | |
4047 result = uID; | |
4048 } | |
4049 return result; | |
4050 } | |
4051 | |
4052 //----- (00494F70) -------------------------------------------------------- | |
4053 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
4054 { | |
4055 IconFrame *v3; // edi@1 | |
4056 IconFrame *v4; // ecx@1 | |
4057 __int16 v5; // dx@2 | |
4058 int v6; // edx@3 | |
4059 unsigned int v7; // eax@3 | |
4060 char *i; // ecx@3 | |
4061 int v9; // esi@5 | |
4062 IconFrame *result; // eax@6 | |
4063 | |
4064 v3 = this->pIcons; | |
4065 v4 = &v3[uIconID]; | |
4066 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
4067 { | |
4068 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
4069 v7 = uIconID; | |
4070 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
4071 { | |
4072 v9 = *(short *)i; | |
4073 if ( v6 <= v9 ) | |
4074 break; | |
4075 v6 -= v9; | |
4076 ++v7; | |
4077 } | |
4078 result = &v3[v7]; | |
4079 } | |
4080 else | |
4081 { | |
4082 result = &v3[uIconID]; | |
4083 } | |
4084 return result; | |
4085 } | |
4086 | |
4087 //----- (00494FBF) -------------------------------------------------------- | |
4088 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
4089 { | |
4090 IconFrameTable *v2; // esi@1 | |
4091 unsigned int v3; // edi@3 | |
4092 const char *i; // eax@3 | |
4093 IconFrame *v5; // eax@5 | |
4094 | |
4095 v2 = this; | |
4096 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
4097 { | |
4098 v3 = uIconID; | |
4099 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
4100 { | |
4101 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
4102 v5 = v2->pIcons; | |
4103 if ( !(v5[v3].uFlags & 1) ) | |
4104 break; | |
4105 ++v3; | |
4106 } | |
4107 } | |
4108 } | |
4109 | |
4110 //----- (0049500A) -------------------------------------------------------- | |
4111 void IconFrameTable::ToFile() | |
4112 { | |
4113 IconFrameTable *v1; // esi@1 | |
4114 FILE *v2; // eax@1 | |
4115 FILE *v3; // edi@1 | |
4116 | |
4117 auto Str = this; | |
4118 | |
4119 v1 = Str; | |
4120 v2 = fopen("data\\dift.bin", "wb"); | |
4121 v3 = v2; | |
4122 if ( !v2 ) | |
4123 Abortf("Unable to save dift.bin!"); | |
4124 fwrite(v1, 4u, 1u, v2); | |
4125 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
4126 fclose(v3); | |
4127 } | |
4128 | |
4129 //----- (00495056) -------------------------------------------------------- | |
4130 void IconFrameTable::FromFile(void *pSerialized) | |
4131 { | |
4132 uNumIcons = *(int *)pSerialized; | |
4133 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
4134 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
4135 } | |
4136 | |
4137 //----- (0049509D) -------------------------------------------------------- | |
4138 int IconFrameTable::FromFileTxt(const char *Args) | |
4139 { | |
4140 IconFrameTable *v2; // ebx@1 | |
4141 FILE *v3; // eax@1 | |
4142 int v4; // esi@3 | |
4143 void *v5; // eax@10 | |
4144 FILE *v6; // ST0C_4@12 | |
4145 char *i; // eax@12 | |
4146 const char *v8; // ST00_4@15 | |
4147 int v9; // eax@16 | |
4148 int v10; // edx@20 | |
4149 int v11; // ecx@21 | |
4150 int v12; // eax@22 | |
4151 signed int j; // edx@25 | |
4152 IconFrame *v14; // ecx@26 | |
4153 int v15; // esi@26 | |
4154 int k; // eax@27 | |
4155 signed int result; // eax@11 | |
4156 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
4157 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
4158 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
4159 int v21; // [sp+2F8h] [bp-Ch]@3 | |
4160 int v22; // [sp+2FCh] [bp-8h]@3 | |
4161 FILE *File; // [sp+300h] [bp-4h]@1 | |
4162 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
4163 | |
4164 v2 = this; | |
4165 //TileTable::dtor((TileTable *)this); | |
4166 v3 = fopen(Args, "r"); | |
4167 File = v3; | |
4168 if ( !v3 ) | |
4169 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
4170 v4 = 0; | |
4171 v21 = 0; | |
4172 v22 = 1; | |
4173 if ( fgets(&Buf, 490, v3) ) | |
4174 { | |
4175 do | |
4176 { | |
4177 *strchr(&Buf, 10) = 0; | |
4178 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 4179 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
4180 { | |
4181 if ( v20.uPropCount < 3 ) | |
0 | 4182 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
4183 ++v21; | |
4184 } | |
4185 ++v22; | |
4186 } | |
4187 while ( fgets(&Buf, 490, File) ); | |
4188 v4 = v21; | |
4189 } | |
4190 v2->uNumIcons = v4; | |
4191 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
4192 v2->pIcons = (IconFrame *)v5; | |
4193 if ( v5 ) | |
4194 { | |
4195 v6 = File; | |
4196 v2->uNumIcons = 0; | |
4197 fseek(v6, 0, 0); | |
4198 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
4199 { | |
4200 *strchr(&Buf, 10) = 0; | |
4201 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 4202 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 4203 { |
4204 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
4205 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
4206 v8 = v20.pProperties[2]; | |
4207 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
4208 if ( !_strcmpi(v8, "new") ) | |
4209 { | |
4210 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
4211 *(char *)v9 |= 4u; | |
4212 } | |
4213 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
4214 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
4215 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
4216 } | |
4217 } | |
4218 fclose(File); | |
4219 v10 = 0; | |
4220 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
4221 { | |
4222 v11 = 0; | |
4223 do | |
4224 { | |
4225 v12 = (int)&v2->pIcons[v11]; | |
4226 if ( !(*(char *)(v12 + 60) & 4) ) | |
4227 *(char *)(v12 + 28) |= 1u; | |
4228 ++v10; | |
4229 ++v11; | |
4230 } | |
4231 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
4232 } | |
4233 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
4234 { | |
4235 v14 = v2->pIcons; | |
4236 Argsa = (int)&v14[j]; | |
4237 v15 = *(short *)(Argsa + 24); | |
4238 if ( *(char *)(Argsa + 28) & 1 ) | |
4239 { | |
4240 ++j; | |
4241 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
4242 { | |
4243 v15 += *(short *)(k + 24); | |
4244 ++j; | |
4245 } | |
4246 LOWORD(v15) = v14[j].uAnimTime + v15; | |
4247 } | |
4248 ++j; | |
4249 } | |
4250 result = 1; | |
4251 } | |
4252 else | |
4253 { | |
4254 fclose(File); | |
4255 result = 0; | |
4256 } | |
4257 return result; | |
4258 } | |
4259 | |
4260 | |
4261 | |
4262 //----- (00495366) -------------------------------------------------------- | |
4263 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
4264 { | |
4265 int v2; // edi@1 | |
4266 int v3; // edx@2 | |
4267 int v4; // esi@3 | |
4268 int v5; // ebx@5 | |
4269 signed int v7; // [sp+Ch] [bp-14h]@1 | |
4270 signed int v8; // [sp+10h] [bp-10h]@1 | |
4271 int **v9; // [sp+14h] [bp-Ch]@4 | |
4272 signed int v10; // [sp+18h] [bp-8h]@3 | |
4273 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
4274 | |
4275 v2 = a1; | |
4276 v11 = a2; | |
4277 v8 = 0; | |
4278 v7 = 0; | |
4279 if ( dword_AE336C == a1 ) | |
4280 { | |
4281 v3 = dword_AE3370; | |
4282 } | |
4283 else | |
4284 { | |
4285 v4 = a2; | |
4286 dword_AE336C = a1; | |
4287 v10 = 0; | |
4288 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
4289 goto LABEL_17; | |
4290 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
4291 do | |
4292 { | |
4293 v5 = tolower(*(char *)*v9); | |
4294 if ( v5 == tolower(v2) ) | |
4295 { | |
4296 if ( v8 ) | |
4297 v7 = v10; | |
4298 else | |
4299 v8 = v10; | |
4300 } | |
4301 ++v10; | |
4302 v9 += 2; | |
4303 } | |
4304 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
4305 if ( v8 && v8 != v7 ) | |
4306 v3 = v8 + rand() % (v7 - v8); | |
4307 else | |
4308 LABEL_17: | |
4309 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
4310 } | |
4311 dword_AE3370 = v3; | |
4312 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
4313 } | |
4314 // AE336C: using guessed type int dword_AE336C; | |
4315 // AE3370: using guessed type int dword_AE3370; | |
4316 | |
4317 //----- (00495430) -------------------------------------------------------- | |
607 | 4318 char * GetReputationString( signed int a1 ) |
4319 { | |
566 | 4320 if (a1 >= 25) |
4321 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
4322 else if (a1 >= 6) | |
4323 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
4324 else if (a1 >= -5) | |
4325 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
4326 else if (a1 >= -24) | |
4327 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 4328 else |
566 | 4329 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 4330 } |
4331 | |
4332 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4333 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 4334 { |
4335 unsigned __int8 v6; // bl@1 | |
4336 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4337 //NPCData *v9; // eax@4 |
250 | 4338 //size_t v10; // eax@6 |
0 | 4339 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4340 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4341 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4342 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4343 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4344 //int v16; // edx@10 |
0 | 4345 int v17; // eax@10 |
4346 signed __int64 v18; // qax@18 | |
4347 unsigned int v19; // edi@32 | |
4348 unsigned __int8 *v20; // ebx@32 | |
4349 int v21; // ecx@34 | |
4350 __int16 v22; // ax@34 | |
4351 int v23; // edx@39 | |
4352 int v24; // eax@39 | |
4353 int v25; // eax@45 | |
4354 float *v26; // esi@68 | |
4355 float v27; // ST18_4@68 | |
4356 signed int v28; // eax@68 | |
4357 int v29; // eax@68 | |
4358 float v30; // ST18_4@72 | |
4359 signed int v31; // eax@72 | |
4360 float v32; // ST18_4@74 | |
4361 signed int v33; // eax@74 | |
4362 double v34; // st7@75 | |
4363 float v35; // ST18_4@76 | |
4364 signed int v36; // eax@76 | |
4365 float *v37; // esi@78 | |
4366 float v38; // ST18_4@78 | |
4367 int v39; // eax@78 | |
4368 float v40; // ST18_4@82 | |
4369 int v41; // eax@82 | |
4370 float v42; // ST18_4@83 | |
4371 int v43; // eax@83 | |
4372 float v44; // ST18_4@85 | |
4373 int v45; // eax@85 | |
4374 const char *v46; // eax@86 | |
4375 unsigned int v47; // eax@87 | |
4376 float v48; // ST18_4@97 | |
4377 __int64 v49; // ST14_8@107 | |
4378 int v50; // eax@107 | |
4379 int v51; // eax@108 | |
4380 Player *v52; // eax@109 | |
4381 int v53; // [sp-4h] [bp-13Ch]@107 | |
4382 int v54; // [sp+0h] [bp-138h]@107 | |
4383 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 4384 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
4385 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 4386 char a1[100]; // [sp+B8h] [bp-80h]@3 |
4387 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4388 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 4389 //Player *v61; // [sp+124h] [bp-14h]@3 |
4390 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 4391 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4392 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4393 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4394 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4395 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4396 |
0 | 4397 |
4398 v6 = uPlayerID; | |
249 | 4399 //Str = lpsz; |
0 | 4400 if ( IsBadStringPtrA(lpsz, 1u) ) |
4401 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4402 |
0 | 4403 a1[0] = 0; |
4404 pPlayer = &pParty->pPlayers[v6]; | |
248 | 4405 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 4406 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4407 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4408 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4409 NPCData *npc = nullptr; |
0 | 4410 if ( dword_5C35D4 ) |
248 | 4411 { |
463 | 4412 //__debugbreak(); // fix |
459 | 4413 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
|
4414 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4415 else |
602 | 4416 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4417 //v65 = v9; |
250 | 4418 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4419 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4420 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4421 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4422 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4423 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4424 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4425 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4426 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4427 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4428 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4429 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4430 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4431 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4432 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4433 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4434 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4435 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4436 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4437 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4438 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4439 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4440 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4441 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
|
4442 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4443 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4444 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4445 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4446 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4447 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4448 case 2: |
0 | 4449 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4450 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4451 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4452 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4453 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4454 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4455 case 5: |
0 | 4456 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
4457 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
4458 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
4459 { | |
4460 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
4461 { | |
4462 if ( v18 < 20 ) | |
4463 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
4464 } | |
4465 else | |
4466 { | |
4467 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
4468 } | |
4469 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4470 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4471 case 6: |
0 | 4472 if ( pPlayer->uSex ) |
4473 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
4474 else | |
4475 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4476 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4477 case 7: |
0 | 4478 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4479 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4480 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4481 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4482 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4483 case 8: |
0 | 4484 v19 = 0; |
4485 v63 = 0; | |
484 | 4486 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 4487 do |
4488 { | |
4489 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
4490 { | |
4491 v21 = v63; | |
4492 v22 = word_4EE150[v19]; | |
4493 ++v63; | |
4494 v55[v21] = v22; | |
4495 } | |
4496 ++v19; | |
4497 } | |
4498 while ( v19 < 28 ); | |
4499 if ( v63 ) | |
4500 { | |
4501 v23 = rand() % v63; | |
4502 v24 = dword_A74CDC; | |
4503 if ( dword_A74CDC == -1 ) | |
4504 { | |
4505 v24 = v23; | |
4506 dword_A74CDC = v23; | |
4507 } | |
492 | 4508 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 4509 } |
4510 else | |
4511 { | |
4512 v11 = (char *)pNPCTopics[55].pText; | |
4513 } | |
249 | 4514 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4515 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4516 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4517 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4518 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4519 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4520 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4521 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4522 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4523 case 10: |
0 | 4524 if ( pPlayer->uSex ) |
4525 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
4526 else | |
4527 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4528 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4529 case 11: |
0 | 4530 v25 = GetPartyReputation(); |
4531 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4532 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4533 v25 = npc->rep; |
0 | 4534 LABEL_46: |
4535 if ( v25 >= 25 ) | |
4536 { | |
4537 v11 = pGlobalTXT_LocalizationStrings[379]; | |
4538 } | |
4539 else | |
4540 { | |
4541 if ( v25 < 6 ) | |
4542 { | |
4543 if ( v25 >= -5 ) | |
4544 { | |
4545 v11 = pGlobalTXT_LocalizationStrings[399]; | |
4546 } | |
4547 else | |
4548 { | |
4549 if ( v25 < -24 ) | |
4550 v11 = pGlobalTXT_LocalizationStrings[434]; | |
4551 else | |
4552 v11 = pGlobalTXT_LocalizationStrings[402]; | |
4553 } | |
4554 } | |
4555 else | |
4556 { | |
4557 v11 = pGlobalTXT_LocalizationStrings[392]; | |
4558 } | |
4559 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4560 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4561 case 13: |
0 | 4562 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4563 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4564 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4565 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4566 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4567 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4568 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4569 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4570 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4571 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4572 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4573 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4574 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4575 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4576 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4577 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4578 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4579 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4580 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4581 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4582 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4583 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4584 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4585 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4586 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4587 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4588 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4589 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4590 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4591 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4592 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4593 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4594 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
|
4595 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4596 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4597 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4598 sprintf(a1, "%lu", pay_percentage); |
250 | 4599 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4600 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4601 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4602 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4603 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4604 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4605 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4606 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4607 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4608 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4609 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4610 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4611 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4612 sprintf(a1, "%lu", v51); |
0 | 4613 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4614 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4615 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4616 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4617 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4618 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4619 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4620 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4621 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4622 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4623 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4624 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4625 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4626 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4627 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4628 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4629 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4630 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4631 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4632 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4633 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4634 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4635 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4636 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4637 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4638 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4639 v29 = pPlayer->_4B8233(v39, v38); |
0 | 4640 switch ( a5 ) |
4641 { | |
4642 case 3: | |
4643 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4644 v45 = a3->GetValue(); |
0 | 4645 v29 = pPlayer->_4B8213(v45, v44); |
4646 break; | |
4647 case 4: | |
4648 v29 = pPlayer->_4B824B(*v37); | |
4649 break; | |
4650 case 5: | |
4651 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4652 v43 = a3->GetValue(); |
0 | 4653 v29 = pPlayer->_4B8265(v43, v42); |
4654 break; | |
4655 case 6: | |
4656 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4657 v41 = a3->GetValue(); |
0 | 4658 v29 = pPlayer->_4B8213(v41, v40) / 2; |
4659 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4660 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4661 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4662 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4663 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4664 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4665 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4666 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 4667 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4668 v28 = a3->GetValue(); |
0 | 4669 v29 = pPlayer->_4B8142(v28, v27); |
4670 if ( a5 == 3 ) | |
4671 { | |
4672 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4673 v36 = a3->GetValue(); |
0 | 4674 v29 = pPlayer->_4B8102(v36, v35); |
315 | 4675 if (a3->Broken()) |
0 | 4676 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4677 goto _continue_sprintf; |
0 | 4678 } |
4679 if ( a5 != 4 ) | |
4680 { | |
4681 if ( a5 == 5 ) | |
4682 { | |
4683 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4684 v33 = a3->GetValue(); |
0 | 4685 v29 = pPlayer->_4B81C3(v33, v32); |
4686 } | |
4687 else | |
4688 { | |
4689 if ( a5 == 6 ) | |
4690 { | |
4691 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4692 v31 = a3->GetValue(); |
0 | 4693 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 4694 if (a3->Broken()) |
0 | 4695 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4696 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4697 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4698 goto _continue_sprintf; |
0 | 4699 } |
4700 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4701 _continue_sprintf: |
0 | 4702 sprintf(a1, "%lu", v29); |
250 | 4703 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4704 goto _continue_strcat; |
0 | 4705 } |
4706 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4707 |
0 | 4708 v48 = v34; |
4709 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4710 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4711 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4712 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4713 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4714 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4715 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4716 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4717 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4718 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4719 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4720 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4721 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4722 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4723 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4724 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4725 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4726 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4727 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4728 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4729 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4730 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4731 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4732 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4733 sub_493F79(&v57, *a6); |
351 | 4734 v54 = v57.field_18_expire_year; |
4735 v53 = v57.field_C_expire_day + 1; | |
4736 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4737 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4738 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4739 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4740 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4741 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4742 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4743 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4744 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4745 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4746 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4747 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4748 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4749 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4750 default: |
0 | 4751 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4752 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4753 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4754 goto _continue_strcat; |
484 | 4755 v49 = pParty->field_3C._s_times[v17-51]; |
4756 | |
0 | 4757 sub_493F79(&v56, v49); |
351 | 4758 v54 = v56.field_18_expire_year; |
4759 v53 = v56.field_C_expire_day + 1; | |
4760 v50 = v56.field_14_exprie_month; | |
0 | 4761 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 4762 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4763 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4764 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4765 } |
0 | 4766 } |
4767 return pTmpBuf2; | |
4768 } | |
4769 | |
706 | 4770 |
4771 | |
0 | 4772 |
4773 //----- (0049B04D) -------------------------------------------------------- | |
734 | 4774 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 4775 { |
734 | 4776 //stru154 *v3; // edi@1 |
4777 //signed int v4; // eax@1 | |
4778 //signed int result; // eax@9 | |
4779 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 4780 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 4781 float v7; |
0 | 4782 |
4783 v.x = 0.0; | |
4784 v.y = 0.0; | |
4785 v.z = 0.0; | |
734 | 4786 GetFacePlane(a2, a3, &v, &v7); |
4787 | |
4788 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
4789 polygonType = POLYGON_VerticalWall; | |
4790 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
4791 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
4792 polygonType = POLYGON_Floor; | |
0 | 4793 else |
734 | 4794 polygonType = POLYGON_InBetweenFloorAndWall; |
4795 | |
4796 face_plane.vNormal.x = v.x; | |
4797 face_plane.vNormal.y = v.y; | |
4798 face_plane.vNormal.z = v.z; | |
4799 face_plane.dist = v7; | |
0 | 4800 } |
4801 | |
4802 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 4803 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 4804 { |
734 | 4805 if (fabsf(pNormal->z) < 1e-6f) |
4806 polygonType = POLYGON_VerticalWall; | |
4807 else if (fabsf(pNormal->x) < 1e-6f && | |
4808 fabsf(pNormal->y) < 1e-6f) | |
4809 polygonType = POLYGON_Floor; | |
0 | 4810 else |
734 | 4811 polygonType = POLYGON_InBetweenFloorAndWall; |
4812 | |
4813 face_plane.vNormal.x = pNormal->x; | |
4814 face_plane.dist = dist; | |
4815 face_plane.vNormal.y = pNormal->y; | |
4816 face_plane.vNormal.z = pNormal->z; | |
0 | 4817 } |
4818 | |
4819 //----- (0049B13D) -------------------------------------------------------- | |
734 | 4820 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 4821 { |
4822 ODMFace *v5; // ebx@1 | |
734 | 4823 //int v6; // eax@1 |
4824 //unsigned __int16 *v7; // ebx@2 | |
4825 //Vec3_int_ *v8; // eax@3 | |
0 | 4826 Vec3_int_ *v9; // ecx@3 |
734 | 4827 //double v10; // st7@3 |
4828 //int v11; // ecx@3 | |
0 | 4829 Vec3_int_ *v12; // ecx@3 |
734 | 4830 //double v13; // st7@3 |
4831 //double v14; // st6@3 | |
4832 //double v15; // st5@3 | |
4833 //int v16; // ecx@3 | |
0 | 4834 Vec3_int_ *v17; // eax@3 |
734 | 4835 //double v18; // st5@3 |
0 | 4836 Vec3_float_ *v19; // eax@3 |
734 | 4837 //int result; // eax@8 |
4838 //float v21; // ecx@10 | |
4839 //double v22; // st7@10 | |
4840 //double v23; // st6@10 | |
0 | 4841 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 4842 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 4843 float v26; // [sp+1Ch] [bp-4Ch]@3 |
4844 float v27; // [sp+20h] [bp-48h]@3 | |
4845 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 4846 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
4847 //float v30; // [sp+30h] [bp-38h]@3 | |
4848 //float v31; // [sp+34h] [bp-34h]@3 | |
4849 //float v32; // [sp+38h] [bp-30h]@3 | |
4850 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 4851 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 4852 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
4853 //float v36; // [sp+50h] [bp-18h]@3 | |
4854 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 4855 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 4856 //int v39; // [sp+64h] [bp-4h]@1 |
4857 | |
4858 //v39 = 0; | |
0 | 4859 v1.x = 0.0; |
4860 v5 = pFace; | |
734 | 4861 //v6 = pFace->uNumVertices; |
0 | 4862 v1.y = 0.0; |
4863 v1.z = 0.0; | |
734 | 4864 |
4865 if (pFace->uNumVertices >= 2) | |
4866 { | |
4867 int i = 0; | |
4868 while ( i < pFace->uNumVertices - 2 ) | |
4869 { | |
4870 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
4871 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
4872 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
4873 | |
4874 v1.x = v12->x - v9->x; | |
4875 v26 = v17->x - v12->x; | |
4876 v1.y = v12->y - v9->y; | |
4877 v27 = v17->y - v12->y; | |
4878 v1.z = v12->z - v9->z; | |
4879 v28 = v17->z - v12->z; | |
0 | 4880 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
4881 v38.x = v19->x; | |
4882 v38.y = v19->y; | |
4883 v38.z = v19->z; | |
734 | 4884 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
4885 { | |
4886 v38.Normalize(); | |
4887 | |
4888 pOutNormal->x = v38.x; | |
4889 pOutNormal->y = v38.y; | |
4890 pOutNormal->z = v38.z; | |
4891 | |
4892 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
4893 return; | |
4894 } | |
4895 } | |
4896 } | |
4897 | |
4898 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
4899 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
4900 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
4901 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 4902 } |
4903 | |
4904 | |
4905 | |
4906 | |
4907 | |
4908 //----- (0049D700) -------------------------------------------------------- | |
4909 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
4910 { | |
4911 unsigned int v1; // eax@1 | |
4912 int v2; // ecx@1 | |
4913 unsigned int v3; // eax@1 | |
4914 | |
4915 v1 = uDim; | |
4916 v2 = 0; | |
4917 v3 = v1 - 1; | |
4918 while ( v3 & 1 ) | |
4919 { | |
4920 v3 >>= 1; | |
4921 ++v2; | |
4922 } | |
4923 return v3 == 0 ? v2 : 0; | |
4924 } | |
4925 | |
4926 | |
4927 | |
4928 | |
4929 | |
4930 | |
4931 | |
4932 | |
4933 | |
4934 | |
4935 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4936 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4937 { |
737 | 4938 /*signed __int64 v2; // ST10_8@1 |
0 | 4939 double v3; // st7@1 |
4940 float v4; // ST24_4@1 | |
4941 double v5; // ST10_8@1 | |
4942 int v6; // ST1C_4@1 | |
4943 float v7; // ST24_4@1 | |
4944 double v8; // ST10_8@1 | |
4945 unsigned __int8 v9; // ST20_1@1 | |
4946 float v10; // ST24_4@1 | |
4947 double v11; // ST10_8@1 | |
4948 float v12; // ST24_4@1 | |
737 | 4949 double v13; // ST08_8@1*/ |
4950 | |
4951 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4952 (a2 >> 24) / 255.0f * 255.0f), | |
4953 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4954 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4955 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4956 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4957 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4958 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4959 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4960 /*v2 = a1 >> 24; | |
4961 v3 = (double)v2 / 255.0f; | |
4962 HIDWORD(v2) = 0; | |
0 | 4963 LODWORD(v2) = a2 >> 24; |
737 | 4964 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4965 v5 = v4 + 6.7553994e15; |
4966 v6 = LODWORD(v5); | |
737 | 4967 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4968 v8 = v7 + 6.7553994e15; |
4969 v9 = LOBYTE(v8); | |
737 | 4970 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4971 v11 = v10 + 6.7553994e15; |
737 | 4972 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4973 v13 = v12 + 6.7553994e15; |
737 | 4974 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4975 } |
4976 | |
4977 | |
4978 | |
4979 //----- (004A46E6) -------------------------------------------------------- | |
4980 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4981 { | |
4982 int v5; // eax@1 | |
4983 int z; // eax@1 | |
4984 unsigned int v7; // eax@9 | |
4985 unsigned int v8; // ecx@9 | |
4986 int v9; // eax@9 | |
4987 unsigned int v10; // eax@10 | |
4988 int *v11; // esi@10 | |
4989 int *v12; // edi@10 | |
4990 int v13; // ecx@10 | |
4991 int v14; // edx@10 | |
4992 unsigned int v15; // eax@22 | |
4993 int *v16; // esi@22 | |
4994 int *v17; // edi@22 | |
4995 int v18; // ecx@22 | |
4996 int v19; // edx@22 | |
4997 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4998 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4999 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
5000 signed int v23; // [sp+20h] [bp+Ch]@1 | |
5001 | |
5002 v5 = a4; | |
5003 v23 = _z >> 16; | |
5004 z = x + v5; | |
693 | 5005 if ( z >= (signed int)pViewport->uViewportTL_X |
5006 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
5007 && y >= (signed int)pViewport->uViewportTL_Y | |
5008 && y <= (signed int)pViewport->uViewportBR_Y ) | |
5009 { | |
5010 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
5011 x = pViewport->uViewportTL_X; | |
5012 if ( z > (signed int)pViewport->uViewportBR_X ) | |
5013 z = pViewport->uViewportBR_X; | |
0 | 5014 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
5015 v22 = z - x; | |
5016 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
5017 v7 = lightColor >> 3; | |
5018 v8 = lightColor & 0xF0; | |
5019 v9 = v7 & 0x1E0000; | |
5020 if ( pRenderer->uTargetGBits == 5 ) | |
5021 { | |
5022 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
5023 v11 = (int *)pTarget; | |
5024 v12 = pTargetZ; | |
5025 v13 = v22; | |
5026 v14 = (v10 << 16) | v10; | |
5027 z = (unsigned __int8)pTarget & 2; | |
5028 if ( (unsigned __int8)pTarget & 2 ) | |
5029 { | |
5030 z = (unsigned int)*pTargetZ >> 16; | |
5031 if ( z > v23 ) | |
5032 { | |
5033 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
5034 *pTarget = z; | |
5035 } | |
5036 v13 = v22 - 1; | |
5037 v11 = (int *)(pTarget + 1); | |
5038 v12 = pTargetZ + 1; | |
5039 } | |
5040 while ( v13 != 1 ) | |
5041 { | |
5042 if ( v13 < 1 ) | |
5043 return z; | |
5044 z = (unsigned int)*v12 >> 16; | |
5045 if ( z <= v23 ) | |
5046 { | |
5047 v13 -= 2; | |
5048 ++v11; | |
5049 v12 += 2; | |
5050 } | |
5051 else | |
5052 { | |
5053 v12 += 2; | |
5054 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
5055 v13 -= 2; | |
5056 *v11 = z; | |
5057 ++v11; | |
5058 } | |
5059 } | |
5060 z = (unsigned int)*v12 >> 16; | |
5061 if ( z > v23 ) | |
5062 { | |
5063 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
5064 *(short *)v11 = z; | |
5065 } | |
5066 } | |
5067 else | |
5068 { | |
5069 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
5070 v16 = (int *)pTarget; | |
5071 v17 = pTargetZ; | |
5072 v18 = v22; | |
5073 v19 = (v15 << 16) | v15; | |
5074 z = (unsigned __int8)pTarget & 2; | |
5075 if ( (unsigned __int8)pTarget & 2 ) | |
5076 { | |
5077 z = (unsigned int)*pTargetZ >> 16; | |
5078 if ( z > v23 ) | |
5079 { | |
5080 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
5081 *pTarget = z; | |
5082 } | |
5083 v18 = v22 - 1; | |
5084 v16 = (int *)(pTarget + 1); | |
5085 v17 = pTargetZ + 1; | |
5086 } | |
5087 while ( v18 != 1 ) | |
5088 { | |
5089 if ( v18 < 1 ) | |
5090 return z; | |
5091 z = (unsigned int)*v17 >> 16; | |
5092 if ( z <= v23 ) | |
5093 { | |
5094 v18 -= 2; | |
5095 ++v16; | |
5096 v17 += 2; | |
5097 } | |
5098 else | |
5099 { | |
5100 v17 += 2; | |
5101 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
5102 v18 -= 2; | |
5103 *v16 = z; | |
5104 ++v16; | |
5105 } | |
5106 } | |
5107 z = (unsigned int)*v17 >> 16; | |
5108 if ( z > v23 ) | |
5109 { | |
5110 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
5111 *(short *)v16 = z; | |
5112 } | |
5113 } | |
5114 } | |
5115 return z; | |
5116 } | |
5117 | |
5118 | |
5119 //----- (004A57E9) -------------------------------------------------------- | |
5120 void __cdecl Present_ColorKey() | |
5121 { | |
5122 HRESULT v0; // eax@3 | |
5123 HRESULT v1; // eax@3 | |
5124 HRESULT v2; // eax@3 | |
5125 HRESULT v3; // eax@3 | |
5126 HRESULT v4; // eax@3 | |
5127 RECT a2; // [sp+4h] [bp-14h]@3 | |
5128 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
5129 | |
5130 if ( !pRenderer->uNumSceneBegins ) | |
5131 { | |
5132 if ( pRenderer->field_40110 ) | |
5133 { | |
693 | 5134 a2.bottom = pViewport->uViewportTL_Y; |
0 | 5135 a2.left = 0; |
5136 a2.top = 0; | |
5137 a2.right = 640; | |
5138 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
5139 a2.right = 640; | |
5140 a2.left = 0; | |
693 | 5141 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 5142 a2.bottom = 480; |
5143 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
5144 0, | |
693 | 5145 pViewport->uViewportBR_Y + 1, |
0 | 5146 pRenderer->pColorKeySurface4, |
5147 &a2, | |
5148 16u)); | |
693 | 5149 a2.right = pViewport->uViewportTL_X; |
5150 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 5151 a2.left = 0; |
693 | 5152 a2.top = pViewport->uViewportTL_Y; |
0 | 5153 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
5154 0, | |
693 | 5155 pViewport->uViewportTL_Y, |
0 | 5156 pRenderer->pColorKeySurface4, |
5157 &a2, | |
5158 16u)); | |
693 | 5159 a2.left = pViewport->uViewportBR_X; |
5160 a2.top = pViewport->uViewportTL_Y; | |
0 | 5161 a2.right = 640; |
693 | 5162 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 5163 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 5164 pViewport->uViewportBR_X, |
5165 pViewport->uViewportTL_Y, | |
0 | 5166 pRenderer->pColorKeySurface4, |
5167 &a2, | |
5168 16u)); | |
693 | 5169 a2.right = pViewport->uViewportBR_X; |
5170 a2.bottom = pViewport->uViewportBR_Y + 1; | |
5171 a2.left = pViewport->uViewportTL_X; | |
5172 a2.top = pViewport->uViewportTL_Y; | |
0 | 5173 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 5174 pViewport->uViewportTL_X, |
5175 pViewport->uViewportTL_Y, | |
0 | 5176 pRenderer->pColorKeySurface4, |
5177 &a2, | |
5178 17u)); | |
5179 } | |
5180 } | |
5181 } | |
5182 | |
5183 //----- (004A597D) -------------------------------------------------------- | |
5184 void Present_NoColorKey() | |
5185 { | |
5186 //unsigned __int16 *v0; // eax@4 | |
5187 unsigned __int16 *v1; // esi@4 | |
5188 void *v2; // edi@4 | |
5189 //signed int v4; // ebx@4 | |
5190 //signed int v5; // ebx@6 | |
5191 //void *v6; // edi@7 | |
5192 //const void *v7; // esi@7 | |
5193 signed int v8; // ebx@8 | |
5194 int v9; // eax@10 | |
5195 unsigned int v10; // esi@10 | |
5196 unsigned __int32 v11; // edi@10 | |
5197 //int v12; // ecx@10 | |
5198 unsigned int v13; // ebx@10 | |
5199 int v14; // eax@11 | |
5200 int v15; // eax@13 | |
5201 int v16; // eax@14 | |
5202 int v17; // eax@16 | |
5203 HRESULT v18; // eax@22 | |
5204 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
5205 int v20; // [sp+88h] [bp-1Ch]@10 | |
5206 int v21; // [sp+8Ch] [bp-18h]@10 | |
5207 __int32 v22; // [sp+90h] [bp-14h]@10 | |
5208 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
5209 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
5210 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
5211 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
5212 | |
5213 if ( !pRenderer->uNumSceneBegins ) | |
5214 { | |
5215 if ( pRenderer->field_40110 ) | |
5216 { | |
5217 memset(&Dst, 0, 0x7Cu); | |
5218 Dst.dwSize = 124; | |
168 | 5219 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 5220 { |
5221 //v26 = Dst.lpSurface; | |
5222 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
5223 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
5224 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
5225 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
5226 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
5227 v1 = pRenderer->pTargetSurface; | |
5228 v2 = Dst.lpSurface; | |
5229 | |
5230 | |
5231 /*for (uint y = 0; y < 480; ++y) | |
5232 { | |
5233 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
5234 for (uint x = 0; x < 640; ++x) | |
5235 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
5236 }*/ | |
5237 | |
5238 auto pSrc = pRenderer->pTargetSurface; | |
5239 auto pDst = (__int16 *)Dst.lpSurface; | |
5240 | |
5241 for (uint y = 0; y < 8; ++y) | |
5242 memcpy(pDst + y * Dst.lPitch / 2, | |
5243 | |
5244 pSrc + y * 640, 640 * sizeof(__int16)); | |
5245 | |
5246 for (uint y = 8; y < 352; ++y) | |
5247 { | |
5248 memcpy(pDst + y * Dst.lPitch / 2, | |
5249 pSrc + y * 640, 8 * sizeof(__int16)); | |
5250 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2, | |
5251 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
5252 } | |
5253 | |
121 | 5254 for (uint y = 352; y < 480; ++y) |
0 | 5255 memcpy(pDst + y * Dst.lPitch / 2, |
5256 pSrc + y * 640, 640 * sizeof(__int16)); | |
5257 | |
5258 | |
693 | 5259 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 5260 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 5261 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 5262 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 5263 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 5264 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
5265 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
5266 v21 = 4 * v9 + 1280; | |
5267 | |
121 | 5268 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 5269 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
5270 v10 = (int)pSrc_x1y1; | |
5271 v11 = (int)pDst_x1y1; | |
693 | 5272 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 5273 v13 = v24; |
5274 | |
693 | 5275 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 5276 { |
5277 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
5278 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 5279 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 5280 { |
5281 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
5282 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
5283 } | |
5284 } | |
5285 | |
5286 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
5287 | |
5288 /* while ( 1 ) | |
5289 { | |
5290 while ( 1 ) | |
5291 { | |
5292 v14 = *(int *)v10; | |
5293 v10 += 4; | |
5294 if ( v14 == v13 ) | |
5295 break; | |
5296 if ( (short)v14 == (short)v13 ) | |
5297 { | |
5298 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
5299 v11 += 4; | |
5300 --uHalfWidth; | |
5301 if ( !uHalfWidth ) | |
5302 goto LABEL_21; | |
5303 } | |
5304 else | |
5305 { | |
5306 v15 = __ROL__(v14, 16); | |
5307 if ( (short)v15 == (short)v13 ) | |
5308 { | |
5309 v17 = __ROR__(v15, 16); | |
5310 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
5311 v11 += 4; | |
5312 --uHalfWidth; | |
5313 if ( !uHalfWidth ) | |
5314 goto LABEL_21; | |
5315 } | |
5316 else | |
5317 { | |
5318 v16 = __ROR__(v15, 16); | |
5319 *(int *)v11 = v16; | |
5320 v11 += 4; | |
5321 --uHalfWidth; | |
5322 if ( !uHalfWidth ) | |
5323 goto LABEL_21; | |
5324 } | |
5325 } | |
5326 } | |
5327 v11 += 4; | |
5328 --uHalfWidth; | |
5329 if ( !uHalfWidth ) | |
5330 { | |
5331 LABEL_21: | |
5332 v10 += v21; | |
5333 v11 += v22; | |
5334 uHalfWidth = v20; | |
5335 if ( !--uNumLines ) | |
5336 { | |
5337 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
5338 return; | |
5339 } | |
5340 } | |
5341 }*/ | |
5342 } | |
5343 } | |
5344 } | |
5345 } | |
5346 | |
5347 | |
5348 | |
5349 //----- (004A7063) -------------------------------------------------------- | |
5350 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
5351 { | |
5352 float v2; // ST1C_4@1 | |
5353 double v3; // ST14_8@1 | |
5354 signed int v4; // ebx@1 | |
5355 float v5; // ST1C_4@1 | |
5356 double v6; // ST14_8@1 | |
5357 signed int v7; // edi@1 | |
5358 double v8; // ST0C_8@1 | |
5359 signed int v9; // esi@1 | |
5360 signed int v10; // ecx@1 | |
5361 double v12; // [sp+8h] [bp-18h]@1 | |
5362 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
5363 | |
5364 v2 = (double)(uDiffuse >> 24) * a2; | |
5365 v3 = v2 + 6.7553994e15; | |
5366 v4 = LODWORD(v3); | |
5367 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
5368 v6 = v5 + 6.7553994e15; | |
5369 v7 = LODWORD(v6); | |
5370 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
5371 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
5372 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
5373 v9 = LODWORD(v8); | |
5374 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
5375 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
5376 v10 = LODWORD(v12); | |
5377 if ( v4 > 255 ) | |
5378 v4 = 255; | |
5379 if ( v4 < 0 ) | |
5380 v4 = 0; | |
5381 if ( SHIDWORD(v13) > 255 ) | |
5382 v7 = 255; | |
5383 if ( v7 < 0 ) | |
5384 v7 = 0; | |
5385 if ( (signed int)v13 > 255 ) | |
5386 v9 = 255; | |
5387 if ( v9 < 0 ) | |
5388 v9 = 0; | |
5389 if ( SLODWORD(v12) > 255 ) | |
5390 v10 = 255; | |
5391 if ( v10 < 0 ) | |
5392 v10 = 0; | |
5393 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
5394 } | |
5395 | |
5396 | |
5397 | |
5398 | |
5399 | |
5400 | |
5401 | |
5402 | |
5403 //----- (004AD504) -------------------------------------------------------- | |
711 | 5404 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 5405 { |
5406 int result; // eax@1 | |
711 | 5407 signed int v2; // ebx@1 |
0 | 5408 BLVFace *v3; // esi@3 |
5409 Texture *v4; // edi@6 | |
5410 int v5; // eax@7 | |
5411 int v6; // edx@7 | |
5412 int v7; // ecx@7 | |
5413 int v8; // ebx@8 | |
5414 int v9; // eax@8 | |
5415 int v10; // ebx@8 | |
5416 unsigned int v11; // ebx@9 | |
5417 int v12; // esi@10 | |
5418 int v13; // eax@13 | |
5419 unsigned __int16 *v14; // eax@13 | |
5420 unsigned int v15; // eax@14 | |
5421 unsigned __int16 *v16; // ebx@14 | |
5422 int v17; // eax@15 | |
5423 int v18; // ebx@15 | |
5424 int v19; // esi@15 | |
5425 int v20; // ecx@15 | |
5426 int v21; // eax@15 | |
5427 stru193_math *v22; // ebx@15 | |
5428 int v23; // eax@15 | |
5429 char *v24; // esi@16 | |
5430 int v25; // eax@18 | |
5431 int v26; // eax@18 | |
5432 int v27; // eax@20 | |
5433 signed int v28; // esi@20 | |
5434 signed int v29; // edx@20 | |
5435 signed int v30; // esi@20 | |
5436 signed int v31; // edi@20 | |
5437 int v32; // esi@20 | |
5438 int v33; // eax@26 | |
5439 int *v34; // esi@27 | |
5440 unsigned __int16 *v35; // edi@27 | |
5441 unsigned int v36; // edx@27 | |
5442 int v37; // ebx@27 | |
5443 char v38; // cl@27 | |
5444 char v39; // ch@27 | |
5445 int v40; // ebx@29 | |
5446 int v41; // edx@29 | |
5447 unsigned int v42; // ebx@30 | |
5448 int v43; // edx@30 | |
5449 int v44; // eax@33 | |
5450 int *v45; // esi@34 | |
5451 unsigned __int16 *v46; // edi@34 | |
5452 unsigned int v47; // edx@34 | |
5453 int v48; // ebx@34 | |
5454 char v49; // cl@34 | |
5455 char v50; // ch@34 | |
5456 int v51; // ebx@36 | |
5457 int v52; // edx@36 | |
5458 unsigned __int16 v53; // bx@37 | |
5459 int v54; // edx@37 | |
5460 int v55; // eax@40 | |
5461 int v56; // eax@41 | |
5462 int *v57; // esi@42 | |
5463 unsigned __int16 *v58; // edi@42 | |
5464 unsigned int v59; // edx@42 | |
5465 int v60; // ebx@42 | |
5466 char v61; // cl@42 | |
5467 char v62; // ch@42 | |
5468 unsigned int v63; // ebx@44 | |
5469 int v64; // edx@44 | |
5470 unsigned int v65; // ebx@44 | |
5471 int v66; // edx@44 | |
5472 unsigned int v67; // ebx@45 | |
5473 int v68; // edx@45 | |
5474 int v69; // ebx@45 | |
5475 int v70; // edx@45 | |
5476 int v71; // eax@48 | |
5477 int *v72; // esi@49 | |
5478 unsigned __int16 *v73; // edi@49 | |
5479 unsigned int v74; // edx@49 | |
5480 int v75; // ebx@49 | |
5481 char v76; // cl@49 | |
5482 char v77; // ch@49 | |
5483 unsigned int v78; // ebx@51 | |
5484 int v79; // edx@51 | |
5485 unsigned int v80; // ebx@51 | |
5486 int v81; // edx@51 | |
5487 unsigned int v82; // ebx@52 | |
5488 int v83; // edx@52 | |
5489 int v84; // ebx@52 | |
5490 int v85; // edx@52 | |
5491 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
5492 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
5493 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
5494 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
5495 int v90; // [sp+1Ch] [bp-88h]@20 | |
5496 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
5497 int v92; // [sp+24h] [bp-80h]@7 | |
5498 int i; // [sp+28h] [bp-7Ch]@7 | |
5499 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
5500 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
5501 Texture *v96; // [sp+34h] [bp-70h]@6 | |
5502 int v97; // [sp+38h] [bp-6Ch]@15 | |
5503 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
5504 int v99; // [sp+40h] [bp-64h]@9 | |
5505 int v100; // [sp+44h] [bp-60h]@24 | |
5506 int v101; // [sp+48h] [bp-5Ch]@10 | |
5507 int v102; // [sp+4Ch] [bp-58h]@20 | |
5508 int v103; // [sp+50h] [bp-54h]@20 | |
5509 int v104; // [sp+54h] [bp-50h]@9 | |
5510 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
5511 int v106; // [sp+5Ch] [bp-48h]@24 | |
5512 int v107; // [sp+60h] [bp-44h]@20 | |
5513 int v108; // [sp+64h] [bp-40h]@20 | |
5514 int v109; // [sp+68h] [bp-3Ch]@20 | |
5515 int v110; // [sp+6Ch] [bp-38h]@15 | |
5516 int v111; // [sp+70h] [bp-34h]@20 | |
5517 int a1; // [sp+74h] [bp-30h]@12 | |
5518 int a2; // [sp+78h] [bp-2Ch]@9 | |
5519 int *v114; // [sp+7Ch] [bp-28h]@16 | |
5520 int v115; // [sp+80h] [bp-24h]@18 | |
5521 int v116; // [sp+84h] [bp-20h]@7 | |
5522 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
5523 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
5524 int *v119; // [sp+90h] [bp-14h]@13 | |
5525 int v120; // [sp+94h] [bp-10h]@15 | |
5526 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
5527 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
5528 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
5529 | |
5530 result = pRenderer->uTargetSurfacePitch; | |
711 | 5531 v2 = sFaceID; |
0 | 5532 v95 = pRenderer->uTargetSurfacePitch; |
711 | 5533 if ( sFaceID >= 0 ) |
5534 { | |
5535 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
5536 { | |
5537 v3 = &pIndoor->pFaces[sFaceID]; | |
5538 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 5539 if ( !pRenderer->pRenderD3D ) |
5540 { | |
711 | 5541 result = sub_423B5D(sFaceID); |
0 | 5542 if ( result ) |
5543 { | |
5544 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
5545 if ( result ) | |
5546 { | |
5547 result = (int)v3->GetTexture(); | |
5548 v4 = (Texture *)result; | |
5549 v96 = (Texture *)result; | |
5550 if ( result ) | |
5551 { | |
5552 v5 = *(short *)(result + 38); | |
5553 LOBYTE(v3->uAttributes) |= 0x80u; | |
5554 v92 = v5; | |
5555 sub_4AE5F1(v2); | |
5556 ++pBLVRenderParams->field_84; | |
5557 v6 = stru_F8AD28.pDeltaUV[0]; | |
5558 v116 = stru_F8AD28.pDeltaUV[1]; | |
5559 v7 = 0; | |
5560 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
5561 { | |
5562 v8 = v116; | |
5563 stru_F8AD28._blv_lights_xs[v7] += v6; | |
5564 v9 = 4 * v7 + 16297672; | |
5565 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
5566 } | |
5567 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
5568 result = stru_F8A590._viewport_space_y; | |
5569 a2 = stru_F8A590._viewport_space_y; | |
5570 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
5571 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 5572 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5573 v87 = v4->pLevelOfDetail1; |
5574 v88 = v4->pLevelOfDetail2; | |
5575 v89 = v4->pLevelOfDetail3; | |
5576 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
5577 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
5578 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5579 { | |
5580 v12 = 2 * stru_F8A590._viewport_space_y; | |
5581 v101 = 2 * stru_F8A590._viewport_space_y; | |
5582 while ( 1 ) | |
5583 { | |
5584 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
5585 sub_4AE313(a1, result, &stru_F81018.field_0); | |
5586 if ( LOBYTE(viewparams->field_20) ) | |
5587 { | |
5588 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
5589 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
5590 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
5591 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
5592 - pBLVRenderParams->uViewportX]; | |
5593 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
5594 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
5595 - pBLVRenderParams->uViewportX]; | |
5596 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
5597 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
5598 - pBLVRenderParams->uViewportX]; | |
5599 v123 = (unsigned int)v16; | |
5600 } | |
5601 else | |
5602 { | |
5603 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
5604 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
5605 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
5606 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
5607 } | |
5608 v117 = (unsigned int)v14; | |
5609 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
5610 v18 = stru_F81018.field_0.field_10; | |
5611 LOWORD(v17) = 0; | |
5612 v97 = stru_F8AD28.field_0 | v17; | |
5613 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
5614 v19 = stru_F81018.field_0.field_4 >> i; | |
5615 v20 = 11 - v18; | |
5616 v116 = stru_F81018.field_0.field_8 >> i; | |
5617 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
5618 v22 = stru_5C6E00; | |
5619 v122 = (unsigned __int16 *)v20; | |
323 | 5620 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
5621 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 5622 v120 = v116 + 4 * v23; |
5623 if ( v123 < v117 ) | |
5624 { | |
5625 v24 = (char *)&stru_F81018.field_34.field_8; | |
5626 v114 = &stru_F81018.field_34.field_8; | |
5627 a1 += 16; | |
5628 while ( 1 ) | |
5629 { | |
5630 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
5631 v25 = *((int *)v24 - 2); | |
5632 LOWORD(v25) = 0; | |
5633 v115 = v97; | |
5634 v26 = stru_F8AD28.field_0 | v25; | |
5635 if ( v97 <= (unsigned int)v26 ) | |
5636 v115 = v26; | |
5637 v97 = v26; | |
5638 v27 = *((int *)v24 - 11); | |
5639 v28 = *((int *)v24 - 1); | |
5640 v105 = (&v86)[4 * v27]; | |
5641 v111 = v27 + 16; | |
5642 v29 = v4->uWidthMinus1; | |
5643 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
5644 v107 = v29 >> v27; | |
5645 v30 = v28 >> i; | |
5646 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
5647 v31 = *v114 >> i; | |
5648 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 5649 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
5650 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 5651 v108 = (signed int)(v116 - v121) >> 4; |
5652 v103 = (v90 - v120) >> 4; | |
5653 v32 = v123 + 32; | |
5654 if ( LOBYTE(viewparams->field_20) ) | |
5655 v32 = v123 + 64; | |
5656 if ( v32 > v117 ) | |
5657 v32 = v117; | |
5658 v118 = v32; | |
5659 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
5660 v106 = (signed int)(v32 - v123) >> 1; | |
5661 if ( v110 >> 16 == v100 >> 16 ) | |
5662 { | |
5663 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
5664 if ( LOBYTE(viewparams->field_20) ) | |
5665 { | |
5666 v44 = v123; | |
5667 if ( v123 < v118 ) | |
5668 { | |
5669 v45 = v119; | |
5670 v46 = v122; | |
5671 v47 = v121; | |
5672 v48 = v120; | |
5673 v49 = v111; | |
5674 v50 = v109; | |
5675 if ( v106 & 2 ) | |
5676 { | |
5677 *v119 = v115; | |
5678 v45 -= 2; | |
5679 v44 = v123 + 4; | |
5680 goto LABEL_37; | |
5681 } | |
5682 do | |
5683 { | |
5684 v44 += 8; | |
5685 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
5686 v52 = v115; | |
5687 LOWORD(v51) = v46[v51]; | |
5688 *v45 = v115; | |
5689 v45[1] = v52; | |
5690 v45[640] = v52; | |
5691 v45[641] = v52; | |
5692 *(short *)(v44 - 8) = v51; | |
5693 *(short *)(v44 - 6) = v51; | |
5694 *(short *)(v44 + 1272) = v51; | |
5695 *(short *)(v44 + 1274) = v51; | |
5696 v45[2] = v52; | |
5697 v45[3] = v52; | |
5698 v45[642] = v52; | |
5699 v45[643] = v52; | |
5700 v121 += v108; | |
5701 v120 += v103; | |
5702 v47 = v121; | |
5703 v48 = v120; | |
5704 LABEL_37: | |
5705 v45 += 4; | |
5706 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
5707 v54 = v108; | |
5708 *(short *)(v44 - 4) = v53; | |
5709 *(short *)(v44 - 2) = v53; | |
5710 *(short *)(v44 + 1276) = v53; | |
5711 *(short *)(v44 + 1278) = v53; | |
5712 v121 += v54; | |
5713 v120 += v103; | |
5714 v47 = v121; | |
5715 v48 = v120; | |
5716 } | |
5717 while ( v44 < v118 ); | |
5718 v123 = v44; | |
5719 v119 = v45; | |
5720 } | |
5721 } | |
5722 else | |
5723 { | |
5724 v33 = v123; | |
5725 if ( v123 < v118 ) | |
5726 { | |
5727 v34 = v119; | |
5728 v35 = v122; | |
5729 v36 = v121; | |
5730 v37 = v120; | |
5731 v38 = v111; | |
5732 v39 = v109; | |
5733 if ( v106 & 1 ) | |
5734 { | |
5735 *v119 = v115; | |
5736 --v34; | |
5737 v33 = v123 + 2; | |
5738 goto LABEL_30; | |
5739 } | |
5740 do | |
5741 { | |
5742 v33 += 4; | |
5743 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
5744 v41 = v115; | |
5745 LOWORD(v40) = v35[v40]; | |
5746 *v34 = v115; | |
5747 *(short *)(v33 - 4) = v40; | |
5748 v34[1] = v41; | |
5749 v121 += v108; | |
5750 v120 += v103; | |
5751 v36 = v121; | |
5752 v37 = v120; | |
5753 LABEL_30: | |
5754 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
5755 v34 += 2; | |
5756 v43 = v108; | |
5757 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
5758 v121 += v43; | |
5759 v120 += v103; | |
5760 v36 = v121; | |
5761 v37 = v120; | |
5762 } | |
5763 while ( v33 < v118 ); | |
5764 v123 = v33; | |
5765 v119 = v34; | |
5766 } | |
5767 } | |
5768 } | |
5769 else | |
5770 { | |
5771 v55 = v110 - ((v100 - v110) >> 4); | |
5772 v110 = (v100 - v110) >> 4; | |
5773 v122 = (unsigned __int16 *)v55; | |
5774 if ( LOBYTE(viewparams->field_20) ) | |
5775 { | |
5776 v71 = v123; | |
5777 if ( v123 < v118 ) | |
5778 { | |
5779 v72 = v119; | |
5780 v73 = v94; | |
5781 v74 = v121; | |
5782 v75 = v120; | |
5783 v76 = v111; | |
5784 v77 = v109; | |
5785 if ( v106 & 2 ) | |
5786 { | |
5787 *v119 = v115; | |
5788 v72 += 2; | |
5789 v71 = v123 + 4; | |
5790 goto LABEL_52; | |
5791 } | |
5792 do | |
5793 { | |
5794 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
5795 v79 = (int)((char *)v122 + v110); | |
5796 v71 += 8; | |
5797 v122 = (unsigned __int16 *)v79; | |
5798 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
5799 v81 = v115; | |
5800 LOWORD(v80) = v73[v80]; | |
5801 *v72 = v115; | |
5802 v72[1] = v81; | |
5803 v72[640] = v81; | |
5804 v72[641] = v81; | |
5805 *(short *)(v71 - 8) = v80; | |
5806 *(short *)(v71 - 6) = v80; | |
5807 *(short *)(v71 + 1272) = v80; | |
5808 *(short *)(v71 + 1274) = v80; | |
5809 v72[2] = v81; | |
5810 v72[3] = v81; | |
5811 v72[642] = v81; | |
5812 v72[643] = v81; | |
5813 v121 += v108; | |
5814 v120 += v103; | |
5815 v74 = v121; | |
5816 v75 = v120; | |
5817 v72 += 4; | |
5818 LABEL_52: | |
5819 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
5820 v83 = (int)((char *)v122 + v110); | |
5821 v84 = v105[v82]; | |
5822 v122 = (unsigned __int16 *)v83; | |
5823 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
5824 v85 = v108; | |
5825 *(short *)(v71 - 4) = v84; | |
5826 *(short *)(v71 - 2) = v84; | |
5827 *(short *)(v71 + 1276) = v84; | |
5828 *(short *)(v71 + 1278) = v84; | |
5829 v121 += v85; | |
5830 v120 += v103; | |
5831 v74 = v121; | |
5832 v75 = v120; | |
5833 } | |
5834 while ( v71 < v118 ); | |
5835 v123 = v71; | |
5836 v119 = v72; | |
5837 } | |
5838 } | |
5839 else | |
5840 { | |
5841 v56 = v123; | |
5842 if ( v123 < v118 ) | |
5843 { | |
5844 v57 = v119; | |
5845 v58 = v94; | |
5846 v59 = v121; | |
5847 v60 = v120; | |
5848 v61 = v111; | |
5849 v62 = v109; | |
5850 if ( v106 & 1 ) | |
5851 { | |
5852 *v119 = v115; | |
5853 ++v57; | |
5854 v56 = v123 + 2; | |
5855 goto LABEL_45; | |
5856 } | |
5857 do | |
5858 { | |
5859 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5860 v64 = (int)((char *)v122 + v110); | |
5861 v56 += 4; | |
5862 v122 = (unsigned __int16 *)v64; | |
5863 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
5864 v66 = v115; | |
5865 LOWORD(v65) = v58[v65]; | |
5866 *v57 = v115; | |
5867 *(short *)(v56 - 4) = v65; | |
5868 v57[1] = v66; | |
5869 v121 += v108; | |
5870 v120 += v103; | |
5871 v59 = v121; | |
5872 v60 = v120; | |
5873 v57 += 2; | |
5874 LABEL_45: | |
5875 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5876 v68 = (int)((char *)v122 + v110); | |
5877 v69 = v105[v67]; | |
5878 v122 = (unsigned __int16 *)v68; | |
5879 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
5880 v70 = v108; | |
5881 *(short *)(v56 - 2) = v69; | |
5882 v121 += v70; | |
5883 v120 += v103; | |
5884 v59 = v121; | |
5885 v60 = v120; | |
5886 } | |
5887 while ( v56 < v118 ); | |
5888 v123 = v56; | |
5889 v119 = v57; | |
5890 } | |
5891 } | |
5892 } | |
5893 v114 += 13; | |
5894 v110 = v100; | |
5895 a1 += 16; | |
5896 v4 = v96; | |
5897 v121 = v116; | |
5898 v120 = v90; | |
5899 if ( v123 >= v117 ) | |
5900 break; | |
5901 v24 = (char *)v114; | |
5902 v22 = stru_5C6E00; | |
5903 } | |
5904 } | |
5905 ++a2; | |
5906 v98 += v95; | |
5907 result = a2; | |
5908 v101 += 2; | |
5909 v99 += 640; | |
5910 if ( a2 > stru_F8A590._viewport_space_w ) | |
5911 break; | |
5912 v12 = v101; | |
5913 result = a2; | |
5914 v11 = v98; | |
5915 } | |
5916 } | |
5917 } | |
5918 } | |
5919 } | |
5920 } | |
5921 } | |
5922 } | |
5923 return result; | |
5924 } | |
5925 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5926 | |
5927 //----- (004ADD1D) -------------------------------------------------------- | |
5928 void __fastcall sub_4ADD1D(int uFaceID) | |
5929 { | |
5930 int v1; // edi@1 | |
5931 BLVFace *v2; // esi@3 | |
5932 signed int v3; // ebx@4 | |
5933 Texture *v4; // edi@9 | |
5934 signed int v5; // eax@9 | |
5935 char *v6; // edi@12 | |
5936 signed int v7; // eax@15 | |
5937 unsigned int v8; // eax@16 | |
5938 __int16 v9; // cx@19 | |
5939 unsigned __int8 *v10; // eax@19 | |
5940 unsigned __int16 *v11; // eax@19 | |
5941 int v12; // edi@19 | |
5942 int v13; // ebx@20 | |
5943 stru352 *v14; // esi@20 | |
5944 DWORD v15; // eax@22 | |
5945 signed int v16; // ecx@22 | |
5946 signed int v17; // ST68_4@22 | |
5947 int v18; // eax@22 | |
5948 int v19; // ecx@22 | |
5949 unsigned int v20; // esi@23 | |
5950 int v21; // edi@23 | |
5951 int v22; // eax@23 | |
5952 int *v23; // ebx@24 | |
5953 int v24; // edx@24 | |
5954 int v25; // ebx@25 | |
5955 unsigned __int16 v26; // cx@25 | |
5956 int v27; // edx@26 | |
5957 unsigned __int16 v28; // cx@26 | |
5958 unsigned __int8 v29; // sf@27 | |
5959 unsigned __int8 v30; // of@27 | |
5960 unsigned int v31; // esi@29 | |
5961 int v32; // edi@29 | |
5962 unsigned __int16 *v33; // eax@29 | |
5963 int *v34; // ebx@30 | |
5964 int v35; // edx@30 | |
5965 int v36; // ebx@31 | |
5966 unsigned __int16 v37; // cx@31 | |
5967 int v38; // edx@32 | |
5968 unsigned __int16 v39; // cx@32 | |
5969 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5970 int v41; // [sp-Ch] [bp-68h]@15 | |
5971 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5972 signed int v43; // [sp+14h] [bp-48h]@12 | |
5973 signed int v44; // [sp+14h] [bp-48h]@22 | |
5974 int v45; // [sp+1Ch] [bp-40h]@22 | |
5975 int v46; // [sp+20h] [bp-3Ch]@22 | |
5976 int v47; // [sp+24h] [bp-38h]@19 | |
5977 char v48; // [sp+28h] [bp-34h]@19 | |
5978 int v49; // [sp+2Ch] [bp-30h]@19 | |
5979 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5980 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5981 int v52; // [sp+38h] [bp-24h]@22 | |
5982 int v53; // [sp+3Ch] [bp-20h]@22 | |
5983 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5984 int v55; // [sp+40h] [bp-1Ch]@20 | |
5985 int v56; // [sp+44h] [bp-18h]@20 | |
5986 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5987 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5988 int v59; // [sp+50h] [bp-Ch]@4 | |
5989 int v60; // [sp+50h] [bp-Ch]@19 | |
5990 int v61; // [sp+54h] [bp-8h]@22 | |
5991 int *v62; // [sp+58h] [bp-4h]@23 | |
5992 int *v63; // [sp+58h] [bp-4h]@29 | |
5993 | |
5994 v1 = uFaceID; | |
5995 v42 = pRenderer->uTargetSurfacePitch; | |
5996 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5997 { | |
5998 v2 = &pIndoor->pFaces[uFaceID]; | |
5999 if ( pRenderer->pRenderD3D ) | |
6000 { | |
6001 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
6002 v59 = v3; | |
6003 } | |
6004 else | |
6005 { | |
6006 v59 = sub_423B5D(uFaceID); | |
6007 v3 = v59; | |
6008 } | |
6009 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
6010 { | |
6011 v4 = v2->GetTexture(); | |
6012 v5 = 0; | |
6013 if ( v4 ) | |
6014 { | |
6015 if ( pRenderer->pRenderD3D ) | |
6016 { | |
6017 if ( v3 > 0 ) | |
6018 { | |
6019 v54 = v3; | |
6020 v43 = v3; | |
6021 v6 = (char *)&array_507D30[0].v; | |
6022 do | |
6023 { | |
6024 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
6025 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
6026 v6 += 48; | |
6027 --v54; | |
6028 } | |
6029 while ( v54 ); | |
6030 v3 = v59; | |
6031 v5 = v43; | |
6032 } | |
6033 v7 = v5; | |
6034 v41 = stru_F8AD28.field_0; | |
6035 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
6036 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
6037 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
6038 { | |
6039 v40 = v2->GetTexture(); | |
6040 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
6041 } | |
6042 else | |
6043 { | |
6044 v40 = v2->GetTexture(); | |
6045 v8 = v2->uBitmapID; | |
6046 } | |
6047 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
6048 } | |
6049 else | |
6050 { | |
6051 v49 = v4->uWidthMinus1; | |
6052 v47 = v4->uHeightMinus1 << 16; | |
6053 v9 = 16 - v4->uWidthLn2; | |
710 | 6054 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 6055 LOBYTE(v2->uAttributes) |= 0x80u; |
6056 v48 = v9; | |
6057 v50 = v10; | |
6058 sub_4AF412(); | |
6059 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
6060 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
6061 v12 = stru_F8A590._viewport_space_y; | |
6062 v51 = v11; | |
6063 v60 = stru_F8A590._viewport_space_y; | |
6064 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
6065 { | |
6066 v13 = 2 * stru_F8A590._viewport_space_y; | |
6067 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
6068 v55 = 2 * stru_F8A590._viewport_space_y; | |
6069 v56 = 640 * stru_F8A590._viewport_space_y; | |
6070 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
6071 { | |
6072 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
6073 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
6074 v15 = GetTickCount(); | |
6075 v16 = v14->field_0; | |
6076 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
6077 v45 = v14->field_4 >> 3; | |
6078 v44 = v16 >> 3; | |
6079 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
6080 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
6081 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
6082 v18 = v14->field_28; | |
6083 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
6084 LOWORD(v18) = 0; | |
6085 v46 = stru_F8AD28.field_0 | v18; | |
6086 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
6087 if ( LOBYTE(viewparams->field_20) ) | |
6088 { | |
6089 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
6090 - pBLVRenderParams->uViewportX]; | |
6091 v31 = v44; | |
6092 v32 = v45; | |
6093 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
6094 + 2 * v19 | |
6095 - pBLVRenderParams->uViewportX]; | |
6096 if ( v61 & 1 ) | |
6097 { | |
6098 --v61; | |
6099 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
6100 + 2 * v19 | |
6101 - pBLVRenderParams->uViewportX | |
6102 - 2]; | |
6103 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
6104 - pBLVRenderParams->uViewportX]; | |
6105 v35 = v46; | |
6106 v63 += 2; | |
6107 goto LABEL_32; | |
6108 } | |
6109 while ( 1 ) | |
6110 { | |
6111 v30 = __OFSUB__(v61, 2); | |
6112 v29 = v61 - 2 < 0; | |
6113 v61 -= 2; | |
6114 if ( v29 ^ v30 ) | |
6115 break; | |
6116 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
6117 v31 += v52; | |
6118 v37 = v51[v36]; | |
6119 v32 += v53; | |
6120 v34 = v63; | |
6121 v35 = v46; | |
6122 *v33 = v37; | |
6123 v33[1] = v37; | |
6124 v33[640] = v37; | |
6125 v33[641] = v37; | |
6126 v63 += 4; | |
6127 v34[2] = v46; | |
6128 v34[3] = v46; | |
6129 v34[642] = v46; | |
6130 v34[643] = v46; | |
6131 LABEL_32: | |
6132 *v34 = v35; | |
6133 v34[1] = v35; | |
6134 v34[640] = v35; | |
6135 v34[641] = v35; | |
6136 v38 = v49 & (v31 >> 16); | |
6137 v33 += 4; | |
6138 v31 += v52; | |
6139 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
6140 v32 += v53; | |
6141 *(v33 - 2) = v39; | |
6142 *(v33 - 1) = v39; | |
6143 v33[638] = v39; | |
6144 v33[639] = v39; | |
6145 } | |
6146 } | |
6147 else | |
6148 { | |
6149 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
6150 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
6151 v20 = v44; | |
6152 v21 = v45; | |
6153 v22 = (int)v58; | |
6154 if ( v61 & 1 ) | |
6155 { | |
6156 --v61; | |
6157 v22 = (int)(v58 - 1); | |
6158 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
6159 v24 = v46; | |
6160 ++v62; | |
6161 goto LABEL_26; | |
6162 } | |
6163 while ( 1 ) | |
6164 { | |
6165 v30 = __OFSUB__(v61, 2); | |
6166 v29 = v61 - 2 < 0; | |
6167 v61 -= 2; | |
6168 if ( v29 ^ v30 ) | |
6169 break; | |
6170 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
6171 v20 += v52; | |
6172 v26 = v51[v25]; | |
6173 v21 += v53; | |
6174 v23 = v62; | |
6175 v24 = v46; | |
6176 *(short *)v22 = v26; | |
6177 v62 += 2; | |
6178 v23[1] = v46; | |
6179 LABEL_26: | |
6180 *v23 = v24; | |
6181 v27 = v49 & (v20 >> 16); | |
6182 v22 += 4; | |
6183 v20 += v52; | |
6184 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
6185 v21 += v53; | |
6186 *(short *)(v22 - 2) = v28; | |
6187 } | |
6188 } | |
6189 ++v60; | |
6190 ++i; | |
6191 v56 += 640; | |
6192 v55 += 2; | |
6193 if ( v60 > stru_F8A590._viewport_space_w ) | |
6194 break; | |
6195 v13 = v55; | |
6196 v12 = v60; | |
6197 } | |
6198 } | |
6199 } | |
6200 } | |
6201 } | |
6202 } | |
6203 } | |
6204 | |
6205 //----- (004AE1E7) -------------------------------------------------------- | |
6206 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
6207 { | |
6208 int v3; // ebx@1 | |
6209 int v4; // edi@1 | |
6210 int v5; // esi@1 | |
6211 signed __int64 v6; // qtt@3 | |
6212 int v7; // esi@3 | |
6213 int v8; // eax@5 | |
6214 int result; // eax@5 | |
6215 int v10; // edx@5 | |
6216 int v11; // [sp+Ch] [bp-8h]@1 | |
6217 int v12; // [sp+1Ch] [bp+8h]@2 | |
6218 | |
6219 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
6220 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
6221 v11 = a1; | |
6222 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
6223 + stru_F8AD28.field_7C | |
6224 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
6225 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
6226 { | |
6227 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
6228 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
6229 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
6230 } | |
6231 else | |
6232 { | |
6233 v7 = 1073741824; | |
6234 } | |
6235 v8 = stru_F8AD28.vec_9C.z; | |
6236 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
6237 + stru_F8AD28.vec_8C.x | |
6238 + v4 * stru_F8AD28.vec_8C.y) | |
6239 * (signed __int64)v7) >> 16) | |
6240 + stru_F8AD28.field_98; | |
6241 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
6242 v10 = result + stru_F8AD28.field_A8; | |
6243 stru_F83B80[v11].field_28 = v7; | |
6244 stru_F83B80[v11].field_4 = v10; | |
6245 return result; | |
6246 } | |
6247 | |
6248 //----- (004AE313) -------------------------------------------------------- | |
6249 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
6250 { | |
6251 int _dy; // ebx@1 | |
6252 int _dx; // edi@1 | |
6253 int v5; // ecx@1 | |
6254 int v6; // esi@1 | |
6255 int v7; // ST18_4@2 | |
6256 signed __int64 v8; // qtt@3 | |
6257 unsigned int v9; // ecx@3 | |
6258 int result; // eax@8 | |
6259 int v11; // [sp+Ch] [bp-8h]@1 | |
6260 | |
6261 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
6262 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
6263 ++pBLVRenderParams->field_88; | |
6264 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
6265 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
6266 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
6267 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
6268 { | |
6269 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
6270 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
6271 v9 = v8 / v11; | |
6272 } | |
6273 else | |
6274 { | |
6275 v9 = 0x40000000u; | |
6276 } | |
6277 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
6278 p->field_0 = v9; | |
6279 else | |
6280 p->field_0 = stru_F8AD28.field_34; | |
6281 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
6282 * (signed __int64)(signed int)v9) >> 16) | |
6283 + stru_F8AD28.field_98 | |
6284 + (stru_F8AD28.pDeltaUV[0] << 16); | |
6285 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
6286 * (signed __int64)(signed int)v9) >> 16) | |
6287 + stru_F8AD28.field_A8 | |
6288 + (stru_F8AD28.pDeltaUV[1] << 16); | |
6289 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
6290 if ( result < 369620 || bUseLoResSprites ) | |
6291 { | |
6292 if ( result < 184810 ) | |
6293 p->field_10 = result > 92405; | |
6294 else | |
6295 p->field_10 = 2; | |
6296 } | |
6297 else | |
6298 { | |
6299 p->field_10 = 3; | |
6300 } | |
6301 return result; | |
6302 } | |
6303 | |
6304 //----- (004AE491) -------------------------------------------------------- | |
6305 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
6306 { | |
6307 signed int v2; // eax@1 | |
6308 signed int v3; // edi@1 | |
6309 int v4; // ecx@1 | |
6310 int v5; // esi@2 | |
6311 int v6; // eax@2 | |
6312 int v7; // ebx@2 | |
6313 unsigned int v8; // ecx@2 | |
6314 int v9; // edx@5 | |
6315 int v10; // edx@7 | |
6316 unsigned int v11; // eax@8 | |
6317 int v13; // [sp+4h] [bp-18h]@2 | |
6318 int v14; // [sp+8h] [bp-14h]@2 | |
6319 signed int v15; // [sp+Ch] [bp-10h]@1 | |
6320 int v16; // [sp+14h] [bp-8h]@1 | |
6321 int v17; // [sp+18h] [bp-4h]@1 | |
6322 | |
6323 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
6324 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
6325 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
6326 v4 = 0; | |
6327 v15 = v2; | |
6328 v16 = 0; | |
6329 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
6330 { | |
6331 do | |
6332 { | |
6333 v5 = v16; | |
6334 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
6335 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
6336 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
6337 v7 = v13; | |
6338 v8 = v14; | |
6339 if ( v6 < v13 ) | |
6340 { | |
6341 v6 = v13; | |
6342 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
6343 } | |
6344 if ( v6 < v14 ) | |
6345 { | |
6346 v9 = v6; | |
6347 v6 = v14; | |
6348 v8 = v9; | |
6349 } | |
6350 if ( v7 < (signed int)v8 ) | |
6351 { | |
6352 v10 = v8; | |
6353 v8 = v7; | |
6354 v7 = v10; | |
6355 } | |
6356 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
6357 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
6358 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
6359 ++v16; | |
6360 v2 = v15; | |
6361 } | |
6362 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
6363 v4 = 0; | |
6364 } | |
6365 if ( stru_F8AD28.field_3E4 != v4 ) | |
6366 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
6367 if ( v17 >= v4 ) | |
6368 { | |
6369 if ( v17 > 2031616 ) | |
6370 v17 = 2031616; | |
6371 } | |
6372 else | |
6373 { | |
6374 v17 = v4; | |
6375 } | |
6376 ++pBLVRenderParams->field_8C; | |
6377 return v17; | |
6378 } | |
6379 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
6380 | |
6381 | |
6382 | |
6383 | |
6384 //----- (004AE5F1) -------------------------------------------------------- | |
6385 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
6386 { | |
6387 BLVFace *v1; // esi@1 | |
6388 BLVFaceExtra *v2; // ebx@1 | |
6389 int v3; // eax@1 | |
6390 int v4; // edi@1 | |
6391 Texture *v5; // edi@1 | |
6392 int v6; // eax@1 | |
6393 unsigned int v7; // eax@1 | |
6394 unsigned int v8; // ecx@1 | |
6395 unsigned int v9; // eax@1 | |
6396 unsigned int v10; // ecx@5 | |
6397 int v11; // edi@10 | |
6398 int v12; // ecx@10 | |
6399 int v13; // eax@10 | |
6400 int v14; // edx@10 | |
6401 int v15; // ebx@12 | |
6402 double v16; // st7@16 | |
6403 int v17; // eax@16 | |
6404 char *v18; // ebx@17 | |
6405 int v19; // ecx@19 | |
6406 int v20; // eax@19 | |
6407 int v21; // edx@21 | |
6408 int v22; // eax@23 | |
6409 int v23; // ST04_4@26 | |
6410 int v24; // edi@26 | |
6411 double v25; // st6@26 | |
6412 int v26; // eax@26 | |
6413 double v27; // st6@26 | |
6414 int v28; // ecx@26 | |
6415 char v29; // al@26 | |
6416 int v30; // edx@28 | |
6417 int v31; // ecx@28 | |
6418 BLVLightMM7 *v32; // ecx@32 | |
6419 int v33; // edi@33 | |
6420 int v34; // edx@33 | |
6421 int v35; // eax@33 | |
6422 int v36; // edi@35 | |
6423 int v37; // edx@37 | |
6424 int v38; // ebx@39 | |
6425 int v39; // edi@42 | |
6426 int v40; // eax@42 | |
6427 char *v41; // ebx@45 | |
6428 signed int v42; // ecx@47 | |
6429 int v43; // edi@47 | |
6430 int v44; // eax@49 | |
6431 int v45; // edx@51 | |
6432 int v46; // eax@53 | |
6433 int v47; // ST04_4@55 | |
6434 int v48; // edi@55 | |
6435 double v49; // st6@55 | |
6436 int v50; // eax@55 | |
6437 double v51; // st6@55 | |
6438 int v52; // eax@55 | |
6439 int v53; // ecx@57 | |
6440 int v54; // ecx@58 | |
6441 int v55; // ecx@59 | |
6442 int v56; // edx@62 | |
6443 int v57; // ecx@62 | |
6444 int v58; // eax@63 | |
6445 int v59; // edx@64 | |
6446 int v60; // ecx@67 | |
6447 int v61; // edx@67 | |
6448 int v62; // eax@68 | |
6449 int v63; // edx@69 | |
6450 signed int v64; // ecx@72 | |
6451 double v65; // st7@75 | |
6452 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
6453 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
6454 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
6455 int v69; // [sp+28h] [bp-18h]@10 | |
6456 int v70; // [sp+2Ch] [bp-14h]@10 | |
6457 int X; // [sp+30h] [bp-10h]@10 | |
6458 int v72; // [sp+34h] [bp-Ch]@10 | |
6459 int v73; // [sp+38h] [bp-8h]@10 | |
6460 int v74; // [sp+3Ch] [bp-4h]@10 | |
6461 | |
6462 v1 = &pIndoor->pFaces[uFaceID]; | |
6463 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
6464 v3 = v1->uBitmapID; | |
6465 v4 = v1->uBitmapID; | |
6466 v68 = v2; | |
6467 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
6468 v6 = 8 * uFaceID; | |
6469 LOBYTE(v6) = 8 * uFaceID | 6; | |
6470 stru_F8AD28.field_0 = v6; | |
6471 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
6472 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
6473 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
6474 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
6475 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
6476 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
6477 v7 = GetTickCount(); | |
6478 v8 = v1->uAttributes; | |
6479 v9 = v7 >> 3; | |
6480 if ( v8 & 4 ) | |
6481 { | |
6482 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
6483 } | |
6484 else | |
6485 { | |
6486 if ( v8 & 0x20 ) | |
6487 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
6488 } | |
6489 v10 = v1->uAttributes; | |
6490 if ( BYTE1(v10) & 8 ) | |
6491 { | |
6492 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
6493 } | |
6494 else | |
6495 { | |
6496 if ( v10 & 0x40 ) | |
6497 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
6498 } | |
6499 v1->_get_normals(&v67, &v66); | |
6500 stru_F8AD28.vec_14.x = v67.x; | |
6501 stru_F8AD28.vec_14.y = v67.y; | |
6502 stru_F8AD28.vec_14.z = v67.z; | |
6503 stru_F8AD28.vec_20.x = v66.x; | |
6504 stru_F8AD28.vec_20.y = v66.y; | |
6505 stru_F8AD28.vec_20.z = v66.z; | |
6506 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
6507 if ( pBLVRenderParams->sPartyRotX ) | |
6508 { | |
6509 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6510 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
6511 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6512 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
6513 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6514 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6515 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6516 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6517 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6518 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6519 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6520 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6521 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
6522 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6523 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6524 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6525 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6526 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6527 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6528 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6529 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
6530 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6531 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
6532 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6533 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6534 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6535 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6536 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6537 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6538 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6539 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6540 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6541 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6542 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6543 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6544 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6545 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6546 v13 = pBLVRenderParams->vPartyPos.y; | |
6547 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6548 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6549 v14 = pBLVRenderParams->vPartyPos.x; | |
6550 } | |
6551 else | |
6552 { | |
6553 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6554 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6555 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6556 - v70; | |
6557 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6558 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6559 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6560 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6561 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6562 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6563 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6564 - v70; | |
6565 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6566 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6567 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6568 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6569 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6570 - v70; | |
6571 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6572 v14 = pBLVRenderParams->vPartyPos.x; | |
6573 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6574 v13 = pBLVRenderParams->vPartyPos.y; | |
6575 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6576 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6577 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6578 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6579 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6580 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6581 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6582 } | |
6583 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6584 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
6585 + stru_F8AD28.plane_4.dist | |
6586 + stru_F8AD28.plane_4.vNormal.y * v13 | |
6587 + stru_F8AD28.plane_4.vNormal.x * v14; | |
6588 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6589 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6590 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6591 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6592 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6593 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6594 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6595 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6596 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
6597 v15 = v70; | |
6598 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
6599 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6600 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
6601 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6602 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6603 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
6604 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
6605 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
6606 stru_F8AD28.field_38 = 0; | |
6607 stru_F8AD28.field_A8 = -(X | |
6608 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
6609 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
6610 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
6611 { | |
6612 stru_F8AD28.field_3E4 = 1; | |
6613 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
6614 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
6615 stru_F8AD28.field_3F0 = v68->field_1E; | |
6616 stru_F8AD28.field_3F4 = v68->field_20; | |
6617 } | |
6618 else | |
6619 { | |
6620 stru_F8AD28.field_3E4 = 0; | |
6621 } | |
6622 v16 = 0.0039215689; | |
6623 v17 = 116 * v1->uSectorID; | |
6624 v69 = v17; | |
6625 v74 = 0; | |
6626 v73 = 0; | |
6627 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
6628 v70 = pMobileLightsStack->uNumLightsActive; | |
6629 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
6630 { | |
6631 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
6632 do | |
6633 { | |
6634 if ( v74 >= 20 ) | |
6635 break; | |
6636 v19 = *((short *)v18 + 2); | |
6637 v20 = *((short *)v18 - 1); | |
6638 if ( v20 > v1->pBounding.x1 - v19 ) | |
6639 { | |
6640 if ( v20 < v19 + v1->pBounding.x2 ) | |
6641 { | |
6642 v21 = *(short *)v18; | |
6643 if ( v21 > v1->pBounding.y1 - v19 ) | |
6644 { | |
6645 if ( v21 < v19 + v1->pBounding.y2 ) | |
6646 { | |
6647 v22 = *((short *)v18 + 1); | |
6648 if ( v22 > v1->pBounding.z1 - v19 ) | |
6649 { | |
6650 if ( v22 < v19 + v1->pBounding.z2 ) | |
6651 { | |
6652 X = (v1->pFacePlane_old.dist | |
6653 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
6654 + v21 * v1->pFacePlane_old.vNormal.y | |
6655 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
6656 if ( X <= v19 ) | |
6657 { | |
6658 v23 = X; | |
6659 v24 = v74; | |
6660 stru_F8AD28._blv_lights_radii[v74] = v19; | |
6661 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
6662 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
6663 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
6664 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
6665 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
6666 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
6667 v25 = (double)(signed int)v68 * v16; | |
6668 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
6669 v26 = (unsigned __int8)v18[8]; | |
6670 *(float *)(v24 * 4 + 16297992) = v25; | |
6671 v27 = (double)(signed int)v68; | |
6672 v68 = (BLVFaceExtra *)v26; | |
6673 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
6674 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
6675 v16 = 0.0039215689; | |
6676 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
6677 v28 = v74; | |
6678 v29 = v18[9]; | |
6679 ++v74; | |
6680 stru_F8AD28._blv_lights_types[v28] = v29; | |
6681 } | |
6682 } | |
6683 } | |
6684 } | |
6685 } | |
6686 } | |
6687 } | |
6688 ++v73; | |
6689 v18 += 18; | |
6690 v17 = v69; | |
6691 } | |
6692 while ( v73 < v70 ); | |
6693 } | |
6694 v30 = 0; | |
6695 v73 = 0; | |
6696 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
6697 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
6698 if ( v31 > 0 ) | |
6699 { | |
6700 while ( v74 < 20 ) | |
6701 { | |
6702 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
6703 if ( !(v32->uAtributes & 8) ) | |
6704 { | |
6705 v33 = v1->pBounding.x1; | |
6706 v34 = v32->vPosition.x; | |
6707 X = v32->uBrightness; | |
6708 v35 = v32->uRadius; | |
6709 v68 = (BLVFaceExtra *)v32->uRadius; | |
6710 if ( v34 > v33 - v35 ) | |
6711 { | |
6712 if ( v34 < v35 + v1->pBounding.x2 ) | |
6713 { | |
6714 v36 = v32->vPosition.y; | |
6715 if ( v36 > v1->pBounding.y1 - v35 ) | |
6716 { | |
6717 if ( v36 < v35 + v1->pBounding.y2 ) | |
6718 { | |
6719 v37 = v32->vPosition.z; | |
6720 if ( v37 > v1->pBounding.z1 - v35 ) | |
6721 { | |
6722 if ( v37 < v35 + v1->pBounding.z2 ) | |
6723 { | |
6724 v38 = (v1->pFacePlane_old.dist | |
6725 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
6726 + v37 * v1->pFacePlane_old.vNormal.z | |
6727 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
6728 if ( v38 >= 0 ) | |
6729 { | |
6730 if ( v38 <= v35 && v35 ) | |
6731 { | |
6732 v39 = v74; | |
6733 stru_F8AD28._blv_lights_radii[v74] = v35; | |
6734 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
6735 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
6736 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
6737 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
6738 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
6739 v68 = (BLVFaceExtra *)v32->uRed; | |
6740 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
6741 v68 = (BLVFaceExtra *)v32->uGreen; | |
6742 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
6743 v68 = (BLVFaceExtra *)v32->uBlue; | |
6744 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
6745 v16 = 0.0039215689; | |
6746 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
6747 v40 = v74++; | |
6748 stru_F8AD28._blv_lights_types[v40] = 1; | |
6749 } | |
6750 } | |
6751 } | |
6752 } | |
6753 } | |
6754 } | |
6755 } | |
6756 } | |
6757 } | |
6758 v30 = v73++ + 1; | |
6759 if ( v73 >= v70 ) | |
6760 break; | |
6761 v17 = v69; | |
6762 } | |
6763 } | |
6764 v73 = 0; | |
6765 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
6766 { | |
6767 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
6768 do | |
6769 { | |
6770 if ( v74 >= 20 ) | |
6771 break; | |
6772 v42 = *((short *)v41 + 2); | |
6773 v43 = *((short *)v41 - 1); | |
6774 if ( v43 > v1->pBounding.x1 - v42 ) | |
6775 { | |
6776 if ( v43 < v42 + v1->pBounding.x2 ) | |
6777 { | |
6778 v44 = *(short *)v41; | |
6779 if ( v44 > v1->pBounding.y1 - v42 ) | |
6780 { | |
6781 if ( v44 < v42 + v1->pBounding.y2 ) | |
6782 { | |
6783 v45 = *((short *)v41 + 1); | |
6784 if ( v45 > v1->pBounding.z1 - v42 ) | |
6785 { | |
6786 if ( v45 < v42 + v1->pBounding.z2 ) | |
6787 { | |
6788 v46 = (v1->pFacePlane_old.dist | |
6789 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
6790 + v43 * v1->pFacePlane_old.vNormal.x | |
6791 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
6792 v69 = v46; | |
6793 if ( v46 >= 0 ) | |
6794 { | |
6795 if ( v46 <= v42 ) | |
6796 { | |
6797 v47 = v69; | |
6798 v48 = v74; | |
6799 stru_F8AD28._blv_lights_radii[v74] = v42; | |
6800 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
6801 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
6802 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
6803 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
6804 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
6805 v49 = (double)(signed int)v68 * v16; | |
6806 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
6807 v50 = (unsigned __int8)v41[8]; | |
6808 stru_F8AD28._blv_lights_rs[v48] = v49; | |
6809 v51 = (double)(signed int)v68; | |
6810 v68 = (BLVFaceExtra *)v50; | |
6811 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
6812 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
6813 v16 = 0.0039215689; | |
6814 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
6815 v52 = v74++; | |
6816 stru_F8AD28._blv_lights_types[v52] = 1; | |
6817 } | |
6818 } | |
6819 } | |
6820 } | |
6821 } | |
6822 } | |
6823 } | |
6824 } | |
6825 ++v73; | |
6826 v41 += 12; | |
6827 } | |
6828 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
6829 } | |
6830 stru_F8AD28.uNumLightsApplied = v74; | |
6831 v53 = v1->pBounding.x2; | |
6832 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
6833 { | |
6834 v55 = v1->pBounding.x1; | |
6835 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
6836 v54 = 0; | |
6837 else | |
6838 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
6839 } | |
6840 else | |
6841 { | |
6842 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
6843 } | |
6844 v56 = v1->pBounding.y2; | |
6845 v57 = v54 * v54; | |
6846 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
6847 { | |
6848 v59 = v1->pBounding.y1; | |
6849 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
6850 v58 = 0; | |
6851 else | |
6852 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
6853 } | |
6854 else | |
6855 { | |
6856 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
6857 } | |
6858 v60 = v58 * v58 + v57; | |
6859 v61 = v1->pBounding.z2; | |
6860 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
6861 { | |
6862 v63 = v1->pBounding.z1; | |
6863 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
6864 v62 = 0; | |
6865 else | |
6866 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
6867 } | |
6868 else | |
6869 { | |
6870 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
6871 } | |
6872 v64 = v62 * v62 + v60; | |
6873 if ( v64 ) | |
295 | 6874 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 6875 else |
6876 stru_F8AD28.field_34 = 0; | |
6877 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
6878 v65 = (double)(signed int)v68; | |
6879 if ( v65 >= 655.36 ) | |
6880 { | |
6881 if ( v65 >= 26214.4 ) | |
6882 { | |
6883 if ( v65 >= 45875.2 ) | |
6884 { | |
6885 stru_F8AD28.field_44 = 8; | |
6886 stru_F8AD28.field_48 = 3; | |
6887 } | |
6888 else | |
6889 { | |
6890 stru_F8AD28.field_44 = 16; | |
6891 stru_F8AD28.field_48 = 4; | |
6892 } | |
6893 } | |
6894 else | |
6895 { | |
6896 stru_F8AD28.field_44 = 32; | |
6897 stru_F8AD28.field_48 = 5; | |
6898 } | |
6899 } | |
6900 else | |
6901 { | |
6902 stru_F8AD28.field_44 = 64; | |
6903 stru_F8AD28.field_48 = 6; | |
6904 } | |
6905 } | |
6906 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
6907 | |
6908 //----- (004AF412) -------------------------------------------------------- | |
6909 int __cdecl sub_4AF412() | |
6910 { | |
6911 int v0; // ST20_4@2 | |
6912 int v1; // ST20_4@2 | |
6913 int v2; // ST20_4@2 | |
6914 int v3; // esi@2 | |
6915 int v4; // ST20_4@2 | |
6916 int v5; // ecx@2 | |
6917 int v6; // ebx@2 | |
6918 int v7; // edi@2 | |
6919 int v8; // edx@2 | |
6920 int v9; // eax@2 | |
6921 int result; // eax@4 | |
6922 | |
6923 stru_F8AD28.plane_4.vNormal.z = -65536; | |
6924 stru_F8AD28.vec_20.y = -65536; | |
6925 stru_F8AD28.plane_4.vNormal.x = 0; | |
6926 stru_F8AD28.plane_4.vNormal.y = 0; | |
6927 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
6928 stru_F8AD28.vec_14.x = 65536; | |
6929 stru_F8AD28.vec_14.y = 0; | |
6930 stru_F8AD28.vec_14.z = 0; | |
6931 stru_F8AD28.vec_20.x = 0; | |
6932 stru_F8AD28.vec_20.z = 0; | |
6933 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
6934 if ( pBLVRenderParams->sPartyRotX ) | |
6935 { | |
6936 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6937 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6938 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6939 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6940 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6941 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6942 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6943 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6944 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6945 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6946 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6947 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6948 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6949 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6950 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6951 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6952 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6953 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6954 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6955 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6956 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6957 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6958 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6959 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6960 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6961 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6962 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6963 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6964 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6965 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6966 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6967 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6968 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6969 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6970 v6 = pBLVRenderParams->vPartyPos.z; | |
6971 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6972 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6973 v8 = pBLVRenderParams->vPartyPos.y; | |
6974 v9 = pBLVRenderParams->vPartyPos.x; | |
6975 } | |
6976 else | |
6977 { | |
6978 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6979 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6980 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6981 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6982 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6983 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6984 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6985 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6986 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6987 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6988 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6989 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6990 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6991 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6992 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6993 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6994 v8 = pBLVRenderParams->vPartyPos.y; | |
6995 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6996 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6997 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6998 v9 = pBLVRenderParams->vPartyPos.x; | |
6999 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
7000 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
7001 v6 = pBLVRenderParams->vPartyPos.z; | |
7002 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
7003 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
7004 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
7005 } | |
7006 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
7007 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
7008 + stru_F8AD28.plane_4.dist | |
7009 + stru_F8AD28.plane_4.vNormal.x * v9 | |
7010 + stru_F8AD28.plane_4.vNormal.z * v6; | |
7011 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
7012 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
7013 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
7014 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
7015 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
7016 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
7017 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
7018 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
7019 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
7020 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
7021 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
7022 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
7023 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
7024 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
7025 result = 0; | |
7026 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
7027 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
7028 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
7029 stru_F8AD28.field_38 = 0; | |
7030 stru_F8AD28.field_3E4 = 0; | |
7031 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
7032 stru_F8AD28.uNumLightsApplied = 0; | |
7033 stru_F8AD28.field_34 = 0; | |
7034 return result; | |
7035 } | |
7036 | |
7037 | |
7038 | |
7039 | |
7040 | |
7041 | |
7042 //----- (004B1447) -------------------------------------------------------- | |
7043 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
7044 { | |
7045 signed int v3; // esi@1 | |
7046 char v4; // sf@8 | |
7047 int v5; // eax@8 | |
7048 unsigned __int64 v6; // qax@12 | |
7049 DDM_DLV_Header *v7; // eax@14 | |
7050 Player **v8; // edi@18 | |
7051 Player *result; // eax@19 | |
735 | 7052 //char *v10; // esi@20 |
0 | 7053 |
7054 v3 = 0; | |
7055 if ( a2 ) | |
7056 { | |
7057 if ( a2 != 1 ) | |
7058 { | |
7059 if ( a2 == 2 ) | |
7060 v3 = 2; | |
7061 goto LABEL_13; | |
7062 } | |
7063 v3 = 2; | |
7064 } | |
7065 else | |
7066 { | |
7067 v3 = 1; | |
7068 } | |
7069 if ( pParty->uFine < 4000000 ) | |
7070 { | |
7071 v4 = a3 + pParty->uFine < 0; | |
7072 v5 = a3 + pParty->uFine; | |
7073 pParty->uFine += a3; | |
7074 if ( v4 ) | |
7075 { | |
7076 v5 = 0; | |
7077 pParty->uFine = 0; | |
7078 } | |
7079 if ( v5 > 4000000 ) | |
7080 pParty->uFine = 4000000; | |
7081 } | |
487 | 7082 |
7083 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
7084 | |
0 | 7085 LABEL_13: |
463 | 7086 pParty->InTheShopFlags[a1] = 1; |
0 | 7087 if ( v3 ) |
7088 { | |
7089 v7 = &pOutdoor->ddm; | |
7090 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7091 v7 = &pIndoor->dlv; | |
7092 v7->uReputation += v3; | |
7093 if ( v7->uReputation > 10000 ) | |
7094 v7->uReputation = 10000; | |
7095 } | |
7096 v8 = &pPlayers[1]; | |
7097 do | |
7098 { | |
7099 result = *v8; | |
7100 if ( pParty->uFine ) | |
7101 { | |
735 | 7102 //v10 = result->_guilds_member_bits; |
484 | 7103 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 7104 if ( !(short)result ) |
735 | 7105 __debugbreak(); |
501 | 7106 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 7107 } |
7108 ++v8; | |
7109 } | |
7110 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
7111 return result; | |
7112 } | |
7113 | |
7114 //----- (004B1523) -------------------------------------------------------- | |
7115 char *__thiscall sub_4B1523(int *_this) | |
7116 { | |
7117 int v1; // esi@1 | |
7118 int v2; // edx@1 | |
7119 unsigned int v3; // eax@2 | |
7120 int v4; // eax@4 | |
7121 LONG v5; // ecx@4 | |
7122 int v6; // eax@10 | |
7123 char *v7; // ST44_4@12 | |
7124 unsigned __int16 v8; // ax@12 | |
7125 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
7126 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
7127 POINT a2; // [sp+64h] [bp-10h]@1 | |
7128 int v13; // [sp+6Ch] [bp-8h]@4 | |
7129 int v14; // [sp+70h] [bp-4h]@4 | |
7130 | |
7131 v1 = *_this - 399; | |
7132 v2 = (*_this - 400) % 11 + 1; | |
7133 v11 = 4 * (*_this - 400) / 11; | |
7134 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
7135 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
7136 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
7137 else | |
7138 v3 = 30; | |
7139 a1.Hint = 0; | |
7140 a1.uFrameY = v3; | |
7141 a1.uFrameWidth = 328; | |
7142 a1.uFrameHeight = 68; | |
7143 a1.uFrameX = 90; | |
7144 a1.uFrameZ = 417; | |
7145 a1.uFrameW = v3 + 67; | |
7146 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
7147 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
7148 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
7149 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
7150 v5 = a2.y; | |
7151 if ( v14 > a2.y ) | |
7152 v5 = v14; | |
7153 if ( v13 > v5 ) | |
7154 v5 = v13; | |
7155 if ( v4 > v5 ) | |
7156 v5 = v4; | |
262 | 7157 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", |
7158 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
7159 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
7160 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
7161 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
7162 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 7163 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
7164 a1.uFrameHeight += v6; | |
7165 if ( (signed int)a1.uFrameHeight < 150 ) | |
7166 a1.uFrameHeight = 150; | |
7167 a1.uFrameWidth = 460; | |
7168 a1.DrawMessageBox(0); | |
7169 a1.uFrameWidth -= 12; | |
7170 a1.uFrameHeight -= 12; | |
7171 v7 = pSpellStats->pInfos[v1].pName; | |
7172 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
7173 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
7174 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7175 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
7176 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
7177 a1.uFrameZ = a1.uFrameX + 107; | |
7178 a1.uFrameWidth = 108; | |
7179 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
7180 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
262 | 7181 return a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 7182 } |
7183 | |
7184 | |
7185 //----- (004B1784) -------------------------------------------------------- | |
7186 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
7187 { | |
7188 Player *pPlayer; // ebx@1 | |
7189 bool result; // eax@2 | |
7190 unsigned __int16 v2; // ST0C_2@3 | |
7191 int v3; // eax@3 | |
7192 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
7193 | |
7194 pPlayer = pPlayers[uActiveCharacter]; | |
7195 if ( pPlayer->CanAct() ) | |
7196 { | |
7197 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
7198 result = 1; | |
7199 } | |
7200 else | |
7201 { | |
7202 pDialogueWindow->pNumPresenceButton = 0; | |
7203 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
7204 v4.uFrameX = 483; | |
7205 v4.uFrameWidth = 148; | |
7206 v4.uFrameZ = 334; | |
7207 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
7208 // "%s is in no condition to %s" | |
7209 // "do anything" | |
7210 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7211 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); | |
7212 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
7213 result = 0; | |
7214 } | |
7215 return result; | |
7216 } | |
7217 // F8B1E0: using guessed type int dword_F8B1E0; | |
7218 | |
7219 | |
463 | 7220 //view item details in shop? |
0 | 7221 //----- (004B1A2D) -------------------------------------------------------- |
7222 void __cdecl sub_4B1A2D() | |
7223 { | |
358 | 7224 //Player *v0; // edi@1 |
0 | 7225 POINT *v1; // esi@5 |
7226 unsigned int v2; // eax@5 | |
7227 int v3; // ecx@5 | |
7228 POINT *v4; // esi@12 | |
7229 int v5; // eax@12 | |
7230 unsigned int v6; // eax@13 | |
7231 ItemGen *v7; // ecx@13 | |
7232 signed int v8; // esi@17 | |
7233 unsigned int v9; // eax@19 | |
475 | 7234 POINT v10; // [sp+8h] [bp-44h]@12 |
7235 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
7236 POINT v12; // [sp+18h] [bp-34h]@18 | |
7237 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
7238 POINT v14; // [sp+28h] [bp-24h]@17 | |
7239 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
7240 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 7241 POINT a2; // [sp+40h] [bp-Ch]@5 |
7242 int v18; // [sp+48h] [bp-4h]@5 | |
7243 | |
358 | 7244 //v0 = pPlayers[uActiveCharacter]; |
484 | 7245 if ( in_current_building_type <= 0 ) |
0 | 7246 return; |
484 | 7247 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 7248 { |
607 | 7249 if ( dialog_menu_id != 2 ) |
7250 { | |
7251 if ( dialog_menu_id <= 2 ) | |
0 | 7252 return; |
607 | 7253 if ( dialog_menu_id <= 5 || dialog_menu_id == 94 ) |
0 | 7254 { |
475 | 7255 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
7256 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
7257 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
7258 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 7259 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 7260 return; |
358 | 7261 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 7262 LABEL_15: |
7263 GameUI_DrawItemInfo(v7); | |
7264 return; | |
7265 } | |
607 | 7266 if ( dialog_menu_id != 95 ) |
0 | 7267 return; |
7268 } | |
475 | 7269 v4 = pMouse->GetCursorPos(&v11); |
7270 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 7271 v18 = v5; |
7272 if ( !v5 ) | |
7273 return; | |
336 | 7274 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 7275 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
607 | 7276 if ( dialog_menu_id != 2 ) |
439 | 7277 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 7278 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 7279 goto LABEL_15; |
7280 } | |
607 | 7281 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == BildingType_18 ) |
0 | 7282 { |
7283 v1 = pMouse->GetCursorPos(&a2); | |
475 | 7284 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 7285 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
7286 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
7287 if ( v18 ) | |
336 | 7288 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 7289 } |
7290 } | |
7291 // F8B198: using guessed type int dword_F8B198; | |
7292 // F8B19C: using guessed type int dword_F8B19C; | |
7293 | |
7294 //----- (004B1BDB) -------------------------------------------------------- | |
7295 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
7296 { | |
7297 signed __int64 v1; // ST2C_8@1 | |
7298 signed __int64 v2; // qax@1 | |
7299 signed __int64 v3; // ST1C_8@1 | |
7300 unsigned __int64 v4; // qax@1 | |
7301 unsigned int v5; // ebx@1 | |
112 | 7302 Player *v6; // ebx@1 |
0 | 7303 |
7304 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
7305 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
7306 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
7307 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
7308 v2 = v1 / 60 / 60; | |
7309 v3 = v2; | |
7310 v4 = (unsigned int)v2 / 0x18; | |
7311 v5 = (unsigned int)(v4 / 7) >> 2; | |
7312 pParty->uCurrentTimeSecond = v1 % 60; | |
7313 pParty->uCurrentMinute = v1 / 60 % 60; | |
7314 pParty->uCurrentHour = v3 % 24; | |
7315 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
7316 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
7317 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 7318 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 7319 pParty->RestAndHeal(); |
7320 dword_507B94 = 1; | |
112 | 7321 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 7322 do |
7323 { | |
112 | 7324 v6->uTimeToRecovery = 0; |
7325 memset(&v6->uTimeToRecovery, 0, 4u); | |
7326 ++v6; | |
7327 } | |
7328 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 7329 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 7330 } |
7331 // 507B94: using guessed type int dword_507B94; | |
7332 | |
7333 //----- (004B1D27) -------------------------------------------------------- | |
7334 void __cdecl sub_4B1D27() | |
7335 { | |
7336 int v0; // edx@2 | |
7337 unsigned int v1; // ecx@7 | |
7338 signed int v2; // edi@10 | |
7339 int v3; // esi@10 | |
7340 __int16 v4; // ax@15 | |
7341 signed int v5; // edi@20 | |
7342 int v6; // esi@20 | |
7343 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
7344 | |
484 | 7345 if ( in_current_building_type > 0 ) |
0 | 7346 { |
7347 v0 = 3; | |
484 | 7348 if ( in_current_building_type > BildingType_MagicShop ) |
7349 { | |
7350 if ( in_current_building_type == BildingType_Bank ) | |
0 | 7351 { |
7352 if ( !dword_F8B1E4 ) | |
7353 return; | |
7354 } | |
7355 else | |
7356 { | |
484 | 7357 if ( in_current_building_type != BildingType_Temple ) |
0 | 7358 return; |
7359 } | |
336 | 7360 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 7361 LABEL_28: |
735 | 7362 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 7363 return; |
7364 } | |
336 | 7365 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 7366 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 7367 { |
7368 if ( pParty->uNumGold <= 0x2710 ) | |
7369 { | |
7370 if ( !dword_F8B1E4 ) | |
7371 return; | |
7372 v0 = 4; | |
7373 goto LABEL_28; | |
7374 } | |
735 | 7375 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 7376 if ( !dword_F8B1E4 && !qword_A750D8 ) |
7377 { | |
7378 v5 = 0; | |
7379 v6 = 1; | |
7380 do | |
7381 { | |
7382 if ( pPlayers[v6]->CanAct() ) | |
7383 v7[v5++] = v6; | |
7384 ++v6; | |
7385 } | |
7386 while ( v6 <= 4 ); | |
7387 if ( v5 ) | |
7388 { | |
7389 qword_A750D8 = 256i64; | |
7390 word_A750E0 = 80; | |
7391 v4 = LOWORD(v7[rand() % v5]); | |
7392 goto LABEL_16; | |
7393 } | |
7394 } | |
7395 } | |
7396 else | |
7397 { | |
7398 if ( !qword_A750D8 ) | |
7399 { | |
7400 v2 = 0; | |
7401 v3 = 1; | |
7402 do | |
7403 { | |
7404 if ( pPlayers[v3]->CanAct() ) | |
7405 v7[v2++] = v3; | |
7406 ++v3; | |
7407 } | |
7408 while ( v3 <= 4 ); | |
7409 if ( v2 ) | |
7410 { | |
7411 qword_A750D8 = 256i64; | |
7412 word_A750E0 = 80; | |
7413 v4 = LOWORD(v7[rand() % v2]); | |
7414 LABEL_16: | |
7415 word_A750E2 = v4; | |
7416 return; | |
7417 } | |
7418 } | |
7419 } | |
7420 } | |
7421 } | |
7422 | |
629 | 7423 |
0 | 7424 |
7425 //----- (004B1ECE) -------------------------------------------------------- | |
7426 void __cdecl sub_4B1ECE() | |
7427 { | |
7428 __int16 *v0; // edi@1 | |
7429 int v1; // ebx@3 | |
7430 Player *v2; // esi@3 | |
7431 int v3; // eax@4 | |
7432 signed int v4; // eax@9 | |
7433 int v5; // ebx@11 | |
89 | 7434 Player *v6; // esi@13 |
7435 ItemGen *v7; // eax@14 | |
0 | 7436 signed int v8; // edi@14 |
89 | 7437 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 7438 signed int v10; // [sp+10h] [bp-8h]@13 |
7439 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 7440 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 7441 |
484 | 7442 contract_approved = 0; |
0 | 7443 v11 = 0; |
7444 uDialogueType = 84; | |
7445 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
7446 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; | |
7447 while ( 1 ) | |
7448 { | |
484 | 7449 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 7450 { |
7451 v1 = 0; | |
7452 v2 = pParty->pPlayers; | |
7453 do | |
7454 { | |
89 | 7455 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 7456 if ( v3 ) |
7457 break; | |
7458 ++v2; | |
7459 ++v1; | |
7460 } | |
7461 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
7462 if ( v1 == 4 ) | |
7463 break; | |
7464 } | |
7465 ++v11; | |
7466 v0 += 2; | |
89 | 7467 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
7468 break; | |
7469 } | |
7470 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
7471 { | |
651 | 7472 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 7473 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 7474 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 7475 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
7476 } | |
484 | 7477 if ( contract_approved == 601 ) |
0 | 7478 { |
7479 v5 = 0; | |
89 | 7480 v12 = pParty->pPlayers;//[0].uClass; |
0 | 7481 v9 = 0; |
7482 while ( 1 ) | |
7483 { | |
135 | 7484 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 7485 { |
7486 v10 = 0; | |
89 | 7487 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 7488 do |
7489 { | |
89 | 7490 v7 = v6->pInventoryItems; |
0 | 7491 v8 = 138; |
7492 do | |
7493 { | |
89 | 7494 if ( v7->uItemID == 601 ) |
0 | 7495 { |
377 | 7496 if ( !v7->uHolderPlayer ) |
89 | 7497 v9 = v7; |
377 | 7498 if ( v7->uHolderPlayer == v5 ) |
0 | 7499 v10 = 1; |
7500 } | |
89 | 7501 ++v7; |
0 | 7502 --v8; |
7503 } | |
7504 while ( v8 ); | |
89 | 7505 ++v6; |
7506 } | |
7507 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 7508 if ( !v10 ) |
7509 break; | |
7510 } | |
89 | 7511 ++v12; |
0 | 7512 ++v5; |
89 | 7513 if ( v12 > &pParty->pPlayers[3] ) |
0 | 7514 return; |
7515 } | |
7516 if ( v9 ) | |
377 | 7517 v9->uHolderPlayer = v5; |
0 | 7518 } |
7519 } | |
503 | 7520 |
0 | 7521 // 4F08EC: using guessed type int dword_4F08EC[]; |
7522 // 722B3C: using guessed type int dword_722B3C; | |
7523 // 722B44: using guessed type int dword_722B44; | |
7524 // F8B1A8: using guessed type int dword_F8B1A8; | |
7525 | |
7526 //----- (004B2001) -------------------------------------------------------- | |
459 | 7527 void __fastcall ClickNPCTopic(signed int uMessageParam) |
7528 { | |
7529 //signed int v1; // eax@1 | |
7530 NPCData *pCurrentNPCInfo; // ebp@1 | |
7531 int pEventNumber; // ecx@8 | |
0 | 7532 Player *v4; // esi@20 |
467 | 7533 //int v5; // eax@28 |
7534 //int v6; // eax@31 | |
7535 //int v7; // eax@34 | |
7536 //int v8; // eax@37 | |
7537 //int v9; // eax@40 | |
7538 //unsigned int v10; // eax@43 | |
0 | 7539 char *v12; // eax@53 |
7540 char *v13; // eax@56 | |
7541 char *v14; // eax@57 | |
7542 char *v15; // eax@58 | |
467 | 7543 //unsigned int v16; // ebp@62 |
0 | 7544 char *v17; // ecx@63 |
7545 char *v18; // eax@65 | |
7546 const char *v19; // ecx@68 | |
248 | 7547 //unsigned int v20; // eax@69 |
467 | 7548 signed int pPrice; // ecx@70 |
0 | 7549 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 7550 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 7551 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 7552 //int v25; // [sp-4h] [bp-10h]@49 |
7553 | |
459 | 7554 uDialogueType = uMessageParam + 1; |
7555 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 7556 if ( uMessageParam <= 24 ) |
460 | 7557 { |
459 | 7558 switch ( uMessageParam ) |
7559 { | |
7560 case 13: | |
7561 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
7562 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 7563 NPCHireableDialogPrepare(); |
459 | 7564 dialogue_show_profession_details = false; |
7565 goto _return; | |
7566 case 19: | |
7567 pEventNumber = pCurrentNPCInfo->evt_A; | |
7568 break; | |
7569 case 20: | |
7570 pEventNumber = pCurrentNPCInfo->evt_B; | |
7571 break; | |
7572 case 21: | |
7573 pEventNumber = pCurrentNPCInfo->evt_C; | |
7574 break; | |
7575 case 22: | |
7576 pEventNumber = pCurrentNPCInfo->evt_D; | |
7577 break; | |
7578 case 23: | |
7579 pEventNumber = pCurrentNPCInfo->evt_E; | |
7580 break; | |
7581 case 24: | |
7582 pEventNumber = pCurrentNPCInfo->evt_F; | |
7583 break; | |
7584 default: | |
467 | 7585 goto _return; |
7586 } | |
7587 /*switch ( pEventNumber ) | |
7588 { | |
7589 case 139: | |
7590 sub_4B1ECE(); | |
7591 goto _return; | |
7592 case 311: | |
7593 sub_4BBA85_bounties(); | |
7594 goto _return; | |
7595 }*/ | |
459 | 7596 if ( pEventNumber < 200 || pEventNumber > 310 ) |
7597 { | |
7598 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
7599 { | |
7600 if ( pEventNumber == 139 ) | |
0 | 7601 { |
7602 sub_4B1ECE(); | |
7603 } | |
7604 else | |
7605 { | |
459 | 7606 if ( pEventNumber == 311 ) |
0 | 7607 { |
7608 sub_4BBA85_bounties(); | |
7609 } | |
7610 else | |
7611 { | |
7612 ptr_F8B1E8 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7613 activeLevelDecoration = (LevelDecoration*)1; |
459 | 7614 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7615 activeLevelDecoration = NULL; |
0 | 7616 } |
7617 } | |
7618 } | |
7619 else | |
7620 { | |
459 | 7621 dword_F8B1D8 = uMessageParam; |
7622 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 7623 } |
7624 } | |
7625 else | |
7626 { | |
459 | 7627 sub_4B3FE5(pEventNumber); |
0 | 7628 } |
7629 goto _return; | |
460 | 7630 } |
459 | 7631 if ( uMessageParam != 76 ) |
7632 { | |
7633 if ( uMessageParam == 77 ) | |
7634 { | |
467 | 7635 //v16 = pCurrentNPCInfo->uProfession; |
248 | 7636 if (dialogue_show_profession_details) |
459 | 7637 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 7638 else |
459 | 7639 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
0 | 7640 ptr_F8B1E8 = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
7641 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 7642 dialogue_show_profession_details = ~dialogue_show_profession_details; |
0 | 7643 ptr_F8B1E8 = v18; |
7644 } | |
7645 else | |
7646 { | |
459 | 7647 if ( uMessageParam == 79 ) |
0 | 7648 { |
484 | 7649 if ( contract_approved ) |
0 | 7650 { |
267 | 7651 Party::TakeGold(gold_transaction_amount); |
0 | 7652 if ( uActiveCharacter ) |
7653 { | |
492 | 7654 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7655 *(short *)v12 &= 0x3Fu; |
7656 switch ( dword_F8B1B0 ) | |
7657 { | |
7658 case 2: | |
492 | 7659 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7660 *v15 |= 0x40u; |
7661 break; | |
7662 case 3: | |
492 | 7663 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7664 *v14 |= 0x80u; |
7665 break; | |
7666 case 4: | |
492 | 7667 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7668 v13[1] |= 1u; |
7669 break; | |
7670 } | |
187 | 7671 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 7672 } |
437 | 7673 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
7674 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7675 { |
7676 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7677 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7678 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7679 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7680 }*/ |
0 | 7681 } |
7682 } | |
7683 else | |
7684 { | |
492 | 7685 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 7686 { |
267 | 7687 Party::TakeGold(gold_transaction_amount); |
0 | 7688 v4 = pParty->pPlayers; |
7689 do | |
7690 { | |
492 | 7691 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 7692 ++v4; |
7693 } | |
7694 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
7695 switch ( dword_F8B1D8 ) | |
7696 { | |
7697 case 19: | |
467 | 7698 pEventNumber = pCurrentNPCInfo->evt_A; |
7699 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7700 pCurrentNPCInfo->evt_A = 0; |
0 | 7701 break; |
7702 case 20: | |
467 | 7703 pEventNumber = pCurrentNPCInfo->evt_B; |
7704 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7705 pCurrentNPCInfo->evt_B = 0; |
0 | 7706 break; |
7707 case 21: | |
467 | 7708 pEventNumber = pCurrentNPCInfo->evt_C; |
7709 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7710 pCurrentNPCInfo->evt_C = 0; |
0 | 7711 break; |
7712 case 22: | |
467 | 7713 pEventNumber = pCurrentNPCInfo->evt_D; |
7714 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7715 pCurrentNPCInfo->evt_D = 0; |
0 | 7716 break; |
7717 case 23: | |
467 | 7718 pEventNumber = pCurrentNPCInfo->evt_E; |
7719 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7720 pCurrentNPCInfo->evt_E = 0; |
0 | 7721 break; |
7722 case 24: | |
467 | 7723 pEventNumber = pCurrentNPCInfo->evt_F; |
7724 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
7725 pCurrentNPCInfo->evt_F = 0; | |
0 | 7726 break; |
7727 } | |
437 | 7728 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
7729 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7730 { |
7731 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7732 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7733 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7734 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7735 }*/ |
467 | 7736 //v11 = uActiveCharacter; |
0 | 7737 if ( uActiveCharacter ) |
7738 { | |
467 | 7739 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 7740 goto _return; |
7741 } | |
7742 } | |
7743 } | |
7744 } | |
7745 goto _return; | |
7746 } | |
7747 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7748 { | |
467 | 7749 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 7750 goto _return; |
7751 } | |
459 | 7752 if ( pCurrentNPCInfo->uProfession != 51 ) |
7753 { | |
467 | 7754 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
7755 if ( pParty->uNumGold < pPrice ) | |
7756 { | |
7757 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 7758 dialogue_show_profession_details = false; |
0 | 7759 uDialogueType = 13; |
459 | 7760 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
7761 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); |
0 | 7762 if ( uActiveCharacter ) |
248 | 7763 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 7764 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
7765 goto _return; | |
7766 } | |
7767 Party::TakeGold(pPrice); | |
0 | 7768 } |
147 | 7769 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 7770 pCurrentNPCInfo->uFlags |= 128; |
0 | 7771 pParty->field_709 = 0; |
659 | 7772 Party__CountHirelings(); |
0 | 7773 if ( pParty->pHirelings[0].pName ) |
7774 { | |
459 | 7775 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
7776 v24 = pCurrentNPCInfo->pName; | |
0 | 7777 v22 = pParty->pHireling2Name; |
7778 } | |
7779 else | |
7780 { | |
459 | 7781 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
7782 v24 = pCurrentNPCInfo->pName; | |
0 | 7783 v22 = pParty->pHireling1Name; |
7784 } | |
7785 strcpy(v22, v24); | |
7786 pParty->field_709 = 0; | |
659 | 7787 Party__CountHirelings(); |
480 | 7788 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
607 | 7789 dialog_menu_id = 1; |
437 | 7790 |
7791 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7792 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7793 { |
7794 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7795 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7796 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7797 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7798 }*/ |
0 | 7799 if ( uActiveCharacter ) |
467 | 7800 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 7801 _return: |
460 | 7802 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 7803 } |
7804 | |
7805 | |
7806 //----- (004B254D) -------------------------------------------------------- | |
7807 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
7808 { | |
7809 Player *v1; // esi@1 | |
7810 int v2; // edx@1 | |
7811 int v3; // ecx@1 | |
7812 int v4; // edi@1 | |
7813 int v5; // eax@7 | |
7814 int v6; // eax@7 | |
7815 int v7; // ebx@7 | |
7816 int v8; // ebx@8 | |
7817 signed int v9; // esi@8 | |
7818 int v10; // eax@8 | |
7819 char *v11; // ecx@8 | |
7820 int v12; // edi@9 | |
7821 char *v13; // edx@9 | |
7822 signed int v14; // edi@10 | |
7823 unsigned int v16; // eax@29 | |
7824 int v17; // eax@36 | |
7825 char v18; // cl@46 | |
7826 __int16 v19; // dx@56 | |
7827 int v20; // eax@60 | |
7828 char *v21; // [sp-Ch] [bp-38h]@82 | |
7829 const char *v22; // [sp-8h] [bp-34h]@21 | |
7830 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
7831 char *v24; // [sp-8h] [bp-34h]@82 | |
7832 char *v25; // [sp-4h] [bp-30h]@14 | |
7833 int v26; // [sp-4h] [bp-30h]@38 | |
7834 int v27; // [sp-4h] [bp-30h]@82 | |
7835 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
7836 int v29; // [sp+10h] [bp-1Ch]@13 | |
7837 int v30; // [sp+14h] [bp-18h]@15 | |
7838 int v31; // [sp+18h] [bp-14h]@16 | |
7839 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
7840 int v33; // [sp+20h] [bp-Ch]@7 | |
7841 int v34; // [sp+24h] [bp-8h]@7 | |
7842 char *v35; // [sp+28h] [bp-4h]@1 | |
7843 | |
7844 v1 = pPlayers[uActiveCharacter]; | |
484 | 7845 contract_approved = 0; |
0 | 7846 v2 = (_this - 200) % 3; |
7847 v3 = (_this - 200) / 3; | |
7848 v4 = v2; | |
7849 v35 = (char *)pNPCTopics[127].pText; | |
492 | 7850 dword_F8B1AC_award_bit_number = v3; |
0 | 7851 if ( v2 ) |
7852 { | |
7853 if ( v2 == 1 ) | |
7854 { | |
267 | 7855 gold_transaction_amount = 5000; |
0 | 7856 dword_F8B1B0 = 3; |
7857 } | |
7858 else | |
7859 { | |
7860 if ( v2 == 2 ) | |
7861 { | |
267 | 7862 gold_transaction_amount = 8000; |
0 | 7863 dword_F8B1B0 = 4; |
7864 } | |
7865 } | |
7866 } | |
7867 else | |
7868 { | |
267 | 7869 gold_transaction_amount = 2000; |
0 | 7870 dword_F8B1B0 = 2; |
7871 } | |
135 | 7872 v5 = v1->classType; |
0 | 7873 v33 = v5; |
7874 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
7875 *(int *)a1 = v1->pActiveSkills[v3]; | |
7876 v7 = a1[0] & 0x3F; | |
7877 v34 = v2 + 2; | |
7878 if ( v6 < v2 + 2 ) | |
7879 { | |
7880 v8 = v33; | |
7881 v9 = 0; | |
7882 v10 = v33 - v33 % 4; | |
7883 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
7884 do | |
7885 { | |
7886 v12 = (unsigned __int8)*v11; | |
7887 v13 = &v28[4 * v9]; | |
7888 *(int *)v13 = 0; | |
7889 if ( v12 < v34 ) | |
7890 { | |
7891 v14 = 1; | |
7892 } | |
7893 else | |
7894 { | |
7895 v14 = 1; | |
7896 *(int *)v13 = 1; | |
7897 } | |
7898 ++v9; | |
7899 v11 += 37; | |
7900 } | |
7901 while ( v9 < 4 ); | |
7902 if ( v29 == v14 ) | |
7903 { | |
7904 v25 = pClassNames[v10 + 1]; | |
7905 } | |
7906 else | |
7907 { | |
7908 if ( v30 == v14 ) | |
7909 { | |
7910 if ( v31 == v14 ) | |
7911 { | |
7912 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
7913 return pTmpBuf; | |
7914 } | |
7915 v25 = pClassNames[v10 + 2]; | |
7916 } | |
7917 else | |
7918 { | |
7919 if ( v31 != v14 ) | |
7920 { | |
7921 v25 = pClassNames[v8]; | |
7922 v22 = pGlobalTXT_LocalizationStrings[632]; | |
7923 goto LABEL_23; | |
7924 } | |
7925 v25 = pClassNames[v10 + 3]; | |
7926 } | |
7927 } | |
7928 v22 = pGlobalTXT_LocalizationStrings[633]; | |
7929 LABEL_23: | |
7930 sprintf(pTmpBuf, v22, v25); | |
7931 return pTmpBuf; | |
7932 } | |
7933 if ( !v1->CanAct() ) | |
7934 return (char *)pNPCTopics[122].pText; | |
7935 if ( !v7 ) | |
7936 return (char *)pNPCTopics[131].pText; | |
7937 v16 = SkillToMastery(a1[0]); | |
7938 if ( (signed int)v16 > v4 + 1 ) | |
7939 return (char *)pNPCTopics[v4 + 128].pText; | |
7940 if ( v34 != 2 ) | |
7941 { | |
7942 if ( v34 == 3 ) | |
7943 { | |
7944 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
7945 { | |
492 | 7946 v17 = dword_F8B1AC_award_bit_number; |
7947 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7948 { |
7949 default: | |
7950 goto LABEL_41; | |
7951 case 12: | |
7952 case 13: | |
7953 case 14: | |
7954 case 15: | |
7955 case 16: | |
7956 case 17: | |
7957 case 18: | |
267 | 7958 gold_transaction_amount = 4000; |
0 | 7959 goto LABEL_42; |
7960 case 19: | |
7961 v19 = 114; | |
7962 goto LABEL_57; | |
7963 case 20: | |
7964 v19 = 110; | |
7965 LABEL_57: | |
484 | 7966 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7967 return v35; |
7968 goto LABEL_40; | |
7969 case 22: | |
7970 v20 = v1->GetBaseWillpower(); | |
7971 goto LABEL_61; | |
7972 case 24: | |
267 | 7973 gold_transaction_amount = 2500; |
0 | 7974 v20 = v1->GetBaseEndurance(); |
7975 goto LABEL_61; | |
7976 case 36: | |
7977 v20 = v1->GetBaseIntelligence(); | |
7978 LABEL_61: | |
7979 if ( v20 < 50 ) | |
7980 return v35; | |
7981 goto LABEL_40; | |
7982 case 21: | |
7983 case 23: | |
7984 case 25: | |
7985 case 26: | |
7986 case 29: | |
7987 case 32: | |
7988 case 34: | |
7989 case 35: | |
267 | 7990 gold_transaction_amount = 2500; |
0 | 7991 goto LABEL_42; |
7992 case 8: | |
7993 case 9: | |
7994 case 10: | |
7995 case 11: | |
267 | 7996 gold_transaction_amount = 3000; |
0 | 7997 goto LABEL_42; |
7998 case 7: | |
7999 goto LABEL_67; | |
8000 } | |
8001 goto LABEL_67; | |
8002 } | |
8003 } | |
8004 else | |
8005 { | |
8006 if ( v34 != 4 ) | |
8007 { | |
8008 LABEL_40: | |
492 | 8009 v17 = dword_F8B1AC_award_bit_number; |
0 | 8010 goto LABEL_41; |
8011 } | |
8012 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
8013 { | |
492 | 8014 v17 = dword_F8B1AC_award_bit_number; |
8015 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 8016 { |
8017 case 19: | |
8018 if ( v1->_49327B(0x22u, 1) == 1 ) | |
8019 goto LABEL_40; | |
8020 v26 = 1; | |
8021 v23 = 26; | |
8022 goto LABEL_39; | |
8023 default: | |
8024 goto LABEL_41; | |
8025 case 20: | |
8026 if ( v1->_49327B(0x23u, 1) == 1 ) | |
8027 goto LABEL_40; | |
8028 v26 = 1; | |
8029 v23 = 27; | |
8030 LABEL_39: | |
8031 if ( v1->_49327B(v23, v26) == 1 ) | |
8032 goto LABEL_40; | |
8033 return v35; | |
8034 case 30: | |
8035 v18 = LOBYTE(v1->pActiveSkills[31]); | |
8036 goto LABEL_47; | |
8037 case 31: | |
8038 v18 = LOBYTE(v1->pActiveSkills[30]); | |
8039 LABEL_47: | |
8040 if ( (v18 & 0x3Fu) < 0xA ) | |
8041 return v35; | |
8042 goto LABEL_41; | |
8043 case 21: | |
8044 case 23: | |
8045 case 24: | |
8046 case 25: | |
8047 case 26: | |
8048 case 29: | |
8049 case 32: | |
8050 case 34: | |
8051 case 35: | |
267 | 8052 gold_transaction_amount = 6000; |
0 | 8053 goto LABEL_42; |
8054 case 8: | |
8055 case 9: | |
8056 case 10: | |
8057 case 11: | |
267 | 8058 gold_transaction_amount = 7000; |
0 | 8059 goto LABEL_42; |
8060 case 7: | |
8061 break; | |
8062 } | |
8063 LABEL_67: | |
267 | 8064 gold_transaction_amount = 0; |
0 | 8065 goto LABEL_41; |
8066 } | |
8067 } | |
8068 return v35; | |
8069 } | |
8070 if ( v7 < 4 ) | |
8071 return v35; | |
492 | 8072 v17 = dword_F8B1AC_award_bit_number; |
8073 if ( dword_F8B1AC_award_bit_number > 27 ) | |
8074 { | |
8075 if ( dword_F8B1AC_award_bit_number != 29 | |
8076 && dword_F8B1AC_award_bit_number != 32 | |
8077 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 8078 { |
8079 LABEL_41: | |
267 | 8080 if ( !gold_transaction_amount ) |
0 | 8081 goto LABEL_79; |
8082 goto LABEL_42; | |
8083 } | |
8084 LABEL_87: | |
267 | 8085 gold_transaction_amount = 500; |
0 | 8086 goto LABEL_41; |
8087 } | |
492 | 8088 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 8089 goto LABEL_87; |
492 | 8090 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 8091 { |
267 | 8092 gold_transaction_amount = 0; |
0 | 8093 goto LABEL_79; |
8094 } | |
492 | 8095 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 8096 goto LABEL_41; |
492 | 8097 if ( dword_F8B1AC_award_bit_number > 18 ) |
8098 { | |
8099 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 8100 goto LABEL_41; |
8101 goto LABEL_87; | |
8102 } | |
267 | 8103 gold_transaction_amount = 1000; |
0 | 8104 LABEL_42: |
267 | 8105 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 8106 return (char *)pNPCTopics[124].pText; |
8107 LABEL_79: | |
484 | 8108 contract_approved = 1; |
0 | 8109 if ( v34 == 2 ) |
8110 { | |
267 | 8111 v27 = gold_transaction_amount; |
0 | 8112 v24 = pSkillNames[v17]; |
8113 v21 = pGlobalTXT_LocalizationStrings[433]; | |
8114 goto LABEL_90; | |
8115 } | |
8116 if ( v34 == 3 ) | |
8117 { | |
267 | 8118 v27 = gold_transaction_amount; |
0 | 8119 v24 = pSkillNames[v17]; |
8120 v21 = pGlobalTXT_LocalizationStrings[432]; | |
8121 goto LABEL_90; | |
8122 } | |
8123 if ( v34 == 4 ) | |
8124 { | |
267 | 8125 v27 = gold_transaction_amount; |
0 | 8126 v24 = pSkillNames[v17]; |
8127 v21 = pGlobalTXT_LocalizationStrings[225]; | |
8128 LABEL_90: | |
8129 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); | |
8130 } | |
8131 return pTmpBuf2; | |
8132 } | |
8133 | |
8134 | |
8135 | |
8136 //----- (004B29F2) -------------------------------------------------------- | |
492 | 8137 const char * ContractSelectText( int pEventCode ) |
8138 { | |
8139 static const int dialogue_base=110; | |
484 | 8140 contract_approved = 0; |
492 | 8141 dword_F8B1AC_award_bit_number = pEventCode + 50; |
8142 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 8143 if ( pPlayers[uActiveCharacter]->CanAct() ) |
8144 { | |
492 | 8145 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
8146 { | |
8147 return pNPCTopics[dialogue_base+13].pText; | |
0 | 8148 } |
8149 else | |
8150 { | |
267 | 8151 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 8152 { |
484 | 8153 contract_approved = 1; |
492 | 8154 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 8155 } |
8156 else | |
8157 { | |
492 | 8158 return pNPCTopics[dialogue_base+14].pText; |
0 | 8159 } |
8160 } | |
8161 } | |
8162 else | |
8163 { | |
492 | 8164 return pNPCTopics[dialogue_base+12].pText; |
0 | 8165 } |
8166 } | |
8167 | |
8168 | |
8169 //----- (004B2A74) -------------------------------------------------------- | |
459 | 8170 char __cdecl SimpleHouseAndBoatsDialog() |
0 | 8171 { |
8172 char *v0; // esi@3 | |
8173 char *v1; // ST1C_4@3 | |
8174 char *v2; // eax@3 | |
8175 const char *v3; // ST1C_4@5 | |
8176 int v4; // eax@5 | |
8177 unsigned int i; // eax@5 | |
8178 NPCData *v6; // esi@6 | |
8179 unsigned __int16 v7; // bx@6 | |
8180 unsigned int v8; // eax@6 | |
8181 int v9; // eax@11 | |
8182 unsigned int v10; // ecx@12 | |
8183 int v11; // eax@12 | |
8184 int v12; // esi@12 | |
8185 char *v13; // eax@12 | |
8186 GUIWindow *v14; // ebx@13 | |
8187 char *v15; // esi@14 | |
8188 GUIButton *v16; // eax@15 | |
8189 unsigned int v17; // ecx@15 | |
8190 int v18; // ecx@17 | |
8191 int v19; // ecx@18 | |
8192 int v20; // ecx@19 | |
8193 int v21; // ecx@20 | |
8194 int v22; // ecx@21 | |
8195 unsigned int v23; // ecx@23 | |
8196 int v24; // ecx@35 | |
8197 int v25; // ecx@36 | |
8198 int v26; // ecx@37 | |
8199 int v27; // ecx@38 | |
8200 int v28; // ecx@39 | |
8201 char *v29; // esi@42 | |
8202 unsigned int v30; // ST20_4@42 | |
8203 int v31; // ST1C_4@42 | |
8204 unsigned int v32; // eax@42 | |
8205 char *v33; // eax@43 | |
8206 int v34; // esi@51 | |
8207 int v35; // eax@51 | |
8208 unsigned int v36; // edi@51 | |
8209 GUIButton *v37; // eax@52 | |
8210 int v38; // eax@52 | |
8211 signed int v39; // ecx@54 | |
8212 int v40; // edi@57 | |
8213 GUIButton *v41; // eax@60 | |
8214 GUIButton *v42; // esi@60 | |
8215 const char *v43; // ebx@60 | |
8216 int v44; // eax@60 | |
8217 unsigned int v45; // ecx@60 | |
8218 unsigned __int16 v46; // ax@60 | |
8219 GUIFont *v47; // ebx@64 | |
8220 int v48; // esi@64 | |
8221 char *v49; // eax@66 | |
8222 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
8223 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
8224 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
8225 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
8226 int v55; // [sp+10Ch] [bp-10h]@6 | |
8227 int v56; // [sp+110h] [bp-Ch]@13 | |
8228 char *pInString; // [sp+114h] [bp-8h]@12 | |
8229 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
8230 | |
8231 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 8232 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 8233 { |
8234 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
8235 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
8236 a1.uFrameX = 493; | |
8237 a1.uFrameWidth = 126; | |
8238 a1.uFrameZ = 366; | |
8239 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
8240 a1.uFrameX = 483; | |
8241 a1.uFrameWidth = 148; | |
8242 a1.uFrameZ = 334; | |
434 | 8243 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 8244 if ( !v2 ) |
8245 { | |
721 | 8246 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 8247 v2 = pTmpBuf; |
8248 } | |
8249 v3 = v2; | |
8250 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
8251 LOBYTE(i) = (unsigned int)a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); | |
8252 return i; | |
8253 } | |
8254 a1.uFrameWidth -= 10; | |
8255 a1.uFrameZ -= 10; | |
459 | 8256 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 8257 v6 = v58; |
8258 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
8259 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
8260 v8 = v6->uProfession; | |
8261 if ( v8 ) | |
264 | 8262 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 8263 else |
8264 strcpy(pTmpBuf, v6->pName); | |
8265 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
8266 if ( !dword_591080 ) | |
8267 { | |
8268 if ( !uDialogueType ) | |
8269 { | |
8270 v9 = v6->greet; | |
8271 if ( v9 ) | |
8272 { | |
8273 v10 = v6->uFlags; | |
8274 a1.uFrameWidth = 460; | |
8275 a1.uFrameZ = 452; | |
8276 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
8277 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
8278 v12 = v11 + 7; | |
8279 pRenderer->_4A6A68( | |
8280 8u, | |
8281 352 - (v11 + 7), | |
8282 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
8283 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
8284 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
8285 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
8286 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
8287 } | |
8288 } | |
8289 } | |
8290 v14 = pDialogueWindow; | |
8291 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
8292 v52.uFrameX = 483; | |
8293 v52.uFrameWidth = 148; | |
8294 v52.uFrameZ = 334; | |
8295 v56 = v52.pStartingPosActiveItem; | |
8296 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
8297 { | |
348 | 8298 v15 = "";//(char *)v54; |
0 | 8299 while ( 1 ) |
8300 { | |
8301 v16 = v52.GetControl(v56); | |
8302 v17 = v16->uControlParam; | |
8303 pInString = (char *)v16; | |
8304 if ( (signed int)v17 > 24 ) | |
8305 { | |
8306 v24 = v17 - 76; | |
8307 if ( !v24 ) | |
8308 { | |
8309 v15 = pGlobalTXT_LocalizationStrings[406]; | |
8310 goto LABEL_49; | |
8311 } | |
8312 v25 = v24 - 1; | |
8313 if ( !v25 ) | |
8314 { | |
8315 v15 = pGlobalTXT_LocalizationStrings[407]; | |
8316 goto LABEL_49; | |
8317 } | |
8318 v26 = v25 - 2; | |
8319 if ( !v26 ) | |
8320 { | |
8321 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
8322 LABEL_44: | |
8323 v15 = v33; | |
8324 LABEL_45: | |
8325 v16 = (GUIButton *)pInString; | |
8326 goto LABEL_49; | |
8327 } | |
8328 v27 = v26 - 3; | |
8329 if ( !v27 ) | |
8330 { | |
459 | 8331 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 8332 goto LABEL_44; |
8333 } | |
8334 v28 = v27 - 1; | |
8335 if ( !v28 ) | |
8336 { | |
8337 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
8338 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8339 v31 = *(int *)v29; | |
8340 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8341 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
8342 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
8343 ptr_F8B1E8 = pTmpBuf2; | |
8344 v15 = ""; | |
8345 goto LABEL_45; | |
8346 } | |
8347 if ( v28 != 10 ) | |
8348 goto LABEL_41; | |
8349 } | |
8350 else | |
8351 { | |
8352 if ( v17 == 24 ) | |
8353 { | |
291 | 8354 v23 = v58->evt_F; |
0 | 8355 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
8356 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 8357 if ( !v15 ) |
8358 { | |
8359 v16->uControlParam = 0; | |
8360 v15 = ""; | |
8361 } | |
8362 goto LABEL_49; | |
8363 } | |
8364 v18 = v17 - 13; | |
8365 if ( v18 ) | |
8366 { | |
8367 v19 = v18 - 6; | |
8368 if ( !v19 ) | |
8369 { | |
291 | 8370 v23 = v58->evt_A; |
0 | 8371 goto LABEL_33; |
8372 } | |
8373 v20 = v19 - 1; | |
8374 if ( !v20 ) | |
8375 { | |
291 | 8376 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 8377 if ( !v15 ) |
8378 { | |
8379 v16->uControlParam = 0; | |
8380 v15 = ""; | |
8381 } | |
8382 if ( uDialogueType != 84 ) | |
8383 goto LABEL_49; | |
484 | 8384 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 8385 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
8386 ptr_F8B1E8 = pTmpBuf2; | |
8387 goto LABEL_45; | |
8388 } | |
8389 v21 = v20 - 1; | |
8390 if ( !v21 ) | |
8391 { | |
291 | 8392 v23 = v58->evt_C; |
0 | 8393 goto LABEL_33; |
8394 } | |
8395 v22 = v21 - 1; | |
8396 if ( !v22 ) | |
8397 { | |
291 | 8398 v23 = v58->evt_D; |
0 | 8399 goto LABEL_33; |
8400 } | |
8401 if ( v22 == 1 ) | |
8402 { | |
291 | 8403 v23 = v58->evt_E; |
0 | 8404 goto LABEL_33; |
8405 } | |
8406 LABEL_41: | |
8407 v15 = ""; | |
8408 goto LABEL_49; | |
8409 } | |
8410 v15 = pGlobalTXT_LocalizationStrings[122]; | |
8411 } | |
8412 LABEL_49: | |
8413 strcpy(v16->pButtonName, v15); | |
8414 ++v56; | |
8415 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
8416 { | |
8417 v14 = pDialogueWindow; | |
8418 break; | |
8419 } | |
8420 } | |
8421 } | |
8422 v34 = 0; | |
8423 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8424 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
8425 v36 = v14->pStartingPosActiveItem; | |
8426 v55 = v35; | |
8427 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
8428 + pDialogueWindow->pStartingPosActiveItem ) | |
8429 { | |
8430 v37 = v14->GetControl(v36); | |
8431 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
8432 v14 = pDialogueWindow; | |
8433 v34 += v38; | |
8434 ++v36; | |
8435 } | |
8436 v39 = v14->pNumPresenceButton; | |
8437 if ( v39 ) | |
8438 { | |
8439 v58 = (NPCData *)((174 - v34) / v39); | |
8440 if ( (signed int)v58 > 32 ) | |
8441 v58 = (NPCData *)32; | |
8442 pInString = (char *)2; | |
8443 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
8444 v56 = v14->pStartingPosActiveItem; | |
8445 i = v56; | |
8446 if ( (signed int)i < (signed int)(i + v39) ) | |
8447 { | |
8448 while ( 1 ) | |
8449 { | |
8450 v41 = v14->GetControl(i); | |
8451 v42 = v41; | |
8452 v43 = v41->pButtonName; | |
8453 v41->uY = (unsigned int)((char *)v58 + v40); | |
8454 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
8455 v45 = v42->uY; | |
8456 v42->uHeight = v44; | |
8457 v40 = v45 + v44 - 1; | |
8458 v42->uW = v40; | |
8459 v46 = v55; | |
8460 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
8461 v46 = v54; | |
8462 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
8463 v14 = pDialogueWindow; | |
8464 ++pInString; | |
8465 ++v56; | |
8466 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
8467 if ( v56 >= (signed int)i ) | |
8468 break; | |
8469 i = v56; | |
8470 } | |
8471 } | |
8472 } | |
8473 if ( ptr_F8B1E8 ) | |
8474 { | |
8475 w.uFrameWidth = 458; | |
8476 w.uFrameZ = 457; | |
8477 v47 = pFontArrus; | |
8478 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
8479 if ( 352 - v48 < 8 ) | |
8480 { | |
8481 v47 = pFontCreate; | |
8482 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
8483 } | |
8484 pRenderer->_4A6A68( | |
8485 8u, | |
8486 352 - v48, | |
8487 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
8488 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
8489 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
8490 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); | |
8491 LOBYTE(i) = a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); | |
8492 } | |
8493 return i; | |
8494 } | |
8495 | |
8496 | |
8497 | |
8498 | |
8499 | |
8500 //----- (004B36CC) -------------------------------------------------------- | |
473 | 8501 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
8502 { | |
8503 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); | |
0 | 8504 } |
8505 | |
8506 | |
8507 | |
8508 //----- (004B3A72) -------------------------------------------------------- | |
473 | 8509 void sub_4B3A72( int a1 ) |
8510 { | |
8511 int num_buttons; // esi@1 | |
8512 | |
8513 num_buttons = 0; | |
0 | 8514 if ( a1 == 21 ) |
8515 { | |
473 | 8516 CreateButtonInColumn(0, 0x66u); |
8517 num_buttons = 2; | |
8518 CreateButtonInColumn(1, 0x67u); | |
8519 if ( pParty->HasItem(651) ) //Arcomage Deck | |
8520 { | |
8521 num_buttons = 3; | |
8522 CreateButtonInColumn(2, 0x68u); | |
8523 } | |
8524 } | |
8525 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 8526 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8527 } | |
8528 // F8B1E0: using guessed type int dword_F8B1E0; | |
8529 | |
8530 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 8531 void sub_4B3AD4( signed int a1 ) |
8532 { | |
0 | 8533 if ( a1 > 0 ) |
8534 { | |
8535 if ( a1 <= 3 ) | |
8536 { | |
473 | 8537 CreateButtonInColumn(0, 3u); |
8538 CreateButtonInColumn(1, 4u); | |
8539 CreateButtonInColumn(2, 5u); | |
8540 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 8541 } |
8542 if ( a1 == 4 ) | |
8543 { | |
473 | 8544 CreateButtonInColumn(0, 3u); |
8545 CreateButtonInColumn(1, 4u); | |
8546 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
8547 } | |
8548 } | |
0 | 8549 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8550 } | |
8551 // F8B1E0: using guessed type int dword_F8B1E0; | |
8552 | |
8553 //----- (004B3B42) -------------------------------------------------------- | |
473 | 8554 void sub_4B3B42( signed int a1 ) |
8555 { | |
0 | 8556 int v1; // ecx@18 |
8557 int v2; // ecx@19 | |
8558 int v3; // ecx@20 | |
8559 signed int v4; // esi@22 | |
8560 signed int v5; // eax@22 | |
8561 unsigned int v6; // edx@24 | |
8562 int v7; // ecx@24 | |
8563 int result; // eax@43 | |
8564 int v9; // [sp-10h] [bp-14h]@28 | |
8565 int v10; // [sp-Ch] [bp-10h]@28 | |
8566 int v11; // [sp-8h] [bp-Ch]@28 | |
8567 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
8568 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
8569 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
8570 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
8571 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
8572 int v17; // [sp-4h] [bp-8h]@28 | |
8573 | |
8574 if ( a1 > 13 ) | |
8575 { | |
8576 if ( a1 > 22 ) | |
8577 { | |
8578 if ( a1 == 23 ) | |
8579 { | |
473 | 8580 CreateButtonInColumn(0, 0xAu); |
8581 CreateButtonInColumn(1, 0xBu); | |
0 | 8582 v14 = 96; |
8583 LABEL_41: | |
473 | 8584 CreateButtonInColumn(2, v14); |
0 | 8585 v17 = 2; |
8586 v11 = 0; | |
8587 v10 = 1; | |
8588 v9 = 3; | |
8589 goto LABEL_42; | |
8590 } | |
8591 if ( a1 <= 26 ) | |
8592 goto LABEL_43; | |
8593 if ( a1 > 28 ) | |
8594 { | |
8595 if ( a1 != 30 ) | |
8596 goto LABEL_43; | |
473 | 8597 CreateButtonInColumn(0, 0x11u); |
0 | 8598 v16 = 96; |
8599 goto LABEL_37; | |
8600 } | |
473 | 8601 CreateButtonInColumn(0, 0x69u); |
8602 CreateButtonInColumn(1, 0x6Au); | |
8603 CreateButtonInColumn(2, 0x6Bu); | |
0 | 8604 v12 = 108; |
8605 } | |
8606 else | |
8607 { | |
8608 if ( a1 == 22 ) | |
8609 { | |
473 | 8610 CreateButtonInColumn(0, 7u); |
0 | 8611 v16 = 8; |
8612 goto LABEL_37; | |
8613 } | |
8614 v1 = a1 - 14; | |
8615 if ( !v1 ) | |
8616 { | |
473 | 8617 CreateButtonInColumn(0, 0x12u); |
8618 CreateButtonInColumn(1, 0x30u); | |
8619 CreateButtonInColumn(2, 0x31u); | |
8620 CreateButtonInColumn(3, 0x32u); | |
8621 CreateButtonInColumn(4, 0x33u); | |
0 | 8622 v17 = 2; |
8623 v11 = 0; | |
8624 v10 = 1; | |
8625 v9 = 5; | |
8626 goto LABEL_42; | |
8627 } | |
8628 v2 = v1 - 1; | |
8629 if ( v2 ) | |
8630 { | |
8631 v3 = v2 - 2; | |
8632 if ( v3 ) | |
8633 { | |
8634 if ( v3 != 4 ) | |
8635 goto LABEL_43; | |
473 | 8636 CreateButtonInColumn(0, 0xFu); |
8637 CreateButtonInColumn(1, 0x10u); | |
0 | 8638 v4 = 3; |
473 | 8639 CreateButtonInColumn(2, 0x60u); |
336 | 8640 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 8641 if ( v5 < 108 || v5 > 120 ) |
8642 goto LABEL_28; | |
8643 v4 = 4; | |
8644 v6 = 101; | |
8645 v7 = 3; | |
8646 } | |
8647 else | |
8648 { | |
8649 v4 = 1; | |
473 | 8650 CreateButtonInColumn(0, 0x63u); |
0 | 8651 if ( !pParty->uFine ) |
8652 { | |
8653 LABEL_28: | |
8654 v17 = 2; | |
8655 v11 = 0; | |
8656 v10 = 1; | |
8657 v9 = v4; | |
8658 LABEL_42: | |
8659 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
8660 goto LABEL_43; | |
8661 } | |
8662 v4 = 2; | |
8663 v7 = 1; | |
8664 v6 = 100; | |
8665 } | |
473 | 8666 CreateButtonInColumn(v7, v6); |
0 | 8667 goto LABEL_28; |
8668 } | |
473 | 8669 CreateButtonInColumn(0, 0x12u); |
8670 CreateButtonInColumn(1, 0x34u); | |
8671 CreateButtonInColumn(2, 0x35u); | |
0 | 8672 v12 = 54; |
8673 } | |
8674 LABEL_39: | |
473 | 8675 CreateButtonInColumn(3, v12); |
0 | 8676 v17 = 2; |
8677 v11 = 0; | |
8678 v10 = 1; | |
8679 v9 = 4; | |
8680 goto LABEL_42; | |
8681 } | |
8682 if ( a1 == 13 ) | |
8683 { | |
473 | 8684 CreateButtonInColumn(0, 0x12u); |
0 | 8685 v16 = 56; |
8686 LABEL_37: | |
473 | 8687 CreateButtonInColumn(1, v16); |
0 | 8688 v17 = 2; |
8689 v11 = 0; | |
8690 v10 = 1; | |
8691 v9 = 2; | |
8692 goto LABEL_42; | |
8693 } | |
8694 switch ( a1 ) | |
8695 { | |
8696 case 1: | |
8697 case 2: | |
8698 case 3: | |
8699 case 4: | |
473 | 8700 CreateButtonInColumn(0, 2u); |
8701 CreateButtonInColumn(1, 0x5Fu); | |
8702 CreateButtonInColumn(2, 0x5Eu); | |
0 | 8703 v12 = 96; |
8704 goto LABEL_39; | |
8705 case 5: | |
473 | 8706 CreateButtonInColumn(0, 0x12u); |
0 | 8707 v13 = 48; |
8708 goto LABEL_9; | |
8709 case 6: | |
473 | 8710 CreateButtonInColumn(0, 0x12u); |
0 | 8711 v13 = 49; |
8712 goto LABEL_9; | |
8713 case 7: | |
473 | 8714 CreateButtonInColumn(0, 0x12u); |
0 | 8715 v13 = 50; |
8716 goto LABEL_9; | |
8717 case 8: | |
473 | 8718 CreateButtonInColumn(0, 0x12u); |
0 | 8719 v13 = 51; |
8720 LABEL_9: | |
473 | 8721 CreateButtonInColumn(1, v13); |
0 | 8722 v14 = 72; |
8723 goto LABEL_41; | |
8724 case 9: | |
473 | 8725 CreateButtonInColumn(0, 0x12u); |
0 | 8726 v15 = 52; |
8727 goto LABEL_13; | |
8728 case 10: | |
473 | 8729 CreateButtonInColumn(0, 0x12u); |
0 | 8730 v15 = 53; |
8731 goto LABEL_13; | |
8732 case 11: | |
473 | 8733 CreateButtonInColumn(0, 0x12u); |
0 | 8734 v15 = 54; |
8735 LABEL_13: | |
473 | 8736 CreateButtonInColumn(1, v15); |
0 | 8737 v14 = 61; |
8738 goto LABEL_41; | |
8739 case 12: | |
473 | 8740 CreateButtonInColumn(0, 0x12u); |
0 | 8741 v16 = 55; |
8742 goto LABEL_37; | |
8743 default: | |
8744 break; | |
8745 } | |
8746 LABEL_43: | |
8747 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
8748 } | |
8749 // F8B1E0: using guessed type int dword_F8B1E0; | |
8750 | |
8751 //----- (004B3E1E) -------------------------------------------------------- | |
8752 void __cdecl sub_4B3E1E() | |
8753 { | |
8754 NPCData *v0; // ST40_4@1 | |
8755 signed int v1; // edi@1 | |
165 | 8756 //GUIWindow *v2; // ecx@1 |
0 | 8757 |
167 | 8758 __debugbreak(); |
602 | 8759 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 8760 v1 = 0; |
8761 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
8762 pDialogueWindow->Release(); | |
165 | 8763 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 8764 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 8765 { |
165 | 8766 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 8767 v1 = 1; |
8768 } | |
165 | 8769 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);// |
0 | 8770 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
8771 } | |
8772 | |
8773 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 8774 void DrawJoinGuildWindow( int pEventCode ) |
8775 { | |
467 | 8776 uDialogueType = 81;//enum JoinGuildDialog |
492 | 8777 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
8778 ContractSelectText(pEventCode); | |
0 | 8779 pDialogueWindow->Release(); |
492 | 8780 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 8781 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 8782 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8783 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8784 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); |
0 | 8785 pDialogueWindow->_41D08F(1, 1, 0, 2); |
607 | 8786 dialog_menu_id = -1; |
0 | 8787 } |
8788 // F8B19C: using guessed type int dword_F8B19C; | |
8789 | |
8790 //----- (004B3FE5) -------------------------------------------------------- | |
8791 void __fastcall sub_4B3FE5(int a4) | |
8792 { | |
8793 int v1; // edi@1 | |
8794 char *v2; // edi@1 | |
8795 | |
8796 v1 = a4; | |
8797 uDialogueType = 78; | |
8798 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
8799 _4B254D_SkillMasteryTeacher(a4); | |
8800 pDialogueWindow->Release(); | |
8801 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
8802 v2 = ""; | |
492 | 8803 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 8804 pGlobalTXT_LocalizationStrings[34], |
526 | 8805 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 8806 0); |
8807 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 8808 if ( contract_approved ) |
0 | 8809 v2 = pGlobalTXT_LocalizationStrings[535]; |
8810 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); | |
8811 pDialogueWindow->_41D08F(1, 1, 0, 2); | |
607 | 8812 dialog_menu_id = -1; |
0 | 8813 } |
8814 // F8B19C: using guessed type int dword_F8B19C; | |
8815 // F8B1A8: using guessed type int dword_F8B1A8; | |
8816 | |
8817 //----- (004B40E6) -------------------------------------------------------- | |
607 | 8818 void NPCHireableDialogPrepare() |
8819 { | |
0 | 8820 signed int v0; // ebx@1 |
8821 NPCData *v1; // edi@1 | |
8822 | |
8823 v0 = 0; | |
459 | 8824 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 8825 pDialogueWindow->Release(); |
8826 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
607 | 8827 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
8828 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 8829 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 8830 0); |
8831 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 8832 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 8833 { |
607 | 8834 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
8835 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 8836 v0 = 1; |
8837 } | |
607 | 8838 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
8839 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" | |
0 | 8840 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
607 | 8841 dialog_menu_id = -1; |
0 | 8842 } |
8843 | |
8844 | |
8845 //----- (004B4224) -------------------------------------------------------- | |
423 | 8846 void _4B4224_UpdateNPCTopics( int _this ) |
8847 { | |
8848 int num_menu_buttons; // ebx@1 | |
0 | 8849 int i; // ebp@5 |
423 | 8850 // signed int v4; // ebp@9 |
8851 int v6; // eax@16 | |
8852 int v8; // eax@21 | |
8853 int v10; // eax@26 | |
8854 int v12; // eax@31 | |
8855 int v14; // eax@36 | |
8856 int v16; // eax@41 | |
0 | 8857 NPCData *v17; // [sp+10h] [bp-4h]@4 |
8858 | |
423 | 8859 num_menu_buttons = 0; |
459 | 8860 pDialogueNPCCount = (_this + 1); |
0 | 8861 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
8862 { | |
8863 pDialogueWindow->Release(); | |
8864 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
423 | 8865 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
8866 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, | |
0 | 8867 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 8868 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 8869 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
8870 sHouseName, | |
8871 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 8872 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 8873 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); |
0 | 8874 } |
8875 else | |
8876 { | |
459 | 8877 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
607 | 8878 if ( dialog_menu_id == -1 ) |
0 | 8879 { |
8880 pDialogueWindow->Release(); | |
8881 } | |
8882 else | |
8883 { | |
8884 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 8885 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 8886 } |
8887 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
423 | 8888 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 8889 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 8890 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8891 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8892 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 8893 { |
484 | 8894 sub_4B3B42(in_current_building_type); |
0 | 8895 } |
8896 else | |
8897 { | |
8898 if ( v17->joins ) | |
8899 { | |
423 | 8900 num_menu_buttons = 1; |
0 | 8901 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); |
8902 } | |
423 | 8903 if ( v17->evt_A) |
8904 { | |
8905 if ( num_menu_buttons < 4 ) | |
8906 { | |
8907 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 8908 if ( v6 == 1 || v6 == 2 ) |
423 | 8909 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
8910 } | |
8911 } | |
8912 if ( v17->evt_B ) | |
8913 { | |
8914 if ( num_menu_buttons < 4 ) | |
8915 { | |
8916 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 8917 if ( v8 == 1 || v8 == 2 ) |
423 | 8918 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
8919 } | |
8920 } | |
8921 if ( v17->evt_C ) | |
8922 { | |
8923 if ( num_menu_buttons < 4 ) | |
8924 { | |
8925 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 8926 if ( v10 == 1 || v10 == 2 ) |
423 | 8927 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
8928 } | |
8929 } | |
8930 | |
8931 if ( v17->evt_D ) | |
8932 { | |
8933 if ( num_menu_buttons < 4 ) | |
8934 { | |
8935 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 8936 if ( v12 == 1 || v12 == 2 ) |
423 | 8937 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
8938 } | |
8939 } | |
8940 if ( v17->evt_E ) | |
8941 { | |
8942 if ( num_menu_buttons < 4 ) | |
8943 { | |
8944 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 8945 if ( v14 == 1 || v14 == 2 ) |
423 | 8946 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
8947 } | |
8948 } | |
8949 if ( v17->evt_F ) | |
8950 { | |
8951 if ( num_menu_buttons < 4 ) | |
8952 { | |
8953 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8954 if ( v16 == 1 || v16 == 2 ) |
423 | 8955 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
8956 } | |
8957 } | |
8958 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 8959 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8960 } | |
607 | 8961 dialog_menu_id = 1; |
423 | 8962 } |
8963 | |
0 | 8964 } |
8965 | |
8966 | |
8967 | |
8968 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8969 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8970 { |
0 | 8971 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8972 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8973 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8974 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8975 } |
8976 | |
8977 //----- (004B46F8) -------------------------------------------------------- | |
8978 int __fastcall sub_4B46F8(int a1) | |
8979 { | |
8980 int v1; // eax@1 | |
8981 int i; // edx@1 | |
8982 | |
8983 v1 = 0; | |
8984 for ( i = 0; i < a1; ++i ) | |
8985 v1 += i + 1; | |
8986 return 1000 * v1; | |
8987 } | |
8988 | |
8989 | |
8990 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8991 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8992 { |
656 | 8993 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8994 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8995 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8996 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8997 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8998 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8999 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9000 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9001 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9002 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9003 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9004 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9005 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9006 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9007 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9008 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9009 //v1 = _this; |
656 | 9010 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9011 //v3 = v1; |
656 | 9012 uDialogueType = newDialogueType; |
9013 if (!speakingNPC->uFlags) | |
9014 { | |
9015 speakingNPC->uFlags = 1; | |
9016 //v3 = uDialogueType; | |
9017 } | |
9018 | |
9019 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
9020 { | |
9021 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
9022 } | |
9023 else if(newDialogueType == DIALOGUE_76) | |
9024 { | |
9025 if (speakingNPC->Hired()) | |
9026 { | |
9027 v8 = 0; | |
9028 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9029 { | |
9030 v6 = (char *)pNPCStats->pNewNPCData; | |
9031 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
9032 { | |
9033 ++v8; | |
9034 v6 += 76; | |
9035 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
9036 break; | |
9037 } | |
9038 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
9039 v6[8] &= 0x7Fu; | |
9040 } | |
9041 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
9042 { | |
9043 v11 = pParty->pHirelings; | |
9044 memset(v11, 0, sizeof(NPCData)); | |
9045 } | |
9046 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
9047 { | |
9048 v11 = &pParty->pHirelings[1]; | |
9049 memset(v11, 0, sizeof(NPCData)); | |
9050 } | |
9051 pParty->field_709 = 0; | |
659 | 9052 Party__CountHirelings(); |
656 | 9053 dword_591084 = 0; |
9054 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9055 dword_7241C8 = 0; | |
9056 return; | |
9057 } | |
9058 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
9059 { | |
9060 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
9061 ShowStatusBarString(v7, 2u); | |
9062 } | |
9063 else | |
9064 { | |
9065 //v9 = v2->uProfession; | |
9066 if ( speakingNPC->uProfession != 51 ) | |
9067 { | |
9068 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
9069 if ( pParty->uNumGold < v10 ) | |
9070 { | |
9071 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
9072 dialogue_show_profession_details = false; | |
9073 uDialogueType = 13; | |
9074 if ( uActiveCharacter ) | |
9075 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
9076 v7 = pGlobalTXT_LocalizationStrings[155]; | |
9077 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
9078 if ( !dword_7241C8 ) | |
9079 pGame->Draw(); | |
9080 dword_7241C8 = 0; | |
9081 return; | |
9082 } | |
9083 Party::TakeGold(v10); | |
9084 } | |
9085 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
9086 if ( pParty->pHirelings[0].pName ) | |
9087 { | |
9088 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
9089 v15 = speakingNPC->pName; | |
9090 v13 = pParty->pHireling2Name; | |
9091 } | |
9092 else | |
9093 { | |
9094 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
9095 v15 = speakingNPC->pName; | |
9096 v13 = pParty->pHireling1Name; | |
9097 } | |
9098 strcpy(v13, v15); | |
9099 pParty->field_709 = 0; | |
659 | 9100 Party__CountHirelings(); |
656 | 9101 |
9102 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9103 | |
711 | 9104 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 9105 pDialogue_SpeakingActor->uAIState = Removed; |
9106 if ( uActiveCharacter ) | |
9107 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
9108 } | |
9109 } | |
9110 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
9111 { | |
9112 ArenaFight(); | |
9113 return; | |
9114 } | |
9115 else if(newDialogueType == DIALOGUE_9) | |
9116 { | |
9117 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
9118 { | |
9119 if ( speakingNPC->uProfession != 41 ) | |
9120 speakingNPC->bHasUsedTheAbility = 1; | |
9121 | |
9122 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9123 } | |
9124 else | |
9125 { | |
9126 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
9127 } | |
9128 } | |
9129 else if(newDialogueType == DIALOGUE_13) | |
9130 { | |
9131 if (!speakingNPC->Hired()) | |
9132 { | |
9133 sub_4B3E1E(); | |
9134 dialogue_show_profession_details = false; | |
9135 } | |
9136 else | |
9137 { | |
9138 v5 = 0; | |
9139 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9140 { | |
9141 v6 = (char *)pNPCStats->pNewNPCData; | |
9142 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
9143 { | |
9144 ++v5; | |
9145 v6 += 76; | |
9146 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
9147 break; | |
9148 } | |
9149 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
9150 v6[8] &= 0x7Fu; | |
9151 } | |
9152 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
9153 { | |
9154 v11 = pParty->pHirelings; | |
9155 memset(v11, 0, sizeof(NPCData)); | |
9156 } | |
9157 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
9158 { | |
9159 v11 = &pParty->pHirelings[1]; | |
9160 memset(v11, 0, sizeof(NPCData)); | |
9161 } | |
9162 pParty->field_709 = 0; | |
659 | 9163 Party__CountHirelings(); |
656 | 9164 dword_591084 = 0; |
9165 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9166 dword_7241C8 = 0; | |
9167 return; | |
9168 } | |
9169 } | |
9170 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
9171 { | |
9172 switch(newDialogueType) | |
9173 { | |
9174 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
9175 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
9176 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
9177 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
9178 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
9179 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
9180 } | |
9181 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
9182 sub_4B3FE5(npc_event_id); //200-310 | |
9183 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
9184 { //400-410 | |
9185 dword_F8B1D8 = newDialogueType; | |
9186 DrawJoinGuildWindow(npc_event_id - 400); | |
9187 } | |
9188 else | |
9189 { | |
9190 switch ( npc_event_id ) | |
9191 { | |
9192 case 139: | |
9193 sub_4B1ECE(); | |
9194 break; | |
9195 case 311: | |
9196 sub_4BBA85_bounties(); | |
9197 break; | |
9198 case 399: | |
9199 sub_4BBCDD(); | |
9200 break; | |
9201 default: | |
9202 activeLevelDecoration = (LevelDecoration*)1; | |
9203 ptr_F8B1E8 = 0; | |
9204 EventProcessor(npc_event_id, 0, 1); | |
9205 activeLevelDecoration = NULL; | |
9206 break; | |
9207 } | |
9208 } | |
9209 } | |
9210 if ( !dword_7241C8 ) | |
9211 pGame->Draw(); | |
9212 dword_7241C8 = 0; | |
9213 } | |
0 | 9214 |
9215 | |
9216 | |
9217 //----- (004BDAAF) -------------------------------------------------------- | |
9218 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
9219 { | |
9220 int v2; // edx@1 | |
9221 unsigned int v3; // esi@1 | |
9222 unsigned int v4; // eax@1 | |
9223 signed int v5; // edi@1 | |
9224 int v6; // edx@8 | |
9225 int v7; // edx@9 | |
9226 int v8; // edx@10 | |
9227 unsigned __int8 v9; // zf@16 | |
9228 char v10; // sf@16 | |
9229 unsigned __int8 v11; // of@16 | |
702 | 9230 bool test; |
0 | 9231 |
9232 auto a2 = _2da_idx; | |
9233 //v2 = p2DEvents_minus1___00[26 * a2]; | |
9234 v2 = p2DEvents[a2 - 1].uType; | |
9235 v3 = a1->uItemID; | |
9236 v4 = a1->uItemID; | |
9237 v5 = pItemsTable->pItems[v4].uEquipType; | |
9238 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 9239 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 9240 return 0; |
702 | 9241 switch( p2DEvents[a2 - 1].uType ) |
9242 { | |
9243 case BildingType_WeaponShop: | |
9244 { | |
9245 test = v5 <= 2; | |
9246 break; | |
9247 } | |
9248 case BildingType_ArmorShop: | |
9249 { | |
9250 test = v5 >= 3; | |
9251 break; | |
9252 } | |
9253 case BildingType_MagicShop: | |
9254 { | |
9255 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
9256 break; | |
9257 } | |
9258 case BildingType_AlchemistShop: | |
9259 { | |
9260 __debugbreak(); // need to test | |
9261 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
9262 break; | |
9263 } | |
9264 default: | |
9265 { | |
9266 test = 0; | |
9267 break; | |
9268 } | |
9269 } | |
9270 | |
9271 return test; | |
9272 /* | |
9273 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 9274 { |
9275 v11 = __OFSUB__(v5, 2); | |
9276 v9 = v5 == 2; | |
9277 v10 = v5 - 2 < 0; | |
9278 goto LABEL_23; | |
9279 } | |
702 | 9280 if ( p2DEvents[a2 - 1].uType > 2 ) |
9281 { | |
9282 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 9283 { |
9284 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
9285 return v5 == 16; | |
9286 return 1; | |
9287 } | |
702 | 9288 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 9289 return 0; |
702 | 9290 if ( p2DEvents[a2 - 1].uType == 4) |
9291 { | |
9292 if ( v5 < 13 ) | |
9293 return 0; | |
9294 if ( v5 <= 14 ) | |
9295 return 1; | |
9296 if ( v5 != 17 || (signed int)v3 < 740 ) | |
9297 return 0; | |
9298 v11 = __OFSUB__(v3, 771); | |
9299 v9 = v3 == 771; | |
9300 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 9301 LABEL_23: |
702 | 9302 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
9303 return 0; | |
9304 return 1; | |
9305 } | |
9306 } | |
9307 if ( p2DEvents[a2 - 1].uType == 2 ) | |
9308 { | |
9309 if ( v5 >= 3 ) | |
9310 { | |
9311 v11 = __OFSUB__(v5, 9); | |
9312 v9 = v5 == 9; | |
9313 v10 = v5 - 9 < 0; | |
9314 goto LABEL_23; | |
9315 } | |
0 | 9316 } |
9317 return 0; | |
702 | 9318 */ |
0 | 9319 } |
9320 | |
9321 | |
9322 | |
9323 | |
9324 //----- (004B6478) -------------------------------------------------------- | |
711 | 9325 void sub_4B6478() |
9326 { | |
0 | 9327 GUIWindow *v0; // ebx@1 |
9328 Player *v1; // edi@1 | |
9329 unsigned int v2; // eax@1 | |
9330 signed int v3; // esi@1 | |
9331 int v4; // ebx@1 | |
9332 unsigned int v5; // esi@5 | |
9333 int v6; // edi@6 | |
9334 int result; // eax@13 | |
9335 GUIWindow *v8; // ebx@17 | |
9336 int v9; // eax@17 | |
9337 int v10; // ecx@17 | |
9338 unsigned int v11; // ecx@18 | |
9339 int v12; // eax@20 | |
9340 int v13; // eax@21 | |
9341 GUIButton *v14; // esi@27 | |
9342 int v15; // ecx@27 | |
9343 unsigned int v16; // eax@28 | |
9344 const char *v17; // ebx@29 | |
9345 int v18; // eax@29 | |
9346 unsigned int v19; // ecx@29 | |
9347 int v20; // eax@29 | |
9348 unsigned __int16 v21; // ax@29 | |
9349 unsigned __int16 v22; // ST14_2@36 | |
9350 int v23; // eax@36 | |
9351 const char *v24; // ST18_4@37 | |
9352 unsigned __int16 v25; // ST14_2@37 | |
9353 int v26; // eax@37 | |
9354 int v27; // [sp-4h] [bp-80h]@8 | |
9355 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
9356 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
9357 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
9358 int v31; // [sp+68h] [bp-14h]@1 | |
9359 int v32; // [sp+6Ch] [bp-10h]@1 | |
9360 int v33; // [sp+70h] [bp-Ch]@17 | |
9361 int v34; // [sp+74h] [bp-8h]@17 | |
9362 int v35; // [sp+78h] [bp-4h]@17 | |
9363 | |
336 | 9364 v0 = window_SpeakInHouse; |
9365 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 9366 v1 = pPlayers[uActiveCharacter]; |
9367 v28.uFrameX = 483; | |
9368 v28.uFrameWidth = 148; | |
9369 v28.uFrameZ = 334; | |
9370 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
9371 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
9372 v2 = 52 * (unsigned int)v0->ptr_1C; | |
9373 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
9374 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
9375 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
9376 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
9377 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
9378 v32 = v4; | |
9379 if ( v4 < v3 / 3 ) | |
9380 { | |
9381 v4 = v3 / 3; | |
9382 v32 = v3 / 3; | |
9383 } | |
607 | 9384 if ( dialog_menu_id != 1 ) |
0 | 9385 { |
9386 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9387 { | |
9388 v5 = 0; | |
9389 | |
9390 __debugbreak(); | |
9391 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
9392 // or | |
9393 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
9394 // or | |
9395 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
9396 | |
9397 if (false | |
9398 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 9399 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 9400 { |
9401 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
9402 } | |
9403 else | |
9404 { | |
9405 if ( pParty->uNumGold < v4 ) | |
9406 { | |
9407 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
9408 v27 = 4; | |
9409 } | |
9410 else | |
9411 { | |
9412 Party::TakeGold(v4); | |
9413 *(short *)v6 = 1; | |
9414 v27 = 2; | |
9415 } | |
735 | 9416 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 9417 } |
9418 } | |
9419 else | |
9420 { | |
9421 v5 = 0; | |
9422 } | |
437 | 9423 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 9424 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
9425 { | |
9426 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9427 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
9428 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
9429 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
9430 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 9431 }*/ |
9432 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 9433 return; // void func |
0 | 9434 } |
484 | 9435 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 9436 { |
9437 v24 = pNPCTopics[171].pText; | |
9438 v25 = v31; | |
9439 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
9440 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
9441 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 9442 return ; |
9443 } | |
9444 | |
9445 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9446 return; | |
0 | 9447 v8 = pDialogueWindow; |
9448 v33 = 0; | |
9449 v34 = 0; | |
9450 v29 = pDialogueWindow; | |
9451 v9 = pDialogueWindow->pStartingPosActiveItem; | |
9452 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
9453 v35 = pDialogueWindow->pStartingPosActiveItem; | |
9454 if ( v9 >= v10 ) | |
9455 goto LABEL_40; | |
9456 do | |
9457 { | |
9458 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 9459 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 9460 { |
9461 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
9462 v33 += v12; | |
9463 ++v34; | |
9464 } | |
9465 v13 = v8->pStartingPosActiveItem; | |
9466 ++v35; | |
9467 } | |
9468 while ( v35 < v8->pNumPresenceButton + v13 ); | |
9469 if ( !v34 ) | |
9470 { | |
9471 LABEL_40: | |
135 | 9472 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 9473 strcat(pTmpBuf, "\n \n"); |
9474 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
9475 v22 = v31; | |
9476 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 9477 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
9478 return; | |
0 | 9479 } |
9480 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
9481 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
9482 v32 = (149 - v33) / v34; | |
9483 if ( (149 - v33) / v34 > 32 ) | |
9484 v32 = 32; | |
711 | 9485 |
9486 v35 = v8->pStartingPosActiveItem; | |
0 | 9487 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 9488 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 9489 { |
9490 v33 = 2; | |
9491 do | |
9492 { | |
9493 v14 = v8->GetControl(v35); | |
9494 v15 = v14->uControlParam - 36; | |
135 | 9495 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 9496 { |
9497 v16 = 0; | |
9498 if ( !v1->pActiveSkills[v15] ) | |
9499 { | |
9500 v17 = pSkillNames[v15]; | |
9501 v14->uY = v32 + v34; | |
9502 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
9503 v19 = v14->uY; | |
9504 v14->uHeight = v18; | |
9505 v20 = v19 + v18 - 1; | |
9506 v14->uW = v20; | |
9507 v34 = v20; | |
9508 v21 = v31; | |
9509 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
9510 v21 = v30; | |
9511 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
9512 goto LABEL_34; | |
9513 } | |
9514 } | |
9515 else | |
9516 { | |
9517 v16 = 0; | |
9518 } | |
9519 v14->uW = v16; | |
9520 v14->uHeight = v16; | |
9521 v14->uY = v16; | |
9522 LABEL_34: | |
9523 v8 = v29; | |
9524 ++v35; | |
9525 ++v33; | |
711 | 9526 } |
9527 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
9528 } | |
9529 return; | |
0 | 9530 } |
9531 | |
9532 | |
9533 | |
9534 //----- (004B6943) -------------------------------------------------------- | |
9535 void __cdecl TravelByTransport() | |
9536 { | |
9537 GUIWindow *v0; // ebx@1 | |
9538 Player *v1; // esi@1 | |
9539 signed int v2; // edi@1 | |
9540 unsigned int v3; // eax@1 | |
9541 signed int v4; // ebx@1 | |
727 | 9542 stru365_travel_info *v5; // esi@7 |
0 | 9543 int v6; // eax@9 |
9544 int v7; // eax@9 | |
9545 int v8; // eax@12 | |
9546 int v9; // edi@12 | |
9547 int v10; // edx@12 | |
9548 int v11; // ecx@12 | |
9549 signed int v12; // esi@13 | |
9550 signed int v13; // edi@14 | |
9551 DWORD v14; // eax@26 | |
9552 DWORD v15; // edi@26 | |
9553 GUIWindow *v16; // ebx@36 | |
9554 int v17; // esi@36 | |
9555 int v18; // eax@36 | |
9556 int v19; // ecx@36 | |
9557 int v20; // esi@36 | |
9558 int v21; // eax@36 | |
9559 void *v22; // eax@39 | |
727 | 9560 int v23; // esi@39 |
0 | 9561 GUIButton *v24; // ebx@39 |
9562 signed int v25; // eax@41 | |
727 | 9563 //int v26; // esi@44 |
0 | 9564 const char *v27; // eax@46 |
9565 char *v28; // eax@62 | |
9566 int v29; // eax@62 | |
9567 unsigned int v30; // ecx@62 | |
9568 char *v31; // eax@63 | |
652 | 9569 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 |
9570 /*int v33; // [sp-38h] [bp-2C8h]@62 | |
0 | 9571 int v34; // [sp-34h] [bp-2C4h]@62 |
9572 int v35; // [sp-30h] [bp-2C0h]@62 | |
9573 int v36; // [sp-2Ch] [bp-2BCh]@62 | |
9574 int v37; // [sp-28h] [bp-2B8h]@62 | |
9575 int v38; // [sp-24h] [bp-2B4h]@62 | |
9576 int v39; // [sp-20h] [bp-2B0h]@62 | |
9577 int v40; // [sp-1Ch] [bp-2ACh]@62 | |
9578 int v41; // [sp-18h] [bp-2A8h]@62 | |
9579 int v42; // [sp-14h] [bp-2A4h]@62 | |
9580 char *v43; // [sp-10h] [bp-2A0h]@62 | |
9581 char *v44; // [sp-Ch] [bp-29Ch]@62 | |
9582 unsigned int v45; // [sp-8h] [bp-298h]@62 | |
9583 char *v46; // [sp-4h] [bp-294h]@62 | |
652 | 9584 const char *v47[5]; // [sp+0h] [bp-290h]@7*/ |
9585 char v48[100]; // [sp+14h] [bp-27Ch]@37 | |
9586 char v49[100]; // [sp+78h] [bp-218h]@68 | |
9587 char v50[100]; // [sp+DCh] [bp-1B4h]@68 | |
9588 char v51[100]; // [sp+140h] [bp-150h]@68 | |
9589 char Dest[100]; // [sp+1A4h] [bp-ECh]@36 | |
0 | 9590 GUIWindow v53; // [sp+208h] [bp-88h]@1 |
9591 int v54; // [sp+25Ch] [bp-34h]@36 | |
9592 int v55; // [sp+260h] [bp-30h]@36 | |
9593 unsigned int v56; // [sp+264h] [bp-2Ch]@1 | |
652 | 9594 int v57; // [sp+268h] [bp-28h]@1 |
727 | 9595 int v58; // [sp+26Ch] [bp-24h]@36 |
0 | 9596 GUIWindow *v59; // [sp+270h] [bp-20h]@1 |
9597 unsigned int v60; // [sp+274h] [bp-1Ch]@36 | |
727 | 9598 //Player *v61; // [sp+278h] [bp-18h]@1 |
0 | 9599 int v62; // [sp+27Ch] [bp-14h]@36 |
9600 int v63; // [sp+280h] [bp-10h]@14 | |
9601 char *a1; // [sp+284h] [bp-Ch]@37 | |
9602 unsigned int s1; // [sp+288h] [bp-8h]@1 | |
9603 int v66; // [sp+28Ch] [bp-4h]@48 | |
9604 | |
336 | 9605 v0 = window_SpeakInHouse; |
9606 memcpy(&v53, window_SpeakInHouse, sizeof(v53)); | |
0 | 9607 v2 = 255; |
727 | 9608 //v61 = pPlayers[uActiveCharacter]; |
9609 v1 = pPlayers[uActiveCharacter]; | |
0 | 9610 v53.uFrameX = 483; |
9611 v53.uFrameWidth = 148; | |
9612 v53.uFrameZ = 334; | |
652 | 9613 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
0 | 9614 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); |
9615 v3 = 52 * (unsigned int)v0->ptr_1C; | |
9616 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); | |
9617 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); | |
9618 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); | |
9619 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
9620 s1 = v4 * (100 - v1->GetMerchant()) / 100; | |
9621 if ( (signed int)s1 < v4 / 3 ) | |
9622 s1 = v4 / 3; | |
607 | 9623 if ( dialog_menu_id == 1 ) |
0 | 9624 { |
9625 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9626 { | |
9627 v16 = pDialogueWindow; | |
727 | 9628 v58 = -1; |
0 | 9629 v62 = 0; |
9630 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
9631 v59 = pDialogueWindow; | |
9632 v54 = v17; | |
652 | 9633 strcpy(Dest, ""); |
9634 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold | |
0 | 9635 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); |
9636 v19 = v16->pNumPresenceButton; | |
9637 v20 = v18 + v17 + 146; | |
9638 v21 = v16->pStartingPosActiveItem; | |
9639 v63 = v20; | |
9640 v55 = v20; | |
9641 v60 = v21; | |
9642 if ( v21 >= v21 + v19 ) | |
9643 goto LABEL_71; | |
9644 s1 = 2; | |
652 | 9645 a1 = v48; |
0 | 9646 while ( 1 ) |
9647 { | |
652 | 9648 int v47 = v60; |
336 | 9649 v22 = window_SpeakInHouse->ptr_1C; |
727 | 9650 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; |
9651 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 | |
9652 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land | |
0 | 9653 v24 = v16->GetControl(v60); |
9654 if ( v23 != v58 | |
727 | 9655 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), |
0 | 9656 v25 |
727 | 9657 && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) |
9658 { | |
9659 v58 = v23; | |
0 | 9660 v27 = (const char *)v56; |
9661 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) | |
652 | 9662 v27 = (const char *)v57; |
9663 //v32.uRedbookTrackID = v27; | |
690 | 9664 sprintf(a1, "\f%05d", v27); |
727 | 9665 v66 = array_4F09B0[v23].uTravelTime; |
336 | 9666 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 9667 { |
652 | 9668 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 9669 v66 -= 2; |
652 | 9670 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 9671 v66 -= 3; |
652 | 9672 //v47 = Pirate; |
9673 if ( CheckHiredNPCSpeciality(Pirate) ) | |
9674 v66 -= 2; | |
0 | 9675 } |
9676 else | |
9677 { | |
652 | 9678 //v47 = Horseman; |
9679 if ( CheckHiredNPCSpeciality(Horseman) ) | |
9680 v66 -= 2; | |
9681 } | |
9682 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 9683 --v66; |
9684 if ( v66 < 1 ) | |
9685 v66 = 1; | |
727 | 9686 if ( v23 != v2 ) |
0 | 9687 { |
727 | 9688 memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); |
652 | 9689 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s |
9690 v66, v32.pName); | |
0 | 9691 strcat(a1, pTmpBuf); |
9692 v28 = a1; | |
9693 a1 += 100; | |
9694 ++v62; | |
9695 ++s1; | |
9696 strcat(v28, "\n \n"); | |
9697 v24->uY = v63; | |
9698 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0); | |
9699 v30 = v24->uY; | |
9700 v24->uHeight = v29; | |
9701 v2 = 255; | |
9702 v24->uW = v30 + v29 - 1; | |
9703 v63 += v54 + v29; | |
9704 } | |
9705 } | |
9706 else | |
9707 { | |
9708 v31 = a1; | |
9709 ++v62; | |
9710 ++s1; | |
9711 a1 += 100; | |
9712 strcpy(v31, ""); | |
9713 if ( v24 ) | |
9714 { | |
9715 v24->uW = 0; | |
9716 v24->uHeight = 0; | |
9717 v24->uY = 0; | |
9718 } | |
9719 } | |
9720 ++v60; | |
9721 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem ) | |
9722 break; | |
9723 v16 = v59; | |
9724 } | |
9725 if ( v63 != v55 ) | |
9726 { | |
652 | 9727 /*v47[1] = &Dest; |
0 | 9728 v47[0] = &v51; |
9729 v46 = &v50; | |
9730 v45 = (unsigned int)&v49; | |
9731 v44 = &v48; | |
652 | 9732 v43 = pTmpBuf2;*/ |
9733 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); | |
0 | 9734 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); |
9735 } | |
9736 else | |
9737 { | |
9738 LABEL_71: | |
652 | 9739 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, |
9740 v57, pGlobalTXT_LocalizationStrings[561], 3); | |
0 | 9741 pAudioPlayer->StopChannels(-1, -1); |
9742 } | |
9743 } | |
9744 } | |
9745 else | |
9746 { | |
607 | 9747 if ( dialog_menu_id > 104 && dialog_menu_id <= 108 ) |
0 | 9748 { |
9749 if ( pParty->uNumGold < s1 ) | |
9750 { | |
9751 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
735 | 9752 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
437 | 9753 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9754 return; |
9755 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9756 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
437 | 9757 goto LABEL_33;*/ |
9758 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
0 | 9759 } |
9760 Party::TakeGold(s1); | |
652 | 9761 //v47[1] = (const char *)7; |
727 | 9762 v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; |
9763 if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) | |
9764 { | |
9765 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) | |
0 | 9766 { |
9767 SaveGame(1, 0); | |
727 | 9768 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); |
9769 v8 = v5->field_18; | |
9770 v9 = v5->field_14; | |
9771 v10 = v5->field_10; | |
0 | 9772 dword_6BE364_game_settings_1 |= 1u; |
9773 _5B65B8_npcdata_hiword_house_or_other = 0; | |
9774 dword_5B65BC = 0; | |
9775 _5B65B4_npcdata_loword_house_or_other = v8; | |
9776 v11 = *((int *)v5 + 3); | |
9777 uGameState = 2; | |
9778 _5B65A8_npcdata_uflags_or_other = v11; | |
9779 _5B65AC_npcdata_fame_or_other = v10; | |
9780 _5B65B0_npcdata_rep_or_other = v9; | |
9781 dword_5B65C0 = v11 | v10 | v9 | v8; | |
9782 } | |
9783 else | |
9784 { | |
727 | 9785 v6 = v5->field_C; |
0 | 9786 pParty->sRotationX = 0; |
9787 pParty->vPosition.x = v6; | |
727 | 9788 v7 = v5->field_10; |
0 | 9789 pIndoorCamera->sRotationY = 0; |
9790 pParty->uFlags |= 2u; | |
9791 pParty->vPosition.y = v7; | |
727 | 9792 pParty->vPosition.z = v5->field_14; |
0 | 9793 pParty->uFallStartY = pParty->vPosition.z; |
727 | 9794 pParty->sRotationY = v5->field_18; |
0 | 9795 } |
735 | 9796 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); |
727 | 9797 v12 = v5->uTravelTime; |
652 | 9798 int _v47; |
336 | 9799 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 9800 { |
652 | 9801 v63 = SPEECH_SetSail; |
0 | 9802 v13 = 2500; |
652 | 9803 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 9804 v12 -= 2; |
652 | 9805 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 9806 v12 -= 3; |
652 | 9807 //_v47 = 45; |
9808 if ( CheckHiredNPCSpeciality(Pirate) ) | |
9809 v12 -= 2; | |
0 | 9810 } |
9811 else | |
9812 { | |
652 | 9813 v63 = SPEECH_CarriageReady; |
0 | 9814 v13 = 1500; |
652 | 9815 //_v47 = 35; |
9816 if ( CheckHiredNPCSpeciality(Horseman) ) | |
9817 v12 -= 2; | |
9818 } | |
9819 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 9820 --v12; |
9821 if ( v12 < 1 ) | |
9822 v12 = 1; | |
9823 RestAndHeal(1440 * v12); | |
727 | 9824 v1->PlaySound((PlayerSpeech)v63, 0); |
0 | 9825 v14 = GetTickCount(); |
9826 v15 = v14 + v13; | |
9827 if ( v15 < v14 ) | |
9828 v15 = v14; | |
9829 while ( GetTickCount() < v15 ) | |
9830 sqrt(3.1415926); | |
9831 while ( sub_4BD8B5() ) | |
9832 ; | |
437 | 9833 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
9834 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 9835 { |
9836 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9837 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9838 LABEL_33: | |
9839 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9840 ++pMessageQueue_50CBD0->uNumMessages; | |
9841 return; | |
437 | 9842 }*/ |
0 | 9843 } |
9844 else | |
9845 { | |
607 | 9846 dialog_menu_id = 1; |
0 | 9847 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9848 } | |
9849 } | |
9850 } | |
9851 } | |
9852 | |
9853 | |
9854 | |
9855 | |
9856 | |
9857 //----- (00405CFF) -------------------------------------------------------- | |
9858 void stru262_TurnBased::End(bool bPlaySound) | |
9859 { | |
9860 stru262_TurnBased *v2; // edi@1 | |
9861 int v3; // ebx@1 | |
9862 int v4; // esi@1 | |
9863 unsigned __int8 v5; // zf@1 | |
9864 unsigned __int8 v6; // sf@1 | |
9865 TurnBased_QueueElem *v7; // ecx@2 | |
9866 unsigned __int16 *pAttributes; // ecx@7 | |
9867 size_t v9; // edx@7 | |
9868 unsigned __int16 v10; // ax@8 | |
9869 TurnBased_QueueElem *v11; // ebx@12 | |
9870 ObjectType objType; // eax@13 | |
9871 int objID; // esi@13 | |
9872 int v14; // [sp+Ch] [bp-4h]@11 | |
9873 | |
9874 v2 = this; | |
9875 v3 = 0; | |
9876 v4 = 0; | |
9877 v5 = this->uActorQueueSize == 0; | |
9878 v6 = this->uActorQueueSize < 0; | |
9879 this->field_4 = 0; | |
9880 if ( !(v6 | v5) ) | |
9881 { | |
9882 v7 = this->pQueue; | |
9883 do | |
9884 { | |
9885 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
9886 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
9887 ++v4; | |
9888 ++v7; | |
9889 } | |
9890 while ( v4 < v2->uActorQueueSize ); | |
9891 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9892 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9893 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9894 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9895 v9 = uNumSpriteObjects; |
0 | 9896 do |
9897 { | |
9898 v10 = *pAttributes; | |
9899 if ( *pAttributes & 4 ) | |
9900 { | |
9901 LOBYTE(v10) = v10 & 0xFB; | |
9902 *pAttributes = v10; | |
9903 } | |
9904 pAttributes += 56; | |
9905 --v9; | |
9906 } | |
9907 while ( v9 ); | |
9908 } | |
9909 v14 = 0; | |
9910 if ( v2->uActorQueueSize > 0 ) | |
9911 { | |
9912 v11 = v2->pQueue; | |
9913 do | |
9914 { | |
9915 objType = (ObjectType)(v11->uPackedID & 7); | |
9916 objID = v11->uPackedID >> 3; | |
9917 if ( objType == OBJECT_Player ) | |
9918 { | |
9919 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9920 } | |
9921 else | |
9922 { | |
9923 if ( objType == OBJECT_Actor ) | |
9924 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9925 } | |
9926 ++v14; | |
9927 ++v11; | |
9928 } | |
9929 while ( v14 < v2->uActorQueueSize ); | |
9930 v3 = 0; | |
9931 } | |
9932 pAudioPlayer->StopChannels(-1, -1); | |
9933 if ( bPlaySound != v3 ) | |
9934 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
9935 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
9936 pEventTimer->StopGameTime(); | |
9937 dword_50C994 = v3; | |
9938 dword_50C998_turnbased_icon_1A = v3; | |
9939 } | |
9940 // 50C994: using guessed type int dword_50C994; | |
9941 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
9942 | |
9943 //----- (00405E14) -------------------------------------------------------- | |
9944 void stru262_TurnBased::_405E14() | |
9945 { | |
9946 stru262_TurnBased *v1; // esi@1 | |
9947 int v2; // ecx@1 | |
9948 SpellBuff *v3; // edi@2 | |
9949 Actor *v4; // ebx@3 | |
9950 signed int v5; // edx@20 | |
9951 AIDirection *v6; // esi@21 | |
9952 int v7; // eax@21 | |
9953 int v8; // eax@21 | |
9954 int v9; // eax@22 | |
9955 int v10; // eax@23 | |
9956 int v11; // eax@37 | |
9957 int v12; // eax@44 | |
9958 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
9959 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
9960 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 9961 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 9962 int v17; // [sp+5Ch] [bp-10h]@6 |
9963 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
9964 int v19; // [sp+64h] [bp-8h]@8 | |
9965 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
9966 | |
9967 v1 = this; | |
9968 v2 = 0; | |
9969 v18 = v1; | |
9970 v20 = 0; | |
9971 if ( (signed int)uNumActors > 0 ) | |
9972 { | |
90 | 9973 //v3 = pActors;//[0].pActorBuffs; |
9974 v16 = pActors;//[0].pActorBuffs; | |
9975 v3 = v16->pActorBuffs; | |
0 | 9976 do |
9977 { | |
90 | 9978 v4 = v16; |
9979 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 9980 v17 = v2; |
9981 else | |
9982 v17 = 1; | |
9983 v19 = v2; | |
9984 do | |
9985 { | |
9986 if ( v19 != 10 ) | |
9987 { | |
9988 v3->_4585CA(pParty->uTimePlayed); | |
9989 v2 = 0; | |
9990 } | |
9991 ++v19; | |
9992 ++v3; | |
9993 } | |
9994 while ( v19 < 22 ); | |
9995 if ( v17 != v2 | |
9996 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
9997 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
9998 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
9999 if ( !(v4->uAttributes & 0x80) ) | |
10000 { | |
10001 if ( !v4->pActorBuffs[5].uExpireTime ) | |
10002 { | |
10003 if ( !v4->pActorBuffs[6].uExpireTime ) | |
10004 { | |
10005 v5 = v4->uCurrentActionLength; | |
10006 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
10007 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
10008 { | |
417 | 10009 v17 = ai_near_actors_targets_pid[v20]; |
10010 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 10011 v7 = v4->uAIState; |
10012 memcpy(&v15, v6, sizeof(v15)); | |
10013 v8 = v7 - 4; | |
10014 memcpy(&v14, &v15, sizeof(v14)); | |
10015 if ( v8 ) | |
10016 { | |
10017 v9 = v8 - 1; | |
10018 if ( v9 ) | |
10019 { | |
10020 v10 = v9 - 6; | |
10021 if ( v10 ) | |
10022 { | |
10023 if ( v10 != 8 ) | |
414 | 10024 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 10025 } |
10026 } | |
10027 } | |
10028 else | |
10029 { | |
10030 v4->uCurrentActionTime = 0; | |
10031 v4->uCurrentActionLength = 0; | |
10032 v4->uAIState = Dead; | |
10033 v4->UpdateAnimation(); | |
10034 } | |
10035 v1 = v18; | |
10036 v2 = 0; | |
10037 } | |
10038 } | |
10039 } | |
10040 } | |
10041 ++v20; | |
90 | 10042 v3 = v16[1].pActorBuffs; |
10043 ++v16; | |
0 | 10044 } |
10045 while ( (signed int)v20 < (signed int)uNumActors ); | |
10046 } | |
10047 if ( v1->field_4 == 1 ) | |
10048 { | |
10049 v12 = v1->field_8; | |
10050 if ( v12 == 64 ) | |
10051 { | |
10052 v1->_406A63(); | |
10053 } | |
10054 else | |
10055 { | |
10056 if ( v12 > v2 ) | |
10057 { | |
10058 v1->_406B9F(); | |
10059 } | |
10060 else | |
10061 { | |
10062 v1->_406AFE(); | |
10063 v1->field_10 = 100; | |
10064 } | |
10065 } | |
10066 v1->field_8 -= pEventTimer->uTimeElapsed; | |
10067 return; | |
10068 } | |
10069 if ( v1->field_4 == 2 ) | |
10070 { | |
10071 if ( !(v1->field_18 & 1) ) | |
10072 { | |
10073 v11 = v1->field_10; | |
10074 if ( v11 == 100 ) | |
10075 { | |
10076 v1->StartTurn(); | |
10077 LABEL_39: | |
10078 v1->_40652A(); | |
10079 return; | |
10080 } | |
10081 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
10082 { | |
10083 v1->_4065B0(); | |
10084 goto LABEL_39; | |
10085 } | |
10086 } | |
10087 v1->NextTurn(); | |
10088 return; | |
10089 } | |
10090 if ( v1->field_4 == 3 ) | |
10091 { | |
10092 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
10093 { | |
10094 v1->field_18 &= 0xFFFFFFF7u; | |
10095 v1->field_4 = 1; | |
10096 v1->field_8 = 64; | |
10097 } | |
10098 else | |
10099 { | |
10100 v1->_406FA8(); | |
10101 } | |
10102 } | |
10103 } | |
10104 | |
10105 | |
10106 | |
10107 | |
10108 //----- (0043FDED) -------------------------------------------------------- | |
10109 void PrepareActorRenderList_BLV() | |
10110 { | |
10111 RenderBillboard *v0; // esi@0 | |
10112 unsigned __int16 v3; // ax@3 | |
10113 unsigned int v4; // eax@5 | |
10114 unsigned __int16 v5; // cx@5 | |
10115 int v6; // esi@5 | |
10116 unsigned int v7; // eax@7 | |
10117 int v8; // eax@10 | |
10118 SpriteFrame *v9; // eax@16 | |
10119 SpriteFrame *v10; // ebx@18 | |
10120 //int *v11; // eax@18 | |
10121 int v12; // ecx@28 | |
10122 //IndoorCameraD3D **v14; // eax@36 | |
10123 double v15; // st7@36 | |
10124 float v16; // eax@36 | |
10125 //double v17; // ST30_8@36 | |
10126 signed __int64 v18; // qtt@36 | |
10127 int v19; // ST5C_4@36 | |
10128 signed __int64 v20; // qtt@37 | |
10129 int v21; // ST5C_4@37 | |
10130 signed __int16 v22; // cx@39 | |
10131 int v23; // ST50_4@40 | |
10132 signed int v24; // ecx@40 | |
10133 int v25; // edx@44 | |
10134 __int16 v26; // ax@44 | |
10135 //MonsterDesc *v27; // edx@44 | |
10136 //int v28; // ecx@44 | |
10137 unsigned __int8 v29; // zf@44 | |
10138 unsigned __int8 v30; // sf@44 | |
10139 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
10140 int v32; // [sp+1Ch] [bp-38h]@5 | |
10141 int a3; // [sp+20h] [bp-34h]@5 | |
10142 int a2; // [sp+24h] [bp-30h]@5 | |
10143 int a1a; // [sp+28h] [bp-2Ch]@5 | |
10144 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
10145 int a5a; // [sp+2Ch] [bp-28h]@36 | |
10146 int a5b; // [sp+2Ch] [bp-28h]@40 | |
10147 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
10148 int a6; // [sp+40h] [bp-14h]@34 | |
10149 int v43; // [sp+44h] [bp-10h]@34 | |
10150 int z; // [sp+48h] [bp-Ch]@32 | |
10151 signed int y; // [sp+4Ch] [bp-8h]@32 | |
10152 int x; // [sp+50h] [bp-4h]@32 | |
10153 | |
10154 for (uint i = 0; i < uNumActors; ++i) | |
10155 { | |
10156 auto p = pActors + i; | |
10157 | |
10158 if (p->uAIState == Removed || | |
10159 p->uAIState == Disabled) | |
10160 continue; | |
10161 | |
10162 a5 = p->uSectorID; | |
10163 a2 = p->vPosition.y; | |
10164 a1a = p->vPosition.x; | |
10165 a3 = p->vPosition.z; | |
10166 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
10167 LOWORD(v0) = p->uYawAngle; | |
10168 v5 = p->uCurrentActionAnimation; | |
10169 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
10170 v32 = v6; | |
10171 if ( pParty->bTurnBasedModeOn ) | |
10172 { | |
10173 if ( v5 == 1 ) | |
10174 { | |
10175 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
10176 goto LABEL_10; | |
10177 } | |
10178 } | |
10179 else | |
10180 { | |
10181 if ( v5 == 1 ) | |
10182 { | |
10183 v7 = pBLVRenderParams->field_0_timer_; | |
10184 LABEL_10: | |
10185 v8 = i * 32 + v7; | |
10186 goto LABEL_12; | |
10187 } | |
10188 } | |
10189 v8 = p->uCurrentActionTime; | |
10190 LABEL_12: | |
10191 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
10192 v8 = 0; | |
10193 v31 = p->pSpriteIDs[v5]; | |
10194 if (p->uAIState == Resurrected) | |
10195 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
10196 else | |
10197 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
10198 v41 = 0; | |
10199 v10 = v9; | |
10200 //v11 = (int *)v9->uFlags; | |
10201 if (v9->uFlags & 2) | |
10202 v41 = 2; | |
10203 if (v9->uFlags & 0x40000) | |
10204 v41 |= 0x40u; | |
10205 if (v9->uFlags & 0x20000) | |
10206 LOBYTE(v41) = v41 | 0x80; | |
10207 v0 = (RenderBillboard *)(256 << v6); | |
10208 if ( (unsigned int)v0 & v9->uFlags) | |
10209 v41 |= 4u; | |
10210 if ( v10->uGlowRadius ) | |
10211 { | |
10212 //LOBYTE(v11) = byte_4E94D3; | |
10213 pMobileLightsStack->AddLight( | |
10214 a1a, | |
10215 a2, | |
10216 a3, | |
10217 a5, | |
10218 v10->uGlowRadius, | |
10219 0xFFu, | |
10220 0xFFu, | |
10221 0xFFu, | |
10222 byte_4E94D3); | |
10223 } | |
10224 v12 = 0; | |
10225 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
10226 continue; | |
10227 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
10228 { | |
10229 ++v12; | |
10230 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
10231 goto _continue; | |
10232 } | |
10233 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
10234 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
10235 continue; | |
10236 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
10237 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
10238 if (uNumBillboardsToDraw >= 500) | |
10239 break; | |
10240 ++uNumBillboardsToDraw; | |
10241 ++uNumSpritesDrawnThisFrame; | |
10242 p->uAttributes |= 8u; | |
10243 v29 = pRenderer->pRenderD3D == 0; | |
10244 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
10245 v0->uPalette = v10->uPaletteIndex; | |
10246 v0->uIndoorSectorID = a5; | |
10247 if ( v29 ) | |
10248 { | |
10249 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
10250 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
10251 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10252 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 10253 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
10254 } | |
10255 else | |
10256 { | |
10257 //v14 = &pGame->pIndoorCameraD3D; | |
10258 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
10259 v15 = pGame->pIndoorCameraD3D->fov_y; | |
10260 v16 = v0->fov_x; | |
10261 v0->fov_y = v15; | |
10262 //v17 = v16 + 6.7553994e15; | |
10263 LODWORD(v18) = 0; | |
10264 HIDWORD(v18) = floorf(v16 + 0.5f); | |
10265 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10266 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 10267 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
10268 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10269 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 10270 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
10271 { | |
10272 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
10273 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10274 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 10275 goto LABEL_43; |
10276 } | |
10277 } | |
10278 else | |
10279 { | |
10280 v22 = p->pActorBuffs[3].uPower; | |
10281 if ( v22 ) | |
10282 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10283 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 10284 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10285 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10286 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 10287 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10288 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 10289 goto LABEL_44; |
10290 } | |
10291 } | |
10292 LABEL_44: | |
10293 HIWORD(v25) = HIWORD(x); | |
430 | 10294 v0->world_x = a1a; |
10295 v0->world_y = a2; | |
10296 v0->world_z = a3; | |
0 | 10297 v0->uScreenSpaceX = v43; |
10298 v0->uScreenSpaceY = a6; | |
10299 LOWORD(v25) = 0; | |
10300 LOBYTE(v26) = v41; | |
194 | 10301 |
10302 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
10303 v0->actual_z = HIWORD(x); | |
10304 v0->object_pid = v8 * i | OBJECT_Actor; | |
10305 | |
0 | 10306 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
10307 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
10308 v0->field_1E = v41; | |
10309 v0->pSpriteFrame = v10; | |
10310 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
10311 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
10312 { | |
10313 HIBYTE(v26) = HIBYTE(v41) | 1; | |
10314 v0->field_1E = v26; | |
10315 } | |
10316 | |
10317 _continue: | |
10318 ; | |
10319 } | |
10320 } | |
10321 | |
10322 | |
10323 | |
10324 | |
10325 //----- (00444732) -------------------------------------------------------- | |
428 | 10326 char *GetEventHintString(unsigned int uEventID) |
10327 { | |
10328 signed int event_index; // edx@1 | |
10329 int event_pos; // esi@4 | |
0 | 10330 char *result; // eax@6 |
428 | 10331 unsigned int str_index; // eax@9 |
10332 int i; // esi@11 | |
10333 _evt_raw* test_evt; | |
10334 _evt_raw* last_evt; | |
10335 | |
10336 event_index = 0; | |
10337 if ( uLevelEVT_NumEvents <= 0 ) | |
10338 return NULL; | |
10339 | |
10340 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 10341 while ( 1 ) |
10342 { | |
428 | 10343 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
10344 { | |
10345 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
10346 last_evt=test_evt; | |
10347 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
10348 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 10349 break; |
10350 } | |
428 | 10351 ++event_index; |
10352 if ( event_index >= uLevelEVT_NumEvents ) | |
10353 return NULL; | |
10354 } | |
10355 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
10356 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
10357 { | |
10358 str_index = EVT_DWORD(test_evt->v5); | |
10359 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 10360 } |
10361 else | |
10362 { | |
428 | 10363 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
10364 { | |
10365 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
10366 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
10367 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
10368 { | |
10369 str_index = EVT_DWORD(test_evt->v5); | |
10370 if ( str_index < 600 ) | |
10371 return (char *)p2DEvents[str_index - 1].pName; | |
10372 } | |
10373 } | |
10374 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
10375 } | |
10376 | |
0 | 10377 return result; |
10378 } | |
10379 | |
10380 | |
10381 | |
10382 | |
10383 //----- (00444839) -------------------------------------------------------- | |
10384 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) | |
10385 { | |
10386 unsigned int v9; // ebx@1 | |
10387 int v10; // edi@1 | |
373 | 10388 //signed int v11; // eax@1 |
0 | 10389 unsigned int v12; // eax@6 |
10390 const char *v13; // ST0C_4@6 | |
10391 unsigned int v14; // eax@8 | |
10392 const char *v15; // eax@14 | |
10393 unsigned int v16; // eax@16 | |
10394 unsigned int result; // eax@26 | |
10395 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 10396 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 10397 char *v20; // [sp-4h] [bp-3Ch]@9 |
10398 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
10399 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
10400 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
10401 | |
10402 v9 = a1; | |
10403 v10 = a2; | |
10404 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
10405 dword_59117C_teleportx = x; | |
10406 dword_591178_teleporty = y; | |
10407 dword_591174_teleportz = z; | |
10408 dword_591170_teleport_directiony = directiony; | |
10409 dword_59116C_teleport_directionx = directionx; | |
10410 dword_591168_teleport_speedz = a8; | |
10411 dword_591164_teleport_map_name = (char *)pLocationName; | |
10412 uCurrentHouse_Animation = v9; | |
10413 pEventTimer->Pause(); | |
10414 pAudioPlayer->StopChannels(-1, -1); | |
373 | 10415 |
10416 switch (pParty->alignment) | |
10417 { | |
10418 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
10419 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
10420 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
10421 default: assert(false); | |
10422 } | |
10423 /*v11 = const_2(); | |
0 | 10424 sprintf(pContainer, "evt%02d", v11); |
10425 if ( pParty->uAlignment ) | |
10426 { | |
10427 if ( pParty->uAlignment != 2 ) | |
10428 goto LABEL_6; | |
10429 v19 = "-c"; | |
10430 } | |
10431 else | |
10432 { | |
10433 v19 = "-b"; | |
10434 } | |
373 | 10435 strcat(pContainer, v19);*/ |
10436 | |
10437 //LABEL_6: | |
0 | 10438 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
10439 v13 = pHouse_ExitPictures[v10]; | |
10440 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
10441 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
10442 if ( v9 ) | |
10443 { | |
10444 if ( !v23 ) | |
10445 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 10446 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 10447 } |
10448 else | |
10449 { | |
10450 if ( !v23 ) | |
10451 { | |
10452 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
10453 if ( v14 ) | |
10454 { | |
721 | 10455 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 10456 goto LABEL_20; |
10457 } | |
10458 v21 = pGlobalTXT_LocalizationStrings[79]; | |
10459 goto LABEL_19; | |
10460 } | |
10461 } | |
10462 v15 = pLocationName; | |
10463 if ( *pLocationName == 48 ) | |
10464 v15 = pCurrentMapName; | |
10465 v16 = pMapStats->GetMapInfo(v15); | |
10466 if ( v16 ) | |
10467 { | |
721 | 10468 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
10469 goto LABEL_20; | |
0 | 10470 } |
10471 v21 = pGlobalTXT_LocalizationStrings[73]; | |
10472 LABEL_19: | |
423 | 10473 strcpy(sHouseName, v21); |
0 | 10474 LABEL_20: |
710 | 10475 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 10476 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 10477 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 10478 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 10479 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 10480 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 10481 result = v23; |
10482 if ( v23 ) | |
10483 uCurrentHouse_Animation = v23; | |
10484 return result; | |
10485 } | |
10486 |