Mercurial > mm7
annotate mm7_4.cpp @ 937:ae747684f644
stru279 removed.
author | Nomad |
---|---|
date | Wed, 01 May 2013 12:45:02 +0200 |
parents | a78f08dbeb88 |
children | 9be9afdbeac3 |
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 "TurnEngine.h" | |
42 #include "FactionTable.h" | |
43 #include "StorylineTextTable.h" | |
44 #include "Random.h" | |
924 | 45 #include "CastSpellInfo.h" |
0 | 46 #include "stru298.h" |
47 #include "stru12.h" | |
48 #include "stru351.h" | |
49 #include "Events2D.h" | |
50 #include "stru159.h" | |
189 | 51 #include "texts.h" |
0 | 52 #include "Log.h" |
629 | 53 #include "UIHouses.h" |
0 | 54 #include "mm7_data.h" |
55 | |
56 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 57 void __cdecl check_event_triggers() |
0 | 58 { |
59 int v0; // eax@1 | |
60 LevelDecoration *v1; // esi@2 | |
61 signed int v2; // edi@2 | |
62 int v3; // ebx@2 | |
63 int v4; // eax@3 | |
64 int v5; // ebx@3 | |
65 unsigned int v6; // ecx@3 | |
66 unsigned int v7; // edx@6 | |
67 unsigned int v8; // edx@8 | |
112 | 68 Actor *v9; // edi@13 |
0 | 69 int v10; // ebx@14 |
70 int v11; // eax@14 | |
71 int v12; // ebx@14 | |
72 unsigned int v13; // ecx@14 | |
73 int v14; // edx@15 | |
74 unsigned int v15; // edx@17 | |
75 unsigned int v16; // edx@19 | |
76 char *v17; // edi@25 | |
77 int v18; // ebx@26 | |
78 int v19; // eax@26 | |
79 int v20; // ebx@26 | |
80 unsigned int v21; // ecx@26 | |
81 int v22; // edx@27 | |
82 unsigned int v23; // edx@29 | |
83 unsigned int v24; // edx@31 | |
84 int v25; // [sp+0h] [bp-24h]@3 | |
85 int v26; // [sp+0h] [bp-24h]@14 | |
86 int v27; // [sp+0h] [bp-24h]@26 | |
87 int v28; // [sp+4h] [bp-20h]@3 | |
88 int v29; // [sp+4h] [bp-20h]@14 | |
89 int v30; // [sp+4h] [bp-20h]@26 | |
90 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
91 int v32; // [sp+Ch] [bp-18h]@2 | |
92 int v33; // [sp+10h] [bp-14h]@2 | |
93 int i; // [sp+14h] [bp-10h]@1 | |
94 int v35; // [sp+18h] [bp-Ch]@2 | |
95 int v36; // [sp+1Ch] [bp-8h]@3 | |
96 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
97 signed int v38; // [sp+20h] [bp-4h]@24 | |
98 | |
99 v0 = 0; | |
100 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
101 { | |
102 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
103 v2 = v1->field_18; | |
104 v3 = v1->vPosition.y; | |
105 v33 = v1->vPosition.x; | |
106 v32 = v1->vPosition.y; | |
107 v35 = v1->vPosition.z; | |
108 v31 = v1->field_18; | |
109 if ( v1->field_2 & 1 ) | |
110 { | |
111 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
112 v25 = abs(v3 - pParty->vPosition.y); | |
113 v28 = abs(v35 - pParty->vPosition.z); | |
114 v4 = v36; | |
115 v5 = v25; | |
116 v6 = v28; | |
117 if ( v36 < v25 ) | |
118 { | |
119 v4 = v25; | |
120 v5 = v36; | |
121 } | |
122 if ( v4 < v28 ) | |
123 { | |
124 v7 = v4; | |
125 v4 = v28; | |
126 v6 = v7; | |
127 } | |
128 if ( v5 < (signed int)v6 ) | |
129 { | |
130 v8 = v6; | |
131 v6 = v5; | |
132 v5 = v8; | |
133 } | |
134 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 135 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 136 } |
137 if ( v1->field_2 & 2 ) | |
138 { | |
139 v37 = 0; | |
140 if ( (signed int)uNumActors > 0 ) | |
141 { | |
112 | 142 v9 = pActors;//[0].vPosition.y; |
0 | 143 do |
144 { | |
112 | 145 v10 = abs(v33 - v9->vPosition.x); |
146 v29 = abs(v32 - v9->vPosition.y); | |
147 v26 = abs(v35 - v9->vPosition.z); | |
0 | 148 v11 = v10; |
149 v12 = v29; | |
150 v13 = v26; | |
151 if ( v11 < v29 ) | |
152 { | |
153 v14 = v11; | |
154 v11 = v29; | |
155 v12 = v14; | |
156 } | |
157 if ( v11 < v26 ) | |
158 { | |
159 v15 = v11; | |
160 v11 = v26; | |
161 v13 = v15; | |
162 } | |
163 if ( v12 < (signed int)v13 ) | |
164 { | |
165 v16 = v13; | |
166 v13 = v12; | |
167 v12 = v16; | |
168 } | |
169 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
170 EventProcessor(v1->field_16_event_id, 0, 1); | |
171 ++v37; | |
112 | 172 ++v9; |
0 | 173 } |
174 while ( v37 < (signed int)uNumActors ); | |
175 } | |
176 } | |
177 if ( v1->field_2 & 4 ) | |
178 { | |
179 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
180 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
181 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
182 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 183 do |
184 { | |
185 v18 = abs(v33 - *((int *)v17 - 1)); | |
186 v30 = abs(v32 - *(int *)v17); | |
187 v27 = abs(v35 - *((int *)v17 + 1)); | |
188 v19 = v18; | |
189 v20 = v30; | |
190 v21 = v27; | |
191 if ( v19 < v30 ) | |
192 { | |
193 v22 = v19; | |
194 v19 = v30; | |
195 v20 = v22; | |
196 } | |
197 if ( v19 < v27 ) | |
198 { | |
199 v23 = v19; | |
200 v19 = v27; | |
201 v21 = v23; | |
202 } | |
203 if ( v20 < (signed int)v21 ) | |
204 { | |
205 v24 = v21; | |
206 v21 = v20; | |
207 v20 = v24; | |
208 } | |
209 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
210 EventProcessor(v1->field_16_event_id, 0, 1); | |
211 ++v38; | |
212 v17 += 112; | |
213 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
214 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 215 } |
216 } | |
217 v0 = i + 1; | |
218 } | |
219 } | |
220 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
221 | |
222 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 223 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 224 { |
225 int v13; // ecx@13 | |
226 signed int v14; // ebx@14 | |
227 int v15; // eax@16 | |
729 | 228 //int v16; // edx@19 |
792 | 229 //int v17; // ST18_4@19 |
230 //signed int v18; // edx@19 | |
231 //signed __int64 v19; // qtt@19 | |
0 | 232 int v21; // eax@27 |
792 | 233 //int v22; // ecx@29 |
0 | 234 signed int v28; // eax@45 |
235 int v29; // ebx@47 | |
236 int v30; // edx@49 | |
830 | 237 //int v31; // ST10_4@49 |
238 //signed int v32; // edx@49 | |
0 | 239 signed __int64 v33; // qtt@49 |
830 | 240 //signed int v34; // eax@54 |
241 //signed int v35; // esi@56 | |
242 //int result; // eax@57 | |
0 | 243 int v38; // edx@62 |
792 | 244 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 245 bool v47; // [sp+24h] [bp-1Ch]@43 |
246 bool v48; // [sp+28h] [bp-18h]@10 | |
247 bool v49; // [sp+28h] [bp-18h]@41 | |
248 bool v50; // [sp+2Ch] [bp-14h]@12 | |
249 signed int v53; // [sp+30h] [bp-10h]@10 | |
250 signed int v54; // [sp+30h] [bp-10h]@41 | |
251 signed int v55; // [sp+34h] [bp-Ch]@1 | |
252 | |
730 | 253 //LOG_DECOMPILATION_WARNING(); |
254 | |
255 static int blv_floor_id[50]; // 00721200 | |
256 static int blv_floor_level[50]; // 007212C8 | |
257 | |
258 static __int16 word_721390_ys[104]; // idb | |
259 static __int16 word_721460_xs[104]; // idb | |
0 | 260 |
261 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 262 v55 = 0; |
0 | 263 for (uint i = 0; i < pSector->uNumFloors; ++i) |
264 { | |
265 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
266 if (pFloor->Clickable()) | |
267 continue; | |
268 | |
792 | 269 assert(pFloor->uNumVertices); |
0 | 270 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
271 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
272 { | |
273 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
274 { | |
730 | 275 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
276 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
277 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
278 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 279 } |
730 | 280 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
281 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
282 | |
792 | 283 v50 = word_721390_ys[0] >= y; |
0 | 284 v53 = 0; |
792 | 285 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
286 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 287 { |
288 if (v53 >= 2) | |
289 break; | |
290 | |
291 v48 = v50; | |
292 v50 = word_721390_ys[j + 1] >= y; | |
730 | 293 |
294 v13 = i; | |
792 | 295 if (v48 == v50) |
296 continue; | |
297 | |
298 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
299 v15 = v14 | word_721460_xs[j] < x; | |
300 | |
301 if (v15 == 3) | |
302 continue; | |
303 else if (!v15) | |
304 ++v53; | |
305 else | |
0 | 306 { |
792 | 307 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 308 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 309 |
310 if (res + word_721460_xs[j] >= x) | |
729 | 311 ++v53; |
0 | 312 } |
792 | 313 } |
314 | |
315 | |
0 | 316 if ( v53 == 1 ) |
317 { | |
318 if ( v55 >= 50 ) | |
319 break; | |
723 | 320 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 321 { |
725 | 322 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 323 } |
324 else | |
325 { | |
871 | 326 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 327 } |
792 | 328 blv_floor_level[v55] = v21; |
329 blv_floor_id[v55] = pSector->pFloors[i]; | |
330 v55++; | |
0 | 331 } |
792 | 332 } |
333 } | |
334 | |
335 | |
0 | 336 if ( pSector->field_0 & 8 ) |
337 { | |
338 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
339 { | |
340 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
341 if (portal->uPolygonType != POLYGON_Floor) | |
342 continue; | |
343 | |
830 | 344 if (!portal->uNumVertices) |
345 continue; | |
346 | |
723 | 347 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
348 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
349 { | |
0 | 350 for (uint j = 0; j < portal->uNumVertices; ++j) |
351 { | |
730 | 352 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
353 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
354 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
355 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
356 } | |
357 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
358 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 359 v54 = 0; |
830 | 360 v47 = word_721390_ys[0] >= y; |
361 | |
362 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 363 { |
830 | 364 v49 = v47; |
0 | 365 if ( v54 >= 2 ) |
366 break; | |
830 | 367 v47 = word_721390_ys[j + 1] >= y; |
0 | 368 if ( v49 != v47 ) |
369 { | |
830 | 370 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
371 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 372 if ( v29 != 3 ) |
373 { | |
723 | 374 if ( !v29 ) |
729 | 375 ++v54; |
376 else | |
377 { | |
830 | 378 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 379 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 380 if (res + word_721460_xs[j] >= x) |
723 | 381 ++v54; |
729 | 382 } |
0 | 383 } |
384 } | |
385 } | |
386 if ( v54 == 1 ) | |
387 { | |
388 if ( v55 >= 50 ) | |
389 break; | |
830 | 390 blv_floor_level[v55] = -29000; |
391 blv_floor_id[v55] = pSector->pPortals[i]; | |
392 v55++; | |
0 | 393 } |
394 } | |
395 } | |
396 } | |
397 if ( v55 == 1 ) | |
398 { | |
730 | 399 *pFaceID = blv_floor_id[0]; |
725 | 400 return blv_floor_level[0]; |
0 | 401 } |
402 if ( !v55 ) | |
403 return -30000; | |
730 | 404 *pFaceID = blv_floor_id[0]; |
725 | 405 //result = blv_floor_level[0]; |
830 | 406 |
407 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 408 { |
725 | 409 if ( blv_floor_level[0] <= z + 5 ) |
410 { | |
411 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 412 continue; |
725 | 413 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 414 *pFaceID = blv_floor_id[v35]; |
717 | 415 continue; |
416 } | |
725 | 417 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
418 { | |
419 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 420 *pFaceID = blv_floor_id[v35]; |
717 | 421 } |
830 | 422 }*/ |
423 | |
424 | |
425 int result = blv_floor_level[0]; | |
426 for (uint i = 1; i < v55; ++i) | |
427 { | |
428 v38 = blv_floor_level[i]; | |
429 if ( result <= z + 5 ) | |
430 { | |
431 if ( v38 > result && v38 <= z + 5 ) | |
432 { | |
433 result = blv_floor_level[i]; | |
434 *pFaceID = blv_floor_id[i]; | |
435 } | |
436 } | |
437 else if ( v38 < result ) | |
438 { | |
439 result = blv_floor_level[i]; | |
440 *pFaceID = blv_floor_id[i]; | |
441 } | |
442 } | |
443 | |
444 return result; | |
0 | 445 } |
446 | |
447 //----- (0046D49E) -------------------------------------------------------- | |
791 | 448 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 449 { |
723 | 450 BSPModel *pBModel; // esi@4 |
451 ODMFace *pFace; // ecx@11 | |
0 | 452 int v14; // edx@20 |
453 signed int v18; // edx@26 | |
454 int v19; // eax@28 | |
455 int v20; // edx@30 | |
456 int v21; // ST1C_4@30 | |
457 signed int v22; // edx@30 | |
458 signed __int64 v23; // qtt@30 | |
459 int v24; // eax@36 | |
460 signed int v25; // ecx@38 | |
461 int result; // eax@42 | |
462 signed int v27; // ecx@43 | |
463 int v28; // edi@44 | |
464 signed int v29; // edx@44 | |
465 int v30; // esi@45 | |
466 int v31; // eax@45 | |
467 ODMFace *v32; // eax@57 | |
468 int v33; // ecx@59 | |
469 int v36; // [sp+14h] [bp-2Ch]@24 | |
470 int v38; // [sp+1Ch] [bp-24h]@2 | |
471 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 472 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
473 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 474 bool v43; // [sp+30h] [bp-10h]@22 |
475 bool v44; // [sp+34h] [bp-Ch]@24 | |
476 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
477 signed int v48; // [sp+58h] [bp+18h]@22 | |
478 signed int v49; // [sp+58h] [bp+18h]@43 | |
479 | |
480 v46 = 1; | |
481 dword_721160[0] = -1; | |
482 dword_721110[0] = -1; | |
791 | 483 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 484 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 485 { |
486 *a6 = 0; | |
725 | 487 return odm_floor_level[0]; |
723 | 488 } |
0 | 489 v38 = 0; |
723 | 490 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
491 { | |
492 pBModel = &pOutdoor->pBModels[v38]; | |
493 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
494 { | |
495 if ( (signed int)pBModel->uNumFaces > 0 ) | |
496 { | |
497 v39 = 0; | |
498 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
499 { | |
500 pFace = &pBModel->pFaces[v39]; | |
501 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
502 && !(pFace->uAttributes & 0x20000000) | |
503 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
504 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 505 { |
723 | 506 if ( pFace->uNumVertices ) |
0 | 507 { |
723 | 508 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 509 { |
723 | 510 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
511 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
512 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
513 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
514 } | |
515 } | |
516 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
517 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
518 v43 = word_720F70[0] >= Y; | |
519 v48 = 0; | |
520 if ( 2 * pFace->uNumVertices > 0 ) | |
521 { | |
522 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
523 { | |
524 if ( v48 >= 2 ) | |
525 break; | |
526 v36 = word_720F70[i + 1]; | |
527 v44 = word_720F70[i + 1] >= Y; | |
528 if ( v43 != v44 ) | |
0 | 529 { |
723 | 530 v18 = word_721040[i + 1] >= X ? 0 : 2; |
531 v19 = v18 | word_721040[i] < X; | |
532 if ( v19 != 3 ) | |
0 | 533 { |
723 | 534 if ( !v19 ) |
740 | 535 ++v48; |
536 else | |
0 | 537 { |
723 | 538 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
539 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
540 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
541 if ( v22 >= X) | |
542 ++v48; | |
0 | 543 } |
544 } | |
545 } | |
723 | 546 v43 = v44; |
547 } | |
548 if ( v48 == 1 ) | |
549 { | |
550 if ( v46 >= 20 ) | |
0 | 551 break; |
723 | 552 if ( pFace->uPolygonType == POLYGON_Floor ) |
553 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
554 else | |
725 | 555 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
556 + HIWORD(pFace->zCalc3); | |
723 | 557 v25 = v46++; |
725 | 558 odm_floor_level[v25] = v24; |
723 | 559 dword_721160[v25] = pBModelNum; |
560 dword_721110[v25] = pFaceNum; | |
0 | 561 } |
562 } | |
563 } | |
723 | 564 ++v39; |
565 } | |
566 } | |
567 } | |
0 | 568 ++v38; |
569 } | |
570 if ( v46 == 1 ) | |
571 { | |
572 *a6 = 0; | |
725 | 573 return odm_floor_level[0]; |
0 | 574 } |
575 v27 = 0; | |
576 if ( v46 <= 1 ) | |
577 *a6 = 0; | |
723 | 578 else |
579 { | |
725 | 580 //v29 = 1; |
723 | 581 for ( v49 = 1; v49 < v46; ++v49 ) |
582 { | |
725 | 583 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 584 { |
585 v27 = v49; | |
725 | 586 //++v29; |
723 | 587 break; |
588 } | |
725 | 589 if ( odm_floor_level[0] > Z + 5 ) |
590 { | |
591 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
592 { | |
593 //++v29; | |
723 | 594 break; |
595 } | |
596 v27 = v49; | |
725 | 597 //++v29; |
723 | 598 break; |
599 } | |
725 | 600 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 601 { |
602 v27 = v49; | |
725 | 603 //++v29; |
723 | 604 } |
605 } | |
606 if ( !v27 ) | |
607 *a6 = 0; | |
608 else | |
609 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
610 } | |
0 | 611 if ( v27 ) |
612 { | |
613 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 614 *pIsOnWater = false; |
615 if ( v32->Fluid()) | |
616 *pIsOnWater = true; | |
0 | 617 } |
725 | 618 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
619 odm_floor_level[0] = odm_floor_level[v27]; | |
620 return odm_floor_level[0]; | |
0 | 621 } |
622 | |
623 //----- (0046D8E3) -------------------------------------------------------- | |
624 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
625 { | |
626 int v4; // ebx@1 | |
627 unsigned int v5; // ecx@1 | |
628 BSPModel *v6; // edi@3 | |
629 ODMFace *v7; // esi@10 | |
630 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
631 signed __int16 *v9; // eax@18 |
0 | 632 int v10; // edx@19 |
633 int v11; // ecx@21 | |
634 int v12; // ecx@23 | |
635 signed int v13; // eax@25 | |
636 int v14; // edx@27 | |
637 int v15; // edx@29 | |
638 int v16; // ST18_4@29 | |
639 signed int v17; // edx@29 | |
640 signed __int64 v18; // qtt@29 | |
641 int v19; // eax@35 | |
642 signed int v20; // ecx@37 | |
643 signed int v22; // ebx@42 | |
644 unsigned int v23; // esi@43 | |
645 int v24; // edx@44 | |
646 int v25; // eax@44 | |
647 int v26; // [sp+Ch] [bp-38h]@7 | |
648 int v27; // [sp+10h] [bp-34h]@21 | |
649 int v28; // [sp+18h] [bp-2Ch]@21 | |
650 int v29; // [sp+1Ch] [bp-28h]@2 | |
651 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
652 signed int v31; // [sp+24h] [bp-20h]@1 | |
653 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
654 int v33; // [sp+2Ch] [bp-18h]@7 | |
655 bool v34; // [sp+30h] [bp-14h]@21 | |
656 bool v35; // [sp+34h] [bp-10h]@23 | |
657 signed int v36; // [sp+38h] [bp-Ch]@17 | |
658 signed int v37; // [sp+38h] [bp-Ch]@21 | |
659 signed int v38; // [sp+38h] [bp-Ch]@42 | |
660 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
661 signed int v40; // [sp+40h] [bp-4h]@1 | |
662 | |
663 dword_720ED0[0] = -1; | |
664 dword_720E80[0] = -1; | |
665 v4 = a1; | |
666 v5 = 0; | |
667 v40 = a2; | |
668 v31 = v4; | |
669 v39 = 1; | |
670 dword_720F20[0] = 10000; | |
671 v32 = 0; | |
672 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
673 { | |
674 v29 = 0; | |
675 do | |
676 { | |
677 v6 = &pOutdoor->pBModels[v29]; | |
678 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
679 { | |
680 if ( v4 >= v6->sMinX ) | |
681 { | |
682 if ( v40 <= v6->sMaxY ) | |
683 { | |
684 if ( v40 >= v6->sMinY ) | |
685 { | |
686 v33 = v5; | |
687 v26 = v6->uNumFaces; | |
688 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
689 { | |
690 v30 = v5; | |
691 while ( 1 ) | |
692 { | |
693 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
694 v8 = v7->uPolygonType; | |
695 if ( (v8 == 5 || v8 == 6) | |
696 && !(BYTE3(v7->uAttributes) & 0x20) | |
697 && v4 <= v7->pBoundingBox.x2 | |
698 && v4 >= v7->pBoundingBox.x1 | |
699 && v40 <= v7->pBoundingBox.y2 | |
700 && v40 >= v7->pBoundingBox.y1 ) | |
701 { | |
702 v36 = v5; | |
703 if ( v7->uNumVertices ) | |
704 { | |
705 v9 = v7->pXInterceptDisplacements; | |
706 do | |
707 { | |
708 v10 = 2 * v36; | |
709 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
710 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
711 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
712 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
713 ++v9; | |
714 } | |
715 while ( v36 < v7->uNumVertices ); | |
716 v4 = v31; | |
717 } | |
718 v27 = 2 * v7->uNumVertices; | |
719 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
720 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
721 v11 = 0; | |
722 v34 = word_720CE0_ys[0] >= v40; | |
723 v37 = 0; | |
724 v28 = 0; | |
725 if ( v27 > 0 ) | |
726 { | |
727 do | |
728 { | |
729 if ( v37 >= 2 ) | |
730 break; | |
731 v12 = v11; | |
732 v4 = v31; | |
733 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
734 if ( v34 != v35 ) | |
735 { | |
736 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
737 v14 = v13 | word_720DB0_xs[v12] < v31; | |
738 if ( v14 != 3 ) | |
739 { | |
740 if ( !v14 | |
741 || (v15 = word_720CE0_ys[v12], | |
742 v16 = word_720CE0_ys[v12 + 1] - v15, | |
743 v17 = v40 - v15, | |
744 LODWORD(v18) = v17 << 16, | |
745 HIDWORD(v18) = v17 >> 16, | |
746 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
747 - (signed int)word_720DB0_xs[v12]) | |
748 * v18 | |
749 / v16) >> 16) | |
750 + word_720DB0_xs[v12]) >= v31) ) | |
751 ++v37; | |
752 } | |
753 } | |
754 v11 = v28 + 1; | |
755 v34 = v35; | |
756 ++v28; | |
757 } | |
758 while ( v28 < v27 ); | |
759 if ( v37 == 1 ) | |
760 { | |
761 if ( v39 >= 20 ) | |
762 break; | |
763 if ( v7->uPolygonType == 5 ) | |
764 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
765 else | |
766 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
767 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
768 + HIWORD(v7->zCalc3); | |
769 v20 = v39++; | |
770 dword_720F20[v20] = v19; | |
771 dword_720ED0[v20] = v32; | |
772 dword_720E80[v20] = v33; | |
773 } | |
774 } | |
775 } | |
776 ++v33; | |
777 v30 += 308; | |
778 if ( v33 >= v26 ) | |
779 break; | |
780 v5 = 0; | |
781 } | |
782 } | |
783 } | |
784 } | |
785 } | |
786 } | |
787 ++v32; | |
788 ++v29; | |
789 v5 = 0; | |
790 } | |
791 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
792 if ( !v39 ) | |
793 { | |
794 *(int *)a4 = 0; | |
795 return dword_720F20[0]; | |
796 } | |
797 } | |
798 v22 = 0; | |
799 v38 = v5; | |
800 if ( v39 <= (signed int)v5 ) | |
801 goto LABEL_54; | |
802 v23 = 0; | |
803 do | |
804 { | |
805 v24 = dword_720F20[v5 / 4]; | |
806 v25 = *(int *)((char *)dword_720F20 + v23); | |
807 if ( v24 == v25 ) | |
808 goto LABEL_50; | |
809 if ( v25 > a3 + 15 ) | |
810 { | |
811 if ( v24 >= v25 ) | |
812 goto LABEL_51; | |
813 LABEL_50: | |
814 v22 = v38; | |
815 v23 = v5; | |
816 goto LABEL_51; | |
817 } | |
818 if ( v24 > v25 && v24 <= a3 + 15 ) | |
819 goto LABEL_50; | |
820 LABEL_51: | |
821 ++v38; | |
822 v5 += 4; | |
823 } | |
824 while ( v38 < v39 ); | |
825 if ( v22 ) | |
826 { | |
827 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
828 return dword_720F20[v22]; | |
829 } | |
830 LABEL_54: | |
831 *(int *)a4 = 0; | |
832 return dword_720F20[v22]; | |
833 } | |
834 | |
138 | 835 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
836 // for a right-handed system, that would be an inverse normal | |
0 | 837 //----- (0046DCC8) -------------------------------------------------------- |
138 | 838 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
839 { | |
840 auto grid_x = WorldPosToGridCellX(pos_x); | |
841 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
842 | |
843 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
844 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
845 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
846 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
847 | |
848 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
849 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
850 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
851 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
852 | |
853 float side1_dx, side1_dy, side1_dz, | |
854 side2_dx, side2_dy, side2_dz; | |
855 | |
856 auto dx = abs(pos_x - grid_pos_x1), | |
857 dz = abs(grid_pos_z1 - pos_z); | |
858 if (dz >= dx) | |
859 { | |
860 side1_dy = (double)(x1z1_y - x1z2_y); | |
861 side2_dy = (double)(x2z2_y - x1z2_y); | |
862 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
863 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
864 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
865 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 866 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 867 /* |\ |
868 side1 | \ | |
869 |____\ | |
870 side 2 */ | |
871 } | |
872 else | |
873 { | |
874 side1_dy = (double)(x2z2_y - x2z1_y); | |
875 side2_dy = (double)(x1z1_y - x2z1_y); | |
876 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
877 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
878 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
879 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
880 | |
881 /* side 2 | |
882 _____ | |
883 \ | | |
884 \ | side 1 | |
885 \| */ | |
886 } | |
887 | |
888 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
889 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
890 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
891 | |
892 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
893 if (fabsf(mag) < 1e-6f) | |
894 { | |
895 out->y = 0; | |
896 out->x = 0; | |
897 out->z = 65536; | |
898 } | |
899 else | |
900 { | |
901 float invmag = 1.0 / mag; | |
902 out->x = invmag * nx * 65536.0; | |
903 out->y = invmag * ny * 65536.0; | |
904 out->z = invmag * nz * 65536.0; | |
905 } | |
906 } | |
907 | |
0 | 908 //----- (0046DEF2) -------------------------------------------------------- |
909 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
910 { | |
911 unsigned int result; // eax@1 | |
912 | |
913 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
914 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 915 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
916 return result; | |
917 } | |
918 | |
919 //----- (0046DF1A) -------------------------------------------------------- | |
920 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
921 { | |
922 Actor *v2; // edi@1 | |
923 unsigned __int16 v3; // ax@1 | |
924 int v4; // esi@6 | |
925 int v5; // ecx@8 | |
926 int v6; // eax@10 | |
927 int v7; // edx@12 | |
928 int v8; // ecx@14 | |
929 int v9; // eax@14 | |
930 int v10; // ebx@14 | |
931 int v11; // esi@14 | |
932 int v12; // ebx@15 | |
933 int v13; // ebx@17 | |
934 unsigned int v14; // eax@20 | |
935 signed int result; // eax@21 | |
936 int v16; // [sp+Ch] [bp-10h]@1 | |
937 int v17; // [sp+10h] [bp-Ch]@14 | |
938 int v18; // [sp+14h] [bp-8h]@14 | |
939 int v19; // [sp+18h] [bp-4h]@14 | |
940 | |
941 v16 = a1; | |
942 v2 = &pActors[a1]; | |
943 v3 = v2->uAIState; | |
944 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
945 goto LABEL_25; | |
946 v4 = v2->uActorRadius; | |
947 if ( a2 ) | |
948 v4 = a2; | |
949 v5 = v2->vPosition.x; | |
950 if ( stru_721530.sMaxX > v5 + v4 | |
951 || stru_721530.sMinX < v5 - v4 | |
952 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
953 || stru_721530.sMinY < v6 - v4 | |
954 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
955 || stru_721530.sMinZ < v7 | |
956 || (v8 = v5 - stru_721530.normal.x, | |
957 v9 = v6 - stru_721530.normal.y, | |
958 v10 = stru_721530.prolly_normal_d + v4, | |
959 v17 = stru_721530.prolly_normal_d + v4, | |
960 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
961 v18 = v8, | |
962 v19 = v9, | |
963 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
964 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
965 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
966 { | |
967 LABEL_25: | |
968 result = 0; | |
969 } | |
970 else | |
971 { | |
295 | 972 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 973 if ( v13 < 0 ) |
974 v13 = 0; | |
975 if ( v13 < stru_721530.field_7C ) | |
976 { | |
977 stru_721530.field_7C = v13; | |
978 v14 = 8 * v16; | |
862 | 979 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 980 stru_721530.uFaceID = v14; |
981 } | |
982 result = 1; | |
983 } | |
984 return result; | |
985 } | |
986 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
987 | |
988 //----- (0046E0B2) -------------------------------------------------------- | |
989 void __cdecl _46E0B2_collide_against_decorations() | |
990 { | |
991 BLVSector *v0; // ebp@1 | |
992 LevelDecoration *v1; // edi@2 | |
993 DecorationDesc *v2; // esi@3 | |
994 int v3; // edx@4 | |
995 int v4; // eax@4 | |
996 int v5; // ecx@6 | |
997 int v6; // ebx@8 | |
998 int v7; // esi@8 | |
999 int v8; // ebx@10 | |
1000 int v9; // esi@11 | |
1001 int v10; // edi@12 | |
1002 int v11; // eax@12 | |
1003 int v12; // esi@14 | |
1004 unsigned int v13; // eax@17 | |
1005 signed int i; // [sp+4h] [bp-14h]@1 | |
1006 int v15; // [sp+8h] [bp-10h]@10 | |
1007 int v16; // [sp+Ch] [bp-Ch]@10 | |
1008 int v17; // [sp+10h] [bp-8h]@10 | |
1009 int v18; // [sp+14h] [bp-4h]@8 | |
1010 | |
1011 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1012 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1013 { | |
1014 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1015 if ( !(v1->field_2 & 0x20) ) | |
1016 { | |
1017 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1018 if (!v2->CanMoveThrough()) |
0 | 1019 { |
1020 v3 = v2->uRadius; | |
1021 v4 = v1->vPosition.x; | |
1022 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1023 { | |
1024 if ( stru_721530.sMinX >= v4 - v3 ) | |
1025 { | |
1026 v5 = v1->vPosition.y; | |
1027 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1028 { | |
1029 if ( stru_721530.sMinY >= v5 - v3 ) | |
1030 { | |
1031 v6 = v2->uDecorationHeight; | |
1032 v7 = v1->vPosition.z; | |
1033 v18 = v6; | |
1034 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1035 { | |
1036 if ( stru_721530.sMinZ >= v7 ) | |
1037 { | |
1038 v16 = v4 - stru_721530.normal.x; | |
1039 v15 = v5 - stru_721530.normal.y; | |
1040 v8 = stru_721530.prolly_normal_d + v3; | |
1041 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1042 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1043 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1044 { | |
1045 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1046 if ( v9 > 0 ) | |
1047 { | |
1048 v10 = v1->vPosition.z; | |
1049 v11 = stru_721530.normal.z | |
1050 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1051 if ( v11 >= v10 ) | |
1052 { | |
1053 if ( v11 <= v18 + v10 ) | |
1054 { | |
295 | 1055 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1056 if ( v12 < 0 ) |
1057 v12 = 0; | |
1058 if ( v12 < stru_721530.field_7C ) | |
1059 { | |
1060 stru_721530.field_7C = v12; | |
1061 v13 = 8 * v0->pDecorationIDs[i]; | |
1062 LOBYTE(v13) = v13 | 5; | |
1063 stru_721530.uFaceID = v13; | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 } | |
1078 } | |
1079 | |
1080 //----- (0046E26D) -------------------------------------------------------- | |
1081 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1082 { | |
1083 int v2; // edx@5 | |
1084 unsigned __int16 *v3; // eax@5 | |
1085 unsigned __int16 v4; // ax@6 | |
1086 LevelDecoration *v5; // edi@7 | |
1087 DecorationDesc *v6; // esi@8 | |
1088 int v7; // edx@9 | |
1089 int v8; // eax@9 | |
1090 int v9; // ecx@11 | |
1091 int v10; // ebx@13 | |
1092 int v11; // esi@13 | |
1093 int v12; // ebp@15 | |
1094 int v13; // ebx@15 | |
1095 int v14; // esi@16 | |
1096 int v15; // edi@17 | |
1097 int v16; // eax@17 | |
1098 int v17; // esi@19 | |
1099 char v18; // zf@23 | |
1100 int v19; // [sp+0h] [bp-10h]@15 | |
1101 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1102 int v21; // [sp+8h] [bp-8h]@15 | |
1103 int v22; // [sp+Ch] [bp-4h]@13 | |
1104 | |
1105 if ( a1 >= 0 ) | |
1106 { | |
1107 if ( a1 <= 127 ) | |
1108 { | |
1109 if ( a2 >= 0 ) | |
1110 { | |
1111 if ( a2 <= 127 ) | |
1112 { | |
1113 v2 = a1 + (a2 << 7); | |
1114 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1115 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1116 if ( v3 ) | |
1117 { | |
1118 do | |
1119 { | |
1120 v4 = *v3; | |
848 | 1121 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1122 { |
1123 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1124 if ( !(v5->field_2 & 0x20) ) | |
1125 { | |
1126 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1127 if (!v6->CanMoveThrough()) |
0 | 1128 { |
1129 v7 = v6->uRadius; | |
1130 v8 = v5->vPosition.x; | |
1131 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1132 { | |
1133 if ( stru_721530.sMinX >= v8 - v7 ) | |
1134 { | |
1135 v9 = v5->vPosition.y; | |
1136 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1137 { | |
1138 if ( stru_721530.sMinY >= v9 - v7 ) | |
1139 { | |
1140 v10 = v6->uDecorationHeight; | |
1141 v11 = v5->vPosition.z; | |
1142 v22 = v10; | |
1143 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1144 { | |
1145 if ( stru_721530.sMinZ >= v11 ) | |
1146 { | |
1147 v12 = v8 - stru_721530.normal.x; | |
1148 v19 = v9 - stru_721530.normal.y; | |
1149 v13 = stru_721530.prolly_normal_d + v7; | |
1150 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1151 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1152 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1153 { | |
1154 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1155 if ( v14 > 0 ) | |
1156 { | |
1157 v15 = v5->vPosition.z; | |
1158 v16 = stru_721530.normal.z | |
1159 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1160 if ( v16 >= v15 ) | |
1161 { | |
1162 if ( v16 <= v22 + v15 ) | |
1163 { | |
295 | 1164 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1165 if ( v17 < 0 ) |
1166 v17 = 0; | |
1167 if ( v17 < stru_721530.field_7C ) | |
1168 { | |
1169 stru_721530.field_7C = v17; | |
1170 stru_721530.uFaceID = (signed __int16)*v20; | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 } | |
1184 } | |
1185 v3 = v20 + 1; | |
1186 v18 = *v20 == 0; | |
1187 ++v20; | |
1188 } | |
1189 while ( !v18 ); | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 | |
1197 //----- (00486F92) -------------------------------------------------------- | |
1198 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1199 { | |
1200 Span *v0; // ebx@1 | |
1201 int v1; // eax@2 | |
1202 Edge *v2; // ecx@3 | |
1203 Edge *v3; // edx@3 | |
1204 Edge *v4; // esi@6 | |
1205 Edge *v5; // eax@7 | |
1206 Edge *v6; // ecx@8 | |
1207 Surf *v7; // esi@11 | |
1208 double v8; // st7@13 | |
1209 Surf *v9; // edi@13 | |
1210 double v10; // st6@13 | |
1211 double v11; // st7@14 | |
1212 signed __int64 v12; // qax@14 | |
1213 stru148 *v13; // eax@15 | |
1214 Span *v14; // ecx@17 | |
1215 double v15; // st7@28 | |
1216 signed __int64 v16; // qax@28 | |
1217 stru148 *v17; // eax@29 | |
1218 Span *v18; // ecx@31 | |
1219 Edge *i; // eax@40 | |
1220 Edge *v20; // ecx@43 | |
1221 Edge *v21; // esi@44 | |
1222 double v22; // st7@45 | |
1223 Edge *v23; // edx@48 | |
1224 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1225 float v25; // [sp+14h] [bp-Ch]@3 | |
1226 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1227 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1228 | |
1229 v0 = pSpans; | |
1230 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1231 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1232 stru_80C9A4.pSurf = &stru_80C980; |
1233 stru_80C980.pPrev = &stru_80C980; | |
1234 stru_80C980.pNext = &stru_80C980; | |
693 | 1235 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1236 stru_80C980.field_8 = 0.0; |
1237 stru_80C980.field_4 = 0.0; | |
1238 stru_80C9D8.pNext = &stru_80C9A4; | |
1239 stru_80C9D8.pPrev = 0; | |
1240 stru_80C9D8.field_8 = 1; | |
1241 stru_80C9A4.pNext = 0; | |
1242 stru_80C9A4.pPrev = &stru_80C9D8; | |
1243 stru_80C9A4.field_8 = 0; | |
1244 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1245 v27 = pViewport->uViewportTL_Y; |
1246 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1247 { |
1248 LABEL_51: | |
1249 v0->field_8 = -1; | |
1250 } | |
1251 else | |
1252 { | |
693 | 1253 v1 = 52 * pViewport->uViewportTL_Y; |
1254 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1255 while ( 1 ) |
1256 { | |
1257 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1258 v3 = &stru_80C9D8; | |
1259 v25 = (double)(signed int)v27; | |
1260 if ( v2 != &defaultEdge ) | |
1261 { | |
1262 do | |
1263 { | |
1264 while ( 1 ) | |
1265 { | |
1266 v4 = v3->pNext; | |
1267 if ( v2->field_0 <= (double)v4->field_0 ) | |
1268 break; | |
1269 v3 = v3->pNext; | |
1270 } | |
1271 v5 = v2->pNext; | |
1272 v2->pNext = v4; | |
1273 v2->pPrev = v3; | |
1274 v3->pNext->pPrev = v2; | |
1275 v3->pNext = v2; | |
1276 v3 = v2; | |
1277 v2 = v5; | |
1278 } | |
1279 while ( v5 != &defaultEdge ); | |
1280 } | |
1281 v6 = stru_80C9D8.pNext; | |
1282 stru_80C980.field_20 = 0; | |
1283 stru_80C980.field_22 = 1; | |
1284 v26 = stru_80C9D8.pNext; | |
1285 if ( stru_80C9D8.pNext ) | |
1286 { | |
1287 while ( 1 ) | |
1288 { | |
1289 v7 = v6->pSurf; | |
1290 if ( v6->field_8 ) | |
1291 { | |
1292 ++v7->field_22; | |
1293 if ( v7->field_22 == 1 ) | |
1294 { | |
1295 v8 = v6->field_0 + 2.0; | |
1296 v9 = stru_80C980.pNext; | |
1297 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1298 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1299 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1300 + stru_80C980.pNext->field_0 ) | |
1301 { | |
1302 do | |
1303 v9 = v9->pNext; | |
1304 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1305 v7->pNext = v9; | |
1306 v7->pPrev = v9->pPrev; | |
1307 v9->pPrev->pNext = v7; | |
1308 v9->pPrev = v7; | |
1309 } | |
1310 else | |
1311 { | |
1312 v11 = v6->field_0 + 0.5; | |
1313 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1314 v0->field_C = v12; | |
1315 if ( (signed __int16)v12 > 0 ) | |
1316 { | |
1317 v0->field_A = v27; | |
1318 v0->field_8 = v9->field_20; | |
1319 v13 = v9->pParent; | |
1320 v0->pParent = v13; | |
1321 if ( v13 ) | |
1322 { | |
1323 if ( v13->prolly_head ) | |
1324 { | |
1325 v14 = v13->prolly_tail; | |
1326 if ( !v14 ) | |
1327 return; | |
1328 v14->pNext = v0; | |
1329 } | |
1330 else | |
1331 { | |
1332 v13->prolly_head = v0; | |
1333 } | |
1334 v13->prolly_tail = v0; | |
1335 } | |
1336 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1337 return; | |
1338 ++v0; | |
1339 ++pOutdoorCamera->uNumSpans; | |
1340 } | |
1341 v6 = v26; | |
1342 v7->field_20 = (signed __int64)v11; | |
1343 v7->pNext = v9; | |
1344 v9->pPrev = v7; | |
1345 stru_80C980.pNext = v7; | |
1346 v7->pPrev = &stru_80C980; | |
1347 } | |
1348 } | |
1349 } | |
1350 else | |
1351 { | |
1352 --v7->field_22; | |
1353 if ( !v7->field_22 ) | |
1354 { | |
1355 if ( stru_80C980.pNext == v7 ) | |
1356 { | |
1357 v15 = v6->field_0 + 0.5; | |
1358 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1359 v0->field_C = v16; | |
1360 if ( (signed __int16)v16 > 0 ) | |
1361 { | |
1362 v0->field_A = v27; | |
1363 v0->field_8 = v7->field_20; | |
1364 v17 = v7->pParent; | |
1365 v0->pParent = v17; | |
1366 if ( v17 ) | |
1367 { | |
1368 if ( v17->prolly_head ) | |
1369 { | |
1370 v18 = v17->prolly_tail; | |
1371 if ( !v18 ) | |
1372 return; | |
1373 v18->pNext = v0; | |
1374 } | |
1375 else | |
1376 { | |
1377 v17->prolly_head = v0; | |
1378 } | |
1379 v17->prolly_tail = v0; | |
1380 } | |
1381 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1382 return; | |
1383 ++v0; | |
1384 ++pOutdoorCamera->uNumSpans; | |
1385 } | |
1386 v7->pNext->field_20 = (signed __int64)v15; | |
1387 v6 = v26; | |
1388 } | |
1389 v7->pNext->pPrev = v7->pPrev; | |
1390 v7->pPrev->pNext = v7->pNext; | |
1391 } | |
1392 } | |
1393 v26 = v6->pNext; | |
1394 if ( !v26 ) | |
1395 break; | |
1396 v6 = v6->pNext; | |
1397 } | |
1398 } | |
1399 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1400 { | |
1401 i->pPrev->pNext = i->pNext; | |
1402 i->pNext->pPrev = i->pPrev; | |
1403 } | |
1404 v20 = stru_80C9D8.pNext; | |
1405 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1406 break; | |
1407 LABEL_50: | |
1408 ++v27; | |
1409 v1 = v24 + 52; | |
1410 v24 += 52; | |
693 | 1411 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1412 goto LABEL_51; |
1413 } | |
1414 while ( 1 ) | |
1415 { | |
1416 v21 = v20->pNext; | |
1417 if ( !v21 ) | |
1418 break; | |
1419 v22 = v20->field_4 + v20->field_0; | |
1420 v20->field_0 = v22; | |
1421 if ( v22 < stru_80C9D8.field_0 ) | |
1422 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1423 while ( 1 ) | |
1424 { | |
1425 v23 = v20->pPrev; | |
1426 if ( v20->field_0 >= (double)v23->field_0 ) | |
1427 break; | |
1428 v23->pNext = v20->pNext; | |
1429 v20->pNext->pPrev = v23; | |
1430 v23->pPrev->pNext = v20; | |
1431 v20->pPrev = v23->pPrev; | |
1432 v20->pNext = v23; | |
1433 v23->pPrev = v20; | |
1434 } | |
1435 v20 = v21; | |
1436 if ( v21 == &stru_80C9A4 ) | |
1437 goto LABEL_50; | |
1438 } | |
1439 } | |
1440 } | |
1441 // 4EC3EC: using guessed type Edge defaultEdge; | |
1442 | |
1443 //----- (00487355) -------------------------------------------------------- | |
1444 bool OutdoorCamera::_487355() | |
1445 { | |
1446 int v0; // esi@1 | |
1447 stru148 *v1; // edi@2 | |
1448 bool result; // eax@3 | |
1449 | |
1450 v0 = 0; | |
1451 if ( pOutdoorCamera->numStru148s > 0 ) | |
1452 { | |
1453 v1 = array_77EC08; | |
1454 do | |
1455 { | |
1456 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1457 ++v0; | |
1458 ++v1; | |
1459 } | |
1460 while ( v0 < pOutdoorCamera->numStru148s ); | |
1461 } | |
1462 return result; | |
1463 } | |
1464 | |
1465 //----- (00487DA9) -------------------------------------------------------- | |
1466 void __cdecl sub_487DA9() | |
1467 { | |
1468 char *v0; // eax@1 | |
1469 | |
1470 v0 = &array_77EC08[0].field_108; | |
1471 do | |
1472 { | |
1473 *v0 = 0; | |
1474 v0 += 268; | |
1475 } | |
1476 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1477 } | |
1478 | |
1479 //----- (00487DBE) -------------------------------------------------------- | |
1480 void Software_ResetNewEdges() | |
1481 { | |
1482 int v0; // ecx@1 | |
1483 Edge **v1; // eax@1 | |
1484 signed int v2; // eax@3 | |
1485 | |
1486 v0 = 0; | |
1487 v1 = ptr_80CA10; | |
1488 do | |
1489 { | |
1490 ++v0; | |
1491 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1492 *v1 = 0; | |
1493 ++v1; | |
1494 } | |
1495 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1496 v2 = 2000; | |
1497 do | |
1498 { | |
1499 pSurfs->field_22 = 0; | |
1500 --v2; | |
1501 } | |
1502 while ( v2 ); | |
1503 } | |
1504 // 4EC3EC: using guessed type Edge defaultEdge; | |
1505 | |
1506 //----- (0048958E) -------------------------------------------------------- | |
1507 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1508 { | |
1509 stru12_MemoryBlock *v2; // esi@1 | |
1510 void *v3; // eax@1 | |
1511 void *v4; // ecx@1 | |
1512 stru12_MemoryBlock *result; // eax@1 | |
1513 | |
1514 v2 = this; | |
1515 v3 = operator new(8 * a2 + 16); | |
1516 v2->pBlockBase = v3; | |
848 | 1517 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1518 result = v2; |
1519 v2->pAlignedBlock = v4; | |
1520 } | |
1521 | |
1522 //----- (004895B7) -------------------------------------------------------- | |
1523 stru12::stru12(stru11 *pStru11) | |
1524 { | |
1525 stru12 *v2; // esi@1 | |
1526 | |
1527 v2 = this; | |
1528 this->field_44 = 0x41000000u; | |
1529 this->field_4C = 0x46000000u; | |
1530 //this->vdestructor_ptr = stru12::_4898E6; | |
1531 this->field_48 = 0; | |
1532 this->field_50 = 0; | |
1533 this->field_54 = 0x33D6BF95u; | |
1534 this->field_58 = 0; | |
1535 | |
1536 for (int i = 0; i < 12; ++i) | |
1537 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1538 /* | |
1539 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1540 if ( v3 ) | |
1541 v4 = AllocAlignedMem(v3, 640); | |
1542 else | |
1543 v4 = 0; | |
1544 v2->pMemBlocks[0] = v4; | |
1545 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1546 if ( v5 ) | |
1547 v6 = AllocAlignedMem(v5, 640); | |
1548 else | |
1549 v6 = 0; | |
1550 v2->pMemBlocks[1] = v6; | |
1551 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1552 if ( v7 ) | |
1553 v8 = AllocAlignedMem(v7, 640); | |
1554 else | |
1555 v8 = 0; | |
1556 v2->pMemBlocks[2] = v8; | |
1557 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1558 if ( v9 ) | |
1559 v10 = AllocAlignedMem(v9, 640); | |
1560 else | |
1561 v10 = 0; | |
1562 v2->pMemBlocks[3] = v10; | |
1563 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1564 if ( v11 ) | |
1565 v12 = AllocAlignedMem(v11, 640); | |
1566 else | |
1567 v12 = 0; | |
1568 v2->pMemBlocks[4] = v12; | |
1569 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1570 if ( v13 ) | |
1571 v14 = AllocAlignedMem(v13, 640); | |
1572 else | |
1573 v14 = 0; | |
1574 v2->pMemBlocks[5] = v14; | |
1575 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1576 if ( v15 ) | |
1577 v16 = AllocAlignedMem(v15, 640); | |
1578 else | |
1579 v16 = 0; | |
1580 v2->pMemBlocks[6] = v16; | |
1581 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1582 if ( v17 ) | |
1583 v18 = AllocAlignedMem(v17, 640); | |
1584 else | |
1585 v18 = 0; | |
1586 v2->pMemBlocks[7] = v18; | |
1587 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1588 if ( v19 ) | |
1589 v20 = AllocAlignedMem(v19, 640); | |
1590 else | |
1591 v20 = 0; | |
1592 v2->pMemBlocks[8] = v20; | |
1593 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1594 if ( v21 ) | |
1595 v22 = AllocAlignedMem(v21, 640); | |
1596 else | |
1597 v22 = 0; | |
1598 v2->pMemBlocks[9] = v22; | |
1599 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1600 if ( v23 ) | |
1601 v24 = AllocAlignedMem(v23, 640); | |
1602 else | |
1603 v24 = 0; | |
1604 v2->pMemBlocks[10] = v24; | |
1605 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1606 if ( v25 ) | |
1607 v26 = AllocAlignedMem(v25, 640); | |
1608 else | |
1609 v26 = 0; | |
1610 v2->field_8C = 0; | |
1611 v2->pMemBlocks[11] = v26;*/ | |
1612 } | |
1613 | |
1614 //----- (00489810) -------------------------------------------------------- | |
1615 stru12::~stru12() | |
1616 { | |
1617 for (int i = 0; i < 12; ++i) | |
1618 delete pMemBlocks[i]; | |
1619 /*if ( v2 ) | |
1620 stru12_MemoryBlock::dtor(v2, 1); | |
1621 v3 = v1->pMemBlocks[1]; | |
1622 if ( v3 ) | |
1623 stru12_MemoryBlock::dtor(v3, 1); | |
1624 v4 = v1->pMemBlocks[2]; | |
1625 if ( v4 ) | |
1626 stru12_MemoryBlock::dtor(v4, 1); | |
1627 v5 = v1->pMemBlocks[3]; | |
1628 if ( v5 ) | |
1629 stru12_MemoryBlock::dtor(v5, 1); | |
1630 v6 = v1->pMemBlocks[4]; | |
1631 if ( v6 ) | |
1632 stru12_MemoryBlock::dtor(v6, 1); | |
1633 v7 = v1->pMemBlocks[5]; | |
1634 if ( v7 ) | |
1635 stru12_MemoryBlock::dtor(v7, 1); | |
1636 v8 = v1->pMemBlocks[6]; | |
1637 if ( v8 ) | |
1638 stru12_MemoryBlock::dtor(v8, 1); | |
1639 v9 = v1->pMemBlocks[7]; | |
1640 if ( v9 ) | |
1641 stru12_MemoryBlock::dtor(v9, 1); | |
1642 v10 = v1->pMemBlocks[8]; | |
1643 if ( v10 ) | |
1644 stru12_MemoryBlock::dtor(v10, 1); | |
1645 v11 = v1->pMemBlocks[9]; | |
1646 if ( v11 ) | |
1647 stru12_MemoryBlock::dtor(v11, 1); | |
1648 v12 = v1->pMemBlocks[10]; | |
1649 if ( v12 ) | |
1650 stru12_MemoryBlock::dtor(v12, 1); | |
1651 v13 = v1->pMemBlocks[11]; | |
1652 if ( v13 ) | |
1653 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1654 } | |
1655 | |
1656 //----- (004898BF) -------------------------------------------------------- | |
1657 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1658 { | |
1659 stru12_MemoryBlock *v2; // esi@1 | |
1660 void *v3; // ST00_4@1 | |
1661 | |
1662 v2 = this; | |
1663 v3 = this->pBlockBase; | |
1664 this->pAlignedBlock = 0; | |
1665 free(v3); | |
1666 v2->pBlockBase = 0; | |
1667 /*if ( a2 & 1 ) | |
1668 free(v2);*/ | |
1669 } | |
1670 | |
1671 //----- (004898E6) -------------------------------------------------------- | |
1672 void stru12::_4898E6() | |
1673 { | |
1674 void *v1; // eax@1 | |
1675 void *v2; // edx@1 | |
1676 char *v3; // edi@2 | |
1677 double v4; // st7@2 | |
1678 char *v5; // ebx@2 | |
1679 double v6; // st6@3 | |
1680 double v7; // st5@3 | |
1681 double v8; // st4@3 | |
1682 int v9; // esi@3 | |
1683 double v10; // st3@3 | |
1684 float v11; // ST34_4@5 | |
1685 double v12; // st6@10 | |
1686 double v13; // ST0C_8@10 | |
1687 char *v14; // [sp+14h] [bp-44h]@2 | |
1688 char *v15; // [sp+18h] [bp-40h]@2 | |
1689 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1690 char *v17; // [sp+20h] [bp-38h]@2 | |
1691 char *v18; // [sp+24h] [bp-34h]@2 | |
1692 float v19; // [sp+30h] [bp-28h]@3 | |
1693 float v20; // [sp+38h] [bp-20h]@3 | |
1694 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1695 int v22; // [sp+40h] [bp-18h]@1 | |
1696 char *v23; // [sp+44h] [bp-14h]@2 | |
1697 char *v24; // [sp+48h] [bp-10h]@2 | |
1698 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1699 float v26; // [sp+50h] [bp-8h]@3 | |
1700 float v27; // [sp+54h] [bp-4h]@3 | |
1701 | |
731 | 1702 __debugbreak(); |
0 | 1703 v22 = 0; |
1704 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1705 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1706 if ( this->field_8C > 0 ) | |
1707 { | |
1708 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1709 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1710 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1711 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1712 v25 = (int)v1 - (int)v2; | |
1713 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1714 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1715 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1716 v4 = 1.0; | |
1717 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1718 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1719 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1720 do | |
1721 { | |
1722 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1723 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1724 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1725 v7 = pIndoorCamera->fRotationYCosine; | |
1726 v8 = pIndoorCamera->fRotationYSine; | |
1727 v20 = pIndoorCamera->fRotationXCosine; | |
1728 v19 = pIndoorCamera->fRotationXSine; | |
1729 v9 = (int)((char *)v2 + (int)v21); | |
1730 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1731 if ( pIndoorCamera->sRotationX ) | |
1732 { | |
1733 v11 = v10; | |
1734 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1735 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1736 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1737 } | |
1738 else | |
1739 { | |
1740 *(float *)v9 = v10; | |
1741 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1742 *(float *)((char *)v2 + (int)v5) = v6; | |
1743 } | |
1744 if ( *(float *)v9 >= 8.0 ) | |
1745 { | |
1746 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1747 { | |
1748 *(int *)v2 = 0; | |
1749 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1750 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1751 - v12 * *(float *)((char *)v2 + (int)v3); | |
1752 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1753 - v12 * *(float *)((char *)v2 + (int)v5); | |
1754 *(float *)((char *)v2 + (int)v16) = v4 | |
1755 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1756 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1757 v13 = *(float *)v9 + 6.7553994e15; | |
1758 v4 = 1.0; | |
1759 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1760 } | |
1761 else | |
1762 { | |
1763 *(int *)v2 = 2; | |
1764 } | |
1765 } | |
1766 else | |
1767 { | |
1768 *(int *)v2 = 1; | |
1769 } | |
1770 ++v22; | |
1771 v2 = (char *)v2 + 4; | |
1772 } | |
1773 while ( v22 < this->field_8C ); | |
1774 } | |
1775 this->field_8C = 0; | |
1776 } | |
1777 | |
1778 //----- (0048A959) -------------------------------------------------------- | |
1779 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1780 { | |
1781 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1782 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1783 b = (uColor & 0x000000FF) / 255.0f; | |
1784 | |
1785 float h, s, v; | |
1786 RGB2HSV(&h, &s, r, g, b, &v); | |
1787 | |
1788 if ( h_replace != -1.0 ) | |
1789 h = h_replace; | |
1790 if ( s_replace != -1.0 ) | |
1791 s = s_replace; | |
1792 if ( v_replace != -1.0 ) | |
1793 v = v_replace; | |
1794 HSV2RGB(&r, &g, &b, h, s, v); | |
1795 | |
1796 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1797 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1798 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1799 } | |
1800 | |
1801 //----- (0048B561) -------------------------------------------------------- | |
1802 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1803 { | |
1804 //v2 = a2 - 0.5; | |
1805 //v3 = v2 + 6.7553994e15; | |
1806 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1807 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1808 //v5 = v7 + 6.7553994e15; | |
1809 //return LODWORD(v5) | (v4 << 16); | |
1810 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1811 return v5 | (v4 << 16); | |
1812 } | |
1813 | |
1814 //----- (00491E3A) -------------------------------------------------------- | |
1815 void __cdecl sub_491E3A() | |
1816 { | |
1817 Player *v0; // ebx@1 | |
1818 signed int v1; // esi@3 | |
1819 char *v2; // eax@4 | |
1820 unsigned int v3; // eax@7 | |
1821 unsigned int v4; // edx@8 | |
1822 char *v5; // ecx@9 | |
1823 int v6; // edi@17 | |
1824 Texture *v7; // ebx@18 | |
1825 struct IDirect3DTexture2 **v8; // eax@19 | |
1826 struct IDirect3DTexture2 *v9; // eax@20 | |
1827 struct IDirectDrawSurface **v10; // eax@22 | |
1828 struct IDirectDrawSurface *v11; // eax@23 | |
1829 int v12; // eax@26 | |
1830 | |
1831 v0 = pParty->pPlayers; | |
1832 do | |
1833 { | |
203 | 1834 if (SoundSetAction[24][0]) |
0 | 1835 { |
1836 v1 = 0; | |
764 | 1837 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1838 { |
1839 LABEL_7: | |
1840 v3 = 0; | |
1841 } | |
1842 else | |
1843 { | |
1844 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1845 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1846 { |
1847 ++v1; | |
1848 v2 += 120; | |
764 | 1849 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1850 goto LABEL_7; |
1851 } | |
1852 v3 = v1; | |
1853 } | |
764 | 1854 pSoundList->UnloadSound(v3, 1); |
0 | 1855 v4 = 0; |
764 | 1856 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1857 { |
1858 LABEL_12: | |
1859 v4 = 0; | |
1860 } | |
1861 else | |
1862 { | |
1863 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1864 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1865 { |
1866 ++v4; | |
1867 v5 += 120; | |
764 | 1868 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1869 goto LABEL_12; |
1870 } | |
1871 } | |
764 | 1872 pSoundList->UnloadSound(v4, 1); |
0 | 1873 } |
1874 ++v0; | |
1875 } | |
1876 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1877 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1878 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1879 { |
1880 v7 = &pIcons_LOD->pTextures[v6]; | |
1881 do | |
1882 { | |
1883 v7->Release(); | |
1884 v8 = pIcons_LOD->pHardwareTextures; | |
1885 if ( v8 ) | |
1886 { | |
1887 v9 = v8[v6]; | |
1888 if ( v9 ) | |
1889 { | |
1890 v9->Release(); | |
1891 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1892 } | |
1893 } | |
1894 v10 = pIcons_LOD->pHardwareSurfaces; | |
1895 if ( v10 ) | |
1896 { | |
1897 v11 = v10[v6]; | |
1898 if ( v11 ) | |
1899 { | |
1900 v11->Release(); | |
1901 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1902 } | |
1903 } | |
1904 --v6; | |
1905 --v7; | |
1906 } | |
33 | 1907 while ( v6 >= pIcons_LOD->pFacesLock ); |
1908 } | |
1909 v12 = pIcons_LOD->pFacesLock; | |
1910 pIcons_LOD->pFacesLock = 0; | |
0 | 1911 pIcons_LOD->uNumLoadedFiles = v12; |
1912 } | |
1913 // 4ED498: using guessed type char byte_4ED498; | |
1914 | |
1915 //----- (0049387A) -------------------------------------------------------- | |
1916 int CycleCharacter(unsigned int _this) | |
1917 { | |
1918 signed int result; // eax@1 | |
1919 signed int v2; // ecx@2 | |
1920 signed int v3; // ecx@8 | |
1921 | |
1922 result = uActiveCharacter; | |
1923 if ( _this ) | |
1924 { | |
1925 v2 = 0; | |
1926 while ( 1 ) | |
1927 { | |
1928 --result; | |
1929 if ( result < 1 ) | |
1930 result = 4; | |
1931 if ( !pPlayers[result]->uTimeToRecovery ) | |
1932 break; | |
1933 ++v2; | |
1934 if ( v2 >= 4 ) | |
1935 return uActiveCharacter; | |
1936 } | |
1937 } | |
1938 else | |
1939 { | |
1940 v3 = 0; | |
1941 while ( 1 ) | |
1942 { | |
1943 ++result; | |
1944 if ( result > 4 ) | |
1945 result = 1; | |
1946 if ( !pPlayers[result]->uTimeToRecovery ) | |
1947 break; | |
1948 ++v3; | |
1949 if ( v3 >= 4 ) | |
1950 return uActiveCharacter; | |
1951 } | |
1952 } | |
1953 return result; | |
1954 } | |
1955 | |
1956 //----- (004938D1) -------------------------------------------------------- | |
1957 void __fastcall Rest(unsigned int uHoursToSleep) | |
1958 { | |
1959 unsigned int v1; // esi@1 | |
1960 double v2; // st7@3 | |
1961 Player **v3; // esi@3 | |
1962 | |
1963 v1 = uHoursToSleep; | |
1964 if ( uHoursToSleep > 240 ) | |
1965 InitializeActors(); | |
1966 v2 = (double)(7680 * v1) * 0.033333335; | |
1967 pParty->uTimePlayed += (signed __int64)v2; | |
1968 v3 = &pPlayers[1]; | |
1969 do | |
1970 { | |
1971 (*v3)->Recover((signed __int64)v2); | |
1972 ++v3; | |
1973 } | |
1974 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1975 _494035_timed_effects__water_walking_damage__etc(); | |
1976 } | |
1977 | |
1978 //----- (00493938) -------------------------------------------------------- | |
1979 int __cdecl _493938_regenerate() | |
1980 { | |
1981 int v0; // edi@1 | |
1982 signed __int64 v1; // qax@1 | |
1983 int v2; // ecx@1 | |
1984 int result; // eax@1 | |
1985 int v4; // eax@2 | |
1986 int v5; // edi@5 | |
112 | 1987 int *v6; // ecx@5 |
0 | 1988 char v7; // sf@5 |
112 | 1989 int *v8; // ecx@10 |
0 | 1990 int v9; // edi@15 |
1991 signed int v10; // eax@15 | |
1992 __int16 *v11; // edx@16 | |
1993 int v12; // eax@20 | |
1994 int v13; // ebx@20 | |
1995 unsigned int *v14; // esi@21 | |
1996 unsigned int v15; // ecx@21 | |
1997 unsigned int v16; // eax@21 | |
1998 int v17; // edx@21 | |
1999 int v18; // eax@21 | |
2000 signed int v19; // eax@21 | |
2001 signed int v20; // ebx@25 | |
2002 Player *v21; // esi@25 | |
2003 ITEM_EQUIP_TYPE v22; // edi@30 | |
2004 //int v23; // edx@31 | |
2005 signed int v24; // ecx@32 | |
2006 signed int v25; // eax@33 | |
2007 int v26; // eax@35 | |
2008 int v27; // eax@36 | |
2009 int v28; // eax@37 | |
2010 int v29; // eax@40 | |
2011 int v30; // eax@41 | |
2012 signed int v31; // ecx@53 | |
2013 char *v32; // eax@53 | |
2014 char *v33; // edi@82 | |
2015 int v34; // ecx@88 | |
2016 int v35; // eax@88 | |
2017 char *v36; // edi@99 | |
2018 int v37; // edi@104 | |
2019 int v38; // edi@106 | |
2020 int v39; // edi@111 | |
2021 int v40; // ecx@113 | |
2022 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
|
2023 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2024 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2025 int v44; // [sp+210h] [bp-20h]@22 | |
2026 int v45; // [sp+214h] [bp-1Ch]@25 | |
2027 int v46; // [sp+218h] [bp-18h]@25 | |
2028 int v47; // [sp+21Ch] [bp-14h]@25 | |
2029 int v48; // [sp+220h] [bp-10h]@25 | |
2030 int v49; // [sp+224h] [bp-Ch]@24 | |
2031 int v50; // [sp+228h] [bp-8h]@25 | |
2032 int v51; // [sp+22Ch] [bp-4h]@2 | |
2033 | |
2034 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2035 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2036 v2 = (signed int)v1 / 60; | |
2037 result = (signed int)v1 / 60 + 5; | |
2038 if ( v0 >= result ) | |
2039 { | |
2040 v51 = 0; | |
2041 v4 = (v0 - v2) / 5; | |
2042 if (pParty->FlyActive()) | |
2043 { | |
2044 if ( pParty->bFlying ) | |
2045 { | |
569 | 2046 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2047 { // colliding with something in the air - fall down | |
2048 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2049 //__debugbreak(); | |
2050 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2051 v7 = *v6 < v5; |
2052 *v6 -= v5; | |
0 | 2053 if ( v7 ) |
2054 { | |
112 | 2055 *v6 = 0; |
0 | 2056 pParty->uFlags &= 0xFFFFFFBFu; |
2057 pParty->bFlying = 0; | |
2058 v51 = 1; | |
2059 } | |
2060 } | |
2061 } | |
2062 } | |
569 | 2063 |
0 | 2064 if (pParty->WaterWalkActive()) |
2065 { | |
569 | 2066 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2067 { | |
2068 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2069 { // taking on water | |
2070 //__debugbreak(); | |
2071 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2072 v7 = *v8 < v4; |
2073 *v8 -= v4; | |
0 | 2074 if ( v7 ) |
2075 { | |
112 | 2076 *v8 = 0; |
569 | 2077 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2078 v51 = 1; |
2079 } | |
2080 } | |
2081 } | |
2082 } | |
569 | 2083 |
0 | 2084 if (pParty->ImmolationActive()) |
2085 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2086 //SpriteObject::SpriteObject(&a1); |
0 | 2087 v9 = 0; |
2088 a3.z = 0; | |
2089 a3.y = 0; | |
2090 a3.x = 0; | |
2091 a1.stru_24.Reset(); | |
822 | 2092 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2093 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2094 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2095 a1.uType = 1070; |
822 | 2096 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2097 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2098 { | |
2099 LABEL_19: | |
2100 LOWORD(v10) = 0; | |
2101 } | |
2102 else | |
2103 { | |
2104 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 2105 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 2106 { |
2107 ++v10; | |
2108 v11 += 28; | |
2109 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2110 goto LABEL_19; | |
2111 } | |
2112 } | |
2113 a1.uObjectDescID = v10; | |
2114 a1.field_60_distance_related_prolly_lod = 0; | |
2115 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2116 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2117 a1.uAttributes = 0; |
2118 a1.uSectorID = 0; | |
2119 a1.uSpriteFrameID = 0; | |
822 | 2120 a1.spell_caster_pid = v12; |
0 | 2121 a1.uFacing = 0; |
2122 a1.uSoundID = 0; | |
2123 v13 = sub_46A89E((int)v41, 100, 307); | |
2124 if ( v13 > 0 ) | |
2125 { | |
2126 do | |
2127 { | |
2128 v14 = (unsigned int *)&v41[4 * v9]; | |
2129 v15 = *v14; | |
2130 v16 = *v14; | |
2131 a1.vPosition.x = pActors[v16].vPosition.x; | |
2132 v17 = pActors[v16].vPosition.y; | |
2133 a1.vPosition.z = pActors[v16].vPosition.z; | |
2134 v18 = 8 * v15; | |
862 | 2135 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2136 a1.vPosition.y = v17; |
823 | 2137 a1.spell_target_pid = v18; |
0 | 2138 v19 = a1.Create(0, 0, 0, 0); |
862 | 2139 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2140 ++v9; |
2141 } | |
2142 while ( v9 < v13 ); | |
2143 } | |
2144 } | |
2145 v44 = 0; | |
248 | 2146 if (PartyHasDragon()) |
0 | 2147 v44 = 1; |
2148 v49 = 0; | |
2149 LABEL_25: | |
2150 v20 = 0; | |
2151 v21 = &pParty->pPlayers[v49]; | |
2152 v50 = 0; | |
2153 v47 = 0; | |
2154 v45 = 0; | |
2155 v48 = 0; | |
2156 v46 = 0; | |
255 | 2157 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2158 v50 = 1; |
135 | 2159 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2160 v48 = 1; |
2161 v22 = (ITEM_EQUIP_TYPE)0; | |
2162 while ( 1 ) | |
2163 { | |
2164 if ( v21->HasItemEquipped(v22) ) | |
2165 { | |
2166 //v23 = v21->pEquipment.pIndices; | |
2167 auto _idx = v21->pEquipment.pIndices[v22]; | |
2168 v24 = v21->pInventoryItems[_idx].uItemID; | |
2169 if ( v24 > 134 ) | |
2170 { | |
2171 if ( v24 == 529 ) | |
2172 goto LABEL_43; | |
2173 if ( v24 == 535 ) | |
2174 goto LABEL_44; | |
2175 if ( v24 == 515 ) | |
2176 { | |
2177 v47 = 1; | |
2178 } | |
2179 else | |
2180 { | |
2181 if ( v24 == 532 ) | |
2182 goto LABEL_50; | |
2183 } | |
2184 } | |
2185 else | |
2186 { | |
377 | 2187 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2188 if ( v25 <= 50 ) |
2189 { | |
2190 if ( v25 != 50 ) | |
2191 { | |
2192 v26 = v25 - 37; | |
2193 if ( v26 ) | |
2194 { | |
2195 v27 = v26 - 1; | |
2196 if ( !v27 ) | |
2197 goto LABEL_50; | |
2198 v28 = v27 - 6; | |
2199 if ( v28 ) | |
2200 { | |
2201 if ( v28 != 3 ) | |
2202 goto LABEL_51; | |
2203 LABEL_50: | |
2204 v50 = 1; | |
2205 goto LABEL_51; | |
2206 } | |
2207 } | |
2208 } | |
2209 LABEL_44: | |
2210 v20 = 1; | |
2211 goto LABEL_51; | |
2212 } | |
2213 v29 = v25 - 54; | |
2214 if ( !v29 ) | |
2215 goto LABEL_44; | |
2216 v30 = v29 - 1; | |
2217 if ( !v30 ) | |
2218 goto LABEL_50; | |
2219 if ( v30 == 11 ) | |
2220 { | |
2221 LABEL_43: | |
2222 v20 = 1; | |
2223 v50 = 1; | |
2224 goto LABEL_51; | |
2225 } | |
2226 } | |
2227 } | |
2228 LABEL_51: | |
2229 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2230 if ( (signed int)v22 >= 16 ) | |
2231 { | |
2232 if ( v48 ) | |
2233 { | |
2234 v31 = 0; | |
2235 v32 = (char *)v21->pInventoryItems; | |
2236 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2237 { | |
2238 ++v31; | |
2239 v32 += 36; | |
2240 if ( v31 >= 138 ) | |
2241 goto LABEL_59; | |
2242 } | |
2243 v48 = 0; | |
2244 v45 = 1; | |
2245 } | |
2246 LABEL_59: | |
2247 if ( v21->pConditions[17] ) | |
2248 v46 = 1; | |
2249 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2250 { | |
2251 ++v21->sHealth; | |
2252 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2253 v21->sHealth = v21->GetMaxHealth(); | |
2254 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2255 { | |
2256 LODWORD(v21->pConditions[13]) = 0; | |
2257 HIDWORD(v21->pConditions[13]) = 0; | |
2258 } | |
2259 v51 = 1; | |
2260 } | |
2261 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2262 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2263 && !v21->pConditions[14] | |
2264 && !v21->pConditions[16] ) | |
2265 { | |
2266 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2267 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2268 v21->sHealth = v21->GetMaxHealth(); | |
2269 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2270 { | |
2271 LODWORD(v21->pConditions[13]) = 0; | |
2272 HIDWORD(v21->pConditions[13]) = 0; | |
2273 } | |
2274 v51 = 1; | |
2275 } | |
2276 if ( v50 ) | |
2277 { | |
2278 v33 = (char *)&v21->sMana; | |
2279 ++*(int *)v33; | |
2280 if ( v21->sMana > v21->GetMaxMana() ) | |
2281 *(int *)v33 = v21->GetMaxMana(); | |
2282 v51 = 1; | |
2283 } | |
2284 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2285 { | |
2286 v34 = LODWORD(v21->pConditions[13]); | |
2287 --v21->sHealth; | |
2288 v35 = v21->sHealth; | |
2289 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2290 v21->pConditions[13] = pParty->uTimePlayed; | |
2291 if ( v35 < 1 ) | |
2292 { | |
2293 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2294 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2295 { | |
2296 v21->pConditions[13] = pParty->uTimePlayed; | |
2297 } | |
2298 else | |
2299 { | |
2300 if ( !v21->pConditions[14] ) | |
2301 v21->pConditions[14] = pParty->uTimePlayed; | |
2302 } | |
2303 } | |
2304 v51 = 1; | |
2305 } | |
2306 if ( v45 ) | |
2307 { | |
2308 v36 = (char *)&v21->sMana; | |
2309 ++*(int *)v36; | |
2310 if ( v21->sMana > v21->GetMaxMana() ) | |
2311 *(int *)v36 = v21->GetMaxMana(); | |
2312 } | |
2313 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2314 { | |
2315 v37 = v21->sHealth; | |
2316 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2317 v21->sHealth = v37 - 2; | |
2318 v38 = v21->sMana; | |
2319 if ( v38 > v21->GetMaxMana() / 2 ) | |
2320 v21->sMana = v38 - 2; | |
2321 } | |
2322 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2323 { | |
2324 v39 = v21->sHealth; | |
2325 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2326 v21->sHealth = v39 - 1; | |
2327 v40 = v21->sMana; | |
2328 if ( v40 > 0 ) | |
2329 v21->sMana = v40 - 1; | |
2330 } | |
2331 ++v49; | |
2332 if ( v49 >= 4 ) | |
2333 { | |
2334 result = HIDWORD(pParty->uTimePlayed); | |
2335 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2336 if ( !viewparams->bRedrawGameUI ) | |
2337 { | |
2338 result = v51; | |
2339 viewparams->bRedrawGameUI = v51; | |
2340 } | |
2341 return result; | |
2342 } | |
2343 goto LABEL_25; | |
2344 } | |
2345 } | |
2346 } | |
2347 return result; | |
2348 } | |
2349 | |
2350 //----- (00493F79) -------------------------------------------------------- | |
351 | 2351 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2352 { |
2353 signed __int64 v2; // ST2C_8@1 | |
2354 signed __int64 v3; // qax@1 | |
351 | 2355 //signed __int64 v4; // ST1C_8@1 |
0 | 2356 unsigned __int64 v5; // qax@1 |
2357 unsigned int v6; // ebx@1 | |
2358 | |
2359 v2 = (signed __int64)((double)a2 * 0.234375); | |
2360 v3 = v2 / 60 / 60; | |
351 | 2361 //v4 = v3; |
0 | 2362 v5 = (unsigned int)v3 / 0x18; |
2363 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2364 _this->field_0_expire_second = v2 % 60; |
2365 _this->field_4_expire_minute = v2 / 60 % 60; | |
2366 _this->field_8_expire_hour = v3 % 24; | |
2367 _this->field_10_expire_week = v5 / 7 & 3; | |
2368 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2369 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2370 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2371 } |
2372 | |
2373 //----- (00494035) -------------------------------------------------------- | |
2374 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2375 { | |
2376 signed __int64 v0; // qax@1 | |
2377 signed __int64 v1; // ST30_8@1 | |
2378 signed __int64 v2; // ST38_8@1 | |
2379 unsigned __int64 v3; // qax@1 | |
2380 unsigned int v4; // edi@1 | |
2381 //signed int v5; // eax@4 | |
2382 //char *v6; // ecx@5 | |
2383 //Player *v7; // esi@8 | |
2384 //char *v8; // ecx@12 | |
766 | 2385 //Player *pPlayer; // esi@15 |
0 | 2386 //void *v10; // esi@25 |
2387 unsigned int v11; // ecx@27 | |
2388 signed int v12; // edi@29 | |
2389 Player *v13; // ecx@30 | |
2390 Player *v14; // esi@35 | |
2391 double v15; // st7@35 | |
2392 Player **v16; // esi@43 | |
2393 Player *v17; // edi@44 | |
2394 double v18; // st7@44 | |
816 | 2395 //float v19; // ST28_4@48 |
2396 //double v20; // ST38_8@48 | |
0 | 2397 Player *v21; // esi@51 |
2398 signed int v22; // edi@53 | |
2399 int v23; // eax@59 | |
2400 int v24; // ecx@60 | |
2401 int v25; // eax@63 | |
2402 int v26; // ecx@64 | |
2403 int v27; // eax@67 | |
2404 int v28; // ecx@68 | |
2405 int v29; // eax@71 | |
2406 int v30; // ecx@72 | |
2407 int v31; // eax@75 | |
2408 int v32; // ecx@76 | |
2409 int v33; // eax@79 | |
2410 int v34; // ecx@80 | |
2411 int v35; // eax@83 | |
2412 int v36; // ecx@84 | |
2413 int v37; // eax@87 | |
2414 int v38; // ecx@88 | |
2415 int v39; // eax@91 | |
2416 int v40; // ecx@92 | |
2417 int v41; // eax@95 | |
2418 int v42; // ecx@96 | |
2419 bool v43; // ebx@102 | |
2420 //SpellBuff *v44; // edi@104 | |
2421 //signed int v45; // ebp@104 | |
2422 bool v46; // edi@111 | |
2423 //SpellBuff *v47; // esi@113 | |
2424 //Player **v48; // esi@119 | |
2425 //signed int v49; // edi@121 | |
2426 //char *v50; // esi@122 | |
2427 signed int v51; // edx@128 | |
2428 signed int v52; // ecx@130 | |
2429 int v53; // eax@131 | |
2430 Player *v54; // eax@141 | |
766 | 2431 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2432 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2433 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2434 int v58; // [sp-4h] [bp-34h]@33 |
2435 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2436 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2437 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2438 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2439 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2440 signed int a2a; // [sp+18h] [bp-18h]@47 |
2441 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2442 | |
766 | 2443 //a2 = pParty->uCurrentHour; |
0 | 2444 v61 = pParty->uDaysPlayed; |
816 | 2445 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2446 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2447 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2448 v1 = v0; |
2449 v0 /= 60i64; | |
2450 v2 = v0; | |
2451 v3 = (unsigned int)v0 / 24; | |
2452 v4 = (unsigned int)(v3 / 7) >> 2; | |
2453 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2454 pParty->uCurrentMinute = v1 % 60; | |
2455 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2456 pParty->uCurrentHour = v2 % 24; | |
2457 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2458 pParty->uCurrentMonth = v4 % 12; | |
352 | 2459 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2460 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2461 { |
2462 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2463 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2464 | |
2465 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2466 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2467 | |
766 | 2468 ++pParty->days_played_without_rest; |
2469 if (pParty->days_played_without_rest > 1) | |
0 | 2470 { |
2471 for (uint i = 0; i < 4; ++i) | |
766 | 2472 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2473 | |
2474 if (pParty->uNumFoodRations) | |
2475 Party::TakeFood(1); | |
0 | 2476 else |
2477 for (uint i = 0; i < 4; ++i) | |
766 | 2478 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2479 | |
2480 if (pParty->days_played_without_rest > 3) | |
2481 for (uint i = 0; i < 4; ++i) | |
0 | 2482 { |
766 | 2483 auto player = pParty->pPlayers + i; |
2484 | |
2485 player->Zero(); | |
2486 | |
2487 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2488 { |
767 | 2489 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2490 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2491 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2492 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2493 } |
2494 } | |
766 | 2495 } |
2496 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2497 pOutdoor->SetFog(); |
2498 | |
2499 for (uint i = 0; i < 4; ++i) | |
2500 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2501 } | |
766 | 2502 |
0 | 2503 v11 = LODWORD(pParty->uTimePlayed); |
2504 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2505 { | |
2506 v12 = 1; | |
2507 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2508 viewparams->bRedrawGameUI = 1; | |
2509 while ( 1 ) | |
2510 { | |
2511 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2512 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2513 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2514 { |
2515 v58 = 0; | |
2516 } | |
2517 else | |
2518 { | |
2519 v58 = 0; | |
2520 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2521 { | |
2522 v14 = pPlayers[v12]; | |
2523 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2524 v14->ReceiveDamage((signed __int64)v15, 0); | |
2525 if ( pParty->uFlags & 4 ) | |
2526 { | |
783 | 2527 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2528 GameUI_Footer_TimeLeft = 128; | |
0 | 2529 } |
2530 goto LABEL_39; | |
2531 } | |
2532 v13 = pPlayers[v12]; | |
2533 } | |
130 | 2534 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2535 LABEL_39: |
2536 ++v12; | |
2537 if ( v12 > 4 ) | |
2538 { | |
2539 v11 = LODWORD(pParty->uTimePlayed); | |
2540 break; | |
2541 } | |
2542 } | |
2543 } | |
2544 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2545 { | |
2546 viewparams->bRedrawGameUI = 1; | |
2547 pParty->field_6FC = v11 + 128; | |
2548 v16 = &pPlayers[1]; | |
2549 do | |
2550 { | |
2551 v17 = *v16; | |
2552 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2553 v17->ReceiveDamage((signed __int64)v18, 0); | |
2554 if ( pParty->uFlags & 0x200 ) | |
2555 { | |
783 | 2556 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2557 GameUI_Footer_TimeLeft = 128; | |
0 | 2558 } |
2559 ++v16; | |
2560 } | |
2561 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2562 } | |
2563 _493938_regenerate(); | |
2564 v65 = 4; | |
816 | 2565 a2a = pEventTimer->uTimeElapsed; |
2566 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2567 { | |
2568 //v19 = (double)(signed int)prev_time * 0.5; | |
2569 //v20 = v19 + 6.7553994e15; | |
2570 a2a *= 0.5f; | |
2571 if (a2a < 1) | |
0 | 2572 a2a = 1; |
2573 } | |
2574 v62 = &pPlayers[1]; | |
2575 do | |
2576 { | |
2577 v21 = *v62; | |
2578 if ( (*v62)->uTimeToRecovery ) | |
2579 v21->Recover(a2a); | |
2580 v22 = v21->sHealth; | |
2581 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2582 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2583 { | |
2584 if ( v22 >= 1 ) | |
2585 goto LABEL_59; | |
2586 v59 = 0; | |
2587 v56 = 13; | |
2588 } | |
2589 else | |
2590 { | |
2591 v59 = 0; | |
2592 v56 = 14; | |
2593 } | |
2594 v21->SetCondition(v56, v59); | |
2595 LABEL_59: | |
2596 v23 = (int)&v21->field_E0; | |
2597 if ( v21->field_E0 ) | |
2598 { | |
816 | 2599 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2600 if ( v24 > 0 ) |
2601 { | |
2602 *(int *)v23 = v24; | |
2603 } | |
2604 else | |
2605 { | |
2606 *(int *)v23 = 0; | |
2607 viewparams->bRedrawGameUI = 1; | |
2608 } | |
2609 } | |
2610 v25 = (int)&v21->field_E4; | |
2611 if ( v21->field_E4 ) | |
2612 { | |
816 | 2613 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2614 if ( v26 > 0 ) |
2615 { | |
2616 *(int *)v25 = v26; | |
2617 } | |
2618 else | |
2619 { | |
2620 *(int *)v25 = 0; | |
2621 viewparams->bRedrawGameUI = 1; | |
2622 } | |
2623 } | |
2624 v27 = (int)&v21->field_E8; | |
2625 if ( v21->field_E8 ) | |
2626 { | |
816 | 2627 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2628 if ( v28 > 0 ) |
2629 { | |
2630 *(int *)v27 = v28; | |
2631 } | |
2632 else | |
2633 { | |
2634 *(int *)v27 = 0; | |
2635 viewparams->bRedrawGameUI = 1; | |
2636 } | |
2637 } | |
2638 v29 = (int)&v21->field_EC; | |
2639 if ( v21->field_EC ) | |
2640 { | |
816 | 2641 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2642 if ( v30 > 0 ) |
2643 { | |
2644 *(int *)v29 = v30; | |
2645 } | |
2646 else | |
2647 { | |
2648 *(int *)v29 = 0; | |
2649 viewparams->bRedrawGameUI = 1; | |
2650 } | |
2651 } | |
2652 v31 = (int)&v21->field_F0; | |
2653 if ( v21->field_F0 ) | |
2654 { | |
816 | 2655 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2656 if ( v32 > 0 ) |
2657 { | |
2658 *(int *)v31 = v32; | |
2659 } | |
2660 else | |
2661 { | |
2662 *(int *)v31 = 0; | |
2663 viewparams->bRedrawGameUI = 1; | |
2664 } | |
2665 } | |
2666 v33 = (int)&v21->field_F4; | |
2667 if ( v21->field_F4 ) | |
2668 { | |
816 | 2669 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2670 if ( v34 > 0 ) |
2671 { | |
2672 *(int *)v33 = v34; | |
2673 } | |
2674 else | |
2675 { | |
2676 *(int *)v33 = 0; | |
2677 viewparams->bRedrawGameUI = 1; | |
2678 } | |
2679 } | |
2680 v35 = (int)&v21->field_F8; | |
2681 if ( v21->field_F8 ) | |
2682 { | |
816 | 2683 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2684 if ( v36 > 0 ) |
2685 { | |
2686 *(int *)v35 = v36; | |
2687 } | |
2688 else | |
2689 { | |
2690 *(int *)v35 = 0; | |
2691 viewparams->bRedrawGameUI = 1; | |
2692 } | |
2693 } | |
2694 v37 = (int)&v21->field_FC; | |
2695 if ( v21->field_FC ) | |
2696 { | |
816 | 2697 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2698 if ( v38 > 0 ) |
2699 { | |
2700 *(int *)v37 = v38; | |
2701 } | |
2702 else | |
2703 { | |
2704 *(int *)v37 = 0; | |
2705 viewparams->bRedrawGameUI = 1; | |
2706 } | |
2707 } | |
2708 v39 = (int)&v21->field_100; | |
2709 if ( v21->field_100 ) | |
2710 { | |
816 | 2711 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2712 if ( v40 > 0 ) |
2713 { | |
2714 *(int *)v39 = v40; | |
2715 } | |
2716 else | |
2717 { | |
2718 *(int *)v39 = 0; | |
2719 viewparams->bRedrawGameUI = 1; | |
2720 } | |
2721 } | |
2722 v41 = (int)&v21->field_104; | |
2723 if ( v21->field_104 ) | |
2724 { | |
816 | 2725 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2726 if ( v42 > 0 ) |
2727 { | |
2728 *(int *)v41 = v42; | |
2729 } | |
2730 else | |
2731 { | |
2732 *(int *)v41 = 0; | |
2733 viewparams->bRedrawGameUI = 1; | |
2734 } | |
2735 } | |
2736 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2737 --v65; | |
2738 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2739 | |
2740 for (uint k = 0; k < 24; ++k) | |
2741 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2742 | |
2743 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2744 v21->SetCondition(1u, 0); | |
2745 ++v62; | |
2746 } | |
2747 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2748 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2749 | |
2750 for (uint i = 0; i < 20; ++i) | |
2751 { | |
2752 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2753 viewparams->bRedrawGameUI = 1; | |
2754 } | |
2755 | |
2756 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2757 { | |
2758 for (uint i = 0; i < 4; ++i) | |
2759 pParty->pPlayers[i].SetCondition(1, 0); | |
2760 } | |
2761 | |
2762 for (uint i = 0; i < 2; ++i) | |
2763 { | |
2764 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2765 if (pBuf->uExpireTime == 0) | |
2766 continue; | |
2767 | |
2768 if ( !(pBuf->uFlags & 1) ) | |
2769 { | |
2770 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2771 { | |
2772 pBuf->Reset(); | |
2773 if (dword_4EE07C[i] == 7 ) | |
2774 pParty->bFlying = false; | |
2775 } | |
2776 } | |
2777 } | |
2778 | |
2779 v51 = v65; | |
2780 if ( v65 ) | |
2781 goto LABEL_135; | |
151 | 2782 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2783 { |
2784 v52 = (signed int)&pPlayers[1]; | |
2785 while ( 1 ) | |
2786 { | |
2787 v53 = *(int *)v52; | |
2788 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2789 break; | |
2790 v52 += 4; | |
2791 if ( v52 > (signed int)&pPlayers[4] ) | |
2792 goto LABEL_135; | |
2793 } | |
2794 *(int *)(v53 + 16) = 0; | |
2795 *(int *)(v53 + 20) = 0; | |
2796 v51 = 1; | |
2797 LABEL_135: | |
151 | 2798 if ( pCurrentScreen != SCREEN_REST |
0 | 2799 && (!v51 || dword_5C35C0) ) |
2800 uGameState = 8; | |
2801 } | |
2802 if ( uActiveCharacter ) | |
2803 { | |
151 | 2804 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2805 { |
2806 v54 = pPlayers[uActiveCharacter]; | |
2807 if ( v54->pConditions[2] | |
2808 || v54->pConditions[12] | |
2809 || v54->pConditions[13] | |
2810 || v54->pConditions[14] | |
2811 || v54->pConditions[15] | |
2812 || v54->pConditions[16] ) | |
2813 { | |
2814 viewparams->bRedrawGameUI = 1; | |
2815 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2816 } | |
2817 } | |
2818 } | |
2819 } | |
2820 | |
2821 //----- (00494820) -------------------------------------------------------- | |
758 | 2822 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2823 { |
2824 signed int v1; // eax@1 | |
2825 | |
2826 v1 = 5; | |
758 | 2827 if ( a1 % 24 >= 5 ) |
0 | 2828 v1 = 29; |
758 | 2829 return v1 - a1 % 24; |
0 | 2830 } |
2831 | |
2832 //----- (00494836) -------------------------------------------------------- | |
2833 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2834 { | |
2835 int v3; // esi@1 | |
2836 int result; // eax@1 | |
2837 stru339_spell_sound *v5; // ebx@1 | |
2838 int *v6; // edi@2 | |
2839 unsigned int v7; // eax@3 | |
2840 int v8; // [sp+Ch] [bp-8h]@3 | |
2841 int v9; // [sp+10h] [bp-4h]@2 | |
2842 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2843 | |
2844 v3 = 0; | |
2845 result = word_4EE088_sound_ids[uSoundID]; | |
2846 v5 = this; | |
2847 a2a = word_4EE088_sound_ids[uSoundID]; | |
2848 if ( result ) | |
2849 { | |
2850 v9 = 0; | |
2851 v6 = this->pSoundsOffsets; | |
2852 do | |
2853 { | |
2854 v7 = a2a++; | |
2855 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2856 if ( !result ) | |
2857 break; | |
2858 a6 += 4; | |
2859 result = v8 + 256; | |
2860 *v6 = v3; | |
2861 v3 += result; | |
2862 ++v9; | |
2863 *(v6 - 2) = result; | |
2864 ++v6; | |
2865 } | |
2866 while ( v9 < 2 ); | |
2867 } | |
2868 return result; | |
2869 } | |
2870 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2871 | |
2872 //----- (00494AED) -------------------------------------------------------- | |
130 | 2873 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2874 { |
2875 unsigned int _uNumFrames; // edx@1 | |
2876 unsigned int result; // eax@1 | |
2877 PlayerFrame *v4; // ecx@2 | |
2878 | |
2879 _uNumFrames = this->uNumFrames; | |
2880 result = 0; | |
2881 if ( (signed int)this->uNumFrames <= 0 ) | |
2882 { | |
2883 LABEL_5: | |
2884 result = 0; | |
2885 } | |
2886 else | |
2887 { | |
2888 v4 = this->pFrames; | |
130 | 2889 while ( v4->expression != expression ) |
0 | 2890 { |
2891 ++result; | |
2892 ++v4; | |
2893 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2894 goto LABEL_5; | |
2895 } | |
2896 } | |
2897 return result; | |
2898 } | |
2899 | |
2900 //----- (00494B10) -------------------------------------------------------- | |
2901 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2902 { | |
2903 unsigned int v3; // esi@1 | |
2904 PlayerFrame *v4; // edi@1 | |
2905 PlayerFrame *v5; // ecx@1 | |
2906 __int16 v6; // dx@2 | |
2907 int v7; // edx@3 | |
2908 char *i; // eax@3 | |
2909 int v9; // ecx@5 | |
2910 PlayerFrame *result; // eax@6 | |
2911 | |
2912 v3 = uFramesetID; | |
2913 v4 = this->pFrames; | |
2914 v5 = &v4[uFramesetID]; | |
2915 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2916 { | |
2917 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2918 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2919 { | |
2920 v9 = *(short *)i; | |
2921 if ( v7 <= v9 ) | |
2922 break; | |
2923 v7 -= v9; | |
2924 ++v3; | |
2925 } | |
2926 result = &v4[v3]; | |
2927 } | |
2928 else | |
2929 { | |
2930 result = &v4[uFramesetID]; | |
2931 } | |
2932 return result; | |
2933 } | |
2934 | |
2935 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2936 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2937 { |
2938 PlayerFrameTable *v4; // edi@1 | |
2939 int v5; // esi@1 | |
2940 int v6; // eax@2 | |
2941 | |
2942 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2943 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2944 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
|
2945 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2946 *pAnimTime = v5; |
0 | 2947 } |
2948 else | |
2949 { | |
2950 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2951 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2952 *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
|
2953 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2954 return &v4->pFrames[*pFramesetID]; |
0 | 2955 } |
2956 | |
2957 //----- (00494BC3) -------------------------------------------------------- | |
2958 void PlayerFrameTable::ToFile() | |
2959 { | |
2960 PlayerFrameTable *v1; // esi@1 | |
2961 FILE *v2; // eax@1 | |
2962 FILE *v3; // edi@1 | |
2963 | |
2964 auto Str = this; | |
2965 | |
2966 v1 = Str; | |
2967 v2 = fopen("data\\dpft.bin", "wb"); | |
2968 v3 = v2; | |
2969 if ( !v2 ) | |
2970 Abortf("Unable to save dpft.bin!"); | |
2971 fwrite(v1, 4u, 1u, v2); | |
2972 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2973 fclose(v3); | |
2974 } | |
2975 | |
2976 //----- (00494C0F) -------------------------------------------------------- | |
2977 void PlayerFrameTable::FromFile(void *pSerialized) | |
2978 { | |
2979 uNumFrames = *(int *)pSerialized; | |
2980 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2981 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2982 } | |
2983 | |
2984 //----- (00494C5A) -------------------------------------------------------- | |
2985 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2986 { | |
2987 PlayerFrameTable *v2; // ebx@1 | |
2988 FILE *v3; // eax@1 | |
2989 int v4; // esi@3 | |
2990 void *v5; // eax@10 | |
2991 FILE *v6; // ST0C_4@12 | |
2992 char *i; // eax@12 | |
2993 __int16 v8; // ax@15 | |
2994 const char *v9; // ST10_4@15 | |
2995 unsigned __int16 v10; // ax@15 | |
2996 const char *v11; // ST0C_4@15 | |
2997 int j; // esi@15 | |
2998 int v13; // eax@17 | |
2999 int v14; // edx@22 | |
3000 int v15; // ecx@23 | |
3001 int v16; // eax@24 | |
3002 signed int k; // eax@27 | |
3003 PlayerFrame *v18; // edx@28 | |
3004 int v19; // esi@28 | |
3005 int l; // ecx@29 | |
3006 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3007 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3008 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3009 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3010 int v26; // [sp+2FCh] [bp-8h]@3 | |
3011 FILE *File; // [sp+300h] [bp-4h]@1 | |
3012 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3013 | |
3014 v2 = this; | |
3015 //TileTable::dtor((TileTable *)this); | |
3016 v3 = fopen(Args, "r"); | |
3017 File = v3; | |
3018 if ( !v3 ) | |
3019 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3020 v4 = 0; | |
3021 v25 = 0; | |
3022 v26 = 1; | |
3023 if ( fgets(&Buf, 490, v3) ) | |
3024 { | |
3025 do | |
3026 { | |
3027 *strchr(&Buf, 10) = 0; | |
703 | 3028 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3029 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3030 { | |
3031 if ( v24.uPropCount < 3 ) | |
0 | 3032 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3033 ++v25; | |
3034 } | |
3035 ++v26; | |
3036 } | |
3037 while ( fgets(&Buf, 490, File) ); | |
3038 v4 = v25; | |
3039 } | |
3040 v2->uNumFrames = v4; | |
3041 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3042 v2->pFrames = (PlayerFrame *)v5; | |
3043 if ( !v5 ) | |
3044 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3045 v6 = File; | |
3046 v2->uNumFrames = 0; | |
3047 fseek(v6, 0, 0); | |
3048 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3049 { | |
3050 *strchr(&Buf, 10) = 0; | |
703 | 3051 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3052 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3053 { |
3054 v8 = atoi(v24.pProperties[0]); | |
3055 v9 = v24.pProperties[1]; | |
130 | 3056 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3057 v10 = atoi(v9); |
3058 v11 = v24.pProperties[2]; | |
3059 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3060 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3061 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3062 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3063 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3064 { |
3065 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3066 { | |
3067 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3068 *(char *)v13 |= 4u; | |
3069 } | |
3070 } | |
3071 ++v2->uNumFrames; | |
3072 } | |
3073 } | |
3074 fclose(File); | |
3075 v14 = 0; | |
3076 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3077 { | |
3078 v15 = 0; | |
3079 do | |
3080 { | |
3081 v16 = (int)&v2->pFrames[v15]; | |
3082 if ( !(*(char *)(v16 + 18) & 4) ) | |
3083 *(char *)(v16 + 8) |= 1u; | |
3084 ++v14; | |
3085 ++v15; | |
3086 } | |
3087 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3088 } | |
3089 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3090 { | |
3091 v18 = v2->pFrames; | |
3092 Argsa = (int)&v18[k]; | |
3093 v19 = *(short *)(Argsa + 4); | |
3094 if ( *(char *)(Argsa + 8) & 1 ) | |
3095 { | |
3096 ++k; | |
3097 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3098 { | |
3099 v19 += *(short *)(l + 4); | |
3100 ++k; | |
3101 } | |
3102 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3103 } | |
3104 ++k; | |
3105 } | |
3106 return 1; | |
3107 } | |
3108 | |
3109 //----- (00494F3A) -------------------------------------------------------- | |
3110 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3111 { | |
3112 IconFrameTable *v2; // esi@1 | |
3113 int v3; // ebx@1 | |
3114 unsigned int uID; // edi@1 | |
3115 unsigned int result; // eax@4 | |
3116 | |
3117 v2 = this; | |
3118 v3 = 0; | |
3119 uID = 0; | |
3120 if ( (signed int)this->uNumIcons <= 0 ) | |
3121 { | |
3122 LABEL_4: | |
3123 result = 0; | |
3124 } | |
3125 else | |
3126 { | |
3127 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3128 { | |
3129 ++uID; | |
3130 ++v3; | |
3131 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3132 goto LABEL_4; | |
3133 } | |
3134 result = uID; | |
3135 } | |
3136 return result; | |
3137 } | |
3138 | |
3139 //----- (00494F70) -------------------------------------------------------- | |
3140 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3141 { | |
3142 IconFrame *v3; // edi@1 | |
3143 IconFrame *v4; // ecx@1 | |
3144 __int16 v5; // dx@2 | |
3145 int v6; // edx@3 | |
3146 unsigned int v7; // eax@3 | |
3147 char *i; // ecx@3 | |
3148 int v9; // esi@5 | |
3149 IconFrame *result; // eax@6 | |
3150 | |
3151 v3 = this->pIcons; | |
3152 v4 = &v3[uIconID]; | |
3153 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3154 { | |
3155 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3156 v7 = uIconID; | |
3157 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3158 { | |
3159 v9 = *(short *)i; | |
3160 if ( v6 <= v9 ) | |
3161 break; | |
3162 v6 -= v9; | |
3163 ++v7; | |
3164 } | |
3165 result = &v3[v7]; | |
3166 } | |
3167 else | |
3168 { | |
3169 result = &v3[uIconID]; | |
3170 } | |
3171 return result; | |
3172 } | |
3173 | |
3174 //----- (00494FBF) -------------------------------------------------------- | |
3175 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3176 { | |
3177 IconFrameTable *v2; // esi@1 | |
3178 unsigned int v3; // edi@3 | |
3179 const char *i; // eax@3 | |
3180 IconFrame *v5; // eax@5 | |
3181 | |
3182 v2 = this; | |
3183 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3184 { | |
3185 v3 = uIconID; | |
3186 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3187 { | |
3188 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3189 v5 = v2->pIcons; | |
3190 if ( !(v5[v3].uFlags & 1) ) | |
3191 break; | |
3192 ++v3; | |
3193 } | |
3194 } | |
3195 } | |
3196 | |
3197 //----- (0049500A) -------------------------------------------------------- | |
3198 void IconFrameTable::ToFile() | |
3199 { | |
3200 IconFrameTable *v1; // esi@1 | |
3201 FILE *v2; // eax@1 | |
3202 FILE *v3; // edi@1 | |
3203 | |
3204 auto Str = this; | |
3205 | |
3206 v1 = Str; | |
3207 v2 = fopen("data\\dift.bin", "wb"); | |
3208 v3 = v2; | |
3209 if ( !v2 ) | |
3210 Abortf("Unable to save dift.bin!"); | |
3211 fwrite(v1, 4u, 1u, v2); | |
3212 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3213 fclose(v3); | |
3214 } | |
3215 | |
3216 //----- (00495056) -------------------------------------------------------- | |
3217 void IconFrameTable::FromFile(void *pSerialized) | |
3218 { | |
3219 uNumIcons = *(int *)pSerialized; | |
3220 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3221 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3222 } | |
3223 | |
3224 //----- (0049509D) -------------------------------------------------------- | |
3225 int IconFrameTable::FromFileTxt(const char *Args) | |
3226 { | |
3227 IconFrameTable *v2; // ebx@1 | |
3228 FILE *v3; // eax@1 | |
3229 int v4; // esi@3 | |
3230 void *v5; // eax@10 | |
3231 FILE *v6; // ST0C_4@12 | |
3232 char *i; // eax@12 | |
3233 const char *v8; // ST00_4@15 | |
3234 int v9; // eax@16 | |
3235 int v10; // edx@20 | |
3236 int v11; // ecx@21 | |
3237 int v12; // eax@22 | |
3238 signed int j; // edx@25 | |
3239 IconFrame *v14; // ecx@26 | |
3240 int v15; // esi@26 | |
3241 int k; // eax@27 | |
3242 signed int result; // eax@11 | |
3243 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3244 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3245 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3246 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3247 int v22; // [sp+2FCh] [bp-8h]@3 | |
3248 FILE *File; // [sp+300h] [bp-4h]@1 | |
3249 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3250 | |
3251 v2 = this; | |
3252 //TileTable::dtor((TileTable *)this); | |
3253 v3 = fopen(Args, "r"); | |
3254 File = v3; | |
3255 if ( !v3 ) | |
3256 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3257 v4 = 0; | |
3258 v21 = 0; | |
3259 v22 = 1; | |
3260 if ( fgets(&Buf, 490, v3) ) | |
3261 { | |
3262 do | |
3263 { | |
3264 *strchr(&Buf, 10) = 0; | |
3265 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3266 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3267 { | |
3268 if ( v20.uPropCount < 3 ) | |
0 | 3269 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3270 ++v21; | |
3271 } | |
3272 ++v22; | |
3273 } | |
3274 while ( fgets(&Buf, 490, File) ); | |
3275 v4 = v21; | |
3276 } | |
3277 v2->uNumIcons = v4; | |
3278 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3279 v2->pIcons = (IconFrame *)v5; | |
3280 if ( v5 ) | |
3281 { | |
3282 v6 = File; | |
3283 v2->uNumIcons = 0; | |
3284 fseek(v6, 0, 0); | |
3285 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3286 { | |
3287 *strchr(&Buf, 10) = 0; | |
3288 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3289 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3290 { |
3291 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3292 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3293 v8 = v20.pProperties[2]; | |
3294 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3295 if ( !_strcmpi(v8, "new") ) | |
3296 { | |
3297 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3298 *(char *)v9 |= 4u; | |
3299 } | |
3300 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3301 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3302 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3303 } | |
3304 } | |
3305 fclose(File); | |
3306 v10 = 0; | |
3307 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3308 { | |
3309 v11 = 0; | |
3310 do | |
3311 { | |
3312 v12 = (int)&v2->pIcons[v11]; | |
3313 if ( !(*(char *)(v12 + 60) & 4) ) | |
3314 *(char *)(v12 + 28) |= 1u; | |
3315 ++v10; | |
3316 ++v11; | |
3317 } | |
3318 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3319 } | |
3320 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3321 { | |
3322 v14 = v2->pIcons; | |
3323 Argsa = (int)&v14[j]; | |
3324 v15 = *(short *)(Argsa + 24); | |
3325 if ( *(char *)(Argsa + 28) & 1 ) | |
3326 { | |
3327 ++j; | |
3328 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3329 { | |
3330 v15 += *(short *)(k + 24); | |
3331 ++j; | |
3332 } | |
3333 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3334 } | |
3335 ++j; | |
3336 } | |
3337 result = 1; | |
3338 } | |
3339 else | |
3340 { | |
3341 fclose(File); | |
3342 result = 0; | |
3343 } | |
3344 return result; | |
3345 } | |
3346 | |
3347 //----- (00495366) -------------------------------------------------------- | |
3348 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3349 { | |
3350 int v2; // edi@1 | |
3351 int v3; // edx@2 | |
3352 int v4; // esi@3 | |
3353 int v5; // ebx@5 | |
3354 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3355 signed int v8; // [sp+10h] [bp-10h]@1 | |
3356 int **v9; // [sp+14h] [bp-Ch]@4 | |
3357 signed int v10; // [sp+18h] [bp-8h]@3 | |
3358 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3359 | |
3360 v2 = a1; | |
3361 v11 = a2; | |
3362 v8 = 0; | |
3363 v7 = 0; | |
3364 if ( dword_AE336C == a1 ) | |
3365 { | |
3366 v3 = dword_AE3370; | |
3367 } | |
3368 else | |
3369 { | |
3370 v4 = a2; | |
3371 dword_AE336C = a1; | |
3372 v10 = 0; | |
3373 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3374 goto LABEL_17; | |
3375 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3376 do | |
3377 { | |
3378 v5 = tolower(*(char *)*v9); | |
3379 if ( v5 == tolower(v2) ) | |
3380 { | |
3381 if ( v8 ) | |
3382 v7 = v10; | |
3383 else | |
3384 v8 = v10; | |
3385 } | |
3386 ++v10; | |
3387 v9 += 2; | |
3388 } | |
3389 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3390 if ( v8 && v8 != v7 ) | |
3391 v3 = v8 + rand() % (v7 - v8); | |
3392 else | |
3393 LABEL_17: | |
3394 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3395 } | |
3396 dword_AE3370 = v3; | |
3397 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3398 } | |
3399 // AE336C: using guessed type int dword_AE336C; | |
3400 // AE3370: using guessed type int dword_AE3370; | |
3401 | |
3402 //----- (00495430) -------------------------------------------------------- | |
607 | 3403 char * GetReputationString( signed int a1 ) |
3404 { | |
566 | 3405 if (a1 >= 25) |
3406 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3407 else if (a1 >= 6) | |
3408 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3409 else if (a1 >= -5) | |
3410 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3411 else if (a1 >= -24) | |
3412 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3413 else |
566 | 3414 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3415 } |
3416 | |
3417 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3418 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3419 { |
3420 unsigned __int8 v6; // bl@1 | |
3421 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3422 //NPCData *v9; // eax@4 |
250 | 3423 //size_t v10; // eax@6 |
0 | 3424 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3425 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3426 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3427 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3428 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3429 //int v16; // edx@10 |
0 | 3430 int v17; // eax@10 |
3431 signed __int64 v18; // qax@18 | |
3432 unsigned int v19; // edi@32 | |
3433 unsigned __int8 *v20; // ebx@32 | |
3434 int v21; // ecx@34 | |
3435 __int16 v22; // ax@34 | |
3436 int v23; // edx@39 | |
3437 int v24; // eax@39 | |
3438 int v25; // eax@45 | |
3439 float *v26; // esi@68 | |
3440 float v27; // ST18_4@68 | |
3441 signed int v28; // eax@68 | |
3442 int v29; // eax@68 | |
3443 float v30; // ST18_4@72 | |
3444 signed int v31; // eax@72 | |
3445 float v32; // ST18_4@74 | |
3446 signed int v33; // eax@74 | |
3447 double v34; // st7@75 | |
3448 float v35; // ST18_4@76 | |
3449 signed int v36; // eax@76 | |
3450 float *v37; // esi@78 | |
3451 float v38; // ST18_4@78 | |
3452 int v39; // eax@78 | |
3453 float v40; // ST18_4@82 | |
3454 int v41; // eax@82 | |
3455 float v42; // ST18_4@83 | |
3456 int v43; // eax@83 | |
3457 float v44; // ST18_4@85 | |
3458 int v45; // eax@85 | |
3459 const char *v46; // eax@86 | |
3460 unsigned int v47; // eax@87 | |
3461 float v48; // ST18_4@97 | |
3462 __int64 v49; // ST14_8@107 | |
3463 int v50; // eax@107 | |
3464 int v51; // eax@108 | |
3465 Player *v52; // eax@109 | |
3466 int v53; // [sp-4h] [bp-13Ch]@107 | |
3467 int v54; // [sp+0h] [bp-138h]@107 | |
3468 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3469 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3470 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3471 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3472 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3473 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3474 //Player *v61; // [sp+124h] [bp-14h]@3 |
3475 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3476 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 |
0 | 3482 |
3483 v6 = uPlayerID; | |
249 | 3484 //Str = lpsz; |
0 | 3485 if ( IsBadStringPtrA(lpsz, 1u) ) |
3486 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 |
0 | 3488 a1[0] = 0; |
3489 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3490 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3491 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3493 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 NPCData *npc = nullptr; |
0 | 3495 if ( dword_5C35D4 ) |
248 | 3496 { |
463 | 3497 //__debugbreak(); // fix |
459 | 3498 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
|
3499 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 else |
602 | 3501 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 //v65 = v9; |
250 | 3503 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3504 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3510 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 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
|
3527 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 case 2: |
0 | 3534 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 case 5: |
0 | 3541 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3542 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3543 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3544 { | |
3545 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3546 { | |
3547 if ( v18 < 20 ) | |
3548 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3549 } | |
3550 else | |
3551 { | |
3552 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3553 } | |
3554 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 case 6: |
0 | 3557 if ( pPlayer->uSex ) |
3558 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3559 else | |
3560 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 case 7: |
0 | 3563 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 case 8: |
0 | 3569 v19 = 0; |
3570 v63 = 0; | |
484 | 3571 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3572 do |
3573 { | |
3574 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3575 { | |
3576 v21 = v63; | |
3577 v22 = word_4EE150[v19]; | |
3578 ++v63; | |
3579 v55[v21] = v22; | |
3580 } | |
3581 ++v19; | |
3582 } | |
3583 while ( v19 < 28 ); | |
3584 if ( v63 ) | |
3585 { | |
3586 v23 = rand() % v63; | |
3587 v24 = dword_A74CDC; | |
3588 if ( dword_A74CDC == -1 ) | |
3589 { | |
3590 v24 = v23; | |
3591 dword_A74CDC = v23; | |
3592 } | |
492 | 3593 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3594 } |
3595 else | |
3596 { | |
3597 v11 = (char *)pNPCTopics[55].pText; | |
3598 } | |
249 | 3599 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3606 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3608 case 10: |
0 | 3609 if ( pPlayer->uSex ) |
3610 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3611 else | |
3612 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3613 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 case 11: |
0 | 3615 v25 = GetPartyReputation(); |
3616 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3617 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3618 v25 = npc->rep; |
0 | 3619 LABEL_46: |
3620 if ( v25 >= 25 ) | |
3621 { | |
3622 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3623 } | |
3624 else | |
3625 { | |
3626 if ( v25 < 6 ) | |
3627 { | |
3628 if ( v25 >= -5 ) | |
3629 { | |
3630 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3631 } | |
3632 else | |
3633 { | |
3634 if ( v25 < -24 ) | |
3635 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3636 else | |
3637 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3638 } | |
3639 } | |
3640 else | |
3641 { | |
3642 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3643 } | |
3644 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3645 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 case 13: |
0 | 3647 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 } |
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 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 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
|
3680 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 sprintf(a1, "%lu", pay_percentage); |
250 | 3684 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 } |
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 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 sprintf(a1, "%lu", v51); |
0 | 3698 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 } |
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 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3725 switch ( a5 ) |
3726 { | |
3727 case 3: | |
3728 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3729 v45 = a3->GetValue(); |
0 | 3730 v29 = pPlayer->_4B8213(v45, v44); |
3731 break; | |
3732 case 4: | |
3733 v29 = pPlayer->_4B824B(*v37); | |
3734 break; | |
3735 case 5: | |
3736 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3737 v43 = a3->GetValue(); |
0 | 3738 v29 = pPlayer->_4B8265(v43, v42); |
3739 break; | |
3740 case 6: | |
3741 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3742 v41 = a3->GetValue(); |
0 | 3743 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3744 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 } |
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 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3752 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3753 v28 = a3->GetValue(); |
749 | 3754 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3755 if ( a5 == 3 ) |
3756 { | |
3757 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3758 v36 = a3->GetValue(); |
917 | 3759 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3760 if (a3->Broken()) |
0 | 3761 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3762 goto _continue_sprintf; |
0 | 3763 } |
3764 if ( a5 != 4 ) | |
3765 { | |
3766 if ( a5 == 5 ) | |
3767 { | |
3768 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3769 v33 = a3->GetValue(); |
916 | 3770 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3771 } |
3772 else | |
3773 { | |
3774 if ( a5 == 6 ) | |
3775 { | |
3776 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3777 v31 = a3->GetValue(); |
917 | 3778 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3779 if (a3->Broken()) |
0 | 3780 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3781 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 goto _continue_sprintf; |
0 | 3784 } |
3785 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3786 _continue_sprintf: |
0 | 3787 sprintf(a1, "%lu", v29); |
250 | 3788 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3789 goto _continue_strcat; |
0 | 3790 } |
3791 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3792 |
0 | 3793 v48 = v34; |
916 | 3794 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 } |
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 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 } |
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 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 v48 = v34; |
916 | 3810 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 } |
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 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3818 sub_493F79(&v57, *a6); |
351 | 3819 v54 = v57.field_18_expire_year; |
3820 v53 = v57.field_C_expire_day + 1; | |
3821 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 } |
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 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3830 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3834 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 default: |
0 | 3836 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3837 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3838 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3839 goto _continue_strcat; |
484 | 3840 v49 = pParty->field_3C._s_times[v17-51]; |
3841 | |
0 | 3842 sub_493F79(&v56, v49); |
351 | 3843 v54 = v56.field_18_expire_year; |
3844 v53 = v56.field_C_expire_day + 1; | |
3845 v50 = v56.field_14_exprie_month; | |
0 | 3846 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3847 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3848 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3849 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3850 } |
0 | 3851 } |
3852 return pTmpBuf2; | |
3853 } | |
3854 | |
3855 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3856 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3857 { |
734 | 3858 //stru154 *v3; // edi@1 |
3859 //signed int v4; // eax@1 | |
3860 //signed int result; // eax@9 | |
3861 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3862 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3863 float v7; |
0 | 3864 |
3865 v.x = 0.0; | |
3866 v.y = 0.0; | |
3867 v.z = 0.0; | |
734 | 3868 GetFacePlane(a2, a3, &v, &v7); |
3869 | |
3870 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3871 polygonType = POLYGON_VerticalWall; | |
3872 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3873 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3874 polygonType = POLYGON_Floor; | |
0 | 3875 else |
734 | 3876 polygonType = POLYGON_InBetweenFloorAndWall; |
3877 | |
3878 face_plane.vNormal.x = v.x; | |
3879 face_plane.vNormal.y = v.y; | |
3880 face_plane.vNormal.z = v.z; | |
3881 face_plane.dist = v7; | |
0 | 3882 } |
3883 | |
3884 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3885 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3886 { |
734 | 3887 if (fabsf(pNormal->z) < 1e-6f) |
3888 polygonType = POLYGON_VerticalWall; | |
3889 else if (fabsf(pNormal->x) < 1e-6f && | |
3890 fabsf(pNormal->y) < 1e-6f) | |
3891 polygonType = POLYGON_Floor; | |
0 | 3892 else |
734 | 3893 polygonType = POLYGON_InBetweenFloorAndWall; |
3894 | |
3895 face_plane.vNormal.x = pNormal->x; | |
3896 face_plane.dist = dist; | |
3897 face_plane.vNormal.y = pNormal->y; | |
3898 face_plane.vNormal.z = pNormal->z; | |
0 | 3899 } |
3900 | |
3901 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3902 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3903 { |
3904 ODMFace *v5; // ebx@1 | |
734 | 3905 //int v6; // eax@1 |
3906 //unsigned __int16 *v7; // ebx@2 | |
3907 //Vec3_int_ *v8; // eax@3 | |
0 | 3908 Vec3_int_ *v9; // ecx@3 |
734 | 3909 //double v10; // st7@3 |
3910 //int v11; // ecx@3 | |
0 | 3911 Vec3_int_ *v12; // ecx@3 |
734 | 3912 //double v13; // st7@3 |
3913 //double v14; // st6@3 | |
3914 //double v15; // st5@3 | |
3915 //int v16; // ecx@3 | |
0 | 3916 Vec3_int_ *v17; // eax@3 |
734 | 3917 //double v18; // st5@3 |
0 | 3918 Vec3_float_ *v19; // eax@3 |
734 | 3919 //int result; // eax@8 |
3920 //float v21; // ecx@10 | |
3921 //double v22; // st7@10 | |
3922 //double v23; // st6@10 | |
0 | 3923 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3924 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3925 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3926 float v27; // [sp+20h] [bp-48h]@3 | |
3927 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3928 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3929 //float v30; // [sp+30h] [bp-38h]@3 | |
3930 //float v31; // [sp+34h] [bp-34h]@3 | |
3931 //float v32; // [sp+38h] [bp-30h]@3 | |
3932 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3933 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3934 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3935 //float v36; // [sp+50h] [bp-18h]@3 | |
3936 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3937 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3938 //int v39; // [sp+64h] [bp-4h]@1 |
3939 | |
3940 //v39 = 0; | |
0 | 3941 v1.x = 0.0; |
3942 v5 = pFace; | |
734 | 3943 //v6 = pFace->uNumVertices; |
0 | 3944 v1.y = 0.0; |
3945 v1.z = 0.0; | |
734 | 3946 |
3947 if (pFace->uNumVertices >= 2) | |
3948 { | |
3949 int i = 0; | |
3950 while ( i < pFace->uNumVertices - 2 ) | |
3951 { | |
3952 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3953 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3954 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3955 | |
3956 v1.x = v12->x - v9->x; | |
3957 v26 = v17->x - v12->x; | |
3958 v1.y = v12->y - v9->y; | |
3959 v27 = v17->y - v12->y; | |
3960 v1.z = v12->z - v9->z; | |
3961 v28 = v17->z - v12->z; | |
0 | 3962 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3963 v38.x = v19->x; | |
3964 v38.y = v19->y; | |
3965 v38.z = v19->z; | |
734 | 3966 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3967 { | |
3968 v38.Normalize(); | |
3969 | |
3970 pOutNormal->x = v38.x; | |
3971 pOutNormal->y = v38.y; | |
3972 pOutNormal->z = v38.z; | |
3973 | |
3974 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3975 return; | |
3976 } | |
3977 } | |
3978 } | |
3979 | |
3980 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3981 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3982 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3983 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3984 } |
3985 | |
3986 //----- (0049D700) -------------------------------------------------------- | |
3987 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3988 { | |
3989 unsigned int v1; // eax@1 | |
3990 int v2; // ecx@1 | |
3991 unsigned int v3; // eax@1 | |
3992 | |
3993 v1 = uDim; | |
3994 v2 = 0; | |
3995 v3 = v1 - 1; | |
3996 while ( v3 & 1 ) | |
3997 { | |
3998 v3 >>= 1; | |
3999 ++v2; | |
4000 } | |
4001 return v3 == 0 ? v2 : 0; | |
4002 } | |
4003 | |
4004 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4005 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4006 { |
737 | 4007 /*signed __int64 v2; // ST10_8@1 |
0 | 4008 double v3; // st7@1 |
4009 float v4; // ST24_4@1 | |
4010 double v5; // ST10_8@1 | |
4011 int v6; // ST1C_4@1 | |
4012 float v7; // ST24_4@1 | |
4013 double v8; // ST10_8@1 | |
4014 unsigned __int8 v9; // ST20_1@1 | |
4015 float v10; // ST24_4@1 | |
4016 double v11; // ST10_8@1 | |
4017 float v12; // ST24_4@1 | |
737 | 4018 double v13; // ST08_8@1*/ |
4019 | |
4020 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4021 (a2 >> 24) / 255.0f * 255.0f), | |
4022 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4023 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4024 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4025 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4026 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4027 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4028 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4029 /*v2 = a1 >> 24; | |
4030 v3 = (double)v2 / 255.0f; | |
4031 HIDWORD(v2) = 0; | |
0 | 4032 LODWORD(v2) = a2 >> 24; |
737 | 4033 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4034 v5 = v4 + 6.7553994e15; |
4035 v6 = LODWORD(v5); | |
737 | 4036 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4037 v8 = v7 + 6.7553994e15; |
4038 v9 = LOBYTE(v8); | |
737 | 4039 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4040 v11 = v10 + 6.7553994e15; |
737 | 4041 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4042 v13 = v12 + 6.7553994e15; |
737 | 4043 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4044 } |
4045 | |
4046 //----- (004A46E6) -------------------------------------------------------- | |
4047 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4048 { | |
4049 int v5; // eax@1 | |
4050 int z; // eax@1 | |
4051 unsigned int v7; // eax@9 | |
4052 unsigned int v8; // ecx@9 | |
4053 int v9; // eax@9 | |
4054 unsigned int v10; // eax@10 | |
4055 int *v11; // esi@10 | |
4056 int *v12; // edi@10 | |
4057 int v13; // ecx@10 | |
4058 int v14; // edx@10 | |
4059 unsigned int v15; // eax@22 | |
4060 int *v16; // esi@22 | |
4061 int *v17; // edi@22 | |
4062 int v18; // ecx@22 | |
4063 int v19; // edx@22 | |
4064 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4065 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4066 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4067 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4068 | |
4069 v5 = a4; | |
4070 v23 = _z >> 16; | |
4071 z = x + v5; | |
693 | 4072 if ( z >= (signed int)pViewport->uViewportTL_X |
4073 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4074 && y >= (signed int)pViewport->uViewportTL_Y | |
4075 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4076 { | |
4077 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4078 x = pViewport->uViewportTL_X; | |
4079 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4080 z = pViewport->uViewportBR_X; | |
0 | 4081 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4082 v22 = z - x; | |
4083 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4084 v7 = lightColor >> 3; | |
4085 v8 = lightColor & 0xF0; | |
4086 v9 = v7 & 0x1E0000; | |
4087 if ( pRenderer->uTargetGBits == 5 ) | |
4088 { | |
4089 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4090 v11 = (int *)pTarget; | |
4091 v12 = pTargetZ; | |
4092 v13 = v22; | |
4093 v14 = (v10 << 16) | v10; | |
4094 z = (unsigned __int8)pTarget & 2; | |
4095 if ( (unsigned __int8)pTarget & 2 ) | |
4096 { | |
4097 z = (unsigned int)*pTargetZ >> 16; | |
4098 if ( z > v23 ) | |
4099 { | |
4100 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4101 *pTarget = z; | |
4102 } | |
4103 v13 = v22 - 1; | |
4104 v11 = (int *)(pTarget + 1); | |
4105 v12 = pTargetZ + 1; | |
4106 } | |
4107 while ( v13 != 1 ) | |
4108 { | |
4109 if ( v13 < 1 ) | |
4110 return z; | |
4111 z = (unsigned int)*v12 >> 16; | |
4112 if ( z <= v23 ) | |
4113 { | |
4114 v13 -= 2; | |
4115 ++v11; | |
4116 v12 += 2; | |
4117 } | |
4118 else | |
4119 { | |
4120 v12 += 2; | |
4121 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4122 v13 -= 2; | |
4123 *v11 = z; | |
4124 ++v11; | |
4125 } | |
4126 } | |
4127 z = (unsigned int)*v12 >> 16; | |
4128 if ( z > v23 ) | |
4129 { | |
4130 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4131 *(short *)v11 = z; | |
4132 } | |
4133 } | |
4134 else | |
4135 { | |
4136 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4137 v16 = (int *)pTarget; | |
4138 v17 = pTargetZ; | |
4139 v18 = v22; | |
4140 v19 = (v15 << 16) | v15; | |
4141 z = (unsigned __int8)pTarget & 2; | |
4142 if ( (unsigned __int8)pTarget & 2 ) | |
4143 { | |
4144 z = (unsigned int)*pTargetZ >> 16; | |
4145 if ( z > v23 ) | |
4146 { | |
4147 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4148 *pTarget = z; | |
4149 } | |
4150 v18 = v22 - 1; | |
4151 v16 = (int *)(pTarget + 1); | |
4152 v17 = pTargetZ + 1; | |
4153 } | |
4154 while ( v18 != 1 ) | |
4155 { | |
4156 if ( v18 < 1 ) | |
4157 return z; | |
4158 z = (unsigned int)*v17 >> 16; | |
4159 if ( z <= v23 ) | |
4160 { | |
4161 v18 -= 2; | |
4162 ++v16; | |
4163 v17 += 2; | |
4164 } | |
4165 else | |
4166 { | |
4167 v17 += 2; | |
4168 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4169 v18 -= 2; | |
4170 *v16 = z; | |
4171 ++v16; | |
4172 } | |
4173 } | |
4174 z = (unsigned int)*v17 >> 16; | |
4175 if ( z > v23 ) | |
4176 { | |
4177 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4178 *(short *)v16 = z; | |
4179 } | |
4180 } | |
4181 } | |
4182 return z; | |
4183 } | |
4184 | |
4185 //----- (004A57E9) -------------------------------------------------------- | |
4186 void __cdecl Present_ColorKey() | |
4187 { | |
4188 HRESULT v0; // eax@3 | |
4189 HRESULT v1; // eax@3 | |
4190 HRESULT v2; // eax@3 | |
4191 HRESULT v3; // eax@3 | |
4192 HRESULT v4; // eax@3 | |
4193 RECT a2; // [sp+4h] [bp-14h]@3 | |
4194 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4195 | |
4196 if ( !pRenderer->uNumSceneBegins ) | |
4197 { | |
4198 if ( pRenderer->field_40110 ) | |
4199 { | |
693 | 4200 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4201 a2.left = 0; |
4202 a2.top = 0; | |
4203 a2.right = 640; | |
4204 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4205 a2.right = 640; | |
4206 a2.left = 0; | |
693 | 4207 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4208 a2.bottom = 480; |
4209 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4210 0, | |
693 | 4211 pViewport->uViewportBR_Y + 1, |
0 | 4212 pRenderer->pColorKeySurface4, |
4213 &a2, | |
4214 16u)); | |
693 | 4215 a2.right = pViewport->uViewportTL_X; |
4216 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4217 a2.left = 0; |
693 | 4218 a2.top = pViewport->uViewportTL_Y; |
0 | 4219 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4220 0, | |
693 | 4221 pViewport->uViewportTL_Y, |
0 | 4222 pRenderer->pColorKeySurface4, |
4223 &a2, | |
4224 16u)); | |
693 | 4225 a2.left = pViewport->uViewportBR_X; |
4226 a2.top = pViewport->uViewportTL_Y; | |
0 | 4227 a2.right = 640; |
693 | 4228 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4229 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4230 pViewport->uViewportBR_X, |
4231 pViewport->uViewportTL_Y, | |
0 | 4232 pRenderer->pColorKeySurface4, |
4233 &a2, | |
4234 16u)); | |
693 | 4235 a2.right = pViewport->uViewportBR_X; |
4236 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4237 a2.left = pViewport->uViewportTL_X; | |
4238 a2.top = pViewport->uViewportTL_Y; | |
0 | 4239 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4240 pViewport->uViewportTL_X, |
4241 pViewport->uViewportTL_Y, | |
0 | 4242 pRenderer->pColorKeySurface4, |
4243 &a2, | |
4244 17u)); | |
4245 } | |
4246 } | |
4247 } | |
4248 | |
4249 //----- (004A597D) -------------------------------------------------------- | |
4250 void Present_NoColorKey() | |
4251 { | |
4252 //unsigned __int16 *v0; // eax@4 | |
4253 unsigned __int16 *v1; // esi@4 | |
4254 void *v2; // edi@4 | |
4255 //signed int v4; // ebx@4 | |
4256 //signed int v5; // ebx@6 | |
4257 //void *v6; // edi@7 | |
4258 //const void *v7; // esi@7 | |
4259 signed int v8; // ebx@8 | |
4260 int v9; // eax@10 | |
4261 unsigned int v10; // esi@10 | |
4262 unsigned __int32 v11; // edi@10 | |
4263 //int v12; // ecx@10 | |
4264 unsigned int v13; // ebx@10 | |
4265 int v14; // eax@11 | |
4266 int v15; // eax@13 | |
4267 int v16; // eax@14 | |
4268 int v17; // eax@16 | |
4269 HRESULT v18; // eax@22 | |
4270 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4271 int v20; // [sp+88h] [bp-1Ch]@10 | |
4272 int v21; // [sp+8Ch] [bp-18h]@10 | |
4273 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4274 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4275 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4276 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4277 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4278 | |
4279 if ( !pRenderer->uNumSceneBegins ) | |
4280 { | |
4281 if ( pRenderer->field_40110 ) | |
4282 { | |
4283 memset(&Dst, 0, 0x7Cu); | |
4284 Dst.dwSize = 124; | |
168 | 4285 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4286 { |
4287 //v26 = Dst.lpSurface; | |
4288 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4289 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4290 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4291 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4292 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4293 v1 = pRenderer->pTargetSurface; | |
4294 v2 = Dst.lpSurface; | |
4295 | |
4296 | |
4297 /*for (uint y = 0; y < 480; ++y) | |
4298 { | |
4299 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4300 for (uint x = 0; x < 640; ++x) | |
4301 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4302 }*/ | |
4303 | |
4304 auto pSrc = pRenderer->pTargetSurface; | |
4305 auto pDst = (__int16 *)Dst.lpSurface; | |
4306 | |
4307 for (uint y = 0; y < 8; ++y) | |
4308 memcpy(pDst + y * Dst.lPitch / 2, | |
4309 | |
4310 pSrc + y * 640, 640 * sizeof(__int16)); | |
4311 | |
4312 for (uint y = 8; y < 352; ++y) | |
4313 { | |
4314 memcpy(pDst + y * Dst.lPitch / 2, | |
4315 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4316 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4317 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4318 } |
4319 | |
121 | 4320 for (uint y = 352; y < 480; ++y) |
0 | 4321 memcpy(pDst + y * Dst.lPitch / 2, |
4322 pSrc + y * 640, 640 * sizeof(__int16)); | |
4323 | |
4324 | |
693 | 4325 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4326 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4327 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4328 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4329 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4330 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4331 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4332 v21 = 4 * v9 + 1280; | |
4333 | |
121 | 4334 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4335 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4336 v10 = (int)pSrc_x1y1; | |
4337 v11 = (int)pDst_x1y1; | |
693 | 4338 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4339 v13 = v24; |
4340 | |
693 | 4341 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4342 { |
4343 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4344 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4345 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4346 { |
4347 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4348 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4349 } | |
4350 } | |
4351 | |
4352 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4353 | |
4354 /* while ( 1 ) | |
4355 { | |
4356 while ( 1 ) | |
4357 { | |
4358 v14 = *(int *)v10; | |
4359 v10 += 4; | |
4360 if ( v14 == v13 ) | |
4361 break; | |
4362 if ( (short)v14 == (short)v13 ) | |
4363 { | |
4364 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4365 v11 += 4; | |
4366 --uHalfWidth; | |
4367 if ( !uHalfWidth ) | |
4368 goto LABEL_21; | |
4369 } | |
4370 else | |
4371 { | |
4372 v15 = __ROL__(v14, 16); | |
4373 if ( (short)v15 == (short)v13 ) | |
4374 { | |
4375 v17 = __ROR__(v15, 16); | |
4376 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4377 v11 += 4; | |
4378 --uHalfWidth; | |
4379 if ( !uHalfWidth ) | |
4380 goto LABEL_21; | |
4381 } | |
4382 else | |
4383 { | |
4384 v16 = __ROR__(v15, 16); | |
4385 *(int *)v11 = v16; | |
4386 v11 += 4; | |
4387 --uHalfWidth; | |
4388 if ( !uHalfWidth ) | |
4389 goto LABEL_21; | |
4390 } | |
4391 } | |
4392 } | |
4393 v11 += 4; | |
4394 --uHalfWidth; | |
4395 if ( !uHalfWidth ) | |
4396 { | |
4397 LABEL_21: | |
4398 v10 += v21; | |
4399 v11 += v22; | |
4400 uHalfWidth = v20; | |
4401 if ( !--uNumLines ) | |
4402 { | |
4403 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4404 return; | |
4405 } | |
4406 } | |
4407 }*/ | |
4408 } | |
4409 } | |
4410 } | |
4411 } | |
4412 | |
4413 //----- (004A7063) -------------------------------------------------------- | |
4414 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4415 { | |
4416 float v2; // ST1C_4@1 | |
4417 double v3; // ST14_8@1 | |
4418 signed int v4; // ebx@1 | |
4419 float v5; // ST1C_4@1 | |
4420 double v6; // ST14_8@1 | |
4421 signed int v7; // edi@1 | |
4422 double v8; // ST0C_8@1 | |
4423 signed int v9; // esi@1 | |
4424 signed int v10; // ecx@1 | |
4425 double v12; // [sp+8h] [bp-18h]@1 | |
4426 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4427 | |
4428 v2 = (double)(uDiffuse >> 24) * a2; | |
4429 v3 = v2 + 6.7553994e15; | |
4430 v4 = LODWORD(v3); | |
4431 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4432 v6 = v5 + 6.7553994e15; | |
4433 v7 = LODWORD(v6); | |
4434 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4435 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4436 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4437 v9 = LODWORD(v8); | |
4438 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4439 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4440 v10 = LODWORD(v12); | |
4441 if ( v4 > 255 ) | |
4442 v4 = 255; | |
4443 if ( v4 < 0 ) | |
4444 v4 = 0; | |
4445 if ( SHIDWORD(v13) > 255 ) | |
4446 v7 = 255; | |
4447 if ( v7 < 0 ) | |
4448 v7 = 0; | |
4449 if ( (signed int)v13 > 255 ) | |
4450 v9 = 255; | |
4451 if ( v9 < 0 ) | |
4452 v9 = 0; | |
4453 if ( SLODWORD(v12) > 255 ) | |
4454 v10 = 255; | |
4455 if ( v10 < 0 ) | |
4456 v10 = 0; | |
4457 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4458 } | |
4459 | |
4460 //----- (004AD504) -------------------------------------------------------- | |
711 | 4461 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4462 { |
4463 int result; // eax@1 | |
711 | 4464 signed int v2; // ebx@1 |
0 | 4465 BLVFace *v3; // esi@3 |
4466 Texture *v4; // edi@6 | |
4467 int v5; // eax@7 | |
4468 int v6; // edx@7 | |
4469 int v7; // ecx@7 | |
4470 int v8; // ebx@8 | |
4471 int v9; // eax@8 | |
4472 int v10; // ebx@8 | |
4473 unsigned int v11; // ebx@9 | |
4474 int v12; // esi@10 | |
4475 int v13; // eax@13 | |
4476 unsigned __int16 *v14; // eax@13 | |
4477 unsigned int v15; // eax@14 | |
4478 unsigned __int16 *v16; // ebx@14 | |
4479 int v17; // eax@15 | |
4480 int v18; // ebx@15 | |
4481 int v19; // esi@15 | |
4482 int v20; // ecx@15 | |
4483 int v21; // eax@15 | |
4484 stru193_math *v22; // ebx@15 | |
4485 int v23; // eax@15 | |
4486 char *v24; // esi@16 | |
4487 int v25; // eax@18 | |
4488 int v26; // eax@18 | |
4489 int v27; // eax@20 | |
4490 signed int v28; // esi@20 | |
4491 signed int v29; // edx@20 | |
4492 signed int v30; // esi@20 | |
4493 signed int v31; // edi@20 | |
4494 int v32; // esi@20 | |
4495 int v33; // eax@26 | |
4496 int *v34; // esi@27 | |
4497 unsigned __int16 *v35; // edi@27 | |
4498 unsigned int v36; // edx@27 | |
4499 int v37; // ebx@27 | |
4500 char v38; // cl@27 | |
4501 char v39; // ch@27 | |
4502 int v40; // ebx@29 | |
4503 int v41; // edx@29 | |
4504 unsigned int v42; // ebx@30 | |
4505 int v43; // edx@30 | |
4506 int v44; // eax@33 | |
4507 int *v45; // esi@34 | |
4508 unsigned __int16 *v46; // edi@34 | |
4509 unsigned int v47; // edx@34 | |
4510 int v48; // ebx@34 | |
4511 char v49; // cl@34 | |
4512 char v50; // ch@34 | |
4513 int v51; // ebx@36 | |
4514 int v52; // edx@36 | |
4515 unsigned __int16 v53; // bx@37 | |
4516 int v54; // edx@37 | |
4517 int v55; // eax@40 | |
4518 int v56; // eax@41 | |
4519 int *v57; // esi@42 | |
4520 unsigned __int16 *v58; // edi@42 | |
4521 unsigned int v59; // edx@42 | |
4522 int v60; // ebx@42 | |
4523 char v61; // cl@42 | |
4524 char v62; // ch@42 | |
4525 unsigned int v63; // ebx@44 | |
4526 int v64; // edx@44 | |
4527 unsigned int v65; // ebx@44 | |
4528 int v66; // edx@44 | |
4529 unsigned int v67; // ebx@45 | |
4530 int v68; // edx@45 | |
4531 int v69; // ebx@45 | |
4532 int v70; // edx@45 | |
4533 int v71; // eax@48 | |
4534 int *v72; // esi@49 | |
4535 unsigned __int16 *v73; // edi@49 | |
4536 unsigned int v74; // edx@49 | |
4537 int v75; // ebx@49 | |
4538 char v76; // cl@49 | |
4539 char v77; // ch@49 | |
4540 unsigned int v78; // ebx@51 | |
4541 int v79; // edx@51 | |
4542 unsigned int v80; // ebx@51 | |
4543 int v81; // edx@51 | |
4544 unsigned int v82; // ebx@52 | |
4545 int v83; // edx@52 | |
4546 int v84; // ebx@52 | |
4547 int v85; // edx@52 | |
4548 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4549 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4550 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4551 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4552 int v90; // [sp+1Ch] [bp-88h]@20 | |
4553 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4554 int v92; // [sp+24h] [bp-80h]@7 | |
4555 int i; // [sp+28h] [bp-7Ch]@7 | |
4556 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4557 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4558 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4559 int v97; // [sp+38h] [bp-6Ch]@15 | |
4560 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4561 int v99; // [sp+40h] [bp-64h]@9 | |
4562 int v100; // [sp+44h] [bp-60h]@24 | |
4563 int v101; // [sp+48h] [bp-5Ch]@10 | |
4564 int v102; // [sp+4Ch] [bp-58h]@20 | |
4565 int v103; // [sp+50h] [bp-54h]@20 | |
4566 int v104; // [sp+54h] [bp-50h]@9 | |
4567 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4568 int v106; // [sp+5Ch] [bp-48h]@24 | |
4569 int v107; // [sp+60h] [bp-44h]@20 | |
4570 int v108; // [sp+64h] [bp-40h]@20 | |
4571 int v109; // [sp+68h] [bp-3Ch]@20 | |
4572 int v110; // [sp+6Ch] [bp-38h]@15 | |
4573 int v111; // [sp+70h] [bp-34h]@20 | |
4574 int a1; // [sp+74h] [bp-30h]@12 | |
4575 int a2; // [sp+78h] [bp-2Ch]@9 | |
4576 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4577 int v115; // [sp+80h] [bp-24h]@18 | |
4578 int v116; // [sp+84h] [bp-20h]@7 | |
4579 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4580 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4581 int *v119; // [sp+90h] [bp-14h]@13 | |
4582 int v120; // [sp+94h] [bp-10h]@15 | |
4583 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4584 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4585 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4586 | |
4587 result = pRenderer->uTargetSurfacePitch; | |
711 | 4588 v2 = sFaceID; |
0 | 4589 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4590 if ( sFaceID >= 0 ) |
4591 { | |
4592 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4593 { | |
4594 v3 = &pIndoor->pFaces[sFaceID]; | |
4595 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4596 if ( !pRenderer->pRenderD3D ) |
4597 { | |
711 | 4598 result = sub_423B5D(sFaceID); |
0 | 4599 if ( result ) |
4600 { | |
4601 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4602 if ( result ) | |
4603 { | |
4604 result = (int)v3->GetTexture(); | |
4605 v4 = (Texture *)result; | |
4606 v96 = (Texture *)result; | |
4607 if ( result ) | |
4608 { | |
4609 v5 = *(short *)(result + 38); | |
4610 LOBYTE(v3->uAttributes) |= 0x80u; | |
4611 v92 = v5; | |
4612 sub_4AE5F1(v2); | |
4613 ++pBLVRenderParams->field_84; | |
4614 v6 = stru_F8AD28.pDeltaUV[0]; | |
4615 v116 = stru_F8AD28.pDeltaUV[1]; | |
4616 v7 = 0; | |
4617 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4618 { | |
4619 v8 = v116; | |
4620 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4621 v9 = 4 * v7 + 16297672; | |
4622 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4623 } | |
4624 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4625 result = stru_F8A590._viewport_space_y; | |
4626 a2 = stru_F8A590._viewport_space_y; | |
4627 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4628 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4629 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4630 v87 = v4->pLevelOfDetail1; |
4631 v88 = v4->pLevelOfDetail2; | |
4632 v89 = v4->pLevelOfDetail3; | |
4633 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4634 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4635 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4636 { | |
4637 v12 = 2 * stru_F8A590._viewport_space_y; | |
4638 v101 = 2 * stru_F8A590._viewport_space_y; | |
4639 while ( 1 ) | |
4640 { | |
4641 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4642 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4643 if ( LOBYTE(viewparams->field_20) ) | |
4644 { | |
4645 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4646 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4647 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4648 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4649 - pBLVRenderParams->uViewportX]; | |
4650 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4651 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4652 - pBLVRenderParams->uViewportX]; | |
4653 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4654 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4655 - pBLVRenderParams->uViewportX]; | |
4656 v123 = (unsigned int)v16; | |
4657 } | |
4658 else | |
4659 { | |
4660 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4661 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4662 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4663 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4664 } | |
4665 v117 = (unsigned int)v14; | |
4666 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4667 v18 = stru_F81018.field_0.field_10; | |
4668 LOWORD(v17) = 0; | |
4669 v97 = stru_F8AD28.field_0 | v17; | |
4670 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4671 v19 = stru_F81018.field_0.field_4 >> i; | |
4672 v20 = 11 - v18; | |
4673 v116 = stru_F81018.field_0.field_8 >> i; | |
4674 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4675 v22 = stru_5C6E00; | |
4676 v122 = (unsigned __int16 *)v20; | |
323 | 4677 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4678 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4679 v120 = v116 + 4 * v23; |
4680 if ( v123 < v117 ) | |
4681 { | |
4682 v24 = (char *)&stru_F81018.field_34.field_8; | |
4683 v114 = &stru_F81018.field_34.field_8; | |
4684 a1 += 16; | |
4685 while ( 1 ) | |
4686 { | |
4687 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4688 v25 = *((int *)v24 - 2); | |
4689 LOWORD(v25) = 0; | |
4690 v115 = v97; | |
4691 v26 = stru_F8AD28.field_0 | v25; | |
4692 if ( v97 <= (unsigned int)v26 ) | |
4693 v115 = v26; | |
4694 v97 = v26; | |
4695 v27 = *((int *)v24 - 11); | |
4696 v28 = *((int *)v24 - 1); | |
4697 v105 = (&v86)[4 * v27]; | |
4698 v111 = v27 + 16; | |
4699 v29 = v4->uWidthMinus1; | |
4700 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4701 v107 = v29 >> v27; | |
4702 v30 = v28 >> i; | |
4703 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4704 v31 = *v114 >> i; | |
4705 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4706 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4707 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4708 v108 = (signed int)(v116 - v121) >> 4; |
4709 v103 = (v90 - v120) >> 4; | |
4710 v32 = v123 + 32; | |
4711 if ( LOBYTE(viewparams->field_20) ) | |
4712 v32 = v123 + 64; | |
4713 if ( v32 > v117 ) | |
4714 v32 = v117; | |
4715 v118 = v32; | |
4716 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4717 v106 = (signed int)(v32 - v123) >> 1; | |
4718 if ( v110 >> 16 == v100 >> 16 ) | |
4719 { | |
4720 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4721 if ( LOBYTE(viewparams->field_20) ) | |
4722 { | |
4723 v44 = v123; | |
4724 if ( v123 < v118 ) | |
4725 { | |
4726 v45 = v119; | |
4727 v46 = v122; | |
4728 v47 = v121; | |
4729 v48 = v120; | |
4730 v49 = v111; | |
4731 v50 = v109; | |
4732 if ( v106 & 2 ) | |
4733 { | |
4734 *v119 = v115; | |
4735 v45 -= 2; | |
4736 v44 = v123 + 4; | |
4737 goto LABEL_37; | |
4738 } | |
4739 do | |
4740 { | |
4741 v44 += 8; | |
4742 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4743 v52 = v115; | |
4744 LOWORD(v51) = v46[v51]; | |
4745 *v45 = v115; | |
4746 v45[1] = v52; | |
4747 v45[640] = v52; | |
4748 v45[641] = v52; | |
4749 *(short *)(v44 - 8) = v51; | |
4750 *(short *)(v44 - 6) = v51; | |
4751 *(short *)(v44 + 1272) = v51; | |
4752 *(short *)(v44 + 1274) = v51; | |
4753 v45[2] = v52; | |
4754 v45[3] = v52; | |
4755 v45[642] = v52; | |
4756 v45[643] = v52; | |
4757 v121 += v108; | |
4758 v120 += v103; | |
4759 v47 = v121; | |
4760 v48 = v120; | |
4761 LABEL_37: | |
4762 v45 += 4; | |
4763 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4764 v54 = v108; | |
4765 *(short *)(v44 - 4) = v53; | |
4766 *(short *)(v44 - 2) = v53; | |
4767 *(short *)(v44 + 1276) = v53; | |
4768 *(short *)(v44 + 1278) = v53; | |
4769 v121 += v54; | |
4770 v120 += v103; | |
4771 v47 = v121; | |
4772 v48 = v120; | |
4773 } | |
4774 while ( v44 < v118 ); | |
4775 v123 = v44; | |
4776 v119 = v45; | |
4777 } | |
4778 } | |
4779 else | |
4780 { | |
4781 v33 = v123; | |
4782 if ( v123 < v118 ) | |
4783 { | |
4784 v34 = v119; | |
4785 v35 = v122; | |
4786 v36 = v121; | |
4787 v37 = v120; | |
4788 v38 = v111; | |
4789 v39 = v109; | |
4790 if ( v106 & 1 ) | |
4791 { | |
4792 *v119 = v115; | |
4793 --v34; | |
4794 v33 = v123 + 2; | |
4795 goto LABEL_30; | |
4796 } | |
4797 do | |
4798 { | |
4799 v33 += 4; | |
4800 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4801 v41 = v115; | |
4802 LOWORD(v40) = v35[v40]; | |
4803 *v34 = v115; | |
4804 *(short *)(v33 - 4) = v40; | |
4805 v34[1] = v41; | |
4806 v121 += v108; | |
4807 v120 += v103; | |
4808 v36 = v121; | |
4809 v37 = v120; | |
4810 LABEL_30: | |
4811 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4812 v34 += 2; | |
4813 v43 = v108; | |
4814 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4815 v121 += v43; | |
4816 v120 += v103; | |
4817 v36 = v121; | |
4818 v37 = v120; | |
4819 } | |
4820 while ( v33 < v118 ); | |
4821 v123 = v33; | |
4822 v119 = v34; | |
4823 } | |
4824 } | |
4825 } | |
4826 else | |
4827 { | |
4828 v55 = v110 - ((v100 - v110) >> 4); | |
4829 v110 = (v100 - v110) >> 4; | |
4830 v122 = (unsigned __int16 *)v55; | |
4831 if ( LOBYTE(viewparams->field_20) ) | |
4832 { | |
4833 v71 = v123; | |
4834 if ( v123 < v118 ) | |
4835 { | |
4836 v72 = v119; | |
4837 v73 = v94; | |
4838 v74 = v121; | |
4839 v75 = v120; | |
4840 v76 = v111; | |
4841 v77 = v109; | |
4842 if ( v106 & 2 ) | |
4843 { | |
4844 *v119 = v115; | |
4845 v72 += 2; | |
4846 v71 = v123 + 4; | |
4847 goto LABEL_52; | |
4848 } | |
4849 do | |
4850 { | |
4851 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4852 v79 = (int)((char *)v122 + v110); | |
4853 v71 += 8; | |
4854 v122 = (unsigned __int16 *)v79; | |
4855 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4856 v81 = v115; | |
4857 LOWORD(v80) = v73[v80]; | |
4858 *v72 = v115; | |
4859 v72[1] = v81; | |
4860 v72[640] = v81; | |
4861 v72[641] = v81; | |
4862 *(short *)(v71 - 8) = v80; | |
4863 *(short *)(v71 - 6) = v80; | |
4864 *(short *)(v71 + 1272) = v80; | |
4865 *(short *)(v71 + 1274) = v80; | |
4866 v72[2] = v81; | |
4867 v72[3] = v81; | |
4868 v72[642] = v81; | |
4869 v72[643] = v81; | |
4870 v121 += v108; | |
4871 v120 += v103; | |
4872 v74 = v121; | |
4873 v75 = v120; | |
4874 v72 += 4; | |
4875 LABEL_52: | |
4876 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4877 v83 = (int)((char *)v122 + v110); | |
4878 v84 = v105[v82]; | |
4879 v122 = (unsigned __int16 *)v83; | |
4880 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4881 v85 = v108; | |
4882 *(short *)(v71 - 4) = v84; | |
4883 *(short *)(v71 - 2) = v84; | |
4884 *(short *)(v71 + 1276) = v84; | |
4885 *(short *)(v71 + 1278) = v84; | |
4886 v121 += v85; | |
4887 v120 += v103; | |
4888 v74 = v121; | |
4889 v75 = v120; | |
4890 } | |
4891 while ( v71 < v118 ); | |
4892 v123 = v71; | |
4893 v119 = v72; | |
4894 } | |
4895 } | |
4896 else | |
4897 { | |
4898 v56 = v123; | |
4899 if ( v123 < v118 ) | |
4900 { | |
4901 v57 = v119; | |
4902 v58 = v94; | |
4903 v59 = v121; | |
4904 v60 = v120; | |
4905 v61 = v111; | |
4906 v62 = v109; | |
4907 if ( v106 & 1 ) | |
4908 { | |
4909 *v119 = v115; | |
4910 ++v57; | |
4911 v56 = v123 + 2; | |
4912 goto LABEL_45; | |
4913 } | |
4914 do | |
4915 { | |
4916 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4917 v64 = (int)((char *)v122 + v110); | |
4918 v56 += 4; | |
4919 v122 = (unsigned __int16 *)v64; | |
4920 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4921 v66 = v115; | |
4922 LOWORD(v65) = v58[v65]; | |
4923 *v57 = v115; | |
4924 *(short *)(v56 - 4) = v65; | |
4925 v57[1] = v66; | |
4926 v121 += v108; | |
4927 v120 += v103; | |
4928 v59 = v121; | |
4929 v60 = v120; | |
4930 v57 += 2; | |
4931 LABEL_45: | |
4932 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4933 v68 = (int)((char *)v122 + v110); | |
4934 v69 = v105[v67]; | |
4935 v122 = (unsigned __int16 *)v68; | |
4936 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4937 v70 = v108; | |
4938 *(short *)(v56 - 2) = v69; | |
4939 v121 += v70; | |
4940 v120 += v103; | |
4941 v59 = v121; | |
4942 v60 = v120; | |
4943 } | |
4944 while ( v56 < v118 ); | |
4945 v123 = v56; | |
4946 v119 = v57; | |
4947 } | |
4948 } | |
4949 } | |
4950 v114 += 13; | |
4951 v110 = v100; | |
4952 a1 += 16; | |
4953 v4 = v96; | |
4954 v121 = v116; | |
4955 v120 = v90; | |
4956 if ( v123 >= v117 ) | |
4957 break; | |
4958 v24 = (char *)v114; | |
4959 v22 = stru_5C6E00; | |
4960 } | |
4961 } | |
4962 ++a2; | |
4963 v98 += v95; | |
4964 result = a2; | |
4965 v101 += 2; | |
4966 v99 += 640; | |
4967 if ( a2 > stru_F8A590._viewport_space_w ) | |
4968 break; | |
4969 v12 = v101; | |
4970 result = a2; | |
4971 v11 = v98; | |
4972 } | |
4973 } | |
4974 } | |
4975 } | |
4976 } | |
4977 } | |
4978 } | |
4979 } | |
4980 return result; | |
4981 } | |
4982 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4983 | |
4984 //----- (004ADD1D) -------------------------------------------------------- | |
4985 void __fastcall sub_4ADD1D(int uFaceID) | |
4986 { | |
4987 int v1; // edi@1 | |
4988 BLVFace *v2; // esi@3 | |
4989 signed int v3; // ebx@4 | |
4990 Texture *v4; // edi@9 | |
4991 signed int v5; // eax@9 | |
4992 char *v6; // edi@12 | |
4993 signed int v7; // eax@15 | |
4994 unsigned int v8; // eax@16 | |
4995 __int16 v9; // cx@19 | |
4996 unsigned __int8 *v10; // eax@19 | |
4997 unsigned __int16 *v11; // eax@19 | |
4998 int v12; // edi@19 | |
4999 int v13; // ebx@20 | |
5000 stru352 *v14; // esi@20 | |
5001 DWORD v15; // eax@22 | |
5002 signed int v16; // ecx@22 | |
5003 signed int v17; // ST68_4@22 | |
5004 int v18; // eax@22 | |
5005 int v19; // ecx@22 | |
5006 unsigned int v20; // esi@23 | |
5007 int v21; // edi@23 | |
5008 int v22; // eax@23 | |
5009 int *v23; // ebx@24 | |
5010 int v24; // edx@24 | |
5011 int v25; // ebx@25 | |
5012 unsigned __int16 v26; // cx@25 | |
5013 int v27; // edx@26 | |
5014 unsigned __int16 v28; // cx@26 | |
5015 unsigned __int8 v29; // sf@27 | |
5016 unsigned __int8 v30; // of@27 | |
5017 unsigned int v31; // esi@29 | |
5018 int v32; // edi@29 | |
5019 unsigned __int16 *v33; // eax@29 | |
5020 int *v34; // ebx@30 | |
5021 int v35; // edx@30 | |
5022 int v36; // ebx@31 | |
5023 unsigned __int16 v37; // cx@31 | |
5024 int v38; // edx@32 | |
5025 unsigned __int16 v39; // cx@32 | |
5026 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5027 int v41; // [sp-Ch] [bp-68h]@15 | |
5028 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5029 signed int v43; // [sp+14h] [bp-48h]@12 | |
5030 signed int v44; // [sp+14h] [bp-48h]@22 | |
5031 int v45; // [sp+1Ch] [bp-40h]@22 | |
5032 int v46; // [sp+20h] [bp-3Ch]@22 | |
5033 int v47; // [sp+24h] [bp-38h]@19 | |
5034 char v48; // [sp+28h] [bp-34h]@19 | |
5035 int v49; // [sp+2Ch] [bp-30h]@19 | |
5036 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5037 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5038 int v52; // [sp+38h] [bp-24h]@22 | |
5039 int v53; // [sp+3Ch] [bp-20h]@22 | |
5040 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5041 int v55; // [sp+40h] [bp-1Ch]@20 | |
5042 int v56; // [sp+44h] [bp-18h]@20 | |
5043 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5044 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5045 int v59; // [sp+50h] [bp-Ch]@4 | |
5046 int v60; // [sp+50h] [bp-Ch]@19 | |
5047 int v61; // [sp+54h] [bp-8h]@22 | |
5048 int *v62; // [sp+58h] [bp-4h]@23 | |
5049 int *v63; // [sp+58h] [bp-4h]@29 | |
5050 | |
5051 v1 = uFaceID; | |
5052 v42 = pRenderer->uTargetSurfacePitch; | |
5053 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5054 { | |
5055 v2 = &pIndoor->pFaces[uFaceID]; | |
5056 if ( pRenderer->pRenderD3D ) | |
5057 { | |
5058 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5059 v59 = v3; | |
5060 } | |
5061 else | |
5062 { | |
5063 v59 = sub_423B5D(uFaceID); | |
5064 v3 = v59; | |
5065 } | |
5066 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5067 { | |
5068 v4 = v2->GetTexture(); | |
5069 v5 = 0; | |
5070 if ( v4 ) | |
5071 { | |
5072 if ( pRenderer->pRenderD3D ) | |
5073 { | |
5074 if ( v3 > 0 ) | |
5075 { | |
5076 v54 = v3; | |
5077 v43 = v3; | |
5078 v6 = (char *)&array_507D30[0].v; | |
5079 do | |
5080 { | |
5081 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5082 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5083 v6 += 48; | |
5084 --v54; | |
5085 } | |
5086 while ( v54 ); | |
5087 v3 = v59; | |
5088 v5 = v43; | |
5089 } | |
5090 v7 = v5; | |
5091 v41 = stru_F8AD28.field_0; | |
5092 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5093 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5094 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5095 { | |
5096 v40 = v2->GetTexture(); | |
5097 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5098 } | |
5099 else | |
5100 { | |
5101 v40 = v2->GetTexture(); | |
5102 v8 = v2->uBitmapID; | |
5103 } | |
5104 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5105 } | |
5106 else | |
5107 { | |
5108 v49 = v4->uWidthMinus1; | |
5109 v47 = v4->uHeightMinus1 << 16; | |
5110 v9 = 16 - v4->uWidthLn2; | |
710 | 5111 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5112 LOBYTE(v2->uAttributes) |= 0x80u; |
5113 v48 = v9; | |
5114 v50 = v10; | |
5115 sub_4AF412(); | |
5116 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5117 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5118 v12 = stru_F8A590._viewport_space_y; | |
5119 v51 = v11; | |
5120 v60 = stru_F8A590._viewport_space_y; | |
5121 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5122 { | |
5123 v13 = 2 * stru_F8A590._viewport_space_y; | |
5124 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5125 v55 = 2 * stru_F8A590._viewport_space_y; | |
5126 v56 = 640 * stru_F8A590._viewport_space_y; | |
5127 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5128 { | |
5129 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5130 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5131 v15 = GetTickCount(); | |
5132 v16 = v14->field_0; | |
5133 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5134 v45 = v14->field_4 >> 3; | |
5135 v44 = v16 >> 3; | |
5136 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5137 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5138 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5139 v18 = v14->field_28; | |
5140 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5141 LOWORD(v18) = 0; | |
5142 v46 = stru_F8AD28.field_0 | v18; | |
5143 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5144 if ( LOBYTE(viewparams->field_20) ) | |
5145 { | |
5146 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5147 - pBLVRenderParams->uViewportX]; | |
5148 v31 = v44; | |
5149 v32 = v45; | |
5150 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5151 + 2 * v19 | |
5152 - pBLVRenderParams->uViewportX]; | |
5153 if ( v61 & 1 ) | |
5154 { | |
5155 --v61; | |
5156 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5157 + 2 * v19 | |
5158 - pBLVRenderParams->uViewportX | |
5159 - 2]; | |
5160 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5161 - pBLVRenderParams->uViewportX]; | |
5162 v35 = v46; | |
5163 v63 += 2; | |
5164 goto LABEL_32; | |
5165 } | |
5166 while ( 1 ) | |
5167 { | |
5168 v30 = __OFSUB__(v61, 2); | |
5169 v29 = v61 - 2 < 0; | |
5170 v61 -= 2; | |
5171 if ( v29 ^ v30 ) | |
5172 break; | |
5173 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5174 v31 += v52; | |
5175 v37 = v51[v36]; | |
5176 v32 += v53; | |
5177 v34 = v63; | |
5178 v35 = v46; | |
5179 *v33 = v37; | |
5180 v33[1] = v37; | |
5181 v33[640] = v37; | |
5182 v33[641] = v37; | |
5183 v63 += 4; | |
5184 v34[2] = v46; | |
5185 v34[3] = v46; | |
5186 v34[642] = v46; | |
5187 v34[643] = v46; | |
5188 LABEL_32: | |
5189 *v34 = v35; | |
5190 v34[1] = v35; | |
5191 v34[640] = v35; | |
5192 v34[641] = v35; | |
5193 v38 = v49 & (v31 >> 16); | |
5194 v33 += 4; | |
5195 v31 += v52; | |
5196 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5197 v32 += v53; | |
5198 *(v33 - 2) = v39; | |
5199 *(v33 - 1) = v39; | |
5200 v33[638] = v39; | |
5201 v33[639] = v39; | |
5202 } | |
5203 } | |
5204 else | |
5205 { | |
5206 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5207 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5208 v20 = v44; | |
5209 v21 = v45; | |
5210 v22 = (int)v58; | |
5211 if ( v61 & 1 ) | |
5212 { | |
5213 --v61; | |
5214 v22 = (int)(v58 - 1); | |
5215 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5216 v24 = v46; | |
5217 ++v62; | |
5218 goto LABEL_26; | |
5219 } | |
5220 while ( 1 ) | |
5221 { | |
5222 v30 = __OFSUB__(v61, 2); | |
5223 v29 = v61 - 2 < 0; | |
5224 v61 -= 2; | |
5225 if ( v29 ^ v30 ) | |
5226 break; | |
5227 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5228 v20 += v52; | |
5229 v26 = v51[v25]; | |
5230 v21 += v53; | |
5231 v23 = v62; | |
5232 v24 = v46; | |
5233 *(short *)v22 = v26; | |
5234 v62 += 2; | |
5235 v23[1] = v46; | |
5236 LABEL_26: | |
5237 *v23 = v24; | |
5238 v27 = v49 & (v20 >> 16); | |
5239 v22 += 4; | |
5240 v20 += v52; | |
5241 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5242 v21 += v53; | |
5243 *(short *)(v22 - 2) = v28; | |
5244 } | |
5245 } | |
5246 ++v60; | |
5247 ++i; | |
5248 v56 += 640; | |
5249 v55 += 2; | |
5250 if ( v60 > stru_F8A590._viewport_space_w ) | |
5251 break; | |
5252 v13 = v55; | |
5253 v12 = v60; | |
5254 } | |
5255 } | |
5256 } | |
5257 } | |
5258 } | |
5259 } | |
5260 } | |
5261 | |
5262 //----- (004AE1E7) -------------------------------------------------------- | |
5263 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5264 { | |
5265 int v3; // ebx@1 | |
5266 int v4; // edi@1 | |
5267 int v5; // esi@1 | |
5268 signed __int64 v6; // qtt@3 | |
5269 int v7; // esi@3 | |
5270 int v8; // eax@5 | |
5271 int result; // eax@5 | |
5272 int v10; // edx@5 | |
5273 int v11; // [sp+Ch] [bp-8h]@1 | |
5274 int v12; // [sp+1Ch] [bp+8h]@2 | |
5275 | |
5276 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5277 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5278 v11 = a1; | |
5279 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5280 + stru_F8AD28.field_7C | |
5281 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5282 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5283 { | |
5284 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5285 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5286 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5287 } | |
5288 else | |
5289 { | |
5290 v7 = 1073741824; | |
5291 } | |
5292 v8 = stru_F8AD28.vec_9C.z; | |
5293 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5294 + stru_F8AD28.vec_8C.x | |
5295 + v4 * stru_F8AD28.vec_8C.y) | |
5296 * (signed __int64)v7) >> 16) | |
5297 + stru_F8AD28.field_98; | |
5298 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5299 v10 = result + stru_F8AD28.field_A8; | |
5300 stru_F83B80[v11].field_28 = v7; | |
5301 stru_F83B80[v11].field_4 = v10; | |
5302 return result; | |
5303 } | |
5304 | |
5305 //----- (004AE313) -------------------------------------------------------- | |
5306 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5307 { | |
5308 int _dy; // ebx@1 | |
5309 int _dx; // edi@1 | |
5310 int v5; // ecx@1 | |
5311 int v6; // esi@1 | |
5312 int v7; // ST18_4@2 | |
5313 signed __int64 v8; // qtt@3 | |
5314 unsigned int v9; // ecx@3 | |
5315 int result; // eax@8 | |
5316 int v11; // [sp+Ch] [bp-8h]@1 | |
5317 | |
5318 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5319 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5320 ++pBLVRenderParams->field_88; | |
5321 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5322 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5323 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5324 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5325 { | |
5326 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5327 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5328 v9 = v8 / v11; | |
5329 } | |
5330 else | |
5331 { | |
5332 v9 = 0x40000000u; | |
5333 } | |
5334 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5335 p->field_0 = v9; | |
5336 else | |
5337 p->field_0 = stru_F8AD28.field_34; | |
5338 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5339 * (signed __int64)(signed int)v9) >> 16) | |
5340 + stru_F8AD28.field_98 | |
5341 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5342 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5343 * (signed __int64)(signed int)v9) >> 16) | |
5344 + stru_F8AD28.field_A8 | |
5345 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5346 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5347 if ( result < 369620 || bUseLoResSprites ) | |
5348 { | |
5349 if ( result < 184810 ) | |
5350 p->field_10 = result > 92405; | |
5351 else | |
5352 p->field_10 = 2; | |
5353 } | |
5354 else | |
5355 { | |
5356 p->field_10 = 3; | |
5357 } | |
5358 return result; | |
5359 } | |
5360 | |
5361 //----- (004AE491) -------------------------------------------------------- | |
5362 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5363 { | |
5364 signed int v2; // eax@1 | |
5365 signed int v3; // edi@1 | |
5366 int v4; // ecx@1 | |
5367 int v5; // esi@2 | |
5368 int v6; // eax@2 | |
5369 int v7; // ebx@2 | |
5370 unsigned int v8; // ecx@2 | |
5371 int v9; // edx@5 | |
5372 int v10; // edx@7 | |
5373 unsigned int v11; // eax@8 | |
5374 int v13; // [sp+4h] [bp-18h]@2 | |
5375 int v14; // [sp+8h] [bp-14h]@2 | |
5376 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5377 int v16; // [sp+14h] [bp-8h]@1 | |
5378 int v17; // [sp+18h] [bp-4h]@1 | |
5379 | |
5380 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5381 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5382 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5383 v4 = 0; | |
5384 v15 = v2; | |
5385 v16 = 0; | |
5386 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5387 { | |
5388 do | |
5389 { | |
5390 v5 = v16; | |
5391 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5392 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5393 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5394 v7 = v13; | |
5395 v8 = v14; | |
5396 if ( v6 < v13 ) | |
5397 { | |
5398 v6 = v13; | |
5399 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5400 } | |
5401 if ( v6 < v14 ) | |
5402 { | |
5403 v9 = v6; | |
5404 v6 = v14; | |
5405 v8 = v9; | |
5406 } | |
5407 if ( v7 < (signed int)v8 ) | |
5408 { | |
5409 v10 = v8; | |
5410 v8 = v7; | |
5411 v7 = v10; | |
5412 } | |
5413 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5414 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5415 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5416 ++v16; | |
5417 v2 = v15; | |
5418 } | |
5419 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5420 v4 = 0; | |
5421 } | |
5422 if ( stru_F8AD28.field_3E4 != v4 ) | |
5423 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5424 if ( v17 >= v4 ) | |
5425 { | |
5426 if ( v17 > 2031616 ) | |
5427 v17 = 2031616; | |
5428 } | |
5429 else | |
5430 { | |
5431 v17 = v4; | |
5432 } | |
5433 ++pBLVRenderParams->field_8C; | |
5434 return v17; | |
5435 } | |
5436 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5437 | |
5438 //----- (004AE5F1) -------------------------------------------------------- | |
5439 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5440 { | |
5441 BLVFace *v1; // esi@1 | |
5442 BLVFaceExtra *v2; // ebx@1 | |
5443 int v3; // eax@1 | |
5444 int v4; // edi@1 | |
5445 Texture *v5; // edi@1 | |
5446 int v6; // eax@1 | |
5447 unsigned int v7; // eax@1 | |
5448 unsigned int v8; // ecx@1 | |
5449 unsigned int v9; // eax@1 | |
5450 unsigned int v10; // ecx@5 | |
5451 int v11; // edi@10 | |
5452 int v12; // ecx@10 | |
5453 int v13; // eax@10 | |
5454 int v14; // edx@10 | |
5455 int v15; // ebx@12 | |
5456 double v16; // st7@16 | |
5457 int v17; // eax@16 | |
5458 char *v18; // ebx@17 | |
5459 int v19; // ecx@19 | |
5460 int v20; // eax@19 | |
5461 int v21; // edx@21 | |
5462 int v22; // eax@23 | |
5463 int v23; // ST04_4@26 | |
5464 int v24; // edi@26 | |
5465 double v25; // st6@26 | |
5466 int v26; // eax@26 | |
5467 double v27; // st6@26 | |
5468 int v28; // ecx@26 | |
5469 char v29; // al@26 | |
5470 int v30; // edx@28 | |
5471 int v31; // ecx@28 | |
5472 BLVLightMM7 *v32; // ecx@32 | |
5473 int v33; // edi@33 | |
5474 int v34; // edx@33 | |
5475 int v35; // eax@33 | |
5476 int v36; // edi@35 | |
5477 int v37; // edx@37 | |
5478 int v38; // ebx@39 | |
5479 int v39; // edi@42 | |
5480 int v40; // eax@42 | |
5481 char *v41; // ebx@45 | |
5482 signed int v42; // ecx@47 | |
5483 int v43; // edi@47 | |
5484 int v44; // eax@49 | |
5485 int v45; // edx@51 | |
5486 int v46; // eax@53 | |
5487 int v47; // ST04_4@55 | |
5488 int v48; // edi@55 | |
5489 double v49; // st6@55 | |
5490 int v50; // eax@55 | |
5491 double v51; // st6@55 | |
5492 int v52; // eax@55 | |
5493 int v53; // ecx@57 | |
5494 int v54; // ecx@58 | |
5495 int v55; // ecx@59 | |
5496 int v56; // edx@62 | |
5497 int v57; // ecx@62 | |
5498 int v58; // eax@63 | |
5499 int v59; // edx@64 | |
5500 int v60; // ecx@67 | |
5501 int v61; // edx@67 | |
5502 int v62; // eax@68 | |
5503 int v63; // edx@69 | |
5504 signed int v64; // ecx@72 | |
5505 double v65; // st7@75 | |
5506 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5507 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5508 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5509 int v69; // [sp+28h] [bp-18h]@10 | |
5510 int v70; // [sp+2Ch] [bp-14h]@10 | |
5511 int X; // [sp+30h] [bp-10h]@10 | |
5512 int v72; // [sp+34h] [bp-Ch]@10 | |
5513 int v73; // [sp+38h] [bp-8h]@10 | |
5514 int v74; // [sp+3Ch] [bp-4h]@10 | |
5515 | |
5516 v1 = &pIndoor->pFaces[uFaceID]; | |
5517 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5518 v3 = v1->uBitmapID; | |
5519 v4 = v1->uBitmapID; | |
5520 v68 = v2; | |
5521 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5522 v6 = 8 * uFaceID; | |
862 | 5523 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5524 stru_F8AD28.field_0 = v6; |
5525 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5526 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5527 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5528 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5529 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5530 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5531 v7 = GetTickCount(); | |
5532 v8 = v1->uAttributes; | |
5533 v9 = v7 >> 3; | |
5534 if ( v8 & 4 ) | |
5535 { | |
5536 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5537 } | |
5538 else | |
5539 { | |
5540 if ( v8 & 0x20 ) | |
5541 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5542 } | |
5543 v10 = v1->uAttributes; | |
5544 if ( BYTE1(v10) & 8 ) | |
5545 { | |
5546 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5547 } | |
5548 else | |
5549 { | |
5550 if ( v10 & 0x40 ) | |
5551 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5552 } | |
5553 v1->_get_normals(&v67, &v66); | |
5554 stru_F8AD28.vec_14.x = v67.x; | |
5555 stru_F8AD28.vec_14.y = v67.y; | |
5556 stru_F8AD28.vec_14.z = v67.z; | |
5557 stru_F8AD28.vec_20.x = v66.x; | |
5558 stru_F8AD28.vec_20.y = v66.y; | |
5559 stru_F8AD28.vec_20.z = v66.z; | |
5560 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5561 if ( pBLVRenderParams->sPartyRotX ) | |
5562 { | |
5563 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5564 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5565 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5566 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5567 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5568 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5569 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5570 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5571 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5572 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5573 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5574 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5575 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5576 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5577 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5578 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5579 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5580 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5581 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5582 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5583 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5584 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5585 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5586 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5587 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5588 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5589 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5590 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5591 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5592 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5593 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5594 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5595 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5596 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5597 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5598 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5599 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5600 v13 = pBLVRenderParams->vPartyPos.y; | |
5601 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5602 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5603 v14 = pBLVRenderParams->vPartyPos.x; | |
5604 } | |
5605 else | |
5606 { | |
5607 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5608 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5609 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5610 - v70; | |
5611 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5612 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5613 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5614 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5615 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5616 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5617 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5618 - v70; | |
5619 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5620 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5621 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5622 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5623 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5624 - v70; | |
5625 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5626 v14 = pBLVRenderParams->vPartyPos.x; | |
5627 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5628 v13 = pBLVRenderParams->vPartyPos.y; | |
5629 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5630 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5631 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5632 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5633 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5634 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5635 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5636 } | |
5637 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5638 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5639 + stru_F8AD28.plane_4.dist | |
5640 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5641 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5642 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5643 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5644 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5645 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5646 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5647 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5648 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5649 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5650 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5651 v15 = v70; | |
5652 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5653 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5654 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5655 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5656 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5657 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5658 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5659 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5660 stru_F8AD28.field_38 = 0; | |
5661 stru_F8AD28.field_A8 = -(X | |
5662 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5663 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5664 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5665 { | |
5666 stru_F8AD28.field_3E4 = 1; | |
5667 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5668 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5669 stru_F8AD28.field_3F0 = v68->field_1E; | |
5670 stru_F8AD28.field_3F4 = v68->field_20; | |
5671 } | |
5672 else | |
5673 { | |
5674 stru_F8AD28.field_3E4 = 0; | |
5675 } | |
5676 v16 = 0.0039215689; | |
5677 v17 = 116 * v1->uSectorID; | |
5678 v69 = v17; | |
5679 v74 = 0; | |
5680 v73 = 0; | |
5681 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5682 v70 = pMobileLightsStack->uNumLightsActive; | |
5683 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5684 { | |
5685 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5686 do | |
5687 { | |
5688 if ( v74 >= 20 ) | |
5689 break; | |
5690 v19 = *((short *)v18 + 2); | |
5691 v20 = *((short *)v18 - 1); | |
5692 if ( v20 > v1->pBounding.x1 - v19 ) | |
5693 { | |
5694 if ( v20 < v19 + v1->pBounding.x2 ) | |
5695 { | |
5696 v21 = *(short *)v18; | |
5697 if ( v21 > v1->pBounding.y1 - v19 ) | |
5698 { | |
5699 if ( v21 < v19 + v1->pBounding.y2 ) | |
5700 { | |
5701 v22 = *((short *)v18 + 1); | |
5702 if ( v22 > v1->pBounding.z1 - v19 ) | |
5703 { | |
5704 if ( v22 < v19 + v1->pBounding.z2 ) | |
5705 { | |
5706 X = (v1->pFacePlane_old.dist | |
5707 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5708 + v21 * v1->pFacePlane_old.vNormal.y | |
5709 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5710 if ( X <= v19 ) | |
5711 { | |
5712 v23 = X; | |
5713 v24 = v74; | |
5714 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5715 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5716 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5717 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5718 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5719 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5720 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5721 v25 = (double)(signed int)v68 * v16; | |
5722 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5723 v26 = (unsigned __int8)v18[8]; | |
5724 *(float *)(v24 * 4 + 16297992) = v25; | |
5725 v27 = (double)(signed int)v68; | |
5726 v68 = (BLVFaceExtra *)v26; | |
5727 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5728 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5729 v16 = 0.0039215689; | |
5730 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5731 v28 = v74; | |
5732 v29 = v18[9]; | |
5733 ++v74; | |
5734 stru_F8AD28._blv_lights_types[v28] = v29; | |
5735 } | |
5736 } | |
5737 } | |
5738 } | |
5739 } | |
5740 } | |
5741 } | |
5742 ++v73; | |
5743 v18 += 18; | |
5744 v17 = v69; | |
5745 } | |
5746 while ( v73 < v70 ); | |
5747 } | |
5748 v30 = 0; | |
5749 v73 = 0; | |
5750 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5751 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5752 if ( v31 > 0 ) | |
5753 { | |
5754 while ( v74 < 20 ) | |
5755 { | |
5756 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5757 if ( !(v32->uAtributes & 8) ) | |
5758 { | |
5759 v33 = v1->pBounding.x1; | |
5760 v34 = v32->vPosition.x; | |
5761 X = v32->uBrightness; | |
5762 v35 = v32->uRadius; | |
5763 v68 = (BLVFaceExtra *)v32->uRadius; | |
5764 if ( v34 > v33 - v35 ) | |
5765 { | |
5766 if ( v34 < v35 + v1->pBounding.x2 ) | |
5767 { | |
5768 v36 = v32->vPosition.y; | |
5769 if ( v36 > v1->pBounding.y1 - v35 ) | |
5770 { | |
5771 if ( v36 < v35 + v1->pBounding.y2 ) | |
5772 { | |
5773 v37 = v32->vPosition.z; | |
5774 if ( v37 > v1->pBounding.z1 - v35 ) | |
5775 { | |
5776 if ( v37 < v35 + v1->pBounding.z2 ) | |
5777 { | |
5778 v38 = (v1->pFacePlane_old.dist | |
5779 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5780 + v37 * v1->pFacePlane_old.vNormal.z | |
5781 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5782 if ( v38 >= 0 ) | |
5783 { | |
5784 if ( v38 <= v35 && v35 ) | |
5785 { | |
5786 v39 = v74; | |
5787 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5788 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5789 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5790 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5791 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5792 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5793 v68 = (BLVFaceExtra *)v32->uRed; | |
5794 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5795 v68 = (BLVFaceExtra *)v32->uGreen; | |
5796 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5797 v68 = (BLVFaceExtra *)v32->uBlue; | |
5798 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5799 v16 = 0.0039215689; | |
5800 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5801 v40 = v74++; | |
5802 stru_F8AD28._blv_lights_types[v40] = 1; | |
5803 } | |
5804 } | |
5805 } | |
5806 } | |
5807 } | |
5808 } | |
5809 } | |
5810 } | |
5811 } | |
5812 v30 = v73++ + 1; | |
5813 if ( v73 >= v70 ) | |
5814 break; | |
5815 v17 = v69; | |
5816 } | |
5817 } | |
5818 v73 = 0; | |
5819 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5820 { | |
5821 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5822 do | |
5823 { | |
5824 if ( v74 >= 20 ) | |
5825 break; | |
5826 v42 = *((short *)v41 + 2); | |
5827 v43 = *((short *)v41 - 1); | |
5828 if ( v43 > v1->pBounding.x1 - v42 ) | |
5829 { | |
5830 if ( v43 < v42 + v1->pBounding.x2 ) | |
5831 { | |
5832 v44 = *(short *)v41; | |
5833 if ( v44 > v1->pBounding.y1 - v42 ) | |
5834 { | |
5835 if ( v44 < v42 + v1->pBounding.y2 ) | |
5836 { | |
5837 v45 = *((short *)v41 + 1); | |
5838 if ( v45 > v1->pBounding.z1 - v42 ) | |
5839 { | |
5840 if ( v45 < v42 + v1->pBounding.z2 ) | |
5841 { | |
5842 v46 = (v1->pFacePlane_old.dist | |
5843 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5844 + v43 * v1->pFacePlane_old.vNormal.x | |
5845 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5846 v69 = v46; | |
5847 if ( v46 >= 0 ) | |
5848 { | |
5849 if ( v46 <= v42 ) | |
5850 { | |
5851 v47 = v69; | |
5852 v48 = v74; | |
5853 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5854 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5855 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5856 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5857 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5858 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5859 v49 = (double)(signed int)v68 * v16; | |
5860 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5861 v50 = (unsigned __int8)v41[8]; | |
5862 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5863 v51 = (double)(signed int)v68; | |
5864 v68 = (BLVFaceExtra *)v50; | |
5865 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5866 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5867 v16 = 0.0039215689; | |
5868 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5869 v52 = v74++; | |
5870 stru_F8AD28._blv_lights_types[v52] = 1; | |
5871 } | |
5872 } | |
5873 } | |
5874 } | |
5875 } | |
5876 } | |
5877 } | |
5878 } | |
5879 ++v73; | |
5880 v41 += 12; | |
5881 } | |
5882 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5883 } | |
5884 stru_F8AD28.uNumLightsApplied = v74; | |
5885 v53 = v1->pBounding.x2; | |
5886 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5887 { | |
5888 v55 = v1->pBounding.x1; | |
5889 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5890 v54 = 0; | |
5891 else | |
5892 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5893 } | |
5894 else | |
5895 { | |
5896 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5897 } | |
5898 v56 = v1->pBounding.y2; | |
5899 v57 = v54 * v54; | |
5900 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5901 { | |
5902 v59 = v1->pBounding.y1; | |
5903 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5904 v58 = 0; | |
5905 else | |
5906 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5907 } | |
5908 else | |
5909 { | |
5910 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5911 } | |
5912 v60 = v58 * v58 + v57; | |
5913 v61 = v1->pBounding.z2; | |
5914 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5915 { | |
5916 v63 = v1->pBounding.z1; | |
5917 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5918 v62 = 0; | |
5919 else | |
5920 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5921 } | |
5922 else | |
5923 { | |
5924 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5925 } | |
5926 v64 = v62 * v62 + v60; | |
5927 if ( v64 ) | |
295 | 5928 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5929 else |
5930 stru_F8AD28.field_34 = 0; | |
5931 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5932 v65 = (double)(signed int)v68; | |
5933 if ( v65 >= 655.36 ) | |
5934 { | |
5935 if ( v65 >= 26214.4 ) | |
5936 { | |
5937 if ( v65 >= 45875.2 ) | |
5938 { | |
5939 stru_F8AD28.field_44 = 8; | |
5940 stru_F8AD28.field_48 = 3; | |
5941 } | |
5942 else | |
5943 { | |
5944 stru_F8AD28.field_44 = 16; | |
5945 stru_F8AD28.field_48 = 4; | |
5946 } | |
5947 } | |
5948 else | |
5949 { | |
5950 stru_F8AD28.field_44 = 32; | |
5951 stru_F8AD28.field_48 = 5; | |
5952 } | |
5953 } | |
5954 else | |
5955 { | |
5956 stru_F8AD28.field_44 = 64; | |
5957 stru_F8AD28.field_48 = 6; | |
5958 } | |
5959 } | |
5960 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5961 | |
5962 //----- (004AF412) -------------------------------------------------------- | |
5963 int __cdecl sub_4AF412() | |
5964 { | |
5965 int v0; // ST20_4@2 | |
5966 int v1; // ST20_4@2 | |
5967 int v2; // ST20_4@2 | |
5968 int v3; // esi@2 | |
5969 int v4; // ST20_4@2 | |
5970 int v5; // ecx@2 | |
5971 int v6; // ebx@2 | |
5972 int v7; // edi@2 | |
5973 int v8; // edx@2 | |
5974 int v9; // eax@2 | |
5975 int result; // eax@4 | |
5976 | |
5977 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5978 stru_F8AD28.vec_20.y = -65536; | |
5979 stru_F8AD28.plane_4.vNormal.x = 0; | |
5980 stru_F8AD28.plane_4.vNormal.y = 0; | |
5981 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5982 stru_F8AD28.vec_14.x = 65536; | |
5983 stru_F8AD28.vec_14.y = 0; | |
5984 stru_F8AD28.vec_14.z = 0; | |
5985 stru_F8AD28.vec_20.x = 0; | |
5986 stru_F8AD28.vec_20.z = 0; | |
5987 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5988 if ( pBLVRenderParams->sPartyRotX ) | |
5989 { | |
5990 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5991 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5992 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5993 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5994 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5995 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5996 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5997 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5998 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5999 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6000 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6001 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6002 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6003 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6004 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6005 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6006 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6007 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6008 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6009 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6010 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6011 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6012 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6013 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6014 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6015 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6016 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6017 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6018 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6019 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6020 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6021 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6022 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6023 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6024 v6 = pBLVRenderParams->vPartyPos.z; | |
6025 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6026 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6027 v8 = pBLVRenderParams->vPartyPos.y; | |
6028 v9 = pBLVRenderParams->vPartyPos.x; | |
6029 } | |
6030 else | |
6031 { | |
6032 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6033 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6034 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6035 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6036 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6037 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6038 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6039 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6040 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6041 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6042 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6043 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6044 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6045 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6046 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6047 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6048 v8 = pBLVRenderParams->vPartyPos.y; | |
6049 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6050 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6051 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6052 v9 = pBLVRenderParams->vPartyPos.x; | |
6053 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6054 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6055 v6 = pBLVRenderParams->vPartyPos.z; | |
6056 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6057 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6058 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6059 } | |
6060 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6061 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6062 + stru_F8AD28.plane_4.dist | |
6063 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6064 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6065 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6066 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6067 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6068 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6069 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6070 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6071 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6072 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6073 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6074 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6075 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6076 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6077 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6078 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6079 result = 0; | |
6080 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6081 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6082 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6083 stru_F8AD28.field_38 = 0; | |
6084 stru_F8AD28.field_3E4 = 0; | |
6085 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6086 stru_F8AD28.uNumLightsApplied = 0; | |
6087 stru_F8AD28.field_34 = 0; | |
6088 return result; | |
6089 } | |
6090 | |
6091 //----- (004B1447) -------------------------------------------------------- | |
6092 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6093 { | |
6094 signed int v3; // esi@1 | |
6095 char v4; // sf@8 | |
6096 int v5; // eax@8 | |
6097 unsigned __int64 v6; // qax@12 | |
6098 DDM_DLV_Header *v7; // eax@14 | |
6099 Player **v8; // edi@18 | |
6100 Player *result; // eax@19 | |
735 | 6101 //char *v10; // esi@20 |
0 | 6102 |
6103 v3 = 0; | |
6104 if ( a2 ) | |
6105 { | |
6106 if ( a2 != 1 ) | |
6107 { | |
6108 if ( a2 == 2 ) | |
6109 v3 = 2; | |
6110 goto LABEL_13; | |
6111 } | |
6112 v3 = 2; | |
6113 } | |
6114 else | |
6115 { | |
6116 v3 = 1; | |
6117 } | |
6118 if ( pParty->uFine < 4000000 ) | |
6119 { | |
6120 v4 = a3 + pParty->uFine < 0; | |
6121 v5 = a3 + pParty->uFine; | |
6122 pParty->uFine += a3; | |
6123 if ( v4 ) | |
6124 { | |
6125 v5 = 0; | |
6126 pParty->uFine = 0; | |
6127 } | |
6128 if ( v5 > 4000000 ) | |
6129 pParty->uFine = 4000000; | |
6130 } | |
487 | 6131 |
6132 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6133 | |
0 | 6134 LABEL_13: |
463 | 6135 pParty->InTheShopFlags[a1] = 1; |
0 | 6136 if ( v3 ) |
6137 { | |
6138 v7 = &pOutdoor->ddm; | |
6139 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6140 v7 = &pIndoor->dlv; | |
6141 v7->uReputation += v3; | |
6142 if ( v7->uReputation > 10000 ) | |
6143 v7->uReputation = 10000; | |
6144 } | |
6145 v8 = &pPlayers[1]; | |
6146 do | |
6147 { | |
6148 result = *v8; | |
6149 if ( pParty->uFine ) | |
6150 { | |
735 | 6151 //v10 = result->_guilds_member_bits; |
484 | 6152 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6153 if ( !(short)result ) |
735 | 6154 __debugbreak(); |
501 | 6155 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6156 } |
6157 ++v8; | |
6158 } | |
6159 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6160 return result; | |
6161 } | |
6162 | |
6163 //----- (004B1523) -------------------------------------------------------- | |
762 | 6164 void __thiscall sub_4B1523(int *_this) |
0 | 6165 { |
6166 int v1; // esi@1 | |
6167 int v2; // edx@1 | |
6168 unsigned int v3; // eax@2 | |
6169 int v4; // eax@4 | |
6170 LONG v5; // ecx@4 | |
6171 int v6; // eax@10 | |
6172 char *v7; // ST44_4@12 | |
6173 unsigned __int16 v8; // ax@12 | |
6174 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6175 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6176 POINT a2; // [sp+64h] [bp-10h]@1 | |
6177 int v13; // [sp+6Ch] [bp-8h]@4 | |
6178 int v14; // [sp+70h] [bp-4h]@4 | |
6179 | |
6180 v1 = *_this - 399; | |
6181 v2 = (*_this - 400) % 11 + 1; | |
6182 v11 = 4 * (*_this - 400) / 11; | |
6183 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6184 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6185 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6186 else | |
6187 v3 = 30; | |
6188 a1.Hint = 0; | |
6189 a1.uFrameY = v3; | |
6190 a1.uFrameWidth = 328; | |
6191 a1.uFrameHeight = 68; | |
6192 a1.uFrameX = 90; | |
6193 a1.uFrameZ = 417; | |
6194 a1.uFrameW = v3 + 67; | |
6195 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6196 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6197 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6198 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6199 v5 = a2.y; | |
6200 if ( v14 > a2.y ) | |
6201 v5 = v14; | |
6202 if ( v13 > v5 ) | |
6203 v5 = v13; | |
6204 if ( v4 > v5 ) | |
6205 v5 = v4; | |
262 | 6206 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", |
6207 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6208 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6209 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6210 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6211 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6212 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6213 a1.uFrameHeight += v6; | |
6214 if ( (signed int)a1.uFrameHeight < 150 ) | |
6215 a1.uFrameHeight = 150; | |
819 | 6216 a1.uFrameWidth = game_viewport_width; |
0 | 6217 a1.DrawMessageBox(0); |
6218 a1.uFrameWidth -= 12; | |
6219 a1.uFrameHeight -= 12; | |
6220 v7 = pSpellStats->pInfos[v1].pName; | |
6221 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6222 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6223 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6224 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6225 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6226 a1.uFrameZ = a1.uFrameX + 107; | |
6227 a1.uFrameWidth = 108; | |
6228 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6229 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6230 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6231 } |
6232 | |
6233 //----- (004B1784) -------------------------------------------------------- | |
6234 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6235 { | |
6236 Player *pPlayer; // ebx@1 | |
6237 bool result; // eax@2 | |
6238 unsigned __int16 v2; // ST0C_2@3 | |
6239 int v3; // eax@3 | |
6240 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6241 | |
6242 pPlayer = pPlayers[uActiveCharacter]; | |
6243 if ( pPlayer->CanAct() ) | |
6244 { | |
6245 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6246 result = 1; | |
6247 } | |
6248 else | |
6249 { | |
6250 pDialogueWindow->pNumPresenceButton = 0; | |
6251 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6252 v4.uFrameX = 483; | |
6253 v4.uFrameWidth = 148; | |
6254 v4.uFrameZ = 334; | |
6255 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6256 // "%s is in no condition to %s" | |
6257 // "do anything" | |
758 | 6258 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6259 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6260 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6261 result = 0; | |
6262 } | |
6263 return result; | |
6264 } | |
6265 // F8B1E0: using guessed type int dword_F8B1E0; | |
6266 | |
6267 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6268 void __cdecl ShowPopupShopItem() |
0 | 6269 { |
6270 POINT *v1; // esi@5 | |
6271 unsigned int v2; // eax@5 | |
6272 int v3; // ecx@5 | |
6273 POINT *v4; // esi@12 | |
6274 int v5; // eax@12 | |
6275 unsigned int v6; // eax@13 | |
6276 ItemGen *v7; // ecx@13 | |
6277 signed int v8; // esi@17 | |
6278 unsigned int v9; // eax@19 | |
475 | 6279 POINT v10; // [sp+8h] [bp-44h]@12 |
6280 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6281 POINT v12; // [sp+18h] [bp-34h]@18 | |
6282 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6283 POINT v14; // [sp+28h] [bp-24h]@17 | |
6284 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6285 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6286 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6287 |
484 | 6288 if ( in_current_building_type <= 0 ) |
0 | 6289 return; |
484 | 6290 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6291 { |
749 | 6292 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6293 { | |
6294 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6295 return; |
749 | 6296 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6297 { |
475 | 6298 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6299 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6300 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6301 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6302 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6303 return; |
907 | 6304 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6305 return; |
6306 } | |
749 | 6307 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6308 return; |
6309 } | |
475 | 6310 v4 = pMouse->GetCursorPos(&v11); |
6311 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6312 if ( !v5 ) |
6313 return; | |
336 | 6314 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6315 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6316 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6317 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6318 GameUI_DrawItemInfo(v7); | |
6319 return; | |
0 | 6320 } |
874 | 6321 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6322 { |
6323 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6324 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6325 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6326 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6327 if ( v5 ) | |
336 | 6328 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6329 } |
6330 } | |
6331 // F8B198: using guessed type int dword_F8B198; | |
6332 // F8B19C: using guessed type int dword_F8B19C; | |
6333 | |
6334 //----- (004B1BDB) -------------------------------------------------------- | |
6335 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6336 { | |
6337 signed __int64 v1; // ST2C_8@1 | |
6338 signed __int64 v2; // qax@1 | |
6339 signed __int64 v3; // ST1C_8@1 | |
6340 unsigned __int64 v4; // qax@1 | |
6341 unsigned int v5; // ebx@1 | |
112 | 6342 Player *v6; // ebx@1 |
0 | 6343 |
6344 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6345 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6346 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6347 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6348 v2 = v1 / 60 / 60; | |
6349 v3 = v2; | |
6350 v4 = (unsigned int)v2 / 0x18; | |
6351 v5 = (unsigned int)(v4 / 7) >> 2; | |
6352 pParty->uCurrentTimeSecond = v1 % 60; | |
6353 pParty->uCurrentMinute = v1 / 60 % 60; | |
6354 pParty->uCurrentHour = v3 % 24; | |
6355 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6356 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6357 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6358 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6359 pParty->RestAndHeal(); |
6360 dword_507B94 = 1; | |
112 | 6361 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6362 do |
6363 { | |
112 | 6364 v6->uTimeToRecovery = 0; |
6365 memset(&v6->uTimeToRecovery, 0, 4u); | |
6366 ++v6; | |
6367 } | |
6368 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6369 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6370 } |
6371 // 507B94: using guessed type int dword_507B94; | |
6372 | |
6373 //----- (004B1D27) -------------------------------------------------------- | |
6374 void __cdecl sub_4B1D27() | |
6375 { | |
6376 int v0; // edx@2 | |
6377 unsigned int v1; // ecx@7 | |
6378 signed int v2; // edi@10 | |
6379 int v3; // esi@10 | |
6380 __int16 v4; // ax@15 | |
6381 signed int v5; // edi@20 | |
6382 int v6; // esi@20 | |
6383 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6384 | |
484 | 6385 if ( in_current_building_type > 0 ) |
0 | 6386 { |
6387 v0 = 3; | |
484 | 6388 if ( in_current_building_type > BildingType_MagicShop ) |
6389 { | |
6390 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6391 { |
6392 if ( !dword_F8B1E4 ) | |
6393 return; | |
6394 } | |
6395 else | |
6396 { | |
484 | 6397 if ( in_current_building_type != BildingType_Temple ) |
0 | 6398 return; |
6399 } | |
336 | 6400 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6401 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6402 return; |
6403 } | |
336 | 6404 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6405 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6406 { |
6407 if ( pParty->uNumGold <= 0x2710 ) | |
6408 { | |
6409 if ( !dword_F8B1E4 ) | |
6410 return; | |
6411 v0 = 4; | |
907 | 6412 PlayHouseSound(v1, (HouseSoundID)v0); |
6413 return; | |
0 | 6414 } |
735 | 6415 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6416 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6417 { | |
6418 v5 = 0; | |
6419 v6 = 1; | |
6420 do | |
6421 { | |
6422 if ( pPlayers[v6]->CanAct() ) | |
6423 v7[v5++] = v6; | |
6424 ++v6; | |
6425 } | |
6426 while ( v6 <= 4 ); | |
6427 if ( v5 ) | |
6428 { | |
6429 qword_A750D8 = 256i64; | |
6430 word_A750E0 = 80; | |
6431 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6432 word_A750E2 = v4; |
6433 return; | |
0 | 6434 } |
6435 } | |
6436 } | |
6437 else | |
6438 { | |
6439 if ( !qword_A750D8 ) | |
6440 { | |
6441 v2 = 0; | |
6442 v3 = 1; | |
6443 do | |
6444 { | |
6445 if ( pPlayers[v3]->CanAct() ) | |
6446 v7[v2++] = v3; | |
6447 ++v3; | |
6448 } | |
6449 while ( v3 <= 4 ); | |
6450 if ( v2 ) | |
6451 { | |
6452 qword_A750D8 = 256i64; | |
6453 word_A750E0 = 80; | |
6454 v4 = LOWORD(v7[rand() % v2]); | |
6455 word_A750E2 = v4; | |
6456 return; | |
6457 } | |
6458 } | |
6459 } | |
6460 } | |
6461 } | |
6462 | |
6463 //----- (004B1ECE) -------------------------------------------------------- | |
6464 void __cdecl sub_4B1ECE() | |
6465 { | |
6466 __int16 *v0; // edi@1 | |
6467 int v1; // ebx@3 | |
6468 Player *v2; // esi@3 | |
6469 int v3; // eax@4 | |
6470 signed int v4; // eax@9 | |
6471 int v5; // ebx@11 | |
89 | 6472 Player *v6; // esi@13 |
6473 ItemGen *v7; // eax@14 | |
0 | 6474 signed int v8; // edi@14 |
89 | 6475 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6476 signed int v10; // [sp+10h] [bp-8h]@13 |
6477 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6478 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6479 |
484 | 6480 contract_approved = 0; |
0 | 6481 v11 = 0; |
6482 uDialogueType = 84; | |
827 | 6483 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6484 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6485 while ( 1 ) | |
6486 { | |
484 | 6487 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6488 { |
6489 v1 = 0; | |
6490 v2 = pParty->pPlayers; | |
6491 do | |
6492 { | |
89 | 6493 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6494 if ( v3 ) |
6495 break; | |
6496 ++v2; | |
6497 ++v1; | |
6498 } | |
6499 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6500 if ( v1 == 4 ) | |
6501 break; | |
6502 } | |
6503 ++v11; | |
6504 v0 += 2; | |
89 | 6505 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6506 break; | |
6507 } | |
6508 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6509 { | |
827 | 6510 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6511 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6512 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6513 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6514 } | |
484 | 6515 if ( contract_approved == 601 ) |
0 | 6516 { |
6517 v5 = 0; | |
89 | 6518 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6519 v9 = 0; |
6520 while ( 1 ) | |
6521 { | |
135 | 6522 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6523 { |
6524 v10 = 0; | |
89 | 6525 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6526 do |
6527 { | |
89 | 6528 v7 = v6->pInventoryItems; |
0 | 6529 v8 = 138; |
6530 do | |
6531 { | |
89 | 6532 if ( v7->uItemID == 601 ) |
0 | 6533 { |
377 | 6534 if ( !v7->uHolderPlayer ) |
89 | 6535 v9 = v7; |
377 | 6536 if ( v7->uHolderPlayer == v5 ) |
0 | 6537 v10 = 1; |
6538 } | |
89 | 6539 ++v7; |
0 | 6540 --v8; |
6541 } | |
6542 while ( v8 ); | |
89 | 6543 ++v6; |
6544 } | |
6545 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6546 if ( !v10 ) |
6547 break; | |
6548 } | |
89 | 6549 ++v12; |
0 | 6550 ++v5; |
89 | 6551 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6552 return; |
6553 } | |
6554 if ( v9 ) | |
377 | 6555 v9->uHolderPlayer = v5; |
0 | 6556 } |
6557 } | |
6558 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6559 // 722B3C: using guessed type int dword_722B3C; | |
6560 // 722B44: using guessed type int dword_722B44; | |
6561 // F8B1A8: using guessed type int dword_F8B1A8; | |
6562 | |
6563 //----- (004B2001) -------------------------------------------------------- | |
459 | 6564 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6565 { | |
6566 //signed int v1; // eax@1 | |
6567 NPCData *pCurrentNPCInfo; // ebp@1 | |
6568 int pEventNumber; // ecx@8 | |
0 | 6569 Player *v4; // esi@20 |
467 | 6570 //int v5; // eax@28 |
6571 //int v6; // eax@31 | |
6572 //int v7; // eax@34 | |
6573 //int v8; // eax@37 | |
6574 //int v9; // eax@40 | |
6575 //unsigned int v10; // eax@43 | |
0 | 6576 char *v12; // eax@53 |
6577 char *v13; // eax@56 | |
6578 char *v14; // eax@57 | |
6579 char *v15; // eax@58 | |
467 | 6580 //unsigned int v16; // ebp@62 |
0 | 6581 char *v17; // ecx@63 |
6582 char *v18; // eax@65 | |
6583 const char *v19; // ecx@68 | |
248 | 6584 //unsigned int v20; // eax@69 |
467 | 6585 signed int pPrice; // ecx@70 |
0 | 6586 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6587 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6588 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6589 //int v25; // [sp-4h] [bp-10h]@49 |
6590 | |
459 | 6591 uDialogueType = uMessageParam + 1; |
6592 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6593 if ( uMessageParam <= 24 ) |
460 | 6594 { |
459 | 6595 switch ( uMessageParam ) |
6596 { | |
6597 case 13: | |
827 | 6598 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6599 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6600 NPCHireableDialogPrepare(); |
459 | 6601 dialogue_show_profession_details = false; |
6602 goto _return; | |
6603 case 19: | |
6604 pEventNumber = pCurrentNPCInfo->evt_A; | |
6605 break; | |
6606 case 20: | |
6607 pEventNumber = pCurrentNPCInfo->evt_B; | |
6608 break; | |
6609 case 21: | |
6610 pEventNumber = pCurrentNPCInfo->evt_C; | |
6611 break; | |
6612 case 22: | |
6613 pEventNumber = pCurrentNPCInfo->evt_D; | |
6614 break; | |
6615 case 23: | |
6616 pEventNumber = pCurrentNPCInfo->evt_E; | |
6617 break; | |
6618 case 24: | |
6619 pEventNumber = pCurrentNPCInfo->evt_F; | |
6620 break; | |
6621 default: | |
467 | 6622 goto _return; |
6623 } | |
6624 /*switch ( pEventNumber ) | |
6625 { | |
6626 case 139: | |
6627 sub_4B1ECE(); | |
6628 goto _return; | |
6629 case 311: | |
6630 sub_4BBA85_bounties(); | |
6631 goto _return; | |
6632 }*/ | |
459 | 6633 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6634 { | |
6635 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6636 { | |
6637 if ( pEventNumber == 139 ) | |
0 | 6638 { |
6639 sub_4B1ECE(); | |
6640 } | |
6641 else | |
6642 { | |
459 | 6643 if ( pEventNumber == 311 ) |
0 | 6644 { |
6645 sub_4BBA85_bounties(); | |
6646 } | |
6647 else | |
6648 { | |
827 | 6649 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6650 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6651 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6652 activeLevelDecoration = NULL; |
0 | 6653 } |
6654 } | |
6655 } | |
6656 else | |
6657 { | |
459 | 6658 dword_F8B1D8 = uMessageParam; |
6659 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6660 } |
6661 } | |
6662 else | |
6663 { | |
459 | 6664 sub_4B3FE5(pEventNumber); |
0 | 6665 } |
6666 goto _return; | |
460 | 6667 } |
459 | 6668 if ( uMessageParam != 76 ) |
6669 { | |
6670 if ( uMessageParam == 77 ) | |
6671 { | |
467 | 6672 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6673 if (dialogue_show_profession_details) |
459 | 6674 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6675 else |
459 | 6676 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6677 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6678 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6679 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6680 current_npc_text = v18; |
0 | 6681 } |
6682 else | |
6683 { | |
459 | 6684 if ( uMessageParam == 79 ) |
0 | 6685 { |
484 | 6686 if ( contract_approved ) |
0 | 6687 { |
267 | 6688 Party::TakeGold(gold_transaction_amount); |
0 | 6689 if ( uActiveCharacter ) |
6690 { | |
492 | 6691 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6692 *(short *)v12 &= 0x3Fu; |
6693 switch ( dword_F8B1B0 ) | |
6694 { | |
6695 case 2: | |
492 | 6696 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6697 *v15 |= 0x40u; |
6698 break; | |
6699 case 3: | |
492 | 6700 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6701 *v14 |= 0x80u; |
6702 break; | |
6703 case 4: | |
492 | 6704 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6705 v13[1] |= 1u; |
6706 break; | |
6707 } | |
187 | 6708 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6709 } |
437 | 6710 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6711 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6712 { |
6713 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6714 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6715 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6716 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6717 }*/ |
0 | 6718 } |
6719 } | |
6720 else | |
6721 { | |
492 | 6722 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6723 { |
267 | 6724 Party::TakeGold(gold_transaction_amount); |
0 | 6725 v4 = pParty->pPlayers; |
6726 do | |
6727 { | |
492 | 6728 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6729 ++v4; |
6730 } | |
6731 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6732 switch ( dword_F8B1D8 ) | |
6733 { | |
6734 case 19: | |
467 | 6735 pEventNumber = pCurrentNPCInfo->evt_A; |
6736 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6737 pCurrentNPCInfo->evt_A = 0; |
0 | 6738 break; |
6739 case 20: | |
467 | 6740 pEventNumber = pCurrentNPCInfo->evt_B; |
6741 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6742 pCurrentNPCInfo->evt_B = 0; |
0 | 6743 break; |
6744 case 21: | |
467 | 6745 pEventNumber = pCurrentNPCInfo->evt_C; |
6746 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6747 pCurrentNPCInfo->evt_C = 0; |
0 | 6748 break; |
6749 case 22: | |
467 | 6750 pEventNumber = pCurrentNPCInfo->evt_D; |
6751 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6752 pCurrentNPCInfo->evt_D = 0; |
0 | 6753 break; |
6754 case 23: | |
467 | 6755 pEventNumber = pCurrentNPCInfo->evt_E; |
6756 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6757 pCurrentNPCInfo->evt_E = 0; |
0 | 6758 break; |
6759 case 24: | |
467 | 6760 pEventNumber = pCurrentNPCInfo->evt_F; |
6761 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6762 pCurrentNPCInfo->evt_F = 0; | |
0 | 6763 break; |
6764 } | |
437 | 6765 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6766 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6767 { |
6768 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6769 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6770 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6771 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6772 }*/ |
467 | 6773 //v11 = uActiveCharacter; |
0 | 6774 if ( uActiveCharacter ) |
6775 { | |
467 | 6776 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6777 goto _return; |
6778 } | |
6779 } | |
6780 } | |
6781 } | |
6782 goto _return; | |
6783 } | |
6784 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6785 { | |
467 | 6786 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6787 goto _return; |
6788 } | |
459 | 6789 if ( pCurrentNPCInfo->uProfession != 51 ) |
6790 { | |
467 | 6791 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6792 if ( pParty->uNumGold < pPrice ) | |
6793 { | |
6794 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6795 dialogue_show_profession_details = false; |
0 | 6796 uDialogueType = 13; |
827 | 6797 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6798 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6799 if ( uActiveCharacter ) |
248 | 6800 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6801 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6802 goto _return; | |
6803 } | |
6804 Party::TakeGold(pPrice); | |
0 | 6805 } |
147 | 6806 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6807 pCurrentNPCInfo->uFlags |= 128; |
0 | 6808 pParty->field_709 = 0; |
659 | 6809 Party__CountHirelings(); |
0 | 6810 if ( pParty->pHirelings[0].pName ) |
6811 { | |
459 | 6812 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6813 v24 = pCurrentNPCInfo->pName; | |
0 | 6814 v22 = pParty->pHireling2Name; |
6815 } | |
6816 else | |
6817 { | |
459 | 6818 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6819 v24 = pCurrentNPCInfo->pName; | |
0 | 6820 v22 = pParty->pHireling1Name; |
6821 } | |
6822 strcpy(v22, v24); | |
6823 pParty->field_709 = 0; | |
659 | 6824 Party__CountHirelings(); |
480 | 6825 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6826 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6827 |
6828 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6829 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6830 { |
6831 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6832 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6833 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6834 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6835 }*/ |
0 | 6836 if ( uActiveCharacter ) |
467 | 6837 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6838 _return: |
460 | 6839 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6840 } |
6841 | |
6842 //----- (004B254D) -------------------------------------------------------- | |
6843 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6844 { | |
6845 Player *v1; // esi@1 | |
6846 int v2; // edx@1 | |
6847 int v3; // ecx@1 | |
6848 int v4; // edi@1 | |
6849 int v5; // eax@7 | |
6850 int v6; // eax@7 | |
6851 int v7; // ebx@7 | |
6852 int v8; // ebx@8 | |
6853 signed int v9; // esi@8 | |
6854 int v10; // eax@8 | |
6855 char *v11; // ecx@8 | |
6856 int v12; // edi@9 | |
6857 char *v13; // edx@9 | |
6858 signed int v14; // edi@10 | |
6859 unsigned int v16; // eax@29 | |
6860 int v17; // eax@36 | |
6861 char v18; // cl@46 | |
6862 __int16 v19; // dx@56 | |
6863 int v20; // eax@60 | |
6864 char *v21; // [sp-Ch] [bp-38h]@82 | |
6865 const char *v22; // [sp-8h] [bp-34h]@21 | |
6866 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6867 char *v24; // [sp-8h] [bp-34h]@82 | |
6868 char *v25; // [sp-4h] [bp-30h]@14 | |
6869 int v26; // [sp-4h] [bp-30h]@38 | |
6870 int v27; // [sp-4h] [bp-30h]@82 | |
6871 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6872 int v29; // [sp+10h] [bp-1Ch]@13 | |
6873 int v30; // [sp+14h] [bp-18h]@15 | |
6874 int v31; // [sp+18h] [bp-14h]@16 | |
6875 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6876 int v33; // [sp+20h] [bp-Ch]@7 | |
6877 int v34; // [sp+24h] [bp-8h]@7 | |
6878 char *v35; // [sp+28h] [bp-4h]@1 | |
6879 | |
6880 v1 = pPlayers[uActiveCharacter]; | |
484 | 6881 contract_approved = 0; |
0 | 6882 v2 = (_this - 200) % 3; |
6883 v3 = (_this - 200) / 3; | |
6884 v4 = v2; | |
6885 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6886 dword_F8B1AC_award_bit_number = v3; |
0 | 6887 if ( v2 ) |
6888 { | |
6889 if ( v2 == 1 ) | |
6890 { | |
267 | 6891 gold_transaction_amount = 5000; |
0 | 6892 dword_F8B1B0 = 3; |
6893 } | |
6894 else | |
6895 { | |
6896 if ( v2 == 2 ) | |
6897 { | |
267 | 6898 gold_transaction_amount = 8000; |
0 | 6899 dword_F8B1B0 = 4; |
6900 } | |
6901 } | |
6902 } | |
6903 else | |
6904 { | |
267 | 6905 gold_transaction_amount = 2000; |
0 | 6906 dword_F8B1B0 = 2; |
6907 } | |
135 | 6908 v5 = v1->classType; |
0 | 6909 v33 = v5; |
6910 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
6911 *(int *)a1 = v1->pActiveSkills[v3]; | |
6912 v7 = a1[0] & 0x3F; | |
6913 v34 = v2 + 2; | |
6914 if ( v6 < v2 + 2 ) | |
6915 { | |
6916 v8 = v33; | |
6917 v9 = 0; | |
6918 v10 = v33 - v33 % 4; | |
6919 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
6920 do | |
6921 { | |
6922 v12 = (unsigned __int8)*v11; | |
6923 v13 = &v28[4 * v9]; | |
6924 *(int *)v13 = 0; | |
6925 if ( v12 < v34 ) | |
6926 { | |
6927 v14 = 1; | |
6928 } | |
6929 else | |
6930 { | |
6931 v14 = 1; | |
6932 *(int *)v13 = 1; | |
6933 } | |
6934 ++v9; | |
6935 v11 += 37; | |
6936 } | |
6937 while ( v9 < 4 ); | |
6938 if ( v29 == v14 ) | |
6939 { | |
6940 v25 = pClassNames[v10 + 1]; | |
6941 } | |
6942 else | |
6943 { | |
6944 if ( v30 == v14 ) | |
6945 { | |
6946 if ( v31 == v14 ) | |
6947 { | |
6948 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
6949 return pTmpBuf; | |
6950 } | |
6951 v25 = pClassNames[v10 + 2]; | |
6952 } | |
6953 else | |
6954 { | |
6955 if ( v31 != v14 ) | |
6956 { | |
6957 v25 = pClassNames[v8]; | |
6958 v22 = pGlobalTXT_LocalizationStrings[632]; | |
6959 goto LABEL_23; | |
6960 } | |
6961 v25 = pClassNames[v10 + 3]; | |
6962 } | |
6963 } | |
6964 v22 = pGlobalTXT_LocalizationStrings[633]; | |
6965 LABEL_23: | |
6966 sprintf(pTmpBuf, v22, v25); | |
6967 return pTmpBuf; | |
6968 } | |
6969 if ( !v1->CanAct() ) | |
6970 return (char *)pNPCTopics[122].pText; | |
6971 if ( !v7 ) | |
6972 return (char *)pNPCTopics[131].pText; | |
6973 v16 = SkillToMastery(a1[0]); | |
6974 if ( (signed int)v16 > v4 + 1 ) | |
6975 return (char *)pNPCTopics[v4 + 128].pText; | |
6976 if ( v34 != 2 ) | |
6977 { | |
6978 if ( v34 == 3 ) | |
6979 { | |
6980 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6981 { | |
492 | 6982 v17 = dword_F8B1AC_award_bit_number; |
6983 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 6984 { |
6985 default: | |
6986 goto LABEL_41; | |
6987 case 12: | |
6988 case 13: | |
6989 case 14: | |
6990 case 15: | |
6991 case 16: | |
6992 case 17: | |
6993 case 18: | |
267 | 6994 gold_transaction_amount = 4000; |
0 | 6995 goto LABEL_42; |
6996 case 19: | |
6997 v19 = 114; | |
6998 goto LABEL_57; | |
6999 case 20: | |
7000 v19 = 110; | |
7001 LABEL_57: | |
484 | 7002 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7003 return v35; |
7004 goto LABEL_40; | |
7005 case 22: | |
7006 v20 = v1->GetBaseWillpower(); | |
7007 goto LABEL_61; | |
7008 case 24: | |
267 | 7009 gold_transaction_amount = 2500; |
0 | 7010 v20 = v1->GetBaseEndurance(); |
7011 goto LABEL_61; | |
7012 case 36: | |
7013 v20 = v1->GetBaseIntelligence(); | |
7014 LABEL_61: | |
7015 if ( v20 < 50 ) | |
7016 return v35; | |
7017 goto LABEL_40; | |
7018 case 21: | |
7019 case 23: | |
7020 case 25: | |
7021 case 26: | |
7022 case 29: | |
7023 case 32: | |
7024 case 34: | |
7025 case 35: | |
267 | 7026 gold_transaction_amount = 2500; |
0 | 7027 goto LABEL_42; |
7028 case 8: | |
7029 case 9: | |
7030 case 10: | |
7031 case 11: | |
267 | 7032 gold_transaction_amount = 3000; |
0 | 7033 goto LABEL_42; |
7034 case 7: | |
7035 goto LABEL_67; | |
7036 } | |
7037 goto LABEL_67; | |
7038 } | |
7039 } | |
7040 else | |
7041 { | |
7042 if ( v34 != 4 ) | |
7043 { | |
7044 LABEL_40: | |
492 | 7045 v17 = dword_F8B1AC_award_bit_number; |
0 | 7046 goto LABEL_41; |
7047 } | |
7048 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7049 { | |
492 | 7050 v17 = dword_F8B1AC_award_bit_number; |
7051 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7052 { |
7053 case 19: | |
7054 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7055 goto LABEL_40; | |
7056 v26 = 1; | |
7057 v23 = 26; | |
7058 goto LABEL_39; | |
7059 default: | |
7060 goto LABEL_41; | |
7061 case 20: | |
7062 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7063 goto LABEL_40; | |
7064 v26 = 1; | |
7065 v23 = 27; | |
7066 LABEL_39: | |
7067 if ( v1->_49327B(v23, v26) == 1 ) | |
7068 goto LABEL_40; | |
7069 return v35; | |
7070 case 30: | |
7071 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7072 goto LABEL_47; | |
7073 case 31: | |
7074 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7075 LABEL_47: | |
7076 if ( (v18 & 0x3Fu) < 0xA ) | |
7077 return v35; | |
7078 goto LABEL_41; | |
7079 case 21: | |
7080 case 23: | |
7081 case 24: | |
7082 case 25: | |
7083 case 26: | |
7084 case 29: | |
7085 case 32: | |
7086 case 34: | |
7087 case 35: | |
267 | 7088 gold_transaction_amount = 6000; |
0 | 7089 goto LABEL_42; |
7090 case 8: | |
7091 case 9: | |
7092 case 10: | |
7093 case 11: | |
267 | 7094 gold_transaction_amount = 7000; |
0 | 7095 goto LABEL_42; |
7096 case 7: | |
7097 break; | |
7098 } | |
7099 LABEL_67: | |
267 | 7100 gold_transaction_amount = 0; |
0 | 7101 goto LABEL_41; |
7102 } | |
7103 } | |
7104 return v35; | |
7105 } | |
7106 if ( v7 < 4 ) | |
7107 return v35; | |
492 | 7108 v17 = dword_F8B1AC_award_bit_number; |
7109 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7110 { | |
7111 if ( dword_F8B1AC_award_bit_number != 29 | |
7112 && dword_F8B1AC_award_bit_number != 32 | |
7113 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7114 { |
7115 LABEL_41: | |
267 | 7116 if ( !gold_transaction_amount ) |
0 | 7117 goto LABEL_79; |
7118 goto LABEL_42; | |
7119 } | |
7120 LABEL_87: | |
267 | 7121 gold_transaction_amount = 500; |
0 | 7122 goto LABEL_41; |
7123 } | |
492 | 7124 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7125 goto LABEL_87; |
492 | 7126 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7127 { |
267 | 7128 gold_transaction_amount = 0; |
0 | 7129 goto LABEL_79; |
7130 } | |
492 | 7131 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7132 goto LABEL_41; |
492 | 7133 if ( dword_F8B1AC_award_bit_number > 18 ) |
7134 { | |
7135 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7136 goto LABEL_41; |
7137 goto LABEL_87; | |
7138 } | |
267 | 7139 gold_transaction_amount = 1000; |
0 | 7140 LABEL_42: |
267 | 7141 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7142 return (char *)pNPCTopics[124].pText; |
7143 LABEL_79: | |
484 | 7144 contract_approved = 1; |
0 | 7145 if ( v34 == 2 ) |
7146 { | |
267 | 7147 v27 = gold_transaction_amount; |
0 | 7148 v24 = pSkillNames[v17]; |
7149 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7150 goto LABEL_90; | |
7151 } | |
7152 if ( v34 == 3 ) | |
7153 { | |
267 | 7154 v27 = gold_transaction_amount; |
0 | 7155 v24 = pSkillNames[v17]; |
7156 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7157 goto LABEL_90; | |
7158 } | |
7159 if ( v34 == 4 ) | |
7160 { | |
267 | 7161 v27 = gold_transaction_amount; |
0 | 7162 v24 = pSkillNames[v17]; |
7163 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7164 LABEL_90: | |
809 | 7165 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); |
0 | 7166 } |
7167 return pTmpBuf2; | |
7168 } | |
7169 | |
7170 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7171 const char * ContractSelectText( int pEventCode ) |
7172 { | |
7173 static const int dialogue_base=110; | |
484 | 7174 contract_approved = 0; |
492 | 7175 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7176 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7177 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7178 { | |
492 | 7179 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7180 { | |
7181 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7182 } |
7183 else | |
7184 { | |
267 | 7185 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7186 { |
484 | 7187 contract_approved = 1; |
492 | 7188 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7189 } |
7190 else | |
7191 { | |
492 | 7192 return pNPCTopics[dialogue_base+14].pText; |
0 | 7193 } |
7194 } | |
7195 } | |
7196 else | |
7197 { | |
492 | 7198 return pNPCTopics[dialogue_base+12].pText; |
0 | 7199 } |
7200 } | |
7201 | |
7202 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7203 void SimpleHouseAndBoatsDialog() |
0 | 7204 { |
7205 char *v0; // esi@3 | |
7206 char *v1; // ST1C_4@3 | |
7207 char *v2; // eax@3 | |
7208 const char *v3; // ST1C_4@5 | |
7209 int v4; // eax@5 | |
7210 unsigned int i; // eax@5 | |
7211 NPCData *v6; // esi@6 | |
7212 unsigned __int16 v7; // bx@6 | |
7213 unsigned int v8; // eax@6 | |
7214 int v9; // eax@11 | |
7215 unsigned int v10; // ecx@12 | |
7216 int v11; // eax@12 | |
7217 int v12; // esi@12 | |
7218 char *v13; // eax@12 | |
7219 GUIWindow *v14; // ebx@13 | |
7220 char *v15; // esi@14 | |
7221 GUIButton *v16; // eax@15 | |
7222 unsigned int v17; // ecx@15 | |
7223 int v18; // ecx@17 | |
7224 int v19; // ecx@18 | |
7225 int v20; // ecx@19 | |
7226 int v21; // ecx@20 | |
7227 int v22; // ecx@21 | |
7228 unsigned int v23; // ecx@23 | |
7229 int v24; // ecx@35 | |
7230 int v25; // ecx@36 | |
7231 int v26; // ecx@37 | |
7232 int v27; // ecx@38 | |
7233 int v28; // ecx@39 | |
7234 char *v29; // esi@42 | |
7235 unsigned int v30; // ST20_4@42 | |
7236 int v31; // ST1C_4@42 | |
7237 unsigned int v32; // eax@42 | |
7238 char *v33; // eax@43 | |
7239 int v34; // esi@51 | |
7240 int v35; // eax@51 | |
7241 unsigned int v36; // edi@51 | |
7242 GUIButton *v37; // eax@52 | |
7243 int v38; // eax@52 | |
7244 signed int v39; // ecx@54 | |
7245 int v40; // edi@57 | |
7246 GUIButton *v41; // eax@60 | |
7247 GUIButton *v42; // esi@60 | |
7248 const char *v43; // ebx@60 | |
7249 int v44; // eax@60 | |
7250 unsigned int v45; // ecx@60 | |
7251 unsigned __int16 v46; // ax@60 | |
7252 GUIFont *v47; // ebx@64 | |
7253 int v48; // esi@64 | |
7254 char *v49; // eax@66 | |
7255 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7256 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7257 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7258 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7259 int v55; // [sp+10Ch] [bp-10h]@6 | |
7260 int v56; // [sp+110h] [bp-Ch]@13 | |
7261 char *pInString; // [sp+114h] [bp-8h]@12 | |
7262 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7263 | |
7264 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7265 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7266 { |
7267 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7268 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7269 a1.uFrameX = 493; | |
7270 a1.uFrameWidth = 126; | |
7271 a1.uFrameZ = 366; | |
7272 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7273 a1.uFrameX = 483; | |
7274 a1.uFrameWidth = 148; | |
7275 a1.uFrameZ = 334; | |
434 | 7276 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7277 if ( !v2 ) |
7278 { | |
721 | 7279 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7280 v2 = pTmpBuf; |
7281 } | |
7282 v3 = v2; | |
7283 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7284 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7285 return; | |
0 | 7286 } |
7287 a1.uFrameWidth -= 10; | |
7288 a1.uFrameZ -= 10; | |
459 | 7289 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7290 v6 = v58; |
7291 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7292 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7293 v8 = v6->uProfession; | |
7294 if ( v8 ) | |
264 | 7295 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7296 else |
7297 strcpy(pTmpBuf, v6->pName); | |
7298 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7299 if ( !dword_591080 ) | |
7300 { | |
7301 if ( !uDialogueType ) | |
7302 { | |
7303 v9 = v6->greet; | |
7304 if ( v9 ) | |
7305 { | |
7306 v10 = v6->uFlags; | |
819 | 7307 a1.uFrameWidth = game_viewport_width; |
0 | 7308 a1.uFrameZ = 452; |
7309 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7310 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7311 v12 = v11 + 7; | |
7312 pRenderer->_4A6A68( | |
7313 8u, | |
7314 352 - (v11 + 7), | |
7315 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7316 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7317 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7318 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7319 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7320 } | |
7321 } | |
7322 } | |
7323 v14 = pDialogueWindow; | |
7324 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7325 v52.uFrameX = 483; | |
7326 v52.uFrameWidth = 148; | |
7327 v52.uFrameZ = 334; | |
7328 v56 = v52.pStartingPosActiveItem; | |
7329 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7330 { | |
348 | 7331 v15 = "";//(char *)v54; |
0 | 7332 while ( 1 ) |
7333 { | |
7334 v16 = v52.GetControl(v56); | |
832 | 7335 v17 = v16->msg_param; |
0 | 7336 pInString = (char *)v16; |
7337 if ( (signed int)v17 > 24 ) | |
7338 { | |
7339 v24 = v17 - 76; | |
7340 if ( !v24 ) | |
7341 { | |
7342 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7343 goto LABEL_49; | |
7344 } | |
7345 v25 = v24 - 1; | |
7346 if ( !v25 ) | |
7347 { | |
7348 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7349 goto LABEL_49; | |
7350 } | |
7351 v26 = v25 - 2; | |
7352 if ( !v26 ) | |
7353 { | |
7354 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7355 LABEL_44: | |
7356 v15 = v33; | |
7357 LABEL_45: | |
7358 v16 = (GUIButton *)pInString; | |
7359 goto LABEL_49; | |
7360 } | |
7361 v27 = v26 - 3; | |
7362 if ( !v27 ) | |
7363 { | |
459 | 7364 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7365 goto LABEL_44; |
7366 } | |
7367 v28 = v27 - 1; | |
7368 if ( !v28 ) | |
7369 { | |
7370 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7371 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7372 v31 = *(int *)v29; | |
7373 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7374 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7375 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7376 current_npc_text = pTmpBuf2; |
0 | 7377 v15 = ""; |
7378 goto LABEL_45; | |
7379 } | |
7380 if ( v28 != 10 ) | |
7381 goto LABEL_41; | |
7382 } | |
7383 else | |
7384 { | |
7385 if ( v17 == 24 ) | |
7386 { | |
291 | 7387 v23 = v58->evt_F; |
0 | 7388 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7389 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7390 if ( !v15 ) |
7391 { | |
832 | 7392 v16->msg_param = 0; |
0 | 7393 v15 = ""; |
7394 } | |
7395 goto LABEL_49; | |
7396 } | |
7397 v18 = v17 - 13; | |
7398 if ( v18 ) | |
7399 { | |
7400 v19 = v18 - 6; | |
7401 if ( !v19 ) | |
7402 { | |
291 | 7403 v23 = v58->evt_A; |
0 | 7404 goto LABEL_33; |
7405 } | |
7406 v20 = v19 - 1; | |
7407 if ( !v20 ) | |
7408 { | |
291 | 7409 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7410 if ( !v15 ) |
7411 { | |
832 | 7412 v16->msg_param = 0; |
0 | 7413 v15 = ""; |
7414 } | |
7415 if ( uDialogueType != 84 ) | |
7416 goto LABEL_49; | |
484 | 7417 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7418 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7419 current_npc_text = pTmpBuf2; | |
0 | 7420 goto LABEL_45; |
7421 } | |
7422 v21 = v20 - 1; | |
7423 if ( !v21 ) | |
7424 { | |
291 | 7425 v23 = v58->evt_C; |
0 | 7426 goto LABEL_33; |
7427 } | |
7428 v22 = v21 - 1; | |
7429 if ( !v22 ) | |
7430 { | |
291 | 7431 v23 = v58->evt_D; |
0 | 7432 goto LABEL_33; |
7433 } | |
7434 if ( v22 == 1 ) | |
7435 { | |
291 | 7436 v23 = v58->evt_E; |
0 | 7437 goto LABEL_33; |
7438 } | |
7439 LABEL_41: | |
7440 v15 = ""; | |
7441 goto LABEL_49; | |
7442 } | |
7443 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7444 } | |
7445 LABEL_49: | |
7446 strcpy(v16->pButtonName, v15); | |
7447 ++v56; | |
7448 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7449 { | |
7450 v14 = pDialogueWindow; | |
7451 break; | |
7452 } | |
7453 } | |
7454 } | |
7455 v34 = 0; | |
7456 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7457 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7458 v36 = v14->pStartingPosActiveItem; | |
7459 v55 = v35; | |
7460 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7461 + pDialogueWindow->pStartingPosActiveItem ) | |
7462 { | |
7463 v37 = v14->GetControl(v36); | |
7464 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7465 v14 = pDialogueWindow; | |
7466 v34 += v38; | |
7467 ++v36; | |
7468 } | |
7469 v39 = v14->pNumPresenceButton; | |
7470 if ( v39 ) | |
7471 { | |
7472 v58 = (NPCData *)((174 - v34) / v39); | |
7473 if ( (signed int)v58 > 32 ) | |
7474 v58 = (NPCData *)32; | |
7475 pInString = (char *)2; | |
7476 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7477 v56 = v14->pStartingPosActiveItem; | |
7478 i = v56; | |
7479 if ( (signed int)i < (signed int)(i + v39) ) | |
7480 { | |
7481 while ( 1 ) | |
7482 { | |
7483 v41 = v14->GetControl(i); | |
7484 v42 = v41; | |
7485 v43 = v41->pButtonName; | |
7486 v41->uY = (unsigned int)((char *)v58 + v40); | |
7487 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7488 v45 = v42->uY; | |
7489 v42->uHeight = v44; | |
7490 v40 = v45 + v44 - 1; | |
7491 v42->uW = v40; | |
7492 v46 = v55; | |
7493 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7494 v46 = v54; | |
7495 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7496 v14 = pDialogueWindow; | |
7497 ++pInString; | |
7498 ++v56; | |
7499 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7500 if ( v56 >= (signed int)i ) | |
7501 break; | |
7502 i = v56; | |
7503 } | |
7504 } | |
7505 } | |
827 | 7506 if ( current_npc_text ) |
0 | 7507 { |
7508 w.uFrameWidth = 458; | |
7509 w.uFrameZ = 457; | |
7510 v47 = pFontArrus; | |
827 | 7511 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7512 if ( 352 - v48 < 8 ) |
7513 { | |
7514 v47 = pFontCreate; | |
827 | 7515 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7516 } |
7517 pRenderer->_4A6A68( | |
7518 8u, | |
7519 352 - v48, | |
7520 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7521 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7522 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
827 | 7523 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7524 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7525 } | |
0 | 7526 } |
7527 | |
7528 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7529 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7530 { |
832 | 7531 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7532 } |
7533 | |
7534 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7535 void sub_4B3A72( int a1 ) |
7536 { | |
7537 int num_buttons; // esi@1 | |
7538 | |
7539 num_buttons = 0; | |
0 | 7540 if ( a1 == 21 ) |
7541 { | |
473 | 7542 CreateButtonInColumn(0, 0x66u); |
7543 num_buttons = 2; | |
7544 CreateButtonInColumn(1, 0x67u); | |
7545 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7546 { | |
7547 num_buttons = 3; | |
7548 CreateButtonInColumn(2, 0x68u); | |
7549 } | |
7550 } | |
7551 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7552 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7553 } | |
7554 // F8B1E0: using guessed type int dword_F8B1E0; | |
7555 | |
7556 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7557 void sub_4B3AD4( signed int a1 ) |
7558 { | |
0 | 7559 if ( a1 > 0 ) |
7560 { | |
7561 if ( a1 <= 3 ) | |
7562 { | |
473 | 7563 CreateButtonInColumn(0, 3u); |
7564 CreateButtonInColumn(1, 4u); | |
7565 CreateButtonInColumn(2, 5u); | |
7566 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7567 } |
7568 if ( a1 == 4 ) | |
7569 { | |
473 | 7570 CreateButtonInColumn(0, 3u); |
7571 CreateButtonInColumn(1, 4u); | |
7572 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7573 } | |
7574 } | |
0 | 7575 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7576 } | |
7577 // F8B1E0: using guessed type int dword_F8B1E0; | |
7578 | |
7579 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7580 void sub_4B3B42( signed int a1 ) |
7581 { | |
0 | 7582 int v1; // ecx@18 |
7583 int v2; // ecx@19 | |
7584 int v3; // ecx@20 | |
7585 signed int v4; // esi@22 | |
7586 signed int v5; // eax@22 | |
7587 unsigned int v6; // edx@24 | |
7588 int v7; // ecx@24 | |
7589 int result; // eax@43 | |
7590 int v9; // [sp-10h] [bp-14h]@28 | |
7591 int v10; // [sp-Ch] [bp-10h]@28 | |
7592 int v11; // [sp-8h] [bp-Ch]@28 | |
7593 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7594 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7595 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7596 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7597 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7598 int v17; // [sp-4h] [bp-8h]@28 | |
7599 | |
7600 if ( a1 > 13 ) | |
7601 { | |
7602 if ( a1 > 22 ) | |
7603 { | |
7604 if ( a1 == 23 ) | |
7605 { | |
473 | 7606 CreateButtonInColumn(0, 0xAu); |
7607 CreateButtonInColumn(1, 0xBu); | |
0 | 7608 v14 = 96; |
7609 LABEL_41: | |
473 | 7610 CreateButtonInColumn(2, v14); |
0 | 7611 v17 = 2; |
7612 v11 = 0; | |
7613 v10 = 1; | |
7614 v9 = 3; | |
7615 goto LABEL_42; | |
7616 } | |
7617 if ( a1 <= 26 ) | |
7618 goto LABEL_43; | |
7619 if ( a1 > 28 ) | |
7620 { | |
7621 if ( a1 != 30 ) | |
7622 goto LABEL_43; | |
473 | 7623 CreateButtonInColumn(0, 0x11u); |
0 | 7624 v16 = 96; |
7625 goto LABEL_37; | |
7626 } | |
473 | 7627 CreateButtonInColumn(0, 0x69u); |
7628 CreateButtonInColumn(1, 0x6Au); | |
7629 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7630 v12 = 108; |
7631 } | |
7632 else | |
7633 { | |
7634 if ( a1 == 22 ) | |
7635 { | |
473 | 7636 CreateButtonInColumn(0, 7u); |
0 | 7637 v16 = 8; |
7638 goto LABEL_37; | |
7639 } | |
7640 v1 = a1 - 14; | |
7641 if ( !v1 ) | |
7642 { | |
473 | 7643 CreateButtonInColumn(0, 0x12u); |
7644 CreateButtonInColumn(1, 0x30u); | |
7645 CreateButtonInColumn(2, 0x31u); | |
7646 CreateButtonInColumn(3, 0x32u); | |
7647 CreateButtonInColumn(4, 0x33u); | |
0 | 7648 v17 = 2; |
7649 v11 = 0; | |
7650 v10 = 1; | |
7651 v9 = 5; | |
7652 goto LABEL_42; | |
7653 } | |
7654 v2 = v1 - 1; | |
7655 if ( v2 ) | |
7656 { | |
7657 v3 = v2 - 2; | |
7658 if ( v3 ) | |
7659 { | |
7660 if ( v3 != 4 ) | |
7661 goto LABEL_43; | |
473 | 7662 CreateButtonInColumn(0, 0xFu); |
7663 CreateButtonInColumn(1, 0x10u); | |
0 | 7664 v4 = 3; |
473 | 7665 CreateButtonInColumn(2, 0x60u); |
336 | 7666 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7667 if ( v5 < 108 || v5 > 120 ) |
7668 goto LABEL_28; | |
7669 v4 = 4; | |
7670 v6 = 101; | |
7671 v7 = 3; | |
7672 } | |
7673 else | |
7674 { | |
7675 v4 = 1; | |
473 | 7676 CreateButtonInColumn(0, 0x63u); |
0 | 7677 if ( !pParty->uFine ) |
7678 { | |
7679 LABEL_28: | |
7680 v17 = 2; | |
7681 v11 = 0; | |
7682 v10 = 1; | |
7683 v9 = v4; | |
7684 LABEL_42: | |
7685 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7686 goto LABEL_43; | |
7687 } | |
7688 v4 = 2; | |
7689 v7 = 1; | |
7690 v6 = 100; | |
7691 } | |
473 | 7692 CreateButtonInColumn(v7, v6); |
0 | 7693 goto LABEL_28; |
7694 } | |
473 | 7695 CreateButtonInColumn(0, 0x12u); |
7696 CreateButtonInColumn(1, 0x34u); | |
7697 CreateButtonInColumn(2, 0x35u); | |
0 | 7698 v12 = 54; |
7699 } | |
7700 LABEL_39: | |
473 | 7701 CreateButtonInColumn(3, v12); |
0 | 7702 v17 = 2; |
7703 v11 = 0; | |
7704 v10 = 1; | |
7705 v9 = 4; | |
7706 goto LABEL_42; | |
7707 } | |
7708 if ( a1 == 13 ) | |
7709 { | |
473 | 7710 CreateButtonInColumn(0, 0x12u); |
0 | 7711 v16 = 56; |
7712 LABEL_37: | |
473 | 7713 CreateButtonInColumn(1, v16); |
0 | 7714 v17 = 2; |
7715 v11 = 0; | |
7716 v10 = 1; | |
7717 v9 = 2; | |
7718 goto LABEL_42; | |
7719 } | |
7720 switch ( a1 ) | |
7721 { | |
7722 case 1: | |
7723 case 2: | |
7724 case 3: | |
7725 case 4: | |
473 | 7726 CreateButtonInColumn(0, 2u); |
7727 CreateButtonInColumn(1, 0x5Fu); | |
7728 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7729 v12 = 96; |
7730 goto LABEL_39; | |
7731 case 5: | |
473 | 7732 CreateButtonInColumn(0, 0x12u); |
0 | 7733 v13 = 48; |
7734 goto LABEL_9; | |
7735 case 6: | |
473 | 7736 CreateButtonInColumn(0, 0x12u); |
0 | 7737 v13 = 49; |
7738 goto LABEL_9; | |
7739 case 7: | |
473 | 7740 CreateButtonInColumn(0, 0x12u); |
0 | 7741 v13 = 50; |
7742 goto LABEL_9; | |
7743 case 8: | |
473 | 7744 CreateButtonInColumn(0, 0x12u); |
0 | 7745 v13 = 51; |
7746 LABEL_9: | |
473 | 7747 CreateButtonInColumn(1, v13); |
0 | 7748 v14 = 72; |
7749 goto LABEL_41; | |
7750 case 9: | |
473 | 7751 CreateButtonInColumn(0, 0x12u); |
0 | 7752 v15 = 52; |
7753 goto LABEL_13; | |
7754 case 10: | |
473 | 7755 CreateButtonInColumn(0, 0x12u); |
0 | 7756 v15 = 53; |
7757 goto LABEL_13; | |
7758 case 11: | |
473 | 7759 CreateButtonInColumn(0, 0x12u); |
0 | 7760 v15 = 54; |
7761 LABEL_13: | |
473 | 7762 CreateButtonInColumn(1, v15); |
0 | 7763 v14 = 61; |
7764 goto LABEL_41; | |
7765 case 12: | |
473 | 7766 CreateButtonInColumn(0, 0x12u); |
0 | 7767 v16 = 55; |
7768 goto LABEL_37; | |
7769 default: | |
7770 break; | |
7771 } | |
7772 LABEL_43: | |
7773 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7774 } | |
7775 // F8B1E0: using guessed type int dword_F8B1E0; | |
7776 | |
7777 //----- (004B3E1E) -------------------------------------------------------- | |
7778 void __cdecl sub_4B3E1E() | |
7779 { | |
7780 NPCData *v0; // ST40_4@1 | |
7781 signed int v1; // edi@1 | |
165 | 7782 //GUIWindow *v2; // ecx@1 |
0 | 7783 |
167 | 7784 __debugbreak(); |
602 | 7785 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7786 v1 = 0; |
7787 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7788 pDialogueWindow->Release(); | |
165 | 7789 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7790 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7791 { |
832 | 7792 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7793 v1 = 1; |
7794 } | |
832 | 7795 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7796 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7797 } | |
7798 | |
7799 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7800 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7801 { |
467 | 7802 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7803 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7804 ContractSelectText(pEventCode); |
0 | 7805 pDialogueWindow->Release(); |
492 | 7806 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
832 | 7807 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], // Cancel |
7808 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
7809 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7810 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
0 | 7811 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7812 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7813 } |
7814 // F8B19C: using guessed type int dword_F8B19C; | |
7815 | |
7816 //----- (004B3FE5) -------------------------------------------------------- | |
7817 void __fastcall sub_4B3FE5(int a4) | |
7818 { | |
7819 int v1; // edi@1 | |
7820 char *v2; // edi@1 | |
7821 | |
7822 v1 = a4; | |
7823 uDialogueType = 78; | |
827 | 7824 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7825 _4B254D_SkillMasteryTeacher(a4); |
7826 pDialogueWindow->Release(); | |
7827 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7828 v2 = ""; | |
832 | 7829 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7830 pGlobalTXT_LocalizationStrings[34], |
526 | 7831 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7832 0); |
832 | 7833 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7834 if ( contract_approved ) |
0 | 7835 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7836 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
0 | 7837 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7838 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7839 } |
7840 // F8B19C: using guessed type int dword_F8B19C; | |
7841 // F8B1A8: using guessed type int dword_F8B1A8; | |
7842 | |
7843 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7844 void NPCHireableDialogPrepare() |
7845 { | |
0 | 7846 signed int v0; // ebx@1 |
7847 NPCData *v1; // edi@1 | |
7848 | |
7849 v0 = 0; | |
459 | 7850 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7851 pDialogueWindow->Release(); |
7852 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7853 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7854 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
526 | 7855 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7856 0); |
832 | 7857 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7858 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7859 { |
832 | 7860 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7861 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7862 v0 = 1; |
7863 } | |
832 | 7864 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7865 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
0 | 7866 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7867 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7868 } |
7869 | |
7870 //----- (004B4224) -------------------------------------------------------- | |
423 | 7871 void _4B4224_UpdateNPCTopics( int _this ) |
7872 { | |
7873 int num_menu_buttons; // ebx@1 | |
0 | 7874 int i; // ebp@5 |
423 | 7875 // signed int v4; // ebp@9 |
7876 int v6; // eax@16 | |
7877 int v8; // eax@21 | |
7878 int v10; // eax@26 | |
7879 int v12; // eax@31 | |
7880 int v14; // eax@36 | |
7881 int v16; // eax@41 | |
0 | 7882 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7883 | |
423 | 7884 num_menu_buttons = 0; |
459 | 7885 pDialogueNPCCount = (_this + 1); |
0 | 7886 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7887 { | |
7888 pDialogueWindow->Release(); | |
7889 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7890 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
832 | 7891 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0x4Eu, |
0 | 7892 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7893 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
832 | 7894 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, UIMSG_BF, 1u, 0x59u, |
423 | 7895 sHouseName, |
7896 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
832 | 7897 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
7898 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, UIMSG_BF, 1u, 0x59u, sHouseName, 0); | |
0 | 7899 } |
7900 else | |
7901 { | |
459 | 7902 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7903 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7904 { |
7905 pDialogueWindow->Release(); | |
7906 } | |
7907 else | |
7908 { | |
7909 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7910 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7911 } |
7912 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7913 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7914 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 7915 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
832 | 7916 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7917 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7918 { |
484 | 7919 sub_4B3B42(in_current_building_type); |
0 | 7920 } |
7921 else | |
7922 { | |
7923 if ( v17->joins ) | |
7924 { | |
423 | 7925 num_menu_buttons = 1; |
858 | 7926 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7927 } |
423 | 7928 if ( v17->evt_A) |
7929 { | |
7930 if ( num_menu_buttons < 4 ) | |
7931 { | |
7932 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7933 if ( v6 == 1 || v6 == 2 ) |
832 | 7934 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7935 } |
7936 } | |
7937 if ( v17->evt_B ) | |
7938 { | |
7939 if ( num_menu_buttons < 4 ) | |
7940 { | |
7941 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7942 if ( v8 == 1 || v8 == 2 ) |
832 | 7943 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7944 } |
7945 } | |
7946 if ( v17->evt_C ) | |
7947 { | |
7948 if ( num_menu_buttons < 4 ) | |
7949 { | |
7950 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7951 if ( v10 == 1 || v10 == 2 ) |
832 | 7952 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7953 } |
7954 } | |
7955 | |
7956 if ( v17->evt_D ) | |
7957 { | |
7958 if ( num_menu_buttons < 4 ) | |
7959 { | |
7960 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7961 if ( v12 == 1 || v12 == 2 ) |
832 | 7962 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7963 } |
7964 } | |
7965 if ( v17->evt_E ) | |
7966 { | |
7967 if ( num_menu_buttons < 4 ) | |
7968 { | |
7969 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7970 if ( v14 == 1 || v14 == 2 ) |
832 | 7971 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7972 } |
7973 } | |
7974 if ( v17->evt_F ) | |
7975 { | |
7976 if ( num_menu_buttons < 4 ) | |
7977 { | |
7978 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7979 if ( v16 == 1 || v16 == 2 ) |
832 | 7980 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7981 } |
7982 } | |
7983 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 7984 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7985 } | |
747 | 7986 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7987 } |
7988 | |
0 | 7989 } |
7990 | |
7991 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7992 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7993 { |
0 | 7994 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7995 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7996 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7997 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 7998 } |
7999 | |
8000 //----- (004B46F8) -------------------------------------------------------- | |
8001 int __fastcall sub_4B46F8(int a1) | |
8002 { | |
8003 int v1; // eax@1 | |
8004 int i; // edx@1 | |
8005 | |
8006 v1 = 0; | |
8007 for ( i = 0; i < a1; ++i ) | |
8008 v1 += i + 1; | |
8009 return 1000 * v1; | |
8010 } | |
8011 | |
8012 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8013 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8014 { |
656 | 8015 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8016 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8017 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8018 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8019 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8020 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8021 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8022 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8023 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8024 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8025 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8026 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8027 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8028 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8029 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8030 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8031 //v1 = _this; |
656 | 8032 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8033 //v3 = v1; |
656 | 8034 uDialogueType = newDialogueType; |
8035 if (!speakingNPC->uFlags) | |
8036 { | |
8037 speakingNPC->uFlags = 1; | |
8038 //v3 = uDialogueType; | |
8039 } | |
8040 | |
8041 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8042 { | |
8043 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8044 } | |
8045 else if(newDialogueType == DIALOGUE_76) | |
8046 { | |
8047 if (speakingNPC->Hired()) | |
8048 { | |
8049 v8 = 0; | |
8050 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8051 { | |
8052 v6 = (char *)pNPCStats->pNewNPCData; | |
8053 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8054 { | |
8055 ++v8; | |
8056 v6 += 76; | |
8057 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8058 break; | |
8059 } | |
8060 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8061 v6[8] &= 0x7Fu; | |
8062 } | |
8063 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8064 { | |
8065 v11 = pParty->pHirelings; | |
8066 memset(v11, 0, sizeof(NPCData)); | |
8067 } | |
8068 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8069 { | |
8070 v11 = &pParty->pHirelings[1]; | |
8071 memset(v11, 0, sizeof(NPCData)); | |
8072 } | |
8073 pParty->field_709 = 0; | |
659 | 8074 Party__CountHirelings(); |
656 | 8075 dword_591084 = 0; |
8076 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8077 dword_7241C8 = 0; | |
8078 return; | |
8079 } | |
8080 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8081 { | |
8082 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8083 ShowStatusBarString(v7, 2u); | |
8084 } | |
8085 else | |
8086 { | |
8087 //v9 = v2->uProfession; | |
8088 if ( speakingNPC->uProfession != 51 ) | |
8089 { | |
8090 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8091 if ( pParty->uNumGold < v10 ) | |
8092 { | |
8093 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8094 dialogue_show_profession_details = false; | |
8095 uDialogueType = 13; | |
8096 if ( uActiveCharacter ) | |
8097 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8098 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8099 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8100 if ( !dword_7241C8 ) | |
8101 pGame->Draw(); | |
8102 dword_7241C8 = 0; | |
8103 return; | |
8104 } | |
8105 Party::TakeGold(v10); | |
8106 } | |
8107 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8108 if ( pParty->pHirelings[0].pName ) | |
8109 { | |
8110 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8111 v15 = speakingNPC->pName; | |
8112 v13 = pParty->pHireling2Name; | |
8113 } | |
8114 else | |
8115 { | |
8116 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8117 v15 = speakingNPC->pName; | |
8118 v13 = pParty->pHireling1Name; | |
8119 } | |
8120 strcpy(v13, v15); | |
8121 pParty->field_709 = 0; | |
659 | 8122 Party__CountHirelings(); |
656 | 8123 |
8124 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8125 | |
711 | 8126 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8127 pDialogue_SpeakingActor->uAIState = Removed; |
8128 if ( uActiveCharacter ) | |
8129 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8130 } | |
8131 } | |
8132 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8133 { | |
8134 ArenaFight(); | |
8135 return; | |
8136 } | |
8137 else if(newDialogueType == DIALOGUE_9) | |
8138 { | |
8139 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8140 { | |
8141 if ( speakingNPC->uProfession != 41 ) | |
8142 speakingNPC->bHasUsedTheAbility = 1; | |
8143 | |
8144 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8145 } | |
8146 else | |
8147 { | |
8148 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8149 } | |
8150 } | |
8151 else if(newDialogueType == DIALOGUE_13) | |
8152 { | |
8153 if (!speakingNPC->Hired()) | |
8154 { | |
8155 sub_4B3E1E(); | |
8156 dialogue_show_profession_details = false; | |
8157 } | |
8158 else | |
8159 { | |
8160 v5 = 0; | |
8161 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8162 { | |
8163 v6 = (char *)pNPCStats->pNewNPCData; | |
8164 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8165 { | |
8166 ++v5; | |
8167 v6 += 76; | |
8168 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8169 break; | |
8170 } | |
8171 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8172 v6[8] &= 0x7Fu; | |
8173 } | |
8174 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8175 { | |
8176 v11 = pParty->pHirelings; | |
8177 memset(v11, 0, sizeof(NPCData)); | |
8178 } | |
8179 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8180 { | |
8181 v11 = &pParty->pHirelings[1]; | |
8182 memset(v11, 0, sizeof(NPCData)); | |
8183 } | |
8184 pParty->field_709 = 0; | |
659 | 8185 Party__CountHirelings(); |
656 | 8186 dword_591084 = 0; |
8187 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8188 dword_7241C8 = 0; | |
8189 return; | |
8190 } | |
8191 } | |
8192 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8193 { | |
8194 switch(newDialogueType) | |
8195 { | |
8196 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8197 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8198 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8199 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8200 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8201 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8202 } | |
8203 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8204 sub_4B3FE5(npc_event_id); //200-310 | |
8205 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8206 { //400-410 | |
8207 dword_F8B1D8 = newDialogueType; | |
8208 DrawJoinGuildWindow(npc_event_id - 400); | |
8209 } | |
8210 else | |
8211 { | |
8212 switch ( npc_event_id ) | |
8213 { | |
8214 case 139: | |
8215 sub_4B1ECE(); | |
8216 break; | |
8217 case 311: | |
8218 sub_4BBA85_bounties(); | |
8219 break; | |
8220 case 399: | |
8221 sub_4BBCDD(); | |
8222 break; | |
8223 default: | |
8224 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8225 current_npc_text = 0; |
656 | 8226 EventProcessor(npc_event_id, 0, 1); |
8227 activeLevelDecoration = NULL; | |
8228 break; | |
8229 } | |
8230 } | |
8231 } | |
8232 if ( !dword_7241C8 ) | |
8233 pGame->Draw(); | |
8234 dword_7241C8 = 0; | |
8235 } | |
0 | 8236 |
8237 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8238 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8239 { |
8240 int v6; // edx@8 | |
8241 int v7; // edx@9 | |
8242 int v8; // edx@10 | |
8243 unsigned __int8 v9; // zf@16 | |
8244 char v10; // sf@16 | |
8245 unsigned __int8 v11; // of@16 | |
702 | 8246 bool test; |
0 | 8247 |
907 | 8248 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8249 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8250 return 0; |
907 | 8251 switch( p2DEvents[_2da_idx - 1].uType ) |
8252 { | |
8253 case BildingType_WeaponShop: | |
8254 { | |
8255 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8256 break; | |
8257 } | |
8258 case BildingType_ArmorShop: | |
8259 { | |
8260 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8261 break; | |
8262 } | |
8263 case BildingType_MagicShop: | |
8264 { | |
8265 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8266 break; | |
8267 } | |
8268 case BildingType_AlchemistShop: | |
8269 { | |
8270 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8271 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8272 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8273 break; | |
8274 } | |
8275 default: | |
8276 { | |
8277 test = false; | |
8278 break; | |
8279 } | |
8280 } | |
702 | 8281 return test; |
8282 /* | |
8283 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8284 { |
8285 v11 = __OFSUB__(v5, 2); | |
8286 v9 = v5 == 2; | |
8287 v10 = v5 - 2 < 0; | |
8288 goto LABEL_23; | |
8289 } | |
702 | 8290 if ( p2DEvents[a2 - 1].uType > 2 ) |
8291 { | |
8292 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8293 { |
8294 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8295 return v5 == 16; | |
8296 return 1; | |
8297 } | |
702 | 8298 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8299 return 0; |
702 | 8300 if ( p2DEvents[a2 - 1].uType == 4) |
8301 { | |
8302 if ( v5 < 13 ) | |
8303 return 0; | |
8304 if ( v5 <= 14 ) | |
8305 return 1; | |
8306 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8307 return 0; | |
8308 v11 = __OFSUB__(v3, 771); | |
8309 v9 = v3 == 771; | |
8310 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8311 LABEL_23: |
702 | 8312 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8313 return 0; | |
8314 return 1; | |
8315 } | |
8316 } | |
8317 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8318 { | |
8319 if ( v5 >= 3 ) | |
8320 { | |
8321 v11 = __OFSUB__(v5, 9); | |
8322 v9 = v5 == 9; | |
8323 v10 = v5 - 9 < 0; | |
8324 goto LABEL_23; | |
8325 } | |
0 | 8326 } |
8327 return 0; | |
702 | 8328 */ |
0 | 8329 } |
8330 | |
8331 //----- (004B6478) -------------------------------------------------------- | |
711 | 8332 void sub_4B6478() |
8333 { | |
0 | 8334 GUIWindow *v0; // ebx@1 |
8335 Player *v1; // edi@1 | |
8336 unsigned int v2; // eax@1 | |
8337 signed int v3; // esi@1 | |
8338 int v4; // ebx@1 | |
8339 unsigned int v5; // esi@5 | |
8340 int v6; // edi@6 | |
8341 int result; // eax@13 | |
8342 GUIWindow *v8; // ebx@17 | |
8343 int v9; // eax@17 | |
8344 int v10; // ecx@17 | |
8345 unsigned int v11; // ecx@18 | |
8346 int v12; // eax@20 | |
8347 int v13; // eax@21 | |
8348 GUIButton *v14; // esi@27 | |
8349 int v15; // ecx@27 | |
8350 unsigned int v16; // eax@28 | |
8351 const char *v17; // ebx@29 | |
8352 int v18; // eax@29 | |
8353 unsigned int v19; // ecx@29 | |
8354 int v20; // eax@29 | |
8355 unsigned __int16 v21; // ax@29 | |
8356 unsigned __int16 v22; // ST14_2@36 | |
8357 int v23; // eax@36 | |
8358 const char *v24; // ST18_4@37 | |
8359 unsigned __int16 v25; // ST14_2@37 | |
8360 int v26; // eax@37 | |
8361 int v27; // [sp-4h] [bp-80h]@8 | |
8362 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8363 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8364 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8365 int v31; // [sp+68h] [bp-14h]@1 | |
8366 int v32; // [sp+6Ch] [bp-10h]@1 | |
8367 int v33; // [sp+70h] [bp-Ch]@17 | |
8368 int v34; // [sp+74h] [bp-8h]@17 | |
8369 int v35; // [sp+78h] [bp-4h]@17 | |
8370 | |
336 | 8371 v0 = window_SpeakInHouse; |
8372 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8373 v1 = pPlayers[uActiveCharacter]; |
8374 v28.uFrameX = 483; | |
8375 v28.uFrameWidth = 148; | |
8376 v28.uFrameZ = 334; | |
8377 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8378 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8379 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8380 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8381 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8382 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8383 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8384 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8385 v32 = v4; | |
8386 if ( v4 < v3 / 3 ) | |
8387 { | |
8388 v4 = v3 / 3; | |
8389 v32 = v3 / 3; | |
8390 } | |
749 | 8391 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8392 { |
8393 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8394 { | |
8395 v5 = 0; | |
8396 | |
8397 __debugbreak(); | |
8398 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8399 // or | |
8400 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8401 // or | |
8402 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8403 __debugbreak(); // whacky condition - fix |
0 | 8404 if (false |
8405 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8406 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8407 { |
8408 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8409 } | |
8410 else | |
8411 { | |
8412 if ( pParty->uNumGold < v4 ) | |
8413 { | |
8414 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8415 v27 = 4; | |
8416 } | |
8417 else | |
8418 { | |
8419 Party::TakeGold(v4); | |
8420 *(short *)v6 = 1; | |
8421 v27 = 2; | |
8422 } | |
735 | 8423 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8424 } |
8425 } | |
8426 else | |
8427 { | |
8428 v5 = 0; | |
8429 } | |
437 | 8430 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8431 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8432 { | |
8433 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8434 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8435 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8436 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8437 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8438 }*/ |
8439 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8440 return; // void func |
0 | 8441 } |
484 | 8442 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8443 { |
8444 v24 = pNPCTopics[171].pText; | |
8445 v25 = v31; | |
8446 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8447 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8448 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8449 return ; |
8450 } | |
8451 | |
8452 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8453 return; | |
0 | 8454 v8 = pDialogueWindow; |
8455 v33 = 0; | |
8456 v34 = 0; | |
8457 v29 = pDialogueWindow; | |
8458 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8459 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8460 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8461 if ( v9 >= v10 ) | |
8462 goto LABEL_40; | |
8463 do | |
8464 { | |
832 | 8465 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8466 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8467 { |
8468 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8469 v33 += v12; | |
8470 ++v34; | |
8471 } | |
8472 v13 = v8->pStartingPosActiveItem; | |
8473 ++v35; | |
8474 } | |
8475 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8476 if ( !v34 ) | |
8477 { | |
8478 LABEL_40: | |
135 | 8479 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8480 strcat(pTmpBuf, "\n \n"); |
8481 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8482 v22 = v31; | |
8483 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8484 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8485 return; | |
0 | 8486 } |
8487 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8488 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8489 v32 = (149 - v33) / v34; | |
8490 if ( (149 - v33) / v34 > 32 ) | |
8491 v32 = 32; | |
711 | 8492 |
8493 v35 = v8->pStartingPosActiveItem; | |
0 | 8494 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8495 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8496 { |
8497 v33 = 2; | |
8498 do | |
8499 { | |
8500 v14 = v8->GetControl(v35); | |
832 | 8501 v15 = v14->msg_param - 36; |
135 | 8502 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8503 { |
8504 v16 = 0; | |
8505 if ( !v1->pActiveSkills[v15] ) | |
8506 { | |
8507 v17 = pSkillNames[v15]; | |
8508 v14->uY = v32 + v34; | |
8509 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8510 v19 = v14->uY; | |
8511 v14->uHeight = v18; | |
8512 v20 = v19 + v18 - 1; | |
8513 v14->uW = v20; | |
8514 v34 = v20; | |
8515 v21 = v31; | |
8516 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8517 v21 = v30; | |
8518 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8519 goto LABEL_34; | |
8520 } | |
8521 } | |
8522 else | |
8523 { | |
8524 v16 = 0; | |
8525 } | |
8526 v14->uW = v16; | |
8527 v14->uHeight = v16; | |
8528 v14->uY = v16; | |
8529 LABEL_34: | |
8530 v8 = v29; | |
8531 ++v35; | |
8532 ++v33; | |
711 | 8533 } |
8534 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8535 } | |
8536 return; | |
0 | 8537 } |
8538 | |
8539 //----- (00405CFF) -------------------------------------------------------- | |
8540 void stru262_TurnBased::End(bool bPlaySound) | |
8541 { | |
8542 stru262_TurnBased *v2; // edi@1 | |
8543 int v3; // ebx@1 | |
8544 int v4; // esi@1 | |
8545 unsigned __int8 v5; // zf@1 | |
8546 unsigned __int8 v6; // sf@1 | |
8547 TurnBased_QueueElem *v7; // ecx@2 | |
8548 unsigned __int16 *pAttributes; // ecx@7 | |
8549 size_t v9; // edx@7 | |
8550 unsigned __int16 v10; // ax@8 | |
8551 TurnBased_QueueElem *v11; // ebx@12 | |
8552 ObjectType objType; // eax@13 | |
8553 int objID; // esi@13 | |
8554 int v14; // [sp+Ch] [bp-4h]@11 | |
8555 | |
8556 v2 = this; | |
8557 v3 = 0; | |
8558 v4 = 0; | |
8559 v5 = this->uActorQueueSize == 0; | |
8560 v6 = this->uActorQueueSize < 0; | |
8561 this->field_4 = 0; | |
8562 if ( !(v6 | v5) ) | |
8563 { | |
8564 v7 = this->pQueue; | |
8565 do | |
8566 { | |
848 | 8567 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8568 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8569 ++v4; |
8570 ++v7; | |
8571 } | |
8572 while ( v4 < v2->uActorQueueSize ); | |
8573 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8574 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8575 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8576 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8577 v9 = uNumSpriteObjects; |
0 | 8578 do |
8579 { | |
8580 v10 = *pAttributes; | |
8581 if ( *pAttributes & 4 ) | |
8582 { | |
8583 LOBYTE(v10) = v10 & 0xFB; | |
8584 *pAttributes = v10; | |
8585 } | |
8586 pAttributes += 56; | |
8587 --v9; | |
8588 } | |
8589 while ( v9 ); | |
8590 } | |
8591 v14 = 0; | |
8592 if ( v2->uActorQueueSize > 0 ) | |
8593 { | |
8594 v11 = v2->pQueue; | |
8595 do | |
8596 { | |
848 | 8597 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8598 objID = PID_ID(v11->uPackedID); | |
0 | 8599 if ( objType == OBJECT_Player ) |
8600 { | |
8601 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8602 } | |
8603 else | |
8604 { | |
8605 if ( objType == OBJECT_Actor ) | |
8606 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8607 } | |
8608 ++v14; | |
8609 ++v11; | |
8610 } | |
8611 while ( v14 < v2->uActorQueueSize ); | |
8612 v3 = 0; | |
8613 } | |
8614 pAudioPlayer->StopChannels(-1, -1); | |
8615 if ( bPlaySound != v3 ) | |
8616 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8617 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8618 pEventTimer->StopGameTime(); | |
8619 dword_50C994 = v3; | |
8620 dword_50C998_turnbased_icon_1A = v3; | |
8621 } | |
8622 // 50C994: using guessed type int dword_50C994; | |
8623 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8624 | |
8625 //----- (00405E14) -------------------------------------------------------- | |
8626 void stru262_TurnBased::_405E14() | |
8627 { | |
8628 stru262_TurnBased *v1; // esi@1 | |
8629 int v2; // ecx@1 | |
8630 SpellBuff *v3; // edi@2 | |
8631 Actor *v4; // ebx@3 | |
8632 signed int v5; // edx@20 | |
8633 AIDirection *v6; // esi@21 | |
8634 int v7; // eax@21 | |
8635 int v8; // eax@21 | |
8636 int v9; // eax@22 | |
8637 int v10; // eax@23 | |
8638 int v11; // eax@37 | |
8639 int v12; // eax@44 | |
8640 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8641 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8642 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8643 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8644 int v17; // [sp+5Ch] [bp-10h]@6 |
8645 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8646 int v19; // [sp+64h] [bp-8h]@8 | |
8647 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8648 | |
8649 v1 = this; | |
8650 v2 = 0; | |
8651 v18 = v1; | |
8652 v20 = 0; | |
8653 if ( (signed int)uNumActors > 0 ) | |
8654 { | |
90 | 8655 //v3 = pActors;//[0].pActorBuffs; |
8656 v16 = pActors;//[0].pActorBuffs; | |
8657 v3 = v16->pActorBuffs; | |
0 | 8658 do |
8659 { | |
90 | 8660 v4 = v16; |
8661 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8662 v17 = v2; |
8663 else | |
8664 v17 = 1; | |
8665 v19 = v2; | |
8666 do | |
8667 { | |
8668 if ( v19 != 10 ) | |
8669 { | |
8670 v3->_4585CA(pParty->uTimePlayed); | |
8671 v2 = 0; | |
8672 } | |
8673 ++v19; | |
8674 ++v3; | |
8675 } | |
8676 while ( v19 < 22 ); | |
8677 if ( v17 != v2 | |
8678 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8679 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8680 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8681 if ( !(v4->uAttributes & 0x80) ) | |
8682 { | |
8683 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8684 { | |
8685 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8686 { | |
8687 v5 = v4->uCurrentActionLength; | |
8688 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8689 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8690 { | |
417 | 8691 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8692 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8693 v7 = v4->uAIState; |
8694 memcpy(&v15, v6, sizeof(v15)); | |
8695 v8 = v7 - 4; | |
8696 memcpy(&v14, &v15, sizeof(v14)); | |
8697 if ( v8 ) | |
8698 { | |
8699 v9 = v8 - 1; | |
8700 if ( v9 ) | |
8701 { | |
8702 v10 = v9 - 6; | |
8703 if ( v10 ) | |
8704 { | |
8705 if ( v10 != 8 ) | |
414 | 8706 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8707 } |
8708 } | |
8709 } | |
8710 else | |
8711 { | |
8712 v4->uCurrentActionTime = 0; | |
8713 v4->uCurrentActionLength = 0; | |
8714 v4->uAIState = Dead; | |
8715 v4->UpdateAnimation(); | |
8716 } | |
8717 v1 = v18; | |
8718 v2 = 0; | |
8719 } | |
8720 } | |
8721 } | |
8722 } | |
8723 ++v20; | |
90 | 8724 v3 = v16[1].pActorBuffs; |
8725 ++v16; | |
0 | 8726 } |
8727 while ( (signed int)v20 < (signed int)uNumActors ); | |
8728 } | |
8729 if ( v1->field_4 == 1 ) | |
8730 { | |
8731 v12 = v1->field_8; | |
8732 if ( v12 == 64 ) | |
8733 { | |
8734 v1->_406A63(); | |
8735 } | |
8736 else | |
8737 { | |
8738 if ( v12 > v2 ) | |
8739 { | |
8740 v1->_406B9F(); | |
8741 } | |
8742 else | |
8743 { | |
8744 v1->_406AFE(); | |
8745 v1->field_10 = 100; | |
8746 } | |
8747 } | |
8748 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8749 return; | |
8750 } | |
8751 if ( v1->field_4 == 2 ) | |
8752 { | |
8753 if ( !(v1->field_18 & 1) ) | |
8754 { | |
8755 v11 = v1->field_10; | |
8756 if ( v11 == 100 ) | |
8757 { | |
8758 v1->StartTurn(); | |
8759 LABEL_39: | |
8760 v1->_40652A(); | |
8761 return; | |
8762 } | |
8763 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8764 { | |
8765 v1->_4065B0(); | |
8766 goto LABEL_39; | |
8767 } | |
8768 } | |
8769 v1->NextTurn(); | |
8770 return; | |
8771 } | |
8772 if ( v1->field_4 == 3 ) | |
8773 { | |
8774 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8775 { | |
8776 v1->field_18 &= 0xFFFFFFF7u; | |
8777 v1->field_4 = 1; | |
8778 v1->field_8 = 64; | |
8779 } | |
8780 else | |
8781 { | |
8782 v1->_406FA8(); | |
8783 } | |
8784 } | |
8785 } | |
8786 | |
8787 //----- (0043FDED) -------------------------------------------------------- | |
8788 void PrepareActorRenderList_BLV() | |
8789 { | |
8790 RenderBillboard *v0; // esi@0 | |
8791 unsigned __int16 v3; // ax@3 | |
8792 unsigned int v4; // eax@5 | |
8793 unsigned __int16 v5; // cx@5 | |
8794 int v6; // esi@5 | |
8795 unsigned int v7; // eax@7 | |
8796 int v8; // eax@10 | |
8797 SpriteFrame *v9; // eax@16 | |
8798 SpriteFrame *v10; // ebx@18 | |
8799 //int *v11; // eax@18 | |
8800 int v12; // ecx@28 | |
8801 //IndoorCameraD3D **v14; // eax@36 | |
8802 double v15; // st7@36 | |
8803 float v16; // eax@36 | |
8804 //double v17; // ST30_8@36 | |
8805 signed __int64 v18; // qtt@36 | |
8806 int v19; // ST5C_4@36 | |
8807 signed __int64 v20; // qtt@37 | |
8808 int v21; // ST5C_4@37 | |
8809 signed __int16 v22; // cx@39 | |
8810 int v23; // ST50_4@40 | |
8811 signed int v24; // ecx@40 | |
8812 int v25; // edx@44 | |
8813 __int16 v26; // ax@44 | |
8814 //MonsterDesc *v27; // edx@44 | |
8815 //int v28; // ecx@44 | |
8816 unsigned __int8 v29; // zf@44 | |
8817 unsigned __int8 v30; // sf@44 | |
8818 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8819 int v32; // [sp+1Ch] [bp-38h]@5 | |
8820 int a3; // [sp+20h] [bp-34h]@5 | |
8821 int a2; // [sp+24h] [bp-30h]@5 | |
8822 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8823 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8824 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8825 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8826 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8827 int a6; // [sp+40h] [bp-14h]@34 | |
8828 int v43; // [sp+44h] [bp-10h]@34 | |
8829 int z; // [sp+48h] [bp-Ch]@32 | |
8830 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8831 int x; // [sp+50h] [bp-4h]@32 | |
8832 | |
8833 for (uint i = 0; i < uNumActors; ++i) | |
8834 { | |
8835 auto p = pActors + i; | |
8836 | |
8837 if (p->uAIState == Removed || | |
8838 p->uAIState == Disabled) | |
8839 continue; | |
8840 | |
8841 a5 = p->uSectorID; | |
8842 a2 = p->vPosition.y; | |
8843 a1a = p->vPosition.x; | |
8844 a3 = p->vPosition.z; | |
8845 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8846 LOWORD(v0) = p->uYawAngle; | |
8847 v5 = p->uCurrentActionAnimation; | |
8848 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8849 v32 = v6; | |
8850 if ( pParty->bTurnBasedModeOn ) | |
8851 { | |
8852 if ( v5 == 1 ) | |
8853 { | |
8854 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8855 goto LABEL_10; | |
8856 } | |
8857 } | |
8858 else | |
8859 { | |
8860 if ( v5 == 1 ) | |
8861 { | |
8862 v7 = pBLVRenderParams->field_0_timer_; | |
8863 LABEL_10: | |
8864 v8 = i * 32 + v7; | |
8865 goto LABEL_12; | |
8866 } | |
8867 } | |
8868 v8 = p->uCurrentActionTime; | |
8869 LABEL_12: | |
8870 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8871 v8 = 0; | |
8872 v31 = p->pSpriteIDs[v5]; | |
8873 if (p->uAIState == Resurrected) | |
8874 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8875 else | |
8876 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8877 v41 = 0; | |
8878 v10 = v9; | |
8879 //v11 = (int *)v9->uFlags; | |
8880 if (v9->uFlags & 2) | |
8881 v41 = 2; | |
8882 if (v9->uFlags & 0x40000) | |
8883 v41 |= 0x40u; | |
8884 if (v9->uFlags & 0x20000) | |
8885 LOBYTE(v41) = v41 | 0x80; | |
8886 v0 = (RenderBillboard *)(256 << v6); | |
8887 if ( (unsigned int)v0 & v9->uFlags) | |
8888 v41 |= 4u; | |
8889 if ( v10->uGlowRadius ) | |
8890 { | |
8891 //LOBYTE(v11) = byte_4E94D3; | |
8892 pMobileLightsStack->AddLight( | |
8893 a1a, | |
8894 a2, | |
8895 a3, | |
8896 a5, | |
8897 v10->uGlowRadius, | |
8898 0xFFu, | |
8899 0xFFu, | |
8900 0xFFu, | |
8901 byte_4E94D3); | |
8902 } | |
8903 v12 = 0; | |
8904 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8905 continue; | |
8906 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8907 { | |
8908 ++v12; | |
8909 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8910 goto _continue; | |
8911 } | |
8912 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8913 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8914 continue; | |
8915 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8916 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8917 if (uNumBillboardsToDraw >= 500) | |
8918 break; | |
8919 ++uNumBillboardsToDraw; | |
8920 ++uNumSpritesDrawnThisFrame; | |
8921 p->uAttributes |= 8u; | |
8922 v29 = pRenderer->pRenderD3D == 0; | |
8923 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8924 v0->uPalette = v10->uPaletteIndex; | |
8925 v0->uIndoorSectorID = a5; | |
8926 if ( v29 ) | |
8927 { | |
8928 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8929 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8930 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8931 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8932 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8933 } | |
8934 else | |
8935 { | |
8936 //v14 = &pGame->pIndoorCameraD3D; | |
8937 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8938 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8939 v16 = v0->fov_x; | |
8940 v0->fov_y = v15; | |
8941 //v17 = v16 + 6.7553994e15; | |
8942 LODWORD(v18) = 0; | |
8943 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8944 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8945 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8946 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8947 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8948 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8949 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8950 { | |
8951 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8952 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8953 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8954 goto LABEL_43; |
8955 } | |
8956 } | |
8957 else | |
8958 { | |
8959 v22 = p->pActorBuffs[3].uPower; | |
8960 if ( v22 ) | |
8961 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8962 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8963 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8964 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8965 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8966 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8967 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8968 goto LABEL_44; |
8969 } | |
8970 } | |
8971 LABEL_44: | |
8972 HIWORD(v25) = HIWORD(x); | |
430 | 8973 v0->world_x = a1a; |
8974 v0->world_y = a2; | |
8975 v0->world_z = a3; | |
0 | 8976 v0->uScreenSpaceX = v43; |
8977 v0->uScreenSpaceY = a6; | |
8978 LOWORD(v25) = 0; | |
8979 LOBYTE(v26) = v41; | |
194 | 8980 |
862 | 8981 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8982 v0->actual_z = HIWORD(x); |
862 | 8983 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8984 |
0 | 8985 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8986 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8987 v0->field_1E = v41; | |
8988 v0->pSpriteFrame = v10; | |
8989 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8990 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8991 { | |
8992 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8993 v0->field_1E = v26; | |
8994 } | |
8995 | |
8996 _continue: | |
8997 ; | |
8998 } | |
8999 } | |
9000 | |
9001 //----- (00444732) -------------------------------------------------------- | |
428 | 9002 char *GetEventHintString(unsigned int uEventID) |
9003 { | |
9004 signed int event_index; // edx@1 | |
9005 int event_pos; // esi@4 | |
0 | 9006 char *result; // eax@6 |
428 | 9007 unsigned int str_index; // eax@9 |
9008 int i; // esi@11 | |
9009 _evt_raw* test_evt; | |
9010 _evt_raw* last_evt; | |
9011 | |
9012 event_index = 0; | |
9013 if ( uLevelEVT_NumEvents <= 0 ) | |
9014 return NULL; | |
9015 | |
9016 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9017 while ( 1 ) |
9018 { | |
428 | 9019 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9020 { | |
9021 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9022 last_evt=test_evt; | |
9023 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9024 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9025 break; |
9026 } | |
428 | 9027 ++event_index; |
9028 if ( event_index >= uLevelEVT_NumEvents ) | |
9029 return NULL; | |
9030 } | |
9031 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9032 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9033 { | |
9034 str_index = EVT_DWORD(test_evt->v5); | |
9035 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9036 } |
9037 else | |
9038 { | |
428 | 9039 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9040 { | |
9041 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9042 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9043 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9044 { | |
9045 str_index = EVT_DWORD(test_evt->v5); | |
9046 if ( str_index < 600 ) | |
9047 return (char *)p2DEvents[str_index - 1].pName; | |
9048 } | |
9049 } | |
9050 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9051 } | |
9052 | |
0 | 9053 return result; |
9054 } | |
9055 | |
9056 //----- (00444839) -------------------------------------------------------- | |
9057 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) | |
9058 { | |
9059 unsigned int v9; // ebx@1 | |
9060 int v10; // edi@1 | |
373 | 9061 //signed int v11; // eax@1 |
0 | 9062 unsigned int v12; // eax@6 |
9063 const char *v13; // ST0C_4@6 | |
9064 unsigned int v14; // eax@8 | |
9065 const char *v15; // eax@14 | |
9066 unsigned int v16; // eax@16 | |
9067 unsigned int result; // eax@26 | |
9068 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9069 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9070 char *v20; // [sp-4h] [bp-3Ch]@9 |
9071 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9072 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9073 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9074 | |
9075 v9 = a1; | |
9076 v10 = a2; | |
9077 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9078 dword_59117C_teleportx = x; | |
9079 dword_591178_teleporty = y; | |
9080 dword_591174_teleportz = z; | |
9081 dword_591170_teleport_directiony = directiony; | |
9082 dword_59116C_teleport_directionx = directionx; | |
9083 dword_591168_teleport_speedz = a8; | |
9084 dword_591164_teleport_map_name = (char *)pLocationName; | |
9085 uCurrentHouse_Animation = v9; | |
9086 pEventTimer->Pause(); | |
9087 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9088 |
9089 switch (pParty->alignment) | |
9090 { | |
9091 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9092 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9093 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9094 default: assert(false); | |
9095 } | |
9096 /*v11 = const_2(); | |
0 | 9097 sprintf(pContainer, "evt%02d", v11); |
9098 if ( pParty->uAlignment ) | |
9099 { | |
9100 if ( pParty->uAlignment != 2 ) | |
9101 goto LABEL_6; | |
9102 v19 = "-c"; | |
9103 } | |
9104 else | |
9105 { | |
9106 v19 = "-b"; | |
9107 } | |
373 | 9108 strcat(pContainer, v19);*/ |
9109 | |
9110 //LABEL_6: | |
0 | 9111 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9112 v13 = pHouse_ExitPictures[v10]; | |
9113 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9114 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9115 if ( v9 ) | |
9116 { | |
9117 if ( !v23 ) | |
898 | 9118 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); |
9119 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); | |
0 | 9120 } |
9121 else | |
9122 { | |
9123 if ( !v23 ) | |
9124 { | |
9125 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9126 if ( v14 ) | |
9127 { | |
721 | 9128 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9129 goto LABEL_20; |
9130 } | |
9131 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9132 goto LABEL_19; | |
9133 } | |
9134 } | |
9135 v15 = pLocationName; | |
9136 if ( *pLocationName == 48 ) | |
9137 v15 = pCurrentMapName; | |
9138 v16 = pMapStats->GetMapInfo(v15); | |
9139 if ( v16 ) | |
9140 { | |
721 | 9141 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9142 goto LABEL_20; | |
0 | 9143 } |
9144 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9145 LABEL_19: | |
423 | 9146 strcpy(sHouseName, v21); |
0 | 9147 LABEL_20: |
710 | 9148 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9149 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9150 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9151 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9152 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9153 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9154 result = v23; |
9155 if ( v23 ) | |
9156 uCurrentHouse_Animation = v23; | |
9157 return result; | |
9158 } |