Mercurial > mm7
annotate mm7_4.cpp @ 783:b27dd658ea77
Taveling by foot fixed.
author | Nomad |
---|---|
date | Sun, 24 Mar 2013 21:14:28 +0200 |
parents | 7994986603d5 |
children | b3e08a496778 |
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) -------------------------------------------------------- | |
783 | 75 void __cdecl check_event_triggers() |
0 | 76 { |
77 int v0; // eax@1 | |
78 LevelDecoration *v1; // esi@2 | |
79 signed int v2; // edi@2 | |
80 int v3; // ebx@2 | |
81 int v4; // eax@3 | |
82 int v5; // ebx@3 | |
83 unsigned int v6; // ecx@3 | |
84 unsigned int v7; // edx@6 | |
85 unsigned int v8; // edx@8 | |
112 | 86 Actor *v9; // edi@13 |
0 | 87 int v10; // ebx@14 |
88 int v11; // eax@14 | |
89 int v12; // ebx@14 | |
90 unsigned int v13; // ecx@14 | |
91 int v14; // edx@15 | |
92 unsigned int v15; // edx@17 | |
93 unsigned int v16; // edx@19 | |
94 char *v17; // edi@25 | |
95 int v18; // ebx@26 | |
96 int v19; // eax@26 | |
97 int v20; // ebx@26 | |
98 unsigned int v21; // ecx@26 | |
99 int v22; // edx@27 | |
100 unsigned int v23; // edx@29 | |
101 unsigned int v24; // edx@31 | |
102 int v25; // [sp+0h] [bp-24h]@3 | |
103 int v26; // [sp+0h] [bp-24h]@14 | |
104 int v27; // [sp+0h] [bp-24h]@26 | |
105 int v28; // [sp+4h] [bp-20h]@3 | |
106 int v29; // [sp+4h] [bp-20h]@14 | |
107 int v30; // [sp+4h] [bp-20h]@26 | |
108 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
109 int v32; // [sp+Ch] [bp-18h]@2 | |
110 int v33; // [sp+10h] [bp-14h]@2 | |
111 int i; // [sp+14h] [bp-10h]@1 | |
112 int v35; // [sp+18h] [bp-Ch]@2 | |
113 int v36; // [sp+1Ch] [bp-8h]@3 | |
114 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
115 signed int v38; // [sp+20h] [bp-4h]@24 | |
116 | |
117 v0 = 0; | |
118 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
119 { | |
120 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
121 v2 = v1->field_18; | |
122 v3 = v1->vPosition.y; | |
123 v33 = v1->vPosition.x; | |
124 v32 = v1->vPosition.y; | |
125 v35 = v1->vPosition.z; | |
126 v31 = v1->field_18; | |
127 if ( v1->field_2 & 1 ) | |
128 { | |
129 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
130 v25 = abs(v3 - pParty->vPosition.y); | |
131 v28 = abs(v35 - pParty->vPosition.z); | |
132 v4 = v36; | |
133 v5 = v25; | |
134 v6 = v28; | |
135 if ( v36 < v25 ) | |
136 { | |
137 v4 = v25; | |
138 v5 = v36; | |
139 } | |
140 if ( v4 < v28 ) | |
141 { | |
142 v7 = v4; | |
143 v4 = v28; | |
144 v6 = v7; | |
145 } | |
146 if ( v5 < (signed int)v6 ) | |
147 { | |
148 v8 = v6; | |
149 v6 = v5; | |
150 v5 = v8; | |
151 } | |
152 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
153 EventProcessor(v1->field_16_event_id, 8 * i | 5, 1); | |
154 } | |
155 if ( v1->field_2 & 2 ) | |
156 { | |
157 v37 = 0; | |
158 if ( (signed int)uNumActors > 0 ) | |
159 { | |
112 | 160 v9 = pActors;//[0].vPosition.y; |
0 | 161 do |
162 { | |
112 | 163 v10 = abs(v33 - v9->vPosition.x); |
164 v29 = abs(v32 - v9->vPosition.y); | |
165 v26 = abs(v35 - v9->vPosition.z); | |
0 | 166 v11 = v10; |
167 v12 = v29; | |
168 v13 = v26; | |
169 if ( v11 < v29 ) | |
170 { | |
171 v14 = v11; | |
172 v11 = v29; | |
173 v12 = v14; | |
174 } | |
175 if ( v11 < v26 ) | |
176 { | |
177 v15 = v11; | |
178 v11 = v26; | |
179 v13 = v15; | |
180 } | |
181 if ( v12 < (signed int)v13 ) | |
182 { | |
183 v16 = v13; | |
184 v13 = v12; | |
185 v12 = v16; | |
186 } | |
187 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
188 EventProcessor(v1->field_16_event_id, 0, 1); | |
189 ++v37; | |
112 | 190 ++v9; |
0 | 191 } |
192 while ( v37 < (signed int)uNumActors ); | |
193 } | |
194 } | |
195 if ( v1->field_2 & 4 ) | |
196 { | |
197 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
198 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
199 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
200 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 201 do |
202 { | |
203 v18 = abs(v33 - *((int *)v17 - 1)); | |
204 v30 = abs(v32 - *(int *)v17); | |
205 v27 = abs(v35 - *((int *)v17 + 1)); | |
206 v19 = v18; | |
207 v20 = v30; | |
208 v21 = v27; | |
209 if ( v19 < v30 ) | |
210 { | |
211 v22 = v19; | |
212 v19 = v30; | |
213 v20 = v22; | |
214 } | |
215 if ( v19 < v27 ) | |
216 { | |
217 v23 = v19; | |
218 v19 = v27; | |
219 v21 = v23; | |
220 } | |
221 if ( v20 < (signed int)v21 ) | |
222 { | |
223 v24 = v21; | |
224 v21 = v20; | |
225 v20 = v24; | |
226 } | |
227 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
228 EventProcessor(v1->field_16_event_id, 0, 1); | |
229 ++v38; | |
230 v17 += 112; | |
231 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
232 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 233 } |
234 } | |
235 v0 = i + 1; | |
236 } | |
237 } | |
238 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
239 | |
240 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 241 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 242 { |
243 int v13; // ecx@13 | |
244 signed int v14; // ebx@14 | |
245 int v15; // eax@16 | |
729 | 246 //int v16; // edx@19 |
0 | 247 int v17; // ST18_4@19 |
248 signed int v18; // edx@19 | |
249 signed __int64 v19; // qtt@19 | |
250 int v21; // eax@27 | |
251 int v22; // ecx@29 | |
252 signed int v28; // eax@45 | |
253 int v29; // ebx@47 | |
254 int v30; // edx@49 | |
255 int v31; // ST10_4@49 | |
256 signed int v32; // edx@49 | |
257 signed __int64 v33; // qtt@49 | |
258 signed int v34; // eax@54 | |
259 signed int v35; // esi@56 | |
260 int result; // eax@57 | |
261 int v38; // edx@62 | |
262 int v44; // [sp+20h] [bp-20h]@10 | |
263 bool v47; // [sp+24h] [bp-1Ch]@43 | |
264 bool v48; // [sp+28h] [bp-18h]@10 | |
265 bool v49; // [sp+28h] [bp-18h]@41 | |
266 bool v50; // [sp+2Ch] [bp-14h]@12 | |
267 signed int v53; // [sp+30h] [bp-10h]@10 | |
268 signed int v54; // [sp+30h] [bp-10h]@41 | |
269 signed int v55; // [sp+34h] [bp-Ch]@1 | |
270 | |
730 | 271 //LOG_DECOMPILATION_WARNING(); |
272 | |
273 static int blv_floor_id[50]; // 00721200 | |
274 static int blv_floor_level[50]; // 007212C8 | |
275 | |
276 static __int16 word_721390_ys[104]; // idb | |
277 static __int16 word_721460_xs[104]; // idb | |
0 | 278 |
279 auto pSector = &pIndoor->pSectors[uSectorID]; | |
723 | 280 v55 = 1; |
0 | 281 for (uint i = 0; i < pSector->uNumFloors; ++i) |
282 { | |
283 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
284 if (pFloor->Clickable()) | |
285 continue; | |
286 | |
287 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && | |
288 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
289 { | |
290 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
291 { | |
730 | 292 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
293 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
294 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
295 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 296 } |
297 v44 = 2 * pFloor->uNumVertices; | |
730 | 298 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
299 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
300 | |
301 v48 = word_721390_ys[0] >= y; | |
0 | 302 v53 = 0; |
303 if ( pFloor->uNumVertices > 0 ) | |
304 { | |
723 | 305 for ( int i = 0; i < v44; i++ ) |
0 | 306 { |
307 if ( v53 >= 2 ) | |
308 break; | |
730 | 309 v50 = word_721390_ys[i + 1] >= y; |
310 | |
311 v13 = i; | |
312 if ( v48 != v50 ) | |
0 | 313 { |
730 | 314 v14 = word_721460_xs[i + 1] >= x ? 0 : 2; |
315 v15 = v14 | word_721460_xs[i] < x; | |
729 | 316 |
317 if ( !v15) | |
318 ++v53; | |
319 else | |
320 { | |
730 | 321 //v16 = word_721390_ys[i]; |
322 v17 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
323 v18 = y - word_721390_ys[i]; | |
729 | 324 LODWORD(v19) = v18 << 16; |
325 HIDWORD(v19) = v18 >> 16; | |
730 | 326 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x) |
729 | 327 ++v53; |
328 } | |
329 /*if ( v15 != 3 ) | |
0 | 330 { |
723 | 331 if ( !v15 ) |
332 { | |
730 | 333 LODWORD(v19) = (y - word_721390_ys[i]) << 16; |
334 HIDWORD(v19) = (y - word_721390_ys[i]) >> 16; | |
335 v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]); | |
723 | 336 if ( v16 >= x) |
337 ++v53; | |
338 } | |
729 | 339 }*/ |
0 | 340 } |
341 v48 = v50; | |
723 | 342 } |
0 | 343 if ( v53 == 1 ) |
344 { | |
345 if ( v55 >= 50 ) | |
346 break; | |
723 | 347 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 348 { |
725 | 349 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 350 } |
351 else | |
352 { | |
725 | 353 v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) |
0 | 354 + HIWORD(pFloor->zCalc3); |
355 } | |
356 v22 = v55++; | |
725 | 357 blv_floor_level[v22] = v21; |
730 | 358 blv_floor_id[v22] = pSector->pFloors[i]; |
0 | 359 } |
360 } | |
361 } | |
362 } | |
363 if ( pSector->field_0 & 8 ) | |
364 { | |
365 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
366 { | |
367 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
368 if (portal->uPolygonType != POLYGON_Floor) | |
369 continue; | |
370 | |
723 | 371 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
372 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
373 { | |
0 | 374 for (uint j = 0; j < portal->uNumVertices; ++j) |
375 { | |
730 | 376 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
377 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
378 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
379 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
380 } | |
381 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
382 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 383 v54 = 0; |
730 | 384 v49 = word_721390_ys[0] >= y; |
435 | 385 if ( portal->uNumVertices > 0 ) |
0 | 386 { |
723 | 387 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) |
0 | 388 { |
389 if ( v54 >= 2 ) | |
390 break; | |
730 | 391 v47 = word_721390_ys[i + 1] >= y; |
0 | 392 if ( v49 != v47 ) |
393 { | |
730 | 394 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; |
395 v29 = v28 | word_721460_xs[i] < x; | |
0 | 396 if ( v29 != 3 ) |
397 { | |
723 | 398 if ( !v29 ) |
729 | 399 ++v54; |
400 else | |
401 { | |
730 | 402 //v30 = word_721390_ys[v27]; |
403 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
404 v32 = y - word_721390_ys[i]; | |
729 | 405 LODWORD(v33) = v32 << 16; |
406 HIDWORD(v33) = v32 >> 16; | |
730 | 407 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x) |
723 | 408 ++v54; |
729 | 409 } |
0 | 410 } |
411 } | |
412 v49 = v47; | |
413 } | |
414 if ( v54 == 1 ) | |
415 { | |
416 if ( v55 >= 50 ) | |
417 break; | |
418 v34 = v55++; | |
725 | 419 blv_floor_level[v34] = -29000; |
730 | 420 blv_floor_id[v34] = pSector->pPortals[i]; |
0 | 421 } |
422 } | |
423 } | |
424 } | |
425 } | |
426 if ( v55 == 1 ) | |
427 { | |
730 | 428 *pFaceID = blv_floor_id[0]; |
725 | 429 return blv_floor_level[0]; |
0 | 430 } |
431 if ( !v55 ) | |
432 return -30000; | |
730 | 433 *pFaceID = blv_floor_id[0]; |
725 | 434 //result = blv_floor_level[0]; |
0 | 435 if ( v55 > 1 ) |
436 { | |
717 | 437 for ( v35 = 1; v35 < v55; ++v35 ) |
0 | 438 { |
725 | 439 if ( blv_floor_level[0] <= z + 5 ) |
440 { | |
441 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 442 continue; |
725 | 443 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 444 *pFaceID = blv_floor_id[v35]; |
717 | 445 continue; |
446 } | |
725 | 447 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
448 { | |
449 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 450 *pFaceID = blv_floor_id[v35]; |
717 | 451 } |
452 } | |
0 | 453 } |
725 | 454 return blv_floor_level[0]; |
0 | 455 } |
456 | |
457 //----- (0046D49E) -------------------------------------------------------- | |
723 | 458 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7) |
0 | 459 { |
723 | 460 BSPModel *pBModel; // esi@4 |
461 ODMFace *pFace; // ecx@11 | |
0 | 462 int v14; // edx@20 |
463 signed int v18; // edx@26 | |
464 int v19; // eax@28 | |
465 int v20; // edx@30 | |
466 int v21; // ST1C_4@30 | |
467 signed int v22; // edx@30 | |
468 signed __int64 v23; // qtt@30 | |
469 int v24; // eax@36 | |
470 signed int v25; // ecx@38 | |
471 int result; // eax@42 | |
472 signed int v27; // ecx@43 | |
473 int v28; // edi@44 | |
474 signed int v29; // edx@44 | |
475 int v30; // esi@45 | |
476 int v31; // eax@45 | |
477 ODMFace *v32; // eax@57 | |
478 int v33; // ecx@59 | |
479 int v36; // [sp+14h] [bp-2Ch]@24 | |
480 int v38; // [sp+1Ch] [bp-24h]@2 | |
481 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 482 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
483 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 484 bool v43; // [sp+30h] [bp-10h]@22 |
485 bool v44; // [sp+34h] [bp-Ch]@24 | |
486 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
487 signed int v48; // [sp+58h] [bp+18h]@22 | |
488 signed int v49; // [sp+58h] [bp+18h]@43 | |
489 | |
490 v46 = 1; | |
491 dword_721160[0] = -1; | |
492 dword_721110[0] = -1; | |
725 | 493 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7); |
0 | 494 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 495 { |
496 *a6 = 0; | |
725 | 497 return odm_floor_level[0]; |
723 | 498 } |
0 | 499 v38 = 0; |
723 | 500 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
501 { | |
502 pBModel = &pOutdoor->pBModels[v38]; | |
503 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
504 { | |
505 if ( (signed int)pBModel->uNumFaces > 0 ) | |
506 { | |
507 v39 = 0; | |
508 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
509 { | |
510 pFace = &pBModel->pFaces[v39]; | |
511 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
512 && !(pFace->uAttributes & 0x20000000) | |
513 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
514 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 515 { |
723 | 516 if ( pFace->uNumVertices ) |
0 | 517 { |
723 | 518 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 519 { |
723 | 520 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
521 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
522 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
523 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
524 } | |
525 } | |
526 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
527 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
528 v43 = word_720F70[0] >= Y; | |
529 v48 = 0; | |
530 if ( 2 * pFace->uNumVertices > 0 ) | |
531 { | |
532 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
533 { | |
534 if ( v48 >= 2 ) | |
535 break; | |
536 v36 = word_720F70[i + 1]; | |
537 v44 = word_720F70[i + 1] >= Y; | |
538 if ( v43 != v44 ) | |
0 | 539 { |
723 | 540 v18 = word_721040[i + 1] >= X ? 0 : 2; |
541 v19 = v18 | word_721040[i] < X; | |
542 if ( v19 != 3 ) | |
0 | 543 { |
723 | 544 if ( !v19 ) |
740 | 545 ++v48; |
546 else | |
0 | 547 { |
723 | 548 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
549 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
550 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
551 if ( v22 >= X) | |
552 ++v48; | |
0 | 553 } |
554 } | |
555 } | |
723 | 556 v43 = v44; |
557 } | |
558 if ( v48 == 1 ) | |
559 { | |
560 if ( v46 >= 20 ) | |
0 | 561 break; |
723 | 562 if ( pFace->uPolygonType == POLYGON_Floor ) |
563 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
564 else | |
725 | 565 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
566 + HIWORD(pFace->zCalc3); | |
723 | 567 v25 = v46++; |
725 | 568 odm_floor_level[v25] = v24; |
723 | 569 dword_721160[v25] = pBModelNum; |
570 dword_721110[v25] = pFaceNum; | |
0 | 571 } |
572 } | |
573 } | |
723 | 574 ++v39; |
575 } | |
576 } | |
577 } | |
0 | 578 ++v38; |
579 } | |
580 if ( v46 == 1 ) | |
581 { | |
582 *a6 = 0; | |
725 | 583 return odm_floor_level[0]; |
0 | 584 } |
585 v27 = 0; | |
586 if ( v46 <= 1 ) | |
587 *a6 = 0; | |
723 | 588 else |
589 { | |
725 | 590 //v29 = 1; |
723 | 591 for ( v49 = 1; v49 < v46; ++v49 ) |
592 { | |
725 | 593 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 594 { |
595 v27 = v49; | |
725 | 596 //++v29; |
723 | 597 break; |
598 } | |
725 | 599 if ( odm_floor_level[0] > Z + 5 ) |
600 { | |
601 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
602 { | |
603 //++v29; | |
723 | 604 break; |
605 } | |
606 v27 = v49; | |
725 | 607 //++v29; |
723 | 608 break; |
609 } | |
725 | 610 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 611 { |
612 v27 = v49; | |
725 | 613 //++v29; |
723 | 614 } |
615 } | |
616 if ( !v27 ) | |
617 *a6 = 0; | |
618 else | |
619 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
620 } | |
0 | 621 if ( v27 ) |
622 { | |
623 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
624 *a5 = 0; | |
625 if ( v32->uAttributes & 0x10 ) | |
626 *a5 = 1; | |
627 } | |
725 | 628 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
629 odm_floor_level[0] = odm_floor_level[v27]; | |
630 return odm_floor_level[0]; | |
0 | 631 } |
632 | |
633 //----- (0046D8E3) -------------------------------------------------------- | |
634 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
635 { | |
636 int v4; // ebx@1 | |
637 unsigned int v5; // ecx@1 | |
638 BSPModel *v6; // edi@3 | |
639 ODMFace *v7; // esi@10 | |
640 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
641 signed __int16 *v9; // eax@18 |
0 | 642 int v10; // edx@19 |
643 int v11; // ecx@21 | |
644 int v12; // ecx@23 | |
645 signed int v13; // eax@25 | |
646 int v14; // edx@27 | |
647 int v15; // edx@29 | |
648 int v16; // ST18_4@29 | |
649 signed int v17; // edx@29 | |
650 signed __int64 v18; // qtt@29 | |
651 int v19; // eax@35 | |
652 signed int v20; // ecx@37 | |
653 signed int v22; // ebx@42 | |
654 unsigned int v23; // esi@43 | |
655 int v24; // edx@44 | |
656 int v25; // eax@44 | |
657 int v26; // [sp+Ch] [bp-38h]@7 | |
658 int v27; // [sp+10h] [bp-34h]@21 | |
659 int v28; // [sp+18h] [bp-2Ch]@21 | |
660 int v29; // [sp+1Ch] [bp-28h]@2 | |
661 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
662 signed int v31; // [sp+24h] [bp-20h]@1 | |
663 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
664 int v33; // [sp+2Ch] [bp-18h]@7 | |
665 bool v34; // [sp+30h] [bp-14h]@21 | |
666 bool v35; // [sp+34h] [bp-10h]@23 | |
667 signed int v36; // [sp+38h] [bp-Ch]@17 | |
668 signed int v37; // [sp+38h] [bp-Ch]@21 | |
669 signed int v38; // [sp+38h] [bp-Ch]@42 | |
670 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
671 signed int v40; // [sp+40h] [bp-4h]@1 | |
672 | |
673 dword_720ED0[0] = -1; | |
674 dword_720E80[0] = -1; | |
675 v4 = a1; | |
676 v5 = 0; | |
677 v40 = a2; | |
678 v31 = v4; | |
679 v39 = 1; | |
680 dword_720F20[0] = 10000; | |
681 v32 = 0; | |
682 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
683 { | |
684 v29 = 0; | |
685 do | |
686 { | |
687 v6 = &pOutdoor->pBModels[v29]; | |
688 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
689 { | |
690 if ( v4 >= v6->sMinX ) | |
691 { | |
692 if ( v40 <= v6->sMaxY ) | |
693 { | |
694 if ( v40 >= v6->sMinY ) | |
695 { | |
696 v33 = v5; | |
697 v26 = v6->uNumFaces; | |
698 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
699 { | |
700 v30 = v5; | |
701 while ( 1 ) | |
702 { | |
703 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
704 v8 = v7->uPolygonType; | |
705 if ( (v8 == 5 || v8 == 6) | |
706 && !(BYTE3(v7->uAttributes) & 0x20) | |
707 && v4 <= v7->pBoundingBox.x2 | |
708 && v4 >= v7->pBoundingBox.x1 | |
709 && v40 <= v7->pBoundingBox.y2 | |
710 && v40 >= v7->pBoundingBox.y1 ) | |
711 { | |
712 v36 = v5; | |
713 if ( v7->uNumVertices ) | |
714 { | |
715 v9 = v7->pXInterceptDisplacements; | |
716 do | |
717 { | |
718 v10 = 2 * v36; | |
719 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
720 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
721 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
722 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
723 ++v9; | |
724 } | |
725 while ( v36 < v7->uNumVertices ); | |
726 v4 = v31; | |
727 } | |
728 v27 = 2 * v7->uNumVertices; | |
729 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
730 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
731 v11 = 0; | |
732 v34 = word_720CE0_ys[0] >= v40; | |
733 v37 = 0; | |
734 v28 = 0; | |
735 if ( v27 > 0 ) | |
736 { | |
737 do | |
738 { | |
739 if ( v37 >= 2 ) | |
740 break; | |
741 v12 = v11; | |
742 v4 = v31; | |
743 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
744 if ( v34 != v35 ) | |
745 { | |
746 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
747 v14 = v13 | word_720DB0_xs[v12] < v31; | |
748 if ( v14 != 3 ) | |
749 { | |
750 if ( !v14 | |
751 || (v15 = word_720CE0_ys[v12], | |
752 v16 = word_720CE0_ys[v12 + 1] - v15, | |
753 v17 = v40 - v15, | |
754 LODWORD(v18) = v17 << 16, | |
755 HIDWORD(v18) = v17 >> 16, | |
756 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
757 - (signed int)word_720DB0_xs[v12]) | |
758 * v18 | |
759 / v16) >> 16) | |
760 + word_720DB0_xs[v12]) >= v31) ) | |
761 ++v37; | |
762 } | |
763 } | |
764 v11 = v28 + 1; | |
765 v34 = v35; | |
766 ++v28; | |
767 } | |
768 while ( v28 < v27 ); | |
769 if ( v37 == 1 ) | |
770 { | |
771 if ( v39 >= 20 ) | |
772 break; | |
773 if ( v7->uPolygonType == 5 ) | |
774 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
775 else | |
776 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
777 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
778 + HIWORD(v7->zCalc3); | |
779 v20 = v39++; | |
780 dword_720F20[v20] = v19; | |
781 dword_720ED0[v20] = v32; | |
782 dword_720E80[v20] = v33; | |
783 } | |
784 } | |
785 } | |
786 ++v33; | |
787 v30 += 308; | |
788 if ( v33 >= v26 ) | |
789 break; | |
790 v5 = 0; | |
791 } | |
792 } | |
793 } | |
794 } | |
795 } | |
796 } | |
797 ++v32; | |
798 ++v29; | |
799 v5 = 0; | |
800 } | |
801 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
802 if ( !v39 ) | |
803 { | |
804 *(int *)a4 = 0; | |
805 return dword_720F20[0]; | |
806 } | |
807 } | |
808 v22 = 0; | |
809 v38 = v5; | |
810 if ( v39 <= (signed int)v5 ) | |
811 goto LABEL_54; | |
812 v23 = 0; | |
813 do | |
814 { | |
815 v24 = dword_720F20[v5 / 4]; | |
816 v25 = *(int *)((char *)dword_720F20 + v23); | |
817 if ( v24 == v25 ) | |
818 goto LABEL_50; | |
819 if ( v25 > a3 + 15 ) | |
820 { | |
821 if ( v24 >= v25 ) | |
822 goto LABEL_51; | |
823 LABEL_50: | |
824 v22 = v38; | |
825 v23 = v5; | |
826 goto LABEL_51; | |
827 } | |
828 if ( v24 > v25 && v24 <= a3 + 15 ) | |
829 goto LABEL_50; | |
830 LABEL_51: | |
831 ++v38; | |
832 v5 += 4; | |
833 } | |
834 while ( v38 < v39 ); | |
835 if ( v22 ) | |
836 { | |
837 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
838 return dword_720F20[v22]; | |
839 } | |
840 LABEL_54: | |
841 *(int *)a4 = 0; | |
842 return dword_720F20[v22]; | |
843 } | |
844 | |
138 | 845 |
846 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal | |
847 // for a right-handed system, that would be an inverse normal | |
0 | 848 //----- (0046DCC8) -------------------------------------------------------- |
138 | 849 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
850 { | |
851 auto grid_x = WorldPosToGridCellX(pos_x); | |
852 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
853 | |
854 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
855 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
856 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
857 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
858 | |
859 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
860 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
861 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
862 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
863 | |
864 float side1_dx, side1_dy, side1_dz, | |
865 side2_dx, side2_dy, side2_dz; | |
866 | |
867 auto dx = abs(pos_x - grid_pos_x1), | |
868 dz = abs(grid_pos_z1 - pos_z); | |
869 if (dz >= dx) | |
870 { | |
871 side1_dy = (double)(x1z1_y - x1z2_y); | |
872 side2_dy = (double)(x2z2_y - x1z2_y); | |
873 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
874 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
875 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
876 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 877 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 878 /* |\ |
879 side1 | \ | |
880 |____\ | |
881 side 2 */ | |
882 } | |
883 else | |
884 { | |
885 side1_dy = (double)(x2z2_y - x2z1_y); | |
886 side2_dy = (double)(x1z1_y - x2z1_y); | |
887 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
888 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
889 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
890 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
891 | |
892 /* side 2 | |
893 _____ | |
894 \ | | |
895 \ | side 1 | |
896 \| */ | |
897 } | |
898 | |
899 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
900 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
901 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
902 | |
903 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
904 if (fabsf(mag) < 1e-6f) | |
905 { | |
906 out->y = 0; | |
907 out->x = 0; | |
908 out->z = 65536; | |
909 } | |
910 else | |
911 { | |
912 float invmag = 1.0 / mag; | |
913 out->x = invmag * nx * 65536.0; | |
914 out->y = invmag * ny * 65536.0; | |
915 out->z = invmag * nz * 65536.0; | |
916 } | |
917 } | |
918 | |
0 | 919 |
920 //----- (0046DEF2) -------------------------------------------------------- | |
921 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
922 { | |
923 unsigned int result; // eax@1 | |
924 | |
925 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
926 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 927 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
928 return result; | |
929 } | |
930 | |
931 //----- (0046DF1A) -------------------------------------------------------- | |
932 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
933 { | |
934 Actor *v2; // edi@1 | |
935 unsigned __int16 v3; // ax@1 | |
936 int v4; // esi@6 | |
937 int v5; // ecx@8 | |
938 int v6; // eax@10 | |
939 int v7; // edx@12 | |
940 int v8; // ecx@14 | |
941 int v9; // eax@14 | |
942 int v10; // ebx@14 | |
943 int v11; // esi@14 | |
944 int v12; // ebx@15 | |
945 int v13; // ebx@17 | |
946 unsigned int v14; // eax@20 | |
947 signed int result; // eax@21 | |
948 int v16; // [sp+Ch] [bp-10h]@1 | |
949 int v17; // [sp+10h] [bp-Ch]@14 | |
950 int v18; // [sp+14h] [bp-8h]@14 | |
951 int v19; // [sp+18h] [bp-4h]@14 | |
952 | |
953 v16 = a1; | |
954 v2 = &pActors[a1]; | |
955 v3 = v2->uAIState; | |
956 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
957 goto LABEL_25; | |
958 v4 = v2->uActorRadius; | |
959 if ( a2 ) | |
960 v4 = a2; | |
961 v5 = v2->vPosition.x; | |
962 if ( stru_721530.sMaxX > v5 + v4 | |
963 || stru_721530.sMinX < v5 - v4 | |
964 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
965 || stru_721530.sMinY < v6 - v4 | |
966 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
967 || stru_721530.sMinZ < v7 | |
968 || (v8 = v5 - stru_721530.normal.x, | |
969 v9 = v6 - stru_721530.normal.y, | |
970 v10 = stru_721530.prolly_normal_d + v4, | |
971 v17 = stru_721530.prolly_normal_d + v4, | |
972 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
973 v18 = v8, | |
974 v19 = v9, | |
975 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
976 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
977 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
978 { | |
979 LABEL_25: | |
980 result = 0; | |
981 } | |
982 else | |
983 { | |
295 | 984 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 985 if ( v13 < 0 ) |
986 v13 = 0; | |
987 if ( v13 < stru_721530.field_7C ) | |
988 { | |
989 stru_721530.field_7C = v13; | |
990 v14 = 8 * v16; | |
991 LOBYTE(v14) = 8 * v16 | 3; | |
992 stru_721530.uFaceID = v14; | |
993 } | |
994 result = 1; | |
995 } | |
996 return result; | |
997 } | |
998 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
999 | |
1000 //----- (0046E0B2) -------------------------------------------------------- | |
1001 void __cdecl _46E0B2_collide_against_decorations() | |
1002 { | |
1003 BLVSector *v0; // ebp@1 | |
1004 LevelDecoration *v1; // edi@2 | |
1005 DecorationDesc *v2; // esi@3 | |
1006 int v3; // edx@4 | |
1007 int v4; // eax@4 | |
1008 int v5; // ecx@6 | |
1009 int v6; // ebx@8 | |
1010 int v7; // esi@8 | |
1011 int v8; // ebx@10 | |
1012 int v9; // esi@11 | |
1013 int v10; // edi@12 | |
1014 int v11; // eax@12 | |
1015 int v12; // esi@14 | |
1016 unsigned int v13; // eax@17 | |
1017 signed int i; // [sp+4h] [bp-14h]@1 | |
1018 int v15; // [sp+8h] [bp-10h]@10 | |
1019 int v16; // [sp+Ch] [bp-Ch]@10 | |
1020 int v17; // [sp+10h] [bp-8h]@10 | |
1021 int v18; // [sp+14h] [bp-4h]@8 | |
1022 | |
1023 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1024 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1025 { | |
1026 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1027 if ( !(v1->field_2 & 0x20) ) | |
1028 { | |
1029 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1030 if (!v2->CanMoveThrough()) |
0 | 1031 { |
1032 v3 = v2->uRadius; | |
1033 v4 = v1->vPosition.x; | |
1034 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1035 { | |
1036 if ( stru_721530.sMinX >= v4 - v3 ) | |
1037 { | |
1038 v5 = v1->vPosition.y; | |
1039 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1040 { | |
1041 if ( stru_721530.sMinY >= v5 - v3 ) | |
1042 { | |
1043 v6 = v2->uDecorationHeight; | |
1044 v7 = v1->vPosition.z; | |
1045 v18 = v6; | |
1046 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1047 { | |
1048 if ( stru_721530.sMinZ >= v7 ) | |
1049 { | |
1050 v16 = v4 - stru_721530.normal.x; | |
1051 v15 = v5 - stru_721530.normal.y; | |
1052 v8 = stru_721530.prolly_normal_d + v3; | |
1053 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1054 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1055 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1056 { | |
1057 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1058 if ( v9 > 0 ) | |
1059 { | |
1060 v10 = v1->vPosition.z; | |
1061 v11 = stru_721530.normal.z | |
1062 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1063 if ( v11 >= v10 ) | |
1064 { | |
1065 if ( v11 <= v18 + v10 ) | |
1066 { | |
295 | 1067 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1068 if ( v12 < 0 ) |
1069 v12 = 0; | |
1070 if ( v12 < stru_721530.field_7C ) | |
1071 { | |
1072 stru_721530.field_7C = v12; | |
1073 v13 = 8 * v0->pDecorationIDs[i]; | |
1074 LOBYTE(v13) = v13 | 5; | |
1075 stru_721530.uFaceID = v13; | |
1076 } | |
1077 } | |
1078 } | |
1079 } | |
1080 } | |
1081 } | |
1082 } | |
1083 } | |
1084 } | |
1085 } | |
1086 } | |
1087 } | |
1088 } | |
1089 } | |
1090 } | |
1091 | |
1092 //----- (0046E26D) -------------------------------------------------------- | |
1093 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1094 { | |
1095 int v2; // edx@5 | |
1096 unsigned __int16 *v3; // eax@5 | |
1097 unsigned __int16 v4; // ax@6 | |
1098 LevelDecoration *v5; // edi@7 | |
1099 DecorationDesc *v6; // esi@8 | |
1100 int v7; // edx@9 | |
1101 int v8; // eax@9 | |
1102 int v9; // ecx@11 | |
1103 int v10; // ebx@13 | |
1104 int v11; // esi@13 | |
1105 int v12; // ebp@15 | |
1106 int v13; // ebx@15 | |
1107 int v14; // esi@16 | |
1108 int v15; // edi@17 | |
1109 int v16; // eax@17 | |
1110 int v17; // esi@19 | |
1111 char v18; // zf@23 | |
1112 int v19; // [sp+0h] [bp-10h]@15 | |
1113 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1114 int v21; // [sp+8h] [bp-8h]@15 | |
1115 int v22; // [sp+Ch] [bp-4h]@13 | |
1116 | |
1117 if ( a1 >= 0 ) | |
1118 { | |
1119 if ( a1 <= 127 ) | |
1120 { | |
1121 if ( a2 >= 0 ) | |
1122 { | |
1123 if ( a2 <= 127 ) | |
1124 { | |
1125 v2 = a1 + (a2 << 7); | |
1126 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1127 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1128 if ( v3 ) | |
1129 { | |
1130 do | |
1131 { | |
1132 v4 = *v3; | |
141 | 1133 if ( (v4 & 7) == OBJECT_Decoration) |
0 | 1134 { |
1135 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1136 if ( !(v5->field_2 & 0x20) ) | |
1137 { | |
1138 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1139 if (!v6->CanMoveThrough()) |
0 | 1140 { |
1141 v7 = v6->uRadius; | |
1142 v8 = v5->vPosition.x; | |
1143 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1144 { | |
1145 if ( stru_721530.sMinX >= v8 - v7 ) | |
1146 { | |
1147 v9 = v5->vPosition.y; | |
1148 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1149 { | |
1150 if ( stru_721530.sMinY >= v9 - v7 ) | |
1151 { | |
1152 v10 = v6->uDecorationHeight; | |
1153 v11 = v5->vPosition.z; | |
1154 v22 = v10; | |
1155 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1156 { | |
1157 if ( stru_721530.sMinZ >= v11 ) | |
1158 { | |
1159 v12 = v8 - stru_721530.normal.x; | |
1160 v19 = v9 - stru_721530.normal.y; | |
1161 v13 = stru_721530.prolly_normal_d + v7; | |
1162 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1163 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1164 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1165 { | |
1166 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1167 if ( v14 > 0 ) | |
1168 { | |
1169 v15 = v5->vPosition.z; | |
1170 v16 = stru_721530.normal.z | |
1171 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1172 if ( v16 >= v15 ) | |
1173 { | |
1174 if ( v16 <= v22 + v15 ) | |
1175 { | |
295 | 1176 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1177 if ( v17 < 0 ) |
1178 v17 = 0; | |
1179 if ( v17 < stru_721530.field_7C ) | |
1180 { | |
1181 stru_721530.field_7C = v17; | |
1182 stru_721530.uFaceID = (signed __int16)*v20; | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 } | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 } | |
1197 v3 = v20 + 1; | |
1198 v18 = *v20 == 0; | |
1199 ++v20; | |
1200 } | |
1201 while ( !v18 ); | |
1202 } | |
1203 } | |
1204 } | |
1205 } | |
1206 } | |
1207 } | |
1208 | |
1209 //----- (00486F92) -------------------------------------------------------- | |
1210 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1211 { | |
1212 Span *v0; // ebx@1 | |
1213 int v1; // eax@2 | |
1214 Edge *v2; // ecx@3 | |
1215 Edge *v3; // edx@3 | |
1216 Edge *v4; // esi@6 | |
1217 Edge *v5; // eax@7 | |
1218 Edge *v6; // ecx@8 | |
1219 Surf *v7; // esi@11 | |
1220 double v8; // st7@13 | |
1221 Surf *v9; // edi@13 | |
1222 double v10; // st6@13 | |
1223 double v11; // st7@14 | |
1224 signed __int64 v12; // qax@14 | |
1225 stru148 *v13; // eax@15 | |
1226 Span *v14; // ecx@17 | |
1227 double v15; // st7@28 | |
1228 signed __int64 v16; // qax@28 | |
1229 stru148 *v17; // eax@29 | |
1230 Span *v18; // ecx@31 | |
1231 Edge *i; // eax@40 | |
1232 Edge *v20; // ecx@43 | |
1233 Edge *v21; // esi@44 | |
1234 double v22; // st7@45 | |
1235 Edge *v23; // edx@48 | |
1236 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1237 float v25; // [sp+14h] [bp-Ch]@3 | |
1238 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1239 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1240 | |
1241 v0 = pSpans; | |
1242 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1243 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1244 stru_80C9A4.pSurf = &stru_80C980; |
1245 stru_80C980.pPrev = &stru_80C980; | |
1246 stru_80C980.pNext = &stru_80C980; | |
693 | 1247 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1248 stru_80C980.field_8 = 0.0; |
1249 stru_80C980.field_4 = 0.0; | |
1250 stru_80C9D8.pNext = &stru_80C9A4; | |
1251 stru_80C9D8.pPrev = 0; | |
1252 stru_80C9D8.field_8 = 1; | |
1253 stru_80C9A4.pNext = 0; | |
1254 stru_80C9A4.pPrev = &stru_80C9D8; | |
1255 stru_80C9A4.field_8 = 0; | |
1256 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1257 v27 = pViewport->uViewportTL_Y; |
1258 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1259 { |
1260 LABEL_51: | |
1261 v0->field_8 = -1; | |
1262 } | |
1263 else | |
1264 { | |
693 | 1265 v1 = 52 * pViewport->uViewportTL_Y; |
1266 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1267 while ( 1 ) |
1268 { | |
1269 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1270 v3 = &stru_80C9D8; | |
1271 v25 = (double)(signed int)v27; | |
1272 if ( v2 != &defaultEdge ) | |
1273 { | |
1274 do | |
1275 { | |
1276 while ( 1 ) | |
1277 { | |
1278 v4 = v3->pNext; | |
1279 if ( v2->field_0 <= (double)v4->field_0 ) | |
1280 break; | |
1281 v3 = v3->pNext; | |
1282 } | |
1283 v5 = v2->pNext; | |
1284 v2->pNext = v4; | |
1285 v2->pPrev = v3; | |
1286 v3->pNext->pPrev = v2; | |
1287 v3->pNext = v2; | |
1288 v3 = v2; | |
1289 v2 = v5; | |
1290 } | |
1291 while ( v5 != &defaultEdge ); | |
1292 } | |
1293 v6 = stru_80C9D8.pNext; | |
1294 stru_80C980.field_20 = 0; | |
1295 stru_80C980.field_22 = 1; | |
1296 v26 = stru_80C9D8.pNext; | |
1297 if ( stru_80C9D8.pNext ) | |
1298 { | |
1299 while ( 1 ) | |
1300 { | |
1301 v7 = v6->pSurf; | |
1302 if ( v6->field_8 ) | |
1303 { | |
1304 ++v7->field_22; | |
1305 if ( v7->field_22 == 1 ) | |
1306 { | |
1307 v8 = v6->field_0 + 2.0; | |
1308 v9 = stru_80C980.pNext; | |
1309 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1310 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1311 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1312 + stru_80C980.pNext->field_0 ) | |
1313 { | |
1314 do | |
1315 v9 = v9->pNext; | |
1316 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1317 v7->pNext = v9; | |
1318 v7->pPrev = v9->pPrev; | |
1319 v9->pPrev->pNext = v7; | |
1320 v9->pPrev = v7; | |
1321 } | |
1322 else | |
1323 { | |
1324 v11 = v6->field_0 + 0.5; | |
1325 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1326 v0->field_C = v12; | |
1327 if ( (signed __int16)v12 > 0 ) | |
1328 { | |
1329 v0->field_A = v27; | |
1330 v0->field_8 = v9->field_20; | |
1331 v13 = v9->pParent; | |
1332 v0->pParent = v13; | |
1333 if ( v13 ) | |
1334 { | |
1335 if ( v13->prolly_head ) | |
1336 { | |
1337 v14 = v13->prolly_tail; | |
1338 if ( !v14 ) | |
1339 return; | |
1340 v14->pNext = v0; | |
1341 } | |
1342 else | |
1343 { | |
1344 v13->prolly_head = v0; | |
1345 } | |
1346 v13->prolly_tail = v0; | |
1347 } | |
1348 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1349 return; | |
1350 ++v0; | |
1351 ++pOutdoorCamera->uNumSpans; | |
1352 } | |
1353 v6 = v26; | |
1354 v7->field_20 = (signed __int64)v11; | |
1355 v7->pNext = v9; | |
1356 v9->pPrev = v7; | |
1357 stru_80C980.pNext = v7; | |
1358 v7->pPrev = &stru_80C980; | |
1359 } | |
1360 } | |
1361 } | |
1362 else | |
1363 { | |
1364 --v7->field_22; | |
1365 if ( !v7->field_22 ) | |
1366 { | |
1367 if ( stru_80C980.pNext == v7 ) | |
1368 { | |
1369 v15 = v6->field_0 + 0.5; | |
1370 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1371 v0->field_C = v16; | |
1372 if ( (signed __int16)v16 > 0 ) | |
1373 { | |
1374 v0->field_A = v27; | |
1375 v0->field_8 = v7->field_20; | |
1376 v17 = v7->pParent; | |
1377 v0->pParent = v17; | |
1378 if ( v17 ) | |
1379 { | |
1380 if ( v17->prolly_head ) | |
1381 { | |
1382 v18 = v17->prolly_tail; | |
1383 if ( !v18 ) | |
1384 return; | |
1385 v18->pNext = v0; | |
1386 } | |
1387 else | |
1388 { | |
1389 v17->prolly_head = v0; | |
1390 } | |
1391 v17->prolly_tail = v0; | |
1392 } | |
1393 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1394 return; | |
1395 ++v0; | |
1396 ++pOutdoorCamera->uNumSpans; | |
1397 } | |
1398 v7->pNext->field_20 = (signed __int64)v15; | |
1399 v6 = v26; | |
1400 } | |
1401 v7->pNext->pPrev = v7->pPrev; | |
1402 v7->pPrev->pNext = v7->pNext; | |
1403 } | |
1404 } | |
1405 v26 = v6->pNext; | |
1406 if ( !v26 ) | |
1407 break; | |
1408 v6 = v6->pNext; | |
1409 } | |
1410 } | |
1411 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1412 { | |
1413 i->pPrev->pNext = i->pNext; | |
1414 i->pNext->pPrev = i->pPrev; | |
1415 } | |
1416 v20 = stru_80C9D8.pNext; | |
1417 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1418 break; | |
1419 LABEL_50: | |
1420 ++v27; | |
1421 v1 = v24 + 52; | |
1422 v24 += 52; | |
693 | 1423 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1424 goto LABEL_51; |
1425 } | |
1426 while ( 1 ) | |
1427 { | |
1428 v21 = v20->pNext; | |
1429 if ( !v21 ) | |
1430 break; | |
1431 v22 = v20->field_4 + v20->field_0; | |
1432 v20->field_0 = v22; | |
1433 if ( v22 < stru_80C9D8.field_0 ) | |
1434 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1435 while ( 1 ) | |
1436 { | |
1437 v23 = v20->pPrev; | |
1438 if ( v20->field_0 >= (double)v23->field_0 ) | |
1439 break; | |
1440 v23->pNext = v20->pNext; | |
1441 v20->pNext->pPrev = v23; | |
1442 v23->pPrev->pNext = v20; | |
1443 v20->pPrev = v23->pPrev; | |
1444 v20->pNext = v23; | |
1445 v23->pPrev = v20; | |
1446 } | |
1447 v20 = v21; | |
1448 if ( v21 == &stru_80C9A4 ) | |
1449 goto LABEL_50; | |
1450 } | |
1451 } | |
1452 } | |
1453 // 4EC3EC: using guessed type Edge defaultEdge; | |
1454 | |
1455 | |
1456 | |
1457 //----- (00487355) -------------------------------------------------------- | |
1458 bool OutdoorCamera::_487355() | |
1459 { | |
1460 int v0; // esi@1 | |
1461 stru148 *v1; // edi@2 | |
1462 bool result; // eax@3 | |
1463 | |
1464 v0 = 0; | |
1465 if ( pOutdoorCamera->numStru148s > 0 ) | |
1466 { | |
1467 v1 = array_77EC08; | |
1468 do | |
1469 { | |
1470 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1471 ++v0; | |
1472 ++v1; | |
1473 } | |
1474 while ( v0 < pOutdoorCamera->numStru148s ); | |
1475 } | |
1476 return result; | |
1477 } | |
1478 | |
1479 | |
1480 | |
1481 //----- (00487DA9) -------------------------------------------------------- | |
1482 void __cdecl sub_487DA9() | |
1483 { | |
1484 char *v0; // eax@1 | |
1485 | |
1486 v0 = &array_77EC08[0].field_108; | |
1487 do | |
1488 { | |
1489 *v0 = 0; | |
1490 v0 += 268; | |
1491 } | |
1492 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1493 } | |
1494 | |
1495 //----- (00487DBE) -------------------------------------------------------- | |
1496 void Software_ResetNewEdges() | |
1497 { | |
1498 int v0; // ecx@1 | |
1499 Edge **v1; // eax@1 | |
1500 signed int v2; // eax@3 | |
1501 | |
1502 v0 = 0; | |
1503 v1 = ptr_80CA10; | |
1504 do | |
1505 { | |
1506 ++v0; | |
1507 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1508 *v1 = 0; | |
1509 ++v1; | |
1510 } | |
1511 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1512 v2 = 2000; | |
1513 do | |
1514 { | |
1515 pSurfs->field_22 = 0; | |
1516 --v2; | |
1517 } | |
1518 while ( v2 ); | |
1519 } | |
1520 // 4EC3EC: using guessed type Edge defaultEdge; | |
1521 | |
1522 | |
1523 | |
1524 | |
1525 | |
1526 //----- (0048958E) -------------------------------------------------------- | |
1527 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1528 { | |
1529 stru12_MemoryBlock *v2; // esi@1 | |
1530 void *v3; // eax@1 | |
1531 void *v4; // ecx@1 | |
1532 stru12_MemoryBlock *result; // eax@1 | |
1533 | |
1534 v2 = this; | |
1535 v3 = operator new(8 * a2 + 16); | |
1536 v2->pBlockBase = v3; | |
1537 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
1538 result = v2; | |
1539 v2->pAlignedBlock = v4; | |
1540 } | |
1541 | |
1542 //----- (004895B7) -------------------------------------------------------- | |
1543 stru12::stru12(stru11 *pStru11) | |
1544 { | |
1545 stru12 *v2; // esi@1 | |
1546 | |
1547 v2 = this; | |
1548 this->field_44 = 0x41000000u; | |
1549 this->field_4C = 0x46000000u; | |
1550 //this->vdestructor_ptr = stru12::_4898E6; | |
1551 this->field_48 = 0; | |
1552 this->field_50 = 0; | |
1553 this->field_54 = 0x33D6BF95u; | |
1554 this->field_58 = 0; | |
1555 | |
1556 for (int i = 0; i < 12; ++i) | |
1557 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1558 /* | |
1559 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1560 if ( v3 ) | |
1561 v4 = AllocAlignedMem(v3, 640); | |
1562 else | |
1563 v4 = 0; | |
1564 v2->pMemBlocks[0] = v4; | |
1565 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1566 if ( v5 ) | |
1567 v6 = AllocAlignedMem(v5, 640); | |
1568 else | |
1569 v6 = 0; | |
1570 v2->pMemBlocks[1] = v6; | |
1571 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1572 if ( v7 ) | |
1573 v8 = AllocAlignedMem(v7, 640); | |
1574 else | |
1575 v8 = 0; | |
1576 v2->pMemBlocks[2] = v8; | |
1577 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1578 if ( v9 ) | |
1579 v10 = AllocAlignedMem(v9, 640); | |
1580 else | |
1581 v10 = 0; | |
1582 v2->pMemBlocks[3] = v10; | |
1583 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1584 if ( v11 ) | |
1585 v12 = AllocAlignedMem(v11, 640); | |
1586 else | |
1587 v12 = 0; | |
1588 v2->pMemBlocks[4] = v12; | |
1589 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1590 if ( v13 ) | |
1591 v14 = AllocAlignedMem(v13, 640); | |
1592 else | |
1593 v14 = 0; | |
1594 v2->pMemBlocks[5] = v14; | |
1595 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1596 if ( v15 ) | |
1597 v16 = AllocAlignedMem(v15, 640); | |
1598 else | |
1599 v16 = 0; | |
1600 v2->pMemBlocks[6] = v16; | |
1601 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1602 if ( v17 ) | |
1603 v18 = AllocAlignedMem(v17, 640); | |
1604 else | |
1605 v18 = 0; | |
1606 v2->pMemBlocks[7] = v18; | |
1607 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1608 if ( v19 ) | |
1609 v20 = AllocAlignedMem(v19, 640); | |
1610 else | |
1611 v20 = 0; | |
1612 v2->pMemBlocks[8] = v20; | |
1613 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1614 if ( v21 ) | |
1615 v22 = AllocAlignedMem(v21, 640); | |
1616 else | |
1617 v22 = 0; | |
1618 v2->pMemBlocks[9] = v22; | |
1619 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1620 if ( v23 ) | |
1621 v24 = AllocAlignedMem(v23, 640); | |
1622 else | |
1623 v24 = 0; | |
1624 v2->pMemBlocks[10] = v24; | |
1625 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1626 if ( v25 ) | |
1627 v26 = AllocAlignedMem(v25, 640); | |
1628 else | |
1629 v26 = 0; | |
1630 v2->field_8C = 0; | |
1631 v2->pMemBlocks[11] = v26;*/ | |
1632 } | |
1633 | |
1634 //----- (00489810) -------------------------------------------------------- | |
1635 stru12::~stru12() | |
1636 { | |
1637 for (int i = 0; i < 12; ++i) | |
1638 delete pMemBlocks[i]; | |
1639 /*if ( v2 ) | |
1640 stru12_MemoryBlock::dtor(v2, 1); | |
1641 v3 = v1->pMemBlocks[1]; | |
1642 if ( v3 ) | |
1643 stru12_MemoryBlock::dtor(v3, 1); | |
1644 v4 = v1->pMemBlocks[2]; | |
1645 if ( v4 ) | |
1646 stru12_MemoryBlock::dtor(v4, 1); | |
1647 v5 = v1->pMemBlocks[3]; | |
1648 if ( v5 ) | |
1649 stru12_MemoryBlock::dtor(v5, 1); | |
1650 v6 = v1->pMemBlocks[4]; | |
1651 if ( v6 ) | |
1652 stru12_MemoryBlock::dtor(v6, 1); | |
1653 v7 = v1->pMemBlocks[5]; | |
1654 if ( v7 ) | |
1655 stru12_MemoryBlock::dtor(v7, 1); | |
1656 v8 = v1->pMemBlocks[6]; | |
1657 if ( v8 ) | |
1658 stru12_MemoryBlock::dtor(v8, 1); | |
1659 v9 = v1->pMemBlocks[7]; | |
1660 if ( v9 ) | |
1661 stru12_MemoryBlock::dtor(v9, 1); | |
1662 v10 = v1->pMemBlocks[8]; | |
1663 if ( v10 ) | |
1664 stru12_MemoryBlock::dtor(v10, 1); | |
1665 v11 = v1->pMemBlocks[9]; | |
1666 if ( v11 ) | |
1667 stru12_MemoryBlock::dtor(v11, 1); | |
1668 v12 = v1->pMemBlocks[10]; | |
1669 if ( v12 ) | |
1670 stru12_MemoryBlock::dtor(v12, 1); | |
1671 v13 = v1->pMemBlocks[11]; | |
1672 if ( v13 ) | |
1673 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1674 } | |
1675 | |
1676 //----- (004898BF) -------------------------------------------------------- | |
1677 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1678 { | |
1679 stru12_MemoryBlock *v2; // esi@1 | |
1680 void *v3; // ST00_4@1 | |
1681 | |
1682 v2 = this; | |
1683 v3 = this->pBlockBase; | |
1684 this->pAlignedBlock = 0; | |
1685 free(v3); | |
1686 v2->pBlockBase = 0; | |
1687 /*if ( a2 & 1 ) | |
1688 free(v2);*/ | |
1689 } | |
1690 | |
1691 //----- (004898E6) -------------------------------------------------------- | |
1692 void stru12::_4898E6() | |
1693 { | |
1694 void *v1; // eax@1 | |
1695 void *v2; // edx@1 | |
1696 char *v3; // edi@2 | |
1697 double v4; // st7@2 | |
1698 char *v5; // ebx@2 | |
1699 double v6; // st6@3 | |
1700 double v7; // st5@3 | |
1701 double v8; // st4@3 | |
1702 int v9; // esi@3 | |
1703 double v10; // st3@3 | |
1704 float v11; // ST34_4@5 | |
1705 double v12; // st6@10 | |
1706 double v13; // ST0C_8@10 | |
1707 char *v14; // [sp+14h] [bp-44h]@2 | |
1708 char *v15; // [sp+18h] [bp-40h]@2 | |
1709 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1710 char *v17; // [sp+20h] [bp-38h]@2 | |
1711 char *v18; // [sp+24h] [bp-34h]@2 | |
1712 float v19; // [sp+30h] [bp-28h]@3 | |
1713 float v20; // [sp+38h] [bp-20h]@3 | |
1714 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1715 int v22; // [sp+40h] [bp-18h]@1 | |
1716 char *v23; // [sp+44h] [bp-14h]@2 | |
1717 char *v24; // [sp+48h] [bp-10h]@2 | |
1718 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1719 float v26; // [sp+50h] [bp-8h]@3 | |
1720 float v27; // [sp+54h] [bp-4h]@3 | |
1721 | |
731 | 1722 __debugbreak(); |
0 | 1723 v22 = 0; |
1724 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1725 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1726 if ( this->field_8C > 0 ) | |
1727 { | |
1728 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1729 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1730 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1731 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1732 v25 = (int)v1 - (int)v2; | |
1733 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1734 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1735 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1736 v4 = 1.0; | |
1737 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1738 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1739 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1740 do | |
1741 { | |
1742 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1743 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1744 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1745 v7 = pIndoorCamera->fRotationYCosine; | |
1746 v8 = pIndoorCamera->fRotationYSine; | |
1747 v20 = pIndoorCamera->fRotationXCosine; | |
1748 v19 = pIndoorCamera->fRotationXSine; | |
1749 v9 = (int)((char *)v2 + (int)v21); | |
1750 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1751 if ( pIndoorCamera->sRotationX ) | |
1752 { | |
1753 v11 = v10; | |
1754 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1755 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1756 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1757 } | |
1758 else | |
1759 { | |
1760 *(float *)v9 = v10; | |
1761 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1762 *(float *)((char *)v2 + (int)v5) = v6; | |
1763 } | |
1764 if ( *(float *)v9 >= 8.0 ) | |
1765 { | |
1766 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1767 { | |
1768 *(int *)v2 = 0; | |
1769 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1770 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1771 - v12 * *(float *)((char *)v2 + (int)v3); | |
1772 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1773 - v12 * *(float *)((char *)v2 + (int)v5); | |
1774 *(float *)((char *)v2 + (int)v16) = v4 | |
1775 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1776 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1777 v13 = *(float *)v9 + 6.7553994e15; | |
1778 v4 = 1.0; | |
1779 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1780 } | |
1781 else | |
1782 { | |
1783 *(int *)v2 = 2; | |
1784 } | |
1785 } | |
1786 else | |
1787 { | |
1788 *(int *)v2 = 1; | |
1789 } | |
1790 ++v22; | |
1791 v2 = (char *)v2 + 4; | |
1792 } | |
1793 while ( v22 < this->field_8C ); | |
1794 } | |
1795 this->field_8C = 0; | |
1796 } | |
1797 | |
1798 | |
1799 | |
1800 | |
1801 | |
1802 //----- (0048A959) -------------------------------------------------------- | |
1803 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1804 { | |
1805 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1806 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1807 b = (uColor & 0x000000FF) / 255.0f; | |
1808 | |
1809 float h, s, v; | |
1810 RGB2HSV(&h, &s, r, g, b, &v); | |
1811 | |
1812 if ( h_replace != -1.0 ) | |
1813 h = h_replace; | |
1814 if ( s_replace != -1.0 ) | |
1815 s = s_replace; | |
1816 if ( v_replace != -1.0 ) | |
1817 v = v_replace; | |
1818 HSV2RGB(&r, &g, &b, h, s, v); | |
1819 | |
1820 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1821 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1822 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1823 } | |
1824 | |
1825 | |
1826 //----- (0048B561) -------------------------------------------------------- | |
1827 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1828 { | |
1829 //v2 = a2 - 0.5; | |
1830 //v3 = v2 + 6.7553994e15; | |
1831 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1832 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1833 //v5 = v7 + 6.7553994e15; | |
1834 //return LODWORD(v5) | (v4 << 16); | |
1835 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1836 return v5 | (v4 << 16); | |
1837 } | |
1838 | |
1839 | |
1840 | |
1841 | |
1842 | |
1843 | |
1844 //----- (00491E3A) -------------------------------------------------------- | |
1845 void __cdecl sub_491E3A() | |
1846 { | |
1847 Player *v0; // ebx@1 | |
1848 signed int v1; // esi@3 | |
1849 char *v2; // eax@4 | |
1850 unsigned int v3; // eax@7 | |
1851 unsigned int v4; // edx@8 | |
1852 char *v5; // ecx@9 | |
1853 int v6; // edi@17 | |
1854 Texture *v7; // ebx@18 | |
1855 struct IDirect3DTexture2 **v8; // eax@19 | |
1856 struct IDirect3DTexture2 *v9; // eax@20 | |
1857 struct IDirectDrawSurface **v10; // eax@22 | |
1858 struct IDirectDrawSurface *v11; // eax@23 | |
1859 int v12; // eax@26 | |
1860 | |
1861 v0 = pParty->pPlayers; | |
1862 do | |
1863 { | |
203 | 1864 if (SoundSetAction[24][0]) |
0 | 1865 { |
1866 v1 = 0; | |
764 | 1867 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1868 { |
1869 LABEL_7: | |
1870 v3 = 0; | |
1871 } | |
1872 else | |
1873 { | |
1874 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1875 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1876 { |
1877 ++v1; | |
1878 v2 += 120; | |
764 | 1879 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1880 goto LABEL_7; |
1881 } | |
1882 v3 = v1; | |
1883 } | |
764 | 1884 pSoundList->UnloadSound(v3, 1); |
0 | 1885 v4 = 0; |
764 | 1886 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1887 { |
1888 LABEL_12: | |
1889 v4 = 0; | |
1890 } | |
1891 else | |
1892 { | |
1893 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1894 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1895 { |
1896 ++v4; | |
1897 v5 += 120; | |
764 | 1898 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1899 goto LABEL_12; |
1900 } | |
1901 } | |
764 | 1902 pSoundList->UnloadSound(v4, 1); |
0 | 1903 } |
1904 ++v0; | |
1905 } | |
1906 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1907 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1908 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1909 { |
1910 v7 = &pIcons_LOD->pTextures[v6]; | |
1911 do | |
1912 { | |
1913 v7->Release(); | |
1914 v8 = pIcons_LOD->pHardwareTextures; | |
1915 if ( v8 ) | |
1916 { | |
1917 v9 = v8[v6]; | |
1918 if ( v9 ) | |
1919 { | |
1920 v9->Release(); | |
1921 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1922 } | |
1923 } | |
1924 v10 = pIcons_LOD->pHardwareSurfaces; | |
1925 if ( v10 ) | |
1926 { | |
1927 v11 = v10[v6]; | |
1928 if ( v11 ) | |
1929 { | |
1930 v11->Release(); | |
1931 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1932 } | |
1933 } | |
1934 --v6; | |
1935 --v7; | |
1936 } | |
33 | 1937 while ( v6 >= pIcons_LOD->pFacesLock ); |
1938 } | |
1939 v12 = pIcons_LOD->pFacesLock; | |
1940 pIcons_LOD->pFacesLock = 0; | |
0 | 1941 pIcons_LOD->uNumLoadedFiles = v12; |
1942 } | |
1943 // 4ED498: using guessed type char byte_4ED498; | |
1944 | |
706 | 1945 |
0 | 1946 |
1947 | |
1948 //----- (0049387A) -------------------------------------------------------- | |
1949 int CycleCharacter(unsigned int _this) | |
1950 { | |
1951 signed int result; // eax@1 | |
1952 signed int v2; // ecx@2 | |
1953 signed int v3; // ecx@8 | |
1954 | |
1955 result = uActiveCharacter; | |
1956 if ( _this ) | |
1957 { | |
1958 v2 = 0; | |
1959 while ( 1 ) | |
1960 { | |
1961 --result; | |
1962 if ( result < 1 ) | |
1963 result = 4; | |
1964 if ( !pPlayers[result]->uTimeToRecovery ) | |
1965 break; | |
1966 ++v2; | |
1967 if ( v2 >= 4 ) | |
1968 return uActiveCharacter; | |
1969 } | |
1970 } | |
1971 else | |
1972 { | |
1973 v3 = 0; | |
1974 while ( 1 ) | |
1975 { | |
1976 ++result; | |
1977 if ( result > 4 ) | |
1978 result = 1; | |
1979 if ( !pPlayers[result]->uTimeToRecovery ) | |
1980 break; | |
1981 ++v3; | |
1982 if ( v3 >= 4 ) | |
1983 return uActiveCharacter; | |
1984 } | |
1985 } | |
1986 return result; | |
1987 } | |
1988 | |
1989 //----- (004938D1) -------------------------------------------------------- | |
1990 void __fastcall Rest(unsigned int uHoursToSleep) | |
1991 { | |
1992 unsigned int v1; // esi@1 | |
1993 double v2; // st7@3 | |
1994 Player **v3; // esi@3 | |
1995 | |
1996 v1 = uHoursToSleep; | |
1997 if ( uHoursToSleep > 240 ) | |
1998 InitializeActors(); | |
1999 v2 = (double)(7680 * v1) * 0.033333335; | |
2000 pParty->uTimePlayed += (signed __int64)v2; | |
2001 v3 = &pPlayers[1]; | |
2002 do | |
2003 { | |
2004 (*v3)->Recover((signed __int64)v2); | |
2005 ++v3; | |
2006 } | |
2007 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
2008 _494035_timed_effects__water_walking_damage__etc(); | |
2009 } | |
2010 | |
2011 //----- (00493938) -------------------------------------------------------- | |
2012 int __cdecl _493938_regenerate() | |
2013 { | |
2014 int v0; // edi@1 | |
2015 signed __int64 v1; // qax@1 | |
2016 int v2; // ecx@1 | |
2017 int result; // eax@1 | |
2018 int v4; // eax@2 | |
2019 int v5; // edi@5 | |
112 | 2020 int *v6; // ecx@5 |
0 | 2021 char v7; // sf@5 |
112 | 2022 int *v8; // ecx@10 |
0 | 2023 int v9; // edi@15 |
2024 signed int v10; // eax@15 | |
2025 __int16 *v11; // edx@16 | |
2026 int v12; // eax@20 | |
2027 int v13; // ebx@20 | |
2028 unsigned int *v14; // esi@21 | |
2029 unsigned int v15; // ecx@21 | |
2030 unsigned int v16; // eax@21 | |
2031 int v17; // edx@21 | |
2032 int v18; // eax@21 | |
2033 signed int v19; // eax@21 | |
2034 signed int v20; // ebx@25 | |
2035 Player *v21; // esi@25 | |
2036 ITEM_EQUIP_TYPE v22; // edi@30 | |
2037 //int v23; // edx@31 | |
2038 signed int v24; // ecx@32 | |
2039 signed int v25; // eax@33 | |
2040 int v26; // eax@35 | |
2041 int v27; // eax@36 | |
2042 int v28; // eax@37 | |
2043 int v29; // eax@40 | |
2044 int v30; // eax@41 | |
2045 signed int v31; // ecx@53 | |
2046 char *v32; // eax@53 | |
2047 char *v33; // edi@82 | |
2048 int v34; // ecx@88 | |
2049 int v35; // eax@88 | |
2050 char *v36; // edi@99 | |
2051 int v37; // edi@104 | |
2052 int v38; // edi@106 | |
2053 int v39; // edi@111 | |
2054 int v40; // ecx@113 | |
2055 char v41[400]; // [sp+4h] [bp-22Ch]@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2056 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2057 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2058 int v44; // [sp+210h] [bp-20h]@22 | |
2059 int v45; // [sp+214h] [bp-1Ch]@25 | |
2060 int v46; // [sp+218h] [bp-18h]@25 | |
2061 int v47; // [sp+21Ch] [bp-14h]@25 | |
2062 int v48; // [sp+220h] [bp-10h]@25 | |
2063 int v49; // [sp+224h] [bp-Ch]@24 | |
2064 int v50; // [sp+228h] [bp-8h]@25 | |
2065 int v51; // [sp+22Ch] [bp-4h]@2 | |
2066 | |
2067 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2068 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2069 v2 = (signed int)v1 / 60; | |
2070 result = (signed int)v1 / 60 + 5; | |
2071 if ( v0 >= result ) | |
2072 { | |
2073 v51 = 0; | |
2074 v4 = (v0 - v2) / 5; | |
2075 if (pParty->FlyActive()) | |
2076 { | |
2077 if ( pParty->bFlying ) | |
2078 { | |
569 | 2079 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2080 { // colliding with something in the air - fall down | |
2081 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2082 //__debugbreak(); | |
2083 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2084 v7 = *v6 < v5; |
2085 *v6 -= v5; | |
0 | 2086 if ( v7 ) |
2087 { | |
112 | 2088 *v6 = 0; |
0 | 2089 pParty->uFlags &= 0xFFFFFFBFu; |
2090 pParty->bFlying = 0; | |
2091 v51 = 1; | |
2092 } | |
2093 } | |
2094 } | |
2095 } | |
569 | 2096 |
0 | 2097 if (pParty->WaterWalkActive()) |
2098 { | |
569 | 2099 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2100 { | |
2101 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2102 { // taking on water | |
2103 //__debugbreak(); | |
2104 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2105 v7 = *v8 < v4; |
2106 *v8 -= v4; | |
0 | 2107 if ( v7 ) |
2108 { | |
112 | 2109 *v8 = 0; |
569 | 2110 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2111 v51 = 1; |
2112 } | |
2113 } | |
2114 } | |
2115 } | |
569 | 2116 |
0 | 2117 if (pParty->ImmolationActive()) |
2118 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2119 //SpriteObject::SpriteObject(&a1); |
0 | 2120 v9 = 0; |
2121 a3.z = 0; | |
2122 a3.y = 0; | |
2123 a3.x = 0; | |
2124 a1.stru_24.Reset(); | |
2125 a1.field_4C = pParty->pPartyBuffs[10].uPower; | |
2126 a1.field_50 = pParty->ImmolationSkillLevel(); | |
2127 v10 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2128 a1.uType = 1070; |
0 | 2129 a1.field_48 = 8; |
2130 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2131 { | |
2132 LABEL_19: | |
2133 LOWORD(v10) = 0; | |
2134 } | |
2135 else | |
2136 { | |
2137 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2138 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2139 { |
2140 ++v10; | |
2141 v11 += 28; | |
2142 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2143 goto LABEL_19; | |
2144 } | |
2145 } | |
2146 a1.uObjectDescID = v10; | |
2147 a1.field_60_distance_related_prolly_lod = 0; | |
2148 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2149 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2150 a1.uAttributes = 0; |
2151 a1.uSectorID = 0; | |
2152 a1.uSpriteFrameID = 0; | |
303 | 2153 a1.field_58_pid = v12; |
0 | 2154 a1.uFacing = 0; |
2155 a1.uSoundID = 0; | |
2156 v13 = sub_46A89E((int)v41, 100, 307); | |
2157 if ( v13 > 0 ) | |
2158 { | |
2159 do | |
2160 { | |
2161 v14 = (unsigned int *)&v41[4 * v9]; | |
2162 v15 = *v14; | |
2163 v16 = *v14; | |
2164 a1.vPosition.x = pActors[v16].vPosition.x; | |
2165 v17 = pActors[v16].vPosition.y; | |
2166 a1.vPosition.z = pActors[v16].vPosition.z; | |
2167 v18 = 8 * v15; | |
2168 LOBYTE(v18) = 8 * v15 | 3; | |
2169 a1.vPosition.y = v17; | |
2170 a1.field_5C = v18; | |
2171 v19 = a1.Create(0, 0, 0, 0); | |
2172 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
2173 ++v9; | |
2174 } | |
2175 while ( v9 < v13 ); | |
2176 } | |
2177 } | |
2178 v44 = 0; | |
248 | 2179 if (PartyHasDragon()) |
0 | 2180 v44 = 1; |
2181 v49 = 0; | |
2182 LABEL_25: | |
2183 v20 = 0; | |
2184 v21 = &pParty->pPlayers[v49]; | |
2185 v50 = 0; | |
2186 v47 = 0; | |
2187 v45 = 0; | |
2188 v48 = 0; | |
2189 v46 = 0; | |
255 | 2190 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2191 v50 = 1; |
135 | 2192 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2193 v48 = 1; |
2194 v22 = (ITEM_EQUIP_TYPE)0; | |
2195 while ( 1 ) | |
2196 { | |
2197 if ( v21->HasItemEquipped(v22) ) | |
2198 { | |
2199 //v23 = v21->pEquipment.pIndices; | |
2200 auto _idx = v21->pEquipment.pIndices[v22]; | |
2201 v24 = v21->pInventoryItems[_idx].uItemID; | |
2202 if ( v24 > 134 ) | |
2203 { | |
2204 if ( v24 == 529 ) | |
2205 goto LABEL_43; | |
2206 if ( v24 == 535 ) | |
2207 goto LABEL_44; | |
2208 if ( v24 == 515 ) | |
2209 { | |
2210 v47 = 1; | |
2211 } | |
2212 else | |
2213 { | |
2214 if ( v24 == 532 ) | |
2215 goto LABEL_50; | |
2216 } | |
2217 } | |
2218 else | |
2219 { | |
377 | 2220 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2221 if ( v25 <= 50 ) |
2222 { | |
2223 if ( v25 != 50 ) | |
2224 { | |
2225 v26 = v25 - 37; | |
2226 if ( v26 ) | |
2227 { | |
2228 v27 = v26 - 1; | |
2229 if ( !v27 ) | |
2230 goto LABEL_50; | |
2231 v28 = v27 - 6; | |
2232 if ( v28 ) | |
2233 { | |
2234 if ( v28 != 3 ) | |
2235 goto LABEL_51; | |
2236 LABEL_50: | |
2237 v50 = 1; | |
2238 goto LABEL_51; | |
2239 } | |
2240 } | |
2241 } | |
2242 LABEL_44: | |
2243 v20 = 1; | |
2244 goto LABEL_51; | |
2245 } | |
2246 v29 = v25 - 54; | |
2247 if ( !v29 ) | |
2248 goto LABEL_44; | |
2249 v30 = v29 - 1; | |
2250 if ( !v30 ) | |
2251 goto LABEL_50; | |
2252 if ( v30 == 11 ) | |
2253 { | |
2254 LABEL_43: | |
2255 v20 = 1; | |
2256 v50 = 1; | |
2257 goto LABEL_51; | |
2258 } | |
2259 } | |
2260 } | |
2261 LABEL_51: | |
2262 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2263 if ( (signed int)v22 >= 16 ) | |
2264 { | |
2265 if ( v48 ) | |
2266 { | |
2267 v31 = 0; | |
2268 v32 = (char *)v21->pInventoryItems; | |
2269 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2270 { | |
2271 ++v31; | |
2272 v32 += 36; | |
2273 if ( v31 >= 138 ) | |
2274 goto LABEL_59; | |
2275 } | |
2276 v48 = 0; | |
2277 v45 = 1; | |
2278 } | |
2279 LABEL_59: | |
2280 if ( v21->pConditions[17] ) | |
2281 v46 = 1; | |
2282 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2283 { | |
2284 ++v21->sHealth; | |
2285 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2286 v21->sHealth = v21->GetMaxHealth(); | |
2287 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2288 { | |
2289 LODWORD(v21->pConditions[13]) = 0; | |
2290 HIDWORD(v21->pConditions[13]) = 0; | |
2291 } | |
2292 v51 = 1; | |
2293 } | |
2294 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2295 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2296 && !v21->pConditions[14] | |
2297 && !v21->pConditions[16] ) | |
2298 { | |
2299 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2300 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2301 v21->sHealth = v21->GetMaxHealth(); | |
2302 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2303 { | |
2304 LODWORD(v21->pConditions[13]) = 0; | |
2305 HIDWORD(v21->pConditions[13]) = 0; | |
2306 } | |
2307 v51 = 1; | |
2308 } | |
2309 if ( v50 ) | |
2310 { | |
2311 v33 = (char *)&v21->sMana; | |
2312 ++*(int *)v33; | |
2313 if ( v21->sMana > v21->GetMaxMana() ) | |
2314 *(int *)v33 = v21->GetMaxMana(); | |
2315 v51 = 1; | |
2316 } | |
2317 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2318 { | |
2319 v34 = LODWORD(v21->pConditions[13]); | |
2320 --v21->sHealth; | |
2321 v35 = v21->sHealth; | |
2322 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2323 v21->pConditions[13] = pParty->uTimePlayed; | |
2324 if ( v35 < 1 ) | |
2325 { | |
2326 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2327 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2328 { | |
2329 v21->pConditions[13] = pParty->uTimePlayed; | |
2330 } | |
2331 else | |
2332 { | |
2333 if ( !v21->pConditions[14] ) | |
2334 v21->pConditions[14] = pParty->uTimePlayed; | |
2335 } | |
2336 } | |
2337 v51 = 1; | |
2338 } | |
2339 if ( v45 ) | |
2340 { | |
2341 v36 = (char *)&v21->sMana; | |
2342 ++*(int *)v36; | |
2343 if ( v21->sMana > v21->GetMaxMana() ) | |
2344 *(int *)v36 = v21->GetMaxMana(); | |
2345 } | |
2346 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2347 { | |
2348 v37 = v21->sHealth; | |
2349 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2350 v21->sHealth = v37 - 2; | |
2351 v38 = v21->sMana; | |
2352 if ( v38 > v21->GetMaxMana() / 2 ) | |
2353 v21->sMana = v38 - 2; | |
2354 } | |
2355 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2356 { | |
2357 v39 = v21->sHealth; | |
2358 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2359 v21->sHealth = v39 - 1; | |
2360 v40 = v21->sMana; | |
2361 if ( v40 > 0 ) | |
2362 v21->sMana = v40 - 1; | |
2363 } | |
2364 ++v49; | |
2365 if ( v49 >= 4 ) | |
2366 { | |
2367 result = HIDWORD(pParty->uTimePlayed); | |
2368 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2369 if ( !viewparams->bRedrawGameUI ) | |
2370 { | |
2371 result = v51; | |
2372 viewparams->bRedrawGameUI = v51; | |
2373 } | |
2374 return result; | |
2375 } | |
2376 goto LABEL_25; | |
2377 } | |
2378 } | |
2379 } | |
2380 return result; | |
2381 } | |
2382 | |
2383 | |
2384 | |
2385 //----- (00493F79) -------------------------------------------------------- | |
351 | 2386 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2387 { |
2388 signed __int64 v2; // ST2C_8@1 | |
2389 signed __int64 v3; // qax@1 | |
351 | 2390 //signed __int64 v4; // ST1C_8@1 |
0 | 2391 unsigned __int64 v5; // qax@1 |
2392 unsigned int v6; // ebx@1 | |
2393 | |
2394 v2 = (signed __int64)((double)a2 * 0.234375); | |
2395 v3 = v2 / 60 / 60; | |
351 | 2396 //v4 = v3; |
0 | 2397 v5 = (unsigned int)v3 / 0x18; |
2398 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2399 _this->field_0_expire_second = v2 % 60; |
2400 _this->field_4_expire_minute = v2 / 60 % 60; | |
2401 _this->field_8_expire_hour = v3 % 24; | |
2402 _this->field_10_expire_week = v5 / 7 & 3; | |
2403 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2404 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2405 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2406 } |
2407 | |
2408 | |
2409 | |
2410 | |
2411 | |
2412 //----- (00494035) -------------------------------------------------------- | |
2413 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2414 { | |
2415 signed __int64 v0; // qax@1 | |
2416 signed __int64 v1; // ST30_8@1 | |
2417 signed __int64 v2; // ST38_8@1 | |
2418 unsigned __int64 v3; // qax@1 | |
2419 unsigned int v4; // edi@1 | |
2420 //signed int v5; // eax@4 | |
2421 //char *v6; // ecx@5 | |
2422 //Player *v7; // esi@8 | |
2423 //char *v8; // ecx@12 | |
766 | 2424 //Player *pPlayer; // esi@15 |
0 | 2425 //void *v10; // esi@25 |
2426 unsigned int v11; // ecx@27 | |
2427 signed int v12; // edi@29 | |
2428 Player *v13; // ecx@30 | |
2429 Player *v14; // esi@35 | |
2430 double v15; // st7@35 | |
2431 Player **v16; // esi@43 | |
2432 Player *v17; // edi@44 | |
2433 double v18; // st7@44 | |
2434 float v19; // ST28_4@48 | |
2435 double v20; // ST38_8@48 | |
2436 Player *v21; // esi@51 | |
2437 signed int v22; // edi@53 | |
2438 int v23; // eax@59 | |
2439 int v24; // ecx@60 | |
2440 int v25; // eax@63 | |
2441 int v26; // ecx@64 | |
2442 int v27; // eax@67 | |
2443 int v28; // ecx@68 | |
2444 int v29; // eax@71 | |
2445 int v30; // ecx@72 | |
2446 int v31; // eax@75 | |
2447 int v32; // ecx@76 | |
2448 int v33; // eax@79 | |
2449 int v34; // ecx@80 | |
2450 int v35; // eax@83 | |
2451 int v36; // ecx@84 | |
2452 int v37; // eax@87 | |
2453 int v38; // ecx@88 | |
2454 int v39; // eax@91 | |
2455 int v40; // ecx@92 | |
2456 int v41; // eax@95 | |
2457 int v42; // ecx@96 | |
2458 bool v43; // ebx@102 | |
2459 //SpellBuff *v44; // edi@104 | |
2460 //signed int v45; // ebp@104 | |
2461 bool v46; // edi@111 | |
2462 //SpellBuff *v47; // esi@113 | |
2463 //Player **v48; // esi@119 | |
2464 //signed int v49; // edi@121 | |
2465 //char *v50; // esi@122 | |
2466 signed int v51; // edx@128 | |
2467 signed int v52; // ecx@130 | |
2468 int v53; // eax@131 | |
2469 Player *v54; // eax@141 | |
766 | 2470 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2471 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2472 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2473 int v58; // [sp-4h] [bp-34h]@33 |
2474 int v59; // [sp-4h] [bp-34h]@55 | |
2475 unsigned int v60; // [sp+10h] [bp-20h]@1 | |
2476 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
2477 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2478 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2479 signed int a2a; // [sp+18h] [bp-18h]@47 |
2480 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2481 | |
766 | 2482 //a2 = pParty->uCurrentHour; |
0 | 2483 v61 = pParty->uDaysPlayed; |
2484 v60 = pEventTimer->uTimeElapsed; | |
766 | 2485 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2486 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2487 v1 = v0; |
2488 v0 /= 60i64; | |
2489 v2 = v0; | |
2490 v3 = (unsigned int)v0 / 24; | |
2491 v4 = (unsigned int)(v3 / 7) >> 2; | |
2492 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2493 pParty->uCurrentMinute = v1 % 60; | |
2494 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2495 pParty->uCurrentHour = v2 % 24; | |
2496 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2497 pParty->uCurrentMonth = v4 % 12; | |
352 | 2498 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2499 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2500 { |
2501 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2502 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2503 | |
2504 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2505 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2506 | |
766 | 2507 ++pParty->days_played_without_rest; |
2508 if (pParty->days_played_without_rest > 1) | |
0 | 2509 { |
2510 for (uint i = 0; i < 4; ++i) | |
766 | 2511 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2512 | |
2513 if (pParty->uNumFoodRations) | |
2514 Party::TakeFood(1); | |
0 | 2515 else |
2516 for (uint i = 0; i < 4; ++i) | |
766 | 2517 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2518 | |
2519 if (pParty->days_played_without_rest > 3) | |
2520 for (uint i = 0; i < 4; ++i) | |
0 | 2521 { |
766 | 2522 auto player = pParty->pPlayers + i; |
2523 | |
2524 player->Zero(); | |
2525 | |
2526 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2527 { |
767 | 2528 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2529 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2530 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2531 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2532 } |
2533 } | |
766 | 2534 } |
2535 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2536 pOutdoor->SetFog(); |
2537 | |
2538 for (uint i = 0; i < 4; ++i) | |
2539 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2540 } | |
766 | 2541 |
0 | 2542 v11 = LODWORD(pParty->uTimePlayed); |
2543 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2544 { | |
2545 v12 = 1; | |
2546 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2547 viewparams->bRedrawGameUI = 1; | |
2548 while ( 1 ) | |
2549 { | |
2550 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2551 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2552 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2553 { |
2554 v58 = 0; | |
2555 } | |
2556 else | |
2557 { | |
2558 v58 = 0; | |
2559 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2560 { | |
2561 v14 = pPlayers[v12]; | |
2562 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2563 v14->ReceiveDamage((signed __int64)v15, 0); | |
2564 if ( pParty->uFlags & 4 ) | |
2565 { | |
783 | 2566 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2567 GameUI_Footer_TimeLeft = 128; | |
0 | 2568 } |
2569 goto LABEL_39; | |
2570 } | |
2571 v13 = pPlayers[v12]; | |
2572 } | |
130 | 2573 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2574 LABEL_39: |
2575 ++v12; | |
2576 if ( v12 > 4 ) | |
2577 { | |
2578 v11 = LODWORD(pParty->uTimePlayed); | |
2579 break; | |
2580 } | |
2581 } | |
2582 } | |
2583 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2584 { | |
2585 viewparams->bRedrawGameUI = 1; | |
2586 pParty->field_6FC = v11 + 128; | |
2587 v16 = &pPlayers[1]; | |
2588 do | |
2589 { | |
2590 v17 = *v16; | |
2591 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2592 v17->ReceiveDamage((signed __int64)v18, 0); | |
2593 if ( pParty->uFlags & 0x200 ) | |
2594 { | |
783 | 2595 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2596 GameUI_Footer_TimeLeft = 128; | |
0 | 2597 } |
2598 ++v16; | |
2599 } | |
2600 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2601 } | |
2602 _493938_regenerate(); | |
2603 v65 = 4; | |
2604 a2a = v60; | |
2605 if ( pParty->uFlags2 & 2 ) | |
2606 { | |
2607 v19 = (double)(signed int)v60 * 0.5; | |
2608 v20 = v19 + 6.7553994e15; | |
2609 a2a = LODWORD(v20); | |
2610 if ( SLODWORD(v20) <= 0 ) | |
2611 a2a = 1; | |
2612 } | |
2613 v62 = &pPlayers[1]; | |
2614 do | |
2615 { | |
2616 v21 = *v62; | |
2617 if ( (*v62)->uTimeToRecovery ) | |
2618 v21->Recover(a2a); | |
2619 v22 = v21->sHealth; | |
2620 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2621 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2622 { | |
2623 if ( v22 >= 1 ) | |
2624 goto LABEL_59; | |
2625 v59 = 0; | |
2626 v56 = 13; | |
2627 } | |
2628 else | |
2629 { | |
2630 v59 = 0; | |
2631 v56 = 14; | |
2632 } | |
2633 v21->SetCondition(v56, v59); | |
2634 LABEL_59: | |
2635 v23 = (int)&v21->field_E0; | |
2636 if ( v21->field_E0 ) | |
2637 { | |
2638 v24 = *(int *)v23 - v60; | |
2639 if ( v24 > 0 ) | |
2640 { | |
2641 *(int *)v23 = v24; | |
2642 } | |
2643 else | |
2644 { | |
2645 *(int *)v23 = 0; | |
2646 viewparams->bRedrawGameUI = 1; | |
2647 } | |
2648 } | |
2649 v25 = (int)&v21->field_E4; | |
2650 if ( v21->field_E4 ) | |
2651 { | |
2652 v26 = *(int *)v25 - v60; | |
2653 if ( v26 > 0 ) | |
2654 { | |
2655 *(int *)v25 = v26; | |
2656 } | |
2657 else | |
2658 { | |
2659 *(int *)v25 = 0; | |
2660 viewparams->bRedrawGameUI = 1; | |
2661 } | |
2662 } | |
2663 v27 = (int)&v21->field_E8; | |
2664 if ( v21->field_E8 ) | |
2665 { | |
2666 v28 = *(int *)v27 - v60; | |
2667 if ( v28 > 0 ) | |
2668 { | |
2669 *(int *)v27 = v28; | |
2670 } | |
2671 else | |
2672 { | |
2673 *(int *)v27 = 0; | |
2674 viewparams->bRedrawGameUI = 1; | |
2675 } | |
2676 } | |
2677 v29 = (int)&v21->field_EC; | |
2678 if ( v21->field_EC ) | |
2679 { | |
2680 v30 = *(int *)v29 - v60; | |
2681 if ( v30 > 0 ) | |
2682 { | |
2683 *(int *)v29 = v30; | |
2684 } | |
2685 else | |
2686 { | |
2687 *(int *)v29 = 0; | |
2688 viewparams->bRedrawGameUI = 1; | |
2689 } | |
2690 } | |
2691 v31 = (int)&v21->field_F0; | |
2692 if ( v21->field_F0 ) | |
2693 { | |
2694 v32 = *(int *)v31 - v60; | |
2695 if ( v32 > 0 ) | |
2696 { | |
2697 *(int *)v31 = v32; | |
2698 } | |
2699 else | |
2700 { | |
2701 *(int *)v31 = 0; | |
2702 viewparams->bRedrawGameUI = 1; | |
2703 } | |
2704 } | |
2705 v33 = (int)&v21->field_F4; | |
2706 if ( v21->field_F4 ) | |
2707 { | |
2708 v34 = *(int *)v33 - v60; | |
2709 if ( v34 > 0 ) | |
2710 { | |
2711 *(int *)v33 = v34; | |
2712 } | |
2713 else | |
2714 { | |
2715 *(int *)v33 = 0; | |
2716 viewparams->bRedrawGameUI = 1; | |
2717 } | |
2718 } | |
2719 v35 = (int)&v21->field_F8; | |
2720 if ( v21->field_F8 ) | |
2721 { | |
2722 v36 = *(int *)v35 - v60; | |
2723 if ( v36 > 0 ) | |
2724 { | |
2725 *(int *)v35 = v36; | |
2726 } | |
2727 else | |
2728 { | |
2729 *(int *)v35 = 0; | |
2730 viewparams->bRedrawGameUI = 1; | |
2731 } | |
2732 } | |
2733 v37 = (int)&v21->field_FC; | |
2734 if ( v21->field_FC ) | |
2735 { | |
2736 v38 = *(int *)v37 - v60; | |
2737 if ( v38 > 0 ) | |
2738 { | |
2739 *(int *)v37 = v38; | |
2740 } | |
2741 else | |
2742 { | |
2743 *(int *)v37 = 0; | |
2744 viewparams->bRedrawGameUI = 1; | |
2745 } | |
2746 } | |
2747 v39 = (int)&v21->field_100; | |
2748 if ( v21->field_100 ) | |
2749 { | |
2750 v40 = *(int *)v39 - v60; | |
2751 if ( v40 > 0 ) | |
2752 { | |
2753 *(int *)v39 = v40; | |
2754 } | |
2755 else | |
2756 { | |
2757 *(int *)v39 = 0; | |
2758 viewparams->bRedrawGameUI = 1; | |
2759 } | |
2760 } | |
2761 v41 = (int)&v21->field_104; | |
2762 if ( v21->field_104 ) | |
2763 { | |
2764 v42 = *(int *)v41 - v60; | |
2765 if ( v42 > 0 ) | |
2766 { | |
2767 *(int *)v41 = v42; | |
2768 } | |
2769 else | |
2770 { | |
2771 *(int *)v41 = 0; | |
2772 viewparams->bRedrawGameUI = 1; | |
2773 } | |
2774 } | |
2775 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2776 --v65; | |
2777 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2778 | |
2779 for (uint k = 0; k < 24; ++k) | |
2780 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2781 | |
2782 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2783 v21->SetCondition(1u, 0); | |
2784 ++v62; | |
2785 } | |
2786 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2787 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2788 | |
2789 for (uint i = 0; i < 20; ++i) | |
2790 { | |
2791 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2792 viewparams->bRedrawGameUI = 1; | |
2793 } | |
2794 | |
2795 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2796 { | |
2797 for (uint i = 0; i < 4; ++i) | |
2798 pParty->pPlayers[i].SetCondition(1, 0); | |
2799 } | |
2800 | |
2801 for (uint i = 0; i < 2; ++i) | |
2802 { | |
2803 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2804 if (pBuf->uExpireTime == 0) | |
2805 continue; | |
2806 | |
2807 if ( !(pBuf->uFlags & 1) ) | |
2808 { | |
2809 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2810 { | |
2811 pBuf->Reset(); | |
2812 if (dword_4EE07C[i] == 7 ) | |
2813 pParty->bFlying = false; | |
2814 } | |
2815 } | |
2816 } | |
2817 | |
2818 v51 = v65; | |
2819 if ( v65 ) | |
2820 goto LABEL_135; | |
151 | 2821 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2822 { |
2823 v52 = (signed int)&pPlayers[1]; | |
2824 while ( 1 ) | |
2825 { | |
2826 v53 = *(int *)v52; | |
2827 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2828 break; | |
2829 v52 += 4; | |
2830 if ( v52 > (signed int)&pPlayers[4] ) | |
2831 goto LABEL_135; | |
2832 } | |
2833 *(int *)(v53 + 16) = 0; | |
2834 *(int *)(v53 + 20) = 0; | |
2835 v51 = 1; | |
2836 LABEL_135: | |
151 | 2837 if ( pCurrentScreen != SCREEN_REST |
0 | 2838 && (!v51 || dword_5C35C0) ) |
2839 uGameState = 8; | |
2840 } | |
2841 if ( uActiveCharacter ) | |
2842 { | |
151 | 2843 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2844 { |
2845 v54 = pPlayers[uActiveCharacter]; | |
2846 if ( v54->pConditions[2] | |
2847 || v54->pConditions[12] | |
2848 || v54->pConditions[13] | |
2849 || v54->pConditions[14] | |
2850 || v54->pConditions[15] | |
2851 || v54->pConditions[16] ) | |
2852 { | |
2853 viewparams->bRedrawGameUI = 1; | |
2854 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2855 } | |
2856 } | |
2857 } | |
2858 } | |
2859 | |
2860 //----- (00494820) -------------------------------------------------------- | |
758 | 2861 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2862 { |
2863 signed int v1; // eax@1 | |
2864 | |
2865 v1 = 5; | |
758 | 2866 if ( a1 % 24 >= 5 ) |
0 | 2867 v1 = 29; |
758 | 2868 return v1 - a1 % 24; |
0 | 2869 } |
2870 | |
2871 //----- (00494836) -------------------------------------------------------- | |
2872 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2873 { | |
2874 int v3; // esi@1 | |
2875 int result; // eax@1 | |
2876 stru339_spell_sound *v5; // ebx@1 | |
2877 int *v6; // edi@2 | |
2878 unsigned int v7; // eax@3 | |
2879 int v8; // [sp+Ch] [bp-8h]@3 | |
2880 int v9; // [sp+10h] [bp-4h]@2 | |
2881 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2882 | |
2883 v3 = 0; | |
2884 result = word_4EE088_sound_ids[uSoundID]; | |
2885 v5 = this; | |
2886 a2a = word_4EE088_sound_ids[uSoundID]; | |
2887 if ( result ) | |
2888 { | |
2889 v9 = 0; | |
2890 v6 = this->pSoundsOffsets; | |
2891 do | |
2892 { | |
2893 v7 = a2a++; | |
2894 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2895 if ( !result ) | |
2896 break; | |
2897 a6 += 4; | |
2898 result = v8 + 256; | |
2899 *v6 = v3; | |
2900 v3 += result; | |
2901 ++v9; | |
2902 *(v6 - 2) = result; | |
2903 ++v6; | |
2904 } | |
2905 while ( v9 < 2 ); | |
2906 } | |
2907 return result; | |
2908 } | |
2909 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2910 | |
2911 | |
2912 | |
2913 //----- (00494AED) -------------------------------------------------------- | |
130 | 2914 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2915 { |
2916 unsigned int _uNumFrames; // edx@1 | |
2917 unsigned int result; // eax@1 | |
2918 PlayerFrame *v4; // ecx@2 | |
2919 | |
2920 _uNumFrames = this->uNumFrames; | |
2921 result = 0; | |
2922 if ( (signed int)this->uNumFrames <= 0 ) | |
2923 { | |
2924 LABEL_5: | |
2925 result = 0; | |
2926 } | |
2927 else | |
2928 { | |
2929 v4 = this->pFrames; | |
130 | 2930 while ( v4->expression != expression ) |
0 | 2931 { |
2932 ++result; | |
2933 ++v4; | |
2934 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2935 goto LABEL_5; | |
2936 } | |
2937 } | |
2938 return result; | |
2939 } | |
2940 | |
2941 //----- (00494B10) -------------------------------------------------------- | |
2942 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2943 { | |
2944 unsigned int v3; // esi@1 | |
2945 PlayerFrame *v4; // edi@1 | |
2946 PlayerFrame *v5; // ecx@1 | |
2947 __int16 v6; // dx@2 | |
2948 int v7; // edx@3 | |
2949 char *i; // eax@3 | |
2950 int v9; // ecx@5 | |
2951 PlayerFrame *result; // eax@6 | |
2952 | |
2953 v3 = uFramesetID; | |
2954 v4 = this->pFrames; | |
2955 v5 = &v4[uFramesetID]; | |
2956 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2957 { | |
2958 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2959 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2960 { | |
2961 v9 = *(short *)i; | |
2962 if ( v7 <= v9 ) | |
2963 break; | |
2964 v7 -= v9; | |
2965 ++v3; | |
2966 } | |
2967 result = &v4[v3]; | |
2968 } | |
2969 else | |
2970 { | |
2971 result = &v4[uFramesetID]; | |
2972 } | |
2973 return result; | |
2974 } | |
2975 | |
2976 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2977 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2978 { |
2979 PlayerFrameTable *v4; // edi@1 | |
2980 int v5; // esi@1 | |
2981 int v6; // eax@2 | |
2982 | |
2983 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2984 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2985 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
|
2986 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2987 *pAnimTime = v5; |
0 | 2988 } |
2989 else | |
2990 { | |
2991 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2992 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2993 *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
|
2994 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2995 return &v4->pFrames[*pFramesetID]; |
0 | 2996 } |
2997 | |
2998 //----- (00494BC3) -------------------------------------------------------- | |
2999 void PlayerFrameTable::ToFile() | |
3000 { | |
3001 PlayerFrameTable *v1; // esi@1 | |
3002 FILE *v2; // eax@1 | |
3003 FILE *v3; // edi@1 | |
3004 | |
3005 auto Str = this; | |
3006 | |
3007 v1 = Str; | |
3008 v2 = fopen("data\\dpft.bin", "wb"); | |
3009 v3 = v2; | |
3010 if ( !v2 ) | |
3011 Abortf("Unable to save dpft.bin!"); | |
3012 fwrite(v1, 4u, 1u, v2); | |
3013 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
3014 fclose(v3); | |
3015 } | |
3016 | |
3017 //----- (00494C0F) -------------------------------------------------------- | |
3018 void PlayerFrameTable::FromFile(void *pSerialized) | |
3019 { | |
3020 uNumFrames = *(int *)pSerialized; | |
3021 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
3022 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
3023 } | |
3024 | |
3025 //----- (00494C5A) -------------------------------------------------------- | |
3026 int PlayerFrameTable::FromFileTxt(const char *Args) | |
3027 { | |
3028 PlayerFrameTable *v2; // ebx@1 | |
3029 FILE *v3; // eax@1 | |
3030 int v4; // esi@3 | |
3031 void *v5; // eax@10 | |
3032 FILE *v6; // ST0C_4@12 | |
3033 char *i; // eax@12 | |
3034 __int16 v8; // ax@15 | |
3035 const char *v9; // ST10_4@15 | |
3036 unsigned __int16 v10; // ax@15 | |
3037 const char *v11; // ST0C_4@15 | |
3038 int j; // esi@15 | |
3039 int v13; // eax@17 | |
3040 int v14; // edx@22 | |
3041 int v15; // ecx@23 | |
3042 int v16; // eax@24 | |
3043 signed int k; // eax@27 | |
3044 PlayerFrame *v18; // edx@28 | |
3045 int v19; // esi@28 | |
3046 int l; // ecx@29 | |
3047 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3048 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3049 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3050 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3051 int v26; // [sp+2FCh] [bp-8h]@3 | |
3052 FILE *File; // [sp+300h] [bp-4h]@1 | |
3053 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3054 | |
3055 v2 = this; | |
3056 //TileTable::dtor((TileTable *)this); | |
3057 v3 = fopen(Args, "r"); | |
3058 File = v3; | |
3059 if ( !v3 ) | |
3060 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3061 v4 = 0; | |
3062 v25 = 0; | |
3063 v26 = 1; | |
3064 if ( fgets(&Buf, 490, v3) ) | |
3065 { | |
3066 do | |
3067 { | |
3068 *strchr(&Buf, 10) = 0; | |
703 | 3069 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3070 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3071 { | |
3072 if ( v24.uPropCount < 3 ) | |
0 | 3073 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3074 ++v25; | |
3075 } | |
3076 ++v26; | |
3077 } | |
3078 while ( fgets(&Buf, 490, File) ); | |
3079 v4 = v25; | |
3080 } | |
3081 v2->uNumFrames = v4; | |
3082 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3083 v2->pFrames = (PlayerFrame *)v5; | |
3084 if ( !v5 ) | |
3085 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3086 v6 = File; | |
3087 v2->uNumFrames = 0; | |
3088 fseek(v6, 0, 0); | |
3089 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3090 { | |
3091 *strchr(&Buf, 10) = 0; | |
703 | 3092 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3093 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3094 { |
3095 v8 = atoi(v24.pProperties[0]); | |
3096 v9 = v24.pProperties[1]; | |
130 | 3097 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3098 v10 = atoi(v9); |
3099 v11 = v24.pProperties[2]; | |
3100 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3101 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3102 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3103 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3104 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3105 { |
3106 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3107 { | |
3108 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3109 *(char *)v13 |= 4u; | |
3110 } | |
3111 } | |
3112 ++v2->uNumFrames; | |
3113 } | |
3114 } | |
3115 fclose(File); | |
3116 v14 = 0; | |
3117 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3118 { | |
3119 v15 = 0; | |
3120 do | |
3121 { | |
3122 v16 = (int)&v2->pFrames[v15]; | |
3123 if ( !(*(char *)(v16 + 18) & 4) ) | |
3124 *(char *)(v16 + 8) |= 1u; | |
3125 ++v14; | |
3126 ++v15; | |
3127 } | |
3128 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3129 } | |
3130 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3131 { | |
3132 v18 = v2->pFrames; | |
3133 Argsa = (int)&v18[k]; | |
3134 v19 = *(short *)(Argsa + 4); | |
3135 if ( *(char *)(Argsa + 8) & 1 ) | |
3136 { | |
3137 ++k; | |
3138 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3139 { | |
3140 v19 += *(short *)(l + 4); | |
3141 ++k; | |
3142 } | |
3143 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3144 } | |
3145 ++k; | |
3146 } | |
3147 return 1; | |
3148 } | |
3149 | |
3150 //----- (00494F3A) -------------------------------------------------------- | |
3151 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3152 { | |
3153 IconFrameTable *v2; // esi@1 | |
3154 int v3; // ebx@1 | |
3155 unsigned int uID; // edi@1 | |
3156 unsigned int result; // eax@4 | |
3157 | |
3158 v2 = this; | |
3159 v3 = 0; | |
3160 uID = 0; | |
3161 if ( (signed int)this->uNumIcons <= 0 ) | |
3162 { | |
3163 LABEL_4: | |
3164 result = 0; | |
3165 } | |
3166 else | |
3167 { | |
3168 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3169 { | |
3170 ++uID; | |
3171 ++v3; | |
3172 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3173 goto LABEL_4; | |
3174 } | |
3175 result = uID; | |
3176 } | |
3177 return result; | |
3178 } | |
3179 | |
3180 //----- (00494F70) -------------------------------------------------------- | |
3181 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3182 { | |
3183 IconFrame *v3; // edi@1 | |
3184 IconFrame *v4; // ecx@1 | |
3185 __int16 v5; // dx@2 | |
3186 int v6; // edx@3 | |
3187 unsigned int v7; // eax@3 | |
3188 char *i; // ecx@3 | |
3189 int v9; // esi@5 | |
3190 IconFrame *result; // eax@6 | |
3191 | |
3192 v3 = this->pIcons; | |
3193 v4 = &v3[uIconID]; | |
3194 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3195 { | |
3196 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3197 v7 = uIconID; | |
3198 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3199 { | |
3200 v9 = *(short *)i; | |
3201 if ( v6 <= v9 ) | |
3202 break; | |
3203 v6 -= v9; | |
3204 ++v7; | |
3205 } | |
3206 result = &v3[v7]; | |
3207 } | |
3208 else | |
3209 { | |
3210 result = &v3[uIconID]; | |
3211 } | |
3212 return result; | |
3213 } | |
3214 | |
3215 //----- (00494FBF) -------------------------------------------------------- | |
3216 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3217 { | |
3218 IconFrameTable *v2; // esi@1 | |
3219 unsigned int v3; // edi@3 | |
3220 const char *i; // eax@3 | |
3221 IconFrame *v5; // eax@5 | |
3222 | |
3223 v2 = this; | |
3224 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3225 { | |
3226 v3 = uIconID; | |
3227 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3228 { | |
3229 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3230 v5 = v2->pIcons; | |
3231 if ( !(v5[v3].uFlags & 1) ) | |
3232 break; | |
3233 ++v3; | |
3234 } | |
3235 } | |
3236 } | |
3237 | |
3238 //----- (0049500A) -------------------------------------------------------- | |
3239 void IconFrameTable::ToFile() | |
3240 { | |
3241 IconFrameTable *v1; // esi@1 | |
3242 FILE *v2; // eax@1 | |
3243 FILE *v3; // edi@1 | |
3244 | |
3245 auto Str = this; | |
3246 | |
3247 v1 = Str; | |
3248 v2 = fopen("data\\dift.bin", "wb"); | |
3249 v3 = v2; | |
3250 if ( !v2 ) | |
3251 Abortf("Unable to save dift.bin!"); | |
3252 fwrite(v1, 4u, 1u, v2); | |
3253 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3254 fclose(v3); | |
3255 } | |
3256 | |
3257 //----- (00495056) -------------------------------------------------------- | |
3258 void IconFrameTable::FromFile(void *pSerialized) | |
3259 { | |
3260 uNumIcons = *(int *)pSerialized; | |
3261 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3262 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3263 } | |
3264 | |
3265 //----- (0049509D) -------------------------------------------------------- | |
3266 int IconFrameTable::FromFileTxt(const char *Args) | |
3267 { | |
3268 IconFrameTable *v2; // ebx@1 | |
3269 FILE *v3; // eax@1 | |
3270 int v4; // esi@3 | |
3271 void *v5; // eax@10 | |
3272 FILE *v6; // ST0C_4@12 | |
3273 char *i; // eax@12 | |
3274 const char *v8; // ST00_4@15 | |
3275 int v9; // eax@16 | |
3276 int v10; // edx@20 | |
3277 int v11; // ecx@21 | |
3278 int v12; // eax@22 | |
3279 signed int j; // edx@25 | |
3280 IconFrame *v14; // ecx@26 | |
3281 int v15; // esi@26 | |
3282 int k; // eax@27 | |
3283 signed int result; // eax@11 | |
3284 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3285 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3286 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3287 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3288 int v22; // [sp+2FCh] [bp-8h]@3 | |
3289 FILE *File; // [sp+300h] [bp-4h]@1 | |
3290 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3291 | |
3292 v2 = this; | |
3293 //TileTable::dtor((TileTable *)this); | |
3294 v3 = fopen(Args, "r"); | |
3295 File = v3; | |
3296 if ( !v3 ) | |
3297 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3298 v4 = 0; | |
3299 v21 = 0; | |
3300 v22 = 1; | |
3301 if ( fgets(&Buf, 490, v3) ) | |
3302 { | |
3303 do | |
3304 { | |
3305 *strchr(&Buf, 10) = 0; | |
3306 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3307 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3308 { | |
3309 if ( v20.uPropCount < 3 ) | |
0 | 3310 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3311 ++v21; | |
3312 } | |
3313 ++v22; | |
3314 } | |
3315 while ( fgets(&Buf, 490, File) ); | |
3316 v4 = v21; | |
3317 } | |
3318 v2->uNumIcons = v4; | |
3319 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3320 v2->pIcons = (IconFrame *)v5; | |
3321 if ( v5 ) | |
3322 { | |
3323 v6 = File; | |
3324 v2->uNumIcons = 0; | |
3325 fseek(v6, 0, 0); | |
3326 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3327 { | |
3328 *strchr(&Buf, 10) = 0; | |
3329 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3330 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3331 { |
3332 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3333 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3334 v8 = v20.pProperties[2]; | |
3335 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3336 if ( !_strcmpi(v8, "new") ) | |
3337 { | |
3338 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3339 *(char *)v9 |= 4u; | |
3340 } | |
3341 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3342 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3343 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3344 } | |
3345 } | |
3346 fclose(File); | |
3347 v10 = 0; | |
3348 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3349 { | |
3350 v11 = 0; | |
3351 do | |
3352 { | |
3353 v12 = (int)&v2->pIcons[v11]; | |
3354 if ( !(*(char *)(v12 + 60) & 4) ) | |
3355 *(char *)(v12 + 28) |= 1u; | |
3356 ++v10; | |
3357 ++v11; | |
3358 } | |
3359 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3360 } | |
3361 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3362 { | |
3363 v14 = v2->pIcons; | |
3364 Argsa = (int)&v14[j]; | |
3365 v15 = *(short *)(Argsa + 24); | |
3366 if ( *(char *)(Argsa + 28) & 1 ) | |
3367 { | |
3368 ++j; | |
3369 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3370 { | |
3371 v15 += *(short *)(k + 24); | |
3372 ++j; | |
3373 } | |
3374 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3375 } | |
3376 ++j; | |
3377 } | |
3378 result = 1; | |
3379 } | |
3380 else | |
3381 { | |
3382 fclose(File); | |
3383 result = 0; | |
3384 } | |
3385 return result; | |
3386 } | |
3387 | |
3388 | |
3389 | |
3390 //----- (00495366) -------------------------------------------------------- | |
3391 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3392 { | |
3393 int v2; // edi@1 | |
3394 int v3; // edx@2 | |
3395 int v4; // esi@3 | |
3396 int v5; // ebx@5 | |
3397 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3398 signed int v8; // [sp+10h] [bp-10h]@1 | |
3399 int **v9; // [sp+14h] [bp-Ch]@4 | |
3400 signed int v10; // [sp+18h] [bp-8h]@3 | |
3401 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3402 | |
3403 v2 = a1; | |
3404 v11 = a2; | |
3405 v8 = 0; | |
3406 v7 = 0; | |
3407 if ( dword_AE336C == a1 ) | |
3408 { | |
3409 v3 = dword_AE3370; | |
3410 } | |
3411 else | |
3412 { | |
3413 v4 = a2; | |
3414 dword_AE336C = a1; | |
3415 v10 = 0; | |
3416 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3417 goto LABEL_17; | |
3418 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3419 do | |
3420 { | |
3421 v5 = tolower(*(char *)*v9); | |
3422 if ( v5 == tolower(v2) ) | |
3423 { | |
3424 if ( v8 ) | |
3425 v7 = v10; | |
3426 else | |
3427 v8 = v10; | |
3428 } | |
3429 ++v10; | |
3430 v9 += 2; | |
3431 } | |
3432 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3433 if ( v8 && v8 != v7 ) | |
3434 v3 = v8 + rand() % (v7 - v8); | |
3435 else | |
3436 LABEL_17: | |
3437 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3438 } | |
3439 dword_AE3370 = v3; | |
3440 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3441 } | |
3442 // AE336C: using guessed type int dword_AE336C; | |
3443 // AE3370: using guessed type int dword_AE3370; | |
3444 | |
3445 //----- (00495430) -------------------------------------------------------- | |
607 | 3446 char * GetReputationString( signed int a1 ) |
3447 { | |
566 | 3448 if (a1 >= 25) |
3449 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3450 else if (a1 >= 6) | |
3451 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3452 else if (a1 >= -5) | |
3453 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3454 else if (a1 >= -24) | |
3455 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3456 else |
566 | 3457 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3458 } |
3459 | |
3460 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3461 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3462 { |
3463 unsigned __int8 v6; // bl@1 | |
3464 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3465 //NPCData *v9; // eax@4 |
250 | 3466 //size_t v10; // eax@6 |
0 | 3467 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3468 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3469 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3470 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3471 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3472 //int v16; // edx@10 |
0 | 3473 int v17; // eax@10 |
3474 signed __int64 v18; // qax@18 | |
3475 unsigned int v19; // edi@32 | |
3476 unsigned __int8 *v20; // ebx@32 | |
3477 int v21; // ecx@34 | |
3478 __int16 v22; // ax@34 | |
3479 int v23; // edx@39 | |
3480 int v24; // eax@39 | |
3481 int v25; // eax@45 | |
3482 float *v26; // esi@68 | |
3483 float v27; // ST18_4@68 | |
3484 signed int v28; // eax@68 | |
3485 int v29; // eax@68 | |
3486 float v30; // ST18_4@72 | |
3487 signed int v31; // eax@72 | |
3488 float v32; // ST18_4@74 | |
3489 signed int v33; // eax@74 | |
3490 double v34; // st7@75 | |
3491 float v35; // ST18_4@76 | |
3492 signed int v36; // eax@76 | |
3493 float *v37; // esi@78 | |
3494 float v38; // ST18_4@78 | |
3495 int v39; // eax@78 | |
3496 float v40; // ST18_4@82 | |
3497 int v41; // eax@82 | |
3498 float v42; // ST18_4@83 | |
3499 int v43; // eax@83 | |
3500 float v44; // ST18_4@85 | |
3501 int v45; // eax@85 | |
3502 const char *v46; // eax@86 | |
3503 unsigned int v47; // eax@87 | |
3504 float v48; // ST18_4@97 | |
3505 __int64 v49; // ST14_8@107 | |
3506 int v50; // eax@107 | |
3507 int v51; // eax@108 | |
3508 Player *v52; // eax@109 | |
3509 int v53; // [sp-4h] [bp-13Ch]@107 | |
3510 int v54; // [sp+0h] [bp-138h]@107 | |
3511 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3512 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3513 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3514 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3515 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3517 //Player *v61; // [sp+124h] [bp-14h]@3 |
3518 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3519 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 |
0 | 3525 |
3526 v6 = uPlayerID; | |
249 | 3527 //Str = lpsz; |
0 | 3528 if ( IsBadStringPtrA(lpsz, 1u) ) |
3529 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 |
0 | 3531 a1[0] = 0; |
3532 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3533 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3534 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 NPCData *npc = nullptr; |
0 | 3538 if ( dword_5C35D4 ) |
248 | 3539 { |
463 | 3540 //__debugbreak(); // fix |
459 | 3541 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
|
3542 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3543 else |
602 | 3544 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 //v65 = v9; |
250 | 3546 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3554 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 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
|
3570 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3571 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3572 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3575 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3576 case 2: |
0 | 3577 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3580 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 case 5: |
0 | 3584 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3585 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3586 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3587 { | |
3588 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3589 { | |
3590 if ( v18 < 20 ) | |
3591 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3592 } | |
3593 else | |
3594 { | |
3595 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3596 } | |
3597 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 case 6: |
0 | 3600 if ( pPlayer->uSex ) |
3601 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3602 else | |
3603 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 case 7: |
0 | 3606 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3608 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3609 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3610 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3611 case 8: |
0 | 3612 v19 = 0; |
3613 v63 = 0; | |
484 | 3614 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3615 do |
3616 { | |
3617 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3618 { | |
3619 v21 = v63; | |
3620 v22 = word_4EE150[v19]; | |
3621 ++v63; | |
3622 v55[v21] = v22; | |
3623 } | |
3624 ++v19; | |
3625 } | |
3626 while ( v19 < 28 ); | |
3627 if ( v63 ) | |
3628 { | |
3629 v23 = rand() % v63; | |
3630 v24 = dword_A74CDC; | |
3631 if ( dword_A74CDC == -1 ) | |
3632 { | |
3633 v24 = v23; | |
3634 dword_A74CDC = v23; | |
3635 } | |
492 | 3636 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3637 } |
3638 else | |
3639 { | |
3640 v11 = (char *)pNPCTopics[55].pText; | |
3641 } | |
249 | 3642 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3644 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3645 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 case 10: |
0 | 3652 if ( pPlayer->uSex ) |
3653 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3654 else | |
3655 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 case 11: |
0 | 3658 v25 = GetPartyReputation(); |
3659 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 v25 = npc->rep; |
0 | 3662 LABEL_46: |
3663 if ( v25 >= 25 ) | |
3664 { | |
3665 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3666 } | |
3667 else | |
3668 { | |
3669 if ( v25 < 6 ) | |
3670 { | |
3671 if ( v25 >= -5 ) | |
3672 { | |
3673 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3674 } | |
3675 else | |
3676 { | |
3677 if ( v25 < -24 ) | |
3678 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3679 else | |
3680 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3681 } | |
3682 } | |
3683 else | |
3684 { | |
3685 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3686 } | |
3687 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 13: |
0 | 3690 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 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
|
3723 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3725 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3726 sprintf(a1, "%lu", pay_percentage); |
250 | 3727 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3728 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3729 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3730 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3731 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3732 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3733 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3734 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3735 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3736 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3737 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3738 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3739 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3740 sprintf(a1, "%lu", v51); |
0 | 3741 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3742 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3744 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3748 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3752 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3753 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3754 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3755 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3756 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3757 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3758 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3759 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3760 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3761 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3762 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3763 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3764 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3765 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3766 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3767 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3768 switch ( a5 ) |
3769 { | |
3770 case 3: | |
3771 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3772 v45 = a3->GetValue(); |
0 | 3773 v29 = pPlayer->_4B8213(v45, v44); |
3774 break; | |
3775 case 4: | |
3776 v29 = pPlayer->_4B824B(*v37); | |
3777 break; | |
3778 case 5: | |
3779 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 v43 = a3->GetValue(); |
0 | 3781 v29 = pPlayer->_4B8265(v43, v42); |
3782 break; | |
3783 case 6: | |
3784 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3785 v41 = a3->GetValue(); |
0 | 3786 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3787 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3788 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3789 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3791 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3792 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3795 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 v28 = a3->GetValue(); |
749 | 3797 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3798 if ( a5 == 3 ) |
3799 { | |
3800 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 v36 = a3->GetValue(); |
0 | 3802 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3803 if (a3->Broken()) |
0 | 3804 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 goto _continue_sprintf; |
0 | 3806 } |
3807 if ( a5 != 4 ) | |
3808 { | |
3809 if ( a5 == 5 ) | |
3810 { | |
3811 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 v33 = a3->GetValue(); |
0 | 3813 v29 = pPlayer->_4B81C3(v33, v32); |
3814 } | |
3815 else | |
3816 { | |
3817 if ( a5 == 6 ) | |
3818 { | |
3819 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 v31 = a3->GetValue(); |
0 | 3821 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3822 if (a3->Broken()) |
0 | 3823 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 goto _continue_sprintf; |
0 | 3827 } |
3828 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 _continue_sprintf: |
0 | 3830 sprintf(a1, "%lu", v29); |
250 | 3831 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 goto _continue_strcat; |
0 | 3833 } |
3834 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 |
0 | 3836 v48 = v34; |
3837 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3838 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3839 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3840 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3841 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3842 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3843 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3844 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3845 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3846 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3847 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3848 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3849 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3850 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3851 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3852 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3853 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3854 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3855 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3856 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3857 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3858 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3859 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3860 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3861 sub_493F79(&v57, *a6); |
351 | 3862 v54 = v57.field_18_expire_year; |
3863 v53 = v57.field_C_expire_day + 1; | |
3864 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3865 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3866 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3867 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3868 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3869 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3870 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3871 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3872 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3873 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3874 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3875 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3876 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3877 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3878 default: |
0 | 3879 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3880 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3881 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3882 goto _continue_strcat; |
484 | 3883 v49 = pParty->field_3C._s_times[v17-51]; |
3884 | |
0 | 3885 sub_493F79(&v56, v49); |
351 | 3886 v54 = v56.field_18_expire_year; |
3887 v53 = v56.field_C_expire_day + 1; | |
3888 v50 = v56.field_14_exprie_month; | |
0 | 3889 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3890 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3891 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3892 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3893 } |
0 | 3894 } |
3895 return pTmpBuf2; | |
3896 } | |
3897 | |
706 | 3898 |
3899 | |
0 | 3900 |
3901 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3902 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3903 { |
734 | 3904 //stru154 *v3; // edi@1 |
3905 //signed int v4; // eax@1 | |
3906 //signed int result; // eax@9 | |
3907 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3908 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3909 float v7; |
0 | 3910 |
3911 v.x = 0.0; | |
3912 v.y = 0.0; | |
3913 v.z = 0.0; | |
734 | 3914 GetFacePlane(a2, a3, &v, &v7); |
3915 | |
3916 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3917 polygonType = POLYGON_VerticalWall; | |
3918 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3919 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3920 polygonType = POLYGON_Floor; | |
0 | 3921 else |
734 | 3922 polygonType = POLYGON_InBetweenFloorAndWall; |
3923 | |
3924 face_plane.vNormal.x = v.x; | |
3925 face_plane.vNormal.y = v.y; | |
3926 face_plane.vNormal.z = v.z; | |
3927 face_plane.dist = v7; | |
0 | 3928 } |
3929 | |
3930 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3931 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3932 { |
734 | 3933 if (fabsf(pNormal->z) < 1e-6f) |
3934 polygonType = POLYGON_VerticalWall; | |
3935 else if (fabsf(pNormal->x) < 1e-6f && | |
3936 fabsf(pNormal->y) < 1e-6f) | |
3937 polygonType = POLYGON_Floor; | |
0 | 3938 else |
734 | 3939 polygonType = POLYGON_InBetweenFloorAndWall; |
3940 | |
3941 face_plane.vNormal.x = pNormal->x; | |
3942 face_plane.dist = dist; | |
3943 face_plane.vNormal.y = pNormal->y; | |
3944 face_plane.vNormal.z = pNormal->z; | |
0 | 3945 } |
3946 | |
3947 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3948 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3949 { |
3950 ODMFace *v5; // ebx@1 | |
734 | 3951 //int v6; // eax@1 |
3952 //unsigned __int16 *v7; // ebx@2 | |
3953 //Vec3_int_ *v8; // eax@3 | |
0 | 3954 Vec3_int_ *v9; // ecx@3 |
734 | 3955 //double v10; // st7@3 |
3956 //int v11; // ecx@3 | |
0 | 3957 Vec3_int_ *v12; // ecx@3 |
734 | 3958 //double v13; // st7@3 |
3959 //double v14; // st6@3 | |
3960 //double v15; // st5@3 | |
3961 //int v16; // ecx@3 | |
0 | 3962 Vec3_int_ *v17; // eax@3 |
734 | 3963 //double v18; // st5@3 |
0 | 3964 Vec3_float_ *v19; // eax@3 |
734 | 3965 //int result; // eax@8 |
3966 //float v21; // ecx@10 | |
3967 //double v22; // st7@10 | |
3968 //double v23; // st6@10 | |
0 | 3969 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3970 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3971 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3972 float v27; // [sp+20h] [bp-48h]@3 | |
3973 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3974 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3975 //float v30; // [sp+30h] [bp-38h]@3 | |
3976 //float v31; // [sp+34h] [bp-34h]@3 | |
3977 //float v32; // [sp+38h] [bp-30h]@3 | |
3978 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3979 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3980 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3981 //float v36; // [sp+50h] [bp-18h]@3 | |
3982 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3983 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3984 //int v39; // [sp+64h] [bp-4h]@1 |
3985 | |
3986 //v39 = 0; | |
0 | 3987 v1.x = 0.0; |
3988 v5 = pFace; | |
734 | 3989 //v6 = pFace->uNumVertices; |
0 | 3990 v1.y = 0.0; |
3991 v1.z = 0.0; | |
734 | 3992 |
3993 if (pFace->uNumVertices >= 2) | |
3994 { | |
3995 int i = 0; | |
3996 while ( i < pFace->uNumVertices - 2 ) | |
3997 { | |
3998 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3999 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
4000 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
4001 | |
4002 v1.x = v12->x - v9->x; | |
4003 v26 = v17->x - v12->x; | |
4004 v1.y = v12->y - v9->y; | |
4005 v27 = v17->y - v12->y; | |
4006 v1.z = v12->z - v9->z; | |
4007 v28 = v17->z - v12->z; | |
0 | 4008 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
4009 v38.x = v19->x; | |
4010 v38.y = v19->y; | |
4011 v38.z = v19->z; | |
734 | 4012 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
4013 { | |
4014 v38.Normalize(); | |
4015 | |
4016 pOutNormal->x = v38.x; | |
4017 pOutNormal->y = v38.y; | |
4018 pOutNormal->z = v38.z; | |
4019 | |
4020 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
4021 return; | |
4022 } | |
4023 } | |
4024 } | |
4025 | |
4026 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
4027 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
4028 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
4029 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 4030 } |
4031 | |
4032 | |
4033 | |
4034 | |
4035 | |
4036 //----- (0049D700) -------------------------------------------------------- | |
4037 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
4038 { | |
4039 unsigned int v1; // eax@1 | |
4040 int v2; // ecx@1 | |
4041 unsigned int v3; // eax@1 | |
4042 | |
4043 v1 = uDim; | |
4044 v2 = 0; | |
4045 v3 = v1 - 1; | |
4046 while ( v3 & 1 ) | |
4047 { | |
4048 v3 >>= 1; | |
4049 ++v2; | |
4050 } | |
4051 return v3 == 0 ? v2 : 0; | |
4052 } | |
4053 | |
4054 | |
4055 | |
4056 | |
4057 | |
4058 | |
4059 | |
4060 | |
4061 | |
4062 | |
4063 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4064 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4065 { |
737 | 4066 /*signed __int64 v2; // ST10_8@1 |
0 | 4067 double v3; // st7@1 |
4068 float v4; // ST24_4@1 | |
4069 double v5; // ST10_8@1 | |
4070 int v6; // ST1C_4@1 | |
4071 float v7; // ST24_4@1 | |
4072 double v8; // ST10_8@1 | |
4073 unsigned __int8 v9; // ST20_1@1 | |
4074 float v10; // ST24_4@1 | |
4075 double v11; // ST10_8@1 | |
4076 float v12; // ST24_4@1 | |
737 | 4077 double v13; // ST08_8@1*/ |
4078 | |
4079 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4080 (a2 >> 24) / 255.0f * 255.0f), | |
4081 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4082 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4083 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4084 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4085 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4086 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4087 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4088 /*v2 = a1 >> 24; | |
4089 v3 = (double)v2 / 255.0f; | |
4090 HIDWORD(v2) = 0; | |
0 | 4091 LODWORD(v2) = a2 >> 24; |
737 | 4092 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4093 v5 = v4 + 6.7553994e15; |
4094 v6 = LODWORD(v5); | |
737 | 4095 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4096 v8 = v7 + 6.7553994e15; |
4097 v9 = LOBYTE(v8); | |
737 | 4098 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4099 v11 = v10 + 6.7553994e15; |
737 | 4100 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4101 v13 = v12 + 6.7553994e15; |
737 | 4102 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4103 } |
4104 | |
4105 | |
4106 | |
4107 //----- (004A46E6) -------------------------------------------------------- | |
4108 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4109 { | |
4110 int v5; // eax@1 | |
4111 int z; // eax@1 | |
4112 unsigned int v7; // eax@9 | |
4113 unsigned int v8; // ecx@9 | |
4114 int v9; // eax@9 | |
4115 unsigned int v10; // eax@10 | |
4116 int *v11; // esi@10 | |
4117 int *v12; // edi@10 | |
4118 int v13; // ecx@10 | |
4119 int v14; // edx@10 | |
4120 unsigned int v15; // eax@22 | |
4121 int *v16; // esi@22 | |
4122 int *v17; // edi@22 | |
4123 int v18; // ecx@22 | |
4124 int v19; // edx@22 | |
4125 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4126 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4127 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4128 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4129 | |
4130 v5 = a4; | |
4131 v23 = _z >> 16; | |
4132 z = x + v5; | |
693 | 4133 if ( z >= (signed int)pViewport->uViewportTL_X |
4134 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4135 && y >= (signed int)pViewport->uViewportTL_Y | |
4136 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4137 { | |
4138 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4139 x = pViewport->uViewportTL_X; | |
4140 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4141 z = pViewport->uViewportBR_X; | |
0 | 4142 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4143 v22 = z - x; | |
4144 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4145 v7 = lightColor >> 3; | |
4146 v8 = lightColor & 0xF0; | |
4147 v9 = v7 & 0x1E0000; | |
4148 if ( pRenderer->uTargetGBits == 5 ) | |
4149 { | |
4150 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4151 v11 = (int *)pTarget; | |
4152 v12 = pTargetZ; | |
4153 v13 = v22; | |
4154 v14 = (v10 << 16) | v10; | |
4155 z = (unsigned __int8)pTarget & 2; | |
4156 if ( (unsigned __int8)pTarget & 2 ) | |
4157 { | |
4158 z = (unsigned int)*pTargetZ >> 16; | |
4159 if ( z > v23 ) | |
4160 { | |
4161 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4162 *pTarget = z; | |
4163 } | |
4164 v13 = v22 - 1; | |
4165 v11 = (int *)(pTarget + 1); | |
4166 v12 = pTargetZ + 1; | |
4167 } | |
4168 while ( v13 != 1 ) | |
4169 { | |
4170 if ( v13 < 1 ) | |
4171 return z; | |
4172 z = (unsigned int)*v12 >> 16; | |
4173 if ( z <= v23 ) | |
4174 { | |
4175 v13 -= 2; | |
4176 ++v11; | |
4177 v12 += 2; | |
4178 } | |
4179 else | |
4180 { | |
4181 v12 += 2; | |
4182 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4183 v13 -= 2; | |
4184 *v11 = z; | |
4185 ++v11; | |
4186 } | |
4187 } | |
4188 z = (unsigned int)*v12 >> 16; | |
4189 if ( z > v23 ) | |
4190 { | |
4191 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4192 *(short *)v11 = z; | |
4193 } | |
4194 } | |
4195 else | |
4196 { | |
4197 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4198 v16 = (int *)pTarget; | |
4199 v17 = pTargetZ; | |
4200 v18 = v22; | |
4201 v19 = (v15 << 16) | v15; | |
4202 z = (unsigned __int8)pTarget & 2; | |
4203 if ( (unsigned __int8)pTarget & 2 ) | |
4204 { | |
4205 z = (unsigned int)*pTargetZ >> 16; | |
4206 if ( z > v23 ) | |
4207 { | |
4208 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4209 *pTarget = z; | |
4210 } | |
4211 v18 = v22 - 1; | |
4212 v16 = (int *)(pTarget + 1); | |
4213 v17 = pTargetZ + 1; | |
4214 } | |
4215 while ( v18 != 1 ) | |
4216 { | |
4217 if ( v18 < 1 ) | |
4218 return z; | |
4219 z = (unsigned int)*v17 >> 16; | |
4220 if ( z <= v23 ) | |
4221 { | |
4222 v18 -= 2; | |
4223 ++v16; | |
4224 v17 += 2; | |
4225 } | |
4226 else | |
4227 { | |
4228 v17 += 2; | |
4229 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4230 v18 -= 2; | |
4231 *v16 = z; | |
4232 ++v16; | |
4233 } | |
4234 } | |
4235 z = (unsigned int)*v17 >> 16; | |
4236 if ( z > v23 ) | |
4237 { | |
4238 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4239 *(short *)v16 = z; | |
4240 } | |
4241 } | |
4242 } | |
4243 return z; | |
4244 } | |
4245 | |
4246 | |
4247 //----- (004A57E9) -------------------------------------------------------- | |
4248 void __cdecl Present_ColorKey() | |
4249 { | |
4250 HRESULT v0; // eax@3 | |
4251 HRESULT v1; // eax@3 | |
4252 HRESULT v2; // eax@3 | |
4253 HRESULT v3; // eax@3 | |
4254 HRESULT v4; // eax@3 | |
4255 RECT a2; // [sp+4h] [bp-14h]@3 | |
4256 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4257 | |
4258 if ( !pRenderer->uNumSceneBegins ) | |
4259 { | |
4260 if ( pRenderer->field_40110 ) | |
4261 { | |
693 | 4262 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4263 a2.left = 0; |
4264 a2.top = 0; | |
4265 a2.right = 640; | |
4266 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4267 a2.right = 640; | |
4268 a2.left = 0; | |
693 | 4269 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4270 a2.bottom = 480; |
4271 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4272 0, | |
693 | 4273 pViewport->uViewportBR_Y + 1, |
0 | 4274 pRenderer->pColorKeySurface4, |
4275 &a2, | |
4276 16u)); | |
693 | 4277 a2.right = pViewport->uViewportTL_X; |
4278 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4279 a2.left = 0; |
693 | 4280 a2.top = pViewport->uViewportTL_Y; |
0 | 4281 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4282 0, | |
693 | 4283 pViewport->uViewportTL_Y, |
0 | 4284 pRenderer->pColorKeySurface4, |
4285 &a2, | |
4286 16u)); | |
693 | 4287 a2.left = pViewport->uViewportBR_X; |
4288 a2.top = pViewport->uViewportTL_Y; | |
0 | 4289 a2.right = 640; |
693 | 4290 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4291 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4292 pViewport->uViewportBR_X, |
4293 pViewport->uViewportTL_Y, | |
0 | 4294 pRenderer->pColorKeySurface4, |
4295 &a2, | |
4296 16u)); | |
693 | 4297 a2.right = pViewport->uViewportBR_X; |
4298 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4299 a2.left = pViewport->uViewportTL_X; | |
4300 a2.top = pViewport->uViewportTL_Y; | |
0 | 4301 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4302 pViewport->uViewportTL_X, |
4303 pViewport->uViewportTL_Y, | |
0 | 4304 pRenderer->pColorKeySurface4, |
4305 &a2, | |
4306 17u)); | |
4307 } | |
4308 } | |
4309 } | |
4310 | |
4311 //----- (004A597D) -------------------------------------------------------- | |
4312 void Present_NoColorKey() | |
4313 { | |
4314 //unsigned __int16 *v0; // eax@4 | |
4315 unsigned __int16 *v1; // esi@4 | |
4316 void *v2; // edi@4 | |
4317 //signed int v4; // ebx@4 | |
4318 //signed int v5; // ebx@6 | |
4319 //void *v6; // edi@7 | |
4320 //const void *v7; // esi@7 | |
4321 signed int v8; // ebx@8 | |
4322 int v9; // eax@10 | |
4323 unsigned int v10; // esi@10 | |
4324 unsigned __int32 v11; // edi@10 | |
4325 //int v12; // ecx@10 | |
4326 unsigned int v13; // ebx@10 | |
4327 int v14; // eax@11 | |
4328 int v15; // eax@13 | |
4329 int v16; // eax@14 | |
4330 int v17; // eax@16 | |
4331 HRESULT v18; // eax@22 | |
4332 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4333 int v20; // [sp+88h] [bp-1Ch]@10 | |
4334 int v21; // [sp+8Ch] [bp-18h]@10 | |
4335 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4336 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4337 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4338 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4339 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4340 | |
4341 if ( !pRenderer->uNumSceneBegins ) | |
4342 { | |
4343 if ( pRenderer->field_40110 ) | |
4344 { | |
4345 memset(&Dst, 0, 0x7Cu); | |
4346 Dst.dwSize = 124; | |
168 | 4347 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4348 { |
4349 //v26 = Dst.lpSurface; | |
4350 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4351 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4352 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4353 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4354 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4355 v1 = pRenderer->pTargetSurface; | |
4356 v2 = Dst.lpSurface; | |
4357 | |
4358 | |
4359 /*for (uint y = 0; y < 480; ++y) | |
4360 { | |
4361 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4362 for (uint x = 0; x < 640; ++x) | |
4363 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4364 }*/ | |
4365 | |
4366 auto pSrc = pRenderer->pTargetSurface; | |
4367 auto pDst = (__int16 *)Dst.lpSurface; | |
4368 | |
4369 for (uint y = 0; y < 8; ++y) | |
4370 memcpy(pDst + y * Dst.lPitch / 2, | |
4371 | |
4372 pSrc + y * 640, 640 * sizeof(__int16)); | |
4373 | |
4374 for (uint y = 8; y < 352; ++y) | |
4375 { | |
4376 memcpy(pDst + y * Dst.lPitch / 2, | |
4377 pSrc + y * 640, 8 * sizeof(__int16)); | |
4378 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2, | |
4379 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
4380 } | |
4381 | |
121 | 4382 for (uint y = 352; y < 480; ++y) |
0 | 4383 memcpy(pDst + y * Dst.lPitch / 2, |
4384 pSrc + y * 640, 640 * sizeof(__int16)); | |
4385 | |
4386 | |
693 | 4387 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4388 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4389 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4390 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4391 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4392 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4393 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4394 v21 = 4 * v9 + 1280; | |
4395 | |
121 | 4396 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4397 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4398 v10 = (int)pSrc_x1y1; | |
4399 v11 = (int)pDst_x1y1; | |
693 | 4400 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4401 v13 = v24; |
4402 | |
693 | 4403 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4404 { |
4405 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4406 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4407 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4408 { |
4409 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4410 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4411 } | |
4412 } | |
4413 | |
4414 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4415 | |
4416 /* while ( 1 ) | |
4417 { | |
4418 while ( 1 ) | |
4419 { | |
4420 v14 = *(int *)v10; | |
4421 v10 += 4; | |
4422 if ( v14 == v13 ) | |
4423 break; | |
4424 if ( (short)v14 == (short)v13 ) | |
4425 { | |
4426 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4427 v11 += 4; | |
4428 --uHalfWidth; | |
4429 if ( !uHalfWidth ) | |
4430 goto LABEL_21; | |
4431 } | |
4432 else | |
4433 { | |
4434 v15 = __ROL__(v14, 16); | |
4435 if ( (short)v15 == (short)v13 ) | |
4436 { | |
4437 v17 = __ROR__(v15, 16); | |
4438 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4439 v11 += 4; | |
4440 --uHalfWidth; | |
4441 if ( !uHalfWidth ) | |
4442 goto LABEL_21; | |
4443 } | |
4444 else | |
4445 { | |
4446 v16 = __ROR__(v15, 16); | |
4447 *(int *)v11 = v16; | |
4448 v11 += 4; | |
4449 --uHalfWidth; | |
4450 if ( !uHalfWidth ) | |
4451 goto LABEL_21; | |
4452 } | |
4453 } | |
4454 } | |
4455 v11 += 4; | |
4456 --uHalfWidth; | |
4457 if ( !uHalfWidth ) | |
4458 { | |
4459 LABEL_21: | |
4460 v10 += v21; | |
4461 v11 += v22; | |
4462 uHalfWidth = v20; | |
4463 if ( !--uNumLines ) | |
4464 { | |
4465 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4466 return; | |
4467 } | |
4468 } | |
4469 }*/ | |
4470 } | |
4471 } | |
4472 } | |
4473 } | |
4474 | |
4475 | |
4476 | |
4477 //----- (004A7063) -------------------------------------------------------- | |
4478 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4479 { | |
4480 float v2; // ST1C_4@1 | |
4481 double v3; // ST14_8@1 | |
4482 signed int v4; // ebx@1 | |
4483 float v5; // ST1C_4@1 | |
4484 double v6; // ST14_8@1 | |
4485 signed int v7; // edi@1 | |
4486 double v8; // ST0C_8@1 | |
4487 signed int v9; // esi@1 | |
4488 signed int v10; // ecx@1 | |
4489 double v12; // [sp+8h] [bp-18h]@1 | |
4490 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4491 | |
4492 v2 = (double)(uDiffuse >> 24) * a2; | |
4493 v3 = v2 + 6.7553994e15; | |
4494 v4 = LODWORD(v3); | |
4495 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4496 v6 = v5 + 6.7553994e15; | |
4497 v7 = LODWORD(v6); | |
4498 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4499 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4500 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4501 v9 = LODWORD(v8); | |
4502 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4503 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4504 v10 = LODWORD(v12); | |
4505 if ( v4 > 255 ) | |
4506 v4 = 255; | |
4507 if ( v4 < 0 ) | |
4508 v4 = 0; | |
4509 if ( SHIDWORD(v13) > 255 ) | |
4510 v7 = 255; | |
4511 if ( v7 < 0 ) | |
4512 v7 = 0; | |
4513 if ( (signed int)v13 > 255 ) | |
4514 v9 = 255; | |
4515 if ( v9 < 0 ) | |
4516 v9 = 0; | |
4517 if ( SLODWORD(v12) > 255 ) | |
4518 v10 = 255; | |
4519 if ( v10 < 0 ) | |
4520 v10 = 0; | |
4521 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4522 } | |
4523 | |
4524 | |
4525 | |
4526 | |
4527 | |
4528 | |
4529 | |
4530 | |
4531 //----- (004AD504) -------------------------------------------------------- | |
711 | 4532 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4533 { |
4534 int result; // eax@1 | |
711 | 4535 signed int v2; // ebx@1 |
0 | 4536 BLVFace *v3; // esi@3 |
4537 Texture *v4; // edi@6 | |
4538 int v5; // eax@7 | |
4539 int v6; // edx@7 | |
4540 int v7; // ecx@7 | |
4541 int v8; // ebx@8 | |
4542 int v9; // eax@8 | |
4543 int v10; // ebx@8 | |
4544 unsigned int v11; // ebx@9 | |
4545 int v12; // esi@10 | |
4546 int v13; // eax@13 | |
4547 unsigned __int16 *v14; // eax@13 | |
4548 unsigned int v15; // eax@14 | |
4549 unsigned __int16 *v16; // ebx@14 | |
4550 int v17; // eax@15 | |
4551 int v18; // ebx@15 | |
4552 int v19; // esi@15 | |
4553 int v20; // ecx@15 | |
4554 int v21; // eax@15 | |
4555 stru193_math *v22; // ebx@15 | |
4556 int v23; // eax@15 | |
4557 char *v24; // esi@16 | |
4558 int v25; // eax@18 | |
4559 int v26; // eax@18 | |
4560 int v27; // eax@20 | |
4561 signed int v28; // esi@20 | |
4562 signed int v29; // edx@20 | |
4563 signed int v30; // esi@20 | |
4564 signed int v31; // edi@20 | |
4565 int v32; // esi@20 | |
4566 int v33; // eax@26 | |
4567 int *v34; // esi@27 | |
4568 unsigned __int16 *v35; // edi@27 | |
4569 unsigned int v36; // edx@27 | |
4570 int v37; // ebx@27 | |
4571 char v38; // cl@27 | |
4572 char v39; // ch@27 | |
4573 int v40; // ebx@29 | |
4574 int v41; // edx@29 | |
4575 unsigned int v42; // ebx@30 | |
4576 int v43; // edx@30 | |
4577 int v44; // eax@33 | |
4578 int *v45; // esi@34 | |
4579 unsigned __int16 *v46; // edi@34 | |
4580 unsigned int v47; // edx@34 | |
4581 int v48; // ebx@34 | |
4582 char v49; // cl@34 | |
4583 char v50; // ch@34 | |
4584 int v51; // ebx@36 | |
4585 int v52; // edx@36 | |
4586 unsigned __int16 v53; // bx@37 | |
4587 int v54; // edx@37 | |
4588 int v55; // eax@40 | |
4589 int v56; // eax@41 | |
4590 int *v57; // esi@42 | |
4591 unsigned __int16 *v58; // edi@42 | |
4592 unsigned int v59; // edx@42 | |
4593 int v60; // ebx@42 | |
4594 char v61; // cl@42 | |
4595 char v62; // ch@42 | |
4596 unsigned int v63; // ebx@44 | |
4597 int v64; // edx@44 | |
4598 unsigned int v65; // ebx@44 | |
4599 int v66; // edx@44 | |
4600 unsigned int v67; // ebx@45 | |
4601 int v68; // edx@45 | |
4602 int v69; // ebx@45 | |
4603 int v70; // edx@45 | |
4604 int v71; // eax@48 | |
4605 int *v72; // esi@49 | |
4606 unsigned __int16 *v73; // edi@49 | |
4607 unsigned int v74; // edx@49 | |
4608 int v75; // ebx@49 | |
4609 char v76; // cl@49 | |
4610 char v77; // ch@49 | |
4611 unsigned int v78; // ebx@51 | |
4612 int v79; // edx@51 | |
4613 unsigned int v80; // ebx@51 | |
4614 int v81; // edx@51 | |
4615 unsigned int v82; // ebx@52 | |
4616 int v83; // edx@52 | |
4617 int v84; // ebx@52 | |
4618 int v85; // edx@52 | |
4619 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4620 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4621 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4622 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4623 int v90; // [sp+1Ch] [bp-88h]@20 | |
4624 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4625 int v92; // [sp+24h] [bp-80h]@7 | |
4626 int i; // [sp+28h] [bp-7Ch]@7 | |
4627 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4628 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4629 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4630 int v97; // [sp+38h] [bp-6Ch]@15 | |
4631 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4632 int v99; // [sp+40h] [bp-64h]@9 | |
4633 int v100; // [sp+44h] [bp-60h]@24 | |
4634 int v101; // [sp+48h] [bp-5Ch]@10 | |
4635 int v102; // [sp+4Ch] [bp-58h]@20 | |
4636 int v103; // [sp+50h] [bp-54h]@20 | |
4637 int v104; // [sp+54h] [bp-50h]@9 | |
4638 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4639 int v106; // [sp+5Ch] [bp-48h]@24 | |
4640 int v107; // [sp+60h] [bp-44h]@20 | |
4641 int v108; // [sp+64h] [bp-40h]@20 | |
4642 int v109; // [sp+68h] [bp-3Ch]@20 | |
4643 int v110; // [sp+6Ch] [bp-38h]@15 | |
4644 int v111; // [sp+70h] [bp-34h]@20 | |
4645 int a1; // [sp+74h] [bp-30h]@12 | |
4646 int a2; // [sp+78h] [bp-2Ch]@9 | |
4647 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4648 int v115; // [sp+80h] [bp-24h]@18 | |
4649 int v116; // [sp+84h] [bp-20h]@7 | |
4650 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4651 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4652 int *v119; // [sp+90h] [bp-14h]@13 | |
4653 int v120; // [sp+94h] [bp-10h]@15 | |
4654 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4655 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4656 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4657 | |
4658 result = pRenderer->uTargetSurfacePitch; | |
711 | 4659 v2 = sFaceID; |
0 | 4660 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4661 if ( sFaceID >= 0 ) |
4662 { | |
4663 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4664 { | |
4665 v3 = &pIndoor->pFaces[sFaceID]; | |
4666 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4667 if ( !pRenderer->pRenderD3D ) |
4668 { | |
711 | 4669 result = sub_423B5D(sFaceID); |
0 | 4670 if ( result ) |
4671 { | |
4672 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4673 if ( result ) | |
4674 { | |
4675 result = (int)v3->GetTexture(); | |
4676 v4 = (Texture *)result; | |
4677 v96 = (Texture *)result; | |
4678 if ( result ) | |
4679 { | |
4680 v5 = *(short *)(result + 38); | |
4681 LOBYTE(v3->uAttributes) |= 0x80u; | |
4682 v92 = v5; | |
4683 sub_4AE5F1(v2); | |
4684 ++pBLVRenderParams->field_84; | |
4685 v6 = stru_F8AD28.pDeltaUV[0]; | |
4686 v116 = stru_F8AD28.pDeltaUV[1]; | |
4687 v7 = 0; | |
4688 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4689 { | |
4690 v8 = v116; | |
4691 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4692 v9 = 4 * v7 + 16297672; | |
4693 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4694 } | |
4695 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4696 result = stru_F8A590._viewport_space_y; | |
4697 a2 = stru_F8A590._viewport_space_y; | |
4698 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4699 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4700 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4701 v87 = v4->pLevelOfDetail1; |
4702 v88 = v4->pLevelOfDetail2; | |
4703 v89 = v4->pLevelOfDetail3; | |
4704 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4705 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4706 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4707 { | |
4708 v12 = 2 * stru_F8A590._viewport_space_y; | |
4709 v101 = 2 * stru_F8A590._viewport_space_y; | |
4710 while ( 1 ) | |
4711 { | |
4712 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4713 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4714 if ( LOBYTE(viewparams->field_20) ) | |
4715 { | |
4716 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4717 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4718 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4719 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4720 - pBLVRenderParams->uViewportX]; | |
4721 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4722 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4723 - pBLVRenderParams->uViewportX]; | |
4724 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4725 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4726 - pBLVRenderParams->uViewportX]; | |
4727 v123 = (unsigned int)v16; | |
4728 } | |
4729 else | |
4730 { | |
4731 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4732 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4733 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4734 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4735 } | |
4736 v117 = (unsigned int)v14; | |
4737 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4738 v18 = stru_F81018.field_0.field_10; | |
4739 LOWORD(v17) = 0; | |
4740 v97 = stru_F8AD28.field_0 | v17; | |
4741 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4742 v19 = stru_F81018.field_0.field_4 >> i; | |
4743 v20 = 11 - v18; | |
4744 v116 = stru_F81018.field_0.field_8 >> i; | |
4745 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4746 v22 = stru_5C6E00; | |
4747 v122 = (unsigned __int16 *)v20; | |
323 | 4748 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4749 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4750 v120 = v116 + 4 * v23; |
4751 if ( v123 < v117 ) | |
4752 { | |
4753 v24 = (char *)&stru_F81018.field_34.field_8; | |
4754 v114 = &stru_F81018.field_34.field_8; | |
4755 a1 += 16; | |
4756 while ( 1 ) | |
4757 { | |
4758 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4759 v25 = *((int *)v24 - 2); | |
4760 LOWORD(v25) = 0; | |
4761 v115 = v97; | |
4762 v26 = stru_F8AD28.field_0 | v25; | |
4763 if ( v97 <= (unsigned int)v26 ) | |
4764 v115 = v26; | |
4765 v97 = v26; | |
4766 v27 = *((int *)v24 - 11); | |
4767 v28 = *((int *)v24 - 1); | |
4768 v105 = (&v86)[4 * v27]; | |
4769 v111 = v27 + 16; | |
4770 v29 = v4->uWidthMinus1; | |
4771 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4772 v107 = v29 >> v27; | |
4773 v30 = v28 >> i; | |
4774 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4775 v31 = *v114 >> i; | |
4776 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4777 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4778 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4779 v108 = (signed int)(v116 - v121) >> 4; |
4780 v103 = (v90 - v120) >> 4; | |
4781 v32 = v123 + 32; | |
4782 if ( LOBYTE(viewparams->field_20) ) | |
4783 v32 = v123 + 64; | |
4784 if ( v32 > v117 ) | |
4785 v32 = v117; | |
4786 v118 = v32; | |
4787 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4788 v106 = (signed int)(v32 - v123) >> 1; | |
4789 if ( v110 >> 16 == v100 >> 16 ) | |
4790 { | |
4791 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4792 if ( LOBYTE(viewparams->field_20) ) | |
4793 { | |
4794 v44 = v123; | |
4795 if ( v123 < v118 ) | |
4796 { | |
4797 v45 = v119; | |
4798 v46 = v122; | |
4799 v47 = v121; | |
4800 v48 = v120; | |
4801 v49 = v111; | |
4802 v50 = v109; | |
4803 if ( v106 & 2 ) | |
4804 { | |
4805 *v119 = v115; | |
4806 v45 -= 2; | |
4807 v44 = v123 + 4; | |
4808 goto LABEL_37; | |
4809 } | |
4810 do | |
4811 { | |
4812 v44 += 8; | |
4813 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4814 v52 = v115; | |
4815 LOWORD(v51) = v46[v51]; | |
4816 *v45 = v115; | |
4817 v45[1] = v52; | |
4818 v45[640] = v52; | |
4819 v45[641] = v52; | |
4820 *(short *)(v44 - 8) = v51; | |
4821 *(short *)(v44 - 6) = v51; | |
4822 *(short *)(v44 + 1272) = v51; | |
4823 *(short *)(v44 + 1274) = v51; | |
4824 v45[2] = v52; | |
4825 v45[3] = v52; | |
4826 v45[642] = v52; | |
4827 v45[643] = v52; | |
4828 v121 += v108; | |
4829 v120 += v103; | |
4830 v47 = v121; | |
4831 v48 = v120; | |
4832 LABEL_37: | |
4833 v45 += 4; | |
4834 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4835 v54 = v108; | |
4836 *(short *)(v44 - 4) = v53; | |
4837 *(short *)(v44 - 2) = v53; | |
4838 *(short *)(v44 + 1276) = v53; | |
4839 *(short *)(v44 + 1278) = v53; | |
4840 v121 += v54; | |
4841 v120 += v103; | |
4842 v47 = v121; | |
4843 v48 = v120; | |
4844 } | |
4845 while ( v44 < v118 ); | |
4846 v123 = v44; | |
4847 v119 = v45; | |
4848 } | |
4849 } | |
4850 else | |
4851 { | |
4852 v33 = v123; | |
4853 if ( v123 < v118 ) | |
4854 { | |
4855 v34 = v119; | |
4856 v35 = v122; | |
4857 v36 = v121; | |
4858 v37 = v120; | |
4859 v38 = v111; | |
4860 v39 = v109; | |
4861 if ( v106 & 1 ) | |
4862 { | |
4863 *v119 = v115; | |
4864 --v34; | |
4865 v33 = v123 + 2; | |
4866 goto LABEL_30; | |
4867 } | |
4868 do | |
4869 { | |
4870 v33 += 4; | |
4871 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4872 v41 = v115; | |
4873 LOWORD(v40) = v35[v40]; | |
4874 *v34 = v115; | |
4875 *(short *)(v33 - 4) = v40; | |
4876 v34[1] = v41; | |
4877 v121 += v108; | |
4878 v120 += v103; | |
4879 v36 = v121; | |
4880 v37 = v120; | |
4881 LABEL_30: | |
4882 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4883 v34 += 2; | |
4884 v43 = v108; | |
4885 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4886 v121 += v43; | |
4887 v120 += v103; | |
4888 v36 = v121; | |
4889 v37 = v120; | |
4890 } | |
4891 while ( v33 < v118 ); | |
4892 v123 = v33; | |
4893 v119 = v34; | |
4894 } | |
4895 } | |
4896 } | |
4897 else | |
4898 { | |
4899 v55 = v110 - ((v100 - v110) >> 4); | |
4900 v110 = (v100 - v110) >> 4; | |
4901 v122 = (unsigned __int16 *)v55; | |
4902 if ( LOBYTE(viewparams->field_20) ) | |
4903 { | |
4904 v71 = v123; | |
4905 if ( v123 < v118 ) | |
4906 { | |
4907 v72 = v119; | |
4908 v73 = v94; | |
4909 v74 = v121; | |
4910 v75 = v120; | |
4911 v76 = v111; | |
4912 v77 = v109; | |
4913 if ( v106 & 2 ) | |
4914 { | |
4915 *v119 = v115; | |
4916 v72 += 2; | |
4917 v71 = v123 + 4; | |
4918 goto LABEL_52; | |
4919 } | |
4920 do | |
4921 { | |
4922 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4923 v79 = (int)((char *)v122 + v110); | |
4924 v71 += 8; | |
4925 v122 = (unsigned __int16 *)v79; | |
4926 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4927 v81 = v115; | |
4928 LOWORD(v80) = v73[v80]; | |
4929 *v72 = v115; | |
4930 v72[1] = v81; | |
4931 v72[640] = v81; | |
4932 v72[641] = v81; | |
4933 *(short *)(v71 - 8) = v80; | |
4934 *(short *)(v71 - 6) = v80; | |
4935 *(short *)(v71 + 1272) = v80; | |
4936 *(short *)(v71 + 1274) = v80; | |
4937 v72[2] = v81; | |
4938 v72[3] = v81; | |
4939 v72[642] = v81; | |
4940 v72[643] = v81; | |
4941 v121 += v108; | |
4942 v120 += v103; | |
4943 v74 = v121; | |
4944 v75 = v120; | |
4945 v72 += 4; | |
4946 LABEL_52: | |
4947 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4948 v83 = (int)((char *)v122 + v110); | |
4949 v84 = v105[v82]; | |
4950 v122 = (unsigned __int16 *)v83; | |
4951 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4952 v85 = v108; | |
4953 *(short *)(v71 - 4) = v84; | |
4954 *(short *)(v71 - 2) = v84; | |
4955 *(short *)(v71 + 1276) = v84; | |
4956 *(short *)(v71 + 1278) = v84; | |
4957 v121 += v85; | |
4958 v120 += v103; | |
4959 v74 = v121; | |
4960 v75 = v120; | |
4961 } | |
4962 while ( v71 < v118 ); | |
4963 v123 = v71; | |
4964 v119 = v72; | |
4965 } | |
4966 } | |
4967 else | |
4968 { | |
4969 v56 = v123; | |
4970 if ( v123 < v118 ) | |
4971 { | |
4972 v57 = v119; | |
4973 v58 = v94; | |
4974 v59 = v121; | |
4975 v60 = v120; | |
4976 v61 = v111; | |
4977 v62 = v109; | |
4978 if ( v106 & 1 ) | |
4979 { | |
4980 *v119 = v115; | |
4981 ++v57; | |
4982 v56 = v123 + 2; | |
4983 goto LABEL_45; | |
4984 } | |
4985 do | |
4986 { | |
4987 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4988 v64 = (int)((char *)v122 + v110); | |
4989 v56 += 4; | |
4990 v122 = (unsigned __int16 *)v64; | |
4991 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4992 v66 = v115; | |
4993 LOWORD(v65) = v58[v65]; | |
4994 *v57 = v115; | |
4995 *(short *)(v56 - 4) = v65; | |
4996 v57[1] = v66; | |
4997 v121 += v108; | |
4998 v120 += v103; | |
4999 v59 = v121; | |
5000 v60 = v120; | |
5001 v57 += 2; | |
5002 LABEL_45: | |
5003 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
5004 v68 = (int)((char *)v122 + v110); | |
5005 v69 = v105[v67]; | |
5006 v122 = (unsigned __int16 *)v68; | |
5007 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
5008 v70 = v108; | |
5009 *(short *)(v56 - 2) = v69; | |
5010 v121 += v70; | |
5011 v120 += v103; | |
5012 v59 = v121; | |
5013 v60 = v120; | |
5014 } | |
5015 while ( v56 < v118 ); | |
5016 v123 = v56; | |
5017 v119 = v57; | |
5018 } | |
5019 } | |
5020 } | |
5021 v114 += 13; | |
5022 v110 = v100; | |
5023 a1 += 16; | |
5024 v4 = v96; | |
5025 v121 = v116; | |
5026 v120 = v90; | |
5027 if ( v123 >= v117 ) | |
5028 break; | |
5029 v24 = (char *)v114; | |
5030 v22 = stru_5C6E00; | |
5031 } | |
5032 } | |
5033 ++a2; | |
5034 v98 += v95; | |
5035 result = a2; | |
5036 v101 += 2; | |
5037 v99 += 640; | |
5038 if ( a2 > stru_F8A590._viewport_space_w ) | |
5039 break; | |
5040 v12 = v101; | |
5041 result = a2; | |
5042 v11 = v98; | |
5043 } | |
5044 } | |
5045 } | |
5046 } | |
5047 } | |
5048 } | |
5049 } | |
5050 } | |
5051 return result; | |
5052 } | |
5053 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5054 | |
5055 //----- (004ADD1D) -------------------------------------------------------- | |
5056 void __fastcall sub_4ADD1D(int uFaceID) | |
5057 { | |
5058 int v1; // edi@1 | |
5059 BLVFace *v2; // esi@3 | |
5060 signed int v3; // ebx@4 | |
5061 Texture *v4; // edi@9 | |
5062 signed int v5; // eax@9 | |
5063 char *v6; // edi@12 | |
5064 signed int v7; // eax@15 | |
5065 unsigned int v8; // eax@16 | |
5066 __int16 v9; // cx@19 | |
5067 unsigned __int8 *v10; // eax@19 | |
5068 unsigned __int16 *v11; // eax@19 | |
5069 int v12; // edi@19 | |
5070 int v13; // ebx@20 | |
5071 stru352 *v14; // esi@20 | |
5072 DWORD v15; // eax@22 | |
5073 signed int v16; // ecx@22 | |
5074 signed int v17; // ST68_4@22 | |
5075 int v18; // eax@22 | |
5076 int v19; // ecx@22 | |
5077 unsigned int v20; // esi@23 | |
5078 int v21; // edi@23 | |
5079 int v22; // eax@23 | |
5080 int *v23; // ebx@24 | |
5081 int v24; // edx@24 | |
5082 int v25; // ebx@25 | |
5083 unsigned __int16 v26; // cx@25 | |
5084 int v27; // edx@26 | |
5085 unsigned __int16 v28; // cx@26 | |
5086 unsigned __int8 v29; // sf@27 | |
5087 unsigned __int8 v30; // of@27 | |
5088 unsigned int v31; // esi@29 | |
5089 int v32; // edi@29 | |
5090 unsigned __int16 *v33; // eax@29 | |
5091 int *v34; // ebx@30 | |
5092 int v35; // edx@30 | |
5093 int v36; // ebx@31 | |
5094 unsigned __int16 v37; // cx@31 | |
5095 int v38; // edx@32 | |
5096 unsigned __int16 v39; // cx@32 | |
5097 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5098 int v41; // [sp-Ch] [bp-68h]@15 | |
5099 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5100 signed int v43; // [sp+14h] [bp-48h]@12 | |
5101 signed int v44; // [sp+14h] [bp-48h]@22 | |
5102 int v45; // [sp+1Ch] [bp-40h]@22 | |
5103 int v46; // [sp+20h] [bp-3Ch]@22 | |
5104 int v47; // [sp+24h] [bp-38h]@19 | |
5105 char v48; // [sp+28h] [bp-34h]@19 | |
5106 int v49; // [sp+2Ch] [bp-30h]@19 | |
5107 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5108 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5109 int v52; // [sp+38h] [bp-24h]@22 | |
5110 int v53; // [sp+3Ch] [bp-20h]@22 | |
5111 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5112 int v55; // [sp+40h] [bp-1Ch]@20 | |
5113 int v56; // [sp+44h] [bp-18h]@20 | |
5114 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5115 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5116 int v59; // [sp+50h] [bp-Ch]@4 | |
5117 int v60; // [sp+50h] [bp-Ch]@19 | |
5118 int v61; // [sp+54h] [bp-8h]@22 | |
5119 int *v62; // [sp+58h] [bp-4h]@23 | |
5120 int *v63; // [sp+58h] [bp-4h]@29 | |
5121 | |
5122 v1 = uFaceID; | |
5123 v42 = pRenderer->uTargetSurfacePitch; | |
5124 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5125 { | |
5126 v2 = &pIndoor->pFaces[uFaceID]; | |
5127 if ( pRenderer->pRenderD3D ) | |
5128 { | |
5129 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5130 v59 = v3; | |
5131 } | |
5132 else | |
5133 { | |
5134 v59 = sub_423B5D(uFaceID); | |
5135 v3 = v59; | |
5136 } | |
5137 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5138 { | |
5139 v4 = v2->GetTexture(); | |
5140 v5 = 0; | |
5141 if ( v4 ) | |
5142 { | |
5143 if ( pRenderer->pRenderD3D ) | |
5144 { | |
5145 if ( v3 > 0 ) | |
5146 { | |
5147 v54 = v3; | |
5148 v43 = v3; | |
5149 v6 = (char *)&array_507D30[0].v; | |
5150 do | |
5151 { | |
5152 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5153 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5154 v6 += 48; | |
5155 --v54; | |
5156 } | |
5157 while ( v54 ); | |
5158 v3 = v59; | |
5159 v5 = v43; | |
5160 } | |
5161 v7 = v5; | |
5162 v41 = stru_F8AD28.field_0; | |
5163 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5164 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5165 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5166 { | |
5167 v40 = v2->GetTexture(); | |
5168 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5169 } | |
5170 else | |
5171 { | |
5172 v40 = v2->GetTexture(); | |
5173 v8 = v2->uBitmapID; | |
5174 } | |
5175 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5176 } | |
5177 else | |
5178 { | |
5179 v49 = v4->uWidthMinus1; | |
5180 v47 = v4->uHeightMinus1 << 16; | |
5181 v9 = 16 - v4->uWidthLn2; | |
710 | 5182 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5183 LOBYTE(v2->uAttributes) |= 0x80u; |
5184 v48 = v9; | |
5185 v50 = v10; | |
5186 sub_4AF412(); | |
5187 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5188 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5189 v12 = stru_F8A590._viewport_space_y; | |
5190 v51 = v11; | |
5191 v60 = stru_F8A590._viewport_space_y; | |
5192 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5193 { | |
5194 v13 = 2 * stru_F8A590._viewport_space_y; | |
5195 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5196 v55 = 2 * stru_F8A590._viewport_space_y; | |
5197 v56 = 640 * stru_F8A590._viewport_space_y; | |
5198 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5199 { | |
5200 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5201 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5202 v15 = GetTickCount(); | |
5203 v16 = v14->field_0; | |
5204 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5205 v45 = v14->field_4 >> 3; | |
5206 v44 = v16 >> 3; | |
5207 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5208 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5209 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5210 v18 = v14->field_28; | |
5211 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5212 LOWORD(v18) = 0; | |
5213 v46 = stru_F8AD28.field_0 | v18; | |
5214 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5215 if ( LOBYTE(viewparams->field_20) ) | |
5216 { | |
5217 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5218 - pBLVRenderParams->uViewportX]; | |
5219 v31 = v44; | |
5220 v32 = v45; | |
5221 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5222 + 2 * v19 | |
5223 - pBLVRenderParams->uViewportX]; | |
5224 if ( v61 & 1 ) | |
5225 { | |
5226 --v61; | |
5227 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5228 + 2 * v19 | |
5229 - pBLVRenderParams->uViewportX | |
5230 - 2]; | |
5231 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5232 - pBLVRenderParams->uViewportX]; | |
5233 v35 = v46; | |
5234 v63 += 2; | |
5235 goto LABEL_32; | |
5236 } | |
5237 while ( 1 ) | |
5238 { | |
5239 v30 = __OFSUB__(v61, 2); | |
5240 v29 = v61 - 2 < 0; | |
5241 v61 -= 2; | |
5242 if ( v29 ^ v30 ) | |
5243 break; | |
5244 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5245 v31 += v52; | |
5246 v37 = v51[v36]; | |
5247 v32 += v53; | |
5248 v34 = v63; | |
5249 v35 = v46; | |
5250 *v33 = v37; | |
5251 v33[1] = v37; | |
5252 v33[640] = v37; | |
5253 v33[641] = v37; | |
5254 v63 += 4; | |
5255 v34[2] = v46; | |
5256 v34[3] = v46; | |
5257 v34[642] = v46; | |
5258 v34[643] = v46; | |
5259 LABEL_32: | |
5260 *v34 = v35; | |
5261 v34[1] = v35; | |
5262 v34[640] = v35; | |
5263 v34[641] = v35; | |
5264 v38 = v49 & (v31 >> 16); | |
5265 v33 += 4; | |
5266 v31 += v52; | |
5267 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5268 v32 += v53; | |
5269 *(v33 - 2) = v39; | |
5270 *(v33 - 1) = v39; | |
5271 v33[638] = v39; | |
5272 v33[639] = v39; | |
5273 } | |
5274 } | |
5275 else | |
5276 { | |
5277 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5278 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5279 v20 = v44; | |
5280 v21 = v45; | |
5281 v22 = (int)v58; | |
5282 if ( v61 & 1 ) | |
5283 { | |
5284 --v61; | |
5285 v22 = (int)(v58 - 1); | |
5286 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5287 v24 = v46; | |
5288 ++v62; | |
5289 goto LABEL_26; | |
5290 } | |
5291 while ( 1 ) | |
5292 { | |
5293 v30 = __OFSUB__(v61, 2); | |
5294 v29 = v61 - 2 < 0; | |
5295 v61 -= 2; | |
5296 if ( v29 ^ v30 ) | |
5297 break; | |
5298 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5299 v20 += v52; | |
5300 v26 = v51[v25]; | |
5301 v21 += v53; | |
5302 v23 = v62; | |
5303 v24 = v46; | |
5304 *(short *)v22 = v26; | |
5305 v62 += 2; | |
5306 v23[1] = v46; | |
5307 LABEL_26: | |
5308 *v23 = v24; | |
5309 v27 = v49 & (v20 >> 16); | |
5310 v22 += 4; | |
5311 v20 += v52; | |
5312 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5313 v21 += v53; | |
5314 *(short *)(v22 - 2) = v28; | |
5315 } | |
5316 } | |
5317 ++v60; | |
5318 ++i; | |
5319 v56 += 640; | |
5320 v55 += 2; | |
5321 if ( v60 > stru_F8A590._viewport_space_w ) | |
5322 break; | |
5323 v13 = v55; | |
5324 v12 = v60; | |
5325 } | |
5326 } | |
5327 } | |
5328 } | |
5329 } | |
5330 } | |
5331 } | |
5332 | |
5333 //----- (004AE1E7) -------------------------------------------------------- | |
5334 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5335 { | |
5336 int v3; // ebx@1 | |
5337 int v4; // edi@1 | |
5338 int v5; // esi@1 | |
5339 signed __int64 v6; // qtt@3 | |
5340 int v7; // esi@3 | |
5341 int v8; // eax@5 | |
5342 int result; // eax@5 | |
5343 int v10; // edx@5 | |
5344 int v11; // [sp+Ch] [bp-8h]@1 | |
5345 int v12; // [sp+1Ch] [bp+8h]@2 | |
5346 | |
5347 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5348 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5349 v11 = a1; | |
5350 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5351 + stru_F8AD28.field_7C | |
5352 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5353 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5354 { | |
5355 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5356 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5357 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5358 } | |
5359 else | |
5360 { | |
5361 v7 = 1073741824; | |
5362 } | |
5363 v8 = stru_F8AD28.vec_9C.z; | |
5364 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5365 + stru_F8AD28.vec_8C.x | |
5366 + v4 * stru_F8AD28.vec_8C.y) | |
5367 * (signed __int64)v7) >> 16) | |
5368 + stru_F8AD28.field_98; | |
5369 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5370 v10 = result + stru_F8AD28.field_A8; | |
5371 stru_F83B80[v11].field_28 = v7; | |
5372 stru_F83B80[v11].field_4 = v10; | |
5373 return result; | |
5374 } | |
5375 | |
5376 //----- (004AE313) -------------------------------------------------------- | |
5377 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5378 { | |
5379 int _dy; // ebx@1 | |
5380 int _dx; // edi@1 | |
5381 int v5; // ecx@1 | |
5382 int v6; // esi@1 | |
5383 int v7; // ST18_4@2 | |
5384 signed __int64 v8; // qtt@3 | |
5385 unsigned int v9; // ecx@3 | |
5386 int result; // eax@8 | |
5387 int v11; // [sp+Ch] [bp-8h]@1 | |
5388 | |
5389 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5390 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5391 ++pBLVRenderParams->field_88; | |
5392 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5393 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5394 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5395 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5396 { | |
5397 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5398 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5399 v9 = v8 / v11; | |
5400 } | |
5401 else | |
5402 { | |
5403 v9 = 0x40000000u; | |
5404 } | |
5405 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5406 p->field_0 = v9; | |
5407 else | |
5408 p->field_0 = stru_F8AD28.field_34; | |
5409 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5410 * (signed __int64)(signed int)v9) >> 16) | |
5411 + stru_F8AD28.field_98 | |
5412 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5413 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5414 * (signed __int64)(signed int)v9) >> 16) | |
5415 + stru_F8AD28.field_A8 | |
5416 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5417 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5418 if ( result < 369620 || bUseLoResSprites ) | |
5419 { | |
5420 if ( result < 184810 ) | |
5421 p->field_10 = result > 92405; | |
5422 else | |
5423 p->field_10 = 2; | |
5424 } | |
5425 else | |
5426 { | |
5427 p->field_10 = 3; | |
5428 } | |
5429 return result; | |
5430 } | |
5431 | |
5432 //----- (004AE491) -------------------------------------------------------- | |
5433 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5434 { | |
5435 signed int v2; // eax@1 | |
5436 signed int v3; // edi@1 | |
5437 int v4; // ecx@1 | |
5438 int v5; // esi@2 | |
5439 int v6; // eax@2 | |
5440 int v7; // ebx@2 | |
5441 unsigned int v8; // ecx@2 | |
5442 int v9; // edx@5 | |
5443 int v10; // edx@7 | |
5444 unsigned int v11; // eax@8 | |
5445 int v13; // [sp+4h] [bp-18h]@2 | |
5446 int v14; // [sp+8h] [bp-14h]@2 | |
5447 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5448 int v16; // [sp+14h] [bp-8h]@1 | |
5449 int v17; // [sp+18h] [bp-4h]@1 | |
5450 | |
5451 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5452 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5453 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5454 v4 = 0; | |
5455 v15 = v2; | |
5456 v16 = 0; | |
5457 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5458 { | |
5459 do | |
5460 { | |
5461 v5 = v16; | |
5462 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5463 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5464 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5465 v7 = v13; | |
5466 v8 = v14; | |
5467 if ( v6 < v13 ) | |
5468 { | |
5469 v6 = v13; | |
5470 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5471 } | |
5472 if ( v6 < v14 ) | |
5473 { | |
5474 v9 = v6; | |
5475 v6 = v14; | |
5476 v8 = v9; | |
5477 } | |
5478 if ( v7 < (signed int)v8 ) | |
5479 { | |
5480 v10 = v8; | |
5481 v8 = v7; | |
5482 v7 = v10; | |
5483 } | |
5484 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5485 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5486 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5487 ++v16; | |
5488 v2 = v15; | |
5489 } | |
5490 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5491 v4 = 0; | |
5492 } | |
5493 if ( stru_F8AD28.field_3E4 != v4 ) | |
5494 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5495 if ( v17 >= v4 ) | |
5496 { | |
5497 if ( v17 > 2031616 ) | |
5498 v17 = 2031616; | |
5499 } | |
5500 else | |
5501 { | |
5502 v17 = v4; | |
5503 } | |
5504 ++pBLVRenderParams->field_8C; | |
5505 return v17; | |
5506 } | |
5507 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5508 | |
5509 | |
5510 | |
5511 | |
5512 //----- (004AE5F1) -------------------------------------------------------- | |
5513 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5514 { | |
5515 BLVFace *v1; // esi@1 | |
5516 BLVFaceExtra *v2; // ebx@1 | |
5517 int v3; // eax@1 | |
5518 int v4; // edi@1 | |
5519 Texture *v5; // edi@1 | |
5520 int v6; // eax@1 | |
5521 unsigned int v7; // eax@1 | |
5522 unsigned int v8; // ecx@1 | |
5523 unsigned int v9; // eax@1 | |
5524 unsigned int v10; // ecx@5 | |
5525 int v11; // edi@10 | |
5526 int v12; // ecx@10 | |
5527 int v13; // eax@10 | |
5528 int v14; // edx@10 | |
5529 int v15; // ebx@12 | |
5530 double v16; // st7@16 | |
5531 int v17; // eax@16 | |
5532 char *v18; // ebx@17 | |
5533 int v19; // ecx@19 | |
5534 int v20; // eax@19 | |
5535 int v21; // edx@21 | |
5536 int v22; // eax@23 | |
5537 int v23; // ST04_4@26 | |
5538 int v24; // edi@26 | |
5539 double v25; // st6@26 | |
5540 int v26; // eax@26 | |
5541 double v27; // st6@26 | |
5542 int v28; // ecx@26 | |
5543 char v29; // al@26 | |
5544 int v30; // edx@28 | |
5545 int v31; // ecx@28 | |
5546 BLVLightMM7 *v32; // ecx@32 | |
5547 int v33; // edi@33 | |
5548 int v34; // edx@33 | |
5549 int v35; // eax@33 | |
5550 int v36; // edi@35 | |
5551 int v37; // edx@37 | |
5552 int v38; // ebx@39 | |
5553 int v39; // edi@42 | |
5554 int v40; // eax@42 | |
5555 char *v41; // ebx@45 | |
5556 signed int v42; // ecx@47 | |
5557 int v43; // edi@47 | |
5558 int v44; // eax@49 | |
5559 int v45; // edx@51 | |
5560 int v46; // eax@53 | |
5561 int v47; // ST04_4@55 | |
5562 int v48; // edi@55 | |
5563 double v49; // st6@55 | |
5564 int v50; // eax@55 | |
5565 double v51; // st6@55 | |
5566 int v52; // eax@55 | |
5567 int v53; // ecx@57 | |
5568 int v54; // ecx@58 | |
5569 int v55; // ecx@59 | |
5570 int v56; // edx@62 | |
5571 int v57; // ecx@62 | |
5572 int v58; // eax@63 | |
5573 int v59; // edx@64 | |
5574 int v60; // ecx@67 | |
5575 int v61; // edx@67 | |
5576 int v62; // eax@68 | |
5577 int v63; // edx@69 | |
5578 signed int v64; // ecx@72 | |
5579 double v65; // st7@75 | |
5580 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5581 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5582 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5583 int v69; // [sp+28h] [bp-18h]@10 | |
5584 int v70; // [sp+2Ch] [bp-14h]@10 | |
5585 int X; // [sp+30h] [bp-10h]@10 | |
5586 int v72; // [sp+34h] [bp-Ch]@10 | |
5587 int v73; // [sp+38h] [bp-8h]@10 | |
5588 int v74; // [sp+3Ch] [bp-4h]@10 | |
5589 | |
5590 v1 = &pIndoor->pFaces[uFaceID]; | |
5591 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5592 v3 = v1->uBitmapID; | |
5593 v4 = v1->uBitmapID; | |
5594 v68 = v2; | |
5595 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5596 v6 = 8 * uFaceID; | |
5597 LOBYTE(v6) = 8 * uFaceID | 6; | |
5598 stru_F8AD28.field_0 = v6; | |
5599 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5600 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5601 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5602 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5603 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5604 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5605 v7 = GetTickCount(); | |
5606 v8 = v1->uAttributes; | |
5607 v9 = v7 >> 3; | |
5608 if ( v8 & 4 ) | |
5609 { | |
5610 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5611 } | |
5612 else | |
5613 { | |
5614 if ( v8 & 0x20 ) | |
5615 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5616 } | |
5617 v10 = v1->uAttributes; | |
5618 if ( BYTE1(v10) & 8 ) | |
5619 { | |
5620 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5621 } | |
5622 else | |
5623 { | |
5624 if ( v10 & 0x40 ) | |
5625 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5626 } | |
5627 v1->_get_normals(&v67, &v66); | |
5628 stru_F8AD28.vec_14.x = v67.x; | |
5629 stru_F8AD28.vec_14.y = v67.y; | |
5630 stru_F8AD28.vec_14.z = v67.z; | |
5631 stru_F8AD28.vec_20.x = v66.x; | |
5632 stru_F8AD28.vec_20.y = v66.y; | |
5633 stru_F8AD28.vec_20.z = v66.z; | |
5634 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5635 if ( pBLVRenderParams->sPartyRotX ) | |
5636 { | |
5637 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5638 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5639 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5640 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5641 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5642 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5643 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5644 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5645 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5646 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5647 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5648 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5649 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5650 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5651 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5652 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5653 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5654 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5655 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5656 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5657 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5658 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5659 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5660 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5661 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5662 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5663 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5664 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5665 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5666 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5667 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5668 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5669 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5670 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5671 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5672 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5673 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5674 v13 = pBLVRenderParams->vPartyPos.y; | |
5675 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5676 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5677 v14 = pBLVRenderParams->vPartyPos.x; | |
5678 } | |
5679 else | |
5680 { | |
5681 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5682 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5683 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5684 - v70; | |
5685 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5686 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5687 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5688 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5689 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5690 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5691 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5692 - v70; | |
5693 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5694 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5695 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5696 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5697 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5698 - v70; | |
5699 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5700 v14 = pBLVRenderParams->vPartyPos.x; | |
5701 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5702 v13 = pBLVRenderParams->vPartyPos.y; | |
5703 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5704 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5705 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5706 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5707 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5708 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5709 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5710 } | |
5711 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5712 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5713 + stru_F8AD28.plane_4.dist | |
5714 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5715 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5716 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5717 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5718 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5719 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5720 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5721 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5722 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5723 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5724 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5725 v15 = v70; | |
5726 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5727 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5728 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5729 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5730 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5731 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5732 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5733 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5734 stru_F8AD28.field_38 = 0; | |
5735 stru_F8AD28.field_A8 = -(X | |
5736 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5737 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5738 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5739 { | |
5740 stru_F8AD28.field_3E4 = 1; | |
5741 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5742 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5743 stru_F8AD28.field_3F0 = v68->field_1E; | |
5744 stru_F8AD28.field_3F4 = v68->field_20; | |
5745 } | |
5746 else | |
5747 { | |
5748 stru_F8AD28.field_3E4 = 0; | |
5749 } | |
5750 v16 = 0.0039215689; | |
5751 v17 = 116 * v1->uSectorID; | |
5752 v69 = v17; | |
5753 v74 = 0; | |
5754 v73 = 0; | |
5755 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5756 v70 = pMobileLightsStack->uNumLightsActive; | |
5757 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5758 { | |
5759 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5760 do | |
5761 { | |
5762 if ( v74 >= 20 ) | |
5763 break; | |
5764 v19 = *((short *)v18 + 2); | |
5765 v20 = *((short *)v18 - 1); | |
5766 if ( v20 > v1->pBounding.x1 - v19 ) | |
5767 { | |
5768 if ( v20 < v19 + v1->pBounding.x2 ) | |
5769 { | |
5770 v21 = *(short *)v18; | |
5771 if ( v21 > v1->pBounding.y1 - v19 ) | |
5772 { | |
5773 if ( v21 < v19 + v1->pBounding.y2 ) | |
5774 { | |
5775 v22 = *((short *)v18 + 1); | |
5776 if ( v22 > v1->pBounding.z1 - v19 ) | |
5777 { | |
5778 if ( v22 < v19 + v1->pBounding.z2 ) | |
5779 { | |
5780 X = (v1->pFacePlane_old.dist | |
5781 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5782 + v21 * v1->pFacePlane_old.vNormal.y | |
5783 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5784 if ( X <= v19 ) | |
5785 { | |
5786 v23 = X; | |
5787 v24 = v74; | |
5788 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5789 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5790 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5791 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5792 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5793 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5794 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5795 v25 = (double)(signed int)v68 * v16; | |
5796 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5797 v26 = (unsigned __int8)v18[8]; | |
5798 *(float *)(v24 * 4 + 16297992) = v25; | |
5799 v27 = (double)(signed int)v68; | |
5800 v68 = (BLVFaceExtra *)v26; | |
5801 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5802 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5803 v16 = 0.0039215689; | |
5804 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5805 v28 = v74; | |
5806 v29 = v18[9]; | |
5807 ++v74; | |
5808 stru_F8AD28._blv_lights_types[v28] = v29; | |
5809 } | |
5810 } | |
5811 } | |
5812 } | |
5813 } | |
5814 } | |
5815 } | |
5816 ++v73; | |
5817 v18 += 18; | |
5818 v17 = v69; | |
5819 } | |
5820 while ( v73 < v70 ); | |
5821 } | |
5822 v30 = 0; | |
5823 v73 = 0; | |
5824 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5825 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5826 if ( v31 > 0 ) | |
5827 { | |
5828 while ( v74 < 20 ) | |
5829 { | |
5830 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5831 if ( !(v32->uAtributes & 8) ) | |
5832 { | |
5833 v33 = v1->pBounding.x1; | |
5834 v34 = v32->vPosition.x; | |
5835 X = v32->uBrightness; | |
5836 v35 = v32->uRadius; | |
5837 v68 = (BLVFaceExtra *)v32->uRadius; | |
5838 if ( v34 > v33 - v35 ) | |
5839 { | |
5840 if ( v34 < v35 + v1->pBounding.x2 ) | |
5841 { | |
5842 v36 = v32->vPosition.y; | |
5843 if ( v36 > v1->pBounding.y1 - v35 ) | |
5844 { | |
5845 if ( v36 < v35 + v1->pBounding.y2 ) | |
5846 { | |
5847 v37 = v32->vPosition.z; | |
5848 if ( v37 > v1->pBounding.z1 - v35 ) | |
5849 { | |
5850 if ( v37 < v35 + v1->pBounding.z2 ) | |
5851 { | |
5852 v38 = (v1->pFacePlane_old.dist | |
5853 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5854 + v37 * v1->pFacePlane_old.vNormal.z | |
5855 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5856 if ( v38 >= 0 ) | |
5857 { | |
5858 if ( v38 <= v35 && v35 ) | |
5859 { | |
5860 v39 = v74; | |
5861 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5862 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5863 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5864 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5865 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5866 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5867 v68 = (BLVFaceExtra *)v32->uRed; | |
5868 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5869 v68 = (BLVFaceExtra *)v32->uGreen; | |
5870 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5871 v68 = (BLVFaceExtra *)v32->uBlue; | |
5872 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5873 v16 = 0.0039215689; | |
5874 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5875 v40 = v74++; | |
5876 stru_F8AD28._blv_lights_types[v40] = 1; | |
5877 } | |
5878 } | |
5879 } | |
5880 } | |
5881 } | |
5882 } | |
5883 } | |
5884 } | |
5885 } | |
5886 v30 = v73++ + 1; | |
5887 if ( v73 >= v70 ) | |
5888 break; | |
5889 v17 = v69; | |
5890 } | |
5891 } | |
5892 v73 = 0; | |
5893 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5894 { | |
5895 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5896 do | |
5897 { | |
5898 if ( v74 >= 20 ) | |
5899 break; | |
5900 v42 = *((short *)v41 + 2); | |
5901 v43 = *((short *)v41 - 1); | |
5902 if ( v43 > v1->pBounding.x1 - v42 ) | |
5903 { | |
5904 if ( v43 < v42 + v1->pBounding.x2 ) | |
5905 { | |
5906 v44 = *(short *)v41; | |
5907 if ( v44 > v1->pBounding.y1 - v42 ) | |
5908 { | |
5909 if ( v44 < v42 + v1->pBounding.y2 ) | |
5910 { | |
5911 v45 = *((short *)v41 + 1); | |
5912 if ( v45 > v1->pBounding.z1 - v42 ) | |
5913 { | |
5914 if ( v45 < v42 + v1->pBounding.z2 ) | |
5915 { | |
5916 v46 = (v1->pFacePlane_old.dist | |
5917 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5918 + v43 * v1->pFacePlane_old.vNormal.x | |
5919 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5920 v69 = v46; | |
5921 if ( v46 >= 0 ) | |
5922 { | |
5923 if ( v46 <= v42 ) | |
5924 { | |
5925 v47 = v69; | |
5926 v48 = v74; | |
5927 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5928 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5929 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5930 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5931 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5932 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5933 v49 = (double)(signed int)v68 * v16; | |
5934 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5935 v50 = (unsigned __int8)v41[8]; | |
5936 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5937 v51 = (double)(signed int)v68; | |
5938 v68 = (BLVFaceExtra *)v50; | |
5939 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5940 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5941 v16 = 0.0039215689; | |
5942 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5943 v52 = v74++; | |
5944 stru_F8AD28._blv_lights_types[v52] = 1; | |
5945 } | |
5946 } | |
5947 } | |
5948 } | |
5949 } | |
5950 } | |
5951 } | |
5952 } | |
5953 ++v73; | |
5954 v41 += 12; | |
5955 } | |
5956 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5957 } | |
5958 stru_F8AD28.uNumLightsApplied = v74; | |
5959 v53 = v1->pBounding.x2; | |
5960 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5961 { | |
5962 v55 = v1->pBounding.x1; | |
5963 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5964 v54 = 0; | |
5965 else | |
5966 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5967 } | |
5968 else | |
5969 { | |
5970 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5971 } | |
5972 v56 = v1->pBounding.y2; | |
5973 v57 = v54 * v54; | |
5974 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5975 { | |
5976 v59 = v1->pBounding.y1; | |
5977 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5978 v58 = 0; | |
5979 else | |
5980 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5981 } | |
5982 else | |
5983 { | |
5984 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5985 } | |
5986 v60 = v58 * v58 + v57; | |
5987 v61 = v1->pBounding.z2; | |
5988 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5989 { | |
5990 v63 = v1->pBounding.z1; | |
5991 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5992 v62 = 0; | |
5993 else | |
5994 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5995 } | |
5996 else | |
5997 { | |
5998 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5999 } | |
6000 v64 = v62 * v62 + v60; | |
6001 if ( v64 ) | |
295 | 6002 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 6003 else |
6004 stru_F8AD28.field_34 = 0; | |
6005 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
6006 v65 = (double)(signed int)v68; | |
6007 if ( v65 >= 655.36 ) | |
6008 { | |
6009 if ( v65 >= 26214.4 ) | |
6010 { | |
6011 if ( v65 >= 45875.2 ) | |
6012 { | |
6013 stru_F8AD28.field_44 = 8; | |
6014 stru_F8AD28.field_48 = 3; | |
6015 } | |
6016 else | |
6017 { | |
6018 stru_F8AD28.field_44 = 16; | |
6019 stru_F8AD28.field_48 = 4; | |
6020 } | |
6021 } | |
6022 else | |
6023 { | |
6024 stru_F8AD28.field_44 = 32; | |
6025 stru_F8AD28.field_48 = 5; | |
6026 } | |
6027 } | |
6028 else | |
6029 { | |
6030 stru_F8AD28.field_44 = 64; | |
6031 stru_F8AD28.field_48 = 6; | |
6032 } | |
6033 } | |
6034 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
6035 | |
6036 //----- (004AF412) -------------------------------------------------------- | |
6037 int __cdecl sub_4AF412() | |
6038 { | |
6039 int v0; // ST20_4@2 | |
6040 int v1; // ST20_4@2 | |
6041 int v2; // ST20_4@2 | |
6042 int v3; // esi@2 | |
6043 int v4; // ST20_4@2 | |
6044 int v5; // ecx@2 | |
6045 int v6; // ebx@2 | |
6046 int v7; // edi@2 | |
6047 int v8; // edx@2 | |
6048 int v9; // eax@2 | |
6049 int result; // eax@4 | |
6050 | |
6051 stru_F8AD28.plane_4.vNormal.z = -65536; | |
6052 stru_F8AD28.vec_20.y = -65536; | |
6053 stru_F8AD28.plane_4.vNormal.x = 0; | |
6054 stru_F8AD28.plane_4.vNormal.y = 0; | |
6055 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
6056 stru_F8AD28.vec_14.x = 65536; | |
6057 stru_F8AD28.vec_14.y = 0; | |
6058 stru_F8AD28.vec_14.z = 0; | |
6059 stru_F8AD28.vec_20.x = 0; | |
6060 stru_F8AD28.vec_20.z = 0; | |
6061 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
6062 if ( pBLVRenderParams->sPartyRotX ) | |
6063 { | |
6064 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6065 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6066 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6067 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6068 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6069 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6070 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6071 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6072 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6073 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6074 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6075 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6076 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6077 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6078 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6079 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6080 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6081 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6082 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6083 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6084 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6085 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6086 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6087 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6088 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6089 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6090 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6091 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6092 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6093 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6094 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6095 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6096 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6097 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6098 v6 = pBLVRenderParams->vPartyPos.z; | |
6099 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6100 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6101 v8 = pBLVRenderParams->vPartyPos.y; | |
6102 v9 = pBLVRenderParams->vPartyPos.x; | |
6103 } | |
6104 else | |
6105 { | |
6106 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6107 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6108 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6109 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6110 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6111 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6112 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6113 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6114 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6115 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6116 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6117 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6118 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6119 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6120 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6121 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6122 v8 = pBLVRenderParams->vPartyPos.y; | |
6123 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6124 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6125 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6126 v9 = pBLVRenderParams->vPartyPos.x; | |
6127 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6128 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6129 v6 = pBLVRenderParams->vPartyPos.z; | |
6130 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6131 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6132 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6133 } | |
6134 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6135 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6136 + stru_F8AD28.plane_4.dist | |
6137 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6138 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6139 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6140 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6141 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6142 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6143 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6144 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6145 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6146 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6147 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6148 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6149 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6150 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6151 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6152 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6153 result = 0; | |
6154 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6155 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6156 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6157 stru_F8AD28.field_38 = 0; | |
6158 stru_F8AD28.field_3E4 = 0; | |
6159 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6160 stru_F8AD28.uNumLightsApplied = 0; | |
6161 stru_F8AD28.field_34 = 0; | |
6162 return result; | |
6163 } | |
6164 | |
6165 | |
6166 | |
6167 | |
6168 | |
6169 | |
6170 //----- (004B1447) -------------------------------------------------------- | |
6171 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6172 { | |
6173 signed int v3; // esi@1 | |
6174 char v4; // sf@8 | |
6175 int v5; // eax@8 | |
6176 unsigned __int64 v6; // qax@12 | |
6177 DDM_DLV_Header *v7; // eax@14 | |
6178 Player **v8; // edi@18 | |
6179 Player *result; // eax@19 | |
735 | 6180 //char *v10; // esi@20 |
0 | 6181 |
6182 v3 = 0; | |
6183 if ( a2 ) | |
6184 { | |
6185 if ( a2 != 1 ) | |
6186 { | |
6187 if ( a2 == 2 ) | |
6188 v3 = 2; | |
6189 goto LABEL_13; | |
6190 } | |
6191 v3 = 2; | |
6192 } | |
6193 else | |
6194 { | |
6195 v3 = 1; | |
6196 } | |
6197 if ( pParty->uFine < 4000000 ) | |
6198 { | |
6199 v4 = a3 + pParty->uFine < 0; | |
6200 v5 = a3 + pParty->uFine; | |
6201 pParty->uFine += a3; | |
6202 if ( v4 ) | |
6203 { | |
6204 v5 = 0; | |
6205 pParty->uFine = 0; | |
6206 } | |
6207 if ( v5 > 4000000 ) | |
6208 pParty->uFine = 4000000; | |
6209 } | |
487 | 6210 |
6211 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6212 | |
0 | 6213 LABEL_13: |
463 | 6214 pParty->InTheShopFlags[a1] = 1; |
0 | 6215 if ( v3 ) |
6216 { | |
6217 v7 = &pOutdoor->ddm; | |
6218 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6219 v7 = &pIndoor->dlv; | |
6220 v7->uReputation += v3; | |
6221 if ( v7->uReputation > 10000 ) | |
6222 v7->uReputation = 10000; | |
6223 } | |
6224 v8 = &pPlayers[1]; | |
6225 do | |
6226 { | |
6227 result = *v8; | |
6228 if ( pParty->uFine ) | |
6229 { | |
735 | 6230 //v10 = result->_guilds_member_bits; |
484 | 6231 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6232 if ( !(short)result ) |
735 | 6233 __debugbreak(); |
501 | 6234 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6235 } |
6236 ++v8; | |
6237 } | |
6238 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6239 return result; | |
6240 } | |
6241 | |
6242 //----- (004B1523) -------------------------------------------------------- | |
762 | 6243 void __thiscall sub_4B1523(int *_this) |
0 | 6244 { |
6245 int v1; // esi@1 | |
6246 int v2; // edx@1 | |
6247 unsigned int v3; // eax@2 | |
6248 int v4; // eax@4 | |
6249 LONG v5; // ecx@4 | |
6250 int v6; // eax@10 | |
6251 char *v7; // ST44_4@12 | |
6252 unsigned __int16 v8; // ax@12 | |
6253 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6254 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6255 POINT a2; // [sp+64h] [bp-10h]@1 | |
6256 int v13; // [sp+6Ch] [bp-8h]@4 | |
6257 int v14; // [sp+70h] [bp-4h]@4 | |
6258 | |
6259 v1 = *_this - 399; | |
6260 v2 = (*_this - 400) % 11 + 1; | |
6261 v11 = 4 * (*_this - 400) / 11; | |
6262 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6263 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6264 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6265 else | |
6266 v3 = 30; | |
6267 a1.Hint = 0; | |
6268 a1.uFrameY = v3; | |
6269 a1.uFrameWidth = 328; | |
6270 a1.uFrameHeight = 68; | |
6271 a1.uFrameX = 90; | |
6272 a1.uFrameZ = 417; | |
6273 a1.uFrameW = v3 + 67; | |
6274 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6275 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6276 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6277 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6278 v5 = a2.y; | |
6279 if ( v14 > a2.y ) | |
6280 v5 = v14; | |
6281 if ( v13 > v5 ) | |
6282 v5 = v13; | |
6283 if ( v4 > v5 ) | |
6284 v5 = v4; | |
262 | 6285 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", |
6286 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6287 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6288 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6289 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6290 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6291 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6292 a1.uFrameHeight += v6; | |
6293 if ( (signed int)a1.uFrameHeight < 150 ) | |
6294 a1.uFrameHeight = 150; | |
6295 a1.uFrameWidth = 460; | |
6296 a1.DrawMessageBox(0); | |
6297 a1.uFrameWidth -= 12; | |
6298 a1.uFrameHeight -= 12; | |
6299 v7 = pSpellStats->pInfos[v1].pName; | |
6300 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6301 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6302 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6303 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6304 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6305 a1.uFrameZ = a1.uFrameX + 107; | |
6306 a1.uFrameWidth = 108; | |
6307 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6308 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6309 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6310 } |
6311 | |
6312 | |
6313 //----- (004B1784) -------------------------------------------------------- | |
6314 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6315 { | |
6316 Player *pPlayer; // ebx@1 | |
6317 bool result; // eax@2 | |
6318 unsigned __int16 v2; // ST0C_2@3 | |
6319 int v3; // eax@3 | |
6320 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6321 | |
6322 pPlayer = pPlayers[uActiveCharacter]; | |
6323 if ( pPlayer->CanAct() ) | |
6324 { | |
6325 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6326 result = 1; | |
6327 } | |
6328 else | |
6329 { | |
6330 pDialogueWindow->pNumPresenceButton = 0; | |
6331 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6332 v4.uFrameX = 483; | |
6333 v4.uFrameWidth = 148; | |
6334 v4.uFrameZ = 334; | |
6335 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6336 // "%s is in no condition to %s" | |
6337 // "do anything" | |
758 | 6338 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6339 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6340 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6341 result = 0; | |
6342 } | |
6343 return result; | |
6344 } | |
6345 // F8B1E0: using guessed type int dword_F8B1E0; | |
6346 | |
6347 | |
463 | 6348 //view item details in shop? |
0 | 6349 //----- (004B1A2D) -------------------------------------------------------- |
6350 void __cdecl sub_4B1A2D() | |
6351 { | |
358 | 6352 //Player *v0; // edi@1 |
0 | 6353 POINT *v1; // esi@5 |
6354 unsigned int v2; // eax@5 | |
6355 int v3; // ecx@5 | |
6356 POINT *v4; // esi@12 | |
6357 int v5; // eax@12 | |
6358 unsigned int v6; // eax@13 | |
6359 ItemGen *v7; // ecx@13 | |
6360 signed int v8; // esi@17 | |
6361 unsigned int v9; // eax@19 | |
475 | 6362 POINT v10; // [sp+8h] [bp-44h]@12 |
6363 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6364 POINT v12; // [sp+18h] [bp-34h]@18 | |
6365 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6366 POINT v14; // [sp+28h] [bp-24h]@17 | |
6367 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6368 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6369 POINT a2; // [sp+40h] [bp-Ch]@5 |
6370 int v18; // [sp+48h] [bp-4h]@5 | |
6371 | |
358 | 6372 //v0 = pPlayers[uActiveCharacter]; |
484 | 6373 if ( in_current_building_type <= 0 ) |
0 | 6374 return; |
484 | 6375 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6376 { |
749 | 6377 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6378 { | |
6379 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6380 return; |
749 | 6381 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6382 { |
475 | 6383 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6384 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
6385 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
6386 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 6387 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 6388 return; |
358 | 6389 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 6390 LABEL_15: |
6391 GameUI_DrawItemInfo(v7); | |
6392 return; | |
6393 } | |
749 | 6394 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6395 return; |
6396 } | |
475 | 6397 v4 = pMouse->GetCursorPos(&v11); |
6398 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6399 v18 = v5; |
6400 if ( !v5 ) | |
6401 return; | |
336 | 6402 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6403 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6404 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
439 | 6405 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 6406 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 6407 goto LABEL_15; |
6408 } | |
749 | 6409 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS ) |
0 | 6410 { |
6411 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6412 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6413 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6414 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
6415 if ( v18 ) | |
336 | 6416 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6417 } |
6418 } | |
6419 // F8B198: using guessed type int dword_F8B198; | |
6420 // F8B19C: using guessed type int dword_F8B19C; | |
6421 | |
6422 //----- (004B1BDB) -------------------------------------------------------- | |
6423 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6424 { | |
6425 signed __int64 v1; // ST2C_8@1 | |
6426 signed __int64 v2; // qax@1 | |
6427 signed __int64 v3; // ST1C_8@1 | |
6428 unsigned __int64 v4; // qax@1 | |
6429 unsigned int v5; // ebx@1 | |
112 | 6430 Player *v6; // ebx@1 |
0 | 6431 |
6432 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6433 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6434 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6435 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6436 v2 = v1 / 60 / 60; | |
6437 v3 = v2; | |
6438 v4 = (unsigned int)v2 / 0x18; | |
6439 v5 = (unsigned int)(v4 / 7) >> 2; | |
6440 pParty->uCurrentTimeSecond = v1 % 60; | |
6441 pParty->uCurrentMinute = v1 / 60 % 60; | |
6442 pParty->uCurrentHour = v3 % 24; | |
6443 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6444 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6445 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6446 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6447 pParty->RestAndHeal(); |
6448 dword_507B94 = 1; | |
112 | 6449 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6450 do |
6451 { | |
112 | 6452 v6->uTimeToRecovery = 0; |
6453 memset(&v6->uTimeToRecovery, 0, 4u); | |
6454 ++v6; | |
6455 } | |
6456 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6457 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6458 } |
6459 // 507B94: using guessed type int dword_507B94; | |
6460 | |
6461 //----- (004B1D27) -------------------------------------------------------- | |
6462 void __cdecl sub_4B1D27() | |
6463 { | |
6464 int v0; // edx@2 | |
6465 unsigned int v1; // ecx@7 | |
6466 signed int v2; // edi@10 | |
6467 int v3; // esi@10 | |
6468 __int16 v4; // ax@15 | |
6469 signed int v5; // edi@20 | |
6470 int v6; // esi@20 | |
6471 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6472 | |
484 | 6473 if ( in_current_building_type > 0 ) |
0 | 6474 { |
6475 v0 = 3; | |
484 | 6476 if ( in_current_building_type > BildingType_MagicShop ) |
6477 { | |
6478 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6479 { |
6480 if ( !dword_F8B1E4 ) | |
6481 return; | |
6482 } | |
6483 else | |
6484 { | |
484 | 6485 if ( in_current_building_type != BildingType_Temple ) |
0 | 6486 return; |
6487 } | |
336 | 6488 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 6489 LABEL_28: |
735 | 6490 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6491 return; |
6492 } | |
336 | 6493 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6494 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6495 { |
6496 if ( pParty->uNumGold <= 0x2710 ) | |
6497 { | |
6498 if ( !dword_F8B1E4 ) | |
6499 return; | |
6500 v0 = 4; | |
6501 goto LABEL_28; | |
6502 } | |
735 | 6503 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6504 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6505 { | |
6506 v5 = 0; | |
6507 v6 = 1; | |
6508 do | |
6509 { | |
6510 if ( pPlayers[v6]->CanAct() ) | |
6511 v7[v5++] = v6; | |
6512 ++v6; | |
6513 } | |
6514 while ( v6 <= 4 ); | |
6515 if ( v5 ) | |
6516 { | |
6517 qword_A750D8 = 256i64; | |
6518 word_A750E0 = 80; | |
6519 v4 = LOWORD(v7[rand() % v5]); | |
6520 goto LABEL_16; | |
6521 } | |
6522 } | |
6523 } | |
6524 else | |
6525 { | |
6526 if ( !qword_A750D8 ) | |
6527 { | |
6528 v2 = 0; | |
6529 v3 = 1; | |
6530 do | |
6531 { | |
6532 if ( pPlayers[v3]->CanAct() ) | |
6533 v7[v2++] = v3; | |
6534 ++v3; | |
6535 } | |
6536 while ( v3 <= 4 ); | |
6537 if ( v2 ) | |
6538 { | |
6539 qword_A750D8 = 256i64; | |
6540 word_A750E0 = 80; | |
6541 v4 = LOWORD(v7[rand() % v2]); | |
6542 LABEL_16: | |
6543 word_A750E2 = v4; | |
6544 return; | |
6545 } | |
6546 } | |
6547 } | |
6548 } | |
6549 } | |
6550 | |
629 | 6551 |
0 | 6552 |
6553 //----- (004B1ECE) -------------------------------------------------------- | |
6554 void __cdecl sub_4B1ECE() | |
6555 { | |
6556 __int16 *v0; // edi@1 | |
6557 int v1; // ebx@3 | |
6558 Player *v2; // esi@3 | |
6559 int v3; // eax@4 | |
6560 signed int v4; // eax@9 | |
6561 int v5; // ebx@11 | |
89 | 6562 Player *v6; // esi@13 |
6563 ItemGen *v7; // eax@14 | |
0 | 6564 signed int v8; // edi@14 |
89 | 6565 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6566 signed int v10; // [sp+10h] [bp-8h]@13 |
6567 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6568 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6569 |
484 | 6570 contract_approved = 0; |
0 | 6571 v11 = 0; |
6572 uDialogueType = 84; | |
6573 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
6574 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; | |
6575 while ( 1 ) | |
6576 { | |
484 | 6577 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6578 { |
6579 v1 = 0; | |
6580 v2 = pParty->pPlayers; | |
6581 do | |
6582 { | |
89 | 6583 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6584 if ( v3 ) |
6585 break; | |
6586 ++v2; | |
6587 ++v1; | |
6588 } | |
6589 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6590 if ( v1 == 4 ) | |
6591 break; | |
6592 } | |
6593 ++v11; | |
6594 v0 += 2; | |
89 | 6595 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6596 break; | |
6597 } | |
6598 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6599 { | |
651 | 6600 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6601 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6602 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6603 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6604 } | |
484 | 6605 if ( contract_approved == 601 ) |
0 | 6606 { |
6607 v5 = 0; | |
89 | 6608 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6609 v9 = 0; |
6610 while ( 1 ) | |
6611 { | |
135 | 6612 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6613 { |
6614 v10 = 0; | |
89 | 6615 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6616 do |
6617 { | |
89 | 6618 v7 = v6->pInventoryItems; |
0 | 6619 v8 = 138; |
6620 do | |
6621 { | |
89 | 6622 if ( v7->uItemID == 601 ) |
0 | 6623 { |
377 | 6624 if ( !v7->uHolderPlayer ) |
89 | 6625 v9 = v7; |
377 | 6626 if ( v7->uHolderPlayer == v5 ) |
0 | 6627 v10 = 1; |
6628 } | |
89 | 6629 ++v7; |
0 | 6630 --v8; |
6631 } | |
6632 while ( v8 ); | |
89 | 6633 ++v6; |
6634 } | |
6635 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6636 if ( !v10 ) |
6637 break; | |
6638 } | |
89 | 6639 ++v12; |
0 | 6640 ++v5; |
89 | 6641 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6642 return; |
6643 } | |
6644 if ( v9 ) | |
377 | 6645 v9->uHolderPlayer = v5; |
0 | 6646 } |
6647 } | |
503 | 6648 |
0 | 6649 // 4F08EC: using guessed type int dword_4F08EC[]; |
6650 // 722B3C: using guessed type int dword_722B3C; | |
6651 // 722B44: using guessed type int dword_722B44; | |
6652 // F8B1A8: using guessed type int dword_F8B1A8; | |
6653 | |
6654 //----- (004B2001) -------------------------------------------------------- | |
459 | 6655 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6656 { | |
6657 //signed int v1; // eax@1 | |
6658 NPCData *pCurrentNPCInfo; // ebp@1 | |
6659 int pEventNumber; // ecx@8 | |
0 | 6660 Player *v4; // esi@20 |
467 | 6661 //int v5; // eax@28 |
6662 //int v6; // eax@31 | |
6663 //int v7; // eax@34 | |
6664 //int v8; // eax@37 | |
6665 //int v9; // eax@40 | |
6666 //unsigned int v10; // eax@43 | |
0 | 6667 char *v12; // eax@53 |
6668 char *v13; // eax@56 | |
6669 char *v14; // eax@57 | |
6670 char *v15; // eax@58 | |
467 | 6671 //unsigned int v16; // ebp@62 |
0 | 6672 char *v17; // ecx@63 |
6673 char *v18; // eax@65 | |
6674 const char *v19; // ecx@68 | |
248 | 6675 //unsigned int v20; // eax@69 |
467 | 6676 signed int pPrice; // ecx@70 |
0 | 6677 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6678 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6679 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6680 //int v25; // [sp-4h] [bp-10h]@49 |
6681 | |
459 | 6682 uDialogueType = uMessageParam + 1; |
6683 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6684 if ( uMessageParam <= 24 ) |
460 | 6685 { |
459 | 6686 switch ( uMessageParam ) |
6687 { | |
6688 case 13: | |
6689 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
6690 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6691 NPCHireableDialogPrepare(); |
459 | 6692 dialogue_show_profession_details = false; |
6693 goto _return; | |
6694 case 19: | |
6695 pEventNumber = pCurrentNPCInfo->evt_A; | |
6696 break; | |
6697 case 20: | |
6698 pEventNumber = pCurrentNPCInfo->evt_B; | |
6699 break; | |
6700 case 21: | |
6701 pEventNumber = pCurrentNPCInfo->evt_C; | |
6702 break; | |
6703 case 22: | |
6704 pEventNumber = pCurrentNPCInfo->evt_D; | |
6705 break; | |
6706 case 23: | |
6707 pEventNumber = pCurrentNPCInfo->evt_E; | |
6708 break; | |
6709 case 24: | |
6710 pEventNumber = pCurrentNPCInfo->evt_F; | |
6711 break; | |
6712 default: | |
467 | 6713 goto _return; |
6714 } | |
6715 /*switch ( pEventNumber ) | |
6716 { | |
6717 case 139: | |
6718 sub_4B1ECE(); | |
6719 goto _return; | |
6720 case 311: | |
6721 sub_4BBA85_bounties(); | |
6722 goto _return; | |
6723 }*/ | |
459 | 6724 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6725 { | |
6726 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6727 { | |
6728 if ( pEventNumber == 139 ) | |
0 | 6729 { |
6730 sub_4B1ECE(); | |
6731 } | |
6732 else | |
6733 { | |
459 | 6734 if ( pEventNumber == 311 ) |
0 | 6735 { |
6736 sub_4BBA85_bounties(); | |
6737 } | |
6738 else | |
6739 { | |
6740 ptr_F8B1E8 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6741 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6742 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6743 activeLevelDecoration = NULL; |
0 | 6744 } |
6745 } | |
6746 } | |
6747 else | |
6748 { | |
459 | 6749 dword_F8B1D8 = uMessageParam; |
6750 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6751 } |
6752 } | |
6753 else | |
6754 { | |
459 | 6755 sub_4B3FE5(pEventNumber); |
0 | 6756 } |
6757 goto _return; | |
460 | 6758 } |
459 | 6759 if ( uMessageParam != 76 ) |
6760 { | |
6761 if ( uMessageParam == 77 ) | |
6762 { | |
467 | 6763 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6764 if (dialogue_show_profession_details) |
459 | 6765 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6766 else |
459 | 6767 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
0 | 6768 ptr_F8B1E8 = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6769 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6770 dialogue_show_profession_details = ~dialogue_show_profession_details; |
0 | 6771 ptr_F8B1E8 = v18; |
6772 } | |
6773 else | |
6774 { | |
459 | 6775 if ( uMessageParam == 79 ) |
0 | 6776 { |
484 | 6777 if ( contract_approved ) |
0 | 6778 { |
267 | 6779 Party::TakeGold(gold_transaction_amount); |
0 | 6780 if ( uActiveCharacter ) |
6781 { | |
492 | 6782 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6783 *(short *)v12 &= 0x3Fu; |
6784 switch ( dword_F8B1B0 ) | |
6785 { | |
6786 case 2: | |
492 | 6787 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6788 *v15 |= 0x40u; |
6789 break; | |
6790 case 3: | |
492 | 6791 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6792 *v14 |= 0x80u; |
6793 break; | |
6794 case 4: | |
492 | 6795 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6796 v13[1] |= 1u; |
6797 break; | |
6798 } | |
187 | 6799 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6800 } |
437 | 6801 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6802 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6803 { |
6804 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6805 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6806 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6807 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6808 }*/ |
0 | 6809 } |
6810 } | |
6811 else | |
6812 { | |
492 | 6813 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6814 { |
267 | 6815 Party::TakeGold(gold_transaction_amount); |
0 | 6816 v4 = pParty->pPlayers; |
6817 do | |
6818 { | |
492 | 6819 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6820 ++v4; |
6821 } | |
6822 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6823 switch ( dword_F8B1D8 ) | |
6824 { | |
6825 case 19: | |
467 | 6826 pEventNumber = pCurrentNPCInfo->evt_A; |
6827 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6828 pCurrentNPCInfo->evt_A = 0; |
0 | 6829 break; |
6830 case 20: | |
467 | 6831 pEventNumber = pCurrentNPCInfo->evt_B; |
6832 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6833 pCurrentNPCInfo->evt_B = 0; |
0 | 6834 break; |
6835 case 21: | |
467 | 6836 pEventNumber = pCurrentNPCInfo->evt_C; |
6837 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6838 pCurrentNPCInfo->evt_C = 0; |
0 | 6839 break; |
6840 case 22: | |
467 | 6841 pEventNumber = pCurrentNPCInfo->evt_D; |
6842 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6843 pCurrentNPCInfo->evt_D = 0; |
0 | 6844 break; |
6845 case 23: | |
467 | 6846 pEventNumber = pCurrentNPCInfo->evt_E; |
6847 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6848 pCurrentNPCInfo->evt_E = 0; |
0 | 6849 break; |
6850 case 24: | |
467 | 6851 pEventNumber = pCurrentNPCInfo->evt_F; |
6852 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6853 pCurrentNPCInfo->evt_F = 0; | |
0 | 6854 break; |
6855 } | |
437 | 6856 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6857 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6858 { |
6859 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6860 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6861 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6862 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6863 }*/ |
467 | 6864 //v11 = uActiveCharacter; |
0 | 6865 if ( uActiveCharacter ) |
6866 { | |
467 | 6867 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6868 goto _return; |
6869 } | |
6870 } | |
6871 } | |
6872 } | |
6873 goto _return; | |
6874 } | |
6875 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6876 { | |
467 | 6877 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6878 goto _return; |
6879 } | |
459 | 6880 if ( pCurrentNPCInfo->uProfession != 51 ) |
6881 { | |
467 | 6882 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6883 if ( pParty->uNumGold < pPrice ) | |
6884 { | |
6885 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6886 dialogue_show_profession_details = false; |
0 | 6887 uDialogueType = 13; |
459 | 6888 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6889 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); |
0 | 6890 if ( uActiveCharacter ) |
248 | 6891 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6892 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6893 goto _return; | |
6894 } | |
6895 Party::TakeGold(pPrice); | |
0 | 6896 } |
147 | 6897 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6898 pCurrentNPCInfo->uFlags |= 128; |
0 | 6899 pParty->field_709 = 0; |
659 | 6900 Party__CountHirelings(); |
0 | 6901 if ( pParty->pHirelings[0].pName ) |
6902 { | |
459 | 6903 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6904 v24 = pCurrentNPCInfo->pName; | |
0 | 6905 v22 = pParty->pHireling2Name; |
6906 } | |
6907 else | |
6908 { | |
459 | 6909 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6910 v24 = pCurrentNPCInfo->pName; | |
0 | 6911 v22 = pParty->pHireling1Name; |
6912 } | |
6913 strcpy(v22, v24); | |
6914 pParty->field_709 = 0; | |
659 | 6915 Party__CountHirelings(); |
480 | 6916 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6917 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6918 |
6919 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6920 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6921 { |
6922 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6923 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6924 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6925 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6926 }*/ |
0 | 6927 if ( uActiveCharacter ) |
467 | 6928 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6929 _return: |
460 | 6930 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6931 } |
6932 | |
6933 | |
6934 //----- (004B254D) -------------------------------------------------------- | |
6935 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6936 { | |
6937 Player *v1; // esi@1 | |
6938 int v2; // edx@1 | |
6939 int v3; // ecx@1 | |
6940 int v4; // edi@1 | |
6941 int v5; // eax@7 | |
6942 int v6; // eax@7 | |
6943 int v7; // ebx@7 | |
6944 int v8; // ebx@8 | |
6945 signed int v9; // esi@8 | |
6946 int v10; // eax@8 | |
6947 char *v11; // ecx@8 | |
6948 int v12; // edi@9 | |
6949 char *v13; // edx@9 | |
6950 signed int v14; // edi@10 | |
6951 unsigned int v16; // eax@29 | |
6952 int v17; // eax@36 | |
6953 char v18; // cl@46 | |
6954 __int16 v19; // dx@56 | |
6955 int v20; // eax@60 | |
6956 char *v21; // [sp-Ch] [bp-38h]@82 | |
6957 const char *v22; // [sp-8h] [bp-34h]@21 | |
6958 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6959 char *v24; // [sp-8h] [bp-34h]@82 | |
6960 char *v25; // [sp-4h] [bp-30h]@14 | |
6961 int v26; // [sp-4h] [bp-30h]@38 | |
6962 int v27; // [sp-4h] [bp-30h]@82 | |
6963 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6964 int v29; // [sp+10h] [bp-1Ch]@13 | |
6965 int v30; // [sp+14h] [bp-18h]@15 | |
6966 int v31; // [sp+18h] [bp-14h]@16 | |
6967 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6968 int v33; // [sp+20h] [bp-Ch]@7 | |
6969 int v34; // [sp+24h] [bp-8h]@7 | |
6970 char *v35; // [sp+28h] [bp-4h]@1 | |
6971 | |
6972 v1 = pPlayers[uActiveCharacter]; | |
484 | 6973 contract_approved = 0; |
0 | 6974 v2 = (_this - 200) % 3; |
6975 v3 = (_this - 200) / 3; | |
6976 v4 = v2; | |
6977 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6978 dword_F8B1AC_award_bit_number = v3; |
0 | 6979 if ( v2 ) |
6980 { | |
6981 if ( v2 == 1 ) | |
6982 { | |
267 | 6983 gold_transaction_amount = 5000; |
0 | 6984 dword_F8B1B0 = 3; |
6985 } | |
6986 else | |
6987 { | |
6988 if ( v2 == 2 ) | |
6989 { | |
267 | 6990 gold_transaction_amount = 8000; |
0 | 6991 dword_F8B1B0 = 4; |
6992 } | |
6993 } | |
6994 } | |
6995 else | |
6996 { | |
267 | 6997 gold_transaction_amount = 2000; |
0 | 6998 dword_F8B1B0 = 2; |
6999 } | |
135 | 7000 v5 = v1->classType; |
0 | 7001 v33 = v5; |
7002 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
7003 *(int *)a1 = v1->pActiveSkills[v3]; | |
7004 v7 = a1[0] & 0x3F; | |
7005 v34 = v2 + 2; | |
7006 if ( v6 < v2 + 2 ) | |
7007 { | |
7008 v8 = v33; | |
7009 v9 = 0; | |
7010 v10 = v33 - v33 % 4; | |
7011 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
7012 do | |
7013 { | |
7014 v12 = (unsigned __int8)*v11; | |
7015 v13 = &v28[4 * v9]; | |
7016 *(int *)v13 = 0; | |
7017 if ( v12 < v34 ) | |
7018 { | |
7019 v14 = 1; | |
7020 } | |
7021 else | |
7022 { | |
7023 v14 = 1; | |
7024 *(int *)v13 = 1; | |
7025 } | |
7026 ++v9; | |
7027 v11 += 37; | |
7028 } | |
7029 while ( v9 < 4 ); | |
7030 if ( v29 == v14 ) | |
7031 { | |
7032 v25 = pClassNames[v10 + 1]; | |
7033 } | |
7034 else | |
7035 { | |
7036 if ( v30 == v14 ) | |
7037 { | |
7038 if ( v31 == v14 ) | |
7039 { | |
7040 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
7041 return pTmpBuf; | |
7042 } | |
7043 v25 = pClassNames[v10 + 2]; | |
7044 } | |
7045 else | |
7046 { | |
7047 if ( v31 != v14 ) | |
7048 { | |
7049 v25 = pClassNames[v8]; | |
7050 v22 = pGlobalTXT_LocalizationStrings[632]; | |
7051 goto LABEL_23; | |
7052 } | |
7053 v25 = pClassNames[v10 + 3]; | |
7054 } | |
7055 } | |
7056 v22 = pGlobalTXT_LocalizationStrings[633]; | |
7057 LABEL_23: | |
7058 sprintf(pTmpBuf, v22, v25); | |
7059 return pTmpBuf; | |
7060 } | |
7061 if ( !v1->CanAct() ) | |
7062 return (char *)pNPCTopics[122].pText; | |
7063 if ( !v7 ) | |
7064 return (char *)pNPCTopics[131].pText; | |
7065 v16 = SkillToMastery(a1[0]); | |
7066 if ( (signed int)v16 > v4 + 1 ) | |
7067 return (char *)pNPCTopics[v4 + 128].pText; | |
7068 if ( v34 != 2 ) | |
7069 { | |
7070 if ( v34 == 3 ) | |
7071 { | |
7072 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
7073 { | |
492 | 7074 v17 = dword_F8B1AC_award_bit_number; |
7075 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7076 { |
7077 default: | |
7078 goto LABEL_41; | |
7079 case 12: | |
7080 case 13: | |
7081 case 14: | |
7082 case 15: | |
7083 case 16: | |
7084 case 17: | |
7085 case 18: | |
267 | 7086 gold_transaction_amount = 4000; |
0 | 7087 goto LABEL_42; |
7088 case 19: | |
7089 v19 = 114; | |
7090 goto LABEL_57; | |
7091 case 20: | |
7092 v19 = 110; | |
7093 LABEL_57: | |
484 | 7094 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7095 return v35; |
7096 goto LABEL_40; | |
7097 case 22: | |
7098 v20 = v1->GetBaseWillpower(); | |
7099 goto LABEL_61; | |
7100 case 24: | |
267 | 7101 gold_transaction_amount = 2500; |
0 | 7102 v20 = v1->GetBaseEndurance(); |
7103 goto LABEL_61; | |
7104 case 36: | |
7105 v20 = v1->GetBaseIntelligence(); | |
7106 LABEL_61: | |
7107 if ( v20 < 50 ) | |
7108 return v35; | |
7109 goto LABEL_40; | |
7110 case 21: | |
7111 case 23: | |
7112 case 25: | |
7113 case 26: | |
7114 case 29: | |
7115 case 32: | |
7116 case 34: | |
7117 case 35: | |
267 | 7118 gold_transaction_amount = 2500; |
0 | 7119 goto LABEL_42; |
7120 case 8: | |
7121 case 9: | |
7122 case 10: | |
7123 case 11: | |
267 | 7124 gold_transaction_amount = 3000; |
0 | 7125 goto LABEL_42; |
7126 case 7: | |
7127 goto LABEL_67; | |
7128 } | |
7129 goto LABEL_67; | |
7130 } | |
7131 } | |
7132 else | |
7133 { | |
7134 if ( v34 != 4 ) | |
7135 { | |
7136 LABEL_40: | |
492 | 7137 v17 = dword_F8B1AC_award_bit_number; |
0 | 7138 goto LABEL_41; |
7139 } | |
7140 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7141 { | |
492 | 7142 v17 = dword_F8B1AC_award_bit_number; |
7143 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7144 { |
7145 case 19: | |
7146 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7147 goto LABEL_40; | |
7148 v26 = 1; | |
7149 v23 = 26; | |
7150 goto LABEL_39; | |
7151 default: | |
7152 goto LABEL_41; | |
7153 case 20: | |
7154 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7155 goto LABEL_40; | |
7156 v26 = 1; | |
7157 v23 = 27; | |
7158 LABEL_39: | |
7159 if ( v1->_49327B(v23, v26) == 1 ) | |
7160 goto LABEL_40; | |
7161 return v35; | |
7162 case 30: | |
7163 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7164 goto LABEL_47; | |
7165 case 31: | |
7166 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7167 LABEL_47: | |
7168 if ( (v18 & 0x3Fu) < 0xA ) | |
7169 return v35; | |
7170 goto LABEL_41; | |
7171 case 21: | |
7172 case 23: | |
7173 case 24: | |
7174 case 25: | |
7175 case 26: | |
7176 case 29: | |
7177 case 32: | |
7178 case 34: | |
7179 case 35: | |
267 | 7180 gold_transaction_amount = 6000; |
0 | 7181 goto LABEL_42; |
7182 case 8: | |
7183 case 9: | |
7184 case 10: | |
7185 case 11: | |
267 | 7186 gold_transaction_amount = 7000; |
0 | 7187 goto LABEL_42; |
7188 case 7: | |
7189 break; | |
7190 } | |
7191 LABEL_67: | |
267 | 7192 gold_transaction_amount = 0; |
0 | 7193 goto LABEL_41; |
7194 } | |
7195 } | |
7196 return v35; | |
7197 } | |
7198 if ( v7 < 4 ) | |
7199 return v35; | |
492 | 7200 v17 = dword_F8B1AC_award_bit_number; |
7201 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7202 { | |
7203 if ( dword_F8B1AC_award_bit_number != 29 | |
7204 && dword_F8B1AC_award_bit_number != 32 | |
7205 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7206 { |
7207 LABEL_41: | |
267 | 7208 if ( !gold_transaction_amount ) |
0 | 7209 goto LABEL_79; |
7210 goto LABEL_42; | |
7211 } | |
7212 LABEL_87: | |
267 | 7213 gold_transaction_amount = 500; |
0 | 7214 goto LABEL_41; |
7215 } | |
492 | 7216 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7217 goto LABEL_87; |
492 | 7218 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7219 { |
267 | 7220 gold_transaction_amount = 0; |
0 | 7221 goto LABEL_79; |
7222 } | |
492 | 7223 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7224 goto LABEL_41; |
492 | 7225 if ( dword_F8B1AC_award_bit_number > 18 ) |
7226 { | |
7227 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7228 goto LABEL_41; |
7229 goto LABEL_87; | |
7230 } | |
267 | 7231 gold_transaction_amount = 1000; |
0 | 7232 LABEL_42: |
267 | 7233 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7234 return (char *)pNPCTopics[124].pText; |
7235 LABEL_79: | |
484 | 7236 contract_approved = 1; |
0 | 7237 if ( v34 == 2 ) |
7238 { | |
267 | 7239 v27 = gold_transaction_amount; |
0 | 7240 v24 = pSkillNames[v17]; |
7241 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7242 goto LABEL_90; | |
7243 } | |
7244 if ( v34 == 3 ) | |
7245 { | |
267 | 7246 v27 = gold_transaction_amount; |
0 | 7247 v24 = pSkillNames[v17]; |
7248 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7249 goto LABEL_90; | |
7250 } | |
7251 if ( v34 == 4 ) | |
7252 { | |
267 | 7253 v27 = gold_transaction_amount; |
0 | 7254 v24 = pSkillNames[v17]; |
7255 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7256 LABEL_90: | |
7257 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); | |
7258 } | |
7259 return pTmpBuf2; | |
7260 } | |
7261 | |
7262 | |
7263 | |
7264 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7265 const char * ContractSelectText( int pEventCode ) |
7266 { | |
7267 static const int dialogue_base=110; | |
484 | 7268 contract_approved = 0; |
492 | 7269 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7270 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7271 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7272 { | |
492 | 7273 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7274 { | |
7275 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7276 } |
7277 else | |
7278 { | |
267 | 7279 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7280 { |
484 | 7281 contract_approved = 1; |
492 | 7282 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7283 } |
7284 else | |
7285 { | |
492 | 7286 return pNPCTopics[dialogue_base+14].pText; |
0 | 7287 } |
7288 } | |
7289 } | |
7290 else | |
7291 { | |
492 | 7292 return pNPCTopics[dialogue_base+12].pText; |
0 | 7293 } |
7294 } | |
7295 | |
7296 | |
7297 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7298 void SimpleHouseAndBoatsDialog() |
0 | 7299 { |
7300 char *v0; // esi@3 | |
7301 char *v1; // ST1C_4@3 | |
7302 char *v2; // eax@3 | |
7303 const char *v3; // ST1C_4@5 | |
7304 int v4; // eax@5 | |
7305 unsigned int i; // eax@5 | |
7306 NPCData *v6; // esi@6 | |
7307 unsigned __int16 v7; // bx@6 | |
7308 unsigned int v8; // eax@6 | |
7309 int v9; // eax@11 | |
7310 unsigned int v10; // ecx@12 | |
7311 int v11; // eax@12 | |
7312 int v12; // esi@12 | |
7313 char *v13; // eax@12 | |
7314 GUIWindow *v14; // ebx@13 | |
7315 char *v15; // esi@14 | |
7316 GUIButton *v16; // eax@15 | |
7317 unsigned int v17; // ecx@15 | |
7318 int v18; // ecx@17 | |
7319 int v19; // ecx@18 | |
7320 int v20; // ecx@19 | |
7321 int v21; // ecx@20 | |
7322 int v22; // ecx@21 | |
7323 unsigned int v23; // ecx@23 | |
7324 int v24; // ecx@35 | |
7325 int v25; // ecx@36 | |
7326 int v26; // ecx@37 | |
7327 int v27; // ecx@38 | |
7328 int v28; // ecx@39 | |
7329 char *v29; // esi@42 | |
7330 unsigned int v30; // ST20_4@42 | |
7331 int v31; // ST1C_4@42 | |
7332 unsigned int v32; // eax@42 | |
7333 char *v33; // eax@43 | |
7334 int v34; // esi@51 | |
7335 int v35; // eax@51 | |
7336 unsigned int v36; // edi@51 | |
7337 GUIButton *v37; // eax@52 | |
7338 int v38; // eax@52 | |
7339 signed int v39; // ecx@54 | |
7340 int v40; // edi@57 | |
7341 GUIButton *v41; // eax@60 | |
7342 GUIButton *v42; // esi@60 | |
7343 const char *v43; // ebx@60 | |
7344 int v44; // eax@60 | |
7345 unsigned int v45; // ecx@60 | |
7346 unsigned __int16 v46; // ax@60 | |
7347 GUIFont *v47; // ebx@64 | |
7348 int v48; // esi@64 | |
7349 char *v49; // eax@66 | |
7350 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7351 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7352 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7353 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7354 int v55; // [sp+10Ch] [bp-10h]@6 | |
7355 int v56; // [sp+110h] [bp-Ch]@13 | |
7356 char *pInString; // [sp+114h] [bp-8h]@12 | |
7357 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7358 | |
7359 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7360 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7361 { |
7362 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7363 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7364 a1.uFrameX = 493; | |
7365 a1.uFrameWidth = 126; | |
7366 a1.uFrameZ = 366; | |
7367 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7368 a1.uFrameX = 483; | |
7369 a1.uFrameWidth = 148; | |
7370 a1.uFrameZ = 334; | |
434 | 7371 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7372 if ( !v2 ) |
7373 { | |
721 | 7374 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7375 v2 = pTmpBuf; |
7376 } | |
7377 v3 = v2; | |
7378 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7379 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7380 return; | |
0 | 7381 } |
7382 a1.uFrameWidth -= 10; | |
7383 a1.uFrameZ -= 10; | |
459 | 7384 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7385 v6 = v58; |
7386 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7387 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7388 v8 = v6->uProfession; | |
7389 if ( v8 ) | |
264 | 7390 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7391 else |
7392 strcpy(pTmpBuf, v6->pName); | |
7393 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7394 if ( !dword_591080 ) | |
7395 { | |
7396 if ( !uDialogueType ) | |
7397 { | |
7398 v9 = v6->greet; | |
7399 if ( v9 ) | |
7400 { | |
7401 v10 = v6->uFlags; | |
7402 a1.uFrameWidth = 460; | |
7403 a1.uFrameZ = 452; | |
7404 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7405 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7406 v12 = v11 + 7; | |
7407 pRenderer->_4A6A68( | |
7408 8u, | |
7409 352 - (v11 + 7), | |
7410 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7411 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7412 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7413 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7414 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7415 } | |
7416 } | |
7417 } | |
7418 v14 = pDialogueWindow; | |
7419 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7420 v52.uFrameX = 483; | |
7421 v52.uFrameWidth = 148; | |
7422 v52.uFrameZ = 334; | |
7423 v56 = v52.pStartingPosActiveItem; | |
7424 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7425 { | |
348 | 7426 v15 = "";//(char *)v54; |
0 | 7427 while ( 1 ) |
7428 { | |
7429 v16 = v52.GetControl(v56); | |
7430 v17 = v16->uControlParam; | |
7431 pInString = (char *)v16; | |
7432 if ( (signed int)v17 > 24 ) | |
7433 { | |
7434 v24 = v17 - 76; | |
7435 if ( !v24 ) | |
7436 { | |
7437 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7438 goto LABEL_49; | |
7439 } | |
7440 v25 = v24 - 1; | |
7441 if ( !v25 ) | |
7442 { | |
7443 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7444 goto LABEL_49; | |
7445 } | |
7446 v26 = v25 - 2; | |
7447 if ( !v26 ) | |
7448 { | |
7449 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7450 LABEL_44: | |
7451 v15 = v33; | |
7452 LABEL_45: | |
7453 v16 = (GUIButton *)pInString; | |
7454 goto LABEL_49; | |
7455 } | |
7456 v27 = v26 - 3; | |
7457 if ( !v27 ) | |
7458 { | |
459 | 7459 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7460 goto LABEL_44; |
7461 } | |
7462 v28 = v27 - 1; | |
7463 if ( !v28 ) | |
7464 { | |
7465 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7466 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7467 v31 = *(int *)v29; | |
7468 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7469 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7470 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
7471 ptr_F8B1E8 = pTmpBuf2; | |
7472 v15 = ""; | |
7473 goto LABEL_45; | |
7474 } | |
7475 if ( v28 != 10 ) | |
7476 goto LABEL_41; | |
7477 } | |
7478 else | |
7479 { | |
7480 if ( v17 == 24 ) | |
7481 { | |
291 | 7482 v23 = v58->evt_F; |
0 | 7483 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7484 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7485 if ( !v15 ) |
7486 { | |
7487 v16->uControlParam = 0; | |
7488 v15 = ""; | |
7489 } | |
7490 goto LABEL_49; | |
7491 } | |
7492 v18 = v17 - 13; | |
7493 if ( v18 ) | |
7494 { | |
7495 v19 = v18 - 6; | |
7496 if ( !v19 ) | |
7497 { | |
291 | 7498 v23 = v58->evt_A; |
0 | 7499 goto LABEL_33; |
7500 } | |
7501 v20 = v19 - 1; | |
7502 if ( !v20 ) | |
7503 { | |
291 | 7504 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7505 if ( !v15 ) |
7506 { | |
7507 v16->uControlParam = 0; | |
7508 v15 = ""; | |
7509 } | |
7510 if ( uDialogueType != 84 ) | |
7511 goto LABEL_49; | |
484 | 7512 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 7513 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
7514 ptr_F8B1E8 = pTmpBuf2; | |
7515 goto LABEL_45; | |
7516 } | |
7517 v21 = v20 - 1; | |
7518 if ( !v21 ) | |
7519 { | |
291 | 7520 v23 = v58->evt_C; |
0 | 7521 goto LABEL_33; |
7522 } | |
7523 v22 = v21 - 1; | |
7524 if ( !v22 ) | |
7525 { | |
291 | 7526 v23 = v58->evt_D; |
0 | 7527 goto LABEL_33; |
7528 } | |
7529 if ( v22 == 1 ) | |
7530 { | |
291 | 7531 v23 = v58->evt_E; |
0 | 7532 goto LABEL_33; |
7533 } | |
7534 LABEL_41: | |
7535 v15 = ""; | |
7536 goto LABEL_49; | |
7537 } | |
7538 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7539 } | |
7540 LABEL_49: | |
7541 strcpy(v16->pButtonName, v15); | |
7542 ++v56; | |
7543 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7544 { | |
7545 v14 = pDialogueWindow; | |
7546 break; | |
7547 } | |
7548 } | |
7549 } | |
7550 v34 = 0; | |
7551 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7552 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7553 v36 = v14->pStartingPosActiveItem; | |
7554 v55 = v35; | |
7555 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7556 + pDialogueWindow->pStartingPosActiveItem ) | |
7557 { | |
7558 v37 = v14->GetControl(v36); | |
7559 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7560 v14 = pDialogueWindow; | |
7561 v34 += v38; | |
7562 ++v36; | |
7563 } | |
7564 v39 = v14->pNumPresenceButton; | |
7565 if ( v39 ) | |
7566 { | |
7567 v58 = (NPCData *)((174 - v34) / v39); | |
7568 if ( (signed int)v58 > 32 ) | |
7569 v58 = (NPCData *)32; | |
7570 pInString = (char *)2; | |
7571 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7572 v56 = v14->pStartingPosActiveItem; | |
7573 i = v56; | |
7574 if ( (signed int)i < (signed int)(i + v39) ) | |
7575 { | |
7576 while ( 1 ) | |
7577 { | |
7578 v41 = v14->GetControl(i); | |
7579 v42 = v41; | |
7580 v43 = v41->pButtonName; | |
7581 v41->uY = (unsigned int)((char *)v58 + v40); | |
7582 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7583 v45 = v42->uY; | |
7584 v42->uHeight = v44; | |
7585 v40 = v45 + v44 - 1; | |
7586 v42->uW = v40; | |
7587 v46 = v55; | |
7588 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7589 v46 = v54; | |
7590 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7591 v14 = pDialogueWindow; | |
7592 ++pInString; | |
7593 ++v56; | |
7594 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7595 if ( v56 >= (signed int)i ) | |
7596 break; | |
7597 i = v56; | |
7598 } | |
7599 } | |
7600 } | |
7601 if ( ptr_F8B1E8 ) | |
7602 { | |
7603 w.uFrameWidth = 458; | |
7604 w.uFrameZ = 457; | |
7605 v47 = pFontArrus; | |
7606 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7607 if ( 352 - v48 < 8 ) | |
7608 { | |
7609 v47 = pFontCreate; | |
7610 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7611 } | |
7612 pRenderer->_4A6A68( | |
7613 8u, | |
7614 352 - v48, | |
7615 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7616 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7617 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
7618 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); | |
762 | 7619 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7620 } | |
0 | 7621 } |
7622 | |
7623 | |
7624 | |
7625 | |
7626 | |
7627 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7628 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
7629 { | |
7630 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); | |
0 | 7631 } |
7632 | |
7633 | |
7634 | |
7635 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7636 void sub_4B3A72( int a1 ) |
7637 { | |
7638 int num_buttons; // esi@1 | |
7639 | |
7640 num_buttons = 0; | |
0 | 7641 if ( a1 == 21 ) |
7642 { | |
473 | 7643 CreateButtonInColumn(0, 0x66u); |
7644 num_buttons = 2; | |
7645 CreateButtonInColumn(1, 0x67u); | |
7646 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7647 { | |
7648 num_buttons = 3; | |
7649 CreateButtonInColumn(2, 0x68u); | |
7650 } | |
7651 } | |
7652 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7653 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7654 } | |
7655 // F8B1E0: using guessed type int dword_F8B1E0; | |
7656 | |
7657 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7658 void sub_4B3AD4( signed int a1 ) |
7659 { | |
0 | 7660 if ( a1 > 0 ) |
7661 { | |
7662 if ( a1 <= 3 ) | |
7663 { | |
473 | 7664 CreateButtonInColumn(0, 3u); |
7665 CreateButtonInColumn(1, 4u); | |
7666 CreateButtonInColumn(2, 5u); | |
7667 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7668 } |
7669 if ( a1 == 4 ) | |
7670 { | |
473 | 7671 CreateButtonInColumn(0, 3u); |
7672 CreateButtonInColumn(1, 4u); | |
7673 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7674 } | |
7675 } | |
0 | 7676 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7677 } | |
7678 // F8B1E0: using guessed type int dword_F8B1E0; | |
7679 | |
7680 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7681 void sub_4B3B42( signed int a1 ) |
7682 { | |
0 | 7683 int v1; // ecx@18 |
7684 int v2; // ecx@19 | |
7685 int v3; // ecx@20 | |
7686 signed int v4; // esi@22 | |
7687 signed int v5; // eax@22 | |
7688 unsigned int v6; // edx@24 | |
7689 int v7; // ecx@24 | |
7690 int result; // eax@43 | |
7691 int v9; // [sp-10h] [bp-14h]@28 | |
7692 int v10; // [sp-Ch] [bp-10h]@28 | |
7693 int v11; // [sp-8h] [bp-Ch]@28 | |
7694 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7695 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7696 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7697 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7698 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7699 int v17; // [sp-4h] [bp-8h]@28 | |
7700 | |
7701 if ( a1 > 13 ) | |
7702 { | |
7703 if ( a1 > 22 ) | |
7704 { | |
7705 if ( a1 == 23 ) | |
7706 { | |
473 | 7707 CreateButtonInColumn(0, 0xAu); |
7708 CreateButtonInColumn(1, 0xBu); | |
0 | 7709 v14 = 96; |
7710 LABEL_41: | |
473 | 7711 CreateButtonInColumn(2, v14); |
0 | 7712 v17 = 2; |
7713 v11 = 0; | |
7714 v10 = 1; | |
7715 v9 = 3; | |
7716 goto LABEL_42; | |
7717 } | |
7718 if ( a1 <= 26 ) | |
7719 goto LABEL_43; | |
7720 if ( a1 > 28 ) | |
7721 { | |
7722 if ( a1 != 30 ) | |
7723 goto LABEL_43; | |
473 | 7724 CreateButtonInColumn(0, 0x11u); |
0 | 7725 v16 = 96; |
7726 goto LABEL_37; | |
7727 } | |
473 | 7728 CreateButtonInColumn(0, 0x69u); |
7729 CreateButtonInColumn(1, 0x6Au); | |
7730 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7731 v12 = 108; |
7732 } | |
7733 else | |
7734 { | |
7735 if ( a1 == 22 ) | |
7736 { | |
473 | 7737 CreateButtonInColumn(0, 7u); |
0 | 7738 v16 = 8; |
7739 goto LABEL_37; | |
7740 } | |
7741 v1 = a1 - 14; | |
7742 if ( !v1 ) | |
7743 { | |
473 | 7744 CreateButtonInColumn(0, 0x12u); |
7745 CreateButtonInColumn(1, 0x30u); | |
7746 CreateButtonInColumn(2, 0x31u); | |
7747 CreateButtonInColumn(3, 0x32u); | |
7748 CreateButtonInColumn(4, 0x33u); | |
0 | 7749 v17 = 2; |
7750 v11 = 0; | |
7751 v10 = 1; | |
7752 v9 = 5; | |
7753 goto LABEL_42; | |
7754 } | |
7755 v2 = v1 - 1; | |
7756 if ( v2 ) | |
7757 { | |
7758 v3 = v2 - 2; | |
7759 if ( v3 ) | |
7760 { | |
7761 if ( v3 != 4 ) | |
7762 goto LABEL_43; | |
473 | 7763 CreateButtonInColumn(0, 0xFu); |
7764 CreateButtonInColumn(1, 0x10u); | |
0 | 7765 v4 = 3; |
473 | 7766 CreateButtonInColumn(2, 0x60u); |
336 | 7767 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7768 if ( v5 < 108 || v5 > 120 ) |
7769 goto LABEL_28; | |
7770 v4 = 4; | |
7771 v6 = 101; | |
7772 v7 = 3; | |
7773 } | |
7774 else | |
7775 { | |
7776 v4 = 1; | |
473 | 7777 CreateButtonInColumn(0, 0x63u); |
0 | 7778 if ( !pParty->uFine ) |
7779 { | |
7780 LABEL_28: | |
7781 v17 = 2; | |
7782 v11 = 0; | |
7783 v10 = 1; | |
7784 v9 = v4; | |
7785 LABEL_42: | |
7786 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7787 goto LABEL_43; | |
7788 } | |
7789 v4 = 2; | |
7790 v7 = 1; | |
7791 v6 = 100; | |
7792 } | |
473 | 7793 CreateButtonInColumn(v7, v6); |
0 | 7794 goto LABEL_28; |
7795 } | |
473 | 7796 CreateButtonInColumn(0, 0x12u); |
7797 CreateButtonInColumn(1, 0x34u); | |
7798 CreateButtonInColumn(2, 0x35u); | |
0 | 7799 v12 = 54; |
7800 } | |
7801 LABEL_39: | |
473 | 7802 CreateButtonInColumn(3, v12); |
0 | 7803 v17 = 2; |
7804 v11 = 0; | |
7805 v10 = 1; | |
7806 v9 = 4; | |
7807 goto LABEL_42; | |
7808 } | |
7809 if ( a1 == 13 ) | |
7810 { | |
473 | 7811 CreateButtonInColumn(0, 0x12u); |
0 | 7812 v16 = 56; |
7813 LABEL_37: | |
473 | 7814 CreateButtonInColumn(1, v16); |
0 | 7815 v17 = 2; |
7816 v11 = 0; | |
7817 v10 = 1; | |
7818 v9 = 2; | |
7819 goto LABEL_42; | |
7820 } | |
7821 switch ( a1 ) | |
7822 { | |
7823 case 1: | |
7824 case 2: | |
7825 case 3: | |
7826 case 4: | |
473 | 7827 CreateButtonInColumn(0, 2u); |
7828 CreateButtonInColumn(1, 0x5Fu); | |
7829 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7830 v12 = 96; |
7831 goto LABEL_39; | |
7832 case 5: | |
473 | 7833 CreateButtonInColumn(0, 0x12u); |
0 | 7834 v13 = 48; |
7835 goto LABEL_9; | |
7836 case 6: | |
473 | 7837 CreateButtonInColumn(0, 0x12u); |
0 | 7838 v13 = 49; |
7839 goto LABEL_9; | |
7840 case 7: | |
473 | 7841 CreateButtonInColumn(0, 0x12u); |
0 | 7842 v13 = 50; |
7843 goto LABEL_9; | |
7844 case 8: | |
473 | 7845 CreateButtonInColumn(0, 0x12u); |
0 | 7846 v13 = 51; |
7847 LABEL_9: | |
473 | 7848 CreateButtonInColumn(1, v13); |
0 | 7849 v14 = 72; |
7850 goto LABEL_41; | |
7851 case 9: | |
473 | 7852 CreateButtonInColumn(0, 0x12u); |
0 | 7853 v15 = 52; |
7854 goto LABEL_13; | |
7855 case 10: | |
473 | 7856 CreateButtonInColumn(0, 0x12u); |
0 | 7857 v15 = 53; |
7858 goto LABEL_13; | |
7859 case 11: | |
473 | 7860 CreateButtonInColumn(0, 0x12u); |
0 | 7861 v15 = 54; |
7862 LABEL_13: | |
473 | 7863 CreateButtonInColumn(1, v15); |
0 | 7864 v14 = 61; |
7865 goto LABEL_41; | |
7866 case 12: | |
473 | 7867 CreateButtonInColumn(0, 0x12u); |
0 | 7868 v16 = 55; |
7869 goto LABEL_37; | |
7870 default: | |
7871 break; | |
7872 } | |
7873 LABEL_43: | |
7874 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7875 } | |
7876 // F8B1E0: using guessed type int dword_F8B1E0; | |
7877 | |
7878 //----- (004B3E1E) -------------------------------------------------------- | |
7879 void __cdecl sub_4B3E1E() | |
7880 { | |
7881 NPCData *v0; // ST40_4@1 | |
7882 signed int v1; // edi@1 | |
165 | 7883 //GUIWindow *v2; // ecx@1 |
0 | 7884 |
167 | 7885 __debugbreak(); |
602 | 7886 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7887 v1 = 0; |
7888 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7889 pDialogueWindow->Release(); | |
165 | 7890 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7891 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7892 { |
165 | 7893 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7894 v1 = 1; |
7895 } | |
165 | 7896 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7897 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7898 } | |
7899 | |
7900 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7901 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7902 { |
467 | 7903 uDialogueType = 81;//enum JoinGuildDialog |
492 | 7904 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
7905 ContractSelectText(pEventCode); | |
0 | 7906 pDialogueWindow->Release(); |
492 | 7907 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 7908 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 7909 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7910 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 7911 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); |
0 | 7912 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7913 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7914 } |
7915 // F8B19C: using guessed type int dword_F8B19C; | |
7916 | |
7917 //----- (004B3FE5) -------------------------------------------------------- | |
7918 void __fastcall sub_4B3FE5(int a4) | |
7919 { | |
7920 int v1; // edi@1 | |
7921 char *v2; // edi@1 | |
7922 | |
7923 v1 = a4; | |
7924 uDialogueType = 78; | |
7925 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
7926 _4B254D_SkillMasteryTeacher(a4); | |
7927 pDialogueWindow->Release(); | |
7928 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7929 v2 = ""; | |
492 | 7930 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 7931 pGlobalTXT_LocalizationStrings[34], |
526 | 7932 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7933 0); |
7934 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 7935 if ( contract_approved ) |
0 | 7936 v2 = pGlobalTXT_LocalizationStrings[535]; |
7937 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); | |
7938 pDialogueWindow->_41D08F(1, 1, 0, 2); | |
747 | 7939 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7940 } |
7941 // F8B19C: using guessed type int dword_F8B19C; | |
7942 // F8B1A8: using guessed type int dword_F8B1A8; | |
7943 | |
7944 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7945 void NPCHireableDialogPrepare() |
7946 { | |
0 | 7947 signed int v0; // ebx@1 |
7948 NPCData *v1; // edi@1 | |
7949 | |
7950 v0 = 0; | |
459 | 7951 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7952 pDialogueWindow->Release(); |
7953 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
607 | 7954 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
7955 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 7956 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7957 0); |
7958 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 7959 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7960 { |
607 | 7961 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
7962 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 7963 v0 = 1; |
7964 } | |
607 | 7965 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
7966 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" | |
0 | 7967 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7968 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7969 } |
7970 | |
7971 | |
7972 //----- (004B4224) -------------------------------------------------------- | |
423 | 7973 void _4B4224_UpdateNPCTopics( int _this ) |
7974 { | |
7975 int num_menu_buttons; // ebx@1 | |
0 | 7976 int i; // ebp@5 |
423 | 7977 // signed int v4; // ebp@9 |
7978 int v6; // eax@16 | |
7979 int v8; // eax@21 | |
7980 int v10; // eax@26 | |
7981 int v12; // eax@31 | |
7982 int v14; // eax@36 | |
7983 int v16; // eax@41 | |
0 | 7984 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7985 | |
423 | 7986 num_menu_buttons = 0; |
459 | 7987 pDialogueNPCCount = (_this + 1); |
0 | 7988 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7989 { | |
7990 pDialogueWindow->Release(); | |
7991 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
423 | 7992 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
7993 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, | |
0 | 7994 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7995 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 7996 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
7997 sHouseName, | |
7998 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 7999 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 8000 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); |
0 | 8001 } |
8002 else | |
8003 { | |
459 | 8004 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 8005 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 8006 { |
8007 pDialogueWindow->Release(); | |
8008 } | |
8009 else | |
8010 { | |
8011 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 8012 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 8013 } |
8014 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
423 | 8015 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 8016 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 8017 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 8018 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 8019 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 8020 { |
484 | 8021 sub_4B3B42(in_current_building_type); |
0 | 8022 } |
8023 else | |
8024 { | |
8025 if ( v17->joins ) | |
8026 { | |
423 | 8027 num_menu_buttons = 1; |
0 | 8028 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); |
8029 } | |
423 | 8030 if ( v17->evt_A) |
8031 { | |
8032 if ( num_menu_buttons < 4 ) | |
8033 { | |
8034 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 8035 if ( v6 == 1 || v6 == 2 ) |
423 | 8036 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
8037 } | |
8038 } | |
8039 if ( v17->evt_B ) | |
8040 { | |
8041 if ( num_menu_buttons < 4 ) | |
8042 { | |
8043 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 8044 if ( v8 == 1 || v8 == 2 ) |
423 | 8045 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
8046 } | |
8047 } | |
8048 if ( v17->evt_C ) | |
8049 { | |
8050 if ( num_menu_buttons < 4 ) | |
8051 { | |
8052 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 8053 if ( v10 == 1 || v10 == 2 ) |
423 | 8054 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
8055 } | |
8056 } | |
8057 | |
8058 if ( v17->evt_D ) | |
8059 { | |
8060 if ( num_menu_buttons < 4 ) | |
8061 { | |
8062 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 8063 if ( v12 == 1 || v12 == 2 ) |
423 | 8064 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
8065 } | |
8066 } | |
8067 if ( v17->evt_E ) | |
8068 { | |
8069 if ( num_menu_buttons < 4 ) | |
8070 { | |
8071 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 8072 if ( v14 == 1 || v14 == 2 ) |
423 | 8073 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
8074 } | |
8075 } | |
8076 if ( v17->evt_F ) | |
8077 { | |
8078 if ( num_menu_buttons < 4 ) | |
8079 { | |
8080 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8081 if ( v16 == 1 || v16 == 2 ) |
423 | 8082 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
8083 } | |
8084 } | |
8085 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 8086 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8087 } | |
747 | 8088 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 8089 } |
8090 | |
0 | 8091 } |
8092 | |
8093 | |
8094 | |
8095 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8096 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8097 { |
0 | 8098 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8099 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8100 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8101 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8102 } |
8103 | |
8104 //----- (004B46F8) -------------------------------------------------------- | |
8105 int __fastcall sub_4B46F8(int a1) | |
8106 { | |
8107 int v1; // eax@1 | |
8108 int i; // edx@1 | |
8109 | |
8110 v1 = 0; | |
8111 for ( i = 0; i < a1; ++i ) | |
8112 v1 += i + 1; | |
8113 return 1000 * v1; | |
8114 } | |
8115 | |
8116 | |
8117 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8118 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8119 { |
656 | 8120 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8121 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8122 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8123 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8124 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8125 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8126 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8127 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8128 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8129 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8130 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8131 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8132 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8133 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8134 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8135 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8136 //v1 = _this; |
656 | 8137 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8138 //v3 = v1; |
656 | 8139 uDialogueType = newDialogueType; |
8140 if (!speakingNPC->uFlags) | |
8141 { | |
8142 speakingNPC->uFlags = 1; | |
8143 //v3 = uDialogueType; | |
8144 } | |
8145 | |
8146 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8147 { | |
8148 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8149 } | |
8150 else if(newDialogueType == DIALOGUE_76) | |
8151 { | |
8152 if (speakingNPC->Hired()) | |
8153 { | |
8154 v8 = 0; | |
8155 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8156 { | |
8157 v6 = (char *)pNPCStats->pNewNPCData; | |
8158 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8159 { | |
8160 ++v8; | |
8161 v6 += 76; | |
8162 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8163 break; | |
8164 } | |
8165 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8166 v6[8] &= 0x7Fu; | |
8167 } | |
8168 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8169 { | |
8170 v11 = pParty->pHirelings; | |
8171 memset(v11, 0, sizeof(NPCData)); | |
8172 } | |
8173 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8174 { | |
8175 v11 = &pParty->pHirelings[1]; | |
8176 memset(v11, 0, sizeof(NPCData)); | |
8177 } | |
8178 pParty->field_709 = 0; | |
659 | 8179 Party__CountHirelings(); |
656 | 8180 dword_591084 = 0; |
8181 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8182 dword_7241C8 = 0; | |
8183 return; | |
8184 } | |
8185 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8186 { | |
8187 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8188 ShowStatusBarString(v7, 2u); | |
8189 } | |
8190 else | |
8191 { | |
8192 //v9 = v2->uProfession; | |
8193 if ( speakingNPC->uProfession != 51 ) | |
8194 { | |
8195 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8196 if ( pParty->uNumGold < v10 ) | |
8197 { | |
8198 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8199 dialogue_show_profession_details = false; | |
8200 uDialogueType = 13; | |
8201 if ( uActiveCharacter ) | |
8202 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8203 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8204 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8205 if ( !dword_7241C8 ) | |
8206 pGame->Draw(); | |
8207 dword_7241C8 = 0; | |
8208 return; | |
8209 } | |
8210 Party::TakeGold(v10); | |
8211 } | |
8212 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8213 if ( pParty->pHirelings[0].pName ) | |
8214 { | |
8215 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8216 v15 = speakingNPC->pName; | |
8217 v13 = pParty->pHireling2Name; | |
8218 } | |
8219 else | |
8220 { | |
8221 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8222 v15 = speakingNPC->pName; | |
8223 v13 = pParty->pHireling1Name; | |
8224 } | |
8225 strcpy(v13, v15); | |
8226 pParty->field_709 = 0; | |
659 | 8227 Party__CountHirelings(); |
656 | 8228 |
8229 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8230 | |
711 | 8231 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8232 pDialogue_SpeakingActor->uAIState = Removed; |
8233 if ( uActiveCharacter ) | |
8234 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8235 } | |
8236 } | |
8237 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8238 { | |
8239 ArenaFight(); | |
8240 return; | |
8241 } | |
8242 else if(newDialogueType == DIALOGUE_9) | |
8243 { | |
8244 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8245 { | |
8246 if ( speakingNPC->uProfession != 41 ) | |
8247 speakingNPC->bHasUsedTheAbility = 1; | |
8248 | |
8249 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8250 } | |
8251 else | |
8252 { | |
8253 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8254 } | |
8255 } | |
8256 else if(newDialogueType == DIALOGUE_13) | |
8257 { | |
8258 if (!speakingNPC->Hired()) | |
8259 { | |
8260 sub_4B3E1E(); | |
8261 dialogue_show_profession_details = false; | |
8262 } | |
8263 else | |
8264 { | |
8265 v5 = 0; | |
8266 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8267 { | |
8268 v6 = (char *)pNPCStats->pNewNPCData; | |
8269 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8270 { | |
8271 ++v5; | |
8272 v6 += 76; | |
8273 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8274 break; | |
8275 } | |
8276 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8277 v6[8] &= 0x7Fu; | |
8278 } | |
8279 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8280 { | |
8281 v11 = pParty->pHirelings; | |
8282 memset(v11, 0, sizeof(NPCData)); | |
8283 } | |
8284 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8285 { | |
8286 v11 = &pParty->pHirelings[1]; | |
8287 memset(v11, 0, sizeof(NPCData)); | |
8288 } | |
8289 pParty->field_709 = 0; | |
659 | 8290 Party__CountHirelings(); |
656 | 8291 dword_591084 = 0; |
8292 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8293 dword_7241C8 = 0; | |
8294 return; | |
8295 } | |
8296 } | |
8297 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8298 { | |
8299 switch(newDialogueType) | |
8300 { | |
8301 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8302 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8303 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8304 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8305 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8306 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8307 } | |
8308 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8309 sub_4B3FE5(npc_event_id); //200-310 | |
8310 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8311 { //400-410 | |
8312 dword_F8B1D8 = newDialogueType; | |
8313 DrawJoinGuildWindow(npc_event_id - 400); | |
8314 } | |
8315 else | |
8316 { | |
8317 switch ( npc_event_id ) | |
8318 { | |
8319 case 139: | |
8320 sub_4B1ECE(); | |
8321 break; | |
8322 case 311: | |
8323 sub_4BBA85_bounties(); | |
8324 break; | |
8325 case 399: | |
8326 sub_4BBCDD(); | |
8327 break; | |
8328 default: | |
8329 activeLevelDecoration = (LevelDecoration*)1; | |
8330 ptr_F8B1E8 = 0; | |
8331 EventProcessor(npc_event_id, 0, 1); | |
8332 activeLevelDecoration = NULL; | |
8333 break; | |
8334 } | |
8335 } | |
8336 } | |
8337 if ( !dword_7241C8 ) | |
8338 pGame->Draw(); | |
8339 dword_7241C8 = 0; | |
8340 } | |
0 | 8341 |
8342 | |
8343 | |
8344 //----- (004BDAAF) -------------------------------------------------------- | |
8345 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
8346 { | |
8347 int v2; // edx@1 | |
8348 unsigned int v3; // esi@1 | |
8349 unsigned int v4; // eax@1 | |
8350 signed int v5; // edi@1 | |
8351 int v6; // edx@8 | |
8352 int v7; // edx@9 | |
8353 int v8; // edx@10 | |
8354 unsigned __int8 v9; // zf@16 | |
8355 char v10; // sf@16 | |
8356 unsigned __int8 v11; // of@16 | |
702 | 8357 bool test; |
0 | 8358 |
8359 auto a2 = _2da_idx; | |
8360 //v2 = p2DEvents_minus1___00[26 * a2]; | |
8361 v2 = p2DEvents[a2 - 1].uType; | |
8362 v3 = a1->uItemID; | |
8363 v4 = a1->uItemID; | |
8364 v5 = pItemsTable->pItems[v4].uEquipType; | |
8365 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 8366 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 8367 return 0; |
702 | 8368 switch( p2DEvents[a2 - 1].uType ) |
8369 { | |
8370 case BildingType_WeaponShop: | |
8371 { | |
8372 test = v5 <= 2; | |
8373 break; | |
8374 } | |
8375 case BildingType_ArmorShop: | |
8376 { | |
8377 test = v5 >= 3; | |
8378 break; | |
8379 } | |
8380 case BildingType_MagicShop: | |
8381 { | |
8382 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
8383 break; | |
8384 } | |
8385 case BildingType_AlchemistShop: | |
8386 { | |
8387 __debugbreak(); // need to test | |
8388 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
8389 break; | |
8390 } | |
8391 default: | |
8392 { | |
8393 test = 0; | |
8394 break; | |
8395 } | |
8396 } | |
8397 | |
8398 return test; | |
8399 /* | |
8400 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8401 { |
8402 v11 = __OFSUB__(v5, 2); | |
8403 v9 = v5 == 2; | |
8404 v10 = v5 - 2 < 0; | |
8405 goto LABEL_23; | |
8406 } | |
702 | 8407 if ( p2DEvents[a2 - 1].uType > 2 ) |
8408 { | |
8409 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8410 { |
8411 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8412 return v5 == 16; | |
8413 return 1; | |
8414 } | |
702 | 8415 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8416 return 0; |
702 | 8417 if ( p2DEvents[a2 - 1].uType == 4) |
8418 { | |
8419 if ( v5 < 13 ) | |
8420 return 0; | |
8421 if ( v5 <= 14 ) | |
8422 return 1; | |
8423 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8424 return 0; | |
8425 v11 = __OFSUB__(v3, 771); | |
8426 v9 = v3 == 771; | |
8427 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8428 LABEL_23: |
702 | 8429 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8430 return 0; | |
8431 return 1; | |
8432 } | |
8433 } | |
8434 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8435 { | |
8436 if ( v5 >= 3 ) | |
8437 { | |
8438 v11 = __OFSUB__(v5, 9); | |
8439 v9 = v5 == 9; | |
8440 v10 = v5 - 9 < 0; | |
8441 goto LABEL_23; | |
8442 } | |
0 | 8443 } |
8444 return 0; | |
702 | 8445 */ |
0 | 8446 } |
8447 | |
8448 | |
8449 | |
8450 | |
8451 //----- (004B6478) -------------------------------------------------------- | |
711 | 8452 void sub_4B6478() |
8453 { | |
0 | 8454 GUIWindow *v0; // ebx@1 |
8455 Player *v1; // edi@1 | |
8456 unsigned int v2; // eax@1 | |
8457 signed int v3; // esi@1 | |
8458 int v4; // ebx@1 | |
8459 unsigned int v5; // esi@5 | |
8460 int v6; // edi@6 | |
8461 int result; // eax@13 | |
8462 GUIWindow *v8; // ebx@17 | |
8463 int v9; // eax@17 | |
8464 int v10; // ecx@17 | |
8465 unsigned int v11; // ecx@18 | |
8466 int v12; // eax@20 | |
8467 int v13; // eax@21 | |
8468 GUIButton *v14; // esi@27 | |
8469 int v15; // ecx@27 | |
8470 unsigned int v16; // eax@28 | |
8471 const char *v17; // ebx@29 | |
8472 int v18; // eax@29 | |
8473 unsigned int v19; // ecx@29 | |
8474 int v20; // eax@29 | |
8475 unsigned __int16 v21; // ax@29 | |
8476 unsigned __int16 v22; // ST14_2@36 | |
8477 int v23; // eax@36 | |
8478 const char *v24; // ST18_4@37 | |
8479 unsigned __int16 v25; // ST14_2@37 | |
8480 int v26; // eax@37 | |
8481 int v27; // [sp-4h] [bp-80h]@8 | |
8482 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8483 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8484 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8485 int v31; // [sp+68h] [bp-14h]@1 | |
8486 int v32; // [sp+6Ch] [bp-10h]@1 | |
8487 int v33; // [sp+70h] [bp-Ch]@17 | |
8488 int v34; // [sp+74h] [bp-8h]@17 | |
8489 int v35; // [sp+78h] [bp-4h]@17 | |
8490 | |
336 | 8491 v0 = window_SpeakInHouse; |
8492 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8493 v1 = pPlayers[uActiveCharacter]; |
8494 v28.uFrameX = 483; | |
8495 v28.uFrameWidth = 148; | |
8496 v28.uFrameZ = 334; | |
8497 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8498 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8499 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8500 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8501 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8502 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8503 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8504 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8505 v32 = v4; | |
8506 if ( v4 < v3 / 3 ) | |
8507 { | |
8508 v4 = v3 / 3; | |
8509 v32 = v3 / 3; | |
8510 } | |
749 | 8511 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8512 { |
8513 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8514 { | |
8515 v5 = 0; | |
8516 | |
8517 __debugbreak(); | |
8518 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8519 // or | |
8520 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8521 // or | |
8522 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8523 __debugbreak(); // whacky condition - fix |
0 | 8524 if (false |
8525 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8526 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8527 { |
8528 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8529 } | |
8530 else | |
8531 { | |
8532 if ( pParty->uNumGold < v4 ) | |
8533 { | |
8534 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8535 v27 = 4; | |
8536 } | |
8537 else | |
8538 { | |
8539 Party::TakeGold(v4); | |
8540 *(short *)v6 = 1; | |
8541 v27 = 2; | |
8542 } | |
735 | 8543 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8544 } |
8545 } | |
8546 else | |
8547 { | |
8548 v5 = 0; | |
8549 } | |
437 | 8550 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8551 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8552 { | |
8553 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8554 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8555 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8556 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8557 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8558 }*/ |
8559 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8560 return; // void func |
0 | 8561 } |
484 | 8562 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8563 { |
8564 v24 = pNPCTopics[171].pText; | |
8565 v25 = v31; | |
8566 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8567 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8568 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8569 return ; |
8570 } | |
8571 | |
8572 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8573 return; | |
0 | 8574 v8 = pDialogueWindow; |
8575 v33 = 0; | |
8576 v34 = 0; | |
8577 v29 = pDialogueWindow; | |
8578 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8579 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8580 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8581 if ( v9 >= v10 ) | |
8582 goto LABEL_40; | |
8583 do | |
8584 { | |
8585 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 8586 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8587 { |
8588 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8589 v33 += v12; | |
8590 ++v34; | |
8591 } | |
8592 v13 = v8->pStartingPosActiveItem; | |
8593 ++v35; | |
8594 } | |
8595 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8596 if ( !v34 ) | |
8597 { | |
8598 LABEL_40: | |
135 | 8599 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8600 strcat(pTmpBuf, "\n \n"); |
8601 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8602 v22 = v31; | |
8603 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8604 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8605 return; | |
0 | 8606 } |
8607 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8608 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8609 v32 = (149 - v33) / v34; | |
8610 if ( (149 - v33) / v34 > 32 ) | |
8611 v32 = 32; | |
711 | 8612 |
8613 v35 = v8->pStartingPosActiveItem; | |
0 | 8614 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8615 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8616 { |
8617 v33 = 2; | |
8618 do | |
8619 { | |
8620 v14 = v8->GetControl(v35); | |
8621 v15 = v14->uControlParam - 36; | |
135 | 8622 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8623 { |
8624 v16 = 0; | |
8625 if ( !v1->pActiveSkills[v15] ) | |
8626 { | |
8627 v17 = pSkillNames[v15]; | |
8628 v14->uY = v32 + v34; | |
8629 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8630 v19 = v14->uY; | |
8631 v14->uHeight = v18; | |
8632 v20 = v19 + v18 - 1; | |
8633 v14->uW = v20; | |
8634 v34 = v20; | |
8635 v21 = v31; | |
8636 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8637 v21 = v30; | |
8638 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8639 goto LABEL_34; | |
8640 } | |
8641 } | |
8642 else | |
8643 { | |
8644 v16 = 0; | |
8645 } | |
8646 v14->uW = v16; | |
8647 v14->uHeight = v16; | |
8648 v14->uY = v16; | |
8649 LABEL_34: | |
8650 v8 = v29; | |
8651 ++v35; | |
8652 ++v33; | |
711 | 8653 } |
8654 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8655 } | |
8656 return; | |
0 | 8657 } |
8658 | |
8659 | |
8660 | |
8661 | |
8662 | |
8663 //----- (00405CFF) -------------------------------------------------------- | |
8664 void stru262_TurnBased::End(bool bPlaySound) | |
8665 { | |
8666 stru262_TurnBased *v2; // edi@1 | |
8667 int v3; // ebx@1 | |
8668 int v4; // esi@1 | |
8669 unsigned __int8 v5; // zf@1 | |
8670 unsigned __int8 v6; // sf@1 | |
8671 TurnBased_QueueElem *v7; // ecx@2 | |
8672 unsigned __int16 *pAttributes; // ecx@7 | |
8673 size_t v9; // edx@7 | |
8674 unsigned __int16 v10; // ax@8 | |
8675 TurnBased_QueueElem *v11; // ebx@12 | |
8676 ObjectType objType; // eax@13 | |
8677 int objID; // esi@13 | |
8678 int v14; // [sp+Ch] [bp-4h]@11 | |
8679 | |
8680 v2 = this; | |
8681 v3 = 0; | |
8682 v4 = 0; | |
8683 v5 = this->uActorQueueSize == 0; | |
8684 v6 = this->uActorQueueSize < 0; | |
8685 this->field_4 = 0; | |
8686 if ( !(v6 | v5) ) | |
8687 { | |
8688 v7 = this->pQueue; | |
8689 do | |
8690 { | |
8691 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
8692 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
8693 ++v4; | |
8694 ++v7; | |
8695 } | |
8696 while ( v4 < v2->uActorQueueSize ); | |
8697 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8698 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8699 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8700 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8701 v9 = uNumSpriteObjects; |
0 | 8702 do |
8703 { | |
8704 v10 = *pAttributes; | |
8705 if ( *pAttributes & 4 ) | |
8706 { | |
8707 LOBYTE(v10) = v10 & 0xFB; | |
8708 *pAttributes = v10; | |
8709 } | |
8710 pAttributes += 56; | |
8711 --v9; | |
8712 } | |
8713 while ( v9 ); | |
8714 } | |
8715 v14 = 0; | |
8716 if ( v2->uActorQueueSize > 0 ) | |
8717 { | |
8718 v11 = v2->pQueue; | |
8719 do | |
8720 { | |
8721 objType = (ObjectType)(v11->uPackedID & 7); | |
8722 objID = v11->uPackedID >> 3; | |
8723 if ( objType == OBJECT_Player ) | |
8724 { | |
8725 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8726 } | |
8727 else | |
8728 { | |
8729 if ( objType == OBJECT_Actor ) | |
8730 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8731 } | |
8732 ++v14; | |
8733 ++v11; | |
8734 } | |
8735 while ( v14 < v2->uActorQueueSize ); | |
8736 v3 = 0; | |
8737 } | |
8738 pAudioPlayer->StopChannels(-1, -1); | |
8739 if ( bPlaySound != v3 ) | |
8740 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8741 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8742 pEventTimer->StopGameTime(); | |
8743 dword_50C994 = v3; | |
8744 dword_50C998_turnbased_icon_1A = v3; | |
8745 } | |
8746 // 50C994: using guessed type int dword_50C994; | |
8747 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8748 | |
8749 //----- (00405E14) -------------------------------------------------------- | |
8750 void stru262_TurnBased::_405E14() | |
8751 { | |
8752 stru262_TurnBased *v1; // esi@1 | |
8753 int v2; // ecx@1 | |
8754 SpellBuff *v3; // edi@2 | |
8755 Actor *v4; // ebx@3 | |
8756 signed int v5; // edx@20 | |
8757 AIDirection *v6; // esi@21 | |
8758 int v7; // eax@21 | |
8759 int v8; // eax@21 | |
8760 int v9; // eax@22 | |
8761 int v10; // eax@23 | |
8762 int v11; // eax@37 | |
8763 int v12; // eax@44 | |
8764 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8765 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8766 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8767 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8768 int v17; // [sp+5Ch] [bp-10h]@6 |
8769 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8770 int v19; // [sp+64h] [bp-8h]@8 | |
8771 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8772 | |
8773 v1 = this; | |
8774 v2 = 0; | |
8775 v18 = v1; | |
8776 v20 = 0; | |
8777 if ( (signed int)uNumActors > 0 ) | |
8778 { | |
90 | 8779 //v3 = pActors;//[0].pActorBuffs; |
8780 v16 = pActors;//[0].pActorBuffs; | |
8781 v3 = v16->pActorBuffs; | |
0 | 8782 do |
8783 { | |
90 | 8784 v4 = v16; |
8785 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8786 v17 = v2; |
8787 else | |
8788 v17 = 1; | |
8789 v19 = v2; | |
8790 do | |
8791 { | |
8792 if ( v19 != 10 ) | |
8793 { | |
8794 v3->_4585CA(pParty->uTimePlayed); | |
8795 v2 = 0; | |
8796 } | |
8797 ++v19; | |
8798 ++v3; | |
8799 } | |
8800 while ( v19 < 22 ); | |
8801 if ( v17 != v2 | |
8802 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8803 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8804 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8805 if ( !(v4->uAttributes & 0x80) ) | |
8806 { | |
8807 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8808 { | |
8809 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8810 { | |
8811 v5 = v4->uCurrentActionLength; | |
8812 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8813 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8814 { | |
417 | 8815 v17 = ai_near_actors_targets_pid[v20]; |
8816 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 8817 v7 = v4->uAIState; |
8818 memcpy(&v15, v6, sizeof(v15)); | |
8819 v8 = v7 - 4; | |
8820 memcpy(&v14, &v15, sizeof(v14)); | |
8821 if ( v8 ) | |
8822 { | |
8823 v9 = v8 - 1; | |
8824 if ( v9 ) | |
8825 { | |
8826 v10 = v9 - 6; | |
8827 if ( v10 ) | |
8828 { | |
8829 if ( v10 != 8 ) | |
414 | 8830 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8831 } |
8832 } | |
8833 } | |
8834 else | |
8835 { | |
8836 v4->uCurrentActionTime = 0; | |
8837 v4->uCurrentActionLength = 0; | |
8838 v4->uAIState = Dead; | |
8839 v4->UpdateAnimation(); | |
8840 } | |
8841 v1 = v18; | |
8842 v2 = 0; | |
8843 } | |
8844 } | |
8845 } | |
8846 } | |
8847 ++v20; | |
90 | 8848 v3 = v16[1].pActorBuffs; |
8849 ++v16; | |
0 | 8850 } |
8851 while ( (signed int)v20 < (signed int)uNumActors ); | |
8852 } | |
8853 if ( v1->field_4 == 1 ) | |
8854 { | |
8855 v12 = v1->field_8; | |
8856 if ( v12 == 64 ) | |
8857 { | |
8858 v1->_406A63(); | |
8859 } | |
8860 else | |
8861 { | |
8862 if ( v12 > v2 ) | |
8863 { | |
8864 v1->_406B9F(); | |
8865 } | |
8866 else | |
8867 { | |
8868 v1->_406AFE(); | |
8869 v1->field_10 = 100; | |
8870 } | |
8871 } | |
8872 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8873 return; | |
8874 } | |
8875 if ( v1->field_4 == 2 ) | |
8876 { | |
8877 if ( !(v1->field_18 & 1) ) | |
8878 { | |
8879 v11 = v1->field_10; | |
8880 if ( v11 == 100 ) | |
8881 { | |
8882 v1->StartTurn(); | |
8883 LABEL_39: | |
8884 v1->_40652A(); | |
8885 return; | |
8886 } | |
8887 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8888 { | |
8889 v1->_4065B0(); | |
8890 goto LABEL_39; | |
8891 } | |
8892 } | |
8893 v1->NextTurn(); | |
8894 return; | |
8895 } | |
8896 if ( v1->field_4 == 3 ) | |
8897 { | |
8898 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8899 { | |
8900 v1->field_18 &= 0xFFFFFFF7u; | |
8901 v1->field_4 = 1; | |
8902 v1->field_8 = 64; | |
8903 } | |
8904 else | |
8905 { | |
8906 v1->_406FA8(); | |
8907 } | |
8908 } | |
8909 } | |
8910 | |
8911 | |
8912 | |
8913 | |
8914 //----- (0043FDED) -------------------------------------------------------- | |
8915 void PrepareActorRenderList_BLV() | |
8916 { | |
8917 RenderBillboard *v0; // esi@0 | |
8918 unsigned __int16 v3; // ax@3 | |
8919 unsigned int v4; // eax@5 | |
8920 unsigned __int16 v5; // cx@5 | |
8921 int v6; // esi@5 | |
8922 unsigned int v7; // eax@7 | |
8923 int v8; // eax@10 | |
8924 SpriteFrame *v9; // eax@16 | |
8925 SpriteFrame *v10; // ebx@18 | |
8926 //int *v11; // eax@18 | |
8927 int v12; // ecx@28 | |
8928 //IndoorCameraD3D **v14; // eax@36 | |
8929 double v15; // st7@36 | |
8930 float v16; // eax@36 | |
8931 //double v17; // ST30_8@36 | |
8932 signed __int64 v18; // qtt@36 | |
8933 int v19; // ST5C_4@36 | |
8934 signed __int64 v20; // qtt@37 | |
8935 int v21; // ST5C_4@37 | |
8936 signed __int16 v22; // cx@39 | |
8937 int v23; // ST50_4@40 | |
8938 signed int v24; // ecx@40 | |
8939 int v25; // edx@44 | |
8940 __int16 v26; // ax@44 | |
8941 //MonsterDesc *v27; // edx@44 | |
8942 //int v28; // ecx@44 | |
8943 unsigned __int8 v29; // zf@44 | |
8944 unsigned __int8 v30; // sf@44 | |
8945 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8946 int v32; // [sp+1Ch] [bp-38h]@5 | |
8947 int a3; // [sp+20h] [bp-34h]@5 | |
8948 int a2; // [sp+24h] [bp-30h]@5 | |
8949 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8950 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8951 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8952 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8953 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8954 int a6; // [sp+40h] [bp-14h]@34 | |
8955 int v43; // [sp+44h] [bp-10h]@34 | |
8956 int z; // [sp+48h] [bp-Ch]@32 | |
8957 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8958 int x; // [sp+50h] [bp-4h]@32 | |
8959 | |
8960 for (uint i = 0; i < uNumActors; ++i) | |
8961 { | |
8962 auto p = pActors + i; | |
8963 | |
8964 if (p->uAIState == Removed || | |
8965 p->uAIState == Disabled) | |
8966 continue; | |
8967 | |
8968 a5 = p->uSectorID; | |
8969 a2 = p->vPosition.y; | |
8970 a1a = p->vPosition.x; | |
8971 a3 = p->vPosition.z; | |
8972 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8973 LOWORD(v0) = p->uYawAngle; | |
8974 v5 = p->uCurrentActionAnimation; | |
8975 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8976 v32 = v6; | |
8977 if ( pParty->bTurnBasedModeOn ) | |
8978 { | |
8979 if ( v5 == 1 ) | |
8980 { | |
8981 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8982 goto LABEL_10; | |
8983 } | |
8984 } | |
8985 else | |
8986 { | |
8987 if ( v5 == 1 ) | |
8988 { | |
8989 v7 = pBLVRenderParams->field_0_timer_; | |
8990 LABEL_10: | |
8991 v8 = i * 32 + v7; | |
8992 goto LABEL_12; | |
8993 } | |
8994 } | |
8995 v8 = p->uCurrentActionTime; | |
8996 LABEL_12: | |
8997 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8998 v8 = 0; | |
8999 v31 = p->pSpriteIDs[v5]; | |
9000 if (p->uAIState == Resurrected) | |
9001 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
9002 else | |
9003 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
9004 v41 = 0; | |
9005 v10 = v9; | |
9006 //v11 = (int *)v9->uFlags; | |
9007 if (v9->uFlags & 2) | |
9008 v41 = 2; | |
9009 if (v9->uFlags & 0x40000) | |
9010 v41 |= 0x40u; | |
9011 if (v9->uFlags & 0x20000) | |
9012 LOBYTE(v41) = v41 | 0x80; | |
9013 v0 = (RenderBillboard *)(256 << v6); | |
9014 if ( (unsigned int)v0 & v9->uFlags) | |
9015 v41 |= 4u; | |
9016 if ( v10->uGlowRadius ) | |
9017 { | |
9018 //LOBYTE(v11) = byte_4E94D3; | |
9019 pMobileLightsStack->AddLight( | |
9020 a1a, | |
9021 a2, | |
9022 a3, | |
9023 a5, | |
9024 v10->uGlowRadius, | |
9025 0xFFu, | |
9026 0xFFu, | |
9027 0xFFu, | |
9028 byte_4E94D3); | |
9029 } | |
9030 v12 = 0; | |
9031 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
9032 continue; | |
9033 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
9034 { | |
9035 ++v12; | |
9036 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
9037 goto _continue; | |
9038 } | |
9039 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
9040 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
9041 continue; | |
9042 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
9043 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
9044 if (uNumBillboardsToDraw >= 500) | |
9045 break; | |
9046 ++uNumBillboardsToDraw; | |
9047 ++uNumSpritesDrawnThisFrame; | |
9048 p->uAttributes |= 8u; | |
9049 v29 = pRenderer->pRenderD3D == 0; | |
9050 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
9051 v0->uPalette = v10->uPaletteIndex; | |
9052 v0->uIndoorSectorID = a5; | |
9053 if ( v29 ) | |
9054 { | |
9055 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
9056 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
9057 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9058 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 9059 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
9060 } | |
9061 else | |
9062 { | |
9063 //v14 = &pGame->pIndoorCameraD3D; | |
9064 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
9065 v15 = pGame->pIndoorCameraD3D->fov_y; | |
9066 v16 = v0->fov_x; | |
9067 v0->fov_y = v15; | |
9068 //v17 = v16 + 6.7553994e15; | |
9069 LODWORD(v18) = 0; | |
9070 HIDWORD(v18) = floorf(v16 + 0.5f); | |
9071 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9072 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 9073 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
9074 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9075 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 9076 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
9077 { | |
9078 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
9079 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9080 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 9081 goto LABEL_43; |
9082 } | |
9083 } | |
9084 else | |
9085 { | |
9086 v22 = p->pActorBuffs[3].uPower; | |
9087 if ( v22 ) | |
9088 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9089 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 9090 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9091 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9092 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 9093 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9094 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 9095 goto LABEL_44; |
9096 } | |
9097 } | |
9098 LABEL_44: | |
9099 HIWORD(v25) = HIWORD(x); | |
430 | 9100 v0->world_x = a1a; |
9101 v0->world_y = a2; | |
9102 v0->world_z = a3; | |
0 | 9103 v0->uScreenSpaceX = v43; |
9104 v0->uScreenSpaceY = a6; | |
9105 LOWORD(v25) = 0; | |
9106 LOBYTE(v26) = v41; | |
194 | 9107 |
9108 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
9109 v0->actual_z = HIWORD(x); | |
9110 v0->object_pid = v8 * i | OBJECT_Actor; | |
9111 | |
0 | 9112 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
9113 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
9114 v0->field_1E = v41; | |
9115 v0->pSpriteFrame = v10; | |
9116 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9117 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9118 { | |
9119 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9120 v0->field_1E = v26; | |
9121 } | |
9122 | |
9123 _continue: | |
9124 ; | |
9125 } | |
9126 } | |
9127 | |
9128 | |
9129 | |
9130 | |
9131 //----- (00444732) -------------------------------------------------------- | |
428 | 9132 char *GetEventHintString(unsigned int uEventID) |
9133 { | |
9134 signed int event_index; // edx@1 | |
9135 int event_pos; // esi@4 | |
0 | 9136 char *result; // eax@6 |
428 | 9137 unsigned int str_index; // eax@9 |
9138 int i; // esi@11 | |
9139 _evt_raw* test_evt; | |
9140 _evt_raw* last_evt; | |
9141 | |
9142 event_index = 0; | |
9143 if ( uLevelEVT_NumEvents <= 0 ) | |
9144 return NULL; | |
9145 | |
9146 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9147 while ( 1 ) |
9148 { | |
428 | 9149 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9150 { | |
9151 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9152 last_evt=test_evt; | |
9153 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9154 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9155 break; |
9156 } | |
428 | 9157 ++event_index; |
9158 if ( event_index >= uLevelEVT_NumEvents ) | |
9159 return NULL; | |
9160 } | |
9161 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9162 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9163 { | |
9164 str_index = EVT_DWORD(test_evt->v5); | |
9165 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9166 } |
9167 else | |
9168 { | |
428 | 9169 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9170 { | |
9171 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9172 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9173 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9174 { | |
9175 str_index = EVT_DWORD(test_evt->v5); | |
9176 if ( str_index < 600 ) | |
9177 return (char *)p2DEvents[str_index - 1].pName; | |
9178 } | |
9179 } | |
9180 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9181 } | |
9182 | |
0 | 9183 return result; |
9184 } | |
9185 | |
9186 | |
9187 | |
9188 | |
9189 //----- (00444839) -------------------------------------------------------- | |
9190 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) | |
9191 { | |
9192 unsigned int v9; // ebx@1 | |
9193 int v10; // edi@1 | |
373 | 9194 //signed int v11; // eax@1 |
0 | 9195 unsigned int v12; // eax@6 |
9196 const char *v13; // ST0C_4@6 | |
9197 unsigned int v14; // eax@8 | |
9198 const char *v15; // eax@14 | |
9199 unsigned int v16; // eax@16 | |
9200 unsigned int result; // eax@26 | |
9201 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9202 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9203 char *v20; // [sp-4h] [bp-3Ch]@9 |
9204 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9205 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9206 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9207 | |
9208 v9 = a1; | |
9209 v10 = a2; | |
9210 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9211 dword_59117C_teleportx = x; | |
9212 dword_591178_teleporty = y; | |
9213 dword_591174_teleportz = z; | |
9214 dword_591170_teleport_directiony = directiony; | |
9215 dword_59116C_teleport_directionx = directionx; | |
9216 dword_591168_teleport_speedz = a8; | |
9217 dword_591164_teleport_map_name = (char *)pLocationName; | |
9218 uCurrentHouse_Animation = v9; | |
9219 pEventTimer->Pause(); | |
9220 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9221 |
9222 switch (pParty->alignment) | |
9223 { | |
9224 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9225 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9226 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9227 default: assert(false); | |
9228 } | |
9229 /*v11 = const_2(); | |
0 | 9230 sprintf(pContainer, "evt%02d", v11); |
9231 if ( pParty->uAlignment ) | |
9232 { | |
9233 if ( pParty->uAlignment != 2 ) | |
9234 goto LABEL_6; | |
9235 v19 = "-c"; | |
9236 } | |
9237 else | |
9238 { | |
9239 v19 = "-b"; | |
9240 } | |
373 | 9241 strcat(pContainer, v19);*/ |
9242 | |
9243 //LABEL_6: | |
0 | 9244 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9245 v13 = pHouse_ExitPictures[v10]; | |
9246 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9247 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9248 if ( v9 ) | |
9249 { | |
9250 if ( !v23 ) | |
9251 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 9252 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 9253 } |
9254 else | |
9255 { | |
9256 if ( !v23 ) | |
9257 { | |
9258 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9259 if ( v14 ) | |
9260 { | |
721 | 9261 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9262 goto LABEL_20; |
9263 } | |
9264 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9265 goto LABEL_19; | |
9266 } | |
9267 } | |
9268 v15 = pLocationName; | |
9269 if ( *pLocationName == 48 ) | |
9270 v15 = pCurrentMapName; | |
9271 v16 = pMapStats->GetMapInfo(v15); | |
9272 if ( v16 ) | |
9273 { | |
721 | 9274 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9275 goto LABEL_20; | |
0 | 9276 } |
9277 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9278 LABEL_19: | |
423 | 9279 strcpy(sHouseName, v21); |
0 | 9280 LABEL_20: |
710 | 9281 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9282 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9283 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9284 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9285 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9286 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9287 result = v23; |
9288 if ( v23 ) | |
9289 uCurrentHouse_Animation = v23; | |
9290 return result; | |
9291 } | |
9292 |