Mercurial > mm7
annotate mm7_4.cpp @ 822:c232f160e6f3
Named SpriteObject spell-related fields.
author | Nomad |
---|---|
date | Tue, 26 Mar 2013 17:56:24 +0200 |
parents | 9359c114f98c |
children | c1da83d8223f |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
198 | 3 #include <assert.h> |
0 | 4 |
341 | 5 #include "MM7.h" |
0 | 6 #include "MapInfo.h" |
7 #include "Game.h" | |
8 #include "GUIWindow.h" | |
9 #include "GUIButton.h" | |
10 #include "GUIFont.h" | |
11 #include "Party.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Outdoor.h" | |
14 #include "IndoorCamera.h" | |
15 #include "Overlays.h" | |
16 #include "Monsters.h" | |
17 #include "Arcomage.h" | |
18 #include "LOD.h" | |
19 #include "Actor.h" | |
20 #include "Allocator.h" | |
21 #include "Events.h" | |
22 #include "Viewport.h" | |
23 #include "FrameTableInc.h" | |
24 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
25 #include "SpriteObject.h" |
0 | 26 #include "ObjectList.h" |
27 #include "Chest.h" | |
28 #include "PaletteManager.h" | |
29 #include "DecorationList.h" | |
30 #include "SaveLoad.h" | |
31 #include "stru123.h" | |
32 #include "stru287.h" | |
33 #include "Time.h" | |
34 #include "IconFrameTable.h" | |
35 #include "GUIProgressBar.h" | |
36 #include "Bink_Smacker.h" | |
37 #include "TileFrameTable.h" | |
38 #include "PlayerFrameTable.h" | |
39 #include "Awards.h" | |
40 #include "Autonotes.h" | |
41 #include "stru160.h" | |
42 #include "stru279.h" | |
43 #include "TurnEngine.h" | |
44 #include "FactionTable.h" | |
45 #include "StorylineTextTable.h" | |
46 #include "Random.h" | |
47 #include "stru277.h" | |
48 #include "stru298.h" | |
49 #include "stru12.h" | |
50 #include "stru351.h" | |
51 #include "Events2D.h" | |
52 #include "stru159.h" | |
189 | 53 #include "texts.h" |
0 | 54 #include "Log.h" |
629 | 55 #include "UIHouses.h" |
0 | 56 #include "mm7_data.h" |
57 | |
58 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 59 void __cdecl check_event_triggers() |
0 | 60 { |
61 int v0; // eax@1 | |
62 LevelDecoration *v1; // esi@2 | |
63 signed int v2; // edi@2 | |
64 int v3; // ebx@2 | |
65 int v4; // eax@3 | |
66 int v5; // ebx@3 | |
67 unsigned int v6; // ecx@3 | |
68 unsigned int v7; // edx@6 | |
69 unsigned int v8; // edx@8 | |
112 | 70 Actor *v9; // edi@13 |
0 | 71 int v10; // ebx@14 |
72 int v11; // eax@14 | |
73 int v12; // ebx@14 | |
74 unsigned int v13; // ecx@14 | |
75 int v14; // edx@15 | |
76 unsigned int v15; // edx@17 | |
77 unsigned int v16; // edx@19 | |
78 char *v17; // edi@25 | |
79 int v18; // ebx@26 | |
80 int v19; // eax@26 | |
81 int v20; // ebx@26 | |
82 unsigned int v21; // ecx@26 | |
83 int v22; // edx@27 | |
84 unsigned int v23; // edx@29 | |
85 unsigned int v24; // edx@31 | |
86 int v25; // [sp+0h] [bp-24h]@3 | |
87 int v26; // [sp+0h] [bp-24h]@14 | |
88 int v27; // [sp+0h] [bp-24h]@26 | |
89 int v28; // [sp+4h] [bp-20h]@3 | |
90 int v29; // [sp+4h] [bp-20h]@14 | |
91 int v30; // [sp+4h] [bp-20h]@26 | |
92 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
93 int v32; // [sp+Ch] [bp-18h]@2 | |
94 int v33; // [sp+10h] [bp-14h]@2 | |
95 int i; // [sp+14h] [bp-10h]@1 | |
96 int v35; // [sp+18h] [bp-Ch]@2 | |
97 int v36; // [sp+1Ch] [bp-8h]@3 | |
98 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
99 signed int v38; // [sp+20h] [bp-4h]@24 | |
100 | |
101 v0 = 0; | |
102 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
103 { | |
104 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
105 v2 = v1->field_18; | |
106 v3 = v1->vPosition.y; | |
107 v33 = v1->vPosition.x; | |
108 v32 = v1->vPosition.y; | |
109 v35 = v1->vPosition.z; | |
110 v31 = v1->field_18; | |
111 if ( v1->field_2 & 1 ) | |
112 { | |
113 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
114 v25 = abs(v3 - pParty->vPosition.y); | |
115 v28 = abs(v35 - pParty->vPosition.z); | |
116 v4 = v36; | |
117 v5 = v25; | |
118 v6 = v28; | |
119 if ( v36 < v25 ) | |
120 { | |
121 v4 = v25; | |
122 v5 = v36; | |
123 } | |
124 if ( v4 < v28 ) | |
125 { | |
126 v7 = v4; | |
127 v4 = v28; | |
128 v6 = v7; | |
129 } | |
130 if ( v5 < (signed int)v6 ) | |
131 { | |
132 v8 = v6; | |
133 v6 = v5; | |
134 v5 = v8; | |
135 } | |
136 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
137 EventProcessor(v1->field_16_event_id, 8 * i | 5, 1); | |
138 } | |
139 if ( v1->field_2 & 2 ) | |
140 { | |
141 v37 = 0; | |
142 if ( (signed int)uNumActors > 0 ) | |
143 { | |
112 | 144 v9 = pActors;//[0].vPosition.y; |
0 | 145 do |
146 { | |
112 | 147 v10 = abs(v33 - v9->vPosition.x); |
148 v29 = abs(v32 - v9->vPosition.y); | |
149 v26 = abs(v35 - v9->vPosition.z); | |
0 | 150 v11 = v10; |
151 v12 = v29; | |
152 v13 = v26; | |
153 if ( v11 < v29 ) | |
154 { | |
155 v14 = v11; | |
156 v11 = v29; | |
157 v12 = v14; | |
158 } | |
159 if ( v11 < v26 ) | |
160 { | |
161 v15 = v11; | |
162 v11 = v26; | |
163 v13 = v15; | |
164 } | |
165 if ( v12 < (signed int)v13 ) | |
166 { | |
167 v16 = v13; | |
168 v13 = v12; | |
169 v12 = v16; | |
170 } | |
171 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
172 EventProcessor(v1->field_16_event_id, 0, 1); | |
173 ++v37; | |
112 | 174 ++v9; |
0 | 175 } |
176 while ( v37 < (signed int)uNumActors ); | |
177 } | |
178 } | |
179 if ( v1->field_2 & 4 ) | |
180 { | |
181 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
182 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
183 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
184 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 185 do |
186 { | |
187 v18 = abs(v33 - *((int *)v17 - 1)); | |
188 v30 = abs(v32 - *(int *)v17); | |
189 v27 = abs(v35 - *((int *)v17 + 1)); | |
190 v19 = v18; | |
191 v20 = v30; | |
192 v21 = v27; | |
193 if ( v19 < v30 ) | |
194 { | |
195 v22 = v19; | |
196 v19 = v30; | |
197 v20 = v22; | |
198 } | |
199 if ( v19 < v27 ) | |
200 { | |
201 v23 = v19; | |
202 v19 = v27; | |
203 v21 = v23; | |
204 } | |
205 if ( v20 < (signed int)v21 ) | |
206 { | |
207 v24 = v21; | |
208 v21 = v20; | |
209 v20 = v24; | |
210 } | |
211 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
212 EventProcessor(v1->field_16_event_id, 0, 1); | |
213 ++v38; | |
214 v17 += 112; | |
215 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
216 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 217 } |
218 } | |
219 v0 = i + 1; | |
220 } | |
221 } | |
222 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
223 | |
224 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 225 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 226 { |
227 int v13; // ecx@13 | |
228 signed int v14; // ebx@14 | |
229 int v15; // eax@16 | |
729 | 230 //int v16; // edx@19 |
792 | 231 //int v17; // ST18_4@19 |
232 //signed int v18; // edx@19 | |
233 //signed __int64 v19; // qtt@19 | |
0 | 234 int v21; // eax@27 |
792 | 235 //int v22; // ecx@29 |
0 | 236 signed int v28; // eax@45 |
237 int v29; // ebx@47 | |
238 int v30; // edx@49 | |
239 int v31; // ST10_4@49 | |
240 signed int v32; // edx@49 | |
241 signed __int64 v33; // qtt@49 | |
242 signed int v34; // eax@54 | |
243 signed int v35; // esi@56 | |
244 int result; // eax@57 | |
245 int v38; // edx@62 | |
792 | 246 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 247 bool v47; // [sp+24h] [bp-1Ch]@43 |
248 bool v48; // [sp+28h] [bp-18h]@10 | |
249 bool v49; // [sp+28h] [bp-18h]@41 | |
250 bool v50; // [sp+2Ch] [bp-14h]@12 | |
251 signed int v53; // [sp+30h] [bp-10h]@10 | |
252 signed int v54; // [sp+30h] [bp-10h]@41 | |
253 signed int v55; // [sp+34h] [bp-Ch]@1 | |
254 | |
730 | 255 //LOG_DECOMPILATION_WARNING(); |
256 | |
257 static int blv_floor_id[50]; // 00721200 | |
258 static int blv_floor_level[50]; // 007212C8 | |
259 | |
260 static __int16 word_721390_ys[104]; // idb | |
261 static __int16 word_721460_xs[104]; // idb | |
0 | 262 |
263 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 264 v55 = 0; |
0 | 265 for (uint i = 0; i < pSector->uNumFloors; ++i) |
266 { | |
267 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
268 if (pFloor->Clickable()) | |
269 continue; | |
270 | |
792 | 271 assert(pFloor->uNumVertices); |
0 | 272 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
273 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
274 { | |
275 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
276 { | |
730 | 277 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
278 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
279 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
280 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 281 } |
730 | 282 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
283 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
284 | |
792 | 285 v50 = word_721390_ys[0] >= y; |
0 | 286 v53 = 0; |
792 | 287 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
288 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 289 { |
290 if (v53 >= 2) | |
291 break; | |
292 | |
293 v48 = v50; | |
294 v50 = word_721390_ys[j + 1] >= y; | |
730 | 295 |
296 v13 = i; | |
792 | 297 if (v48 == v50) |
298 continue; | |
299 | |
300 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
301 v15 = v14 | word_721460_xs[j] < x; | |
302 | |
303 if (v15 == 3) | |
304 continue; | |
305 else if (!v15) | |
306 ++v53; | |
307 else | |
0 | 308 { |
792 | 309 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
310 auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); | |
311 | |
312 if (res + word_721460_xs[j] >= x) | |
729 | 313 ++v53; |
0 | 314 } |
792 | 315 } |
316 | |
317 | |
0 | 318 if ( v53 == 1 ) |
319 { | |
320 if ( v55 >= 50 ) | |
321 break; | |
723 | 322 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 323 { |
725 | 324 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 325 } |
326 else | |
327 { | |
792 | 328 v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 329 } |
792 | 330 blv_floor_level[v55] = v21; |
331 blv_floor_id[v55] = pSector->pFloors[i]; | |
332 v55++; | |
0 | 333 } |
792 | 334 } |
335 } | |
336 | |
337 | |
0 | 338 if ( pSector->field_0 & 8 ) |
339 { | |
340 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
341 { | |
342 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
343 if (portal->uPolygonType != POLYGON_Floor) | |
344 continue; | |
345 | |
723 | 346 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
347 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
348 { | |
0 | 349 for (uint j = 0; j < portal->uNumVertices; ++j) |
350 { | |
730 | 351 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
352 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
353 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
354 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
355 } | |
356 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
357 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 358 v54 = 0; |
730 | 359 v49 = word_721390_ys[0] >= y; |
435 | 360 if ( portal->uNumVertices > 0 ) |
0 | 361 { |
723 | 362 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) |
0 | 363 { |
364 if ( v54 >= 2 ) | |
365 break; | |
730 | 366 v47 = word_721390_ys[i + 1] >= y; |
0 | 367 if ( v49 != v47 ) |
368 { | |
730 | 369 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; |
370 v29 = v28 | word_721460_xs[i] < x; | |
0 | 371 if ( v29 != 3 ) |
372 { | |
723 | 373 if ( !v29 ) |
729 | 374 ++v54; |
375 else | |
376 { | |
730 | 377 //v30 = word_721390_ys[v27]; |
378 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
379 v32 = y - word_721390_ys[i]; | |
729 | 380 LODWORD(v33) = v32 << 16; |
381 HIDWORD(v33) = v32 >> 16; | |
730 | 382 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 | 383 ++v54; |
729 | 384 } |
0 | 385 } |
386 } | |
387 v49 = v47; | |
388 } | |
389 if ( v54 == 1 ) | |
390 { | |
391 if ( v55 >= 50 ) | |
392 break; | |
393 v34 = v55++; | |
725 | 394 blv_floor_level[v34] = -29000; |
730 | 395 blv_floor_id[v34] = pSector->pPortals[i]; |
0 | 396 } |
397 } | |
398 } | |
399 } | |
400 } | |
401 if ( v55 == 1 ) | |
402 { | |
730 | 403 *pFaceID = blv_floor_id[0]; |
725 | 404 return blv_floor_level[0]; |
0 | 405 } |
406 if ( !v55 ) | |
407 return -30000; | |
730 | 408 *pFaceID = blv_floor_id[0]; |
725 | 409 //result = blv_floor_level[0]; |
0 | 410 if ( v55 > 1 ) |
411 { | |
717 | 412 for ( v35 = 1; v35 < v55; ++v35 ) |
0 | 413 { |
725 | 414 if ( blv_floor_level[0] <= z + 5 ) |
415 { | |
416 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 417 continue; |
725 | 418 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 419 *pFaceID = blv_floor_id[v35]; |
717 | 420 continue; |
421 } | |
725 | 422 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
423 { | |
424 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 425 *pFaceID = blv_floor_id[v35]; |
717 | 426 } |
427 } | |
0 | 428 } |
725 | 429 return blv_floor_level[0]; |
0 | 430 } |
431 | |
432 //----- (0046D49E) -------------------------------------------------------- | |
791 | 433 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 434 { |
723 | 435 BSPModel *pBModel; // esi@4 |
436 ODMFace *pFace; // ecx@11 | |
0 | 437 int v14; // edx@20 |
438 signed int v18; // edx@26 | |
439 int v19; // eax@28 | |
440 int v20; // edx@30 | |
441 int v21; // ST1C_4@30 | |
442 signed int v22; // edx@30 | |
443 signed __int64 v23; // qtt@30 | |
444 int v24; // eax@36 | |
445 signed int v25; // ecx@38 | |
446 int result; // eax@42 | |
447 signed int v27; // ecx@43 | |
448 int v28; // edi@44 | |
449 signed int v29; // edx@44 | |
450 int v30; // esi@45 | |
451 int v31; // eax@45 | |
452 ODMFace *v32; // eax@57 | |
453 int v33; // ecx@59 | |
454 int v36; // [sp+14h] [bp-2Ch]@24 | |
455 int v38; // [sp+1Ch] [bp-24h]@2 | |
456 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 457 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
458 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 459 bool v43; // [sp+30h] [bp-10h]@22 |
460 bool v44; // [sp+34h] [bp-Ch]@24 | |
461 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
462 signed int v48; // [sp+58h] [bp+18h]@22 | |
463 signed int v49; // [sp+58h] [bp+18h]@43 | |
464 | |
465 v46 = 1; | |
466 dword_721160[0] = -1; | |
467 dword_721110[0] = -1; | |
791 | 468 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 469 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 470 { |
471 *a6 = 0; | |
725 | 472 return odm_floor_level[0]; |
723 | 473 } |
0 | 474 v38 = 0; |
723 | 475 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
476 { | |
477 pBModel = &pOutdoor->pBModels[v38]; | |
478 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
479 { | |
480 if ( (signed int)pBModel->uNumFaces > 0 ) | |
481 { | |
482 v39 = 0; | |
483 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
484 { | |
485 pFace = &pBModel->pFaces[v39]; | |
486 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
487 && !(pFace->uAttributes & 0x20000000) | |
488 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
489 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 490 { |
723 | 491 if ( pFace->uNumVertices ) |
0 | 492 { |
723 | 493 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 494 { |
723 | 495 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
496 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
497 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
498 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
499 } | |
500 } | |
501 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
502 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
503 v43 = word_720F70[0] >= Y; | |
504 v48 = 0; | |
505 if ( 2 * pFace->uNumVertices > 0 ) | |
506 { | |
507 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
508 { | |
509 if ( v48 >= 2 ) | |
510 break; | |
511 v36 = word_720F70[i + 1]; | |
512 v44 = word_720F70[i + 1] >= Y; | |
513 if ( v43 != v44 ) | |
0 | 514 { |
723 | 515 v18 = word_721040[i + 1] >= X ? 0 : 2; |
516 v19 = v18 | word_721040[i] < X; | |
517 if ( v19 != 3 ) | |
0 | 518 { |
723 | 519 if ( !v19 ) |
740 | 520 ++v48; |
521 else | |
0 | 522 { |
723 | 523 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
524 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
525 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
526 if ( v22 >= X) | |
527 ++v48; | |
0 | 528 } |
529 } | |
530 } | |
723 | 531 v43 = v44; |
532 } | |
533 if ( v48 == 1 ) | |
534 { | |
535 if ( v46 >= 20 ) | |
0 | 536 break; |
723 | 537 if ( pFace->uPolygonType == POLYGON_Floor ) |
538 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
539 else | |
725 | 540 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
541 + HIWORD(pFace->zCalc3); | |
723 | 542 v25 = v46++; |
725 | 543 odm_floor_level[v25] = v24; |
723 | 544 dword_721160[v25] = pBModelNum; |
545 dword_721110[v25] = pFaceNum; | |
0 | 546 } |
547 } | |
548 } | |
723 | 549 ++v39; |
550 } | |
551 } | |
552 } | |
0 | 553 ++v38; |
554 } | |
555 if ( v46 == 1 ) | |
556 { | |
557 *a6 = 0; | |
725 | 558 return odm_floor_level[0]; |
0 | 559 } |
560 v27 = 0; | |
561 if ( v46 <= 1 ) | |
562 *a6 = 0; | |
723 | 563 else |
564 { | |
725 | 565 //v29 = 1; |
723 | 566 for ( v49 = 1; v49 < v46; ++v49 ) |
567 { | |
725 | 568 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 569 { |
570 v27 = v49; | |
725 | 571 //++v29; |
723 | 572 break; |
573 } | |
725 | 574 if ( odm_floor_level[0] > Z + 5 ) |
575 { | |
576 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
577 { | |
578 //++v29; | |
723 | 579 break; |
580 } | |
581 v27 = v49; | |
725 | 582 //++v29; |
723 | 583 break; |
584 } | |
725 | 585 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 586 { |
587 v27 = v49; | |
725 | 588 //++v29; |
723 | 589 } |
590 } | |
591 if ( !v27 ) | |
592 *a6 = 0; | |
593 else | |
594 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
595 } | |
0 | 596 if ( v27 ) |
597 { | |
598 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 599 *pIsOnWater = false; |
600 if ( v32->Fluid()) | |
601 *pIsOnWater = true; | |
0 | 602 } |
725 | 603 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
604 odm_floor_level[0] = odm_floor_level[v27]; | |
605 return odm_floor_level[0]; | |
0 | 606 } |
607 | |
608 //----- (0046D8E3) -------------------------------------------------------- | |
609 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
610 { | |
611 int v4; // ebx@1 | |
612 unsigned int v5; // ecx@1 | |
613 BSPModel *v6; // edi@3 | |
614 ODMFace *v7; // esi@10 | |
615 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
616 signed __int16 *v9; // eax@18 |
0 | 617 int v10; // edx@19 |
618 int v11; // ecx@21 | |
619 int v12; // ecx@23 | |
620 signed int v13; // eax@25 | |
621 int v14; // edx@27 | |
622 int v15; // edx@29 | |
623 int v16; // ST18_4@29 | |
624 signed int v17; // edx@29 | |
625 signed __int64 v18; // qtt@29 | |
626 int v19; // eax@35 | |
627 signed int v20; // ecx@37 | |
628 signed int v22; // ebx@42 | |
629 unsigned int v23; // esi@43 | |
630 int v24; // edx@44 | |
631 int v25; // eax@44 | |
632 int v26; // [sp+Ch] [bp-38h]@7 | |
633 int v27; // [sp+10h] [bp-34h]@21 | |
634 int v28; // [sp+18h] [bp-2Ch]@21 | |
635 int v29; // [sp+1Ch] [bp-28h]@2 | |
636 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
637 signed int v31; // [sp+24h] [bp-20h]@1 | |
638 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
639 int v33; // [sp+2Ch] [bp-18h]@7 | |
640 bool v34; // [sp+30h] [bp-14h]@21 | |
641 bool v35; // [sp+34h] [bp-10h]@23 | |
642 signed int v36; // [sp+38h] [bp-Ch]@17 | |
643 signed int v37; // [sp+38h] [bp-Ch]@21 | |
644 signed int v38; // [sp+38h] [bp-Ch]@42 | |
645 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
646 signed int v40; // [sp+40h] [bp-4h]@1 | |
647 | |
648 dword_720ED0[0] = -1; | |
649 dword_720E80[0] = -1; | |
650 v4 = a1; | |
651 v5 = 0; | |
652 v40 = a2; | |
653 v31 = v4; | |
654 v39 = 1; | |
655 dword_720F20[0] = 10000; | |
656 v32 = 0; | |
657 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
658 { | |
659 v29 = 0; | |
660 do | |
661 { | |
662 v6 = &pOutdoor->pBModels[v29]; | |
663 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
664 { | |
665 if ( v4 >= v6->sMinX ) | |
666 { | |
667 if ( v40 <= v6->sMaxY ) | |
668 { | |
669 if ( v40 >= v6->sMinY ) | |
670 { | |
671 v33 = v5; | |
672 v26 = v6->uNumFaces; | |
673 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
674 { | |
675 v30 = v5; | |
676 while ( 1 ) | |
677 { | |
678 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
679 v8 = v7->uPolygonType; | |
680 if ( (v8 == 5 || v8 == 6) | |
681 && !(BYTE3(v7->uAttributes) & 0x20) | |
682 && v4 <= v7->pBoundingBox.x2 | |
683 && v4 >= v7->pBoundingBox.x1 | |
684 && v40 <= v7->pBoundingBox.y2 | |
685 && v40 >= v7->pBoundingBox.y1 ) | |
686 { | |
687 v36 = v5; | |
688 if ( v7->uNumVertices ) | |
689 { | |
690 v9 = v7->pXInterceptDisplacements; | |
691 do | |
692 { | |
693 v10 = 2 * v36; | |
694 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
695 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
696 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
697 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
698 ++v9; | |
699 } | |
700 while ( v36 < v7->uNumVertices ); | |
701 v4 = v31; | |
702 } | |
703 v27 = 2 * v7->uNumVertices; | |
704 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
705 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
706 v11 = 0; | |
707 v34 = word_720CE0_ys[0] >= v40; | |
708 v37 = 0; | |
709 v28 = 0; | |
710 if ( v27 > 0 ) | |
711 { | |
712 do | |
713 { | |
714 if ( v37 >= 2 ) | |
715 break; | |
716 v12 = v11; | |
717 v4 = v31; | |
718 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
719 if ( v34 != v35 ) | |
720 { | |
721 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
722 v14 = v13 | word_720DB0_xs[v12] < v31; | |
723 if ( v14 != 3 ) | |
724 { | |
725 if ( !v14 | |
726 || (v15 = word_720CE0_ys[v12], | |
727 v16 = word_720CE0_ys[v12 + 1] - v15, | |
728 v17 = v40 - v15, | |
729 LODWORD(v18) = v17 << 16, | |
730 HIDWORD(v18) = v17 >> 16, | |
731 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
732 - (signed int)word_720DB0_xs[v12]) | |
733 * v18 | |
734 / v16) >> 16) | |
735 + word_720DB0_xs[v12]) >= v31) ) | |
736 ++v37; | |
737 } | |
738 } | |
739 v11 = v28 + 1; | |
740 v34 = v35; | |
741 ++v28; | |
742 } | |
743 while ( v28 < v27 ); | |
744 if ( v37 == 1 ) | |
745 { | |
746 if ( v39 >= 20 ) | |
747 break; | |
748 if ( v7->uPolygonType == 5 ) | |
749 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
750 else | |
751 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
752 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
753 + HIWORD(v7->zCalc3); | |
754 v20 = v39++; | |
755 dword_720F20[v20] = v19; | |
756 dword_720ED0[v20] = v32; | |
757 dword_720E80[v20] = v33; | |
758 } | |
759 } | |
760 } | |
761 ++v33; | |
762 v30 += 308; | |
763 if ( v33 >= v26 ) | |
764 break; | |
765 v5 = 0; | |
766 } | |
767 } | |
768 } | |
769 } | |
770 } | |
771 } | |
772 ++v32; | |
773 ++v29; | |
774 v5 = 0; | |
775 } | |
776 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
777 if ( !v39 ) | |
778 { | |
779 *(int *)a4 = 0; | |
780 return dword_720F20[0]; | |
781 } | |
782 } | |
783 v22 = 0; | |
784 v38 = v5; | |
785 if ( v39 <= (signed int)v5 ) | |
786 goto LABEL_54; | |
787 v23 = 0; | |
788 do | |
789 { | |
790 v24 = dword_720F20[v5 / 4]; | |
791 v25 = *(int *)((char *)dword_720F20 + v23); | |
792 if ( v24 == v25 ) | |
793 goto LABEL_50; | |
794 if ( v25 > a3 + 15 ) | |
795 { | |
796 if ( v24 >= v25 ) | |
797 goto LABEL_51; | |
798 LABEL_50: | |
799 v22 = v38; | |
800 v23 = v5; | |
801 goto LABEL_51; | |
802 } | |
803 if ( v24 > v25 && v24 <= a3 + 15 ) | |
804 goto LABEL_50; | |
805 LABEL_51: | |
806 ++v38; | |
807 v5 += 4; | |
808 } | |
809 while ( v38 < v39 ); | |
810 if ( v22 ) | |
811 { | |
812 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
813 return dword_720F20[v22]; | |
814 } | |
815 LABEL_54: | |
816 *(int *)a4 = 0; | |
817 return dword_720F20[v22]; | |
818 } | |
819 | |
138 | 820 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
821 // for a right-handed system, that would be an inverse normal | |
0 | 822 //----- (0046DCC8) -------------------------------------------------------- |
138 | 823 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
824 { | |
825 auto grid_x = WorldPosToGridCellX(pos_x); | |
826 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
827 | |
828 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
829 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
830 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
831 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
832 | |
833 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
834 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
835 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
836 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
837 | |
838 float side1_dx, side1_dy, side1_dz, | |
839 side2_dx, side2_dy, side2_dz; | |
840 | |
841 auto dx = abs(pos_x - grid_pos_x1), | |
842 dz = abs(grid_pos_z1 - pos_z); | |
843 if (dz >= dx) | |
844 { | |
845 side1_dy = (double)(x1z1_y - x1z2_y); | |
846 side2_dy = (double)(x2z2_y - x1z2_y); | |
847 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
848 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
849 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
850 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 851 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 852 /* |\ |
853 side1 | \ | |
854 |____\ | |
855 side 2 */ | |
856 } | |
857 else | |
858 { | |
859 side1_dy = (double)(x2z2_y - x2z1_y); | |
860 side2_dy = (double)(x1z1_y - x2z1_y); | |
861 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
862 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
863 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
864 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
865 | |
866 /* side 2 | |
867 _____ | |
868 \ | | |
869 \ | side 1 | |
870 \| */ | |
871 } | |
872 | |
873 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
874 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
875 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
876 | |
877 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
878 if (fabsf(mag) < 1e-6f) | |
879 { | |
880 out->y = 0; | |
881 out->x = 0; | |
882 out->z = 65536; | |
883 } | |
884 else | |
885 { | |
886 float invmag = 1.0 / mag; | |
887 out->x = invmag * nx * 65536.0; | |
888 out->y = invmag * ny * 65536.0; | |
889 out->z = invmag * nz * 65536.0; | |
890 } | |
891 } | |
892 | |
0 | 893 //----- (0046DEF2) -------------------------------------------------------- |
894 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
895 { | |
896 unsigned int result; // eax@1 | |
897 | |
898 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
899 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 900 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
901 return result; | |
902 } | |
903 | |
904 //----- (0046DF1A) -------------------------------------------------------- | |
905 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
906 { | |
907 Actor *v2; // edi@1 | |
908 unsigned __int16 v3; // ax@1 | |
909 int v4; // esi@6 | |
910 int v5; // ecx@8 | |
911 int v6; // eax@10 | |
912 int v7; // edx@12 | |
913 int v8; // ecx@14 | |
914 int v9; // eax@14 | |
915 int v10; // ebx@14 | |
916 int v11; // esi@14 | |
917 int v12; // ebx@15 | |
918 int v13; // ebx@17 | |
919 unsigned int v14; // eax@20 | |
920 signed int result; // eax@21 | |
921 int v16; // [sp+Ch] [bp-10h]@1 | |
922 int v17; // [sp+10h] [bp-Ch]@14 | |
923 int v18; // [sp+14h] [bp-8h]@14 | |
924 int v19; // [sp+18h] [bp-4h]@14 | |
925 | |
926 v16 = a1; | |
927 v2 = &pActors[a1]; | |
928 v3 = v2->uAIState; | |
929 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
930 goto LABEL_25; | |
931 v4 = v2->uActorRadius; | |
932 if ( a2 ) | |
933 v4 = a2; | |
934 v5 = v2->vPosition.x; | |
935 if ( stru_721530.sMaxX > v5 + v4 | |
936 || stru_721530.sMinX < v5 - v4 | |
937 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
938 || stru_721530.sMinY < v6 - v4 | |
939 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
940 || stru_721530.sMinZ < v7 | |
941 || (v8 = v5 - stru_721530.normal.x, | |
942 v9 = v6 - stru_721530.normal.y, | |
943 v10 = stru_721530.prolly_normal_d + v4, | |
944 v17 = stru_721530.prolly_normal_d + v4, | |
945 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
946 v18 = v8, | |
947 v19 = v9, | |
948 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
949 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
950 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
951 { | |
952 LABEL_25: | |
953 result = 0; | |
954 } | |
955 else | |
956 { | |
295 | 957 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 958 if ( v13 < 0 ) |
959 v13 = 0; | |
960 if ( v13 < stru_721530.field_7C ) | |
961 { | |
962 stru_721530.field_7C = v13; | |
963 v14 = 8 * v16; | |
964 LOBYTE(v14) = 8 * v16 | 3; | |
965 stru_721530.uFaceID = v14; | |
966 } | |
967 result = 1; | |
968 } | |
969 return result; | |
970 } | |
971 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
972 | |
973 //----- (0046E0B2) -------------------------------------------------------- | |
974 void __cdecl _46E0B2_collide_against_decorations() | |
975 { | |
976 BLVSector *v0; // ebp@1 | |
977 LevelDecoration *v1; // edi@2 | |
978 DecorationDesc *v2; // esi@3 | |
979 int v3; // edx@4 | |
980 int v4; // eax@4 | |
981 int v5; // ecx@6 | |
982 int v6; // ebx@8 | |
983 int v7; // esi@8 | |
984 int v8; // ebx@10 | |
985 int v9; // esi@11 | |
986 int v10; // edi@12 | |
987 int v11; // eax@12 | |
988 int v12; // esi@14 | |
989 unsigned int v13; // eax@17 | |
990 signed int i; // [sp+4h] [bp-14h]@1 | |
991 int v15; // [sp+8h] [bp-10h]@10 | |
992 int v16; // [sp+Ch] [bp-Ch]@10 | |
993 int v17; // [sp+10h] [bp-8h]@10 | |
994 int v18; // [sp+14h] [bp-4h]@8 | |
995 | |
996 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
997 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
998 { | |
999 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1000 if ( !(v1->field_2 & 0x20) ) | |
1001 { | |
1002 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1003 if (!v2->CanMoveThrough()) |
0 | 1004 { |
1005 v3 = v2->uRadius; | |
1006 v4 = v1->vPosition.x; | |
1007 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1008 { | |
1009 if ( stru_721530.sMinX >= v4 - v3 ) | |
1010 { | |
1011 v5 = v1->vPosition.y; | |
1012 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1013 { | |
1014 if ( stru_721530.sMinY >= v5 - v3 ) | |
1015 { | |
1016 v6 = v2->uDecorationHeight; | |
1017 v7 = v1->vPosition.z; | |
1018 v18 = v6; | |
1019 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1020 { | |
1021 if ( stru_721530.sMinZ >= v7 ) | |
1022 { | |
1023 v16 = v4 - stru_721530.normal.x; | |
1024 v15 = v5 - stru_721530.normal.y; | |
1025 v8 = stru_721530.prolly_normal_d + v3; | |
1026 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1027 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1028 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1029 { | |
1030 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1031 if ( v9 > 0 ) | |
1032 { | |
1033 v10 = v1->vPosition.z; | |
1034 v11 = stru_721530.normal.z | |
1035 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1036 if ( v11 >= v10 ) | |
1037 { | |
1038 if ( v11 <= v18 + v10 ) | |
1039 { | |
295 | 1040 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1041 if ( v12 < 0 ) |
1042 v12 = 0; | |
1043 if ( v12 < stru_721530.field_7C ) | |
1044 { | |
1045 stru_721530.field_7C = v12; | |
1046 v13 = 8 * v0->pDecorationIDs[i]; | |
1047 LOBYTE(v13) = v13 | 5; | |
1048 stru_721530.uFaceID = v13; | |
1049 } | |
1050 } | |
1051 } | |
1052 } | |
1053 } | |
1054 } | |
1055 } | |
1056 } | |
1057 } | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 | |
1065 //----- (0046E26D) -------------------------------------------------------- | |
1066 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1067 { | |
1068 int v2; // edx@5 | |
1069 unsigned __int16 *v3; // eax@5 | |
1070 unsigned __int16 v4; // ax@6 | |
1071 LevelDecoration *v5; // edi@7 | |
1072 DecorationDesc *v6; // esi@8 | |
1073 int v7; // edx@9 | |
1074 int v8; // eax@9 | |
1075 int v9; // ecx@11 | |
1076 int v10; // ebx@13 | |
1077 int v11; // esi@13 | |
1078 int v12; // ebp@15 | |
1079 int v13; // ebx@15 | |
1080 int v14; // esi@16 | |
1081 int v15; // edi@17 | |
1082 int v16; // eax@17 | |
1083 int v17; // esi@19 | |
1084 char v18; // zf@23 | |
1085 int v19; // [sp+0h] [bp-10h]@15 | |
1086 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1087 int v21; // [sp+8h] [bp-8h]@15 | |
1088 int v22; // [sp+Ch] [bp-4h]@13 | |
1089 | |
1090 if ( a1 >= 0 ) | |
1091 { | |
1092 if ( a1 <= 127 ) | |
1093 { | |
1094 if ( a2 >= 0 ) | |
1095 { | |
1096 if ( a2 <= 127 ) | |
1097 { | |
1098 v2 = a1 + (a2 << 7); | |
1099 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1100 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1101 if ( v3 ) | |
1102 { | |
1103 do | |
1104 { | |
1105 v4 = *v3; | |
141 | 1106 if ( (v4 & 7) == OBJECT_Decoration) |
0 | 1107 { |
1108 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1109 if ( !(v5->field_2 & 0x20) ) | |
1110 { | |
1111 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1112 if (!v6->CanMoveThrough()) |
0 | 1113 { |
1114 v7 = v6->uRadius; | |
1115 v8 = v5->vPosition.x; | |
1116 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1117 { | |
1118 if ( stru_721530.sMinX >= v8 - v7 ) | |
1119 { | |
1120 v9 = v5->vPosition.y; | |
1121 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1122 { | |
1123 if ( stru_721530.sMinY >= v9 - v7 ) | |
1124 { | |
1125 v10 = v6->uDecorationHeight; | |
1126 v11 = v5->vPosition.z; | |
1127 v22 = v10; | |
1128 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1129 { | |
1130 if ( stru_721530.sMinZ >= v11 ) | |
1131 { | |
1132 v12 = v8 - stru_721530.normal.x; | |
1133 v19 = v9 - stru_721530.normal.y; | |
1134 v13 = stru_721530.prolly_normal_d + v7; | |
1135 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1136 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1137 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1138 { | |
1139 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1140 if ( v14 > 0 ) | |
1141 { | |
1142 v15 = v5->vPosition.z; | |
1143 v16 = stru_721530.normal.z | |
1144 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1145 if ( v16 >= v15 ) | |
1146 { | |
1147 if ( v16 <= v22 + v15 ) | |
1148 { | |
295 | 1149 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1150 if ( v17 < 0 ) |
1151 v17 = 0; | |
1152 if ( v17 < stru_721530.field_7C ) | |
1153 { | |
1154 stru_721530.field_7C = v17; | |
1155 stru_721530.uFaceID = (signed __int16)*v20; | |
1156 } | |
1157 } | |
1158 } | |
1159 } | |
1160 } | |
1161 } | |
1162 } | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 v3 = v20 + 1; | |
1171 v18 = *v20 == 0; | |
1172 ++v20; | |
1173 } | |
1174 while ( !v18 ); | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 | |
1182 //----- (00486F92) -------------------------------------------------------- | |
1183 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1184 { | |
1185 Span *v0; // ebx@1 | |
1186 int v1; // eax@2 | |
1187 Edge *v2; // ecx@3 | |
1188 Edge *v3; // edx@3 | |
1189 Edge *v4; // esi@6 | |
1190 Edge *v5; // eax@7 | |
1191 Edge *v6; // ecx@8 | |
1192 Surf *v7; // esi@11 | |
1193 double v8; // st7@13 | |
1194 Surf *v9; // edi@13 | |
1195 double v10; // st6@13 | |
1196 double v11; // st7@14 | |
1197 signed __int64 v12; // qax@14 | |
1198 stru148 *v13; // eax@15 | |
1199 Span *v14; // ecx@17 | |
1200 double v15; // st7@28 | |
1201 signed __int64 v16; // qax@28 | |
1202 stru148 *v17; // eax@29 | |
1203 Span *v18; // ecx@31 | |
1204 Edge *i; // eax@40 | |
1205 Edge *v20; // ecx@43 | |
1206 Edge *v21; // esi@44 | |
1207 double v22; // st7@45 | |
1208 Edge *v23; // edx@48 | |
1209 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1210 float v25; // [sp+14h] [bp-Ch]@3 | |
1211 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1212 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1213 | |
1214 v0 = pSpans; | |
1215 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1216 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1217 stru_80C9A4.pSurf = &stru_80C980; |
1218 stru_80C980.pPrev = &stru_80C980; | |
1219 stru_80C980.pNext = &stru_80C980; | |
693 | 1220 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1221 stru_80C980.field_8 = 0.0; |
1222 stru_80C980.field_4 = 0.0; | |
1223 stru_80C9D8.pNext = &stru_80C9A4; | |
1224 stru_80C9D8.pPrev = 0; | |
1225 stru_80C9D8.field_8 = 1; | |
1226 stru_80C9A4.pNext = 0; | |
1227 stru_80C9A4.pPrev = &stru_80C9D8; | |
1228 stru_80C9A4.field_8 = 0; | |
1229 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1230 v27 = pViewport->uViewportTL_Y; |
1231 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1232 { |
1233 LABEL_51: | |
1234 v0->field_8 = -1; | |
1235 } | |
1236 else | |
1237 { | |
693 | 1238 v1 = 52 * pViewport->uViewportTL_Y; |
1239 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1240 while ( 1 ) |
1241 { | |
1242 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1243 v3 = &stru_80C9D8; | |
1244 v25 = (double)(signed int)v27; | |
1245 if ( v2 != &defaultEdge ) | |
1246 { | |
1247 do | |
1248 { | |
1249 while ( 1 ) | |
1250 { | |
1251 v4 = v3->pNext; | |
1252 if ( v2->field_0 <= (double)v4->field_0 ) | |
1253 break; | |
1254 v3 = v3->pNext; | |
1255 } | |
1256 v5 = v2->pNext; | |
1257 v2->pNext = v4; | |
1258 v2->pPrev = v3; | |
1259 v3->pNext->pPrev = v2; | |
1260 v3->pNext = v2; | |
1261 v3 = v2; | |
1262 v2 = v5; | |
1263 } | |
1264 while ( v5 != &defaultEdge ); | |
1265 } | |
1266 v6 = stru_80C9D8.pNext; | |
1267 stru_80C980.field_20 = 0; | |
1268 stru_80C980.field_22 = 1; | |
1269 v26 = stru_80C9D8.pNext; | |
1270 if ( stru_80C9D8.pNext ) | |
1271 { | |
1272 while ( 1 ) | |
1273 { | |
1274 v7 = v6->pSurf; | |
1275 if ( v6->field_8 ) | |
1276 { | |
1277 ++v7->field_22; | |
1278 if ( v7->field_22 == 1 ) | |
1279 { | |
1280 v8 = v6->field_0 + 2.0; | |
1281 v9 = stru_80C980.pNext; | |
1282 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1283 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1284 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1285 + stru_80C980.pNext->field_0 ) | |
1286 { | |
1287 do | |
1288 v9 = v9->pNext; | |
1289 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1290 v7->pNext = v9; | |
1291 v7->pPrev = v9->pPrev; | |
1292 v9->pPrev->pNext = v7; | |
1293 v9->pPrev = v7; | |
1294 } | |
1295 else | |
1296 { | |
1297 v11 = v6->field_0 + 0.5; | |
1298 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1299 v0->field_C = v12; | |
1300 if ( (signed __int16)v12 > 0 ) | |
1301 { | |
1302 v0->field_A = v27; | |
1303 v0->field_8 = v9->field_20; | |
1304 v13 = v9->pParent; | |
1305 v0->pParent = v13; | |
1306 if ( v13 ) | |
1307 { | |
1308 if ( v13->prolly_head ) | |
1309 { | |
1310 v14 = v13->prolly_tail; | |
1311 if ( !v14 ) | |
1312 return; | |
1313 v14->pNext = v0; | |
1314 } | |
1315 else | |
1316 { | |
1317 v13->prolly_head = v0; | |
1318 } | |
1319 v13->prolly_tail = v0; | |
1320 } | |
1321 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1322 return; | |
1323 ++v0; | |
1324 ++pOutdoorCamera->uNumSpans; | |
1325 } | |
1326 v6 = v26; | |
1327 v7->field_20 = (signed __int64)v11; | |
1328 v7->pNext = v9; | |
1329 v9->pPrev = v7; | |
1330 stru_80C980.pNext = v7; | |
1331 v7->pPrev = &stru_80C980; | |
1332 } | |
1333 } | |
1334 } | |
1335 else | |
1336 { | |
1337 --v7->field_22; | |
1338 if ( !v7->field_22 ) | |
1339 { | |
1340 if ( stru_80C980.pNext == v7 ) | |
1341 { | |
1342 v15 = v6->field_0 + 0.5; | |
1343 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1344 v0->field_C = v16; | |
1345 if ( (signed __int16)v16 > 0 ) | |
1346 { | |
1347 v0->field_A = v27; | |
1348 v0->field_8 = v7->field_20; | |
1349 v17 = v7->pParent; | |
1350 v0->pParent = v17; | |
1351 if ( v17 ) | |
1352 { | |
1353 if ( v17->prolly_head ) | |
1354 { | |
1355 v18 = v17->prolly_tail; | |
1356 if ( !v18 ) | |
1357 return; | |
1358 v18->pNext = v0; | |
1359 } | |
1360 else | |
1361 { | |
1362 v17->prolly_head = v0; | |
1363 } | |
1364 v17->prolly_tail = v0; | |
1365 } | |
1366 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1367 return; | |
1368 ++v0; | |
1369 ++pOutdoorCamera->uNumSpans; | |
1370 } | |
1371 v7->pNext->field_20 = (signed __int64)v15; | |
1372 v6 = v26; | |
1373 } | |
1374 v7->pNext->pPrev = v7->pPrev; | |
1375 v7->pPrev->pNext = v7->pNext; | |
1376 } | |
1377 } | |
1378 v26 = v6->pNext; | |
1379 if ( !v26 ) | |
1380 break; | |
1381 v6 = v6->pNext; | |
1382 } | |
1383 } | |
1384 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1385 { | |
1386 i->pPrev->pNext = i->pNext; | |
1387 i->pNext->pPrev = i->pPrev; | |
1388 } | |
1389 v20 = stru_80C9D8.pNext; | |
1390 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1391 break; | |
1392 LABEL_50: | |
1393 ++v27; | |
1394 v1 = v24 + 52; | |
1395 v24 += 52; | |
693 | 1396 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1397 goto LABEL_51; |
1398 } | |
1399 while ( 1 ) | |
1400 { | |
1401 v21 = v20->pNext; | |
1402 if ( !v21 ) | |
1403 break; | |
1404 v22 = v20->field_4 + v20->field_0; | |
1405 v20->field_0 = v22; | |
1406 if ( v22 < stru_80C9D8.field_0 ) | |
1407 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1408 while ( 1 ) | |
1409 { | |
1410 v23 = v20->pPrev; | |
1411 if ( v20->field_0 >= (double)v23->field_0 ) | |
1412 break; | |
1413 v23->pNext = v20->pNext; | |
1414 v20->pNext->pPrev = v23; | |
1415 v23->pPrev->pNext = v20; | |
1416 v20->pPrev = v23->pPrev; | |
1417 v20->pNext = v23; | |
1418 v23->pPrev = v20; | |
1419 } | |
1420 v20 = v21; | |
1421 if ( v21 == &stru_80C9A4 ) | |
1422 goto LABEL_50; | |
1423 } | |
1424 } | |
1425 } | |
1426 // 4EC3EC: using guessed type Edge defaultEdge; | |
1427 | |
1428 //----- (00487355) -------------------------------------------------------- | |
1429 bool OutdoorCamera::_487355() | |
1430 { | |
1431 int v0; // esi@1 | |
1432 stru148 *v1; // edi@2 | |
1433 bool result; // eax@3 | |
1434 | |
1435 v0 = 0; | |
1436 if ( pOutdoorCamera->numStru148s > 0 ) | |
1437 { | |
1438 v1 = array_77EC08; | |
1439 do | |
1440 { | |
1441 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1442 ++v0; | |
1443 ++v1; | |
1444 } | |
1445 while ( v0 < pOutdoorCamera->numStru148s ); | |
1446 } | |
1447 return result; | |
1448 } | |
1449 | |
1450 //----- (00487DA9) -------------------------------------------------------- | |
1451 void __cdecl sub_487DA9() | |
1452 { | |
1453 char *v0; // eax@1 | |
1454 | |
1455 v0 = &array_77EC08[0].field_108; | |
1456 do | |
1457 { | |
1458 *v0 = 0; | |
1459 v0 += 268; | |
1460 } | |
1461 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1462 } | |
1463 | |
1464 //----- (00487DBE) -------------------------------------------------------- | |
1465 void Software_ResetNewEdges() | |
1466 { | |
1467 int v0; // ecx@1 | |
1468 Edge **v1; // eax@1 | |
1469 signed int v2; // eax@3 | |
1470 | |
1471 v0 = 0; | |
1472 v1 = ptr_80CA10; | |
1473 do | |
1474 { | |
1475 ++v0; | |
1476 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1477 *v1 = 0; | |
1478 ++v1; | |
1479 } | |
1480 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1481 v2 = 2000; | |
1482 do | |
1483 { | |
1484 pSurfs->field_22 = 0; | |
1485 --v2; | |
1486 } | |
1487 while ( v2 ); | |
1488 } | |
1489 // 4EC3EC: using guessed type Edge defaultEdge; | |
1490 | |
1491 //----- (0048958E) -------------------------------------------------------- | |
1492 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1493 { | |
1494 stru12_MemoryBlock *v2; // esi@1 | |
1495 void *v3; // eax@1 | |
1496 void *v4; // ecx@1 | |
1497 stru12_MemoryBlock *result; // eax@1 | |
1498 | |
1499 v2 = this; | |
1500 v3 = operator new(8 * a2 + 16); | |
1501 v2->pBlockBase = v3; | |
1502 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
1503 result = v2; | |
1504 v2->pAlignedBlock = v4; | |
1505 } | |
1506 | |
1507 //----- (004895B7) -------------------------------------------------------- | |
1508 stru12::stru12(stru11 *pStru11) | |
1509 { | |
1510 stru12 *v2; // esi@1 | |
1511 | |
1512 v2 = this; | |
1513 this->field_44 = 0x41000000u; | |
1514 this->field_4C = 0x46000000u; | |
1515 //this->vdestructor_ptr = stru12::_4898E6; | |
1516 this->field_48 = 0; | |
1517 this->field_50 = 0; | |
1518 this->field_54 = 0x33D6BF95u; | |
1519 this->field_58 = 0; | |
1520 | |
1521 for (int i = 0; i < 12; ++i) | |
1522 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1523 /* | |
1524 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1525 if ( v3 ) | |
1526 v4 = AllocAlignedMem(v3, 640); | |
1527 else | |
1528 v4 = 0; | |
1529 v2->pMemBlocks[0] = v4; | |
1530 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1531 if ( v5 ) | |
1532 v6 = AllocAlignedMem(v5, 640); | |
1533 else | |
1534 v6 = 0; | |
1535 v2->pMemBlocks[1] = v6; | |
1536 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1537 if ( v7 ) | |
1538 v8 = AllocAlignedMem(v7, 640); | |
1539 else | |
1540 v8 = 0; | |
1541 v2->pMemBlocks[2] = v8; | |
1542 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1543 if ( v9 ) | |
1544 v10 = AllocAlignedMem(v9, 640); | |
1545 else | |
1546 v10 = 0; | |
1547 v2->pMemBlocks[3] = v10; | |
1548 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1549 if ( v11 ) | |
1550 v12 = AllocAlignedMem(v11, 640); | |
1551 else | |
1552 v12 = 0; | |
1553 v2->pMemBlocks[4] = v12; | |
1554 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1555 if ( v13 ) | |
1556 v14 = AllocAlignedMem(v13, 640); | |
1557 else | |
1558 v14 = 0; | |
1559 v2->pMemBlocks[5] = v14; | |
1560 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1561 if ( v15 ) | |
1562 v16 = AllocAlignedMem(v15, 640); | |
1563 else | |
1564 v16 = 0; | |
1565 v2->pMemBlocks[6] = v16; | |
1566 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1567 if ( v17 ) | |
1568 v18 = AllocAlignedMem(v17, 640); | |
1569 else | |
1570 v18 = 0; | |
1571 v2->pMemBlocks[7] = v18; | |
1572 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1573 if ( v19 ) | |
1574 v20 = AllocAlignedMem(v19, 640); | |
1575 else | |
1576 v20 = 0; | |
1577 v2->pMemBlocks[8] = v20; | |
1578 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1579 if ( v21 ) | |
1580 v22 = AllocAlignedMem(v21, 640); | |
1581 else | |
1582 v22 = 0; | |
1583 v2->pMemBlocks[9] = v22; | |
1584 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1585 if ( v23 ) | |
1586 v24 = AllocAlignedMem(v23, 640); | |
1587 else | |
1588 v24 = 0; | |
1589 v2->pMemBlocks[10] = v24; | |
1590 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1591 if ( v25 ) | |
1592 v26 = AllocAlignedMem(v25, 640); | |
1593 else | |
1594 v26 = 0; | |
1595 v2->field_8C = 0; | |
1596 v2->pMemBlocks[11] = v26;*/ | |
1597 } | |
1598 | |
1599 //----- (00489810) -------------------------------------------------------- | |
1600 stru12::~stru12() | |
1601 { | |
1602 for (int i = 0; i < 12; ++i) | |
1603 delete pMemBlocks[i]; | |
1604 /*if ( v2 ) | |
1605 stru12_MemoryBlock::dtor(v2, 1); | |
1606 v3 = v1->pMemBlocks[1]; | |
1607 if ( v3 ) | |
1608 stru12_MemoryBlock::dtor(v3, 1); | |
1609 v4 = v1->pMemBlocks[2]; | |
1610 if ( v4 ) | |
1611 stru12_MemoryBlock::dtor(v4, 1); | |
1612 v5 = v1->pMemBlocks[3]; | |
1613 if ( v5 ) | |
1614 stru12_MemoryBlock::dtor(v5, 1); | |
1615 v6 = v1->pMemBlocks[4]; | |
1616 if ( v6 ) | |
1617 stru12_MemoryBlock::dtor(v6, 1); | |
1618 v7 = v1->pMemBlocks[5]; | |
1619 if ( v7 ) | |
1620 stru12_MemoryBlock::dtor(v7, 1); | |
1621 v8 = v1->pMemBlocks[6]; | |
1622 if ( v8 ) | |
1623 stru12_MemoryBlock::dtor(v8, 1); | |
1624 v9 = v1->pMemBlocks[7]; | |
1625 if ( v9 ) | |
1626 stru12_MemoryBlock::dtor(v9, 1); | |
1627 v10 = v1->pMemBlocks[8]; | |
1628 if ( v10 ) | |
1629 stru12_MemoryBlock::dtor(v10, 1); | |
1630 v11 = v1->pMemBlocks[9]; | |
1631 if ( v11 ) | |
1632 stru12_MemoryBlock::dtor(v11, 1); | |
1633 v12 = v1->pMemBlocks[10]; | |
1634 if ( v12 ) | |
1635 stru12_MemoryBlock::dtor(v12, 1); | |
1636 v13 = v1->pMemBlocks[11]; | |
1637 if ( v13 ) | |
1638 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1639 } | |
1640 | |
1641 //----- (004898BF) -------------------------------------------------------- | |
1642 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1643 { | |
1644 stru12_MemoryBlock *v2; // esi@1 | |
1645 void *v3; // ST00_4@1 | |
1646 | |
1647 v2 = this; | |
1648 v3 = this->pBlockBase; | |
1649 this->pAlignedBlock = 0; | |
1650 free(v3); | |
1651 v2->pBlockBase = 0; | |
1652 /*if ( a2 & 1 ) | |
1653 free(v2);*/ | |
1654 } | |
1655 | |
1656 //----- (004898E6) -------------------------------------------------------- | |
1657 void stru12::_4898E6() | |
1658 { | |
1659 void *v1; // eax@1 | |
1660 void *v2; // edx@1 | |
1661 char *v3; // edi@2 | |
1662 double v4; // st7@2 | |
1663 char *v5; // ebx@2 | |
1664 double v6; // st6@3 | |
1665 double v7; // st5@3 | |
1666 double v8; // st4@3 | |
1667 int v9; // esi@3 | |
1668 double v10; // st3@3 | |
1669 float v11; // ST34_4@5 | |
1670 double v12; // st6@10 | |
1671 double v13; // ST0C_8@10 | |
1672 char *v14; // [sp+14h] [bp-44h]@2 | |
1673 char *v15; // [sp+18h] [bp-40h]@2 | |
1674 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1675 char *v17; // [sp+20h] [bp-38h]@2 | |
1676 char *v18; // [sp+24h] [bp-34h]@2 | |
1677 float v19; // [sp+30h] [bp-28h]@3 | |
1678 float v20; // [sp+38h] [bp-20h]@3 | |
1679 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1680 int v22; // [sp+40h] [bp-18h]@1 | |
1681 char *v23; // [sp+44h] [bp-14h]@2 | |
1682 char *v24; // [sp+48h] [bp-10h]@2 | |
1683 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1684 float v26; // [sp+50h] [bp-8h]@3 | |
1685 float v27; // [sp+54h] [bp-4h]@3 | |
1686 | |
731 | 1687 __debugbreak(); |
0 | 1688 v22 = 0; |
1689 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1690 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1691 if ( this->field_8C > 0 ) | |
1692 { | |
1693 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1694 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1695 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1696 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1697 v25 = (int)v1 - (int)v2; | |
1698 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1699 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1700 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1701 v4 = 1.0; | |
1702 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1703 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1704 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1705 do | |
1706 { | |
1707 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1708 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1709 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1710 v7 = pIndoorCamera->fRotationYCosine; | |
1711 v8 = pIndoorCamera->fRotationYSine; | |
1712 v20 = pIndoorCamera->fRotationXCosine; | |
1713 v19 = pIndoorCamera->fRotationXSine; | |
1714 v9 = (int)((char *)v2 + (int)v21); | |
1715 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1716 if ( pIndoorCamera->sRotationX ) | |
1717 { | |
1718 v11 = v10; | |
1719 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1720 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1721 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1722 } | |
1723 else | |
1724 { | |
1725 *(float *)v9 = v10; | |
1726 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1727 *(float *)((char *)v2 + (int)v5) = v6; | |
1728 } | |
1729 if ( *(float *)v9 >= 8.0 ) | |
1730 { | |
1731 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1732 { | |
1733 *(int *)v2 = 0; | |
1734 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1735 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1736 - v12 * *(float *)((char *)v2 + (int)v3); | |
1737 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1738 - v12 * *(float *)((char *)v2 + (int)v5); | |
1739 *(float *)((char *)v2 + (int)v16) = v4 | |
1740 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1741 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1742 v13 = *(float *)v9 + 6.7553994e15; | |
1743 v4 = 1.0; | |
1744 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1745 } | |
1746 else | |
1747 { | |
1748 *(int *)v2 = 2; | |
1749 } | |
1750 } | |
1751 else | |
1752 { | |
1753 *(int *)v2 = 1; | |
1754 } | |
1755 ++v22; | |
1756 v2 = (char *)v2 + 4; | |
1757 } | |
1758 while ( v22 < this->field_8C ); | |
1759 } | |
1760 this->field_8C = 0; | |
1761 } | |
1762 | |
1763 //----- (0048A959) -------------------------------------------------------- | |
1764 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1765 { | |
1766 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1767 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1768 b = (uColor & 0x000000FF) / 255.0f; | |
1769 | |
1770 float h, s, v; | |
1771 RGB2HSV(&h, &s, r, g, b, &v); | |
1772 | |
1773 if ( h_replace != -1.0 ) | |
1774 h = h_replace; | |
1775 if ( s_replace != -1.0 ) | |
1776 s = s_replace; | |
1777 if ( v_replace != -1.0 ) | |
1778 v = v_replace; | |
1779 HSV2RGB(&r, &g, &b, h, s, v); | |
1780 | |
1781 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1782 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1783 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1784 } | |
1785 | |
1786 //----- (0048B561) -------------------------------------------------------- | |
1787 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1788 { | |
1789 //v2 = a2 - 0.5; | |
1790 //v3 = v2 + 6.7553994e15; | |
1791 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1792 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1793 //v5 = v7 + 6.7553994e15; | |
1794 //return LODWORD(v5) | (v4 << 16); | |
1795 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1796 return v5 | (v4 << 16); | |
1797 } | |
1798 | |
1799 //----- (00491E3A) -------------------------------------------------------- | |
1800 void __cdecl sub_491E3A() | |
1801 { | |
1802 Player *v0; // ebx@1 | |
1803 signed int v1; // esi@3 | |
1804 char *v2; // eax@4 | |
1805 unsigned int v3; // eax@7 | |
1806 unsigned int v4; // edx@8 | |
1807 char *v5; // ecx@9 | |
1808 int v6; // edi@17 | |
1809 Texture *v7; // ebx@18 | |
1810 struct IDirect3DTexture2 **v8; // eax@19 | |
1811 struct IDirect3DTexture2 *v9; // eax@20 | |
1812 struct IDirectDrawSurface **v10; // eax@22 | |
1813 struct IDirectDrawSurface *v11; // eax@23 | |
1814 int v12; // eax@26 | |
1815 | |
1816 v0 = pParty->pPlayers; | |
1817 do | |
1818 { | |
203 | 1819 if (SoundSetAction[24][0]) |
0 | 1820 { |
1821 v1 = 0; | |
764 | 1822 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1823 { |
1824 LABEL_7: | |
1825 v3 = 0; | |
1826 } | |
1827 else | |
1828 { | |
1829 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1830 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1831 { |
1832 ++v1; | |
1833 v2 += 120; | |
764 | 1834 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1835 goto LABEL_7; |
1836 } | |
1837 v3 = v1; | |
1838 } | |
764 | 1839 pSoundList->UnloadSound(v3, 1); |
0 | 1840 v4 = 0; |
764 | 1841 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1842 { |
1843 LABEL_12: | |
1844 v4 = 0; | |
1845 } | |
1846 else | |
1847 { | |
1848 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1849 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1850 { |
1851 ++v4; | |
1852 v5 += 120; | |
764 | 1853 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1854 goto LABEL_12; |
1855 } | |
1856 } | |
764 | 1857 pSoundList->UnloadSound(v4, 1); |
0 | 1858 } |
1859 ++v0; | |
1860 } | |
1861 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1862 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1863 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1864 { |
1865 v7 = &pIcons_LOD->pTextures[v6]; | |
1866 do | |
1867 { | |
1868 v7->Release(); | |
1869 v8 = pIcons_LOD->pHardwareTextures; | |
1870 if ( v8 ) | |
1871 { | |
1872 v9 = v8[v6]; | |
1873 if ( v9 ) | |
1874 { | |
1875 v9->Release(); | |
1876 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1877 } | |
1878 } | |
1879 v10 = pIcons_LOD->pHardwareSurfaces; | |
1880 if ( v10 ) | |
1881 { | |
1882 v11 = v10[v6]; | |
1883 if ( v11 ) | |
1884 { | |
1885 v11->Release(); | |
1886 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1887 } | |
1888 } | |
1889 --v6; | |
1890 --v7; | |
1891 } | |
33 | 1892 while ( v6 >= pIcons_LOD->pFacesLock ); |
1893 } | |
1894 v12 = pIcons_LOD->pFacesLock; | |
1895 pIcons_LOD->pFacesLock = 0; | |
0 | 1896 pIcons_LOD->uNumLoadedFiles = v12; |
1897 } | |
1898 // 4ED498: using guessed type char byte_4ED498; | |
1899 | |
1900 //----- (0049387A) -------------------------------------------------------- | |
1901 int CycleCharacter(unsigned int _this) | |
1902 { | |
1903 signed int result; // eax@1 | |
1904 signed int v2; // ecx@2 | |
1905 signed int v3; // ecx@8 | |
1906 | |
1907 result = uActiveCharacter; | |
1908 if ( _this ) | |
1909 { | |
1910 v2 = 0; | |
1911 while ( 1 ) | |
1912 { | |
1913 --result; | |
1914 if ( result < 1 ) | |
1915 result = 4; | |
1916 if ( !pPlayers[result]->uTimeToRecovery ) | |
1917 break; | |
1918 ++v2; | |
1919 if ( v2 >= 4 ) | |
1920 return uActiveCharacter; | |
1921 } | |
1922 } | |
1923 else | |
1924 { | |
1925 v3 = 0; | |
1926 while ( 1 ) | |
1927 { | |
1928 ++result; | |
1929 if ( result > 4 ) | |
1930 result = 1; | |
1931 if ( !pPlayers[result]->uTimeToRecovery ) | |
1932 break; | |
1933 ++v3; | |
1934 if ( v3 >= 4 ) | |
1935 return uActiveCharacter; | |
1936 } | |
1937 } | |
1938 return result; | |
1939 } | |
1940 | |
1941 //----- (004938D1) -------------------------------------------------------- | |
1942 void __fastcall Rest(unsigned int uHoursToSleep) | |
1943 { | |
1944 unsigned int v1; // esi@1 | |
1945 double v2; // st7@3 | |
1946 Player **v3; // esi@3 | |
1947 | |
1948 v1 = uHoursToSleep; | |
1949 if ( uHoursToSleep > 240 ) | |
1950 InitializeActors(); | |
1951 v2 = (double)(7680 * v1) * 0.033333335; | |
1952 pParty->uTimePlayed += (signed __int64)v2; | |
1953 v3 = &pPlayers[1]; | |
1954 do | |
1955 { | |
1956 (*v3)->Recover((signed __int64)v2); | |
1957 ++v3; | |
1958 } | |
1959 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1960 _494035_timed_effects__water_walking_damage__etc(); | |
1961 } | |
1962 | |
1963 //----- (00493938) -------------------------------------------------------- | |
1964 int __cdecl _493938_regenerate() | |
1965 { | |
1966 int v0; // edi@1 | |
1967 signed __int64 v1; // qax@1 | |
1968 int v2; // ecx@1 | |
1969 int result; // eax@1 | |
1970 int v4; // eax@2 | |
1971 int v5; // edi@5 | |
112 | 1972 int *v6; // ecx@5 |
0 | 1973 char v7; // sf@5 |
112 | 1974 int *v8; // ecx@10 |
0 | 1975 int v9; // edi@15 |
1976 signed int v10; // eax@15 | |
1977 __int16 *v11; // edx@16 | |
1978 int v12; // eax@20 | |
1979 int v13; // ebx@20 | |
1980 unsigned int *v14; // esi@21 | |
1981 unsigned int v15; // ecx@21 | |
1982 unsigned int v16; // eax@21 | |
1983 int v17; // edx@21 | |
1984 int v18; // eax@21 | |
1985 signed int v19; // eax@21 | |
1986 signed int v20; // ebx@25 | |
1987 Player *v21; // esi@25 | |
1988 ITEM_EQUIP_TYPE v22; // edi@30 | |
1989 //int v23; // edx@31 | |
1990 signed int v24; // ecx@32 | |
1991 signed int v25; // eax@33 | |
1992 int v26; // eax@35 | |
1993 int v27; // eax@36 | |
1994 int v28; // eax@37 | |
1995 int v29; // eax@40 | |
1996 int v30; // eax@41 | |
1997 signed int v31; // ecx@53 | |
1998 char *v32; // eax@53 | |
1999 char *v33; // edi@82 | |
2000 int v34; // ecx@88 | |
2001 int v35; // eax@88 | |
2002 char *v36; // edi@99 | |
2003 int v37; // edi@104 | |
2004 int v38; // edi@106 | |
2005 int v39; // edi@111 | |
2006 int v40; // ecx@113 | |
2007 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
|
2008 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2009 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2010 int v44; // [sp+210h] [bp-20h]@22 | |
2011 int v45; // [sp+214h] [bp-1Ch]@25 | |
2012 int v46; // [sp+218h] [bp-18h]@25 | |
2013 int v47; // [sp+21Ch] [bp-14h]@25 | |
2014 int v48; // [sp+220h] [bp-10h]@25 | |
2015 int v49; // [sp+224h] [bp-Ch]@24 | |
2016 int v50; // [sp+228h] [bp-8h]@25 | |
2017 int v51; // [sp+22Ch] [bp-4h]@2 | |
2018 | |
2019 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2020 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2021 v2 = (signed int)v1 / 60; | |
2022 result = (signed int)v1 / 60 + 5; | |
2023 if ( v0 >= result ) | |
2024 { | |
2025 v51 = 0; | |
2026 v4 = (v0 - v2) / 5; | |
2027 if (pParty->FlyActive()) | |
2028 { | |
2029 if ( pParty->bFlying ) | |
2030 { | |
569 | 2031 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2032 { // colliding with something in the air - fall down | |
2033 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2034 //__debugbreak(); | |
2035 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2036 v7 = *v6 < v5; |
2037 *v6 -= v5; | |
0 | 2038 if ( v7 ) |
2039 { | |
112 | 2040 *v6 = 0; |
0 | 2041 pParty->uFlags &= 0xFFFFFFBFu; |
2042 pParty->bFlying = 0; | |
2043 v51 = 1; | |
2044 } | |
2045 } | |
2046 } | |
2047 } | |
569 | 2048 |
0 | 2049 if (pParty->WaterWalkActive()) |
2050 { | |
569 | 2051 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2052 { | |
2053 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2054 { // taking on water | |
2055 //__debugbreak(); | |
2056 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2057 v7 = *v8 < v4; |
2058 *v8 -= v4; | |
0 | 2059 if ( v7 ) |
2060 { | |
112 | 2061 *v8 = 0; |
569 | 2062 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2063 v51 = 1; |
2064 } | |
2065 } | |
2066 } | |
2067 } | |
569 | 2068 |
0 | 2069 if (pParty->ImmolationActive()) |
2070 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2071 //SpriteObject::SpriteObject(&a1); |
0 | 2072 v9 = 0; |
2073 a3.z = 0; | |
2074 a3.y = 0; | |
2075 a3.x = 0; | |
2076 a1.stru_24.Reset(); | |
822 | 2077 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2078 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2079 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2080 a1.uType = 1070; |
822 | 2081 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2082 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2083 { | |
2084 LABEL_19: | |
2085 LOWORD(v10) = 0; | |
2086 } | |
2087 else | |
2088 { | |
2089 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2090 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2091 { |
2092 ++v10; | |
2093 v11 += 28; | |
2094 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2095 goto LABEL_19; | |
2096 } | |
2097 } | |
2098 a1.uObjectDescID = v10; | |
2099 a1.field_60_distance_related_prolly_lod = 0; | |
2100 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2101 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2102 a1.uAttributes = 0; |
2103 a1.uSectorID = 0; | |
2104 a1.uSpriteFrameID = 0; | |
822 | 2105 a1.spell_caster_pid = v12; |
0 | 2106 a1.uFacing = 0; |
2107 a1.uSoundID = 0; | |
2108 v13 = sub_46A89E((int)v41, 100, 307); | |
2109 if ( v13 > 0 ) | |
2110 { | |
2111 do | |
2112 { | |
2113 v14 = (unsigned int *)&v41[4 * v9]; | |
2114 v15 = *v14; | |
2115 v16 = *v14; | |
2116 a1.vPosition.x = pActors[v16].vPosition.x; | |
2117 v17 = pActors[v16].vPosition.y; | |
2118 a1.vPosition.z = pActors[v16].vPosition.z; | |
2119 v18 = 8 * v15; | |
2120 LOBYTE(v18) = 8 * v15 | 3; | |
2121 a1.vPosition.y = v17; | |
2122 a1.field_5C = v18; | |
2123 v19 = a1.Create(0, 0, 0, 0); | |
2124 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
2125 ++v9; | |
2126 } | |
2127 while ( v9 < v13 ); | |
2128 } | |
2129 } | |
2130 v44 = 0; | |
248 | 2131 if (PartyHasDragon()) |
0 | 2132 v44 = 1; |
2133 v49 = 0; | |
2134 LABEL_25: | |
2135 v20 = 0; | |
2136 v21 = &pParty->pPlayers[v49]; | |
2137 v50 = 0; | |
2138 v47 = 0; | |
2139 v45 = 0; | |
2140 v48 = 0; | |
2141 v46 = 0; | |
255 | 2142 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2143 v50 = 1; |
135 | 2144 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2145 v48 = 1; |
2146 v22 = (ITEM_EQUIP_TYPE)0; | |
2147 while ( 1 ) | |
2148 { | |
2149 if ( v21->HasItemEquipped(v22) ) | |
2150 { | |
2151 //v23 = v21->pEquipment.pIndices; | |
2152 auto _idx = v21->pEquipment.pIndices[v22]; | |
2153 v24 = v21->pInventoryItems[_idx].uItemID; | |
2154 if ( v24 > 134 ) | |
2155 { | |
2156 if ( v24 == 529 ) | |
2157 goto LABEL_43; | |
2158 if ( v24 == 535 ) | |
2159 goto LABEL_44; | |
2160 if ( v24 == 515 ) | |
2161 { | |
2162 v47 = 1; | |
2163 } | |
2164 else | |
2165 { | |
2166 if ( v24 == 532 ) | |
2167 goto LABEL_50; | |
2168 } | |
2169 } | |
2170 else | |
2171 { | |
377 | 2172 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2173 if ( v25 <= 50 ) |
2174 { | |
2175 if ( v25 != 50 ) | |
2176 { | |
2177 v26 = v25 - 37; | |
2178 if ( v26 ) | |
2179 { | |
2180 v27 = v26 - 1; | |
2181 if ( !v27 ) | |
2182 goto LABEL_50; | |
2183 v28 = v27 - 6; | |
2184 if ( v28 ) | |
2185 { | |
2186 if ( v28 != 3 ) | |
2187 goto LABEL_51; | |
2188 LABEL_50: | |
2189 v50 = 1; | |
2190 goto LABEL_51; | |
2191 } | |
2192 } | |
2193 } | |
2194 LABEL_44: | |
2195 v20 = 1; | |
2196 goto LABEL_51; | |
2197 } | |
2198 v29 = v25 - 54; | |
2199 if ( !v29 ) | |
2200 goto LABEL_44; | |
2201 v30 = v29 - 1; | |
2202 if ( !v30 ) | |
2203 goto LABEL_50; | |
2204 if ( v30 == 11 ) | |
2205 { | |
2206 LABEL_43: | |
2207 v20 = 1; | |
2208 v50 = 1; | |
2209 goto LABEL_51; | |
2210 } | |
2211 } | |
2212 } | |
2213 LABEL_51: | |
2214 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2215 if ( (signed int)v22 >= 16 ) | |
2216 { | |
2217 if ( v48 ) | |
2218 { | |
2219 v31 = 0; | |
2220 v32 = (char *)v21->pInventoryItems; | |
2221 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2222 { | |
2223 ++v31; | |
2224 v32 += 36; | |
2225 if ( v31 >= 138 ) | |
2226 goto LABEL_59; | |
2227 } | |
2228 v48 = 0; | |
2229 v45 = 1; | |
2230 } | |
2231 LABEL_59: | |
2232 if ( v21->pConditions[17] ) | |
2233 v46 = 1; | |
2234 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2235 { | |
2236 ++v21->sHealth; | |
2237 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2238 v21->sHealth = v21->GetMaxHealth(); | |
2239 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2240 { | |
2241 LODWORD(v21->pConditions[13]) = 0; | |
2242 HIDWORD(v21->pConditions[13]) = 0; | |
2243 } | |
2244 v51 = 1; | |
2245 } | |
2246 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2247 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2248 && !v21->pConditions[14] | |
2249 && !v21->pConditions[16] ) | |
2250 { | |
2251 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2252 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2253 v21->sHealth = v21->GetMaxHealth(); | |
2254 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2255 { | |
2256 LODWORD(v21->pConditions[13]) = 0; | |
2257 HIDWORD(v21->pConditions[13]) = 0; | |
2258 } | |
2259 v51 = 1; | |
2260 } | |
2261 if ( v50 ) | |
2262 { | |
2263 v33 = (char *)&v21->sMana; | |
2264 ++*(int *)v33; | |
2265 if ( v21->sMana > v21->GetMaxMana() ) | |
2266 *(int *)v33 = v21->GetMaxMana(); | |
2267 v51 = 1; | |
2268 } | |
2269 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2270 { | |
2271 v34 = LODWORD(v21->pConditions[13]); | |
2272 --v21->sHealth; | |
2273 v35 = v21->sHealth; | |
2274 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2275 v21->pConditions[13] = pParty->uTimePlayed; | |
2276 if ( v35 < 1 ) | |
2277 { | |
2278 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2279 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2280 { | |
2281 v21->pConditions[13] = pParty->uTimePlayed; | |
2282 } | |
2283 else | |
2284 { | |
2285 if ( !v21->pConditions[14] ) | |
2286 v21->pConditions[14] = pParty->uTimePlayed; | |
2287 } | |
2288 } | |
2289 v51 = 1; | |
2290 } | |
2291 if ( v45 ) | |
2292 { | |
2293 v36 = (char *)&v21->sMana; | |
2294 ++*(int *)v36; | |
2295 if ( v21->sMana > v21->GetMaxMana() ) | |
2296 *(int *)v36 = v21->GetMaxMana(); | |
2297 } | |
2298 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2299 { | |
2300 v37 = v21->sHealth; | |
2301 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2302 v21->sHealth = v37 - 2; | |
2303 v38 = v21->sMana; | |
2304 if ( v38 > v21->GetMaxMana() / 2 ) | |
2305 v21->sMana = v38 - 2; | |
2306 } | |
2307 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2308 { | |
2309 v39 = v21->sHealth; | |
2310 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2311 v21->sHealth = v39 - 1; | |
2312 v40 = v21->sMana; | |
2313 if ( v40 > 0 ) | |
2314 v21->sMana = v40 - 1; | |
2315 } | |
2316 ++v49; | |
2317 if ( v49 >= 4 ) | |
2318 { | |
2319 result = HIDWORD(pParty->uTimePlayed); | |
2320 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2321 if ( !viewparams->bRedrawGameUI ) | |
2322 { | |
2323 result = v51; | |
2324 viewparams->bRedrawGameUI = v51; | |
2325 } | |
2326 return result; | |
2327 } | |
2328 goto LABEL_25; | |
2329 } | |
2330 } | |
2331 } | |
2332 return result; | |
2333 } | |
2334 | |
2335 //----- (00493F79) -------------------------------------------------------- | |
351 | 2336 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2337 { |
2338 signed __int64 v2; // ST2C_8@1 | |
2339 signed __int64 v3; // qax@1 | |
351 | 2340 //signed __int64 v4; // ST1C_8@1 |
0 | 2341 unsigned __int64 v5; // qax@1 |
2342 unsigned int v6; // ebx@1 | |
2343 | |
2344 v2 = (signed __int64)((double)a2 * 0.234375); | |
2345 v3 = v2 / 60 / 60; | |
351 | 2346 //v4 = v3; |
0 | 2347 v5 = (unsigned int)v3 / 0x18; |
2348 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2349 _this->field_0_expire_second = v2 % 60; |
2350 _this->field_4_expire_minute = v2 / 60 % 60; | |
2351 _this->field_8_expire_hour = v3 % 24; | |
2352 _this->field_10_expire_week = v5 / 7 & 3; | |
2353 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2354 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2355 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2356 } |
2357 | |
2358 //----- (00494035) -------------------------------------------------------- | |
2359 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2360 { | |
2361 signed __int64 v0; // qax@1 | |
2362 signed __int64 v1; // ST30_8@1 | |
2363 signed __int64 v2; // ST38_8@1 | |
2364 unsigned __int64 v3; // qax@1 | |
2365 unsigned int v4; // edi@1 | |
2366 //signed int v5; // eax@4 | |
2367 //char *v6; // ecx@5 | |
2368 //Player *v7; // esi@8 | |
2369 //char *v8; // ecx@12 | |
766 | 2370 //Player *pPlayer; // esi@15 |
0 | 2371 //void *v10; // esi@25 |
2372 unsigned int v11; // ecx@27 | |
2373 signed int v12; // edi@29 | |
2374 Player *v13; // ecx@30 | |
2375 Player *v14; // esi@35 | |
2376 double v15; // st7@35 | |
2377 Player **v16; // esi@43 | |
2378 Player *v17; // edi@44 | |
2379 double v18; // st7@44 | |
816 | 2380 //float v19; // ST28_4@48 |
2381 //double v20; // ST38_8@48 | |
0 | 2382 Player *v21; // esi@51 |
2383 signed int v22; // edi@53 | |
2384 int v23; // eax@59 | |
2385 int v24; // ecx@60 | |
2386 int v25; // eax@63 | |
2387 int v26; // ecx@64 | |
2388 int v27; // eax@67 | |
2389 int v28; // ecx@68 | |
2390 int v29; // eax@71 | |
2391 int v30; // ecx@72 | |
2392 int v31; // eax@75 | |
2393 int v32; // ecx@76 | |
2394 int v33; // eax@79 | |
2395 int v34; // ecx@80 | |
2396 int v35; // eax@83 | |
2397 int v36; // ecx@84 | |
2398 int v37; // eax@87 | |
2399 int v38; // ecx@88 | |
2400 int v39; // eax@91 | |
2401 int v40; // ecx@92 | |
2402 int v41; // eax@95 | |
2403 int v42; // ecx@96 | |
2404 bool v43; // ebx@102 | |
2405 //SpellBuff *v44; // edi@104 | |
2406 //signed int v45; // ebp@104 | |
2407 bool v46; // edi@111 | |
2408 //SpellBuff *v47; // esi@113 | |
2409 //Player **v48; // esi@119 | |
2410 //signed int v49; // edi@121 | |
2411 //char *v50; // esi@122 | |
2412 signed int v51; // edx@128 | |
2413 signed int v52; // ecx@130 | |
2414 int v53; // eax@131 | |
2415 Player *v54; // eax@141 | |
766 | 2416 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2417 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2418 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2419 int v58; // [sp-4h] [bp-34h]@33 |
2420 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2421 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2422 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2423 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2424 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2425 signed int a2a; // [sp+18h] [bp-18h]@47 |
2426 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2427 | |
766 | 2428 //a2 = pParty->uCurrentHour; |
0 | 2429 v61 = pParty->uDaysPlayed; |
816 | 2430 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2431 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2432 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2433 v1 = v0; |
2434 v0 /= 60i64; | |
2435 v2 = v0; | |
2436 v3 = (unsigned int)v0 / 24; | |
2437 v4 = (unsigned int)(v3 / 7) >> 2; | |
2438 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2439 pParty->uCurrentMinute = v1 % 60; | |
2440 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2441 pParty->uCurrentHour = v2 % 24; | |
2442 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2443 pParty->uCurrentMonth = v4 % 12; | |
352 | 2444 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2445 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2446 { |
2447 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2448 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2449 | |
2450 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2451 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2452 | |
766 | 2453 ++pParty->days_played_without_rest; |
2454 if (pParty->days_played_without_rest > 1) | |
0 | 2455 { |
2456 for (uint i = 0; i < 4; ++i) | |
766 | 2457 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2458 | |
2459 if (pParty->uNumFoodRations) | |
2460 Party::TakeFood(1); | |
0 | 2461 else |
2462 for (uint i = 0; i < 4; ++i) | |
766 | 2463 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2464 | |
2465 if (pParty->days_played_without_rest > 3) | |
2466 for (uint i = 0; i < 4; ++i) | |
0 | 2467 { |
766 | 2468 auto player = pParty->pPlayers + i; |
2469 | |
2470 player->Zero(); | |
2471 | |
2472 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2473 { |
767 | 2474 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2475 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2476 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2477 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2478 } |
2479 } | |
766 | 2480 } |
2481 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2482 pOutdoor->SetFog(); |
2483 | |
2484 for (uint i = 0; i < 4; ++i) | |
2485 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2486 } | |
766 | 2487 |
0 | 2488 v11 = LODWORD(pParty->uTimePlayed); |
2489 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2490 { | |
2491 v12 = 1; | |
2492 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2493 viewparams->bRedrawGameUI = 1; | |
2494 while ( 1 ) | |
2495 { | |
2496 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2497 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2498 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2499 { |
2500 v58 = 0; | |
2501 } | |
2502 else | |
2503 { | |
2504 v58 = 0; | |
2505 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2506 { | |
2507 v14 = pPlayers[v12]; | |
2508 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2509 v14->ReceiveDamage((signed __int64)v15, 0); | |
2510 if ( pParty->uFlags & 4 ) | |
2511 { | |
783 | 2512 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2513 GameUI_Footer_TimeLeft = 128; | |
0 | 2514 } |
2515 goto LABEL_39; | |
2516 } | |
2517 v13 = pPlayers[v12]; | |
2518 } | |
130 | 2519 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2520 LABEL_39: |
2521 ++v12; | |
2522 if ( v12 > 4 ) | |
2523 { | |
2524 v11 = LODWORD(pParty->uTimePlayed); | |
2525 break; | |
2526 } | |
2527 } | |
2528 } | |
2529 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2530 { | |
2531 viewparams->bRedrawGameUI = 1; | |
2532 pParty->field_6FC = v11 + 128; | |
2533 v16 = &pPlayers[1]; | |
2534 do | |
2535 { | |
2536 v17 = *v16; | |
2537 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2538 v17->ReceiveDamage((signed __int64)v18, 0); | |
2539 if ( pParty->uFlags & 0x200 ) | |
2540 { | |
783 | 2541 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2542 GameUI_Footer_TimeLeft = 128; | |
0 | 2543 } |
2544 ++v16; | |
2545 } | |
2546 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2547 } | |
2548 _493938_regenerate(); | |
2549 v65 = 4; | |
816 | 2550 a2a = pEventTimer->uTimeElapsed; |
2551 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2552 { | |
2553 //v19 = (double)(signed int)prev_time * 0.5; | |
2554 //v20 = v19 + 6.7553994e15; | |
2555 a2a *= 0.5f; | |
2556 if (a2a < 1) | |
0 | 2557 a2a = 1; |
2558 } | |
2559 v62 = &pPlayers[1]; | |
2560 do | |
2561 { | |
2562 v21 = *v62; | |
2563 if ( (*v62)->uTimeToRecovery ) | |
2564 v21->Recover(a2a); | |
2565 v22 = v21->sHealth; | |
2566 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2567 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2568 { | |
2569 if ( v22 >= 1 ) | |
2570 goto LABEL_59; | |
2571 v59 = 0; | |
2572 v56 = 13; | |
2573 } | |
2574 else | |
2575 { | |
2576 v59 = 0; | |
2577 v56 = 14; | |
2578 } | |
2579 v21->SetCondition(v56, v59); | |
2580 LABEL_59: | |
2581 v23 = (int)&v21->field_E0; | |
2582 if ( v21->field_E0 ) | |
2583 { | |
816 | 2584 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2585 if ( v24 > 0 ) |
2586 { | |
2587 *(int *)v23 = v24; | |
2588 } | |
2589 else | |
2590 { | |
2591 *(int *)v23 = 0; | |
2592 viewparams->bRedrawGameUI = 1; | |
2593 } | |
2594 } | |
2595 v25 = (int)&v21->field_E4; | |
2596 if ( v21->field_E4 ) | |
2597 { | |
816 | 2598 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2599 if ( v26 > 0 ) |
2600 { | |
2601 *(int *)v25 = v26; | |
2602 } | |
2603 else | |
2604 { | |
2605 *(int *)v25 = 0; | |
2606 viewparams->bRedrawGameUI = 1; | |
2607 } | |
2608 } | |
2609 v27 = (int)&v21->field_E8; | |
2610 if ( v21->field_E8 ) | |
2611 { | |
816 | 2612 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2613 if ( v28 > 0 ) |
2614 { | |
2615 *(int *)v27 = v28; | |
2616 } | |
2617 else | |
2618 { | |
2619 *(int *)v27 = 0; | |
2620 viewparams->bRedrawGameUI = 1; | |
2621 } | |
2622 } | |
2623 v29 = (int)&v21->field_EC; | |
2624 if ( v21->field_EC ) | |
2625 { | |
816 | 2626 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2627 if ( v30 > 0 ) |
2628 { | |
2629 *(int *)v29 = v30; | |
2630 } | |
2631 else | |
2632 { | |
2633 *(int *)v29 = 0; | |
2634 viewparams->bRedrawGameUI = 1; | |
2635 } | |
2636 } | |
2637 v31 = (int)&v21->field_F0; | |
2638 if ( v21->field_F0 ) | |
2639 { | |
816 | 2640 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2641 if ( v32 > 0 ) |
2642 { | |
2643 *(int *)v31 = v32; | |
2644 } | |
2645 else | |
2646 { | |
2647 *(int *)v31 = 0; | |
2648 viewparams->bRedrawGameUI = 1; | |
2649 } | |
2650 } | |
2651 v33 = (int)&v21->field_F4; | |
2652 if ( v21->field_F4 ) | |
2653 { | |
816 | 2654 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2655 if ( v34 > 0 ) |
2656 { | |
2657 *(int *)v33 = v34; | |
2658 } | |
2659 else | |
2660 { | |
2661 *(int *)v33 = 0; | |
2662 viewparams->bRedrawGameUI = 1; | |
2663 } | |
2664 } | |
2665 v35 = (int)&v21->field_F8; | |
2666 if ( v21->field_F8 ) | |
2667 { | |
816 | 2668 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2669 if ( v36 > 0 ) |
2670 { | |
2671 *(int *)v35 = v36; | |
2672 } | |
2673 else | |
2674 { | |
2675 *(int *)v35 = 0; | |
2676 viewparams->bRedrawGameUI = 1; | |
2677 } | |
2678 } | |
2679 v37 = (int)&v21->field_FC; | |
2680 if ( v21->field_FC ) | |
2681 { | |
816 | 2682 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2683 if ( v38 > 0 ) |
2684 { | |
2685 *(int *)v37 = v38; | |
2686 } | |
2687 else | |
2688 { | |
2689 *(int *)v37 = 0; | |
2690 viewparams->bRedrawGameUI = 1; | |
2691 } | |
2692 } | |
2693 v39 = (int)&v21->field_100; | |
2694 if ( v21->field_100 ) | |
2695 { | |
816 | 2696 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2697 if ( v40 > 0 ) |
2698 { | |
2699 *(int *)v39 = v40; | |
2700 } | |
2701 else | |
2702 { | |
2703 *(int *)v39 = 0; | |
2704 viewparams->bRedrawGameUI = 1; | |
2705 } | |
2706 } | |
2707 v41 = (int)&v21->field_104; | |
2708 if ( v21->field_104 ) | |
2709 { | |
816 | 2710 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2711 if ( v42 > 0 ) |
2712 { | |
2713 *(int *)v41 = v42; | |
2714 } | |
2715 else | |
2716 { | |
2717 *(int *)v41 = 0; | |
2718 viewparams->bRedrawGameUI = 1; | |
2719 } | |
2720 } | |
2721 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2722 --v65; | |
2723 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2724 | |
2725 for (uint k = 0; k < 24; ++k) | |
2726 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2727 | |
2728 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2729 v21->SetCondition(1u, 0); | |
2730 ++v62; | |
2731 } | |
2732 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2733 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2734 | |
2735 for (uint i = 0; i < 20; ++i) | |
2736 { | |
2737 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2738 viewparams->bRedrawGameUI = 1; | |
2739 } | |
2740 | |
2741 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2742 { | |
2743 for (uint i = 0; i < 4; ++i) | |
2744 pParty->pPlayers[i].SetCondition(1, 0); | |
2745 } | |
2746 | |
2747 for (uint i = 0; i < 2; ++i) | |
2748 { | |
2749 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2750 if (pBuf->uExpireTime == 0) | |
2751 continue; | |
2752 | |
2753 if ( !(pBuf->uFlags & 1) ) | |
2754 { | |
2755 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2756 { | |
2757 pBuf->Reset(); | |
2758 if (dword_4EE07C[i] == 7 ) | |
2759 pParty->bFlying = false; | |
2760 } | |
2761 } | |
2762 } | |
2763 | |
2764 v51 = v65; | |
2765 if ( v65 ) | |
2766 goto LABEL_135; | |
151 | 2767 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2768 { |
2769 v52 = (signed int)&pPlayers[1]; | |
2770 while ( 1 ) | |
2771 { | |
2772 v53 = *(int *)v52; | |
2773 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2774 break; | |
2775 v52 += 4; | |
2776 if ( v52 > (signed int)&pPlayers[4] ) | |
2777 goto LABEL_135; | |
2778 } | |
2779 *(int *)(v53 + 16) = 0; | |
2780 *(int *)(v53 + 20) = 0; | |
2781 v51 = 1; | |
2782 LABEL_135: | |
151 | 2783 if ( pCurrentScreen != SCREEN_REST |
0 | 2784 && (!v51 || dword_5C35C0) ) |
2785 uGameState = 8; | |
2786 } | |
2787 if ( uActiveCharacter ) | |
2788 { | |
151 | 2789 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2790 { |
2791 v54 = pPlayers[uActiveCharacter]; | |
2792 if ( v54->pConditions[2] | |
2793 || v54->pConditions[12] | |
2794 || v54->pConditions[13] | |
2795 || v54->pConditions[14] | |
2796 || v54->pConditions[15] | |
2797 || v54->pConditions[16] ) | |
2798 { | |
2799 viewparams->bRedrawGameUI = 1; | |
2800 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2801 } | |
2802 } | |
2803 } | |
2804 } | |
2805 | |
2806 //----- (00494820) -------------------------------------------------------- | |
758 | 2807 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2808 { |
2809 signed int v1; // eax@1 | |
2810 | |
2811 v1 = 5; | |
758 | 2812 if ( a1 % 24 >= 5 ) |
0 | 2813 v1 = 29; |
758 | 2814 return v1 - a1 % 24; |
0 | 2815 } |
2816 | |
2817 //----- (00494836) -------------------------------------------------------- | |
2818 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2819 { | |
2820 int v3; // esi@1 | |
2821 int result; // eax@1 | |
2822 stru339_spell_sound *v5; // ebx@1 | |
2823 int *v6; // edi@2 | |
2824 unsigned int v7; // eax@3 | |
2825 int v8; // [sp+Ch] [bp-8h]@3 | |
2826 int v9; // [sp+10h] [bp-4h]@2 | |
2827 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2828 | |
2829 v3 = 0; | |
2830 result = word_4EE088_sound_ids[uSoundID]; | |
2831 v5 = this; | |
2832 a2a = word_4EE088_sound_ids[uSoundID]; | |
2833 if ( result ) | |
2834 { | |
2835 v9 = 0; | |
2836 v6 = this->pSoundsOffsets; | |
2837 do | |
2838 { | |
2839 v7 = a2a++; | |
2840 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2841 if ( !result ) | |
2842 break; | |
2843 a6 += 4; | |
2844 result = v8 + 256; | |
2845 *v6 = v3; | |
2846 v3 += result; | |
2847 ++v9; | |
2848 *(v6 - 2) = result; | |
2849 ++v6; | |
2850 } | |
2851 while ( v9 < 2 ); | |
2852 } | |
2853 return result; | |
2854 } | |
2855 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2856 | |
2857 //----- (00494AED) -------------------------------------------------------- | |
130 | 2858 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2859 { |
2860 unsigned int _uNumFrames; // edx@1 | |
2861 unsigned int result; // eax@1 | |
2862 PlayerFrame *v4; // ecx@2 | |
2863 | |
2864 _uNumFrames = this->uNumFrames; | |
2865 result = 0; | |
2866 if ( (signed int)this->uNumFrames <= 0 ) | |
2867 { | |
2868 LABEL_5: | |
2869 result = 0; | |
2870 } | |
2871 else | |
2872 { | |
2873 v4 = this->pFrames; | |
130 | 2874 while ( v4->expression != expression ) |
0 | 2875 { |
2876 ++result; | |
2877 ++v4; | |
2878 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2879 goto LABEL_5; | |
2880 } | |
2881 } | |
2882 return result; | |
2883 } | |
2884 | |
2885 //----- (00494B10) -------------------------------------------------------- | |
2886 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2887 { | |
2888 unsigned int v3; // esi@1 | |
2889 PlayerFrame *v4; // edi@1 | |
2890 PlayerFrame *v5; // ecx@1 | |
2891 __int16 v6; // dx@2 | |
2892 int v7; // edx@3 | |
2893 char *i; // eax@3 | |
2894 int v9; // ecx@5 | |
2895 PlayerFrame *result; // eax@6 | |
2896 | |
2897 v3 = uFramesetID; | |
2898 v4 = this->pFrames; | |
2899 v5 = &v4[uFramesetID]; | |
2900 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2901 { | |
2902 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2903 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2904 { | |
2905 v9 = *(short *)i; | |
2906 if ( v7 <= v9 ) | |
2907 break; | |
2908 v7 -= v9; | |
2909 ++v3; | |
2910 } | |
2911 result = &v4[v3]; | |
2912 } | |
2913 else | |
2914 { | |
2915 result = &v4[uFramesetID]; | |
2916 } | |
2917 return result; | |
2918 } | |
2919 | |
2920 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2921 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2922 { |
2923 PlayerFrameTable *v4; // edi@1 | |
2924 int v5; // esi@1 | |
2925 int v6; // eax@2 | |
2926 | |
2927 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2928 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2929 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
|
2930 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2931 *pAnimTime = v5; |
0 | 2932 } |
2933 else | |
2934 { | |
2935 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2936 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2937 *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
|
2938 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2939 return &v4->pFrames[*pFramesetID]; |
0 | 2940 } |
2941 | |
2942 //----- (00494BC3) -------------------------------------------------------- | |
2943 void PlayerFrameTable::ToFile() | |
2944 { | |
2945 PlayerFrameTable *v1; // esi@1 | |
2946 FILE *v2; // eax@1 | |
2947 FILE *v3; // edi@1 | |
2948 | |
2949 auto Str = this; | |
2950 | |
2951 v1 = Str; | |
2952 v2 = fopen("data\\dpft.bin", "wb"); | |
2953 v3 = v2; | |
2954 if ( !v2 ) | |
2955 Abortf("Unable to save dpft.bin!"); | |
2956 fwrite(v1, 4u, 1u, v2); | |
2957 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2958 fclose(v3); | |
2959 } | |
2960 | |
2961 //----- (00494C0F) -------------------------------------------------------- | |
2962 void PlayerFrameTable::FromFile(void *pSerialized) | |
2963 { | |
2964 uNumFrames = *(int *)pSerialized; | |
2965 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2966 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2967 } | |
2968 | |
2969 //----- (00494C5A) -------------------------------------------------------- | |
2970 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2971 { | |
2972 PlayerFrameTable *v2; // ebx@1 | |
2973 FILE *v3; // eax@1 | |
2974 int v4; // esi@3 | |
2975 void *v5; // eax@10 | |
2976 FILE *v6; // ST0C_4@12 | |
2977 char *i; // eax@12 | |
2978 __int16 v8; // ax@15 | |
2979 const char *v9; // ST10_4@15 | |
2980 unsigned __int16 v10; // ax@15 | |
2981 const char *v11; // ST0C_4@15 | |
2982 int j; // esi@15 | |
2983 int v13; // eax@17 | |
2984 int v14; // edx@22 | |
2985 int v15; // ecx@23 | |
2986 int v16; // eax@24 | |
2987 signed int k; // eax@27 | |
2988 PlayerFrame *v18; // edx@28 | |
2989 int v19; // esi@28 | |
2990 int l; // ecx@29 | |
2991 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2992 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2993 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2994 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2995 int v26; // [sp+2FCh] [bp-8h]@3 | |
2996 FILE *File; // [sp+300h] [bp-4h]@1 | |
2997 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
2998 | |
2999 v2 = this; | |
3000 //TileTable::dtor((TileTable *)this); | |
3001 v3 = fopen(Args, "r"); | |
3002 File = v3; | |
3003 if ( !v3 ) | |
3004 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3005 v4 = 0; | |
3006 v25 = 0; | |
3007 v26 = 1; | |
3008 if ( fgets(&Buf, 490, v3) ) | |
3009 { | |
3010 do | |
3011 { | |
3012 *strchr(&Buf, 10) = 0; | |
703 | 3013 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3014 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3015 { | |
3016 if ( v24.uPropCount < 3 ) | |
0 | 3017 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3018 ++v25; | |
3019 } | |
3020 ++v26; | |
3021 } | |
3022 while ( fgets(&Buf, 490, File) ); | |
3023 v4 = v25; | |
3024 } | |
3025 v2->uNumFrames = v4; | |
3026 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3027 v2->pFrames = (PlayerFrame *)v5; | |
3028 if ( !v5 ) | |
3029 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3030 v6 = File; | |
3031 v2->uNumFrames = 0; | |
3032 fseek(v6, 0, 0); | |
3033 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3034 { | |
3035 *strchr(&Buf, 10) = 0; | |
703 | 3036 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3037 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3038 { |
3039 v8 = atoi(v24.pProperties[0]); | |
3040 v9 = v24.pProperties[1]; | |
130 | 3041 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3042 v10 = atoi(v9); |
3043 v11 = v24.pProperties[2]; | |
3044 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3045 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3046 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3047 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3048 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3049 { |
3050 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3051 { | |
3052 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3053 *(char *)v13 |= 4u; | |
3054 } | |
3055 } | |
3056 ++v2->uNumFrames; | |
3057 } | |
3058 } | |
3059 fclose(File); | |
3060 v14 = 0; | |
3061 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3062 { | |
3063 v15 = 0; | |
3064 do | |
3065 { | |
3066 v16 = (int)&v2->pFrames[v15]; | |
3067 if ( !(*(char *)(v16 + 18) & 4) ) | |
3068 *(char *)(v16 + 8) |= 1u; | |
3069 ++v14; | |
3070 ++v15; | |
3071 } | |
3072 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3073 } | |
3074 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3075 { | |
3076 v18 = v2->pFrames; | |
3077 Argsa = (int)&v18[k]; | |
3078 v19 = *(short *)(Argsa + 4); | |
3079 if ( *(char *)(Argsa + 8) & 1 ) | |
3080 { | |
3081 ++k; | |
3082 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3083 { | |
3084 v19 += *(short *)(l + 4); | |
3085 ++k; | |
3086 } | |
3087 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3088 } | |
3089 ++k; | |
3090 } | |
3091 return 1; | |
3092 } | |
3093 | |
3094 //----- (00494F3A) -------------------------------------------------------- | |
3095 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3096 { | |
3097 IconFrameTable *v2; // esi@1 | |
3098 int v3; // ebx@1 | |
3099 unsigned int uID; // edi@1 | |
3100 unsigned int result; // eax@4 | |
3101 | |
3102 v2 = this; | |
3103 v3 = 0; | |
3104 uID = 0; | |
3105 if ( (signed int)this->uNumIcons <= 0 ) | |
3106 { | |
3107 LABEL_4: | |
3108 result = 0; | |
3109 } | |
3110 else | |
3111 { | |
3112 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3113 { | |
3114 ++uID; | |
3115 ++v3; | |
3116 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3117 goto LABEL_4; | |
3118 } | |
3119 result = uID; | |
3120 } | |
3121 return result; | |
3122 } | |
3123 | |
3124 //----- (00494F70) -------------------------------------------------------- | |
3125 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3126 { | |
3127 IconFrame *v3; // edi@1 | |
3128 IconFrame *v4; // ecx@1 | |
3129 __int16 v5; // dx@2 | |
3130 int v6; // edx@3 | |
3131 unsigned int v7; // eax@3 | |
3132 char *i; // ecx@3 | |
3133 int v9; // esi@5 | |
3134 IconFrame *result; // eax@6 | |
3135 | |
3136 v3 = this->pIcons; | |
3137 v4 = &v3[uIconID]; | |
3138 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3139 { | |
3140 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3141 v7 = uIconID; | |
3142 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3143 { | |
3144 v9 = *(short *)i; | |
3145 if ( v6 <= v9 ) | |
3146 break; | |
3147 v6 -= v9; | |
3148 ++v7; | |
3149 } | |
3150 result = &v3[v7]; | |
3151 } | |
3152 else | |
3153 { | |
3154 result = &v3[uIconID]; | |
3155 } | |
3156 return result; | |
3157 } | |
3158 | |
3159 //----- (00494FBF) -------------------------------------------------------- | |
3160 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3161 { | |
3162 IconFrameTable *v2; // esi@1 | |
3163 unsigned int v3; // edi@3 | |
3164 const char *i; // eax@3 | |
3165 IconFrame *v5; // eax@5 | |
3166 | |
3167 v2 = this; | |
3168 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3169 { | |
3170 v3 = uIconID; | |
3171 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3172 { | |
3173 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3174 v5 = v2->pIcons; | |
3175 if ( !(v5[v3].uFlags & 1) ) | |
3176 break; | |
3177 ++v3; | |
3178 } | |
3179 } | |
3180 } | |
3181 | |
3182 //----- (0049500A) -------------------------------------------------------- | |
3183 void IconFrameTable::ToFile() | |
3184 { | |
3185 IconFrameTable *v1; // esi@1 | |
3186 FILE *v2; // eax@1 | |
3187 FILE *v3; // edi@1 | |
3188 | |
3189 auto Str = this; | |
3190 | |
3191 v1 = Str; | |
3192 v2 = fopen("data\\dift.bin", "wb"); | |
3193 v3 = v2; | |
3194 if ( !v2 ) | |
3195 Abortf("Unable to save dift.bin!"); | |
3196 fwrite(v1, 4u, 1u, v2); | |
3197 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3198 fclose(v3); | |
3199 } | |
3200 | |
3201 //----- (00495056) -------------------------------------------------------- | |
3202 void IconFrameTable::FromFile(void *pSerialized) | |
3203 { | |
3204 uNumIcons = *(int *)pSerialized; | |
3205 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3206 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3207 } | |
3208 | |
3209 //----- (0049509D) -------------------------------------------------------- | |
3210 int IconFrameTable::FromFileTxt(const char *Args) | |
3211 { | |
3212 IconFrameTable *v2; // ebx@1 | |
3213 FILE *v3; // eax@1 | |
3214 int v4; // esi@3 | |
3215 void *v5; // eax@10 | |
3216 FILE *v6; // ST0C_4@12 | |
3217 char *i; // eax@12 | |
3218 const char *v8; // ST00_4@15 | |
3219 int v9; // eax@16 | |
3220 int v10; // edx@20 | |
3221 int v11; // ecx@21 | |
3222 int v12; // eax@22 | |
3223 signed int j; // edx@25 | |
3224 IconFrame *v14; // ecx@26 | |
3225 int v15; // esi@26 | |
3226 int k; // eax@27 | |
3227 signed int result; // eax@11 | |
3228 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3229 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3230 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3231 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3232 int v22; // [sp+2FCh] [bp-8h]@3 | |
3233 FILE *File; // [sp+300h] [bp-4h]@1 | |
3234 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3235 | |
3236 v2 = this; | |
3237 //TileTable::dtor((TileTable *)this); | |
3238 v3 = fopen(Args, "r"); | |
3239 File = v3; | |
3240 if ( !v3 ) | |
3241 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3242 v4 = 0; | |
3243 v21 = 0; | |
3244 v22 = 1; | |
3245 if ( fgets(&Buf, 490, v3) ) | |
3246 { | |
3247 do | |
3248 { | |
3249 *strchr(&Buf, 10) = 0; | |
3250 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3251 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3252 { | |
3253 if ( v20.uPropCount < 3 ) | |
0 | 3254 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3255 ++v21; | |
3256 } | |
3257 ++v22; | |
3258 } | |
3259 while ( fgets(&Buf, 490, File) ); | |
3260 v4 = v21; | |
3261 } | |
3262 v2->uNumIcons = v4; | |
3263 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3264 v2->pIcons = (IconFrame *)v5; | |
3265 if ( v5 ) | |
3266 { | |
3267 v6 = File; | |
3268 v2->uNumIcons = 0; | |
3269 fseek(v6, 0, 0); | |
3270 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3271 { | |
3272 *strchr(&Buf, 10) = 0; | |
3273 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3274 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3275 { |
3276 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3277 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3278 v8 = v20.pProperties[2]; | |
3279 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3280 if ( !_strcmpi(v8, "new") ) | |
3281 { | |
3282 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3283 *(char *)v9 |= 4u; | |
3284 } | |
3285 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3286 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3287 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3288 } | |
3289 } | |
3290 fclose(File); | |
3291 v10 = 0; | |
3292 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3293 { | |
3294 v11 = 0; | |
3295 do | |
3296 { | |
3297 v12 = (int)&v2->pIcons[v11]; | |
3298 if ( !(*(char *)(v12 + 60) & 4) ) | |
3299 *(char *)(v12 + 28) |= 1u; | |
3300 ++v10; | |
3301 ++v11; | |
3302 } | |
3303 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3304 } | |
3305 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3306 { | |
3307 v14 = v2->pIcons; | |
3308 Argsa = (int)&v14[j]; | |
3309 v15 = *(short *)(Argsa + 24); | |
3310 if ( *(char *)(Argsa + 28) & 1 ) | |
3311 { | |
3312 ++j; | |
3313 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3314 { | |
3315 v15 += *(short *)(k + 24); | |
3316 ++j; | |
3317 } | |
3318 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3319 } | |
3320 ++j; | |
3321 } | |
3322 result = 1; | |
3323 } | |
3324 else | |
3325 { | |
3326 fclose(File); | |
3327 result = 0; | |
3328 } | |
3329 return result; | |
3330 } | |
3331 | |
3332 //----- (00495366) -------------------------------------------------------- | |
3333 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3334 { | |
3335 int v2; // edi@1 | |
3336 int v3; // edx@2 | |
3337 int v4; // esi@3 | |
3338 int v5; // ebx@5 | |
3339 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3340 signed int v8; // [sp+10h] [bp-10h]@1 | |
3341 int **v9; // [sp+14h] [bp-Ch]@4 | |
3342 signed int v10; // [sp+18h] [bp-8h]@3 | |
3343 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3344 | |
3345 v2 = a1; | |
3346 v11 = a2; | |
3347 v8 = 0; | |
3348 v7 = 0; | |
3349 if ( dword_AE336C == a1 ) | |
3350 { | |
3351 v3 = dword_AE3370; | |
3352 } | |
3353 else | |
3354 { | |
3355 v4 = a2; | |
3356 dword_AE336C = a1; | |
3357 v10 = 0; | |
3358 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3359 goto LABEL_17; | |
3360 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3361 do | |
3362 { | |
3363 v5 = tolower(*(char *)*v9); | |
3364 if ( v5 == tolower(v2) ) | |
3365 { | |
3366 if ( v8 ) | |
3367 v7 = v10; | |
3368 else | |
3369 v8 = v10; | |
3370 } | |
3371 ++v10; | |
3372 v9 += 2; | |
3373 } | |
3374 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3375 if ( v8 && v8 != v7 ) | |
3376 v3 = v8 + rand() % (v7 - v8); | |
3377 else | |
3378 LABEL_17: | |
3379 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3380 } | |
3381 dword_AE3370 = v3; | |
3382 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3383 } | |
3384 // AE336C: using guessed type int dword_AE336C; | |
3385 // AE3370: using guessed type int dword_AE3370; | |
3386 | |
3387 //----- (00495430) -------------------------------------------------------- | |
607 | 3388 char * GetReputationString( signed int a1 ) |
3389 { | |
566 | 3390 if (a1 >= 25) |
3391 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3392 else if (a1 >= 6) | |
3393 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3394 else if (a1 >= -5) | |
3395 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3396 else if (a1 >= -24) | |
3397 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3398 else |
566 | 3399 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3400 } |
3401 | |
3402 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3403 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3404 { |
3405 unsigned __int8 v6; // bl@1 | |
3406 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3407 //NPCData *v9; // eax@4 |
250 | 3408 //size_t v10; // eax@6 |
0 | 3409 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3410 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3411 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3412 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3413 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3414 //int v16; // edx@10 |
0 | 3415 int v17; // eax@10 |
3416 signed __int64 v18; // qax@18 | |
3417 unsigned int v19; // edi@32 | |
3418 unsigned __int8 *v20; // ebx@32 | |
3419 int v21; // ecx@34 | |
3420 __int16 v22; // ax@34 | |
3421 int v23; // edx@39 | |
3422 int v24; // eax@39 | |
3423 int v25; // eax@45 | |
3424 float *v26; // esi@68 | |
3425 float v27; // ST18_4@68 | |
3426 signed int v28; // eax@68 | |
3427 int v29; // eax@68 | |
3428 float v30; // ST18_4@72 | |
3429 signed int v31; // eax@72 | |
3430 float v32; // ST18_4@74 | |
3431 signed int v33; // eax@74 | |
3432 double v34; // st7@75 | |
3433 float v35; // ST18_4@76 | |
3434 signed int v36; // eax@76 | |
3435 float *v37; // esi@78 | |
3436 float v38; // ST18_4@78 | |
3437 int v39; // eax@78 | |
3438 float v40; // ST18_4@82 | |
3439 int v41; // eax@82 | |
3440 float v42; // ST18_4@83 | |
3441 int v43; // eax@83 | |
3442 float v44; // ST18_4@85 | |
3443 int v45; // eax@85 | |
3444 const char *v46; // eax@86 | |
3445 unsigned int v47; // eax@87 | |
3446 float v48; // ST18_4@97 | |
3447 __int64 v49; // ST14_8@107 | |
3448 int v50; // eax@107 | |
3449 int v51; // eax@108 | |
3450 Player *v52; // eax@109 | |
3451 int v53; // [sp-4h] [bp-13Ch]@107 | |
3452 int v54; // [sp+0h] [bp-138h]@107 | |
3453 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3454 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3455 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3456 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3457 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3458 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3459 //Player *v61; // [sp+124h] [bp-14h]@3 |
3460 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3461 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3462 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3463 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3464 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3465 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3466 |
0 | 3467 |
3468 v6 = uPlayerID; | |
249 | 3469 //Str = lpsz; |
0 | 3470 if ( IsBadStringPtrA(lpsz, 1u) ) |
3471 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3472 |
0 | 3473 a1[0] = 0; |
3474 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3475 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3476 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 NPCData *npc = nullptr; |
0 | 3480 if ( dword_5C35D4 ) |
248 | 3481 { |
463 | 3482 //__debugbreak(); // fix |
459 | 3483 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
|
3484 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3485 else |
602 | 3486 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 //v65 = v9; |
250 | 3488 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3489 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3490 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3493 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3495 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3496 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3497 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3498 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3499 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3504 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3510 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 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
|
3512 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 case 2: |
0 | 3519 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 case 5: |
0 | 3526 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3527 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3528 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3529 { | |
3530 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3531 { | |
3532 if ( v18 < 20 ) | |
3533 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3534 } | |
3535 else | |
3536 { | |
3537 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3538 } | |
3539 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 case 6: |
0 | 3542 if ( pPlayer->uSex ) |
3543 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3544 else | |
3545 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3546 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 case 7: |
0 | 3548 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 case 8: |
0 | 3554 v19 = 0; |
3555 v63 = 0; | |
484 | 3556 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3557 do |
3558 { | |
3559 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3560 { | |
3561 v21 = v63; | |
3562 v22 = word_4EE150[v19]; | |
3563 ++v63; | |
3564 v55[v21] = v22; | |
3565 } | |
3566 ++v19; | |
3567 } | |
3568 while ( v19 < 28 ); | |
3569 if ( v63 ) | |
3570 { | |
3571 v23 = rand() % v63; | |
3572 v24 = dword_A74CDC; | |
3573 if ( dword_A74CDC == -1 ) | |
3574 { | |
3575 v24 = v23; | |
3576 dword_A74CDC = v23; | |
3577 } | |
492 | 3578 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3579 } |
3580 else | |
3581 { | |
3582 v11 = (char *)pNPCTopics[55].pText; | |
3583 } | |
249 | 3584 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3585 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3592 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 case 10: |
0 | 3594 if ( pPlayer->uSex ) |
3595 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3596 else | |
3597 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
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 11: |
0 | 3600 v25 = GetPartyReputation(); |
3601 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 v25 = npc->rep; |
0 | 3604 LABEL_46: |
3605 if ( v25 >= 25 ) | |
3606 { | |
3607 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3608 } | |
3609 else | |
3610 { | |
3611 if ( v25 < 6 ) | |
3612 { | |
3613 if ( v25 >= -5 ) | |
3614 { | |
3615 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3616 } | |
3617 else | |
3618 { | |
3619 if ( v25 < -24 ) | |
3620 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3621 else | |
3622 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3623 } | |
3624 } | |
3625 else | |
3626 { | |
3627 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3628 } | |
3629 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3630 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3631 case 13: |
0 | 3632 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3633 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3634 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3635 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3636 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3637 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3638 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3639 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3640 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3641 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3642 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3644 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3645 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 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
|
3665 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 sprintf(a1, "%lu", pay_percentage); |
250 | 3669 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 sprintf(a1, "%lu", v51); |
0 | 3683 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 } |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3710 switch ( a5 ) |
3711 { | |
3712 case 3: | |
3713 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 v45 = a3->GetValue(); |
0 | 3715 v29 = pPlayer->_4B8213(v45, v44); |
3716 break; | |
3717 case 4: | |
3718 v29 = pPlayer->_4B824B(*v37); | |
3719 break; | |
3720 case 5: | |
3721 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 v43 = a3->GetValue(); |
0 | 3723 v29 = pPlayer->_4B8265(v43, v42); |
3724 break; | |
3725 case 6: | |
3726 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3727 v41 = a3->GetValue(); |
0 | 3728 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3729 break; | |
254
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 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3732 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3733 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3734 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3735 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3736 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3737 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3738 v28 = a3->GetValue(); |
749 | 3739 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3740 if ( a5 == 3 ) |
3741 { | |
3742 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 v36 = a3->GetValue(); |
0 | 3744 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3745 if (a3->Broken()) |
0 | 3746 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 goto _continue_sprintf; |
0 | 3748 } |
3749 if ( a5 != 4 ) | |
3750 { | |
3751 if ( a5 == 5 ) | |
3752 { | |
3753 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3754 v33 = a3->GetValue(); |
0 | 3755 v29 = pPlayer->_4B81C3(v33, v32); |
3756 } | |
3757 else | |
3758 { | |
3759 if ( a5 == 6 ) | |
3760 { | |
3761 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3762 v31 = a3->GetValue(); |
0 | 3763 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3764 if (a3->Broken()) |
0 | 3765 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3766 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3767 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3768 goto _continue_sprintf; |
0 | 3769 } |
3770 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3771 _continue_sprintf: |
0 | 3772 sprintf(a1, "%lu", v29); |
250 | 3773 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3774 goto _continue_strcat; |
0 | 3775 } |
3776 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3777 |
0 | 3778 v48 = v34; |
3779 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3781 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3784 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3785 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3786 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 case 29: |
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 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3797 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3798 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 sub_493F79(&v57, *a6); |
351 | 3804 v54 = v57.field_18_expire_year; |
3805 v53 = v57.field_C_expire_day + 1; | |
3806 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3813 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3818 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3819 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 default: |
0 | 3821 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 goto _continue_strcat; |
484 | 3825 v49 = pParty->field_3C._s_times[v17-51]; |
3826 | |
0 | 3827 sub_493F79(&v56, v49); |
351 | 3828 v54 = v56.field_18_expire_year; |
3829 v53 = v56.field_C_expire_day + 1; | |
3830 v50 = v56.field_14_exprie_month; | |
0 | 3831 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3832 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3834 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 } |
0 | 3836 } |
3837 return pTmpBuf2; | |
3838 } | |
3839 | |
3840 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3841 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3842 { |
734 | 3843 //stru154 *v3; // edi@1 |
3844 //signed int v4; // eax@1 | |
3845 //signed int result; // eax@9 | |
3846 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3847 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3848 float v7; |
0 | 3849 |
3850 v.x = 0.0; | |
3851 v.y = 0.0; | |
3852 v.z = 0.0; | |
734 | 3853 GetFacePlane(a2, a3, &v, &v7); |
3854 | |
3855 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3856 polygonType = POLYGON_VerticalWall; | |
3857 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3858 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3859 polygonType = POLYGON_Floor; | |
0 | 3860 else |
734 | 3861 polygonType = POLYGON_InBetweenFloorAndWall; |
3862 | |
3863 face_plane.vNormal.x = v.x; | |
3864 face_plane.vNormal.y = v.y; | |
3865 face_plane.vNormal.z = v.z; | |
3866 face_plane.dist = v7; | |
0 | 3867 } |
3868 | |
3869 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3870 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3871 { |
734 | 3872 if (fabsf(pNormal->z) < 1e-6f) |
3873 polygonType = POLYGON_VerticalWall; | |
3874 else if (fabsf(pNormal->x) < 1e-6f && | |
3875 fabsf(pNormal->y) < 1e-6f) | |
3876 polygonType = POLYGON_Floor; | |
0 | 3877 else |
734 | 3878 polygonType = POLYGON_InBetweenFloorAndWall; |
3879 | |
3880 face_plane.vNormal.x = pNormal->x; | |
3881 face_plane.dist = dist; | |
3882 face_plane.vNormal.y = pNormal->y; | |
3883 face_plane.vNormal.z = pNormal->z; | |
0 | 3884 } |
3885 | |
3886 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3887 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3888 { |
3889 ODMFace *v5; // ebx@1 | |
734 | 3890 //int v6; // eax@1 |
3891 //unsigned __int16 *v7; // ebx@2 | |
3892 //Vec3_int_ *v8; // eax@3 | |
0 | 3893 Vec3_int_ *v9; // ecx@3 |
734 | 3894 //double v10; // st7@3 |
3895 //int v11; // ecx@3 | |
0 | 3896 Vec3_int_ *v12; // ecx@3 |
734 | 3897 //double v13; // st7@3 |
3898 //double v14; // st6@3 | |
3899 //double v15; // st5@3 | |
3900 //int v16; // ecx@3 | |
0 | 3901 Vec3_int_ *v17; // eax@3 |
734 | 3902 //double v18; // st5@3 |
0 | 3903 Vec3_float_ *v19; // eax@3 |
734 | 3904 //int result; // eax@8 |
3905 //float v21; // ecx@10 | |
3906 //double v22; // st7@10 | |
3907 //double v23; // st6@10 | |
0 | 3908 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3909 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3910 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3911 float v27; // [sp+20h] [bp-48h]@3 | |
3912 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3913 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3914 //float v30; // [sp+30h] [bp-38h]@3 | |
3915 //float v31; // [sp+34h] [bp-34h]@3 | |
3916 //float v32; // [sp+38h] [bp-30h]@3 | |
3917 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3918 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3919 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3920 //float v36; // [sp+50h] [bp-18h]@3 | |
3921 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3922 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3923 //int v39; // [sp+64h] [bp-4h]@1 |
3924 | |
3925 //v39 = 0; | |
0 | 3926 v1.x = 0.0; |
3927 v5 = pFace; | |
734 | 3928 //v6 = pFace->uNumVertices; |
0 | 3929 v1.y = 0.0; |
3930 v1.z = 0.0; | |
734 | 3931 |
3932 if (pFace->uNumVertices >= 2) | |
3933 { | |
3934 int i = 0; | |
3935 while ( i < pFace->uNumVertices - 2 ) | |
3936 { | |
3937 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3938 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3939 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3940 | |
3941 v1.x = v12->x - v9->x; | |
3942 v26 = v17->x - v12->x; | |
3943 v1.y = v12->y - v9->y; | |
3944 v27 = v17->y - v12->y; | |
3945 v1.z = v12->z - v9->z; | |
3946 v28 = v17->z - v12->z; | |
0 | 3947 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3948 v38.x = v19->x; | |
3949 v38.y = v19->y; | |
3950 v38.z = v19->z; | |
734 | 3951 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3952 { | |
3953 v38.Normalize(); | |
3954 | |
3955 pOutNormal->x = v38.x; | |
3956 pOutNormal->y = v38.y; | |
3957 pOutNormal->z = v38.z; | |
3958 | |
3959 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3960 return; | |
3961 } | |
3962 } | |
3963 } | |
3964 | |
3965 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3966 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3967 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3968 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3969 } |
3970 | |
3971 //----- (0049D700) -------------------------------------------------------- | |
3972 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3973 { | |
3974 unsigned int v1; // eax@1 | |
3975 int v2; // ecx@1 | |
3976 unsigned int v3; // eax@1 | |
3977 | |
3978 v1 = uDim; | |
3979 v2 = 0; | |
3980 v3 = v1 - 1; | |
3981 while ( v3 & 1 ) | |
3982 { | |
3983 v3 >>= 1; | |
3984 ++v2; | |
3985 } | |
3986 return v3 == 0 ? v2 : 0; | |
3987 } | |
3988 | |
3989 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3990 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3991 { |
737 | 3992 /*signed __int64 v2; // ST10_8@1 |
0 | 3993 double v3; // st7@1 |
3994 float v4; // ST24_4@1 | |
3995 double v5; // ST10_8@1 | |
3996 int v6; // ST1C_4@1 | |
3997 float v7; // ST24_4@1 | |
3998 double v8; // ST10_8@1 | |
3999 unsigned __int8 v9; // ST20_1@1 | |
4000 float v10; // ST24_4@1 | |
4001 double v11; // ST10_8@1 | |
4002 float v12; // ST24_4@1 | |
737 | 4003 double v13; // ST08_8@1*/ |
4004 | |
4005 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4006 (a2 >> 24) / 255.0f * 255.0f), | |
4007 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4008 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4009 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4010 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4011 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4012 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4013 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4014 /*v2 = a1 >> 24; | |
4015 v3 = (double)v2 / 255.0f; | |
4016 HIDWORD(v2) = 0; | |
0 | 4017 LODWORD(v2) = a2 >> 24; |
737 | 4018 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4019 v5 = v4 + 6.7553994e15; |
4020 v6 = LODWORD(v5); | |
737 | 4021 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4022 v8 = v7 + 6.7553994e15; |
4023 v9 = LOBYTE(v8); | |
737 | 4024 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4025 v11 = v10 + 6.7553994e15; |
737 | 4026 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4027 v13 = v12 + 6.7553994e15; |
737 | 4028 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4029 } |
4030 | |
4031 //----- (004A46E6) -------------------------------------------------------- | |
4032 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4033 { | |
4034 int v5; // eax@1 | |
4035 int z; // eax@1 | |
4036 unsigned int v7; // eax@9 | |
4037 unsigned int v8; // ecx@9 | |
4038 int v9; // eax@9 | |
4039 unsigned int v10; // eax@10 | |
4040 int *v11; // esi@10 | |
4041 int *v12; // edi@10 | |
4042 int v13; // ecx@10 | |
4043 int v14; // edx@10 | |
4044 unsigned int v15; // eax@22 | |
4045 int *v16; // esi@22 | |
4046 int *v17; // edi@22 | |
4047 int v18; // ecx@22 | |
4048 int v19; // edx@22 | |
4049 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4050 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4051 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4052 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4053 | |
4054 v5 = a4; | |
4055 v23 = _z >> 16; | |
4056 z = x + v5; | |
693 | 4057 if ( z >= (signed int)pViewport->uViewportTL_X |
4058 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4059 && y >= (signed int)pViewport->uViewportTL_Y | |
4060 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4061 { | |
4062 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4063 x = pViewport->uViewportTL_X; | |
4064 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4065 z = pViewport->uViewportBR_X; | |
0 | 4066 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4067 v22 = z - x; | |
4068 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4069 v7 = lightColor >> 3; | |
4070 v8 = lightColor & 0xF0; | |
4071 v9 = v7 & 0x1E0000; | |
4072 if ( pRenderer->uTargetGBits == 5 ) | |
4073 { | |
4074 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4075 v11 = (int *)pTarget; | |
4076 v12 = pTargetZ; | |
4077 v13 = v22; | |
4078 v14 = (v10 << 16) | v10; | |
4079 z = (unsigned __int8)pTarget & 2; | |
4080 if ( (unsigned __int8)pTarget & 2 ) | |
4081 { | |
4082 z = (unsigned int)*pTargetZ >> 16; | |
4083 if ( z > v23 ) | |
4084 { | |
4085 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4086 *pTarget = z; | |
4087 } | |
4088 v13 = v22 - 1; | |
4089 v11 = (int *)(pTarget + 1); | |
4090 v12 = pTargetZ + 1; | |
4091 } | |
4092 while ( v13 != 1 ) | |
4093 { | |
4094 if ( v13 < 1 ) | |
4095 return z; | |
4096 z = (unsigned int)*v12 >> 16; | |
4097 if ( z <= v23 ) | |
4098 { | |
4099 v13 -= 2; | |
4100 ++v11; | |
4101 v12 += 2; | |
4102 } | |
4103 else | |
4104 { | |
4105 v12 += 2; | |
4106 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4107 v13 -= 2; | |
4108 *v11 = z; | |
4109 ++v11; | |
4110 } | |
4111 } | |
4112 z = (unsigned int)*v12 >> 16; | |
4113 if ( z > v23 ) | |
4114 { | |
4115 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4116 *(short *)v11 = z; | |
4117 } | |
4118 } | |
4119 else | |
4120 { | |
4121 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4122 v16 = (int *)pTarget; | |
4123 v17 = pTargetZ; | |
4124 v18 = v22; | |
4125 v19 = (v15 << 16) | v15; | |
4126 z = (unsigned __int8)pTarget & 2; | |
4127 if ( (unsigned __int8)pTarget & 2 ) | |
4128 { | |
4129 z = (unsigned int)*pTargetZ >> 16; | |
4130 if ( z > v23 ) | |
4131 { | |
4132 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4133 *pTarget = z; | |
4134 } | |
4135 v18 = v22 - 1; | |
4136 v16 = (int *)(pTarget + 1); | |
4137 v17 = pTargetZ + 1; | |
4138 } | |
4139 while ( v18 != 1 ) | |
4140 { | |
4141 if ( v18 < 1 ) | |
4142 return z; | |
4143 z = (unsigned int)*v17 >> 16; | |
4144 if ( z <= v23 ) | |
4145 { | |
4146 v18 -= 2; | |
4147 ++v16; | |
4148 v17 += 2; | |
4149 } | |
4150 else | |
4151 { | |
4152 v17 += 2; | |
4153 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4154 v18 -= 2; | |
4155 *v16 = z; | |
4156 ++v16; | |
4157 } | |
4158 } | |
4159 z = (unsigned int)*v17 >> 16; | |
4160 if ( z > v23 ) | |
4161 { | |
4162 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4163 *(short *)v16 = z; | |
4164 } | |
4165 } | |
4166 } | |
4167 return z; | |
4168 } | |
4169 | |
4170 //----- (004A57E9) -------------------------------------------------------- | |
4171 void __cdecl Present_ColorKey() | |
4172 { | |
4173 HRESULT v0; // eax@3 | |
4174 HRESULT v1; // eax@3 | |
4175 HRESULT v2; // eax@3 | |
4176 HRESULT v3; // eax@3 | |
4177 HRESULT v4; // eax@3 | |
4178 RECT a2; // [sp+4h] [bp-14h]@3 | |
4179 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4180 | |
4181 if ( !pRenderer->uNumSceneBegins ) | |
4182 { | |
4183 if ( pRenderer->field_40110 ) | |
4184 { | |
693 | 4185 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4186 a2.left = 0; |
4187 a2.top = 0; | |
4188 a2.right = 640; | |
4189 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4190 a2.right = 640; | |
4191 a2.left = 0; | |
693 | 4192 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4193 a2.bottom = 480; |
4194 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4195 0, | |
693 | 4196 pViewport->uViewportBR_Y + 1, |
0 | 4197 pRenderer->pColorKeySurface4, |
4198 &a2, | |
4199 16u)); | |
693 | 4200 a2.right = pViewport->uViewportTL_X; |
4201 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4202 a2.left = 0; |
693 | 4203 a2.top = pViewport->uViewportTL_Y; |
0 | 4204 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4205 0, | |
693 | 4206 pViewport->uViewportTL_Y, |
0 | 4207 pRenderer->pColorKeySurface4, |
4208 &a2, | |
4209 16u)); | |
693 | 4210 a2.left = pViewport->uViewportBR_X; |
4211 a2.top = pViewport->uViewportTL_Y; | |
0 | 4212 a2.right = 640; |
693 | 4213 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4214 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4215 pViewport->uViewportBR_X, |
4216 pViewport->uViewportTL_Y, | |
0 | 4217 pRenderer->pColorKeySurface4, |
4218 &a2, | |
4219 16u)); | |
693 | 4220 a2.right = pViewport->uViewportBR_X; |
4221 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4222 a2.left = pViewport->uViewportTL_X; | |
4223 a2.top = pViewport->uViewportTL_Y; | |
0 | 4224 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4225 pViewport->uViewportTL_X, |
4226 pViewport->uViewportTL_Y, | |
0 | 4227 pRenderer->pColorKeySurface4, |
4228 &a2, | |
4229 17u)); | |
4230 } | |
4231 } | |
4232 } | |
4233 | |
4234 //----- (004A597D) -------------------------------------------------------- | |
4235 void Present_NoColorKey() | |
4236 { | |
4237 //unsigned __int16 *v0; // eax@4 | |
4238 unsigned __int16 *v1; // esi@4 | |
4239 void *v2; // edi@4 | |
4240 //signed int v4; // ebx@4 | |
4241 //signed int v5; // ebx@6 | |
4242 //void *v6; // edi@7 | |
4243 //const void *v7; // esi@7 | |
4244 signed int v8; // ebx@8 | |
4245 int v9; // eax@10 | |
4246 unsigned int v10; // esi@10 | |
4247 unsigned __int32 v11; // edi@10 | |
4248 //int v12; // ecx@10 | |
4249 unsigned int v13; // ebx@10 | |
4250 int v14; // eax@11 | |
4251 int v15; // eax@13 | |
4252 int v16; // eax@14 | |
4253 int v17; // eax@16 | |
4254 HRESULT v18; // eax@22 | |
4255 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4256 int v20; // [sp+88h] [bp-1Ch]@10 | |
4257 int v21; // [sp+8Ch] [bp-18h]@10 | |
4258 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4259 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4260 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4261 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4262 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4263 | |
4264 if ( !pRenderer->uNumSceneBegins ) | |
4265 { | |
4266 if ( pRenderer->field_40110 ) | |
4267 { | |
4268 memset(&Dst, 0, 0x7Cu); | |
4269 Dst.dwSize = 124; | |
168 | 4270 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4271 { |
4272 //v26 = Dst.lpSurface; | |
4273 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4274 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4275 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4276 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4277 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4278 v1 = pRenderer->pTargetSurface; | |
4279 v2 = Dst.lpSurface; | |
4280 | |
4281 | |
4282 /*for (uint y = 0; y < 480; ++y) | |
4283 { | |
4284 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4285 for (uint x = 0; x < 640; ++x) | |
4286 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4287 }*/ | |
4288 | |
4289 auto pSrc = pRenderer->pTargetSurface; | |
4290 auto pDst = (__int16 *)Dst.lpSurface; | |
4291 | |
4292 for (uint y = 0; y < 8; ++y) | |
4293 memcpy(pDst + y * Dst.lPitch / 2, | |
4294 | |
4295 pSrc + y * 640, 640 * sizeof(__int16)); | |
4296 | |
4297 for (uint y = 8; y < 352; ++y) | |
4298 { | |
4299 memcpy(pDst + y * Dst.lPitch / 2, | |
4300 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4301 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4302 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4303 } |
4304 | |
121 | 4305 for (uint y = 352; y < 480; ++y) |
0 | 4306 memcpy(pDst + y * Dst.lPitch / 2, |
4307 pSrc + y * 640, 640 * sizeof(__int16)); | |
4308 | |
4309 | |
693 | 4310 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4311 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4312 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4313 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4314 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4315 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4316 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4317 v21 = 4 * v9 + 1280; | |
4318 | |
121 | 4319 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4320 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4321 v10 = (int)pSrc_x1y1; | |
4322 v11 = (int)pDst_x1y1; | |
693 | 4323 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4324 v13 = v24; |
4325 | |
693 | 4326 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4327 { |
4328 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4329 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4330 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4331 { |
4332 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4333 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4334 } | |
4335 } | |
4336 | |
4337 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4338 | |
4339 /* while ( 1 ) | |
4340 { | |
4341 while ( 1 ) | |
4342 { | |
4343 v14 = *(int *)v10; | |
4344 v10 += 4; | |
4345 if ( v14 == v13 ) | |
4346 break; | |
4347 if ( (short)v14 == (short)v13 ) | |
4348 { | |
4349 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4350 v11 += 4; | |
4351 --uHalfWidth; | |
4352 if ( !uHalfWidth ) | |
4353 goto LABEL_21; | |
4354 } | |
4355 else | |
4356 { | |
4357 v15 = __ROL__(v14, 16); | |
4358 if ( (short)v15 == (short)v13 ) | |
4359 { | |
4360 v17 = __ROR__(v15, 16); | |
4361 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4362 v11 += 4; | |
4363 --uHalfWidth; | |
4364 if ( !uHalfWidth ) | |
4365 goto LABEL_21; | |
4366 } | |
4367 else | |
4368 { | |
4369 v16 = __ROR__(v15, 16); | |
4370 *(int *)v11 = v16; | |
4371 v11 += 4; | |
4372 --uHalfWidth; | |
4373 if ( !uHalfWidth ) | |
4374 goto LABEL_21; | |
4375 } | |
4376 } | |
4377 } | |
4378 v11 += 4; | |
4379 --uHalfWidth; | |
4380 if ( !uHalfWidth ) | |
4381 { | |
4382 LABEL_21: | |
4383 v10 += v21; | |
4384 v11 += v22; | |
4385 uHalfWidth = v20; | |
4386 if ( !--uNumLines ) | |
4387 { | |
4388 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4389 return; | |
4390 } | |
4391 } | |
4392 }*/ | |
4393 } | |
4394 } | |
4395 } | |
4396 } | |
4397 | |
4398 //----- (004A7063) -------------------------------------------------------- | |
4399 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4400 { | |
4401 float v2; // ST1C_4@1 | |
4402 double v3; // ST14_8@1 | |
4403 signed int v4; // ebx@1 | |
4404 float v5; // ST1C_4@1 | |
4405 double v6; // ST14_8@1 | |
4406 signed int v7; // edi@1 | |
4407 double v8; // ST0C_8@1 | |
4408 signed int v9; // esi@1 | |
4409 signed int v10; // ecx@1 | |
4410 double v12; // [sp+8h] [bp-18h]@1 | |
4411 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4412 | |
4413 v2 = (double)(uDiffuse >> 24) * a2; | |
4414 v3 = v2 + 6.7553994e15; | |
4415 v4 = LODWORD(v3); | |
4416 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4417 v6 = v5 + 6.7553994e15; | |
4418 v7 = LODWORD(v6); | |
4419 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4420 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4421 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4422 v9 = LODWORD(v8); | |
4423 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4424 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4425 v10 = LODWORD(v12); | |
4426 if ( v4 > 255 ) | |
4427 v4 = 255; | |
4428 if ( v4 < 0 ) | |
4429 v4 = 0; | |
4430 if ( SHIDWORD(v13) > 255 ) | |
4431 v7 = 255; | |
4432 if ( v7 < 0 ) | |
4433 v7 = 0; | |
4434 if ( (signed int)v13 > 255 ) | |
4435 v9 = 255; | |
4436 if ( v9 < 0 ) | |
4437 v9 = 0; | |
4438 if ( SLODWORD(v12) > 255 ) | |
4439 v10 = 255; | |
4440 if ( v10 < 0 ) | |
4441 v10 = 0; | |
4442 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4443 } | |
4444 | |
4445 //----- (004AD504) -------------------------------------------------------- | |
711 | 4446 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4447 { |
4448 int result; // eax@1 | |
711 | 4449 signed int v2; // ebx@1 |
0 | 4450 BLVFace *v3; // esi@3 |
4451 Texture *v4; // edi@6 | |
4452 int v5; // eax@7 | |
4453 int v6; // edx@7 | |
4454 int v7; // ecx@7 | |
4455 int v8; // ebx@8 | |
4456 int v9; // eax@8 | |
4457 int v10; // ebx@8 | |
4458 unsigned int v11; // ebx@9 | |
4459 int v12; // esi@10 | |
4460 int v13; // eax@13 | |
4461 unsigned __int16 *v14; // eax@13 | |
4462 unsigned int v15; // eax@14 | |
4463 unsigned __int16 *v16; // ebx@14 | |
4464 int v17; // eax@15 | |
4465 int v18; // ebx@15 | |
4466 int v19; // esi@15 | |
4467 int v20; // ecx@15 | |
4468 int v21; // eax@15 | |
4469 stru193_math *v22; // ebx@15 | |
4470 int v23; // eax@15 | |
4471 char *v24; // esi@16 | |
4472 int v25; // eax@18 | |
4473 int v26; // eax@18 | |
4474 int v27; // eax@20 | |
4475 signed int v28; // esi@20 | |
4476 signed int v29; // edx@20 | |
4477 signed int v30; // esi@20 | |
4478 signed int v31; // edi@20 | |
4479 int v32; // esi@20 | |
4480 int v33; // eax@26 | |
4481 int *v34; // esi@27 | |
4482 unsigned __int16 *v35; // edi@27 | |
4483 unsigned int v36; // edx@27 | |
4484 int v37; // ebx@27 | |
4485 char v38; // cl@27 | |
4486 char v39; // ch@27 | |
4487 int v40; // ebx@29 | |
4488 int v41; // edx@29 | |
4489 unsigned int v42; // ebx@30 | |
4490 int v43; // edx@30 | |
4491 int v44; // eax@33 | |
4492 int *v45; // esi@34 | |
4493 unsigned __int16 *v46; // edi@34 | |
4494 unsigned int v47; // edx@34 | |
4495 int v48; // ebx@34 | |
4496 char v49; // cl@34 | |
4497 char v50; // ch@34 | |
4498 int v51; // ebx@36 | |
4499 int v52; // edx@36 | |
4500 unsigned __int16 v53; // bx@37 | |
4501 int v54; // edx@37 | |
4502 int v55; // eax@40 | |
4503 int v56; // eax@41 | |
4504 int *v57; // esi@42 | |
4505 unsigned __int16 *v58; // edi@42 | |
4506 unsigned int v59; // edx@42 | |
4507 int v60; // ebx@42 | |
4508 char v61; // cl@42 | |
4509 char v62; // ch@42 | |
4510 unsigned int v63; // ebx@44 | |
4511 int v64; // edx@44 | |
4512 unsigned int v65; // ebx@44 | |
4513 int v66; // edx@44 | |
4514 unsigned int v67; // ebx@45 | |
4515 int v68; // edx@45 | |
4516 int v69; // ebx@45 | |
4517 int v70; // edx@45 | |
4518 int v71; // eax@48 | |
4519 int *v72; // esi@49 | |
4520 unsigned __int16 *v73; // edi@49 | |
4521 unsigned int v74; // edx@49 | |
4522 int v75; // ebx@49 | |
4523 char v76; // cl@49 | |
4524 char v77; // ch@49 | |
4525 unsigned int v78; // ebx@51 | |
4526 int v79; // edx@51 | |
4527 unsigned int v80; // ebx@51 | |
4528 int v81; // edx@51 | |
4529 unsigned int v82; // ebx@52 | |
4530 int v83; // edx@52 | |
4531 int v84; // ebx@52 | |
4532 int v85; // edx@52 | |
4533 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4534 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4535 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4536 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4537 int v90; // [sp+1Ch] [bp-88h]@20 | |
4538 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4539 int v92; // [sp+24h] [bp-80h]@7 | |
4540 int i; // [sp+28h] [bp-7Ch]@7 | |
4541 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4542 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4543 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4544 int v97; // [sp+38h] [bp-6Ch]@15 | |
4545 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4546 int v99; // [sp+40h] [bp-64h]@9 | |
4547 int v100; // [sp+44h] [bp-60h]@24 | |
4548 int v101; // [sp+48h] [bp-5Ch]@10 | |
4549 int v102; // [sp+4Ch] [bp-58h]@20 | |
4550 int v103; // [sp+50h] [bp-54h]@20 | |
4551 int v104; // [sp+54h] [bp-50h]@9 | |
4552 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4553 int v106; // [sp+5Ch] [bp-48h]@24 | |
4554 int v107; // [sp+60h] [bp-44h]@20 | |
4555 int v108; // [sp+64h] [bp-40h]@20 | |
4556 int v109; // [sp+68h] [bp-3Ch]@20 | |
4557 int v110; // [sp+6Ch] [bp-38h]@15 | |
4558 int v111; // [sp+70h] [bp-34h]@20 | |
4559 int a1; // [sp+74h] [bp-30h]@12 | |
4560 int a2; // [sp+78h] [bp-2Ch]@9 | |
4561 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4562 int v115; // [sp+80h] [bp-24h]@18 | |
4563 int v116; // [sp+84h] [bp-20h]@7 | |
4564 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4565 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4566 int *v119; // [sp+90h] [bp-14h]@13 | |
4567 int v120; // [sp+94h] [bp-10h]@15 | |
4568 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4569 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4570 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4571 | |
4572 result = pRenderer->uTargetSurfacePitch; | |
711 | 4573 v2 = sFaceID; |
0 | 4574 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4575 if ( sFaceID >= 0 ) |
4576 { | |
4577 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4578 { | |
4579 v3 = &pIndoor->pFaces[sFaceID]; | |
4580 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4581 if ( !pRenderer->pRenderD3D ) |
4582 { | |
711 | 4583 result = sub_423B5D(sFaceID); |
0 | 4584 if ( result ) |
4585 { | |
4586 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4587 if ( result ) | |
4588 { | |
4589 result = (int)v3->GetTexture(); | |
4590 v4 = (Texture *)result; | |
4591 v96 = (Texture *)result; | |
4592 if ( result ) | |
4593 { | |
4594 v5 = *(short *)(result + 38); | |
4595 LOBYTE(v3->uAttributes) |= 0x80u; | |
4596 v92 = v5; | |
4597 sub_4AE5F1(v2); | |
4598 ++pBLVRenderParams->field_84; | |
4599 v6 = stru_F8AD28.pDeltaUV[0]; | |
4600 v116 = stru_F8AD28.pDeltaUV[1]; | |
4601 v7 = 0; | |
4602 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4603 { | |
4604 v8 = v116; | |
4605 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4606 v9 = 4 * v7 + 16297672; | |
4607 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4608 } | |
4609 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4610 result = stru_F8A590._viewport_space_y; | |
4611 a2 = stru_F8A590._viewport_space_y; | |
4612 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4613 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4614 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4615 v87 = v4->pLevelOfDetail1; |
4616 v88 = v4->pLevelOfDetail2; | |
4617 v89 = v4->pLevelOfDetail3; | |
4618 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4619 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4620 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4621 { | |
4622 v12 = 2 * stru_F8A590._viewport_space_y; | |
4623 v101 = 2 * stru_F8A590._viewport_space_y; | |
4624 while ( 1 ) | |
4625 { | |
4626 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4627 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4628 if ( LOBYTE(viewparams->field_20) ) | |
4629 { | |
4630 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4631 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4632 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4633 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4634 - pBLVRenderParams->uViewportX]; | |
4635 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4636 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4637 - pBLVRenderParams->uViewportX]; | |
4638 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4639 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4640 - pBLVRenderParams->uViewportX]; | |
4641 v123 = (unsigned int)v16; | |
4642 } | |
4643 else | |
4644 { | |
4645 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4646 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4647 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4648 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4649 } | |
4650 v117 = (unsigned int)v14; | |
4651 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4652 v18 = stru_F81018.field_0.field_10; | |
4653 LOWORD(v17) = 0; | |
4654 v97 = stru_F8AD28.field_0 | v17; | |
4655 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4656 v19 = stru_F81018.field_0.field_4 >> i; | |
4657 v20 = 11 - v18; | |
4658 v116 = stru_F81018.field_0.field_8 >> i; | |
4659 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4660 v22 = stru_5C6E00; | |
4661 v122 = (unsigned __int16 *)v20; | |
323 | 4662 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4663 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4664 v120 = v116 + 4 * v23; |
4665 if ( v123 < v117 ) | |
4666 { | |
4667 v24 = (char *)&stru_F81018.field_34.field_8; | |
4668 v114 = &stru_F81018.field_34.field_8; | |
4669 a1 += 16; | |
4670 while ( 1 ) | |
4671 { | |
4672 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4673 v25 = *((int *)v24 - 2); | |
4674 LOWORD(v25) = 0; | |
4675 v115 = v97; | |
4676 v26 = stru_F8AD28.field_0 | v25; | |
4677 if ( v97 <= (unsigned int)v26 ) | |
4678 v115 = v26; | |
4679 v97 = v26; | |
4680 v27 = *((int *)v24 - 11); | |
4681 v28 = *((int *)v24 - 1); | |
4682 v105 = (&v86)[4 * v27]; | |
4683 v111 = v27 + 16; | |
4684 v29 = v4->uWidthMinus1; | |
4685 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4686 v107 = v29 >> v27; | |
4687 v30 = v28 >> i; | |
4688 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4689 v31 = *v114 >> i; | |
4690 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4691 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4692 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4693 v108 = (signed int)(v116 - v121) >> 4; |
4694 v103 = (v90 - v120) >> 4; | |
4695 v32 = v123 + 32; | |
4696 if ( LOBYTE(viewparams->field_20) ) | |
4697 v32 = v123 + 64; | |
4698 if ( v32 > v117 ) | |
4699 v32 = v117; | |
4700 v118 = v32; | |
4701 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4702 v106 = (signed int)(v32 - v123) >> 1; | |
4703 if ( v110 >> 16 == v100 >> 16 ) | |
4704 { | |
4705 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4706 if ( LOBYTE(viewparams->field_20) ) | |
4707 { | |
4708 v44 = v123; | |
4709 if ( v123 < v118 ) | |
4710 { | |
4711 v45 = v119; | |
4712 v46 = v122; | |
4713 v47 = v121; | |
4714 v48 = v120; | |
4715 v49 = v111; | |
4716 v50 = v109; | |
4717 if ( v106 & 2 ) | |
4718 { | |
4719 *v119 = v115; | |
4720 v45 -= 2; | |
4721 v44 = v123 + 4; | |
4722 goto LABEL_37; | |
4723 } | |
4724 do | |
4725 { | |
4726 v44 += 8; | |
4727 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4728 v52 = v115; | |
4729 LOWORD(v51) = v46[v51]; | |
4730 *v45 = v115; | |
4731 v45[1] = v52; | |
4732 v45[640] = v52; | |
4733 v45[641] = v52; | |
4734 *(short *)(v44 - 8) = v51; | |
4735 *(short *)(v44 - 6) = v51; | |
4736 *(short *)(v44 + 1272) = v51; | |
4737 *(short *)(v44 + 1274) = v51; | |
4738 v45[2] = v52; | |
4739 v45[3] = v52; | |
4740 v45[642] = v52; | |
4741 v45[643] = v52; | |
4742 v121 += v108; | |
4743 v120 += v103; | |
4744 v47 = v121; | |
4745 v48 = v120; | |
4746 LABEL_37: | |
4747 v45 += 4; | |
4748 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4749 v54 = v108; | |
4750 *(short *)(v44 - 4) = v53; | |
4751 *(short *)(v44 - 2) = v53; | |
4752 *(short *)(v44 + 1276) = v53; | |
4753 *(short *)(v44 + 1278) = v53; | |
4754 v121 += v54; | |
4755 v120 += v103; | |
4756 v47 = v121; | |
4757 v48 = v120; | |
4758 } | |
4759 while ( v44 < v118 ); | |
4760 v123 = v44; | |
4761 v119 = v45; | |
4762 } | |
4763 } | |
4764 else | |
4765 { | |
4766 v33 = v123; | |
4767 if ( v123 < v118 ) | |
4768 { | |
4769 v34 = v119; | |
4770 v35 = v122; | |
4771 v36 = v121; | |
4772 v37 = v120; | |
4773 v38 = v111; | |
4774 v39 = v109; | |
4775 if ( v106 & 1 ) | |
4776 { | |
4777 *v119 = v115; | |
4778 --v34; | |
4779 v33 = v123 + 2; | |
4780 goto LABEL_30; | |
4781 } | |
4782 do | |
4783 { | |
4784 v33 += 4; | |
4785 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4786 v41 = v115; | |
4787 LOWORD(v40) = v35[v40]; | |
4788 *v34 = v115; | |
4789 *(short *)(v33 - 4) = v40; | |
4790 v34[1] = v41; | |
4791 v121 += v108; | |
4792 v120 += v103; | |
4793 v36 = v121; | |
4794 v37 = v120; | |
4795 LABEL_30: | |
4796 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4797 v34 += 2; | |
4798 v43 = v108; | |
4799 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4800 v121 += v43; | |
4801 v120 += v103; | |
4802 v36 = v121; | |
4803 v37 = v120; | |
4804 } | |
4805 while ( v33 < v118 ); | |
4806 v123 = v33; | |
4807 v119 = v34; | |
4808 } | |
4809 } | |
4810 } | |
4811 else | |
4812 { | |
4813 v55 = v110 - ((v100 - v110) >> 4); | |
4814 v110 = (v100 - v110) >> 4; | |
4815 v122 = (unsigned __int16 *)v55; | |
4816 if ( LOBYTE(viewparams->field_20) ) | |
4817 { | |
4818 v71 = v123; | |
4819 if ( v123 < v118 ) | |
4820 { | |
4821 v72 = v119; | |
4822 v73 = v94; | |
4823 v74 = v121; | |
4824 v75 = v120; | |
4825 v76 = v111; | |
4826 v77 = v109; | |
4827 if ( v106 & 2 ) | |
4828 { | |
4829 *v119 = v115; | |
4830 v72 += 2; | |
4831 v71 = v123 + 4; | |
4832 goto LABEL_52; | |
4833 } | |
4834 do | |
4835 { | |
4836 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4837 v79 = (int)((char *)v122 + v110); | |
4838 v71 += 8; | |
4839 v122 = (unsigned __int16 *)v79; | |
4840 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4841 v81 = v115; | |
4842 LOWORD(v80) = v73[v80]; | |
4843 *v72 = v115; | |
4844 v72[1] = v81; | |
4845 v72[640] = v81; | |
4846 v72[641] = v81; | |
4847 *(short *)(v71 - 8) = v80; | |
4848 *(short *)(v71 - 6) = v80; | |
4849 *(short *)(v71 + 1272) = v80; | |
4850 *(short *)(v71 + 1274) = v80; | |
4851 v72[2] = v81; | |
4852 v72[3] = v81; | |
4853 v72[642] = v81; | |
4854 v72[643] = v81; | |
4855 v121 += v108; | |
4856 v120 += v103; | |
4857 v74 = v121; | |
4858 v75 = v120; | |
4859 v72 += 4; | |
4860 LABEL_52: | |
4861 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4862 v83 = (int)((char *)v122 + v110); | |
4863 v84 = v105[v82]; | |
4864 v122 = (unsigned __int16 *)v83; | |
4865 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4866 v85 = v108; | |
4867 *(short *)(v71 - 4) = v84; | |
4868 *(short *)(v71 - 2) = v84; | |
4869 *(short *)(v71 + 1276) = v84; | |
4870 *(short *)(v71 + 1278) = v84; | |
4871 v121 += v85; | |
4872 v120 += v103; | |
4873 v74 = v121; | |
4874 v75 = v120; | |
4875 } | |
4876 while ( v71 < v118 ); | |
4877 v123 = v71; | |
4878 v119 = v72; | |
4879 } | |
4880 } | |
4881 else | |
4882 { | |
4883 v56 = v123; | |
4884 if ( v123 < v118 ) | |
4885 { | |
4886 v57 = v119; | |
4887 v58 = v94; | |
4888 v59 = v121; | |
4889 v60 = v120; | |
4890 v61 = v111; | |
4891 v62 = v109; | |
4892 if ( v106 & 1 ) | |
4893 { | |
4894 *v119 = v115; | |
4895 ++v57; | |
4896 v56 = v123 + 2; | |
4897 goto LABEL_45; | |
4898 } | |
4899 do | |
4900 { | |
4901 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4902 v64 = (int)((char *)v122 + v110); | |
4903 v56 += 4; | |
4904 v122 = (unsigned __int16 *)v64; | |
4905 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4906 v66 = v115; | |
4907 LOWORD(v65) = v58[v65]; | |
4908 *v57 = v115; | |
4909 *(short *)(v56 - 4) = v65; | |
4910 v57[1] = v66; | |
4911 v121 += v108; | |
4912 v120 += v103; | |
4913 v59 = v121; | |
4914 v60 = v120; | |
4915 v57 += 2; | |
4916 LABEL_45: | |
4917 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4918 v68 = (int)((char *)v122 + v110); | |
4919 v69 = v105[v67]; | |
4920 v122 = (unsigned __int16 *)v68; | |
4921 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4922 v70 = v108; | |
4923 *(short *)(v56 - 2) = v69; | |
4924 v121 += v70; | |
4925 v120 += v103; | |
4926 v59 = v121; | |
4927 v60 = v120; | |
4928 } | |
4929 while ( v56 < v118 ); | |
4930 v123 = v56; | |
4931 v119 = v57; | |
4932 } | |
4933 } | |
4934 } | |
4935 v114 += 13; | |
4936 v110 = v100; | |
4937 a1 += 16; | |
4938 v4 = v96; | |
4939 v121 = v116; | |
4940 v120 = v90; | |
4941 if ( v123 >= v117 ) | |
4942 break; | |
4943 v24 = (char *)v114; | |
4944 v22 = stru_5C6E00; | |
4945 } | |
4946 } | |
4947 ++a2; | |
4948 v98 += v95; | |
4949 result = a2; | |
4950 v101 += 2; | |
4951 v99 += 640; | |
4952 if ( a2 > stru_F8A590._viewport_space_w ) | |
4953 break; | |
4954 v12 = v101; | |
4955 result = a2; | |
4956 v11 = v98; | |
4957 } | |
4958 } | |
4959 } | |
4960 } | |
4961 } | |
4962 } | |
4963 } | |
4964 } | |
4965 return result; | |
4966 } | |
4967 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4968 | |
4969 //----- (004ADD1D) -------------------------------------------------------- | |
4970 void __fastcall sub_4ADD1D(int uFaceID) | |
4971 { | |
4972 int v1; // edi@1 | |
4973 BLVFace *v2; // esi@3 | |
4974 signed int v3; // ebx@4 | |
4975 Texture *v4; // edi@9 | |
4976 signed int v5; // eax@9 | |
4977 char *v6; // edi@12 | |
4978 signed int v7; // eax@15 | |
4979 unsigned int v8; // eax@16 | |
4980 __int16 v9; // cx@19 | |
4981 unsigned __int8 *v10; // eax@19 | |
4982 unsigned __int16 *v11; // eax@19 | |
4983 int v12; // edi@19 | |
4984 int v13; // ebx@20 | |
4985 stru352 *v14; // esi@20 | |
4986 DWORD v15; // eax@22 | |
4987 signed int v16; // ecx@22 | |
4988 signed int v17; // ST68_4@22 | |
4989 int v18; // eax@22 | |
4990 int v19; // ecx@22 | |
4991 unsigned int v20; // esi@23 | |
4992 int v21; // edi@23 | |
4993 int v22; // eax@23 | |
4994 int *v23; // ebx@24 | |
4995 int v24; // edx@24 | |
4996 int v25; // ebx@25 | |
4997 unsigned __int16 v26; // cx@25 | |
4998 int v27; // edx@26 | |
4999 unsigned __int16 v28; // cx@26 | |
5000 unsigned __int8 v29; // sf@27 | |
5001 unsigned __int8 v30; // of@27 | |
5002 unsigned int v31; // esi@29 | |
5003 int v32; // edi@29 | |
5004 unsigned __int16 *v33; // eax@29 | |
5005 int *v34; // ebx@30 | |
5006 int v35; // edx@30 | |
5007 int v36; // ebx@31 | |
5008 unsigned __int16 v37; // cx@31 | |
5009 int v38; // edx@32 | |
5010 unsigned __int16 v39; // cx@32 | |
5011 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5012 int v41; // [sp-Ch] [bp-68h]@15 | |
5013 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5014 signed int v43; // [sp+14h] [bp-48h]@12 | |
5015 signed int v44; // [sp+14h] [bp-48h]@22 | |
5016 int v45; // [sp+1Ch] [bp-40h]@22 | |
5017 int v46; // [sp+20h] [bp-3Ch]@22 | |
5018 int v47; // [sp+24h] [bp-38h]@19 | |
5019 char v48; // [sp+28h] [bp-34h]@19 | |
5020 int v49; // [sp+2Ch] [bp-30h]@19 | |
5021 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5022 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5023 int v52; // [sp+38h] [bp-24h]@22 | |
5024 int v53; // [sp+3Ch] [bp-20h]@22 | |
5025 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5026 int v55; // [sp+40h] [bp-1Ch]@20 | |
5027 int v56; // [sp+44h] [bp-18h]@20 | |
5028 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5029 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5030 int v59; // [sp+50h] [bp-Ch]@4 | |
5031 int v60; // [sp+50h] [bp-Ch]@19 | |
5032 int v61; // [sp+54h] [bp-8h]@22 | |
5033 int *v62; // [sp+58h] [bp-4h]@23 | |
5034 int *v63; // [sp+58h] [bp-4h]@29 | |
5035 | |
5036 v1 = uFaceID; | |
5037 v42 = pRenderer->uTargetSurfacePitch; | |
5038 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5039 { | |
5040 v2 = &pIndoor->pFaces[uFaceID]; | |
5041 if ( pRenderer->pRenderD3D ) | |
5042 { | |
5043 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5044 v59 = v3; | |
5045 } | |
5046 else | |
5047 { | |
5048 v59 = sub_423B5D(uFaceID); | |
5049 v3 = v59; | |
5050 } | |
5051 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5052 { | |
5053 v4 = v2->GetTexture(); | |
5054 v5 = 0; | |
5055 if ( v4 ) | |
5056 { | |
5057 if ( pRenderer->pRenderD3D ) | |
5058 { | |
5059 if ( v3 > 0 ) | |
5060 { | |
5061 v54 = v3; | |
5062 v43 = v3; | |
5063 v6 = (char *)&array_507D30[0].v; | |
5064 do | |
5065 { | |
5066 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5067 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5068 v6 += 48; | |
5069 --v54; | |
5070 } | |
5071 while ( v54 ); | |
5072 v3 = v59; | |
5073 v5 = v43; | |
5074 } | |
5075 v7 = v5; | |
5076 v41 = stru_F8AD28.field_0; | |
5077 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5078 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5079 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5080 { | |
5081 v40 = v2->GetTexture(); | |
5082 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5083 } | |
5084 else | |
5085 { | |
5086 v40 = v2->GetTexture(); | |
5087 v8 = v2->uBitmapID; | |
5088 } | |
5089 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5090 } | |
5091 else | |
5092 { | |
5093 v49 = v4->uWidthMinus1; | |
5094 v47 = v4->uHeightMinus1 << 16; | |
5095 v9 = 16 - v4->uWidthLn2; | |
710 | 5096 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5097 LOBYTE(v2->uAttributes) |= 0x80u; |
5098 v48 = v9; | |
5099 v50 = v10; | |
5100 sub_4AF412(); | |
5101 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5102 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5103 v12 = stru_F8A590._viewport_space_y; | |
5104 v51 = v11; | |
5105 v60 = stru_F8A590._viewport_space_y; | |
5106 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5107 { | |
5108 v13 = 2 * stru_F8A590._viewport_space_y; | |
5109 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5110 v55 = 2 * stru_F8A590._viewport_space_y; | |
5111 v56 = 640 * stru_F8A590._viewport_space_y; | |
5112 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5113 { | |
5114 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5115 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5116 v15 = GetTickCount(); | |
5117 v16 = v14->field_0; | |
5118 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5119 v45 = v14->field_4 >> 3; | |
5120 v44 = v16 >> 3; | |
5121 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5122 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5123 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5124 v18 = v14->field_28; | |
5125 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5126 LOWORD(v18) = 0; | |
5127 v46 = stru_F8AD28.field_0 | v18; | |
5128 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5129 if ( LOBYTE(viewparams->field_20) ) | |
5130 { | |
5131 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5132 - pBLVRenderParams->uViewportX]; | |
5133 v31 = v44; | |
5134 v32 = v45; | |
5135 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5136 + 2 * v19 | |
5137 - pBLVRenderParams->uViewportX]; | |
5138 if ( v61 & 1 ) | |
5139 { | |
5140 --v61; | |
5141 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5142 + 2 * v19 | |
5143 - pBLVRenderParams->uViewportX | |
5144 - 2]; | |
5145 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5146 - pBLVRenderParams->uViewportX]; | |
5147 v35 = v46; | |
5148 v63 += 2; | |
5149 goto LABEL_32; | |
5150 } | |
5151 while ( 1 ) | |
5152 { | |
5153 v30 = __OFSUB__(v61, 2); | |
5154 v29 = v61 - 2 < 0; | |
5155 v61 -= 2; | |
5156 if ( v29 ^ v30 ) | |
5157 break; | |
5158 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5159 v31 += v52; | |
5160 v37 = v51[v36]; | |
5161 v32 += v53; | |
5162 v34 = v63; | |
5163 v35 = v46; | |
5164 *v33 = v37; | |
5165 v33[1] = v37; | |
5166 v33[640] = v37; | |
5167 v33[641] = v37; | |
5168 v63 += 4; | |
5169 v34[2] = v46; | |
5170 v34[3] = v46; | |
5171 v34[642] = v46; | |
5172 v34[643] = v46; | |
5173 LABEL_32: | |
5174 *v34 = v35; | |
5175 v34[1] = v35; | |
5176 v34[640] = v35; | |
5177 v34[641] = v35; | |
5178 v38 = v49 & (v31 >> 16); | |
5179 v33 += 4; | |
5180 v31 += v52; | |
5181 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5182 v32 += v53; | |
5183 *(v33 - 2) = v39; | |
5184 *(v33 - 1) = v39; | |
5185 v33[638] = v39; | |
5186 v33[639] = v39; | |
5187 } | |
5188 } | |
5189 else | |
5190 { | |
5191 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5192 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5193 v20 = v44; | |
5194 v21 = v45; | |
5195 v22 = (int)v58; | |
5196 if ( v61 & 1 ) | |
5197 { | |
5198 --v61; | |
5199 v22 = (int)(v58 - 1); | |
5200 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5201 v24 = v46; | |
5202 ++v62; | |
5203 goto LABEL_26; | |
5204 } | |
5205 while ( 1 ) | |
5206 { | |
5207 v30 = __OFSUB__(v61, 2); | |
5208 v29 = v61 - 2 < 0; | |
5209 v61 -= 2; | |
5210 if ( v29 ^ v30 ) | |
5211 break; | |
5212 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5213 v20 += v52; | |
5214 v26 = v51[v25]; | |
5215 v21 += v53; | |
5216 v23 = v62; | |
5217 v24 = v46; | |
5218 *(short *)v22 = v26; | |
5219 v62 += 2; | |
5220 v23[1] = v46; | |
5221 LABEL_26: | |
5222 *v23 = v24; | |
5223 v27 = v49 & (v20 >> 16); | |
5224 v22 += 4; | |
5225 v20 += v52; | |
5226 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5227 v21 += v53; | |
5228 *(short *)(v22 - 2) = v28; | |
5229 } | |
5230 } | |
5231 ++v60; | |
5232 ++i; | |
5233 v56 += 640; | |
5234 v55 += 2; | |
5235 if ( v60 > stru_F8A590._viewport_space_w ) | |
5236 break; | |
5237 v13 = v55; | |
5238 v12 = v60; | |
5239 } | |
5240 } | |
5241 } | |
5242 } | |
5243 } | |
5244 } | |
5245 } | |
5246 | |
5247 //----- (004AE1E7) -------------------------------------------------------- | |
5248 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5249 { | |
5250 int v3; // ebx@1 | |
5251 int v4; // edi@1 | |
5252 int v5; // esi@1 | |
5253 signed __int64 v6; // qtt@3 | |
5254 int v7; // esi@3 | |
5255 int v8; // eax@5 | |
5256 int result; // eax@5 | |
5257 int v10; // edx@5 | |
5258 int v11; // [sp+Ch] [bp-8h]@1 | |
5259 int v12; // [sp+1Ch] [bp+8h]@2 | |
5260 | |
5261 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5262 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5263 v11 = a1; | |
5264 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5265 + stru_F8AD28.field_7C | |
5266 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5267 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5268 { | |
5269 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5270 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5271 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5272 } | |
5273 else | |
5274 { | |
5275 v7 = 1073741824; | |
5276 } | |
5277 v8 = stru_F8AD28.vec_9C.z; | |
5278 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5279 + stru_F8AD28.vec_8C.x | |
5280 + v4 * stru_F8AD28.vec_8C.y) | |
5281 * (signed __int64)v7) >> 16) | |
5282 + stru_F8AD28.field_98; | |
5283 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5284 v10 = result + stru_F8AD28.field_A8; | |
5285 stru_F83B80[v11].field_28 = v7; | |
5286 stru_F83B80[v11].field_4 = v10; | |
5287 return result; | |
5288 } | |
5289 | |
5290 //----- (004AE313) -------------------------------------------------------- | |
5291 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5292 { | |
5293 int _dy; // ebx@1 | |
5294 int _dx; // edi@1 | |
5295 int v5; // ecx@1 | |
5296 int v6; // esi@1 | |
5297 int v7; // ST18_4@2 | |
5298 signed __int64 v8; // qtt@3 | |
5299 unsigned int v9; // ecx@3 | |
5300 int result; // eax@8 | |
5301 int v11; // [sp+Ch] [bp-8h]@1 | |
5302 | |
5303 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5304 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5305 ++pBLVRenderParams->field_88; | |
5306 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5307 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5308 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5309 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5310 { | |
5311 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5312 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5313 v9 = v8 / v11; | |
5314 } | |
5315 else | |
5316 { | |
5317 v9 = 0x40000000u; | |
5318 } | |
5319 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5320 p->field_0 = v9; | |
5321 else | |
5322 p->field_0 = stru_F8AD28.field_34; | |
5323 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5324 * (signed __int64)(signed int)v9) >> 16) | |
5325 + stru_F8AD28.field_98 | |
5326 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5327 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5328 * (signed __int64)(signed int)v9) >> 16) | |
5329 + stru_F8AD28.field_A8 | |
5330 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5331 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5332 if ( result < 369620 || bUseLoResSprites ) | |
5333 { | |
5334 if ( result < 184810 ) | |
5335 p->field_10 = result > 92405; | |
5336 else | |
5337 p->field_10 = 2; | |
5338 } | |
5339 else | |
5340 { | |
5341 p->field_10 = 3; | |
5342 } | |
5343 return result; | |
5344 } | |
5345 | |
5346 //----- (004AE491) -------------------------------------------------------- | |
5347 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5348 { | |
5349 signed int v2; // eax@1 | |
5350 signed int v3; // edi@1 | |
5351 int v4; // ecx@1 | |
5352 int v5; // esi@2 | |
5353 int v6; // eax@2 | |
5354 int v7; // ebx@2 | |
5355 unsigned int v8; // ecx@2 | |
5356 int v9; // edx@5 | |
5357 int v10; // edx@7 | |
5358 unsigned int v11; // eax@8 | |
5359 int v13; // [sp+4h] [bp-18h]@2 | |
5360 int v14; // [sp+8h] [bp-14h]@2 | |
5361 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5362 int v16; // [sp+14h] [bp-8h]@1 | |
5363 int v17; // [sp+18h] [bp-4h]@1 | |
5364 | |
5365 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5366 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5367 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5368 v4 = 0; | |
5369 v15 = v2; | |
5370 v16 = 0; | |
5371 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5372 { | |
5373 do | |
5374 { | |
5375 v5 = v16; | |
5376 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5377 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5378 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5379 v7 = v13; | |
5380 v8 = v14; | |
5381 if ( v6 < v13 ) | |
5382 { | |
5383 v6 = v13; | |
5384 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5385 } | |
5386 if ( v6 < v14 ) | |
5387 { | |
5388 v9 = v6; | |
5389 v6 = v14; | |
5390 v8 = v9; | |
5391 } | |
5392 if ( v7 < (signed int)v8 ) | |
5393 { | |
5394 v10 = v8; | |
5395 v8 = v7; | |
5396 v7 = v10; | |
5397 } | |
5398 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5399 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5400 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5401 ++v16; | |
5402 v2 = v15; | |
5403 } | |
5404 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5405 v4 = 0; | |
5406 } | |
5407 if ( stru_F8AD28.field_3E4 != v4 ) | |
5408 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5409 if ( v17 >= v4 ) | |
5410 { | |
5411 if ( v17 > 2031616 ) | |
5412 v17 = 2031616; | |
5413 } | |
5414 else | |
5415 { | |
5416 v17 = v4; | |
5417 } | |
5418 ++pBLVRenderParams->field_8C; | |
5419 return v17; | |
5420 } | |
5421 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5422 | |
5423 //----- (004AE5F1) -------------------------------------------------------- | |
5424 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5425 { | |
5426 BLVFace *v1; // esi@1 | |
5427 BLVFaceExtra *v2; // ebx@1 | |
5428 int v3; // eax@1 | |
5429 int v4; // edi@1 | |
5430 Texture *v5; // edi@1 | |
5431 int v6; // eax@1 | |
5432 unsigned int v7; // eax@1 | |
5433 unsigned int v8; // ecx@1 | |
5434 unsigned int v9; // eax@1 | |
5435 unsigned int v10; // ecx@5 | |
5436 int v11; // edi@10 | |
5437 int v12; // ecx@10 | |
5438 int v13; // eax@10 | |
5439 int v14; // edx@10 | |
5440 int v15; // ebx@12 | |
5441 double v16; // st7@16 | |
5442 int v17; // eax@16 | |
5443 char *v18; // ebx@17 | |
5444 int v19; // ecx@19 | |
5445 int v20; // eax@19 | |
5446 int v21; // edx@21 | |
5447 int v22; // eax@23 | |
5448 int v23; // ST04_4@26 | |
5449 int v24; // edi@26 | |
5450 double v25; // st6@26 | |
5451 int v26; // eax@26 | |
5452 double v27; // st6@26 | |
5453 int v28; // ecx@26 | |
5454 char v29; // al@26 | |
5455 int v30; // edx@28 | |
5456 int v31; // ecx@28 | |
5457 BLVLightMM7 *v32; // ecx@32 | |
5458 int v33; // edi@33 | |
5459 int v34; // edx@33 | |
5460 int v35; // eax@33 | |
5461 int v36; // edi@35 | |
5462 int v37; // edx@37 | |
5463 int v38; // ebx@39 | |
5464 int v39; // edi@42 | |
5465 int v40; // eax@42 | |
5466 char *v41; // ebx@45 | |
5467 signed int v42; // ecx@47 | |
5468 int v43; // edi@47 | |
5469 int v44; // eax@49 | |
5470 int v45; // edx@51 | |
5471 int v46; // eax@53 | |
5472 int v47; // ST04_4@55 | |
5473 int v48; // edi@55 | |
5474 double v49; // st6@55 | |
5475 int v50; // eax@55 | |
5476 double v51; // st6@55 | |
5477 int v52; // eax@55 | |
5478 int v53; // ecx@57 | |
5479 int v54; // ecx@58 | |
5480 int v55; // ecx@59 | |
5481 int v56; // edx@62 | |
5482 int v57; // ecx@62 | |
5483 int v58; // eax@63 | |
5484 int v59; // edx@64 | |
5485 int v60; // ecx@67 | |
5486 int v61; // edx@67 | |
5487 int v62; // eax@68 | |
5488 int v63; // edx@69 | |
5489 signed int v64; // ecx@72 | |
5490 double v65; // st7@75 | |
5491 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5492 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5493 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5494 int v69; // [sp+28h] [bp-18h]@10 | |
5495 int v70; // [sp+2Ch] [bp-14h]@10 | |
5496 int X; // [sp+30h] [bp-10h]@10 | |
5497 int v72; // [sp+34h] [bp-Ch]@10 | |
5498 int v73; // [sp+38h] [bp-8h]@10 | |
5499 int v74; // [sp+3Ch] [bp-4h]@10 | |
5500 | |
5501 v1 = &pIndoor->pFaces[uFaceID]; | |
5502 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5503 v3 = v1->uBitmapID; | |
5504 v4 = v1->uBitmapID; | |
5505 v68 = v2; | |
5506 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5507 v6 = 8 * uFaceID; | |
5508 LOBYTE(v6) = 8 * uFaceID | 6; | |
5509 stru_F8AD28.field_0 = v6; | |
5510 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5511 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5512 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5513 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5514 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5515 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5516 v7 = GetTickCount(); | |
5517 v8 = v1->uAttributes; | |
5518 v9 = v7 >> 3; | |
5519 if ( v8 & 4 ) | |
5520 { | |
5521 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5522 } | |
5523 else | |
5524 { | |
5525 if ( v8 & 0x20 ) | |
5526 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5527 } | |
5528 v10 = v1->uAttributes; | |
5529 if ( BYTE1(v10) & 8 ) | |
5530 { | |
5531 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5532 } | |
5533 else | |
5534 { | |
5535 if ( v10 & 0x40 ) | |
5536 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5537 } | |
5538 v1->_get_normals(&v67, &v66); | |
5539 stru_F8AD28.vec_14.x = v67.x; | |
5540 stru_F8AD28.vec_14.y = v67.y; | |
5541 stru_F8AD28.vec_14.z = v67.z; | |
5542 stru_F8AD28.vec_20.x = v66.x; | |
5543 stru_F8AD28.vec_20.y = v66.y; | |
5544 stru_F8AD28.vec_20.z = v66.z; | |
5545 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5546 if ( pBLVRenderParams->sPartyRotX ) | |
5547 { | |
5548 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5549 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5550 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5551 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5552 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5553 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5554 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5555 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5556 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5557 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5558 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5559 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5560 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5561 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5562 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5563 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5564 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5565 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5566 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5567 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5568 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5569 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5570 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5571 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5572 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5573 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5574 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5575 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5576 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5577 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5578 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5579 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5580 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5581 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5582 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5583 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5584 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5585 v13 = pBLVRenderParams->vPartyPos.y; | |
5586 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5587 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5588 v14 = pBLVRenderParams->vPartyPos.x; | |
5589 } | |
5590 else | |
5591 { | |
5592 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5593 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5594 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5595 - v70; | |
5596 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5597 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5598 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5599 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5600 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5601 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5602 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5603 - v70; | |
5604 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5605 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5606 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5607 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5608 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5609 - v70; | |
5610 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5611 v14 = pBLVRenderParams->vPartyPos.x; | |
5612 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5613 v13 = pBLVRenderParams->vPartyPos.y; | |
5614 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5615 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5616 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5617 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5618 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5619 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5620 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5621 } | |
5622 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5623 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5624 + stru_F8AD28.plane_4.dist | |
5625 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5626 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5627 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5628 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5629 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5630 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5631 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5632 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5633 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5634 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5635 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5636 v15 = v70; | |
5637 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5638 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5639 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5640 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5641 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5642 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5643 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5644 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5645 stru_F8AD28.field_38 = 0; | |
5646 stru_F8AD28.field_A8 = -(X | |
5647 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5648 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5649 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5650 { | |
5651 stru_F8AD28.field_3E4 = 1; | |
5652 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5653 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5654 stru_F8AD28.field_3F0 = v68->field_1E; | |
5655 stru_F8AD28.field_3F4 = v68->field_20; | |
5656 } | |
5657 else | |
5658 { | |
5659 stru_F8AD28.field_3E4 = 0; | |
5660 } | |
5661 v16 = 0.0039215689; | |
5662 v17 = 116 * v1->uSectorID; | |
5663 v69 = v17; | |
5664 v74 = 0; | |
5665 v73 = 0; | |
5666 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5667 v70 = pMobileLightsStack->uNumLightsActive; | |
5668 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5669 { | |
5670 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5671 do | |
5672 { | |
5673 if ( v74 >= 20 ) | |
5674 break; | |
5675 v19 = *((short *)v18 + 2); | |
5676 v20 = *((short *)v18 - 1); | |
5677 if ( v20 > v1->pBounding.x1 - v19 ) | |
5678 { | |
5679 if ( v20 < v19 + v1->pBounding.x2 ) | |
5680 { | |
5681 v21 = *(short *)v18; | |
5682 if ( v21 > v1->pBounding.y1 - v19 ) | |
5683 { | |
5684 if ( v21 < v19 + v1->pBounding.y2 ) | |
5685 { | |
5686 v22 = *((short *)v18 + 1); | |
5687 if ( v22 > v1->pBounding.z1 - v19 ) | |
5688 { | |
5689 if ( v22 < v19 + v1->pBounding.z2 ) | |
5690 { | |
5691 X = (v1->pFacePlane_old.dist | |
5692 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5693 + v21 * v1->pFacePlane_old.vNormal.y | |
5694 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5695 if ( X <= v19 ) | |
5696 { | |
5697 v23 = X; | |
5698 v24 = v74; | |
5699 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5700 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5701 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5702 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5703 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5704 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5705 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5706 v25 = (double)(signed int)v68 * v16; | |
5707 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5708 v26 = (unsigned __int8)v18[8]; | |
5709 *(float *)(v24 * 4 + 16297992) = v25; | |
5710 v27 = (double)(signed int)v68; | |
5711 v68 = (BLVFaceExtra *)v26; | |
5712 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5713 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5714 v16 = 0.0039215689; | |
5715 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5716 v28 = v74; | |
5717 v29 = v18[9]; | |
5718 ++v74; | |
5719 stru_F8AD28._blv_lights_types[v28] = v29; | |
5720 } | |
5721 } | |
5722 } | |
5723 } | |
5724 } | |
5725 } | |
5726 } | |
5727 ++v73; | |
5728 v18 += 18; | |
5729 v17 = v69; | |
5730 } | |
5731 while ( v73 < v70 ); | |
5732 } | |
5733 v30 = 0; | |
5734 v73 = 0; | |
5735 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5736 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5737 if ( v31 > 0 ) | |
5738 { | |
5739 while ( v74 < 20 ) | |
5740 { | |
5741 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5742 if ( !(v32->uAtributes & 8) ) | |
5743 { | |
5744 v33 = v1->pBounding.x1; | |
5745 v34 = v32->vPosition.x; | |
5746 X = v32->uBrightness; | |
5747 v35 = v32->uRadius; | |
5748 v68 = (BLVFaceExtra *)v32->uRadius; | |
5749 if ( v34 > v33 - v35 ) | |
5750 { | |
5751 if ( v34 < v35 + v1->pBounding.x2 ) | |
5752 { | |
5753 v36 = v32->vPosition.y; | |
5754 if ( v36 > v1->pBounding.y1 - v35 ) | |
5755 { | |
5756 if ( v36 < v35 + v1->pBounding.y2 ) | |
5757 { | |
5758 v37 = v32->vPosition.z; | |
5759 if ( v37 > v1->pBounding.z1 - v35 ) | |
5760 { | |
5761 if ( v37 < v35 + v1->pBounding.z2 ) | |
5762 { | |
5763 v38 = (v1->pFacePlane_old.dist | |
5764 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5765 + v37 * v1->pFacePlane_old.vNormal.z | |
5766 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5767 if ( v38 >= 0 ) | |
5768 { | |
5769 if ( v38 <= v35 && v35 ) | |
5770 { | |
5771 v39 = v74; | |
5772 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5773 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5774 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5775 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5776 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5777 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5778 v68 = (BLVFaceExtra *)v32->uRed; | |
5779 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5780 v68 = (BLVFaceExtra *)v32->uGreen; | |
5781 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5782 v68 = (BLVFaceExtra *)v32->uBlue; | |
5783 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5784 v16 = 0.0039215689; | |
5785 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5786 v40 = v74++; | |
5787 stru_F8AD28._blv_lights_types[v40] = 1; | |
5788 } | |
5789 } | |
5790 } | |
5791 } | |
5792 } | |
5793 } | |
5794 } | |
5795 } | |
5796 } | |
5797 v30 = v73++ + 1; | |
5798 if ( v73 >= v70 ) | |
5799 break; | |
5800 v17 = v69; | |
5801 } | |
5802 } | |
5803 v73 = 0; | |
5804 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5805 { | |
5806 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5807 do | |
5808 { | |
5809 if ( v74 >= 20 ) | |
5810 break; | |
5811 v42 = *((short *)v41 + 2); | |
5812 v43 = *((short *)v41 - 1); | |
5813 if ( v43 > v1->pBounding.x1 - v42 ) | |
5814 { | |
5815 if ( v43 < v42 + v1->pBounding.x2 ) | |
5816 { | |
5817 v44 = *(short *)v41; | |
5818 if ( v44 > v1->pBounding.y1 - v42 ) | |
5819 { | |
5820 if ( v44 < v42 + v1->pBounding.y2 ) | |
5821 { | |
5822 v45 = *((short *)v41 + 1); | |
5823 if ( v45 > v1->pBounding.z1 - v42 ) | |
5824 { | |
5825 if ( v45 < v42 + v1->pBounding.z2 ) | |
5826 { | |
5827 v46 = (v1->pFacePlane_old.dist | |
5828 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5829 + v43 * v1->pFacePlane_old.vNormal.x | |
5830 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5831 v69 = v46; | |
5832 if ( v46 >= 0 ) | |
5833 { | |
5834 if ( v46 <= v42 ) | |
5835 { | |
5836 v47 = v69; | |
5837 v48 = v74; | |
5838 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5839 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5840 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5841 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5842 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5843 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5844 v49 = (double)(signed int)v68 * v16; | |
5845 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5846 v50 = (unsigned __int8)v41[8]; | |
5847 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5848 v51 = (double)(signed int)v68; | |
5849 v68 = (BLVFaceExtra *)v50; | |
5850 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5851 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5852 v16 = 0.0039215689; | |
5853 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5854 v52 = v74++; | |
5855 stru_F8AD28._blv_lights_types[v52] = 1; | |
5856 } | |
5857 } | |
5858 } | |
5859 } | |
5860 } | |
5861 } | |
5862 } | |
5863 } | |
5864 ++v73; | |
5865 v41 += 12; | |
5866 } | |
5867 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5868 } | |
5869 stru_F8AD28.uNumLightsApplied = v74; | |
5870 v53 = v1->pBounding.x2; | |
5871 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5872 { | |
5873 v55 = v1->pBounding.x1; | |
5874 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5875 v54 = 0; | |
5876 else | |
5877 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5878 } | |
5879 else | |
5880 { | |
5881 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5882 } | |
5883 v56 = v1->pBounding.y2; | |
5884 v57 = v54 * v54; | |
5885 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5886 { | |
5887 v59 = v1->pBounding.y1; | |
5888 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5889 v58 = 0; | |
5890 else | |
5891 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5892 } | |
5893 else | |
5894 { | |
5895 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5896 } | |
5897 v60 = v58 * v58 + v57; | |
5898 v61 = v1->pBounding.z2; | |
5899 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5900 { | |
5901 v63 = v1->pBounding.z1; | |
5902 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5903 v62 = 0; | |
5904 else | |
5905 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5906 } | |
5907 else | |
5908 { | |
5909 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5910 } | |
5911 v64 = v62 * v62 + v60; | |
5912 if ( v64 ) | |
295 | 5913 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5914 else |
5915 stru_F8AD28.field_34 = 0; | |
5916 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5917 v65 = (double)(signed int)v68; | |
5918 if ( v65 >= 655.36 ) | |
5919 { | |
5920 if ( v65 >= 26214.4 ) | |
5921 { | |
5922 if ( v65 >= 45875.2 ) | |
5923 { | |
5924 stru_F8AD28.field_44 = 8; | |
5925 stru_F8AD28.field_48 = 3; | |
5926 } | |
5927 else | |
5928 { | |
5929 stru_F8AD28.field_44 = 16; | |
5930 stru_F8AD28.field_48 = 4; | |
5931 } | |
5932 } | |
5933 else | |
5934 { | |
5935 stru_F8AD28.field_44 = 32; | |
5936 stru_F8AD28.field_48 = 5; | |
5937 } | |
5938 } | |
5939 else | |
5940 { | |
5941 stru_F8AD28.field_44 = 64; | |
5942 stru_F8AD28.field_48 = 6; | |
5943 } | |
5944 } | |
5945 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5946 | |
5947 //----- (004AF412) -------------------------------------------------------- | |
5948 int __cdecl sub_4AF412() | |
5949 { | |
5950 int v0; // ST20_4@2 | |
5951 int v1; // ST20_4@2 | |
5952 int v2; // ST20_4@2 | |
5953 int v3; // esi@2 | |
5954 int v4; // ST20_4@2 | |
5955 int v5; // ecx@2 | |
5956 int v6; // ebx@2 | |
5957 int v7; // edi@2 | |
5958 int v8; // edx@2 | |
5959 int v9; // eax@2 | |
5960 int result; // eax@4 | |
5961 | |
5962 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5963 stru_F8AD28.vec_20.y = -65536; | |
5964 stru_F8AD28.plane_4.vNormal.x = 0; | |
5965 stru_F8AD28.plane_4.vNormal.y = 0; | |
5966 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5967 stru_F8AD28.vec_14.x = 65536; | |
5968 stru_F8AD28.vec_14.y = 0; | |
5969 stru_F8AD28.vec_14.z = 0; | |
5970 stru_F8AD28.vec_20.x = 0; | |
5971 stru_F8AD28.vec_20.z = 0; | |
5972 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5973 if ( pBLVRenderParams->sPartyRotX ) | |
5974 { | |
5975 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5976 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5977 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5978 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5979 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5980 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5981 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5982 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5983 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5984 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5985 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5986 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5987 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5988 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5989 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5990 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5991 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5992 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5993 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5994 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5995 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5996 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5997 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5998 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5999 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6000 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6001 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6002 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6003 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6004 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6005 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6006 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6007 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6008 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6009 v6 = pBLVRenderParams->vPartyPos.z; | |
6010 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6011 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6012 v8 = pBLVRenderParams->vPartyPos.y; | |
6013 v9 = pBLVRenderParams->vPartyPos.x; | |
6014 } | |
6015 else | |
6016 { | |
6017 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6018 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6019 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6020 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6021 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6022 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6023 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6024 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6025 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6026 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6027 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6028 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6029 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6030 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6031 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6032 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6033 v8 = pBLVRenderParams->vPartyPos.y; | |
6034 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6035 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6036 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6037 v9 = pBLVRenderParams->vPartyPos.x; | |
6038 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6039 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6040 v6 = pBLVRenderParams->vPartyPos.z; | |
6041 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6042 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6043 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6044 } | |
6045 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6046 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6047 + stru_F8AD28.plane_4.dist | |
6048 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6049 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6050 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6051 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6052 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6053 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6054 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6055 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6056 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6057 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6058 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6059 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6060 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6061 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6062 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6063 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6064 result = 0; | |
6065 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6066 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6067 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6068 stru_F8AD28.field_38 = 0; | |
6069 stru_F8AD28.field_3E4 = 0; | |
6070 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6071 stru_F8AD28.uNumLightsApplied = 0; | |
6072 stru_F8AD28.field_34 = 0; | |
6073 return result; | |
6074 } | |
6075 | |
6076 //----- (004B1447) -------------------------------------------------------- | |
6077 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6078 { | |
6079 signed int v3; // esi@1 | |
6080 char v4; // sf@8 | |
6081 int v5; // eax@8 | |
6082 unsigned __int64 v6; // qax@12 | |
6083 DDM_DLV_Header *v7; // eax@14 | |
6084 Player **v8; // edi@18 | |
6085 Player *result; // eax@19 | |
735 | 6086 //char *v10; // esi@20 |
0 | 6087 |
6088 v3 = 0; | |
6089 if ( a2 ) | |
6090 { | |
6091 if ( a2 != 1 ) | |
6092 { | |
6093 if ( a2 == 2 ) | |
6094 v3 = 2; | |
6095 goto LABEL_13; | |
6096 } | |
6097 v3 = 2; | |
6098 } | |
6099 else | |
6100 { | |
6101 v3 = 1; | |
6102 } | |
6103 if ( pParty->uFine < 4000000 ) | |
6104 { | |
6105 v4 = a3 + pParty->uFine < 0; | |
6106 v5 = a3 + pParty->uFine; | |
6107 pParty->uFine += a3; | |
6108 if ( v4 ) | |
6109 { | |
6110 v5 = 0; | |
6111 pParty->uFine = 0; | |
6112 } | |
6113 if ( v5 > 4000000 ) | |
6114 pParty->uFine = 4000000; | |
6115 } | |
487 | 6116 |
6117 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6118 | |
0 | 6119 LABEL_13: |
463 | 6120 pParty->InTheShopFlags[a1] = 1; |
0 | 6121 if ( v3 ) |
6122 { | |
6123 v7 = &pOutdoor->ddm; | |
6124 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6125 v7 = &pIndoor->dlv; | |
6126 v7->uReputation += v3; | |
6127 if ( v7->uReputation > 10000 ) | |
6128 v7->uReputation = 10000; | |
6129 } | |
6130 v8 = &pPlayers[1]; | |
6131 do | |
6132 { | |
6133 result = *v8; | |
6134 if ( pParty->uFine ) | |
6135 { | |
735 | 6136 //v10 = result->_guilds_member_bits; |
484 | 6137 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6138 if ( !(short)result ) |
735 | 6139 __debugbreak(); |
501 | 6140 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6141 } |
6142 ++v8; | |
6143 } | |
6144 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6145 return result; | |
6146 } | |
6147 | |
6148 //----- (004B1523) -------------------------------------------------------- | |
762 | 6149 void __thiscall sub_4B1523(int *_this) |
0 | 6150 { |
6151 int v1; // esi@1 | |
6152 int v2; // edx@1 | |
6153 unsigned int v3; // eax@2 | |
6154 int v4; // eax@4 | |
6155 LONG v5; // ecx@4 | |
6156 int v6; // eax@10 | |
6157 char *v7; // ST44_4@12 | |
6158 unsigned __int16 v8; // ax@12 | |
6159 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6160 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6161 POINT a2; // [sp+64h] [bp-10h]@1 | |
6162 int v13; // [sp+6Ch] [bp-8h]@4 | |
6163 int v14; // [sp+70h] [bp-4h]@4 | |
6164 | |
6165 v1 = *_this - 399; | |
6166 v2 = (*_this - 400) % 11 + 1; | |
6167 v11 = 4 * (*_this - 400) / 11; | |
6168 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6169 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6170 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6171 else | |
6172 v3 = 30; | |
6173 a1.Hint = 0; | |
6174 a1.uFrameY = v3; | |
6175 a1.uFrameWidth = 328; | |
6176 a1.uFrameHeight = 68; | |
6177 a1.uFrameX = 90; | |
6178 a1.uFrameZ = 417; | |
6179 a1.uFrameW = v3 + 67; | |
6180 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6181 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6182 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6183 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6184 v5 = a2.y; | |
6185 if ( v14 > a2.y ) | |
6186 v5 = v14; | |
6187 if ( v13 > v5 ) | |
6188 v5 = v13; | |
6189 if ( v4 > v5 ) | |
6190 v5 = v4; | |
262 | 6191 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", |
6192 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6193 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6194 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6195 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6196 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6197 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6198 a1.uFrameHeight += v6; | |
6199 if ( (signed int)a1.uFrameHeight < 150 ) | |
6200 a1.uFrameHeight = 150; | |
819 | 6201 a1.uFrameWidth = game_viewport_width; |
0 | 6202 a1.DrawMessageBox(0); |
6203 a1.uFrameWidth -= 12; | |
6204 a1.uFrameHeight -= 12; | |
6205 v7 = pSpellStats->pInfos[v1].pName; | |
6206 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6207 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6208 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6209 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6210 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6211 a1.uFrameZ = a1.uFrameX + 107; | |
6212 a1.uFrameWidth = 108; | |
6213 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6214 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6215 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6216 } |
6217 | |
6218 //----- (004B1784) -------------------------------------------------------- | |
6219 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6220 { | |
6221 Player *pPlayer; // ebx@1 | |
6222 bool result; // eax@2 | |
6223 unsigned __int16 v2; // ST0C_2@3 | |
6224 int v3; // eax@3 | |
6225 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6226 | |
6227 pPlayer = pPlayers[uActiveCharacter]; | |
6228 if ( pPlayer->CanAct() ) | |
6229 { | |
6230 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6231 result = 1; | |
6232 } | |
6233 else | |
6234 { | |
6235 pDialogueWindow->pNumPresenceButton = 0; | |
6236 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6237 v4.uFrameX = 483; | |
6238 v4.uFrameWidth = 148; | |
6239 v4.uFrameZ = 334; | |
6240 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6241 // "%s is in no condition to %s" | |
6242 // "do anything" | |
758 | 6243 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6244 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6245 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6246 result = 0; | |
6247 } | |
6248 return result; | |
6249 } | |
6250 // F8B1E0: using guessed type int dword_F8B1E0; | |
6251 | |
463 | 6252 //view item details in shop? |
0 | 6253 //----- (004B1A2D) -------------------------------------------------------- |
6254 void __cdecl sub_4B1A2D() | |
6255 { | |
358 | 6256 //Player *v0; // edi@1 |
0 | 6257 POINT *v1; // esi@5 |
6258 unsigned int v2; // eax@5 | |
6259 int v3; // ecx@5 | |
6260 POINT *v4; // esi@12 | |
6261 int v5; // eax@12 | |
6262 unsigned int v6; // eax@13 | |
6263 ItemGen *v7; // ecx@13 | |
6264 signed int v8; // esi@17 | |
6265 unsigned int v9; // eax@19 | |
475 | 6266 POINT v10; // [sp+8h] [bp-44h]@12 |
6267 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6268 POINT v12; // [sp+18h] [bp-34h]@18 | |
6269 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6270 POINT v14; // [sp+28h] [bp-24h]@17 | |
6271 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6272 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6273 POINT a2; // [sp+40h] [bp-Ch]@5 |
6274 int v18; // [sp+48h] [bp-4h]@5 | |
6275 | |
358 | 6276 //v0 = pPlayers[uActiveCharacter]; |
484 | 6277 if ( in_current_building_type <= 0 ) |
0 | 6278 return; |
484 | 6279 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6280 { |
749 | 6281 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6282 { | |
6283 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6284 return; |
749 | 6285 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6286 { |
475 | 6287 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6288 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
6289 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
6290 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 6291 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 6292 return; |
358 | 6293 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 6294 LABEL_15: |
6295 GameUI_DrawItemInfo(v7); | |
6296 return; | |
6297 } | |
749 | 6298 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6299 return; |
6300 } | |
475 | 6301 v4 = pMouse->GetCursorPos(&v11); |
6302 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6303 v18 = v5; |
6304 if ( !v5 ) | |
6305 return; | |
336 | 6306 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6307 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6308 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
439 | 6309 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 6310 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 6311 goto LABEL_15; |
6312 } | |
749 | 6313 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS ) |
0 | 6314 { |
6315 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6316 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6317 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6318 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
6319 if ( v18 ) | |
336 | 6320 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6321 } |
6322 } | |
6323 // F8B198: using guessed type int dword_F8B198; | |
6324 // F8B19C: using guessed type int dword_F8B19C; | |
6325 | |
6326 //----- (004B1BDB) -------------------------------------------------------- | |
6327 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6328 { | |
6329 signed __int64 v1; // ST2C_8@1 | |
6330 signed __int64 v2; // qax@1 | |
6331 signed __int64 v3; // ST1C_8@1 | |
6332 unsigned __int64 v4; // qax@1 | |
6333 unsigned int v5; // ebx@1 | |
112 | 6334 Player *v6; // ebx@1 |
0 | 6335 |
6336 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6337 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6338 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6339 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6340 v2 = v1 / 60 / 60; | |
6341 v3 = v2; | |
6342 v4 = (unsigned int)v2 / 0x18; | |
6343 v5 = (unsigned int)(v4 / 7) >> 2; | |
6344 pParty->uCurrentTimeSecond = v1 % 60; | |
6345 pParty->uCurrentMinute = v1 / 60 % 60; | |
6346 pParty->uCurrentHour = v3 % 24; | |
6347 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6348 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6349 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6350 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6351 pParty->RestAndHeal(); |
6352 dword_507B94 = 1; | |
112 | 6353 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6354 do |
6355 { | |
112 | 6356 v6->uTimeToRecovery = 0; |
6357 memset(&v6->uTimeToRecovery, 0, 4u); | |
6358 ++v6; | |
6359 } | |
6360 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6361 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6362 } |
6363 // 507B94: using guessed type int dword_507B94; | |
6364 | |
6365 //----- (004B1D27) -------------------------------------------------------- | |
6366 void __cdecl sub_4B1D27() | |
6367 { | |
6368 int v0; // edx@2 | |
6369 unsigned int v1; // ecx@7 | |
6370 signed int v2; // edi@10 | |
6371 int v3; // esi@10 | |
6372 __int16 v4; // ax@15 | |
6373 signed int v5; // edi@20 | |
6374 int v6; // esi@20 | |
6375 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6376 | |
484 | 6377 if ( in_current_building_type > 0 ) |
0 | 6378 { |
6379 v0 = 3; | |
484 | 6380 if ( in_current_building_type > BildingType_MagicShop ) |
6381 { | |
6382 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6383 { |
6384 if ( !dword_F8B1E4 ) | |
6385 return; | |
6386 } | |
6387 else | |
6388 { | |
484 | 6389 if ( in_current_building_type != BildingType_Temple ) |
0 | 6390 return; |
6391 } | |
336 | 6392 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 6393 LABEL_28: |
735 | 6394 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6395 return; |
6396 } | |
336 | 6397 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6398 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6399 { |
6400 if ( pParty->uNumGold <= 0x2710 ) | |
6401 { | |
6402 if ( !dword_F8B1E4 ) | |
6403 return; | |
6404 v0 = 4; | |
6405 goto LABEL_28; | |
6406 } | |
735 | 6407 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6408 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6409 { | |
6410 v5 = 0; | |
6411 v6 = 1; | |
6412 do | |
6413 { | |
6414 if ( pPlayers[v6]->CanAct() ) | |
6415 v7[v5++] = v6; | |
6416 ++v6; | |
6417 } | |
6418 while ( v6 <= 4 ); | |
6419 if ( v5 ) | |
6420 { | |
6421 qword_A750D8 = 256i64; | |
6422 word_A750E0 = 80; | |
6423 v4 = LOWORD(v7[rand() % v5]); | |
6424 goto LABEL_16; | |
6425 } | |
6426 } | |
6427 } | |
6428 else | |
6429 { | |
6430 if ( !qword_A750D8 ) | |
6431 { | |
6432 v2 = 0; | |
6433 v3 = 1; | |
6434 do | |
6435 { | |
6436 if ( pPlayers[v3]->CanAct() ) | |
6437 v7[v2++] = v3; | |
6438 ++v3; | |
6439 } | |
6440 while ( v3 <= 4 ); | |
6441 if ( v2 ) | |
6442 { | |
6443 qword_A750D8 = 256i64; | |
6444 word_A750E0 = 80; | |
6445 v4 = LOWORD(v7[rand() % v2]); | |
6446 LABEL_16: | |
6447 word_A750E2 = v4; | |
6448 return; | |
6449 } | |
6450 } | |
6451 } | |
6452 } | |
6453 } | |
6454 | |
6455 //----- (004B1ECE) -------------------------------------------------------- | |
6456 void __cdecl sub_4B1ECE() | |
6457 { | |
6458 __int16 *v0; // edi@1 | |
6459 int v1; // ebx@3 | |
6460 Player *v2; // esi@3 | |
6461 int v3; // eax@4 | |
6462 signed int v4; // eax@9 | |
6463 int v5; // ebx@11 | |
89 | 6464 Player *v6; // esi@13 |
6465 ItemGen *v7; // eax@14 | |
0 | 6466 signed int v8; // edi@14 |
89 | 6467 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6468 signed int v10; // [sp+10h] [bp-8h]@13 |
6469 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6470 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6471 |
484 | 6472 contract_approved = 0; |
0 | 6473 v11 = 0; |
6474 uDialogueType = 84; | |
6475 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
6476 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; | |
6477 while ( 1 ) | |
6478 { | |
484 | 6479 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6480 { |
6481 v1 = 0; | |
6482 v2 = pParty->pPlayers; | |
6483 do | |
6484 { | |
89 | 6485 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6486 if ( v3 ) |
6487 break; | |
6488 ++v2; | |
6489 ++v1; | |
6490 } | |
6491 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6492 if ( v1 == 4 ) | |
6493 break; | |
6494 } | |
6495 ++v11; | |
6496 v0 += 2; | |
89 | 6497 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6498 break; | |
6499 } | |
6500 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6501 { | |
651 | 6502 ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6503 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6504 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6505 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6506 } | |
484 | 6507 if ( contract_approved == 601 ) |
0 | 6508 { |
6509 v5 = 0; | |
89 | 6510 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6511 v9 = 0; |
6512 while ( 1 ) | |
6513 { | |
135 | 6514 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6515 { |
6516 v10 = 0; | |
89 | 6517 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6518 do |
6519 { | |
89 | 6520 v7 = v6->pInventoryItems; |
0 | 6521 v8 = 138; |
6522 do | |
6523 { | |
89 | 6524 if ( v7->uItemID == 601 ) |
0 | 6525 { |
377 | 6526 if ( !v7->uHolderPlayer ) |
89 | 6527 v9 = v7; |
377 | 6528 if ( v7->uHolderPlayer == v5 ) |
0 | 6529 v10 = 1; |
6530 } | |
89 | 6531 ++v7; |
0 | 6532 --v8; |
6533 } | |
6534 while ( v8 ); | |
89 | 6535 ++v6; |
6536 } | |
6537 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6538 if ( !v10 ) |
6539 break; | |
6540 } | |
89 | 6541 ++v12; |
0 | 6542 ++v5; |
89 | 6543 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6544 return; |
6545 } | |
6546 if ( v9 ) | |
377 | 6547 v9->uHolderPlayer = v5; |
0 | 6548 } |
6549 } | |
6550 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6551 // 722B3C: using guessed type int dword_722B3C; | |
6552 // 722B44: using guessed type int dword_722B44; | |
6553 // F8B1A8: using guessed type int dword_F8B1A8; | |
6554 | |
6555 //----- (004B2001) -------------------------------------------------------- | |
459 | 6556 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6557 { | |
6558 //signed int v1; // eax@1 | |
6559 NPCData *pCurrentNPCInfo; // ebp@1 | |
6560 int pEventNumber; // ecx@8 | |
0 | 6561 Player *v4; // esi@20 |
467 | 6562 //int v5; // eax@28 |
6563 //int v6; // eax@31 | |
6564 //int v7; // eax@34 | |
6565 //int v8; // eax@37 | |
6566 //int v9; // eax@40 | |
6567 //unsigned int v10; // eax@43 | |
0 | 6568 char *v12; // eax@53 |
6569 char *v13; // eax@56 | |
6570 char *v14; // eax@57 | |
6571 char *v15; // eax@58 | |
467 | 6572 //unsigned int v16; // ebp@62 |
0 | 6573 char *v17; // ecx@63 |
6574 char *v18; // eax@65 | |
6575 const char *v19; // ecx@68 | |
248 | 6576 //unsigned int v20; // eax@69 |
467 | 6577 signed int pPrice; // ecx@70 |
0 | 6578 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6579 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6580 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6581 //int v25; // [sp-4h] [bp-10h]@49 |
6582 | |
459 | 6583 uDialogueType = uMessageParam + 1; |
6584 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6585 if ( uMessageParam <= 24 ) |
460 | 6586 { |
459 | 6587 switch ( uMessageParam ) |
6588 { | |
6589 case 13: | |
6590 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
6591 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6592 NPCHireableDialogPrepare(); |
459 | 6593 dialogue_show_profession_details = false; |
6594 goto _return; | |
6595 case 19: | |
6596 pEventNumber = pCurrentNPCInfo->evt_A; | |
6597 break; | |
6598 case 20: | |
6599 pEventNumber = pCurrentNPCInfo->evt_B; | |
6600 break; | |
6601 case 21: | |
6602 pEventNumber = pCurrentNPCInfo->evt_C; | |
6603 break; | |
6604 case 22: | |
6605 pEventNumber = pCurrentNPCInfo->evt_D; | |
6606 break; | |
6607 case 23: | |
6608 pEventNumber = pCurrentNPCInfo->evt_E; | |
6609 break; | |
6610 case 24: | |
6611 pEventNumber = pCurrentNPCInfo->evt_F; | |
6612 break; | |
6613 default: | |
467 | 6614 goto _return; |
6615 } | |
6616 /*switch ( pEventNumber ) | |
6617 { | |
6618 case 139: | |
6619 sub_4B1ECE(); | |
6620 goto _return; | |
6621 case 311: | |
6622 sub_4BBA85_bounties(); | |
6623 goto _return; | |
6624 }*/ | |
459 | 6625 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6626 { | |
6627 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6628 { | |
6629 if ( pEventNumber == 139 ) | |
0 | 6630 { |
6631 sub_4B1ECE(); | |
6632 } | |
6633 else | |
6634 { | |
459 | 6635 if ( pEventNumber == 311 ) |
0 | 6636 { |
6637 sub_4BBA85_bounties(); | |
6638 } | |
6639 else | |
6640 { | |
6641 ptr_F8B1E8 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6642 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6643 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6644 activeLevelDecoration = NULL; |
0 | 6645 } |
6646 } | |
6647 } | |
6648 else | |
6649 { | |
459 | 6650 dword_F8B1D8 = uMessageParam; |
6651 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6652 } |
6653 } | |
6654 else | |
6655 { | |
459 | 6656 sub_4B3FE5(pEventNumber); |
0 | 6657 } |
6658 goto _return; | |
460 | 6659 } |
459 | 6660 if ( uMessageParam != 76 ) |
6661 { | |
6662 if ( uMessageParam == 77 ) | |
6663 { | |
467 | 6664 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6665 if (dialogue_show_profession_details) |
459 | 6666 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6667 else |
459 | 6668 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
0 | 6669 ptr_F8B1E8 = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6670 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6671 dialogue_show_profession_details = ~dialogue_show_profession_details; |
0 | 6672 ptr_F8B1E8 = v18; |
6673 } | |
6674 else | |
6675 { | |
459 | 6676 if ( uMessageParam == 79 ) |
0 | 6677 { |
484 | 6678 if ( contract_approved ) |
0 | 6679 { |
267 | 6680 Party::TakeGold(gold_transaction_amount); |
0 | 6681 if ( uActiveCharacter ) |
6682 { | |
492 | 6683 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6684 *(short *)v12 &= 0x3Fu; |
6685 switch ( dword_F8B1B0 ) | |
6686 { | |
6687 case 2: | |
492 | 6688 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6689 *v15 |= 0x40u; |
6690 break; | |
6691 case 3: | |
492 | 6692 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6693 *v14 |= 0x80u; |
6694 break; | |
6695 case 4: | |
492 | 6696 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6697 v13[1] |= 1u; |
6698 break; | |
6699 } | |
187 | 6700 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6701 } |
437 | 6702 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6703 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6704 { |
6705 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6706 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6707 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6708 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6709 }*/ |
0 | 6710 } |
6711 } | |
6712 else | |
6713 { | |
492 | 6714 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6715 { |
267 | 6716 Party::TakeGold(gold_transaction_amount); |
0 | 6717 v4 = pParty->pPlayers; |
6718 do | |
6719 { | |
492 | 6720 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6721 ++v4; |
6722 } | |
6723 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6724 switch ( dword_F8B1D8 ) | |
6725 { | |
6726 case 19: | |
467 | 6727 pEventNumber = pCurrentNPCInfo->evt_A; |
6728 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6729 pCurrentNPCInfo->evt_A = 0; |
0 | 6730 break; |
6731 case 20: | |
467 | 6732 pEventNumber = pCurrentNPCInfo->evt_B; |
6733 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6734 pCurrentNPCInfo->evt_B = 0; |
0 | 6735 break; |
6736 case 21: | |
467 | 6737 pEventNumber = pCurrentNPCInfo->evt_C; |
6738 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6739 pCurrentNPCInfo->evt_C = 0; |
0 | 6740 break; |
6741 case 22: | |
467 | 6742 pEventNumber = pCurrentNPCInfo->evt_D; |
6743 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6744 pCurrentNPCInfo->evt_D = 0; |
0 | 6745 break; |
6746 case 23: | |
467 | 6747 pEventNumber = pCurrentNPCInfo->evt_E; |
6748 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6749 pCurrentNPCInfo->evt_E = 0; |
0 | 6750 break; |
6751 case 24: | |
467 | 6752 pEventNumber = pCurrentNPCInfo->evt_F; |
6753 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6754 pCurrentNPCInfo->evt_F = 0; | |
0 | 6755 break; |
6756 } | |
437 | 6757 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6758 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6759 { |
6760 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6761 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6762 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6763 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6764 }*/ |
467 | 6765 //v11 = uActiveCharacter; |
0 | 6766 if ( uActiveCharacter ) |
6767 { | |
467 | 6768 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6769 goto _return; |
6770 } | |
6771 } | |
6772 } | |
6773 } | |
6774 goto _return; | |
6775 } | |
6776 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6777 { | |
467 | 6778 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6779 goto _return; |
6780 } | |
459 | 6781 if ( pCurrentNPCInfo->uProfession != 51 ) |
6782 { | |
467 | 6783 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6784 if ( pParty->uNumGold < pPrice ) | |
6785 { | |
6786 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6787 dialogue_show_profession_details = false; |
0 | 6788 uDialogueType = 13; |
459 | 6789 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6790 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); |
0 | 6791 if ( uActiveCharacter ) |
248 | 6792 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6793 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6794 goto _return; | |
6795 } | |
6796 Party::TakeGold(pPrice); | |
0 | 6797 } |
147 | 6798 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6799 pCurrentNPCInfo->uFlags |= 128; |
0 | 6800 pParty->field_709 = 0; |
659 | 6801 Party__CountHirelings(); |
0 | 6802 if ( pParty->pHirelings[0].pName ) |
6803 { | |
459 | 6804 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6805 v24 = pCurrentNPCInfo->pName; | |
0 | 6806 v22 = pParty->pHireling2Name; |
6807 } | |
6808 else | |
6809 { | |
459 | 6810 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6811 v24 = pCurrentNPCInfo->pName; | |
0 | 6812 v22 = pParty->pHireling1Name; |
6813 } | |
6814 strcpy(v22, v24); | |
6815 pParty->field_709 = 0; | |
659 | 6816 Party__CountHirelings(); |
480 | 6817 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6818 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6819 |
6820 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6821 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6822 { |
6823 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6824 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6825 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6826 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6827 }*/ |
0 | 6828 if ( uActiveCharacter ) |
467 | 6829 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6830 _return: |
460 | 6831 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6832 } |
6833 | |
6834 //----- (004B254D) -------------------------------------------------------- | |
6835 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6836 { | |
6837 Player *v1; // esi@1 | |
6838 int v2; // edx@1 | |
6839 int v3; // ecx@1 | |
6840 int v4; // edi@1 | |
6841 int v5; // eax@7 | |
6842 int v6; // eax@7 | |
6843 int v7; // ebx@7 | |
6844 int v8; // ebx@8 | |
6845 signed int v9; // esi@8 | |
6846 int v10; // eax@8 | |
6847 char *v11; // ecx@8 | |
6848 int v12; // edi@9 | |
6849 char *v13; // edx@9 | |
6850 signed int v14; // edi@10 | |
6851 unsigned int v16; // eax@29 | |
6852 int v17; // eax@36 | |
6853 char v18; // cl@46 | |
6854 __int16 v19; // dx@56 | |
6855 int v20; // eax@60 | |
6856 char *v21; // [sp-Ch] [bp-38h]@82 | |
6857 const char *v22; // [sp-8h] [bp-34h]@21 | |
6858 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6859 char *v24; // [sp-8h] [bp-34h]@82 | |
6860 char *v25; // [sp-4h] [bp-30h]@14 | |
6861 int v26; // [sp-4h] [bp-30h]@38 | |
6862 int v27; // [sp-4h] [bp-30h]@82 | |
6863 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6864 int v29; // [sp+10h] [bp-1Ch]@13 | |
6865 int v30; // [sp+14h] [bp-18h]@15 | |
6866 int v31; // [sp+18h] [bp-14h]@16 | |
6867 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6868 int v33; // [sp+20h] [bp-Ch]@7 | |
6869 int v34; // [sp+24h] [bp-8h]@7 | |
6870 char *v35; // [sp+28h] [bp-4h]@1 | |
6871 | |
6872 v1 = pPlayers[uActiveCharacter]; | |
484 | 6873 contract_approved = 0; |
0 | 6874 v2 = (_this - 200) % 3; |
6875 v3 = (_this - 200) / 3; | |
6876 v4 = v2; | |
6877 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6878 dword_F8B1AC_award_bit_number = v3; |
0 | 6879 if ( v2 ) |
6880 { | |
6881 if ( v2 == 1 ) | |
6882 { | |
267 | 6883 gold_transaction_amount = 5000; |
0 | 6884 dword_F8B1B0 = 3; |
6885 } | |
6886 else | |
6887 { | |
6888 if ( v2 == 2 ) | |
6889 { | |
267 | 6890 gold_transaction_amount = 8000; |
0 | 6891 dword_F8B1B0 = 4; |
6892 } | |
6893 } | |
6894 } | |
6895 else | |
6896 { | |
267 | 6897 gold_transaction_amount = 2000; |
0 | 6898 dword_F8B1B0 = 2; |
6899 } | |
135 | 6900 v5 = v1->classType; |
0 | 6901 v33 = v5; |
6902 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
6903 *(int *)a1 = v1->pActiveSkills[v3]; | |
6904 v7 = a1[0] & 0x3F; | |
6905 v34 = v2 + 2; | |
6906 if ( v6 < v2 + 2 ) | |
6907 { | |
6908 v8 = v33; | |
6909 v9 = 0; | |
6910 v10 = v33 - v33 % 4; | |
6911 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
6912 do | |
6913 { | |
6914 v12 = (unsigned __int8)*v11; | |
6915 v13 = &v28[4 * v9]; | |
6916 *(int *)v13 = 0; | |
6917 if ( v12 < v34 ) | |
6918 { | |
6919 v14 = 1; | |
6920 } | |
6921 else | |
6922 { | |
6923 v14 = 1; | |
6924 *(int *)v13 = 1; | |
6925 } | |
6926 ++v9; | |
6927 v11 += 37; | |
6928 } | |
6929 while ( v9 < 4 ); | |
6930 if ( v29 == v14 ) | |
6931 { | |
6932 v25 = pClassNames[v10 + 1]; | |
6933 } | |
6934 else | |
6935 { | |
6936 if ( v30 == v14 ) | |
6937 { | |
6938 if ( v31 == v14 ) | |
6939 { | |
6940 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
6941 return pTmpBuf; | |
6942 } | |
6943 v25 = pClassNames[v10 + 2]; | |
6944 } | |
6945 else | |
6946 { | |
6947 if ( v31 != v14 ) | |
6948 { | |
6949 v25 = pClassNames[v8]; | |
6950 v22 = pGlobalTXT_LocalizationStrings[632]; | |
6951 goto LABEL_23; | |
6952 } | |
6953 v25 = pClassNames[v10 + 3]; | |
6954 } | |
6955 } | |
6956 v22 = pGlobalTXT_LocalizationStrings[633]; | |
6957 LABEL_23: | |
6958 sprintf(pTmpBuf, v22, v25); | |
6959 return pTmpBuf; | |
6960 } | |
6961 if ( !v1->CanAct() ) | |
6962 return (char *)pNPCTopics[122].pText; | |
6963 if ( !v7 ) | |
6964 return (char *)pNPCTopics[131].pText; | |
6965 v16 = SkillToMastery(a1[0]); | |
6966 if ( (signed int)v16 > v4 + 1 ) | |
6967 return (char *)pNPCTopics[v4 + 128].pText; | |
6968 if ( v34 != 2 ) | |
6969 { | |
6970 if ( v34 == 3 ) | |
6971 { | |
6972 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6973 { | |
492 | 6974 v17 = dword_F8B1AC_award_bit_number; |
6975 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 6976 { |
6977 default: | |
6978 goto LABEL_41; | |
6979 case 12: | |
6980 case 13: | |
6981 case 14: | |
6982 case 15: | |
6983 case 16: | |
6984 case 17: | |
6985 case 18: | |
267 | 6986 gold_transaction_amount = 4000; |
0 | 6987 goto LABEL_42; |
6988 case 19: | |
6989 v19 = 114; | |
6990 goto LABEL_57; | |
6991 case 20: | |
6992 v19 = 110; | |
6993 LABEL_57: | |
484 | 6994 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6995 return v35; |
6996 goto LABEL_40; | |
6997 case 22: | |
6998 v20 = v1->GetBaseWillpower(); | |
6999 goto LABEL_61; | |
7000 case 24: | |
267 | 7001 gold_transaction_amount = 2500; |
0 | 7002 v20 = v1->GetBaseEndurance(); |
7003 goto LABEL_61; | |
7004 case 36: | |
7005 v20 = v1->GetBaseIntelligence(); | |
7006 LABEL_61: | |
7007 if ( v20 < 50 ) | |
7008 return v35; | |
7009 goto LABEL_40; | |
7010 case 21: | |
7011 case 23: | |
7012 case 25: | |
7013 case 26: | |
7014 case 29: | |
7015 case 32: | |
7016 case 34: | |
7017 case 35: | |
267 | 7018 gold_transaction_amount = 2500; |
0 | 7019 goto LABEL_42; |
7020 case 8: | |
7021 case 9: | |
7022 case 10: | |
7023 case 11: | |
267 | 7024 gold_transaction_amount = 3000; |
0 | 7025 goto LABEL_42; |
7026 case 7: | |
7027 goto LABEL_67; | |
7028 } | |
7029 goto LABEL_67; | |
7030 } | |
7031 } | |
7032 else | |
7033 { | |
7034 if ( v34 != 4 ) | |
7035 { | |
7036 LABEL_40: | |
492 | 7037 v17 = dword_F8B1AC_award_bit_number; |
0 | 7038 goto LABEL_41; |
7039 } | |
7040 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7041 { | |
492 | 7042 v17 = dword_F8B1AC_award_bit_number; |
7043 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7044 { |
7045 case 19: | |
7046 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7047 goto LABEL_40; | |
7048 v26 = 1; | |
7049 v23 = 26; | |
7050 goto LABEL_39; | |
7051 default: | |
7052 goto LABEL_41; | |
7053 case 20: | |
7054 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7055 goto LABEL_40; | |
7056 v26 = 1; | |
7057 v23 = 27; | |
7058 LABEL_39: | |
7059 if ( v1->_49327B(v23, v26) == 1 ) | |
7060 goto LABEL_40; | |
7061 return v35; | |
7062 case 30: | |
7063 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7064 goto LABEL_47; | |
7065 case 31: | |
7066 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7067 LABEL_47: | |
7068 if ( (v18 & 0x3Fu) < 0xA ) | |
7069 return v35; | |
7070 goto LABEL_41; | |
7071 case 21: | |
7072 case 23: | |
7073 case 24: | |
7074 case 25: | |
7075 case 26: | |
7076 case 29: | |
7077 case 32: | |
7078 case 34: | |
7079 case 35: | |
267 | 7080 gold_transaction_amount = 6000; |
0 | 7081 goto LABEL_42; |
7082 case 8: | |
7083 case 9: | |
7084 case 10: | |
7085 case 11: | |
267 | 7086 gold_transaction_amount = 7000; |
0 | 7087 goto LABEL_42; |
7088 case 7: | |
7089 break; | |
7090 } | |
7091 LABEL_67: | |
267 | 7092 gold_transaction_amount = 0; |
0 | 7093 goto LABEL_41; |
7094 } | |
7095 } | |
7096 return v35; | |
7097 } | |
7098 if ( v7 < 4 ) | |
7099 return v35; | |
492 | 7100 v17 = dword_F8B1AC_award_bit_number; |
7101 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7102 { | |
7103 if ( dword_F8B1AC_award_bit_number != 29 | |
7104 && dword_F8B1AC_award_bit_number != 32 | |
7105 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7106 { |
7107 LABEL_41: | |
267 | 7108 if ( !gold_transaction_amount ) |
0 | 7109 goto LABEL_79; |
7110 goto LABEL_42; | |
7111 } | |
7112 LABEL_87: | |
267 | 7113 gold_transaction_amount = 500; |
0 | 7114 goto LABEL_41; |
7115 } | |
492 | 7116 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7117 goto LABEL_87; |
492 | 7118 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7119 { |
267 | 7120 gold_transaction_amount = 0; |
0 | 7121 goto LABEL_79; |
7122 } | |
492 | 7123 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7124 goto LABEL_41; |
492 | 7125 if ( dword_F8B1AC_award_bit_number > 18 ) |
7126 { | |
7127 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7128 goto LABEL_41; |
7129 goto LABEL_87; | |
7130 } | |
267 | 7131 gold_transaction_amount = 1000; |
0 | 7132 LABEL_42: |
267 | 7133 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7134 return (char *)pNPCTopics[124].pText; |
7135 LABEL_79: | |
484 | 7136 contract_approved = 1; |
0 | 7137 if ( v34 == 2 ) |
7138 { | |
267 | 7139 v27 = gold_transaction_amount; |
0 | 7140 v24 = pSkillNames[v17]; |
7141 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7142 goto LABEL_90; | |
7143 } | |
7144 if ( v34 == 3 ) | |
7145 { | |
267 | 7146 v27 = gold_transaction_amount; |
0 | 7147 v24 = pSkillNames[v17]; |
7148 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7149 goto LABEL_90; | |
7150 } | |
7151 if ( v34 == 4 ) | |
7152 { | |
267 | 7153 v27 = gold_transaction_amount; |
0 | 7154 v24 = pSkillNames[v17]; |
7155 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7156 LABEL_90: | |
809 | 7157 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); |
0 | 7158 } |
7159 return pTmpBuf2; | |
7160 } | |
7161 | |
7162 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7163 const char * ContractSelectText( int pEventCode ) |
7164 { | |
7165 static const int dialogue_base=110; | |
484 | 7166 contract_approved = 0; |
492 | 7167 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7168 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7169 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7170 { | |
492 | 7171 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7172 { | |
7173 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7174 } |
7175 else | |
7176 { | |
267 | 7177 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7178 { |
484 | 7179 contract_approved = 1; |
492 | 7180 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7181 } |
7182 else | |
7183 { | |
492 | 7184 return pNPCTopics[dialogue_base+14].pText; |
0 | 7185 } |
7186 } | |
7187 } | |
7188 else | |
7189 { | |
492 | 7190 return pNPCTopics[dialogue_base+12].pText; |
0 | 7191 } |
7192 } | |
7193 | |
7194 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7195 void SimpleHouseAndBoatsDialog() |
0 | 7196 { |
7197 char *v0; // esi@3 | |
7198 char *v1; // ST1C_4@3 | |
7199 char *v2; // eax@3 | |
7200 const char *v3; // ST1C_4@5 | |
7201 int v4; // eax@5 | |
7202 unsigned int i; // eax@5 | |
7203 NPCData *v6; // esi@6 | |
7204 unsigned __int16 v7; // bx@6 | |
7205 unsigned int v8; // eax@6 | |
7206 int v9; // eax@11 | |
7207 unsigned int v10; // ecx@12 | |
7208 int v11; // eax@12 | |
7209 int v12; // esi@12 | |
7210 char *v13; // eax@12 | |
7211 GUIWindow *v14; // ebx@13 | |
7212 char *v15; // esi@14 | |
7213 GUIButton *v16; // eax@15 | |
7214 unsigned int v17; // ecx@15 | |
7215 int v18; // ecx@17 | |
7216 int v19; // ecx@18 | |
7217 int v20; // ecx@19 | |
7218 int v21; // ecx@20 | |
7219 int v22; // ecx@21 | |
7220 unsigned int v23; // ecx@23 | |
7221 int v24; // ecx@35 | |
7222 int v25; // ecx@36 | |
7223 int v26; // ecx@37 | |
7224 int v27; // ecx@38 | |
7225 int v28; // ecx@39 | |
7226 char *v29; // esi@42 | |
7227 unsigned int v30; // ST20_4@42 | |
7228 int v31; // ST1C_4@42 | |
7229 unsigned int v32; // eax@42 | |
7230 char *v33; // eax@43 | |
7231 int v34; // esi@51 | |
7232 int v35; // eax@51 | |
7233 unsigned int v36; // edi@51 | |
7234 GUIButton *v37; // eax@52 | |
7235 int v38; // eax@52 | |
7236 signed int v39; // ecx@54 | |
7237 int v40; // edi@57 | |
7238 GUIButton *v41; // eax@60 | |
7239 GUIButton *v42; // esi@60 | |
7240 const char *v43; // ebx@60 | |
7241 int v44; // eax@60 | |
7242 unsigned int v45; // ecx@60 | |
7243 unsigned __int16 v46; // ax@60 | |
7244 GUIFont *v47; // ebx@64 | |
7245 int v48; // esi@64 | |
7246 char *v49; // eax@66 | |
7247 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7248 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7249 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7250 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7251 int v55; // [sp+10Ch] [bp-10h]@6 | |
7252 int v56; // [sp+110h] [bp-Ch]@13 | |
7253 char *pInString; // [sp+114h] [bp-8h]@12 | |
7254 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7255 | |
7256 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7257 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7258 { |
7259 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7260 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7261 a1.uFrameX = 493; | |
7262 a1.uFrameWidth = 126; | |
7263 a1.uFrameZ = 366; | |
7264 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7265 a1.uFrameX = 483; | |
7266 a1.uFrameWidth = 148; | |
7267 a1.uFrameZ = 334; | |
434 | 7268 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7269 if ( !v2 ) |
7270 { | |
721 | 7271 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7272 v2 = pTmpBuf; |
7273 } | |
7274 v3 = v2; | |
7275 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7276 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7277 return; | |
0 | 7278 } |
7279 a1.uFrameWidth -= 10; | |
7280 a1.uFrameZ -= 10; | |
459 | 7281 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7282 v6 = v58; |
7283 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7284 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7285 v8 = v6->uProfession; | |
7286 if ( v8 ) | |
264 | 7287 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7288 else |
7289 strcpy(pTmpBuf, v6->pName); | |
7290 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7291 if ( !dword_591080 ) | |
7292 { | |
7293 if ( !uDialogueType ) | |
7294 { | |
7295 v9 = v6->greet; | |
7296 if ( v9 ) | |
7297 { | |
7298 v10 = v6->uFlags; | |
819 | 7299 a1.uFrameWidth = game_viewport_width; |
0 | 7300 a1.uFrameZ = 452; |
7301 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7302 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7303 v12 = v11 + 7; | |
7304 pRenderer->_4A6A68( | |
7305 8u, | |
7306 352 - (v11 + 7), | |
7307 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7308 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7309 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7310 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7311 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7312 } | |
7313 } | |
7314 } | |
7315 v14 = pDialogueWindow; | |
7316 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7317 v52.uFrameX = 483; | |
7318 v52.uFrameWidth = 148; | |
7319 v52.uFrameZ = 334; | |
7320 v56 = v52.pStartingPosActiveItem; | |
7321 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7322 { | |
348 | 7323 v15 = "";//(char *)v54; |
0 | 7324 while ( 1 ) |
7325 { | |
7326 v16 = v52.GetControl(v56); | |
7327 v17 = v16->uControlParam; | |
7328 pInString = (char *)v16; | |
7329 if ( (signed int)v17 > 24 ) | |
7330 { | |
7331 v24 = v17 - 76; | |
7332 if ( !v24 ) | |
7333 { | |
7334 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7335 goto LABEL_49; | |
7336 } | |
7337 v25 = v24 - 1; | |
7338 if ( !v25 ) | |
7339 { | |
7340 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7341 goto LABEL_49; | |
7342 } | |
7343 v26 = v25 - 2; | |
7344 if ( !v26 ) | |
7345 { | |
7346 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7347 LABEL_44: | |
7348 v15 = v33; | |
7349 LABEL_45: | |
7350 v16 = (GUIButton *)pInString; | |
7351 goto LABEL_49; | |
7352 } | |
7353 v27 = v26 - 3; | |
7354 if ( !v27 ) | |
7355 { | |
459 | 7356 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7357 goto LABEL_44; |
7358 } | |
7359 v28 = v27 - 1; | |
7360 if ( !v28 ) | |
7361 { | |
7362 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7363 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7364 v31 = *(int *)v29; | |
7365 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7366 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7367 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
7368 ptr_F8B1E8 = pTmpBuf2; | |
7369 v15 = ""; | |
7370 goto LABEL_45; | |
7371 } | |
7372 if ( v28 != 10 ) | |
7373 goto LABEL_41; | |
7374 } | |
7375 else | |
7376 { | |
7377 if ( v17 == 24 ) | |
7378 { | |
291 | 7379 v23 = v58->evt_F; |
0 | 7380 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7381 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7382 if ( !v15 ) |
7383 { | |
7384 v16->uControlParam = 0; | |
7385 v15 = ""; | |
7386 } | |
7387 goto LABEL_49; | |
7388 } | |
7389 v18 = v17 - 13; | |
7390 if ( v18 ) | |
7391 { | |
7392 v19 = v18 - 6; | |
7393 if ( !v19 ) | |
7394 { | |
291 | 7395 v23 = v58->evt_A; |
0 | 7396 goto LABEL_33; |
7397 } | |
7398 v20 = v19 - 1; | |
7399 if ( !v20 ) | |
7400 { | |
291 | 7401 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7402 if ( !v15 ) |
7403 { | |
7404 v16->uControlParam = 0; | |
7405 v15 = ""; | |
7406 } | |
7407 if ( uDialogueType != 84 ) | |
7408 goto LABEL_49; | |
484 | 7409 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 7410 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
7411 ptr_F8B1E8 = pTmpBuf2; | |
7412 goto LABEL_45; | |
7413 } | |
7414 v21 = v20 - 1; | |
7415 if ( !v21 ) | |
7416 { | |
291 | 7417 v23 = v58->evt_C; |
0 | 7418 goto LABEL_33; |
7419 } | |
7420 v22 = v21 - 1; | |
7421 if ( !v22 ) | |
7422 { | |
291 | 7423 v23 = v58->evt_D; |
0 | 7424 goto LABEL_33; |
7425 } | |
7426 if ( v22 == 1 ) | |
7427 { | |
291 | 7428 v23 = v58->evt_E; |
0 | 7429 goto LABEL_33; |
7430 } | |
7431 LABEL_41: | |
7432 v15 = ""; | |
7433 goto LABEL_49; | |
7434 } | |
7435 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7436 } | |
7437 LABEL_49: | |
7438 strcpy(v16->pButtonName, v15); | |
7439 ++v56; | |
7440 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7441 { | |
7442 v14 = pDialogueWindow; | |
7443 break; | |
7444 } | |
7445 } | |
7446 } | |
7447 v34 = 0; | |
7448 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7449 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7450 v36 = v14->pStartingPosActiveItem; | |
7451 v55 = v35; | |
7452 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7453 + pDialogueWindow->pStartingPosActiveItem ) | |
7454 { | |
7455 v37 = v14->GetControl(v36); | |
7456 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7457 v14 = pDialogueWindow; | |
7458 v34 += v38; | |
7459 ++v36; | |
7460 } | |
7461 v39 = v14->pNumPresenceButton; | |
7462 if ( v39 ) | |
7463 { | |
7464 v58 = (NPCData *)((174 - v34) / v39); | |
7465 if ( (signed int)v58 > 32 ) | |
7466 v58 = (NPCData *)32; | |
7467 pInString = (char *)2; | |
7468 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7469 v56 = v14->pStartingPosActiveItem; | |
7470 i = v56; | |
7471 if ( (signed int)i < (signed int)(i + v39) ) | |
7472 { | |
7473 while ( 1 ) | |
7474 { | |
7475 v41 = v14->GetControl(i); | |
7476 v42 = v41; | |
7477 v43 = v41->pButtonName; | |
7478 v41->uY = (unsigned int)((char *)v58 + v40); | |
7479 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7480 v45 = v42->uY; | |
7481 v42->uHeight = v44; | |
7482 v40 = v45 + v44 - 1; | |
7483 v42->uW = v40; | |
7484 v46 = v55; | |
7485 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7486 v46 = v54; | |
7487 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7488 v14 = pDialogueWindow; | |
7489 ++pInString; | |
7490 ++v56; | |
7491 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7492 if ( v56 >= (signed int)i ) | |
7493 break; | |
7494 i = v56; | |
7495 } | |
7496 } | |
7497 } | |
7498 if ( ptr_F8B1E8 ) | |
7499 { | |
7500 w.uFrameWidth = 458; | |
7501 w.uFrameZ = 457; | |
7502 v47 = pFontArrus; | |
7503 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7504 if ( 352 - v48 < 8 ) | |
7505 { | |
7506 v47 = pFontCreate; | |
7507 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7508 } | |
7509 pRenderer->_4A6A68( | |
7510 8u, | |
7511 352 - v48, | |
7512 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7513 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7514 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
7515 v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); | |
762 | 7516 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7517 } | |
0 | 7518 } |
7519 | |
7520 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7521 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7522 { |
473 | 7523 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); |
0 | 7524 } |
7525 | |
7526 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7527 void sub_4B3A72( int a1 ) |
7528 { | |
7529 int num_buttons; // esi@1 | |
7530 | |
7531 num_buttons = 0; | |
0 | 7532 if ( a1 == 21 ) |
7533 { | |
473 | 7534 CreateButtonInColumn(0, 0x66u); |
7535 num_buttons = 2; | |
7536 CreateButtonInColumn(1, 0x67u); | |
7537 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7538 { | |
7539 num_buttons = 3; | |
7540 CreateButtonInColumn(2, 0x68u); | |
7541 } | |
7542 } | |
7543 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7544 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7545 } | |
7546 // F8B1E0: using guessed type int dword_F8B1E0; | |
7547 | |
7548 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7549 void sub_4B3AD4( signed int a1 ) |
7550 { | |
0 | 7551 if ( a1 > 0 ) |
7552 { | |
7553 if ( a1 <= 3 ) | |
7554 { | |
473 | 7555 CreateButtonInColumn(0, 3u); |
7556 CreateButtonInColumn(1, 4u); | |
7557 CreateButtonInColumn(2, 5u); | |
7558 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7559 } |
7560 if ( a1 == 4 ) | |
7561 { | |
473 | 7562 CreateButtonInColumn(0, 3u); |
7563 CreateButtonInColumn(1, 4u); | |
7564 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7565 } | |
7566 } | |
0 | 7567 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7568 } | |
7569 // F8B1E0: using guessed type int dword_F8B1E0; | |
7570 | |
7571 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7572 void sub_4B3B42( signed int a1 ) |
7573 { | |
0 | 7574 int v1; // ecx@18 |
7575 int v2; // ecx@19 | |
7576 int v3; // ecx@20 | |
7577 signed int v4; // esi@22 | |
7578 signed int v5; // eax@22 | |
7579 unsigned int v6; // edx@24 | |
7580 int v7; // ecx@24 | |
7581 int result; // eax@43 | |
7582 int v9; // [sp-10h] [bp-14h]@28 | |
7583 int v10; // [sp-Ch] [bp-10h]@28 | |
7584 int v11; // [sp-8h] [bp-Ch]@28 | |
7585 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7586 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7587 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7588 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7589 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7590 int v17; // [sp-4h] [bp-8h]@28 | |
7591 | |
7592 if ( a1 > 13 ) | |
7593 { | |
7594 if ( a1 > 22 ) | |
7595 { | |
7596 if ( a1 == 23 ) | |
7597 { | |
473 | 7598 CreateButtonInColumn(0, 0xAu); |
7599 CreateButtonInColumn(1, 0xBu); | |
0 | 7600 v14 = 96; |
7601 LABEL_41: | |
473 | 7602 CreateButtonInColumn(2, v14); |
0 | 7603 v17 = 2; |
7604 v11 = 0; | |
7605 v10 = 1; | |
7606 v9 = 3; | |
7607 goto LABEL_42; | |
7608 } | |
7609 if ( a1 <= 26 ) | |
7610 goto LABEL_43; | |
7611 if ( a1 > 28 ) | |
7612 { | |
7613 if ( a1 != 30 ) | |
7614 goto LABEL_43; | |
473 | 7615 CreateButtonInColumn(0, 0x11u); |
0 | 7616 v16 = 96; |
7617 goto LABEL_37; | |
7618 } | |
473 | 7619 CreateButtonInColumn(0, 0x69u); |
7620 CreateButtonInColumn(1, 0x6Au); | |
7621 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7622 v12 = 108; |
7623 } | |
7624 else | |
7625 { | |
7626 if ( a1 == 22 ) | |
7627 { | |
473 | 7628 CreateButtonInColumn(0, 7u); |
0 | 7629 v16 = 8; |
7630 goto LABEL_37; | |
7631 } | |
7632 v1 = a1 - 14; | |
7633 if ( !v1 ) | |
7634 { | |
473 | 7635 CreateButtonInColumn(0, 0x12u); |
7636 CreateButtonInColumn(1, 0x30u); | |
7637 CreateButtonInColumn(2, 0x31u); | |
7638 CreateButtonInColumn(3, 0x32u); | |
7639 CreateButtonInColumn(4, 0x33u); | |
0 | 7640 v17 = 2; |
7641 v11 = 0; | |
7642 v10 = 1; | |
7643 v9 = 5; | |
7644 goto LABEL_42; | |
7645 } | |
7646 v2 = v1 - 1; | |
7647 if ( v2 ) | |
7648 { | |
7649 v3 = v2 - 2; | |
7650 if ( v3 ) | |
7651 { | |
7652 if ( v3 != 4 ) | |
7653 goto LABEL_43; | |
473 | 7654 CreateButtonInColumn(0, 0xFu); |
7655 CreateButtonInColumn(1, 0x10u); | |
0 | 7656 v4 = 3; |
473 | 7657 CreateButtonInColumn(2, 0x60u); |
336 | 7658 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7659 if ( v5 < 108 || v5 > 120 ) |
7660 goto LABEL_28; | |
7661 v4 = 4; | |
7662 v6 = 101; | |
7663 v7 = 3; | |
7664 } | |
7665 else | |
7666 { | |
7667 v4 = 1; | |
473 | 7668 CreateButtonInColumn(0, 0x63u); |
0 | 7669 if ( !pParty->uFine ) |
7670 { | |
7671 LABEL_28: | |
7672 v17 = 2; | |
7673 v11 = 0; | |
7674 v10 = 1; | |
7675 v9 = v4; | |
7676 LABEL_42: | |
7677 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7678 goto LABEL_43; | |
7679 } | |
7680 v4 = 2; | |
7681 v7 = 1; | |
7682 v6 = 100; | |
7683 } | |
473 | 7684 CreateButtonInColumn(v7, v6); |
0 | 7685 goto LABEL_28; |
7686 } | |
473 | 7687 CreateButtonInColumn(0, 0x12u); |
7688 CreateButtonInColumn(1, 0x34u); | |
7689 CreateButtonInColumn(2, 0x35u); | |
0 | 7690 v12 = 54; |
7691 } | |
7692 LABEL_39: | |
473 | 7693 CreateButtonInColumn(3, v12); |
0 | 7694 v17 = 2; |
7695 v11 = 0; | |
7696 v10 = 1; | |
7697 v9 = 4; | |
7698 goto LABEL_42; | |
7699 } | |
7700 if ( a1 == 13 ) | |
7701 { | |
473 | 7702 CreateButtonInColumn(0, 0x12u); |
0 | 7703 v16 = 56; |
7704 LABEL_37: | |
473 | 7705 CreateButtonInColumn(1, v16); |
0 | 7706 v17 = 2; |
7707 v11 = 0; | |
7708 v10 = 1; | |
7709 v9 = 2; | |
7710 goto LABEL_42; | |
7711 } | |
7712 switch ( a1 ) | |
7713 { | |
7714 case 1: | |
7715 case 2: | |
7716 case 3: | |
7717 case 4: | |
473 | 7718 CreateButtonInColumn(0, 2u); |
7719 CreateButtonInColumn(1, 0x5Fu); | |
7720 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7721 v12 = 96; |
7722 goto LABEL_39; | |
7723 case 5: | |
473 | 7724 CreateButtonInColumn(0, 0x12u); |
0 | 7725 v13 = 48; |
7726 goto LABEL_9; | |
7727 case 6: | |
473 | 7728 CreateButtonInColumn(0, 0x12u); |
0 | 7729 v13 = 49; |
7730 goto LABEL_9; | |
7731 case 7: | |
473 | 7732 CreateButtonInColumn(0, 0x12u); |
0 | 7733 v13 = 50; |
7734 goto LABEL_9; | |
7735 case 8: | |
473 | 7736 CreateButtonInColumn(0, 0x12u); |
0 | 7737 v13 = 51; |
7738 LABEL_9: | |
473 | 7739 CreateButtonInColumn(1, v13); |
0 | 7740 v14 = 72; |
7741 goto LABEL_41; | |
7742 case 9: | |
473 | 7743 CreateButtonInColumn(0, 0x12u); |
0 | 7744 v15 = 52; |
7745 goto LABEL_13; | |
7746 case 10: | |
473 | 7747 CreateButtonInColumn(0, 0x12u); |
0 | 7748 v15 = 53; |
7749 goto LABEL_13; | |
7750 case 11: | |
473 | 7751 CreateButtonInColumn(0, 0x12u); |
0 | 7752 v15 = 54; |
7753 LABEL_13: | |
473 | 7754 CreateButtonInColumn(1, v15); |
0 | 7755 v14 = 61; |
7756 goto LABEL_41; | |
7757 case 12: | |
473 | 7758 CreateButtonInColumn(0, 0x12u); |
0 | 7759 v16 = 55; |
7760 goto LABEL_37; | |
7761 default: | |
7762 break; | |
7763 } | |
7764 LABEL_43: | |
7765 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7766 } | |
7767 // F8B1E0: using guessed type int dword_F8B1E0; | |
7768 | |
7769 //----- (004B3E1E) -------------------------------------------------------- | |
7770 void __cdecl sub_4B3E1E() | |
7771 { | |
7772 NPCData *v0; // ST40_4@1 | |
7773 signed int v1; // edi@1 | |
165 | 7774 //GUIWindow *v2; // ecx@1 |
0 | 7775 |
167 | 7776 __debugbreak(); |
602 | 7777 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7778 v1 = 0; |
7779 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7780 pDialogueWindow->Release(); | |
165 | 7781 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7782 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7783 { |
165 | 7784 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7785 v1 = 1; |
7786 } | |
165 | 7787 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7788 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7789 } | |
7790 | |
7791 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7792 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7793 { |
467 | 7794 uDialogueType = 81;//enum JoinGuildDialog |
492 | 7795 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
7796 ContractSelectText(pEventCode); | |
0 | 7797 pDialogueWindow->Release(); |
492 | 7798 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 7799 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 7800 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7801 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 7802 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); |
0 | 7803 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7804 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7805 } |
7806 // F8B19C: using guessed type int dword_F8B19C; | |
7807 | |
7808 //----- (004B3FE5) -------------------------------------------------------- | |
7809 void __fastcall sub_4B3FE5(int a4) | |
7810 { | |
7811 int v1; // edi@1 | |
7812 char *v2; // edi@1 | |
7813 | |
7814 v1 = a4; | |
7815 uDialogueType = 78; | |
7816 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
7817 _4B254D_SkillMasteryTeacher(a4); | |
7818 pDialogueWindow->Release(); | |
7819 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7820 v2 = ""; | |
492 | 7821 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 7822 pGlobalTXT_LocalizationStrings[34], |
526 | 7823 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7824 0); |
7825 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 7826 if ( contract_approved ) |
0 | 7827 v2 = pGlobalTXT_LocalizationStrings[535]; |
7828 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); | |
7829 pDialogueWindow->_41D08F(1, 1, 0, 2); | |
747 | 7830 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7831 } |
7832 // F8B19C: using guessed type int dword_F8B19C; | |
7833 // F8B1A8: using guessed type int dword_F8B1A8; | |
7834 | |
7835 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7836 void NPCHireableDialogPrepare() |
7837 { | |
0 | 7838 signed int v0; // ebx@1 |
7839 NPCData *v1; // edi@1 | |
7840 | |
7841 v0 = 0; | |
459 | 7842 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7843 pDialogueWindow->Release(); |
7844 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
607 | 7845 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
7846 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 7847 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7848 0); |
7849 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 7850 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7851 { |
607 | 7852 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
7853 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 7854 v0 = 1; |
7855 } | |
607 | 7856 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
7857 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" | |
0 | 7858 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7859 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7860 } |
7861 | |
7862 //----- (004B4224) -------------------------------------------------------- | |
423 | 7863 void _4B4224_UpdateNPCTopics( int _this ) |
7864 { | |
7865 int num_menu_buttons; // ebx@1 | |
0 | 7866 int i; // ebp@5 |
423 | 7867 // signed int v4; // ebp@9 |
7868 int v6; // eax@16 | |
7869 int v8; // eax@21 | |
7870 int v10; // eax@26 | |
7871 int v12; // eax@31 | |
7872 int v14; // eax@36 | |
7873 int v16; // eax@41 | |
0 | 7874 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7875 | |
423 | 7876 num_menu_buttons = 0; |
459 | 7877 pDialogueNPCCount = (_this + 1); |
0 | 7878 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7879 { | |
7880 pDialogueWindow->Release(); | |
7881 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7882 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
423 | 7883 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, |
0 | 7884 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7885 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 7886 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
7887 sHouseName, | |
7888 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 7889 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 7890 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0); |
0 | 7891 } |
7892 else | |
7893 { | |
459 | 7894 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7895 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7896 { |
7897 pDialogueWindow->Release(); | |
7898 } | |
7899 else | |
7900 { | |
7901 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7902 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7903 } |
7904 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
423 | 7905 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 7906 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 7907 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7908 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 7909 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7910 { |
484 | 7911 sub_4B3B42(in_current_building_type); |
0 | 7912 } |
7913 else | |
7914 { | |
7915 if ( v17->joins ) | |
7916 { | |
423 | 7917 num_menu_buttons = 1; |
0 | 7918 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0); |
7919 } | |
423 | 7920 if ( v17->evt_A) |
7921 { | |
7922 if ( num_menu_buttons < 4 ) | |
7923 { | |
7924 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7925 if ( v6 == 1 || v6 == 2 ) |
423 | 7926 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
7927 } | |
7928 } | |
7929 if ( v17->evt_B ) | |
7930 { | |
7931 if ( num_menu_buttons < 4 ) | |
7932 { | |
7933 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7934 if ( v8 == 1 || v8 == 2 ) |
423 | 7935 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
7936 } | |
7937 } | |
7938 if ( v17->evt_C ) | |
7939 { | |
7940 if ( num_menu_buttons < 4 ) | |
7941 { | |
7942 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7943 if ( v10 == 1 || v10 == 2 ) |
423 | 7944 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
7945 } | |
7946 } | |
7947 | |
7948 if ( v17->evt_D ) | |
7949 { | |
7950 if ( num_menu_buttons < 4 ) | |
7951 { | |
7952 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7953 if ( v12 == 1 || v12 == 2 ) |
423 | 7954 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
7955 } | |
7956 } | |
7957 if ( v17->evt_E ) | |
7958 { | |
7959 if ( num_menu_buttons < 4 ) | |
7960 { | |
7961 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7962 if ( v14 == 1 || v14 == 2 ) |
423 | 7963 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
7964 } | |
7965 } | |
7966 if ( v17->evt_F ) | |
7967 { | |
7968 if ( num_menu_buttons < 4 ) | |
7969 { | |
7970 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7971 if ( v16 == 1 || v16 == 2 ) |
423 | 7972 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
7973 } | |
7974 } | |
7975 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 7976 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7977 } | |
747 | 7978 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7979 } |
7980 | |
0 | 7981 } |
7982 | |
7983 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7984 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7985 { |
0 | 7986 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7987 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7988 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7989 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 7990 } |
7991 | |
7992 //----- (004B46F8) -------------------------------------------------------- | |
7993 int __fastcall sub_4B46F8(int a1) | |
7994 { | |
7995 int v1; // eax@1 | |
7996 int i; // edx@1 | |
7997 | |
7998 v1 = 0; | |
7999 for ( i = 0; i < a1; ++i ) | |
8000 v1 += i + 1; | |
8001 return 1000 * v1; | |
8002 } | |
8003 | |
8004 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8005 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8006 { |
656 | 8007 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8008 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8009 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8010 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8011 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8012 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8013 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8014 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8015 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8016 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8017 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8018 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8019 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8020 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8021 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8022 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8023 //v1 = _this; |
656 | 8024 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8025 //v3 = v1; |
656 | 8026 uDialogueType = newDialogueType; |
8027 if (!speakingNPC->uFlags) | |
8028 { | |
8029 speakingNPC->uFlags = 1; | |
8030 //v3 = uDialogueType; | |
8031 } | |
8032 | |
8033 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8034 { | |
8035 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8036 } | |
8037 else if(newDialogueType == DIALOGUE_76) | |
8038 { | |
8039 if (speakingNPC->Hired()) | |
8040 { | |
8041 v8 = 0; | |
8042 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8043 { | |
8044 v6 = (char *)pNPCStats->pNewNPCData; | |
8045 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8046 { | |
8047 ++v8; | |
8048 v6 += 76; | |
8049 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8050 break; | |
8051 } | |
8052 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8053 v6[8] &= 0x7Fu; | |
8054 } | |
8055 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8056 { | |
8057 v11 = pParty->pHirelings; | |
8058 memset(v11, 0, sizeof(NPCData)); | |
8059 } | |
8060 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8061 { | |
8062 v11 = &pParty->pHirelings[1]; | |
8063 memset(v11, 0, sizeof(NPCData)); | |
8064 } | |
8065 pParty->field_709 = 0; | |
659 | 8066 Party__CountHirelings(); |
656 | 8067 dword_591084 = 0; |
8068 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8069 dword_7241C8 = 0; | |
8070 return; | |
8071 } | |
8072 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8073 { | |
8074 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8075 ShowStatusBarString(v7, 2u); | |
8076 } | |
8077 else | |
8078 { | |
8079 //v9 = v2->uProfession; | |
8080 if ( speakingNPC->uProfession != 51 ) | |
8081 { | |
8082 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8083 if ( pParty->uNumGold < v10 ) | |
8084 { | |
8085 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8086 dialogue_show_profession_details = false; | |
8087 uDialogueType = 13; | |
8088 if ( uActiveCharacter ) | |
8089 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8090 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8091 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8092 if ( !dword_7241C8 ) | |
8093 pGame->Draw(); | |
8094 dword_7241C8 = 0; | |
8095 return; | |
8096 } | |
8097 Party::TakeGold(v10); | |
8098 } | |
8099 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8100 if ( pParty->pHirelings[0].pName ) | |
8101 { | |
8102 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8103 v15 = speakingNPC->pName; | |
8104 v13 = pParty->pHireling2Name; | |
8105 } | |
8106 else | |
8107 { | |
8108 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8109 v15 = speakingNPC->pName; | |
8110 v13 = pParty->pHireling1Name; | |
8111 } | |
8112 strcpy(v13, v15); | |
8113 pParty->field_709 = 0; | |
659 | 8114 Party__CountHirelings(); |
656 | 8115 |
8116 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8117 | |
711 | 8118 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8119 pDialogue_SpeakingActor->uAIState = Removed; |
8120 if ( uActiveCharacter ) | |
8121 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8122 } | |
8123 } | |
8124 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8125 { | |
8126 ArenaFight(); | |
8127 return; | |
8128 } | |
8129 else if(newDialogueType == DIALOGUE_9) | |
8130 { | |
8131 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8132 { | |
8133 if ( speakingNPC->uProfession != 41 ) | |
8134 speakingNPC->bHasUsedTheAbility = 1; | |
8135 | |
8136 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8137 } | |
8138 else | |
8139 { | |
8140 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8141 } | |
8142 } | |
8143 else if(newDialogueType == DIALOGUE_13) | |
8144 { | |
8145 if (!speakingNPC->Hired()) | |
8146 { | |
8147 sub_4B3E1E(); | |
8148 dialogue_show_profession_details = false; | |
8149 } | |
8150 else | |
8151 { | |
8152 v5 = 0; | |
8153 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8154 { | |
8155 v6 = (char *)pNPCStats->pNewNPCData; | |
8156 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8157 { | |
8158 ++v5; | |
8159 v6 += 76; | |
8160 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8161 break; | |
8162 } | |
8163 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8164 v6[8] &= 0x7Fu; | |
8165 } | |
8166 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8167 { | |
8168 v11 = pParty->pHirelings; | |
8169 memset(v11, 0, sizeof(NPCData)); | |
8170 } | |
8171 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8172 { | |
8173 v11 = &pParty->pHirelings[1]; | |
8174 memset(v11, 0, sizeof(NPCData)); | |
8175 } | |
8176 pParty->field_709 = 0; | |
659 | 8177 Party__CountHirelings(); |
656 | 8178 dword_591084 = 0; |
8179 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8180 dword_7241C8 = 0; | |
8181 return; | |
8182 } | |
8183 } | |
8184 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8185 { | |
8186 switch(newDialogueType) | |
8187 { | |
8188 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8189 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8190 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8191 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8192 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8193 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8194 } | |
8195 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8196 sub_4B3FE5(npc_event_id); //200-310 | |
8197 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8198 { //400-410 | |
8199 dword_F8B1D8 = newDialogueType; | |
8200 DrawJoinGuildWindow(npc_event_id - 400); | |
8201 } | |
8202 else | |
8203 { | |
8204 switch ( npc_event_id ) | |
8205 { | |
8206 case 139: | |
8207 sub_4B1ECE(); | |
8208 break; | |
8209 case 311: | |
8210 sub_4BBA85_bounties(); | |
8211 break; | |
8212 case 399: | |
8213 sub_4BBCDD(); | |
8214 break; | |
8215 default: | |
8216 activeLevelDecoration = (LevelDecoration*)1; | |
8217 ptr_F8B1E8 = 0; | |
8218 EventProcessor(npc_event_id, 0, 1); | |
8219 activeLevelDecoration = NULL; | |
8220 break; | |
8221 } | |
8222 } | |
8223 } | |
8224 if ( !dword_7241C8 ) | |
8225 pGame->Draw(); | |
8226 dword_7241C8 = 0; | |
8227 } | |
0 | 8228 |
8229 //----- (004BDAAF) -------------------------------------------------------- | |
8230 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
8231 { | |
8232 int v2; // edx@1 | |
8233 unsigned int v3; // esi@1 | |
8234 unsigned int v4; // eax@1 | |
8235 signed int v5; // edi@1 | |
8236 int v6; // edx@8 | |
8237 int v7; // edx@9 | |
8238 int v8; // edx@10 | |
8239 unsigned __int8 v9; // zf@16 | |
8240 char v10; // sf@16 | |
8241 unsigned __int8 v11; // of@16 | |
702 | 8242 bool test; |
0 | 8243 |
8244 auto a2 = _2da_idx; | |
8245 //v2 = p2DEvents_minus1___00[26 * a2]; | |
8246 v2 = p2DEvents[a2 - 1].uType; | |
8247 v3 = a1->uItemID; | |
8248 v4 = a1->uItemID; | |
8249 v5 = pItemsTable->pItems[v4].uEquipType; | |
8250 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 8251 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 8252 return 0; |
702 | 8253 switch( p2DEvents[a2 - 1].uType ) |
8254 { | |
8255 case BildingType_WeaponShop: | |
8256 { | |
8257 test = v5 <= 2; | |
8258 break; | |
8259 } | |
8260 case BildingType_ArmorShop: | |
8261 { | |
8262 test = v5 >= 3; | |
8263 break; | |
8264 } | |
8265 case BildingType_MagicShop: | |
8266 { | |
8267 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
8268 break; | |
8269 } | |
8270 case BildingType_AlchemistShop: | |
8271 { | |
8272 __debugbreak(); // need to test | |
8273 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
8274 break; | |
8275 } | |
8276 default: | |
8277 { | |
8278 test = 0; | |
8279 break; | |
8280 } | |
8281 } | |
8282 | |
8283 return test; | |
8284 /* | |
8285 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8286 { |
8287 v11 = __OFSUB__(v5, 2); | |
8288 v9 = v5 == 2; | |
8289 v10 = v5 - 2 < 0; | |
8290 goto LABEL_23; | |
8291 } | |
702 | 8292 if ( p2DEvents[a2 - 1].uType > 2 ) |
8293 { | |
8294 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8295 { |
8296 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8297 return v5 == 16; | |
8298 return 1; | |
8299 } | |
702 | 8300 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8301 return 0; |
702 | 8302 if ( p2DEvents[a2 - 1].uType == 4) |
8303 { | |
8304 if ( v5 < 13 ) | |
8305 return 0; | |
8306 if ( v5 <= 14 ) | |
8307 return 1; | |
8308 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8309 return 0; | |
8310 v11 = __OFSUB__(v3, 771); | |
8311 v9 = v3 == 771; | |
8312 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8313 LABEL_23: |
702 | 8314 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8315 return 0; | |
8316 return 1; | |
8317 } | |
8318 } | |
8319 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8320 { | |
8321 if ( v5 >= 3 ) | |
8322 { | |
8323 v11 = __OFSUB__(v5, 9); | |
8324 v9 = v5 == 9; | |
8325 v10 = v5 - 9 < 0; | |
8326 goto LABEL_23; | |
8327 } | |
0 | 8328 } |
8329 return 0; | |
702 | 8330 */ |
0 | 8331 } |
8332 | |
8333 //----- (004B6478) -------------------------------------------------------- | |
711 | 8334 void sub_4B6478() |
8335 { | |
0 | 8336 GUIWindow *v0; // ebx@1 |
8337 Player *v1; // edi@1 | |
8338 unsigned int v2; // eax@1 | |
8339 signed int v3; // esi@1 | |
8340 int v4; // ebx@1 | |
8341 unsigned int v5; // esi@5 | |
8342 int v6; // edi@6 | |
8343 int result; // eax@13 | |
8344 GUIWindow *v8; // ebx@17 | |
8345 int v9; // eax@17 | |
8346 int v10; // ecx@17 | |
8347 unsigned int v11; // ecx@18 | |
8348 int v12; // eax@20 | |
8349 int v13; // eax@21 | |
8350 GUIButton *v14; // esi@27 | |
8351 int v15; // ecx@27 | |
8352 unsigned int v16; // eax@28 | |
8353 const char *v17; // ebx@29 | |
8354 int v18; // eax@29 | |
8355 unsigned int v19; // ecx@29 | |
8356 int v20; // eax@29 | |
8357 unsigned __int16 v21; // ax@29 | |
8358 unsigned __int16 v22; // ST14_2@36 | |
8359 int v23; // eax@36 | |
8360 const char *v24; // ST18_4@37 | |
8361 unsigned __int16 v25; // ST14_2@37 | |
8362 int v26; // eax@37 | |
8363 int v27; // [sp-4h] [bp-80h]@8 | |
8364 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8365 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8366 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8367 int v31; // [sp+68h] [bp-14h]@1 | |
8368 int v32; // [sp+6Ch] [bp-10h]@1 | |
8369 int v33; // [sp+70h] [bp-Ch]@17 | |
8370 int v34; // [sp+74h] [bp-8h]@17 | |
8371 int v35; // [sp+78h] [bp-4h]@17 | |
8372 | |
336 | 8373 v0 = window_SpeakInHouse; |
8374 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8375 v1 = pPlayers[uActiveCharacter]; |
8376 v28.uFrameX = 483; | |
8377 v28.uFrameWidth = 148; | |
8378 v28.uFrameZ = 334; | |
8379 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8380 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8381 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8382 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8383 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8384 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8385 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8386 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8387 v32 = v4; | |
8388 if ( v4 < v3 / 3 ) | |
8389 { | |
8390 v4 = v3 / 3; | |
8391 v32 = v3 / 3; | |
8392 } | |
749 | 8393 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8394 { |
8395 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8396 { | |
8397 v5 = 0; | |
8398 | |
8399 __debugbreak(); | |
8400 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8401 // or | |
8402 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8403 // or | |
8404 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8405 __debugbreak(); // whacky condition - fix |
0 | 8406 if (false |
8407 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8408 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8409 { |
8410 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8411 } | |
8412 else | |
8413 { | |
8414 if ( pParty->uNumGold < v4 ) | |
8415 { | |
8416 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8417 v27 = 4; | |
8418 } | |
8419 else | |
8420 { | |
8421 Party::TakeGold(v4); | |
8422 *(short *)v6 = 1; | |
8423 v27 = 2; | |
8424 } | |
735 | 8425 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8426 } |
8427 } | |
8428 else | |
8429 { | |
8430 v5 = 0; | |
8431 } | |
437 | 8432 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8433 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8434 { | |
8435 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8436 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8437 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8438 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8439 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8440 }*/ |
8441 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8442 return; // void func |
0 | 8443 } |
484 | 8444 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8445 { |
8446 v24 = pNPCTopics[171].pText; | |
8447 v25 = v31; | |
8448 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8449 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8450 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8451 return ; |
8452 } | |
8453 | |
8454 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8455 return; | |
0 | 8456 v8 = pDialogueWindow; |
8457 v33 = 0; | |
8458 v34 = 0; | |
8459 v29 = pDialogueWindow; | |
8460 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8461 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8462 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8463 if ( v9 >= v10 ) | |
8464 goto LABEL_40; | |
8465 do | |
8466 { | |
8467 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 8468 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8469 { |
8470 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8471 v33 += v12; | |
8472 ++v34; | |
8473 } | |
8474 v13 = v8->pStartingPosActiveItem; | |
8475 ++v35; | |
8476 } | |
8477 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8478 if ( !v34 ) | |
8479 { | |
8480 LABEL_40: | |
135 | 8481 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8482 strcat(pTmpBuf, "\n \n"); |
8483 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8484 v22 = v31; | |
8485 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8486 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8487 return; | |
0 | 8488 } |
8489 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8490 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8491 v32 = (149 - v33) / v34; | |
8492 if ( (149 - v33) / v34 > 32 ) | |
8493 v32 = 32; | |
711 | 8494 |
8495 v35 = v8->pStartingPosActiveItem; | |
0 | 8496 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8497 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8498 { |
8499 v33 = 2; | |
8500 do | |
8501 { | |
8502 v14 = v8->GetControl(v35); | |
8503 v15 = v14->uControlParam - 36; | |
135 | 8504 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8505 { |
8506 v16 = 0; | |
8507 if ( !v1->pActiveSkills[v15] ) | |
8508 { | |
8509 v17 = pSkillNames[v15]; | |
8510 v14->uY = v32 + v34; | |
8511 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8512 v19 = v14->uY; | |
8513 v14->uHeight = v18; | |
8514 v20 = v19 + v18 - 1; | |
8515 v14->uW = v20; | |
8516 v34 = v20; | |
8517 v21 = v31; | |
8518 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8519 v21 = v30; | |
8520 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8521 goto LABEL_34; | |
8522 } | |
8523 } | |
8524 else | |
8525 { | |
8526 v16 = 0; | |
8527 } | |
8528 v14->uW = v16; | |
8529 v14->uHeight = v16; | |
8530 v14->uY = v16; | |
8531 LABEL_34: | |
8532 v8 = v29; | |
8533 ++v35; | |
8534 ++v33; | |
711 | 8535 } |
8536 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8537 } | |
8538 return; | |
0 | 8539 } |
8540 | |
8541 //----- (00405CFF) -------------------------------------------------------- | |
8542 void stru262_TurnBased::End(bool bPlaySound) | |
8543 { | |
8544 stru262_TurnBased *v2; // edi@1 | |
8545 int v3; // ebx@1 | |
8546 int v4; // esi@1 | |
8547 unsigned __int8 v5; // zf@1 | |
8548 unsigned __int8 v6; // sf@1 | |
8549 TurnBased_QueueElem *v7; // ecx@2 | |
8550 unsigned __int16 *pAttributes; // ecx@7 | |
8551 size_t v9; // edx@7 | |
8552 unsigned __int16 v10; // ax@8 | |
8553 TurnBased_QueueElem *v11; // ebx@12 | |
8554 ObjectType objType; // eax@13 | |
8555 int objID; // esi@13 | |
8556 int v14; // [sp+Ch] [bp-4h]@11 | |
8557 | |
8558 v2 = this; | |
8559 v3 = 0; | |
8560 v4 = 0; | |
8561 v5 = this->uActorQueueSize == 0; | |
8562 v6 = this->uActorQueueSize < 0; | |
8563 this->field_4 = 0; | |
8564 if ( !(v6 | v5) ) | |
8565 { | |
8566 v7 = this->pQueue; | |
8567 do | |
8568 { | |
8569 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
8570 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
8571 ++v4; | |
8572 ++v7; | |
8573 } | |
8574 while ( v4 < v2->uActorQueueSize ); | |
8575 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8576 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8577 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8578 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8579 v9 = uNumSpriteObjects; |
0 | 8580 do |
8581 { | |
8582 v10 = *pAttributes; | |
8583 if ( *pAttributes & 4 ) | |
8584 { | |
8585 LOBYTE(v10) = v10 & 0xFB; | |
8586 *pAttributes = v10; | |
8587 } | |
8588 pAttributes += 56; | |
8589 --v9; | |
8590 } | |
8591 while ( v9 ); | |
8592 } | |
8593 v14 = 0; | |
8594 if ( v2->uActorQueueSize > 0 ) | |
8595 { | |
8596 v11 = v2->pQueue; | |
8597 do | |
8598 { | |
8599 objType = (ObjectType)(v11->uPackedID & 7); | |
8600 objID = v11->uPackedID >> 3; | |
8601 if ( objType == OBJECT_Player ) | |
8602 { | |
8603 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8604 } | |
8605 else | |
8606 { | |
8607 if ( objType == OBJECT_Actor ) | |
8608 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8609 } | |
8610 ++v14; | |
8611 ++v11; | |
8612 } | |
8613 while ( v14 < v2->uActorQueueSize ); | |
8614 v3 = 0; | |
8615 } | |
8616 pAudioPlayer->StopChannels(-1, -1); | |
8617 if ( bPlaySound != v3 ) | |
8618 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8619 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8620 pEventTimer->StopGameTime(); | |
8621 dword_50C994 = v3; | |
8622 dword_50C998_turnbased_icon_1A = v3; | |
8623 } | |
8624 // 50C994: using guessed type int dword_50C994; | |
8625 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8626 | |
8627 //----- (00405E14) -------------------------------------------------------- | |
8628 void stru262_TurnBased::_405E14() | |
8629 { | |
8630 stru262_TurnBased *v1; // esi@1 | |
8631 int v2; // ecx@1 | |
8632 SpellBuff *v3; // edi@2 | |
8633 Actor *v4; // ebx@3 | |
8634 signed int v5; // edx@20 | |
8635 AIDirection *v6; // esi@21 | |
8636 int v7; // eax@21 | |
8637 int v8; // eax@21 | |
8638 int v9; // eax@22 | |
8639 int v10; // eax@23 | |
8640 int v11; // eax@37 | |
8641 int v12; // eax@44 | |
8642 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8643 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8644 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8645 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8646 int v17; // [sp+5Ch] [bp-10h]@6 |
8647 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8648 int v19; // [sp+64h] [bp-8h]@8 | |
8649 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8650 | |
8651 v1 = this; | |
8652 v2 = 0; | |
8653 v18 = v1; | |
8654 v20 = 0; | |
8655 if ( (signed int)uNumActors > 0 ) | |
8656 { | |
90 | 8657 //v3 = pActors;//[0].pActorBuffs; |
8658 v16 = pActors;//[0].pActorBuffs; | |
8659 v3 = v16->pActorBuffs; | |
0 | 8660 do |
8661 { | |
90 | 8662 v4 = v16; |
8663 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8664 v17 = v2; |
8665 else | |
8666 v17 = 1; | |
8667 v19 = v2; | |
8668 do | |
8669 { | |
8670 if ( v19 != 10 ) | |
8671 { | |
8672 v3->_4585CA(pParty->uTimePlayed); | |
8673 v2 = 0; | |
8674 } | |
8675 ++v19; | |
8676 ++v3; | |
8677 } | |
8678 while ( v19 < 22 ); | |
8679 if ( v17 != v2 | |
8680 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8681 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8682 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8683 if ( !(v4->uAttributes & 0x80) ) | |
8684 { | |
8685 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8686 { | |
8687 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8688 { | |
8689 v5 = v4->uCurrentActionLength; | |
8690 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8691 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8692 { | |
417 | 8693 v17 = ai_near_actors_targets_pid[v20]; |
8694 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 8695 v7 = v4->uAIState; |
8696 memcpy(&v15, v6, sizeof(v15)); | |
8697 v8 = v7 - 4; | |
8698 memcpy(&v14, &v15, sizeof(v14)); | |
8699 if ( v8 ) | |
8700 { | |
8701 v9 = v8 - 1; | |
8702 if ( v9 ) | |
8703 { | |
8704 v10 = v9 - 6; | |
8705 if ( v10 ) | |
8706 { | |
8707 if ( v10 != 8 ) | |
414 | 8708 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8709 } |
8710 } | |
8711 } | |
8712 else | |
8713 { | |
8714 v4->uCurrentActionTime = 0; | |
8715 v4->uCurrentActionLength = 0; | |
8716 v4->uAIState = Dead; | |
8717 v4->UpdateAnimation(); | |
8718 } | |
8719 v1 = v18; | |
8720 v2 = 0; | |
8721 } | |
8722 } | |
8723 } | |
8724 } | |
8725 ++v20; | |
90 | 8726 v3 = v16[1].pActorBuffs; |
8727 ++v16; | |
0 | 8728 } |
8729 while ( (signed int)v20 < (signed int)uNumActors ); | |
8730 } | |
8731 if ( v1->field_4 == 1 ) | |
8732 { | |
8733 v12 = v1->field_8; | |
8734 if ( v12 == 64 ) | |
8735 { | |
8736 v1->_406A63(); | |
8737 } | |
8738 else | |
8739 { | |
8740 if ( v12 > v2 ) | |
8741 { | |
8742 v1->_406B9F(); | |
8743 } | |
8744 else | |
8745 { | |
8746 v1->_406AFE(); | |
8747 v1->field_10 = 100; | |
8748 } | |
8749 } | |
8750 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8751 return; | |
8752 } | |
8753 if ( v1->field_4 == 2 ) | |
8754 { | |
8755 if ( !(v1->field_18 & 1) ) | |
8756 { | |
8757 v11 = v1->field_10; | |
8758 if ( v11 == 100 ) | |
8759 { | |
8760 v1->StartTurn(); | |
8761 LABEL_39: | |
8762 v1->_40652A(); | |
8763 return; | |
8764 } | |
8765 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8766 { | |
8767 v1->_4065B0(); | |
8768 goto LABEL_39; | |
8769 } | |
8770 } | |
8771 v1->NextTurn(); | |
8772 return; | |
8773 } | |
8774 if ( v1->field_4 == 3 ) | |
8775 { | |
8776 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8777 { | |
8778 v1->field_18 &= 0xFFFFFFF7u; | |
8779 v1->field_4 = 1; | |
8780 v1->field_8 = 64; | |
8781 } | |
8782 else | |
8783 { | |
8784 v1->_406FA8(); | |
8785 } | |
8786 } | |
8787 } | |
8788 | |
8789 //----- (0043FDED) -------------------------------------------------------- | |
8790 void PrepareActorRenderList_BLV() | |
8791 { | |
8792 RenderBillboard *v0; // esi@0 | |
8793 unsigned __int16 v3; // ax@3 | |
8794 unsigned int v4; // eax@5 | |
8795 unsigned __int16 v5; // cx@5 | |
8796 int v6; // esi@5 | |
8797 unsigned int v7; // eax@7 | |
8798 int v8; // eax@10 | |
8799 SpriteFrame *v9; // eax@16 | |
8800 SpriteFrame *v10; // ebx@18 | |
8801 //int *v11; // eax@18 | |
8802 int v12; // ecx@28 | |
8803 //IndoorCameraD3D **v14; // eax@36 | |
8804 double v15; // st7@36 | |
8805 float v16; // eax@36 | |
8806 //double v17; // ST30_8@36 | |
8807 signed __int64 v18; // qtt@36 | |
8808 int v19; // ST5C_4@36 | |
8809 signed __int64 v20; // qtt@37 | |
8810 int v21; // ST5C_4@37 | |
8811 signed __int16 v22; // cx@39 | |
8812 int v23; // ST50_4@40 | |
8813 signed int v24; // ecx@40 | |
8814 int v25; // edx@44 | |
8815 __int16 v26; // ax@44 | |
8816 //MonsterDesc *v27; // edx@44 | |
8817 //int v28; // ecx@44 | |
8818 unsigned __int8 v29; // zf@44 | |
8819 unsigned __int8 v30; // sf@44 | |
8820 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8821 int v32; // [sp+1Ch] [bp-38h]@5 | |
8822 int a3; // [sp+20h] [bp-34h]@5 | |
8823 int a2; // [sp+24h] [bp-30h]@5 | |
8824 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8825 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8826 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8827 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8828 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8829 int a6; // [sp+40h] [bp-14h]@34 | |
8830 int v43; // [sp+44h] [bp-10h]@34 | |
8831 int z; // [sp+48h] [bp-Ch]@32 | |
8832 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8833 int x; // [sp+50h] [bp-4h]@32 | |
8834 | |
8835 for (uint i = 0; i < uNumActors; ++i) | |
8836 { | |
8837 auto p = pActors + i; | |
8838 | |
8839 if (p->uAIState == Removed || | |
8840 p->uAIState == Disabled) | |
8841 continue; | |
8842 | |
8843 a5 = p->uSectorID; | |
8844 a2 = p->vPosition.y; | |
8845 a1a = p->vPosition.x; | |
8846 a3 = p->vPosition.z; | |
8847 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8848 LOWORD(v0) = p->uYawAngle; | |
8849 v5 = p->uCurrentActionAnimation; | |
8850 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8851 v32 = v6; | |
8852 if ( pParty->bTurnBasedModeOn ) | |
8853 { | |
8854 if ( v5 == 1 ) | |
8855 { | |
8856 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8857 goto LABEL_10; | |
8858 } | |
8859 } | |
8860 else | |
8861 { | |
8862 if ( v5 == 1 ) | |
8863 { | |
8864 v7 = pBLVRenderParams->field_0_timer_; | |
8865 LABEL_10: | |
8866 v8 = i * 32 + v7; | |
8867 goto LABEL_12; | |
8868 } | |
8869 } | |
8870 v8 = p->uCurrentActionTime; | |
8871 LABEL_12: | |
8872 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8873 v8 = 0; | |
8874 v31 = p->pSpriteIDs[v5]; | |
8875 if (p->uAIState == Resurrected) | |
8876 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8877 else | |
8878 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8879 v41 = 0; | |
8880 v10 = v9; | |
8881 //v11 = (int *)v9->uFlags; | |
8882 if (v9->uFlags & 2) | |
8883 v41 = 2; | |
8884 if (v9->uFlags & 0x40000) | |
8885 v41 |= 0x40u; | |
8886 if (v9->uFlags & 0x20000) | |
8887 LOBYTE(v41) = v41 | 0x80; | |
8888 v0 = (RenderBillboard *)(256 << v6); | |
8889 if ( (unsigned int)v0 & v9->uFlags) | |
8890 v41 |= 4u; | |
8891 if ( v10->uGlowRadius ) | |
8892 { | |
8893 //LOBYTE(v11) = byte_4E94D3; | |
8894 pMobileLightsStack->AddLight( | |
8895 a1a, | |
8896 a2, | |
8897 a3, | |
8898 a5, | |
8899 v10->uGlowRadius, | |
8900 0xFFu, | |
8901 0xFFu, | |
8902 0xFFu, | |
8903 byte_4E94D3); | |
8904 } | |
8905 v12 = 0; | |
8906 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8907 continue; | |
8908 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8909 { | |
8910 ++v12; | |
8911 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8912 goto _continue; | |
8913 } | |
8914 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8915 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8916 continue; | |
8917 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8918 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8919 if (uNumBillboardsToDraw >= 500) | |
8920 break; | |
8921 ++uNumBillboardsToDraw; | |
8922 ++uNumSpritesDrawnThisFrame; | |
8923 p->uAttributes |= 8u; | |
8924 v29 = pRenderer->pRenderD3D == 0; | |
8925 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8926 v0->uPalette = v10->uPaletteIndex; | |
8927 v0->uIndoorSectorID = a5; | |
8928 if ( v29 ) | |
8929 { | |
8930 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8931 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8932 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8933 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8934 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8935 } | |
8936 else | |
8937 { | |
8938 //v14 = &pGame->pIndoorCameraD3D; | |
8939 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8940 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8941 v16 = v0->fov_x; | |
8942 v0->fov_y = v15; | |
8943 //v17 = v16 + 6.7553994e15; | |
8944 LODWORD(v18) = 0; | |
8945 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8946 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8947 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8948 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8949 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8950 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8951 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8952 { | |
8953 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8954 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8955 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8956 goto LABEL_43; |
8957 } | |
8958 } | |
8959 else | |
8960 { | |
8961 v22 = p->pActorBuffs[3].uPower; | |
8962 if ( v22 ) | |
8963 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8964 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8965 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8966 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8967 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8968 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8969 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8970 goto LABEL_44; |
8971 } | |
8972 } | |
8973 LABEL_44: | |
8974 HIWORD(v25) = HIWORD(x); | |
430 | 8975 v0->world_x = a1a; |
8976 v0->world_y = a2; | |
8977 v0->world_z = a3; | |
0 | 8978 v0->uScreenSpaceX = v43; |
8979 v0->uScreenSpaceY = a6; | |
8980 LOWORD(v25) = 0; | |
8981 LOBYTE(v26) = v41; | |
194 | 8982 |
8983 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
8984 v0->actual_z = HIWORD(x); | |
8985 v0->object_pid = v8 * i | OBJECT_Actor; | |
8986 | |
0 | 8987 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8988 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8989 v0->field_1E = v41; | |
8990 v0->pSpriteFrame = v10; | |
8991 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8992 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8993 { | |
8994 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8995 v0->field_1E = v26; | |
8996 } | |
8997 | |
8998 _continue: | |
8999 ; | |
9000 } | |
9001 } | |
9002 | |
9003 //----- (00444732) -------------------------------------------------------- | |
428 | 9004 char *GetEventHintString(unsigned int uEventID) |
9005 { | |
9006 signed int event_index; // edx@1 | |
9007 int event_pos; // esi@4 | |
0 | 9008 char *result; // eax@6 |
428 | 9009 unsigned int str_index; // eax@9 |
9010 int i; // esi@11 | |
9011 _evt_raw* test_evt; | |
9012 _evt_raw* last_evt; | |
9013 | |
9014 event_index = 0; | |
9015 if ( uLevelEVT_NumEvents <= 0 ) | |
9016 return NULL; | |
9017 | |
9018 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9019 while ( 1 ) |
9020 { | |
428 | 9021 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9022 { | |
9023 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9024 last_evt=test_evt; | |
9025 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9026 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9027 break; |
9028 } | |
428 | 9029 ++event_index; |
9030 if ( event_index >= uLevelEVT_NumEvents ) | |
9031 return NULL; | |
9032 } | |
9033 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9034 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9035 { | |
9036 str_index = EVT_DWORD(test_evt->v5); | |
9037 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9038 } |
9039 else | |
9040 { | |
428 | 9041 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9042 { | |
9043 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9044 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9045 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9046 { | |
9047 str_index = EVT_DWORD(test_evt->v5); | |
9048 if ( str_index < 600 ) | |
9049 return (char *)p2DEvents[str_index - 1].pName; | |
9050 } | |
9051 } | |
9052 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9053 } | |
9054 | |
0 | 9055 return result; |
9056 } | |
9057 | |
9058 //----- (00444839) -------------------------------------------------------- | |
9059 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) | |
9060 { | |
9061 unsigned int v9; // ebx@1 | |
9062 int v10; // edi@1 | |
373 | 9063 //signed int v11; // eax@1 |
0 | 9064 unsigned int v12; // eax@6 |
9065 const char *v13; // ST0C_4@6 | |
9066 unsigned int v14; // eax@8 | |
9067 const char *v15; // eax@14 | |
9068 unsigned int v16; // eax@16 | |
9069 unsigned int result; // eax@26 | |
9070 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9071 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9072 char *v20; // [sp-4h] [bp-3Ch]@9 |
9073 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9074 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9075 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9076 | |
9077 v9 = a1; | |
9078 v10 = a2; | |
9079 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9080 dword_59117C_teleportx = x; | |
9081 dword_591178_teleporty = y; | |
9082 dword_591174_teleportz = z; | |
9083 dword_591170_teleport_directiony = directiony; | |
9084 dword_59116C_teleport_directionx = directionx; | |
9085 dword_591168_teleport_speedz = a8; | |
9086 dword_591164_teleport_map_name = (char *)pLocationName; | |
9087 uCurrentHouse_Animation = v9; | |
9088 pEventTimer->Pause(); | |
9089 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9090 |
9091 switch (pParty->alignment) | |
9092 { | |
9093 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9094 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9095 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9096 default: assert(false); | |
9097 } | |
9098 /*v11 = const_2(); | |
0 | 9099 sprintf(pContainer, "evt%02d", v11); |
9100 if ( pParty->uAlignment ) | |
9101 { | |
9102 if ( pParty->uAlignment != 2 ) | |
9103 goto LABEL_6; | |
9104 v19 = "-c"; | |
9105 } | |
9106 else | |
9107 { | |
9108 v19 = "-b"; | |
9109 } | |
373 | 9110 strcat(pContainer, v19);*/ |
9111 | |
9112 //LABEL_6: | |
0 | 9113 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9114 v13 = pHouse_ExitPictures[v10]; | |
9115 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9116 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9117 if ( v9 ) | |
9118 { | |
9119 if ( !v23 ) | |
9120 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 9121 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 9122 } |
9123 else | |
9124 { | |
9125 if ( !v23 ) | |
9126 { | |
9127 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9128 if ( v14 ) | |
9129 { | |
721 | 9130 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9131 goto LABEL_20; |
9132 } | |
9133 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9134 goto LABEL_19; | |
9135 } | |
9136 } | |
9137 v15 = pLocationName; | |
9138 if ( *pLocationName == 48 ) | |
9139 v15 = pCurrentMapName; | |
9140 v16 = pMapStats->GetMapInfo(v15); | |
9141 if ( v16 ) | |
9142 { | |
721 | 9143 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9144 goto LABEL_20; | |
0 | 9145 } |
9146 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9147 LABEL_19: | |
423 | 9148 strcpy(sHouseName, v21); |
0 | 9149 LABEL_20: |
710 | 9150 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9151 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9152 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9153 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9154 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9155 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9156 result = v23; |
9157 if ( v23 ) | |
9158 uCurrentHouse_Animation = v23; | |
9159 return result; | |
9160 } |