Mercurial > mm7
annotate mm7_4.cpp @ 735:6daaa2f18d0d
Fixed some house sounds & shop-related stuff
author | Nomad |
---|---|
date | Fri, 22 Mar 2013 20:01:46 +0200 |
parents | 2f4e33c1ed24 |
children | 225d92620998 4b06e19fcdbc |
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 | |
364 if ( pSector->field_0 & 8 ) | |
365 { | |
366 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
367 { | |
368 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
369 if (portal->uPolygonType != POLYGON_Floor) | |
370 continue; | |
371 | |
723 | 372 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
373 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
374 { | |
0 | 375 for (uint j = 0; j < portal->uNumVertices; ++j) |
376 { | |
730 | 377 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
378 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
379 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
380 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
381 } | |
382 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
383 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 384 v54 = 0; |
730 | 385 v49 = word_721390_ys[0] >= y; |
435 | 386 if ( portal->uNumVertices > 0 ) |
0 | 387 { |
723 | 388 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) |
0 | 389 { |
390 if ( v54 >= 2 ) | |
391 break; | |
730 | 392 v47 = word_721390_ys[i + 1] >= y; |
0 | 393 if ( v49 != v47 ) |
394 { | |
730 | 395 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; |
396 v29 = v28 | word_721460_xs[i] < x; | |
0 | 397 if ( v29 != 3 ) |
398 { | |
723 | 399 if ( !v29 ) |
729 | 400 ++v54; |
401 else | |
402 { | |
730 | 403 //v30 = word_721390_ys[v27]; |
404 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
405 v32 = y - word_721390_ys[i]; | |
729 | 406 LODWORD(v33) = v32 << 16; |
407 HIDWORD(v33) = v32 >> 16; | |
730 | 408 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 | 409 ++v54; |
729 | 410 } |
0 | 411 } |
412 } | |
413 v49 = v47; | |
414 } | |
415 if ( v54 == 1 ) | |
416 { | |
417 if ( v55 >= 50 ) | |
418 break; | |
419 v34 = v55++; | |
725 | 420 blv_floor_level[v34] = -29000; |
730 | 421 blv_floor_id[v34] = pSector->pPortals[i]; |
0 | 422 } |
423 } | |
424 } | |
425 } | |
426 } | |
427 if ( v55 == 1 ) | |
428 { | |
730 | 429 *pFaceID = blv_floor_id[0]; |
725 | 430 return blv_floor_level[0]; |
0 | 431 } |
432 if ( !v55 ) | |
433 return -30000; | |
730 | 434 *pFaceID = blv_floor_id[0]; |
725 | 435 //result = blv_floor_level[0]; |
0 | 436 if ( v55 > 1 ) |
437 { | |
717 | 438 for ( v35 = 1; v35 < v55; ++v35 ) |
0 | 439 { |
725 | 440 if ( blv_floor_level[0] <= z + 5 ) |
441 { | |
442 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 443 continue; |
725 | 444 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 445 *pFaceID = blv_floor_id[v35]; |
717 | 446 continue; |
447 } | |
725 | 448 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
449 { | |
450 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 451 *pFaceID = blv_floor_id[v35]; |
717 | 452 } |
453 } | |
0 | 454 } |
725 | 455 return blv_floor_level[0]; |
0 | 456 } |
457 | |
458 //----- (0046D49E) -------------------------------------------------------- | |
723 | 459 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7) |
0 | 460 { |
723 | 461 BSPModel *pBModel; // esi@4 |
462 ODMFace *pFace; // ecx@11 | |
0 | 463 int v14; // edx@20 |
464 signed int v18; // edx@26 | |
465 int v19; // eax@28 | |
466 int v20; // edx@30 | |
467 int v21; // ST1C_4@30 | |
468 signed int v22; // edx@30 | |
469 signed __int64 v23; // qtt@30 | |
470 int v24; // eax@36 | |
471 signed int v25; // ecx@38 | |
472 int result; // eax@42 | |
473 signed int v27; // ecx@43 | |
474 int v28; // edi@44 | |
475 signed int v29; // edx@44 | |
476 int v30; // esi@45 | |
477 int v31; // eax@45 | |
478 ODMFace *v32; // eax@57 | |
479 int v33; // ecx@59 | |
480 int v36; // [sp+14h] [bp-2Ch]@24 | |
481 int v38; // [sp+1Ch] [bp-24h]@2 | |
482 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 483 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
484 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 485 bool v43; // [sp+30h] [bp-10h]@22 |
486 bool v44; // [sp+34h] [bp-Ch]@24 | |
487 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
488 signed int v48; // [sp+58h] [bp+18h]@22 | |
489 signed int v49; // [sp+58h] [bp+18h]@43 | |
490 | |
491 v46 = 1; | |
492 dword_721160[0] = -1; | |
493 dword_721110[0] = -1; | |
725 | 494 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7); |
0 | 495 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 496 { |
497 *a6 = 0; | |
725 | 498 return odm_floor_level[0]; |
723 | 499 } |
0 | 500 v38 = 0; |
723 | 501 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
502 { | |
503 pBModel = &pOutdoor->pBModels[v38]; | |
504 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
505 { | |
506 if ( (signed int)pBModel->uNumFaces > 0 ) | |
507 { | |
508 v39 = 0; | |
509 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
510 { | |
511 pFace = &pBModel->pFaces[v39]; | |
512 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
513 && !(pFace->uAttributes & 0x20000000) | |
514 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
515 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 516 { |
723 | 517 if ( pFace->uNumVertices ) |
0 | 518 { |
723 | 519 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 520 { |
723 | 521 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
522 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
523 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
524 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
525 } | |
526 } | |
527 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
528 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
529 v43 = word_720F70[0] >= Y; | |
530 v48 = 0; | |
531 if ( 2 * pFace->uNumVertices > 0 ) | |
532 { | |
533 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
534 { | |
535 if ( v48 >= 2 ) | |
536 break; | |
537 v36 = word_720F70[i + 1]; | |
538 v44 = word_720F70[i + 1] >= Y; | |
539 if ( v43 != v44 ) | |
0 | 540 { |
723 | 541 v18 = word_721040[i + 1] >= X ? 0 : 2; |
542 v19 = v18 | word_721040[i] < X; | |
543 if ( v19 != 3 ) | |
0 | 544 { |
723 | 545 if ( !v19 ) |
0 | 546 { |
723 | 547 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
548 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
549 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
550 if ( v22 >= X) | |
551 ++v48; | |
0 | 552 } |
553 } | |
554 } | |
723 | 555 v43 = v44; |
556 } | |
557 if ( v48 == 1 ) | |
558 { | |
559 if ( v46 >= 20 ) | |
0 | 560 break; |
723 | 561 if ( pFace->uPolygonType == POLYGON_Floor ) |
562 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
563 else | |
725 | 564 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
565 + HIWORD(pFace->zCalc3); | |
723 | 566 v25 = v46++; |
725 | 567 odm_floor_level[v25] = v24; |
723 | 568 dword_721160[v25] = pBModelNum; |
569 dword_721110[v25] = pFaceNum; | |
0 | 570 } |
571 } | |
572 } | |
723 | 573 ++v39; |
574 } | |
575 } | |
576 } | |
0 | 577 ++v38; |
578 } | |
579 if ( v46 == 1 ) | |
580 { | |
581 *a6 = 0; | |
725 | 582 return odm_floor_level[0]; |
0 | 583 } |
584 v27 = 0; | |
585 if ( v46 <= 1 ) | |
586 *a6 = 0; | |
723 | 587 else |
588 { | |
725 | 589 //v29 = 1; |
723 | 590 for ( v49 = 1; v49 < v46; ++v49 ) |
591 { | |
725 | 592 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 593 { |
594 v27 = v49; | |
725 | 595 //++v29; |
723 | 596 break; |
597 } | |
725 | 598 if ( odm_floor_level[0] > Z + 5 ) |
599 { | |
600 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
601 { | |
602 //++v29; | |
723 | 603 break; |
604 } | |
605 v27 = v49; | |
725 | 606 //++v29; |
723 | 607 break; |
608 } | |
725 | 609 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 610 { |
611 v27 = v49; | |
725 | 612 //++v29; |
723 | 613 } |
614 } | |
615 if ( !v27 ) | |
616 *a6 = 0; | |
617 else | |
618 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
619 } | |
0 | 620 if ( v27 ) |
621 { | |
622 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
623 *a5 = 0; | |
624 if ( v32->uAttributes & 0x10 ) | |
625 *a5 = 1; | |
626 } | |
725 | 627 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
628 odm_floor_level[0] = odm_floor_level[v27]; | |
629 return odm_floor_level[0]; | |
0 | 630 } |
631 | |
632 //----- (0046D8E3) -------------------------------------------------------- | |
633 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
634 { | |
635 int v4; // ebx@1 | |
636 unsigned int v5; // ecx@1 | |
637 BSPModel *v6; // edi@3 | |
638 ODMFace *v7; // esi@10 | |
639 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
640 signed __int16 *v9; // eax@18 |
0 | 641 int v10; // edx@19 |
642 int v11; // ecx@21 | |
643 int v12; // ecx@23 | |
644 signed int v13; // eax@25 | |
645 int v14; // edx@27 | |
646 int v15; // edx@29 | |
647 int v16; // ST18_4@29 | |
648 signed int v17; // edx@29 | |
649 signed __int64 v18; // qtt@29 | |
650 int v19; // eax@35 | |
651 signed int v20; // ecx@37 | |
652 signed int v22; // ebx@42 | |
653 unsigned int v23; // esi@43 | |
654 int v24; // edx@44 | |
655 int v25; // eax@44 | |
656 int v26; // [sp+Ch] [bp-38h]@7 | |
657 int v27; // [sp+10h] [bp-34h]@21 | |
658 int v28; // [sp+18h] [bp-2Ch]@21 | |
659 int v29; // [sp+1Ch] [bp-28h]@2 | |
660 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
661 signed int v31; // [sp+24h] [bp-20h]@1 | |
662 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
663 int v33; // [sp+2Ch] [bp-18h]@7 | |
664 bool v34; // [sp+30h] [bp-14h]@21 | |
665 bool v35; // [sp+34h] [bp-10h]@23 | |
666 signed int v36; // [sp+38h] [bp-Ch]@17 | |
667 signed int v37; // [sp+38h] [bp-Ch]@21 | |
668 signed int v38; // [sp+38h] [bp-Ch]@42 | |
669 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
670 signed int v40; // [sp+40h] [bp-4h]@1 | |
671 | |
672 dword_720ED0[0] = -1; | |
673 dword_720E80[0] = -1; | |
674 v4 = a1; | |
675 v5 = 0; | |
676 v40 = a2; | |
677 v31 = v4; | |
678 v39 = 1; | |
679 dword_720F20[0] = 10000; | |
680 v32 = 0; | |
681 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
682 { | |
683 v29 = 0; | |
684 do | |
685 { | |
686 v6 = &pOutdoor->pBModels[v29]; | |
687 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
688 { | |
689 if ( v4 >= v6->sMinX ) | |
690 { | |
691 if ( v40 <= v6->sMaxY ) | |
692 { | |
693 if ( v40 >= v6->sMinY ) | |
694 { | |
695 v33 = v5; | |
696 v26 = v6->uNumFaces; | |
697 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
698 { | |
699 v30 = v5; | |
700 while ( 1 ) | |
701 { | |
702 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
703 v8 = v7->uPolygonType; | |
704 if ( (v8 == 5 || v8 == 6) | |
705 && !(BYTE3(v7->uAttributes) & 0x20) | |
706 && v4 <= v7->pBoundingBox.x2 | |
707 && v4 >= v7->pBoundingBox.x1 | |
708 && v40 <= v7->pBoundingBox.y2 | |
709 && v40 >= v7->pBoundingBox.y1 ) | |
710 { | |
711 v36 = v5; | |
712 if ( v7->uNumVertices ) | |
713 { | |
714 v9 = v7->pXInterceptDisplacements; | |
715 do | |
716 { | |
717 v10 = 2 * v36; | |
718 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
719 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
720 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
721 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
722 ++v9; | |
723 } | |
724 while ( v36 < v7->uNumVertices ); | |
725 v4 = v31; | |
726 } | |
727 v27 = 2 * v7->uNumVertices; | |
728 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
729 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
730 v11 = 0; | |
731 v34 = word_720CE0_ys[0] >= v40; | |
732 v37 = 0; | |
733 v28 = 0; | |
734 if ( v27 > 0 ) | |
735 { | |
736 do | |
737 { | |
738 if ( v37 >= 2 ) | |
739 break; | |
740 v12 = v11; | |
741 v4 = v31; | |
742 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
743 if ( v34 != v35 ) | |
744 { | |
745 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
746 v14 = v13 | word_720DB0_xs[v12] < v31; | |
747 if ( v14 != 3 ) | |
748 { | |
749 if ( !v14 | |
750 || (v15 = word_720CE0_ys[v12], | |
751 v16 = word_720CE0_ys[v12 + 1] - v15, | |
752 v17 = v40 - v15, | |
753 LODWORD(v18) = v17 << 16, | |
754 HIDWORD(v18) = v17 >> 16, | |
755 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
756 - (signed int)word_720DB0_xs[v12]) | |
757 * v18 | |
758 / v16) >> 16) | |
759 + word_720DB0_xs[v12]) >= v31) ) | |
760 ++v37; | |
761 } | |
762 } | |
763 v11 = v28 + 1; | |
764 v34 = v35; | |
765 ++v28; | |
766 } | |
767 while ( v28 < v27 ); | |
768 if ( v37 == 1 ) | |
769 { | |
770 if ( v39 >= 20 ) | |
771 break; | |
772 if ( v7->uPolygonType == 5 ) | |
773 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
774 else | |
775 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
776 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
777 + HIWORD(v7->zCalc3); | |
778 v20 = v39++; | |
779 dword_720F20[v20] = v19; | |
780 dword_720ED0[v20] = v32; | |
781 dword_720E80[v20] = v33; | |
782 } | |
783 } | |
784 } | |
785 ++v33; | |
786 v30 += 308; | |
787 if ( v33 >= v26 ) | |
788 break; | |
789 v5 = 0; | |
790 } | |
791 } | |
792 } | |
793 } | |
794 } | |
795 } | |
796 ++v32; | |
797 ++v29; | |
798 v5 = 0; | |
799 } | |
800 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
801 if ( !v39 ) | |
802 { | |
803 *(int *)a4 = 0; | |
804 return dword_720F20[0]; | |
805 } | |
806 } | |
807 v22 = 0; | |
808 v38 = v5; | |
809 if ( v39 <= (signed int)v5 ) | |
810 goto LABEL_54; | |
811 v23 = 0; | |
812 do | |
813 { | |
814 v24 = dword_720F20[v5 / 4]; | |
815 v25 = *(int *)((char *)dword_720F20 + v23); | |
816 if ( v24 == v25 ) | |
817 goto LABEL_50; | |
818 if ( v25 > a3 + 15 ) | |
819 { | |
820 if ( v24 >= v25 ) | |
821 goto LABEL_51; | |
822 LABEL_50: | |
823 v22 = v38; | |
824 v23 = v5; | |
825 goto LABEL_51; | |
826 } | |
827 if ( v24 > v25 && v24 <= a3 + 15 ) | |
828 goto LABEL_50; | |
829 LABEL_51: | |
830 ++v38; | |
831 v5 += 4; | |
832 } | |
833 while ( v38 < v39 ); | |
834 if ( v22 ) | |
835 { | |
836 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
837 return dword_720F20[v22]; | |
838 } | |
839 LABEL_54: | |
840 *(int *)a4 = 0; | |
841 return dword_720F20[v22]; | |
842 } | |
843 | |
138 | 844 |
845 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal | |
846 // for a right-handed system, that would be an inverse normal | |
0 | 847 //----- (0046DCC8) -------------------------------------------------------- |
138 | 848 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
849 { | |
850 auto grid_x = WorldPosToGridCellX(pos_x); | |
851 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
852 | |
853 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
854 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
855 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
856 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
857 | |
858 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
859 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
860 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
861 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
862 | |
863 float side1_dx, side1_dy, side1_dz, | |
864 side2_dx, side2_dy, side2_dz; | |
865 | |
866 auto dx = abs(pos_x - grid_pos_x1), | |
867 dz = abs(grid_pos_z1 - pos_z); | |
868 if (dz >= dx) | |
869 { | |
870 side1_dy = (double)(x1z1_y - x1z2_y); | |
871 side2_dy = (double)(x2z2_y - x1z2_y); | |
872 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
873 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
874 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
875 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 876 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 877 /* |\ |
878 side1 | \ | |
879 |____\ | |
880 side 2 */ | |
881 } | |
882 else | |
883 { | |
884 side1_dy = (double)(x2z2_y - x2z1_y); | |
885 side2_dy = (double)(x1z1_y - x2z1_y); | |
886 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
887 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
888 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
889 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
890 | |
891 /* side 2 | |
892 _____ | |
893 \ | | |
894 \ | side 1 | |
895 \| */ | |
896 } | |
897 | |
898 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
899 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
900 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
901 | |
902 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
903 if (fabsf(mag) < 1e-6f) | |
904 { | |
905 out->y = 0; | |
906 out->x = 0; | |
907 out->z = 65536; | |
908 } | |
909 else | |
910 { | |
911 float invmag = 1.0 / mag; | |
912 out->x = invmag * nx * 65536.0; | |
913 out->y = invmag * ny * 65536.0; | |
914 out->z = invmag * nz * 65536.0; | |
915 } | |
916 } | |
917 | |
0 | 918 |
919 //----- (0046DEF2) -------------------------------------------------------- | |
920 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
921 { | |
922 unsigned int result; // eax@1 | |
923 | |
924 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
925 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 926 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
927 return result; | |
928 } | |
929 | |
930 //----- (0046DF1A) -------------------------------------------------------- | |
931 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
932 { | |
933 Actor *v2; // edi@1 | |
934 unsigned __int16 v3; // ax@1 | |
935 int v4; // esi@6 | |
936 int v5; // ecx@8 | |
937 int v6; // eax@10 | |
938 int v7; // edx@12 | |
939 int v8; // ecx@14 | |
940 int v9; // eax@14 | |
941 int v10; // ebx@14 | |
942 int v11; // esi@14 | |
943 int v12; // ebx@15 | |
944 int v13; // ebx@17 | |
945 unsigned int v14; // eax@20 | |
946 signed int result; // eax@21 | |
947 int v16; // [sp+Ch] [bp-10h]@1 | |
948 int v17; // [sp+10h] [bp-Ch]@14 | |
949 int v18; // [sp+14h] [bp-8h]@14 | |
950 int v19; // [sp+18h] [bp-4h]@14 | |
951 | |
952 v16 = a1; | |
953 v2 = &pActors[a1]; | |
954 v3 = v2->uAIState; | |
955 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
956 goto LABEL_25; | |
957 v4 = v2->uActorRadius; | |
958 if ( a2 ) | |
959 v4 = a2; | |
960 v5 = v2->vPosition.x; | |
961 if ( stru_721530.sMaxX > v5 + v4 | |
962 || stru_721530.sMinX < v5 - v4 | |
963 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
964 || stru_721530.sMinY < v6 - v4 | |
965 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
966 || stru_721530.sMinZ < v7 | |
967 || (v8 = v5 - stru_721530.normal.x, | |
968 v9 = v6 - stru_721530.normal.y, | |
969 v10 = stru_721530.prolly_normal_d + v4, | |
970 v17 = stru_721530.prolly_normal_d + v4, | |
971 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
972 v18 = v8, | |
973 v19 = v9, | |
974 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
975 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
976 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
977 { | |
978 LABEL_25: | |
979 result = 0; | |
980 } | |
981 else | |
982 { | |
295 | 983 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 984 if ( v13 < 0 ) |
985 v13 = 0; | |
986 if ( v13 < stru_721530.field_7C ) | |
987 { | |
988 stru_721530.field_7C = v13; | |
989 v14 = 8 * v16; | |
990 LOBYTE(v14) = 8 * v16 | 3; | |
991 stru_721530.uFaceID = v14; | |
992 } | |
993 result = 1; | |
994 } | |
995 return result; | |
996 } | |
997 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
998 | |
999 //----- (0046E0B2) -------------------------------------------------------- | |
1000 void __cdecl _46E0B2_collide_against_decorations() | |
1001 { | |
1002 BLVSector *v0; // ebp@1 | |
1003 LevelDecoration *v1; // edi@2 | |
1004 DecorationDesc *v2; // esi@3 | |
1005 int v3; // edx@4 | |
1006 int v4; // eax@4 | |
1007 int v5; // ecx@6 | |
1008 int v6; // ebx@8 | |
1009 int v7; // esi@8 | |
1010 int v8; // ebx@10 | |
1011 int v9; // esi@11 | |
1012 int v10; // edi@12 | |
1013 int v11; // eax@12 | |
1014 int v12; // esi@14 | |
1015 unsigned int v13; // eax@17 | |
1016 signed int i; // [sp+4h] [bp-14h]@1 | |
1017 int v15; // [sp+8h] [bp-10h]@10 | |
1018 int v16; // [sp+Ch] [bp-Ch]@10 | |
1019 int v17; // [sp+10h] [bp-8h]@10 | |
1020 int v18; // [sp+14h] [bp-4h]@8 | |
1021 | |
1022 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1023 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1024 { | |
1025 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1026 if ( !(v1->field_2 & 0x20) ) | |
1027 { | |
1028 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1029 if (!v2->CanMoveThrough()) |
0 | 1030 { |
1031 v3 = v2->uRadius; | |
1032 v4 = v1->vPosition.x; | |
1033 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1034 { | |
1035 if ( stru_721530.sMinX >= v4 - v3 ) | |
1036 { | |
1037 v5 = v1->vPosition.y; | |
1038 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1039 { | |
1040 if ( stru_721530.sMinY >= v5 - v3 ) | |
1041 { | |
1042 v6 = v2->uDecorationHeight; | |
1043 v7 = v1->vPosition.z; | |
1044 v18 = v6; | |
1045 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1046 { | |
1047 if ( stru_721530.sMinZ >= v7 ) | |
1048 { | |
1049 v16 = v4 - stru_721530.normal.x; | |
1050 v15 = v5 - stru_721530.normal.y; | |
1051 v8 = stru_721530.prolly_normal_d + v3; | |
1052 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1053 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1054 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1055 { | |
1056 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1057 if ( v9 > 0 ) | |
1058 { | |
1059 v10 = v1->vPosition.z; | |
1060 v11 = stru_721530.normal.z | |
1061 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1062 if ( v11 >= v10 ) | |
1063 { | |
1064 if ( v11 <= v18 + v10 ) | |
1065 { | |
295 | 1066 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1067 if ( v12 < 0 ) |
1068 v12 = 0; | |
1069 if ( v12 < stru_721530.field_7C ) | |
1070 { | |
1071 stru_721530.field_7C = v12; | |
1072 v13 = 8 * v0->pDecorationIDs[i]; | |
1073 LOBYTE(v13) = v13 | 5; | |
1074 stru_721530.uFaceID = v13; | |
1075 } | |
1076 } | |
1077 } | |
1078 } | |
1079 } | |
1080 } | |
1081 } | |
1082 } | |
1083 } | |
1084 } | |
1085 } | |
1086 } | |
1087 } | |
1088 } | |
1089 } | |
1090 | |
1091 //----- (0046E26D) -------------------------------------------------------- | |
1092 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1093 { | |
1094 int v2; // edx@5 | |
1095 unsigned __int16 *v3; // eax@5 | |
1096 unsigned __int16 v4; // ax@6 | |
1097 LevelDecoration *v5; // edi@7 | |
1098 DecorationDesc *v6; // esi@8 | |
1099 int v7; // edx@9 | |
1100 int v8; // eax@9 | |
1101 int v9; // ecx@11 | |
1102 int v10; // ebx@13 | |
1103 int v11; // esi@13 | |
1104 int v12; // ebp@15 | |
1105 int v13; // ebx@15 | |
1106 int v14; // esi@16 | |
1107 int v15; // edi@17 | |
1108 int v16; // eax@17 | |
1109 int v17; // esi@19 | |
1110 char v18; // zf@23 | |
1111 int v19; // [sp+0h] [bp-10h]@15 | |
1112 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1113 int v21; // [sp+8h] [bp-8h]@15 | |
1114 int v22; // [sp+Ch] [bp-4h]@13 | |
1115 | |
1116 if ( a1 >= 0 ) | |
1117 { | |
1118 if ( a1 <= 127 ) | |
1119 { | |
1120 if ( a2 >= 0 ) | |
1121 { | |
1122 if ( a2 <= 127 ) | |
1123 { | |
1124 v2 = a1 + (a2 << 7); | |
1125 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1126 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1127 if ( v3 ) | |
1128 { | |
1129 do | |
1130 { | |
1131 v4 = *v3; | |
141 | 1132 if ( (v4 & 7) == OBJECT_Decoration) |
0 | 1133 { |
1134 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1135 if ( !(v5->field_2 & 0x20) ) | |
1136 { | |
1137 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1138 if (!v6->CanMoveThrough()) |
0 | 1139 { |
1140 v7 = v6->uRadius; | |
1141 v8 = v5->vPosition.x; | |
1142 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1143 { | |
1144 if ( stru_721530.sMinX >= v8 - v7 ) | |
1145 { | |
1146 v9 = v5->vPosition.y; | |
1147 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1148 { | |
1149 if ( stru_721530.sMinY >= v9 - v7 ) | |
1150 { | |
1151 v10 = v6->uDecorationHeight; | |
1152 v11 = v5->vPosition.z; | |
1153 v22 = v10; | |
1154 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1155 { | |
1156 if ( stru_721530.sMinZ >= v11 ) | |
1157 { | |
1158 v12 = v8 - stru_721530.normal.x; | |
1159 v19 = v9 - stru_721530.normal.y; | |
1160 v13 = stru_721530.prolly_normal_d + v7; | |
1161 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1162 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1163 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1164 { | |
1165 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1166 if ( v14 > 0 ) | |
1167 { | |
1168 v15 = v5->vPosition.z; | |
1169 v16 = stru_721530.normal.z | |
1170 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1171 if ( v16 >= v15 ) | |
1172 { | |
1173 if ( v16 <= v22 + v15 ) | |
1174 { | |
295 | 1175 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1176 if ( v17 < 0 ) |
1177 v17 = 0; | |
1178 if ( v17 < stru_721530.field_7C ) | |
1179 { | |
1180 stru_721530.field_7C = v17; | |
1181 stru_721530.uFaceID = (signed __int16)*v20; | |
1182 } | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 } | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 v3 = v20 + 1; | |
1197 v18 = *v20 == 0; | |
1198 ++v20; | |
1199 } | |
1200 while ( !v18 ); | |
1201 } | |
1202 } | |
1203 } | |
1204 } | |
1205 } | |
1206 } | |
1207 | |
1208 //----- (00486F92) -------------------------------------------------------- | |
1209 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1210 { | |
1211 Span *v0; // ebx@1 | |
1212 int v1; // eax@2 | |
1213 Edge *v2; // ecx@3 | |
1214 Edge *v3; // edx@3 | |
1215 Edge *v4; // esi@6 | |
1216 Edge *v5; // eax@7 | |
1217 Edge *v6; // ecx@8 | |
1218 Surf *v7; // esi@11 | |
1219 double v8; // st7@13 | |
1220 Surf *v9; // edi@13 | |
1221 double v10; // st6@13 | |
1222 double v11; // st7@14 | |
1223 signed __int64 v12; // qax@14 | |
1224 stru148 *v13; // eax@15 | |
1225 Span *v14; // ecx@17 | |
1226 double v15; // st7@28 | |
1227 signed __int64 v16; // qax@28 | |
1228 stru148 *v17; // eax@29 | |
1229 Span *v18; // ecx@31 | |
1230 Edge *i; // eax@40 | |
1231 Edge *v20; // ecx@43 | |
1232 Edge *v21; // esi@44 | |
1233 double v22; // st7@45 | |
1234 Edge *v23; // edx@48 | |
1235 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1236 float v25; // [sp+14h] [bp-Ch]@3 | |
1237 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1238 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1239 | |
1240 v0 = pSpans; | |
1241 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1242 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1243 stru_80C9A4.pSurf = &stru_80C980; |
1244 stru_80C980.pPrev = &stru_80C980; | |
1245 stru_80C980.pNext = &stru_80C980; | |
693 | 1246 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1247 stru_80C980.field_8 = 0.0; |
1248 stru_80C980.field_4 = 0.0; | |
1249 stru_80C9D8.pNext = &stru_80C9A4; | |
1250 stru_80C9D8.pPrev = 0; | |
1251 stru_80C9D8.field_8 = 1; | |
1252 stru_80C9A4.pNext = 0; | |
1253 stru_80C9A4.pPrev = &stru_80C9D8; | |
1254 stru_80C9A4.field_8 = 0; | |
1255 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1256 v27 = pViewport->uViewportTL_Y; |
1257 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1258 { |
1259 LABEL_51: | |
1260 v0->field_8 = -1; | |
1261 } | |
1262 else | |
1263 { | |
693 | 1264 v1 = 52 * pViewport->uViewportTL_Y; |
1265 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1266 while ( 1 ) |
1267 { | |
1268 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1269 v3 = &stru_80C9D8; | |
1270 v25 = (double)(signed int)v27; | |
1271 if ( v2 != &defaultEdge ) | |
1272 { | |
1273 do | |
1274 { | |
1275 while ( 1 ) | |
1276 { | |
1277 v4 = v3->pNext; | |
1278 if ( v2->field_0 <= (double)v4->field_0 ) | |
1279 break; | |
1280 v3 = v3->pNext; | |
1281 } | |
1282 v5 = v2->pNext; | |
1283 v2->pNext = v4; | |
1284 v2->pPrev = v3; | |
1285 v3->pNext->pPrev = v2; | |
1286 v3->pNext = v2; | |
1287 v3 = v2; | |
1288 v2 = v5; | |
1289 } | |
1290 while ( v5 != &defaultEdge ); | |
1291 } | |
1292 v6 = stru_80C9D8.pNext; | |
1293 stru_80C980.field_20 = 0; | |
1294 stru_80C980.field_22 = 1; | |
1295 v26 = stru_80C9D8.pNext; | |
1296 if ( stru_80C9D8.pNext ) | |
1297 { | |
1298 while ( 1 ) | |
1299 { | |
1300 v7 = v6->pSurf; | |
1301 if ( v6->field_8 ) | |
1302 { | |
1303 ++v7->field_22; | |
1304 if ( v7->field_22 == 1 ) | |
1305 { | |
1306 v8 = v6->field_0 + 2.0; | |
1307 v9 = stru_80C980.pNext; | |
1308 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1309 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1310 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1311 + stru_80C980.pNext->field_0 ) | |
1312 { | |
1313 do | |
1314 v9 = v9->pNext; | |
1315 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1316 v7->pNext = v9; | |
1317 v7->pPrev = v9->pPrev; | |
1318 v9->pPrev->pNext = v7; | |
1319 v9->pPrev = v7; | |
1320 } | |
1321 else | |
1322 { | |
1323 v11 = v6->field_0 + 0.5; | |
1324 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1325 v0->field_C = v12; | |
1326 if ( (signed __int16)v12 > 0 ) | |
1327 { | |
1328 v0->field_A = v27; | |
1329 v0->field_8 = v9->field_20; | |
1330 v13 = v9->pParent; | |
1331 v0->pParent = v13; | |
1332 if ( v13 ) | |
1333 { | |
1334 if ( v13->prolly_head ) | |
1335 { | |
1336 v14 = v13->prolly_tail; | |
1337 if ( !v14 ) | |
1338 return; | |
1339 v14->pNext = v0; | |
1340 } | |
1341 else | |
1342 { | |
1343 v13->prolly_head = v0; | |
1344 } | |
1345 v13->prolly_tail = v0; | |
1346 } | |
1347 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1348 return; | |
1349 ++v0; | |
1350 ++pOutdoorCamera->uNumSpans; | |
1351 } | |
1352 v6 = v26; | |
1353 v7->field_20 = (signed __int64)v11; | |
1354 v7->pNext = v9; | |
1355 v9->pPrev = v7; | |
1356 stru_80C980.pNext = v7; | |
1357 v7->pPrev = &stru_80C980; | |
1358 } | |
1359 } | |
1360 } | |
1361 else | |
1362 { | |
1363 --v7->field_22; | |
1364 if ( !v7->field_22 ) | |
1365 { | |
1366 if ( stru_80C980.pNext == v7 ) | |
1367 { | |
1368 v15 = v6->field_0 + 0.5; | |
1369 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1370 v0->field_C = v16; | |
1371 if ( (signed __int16)v16 > 0 ) | |
1372 { | |
1373 v0->field_A = v27; | |
1374 v0->field_8 = v7->field_20; | |
1375 v17 = v7->pParent; | |
1376 v0->pParent = v17; | |
1377 if ( v17 ) | |
1378 { | |
1379 if ( v17->prolly_head ) | |
1380 { | |
1381 v18 = v17->prolly_tail; | |
1382 if ( !v18 ) | |
1383 return; | |
1384 v18->pNext = v0; | |
1385 } | |
1386 else | |
1387 { | |
1388 v17->prolly_head = v0; | |
1389 } | |
1390 v17->prolly_tail = v0; | |
1391 } | |
1392 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1393 return; | |
1394 ++v0; | |
1395 ++pOutdoorCamera->uNumSpans; | |
1396 } | |
1397 v7->pNext->field_20 = (signed __int64)v15; | |
1398 v6 = v26; | |
1399 } | |
1400 v7->pNext->pPrev = v7->pPrev; | |
1401 v7->pPrev->pNext = v7->pNext; | |
1402 } | |
1403 } | |
1404 v26 = v6->pNext; | |
1405 if ( !v26 ) | |
1406 break; | |
1407 v6 = v6->pNext; | |
1408 } | |
1409 } | |
1410 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1411 { | |
1412 i->pPrev->pNext = i->pNext; | |
1413 i->pNext->pPrev = i->pPrev; | |
1414 } | |
1415 v20 = stru_80C9D8.pNext; | |
1416 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1417 break; | |
1418 LABEL_50: | |
1419 ++v27; | |
1420 v1 = v24 + 52; | |
1421 v24 += 52; | |
693 | 1422 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1423 goto LABEL_51; |
1424 } | |
1425 while ( 1 ) | |
1426 { | |
1427 v21 = v20->pNext; | |
1428 if ( !v21 ) | |
1429 break; | |
1430 v22 = v20->field_4 + v20->field_0; | |
1431 v20->field_0 = v22; | |
1432 if ( v22 < stru_80C9D8.field_0 ) | |
1433 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1434 while ( 1 ) | |
1435 { | |
1436 v23 = v20->pPrev; | |
1437 if ( v20->field_0 >= (double)v23->field_0 ) | |
1438 break; | |
1439 v23->pNext = v20->pNext; | |
1440 v20->pNext->pPrev = v23; | |
1441 v23->pPrev->pNext = v20; | |
1442 v20->pPrev = v23->pPrev; | |
1443 v20->pNext = v23; | |
1444 v23->pPrev = v20; | |
1445 } | |
1446 v20 = v21; | |
1447 if ( v21 == &stru_80C9A4 ) | |
1448 goto LABEL_50; | |
1449 } | |
1450 } | |
1451 } | |
1452 // 4EC3EC: using guessed type Edge defaultEdge; | |
1453 | |
1454 | |
1455 | |
1456 //----- (00487355) -------------------------------------------------------- | |
1457 bool OutdoorCamera::_487355() | |
1458 { | |
1459 int v0; // esi@1 | |
1460 stru148 *v1; // edi@2 | |
1461 bool result; // eax@3 | |
1462 | |
1463 v0 = 0; | |
1464 if ( pOutdoorCamera->numStru148s > 0 ) | |
1465 { | |
1466 v1 = array_77EC08; | |
1467 do | |
1468 { | |
1469 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1470 ++v0; | |
1471 ++v1; | |
1472 } | |
1473 while ( v0 < pOutdoorCamera->numStru148s ); | |
1474 } | |
1475 return result; | |
1476 } | |
1477 | |
1478 | |
1479 | |
1480 //----- (00487DA9) -------------------------------------------------------- | |
1481 void __cdecl sub_487DA9() | |
1482 { | |
1483 char *v0; // eax@1 | |
1484 | |
1485 v0 = &array_77EC08[0].field_108; | |
1486 do | |
1487 { | |
1488 *v0 = 0; | |
1489 v0 += 268; | |
1490 } | |
1491 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1492 } | |
1493 | |
1494 //----- (00487DBE) -------------------------------------------------------- | |
1495 void Software_ResetNewEdges() | |
1496 { | |
1497 int v0; // ecx@1 | |
1498 Edge **v1; // eax@1 | |
1499 signed int v2; // eax@3 | |
1500 | |
1501 v0 = 0; | |
1502 v1 = ptr_80CA10; | |
1503 do | |
1504 { | |
1505 ++v0; | |
1506 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1507 *v1 = 0; | |
1508 ++v1; | |
1509 } | |
1510 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1511 v2 = 2000; | |
1512 do | |
1513 { | |
1514 pSurfs->field_22 = 0; | |
1515 --v2; | |
1516 } | |
1517 while ( v2 ); | |
1518 } | |
1519 // 4EC3EC: using guessed type Edge defaultEdge; | |
1520 | |
1521 | |
1522 | |
1523 | |
1524 //----- (00487E1D) -------------------------------------------------------- | |
1525 TileTable::~TileTable() | |
1526 { | |
1527 if ( this->pTiles ) | |
1528 { | |
1529 pAllocator->FreeChunk(this->pTiles); | |
1530 pTiles = nullptr; | |
1531 } | |
1532 uNumTiles = 0; | |
1533 } | |
1534 | |
1535 //----- (00487E3B) -------------------------------------------------------- | |
1536 TileDesc *TileTable::GetTileById(unsigned int uTileID) | |
1537 { | |
86 | 1538 /*TileDesc *result; // eax@3 |
0 | 1539 |
1540 if ( (uTileID & 0x80000000u) != 0 || (signed int)uTileID > (signed int)(this->uNumTiles - 1) ) | |
1541 result = this->pTiles; | |
1542 else | |
1543 result = &this->pTiles[uTileID]; | |
86 | 1544 return result;*/ |
1545 | |
630 | 1546 assert(uTileID < uNumTiles); |
1547 return &pTiles[uTileID]; | |
0 | 1548 } |
1549 | |
1550 //----- (00487E58) -------------------------------------------------------- | |
630 | 1551 void TileTable::InitializeTileset(Tileset tileset) |
0 | 1552 { |
1553 TileTable *v2; // edi@1 | |
1554 int v3; // ebx@1 | |
1555 TileDesc *v4; // eax@2 | |
1556 signed int i; // [sp+8h] [bp-4h]@1 | |
1557 | |
1558 v2 = this; | |
1559 v3 = 0; | |
1560 for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 ) | |
1561 { | |
1562 v4 = &v2->pTiles[v3]; | |
630 | 1563 if (v4->tileset == tileset && v4->pTileName[0] ) |
0 | 1564 { |
1565 v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName); | |
1566 if ( v2->pTiles[v3].uBitmapID != -1 ) | |
1567 pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2->pTiles[v3].uBitmapID].palette_id1); | |
1568 } | |
1569 ++i; | |
1570 } | |
1571 } | |
1572 | |
1573 //----- (00487ED6) -------------------------------------------------------- | |
1574 int TileTable::method_487ED6(signed int a1, int a2) | |
1575 { | |
1576 int v3; // esi@1 | |
1577 TileTable *v4; // edi@1 | |
1578 int v5; // edx@3 | |
1579 int v6; // edx@11 | |
1580 unsigned int v8; // [sp-4h] [bp-10h]@4 | |
1581 | |
1582 v3 = 0; | |
1583 v4 = this; | |
1584 if ( a1 > 8 ) | |
1585 { | |
1586 v8 = 0; | |
1587 return v4->GetTileId(a1, v8); | |
1588 } | |
1589 if ( a2 || (v5 = rand() % 50, v5 < 20) ) | |
1590 { | |
1591 v8 = 0; | |
1592 return v4->GetTileId(a1, v8); | |
1593 } | |
1594 if ( v5 < 30 ) | |
1595 { | |
1596 v8 = 1; | |
1597 return v4->GetTileId(a1, v8); | |
1598 } | |
1599 if ( v5 < 40 ) | |
1600 { | |
1601 v8 = 2; | |
1602 return v4->GetTileId(a1, v8); | |
1603 } | |
1604 if ( v5 < 48 ) | |
1605 { | |
1606 v8 = 3; | |
1607 return v4->GetTileId(a1, v8); | |
1608 } | |
1609 v6 = rand() % 8; | |
1610 if ( !v6 ) | |
1611 { | |
1612 v8 = 4; | |
1613 return v4->GetTileId(a1, v8); | |
1614 } | |
1615 if ( v6 == 1 ) | |
1616 { | |
1617 v8 = 5; | |
1618 return v4->GetTileId(a1, v8); | |
1619 } | |
1620 if ( v6 == 2 ) | |
1621 { | |
1622 v8 = 6; | |
1623 return v4->GetTileId(a1, v8); | |
1624 } | |
1625 if ( v6 == 3 ) | |
1626 { | |
1627 v8 = 7; | |
1628 return v4->GetTileId(a1, v8); | |
1629 } | |
1630 if ( v6 == 4 ) | |
1631 { | |
1632 v8 = 8; | |
1633 return v4->GetTileId(a1, v8); | |
1634 } | |
1635 if ( v6 == 5 ) | |
1636 { | |
1637 v8 = 9; | |
1638 return v4->GetTileId(a1, v8); | |
1639 } | |
1640 if ( v6 == 6 ) | |
1641 { | |
1642 v8 = 10; | |
1643 return v4->GetTileId(a1, v8); | |
1644 } | |
1645 if ( v6 == 7 ) | |
1646 { | |
1647 v8 = 11; | |
1648 return v4->GetTileId(a1, v8); | |
1649 } | |
1650 return v3; | |
1651 } | |
1652 | |
1653 //----- (00487F84) -------------------------------------------------------- | |
1654 unsigned int TileTable::GetTileId(unsigned int uTerrainType, unsigned int uSection) | |
1655 { | |
1656 unsigned int v3; // edx@1 | |
1657 unsigned int result; // eax@1 | |
1658 unsigned __int16 *v5; // ecx@2 | |
1659 | |
1660 v3 = this->uNumTiles; | |
1661 result = 0; | |
1662 if ( (signed int)this->uNumTiles <= 0 ) | |
1663 { | |
1664 LABEL_6: | |
1665 result = 0; | |
1666 } | |
1667 else | |
1668 { | |
1669 v5 = &this->pTiles->uSection; | |
1670 while ( (signed __int16)*(v5 - 1) != uTerrainType || (signed __int16)*v5 != uSection ) | |
1671 { | |
1672 ++result; | |
1673 v5 += 13; | |
1674 if ( (signed int)result >= (signed int)v3 ) | |
1675 goto LABEL_6; | |
1676 } | |
1677 } | |
1678 return result; | |
1679 } | |
1680 | |
1681 //----- (00487FB4) -------------------------------------------------------- | |
1682 void TileTable::ToFile() | |
1683 { | |
1684 TileTable *v1; // esi@1 | |
1685 FILE *v2; // eax@1 | |
1686 FILE *v3; // edi@1 | |
1687 | |
1688 auto Str = this; | |
1689 | |
1690 v1 = Str; | |
1691 v2 = fopen("data\\dtile.bin", "wb"); | |
1692 v3 = v2; | |
1693 if ( !v2 ) | |
1694 Abortf("Unable to save dtile.bin!"); | |
1695 fwrite(v1, 4u, 1u, v2); | |
1696 fwrite(v1->pTiles, 0x1Au, v1->uNumTiles, v3); | |
1697 fclose(v3); | |
1698 } | |
1699 | |
1700 //----- (00488000) -------------------------------------------------------- | |
1701 void TileTable::FromFile(void *pSerialized) | |
1702 { | |
1703 uNumTiles = *(int *)pSerialized; | |
1704 pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, 26 * uNumTiles, "Tile Descrip"); | |
1705 memcpy(pTiles, (char *)pSerialized + 4, 26 * uNumTiles); | |
1706 } | |
1707 | |
1708 //----- (00488047) -------------------------------------------------------- | |
1709 int TileTable::FromFileTxt(const char *pFilename) | |
1710 { | |
1711 TileTable *v2; // ebp@1 | |
1712 FILE *v3; // eax@1 | |
1713 unsigned int v4; // ebx@3 | |
1714 void *v5; // eax@9 | |
1715 unsigned __int16 v6; // ax@14 | |
1716 const char *v7; // ST14_4@14 | |
1717 unsigned __int16 v8; // ax@14 | |
1718 const char *v9; // esi@14 | |
1719 int v10; // eax@17 | |
1720 int v11; // eax@20 | |
1721 int v12; // eax@22 | |
1722 int v13; // eax@24 | |
1723 int v14; // eax@26 | |
1724 int v15; // eax@28 | |
1725 int v16; // eax@30 | |
1726 int v17; // eax@32 | |
1727 int v18; // eax@34 | |
1728 int v19; // eax@36 | |
1729 int v20; // eax@38 | |
1730 int v21; // eax@40 | |
1731 int v22; // eax@42 | |
1732 int v23; // eax@44 | |
1733 int v24; // eax@46 | |
1734 int v25; // eax@48 | |
1735 int v26; // eax@50 | |
1736 int v27; // eax@52 | |
1737 int v28; // eax@54 | |
1738 int v29; // eax@56 | |
1739 int v30; // eax@58 | |
1740 int v31; // eax@60 | |
1741 int v32; // eax@62 | |
1742 int v33; // eax@64 | |
1743 int v34; // eax@66 | |
1744 const char *v35; // esi@67 | |
1745 int v36; // eax@70 | |
1746 int v37; // eax@73 | |
1747 int v38; // eax@75 | |
1748 int v39; // eax@77 | |
1749 int v40; // eax@79 | |
1750 int v41; // eax@81 | |
1751 int v42; // eax@83 | |
1752 int v43; // eax@85 | |
1753 int v44; // eax@87 | |
1754 int v45; // eax@89 | |
1755 int v46; // eax@91 | |
1756 int v47; // eax@93 | |
1757 int v48; // eax@108 | |
1758 int v49; // eax@110 | |
1759 int v50; // eax@112 | |
1760 int v51; // eax@114 | |
1761 int v52; // eax@116 | |
1762 int v53; // eax@118 | |
1763 int v54; // eax@120 | |
1764 int v55; // eax@122 | |
1765 int v56; // eax@124 | |
1766 int v57; // eax@126 | |
1767 int v58; // eax@128 | |
1768 int v59; // eax@130 | |
1769 int v60; // eax@132 | |
1770 int v61; // eax@134 | |
1771 int v62; // eax@136 | |
1772 int v63; // eax@138 | |
1773 int v64; // eax@140 | |
1774 int v65; // eax@142 | |
1775 int v66; // eax@144 | |
1776 int v67; // eax@146 | |
1777 int v68; // eax@148 | |
1778 int v69; // eax@150 | |
1779 int v70; // eax@151 | |
1780 int j; // edi@152 | |
1781 const char *v72; // esi@153 | |
1782 int v73; // eax@154 | |
1783 int v74; // eax@156 | |
1784 int v75; // eax@160 | |
1785 int v76; // eax@162 | |
1786 int v77; // eax@164 | |
1787 int v78; // eax@166 | |
1788 int v79; // eax@168 | |
1789 int v80; // eax@170 | |
1790 FILE *i; // [sp-10h] [bp-304h]@3 | |
1791 FILE *File; // [sp+4h] [bp-2F0h]@1 | |
1792 FrameTableTxtLine v84; // [sp+8h] [bp-2ECh]@4 | |
1793 FrameTableTxtLine v85; // [sp+84h] [bp-270h]@4 | |
1794 char Buf; // [sp+100h] [bp-1F4h]@4 | |
1795 | |
1796 v2 = this; | |
1797 v3 = fopen(pFilename, "r"); | |
1798 File = v3; | |
1799 if ( !v3 ) | |
1800 Abortf("TileTable::load - Unable to open file: %s."); | |
1801 v4 = 0; | |
1802 for ( i = v3; fgets(&Buf, 490, i); i = File ) | |
1803 { | |
1804 *strchr(&Buf, 10) = 0; | |
703 | 1805 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); |
701 | 1806 if ( v84.uPropCount && *v84.pProperties[0] != 47 ) |
0 | 1807 ++v4; |
1808 } | |
1809 v2->uNumTiles = v4; | |
1810 v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip"); | |
1811 v2->pTiles = (TileDesc *)v5; | |
1812 if ( !v5 ) | |
1813 Abortf("TileTable::Load - Out of Memory!"); | |
1814 memset(v5, 0, 26 * v2->uNumTiles); | |
1815 v2->uNumTiles = 0; | |
1816 fseek(File, 0, 0); | |
1817 if ( fgets(&Buf, 490, File) ) | |
1818 { | |
1819 while ( 1 ) | |
1820 { | |
1821 *strchr(&Buf, 10) = 0; | |
703 | 1822 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); |
701 | 1823 if ( v84.uPropCount ) |
0 | 1824 { |
1825 if ( *v84.pProperties[0] != 47 ) | |
1826 break; | |
1827 } | |
1828 LABEL_173: | |
1829 if ( !fgets(&Buf, 490, File) ) | |
1830 goto LABEL_174; | |
1831 } | |
1832 strcpy(v2->pTiles[v2->uNumTiles].pTileName, v84.pProperties[0]); | |
1833 v6 = atoi(v84.pProperties[1]); | |
1834 v7 = v84.pProperties[2]; | |
1835 v2->pTiles[v2->uNumTiles].uTileID = v6; | |
1836 v8 = atoi(v7); | |
1837 v9 = v84.pProperties[3]; | |
1838 v2->pTiles[v2->uNumTiles].uBitmapID = v8; | |
630 | 1839 v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass; |
0 | 1840 if ( _strcmpi(v9, "TTtype_NULL") ) |
1841 { | |
1842 if ( _strcmpi(v9, "TTtype_Start") ) | |
1843 { | |
1844 if ( _strcmpi(v9, "TTtype_Grass") ) | |
1845 { | |
1846 if ( _strcmpi(v9, "TTtype_Cracked") ) | |
1847 { | |
1848 if ( _strcmpi(v9, "TTtype_Snow") ) | |
1849 { | |
1850 if ( _strcmpi(v9, "TTtype_Sand") ) | |
1851 { | |
1852 if ( _strcmpi(v9, "TTtype_Volcano") ) | |
1853 { | |
1854 if ( _strcmpi(v9, "TTtype_Dirt") ) | |
1855 { | |
1856 if ( _strcmpi(v9, "TTtype_Water") ) | |
1857 { | |
1858 if ( _strcmpi(v9, "TTtype_Tropical") ) | |
1859 { | |
1860 if ( _strcmpi(v9, "TTtype_Swamp") ) | |
1861 { | |
1862 if ( _strcmpi(v9, "TTtype_City") ) | |
1863 { | |
1864 if ( _strcmpi(v9, "TTtype_RoadGrassCobble") ) | |
1865 { | |
1866 if ( _strcmpi(v9, "TTtype_RoadGrassDirt") ) | |
1867 { | |
1868 if ( _strcmpi(v9, "TTtype_RoadCrackedCobble") ) | |
1869 { | |
1870 if ( _strcmpi(v9, "TTtype_RoadCrackedDirt") ) | |
1871 { | |
1872 if ( _strcmpi(v9, "TTtype_RoadSandCobble") ) | |
1873 { | |
1874 if ( _strcmpi(v9, "TTtype_RoadSandDirt") ) | |
1875 { | |
1876 if ( _strcmpi(v9, "TTtype_RoadVolcanoCobble") ) | |
1877 { | |
1878 if ( _strcmpi(v9, "TTtype_RoadVolcanoDirt") ) | |
1879 { | |
1880 if ( _strcmpi(v9, "TTtype_RoadSwampCobble") ) | |
1881 { | |
1882 if ( _strcmpi(v9, "TTtype_RoadSwampDirt") ) | |
1883 { | |
1884 if ( _strcmpi(v9, "TTtype_RoadTropicalCobble") ) | |
1885 { | |
1886 if ( _strcmpi(v9, "TTtype_RoadTropicalDirt") ) | |
1887 { | |
1888 if ( _strcmpi(v9, "TTtype_RoadSnowCobble") ) | |
1889 { | |
1890 if ( _strcmpi(v9, "TTtype_RoadSnowDirt") ) | |
1891 { | |
1892 if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) | |
1893 { | |
630 | 1894 v34 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1895 *(char *)v34 |= 0x1Cu; |
1896 } | |
1897 } | |
1898 else | |
1899 { | |
630 | 1900 v33 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1901 *(char *)v33 |= 0xDu; |
1902 } | |
1903 } | |
1904 else | |
1905 { | |
630 | 1906 v32 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1907 *(char *)v32 |= 0xCu; |
1908 } | |
1909 } | |
1910 else | |
1911 { | |
630 | 1912 v31 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1913 *(char *)v31 |= 0x1Bu; |
1914 } | |
1915 } | |
1916 else | |
1917 { | |
630 | 1918 v30 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1919 *(char *)v30 |= 0x1Au; |
1920 } | |
1921 } | |
1922 else | |
1923 { | |
630 | 1924 v29 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1925 *(char *)v29 |= 0x19u; |
1926 } | |
1927 } | |
1928 else | |
1929 { | |
630 | 1930 v28 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1931 *(char *)v28 |= 0x18u; |
1932 } | |
1933 } | |
1934 else | |
1935 { | |
630 | 1936 v27 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1937 *(char *)v27 |= 0x11u; |
1938 } | |
1939 } | |
1940 else | |
1941 { | |
630 | 1942 v26 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1943 *(char *)v26 |= 0x10u; |
1944 } | |
1945 } | |
1946 else | |
1947 { | |
630 | 1948 v25 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1949 *(char *)v25 |= 0xFu; |
1950 } | |
1951 } | |
1952 else | |
1953 { | |
630 | 1954 v24 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1955 *(char *)v24 |= 0xEu; |
1956 } | |
1957 } | |
1958 else | |
1959 { | |
630 | 1960 v23 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1961 *(char *)v23 |= 0x17u; |
1962 } | |
1963 } | |
1964 else | |
1965 { | |
630 | 1966 v22 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1967 *(char *)v22 |= 0x16u; |
1968 } | |
1969 } | |
1970 else | |
1971 { | |
630 | 1972 v21 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1973 *(char *)v21 |= 0xBu; |
1974 } | |
1975 } | |
1976 else | |
1977 { | |
630 | 1978 v20 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1979 *(char *)v20 |= 0xAu; |
1980 } | |
1981 } | |
1982 else | |
1983 { | |
630 | 1984 v19 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1985 *(char *)v19 |= 9u; |
1986 } | |
1987 } | |
1988 else | |
1989 { | |
630 | 1990 v18 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1991 *(char *)v18 |= 7u; |
1992 } | |
1993 } | |
1994 else | |
1995 { | |
630 | 1996 v17 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 1997 *(char *)v17 |= 8u; |
1998 } | |
1999 } | |
2000 else | |
2001 { | |
630 | 2002 v16 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2003 *(char *)v16 |= 5u; |
2004 } | |
2005 } | |
2006 else | |
2007 { | |
630 | 2008 v15 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2009 *(char *)v15 |= 4u; |
2010 } | |
2011 } | |
2012 else | |
2013 { | |
630 | 2014 v14 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2015 *(char *)v14 |= 3u; |
2016 } | |
2017 } | |
2018 else | |
2019 { | |
630 | 2020 v13 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2021 *(char *)v13 |= 2u; |
2022 } | |
2023 } | |
2024 else | |
2025 { | |
630 | 2026 v12 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2027 *(char *)v12 |= 1u; |
2028 } | |
2029 } | |
2030 else | |
2031 { | |
630 | 2032 v11 = (int)&v2->pTiles[v2->uNumTiles].tileset; |
0 | 2033 *(char *)v11 |= 6u; |
2034 } | |
2035 } | |
2036 } | |
2037 else | |
2038 { | |
2039 v10 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2040 *(char *)v10 |= 0xFEu; | |
2041 } | |
2042 } | |
2043 else | |
2044 { | |
630 | 2045 LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1; |
0 | 2046 } |
2047 v35 = v84.pProperties[4]; | |
2048 v2->pTiles[v2->uNumTiles].uSection = 0; | |
2049 v2->pTiles[v2->uNumTiles].uAttributes = 0; | |
2050 if ( !_strcmpi(v35, "TTsect_NULL") ) | |
2051 { | |
2052 LOBYTE(v2->pTiles[v2->uNumTiles].uSection) = -1; | |
2053 LABEL_152: | |
701 | 2054 for ( j = 5; j < v84.uPropCount; ++j ) |
0 | 2055 { |
2056 v72 = v84.pProperties[j]; | |
2057 if ( _strcmpi(v84.pProperties[j], "TTattr_Burn") ) | |
2058 { | |
2059 if ( _strcmpi(v72, "TTattr_Water") ) | |
2060 { | |
2061 if ( _strcmpi(v72, "TTattr_Water2") ) | |
2062 { | |
2063 if ( _strcmpi(v72, "TTattr_Block") ) | |
2064 { | |
2065 if ( _strcmpi(v72, "TTattr_Repulse") ) | |
2066 { | |
2067 if ( _strcmpi(v72, "TTattr_Flat") ) | |
2068 { | |
2069 if ( _strcmpi(v72, "TTattr_Wave") ) | |
2070 { | |
2071 if ( _strcmpi(v72, "TTattr_NoDraw") ) | |
2072 { | |
2073 if ( !_strcmpi(v72, "TTattr_Transition") ) | |
2074 { | |
2075 v80 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2076 *(short *)v80 |= 0x200u; | |
2077 } | |
2078 } | |
2079 else | |
2080 { | |
2081 v79 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2082 *(char *)v79 |= 0x40u; | |
2083 } | |
2084 } | |
2085 else | |
2086 { | |
2087 v78 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2088 *(char *)v78 |= 0x20u; | |
2089 } | |
2090 } | |
2091 else | |
2092 { | |
2093 v77 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2094 *(char *)v77 |= 0x10u; | |
2095 } | |
2096 } | |
2097 else | |
2098 { | |
2099 v76 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2100 *(char *)v76 |= 8u; | |
2101 } | |
2102 } | |
2103 else | |
2104 { | |
2105 v75 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2106 *(char *)v75 |= 4u; | |
2107 } | |
2108 } | |
2109 else | |
2110 { | |
2111 HIBYTE(v2->pTiles[v2->uNumTiles].uAttributes) |= 1u; | |
2112 } | |
2113 } | |
2114 else | |
2115 { | |
2116 v74 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2117 *(char *)v74 |= 2u; | |
2118 } | |
2119 } | |
2120 else | |
2121 { | |
2122 v73 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2123 *(char *)v73 |= 1u; | |
2124 } | |
2125 } | |
2126 ++v2->uNumTiles; | |
2127 goto LABEL_173; | |
2128 } | |
2129 if ( !_strcmpi(v35, "TTsect_Start") ) | |
2130 { | |
2131 v36 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2132 *(char *)v36 |= 0xFEu; | |
2133 goto LABEL_152; | |
2134 } | |
2135 if ( !_strcmpi(v35, "TTsect_Base1") ) | |
2136 goto LABEL_152; | |
2137 if ( !_strcmpi(v35, "TTsect_Base2") ) | |
2138 { | |
2139 v37 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2140 *(char *)v37 |= 1u; | |
2141 goto LABEL_152; | |
2142 } | |
2143 if ( !_strcmpi(v35, "TTsect_Base3") ) | |
2144 { | |
2145 v38 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2146 *(char *)v38 |= 2u; | |
2147 goto LABEL_152; | |
2148 } | |
2149 if ( !_strcmpi(v35, "TTsect_Base4") ) | |
2150 { | |
2151 v39 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2152 *(char *)v39 |= 3u; | |
2153 goto LABEL_152; | |
2154 } | |
2155 if ( !_strcmpi(v35, "TTsect_Special1") ) | |
2156 { | |
2157 v40 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2158 *(char *)v40 |= 4u; | |
2159 goto LABEL_152; | |
2160 } | |
2161 if ( !_strcmpi(v35, "TTsect_Special2") ) | |
2162 { | |
2163 v41 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2164 *(char *)v41 |= 5u; | |
2165 goto LABEL_152; | |
2166 } | |
2167 if ( !_strcmpi(v35, "TTsect_Special3") ) | |
2168 { | |
2169 v42 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2170 *(char *)v42 |= 6u; | |
2171 goto LABEL_152; | |
2172 } | |
2173 if ( !_strcmpi(v35, "TTsect_Special4") ) | |
2174 { | |
2175 v43 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2176 *(char *)v43 |= 7u; | |
2177 goto LABEL_152; | |
2178 } | |
2179 if ( !_strcmpi(v35, "TTsect_Special5") ) | |
2180 { | |
2181 v44 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2182 *(char *)v44 |= 8u; | |
2183 goto LABEL_152; | |
2184 } | |
2185 if ( !_strcmpi(v35, "TTsect_Special6") ) | |
2186 { | |
2187 v45 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2188 *(char *)v45 |= 9u; | |
2189 goto LABEL_152; | |
2190 } | |
2191 if ( !_strcmpi(v35, "TTsect_Special7") ) | |
2192 { | |
2193 v46 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2194 *(char *)v46 |= 0xAu; | |
2195 goto LABEL_152; | |
2196 } | |
2197 if ( !_strcmpi(v35, "TTsect_Special8") ) | |
2198 { | |
2199 v47 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2200 *(char *)v47 |= 0xBu; | |
2201 goto LABEL_152; | |
2202 } | |
2203 if ( !_strcmpi(v35, "TTsect_NE1") ) | |
2204 goto LABEL_130; | |
2205 if ( !_strcmpi(v35, "TTsect_NW1") ) | |
2206 goto LABEL_134; | |
2207 if ( !_strcmpi(v35, "TTsect_SE1") ) | |
2208 goto LABEL_130; | |
2209 if ( !_strcmpi(v35, "TTsect_SW1") ) | |
2210 goto LABEL_134; | |
2211 if ( !_strcmpi(v35, "TTsect_E1") ) | |
2212 goto LABEL_138; | |
2213 if ( !_strcmpi(v35, "TTsect_W1") ) | |
2214 goto LABEL_140; | |
2215 if ( !_strcmpi(v35, "TTsect_N1") ) | |
2216 goto LABEL_142; | |
2217 if ( !_strcmpi(v35, "TTsect_S1") ) | |
2218 goto LABEL_144; | |
2219 if ( !_strcmpi(v35, "TTsect_XNE1") ) | |
2220 goto LABEL_146; | |
2221 if ( _strcmpi(v35, "TTsect_XNW1") ) | |
2222 { | |
2223 if ( !_strcmpi(v35, "TTsect_XSE1") ) | |
2224 goto LABEL_146; | |
2225 if ( _strcmpi(v35, "TTsect_XSW1") ) | |
2226 { | |
2227 if ( !_strcmpi(v35, "TTsect_CROS") ) | |
2228 { | |
2229 LABEL_151: | |
2230 v70 = (int)&v2->pTiles[v2->uNumTiles].uAttributes; | |
2231 *(short *)v70 |= 0x200u; | |
2232 goto LABEL_152; | |
2233 } | |
2234 if ( !_strcmpi(v35, "TTsect_NS") ) | |
2235 { | |
2236 v48 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2237 *(char *)v48 |= 1u; | |
2238 goto LABEL_151; | |
2239 } | |
2240 if ( !_strcmpi(v35, "TTsect_EW") ) | |
2241 { | |
2242 v49 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2243 *(char *)v49 |= 2u; | |
2244 goto LABEL_151; | |
2245 } | |
2246 if ( !_strcmpi(v35, "TTsect_N_E") ) | |
2247 { | |
2248 v50 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2249 *(char *)v50 |= 3u; | |
2250 goto LABEL_151; | |
2251 } | |
2252 if ( !_strcmpi(v35, "TTsect_N_W") ) | |
2253 { | |
2254 v51 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2255 *(char *)v51 |= 4u; | |
2256 goto LABEL_151; | |
2257 } | |
2258 if ( !_strcmpi(v35, "TTsect_S_E") ) | |
2259 { | |
2260 v52 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2261 *(char *)v52 |= 5u; | |
2262 goto LABEL_151; | |
2263 } | |
2264 if ( !_strcmpi(v35, "TTsect_S_W") ) | |
2265 { | |
2266 v53 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2267 *(char *)v53 |= 6u; | |
2268 goto LABEL_151; | |
2269 } | |
2270 if ( !_strcmpi(v35, "TTsect_NS_E") ) | |
2271 { | |
2272 v54 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2273 *(char *)v54 |= 7u; | |
2274 goto LABEL_151; | |
2275 } | |
2276 if ( !_strcmpi(v35, "TTsect_NS_W") ) | |
2277 { | |
2278 v55 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2279 *(char *)v55 |= 8u; | |
2280 goto LABEL_151; | |
2281 } | |
2282 if ( !_strcmpi(v35, "TTsect_EW_N") ) | |
2283 { | |
2284 v56 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2285 *(char *)v56 |= 9u; | |
2286 goto LABEL_151; | |
2287 } | |
2288 if ( !_strcmpi(v35, "TTsect_EW_S") ) | |
2289 { | |
2290 v57 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2291 *(char *)v57 |= 0xAu; | |
2292 goto LABEL_151; | |
2293 } | |
2294 if ( !_strcmpi(v35, "TTsect_NCAP") ) | |
2295 { | |
2296 v58 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2297 *(char *)v58 |= 0xBu; | |
2298 goto LABEL_151; | |
2299 } | |
2300 if ( !_strcmpi(v35, "TTsect_ECAP") ) | |
2301 { | |
2302 LABEL_130: | |
2303 v59 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2304 *(char *)v59 |= 0xCu; | |
2305 goto LABEL_151; | |
2306 } | |
2307 if ( !_strcmpi(v35, "TTsect_SCAP") ) | |
2308 { | |
2309 v60 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2310 *(char *)v60 |= 0xDu; | |
2311 goto LABEL_151; | |
2312 } | |
2313 if ( !_strcmpi(v35, "TTsect_WCAP") ) | |
2314 { | |
2315 LABEL_134: | |
2316 v61 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2317 *(char *)v61 |= 0xEu; | |
2318 goto LABEL_151; | |
2319 } | |
2320 if ( !_strcmpi(v35, "TTsect_DN") ) | |
2321 { | |
2322 v62 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2323 *(char *)v62 |= 0xFu; | |
2324 goto LABEL_151; | |
2325 } | |
2326 if ( !_strcmpi(v35, "TTsect_DS") ) | |
2327 { | |
2328 LABEL_138: | |
2329 v63 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2330 *(char *)v63 |= 0x10u; | |
2331 goto LABEL_151; | |
2332 } | |
2333 if ( !_strcmpi(v35, "TTsect_DW") ) | |
2334 { | |
2335 LABEL_140: | |
2336 v64 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2337 *(char *)v64 |= 0x11u; | |
2338 goto LABEL_151; | |
2339 } | |
2340 if ( !_strcmpi(v35, "TTsect_DE") ) | |
2341 { | |
2342 LABEL_142: | |
2343 v65 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2344 *(char *)v65 |= 0x12u; | |
2345 goto LABEL_151; | |
2346 } | |
2347 if ( !_strcmpi(v35, "TTsect_DSW") ) | |
2348 { | |
2349 LABEL_144: | |
2350 v66 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2351 *(char *)v66 |= 0x13u; | |
2352 goto LABEL_151; | |
2353 } | |
2354 if ( !_strcmpi(v35, "TTsect_DNE") ) | |
2355 { | |
2356 LABEL_146: | |
2357 v67 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2358 *(char *)v67 |= 0x14u; | |
2359 goto LABEL_151; | |
2360 } | |
2361 if ( !_strcmpi(v35, "TTsect_DSE") ) | |
2362 { | |
2363 v68 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2364 *(char *)v68 |= 0x15u; | |
2365 goto LABEL_151; | |
2366 } | |
2367 if ( _strcmpi(v35, "TTsect_DNW") ) | |
2368 goto LABEL_152; | |
2369 } | |
2370 } | |
2371 v69 = (int)&v2->pTiles[v2->uNumTiles].uSection; | |
2372 *(char *)v69 |= 0x16u; | |
2373 goto LABEL_151; | |
2374 } | |
2375 LABEL_174: | |
2376 fclose(File); | |
2377 return 1; | |
2378 } | |
2379 | |
2380 | |
2381 | |
2382 //----- (0048958E) -------------------------------------------------------- | |
2383 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
2384 { | |
2385 stru12_MemoryBlock *v2; // esi@1 | |
2386 void *v3; // eax@1 | |
2387 void *v4; // ecx@1 | |
2388 stru12_MemoryBlock *result; // eax@1 | |
2389 | |
2390 v2 = this; | |
2391 v3 = operator new(8 * a2 + 16); | |
2392 v2->pBlockBase = v3; | |
2393 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
2394 result = v2; | |
2395 v2->pAlignedBlock = v4; | |
2396 } | |
2397 | |
2398 //----- (004895B7) -------------------------------------------------------- | |
2399 stru12::stru12(stru11 *pStru11) | |
2400 { | |
2401 stru12 *v2; // esi@1 | |
2402 | |
2403 v2 = this; | |
2404 this->field_44 = 0x41000000u; | |
2405 this->field_4C = 0x46000000u; | |
2406 //this->vdestructor_ptr = stru12::_4898E6; | |
2407 this->field_48 = 0; | |
2408 this->field_50 = 0; | |
2409 this->field_54 = 0x33D6BF95u; | |
2410 this->field_58 = 0; | |
2411 | |
2412 for (int i = 0; i < 12; ++i) | |
2413 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
2414 /* | |
2415 v3 = (stru12_MemoryBlock *)operator new(8u); | |
2416 if ( v3 ) | |
2417 v4 = AllocAlignedMem(v3, 640); | |
2418 else | |
2419 v4 = 0; | |
2420 v2->pMemBlocks[0] = v4; | |
2421 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
2422 if ( v5 ) | |
2423 v6 = AllocAlignedMem(v5, 640); | |
2424 else | |
2425 v6 = 0; | |
2426 v2->pMemBlocks[1] = v6; | |
2427 v7 = (stru12_MemoryBlock *)operator new(8u); | |
2428 if ( v7 ) | |
2429 v8 = AllocAlignedMem(v7, 640); | |
2430 else | |
2431 v8 = 0; | |
2432 v2->pMemBlocks[2] = v8; | |
2433 v9 = (stru12_MemoryBlock *)operator new(8u); | |
2434 if ( v9 ) | |
2435 v10 = AllocAlignedMem(v9, 640); | |
2436 else | |
2437 v10 = 0; | |
2438 v2->pMemBlocks[3] = v10; | |
2439 v11 = (stru12_MemoryBlock *)operator new(8u); | |
2440 if ( v11 ) | |
2441 v12 = AllocAlignedMem(v11, 640); | |
2442 else | |
2443 v12 = 0; | |
2444 v2->pMemBlocks[4] = v12; | |
2445 v13 = (stru12_MemoryBlock *)operator new(8u); | |
2446 if ( v13 ) | |
2447 v14 = AllocAlignedMem(v13, 640); | |
2448 else | |
2449 v14 = 0; | |
2450 v2->pMemBlocks[5] = v14; | |
2451 v15 = (stru12_MemoryBlock *)operator new(8u); | |
2452 if ( v15 ) | |
2453 v16 = AllocAlignedMem(v15, 640); | |
2454 else | |
2455 v16 = 0; | |
2456 v2->pMemBlocks[6] = v16; | |
2457 v17 = (stru12_MemoryBlock *)operator new(8u); | |
2458 if ( v17 ) | |
2459 v18 = AllocAlignedMem(v17, 640); | |
2460 else | |
2461 v18 = 0; | |
2462 v2->pMemBlocks[7] = v18; | |
2463 v19 = (stru12_MemoryBlock *)operator new(8u); | |
2464 if ( v19 ) | |
2465 v20 = AllocAlignedMem(v19, 640); | |
2466 else | |
2467 v20 = 0; | |
2468 v2->pMemBlocks[8] = v20; | |
2469 v21 = (stru12_MemoryBlock *)operator new(8u); | |
2470 if ( v21 ) | |
2471 v22 = AllocAlignedMem(v21, 640); | |
2472 else | |
2473 v22 = 0; | |
2474 v2->pMemBlocks[9] = v22; | |
2475 v23 = (stru12_MemoryBlock *)operator new(8u); | |
2476 if ( v23 ) | |
2477 v24 = AllocAlignedMem(v23, 640); | |
2478 else | |
2479 v24 = 0; | |
2480 v2->pMemBlocks[10] = v24; | |
2481 v25 = (stru12_MemoryBlock *)operator new(8u); | |
2482 if ( v25 ) | |
2483 v26 = AllocAlignedMem(v25, 640); | |
2484 else | |
2485 v26 = 0; | |
2486 v2->field_8C = 0; | |
2487 v2->pMemBlocks[11] = v26;*/ | |
2488 } | |
2489 | |
2490 //----- (00489810) -------------------------------------------------------- | |
2491 stru12::~stru12() | |
2492 { | |
2493 for (int i = 0; i < 12; ++i) | |
2494 delete pMemBlocks[i]; | |
2495 /*if ( v2 ) | |
2496 stru12_MemoryBlock::dtor(v2, 1); | |
2497 v3 = v1->pMemBlocks[1]; | |
2498 if ( v3 ) | |
2499 stru12_MemoryBlock::dtor(v3, 1); | |
2500 v4 = v1->pMemBlocks[2]; | |
2501 if ( v4 ) | |
2502 stru12_MemoryBlock::dtor(v4, 1); | |
2503 v5 = v1->pMemBlocks[3]; | |
2504 if ( v5 ) | |
2505 stru12_MemoryBlock::dtor(v5, 1); | |
2506 v6 = v1->pMemBlocks[4]; | |
2507 if ( v6 ) | |
2508 stru12_MemoryBlock::dtor(v6, 1); | |
2509 v7 = v1->pMemBlocks[5]; | |
2510 if ( v7 ) | |
2511 stru12_MemoryBlock::dtor(v7, 1); | |
2512 v8 = v1->pMemBlocks[6]; | |
2513 if ( v8 ) | |
2514 stru12_MemoryBlock::dtor(v8, 1); | |
2515 v9 = v1->pMemBlocks[7]; | |
2516 if ( v9 ) | |
2517 stru12_MemoryBlock::dtor(v9, 1); | |
2518 v10 = v1->pMemBlocks[8]; | |
2519 if ( v10 ) | |
2520 stru12_MemoryBlock::dtor(v10, 1); | |
2521 v11 = v1->pMemBlocks[9]; | |
2522 if ( v11 ) | |
2523 stru12_MemoryBlock::dtor(v11, 1); | |
2524 v12 = v1->pMemBlocks[10]; | |
2525 if ( v12 ) | |
2526 stru12_MemoryBlock::dtor(v12, 1); | |
2527 v13 = v1->pMemBlocks[11]; | |
2528 if ( v13 ) | |
2529 stru12_MemoryBlock::dtor(v13, 1);*/ | |
2530 } | |
2531 | |
2532 //----- (004898BF) -------------------------------------------------------- | |
2533 stru12_MemoryBlock::~stru12_MemoryBlock() | |
2534 { | |
2535 stru12_MemoryBlock *v2; // esi@1 | |
2536 void *v3; // ST00_4@1 | |
2537 | |
2538 v2 = this; | |
2539 v3 = this->pBlockBase; | |
2540 this->pAlignedBlock = 0; | |
2541 free(v3); | |
2542 v2->pBlockBase = 0; | |
2543 /*if ( a2 & 1 ) | |
2544 free(v2);*/ | |
2545 } | |
2546 | |
2547 //----- (004898E6) -------------------------------------------------------- | |
2548 void stru12::_4898E6() | |
2549 { | |
2550 void *v1; // eax@1 | |
2551 void *v2; // edx@1 | |
2552 char *v3; // edi@2 | |
2553 double v4; // st7@2 | |
2554 char *v5; // ebx@2 | |
2555 double v6; // st6@3 | |
2556 double v7; // st5@3 | |
2557 double v8; // st4@3 | |
2558 int v9; // esi@3 | |
2559 double v10; // st3@3 | |
2560 float v11; // ST34_4@5 | |
2561 double v12; // st6@10 | |
2562 double v13; // ST0C_8@10 | |
2563 char *v14; // [sp+14h] [bp-44h]@2 | |
2564 char *v15; // [sp+18h] [bp-40h]@2 | |
2565 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
2566 char *v17; // [sp+20h] [bp-38h]@2 | |
2567 char *v18; // [sp+24h] [bp-34h]@2 | |
2568 float v19; // [sp+30h] [bp-28h]@3 | |
2569 float v20; // [sp+38h] [bp-20h]@3 | |
2570 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
2571 int v22; // [sp+40h] [bp-18h]@1 | |
2572 char *v23; // [sp+44h] [bp-14h]@2 | |
2573 char *v24; // [sp+48h] [bp-10h]@2 | |
2574 int v25; // [sp+4Ch] [bp-Ch]@2 | |
2575 float v26; // [sp+50h] [bp-8h]@3 | |
2576 float v27; // [sp+54h] [bp-4h]@3 | |
2577 | |
731 | 2578 __debugbreak(); |
0 | 2579 v22 = 0; |
2580 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
2581 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
2582 if ( this->field_8C > 0 ) | |
2583 { | |
2584 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
2585 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
2586 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
2587 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
2588 v25 = (int)v1 - (int)v2; | |
2589 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
2590 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
2591 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
2592 v4 = 1.0; | |
2593 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
2594 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
2595 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
2596 do | |
2597 { | |
2598 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
2599 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
2600 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
2601 v7 = pIndoorCamera->fRotationYCosine; | |
2602 v8 = pIndoorCamera->fRotationYSine; | |
2603 v20 = pIndoorCamera->fRotationXCosine; | |
2604 v19 = pIndoorCamera->fRotationXSine; | |
2605 v9 = (int)((char *)v2 + (int)v21); | |
2606 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
2607 if ( pIndoorCamera->sRotationX ) | |
2608 { | |
2609 v11 = v10; | |
2610 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
2611 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
2612 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
2613 } | |
2614 else | |
2615 { | |
2616 *(float *)v9 = v10; | |
2617 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
2618 *(float *)((char *)v2 + (int)v5) = v6; | |
2619 } | |
2620 if ( *(float *)v9 >= 8.0 ) | |
2621 { | |
2622 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
2623 { | |
2624 *(int *)v2 = 0; | |
2625 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
2626 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
2627 - v12 * *(float *)((char *)v2 + (int)v3); | |
2628 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
2629 - v12 * *(float *)((char *)v2 + (int)v5); | |
2630 *(float *)((char *)v2 + (int)v16) = v4 | |
2631 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
2632 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
2633 v13 = *(float *)v9 + 6.7553994e15; | |
2634 v4 = 1.0; | |
2635 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
2636 } | |
2637 else | |
2638 { | |
2639 *(int *)v2 = 2; | |
2640 } | |
2641 } | |
2642 else | |
2643 { | |
2644 *(int *)v2 = 1; | |
2645 } | |
2646 ++v22; | |
2647 v2 = (char *)v2 + 4; | |
2648 } | |
2649 while ( v22 < this->field_8C ); | |
2650 } | |
2651 this->field_8C = 0; | |
2652 } | |
2653 | |
2654 | |
2655 | |
2656 | |
2657 | |
2658 //----- (0048A959) -------------------------------------------------------- | |
2659 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
2660 { | |
2661 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
2662 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
2663 b = (uColor & 0x000000FF) / 255.0f; | |
2664 | |
2665 float h, s, v; | |
2666 RGB2HSV(&h, &s, r, g, b, &v); | |
2667 | |
2668 if ( h_replace != -1.0 ) | |
2669 h = h_replace; | |
2670 if ( s_replace != -1.0 ) | |
2671 s = s_replace; | |
2672 if ( v_replace != -1.0 ) | |
2673 v = v_replace; | |
2674 HSV2RGB(&r, &g, &b, h, s, v); | |
2675 | |
2676 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
2677 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
2678 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
2679 } | |
2680 | |
2681 | |
2682 //----- (0048B561) -------------------------------------------------------- | |
2683 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
2684 { | |
2685 //v2 = a2 - 0.5; | |
2686 //v3 = v2 + 6.7553994e15; | |
2687 int v4 = floorf(a2 - 0.5f + 0.5f); | |
2688 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
2689 //v5 = v7 + 6.7553994e15; | |
2690 //return LODWORD(v5) | (v4 << 16); | |
2691 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
2692 return v5 | (v4 << 16); | |
2693 } | |
2694 | |
2695 | |
2696 | |
2697 | |
2698 | |
2699 | |
2700 //----- (00491E3A) -------------------------------------------------------- | |
2701 void __cdecl sub_491E3A() | |
2702 { | |
2703 Player *v0; // ebx@1 | |
2704 signed int v1; // esi@3 | |
2705 char *v2; // eax@4 | |
2706 unsigned int v3; // eax@7 | |
2707 unsigned int v4; // edx@8 | |
2708 char *v5; // ecx@9 | |
2709 int v6; // edi@17 | |
2710 Texture *v7; // ebx@18 | |
2711 struct IDirect3DTexture2 **v8; // eax@19 | |
2712 struct IDirect3DTexture2 *v9; // eax@20 | |
2713 struct IDirectDrawSurface **v10; // eax@22 | |
2714 struct IDirectDrawSurface *v11; // eax@23 | |
2715 int v12; // eax@26 | |
2716 | |
2717 v0 = pParty->pPlayers; | |
2718 do | |
2719 { | |
203 | 2720 if (SoundSetAction[24][0]) |
0 | 2721 { |
2722 v1 = 0; | |
2723 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
2724 { | |
2725 LABEL_7: | |
2726 v3 = 0; | |
2727 } | |
2728 else | |
2729 { | |
2730 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 2731 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 2732 { |
2733 ++v1; | |
2734 v2 += 120; | |
2735 if ( v1 >= (signed int)pSoundList->uNumSounds ) | |
2736 goto LABEL_7; | |
2737 } | |
2738 v3 = v1; | |
2739 } | |
2740 pSoundList->_4A9DCD(v3, 1); | |
2741 v4 = 0; | |
2742 if ( (signed int)pSoundList->uNumSounds <= 0 ) | |
2743 { | |
2744 LABEL_12: | |
2745 v4 = 0; | |
2746 } | |
2747 else | |
2748 { | |
2749 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 2750 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 2751 { |
2752 ++v4; | |
2753 v5 += 120; | |
2754 if ( (signed int)v4 >= (signed int)pSoundList->uNumSounds ) | |
2755 goto LABEL_12; | |
2756 } | |
2757 } | |
2758 pSoundList->_4A9DCD(v4, 1); | |
2759 } | |
2760 ++v0; | |
2761 } | |
2762 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
2763 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 2764 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 2765 { |
2766 v7 = &pIcons_LOD->pTextures[v6]; | |
2767 do | |
2768 { | |
2769 v7->Release(); | |
2770 v8 = pIcons_LOD->pHardwareTextures; | |
2771 if ( v8 ) | |
2772 { | |
2773 v9 = v8[v6]; | |
2774 if ( v9 ) | |
2775 { | |
2776 v9->Release(); | |
2777 pIcons_LOD->pHardwareTextures[v6] = 0; | |
2778 } | |
2779 } | |
2780 v10 = pIcons_LOD->pHardwareSurfaces; | |
2781 if ( v10 ) | |
2782 { | |
2783 v11 = v10[v6]; | |
2784 if ( v11 ) | |
2785 { | |
2786 v11->Release(); | |
2787 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
2788 } | |
2789 } | |
2790 --v6; | |
2791 --v7; | |
2792 } | |
33 | 2793 while ( v6 >= pIcons_LOD->pFacesLock ); |
2794 } | |
2795 v12 = pIcons_LOD->pFacesLock; | |
2796 pIcons_LOD->pFacesLock = 0; | |
0 | 2797 pIcons_LOD->uNumLoadedFiles = v12; |
2798 } | |
2799 // 4ED498: using guessed type char byte_4ED498; | |
2800 | |
706 | 2801 |
0 | 2802 |
2803 | |
2804 //----- (0049387A) -------------------------------------------------------- | |
2805 int CycleCharacter(unsigned int _this) | |
2806 { | |
2807 signed int result; // eax@1 | |
2808 signed int v2; // ecx@2 | |
2809 signed int v3; // ecx@8 | |
2810 | |
2811 result = uActiveCharacter; | |
2812 if ( _this ) | |
2813 { | |
2814 v2 = 0; | |
2815 while ( 1 ) | |
2816 { | |
2817 --result; | |
2818 if ( result < 1 ) | |
2819 result = 4; | |
2820 if ( !pPlayers[result]->uTimeToRecovery ) | |
2821 break; | |
2822 ++v2; | |
2823 if ( v2 >= 4 ) | |
2824 return uActiveCharacter; | |
2825 } | |
2826 } | |
2827 else | |
2828 { | |
2829 v3 = 0; | |
2830 while ( 1 ) | |
2831 { | |
2832 ++result; | |
2833 if ( result > 4 ) | |
2834 result = 1; | |
2835 if ( !pPlayers[result]->uTimeToRecovery ) | |
2836 break; | |
2837 ++v3; | |
2838 if ( v3 >= 4 ) | |
2839 return uActiveCharacter; | |
2840 } | |
2841 } | |
2842 return result; | |
2843 } | |
2844 | |
2845 //----- (004938D1) -------------------------------------------------------- | |
2846 void __fastcall Rest(unsigned int uHoursToSleep) | |
2847 { | |
2848 unsigned int v1; // esi@1 | |
2849 double v2; // st7@3 | |
2850 Player **v3; // esi@3 | |
2851 | |
2852 v1 = uHoursToSleep; | |
2853 if ( uHoursToSleep > 240 ) | |
2854 InitializeActors(); | |
2855 v2 = (double)(7680 * v1) * 0.033333335; | |
2856 pParty->uTimePlayed += (signed __int64)v2; | |
2857 v3 = &pPlayers[1]; | |
2858 do | |
2859 { | |
2860 (*v3)->Recover((signed __int64)v2); | |
2861 ++v3; | |
2862 } | |
2863 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
2864 _494035_timed_effects__water_walking_damage__etc(); | |
2865 } | |
2866 | |
2867 //----- (00493938) -------------------------------------------------------- | |
2868 int __cdecl _493938_regenerate() | |
2869 { | |
2870 int v0; // edi@1 | |
2871 signed __int64 v1; // qax@1 | |
2872 int v2; // ecx@1 | |
2873 int result; // eax@1 | |
2874 int v4; // eax@2 | |
2875 int v5; // edi@5 | |
112 | 2876 int *v6; // ecx@5 |
0 | 2877 char v7; // sf@5 |
112 | 2878 int *v8; // ecx@10 |
0 | 2879 int v9; // edi@15 |
2880 signed int v10; // eax@15 | |
2881 __int16 *v11; // edx@16 | |
2882 int v12; // eax@20 | |
2883 int v13; // ebx@20 | |
2884 unsigned int *v14; // esi@21 | |
2885 unsigned int v15; // ecx@21 | |
2886 unsigned int v16; // eax@21 | |
2887 int v17; // edx@21 | |
2888 int v18; // eax@21 | |
2889 signed int v19; // eax@21 | |
2890 signed int v20; // ebx@25 | |
2891 Player *v21; // esi@25 | |
2892 ITEM_EQUIP_TYPE v22; // edi@30 | |
2893 //int v23; // edx@31 | |
2894 signed int v24; // ecx@32 | |
2895 signed int v25; // eax@33 | |
2896 int v26; // eax@35 | |
2897 int v27; // eax@36 | |
2898 int v28; // eax@37 | |
2899 int v29; // eax@40 | |
2900 int v30; // eax@41 | |
2901 signed int v31; // ecx@53 | |
2902 char *v32; // eax@53 | |
2903 char *v33; // edi@82 | |
2904 int v34; // ecx@88 | |
2905 int v35; // eax@88 | |
2906 char *v36; // edi@99 | |
2907 int v37; // edi@104 | |
2908 int v38; // edi@106 | |
2909 int v39; // edi@111 | |
2910 int v40; // ecx@113 | |
2911 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
|
2912 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2913 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2914 int v44; // [sp+210h] [bp-20h]@22 | |
2915 int v45; // [sp+214h] [bp-1Ch]@25 | |
2916 int v46; // [sp+218h] [bp-18h]@25 | |
2917 int v47; // [sp+21Ch] [bp-14h]@25 | |
2918 int v48; // [sp+220h] [bp-10h]@25 | |
2919 int v49; // [sp+224h] [bp-Ch]@24 | |
2920 int v50; // [sp+228h] [bp-8h]@25 | |
2921 int v51; // [sp+22Ch] [bp-4h]@2 | |
2922 | |
2923 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2924 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2925 v2 = (signed int)v1 / 60; | |
2926 result = (signed int)v1 / 60 + 5; | |
2927 if ( v0 >= result ) | |
2928 { | |
2929 v51 = 0; | |
2930 v4 = (v0 - v2) / 5; | |
2931 if (pParty->FlyActive()) | |
2932 { | |
2933 if ( pParty->bFlying ) | |
2934 { | |
569 | 2935 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2936 { // colliding with something in the air - fall down | |
2937 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2938 //__debugbreak(); | |
2939 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2940 v7 = *v6 < v5; |
2941 *v6 -= v5; | |
0 | 2942 if ( v7 ) |
2943 { | |
112 | 2944 *v6 = 0; |
0 | 2945 pParty->uFlags &= 0xFFFFFFBFu; |
2946 pParty->bFlying = 0; | |
2947 v51 = 1; | |
2948 } | |
2949 } | |
2950 } | |
2951 } | |
569 | 2952 |
0 | 2953 if (pParty->WaterWalkActive()) |
2954 { | |
569 | 2955 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2956 { | |
2957 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2958 { // taking on water | |
2959 //__debugbreak(); | |
2960 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2961 v7 = *v8 < v4; |
2962 *v8 -= v4; | |
0 | 2963 if ( v7 ) |
2964 { | |
112 | 2965 *v8 = 0; |
569 | 2966 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2967 v51 = 1; |
2968 } | |
2969 } | |
2970 } | |
2971 } | |
569 | 2972 |
0 | 2973 if (pParty->ImmolationActive()) |
2974 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2975 //SpriteObject::SpriteObject(&a1); |
0 | 2976 v9 = 0; |
2977 a3.z = 0; | |
2978 a3.y = 0; | |
2979 a3.x = 0; | |
2980 a1.stru_24.Reset(); | |
2981 a1.field_4C = pParty->pPartyBuffs[10].uPower; | |
2982 a1.field_50 = pParty->ImmolationSkillLevel(); | |
2983 v10 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2984 a1.uType = 1070; |
0 | 2985 a1.field_48 = 8; |
2986 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2987 { | |
2988 LABEL_19: | |
2989 LOWORD(v10) = 0; | |
2990 } | |
2991 else | |
2992 { | |
2993 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2994 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2995 { |
2996 ++v10; | |
2997 v11 += 28; | |
2998 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2999 goto LABEL_19; | |
3000 } | |
3001 } | |
3002 a1.uObjectDescID = v10; | |
3003 a1.field_60_distance_related_prolly_lod = 0; | |
3004 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 3005 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 3006 a1.uAttributes = 0; |
3007 a1.uSectorID = 0; | |
3008 a1.uSpriteFrameID = 0; | |
303 | 3009 a1.field_58_pid = v12; |
0 | 3010 a1.uFacing = 0; |
3011 a1.uSoundID = 0; | |
3012 v13 = sub_46A89E((int)v41, 100, 307); | |
3013 if ( v13 > 0 ) | |
3014 { | |
3015 do | |
3016 { | |
3017 v14 = (unsigned int *)&v41[4 * v9]; | |
3018 v15 = *v14; | |
3019 v16 = *v14; | |
3020 a1.vPosition.x = pActors[v16].vPosition.x; | |
3021 v17 = pActors[v16].vPosition.y; | |
3022 a1.vPosition.z = pActors[v16].vPosition.z; | |
3023 v18 = 8 * v15; | |
3024 LOBYTE(v18) = 8 * v15 | 3; | |
3025 a1.vPosition.y = v17; | |
3026 a1.field_5C = v18; | |
3027 v19 = a1.Create(0, 0, 0, 0); | |
3028 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
3029 ++v9; | |
3030 } | |
3031 while ( v9 < v13 ); | |
3032 } | |
3033 } | |
3034 v44 = 0; | |
248 | 3035 if (PartyHasDragon()) |
0 | 3036 v44 = 1; |
3037 v49 = 0; | |
3038 LABEL_25: | |
3039 v20 = 0; | |
3040 v21 = &pParty->pPlayers[v49]; | |
3041 v50 = 0; | |
3042 v47 = 0; | |
3043 v45 = 0; | |
3044 v48 = 0; | |
3045 v46 = 0; | |
255 | 3046 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 3047 v50 = 1; |
135 | 3048 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 3049 v48 = 1; |
3050 v22 = (ITEM_EQUIP_TYPE)0; | |
3051 while ( 1 ) | |
3052 { | |
3053 if ( v21->HasItemEquipped(v22) ) | |
3054 { | |
3055 //v23 = v21->pEquipment.pIndices; | |
3056 auto _idx = v21->pEquipment.pIndices[v22]; | |
3057 v24 = v21->pInventoryItems[_idx].uItemID; | |
3058 if ( v24 > 134 ) | |
3059 { | |
3060 if ( v24 == 529 ) | |
3061 goto LABEL_43; | |
3062 if ( v24 == 535 ) | |
3063 goto LABEL_44; | |
3064 if ( v24 == 515 ) | |
3065 { | |
3066 v47 = 1; | |
3067 } | |
3068 else | |
3069 { | |
3070 if ( v24 == 532 ) | |
3071 goto LABEL_50; | |
3072 } | |
3073 } | |
3074 else | |
3075 { | |
377 | 3076 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 3077 if ( v25 <= 50 ) |
3078 { | |
3079 if ( v25 != 50 ) | |
3080 { | |
3081 v26 = v25 - 37; | |
3082 if ( v26 ) | |
3083 { | |
3084 v27 = v26 - 1; | |
3085 if ( !v27 ) | |
3086 goto LABEL_50; | |
3087 v28 = v27 - 6; | |
3088 if ( v28 ) | |
3089 { | |
3090 if ( v28 != 3 ) | |
3091 goto LABEL_51; | |
3092 LABEL_50: | |
3093 v50 = 1; | |
3094 goto LABEL_51; | |
3095 } | |
3096 } | |
3097 } | |
3098 LABEL_44: | |
3099 v20 = 1; | |
3100 goto LABEL_51; | |
3101 } | |
3102 v29 = v25 - 54; | |
3103 if ( !v29 ) | |
3104 goto LABEL_44; | |
3105 v30 = v29 - 1; | |
3106 if ( !v30 ) | |
3107 goto LABEL_50; | |
3108 if ( v30 == 11 ) | |
3109 { | |
3110 LABEL_43: | |
3111 v20 = 1; | |
3112 v50 = 1; | |
3113 goto LABEL_51; | |
3114 } | |
3115 } | |
3116 } | |
3117 LABEL_51: | |
3118 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
3119 if ( (signed int)v22 >= 16 ) | |
3120 { | |
3121 if ( v48 ) | |
3122 { | |
3123 v31 = 0; | |
3124 v32 = (char *)v21->pInventoryItems; | |
3125 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
3126 { | |
3127 ++v31; | |
3128 v32 += 36; | |
3129 if ( v31 >= 138 ) | |
3130 goto LABEL_59; | |
3131 } | |
3132 v48 = 0; | |
3133 v45 = 1; | |
3134 } | |
3135 LABEL_59: | |
3136 if ( v21->pConditions[17] ) | |
3137 v46 = 1; | |
3138 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3139 { | |
3140 ++v21->sHealth; | |
3141 if ( v21->sHealth > v21->GetMaxHealth() ) | |
3142 v21->sHealth = v21->GetMaxHealth(); | |
3143 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
3144 { | |
3145 LODWORD(v21->pConditions[13]) = 0; | |
3146 HIDWORD(v21->pConditions[13]) = 0; | |
3147 } | |
3148 v51 = 1; | |
3149 } | |
3150 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
3151 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
3152 && !v21->pConditions[14] | |
3153 && !v21->pConditions[16] ) | |
3154 { | |
3155 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
3156 if ( v21->sHealth > v21->GetMaxHealth() ) | |
3157 v21->sHealth = v21->GetMaxHealth(); | |
3158 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
3159 { | |
3160 LODWORD(v21->pConditions[13]) = 0; | |
3161 HIDWORD(v21->pConditions[13]) = 0; | |
3162 } | |
3163 v51 = 1; | |
3164 } | |
3165 if ( v50 ) | |
3166 { | |
3167 v33 = (char *)&v21->sMana; | |
3168 ++*(int *)v33; | |
3169 if ( v21->sMana > v21->GetMaxMana() ) | |
3170 *(int *)v33 = v21->GetMaxMana(); | |
3171 v51 = 1; | |
3172 } | |
3173 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3174 { | |
3175 v34 = LODWORD(v21->pConditions[13]); | |
3176 --v21->sHealth; | |
3177 v35 = v21->sHealth; | |
3178 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
3179 v21->pConditions[13] = pParty->uTimePlayed; | |
3180 if ( v35 < 1 ) | |
3181 { | |
3182 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3183 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
3184 { | |
3185 v21->pConditions[13] = pParty->uTimePlayed; | |
3186 } | |
3187 else | |
3188 { | |
3189 if ( !v21->pConditions[14] ) | |
3190 v21->pConditions[14] = pParty->uTimePlayed; | |
3191 } | |
3192 } | |
3193 v51 = 1; | |
3194 } | |
3195 if ( v45 ) | |
3196 { | |
3197 v36 = (char *)&v21->sMana; | |
3198 ++*(int *)v36; | |
3199 if ( v21->sMana > v21->GetMaxMana() ) | |
3200 *(int *)v36 = v21->GetMaxMana(); | |
3201 } | |
3202 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3203 { | |
3204 v37 = v21->sHealth; | |
3205 if ( v37 > v21->GetMaxHealth() / 2 ) | |
3206 v21->sHealth = v37 - 2; | |
3207 v38 = v21->sMana; | |
3208 if ( v38 > v21->GetMaxMana() / 2 ) | |
3209 v21->sMana = v38 - 2; | |
3210 } | |
3211 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
3212 { | |
3213 v39 = v21->sHealth; | |
3214 if ( v39 > v21->GetMaxHealth() / 2 ) | |
3215 v21->sHealth = v39 - 1; | |
3216 v40 = v21->sMana; | |
3217 if ( v40 > 0 ) | |
3218 v21->sMana = v40 - 1; | |
3219 } | |
3220 ++v49; | |
3221 if ( v49 >= 4 ) | |
3222 { | |
3223 result = HIDWORD(pParty->uTimePlayed); | |
3224 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
3225 if ( !viewparams->bRedrawGameUI ) | |
3226 { | |
3227 result = v51; | |
3228 viewparams->bRedrawGameUI = v51; | |
3229 } | |
3230 return result; | |
3231 } | |
3232 goto LABEL_25; | |
3233 } | |
3234 } | |
3235 } | |
3236 return result; | |
3237 } | |
3238 | |
3239 | |
3240 | |
3241 //----- (00493F79) -------------------------------------------------------- | |
351 | 3242 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 3243 { |
3244 signed __int64 v2; // ST2C_8@1 | |
3245 signed __int64 v3; // qax@1 | |
351 | 3246 //signed __int64 v4; // ST1C_8@1 |
0 | 3247 unsigned __int64 v5; // qax@1 |
3248 unsigned int v6; // ebx@1 | |
3249 | |
3250 v2 = (signed __int64)((double)a2 * 0.234375); | |
3251 v3 = v2 / 60 / 60; | |
351 | 3252 //v4 = v3; |
0 | 3253 v5 = (unsigned int)v3 / 0x18; |
3254 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 3255 _this->field_0_expire_second = v2 % 60; |
3256 _this->field_4_expire_minute = v2 / 60 % 60; | |
3257 _this->field_8_expire_hour = v3 % 24; | |
3258 _this->field_10_expire_week = v5 / 7 & 3; | |
3259 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
3260 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 3261 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 3262 } |
3263 | |
3264 | |
3265 | |
3266 | |
3267 | |
3268 //----- (00494035) -------------------------------------------------------- | |
3269 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
3270 { | |
3271 signed __int64 v0; // qax@1 | |
3272 signed __int64 v1; // ST30_8@1 | |
3273 signed __int64 v2; // ST38_8@1 | |
3274 unsigned __int64 v3; // qax@1 | |
3275 unsigned int v4; // edi@1 | |
3276 //signed int v5; // eax@4 | |
3277 //char *v6; // ecx@5 | |
3278 //Player *v7; // esi@8 | |
3279 //char *v8; // ecx@12 | |
3280 Player *pPlayer; // esi@15 | |
3281 //void *v10; // esi@25 | |
3282 unsigned int v11; // ecx@27 | |
3283 signed int v12; // edi@29 | |
3284 Player *v13; // ecx@30 | |
3285 Player *v14; // esi@35 | |
3286 double v15; // st7@35 | |
3287 Player **v16; // esi@43 | |
3288 Player *v17; // edi@44 | |
3289 double v18; // st7@44 | |
3290 float v19; // ST28_4@48 | |
3291 double v20; // ST38_8@48 | |
3292 Player *v21; // esi@51 | |
3293 signed int v22; // edi@53 | |
3294 int v23; // eax@59 | |
3295 int v24; // ecx@60 | |
3296 int v25; // eax@63 | |
3297 int v26; // ecx@64 | |
3298 int v27; // eax@67 | |
3299 int v28; // ecx@68 | |
3300 int v29; // eax@71 | |
3301 int v30; // ecx@72 | |
3302 int v31; // eax@75 | |
3303 int v32; // ecx@76 | |
3304 int v33; // eax@79 | |
3305 int v34; // ecx@80 | |
3306 int v35; // eax@83 | |
3307 int v36; // ecx@84 | |
3308 int v37; // eax@87 | |
3309 int v38; // ecx@88 | |
3310 int v39; // eax@91 | |
3311 int v40; // ecx@92 | |
3312 int v41; // eax@95 | |
3313 int v42; // ecx@96 | |
3314 bool v43; // ebx@102 | |
3315 //SpellBuff *v44; // edi@104 | |
3316 //signed int v45; // ebp@104 | |
3317 bool v46; // edi@111 | |
3318 //SpellBuff *v47; // esi@113 | |
3319 //Player **v48; // esi@119 | |
3320 //signed int v49; // edi@121 | |
3321 //char *v50; // esi@122 | |
3322 signed int v51; // edx@128 | |
3323 signed int v52; // ecx@130 | |
3324 int v53; // eax@131 | |
3325 Player *v54; // eax@141 | |
3326 unsigned int v55; // [sp-8h] [bp-38h]@18 | |
3327 unsigned int v56; // [sp-8h] [bp-38h]@55 | |
3328 int v57; // [sp-4h] [bp-34h]@18 | |
3329 int v58; // [sp-4h] [bp-34h]@33 | |
3330 int v59; // [sp-4h] [bp-34h]@55 | |
3331 unsigned int v60; // [sp+10h] [bp-20h]@1 | |
3332 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
3333 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
3334 unsigned int a2; // [sp+18h] [bp-18h]@1 | |
3335 signed int a2a; // [sp+18h] [bp-18h]@47 | |
3336 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
3337 | |
3338 a2 = pParty->uCurrentHour; | |
3339 v61 = pParty->uDaysPlayed; | |
3340 v60 = pEventTimer->uTimeElapsed; | |
3341 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; | |
3342 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
3343 v1 = v0; | |
3344 v0 /= 60i64; | |
3345 v2 = v0; | |
3346 v3 = (unsigned int)v0 / 24; | |
3347 v4 = (unsigned int)(v3 / 7) >> 2; | |
3348 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
3349 pParty->uCurrentMinute = v1 % 60; | |
3350 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
3351 pParty->uCurrentHour = v2 % 24; | |
3352 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
3353 pParty->uCurrentMonth = v4 % 12; | |
352 | 3354 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
0 | 3355 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) |
3356 { | |
3357 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
3358 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
3359 | |
3360 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
3361 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
3362 | |
3363 ++pParty->field_764; | |
3364 if ( pParty->field_764 > 1u ) | |
3365 { | |
3366 for (uint i = 0; i < 4; ++i) | |
3367 pParty->pPlayers[i].SetCondition(1, 0); | |
3368 | |
3369 if ( pParty->uNumFoodRations ) | |
3370 { | |
3371 Party::TakeFood(1u); | |
3372 } | |
3373 else | |
3374 { | |
3375 for (uint i = 0; i < 4; ++i) | |
3376 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; | |
3377 } | |
3378 if ( pParty->field_764 > 3u ) | |
3379 { | |
3380 pPlayer = pParty->pPlayers; | |
3381 do | |
3382 { | |
3383 pPlayer->Zero(); | |
3384 if ( !(pPlayer->pConditions[15] | pPlayer->pConditions[16] | pPlayer->pConditions[14]) ) | |
3385 { | |
3386 if ( rand() % 100 < 5 * (unsigned __int8)pParty->field_764 ) | |
3387 { | |
3388 v57 = 0; | |
3389 v55 = 14; | |
3390 LABEL_21: | |
3391 pPlayer->SetCondition(v55, v57); | |
3392 goto LABEL_22; | |
3393 } | |
3394 if ( rand() % 100 < 10 * (unsigned __int8)pParty->field_764 ) | |
3395 { | |
3396 v57 = 0; | |
3397 v55 = 5; | |
3398 goto LABEL_21; | |
3399 } | |
3400 } | |
3401 LABEL_22: | |
3402 ++pPlayer; | |
3403 } | |
3404 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); | |
3405 } | |
3406 } | |
3407 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
3408 pOutdoor->SetFog(); | |
3409 | |
3410 for (uint i = 0; i < 4; ++i) | |
3411 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
3412 } | |
3413 v11 = LODWORD(pParty->uTimePlayed); | |
3414 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
3415 { | |
3416 v12 = 1; | |
3417 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
3418 viewparams->bRedrawGameUI = 1; | |
3419 while ( 1 ) | |
3420 { | |
3421 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 3422 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
3423 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 3424 { |
3425 v58 = 0; | |
3426 } | |
3427 else | |
3428 { | |
3429 v58 = 0; | |
3430 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
3431 { | |
3432 v14 = pPlayers[v12]; | |
3433 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
3434 v14->ReceiveDamage((signed __int64)v15, 0); | |
3435 if ( pParty->uFlags & 4 ) | |
3436 { | |
3437 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[660]); | |
3438 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
3439 } | |
3440 goto LABEL_39; | |
3441 } | |
3442 v13 = pPlayers[v12]; | |
3443 } | |
130 | 3444 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 3445 LABEL_39: |
3446 ++v12; | |
3447 if ( v12 > 4 ) | |
3448 { | |
3449 v11 = LODWORD(pParty->uTimePlayed); | |
3450 break; | |
3451 } | |
3452 } | |
3453 } | |
3454 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
3455 { | |
3456 viewparams->bRedrawGameUI = 1; | |
3457 pParty->field_6FC = v11 + 128; | |
3458 v16 = &pPlayers[1]; | |
3459 do | |
3460 { | |
3461 v17 = *v16; | |
3462 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
3463 v17->ReceiveDamage((signed __int64)v18, 0); | |
3464 if ( pParty->uFlags & 0x200 ) | |
3465 { | |
3466 strcpy(GameUI_StatusBar_TimedString, pGlobalTXT_LocalizationStrings[661]); | |
3467 GameUI_StatusBar_TimedStringTimeLeft = 128; | |
3468 } | |
3469 ++v16; | |
3470 } | |
3471 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
3472 } | |
3473 _493938_regenerate(); | |
3474 v65 = 4; | |
3475 a2a = v60; | |
3476 if ( pParty->uFlags2 & 2 ) | |
3477 { | |
3478 v19 = (double)(signed int)v60 * 0.5; | |
3479 v20 = v19 + 6.7553994e15; | |
3480 a2a = LODWORD(v20); | |
3481 if ( SLODWORD(v20) <= 0 ) | |
3482 a2a = 1; | |
3483 } | |
3484 v62 = &pPlayers[1]; | |
3485 do | |
3486 { | |
3487 v21 = *v62; | |
3488 if ( (*v62)->uTimeToRecovery ) | |
3489 v21->Recover(a2a); | |
3490 v22 = v21->sHealth; | |
3491 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
3492 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
3493 { | |
3494 if ( v22 >= 1 ) | |
3495 goto LABEL_59; | |
3496 v59 = 0; | |
3497 v56 = 13; | |
3498 } | |
3499 else | |
3500 { | |
3501 v59 = 0; | |
3502 v56 = 14; | |
3503 } | |
3504 v21->SetCondition(v56, v59); | |
3505 LABEL_59: | |
3506 v23 = (int)&v21->field_E0; | |
3507 if ( v21->field_E0 ) | |
3508 { | |
3509 v24 = *(int *)v23 - v60; | |
3510 if ( v24 > 0 ) | |
3511 { | |
3512 *(int *)v23 = v24; | |
3513 } | |
3514 else | |
3515 { | |
3516 *(int *)v23 = 0; | |
3517 viewparams->bRedrawGameUI = 1; | |
3518 } | |
3519 } | |
3520 v25 = (int)&v21->field_E4; | |
3521 if ( v21->field_E4 ) | |
3522 { | |
3523 v26 = *(int *)v25 - v60; | |
3524 if ( v26 > 0 ) | |
3525 { | |
3526 *(int *)v25 = v26; | |
3527 } | |
3528 else | |
3529 { | |
3530 *(int *)v25 = 0; | |
3531 viewparams->bRedrawGameUI = 1; | |
3532 } | |
3533 } | |
3534 v27 = (int)&v21->field_E8; | |
3535 if ( v21->field_E8 ) | |
3536 { | |
3537 v28 = *(int *)v27 - v60; | |
3538 if ( v28 > 0 ) | |
3539 { | |
3540 *(int *)v27 = v28; | |
3541 } | |
3542 else | |
3543 { | |
3544 *(int *)v27 = 0; | |
3545 viewparams->bRedrawGameUI = 1; | |
3546 } | |
3547 } | |
3548 v29 = (int)&v21->field_EC; | |
3549 if ( v21->field_EC ) | |
3550 { | |
3551 v30 = *(int *)v29 - v60; | |
3552 if ( v30 > 0 ) | |
3553 { | |
3554 *(int *)v29 = v30; | |
3555 } | |
3556 else | |
3557 { | |
3558 *(int *)v29 = 0; | |
3559 viewparams->bRedrawGameUI = 1; | |
3560 } | |
3561 } | |
3562 v31 = (int)&v21->field_F0; | |
3563 if ( v21->field_F0 ) | |
3564 { | |
3565 v32 = *(int *)v31 - v60; | |
3566 if ( v32 > 0 ) | |
3567 { | |
3568 *(int *)v31 = v32; | |
3569 } | |
3570 else | |
3571 { | |
3572 *(int *)v31 = 0; | |
3573 viewparams->bRedrawGameUI = 1; | |
3574 } | |
3575 } | |
3576 v33 = (int)&v21->field_F4; | |
3577 if ( v21->field_F4 ) | |
3578 { | |
3579 v34 = *(int *)v33 - v60; | |
3580 if ( v34 > 0 ) | |
3581 { | |
3582 *(int *)v33 = v34; | |
3583 } | |
3584 else | |
3585 { | |
3586 *(int *)v33 = 0; | |
3587 viewparams->bRedrawGameUI = 1; | |
3588 } | |
3589 } | |
3590 v35 = (int)&v21->field_F8; | |
3591 if ( v21->field_F8 ) | |
3592 { | |
3593 v36 = *(int *)v35 - v60; | |
3594 if ( v36 > 0 ) | |
3595 { | |
3596 *(int *)v35 = v36; | |
3597 } | |
3598 else | |
3599 { | |
3600 *(int *)v35 = 0; | |
3601 viewparams->bRedrawGameUI = 1; | |
3602 } | |
3603 } | |
3604 v37 = (int)&v21->field_FC; | |
3605 if ( v21->field_FC ) | |
3606 { | |
3607 v38 = *(int *)v37 - v60; | |
3608 if ( v38 > 0 ) | |
3609 { | |
3610 *(int *)v37 = v38; | |
3611 } | |
3612 else | |
3613 { | |
3614 *(int *)v37 = 0; | |
3615 viewparams->bRedrawGameUI = 1; | |
3616 } | |
3617 } | |
3618 v39 = (int)&v21->field_100; | |
3619 if ( v21->field_100 ) | |
3620 { | |
3621 v40 = *(int *)v39 - v60; | |
3622 if ( v40 > 0 ) | |
3623 { | |
3624 *(int *)v39 = v40; | |
3625 } | |
3626 else | |
3627 { | |
3628 *(int *)v39 = 0; | |
3629 viewparams->bRedrawGameUI = 1; | |
3630 } | |
3631 } | |
3632 v41 = (int)&v21->field_104; | |
3633 if ( v21->field_104 ) | |
3634 { | |
3635 v42 = *(int *)v41 - v60; | |
3636 if ( v42 > 0 ) | |
3637 { | |
3638 *(int *)v41 = v42; | |
3639 } | |
3640 else | |
3641 { | |
3642 *(int *)v41 = 0; | |
3643 viewparams->bRedrawGameUI = 1; | |
3644 } | |
3645 } | |
3646 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
3647 --v65; | |
3648 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
3649 | |
3650 for (uint k = 0; k < 24; ++k) | |
3651 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
3652 | |
3653 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
3654 v21->SetCondition(1u, 0); | |
3655 ++v62; | |
3656 } | |
3657 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
3658 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
3659 | |
3660 for (uint i = 0; i < 20; ++i) | |
3661 { | |
3662 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
3663 viewparams->bRedrawGameUI = 1; | |
3664 } | |
3665 | |
3666 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
3667 { | |
3668 for (uint i = 0; i < 4; ++i) | |
3669 pParty->pPlayers[i].SetCondition(1, 0); | |
3670 } | |
3671 | |
3672 for (uint i = 0; i < 2; ++i) | |
3673 { | |
3674 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
3675 if (pBuf->uExpireTime == 0) | |
3676 continue; | |
3677 | |
3678 if ( !(pBuf->uFlags & 1) ) | |
3679 { | |
3680 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
3681 { | |
3682 pBuf->Reset(); | |
3683 if (dword_4EE07C[i] == 7 ) | |
3684 pParty->bFlying = false; | |
3685 } | |
3686 } | |
3687 } | |
3688 | |
3689 v51 = v65; | |
3690 if ( v65 ) | |
3691 goto LABEL_135; | |
151 | 3692 if ( pCurrentScreen != SCREEN_REST ) |
0 | 3693 { |
3694 v52 = (signed int)&pPlayers[1]; | |
3695 while ( 1 ) | |
3696 { | |
3697 v53 = *(int *)v52; | |
3698 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
3699 break; | |
3700 v52 += 4; | |
3701 if ( v52 > (signed int)&pPlayers[4] ) | |
3702 goto LABEL_135; | |
3703 } | |
3704 *(int *)(v53 + 16) = 0; | |
3705 *(int *)(v53 + 20) = 0; | |
3706 v51 = 1; | |
3707 LABEL_135: | |
151 | 3708 if ( pCurrentScreen != SCREEN_REST |
0 | 3709 && (!v51 || dword_5C35C0) ) |
3710 uGameState = 8; | |
3711 } | |
3712 if ( uActiveCharacter ) | |
3713 { | |
151 | 3714 if ( pCurrentScreen != SCREEN_REST ) |
0 | 3715 { |
3716 v54 = pPlayers[uActiveCharacter]; | |
3717 if ( v54->pConditions[2] | |
3718 || v54->pConditions[12] | |
3719 || v54->pConditions[13] | |
3720 || v54->pConditions[14] | |
3721 || v54->pConditions[15] | |
3722 || v54->pConditions[16] ) | |
3723 { | |
3724 viewparams->bRedrawGameUI = 1; | |
3725 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
3726 } | |
3727 } | |
3728 } | |
3729 } | |
3730 | |
3731 //----- (00494820) -------------------------------------------------------- | |
3732 unsigned int __fastcall sub_494820(unsigned int a1) | |
3733 { | |
3734 signed int v1; // eax@1 | |
3735 | |
3736 v1 = 5; | |
3737 if ( a1 % 0x18 >= 5 ) | |
3738 v1 = 29; | |
3739 return v1 - a1 % 0x18; | |
3740 } | |
3741 | |
3742 //----- (00494836) -------------------------------------------------------- | |
3743 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
3744 { | |
3745 int v3; // esi@1 | |
3746 int result; // eax@1 | |
3747 stru339_spell_sound *v5; // ebx@1 | |
3748 int *v6; // edi@2 | |
3749 unsigned int v7; // eax@3 | |
3750 int v8; // [sp+Ch] [bp-8h]@3 | |
3751 int v9; // [sp+10h] [bp-4h]@2 | |
3752 int a2a; // [sp+1Ch] [bp+8h]@1 | |
3753 | |
3754 v3 = 0; | |
3755 result = word_4EE088_sound_ids[uSoundID]; | |
3756 v5 = this; | |
3757 a2a = word_4EE088_sound_ids[uSoundID]; | |
3758 if ( result ) | |
3759 { | |
3760 v9 = 0; | |
3761 v6 = this->pSoundsOffsets; | |
3762 do | |
3763 { | |
3764 v7 = a2a++; | |
3765 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
3766 if ( !result ) | |
3767 break; | |
3768 a6 += 4; | |
3769 result = v8 + 256; | |
3770 *v6 = v3; | |
3771 v3 += result; | |
3772 ++v9; | |
3773 *(v6 - 2) = result; | |
3774 ++v6; | |
3775 } | |
3776 while ( v9 < 2 ); | |
3777 } | |
3778 return result; | |
3779 } | |
3780 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
3781 | |
3782 | |
3783 | |
3784 //----- (00494AED) -------------------------------------------------------- | |
130 | 3785 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 3786 { |
3787 unsigned int _uNumFrames; // edx@1 | |
3788 unsigned int result; // eax@1 | |
3789 PlayerFrame *v4; // ecx@2 | |
3790 | |
3791 _uNumFrames = this->uNumFrames; | |
3792 result = 0; | |
3793 if ( (signed int)this->uNumFrames <= 0 ) | |
3794 { | |
3795 LABEL_5: | |
3796 result = 0; | |
3797 } | |
3798 else | |
3799 { | |
3800 v4 = this->pFrames; | |
130 | 3801 while ( v4->expression != expression ) |
0 | 3802 { |
3803 ++result; | |
3804 ++v4; | |
3805 if ( (signed int)result >= (signed int)_uNumFrames ) | |
3806 goto LABEL_5; | |
3807 } | |
3808 } | |
3809 return result; | |
3810 } | |
3811 | |
3812 //----- (00494B10) -------------------------------------------------------- | |
3813 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
3814 { | |
3815 unsigned int v3; // esi@1 | |
3816 PlayerFrame *v4; // edi@1 | |
3817 PlayerFrame *v5; // ecx@1 | |
3818 __int16 v6; // dx@2 | |
3819 int v7; // edx@3 | |
3820 char *i; // eax@3 | |
3821 int v9; // ecx@5 | |
3822 PlayerFrame *result; // eax@6 | |
3823 | |
3824 v3 = uFramesetID; | |
3825 v4 = this->pFrames; | |
3826 v5 = &v4[uFramesetID]; | |
3827 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
3828 { | |
3829 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
3830 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
3831 { | |
3832 v9 = *(short *)i; | |
3833 if ( v7 <= v9 ) | |
3834 break; | |
3835 v7 -= v9; | |
3836 ++v3; | |
3837 } | |
3838 result = &v4[v3]; | |
3839 } | |
3840 else | |
3841 { | |
3842 result = &v4[uFramesetID]; | |
3843 } | |
3844 return result; | |
3845 } | |
3846 | |
3847 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3848 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 3849 { |
3850 PlayerFrameTable *v4; // edi@1 | |
3851 int v5; // esi@1 | |
3852 int v6; // eax@2 | |
3853 | |
3854 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3855 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3856 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
|
3857 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3858 *pAnimTime = v5; |
0 | 3859 } |
3860 else | |
3861 { | |
3862 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3863 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3864 *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
|
3865 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
3866 return &v4->pFrames[*pFramesetID]; |
0 | 3867 } |
3868 | |
3869 //----- (00494BC3) -------------------------------------------------------- | |
3870 void PlayerFrameTable::ToFile() | |
3871 { | |
3872 PlayerFrameTable *v1; // esi@1 | |
3873 FILE *v2; // eax@1 | |
3874 FILE *v3; // edi@1 | |
3875 | |
3876 auto Str = this; | |
3877 | |
3878 v1 = Str; | |
3879 v2 = fopen("data\\dpft.bin", "wb"); | |
3880 v3 = v2; | |
3881 if ( !v2 ) | |
3882 Abortf("Unable to save dpft.bin!"); | |
3883 fwrite(v1, 4u, 1u, v2); | |
3884 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
3885 fclose(v3); | |
3886 } | |
3887 | |
3888 //----- (00494C0F) -------------------------------------------------------- | |
3889 void PlayerFrameTable::FromFile(void *pSerialized) | |
3890 { | |
3891 uNumFrames = *(int *)pSerialized; | |
3892 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
3893 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
3894 } | |
3895 | |
3896 //----- (00494C5A) -------------------------------------------------------- | |
3897 int PlayerFrameTable::FromFileTxt(const char *Args) | |
3898 { | |
3899 PlayerFrameTable *v2; // ebx@1 | |
3900 FILE *v3; // eax@1 | |
3901 int v4; // esi@3 | |
3902 void *v5; // eax@10 | |
3903 FILE *v6; // ST0C_4@12 | |
3904 char *i; // eax@12 | |
3905 __int16 v8; // ax@15 | |
3906 const char *v9; // ST10_4@15 | |
3907 unsigned __int16 v10; // ax@15 | |
3908 const char *v11; // ST0C_4@15 | |
3909 int j; // esi@15 | |
3910 int v13; // eax@17 | |
3911 int v14; // edx@22 | |
3912 int v15; // ecx@23 | |
3913 int v16; // eax@24 | |
3914 signed int k; // eax@27 | |
3915 PlayerFrame *v18; // edx@28 | |
3916 int v19; // esi@28 | |
3917 int l; // ecx@29 | |
3918 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3919 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3920 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3921 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3922 int v26; // [sp+2FCh] [bp-8h]@3 | |
3923 FILE *File; // [sp+300h] [bp-4h]@1 | |
3924 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3925 | |
3926 v2 = this; | |
3927 //TileTable::dtor((TileTable *)this); | |
3928 v3 = fopen(Args, "r"); | |
3929 File = v3; | |
3930 if ( !v3 ) | |
3931 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3932 v4 = 0; | |
3933 v25 = 0; | |
3934 v26 = 1; | |
3935 if ( fgets(&Buf, 490, v3) ) | |
3936 { | |
3937 do | |
3938 { | |
3939 *strchr(&Buf, 10) = 0; | |
703 | 3940 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3941 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3942 { | |
3943 if ( v24.uPropCount < 3 ) | |
0 | 3944 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3945 ++v25; | |
3946 } | |
3947 ++v26; | |
3948 } | |
3949 while ( fgets(&Buf, 490, File) ); | |
3950 v4 = v25; | |
3951 } | |
3952 v2->uNumFrames = v4; | |
3953 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3954 v2->pFrames = (PlayerFrame *)v5; | |
3955 if ( !v5 ) | |
3956 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3957 v6 = File; | |
3958 v2->uNumFrames = 0; | |
3959 fseek(v6, 0, 0); | |
3960 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3961 { | |
3962 *strchr(&Buf, 10) = 0; | |
703 | 3963 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3964 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3965 { |
3966 v8 = atoi(v24.pProperties[0]); | |
3967 v9 = v24.pProperties[1]; | |
130 | 3968 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3969 v10 = atoi(v9); |
3970 v11 = v24.pProperties[2]; | |
3971 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3972 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3973 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3974 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3975 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3976 { |
3977 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3978 { | |
3979 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3980 *(char *)v13 |= 4u; | |
3981 } | |
3982 } | |
3983 ++v2->uNumFrames; | |
3984 } | |
3985 } | |
3986 fclose(File); | |
3987 v14 = 0; | |
3988 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3989 { | |
3990 v15 = 0; | |
3991 do | |
3992 { | |
3993 v16 = (int)&v2->pFrames[v15]; | |
3994 if ( !(*(char *)(v16 + 18) & 4) ) | |
3995 *(char *)(v16 + 8) |= 1u; | |
3996 ++v14; | |
3997 ++v15; | |
3998 } | |
3999 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
4000 } | |
4001 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
4002 { | |
4003 v18 = v2->pFrames; | |
4004 Argsa = (int)&v18[k]; | |
4005 v19 = *(short *)(Argsa + 4); | |
4006 if ( *(char *)(Argsa + 8) & 1 ) | |
4007 { | |
4008 ++k; | |
4009 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
4010 { | |
4011 v19 += *(short *)(l + 4); | |
4012 ++k; | |
4013 } | |
4014 LOWORD(v19) = v18[k].uAnimTime + v19; | |
4015 } | |
4016 ++k; | |
4017 } | |
4018 return 1; | |
4019 } | |
4020 | |
4021 //----- (00494F3A) -------------------------------------------------------- | |
4022 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
4023 { | |
4024 IconFrameTable *v2; // esi@1 | |
4025 int v3; // ebx@1 | |
4026 unsigned int uID; // edi@1 | |
4027 unsigned int result; // eax@4 | |
4028 | |
4029 v2 = this; | |
4030 v3 = 0; | |
4031 uID = 0; | |
4032 if ( (signed int)this->uNumIcons <= 0 ) | |
4033 { | |
4034 LABEL_4: | |
4035 result = 0; | |
4036 } | |
4037 else | |
4038 { | |
4039 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
4040 { | |
4041 ++uID; | |
4042 ++v3; | |
4043 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
4044 goto LABEL_4; | |
4045 } | |
4046 result = uID; | |
4047 } | |
4048 return result; | |
4049 } | |
4050 | |
4051 //----- (00494F70) -------------------------------------------------------- | |
4052 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
4053 { | |
4054 IconFrame *v3; // edi@1 | |
4055 IconFrame *v4; // ecx@1 | |
4056 __int16 v5; // dx@2 | |
4057 int v6; // edx@3 | |
4058 unsigned int v7; // eax@3 | |
4059 char *i; // ecx@3 | |
4060 int v9; // esi@5 | |
4061 IconFrame *result; // eax@6 | |
4062 | |
4063 v3 = this->pIcons; | |
4064 v4 = &v3[uIconID]; | |
4065 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
4066 { | |
4067 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
4068 v7 = uIconID; | |
4069 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
4070 { | |
4071 v9 = *(short *)i; | |
4072 if ( v6 <= v9 ) | |
4073 break; | |
4074 v6 -= v9; | |
4075 ++v7; | |
4076 } | |
4077 result = &v3[v7]; | |
4078 } | |
4079 else | |
4080 { | |
4081 result = &v3[uIconID]; | |
4082 } | |
4083 return result; | |
4084 } | |
4085 | |
4086 //----- (00494FBF) -------------------------------------------------------- | |
4087 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
4088 { | |
4089 IconFrameTable *v2; // esi@1 | |
4090 unsigned int v3; // edi@3 | |
4091 const char *i; // eax@3 | |
4092 IconFrame *v5; // eax@5 | |
4093 | |
4094 v2 = this; | |
4095 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
4096 { | |
4097 v3 = uIconID; | |
4098 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
4099 { | |
4100 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
4101 v5 = v2->pIcons; | |
4102 if ( !(v5[v3].uFlags & 1) ) | |
4103 break; | |
4104 ++v3; | |
4105 } | |
4106 } | |
4107 } | |
4108 | |
4109 //----- (0049500A) -------------------------------------------------------- | |
4110 void IconFrameTable::ToFile() | |
4111 { | |
4112 IconFrameTable *v1; // esi@1 | |
4113 FILE *v2; // eax@1 | |
4114 FILE *v3; // edi@1 | |
4115 | |
4116 auto Str = this; | |
4117 | |
4118 v1 = Str; | |
4119 v2 = fopen("data\\dift.bin", "wb"); | |
4120 v3 = v2; | |
4121 if ( !v2 ) | |
4122 Abortf("Unable to save dift.bin!"); | |
4123 fwrite(v1, 4u, 1u, v2); | |
4124 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
4125 fclose(v3); | |
4126 } | |
4127 | |
4128 //----- (00495056) -------------------------------------------------------- | |
4129 void IconFrameTable::FromFile(void *pSerialized) | |
4130 { | |
4131 uNumIcons = *(int *)pSerialized; | |
4132 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
4133 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
4134 } | |
4135 | |
4136 //----- (0049509D) -------------------------------------------------------- | |
4137 int IconFrameTable::FromFileTxt(const char *Args) | |
4138 { | |
4139 IconFrameTable *v2; // ebx@1 | |
4140 FILE *v3; // eax@1 | |
4141 int v4; // esi@3 | |
4142 void *v5; // eax@10 | |
4143 FILE *v6; // ST0C_4@12 | |
4144 char *i; // eax@12 | |
4145 const char *v8; // ST00_4@15 | |
4146 int v9; // eax@16 | |
4147 int v10; // edx@20 | |
4148 int v11; // ecx@21 | |
4149 int v12; // eax@22 | |
4150 signed int j; // edx@25 | |
4151 IconFrame *v14; // ecx@26 | |
4152 int v15; // esi@26 | |
4153 int k; // eax@27 | |
4154 signed int result; // eax@11 | |
4155 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
4156 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
4157 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
4158 int v21; // [sp+2F8h] [bp-Ch]@3 | |
4159 int v22; // [sp+2FCh] [bp-8h]@3 | |
4160 FILE *File; // [sp+300h] [bp-4h]@1 | |
4161 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
4162 | |
4163 v2 = this; | |
4164 //TileTable::dtor((TileTable *)this); | |
4165 v3 = fopen(Args, "r"); | |
4166 File = v3; | |
4167 if ( !v3 ) | |
4168 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
4169 v4 = 0; | |
4170 v21 = 0; | |
4171 v22 = 1; | |
4172 if ( fgets(&Buf, 490, v3) ) | |
4173 { | |
4174 do | |
4175 { | |
4176 *strchr(&Buf, 10) = 0; | |
4177 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 4178 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
4179 { | |
4180 if ( v20.uPropCount < 3 ) | |
0 | 4181 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
4182 ++v21; | |
4183 } | |
4184 ++v22; | |
4185 } | |
4186 while ( fgets(&Buf, 490, File) ); | |
4187 v4 = v21; | |
4188 } | |
4189 v2->uNumIcons = v4; | |
4190 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
4191 v2->pIcons = (IconFrame *)v5; | |
4192 if ( v5 ) | |
4193 { | |
4194 v6 = File; | |
4195 v2->uNumIcons = 0; | |
4196 fseek(v6, 0, 0); | |
4197 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
4198 { | |
4199 *strchr(&Buf, 10) = 0; | |
4200 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 4201 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 4202 { |
4203 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
4204 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
4205 v8 = v20.pProperties[2]; | |
4206 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
4207 if ( !_strcmpi(v8, "new") ) | |
4208 { | |
4209 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
4210 *(char *)v9 |= 4u; | |
4211 } | |
4212 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
4213 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
4214 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
4215 } | |
4216 } | |
4217 fclose(File); | |
4218 v10 = 0; | |
4219 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
4220 { | |
4221 v11 = 0; | |
4222 do | |
4223 { | |
4224 v12 = (int)&v2->pIcons[v11]; | |
4225 if ( !(*(char *)(v12 + 60) & 4) ) | |
4226 *(char *)(v12 + 28) |= 1u; | |
4227 ++v10; | |
4228 ++v11; | |
4229 } | |
4230 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
4231 } | |
4232 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
4233 { | |
4234 v14 = v2->pIcons; | |
4235 Argsa = (int)&v14[j]; | |
4236 v15 = *(short *)(Argsa + 24); | |
4237 if ( *(char *)(Argsa + 28) & 1 ) | |
4238 { | |
4239 ++j; | |
4240 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
4241 { | |
4242 v15 += *(short *)(k + 24); | |
4243 ++j; | |
4244 } | |
4245 LOWORD(v15) = v14[j].uAnimTime + v15; | |
4246 } | |
4247 ++j; | |
4248 } | |
4249 result = 1; | |
4250 } | |
4251 else | |
4252 { | |
4253 fclose(File); | |
4254 result = 0; | |
4255 } | |
4256 return result; | |
4257 } | |
4258 | |
4259 | |
4260 | |
4261 //----- (00495366) -------------------------------------------------------- | |
4262 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
4263 { | |
4264 int v2; // edi@1 | |
4265 int v3; // edx@2 | |
4266 int v4; // esi@3 | |
4267 int v5; // ebx@5 | |
4268 signed int v7; // [sp+Ch] [bp-14h]@1 | |
4269 signed int v8; // [sp+10h] [bp-10h]@1 | |
4270 int **v9; // [sp+14h] [bp-Ch]@4 | |
4271 signed int v10; // [sp+18h] [bp-8h]@3 | |
4272 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
4273 | |
4274 v2 = a1; | |
4275 v11 = a2; | |
4276 v8 = 0; | |
4277 v7 = 0; | |
4278 if ( dword_AE336C == a1 ) | |
4279 { | |
4280 v3 = dword_AE3370; | |
4281 } | |
4282 else | |
4283 { | |
4284 v4 = a2; | |
4285 dword_AE336C = a1; | |
4286 v10 = 0; | |
4287 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
4288 goto LABEL_17; | |
4289 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
4290 do | |
4291 { | |
4292 v5 = tolower(*(char *)*v9); | |
4293 if ( v5 == tolower(v2) ) | |
4294 { | |
4295 if ( v8 ) | |
4296 v7 = v10; | |
4297 else | |
4298 v8 = v10; | |
4299 } | |
4300 ++v10; | |
4301 v9 += 2; | |
4302 } | |
4303 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
4304 if ( v8 && v8 != v7 ) | |
4305 v3 = v8 + rand() % (v7 - v8); | |
4306 else | |
4307 LABEL_17: | |
4308 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
4309 } | |
4310 dword_AE3370 = v3; | |
4311 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
4312 } | |
4313 // AE336C: using guessed type int dword_AE336C; | |
4314 // AE3370: using guessed type int dword_AE3370; | |
4315 | |
4316 //----- (00495430) -------------------------------------------------------- | |
607 | 4317 char * GetReputationString( signed int a1 ) |
4318 { | |
566 | 4319 if (a1 >= 25) |
4320 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
4321 else if (a1 >= 6) | |
4322 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
4323 else if (a1 >= -5) | |
4324 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
4325 else if (a1 >= -24) | |
4326 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 4327 else |
566 | 4328 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 4329 } |
4330 | |
4331 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4332 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 4333 { |
4334 unsigned __int8 v6; // bl@1 | |
4335 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4336 //NPCData *v9; // eax@4 |
250 | 4337 //size_t v10; // eax@6 |
0 | 4338 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4339 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4340 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4341 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4342 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4343 //int v16; // edx@10 |
0 | 4344 int v17; // eax@10 |
4345 signed __int64 v18; // qax@18 | |
4346 unsigned int v19; // edi@32 | |
4347 unsigned __int8 *v20; // ebx@32 | |
4348 int v21; // ecx@34 | |
4349 __int16 v22; // ax@34 | |
4350 int v23; // edx@39 | |
4351 int v24; // eax@39 | |
4352 int v25; // eax@45 | |
4353 float *v26; // esi@68 | |
4354 float v27; // ST18_4@68 | |
4355 signed int v28; // eax@68 | |
4356 int v29; // eax@68 | |
4357 float v30; // ST18_4@72 | |
4358 signed int v31; // eax@72 | |
4359 float v32; // ST18_4@74 | |
4360 signed int v33; // eax@74 | |
4361 double v34; // st7@75 | |
4362 float v35; // ST18_4@76 | |
4363 signed int v36; // eax@76 | |
4364 float *v37; // esi@78 | |
4365 float v38; // ST18_4@78 | |
4366 int v39; // eax@78 | |
4367 float v40; // ST18_4@82 | |
4368 int v41; // eax@82 | |
4369 float v42; // ST18_4@83 | |
4370 int v43; // eax@83 | |
4371 float v44; // ST18_4@85 | |
4372 int v45; // eax@85 | |
4373 const char *v46; // eax@86 | |
4374 unsigned int v47; // eax@87 | |
4375 float v48; // ST18_4@97 | |
4376 __int64 v49; // ST14_8@107 | |
4377 int v50; // eax@107 | |
4378 int v51; // eax@108 | |
4379 Player *v52; // eax@109 | |
4380 int v53; // [sp-4h] [bp-13Ch]@107 | |
4381 int v54; // [sp+0h] [bp-138h]@107 | |
4382 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 4383 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
4384 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 4385 char a1[100]; // [sp+B8h] [bp-80h]@3 |
4386 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4387 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 4388 //Player *v61; // [sp+124h] [bp-14h]@3 |
4389 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 4390 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4391 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4392 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4393 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4394 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4395 |
0 | 4396 |
4397 v6 = uPlayerID; | |
249 | 4398 //Str = lpsz; |
0 | 4399 if ( IsBadStringPtrA(lpsz, 1u) ) |
4400 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4401 |
0 | 4402 a1[0] = 0; |
4403 pPlayer = &pParty->pPlayers[v6]; | |
248 | 4404 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 4405 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4406 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4407 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4408 NPCData *npc = nullptr; |
0 | 4409 if ( dword_5C35D4 ) |
248 | 4410 { |
463 | 4411 //__debugbreak(); // fix |
459 | 4412 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
|
4413 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4414 else |
602 | 4415 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4416 //v65 = v9; |
250 | 4417 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4418 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4419 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4420 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4421 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4422 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4423 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4424 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4425 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4426 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4427 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4428 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4429 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4430 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4431 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4432 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4433 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4434 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4435 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4436 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4437 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4438 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4439 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4440 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
|
4441 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4442 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4443 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4444 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4445 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4446 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4447 case 2: |
0 | 4448 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4449 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4450 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4451 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4452 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4453 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4454 case 5: |
0 | 4455 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
4456 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
4457 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
4458 { | |
4459 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
4460 { | |
4461 if ( v18 < 20 ) | |
4462 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
4463 } | |
4464 else | |
4465 { | |
4466 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
4467 } | |
4468 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4469 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4470 case 6: |
0 | 4471 if ( pPlayer->uSex ) |
4472 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
4473 else | |
4474 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4475 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4476 case 7: |
0 | 4477 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4478 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4479 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4480 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4481 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4482 case 8: |
0 | 4483 v19 = 0; |
4484 v63 = 0; | |
484 | 4485 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 4486 do |
4487 { | |
4488 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
4489 { | |
4490 v21 = v63; | |
4491 v22 = word_4EE150[v19]; | |
4492 ++v63; | |
4493 v55[v21] = v22; | |
4494 } | |
4495 ++v19; | |
4496 } | |
4497 while ( v19 < 28 ); | |
4498 if ( v63 ) | |
4499 { | |
4500 v23 = rand() % v63; | |
4501 v24 = dword_A74CDC; | |
4502 if ( dword_A74CDC == -1 ) | |
4503 { | |
4504 v24 = v23; | |
4505 dword_A74CDC = v23; | |
4506 } | |
492 | 4507 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 4508 } |
4509 else | |
4510 { | |
4511 v11 = (char *)pNPCTopics[55].pText; | |
4512 } | |
249 | 4513 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4514 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4515 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4516 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4517 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4518 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4519 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4520 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4521 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4522 case 10: |
0 | 4523 if ( pPlayer->uSex ) |
4524 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
4525 else | |
4526 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4527 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4528 case 11: |
0 | 4529 v25 = GetPartyReputation(); |
4530 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4531 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4532 v25 = npc->rep; |
0 | 4533 LABEL_46: |
4534 if ( v25 >= 25 ) | |
4535 { | |
4536 v11 = pGlobalTXT_LocalizationStrings[379]; | |
4537 } | |
4538 else | |
4539 { | |
4540 if ( v25 < 6 ) | |
4541 { | |
4542 if ( v25 >= -5 ) | |
4543 { | |
4544 v11 = pGlobalTXT_LocalizationStrings[399]; | |
4545 } | |
4546 else | |
4547 { | |
4548 if ( v25 < -24 ) | |
4549 v11 = pGlobalTXT_LocalizationStrings[434]; | |
4550 else | |
4551 v11 = pGlobalTXT_LocalizationStrings[402]; | |
4552 } | |
4553 } | |
4554 else | |
4555 { | |
4556 v11 = pGlobalTXT_LocalizationStrings[392]; | |
4557 } | |
4558 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4559 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4560 case 13: |
0 | 4561 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4562 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4563 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4564 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4565 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4566 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4567 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4568 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4569 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4570 } |
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 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4573 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4574 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4575 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4576 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4577 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4578 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4579 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4580 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4581 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4582 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4583 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4584 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4585 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4586 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4587 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4588 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4589 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4590 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4591 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4592 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4593 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
|
4594 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4595 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4596 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4597 sprintf(a1, "%lu", pay_percentage); |
250 | 4598 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4599 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4600 } |
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 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4603 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4604 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4605 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4606 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4607 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4608 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4609 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4610 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4611 sprintf(a1, "%lu", v51); |
0 | 4612 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4613 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4614 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4615 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4616 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4617 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4618 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4619 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4620 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4621 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4622 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4623 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4624 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4625 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4626 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4627 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4628 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4629 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4630 } |
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 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4634 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4635 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4636 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4637 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4638 v29 = pPlayer->_4B8233(v39, v38); |
0 | 4639 switch ( a5 ) |
4640 { | |
4641 case 3: | |
4642 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4643 v45 = a3->GetValue(); |
0 | 4644 v29 = pPlayer->_4B8213(v45, v44); |
4645 break; | |
4646 case 4: | |
4647 v29 = pPlayer->_4B824B(*v37); | |
4648 break; | |
4649 case 5: | |
4650 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4651 v43 = a3->GetValue(); |
0 | 4652 v29 = pPlayer->_4B8265(v43, v42); |
4653 break; | |
4654 case 6: | |
4655 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4656 v41 = a3->GetValue(); |
0 | 4657 v29 = pPlayer->_4B8213(v41, v40) / 2; |
4658 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4659 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4660 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4661 } |
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 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4664 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4665 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 4666 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4667 v28 = a3->GetValue(); |
0 | 4668 v29 = pPlayer->_4B8142(v28, v27); |
4669 if ( a5 == 3 ) | |
4670 { | |
4671 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4672 v36 = a3->GetValue(); |
0 | 4673 v29 = pPlayer->_4B8102(v36, v35); |
315 | 4674 if (a3->Broken()) |
0 | 4675 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4676 goto _continue_sprintf; |
0 | 4677 } |
4678 if ( a5 != 4 ) | |
4679 { | |
4680 if ( a5 == 5 ) | |
4681 { | |
4682 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4683 v33 = a3->GetValue(); |
0 | 4684 v29 = pPlayer->_4B81C3(v33, v32); |
4685 } | |
4686 else | |
4687 { | |
4688 if ( a5 == 6 ) | |
4689 { | |
4690 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4691 v31 = a3->GetValue(); |
0 | 4692 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 4693 if (a3->Broken()) |
0 | 4694 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4695 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4696 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4697 goto _continue_sprintf; |
0 | 4698 } |
4699 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4700 _continue_sprintf: |
0 | 4701 sprintf(a1, "%lu", v29); |
250 | 4702 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4703 goto _continue_strcat; |
0 | 4704 } |
4705 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4706 |
0 | 4707 v48 = v34; |
4708 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4709 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4710 } |
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 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4713 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4714 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4715 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4716 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4717 } |
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 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4720 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4721 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4722 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4723 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4724 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4725 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4726 } |
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 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4729 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4730 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4731 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4732 sub_493F79(&v57, *a6); |
351 | 4733 v54 = v57.field_18_expire_year; |
4734 v53 = v57.field_C_expire_day + 1; | |
4735 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4736 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4737 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4738 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4739 } |
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 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4742 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4743 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4744 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4745 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4746 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4747 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4748 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4749 default: |
0 | 4750 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4751 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4752 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4753 goto _continue_strcat; |
484 | 4754 v49 = pParty->field_3C._s_times[v17-51]; |
4755 | |
0 | 4756 sub_493F79(&v56, v49); |
351 | 4757 v54 = v56.field_18_expire_year; |
4758 v53 = v56.field_C_expire_day + 1; | |
4759 v50 = v56.field_14_exprie_month; | |
0 | 4760 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 4761 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4762 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4763 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
4764 } |
0 | 4765 } |
4766 return pTmpBuf2; | |
4767 } | |
4768 | |
706 | 4769 |
4770 | |
0 | 4771 |
4772 //----- (0049B04D) -------------------------------------------------------- | |
734 | 4773 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 4774 { |
734 | 4775 //stru154 *v3; // edi@1 |
4776 //signed int v4; // eax@1 | |
4777 //signed int result; // eax@9 | |
4778 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 4779 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 4780 float v7; |
0 | 4781 |
4782 v.x = 0.0; | |
4783 v.y = 0.0; | |
4784 v.z = 0.0; | |
734 | 4785 GetFacePlane(a2, a3, &v, &v7); |
4786 | |
4787 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
4788 polygonType = POLYGON_VerticalWall; | |
4789 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
4790 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
4791 polygonType = POLYGON_Floor; | |
0 | 4792 else |
734 | 4793 polygonType = POLYGON_InBetweenFloorAndWall; |
4794 | |
4795 face_plane.vNormal.x = v.x; | |
4796 face_plane.vNormal.y = v.y; | |
4797 face_plane.vNormal.z = v.z; | |
4798 face_plane.dist = v7; | |
0 | 4799 } |
4800 | |
4801 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 4802 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 4803 { |
734 | 4804 if (fabsf(pNormal->z) < 1e-6f) |
4805 polygonType = POLYGON_VerticalWall; | |
4806 else if (fabsf(pNormal->x) < 1e-6f && | |
4807 fabsf(pNormal->y) < 1e-6f) | |
4808 polygonType = POLYGON_Floor; | |
0 | 4809 else |
734 | 4810 polygonType = POLYGON_InBetweenFloorAndWall; |
4811 | |
4812 face_plane.vNormal.x = pNormal->x; | |
4813 face_plane.dist = dist; | |
4814 face_plane.vNormal.y = pNormal->y; | |
4815 face_plane.vNormal.z = pNormal->z; | |
0 | 4816 } |
4817 | |
4818 //----- (0049B13D) -------------------------------------------------------- | |
734 | 4819 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 4820 { |
4821 ODMFace *v5; // ebx@1 | |
734 | 4822 //int v6; // eax@1 |
4823 //unsigned __int16 *v7; // ebx@2 | |
4824 //Vec3_int_ *v8; // eax@3 | |
0 | 4825 Vec3_int_ *v9; // ecx@3 |
734 | 4826 //double v10; // st7@3 |
4827 //int v11; // ecx@3 | |
0 | 4828 Vec3_int_ *v12; // ecx@3 |
734 | 4829 //double v13; // st7@3 |
4830 //double v14; // st6@3 | |
4831 //double v15; // st5@3 | |
4832 //int v16; // ecx@3 | |
0 | 4833 Vec3_int_ *v17; // eax@3 |
734 | 4834 //double v18; // st5@3 |
0 | 4835 Vec3_float_ *v19; // eax@3 |
734 | 4836 //int result; // eax@8 |
4837 //float v21; // ecx@10 | |
4838 //double v22; // st7@10 | |
4839 //double v23; // st6@10 | |
0 | 4840 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 4841 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 4842 float v26; // [sp+1Ch] [bp-4Ch]@3 |
4843 float v27; // [sp+20h] [bp-48h]@3 | |
4844 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 4845 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
4846 //float v30; // [sp+30h] [bp-38h]@3 | |
4847 //float v31; // [sp+34h] [bp-34h]@3 | |
4848 //float v32; // [sp+38h] [bp-30h]@3 | |
4849 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 4850 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 4851 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
4852 //float v36; // [sp+50h] [bp-18h]@3 | |
4853 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 4854 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 4855 //int v39; // [sp+64h] [bp-4h]@1 |
4856 | |
4857 //v39 = 0; | |
0 | 4858 v1.x = 0.0; |
4859 v5 = pFace; | |
734 | 4860 //v6 = pFace->uNumVertices; |
0 | 4861 v1.y = 0.0; |
4862 v1.z = 0.0; | |
734 | 4863 |
4864 if (pFace->uNumVertices >= 2) | |
4865 { | |
4866 int i = 0; | |
4867 while ( i < pFace->uNumVertices - 2 ) | |
4868 { | |
4869 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
4870 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
4871 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
4872 | |
4873 v1.x = v12->x - v9->x; | |
4874 v26 = v17->x - v12->x; | |
4875 v1.y = v12->y - v9->y; | |
4876 v27 = v17->y - v12->y; | |
4877 v1.z = v12->z - v9->z; | |
4878 v28 = v17->z - v12->z; | |
0 | 4879 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
4880 v38.x = v19->x; | |
4881 v38.y = v19->y; | |
4882 v38.z = v19->z; | |
734 | 4883 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
4884 { | |
4885 v38.Normalize(); | |
4886 | |
4887 pOutNormal->x = v38.x; | |
4888 pOutNormal->y = v38.y; | |
4889 pOutNormal->z = v38.z; | |
4890 | |
4891 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
4892 return; | |
4893 } | |
4894 } | |
4895 } | |
4896 | |
4897 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
4898 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
4899 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
4900 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 4901 } |
4902 | |
4903 | |
4904 | |
4905 | |
4906 | |
4907 //----- (0049D700) -------------------------------------------------------- | |
4908 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
4909 { | |
4910 unsigned int v1; // eax@1 | |
4911 int v2; // ecx@1 | |
4912 unsigned int v3; // eax@1 | |
4913 | |
4914 v1 = uDim; | |
4915 v2 = 0; | |
4916 v3 = v1 - 1; | |
4917 while ( v3 & 1 ) | |
4918 { | |
4919 v3 >>= 1; | |
4920 ++v2; | |
4921 } | |
4922 return v3 == 0 ? v2 : 0; | |
4923 } | |
4924 | |
4925 | |
4926 | |
4927 | |
4928 | |
4929 | |
4930 | |
4931 | |
4932 | |
4933 | |
4934 //----- (004A19D8) -------------------------------------------------------- | |
4935 int __fastcall sub_4A19D8(unsigned int a1, unsigned int a2) | |
4936 { | |
4937 signed __int64 v2; // ST10_8@1 | |
4938 double v3; // st7@1 | |
4939 float v4; // ST24_4@1 | |
4940 double v5; // ST10_8@1 | |
4941 int v6; // ST1C_4@1 | |
4942 float v7; // ST24_4@1 | |
4943 double v8; // ST10_8@1 | |
4944 unsigned __int8 v9; // ST20_1@1 | |
4945 float v10; // ST24_4@1 | |
4946 double v11; // ST10_8@1 | |
4947 float v12; // ST24_4@1 | |
4948 double v13; // ST08_8@1 | |
4949 | |
4950 v2 = a1 >> 24; | |
4951 v3 = (double)v2 * 0.0039215689; | |
4952 LODWORD(v2) = a2 >> 24; | |
4953 v4 = v3 * (double)v2 * 0.0039215689 * 255.0; | |
4954 v5 = v4 + 6.7553994e15; | |
4955 v6 = LODWORD(v5); | |
4956 v7 = (double)((a1 >> 16) & 0xFFi64) * 0.0039215689 * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; | |
4957 v8 = v7 + 6.7553994e15; | |
4958 v9 = LOBYTE(v8); | |
4959 v10 = (double)((unsigned __int16)a1 >> 8) * 0.0039215689 * (double)((unsigned __int16)a2 >> 8) * 0.0039215689 * 255.0; | |
4960 v11 = v10 + 6.7553994e15; | |
4961 v12 = (double)(a1 & 0xFFi64) * 0.0039215689 * (double)(unsigned __int8)a2 * 0.0039215689 * 255.0; | |
4962 v13 = v12 + 6.7553994e15; | |
4963 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8); | |
4964 } | |
4965 | |
4966 | |
4967 | |
4968 //----- (004A46E6) -------------------------------------------------------- | |
4969 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4970 { | |
4971 int v5; // eax@1 | |
4972 int z; // eax@1 | |
4973 unsigned int v7; // eax@9 | |
4974 unsigned int v8; // ecx@9 | |
4975 int v9; // eax@9 | |
4976 unsigned int v10; // eax@10 | |
4977 int *v11; // esi@10 | |
4978 int *v12; // edi@10 | |
4979 int v13; // ecx@10 | |
4980 int v14; // edx@10 | |
4981 unsigned int v15; // eax@22 | |
4982 int *v16; // esi@22 | |
4983 int *v17; // edi@22 | |
4984 int v18; // ecx@22 | |
4985 int v19; // edx@22 | |
4986 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4987 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4988 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4989 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4990 | |
4991 v5 = a4; | |
4992 v23 = _z >> 16; | |
4993 z = x + v5; | |
693 | 4994 if ( z >= (signed int)pViewport->uViewportTL_X |
4995 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4996 && y >= (signed int)pViewport->uViewportTL_Y | |
4997 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4998 { | |
4999 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
5000 x = pViewport->uViewportTL_X; | |
5001 if ( z > (signed int)pViewport->uViewportBR_X ) | |
5002 z = pViewport->uViewportBR_X; | |
0 | 5003 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
5004 v22 = z - x; | |
5005 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
5006 v7 = lightColor >> 3; | |
5007 v8 = lightColor & 0xF0; | |
5008 v9 = v7 & 0x1E0000; | |
5009 if ( pRenderer->uTargetGBits == 5 ) | |
5010 { | |
5011 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
5012 v11 = (int *)pTarget; | |
5013 v12 = pTargetZ; | |
5014 v13 = v22; | |
5015 v14 = (v10 << 16) | v10; | |
5016 z = (unsigned __int8)pTarget & 2; | |
5017 if ( (unsigned __int8)pTarget & 2 ) | |
5018 { | |
5019 z = (unsigned int)*pTargetZ >> 16; | |
5020 if ( z > v23 ) | |
5021 { | |
5022 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
5023 *pTarget = z; | |
5024 } | |
5025 v13 = v22 - 1; | |
5026 v11 = (int *)(pTarget + 1); | |
5027 v12 = pTargetZ + 1; | |
5028 } | |
5029 while ( v13 != 1 ) | |
5030 { | |
5031 if ( v13 < 1 ) | |
5032 return z; | |
5033 z = (unsigned int)*v12 >> 16; | |
5034 if ( z <= v23 ) | |
5035 { | |
5036 v13 -= 2; | |
5037 ++v11; | |
5038 v12 += 2; | |
5039 } | |
5040 else | |
5041 { | |
5042 v12 += 2; | |
5043 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
5044 v13 -= 2; | |
5045 *v11 = z; | |
5046 ++v11; | |
5047 } | |
5048 } | |
5049 z = (unsigned int)*v12 >> 16; | |
5050 if ( z > v23 ) | |
5051 { | |
5052 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
5053 *(short *)v11 = z; | |
5054 } | |
5055 } | |
5056 else | |
5057 { | |
5058 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
5059 v16 = (int *)pTarget; | |
5060 v17 = pTargetZ; | |
5061 v18 = v22; | |
5062 v19 = (v15 << 16) | v15; | |
5063 z = (unsigned __int8)pTarget & 2; | |
5064 if ( (unsigned __int8)pTarget & 2 ) | |
5065 { | |
5066 z = (unsigned int)*pTargetZ >> 16; | |
5067 if ( z > v23 ) | |
5068 { | |
5069 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
5070 *pTarget = z; | |
5071 } | |
5072 v18 = v22 - 1; | |
5073 v16 = (int *)(pTarget + 1); | |
5074 v17 = pTargetZ + 1; | |
5075 } | |
5076 while ( v18 != 1 ) | |
5077 { | |
5078 if ( v18 < 1 ) | |
5079 return z; | |
5080 z = (unsigned int)*v17 >> 16; | |
5081 if ( z <= v23 ) | |
5082 { | |
5083 v18 -= 2; | |
5084 ++v16; | |
5085 v17 += 2; | |
5086 } | |
5087 else | |
5088 { | |
5089 v17 += 2; | |
5090 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
5091 v18 -= 2; | |
5092 *v16 = z; | |
5093 ++v16; | |
5094 } | |
5095 } | |
5096 z = (unsigned int)*v17 >> 16; | |
5097 if ( z > v23 ) | |
5098 { | |
5099 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
5100 *(short *)v16 = z; | |
5101 } | |
5102 } | |
5103 } | |
5104 return z; | |
5105 } | |
5106 | |
5107 | |
5108 //----- (004A57E9) -------------------------------------------------------- | |
5109 void __cdecl Present_ColorKey() | |
5110 { | |
5111 HRESULT v0; // eax@3 | |
5112 HRESULT v1; // eax@3 | |
5113 HRESULT v2; // eax@3 | |
5114 HRESULT v3; // eax@3 | |
5115 HRESULT v4; // eax@3 | |
5116 RECT a2; // [sp+4h] [bp-14h]@3 | |
5117 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
5118 | |
5119 if ( !pRenderer->uNumSceneBegins ) | |
5120 { | |
5121 if ( pRenderer->field_40110 ) | |
5122 { | |
693 | 5123 a2.bottom = pViewport->uViewportTL_Y; |
0 | 5124 a2.left = 0; |
5125 a2.top = 0; | |
5126 a2.right = 640; | |
5127 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
5128 a2.right = 640; | |
5129 a2.left = 0; | |
693 | 5130 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 5131 a2.bottom = 480; |
5132 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
5133 0, | |
693 | 5134 pViewport->uViewportBR_Y + 1, |
0 | 5135 pRenderer->pColorKeySurface4, |
5136 &a2, | |
5137 16u)); | |
693 | 5138 a2.right = pViewport->uViewportTL_X; |
5139 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 5140 a2.left = 0; |
693 | 5141 a2.top = pViewport->uViewportTL_Y; |
0 | 5142 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
5143 0, | |
693 | 5144 pViewport->uViewportTL_Y, |
0 | 5145 pRenderer->pColorKeySurface4, |
5146 &a2, | |
5147 16u)); | |
693 | 5148 a2.left = pViewport->uViewportBR_X; |
5149 a2.top = pViewport->uViewportTL_Y; | |
0 | 5150 a2.right = 640; |
693 | 5151 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 5152 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 5153 pViewport->uViewportBR_X, |
5154 pViewport->uViewportTL_Y, | |
0 | 5155 pRenderer->pColorKeySurface4, |
5156 &a2, | |
5157 16u)); | |
693 | 5158 a2.right = pViewport->uViewportBR_X; |
5159 a2.bottom = pViewport->uViewportBR_Y + 1; | |
5160 a2.left = pViewport->uViewportTL_X; | |
5161 a2.top = pViewport->uViewportTL_Y; | |
0 | 5162 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 5163 pViewport->uViewportTL_X, |
5164 pViewport->uViewportTL_Y, | |
0 | 5165 pRenderer->pColorKeySurface4, |
5166 &a2, | |
5167 17u)); | |
5168 } | |
5169 } | |
5170 } | |
5171 | |
5172 //----- (004A597D) -------------------------------------------------------- | |
5173 void Present_NoColorKey() | |
5174 { | |
5175 //unsigned __int16 *v0; // eax@4 | |
5176 unsigned __int16 *v1; // esi@4 | |
5177 void *v2; // edi@4 | |
5178 //signed int v4; // ebx@4 | |
5179 //signed int v5; // ebx@6 | |
5180 //void *v6; // edi@7 | |
5181 //const void *v7; // esi@7 | |
5182 signed int v8; // ebx@8 | |
5183 int v9; // eax@10 | |
5184 unsigned int v10; // esi@10 | |
5185 unsigned __int32 v11; // edi@10 | |
5186 //int v12; // ecx@10 | |
5187 unsigned int v13; // ebx@10 | |
5188 int v14; // eax@11 | |
5189 int v15; // eax@13 | |
5190 int v16; // eax@14 | |
5191 int v17; // eax@16 | |
5192 HRESULT v18; // eax@22 | |
5193 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
5194 int v20; // [sp+88h] [bp-1Ch]@10 | |
5195 int v21; // [sp+8Ch] [bp-18h]@10 | |
5196 __int32 v22; // [sp+90h] [bp-14h]@10 | |
5197 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
5198 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
5199 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
5200 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
5201 | |
5202 if ( !pRenderer->uNumSceneBegins ) | |
5203 { | |
5204 if ( pRenderer->field_40110 ) | |
5205 { | |
5206 memset(&Dst, 0, 0x7Cu); | |
5207 Dst.dwSize = 124; | |
168 | 5208 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 5209 { |
5210 //v26 = Dst.lpSurface; | |
5211 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
5212 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
5213 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
5214 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
5215 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
5216 v1 = pRenderer->pTargetSurface; | |
5217 v2 = Dst.lpSurface; | |
5218 | |
5219 | |
5220 /*for (uint y = 0; y < 480; ++y) | |
5221 { | |
5222 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
5223 for (uint x = 0; x < 640; ++x) | |
5224 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
5225 }*/ | |
5226 | |
5227 auto pSrc = pRenderer->pTargetSurface; | |
5228 auto pDst = (__int16 *)Dst.lpSurface; | |
5229 | |
5230 for (uint y = 0; y < 8; ++y) | |
5231 memcpy(pDst + y * Dst.lPitch / 2, | |
5232 | |
5233 pSrc + y * 640, 640 * sizeof(__int16)); | |
5234 | |
5235 for (uint y = 8; y < 352; ++y) | |
5236 { | |
5237 memcpy(pDst + y * Dst.lPitch / 2, | |
5238 pSrc + y * 640, 8 * sizeof(__int16)); | |
5239 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2, | |
5240 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
5241 } | |
5242 | |
121 | 5243 for (uint y = 352; y < 480; ++y) |
0 | 5244 memcpy(pDst + y * Dst.lPitch / 2, |
5245 pSrc + y * 640, 640 * sizeof(__int16)); | |
5246 | |
5247 | |
693 | 5248 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 5249 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 5250 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 5251 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 5252 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 5253 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
5254 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
5255 v21 = 4 * v9 + 1280; | |
5256 | |
121 | 5257 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 5258 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
5259 v10 = (int)pSrc_x1y1; | |
5260 v11 = (int)pDst_x1y1; | |
693 | 5261 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 5262 v13 = v24; |
5263 | |
693 | 5264 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 5265 { |
5266 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
5267 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 5268 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 5269 { |
5270 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
5271 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
5272 } | |
5273 } | |
5274 | |
5275 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
5276 | |
5277 /* while ( 1 ) | |
5278 { | |
5279 while ( 1 ) | |
5280 { | |
5281 v14 = *(int *)v10; | |
5282 v10 += 4; | |
5283 if ( v14 == v13 ) | |
5284 break; | |
5285 if ( (short)v14 == (short)v13 ) | |
5286 { | |
5287 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
5288 v11 += 4; | |
5289 --uHalfWidth; | |
5290 if ( !uHalfWidth ) | |
5291 goto LABEL_21; | |
5292 } | |
5293 else | |
5294 { | |
5295 v15 = __ROL__(v14, 16); | |
5296 if ( (short)v15 == (short)v13 ) | |
5297 { | |
5298 v17 = __ROR__(v15, 16); | |
5299 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
5300 v11 += 4; | |
5301 --uHalfWidth; | |
5302 if ( !uHalfWidth ) | |
5303 goto LABEL_21; | |
5304 } | |
5305 else | |
5306 { | |
5307 v16 = __ROR__(v15, 16); | |
5308 *(int *)v11 = v16; | |
5309 v11 += 4; | |
5310 --uHalfWidth; | |
5311 if ( !uHalfWidth ) | |
5312 goto LABEL_21; | |
5313 } | |
5314 } | |
5315 } | |
5316 v11 += 4; | |
5317 --uHalfWidth; | |
5318 if ( !uHalfWidth ) | |
5319 { | |
5320 LABEL_21: | |
5321 v10 += v21; | |
5322 v11 += v22; | |
5323 uHalfWidth = v20; | |
5324 if ( !--uNumLines ) | |
5325 { | |
5326 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
5327 return; | |
5328 } | |
5329 } | |
5330 }*/ | |
5331 } | |
5332 } | |
5333 } | |
5334 } | |
5335 | |
5336 | |
5337 | |
5338 //----- (004A7063) -------------------------------------------------------- | |
5339 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
5340 { | |
5341 float v2; // ST1C_4@1 | |
5342 double v3; // ST14_8@1 | |
5343 signed int v4; // ebx@1 | |
5344 float v5; // ST1C_4@1 | |
5345 double v6; // ST14_8@1 | |
5346 signed int v7; // edi@1 | |
5347 double v8; // ST0C_8@1 | |
5348 signed int v9; // esi@1 | |
5349 signed int v10; // ecx@1 | |
5350 double v12; // [sp+8h] [bp-18h]@1 | |
5351 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
5352 | |
5353 v2 = (double)(uDiffuse >> 24) * a2; | |
5354 v3 = v2 + 6.7553994e15; | |
5355 v4 = LODWORD(v3); | |
5356 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
5357 v6 = v5 + 6.7553994e15; | |
5358 v7 = LODWORD(v6); | |
5359 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
5360 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
5361 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
5362 v9 = LODWORD(v8); | |
5363 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
5364 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
5365 v10 = LODWORD(v12); | |
5366 if ( v4 > 255 ) | |
5367 v4 = 255; | |
5368 if ( v4 < 0 ) | |
5369 v4 = 0; | |
5370 if ( SHIDWORD(v13) > 255 ) | |
5371 v7 = 255; | |
5372 if ( v7 < 0 ) | |
5373 v7 = 0; | |
5374 if ( (signed int)v13 > 255 ) | |
5375 v9 = 255; | |
5376 if ( v9 < 0 ) | |
5377 v9 = 0; | |
5378 if ( SLODWORD(v12) > 255 ) | |
5379 v10 = 255; | |
5380 if ( v10 < 0 ) | |
5381 v10 = 0; | |
5382 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
5383 } | |
5384 | |
5385 | |
5386 | |
5387 | |
5388 | |
5389 | |
5390 | |
5391 | |
5392 //----- (004AD504) -------------------------------------------------------- | |
711 | 5393 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 5394 { |
5395 int result; // eax@1 | |
711 | 5396 signed int v2; // ebx@1 |
0 | 5397 BLVFace *v3; // esi@3 |
5398 Texture *v4; // edi@6 | |
5399 int v5; // eax@7 | |
5400 int v6; // edx@7 | |
5401 int v7; // ecx@7 | |
5402 int v8; // ebx@8 | |
5403 int v9; // eax@8 | |
5404 int v10; // ebx@8 | |
5405 unsigned int v11; // ebx@9 | |
5406 int v12; // esi@10 | |
5407 int v13; // eax@13 | |
5408 unsigned __int16 *v14; // eax@13 | |
5409 unsigned int v15; // eax@14 | |
5410 unsigned __int16 *v16; // ebx@14 | |
5411 int v17; // eax@15 | |
5412 int v18; // ebx@15 | |
5413 int v19; // esi@15 | |
5414 int v20; // ecx@15 | |
5415 int v21; // eax@15 | |
5416 stru193_math *v22; // ebx@15 | |
5417 int v23; // eax@15 | |
5418 char *v24; // esi@16 | |
5419 int v25; // eax@18 | |
5420 int v26; // eax@18 | |
5421 int v27; // eax@20 | |
5422 signed int v28; // esi@20 | |
5423 signed int v29; // edx@20 | |
5424 signed int v30; // esi@20 | |
5425 signed int v31; // edi@20 | |
5426 int v32; // esi@20 | |
5427 int v33; // eax@26 | |
5428 int *v34; // esi@27 | |
5429 unsigned __int16 *v35; // edi@27 | |
5430 unsigned int v36; // edx@27 | |
5431 int v37; // ebx@27 | |
5432 char v38; // cl@27 | |
5433 char v39; // ch@27 | |
5434 int v40; // ebx@29 | |
5435 int v41; // edx@29 | |
5436 unsigned int v42; // ebx@30 | |
5437 int v43; // edx@30 | |
5438 int v44; // eax@33 | |
5439 int *v45; // esi@34 | |
5440 unsigned __int16 *v46; // edi@34 | |
5441 unsigned int v47; // edx@34 | |
5442 int v48; // ebx@34 | |
5443 char v49; // cl@34 | |
5444 char v50; // ch@34 | |
5445 int v51; // ebx@36 | |
5446 int v52; // edx@36 | |
5447 unsigned __int16 v53; // bx@37 | |
5448 int v54; // edx@37 | |
5449 int v55; // eax@40 | |
5450 int v56; // eax@41 | |
5451 int *v57; // esi@42 | |
5452 unsigned __int16 *v58; // edi@42 | |
5453 unsigned int v59; // edx@42 | |
5454 int v60; // ebx@42 | |
5455 char v61; // cl@42 | |
5456 char v62; // ch@42 | |
5457 unsigned int v63; // ebx@44 | |
5458 int v64; // edx@44 | |
5459 unsigned int v65; // ebx@44 | |
5460 int v66; // edx@44 | |
5461 unsigned int v67; // ebx@45 | |
5462 int v68; // edx@45 | |
5463 int v69; // ebx@45 | |
5464 int v70; // edx@45 | |
5465 int v71; // eax@48 | |
5466 int *v72; // esi@49 | |
5467 unsigned __int16 *v73; // edi@49 | |
5468 unsigned int v74; // edx@49 | |
5469 int v75; // ebx@49 | |
5470 char v76; // cl@49 | |
5471 char v77; // ch@49 | |
5472 unsigned int v78; // ebx@51 | |
5473 int v79; // edx@51 | |
5474 unsigned int v80; // ebx@51 | |
5475 int v81; // edx@51 | |
5476 unsigned int v82; // ebx@52 | |
5477 int v83; // edx@52 | |
5478 int v84; // ebx@52 | |
5479 int v85; // edx@52 | |
5480 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
5481 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
5482 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
5483 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
5484 int v90; // [sp+1Ch] [bp-88h]@20 | |
5485 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
5486 int v92; // [sp+24h] [bp-80h]@7 | |
5487 int i; // [sp+28h] [bp-7Ch]@7 | |
5488 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
5489 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
5490 Texture *v96; // [sp+34h] [bp-70h]@6 | |
5491 int v97; // [sp+38h] [bp-6Ch]@15 | |
5492 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
5493 int v99; // [sp+40h] [bp-64h]@9 | |
5494 int v100; // [sp+44h] [bp-60h]@24 | |
5495 int v101; // [sp+48h] [bp-5Ch]@10 | |
5496 int v102; // [sp+4Ch] [bp-58h]@20 | |
5497 int v103; // [sp+50h] [bp-54h]@20 | |
5498 int v104; // [sp+54h] [bp-50h]@9 | |
5499 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
5500 int v106; // [sp+5Ch] [bp-48h]@24 | |
5501 int v107; // [sp+60h] [bp-44h]@20 | |
5502 int v108; // [sp+64h] [bp-40h]@20 | |
5503 int v109; // [sp+68h] [bp-3Ch]@20 | |
5504 int v110; // [sp+6Ch] [bp-38h]@15 | |
5505 int v111; // [sp+70h] [bp-34h]@20 | |
5506 int a1; // [sp+74h] [bp-30h]@12 | |
5507 int a2; // [sp+78h] [bp-2Ch]@9 | |
5508 int *v114; // [sp+7Ch] [bp-28h]@16 | |
5509 int v115; // [sp+80h] [bp-24h]@18 | |
5510 int v116; // [sp+84h] [bp-20h]@7 | |
5511 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
5512 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
5513 int *v119; // [sp+90h] [bp-14h]@13 | |
5514 int v120; // [sp+94h] [bp-10h]@15 | |
5515 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
5516 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
5517 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
5518 | |
5519 result = pRenderer->uTargetSurfacePitch; | |
711 | 5520 v2 = sFaceID; |
0 | 5521 v95 = pRenderer->uTargetSurfacePitch; |
711 | 5522 if ( sFaceID >= 0 ) |
5523 { | |
5524 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
5525 { | |
5526 v3 = &pIndoor->pFaces[sFaceID]; | |
5527 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 5528 if ( !pRenderer->pRenderD3D ) |
5529 { | |
711 | 5530 result = sub_423B5D(sFaceID); |
0 | 5531 if ( result ) |
5532 { | |
5533 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
5534 if ( result ) | |
5535 { | |
5536 result = (int)v3->GetTexture(); | |
5537 v4 = (Texture *)result; | |
5538 v96 = (Texture *)result; | |
5539 if ( result ) | |
5540 { | |
5541 v5 = *(short *)(result + 38); | |
5542 LOBYTE(v3->uAttributes) |= 0x80u; | |
5543 v92 = v5; | |
5544 sub_4AE5F1(v2); | |
5545 ++pBLVRenderParams->field_84; | |
5546 v6 = stru_F8AD28.pDeltaUV[0]; | |
5547 v116 = stru_F8AD28.pDeltaUV[1]; | |
5548 v7 = 0; | |
5549 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
5550 { | |
5551 v8 = v116; | |
5552 stru_F8AD28._blv_lights_xs[v7] += v6; | |
5553 v9 = 4 * v7 + 16297672; | |
5554 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
5555 } | |
5556 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
5557 result = stru_F8A590._viewport_space_y; | |
5558 a2 = stru_F8A590._viewport_space_y; | |
5559 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
5560 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 5561 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5562 v87 = v4->pLevelOfDetail1; |
5563 v88 = v4->pLevelOfDetail2; | |
5564 v89 = v4->pLevelOfDetail3; | |
5565 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
5566 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
5567 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5568 { | |
5569 v12 = 2 * stru_F8A590._viewport_space_y; | |
5570 v101 = 2 * stru_F8A590._viewport_space_y; | |
5571 while ( 1 ) | |
5572 { | |
5573 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
5574 sub_4AE313(a1, result, &stru_F81018.field_0); | |
5575 if ( LOBYTE(viewparams->field_20) ) | |
5576 { | |
5577 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
5578 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
5579 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
5580 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
5581 - pBLVRenderParams->uViewportX]; | |
5582 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
5583 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
5584 - pBLVRenderParams->uViewportX]; | |
5585 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
5586 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
5587 - pBLVRenderParams->uViewportX]; | |
5588 v123 = (unsigned int)v16; | |
5589 } | |
5590 else | |
5591 { | |
5592 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
5593 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
5594 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
5595 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
5596 } | |
5597 v117 = (unsigned int)v14; | |
5598 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
5599 v18 = stru_F81018.field_0.field_10; | |
5600 LOWORD(v17) = 0; | |
5601 v97 = stru_F8AD28.field_0 | v17; | |
5602 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
5603 v19 = stru_F81018.field_0.field_4 >> i; | |
5604 v20 = 11 - v18; | |
5605 v116 = stru_F81018.field_0.field_8 >> i; | |
5606 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
5607 v22 = stru_5C6E00; | |
5608 v122 = (unsigned __int16 *)v20; | |
323 | 5609 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
5610 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 5611 v120 = v116 + 4 * v23; |
5612 if ( v123 < v117 ) | |
5613 { | |
5614 v24 = (char *)&stru_F81018.field_34.field_8; | |
5615 v114 = &stru_F81018.field_34.field_8; | |
5616 a1 += 16; | |
5617 while ( 1 ) | |
5618 { | |
5619 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
5620 v25 = *((int *)v24 - 2); | |
5621 LOWORD(v25) = 0; | |
5622 v115 = v97; | |
5623 v26 = stru_F8AD28.field_0 | v25; | |
5624 if ( v97 <= (unsigned int)v26 ) | |
5625 v115 = v26; | |
5626 v97 = v26; | |
5627 v27 = *((int *)v24 - 11); | |
5628 v28 = *((int *)v24 - 1); | |
5629 v105 = (&v86)[4 * v27]; | |
5630 v111 = v27 + 16; | |
5631 v29 = v4->uWidthMinus1; | |
5632 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
5633 v107 = v29 >> v27; | |
5634 v30 = v28 >> i; | |
5635 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
5636 v31 = *v114 >> i; | |
5637 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 5638 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
5639 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 5640 v108 = (signed int)(v116 - v121) >> 4; |
5641 v103 = (v90 - v120) >> 4; | |
5642 v32 = v123 + 32; | |
5643 if ( LOBYTE(viewparams->field_20) ) | |
5644 v32 = v123 + 64; | |
5645 if ( v32 > v117 ) | |
5646 v32 = v117; | |
5647 v118 = v32; | |
5648 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
5649 v106 = (signed int)(v32 - v123) >> 1; | |
5650 if ( v110 >> 16 == v100 >> 16 ) | |
5651 { | |
5652 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
5653 if ( LOBYTE(viewparams->field_20) ) | |
5654 { | |
5655 v44 = v123; | |
5656 if ( v123 < v118 ) | |
5657 { | |
5658 v45 = v119; | |
5659 v46 = v122; | |
5660 v47 = v121; | |
5661 v48 = v120; | |
5662 v49 = v111; | |
5663 v50 = v109; | |
5664 if ( v106 & 2 ) | |
5665 { | |
5666 *v119 = v115; | |
5667 v45 -= 2; | |
5668 v44 = v123 + 4; | |
5669 goto LABEL_37; | |
5670 } | |
5671 do | |
5672 { | |
5673 v44 += 8; | |
5674 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
5675 v52 = v115; | |
5676 LOWORD(v51) = v46[v51]; | |
5677 *v45 = v115; | |
5678 v45[1] = v52; | |
5679 v45[640] = v52; | |
5680 v45[641] = v52; | |
5681 *(short *)(v44 - 8) = v51; | |
5682 *(short *)(v44 - 6) = v51; | |
5683 *(short *)(v44 + 1272) = v51; | |
5684 *(short *)(v44 + 1274) = v51; | |
5685 v45[2] = v52; | |
5686 v45[3] = v52; | |
5687 v45[642] = v52; | |
5688 v45[643] = v52; | |
5689 v121 += v108; | |
5690 v120 += v103; | |
5691 v47 = v121; | |
5692 v48 = v120; | |
5693 LABEL_37: | |
5694 v45 += 4; | |
5695 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
5696 v54 = v108; | |
5697 *(short *)(v44 - 4) = v53; | |
5698 *(short *)(v44 - 2) = v53; | |
5699 *(short *)(v44 + 1276) = v53; | |
5700 *(short *)(v44 + 1278) = v53; | |
5701 v121 += v54; | |
5702 v120 += v103; | |
5703 v47 = v121; | |
5704 v48 = v120; | |
5705 } | |
5706 while ( v44 < v118 ); | |
5707 v123 = v44; | |
5708 v119 = v45; | |
5709 } | |
5710 } | |
5711 else | |
5712 { | |
5713 v33 = v123; | |
5714 if ( v123 < v118 ) | |
5715 { | |
5716 v34 = v119; | |
5717 v35 = v122; | |
5718 v36 = v121; | |
5719 v37 = v120; | |
5720 v38 = v111; | |
5721 v39 = v109; | |
5722 if ( v106 & 1 ) | |
5723 { | |
5724 *v119 = v115; | |
5725 --v34; | |
5726 v33 = v123 + 2; | |
5727 goto LABEL_30; | |
5728 } | |
5729 do | |
5730 { | |
5731 v33 += 4; | |
5732 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
5733 v41 = v115; | |
5734 LOWORD(v40) = v35[v40]; | |
5735 *v34 = v115; | |
5736 *(short *)(v33 - 4) = v40; | |
5737 v34[1] = v41; | |
5738 v121 += v108; | |
5739 v120 += v103; | |
5740 v36 = v121; | |
5741 v37 = v120; | |
5742 LABEL_30: | |
5743 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
5744 v34 += 2; | |
5745 v43 = v108; | |
5746 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
5747 v121 += v43; | |
5748 v120 += v103; | |
5749 v36 = v121; | |
5750 v37 = v120; | |
5751 } | |
5752 while ( v33 < v118 ); | |
5753 v123 = v33; | |
5754 v119 = v34; | |
5755 } | |
5756 } | |
5757 } | |
5758 else | |
5759 { | |
5760 v55 = v110 - ((v100 - v110) >> 4); | |
5761 v110 = (v100 - v110) >> 4; | |
5762 v122 = (unsigned __int16 *)v55; | |
5763 if ( LOBYTE(viewparams->field_20) ) | |
5764 { | |
5765 v71 = v123; | |
5766 if ( v123 < v118 ) | |
5767 { | |
5768 v72 = v119; | |
5769 v73 = v94; | |
5770 v74 = v121; | |
5771 v75 = v120; | |
5772 v76 = v111; | |
5773 v77 = v109; | |
5774 if ( v106 & 2 ) | |
5775 { | |
5776 *v119 = v115; | |
5777 v72 += 2; | |
5778 v71 = v123 + 4; | |
5779 goto LABEL_52; | |
5780 } | |
5781 do | |
5782 { | |
5783 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
5784 v79 = (int)((char *)v122 + v110); | |
5785 v71 += 8; | |
5786 v122 = (unsigned __int16 *)v79; | |
5787 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
5788 v81 = v115; | |
5789 LOWORD(v80) = v73[v80]; | |
5790 *v72 = v115; | |
5791 v72[1] = v81; | |
5792 v72[640] = v81; | |
5793 v72[641] = v81; | |
5794 *(short *)(v71 - 8) = v80; | |
5795 *(short *)(v71 - 6) = v80; | |
5796 *(short *)(v71 + 1272) = v80; | |
5797 *(short *)(v71 + 1274) = v80; | |
5798 v72[2] = v81; | |
5799 v72[3] = v81; | |
5800 v72[642] = v81; | |
5801 v72[643] = v81; | |
5802 v121 += v108; | |
5803 v120 += v103; | |
5804 v74 = v121; | |
5805 v75 = v120; | |
5806 v72 += 4; | |
5807 LABEL_52: | |
5808 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
5809 v83 = (int)((char *)v122 + v110); | |
5810 v84 = v105[v82]; | |
5811 v122 = (unsigned __int16 *)v83; | |
5812 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
5813 v85 = v108; | |
5814 *(short *)(v71 - 4) = v84; | |
5815 *(short *)(v71 - 2) = v84; | |
5816 *(short *)(v71 + 1276) = v84; | |
5817 *(short *)(v71 + 1278) = v84; | |
5818 v121 += v85; | |
5819 v120 += v103; | |
5820 v74 = v121; | |
5821 v75 = v120; | |
5822 } | |
5823 while ( v71 < v118 ); | |
5824 v123 = v71; | |
5825 v119 = v72; | |
5826 } | |
5827 } | |
5828 else | |
5829 { | |
5830 v56 = v123; | |
5831 if ( v123 < v118 ) | |
5832 { | |
5833 v57 = v119; | |
5834 v58 = v94; | |
5835 v59 = v121; | |
5836 v60 = v120; | |
5837 v61 = v111; | |
5838 v62 = v109; | |
5839 if ( v106 & 1 ) | |
5840 { | |
5841 *v119 = v115; | |
5842 ++v57; | |
5843 v56 = v123 + 2; | |
5844 goto LABEL_45; | |
5845 } | |
5846 do | |
5847 { | |
5848 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5849 v64 = (int)((char *)v122 + v110); | |
5850 v56 += 4; | |
5851 v122 = (unsigned __int16 *)v64; | |
5852 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
5853 v66 = v115; | |
5854 LOWORD(v65) = v58[v65]; | |
5855 *v57 = v115; | |
5856 *(short *)(v56 - 4) = v65; | |
5857 v57[1] = v66; | |
5858 v121 += v108; | |
5859 v120 += v103; | |
5860 v59 = v121; | |
5861 v60 = v120; | |
5862 v57 += 2; | |
5863 LABEL_45: | |
5864 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5865 v68 = (int)((char *)v122 + v110); | |
5866 v69 = v105[v67]; | |
5867 v122 = (unsigned __int16 *)v68; | |
5868 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
5869 v70 = v108; | |
5870 *(short *)(v56 - 2) = v69; | |
5871 v121 += v70; | |
5872 v120 += v103; | |
5873 v59 = v121; | |
5874 v60 = v120; | |
5875 } | |
5876 while ( v56 < v118 ); | |
5877 v123 = v56; | |
5878 v119 = v57; | |
5879 } | |
5880 } | |
5881 } | |
5882 v114 += 13; | |
5883 v110 = v100; | |
5884 a1 += 16; | |
5885 v4 = v96; | |
5886 v121 = v116; | |
5887 v120 = v90; | |
5888 if ( v123 >= v117 ) | |
5889 break; | |
5890 v24 = (char *)v114; | |
5891 v22 = stru_5C6E00; | |
5892 } | |
5893 } | |
5894 ++a2; | |
5895 v98 += v95; | |
5896 result = a2; | |
5897 v101 += 2; | |
5898 v99 += 640; | |
5899 if ( a2 > stru_F8A590._viewport_space_w ) | |
5900 break; | |
5901 v12 = v101; | |
5902 result = a2; | |
5903 v11 = v98; | |
5904 } | |
5905 } | |
5906 } | |
5907 } | |
5908 } | |
5909 } | |
5910 } | |
5911 } | |
5912 return result; | |
5913 } | |
5914 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5915 | |
5916 //----- (004ADD1D) -------------------------------------------------------- | |
5917 void __fastcall sub_4ADD1D(int uFaceID) | |
5918 { | |
5919 int v1; // edi@1 | |
5920 BLVFace *v2; // esi@3 | |
5921 signed int v3; // ebx@4 | |
5922 Texture *v4; // edi@9 | |
5923 signed int v5; // eax@9 | |
5924 char *v6; // edi@12 | |
5925 signed int v7; // eax@15 | |
5926 unsigned int v8; // eax@16 | |
5927 __int16 v9; // cx@19 | |
5928 unsigned __int8 *v10; // eax@19 | |
5929 unsigned __int16 *v11; // eax@19 | |
5930 int v12; // edi@19 | |
5931 int v13; // ebx@20 | |
5932 stru352 *v14; // esi@20 | |
5933 DWORD v15; // eax@22 | |
5934 signed int v16; // ecx@22 | |
5935 signed int v17; // ST68_4@22 | |
5936 int v18; // eax@22 | |
5937 int v19; // ecx@22 | |
5938 unsigned int v20; // esi@23 | |
5939 int v21; // edi@23 | |
5940 int v22; // eax@23 | |
5941 int *v23; // ebx@24 | |
5942 int v24; // edx@24 | |
5943 int v25; // ebx@25 | |
5944 unsigned __int16 v26; // cx@25 | |
5945 int v27; // edx@26 | |
5946 unsigned __int16 v28; // cx@26 | |
5947 unsigned __int8 v29; // sf@27 | |
5948 unsigned __int8 v30; // of@27 | |
5949 unsigned int v31; // esi@29 | |
5950 int v32; // edi@29 | |
5951 unsigned __int16 *v33; // eax@29 | |
5952 int *v34; // ebx@30 | |
5953 int v35; // edx@30 | |
5954 int v36; // ebx@31 | |
5955 unsigned __int16 v37; // cx@31 | |
5956 int v38; // edx@32 | |
5957 unsigned __int16 v39; // cx@32 | |
5958 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5959 int v41; // [sp-Ch] [bp-68h]@15 | |
5960 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5961 signed int v43; // [sp+14h] [bp-48h]@12 | |
5962 signed int v44; // [sp+14h] [bp-48h]@22 | |
5963 int v45; // [sp+1Ch] [bp-40h]@22 | |
5964 int v46; // [sp+20h] [bp-3Ch]@22 | |
5965 int v47; // [sp+24h] [bp-38h]@19 | |
5966 char v48; // [sp+28h] [bp-34h]@19 | |
5967 int v49; // [sp+2Ch] [bp-30h]@19 | |
5968 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5969 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5970 int v52; // [sp+38h] [bp-24h]@22 | |
5971 int v53; // [sp+3Ch] [bp-20h]@22 | |
5972 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5973 int v55; // [sp+40h] [bp-1Ch]@20 | |
5974 int v56; // [sp+44h] [bp-18h]@20 | |
5975 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5976 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5977 int v59; // [sp+50h] [bp-Ch]@4 | |
5978 int v60; // [sp+50h] [bp-Ch]@19 | |
5979 int v61; // [sp+54h] [bp-8h]@22 | |
5980 int *v62; // [sp+58h] [bp-4h]@23 | |
5981 int *v63; // [sp+58h] [bp-4h]@29 | |
5982 | |
5983 v1 = uFaceID; | |
5984 v42 = pRenderer->uTargetSurfacePitch; | |
5985 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5986 { | |
5987 v2 = &pIndoor->pFaces[uFaceID]; | |
5988 if ( pRenderer->pRenderD3D ) | |
5989 { | |
5990 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5991 v59 = v3; | |
5992 } | |
5993 else | |
5994 { | |
5995 v59 = sub_423B5D(uFaceID); | |
5996 v3 = v59; | |
5997 } | |
5998 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5999 { | |
6000 v4 = v2->GetTexture(); | |
6001 v5 = 0; | |
6002 if ( v4 ) | |
6003 { | |
6004 if ( pRenderer->pRenderD3D ) | |
6005 { | |
6006 if ( v3 > 0 ) | |
6007 { | |
6008 v54 = v3; | |
6009 v43 = v3; | |
6010 v6 = (char *)&array_507D30[0].v; | |
6011 do | |
6012 { | |
6013 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
6014 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
6015 v6 += 48; | |
6016 --v54; | |
6017 } | |
6018 while ( v54 ); | |
6019 v3 = v59; | |
6020 v5 = v43; | |
6021 } | |
6022 v7 = v5; | |
6023 v41 = stru_F8AD28.field_0; | |
6024 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
6025 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
6026 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
6027 { | |
6028 v40 = v2->GetTexture(); | |
6029 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
6030 } | |
6031 else | |
6032 { | |
6033 v40 = v2->GetTexture(); | |
6034 v8 = v2->uBitmapID; | |
6035 } | |
6036 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
6037 } | |
6038 else | |
6039 { | |
6040 v49 = v4->uWidthMinus1; | |
6041 v47 = v4->uHeightMinus1 << 16; | |
6042 v9 = 16 - v4->uWidthLn2; | |
710 | 6043 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 6044 LOBYTE(v2->uAttributes) |= 0x80u; |
6045 v48 = v9; | |
6046 v50 = v10; | |
6047 sub_4AF412(); | |
6048 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
6049 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
6050 v12 = stru_F8A590._viewport_space_y; | |
6051 v51 = v11; | |
6052 v60 = stru_F8A590._viewport_space_y; | |
6053 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
6054 { | |
6055 v13 = 2 * stru_F8A590._viewport_space_y; | |
6056 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
6057 v55 = 2 * stru_F8A590._viewport_space_y; | |
6058 v56 = 640 * stru_F8A590._viewport_space_y; | |
6059 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
6060 { | |
6061 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
6062 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
6063 v15 = GetTickCount(); | |
6064 v16 = v14->field_0; | |
6065 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
6066 v45 = v14->field_4 >> 3; | |
6067 v44 = v16 >> 3; | |
6068 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
6069 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
6070 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
6071 v18 = v14->field_28; | |
6072 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
6073 LOWORD(v18) = 0; | |
6074 v46 = stru_F8AD28.field_0 | v18; | |
6075 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
6076 if ( LOBYTE(viewparams->field_20) ) | |
6077 { | |
6078 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
6079 - pBLVRenderParams->uViewportX]; | |
6080 v31 = v44; | |
6081 v32 = v45; | |
6082 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
6083 + 2 * v19 | |
6084 - pBLVRenderParams->uViewportX]; | |
6085 if ( v61 & 1 ) | |
6086 { | |
6087 --v61; | |
6088 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
6089 + 2 * v19 | |
6090 - pBLVRenderParams->uViewportX | |
6091 - 2]; | |
6092 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
6093 - pBLVRenderParams->uViewportX]; | |
6094 v35 = v46; | |
6095 v63 += 2; | |
6096 goto LABEL_32; | |
6097 } | |
6098 while ( 1 ) | |
6099 { | |
6100 v30 = __OFSUB__(v61, 2); | |
6101 v29 = v61 - 2 < 0; | |
6102 v61 -= 2; | |
6103 if ( v29 ^ v30 ) | |
6104 break; | |
6105 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
6106 v31 += v52; | |
6107 v37 = v51[v36]; | |
6108 v32 += v53; | |
6109 v34 = v63; | |
6110 v35 = v46; | |
6111 *v33 = v37; | |
6112 v33[1] = v37; | |
6113 v33[640] = v37; | |
6114 v33[641] = v37; | |
6115 v63 += 4; | |
6116 v34[2] = v46; | |
6117 v34[3] = v46; | |
6118 v34[642] = v46; | |
6119 v34[643] = v46; | |
6120 LABEL_32: | |
6121 *v34 = v35; | |
6122 v34[1] = v35; | |
6123 v34[640] = v35; | |
6124 v34[641] = v35; | |
6125 v38 = v49 & (v31 >> 16); | |
6126 v33 += 4; | |
6127 v31 += v52; | |
6128 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
6129 v32 += v53; | |
6130 *(v33 - 2) = v39; | |
6131 *(v33 - 1) = v39; | |
6132 v33[638] = v39; | |
6133 v33[639] = v39; | |
6134 } | |
6135 } | |
6136 else | |
6137 { | |
6138 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
6139 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
6140 v20 = v44; | |
6141 v21 = v45; | |
6142 v22 = (int)v58; | |
6143 if ( v61 & 1 ) | |
6144 { | |
6145 --v61; | |
6146 v22 = (int)(v58 - 1); | |
6147 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
6148 v24 = v46; | |
6149 ++v62; | |
6150 goto LABEL_26; | |
6151 } | |
6152 while ( 1 ) | |
6153 { | |
6154 v30 = __OFSUB__(v61, 2); | |
6155 v29 = v61 - 2 < 0; | |
6156 v61 -= 2; | |
6157 if ( v29 ^ v30 ) | |
6158 break; | |
6159 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
6160 v20 += v52; | |
6161 v26 = v51[v25]; | |
6162 v21 += v53; | |
6163 v23 = v62; | |
6164 v24 = v46; | |
6165 *(short *)v22 = v26; | |
6166 v62 += 2; | |
6167 v23[1] = v46; | |
6168 LABEL_26: | |
6169 *v23 = v24; | |
6170 v27 = v49 & (v20 >> 16); | |
6171 v22 += 4; | |
6172 v20 += v52; | |
6173 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
6174 v21 += v53; | |
6175 *(short *)(v22 - 2) = v28; | |
6176 } | |
6177 } | |
6178 ++v60; | |
6179 ++i; | |
6180 v56 += 640; | |
6181 v55 += 2; | |
6182 if ( v60 > stru_F8A590._viewport_space_w ) | |
6183 break; | |
6184 v13 = v55; | |
6185 v12 = v60; | |
6186 } | |
6187 } | |
6188 } | |
6189 } | |
6190 } | |
6191 } | |
6192 } | |
6193 | |
6194 //----- (004AE1E7) -------------------------------------------------------- | |
6195 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
6196 { | |
6197 int v3; // ebx@1 | |
6198 int v4; // edi@1 | |
6199 int v5; // esi@1 | |
6200 signed __int64 v6; // qtt@3 | |
6201 int v7; // esi@3 | |
6202 int v8; // eax@5 | |
6203 int result; // eax@5 | |
6204 int v10; // edx@5 | |
6205 int v11; // [sp+Ch] [bp-8h]@1 | |
6206 int v12; // [sp+1Ch] [bp+8h]@2 | |
6207 | |
6208 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
6209 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
6210 v11 = a1; | |
6211 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
6212 + stru_F8AD28.field_7C | |
6213 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
6214 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
6215 { | |
6216 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
6217 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
6218 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
6219 } | |
6220 else | |
6221 { | |
6222 v7 = 1073741824; | |
6223 } | |
6224 v8 = stru_F8AD28.vec_9C.z; | |
6225 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
6226 + stru_F8AD28.vec_8C.x | |
6227 + v4 * stru_F8AD28.vec_8C.y) | |
6228 * (signed __int64)v7) >> 16) | |
6229 + stru_F8AD28.field_98; | |
6230 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
6231 v10 = result + stru_F8AD28.field_A8; | |
6232 stru_F83B80[v11].field_28 = v7; | |
6233 stru_F83B80[v11].field_4 = v10; | |
6234 return result; | |
6235 } | |
6236 | |
6237 //----- (004AE313) -------------------------------------------------------- | |
6238 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
6239 { | |
6240 int _dy; // ebx@1 | |
6241 int _dx; // edi@1 | |
6242 int v5; // ecx@1 | |
6243 int v6; // esi@1 | |
6244 int v7; // ST18_4@2 | |
6245 signed __int64 v8; // qtt@3 | |
6246 unsigned int v9; // ecx@3 | |
6247 int result; // eax@8 | |
6248 int v11; // [sp+Ch] [bp-8h]@1 | |
6249 | |
6250 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
6251 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
6252 ++pBLVRenderParams->field_88; | |
6253 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
6254 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
6255 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
6256 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
6257 { | |
6258 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
6259 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
6260 v9 = v8 / v11; | |
6261 } | |
6262 else | |
6263 { | |
6264 v9 = 0x40000000u; | |
6265 } | |
6266 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
6267 p->field_0 = v9; | |
6268 else | |
6269 p->field_0 = stru_F8AD28.field_34; | |
6270 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
6271 * (signed __int64)(signed int)v9) >> 16) | |
6272 + stru_F8AD28.field_98 | |
6273 + (stru_F8AD28.pDeltaUV[0] << 16); | |
6274 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
6275 * (signed __int64)(signed int)v9) >> 16) | |
6276 + stru_F8AD28.field_A8 | |
6277 + (stru_F8AD28.pDeltaUV[1] << 16); | |
6278 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
6279 if ( result < 369620 || bUseLoResSprites ) | |
6280 { | |
6281 if ( result < 184810 ) | |
6282 p->field_10 = result > 92405; | |
6283 else | |
6284 p->field_10 = 2; | |
6285 } | |
6286 else | |
6287 { | |
6288 p->field_10 = 3; | |
6289 } | |
6290 return result; | |
6291 } | |
6292 | |
6293 //----- (004AE491) -------------------------------------------------------- | |
6294 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
6295 { | |
6296 signed int v2; // eax@1 | |
6297 signed int v3; // edi@1 | |
6298 int v4; // ecx@1 | |
6299 int v5; // esi@2 | |
6300 int v6; // eax@2 | |
6301 int v7; // ebx@2 | |
6302 unsigned int v8; // ecx@2 | |
6303 int v9; // edx@5 | |
6304 int v10; // edx@7 | |
6305 unsigned int v11; // eax@8 | |
6306 int v13; // [sp+4h] [bp-18h]@2 | |
6307 int v14; // [sp+8h] [bp-14h]@2 | |
6308 signed int v15; // [sp+Ch] [bp-10h]@1 | |
6309 int v16; // [sp+14h] [bp-8h]@1 | |
6310 int v17; // [sp+18h] [bp-4h]@1 | |
6311 | |
6312 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
6313 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
6314 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
6315 v4 = 0; | |
6316 v15 = v2; | |
6317 v16 = 0; | |
6318 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
6319 { | |
6320 do | |
6321 { | |
6322 v5 = v16; | |
6323 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
6324 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
6325 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
6326 v7 = v13; | |
6327 v8 = v14; | |
6328 if ( v6 < v13 ) | |
6329 { | |
6330 v6 = v13; | |
6331 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
6332 } | |
6333 if ( v6 < v14 ) | |
6334 { | |
6335 v9 = v6; | |
6336 v6 = v14; | |
6337 v8 = v9; | |
6338 } | |
6339 if ( v7 < (signed int)v8 ) | |
6340 { | |
6341 v10 = v8; | |
6342 v8 = v7; | |
6343 v7 = v10; | |
6344 } | |
6345 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
6346 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
6347 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
6348 ++v16; | |
6349 v2 = v15; | |
6350 } | |
6351 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
6352 v4 = 0; | |
6353 } | |
6354 if ( stru_F8AD28.field_3E4 != v4 ) | |
6355 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
6356 if ( v17 >= v4 ) | |
6357 { | |
6358 if ( v17 > 2031616 ) | |
6359 v17 = 2031616; | |
6360 } | |
6361 else | |
6362 { | |
6363 v17 = v4; | |
6364 } | |
6365 ++pBLVRenderParams->field_8C; | |
6366 return v17; | |
6367 } | |
6368 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
6369 | |
6370 | |
6371 | |
6372 | |
6373 //----- (004AE5F1) -------------------------------------------------------- | |
6374 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
6375 { | |
6376 BLVFace *v1; // esi@1 | |
6377 BLVFaceExtra *v2; // ebx@1 | |
6378 int v3; // eax@1 | |
6379 int v4; // edi@1 | |
6380 Texture *v5; // edi@1 | |
6381 int v6; // eax@1 | |
6382 unsigned int v7; // eax@1 | |
6383 unsigned int v8; // ecx@1 | |
6384 unsigned int v9; // eax@1 | |
6385 unsigned int v10; // ecx@5 | |
6386 int v11; // edi@10 | |
6387 int v12; // ecx@10 | |
6388 int v13; // eax@10 | |
6389 int v14; // edx@10 | |
6390 int v15; // ebx@12 | |
6391 double v16; // st7@16 | |
6392 int v17; // eax@16 | |
6393 char *v18; // ebx@17 | |
6394 int v19; // ecx@19 | |
6395 int v20; // eax@19 | |
6396 int v21; // edx@21 | |
6397 int v22; // eax@23 | |
6398 int v23; // ST04_4@26 | |
6399 int v24; // edi@26 | |
6400 double v25; // st6@26 | |
6401 int v26; // eax@26 | |
6402 double v27; // st6@26 | |
6403 int v28; // ecx@26 | |
6404 char v29; // al@26 | |
6405 int v30; // edx@28 | |
6406 int v31; // ecx@28 | |
6407 BLVLightMM7 *v32; // ecx@32 | |
6408 int v33; // edi@33 | |
6409 int v34; // edx@33 | |
6410 int v35; // eax@33 | |
6411 int v36; // edi@35 | |
6412 int v37; // edx@37 | |
6413 int v38; // ebx@39 | |
6414 int v39; // edi@42 | |
6415 int v40; // eax@42 | |
6416 char *v41; // ebx@45 | |
6417 signed int v42; // ecx@47 | |
6418 int v43; // edi@47 | |
6419 int v44; // eax@49 | |
6420 int v45; // edx@51 | |
6421 int v46; // eax@53 | |
6422 int v47; // ST04_4@55 | |
6423 int v48; // edi@55 | |
6424 double v49; // st6@55 | |
6425 int v50; // eax@55 | |
6426 double v51; // st6@55 | |
6427 int v52; // eax@55 | |
6428 int v53; // ecx@57 | |
6429 int v54; // ecx@58 | |
6430 int v55; // ecx@59 | |
6431 int v56; // edx@62 | |
6432 int v57; // ecx@62 | |
6433 int v58; // eax@63 | |
6434 int v59; // edx@64 | |
6435 int v60; // ecx@67 | |
6436 int v61; // edx@67 | |
6437 int v62; // eax@68 | |
6438 int v63; // edx@69 | |
6439 signed int v64; // ecx@72 | |
6440 double v65; // st7@75 | |
6441 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
6442 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
6443 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
6444 int v69; // [sp+28h] [bp-18h]@10 | |
6445 int v70; // [sp+2Ch] [bp-14h]@10 | |
6446 int X; // [sp+30h] [bp-10h]@10 | |
6447 int v72; // [sp+34h] [bp-Ch]@10 | |
6448 int v73; // [sp+38h] [bp-8h]@10 | |
6449 int v74; // [sp+3Ch] [bp-4h]@10 | |
6450 | |
6451 v1 = &pIndoor->pFaces[uFaceID]; | |
6452 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
6453 v3 = v1->uBitmapID; | |
6454 v4 = v1->uBitmapID; | |
6455 v68 = v2; | |
6456 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
6457 v6 = 8 * uFaceID; | |
6458 LOBYTE(v6) = 8 * uFaceID | 6; | |
6459 stru_F8AD28.field_0 = v6; | |
6460 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
6461 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
6462 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
6463 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
6464 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
6465 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
6466 v7 = GetTickCount(); | |
6467 v8 = v1->uAttributes; | |
6468 v9 = v7 >> 3; | |
6469 if ( v8 & 4 ) | |
6470 { | |
6471 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
6472 } | |
6473 else | |
6474 { | |
6475 if ( v8 & 0x20 ) | |
6476 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
6477 } | |
6478 v10 = v1->uAttributes; | |
6479 if ( BYTE1(v10) & 8 ) | |
6480 { | |
6481 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
6482 } | |
6483 else | |
6484 { | |
6485 if ( v10 & 0x40 ) | |
6486 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
6487 } | |
6488 v1->_get_normals(&v67, &v66); | |
6489 stru_F8AD28.vec_14.x = v67.x; | |
6490 stru_F8AD28.vec_14.y = v67.y; | |
6491 stru_F8AD28.vec_14.z = v67.z; | |
6492 stru_F8AD28.vec_20.x = v66.x; | |
6493 stru_F8AD28.vec_20.y = v66.y; | |
6494 stru_F8AD28.vec_20.z = v66.z; | |
6495 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
6496 if ( pBLVRenderParams->sPartyRotX ) | |
6497 { | |
6498 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6499 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
6500 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6501 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
6502 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6503 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6504 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6505 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6506 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6507 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6508 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6509 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6510 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
6511 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6512 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6513 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6514 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6515 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6516 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6517 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6518 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
6519 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6520 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
6521 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6522 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6523 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6524 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6525 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6526 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6527 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6528 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6529 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6530 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6531 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6532 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6533 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
6534 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
6535 v13 = pBLVRenderParams->vPartyPos.y; | |
6536 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6537 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6538 v14 = pBLVRenderParams->vPartyPos.x; | |
6539 } | |
6540 else | |
6541 { | |
6542 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6543 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6544 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6545 - v70; | |
6546 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6547 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6548 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6549 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6550 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6551 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6552 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6553 - v70; | |
6554 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6555 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6556 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6557 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6558 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6559 - v70; | |
6560 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
6561 v14 = pBLVRenderParams->vPartyPos.x; | |
6562 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6563 v13 = pBLVRenderParams->vPartyPos.y; | |
6564 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6565 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6566 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6567 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6568 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6569 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6570 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6571 } | |
6572 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6573 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
6574 + stru_F8AD28.plane_4.dist | |
6575 + stru_F8AD28.plane_4.vNormal.y * v13 | |
6576 + stru_F8AD28.plane_4.vNormal.x * v14; | |
6577 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6578 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6579 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6580 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6581 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6582 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6583 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6584 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6585 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
6586 v15 = v70; | |
6587 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
6588 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6589 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
6590 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6591 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6592 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
6593 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
6594 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
6595 stru_F8AD28.field_38 = 0; | |
6596 stru_F8AD28.field_A8 = -(X | |
6597 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
6598 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
6599 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
6600 { | |
6601 stru_F8AD28.field_3E4 = 1; | |
6602 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
6603 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
6604 stru_F8AD28.field_3F0 = v68->field_1E; | |
6605 stru_F8AD28.field_3F4 = v68->field_20; | |
6606 } | |
6607 else | |
6608 { | |
6609 stru_F8AD28.field_3E4 = 0; | |
6610 } | |
6611 v16 = 0.0039215689; | |
6612 v17 = 116 * v1->uSectorID; | |
6613 v69 = v17; | |
6614 v74 = 0; | |
6615 v73 = 0; | |
6616 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
6617 v70 = pMobileLightsStack->uNumLightsActive; | |
6618 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
6619 { | |
6620 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
6621 do | |
6622 { | |
6623 if ( v74 >= 20 ) | |
6624 break; | |
6625 v19 = *((short *)v18 + 2); | |
6626 v20 = *((short *)v18 - 1); | |
6627 if ( v20 > v1->pBounding.x1 - v19 ) | |
6628 { | |
6629 if ( v20 < v19 + v1->pBounding.x2 ) | |
6630 { | |
6631 v21 = *(short *)v18; | |
6632 if ( v21 > v1->pBounding.y1 - v19 ) | |
6633 { | |
6634 if ( v21 < v19 + v1->pBounding.y2 ) | |
6635 { | |
6636 v22 = *((short *)v18 + 1); | |
6637 if ( v22 > v1->pBounding.z1 - v19 ) | |
6638 { | |
6639 if ( v22 < v19 + v1->pBounding.z2 ) | |
6640 { | |
6641 X = (v1->pFacePlane_old.dist | |
6642 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
6643 + v21 * v1->pFacePlane_old.vNormal.y | |
6644 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
6645 if ( X <= v19 ) | |
6646 { | |
6647 v23 = X; | |
6648 v24 = v74; | |
6649 stru_F8AD28._blv_lights_radii[v74] = v19; | |
6650 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
6651 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
6652 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
6653 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
6654 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
6655 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
6656 v25 = (double)(signed int)v68 * v16; | |
6657 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
6658 v26 = (unsigned __int8)v18[8]; | |
6659 *(float *)(v24 * 4 + 16297992) = v25; | |
6660 v27 = (double)(signed int)v68; | |
6661 v68 = (BLVFaceExtra *)v26; | |
6662 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
6663 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
6664 v16 = 0.0039215689; | |
6665 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
6666 v28 = v74; | |
6667 v29 = v18[9]; | |
6668 ++v74; | |
6669 stru_F8AD28._blv_lights_types[v28] = v29; | |
6670 } | |
6671 } | |
6672 } | |
6673 } | |
6674 } | |
6675 } | |
6676 } | |
6677 ++v73; | |
6678 v18 += 18; | |
6679 v17 = v69; | |
6680 } | |
6681 while ( v73 < v70 ); | |
6682 } | |
6683 v30 = 0; | |
6684 v73 = 0; | |
6685 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
6686 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
6687 if ( v31 > 0 ) | |
6688 { | |
6689 while ( v74 < 20 ) | |
6690 { | |
6691 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
6692 if ( !(v32->uAtributes & 8) ) | |
6693 { | |
6694 v33 = v1->pBounding.x1; | |
6695 v34 = v32->vPosition.x; | |
6696 X = v32->uBrightness; | |
6697 v35 = v32->uRadius; | |
6698 v68 = (BLVFaceExtra *)v32->uRadius; | |
6699 if ( v34 > v33 - v35 ) | |
6700 { | |
6701 if ( v34 < v35 + v1->pBounding.x2 ) | |
6702 { | |
6703 v36 = v32->vPosition.y; | |
6704 if ( v36 > v1->pBounding.y1 - v35 ) | |
6705 { | |
6706 if ( v36 < v35 + v1->pBounding.y2 ) | |
6707 { | |
6708 v37 = v32->vPosition.z; | |
6709 if ( v37 > v1->pBounding.z1 - v35 ) | |
6710 { | |
6711 if ( v37 < v35 + v1->pBounding.z2 ) | |
6712 { | |
6713 v38 = (v1->pFacePlane_old.dist | |
6714 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
6715 + v37 * v1->pFacePlane_old.vNormal.z | |
6716 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
6717 if ( v38 >= 0 ) | |
6718 { | |
6719 if ( v38 <= v35 && v35 ) | |
6720 { | |
6721 v39 = v74; | |
6722 stru_F8AD28._blv_lights_radii[v74] = v35; | |
6723 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
6724 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
6725 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
6726 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
6727 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
6728 v68 = (BLVFaceExtra *)v32->uRed; | |
6729 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
6730 v68 = (BLVFaceExtra *)v32->uGreen; | |
6731 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
6732 v68 = (BLVFaceExtra *)v32->uBlue; | |
6733 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
6734 v16 = 0.0039215689; | |
6735 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
6736 v40 = v74++; | |
6737 stru_F8AD28._blv_lights_types[v40] = 1; | |
6738 } | |
6739 } | |
6740 } | |
6741 } | |
6742 } | |
6743 } | |
6744 } | |
6745 } | |
6746 } | |
6747 v30 = v73++ + 1; | |
6748 if ( v73 >= v70 ) | |
6749 break; | |
6750 v17 = v69; | |
6751 } | |
6752 } | |
6753 v73 = 0; | |
6754 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
6755 { | |
6756 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
6757 do | |
6758 { | |
6759 if ( v74 >= 20 ) | |
6760 break; | |
6761 v42 = *((short *)v41 + 2); | |
6762 v43 = *((short *)v41 - 1); | |
6763 if ( v43 > v1->pBounding.x1 - v42 ) | |
6764 { | |
6765 if ( v43 < v42 + v1->pBounding.x2 ) | |
6766 { | |
6767 v44 = *(short *)v41; | |
6768 if ( v44 > v1->pBounding.y1 - v42 ) | |
6769 { | |
6770 if ( v44 < v42 + v1->pBounding.y2 ) | |
6771 { | |
6772 v45 = *((short *)v41 + 1); | |
6773 if ( v45 > v1->pBounding.z1 - v42 ) | |
6774 { | |
6775 if ( v45 < v42 + v1->pBounding.z2 ) | |
6776 { | |
6777 v46 = (v1->pFacePlane_old.dist | |
6778 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
6779 + v43 * v1->pFacePlane_old.vNormal.x | |
6780 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
6781 v69 = v46; | |
6782 if ( v46 >= 0 ) | |
6783 { | |
6784 if ( v46 <= v42 ) | |
6785 { | |
6786 v47 = v69; | |
6787 v48 = v74; | |
6788 stru_F8AD28._blv_lights_radii[v74] = v42; | |
6789 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
6790 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
6791 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
6792 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
6793 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
6794 v49 = (double)(signed int)v68 * v16; | |
6795 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
6796 v50 = (unsigned __int8)v41[8]; | |
6797 stru_F8AD28._blv_lights_rs[v48] = v49; | |
6798 v51 = (double)(signed int)v68; | |
6799 v68 = (BLVFaceExtra *)v50; | |
6800 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
6801 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
6802 v16 = 0.0039215689; | |
6803 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
6804 v52 = v74++; | |
6805 stru_F8AD28._blv_lights_types[v52] = 1; | |
6806 } | |
6807 } | |
6808 } | |
6809 } | |
6810 } | |
6811 } | |
6812 } | |
6813 } | |
6814 ++v73; | |
6815 v41 += 12; | |
6816 } | |
6817 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
6818 } | |
6819 stru_F8AD28.uNumLightsApplied = v74; | |
6820 v53 = v1->pBounding.x2; | |
6821 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
6822 { | |
6823 v55 = v1->pBounding.x1; | |
6824 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
6825 v54 = 0; | |
6826 else | |
6827 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
6828 } | |
6829 else | |
6830 { | |
6831 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
6832 } | |
6833 v56 = v1->pBounding.y2; | |
6834 v57 = v54 * v54; | |
6835 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
6836 { | |
6837 v59 = v1->pBounding.y1; | |
6838 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
6839 v58 = 0; | |
6840 else | |
6841 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
6842 } | |
6843 else | |
6844 { | |
6845 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
6846 } | |
6847 v60 = v58 * v58 + v57; | |
6848 v61 = v1->pBounding.z2; | |
6849 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
6850 { | |
6851 v63 = v1->pBounding.z1; | |
6852 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
6853 v62 = 0; | |
6854 else | |
6855 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
6856 } | |
6857 else | |
6858 { | |
6859 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
6860 } | |
6861 v64 = v62 * v62 + v60; | |
6862 if ( v64 ) | |
295 | 6863 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 6864 else |
6865 stru_F8AD28.field_34 = 0; | |
6866 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
6867 v65 = (double)(signed int)v68; | |
6868 if ( v65 >= 655.36 ) | |
6869 { | |
6870 if ( v65 >= 26214.4 ) | |
6871 { | |
6872 if ( v65 >= 45875.2 ) | |
6873 { | |
6874 stru_F8AD28.field_44 = 8; | |
6875 stru_F8AD28.field_48 = 3; | |
6876 } | |
6877 else | |
6878 { | |
6879 stru_F8AD28.field_44 = 16; | |
6880 stru_F8AD28.field_48 = 4; | |
6881 } | |
6882 } | |
6883 else | |
6884 { | |
6885 stru_F8AD28.field_44 = 32; | |
6886 stru_F8AD28.field_48 = 5; | |
6887 } | |
6888 } | |
6889 else | |
6890 { | |
6891 stru_F8AD28.field_44 = 64; | |
6892 stru_F8AD28.field_48 = 6; | |
6893 } | |
6894 } | |
6895 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
6896 | |
6897 //----- (004AF412) -------------------------------------------------------- | |
6898 int __cdecl sub_4AF412() | |
6899 { | |
6900 int v0; // ST20_4@2 | |
6901 int v1; // ST20_4@2 | |
6902 int v2; // ST20_4@2 | |
6903 int v3; // esi@2 | |
6904 int v4; // ST20_4@2 | |
6905 int v5; // ecx@2 | |
6906 int v6; // ebx@2 | |
6907 int v7; // edi@2 | |
6908 int v8; // edx@2 | |
6909 int v9; // eax@2 | |
6910 int result; // eax@4 | |
6911 | |
6912 stru_F8AD28.plane_4.vNormal.z = -65536; | |
6913 stru_F8AD28.vec_20.y = -65536; | |
6914 stru_F8AD28.plane_4.vNormal.x = 0; | |
6915 stru_F8AD28.plane_4.vNormal.y = 0; | |
6916 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
6917 stru_F8AD28.vec_14.x = 65536; | |
6918 stru_F8AD28.vec_14.y = 0; | |
6919 stru_F8AD28.vec_14.z = 0; | |
6920 stru_F8AD28.vec_20.x = 0; | |
6921 stru_F8AD28.vec_20.z = 0; | |
6922 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
6923 if ( pBLVRenderParams->sPartyRotX ) | |
6924 { | |
6925 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6926 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6927 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6928 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6929 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6930 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6931 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6932 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6933 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6934 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6935 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6936 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6937 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6938 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6939 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6940 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6941 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6942 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6943 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6944 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6945 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6946 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6947 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6948 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6949 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6950 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6951 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6952 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6953 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6954 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6955 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6956 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6957 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6958 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6959 v6 = pBLVRenderParams->vPartyPos.z; | |
6960 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6961 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6962 v8 = pBLVRenderParams->vPartyPos.y; | |
6963 v9 = pBLVRenderParams->vPartyPos.x; | |
6964 } | |
6965 else | |
6966 { | |
6967 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6968 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6969 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6970 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6971 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6972 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6973 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6974 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6975 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6976 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6977 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6978 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6979 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6980 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6981 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6982 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6983 v8 = pBLVRenderParams->vPartyPos.y; | |
6984 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6985 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6986 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6987 v9 = pBLVRenderParams->vPartyPos.x; | |
6988 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6989 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6990 v6 = pBLVRenderParams->vPartyPos.z; | |
6991 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6992 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6993 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6994 } | |
6995 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6996 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6997 + stru_F8AD28.plane_4.dist | |
6998 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6999 + stru_F8AD28.plane_4.vNormal.z * v6; | |
7000 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
7001 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
7002 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
7003 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
7004 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
7005 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
7006 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
7007 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
7008 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
7009 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
7010 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
7011 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
7012 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
7013 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
7014 result = 0; | |
7015 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
7016 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
7017 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
7018 stru_F8AD28.field_38 = 0; | |
7019 stru_F8AD28.field_3E4 = 0; | |
7020 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
7021 stru_F8AD28.uNumLightsApplied = 0; | |
7022 stru_F8AD28.field_34 = 0; | |
7023 return result; | |
7024 } | |
7025 | |
7026 | |
7027 | |
7028 | |
7029 | |
7030 | |
7031 //----- (004B1447) -------------------------------------------------------- | |
7032 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
7033 { | |
7034 signed int v3; // esi@1 | |
7035 char v4; // sf@8 | |
7036 int v5; // eax@8 | |
7037 unsigned __int64 v6; // qax@12 | |
7038 DDM_DLV_Header *v7; // eax@14 | |
7039 Player **v8; // edi@18 | |
7040 Player *result; // eax@19 | |
735 | 7041 //char *v10; // esi@20 |
0 | 7042 |
7043 v3 = 0; | |
7044 if ( a2 ) | |
7045 { | |
7046 if ( a2 != 1 ) | |
7047 { | |
7048 if ( a2 == 2 ) | |
7049 v3 = 2; | |
7050 goto LABEL_13; | |
7051 } | |
7052 v3 = 2; | |
7053 } | |
7054 else | |
7055 { | |
7056 v3 = 1; | |
7057 } | |
7058 if ( pParty->uFine < 4000000 ) | |
7059 { | |
7060 v4 = a3 + pParty->uFine < 0; | |
7061 v5 = a3 + pParty->uFine; | |
7062 pParty->uFine += a3; | |
7063 if ( v4 ) | |
7064 { | |
7065 v5 = 0; | |
7066 pParty->uFine = 0; | |
7067 } | |
7068 if ( v5 > 4000000 ) | |
7069 pParty->uFine = 4000000; | |
7070 } | |
487 | 7071 |
7072 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
7073 | |
0 | 7074 LABEL_13: |
463 | 7075 pParty->InTheShopFlags[a1] = 1; |
0 | 7076 if ( v3 ) |
7077 { | |
7078 v7 = &pOutdoor->ddm; | |
7079 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7080 v7 = &pIndoor->dlv; | |
7081 v7->uReputation += v3; | |
7082 if ( v7->uReputation > 10000 ) | |
7083 v7->uReputation = 10000; | |
7084 } | |
7085 v8 = &pPlayers[1]; | |
7086 do | |
7087 { | |
7088 result = *v8; | |
7089 if ( pParty->uFine ) | |
7090 { | |
735 | 7091 //v10 = result->_guilds_member_bits; |
484 | 7092 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 7093 if ( !(short)result ) |
735 | 7094 __debugbreak(); |
501 | 7095 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 7096 } |
7097 ++v8; | |
7098 } | |
7099 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
7100 return result; | |
7101 } | |
7102 | |
7103 //----- (004B1523) -------------------------------------------------------- | |
7104 char *__thiscall sub_4B1523(int *_this) | |
7105 { | |
7106 int v1; // esi@1 | |
7107 int v2; // edx@1 | |
7108 unsigned int v3; // eax@2 | |
7109 int v4; // eax@4 | |
7110 LONG v5; // ecx@4 | |
7111 int v6; // eax@10 | |
7112 char *v7; // ST44_4@12 | |
7113 unsigned __int16 v8; // ax@12 | |
7114 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
7115 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
7116 POINT a2; // [sp+64h] [bp-10h]@1 | |
7117 int v13; // [sp+6Ch] [bp-8h]@4 | |
7118 int v14; // [sp+70h] [bp-4h]@4 | |
7119 | |
7120 v1 = *_this - 399; | |
7121 v2 = (*_this - 400) % 11 + 1; | |
7122 v11 = 4 * (*_this - 400) / 11; | |
7123 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
7124 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
7125 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
7126 else | |
7127 v3 = 30; | |
7128 a1.Hint = 0; | |
7129 a1.uFrameY = v3; | |
7130 a1.uFrameWidth = 328; | |
7131 a1.uFrameHeight = 68; | |
7132 a1.uFrameX = 90; | |
7133 a1.uFrameZ = 417; | |
7134 a1.uFrameW = v3 + 67; | |
7135 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
7136 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
7137 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
7138 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
7139 v5 = a2.y; | |
7140 if ( v14 > a2.y ) | |
7141 v5 = v14; | |
7142 if ( v13 > v5 ) | |
7143 v5 = v13; | |
7144 if ( v4 > v5 ) | |
7145 v5 = v4; | |
262 | 7146 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", |
7147 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
7148 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
7149 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
7150 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
7151 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 7152 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
7153 a1.uFrameHeight += v6; | |
7154 if ( (signed int)a1.uFrameHeight < 150 ) | |
7155 a1.uFrameHeight = 150; | |
7156 a1.uFrameWidth = 460; | |
7157 a1.DrawMessageBox(0); | |
7158 a1.uFrameWidth -= 12; | |
7159 a1.uFrameHeight -= 12; | |
7160 v7 = pSpellStats->pInfos[v1].pName; | |
7161 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
7162 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
7163 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7164 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
7165 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
7166 a1.uFrameZ = a1.uFrameX + 107; | |
7167 a1.uFrameWidth = 108; | |
7168 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
7169 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
262 | 7170 return a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 7171 } |
7172 | |
7173 | |
7174 //----- (004B1784) -------------------------------------------------------- | |
7175 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
7176 { | |
7177 Player *pPlayer; // ebx@1 | |
7178 bool result; // eax@2 | |
7179 unsigned __int16 v2; // ST0C_2@3 | |
7180 int v3; // eax@3 | |
7181 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
7182 | |
7183 pPlayer = pPlayers[uActiveCharacter]; | |
7184 if ( pPlayer->CanAct() ) | |
7185 { | |
7186 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
7187 result = 1; | |
7188 } | |
7189 else | |
7190 { | |
7191 pDialogueWindow->pNumPresenceButton = 0; | |
7192 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
7193 v4.uFrameX = 483; | |
7194 v4.uFrameWidth = 148; | |
7195 v4.uFrameZ = 334; | |
7196 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
7197 // "%s is in no condition to %s" | |
7198 // "do anything" | |
7199 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7200 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); | |
7201 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
7202 result = 0; | |
7203 } | |
7204 return result; | |
7205 } | |
7206 // F8B1E0: using guessed type int dword_F8B1E0; | |
7207 | |
7208 | |
463 | 7209 //view item details in shop? |
0 | 7210 //----- (004B1A2D) -------------------------------------------------------- |
7211 void __cdecl sub_4B1A2D() | |
7212 { | |
358 | 7213 //Player *v0; // edi@1 |
0 | 7214 POINT *v1; // esi@5 |
7215 unsigned int v2; // eax@5 | |
7216 int v3; // ecx@5 | |
7217 POINT *v4; // esi@12 | |
7218 int v5; // eax@12 | |
7219 unsigned int v6; // eax@13 | |
7220 ItemGen *v7; // ecx@13 | |
7221 signed int v8; // esi@17 | |
7222 unsigned int v9; // eax@19 | |
475 | 7223 POINT v10; // [sp+8h] [bp-44h]@12 |
7224 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
7225 POINT v12; // [sp+18h] [bp-34h]@18 | |
7226 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
7227 POINT v14; // [sp+28h] [bp-24h]@17 | |
7228 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
7229 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 7230 POINT a2; // [sp+40h] [bp-Ch]@5 |
7231 int v18; // [sp+48h] [bp-4h]@5 | |
7232 | |
358 | 7233 //v0 = pPlayers[uActiveCharacter]; |
484 | 7234 if ( in_current_building_type <= 0 ) |
0 | 7235 return; |
484 | 7236 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 7237 { |
607 | 7238 if ( dialog_menu_id != 2 ) |
7239 { | |
7240 if ( dialog_menu_id <= 2 ) | |
0 | 7241 return; |
607 | 7242 if ( dialog_menu_id <= 5 || dialog_menu_id == 94 ) |
0 | 7243 { |
475 | 7244 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
7245 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
7246 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
7247 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 7248 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 7249 return; |
358 | 7250 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 7251 LABEL_15: |
7252 GameUI_DrawItemInfo(v7); | |
7253 return; | |
7254 } | |
607 | 7255 if ( dialog_menu_id != 95 ) |
0 | 7256 return; |
7257 } | |
475 | 7258 v4 = pMouse->GetCursorPos(&v11); |
7259 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 7260 v18 = v5; |
7261 if ( !v5 ) | |
7262 return; | |
336 | 7263 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 7264 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
607 | 7265 if ( dialog_menu_id != 2 ) |
439 | 7266 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 7267 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 7268 goto LABEL_15; |
7269 } | |
607 | 7270 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == BildingType_18 ) |
0 | 7271 { |
7272 v1 = pMouse->GetCursorPos(&a2); | |
475 | 7273 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 7274 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
7275 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
7276 if ( v18 ) | |
336 | 7277 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 7278 } |
7279 } | |
7280 // F8B198: using guessed type int dword_F8B198; | |
7281 // F8B19C: using guessed type int dword_F8B19C; | |
7282 | |
7283 //----- (004B1BDB) -------------------------------------------------------- | |
7284 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
7285 { | |
7286 signed __int64 v1; // ST2C_8@1 | |
7287 signed __int64 v2; // qax@1 | |
7288 signed __int64 v3; // ST1C_8@1 | |
7289 unsigned __int64 v4; // qax@1 | |
7290 unsigned int v5; // ebx@1 | |
112 | 7291 Player *v6; // ebx@1 |
0 | 7292 |
7293 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
7294 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
7295 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
7296 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
7297 v2 = v1 / 60 / 60; | |
7298 v3 = v2; | |
7299 v4 = (unsigned int)v2 / 0x18; | |
7300 v5 = (unsigned int)(v4 / 7) >> 2; | |
7301 pParty->uCurrentTimeSecond = v1 % 60; | |
7302 pParty->uCurrentMinute = v1 / 60 % 60; | |
7303 pParty->uCurrentHour = v3 % 24; | |
7304 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
7305 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
7306 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 7307 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 7308 pParty->RestAndHeal(); |
7309 dword_507B94 = 1; | |
112 | 7310 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 7311 do |
7312 { | |
112 | 7313 v6->uTimeToRecovery = 0; |
7314 memset(&v6->uTimeToRecovery, 0, 4u); | |
7315 ++v6; | |
7316 } | |
7317 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 7318 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 7319 } |
7320 // 507B94: using guessed type int dword_507B94; | |
7321 | |
7322 //----- (004B1D27) -------------------------------------------------------- | |
7323 void __cdecl sub_4B1D27() | |
7324 { | |
7325 int v0; // edx@2 | |
7326 unsigned int v1; // ecx@7 | |
7327 signed int v2; // edi@10 | |
7328 int v3; // esi@10 | |
7329 __int16 v4; // ax@15 | |
7330 signed int v5; // edi@20 | |
7331 int v6; // esi@20 | |
7332 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
7333 | |
484 | 7334 if ( in_current_building_type > 0 ) |
0 | 7335 { |
7336 v0 = 3; | |
484 | 7337 if ( in_current_building_type > BildingType_MagicShop ) |
7338 { | |
7339 if ( in_current_building_type == BildingType_Bank ) | |
0 | 7340 { |
7341 if ( !dword_F8B1E4 ) | |
7342 return; | |
7343 } | |
7344 else | |
7345 { | |
484 | 7346 if ( in_current_building_type != BildingType_Temple ) |
0 | 7347 return; |
7348 } | |
336 | 7349 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 7350 LABEL_28: |
735 | 7351 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 7352 return; |
7353 } | |
336 | 7354 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 7355 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 7356 { |
7357 if ( pParty->uNumGold <= 0x2710 ) | |
7358 { | |
7359 if ( !dword_F8B1E4 ) | |
7360 return; | |
7361 v0 = 4; | |
7362 goto LABEL_28; | |
7363 } | |
735 | 7364 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 7365 if ( !dword_F8B1E4 && !qword_A750D8 ) |
7366 { | |
7367 v5 = 0; | |
7368 v6 = 1; | |
7369 do | |
7370 { | |
7371 if ( pPlayers[v6]->CanAct() ) | |
7372 v7[v5++] = v6; | |
7373 ++v6; | |
7374 } | |
7375 while ( v6 <= 4 ); | |
7376 if ( v5 ) | |
7377 { | |
7378 qword_A750D8 = 256i64; | |
7379 word_A750E0 = 80; | |
7380 v4 = LOWORD(v7[rand() % v5]); | |
7381 goto LABEL_16; | |
7382 } | |
7383 } | |
7384 } | |
7385 else | |
7386 { | |
7387 if ( !qword_A750D8 ) | |
7388 { | |
7389 v2 = 0; | |
7390 v3 = 1; | |
7391 do | |
7392 { | |
7393 if ( pPlayers[v3]->CanAct() ) | |
7394 v7[v2++] = v3; | |
7395 ++v3; | |
7396 } | |
7397 while ( v3 <= 4 ); | |
7398 if ( v2 ) | |
7399 { | |
7400 qword_A750D8 = 256i64; | |
7401 word_A750E0 = 80; | |
7402 v4 = LOWORD(v7[rand() % v2]); | |
7403 LABEL_16: | |
7404 word_A750E2 = v4; | |
7405 return; | |
7406 } | |
7407 } | |
7408 } | |
7409 } | |
7410 } | |
7411 | |
629 | 7412 |
0 | 7413 |
7414 //----- (004B1ECE) -------------------------------------------------------- | |
7415 void __cdecl sub_4B1ECE() | |
7416 { | |
7417 __int16 *v0; // edi@1 | |
7418 int v1; // ebx@3 | |
7419 Player *v2; // esi@3 | |
7420 int v3; // eax@4 | |
7421 signed int v4; // eax@9 | |
7422 int v5; // ebx@11 | |
89 | 7423 Player *v6; // esi@13 |
7424 ItemGen *v7; // eax@14 | |
0 | 7425 signed int v8; // edi@14 |
89 | 7426 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 7427 signed int v10; // [sp+10h] [bp-8h]@13 |
7428 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 7429 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 7430 |
484 | 7431 contract_approved = 0; |
0 | 7432 v11 = 0; |
7433 uDialogueType = 84; | |
7434 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
7435 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; | |
7436 while ( 1 ) | |
7437 { | |
484 | 7438 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 7439 { |
7440 v1 = 0; | |
7441 v2 = pParty->pPlayers; | |
7442 do | |
7443 { | |
89 | 7444 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 7445 if ( v3 ) |
7446 break; | |
7447 ++v2; | |
7448 ++v1; | |
7449 } | |
7450 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
7451 if ( v1 == 4 ) | |
7452 break; | |
7453 } | |
7454 ++v11; | |
7455 v0 += 2; | |
89 | 7456 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
7457 break; | |
7458 } | |
7459 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
7460 { | |
651 | 7461 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 7462 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 7463 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 7464 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
7465 } | |
484 | 7466 if ( contract_approved == 601 ) |
0 | 7467 { |
7468 v5 = 0; | |
89 | 7469 v12 = pParty->pPlayers;//[0].uClass; |
0 | 7470 v9 = 0; |
7471 while ( 1 ) | |
7472 { | |
135 | 7473 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 7474 { |
7475 v10 = 0; | |
89 | 7476 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 7477 do |
7478 { | |
89 | 7479 v7 = v6->pInventoryItems; |
0 | 7480 v8 = 138; |
7481 do | |
7482 { | |
89 | 7483 if ( v7->uItemID == 601 ) |
0 | 7484 { |
377 | 7485 if ( !v7->uHolderPlayer ) |
89 | 7486 v9 = v7; |
377 | 7487 if ( v7->uHolderPlayer == v5 ) |
0 | 7488 v10 = 1; |
7489 } | |
89 | 7490 ++v7; |
0 | 7491 --v8; |
7492 } | |
7493 while ( v8 ); | |
89 | 7494 ++v6; |
7495 } | |
7496 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 7497 if ( !v10 ) |
7498 break; | |
7499 } | |
89 | 7500 ++v12; |
0 | 7501 ++v5; |
89 | 7502 if ( v12 > &pParty->pPlayers[3] ) |
0 | 7503 return; |
7504 } | |
7505 if ( v9 ) | |
377 | 7506 v9->uHolderPlayer = v5; |
0 | 7507 } |
7508 } | |
503 | 7509 |
0 | 7510 // 4F08EC: using guessed type int dword_4F08EC[]; |
7511 // 722B3C: using guessed type int dword_722B3C; | |
7512 // 722B44: using guessed type int dword_722B44; | |
7513 // F8B1A8: using guessed type int dword_F8B1A8; | |
7514 | |
7515 //----- (004B2001) -------------------------------------------------------- | |
459 | 7516 void __fastcall ClickNPCTopic(signed int uMessageParam) |
7517 { | |
7518 //signed int v1; // eax@1 | |
7519 NPCData *pCurrentNPCInfo; // ebp@1 | |
7520 int pEventNumber; // ecx@8 | |
0 | 7521 Player *v4; // esi@20 |
467 | 7522 //int v5; // eax@28 |
7523 //int v6; // eax@31 | |
7524 //int v7; // eax@34 | |
7525 //int v8; // eax@37 | |
7526 //int v9; // eax@40 | |
7527 //unsigned int v10; // eax@43 | |
0 | 7528 char *v12; // eax@53 |
7529 char *v13; // eax@56 | |
7530 char *v14; // eax@57 | |
7531 char *v15; // eax@58 | |
467 | 7532 //unsigned int v16; // ebp@62 |
0 | 7533 char *v17; // ecx@63 |
7534 char *v18; // eax@65 | |
7535 const char *v19; // ecx@68 | |
248 | 7536 //unsigned int v20; // eax@69 |
467 | 7537 signed int pPrice; // ecx@70 |
0 | 7538 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 7539 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 7540 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 7541 //int v25; // [sp-4h] [bp-10h]@49 |
7542 | |
459 | 7543 uDialogueType = uMessageParam + 1; |
7544 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 7545 if ( uMessageParam <= 24 ) |
460 | 7546 { |
459 | 7547 switch ( uMessageParam ) |
7548 { | |
7549 case 13: | |
7550 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
7551 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 7552 NPCHireableDialogPrepare(); |
459 | 7553 dialogue_show_profession_details = false; |
7554 goto _return; | |
7555 case 19: | |
7556 pEventNumber = pCurrentNPCInfo->evt_A; | |
7557 break; | |
7558 case 20: | |
7559 pEventNumber = pCurrentNPCInfo->evt_B; | |
7560 break; | |
7561 case 21: | |
7562 pEventNumber = pCurrentNPCInfo->evt_C; | |
7563 break; | |
7564 case 22: | |
7565 pEventNumber = pCurrentNPCInfo->evt_D; | |
7566 break; | |
7567 case 23: | |
7568 pEventNumber = pCurrentNPCInfo->evt_E; | |
7569 break; | |
7570 case 24: | |
7571 pEventNumber = pCurrentNPCInfo->evt_F; | |
7572 break; | |
7573 default: | |
467 | 7574 goto _return; |
7575 } | |
7576 /*switch ( pEventNumber ) | |
7577 { | |
7578 case 139: | |
7579 sub_4B1ECE(); | |
7580 goto _return; | |
7581 case 311: | |
7582 sub_4BBA85_bounties(); | |
7583 goto _return; | |
7584 }*/ | |
459 | 7585 if ( pEventNumber < 200 || pEventNumber > 310 ) |
7586 { | |
7587 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
7588 { | |
7589 if ( pEventNumber == 139 ) | |
0 | 7590 { |
7591 sub_4B1ECE(); | |
7592 } | |
7593 else | |
7594 { | |
459 | 7595 if ( pEventNumber == 311 ) |
0 | 7596 { |
7597 sub_4BBA85_bounties(); | |
7598 } | |
7599 else | |
7600 { | |
7601 ptr_F8B1E8 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7602 activeLevelDecoration = (LevelDecoration*)1; |
459 | 7603 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7604 activeLevelDecoration = NULL; |
0 | 7605 } |
7606 } | |
7607 } | |
7608 else | |
7609 { | |
459 | 7610 dword_F8B1D8 = uMessageParam; |
7611 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 7612 } |
7613 } | |
7614 else | |
7615 { | |
459 | 7616 sub_4B3FE5(pEventNumber); |
0 | 7617 } |
7618 goto _return; | |
460 | 7619 } |
459 | 7620 if ( uMessageParam != 76 ) |
7621 { | |
7622 if ( uMessageParam == 77 ) | |
7623 { | |
467 | 7624 //v16 = pCurrentNPCInfo->uProfession; |
248 | 7625 if (dialogue_show_profession_details) |
459 | 7626 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 7627 else |
459 | 7628 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
0 | 7629 ptr_F8B1E8 = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
7630 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 7631 dialogue_show_profession_details = ~dialogue_show_profession_details; |
0 | 7632 ptr_F8B1E8 = v18; |
7633 } | |
7634 else | |
7635 { | |
459 | 7636 if ( uMessageParam == 79 ) |
0 | 7637 { |
484 | 7638 if ( contract_approved ) |
0 | 7639 { |
267 | 7640 Party::TakeGold(gold_transaction_amount); |
0 | 7641 if ( uActiveCharacter ) |
7642 { | |
492 | 7643 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7644 *(short *)v12 &= 0x3Fu; |
7645 switch ( dword_F8B1B0 ) | |
7646 { | |
7647 case 2: | |
492 | 7648 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7649 *v15 |= 0x40u; |
7650 break; | |
7651 case 3: | |
492 | 7652 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7653 *v14 |= 0x80u; |
7654 break; | |
7655 case 4: | |
492 | 7656 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 7657 v13[1] |= 1u; |
7658 break; | |
7659 } | |
187 | 7660 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 7661 } |
437 | 7662 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
7663 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7664 { |
7665 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7666 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7667 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7668 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7669 }*/ |
0 | 7670 } |
7671 } | |
7672 else | |
7673 { | |
492 | 7674 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 7675 { |
267 | 7676 Party::TakeGold(gold_transaction_amount); |
0 | 7677 v4 = pParty->pPlayers; |
7678 do | |
7679 { | |
492 | 7680 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 7681 ++v4; |
7682 } | |
7683 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
7684 switch ( dword_F8B1D8 ) | |
7685 { | |
7686 case 19: | |
467 | 7687 pEventNumber = pCurrentNPCInfo->evt_A; |
7688 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7689 pCurrentNPCInfo->evt_A = 0; |
0 | 7690 break; |
7691 case 20: | |
467 | 7692 pEventNumber = pCurrentNPCInfo->evt_B; |
7693 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7694 pCurrentNPCInfo->evt_B = 0; |
0 | 7695 break; |
7696 case 21: | |
467 | 7697 pEventNumber = pCurrentNPCInfo->evt_C; |
7698 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7699 pCurrentNPCInfo->evt_C = 0; |
0 | 7700 break; |
7701 case 22: | |
467 | 7702 pEventNumber = pCurrentNPCInfo->evt_D; |
7703 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7704 pCurrentNPCInfo->evt_D = 0; |
0 | 7705 break; |
7706 case 23: | |
467 | 7707 pEventNumber = pCurrentNPCInfo->evt_E; |
7708 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 7709 pCurrentNPCInfo->evt_E = 0; |
0 | 7710 break; |
7711 case 24: | |
467 | 7712 pEventNumber = pCurrentNPCInfo->evt_F; |
7713 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
7714 pCurrentNPCInfo->evt_F = 0; | |
0 | 7715 break; |
7716 } | |
437 | 7717 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
7718 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7719 { |
7720 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7721 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7722 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7723 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7724 }*/ |
467 | 7725 //v11 = uActiveCharacter; |
0 | 7726 if ( uActiveCharacter ) |
7727 { | |
467 | 7728 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 7729 goto _return; |
7730 } | |
7731 } | |
7732 } | |
7733 } | |
7734 goto _return; | |
7735 } | |
7736 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7737 { | |
467 | 7738 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 7739 goto _return; |
7740 } | |
459 | 7741 if ( pCurrentNPCInfo->uProfession != 51 ) |
7742 { | |
467 | 7743 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
7744 if ( pParty->uNumGold < pPrice ) | |
7745 { | |
7746 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 7747 dialogue_show_profession_details = false; |
0 | 7748 uDialogueType = 13; |
459 | 7749 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
7750 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); |
0 | 7751 if ( uActiveCharacter ) |
248 | 7752 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 7753 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
7754 goto _return; | |
7755 } | |
7756 Party::TakeGold(pPrice); | |
0 | 7757 } |
147 | 7758 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 7759 pCurrentNPCInfo->uFlags |= 128; |
0 | 7760 pParty->field_709 = 0; |
659 | 7761 Party__CountHirelings(); |
0 | 7762 if ( pParty->pHirelings[0].pName ) |
7763 { | |
459 | 7764 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
7765 v24 = pCurrentNPCInfo->pName; | |
0 | 7766 v22 = pParty->pHireling2Name; |
7767 } | |
7768 else | |
7769 { | |
459 | 7770 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
7771 v24 = pCurrentNPCInfo->pName; | |
0 | 7772 v22 = pParty->pHireling1Name; |
7773 } | |
7774 strcpy(v22, v24); | |
7775 pParty->field_709 = 0; | |
659 | 7776 Party__CountHirelings(); |
480 | 7777 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
607 | 7778 dialog_menu_id = 1; |
437 | 7779 |
7780 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7781 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 7782 { |
7783 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7784 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
7785 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7786 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7787 }*/ |
0 | 7788 if ( uActiveCharacter ) |
467 | 7789 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 7790 _return: |
460 | 7791 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 7792 } |
7793 | |
7794 | |
7795 //----- (004B254D) -------------------------------------------------------- | |
7796 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
7797 { | |
7798 Player *v1; // esi@1 | |
7799 int v2; // edx@1 | |
7800 int v3; // ecx@1 | |
7801 int v4; // edi@1 | |
7802 int v5; // eax@7 | |
7803 int v6; // eax@7 | |
7804 int v7; // ebx@7 | |
7805 int v8; // ebx@8 | |
7806 signed int v9; // esi@8 | |
7807 int v10; // eax@8 | |
7808 char *v11; // ecx@8 | |
7809 int v12; // edi@9 | |
7810 char *v13; // edx@9 | |
7811 signed int v14; // edi@10 | |
7812 unsigned int v16; // eax@29 | |
7813 int v17; // eax@36 | |
7814 char v18; // cl@46 | |
7815 __int16 v19; // dx@56 | |
7816 int v20; // eax@60 | |
7817 char *v21; // [sp-Ch] [bp-38h]@82 | |
7818 const char *v22; // [sp-8h] [bp-34h]@21 | |
7819 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
7820 char *v24; // [sp-8h] [bp-34h]@82 | |
7821 char *v25; // [sp-4h] [bp-30h]@14 | |
7822 int v26; // [sp-4h] [bp-30h]@38 | |
7823 int v27; // [sp-4h] [bp-30h]@82 | |
7824 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
7825 int v29; // [sp+10h] [bp-1Ch]@13 | |
7826 int v30; // [sp+14h] [bp-18h]@15 | |
7827 int v31; // [sp+18h] [bp-14h]@16 | |
7828 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
7829 int v33; // [sp+20h] [bp-Ch]@7 | |
7830 int v34; // [sp+24h] [bp-8h]@7 | |
7831 char *v35; // [sp+28h] [bp-4h]@1 | |
7832 | |
7833 v1 = pPlayers[uActiveCharacter]; | |
484 | 7834 contract_approved = 0; |
0 | 7835 v2 = (_this - 200) % 3; |
7836 v3 = (_this - 200) / 3; | |
7837 v4 = v2; | |
7838 v35 = (char *)pNPCTopics[127].pText; | |
492 | 7839 dword_F8B1AC_award_bit_number = v3; |
0 | 7840 if ( v2 ) |
7841 { | |
7842 if ( v2 == 1 ) | |
7843 { | |
267 | 7844 gold_transaction_amount = 5000; |
0 | 7845 dword_F8B1B0 = 3; |
7846 } | |
7847 else | |
7848 { | |
7849 if ( v2 == 2 ) | |
7850 { | |
267 | 7851 gold_transaction_amount = 8000; |
0 | 7852 dword_F8B1B0 = 4; |
7853 } | |
7854 } | |
7855 } | |
7856 else | |
7857 { | |
267 | 7858 gold_transaction_amount = 2000; |
0 | 7859 dword_F8B1B0 = 2; |
7860 } | |
135 | 7861 v5 = v1->classType; |
0 | 7862 v33 = v5; |
7863 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
7864 *(int *)a1 = v1->pActiveSkills[v3]; | |
7865 v7 = a1[0] & 0x3F; | |
7866 v34 = v2 + 2; | |
7867 if ( v6 < v2 + 2 ) | |
7868 { | |
7869 v8 = v33; | |
7870 v9 = 0; | |
7871 v10 = v33 - v33 % 4; | |
7872 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
7873 do | |
7874 { | |
7875 v12 = (unsigned __int8)*v11; | |
7876 v13 = &v28[4 * v9]; | |
7877 *(int *)v13 = 0; | |
7878 if ( v12 < v34 ) | |
7879 { | |
7880 v14 = 1; | |
7881 } | |
7882 else | |
7883 { | |
7884 v14 = 1; | |
7885 *(int *)v13 = 1; | |
7886 } | |
7887 ++v9; | |
7888 v11 += 37; | |
7889 } | |
7890 while ( v9 < 4 ); | |
7891 if ( v29 == v14 ) | |
7892 { | |
7893 v25 = pClassNames[v10 + 1]; | |
7894 } | |
7895 else | |
7896 { | |
7897 if ( v30 == v14 ) | |
7898 { | |
7899 if ( v31 == v14 ) | |
7900 { | |
7901 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
7902 return pTmpBuf; | |
7903 } | |
7904 v25 = pClassNames[v10 + 2]; | |
7905 } | |
7906 else | |
7907 { | |
7908 if ( v31 != v14 ) | |
7909 { | |
7910 v25 = pClassNames[v8]; | |
7911 v22 = pGlobalTXT_LocalizationStrings[632]; | |
7912 goto LABEL_23; | |
7913 } | |
7914 v25 = pClassNames[v10 + 3]; | |
7915 } | |
7916 } | |
7917 v22 = pGlobalTXT_LocalizationStrings[633]; | |
7918 LABEL_23: | |
7919 sprintf(pTmpBuf, v22, v25); | |
7920 return pTmpBuf; | |
7921 } | |
7922 if ( !v1->CanAct() ) | |
7923 return (char *)pNPCTopics[122].pText; | |
7924 if ( !v7 ) | |
7925 return (char *)pNPCTopics[131].pText; | |
7926 v16 = SkillToMastery(a1[0]); | |
7927 if ( (signed int)v16 > v4 + 1 ) | |
7928 return (char *)pNPCTopics[v4 + 128].pText; | |
7929 if ( v34 != 2 ) | |
7930 { | |
7931 if ( v34 == 3 ) | |
7932 { | |
7933 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
7934 { | |
492 | 7935 v17 = dword_F8B1AC_award_bit_number; |
7936 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7937 { |
7938 default: | |
7939 goto LABEL_41; | |
7940 case 12: | |
7941 case 13: | |
7942 case 14: | |
7943 case 15: | |
7944 case 16: | |
7945 case 17: | |
7946 case 18: | |
267 | 7947 gold_transaction_amount = 4000; |
0 | 7948 goto LABEL_42; |
7949 case 19: | |
7950 v19 = 114; | |
7951 goto LABEL_57; | |
7952 case 20: | |
7953 v19 = 110; | |
7954 LABEL_57: | |
484 | 7955 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7956 return v35; |
7957 goto LABEL_40; | |
7958 case 22: | |
7959 v20 = v1->GetBaseWillpower(); | |
7960 goto LABEL_61; | |
7961 case 24: | |
267 | 7962 gold_transaction_amount = 2500; |
0 | 7963 v20 = v1->GetBaseEndurance(); |
7964 goto LABEL_61; | |
7965 case 36: | |
7966 v20 = v1->GetBaseIntelligence(); | |
7967 LABEL_61: | |
7968 if ( v20 < 50 ) | |
7969 return v35; | |
7970 goto LABEL_40; | |
7971 case 21: | |
7972 case 23: | |
7973 case 25: | |
7974 case 26: | |
7975 case 29: | |
7976 case 32: | |
7977 case 34: | |
7978 case 35: | |
267 | 7979 gold_transaction_amount = 2500; |
0 | 7980 goto LABEL_42; |
7981 case 8: | |
7982 case 9: | |
7983 case 10: | |
7984 case 11: | |
267 | 7985 gold_transaction_amount = 3000; |
0 | 7986 goto LABEL_42; |
7987 case 7: | |
7988 goto LABEL_67; | |
7989 } | |
7990 goto LABEL_67; | |
7991 } | |
7992 } | |
7993 else | |
7994 { | |
7995 if ( v34 != 4 ) | |
7996 { | |
7997 LABEL_40: | |
492 | 7998 v17 = dword_F8B1AC_award_bit_number; |
0 | 7999 goto LABEL_41; |
8000 } | |
8001 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
8002 { | |
492 | 8003 v17 = dword_F8B1AC_award_bit_number; |
8004 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 8005 { |
8006 case 19: | |
8007 if ( v1->_49327B(0x22u, 1) == 1 ) | |
8008 goto LABEL_40; | |
8009 v26 = 1; | |
8010 v23 = 26; | |
8011 goto LABEL_39; | |
8012 default: | |
8013 goto LABEL_41; | |
8014 case 20: | |
8015 if ( v1->_49327B(0x23u, 1) == 1 ) | |
8016 goto LABEL_40; | |
8017 v26 = 1; | |
8018 v23 = 27; | |
8019 LABEL_39: | |
8020 if ( v1->_49327B(v23, v26) == 1 ) | |
8021 goto LABEL_40; | |
8022 return v35; | |
8023 case 30: | |
8024 v18 = LOBYTE(v1->pActiveSkills[31]); | |
8025 goto LABEL_47; | |
8026 case 31: | |
8027 v18 = LOBYTE(v1->pActiveSkills[30]); | |
8028 LABEL_47: | |
8029 if ( (v18 & 0x3Fu) < 0xA ) | |
8030 return v35; | |
8031 goto LABEL_41; | |
8032 case 21: | |
8033 case 23: | |
8034 case 24: | |
8035 case 25: | |
8036 case 26: | |
8037 case 29: | |
8038 case 32: | |
8039 case 34: | |
8040 case 35: | |
267 | 8041 gold_transaction_amount = 6000; |
0 | 8042 goto LABEL_42; |
8043 case 8: | |
8044 case 9: | |
8045 case 10: | |
8046 case 11: | |
267 | 8047 gold_transaction_amount = 7000; |
0 | 8048 goto LABEL_42; |
8049 case 7: | |
8050 break; | |
8051 } | |
8052 LABEL_67: | |
267 | 8053 gold_transaction_amount = 0; |
0 | 8054 goto LABEL_41; |
8055 } | |
8056 } | |
8057 return v35; | |
8058 } | |
8059 if ( v7 < 4 ) | |
8060 return v35; | |
492 | 8061 v17 = dword_F8B1AC_award_bit_number; |
8062 if ( dword_F8B1AC_award_bit_number > 27 ) | |
8063 { | |
8064 if ( dword_F8B1AC_award_bit_number != 29 | |
8065 && dword_F8B1AC_award_bit_number != 32 | |
8066 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 8067 { |
8068 LABEL_41: | |
267 | 8069 if ( !gold_transaction_amount ) |
0 | 8070 goto LABEL_79; |
8071 goto LABEL_42; | |
8072 } | |
8073 LABEL_87: | |
267 | 8074 gold_transaction_amount = 500; |
0 | 8075 goto LABEL_41; |
8076 } | |
492 | 8077 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 8078 goto LABEL_87; |
492 | 8079 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 8080 { |
267 | 8081 gold_transaction_amount = 0; |
0 | 8082 goto LABEL_79; |
8083 } | |
492 | 8084 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 8085 goto LABEL_41; |
492 | 8086 if ( dword_F8B1AC_award_bit_number > 18 ) |
8087 { | |
8088 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 8089 goto LABEL_41; |
8090 goto LABEL_87; | |
8091 } | |
267 | 8092 gold_transaction_amount = 1000; |
0 | 8093 LABEL_42: |
267 | 8094 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 8095 return (char *)pNPCTopics[124].pText; |
8096 LABEL_79: | |
484 | 8097 contract_approved = 1; |
0 | 8098 if ( v34 == 2 ) |
8099 { | |
267 | 8100 v27 = gold_transaction_amount; |
0 | 8101 v24 = pSkillNames[v17]; |
8102 v21 = pGlobalTXT_LocalizationStrings[433]; | |
8103 goto LABEL_90; | |
8104 } | |
8105 if ( v34 == 3 ) | |
8106 { | |
267 | 8107 v27 = gold_transaction_amount; |
0 | 8108 v24 = pSkillNames[v17]; |
8109 v21 = pGlobalTXT_LocalizationStrings[432]; | |
8110 goto LABEL_90; | |
8111 } | |
8112 if ( v34 == 4 ) | |
8113 { | |
267 | 8114 v27 = gold_transaction_amount; |
0 | 8115 v24 = pSkillNames[v17]; |
8116 v21 = pGlobalTXT_LocalizationStrings[225]; | |
8117 LABEL_90: | |
8118 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); | |
8119 } | |
8120 return pTmpBuf2; | |
8121 } | |
8122 | |
8123 | |
8124 | |
8125 //----- (004B29F2) -------------------------------------------------------- | |
492 | 8126 const char * ContractSelectText( int pEventCode ) |
8127 { | |
8128 static const int dialogue_base=110; | |
484 | 8129 contract_approved = 0; |
492 | 8130 dword_F8B1AC_award_bit_number = pEventCode + 50; |
8131 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 8132 if ( pPlayers[uActiveCharacter]->CanAct() ) |
8133 { | |
492 | 8134 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
8135 { | |
8136 return pNPCTopics[dialogue_base+13].pText; | |
0 | 8137 } |
8138 else | |
8139 { | |
267 | 8140 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 8141 { |
484 | 8142 contract_approved = 1; |
492 | 8143 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 8144 } |
8145 else | |
8146 { | |
492 | 8147 return pNPCTopics[dialogue_base+14].pText; |
0 | 8148 } |
8149 } | |
8150 } | |
8151 else | |
8152 { | |
492 | 8153 return pNPCTopics[dialogue_base+12].pText; |
0 | 8154 } |
8155 } | |
8156 | |
8157 | |
8158 //----- (004B2A74) -------------------------------------------------------- | |
459 | 8159 char __cdecl SimpleHouseAndBoatsDialog() |
0 | 8160 { |
8161 char *v0; // esi@3 | |
8162 char *v1; // ST1C_4@3 | |
8163 char *v2; // eax@3 | |
8164 const char *v3; // ST1C_4@5 | |
8165 int v4; // eax@5 | |
8166 unsigned int i; // eax@5 | |
8167 NPCData *v6; // esi@6 | |
8168 unsigned __int16 v7; // bx@6 | |
8169 unsigned int v8; // eax@6 | |
8170 int v9; // eax@11 | |
8171 unsigned int v10; // ecx@12 | |
8172 int v11; // eax@12 | |
8173 int v12; // esi@12 | |
8174 char *v13; // eax@12 | |
8175 GUIWindow *v14; // ebx@13 | |
8176 char *v15; // esi@14 | |
8177 GUIButton *v16; // eax@15 | |
8178 unsigned int v17; // ecx@15 | |
8179 int v18; // ecx@17 | |
8180 int v19; // ecx@18 | |
8181 int v20; // ecx@19 | |
8182 int v21; // ecx@20 | |
8183 int v22; // ecx@21 | |
8184 unsigned int v23; // ecx@23 | |
8185 int v24; // ecx@35 | |
8186 int v25; // ecx@36 | |
8187 int v26; // ecx@37 | |
8188 int v27; // ecx@38 | |
8189 int v28; // ecx@39 | |
8190 char *v29; // esi@42 | |
8191 unsigned int v30; // ST20_4@42 | |
8192 int v31; // ST1C_4@42 | |
8193 unsigned int v32; // eax@42 | |
8194 char *v33; // eax@43 | |
8195 int v34; // esi@51 | |
8196 int v35; // eax@51 | |
8197 unsigned int v36; // edi@51 | |
8198 GUIButton *v37; // eax@52 | |
8199 int v38; // eax@52 | |
8200 signed int v39; // ecx@54 | |
8201 int v40; // edi@57 | |
8202 GUIButton *v41; // eax@60 | |
8203 GUIButton *v42; // esi@60 | |
8204 const char *v43; // ebx@60 | |
8205 int v44; // eax@60 | |
8206 unsigned int v45; // ecx@60 | |
8207 unsigned __int16 v46; // ax@60 | |
8208 GUIFont *v47; // ebx@64 | |
8209 int v48; // esi@64 | |
8210 char *v49; // eax@66 | |
8211 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
8212 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
8213 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
8214 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
8215 int v55; // [sp+10Ch] [bp-10h]@6 | |
8216 int v56; // [sp+110h] [bp-Ch]@13 | |
8217 char *pInString; // [sp+114h] [bp-8h]@12 | |
8218 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
8219 | |
8220 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 8221 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 8222 { |
8223 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
8224 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
8225 a1.uFrameX = 493; | |
8226 a1.uFrameWidth = 126; | |
8227 a1.uFrameZ = 366; | |
8228 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
8229 a1.uFrameX = 483; | |
8230 a1.uFrameWidth = 148; | |
8231 a1.uFrameZ = 334; | |
434 | 8232 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 8233 if ( !v2 ) |
8234 { | |
721 | 8235 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 8236 v2 = pTmpBuf; |
8237 } | |
8238 v3 = v2; | |
8239 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
8240 LOBYTE(i) = (unsigned int)a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); | |
8241 return i; | |
8242 } | |
8243 a1.uFrameWidth -= 10; | |
8244 a1.uFrameZ -= 10; | |
459 | 8245 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 8246 v6 = v58; |
8247 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
8248 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
8249 v8 = v6->uProfession; | |
8250 if ( v8 ) | |
264 | 8251 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 8252 else |
8253 strcpy(pTmpBuf, v6->pName); | |
8254 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
8255 if ( !dword_591080 ) | |
8256 { | |
8257 if ( !uDialogueType ) | |
8258 { | |
8259 v9 = v6->greet; | |
8260 if ( v9 ) | |
8261 { | |
8262 v10 = v6->uFlags; | |
8263 a1.uFrameWidth = 460; | |
8264 a1.uFrameZ = 452; | |
8265 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
8266 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
8267 v12 = v11 + 7; | |
8268 pRenderer->_4A6A68( | |
8269 8u, | |
8270 352 - (v11 + 7), | |
8271 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
8272 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
8273 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
8274 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
8275 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
8276 } | |
8277 } | |
8278 } | |
8279 v14 = pDialogueWindow; | |
8280 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
8281 v52.uFrameX = 483; | |
8282 v52.uFrameWidth = 148; | |
8283 v52.uFrameZ = 334; | |
8284 v56 = v52.pStartingPosActiveItem; | |
8285 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
8286 { | |
348 | 8287 v15 = "";//(char *)v54; |
0 | 8288 while ( 1 ) |
8289 { | |
8290 v16 = v52.GetControl(v56); | |
8291 v17 = v16->uControlParam; | |
8292 pInString = (char *)v16; | |
8293 if ( (signed int)v17 > 24 ) | |
8294 { | |
8295 v24 = v17 - 76; | |
8296 if ( !v24 ) | |
8297 { | |
8298 v15 = pGlobalTXT_LocalizationStrings[406]; | |
8299 goto LABEL_49; | |
8300 } | |
8301 v25 = v24 - 1; | |
8302 if ( !v25 ) | |
8303 { | |
8304 v15 = pGlobalTXT_LocalizationStrings[407]; | |
8305 goto LABEL_49; | |
8306 } | |
8307 v26 = v25 - 2; | |
8308 if ( !v26 ) | |
8309 { | |
8310 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
8311 LABEL_44: | |
8312 v15 = v33; | |
8313 LABEL_45: | |
8314 v16 = (GUIButton *)pInString; | |
8315 goto LABEL_49; | |
8316 } | |
8317 v27 = v26 - 3; | |
8318 if ( !v27 ) | |
8319 { | |
459 | 8320 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 8321 goto LABEL_44; |
8322 } | |
8323 v28 = v27 - 1; | |
8324 if ( !v28 ) | |
8325 { | |
8326 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
8327 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8328 v31 = *(int *)v29; | |
8329 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8330 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
8331 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
8332 ptr_F8B1E8 = pTmpBuf2; | |
8333 v15 = ""; | |
8334 goto LABEL_45; | |
8335 } | |
8336 if ( v28 != 10 ) | |
8337 goto LABEL_41; | |
8338 } | |
8339 else | |
8340 { | |
8341 if ( v17 == 24 ) | |
8342 { | |
291 | 8343 v23 = v58->evt_F; |
0 | 8344 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
8345 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 8346 if ( !v15 ) |
8347 { | |
8348 v16->uControlParam = 0; | |
8349 v15 = ""; | |
8350 } | |
8351 goto LABEL_49; | |
8352 } | |
8353 v18 = v17 - 13; | |
8354 if ( v18 ) | |
8355 { | |
8356 v19 = v18 - 6; | |
8357 if ( !v19 ) | |
8358 { | |
291 | 8359 v23 = v58->evt_A; |
0 | 8360 goto LABEL_33; |
8361 } | |
8362 v20 = v19 - 1; | |
8363 if ( !v20 ) | |
8364 { | |
291 | 8365 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 8366 if ( !v15 ) |
8367 { | |
8368 v16->uControlParam = 0; | |
8369 v15 = ""; | |
8370 } | |
8371 if ( uDialogueType != 84 ) | |
8372 goto LABEL_49; | |
484 | 8373 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 8374 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
8375 ptr_F8B1E8 = pTmpBuf2; | |
8376 goto LABEL_45; | |
8377 } | |
8378 v21 = v20 - 1; | |
8379 if ( !v21 ) | |
8380 { | |
291 | 8381 v23 = v58->evt_C; |
0 | 8382 goto LABEL_33; |
8383 } | |
8384 v22 = v21 - 1; | |
8385 if ( !v22 ) | |
8386 { | |
291 | 8387 v23 = v58->evt_D; |
0 | 8388 goto LABEL_33; |
8389 } | |
8390 if ( v22 == 1 ) | |
8391 { | |
291 | 8392 v23 = v58->evt_E; |
0 | 8393 goto LABEL_33; |
8394 } | |
8395 LABEL_41: | |
8396 v15 = ""; | |
8397 goto LABEL_49; | |
8398 } | |
8399 v15 = pGlobalTXT_LocalizationStrings[122]; | |
8400 } | |
8401 LABEL_49: | |
8402 strcpy(v16->pButtonName, v15); | |
8403 ++v56; | |
8404 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
8405 { | |
8406 v14 = pDialogueWindow; | |
8407 break; | |
8408 } | |
8409 } | |
8410 } | |
8411 v34 = 0; | |
8412 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8413 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
8414 v36 = v14->pStartingPosActiveItem; | |
8415 v55 = v35; | |
8416 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
8417 + pDialogueWindow->pStartingPosActiveItem ) | |
8418 { | |
8419 v37 = v14->GetControl(v36); | |
8420 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
8421 v14 = pDialogueWindow; | |
8422 v34 += v38; | |
8423 ++v36; | |
8424 } | |
8425 v39 = v14->pNumPresenceButton; | |
8426 if ( v39 ) | |
8427 { | |
8428 v58 = (NPCData *)((174 - v34) / v39); | |
8429 if ( (signed int)v58 > 32 ) | |
8430 v58 = (NPCData *)32; | |
8431 pInString = (char *)2; | |
8432 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
8433 v56 = v14->pStartingPosActiveItem; | |
8434 i = v56; | |
8435 if ( (signed int)i < (signed int)(i + v39) ) | |
8436 { | |
8437 while ( 1 ) | |
8438 { | |
8439 v41 = v14->GetControl(i); | |
8440 v42 = v41; | |
8441 v43 = v41->pButtonName; | |
8442 v41->uY = (unsigned int)((char *)v58 + v40); | |
8443 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
8444 v45 = v42->uY; | |
8445 v42->uHeight = v44; | |
8446 v40 = v45 + v44 - 1; | |
8447 v42->uW = v40; | |
8448 v46 = v55; | |
8449 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
8450 v46 = v54; | |
8451 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
8452 v14 = pDialogueWindow; | |
8453 ++pInString; | |
8454 ++v56; | |
8455 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
8456 if ( v56 >= (signed int)i ) | |
8457 break; | |
8458 i = v56; | |
8459 } | |
8460 } | |
8461 } | |
8462 if ( ptr_F8B1E8 ) | |
8463 { | |
8464 w.uFrameWidth = 458; | |
8465 w.uFrameZ = 457; | |
8466 v47 = pFontArrus; | |
8467 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
8468 if ( 352 - v48 < 8 ) | |
8469 { | |
8470 v47 = pFontCreate; | |
8471 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
8472 } | |
8473 pRenderer->_4A6A68( | |
8474 8u, | |
8475 352 - v48, | |
8476 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
8477 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
8478 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
8479 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); | |
8480 LOBYTE(i) = a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); | |
8481 } | |
8482 return i; | |
8483 } | |
8484 | |
8485 | |
8486 | |
8487 | |
8488 | |
8489 //----- (004B36CC) -------------------------------------------------------- | |
473 | 8490 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
8491 { | |
8492 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); | |
0 | 8493 } |
8494 | |
8495 | |
8496 | |
8497 //----- (004B3A72) -------------------------------------------------------- | |
473 | 8498 void sub_4B3A72( int a1 ) |
8499 { | |
8500 int num_buttons; // esi@1 | |
8501 | |
8502 num_buttons = 0; | |
0 | 8503 if ( a1 == 21 ) |
8504 { | |
473 | 8505 CreateButtonInColumn(0, 0x66u); |
8506 num_buttons = 2; | |
8507 CreateButtonInColumn(1, 0x67u); | |
8508 if ( pParty->HasItem(651) ) //Arcomage Deck | |
8509 { | |
8510 num_buttons = 3; | |
8511 CreateButtonInColumn(2, 0x68u); | |
8512 } | |
8513 } | |
8514 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 8515 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8516 } | |
8517 // F8B1E0: using guessed type int dword_F8B1E0; | |
8518 | |
8519 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 8520 void sub_4B3AD4( signed int a1 ) |
8521 { | |
0 | 8522 if ( a1 > 0 ) |
8523 { | |
8524 if ( a1 <= 3 ) | |
8525 { | |
473 | 8526 CreateButtonInColumn(0, 3u); |
8527 CreateButtonInColumn(1, 4u); | |
8528 CreateButtonInColumn(2, 5u); | |
8529 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 8530 } |
8531 if ( a1 == 4 ) | |
8532 { | |
473 | 8533 CreateButtonInColumn(0, 3u); |
8534 CreateButtonInColumn(1, 4u); | |
8535 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
8536 } | |
8537 } | |
0 | 8538 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8539 } | |
8540 // F8B1E0: using guessed type int dword_F8B1E0; | |
8541 | |
8542 //----- (004B3B42) -------------------------------------------------------- | |
473 | 8543 void sub_4B3B42( signed int a1 ) |
8544 { | |
0 | 8545 int v1; // ecx@18 |
8546 int v2; // ecx@19 | |
8547 int v3; // ecx@20 | |
8548 signed int v4; // esi@22 | |
8549 signed int v5; // eax@22 | |
8550 unsigned int v6; // edx@24 | |
8551 int v7; // ecx@24 | |
8552 int result; // eax@43 | |
8553 int v9; // [sp-10h] [bp-14h]@28 | |
8554 int v10; // [sp-Ch] [bp-10h]@28 | |
8555 int v11; // [sp-8h] [bp-Ch]@28 | |
8556 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
8557 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
8558 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
8559 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
8560 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
8561 int v17; // [sp-4h] [bp-8h]@28 | |
8562 | |
8563 if ( a1 > 13 ) | |
8564 { | |
8565 if ( a1 > 22 ) | |
8566 { | |
8567 if ( a1 == 23 ) | |
8568 { | |
473 | 8569 CreateButtonInColumn(0, 0xAu); |
8570 CreateButtonInColumn(1, 0xBu); | |
0 | 8571 v14 = 96; |
8572 LABEL_41: | |
473 | 8573 CreateButtonInColumn(2, v14); |
0 | 8574 v17 = 2; |
8575 v11 = 0; | |
8576 v10 = 1; | |
8577 v9 = 3; | |
8578 goto LABEL_42; | |
8579 } | |
8580 if ( a1 <= 26 ) | |
8581 goto LABEL_43; | |
8582 if ( a1 > 28 ) | |
8583 { | |
8584 if ( a1 != 30 ) | |
8585 goto LABEL_43; | |
473 | 8586 CreateButtonInColumn(0, 0x11u); |
0 | 8587 v16 = 96; |
8588 goto LABEL_37; | |
8589 } | |
473 | 8590 CreateButtonInColumn(0, 0x69u); |
8591 CreateButtonInColumn(1, 0x6Au); | |
8592 CreateButtonInColumn(2, 0x6Bu); | |
0 | 8593 v12 = 108; |
8594 } | |
8595 else | |
8596 { | |
8597 if ( a1 == 22 ) | |
8598 { | |
473 | 8599 CreateButtonInColumn(0, 7u); |
0 | 8600 v16 = 8; |
8601 goto LABEL_37; | |
8602 } | |
8603 v1 = a1 - 14; | |
8604 if ( !v1 ) | |
8605 { | |
473 | 8606 CreateButtonInColumn(0, 0x12u); |
8607 CreateButtonInColumn(1, 0x30u); | |
8608 CreateButtonInColumn(2, 0x31u); | |
8609 CreateButtonInColumn(3, 0x32u); | |
8610 CreateButtonInColumn(4, 0x33u); | |
0 | 8611 v17 = 2; |
8612 v11 = 0; | |
8613 v10 = 1; | |
8614 v9 = 5; | |
8615 goto LABEL_42; | |
8616 } | |
8617 v2 = v1 - 1; | |
8618 if ( v2 ) | |
8619 { | |
8620 v3 = v2 - 2; | |
8621 if ( v3 ) | |
8622 { | |
8623 if ( v3 != 4 ) | |
8624 goto LABEL_43; | |
473 | 8625 CreateButtonInColumn(0, 0xFu); |
8626 CreateButtonInColumn(1, 0x10u); | |
0 | 8627 v4 = 3; |
473 | 8628 CreateButtonInColumn(2, 0x60u); |
336 | 8629 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 8630 if ( v5 < 108 || v5 > 120 ) |
8631 goto LABEL_28; | |
8632 v4 = 4; | |
8633 v6 = 101; | |
8634 v7 = 3; | |
8635 } | |
8636 else | |
8637 { | |
8638 v4 = 1; | |
473 | 8639 CreateButtonInColumn(0, 0x63u); |
0 | 8640 if ( !pParty->uFine ) |
8641 { | |
8642 LABEL_28: | |
8643 v17 = 2; | |
8644 v11 = 0; | |
8645 v10 = 1; | |
8646 v9 = v4; | |
8647 LABEL_42: | |
8648 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
8649 goto LABEL_43; | |
8650 } | |
8651 v4 = 2; | |
8652 v7 = 1; | |
8653 v6 = 100; | |
8654 } | |
473 | 8655 CreateButtonInColumn(v7, v6); |
0 | 8656 goto LABEL_28; |
8657 } | |
473 | 8658 CreateButtonInColumn(0, 0x12u); |
8659 CreateButtonInColumn(1, 0x34u); | |
8660 CreateButtonInColumn(2, 0x35u); | |
0 | 8661 v12 = 54; |
8662 } | |
8663 LABEL_39: | |
473 | 8664 CreateButtonInColumn(3, v12); |
0 | 8665 v17 = 2; |
8666 v11 = 0; | |
8667 v10 = 1; | |
8668 v9 = 4; | |
8669 goto LABEL_42; | |
8670 } | |
8671 if ( a1 == 13 ) | |
8672 { | |
473 | 8673 CreateButtonInColumn(0, 0x12u); |
0 | 8674 v16 = 56; |
8675 LABEL_37: | |
473 | 8676 CreateButtonInColumn(1, v16); |
0 | 8677 v17 = 2; |
8678 v11 = 0; | |
8679 v10 = 1; | |
8680 v9 = 2; | |
8681 goto LABEL_42; | |
8682 } | |
8683 switch ( a1 ) | |
8684 { | |
8685 case 1: | |
8686 case 2: | |
8687 case 3: | |
8688 case 4: | |
473 | 8689 CreateButtonInColumn(0, 2u); |
8690 CreateButtonInColumn(1, 0x5Fu); | |
8691 CreateButtonInColumn(2, 0x5Eu); | |
0 | 8692 v12 = 96; |
8693 goto LABEL_39; | |
8694 case 5: | |
473 | 8695 CreateButtonInColumn(0, 0x12u); |
0 | 8696 v13 = 48; |
8697 goto LABEL_9; | |
8698 case 6: | |
473 | 8699 CreateButtonInColumn(0, 0x12u); |
0 | 8700 v13 = 49; |
8701 goto LABEL_9; | |
8702 case 7: | |
473 | 8703 CreateButtonInColumn(0, 0x12u); |
0 | 8704 v13 = 50; |
8705 goto LABEL_9; | |
8706 case 8: | |
473 | 8707 CreateButtonInColumn(0, 0x12u); |
0 | 8708 v13 = 51; |
8709 LABEL_9: | |
473 | 8710 CreateButtonInColumn(1, v13); |
0 | 8711 v14 = 72; |
8712 goto LABEL_41; | |
8713 case 9: | |
473 | 8714 CreateButtonInColumn(0, 0x12u); |
0 | 8715 v15 = 52; |
8716 goto LABEL_13; | |
8717 case 10: | |
473 | 8718 CreateButtonInColumn(0, 0x12u); |
0 | 8719 v15 = 53; |
8720 goto LABEL_13; | |
8721 case 11: | |
473 | 8722 CreateButtonInColumn(0, 0x12u); |
0 | 8723 v15 = 54; |
8724 LABEL_13: | |
473 | 8725 CreateButtonInColumn(1, v15); |
0 | 8726 v14 = 61; |
8727 goto LABEL_41; | |
8728 case 12: | |
473 | 8729 CreateButtonInColumn(0, 0x12u); |
0 | 8730 v16 = 55; |
8731 goto LABEL_37; | |
8732 default: | |
8733 break; | |
8734 } | |
8735 LABEL_43: | |
8736 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
8737 } | |
8738 // F8B1E0: using guessed type int dword_F8B1E0; | |
8739 | |
8740 //----- (004B3E1E) -------------------------------------------------------- | |
8741 void __cdecl sub_4B3E1E() | |
8742 { | |
8743 NPCData *v0; // ST40_4@1 | |
8744 signed int v1; // edi@1 | |
165 | 8745 //GUIWindow *v2; // ecx@1 |
0 | 8746 |
167 | 8747 __debugbreak(); |
602 | 8748 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 8749 v1 = 0; |
8750 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
8751 pDialogueWindow->Release(); | |
165 | 8752 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 8753 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 8754 { |
165 | 8755 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 8756 v1 = 1; |
8757 } | |
165 | 8758 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 8759 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
8760 } | |
8761 | |
8762 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 8763 void DrawJoinGuildWindow( int pEventCode ) |
8764 { | |
467 | 8765 uDialogueType = 81;//enum JoinGuildDialog |
492 | 8766 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
8767 ContractSelectText(pEventCode); | |
0 | 8768 pDialogueWindow->Release(); |
492 | 8769 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 8770 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 8771 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8772 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8773 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); |
0 | 8774 pDialogueWindow->_41D08F(1, 1, 0, 2); |
607 | 8775 dialog_menu_id = -1; |
0 | 8776 } |
8777 // F8B19C: using guessed type int dword_F8B19C; | |
8778 | |
8779 //----- (004B3FE5) -------------------------------------------------------- | |
8780 void __fastcall sub_4B3FE5(int a4) | |
8781 { | |
8782 int v1; // edi@1 | |
8783 char *v2; // edi@1 | |
8784 | |
8785 v1 = a4; | |
8786 uDialogueType = 78; | |
8787 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
8788 _4B254D_SkillMasteryTeacher(a4); | |
8789 pDialogueWindow->Release(); | |
8790 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
8791 v2 = ""; | |
492 | 8792 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 8793 pGlobalTXT_LocalizationStrings[34], |
526 | 8794 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 8795 0); |
8796 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 8797 if ( contract_approved ) |
0 | 8798 v2 = pGlobalTXT_LocalizationStrings[535]; |
8799 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); | |
8800 pDialogueWindow->_41D08F(1, 1, 0, 2); | |
607 | 8801 dialog_menu_id = -1; |
0 | 8802 } |
8803 // F8B19C: using guessed type int dword_F8B19C; | |
8804 // F8B1A8: using guessed type int dword_F8B1A8; | |
8805 | |
8806 //----- (004B40E6) -------------------------------------------------------- | |
607 | 8807 void NPCHireableDialogPrepare() |
8808 { | |
0 | 8809 signed int v0; // ebx@1 |
8810 NPCData *v1; // edi@1 | |
8811 | |
8812 v0 = 0; | |
459 | 8813 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 8814 pDialogueWindow->Release(); |
8815 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
607 | 8816 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
8817 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 8818 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 8819 0); |
8820 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 8821 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 8822 { |
607 | 8823 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
8824 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 8825 v0 = 1; |
8826 } | |
607 | 8827 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
8828 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" | |
0 | 8829 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
607 | 8830 dialog_menu_id = -1; |
0 | 8831 } |
8832 | |
8833 | |
8834 //----- (004B4224) -------------------------------------------------------- | |
423 | 8835 void _4B4224_UpdateNPCTopics( int _this ) |
8836 { | |
8837 int num_menu_buttons; // ebx@1 | |
0 | 8838 int i; // ebp@5 |
423 | 8839 // signed int v4; // ebp@9 |
8840 int v6; // eax@16 | |
8841 int v8; // eax@21 | |
8842 int v10; // eax@26 | |
8843 int v12; // eax@31 | |
8844 int v14; // eax@36 | |
8845 int v16; // eax@41 | |
0 | 8846 NPCData *v17; // [sp+10h] [bp-4h]@4 |
8847 | |
423 | 8848 num_menu_buttons = 0; |
459 | 8849 pDialogueNPCCount = (_this + 1); |
0 | 8850 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
8851 { | |
8852 pDialogueWindow->Release(); | |
8853 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
423 | 8854 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
8855 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, | |
0 | 8856 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 8857 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 8858 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
8859 sHouseName, | |
8860 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 8861 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 8862 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); |
0 | 8863 } |
8864 else | |
8865 { | |
459 | 8866 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
607 | 8867 if ( dialog_menu_id == -1 ) |
0 | 8868 { |
8869 pDialogueWindow->Release(); | |
8870 } | |
8871 else | |
8872 { | |
8873 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 8874 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 8875 } |
8876 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
423 | 8877 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 8878 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 8879 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8880 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8881 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 8882 { |
484 | 8883 sub_4B3B42(in_current_building_type); |
0 | 8884 } |
8885 else | |
8886 { | |
8887 if ( v17->joins ) | |
8888 { | |
423 | 8889 num_menu_buttons = 1; |
0 | 8890 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); |
8891 } | |
423 | 8892 if ( v17->evt_A) |
8893 { | |
8894 if ( num_menu_buttons < 4 ) | |
8895 { | |
8896 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 8897 if ( v6 == 1 || v6 == 2 ) |
423 | 8898 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
8899 } | |
8900 } | |
8901 if ( v17->evt_B ) | |
8902 { | |
8903 if ( num_menu_buttons < 4 ) | |
8904 { | |
8905 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 8906 if ( v8 == 1 || v8 == 2 ) |
423 | 8907 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
8908 } | |
8909 } | |
8910 if ( v17->evt_C ) | |
8911 { | |
8912 if ( num_menu_buttons < 4 ) | |
8913 { | |
8914 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 8915 if ( v10 == 1 || v10 == 2 ) |
423 | 8916 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
8917 } | |
8918 } | |
8919 | |
8920 if ( v17->evt_D ) | |
8921 { | |
8922 if ( num_menu_buttons < 4 ) | |
8923 { | |
8924 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 8925 if ( v12 == 1 || v12 == 2 ) |
423 | 8926 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
8927 } | |
8928 } | |
8929 if ( v17->evt_E ) | |
8930 { | |
8931 if ( num_menu_buttons < 4 ) | |
8932 { | |
8933 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 8934 if ( v14 == 1 || v14 == 2 ) |
423 | 8935 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
8936 } | |
8937 } | |
8938 if ( v17->evt_F ) | |
8939 { | |
8940 if ( num_menu_buttons < 4 ) | |
8941 { | |
8942 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8943 if ( v16 == 1 || v16 == 2 ) |
423 | 8944 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
8945 } | |
8946 } | |
8947 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 8948 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8949 } | |
607 | 8950 dialog_menu_id = 1; |
423 | 8951 } |
8952 | |
0 | 8953 } |
8954 | |
8955 | |
8956 | |
8957 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8958 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8959 { |
0 | 8960 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8961 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8962 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8963 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8964 } |
8965 | |
8966 //----- (004B46F8) -------------------------------------------------------- | |
8967 int __fastcall sub_4B46F8(int a1) | |
8968 { | |
8969 int v1; // eax@1 | |
8970 int i; // edx@1 | |
8971 | |
8972 v1 = 0; | |
8973 for ( i = 0; i < a1; ++i ) | |
8974 v1 += i + 1; | |
8975 return 1000 * v1; | |
8976 } | |
8977 | |
8978 | |
8979 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8980 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8981 { |
656 | 8982 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8983 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8984 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8985 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8986 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8987 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8988 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8989 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8990 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8991 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8992 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8993 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8994 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8995 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8996 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8997 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8998 //v1 = _this; |
656 | 8999 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
9000 //v3 = v1; |
656 | 9001 uDialogueType = newDialogueType; |
9002 if (!speakingNPC->uFlags) | |
9003 { | |
9004 speakingNPC->uFlags = 1; | |
9005 //v3 = uDialogueType; | |
9006 } | |
9007 | |
9008 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
9009 { | |
9010 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
9011 } | |
9012 else if(newDialogueType == DIALOGUE_76) | |
9013 { | |
9014 if (speakingNPC->Hired()) | |
9015 { | |
9016 v8 = 0; | |
9017 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9018 { | |
9019 v6 = (char *)pNPCStats->pNewNPCData; | |
9020 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
9021 { | |
9022 ++v8; | |
9023 v6 += 76; | |
9024 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
9025 break; | |
9026 } | |
9027 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
9028 v6[8] &= 0x7Fu; | |
9029 } | |
9030 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
9031 { | |
9032 v11 = pParty->pHirelings; | |
9033 memset(v11, 0, sizeof(NPCData)); | |
9034 } | |
9035 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
9036 { | |
9037 v11 = &pParty->pHirelings[1]; | |
9038 memset(v11, 0, sizeof(NPCData)); | |
9039 } | |
9040 pParty->field_709 = 0; | |
659 | 9041 Party__CountHirelings(); |
656 | 9042 dword_591084 = 0; |
9043 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9044 dword_7241C8 = 0; | |
9045 return; | |
9046 } | |
9047 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
9048 { | |
9049 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
9050 ShowStatusBarString(v7, 2u); | |
9051 } | |
9052 else | |
9053 { | |
9054 //v9 = v2->uProfession; | |
9055 if ( speakingNPC->uProfession != 51 ) | |
9056 { | |
9057 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
9058 if ( pParty->uNumGold < v10 ) | |
9059 { | |
9060 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
9061 dialogue_show_profession_details = false; | |
9062 uDialogueType = 13; | |
9063 if ( uActiveCharacter ) | |
9064 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
9065 v7 = pGlobalTXT_LocalizationStrings[155]; | |
9066 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
9067 if ( !dword_7241C8 ) | |
9068 pGame->Draw(); | |
9069 dword_7241C8 = 0; | |
9070 return; | |
9071 } | |
9072 Party::TakeGold(v10); | |
9073 } | |
9074 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
9075 if ( pParty->pHirelings[0].pName ) | |
9076 { | |
9077 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
9078 v15 = speakingNPC->pName; | |
9079 v13 = pParty->pHireling2Name; | |
9080 } | |
9081 else | |
9082 { | |
9083 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
9084 v15 = speakingNPC->pName; | |
9085 v13 = pParty->pHireling1Name; | |
9086 } | |
9087 strcpy(v13, v15); | |
9088 pParty->field_709 = 0; | |
659 | 9089 Party__CountHirelings(); |
656 | 9090 |
9091 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9092 | |
711 | 9093 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 9094 pDialogue_SpeakingActor->uAIState = Removed; |
9095 if ( uActiveCharacter ) | |
9096 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
9097 } | |
9098 } | |
9099 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
9100 { | |
9101 ArenaFight(); | |
9102 return; | |
9103 } | |
9104 else if(newDialogueType == DIALOGUE_9) | |
9105 { | |
9106 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
9107 { | |
9108 if ( speakingNPC->uProfession != 41 ) | |
9109 speakingNPC->bHasUsedTheAbility = 1; | |
9110 | |
9111 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9112 } | |
9113 else | |
9114 { | |
9115 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
9116 } | |
9117 } | |
9118 else if(newDialogueType == DIALOGUE_13) | |
9119 { | |
9120 if (!speakingNPC->Hired()) | |
9121 { | |
9122 sub_4B3E1E(); | |
9123 dialogue_show_profession_details = false; | |
9124 } | |
9125 else | |
9126 { | |
9127 v5 = 0; | |
9128 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9129 { | |
9130 v6 = (char *)pNPCStats->pNewNPCData; | |
9131 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
9132 { | |
9133 ++v5; | |
9134 v6 += 76; | |
9135 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
9136 break; | |
9137 } | |
9138 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
9139 v6[8] &= 0x7Fu; | |
9140 } | |
9141 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
9142 { | |
9143 v11 = pParty->pHirelings; | |
9144 memset(v11, 0, sizeof(NPCData)); | |
9145 } | |
9146 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
9147 { | |
9148 v11 = &pParty->pHirelings[1]; | |
9149 memset(v11, 0, sizeof(NPCData)); | |
9150 } | |
9151 pParty->field_709 = 0; | |
659 | 9152 Party__CountHirelings(); |
656 | 9153 dword_591084 = 0; |
9154 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
9155 dword_7241C8 = 0; | |
9156 return; | |
9157 } | |
9158 } | |
9159 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
9160 { | |
9161 switch(newDialogueType) | |
9162 { | |
9163 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
9164 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
9165 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
9166 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
9167 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
9168 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
9169 } | |
9170 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
9171 sub_4B3FE5(npc_event_id); //200-310 | |
9172 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
9173 { //400-410 | |
9174 dword_F8B1D8 = newDialogueType; | |
9175 DrawJoinGuildWindow(npc_event_id - 400); | |
9176 } | |
9177 else | |
9178 { | |
9179 switch ( npc_event_id ) | |
9180 { | |
9181 case 139: | |
9182 sub_4B1ECE(); | |
9183 break; | |
9184 case 311: | |
9185 sub_4BBA85_bounties(); | |
9186 break; | |
9187 case 399: | |
9188 sub_4BBCDD(); | |
9189 break; | |
9190 default: | |
9191 activeLevelDecoration = (LevelDecoration*)1; | |
9192 ptr_F8B1E8 = 0; | |
9193 EventProcessor(npc_event_id, 0, 1); | |
9194 activeLevelDecoration = NULL; | |
9195 break; | |
9196 } | |
9197 } | |
9198 } | |
9199 if ( !dword_7241C8 ) | |
9200 pGame->Draw(); | |
9201 dword_7241C8 = 0; | |
9202 } | |
0 | 9203 |
9204 | |
9205 | |
9206 //----- (004BDAAF) -------------------------------------------------------- | |
9207 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
9208 { | |
9209 int v2; // edx@1 | |
9210 unsigned int v3; // esi@1 | |
9211 unsigned int v4; // eax@1 | |
9212 signed int v5; // edi@1 | |
9213 int v6; // edx@8 | |
9214 int v7; // edx@9 | |
9215 int v8; // edx@10 | |
9216 unsigned __int8 v9; // zf@16 | |
9217 char v10; // sf@16 | |
9218 unsigned __int8 v11; // of@16 | |
702 | 9219 bool test; |
0 | 9220 |
9221 auto a2 = _2da_idx; | |
9222 //v2 = p2DEvents_minus1___00[26 * a2]; | |
9223 v2 = p2DEvents[a2 - 1].uType; | |
9224 v3 = a1->uItemID; | |
9225 v4 = a1->uItemID; | |
9226 v5 = pItemsTable->pItems[v4].uEquipType; | |
9227 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 9228 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 9229 return 0; |
702 | 9230 switch( p2DEvents[a2 - 1].uType ) |
9231 { | |
9232 case BildingType_WeaponShop: | |
9233 { | |
9234 test = v5 <= 2; | |
9235 break; | |
9236 } | |
9237 case BildingType_ArmorShop: | |
9238 { | |
9239 test = v5 >= 3; | |
9240 break; | |
9241 } | |
9242 case BildingType_MagicShop: | |
9243 { | |
9244 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
9245 break; | |
9246 } | |
9247 case BildingType_AlchemistShop: | |
9248 { | |
9249 __debugbreak(); // need to test | |
9250 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
9251 break; | |
9252 } | |
9253 default: | |
9254 { | |
9255 test = 0; | |
9256 break; | |
9257 } | |
9258 } | |
9259 | |
9260 return test; | |
9261 /* | |
9262 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 9263 { |
9264 v11 = __OFSUB__(v5, 2); | |
9265 v9 = v5 == 2; | |
9266 v10 = v5 - 2 < 0; | |
9267 goto LABEL_23; | |
9268 } | |
702 | 9269 if ( p2DEvents[a2 - 1].uType > 2 ) |
9270 { | |
9271 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 9272 { |
9273 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
9274 return v5 == 16; | |
9275 return 1; | |
9276 } | |
702 | 9277 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 9278 return 0; |
702 | 9279 if ( p2DEvents[a2 - 1].uType == 4) |
9280 { | |
9281 if ( v5 < 13 ) | |
9282 return 0; | |
9283 if ( v5 <= 14 ) | |
9284 return 1; | |
9285 if ( v5 != 17 || (signed int)v3 < 740 ) | |
9286 return 0; | |
9287 v11 = __OFSUB__(v3, 771); | |
9288 v9 = v3 == 771; | |
9289 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 9290 LABEL_23: |
702 | 9291 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
9292 return 0; | |
9293 return 1; | |
9294 } | |
9295 } | |
9296 if ( p2DEvents[a2 - 1].uType == 2 ) | |
9297 { | |
9298 if ( v5 >= 3 ) | |
9299 { | |
9300 v11 = __OFSUB__(v5, 9); | |
9301 v9 = v5 == 9; | |
9302 v10 = v5 - 9 < 0; | |
9303 goto LABEL_23; | |
9304 } | |
0 | 9305 } |
9306 return 0; | |
702 | 9307 */ |
0 | 9308 } |
9309 | |
9310 | |
9311 | |
9312 | |
9313 //----- (004B6478) -------------------------------------------------------- | |
711 | 9314 void sub_4B6478() |
9315 { | |
0 | 9316 GUIWindow *v0; // ebx@1 |
9317 Player *v1; // edi@1 | |
9318 unsigned int v2; // eax@1 | |
9319 signed int v3; // esi@1 | |
9320 int v4; // ebx@1 | |
9321 unsigned int v5; // esi@5 | |
9322 int v6; // edi@6 | |
9323 int result; // eax@13 | |
9324 GUIWindow *v8; // ebx@17 | |
9325 int v9; // eax@17 | |
9326 int v10; // ecx@17 | |
9327 unsigned int v11; // ecx@18 | |
9328 int v12; // eax@20 | |
9329 int v13; // eax@21 | |
9330 GUIButton *v14; // esi@27 | |
9331 int v15; // ecx@27 | |
9332 unsigned int v16; // eax@28 | |
9333 const char *v17; // ebx@29 | |
9334 int v18; // eax@29 | |
9335 unsigned int v19; // ecx@29 | |
9336 int v20; // eax@29 | |
9337 unsigned __int16 v21; // ax@29 | |
9338 unsigned __int16 v22; // ST14_2@36 | |
9339 int v23; // eax@36 | |
9340 const char *v24; // ST18_4@37 | |
9341 unsigned __int16 v25; // ST14_2@37 | |
9342 int v26; // eax@37 | |
9343 int v27; // [sp-4h] [bp-80h]@8 | |
9344 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
9345 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
9346 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
9347 int v31; // [sp+68h] [bp-14h]@1 | |
9348 int v32; // [sp+6Ch] [bp-10h]@1 | |
9349 int v33; // [sp+70h] [bp-Ch]@17 | |
9350 int v34; // [sp+74h] [bp-8h]@17 | |
9351 int v35; // [sp+78h] [bp-4h]@17 | |
9352 | |
336 | 9353 v0 = window_SpeakInHouse; |
9354 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 9355 v1 = pPlayers[uActiveCharacter]; |
9356 v28.uFrameX = 483; | |
9357 v28.uFrameWidth = 148; | |
9358 v28.uFrameZ = 334; | |
9359 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
9360 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
9361 v2 = 52 * (unsigned int)v0->ptr_1C; | |
9362 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
9363 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
9364 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
9365 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
9366 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
9367 v32 = v4; | |
9368 if ( v4 < v3 / 3 ) | |
9369 { | |
9370 v4 = v3 / 3; | |
9371 v32 = v3 / 3; | |
9372 } | |
607 | 9373 if ( dialog_menu_id != 1 ) |
0 | 9374 { |
9375 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9376 { | |
9377 v5 = 0; | |
9378 | |
9379 __debugbreak(); | |
9380 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
9381 // or | |
9382 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
9383 // or | |
9384 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
9385 | |
9386 if (false | |
9387 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 9388 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 9389 { |
9390 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
9391 } | |
9392 else | |
9393 { | |
9394 if ( pParty->uNumGold < v4 ) | |
9395 { | |
9396 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
9397 v27 = 4; | |
9398 } | |
9399 else | |
9400 { | |
9401 Party::TakeGold(v4); | |
9402 *(short *)v6 = 1; | |
9403 v27 = 2; | |
9404 } | |
735 | 9405 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 9406 } |
9407 } | |
9408 else | |
9409 { | |
9410 v5 = 0; | |
9411 } | |
437 | 9412 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 9413 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
9414 { | |
9415 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9416 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
9417 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
9418 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
9419 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 9420 }*/ |
9421 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 9422 return; // void func |
0 | 9423 } |
484 | 9424 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 9425 { |
9426 v24 = pNPCTopics[171].pText; | |
9427 v25 = v31; | |
9428 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
9429 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
9430 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 9431 return ; |
9432 } | |
9433 | |
9434 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9435 return; | |
0 | 9436 v8 = pDialogueWindow; |
9437 v33 = 0; | |
9438 v34 = 0; | |
9439 v29 = pDialogueWindow; | |
9440 v9 = pDialogueWindow->pStartingPosActiveItem; | |
9441 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
9442 v35 = pDialogueWindow->pStartingPosActiveItem; | |
9443 if ( v9 >= v10 ) | |
9444 goto LABEL_40; | |
9445 do | |
9446 { | |
9447 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 9448 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 9449 { |
9450 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
9451 v33 += v12; | |
9452 ++v34; | |
9453 } | |
9454 v13 = v8->pStartingPosActiveItem; | |
9455 ++v35; | |
9456 } | |
9457 while ( v35 < v8->pNumPresenceButton + v13 ); | |
9458 if ( !v34 ) | |
9459 { | |
9460 LABEL_40: | |
135 | 9461 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 9462 strcat(pTmpBuf, "\n \n"); |
9463 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
9464 v22 = v31; | |
9465 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 9466 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
9467 return; | |
0 | 9468 } |
9469 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
9470 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
9471 v32 = (149 - v33) / v34; | |
9472 if ( (149 - v33) / v34 > 32 ) | |
9473 v32 = 32; | |
711 | 9474 |
9475 v35 = v8->pStartingPosActiveItem; | |
0 | 9476 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 9477 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 9478 { |
9479 v33 = 2; | |
9480 do | |
9481 { | |
9482 v14 = v8->GetControl(v35); | |
9483 v15 = v14->uControlParam - 36; | |
135 | 9484 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 9485 { |
9486 v16 = 0; | |
9487 if ( !v1->pActiveSkills[v15] ) | |
9488 { | |
9489 v17 = pSkillNames[v15]; | |
9490 v14->uY = v32 + v34; | |
9491 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
9492 v19 = v14->uY; | |
9493 v14->uHeight = v18; | |
9494 v20 = v19 + v18 - 1; | |
9495 v14->uW = v20; | |
9496 v34 = v20; | |
9497 v21 = v31; | |
9498 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
9499 v21 = v30; | |
9500 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
9501 goto LABEL_34; | |
9502 } | |
9503 } | |
9504 else | |
9505 { | |
9506 v16 = 0; | |
9507 } | |
9508 v14->uW = v16; | |
9509 v14->uHeight = v16; | |
9510 v14->uY = v16; | |
9511 LABEL_34: | |
9512 v8 = v29; | |
9513 ++v35; | |
9514 ++v33; | |
711 | 9515 } |
9516 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
9517 } | |
9518 return; | |
0 | 9519 } |
9520 | |
9521 | |
9522 | |
9523 //----- (004B6943) -------------------------------------------------------- | |
9524 void __cdecl TravelByTransport() | |
9525 { | |
9526 GUIWindow *v0; // ebx@1 | |
9527 Player *v1; // esi@1 | |
9528 signed int v2; // edi@1 | |
9529 unsigned int v3; // eax@1 | |
9530 signed int v4; // ebx@1 | |
727 | 9531 stru365_travel_info *v5; // esi@7 |
0 | 9532 int v6; // eax@9 |
9533 int v7; // eax@9 | |
9534 int v8; // eax@12 | |
9535 int v9; // edi@12 | |
9536 int v10; // edx@12 | |
9537 int v11; // ecx@12 | |
9538 signed int v12; // esi@13 | |
9539 signed int v13; // edi@14 | |
9540 DWORD v14; // eax@26 | |
9541 DWORD v15; // edi@26 | |
9542 GUIWindow *v16; // ebx@36 | |
9543 int v17; // esi@36 | |
9544 int v18; // eax@36 | |
9545 int v19; // ecx@36 | |
9546 int v20; // esi@36 | |
9547 int v21; // eax@36 | |
9548 void *v22; // eax@39 | |
727 | 9549 int v23; // esi@39 |
0 | 9550 GUIButton *v24; // ebx@39 |
9551 signed int v25; // eax@41 | |
727 | 9552 //int v26; // esi@44 |
0 | 9553 const char *v27; // eax@46 |
9554 char *v28; // eax@62 | |
9555 int v29; // eax@62 | |
9556 unsigned int v30; // ecx@62 | |
9557 char *v31; // eax@63 | |
652 | 9558 MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 |
9559 /*int v33; // [sp-38h] [bp-2C8h]@62 | |
0 | 9560 int v34; // [sp-34h] [bp-2C4h]@62 |
9561 int v35; // [sp-30h] [bp-2C0h]@62 | |
9562 int v36; // [sp-2Ch] [bp-2BCh]@62 | |
9563 int v37; // [sp-28h] [bp-2B8h]@62 | |
9564 int v38; // [sp-24h] [bp-2B4h]@62 | |
9565 int v39; // [sp-20h] [bp-2B0h]@62 | |
9566 int v40; // [sp-1Ch] [bp-2ACh]@62 | |
9567 int v41; // [sp-18h] [bp-2A8h]@62 | |
9568 int v42; // [sp-14h] [bp-2A4h]@62 | |
9569 char *v43; // [sp-10h] [bp-2A0h]@62 | |
9570 char *v44; // [sp-Ch] [bp-29Ch]@62 | |
9571 unsigned int v45; // [sp-8h] [bp-298h]@62 | |
9572 char *v46; // [sp-4h] [bp-294h]@62 | |
652 | 9573 const char *v47[5]; // [sp+0h] [bp-290h]@7*/ |
9574 char v48[100]; // [sp+14h] [bp-27Ch]@37 | |
9575 char v49[100]; // [sp+78h] [bp-218h]@68 | |
9576 char v50[100]; // [sp+DCh] [bp-1B4h]@68 | |
9577 char v51[100]; // [sp+140h] [bp-150h]@68 | |
9578 char Dest[100]; // [sp+1A4h] [bp-ECh]@36 | |
0 | 9579 GUIWindow v53; // [sp+208h] [bp-88h]@1 |
9580 int v54; // [sp+25Ch] [bp-34h]@36 | |
9581 int v55; // [sp+260h] [bp-30h]@36 | |
9582 unsigned int v56; // [sp+264h] [bp-2Ch]@1 | |
652 | 9583 int v57; // [sp+268h] [bp-28h]@1 |
727 | 9584 int v58; // [sp+26Ch] [bp-24h]@36 |
0 | 9585 GUIWindow *v59; // [sp+270h] [bp-20h]@1 |
9586 unsigned int v60; // [sp+274h] [bp-1Ch]@36 | |
727 | 9587 //Player *v61; // [sp+278h] [bp-18h]@1 |
0 | 9588 int v62; // [sp+27Ch] [bp-14h]@36 |
9589 int v63; // [sp+280h] [bp-10h]@14 | |
9590 char *a1; // [sp+284h] [bp-Ch]@37 | |
9591 unsigned int s1; // [sp+288h] [bp-8h]@1 | |
9592 int v66; // [sp+28Ch] [bp-4h]@48 | |
9593 | |
336 | 9594 v0 = window_SpeakInHouse; |
9595 memcpy(&v53, window_SpeakInHouse, sizeof(v53)); | |
0 | 9596 v2 = 255; |
727 | 9597 //v61 = pPlayers[uActiveCharacter]; |
9598 v1 = pPlayers[uActiveCharacter]; | |
0 | 9599 v53.uFrameX = 483; |
9600 v53.uFrameWidth = 148; | |
9601 v53.uFrameZ = 334; | |
652 | 9602 v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
0 | 9603 v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); |
9604 v3 = 52 * (unsigned int)v0->ptr_1C; | |
9605 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); | |
9606 v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); | |
9607 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); | |
9608 v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
9609 s1 = v4 * (100 - v1->GetMerchant()) / 100; | |
9610 if ( (signed int)s1 < v4 / 3 ) | |
9611 s1 = v4 / 3; | |
607 | 9612 if ( dialog_menu_id == 1 ) |
0 | 9613 { |
9614 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
9615 { | |
9616 v16 = pDialogueWindow; | |
727 | 9617 v58 = -1; |
0 | 9618 v62 = 0; |
9619 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
9620 v59 = pDialogueWindow; | |
9621 v54 = v17; | |
652 | 9622 strcpy(Dest, ""); |
9623 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold | |
0 | 9624 v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); |
9625 v19 = v16->pNumPresenceButton; | |
9626 v20 = v18 + v17 + 146; | |
9627 v21 = v16->pStartingPosActiveItem; | |
9628 v63 = v20; | |
9629 v55 = v20; | |
9630 v60 = v21; | |
9631 if ( v21 >= v21 + v19 ) | |
9632 goto LABEL_71; | |
9633 s1 = 2; | |
652 | 9634 a1 = v48; |
0 | 9635 while ( 1 ) |
9636 { | |
652 | 9637 int v47 = v60; |
336 | 9638 v22 = window_SpeakInHouse->ptr_1C; |
727 | 9639 v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; |
9640 //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 | |
9641 //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land | |
0 | 9642 v24 = v16->GetControl(v60); |
9643 if ( v23 != v58 | |
727 | 9644 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), |
0 | 9645 v25 |
727 | 9646 && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) |
9647 { | |
9648 v58 = v23; | |
0 | 9649 v27 = (const char *)v56; |
9650 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) | |
652 | 9651 v27 = (const char *)v57; |
9652 //v32.uRedbookTrackID = v27; | |
690 | 9653 sprintf(a1, "\f%05d", v27); |
727 | 9654 v66 = array_4F09B0[v23].uTravelTime; |
336 | 9655 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 9656 { |
652 | 9657 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 9658 v66 -= 2; |
652 | 9659 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 9660 v66 -= 3; |
652 | 9661 //v47 = Pirate; |
9662 if ( CheckHiredNPCSpeciality(Pirate) ) | |
9663 v66 -= 2; | |
0 | 9664 } |
9665 else | |
9666 { | |
652 | 9667 //v47 = Horseman; |
9668 if ( CheckHiredNPCSpeciality(Horseman) ) | |
9669 v66 -= 2; | |
9670 } | |
9671 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 9672 --v66; |
9673 if ( v66 < 1 ) | |
9674 v66 = 1; | |
727 | 9675 if ( v23 != v2 ) |
0 | 9676 { |
727 | 9677 memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); |
652 | 9678 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s |
9679 v66, v32.pName); | |
0 | 9680 strcat(a1, pTmpBuf); |
9681 v28 = a1; | |
9682 a1 += 100; | |
9683 ++v62; | |
9684 ++s1; | |
9685 strcat(v28, "\n \n"); | |
9686 v24->uY = v63; | |
9687 v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0); | |
9688 v30 = v24->uY; | |
9689 v24->uHeight = v29; | |
9690 v2 = 255; | |
9691 v24->uW = v30 + v29 - 1; | |
9692 v63 += v54 + v29; | |
9693 } | |
9694 } | |
9695 else | |
9696 { | |
9697 v31 = a1; | |
9698 ++v62; | |
9699 ++s1; | |
9700 a1 += 100; | |
9701 strcpy(v31, ""); | |
9702 if ( v24 ) | |
9703 { | |
9704 v24->uW = 0; | |
9705 v24->uHeight = 0; | |
9706 v24->uY = 0; | |
9707 } | |
9708 } | |
9709 ++v60; | |
9710 if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem ) | |
9711 break; | |
9712 v16 = v59; | |
9713 } | |
9714 if ( v63 != v55 ) | |
9715 { | |
652 | 9716 /*v47[1] = &Dest; |
0 | 9717 v47[0] = &v51; |
9718 v46 = &v50; | |
9719 v45 = (unsigned int)&v49; | |
9720 v44 = &v48; | |
652 | 9721 v43 = pTmpBuf2;*/ |
9722 sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); | |
0 | 9723 v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); |
9724 } | |
9725 else | |
9726 { | |
9727 LABEL_71: | |
652 | 9728 v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, |
9729 v57, pGlobalTXT_LocalizationStrings[561], 3); | |
0 | 9730 pAudioPlayer->StopChannels(-1, -1); |
9731 } | |
9732 } | |
9733 } | |
9734 else | |
9735 { | |
607 | 9736 if ( dialog_menu_id > 104 && dialog_menu_id <= 108 ) |
0 | 9737 { |
9738 if ( pParty->uNumGold < s1 ) | |
9739 { | |
9740 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
735 | 9741 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
437 | 9742 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 9743 return; |
9744 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9745 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
437 | 9746 goto LABEL_33;*/ |
9747 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
0 | 9748 } |
9749 Party::TakeGold(s1); | |
652 | 9750 //v47[1] = (const char *)7; |
727 | 9751 v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; |
9752 if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) | |
9753 { | |
9754 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) | |
0 | 9755 { |
9756 SaveGame(1, 0); | |
727 | 9757 strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); |
9758 v8 = v5->field_18; | |
9759 v9 = v5->field_14; | |
9760 v10 = v5->field_10; | |
0 | 9761 dword_6BE364_game_settings_1 |= 1u; |
9762 _5B65B8_npcdata_hiword_house_or_other = 0; | |
9763 dword_5B65BC = 0; | |
9764 _5B65B4_npcdata_loword_house_or_other = v8; | |
9765 v11 = *((int *)v5 + 3); | |
9766 uGameState = 2; | |
9767 _5B65A8_npcdata_uflags_or_other = v11; | |
9768 _5B65AC_npcdata_fame_or_other = v10; | |
9769 _5B65B0_npcdata_rep_or_other = v9; | |
9770 dword_5B65C0 = v11 | v10 | v9 | v8; | |
9771 } | |
9772 else | |
9773 { | |
727 | 9774 v6 = v5->field_C; |
0 | 9775 pParty->sRotationX = 0; |
9776 pParty->vPosition.x = v6; | |
727 | 9777 v7 = v5->field_10; |
0 | 9778 pIndoorCamera->sRotationY = 0; |
9779 pParty->uFlags |= 2u; | |
9780 pParty->vPosition.y = v7; | |
727 | 9781 pParty->vPosition.z = v5->field_14; |
0 | 9782 pParty->uFallStartY = pParty->vPosition.z; |
727 | 9783 pParty->sRotationY = v5->field_18; |
0 | 9784 } |
735 | 9785 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); |
727 | 9786 v12 = v5->uTravelTime; |
652 | 9787 int _v47; |
336 | 9788 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) |
0 | 9789 { |
652 | 9790 v63 = SPEECH_SetSail; |
0 | 9791 v13 = 2500; |
652 | 9792 if ( CheckHiredNPCSpeciality(Sailor) ) |
0 | 9793 v12 -= 2; |
652 | 9794 if ( CheckHiredNPCSpeciality(Navigator) ) |
0 | 9795 v12 -= 3; |
652 | 9796 //_v47 = 45; |
9797 if ( CheckHiredNPCSpeciality(Pirate) ) | |
9798 v12 -= 2; | |
0 | 9799 } |
9800 else | |
9801 { | |
652 | 9802 v63 = SPEECH_CarriageReady; |
0 | 9803 v13 = 1500; |
652 | 9804 //_v47 = 35; |
9805 if ( CheckHiredNPCSpeciality(Horseman) ) | |
9806 v12 -= 2; | |
9807 } | |
9808 if ( CheckHiredNPCSpeciality(Explorer) ) | |
0 | 9809 --v12; |
9810 if ( v12 < 1 ) | |
9811 v12 = 1; | |
9812 RestAndHeal(1440 * v12); | |
727 | 9813 v1->PlaySound((PlayerSpeech)v63, 0); |
0 | 9814 v14 = GetTickCount(); |
9815 v15 = v14 + v13; | |
9816 if ( v15 < v14 ) | |
9817 v15 = v14; | |
9818 while ( GetTickCount() < v15 ) | |
9819 sqrt(3.1415926); | |
9820 while ( sub_4BD8B5() ) | |
9821 ; | |
437 | 9822 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
9823 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 9824 { |
9825 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
9826 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
9827 LABEL_33: | |
9828 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
9829 ++pMessageQueue_50CBD0->uNumMessages; | |
9830 return; | |
437 | 9831 }*/ |
0 | 9832 } |
9833 else | |
9834 { | |
607 | 9835 dialog_menu_id = 1; |
0 | 9836 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); |
9837 } | |
9838 } | |
9839 } | |
9840 } | |
9841 | |
9842 | |
9843 | |
9844 | |
9845 | |
9846 //----- (00405CFF) -------------------------------------------------------- | |
9847 void stru262_TurnBased::End(bool bPlaySound) | |
9848 { | |
9849 stru262_TurnBased *v2; // edi@1 | |
9850 int v3; // ebx@1 | |
9851 int v4; // esi@1 | |
9852 unsigned __int8 v5; // zf@1 | |
9853 unsigned __int8 v6; // sf@1 | |
9854 TurnBased_QueueElem *v7; // ecx@2 | |
9855 unsigned __int16 *pAttributes; // ecx@7 | |
9856 size_t v9; // edx@7 | |
9857 unsigned __int16 v10; // ax@8 | |
9858 TurnBased_QueueElem *v11; // ebx@12 | |
9859 ObjectType objType; // eax@13 | |
9860 int objID; // esi@13 | |
9861 int v14; // [sp+Ch] [bp-4h]@11 | |
9862 | |
9863 v2 = this; | |
9864 v3 = 0; | |
9865 v4 = 0; | |
9866 v5 = this->uActorQueueSize == 0; | |
9867 v6 = this->uActorQueueSize < 0; | |
9868 this->field_4 = 0; | |
9869 if ( !(v6 | v5) ) | |
9870 { | |
9871 v7 = this->pQueue; | |
9872 do | |
9873 { | |
9874 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
9875 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
9876 ++v4; | |
9877 ++v7; | |
9878 } | |
9879 while ( v4 < v2->uActorQueueSize ); | |
9880 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9881 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9882 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9883 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
9884 v9 = uNumSpriteObjects; |
0 | 9885 do |
9886 { | |
9887 v10 = *pAttributes; | |
9888 if ( *pAttributes & 4 ) | |
9889 { | |
9890 LOBYTE(v10) = v10 & 0xFB; | |
9891 *pAttributes = v10; | |
9892 } | |
9893 pAttributes += 56; | |
9894 --v9; | |
9895 } | |
9896 while ( v9 ); | |
9897 } | |
9898 v14 = 0; | |
9899 if ( v2->uActorQueueSize > 0 ) | |
9900 { | |
9901 v11 = v2->pQueue; | |
9902 do | |
9903 { | |
9904 objType = (ObjectType)(v11->uPackedID & 7); | |
9905 objID = v11->uPackedID >> 3; | |
9906 if ( objType == OBJECT_Player ) | |
9907 { | |
9908 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9909 } | |
9910 else | |
9911 { | |
9912 if ( objType == OBJECT_Actor ) | |
9913 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
9914 } | |
9915 ++v14; | |
9916 ++v11; | |
9917 } | |
9918 while ( v14 < v2->uActorQueueSize ); | |
9919 v3 = 0; | |
9920 } | |
9921 pAudioPlayer->StopChannels(-1, -1); | |
9922 if ( bPlaySound != v3 ) | |
9923 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
9924 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
9925 pEventTimer->StopGameTime(); | |
9926 dword_50C994 = v3; | |
9927 dword_50C998_turnbased_icon_1A = v3; | |
9928 } | |
9929 // 50C994: using guessed type int dword_50C994; | |
9930 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
9931 | |
9932 //----- (00405E14) -------------------------------------------------------- | |
9933 void stru262_TurnBased::_405E14() | |
9934 { | |
9935 stru262_TurnBased *v1; // esi@1 | |
9936 int v2; // ecx@1 | |
9937 SpellBuff *v3; // edi@2 | |
9938 Actor *v4; // ebx@3 | |
9939 signed int v5; // edx@20 | |
9940 AIDirection *v6; // esi@21 | |
9941 int v7; // eax@21 | |
9942 int v8; // eax@21 | |
9943 int v9; // eax@22 | |
9944 int v10; // eax@23 | |
9945 int v11; // eax@37 | |
9946 int v12; // eax@44 | |
9947 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
9948 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
9949 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 9950 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 9951 int v17; // [sp+5Ch] [bp-10h]@6 |
9952 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
9953 int v19; // [sp+64h] [bp-8h]@8 | |
9954 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
9955 | |
9956 v1 = this; | |
9957 v2 = 0; | |
9958 v18 = v1; | |
9959 v20 = 0; | |
9960 if ( (signed int)uNumActors > 0 ) | |
9961 { | |
90 | 9962 //v3 = pActors;//[0].pActorBuffs; |
9963 v16 = pActors;//[0].pActorBuffs; | |
9964 v3 = v16->pActorBuffs; | |
0 | 9965 do |
9966 { | |
90 | 9967 v4 = v16; |
9968 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 9969 v17 = v2; |
9970 else | |
9971 v17 = 1; | |
9972 v19 = v2; | |
9973 do | |
9974 { | |
9975 if ( v19 != 10 ) | |
9976 { | |
9977 v3->_4585CA(pParty->uTimePlayed); | |
9978 v2 = 0; | |
9979 } | |
9980 ++v19; | |
9981 ++v3; | |
9982 } | |
9983 while ( v19 < 22 ); | |
9984 if ( v17 != v2 | |
9985 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
9986 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
9987 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
9988 if ( !(v4->uAttributes & 0x80) ) | |
9989 { | |
9990 if ( !v4->pActorBuffs[5].uExpireTime ) | |
9991 { | |
9992 if ( !v4->pActorBuffs[6].uExpireTime ) | |
9993 { | |
9994 v5 = v4->uCurrentActionLength; | |
9995 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
9996 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
9997 { | |
417 | 9998 v17 = ai_near_actors_targets_pid[v20]; |
9999 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 10000 v7 = v4->uAIState; |
10001 memcpy(&v15, v6, sizeof(v15)); | |
10002 v8 = v7 - 4; | |
10003 memcpy(&v14, &v15, sizeof(v14)); | |
10004 if ( v8 ) | |
10005 { | |
10006 v9 = v8 - 1; | |
10007 if ( v9 ) | |
10008 { | |
10009 v10 = v9 - 6; | |
10010 if ( v10 ) | |
10011 { | |
10012 if ( v10 != 8 ) | |
414 | 10013 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 10014 } |
10015 } | |
10016 } | |
10017 else | |
10018 { | |
10019 v4->uCurrentActionTime = 0; | |
10020 v4->uCurrentActionLength = 0; | |
10021 v4->uAIState = Dead; | |
10022 v4->UpdateAnimation(); | |
10023 } | |
10024 v1 = v18; | |
10025 v2 = 0; | |
10026 } | |
10027 } | |
10028 } | |
10029 } | |
10030 ++v20; | |
90 | 10031 v3 = v16[1].pActorBuffs; |
10032 ++v16; | |
0 | 10033 } |
10034 while ( (signed int)v20 < (signed int)uNumActors ); | |
10035 } | |
10036 if ( v1->field_4 == 1 ) | |
10037 { | |
10038 v12 = v1->field_8; | |
10039 if ( v12 == 64 ) | |
10040 { | |
10041 v1->_406A63(); | |
10042 } | |
10043 else | |
10044 { | |
10045 if ( v12 > v2 ) | |
10046 { | |
10047 v1->_406B9F(); | |
10048 } | |
10049 else | |
10050 { | |
10051 v1->_406AFE(); | |
10052 v1->field_10 = 100; | |
10053 } | |
10054 } | |
10055 v1->field_8 -= pEventTimer->uTimeElapsed; | |
10056 return; | |
10057 } | |
10058 if ( v1->field_4 == 2 ) | |
10059 { | |
10060 if ( !(v1->field_18 & 1) ) | |
10061 { | |
10062 v11 = v1->field_10; | |
10063 if ( v11 == 100 ) | |
10064 { | |
10065 v1->StartTurn(); | |
10066 LABEL_39: | |
10067 v1->_40652A(); | |
10068 return; | |
10069 } | |
10070 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
10071 { | |
10072 v1->_4065B0(); | |
10073 goto LABEL_39; | |
10074 } | |
10075 } | |
10076 v1->NextTurn(); | |
10077 return; | |
10078 } | |
10079 if ( v1->field_4 == 3 ) | |
10080 { | |
10081 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
10082 { | |
10083 v1->field_18 &= 0xFFFFFFF7u; | |
10084 v1->field_4 = 1; | |
10085 v1->field_8 = 64; | |
10086 } | |
10087 else | |
10088 { | |
10089 v1->_406FA8(); | |
10090 } | |
10091 } | |
10092 } | |
10093 | |
10094 | |
10095 | |
10096 | |
10097 //----- (0043FDED) -------------------------------------------------------- | |
10098 void PrepareActorRenderList_BLV() | |
10099 { | |
10100 RenderBillboard *v0; // esi@0 | |
10101 unsigned __int16 v3; // ax@3 | |
10102 unsigned int v4; // eax@5 | |
10103 unsigned __int16 v5; // cx@5 | |
10104 int v6; // esi@5 | |
10105 unsigned int v7; // eax@7 | |
10106 int v8; // eax@10 | |
10107 SpriteFrame *v9; // eax@16 | |
10108 SpriteFrame *v10; // ebx@18 | |
10109 //int *v11; // eax@18 | |
10110 int v12; // ecx@28 | |
10111 //IndoorCameraD3D **v14; // eax@36 | |
10112 double v15; // st7@36 | |
10113 float v16; // eax@36 | |
10114 //double v17; // ST30_8@36 | |
10115 signed __int64 v18; // qtt@36 | |
10116 int v19; // ST5C_4@36 | |
10117 signed __int64 v20; // qtt@37 | |
10118 int v21; // ST5C_4@37 | |
10119 signed __int16 v22; // cx@39 | |
10120 int v23; // ST50_4@40 | |
10121 signed int v24; // ecx@40 | |
10122 int v25; // edx@44 | |
10123 __int16 v26; // ax@44 | |
10124 //MonsterDesc *v27; // edx@44 | |
10125 //int v28; // ecx@44 | |
10126 unsigned __int8 v29; // zf@44 | |
10127 unsigned __int8 v30; // sf@44 | |
10128 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
10129 int v32; // [sp+1Ch] [bp-38h]@5 | |
10130 int a3; // [sp+20h] [bp-34h]@5 | |
10131 int a2; // [sp+24h] [bp-30h]@5 | |
10132 int a1a; // [sp+28h] [bp-2Ch]@5 | |
10133 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
10134 int a5a; // [sp+2Ch] [bp-28h]@36 | |
10135 int a5b; // [sp+2Ch] [bp-28h]@40 | |
10136 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
10137 int a6; // [sp+40h] [bp-14h]@34 | |
10138 int v43; // [sp+44h] [bp-10h]@34 | |
10139 int z; // [sp+48h] [bp-Ch]@32 | |
10140 signed int y; // [sp+4Ch] [bp-8h]@32 | |
10141 int x; // [sp+50h] [bp-4h]@32 | |
10142 | |
10143 for (uint i = 0; i < uNumActors; ++i) | |
10144 { | |
10145 auto p = pActors + i; | |
10146 | |
10147 if (p->uAIState == Removed || | |
10148 p->uAIState == Disabled) | |
10149 continue; | |
10150 | |
10151 a5 = p->uSectorID; | |
10152 a2 = p->vPosition.y; | |
10153 a1a = p->vPosition.x; | |
10154 a3 = p->vPosition.z; | |
10155 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
10156 LOWORD(v0) = p->uYawAngle; | |
10157 v5 = p->uCurrentActionAnimation; | |
10158 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
10159 v32 = v6; | |
10160 if ( pParty->bTurnBasedModeOn ) | |
10161 { | |
10162 if ( v5 == 1 ) | |
10163 { | |
10164 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
10165 goto LABEL_10; | |
10166 } | |
10167 } | |
10168 else | |
10169 { | |
10170 if ( v5 == 1 ) | |
10171 { | |
10172 v7 = pBLVRenderParams->field_0_timer_; | |
10173 LABEL_10: | |
10174 v8 = i * 32 + v7; | |
10175 goto LABEL_12; | |
10176 } | |
10177 } | |
10178 v8 = p->uCurrentActionTime; | |
10179 LABEL_12: | |
10180 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
10181 v8 = 0; | |
10182 v31 = p->pSpriteIDs[v5]; | |
10183 if (p->uAIState == Resurrected) | |
10184 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
10185 else | |
10186 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
10187 v41 = 0; | |
10188 v10 = v9; | |
10189 //v11 = (int *)v9->uFlags; | |
10190 if (v9->uFlags & 2) | |
10191 v41 = 2; | |
10192 if (v9->uFlags & 0x40000) | |
10193 v41 |= 0x40u; | |
10194 if (v9->uFlags & 0x20000) | |
10195 LOBYTE(v41) = v41 | 0x80; | |
10196 v0 = (RenderBillboard *)(256 << v6); | |
10197 if ( (unsigned int)v0 & v9->uFlags) | |
10198 v41 |= 4u; | |
10199 if ( v10->uGlowRadius ) | |
10200 { | |
10201 //LOBYTE(v11) = byte_4E94D3; | |
10202 pMobileLightsStack->AddLight( | |
10203 a1a, | |
10204 a2, | |
10205 a3, | |
10206 a5, | |
10207 v10->uGlowRadius, | |
10208 0xFFu, | |
10209 0xFFu, | |
10210 0xFFu, | |
10211 byte_4E94D3); | |
10212 } | |
10213 v12 = 0; | |
10214 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
10215 continue; | |
10216 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
10217 { | |
10218 ++v12; | |
10219 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
10220 goto _continue; | |
10221 } | |
10222 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
10223 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
10224 continue; | |
10225 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
10226 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
10227 if (uNumBillboardsToDraw >= 500) | |
10228 break; | |
10229 ++uNumBillboardsToDraw; | |
10230 ++uNumSpritesDrawnThisFrame; | |
10231 p->uAttributes |= 8u; | |
10232 v29 = pRenderer->pRenderD3D == 0; | |
10233 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
10234 v0->uPalette = v10->uPaletteIndex; | |
10235 v0->uIndoorSectorID = a5; | |
10236 if ( v29 ) | |
10237 { | |
10238 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
10239 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
10240 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10241 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 10242 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
10243 } | |
10244 else | |
10245 { | |
10246 //v14 = &pGame->pIndoorCameraD3D; | |
10247 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
10248 v15 = pGame->pIndoorCameraD3D->fov_y; | |
10249 v16 = v0->fov_x; | |
10250 v0->fov_y = v15; | |
10251 //v17 = v16 + 6.7553994e15; | |
10252 LODWORD(v18) = 0; | |
10253 HIDWORD(v18) = floorf(v16 + 0.5f); | |
10254 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10255 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 10256 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
10257 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10258 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 10259 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
10260 { | |
10261 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
10262 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10263 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 10264 goto LABEL_43; |
10265 } | |
10266 } | |
10267 else | |
10268 { | |
10269 v22 = p->pActorBuffs[3].uPower; | |
10270 if ( v22 ) | |
10271 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10272 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 10273 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10274 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10275 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 10276 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
10277 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 10278 goto LABEL_44; |
10279 } | |
10280 } | |
10281 LABEL_44: | |
10282 HIWORD(v25) = HIWORD(x); | |
430 | 10283 v0->world_x = a1a; |
10284 v0->world_y = a2; | |
10285 v0->world_z = a3; | |
0 | 10286 v0->uScreenSpaceX = v43; |
10287 v0->uScreenSpaceY = a6; | |
10288 LOWORD(v25) = 0; | |
10289 LOBYTE(v26) = v41; | |
194 | 10290 |
10291 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
10292 v0->actual_z = HIWORD(x); | |
10293 v0->object_pid = v8 * i | OBJECT_Actor; | |
10294 | |
0 | 10295 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
10296 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
10297 v0->field_1E = v41; | |
10298 v0->pSpriteFrame = v10; | |
10299 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
10300 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
10301 { | |
10302 HIBYTE(v26) = HIBYTE(v41) | 1; | |
10303 v0->field_1E = v26; | |
10304 } | |
10305 | |
10306 _continue: | |
10307 ; | |
10308 } | |
10309 } | |
10310 | |
10311 | |
10312 | |
10313 | |
10314 //----- (00444732) -------------------------------------------------------- | |
428 | 10315 char *GetEventHintString(unsigned int uEventID) |
10316 { | |
10317 signed int event_index; // edx@1 | |
10318 int event_pos; // esi@4 | |
0 | 10319 char *result; // eax@6 |
428 | 10320 unsigned int str_index; // eax@9 |
10321 int i; // esi@11 | |
10322 _evt_raw* test_evt; | |
10323 _evt_raw* last_evt; | |
10324 | |
10325 event_index = 0; | |
10326 if ( uLevelEVT_NumEvents <= 0 ) | |
10327 return NULL; | |
10328 | |
10329 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 10330 while ( 1 ) |
10331 { | |
428 | 10332 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
10333 { | |
10334 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
10335 last_evt=test_evt; | |
10336 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
10337 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 10338 break; |
10339 } | |
428 | 10340 ++event_index; |
10341 if ( event_index >= uLevelEVT_NumEvents ) | |
10342 return NULL; | |
10343 } | |
10344 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
10345 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
10346 { | |
10347 str_index = EVT_DWORD(test_evt->v5); | |
10348 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 10349 } |
10350 else | |
10351 { | |
428 | 10352 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
10353 { | |
10354 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
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 if ( str_index < 600 ) | |
10360 return (char *)p2DEvents[str_index - 1].pName; | |
10361 } | |
10362 } | |
10363 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
10364 } | |
10365 | |
0 | 10366 return result; |
10367 } | |
10368 | |
10369 | |
10370 | |
10371 | |
10372 //----- (00444839) -------------------------------------------------------- | |
10373 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) | |
10374 { | |
10375 unsigned int v9; // ebx@1 | |
10376 int v10; // edi@1 | |
373 | 10377 //signed int v11; // eax@1 |
0 | 10378 unsigned int v12; // eax@6 |
10379 const char *v13; // ST0C_4@6 | |
10380 unsigned int v14; // eax@8 | |
10381 const char *v15; // eax@14 | |
10382 unsigned int v16; // eax@16 | |
10383 unsigned int result; // eax@26 | |
10384 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 10385 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 10386 char *v20; // [sp-4h] [bp-3Ch]@9 |
10387 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
10388 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
10389 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
10390 | |
10391 v9 = a1; | |
10392 v10 = a2; | |
10393 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
10394 dword_59117C_teleportx = x; | |
10395 dword_591178_teleporty = y; | |
10396 dword_591174_teleportz = z; | |
10397 dword_591170_teleport_directiony = directiony; | |
10398 dword_59116C_teleport_directionx = directionx; | |
10399 dword_591168_teleport_speedz = a8; | |
10400 dword_591164_teleport_map_name = (char *)pLocationName; | |
10401 uCurrentHouse_Animation = v9; | |
10402 pEventTimer->Pause(); | |
10403 pAudioPlayer->StopChannels(-1, -1); | |
373 | 10404 |
10405 switch (pParty->alignment) | |
10406 { | |
10407 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
10408 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
10409 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
10410 default: assert(false); | |
10411 } | |
10412 /*v11 = const_2(); | |
0 | 10413 sprintf(pContainer, "evt%02d", v11); |
10414 if ( pParty->uAlignment ) | |
10415 { | |
10416 if ( pParty->uAlignment != 2 ) | |
10417 goto LABEL_6; | |
10418 v19 = "-c"; | |
10419 } | |
10420 else | |
10421 { | |
10422 v19 = "-b"; | |
10423 } | |
373 | 10424 strcat(pContainer, v19);*/ |
10425 | |
10426 //LABEL_6: | |
0 | 10427 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
10428 v13 = pHouse_ExitPictures[v10]; | |
10429 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
10430 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
10431 if ( v9 ) | |
10432 { | |
10433 if ( !v23 ) | |
10434 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 10435 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 10436 } |
10437 else | |
10438 { | |
10439 if ( !v23 ) | |
10440 { | |
10441 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
10442 if ( v14 ) | |
10443 { | |
721 | 10444 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 10445 goto LABEL_20; |
10446 } | |
10447 v21 = pGlobalTXT_LocalizationStrings[79]; | |
10448 goto LABEL_19; | |
10449 } | |
10450 } | |
10451 v15 = pLocationName; | |
10452 if ( *pLocationName == 48 ) | |
10453 v15 = pCurrentMapName; | |
10454 v16 = pMapStats->GetMapInfo(v15); | |
10455 if ( v16 ) | |
10456 { | |
721 | 10457 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
10458 goto LABEL_20; | |
0 | 10459 } |
10460 v21 = pGlobalTXT_LocalizationStrings[73]; | |
10461 LABEL_19: | |
423 | 10462 strcpy(sHouseName, v21); |
0 | 10463 LABEL_20: |
710 | 10464 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 10465 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 10466 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 10467 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 10468 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 10469 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 10470 result = v23; |
10471 if ( v23 ) | |
10472 uCurrentHouse_Animation = v23; | |
10473 return result; | |
10474 } | |
10475 |