Mercurial > mm7
annotate mm7_4.cpp @ 890:dba25247e74f
massive cast spell clean
author | zipi |
---|---|
date | Wed, 03 Apr 2013 00:44:11 +0100 |
parents | b7246c149957 |
children | 10fa7dad1391 |
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 "GUIFont.h" | |
10 #include "Party.h" | |
11 #include "AudioPlayer.h" | |
12 #include "Outdoor.h" | |
13 #include "IndoorCamera.h" | |
14 #include "Overlays.h" | |
15 #include "Monsters.h" | |
16 #include "Arcomage.h" | |
17 #include "LOD.h" | |
18 #include "Actor.h" | |
19 #include "Allocator.h" | |
20 #include "Events.h" | |
21 #include "Viewport.h" | |
22 #include "FrameTableInc.h" | |
23 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
24 #include "SpriteObject.h" |
0 | 25 #include "ObjectList.h" |
26 #include "Chest.h" | |
27 #include "PaletteManager.h" | |
28 #include "DecorationList.h" | |
29 #include "SaveLoad.h" | |
30 #include "stru123.h" | |
31 #include "stru287.h" | |
32 #include "Time.h" | |
33 #include "IconFrameTable.h" | |
34 #include "GUIProgressBar.h" | |
35 #include "Bink_Smacker.h" | |
36 #include "TileFrameTable.h" | |
37 #include "PlayerFrameTable.h" | |
38 #include "Awards.h" | |
39 #include "Autonotes.h" | |
40 #include "stru160.h" | |
41 #include "stru279.h" | |
42 #include "TurnEngine.h" | |
43 #include "FactionTable.h" | |
44 #include "StorylineTextTable.h" | |
45 #include "Random.h" | |
46 #include "stru277.h" | |
47 #include "stru298.h" | |
48 #include "stru12.h" | |
49 #include "stru351.h" | |
50 #include "Events2D.h" | |
51 #include "stru159.h" | |
189 | 52 #include "texts.h" |
0 | 53 #include "Log.h" |
629 | 54 #include "UIHouses.h" |
0 | 55 #include "mm7_data.h" |
56 | |
57 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 58 void __cdecl check_event_triggers() |
0 | 59 { |
60 int v0; // eax@1 | |
61 LevelDecoration *v1; // esi@2 | |
62 signed int v2; // edi@2 | |
63 int v3; // ebx@2 | |
64 int v4; // eax@3 | |
65 int v5; // ebx@3 | |
66 unsigned int v6; // ecx@3 | |
67 unsigned int v7; // edx@6 | |
68 unsigned int v8; // edx@8 | |
112 | 69 Actor *v9; // edi@13 |
0 | 70 int v10; // ebx@14 |
71 int v11; // eax@14 | |
72 int v12; // ebx@14 | |
73 unsigned int v13; // ecx@14 | |
74 int v14; // edx@15 | |
75 unsigned int v15; // edx@17 | |
76 unsigned int v16; // edx@19 | |
77 char *v17; // edi@25 | |
78 int v18; // ebx@26 | |
79 int v19; // eax@26 | |
80 int v20; // ebx@26 | |
81 unsigned int v21; // ecx@26 | |
82 int v22; // edx@27 | |
83 unsigned int v23; // edx@29 | |
84 unsigned int v24; // edx@31 | |
85 int v25; // [sp+0h] [bp-24h]@3 | |
86 int v26; // [sp+0h] [bp-24h]@14 | |
87 int v27; // [sp+0h] [bp-24h]@26 | |
88 int v28; // [sp+4h] [bp-20h]@3 | |
89 int v29; // [sp+4h] [bp-20h]@14 | |
90 int v30; // [sp+4h] [bp-20h]@26 | |
91 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
92 int v32; // [sp+Ch] [bp-18h]@2 | |
93 int v33; // [sp+10h] [bp-14h]@2 | |
94 int i; // [sp+14h] [bp-10h]@1 | |
95 int v35; // [sp+18h] [bp-Ch]@2 | |
96 int v36; // [sp+1Ch] [bp-8h]@3 | |
97 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
98 signed int v38; // [sp+20h] [bp-4h]@24 | |
99 | |
100 v0 = 0; | |
101 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
102 { | |
103 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
104 v2 = v1->field_18; | |
105 v3 = v1->vPosition.y; | |
106 v33 = v1->vPosition.x; | |
107 v32 = v1->vPosition.y; | |
108 v35 = v1->vPosition.z; | |
109 v31 = v1->field_18; | |
110 if ( v1->field_2 & 1 ) | |
111 { | |
112 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
113 v25 = abs(v3 - pParty->vPosition.y); | |
114 v28 = abs(v35 - pParty->vPosition.z); | |
115 v4 = v36; | |
116 v5 = v25; | |
117 v6 = v28; | |
118 if ( v36 < v25 ) | |
119 { | |
120 v4 = v25; | |
121 v5 = v36; | |
122 } | |
123 if ( v4 < v28 ) | |
124 { | |
125 v7 = v4; | |
126 v4 = v28; | |
127 v6 = v7; | |
128 } | |
129 if ( v5 < (signed int)v6 ) | |
130 { | |
131 v8 = v6; | |
132 v6 = v5; | |
133 v5 = v8; | |
134 } | |
135 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 136 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 137 } |
138 if ( v1->field_2 & 2 ) | |
139 { | |
140 v37 = 0; | |
141 if ( (signed int)uNumActors > 0 ) | |
142 { | |
112 | 143 v9 = pActors;//[0].vPosition.y; |
0 | 144 do |
145 { | |
112 | 146 v10 = abs(v33 - v9->vPosition.x); |
147 v29 = abs(v32 - v9->vPosition.y); | |
148 v26 = abs(v35 - v9->vPosition.z); | |
0 | 149 v11 = v10; |
150 v12 = v29; | |
151 v13 = v26; | |
152 if ( v11 < v29 ) | |
153 { | |
154 v14 = v11; | |
155 v11 = v29; | |
156 v12 = v14; | |
157 } | |
158 if ( v11 < v26 ) | |
159 { | |
160 v15 = v11; | |
161 v11 = v26; | |
162 v13 = v15; | |
163 } | |
164 if ( v12 < (signed int)v13 ) | |
165 { | |
166 v16 = v13; | |
167 v13 = v12; | |
168 v12 = v16; | |
169 } | |
170 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
171 EventProcessor(v1->field_16_event_id, 0, 1); | |
172 ++v37; | |
112 | 173 ++v9; |
0 | 174 } |
175 while ( v37 < (signed int)uNumActors ); | |
176 } | |
177 } | |
178 if ( v1->field_2 & 4 ) | |
179 { | |
180 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
181 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
182 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
183 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 184 do |
185 { | |
186 v18 = abs(v33 - *((int *)v17 - 1)); | |
187 v30 = abs(v32 - *(int *)v17); | |
188 v27 = abs(v35 - *((int *)v17 + 1)); | |
189 v19 = v18; | |
190 v20 = v30; | |
191 v21 = v27; | |
192 if ( v19 < v30 ) | |
193 { | |
194 v22 = v19; | |
195 v19 = v30; | |
196 v20 = v22; | |
197 } | |
198 if ( v19 < v27 ) | |
199 { | |
200 v23 = v19; | |
201 v19 = v27; | |
202 v21 = v23; | |
203 } | |
204 if ( v20 < (signed int)v21 ) | |
205 { | |
206 v24 = v21; | |
207 v21 = v20; | |
208 v20 = v24; | |
209 } | |
210 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
211 EventProcessor(v1->field_16_event_id, 0, 1); | |
212 ++v38; | |
213 v17 += 112; | |
214 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
215 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 216 } |
217 } | |
218 v0 = i + 1; | |
219 } | |
220 } | |
221 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
222 | |
223 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 224 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 225 { |
226 int v13; // ecx@13 | |
227 signed int v14; // ebx@14 | |
228 int v15; // eax@16 | |
729 | 229 //int v16; // edx@19 |
792 | 230 //int v17; // ST18_4@19 |
231 //signed int v18; // edx@19 | |
232 //signed __int64 v19; // qtt@19 | |
0 | 233 int v21; // eax@27 |
792 | 234 //int v22; // ecx@29 |
0 | 235 signed int v28; // eax@45 |
236 int v29; // ebx@47 | |
237 int v30; // edx@49 | |
830 | 238 //int v31; // ST10_4@49 |
239 //signed int v32; // edx@49 | |
0 | 240 signed __int64 v33; // qtt@49 |
830 | 241 //signed int v34; // eax@54 |
242 //signed int v35; // esi@56 | |
243 //int result; // eax@57 | |
0 | 244 int v38; // edx@62 |
792 | 245 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 246 bool v47; // [sp+24h] [bp-1Ch]@43 |
247 bool v48; // [sp+28h] [bp-18h]@10 | |
248 bool v49; // [sp+28h] [bp-18h]@41 | |
249 bool v50; // [sp+2Ch] [bp-14h]@12 | |
250 signed int v53; // [sp+30h] [bp-10h]@10 | |
251 signed int v54; // [sp+30h] [bp-10h]@41 | |
252 signed int v55; // [sp+34h] [bp-Ch]@1 | |
253 | |
730 | 254 //LOG_DECOMPILATION_WARNING(); |
255 | |
256 static int blv_floor_id[50]; // 00721200 | |
257 static int blv_floor_level[50]; // 007212C8 | |
258 | |
259 static __int16 word_721390_ys[104]; // idb | |
260 static __int16 word_721460_xs[104]; // idb | |
0 | 261 |
262 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 263 v55 = 0; |
0 | 264 for (uint i = 0; i < pSector->uNumFloors; ++i) |
265 { | |
266 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
267 if (pFloor->Clickable()) | |
268 continue; | |
269 | |
792 | 270 assert(pFloor->uNumVertices); |
0 | 271 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
272 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
273 { | |
274 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
275 { | |
730 | 276 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
277 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
278 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
279 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 280 } |
730 | 281 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
282 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
283 | |
792 | 284 v50 = word_721390_ys[0] >= y; |
0 | 285 v53 = 0; |
792 | 286 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
287 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 288 { |
289 if (v53 >= 2) | |
290 break; | |
291 | |
292 v48 = v50; | |
293 v50 = word_721390_ys[j + 1] >= y; | |
730 | 294 |
295 v13 = i; | |
792 | 296 if (v48 == v50) |
297 continue; | |
298 | |
299 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
300 v15 = v14 | word_721460_xs[j] < x; | |
301 | |
302 if (v15 == 3) | |
303 continue; | |
304 else if (!v15) | |
305 ++v53; | |
306 else | |
0 | 307 { |
792 | 308 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 309 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 310 |
311 if (res + word_721460_xs[j] >= x) | |
729 | 312 ++v53; |
0 | 313 } |
792 | 314 } |
315 | |
316 | |
0 | 317 if ( v53 == 1 ) |
318 { | |
319 if ( v55 >= 50 ) | |
320 break; | |
723 | 321 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 322 { |
725 | 323 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 324 } |
325 else | |
326 { | |
871 | 327 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 328 } |
792 | 329 blv_floor_level[v55] = v21; |
330 blv_floor_id[v55] = pSector->pFloors[i]; | |
331 v55++; | |
0 | 332 } |
792 | 333 } |
334 } | |
335 | |
336 | |
0 | 337 if ( pSector->field_0 & 8 ) |
338 { | |
339 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
340 { | |
341 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
342 if (portal->uPolygonType != POLYGON_Floor) | |
343 continue; | |
344 | |
830 | 345 if (!portal->uNumVertices) |
346 continue; | |
347 | |
723 | 348 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
349 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
350 { | |
0 | 351 for (uint j = 0; j < portal->uNumVertices; ++j) |
352 { | |
730 | 353 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
354 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
355 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
356 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
357 } | |
358 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
359 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 360 v54 = 0; |
830 | 361 v47 = word_721390_ys[0] >= y; |
362 | |
363 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 364 { |
830 | 365 v49 = v47; |
0 | 366 if ( v54 >= 2 ) |
367 break; | |
830 | 368 v47 = word_721390_ys[j + 1] >= y; |
0 | 369 if ( v49 != v47 ) |
370 { | |
830 | 371 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
372 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 373 if ( v29 != 3 ) |
374 { | |
723 | 375 if ( !v29 ) |
729 | 376 ++v54; |
377 else | |
378 { | |
830 | 379 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 380 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 381 if (res + word_721460_xs[j] >= x) |
723 | 382 ++v54; |
729 | 383 } |
0 | 384 } |
385 } | |
386 } | |
387 if ( v54 == 1 ) | |
388 { | |
389 if ( v55 >= 50 ) | |
390 break; | |
830 | 391 blv_floor_level[v55] = -29000; |
392 blv_floor_id[v55] = pSector->pPortals[i]; | |
393 v55++; | |
0 | 394 } |
395 } | |
396 } | |
397 } | |
398 if ( v55 == 1 ) | |
399 { | |
730 | 400 *pFaceID = blv_floor_id[0]; |
725 | 401 return blv_floor_level[0]; |
0 | 402 } |
403 if ( !v55 ) | |
404 return -30000; | |
730 | 405 *pFaceID = blv_floor_id[0]; |
725 | 406 //result = blv_floor_level[0]; |
830 | 407 |
408 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 409 { |
725 | 410 if ( blv_floor_level[0] <= z + 5 ) |
411 { | |
412 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 413 continue; |
725 | 414 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 415 *pFaceID = blv_floor_id[v35]; |
717 | 416 continue; |
417 } | |
725 | 418 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
419 { | |
420 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 421 *pFaceID = blv_floor_id[v35]; |
717 | 422 } |
830 | 423 }*/ |
424 | |
425 | |
426 int result = blv_floor_level[0]; | |
427 for (uint i = 1; i < v55; ++i) | |
428 { | |
429 v38 = blv_floor_level[i]; | |
430 if ( result <= z + 5 ) | |
431 { | |
432 if ( v38 > result && v38 <= z + 5 ) | |
433 { | |
434 result = blv_floor_level[i]; | |
435 *pFaceID = blv_floor_id[i]; | |
436 } | |
437 } | |
438 else if ( v38 < result ) | |
439 { | |
440 result = blv_floor_level[i]; | |
441 *pFaceID = blv_floor_id[i]; | |
442 } | |
443 } | |
444 | |
445 return result; | |
0 | 446 } |
447 | |
448 //----- (0046D49E) -------------------------------------------------------- | |
791 | 449 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 450 { |
723 | 451 BSPModel *pBModel; // esi@4 |
452 ODMFace *pFace; // ecx@11 | |
0 | 453 int v14; // edx@20 |
454 signed int v18; // edx@26 | |
455 int v19; // eax@28 | |
456 int v20; // edx@30 | |
457 int v21; // ST1C_4@30 | |
458 signed int v22; // edx@30 | |
459 signed __int64 v23; // qtt@30 | |
460 int v24; // eax@36 | |
461 signed int v25; // ecx@38 | |
462 int result; // eax@42 | |
463 signed int v27; // ecx@43 | |
464 int v28; // edi@44 | |
465 signed int v29; // edx@44 | |
466 int v30; // esi@45 | |
467 int v31; // eax@45 | |
468 ODMFace *v32; // eax@57 | |
469 int v33; // ecx@59 | |
470 int v36; // [sp+14h] [bp-2Ch]@24 | |
471 int v38; // [sp+1Ch] [bp-24h]@2 | |
472 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 473 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
474 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 475 bool v43; // [sp+30h] [bp-10h]@22 |
476 bool v44; // [sp+34h] [bp-Ch]@24 | |
477 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
478 signed int v48; // [sp+58h] [bp+18h]@22 | |
479 signed int v49; // [sp+58h] [bp+18h]@43 | |
480 | |
481 v46 = 1; | |
482 dword_721160[0] = -1; | |
483 dword_721110[0] = -1; | |
791 | 484 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 485 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 486 { |
487 *a6 = 0; | |
725 | 488 return odm_floor_level[0]; |
723 | 489 } |
0 | 490 v38 = 0; |
723 | 491 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
492 { | |
493 pBModel = &pOutdoor->pBModels[v38]; | |
494 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
495 { | |
496 if ( (signed int)pBModel->uNumFaces > 0 ) | |
497 { | |
498 v39 = 0; | |
499 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
500 { | |
501 pFace = &pBModel->pFaces[v39]; | |
502 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
503 && !(pFace->uAttributes & 0x20000000) | |
504 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
505 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 506 { |
723 | 507 if ( pFace->uNumVertices ) |
0 | 508 { |
723 | 509 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 510 { |
723 | 511 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
512 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
513 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
514 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
515 } | |
516 } | |
517 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
518 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
519 v43 = word_720F70[0] >= Y; | |
520 v48 = 0; | |
521 if ( 2 * pFace->uNumVertices > 0 ) | |
522 { | |
523 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
524 { | |
525 if ( v48 >= 2 ) | |
526 break; | |
527 v36 = word_720F70[i + 1]; | |
528 v44 = word_720F70[i + 1] >= Y; | |
529 if ( v43 != v44 ) | |
0 | 530 { |
723 | 531 v18 = word_721040[i + 1] >= X ? 0 : 2; |
532 v19 = v18 | word_721040[i] < X; | |
533 if ( v19 != 3 ) | |
0 | 534 { |
723 | 535 if ( !v19 ) |
740 | 536 ++v48; |
537 else | |
0 | 538 { |
723 | 539 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
540 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
541 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
542 if ( v22 >= X) | |
543 ++v48; | |
0 | 544 } |
545 } | |
546 } | |
723 | 547 v43 = v44; |
548 } | |
549 if ( v48 == 1 ) | |
550 { | |
551 if ( v46 >= 20 ) | |
0 | 552 break; |
723 | 553 if ( pFace->uPolygonType == POLYGON_Floor ) |
554 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
555 else | |
725 | 556 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
557 + HIWORD(pFace->zCalc3); | |
723 | 558 v25 = v46++; |
725 | 559 odm_floor_level[v25] = v24; |
723 | 560 dword_721160[v25] = pBModelNum; |
561 dword_721110[v25] = pFaceNum; | |
0 | 562 } |
563 } | |
564 } | |
723 | 565 ++v39; |
566 } | |
567 } | |
568 } | |
0 | 569 ++v38; |
570 } | |
571 if ( v46 == 1 ) | |
572 { | |
573 *a6 = 0; | |
725 | 574 return odm_floor_level[0]; |
0 | 575 } |
576 v27 = 0; | |
577 if ( v46 <= 1 ) | |
578 *a6 = 0; | |
723 | 579 else |
580 { | |
725 | 581 //v29 = 1; |
723 | 582 for ( v49 = 1; v49 < v46; ++v49 ) |
583 { | |
725 | 584 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 585 { |
586 v27 = v49; | |
725 | 587 //++v29; |
723 | 588 break; |
589 } | |
725 | 590 if ( odm_floor_level[0] > Z + 5 ) |
591 { | |
592 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
593 { | |
594 //++v29; | |
723 | 595 break; |
596 } | |
597 v27 = v49; | |
725 | 598 //++v29; |
723 | 599 break; |
600 } | |
725 | 601 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 602 { |
603 v27 = v49; | |
725 | 604 //++v29; |
723 | 605 } |
606 } | |
607 if ( !v27 ) | |
608 *a6 = 0; | |
609 else | |
610 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
611 } | |
0 | 612 if ( v27 ) |
613 { | |
614 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 615 *pIsOnWater = false; |
616 if ( v32->Fluid()) | |
617 *pIsOnWater = true; | |
0 | 618 } |
725 | 619 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
620 odm_floor_level[0] = odm_floor_level[v27]; | |
621 return odm_floor_level[0]; | |
0 | 622 } |
623 | |
624 //----- (0046D8E3) -------------------------------------------------------- | |
625 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
626 { | |
627 int v4; // ebx@1 | |
628 unsigned int v5; // ecx@1 | |
629 BSPModel *v6; // edi@3 | |
630 ODMFace *v7; // esi@10 | |
631 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
632 signed __int16 *v9; // eax@18 |
0 | 633 int v10; // edx@19 |
634 int v11; // ecx@21 | |
635 int v12; // ecx@23 | |
636 signed int v13; // eax@25 | |
637 int v14; // edx@27 | |
638 int v15; // edx@29 | |
639 int v16; // ST18_4@29 | |
640 signed int v17; // edx@29 | |
641 signed __int64 v18; // qtt@29 | |
642 int v19; // eax@35 | |
643 signed int v20; // ecx@37 | |
644 signed int v22; // ebx@42 | |
645 unsigned int v23; // esi@43 | |
646 int v24; // edx@44 | |
647 int v25; // eax@44 | |
648 int v26; // [sp+Ch] [bp-38h]@7 | |
649 int v27; // [sp+10h] [bp-34h]@21 | |
650 int v28; // [sp+18h] [bp-2Ch]@21 | |
651 int v29; // [sp+1Ch] [bp-28h]@2 | |
652 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
653 signed int v31; // [sp+24h] [bp-20h]@1 | |
654 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
655 int v33; // [sp+2Ch] [bp-18h]@7 | |
656 bool v34; // [sp+30h] [bp-14h]@21 | |
657 bool v35; // [sp+34h] [bp-10h]@23 | |
658 signed int v36; // [sp+38h] [bp-Ch]@17 | |
659 signed int v37; // [sp+38h] [bp-Ch]@21 | |
660 signed int v38; // [sp+38h] [bp-Ch]@42 | |
661 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
662 signed int v40; // [sp+40h] [bp-4h]@1 | |
663 | |
664 dword_720ED0[0] = -1; | |
665 dword_720E80[0] = -1; | |
666 v4 = a1; | |
667 v5 = 0; | |
668 v40 = a2; | |
669 v31 = v4; | |
670 v39 = 1; | |
671 dword_720F20[0] = 10000; | |
672 v32 = 0; | |
673 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
674 { | |
675 v29 = 0; | |
676 do | |
677 { | |
678 v6 = &pOutdoor->pBModels[v29]; | |
679 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
680 { | |
681 if ( v4 >= v6->sMinX ) | |
682 { | |
683 if ( v40 <= v6->sMaxY ) | |
684 { | |
685 if ( v40 >= v6->sMinY ) | |
686 { | |
687 v33 = v5; | |
688 v26 = v6->uNumFaces; | |
689 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
690 { | |
691 v30 = v5; | |
692 while ( 1 ) | |
693 { | |
694 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
695 v8 = v7->uPolygonType; | |
696 if ( (v8 == 5 || v8 == 6) | |
697 && !(BYTE3(v7->uAttributes) & 0x20) | |
698 && v4 <= v7->pBoundingBox.x2 | |
699 && v4 >= v7->pBoundingBox.x1 | |
700 && v40 <= v7->pBoundingBox.y2 | |
701 && v40 >= v7->pBoundingBox.y1 ) | |
702 { | |
703 v36 = v5; | |
704 if ( v7->uNumVertices ) | |
705 { | |
706 v9 = v7->pXInterceptDisplacements; | |
707 do | |
708 { | |
709 v10 = 2 * v36; | |
710 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
711 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
712 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
713 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
714 ++v9; | |
715 } | |
716 while ( v36 < v7->uNumVertices ); | |
717 v4 = v31; | |
718 } | |
719 v27 = 2 * v7->uNumVertices; | |
720 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
721 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
722 v11 = 0; | |
723 v34 = word_720CE0_ys[0] >= v40; | |
724 v37 = 0; | |
725 v28 = 0; | |
726 if ( v27 > 0 ) | |
727 { | |
728 do | |
729 { | |
730 if ( v37 >= 2 ) | |
731 break; | |
732 v12 = v11; | |
733 v4 = v31; | |
734 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
735 if ( v34 != v35 ) | |
736 { | |
737 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
738 v14 = v13 | word_720DB0_xs[v12] < v31; | |
739 if ( v14 != 3 ) | |
740 { | |
741 if ( !v14 | |
742 || (v15 = word_720CE0_ys[v12], | |
743 v16 = word_720CE0_ys[v12 + 1] - v15, | |
744 v17 = v40 - v15, | |
745 LODWORD(v18) = v17 << 16, | |
746 HIDWORD(v18) = v17 >> 16, | |
747 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
748 - (signed int)word_720DB0_xs[v12]) | |
749 * v18 | |
750 / v16) >> 16) | |
751 + word_720DB0_xs[v12]) >= v31) ) | |
752 ++v37; | |
753 } | |
754 } | |
755 v11 = v28 + 1; | |
756 v34 = v35; | |
757 ++v28; | |
758 } | |
759 while ( v28 < v27 ); | |
760 if ( v37 == 1 ) | |
761 { | |
762 if ( v39 >= 20 ) | |
763 break; | |
764 if ( v7->uPolygonType == 5 ) | |
765 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
766 else | |
767 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
768 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
769 + HIWORD(v7->zCalc3); | |
770 v20 = v39++; | |
771 dword_720F20[v20] = v19; | |
772 dword_720ED0[v20] = v32; | |
773 dword_720E80[v20] = v33; | |
774 } | |
775 } | |
776 } | |
777 ++v33; | |
778 v30 += 308; | |
779 if ( v33 >= v26 ) | |
780 break; | |
781 v5 = 0; | |
782 } | |
783 } | |
784 } | |
785 } | |
786 } | |
787 } | |
788 ++v32; | |
789 ++v29; | |
790 v5 = 0; | |
791 } | |
792 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
793 if ( !v39 ) | |
794 { | |
795 *(int *)a4 = 0; | |
796 return dword_720F20[0]; | |
797 } | |
798 } | |
799 v22 = 0; | |
800 v38 = v5; | |
801 if ( v39 <= (signed int)v5 ) | |
802 goto LABEL_54; | |
803 v23 = 0; | |
804 do | |
805 { | |
806 v24 = dword_720F20[v5 / 4]; | |
807 v25 = *(int *)((char *)dword_720F20 + v23); | |
808 if ( v24 == v25 ) | |
809 goto LABEL_50; | |
810 if ( v25 > a3 + 15 ) | |
811 { | |
812 if ( v24 >= v25 ) | |
813 goto LABEL_51; | |
814 LABEL_50: | |
815 v22 = v38; | |
816 v23 = v5; | |
817 goto LABEL_51; | |
818 } | |
819 if ( v24 > v25 && v24 <= a3 + 15 ) | |
820 goto LABEL_50; | |
821 LABEL_51: | |
822 ++v38; | |
823 v5 += 4; | |
824 } | |
825 while ( v38 < v39 ); | |
826 if ( v22 ) | |
827 { | |
828 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
829 return dword_720F20[v22]; | |
830 } | |
831 LABEL_54: | |
832 *(int *)a4 = 0; | |
833 return dword_720F20[v22]; | |
834 } | |
835 | |
138 | 836 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
837 // for a right-handed system, that would be an inverse normal | |
0 | 838 //----- (0046DCC8) -------------------------------------------------------- |
138 | 839 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
840 { | |
841 auto grid_x = WorldPosToGridCellX(pos_x); | |
842 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
843 | |
844 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
845 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
846 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
847 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
848 | |
849 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
850 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
851 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
852 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
853 | |
854 float side1_dx, side1_dy, side1_dz, | |
855 side2_dx, side2_dy, side2_dz; | |
856 | |
857 auto dx = abs(pos_x - grid_pos_x1), | |
858 dz = abs(grid_pos_z1 - pos_z); | |
859 if (dz >= dx) | |
860 { | |
861 side1_dy = (double)(x1z1_y - x1z2_y); | |
862 side2_dy = (double)(x2z2_y - x1z2_y); | |
863 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
864 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
865 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
866 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 867 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 868 /* |\ |
869 side1 | \ | |
870 |____\ | |
871 side 2 */ | |
872 } | |
873 else | |
874 { | |
875 side1_dy = (double)(x2z2_y - x2z1_y); | |
876 side2_dy = (double)(x1z1_y - x2z1_y); | |
877 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
878 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
879 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
880 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
881 | |
882 /* side 2 | |
883 _____ | |
884 \ | | |
885 \ | side 1 | |
886 \| */ | |
887 } | |
888 | |
889 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
890 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
891 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
892 | |
893 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
894 if (fabsf(mag) < 1e-6f) | |
895 { | |
896 out->y = 0; | |
897 out->x = 0; | |
898 out->z = 65536; | |
899 } | |
900 else | |
901 { | |
902 float invmag = 1.0 / mag; | |
903 out->x = invmag * nx * 65536.0; | |
904 out->y = invmag * ny * 65536.0; | |
905 out->z = invmag * nz * 65536.0; | |
906 } | |
907 } | |
908 | |
0 | 909 //----- (0046DEF2) -------------------------------------------------------- |
910 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
911 { | |
912 unsigned int result; // eax@1 | |
913 | |
914 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
915 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 916 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
917 return result; | |
918 } | |
919 | |
920 //----- (0046DF1A) -------------------------------------------------------- | |
921 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
922 { | |
923 Actor *v2; // edi@1 | |
924 unsigned __int16 v3; // ax@1 | |
925 int v4; // esi@6 | |
926 int v5; // ecx@8 | |
927 int v6; // eax@10 | |
928 int v7; // edx@12 | |
929 int v8; // ecx@14 | |
930 int v9; // eax@14 | |
931 int v10; // ebx@14 | |
932 int v11; // esi@14 | |
933 int v12; // ebx@15 | |
934 int v13; // ebx@17 | |
935 unsigned int v14; // eax@20 | |
936 signed int result; // eax@21 | |
937 int v16; // [sp+Ch] [bp-10h]@1 | |
938 int v17; // [sp+10h] [bp-Ch]@14 | |
939 int v18; // [sp+14h] [bp-8h]@14 | |
940 int v19; // [sp+18h] [bp-4h]@14 | |
941 | |
942 v16 = a1; | |
943 v2 = &pActors[a1]; | |
944 v3 = v2->uAIState; | |
945 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
946 goto LABEL_25; | |
947 v4 = v2->uActorRadius; | |
948 if ( a2 ) | |
949 v4 = a2; | |
950 v5 = v2->vPosition.x; | |
951 if ( stru_721530.sMaxX > v5 + v4 | |
952 || stru_721530.sMinX < v5 - v4 | |
953 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
954 || stru_721530.sMinY < v6 - v4 | |
955 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
956 || stru_721530.sMinZ < v7 | |
957 || (v8 = v5 - stru_721530.normal.x, | |
958 v9 = v6 - stru_721530.normal.y, | |
959 v10 = stru_721530.prolly_normal_d + v4, | |
960 v17 = stru_721530.prolly_normal_d + v4, | |
961 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
962 v18 = v8, | |
963 v19 = v9, | |
964 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
965 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
966 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
967 { | |
968 LABEL_25: | |
969 result = 0; | |
970 } | |
971 else | |
972 { | |
295 | 973 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 974 if ( v13 < 0 ) |
975 v13 = 0; | |
976 if ( v13 < stru_721530.field_7C ) | |
977 { | |
978 stru_721530.field_7C = v13; | |
979 v14 = 8 * v16; | |
862 | 980 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 981 stru_721530.uFaceID = v14; |
982 } | |
983 result = 1; | |
984 } | |
985 return result; | |
986 } | |
987 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
988 | |
989 //----- (0046E0B2) -------------------------------------------------------- | |
990 void __cdecl _46E0B2_collide_against_decorations() | |
991 { | |
992 BLVSector *v0; // ebp@1 | |
993 LevelDecoration *v1; // edi@2 | |
994 DecorationDesc *v2; // esi@3 | |
995 int v3; // edx@4 | |
996 int v4; // eax@4 | |
997 int v5; // ecx@6 | |
998 int v6; // ebx@8 | |
999 int v7; // esi@8 | |
1000 int v8; // ebx@10 | |
1001 int v9; // esi@11 | |
1002 int v10; // edi@12 | |
1003 int v11; // eax@12 | |
1004 int v12; // esi@14 | |
1005 unsigned int v13; // eax@17 | |
1006 signed int i; // [sp+4h] [bp-14h]@1 | |
1007 int v15; // [sp+8h] [bp-10h]@10 | |
1008 int v16; // [sp+Ch] [bp-Ch]@10 | |
1009 int v17; // [sp+10h] [bp-8h]@10 | |
1010 int v18; // [sp+14h] [bp-4h]@8 | |
1011 | |
1012 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1013 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1014 { | |
1015 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1016 if ( !(v1->field_2 & 0x20) ) | |
1017 { | |
1018 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1019 if (!v2->CanMoveThrough()) |
0 | 1020 { |
1021 v3 = v2->uRadius; | |
1022 v4 = v1->vPosition.x; | |
1023 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1024 { | |
1025 if ( stru_721530.sMinX >= v4 - v3 ) | |
1026 { | |
1027 v5 = v1->vPosition.y; | |
1028 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1029 { | |
1030 if ( stru_721530.sMinY >= v5 - v3 ) | |
1031 { | |
1032 v6 = v2->uDecorationHeight; | |
1033 v7 = v1->vPosition.z; | |
1034 v18 = v6; | |
1035 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1036 { | |
1037 if ( stru_721530.sMinZ >= v7 ) | |
1038 { | |
1039 v16 = v4 - stru_721530.normal.x; | |
1040 v15 = v5 - stru_721530.normal.y; | |
1041 v8 = stru_721530.prolly_normal_d + v3; | |
1042 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1043 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1044 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1045 { | |
1046 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1047 if ( v9 > 0 ) | |
1048 { | |
1049 v10 = v1->vPosition.z; | |
1050 v11 = stru_721530.normal.z | |
1051 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1052 if ( v11 >= v10 ) | |
1053 { | |
1054 if ( v11 <= v18 + v10 ) | |
1055 { | |
295 | 1056 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1057 if ( v12 < 0 ) |
1058 v12 = 0; | |
1059 if ( v12 < stru_721530.field_7C ) | |
1060 { | |
1061 stru_721530.field_7C = v12; | |
1062 v13 = 8 * v0->pDecorationIDs[i]; | |
1063 LOBYTE(v13) = v13 | 5; | |
1064 stru_721530.uFaceID = v13; | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 } | |
1078 } | |
1079 } | |
1080 | |
1081 //----- (0046E26D) -------------------------------------------------------- | |
1082 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1083 { | |
1084 int v2; // edx@5 | |
1085 unsigned __int16 *v3; // eax@5 | |
1086 unsigned __int16 v4; // ax@6 | |
1087 LevelDecoration *v5; // edi@7 | |
1088 DecorationDesc *v6; // esi@8 | |
1089 int v7; // edx@9 | |
1090 int v8; // eax@9 | |
1091 int v9; // ecx@11 | |
1092 int v10; // ebx@13 | |
1093 int v11; // esi@13 | |
1094 int v12; // ebp@15 | |
1095 int v13; // ebx@15 | |
1096 int v14; // esi@16 | |
1097 int v15; // edi@17 | |
1098 int v16; // eax@17 | |
1099 int v17; // esi@19 | |
1100 char v18; // zf@23 | |
1101 int v19; // [sp+0h] [bp-10h]@15 | |
1102 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1103 int v21; // [sp+8h] [bp-8h]@15 | |
1104 int v22; // [sp+Ch] [bp-4h]@13 | |
1105 | |
1106 if ( a1 >= 0 ) | |
1107 { | |
1108 if ( a1 <= 127 ) | |
1109 { | |
1110 if ( a2 >= 0 ) | |
1111 { | |
1112 if ( a2 <= 127 ) | |
1113 { | |
1114 v2 = a1 + (a2 << 7); | |
1115 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1116 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1117 if ( v3 ) | |
1118 { | |
1119 do | |
1120 { | |
1121 v4 = *v3; | |
848 | 1122 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1123 { |
1124 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1125 if ( !(v5->field_2 & 0x20) ) | |
1126 { | |
1127 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1128 if (!v6->CanMoveThrough()) |
0 | 1129 { |
1130 v7 = v6->uRadius; | |
1131 v8 = v5->vPosition.x; | |
1132 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1133 { | |
1134 if ( stru_721530.sMinX >= v8 - v7 ) | |
1135 { | |
1136 v9 = v5->vPosition.y; | |
1137 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1138 { | |
1139 if ( stru_721530.sMinY >= v9 - v7 ) | |
1140 { | |
1141 v10 = v6->uDecorationHeight; | |
1142 v11 = v5->vPosition.z; | |
1143 v22 = v10; | |
1144 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1145 { | |
1146 if ( stru_721530.sMinZ >= v11 ) | |
1147 { | |
1148 v12 = v8 - stru_721530.normal.x; | |
1149 v19 = v9 - stru_721530.normal.y; | |
1150 v13 = stru_721530.prolly_normal_d + v7; | |
1151 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1152 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1153 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1154 { | |
1155 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1156 if ( v14 > 0 ) | |
1157 { | |
1158 v15 = v5->vPosition.z; | |
1159 v16 = stru_721530.normal.z | |
1160 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1161 if ( v16 >= v15 ) | |
1162 { | |
1163 if ( v16 <= v22 + v15 ) | |
1164 { | |
295 | 1165 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1166 if ( v17 < 0 ) |
1167 v17 = 0; | |
1168 if ( v17 < stru_721530.field_7C ) | |
1169 { | |
1170 stru_721530.field_7C = v17; | |
1171 stru_721530.uFaceID = (signed __int16)*v20; | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 } | |
1184 } | |
1185 } | |
1186 v3 = v20 + 1; | |
1187 v18 = *v20 == 0; | |
1188 ++v20; | |
1189 } | |
1190 while ( !v18 ); | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 } | |
1197 | |
1198 //----- (00486F92) -------------------------------------------------------- | |
1199 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1200 { | |
1201 Span *v0; // ebx@1 | |
1202 int v1; // eax@2 | |
1203 Edge *v2; // ecx@3 | |
1204 Edge *v3; // edx@3 | |
1205 Edge *v4; // esi@6 | |
1206 Edge *v5; // eax@7 | |
1207 Edge *v6; // ecx@8 | |
1208 Surf *v7; // esi@11 | |
1209 double v8; // st7@13 | |
1210 Surf *v9; // edi@13 | |
1211 double v10; // st6@13 | |
1212 double v11; // st7@14 | |
1213 signed __int64 v12; // qax@14 | |
1214 stru148 *v13; // eax@15 | |
1215 Span *v14; // ecx@17 | |
1216 double v15; // st7@28 | |
1217 signed __int64 v16; // qax@28 | |
1218 stru148 *v17; // eax@29 | |
1219 Span *v18; // ecx@31 | |
1220 Edge *i; // eax@40 | |
1221 Edge *v20; // ecx@43 | |
1222 Edge *v21; // esi@44 | |
1223 double v22; // st7@45 | |
1224 Edge *v23; // edx@48 | |
1225 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1226 float v25; // [sp+14h] [bp-Ch]@3 | |
1227 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1228 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1229 | |
1230 v0 = pSpans; | |
1231 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1232 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1233 stru_80C9A4.pSurf = &stru_80C980; |
1234 stru_80C980.pPrev = &stru_80C980; | |
1235 stru_80C980.pNext = &stru_80C980; | |
693 | 1236 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1237 stru_80C980.field_8 = 0.0; |
1238 stru_80C980.field_4 = 0.0; | |
1239 stru_80C9D8.pNext = &stru_80C9A4; | |
1240 stru_80C9D8.pPrev = 0; | |
1241 stru_80C9D8.field_8 = 1; | |
1242 stru_80C9A4.pNext = 0; | |
1243 stru_80C9A4.pPrev = &stru_80C9D8; | |
1244 stru_80C9A4.field_8 = 0; | |
1245 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1246 v27 = pViewport->uViewportTL_Y; |
1247 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1248 { |
1249 LABEL_51: | |
1250 v0->field_8 = -1; | |
1251 } | |
1252 else | |
1253 { | |
693 | 1254 v1 = 52 * pViewport->uViewportTL_Y; |
1255 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1256 while ( 1 ) |
1257 { | |
1258 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1259 v3 = &stru_80C9D8; | |
1260 v25 = (double)(signed int)v27; | |
1261 if ( v2 != &defaultEdge ) | |
1262 { | |
1263 do | |
1264 { | |
1265 while ( 1 ) | |
1266 { | |
1267 v4 = v3->pNext; | |
1268 if ( v2->field_0 <= (double)v4->field_0 ) | |
1269 break; | |
1270 v3 = v3->pNext; | |
1271 } | |
1272 v5 = v2->pNext; | |
1273 v2->pNext = v4; | |
1274 v2->pPrev = v3; | |
1275 v3->pNext->pPrev = v2; | |
1276 v3->pNext = v2; | |
1277 v3 = v2; | |
1278 v2 = v5; | |
1279 } | |
1280 while ( v5 != &defaultEdge ); | |
1281 } | |
1282 v6 = stru_80C9D8.pNext; | |
1283 stru_80C980.field_20 = 0; | |
1284 stru_80C980.field_22 = 1; | |
1285 v26 = stru_80C9D8.pNext; | |
1286 if ( stru_80C9D8.pNext ) | |
1287 { | |
1288 while ( 1 ) | |
1289 { | |
1290 v7 = v6->pSurf; | |
1291 if ( v6->field_8 ) | |
1292 { | |
1293 ++v7->field_22; | |
1294 if ( v7->field_22 == 1 ) | |
1295 { | |
1296 v8 = v6->field_0 + 2.0; | |
1297 v9 = stru_80C980.pNext; | |
1298 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1299 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1300 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1301 + stru_80C980.pNext->field_0 ) | |
1302 { | |
1303 do | |
1304 v9 = v9->pNext; | |
1305 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1306 v7->pNext = v9; | |
1307 v7->pPrev = v9->pPrev; | |
1308 v9->pPrev->pNext = v7; | |
1309 v9->pPrev = v7; | |
1310 } | |
1311 else | |
1312 { | |
1313 v11 = v6->field_0 + 0.5; | |
1314 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1315 v0->field_C = v12; | |
1316 if ( (signed __int16)v12 > 0 ) | |
1317 { | |
1318 v0->field_A = v27; | |
1319 v0->field_8 = v9->field_20; | |
1320 v13 = v9->pParent; | |
1321 v0->pParent = v13; | |
1322 if ( v13 ) | |
1323 { | |
1324 if ( v13->prolly_head ) | |
1325 { | |
1326 v14 = v13->prolly_tail; | |
1327 if ( !v14 ) | |
1328 return; | |
1329 v14->pNext = v0; | |
1330 } | |
1331 else | |
1332 { | |
1333 v13->prolly_head = v0; | |
1334 } | |
1335 v13->prolly_tail = v0; | |
1336 } | |
1337 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1338 return; | |
1339 ++v0; | |
1340 ++pOutdoorCamera->uNumSpans; | |
1341 } | |
1342 v6 = v26; | |
1343 v7->field_20 = (signed __int64)v11; | |
1344 v7->pNext = v9; | |
1345 v9->pPrev = v7; | |
1346 stru_80C980.pNext = v7; | |
1347 v7->pPrev = &stru_80C980; | |
1348 } | |
1349 } | |
1350 } | |
1351 else | |
1352 { | |
1353 --v7->field_22; | |
1354 if ( !v7->field_22 ) | |
1355 { | |
1356 if ( stru_80C980.pNext == v7 ) | |
1357 { | |
1358 v15 = v6->field_0 + 0.5; | |
1359 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1360 v0->field_C = v16; | |
1361 if ( (signed __int16)v16 > 0 ) | |
1362 { | |
1363 v0->field_A = v27; | |
1364 v0->field_8 = v7->field_20; | |
1365 v17 = v7->pParent; | |
1366 v0->pParent = v17; | |
1367 if ( v17 ) | |
1368 { | |
1369 if ( v17->prolly_head ) | |
1370 { | |
1371 v18 = v17->prolly_tail; | |
1372 if ( !v18 ) | |
1373 return; | |
1374 v18->pNext = v0; | |
1375 } | |
1376 else | |
1377 { | |
1378 v17->prolly_head = v0; | |
1379 } | |
1380 v17->prolly_tail = v0; | |
1381 } | |
1382 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1383 return; | |
1384 ++v0; | |
1385 ++pOutdoorCamera->uNumSpans; | |
1386 } | |
1387 v7->pNext->field_20 = (signed __int64)v15; | |
1388 v6 = v26; | |
1389 } | |
1390 v7->pNext->pPrev = v7->pPrev; | |
1391 v7->pPrev->pNext = v7->pNext; | |
1392 } | |
1393 } | |
1394 v26 = v6->pNext; | |
1395 if ( !v26 ) | |
1396 break; | |
1397 v6 = v6->pNext; | |
1398 } | |
1399 } | |
1400 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1401 { | |
1402 i->pPrev->pNext = i->pNext; | |
1403 i->pNext->pPrev = i->pPrev; | |
1404 } | |
1405 v20 = stru_80C9D8.pNext; | |
1406 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1407 break; | |
1408 LABEL_50: | |
1409 ++v27; | |
1410 v1 = v24 + 52; | |
1411 v24 += 52; | |
693 | 1412 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1413 goto LABEL_51; |
1414 } | |
1415 while ( 1 ) | |
1416 { | |
1417 v21 = v20->pNext; | |
1418 if ( !v21 ) | |
1419 break; | |
1420 v22 = v20->field_4 + v20->field_0; | |
1421 v20->field_0 = v22; | |
1422 if ( v22 < stru_80C9D8.field_0 ) | |
1423 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1424 while ( 1 ) | |
1425 { | |
1426 v23 = v20->pPrev; | |
1427 if ( v20->field_0 >= (double)v23->field_0 ) | |
1428 break; | |
1429 v23->pNext = v20->pNext; | |
1430 v20->pNext->pPrev = v23; | |
1431 v23->pPrev->pNext = v20; | |
1432 v20->pPrev = v23->pPrev; | |
1433 v20->pNext = v23; | |
1434 v23->pPrev = v20; | |
1435 } | |
1436 v20 = v21; | |
1437 if ( v21 == &stru_80C9A4 ) | |
1438 goto LABEL_50; | |
1439 } | |
1440 } | |
1441 } | |
1442 // 4EC3EC: using guessed type Edge defaultEdge; | |
1443 | |
1444 //----- (00487355) -------------------------------------------------------- | |
1445 bool OutdoorCamera::_487355() | |
1446 { | |
1447 int v0; // esi@1 | |
1448 stru148 *v1; // edi@2 | |
1449 bool result; // eax@3 | |
1450 | |
1451 v0 = 0; | |
1452 if ( pOutdoorCamera->numStru148s > 0 ) | |
1453 { | |
1454 v1 = array_77EC08; | |
1455 do | |
1456 { | |
1457 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1458 ++v0; | |
1459 ++v1; | |
1460 } | |
1461 while ( v0 < pOutdoorCamera->numStru148s ); | |
1462 } | |
1463 return result; | |
1464 } | |
1465 | |
1466 //----- (00487DA9) -------------------------------------------------------- | |
1467 void __cdecl sub_487DA9() | |
1468 { | |
1469 char *v0; // eax@1 | |
1470 | |
1471 v0 = &array_77EC08[0].field_108; | |
1472 do | |
1473 { | |
1474 *v0 = 0; | |
1475 v0 += 268; | |
1476 } | |
1477 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1478 } | |
1479 | |
1480 //----- (00487DBE) -------------------------------------------------------- | |
1481 void Software_ResetNewEdges() | |
1482 { | |
1483 int v0; // ecx@1 | |
1484 Edge **v1; // eax@1 | |
1485 signed int v2; // eax@3 | |
1486 | |
1487 v0 = 0; | |
1488 v1 = ptr_80CA10; | |
1489 do | |
1490 { | |
1491 ++v0; | |
1492 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1493 *v1 = 0; | |
1494 ++v1; | |
1495 } | |
1496 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1497 v2 = 2000; | |
1498 do | |
1499 { | |
1500 pSurfs->field_22 = 0; | |
1501 --v2; | |
1502 } | |
1503 while ( v2 ); | |
1504 } | |
1505 // 4EC3EC: using guessed type Edge defaultEdge; | |
1506 | |
1507 //----- (0048958E) -------------------------------------------------------- | |
1508 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1509 { | |
1510 stru12_MemoryBlock *v2; // esi@1 | |
1511 void *v3; // eax@1 | |
1512 void *v4; // ecx@1 | |
1513 stru12_MemoryBlock *result; // eax@1 | |
1514 | |
1515 v2 = this; | |
1516 v3 = operator new(8 * a2 + 16); | |
1517 v2->pBlockBase = v3; | |
848 | 1518 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1519 result = v2; |
1520 v2->pAlignedBlock = v4; | |
1521 } | |
1522 | |
1523 //----- (004895B7) -------------------------------------------------------- | |
1524 stru12::stru12(stru11 *pStru11) | |
1525 { | |
1526 stru12 *v2; // esi@1 | |
1527 | |
1528 v2 = this; | |
1529 this->field_44 = 0x41000000u; | |
1530 this->field_4C = 0x46000000u; | |
1531 //this->vdestructor_ptr = stru12::_4898E6; | |
1532 this->field_48 = 0; | |
1533 this->field_50 = 0; | |
1534 this->field_54 = 0x33D6BF95u; | |
1535 this->field_58 = 0; | |
1536 | |
1537 for (int i = 0; i < 12; ++i) | |
1538 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1539 /* | |
1540 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1541 if ( v3 ) | |
1542 v4 = AllocAlignedMem(v3, 640); | |
1543 else | |
1544 v4 = 0; | |
1545 v2->pMemBlocks[0] = v4; | |
1546 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1547 if ( v5 ) | |
1548 v6 = AllocAlignedMem(v5, 640); | |
1549 else | |
1550 v6 = 0; | |
1551 v2->pMemBlocks[1] = v6; | |
1552 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1553 if ( v7 ) | |
1554 v8 = AllocAlignedMem(v7, 640); | |
1555 else | |
1556 v8 = 0; | |
1557 v2->pMemBlocks[2] = v8; | |
1558 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1559 if ( v9 ) | |
1560 v10 = AllocAlignedMem(v9, 640); | |
1561 else | |
1562 v10 = 0; | |
1563 v2->pMemBlocks[3] = v10; | |
1564 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1565 if ( v11 ) | |
1566 v12 = AllocAlignedMem(v11, 640); | |
1567 else | |
1568 v12 = 0; | |
1569 v2->pMemBlocks[4] = v12; | |
1570 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1571 if ( v13 ) | |
1572 v14 = AllocAlignedMem(v13, 640); | |
1573 else | |
1574 v14 = 0; | |
1575 v2->pMemBlocks[5] = v14; | |
1576 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1577 if ( v15 ) | |
1578 v16 = AllocAlignedMem(v15, 640); | |
1579 else | |
1580 v16 = 0; | |
1581 v2->pMemBlocks[6] = v16; | |
1582 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1583 if ( v17 ) | |
1584 v18 = AllocAlignedMem(v17, 640); | |
1585 else | |
1586 v18 = 0; | |
1587 v2->pMemBlocks[7] = v18; | |
1588 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1589 if ( v19 ) | |
1590 v20 = AllocAlignedMem(v19, 640); | |
1591 else | |
1592 v20 = 0; | |
1593 v2->pMemBlocks[8] = v20; | |
1594 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1595 if ( v21 ) | |
1596 v22 = AllocAlignedMem(v21, 640); | |
1597 else | |
1598 v22 = 0; | |
1599 v2->pMemBlocks[9] = v22; | |
1600 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1601 if ( v23 ) | |
1602 v24 = AllocAlignedMem(v23, 640); | |
1603 else | |
1604 v24 = 0; | |
1605 v2->pMemBlocks[10] = v24; | |
1606 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1607 if ( v25 ) | |
1608 v26 = AllocAlignedMem(v25, 640); | |
1609 else | |
1610 v26 = 0; | |
1611 v2->field_8C = 0; | |
1612 v2->pMemBlocks[11] = v26;*/ | |
1613 } | |
1614 | |
1615 //----- (00489810) -------------------------------------------------------- | |
1616 stru12::~stru12() | |
1617 { | |
1618 for (int i = 0; i < 12; ++i) | |
1619 delete pMemBlocks[i]; | |
1620 /*if ( v2 ) | |
1621 stru12_MemoryBlock::dtor(v2, 1); | |
1622 v3 = v1->pMemBlocks[1]; | |
1623 if ( v3 ) | |
1624 stru12_MemoryBlock::dtor(v3, 1); | |
1625 v4 = v1->pMemBlocks[2]; | |
1626 if ( v4 ) | |
1627 stru12_MemoryBlock::dtor(v4, 1); | |
1628 v5 = v1->pMemBlocks[3]; | |
1629 if ( v5 ) | |
1630 stru12_MemoryBlock::dtor(v5, 1); | |
1631 v6 = v1->pMemBlocks[4]; | |
1632 if ( v6 ) | |
1633 stru12_MemoryBlock::dtor(v6, 1); | |
1634 v7 = v1->pMemBlocks[5]; | |
1635 if ( v7 ) | |
1636 stru12_MemoryBlock::dtor(v7, 1); | |
1637 v8 = v1->pMemBlocks[6]; | |
1638 if ( v8 ) | |
1639 stru12_MemoryBlock::dtor(v8, 1); | |
1640 v9 = v1->pMemBlocks[7]; | |
1641 if ( v9 ) | |
1642 stru12_MemoryBlock::dtor(v9, 1); | |
1643 v10 = v1->pMemBlocks[8]; | |
1644 if ( v10 ) | |
1645 stru12_MemoryBlock::dtor(v10, 1); | |
1646 v11 = v1->pMemBlocks[9]; | |
1647 if ( v11 ) | |
1648 stru12_MemoryBlock::dtor(v11, 1); | |
1649 v12 = v1->pMemBlocks[10]; | |
1650 if ( v12 ) | |
1651 stru12_MemoryBlock::dtor(v12, 1); | |
1652 v13 = v1->pMemBlocks[11]; | |
1653 if ( v13 ) | |
1654 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1655 } | |
1656 | |
1657 //----- (004898BF) -------------------------------------------------------- | |
1658 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1659 { | |
1660 stru12_MemoryBlock *v2; // esi@1 | |
1661 void *v3; // ST00_4@1 | |
1662 | |
1663 v2 = this; | |
1664 v3 = this->pBlockBase; | |
1665 this->pAlignedBlock = 0; | |
1666 free(v3); | |
1667 v2->pBlockBase = 0; | |
1668 /*if ( a2 & 1 ) | |
1669 free(v2);*/ | |
1670 } | |
1671 | |
1672 //----- (004898E6) -------------------------------------------------------- | |
1673 void stru12::_4898E6() | |
1674 { | |
1675 void *v1; // eax@1 | |
1676 void *v2; // edx@1 | |
1677 char *v3; // edi@2 | |
1678 double v4; // st7@2 | |
1679 char *v5; // ebx@2 | |
1680 double v6; // st6@3 | |
1681 double v7; // st5@3 | |
1682 double v8; // st4@3 | |
1683 int v9; // esi@3 | |
1684 double v10; // st3@3 | |
1685 float v11; // ST34_4@5 | |
1686 double v12; // st6@10 | |
1687 double v13; // ST0C_8@10 | |
1688 char *v14; // [sp+14h] [bp-44h]@2 | |
1689 char *v15; // [sp+18h] [bp-40h]@2 | |
1690 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1691 char *v17; // [sp+20h] [bp-38h]@2 | |
1692 char *v18; // [sp+24h] [bp-34h]@2 | |
1693 float v19; // [sp+30h] [bp-28h]@3 | |
1694 float v20; // [sp+38h] [bp-20h]@3 | |
1695 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1696 int v22; // [sp+40h] [bp-18h]@1 | |
1697 char *v23; // [sp+44h] [bp-14h]@2 | |
1698 char *v24; // [sp+48h] [bp-10h]@2 | |
1699 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1700 float v26; // [sp+50h] [bp-8h]@3 | |
1701 float v27; // [sp+54h] [bp-4h]@3 | |
1702 | |
731 | 1703 __debugbreak(); |
0 | 1704 v22 = 0; |
1705 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1706 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1707 if ( this->field_8C > 0 ) | |
1708 { | |
1709 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1710 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1711 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1712 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1713 v25 = (int)v1 - (int)v2; | |
1714 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1715 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1716 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1717 v4 = 1.0; | |
1718 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1719 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1720 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1721 do | |
1722 { | |
1723 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1724 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1725 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1726 v7 = pIndoorCamera->fRotationYCosine; | |
1727 v8 = pIndoorCamera->fRotationYSine; | |
1728 v20 = pIndoorCamera->fRotationXCosine; | |
1729 v19 = pIndoorCamera->fRotationXSine; | |
1730 v9 = (int)((char *)v2 + (int)v21); | |
1731 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1732 if ( pIndoorCamera->sRotationX ) | |
1733 { | |
1734 v11 = v10; | |
1735 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1736 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1737 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1738 } | |
1739 else | |
1740 { | |
1741 *(float *)v9 = v10; | |
1742 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1743 *(float *)((char *)v2 + (int)v5) = v6; | |
1744 } | |
1745 if ( *(float *)v9 >= 8.0 ) | |
1746 { | |
1747 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1748 { | |
1749 *(int *)v2 = 0; | |
1750 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1751 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1752 - v12 * *(float *)((char *)v2 + (int)v3); | |
1753 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1754 - v12 * *(float *)((char *)v2 + (int)v5); | |
1755 *(float *)((char *)v2 + (int)v16) = v4 | |
1756 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1757 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1758 v13 = *(float *)v9 + 6.7553994e15; | |
1759 v4 = 1.0; | |
1760 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1761 } | |
1762 else | |
1763 { | |
1764 *(int *)v2 = 2; | |
1765 } | |
1766 } | |
1767 else | |
1768 { | |
1769 *(int *)v2 = 1; | |
1770 } | |
1771 ++v22; | |
1772 v2 = (char *)v2 + 4; | |
1773 } | |
1774 while ( v22 < this->field_8C ); | |
1775 } | |
1776 this->field_8C = 0; | |
1777 } | |
1778 | |
1779 //----- (0048A959) -------------------------------------------------------- | |
1780 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1781 { | |
1782 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1783 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1784 b = (uColor & 0x000000FF) / 255.0f; | |
1785 | |
1786 float h, s, v; | |
1787 RGB2HSV(&h, &s, r, g, b, &v); | |
1788 | |
1789 if ( h_replace != -1.0 ) | |
1790 h = h_replace; | |
1791 if ( s_replace != -1.0 ) | |
1792 s = s_replace; | |
1793 if ( v_replace != -1.0 ) | |
1794 v = v_replace; | |
1795 HSV2RGB(&r, &g, &b, h, s, v); | |
1796 | |
1797 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1798 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1799 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1800 } | |
1801 | |
1802 //----- (0048B561) -------------------------------------------------------- | |
1803 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1804 { | |
1805 //v2 = a2 - 0.5; | |
1806 //v3 = v2 + 6.7553994e15; | |
1807 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1808 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1809 //v5 = v7 + 6.7553994e15; | |
1810 //return LODWORD(v5) | (v4 << 16); | |
1811 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1812 return v5 | (v4 << 16); | |
1813 } | |
1814 | |
1815 //----- (00491E3A) -------------------------------------------------------- | |
1816 void __cdecl sub_491E3A() | |
1817 { | |
1818 Player *v0; // ebx@1 | |
1819 signed int v1; // esi@3 | |
1820 char *v2; // eax@4 | |
1821 unsigned int v3; // eax@7 | |
1822 unsigned int v4; // edx@8 | |
1823 char *v5; // ecx@9 | |
1824 int v6; // edi@17 | |
1825 Texture *v7; // ebx@18 | |
1826 struct IDirect3DTexture2 **v8; // eax@19 | |
1827 struct IDirect3DTexture2 *v9; // eax@20 | |
1828 struct IDirectDrawSurface **v10; // eax@22 | |
1829 struct IDirectDrawSurface *v11; // eax@23 | |
1830 int v12; // eax@26 | |
1831 | |
1832 v0 = pParty->pPlayers; | |
1833 do | |
1834 { | |
203 | 1835 if (SoundSetAction[24][0]) |
0 | 1836 { |
1837 v1 = 0; | |
764 | 1838 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1839 { |
1840 LABEL_7: | |
1841 v3 = 0; | |
1842 } | |
1843 else | |
1844 { | |
1845 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1846 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1847 { |
1848 ++v1; | |
1849 v2 += 120; | |
764 | 1850 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1851 goto LABEL_7; |
1852 } | |
1853 v3 = v1; | |
1854 } | |
764 | 1855 pSoundList->UnloadSound(v3, 1); |
0 | 1856 v4 = 0; |
764 | 1857 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1858 { |
1859 LABEL_12: | |
1860 v4 = 0; | |
1861 } | |
1862 else | |
1863 { | |
1864 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1865 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1866 { |
1867 ++v4; | |
1868 v5 += 120; | |
764 | 1869 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1870 goto LABEL_12; |
1871 } | |
1872 } | |
764 | 1873 pSoundList->UnloadSound(v4, 1); |
0 | 1874 } |
1875 ++v0; | |
1876 } | |
1877 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1878 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1879 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1880 { |
1881 v7 = &pIcons_LOD->pTextures[v6]; | |
1882 do | |
1883 { | |
1884 v7->Release(); | |
1885 v8 = pIcons_LOD->pHardwareTextures; | |
1886 if ( v8 ) | |
1887 { | |
1888 v9 = v8[v6]; | |
1889 if ( v9 ) | |
1890 { | |
1891 v9->Release(); | |
1892 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1893 } | |
1894 } | |
1895 v10 = pIcons_LOD->pHardwareSurfaces; | |
1896 if ( v10 ) | |
1897 { | |
1898 v11 = v10[v6]; | |
1899 if ( v11 ) | |
1900 { | |
1901 v11->Release(); | |
1902 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1903 } | |
1904 } | |
1905 --v6; | |
1906 --v7; | |
1907 } | |
33 | 1908 while ( v6 >= pIcons_LOD->pFacesLock ); |
1909 } | |
1910 v12 = pIcons_LOD->pFacesLock; | |
1911 pIcons_LOD->pFacesLock = 0; | |
0 | 1912 pIcons_LOD->uNumLoadedFiles = v12; |
1913 } | |
1914 // 4ED498: using guessed type char byte_4ED498; | |
1915 | |
1916 //----- (0049387A) -------------------------------------------------------- | |
1917 int CycleCharacter(unsigned int _this) | |
1918 { | |
1919 signed int result; // eax@1 | |
1920 signed int v2; // ecx@2 | |
1921 signed int v3; // ecx@8 | |
1922 | |
1923 result = uActiveCharacter; | |
1924 if ( _this ) | |
1925 { | |
1926 v2 = 0; | |
1927 while ( 1 ) | |
1928 { | |
1929 --result; | |
1930 if ( result < 1 ) | |
1931 result = 4; | |
1932 if ( !pPlayers[result]->uTimeToRecovery ) | |
1933 break; | |
1934 ++v2; | |
1935 if ( v2 >= 4 ) | |
1936 return uActiveCharacter; | |
1937 } | |
1938 } | |
1939 else | |
1940 { | |
1941 v3 = 0; | |
1942 while ( 1 ) | |
1943 { | |
1944 ++result; | |
1945 if ( result > 4 ) | |
1946 result = 1; | |
1947 if ( !pPlayers[result]->uTimeToRecovery ) | |
1948 break; | |
1949 ++v3; | |
1950 if ( v3 >= 4 ) | |
1951 return uActiveCharacter; | |
1952 } | |
1953 } | |
1954 return result; | |
1955 } | |
1956 | |
1957 //----- (004938D1) -------------------------------------------------------- | |
1958 void __fastcall Rest(unsigned int uHoursToSleep) | |
1959 { | |
1960 unsigned int v1; // esi@1 | |
1961 double v2; // st7@3 | |
1962 Player **v3; // esi@3 | |
1963 | |
1964 v1 = uHoursToSleep; | |
1965 if ( uHoursToSleep > 240 ) | |
1966 InitializeActors(); | |
1967 v2 = (double)(7680 * v1) * 0.033333335; | |
1968 pParty->uTimePlayed += (signed __int64)v2; | |
1969 v3 = &pPlayers[1]; | |
1970 do | |
1971 { | |
1972 (*v3)->Recover((signed __int64)v2); | |
1973 ++v3; | |
1974 } | |
1975 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1976 _494035_timed_effects__water_walking_damage__etc(); | |
1977 } | |
1978 | |
1979 //----- (00493938) -------------------------------------------------------- | |
1980 int __cdecl _493938_regenerate() | |
1981 { | |
1982 int v0; // edi@1 | |
1983 signed __int64 v1; // qax@1 | |
1984 int v2; // ecx@1 | |
1985 int result; // eax@1 | |
1986 int v4; // eax@2 | |
1987 int v5; // edi@5 | |
112 | 1988 int *v6; // ecx@5 |
0 | 1989 char v7; // sf@5 |
112 | 1990 int *v8; // ecx@10 |
0 | 1991 int v9; // edi@15 |
1992 signed int v10; // eax@15 | |
1993 __int16 *v11; // edx@16 | |
1994 int v12; // eax@20 | |
1995 int v13; // ebx@20 | |
1996 unsigned int *v14; // esi@21 | |
1997 unsigned int v15; // ecx@21 | |
1998 unsigned int v16; // eax@21 | |
1999 int v17; // edx@21 | |
2000 int v18; // eax@21 | |
2001 signed int v19; // eax@21 | |
2002 signed int v20; // ebx@25 | |
2003 Player *v21; // esi@25 | |
2004 ITEM_EQUIP_TYPE v22; // edi@30 | |
2005 //int v23; // edx@31 | |
2006 signed int v24; // ecx@32 | |
2007 signed int v25; // eax@33 | |
2008 int v26; // eax@35 | |
2009 int v27; // eax@36 | |
2010 int v28; // eax@37 | |
2011 int v29; // eax@40 | |
2012 int v30; // eax@41 | |
2013 signed int v31; // ecx@53 | |
2014 char *v32; // eax@53 | |
2015 char *v33; // edi@82 | |
2016 int v34; // ecx@88 | |
2017 int v35; // eax@88 | |
2018 char *v36; // edi@99 | |
2019 int v37; // edi@104 | |
2020 int v38; // edi@106 | |
2021 int v39; // edi@111 | |
2022 int v40; // ecx@113 | |
2023 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
|
2024 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2025 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2026 int v44; // [sp+210h] [bp-20h]@22 | |
2027 int v45; // [sp+214h] [bp-1Ch]@25 | |
2028 int v46; // [sp+218h] [bp-18h]@25 | |
2029 int v47; // [sp+21Ch] [bp-14h]@25 | |
2030 int v48; // [sp+220h] [bp-10h]@25 | |
2031 int v49; // [sp+224h] [bp-Ch]@24 | |
2032 int v50; // [sp+228h] [bp-8h]@25 | |
2033 int v51; // [sp+22Ch] [bp-4h]@2 | |
2034 | |
2035 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2036 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2037 v2 = (signed int)v1 / 60; | |
2038 result = (signed int)v1 / 60 + 5; | |
2039 if ( v0 >= result ) | |
2040 { | |
2041 v51 = 0; | |
2042 v4 = (v0 - v2) / 5; | |
2043 if (pParty->FlyActive()) | |
2044 { | |
2045 if ( pParty->bFlying ) | |
2046 { | |
569 | 2047 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2048 { // colliding with something in the air - fall down | |
2049 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2050 //__debugbreak(); | |
2051 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2052 v7 = *v6 < v5; |
2053 *v6 -= v5; | |
0 | 2054 if ( v7 ) |
2055 { | |
112 | 2056 *v6 = 0; |
0 | 2057 pParty->uFlags &= 0xFFFFFFBFu; |
2058 pParty->bFlying = 0; | |
2059 v51 = 1; | |
2060 } | |
2061 } | |
2062 } | |
2063 } | |
569 | 2064 |
0 | 2065 if (pParty->WaterWalkActive()) |
2066 { | |
569 | 2067 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2068 { | |
2069 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2070 { // taking on water | |
2071 //__debugbreak(); | |
2072 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2073 v7 = *v8 < v4; |
2074 *v8 -= v4; | |
0 | 2075 if ( v7 ) |
2076 { | |
112 | 2077 *v8 = 0; |
569 | 2078 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2079 v51 = 1; |
2080 } | |
2081 } | |
2082 } | |
2083 } | |
569 | 2084 |
0 | 2085 if (pParty->ImmolationActive()) |
2086 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2087 //SpriteObject::SpriteObject(&a1); |
0 | 2088 v9 = 0; |
2089 a3.z = 0; | |
2090 a3.y = 0; | |
2091 a3.x = 0; | |
2092 a1.stru_24.Reset(); | |
822 | 2093 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2094 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2095 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2096 a1.uType = 1070; |
822 | 2097 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2098 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2099 { | |
2100 LABEL_19: | |
2101 LOWORD(v10) = 0; | |
2102 } | |
2103 else | |
2104 { | |
2105 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2106 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2107 { |
2108 ++v10; | |
2109 v11 += 28; | |
2110 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2111 goto LABEL_19; | |
2112 } | |
2113 } | |
2114 a1.uObjectDescID = v10; | |
2115 a1.field_60_distance_related_prolly_lod = 0; | |
2116 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2117 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2118 a1.uAttributes = 0; |
2119 a1.uSectorID = 0; | |
2120 a1.uSpriteFrameID = 0; | |
822 | 2121 a1.spell_caster_pid = v12; |
0 | 2122 a1.uFacing = 0; |
2123 a1.uSoundID = 0; | |
2124 v13 = sub_46A89E((int)v41, 100, 307); | |
2125 if ( v13 > 0 ) | |
2126 { | |
2127 do | |
2128 { | |
2129 v14 = (unsigned int *)&v41[4 * v9]; | |
2130 v15 = *v14; | |
2131 v16 = *v14; | |
2132 a1.vPosition.x = pActors[v16].vPosition.x; | |
2133 v17 = pActors[v16].vPosition.y; | |
2134 a1.vPosition.z = pActors[v16].vPosition.z; | |
2135 v18 = 8 * v15; | |
862 | 2136 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2137 a1.vPosition.y = v17; |
823 | 2138 a1.spell_target_pid = v18; |
0 | 2139 v19 = a1.Create(0, 0, 0, 0); |
862 | 2140 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2141 ++v9; |
2142 } | |
2143 while ( v9 < v13 ); | |
2144 } | |
2145 } | |
2146 v44 = 0; | |
248 | 2147 if (PartyHasDragon()) |
0 | 2148 v44 = 1; |
2149 v49 = 0; | |
2150 LABEL_25: | |
2151 v20 = 0; | |
2152 v21 = &pParty->pPlayers[v49]; | |
2153 v50 = 0; | |
2154 v47 = 0; | |
2155 v45 = 0; | |
2156 v48 = 0; | |
2157 v46 = 0; | |
255 | 2158 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2159 v50 = 1; |
135 | 2160 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2161 v48 = 1; |
2162 v22 = (ITEM_EQUIP_TYPE)0; | |
2163 while ( 1 ) | |
2164 { | |
2165 if ( v21->HasItemEquipped(v22) ) | |
2166 { | |
2167 //v23 = v21->pEquipment.pIndices; | |
2168 auto _idx = v21->pEquipment.pIndices[v22]; | |
2169 v24 = v21->pInventoryItems[_idx].uItemID; | |
2170 if ( v24 > 134 ) | |
2171 { | |
2172 if ( v24 == 529 ) | |
2173 goto LABEL_43; | |
2174 if ( v24 == 535 ) | |
2175 goto LABEL_44; | |
2176 if ( v24 == 515 ) | |
2177 { | |
2178 v47 = 1; | |
2179 } | |
2180 else | |
2181 { | |
2182 if ( v24 == 532 ) | |
2183 goto LABEL_50; | |
2184 } | |
2185 } | |
2186 else | |
2187 { | |
377 | 2188 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2189 if ( v25 <= 50 ) |
2190 { | |
2191 if ( v25 != 50 ) | |
2192 { | |
2193 v26 = v25 - 37; | |
2194 if ( v26 ) | |
2195 { | |
2196 v27 = v26 - 1; | |
2197 if ( !v27 ) | |
2198 goto LABEL_50; | |
2199 v28 = v27 - 6; | |
2200 if ( v28 ) | |
2201 { | |
2202 if ( v28 != 3 ) | |
2203 goto LABEL_51; | |
2204 LABEL_50: | |
2205 v50 = 1; | |
2206 goto LABEL_51; | |
2207 } | |
2208 } | |
2209 } | |
2210 LABEL_44: | |
2211 v20 = 1; | |
2212 goto LABEL_51; | |
2213 } | |
2214 v29 = v25 - 54; | |
2215 if ( !v29 ) | |
2216 goto LABEL_44; | |
2217 v30 = v29 - 1; | |
2218 if ( !v30 ) | |
2219 goto LABEL_50; | |
2220 if ( v30 == 11 ) | |
2221 { | |
2222 LABEL_43: | |
2223 v20 = 1; | |
2224 v50 = 1; | |
2225 goto LABEL_51; | |
2226 } | |
2227 } | |
2228 } | |
2229 LABEL_51: | |
2230 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2231 if ( (signed int)v22 >= 16 ) | |
2232 { | |
2233 if ( v48 ) | |
2234 { | |
2235 v31 = 0; | |
2236 v32 = (char *)v21->pInventoryItems; | |
2237 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2238 { | |
2239 ++v31; | |
2240 v32 += 36; | |
2241 if ( v31 >= 138 ) | |
2242 goto LABEL_59; | |
2243 } | |
2244 v48 = 0; | |
2245 v45 = 1; | |
2246 } | |
2247 LABEL_59: | |
2248 if ( v21->pConditions[17] ) | |
2249 v46 = 1; | |
2250 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2251 { | |
2252 ++v21->sHealth; | |
2253 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2254 v21->sHealth = v21->GetMaxHealth(); | |
2255 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2256 { | |
2257 LODWORD(v21->pConditions[13]) = 0; | |
2258 HIDWORD(v21->pConditions[13]) = 0; | |
2259 } | |
2260 v51 = 1; | |
2261 } | |
2262 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2263 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2264 && !v21->pConditions[14] | |
2265 && !v21->pConditions[16] ) | |
2266 { | |
2267 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2268 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2269 v21->sHealth = v21->GetMaxHealth(); | |
2270 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2271 { | |
2272 LODWORD(v21->pConditions[13]) = 0; | |
2273 HIDWORD(v21->pConditions[13]) = 0; | |
2274 } | |
2275 v51 = 1; | |
2276 } | |
2277 if ( v50 ) | |
2278 { | |
2279 v33 = (char *)&v21->sMana; | |
2280 ++*(int *)v33; | |
2281 if ( v21->sMana > v21->GetMaxMana() ) | |
2282 *(int *)v33 = v21->GetMaxMana(); | |
2283 v51 = 1; | |
2284 } | |
2285 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2286 { | |
2287 v34 = LODWORD(v21->pConditions[13]); | |
2288 --v21->sHealth; | |
2289 v35 = v21->sHealth; | |
2290 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2291 v21->pConditions[13] = pParty->uTimePlayed; | |
2292 if ( v35 < 1 ) | |
2293 { | |
2294 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2295 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2296 { | |
2297 v21->pConditions[13] = pParty->uTimePlayed; | |
2298 } | |
2299 else | |
2300 { | |
2301 if ( !v21->pConditions[14] ) | |
2302 v21->pConditions[14] = pParty->uTimePlayed; | |
2303 } | |
2304 } | |
2305 v51 = 1; | |
2306 } | |
2307 if ( v45 ) | |
2308 { | |
2309 v36 = (char *)&v21->sMana; | |
2310 ++*(int *)v36; | |
2311 if ( v21->sMana > v21->GetMaxMana() ) | |
2312 *(int *)v36 = v21->GetMaxMana(); | |
2313 } | |
2314 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2315 { | |
2316 v37 = v21->sHealth; | |
2317 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2318 v21->sHealth = v37 - 2; | |
2319 v38 = v21->sMana; | |
2320 if ( v38 > v21->GetMaxMana() / 2 ) | |
2321 v21->sMana = v38 - 2; | |
2322 } | |
2323 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2324 { | |
2325 v39 = v21->sHealth; | |
2326 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2327 v21->sHealth = v39 - 1; | |
2328 v40 = v21->sMana; | |
2329 if ( v40 > 0 ) | |
2330 v21->sMana = v40 - 1; | |
2331 } | |
2332 ++v49; | |
2333 if ( v49 >= 4 ) | |
2334 { | |
2335 result = HIDWORD(pParty->uTimePlayed); | |
2336 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2337 if ( !viewparams->bRedrawGameUI ) | |
2338 { | |
2339 result = v51; | |
2340 viewparams->bRedrawGameUI = v51; | |
2341 } | |
2342 return result; | |
2343 } | |
2344 goto LABEL_25; | |
2345 } | |
2346 } | |
2347 } | |
2348 return result; | |
2349 } | |
2350 | |
2351 //----- (00493F79) -------------------------------------------------------- | |
351 | 2352 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2353 { |
2354 signed __int64 v2; // ST2C_8@1 | |
2355 signed __int64 v3; // qax@1 | |
351 | 2356 //signed __int64 v4; // ST1C_8@1 |
0 | 2357 unsigned __int64 v5; // qax@1 |
2358 unsigned int v6; // ebx@1 | |
2359 | |
2360 v2 = (signed __int64)((double)a2 * 0.234375); | |
2361 v3 = v2 / 60 / 60; | |
351 | 2362 //v4 = v3; |
0 | 2363 v5 = (unsigned int)v3 / 0x18; |
2364 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2365 _this->field_0_expire_second = v2 % 60; |
2366 _this->field_4_expire_minute = v2 / 60 % 60; | |
2367 _this->field_8_expire_hour = v3 % 24; | |
2368 _this->field_10_expire_week = v5 / 7 & 3; | |
2369 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2370 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2371 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2372 } |
2373 | |
2374 //----- (00494035) -------------------------------------------------------- | |
2375 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2376 { | |
2377 signed __int64 v0; // qax@1 | |
2378 signed __int64 v1; // ST30_8@1 | |
2379 signed __int64 v2; // ST38_8@1 | |
2380 unsigned __int64 v3; // qax@1 | |
2381 unsigned int v4; // edi@1 | |
2382 //signed int v5; // eax@4 | |
2383 //char *v6; // ecx@5 | |
2384 //Player *v7; // esi@8 | |
2385 //char *v8; // ecx@12 | |
766 | 2386 //Player *pPlayer; // esi@15 |
0 | 2387 //void *v10; // esi@25 |
2388 unsigned int v11; // ecx@27 | |
2389 signed int v12; // edi@29 | |
2390 Player *v13; // ecx@30 | |
2391 Player *v14; // esi@35 | |
2392 double v15; // st7@35 | |
2393 Player **v16; // esi@43 | |
2394 Player *v17; // edi@44 | |
2395 double v18; // st7@44 | |
816 | 2396 //float v19; // ST28_4@48 |
2397 //double v20; // ST38_8@48 | |
0 | 2398 Player *v21; // esi@51 |
2399 signed int v22; // edi@53 | |
2400 int v23; // eax@59 | |
2401 int v24; // ecx@60 | |
2402 int v25; // eax@63 | |
2403 int v26; // ecx@64 | |
2404 int v27; // eax@67 | |
2405 int v28; // ecx@68 | |
2406 int v29; // eax@71 | |
2407 int v30; // ecx@72 | |
2408 int v31; // eax@75 | |
2409 int v32; // ecx@76 | |
2410 int v33; // eax@79 | |
2411 int v34; // ecx@80 | |
2412 int v35; // eax@83 | |
2413 int v36; // ecx@84 | |
2414 int v37; // eax@87 | |
2415 int v38; // ecx@88 | |
2416 int v39; // eax@91 | |
2417 int v40; // ecx@92 | |
2418 int v41; // eax@95 | |
2419 int v42; // ecx@96 | |
2420 bool v43; // ebx@102 | |
2421 //SpellBuff *v44; // edi@104 | |
2422 //signed int v45; // ebp@104 | |
2423 bool v46; // edi@111 | |
2424 //SpellBuff *v47; // esi@113 | |
2425 //Player **v48; // esi@119 | |
2426 //signed int v49; // edi@121 | |
2427 //char *v50; // esi@122 | |
2428 signed int v51; // edx@128 | |
2429 signed int v52; // ecx@130 | |
2430 int v53; // eax@131 | |
2431 Player *v54; // eax@141 | |
766 | 2432 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2433 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2434 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2435 int v58; // [sp-4h] [bp-34h]@33 |
2436 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2437 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2438 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2439 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2440 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2441 signed int a2a; // [sp+18h] [bp-18h]@47 |
2442 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2443 | |
766 | 2444 //a2 = pParty->uCurrentHour; |
0 | 2445 v61 = pParty->uDaysPlayed; |
816 | 2446 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2447 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2448 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2449 v1 = v0; |
2450 v0 /= 60i64; | |
2451 v2 = v0; | |
2452 v3 = (unsigned int)v0 / 24; | |
2453 v4 = (unsigned int)(v3 / 7) >> 2; | |
2454 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2455 pParty->uCurrentMinute = v1 % 60; | |
2456 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2457 pParty->uCurrentHour = v2 % 24; | |
2458 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2459 pParty->uCurrentMonth = v4 % 12; | |
352 | 2460 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2461 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2462 { |
2463 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2464 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2465 | |
2466 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2467 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2468 | |
766 | 2469 ++pParty->days_played_without_rest; |
2470 if (pParty->days_played_without_rest > 1) | |
0 | 2471 { |
2472 for (uint i = 0; i < 4; ++i) | |
766 | 2473 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2474 | |
2475 if (pParty->uNumFoodRations) | |
2476 Party::TakeFood(1); | |
0 | 2477 else |
2478 for (uint i = 0; i < 4; ++i) | |
766 | 2479 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2480 | |
2481 if (pParty->days_played_without_rest > 3) | |
2482 for (uint i = 0; i < 4; ++i) | |
0 | 2483 { |
766 | 2484 auto player = pParty->pPlayers + i; |
2485 | |
2486 player->Zero(); | |
2487 | |
2488 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2489 { |
767 | 2490 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2491 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2492 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2493 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2494 } |
2495 } | |
766 | 2496 } |
2497 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2498 pOutdoor->SetFog(); |
2499 | |
2500 for (uint i = 0; i < 4; ++i) | |
2501 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2502 } | |
766 | 2503 |
0 | 2504 v11 = LODWORD(pParty->uTimePlayed); |
2505 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2506 { | |
2507 v12 = 1; | |
2508 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2509 viewparams->bRedrawGameUI = 1; | |
2510 while ( 1 ) | |
2511 { | |
2512 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2513 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2514 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2515 { |
2516 v58 = 0; | |
2517 } | |
2518 else | |
2519 { | |
2520 v58 = 0; | |
2521 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2522 { | |
2523 v14 = pPlayers[v12]; | |
2524 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2525 v14->ReceiveDamage((signed __int64)v15, 0); | |
2526 if ( pParty->uFlags & 4 ) | |
2527 { | |
783 | 2528 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2529 GameUI_Footer_TimeLeft = 128; | |
0 | 2530 } |
2531 goto LABEL_39; | |
2532 } | |
2533 v13 = pPlayers[v12]; | |
2534 } | |
130 | 2535 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2536 LABEL_39: |
2537 ++v12; | |
2538 if ( v12 > 4 ) | |
2539 { | |
2540 v11 = LODWORD(pParty->uTimePlayed); | |
2541 break; | |
2542 } | |
2543 } | |
2544 } | |
2545 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2546 { | |
2547 viewparams->bRedrawGameUI = 1; | |
2548 pParty->field_6FC = v11 + 128; | |
2549 v16 = &pPlayers[1]; | |
2550 do | |
2551 { | |
2552 v17 = *v16; | |
2553 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2554 v17->ReceiveDamage((signed __int64)v18, 0); | |
2555 if ( pParty->uFlags & 0x200 ) | |
2556 { | |
783 | 2557 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2558 GameUI_Footer_TimeLeft = 128; | |
0 | 2559 } |
2560 ++v16; | |
2561 } | |
2562 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2563 } | |
2564 _493938_regenerate(); | |
2565 v65 = 4; | |
816 | 2566 a2a = pEventTimer->uTimeElapsed; |
2567 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2568 { | |
2569 //v19 = (double)(signed int)prev_time * 0.5; | |
2570 //v20 = v19 + 6.7553994e15; | |
2571 a2a *= 0.5f; | |
2572 if (a2a < 1) | |
0 | 2573 a2a = 1; |
2574 } | |
2575 v62 = &pPlayers[1]; | |
2576 do | |
2577 { | |
2578 v21 = *v62; | |
2579 if ( (*v62)->uTimeToRecovery ) | |
2580 v21->Recover(a2a); | |
2581 v22 = v21->sHealth; | |
2582 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2583 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2584 { | |
2585 if ( v22 >= 1 ) | |
2586 goto LABEL_59; | |
2587 v59 = 0; | |
2588 v56 = 13; | |
2589 } | |
2590 else | |
2591 { | |
2592 v59 = 0; | |
2593 v56 = 14; | |
2594 } | |
2595 v21->SetCondition(v56, v59); | |
2596 LABEL_59: | |
2597 v23 = (int)&v21->field_E0; | |
2598 if ( v21->field_E0 ) | |
2599 { | |
816 | 2600 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2601 if ( v24 > 0 ) |
2602 { | |
2603 *(int *)v23 = v24; | |
2604 } | |
2605 else | |
2606 { | |
2607 *(int *)v23 = 0; | |
2608 viewparams->bRedrawGameUI = 1; | |
2609 } | |
2610 } | |
2611 v25 = (int)&v21->field_E4; | |
2612 if ( v21->field_E4 ) | |
2613 { | |
816 | 2614 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2615 if ( v26 > 0 ) |
2616 { | |
2617 *(int *)v25 = v26; | |
2618 } | |
2619 else | |
2620 { | |
2621 *(int *)v25 = 0; | |
2622 viewparams->bRedrawGameUI = 1; | |
2623 } | |
2624 } | |
2625 v27 = (int)&v21->field_E8; | |
2626 if ( v21->field_E8 ) | |
2627 { | |
816 | 2628 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2629 if ( v28 > 0 ) |
2630 { | |
2631 *(int *)v27 = v28; | |
2632 } | |
2633 else | |
2634 { | |
2635 *(int *)v27 = 0; | |
2636 viewparams->bRedrawGameUI = 1; | |
2637 } | |
2638 } | |
2639 v29 = (int)&v21->field_EC; | |
2640 if ( v21->field_EC ) | |
2641 { | |
816 | 2642 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2643 if ( v30 > 0 ) |
2644 { | |
2645 *(int *)v29 = v30; | |
2646 } | |
2647 else | |
2648 { | |
2649 *(int *)v29 = 0; | |
2650 viewparams->bRedrawGameUI = 1; | |
2651 } | |
2652 } | |
2653 v31 = (int)&v21->field_F0; | |
2654 if ( v21->field_F0 ) | |
2655 { | |
816 | 2656 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2657 if ( v32 > 0 ) |
2658 { | |
2659 *(int *)v31 = v32; | |
2660 } | |
2661 else | |
2662 { | |
2663 *(int *)v31 = 0; | |
2664 viewparams->bRedrawGameUI = 1; | |
2665 } | |
2666 } | |
2667 v33 = (int)&v21->field_F4; | |
2668 if ( v21->field_F4 ) | |
2669 { | |
816 | 2670 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2671 if ( v34 > 0 ) |
2672 { | |
2673 *(int *)v33 = v34; | |
2674 } | |
2675 else | |
2676 { | |
2677 *(int *)v33 = 0; | |
2678 viewparams->bRedrawGameUI = 1; | |
2679 } | |
2680 } | |
2681 v35 = (int)&v21->field_F8; | |
2682 if ( v21->field_F8 ) | |
2683 { | |
816 | 2684 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2685 if ( v36 > 0 ) |
2686 { | |
2687 *(int *)v35 = v36; | |
2688 } | |
2689 else | |
2690 { | |
2691 *(int *)v35 = 0; | |
2692 viewparams->bRedrawGameUI = 1; | |
2693 } | |
2694 } | |
2695 v37 = (int)&v21->field_FC; | |
2696 if ( v21->field_FC ) | |
2697 { | |
816 | 2698 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2699 if ( v38 > 0 ) |
2700 { | |
2701 *(int *)v37 = v38; | |
2702 } | |
2703 else | |
2704 { | |
2705 *(int *)v37 = 0; | |
2706 viewparams->bRedrawGameUI = 1; | |
2707 } | |
2708 } | |
2709 v39 = (int)&v21->field_100; | |
2710 if ( v21->field_100 ) | |
2711 { | |
816 | 2712 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2713 if ( v40 > 0 ) |
2714 { | |
2715 *(int *)v39 = v40; | |
2716 } | |
2717 else | |
2718 { | |
2719 *(int *)v39 = 0; | |
2720 viewparams->bRedrawGameUI = 1; | |
2721 } | |
2722 } | |
2723 v41 = (int)&v21->field_104; | |
2724 if ( v21->field_104 ) | |
2725 { | |
816 | 2726 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2727 if ( v42 > 0 ) |
2728 { | |
2729 *(int *)v41 = v42; | |
2730 } | |
2731 else | |
2732 { | |
2733 *(int *)v41 = 0; | |
2734 viewparams->bRedrawGameUI = 1; | |
2735 } | |
2736 } | |
2737 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2738 --v65; | |
2739 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2740 | |
2741 for (uint k = 0; k < 24; ++k) | |
2742 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2743 | |
2744 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2745 v21->SetCondition(1u, 0); | |
2746 ++v62; | |
2747 } | |
2748 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2749 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2750 | |
2751 for (uint i = 0; i < 20; ++i) | |
2752 { | |
2753 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2754 viewparams->bRedrawGameUI = 1; | |
2755 } | |
2756 | |
2757 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2758 { | |
2759 for (uint i = 0; i < 4; ++i) | |
2760 pParty->pPlayers[i].SetCondition(1, 0); | |
2761 } | |
2762 | |
2763 for (uint i = 0; i < 2; ++i) | |
2764 { | |
2765 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2766 if (pBuf->uExpireTime == 0) | |
2767 continue; | |
2768 | |
2769 if ( !(pBuf->uFlags & 1) ) | |
2770 { | |
2771 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2772 { | |
2773 pBuf->Reset(); | |
2774 if (dword_4EE07C[i] == 7 ) | |
2775 pParty->bFlying = false; | |
2776 } | |
2777 } | |
2778 } | |
2779 | |
2780 v51 = v65; | |
2781 if ( v65 ) | |
2782 goto LABEL_135; | |
151 | 2783 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2784 { |
2785 v52 = (signed int)&pPlayers[1]; | |
2786 while ( 1 ) | |
2787 { | |
2788 v53 = *(int *)v52; | |
2789 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2790 break; | |
2791 v52 += 4; | |
2792 if ( v52 > (signed int)&pPlayers[4] ) | |
2793 goto LABEL_135; | |
2794 } | |
2795 *(int *)(v53 + 16) = 0; | |
2796 *(int *)(v53 + 20) = 0; | |
2797 v51 = 1; | |
2798 LABEL_135: | |
151 | 2799 if ( pCurrentScreen != SCREEN_REST |
0 | 2800 && (!v51 || dword_5C35C0) ) |
2801 uGameState = 8; | |
2802 } | |
2803 if ( uActiveCharacter ) | |
2804 { | |
151 | 2805 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2806 { |
2807 v54 = pPlayers[uActiveCharacter]; | |
2808 if ( v54->pConditions[2] | |
2809 || v54->pConditions[12] | |
2810 || v54->pConditions[13] | |
2811 || v54->pConditions[14] | |
2812 || v54->pConditions[15] | |
2813 || v54->pConditions[16] ) | |
2814 { | |
2815 viewparams->bRedrawGameUI = 1; | |
2816 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2817 } | |
2818 } | |
2819 } | |
2820 } | |
2821 | |
2822 //----- (00494820) -------------------------------------------------------- | |
758 | 2823 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2824 { |
2825 signed int v1; // eax@1 | |
2826 | |
2827 v1 = 5; | |
758 | 2828 if ( a1 % 24 >= 5 ) |
0 | 2829 v1 = 29; |
758 | 2830 return v1 - a1 % 24; |
0 | 2831 } |
2832 | |
2833 //----- (00494836) -------------------------------------------------------- | |
2834 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2835 { | |
2836 int v3; // esi@1 | |
2837 int result; // eax@1 | |
2838 stru339_spell_sound *v5; // ebx@1 | |
2839 int *v6; // edi@2 | |
2840 unsigned int v7; // eax@3 | |
2841 int v8; // [sp+Ch] [bp-8h]@3 | |
2842 int v9; // [sp+10h] [bp-4h]@2 | |
2843 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2844 | |
2845 v3 = 0; | |
2846 result = word_4EE088_sound_ids[uSoundID]; | |
2847 v5 = this; | |
2848 a2a = word_4EE088_sound_ids[uSoundID]; | |
2849 if ( result ) | |
2850 { | |
2851 v9 = 0; | |
2852 v6 = this->pSoundsOffsets; | |
2853 do | |
2854 { | |
2855 v7 = a2a++; | |
2856 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2857 if ( !result ) | |
2858 break; | |
2859 a6 += 4; | |
2860 result = v8 + 256; | |
2861 *v6 = v3; | |
2862 v3 += result; | |
2863 ++v9; | |
2864 *(v6 - 2) = result; | |
2865 ++v6; | |
2866 } | |
2867 while ( v9 < 2 ); | |
2868 } | |
2869 return result; | |
2870 } | |
2871 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2872 | |
2873 //----- (00494AED) -------------------------------------------------------- | |
130 | 2874 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2875 { |
2876 unsigned int _uNumFrames; // edx@1 | |
2877 unsigned int result; // eax@1 | |
2878 PlayerFrame *v4; // ecx@2 | |
2879 | |
2880 _uNumFrames = this->uNumFrames; | |
2881 result = 0; | |
2882 if ( (signed int)this->uNumFrames <= 0 ) | |
2883 { | |
2884 LABEL_5: | |
2885 result = 0; | |
2886 } | |
2887 else | |
2888 { | |
2889 v4 = this->pFrames; | |
130 | 2890 while ( v4->expression != expression ) |
0 | 2891 { |
2892 ++result; | |
2893 ++v4; | |
2894 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2895 goto LABEL_5; | |
2896 } | |
2897 } | |
2898 return result; | |
2899 } | |
2900 | |
2901 //----- (00494B10) -------------------------------------------------------- | |
2902 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2903 { | |
2904 unsigned int v3; // esi@1 | |
2905 PlayerFrame *v4; // edi@1 | |
2906 PlayerFrame *v5; // ecx@1 | |
2907 __int16 v6; // dx@2 | |
2908 int v7; // edx@3 | |
2909 char *i; // eax@3 | |
2910 int v9; // ecx@5 | |
2911 PlayerFrame *result; // eax@6 | |
2912 | |
2913 v3 = uFramesetID; | |
2914 v4 = this->pFrames; | |
2915 v5 = &v4[uFramesetID]; | |
2916 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2917 { | |
2918 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2919 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2920 { | |
2921 v9 = *(short *)i; | |
2922 if ( v7 <= v9 ) | |
2923 break; | |
2924 v7 -= v9; | |
2925 ++v3; | |
2926 } | |
2927 result = &v4[v3]; | |
2928 } | |
2929 else | |
2930 { | |
2931 result = &v4[uFramesetID]; | |
2932 } | |
2933 return result; | |
2934 } | |
2935 | |
2936 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2937 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2938 { |
2939 PlayerFrameTable *v4; // edi@1 | |
2940 int v5; // esi@1 | |
2941 int v6; // eax@2 | |
2942 | |
2943 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2944 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2945 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
|
2946 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2947 *pAnimTime = v5; |
0 | 2948 } |
2949 else | |
2950 { | |
2951 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2952 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2953 *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
|
2954 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2955 return &v4->pFrames[*pFramesetID]; |
0 | 2956 } |
2957 | |
2958 //----- (00494BC3) -------------------------------------------------------- | |
2959 void PlayerFrameTable::ToFile() | |
2960 { | |
2961 PlayerFrameTable *v1; // esi@1 | |
2962 FILE *v2; // eax@1 | |
2963 FILE *v3; // edi@1 | |
2964 | |
2965 auto Str = this; | |
2966 | |
2967 v1 = Str; | |
2968 v2 = fopen("data\\dpft.bin", "wb"); | |
2969 v3 = v2; | |
2970 if ( !v2 ) | |
2971 Abortf("Unable to save dpft.bin!"); | |
2972 fwrite(v1, 4u, 1u, v2); | |
2973 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2974 fclose(v3); | |
2975 } | |
2976 | |
2977 //----- (00494C0F) -------------------------------------------------------- | |
2978 void PlayerFrameTable::FromFile(void *pSerialized) | |
2979 { | |
2980 uNumFrames = *(int *)pSerialized; | |
2981 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2982 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2983 } | |
2984 | |
2985 //----- (00494C5A) -------------------------------------------------------- | |
2986 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2987 { | |
2988 PlayerFrameTable *v2; // ebx@1 | |
2989 FILE *v3; // eax@1 | |
2990 int v4; // esi@3 | |
2991 void *v5; // eax@10 | |
2992 FILE *v6; // ST0C_4@12 | |
2993 char *i; // eax@12 | |
2994 __int16 v8; // ax@15 | |
2995 const char *v9; // ST10_4@15 | |
2996 unsigned __int16 v10; // ax@15 | |
2997 const char *v11; // ST0C_4@15 | |
2998 int j; // esi@15 | |
2999 int v13; // eax@17 | |
3000 int v14; // edx@22 | |
3001 int v15; // ecx@23 | |
3002 int v16; // eax@24 | |
3003 signed int k; // eax@27 | |
3004 PlayerFrame *v18; // edx@28 | |
3005 int v19; // esi@28 | |
3006 int l; // ecx@29 | |
3007 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3008 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3009 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3010 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3011 int v26; // [sp+2FCh] [bp-8h]@3 | |
3012 FILE *File; // [sp+300h] [bp-4h]@1 | |
3013 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3014 | |
3015 v2 = this; | |
3016 //TileTable::dtor((TileTable *)this); | |
3017 v3 = fopen(Args, "r"); | |
3018 File = v3; | |
3019 if ( !v3 ) | |
3020 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3021 v4 = 0; | |
3022 v25 = 0; | |
3023 v26 = 1; | |
3024 if ( fgets(&Buf, 490, v3) ) | |
3025 { | |
3026 do | |
3027 { | |
3028 *strchr(&Buf, 10) = 0; | |
703 | 3029 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3030 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3031 { | |
3032 if ( v24.uPropCount < 3 ) | |
0 | 3033 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3034 ++v25; | |
3035 } | |
3036 ++v26; | |
3037 } | |
3038 while ( fgets(&Buf, 490, File) ); | |
3039 v4 = v25; | |
3040 } | |
3041 v2->uNumFrames = v4; | |
3042 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3043 v2->pFrames = (PlayerFrame *)v5; | |
3044 if ( !v5 ) | |
3045 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3046 v6 = File; | |
3047 v2->uNumFrames = 0; | |
3048 fseek(v6, 0, 0); | |
3049 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3050 { | |
3051 *strchr(&Buf, 10) = 0; | |
703 | 3052 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3053 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3054 { |
3055 v8 = atoi(v24.pProperties[0]); | |
3056 v9 = v24.pProperties[1]; | |
130 | 3057 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3058 v10 = atoi(v9); |
3059 v11 = v24.pProperties[2]; | |
3060 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3061 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3062 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3063 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3064 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3065 { |
3066 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3067 { | |
3068 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3069 *(char *)v13 |= 4u; | |
3070 } | |
3071 } | |
3072 ++v2->uNumFrames; | |
3073 } | |
3074 } | |
3075 fclose(File); | |
3076 v14 = 0; | |
3077 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3078 { | |
3079 v15 = 0; | |
3080 do | |
3081 { | |
3082 v16 = (int)&v2->pFrames[v15]; | |
3083 if ( !(*(char *)(v16 + 18) & 4) ) | |
3084 *(char *)(v16 + 8) |= 1u; | |
3085 ++v14; | |
3086 ++v15; | |
3087 } | |
3088 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3089 } | |
3090 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3091 { | |
3092 v18 = v2->pFrames; | |
3093 Argsa = (int)&v18[k]; | |
3094 v19 = *(short *)(Argsa + 4); | |
3095 if ( *(char *)(Argsa + 8) & 1 ) | |
3096 { | |
3097 ++k; | |
3098 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3099 { | |
3100 v19 += *(short *)(l + 4); | |
3101 ++k; | |
3102 } | |
3103 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3104 } | |
3105 ++k; | |
3106 } | |
3107 return 1; | |
3108 } | |
3109 | |
3110 //----- (00494F3A) -------------------------------------------------------- | |
3111 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3112 { | |
3113 IconFrameTable *v2; // esi@1 | |
3114 int v3; // ebx@1 | |
3115 unsigned int uID; // edi@1 | |
3116 unsigned int result; // eax@4 | |
3117 | |
3118 v2 = this; | |
3119 v3 = 0; | |
3120 uID = 0; | |
3121 if ( (signed int)this->uNumIcons <= 0 ) | |
3122 { | |
3123 LABEL_4: | |
3124 result = 0; | |
3125 } | |
3126 else | |
3127 { | |
3128 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3129 { | |
3130 ++uID; | |
3131 ++v3; | |
3132 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3133 goto LABEL_4; | |
3134 } | |
3135 result = uID; | |
3136 } | |
3137 return result; | |
3138 } | |
3139 | |
3140 //----- (00494F70) -------------------------------------------------------- | |
3141 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3142 { | |
3143 IconFrame *v3; // edi@1 | |
3144 IconFrame *v4; // ecx@1 | |
3145 __int16 v5; // dx@2 | |
3146 int v6; // edx@3 | |
3147 unsigned int v7; // eax@3 | |
3148 char *i; // ecx@3 | |
3149 int v9; // esi@5 | |
3150 IconFrame *result; // eax@6 | |
3151 | |
3152 v3 = this->pIcons; | |
3153 v4 = &v3[uIconID]; | |
3154 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3155 { | |
3156 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3157 v7 = uIconID; | |
3158 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3159 { | |
3160 v9 = *(short *)i; | |
3161 if ( v6 <= v9 ) | |
3162 break; | |
3163 v6 -= v9; | |
3164 ++v7; | |
3165 } | |
3166 result = &v3[v7]; | |
3167 } | |
3168 else | |
3169 { | |
3170 result = &v3[uIconID]; | |
3171 } | |
3172 return result; | |
3173 } | |
3174 | |
3175 //----- (00494FBF) -------------------------------------------------------- | |
3176 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3177 { | |
3178 IconFrameTable *v2; // esi@1 | |
3179 unsigned int v3; // edi@3 | |
3180 const char *i; // eax@3 | |
3181 IconFrame *v5; // eax@5 | |
3182 | |
3183 v2 = this; | |
3184 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3185 { | |
3186 v3 = uIconID; | |
3187 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3188 { | |
3189 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3190 v5 = v2->pIcons; | |
3191 if ( !(v5[v3].uFlags & 1) ) | |
3192 break; | |
3193 ++v3; | |
3194 } | |
3195 } | |
3196 } | |
3197 | |
3198 //----- (0049500A) -------------------------------------------------------- | |
3199 void IconFrameTable::ToFile() | |
3200 { | |
3201 IconFrameTable *v1; // esi@1 | |
3202 FILE *v2; // eax@1 | |
3203 FILE *v3; // edi@1 | |
3204 | |
3205 auto Str = this; | |
3206 | |
3207 v1 = Str; | |
3208 v2 = fopen("data\\dift.bin", "wb"); | |
3209 v3 = v2; | |
3210 if ( !v2 ) | |
3211 Abortf("Unable to save dift.bin!"); | |
3212 fwrite(v1, 4u, 1u, v2); | |
3213 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3214 fclose(v3); | |
3215 } | |
3216 | |
3217 //----- (00495056) -------------------------------------------------------- | |
3218 void IconFrameTable::FromFile(void *pSerialized) | |
3219 { | |
3220 uNumIcons = *(int *)pSerialized; | |
3221 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3222 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3223 } | |
3224 | |
3225 //----- (0049509D) -------------------------------------------------------- | |
3226 int IconFrameTable::FromFileTxt(const char *Args) | |
3227 { | |
3228 IconFrameTable *v2; // ebx@1 | |
3229 FILE *v3; // eax@1 | |
3230 int v4; // esi@3 | |
3231 void *v5; // eax@10 | |
3232 FILE *v6; // ST0C_4@12 | |
3233 char *i; // eax@12 | |
3234 const char *v8; // ST00_4@15 | |
3235 int v9; // eax@16 | |
3236 int v10; // edx@20 | |
3237 int v11; // ecx@21 | |
3238 int v12; // eax@22 | |
3239 signed int j; // edx@25 | |
3240 IconFrame *v14; // ecx@26 | |
3241 int v15; // esi@26 | |
3242 int k; // eax@27 | |
3243 signed int result; // eax@11 | |
3244 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3245 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3246 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3247 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3248 int v22; // [sp+2FCh] [bp-8h]@3 | |
3249 FILE *File; // [sp+300h] [bp-4h]@1 | |
3250 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3251 | |
3252 v2 = this; | |
3253 //TileTable::dtor((TileTable *)this); | |
3254 v3 = fopen(Args, "r"); | |
3255 File = v3; | |
3256 if ( !v3 ) | |
3257 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3258 v4 = 0; | |
3259 v21 = 0; | |
3260 v22 = 1; | |
3261 if ( fgets(&Buf, 490, v3) ) | |
3262 { | |
3263 do | |
3264 { | |
3265 *strchr(&Buf, 10) = 0; | |
3266 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3267 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3268 { | |
3269 if ( v20.uPropCount < 3 ) | |
0 | 3270 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3271 ++v21; | |
3272 } | |
3273 ++v22; | |
3274 } | |
3275 while ( fgets(&Buf, 490, File) ); | |
3276 v4 = v21; | |
3277 } | |
3278 v2->uNumIcons = v4; | |
3279 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3280 v2->pIcons = (IconFrame *)v5; | |
3281 if ( v5 ) | |
3282 { | |
3283 v6 = File; | |
3284 v2->uNumIcons = 0; | |
3285 fseek(v6, 0, 0); | |
3286 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3287 { | |
3288 *strchr(&Buf, 10) = 0; | |
3289 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3290 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3291 { |
3292 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3293 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3294 v8 = v20.pProperties[2]; | |
3295 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3296 if ( !_strcmpi(v8, "new") ) | |
3297 { | |
3298 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3299 *(char *)v9 |= 4u; | |
3300 } | |
3301 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3302 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3303 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3304 } | |
3305 } | |
3306 fclose(File); | |
3307 v10 = 0; | |
3308 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3309 { | |
3310 v11 = 0; | |
3311 do | |
3312 { | |
3313 v12 = (int)&v2->pIcons[v11]; | |
3314 if ( !(*(char *)(v12 + 60) & 4) ) | |
3315 *(char *)(v12 + 28) |= 1u; | |
3316 ++v10; | |
3317 ++v11; | |
3318 } | |
3319 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3320 } | |
3321 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3322 { | |
3323 v14 = v2->pIcons; | |
3324 Argsa = (int)&v14[j]; | |
3325 v15 = *(short *)(Argsa + 24); | |
3326 if ( *(char *)(Argsa + 28) & 1 ) | |
3327 { | |
3328 ++j; | |
3329 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3330 { | |
3331 v15 += *(short *)(k + 24); | |
3332 ++j; | |
3333 } | |
3334 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3335 } | |
3336 ++j; | |
3337 } | |
3338 result = 1; | |
3339 } | |
3340 else | |
3341 { | |
3342 fclose(File); | |
3343 result = 0; | |
3344 } | |
3345 return result; | |
3346 } | |
3347 | |
3348 //----- (00495366) -------------------------------------------------------- | |
3349 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3350 { | |
3351 int v2; // edi@1 | |
3352 int v3; // edx@2 | |
3353 int v4; // esi@3 | |
3354 int v5; // ebx@5 | |
3355 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3356 signed int v8; // [sp+10h] [bp-10h]@1 | |
3357 int **v9; // [sp+14h] [bp-Ch]@4 | |
3358 signed int v10; // [sp+18h] [bp-8h]@3 | |
3359 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3360 | |
3361 v2 = a1; | |
3362 v11 = a2; | |
3363 v8 = 0; | |
3364 v7 = 0; | |
3365 if ( dword_AE336C == a1 ) | |
3366 { | |
3367 v3 = dword_AE3370; | |
3368 } | |
3369 else | |
3370 { | |
3371 v4 = a2; | |
3372 dword_AE336C = a1; | |
3373 v10 = 0; | |
3374 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3375 goto LABEL_17; | |
3376 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3377 do | |
3378 { | |
3379 v5 = tolower(*(char *)*v9); | |
3380 if ( v5 == tolower(v2) ) | |
3381 { | |
3382 if ( v8 ) | |
3383 v7 = v10; | |
3384 else | |
3385 v8 = v10; | |
3386 } | |
3387 ++v10; | |
3388 v9 += 2; | |
3389 } | |
3390 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3391 if ( v8 && v8 != v7 ) | |
3392 v3 = v8 + rand() % (v7 - v8); | |
3393 else | |
3394 LABEL_17: | |
3395 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3396 } | |
3397 dword_AE3370 = v3; | |
3398 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3399 } | |
3400 // AE336C: using guessed type int dword_AE336C; | |
3401 // AE3370: using guessed type int dword_AE3370; | |
3402 | |
3403 //----- (00495430) -------------------------------------------------------- | |
607 | 3404 char * GetReputationString( signed int a1 ) |
3405 { | |
566 | 3406 if (a1 >= 25) |
3407 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3408 else if (a1 >= 6) | |
3409 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3410 else if (a1 >= -5) | |
3411 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3412 else if (a1 >= -24) | |
3413 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3414 else |
566 | 3415 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3416 } |
3417 | |
3418 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3419 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3420 { |
3421 unsigned __int8 v6; // bl@1 | |
3422 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3423 //NPCData *v9; // eax@4 |
250 | 3424 //size_t v10; // eax@6 |
0 | 3425 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3426 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3427 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3428 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3429 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3430 //int v16; // edx@10 |
0 | 3431 int v17; // eax@10 |
3432 signed __int64 v18; // qax@18 | |
3433 unsigned int v19; // edi@32 | |
3434 unsigned __int8 *v20; // ebx@32 | |
3435 int v21; // ecx@34 | |
3436 __int16 v22; // ax@34 | |
3437 int v23; // edx@39 | |
3438 int v24; // eax@39 | |
3439 int v25; // eax@45 | |
3440 float *v26; // esi@68 | |
3441 float v27; // ST18_4@68 | |
3442 signed int v28; // eax@68 | |
3443 int v29; // eax@68 | |
3444 float v30; // ST18_4@72 | |
3445 signed int v31; // eax@72 | |
3446 float v32; // ST18_4@74 | |
3447 signed int v33; // eax@74 | |
3448 double v34; // st7@75 | |
3449 float v35; // ST18_4@76 | |
3450 signed int v36; // eax@76 | |
3451 float *v37; // esi@78 | |
3452 float v38; // ST18_4@78 | |
3453 int v39; // eax@78 | |
3454 float v40; // ST18_4@82 | |
3455 int v41; // eax@82 | |
3456 float v42; // ST18_4@83 | |
3457 int v43; // eax@83 | |
3458 float v44; // ST18_4@85 | |
3459 int v45; // eax@85 | |
3460 const char *v46; // eax@86 | |
3461 unsigned int v47; // eax@87 | |
3462 float v48; // ST18_4@97 | |
3463 __int64 v49; // ST14_8@107 | |
3464 int v50; // eax@107 | |
3465 int v51; // eax@108 | |
3466 Player *v52; // eax@109 | |
3467 int v53; // [sp-4h] [bp-13Ch]@107 | |
3468 int v54; // [sp+0h] [bp-138h]@107 | |
3469 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3470 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3471 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3472 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3473 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3475 //Player *v61; // [sp+124h] [bp-14h]@3 |
3476 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3477 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3482 |
0 | 3483 |
3484 v6 = uPlayerID; | |
249 | 3485 //Str = lpsz; |
0 | 3486 if ( IsBadStringPtrA(lpsz, 1u) ) |
3487 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3488 |
0 | 3489 a1[0] = 0; |
3490 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3491 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3492 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3493 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
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 NPCData *npc = nullptr; |
0 | 3496 if ( dword_5C35D4 ) |
248 | 3497 { |
463 | 3498 //__debugbreak(); // fix |
459 | 3499 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
|
3500 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 else |
602 | 3502 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 //v65 = v9; |
250 | 3504 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 //v64 = 0; |
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 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3510 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 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
|
3528 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 case 2: |
0 | 3535 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 v11 = a1; |
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 5: |
0 | 3542 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3543 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3544 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3545 { | |
3546 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3547 { | |
3548 if ( v18 < 20 ) | |
3549 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3550 } | |
3551 else | |
3552 { | |
3553 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3554 } | |
3555 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 case 6: |
0 | 3558 if ( pPlayer->uSex ) |
3559 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3560 else | |
3561 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 case 7: |
0 | 3564 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 case 8: |
0 | 3570 v19 = 0; |
3571 v63 = 0; | |
484 | 3572 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3573 do |
3574 { | |
3575 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3576 { | |
3577 v21 = v63; | |
3578 v22 = word_4EE150[v19]; | |
3579 ++v63; | |
3580 v55[v21] = v22; | |
3581 } | |
3582 ++v19; | |
3583 } | |
3584 while ( v19 < 28 ); | |
3585 if ( v63 ) | |
3586 { | |
3587 v23 = rand() % v63; | |
3588 v24 = dword_A74CDC; | |
3589 if ( dword_A74CDC == -1 ) | |
3590 { | |
3591 v24 = v23; | |
3592 dword_A74CDC = v23; | |
3593 } | |
492 | 3594 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3595 } |
3596 else | |
3597 { | |
3598 v11 = (char *)pNPCTopics[55].pText; | |
3599 } | |
249 | 3600 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3606 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3608 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3609 case 10: |
0 | 3610 if ( pPlayer->uSex ) |
3611 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3612 else | |
3613 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 case 11: |
0 | 3616 v25 = GetPartyReputation(); |
3617 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3618 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 v25 = npc->rep; |
0 | 3620 LABEL_46: |
3621 if ( v25 >= 25 ) | |
3622 { | |
3623 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3624 } | |
3625 else | |
3626 { | |
3627 if ( v25 < 6 ) | |
3628 { | |
3629 if ( v25 >= -5 ) | |
3630 { | |
3631 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3632 } | |
3633 else | |
3634 { | |
3635 if ( v25 < -24 ) | |
3636 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3637 else | |
3638 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3639 } | |
3640 } | |
3641 else | |
3642 { | |
3643 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3644 } | |
3645 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 case 13: |
0 | 3648 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 case 14: |
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 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 i += 2; |
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 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 case 16: |
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 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 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
|
3681 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 sprintf(a1, "%lu", pay_percentage); |
250 | 3685 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 goto _continue_strcat; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 sprintf(a1, "%lu", v51); |
0 | 3699 v11 = a1; |
254
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 case 23: |
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 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3725 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3726 switch ( a5 ) |
3727 { | |
3728 case 3: | |
3729 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3730 v45 = a3->GetValue(); |
0 | 3731 v29 = pPlayer->_4B8213(v45, v44); |
3732 break; | |
3733 case 4: | |
3734 v29 = pPlayer->_4B824B(*v37); | |
3735 break; | |
3736 case 5: | |
3737 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3738 v43 = a3->GetValue(); |
0 | 3739 v29 = pPlayer->_4B8265(v43, v42); |
3740 break; | |
3741 case 6: | |
3742 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 v41 = a3->GetValue(); |
0 | 3744 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3745 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3748 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3752 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3753 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3754 v28 = a3->GetValue(); |
749 | 3755 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3756 if ( a5 == 3 ) |
3757 { | |
3758 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3759 v36 = a3->GetValue(); |
0 | 3760 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3761 if (a3->Broken()) |
0 | 3762 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3763 goto _continue_sprintf; |
0 | 3764 } |
3765 if ( a5 != 4 ) | |
3766 { | |
3767 if ( a5 == 5 ) | |
3768 { | |
3769 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3770 v33 = a3->GetValue(); |
0 | 3771 v29 = pPlayer->_4B81C3(v33, v32); |
3772 } | |
3773 else | |
3774 { | |
3775 if ( a5 == 6 ) | |
3776 { | |
3777 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3778 v31 = a3->GetValue(); |
0 | 3779 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3780 if (a3->Broken()) |
0 | 3781 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3784 goto _continue_sprintf; |
0 | 3785 } |
3786 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 _continue_sprintf: |
0 | 3788 sprintf(a1, "%lu", v29); |
250 | 3789 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 goto _continue_strcat; |
0 | 3791 } |
3792 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 |
0 | 3794 v48 = v34; |
3795 v29 = pPlayer->_4B8179(v48); | |
254
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 28: |
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 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3813 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 if ( !a6 ) |
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 sub_493F79(&v57, *a6); |
351 | 3820 v54 = v57.field_18_expire_year; |
3821 v53 = v57.field_C_expire_day + 1; | |
3822 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3830 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3834 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3836 default: |
0 | 3837 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3838 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3839 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3840 goto _continue_strcat; |
484 | 3841 v49 = pParty->field_3C._s_times[v17-51]; |
3842 | |
0 | 3843 sub_493F79(&v56, v49); |
351 | 3844 v54 = v56.field_18_expire_year; |
3845 v53 = v56.field_C_expire_day + 1; | |
3846 v50 = v56.field_14_exprie_month; | |
0 | 3847 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3848 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3849 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3850 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3851 } |
0 | 3852 } |
3853 return pTmpBuf2; | |
3854 } | |
3855 | |
3856 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3857 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3858 { |
734 | 3859 //stru154 *v3; // edi@1 |
3860 //signed int v4; // eax@1 | |
3861 //signed int result; // eax@9 | |
3862 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3863 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3864 float v7; |
0 | 3865 |
3866 v.x = 0.0; | |
3867 v.y = 0.0; | |
3868 v.z = 0.0; | |
734 | 3869 GetFacePlane(a2, a3, &v, &v7); |
3870 | |
3871 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3872 polygonType = POLYGON_VerticalWall; | |
3873 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3874 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3875 polygonType = POLYGON_Floor; | |
0 | 3876 else |
734 | 3877 polygonType = POLYGON_InBetweenFloorAndWall; |
3878 | |
3879 face_plane.vNormal.x = v.x; | |
3880 face_plane.vNormal.y = v.y; | |
3881 face_plane.vNormal.z = v.z; | |
3882 face_plane.dist = v7; | |
0 | 3883 } |
3884 | |
3885 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3886 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3887 { |
734 | 3888 if (fabsf(pNormal->z) < 1e-6f) |
3889 polygonType = POLYGON_VerticalWall; | |
3890 else if (fabsf(pNormal->x) < 1e-6f && | |
3891 fabsf(pNormal->y) < 1e-6f) | |
3892 polygonType = POLYGON_Floor; | |
0 | 3893 else |
734 | 3894 polygonType = POLYGON_InBetweenFloorAndWall; |
3895 | |
3896 face_plane.vNormal.x = pNormal->x; | |
3897 face_plane.dist = dist; | |
3898 face_plane.vNormal.y = pNormal->y; | |
3899 face_plane.vNormal.z = pNormal->z; | |
0 | 3900 } |
3901 | |
3902 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3903 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3904 { |
3905 ODMFace *v5; // ebx@1 | |
734 | 3906 //int v6; // eax@1 |
3907 //unsigned __int16 *v7; // ebx@2 | |
3908 //Vec3_int_ *v8; // eax@3 | |
0 | 3909 Vec3_int_ *v9; // ecx@3 |
734 | 3910 //double v10; // st7@3 |
3911 //int v11; // ecx@3 | |
0 | 3912 Vec3_int_ *v12; // ecx@3 |
734 | 3913 //double v13; // st7@3 |
3914 //double v14; // st6@3 | |
3915 //double v15; // st5@3 | |
3916 //int v16; // ecx@3 | |
0 | 3917 Vec3_int_ *v17; // eax@3 |
734 | 3918 //double v18; // st5@3 |
0 | 3919 Vec3_float_ *v19; // eax@3 |
734 | 3920 //int result; // eax@8 |
3921 //float v21; // ecx@10 | |
3922 //double v22; // st7@10 | |
3923 //double v23; // st6@10 | |
0 | 3924 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3925 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3926 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3927 float v27; // [sp+20h] [bp-48h]@3 | |
3928 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3929 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3930 //float v30; // [sp+30h] [bp-38h]@3 | |
3931 //float v31; // [sp+34h] [bp-34h]@3 | |
3932 //float v32; // [sp+38h] [bp-30h]@3 | |
3933 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3934 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3935 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3936 //float v36; // [sp+50h] [bp-18h]@3 | |
3937 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3938 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3939 //int v39; // [sp+64h] [bp-4h]@1 |
3940 | |
3941 //v39 = 0; | |
0 | 3942 v1.x = 0.0; |
3943 v5 = pFace; | |
734 | 3944 //v6 = pFace->uNumVertices; |
0 | 3945 v1.y = 0.0; |
3946 v1.z = 0.0; | |
734 | 3947 |
3948 if (pFace->uNumVertices >= 2) | |
3949 { | |
3950 int i = 0; | |
3951 while ( i < pFace->uNumVertices - 2 ) | |
3952 { | |
3953 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3954 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3955 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3956 | |
3957 v1.x = v12->x - v9->x; | |
3958 v26 = v17->x - v12->x; | |
3959 v1.y = v12->y - v9->y; | |
3960 v27 = v17->y - v12->y; | |
3961 v1.z = v12->z - v9->z; | |
3962 v28 = v17->z - v12->z; | |
0 | 3963 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3964 v38.x = v19->x; | |
3965 v38.y = v19->y; | |
3966 v38.z = v19->z; | |
734 | 3967 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3968 { | |
3969 v38.Normalize(); | |
3970 | |
3971 pOutNormal->x = v38.x; | |
3972 pOutNormal->y = v38.y; | |
3973 pOutNormal->z = v38.z; | |
3974 | |
3975 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3976 return; | |
3977 } | |
3978 } | |
3979 } | |
3980 | |
3981 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3982 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3983 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3984 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3985 } |
3986 | |
3987 //----- (0049D700) -------------------------------------------------------- | |
3988 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3989 { | |
3990 unsigned int v1; // eax@1 | |
3991 int v2; // ecx@1 | |
3992 unsigned int v3; // eax@1 | |
3993 | |
3994 v1 = uDim; | |
3995 v2 = 0; | |
3996 v3 = v1 - 1; | |
3997 while ( v3 & 1 ) | |
3998 { | |
3999 v3 >>= 1; | |
4000 ++v2; | |
4001 } | |
4002 return v3 == 0 ? v2 : 0; | |
4003 } | |
4004 | |
4005 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4006 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4007 { |
737 | 4008 /*signed __int64 v2; // ST10_8@1 |
0 | 4009 double v3; // st7@1 |
4010 float v4; // ST24_4@1 | |
4011 double v5; // ST10_8@1 | |
4012 int v6; // ST1C_4@1 | |
4013 float v7; // ST24_4@1 | |
4014 double v8; // ST10_8@1 | |
4015 unsigned __int8 v9; // ST20_1@1 | |
4016 float v10; // ST24_4@1 | |
4017 double v11; // ST10_8@1 | |
4018 float v12; // ST24_4@1 | |
737 | 4019 double v13; // ST08_8@1*/ |
4020 | |
4021 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4022 (a2 >> 24) / 255.0f * 255.0f), | |
4023 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4024 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4025 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4026 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4027 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4028 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4029 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4030 /*v2 = a1 >> 24; | |
4031 v3 = (double)v2 / 255.0f; | |
4032 HIDWORD(v2) = 0; | |
0 | 4033 LODWORD(v2) = a2 >> 24; |
737 | 4034 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4035 v5 = v4 + 6.7553994e15; |
4036 v6 = LODWORD(v5); | |
737 | 4037 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4038 v8 = v7 + 6.7553994e15; |
4039 v9 = LOBYTE(v8); | |
737 | 4040 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4041 v11 = v10 + 6.7553994e15; |
737 | 4042 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4043 v13 = v12 + 6.7553994e15; |
737 | 4044 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4045 } |
4046 | |
4047 //----- (004A46E6) -------------------------------------------------------- | |
4048 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4049 { | |
4050 int v5; // eax@1 | |
4051 int z; // eax@1 | |
4052 unsigned int v7; // eax@9 | |
4053 unsigned int v8; // ecx@9 | |
4054 int v9; // eax@9 | |
4055 unsigned int v10; // eax@10 | |
4056 int *v11; // esi@10 | |
4057 int *v12; // edi@10 | |
4058 int v13; // ecx@10 | |
4059 int v14; // edx@10 | |
4060 unsigned int v15; // eax@22 | |
4061 int *v16; // esi@22 | |
4062 int *v17; // edi@22 | |
4063 int v18; // ecx@22 | |
4064 int v19; // edx@22 | |
4065 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4066 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4067 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4068 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4069 | |
4070 v5 = a4; | |
4071 v23 = _z >> 16; | |
4072 z = x + v5; | |
693 | 4073 if ( z >= (signed int)pViewport->uViewportTL_X |
4074 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4075 && y >= (signed int)pViewport->uViewportTL_Y | |
4076 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4077 { | |
4078 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4079 x = pViewport->uViewportTL_X; | |
4080 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4081 z = pViewport->uViewportBR_X; | |
0 | 4082 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4083 v22 = z - x; | |
4084 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4085 v7 = lightColor >> 3; | |
4086 v8 = lightColor & 0xF0; | |
4087 v9 = v7 & 0x1E0000; | |
4088 if ( pRenderer->uTargetGBits == 5 ) | |
4089 { | |
4090 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4091 v11 = (int *)pTarget; | |
4092 v12 = pTargetZ; | |
4093 v13 = v22; | |
4094 v14 = (v10 << 16) | v10; | |
4095 z = (unsigned __int8)pTarget & 2; | |
4096 if ( (unsigned __int8)pTarget & 2 ) | |
4097 { | |
4098 z = (unsigned int)*pTargetZ >> 16; | |
4099 if ( z > v23 ) | |
4100 { | |
4101 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4102 *pTarget = z; | |
4103 } | |
4104 v13 = v22 - 1; | |
4105 v11 = (int *)(pTarget + 1); | |
4106 v12 = pTargetZ + 1; | |
4107 } | |
4108 while ( v13 != 1 ) | |
4109 { | |
4110 if ( v13 < 1 ) | |
4111 return z; | |
4112 z = (unsigned int)*v12 >> 16; | |
4113 if ( z <= v23 ) | |
4114 { | |
4115 v13 -= 2; | |
4116 ++v11; | |
4117 v12 += 2; | |
4118 } | |
4119 else | |
4120 { | |
4121 v12 += 2; | |
4122 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4123 v13 -= 2; | |
4124 *v11 = z; | |
4125 ++v11; | |
4126 } | |
4127 } | |
4128 z = (unsigned int)*v12 >> 16; | |
4129 if ( z > v23 ) | |
4130 { | |
4131 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4132 *(short *)v11 = z; | |
4133 } | |
4134 } | |
4135 else | |
4136 { | |
4137 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4138 v16 = (int *)pTarget; | |
4139 v17 = pTargetZ; | |
4140 v18 = v22; | |
4141 v19 = (v15 << 16) | v15; | |
4142 z = (unsigned __int8)pTarget & 2; | |
4143 if ( (unsigned __int8)pTarget & 2 ) | |
4144 { | |
4145 z = (unsigned int)*pTargetZ >> 16; | |
4146 if ( z > v23 ) | |
4147 { | |
4148 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4149 *pTarget = z; | |
4150 } | |
4151 v18 = v22 - 1; | |
4152 v16 = (int *)(pTarget + 1); | |
4153 v17 = pTargetZ + 1; | |
4154 } | |
4155 while ( v18 != 1 ) | |
4156 { | |
4157 if ( v18 < 1 ) | |
4158 return z; | |
4159 z = (unsigned int)*v17 >> 16; | |
4160 if ( z <= v23 ) | |
4161 { | |
4162 v18 -= 2; | |
4163 ++v16; | |
4164 v17 += 2; | |
4165 } | |
4166 else | |
4167 { | |
4168 v17 += 2; | |
4169 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4170 v18 -= 2; | |
4171 *v16 = z; | |
4172 ++v16; | |
4173 } | |
4174 } | |
4175 z = (unsigned int)*v17 >> 16; | |
4176 if ( z > v23 ) | |
4177 { | |
4178 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4179 *(short *)v16 = z; | |
4180 } | |
4181 } | |
4182 } | |
4183 return z; | |
4184 } | |
4185 | |
4186 //----- (004A57E9) -------------------------------------------------------- | |
4187 void __cdecl Present_ColorKey() | |
4188 { | |
4189 HRESULT v0; // eax@3 | |
4190 HRESULT v1; // eax@3 | |
4191 HRESULT v2; // eax@3 | |
4192 HRESULT v3; // eax@3 | |
4193 HRESULT v4; // eax@3 | |
4194 RECT a2; // [sp+4h] [bp-14h]@3 | |
4195 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4196 | |
4197 if ( !pRenderer->uNumSceneBegins ) | |
4198 { | |
4199 if ( pRenderer->field_40110 ) | |
4200 { | |
693 | 4201 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4202 a2.left = 0; |
4203 a2.top = 0; | |
4204 a2.right = 640; | |
4205 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4206 a2.right = 640; | |
4207 a2.left = 0; | |
693 | 4208 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4209 a2.bottom = 480; |
4210 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4211 0, | |
693 | 4212 pViewport->uViewportBR_Y + 1, |
0 | 4213 pRenderer->pColorKeySurface4, |
4214 &a2, | |
4215 16u)); | |
693 | 4216 a2.right = pViewport->uViewportTL_X; |
4217 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4218 a2.left = 0; |
693 | 4219 a2.top = pViewport->uViewportTL_Y; |
0 | 4220 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4221 0, | |
693 | 4222 pViewport->uViewportTL_Y, |
0 | 4223 pRenderer->pColorKeySurface4, |
4224 &a2, | |
4225 16u)); | |
693 | 4226 a2.left = pViewport->uViewportBR_X; |
4227 a2.top = pViewport->uViewportTL_Y; | |
0 | 4228 a2.right = 640; |
693 | 4229 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4230 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4231 pViewport->uViewportBR_X, |
4232 pViewport->uViewportTL_Y, | |
0 | 4233 pRenderer->pColorKeySurface4, |
4234 &a2, | |
4235 16u)); | |
693 | 4236 a2.right = pViewport->uViewportBR_X; |
4237 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4238 a2.left = pViewport->uViewportTL_X; | |
4239 a2.top = pViewport->uViewportTL_Y; | |
0 | 4240 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4241 pViewport->uViewportTL_X, |
4242 pViewport->uViewportTL_Y, | |
0 | 4243 pRenderer->pColorKeySurface4, |
4244 &a2, | |
4245 17u)); | |
4246 } | |
4247 } | |
4248 } | |
4249 | |
4250 //----- (004A597D) -------------------------------------------------------- | |
4251 void Present_NoColorKey() | |
4252 { | |
4253 //unsigned __int16 *v0; // eax@4 | |
4254 unsigned __int16 *v1; // esi@4 | |
4255 void *v2; // edi@4 | |
4256 //signed int v4; // ebx@4 | |
4257 //signed int v5; // ebx@6 | |
4258 //void *v6; // edi@7 | |
4259 //const void *v7; // esi@7 | |
4260 signed int v8; // ebx@8 | |
4261 int v9; // eax@10 | |
4262 unsigned int v10; // esi@10 | |
4263 unsigned __int32 v11; // edi@10 | |
4264 //int v12; // ecx@10 | |
4265 unsigned int v13; // ebx@10 | |
4266 int v14; // eax@11 | |
4267 int v15; // eax@13 | |
4268 int v16; // eax@14 | |
4269 int v17; // eax@16 | |
4270 HRESULT v18; // eax@22 | |
4271 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4272 int v20; // [sp+88h] [bp-1Ch]@10 | |
4273 int v21; // [sp+8Ch] [bp-18h]@10 | |
4274 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4275 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4276 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4277 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4278 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4279 | |
4280 if ( !pRenderer->uNumSceneBegins ) | |
4281 { | |
4282 if ( pRenderer->field_40110 ) | |
4283 { | |
4284 memset(&Dst, 0, 0x7Cu); | |
4285 Dst.dwSize = 124; | |
168 | 4286 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4287 { |
4288 //v26 = Dst.lpSurface; | |
4289 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4290 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4291 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4292 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4293 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4294 v1 = pRenderer->pTargetSurface; | |
4295 v2 = Dst.lpSurface; | |
4296 | |
4297 | |
4298 /*for (uint y = 0; y < 480; ++y) | |
4299 { | |
4300 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4301 for (uint x = 0; x < 640; ++x) | |
4302 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4303 }*/ | |
4304 | |
4305 auto pSrc = pRenderer->pTargetSurface; | |
4306 auto pDst = (__int16 *)Dst.lpSurface; | |
4307 | |
4308 for (uint y = 0; y < 8; ++y) | |
4309 memcpy(pDst + y * Dst.lPitch / 2, | |
4310 | |
4311 pSrc + y * 640, 640 * sizeof(__int16)); | |
4312 | |
4313 for (uint y = 8; y < 352; ++y) | |
4314 { | |
4315 memcpy(pDst + y * Dst.lPitch / 2, | |
4316 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4317 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4318 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4319 } |
4320 | |
121 | 4321 for (uint y = 352; y < 480; ++y) |
0 | 4322 memcpy(pDst + y * Dst.lPitch / 2, |
4323 pSrc + y * 640, 640 * sizeof(__int16)); | |
4324 | |
4325 | |
693 | 4326 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4327 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4328 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4329 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4330 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4331 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4332 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4333 v21 = 4 * v9 + 1280; | |
4334 | |
121 | 4335 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4336 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4337 v10 = (int)pSrc_x1y1; | |
4338 v11 = (int)pDst_x1y1; | |
693 | 4339 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4340 v13 = v24; |
4341 | |
693 | 4342 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4343 { |
4344 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4345 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4346 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4347 { |
4348 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4349 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4350 } | |
4351 } | |
4352 | |
4353 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4354 | |
4355 /* while ( 1 ) | |
4356 { | |
4357 while ( 1 ) | |
4358 { | |
4359 v14 = *(int *)v10; | |
4360 v10 += 4; | |
4361 if ( v14 == v13 ) | |
4362 break; | |
4363 if ( (short)v14 == (short)v13 ) | |
4364 { | |
4365 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4366 v11 += 4; | |
4367 --uHalfWidth; | |
4368 if ( !uHalfWidth ) | |
4369 goto LABEL_21; | |
4370 } | |
4371 else | |
4372 { | |
4373 v15 = __ROL__(v14, 16); | |
4374 if ( (short)v15 == (short)v13 ) | |
4375 { | |
4376 v17 = __ROR__(v15, 16); | |
4377 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4378 v11 += 4; | |
4379 --uHalfWidth; | |
4380 if ( !uHalfWidth ) | |
4381 goto LABEL_21; | |
4382 } | |
4383 else | |
4384 { | |
4385 v16 = __ROR__(v15, 16); | |
4386 *(int *)v11 = v16; | |
4387 v11 += 4; | |
4388 --uHalfWidth; | |
4389 if ( !uHalfWidth ) | |
4390 goto LABEL_21; | |
4391 } | |
4392 } | |
4393 } | |
4394 v11 += 4; | |
4395 --uHalfWidth; | |
4396 if ( !uHalfWidth ) | |
4397 { | |
4398 LABEL_21: | |
4399 v10 += v21; | |
4400 v11 += v22; | |
4401 uHalfWidth = v20; | |
4402 if ( !--uNumLines ) | |
4403 { | |
4404 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4405 return; | |
4406 } | |
4407 } | |
4408 }*/ | |
4409 } | |
4410 } | |
4411 } | |
4412 } | |
4413 | |
4414 //----- (004A7063) -------------------------------------------------------- | |
4415 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4416 { | |
4417 float v2; // ST1C_4@1 | |
4418 double v3; // ST14_8@1 | |
4419 signed int v4; // ebx@1 | |
4420 float v5; // ST1C_4@1 | |
4421 double v6; // ST14_8@1 | |
4422 signed int v7; // edi@1 | |
4423 double v8; // ST0C_8@1 | |
4424 signed int v9; // esi@1 | |
4425 signed int v10; // ecx@1 | |
4426 double v12; // [sp+8h] [bp-18h]@1 | |
4427 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4428 | |
4429 v2 = (double)(uDiffuse >> 24) * a2; | |
4430 v3 = v2 + 6.7553994e15; | |
4431 v4 = LODWORD(v3); | |
4432 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4433 v6 = v5 + 6.7553994e15; | |
4434 v7 = LODWORD(v6); | |
4435 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4436 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4437 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4438 v9 = LODWORD(v8); | |
4439 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4440 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4441 v10 = LODWORD(v12); | |
4442 if ( v4 > 255 ) | |
4443 v4 = 255; | |
4444 if ( v4 < 0 ) | |
4445 v4 = 0; | |
4446 if ( SHIDWORD(v13) > 255 ) | |
4447 v7 = 255; | |
4448 if ( v7 < 0 ) | |
4449 v7 = 0; | |
4450 if ( (signed int)v13 > 255 ) | |
4451 v9 = 255; | |
4452 if ( v9 < 0 ) | |
4453 v9 = 0; | |
4454 if ( SLODWORD(v12) > 255 ) | |
4455 v10 = 255; | |
4456 if ( v10 < 0 ) | |
4457 v10 = 0; | |
4458 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4459 } | |
4460 | |
4461 //----- (004AD504) -------------------------------------------------------- | |
711 | 4462 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4463 { |
4464 int result; // eax@1 | |
711 | 4465 signed int v2; // ebx@1 |
0 | 4466 BLVFace *v3; // esi@3 |
4467 Texture *v4; // edi@6 | |
4468 int v5; // eax@7 | |
4469 int v6; // edx@7 | |
4470 int v7; // ecx@7 | |
4471 int v8; // ebx@8 | |
4472 int v9; // eax@8 | |
4473 int v10; // ebx@8 | |
4474 unsigned int v11; // ebx@9 | |
4475 int v12; // esi@10 | |
4476 int v13; // eax@13 | |
4477 unsigned __int16 *v14; // eax@13 | |
4478 unsigned int v15; // eax@14 | |
4479 unsigned __int16 *v16; // ebx@14 | |
4480 int v17; // eax@15 | |
4481 int v18; // ebx@15 | |
4482 int v19; // esi@15 | |
4483 int v20; // ecx@15 | |
4484 int v21; // eax@15 | |
4485 stru193_math *v22; // ebx@15 | |
4486 int v23; // eax@15 | |
4487 char *v24; // esi@16 | |
4488 int v25; // eax@18 | |
4489 int v26; // eax@18 | |
4490 int v27; // eax@20 | |
4491 signed int v28; // esi@20 | |
4492 signed int v29; // edx@20 | |
4493 signed int v30; // esi@20 | |
4494 signed int v31; // edi@20 | |
4495 int v32; // esi@20 | |
4496 int v33; // eax@26 | |
4497 int *v34; // esi@27 | |
4498 unsigned __int16 *v35; // edi@27 | |
4499 unsigned int v36; // edx@27 | |
4500 int v37; // ebx@27 | |
4501 char v38; // cl@27 | |
4502 char v39; // ch@27 | |
4503 int v40; // ebx@29 | |
4504 int v41; // edx@29 | |
4505 unsigned int v42; // ebx@30 | |
4506 int v43; // edx@30 | |
4507 int v44; // eax@33 | |
4508 int *v45; // esi@34 | |
4509 unsigned __int16 *v46; // edi@34 | |
4510 unsigned int v47; // edx@34 | |
4511 int v48; // ebx@34 | |
4512 char v49; // cl@34 | |
4513 char v50; // ch@34 | |
4514 int v51; // ebx@36 | |
4515 int v52; // edx@36 | |
4516 unsigned __int16 v53; // bx@37 | |
4517 int v54; // edx@37 | |
4518 int v55; // eax@40 | |
4519 int v56; // eax@41 | |
4520 int *v57; // esi@42 | |
4521 unsigned __int16 *v58; // edi@42 | |
4522 unsigned int v59; // edx@42 | |
4523 int v60; // ebx@42 | |
4524 char v61; // cl@42 | |
4525 char v62; // ch@42 | |
4526 unsigned int v63; // ebx@44 | |
4527 int v64; // edx@44 | |
4528 unsigned int v65; // ebx@44 | |
4529 int v66; // edx@44 | |
4530 unsigned int v67; // ebx@45 | |
4531 int v68; // edx@45 | |
4532 int v69; // ebx@45 | |
4533 int v70; // edx@45 | |
4534 int v71; // eax@48 | |
4535 int *v72; // esi@49 | |
4536 unsigned __int16 *v73; // edi@49 | |
4537 unsigned int v74; // edx@49 | |
4538 int v75; // ebx@49 | |
4539 char v76; // cl@49 | |
4540 char v77; // ch@49 | |
4541 unsigned int v78; // ebx@51 | |
4542 int v79; // edx@51 | |
4543 unsigned int v80; // ebx@51 | |
4544 int v81; // edx@51 | |
4545 unsigned int v82; // ebx@52 | |
4546 int v83; // edx@52 | |
4547 int v84; // ebx@52 | |
4548 int v85; // edx@52 | |
4549 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4550 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4551 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4552 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4553 int v90; // [sp+1Ch] [bp-88h]@20 | |
4554 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4555 int v92; // [sp+24h] [bp-80h]@7 | |
4556 int i; // [sp+28h] [bp-7Ch]@7 | |
4557 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4558 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4559 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4560 int v97; // [sp+38h] [bp-6Ch]@15 | |
4561 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4562 int v99; // [sp+40h] [bp-64h]@9 | |
4563 int v100; // [sp+44h] [bp-60h]@24 | |
4564 int v101; // [sp+48h] [bp-5Ch]@10 | |
4565 int v102; // [sp+4Ch] [bp-58h]@20 | |
4566 int v103; // [sp+50h] [bp-54h]@20 | |
4567 int v104; // [sp+54h] [bp-50h]@9 | |
4568 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4569 int v106; // [sp+5Ch] [bp-48h]@24 | |
4570 int v107; // [sp+60h] [bp-44h]@20 | |
4571 int v108; // [sp+64h] [bp-40h]@20 | |
4572 int v109; // [sp+68h] [bp-3Ch]@20 | |
4573 int v110; // [sp+6Ch] [bp-38h]@15 | |
4574 int v111; // [sp+70h] [bp-34h]@20 | |
4575 int a1; // [sp+74h] [bp-30h]@12 | |
4576 int a2; // [sp+78h] [bp-2Ch]@9 | |
4577 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4578 int v115; // [sp+80h] [bp-24h]@18 | |
4579 int v116; // [sp+84h] [bp-20h]@7 | |
4580 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4581 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4582 int *v119; // [sp+90h] [bp-14h]@13 | |
4583 int v120; // [sp+94h] [bp-10h]@15 | |
4584 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4585 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4586 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4587 | |
4588 result = pRenderer->uTargetSurfacePitch; | |
711 | 4589 v2 = sFaceID; |
0 | 4590 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4591 if ( sFaceID >= 0 ) |
4592 { | |
4593 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4594 { | |
4595 v3 = &pIndoor->pFaces[sFaceID]; | |
4596 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4597 if ( !pRenderer->pRenderD3D ) |
4598 { | |
711 | 4599 result = sub_423B5D(sFaceID); |
0 | 4600 if ( result ) |
4601 { | |
4602 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4603 if ( result ) | |
4604 { | |
4605 result = (int)v3->GetTexture(); | |
4606 v4 = (Texture *)result; | |
4607 v96 = (Texture *)result; | |
4608 if ( result ) | |
4609 { | |
4610 v5 = *(short *)(result + 38); | |
4611 LOBYTE(v3->uAttributes) |= 0x80u; | |
4612 v92 = v5; | |
4613 sub_4AE5F1(v2); | |
4614 ++pBLVRenderParams->field_84; | |
4615 v6 = stru_F8AD28.pDeltaUV[0]; | |
4616 v116 = stru_F8AD28.pDeltaUV[1]; | |
4617 v7 = 0; | |
4618 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4619 { | |
4620 v8 = v116; | |
4621 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4622 v9 = 4 * v7 + 16297672; | |
4623 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4624 } | |
4625 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4626 result = stru_F8A590._viewport_space_y; | |
4627 a2 = stru_F8A590._viewport_space_y; | |
4628 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4629 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4630 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4631 v87 = v4->pLevelOfDetail1; |
4632 v88 = v4->pLevelOfDetail2; | |
4633 v89 = v4->pLevelOfDetail3; | |
4634 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4635 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4636 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4637 { | |
4638 v12 = 2 * stru_F8A590._viewport_space_y; | |
4639 v101 = 2 * stru_F8A590._viewport_space_y; | |
4640 while ( 1 ) | |
4641 { | |
4642 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4643 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4644 if ( LOBYTE(viewparams->field_20) ) | |
4645 { | |
4646 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4647 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4648 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4649 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4650 - pBLVRenderParams->uViewportX]; | |
4651 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4652 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4653 - pBLVRenderParams->uViewportX]; | |
4654 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4655 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4656 - pBLVRenderParams->uViewportX]; | |
4657 v123 = (unsigned int)v16; | |
4658 } | |
4659 else | |
4660 { | |
4661 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4662 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4663 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4664 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4665 } | |
4666 v117 = (unsigned int)v14; | |
4667 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4668 v18 = stru_F81018.field_0.field_10; | |
4669 LOWORD(v17) = 0; | |
4670 v97 = stru_F8AD28.field_0 | v17; | |
4671 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4672 v19 = stru_F81018.field_0.field_4 >> i; | |
4673 v20 = 11 - v18; | |
4674 v116 = stru_F81018.field_0.field_8 >> i; | |
4675 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4676 v22 = stru_5C6E00; | |
4677 v122 = (unsigned __int16 *)v20; | |
323 | 4678 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4679 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4680 v120 = v116 + 4 * v23; |
4681 if ( v123 < v117 ) | |
4682 { | |
4683 v24 = (char *)&stru_F81018.field_34.field_8; | |
4684 v114 = &stru_F81018.field_34.field_8; | |
4685 a1 += 16; | |
4686 while ( 1 ) | |
4687 { | |
4688 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4689 v25 = *((int *)v24 - 2); | |
4690 LOWORD(v25) = 0; | |
4691 v115 = v97; | |
4692 v26 = stru_F8AD28.field_0 | v25; | |
4693 if ( v97 <= (unsigned int)v26 ) | |
4694 v115 = v26; | |
4695 v97 = v26; | |
4696 v27 = *((int *)v24 - 11); | |
4697 v28 = *((int *)v24 - 1); | |
4698 v105 = (&v86)[4 * v27]; | |
4699 v111 = v27 + 16; | |
4700 v29 = v4->uWidthMinus1; | |
4701 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4702 v107 = v29 >> v27; | |
4703 v30 = v28 >> i; | |
4704 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4705 v31 = *v114 >> i; | |
4706 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4707 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4708 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4709 v108 = (signed int)(v116 - v121) >> 4; |
4710 v103 = (v90 - v120) >> 4; | |
4711 v32 = v123 + 32; | |
4712 if ( LOBYTE(viewparams->field_20) ) | |
4713 v32 = v123 + 64; | |
4714 if ( v32 > v117 ) | |
4715 v32 = v117; | |
4716 v118 = v32; | |
4717 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4718 v106 = (signed int)(v32 - v123) >> 1; | |
4719 if ( v110 >> 16 == v100 >> 16 ) | |
4720 { | |
4721 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4722 if ( LOBYTE(viewparams->field_20) ) | |
4723 { | |
4724 v44 = v123; | |
4725 if ( v123 < v118 ) | |
4726 { | |
4727 v45 = v119; | |
4728 v46 = v122; | |
4729 v47 = v121; | |
4730 v48 = v120; | |
4731 v49 = v111; | |
4732 v50 = v109; | |
4733 if ( v106 & 2 ) | |
4734 { | |
4735 *v119 = v115; | |
4736 v45 -= 2; | |
4737 v44 = v123 + 4; | |
4738 goto LABEL_37; | |
4739 } | |
4740 do | |
4741 { | |
4742 v44 += 8; | |
4743 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4744 v52 = v115; | |
4745 LOWORD(v51) = v46[v51]; | |
4746 *v45 = v115; | |
4747 v45[1] = v52; | |
4748 v45[640] = v52; | |
4749 v45[641] = v52; | |
4750 *(short *)(v44 - 8) = v51; | |
4751 *(short *)(v44 - 6) = v51; | |
4752 *(short *)(v44 + 1272) = v51; | |
4753 *(short *)(v44 + 1274) = v51; | |
4754 v45[2] = v52; | |
4755 v45[3] = v52; | |
4756 v45[642] = v52; | |
4757 v45[643] = v52; | |
4758 v121 += v108; | |
4759 v120 += v103; | |
4760 v47 = v121; | |
4761 v48 = v120; | |
4762 LABEL_37: | |
4763 v45 += 4; | |
4764 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4765 v54 = v108; | |
4766 *(short *)(v44 - 4) = v53; | |
4767 *(short *)(v44 - 2) = v53; | |
4768 *(short *)(v44 + 1276) = v53; | |
4769 *(short *)(v44 + 1278) = v53; | |
4770 v121 += v54; | |
4771 v120 += v103; | |
4772 v47 = v121; | |
4773 v48 = v120; | |
4774 } | |
4775 while ( v44 < v118 ); | |
4776 v123 = v44; | |
4777 v119 = v45; | |
4778 } | |
4779 } | |
4780 else | |
4781 { | |
4782 v33 = v123; | |
4783 if ( v123 < v118 ) | |
4784 { | |
4785 v34 = v119; | |
4786 v35 = v122; | |
4787 v36 = v121; | |
4788 v37 = v120; | |
4789 v38 = v111; | |
4790 v39 = v109; | |
4791 if ( v106 & 1 ) | |
4792 { | |
4793 *v119 = v115; | |
4794 --v34; | |
4795 v33 = v123 + 2; | |
4796 goto LABEL_30; | |
4797 } | |
4798 do | |
4799 { | |
4800 v33 += 4; | |
4801 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4802 v41 = v115; | |
4803 LOWORD(v40) = v35[v40]; | |
4804 *v34 = v115; | |
4805 *(short *)(v33 - 4) = v40; | |
4806 v34[1] = v41; | |
4807 v121 += v108; | |
4808 v120 += v103; | |
4809 v36 = v121; | |
4810 v37 = v120; | |
4811 LABEL_30: | |
4812 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4813 v34 += 2; | |
4814 v43 = v108; | |
4815 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4816 v121 += v43; | |
4817 v120 += v103; | |
4818 v36 = v121; | |
4819 v37 = v120; | |
4820 } | |
4821 while ( v33 < v118 ); | |
4822 v123 = v33; | |
4823 v119 = v34; | |
4824 } | |
4825 } | |
4826 } | |
4827 else | |
4828 { | |
4829 v55 = v110 - ((v100 - v110) >> 4); | |
4830 v110 = (v100 - v110) >> 4; | |
4831 v122 = (unsigned __int16 *)v55; | |
4832 if ( LOBYTE(viewparams->field_20) ) | |
4833 { | |
4834 v71 = v123; | |
4835 if ( v123 < v118 ) | |
4836 { | |
4837 v72 = v119; | |
4838 v73 = v94; | |
4839 v74 = v121; | |
4840 v75 = v120; | |
4841 v76 = v111; | |
4842 v77 = v109; | |
4843 if ( v106 & 2 ) | |
4844 { | |
4845 *v119 = v115; | |
4846 v72 += 2; | |
4847 v71 = v123 + 4; | |
4848 goto LABEL_52; | |
4849 } | |
4850 do | |
4851 { | |
4852 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4853 v79 = (int)((char *)v122 + v110); | |
4854 v71 += 8; | |
4855 v122 = (unsigned __int16 *)v79; | |
4856 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4857 v81 = v115; | |
4858 LOWORD(v80) = v73[v80]; | |
4859 *v72 = v115; | |
4860 v72[1] = v81; | |
4861 v72[640] = v81; | |
4862 v72[641] = v81; | |
4863 *(short *)(v71 - 8) = v80; | |
4864 *(short *)(v71 - 6) = v80; | |
4865 *(short *)(v71 + 1272) = v80; | |
4866 *(short *)(v71 + 1274) = v80; | |
4867 v72[2] = v81; | |
4868 v72[3] = v81; | |
4869 v72[642] = v81; | |
4870 v72[643] = v81; | |
4871 v121 += v108; | |
4872 v120 += v103; | |
4873 v74 = v121; | |
4874 v75 = v120; | |
4875 v72 += 4; | |
4876 LABEL_52: | |
4877 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4878 v83 = (int)((char *)v122 + v110); | |
4879 v84 = v105[v82]; | |
4880 v122 = (unsigned __int16 *)v83; | |
4881 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4882 v85 = v108; | |
4883 *(short *)(v71 - 4) = v84; | |
4884 *(short *)(v71 - 2) = v84; | |
4885 *(short *)(v71 + 1276) = v84; | |
4886 *(short *)(v71 + 1278) = v84; | |
4887 v121 += v85; | |
4888 v120 += v103; | |
4889 v74 = v121; | |
4890 v75 = v120; | |
4891 } | |
4892 while ( v71 < v118 ); | |
4893 v123 = v71; | |
4894 v119 = v72; | |
4895 } | |
4896 } | |
4897 else | |
4898 { | |
4899 v56 = v123; | |
4900 if ( v123 < v118 ) | |
4901 { | |
4902 v57 = v119; | |
4903 v58 = v94; | |
4904 v59 = v121; | |
4905 v60 = v120; | |
4906 v61 = v111; | |
4907 v62 = v109; | |
4908 if ( v106 & 1 ) | |
4909 { | |
4910 *v119 = v115; | |
4911 ++v57; | |
4912 v56 = v123 + 2; | |
4913 goto LABEL_45; | |
4914 } | |
4915 do | |
4916 { | |
4917 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4918 v64 = (int)((char *)v122 + v110); | |
4919 v56 += 4; | |
4920 v122 = (unsigned __int16 *)v64; | |
4921 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4922 v66 = v115; | |
4923 LOWORD(v65) = v58[v65]; | |
4924 *v57 = v115; | |
4925 *(short *)(v56 - 4) = v65; | |
4926 v57[1] = v66; | |
4927 v121 += v108; | |
4928 v120 += v103; | |
4929 v59 = v121; | |
4930 v60 = v120; | |
4931 v57 += 2; | |
4932 LABEL_45: | |
4933 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4934 v68 = (int)((char *)v122 + v110); | |
4935 v69 = v105[v67]; | |
4936 v122 = (unsigned __int16 *)v68; | |
4937 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4938 v70 = v108; | |
4939 *(short *)(v56 - 2) = v69; | |
4940 v121 += v70; | |
4941 v120 += v103; | |
4942 v59 = v121; | |
4943 v60 = v120; | |
4944 } | |
4945 while ( v56 < v118 ); | |
4946 v123 = v56; | |
4947 v119 = v57; | |
4948 } | |
4949 } | |
4950 } | |
4951 v114 += 13; | |
4952 v110 = v100; | |
4953 a1 += 16; | |
4954 v4 = v96; | |
4955 v121 = v116; | |
4956 v120 = v90; | |
4957 if ( v123 >= v117 ) | |
4958 break; | |
4959 v24 = (char *)v114; | |
4960 v22 = stru_5C6E00; | |
4961 } | |
4962 } | |
4963 ++a2; | |
4964 v98 += v95; | |
4965 result = a2; | |
4966 v101 += 2; | |
4967 v99 += 640; | |
4968 if ( a2 > stru_F8A590._viewport_space_w ) | |
4969 break; | |
4970 v12 = v101; | |
4971 result = a2; | |
4972 v11 = v98; | |
4973 } | |
4974 } | |
4975 } | |
4976 } | |
4977 } | |
4978 } | |
4979 } | |
4980 } | |
4981 return result; | |
4982 } | |
4983 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4984 | |
4985 //----- (004ADD1D) -------------------------------------------------------- | |
4986 void __fastcall sub_4ADD1D(int uFaceID) | |
4987 { | |
4988 int v1; // edi@1 | |
4989 BLVFace *v2; // esi@3 | |
4990 signed int v3; // ebx@4 | |
4991 Texture *v4; // edi@9 | |
4992 signed int v5; // eax@9 | |
4993 char *v6; // edi@12 | |
4994 signed int v7; // eax@15 | |
4995 unsigned int v8; // eax@16 | |
4996 __int16 v9; // cx@19 | |
4997 unsigned __int8 *v10; // eax@19 | |
4998 unsigned __int16 *v11; // eax@19 | |
4999 int v12; // edi@19 | |
5000 int v13; // ebx@20 | |
5001 stru352 *v14; // esi@20 | |
5002 DWORD v15; // eax@22 | |
5003 signed int v16; // ecx@22 | |
5004 signed int v17; // ST68_4@22 | |
5005 int v18; // eax@22 | |
5006 int v19; // ecx@22 | |
5007 unsigned int v20; // esi@23 | |
5008 int v21; // edi@23 | |
5009 int v22; // eax@23 | |
5010 int *v23; // ebx@24 | |
5011 int v24; // edx@24 | |
5012 int v25; // ebx@25 | |
5013 unsigned __int16 v26; // cx@25 | |
5014 int v27; // edx@26 | |
5015 unsigned __int16 v28; // cx@26 | |
5016 unsigned __int8 v29; // sf@27 | |
5017 unsigned __int8 v30; // of@27 | |
5018 unsigned int v31; // esi@29 | |
5019 int v32; // edi@29 | |
5020 unsigned __int16 *v33; // eax@29 | |
5021 int *v34; // ebx@30 | |
5022 int v35; // edx@30 | |
5023 int v36; // ebx@31 | |
5024 unsigned __int16 v37; // cx@31 | |
5025 int v38; // edx@32 | |
5026 unsigned __int16 v39; // cx@32 | |
5027 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5028 int v41; // [sp-Ch] [bp-68h]@15 | |
5029 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5030 signed int v43; // [sp+14h] [bp-48h]@12 | |
5031 signed int v44; // [sp+14h] [bp-48h]@22 | |
5032 int v45; // [sp+1Ch] [bp-40h]@22 | |
5033 int v46; // [sp+20h] [bp-3Ch]@22 | |
5034 int v47; // [sp+24h] [bp-38h]@19 | |
5035 char v48; // [sp+28h] [bp-34h]@19 | |
5036 int v49; // [sp+2Ch] [bp-30h]@19 | |
5037 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5038 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5039 int v52; // [sp+38h] [bp-24h]@22 | |
5040 int v53; // [sp+3Ch] [bp-20h]@22 | |
5041 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5042 int v55; // [sp+40h] [bp-1Ch]@20 | |
5043 int v56; // [sp+44h] [bp-18h]@20 | |
5044 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5045 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5046 int v59; // [sp+50h] [bp-Ch]@4 | |
5047 int v60; // [sp+50h] [bp-Ch]@19 | |
5048 int v61; // [sp+54h] [bp-8h]@22 | |
5049 int *v62; // [sp+58h] [bp-4h]@23 | |
5050 int *v63; // [sp+58h] [bp-4h]@29 | |
5051 | |
5052 v1 = uFaceID; | |
5053 v42 = pRenderer->uTargetSurfacePitch; | |
5054 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5055 { | |
5056 v2 = &pIndoor->pFaces[uFaceID]; | |
5057 if ( pRenderer->pRenderD3D ) | |
5058 { | |
5059 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5060 v59 = v3; | |
5061 } | |
5062 else | |
5063 { | |
5064 v59 = sub_423B5D(uFaceID); | |
5065 v3 = v59; | |
5066 } | |
5067 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5068 { | |
5069 v4 = v2->GetTexture(); | |
5070 v5 = 0; | |
5071 if ( v4 ) | |
5072 { | |
5073 if ( pRenderer->pRenderD3D ) | |
5074 { | |
5075 if ( v3 > 0 ) | |
5076 { | |
5077 v54 = v3; | |
5078 v43 = v3; | |
5079 v6 = (char *)&array_507D30[0].v; | |
5080 do | |
5081 { | |
5082 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5083 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5084 v6 += 48; | |
5085 --v54; | |
5086 } | |
5087 while ( v54 ); | |
5088 v3 = v59; | |
5089 v5 = v43; | |
5090 } | |
5091 v7 = v5; | |
5092 v41 = stru_F8AD28.field_0; | |
5093 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5094 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5095 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5096 { | |
5097 v40 = v2->GetTexture(); | |
5098 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5099 } | |
5100 else | |
5101 { | |
5102 v40 = v2->GetTexture(); | |
5103 v8 = v2->uBitmapID; | |
5104 } | |
5105 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5106 } | |
5107 else | |
5108 { | |
5109 v49 = v4->uWidthMinus1; | |
5110 v47 = v4->uHeightMinus1 << 16; | |
5111 v9 = 16 - v4->uWidthLn2; | |
710 | 5112 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5113 LOBYTE(v2->uAttributes) |= 0x80u; |
5114 v48 = v9; | |
5115 v50 = v10; | |
5116 sub_4AF412(); | |
5117 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5118 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5119 v12 = stru_F8A590._viewport_space_y; | |
5120 v51 = v11; | |
5121 v60 = stru_F8A590._viewport_space_y; | |
5122 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5123 { | |
5124 v13 = 2 * stru_F8A590._viewport_space_y; | |
5125 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5126 v55 = 2 * stru_F8A590._viewport_space_y; | |
5127 v56 = 640 * stru_F8A590._viewport_space_y; | |
5128 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5129 { | |
5130 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5131 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5132 v15 = GetTickCount(); | |
5133 v16 = v14->field_0; | |
5134 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5135 v45 = v14->field_4 >> 3; | |
5136 v44 = v16 >> 3; | |
5137 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5138 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5139 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5140 v18 = v14->field_28; | |
5141 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5142 LOWORD(v18) = 0; | |
5143 v46 = stru_F8AD28.field_0 | v18; | |
5144 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5145 if ( LOBYTE(viewparams->field_20) ) | |
5146 { | |
5147 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5148 - pBLVRenderParams->uViewportX]; | |
5149 v31 = v44; | |
5150 v32 = v45; | |
5151 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5152 + 2 * v19 | |
5153 - pBLVRenderParams->uViewportX]; | |
5154 if ( v61 & 1 ) | |
5155 { | |
5156 --v61; | |
5157 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5158 + 2 * v19 | |
5159 - pBLVRenderParams->uViewportX | |
5160 - 2]; | |
5161 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5162 - pBLVRenderParams->uViewportX]; | |
5163 v35 = v46; | |
5164 v63 += 2; | |
5165 goto LABEL_32; | |
5166 } | |
5167 while ( 1 ) | |
5168 { | |
5169 v30 = __OFSUB__(v61, 2); | |
5170 v29 = v61 - 2 < 0; | |
5171 v61 -= 2; | |
5172 if ( v29 ^ v30 ) | |
5173 break; | |
5174 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5175 v31 += v52; | |
5176 v37 = v51[v36]; | |
5177 v32 += v53; | |
5178 v34 = v63; | |
5179 v35 = v46; | |
5180 *v33 = v37; | |
5181 v33[1] = v37; | |
5182 v33[640] = v37; | |
5183 v33[641] = v37; | |
5184 v63 += 4; | |
5185 v34[2] = v46; | |
5186 v34[3] = v46; | |
5187 v34[642] = v46; | |
5188 v34[643] = v46; | |
5189 LABEL_32: | |
5190 *v34 = v35; | |
5191 v34[1] = v35; | |
5192 v34[640] = v35; | |
5193 v34[641] = v35; | |
5194 v38 = v49 & (v31 >> 16); | |
5195 v33 += 4; | |
5196 v31 += v52; | |
5197 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5198 v32 += v53; | |
5199 *(v33 - 2) = v39; | |
5200 *(v33 - 1) = v39; | |
5201 v33[638] = v39; | |
5202 v33[639] = v39; | |
5203 } | |
5204 } | |
5205 else | |
5206 { | |
5207 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5208 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5209 v20 = v44; | |
5210 v21 = v45; | |
5211 v22 = (int)v58; | |
5212 if ( v61 & 1 ) | |
5213 { | |
5214 --v61; | |
5215 v22 = (int)(v58 - 1); | |
5216 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5217 v24 = v46; | |
5218 ++v62; | |
5219 goto LABEL_26; | |
5220 } | |
5221 while ( 1 ) | |
5222 { | |
5223 v30 = __OFSUB__(v61, 2); | |
5224 v29 = v61 - 2 < 0; | |
5225 v61 -= 2; | |
5226 if ( v29 ^ v30 ) | |
5227 break; | |
5228 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5229 v20 += v52; | |
5230 v26 = v51[v25]; | |
5231 v21 += v53; | |
5232 v23 = v62; | |
5233 v24 = v46; | |
5234 *(short *)v22 = v26; | |
5235 v62 += 2; | |
5236 v23[1] = v46; | |
5237 LABEL_26: | |
5238 *v23 = v24; | |
5239 v27 = v49 & (v20 >> 16); | |
5240 v22 += 4; | |
5241 v20 += v52; | |
5242 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5243 v21 += v53; | |
5244 *(short *)(v22 - 2) = v28; | |
5245 } | |
5246 } | |
5247 ++v60; | |
5248 ++i; | |
5249 v56 += 640; | |
5250 v55 += 2; | |
5251 if ( v60 > stru_F8A590._viewport_space_w ) | |
5252 break; | |
5253 v13 = v55; | |
5254 v12 = v60; | |
5255 } | |
5256 } | |
5257 } | |
5258 } | |
5259 } | |
5260 } | |
5261 } | |
5262 | |
5263 //----- (004AE1E7) -------------------------------------------------------- | |
5264 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5265 { | |
5266 int v3; // ebx@1 | |
5267 int v4; // edi@1 | |
5268 int v5; // esi@1 | |
5269 signed __int64 v6; // qtt@3 | |
5270 int v7; // esi@3 | |
5271 int v8; // eax@5 | |
5272 int result; // eax@5 | |
5273 int v10; // edx@5 | |
5274 int v11; // [sp+Ch] [bp-8h]@1 | |
5275 int v12; // [sp+1Ch] [bp+8h]@2 | |
5276 | |
5277 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5278 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5279 v11 = a1; | |
5280 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5281 + stru_F8AD28.field_7C | |
5282 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5283 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5284 { | |
5285 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5286 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5287 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5288 } | |
5289 else | |
5290 { | |
5291 v7 = 1073741824; | |
5292 } | |
5293 v8 = stru_F8AD28.vec_9C.z; | |
5294 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5295 + stru_F8AD28.vec_8C.x | |
5296 + v4 * stru_F8AD28.vec_8C.y) | |
5297 * (signed __int64)v7) >> 16) | |
5298 + stru_F8AD28.field_98; | |
5299 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5300 v10 = result + stru_F8AD28.field_A8; | |
5301 stru_F83B80[v11].field_28 = v7; | |
5302 stru_F83B80[v11].field_4 = v10; | |
5303 return result; | |
5304 } | |
5305 | |
5306 //----- (004AE313) -------------------------------------------------------- | |
5307 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5308 { | |
5309 int _dy; // ebx@1 | |
5310 int _dx; // edi@1 | |
5311 int v5; // ecx@1 | |
5312 int v6; // esi@1 | |
5313 int v7; // ST18_4@2 | |
5314 signed __int64 v8; // qtt@3 | |
5315 unsigned int v9; // ecx@3 | |
5316 int result; // eax@8 | |
5317 int v11; // [sp+Ch] [bp-8h]@1 | |
5318 | |
5319 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5320 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5321 ++pBLVRenderParams->field_88; | |
5322 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5323 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5324 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5325 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5326 { | |
5327 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5328 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5329 v9 = v8 / v11; | |
5330 } | |
5331 else | |
5332 { | |
5333 v9 = 0x40000000u; | |
5334 } | |
5335 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5336 p->field_0 = v9; | |
5337 else | |
5338 p->field_0 = stru_F8AD28.field_34; | |
5339 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5340 * (signed __int64)(signed int)v9) >> 16) | |
5341 + stru_F8AD28.field_98 | |
5342 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5343 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5344 * (signed __int64)(signed int)v9) >> 16) | |
5345 + stru_F8AD28.field_A8 | |
5346 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5347 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5348 if ( result < 369620 || bUseLoResSprites ) | |
5349 { | |
5350 if ( result < 184810 ) | |
5351 p->field_10 = result > 92405; | |
5352 else | |
5353 p->field_10 = 2; | |
5354 } | |
5355 else | |
5356 { | |
5357 p->field_10 = 3; | |
5358 } | |
5359 return result; | |
5360 } | |
5361 | |
5362 //----- (004AE491) -------------------------------------------------------- | |
5363 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5364 { | |
5365 signed int v2; // eax@1 | |
5366 signed int v3; // edi@1 | |
5367 int v4; // ecx@1 | |
5368 int v5; // esi@2 | |
5369 int v6; // eax@2 | |
5370 int v7; // ebx@2 | |
5371 unsigned int v8; // ecx@2 | |
5372 int v9; // edx@5 | |
5373 int v10; // edx@7 | |
5374 unsigned int v11; // eax@8 | |
5375 int v13; // [sp+4h] [bp-18h]@2 | |
5376 int v14; // [sp+8h] [bp-14h]@2 | |
5377 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5378 int v16; // [sp+14h] [bp-8h]@1 | |
5379 int v17; // [sp+18h] [bp-4h]@1 | |
5380 | |
5381 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5382 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5383 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5384 v4 = 0; | |
5385 v15 = v2; | |
5386 v16 = 0; | |
5387 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5388 { | |
5389 do | |
5390 { | |
5391 v5 = v16; | |
5392 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5393 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5394 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5395 v7 = v13; | |
5396 v8 = v14; | |
5397 if ( v6 < v13 ) | |
5398 { | |
5399 v6 = v13; | |
5400 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5401 } | |
5402 if ( v6 < v14 ) | |
5403 { | |
5404 v9 = v6; | |
5405 v6 = v14; | |
5406 v8 = v9; | |
5407 } | |
5408 if ( v7 < (signed int)v8 ) | |
5409 { | |
5410 v10 = v8; | |
5411 v8 = v7; | |
5412 v7 = v10; | |
5413 } | |
5414 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5415 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5416 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5417 ++v16; | |
5418 v2 = v15; | |
5419 } | |
5420 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5421 v4 = 0; | |
5422 } | |
5423 if ( stru_F8AD28.field_3E4 != v4 ) | |
5424 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5425 if ( v17 >= v4 ) | |
5426 { | |
5427 if ( v17 > 2031616 ) | |
5428 v17 = 2031616; | |
5429 } | |
5430 else | |
5431 { | |
5432 v17 = v4; | |
5433 } | |
5434 ++pBLVRenderParams->field_8C; | |
5435 return v17; | |
5436 } | |
5437 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5438 | |
5439 //----- (004AE5F1) -------------------------------------------------------- | |
5440 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5441 { | |
5442 BLVFace *v1; // esi@1 | |
5443 BLVFaceExtra *v2; // ebx@1 | |
5444 int v3; // eax@1 | |
5445 int v4; // edi@1 | |
5446 Texture *v5; // edi@1 | |
5447 int v6; // eax@1 | |
5448 unsigned int v7; // eax@1 | |
5449 unsigned int v8; // ecx@1 | |
5450 unsigned int v9; // eax@1 | |
5451 unsigned int v10; // ecx@5 | |
5452 int v11; // edi@10 | |
5453 int v12; // ecx@10 | |
5454 int v13; // eax@10 | |
5455 int v14; // edx@10 | |
5456 int v15; // ebx@12 | |
5457 double v16; // st7@16 | |
5458 int v17; // eax@16 | |
5459 char *v18; // ebx@17 | |
5460 int v19; // ecx@19 | |
5461 int v20; // eax@19 | |
5462 int v21; // edx@21 | |
5463 int v22; // eax@23 | |
5464 int v23; // ST04_4@26 | |
5465 int v24; // edi@26 | |
5466 double v25; // st6@26 | |
5467 int v26; // eax@26 | |
5468 double v27; // st6@26 | |
5469 int v28; // ecx@26 | |
5470 char v29; // al@26 | |
5471 int v30; // edx@28 | |
5472 int v31; // ecx@28 | |
5473 BLVLightMM7 *v32; // ecx@32 | |
5474 int v33; // edi@33 | |
5475 int v34; // edx@33 | |
5476 int v35; // eax@33 | |
5477 int v36; // edi@35 | |
5478 int v37; // edx@37 | |
5479 int v38; // ebx@39 | |
5480 int v39; // edi@42 | |
5481 int v40; // eax@42 | |
5482 char *v41; // ebx@45 | |
5483 signed int v42; // ecx@47 | |
5484 int v43; // edi@47 | |
5485 int v44; // eax@49 | |
5486 int v45; // edx@51 | |
5487 int v46; // eax@53 | |
5488 int v47; // ST04_4@55 | |
5489 int v48; // edi@55 | |
5490 double v49; // st6@55 | |
5491 int v50; // eax@55 | |
5492 double v51; // st6@55 | |
5493 int v52; // eax@55 | |
5494 int v53; // ecx@57 | |
5495 int v54; // ecx@58 | |
5496 int v55; // ecx@59 | |
5497 int v56; // edx@62 | |
5498 int v57; // ecx@62 | |
5499 int v58; // eax@63 | |
5500 int v59; // edx@64 | |
5501 int v60; // ecx@67 | |
5502 int v61; // edx@67 | |
5503 int v62; // eax@68 | |
5504 int v63; // edx@69 | |
5505 signed int v64; // ecx@72 | |
5506 double v65; // st7@75 | |
5507 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5508 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5509 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5510 int v69; // [sp+28h] [bp-18h]@10 | |
5511 int v70; // [sp+2Ch] [bp-14h]@10 | |
5512 int X; // [sp+30h] [bp-10h]@10 | |
5513 int v72; // [sp+34h] [bp-Ch]@10 | |
5514 int v73; // [sp+38h] [bp-8h]@10 | |
5515 int v74; // [sp+3Ch] [bp-4h]@10 | |
5516 | |
5517 v1 = &pIndoor->pFaces[uFaceID]; | |
5518 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5519 v3 = v1->uBitmapID; | |
5520 v4 = v1->uBitmapID; | |
5521 v68 = v2; | |
5522 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5523 v6 = 8 * uFaceID; | |
862 | 5524 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5525 stru_F8AD28.field_0 = v6; |
5526 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5527 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5528 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5529 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5530 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5531 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5532 v7 = GetTickCount(); | |
5533 v8 = v1->uAttributes; | |
5534 v9 = v7 >> 3; | |
5535 if ( v8 & 4 ) | |
5536 { | |
5537 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5538 } | |
5539 else | |
5540 { | |
5541 if ( v8 & 0x20 ) | |
5542 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5543 } | |
5544 v10 = v1->uAttributes; | |
5545 if ( BYTE1(v10) & 8 ) | |
5546 { | |
5547 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5548 } | |
5549 else | |
5550 { | |
5551 if ( v10 & 0x40 ) | |
5552 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5553 } | |
5554 v1->_get_normals(&v67, &v66); | |
5555 stru_F8AD28.vec_14.x = v67.x; | |
5556 stru_F8AD28.vec_14.y = v67.y; | |
5557 stru_F8AD28.vec_14.z = v67.z; | |
5558 stru_F8AD28.vec_20.x = v66.x; | |
5559 stru_F8AD28.vec_20.y = v66.y; | |
5560 stru_F8AD28.vec_20.z = v66.z; | |
5561 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5562 if ( pBLVRenderParams->sPartyRotX ) | |
5563 { | |
5564 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5565 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5566 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5567 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5568 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5569 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5570 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5571 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5572 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5573 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5574 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5575 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5576 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5577 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5578 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5579 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5580 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5581 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5582 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5583 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5584 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5585 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5586 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5587 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5588 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5589 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5590 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5591 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5592 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5593 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5594 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5595 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5596 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5597 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5598 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5599 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5600 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5601 v13 = pBLVRenderParams->vPartyPos.y; | |
5602 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5603 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5604 v14 = pBLVRenderParams->vPartyPos.x; | |
5605 } | |
5606 else | |
5607 { | |
5608 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5609 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5610 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5611 - v70; | |
5612 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5613 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5614 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5615 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5616 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5617 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5618 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5619 - v70; | |
5620 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5621 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5622 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5623 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5624 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5625 - v70; | |
5626 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5627 v14 = pBLVRenderParams->vPartyPos.x; | |
5628 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5629 v13 = pBLVRenderParams->vPartyPos.y; | |
5630 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5631 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5632 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5633 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5634 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5635 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5636 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5637 } | |
5638 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5639 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5640 + stru_F8AD28.plane_4.dist | |
5641 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5642 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5643 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5644 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5645 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5646 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5647 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5648 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5649 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5650 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5651 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5652 v15 = v70; | |
5653 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5654 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5655 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5656 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5657 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5658 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5659 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5660 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5661 stru_F8AD28.field_38 = 0; | |
5662 stru_F8AD28.field_A8 = -(X | |
5663 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5664 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5665 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5666 { | |
5667 stru_F8AD28.field_3E4 = 1; | |
5668 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5669 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5670 stru_F8AD28.field_3F0 = v68->field_1E; | |
5671 stru_F8AD28.field_3F4 = v68->field_20; | |
5672 } | |
5673 else | |
5674 { | |
5675 stru_F8AD28.field_3E4 = 0; | |
5676 } | |
5677 v16 = 0.0039215689; | |
5678 v17 = 116 * v1->uSectorID; | |
5679 v69 = v17; | |
5680 v74 = 0; | |
5681 v73 = 0; | |
5682 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5683 v70 = pMobileLightsStack->uNumLightsActive; | |
5684 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5685 { | |
5686 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5687 do | |
5688 { | |
5689 if ( v74 >= 20 ) | |
5690 break; | |
5691 v19 = *((short *)v18 + 2); | |
5692 v20 = *((short *)v18 - 1); | |
5693 if ( v20 > v1->pBounding.x1 - v19 ) | |
5694 { | |
5695 if ( v20 < v19 + v1->pBounding.x2 ) | |
5696 { | |
5697 v21 = *(short *)v18; | |
5698 if ( v21 > v1->pBounding.y1 - v19 ) | |
5699 { | |
5700 if ( v21 < v19 + v1->pBounding.y2 ) | |
5701 { | |
5702 v22 = *((short *)v18 + 1); | |
5703 if ( v22 > v1->pBounding.z1 - v19 ) | |
5704 { | |
5705 if ( v22 < v19 + v1->pBounding.z2 ) | |
5706 { | |
5707 X = (v1->pFacePlane_old.dist | |
5708 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5709 + v21 * v1->pFacePlane_old.vNormal.y | |
5710 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5711 if ( X <= v19 ) | |
5712 { | |
5713 v23 = X; | |
5714 v24 = v74; | |
5715 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5716 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5717 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5718 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5719 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5720 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5721 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5722 v25 = (double)(signed int)v68 * v16; | |
5723 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5724 v26 = (unsigned __int8)v18[8]; | |
5725 *(float *)(v24 * 4 + 16297992) = v25; | |
5726 v27 = (double)(signed int)v68; | |
5727 v68 = (BLVFaceExtra *)v26; | |
5728 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5729 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5730 v16 = 0.0039215689; | |
5731 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5732 v28 = v74; | |
5733 v29 = v18[9]; | |
5734 ++v74; | |
5735 stru_F8AD28._blv_lights_types[v28] = v29; | |
5736 } | |
5737 } | |
5738 } | |
5739 } | |
5740 } | |
5741 } | |
5742 } | |
5743 ++v73; | |
5744 v18 += 18; | |
5745 v17 = v69; | |
5746 } | |
5747 while ( v73 < v70 ); | |
5748 } | |
5749 v30 = 0; | |
5750 v73 = 0; | |
5751 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5752 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5753 if ( v31 > 0 ) | |
5754 { | |
5755 while ( v74 < 20 ) | |
5756 { | |
5757 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5758 if ( !(v32->uAtributes & 8) ) | |
5759 { | |
5760 v33 = v1->pBounding.x1; | |
5761 v34 = v32->vPosition.x; | |
5762 X = v32->uBrightness; | |
5763 v35 = v32->uRadius; | |
5764 v68 = (BLVFaceExtra *)v32->uRadius; | |
5765 if ( v34 > v33 - v35 ) | |
5766 { | |
5767 if ( v34 < v35 + v1->pBounding.x2 ) | |
5768 { | |
5769 v36 = v32->vPosition.y; | |
5770 if ( v36 > v1->pBounding.y1 - v35 ) | |
5771 { | |
5772 if ( v36 < v35 + v1->pBounding.y2 ) | |
5773 { | |
5774 v37 = v32->vPosition.z; | |
5775 if ( v37 > v1->pBounding.z1 - v35 ) | |
5776 { | |
5777 if ( v37 < v35 + v1->pBounding.z2 ) | |
5778 { | |
5779 v38 = (v1->pFacePlane_old.dist | |
5780 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5781 + v37 * v1->pFacePlane_old.vNormal.z | |
5782 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5783 if ( v38 >= 0 ) | |
5784 { | |
5785 if ( v38 <= v35 && v35 ) | |
5786 { | |
5787 v39 = v74; | |
5788 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5789 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5790 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5791 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5792 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5793 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5794 v68 = (BLVFaceExtra *)v32->uRed; | |
5795 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5796 v68 = (BLVFaceExtra *)v32->uGreen; | |
5797 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5798 v68 = (BLVFaceExtra *)v32->uBlue; | |
5799 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5800 v16 = 0.0039215689; | |
5801 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5802 v40 = v74++; | |
5803 stru_F8AD28._blv_lights_types[v40] = 1; | |
5804 } | |
5805 } | |
5806 } | |
5807 } | |
5808 } | |
5809 } | |
5810 } | |
5811 } | |
5812 } | |
5813 v30 = v73++ + 1; | |
5814 if ( v73 >= v70 ) | |
5815 break; | |
5816 v17 = v69; | |
5817 } | |
5818 } | |
5819 v73 = 0; | |
5820 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5821 { | |
5822 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5823 do | |
5824 { | |
5825 if ( v74 >= 20 ) | |
5826 break; | |
5827 v42 = *((short *)v41 + 2); | |
5828 v43 = *((short *)v41 - 1); | |
5829 if ( v43 > v1->pBounding.x1 - v42 ) | |
5830 { | |
5831 if ( v43 < v42 + v1->pBounding.x2 ) | |
5832 { | |
5833 v44 = *(short *)v41; | |
5834 if ( v44 > v1->pBounding.y1 - v42 ) | |
5835 { | |
5836 if ( v44 < v42 + v1->pBounding.y2 ) | |
5837 { | |
5838 v45 = *((short *)v41 + 1); | |
5839 if ( v45 > v1->pBounding.z1 - v42 ) | |
5840 { | |
5841 if ( v45 < v42 + v1->pBounding.z2 ) | |
5842 { | |
5843 v46 = (v1->pFacePlane_old.dist | |
5844 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5845 + v43 * v1->pFacePlane_old.vNormal.x | |
5846 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5847 v69 = v46; | |
5848 if ( v46 >= 0 ) | |
5849 { | |
5850 if ( v46 <= v42 ) | |
5851 { | |
5852 v47 = v69; | |
5853 v48 = v74; | |
5854 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5855 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5856 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5857 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5858 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5859 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5860 v49 = (double)(signed int)v68 * v16; | |
5861 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5862 v50 = (unsigned __int8)v41[8]; | |
5863 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5864 v51 = (double)(signed int)v68; | |
5865 v68 = (BLVFaceExtra *)v50; | |
5866 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5867 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5868 v16 = 0.0039215689; | |
5869 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5870 v52 = v74++; | |
5871 stru_F8AD28._blv_lights_types[v52] = 1; | |
5872 } | |
5873 } | |
5874 } | |
5875 } | |
5876 } | |
5877 } | |
5878 } | |
5879 } | |
5880 ++v73; | |
5881 v41 += 12; | |
5882 } | |
5883 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5884 } | |
5885 stru_F8AD28.uNumLightsApplied = v74; | |
5886 v53 = v1->pBounding.x2; | |
5887 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5888 { | |
5889 v55 = v1->pBounding.x1; | |
5890 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5891 v54 = 0; | |
5892 else | |
5893 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5894 } | |
5895 else | |
5896 { | |
5897 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5898 } | |
5899 v56 = v1->pBounding.y2; | |
5900 v57 = v54 * v54; | |
5901 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5902 { | |
5903 v59 = v1->pBounding.y1; | |
5904 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5905 v58 = 0; | |
5906 else | |
5907 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5908 } | |
5909 else | |
5910 { | |
5911 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5912 } | |
5913 v60 = v58 * v58 + v57; | |
5914 v61 = v1->pBounding.z2; | |
5915 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5916 { | |
5917 v63 = v1->pBounding.z1; | |
5918 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5919 v62 = 0; | |
5920 else | |
5921 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5922 } | |
5923 else | |
5924 { | |
5925 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5926 } | |
5927 v64 = v62 * v62 + v60; | |
5928 if ( v64 ) | |
295 | 5929 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5930 else |
5931 stru_F8AD28.field_34 = 0; | |
5932 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5933 v65 = (double)(signed int)v68; | |
5934 if ( v65 >= 655.36 ) | |
5935 { | |
5936 if ( v65 >= 26214.4 ) | |
5937 { | |
5938 if ( v65 >= 45875.2 ) | |
5939 { | |
5940 stru_F8AD28.field_44 = 8; | |
5941 stru_F8AD28.field_48 = 3; | |
5942 } | |
5943 else | |
5944 { | |
5945 stru_F8AD28.field_44 = 16; | |
5946 stru_F8AD28.field_48 = 4; | |
5947 } | |
5948 } | |
5949 else | |
5950 { | |
5951 stru_F8AD28.field_44 = 32; | |
5952 stru_F8AD28.field_48 = 5; | |
5953 } | |
5954 } | |
5955 else | |
5956 { | |
5957 stru_F8AD28.field_44 = 64; | |
5958 stru_F8AD28.field_48 = 6; | |
5959 } | |
5960 } | |
5961 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5962 | |
5963 //----- (004AF412) -------------------------------------------------------- | |
5964 int __cdecl sub_4AF412() | |
5965 { | |
5966 int v0; // ST20_4@2 | |
5967 int v1; // ST20_4@2 | |
5968 int v2; // ST20_4@2 | |
5969 int v3; // esi@2 | |
5970 int v4; // ST20_4@2 | |
5971 int v5; // ecx@2 | |
5972 int v6; // ebx@2 | |
5973 int v7; // edi@2 | |
5974 int v8; // edx@2 | |
5975 int v9; // eax@2 | |
5976 int result; // eax@4 | |
5977 | |
5978 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5979 stru_F8AD28.vec_20.y = -65536; | |
5980 stru_F8AD28.plane_4.vNormal.x = 0; | |
5981 stru_F8AD28.plane_4.vNormal.y = 0; | |
5982 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5983 stru_F8AD28.vec_14.x = 65536; | |
5984 stru_F8AD28.vec_14.y = 0; | |
5985 stru_F8AD28.vec_14.z = 0; | |
5986 stru_F8AD28.vec_20.x = 0; | |
5987 stru_F8AD28.vec_20.z = 0; | |
5988 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5989 if ( pBLVRenderParams->sPartyRotX ) | |
5990 { | |
5991 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5992 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5993 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5994 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5995 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5996 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5997 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5998 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5999 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6000 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6001 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6002 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6003 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6004 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6005 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6006 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6007 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6008 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6009 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6010 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6011 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6012 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6013 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6014 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6015 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6016 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6017 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6018 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6019 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6020 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6021 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6022 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6023 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6024 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6025 v6 = pBLVRenderParams->vPartyPos.z; | |
6026 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6027 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6028 v8 = pBLVRenderParams->vPartyPos.y; | |
6029 v9 = pBLVRenderParams->vPartyPos.x; | |
6030 } | |
6031 else | |
6032 { | |
6033 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6034 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6035 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6036 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6037 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6038 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6039 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6040 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6041 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6042 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6043 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6044 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6045 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6046 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6047 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6048 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6049 v8 = pBLVRenderParams->vPartyPos.y; | |
6050 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6051 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6052 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6053 v9 = pBLVRenderParams->vPartyPos.x; | |
6054 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6055 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6056 v6 = pBLVRenderParams->vPartyPos.z; | |
6057 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6058 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6059 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6060 } | |
6061 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6062 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6063 + stru_F8AD28.plane_4.dist | |
6064 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6065 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6066 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6067 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6068 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6069 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6070 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6071 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6072 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6073 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6074 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6075 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6076 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6077 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6078 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6079 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6080 result = 0; | |
6081 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6082 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6083 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6084 stru_F8AD28.field_38 = 0; | |
6085 stru_F8AD28.field_3E4 = 0; | |
6086 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6087 stru_F8AD28.uNumLightsApplied = 0; | |
6088 stru_F8AD28.field_34 = 0; | |
6089 return result; | |
6090 } | |
6091 | |
6092 //----- (004B1447) -------------------------------------------------------- | |
6093 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6094 { | |
6095 signed int v3; // esi@1 | |
6096 char v4; // sf@8 | |
6097 int v5; // eax@8 | |
6098 unsigned __int64 v6; // qax@12 | |
6099 DDM_DLV_Header *v7; // eax@14 | |
6100 Player **v8; // edi@18 | |
6101 Player *result; // eax@19 | |
735 | 6102 //char *v10; // esi@20 |
0 | 6103 |
6104 v3 = 0; | |
6105 if ( a2 ) | |
6106 { | |
6107 if ( a2 != 1 ) | |
6108 { | |
6109 if ( a2 == 2 ) | |
6110 v3 = 2; | |
6111 goto LABEL_13; | |
6112 } | |
6113 v3 = 2; | |
6114 } | |
6115 else | |
6116 { | |
6117 v3 = 1; | |
6118 } | |
6119 if ( pParty->uFine < 4000000 ) | |
6120 { | |
6121 v4 = a3 + pParty->uFine < 0; | |
6122 v5 = a3 + pParty->uFine; | |
6123 pParty->uFine += a3; | |
6124 if ( v4 ) | |
6125 { | |
6126 v5 = 0; | |
6127 pParty->uFine = 0; | |
6128 } | |
6129 if ( v5 > 4000000 ) | |
6130 pParty->uFine = 4000000; | |
6131 } | |
487 | 6132 |
6133 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6134 | |
0 | 6135 LABEL_13: |
463 | 6136 pParty->InTheShopFlags[a1] = 1; |
0 | 6137 if ( v3 ) |
6138 { | |
6139 v7 = &pOutdoor->ddm; | |
6140 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6141 v7 = &pIndoor->dlv; | |
6142 v7->uReputation += v3; | |
6143 if ( v7->uReputation > 10000 ) | |
6144 v7->uReputation = 10000; | |
6145 } | |
6146 v8 = &pPlayers[1]; | |
6147 do | |
6148 { | |
6149 result = *v8; | |
6150 if ( pParty->uFine ) | |
6151 { | |
735 | 6152 //v10 = result->_guilds_member_bits; |
484 | 6153 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6154 if ( !(short)result ) |
735 | 6155 __debugbreak(); |
501 | 6156 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6157 } |
6158 ++v8; | |
6159 } | |
6160 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6161 return result; | |
6162 } | |
6163 | |
6164 //----- (004B1523) -------------------------------------------------------- | |
762 | 6165 void __thiscall sub_4B1523(int *_this) |
0 | 6166 { |
6167 int v1; // esi@1 | |
6168 int v2; // edx@1 | |
6169 unsigned int v3; // eax@2 | |
6170 int v4; // eax@4 | |
6171 LONG v5; // ecx@4 | |
6172 int v6; // eax@10 | |
6173 char *v7; // ST44_4@12 | |
6174 unsigned __int16 v8; // ax@12 | |
6175 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6176 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6177 POINT a2; // [sp+64h] [bp-10h]@1 | |
6178 int v13; // [sp+6Ch] [bp-8h]@4 | |
6179 int v14; // [sp+70h] [bp-4h]@4 | |
6180 | |
6181 v1 = *_this - 399; | |
6182 v2 = (*_this - 400) % 11 + 1; | |
6183 v11 = 4 * (*_this - 400) / 11; | |
6184 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6185 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6186 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6187 else | |
6188 v3 = 30; | |
6189 a1.Hint = 0; | |
6190 a1.uFrameY = v3; | |
6191 a1.uFrameWidth = 328; | |
6192 a1.uFrameHeight = 68; | |
6193 a1.uFrameX = 90; | |
6194 a1.uFrameZ = 417; | |
6195 a1.uFrameW = v3 + 67; | |
6196 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6197 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6198 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6199 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6200 v5 = a2.y; | |
6201 if ( v14 > a2.y ) | |
6202 v5 = v14; | |
6203 if ( v13 > v5 ) | |
6204 v5 = v13; | |
6205 if ( v4 > v5 ) | |
6206 v5 = v4; | |
262 | 6207 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", |
6208 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6209 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6210 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6211 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6212 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6213 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6214 a1.uFrameHeight += v6; | |
6215 if ( (signed int)a1.uFrameHeight < 150 ) | |
6216 a1.uFrameHeight = 150; | |
819 | 6217 a1.uFrameWidth = game_viewport_width; |
0 | 6218 a1.DrawMessageBox(0); |
6219 a1.uFrameWidth -= 12; | |
6220 a1.uFrameHeight -= 12; | |
6221 v7 = pSpellStats->pInfos[v1].pName; | |
6222 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6223 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6224 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6225 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6226 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6227 a1.uFrameZ = a1.uFrameX + 107; | |
6228 a1.uFrameWidth = 108; | |
6229 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6230 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6231 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6232 } |
6233 | |
6234 //----- (004B1784) -------------------------------------------------------- | |
6235 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6236 { | |
6237 Player *pPlayer; // ebx@1 | |
6238 bool result; // eax@2 | |
6239 unsigned __int16 v2; // ST0C_2@3 | |
6240 int v3; // eax@3 | |
6241 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6242 | |
6243 pPlayer = pPlayers[uActiveCharacter]; | |
6244 if ( pPlayer->CanAct() ) | |
6245 { | |
6246 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6247 result = 1; | |
6248 } | |
6249 else | |
6250 { | |
6251 pDialogueWindow->pNumPresenceButton = 0; | |
6252 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6253 v4.uFrameX = 483; | |
6254 v4.uFrameWidth = 148; | |
6255 v4.uFrameZ = 334; | |
6256 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6257 // "%s is in no condition to %s" | |
6258 // "do anything" | |
758 | 6259 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6260 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6261 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6262 result = 0; | |
6263 } | |
6264 return result; | |
6265 } | |
6266 // F8B1E0: using guessed type int dword_F8B1E0; | |
6267 | |
463 | 6268 //view item details in shop? |
0 | 6269 //----- (004B1A2D) -------------------------------------------------------- |
6270 void __cdecl sub_4B1A2D() | |
6271 { | |
358 | 6272 //Player *v0; // edi@1 |
0 | 6273 POINT *v1; // esi@5 |
6274 unsigned int v2; // eax@5 | |
6275 int v3; // ecx@5 | |
6276 POINT *v4; // esi@12 | |
6277 int v5; // eax@12 | |
6278 unsigned int v6; // eax@13 | |
6279 ItemGen *v7; // ecx@13 | |
6280 signed int v8; // esi@17 | |
6281 unsigned int v9; // eax@19 | |
475 | 6282 POINT v10; // [sp+8h] [bp-44h]@12 |
6283 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6284 POINT v12; // [sp+18h] [bp-34h]@18 | |
6285 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6286 POINT v14; // [sp+28h] [bp-24h]@17 | |
6287 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6288 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6289 POINT a2; // [sp+40h] [bp-Ch]@5 |
6290 int v18; // [sp+48h] [bp-4h]@5 | |
6291 | |
358 | 6292 //v0 = pPlayers[uActiveCharacter]; |
484 | 6293 if ( in_current_building_type <= 0 ) |
0 | 6294 return; |
484 | 6295 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6296 { |
749 | 6297 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6298 { | |
6299 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6300 return; |
749 | 6301 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6302 { |
475 | 6303 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6304 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
6305 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
6306 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 6307 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 6308 return; |
358 | 6309 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 6310 LABEL_15: |
6311 GameUI_DrawItemInfo(v7); | |
6312 return; | |
6313 } | |
749 | 6314 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6315 return; |
6316 } | |
475 | 6317 v4 = pMouse->GetCursorPos(&v11); |
6318 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6319 v18 = v5; |
6320 if ( !v5 ) | |
6321 return; | |
336 | 6322 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6323 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6324 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
439 | 6325 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 6326 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 6327 goto LABEL_15; |
6328 } | |
874 | 6329 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6330 { |
6331 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6332 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6333 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6334 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
6335 if ( v18 ) | |
336 | 6336 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6337 } |
6338 } | |
6339 // F8B198: using guessed type int dword_F8B198; | |
6340 // F8B19C: using guessed type int dword_F8B19C; | |
6341 | |
6342 //----- (004B1BDB) -------------------------------------------------------- | |
6343 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6344 { | |
6345 signed __int64 v1; // ST2C_8@1 | |
6346 signed __int64 v2; // qax@1 | |
6347 signed __int64 v3; // ST1C_8@1 | |
6348 unsigned __int64 v4; // qax@1 | |
6349 unsigned int v5; // ebx@1 | |
112 | 6350 Player *v6; // ebx@1 |
0 | 6351 |
6352 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6353 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6354 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6355 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6356 v2 = v1 / 60 / 60; | |
6357 v3 = v2; | |
6358 v4 = (unsigned int)v2 / 0x18; | |
6359 v5 = (unsigned int)(v4 / 7) >> 2; | |
6360 pParty->uCurrentTimeSecond = v1 % 60; | |
6361 pParty->uCurrentMinute = v1 / 60 % 60; | |
6362 pParty->uCurrentHour = v3 % 24; | |
6363 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6364 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6365 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6366 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6367 pParty->RestAndHeal(); |
6368 dword_507B94 = 1; | |
112 | 6369 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6370 do |
6371 { | |
112 | 6372 v6->uTimeToRecovery = 0; |
6373 memset(&v6->uTimeToRecovery, 0, 4u); | |
6374 ++v6; | |
6375 } | |
6376 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6377 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6378 } |
6379 // 507B94: using guessed type int dword_507B94; | |
6380 | |
6381 //----- (004B1D27) -------------------------------------------------------- | |
6382 void __cdecl sub_4B1D27() | |
6383 { | |
6384 int v0; // edx@2 | |
6385 unsigned int v1; // ecx@7 | |
6386 signed int v2; // edi@10 | |
6387 int v3; // esi@10 | |
6388 __int16 v4; // ax@15 | |
6389 signed int v5; // edi@20 | |
6390 int v6; // esi@20 | |
6391 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6392 | |
484 | 6393 if ( in_current_building_type > 0 ) |
0 | 6394 { |
6395 v0 = 3; | |
484 | 6396 if ( in_current_building_type > BildingType_MagicShop ) |
6397 { | |
6398 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6399 { |
6400 if ( !dword_F8B1E4 ) | |
6401 return; | |
6402 } | |
6403 else | |
6404 { | |
484 | 6405 if ( in_current_building_type != BildingType_Temple ) |
0 | 6406 return; |
6407 } | |
336 | 6408 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
0 | 6409 LABEL_28: |
735 | 6410 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6411 return; |
6412 } | |
336 | 6413 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6414 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6415 { |
6416 if ( pParty->uNumGold <= 0x2710 ) | |
6417 { | |
6418 if ( !dword_F8B1E4 ) | |
6419 return; | |
6420 v0 = 4; | |
6421 goto LABEL_28; | |
6422 } | |
735 | 6423 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6424 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6425 { | |
6426 v5 = 0; | |
6427 v6 = 1; | |
6428 do | |
6429 { | |
6430 if ( pPlayers[v6]->CanAct() ) | |
6431 v7[v5++] = v6; | |
6432 ++v6; | |
6433 } | |
6434 while ( v6 <= 4 ); | |
6435 if ( v5 ) | |
6436 { | |
6437 qword_A750D8 = 256i64; | |
6438 word_A750E0 = 80; | |
6439 v4 = LOWORD(v7[rand() % v5]); | |
6440 goto LABEL_16; | |
6441 } | |
6442 } | |
6443 } | |
6444 else | |
6445 { | |
6446 if ( !qword_A750D8 ) | |
6447 { | |
6448 v2 = 0; | |
6449 v3 = 1; | |
6450 do | |
6451 { | |
6452 if ( pPlayers[v3]->CanAct() ) | |
6453 v7[v2++] = v3; | |
6454 ++v3; | |
6455 } | |
6456 while ( v3 <= 4 ); | |
6457 if ( v2 ) | |
6458 { | |
6459 qword_A750D8 = 256i64; | |
6460 word_A750E0 = 80; | |
6461 v4 = LOWORD(v7[rand() % v2]); | |
6462 LABEL_16: | |
6463 word_A750E2 = v4; | |
6464 return; | |
6465 } | |
6466 } | |
6467 } | |
6468 } | |
6469 } | |
6470 | |
6471 //----- (004B1ECE) -------------------------------------------------------- | |
6472 void __cdecl sub_4B1ECE() | |
6473 { | |
6474 __int16 *v0; // edi@1 | |
6475 int v1; // ebx@3 | |
6476 Player *v2; // esi@3 | |
6477 int v3; // eax@4 | |
6478 signed int v4; // eax@9 | |
6479 int v5; // ebx@11 | |
89 | 6480 Player *v6; // esi@13 |
6481 ItemGen *v7; // eax@14 | |
0 | 6482 signed int v8; // edi@14 |
89 | 6483 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6484 signed int v10; // [sp+10h] [bp-8h]@13 |
6485 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6486 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6487 |
484 | 6488 contract_approved = 0; |
0 | 6489 v11 = 0; |
6490 uDialogueType = 84; | |
827 | 6491 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6492 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6493 while ( 1 ) | |
6494 { | |
484 | 6495 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6496 { |
6497 v1 = 0; | |
6498 v2 = pParty->pPlayers; | |
6499 do | |
6500 { | |
89 | 6501 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6502 if ( v3 ) |
6503 break; | |
6504 ++v2; | |
6505 ++v1; | |
6506 } | |
6507 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6508 if ( v1 == 4 ) | |
6509 break; | |
6510 } | |
6511 ++v11; | |
6512 v0 += 2; | |
89 | 6513 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6514 break; | |
6515 } | |
6516 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6517 { | |
827 | 6518 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6519 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6520 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6521 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6522 } | |
484 | 6523 if ( contract_approved == 601 ) |
0 | 6524 { |
6525 v5 = 0; | |
89 | 6526 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6527 v9 = 0; |
6528 while ( 1 ) | |
6529 { | |
135 | 6530 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6531 { |
6532 v10 = 0; | |
89 | 6533 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6534 do |
6535 { | |
89 | 6536 v7 = v6->pInventoryItems; |
0 | 6537 v8 = 138; |
6538 do | |
6539 { | |
89 | 6540 if ( v7->uItemID == 601 ) |
0 | 6541 { |
377 | 6542 if ( !v7->uHolderPlayer ) |
89 | 6543 v9 = v7; |
377 | 6544 if ( v7->uHolderPlayer == v5 ) |
0 | 6545 v10 = 1; |
6546 } | |
89 | 6547 ++v7; |
0 | 6548 --v8; |
6549 } | |
6550 while ( v8 ); | |
89 | 6551 ++v6; |
6552 } | |
6553 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6554 if ( !v10 ) |
6555 break; | |
6556 } | |
89 | 6557 ++v12; |
0 | 6558 ++v5; |
89 | 6559 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6560 return; |
6561 } | |
6562 if ( v9 ) | |
377 | 6563 v9->uHolderPlayer = v5; |
0 | 6564 } |
6565 } | |
6566 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6567 // 722B3C: using guessed type int dword_722B3C; | |
6568 // 722B44: using guessed type int dword_722B44; | |
6569 // F8B1A8: using guessed type int dword_F8B1A8; | |
6570 | |
6571 //----- (004B2001) -------------------------------------------------------- | |
459 | 6572 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6573 { | |
6574 //signed int v1; // eax@1 | |
6575 NPCData *pCurrentNPCInfo; // ebp@1 | |
6576 int pEventNumber; // ecx@8 | |
0 | 6577 Player *v4; // esi@20 |
467 | 6578 //int v5; // eax@28 |
6579 //int v6; // eax@31 | |
6580 //int v7; // eax@34 | |
6581 //int v8; // eax@37 | |
6582 //int v9; // eax@40 | |
6583 //unsigned int v10; // eax@43 | |
0 | 6584 char *v12; // eax@53 |
6585 char *v13; // eax@56 | |
6586 char *v14; // eax@57 | |
6587 char *v15; // eax@58 | |
467 | 6588 //unsigned int v16; // ebp@62 |
0 | 6589 char *v17; // ecx@63 |
6590 char *v18; // eax@65 | |
6591 const char *v19; // ecx@68 | |
248 | 6592 //unsigned int v20; // eax@69 |
467 | 6593 signed int pPrice; // ecx@70 |
0 | 6594 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6595 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6596 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6597 //int v25; // [sp-4h] [bp-10h]@49 |
6598 | |
459 | 6599 uDialogueType = uMessageParam + 1; |
6600 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6601 if ( uMessageParam <= 24 ) |
460 | 6602 { |
459 | 6603 switch ( uMessageParam ) |
6604 { | |
6605 case 13: | |
827 | 6606 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6607 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6608 NPCHireableDialogPrepare(); |
459 | 6609 dialogue_show_profession_details = false; |
6610 goto _return; | |
6611 case 19: | |
6612 pEventNumber = pCurrentNPCInfo->evt_A; | |
6613 break; | |
6614 case 20: | |
6615 pEventNumber = pCurrentNPCInfo->evt_B; | |
6616 break; | |
6617 case 21: | |
6618 pEventNumber = pCurrentNPCInfo->evt_C; | |
6619 break; | |
6620 case 22: | |
6621 pEventNumber = pCurrentNPCInfo->evt_D; | |
6622 break; | |
6623 case 23: | |
6624 pEventNumber = pCurrentNPCInfo->evt_E; | |
6625 break; | |
6626 case 24: | |
6627 pEventNumber = pCurrentNPCInfo->evt_F; | |
6628 break; | |
6629 default: | |
467 | 6630 goto _return; |
6631 } | |
6632 /*switch ( pEventNumber ) | |
6633 { | |
6634 case 139: | |
6635 sub_4B1ECE(); | |
6636 goto _return; | |
6637 case 311: | |
6638 sub_4BBA85_bounties(); | |
6639 goto _return; | |
6640 }*/ | |
459 | 6641 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6642 { | |
6643 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6644 { | |
6645 if ( pEventNumber == 139 ) | |
0 | 6646 { |
6647 sub_4B1ECE(); | |
6648 } | |
6649 else | |
6650 { | |
459 | 6651 if ( pEventNumber == 311 ) |
0 | 6652 { |
6653 sub_4BBA85_bounties(); | |
6654 } | |
6655 else | |
6656 { | |
827 | 6657 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6658 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6659 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6660 activeLevelDecoration = NULL; |
0 | 6661 } |
6662 } | |
6663 } | |
6664 else | |
6665 { | |
459 | 6666 dword_F8B1D8 = uMessageParam; |
6667 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6668 } |
6669 } | |
6670 else | |
6671 { | |
459 | 6672 sub_4B3FE5(pEventNumber); |
0 | 6673 } |
6674 goto _return; | |
460 | 6675 } |
459 | 6676 if ( uMessageParam != 76 ) |
6677 { | |
6678 if ( uMessageParam == 77 ) | |
6679 { | |
467 | 6680 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6681 if (dialogue_show_profession_details) |
459 | 6682 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6683 else |
459 | 6684 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6685 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6686 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6687 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6688 current_npc_text = v18; |
0 | 6689 } |
6690 else | |
6691 { | |
459 | 6692 if ( uMessageParam == 79 ) |
0 | 6693 { |
484 | 6694 if ( contract_approved ) |
0 | 6695 { |
267 | 6696 Party::TakeGold(gold_transaction_amount); |
0 | 6697 if ( uActiveCharacter ) |
6698 { | |
492 | 6699 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6700 *(short *)v12 &= 0x3Fu; |
6701 switch ( dword_F8B1B0 ) | |
6702 { | |
6703 case 2: | |
492 | 6704 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6705 *v15 |= 0x40u; |
6706 break; | |
6707 case 3: | |
492 | 6708 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6709 *v14 |= 0x80u; |
6710 break; | |
6711 case 4: | |
492 | 6712 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6713 v13[1] |= 1u; |
6714 break; | |
6715 } | |
187 | 6716 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6717 } |
437 | 6718 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6719 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6720 { |
6721 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6722 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6723 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6724 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6725 }*/ |
0 | 6726 } |
6727 } | |
6728 else | |
6729 { | |
492 | 6730 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6731 { |
267 | 6732 Party::TakeGold(gold_transaction_amount); |
0 | 6733 v4 = pParty->pPlayers; |
6734 do | |
6735 { | |
492 | 6736 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6737 ++v4; |
6738 } | |
6739 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6740 switch ( dword_F8B1D8 ) | |
6741 { | |
6742 case 19: | |
467 | 6743 pEventNumber = pCurrentNPCInfo->evt_A; |
6744 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6745 pCurrentNPCInfo->evt_A = 0; |
0 | 6746 break; |
6747 case 20: | |
467 | 6748 pEventNumber = pCurrentNPCInfo->evt_B; |
6749 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6750 pCurrentNPCInfo->evt_B = 0; |
0 | 6751 break; |
6752 case 21: | |
467 | 6753 pEventNumber = pCurrentNPCInfo->evt_C; |
6754 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6755 pCurrentNPCInfo->evt_C = 0; |
0 | 6756 break; |
6757 case 22: | |
467 | 6758 pEventNumber = pCurrentNPCInfo->evt_D; |
6759 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6760 pCurrentNPCInfo->evt_D = 0; |
0 | 6761 break; |
6762 case 23: | |
467 | 6763 pEventNumber = pCurrentNPCInfo->evt_E; |
6764 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6765 pCurrentNPCInfo->evt_E = 0; |
0 | 6766 break; |
6767 case 24: | |
467 | 6768 pEventNumber = pCurrentNPCInfo->evt_F; |
6769 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6770 pCurrentNPCInfo->evt_F = 0; | |
0 | 6771 break; |
6772 } | |
437 | 6773 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6774 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6775 { |
6776 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6777 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6778 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6779 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6780 }*/ |
467 | 6781 //v11 = uActiveCharacter; |
0 | 6782 if ( uActiveCharacter ) |
6783 { | |
467 | 6784 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6785 goto _return; |
6786 } | |
6787 } | |
6788 } | |
6789 } | |
6790 goto _return; | |
6791 } | |
6792 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6793 { | |
467 | 6794 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6795 goto _return; |
6796 } | |
459 | 6797 if ( pCurrentNPCInfo->uProfession != 51 ) |
6798 { | |
467 | 6799 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6800 if ( pParty->uNumGold < pPrice ) | |
6801 { | |
6802 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6803 dialogue_show_profession_details = false; |
0 | 6804 uDialogueType = 13; |
827 | 6805 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6806 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6807 if ( uActiveCharacter ) |
248 | 6808 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6809 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6810 goto _return; | |
6811 } | |
6812 Party::TakeGold(pPrice); | |
0 | 6813 } |
147 | 6814 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6815 pCurrentNPCInfo->uFlags |= 128; |
0 | 6816 pParty->field_709 = 0; |
659 | 6817 Party__CountHirelings(); |
0 | 6818 if ( pParty->pHirelings[0].pName ) |
6819 { | |
459 | 6820 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6821 v24 = pCurrentNPCInfo->pName; | |
0 | 6822 v22 = pParty->pHireling2Name; |
6823 } | |
6824 else | |
6825 { | |
459 | 6826 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6827 v24 = pCurrentNPCInfo->pName; | |
0 | 6828 v22 = pParty->pHireling1Name; |
6829 } | |
6830 strcpy(v22, v24); | |
6831 pParty->field_709 = 0; | |
659 | 6832 Party__CountHirelings(); |
480 | 6833 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6834 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6835 |
6836 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6837 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6838 { |
6839 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6840 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6841 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6842 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6843 }*/ |
0 | 6844 if ( uActiveCharacter ) |
467 | 6845 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6846 _return: |
460 | 6847 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6848 } |
6849 | |
6850 //----- (004B254D) -------------------------------------------------------- | |
6851 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6852 { | |
6853 Player *v1; // esi@1 | |
6854 int v2; // edx@1 | |
6855 int v3; // ecx@1 | |
6856 int v4; // edi@1 | |
6857 int v5; // eax@7 | |
6858 int v6; // eax@7 | |
6859 int v7; // ebx@7 | |
6860 int v8; // ebx@8 | |
6861 signed int v9; // esi@8 | |
6862 int v10; // eax@8 | |
6863 char *v11; // ecx@8 | |
6864 int v12; // edi@9 | |
6865 char *v13; // edx@9 | |
6866 signed int v14; // edi@10 | |
6867 unsigned int v16; // eax@29 | |
6868 int v17; // eax@36 | |
6869 char v18; // cl@46 | |
6870 __int16 v19; // dx@56 | |
6871 int v20; // eax@60 | |
6872 char *v21; // [sp-Ch] [bp-38h]@82 | |
6873 const char *v22; // [sp-8h] [bp-34h]@21 | |
6874 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6875 char *v24; // [sp-8h] [bp-34h]@82 | |
6876 char *v25; // [sp-4h] [bp-30h]@14 | |
6877 int v26; // [sp-4h] [bp-30h]@38 | |
6878 int v27; // [sp-4h] [bp-30h]@82 | |
6879 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6880 int v29; // [sp+10h] [bp-1Ch]@13 | |
6881 int v30; // [sp+14h] [bp-18h]@15 | |
6882 int v31; // [sp+18h] [bp-14h]@16 | |
6883 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6884 int v33; // [sp+20h] [bp-Ch]@7 | |
6885 int v34; // [sp+24h] [bp-8h]@7 | |
6886 char *v35; // [sp+28h] [bp-4h]@1 | |
6887 | |
6888 v1 = pPlayers[uActiveCharacter]; | |
484 | 6889 contract_approved = 0; |
0 | 6890 v2 = (_this - 200) % 3; |
6891 v3 = (_this - 200) / 3; | |
6892 v4 = v2; | |
6893 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6894 dword_F8B1AC_award_bit_number = v3; |
0 | 6895 if ( v2 ) |
6896 { | |
6897 if ( v2 == 1 ) | |
6898 { | |
267 | 6899 gold_transaction_amount = 5000; |
0 | 6900 dword_F8B1B0 = 3; |
6901 } | |
6902 else | |
6903 { | |
6904 if ( v2 == 2 ) | |
6905 { | |
267 | 6906 gold_transaction_amount = 8000; |
0 | 6907 dword_F8B1B0 = 4; |
6908 } | |
6909 } | |
6910 } | |
6911 else | |
6912 { | |
267 | 6913 gold_transaction_amount = 2000; |
0 | 6914 dword_F8B1B0 = 2; |
6915 } | |
135 | 6916 v5 = v1->classType; |
0 | 6917 v33 = v5; |
6918 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
6919 *(int *)a1 = v1->pActiveSkills[v3]; | |
6920 v7 = a1[0] & 0x3F; | |
6921 v34 = v2 + 2; | |
6922 if ( v6 < v2 + 2 ) | |
6923 { | |
6924 v8 = v33; | |
6925 v9 = 0; | |
6926 v10 = v33 - v33 % 4; | |
6927 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
6928 do | |
6929 { | |
6930 v12 = (unsigned __int8)*v11; | |
6931 v13 = &v28[4 * v9]; | |
6932 *(int *)v13 = 0; | |
6933 if ( v12 < v34 ) | |
6934 { | |
6935 v14 = 1; | |
6936 } | |
6937 else | |
6938 { | |
6939 v14 = 1; | |
6940 *(int *)v13 = 1; | |
6941 } | |
6942 ++v9; | |
6943 v11 += 37; | |
6944 } | |
6945 while ( v9 < 4 ); | |
6946 if ( v29 == v14 ) | |
6947 { | |
6948 v25 = pClassNames[v10 + 1]; | |
6949 } | |
6950 else | |
6951 { | |
6952 if ( v30 == v14 ) | |
6953 { | |
6954 if ( v31 == v14 ) | |
6955 { | |
6956 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
6957 return pTmpBuf; | |
6958 } | |
6959 v25 = pClassNames[v10 + 2]; | |
6960 } | |
6961 else | |
6962 { | |
6963 if ( v31 != v14 ) | |
6964 { | |
6965 v25 = pClassNames[v8]; | |
6966 v22 = pGlobalTXT_LocalizationStrings[632]; | |
6967 goto LABEL_23; | |
6968 } | |
6969 v25 = pClassNames[v10 + 3]; | |
6970 } | |
6971 } | |
6972 v22 = pGlobalTXT_LocalizationStrings[633]; | |
6973 LABEL_23: | |
6974 sprintf(pTmpBuf, v22, v25); | |
6975 return pTmpBuf; | |
6976 } | |
6977 if ( !v1->CanAct() ) | |
6978 return (char *)pNPCTopics[122].pText; | |
6979 if ( !v7 ) | |
6980 return (char *)pNPCTopics[131].pText; | |
6981 v16 = SkillToMastery(a1[0]); | |
6982 if ( (signed int)v16 > v4 + 1 ) | |
6983 return (char *)pNPCTopics[v4 + 128].pText; | |
6984 if ( v34 != 2 ) | |
6985 { | |
6986 if ( v34 == 3 ) | |
6987 { | |
6988 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6989 { | |
492 | 6990 v17 = dword_F8B1AC_award_bit_number; |
6991 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 6992 { |
6993 default: | |
6994 goto LABEL_41; | |
6995 case 12: | |
6996 case 13: | |
6997 case 14: | |
6998 case 15: | |
6999 case 16: | |
7000 case 17: | |
7001 case 18: | |
267 | 7002 gold_transaction_amount = 4000; |
0 | 7003 goto LABEL_42; |
7004 case 19: | |
7005 v19 = 114; | |
7006 goto LABEL_57; | |
7007 case 20: | |
7008 v19 = 110; | |
7009 LABEL_57: | |
484 | 7010 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7011 return v35; |
7012 goto LABEL_40; | |
7013 case 22: | |
7014 v20 = v1->GetBaseWillpower(); | |
7015 goto LABEL_61; | |
7016 case 24: | |
267 | 7017 gold_transaction_amount = 2500; |
0 | 7018 v20 = v1->GetBaseEndurance(); |
7019 goto LABEL_61; | |
7020 case 36: | |
7021 v20 = v1->GetBaseIntelligence(); | |
7022 LABEL_61: | |
7023 if ( v20 < 50 ) | |
7024 return v35; | |
7025 goto LABEL_40; | |
7026 case 21: | |
7027 case 23: | |
7028 case 25: | |
7029 case 26: | |
7030 case 29: | |
7031 case 32: | |
7032 case 34: | |
7033 case 35: | |
267 | 7034 gold_transaction_amount = 2500; |
0 | 7035 goto LABEL_42; |
7036 case 8: | |
7037 case 9: | |
7038 case 10: | |
7039 case 11: | |
267 | 7040 gold_transaction_amount = 3000; |
0 | 7041 goto LABEL_42; |
7042 case 7: | |
7043 goto LABEL_67; | |
7044 } | |
7045 goto LABEL_67; | |
7046 } | |
7047 } | |
7048 else | |
7049 { | |
7050 if ( v34 != 4 ) | |
7051 { | |
7052 LABEL_40: | |
492 | 7053 v17 = dword_F8B1AC_award_bit_number; |
0 | 7054 goto LABEL_41; |
7055 } | |
7056 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7057 { | |
492 | 7058 v17 = dword_F8B1AC_award_bit_number; |
7059 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7060 { |
7061 case 19: | |
7062 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7063 goto LABEL_40; | |
7064 v26 = 1; | |
7065 v23 = 26; | |
7066 goto LABEL_39; | |
7067 default: | |
7068 goto LABEL_41; | |
7069 case 20: | |
7070 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7071 goto LABEL_40; | |
7072 v26 = 1; | |
7073 v23 = 27; | |
7074 LABEL_39: | |
7075 if ( v1->_49327B(v23, v26) == 1 ) | |
7076 goto LABEL_40; | |
7077 return v35; | |
7078 case 30: | |
7079 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7080 goto LABEL_47; | |
7081 case 31: | |
7082 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7083 LABEL_47: | |
7084 if ( (v18 & 0x3Fu) < 0xA ) | |
7085 return v35; | |
7086 goto LABEL_41; | |
7087 case 21: | |
7088 case 23: | |
7089 case 24: | |
7090 case 25: | |
7091 case 26: | |
7092 case 29: | |
7093 case 32: | |
7094 case 34: | |
7095 case 35: | |
267 | 7096 gold_transaction_amount = 6000; |
0 | 7097 goto LABEL_42; |
7098 case 8: | |
7099 case 9: | |
7100 case 10: | |
7101 case 11: | |
267 | 7102 gold_transaction_amount = 7000; |
0 | 7103 goto LABEL_42; |
7104 case 7: | |
7105 break; | |
7106 } | |
7107 LABEL_67: | |
267 | 7108 gold_transaction_amount = 0; |
0 | 7109 goto LABEL_41; |
7110 } | |
7111 } | |
7112 return v35; | |
7113 } | |
7114 if ( v7 < 4 ) | |
7115 return v35; | |
492 | 7116 v17 = dword_F8B1AC_award_bit_number; |
7117 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7118 { | |
7119 if ( dword_F8B1AC_award_bit_number != 29 | |
7120 && dword_F8B1AC_award_bit_number != 32 | |
7121 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7122 { |
7123 LABEL_41: | |
267 | 7124 if ( !gold_transaction_amount ) |
0 | 7125 goto LABEL_79; |
7126 goto LABEL_42; | |
7127 } | |
7128 LABEL_87: | |
267 | 7129 gold_transaction_amount = 500; |
0 | 7130 goto LABEL_41; |
7131 } | |
492 | 7132 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7133 goto LABEL_87; |
492 | 7134 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7135 { |
267 | 7136 gold_transaction_amount = 0; |
0 | 7137 goto LABEL_79; |
7138 } | |
492 | 7139 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7140 goto LABEL_41; |
492 | 7141 if ( dword_F8B1AC_award_bit_number > 18 ) |
7142 { | |
7143 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7144 goto LABEL_41; |
7145 goto LABEL_87; | |
7146 } | |
267 | 7147 gold_transaction_amount = 1000; |
0 | 7148 LABEL_42: |
267 | 7149 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7150 return (char *)pNPCTopics[124].pText; |
7151 LABEL_79: | |
484 | 7152 contract_approved = 1; |
0 | 7153 if ( v34 == 2 ) |
7154 { | |
267 | 7155 v27 = gold_transaction_amount; |
0 | 7156 v24 = pSkillNames[v17]; |
7157 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7158 goto LABEL_90; | |
7159 } | |
7160 if ( v34 == 3 ) | |
7161 { | |
267 | 7162 v27 = gold_transaction_amount; |
0 | 7163 v24 = pSkillNames[v17]; |
7164 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7165 goto LABEL_90; | |
7166 } | |
7167 if ( v34 == 4 ) | |
7168 { | |
267 | 7169 v27 = gold_transaction_amount; |
0 | 7170 v24 = pSkillNames[v17]; |
7171 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7172 LABEL_90: | |
809 | 7173 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); |
0 | 7174 } |
7175 return pTmpBuf2; | |
7176 } | |
7177 | |
7178 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7179 const char * ContractSelectText( int pEventCode ) |
7180 { | |
7181 static const int dialogue_base=110; | |
484 | 7182 contract_approved = 0; |
492 | 7183 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7184 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7185 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7186 { | |
492 | 7187 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7188 { | |
7189 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7190 } |
7191 else | |
7192 { | |
267 | 7193 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7194 { |
484 | 7195 contract_approved = 1; |
492 | 7196 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7197 } |
7198 else | |
7199 { | |
492 | 7200 return pNPCTopics[dialogue_base+14].pText; |
0 | 7201 } |
7202 } | |
7203 } | |
7204 else | |
7205 { | |
492 | 7206 return pNPCTopics[dialogue_base+12].pText; |
0 | 7207 } |
7208 } | |
7209 | |
7210 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7211 void SimpleHouseAndBoatsDialog() |
0 | 7212 { |
7213 char *v0; // esi@3 | |
7214 char *v1; // ST1C_4@3 | |
7215 char *v2; // eax@3 | |
7216 const char *v3; // ST1C_4@5 | |
7217 int v4; // eax@5 | |
7218 unsigned int i; // eax@5 | |
7219 NPCData *v6; // esi@6 | |
7220 unsigned __int16 v7; // bx@6 | |
7221 unsigned int v8; // eax@6 | |
7222 int v9; // eax@11 | |
7223 unsigned int v10; // ecx@12 | |
7224 int v11; // eax@12 | |
7225 int v12; // esi@12 | |
7226 char *v13; // eax@12 | |
7227 GUIWindow *v14; // ebx@13 | |
7228 char *v15; // esi@14 | |
7229 GUIButton *v16; // eax@15 | |
7230 unsigned int v17; // ecx@15 | |
7231 int v18; // ecx@17 | |
7232 int v19; // ecx@18 | |
7233 int v20; // ecx@19 | |
7234 int v21; // ecx@20 | |
7235 int v22; // ecx@21 | |
7236 unsigned int v23; // ecx@23 | |
7237 int v24; // ecx@35 | |
7238 int v25; // ecx@36 | |
7239 int v26; // ecx@37 | |
7240 int v27; // ecx@38 | |
7241 int v28; // ecx@39 | |
7242 char *v29; // esi@42 | |
7243 unsigned int v30; // ST20_4@42 | |
7244 int v31; // ST1C_4@42 | |
7245 unsigned int v32; // eax@42 | |
7246 char *v33; // eax@43 | |
7247 int v34; // esi@51 | |
7248 int v35; // eax@51 | |
7249 unsigned int v36; // edi@51 | |
7250 GUIButton *v37; // eax@52 | |
7251 int v38; // eax@52 | |
7252 signed int v39; // ecx@54 | |
7253 int v40; // edi@57 | |
7254 GUIButton *v41; // eax@60 | |
7255 GUIButton *v42; // esi@60 | |
7256 const char *v43; // ebx@60 | |
7257 int v44; // eax@60 | |
7258 unsigned int v45; // ecx@60 | |
7259 unsigned __int16 v46; // ax@60 | |
7260 GUIFont *v47; // ebx@64 | |
7261 int v48; // esi@64 | |
7262 char *v49; // eax@66 | |
7263 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7264 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7265 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7266 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7267 int v55; // [sp+10Ch] [bp-10h]@6 | |
7268 int v56; // [sp+110h] [bp-Ch]@13 | |
7269 char *pInString; // [sp+114h] [bp-8h]@12 | |
7270 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7271 | |
7272 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7273 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7274 { |
7275 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7276 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7277 a1.uFrameX = 493; | |
7278 a1.uFrameWidth = 126; | |
7279 a1.uFrameZ = 366; | |
7280 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7281 a1.uFrameX = 483; | |
7282 a1.uFrameWidth = 148; | |
7283 a1.uFrameZ = 334; | |
434 | 7284 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7285 if ( !v2 ) |
7286 { | |
721 | 7287 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7288 v2 = pTmpBuf; |
7289 } | |
7290 v3 = v2; | |
7291 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7292 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7293 return; | |
0 | 7294 } |
7295 a1.uFrameWidth -= 10; | |
7296 a1.uFrameZ -= 10; | |
459 | 7297 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7298 v6 = v58; |
7299 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7300 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7301 v8 = v6->uProfession; | |
7302 if ( v8 ) | |
264 | 7303 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7304 else |
7305 strcpy(pTmpBuf, v6->pName); | |
7306 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7307 if ( !dword_591080 ) | |
7308 { | |
7309 if ( !uDialogueType ) | |
7310 { | |
7311 v9 = v6->greet; | |
7312 if ( v9 ) | |
7313 { | |
7314 v10 = v6->uFlags; | |
819 | 7315 a1.uFrameWidth = game_viewport_width; |
0 | 7316 a1.uFrameZ = 452; |
7317 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7318 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7319 v12 = v11 + 7; | |
7320 pRenderer->_4A6A68( | |
7321 8u, | |
7322 352 - (v11 + 7), | |
7323 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7324 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7325 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7326 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7327 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7328 } | |
7329 } | |
7330 } | |
7331 v14 = pDialogueWindow; | |
7332 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7333 v52.uFrameX = 483; | |
7334 v52.uFrameWidth = 148; | |
7335 v52.uFrameZ = 334; | |
7336 v56 = v52.pStartingPosActiveItem; | |
7337 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7338 { | |
348 | 7339 v15 = "";//(char *)v54; |
0 | 7340 while ( 1 ) |
7341 { | |
7342 v16 = v52.GetControl(v56); | |
832 | 7343 v17 = v16->msg_param; |
0 | 7344 pInString = (char *)v16; |
7345 if ( (signed int)v17 > 24 ) | |
7346 { | |
7347 v24 = v17 - 76; | |
7348 if ( !v24 ) | |
7349 { | |
7350 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7351 goto LABEL_49; | |
7352 } | |
7353 v25 = v24 - 1; | |
7354 if ( !v25 ) | |
7355 { | |
7356 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7357 goto LABEL_49; | |
7358 } | |
7359 v26 = v25 - 2; | |
7360 if ( !v26 ) | |
7361 { | |
7362 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7363 LABEL_44: | |
7364 v15 = v33; | |
7365 LABEL_45: | |
7366 v16 = (GUIButton *)pInString; | |
7367 goto LABEL_49; | |
7368 } | |
7369 v27 = v26 - 3; | |
7370 if ( !v27 ) | |
7371 { | |
459 | 7372 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7373 goto LABEL_44; |
7374 } | |
7375 v28 = v27 - 1; | |
7376 if ( !v28 ) | |
7377 { | |
7378 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7379 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7380 v31 = *(int *)v29; | |
7381 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7382 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7383 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7384 current_npc_text = pTmpBuf2; |
0 | 7385 v15 = ""; |
7386 goto LABEL_45; | |
7387 } | |
7388 if ( v28 != 10 ) | |
7389 goto LABEL_41; | |
7390 } | |
7391 else | |
7392 { | |
7393 if ( v17 == 24 ) | |
7394 { | |
291 | 7395 v23 = v58->evt_F; |
0 | 7396 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7397 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7398 if ( !v15 ) |
7399 { | |
832 | 7400 v16->msg_param = 0; |
0 | 7401 v15 = ""; |
7402 } | |
7403 goto LABEL_49; | |
7404 } | |
7405 v18 = v17 - 13; | |
7406 if ( v18 ) | |
7407 { | |
7408 v19 = v18 - 6; | |
7409 if ( !v19 ) | |
7410 { | |
291 | 7411 v23 = v58->evt_A; |
0 | 7412 goto LABEL_33; |
7413 } | |
7414 v20 = v19 - 1; | |
7415 if ( !v20 ) | |
7416 { | |
291 | 7417 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7418 if ( !v15 ) |
7419 { | |
832 | 7420 v16->msg_param = 0; |
0 | 7421 v15 = ""; |
7422 } | |
7423 if ( uDialogueType != 84 ) | |
7424 goto LABEL_49; | |
484 | 7425 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7426 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7427 current_npc_text = pTmpBuf2; | |
0 | 7428 goto LABEL_45; |
7429 } | |
7430 v21 = v20 - 1; | |
7431 if ( !v21 ) | |
7432 { | |
291 | 7433 v23 = v58->evt_C; |
0 | 7434 goto LABEL_33; |
7435 } | |
7436 v22 = v21 - 1; | |
7437 if ( !v22 ) | |
7438 { | |
291 | 7439 v23 = v58->evt_D; |
0 | 7440 goto LABEL_33; |
7441 } | |
7442 if ( v22 == 1 ) | |
7443 { | |
291 | 7444 v23 = v58->evt_E; |
0 | 7445 goto LABEL_33; |
7446 } | |
7447 LABEL_41: | |
7448 v15 = ""; | |
7449 goto LABEL_49; | |
7450 } | |
7451 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7452 } | |
7453 LABEL_49: | |
7454 strcpy(v16->pButtonName, v15); | |
7455 ++v56; | |
7456 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7457 { | |
7458 v14 = pDialogueWindow; | |
7459 break; | |
7460 } | |
7461 } | |
7462 } | |
7463 v34 = 0; | |
7464 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7465 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7466 v36 = v14->pStartingPosActiveItem; | |
7467 v55 = v35; | |
7468 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7469 + pDialogueWindow->pStartingPosActiveItem ) | |
7470 { | |
7471 v37 = v14->GetControl(v36); | |
7472 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7473 v14 = pDialogueWindow; | |
7474 v34 += v38; | |
7475 ++v36; | |
7476 } | |
7477 v39 = v14->pNumPresenceButton; | |
7478 if ( v39 ) | |
7479 { | |
7480 v58 = (NPCData *)((174 - v34) / v39); | |
7481 if ( (signed int)v58 > 32 ) | |
7482 v58 = (NPCData *)32; | |
7483 pInString = (char *)2; | |
7484 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7485 v56 = v14->pStartingPosActiveItem; | |
7486 i = v56; | |
7487 if ( (signed int)i < (signed int)(i + v39) ) | |
7488 { | |
7489 while ( 1 ) | |
7490 { | |
7491 v41 = v14->GetControl(i); | |
7492 v42 = v41; | |
7493 v43 = v41->pButtonName; | |
7494 v41->uY = (unsigned int)((char *)v58 + v40); | |
7495 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7496 v45 = v42->uY; | |
7497 v42->uHeight = v44; | |
7498 v40 = v45 + v44 - 1; | |
7499 v42->uW = v40; | |
7500 v46 = v55; | |
7501 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7502 v46 = v54; | |
7503 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7504 v14 = pDialogueWindow; | |
7505 ++pInString; | |
7506 ++v56; | |
7507 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7508 if ( v56 >= (signed int)i ) | |
7509 break; | |
7510 i = v56; | |
7511 } | |
7512 } | |
7513 } | |
827 | 7514 if ( current_npc_text ) |
0 | 7515 { |
7516 w.uFrameWidth = 458; | |
7517 w.uFrameZ = 457; | |
7518 v47 = pFontArrus; | |
827 | 7519 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7520 if ( 352 - v48 < 8 ) |
7521 { | |
7522 v47 = pFontCreate; | |
827 | 7523 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7524 } |
7525 pRenderer->_4A6A68( | |
7526 8u, | |
7527 352 - v48, | |
7528 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7529 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7530 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
827 | 7531 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7532 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7533 } | |
0 | 7534 } |
7535 | |
7536 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7537 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7538 { |
832 | 7539 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7540 } |
7541 | |
7542 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7543 void sub_4B3A72( int a1 ) |
7544 { | |
7545 int num_buttons; // esi@1 | |
7546 | |
7547 num_buttons = 0; | |
0 | 7548 if ( a1 == 21 ) |
7549 { | |
473 | 7550 CreateButtonInColumn(0, 0x66u); |
7551 num_buttons = 2; | |
7552 CreateButtonInColumn(1, 0x67u); | |
7553 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7554 { | |
7555 num_buttons = 3; | |
7556 CreateButtonInColumn(2, 0x68u); | |
7557 } | |
7558 } | |
7559 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7560 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7561 } | |
7562 // F8B1E0: using guessed type int dword_F8B1E0; | |
7563 | |
7564 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7565 void sub_4B3AD4( signed int a1 ) |
7566 { | |
0 | 7567 if ( a1 > 0 ) |
7568 { | |
7569 if ( a1 <= 3 ) | |
7570 { | |
473 | 7571 CreateButtonInColumn(0, 3u); |
7572 CreateButtonInColumn(1, 4u); | |
7573 CreateButtonInColumn(2, 5u); | |
7574 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7575 } |
7576 if ( a1 == 4 ) | |
7577 { | |
473 | 7578 CreateButtonInColumn(0, 3u); |
7579 CreateButtonInColumn(1, 4u); | |
7580 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7581 } | |
7582 } | |
0 | 7583 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7584 } | |
7585 // F8B1E0: using guessed type int dword_F8B1E0; | |
7586 | |
7587 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7588 void sub_4B3B42( signed int a1 ) |
7589 { | |
0 | 7590 int v1; // ecx@18 |
7591 int v2; // ecx@19 | |
7592 int v3; // ecx@20 | |
7593 signed int v4; // esi@22 | |
7594 signed int v5; // eax@22 | |
7595 unsigned int v6; // edx@24 | |
7596 int v7; // ecx@24 | |
7597 int result; // eax@43 | |
7598 int v9; // [sp-10h] [bp-14h]@28 | |
7599 int v10; // [sp-Ch] [bp-10h]@28 | |
7600 int v11; // [sp-8h] [bp-Ch]@28 | |
7601 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7602 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7603 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7604 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7605 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7606 int v17; // [sp-4h] [bp-8h]@28 | |
7607 | |
7608 if ( a1 > 13 ) | |
7609 { | |
7610 if ( a1 > 22 ) | |
7611 { | |
7612 if ( a1 == 23 ) | |
7613 { | |
473 | 7614 CreateButtonInColumn(0, 0xAu); |
7615 CreateButtonInColumn(1, 0xBu); | |
0 | 7616 v14 = 96; |
7617 LABEL_41: | |
473 | 7618 CreateButtonInColumn(2, v14); |
0 | 7619 v17 = 2; |
7620 v11 = 0; | |
7621 v10 = 1; | |
7622 v9 = 3; | |
7623 goto LABEL_42; | |
7624 } | |
7625 if ( a1 <= 26 ) | |
7626 goto LABEL_43; | |
7627 if ( a1 > 28 ) | |
7628 { | |
7629 if ( a1 != 30 ) | |
7630 goto LABEL_43; | |
473 | 7631 CreateButtonInColumn(0, 0x11u); |
0 | 7632 v16 = 96; |
7633 goto LABEL_37; | |
7634 } | |
473 | 7635 CreateButtonInColumn(0, 0x69u); |
7636 CreateButtonInColumn(1, 0x6Au); | |
7637 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7638 v12 = 108; |
7639 } | |
7640 else | |
7641 { | |
7642 if ( a1 == 22 ) | |
7643 { | |
473 | 7644 CreateButtonInColumn(0, 7u); |
0 | 7645 v16 = 8; |
7646 goto LABEL_37; | |
7647 } | |
7648 v1 = a1 - 14; | |
7649 if ( !v1 ) | |
7650 { | |
473 | 7651 CreateButtonInColumn(0, 0x12u); |
7652 CreateButtonInColumn(1, 0x30u); | |
7653 CreateButtonInColumn(2, 0x31u); | |
7654 CreateButtonInColumn(3, 0x32u); | |
7655 CreateButtonInColumn(4, 0x33u); | |
0 | 7656 v17 = 2; |
7657 v11 = 0; | |
7658 v10 = 1; | |
7659 v9 = 5; | |
7660 goto LABEL_42; | |
7661 } | |
7662 v2 = v1 - 1; | |
7663 if ( v2 ) | |
7664 { | |
7665 v3 = v2 - 2; | |
7666 if ( v3 ) | |
7667 { | |
7668 if ( v3 != 4 ) | |
7669 goto LABEL_43; | |
473 | 7670 CreateButtonInColumn(0, 0xFu); |
7671 CreateButtonInColumn(1, 0x10u); | |
0 | 7672 v4 = 3; |
473 | 7673 CreateButtonInColumn(2, 0x60u); |
336 | 7674 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7675 if ( v5 < 108 || v5 > 120 ) |
7676 goto LABEL_28; | |
7677 v4 = 4; | |
7678 v6 = 101; | |
7679 v7 = 3; | |
7680 } | |
7681 else | |
7682 { | |
7683 v4 = 1; | |
473 | 7684 CreateButtonInColumn(0, 0x63u); |
0 | 7685 if ( !pParty->uFine ) |
7686 { | |
7687 LABEL_28: | |
7688 v17 = 2; | |
7689 v11 = 0; | |
7690 v10 = 1; | |
7691 v9 = v4; | |
7692 LABEL_42: | |
7693 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7694 goto LABEL_43; | |
7695 } | |
7696 v4 = 2; | |
7697 v7 = 1; | |
7698 v6 = 100; | |
7699 } | |
473 | 7700 CreateButtonInColumn(v7, v6); |
0 | 7701 goto LABEL_28; |
7702 } | |
473 | 7703 CreateButtonInColumn(0, 0x12u); |
7704 CreateButtonInColumn(1, 0x34u); | |
7705 CreateButtonInColumn(2, 0x35u); | |
0 | 7706 v12 = 54; |
7707 } | |
7708 LABEL_39: | |
473 | 7709 CreateButtonInColumn(3, v12); |
0 | 7710 v17 = 2; |
7711 v11 = 0; | |
7712 v10 = 1; | |
7713 v9 = 4; | |
7714 goto LABEL_42; | |
7715 } | |
7716 if ( a1 == 13 ) | |
7717 { | |
473 | 7718 CreateButtonInColumn(0, 0x12u); |
0 | 7719 v16 = 56; |
7720 LABEL_37: | |
473 | 7721 CreateButtonInColumn(1, v16); |
0 | 7722 v17 = 2; |
7723 v11 = 0; | |
7724 v10 = 1; | |
7725 v9 = 2; | |
7726 goto LABEL_42; | |
7727 } | |
7728 switch ( a1 ) | |
7729 { | |
7730 case 1: | |
7731 case 2: | |
7732 case 3: | |
7733 case 4: | |
473 | 7734 CreateButtonInColumn(0, 2u); |
7735 CreateButtonInColumn(1, 0x5Fu); | |
7736 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7737 v12 = 96; |
7738 goto LABEL_39; | |
7739 case 5: | |
473 | 7740 CreateButtonInColumn(0, 0x12u); |
0 | 7741 v13 = 48; |
7742 goto LABEL_9; | |
7743 case 6: | |
473 | 7744 CreateButtonInColumn(0, 0x12u); |
0 | 7745 v13 = 49; |
7746 goto LABEL_9; | |
7747 case 7: | |
473 | 7748 CreateButtonInColumn(0, 0x12u); |
0 | 7749 v13 = 50; |
7750 goto LABEL_9; | |
7751 case 8: | |
473 | 7752 CreateButtonInColumn(0, 0x12u); |
0 | 7753 v13 = 51; |
7754 LABEL_9: | |
473 | 7755 CreateButtonInColumn(1, v13); |
0 | 7756 v14 = 72; |
7757 goto LABEL_41; | |
7758 case 9: | |
473 | 7759 CreateButtonInColumn(0, 0x12u); |
0 | 7760 v15 = 52; |
7761 goto LABEL_13; | |
7762 case 10: | |
473 | 7763 CreateButtonInColumn(0, 0x12u); |
0 | 7764 v15 = 53; |
7765 goto LABEL_13; | |
7766 case 11: | |
473 | 7767 CreateButtonInColumn(0, 0x12u); |
0 | 7768 v15 = 54; |
7769 LABEL_13: | |
473 | 7770 CreateButtonInColumn(1, v15); |
0 | 7771 v14 = 61; |
7772 goto LABEL_41; | |
7773 case 12: | |
473 | 7774 CreateButtonInColumn(0, 0x12u); |
0 | 7775 v16 = 55; |
7776 goto LABEL_37; | |
7777 default: | |
7778 break; | |
7779 } | |
7780 LABEL_43: | |
7781 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7782 } | |
7783 // F8B1E0: using guessed type int dword_F8B1E0; | |
7784 | |
7785 //----- (004B3E1E) -------------------------------------------------------- | |
7786 void __cdecl sub_4B3E1E() | |
7787 { | |
7788 NPCData *v0; // ST40_4@1 | |
7789 signed int v1; // edi@1 | |
165 | 7790 //GUIWindow *v2; // ecx@1 |
0 | 7791 |
167 | 7792 __debugbreak(); |
602 | 7793 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7794 v1 = 0; |
7795 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7796 pDialogueWindow->Release(); | |
165 | 7797 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7798 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7799 { |
832 | 7800 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7801 v1 = 1; |
7802 } | |
832 | 7803 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7804 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7805 } | |
7806 | |
7807 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7808 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7809 { |
467 | 7810 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7811 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7812 ContractSelectText(pEventCode); |
0 | 7813 pDialogueWindow->Release(); |
492 | 7814 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
832 | 7815 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], // Cancel |
7816 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
7817 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7818 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
0 | 7819 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7820 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7821 } |
7822 // F8B19C: using guessed type int dword_F8B19C; | |
7823 | |
7824 //----- (004B3FE5) -------------------------------------------------------- | |
7825 void __fastcall sub_4B3FE5(int a4) | |
7826 { | |
7827 int v1; // edi@1 | |
7828 char *v2; // edi@1 | |
7829 | |
7830 v1 = a4; | |
7831 uDialogueType = 78; | |
827 | 7832 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7833 _4B254D_SkillMasteryTeacher(a4); |
7834 pDialogueWindow->Release(); | |
7835 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7836 v2 = ""; | |
832 | 7837 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7838 pGlobalTXT_LocalizationStrings[34], |
526 | 7839 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7840 0); |
832 | 7841 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7842 if ( contract_approved ) |
0 | 7843 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7844 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
0 | 7845 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7846 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7847 } |
7848 // F8B19C: using guessed type int dword_F8B19C; | |
7849 // F8B1A8: using guessed type int dword_F8B1A8; | |
7850 | |
7851 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7852 void NPCHireableDialogPrepare() |
7853 { | |
0 | 7854 signed int v0; // ebx@1 |
7855 NPCData *v1; // edi@1 | |
7856 | |
7857 v0 = 0; | |
459 | 7858 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7859 pDialogueWindow->Release(); |
7860 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7861 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7862 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
526 | 7863 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7864 0); |
832 | 7865 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7866 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7867 { |
832 | 7868 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7869 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7870 v0 = 1; |
7871 } | |
832 | 7872 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7873 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
0 | 7874 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7875 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7876 } |
7877 | |
7878 //----- (004B4224) -------------------------------------------------------- | |
423 | 7879 void _4B4224_UpdateNPCTopics( int _this ) |
7880 { | |
7881 int num_menu_buttons; // ebx@1 | |
0 | 7882 int i; // ebp@5 |
423 | 7883 // signed int v4; // ebp@9 |
7884 int v6; // eax@16 | |
7885 int v8; // eax@21 | |
7886 int v10; // eax@26 | |
7887 int v12; // eax@31 | |
7888 int v14; // eax@36 | |
7889 int v16; // eax@41 | |
0 | 7890 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7891 | |
423 | 7892 num_menu_buttons = 0; |
459 | 7893 pDialogueNPCCount = (_this + 1); |
0 | 7894 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7895 { | |
7896 pDialogueWindow->Release(); | |
7897 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7898 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
832 | 7899 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0x4Eu, |
0 | 7900 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7901 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
832 | 7902 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, UIMSG_BF, 1u, 0x59u, |
423 | 7903 sHouseName, |
7904 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
832 | 7905 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
7906 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, UIMSG_BF, 1u, 0x59u, sHouseName, 0); | |
0 | 7907 } |
7908 else | |
7909 { | |
459 | 7910 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7911 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7912 { |
7913 pDialogueWindow->Release(); | |
7914 } | |
7915 else | |
7916 { | |
7917 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7918 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7919 } |
7920 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7921 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7922 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 7923 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
832 | 7924 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7925 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7926 { |
484 | 7927 sub_4B3B42(in_current_building_type); |
0 | 7928 } |
7929 else | |
7930 { | |
7931 if ( v17->joins ) | |
7932 { | |
423 | 7933 num_menu_buttons = 1; |
858 | 7934 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7935 } |
423 | 7936 if ( v17->evt_A) |
7937 { | |
7938 if ( num_menu_buttons < 4 ) | |
7939 { | |
7940 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7941 if ( v6 == 1 || v6 == 2 ) |
832 | 7942 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7943 } |
7944 } | |
7945 if ( v17->evt_B ) | |
7946 { | |
7947 if ( num_menu_buttons < 4 ) | |
7948 { | |
7949 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7950 if ( v8 == 1 || v8 == 2 ) |
832 | 7951 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7952 } |
7953 } | |
7954 if ( v17->evt_C ) | |
7955 { | |
7956 if ( num_menu_buttons < 4 ) | |
7957 { | |
7958 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7959 if ( v10 == 1 || v10 == 2 ) |
832 | 7960 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7961 } |
7962 } | |
7963 | |
7964 if ( v17->evt_D ) | |
7965 { | |
7966 if ( num_menu_buttons < 4 ) | |
7967 { | |
7968 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7969 if ( v12 == 1 || v12 == 2 ) |
832 | 7970 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7971 } |
7972 } | |
7973 if ( v17->evt_E ) | |
7974 { | |
7975 if ( num_menu_buttons < 4 ) | |
7976 { | |
7977 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7978 if ( v14 == 1 || v14 == 2 ) |
832 | 7979 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7980 } |
7981 } | |
7982 if ( v17->evt_F ) | |
7983 { | |
7984 if ( num_menu_buttons < 4 ) | |
7985 { | |
7986 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7987 if ( v16 == 1 || v16 == 2 ) |
832 | 7988 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7989 } |
7990 } | |
7991 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 7992 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7993 } | |
747 | 7994 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7995 } |
7996 | |
0 | 7997 } |
7998 | |
7999 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8000 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8001 { |
0 | 8002 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8003 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8004 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8005 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8006 } |
8007 | |
8008 //----- (004B46F8) -------------------------------------------------------- | |
8009 int __fastcall sub_4B46F8(int a1) | |
8010 { | |
8011 int v1; // eax@1 | |
8012 int i; // edx@1 | |
8013 | |
8014 v1 = 0; | |
8015 for ( i = 0; i < a1; ++i ) | |
8016 v1 += i + 1; | |
8017 return 1000 * v1; | |
8018 } | |
8019 | |
8020 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8021 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8022 { |
656 | 8023 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8024 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8025 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8026 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8027 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8028 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8029 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8030 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8031 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8032 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8033 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8034 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8035 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8036 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8037 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8038 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8039 //v1 = _this; |
656 | 8040 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8041 //v3 = v1; |
656 | 8042 uDialogueType = newDialogueType; |
8043 if (!speakingNPC->uFlags) | |
8044 { | |
8045 speakingNPC->uFlags = 1; | |
8046 //v3 = uDialogueType; | |
8047 } | |
8048 | |
8049 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8050 { | |
8051 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8052 } | |
8053 else if(newDialogueType == DIALOGUE_76) | |
8054 { | |
8055 if (speakingNPC->Hired()) | |
8056 { | |
8057 v8 = 0; | |
8058 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8059 { | |
8060 v6 = (char *)pNPCStats->pNewNPCData; | |
8061 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8062 { | |
8063 ++v8; | |
8064 v6 += 76; | |
8065 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8066 break; | |
8067 } | |
8068 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8069 v6[8] &= 0x7Fu; | |
8070 } | |
8071 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8072 { | |
8073 v11 = pParty->pHirelings; | |
8074 memset(v11, 0, sizeof(NPCData)); | |
8075 } | |
8076 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8077 { | |
8078 v11 = &pParty->pHirelings[1]; | |
8079 memset(v11, 0, sizeof(NPCData)); | |
8080 } | |
8081 pParty->field_709 = 0; | |
659 | 8082 Party__CountHirelings(); |
656 | 8083 dword_591084 = 0; |
8084 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8085 dword_7241C8 = 0; | |
8086 return; | |
8087 } | |
8088 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8089 { | |
8090 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8091 ShowStatusBarString(v7, 2u); | |
8092 } | |
8093 else | |
8094 { | |
8095 //v9 = v2->uProfession; | |
8096 if ( speakingNPC->uProfession != 51 ) | |
8097 { | |
8098 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8099 if ( pParty->uNumGold < v10 ) | |
8100 { | |
8101 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8102 dialogue_show_profession_details = false; | |
8103 uDialogueType = 13; | |
8104 if ( uActiveCharacter ) | |
8105 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8106 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8107 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8108 if ( !dword_7241C8 ) | |
8109 pGame->Draw(); | |
8110 dword_7241C8 = 0; | |
8111 return; | |
8112 } | |
8113 Party::TakeGold(v10); | |
8114 } | |
8115 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8116 if ( pParty->pHirelings[0].pName ) | |
8117 { | |
8118 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8119 v15 = speakingNPC->pName; | |
8120 v13 = pParty->pHireling2Name; | |
8121 } | |
8122 else | |
8123 { | |
8124 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8125 v15 = speakingNPC->pName; | |
8126 v13 = pParty->pHireling1Name; | |
8127 } | |
8128 strcpy(v13, v15); | |
8129 pParty->field_709 = 0; | |
659 | 8130 Party__CountHirelings(); |
656 | 8131 |
8132 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8133 | |
711 | 8134 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8135 pDialogue_SpeakingActor->uAIState = Removed; |
8136 if ( uActiveCharacter ) | |
8137 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8138 } | |
8139 } | |
8140 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8141 { | |
8142 ArenaFight(); | |
8143 return; | |
8144 } | |
8145 else if(newDialogueType == DIALOGUE_9) | |
8146 { | |
8147 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8148 { | |
8149 if ( speakingNPC->uProfession != 41 ) | |
8150 speakingNPC->bHasUsedTheAbility = 1; | |
8151 | |
8152 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8153 } | |
8154 else | |
8155 { | |
8156 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8157 } | |
8158 } | |
8159 else if(newDialogueType == DIALOGUE_13) | |
8160 { | |
8161 if (!speakingNPC->Hired()) | |
8162 { | |
8163 sub_4B3E1E(); | |
8164 dialogue_show_profession_details = false; | |
8165 } | |
8166 else | |
8167 { | |
8168 v5 = 0; | |
8169 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8170 { | |
8171 v6 = (char *)pNPCStats->pNewNPCData; | |
8172 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8173 { | |
8174 ++v5; | |
8175 v6 += 76; | |
8176 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8177 break; | |
8178 } | |
8179 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8180 v6[8] &= 0x7Fu; | |
8181 } | |
8182 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8183 { | |
8184 v11 = pParty->pHirelings; | |
8185 memset(v11, 0, sizeof(NPCData)); | |
8186 } | |
8187 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8188 { | |
8189 v11 = &pParty->pHirelings[1]; | |
8190 memset(v11, 0, sizeof(NPCData)); | |
8191 } | |
8192 pParty->field_709 = 0; | |
659 | 8193 Party__CountHirelings(); |
656 | 8194 dword_591084 = 0; |
8195 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8196 dword_7241C8 = 0; | |
8197 return; | |
8198 } | |
8199 } | |
8200 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8201 { | |
8202 switch(newDialogueType) | |
8203 { | |
8204 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8205 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8206 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8207 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8208 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8209 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8210 } | |
8211 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8212 sub_4B3FE5(npc_event_id); //200-310 | |
8213 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8214 { //400-410 | |
8215 dword_F8B1D8 = newDialogueType; | |
8216 DrawJoinGuildWindow(npc_event_id - 400); | |
8217 } | |
8218 else | |
8219 { | |
8220 switch ( npc_event_id ) | |
8221 { | |
8222 case 139: | |
8223 sub_4B1ECE(); | |
8224 break; | |
8225 case 311: | |
8226 sub_4BBA85_bounties(); | |
8227 break; | |
8228 case 399: | |
8229 sub_4BBCDD(); | |
8230 break; | |
8231 default: | |
8232 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8233 current_npc_text = 0; |
656 | 8234 EventProcessor(npc_event_id, 0, 1); |
8235 activeLevelDecoration = NULL; | |
8236 break; | |
8237 } | |
8238 } | |
8239 } | |
8240 if ( !dword_7241C8 ) | |
8241 pGame->Draw(); | |
8242 dword_7241C8 = 0; | |
8243 } | |
0 | 8244 |
8245 //----- (004BDAAF) -------------------------------------------------------- | |
8246 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
8247 { | |
8248 int v2; // edx@1 | |
8249 unsigned int v3; // esi@1 | |
8250 unsigned int v4; // eax@1 | |
8251 signed int v5; // edi@1 | |
8252 int v6; // edx@8 | |
8253 int v7; // edx@9 | |
8254 int v8; // edx@10 | |
8255 unsigned __int8 v9; // zf@16 | |
8256 char v10; // sf@16 | |
8257 unsigned __int8 v11; // of@16 | |
702 | 8258 bool test; |
0 | 8259 |
8260 auto a2 = _2da_idx; | |
8261 //v2 = p2DEvents_minus1___00[26 * a2]; | |
8262 v2 = p2DEvents[a2 - 1].uType; | |
8263 v3 = a1->uItemID; | |
8264 v4 = a1->uItemID; | |
8265 v5 = pItemsTable->pItems[v4].uEquipType; | |
8266 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 8267 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 8268 return 0; |
702 | 8269 switch( p2DEvents[a2 - 1].uType ) |
8270 { | |
8271 case BildingType_WeaponShop: | |
8272 { | |
8273 test = v5 <= 2; | |
8274 break; | |
8275 } | |
8276 case BildingType_ArmorShop: | |
8277 { | |
8278 test = v5 >= 3; | |
8279 break; | |
8280 } | |
8281 case BildingType_MagicShop: | |
8282 { | |
8283 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
8284 break; | |
8285 } | |
8286 case BildingType_AlchemistShop: | |
8287 { | |
8288 __debugbreak(); // need to test | |
8289 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
8290 break; | |
8291 } | |
8292 default: | |
8293 { | |
8294 test = 0; | |
8295 break; | |
8296 } | |
8297 } | |
8298 | |
8299 return test; | |
8300 /* | |
8301 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8302 { |
8303 v11 = __OFSUB__(v5, 2); | |
8304 v9 = v5 == 2; | |
8305 v10 = v5 - 2 < 0; | |
8306 goto LABEL_23; | |
8307 } | |
702 | 8308 if ( p2DEvents[a2 - 1].uType > 2 ) |
8309 { | |
8310 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8311 { |
8312 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8313 return v5 == 16; | |
8314 return 1; | |
8315 } | |
702 | 8316 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8317 return 0; |
702 | 8318 if ( p2DEvents[a2 - 1].uType == 4) |
8319 { | |
8320 if ( v5 < 13 ) | |
8321 return 0; | |
8322 if ( v5 <= 14 ) | |
8323 return 1; | |
8324 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8325 return 0; | |
8326 v11 = __OFSUB__(v3, 771); | |
8327 v9 = v3 == 771; | |
8328 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8329 LABEL_23: |
702 | 8330 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8331 return 0; | |
8332 return 1; | |
8333 } | |
8334 } | |
8335 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8336 { | |
8337 if ( v5 >= 3 ) | |
8338 { | |
8339 v11 = __OFSUB__(v5, 9); | |
8340 v9 = v5 == 9; | |
8341 v10 = v5 - 9 < 0; | |
8342 goto LABEL_23; | |
8343 } | |
0 | 8344 } |
8345 return 0; | |
702 | 8346 */ |
0 | 8347 } |
8348 | |
8349 //----- (004B6478) -------------------------------------------------------- | |
711 | 8350 void sub_4B6478() |
8351 { | |
0 | 8352 GUIWindow *v0; // ebx@1 |
8353 Player *v1; // edi@1 | |
8354 unsigned int v2; // eax@1 | |
8355 signed int v3; // esi@1 | |
8356 int v4; // ebx@1 | |
8357 unsigned int v5; // esi@5 | |
8358 int v6; // edi@6 | |
8359 int result; // eax@13 | |
8360 GUIWindow *v8; // ebx@17 | |
8361 int v9; // eax@17 | |
8362 int v10; // ecx@17 | |
8363 unsigned int v11; // ecx@18 | |
8364 int v12; // eax@20 | |
8365 int v13; // eax@21 | |
8366 GUIButton *v14; // esi@27 | |
8367 int v15; // ecx@27 | |
8368 unsigned int v16; // eax@28 | |
8369 const char *v17; // ebx@29 | |
8370 int v18; // eax@29 | |
8371 unsigned int v19; // ecx@29 | |
8372 int v20; // eax@29 | |
8373 unsigned __int16 v21; // ax@29 | |
8374 unsigned __int16 v22; // ST14_2@36 | |
8375 int v23; // eax@36 | |
8376 const char *v24; // ST18_4@37 | |
8377 unsigned __int16 v25; // ST14_2@37 | |
8378 int v26; // eax@37 | |
8379 int v27; // [sp-4h] [bp-80h]@8 | |
8380 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8381 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8382 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8383 int v31; // [sp+68h] [bp-14h]@1 | |
8384 int v32; // [sp+6Ch] [bp-10h]@1 | |
8385 int v33; // [sp+70h] [bp-Ch]@17 | |
8386 int v34; // [sp+74h] [bp-8h]@17 | |
8387 int v35; // [sp+78h] [bp-4h]@17 | |
8388 | |
336 | 8389 v0 = window_SpeakInHouse; |
8390 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8391 v1 = pPlayers[uActiveCharacter]; |
8392 v28.uFrameX = 483; | |
8393 v28.uFrameWidth = 148; | |
8394 v28.uFrameZ = 334; | |
8395 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8396 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8397 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8398 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8399 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8400 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8401 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8402 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8403 v32 = v4; | |
8404 if ( v4 < v3 / 3 ) | |
8405 { | |
8406 v4 = v3 / 3; | |
8407 v32 = v3 / 3; | |
8408 } | |
749 | 8409 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8410 { |
8411 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8412 { | |
8413 v5 = 0; | |
8414 | |
8415 __debugbreak(); | |
8416 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8417 // or | |
8418 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8419 // or | |
8420 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8421 __debugbreak(); // whacky condition - fix |
0 | 8422 if (false |
8423 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8424 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8425 { |
8426 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8427 } | |
8428 else | |
8429 { | |
8430 if ( pParty->uNumGold < v4 ) | |
8431 { | |
8432 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8433 v27 = 4; | |
8434 } | |
8435 else | |
8436 { | |
8437 Party::TakeGold(v4); | |
8438 *(short *)v6 = 1; | |
8439 v27 = 2; | |
8440 } | |
735 | 8441 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8442 } |
8443 } | |
8444 else | |
8445 { | |
8446 v5 = 0; | |
8447 } | |
437 | 8448 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8449 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8450 { | |
8451 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8452 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8453 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8454 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8455 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8456 }*/ |
8457 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8458 return; // void func |
0 | 8459 } |
484 | 8460 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8461 { |
8462 v24 = pNPCTopics[171].pText; | |
8463 v25 = v31; | |
8464 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8465 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8466 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8467 return ; |
8468 } | |
8469 | |
8470 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8471 return; | |
0 | 8472 v8 = pDialogueWindow; |
8473 v33 = 0; | |
8474 v34 = 0; | |
8475 v29 = pDialogueWindow; | |
8476 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8477 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8478 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8479 if ( v9 >= v10 ) | |
8480 goto LABEL_40; | |
8481 do | |
8482 { | |
832 | 8483 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8484 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8485 { |
8486 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8487 v33 += v12; | |
8488 ++v34; | |
8489 } | |
8490 v13 = v8->pStartingPosActiveItem; | |
8491 ++v35; | |
8492 } | |
8493 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8494 if ( !v34 ) | |
8495 { | |
8496 LABEL_40: | |
135 | 8497 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8498 strcat(pTmpBuf, "\n \n"); |
8499 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8500 v22 = v31; | |
8501 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8502 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8503 return; | |
0 | 8504 } |
8505 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8506 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8507 v32 = (149 - v33) / v34; | |
8508 if ( (149 - v33) / v34 > 32 ) | |
8509 v32 = 32; | |
711 | 8510 |
8511 v35 = v8->pStartingPosActiveItem; | |
0 | 8512 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8513 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8514 { |
8515 v33 = 2; | |
8516 do | |
8517 { | |
8518 v14 = v8->GetControl(v35); | |
832 | 8519 v15 = v14->msg_param - 36; |
135 | 8520 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8521 { |
8522 v16 = 0; | |
8523 if ( !v1->pActiveSkills[v15] ) | |
8524 { | |
8525 v17 = pSkillNames[v15]; | |
8526 v14->uY = v32 + v34; | |
8527 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8528 v19 = v14->uY; | |
8529 v14->uHeight = v18; | |
8530 v20 = v19 + v18 - 1; | |
8531 v14->uW = v20; | |
8532 v34 = v20; | |
8533 v21 = v31; | |
8534 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8535 v21 = v30; | |
8536 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8537 goto LABEL_34; | |
8538 } | |
8539 } | |
8540 else | |
8541 { | |
8542 v16 = 0; | |
8543 } | |
8544 v14->uW = v16; | |
8545 v14->uHeight = v16; | |
8546 v14->uY = v16; | |
8547 LABEL_34: | |
8548 v8 = v29; | |
8549 ++v35; | |
8550 ++v33; | |
711 | 8551 } |
8552 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8553 } | |
8554 return; | |
0 | 8555 } |
8556 | |
8557 //----- (00405CFF) -------------------------------------------------------- | |
8558 void stru262_TurnBased::End(bool bPlaySound) | |
8559 { | |
8560 stru262_TurnBased *v2; // edi@1 | |
8561 int v3; // ebx@1 | |
8562 int v4; // esi@1 | |
8563 unsigned __int8 v5; // zf@1 | |
8564 unsigned __int8 v6; // sf@1 | |
8565 TurnBased_QueueElem *v7; // ecx@2 | |
8566 unsigned __int16 *pAttributes; // ecx@7 | |
8567 size_t v9; // edx@7 | |
8568 unsigned __int16 v10; // ax@8 | |
8569 TurnBased_QueueElem *v11; // ebx@12 | |
8570 ObjectType objType; // eax@13 | |
8571 int objID; // esi@13 | |
8572 int v14; // [sp+Ch] [bp-4h]@11 | |
8573 | |
8574 v2 = this; | |
8575 v3 = 0; | |
8576 v4 = 0; | |
8577 v5 = this->uActorQueueSize == 0; | |
8578 v6 = this->uActorQueueSize < 0; | |
8579 this->field_4 = 0; | |
8580 if ( !(v6 | v5) ) | |
8581 { | |
8582 v7 = this->pQueue; | |
8583 do | |
8584 { | |
848 | 8585 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8586 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8587 ++v4; |
8588 ++v7; | |
8589 } | |
8590 while ( v4 < v2->uActorQueueSize ); | |
8591 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8592 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8593 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8594 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8595 v9 = uNumSpriteObjects; |
0 | 8596 do |
8597 { | |
8598 v10 = *pAttributes; | |
8599 if ( *pAttributes & 4 ) | |
8600 { | |
8601 LOBYTE(v10) = v10 & 0xFB; | |
8602 *pAttributes = v10; | |
8603 } | |
8604 pAttributes += 56; | |
8605 --v9; | |
8606 } | |
8607 while ( v9 ); | |
8608 } | |
8609 v14 = 0; | |
8610 if ( v2->uActorQueueSize > 0 ) | |
8611 { | |
8612 v11 = v2->pQueue; | |
8613 do | |
8614 { | |
848 | 8615 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8616 objID = PID_ID(v11->uPackedID); | |
0 | 8617 if ( objType == OBJECT_Player ) |
8618 { | |
8619 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8620 } | |
8621 else | |
8622 { | |
8623 if ( objType == OBJECT_Actor ) | |
8624 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8625 } | |
8626 ++v14; | |
8627 ++v11; | |
8628 } | |
8629 while ( v14 < v2->uActorQueueSize ); | |
8630 v3 = 0; | |
8631 } | |
8632 pAudioPlayer->StopChannels(-1, -1); | |
8633 if ( bPlaySound != v3 ) | |
8634 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8635 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8636 pEventTimer->StopGameTime(); | |
8637 dword_50C994 = v3; | |
8638 dword_50C998_turnbased_icon_1A = v3; | |
8639 } | |
8640 // 50C994: using guessed type int dword_50C994; | |
8641 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8642 | |
8643 //----- (00405E14) -------------------------------------------------------- | |
8644 void stru262_TurnBased::_405E14() | |
8645 { | |
8646 stru262_TurnBased *v1; // esi@1 | |
8647 int v2; // ecx@1 | |
8648 SpellBuff *v3; // edi@2 | |
8649 Actor *v4; // ebx@3 | |
8650 signed int v5; // edx@20 | |
8651 AIDirection *v6; // esi@21 | |
8652 int v7; // eax@21 | |
8653 int v8; // eax@21 | |
8654 int v9; // eax@22 | |
8655 int v10; // eax@23 | |
8656 int v11; // eax@37 | |
8657 int v12; // eax@44 | |
8658 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8659 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8660 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8661 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8662 int v17; // [sp+5Ch] [bp-10h]@6 |
8663 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8664 int v19; // [sp+64h] [bp-8h]@8 | |
8665 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8666 | |
8667 v1 = this; | |
8668 v2 = 0; | |
8669 v18 = v1; | |
8670 v20 = 0; | |
8671 if ( (signed int)uNumActors > 0 ) | |
8672 { | |
90 | 8673 //v3 = pActors;//[0].pActorBuffs; |
8674 v16 = pActors;//[0].pActorBuffs; | |
8675 v3 = v16->pActorBuffs; | |
0 | 8676 do |
8677 { | |
90 | 8678 v4 = v16; |
8679 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8680 v17 = v2; |
8681 else | |
8682 v17 = 1; | |
8683 v19 = v2; | |
8684 do | |
8685 { | |
8686 if ( v19 != 10 ) | |
8687 { | |
8688 v3->_4585CA(pParty->uTimePlayed); | |
8689 v2 = 0; | |
8690 } | |
8691 ++v19; | |
8692 ++v3; | |
8693 } | |
8694 while ( v19 < 22 ); | |
8695 if ( v17 != v2 | |
8696 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8697 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8698 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8699 if ( !(v4->uAttributes & 0x80) ) | |
8700 { | |
8701 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8702 { | |
8703 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8704 { | |
8705 v5 = v4->uCurrentActionLength; | |
8706 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8707 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8708 { | |
417 | 8709 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8710 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8711 v7 = v4->uAIState; |
8712 memcpy(&v15, v6, sizeof(v15)); | |
8713 v8 = v7 - 4; | |
8714 memcpy(&v14, &v15, sizeof(v14)); | |
8715 if ( v8 ) | |
8716 { | |
8717 v9 = v8 - 1; | |
8718 if ( v9 ) | |
8719 { | |
8720 v10 = v9 - 6; | |
8721 if ( v10 ) | |
8722 { | |
8723 if ( v10 != 8 ) | |
414 | 8724 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8725 } |
8726 } | |
8727 } | |
8728 else | |
8729 { | |
8730 v4->uCurrentActionTime = 0; | |
8731 v4->uCurrentActionLength = 0; | |
8732 v4->uAIState = Dead; | |
8733 v4->UpdateAnimation(); | |
8734 } | |
8735 v1 = v18; | |
8736 v2 = 0; | |
8737 } | |
8738 } | |
8739 } | |
8740 } | |
8741 ++v20; | |
90 | 8742 v3 = v16[1].pActorBuffs; |
8743 ++v16; | |
0 | 8744 } |
8745 while ( (signed int)v20 < (signed int)uNumActors ); | |
8746 } | |
8747 if ( v1->field_4 == 1 ) | |
8748 { | |
8749 v12 = v1->field_8; | |
8750 if ( v12 == 64 ) | |
8751 { | |
8752 v1->_406A63(); | |
8753 } | |
8754 else | |
8755 { | |
8756 if ( v12 > v2 ) | |
8757 { | |
8758 v1->_406B9F(); | |
8759 } | |
8760 else | |
8761 { | |
8762 v1->_406AFE(); | |
8763 v1->field_10 = 100; | |
8764 } | |
8765 } | |
8766 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8767 return; | |
8768 } | |
8769 if ( v1->field_4 == 2 ) | |
8770 { | |
8771 if ( !(v1->field_18 & 1) ) | |
8772 { | |
8773 v11 = v1->field_10; | |
8774 if ( v11 == 100 ) | |
8775 { | |
8776 v1->StartTurn(); | |
8777 LABEL_39: | |
8778 v1->_40652A(); | |
8779 return; | |
8780 } | |
8781 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8782 { | |
8783 v1->_4065B0(); | |
8784 goto LABEL_39; | |
8785 } | |
8786 } | |
8787 v1->NextTurn(); | |
8788 return; | |
8789 } | |
8790 if ( v1->field_4 == 3 ) | |
8791 { | |
8792 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8793 { | |
8794 v1->field_18 &= 0xFFFFFFF7u; | |
8795 v1->field_4 = 1; | |
8796 v1->field_8 = 64; | |
8797 } | |
8798 else | |
8799 { | |
8800 v1->_406FA8(); | |
8801 } | |
8802 } | |
8803 } | |
8804 | |
8805 //----- (0043FDED) -------------------------------------------------------- | |
8806 void PrepareActorRenderList_BLV() | |
8807 { | |
8808 RenderBillboard *v0; // esi@0 | |
8809 unsigned __int16 v3; // ax@3 | |
8810 unsigned int v4; // eax@5 | |
8811 unsigned __int16 v5; // cx@5 | |
8812 int v6; // esi@5 | |
8813 unsigned int v7; // eax@7 | |
8814 int v8; // eax@10 | |
8815 SpriteFrame *v9; // eax@16 | |
8816 SpriteFrame *v10; // ebx@18 | |
8817 //int *v11; // eax@18 | |
8818 int v12; // ecx@28 | |
8819 //IndoorCameraD3D **v14; // eax@36 | |
8820 double v15; // st7@36 | |
8821 float v16; // eax@36 | |
8822 //double v17; // ST30_8@36 | |
8823 signed __int64 v18; // qtt@36 | |
8824 int v19; // ST5C_4@36 | |
8825 signed __int64 v20; // qtt@37 | |
8826 int v21; // ST5C_4@37 | |
8827 signed __int16 v22; // cx@39 | |
8828 int v23; // ST50_4@40 | |
8829 signed int v24; // ecx@40 | |
8830 int v25; // edx@44 | |
8831 __int16 v26; // ax@44 | |
8832 //MonsterDesc *v27; // edx@44 | |
8833 //int v28; // ecx@44 | |
8834 unsigned __int8 v29; // zf@44 | |
8835 unsigned __int8 v30; // sf@44 | |
8836 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8837 int v32; // [sp+1Ch] [bp-38h]@5 | |
8838 int a3; // [sp+20h] [bp-34h]@5 | |
8839 int a2; // [sp+24h] [bp-30h]@5 | |
8840 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8841 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8842 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8843 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8844 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8845 int a6; // [sp+40h] [bp-14h]@34 | |
8846 int v43; // [sp+44h] [bp-10h]@34 | |
8847 int z; // [sp+48h] [bp-Ch]@32 | |
8848 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8849 int x; // [sp+50h] [bp-4h]@32 | |
8850 | |
8851 for (uint i = 0; i < uNumActors; ++i) | |
8852 { | |
8853 auto p = pActors + i; | |
8854 | |
8855 if (p->uAIState == Removed || | |
8856 p->uAIState == Disabled) | |
8857 continue; | |
8858 | |
8859 a5 = p->uSectorID; | |
8860 a2 = p->vPosition.y; | |
8861 a1a = p->vPosition.x; | |
8862 a3 = p->vPosition.z; | |
8863 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8864 LOWORD(v0) = p->uYawAngle; | |
8865 v5 = p->uCurrentActionAnimation; | |
8866 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8867 v32 = v6; | |
8868 if ( pParty->bTurnBasedModeOn ) | |
8869 { | |
8870 if ( v5 == 1 ) | |
8871 { | |
8872 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8873 goto LABEL_10; | |
8874 } | |
8875 } | |
8876 else | |
8877 { | |
8878 if ( v5 == 1 ) | |
8879 { | |
8880 v7 = pBLVRenderParams->field_0_timer_; | |
8881 LABEL_10: | |
8882 v8 = i * 32 + v7; | |
8883 goto LABEL_12; | |
8884 } | |
8885 } | |
8886 v8 = p->uCurrentActionTime; | |
8887 LABEL_12: | |
8888 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8889 v8 = 0; | |
8890 v31 = p->pSpriteIDs[v5]; | |
8891 if (p->uAIState == Resurrected) | |
8892 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8893 else | |
8894 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8895 v41 = 0; | |
8896 v10 = v9; | |
8897 //v11 = (int *)v9->uFlags; | |
8898 if (v9->uFlags & 2) | |
8899 v41 = 2; | |
8900 if (v9->uFlags & 0x40000) | |
8901 v41 |= 0x40u; | |
8902 if (v9->uFlags & 0x20000) | |
8903 LOBYTE(v41) = v41 | 0x80; | |
8904 v0 = (RenderBillboard *)(256 << v6); | |
8905 if ( (unsigned int)v0 & v9->uFlags) | |
8906 v41 |= 4u; | |
8907 if ( v10->uGlowRadius ) | |
8908 { | |
8909 //LOBYTE(v11) = byte_4E94D3; | |
8910 pMobileLightsStack->AddLight( | |
8911 a1a, | |
8912 a2, | |
8913 a3, | |
8914 a5, | |
8915 v10->uGlowRadius, | |
8916 0xFFu, | |
8917 0xFFu, | |
8918 0xFFu, | |
8919 byte_4E94D3); | |
8920 } | |
8921 v12 = 0; | |
8922 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8923 continue; | |
8924 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8925 { | |
8926 ++v12; | |
8927 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8928 goto _continue; | |
8929 } | |
8930 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8931 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8932 continue; | |
8933 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8934 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8935 if (uNumBillboardsToDraw >= 500) | |
8936 break; | |
8937 ++uNumBillboardsToDraw; | |
8938 ++uNumSpritesDrawnThisFrame; | |
8939 p->uAttributes |= 8u; | |
8940 v29 = pRenderer->pRenderD3D == 0; | |
8941 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8942 v0->uPalette = v10->uPaletteIndex; | |
8943 v0->uIndoorSectorID = a5; | |
8944 if ( v29 ) | |
8945 { | |
8946 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8947 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8948 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8949 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8950 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8951 } | |
8952 else | |
8953 { | |
8954 //v14 = &pGame->pIndoorCameraD3D; | |
8955 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8956 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8957 v16 = v0->fov_x; | |
8958 v0->fov_y = v15; | |
8959 //v17 = v16 + 6.7553994e15; | |
8960 LODWORD(v18) = 0; | |
8961 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8962 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8963 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8964 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8965 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8966 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8967 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8968 { | |
8969 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8970 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8971 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8972 goto LABEL_43; |
8973 } | |
8974 } | |
8975 else | |
8976 { | |
8977 v22 = p->pActorBuffs[3].uPower; | |
8978 if ( v22 ) | |
8979 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8980 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8981 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8982 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8983 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8984 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8985 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8986 goto LABEL_44; |
8987 } | |
8988 } | |
8989 LABEL_44: | |
8990 HIWORD(v25) = HIWORD(x); | |
430 | 8991 v0->world_x = a1a; |
8992 v0->world_y = a2; | |
8993 v0->world_z = a3; | |
0 | 8994 v0->uScreenSpaceX = v43; |
8995 v0->uScreenSpaceY = a6; | |
8996 LOWORD(v25) = 0; | |
8997 LOBYTE(v26) = v41; | |
194 | 8998 |
862 | 8999 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 9000 v0->actual_z = HIWORD(x); |
862 | 9001 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 9002 |
0 | 9003 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
9004 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
9005 v0->field_1E = v41; | |
9006 v0->pSpriteFrame = v10; | |
9007 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9008 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9009 { | |
9010 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9011 v0->field_1E = v26; | |
9012 } | |
9013 | |
9014 _continue: | |
9015 ; | |
9016 } | |
9017 } | |
9018 | |
9019 //----- (00444732) -------------------------------------------------------- | |
428 | 9020 char *GetEventHintString(unsigned int uEventID) |
9021 { | |
9022 signed int event_index; // edx@1 | |
9023 int event_pos; // esi@4 | |
0 | 9024 char *result; // eax@6 |
428 | 9025 unsigned int str_index; // eax@9 |
9026 int i; // esi@11 | |
9027 _evt_raw* test_evt; | |
9028 _evt_raw* last_evt; | |
9029 | |
9030 event_index = 0; | |
9031 if ( uLevelEVT_NumEvents <= 0 ) | |
9032 return NULL; | |
9033 | |
9034 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9035 while ( 1 ) |
9036 { | |
428 | 9037 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9038 { | |
9039 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9040 last_evt=test_evt; | |
9041 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9042 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9043 break; |
9044 } | |
428 | 9045 ++event_index; |
9046 if ( event_index >= uLevelEVT_NumEvents ) | |
9047 return NULL; | |
9048 } | |
9049 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9050 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9051 { | |
9052 str_index = EVT_DWORD(test_evt->v5); | |
9053 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9054 } |
9055 else | |
9056 { | |
428 | 9057 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9058 { | |
9059 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9060 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9061 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9062 { | |
9063 str_index = EVT_DWORD(test_evt->v5); | |
9064 if ( str_index < 600 ) | |
9065 return (char *)p2DEvents[str_index - 1].pName; | |
9066 } | |
9067 } | |
9068 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9069 } | |
9070 | |
0 | 9071 return result; |
9072 } | |
9073 | |
9074 //----- (00444839) -------------------------------------------------------- | |
9075 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) | |
9076 { | |
9077 unsigned int v9; // ebx@1 | |
9078 int v10; // edi@1 | |
373 | 9079 //signed int v11; // eax@1 |
0 | 9080 unsigned int v12; // eax@6 |
9081 const char *v13; // ST0C_4@6 | |
9082 unsigned int v14; // eax@8 | |
9083 const char *v15; // eax@14 | |
9084 unsigned int v16; // eax@16 | |
9085 unsigned int result; // eax@26 | |
9086 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9087 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9088 char *v20; // [sp-4h] [bp-3Ch]@9 |
9089 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9090 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9091 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9092 | |
9093 v9 = a1; | |
9094 v10 = a2; | |
9095 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9096 dword_59117C_teleportx = x; | |
9097 dword_591178_teleporty = y; | |
9098 dword_591174_teleportz = z; | |
9099 dword_591170_teleport_directiony = directiony; | |
9100 dword_59116C_teleport_directionx = directionx; | |
9101 dword_591168_teleport_speedz = a8; | |
9102 dword_591164_teleport_map_name = (char *)pLocationName; | |
9103 uCurrentHouse_Animation = v9; | |
9104 pEventTimer->Pause(); | |
9105 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9106 |
9107 switch (pParty->alignment) | |
9108 { | |
9109 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9110 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9111 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9112 default: assert(false); | |
9113 } | |
9114 /*v11 = const_2(); | |
0 | 9115 sprintf(pContainer, "evt%02d", v11); |
9116 if ( pParty->uAlignment ) | |
9117 { | |
9118 if ( pParty->uAlignment != 2 ) | |
9119 goto LABEL_6; | |
9120 v19 = "-c"; | |
9121 } | |
9122 else | |
9123 { | |
9124 v19 = "-b"; | |
9125 } | |
373 | 9126 strcat(pContainer, v19);*/ |
9127 | |
9128 //LABEL_6: | |
0 | 9129 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9130 v13 = pHouse_ExitPictures[v10]; | |
9131 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9132 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9133 if ( v9 ) | |
9134 { | |
9135 if ( !v23 ) | |
9136 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 9137 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 9138 } |
9139 else | |
9140 { | |
9141 if ( !v23 ) | |
9142 { | |
9143 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9144 if ( v14 ) | |
9145 { | |
721 | 9146 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9147 goto LABEL_20; |
9148 } | |
9149 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9150 goto LABEL_19; | |
9151 } | |
9152 } | |
9153 v15 = pLocationName; | |
9154 if ( *pLocationName == 48 ) | |
9155 v15 = pCurrentMapName; | |
9156 v16 = pMapStats->GetMapInfo(v15); | |
9157 if ( v16 ) | |
9158 { | |
721 | 9159 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9160 goto LABEL_20; | |
0 | 9161 } |
9162 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9163 LABEL_19: | |
423 | 9164 strcpy(sHouseName, v21); |
0 | 9165 LABEL_20: |
710 | 9166 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9167 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9168 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9169 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9170 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9171 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9172 result = v23; |
9173 if ( v23 ) | |
9174 uCurrentHouse_Animation = v23; | |
9175 return result; | |
9176 } |