Mercurial > mm7
annotate mm7_4.cpp @ 963:cbf623f00e6c
m
author | Ritor1 |
---|---|
date | Sat, 04 May 2013 18:18:47 +0600 |
parents | c0d0656aa662 |
children | d7f0572335ec |
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 "Time.h" | |
32 #include "IconFrameTable.h" | |
33 #include "GUIProgressBar.h" | |
34 #include "Bink_Smacker.h" | |
35 #include "TileFrameTable.h" | |
36 #include "PlayerFrameTable.h" | |
37 #include "Awards.h" | |
38 #include "Autonotes.h" | |
39 #include "stru160.h" | |
40 #include "TurnEngine.h" | |
41 #include "FactionTable.h" | |
42 #include "StorylineTextTable.h" | |
43 #include "Random.h" | |
924 | 44 #include "CastSpellInfo.h" |
0 | 45 #include "stru298.h" |
46 #include "stru12.h" | |
47 #include "Events2D.h" | |
48 #include "stru159.h" | |
189 | 49 #include "texts.h" |
0 | 50 #include "Log.h" |
629 | 51 #include "UIHouses.h" |
0 | 52 #include "mm7_data.h" |
53 | |
54 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 55 void __cdecl check_event_triggers() |
0 | 56 { |
57 int v0; // eax@1 | |
58 LevelDecoration *v1; // esi@2 | |
59 signed int v2; // edi@2 | |
60 int v3; // ebx@2 | |
61 int v4; // eax@3 | |
62 int v5; // ebx@3 | |
63 unsigned int v6; // ecx@3 | |
64 unsigned int v7; // edx@6 | |
65 unsigned int v8; // edx@8 | |
112 | 66 Actor *v9; // edi@13 |
0 | 67 int v10; // ebx@14 |
68 int v11; // eax@14 | |
69 int v12; // ebx@14 | |
70 unsigned int v13; // ecx@14 | |
71 int v14; // edx@15 | |
72 unsigned int v15; // edx@17 | |
73 unsigned int v16; // edx@19 | |
74 char *v17; // edi@25 | |
75 int v18; // ebx@26 | |
76 int v19; // eax@26 | |
77 int v20; // ebx@26 | |
78 unsigned int v21; // ecx@26 | |
79 int v22; // edx@27 | |
80 unsigned int v23; // edx@29 | |
81 unsigned int v24; // edx@31 | |
82 int v25; // [sp+0h] [bp-24h]@3 | |
83 int v26; // [sp+0h] [bp-24h]@14 | |
84 int v27; // [sp+0h] [bp-24h]@26 | |
85 int v28; // [sp+4h] [bp-20h]@3 | |
86 int v29; // [sp+4h] [bp-20h]@14 | |
87 int v30; // [sp+4h] [bp-20h]@26 | |
88 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
89 int v32; // [sp+Ch] [bp-18h]@2 | |
90 int v33; // [sp+10h] [bp-14h]@2 | |
91 int i; // [sp+14h] [bp-10h]@1 | |
92 int v35; // [sp+18h] [bp-Ch]@2 | |
93 int v36; // [sp+1Ch] [bp-8h]@3 | |
94 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
95 signed int v38; // [sp+20h] [bp-4h]@24 | |
96 | |
97 v0 = 0; | |
98 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
99 { | |
100 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
101 v2 = v1->field_18; | |
102 v3 = v1->vPosition.y; | |
103 v33 = v1->vPosition.x; | |
104 v32 = v1->vPosition.y; | |
105 v35 = v1->vPosition.z; | |
106 v31 = v1->field_18; | |
107 if ( v1->field_2 & 1 ) | |
108 { | |
109 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
110 v25 = abs(v3 - pParty->vPosition.y); | |
111 v28 = abs(v35 - pParty->vPosition.z); | |
112 v4 = v36; | |
113 v5 = v25; | |
114 v6 = v28; | |
115 if ( v36 < v25 ) | |
116 { | |
117 v4 = v25; | |
118 v5 = v36; | |
119 } | |
120 if ( v4 < v28 ) | |
121 { | |
122 v7 = v4; | |
123 v4 = v28; | |
124 v6 = v7; | |
125 } | |
126 if ( v5 < (signed int)v6 ) | |
127 { | |
128 v8 = v6; | |
129 v6 = v5; | |
130 v5 = v8; | |
131 } | |
132 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 133 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 134 } |
135 if ( v1->field_2 & 2 ) | |
136 { | |
137 v37 = 0; | |
138 if ( (signed int)uNumActors > 0 ) | |
139 { | |
112 | 140 v9 = pActors;//[0].vPosition.y; |
0 | 141 do |
142 { | |
112 | 143 v10 = abs(v33 - v9->vPosition.x); |
144 v29 = abs(v32 - v9->vPosition.y); | |
145 v26 = abs(v35 - v9->vPosition.z); | |
0 | 146 v11 = v10; |
147 v12 = v29; | |
148 v13 = v26; | |
149 if ( v11 < v29 ) | |
150 { | |
151 v14 = v11; | |
152 v11 = v29; | |
153 v12 = v14; | |
154 } | |
155 if ( v11 < v26 ) | |
156 { | |
157 v15 = v11; | |
158 v11 = v26; | |
159 v13 = v15; | |
160 } | |
161 if ( v12 < (signed int)v13 ) | |
162 { | |
163 v16 = v13; | |
164 v13 = v12; | |
165 v12 = v16; | |
166 } | |
167 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
168 EventProcessor(v1->field_16_event_id, 0, 1); | |
169 ++v37; | |
112 | 170 ++v9; |
0 | 171 } |
172 while ( v37 < (signed int)uNumActors ); | |
173 } | |
174 } | |
175 if ( v1->field_2 & 4 ) | |
176 { | |
177 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
178 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
179 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
180 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 181 do |
182 { | |
183 v18 = abs(v33 - *((int *)v17 - 1)); | |
184 v30 = abs(v32 - *(int *)v17); | |
185 v27 = abs(v35 - *((int *)v17 + 1)); | |
186 v19 = v18; | |
187 v20 = v30; | |
188 v21 = v27; | |
189 if ( v19 < v30 ) | |
190 { | |
191 v22 = v19; | |
192 v19 = v30; | |
193 v20 = v22; | |
194 } | |
195 if ( v19 < v27 ) | |
196 { | |
197 v23 = v19; | |
198 v19 = v27; | |
199 v21 = v23; | |
200 } | |
201 if ( v20 < (signed int)v21 ) | |
202 { | |
203 v24 = v21; | |
204 v21 = v20; | |
205 v20 = v24; | |
206 } | |
207 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
208 EventProcessor(v1->field_16_event_id, 0, 1); | |
209 ++v38; | |
210 v17 += 112; | |
211 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
212 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 213 } |
214 } | |
215 v0 = i + 1; | |
216 } | |
217 } | |
218 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
219 | |
220 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 221 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 222 { |
223 int v13; // ecx@13 | |
224 signed int v14; // ebx@14 | |
225 int v15; // eax@16 | |
729 | 226 //int v16; // edx@19 |
792 | 227 //int v17; // ST18_4@19 |
228 //signed int v18; // edx@19 | |
229 //signed __int64 v19; // qtt@19 | |
0 | 230 int v21; // eax@27 |
792 | 231 //int v22; // ecx@29 |
0 | 232 signed int v28; // eax@45 |
233 int v29; // ebx@47 | |
234 int v30; // edx@49 | |
830 | 235 //int v31; // ST10_4@49 |
236 //signed int v32; // edx@49 | |
0 | 237 signed __int64 v33; // qtt@49 |
830 | 238 //signed int v34; // eax@54 |
239 //signed int v35; // esi@56 | |
240 //int result; // eax@57 | |
0 | 241 int v38; // edx@62 |
792 | 242 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 243 bool v47; // [sp+24h] [bp-1Ch]@43 |
244 bool v48; // [sp+28h] [bp-18h]@10 | |
245 bool v49; // [sp+28h] [bp-18h]@41 | |
246 bool v50; // [sp+2Ch] [bp-14h]@12 | |
247 signed int v53; // [sp+30h] [bp-10h]@10 | |
248 signed int v54; // [sp+30h] [bp-10h]@41 | |
249 signed int v55; // [sp+34h] [bp-Ch]@1 | |
250 | |
730 | 251 //LOG_DECOMPILATION_WARNING(); |
252 | |
253 static int blv_floor_id[50]; // 00721200 | |
254 static int blv_floor_level[50]; // 007212C8 | |
255 | |
256 static __int16 word_721390_ys[104]; // idb | |
257 static __int16 word_721460_xs[104]; // idb | |
0 | 258 |
259 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 260 v55 = 0; |
0 | 261 for (uint i = 0; i < pSector->uNumFloors; ++i) |
262 { | |
263 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
264 if (pFloor->Clickable()) | |
265 continue; | |
266 | |
792 | 267 assert(pFloor->uNumVertices); |
0 | 268 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
269 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
270 { | |
271 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
272 { | |
730 | 273 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
274 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
275 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
276 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 277 } |
730 | 278 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
279 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
280 | |
792 | 281 v50 = word_721390_ys[0] >= y; |
0 | 282 v53 = 0; |
792 | 283 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
284 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 285 { |
286 if (v53 >= 2) | |
287 break; | |
288 | |
289 v48 = v50; | |
290 v50 = word_721390_ys[j + 1] >= y; | |
730 | 291 |
292 v13 = i; | |
792 | 293 if (v48 == v50) |
294 continue; | |
295 | |
296 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
297 v15 = v14 | word_721460_xs[j] < x; | |
298 | |
299 if (v15 == 3) | |
300 continue; | |
301 else if (!v15) | |
302 ++v53; | |
303 else | |
0 | 304 { |
792 | 305 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 306 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 307 |
308 if (res + word_721460_xs[j] >= x) | |
729 | 309 ++v53; |
0 | 310 } |
792 | 311 } |
312 | |
313 | |
0 | 314 if ( v53 == 1 ) |
315 { | |
316 if ( v55 >= 50 ) | |
317 break; | |
723 | 318 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 319 { |
725 | 320 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 321 } |
322 else | |
323 { | |
871 | 324 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 325 } |
792 | 326 blv_floor_level[v55] = v21; |
327 blv_floor_id[v55] = pSector->pFloors[i]; | |
328 v55++; | |
0 | 329 } |
792 | 330 } |
331 } | |
332 | |
333 | |
0 | 334 if ( pSector->field_0 & 8 ) |
335 { | |
336 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
337 { | |
338 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
339 if (portal->uPolygonType != POLYGON_Floor) | |
340 continue; | |
341 | |
830 | 342 if (!portal->uNumVertices) |
343 continue; | |
344 | |
723 | 345 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
346 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
347 { | |
0 | 348 for (uint j = 0; j < portal->uNumVertices; ++j) |
349 { | |
730 | 350 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
351 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
352 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
353 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
354 } | |
355 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
356 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 357 v54 = 0; |
830 | 358 v47 = word_721390_ys[0] >= y; |
359 | |
360 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 361 { |
830 | 362 v49 = v47; |
0 | 363 if ( v54 >= 2 ) |
364 break; | |
830 | 365 v47 = word_721390_ys[j + 1] >= y; |
0 | 366 if ( v49 != v47 ) |
367 { | |
830 | 368 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
369 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 370 if ( v29 != 3 ) |
371 { | |
723 | 372 if ( !v29 ) |
729 | 373 ++v54; |
374 else | |
375 { | |
830 | 376 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 377 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 378 if (res + word_721460_xs[j] >= x) |
723 | 379 ++v54; |
729 | 380 } |
0 | 381 } |
382 } | |
383 } | |
384 if ( v54 == 1 ) | |
385 { | |
386 if ( v55 >= 50 ) | |
387 break; | |
830 | 388 blv_floor_level[v55] = -29000; |
389 blv_floor_id[v55] = pSector->pPortals[i]; | |
390 v55++; | |
0 | 391 } |
392 } | |
393 } | |
394 } | |
395 if ( v55 == 1 ) | |
396 { | |
730 | 397 *pFaceID = blv_floor_id[0]; |
725 | 398 return blv_floor_level[0]; |
0 | 399 } |
400 if ( !v55 ) | |
401 return -30000; | |
730 | 402 *pFaceID = blv_floor_id[0]; |
725 | 403 //result = blv_floor_level[0]; |
830 | 404 |
405 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 406 { |
725 | 407 if ( blv_floor_level[0] <= z + 5 ) |
408 { | |
409 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 410 continue; |
725 | 411 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 412 *pFaceID = blv_floor_id[v35]; |
717 | 413 continue; |
414 } | |
725 | 415 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
416 { | |
417 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 418 *pFaceID = blv_floor_id[v35]; |
717 | 419 } |
830 | 420 }*/ |
421 | |
422 | |
423 int result = blv_floor_level[0]; | |
424 for (uint i = 1; i < v55; ++i) | |
425 { | |
426 v38 = blv_floor_level[i]; | |
427 if ( result <= z + 5 ) | |
428 { | |
429 if ( v38 > result && v38 <= z + 5 ) | |
430 { | |
431 result = blv_floor_level[i]; | |
432 *pFaceID = blv_floor_id[i]; | |
433 } | |
434 } | |
435 else if ( v38 < result ) | |
436 { | |
437 result = blv_floor_level[i]; | |
438 *pFaceID = blv_floor_id[i]; | |
439 } | |
440 } | |
441 | |
442 return result; | |
0 | 443 } |
444 | |
445 //----- (0046D49E) -------------------------------------------------------- | |
791 | 446 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 447 { |
723 | 448 BSPModel *pBModel; // esi@4 |
449 ODMFace *pFace; // ecx@11 | |
0 | 450 int v14; // edx@20 |
451 signed int v18; // edx@26 | |
452 int v19; // eax@28 | |
453 int v20; // edx@30 | |
454 int v21; // ST1C_4@30 | |
455 signed int v22; // edx@30 | |
456 signed __int64 v23; // qtt@30 | |
457 int v24; // eax@36 | |
458 signed int v25; // ecx@38 | |
459 int result; // eax@42 | |
460 signed int v27; // ecx@43 | |
461 int v28; // edi@44 | |
462 signed int v29; // edx@44 | |
463 int v30; // esi@45 | |
464 int v31; // eax@45 | |
465 ODMFace *v32; // eax@57 | |
466 int v33; // ecx@59 | |
467 int v36; // [sp+14h] [bp-2Ch]@24 | |
468 int v38; // [sp+1Ch] [bp-24h]@2 | |
469 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 470 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
471 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 472 bool v43; // [sp+30h] [bp-10h]@22 |
473 bool v44; // [sp+34h] [bp-Ch]@24 | |
474 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
475 signed int v48; // [sp+58h] [bp+18h]@22 | |
476 signed int v49; // [sp+58h] [bp+18h]@43 | |
477 | |
478 v46 = 1; | |
479 dword_721160[0] = -1; | |
480 dword_721110[0] = -1; | |
791 | 481 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 482 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 483 { |
484 *a6 = 0; | |
725 | 485 return odm_floor_level[0]; |
723 | 486 } |
0 | 487 v38 = 0; |
723 | 488 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
489 { | |
490 pBModel = &pOutdoor->pBModels[v38]; | |
491 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
492 { | |
493 if ( (signed int)pBModel->uNumFaces > 0 ) | |
494 { | |
495 v39 = 0; | |
496 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
497 { | |
498 pFace = &pBModel->pFaces[v39]; | |
499 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
500 && !(pFace->uAttributes & 0x20000000) | |
501 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
502 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 503 { |
723 | 504 if ( pFace->uNumVertices ) |
0 | 505 { |
723 | 506 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 507 { |
723 | 508 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
509 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
510 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
511 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
512 } | |
513 } | |
514 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
515 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
516 v43 = word_720F70[0] >= Y; | |
517 v48 = 0; | |
518 if ( 2 * pFace->uNumVertices > 0 ) | |
519 { | |
520 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
521 { | |
522 if ( v48 >= 2 ) | |
523 break; | |
524 v36 = word_720F70[i + 1]; | |
525 v44 = word_720F70[i + 1] >= Y; | |
526 if ( v43 != v44 ) | |
0 | 527 { |
723 | 528 v18 = word_721040[i + 1] >= X ? 0 : 2; |
529 v19 = v18 | word_721040[i] < X; | |
530 if ( v19 != 3 ) | |
0 | 531 { |
723 | 532 if ( !v19 ) |
740 | 533 ++v48; |
534 else | |
0 | 535 { |
723 | 536 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
537 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
538 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
539 if ( v22 >= X) | |
540 ++v48; | |
0 | 541 } |
542 } | |
543 } | |
723 | 544 v43 = v44; |
545 } | |
546 if ( v48 == 1 ) | |
547 { | |
548 if ( v46 >= 20 ) | |
0 | 549 break; |
723 | 550 if ( pFace->uPolygonType == POLYGON_Floor ) |
551 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
552 else | |
725 | 553 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
554 + HIWORD(pFace->zCalc3); | |
723 | 555 v25 = v46++; |
725 | 556 odm_floor_level[v25] = v24; |
723 | 557 dword_721160[v25] = pBModelNum; |
558 dword_721110[v25] = pFaceNum; | |
0 | 559 } |
560 } | |
561 } | |
723 | 562 ++v39; |
563 } | |
564 } | |
565 } | |
0 | 566 ++v38; |
567 } | |
568 if ( v46 == 1 ) | |
569 { | |
570 *a6 = 0; | |
725 | 571 return odm_floor_level[0]; |
0 | 572 } |
573 v27 = 0; | |
574 if ( v46 <= 1 ) | |
575 *a6 = 0; | |
723 | 576 else |
577 { | |
725 | 578 //v29 = 1; |
723 | 579 for ( v49 = 1; v49 < v46; ++v49 ) |
580 { | |
725 | 581 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 582 { |
583 v27 = v49; | |
725 | 584 //++v29; |
723 | 585 break; |
586 } | |
725 | 587 if ( odm_floor_level[0] > Z + 5 ) |
588 { | |
589 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
590 { | |
591 //++v29; | |
723 | 592 break; |
593 } | |
594 v27 = v49; | |
725 | 595 //++v29; |
723 | 596 break; |
597 } | |
725 | 598 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 599 { |
600 v27 = v49; | |
725 | 601 //++v29; |
723 | 602 } |
603 } | |
604 if ( !v27 ) | |
605 *a6 = 0; | |
606 else | |
607 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
608 } | |
0 | 609 if ( v27 ) |
610 { | |
611 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 612 *pIsOnWater = false; |
613 if ( v32->Fluid()) | |
614 *pIsOnWater = true; | |
0 | 615 } |
725 | 616 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
617 odm_floor_level[0] = odm_floor_level[v27]; | |
618 return odm_floor_level[0]; | |
0 | 619 } |
620 | |
621 //----- (0046D8E3) -------------------------------------------------------- | |
622 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
623 { | |
624 int v4; // ebx@1 | |
625 unsigned int v5; // ecx@1 | |
626 BSPModel *v6; // edi@3 | |
627 ODMFace *v7; // esi@10 | |
628 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
629 signed __int16 *v9; // eax@18 |
0 | 630 int v10; // edx@19 |
631 int v11; // ecx@21 | |
632 int v12; // ecx@23 | |
633 signed int v13; // eax@25 | |
634 int v14; // edx@27 | |
635 int v15; // edx@29 | |
636 int v16; // ST18_4@29 | |
637 signed int v17; // edx@29 | |
638 signed __int64 v18; // qtt@29 | |
639 int v19; // eax@35 | |
640 signed int v20; // ecx@37 | |
641 signed int v22; // ebx@42 | |
642 unsigned int v23; // esi@43 | |
643 int v24; // edx@44 | |
644 int v25; // eax@44 | |
645 int v26; // [sp+Ch] [bp-38h]@7 | |
646 int v27; // [sp+10h] [bp-34h]@21 | |
647 int v28; // [sp+18h] [bp-2Ch]@21 | |
648 int v29; // [sp+1Ch] [bp-28h]@2 | |
649 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
650 signed int v31; // [sp+24h] [bp-20h]@1 | |
651 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
652 int v33; // [sp+2Ch] [bp-18h]@7 | |
653 bool v34; // [sp+30h] [bp-14h]@21 | |
654 bool v35; // [sp+34h] [bp-10h]@23 | |
655 signed int v36; // [sp+38h] [bp-Ch]@17 | |
656 signed int v37; // [sp+38h] [bp-Ch]@21 | |
657 signed int v38; // [sp+38h] [bp-Ch]@42 | |
658 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
659 signed int v40; // [sp+40h] [bp-4h]@1 | |
660 | |
661 dword_720ED0[0] = -1; | |
662 dword_720E80[0] = -1; | |
663 v4 = a1; | |
664 v5 = 0; | |
665 v40 = a2; | |
666 v31 = v4; | |
667 v39 = 1; | |
668 dword_720F20[0] = 10000; | |
669 v32 = 0; | |
670 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
671 { | |
672 v29 = 0; | |
673 do | |
674 { | |
675 v6 = &pOutdoor->pBModels[v29]; | |
676 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
677 { | |
678 if ( v4 >= v6->sMinX ) | |
679 { | |
680 if ( v40 <= v6->sMaxY ) | |
681 { | |
682 if ( v40 >= v6->sMinY ) | |
683 { | |
684 v33 = v5; | |
685 v26 = v6->uNumFaces; | |
686 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
687 { | |
688 v30 = v5; | |
689 while ( 1 ) | |
690 { | |
691 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
692 v8 = v7->uPolygonType; | |
693 if ( (v8 == 5 || v8 == 6) | |
694 && !(BYTE3(v7->uAttributes) & 0x20) | |
695 && v4 <= v7->pBoundingBox.x2 | |
696 && v4 >= v7->pBoundingBox.x1 | |
697 && v40 <= v7->pBoundingBox.y2 | |
698 && v40 >= v7->pBoundingBox.y1 ) | |
699 { | |
700 v36 = v5; | |
701 if ( v7->uNumVertices ) | |
702 { | |
703 v9 = v7->pXInterceptDisplacements; | |
704 do | |
705 { | |
706 v10 = 2 * v36; | |
707 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
708 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
709 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
710 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
711 ++v9; | |
712 } | |
713 while ( v36 < v7->uNumVertices ); | |
714 v4 = v31; | |
715 } | |
716 v27 = 2 * v7->uNumVertices; | |
717 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
718 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
719 v11 = 0; | |
720 v34 = word_720CE0_ys[0] >= v40; | |
721 v37 = 0; | |
722 v28 = 0; | |
723 if ( v27 > 0 ) | |
724 { | |
725 do | |
726 { | |
727 if ( v37 >= 2 ) | |
728 break; | |
729 v12 = v11; | |
730 v4 = v31; | |
731 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
732 if ( v34 != v35 ) | |
733 { | |
734 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
735 v14 = v13 | word_720DB0_xs[v12] < v31; | |
736 if ( v14 != 3 ) | |
737 { | |
738 if ( !v14 | |
739 || (v15 = word_720CE0_ys[v12], | |
740 v16 = word_720CE0_ys[v12 + 1] - v15, | |
741 v17 = v40 - v15, | |
742 LODWORD(v18) = v17 << 16, | |
743 HIDWORD(v18) = v17 >> 16, | |
744 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
745 - (signed int)word_720DB0_xs[v12]) | |
746 * v18 | |
747 / v16) >> 16) | |
748 + word_720DB0_xs[v12]) >= v31) ) | |
749 ++v37; | |
750 } | |
751 } | |
752 v11 = v28 + 1; | |
753 v34 = v35; | |
754 ++v28; | |
755 } | |
756 while ( v28 < v27 ); | |
757 if ( v37 == 1 ) | |
758 { | |
759 if ( v39 >= 20 ) | |
760 break; | |
761 if ( v7->uPolygonType == 5 ) | |
762 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
763 else | |
764 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
765 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
766 + HIWORD(v7->zCalc3); | |
767 v20 = v39++; | |
768 dword_720F20[v20] = v19; | |
769 dword_720ED0[v20] = v32; | |
770 dword_720E80[v20] = v33; | |
771 } | |
772 } | |
773 } | |
774 ++v33; | |
775 v30 += 308; | |
776 if ( v33 >= v26 ) | |
777 break; | |
778 v5 = 0; | |
779 } | |
780 } | |
781 } | |
782 } | |
783 } | |
784 } | |
785 ++v32; | |
786 ++v29; | |
787 v5 = 0; | |
788 } | |
789 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
790 if ( !v39 ) | |
791 { | |
792 *(int *)a4 = 0; | |
793 return dword_720F20[0]; | |
794 } | |
795 } | |
796 v22 = 0; | |
797 v38 = v5; | |
798 if ( v39 <= (signed int)v5 ) | |
799 goto LABEL_54; | |
800 v23 = 0; | |
801 do | |
802 { | |
803 v24 = dword_720F20[v5 / 4]; | |
804 v25 = *(int *)((char *)dword_720F20 + v23); | |
805 if ( v24 == v25 ) | |
806 goto LABEL_50; | |
807 if ( v25 > a3 + 15 ) | |
808 { | |
809 if ( v24 >= v25 ) | |
810 goto LABEL_51; | |
811 LABEL_50: | |
812 v22 = v38; | |
813 v23 = v5; | |
814 goto LABEL_51; | |
815 } | |
816 if ( v24 > v25 && v24 <= a3 + 15 ) | |
817 goto LABEL_50; | |
818 LABEL_51: | |
819 ++v38; | |
820 v5 += 4; | |
821 } | |
822 while ( v38 < v39 ); | |
823 if ( v22 ) | |
824 { | |
825 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
826 return dword_720F20[v22]; | |
827 } | |
828 LABEL_54: | |
829 *(int *)a4 = 0; | |
830 return dword_720F20[v22]; | |
831 } | |
832 | |
138 | 833 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
834 // for a right-handed system, that would be an inverse normal | |
0 | 835 //----- (0046DCC8) -------------------------------------------------------- |
138 | 836 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
837 { | |
838 auto grid_x = WorldPosToGridCellX(pos_x); | |
839 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
840 | |
841 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
842 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
843 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
844 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
845 | |
846 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
847 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
848 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
849 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
850 | |
851 float side1_dx, side1_dy, side1_dz, | |
852 side2_dx, side2_dy, side2_dz; | |
853 | |
854 auto dx = abs(pos_x - grid_pos_x1), | |
855 dz = abs(grid_pos_z1 - pos_z); | |
856 if (dz >= dx) | |
857 { | |
858 side1_dy = (double)(x1z1_y - x1z2_y); | |
859 side2_dy = (double)(x2z2_y - x1z2_y); | |
860 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
861 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
862 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
863 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 864 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 865 /* |\ |
866 side1 | \ | |
867 |____\ | |
868 side 2 */ | |
869 } | |
870 else | |
871 { | |
872 side1_dy = (double)(x2z2_y - x2z1_y); | |
873 side2_dy = (double)(x1z1_y - x2z1_y); | |
874 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
875 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
876 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
877 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
878 | |
879 /* side 2 | |
880 _____ | |
881 \ | | |
882 \ | side 1 | |
883 \| */ | |
884 } | |
885 | |
886 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
887 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
888 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
889 | |
890 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
891 if (fabsf(mag) < 1e-6f) | |
892 { | |
893 out->y = 0; | |
894 out->x = 0; | |
895 out->z = 65536; | |
896 } | |
897 else | |
898 { | |
899 float invmag = 1.0 / mag; | |
900 out->x = invmag * nx * 65536.0; | |
901 out->y = invmag * ny * 65536.0; | |
902 out->z = invmag * nz * 65536.0; | |
903 } | |
904 } | |
905 | |
0 | 906 //----- (0046DEF2) -------------------------------------------------------- |
907 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
908 { | |
909 unsigned int result; // eax@1 | |
910 | |
911 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
912 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 913 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
914 return result; | |
915 } | |
916 | |
917 //----- (0046DF1A) -------------------------------------------------------- | |
918 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
919 { | |
920 Actor *v2; // edi@1 | |
921 unsigned __int16 v3; // ax@1 | |
922 int v4; // esi@6 | |
923 int v5; // ecx@8 | |
924 int v6; // eax@10 | |
925 int v7; // edx@12 | |
926 int v8; // ecx@14 | |
927 int v9; // eax@14 | |
928 int v10; // ebx@14 | |
929 int v11; // esi@14 | |
930 int v12; // ebx@15 | |
931 int v13; // ebx@17 | |
932 unsigned int v14; // eax@20 | |
933 signed int result; // eax@21 | |
934 int v16; // [sp+Ch] [bp-10h]@1 | |
935 int v17; // [sp+10h] [bp-Ch]@14 | |
936 int v18; // [sp+14h] [bp-8h]@14 | |
937 int v19; // [sp+18h] [bp-4h]@14 | |
938 | |
939 v16 = a1; | |
940 v2 = &pActors[a1]; | |
941 v3 = v2->uAIState; | |
942 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
943 goto LABEL_25; | |
944 v4 = v2->uActorRadius; | |
945 if ( a2 ) | |
946 v4 = a2; | |
947 v5 = v2->vPosition.x; | |
948 if ( stru_721530.sMaxX > v5 + v4 | |
949 || stru_721530.sMinX < v5 - v4 | |
950 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
951 || stru_721530.sMinY < v6 - v4 | |
952 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
953 || stru_721530.sMinZ < v7 | |
954 || (v8 = v5 - stru_721530.normal.x, | |
955 v9 = v6 - stru_721530.normal.y, | |
956 v10 = stru_721530.prolly_normal_d + v4, | |
957 v17 = stru_721530.prolly_normal_d + v4, | |
958 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
959 v18 = v8, | |
960 v19 = v9, | |
961 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
962 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
963 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
964 { | |
965 LABEL_25: | |
966 result = 0; | |
967 } | |
968 else | |
969 { | |
295 | 970 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 971 if ( v13 < 0 ) |
972 v13 = 0; | |
973 if ( v13 < stru_721530.field_7C ) | |
974 { | |
975 stru_721530.field_7C = v13; | |
976 v14 = 8 * v16; | |
862 | 977 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 978 stru_721530.uFaceID = v14; |
979 } | |
980 result = 1; | |
981 } | |
982 return result; | |
983 } | |
984 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
985 | |
986 //----- (0046E0B2) -------------------------------------------------------- | |
987 void __cdecl _46E0B2_collide_against_decorations() | |
988 { | |
989 BLVSector *v0; // ebp@1 | |
990 LevelDecoration *v1; // edi@2 | |
991 DecorationDesc *v2; // esi@3 | |
992 int v3; // edx@4 | |
993 int v4; // eax@4 | |
994 int v5; // ecx@6 | |
995 int v6; // ebx@8 | |
996 int v7; // esi@8 | |
997 int v8; // ebx@10 | |
998 int v9; // esi@11 | |
999 int v10; // edi@12 | |
1000 int v11; // eax@12 | |
1001 int v12; // esi@14 | |
1002 unsigned int v13; // eax@17 | |
1003 signed int i; // [sp+4h] [bp-14h]@1 | |
1004 int v15; // [sp+8h] [bp-10h]@10 | |
1005 int v16; // [sp+Ch] [bp-Ch]@10 | |
1006 int v17; // [sp+10h] [bp-8h]@10 | |
1007 int v18; // [sp+14h] [bp-4h]@8 | |
1008 | |
1009 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1010 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1011 { | |
1012 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1013 if ( !(v1->field_2 & 0x20) ) | |
1014 { | |
1015 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1016 if (!v2->CanMoveThrough()) |
0 | 1017 { |
1018 v3 = v2->uRadius; | |
1019 v4 = v1->vPosition.x; | |
1020 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1021 { | |
1022 if ( stru_721530.sMinX >= v4 - v3 ) | |
1023 { | |
1024 v5 = v1->vPosition.y; | |
1025 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1026 { | |
1027 if ( stru_721530.sMinY >= v5 - v3 ) | |
1028 { | |
1029 v6 = v2->uDecorationHeight; | |
1030 v7 = v1->vPosition.z; | |
1031 v18 = v6; | |
1032 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1033 { | |
1034 if ( stru_721530.sMinZ >= v7 ) | |
1035 { | |
1036 v16 = v4 - stru_721530.normal.x; | |
1037 v15 = v5 - stru_721530.normal.y; | |
1038 v8 = stru_721530.prolly_normal_d + v3; | |
1039 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1040 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1041 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1042 { | |
1043 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1044 if ( v9 > 0 ) | |
1045 { | |
1046 v10 = v1->vPosition.z; | |
1047 v11 = stru_721530.normal.z | |
1048 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1049 if ( v11 >= v10 ) | |
1050 { | |
1051 if ( v11 <= v18 + v10 ) | |
1052 { | |
295 | 1053 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1054 if ( v12 < 0 ) |
1055 v12 = 0; | |
1056 if ( v12 < stru_721530.field_7C ) | |
1057 { | |
1058 stru_721530.field_7C = v12; | |
1059 v13 = 8 * v0->pDecorationIDs[i]; | |
1060 LOBYTE(v13) = v13 | 5; | |
1061 stru_721530.uFaceID = v13; | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 | |
1078 //----- (0046E26D) -------------------------------------------------------- | |
1079 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1080 { | |
1081 int v2; // edx@5 | |
1082 unsigned __int16 *v3; // eax@5 | |
1083 unsigned __int16 v4; // ax@6 | |
1084 LevelDecoration *v5; // edi@7 | |
1085 DecorationDesc *v6; // esi@8 | |
1086 int v7; // edx@9 | |
1087 int v8; // eax@9 | |
1088 int v9; // ecx@11 | |
1089 int v10; // ebx@13 | |
1090 int v11; // esi@13 | |
1091 int v12; // ebp@15 | |
1092 int v13; // ebx@15 | |
1093 int v14; // esi@16 | |
1094 int v15; // edi@17 | |
1095 int v16; // eax@17 | |
1096 int v17; // esi@19 | |
1097 char v18; // zf@23 | |
1098 int v19; // [sp+0h] [bp-10h]@15 | |
1099 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1100 int v21; // [sp+8h] [bp-8h]@15 | |
1101 int v22; // [sp+Ch] [bp-4h]@13 | |
1102 | |
1103 if ( a1 >= 0 ) | |
1104 { | |
1105 if ( a1 <= 127 ) | |
1106 { | |
1107 if ( a2 >= 0 ) | |
1108 { | |
1109 if ( a2 <= 127 ) | |
1110 { | |
1111 v2 = a1 + (a2 << 7); | |
1112 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1113 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1114 if ( v3 ) | |
1115 { | |
1116 do | |
1117 { | |
1118 v4 = *v3; | |
848 | 1119 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1120 { |
1121 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1122 if ( !(v5->field_2 & 0x20) ) | |
1123 { | |
1124 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1125 if (!v6->CanMoveThrough()) |
0 | 1126 { |
1127 v7 = v6->uRadius; | |
1128 v8 = v5->vPosition.x; | |
1129 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1130 { | |
1131 if ( stru_721530.sMinX >= v8 - v7 ) | |
1132 { | |
1133 v9 = v5->vPosition.y; | |
1134 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1135 { | |
1136 if ( stru_721530.sMinY >= v9 - v7 ) | |
1137 { | |
1138 v10 = v6->uDecorationHeight; | |
1139 v11 = v5->vPosition.z; | |
1140 v22 = v10; | |
1141 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1142 { | |
1143 if ( stru_721530.sMinZ >= v11 ) | |
1144 { | |
1145 v12 = v8 - stru_721530.normal.x; | |
1146 v19 = v9 - stru_721530.normal.y; | |
1147 v13 = stru_721530.prolly_normal_d + v7; | |
1148 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1149 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1150 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1151 { | |
1152 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1153 if ( v14 > 0 ) | |
1154 { | |
1155 v15 = v5->vPosition.z; | |
1156 v16 = stru_721530.normal.z | |
1157 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1158 if ( v16 >= v15 ) | |
1159 { | |
1160 if ( v16 <= v22 + v15 ) | |
1161 { | |
295 | 1162 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1163 if ( v17 < 0 ) |
1164 v17 = 0; | |
1165 if ( v17 < stru_721530.field_7C ) | |
1166 { | |
1167 stru_721530.field_7C = v17; | |
1168 stru_721530.uFaceID = (signed __int16)*v20; | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 v3 = v20 + 1; | |
1184 v18 = *v20 == 0; | |
1185 ++v20; | |
1186 } | |
1187 while ( !v18 ); | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 | |
1195 //----- (00486F92) -------------------------------------------------------- | |
1196 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1197 { | |
1198 Span *v0; // ebx@1 | |
1199 int v1; // eax@2 | |
1200 Edge *v2; // ecx@3 | |
1201 Edge *v3; // edx@3 | |
1202 Edge *v4; // esi@6 | |
1203 Edge *v5; // eax@7 | |
1204 Edge *v6; // ecx@8 | |
1205 Surf *v7; // esi@11 | |
1206 double v8; // st7@13 | |
1207 Surf *v9; // edi@13 | |
1208 double v10; // st6@13 | |
1209 double v11; // st7@14 | |
1210 signed __int64 v12; // qax@14 | |
1211 stru148 *v13; // eax@15 | |
1212 Span *v14; // ecx@17 | |
1213 double v15; // st7@28 | |
1214 signed __int64 v16; // qax@28 | |
1215 stru148 *v17; // eax@29 | |
1216 Span *v18; // ecx@31 | |
1217 Edge *i; // eax@40 | |
1218 Edge *v20; // ecx@43 | |
1219 Edge *v21; // esi@44 | |
1220 double v22; // st7@45 | |
1221 Edge *v23; // edx@48 | |
1222 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1223 float v25; // [sp+14h] [bp-Ch]@3 | |
1224 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1225 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1226 | |
1227 v0 = pSpans; | |
1228 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1229 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1230 stru_80C9A4.pSurf = &stru_80C980; |
1231 stru_80C980.pPrev = &stru_80C980; | |
1232 stru_80C980.pNext = &stru_80C980; | |
693 | 1233 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1234 stru_80C980.field_8 = 0.0; |
1235 stru_80C980.field_4 = 0.0; | |
1236 stru_80C9D8.pNext = &stru_80C9A4; | |
1237 stru_80C9D8.pPrev = 0; | |
1238 stru_80C9D8.field_8 = 1; | |
1239 stru_80C9A4.pNext = 0; | |
1240 stru_80C9A4.pPrev = &stru_80C9D8; | |
1241 stru_80C9A4.field_8 = 0; | |
1242 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1243 v27 = pViewport->uViewportTL_Y; |
1244 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1245 { |
1246 LABEL_51: | |
1247 v0->field_8 = -1; | |
1248 } | |
1249 else | |
1250 { | |
693 | 1251 v1 = 52 * pViewport->uViewportTL_Y; |
1252 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1253 while ( 1 ) |
1254 { | |
1255 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1256 v3 = &stru_80C9D8; | |
1257 v25 = (double)(signed int)v27; | |
1258 if ( v2 != &defaultEdge ) | |
1259 { | |
1260 do | |
1261 { | |
1262 while ( 1 ) | |
1263 { | |
1264 v4 = v3->pNext; | |
1265 if ( v2->field_0 <= (double)v4->field_0 ) | |
1266 break; | |
1267 v3 = v3->pNext; | |
1268 } | |
1269 v5 = v2->pNext; | |
1270 v2->pNext = v4; | |
1271 v2->pPrev = v3; | |
1272 v3->pNext->pPrev = v2; | |
1273 v3->pNext = v2; | |
1274 v3 = v2; | |
1275 v2 = v5; | |
1276 } | |
1277 while ( v5 != &defaultEdge ); | |
1278 } | |
1279 v6 = stru_80C9D8.pNext; | |
1280 stru_80C980.field_20 = 0; | |
1281 stru_80C980.field_22 = 1; | |
1282 v26 = stru_80C9D8.pNext; | |
1283 if ( stru_80C9D8.pNext ) | |
1284 { | |
1285 while ( 1 ) | |
1286 { | |
1287 v7 = v6->pSurf; | |
1288 if ( v6->field_8 ) | |
1289 { | |
1290 ++v7->field_22; | |
1291 if ( v7->field_22 == 1 ) | |
1292 { | |
1293 v8 = v6->field_0 + 2.0; | |
1294 v9 = stru_80C980.pNext; | |
1295 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1296 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1297 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1298 + stru_80C980.pNext->field_0 ) | |
1299 { | |
1300 do | |
1301 v9 = v9->pNext; | |
1302 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1303 v7->pNext = v9; | |
1304 v7->pPrev = v9->pPrev; | |
1305 v9->pPrev->pNext = v7; | |
1306 v9->pPrev = v7; | |
1307 } | |
1308 else | |
1309 { | |
1310 v11 = v6->field_0 + 0.5; | |
1311 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1312 v0->field_C = v12; | |
1313 if ( (signed __int16)v12 > 0 ) | |
1314 { | |
1315 v0->field_A = v27; | |
1316 v0->field_8 = v9->field_20; | |
1317 v13 = v9->pParent; | |
1318 v0->pParent = v13; | |
1319 if ( v13 ) | |
1320 { | |
1321 if ( v13->prolly_head ) | |
1322 { | |
1323 v14 = v13->prolly_tail; | |
1324 if ( !v14 ) | |
1325 return; | |
1326 v14->pNext = v0; | |
1327 } | |
1328 else | |
1329 { | |
1330 v13->prolly_head = v0; | |
1331 } | |
1332 v13->prolly_tail = v0; | |
1333 } | |
1334 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1335 return; | |
1336 ++v0; | |
1337 ++pOutdoorCamera->uNumSpans; | |
1338 } | |
1339 v6 = v26; | |
1340 v7->field_20 = (signed __int64)v11; | |
1341 v7->pNext = v9; | |
1342 v9->pPrev = v7; | |
1343 stru_80C980.pNext = v7; | |
1344 v7->pPrev = &stru_80C980; | |
1345 } | |
1346 } | |
1347 } | |
1348 else | |
1349 { | |
1350 --v7->field_22; | |
1351 if ( !v7->field_22 ) | |
1352 { | |
1353 if ( stru_80C980.pNext == v7 ) | |
1354 { | |
1355 v15 = v6->field_0 + 0.5; | |
1356 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1357 v0->field_C = v16; | |
1358 if ( (signed __int16)v16 > 0 ) | |
1359 { | |
1360 v0->field_A = v27; | |
1361 v0->field_8 = v7->field_20; | |
1362 v17 = v7->pParent; | |
1363 v0->pParent = v17; | |
1364 if ( v17 ) | |
1365 { | |
1366 if ( v17->prolly_head ) | |
1367 { | |
1368 v18 = v17->prolly_tail; | |
1369 if ( !v18 ) | |
1370 return; | |
1371 v18->pNext = v0; | |
1372 } | |
1373 else | |
1374 { | |
1375 v17->prolly_head = v0; | |
1376 } | |
1377 v17->prolly_tail = v0; | |
1378 } | |
1379 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1380 return; | |
1381 ++v0; | |
1382 ++pOutdoorCamera->uNumSpans; | |
1383 } | |
1384 v7->pNext->field_20 = (signed __int64)v15; | |
1385 v6 = v26; | |
1386 } | |
1387 v7->pNext->pPrev = v7->pPrev; | |
1388 v7->pPrev->pNext = v7->pNext; | |
1389 } | |
1390 } | |
1391 v26 = v6->pNext; | |
1392 if ( !v26 ) | |
1393 break; | |
1394 v6 = v6->pNext; | |
1395 } | |
1396 } | |
1397 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1398 { | |
1399 i->pPrev->pNext = i->pNext; | |
1400 i->pNext->pPrev = i->pPrev; | |
1401 } | |
1402 v20 = stru_80C9D8.pNext; | |
1403 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1404 break; | |
1405 LABEL_50: | |
1406 ++v27; | |
1407 v1 = v24 + 52; | |
1408 v24 += 52; | |
693 | 1409 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1410 goto LABEL_51; |
1411 } | |
1412 while ( 1 ) | |
1413 { | |
1414 v21 = v20->pNext; | |
1415 if ( !v21 ) | |
1416 break; | |
1417 v22 = v20->field_4 + v20->field_0; | |
1418 v20->field_0 = v22; | |
1419 if ( v22 < stru_80C9D8.field_0 ) | |
1420 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1421 while ( 1 ) | |
1422 { | |
1423 v23 = v20->pPrev; | |
1424 if ( v20->field_0 >= (double)v23->field_0 ) | |
1425 break; | |
1426 v23->pNext = v20->pNext; | |
1427 v20->pNext->pPrev = v23; | |
1428 v23->pPrev->pNext = v20; | |
1429 v20->pPrev = v23->pPrev; | |
1430 v20->pNext = v23; | |
1431 v23->pPrev = v20; | |
1432 } | |
1433 v20 = v21; | |
1434 if ( v21 == &stru_80C9A4 ) | |
1435 goto LABEL_50; | |
1436 } | |
1437 } | |
1438 } | |
1439 // 4EC3EC: using guessed type Edge defaultEdge; | |
1440 | |
1441 //----- (00487355) -------------------------------------------------------- | |
1442 bool OutdoorCamera::_487355() | |
1443 { | |
1444 int v0; // esi@1 | |
1445 stru148 *v1; // edi@2 | |
1446 bool result; // eax@3 | |
1447 | |
1448 v0 = 0; | |
1449 if ( pOutdoorCamera->numStru148s > 0 ) | |
1450 { | |
1451 v1 = array_77EC08; | |
1452 do | |
1453 { | |
1454 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1455 ++v0; | |
1456 ++v1; | |
1457 } | |
1458 while ( v0 < pOutdoorCamera->numStru148s ); | |
1459 } | |
1460 return result; | |
1461 } | |
1462 | |
1463 //----- (00487DA9) -------------------------------------------------------- | |
1464 void __cdecl sub_487DA9() | |
1465 { | |
1466 char *v0; // eax@1 | |
1467 | |
1468 v0 = &array_77EC08[0].field_108; | |
1469 do | |
1470 { | |
1471 *v0 = 0; | |
1472 v0 += 268; | |
1473 } | |
1474 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1475 } | |
1476 | |
1477 //----- (00487DBE) -------------------------------------------------------- | |
1478 void Software_ResetNewEdges() | |
1479 { | |
1480 int v0; // ecx@1 | |
1481 Edge **v1; // eax@1 | |
1482 signed int v2; // eax@3 | |
1483 | |
1484 v0 = 0; | |
1485 v1 = ptr_80CA10; | |
1486 do | |
1487 { | |
1488 ++v0; | |
1489 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1490 *v1 = 0; | |
1491 ++v1; | |
1492 } | |
1493 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1494 v2 = 2000; | |
1495 do | |
1496 { | |
1497 pSurfs->field_22 = 0; | |
1498 --v2; | |
1499 } | |
1500 while ( v2 ); | |
1501 } | |
1502 // 4EC3EC: using guessed type Edge defaultEdge; | |
1503 | |
1504 //----- (0048958E) -------------------------------------------------------- | |
1505 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1506 { | |
1507 stru12_MemoryBlock *v2; // esi@1 | |
1508 void *v3; // eax@1 | |
1509 void *v4; // ecx@1 | |
1510 stru12_MemoryBlock *result; // eax@1 | |
1511 | |
1512 v2 = this; | |
1513 v3 = operator new(8 * a2 + 16); | |
1514 v2->pBlockBase = v3; | |
848 | 1515 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1516 result = v2; |
1517 v2->pAlignedBlock = v4; | |
1518 } | |
1519 | |
1520 //----- (004895B7) -------------------------------------------------------- | |
1521 stru12::stru12(stru11 *pStru11) | |
1522 { | |
1523 stru12 *v2; // esi@1 | |
1524 | |
1525 v2 = this; | |
1526 this->field_44 = 0x41000000u; | |
1527 this->field_4C = 0x46000000u; | |
1528 //this->vdestructor_ptr = stru12::_4898E6; | |
1529 this->field_48 = 0; | |
1530 this->field_50 = 0; | |
1531 this->field_54 = 0x33D6BF95u; | |
1532 this->field_58 = 0; | |
1533 | |
1534 for (int i = 0; i < 12; ++i) | |
1535 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1536 /* | |
1537 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1538 if ( v3 ) | |
1539 v4 = AllocAlignedMem(v3, 640); | |
1540 else | |
1541 v4 = 0; | |
1542 v2->pMemBlocks[0] = v4; | |
1543 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1544 if ( v5 ) | |
1545 v6 = AllocAlignedMem(v5, 640); | |
1546 else | |
1547 v6 = 0; | |
1548 v2->pMemBlocks[1] = v6; | |
1549 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1550 if ( v7 ) | |
1551 v8 = AllocAlignedMem(v7, 640); | |
1552 else | |
1553 v8 = 0; | |
1554 v2->pMemBlocks[2] = v8; | |
1555 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1556 if ( v9 ) | |
1557 v10 = AllocAlignedMem(v9, 640); | |
1558 else | |
1559 v10 = 0; | |
1560 v2->pMemBlocks[3] = v10; | |
1561 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1562 if ( v11 ) | |
1563 v12 = AllocAlignedMem(v11, 640); | |
1564 else | |
1565 v12 = 0; | |
1566 v2->pMemBlocks[4] = v12; | |
1567 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1568 if ( v13 ) | |
1569 v14 = AllocAlignedMem(v13, 640); | |
1570 else | |
1571 v14 = 0; | |
1572 v2->pMemBlocks[5] = v14; | |
1573 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1574 if ( v15 ) | |
1575 v16 = AllocAlignedMem(v15, 640); | |
1576 else | |
1577 v16 = 0; | |
1578 v2->pMemBlocks[6] = v16; | |
1579 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1580 if ( v17 ) | |
1581 v18 = AllocAlignedMem(v17, 640); | |
1582 else | |
1583 v18 = 0; | |
1584 v2->pMemBlocks[7] = v18; | |
1585 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1586 if ( v19 ) | |
1587 v20 = AllocAlignedMem(v19, 640); | |
1588 else | |
1589 v20 = 0; | |
1590 v2->pMemBlocks[8] = v20; | |
1591 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1592 if ( v21 ) | |
1593 v22 = AllocAlignedMem(v21, 640); | |
1594 else | |
1595 v22 = 0; | |
1596 v2->pMemBlocks[9] = v22; | |
1597 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1598 if ( v23 ) | |
1599 v24 = AllocAlignedMem(v23, 640); | |
1600 else | |
1601 v24 = 0; | |
1602 v2->pMemBlocks[10] = v24; | |
1603 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1604 if ( v25 ) | |
1605 v26 = AllocAlignedMem(v25, 640); | |
1606 else | |
1607 v26 = 0; | |
1608 v2->field_8C = 0; | |
1609 v2->pMemBlocks[11] = v26;*/ | |
1610 } | |
1611 | |
1612 //----- (00489810) -------------------------------------------------------- | |
1613 stru12::~stru12() | |
1614 { | |
1615 for (int i = 0; i < 12; ++i) | |
1616 delete pMemBlocks[i]; | |
1617 /*if ( v2 ) | |
1618 stru12_MemoryBlock::dtor(v2, 1); | |
1619 v3 = v1->pMemBlocks[1]; | |
1620 if ( v3 ) | |
1621 stru12_MemoryBlock::dtor(v3, 1); | |
1622 v4 = v1->pMemBlocks[2]; | |
1623 if ( v4 ) | |
1624 stru12_MemoryBlock::dtor(v4, 1); | |
1625 v5 = v1->pMemBlocks[3]; | |
1626 if ( v5 ) | |
1627 stru12_MemoryBlock::dtor(v5, 1); | |
1628 v6 = v1->pMemBlocks[4]; | |
1629 if ( v6 ) | |
1630 stru12_MemoryBlock::dtor(v6, 1); | |
1631 v7 = v1->pMemBlocks[5]; | |
1632 if ( v7 ) | |
1633 stru12_MemoryBlock::dtor(v7, 1); | |
1634 v8 = v1->pMemBlocks[6]; | |
1635 if ( v8 ) | |
1636 stru12_MemoryBlock::dtor(v8, 1); | |
1637 v9 = v1->pMemBlocks[7]; | |
1638 if ( v9 ) | |
1639 stru12_MemoryBlock::dtor(v9, 1); | |
1640 v10 = v1->pMemBlocks[8]; | |
1641 if ( v10 ) | |
1642 stru12_MemoryBlock::dtor(v10, 1); | |
1643 v11 = v1->pMemBlocks[9]; | |
1644 if ( v11 ) | |
1645 stru12_MemoryBlock::dtor(v11, 1); | |
1646 v12 = v1->pMemBlocks[10]; | |
1647 if ( v12 ) | |
1648 stru12_MemoryBlock::dtor(v12, 1); | |
1649 v13 = v1->pMemBlocks[11]; | |
1650 if ( v13 ) | |
1651 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1652 } | |
1653 | |
1654 //----- (004898BF) -------------------------------------------------------- | |
1655 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1656 { | |
1657 stru12_MemoryBlock *v2; // esi@1 | |
1658 void *v3; // ST00_4@1 | |
1659 | |
1660 v2 = this; | |
1661 v3 = this->pBlockBase; | |
1662 this->pAlignedBlock = 0; | |
1663 free(v3); | |
1664 v2->pBlockBase = 0; | |
1665 /*if ( a2 & 1 ) | |
1666 free(v2);*/ | |
1667 } | |
1668 | |
1669 //----- (004898E6) -------------------------------------------------------- | |
1670 void stru12::_4898E6() | |
1671 { | |
1672 void *v1; // eax@1 | |
1673 void *v2; // edx@1 | |
1674 char *v3; // edi@2 | |
1675 double v4; // st7@2 | |
1676 char *v5; // ebx@2 | |
1677 double v6; // st6@3 | |
1678 double v7; // st5@3 | |
1679 double v8; // st4@3 | |
1680 int v9; // esi@3 | |
1681 double v10; // st3@3 | |
1682 float v11; // ST34_4@5 | |
1683 double v12; // st6@10 | |
1684 double v13; // ST0C_8@10 | |
1685 char *v14; // [sp+14h] [bp-44h]@2 | |
1686 char *v15; // [sp+18h] [bp-40h]@2 | |
1687 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1688 char *v17; // [sp+20h] [bp-38h]@2 | |
1689 char *v18; // [sp+24h] [bp-34h]@2 | |
1690 float v19; // [sp+30h] [bp-28h]@3 | |
1691 float v20; // [sp+38h] [bp-20h]@3 | |
1692 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1693 int v22; // [sp+40h] [bp-18h]@1 | |
1694 char *v23; // [sp+44h] [bp-14h]@2 | |
1695 char *v24; // [sp+48h] [bp-10h]@2 | |
1696 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1697 float v26; // [sp+50h] [bp-8h]@3 | |
1698 float v27; // [sp+54h] [bp-4h]@3 | |
1699 | |
731 | 1700 __debugbreak(); |
0 | 1701 v22 = 0; |
1702 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1703 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1704 if ( this->field_8C > 0 ) | |
1705 { | |
1706 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1707 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1708 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1709 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1710 v25 = (int)v1 - (int)v2; | |
1711 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1712 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1713 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1714 v4 = 1.0; | |
1715 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1716 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1717 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1718 do | |
1719 { | |
1720 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1721 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1722 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1723 v7 = pIndoorCamera->fRotationYCosine; | |
1724 v8 = pIndoorCamera->fRotationYSine; | |
1725 v20 = pIndoorCamera->fRotationXCosine; | |
1726 v19 = pIndoorCamera->fRotationXSine; | |
1727 v9 = (int)((char *)v2 + (int)v21); | |
1728 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1729 if ( pIndoorCamera->sRotationX ) | |
1730 { | |
1731 v11 = v10; | |
1732 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1733 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1734 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1735 } | |
1736 else | |
1737 { | |
1738 *(float *)v9 = v10; | |
1739 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1740 *(float *)((char *)v2 + (int)v5) = v6; | |
1741 } | |
1742 if ( *(float *)v9 >= 8.0 ) | |
1743 { | |
1744 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1745 { | |
1746 *(int *)v2 = 0; | |
1747 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1748 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1749 - v12 * *(float *)((char *)v2 + (int)v3); | |
1750 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1751 - v12 * *(float *)((char *)v2 + (int)v5); | |
1752 *(float *)((char *)v2 + (int)v16) = v4 | |
1753 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1754 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1755 v13 = *(float *)v9 + 6.7553994e15; | |
1756 v4 = 1.0; | |
1757 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1758 } | |
1759 else | |
1760 { | |
1761 *(int *)v2 = 2; | |
1762 } | |
1763 } | |
1764 else | |
1765 { | |
1766 *(int *)v2 = 1; | |
1767 } | |
1768 ++v22; | |
1769 v2 = (char *)v2 + 4; | |
1770 } | |
1771 while ( v22 < this->field_8C ); | |
1772 } | |
1773 this->field_8C = 0; | |
1774 } | |
1775 | |
1776 //----- (0048A959) -------------------------------------------------------- | |
1777 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1778 { | |
1779 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1780 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1781 b = (uColor & 0x000000FF) / 255.0f; | |
1782 | |
1783 float h, s, v; | |
1784 RGB2HSV(&h, &s, r, g, b, &v); | |
1785 | |
1786 if ( h_replace != -1.0 ) | |
1787 h = h_replace; | |
1788 if ( s_replace != -1.0 ) | |
1789 s = s_replace; | |
1790 if ( v_replace != -1.0 ) | |
1791 v = v_replace; | |
1792 HSV2RGB(&r, &g, &b, h, s, v); | |
1793 | |
1794 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1795 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1796 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1797 } | |
1798 | |
1799 //----- (0048B561) -------------------------------------------------------- | |
1800 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1801 { | |
1802 //v2 = a2 - 0.5; | |
1803 //v3 = v2 + 6.7553994e15; | |
1804 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1805 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1806 //v5 = v7 + 6.7553994e15; | |
1807 //return LODWORD(v5) | (v4 << 16); | |
1808 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1809 return v5 | (v4 << 16); | |
1810 } | |
1811 | |
1812 //----- (00491E3A) -------------------------------------------------------- | |
1813 void __cdecl sub_491E3A() | |
1814 { | |
1815 Player *v0; // ebx@1 | |
1816 signed int v1; // esi@3 | |
1817 char *v2; // eax@4 | |
1818 unsigned int v3; // eax@7 | |
1819 unsigned int v4; // edx@8 | |
1820 char *v5; // ecx@9 | |
1821 int v6; // edi@17 | |
1822 Texture *v7; // ebx@18 | |
1823 struct IDirect3DTexture2 **v8; // eax@19 | |
1824 struct IDirect3DTexture2 *v9; // eax@20 | |
1825 struct IDirectDrawSurface **v10; // eax@22 | |
1826 struct IDirectDrawSurface *v11; // eax@23 | |
1827 int v12; // eax@26 | |
1828 | |
1829 v0 = pParty->pPlayers; | |
1830 do | |
1831 { | |
203 | 1832 if (SoundSetAction[24][0]) |
0 | 1833 { |
1834 v1 = 0; | |
764 | 1835 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1836 { |
1837 LABEL_7: | |
1838 v3 = 0; | |
1839 } | |
1840 else | |
1841 { | |
1842 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1843 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1844 { |
1845 ++v1; | |
1846 v2 += 120; | |
764 | 1847 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1848 goto LABEL_7; |
1849 } | |
1850 v3 = v1; | |
1851 } | |
764 | 1852 pSoundList->UnloadSound(v3, 1); |
0 | 1853 v4 = 0; |
764 | 1854 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1855 { |
1856 LABEL_12: | |
1857 v4 = 0; | |
1858 } | |
1859 else | |
1860 { | |
1861 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1862 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1863 { |
1864 ++v4; | |
1865 v5 += 120; | |
764 | 1866 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1867 goto LABEL_12; |
1868 } | |
1869 } | |
764 | 1870 pSoundList->UnloadSound(v4, 1); |
0 | 1871 } |
1872 ++v0; | |
1873 } | |
1874 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1875 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1876 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1877 { |
1878 v7 = &pIcons_LOD->pTextures[v6]; | |
1879 do | |
1880 { | |
1881 v7->Release(); | |
1882 v8 = pIcons_LOD->pHardwareTextures; | |
1883 if ( v8 ) | |
1884 { | |
1885 v9 = v8[v6]; | |
1886 if ( v9 ) | |
1887 { | |
1888 v9->Release(); | |
1889 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1890 } | |
1891 } | |
1892 v10 = pIcons_LOD->pHardwareSurfaces; | |
1893 if ( v10 ) | |
1894 { | |
1895 v11 = v10[v6]; | |
1896 if ( v11 ) | |
1897 { | |
1898 v11->Release(); | |
1899 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1900 } | |
1901 } | |
1902 --v6; | |
1903 --v7; | |
1904 } | |
33 | 1905 while ( v6 >= pIcons_LOD->pFacesLock ); |
1906 } | |
1907 v12 = pIcons_LOD->pFacesLock; | |
1908 pIcons_LOD->pFacesLock = 0; | |
0 | 1909 pIcons_LOD->uNumLoadedFiles = v12; |
1910 } | |
1911 // 4ED498: using guessed type char byte_4ED498; | |
1912 | |
1913 //----- (0049387A) -------------------------------------------------------- | |
1914 int CycleCharacter(unsigned int _this) | |
1915 { | |
1916 signed int result; // eax@1 | |
1917 signed int v2; // ecx@2 | |
1918 signed int v3; // ecx@8 | |
1919 | |
1920 result = uActiveCharacter; | |
1921 if ( _this ) | |
1922 { | |
1923 v2 = 0; | |
1924 while ( 1 ) | |
1925 { | |
1926 --result; | |
1927 if ( result < 1 ) | |
1928 result = 4; | |
1929 if ( !pPlayers[result]->uTimeToRecovery ) | |
1930 break; | |
1931 ++v2; | |
1932 if ( v2 >= 4 ) | |
1933 return uActiveCharacter; | |
1934 } | |
1935 } | |
1936 else | |
1937 { | |
1938 v3 = 0; | |
1939 while ( 1 ) | |
1940 { | |
1941 ++result; | |
1942 if ( result > 4 ) | |
1943 result = 1; | |
1944 if ( !pPlayers[result]->uTimeToRecovery ) | |
1945 break; | |
1946 ++v3; | |
1947 if ( v3 >= 4 ) | |
1948 return uActiveCharacter; | |
1949 } | |
1950 } | |
1951 return result; | |
1952 } | |
1953 //----- (004938D1) -------------------------------------------------------- | |
1954 void __fastcall Rest(unsigned int uHoursToSleep) | |
1955 { | |
1956 unsigned int v1; // esi@1 | |
1957 double v2; // st7@3 | |
1958 Player **v3; // esi@3 | |
1959 | |
1960 v1 = uHoursToSleep; | |
1961 if ( uHoursToSleep > 240 ) | |
1962 InitializeActors(); | |
1963 v2 = (double)(7680 * v1) * 0.033333335; | |
1964 pParty->uTimePlayed += (signed __int64)v2; | |
1965 v3 = &pPlayers[1]; | |
1966 do | |
1967 { | |
1968 (*v3)->Recover((signed __int64)v2); | |
1969 ++v3; | |
1970 } | |
1971 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1972 _494035_timed_effects__water_walking_damage__etc(); | |
1973 } | |
1974 | |
1975 //----- (00493938) -------------------------------------------------------- | |
1976 int __cdecl _493938_regenerate() | |
1977 { | |
1978 int v0; // edi@1 | |
1979 signed __int64 v1; // qax@1 | |
1980 int v2; // ecx@1 | |
1981 int result; // eax@1 | |
1982 int v4; // eax@2 | |
1983 int v5; // edi@5 | |
112 | 1984 int *v6; // ecx@5 |
0 | 1985 char v7; // sf@5 |
112 | 1986 int *v8; // ecx@10 |
0 | 1987 int v9; // edi@15 |
1988 signed int v10; // eax@15 | |
1989 __int16 *v11; // edx@16 | |
1990 int v12; // eax@20 | |
1991 int v13; // ebx@20 | |
1992 unsigned int *v14; // esi@21 | |
1993 unsigned int v15; // ecx@21 | |
1994 unsigned int v16; // eax@21 | |
1995 int v17; // edx@21 | |
1996 int v18; // eax@21 | |
1997 signed int v19; // eax@21 | |
1998 signed int v20; // ebx@25 | |
1999 Player *v21; // esi@25 | |
2000 ITEM_EQUIP_TYPE v22; // edi@30 | |
2001 //int v23; // edx@31 | |
2002 signed int v24; // ecx@32 | |
2003 signed int v25; // eax@33 | |
2004 int v26; // eax@35 | |
2005 int v27; // eax@36 | |
2006 int v28; // eax@37 | |
2007 int v29; // eax@40 | |
2008 int v30; // eax@41 | |
2009 signed int v31; // ecx@53 | |
2010 char *v32; // eax@53 | |
2011 char *v33; // edi@82 | |
2012 int v34; // ecx@88 | |
2013 int v35; // eax@88 | |
2014 char *v36; // edi@99 | |
2015 int v37; // edi@104 | |
2016 int v38; // edi@106 | |
2017 int v39; // edi@111 | |
2018 int v40; // ecx@113 | |
2019 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
|
2020 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2021 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2022 int v44; // [sp+210h] [bp-20h]@22 | |
2023 int v45; // [sp+214h] [bp-1Ch]@25 | |
2024 int v46; // [sp+218h] [bp-18h]@25 | |
2025 int v47; // [sp+21Ch] [bp-14h]@25 | |
2026 int v48; // [sp+220h] [bp-10h]@25 | |
2027 int v49; // [sp+224h] [bp-Ch]@24 | |
2028 int v50; // [sp+228h] [bp-8h]@25 | |
2029 int v51; // [sp+22Ch] [bp-4h]@2 | |
2030 | |
2031 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2032 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2033 v2 = (signed int)v1 / 60; | |
2034 result = (signed int)v1 / 60 + 5; | |
2035 if ( v0 >= result ) | |
2036 { | |
2037 v51 = 0; | |
2038 v4 = (v0 - v2) / 5; | |
2039 if (pParty->FlyActive()) | |
2040 { | |
2041 if ( pParty->bFlying ) | |
2042 { | |
569 | 2043 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2044 { // colliding with something in the air - fall down | |
2045 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2046 //__debugbreak(); | |
2047 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2048 v7 = *v6 < v5; |
2049 *v6 -= v5; | |
0 | 2050 if ( v7 ) |
2051 { | |
112 | 2052 *v6 = 0; |
0 | 2053 pParty->uFlags &= 0xFFFFFFBFu; |
2054 pParty->bFlying = 0; | |
2055 v51 = 1; | |
2056 } | |
2057 } | |
2058 } | |
2059 } | |
569 | 2060 |
0 | 2061 if (pParty->WaterWalkActive()) |
2062 { | |
569 | 2063 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2064 { | |
2065 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2066 { // taking on water | |
2067 //__debugbreak(); | |
2068 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2069 v7 = *v8 < v4; |
2070 *v8 -= v4; | |
0 | 2071 if ( v7 ) |
2072 { | |
112 | 2073 *v8 = 0; |
569 | 2074 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2075 v51 = 1; |
2076 } | |
2077 } | |
2078 } | |
2079 } | |
569 | 2080 |
0 | 2081 if (pParty->ImmolationActive()) |
2082 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2083 //SpriteObject::SpriteObject(&a1); |
0 | 2084 v9 = 0; |
2085 a3.z = 0; | |
2086 a3.y = 0; | |
2087 a3.x = 0; | |
2088 a1.stru_24.Reset(); | |
822 | 2089 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2090 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2091 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2092 a1.uType = 1070; |
822 | 2093 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2094 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2095 { | |
2096 LABEL_19: | |
2097 LOWORD(v10) = 0; | |
2098 } | |
2099 else | |
2100 { | |
2101 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 2102 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 2103 { |
2104 ++v10; | |
2105 v11 += 28; | |
2106 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2107 goto LABEL_19; | |
2108 } | |
2109 } | |
2110 a1.uObjectDescID = v10; | |
2111 a1.field_60_distance_related_prolly_lod = 0; | |
2112 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2113 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2114 a1.uAttributes = 0; |
2115 a1.uSectorID = 0; | |
2116 a1.uSpriteFrameID = 0; | |
822 | 2117 a1.spell_caster_pid = v12; |
0 | 2118 a1.uFacing = 0; |
2119 a1.uSoundID = 0; | |
2120 v13 = sub_46A89E((int)v41, 100, 307); | |
2121 if ( v13 > 0 ) | |
2122 { | |
2123 do | |
2124 { | |
2125 v14 = (unsigned int *)&v41[4 * v9]; | |
2126 v15 = *v14; | |
2127 v16 = *v14; | |
2128 a1.vPosition.x = pActors[v16].vPosition.x; | |
2129 v17 = pActors[v16].vPosition.y; | |
2130 a1.vPosition.z = pActors[v16].vPosition.z; | |
2131 v18 = 8 * v15; | |
862 | 2132 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2133 a1.vPosition.y = v17; |
823 | 2134 a1.spell_target_pid = v18; |
0 | 2135 v19 = a1.Create(0, 0, 0, 0); |
862 | 2136 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2137 ++v9; |
2138 } | |
2139 while ( v9 < v13 ); | |
2140 } | |
2141 } | |
2142 v44 = 0; | |
248 | 2143 if (PartyHasDragon()) |
0 | 2144 v44 = 1; |
2145 v49 = 0; | |
2146 LABEL_25: | |
2147 v20 = 0; | |
2148 v21 = &pParty->pPlayers[v49]; | |
2149 v50 = 0; | |
2150 v47 = 0; | |
2151 v45 = 0; | |
2152 v48 = 0; | |
2153 v46 = 0; | |
255 | 2154 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2155 v50 = 1; |
135 | 2156 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2157 v48 = 1; |
2158 v22 = (ITEM_EQUIP_TYPE)0; | |
2159 while ( 1 ) | |
2160 { | |
2161 if ( v21->HasItemEquipped(v22) ) | |
2162 { | |
2163 //v23 = v21->pEquipment.pIndices; | |
2164 auto _idx = v21->pEquipment.pIndices[v22]; | |
2165 v24 = v21->pInventoryItems[_idx].uItemID; | |
2166 if ( v24 > 134 ) | |
2167 { | |
2168 if ( v24 == 529 ) | |
2169 goto LABEL_43; | |
2170 if ( v24 == 535 ) | |
2171 goto LABEL_44; | |
2172 if ( v24 == 515 ) | |
2173 { | |
2174 v47 = 1; | |
2175 } | |
2176 else | |
2177 { | |
2178 if ( v24 == 532 ) | |
2179 goto LABEL_50; | |
2180 } | |
2181 } | |
2182 else | |
2183 { | |
377 | 2184 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2185 if ( v25 <= 50 ) |
2186 { | |
2187 if ( v25 != 50 ) | |
2188 { | |
2189 v26 = v25 - 37; | |
2190 if ( v26 ) | |
2191 { | |
2192 v27 = v26 - 1; | |
2193 if ( !v27 ) | |
2194 goto LABEL_50; | |
2195 v28 = v27 - 6; | |
2196 if ( v28 ) | |
2197 { | |
2198 if ( v28 != 3 ) | |
2199 goto LABEL_51; | |
2200 LABEL_50: | |
2201 v50 = 1; | |
2202 goto LABEL_51; | |
2203 } | |
2204 } | |
2205 } | |
2206 LABEL_44: | |
2207 v20 = 1; | |
2208 goto LABEL_51; | |
2209 } | |
2210 v29 = v25 - 54; | |
2211 if ( !v29 ) | |
2212 goto LABEL_44; | |
2213 v30 = v29 - 1; | |
2214 if ( !v30 ) | |
2215 goto LABEL_50; | |
2216 if ( v30 == 11 ) | |
2217 { | |
2218 LABEL_43: | |
2219 v20 = 1; | |
2220 v50 = 1; | |
2221 goto LABEL_51; | |
2222 } | |
2223 } | |
2224 } | |
2225 LABEL_51: | |
2226 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2227 if ( (signed int)v22 >= 16 ) | |
2228 { | |
2229 if ( v48 ) | |
2230 { | |
2231 v31 = 0; | |
2232 v32 = (char *)v21->pInventoryItems; | |
2233 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2234 { | |
2235 ++v31; | |
2236 v32 += 36; | |
2237 if ( v31 >= 138 ) | |
2238 goto LABEL_59; | |
2239 } | |
2240 v48 = 0; | |
2241 v45 = 1; | |
2242 } | |
2243 LABEL_59: | |
2244 if ( v21->pConditions[17] ) | |
2245 v46 = 1; | |
2246 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2247 { | |
2248 ++v21->sHealth; | |
2249 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2250 v21->sHealth = v21->GetMaxHealth(); | |
2251 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2252 { | |
2253 LODWORD(v21->pConditions[13]) = 0; | |
2254 HIDWORD(v21->pConditions[13]) = 0; | |
2255 } | |
2256 v51 = 1; | |
2257 } | |
2258 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2259 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2260 && !v21->pConditions[14] | |
2261 && !v21->pConditions[16] ) | |
2262 { | |
2263 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2264 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2265 v21->sHealth = v21->GetMaxHealth(); | |
2266 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2267 { | |
2268 LODWORD(v21->pConditions[13]) = 0; | |
2269 HIDWORD(v21->pConditions[13]) = 0; | |
2270 } | |
2271 v51 = 1; | |
2272 } | |
2273 if ( v50 ) | |
2274 { | |
2275 v33 = (char *)&v21->sMana; | |
2276 ++*(int *)v33; | |
2277 if ( v21->sMana > v21->GetMaxMana() ) | |
2278 *(int *)v33 = v21->GetMaxMana(); | |
2279 v51 = 1; | |
2280 } | |
2281 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2282 { | |
2283 v34 = LODWORD(v21->pConditions[13]); | |
2284 --v21->sHealth; | |
2285 v35 = v21->sHealth; | |
2286 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2287 v21->pConditions[13] = pParty->uTimePlayed; | |
2288 if ( v35 < 1 ) | |
2289 { | |
2290 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2291 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2292 { | |
2293 v21->pConditions[13] = pParty->uTimePlayed; | |
2294 } | |
2295 else | |
2296 { | |
2297 if ( !v21->pConditions[14] ) | |
2298 v21->pConditions[14] = pParty->uTimePlayed; | |
2299 } | |
2300 } | |
2301 v51 = 1; | |
2302 } | |
2303 if ( v45 ) | |
2304 { | |
2305 v36 = (char *)&v21->sMana; | |
2306 ++*(int *)v36; | |
2307 if ( v21->sMana > v21->GetMaxMana() ) | |
2308 *(int *)v36 = v21->GetMaxMana(); | |
2309 } | |
2310 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2311 { | |
2312 v37 = v21->sHealth; | |
2313 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2314 v21->sHealth = v37 - 2; | |
2315 v38 = v21->sMana; | |
2316 if ( v38 > v21->GetMaxMana() / 2 ) | |
2317 v21->sMana = v38 - 2; | |
2318 } | |
2319 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2320 { | |
2321 v39 = v21->sHealth; | |
2322 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2323 v21->sHealth = v39 - 1; | |
2324 v40 = v21->sMana; | |
2325 if ( v40 > 0 ) | |
2326 v21->sMana = v40 - 1; | |
2327 } | |
2328 ++v49; | |
2329 if ( v49 >= 4 ) | |
2330 { | |
2331 result = HIDWORD(pParty->uTimePlayed); | |
2332 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2333 if ( !viewparams->bRedrawGameUI ) | |
2334 { | |
2335 result = v51; | |
2336 viewparams->bRedrawGameUI = v51; | |
2337 } | |
2338 return result; | |
2339 } | |
2340 goto LABEL_25; | |
2341 } | |
2342 } | |
2343 } | |
2344 return result; | |
2345 } | |
2346 | |
2347 //----- (00493F79) -------------------------------------------------------- | |
351 | 2348 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2349 { |
2350 signed __int64 v2; // ST2C_8@1 | |
2351 signed __int64 v3; // qax@1 | |
351 | 2352 //signed __int64 v4; // ST1C_8@1 |
0 | 2353 unsigned __int64 v5; // qax@1 |
2354 unsigned int v6; // ebx@1 | |
2355 | |
2356 v2 = (signed __int64)((double)a2 * 0.234375); | |
2357 v3 = v2 / 60 / 60; | |
351 | 2358 //v4 = v3; |
0 | 2359 v5 = (unsigned int)v3 / 0x18; |
2360 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2361 _this->field_0_expire_second = v2 % 60; |
2362 _this->field_4_expire_minute = v2 / 60 % 60; | |
2363 _this->field_8_expire_hour = v3 % 24; | |
2364 _this->field_10_expire_week = v5 / 7 & 3; | |
2365 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2366 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2367 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2368 } |
2369 | |
2370 //----- (00494035) -------------------------------------------------------- | |
2371 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2372 { | |
2373 signed __int64 v0; // qax@1 | |
2374 signed __int64 v1; // ST30_8@1 | |
2375 signed __int64 v2; // ST38_8@1 | |
2376 unsigned __int64 v3; // qax@1 | |
2377 unsigned int v4; // edi@1 | |
2378 //signed int v5; // eax@4 | |
2379 //char *v6; // ecx@5 | |
2380 //Player *v7; // esi@8 | |
2381 //char *v8; // ecx@12 | |
766 | 2382 //Player *pPlayer; // esi@15 |
0 | 2383 //void *v10; // esi@25 |
2384 unsigned int v11; // ecx@27 | |
2385 signed int v12; // edi@29 | |
2386 Player *v13; // ecx@30 | |
2387 Player *v14; // esi@35 | |
2388 double v15; // st7@35 | |
2389 Player **v16; // esi@43 | |
2390 Player *v17; // edi@44 | |
2391 double v18; // st7@44 | |
816 | 2392 //float v19; // ST28_4@48 |
2393 //double v20; // ST38_8@48 | |
0 | 2394 Player *v21; // esi@51 |
2395 signed int v22; // edi@53 | |
2396 int v23; // eax@59 | |
2397 int v24; // ecx@60 | |
2398 int v25; // eax@63 | |
2399 int v26; // ecx@64 | |
2400 int v27; // eax@67 | |
2401 int v28; // ecx@68 | |
2402 int v29; // eax@71 | |
2403 int v30; // ecx@72 | |
2404 int v31; // eax@75 | |
2405 int v32; // ecx@76 | |
2406 int v33; // eax@79 | |
2407 int v34; // ecx@80 | |
2408 int v35; // eax@83 | |
2409 int v36; // ecx@84 | |
2410 int v37; // eax@87 | |
2411 int v38; // ecx@88 | |
2412 int v39; // eax@91 | |
2413 int v40; // ecx@92 | |
2414 int v41; // eax@95 | |
2415 int v42; // ecx@96 | |
2416 bool v43; // ebx@102 | |
2417 //SpellBuff *v44; // edi@104 | |
2418 //signed int v45; // ebp@104 | |
2419 bool v46; // edi@111 | |
2420 //SpellBuff *v47; // esi@113 | |
2421 //Player **v48; // esi@119 | |
2422 //signed int v49; // edi@121 | |
2423 //char *v50; // esi@122 | |
2424 signed int v51; // edx@128 | |
2425 signed int v52; // ecx@130 | |
2426 int v53; // eax@131 | |
2427 Player *v54; // eax@141 | |
766 | 2428 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2429 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2430 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2431 int v58; // [sp-4h] [bp-34h]@33 |
2432 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2433 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2434 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2435 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2436 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2437 signed int a2a; // [sp+18h] [bp-18h]@47 |
2438 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2439 | |
766 | 2440 //a2 = pParty->uCurrentHour; |
0 | 2441 v61 = pParty->uDaysPlayed; |
816 | 2442 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2443 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2444 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2445 v1 = v0; |
2446 v0 /= 60i64; | |
2447 v2 = v0; | |
2448 v3 = (unsigned int)v0 / 24; | |
2449 v4 = (unsigned int)(v3 / 7) >> 2; | |
2450 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2451 pParty->uCurrentMinute = v1 % 60; | |
2452 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2453 pParty->uCurrentHour = v2 % 24; | |
2454 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2455 pParty->uCurrentMonth = v4 % 12; | |
352 | 2456 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2457 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2458 { |
2459 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2460 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2461 | |
2462 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2463 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2464 | |
766 | 2465 ++pParty->days_played_without_rest; |
2466 if (pParty->days_played_without_rest > 1) | |
0 | 2467 { |
2468 for (uint i = 0; i < 4; ++i) | |
766 | 2469 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2470 | |
2471 if (pParty->uNumFoodRations) | |
2472 Party::TakeFood(1); | |
0 | 2473 else |
2474 for (uint i = 0; i < 4; ++i) | |
766 | 2475 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2476 | |
2477 if (pParty->days_played_without_rest > 3) | |
2478 for (uint i = 0; i < 4; ++i) | |
0 | 2479 { |
766 | 2480 auto player = pParty->pPlayers + i; |
2481 | |
2482 player->Zero(); | |
2483 | |
2484 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2485 { |
767 | 2486 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2487 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2488 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2489 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2490 } |
2491 } | |
766 | 2492 } |
2493 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2494 pOutdoor->SetFog(); |
2495 | |
2496 for (uint i = 0; i < 4; ++i) | |
2497 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2498 } | |
766 | 2499 |
0 | 2500 v11 = LODWORD(pParty->uTimePlayed); |
2501 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2502 { | |
2503 v12 = 1; | |
2504 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2505 viewparams->bRedrawGameUI = 1; | |
2506 while ( 1 ) | |
2507 { | |
2508 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2509 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2510 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2511 { |
2512 v58 = 0; | |
2513 } | |
2514 else | |
2515 { | |
2516 v58 = 0; | |
2517 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2518 { | |
2519 v14 = pPlayers[v12]; | |
2520 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2521 v14->ReceiveDamage((signed __int64)v15, 0); | |
2522 if ( pParty->uFlags & 4 ) | |
2523 { | |
783 | 2524 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2525 GameUI_Footer_TimeLeft = 128; | |
0 | 2526 } |
2527 goto LABEL_39; | |
2528 } | |
2529 v13 = pPlayers[v12]; | |
2530 } | |
130 | 2531 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2532 LABEL_39: |
2533 ++v12; | |
2534 if ( v12 > 4 ) | |
2535 { | |
2536 v11 = LODWORD(pParty->uTimePlayed); | |
2537 break; | |
2538 } | |
2539 } | |
2540 } | |
2541 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2542 { | |
2543 viewparams->bRedrawGameUI = 1; | |
2544 pParty->field_6FC = v11 + 128; | |
2545 v16 = &pPlayers[1]; | |
2546 do | |
2547 { | |
2548 v17 = *v16; | |
2549 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2550 v17->ReceiveDamage((signed __int64)v18, 0); | |
2551 if ( pParty->uFlags & 0x200 ) | |
2552 { | |
783 | 2553 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2554 GameUI_Footer_TimeLeft = 128; | |
0 | 2555 } |
2556 ++v16; | |
2557 } | |
2558 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2559 } | |
2560 _493938_regenerate(); | |
2561 v65 = 4; | |
816 | 2562 a2a = pEventTimer->uTimeElapsed; |
2563 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2564 { | |
2565 //v19 = (double)(signed int)prev_time * 0.5; | |
2566 //v20 = v19 + 6.7553994e15; | |
2567 a2a *= 0.5f; | |
2568 if (a2a < 1) | |
0 | 2569 a2a = 1; |
2570 } | |
2571 v62 = &pPlayers[1]; | |
2572 do | |
2573 { | |
2574 v21 = *v62; | |
2575 if ( (*v62)->uTimeToRecovery ) | |
2576 v21->Recover(a2a); | |
2577 v22 = v21->sHealth; | |
2578 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2579 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2580 { | |
2581 if ( v22 >= 1 ) | |
2582 goto LABEL_59; | |
2583 v59 = 0; | |
2584 v56 = 13; | |
2585 } | |
2586 else | |
2587 { | |
2588 v59 = 0; | |
2589 v56 = 14; | |
2590 } | |
2591 v21->SetCondition(v56, v59); | |
2592 LABEL_59: | |
2593 v23 = (int)&v21->field_E0; | |
2594 if ( v21->field_E0 ) | |
2595 { | |
816 | 2596 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2597 if ( v24 > 0 ) |
2598 { | |
2599 *(int *)v23 = v24; | |
2600 } | |
2601 else | |
2602 { | |
2603 *(int *)v23 = 0; | |
2604 viewparams->bRedrawGameUI = 1; | |
2605 } | |
2606 } | |
2607 v25 = (int)&v21->field_E4; | |
2608 if ( v21->field_E4 ) | |
2609 { | |
816 | 2610 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2611 if ( v26 > 0 ) |
2612 { | |
2613 *(int *)v25 = v26; | |
2614 } | |
2615 else | |
2616 { | |
2617 *(int *)v25 = 0; | |
2618 viewparams->bRedrawGameUI = 1; | |
2619 } | |
2620 } | |
2621 v27 = (int)&v21->field_E8; | |
2622 if ( v21->field_E8 ) | |
2623 { | |
816 | 2624 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2625 if ( v28 > 0 ) |
2626 { | |
2627 *(int *)v27 = v28; | |
2628 } | |
2629 else | |
2630 { | |
2631 *(int *)v27 = 0; | |
2632 viewparams->bRedrawGameUI = 1; | |
2633 } | |
2634 } | |
2635 v29 = (int)&v21->field_EC; | |
2636 if ( v21->field_EC ) | |
2637 { | |
816 | 2638 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2639 if ( v30 > 0 ) |
2640 { | |
2641 *(int *)v29 = v30; | |
2642 } | |
2643 else | |
2644 { | |
2645 *(int *)v29 = 0; | |
2646 viewparams->bRedrawGameUI = 1; | |
2647 } | |
2648 } | |
2649 v31 = (int)&v21->field_F0; | |
2650 if ( v21->field_F0 ) | |
2651 { | |
816 | 2652 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2653 if ( v32 > 0 ) |
2654 { | |
2655 *(int *)v31 = v32; | |
2656 } | |
2657 else | |
2658 { | |
2659 *(int *)v31 = 0; | |
2660 viewparams->bRedrawGameUI = 1; | |
2661 } | |
2662 } | |
2663 v33 = (int)&v21->field_F4; | |
2664 if ( v21->field_F4 ) | |
2665 { | |
816 | 2666 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2667 if ( v34 > 0 ) |
2668 { | |
2669 *(int *)v33 = v34; | |
2670 } | |
2671 else | |
2672 { | |
2673 *(int *)v33 = 0; | |
2674 viewparams->bRedrawGameUI = 1; | |
2675 } | |
2676 } | |
2677 v35 = (int)&v21->field_F8; | |
2678 if ( v21->field_F8 ) | |
2679 { | |
816 | 2680 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2681 if ( v36 > 0 ) |
2682 { | |
2683 *(int *)v35 = v36; | |
2684 } | |
2685 else | |
2686 { | |
2687 *(int *)v35 = 0; | |
2688 viewparams->bRedrawGameUI = 1; | |
2689 } | |
2690 } | |
2691 v37 = (int)&v21->field_FC; | |
2692 if ( v21->field_FC ) | |
2693 { | |
816 | 2694 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2695 if ( v38 > 0 ) |
2696 { | |
2697 *(int *)v37 = v38; | |
2698 } | |
2699 else | |
2700 { | |
2701 *(int *)v37 = 0; | |
2702 viewparams->bRedrawGameUI = 1; | |
2703 } | |
2704 } | |
2705 v39 = (int)&v21->field_100; | |
2706 if ( v21->field_100 ) | |
2707 { | |
816 | 2708 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2709 if ( v40 > 0 ) |
2710 { | |
2711 *(int *)v39 = v40; | |
2712 } | |
2713 else | |
2714 { | |
2715 *(int *)v39 = 0; | |
2716 viewparams->bRedrawGameUI = 1; | |
2717 } | |
2718 } | |
2719 v41 = (int)&v21->field_104; | |
2720 if ( v21->field_104 ) | |
2721 { | |
816 | 2722 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2723 if ( v42 > 0 ) |
2724 { | |
2725 *(int *)v41 = v42; | |
2726 } | |
2727 else | |
2728 { | |
2729 *(int *)v41 = 0; | |
2730 viewparams->bRedrawGameUI = 1; | |
2731 } | |
2732 } | |
2733 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2734 --v65; | |
2735 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2736 | |
2737 for (uint k = 0; k < 24; ++k) | |
2738 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2739 | |
2740 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2741 v21->SetCondition(1u, 0); | |
2742 ++v62; | |
2743 } | |
2744 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2745 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2746 | |
2747 for (uint i = 0; i < 20; ++i) | |
2748 { | |
2749 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2750 viewparams->bRedrawGameUI = 1; | |
2751 } | |
2752 | |
2753 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2754 { | |
2755 for (uint i = 0; i < 4; ++i) | |
2756 pParty->pPlayers[i].SetCondition(1, 0); | |
2757 } | |
2758 | |
2759 for (uint i = 0; i < 2; ++i) | |
2760 { | |
2761 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2762 if (pBuf->uExpireTime == 0) | |
2763 continue; | |
2764 | |
2765 if ( !(pBuf->uFlags & 1) ) | |
2766 { | |
2767 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2768 { | |
2769 pBuf->Reset(); | |
2770 if (dword_4EE07C[i] == 7 ) | |
2771 pParty->bFlying = false; | |
2772 } | |
2773 } | |
2774 } | |
2775 | |
2776 v51 = v65; | |
2777 if ( v65 ) | |
2778 goto LABEL_135; | |
151 | 2779 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2780 { |
2781 v52 = (signed int)&pPlayers[1]; | |
2782 while ( 1 ) | |
2783 { | |
2784 v53 = *(int *)v52; | |
2785 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2786 break; | |
2787 v52 += 4; | |
2788 if ( v52 > (signed int)&pPlayers[4] ) | |
2789 goto LABEL_135; | |
2790 } | |
2791 *(int *)(v53 + 16) = 0; | |
2792 *(int *)(v53 + 20) = 0; | |
2793 v51 = 1; | |
2794 LABEL_135: | |
151 | 2795 if ( pCurrentScreen != SCREEN_REST |
0 | 2796 && (!v51 || dword_5C35C0) ) |
2797 uGameState = 8; | |
2798 } | |
2799 if ( uActiveCharacter ) | |
2800 { | |
151 | 2801 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2802 { |
2803 v54 = pPlayers[uActiveCharacter]; | |
2804 if ( v54->pConditions[2] | |
2805 || v54->pConditions[12] | |
2806 || v54->pConditions[13] | |
2807 || v54->pConditions[14] | |
2808 || v54->pConditions[15] | |
2809 || v54->pConditions[16] ) | |
2810 { | |
2811 viewparams->bRedrawGameUI = 1; | |
2812 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2813 } | |
2814 } | |
2815 } | |
2816 } | |
2817 | |
2818 //----- (00494820) -------------------------------------------------------- | |
758 | 2819 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2820 { |
2821 signed int v1; // eax@1 | |
2822 | |
2823 v1 = 5; | |
758 | 2824 if ( a1 % 24 >= 5 ) |
0 | 2825 v1 = 29; |
758 | 2826 return v1 - a1 % 24; |
0 | 2827 } |
2828 | |
2829 //----- (00494836) -------------------------------------------------------- | |
2830 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2831 { | |
2832 int v3; // esi@1 | |
2833 int result; // eax@1 | |
2834 stru339_spell_sound *v5; // ebx@1 | |
2835 int *v6; // edi@2 | |
2836 unsigned int v7; // eax@3 | |
2837 int v8; // [sp+Ch] [bp-8h]@3 | |
2838 int v9; // [sp+10h] [bp-4h]@2 | |
2839 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2840 | |
2841 v3 = 0; | |
2842 result = word_4EE088_sound_ids[uSoundID]; | |
2843 v5 = this; | |
2844 a2a = word_4EE088_sound_ids[uSoundID]; | |
2845 if ( result ) | |
2846 { | |
2847 v9 = 0; | |
2848 v6 = this->pSoundsOffsets; | |
2849 do | |
2850 { | |
2851 v7 = a2a++; | |
2852 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2853 if ( !result ) | |
2854 break; | |
2855 a6 += 4; | |
2856 result = v8 + 256; | |
2857 *v6 = v3; | |
2858 v3 += result; | |
2859 ++v9; | |
2860 *(v6 - 2) = result; | |
2861 ++v6; | |
2862 } | |
2863 while ( v9 < 2 ); | |
2864 } | |
2865 return result; | |
2866 } | |
2867 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2868 | |
2869 //----- (00494AED) -------------------------------------------------------- | |
130 | 2870 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2871 { |
2872 unsigned int _uNumFrames; // edx@1 | |
2873 unsigned int result; // eax@1 | |
2874 PlayerFrame *v4; // ecx@2 | |
2875 | |
2876 _uNumFrames = this->uNumFrames; | |
2877 result = 0; | |
2878 if ( (signed int)this->uNumFrames <= 0 ) | |
2879 { | |
2880 LABEL_5: | |
2881 result = 0; | |
2882 } | |
2883 else | |
2884 { | |
2885 v4 = this->pFrames; | |
130 | 2886 while ( v4->expression != expression ) |
0 | 2887 { |
2888 ++result; | |
2889 ++v4; | |
2890 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2891 goto LABEL_5; | |
2892 } | |
2893 } | |
2894 return result; | |
2895 } | |
2896 | |
2897 //----- (00494B10) -------------------------------------------------------- | |
2898 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2899 { | |
2900 unsigned int v3; // esi@1 | |
2901 PlayerFrame *v4; // edi@1 | |
2902 PlayerFrame *v5; // ecx@1 | |
2903 __int16 v6; // dx@2 | |
2904 int v7; // edx@3 | |
2905 char *i; // eax@3 | |
2906 int v9; // ecx@5 | |
2907 PlayerFrame *result; // eax@6 | |
2908 | |
2909 v3 = uFramesetID; | |
2910 v4 = this->pFrames; | |
2911 v5 = &v4[uFramesetID]; | |
2912 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2913 { | |
2914 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2915 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2916 { | |
2917 v9 = *(short *)i; | |
2918 if ( v7 <= v9 ) | |
2919 break; | |
2920 v7 -= v9; | |
2921 ++v3; | |
2922 } | |
2923 result = &v4[v3]; | |
2924 } | |
2925 else | |
2926 { | |
2927 result = &v4[uFramesetID]; | |
2928 } | |
2929 return result; | |
2930 } | |
2931 | |
2932 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2933 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2934 { |
2935 PlayerFrameTable *v4; // edi@1 | |
2936 int v5; // esi@1 | |
2937 int v6; // eax@2 | |
2938 | |
2939 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2940 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2941 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
|
2942 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2943 *pAnimTime = v5; |
0 | 2944 } |
2945 else | |
2946 { | |
2947 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2948 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2949 *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
|
2950 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2951 return &v4->pFrames[*pFramesetID]; |
0 | 2952 } |
2953 | |
2954 //----- (00494BC3) -------------------------------------------------------- | |
2955 void PlayerFrameTable::ToFile() | |
2956 { | |
2957 PlayerFrameTable *v1; // esi@1 | |
2958 FILE *v2; // eax@1 | |
2959 FILE *v3; // edi@1 | |
2960 | |
2961 auto Str = this; | |
2962 | |
2963 v1 = Str; | |
2964 v2 = fopen("data\\dpft.bin", "wb"); | |
2965 v3 = v2; | |
2966 if ( !v2 ) | |
2967 Abortf("Unable to save dpft.bin!"); | |
2968 fwrite(v1, 4u, 1u, v2); | |
2969 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2970 fclose(v3); | |
2971 } | |
2972 | |
2973 //----- (00494C0F) -------------------------------------------------------- | |
2974 void PlayerFrameTable::FromFile(void *pSerialized) | |
2975 { | |
2976 uNumFrames = *(int *)pSerialized; | |
2977 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2978 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2979 } | |
2980 | |
2981 //----- (00494C5A) -------------------------------------------------------- | |
2982 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2983 { | |
2984 PlayerFrameTable *v2; // ebx@1 | |
2985 FILE *v3; // eax@1 | |
2986 int v4; // esi@3 | |
2987 void *v5; // eax@10 | |
2988 FILE *v6; // ST0C_4@12 | |
2989 char *i; // eax@12 | |
2990 __int16 v8; // ax@15 | |
2991 const char *v9; // ST10_4@15 | |
2992 unsigned __int16 v10; // ax@15 | |
2993 const char *v11; // ST0C_4@15 | |
2994 int j; // esi@15 | |
2995 int v13; // eax@17 | |
2996 int v14; // edx@22 | |
2997 int v15; // ecx@23 | |
2998 int v16; // eax@24 | |
2999 signed int k; // eax@27 | |
3000 PlayerFrame *v18; // edx@28 | |
3001 int v19; // esi@28 | |
3002 int l; // ecx@29 | |
3003 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3004 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3005 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3006 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3007 int v26; // [sp+2FCh] [bp-8h]@3 | |
3008 FILE *File; // [sp+300h] [bp-4h]@1 | |
3009 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3010 | |
3011 v2 = this; | |
3012 //TileTable::dtor((TileTable *)this); | |
3013 v3 = fopen(Args, "r"); | |
3014 File = v3; | |
3015 if ( !v3 ) | |
3016 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3017 v4 = 0; | |
3018 v25 = 0; | |
3019 v26 = 1; | |
3020 if ( fgets(&Buf, 490, v3) ) | |
3021 { | |
3022 do | |
3023 { | |
3024 *strchr(&Buf, 10) = 0; | |
703 | 3025 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3026 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3027 { | |
3028 if ( v24.uPropCount < 3 ) | |
0 | 3029 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3030 ++v25; | |
3031 } | |
3032 ++v26; | |
3033 } | |
3034 while ( fgets(&Buf, 490, File) ); | |
3035 v4 = v25; | |
3036 } | |
3037 v2->uNumFrames = v4; | |
3038 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3039 v2->pFrames = (PlayerFrame *)v5; | |
3040 if ( !v5 ) | |
3041 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3042 v6 = File; | |
3043 v2->uNumFrames = 0; | |
3044 fseek(v6, 0, 0); | |
3045 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3046 { | |
3047 *strchr(&Buf, 10) = 0; | |
703 | 3048 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3049 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3050 { |
3051 v8 = atoi(v24.pProperties[0]); | |
3052 v9 = v24.pProperties[1]; | |
130 | 3053 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3054 v10 = atoi(v9); |
3055 v11 = v24.pProperties[2]; | |
3056 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3057 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3058 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3059 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3060 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3061 { |
3062 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3063 { | |
3064 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3065 *(char *)v13 |= 4u; | |
3066 } | |
3067 } | |
3068 ++v2->uNumFrames; | |
3069 } | |
3070 } | |
3071 fclose(File); | |
3072 v14 = 0; | |
3073 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3074 { | |
3075 v15 = 0; | |
3076 do | |
3077 { | |
3078 v16 = (int)&v2->pFrames[v15]; | |
3079 if ( !(*(char *)(v16 + 18) & 4) ) | |
3080 *(char *)(v16 + 8) |= 1u; | |
3081 ++v14; | |
3082 ++v15; | |
3083 } | |
3084 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3085 } | |
3086 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3087 { | |
3088 v18 = v2->pFrames; | |
3089 Argsa = (int)&v18[k]; | |
3090 v19 = *(short *)(Argsa + 4); | |
3091 if ( *(char *)(Argsa + 8) & 1 ) | |
3092 { | |
3093 ++k; | |
3094 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3095 { | |
3096 v19 += *(short *)(l + 4); | |
3097 ++k; | |
3098 } | |
3099 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3100 } | |
3101 ++k; | |
3102 } | |
3103 return 1; | |
3104 } | |
3105 | |
3106 //----- (00494F3A) -------------------------------------------------------- | |
3107 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3108 { | |
3109 IconFrameTable *v2; // esi@1 | |
3110 int v3; // ebx@1 | |
3111 unsigned int uID; // edi@1 | |
3112 unsigned int result; // eax@4 | |
3113 | |
3114 v2 = this; | |
3115 v3 = 0; | |
3116 uID = 0; | |
3117 if ( (signed int)this->uNumIcons <= 0 ) | |
3118 { | |
3119 LABEL_4: | |
3120 result = 0; | |
3121 } | |
3122 else | |
3123 { | |
3124 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3125 { | |
3126 ++uID; | |
3127 ++v3; | |
3128 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3129 goto LABEL_4; | |
3130 } | |
3131 result = uID; | |
3132 } | |
3133 return result; | |
3134 } | |
3135 | |
3136 //----- (00494F70) -------------------------------------------------------- | |
3137 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3138 { | |
3139 IconFrame *v3; // edi@1 | |
3140 IconFrame *v4; // ecx@1 | |
3141 __int16 v5; // dx@2 | |
3142 int v6; // edx@3 | |
3143 unsigned int v7; // eax@3 | |
3144 char *i; // ecx@3 | |
3145 int v9; // esi@5 | |
3146 IconFrame *result; // eax@6 | |
3147 | |
3148 v3 = this->pIcons; | |
3149 v4 = &v3[uIconID]; | |
3150 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3151 { | |
3152 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3153 v7 = uIconID; | |
3154 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3155 { | |
3156 v9 = *(short *)i; | |
3157 if ( v6 <= v9 ) | |
3158 break; | |
3159 v6 -= v9; | |
3160 ++v7; | |
3161 } | |
3162 result = &v3[v7]; | |
3163 } | |
3164 else | |
3165 { | |
3166 result = &v3[uIconID]; | |
3167 } | |
3168 return result; | |
3169 } | |
3170 | |
3171 //----- (00494FBF) -------------------------------------------------------- | |
3172 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3173 { | |
3174 IconFrameTable *v2; // esi@1 | |
3175 unsigned int v3; // edi@3 | |
3176 const char *i; // eax@3 | |
3177 IconFrame *v5; // eax@5 | |
3178 | |
3179 v2 = this; | |
3180 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3181 { | |
3182 v3 = uIconID; | |
3183 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3184 { | |
3185 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3186 v5 = v2->pIcons; | |
3187 if ( !(v5[v3].uFlags & 1) ) | |
3188 break; | |
3189 ++v3; | |
3190 } | |
3191 } | |
3192 } | |
3193 | |
3194 //----- (0049500A) -------------------------------------------------------- | |
3195 void IconFrameTable::ToFile() | |
3196 { | |
3197 IconFrameTable *v1; // esi@1 | |
3198 FILE *v2; // eax@1 | |
3199 FILE *v3; // edi@1 | |
3200 | |
3201 auto Str = this; | |
3202 | |
3203 v1 = Str; | |
3204 v2 = fopen("data\\dift.bin", "wb"); | |
3205 v3 = v2; | |
3206 if ( !v2 ) | |
3207 Abortf("Unable to save dift.bin!"); | |
3208 fwrite(v1, 4u, 1u, v2); | |
3209 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3210 fclose(v3); | |
3211 } | |
3212 | |
3213 //----- (00495056) -------------------------------------------------------- | |
3214 void IconFrameTable::FromFile(void *pSerialized) | |
3215 { | |
3216 uNumIcons = *(int *)pSerialized; | |
3217 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3218 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3219 } | |
3220 | |
3221 //----- (0049509D) -------------------------------------------------------- | |
3222 int IconFrameTable::FromFileTxt(const char *Args) | |
3223 { | |
3224 IconFrameTable *v2; // ebx@1 | |
3225 FILE *v3; // eax@1 | |
3226 int v4; // esi@3 | |
3227 void *v5; // eax@10 | |
3228 FILE *v6; // ST0C_4@12 | |
3229 char *i; // eax@12 | |
3230 const char *v8; // ST00_4@15 | |
3231 int v9; // eax@16 | |
3232 int v10; // edx@20 | |
3233 int v11; // ecx@21 | |
3234 int v12; // eax@22 | |
3235 signed int j; // edx@25 | |
3236 IconFrame *v14; // ecx@26 | |
3237 int v15; // esi@26 | |
3238 int k; // eax@27 | |
3239 signed int result; // eax@11 | |
3240 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3241 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3242 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3243 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3244 int v22; // [sp+2FCh] [bp-8h]@3 | |
3245 FILE *File; // [sp+300h] [bp-4h]@1 | |
3246 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3247 | |
3248 v2 = this; | |
3249 //TileTable::dtor((TileTable *)this); | |
3250 v3 = fopen(Args, "r"); | |
3251 File = v3; | |
3252 if ( !v3 ) | |
3253 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3254 v4 = 0; | |
3255 v21 = 0; | |
3256 v22 = 1; | |
3257 if ( fgets(&Buf, 490, v3) ) | |
3258 { | |
3259 do | |
3260 { | |
3261 *strchr(&Buf, 10) = 0; | |
3262 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3263 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3264 { | |
3265 if ( v20.uPropCount < 3 ) | |
0 | 3266 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3267 ++v21; | |
3268 } | |
3269 ++v22; | |
3270 } | |
3271 while ( fgets(&Buf, 490, File) ); | |
3272 v4 = v21; | |
3273 } | |
3274 v2->uNumIcons = v4; | |
3275 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3276 v2->pIcons = (IconFrame *)v5; | |
3277 if ( v5 ) | |
3278 { | |
3279 v6 = File; | |
3280 v2->uNumIcons = 0; | |
3281 fseek(v6, 0, 0); | |
3282 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3283 { | |
3284 *strchr(&Buf, 10) = 0; | |
3285 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3286 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3287 { |
3288 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3289 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3290 v8 = v20.pProperties[2]; | |
3291 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3292 if ( !_strcmpi(v8, "new") ) | |
3293 { | |
3294 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3295 *(char *)v9 |= 4u; | |
3296 } | |
3297 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3298 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3299 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3300 } | |
3301 } | |
3302 fclose(File); | |
3303 v10 = 0; | |
3304 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3305 { | |
3306 v11 = 0; | |
3307 do | |
3308 { | |
3309 v12 = (int)&v2->pIcons[v11]; | |
3310 if ( !(*(char *)(v12 + 60) & 4) ) | |
3311 *(char *)(v12 + 28) |= 1u; | |
3312 ++v10; | |
3313 ++v11; | |
3314 } | |
3315 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3316 } | |
3317 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3318 { | |
3319 v14 = v2->pIcons; | |
3320 Argsa = (int)&v14[j]; | |
3321 v15 = *(short *)(Argsa + 24); | |
3322 if ( *(char *)(Argsa + 28) & 1 ) | |
3323 { | |
3324 ++j; | |
3325 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3326 { | |
3327 v15 += *(short *)(k + 24); | |
3328 ++j; | |
3329 } | |
3330 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3331 } | |
3332 ++j; | |
3333 } | |
3334 result = 1; | |
3335 } | |
3336 else | |
3337 { | |
3338 fclose(File); | |
3339 result = 0; | |
3340 } | |
3341 return result; | |
3342 } | |
3343 | |
3344 //----- (00495366) -------------------------------------------------------- | |
3345 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3346 { | |
3347 int v2; // edi@1 | |
3348 int v3; // edx@2 | |
3349 int v4; // esi@3 | |
3350 int v5; // ebx@5 | |
3351 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3352 signed int v8; // [sp+10h] [bp-10h]@1 | |
3353 int **v9; // [sp+14h] [bp-Ch]@4 | |
3354 signed int v10; // [sp+18h] [bp-8h]@3 | |
3355 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3356 | |
3357 v2 = a1; | |
3358 v11 = a2; | |
3359 v8 = 0; | |
3360 v7 = 0; | |
3361 if ( dword_AE336C == a1 ) | |
3362 { | |
3363 v3 = dword_AE3370; | |
3364 } | |
3365 else | |
3366 { | |
3367 v4 = a2; | |
3368 dword_AE336C = a1; | |
3369 v10 = 0; | |
3370 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3371 goto LABEL_17; | |
3372 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3373 do | |
3374 { | |
3375 v5 = tolower(*(char *)*v9); | |
3376 if ( v5 == tolower(v2) ) | |
3377 { | |
3378 if ( v8 ) | |
3379 v7 = v10; | |
3380 else | |
3381 v8 = v10; | |
3382 } | |
3383 ++v10; | |
3384 v9 += 2; | |
3385 } | |
3386 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3387 if ( v8 && v8 != v7 ) | |
3388 v3 = v8 + rand() % (v7 - v8); | |
3389 else | |
3390 LABEL_17: | |
3391 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3392 } | |
3393 dword_AE3370 = v3; | |
3394 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3395 } | |
3396 // AE336C: using guessed type int dword_AE336C; | |
3397 // AE3370: using guessed type int dword_AE3370; | |
3398 | |
3399 //----- (00495430) -------------------------------------------------------- | |
607 | 3400 char * GetReputationString( signed int a1 ) |
3401 { | |
566 | 3402 if (a1 >= 25) |
3403 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3404 else if (a1 >= 6) | |
3405 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3406 else if (a1 >= -5) | |
3407 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3408 else if (a1 >= -24) | |
3409 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3410 else |
566 | 3411 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3412 } |
3413 | |
3414 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3415 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3416 { |
3417 unsigned __int8 v6; // bl@1 | |
3418 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3419 //NPCData *v9; // eax@4 |
250 | 3420 //size_t v10; // eax@6 |
0 | 3421 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3422 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3423 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3424 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3425 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3426 //int v16; // edx@10 |
0 | 3427 int v17; // eax@10 |
3428 signed __int64 v18; // qax@18 | |
3429 unsigned int v19; // edi@32 | |
3430 unsigned __int8 *v20; // ebx@32 | |
3431 int v21; // ecx@34 | |
3432 __int16 v22; // ax@34 | |
3433 int v23; // edx@39 | |
3434 int v24; // eax@39 | |
3435 int v25; // eax@45 | |
3436 float *v26; // esi@68 | |
3437 float v27; // ST18_4@68 | |
3438 signed int v28; // eax@68 | |
3439 int v29; // eax@68 | |
3440 float v30; // ST18_4@72 | |
3441 signed int v31; // eax@72 | |
3442 float v32; // ST18_4@74 | |
3443 signed int v33; // eax@74 | |
3444 double v34; // st7@75 | |
3445 float v35; // ST18_4@76 | |
3446 signed int v36; // eax@76 | |
3447 float *v37; // esi@78 | |
3448 float v38; // ST18_4@78 | |
3449 int v39; // eax@78 | |
3450 float v40; // ST18_4@82 | |
3451 int v41; // eax@82 | |
3452 float v42; // ST18_4@83 | |
3453 int v43; // eax@83 | |
3454 float v44; // ST18_4@85 | |
3455 int v45; // eax@85 | |
3456 const char *v46; // eax@86 | |
3457 unsigned int v47; // eax@87 | |
3458 float v48; // ST18_4@97 | |
3459 __int64 v49; // ST14_8@107 | |
3460 int v50; // eax@107 | |
3461 int v51; // eax@108 | |
3462 Player *v52; // eax@109 | |
3463 int v53; // [sp-4h] [bp-13Ch]@107 | |
3464 int v54; // [sp+0h] [bp-138h]@107 | |
3465 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3466 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3467 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3468 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3469 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3470 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3471 //Player *v61; // [sp+124h] [bp-14h]@3 |
3472 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3473 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3475 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3476 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 |
0 | 3479 |
3480 v6 = uPlayerID; | |
249 | 3481 //Str = lpsz; |
0 | 3482 if ( IsBadStringPtrA(lpsz, 1u) ) |
3483 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3484 |
0 | 3485 a1[0] = 0; |
3486 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3487 v59 = TargetColor(255, 255, 155); |
249 | 3488 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3489 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3490 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 NPCData *npc = nullptr; |
0 | 3492 if ( dword_5C35D4 ) |
248 | 3493 { |
463 | 3494 //__debugbreak(); // fix |
459 | 3495 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
|
3496 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3497 else |
602 | 3498 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3499 //v65 = v9; |
250 | 3500 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3504 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 for (int i = 0, dst = 0; i < len; ++i) |
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 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 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
|
3524 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 case 2: |
0 | 3531 v11 = pPlayer->pName; |
254
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 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 case 5: |
0 | 3538 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3539 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3540 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3541 { | |
3542 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3543 { | |
3544 if ( v18 < 20 ) | |
3545 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3546 } | |
3547 else | |
3548 { | |
3549 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3550 } | |
3551 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 case 6: |
0 | 3554 if ( pPlayer->uSex ) |
3555 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3556 else | |
3557 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 case 7: |
0 | 3560 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 case 8: |
0 | 3566 v19 = 0; |
3567 v63 = 0; | |
484 | 3568 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3569 do |
3570 { | |
3571 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3572 { | |
3573 v21 = v63; | |
3574 v22 = word_4EE150[v19]; | |
3575 ++v63; | |
3576 v55[v21] = v22; | |
3577 } | |
3578 ++v19; | |
3579 } | |
3580 while ( v19 < 28 ); | |
3581 if ( v63 ) | |
3582 { | |
3583 v23 = rand() % v63; | |
3584 v24 = dword_A74CDC; | |
3585 if ( dword_A74CDC == -1 ) | |
3586 { | |
3587 v24 = v23; | |
3588 dword_A74CDC = v23; | |
3589 } | |
492 | 3590 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3591 } |
3592 else | |
3593 { | |
3594 v11 = (char *)pNPCTopics[55].pText; | |
3595 } | |
249 | 3596 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 case 10: |
0 | 3606 if ( pPlayer->uSex ) |
3607 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3608 else | |
3609 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3610 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3611 case 11: |
0 | 3612 v25 = GetPartyReputation(); |
3613 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 v25 = npc->rep; |
0 | 3616 LABEL_46: |
3617 if ( v25 >= 25 ) | |
3618 { | |
3619 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3620 } | |
3621 else | |
3622 { | |
3623 if ( v25 < 6 ) | |
3624 { | |
3625 if ( v25 >= -5 ) | |
3626 { | |
3627 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3628 } | |
3629 else | |
3630 { | |
3631 if ( v25 < -24 ) | |
3632 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3633 else | |
3634 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3635 } | |
3636 } | |
3637 else | |
3638 { | |
3639 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3640 } | |
3641 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3642 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 case 13: |
0 | 3644 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
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 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 case 15: |
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 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 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
|
3677 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 sprintf(a1, "%lu", pay_percentage); |
250 | 3681 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 sprintf(a1, "%lu", v51); |
0 | 3695 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 case 25: |
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 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3722 switch ( a5 ) |
3723 { | |
3724 case 3: | |
3725 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3726 v45 = a3->GetValue(); |
0 | 3727 v29 = pPlayer->_4B8213(v45, v44); |
3728 break; | |
3729 case 4: | |
3730 v29 = pPlayer->_4B824B(*v37); | |
3731 break; | |
3732 case 5: | |
3733 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3734 v43 = a3->GetValue(); |
0 | 3735 v29 = pPlayer->_4B8265(v43, v42); |
3736 break; | |
3737 case 6: | |
3738 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3739 v41 = a3->GetValue(); |
0 | 3740 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3741 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3742 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3744 } |
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 case 27: |
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 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3749 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 v28 = a3->GetValue(); |
749 | 3751 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3752 if ( a5 == 3 ) |
3753 { | |
3754 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3755 v36 = a3->GetValue(); |
917 | 3756 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3757 if (a3->Broken()) |
0 | 3758 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3759 goto _continue_sprintf; |
0 | 3760 } |
3761 if ( a5 != 4 ) | |
3762 { | |
3763 if ( a5 == 5 ) | |
3764 { | |
3765 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3766 v33 = a3->GetValue(); |
916 | 3767 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3768 } |
3769 else | |
3770 { | |
3771 if ( a5 == 6 ) | |
3772 { | |
3773 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3774 v31 = a3->GetValue(); |
917 | 3775 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3776 if (a3->Broken()) |
0 | 3777 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3778 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3779 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 goto _continue_sprintf; |
0 | 3781 } |
3782 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 _continue_sprintf: |
0 | 3784 sprintf(a1, "%lu", v29); |
250 | 3785 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3786 goto _continue_strcat; |
0 | 3787 } |
3788 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3789 |
0 | 3790 v48 = v34; |
916 | 3791 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3792 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 case 28: |
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 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3798 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 case 29: |
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 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 v48 = v34; |
916 | 3807 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 case 30: |
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 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 sub_493F79(&v57, *a6); |
351 | 3816 v54 = v57.field_18_expire_year; |
3817 v53 = v57.field_C_expire_day + 1; | |
3818 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3819 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3821 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3830 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 default: |
0 | 3833 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3834 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3836 goto _continue_strcat; |
484 | 3837 v49 = pParty->field_3C._s_times[v17-51]; |
3838 | |
0 | 3839 sub_493F79(&v56, v49); |
351 | 3840 v54 = v56.field_18_expire_year; |
3841 v53 = v56.field_C_expire_day + 1; | |
3842 v50 = v56.field_14_exprie_month; | |
0 | 3843 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3844 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3845 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3846 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3847 } |
0 | 3848 } |
3849 return pTmpBuf2; | |
3850 } | |
3851 | |
3852 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3853 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3854 { |
734 | 3855 //stru154 *v3; // edi@1 |
3856 //signed int v4; // eax@1 | |
3857 //signed int result; // eax@9 | |
3858 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3859 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3860 float v7; |
0 | 3861 |
3862 v.x = 0.0; | |
3863 v.y = 0.0; | |
3864 v.z = 0.0; | |
734 | 3865 GetFacePlane(a2, a3, &v, &v7); |
3866 | |
3867 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3868 polygonType = POLYGON_VerticalWall; | |
3869 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3870 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3871 polygonType = POLYGON_Floor; | |
0 | 3872 else |
734 | 3873 polygonType = POLYGON_InBetweenFloorAndWall; |
3874 | |
3875 face_plane.vNormal.x = v.x; | |
3876 face_plane.vNormal.y = v.y; | |
3877 face_plane.vNormal.z = v.z; | |
3878 face_plane.dist = v7; | |
0 | 3879 } |
3880 | |
3881 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3882 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3883 { |
734 | 3884 if (fabsf(pNormal->z) < 1e-6f) |
3885 polygonType = POLYGON_VerticalWall; | |
3886 else if (fabsf(pNormal->x) < 1e-6f && | |
3887 fabsf(pNormal->y) < 1e-6f) | |
3888 polygonType = POLYGON_Floor; | |
0 | 3889 else |
734 | 3890 polygonType = POLYGON_InBetweenFloorAndWall; |
3891 | |
3892 face_plane.vNormal.x = pNormal->x; | |
3893 face_plane.dist = dist; | |
3894 face_plane.vNormal.y = pNormal->y; | |
3895 face_plane.vNormal.z = pNormal->z; | |
0 | 3896 } |
3897 | |
3898 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3899 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3900 { |
3901 ODMFace *v5; // ebx@1 | |
734 | 3902 //int v6; // eax@1 |
3903 //unsigned __int16 *v7; // ebx@2 | |
3904 //Vec3_int_ *v8; // eax@3 | |
0 | 3905 Vec3_int_ *v9; // ecx@3 |
734 | 3906 //double v10; // st7@3 |
3907 //int v11; // ecx@3 | |
0 | 3908 Vec3_int_ *v12; // ecx@3 |
734 | 3909 //double v13; // st7@3 |
3910 //double v14; // st6@3 | |
3911 //double v15; // st5@3 | |
3912 //int v16; // ecx@3 | |
0 | 3913 Vec3_int_ *v17; // eax@3 |
734 | 3914 //double v18; // st5@3 |
0 | 3915 Vec3_float_ *v19; // eax@3 |
734 | 3916 //int result; // eax@8 |
3917 //float v21; // ecx@10 | |
3918 //double v22; // st7@10 | |
3919 //double v23; // st6@10 | |
0 | 3920 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3921 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3922 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3923 float v27; // [sp+20h] [bp-48h]@3 | |
3924 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3925 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3926 //float v30; // [sp+30h] [bp-38h]@3 | |
3927 //float v31; // [sp+34h] [bp-34h]@3 | |
3928 //float v32; // [sp+38h] [bp-30h]@3 | |
3929 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3930 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3931 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3932 //float v36; // [sp+50h] [bp-18h]@3 | |
3933 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3934 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3935 //int v39; // [sp+64h] [bp-4h]@1 |
3936 | |
3937 //v39 = 0; | |
0 | 3938 v1.x = 0.0; |
3939 v5 = pFace; | |
734 | 3940 //v6 = pFace->uNumVertices; |
0 | 3941 v1.y = 0.0; |
3942 v1.z = 0.0; | |
734 | 3943 |
3944 if (pFace->uNumVertices >= 2) | |
3945 { | |
3946 int i = 0; | |
3947 while ( i < pFace->uNumVertices - 2 ) | |
3948 { | |
3949 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3950 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3951 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3952 | |
3953 v1.x = v12->x - v9->x; | |
3954 v26 = v17->x - v12->x; | |
3955 v1.y = v12->y - v9->y; | |
3956 v27 = v17->y - v12->y; | |
3957 v1.z = v12->z - v9->z; | |
3958 v28 = v17->z - v12->z; | |
0 | 3959 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3960 v38.x = v19->x; | |
3961 v38.y = v19->y; | |
3962 v38.z = v19->z; | |
734 | 3963 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3964 { | |
3965 v38.Normalize(); | |
3966 | |
3967 pOutNormal->x = v38.x; | |
3968 pOutNormal->y = v38.y; | |
3969 pOutNormal->z = v38.z; | |
3970 | |
3971 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3972 return; | |
3973 } | |
3974 } | |
3975 } | |
3976 | |
3977 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3978 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3979 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3980 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3981 } |
3982 | |
3983 //----- (0049D700) -------------------------------------------------------- | |
3984 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3985 { | |
3986 unsigned int v1; // eax@1 | |
3987 int v2; // ecx@1 | |
3988 unsigned int v3; // eax@1 | |
3989 | |
3990 v1 = uDim; | |
3991 v2 = 0; | |
3992 v3 = v1 - 1; | |
3993 while ( v3 & 1 ) | |
3994 { | |
3995 v3 >>= 1; | |
3996 ++v2; | |
3997 } | |
3998 return v3 == 0 ? v2 : 0; | |
3999 } | |
4000 | |
4001 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4002 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4003 { |
737 | 4004 /*signed __int64 v2; // ST10_8@1 |
0 | 4005 double v3; // st7@1 |
4006 float v4; // ST24_4@1 | |
4007 double v5; // ST10_8@1 | |
4008 int v6; // ST1C_4@1 | |
4009 float v7; // ST24_4@1 | |
4010 double v8; // ST10_8@1 | |
4011 unsigned __int8 v9; // ST20_1@1 | |
4012 float v10; // ST24_4@1 | |
4013 double v11; // ST10_8@1 | |
4014 float v12; // ST24_4@1 | |
737 | 4015 double v13; // ST08_8@1*/ |
4016 | |
4017 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4018 (a2 >> 24) / 255.0f * 255.0f), | |
4019 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4020 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4021 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4022 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4023 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4024 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4025 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4026 /*v2 = a1 >> 24; | |
4027 v3 = (double)v2 / 255.0f; | |
4028 HIDWORD(v2) = 0; | |
0 | 4029 LODWORD(v2) = a2 >> 24; |
737 | 4030 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4031 v5 = v4 + 6.7553994e15; |
4032 v6 = LODWORD(v5); | |
737 | 4033 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4034 v8 = v7 + 6.7553994e15; |
4035 v9 = LOBYTE(v8); | |
737 | 4036 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4037 v11 = v10 + 6.7553994e15; |
737 | 4038 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4039 v13 = v12 + 6.7553994e15; |
737 | 4040 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4041 } |
4042 | |
4043 //----- (004A46E6) -------------------------------------------------------- | |
4044 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4045 { | |
4046 int v5; // eax@1 | |
4047 int z; // eax@1 | |
4048 unsigned int v7; // eax@9 | |
4049 unsigned int v8; // ecx@9 | |
4050 int v9; // eax@9 | |
4051 unsigned int v10; // eax@10 | |
4052 int *v11; // esi@10 | |
4053 int *v12; // edi@10 | |
4054 int v13; // ecx@10 | |
4055 int v14; // edx@10 | |
4056 unsigned int v15; // eax@22 | |
4057 int *v16; // esi@22 | |
4058 int *v17; // edi@22 | |
4059 int v18; // ecx@22 | |
4060 int v19; // edx@22 | |
4061 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4062 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4063 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4064 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4065 | |
4066 v5 = a4; | |
4067 v23 = _z >> 16; | |
4068 z = x + v5; | |
693 | 4069 if ( z >= (signed int)pViewport->uViewportTL_X |
4070 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4071 && y >= (signed int)pViewport->uViewportTL_Y | |
4072 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4073 { | |
4074 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4075 x = pViewport->uViewportTL_X; | |
4076 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4077 z = pViewport->uViewportBR_X; | |
0 | 4078 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4079 v22 = z - x; | |
4080 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4081 v7 = lightColor >> 3; | |
4082 v8 = lightColor & 0xF0; | |
4083 v9 = v7 & 0x1E0000; | |
4084 if ( pRenderer->uTargetGBits == 5 ) | |
4085 { | |
4086 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4087 v11 = (int *)pTarget; | |
4088 v12 = pTargetZ; | |
4089 v13 = v22; | |
4090 v14 = (v10 << 16) | v10; | |
4091 z = (unsigned __int8)pTarget & 2; | |
4092 if ( (unsigned __int8)pTarget & 2 ) | |
4093 { | |
4094 z = (unsigned int)*pTargetZ >> 16; | |
4095 if ( z > v23 ) | |
4096 { | |
4097 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4098 *pTarget = z; | |
4099 } | |
4100 v13 = v22 - 1; | |
4101 v11 = (int *)(pTarget + 1); | |
4102 v12 = pTargetZ + 1; | |
4103 } | |
4104 while ( v13 != 1 ) | |
4105 { | |
4106 if ( v13 < 1 ) | |
4107 return z; | |
4108 z = (unsigned int)*v12 >> 16; | |
4109 if ( z <= v23 ) | |
4110 { | |
4111 v13 -= 2; | |
4112 ++v11; | |
4113 v12 += 2; | |
4114 } | |
4115 else | |
4116 { | |
4117 v12 += 2; | |
4118 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4119 v13 -= 2; | |
4120 *v11 = z; | |
4121 ++v11; | |
4122 } | |
4123 } | |
4124 z = (unsigned int)*v12 >> 16; | |
4125 if ( z > v23 ) | |
4126 { | |
4127 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4128 *(short *)v11 = z; | |
4129 } | |
4130 } | |
4131 else | |
4132 { | |
4133 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4134 v16 = (int *)pTarget; | |
4135 v17 = pTargetZ; | |
4136 v18 = v22; | |
4137 v19 = (v15 << 16) | v15; | |
4138 z = (unsigned __int8)pTarget & 2; | |
4139 if ( (unsigned __int8)pTarget & 2 ) | |
4140 { | |
4141 z = (unsigned int)*pTargetZ >> 16; | |
4142 if ( z > v23 ) | |
4143 { | |
4144 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4145 *pTarget = z; | |
4146 } | |
4147 v18 = v22 - 1; | |
4148 v16 = (int *)(pTarget + 1); | |
4149 v17 = pTargetZ + 1; | |
4150 } | |
4151 while ( v18 != 1 ) | |
4152 { | |
4153 if ( v18 < 1 ) | |
4154 return z; | |
4155 z = (unsigned int)*v17 >> 16; | |
4156 if ( z <= v23 ) | |
4157 { | |
4158 v18 -= 2; | |
4159 ++v16; | |
4160 v17 += 2; | |
4161 } | |
4162 else | |
4163 { | |
4164 v17 += 2; | |
4165 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4166 v18 -= 2; | |
4167 *v16 = z; | |
4168 ++v16; | |
4169 } | |
4170 } | |
4171 z = (unsigned int)*v17 >> 16; | |
4172 if ( z > v23 ) | |
4173 { | |
4174 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4175 *(short *)v16 = z; | |
4176 } | |
4177 } | |
4178 } | |
4179 return z; | |
4180 } | |
4181 | |
4182 //----- (004A57E9) -------------------------------------------------------- | |
4183 void __cdecl Present_ColorKey() | |
4184 { | |
4185 HRESULT v0; // eax@3 | |
4186 HRESULT v1; // eax@3 | |
4187 HRESULT v2; // eax@3 | |
4188 HRESULT v3; // eax@3 | |
4189 HRESULT v4; // eax@3 | |
4190 RECT a2; // [sp+4h] [bp-14h]@3 | |
4191 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4192 | |
4193 if ( !pRenderer->uNumSceneBegins ) | |
4194 { | |
4195 if ( pRenderer->field_40110 ) | |
4196 { | |
693 | 4197 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4198 a2.left = 0; |
4199 a2.top = 0; | |
4200 a2.right = 640; | |
4201 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4202 a2.right = 640; | |
4203 a2.left = 0; | |
693 | 4204 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4205 a2.bottom = 480; |
4206 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4207 0, | |
693 | 4208 pViewport->uViewportBR_Y + 1, |
0 | 4209 pRenderer->pColorKeySurface4, |
4210 &a2, | |
4211 16u)); | |
693 | 4212 a2.right = pViewport->uViewportTL_X; |
4213 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4214 a2.left = 0; |
693 | 4215 a2.top = pViewport->uViewportTL_Y; |
0 | 4216 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4217 0, | |
693 | 4218 pViewport->uViewportTL_Y, |
0 | 4219 pRenderer->pColorKeySurface4, |
4220 &a2, | |
4221 16u)); | |
693 | 4222 a2.left = pViewport->uViewportBR_X; |
4223 a2.top = pViewport->uViewportTL_Y; | |
0 | 4224 a2.right = 640; |
693 | 4225 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4226 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4227 pViewport->uViewportBR_X, |
4228 pViewport->uViewportTL_Y, | |
0 | 4229 pRenderer->pColorKeySurface4, |
4230 &a2, | |
4231 16u)); | |
693 | 4232 a2.right = pViewport->uViewportBR_X; |
4233 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4234 a2.left = pViewport->uViewportTL_X; | |
4235 a2.top = pViewport->uViewportTL_Y; | |
0 | 4236 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4237 pViewport->uViewportTL_X, |
4238 pViewport->uViewportTL_Y, | |
0 | 4239 pRenderer->pColorKeySurface4, |
4240 &a2, | |
4241 17u)); | |
4242 } | |
4243 } | |
4244 } | |
4245 | |
4246 //----- (004A597D) -------------------------------------------------------- | |
4247 void Present_NoColorKey() | |
4248 { | |
4249 //unsigned __int16 *v0; // eax@4 | |
4250 unsigned __int16 *v1; // esi@4 | |
4251 void *v2; // edi@4 | |
4252 //signed int v4; // ebx@4 | |
4253 //signed int v5; // ebx@6 | |
4254 //void *v6; // edi@7 | |
4255 //const void *v7; // esi@7 | |
4256 signed int v8; // ebx@8 | |
4257 int v9; // eax@10 | |
4258 unsigned int v10; // esi@10 | |
4259 unsigned __int32 v11; // edi@10 | |
4260 //int v12; // ecx@10 | |
4261 unsigned int v13; // ebx@10 | |
4262 int v14; // eax@11 | |
4263 int v15; // eax@13 | |
4264 int v16; // eax@14 | |
4265 int v17; // eax@16 | |
4266 HRESULT v18; // eax@22 | |
4267 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4268 int v20; // [sp+88h] [bp-1Ch]@10 | |
4269 int v21; // [sp+8Ch] [bp-18h]@10 | |
4270 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4271 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4272 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4273 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4274 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4275 | |
4276 if ( !pRenderer->uNumSceneBegins ) | |
4277 { | |
4278 if ( pRenderer->field_40110 ) | |
4279 { | |
4280 memset(&Dst, 0, 0x7Cu); | |
4281 Dst.dwSize = 124; | |
168 | 4282 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4283 { |
4284 //v26 = Dst.lpSurface; | |
4285 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4286 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4287 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4288 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4289 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4290 v1 = pRenderer->pTargetSurface; | |
4291 v2 = Dst.lpSurface; | |
4292 | |
4293 | |
4294 /*for (uint y = 0; y < 480; ++y) | |
4295 { | |
4296 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4297 for (uint x = 0; x < 640; ++x) | |
4298 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4299 }*/ | |
4300 | |
4301 auto pSrc = pRenderer->pTargetSurface; | |
4302 auto pDst = (__int16 *)Dst.lpSurface; | |
4303 | |
4304 for (uint y = 0; y < 8; ++y) | |
4305 memcpy(pDst + y * Dst.lPitch / 2, | |
4306 | |
4307 pSrc + y * 640, 640 * sizeof(__int16)); | |
4308 | |
4309 for (uint y = 8; y < 352; ++y) | |
4310 { | |
4311 memcpy(pDst + y * Dst.lPitch / 2, | |
4312 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4313 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4314 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4315 } |
4316 | |
121 | 4317 for (uint y = 352; y < 480; ++y) |
0 | 4318 memcpy(pDst + y * Dst.lPitch / 2, |
4319 pSrc + y * 640, 640 * sizeof(__int16)); | |
4320 | |
4321 | |
693 | 4322 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4323 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4324 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4325 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4326 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4327 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4328 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4329 v21 = 4 * v9 + 1280; | |
4330 | |
121 | 4331 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4332 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4333 v10 = (int)pSrc_x1y1; | |
4334 v11 = (int)pDst_x1y1; | |
693 | 4335 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4336 v13 = v24; |
4337 | |
693 | 4338 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4339 { |
4340 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4341 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4342 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4343 { |
4344 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4345 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4346 } | |
4347 } | |
4348 | |
4349 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4350 | |
4351 /* while ( 1 ) | |
4352 { | |
4353 while ( 1 ) | |
4354 { | |
4355 v14 = *(int *)v10; | |
4356 v10 += 4; | |
4357 if ( v14 == v13 ) | |
4358 break; | |
4359 if ( (short)v14 == (short)v13 ) | |
4360 { | |
4361 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4362 v11 += 4; | |
4363 --uHalfWidth; | |
4364 if ( !uHalfWidth ) | |
4365 goto LABEL_21; | |
4366 } | |
4367 else | |
4368 { | |
4369 v15 = __ROL__(v14, 16); | |
4370 if ( (short)v15 == (short)v13 ) | |
4371 { | |
4372 v17 = __ROR__(v15, 16); | |
4373 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4374 v11 += 4; | |
4375 --uHalfWidth; | |
4376 if ( !uHalfWidth ) | |
4377 goto LABEL_21; | |
4378 } | |
4379 else | |
4380 { | |
4381 v16 = __ROR__(v15, 16); | |
4382 *(int *)v11 = v16; | |
4383 v11 += 4; | |
4384 --uHalfWidth; | |
4385 if ( !uHalfWidth ) | |
4386 goto LABEL_21; | |
4387 } | |
4388 } | |
4389 } | |
4390 v11 += 4; | |
4391 --uHalfWidth; | |
4392 if ( !uHalfWidth ) | |
4393 { | |
4394 LABEL_21: | |
4395 v10 += v21; | |
4396 v11 += v22; | |
4397 uHalfWidth = v20; | |
4398 if ( !--uNumLines ) | |
4399 { | |
4400 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4401 return; | |
4402 } | |
4403 } | |
4404 }*/ | |
4405 } | |
4406 } | |
4407 } | |
4408 } | |
4409 | |
4410 //----- (004A7063) -------------------------------------------------------- | |
4411 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4412 { | |
4413 float v2; // ST1C_4@1 | |
4414 double v3; // ST14_8@1 | |
4415 signed int v4; // ebx@1 | |
4416 float v5; // ST1C_4@1 | |
4417 double v6; // ST14_8@1 | |
4418 signed int v7; // edi@1 | |
4419 double v8; // ST0C_8@1 | |
4420 signed int v9; // esi@1 | |
4421 signed int v10; // ecx@1 | |
4422 double v12; // [sp+8h] [bp-18h]@1 | |
4423 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4424 | |
4425 v2 = (double)(uDiffuse >> 24) * a2; | |
4426 v3 = v2 + 6.7553994e15; | |
4427 v4 = LODWORD(v3); | |
4428 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4429 v6 = v5 + 6.7553994e15; | |
4430 v7 = LODWORD(v6); | |
4431 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4432 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4433 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4434 v9 = LODWORD(v8); | |
4435 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4436 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4437 v10 = LODWORD(v12); | |
4438 if ( v4 > 255 ) | |
4439 v4 = 255; | |
4440 if ( v4 < 0 ) | |
4441 v4 = 0; | |
4442 if ( SHIDWORD(v13) > 255 ) | |
4443 v7 = 255; | |
4444 if ( v7 < 0 ) | |
4445 v7 = 0; | |
4446 if ( (signed int)v13 > 255 ) | |
4447 v9 = 255; | |
4448 if ( v9 < 0 ) | |
4449 v9 = 0; | |
4450 if ( SLODWORD(v12) > 255 ) | |
4451 v10 = 255; | |
4452 if ( v10 < 0 ) | |
4453 v10 = 0; | |
4454 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4455 } | |
4456 | |
4457 //----- (004AD504) -------------------------------------------------------- | |
711 | 4458 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4459 { |
4460 int result; // eax@1 | |
711 | 4461 signed int v2; // ebx@1 |
0 | 4462 BLVFace *v3; // esi@3 |
4463 Texture *v4; // edi@6 | |
4464 int v5; // eax@7 | |
4465 int v6; // edx@7 | |
4466 int v7; // ecx@7 | |
4467 int v8; // ebx@8 | |
4468 int v9; // eax@8 | |
4469 int v10; // ebx@8 | |
4470 unsigned int v11; // ebx@9 | |
4471 int v12; // esi@10 | |
4472 int v13; // eax@13 | |
4473 unsigned __int16 *v14; // eax@13 | |
4474 unsigned int v15; // eax@14 | |
4475 unsigned __int16 *v16; // ebx@14 | |
4476 int v17; // eax@15 | |
4477 int v18; // ebx@15 | |
4478 int v19; // esi@15 | |
4479 int v20; // ecx@15 | |
4480 int v21; // eax@15 | |
4481 stru193_math *v22; // ebx@15 | |
4482 int v23; // eax@15 | |
4483 char *v24; // esi@16 | |
4484 int v25; // eax@18 | |
4485 int v26; // eax@18 | |
4486 int v27; // eax@20 | |
4487 signed int v28; // esi@20 | |
4488 signed int v29; // edx@20 | |
4489 signed int v30; // esi@20 | |
4490 signed int v31; // edi@20 | |
4491 int v32; // esi@20 | |
4492 int v33; // eax@26 | |
4493 int *v34; // esi@27 | |
4494 unsigned __int16 *v35; // edi@27 | |
4495 unsigned int v36; // edx@27 | |
4496 int v37; // ebx@27 | |
4497 char v38; // cl@27 | |
4498 char v39; // ch@27 | |
4499 int v40; // ebx@29 | |
4500 int v41; // edx@29 | |
4501 unsigned int v42; // ebx@30 | |
4502 int v43; // edx@30 | |
4503 int v44; // eax@33 | |
4504 int *v45; // esi@34 | |
4505 unsigned __int16 *v46; // edi@34 | |
4506 unsigned int v47; // edx@34 | |
4507 int v48; // ebx@34 | |
4508 char v49; // cl@34 | |
4509 char v50; // ch@34 | |
4510 int v51; // ebx@36 | |
4511 int v52; // edx@36 | |
4512 unsigned __int16 v53; // bx@37 | |
4513 int v54; // edx@37 | |
4514 int v55; // eax@40 | |
4515 int v56; // eax@41 | |
4516 int *v57; // esi@42 | |
4517 unsigned __int16 *v58; // edi@42 | |
4518 unsigned int v59; // edx@42 | |
4519 int v60; // ebx@42 | |
4520 char v61; // cl@42 | |
4521 char v62; // ch@42 | |
4522 unsigned int v63; // ebx@44 | |
4523 int v64; // edx@44 | |
4524 unsigned int v65; // ebx@44 | |
4525 int v66; // edx@44 | |
4526 unsigned int v67; // ebx@45 | |
4527 int v68; // edx@45 | |
4528 int v69; // ebx@45 | |
4529 int v70; // edx@45 | |
4530 int v71; // eax@48 | |
4531 int *v72; // esi@49 | |
4532 unsigned __int16 *v73; // edi@49 | |
4533 unsigned int v74; // edx@49 | |
4534 int v75; // ebx@49 | |
4535 char v76; // cl@49 | |
4536 char v77; // ch@49 | |
4537 unsigned int v78; // ebx@51 | |
4538 int v79; // edx@51 | |
4539 unsigned int v80; // ebx@51 | |
4540 int v81; // edx@51 | |
4541 unsigned int v82; // ebx@52 | |
4542 int v83; // edx@52 | |
4543 int v84; // ebx@52 | |
4544 int v85; // edx@52 | |
4545 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4546 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4547 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4548 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4549 int v90; // [sp+1Ch] [bp-88h]@20 | |
4550 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4551 int v92; // [sp+24h] [bp-80h]@7 | |
4552 int i; // [sp+28h] [bp-7Ch]@7 | |
4553 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4554 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4555 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4556 int v97; // [sp+38h] [bp-6Ch]@15 | |
4557 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4558 int v99; // [sp+40h] [bp-64h]@9 | |
4559 int v100; // [sp+44h] [bp-60h]@24 | |
4560 int v101; // [sp+48h] [bp-5Ch]@10 | |
4561 int v102; // [sp+4Ch] [bp-58h]@20 | |
4562 int v103; // [sp+50h] [bp-54h]@20 | |
4563 int v104; // [sp+54h] [bp-50h]@9 | |
4564 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4565 int v106; // [sp+5Ch] [bp-48h]@24 | |
4566 int v107; // [sp+60h] [bp-44h]@20 | |
4567 int v108; // [sp+64h] [bp-40h]@20 | |
4568 int v109; // [sp+68h] [bp-3Ch]@20 | |
4569 int v110; // [sp+6Ch] [bp-38h]@15 | |
4570 int v111; // [sp+70h] [bp-34h]@20 | |
4571 int a1; // [sp+74h] [bp-30h]@12 | |
4572 int a2; // [sp+78h] [bp-2Ch]@9 | |
4573 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4574 int v115; // [sp+80h] [bp-24h]@18 | |
4575 int v116; // [sp+84h] [bp-20h]@7 | |
4576 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4577 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4578 int *v119; // [sp+90h] [bp-14h]@13 | |
4579 int v120; // [sp+94h] [bp-10h]@15 | |
4580 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4581 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4582 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4583 | |
4584 result = pRenderer->uTargetSurfacePitch; | |
711 | 4585 v2 = sFaceID; |
0 | 4586 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4587 if ( sFaceID >= 0 ) |
4588 { | |
4589 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4590 { | |
4591 v3 = &pIndoor->pFaces[sFaceID]; | |
4592 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4593 if ( !pRenderer->pRenderD3D ) |
4594 { | |
711 | 4595 result = sub_423B5D(sFaceID); |
0 | 4596 if ( result ) |
4597 { | |
4598 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4599 if ( result ) | |
4600 { | |
4601 result = (int)v3->GetTexture(); | |
4602 v4 = (Texture *)result; | |
4603 v96 = (Texture *)result; | |
4604 if ( result ) | |
4605 { | |
4606 v5 = *(short *)(result + 38); | |
4607 LOBYTE(v3->uAttributes) |= 0x80u; | |
4608 v92 = v5; | |
4609 sub_4AE5F1(v2); | |
4610 ++pBLVRenderParams->field_84; | |
4611 v6 = stru_F8AD28.pDeltaUV[0]; | |
4612 v116 = stru_F8AD28.pDeltaUV[1]; | |
4613 v7 = 0; | |
4614 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4615 { | |
4616 v8 = v116; | |
4617 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4618 v9 = 4 * v7 + 16297672; | |
4619 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4620 } | |
4621 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4622 result = stru_F8A590._viewport_space_y; | |
4623 a2 = stru_F8A590._viewport_space_y; | |
4624 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4625 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4626 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4627 v87 = v4->pLevelOfDetail1; |
4628 v88 = v4->pLevelOfDetail2; | |
4629 v89 = v4->pLevelOfDetail3; | |
4630 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4631 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4632 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4633 { | |
4634 v12 = 2 * stru_F8A590._viewport_space_y; | |
4635 v101 = 2 * stru_F8A590._viewport_space_y; | |
4636 while ( 1 ) | |
4637 { | |
4638 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4639 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4640 if ( LOBYTE(viewparams->field_20) ) | |
4641 { | |
4642 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4643 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4644 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4645 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4646 - pBLVRenderParams->uViewportX]; | |
4647 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4648 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4649 - pBLVRenderParams->uViewportX]; | |
4650 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4651 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4652 - pBLVRenderParams->uViewportX]; | |
4653 v123 = (unsigned int)v16; | |
4654 } | |
4655 else | |
4656 { | |
4657 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4658 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4659 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4660 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4661 } | |
4662 v117 = (unsigned int)v14; | |
4663 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4664 v18 = stru_F81018.field_0.field_10; | |
4665 LOWORD(v17) = 0; | |
4666 v97 = stru_F8AD28.field_0 | v17; | |
4667 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4668 v19 = stru_F81018.field_0.field_4 >> i; | |
4669 v20 = 11 - v18; | |
4670 v116 = stru_F81018.field_0.field_8 >> i; | |
4671 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4672 v22 = stru_5C6E00; | |
4673 v122 = (unsigned __int16 *)v20; | |
323 | 4674 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4675 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4676 v120 = v116 + 4 * v23; |
4677 if ( v123 < v117 ) | |
4678 { | |
4679 v24 = (char *)&stru_F81018.field_34.field_8; | |
4680 v114 = &stru_F81018.field_34.field_8; | |
4681 a1 += 16; | |
4682 while ( 1 ) | |
4683 { | |
4684 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4685 v25 = *((int *)v24 - 2); | |
4686 LOWORD(v25) = 0; | |
4687 v115 = v97; | |
4688 v26 = stru_F8AD28.field_0 | v25; | |
4689 if ( v97 <= (unsigned int)v26 ) | |
4690 v115 = v26; | |
4691 v97 = v26; | |
4692 v27 = *((int *)v24 - 11); | |
4693 v28 = *((int *)v24 - 1); | |
4694 v105 = (&v86)[4 * v27]; | |
4695 v111 = v27 + 16; | |
4696 v29 = v4->uWidthMinus1; | |
4697 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4698 v107 = v29 >> v27; | |
4699 v30 = v28 >> i; | |
4700 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4701 v31 = *v114 >> i; | |
4702 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4703 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4704 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4705 v108 = (signed int)(v116 - v121) >> 4; |
4706 v103 = (v90 - v120) >> 4; | |
4707 v32 = v123 + 32; | |
4708 if ( LOBYTE(viewparams->field_20) ) | |
4709 v32 = v123 + 64; | |
4710 if ( v32 > v117 ) | |
4711 v32 = v117; | |
4712 v118 = v32; | |
4713 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4714 v106 = (signed int)(v32 - v123) >> 1; | |
4715 if ( v110 >> 16 == v100 >> 16 ) | |
4716 { | |
4717 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4718 if ( LOBYTE(viewparams->field_20) ) | |
4719 { | |
4720 v44 = v123; | |
4721 if ( v123 < v118 ) | |
4722 { | |
4723 v45 = v119; | |
4724 v46 = v122; | |
4725 v47 = v121; | |
4726 v48 = v120; | |
4727 v49 = v111; | |
4728 v50 = v109; | |
4729 if ( v106 & 2 ) | |
4730 { | |
4731 *v119 = v115; | |
4732 v45 -= 2; | |
4733 v44 = v123 + 4; | |
4734 goto LABEL_37; | |
4735 } | |
4736 do | |
4737 { | |
4738 v44 += 8; | |
4739 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4740 v52 = v115; | |
4741 LOWORD(v51) = v46[v51]; | |
4742 *v45 = v115; | |
4743 v45[1] = v52; | |
4744 v45[640] = v52; | |
4745 v45[641] = v52; | |
4746 *(short *)(v44 - 8) = v51; | |
4747 *(short *)(v44 - 6) = v51; | |
4748 *(short *)(v44 + 1272) = v51; | |
4749 *(short *)(v44 + 1274) = v51; | |
4750 v45[2] = v52; | |
4751 v45[3] = v52; | |
4752 v45[642] = v52; | |
4753 v45[643] = v52; | |
4754 v121 += v108; | |
4755 v120 += v103; | |
4756 v47 = v121; | |
4757 v48 = v120; | |
4758 LABEL_37: | |
4759 v45 += 4; | |
4760 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4761 v54 = v108; | |
4762 *(short *)(v44 - 4) = v53; | |
4763 *(short *)(v44 - 2) = v53; | |
4764 *(short *)(v44 + 1276) = v53; | |
4765 *(short *)(v44 + 1278) = v53; | |
4766 v121 += v54; | |
4767 v120 += v103; | |
4768 v47 = v121; | |
4769 v48 = v120; | |
4770 } | |
4771 while ( v44 < v118 ); | |
4772 v123 = v44; | |
4773 v119 = v45; | |
4774 } | |
4775 } | |
4776 else | |
4777 { | |
4778 v33 = v123; | |
4779 if ( v123 < v118 ) | |
4780 { | |
4781 v34 = v119; | |
4782 v35 = v122; | |
4783 v36 = v121; | |
4784 v37 = v120; | |
4785 v38 = v111; | |
4786 v39 = v109; | |
4787 if ( v106 & 1 ) | |
4788 { | |
4789 *v119 = v115; | |
4790 --v34; | |
4791 v33 = v123 + 2; | |
4792 goto LABEL_30; | |
4793 } | |
4794 do | |
4795 { | |
4796 v33 += 4; | |
4797 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4798 v41 = v115; | |
4799 LOWORD(v40) = v35[v40]; | |
4800 *v34 = v115; | |
4801 *(short *)(v33 - 4) = v40; | |
4802 v34[1] = v41; | |
4803 v121 += v108; | |
4804 v120 += v103; | |
4805 v36 = v121; | |
4806 v37 = v120; | |
4807 LABEL_30: | |
4808 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4809 v34 += 2; | |
4810 v43 = v108; | |
4811 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4812 v121 += v43; | |
4813 v120 += v103; | |
4814 v36 = v121; | |
4815 v37 = v120; | |
4816 } | |
4817 while ( v33 < v118 ); | |
4818 v123 = v33; | |
4819 v119 = v34; | |
4820 } | |
4821 } | |
4822 } | |
4823 else | |
4824 { | |
4825 v55 = v110 - ((v100 - v110) >> 4); | |
4826 v110 = (v100 - v110) >> 4; | |
4827 v122 = (unsigned __int16 *)v55; | |
4828 if ( LOBYTE(viewparams->field_20) ) | |
4829 { | |
4830 v71 = v123; | |
4831 if ( v123 < v118 ) | |
4832 { | |
4833 v72 = v119; | |
4834 v73 = v94; | |
4835 v74 = v121; | |
4836 v75 = v120; | |
4837 v76 = v111; | |
4838 v77 = v109; | |
4839 if ( v106 & 2 ) | |
4840 { | |
4841 *v119 = v115; | |
4842 v72 += 2; | |
4843 v71 = v123 + 4; | |
4844 goto LABEL_52; | |
4845 } | |
4846 do | |
4847 { | |
4848 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4849 v79 = (int)((char *)v122 + v110); | |
4850 v71 += 8; | |
4851 v122 = (unsigned __int16 *)v79; | |
4852 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4853 v81 = v115; | |
4854 LOWORD(v80) = v73[v80]; | |
4855 *v72 = v115; | |
4856 v72[1] = v81; | |
4857 v72[640] = v81; | |
4858 v72[641] = v81; | |
4859 *(short *)(v71 - 8) = v80; | |
4860 *(short *)(v71 - 6) = v80; | |
4861 *(short *)(v71 + 1272) = v80; | |
4862 *(short *)(v71 + 1274) = v80; | |
4863 v72[2] = v81; | |
4864 v72[3] = v81; | |
4865 v72[642] = v81; | |
4866 v72[643] = v81; | |
4867 v121 += v108; | |
4868 v120 += v103; | |
4869 v74 = v121; | |
4870 v75 = v120; | |
4871 v72 += 4; | |
4872 LABEL_52: | |
4873 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4874 v83 = (int)((char *)v122 + v110); | |
4875 v84 = v105[v82]; | |
4876 v122 = (unsigned __int16 *)v83; | |
4877 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4878 v85 = v108; | |
4879 *(short *)(v71 - 4) = v84; | |
4880 *(short *)(v71 - 2) = v84; | |
4881 *(short *)(v71 + 1276) = v84; | |
4882 *(short *)(v71 + 1278) = v84; | |
4883 v121 += v85; | |
4884 v120 += v103; | |
4885 v74 = v121; | |
4886 v75 = v120; | |
4887 } | |
4888 while ( v71 < v118 ); | |
4889 v123 = v71; | |
4890 v119 = v72; | |
4891 } | |
4892 } | |
4893 else | |
4894 { | |
4895 v56 = v123; | |
4896 if ( v123 < v118 ) | |
4897 { | |
4898 v57 = v119; | |
4899 v58 = v94; | |
4900 v59 = v121; | |
4901 v60 = v120; | |
4902 v61 = v111; | |
4903 v62 = v109; | |
4904 if ( v106 & 1 ) | |
4905 { | |
4906 *v119 = v115; | |
4907 ++v57; | |
4908 v56 = v123 + 2; | |
4909 goto LABEL_45; | |
4910 } | |
4911 do | |
4912 { | |
4913 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4914 v64 = (int)((char *)v122 + v110); | |
4915 v56 += 4; | |
4916 v122 = (unsigned __int16 *)v64; | |
4917 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4918 v66 = v115; | |
4919 LOWORD(v65) = v58[v65]; | |
4920 *v57 = v115; | |
4921 *(short *)(v56 - 4) = v65; | |
4922 v57[1] = v66; | |
4923 v121 += v108; | |
4924 v120 += v103; | |
4925 v59 = v121; | |
4926 v60 = v120; | |
4927 v57 += 2; | |
4928 LABEL_45: | |
4929 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4930 v68 = (int)((char *)v122 + v110); | |
4931 v69 = v105[v67]; | |
4932 v122 = (unsigned __int16 *)v68; | |
4933 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4934 v70 = v108; | |
4935 *(short *)(v56 - 2) = v69; | |
4936 v121 += v70; | |
4937 v120 += v103; | |
4938 v59 = v121; | |
4939 v60 = v120; | |
4940 } | |
4941 while ( v56 < v118 ); | |
4942 v123 = v56; | |
4943 v119 = v57; | |
4944 } | |
4945 } | |
4946 } | |
4947 v114 += 13; | |
4948 v110 = v100; | |
4949 a1 += 16; | |
4950 v4 = v96; | |
4951 v121 = v116; | |
4952 v120 = v90; | |
4953 if ( v123 >= v117 ) | |
4954 break; | |
4955 v24 = (char *)v114; | |
4956 v22 = stru_5C6E00; | |
4957 } | |
4958 } | |
4959 ++a2; | |
4960 v98 += v95; | |
4961 result = a2; | |
4962 v101 += 2; | |
4963 v99 += 640; | |
4964 if ( a2 > stru_F8A590._viewport_space_w ) | |
4965 break; | |
4966 v12 = v101; | |
4967 result = a2; | |
4968 v11 = v98; | |
4969 } | |
4970 } | |
4971 } | |
4972 } | |
4973 } | |
4974 } | |
4975 } | |
4976 } | |
4977 return result; | |
4978 } | |
4979 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4980 | |
4981 //----- (004ADD1D) -------------------------------------------------------- | |
4982 void __fastcall sub_4ADD1D(int uFaceID) | |
4983 { | |
4984 int v1; // edi@1 | |
4985 BLVFace *v2; // esi@3 | |
4986 signed int v3; // ebx@4 | |
4987 Texture *v4; // edi@9 | |
4988 signed int v5; // eax@9 | |
4989 char *v6; // edi@12 | |
4990 signed int v7; // eax@15 | |
4991 unsigned int v8; // eax@16 | |
4992 __int16 v9; // cx@19 | |
4993 unsigned __int8 *v10; // eax@19 | |
4994 unsigned __int16 *v11; // eax@19 | |
4995 int v12; // edi@19 | |
4996 int v13; // ebx@20 | |
4997 stru352 *v14; // esi@20 | |
4998 DWORD v15; // eax@22 | |
4999 signed int v16; // ecx@22 | |
5000 signed int v17; // ST68_4@22 | |
5001 int v18; // eax@22 | |
5002 int v19; // ecx@22 | |
5003 unsigned int v20; // esi@23 | |
5004 int v21; // edi@23 | |
5005 int v22; // eax@23 | |
5006 int *v23; // ebx@24 | |
5007 int v24; // edx@24 | |
5008 int v25; // ebx@25 | |
5009 unsigned __int16 v26; // cx@25 | |
5010 int v27; // edx@26 | |
5011 unsigned __int16 v28; // cx@26 | |
5012 unsigned __int8 v29; // sf@27 | |
5013 unsigned __int8 v30; // of@27 | |
5014 unsigned int v31; // esi@29 | |
5015 int v32; // edi@29 | |
5016 unsigned __int16 *v33; // eax@29 | |
5017 int *v34; // ebx@30 | |
5018 int v35; // edx@30 | |
5019 int v36; // ebx@31 | |
5020 unsigned __int16 v37; // cx@31 | |
5021 int v38; // edx@32 | |
5022 unsigned __int16 v39; // cx@32 | |
5023 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5024 int v41; // [sp-Ch] [bp-68h]@15 | |
5025 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5026 signed int v43; // [sp+14h] [bp-48h]@12 | |
5027 signed int v44; // [sp+14h] [bp-48h]@22 | |
5028 int v45; // [sp+1Ch] [bp-40h]@22 | |
5029 int v46; // [sp+20h] [bp-3Ch]@22 | |
5030 int v47; // [sp+24h] [bp-38h]@19 | |
5031 char v48; // [sp+28h] [bp-34h]@19 | |
5032 int v49; // [sp+2Ch] [bp-30h]@19 | |
5033 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5034 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5035 int v52; // [sp+38h] [bp-24h]@22 | |
5036 int v53; // [sp+3Ch] [bp-20h]@22 | |
5037 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5038 int v55; // [sp+40h] [bp-1Ch]@20 | |
5039 int v56; // [sp+44h] [bp-18h]@20 | |
5040 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5041 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5042 int v59; // [sp+50h] [bp-Ch]@4 | |
5043 int v60; // [sp+50h] [bp-Ch]@19 | |
5044 int v61; // [sp+54h] [bp-8h]@22 | |
5045 int *v62; // [sp+58h] [bp-4h]@23 | |
5046 int *v63; // [sp+58h] [bp-4h]@29 | |
5047 | |
5048 v1 = uFaceID; | |
5049 v42 = pRenderer->uTargetSurfacePitch; | |
5050 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5051 { | |
5052 v2 = &pIndoor->pFaces[uFaceID]; | |
5053 if ( pRenderer->pRenderD3D ) | |
5054 { | |
5055 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5056 v59 = v3; | |
5057 } | |
5058 else | |
5059 { | |
5060 v59 = sub_423B5D(uFaceID); | |
5061 v3 = v59; | |
5062 } | |
5063 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5064 { | |
5065 v4 = v2->GetTexture(); | |
5066 v5 = 0; | |
5067 if ( v4 ) | |
5068 { | |
5069 if ( pRenderer->pRenderD3D ) | |
5070 { | |
5071 if ( v3 > 0 ) | |
5072 { | |
5073 v54 = v3; | |
5074 v43 = v3; | |
5075 v6 = (char *)&array_507D30[0].v; | |
5076 do | |
5077 { | |
5078 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5079 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5080 v6 += 48; | |
5081 --v54; | |
5082 } | |
5083 while ( v54 ); | |
5084 v3 = v59; | |
5085 v5 = v43; | |
5086 } | |
5087 v7 = v5; | |
5088 v41 = stru_F8AD28.field_0; | |
5089 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5090 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5091 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5092 { | |
5093 v40 = v2->GetTexture(); | |
5094 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5095 } | |
5096 else | |
5097 { | |
5098 v40 = v2->GetTexture(); | |
5099 v8 = v2->uBitmapID; | |
5100 } | |
5101 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5102 } | |
5103 else | |
5104 { | |
5105 v49 = v4->uWidthMinus1; | |
5106 v47 = v4->uHeightMinus1 << 16; | |
5107 v9 = 16 - v4->uWidthLn2; | |
710 | 5108 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5109 LOBYTE(v2->uAttributes) |= 0x80u; |
5110 v48 = v9; | |
5111 v50 = v10; | |
5112 sub_4AF412(); | |
5113 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5114 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5115 v12 = stru_F8A590._viewport_space_y; | |
5116 v51 = v11; | |
5117 v60 = stru_F8A590._viewport_space_y; | |
5118 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5119 { | |
5120 v13 = 2 * stru_F8A590._viewport_space_y; | |
5121 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5122 v55 = 2 * stru_F8A590._viewport_space_y; | |
5123 v56 = 640 * stru_F8A590._viewport_space_y; | |
5124 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5125 { | |
5126 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5127 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5128 v15 = GetTickCount(); | |
5129 v16 = v14->field_0; | |
5130 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5131 v45 = v14->field_4 >> 3; | |
5132 v44 = v16 >> 3; | |
5133 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5134 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5135 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5136 v18 = v14->field_28; | |
5137 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5138 LOWORD(v18) = 0; | |
5139 v46 = stru_F8AD28.field_0 | v18; | |
5140 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5141 if ( LOBYTE(viewparams->field_20) ) | |
5142 { | |
5143 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5144 - pBLVRenderParams->uViewportX]; | |
5145 v31 = v44; | |
5146 v32 = v45; | |
5147 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5148 + 2 * v19 | |
5149 - pBLVRenderParams->uViewportX]; | |
5150 if ( v61 & 1 ) | |
5151 { | |
5152 --v61; | |
5153 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5154 + 2 * v19 | |
5155 - pBLVRenderParams->uViewportX | |
5156 - 2]; | |
5157 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5158 - pBLVRenderParams->uViewportX]; | |
5159 v35 = v46; | |
5160 v63 += 2; | |
5161 goto LABEL_32; | |
5162 } | |
5163 while ( 1 ) | |
5164 { | |
5165 v30 = __OFSUB__(v61, 2); | |
5166 v29 = v61 - 2 < 0; | |
5167 v61 -= 2; | |
5168 if ( v29 ^ v30 ) | |
5169 break; | |
5170 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5171 v31 += v52; | |
5172 v37 = v51[v36]; | |
5173 v32 += v53; | |
5174 v34 = v63; | |
5175 v35 = v46; | |
5176 *v33 = v37; | |
5177 v33[1] = v37; | |
5178 v33[640] = v37; | |
5179 v33[641] = v37; | |
5180 v63 += 4; | |
5181 v34[2] = v46; | |
5182 v34[3] = v46; | |
5183 v34[642] = v46; | |
5184 v34[643] = v46; | |
5185 LABEL_32: | |
5186 *v34 = v35; | |
5187 v34[1] = v35; | |
5188 v34[640] = v35; | |
5189 v34[641] = v35; | |
5190 v38 = v49 & (v31 >> 16); | |
5191 v33 += 4; | |
5192 v31 += v52; | |
5193 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5194 v32 += v53; | |
5195 *(v33 - 2) = v39; | |
5196 *(v33 - 1) = v39; | |
5197 v33[638] = v39; | |
5198 v33[639] = v39; | |
5199 } | |
5200 } | |
5201 else | |
5202 { | |
5203 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5204 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5205 v20 = v44; | |
5206 v21 = v45; | |
5207 v22 = (int)v58; | |
5208 if ( v61 & 1 ) | |
5209 { | |
5210 --v61; | |
5211 v22 = (int)(v58 - 1); | |
5212 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5213 v24 = v46; | |
5214 ++v62; | |
5215 goto LABEL_26; | |
5216 } | |
5217 while ( 1 ) | |
5218 { | |
5219 v30 = __OFSUB__(v61, 2); | |
5220 v29 = v61 - 2 < 0; | |
5221 v61 -= 2; | |
5222 if ( v29 ^ v30 ) | |
5223 break; | |
5224 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5225 v20 += v52; | |
5226 v26 = v51[v25]; | |
5227 v21 += v53; | |
5228 v23 = v62; | |
5229 v24 = v46; | |
5230 *(short *)v22 = v26; | |
5231 v62 += 2; | |
5232 v23[1] = v46; | |
5233 LABEL_26: | |
5234 *v23 = v24; | |
5235 v27 = v49 & (v20 >> 16); | |
5236 v22 += 4; | |
5237 v20 += v52; | |
5238 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5239 v21 += v53; | |
5240 *(short *)(v22 - 2) = v28; | |
5241 } | |
5242 } | |
5243 ++v60; | |
5244 ++i; | |
5245 v56 += 640; | |
5246 v55 += 2; | |
5247 if ( v60 > stru_F8A590._viewport_space_w ) | |
5248 break; | |
5249 v13 = v55; | |
5250 v12 = v60; | |
5251 } | |
5252 } | |
5253 } | |
5254 } | |
5255 } | |
5256 } | |
5257 } | |
5258 | |
5259 //----- (004AE1E7) -------------------------------------------------------- | |
5260 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5261 { | |
5262 int v3; // ebx@1 | |
5263 int v4; // edi@1 | |
5264 int v5; // esi@1 | |
5265 signed __int64 v6; // qtt@3 | |
5266 int v7; // esi@3 | |
5267 int v8; // eax@5 | |
5268 int result; // eax@5 | |
5269 int v10; // edx@5 | |
5270 int v11; // [sp+Ch] [bp-8h]@1 | |
5271 int v12; // [sp+1Ch] [bp+8h]@2 | |
5272 | |
5273 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5274 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5275 v11 = a1; | |
5276 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5277 + stru_F8AD28.field_7C | |
5278 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5279 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5280 { | |
5281 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5282 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5283 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5284 } | |
5285 else | |
5286 { | |
5287 v7 = 1073741824; | |
5288 } | |
5289 v8 = stru_F8AD28.vec_9C.z; | |
5290 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5291 + stru_F8AD28.vec_8C.x | |
5292 + v4 * stru_F8AD28.vec_8C.y) | |
5293 * (signed __int64)v7) >> 16) | |
5294 + stru_F8AD28.field_98; | |
5295 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5296 v10 = result + stru_F8AD28.field_A8; | |
5297 stru_F83B80[v11].field_28 = v7; | |
5298 stru_F83B80[v11].field_4 = v10; | |
5299 return result; | |
5300 } | |
5301 | |
5302 //----- (004AE313) -------------------------------------------------------- | |
5303 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5304 { | |
5305 int _dy; // ebx@1 | |
5306 int _dx; // edi@1 | |
5307 int v5; // ecx@1 | |
5308 int v6; // esi@1 | |
5309 int v7; // ST18_4@2 | |
5310 signed __int64 v8; // qtt@3 | |
5311 unsigned int v9; // ecx@3 | |
5312 int result; // eax@8 | |
5313 int v11; // [sp+Ch] [bp-8h]@1 | |
5314 | |
5315 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5316 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5317 ++pBLVRenderParams->field_88; | |
5318 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5319 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5320 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5321 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5322 { | |
5323 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5324 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5325 v9 = v8 / v11; | |
5326 } | |
5327 else | |
5328 { | |
5329 v9 = 0x40000000u; | |
5330 } | |
5331 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5332 p->field_0 = v9; | |
5333 else | |
5334 p->field_0 = stru_F8AD28.field_34; | |
5335 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5336 * (signed __int64)(signed int)v9) >> 16) | |
5337 + stru_F8AD28.field_98 | |
5338 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5339 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5340 * (signed __int64)(signed int)v9) >> 16) | |
5341 + stru_F8AD28.field_A8 | |
5342 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5343 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5344 if ( result < 369620 || bUseLoResSprites ) | |
5345 { | |
5346 if ( result < 184810 ) | |
5347 p->field_10 = result > 92405; | |
5348 else | |
5349 p->field_10 = 2; | |
5350 } | |
5351 else | |
5352 { | |
5353 p->field_10 = 3; | |
5354 } | |
5355 return result; | |
5356 } | |
5357 | |
5358 //----- (004AE491) -------------------------------------------------------- | |
5359 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5360 { | |
5361 signed int v2; // eax@1 | |
5362 signed int v3; // edi@1 | |
5363 int v4; // ecx@1 | |
5364 int v5; // esi@2 | |
5365 int v6; // eax@2 | |
5366 int v7; // ebx@2 | |
5367 unsigned int v8; // ecx@2 | |
5368 int v9; // edx@5 | |
5369 int v10; // edx@7 | |
5370 unsigned int v11; // eax@8 | |
5371 int v13; // [sp+4h] [bp-18h]@2 | |
5372 int v14; // [sp+8h] [bp-14h]@2 | |
5373 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5374 int v16; // [sp+14h] [bp-8h]@1 | |
5375 int v17; // [sp+18h] [bp-4h]@1 | |
5376 | |
5377 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5378 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5379 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5380 v4 = 0; | |
5381 v15 = v2; | |
5382 v16 = 0; | |
5383 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5384 { | |
5385 do | |
5386 { | |
5387 v5 = v16; | |
5388 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5389 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5390 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5391 v7 = v13; | |
5392 v8 = v14; | |
5393 if ( v6 < v13 ) | |
5394 { | |
5395 v6 = v13; | |
5396 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5397 } | |
5398 if ( v6 < v14 ) | |
5399 { | |
5400 v9 = v6; | |
5401 v6 = v14; | |
5402 v8 = v9; | |
5403 } | |
5404 if ( v7 < (signed int)v8 ) | |
5405 { | |
5406 v10 = v8; | |
5407 v8 = v7; | |
5408 v7 = v10; | |
5409 } | |
5410 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5411 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5412 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5413 ++v16; | |
5414 v2 = v15; | |
5415 } | |
5416 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5417 v4 = 0; | |
5418 } | |
5419 if ( stru_F8AD28.field_3E4 != v4 ) | |
5420 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5421 if ( v17 >= v4 ) | |
5422 { | |
5423 if ( v17 > 2031616 ) | |
5424 v17 = 2031616; | |
5425 } | |
5426 else | |
5427 { | |
5428 v17 = v4; | |
5429 } | |
5430 ++pBLVRenderParams->field_8C; | |
5431 return v17; | |
5432 } | |
5433 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5434 | |
5435 //----- (004AE5F1) -------------------------------------------------------- | |
5436 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5437 { | |
5438 BLVFace *v1; // esi@1 | |
5439 BLVFaceExtra *v2; // ebx@1 | |
5440 int v3; // eax@1 | |
5441 int v4; // edi@1 | |
5442 Texture *v5; // edi@1 | |
5443 int v6; // eax@1 | |
5444 unsigned int v7; // eax@1 | |
5445 unsigned int v8; // ecx@1 | |
5446 unsigned int v9; // eax@1 | |
5447 unsigned int v10; // ecx@5 | |
5448 int v11; // edi@10 | |
5449 int v12; // ecx@10 | |
5450 int v13; // eax@10 | |
5451 int v14; // edx@10 | |
5452 int v15; // ebx@12 | |
5453 double v16; // st7@16 | |
5454 int v17; // eax@16 | |
5455 char *v18; // ebx@17 | |
5456 int v19; // ecx@19 | |
5457 int v20; // eax@19 | |
5458 int v21; // edx@21 | |
5459 int v22; // eax@23 | |
5460 int v23; // ST04_4@26 | |
5461 int v24; // edi@26 | |
5462 double v25; // st6@26 | |
5463 int v26; // eax@26 | |
5464 double v27; // st6@26 | |
5465 int v28; // ecx@26 | |
5466 char v29; // al@26 | |
5467 int v30; // edx@28 | |
5468 int v31; // ecx@28 | |
5469 BLVLightMM7 *v32; // ecx@32 | |
5470 int v33; // edi@33 | |
5471 int v34; // edx@33 | |
5472 int v35; // eax@33 | |
5473 int v36; // edi@35 | |
5474 int v37; // edx@37 | |
5475 int v38; // ebx@39 | |
5476 int v39; // edi@42 | |
5477 int v40; // eax@42 | |
5478 char *v41; // ebx@45 | |
5479 signed int v42; // ecx@47 | |
5480 int v43; // edi@47 | |
5481 int v44; // eax@49 | |
5482 int v45; // edx@51 | |
5483 int v46; // eax@53 | |
5484 int v47; // ST04_4@55 | |
5485 int v48; // edi@55 | |
5486 double v49; // st6@55 | |
5487 int v50; // eax@55 | |
5488 double v51; // st6@55 | |
5489 int v52; // eax@55 | |
5490 int v53; // ecx@57 | |
5491 int v54; // ecx@58 | |
5492 int v55; // ecx@59 | |
5493 int v56; // edx@62 | |
5494 int v57; // ecx@62 | |
5495 int v58; // eax@63 | |
5496 int v59; // edx@64 | |
5497 int v60; // ecx@67 | |
5498 int v61; // edx@67 | |
5499 int v62; // eax@68 | |
5500 int v63; // edx@69 | |
5501 signed int v64; // ecx@72 | |
5502 double v65; // st7@75 | |
5503 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5504 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5505 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5506 int v69; // [sp+28h] [bp-18h]@10 | |
5507 int v70; // [sp+2Ch] [bp-14h]@10 | |
5508 int X; // [sp+30h] [bp-10h]@10 | |
5509 int v72; // [sp+34h] [bp-Ch]@10 | |
5510 int v73; // [sp+38h] [bp-8h]@10 | |
5511 int v74; // [sp+3Ch] [bp-4h]@10 | |
5512 | |
5513 v1 = &pIndoor->pFaces[uFaceID]; | |
5514 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5515 v3 = v1->uBitmapID; | |
5516 v4 = v1->uBitmapID; | |
5517 v68 = v2; | |
5518 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5519 v6 = 8 * uFaceID; | |
862 | 5520 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5521 stru_F8AD28.field_0 = v6; |
5522 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5523 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5524 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5525 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5526 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5527 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5528 v7 = GetTickCount(); | |
5529 v8 = v1->uAttributes; | |
5530 v9 = v7 >> 3; | |
5531 if ( v8 & 4 ) | |
5532 { | |
5533 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5534 } | |
5535 else | |
5536 { | |
5537 if ( v8 & 0x20 ) | |
5538 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5539 } | |
5540 v10 = v1->uAttributes; | |
5541 if ( BYTE1(v10) & 8 ) | |
5542 { | |
5543 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5544 } | |
5545 else | |
5546 { | |
5547 if ( v10 & 0x40 ) | |
5548 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5549 } | |
5550 v1->_get_normals(&v67, &v66); | |
5551 stru_F8AD28.vec_14.x = v67.x; | |
5552 stru_F8AD28.vec_14.y = v67.y; | |
5553 stru_F8AD28.vec_14.z = v67.z; | |
5554 stru_F8AD28.vec_20.x = v66.x; | |
5555 stru_F8AD28.vec_20.y = v66.y; | |
5556 stru_F8AD28.vec_20.z = v66.z; | |
5557 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5558 if ( pBLVRenderParams->sPartyRotX ) | |
5559 { | |
5560 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5561 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5562 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5563 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5564 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5565 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5566 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5567 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5568 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5569 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5570 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5571 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5572 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5573 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5574 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5575 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5576 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5577 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5578 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5579 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5580 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5581 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5582 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5583 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5584 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5585 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5586 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5587 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5588 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5589 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5590 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5591 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5592 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5593 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5594 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5595 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5596 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5597 v13 = pBLVRenderParams->vPartyPos.y; | |
5598 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5599 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5600 v14 = pBLVRenderParams->vPartyPos.x; | |
5601 } | |
5602 else | |
5603 { | |
5604 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5605 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5606 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5607 - v70; | |
5608 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5609 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5610 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5611 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5612 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5613 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5614 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5615 - v70; | |
5616 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5617 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5618 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5619 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5620 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5621 - v70; | |
5622 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5623 v14 = pBLVRenderParams->vPartyPos.x; | |
5624 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5625 v13 = pBLVRenderParams->vPartyPos.y; | |
5626 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5627 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5628 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5629 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5630 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5631 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5632 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5633 } | |
5634 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5635 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5636 + stru_F8AD28.plane_4.dist | |
5637 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5638 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5639 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5640 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5641 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5642 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5643 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5644 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5645 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5646 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5647 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5648 v15 = v70; | |
5649 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5650 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5651 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5652 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5653 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5654 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5655 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5656 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5657 stru_F8AD28.field_38 = 0; | |
5658 stru_F8AD28.field_A8 = -(X | |
5659 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5660 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5661 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5662 { | |
5663 stru_F8AD28.field_3E4 = 1; | |
5664 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5665 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5666 stru_F8AD28.field_3F0 = v68->field_1E; | |
5667 stru_F8AD28.field_3F4 = v68->field_20; | |
5668 } | |
5669 else | |
5670 { | |
5671 stru_F8AD28.field_3E4 = 0; | |
5672 } | |
5673 v16 = 0.0039215689; | |
5674 v17 = 116 * v1->uSectorID; | |
5675 v69 = v17; | |
5676 v74 = 0; | |
5677 v73 = 0; | |
5678 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5679 v70 = pMobileLightsStack->uNumLightsActive; | |
5680 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5681 { | |
5682 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5683 do | |
5684 { | |
5685 if ( v74 >= 20 ) | |
5686 break; | |
5687 v19 = *((short *)v18 + 2); | |
5688 v20 = *((short *)v18 - 1); | |
5689 if ( v20 > v1->pBounding.x1 - v19 ) | |
5690 { | |
5691 if ( v20 < v19 + v1->pBounding.x2 ) | |
5692 { | |
5693 v21 = *(short *)v18; | |
5694 if ( v21 > v1->pBounding.y1 - v19 ) | |
5695 { | |
5696 if ( v21 < v19 + v1->pBounding.y2 ) | |
5697 { | |
5698 v22 = *((short *)v18 + 1); | |
5699 if ( v22 > v1->pBounding.z1 - v19 ) | |
5700 { | |
5701 if ( v22 < v19 + v1->pBounding.z2 ) | |
5702 { | |
5703 X = (v1->pFacePlane_old.dist | |
5704 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5705 + v21 * v1->pFacePlane_old.vNormal.y | |
5706 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5707 if ( X <= v19 ) | |
5708 { | |
5709 v23 = X; | |
5710 v24 = v74; | |
5711 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5712 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5713 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5714 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5715 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5716 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5717 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5718 v25 = (double)(signed int)v68 * v16; | |
5719 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5720 v26 = (unsigned __int8)v18[8]; | |
5721 *(float *)(v24 * 4 + 16297992) = v25; | |
5722 v27 = (double)(signed int)v68; | |
5723 v68 = (BLVFaceExtra *)v26; | |
5724 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5725 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5726 v16 = 0.0039215689; | |
5727 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5728 v28 = v74; | |
5729 v29 = v18[9]; | |
5730 ++v74; | |
5731 stru_F8AD28._blv_lights_types[v28] = v29; | |
5732 } | |
5733 } | |
5734 } | |
5735 } | |
5736 } | |
5737 } | |
5738 } | |
5739 ++v73; | |
5740 v18 += 18; | |
5741 v17 = v69; | |
5742 } | |
5743 while ( v73 < v70 ); | |
5744 } | |
5745 v30 = 0; | |
5746 v73 = 0; | |
5747 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5748 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5749 if ( v31 > 0 ) | |
5750 { | |
5751 while ( v74 < 20 ) | |
5752 { | |
5753 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5754 if ( !(v32->uAtributes & 8) ) | |
5755 { | |
5756 v33 = v1->pBounding.x1; | |
5757 v34 = v32->vPosition.x; | |
5758 X = v32->uBrightness; | |
5759 v35 = v32->uRadius; | |
5760 v68 = (BLVFaceExtra *)v32->uRadius; | |
5761 if ( v34 > v33 - v35 ) | |
5762 { | |
5763 if ( v34 < v35 + v1->pBounding.x2 ) | |
5764 { | |
5765 v36 = v32->vPosition.y; | |
5766 if ( v36 > v1->pBounding.y1 - v35 ) | |
5767 { | |
5768 if ( v36 < v35 + v1->pBounding.y2 ) | |
5769 { | |
5770 v37 = v32->vPosition.z; | |
5771 if ( v37 > v1->pBounding.z1 - v35 ) | |
5772 { | |
5773 if ( v37 < v35 + v1->pBounding.z2 ) | |
5774 { | |
5775 v38 = (v1->pFacePlane_old.dist | |
5776 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5777 + v37 * v1->pFacePlane_old.vNormal.z | |
5778 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5779 if ( v38 >= 0 ) | |
5780 { | |
5781 if ( v38 <= v35 && v35 ) | |
5782 { | |
5783 v39 = v74; | |
5784 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5785 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5786 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5787 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5788 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5789 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5790 v68 = (BLVFaceExtra *)v32->uRed; | |
5791 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5792 v68 = (BLVFaceExtra *)v32->uGreen; | |
5793 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5794 v68 = (BLVFaceExtra *)v32->uBlue; | |
5795 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5796 v16 = 0.0039215689; | |
5797 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5798 v40 = v74++; | |
5799 stru_F8AD28._blv_lights_types[v40] = 1; | |
5800 } | |
5801 } | |
5802 } | |
5803 } | |
5804 } | |
5805 } | |
5806 } | |
5807 } | |
5808 } | |
5809 v30 = v73++ + 1; | |
5810 if ( v73 >= v70 ) | |
5811 break; | |
5812 v17 = v69; | |
5813 } | |
5814 } | |
5815 v73 = 0; | |
5816 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5817 { | |
5818 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5819 do | |
5820 { | |
5821 if ( v74 >= 20 ) | |
5822 break; | |
5823 v42 = *((short *)v41 + 2); | |
5824 v43 = *((short *)v41 - 1); | |
5825 if ( v43 > v1->pBounding.x1 - v42 ) | |
5826 { | |
5827 if ( v43 < v42 + v1->pBounding.x2 ) | |
5828 { | |
5829 v44 = *(short *)v41; | |
5830 if ( v44 > v1->pBounding.y1 - v42 ) | |
5831 { | |
5832 if ( v44 < v42 + v1->pBounding.y2 ) | |
5833 { | |
5834 v45 = *((short *)v41 + 1); | |
5835 if ( v45 > v1->pBounding.z1 - v42 ) | |
5836 { | |
5837 if ( v45 < v42 + v1->pBounding.z2 ) | |
5838 { | |
5839 v46 = (v1->pFacePlane_old.dist | |
5840 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5841 + v43 * v1->pFacePlane_old.vNormal.x | |
5842 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5843 v69 = v46; | |
5844 if ( v46 >= 0 ) | |
5845 { | |
5846 if ( v46 <= v42 ) | |
5847 { | |
5848 v47 = v69; | |
5849 v48 = v74; | |
5850 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5851 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5852 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5853 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5854 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5855 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5856 v49 = (double)(signed int)v68 * v16; | |
5857 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5858 v50 = (unsigned __int8)v41[8]; | |
5859 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5860 v51 = (double)(signed int)v68; | |
5861 v68 = (BLVFaceExtra *)v50; | |
5862 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5863 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5864 v16 = 0.0039215689; | |
5865 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5866 v52 = v74++; | |
5867 stru_F8AD28._blv_lights_types[v52] = 1; | |
5868 } | |
5869 } | |
5870 } | |
5871 } | |
5872 } | |
5873 } | |
5874 } | |
5875 } | |
5876 ++v73; | |
5877 v41 += 12; | |
5878 } | |
5879 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5880 } | |
5881 stru_F8AD28.uNumLightsApplied = v74; | |
5882 v53 = v1->pBounding.x2; | |
5883 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5884 { | |
5885 v55 = v1->pBounding.x1; | |
5886 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5887 v54 = 0; | |
5888 else | |
5889 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5890 } | |
5891 else | |
5892 { | |
5893 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5894 } | |
5895 v56 = v1->pBounding.y2; | |
5896 v57 = v54 * v54; | |
5897 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5898 { | |
5899 v59 = v1->pBounding.y1; | |
5900 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5901 v58 = 0; | |
5902 else | |
5903 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5904 } | |
5905 else | |
5906 { | |
5907 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5908 } | |
5909 v60 = v58 * v58 + v57; | |
5910 v61 = v1->pBounding.z2; | |
5911 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5912 { | |
5913 v63 = v1->pBounding.z1; | |
5914 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5915 v62 = 0; | |
5916 else | |
5917 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5918 } | |
5919 else | |
5920 { | |
5921 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5922 } | |
5923 v64 = v62 * v62 + v60; | |
5924 if ( v64 ) | |
295 | 5925 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5926 else |
5927 stru_F8AD28.field_34 = 0; | |
5928 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5929 v65 = (double)(signed int)v68; | |
5930 if ( v65 >= 655.36 ) | |
5931 { | |
5932 if ( v65 >= 26214.4 ) | |
5933 { | |
5934 if ( v65 >= 45875.2 ) | |
5935 { | |
5936 stru_F8AD28.field_44 = 8; | |
5937 stru_F8AD28.field_48 = 3; | |
5938 } | |
5939 else | |
5940 { | |
5941 stru_F8AD28.field_44 = 16; | |
5942 stru_F8AD28.field_48 = 4; | |
5943 } | |
5944 } | |
5945 else | |
5946 { | |
5947 stru_F8AD28.field_44 = 32; | |
5948 stru_F8AD28.field_48 = 5; | |
5949 } | |
5950 } | |
5951 else | |
5952 { | |
5953 stru_F8AD28.field_44 = 64; | |
5954 stru_F8AD28.field_48 = 6; | |
5955 } | |
5956 } | |
5957 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5958 | |
5959 //----- (004AF412) -------------------------------------------------------- | |
5960 int __cdecl sub_4AF412() | |
5961 { | |
5962 int v0; // ST20_4@2 | |
5963 int v1; // ST20_4@2 | |
5964 int v2; // ST20_4@2 | |
5965 int v3; // esi@2 | |
5966 int v4; // ST20_4@2 | |
5967 int v5; // ecx@2 | |
5968 int v6; // ebx@2 | |
5969 int v7; // edi@2 | |
5970 int v8; // edx@2 | |
5971 int v9; // eax@2 | |
5972 int result; // eax@4 | |
5973 | |
5974 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5975 stru_F8AD28.vec_20.y = -65536; | |
5976 stru_F8AD28.plane_4.vNormal.x = 0; | |
5977 stru_F8AD28.plane_4.vNormal.y = 0; | |
5978 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5979 stru_F8AD28.vec_14.x = 65536; | |
5980 stru_F8AD28.vec_14.y = 0; | |
5981 stru_F8AD28.vec_14.z = 0; | |
5982 stru_F8AD28.vec_20.x = 0; | |
5983 stru_F8AD28.vec_20.z = 0; | |
5984 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5985 if ( pBLVRenderParams->sPartyRotX ) | |
5986 { | |
5987 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5988 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5989 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5990 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5991 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5992 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5993 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5994 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5995 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5996 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5997 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5998 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5999 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6000 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6001 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6002 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6003 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6004 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6005 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6006 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6007 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6008 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6009 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6010 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6011 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6012 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6013 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6014 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6015 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6016 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6017 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6018 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6019 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6020 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6021 v6 = pBLVRenderParams->vPartyPos.z; | |
6022 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6023 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6024 v8 = pBLVRenderParams->vPartyPos.y; | |
6025 v9 = pBLVRenderParams->vPartyPos.x; | |
6026 } | |
6027 else | |
6028 { | |
6029 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6030 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6031 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6032 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6033 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6034 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6035 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6036 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6037 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6038 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6039 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6040 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6041 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6042 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6043 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6044 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6045 v8 = pBLVRenderParams->vPartyPos.y; | |
6046 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6047 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6048 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6049 v9 = pBLVRenderParams->vPartyPos.x; | |
6050 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6051 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6052 v6 = pBLVRenderParams->vPartyPos.z; | |
6053 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6054 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6055 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6056 } | |
6057 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6058 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6059 + stru_F8AD28.plane_4.dist | |
6060 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6061 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6062 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6063 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6064 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6065 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6066 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6067 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6068 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6069 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6070 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6071 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6072 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6073 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6074 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6075 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6076 result = 0; | |
6077 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6078 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6079 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6080 stru_F8AD28.field_38 = 0; | |
6081 stru_F8AD28.field_3E4 = 0; | |
6082 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6083 stru_F8AD28.uNumLightsApplied = 0; | |
6084 stru_F8AD28.field_34 = 0; | |
6085 return result; | |
6086 } | |
6087 | |
6088 //----- (004B1447) -------------------------------------------------------- | |
6089 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6090 { | |
6091 signed int v3; // esi@1 | |
6092 char v4; // sf@8 | |
6093 int v5; // eax@8 | |
6094 unsigned __int64 v6; // qax@12 | |
6095 DDM_DLV_Header *v7; // eax@14 | |
6096 Player **v8; // edi@18 | |
6097 Player *result; // eax@19 | |
735 | 6098 //char *v10; // esi@20 |
0 | 6099 |
6100 v3 = 0; | |
6101 if ( a2 ) | |
6102 { | |
6103 if ( a2 != 1 ) | |
6104 { | |
6105 if ( a2 == 2 ) | |
6106 v3 = 2; | |
6107 goto LABEL_13; | |
6108 } | |
6109 v3 = 2; | |
6110 } | |
6111 else | |
6112 { | |
6113 v3 = 1; | |
6114 } | |
6115 if ( pParty->uFine < 4000000 ) | |
6116 { | |
6117 v4 = a3 + pParty->uFine < 0; | |
6118 v5 = a3 + pParty->uFine; | |
6119 pParty->uFine += a3; | |
6120 if ( v4 ) | |
6121 { | |
6122 v5 = 0; | |
6123 pParty->uFine = 0; | |
6124 } | |
6125 if ( v5 > 4000000 ) | |
6126 pParty->uFine = 4000000; | |
6127 } | |
487 | 6128 |
6129 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6130 | |
0 | 6131 LABEL_13: |
463 | 6132 pParty->InTheShopFlags[a1] = 1; |
0 | 6133 if ( v3 ) |
6134 { | |
6135 v7 = &pOutdoor->ddm; | |
6136 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6137 v7 = &pIndoor->dlv; | |
6138 v7->uReputation += v3; | |
6139 if ( v7->uReputation > 10000 ) | |
6140 v7->uReputation = 10000; | |
6141 } | |
6142 v8 = &pPlayers[1]; | |
6143 do | |
6144 { | |
6145 result = *v8; | |
6146 if ( pParty->uFine ) | |
6147 { | |
735 | 6148 //v10 = result->_guilds_member_bits; |
484 | 6149 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6150 if ( !(short)result ) |
735 | 6151 __debugbreak(); |
501 | 6152 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6153 } |
6154 ++v8; | |
6155 } | |
6156 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6157 return result; | |
6158 } | |
6159 | |
6160 //----- (004B1523) -------------------------------------------------------- | |
762 | 6161 void __thiscall sub_4B1523(int *_this) |
0 | 6162 { |
6163 int v1; // esi@1 | |
6164 int v2; // edx@1 | |
6165 unsigned int v3; // eax@2 | |
6166 int v4; // eax@4 | |
6167 LONG v5; // ecx@4 | |
6168 int v6; // eax@10 | |
6169 char *v7; // ST44_4@12 | |
6170 unsigned __int16 v8; // ax@12 | |
6171 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6172 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6173 POINT a2; // [sp+64h] [bp-10h]@1 | |
6174 int v13; // [sp+6Ch] [bp-8h]@4 | |
6175 int v14; // [sp+70h] [bp-4h]@4 | |
6176 | |
6177 v1 = *_this - 399; | |
6178 v2 = (*_this - 400) % 11 + 1; | |
6179 v11 = 4 * (*_this - 400) / 11; | |
6180 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6181 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6182 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6183 else | |
6184 v3 = 30; | |
6185 a1.Hint = 0; | |
6186 a1.uFrameY = v3; | |
6187 a1.uFrameWidth = 328; | |
6188 a1.uFrameHeight = 68; | |
6189 a1.uFrameX = 90; | |
6190 a1.uFrameZ = 417; | |
6191 a1.uFrameW = v3 + 67; | |
6192 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6193 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6194 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6195 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6196 v5 = a2.y; | |
6197 if ( v14 > a2.y ) | |
6198 v5 = v14; | |
6199 if ( v13 > v5 ) | |
6200 v5 = v13; | |
6201 if ( v4 > v5 ) | |
6202 v5 = v4; | |
262 | 6203 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", |
6204 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6205 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6206 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6207 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6208 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6209 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6210 a1.uFrameHeight += v6; | |
6211 if ( (signed int)a1.uFrameHeight < 150 ) | |
6212 a1.uFrameHeight = 150; | |
819 | 6213 a1.uFrameWidth = game_viewport_width; |
0 | 6214 a1.DrawMessageBox(0); |
6215 a1.uFrameWidth -= 12; | |
6216 a1.uFrameHeight -= 12; | |
6217 v7 = pSpellStats->pInfos[v1].pName; | |
6218 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6219 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6220 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6221 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
6222 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6223 a1.uFrameZ = a1.uFrameX + 107; | |
6224 a1.uFrameWidth = 108; | |
6225 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6226 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6227 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6228 } |
6229 | |
6230 //----- (004B1784) -------------------------------------------------------- | |
6231 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6232 { | |
6233 Player *pPlayer; // ebx@1 | |
6234 bool result; // eax@2 | |
6235 unsigned __int16 v2; // ST0C_2@3 | |
6236 int v3; // eax@3 | |
6237 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6238 | |
6239 pPlayer = pPlayers[uActiveCharacter]; | |
6240 if ( pPlayer->CanAct() ) | |
6241 { | |
6242 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6243 result = 1; | |
6244 } | |
6245 else | |
6246 { | |
6247 pDialogueWindow->pNumPresenceButton = 0; | |
6248 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6249 v4.uFrameX = 483; | |
6250 v4.uFrameWidth = 148; | |
6251 v4.uFrameZ = 334; | |
6252 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6253 // "%s is in no condition to %s" | |
6254 // "do anything" | |
949 | 6255 v2 = TargetColor(255, 255, 0x9Bu); |
0 | 6256 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6257 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6258 result = 0; | |
6259 } | |
6260 return result; | |
6261 } | |
6262 // F8B1E0: using guessed type int dword_F8B1E0; | |
6263 | |
6264 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6265 void __cdecl ShowPopupShopItem() |
0 | 6266 { |
6267 POINT *v1; // esi@5 | |
6268 unsigned int v2; // eax@5 | |
6269 int v3; // ecx@5 | |
6270 POINT *v4; // esi@12 | |
6271 int v5; // eax@12 | |
6272 unsigned int v6; // eax@13 | |
6273 ItemGen *v7; // ecx@13 | |
6274 signed int v8; // esi@17 | |
6275 unsigned int v9; // eax@19 | |
475 | 6276 POINT v10; // [sp+8h] [bp-44h]@12 |
6277 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6278 POINT v12; // [sp+18h] [bp-34h]@18 | |
6279 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6280 POINT v14; // [sp+28h] [bp-24h]@17 | |
6281 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6282 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6283 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6284 |
484 | 6285 if ( in_current_building_type <= 0 ) |
0 | 6286 return; |
484 | 6287 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6288 { |
749 | 6289 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6290 { | |
6291 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6292 return; |
749 | 6293 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6294 { |
475 | 6295 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6296 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6297 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6298 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6299 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6300 return; |
907 | 6301 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6302 return; |
6303 } | |
749 | 6304 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6305 return; |
6306 } | |
475 | 6307 v4 = pMouse->GetCursorPos(&v11); |
6308 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6309 if ( !v5 ) |
6310 return; | |
336 | 6311 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6312 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6313 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6314 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6315 GameUI_DrawItemInfo(v7); | |
6316 return; | |
0 | 6317 } |
874 | 6318 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6319 { |
6320 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6321 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6322 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6323 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6324 if ( v5 ) | |
336 | 6325 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6326 } |
6327 } | |
6328 // F8B198: using guessed type int dword_F8B198; | |
6329 // F8B19C: using guessed type int dword_F8B19C; | |
6330 | |
6331 //----- (004B1BDB) -------------------------------------------------------- | |
6332 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6333 { | |
6334 signed __int64 v1; // ST2C_8@1 | |
6335 signed __int64 v2; // qax@1 | |
6336 signed __int64 v3; // ST1C_8@1 | |
6337 unsigned __int64 v4; // qax@1 | |
6338 unsigned int v5; // ebx@1 | |
112 | 6339 Player *v6; // ebx@1 |
0 | 6340 |
6341 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6342 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6343 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6344 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6345 v2 = v1 / 60 / 60; | |
6346 v3 = v2; | |
6347 v4 = (unsigned int)v2 / 0x18; | |
6348 v5 = (unsigned int)(v4 / 7) >> 2; | |
6349 pParty->uCurrentTimeSecond = v1 % 60; | |
6350 pParty->uCurrentMinute = v1 / 60 % 60; | |
6351 pParty->uCurrentHour = v3 % 24; | |
6352 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6353 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6354 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6355 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6356 pParty->RestAndHeal(); |
6357 dword_507B94 = 1; | |
112 | 6358 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6359 do |
6360 { | |
112 | 6361 v6->uTimeToRecovery = 0; |
6362 memset(&v6->uTimeToRecovery, 0, 4u); | |
6363 ++v6; | |
6364 } | |
6365 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6366 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6367 } |
6368 // 507B94: using guessed type int dword_507B94; | |
6369 | |
6370 //----- (004B1D27) -------------------------------------------------------- | |
6371 void __cdecl sub_4B1D27() | |
6372 { | |
6373 int v0; // edx@2 | |
6374 unsigned int v1; // ecx@7 | |
6375 signed int v2; // edi@10 | |
6376 int v3; // esi@10 | |
6377 __int16 v4; // ax@15 | |
6378 signed int v5; // edi@20 | |
6379 int v6; // esi@20 | |
6380 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6381 | |
484 | 6382 if ( in_current_building_type > 0 ) |
0 | 6383 { |
6384 v0 = 3; | |
484 | 6385 if ( in_current_building_type > BildingType_MagicShop ) |
6386 { | |
6387 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6388 { |
6389 if ( !dword_F8B1E4 ) | |
6390 return; | |
6391 } | |
6392 else | |
6393 { | |
484 | 6394 if ( in_current_building_type != BildingType_Temple ) |
0 | 6395 return; |
6396 } | |
336 | 6397 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6398 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6399 return; |
6400 } | |
336 | 6401 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6402 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6403 { |
6404 if ( pParty->uNumGold <= 0x2710 ) | |
6405 { | |
6406 if ( !dword_F8B1E4 ) | |
6407 return; | |
6408 v0 = 4; | |
907 | 6409 PlayHouseSound(v1, (HouseSoundID)v0); |
6410 return; | |
0 | 6411 } |
735 | 6412 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6413 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6414 { | |
6415 v5 = 0; | |
6416 v6 = 1; | |
6417 do | |
6418 { | |
6419 if ( pPlayers[v6]->CanAct() ) | |
6420 v7[v5++] = v6; | |
6421 ++v6; | |
6422 } | |
6423 while ( v6 <= 4 ); | |
6424 if ( v5 ) | |
6425 { | |
6426 qword_A750D8 = 256i64; | |
6427 word_A750E0 = 80; | |
6428 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6429 word_A750E2 = v4; |
6430 return; | |
0 | 6431 } |
6432 } | |
6433 } | |
6434 else | |
6435 { | |
6436 if ( !qword_A750D8 ) | |
6437 { | |
6438 v2 = 0; | |
6439 v3 = 1; | |
6440 do | |
6441 { | |
6442 if ( pPlayers[v3]->CanAct() ) | |
6443 v7[v2++] = v3; | |
6444 ++v3; | |
6445 } | |
6446 while ( v3 <= 4 ); | |
6447 if ( v2 ) | |
6448 { | |
6449 qword_A750D8 = 256i64; | |
6450 word_A750E0 = 80; | |
6451 v4 = LOWORD(v7[rand() % v2]); | |
6452 word_A750E2 = v4; | |
6453 return; | |
6454 } | |
6455 } | |
6456 } | |
6457 } | |
6458 } | |
6459 | |
6460 //----- (004B1ECE) -------------------------------------------------------- | |
6461 void __cdecl sub_4B1ECE() | |
6462 { | |
6463 __int16 *v0; // edi@1 | |
6464 int v1; // ebx@3 | |
6465 Player *v2; // esi@3 | |
6466 int v3; // eax@4 | |
6467 signed int v4; // eax@9 | |
6468 int v5; // ebx@11 | |
89 | 6469 Player *v6; // esi@13 |
6470 ItemGen *v7; // eax@14 | |
0 | 6471 signed int v8; // edi@14 |
89 | 6472 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6473 signed int v10; // [sp+10h] [bp-8h]@13 |
6474 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6475 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6476 |
484 | 6477 contract_approved = 0; |
0 | 6478 v11 = 0; |
6479 uDialogueType = 84; | |
827 | 6480 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6481 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6482 while ( 1 ) | |
6483 { | |
484 | 6484 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6485 { |
6486 v1 = 0; | |
6487 v2 = pParty->pPlayers; | |
6488 do | |
6489 { | |
89 | 6490 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6491 if ( v3 ) |
6492 break; | |
6493 ++v2; | |
6494 ++v1; | |
6495 } | |
6496 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6497 if ( v1 == 4 ) | |
6498 break; | |
6499 } | |
6500 ++v11; | |
6501 v0 += 2; | |
89 | 6502 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6503 break; | |
6504 } | |
6505 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6506 { | |
827 | 6507 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6508 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6509 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6510 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6511 } | |
484 | 6512 if ( contract_approved == 601 ) |
0 | 6513 { |
6514 v5 = 0; | |
89 | 6515 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6516 v9 = 0; |
6517 while ( 1 ) | |
6518 { | |
135 | 6519 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6520 { |
6521 v10 = 0; | |
89 | 6522 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6523 do |
6524 { | |
89 | 6525 v7 = v6->pInventoryItems; |
0 | 6526 v8 = 138; |
6527 do | |
6528 { | |
89 | 6529 if ( v7->uItemID == 601 ) |
0 | 6530 { |
377 | 6531 if ( !v7->uHolderPlayer ) |
89 | 6532 v9 = v7; |
377 | 6533 if ( v7->uHolderPlayer == v5 ) |
0 | 6534 v10 = 1; |
6535 } | |
89 | 6536 ++v7; |
0 | 6537 --v8; |
6538 } | |
6539 while ( v8 ); | |
89 | 6540 ++v6; |
6541 } | |
6542 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6543 if ( !v10 ) |
6544 break; | |
6545 } | |
89 | 6546 ++v12; |
0 | 6547 ++v5; |
89 | 6548 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6549 return; |
6550 } | |
6551 if ( v9 ) | |
377 | 6552 v9->uHolderPlayer = v5; |
0 | 6553 } |
6554 } | |
6555 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6556 // 722B3C: using guessed type int dword_722B3C; | |
6557 // 722B44: using guessed type int dword_722B44; | |
6558 // F8B1A8: using guessed type int dword_F8B1A8; | |
6559 | |
6560 //----- (004B2001) -------------------------------------------------------- | |
459 | 6561 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6562 { | |
6563 //signed int v1; // eax@1 | |
6564 NPCData *pCurrentNPCInfo; // ebp@1 | |
6565 int pEventNumber; // ecx@8 | |
0 | 6566 Player *v4; // esi@20 |
467 | 6567 //int v5; // eax@28 |
6568 //int v6; // eax@31 | |
6569 //int v7; // eax@34 | |
6570 //int v8; // eax@37 | |
6571 //int v9; // eax@40 | |
6572 //unsigned int v10; // eax@43 | |
0 | 6573 char *v12; // eax@53 |
6574 char *v13; // eax@56 | |
6575 char *v14; // eax@57 | |
6576 char *v15; // eax@58 | |
467 | 6577 //unsigned int v16; // ebp@62 |
0 | 6578 char *v17; // ecx@63 |
6579 char *v18; // eax@65 | |
6580 const char *v19; // ecx@68 | |
248 | 6581 //unsigned int v20; // eax@69 |
467 | 6582 signed int pPrice; // ecx@70 |
0 | 6583 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6584 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6585 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6586 //int v25; // [sp-4h] [bp-10h]@49 |
6587 | |
459 | 6588 uDialogueType = uMessageParam + 1; |
6589 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6590 if ( uMessageParam <= 24 ) |
460 | 6591 { |
459 | 6592 switch ( uMessageParam ) |
6593 { | |
6594 case 13: | |
827 | 6595 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6596 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6597 NPCHireableDialogPrepare(); |
459 | 6598 dialogue_show_profession_details = false; |
6599 goto _return; | |
6600 case 19: | |
6601 pEventNumber = pCurrentNPCInfo->evt_A; | |
6602 break; | |
6603 case 20: | |
6604 pEventNumber = pCurrentNPCInfo->evt_B; | |
6605 break; | |
6606 case 21: | |
6607 pEventNumber = pCurrentNPCInfo->evt_C; | |
6608 break; | |
6609 case 22: | |
6610 pEventNumber = pCurrentNPCInfo->evt_D; | |
6611 break; | |
6612 case 23: | |
6613 pEventNumber = pCurrentNPCInfo->evt_E; | |
6614 break; | |
6615 case 24: | |
6616 pEventNumber = pCurrentNPCInfo->evt_F; | |
6617 break; | |
6618 default: | |
467 | 6619 goto _return; |
6620 } | |
6621 /*switch ( pEventNumber ) | |
6622 { | |
6623 case 139: | |
6624 sub_4B1ECE(); | |
6625 goto _return; | |
6626 case 311: | |
6627 sub_4BBA85_bounties(); | |
6628 goto _return; | |
6629 }*/ | |
459 | 6630 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6631 { | |
6632 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6633 { | |
6634 if ( pEventNumber == 139 ) | |
0 | 6635 { |
6636 sub_4B1ECE(); | |
6637 } | |
6638 else | |
6639 { | |
459 | 6640 if ( pEventNumber == 311 ) |
0 | 6641 { |
6642 sub_4BBA85_bounties(); | |
6643 } | |
6644 else | |
6645 { | |
827 | 6646 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6647 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6648 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6649 activeLevelDecoration = NULL; |
0 | 6650 } |
6651 } | |
6652 } | |
6653 else | |
6654 { | |
459 | 6655 dword_F8B1D8 = uMessageParam; |
6656 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6657 } |
6658 } | |
6659 else | |
6660 { | |
459 | 6661 sub_4B3FE5(pEventNumber); |
0 | 6662 } |
6663 goto _return; | |
460 | 6664 } |
459 | 6665 if ( uMessageParam != 76 ) |
6666 { | |
6667 if ( uMessageParam == 77 ) | |
6668 { | |
467 | 6669 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6670 if (dialogue_show_profession_details) |
459 | 6671 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6672 else |
459 | 6673 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6674 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6675 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6676 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6677 current_npc_text = v18; |
0 | 6678 } |
6679 else | |
6680 { | |
459 | 6681 if ( uMessageParam == 79 ) |
0 | 6682 { |
484 | 6683 if ( contract_approved ) |
0 | 6684 { |
267 | 6685 Party::TakeGold(gold_transaction_amount); |
0 | 6686 if ( uActiveCharacter ) |
6687 { | |
492 | 6688 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6689 *(short *)v12 &= 0x3Fu; |
6690 switch ( dword_F8B1B0 ) | |
6691 { | |
6692 case 2: | |
492 | 6693 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6694 *v15 |= 0x40u; |
6695 break; | |
6696 case 3: | |
492 | 6697 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6698 *v14 |= 0x80u; |
6699 break; | |
6700 case 4: | |
492 | 6701 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6702 v13[1] |= 1u; |
6703 break; | |
6704 } | |
187 | 6705 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6706 } |
437 | 6707 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6708 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6709 { |
6710 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6711 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6712 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6713 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6714 }*/ |
0 | 6715 } |
6716 } | |
6717 else | |
6718 { | |
492 | 6719 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6720 { |
267 | 6721 Party::TakeGold(gold_transaction_amount); |
0 | 6722 v4 = pParty->pPlayers; |
6723 do | |
6724 { | |
492 | 6725 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6726 ++v4; |
6727 } | |
6728 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6729 switch ( dword_F8B1D8 ) | |
6730 { | |
6731 case 19: | |
467 | 6732 pEventNumber = pCurrentNPCInfo->evt_A; |
6733 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6734 pCurrentNPCInfo->evt_A = 0; |
0 | 6735 break; |
6736 case 20: | |
467 | 6737 pEventNumber = pCurrentNPCInfo->evt_B; |
6738 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6739 pCurrentNPCInfo->evt_B = 0; |
0 | 6740 break; |
6741 case 21: | |
467 | 6742 pEventNumber = pCurrentNPCInfo->evt_C; |
6743 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6744 pCurrentNPCInfo->evt_C = 0; |
0 | 6745 break; |
6746 case 22: | |
467 | 6747 pEventNumber = pCurrentNPCInfo->evt_D; |
6748 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6749 pCurrentNPCInfo->evt_D = 0; |
0 | 6750 break; |
6751 case 23: | |
467 | 6752 pEventNumber = pCurrentNPCInfo->evt_E; |
6753 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6754 pCurrentNPCInfo->evt_E = 0; |
0 | 6755 break; |
6756 case 24: | |
467 | 6757 pEventNumber = pCurrentNPCInfo->evt_F; |
6758 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6759 pCurrentNPCInfo->evt_F = 0; | |
0 | 6760 break; |
6761 } | |
437 | 6762 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6763 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6764 { |
6765 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6766 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6767 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6768 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6769 }*/ |
467 | 6770 //v11 = uActiveCharacter; |
0 | 6771 if ( uActiveCharacter ) |
6772 { | |
467 | 6773 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6774 goto _return; |
6775 } | |
6776 } | |
6777 } | |
6778 } | |
6779 goto _return; | |
6780 } | |
6781 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6782 { | |
467 | 6783 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6784 goto _return; |
6785 } | |
459 | 6786 if ( pCurrentNPCInfo->uProfession != 51 ) |
6787 { | |
467 | 6788 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6789 if ( pParty->uNumGold < pPrice ) | |
6790 { | |
6791 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6792 dialogue_show_profession_details = false; |
0 | 6793 uDialogueType = 13; |
827 | 6794 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6795 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6796 if ( uActiveCharacter ) |
248 | 6797 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6798 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6799 goto _return; | |
6800 } | |
6801 Party::TakeGold(pPrice); | |
0 | 6802 } |
147 | 6803 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6804 pCurrentNPCInfo->uFlags |= 128; |
0 | 6805 pParty->field_709 = 0; |
659 | 6806 Party__CountHirelings(); |
0 | 6807 if ( pParty->pHirelings[0].pName ) |
6808 { | |
459 | 6809 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6810 v24 = pCurrentNPCInfo->pName; | |
0 | 6811 v22 = pParty->pHireling2Name; |
6812 } | |
6813 else | |
6814 { | |
459 | 6815 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6816 v24 = pCurrentNPCInfo->pName; | |
0 | 6817 v22 = pParty->pHireling1Name; |
6818 } | |
6819 strcpy(v22, v24); | |
6820 pParty->field_709 = 0; | |
659 | 6821 Party__CountHirelings(); |
480 | 6822 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6823 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6824 |
6825 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6826 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6827 { |
6828 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6829 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6830 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6831 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6832 }*/ |
0 | 6833 if ( uActiveCharacter ) |
467 | 6834 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6835 _return: |
460 | 6836 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6837 } |
6838 | |
6839 //----- (004B254D) -------------------------------------------------------- | |
6840 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6841 { | |
6842 Player *v1; // esi@1 | |
6843 int v2; // edx@1 | |
6844 int v3; // ecx@1 | |
6845 int v4; // edi@1 | |
6846 int v5; // eax@7 | |
6847 int v6; // eax@7 | |
6848 int v7; // ebx@7 | |
6849 int v8; // ebx@8 | |
6850 signed int v9; // esi@8 | |
6851 int v10; // eax@8 | |
6852 char *v11; // ecx@8 | |
6853 int v12; // edi@9 | |
6854 char *v13; // edx@9 | |
6855 signed int v14; // edi@10 | |
6856 unsigned int v16; // eax@29 | |
6857 int v17; // eax@36 | |
6858 char v18; // cl@46 | |
6859 __int16 v19; // dx@56 | |
6860 int v20; // eax@60 | |
6861 char *v21; // [sp-Ch] [bp-38h]@82 | |
6862 const char *v22; // [sp-8h] [bp-34h]@21 | |
6863 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6864 char *v24; // [sp-8h] [bp-34h]@82 | |
6865 char *v25; // [sp-4h] [bp-30h]@14 | |
6866 int v26; // [sp-4h] [bp-30h]@38 | |
6867 int v27; // [sp-4h] [bp-30h]@82 | |
6868 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6869 int v29; // [sp+10h] [bp-1Ch]@13 | |
6870 int v30; // [sp+14h] [bp-18h]@15 | |
6871 int v31; // [sp+18h] [bp-14h]@16 | |
6872 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6873 int v33; // [sp+20h] [bp-Ch]@7 | |
6874 int v34; // [sp+24h] [bp-8h]@7 | |
6875 char *v35; // [sp+28h] [bp-4h]@1 | |
6876 | |
6877 v1 = pPlayers[uActiveCharacter]; | |
484 | 6878 contract_approved = 0; |
0 | 6879 v2 = (_this - 200) % 3; |
6880 v3 = (_this - 200) / 3; | |
6881 v4 = v2; | |
6882 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6883 dword_F8B1AC_award_bit_number = v3; |
0 | 6884 if ( v2 ) |
6885 { | |
6886 if ( v2 == 1 ) | |
6887 { | |
267 | 6888 gold_transaction_amount = 5000; |
0 | 6889 dword_F8B1B0 = 3; |
6890 } | |
6891 else | |
6892 { | |
6893 if ( v2 == 2 ) | |
6894 { | |
267 | 6895 gold_transaction_amount = 8000; |
0 | 6896 dword_F8B1B0 = 4; |
6897 } | |
6898 } | |
6899 } | |
6900 else | |
6901 { | |
267 | 6902 gold_transaction_amount = 2000; |
0 | 6903 dword_F8B1B0 = 2; |
6904 } | |
135 | 6905 v5 = v1->classType; |
0 | 6906 v33 = v5; |
6907 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
6908 *(int *)a1 = v1->pActiveSkills[v3]; | |
6909 v7 = a1[0] & 0x3F; | |
6910 v34 = v2 + 2; | |
6911 if ( v6 < v2 + 2 ) | |
6912 { | |
6913 v8 = v33; | |
6914 v9 = 0; | |
6915 v10 = v33 - v33 % 4; | |
6916 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
6917 do | |
6918 { | |
6919 v12 = (unsigned __int8)*v11; | |
6920 v13 = &v28[4 * v9]; | |
6921 *(int *)v13 = 0; | |
6922 if ( v12 < v34 ) | |
6923 { | |
6924 v14 = 1; | |
6925 } | |
6926 else | |
6927 { | |
6928 v14 = 1; | |
6929 *(int *)v13 = 1; | |
6930 } | |
6931 ++v9; | |
6932 v11 += 37; | |
6933 } | |
6934 while ( v9 < 4 ); | |
6935 if ( v29 == v14 ) | |
6936 { | |
6937 v25 = pClassNames[v10 + 1]; | |
6938 } | |
6939 else | |
6940 { | |
6941 if ( v30 == v14 ) | |
6942 { | |
6943 if ( v31 == v14 ) | |
6944 { | |
6945 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
6946 return pTmpBuf; | |
6947 } | |
6948 v25 = pClassNames[v10 + 2]; | |
6949 } | |
6950 else | |
6951 { | |
6952 if ( v31 != v14 ) | |
6953 { | |
6954 v25 = pClassNames[v8]; | |
6955 v22 = pGlobalTXT_LocalizationStrings[632]; | |
6956 goto LABEL_23; | |
6957 } | |
6958 v25 = pClassNames[v10 + 3]; | |
6959 } | |
6960 } | |
6961 v22 = pGlobalTXT_LocalizationStrings[633]; | |
6962 LABEL_23: | |
6963 sprintf(pTmpBuf, v22, v25); | |
6964 return pTmpBuf; | |
6965 } | |
6966 if ( !v1->CanAct() ) | |
6967 return (char *)pNPCTopics[122].pText; | |
6968 if ( !v7 ) | |
6969 return (char *)pNPCTopics[131].pText; | |
6970 v16 = SkillToMastery(a1[0]); | |
6971 if ( (signed int)v16 > v4 + 1 ) | |
6972 return (char *)pNPCTopics[v4 + 128].pText; | |
6973 if ( v34 != 2 ) | |
6974 { | |
6975 if ( v34 == 3 ) | |
6976 { | |
6977 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6978 { | |
492 | 6979 v17 = dword_F8B1AC_award_bit_number; |
6980 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 6981 { |
6982 default: | |
6983 goto LABEL_41; | |
6984 case 12: | |
6985 case 13: | |
6986 case 14: | |
6987 case 15: | |
6988 case 16: | |
6989 case 17: | |
6990 case 18: | |
267 | 6991 gold_transaction_amount = 4000; |
0 | 6992 goto LABEL_42; |
6993 case 19: | |
6994 v19 = 114; | |
6995 goto LABEL_57; | |
6996 case 20: | |
6997 v19 = 110; | |
6998 LABEL_57: | |
484 | 6999 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7000 return v35; |
7001 goto LABEL_40; | |
7002 case 22: | |
7003 v20 = v1->GetBaseWillpower(); | |
7004 goto LABEL_61; | |
7005 case 24: | |
267 | 7006 gold_transaction_amount = 2500; |
0 | 7007 v20 = v1->GetBaseEndurance(); |
7008 goto LABEL_61; | |
7009 case 36: | |
7010 v20 = v1->GetBaseIntelligence(); | |
7011 LABEL_61: | |
7012 if ( v20 < 50 ) | |
7013 return v35; | |
7014 goto LABEL_40; | |
7015 case 21: | |
7016 case 23: | |
7017 case 25: | |
7018 case 26: | |
7019 case 29: | |
7020 case 32: | |
7021 case 34: | |
7022 case 35: | |
267 | 7023 gold_transaction_amount = 2500; |
0 | 7024 goto LABEL_42; |
7025 case 8: | |
7026 case 9: | |
7027 case 10: | |
7028 case 11: | |
267 | 7029 gold_transaction_amount = 3000; |
0 | 7030 goto LABEL_42; |
7031 case 7: | |
7032 goto LABEL_67; | |
7033 } | |
7034 goto LABEL_67; | |
7035 } | |
7036 } | |
7037 else | |
7038 { | |
7039 if ( v34 != 4 ) | |
7040 { | |
7041 LABEL_40: | |
492 | 7042 v17 = dword_F8B1AC_award_bit_number; |
0 | 7043 goto LABEL_41; |
7044 } | |
7045 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7046 { | |
492 | 7047 v17 = dword_F8B1AC_award_bit_number; |
7048 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7049 { |
7050 case 19: | |
7051 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7052 goto LABEL_40; | |
7053 v26 = 1; | |
7054 v23 = 26; | |
7055 goto LABEL_39; | |
7056 default: | |
7057 goto LABEL_41; | |
7058 case 20: | |
7059 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7060 goto LABEL_40; | |
7061 v26 = 1; | |
7062 v23 = 27; | |
7063 LABEL_39: | |
7064 if ( v1->_49327B(v23, v26) == 1 ) | |
7065 goto LABEL_40; | |
7066 return v35; | |
7067 case 30: | |
7068 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7069 goto LABEL_47; | |
7070 case 31: | |
7071 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7072 LABEL_47: | |
7073 if ( (v18 & 0x3Fu) < 0xA ) | |
7074 return v35; | |
7075 goto LABEL_41; | |
7076 case 21: | |
7077 case 23: | |
7078 case 24: | |
7079 case 25: | |
7080 case 26: | |
7081 case 29: | |
7082 case 32: | |
7083 case 34: | |
7084 case 35: | |
267 | 7085 gold_transaction_amount = 6000; |
0 | 7086 goto LABEL_42; |
7087 case 8: | |
7088 case 9: | |
7089 case 10: | |
7090 case 11: | |
267 | 7091 gold_transaction_amount = 7000; |
0 | 7092 goto LABEL_42; |
7093 case 7: | |
7094 break; | |
7095 } | |
7096 LABEL_67: | |
267 | 7097 gold_transaction_amount = 0; |
0 | 7098 goto LABEL_41; |
7099 } | |
7100 } | |
7101 return v35; | |
7102 } | |
7103 if ( v7 < 4 ) | |
7104 return v35; | |
492 | 7105 v17 = dword_F8B1AC_award_bit_number; |
7106 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7107 { | |
7108 if ( dword_F8B1AC_award_bit_number != 29 | |
7109 && dword_F8B1AC_award_bit_number != 32 | |
7110 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7111 { |
7112 LABEL_41: | |
267 | 7113 if ( !gold_transaction_amount ) |
0 | 7114 goto LABEL_79; |
7115 goto LABEL_42; | |
7116 } | |
7117 LABEL_87: | |
267 | 7118 gold_transaction_amount = 500; |
0 | 7119 goto LABEL_41; |
7120 } | |
492 | 7121 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7122 goto LABEL_87; |
492 | 7123 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7124 { |
267 | 7125 gold_transaction_amount = 0; |
0 | 7126 goto LABEL_79; |
7127 } | |
492 | 7128 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7129 goto LABEL_41; |
492 | 7130 if ( dword_F8B1AC_award_bit_number > 18 ) |
7131 { | |
7132 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7133 goto LABEL_41; |
7134 goto LABEL_87; | |
7135 } | |
267 | 7136 gold_transaction_amount = 1000; |
0 | 7137 LABEL_42: |
267 | 7138 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7139 return (char *)pNPCTopics[124].pText; |
7140 LABEL_79: | |
484 | 7141 contract_approved = 1; |
0 | 7142 if ( v34 == 2 ) |
7143 { | |
267 | 7144 v27 = gold_transaction_amount; |
0 | 7145 v24 = pSkillNames[v17]; |
7146 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7147 goto LABEL_90; | |
7148 } | |
7149 if ( v34 == 3 ) | |
7150 { | |
267 | 7151 v27 = gold_transaction_amount; |
0 | 7152 v24 = pSkillNames[v17]; |
7153 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7154 goto LABEL_90; | |
7155 } | |
7156 if ( v34 == 4 ) | |
7157 { | |
267 | 7158 v27 = gold_transaction_amount; |
0 | 7159 v24 = pSkillNames[v17]; |
7160 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7161 LABEL_90: | |
809 | 7162 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); |
0 | 7163 } |
7164 return pTmpBuf2; | |
7165 } | |
7166 | |
7167 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7168 const char * ContractSelectText( int pEventCode ) |
7169 { | |
7170 static const int dialogue_base=110; | |
484 | 7171 contract_approved = 0; |
492 | 7172 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7173 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7174 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7175 { | |
492 | 7176 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7177 { | |
7178 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7179 } |
7180 else | |
7181 { | |
267 | 7182 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7183 { |
484 | 7184 contract_approved = 1; |
492 | 7185 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7186 } |
7187 else | |
7188 { | |
492 | 7189 return pNPCTopics[dialogue_base+14].pText; |
0 | 7190 } |
7191 } | |
7192 } | |
7193 else | |
7194 { | |
492 | 7195 return pNPCTopics[dialogue_base+12].pText; |
0 | 7196 } |
7197 } | |
7198 | |
7199 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7200 void SimpleHouseAndBoatsDialog() |
0 | 7201 { |
7202 char *v0; // esi@3 | |
7203 char *v1; // ST1C_4@3 | |
7204 char *v2; // eax@3 | |
7205 const char *v3; // ST1C_4@5 | |
7206 int v4; // eax@5 | |
7207 unsigned int i; // eax@5 | |
7208 NPCData *v6; // esi@6 | |
7209 unsigned __int16 v7; // bx@6 | |
7210 unsigned int v8; // eax@6 | |
7211 int v9; // eax@11 | |
7212 unsigned int v10; // ecx@12 | |
7213 int v11; // eax@12 | |
7214 int v12; // esi@12 | |
7215 char *v13; // eax@12 | |
7216 GUIWindow *v14; // ebx@13 | |
7217 char *v15; // esi@14 | |
7218 GUIButton *v16; // eax@15 | |
7219 unsigned int v17; // ecx@15 | |
7220 int v18; // ecx@17 | |
7221 int v19; // ecx@18 | |
7222 int v20; // ecx@19 | |
7223 int v21; // ecx@20 | |
7224 int v22; // ecx@21 | |
7225 unsigned int v23; // ecx@23 | |
7226 int v24; // ecx@35 | |
7227 int v25; // ecx@36 | |
7228 int v26; // ecx@37 | |
7229 int v27; // ecx@38 | |
7230 int v28; // ecx@39 | |
7231 char *v29; // esi@42 | |
7232 unsigned int v30; // ST20_4@42 | |
7233 int v31; // ST1C_4@42 | |
7234 unsigned int v32; // eax@42 | |
7235 char *v33; // eax@43 | |
7236 int v34; // esi@51 | |
7237 int v35; // eax@51 | |
7238 unsigned int v36; // edi@51 | |
7239 GUIButton *v37; // eax@52 | |
7240 int v38; // eax@52 | |
7241 signed int v39; // ecx@54 | |
7242 int v40; // edi@57 | |
7243 GUIButton *v41; // eax@60 | |
7244 GUIButton *v42; // esi@60 | |
7245 const char *v43; // ebx@60 | |
7246 int v44; // eax@60 | |
7247 unsigned int v45; // ecx@60 | |
7248 unsigned __int16 v46; // ax@60 | |
7249 GUIFont *v47; // ebx@64 | |
7250 int v48; // esi@64 | |
7251 char *v49; // eax@66 | |
7252 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7253 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7254 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7255 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7256 int v55; // [sp+10Ch] [bp-10h]@6 | |
7257 int v56; // [sp+110h] [bp-Ch]@13 | |
7258 char *pInString; // [sp+114h] [bp-8h]@12 | |
7259 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7260 | |
7261 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7262 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7263 { |
7264 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7265 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7266 a1.uFrameX = 493; | |
7267 a1.uFrameWidth = 126; | |
7268 a1.uFrameZ = 366; | |
7269 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7270 a1.uFrameX = 483; | |
7271 a1.uFrameWidth = 148; | |
7272 a1.uFrameZ = 334; | |
434 | 7273 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7274 if ( !v2 ) |
7275 { | |
721 | 7276 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7277 v2 = pTmpBuf; |
7278 } | |
7279 v3 = v2; | |
7280 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7281 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7282 return; | |
0 | 7283 } |
7284 a1.uFrameWidth -= 10; | |
7285 a1.uFrameZ -= 10; | |
459 | 7286 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7287 v6 = v58; |
949 | 7288 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7289 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7290 v8 = v6->uProfession; |
7291 if ( v8 ) | |
264 | 7292 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7293 else |
7294 strcpy(pTmpBuf, v6->pName); | |
7295 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7296 if ( !dword_591080 ) | |
7297 { | |
7298 if ( !uDialogueType ) | |
7299 { | |
7300 v9 = v6->greet; | |
7301 if ( v9 ) | |
7302 { | |
7303 v10 = v6->uFlags; | |
819 | 7304 a1.uFrameWidth = game_viewport_width; |
0 | 7305 a1.uFrameZ = 452; |
7306 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7307 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7308 v12 = v11 + 7; | |
7309 pRenderer->_4A6A68( | |
7310 8u, | |
7311 352 - (v11 + 7), | |
7312 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7313 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7314 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7315 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7316 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7317 } | |
7318 } | |
7319 } | |
7320 v14 = pDialogueWindow; | |
7321 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7322 v52.uFrameX = 483; | |
7323 v52.uFrameWidth = 148; | |
7324 v52.uFrameZ = 334; | |
7325 v56 = v52.pStartingPosActiveItem; | |
7326 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7327 { | |
348 | 7328 v15 = "";//(char *)v54; |
0 | 7329 while ( 1 ) |
7330 { | |
7331 v16 = v52.GetControl(v56); | |
832 | 7332 v17 = v16->msg_param; |
0 | 7333 pInString = (char *)v16; |
7334 if ( (signed int)v17 > 24 ) | |
7335 { | |
7336 v24 = v17 - 76; | |
7337 if ( !v24 ) | |
7338 { | |
7339 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7340 goto LABEL_49; | |
7341 } | |
7342 v25 = v24 - 1; | |
7343 if ( !v25 ) | |
7344 { | |
7345 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7346 goto LABEL_49; | |
7347 } | |
7348 v26 = v25 - 2; | |
7349 if ( !v26 ) | |
7350 { | |
7351 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7352 LABEL_44: | |
7353 v15 = v33; | |
7354 LABEL_45: | |
7355 v16 = (GUIButton *)pInString; | |
7356 goto LABEL_49; | |
7357 } | |
7358 v27 = v26 - 3; | |
7359 if ( !v27 ) | |
7360 { | |
459 | 7361 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7362 goto LABEL_44; |
7363 } | |
7364 v28 = v27 - 1; | |
7365 if ( !v28 ) | |
7366 { | |
7367 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7368 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7369 v31 = *(int *)v29; |
949 | 7370 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 7371 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); |
7372 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7373 current_npc_text = pTmpBuf2; |
0 | 7374 v15 = ""; |
7375 goto LABEL_45; | |
7376 } | |
7377 if ( v28 != 10 ) | |
7378 goto LABEL_41; | |
7379 } | |
7380 else | |
7381 { | |
7382 if ( v17 == 24 ) | |
7383 { | |
291 | 7384 v23 = v58->evt_F; |
0 | 7385 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7386 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7387 if ( !v15 ) |
7388 { | |
832 | 7389 v16->msg_param = 0; |
0 | 7390 v15 = ""; |
7391 } | |
7392 goto LABEL_49; | |
7393 } | |
7394 v18 = v17 - 13; | |
7395 if ( v18 ) | |
7396 { | |
7397 v19 = v18 - 6; | |
7398 if ( !v19 ) | |
7399 { | |
291 | 7400 v23 = v58->evt_A; |
0 | 7401 goto LABEL_33; |
7402 } | |
7403 v20 = v19 - 1; | |
7404 if ( !v20 ) | |
7405 { | |
291 | 7406 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7407 if ( !v15 ) |
7408 { | |
832 | 7409 v16->msg_param = 0; |
0 | 7410 v15 = ""; |
7411 } | |
7412 if ( uDialogueType != 84 ) | |
7413 goto LABEL_49; | |
484 | 7414 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7415 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7416 current_npc_text = pTmpBuf2; | |
0 | 7417 goto LABEL_45; |
7418 } | |
7419 v21 = v20 - 1; | |
7420 if ( !v21 ) | |
7421 { | |
291 | 7422 v23 = v58->evt_C; |
0 | 7423 goto LABEL_33; |
7424 } | |
7425 v22 = v21 - 1; | |
7426 if ( !v22 ) | |
7427 { | |
291 | 7428 v23 = v58->evt_D; |
0 | 7429 goto LABEL_33; |
7430 } | |
7431 if ( v22 == 1 ) | |
7432 { | |
291 | 7433 v23 = v58->evt_E; |
0 | 7434 goto LABEL_33; |
7435 } | |
7436 LABEL_41: | |
7437 v15 = ""; | |
7438 goto LABEL_49; | |
7439 } | |
7440 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7441 } | |
7442 LABEL_49: | |
7443 strcpy(v16->pButtonName, v15); | |
7444 ++v56; | |
7445 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7446 { | |
7447 v14 = pDialogueWindow; | |
7448 break; | |
7449 } | |
7450 } | |
7451 } | |
7452 v34 = 0; | |
949 | 7453 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7454 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7455 v36 = v14->pStartingPosActiveItem; |
7456 v55 = v35; | |
7457 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7458 + pDialogueWindow->pStartingPosActiveItem ) | |
7459 { | |
7460 v37 = v14->GetControl(v36); | |
7461 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7462 v14 = pDialogueWindow; | |
7463 v34 += v38; | |
7464 ++v36; | |
7465 } | |
7466 v39 = v14->pNumPresenceButton; | |
7467 if ( v39 ) | |
7468 { | |
7469 v58 = (NPCData *)((174 - v34) / v39); | |
7470 if ( (signed int)v58 > 32 ) | |
7471 v58 = (NPCData *)32; | |
7472 pInString = (char *)2; | |
7473 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7474 v56 = v14->pStartingPosActiveItem; | |
7475 i = v56; | |
7476 if ( (signed int)i < (signed int)(i + v39) ) | |
7477 { | |
7478 while ( 1 ) | |
7479 { | |
7480 v41 = v14->GetControl(i); | |
7481 v42 = v41; | |
7482 v43 = v41->pButtonName; | |
7483 v41->uY = (unsigned int)((char *)v58 + v40); | |
7484 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7485 v45 = v42->uY; | |
7486 v42->uHeight = v44; | |
7487 v40 = v45 + v44 - 1; | |
7488 v42->uW = v40; | |
7489 v46 = v55; | |
7490 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7491 v46 = v54; | |
7492 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7493 v14 = pDialogueWindow; | |
7494 ++pInString; | |
7495 ++v56; | |
7496 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7497 if ( v56 >= (signed int)i ) | |
7498 break; | |
7499 i = v56; | |
7500 } | |
7501 } | |
7502 } | |
827 | 7503 if ( current_npc_text ) |
0 | 7504 { |
7505 w.uFrameWidth = 458; | |
7506 w.uFrameZ = 457; | |
7507 v47 = pFontArrus; | |
827 | 7508 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7509 if ( 352 - v48 < 8 ) |
7510 { | |
7511 v47 = pFontCreate; | |
827 | 7512 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7513 } |
7514 pRenderer->_4A6A68( | |
7515 8u, | |
7516 352 - v48, | |
7517 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7518 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7519 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
827 | 7520 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7521 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7522 } | |
0 | 7523 } |
7524 | |
7525 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7526 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7527 { |
832 | 7528 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7529 } |
7530 | |
7531 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7532 void sub_4B3A72( int a1 ) |
7533 { | |
7534 int num_buttons; // esi@1 | |
7535 | |
7536 num_buttons = 0; | |
0 | 7537 if ( a1 == 21 ) |
7538 { | |
473 | 7539 CreateButtonInColumn(0, 0x66u); |
7540 num_buttons = 2; | |
7541 CreateButtonInColumn(1, 0x67u); | |
7542 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7543 { | |
7544 num_buttons = 3; | |
7545 CreateButtonInColumn(2, 0x68u); | |
7546 } | |
7547 } | |
7548 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7549 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7550 } | |
7551 // F8B1E0: using guessed type int dword_F8B1E0; | |
7552 | |
7553 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7554 void sub_4B3AD4( signed int a1 ) |
7555 { | |
0 | 7556 if ( a1 > 0 ) |
7557 { | |
7558 if ( a1 <= 3 ) | |
7559 { | |
473 | 7560 CreateButtonInColumn(0, 3u); |
7561 CreateButtonInColumn(1, 4u); | |
7562 CreateButtonInColumn(2, 5u); | |
7563 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7564 } |
7565 if ( a1 == 4 ) | |
7566 { | |
473 | 7567 CreateButtonInColumn(0, 3u); |
7568 CreateButtonInColumn(1, 4u); | |
7569 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7570 } | |
7571 } | |
0 | 7572 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7573 } | |
7574 // F8B1E0: using guessed type int dword_F8B1E0; | |
7575 | |
7576 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7577 void sub_4B3B42( signed int a1 ) |
7578 { | |
0 | 7579 int v1; // ecx@18 |
7580 int v2; // ecx@19 | |
7581 int v3; // ecx@20 | |
7582 signed int v4; // esi@22 | |
7583 signed int v5; // eax@22 | |
7584 unsigned int v6; // edx@24 | |
7585 int v7; // ecx@24 | |
7586 int result; // eax@43 | |
7587 int v9; // [sp-10h] [bp-14h]@28 | |
7588 int v10; // [sp-Ch] [bp-10h]@28 | |
7589 int v11; // [sp-8h] [bp-Ch]@28 | |
7590 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7591 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7592 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7593 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7594 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7595 int v17; // [sp-4h] [bp-8h]@28 | |
7596 | |
7597 if ( a1 > 13 ) | |
7598 { | |
7599 if ( a1 > 22 ) | |
7600 { | |
7601 if ( a1 == 23 ) | |
7602 { | |
473 | 7603 CreateButtonInColumn(0, 0xAu); |
7604 CreateButtonInColumn(1, 0xBu); | |
0 | 7605 v14 = 96; |
7606 LABEL_41: | |
473 | 7607 CreateButtonInColumn(2, v14); |
0 | 7608 v17 = 2; |
7609 v11 = 0; | |
7610 v10 = 1; | |
7611 v9 = 3; | |
7612 goto LABEL_42; | |
7613 } | |
7614 if ( a1 <= 26 ) | |
7615 goto LABEL_43; | |
7616 if ( a1 > 28 ) | |
7617 { | |
7618 if ( a1 != 30 ) | |
7619 goto LABEL_43; | |
473 | 7620 CreateButtonInColumn(0, 0x11u); |
0 | 7621 v16 = 96; |
7622 goto LABEL_37; | |
7623 } | |
473 | 7624 CreateButtonInColumn(0, 0x69u); |
7625 CreateButtonInColumn(1, 0x6Au); | |
7626 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7627 v12 = 108; |
7628 } | |
7629 else | |
7630 { | |
7631 if ( a1 == 22 ) | |
7632 { | |
473 | 7633 CreateButtonInColumn(0, 7u); |
0 | 7634 v16 = 8; |
7635 goto LABEL_37; | |
7636 } | |
7637 v1 = a1 - 14; | |
7638 if ( !v1 ) | |
7639 { | |
473 | 7640 CreateButtonInColumn(0, 0x12u); |
7641 CreateButtonInColumn(1, 0x30u); | |
7642 CreateButtonInColumn(2, 0x31u); | |
7643 CreateButtonInColumn(3, 0x32u); | |
7644 CreateButtonInColumn(4, 0x33u); | |
0 | 7645 v17 = 2; |
7646 v11 = 0; | |
7647 v10 = 1; | |
7648 v9 = 5; | |
7649 goto LABEL_42; | |
7650 } | |
7651 v2 = v1 - 1; | |
7652 if ( v2 ) | |
7653 { | |
7654 v3 = v2 - 2; | |
7655 if ( v3 ) | |
7656 { | |
7657 if ( v3 != 4 ) | |
7658 goto LABEL_43; | |
473 | 7659 CreateButtonInColumn(0, 0xFu); |
7660 CreateButtonInColumn(1, 0x10u); | |
0 | 7661 v4 = 3; |
473 | 7662 CreateButtonInColumn(2, 0x60u); |
336 | 7663 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7664 if ( v5 < 108 || v5 > 120 ) |
7665 goto LABEL_28; | |
7666 v4 = 4; | |
7667 v6 = 101; | |
7668 v7 = 3; | |
7669 } | |
7670 else | |
7671 { | |
7672 v4 = 1; | |
473 | 7673 CreateButtonInColumn(0, 0x63u); |
0 | 7674 if ( !pParty->uFine ) |
7675 { | |
7676 LABEL_28: | |
7677 v17 = 2; | |
7678 v11 = 0; | |
7679 v10 = 1; | |
7680 v9 = v4; | |
7681 LABEL_42: | |
7682 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7683 goto LABEL_43; | |
7684 } | |
7685 v4 = 2; | |
7686 v7 = 1; | |
7687 v6 = 100; | |
7688 } | |
473 | 7689 CreateButtonInColumn(v7, v6); |
0 | 7690 goto LABEL_28; |
7691 } | |
473 | 7692 CreateButtonInColumn(0, 0x12u); |
7693 CreateButtonInColumn(1, 0x34u); | |
7694 CreateButtonInColumn(2, 0x35u); | |
0 | 7695 v12 = 54; |
7696 } | |
7697 LABEL_39: | |
473 | 7698 CreateButtonInColumn(3, v12); |
0 | 7699 v17 = 2; |
7700 v11 = 0; | |
7701 v10 = 1; | |
7702 v9 = 4; | |
7703 goto LABEL_42; | |
7704 } | |
7705 if ( a1 == 13 ) | |
7706 { | |
473 | 7707 CreateButtonInColumn(0, 0x12u); |
0 | 7708 v16 = 56; |
7709 LABEL_37: | |
473 | 7710 CreateButtonInColumn(1, v16); |
0 | 7711 v17 = 2; |
7712 v11 = 0; | |
7713 v10 = 1; | |
7714 v9 = 2; | |
7715 goto LABEL_42; | |
7716 } | |
7717 switch ( a1 ) | |
7718 { | |
7719 case 1: | |
7720 case 2: | |
7721 case 3: | |
7722 case 4: | |
473 | 7723 CreateButtonInColumn(0, 2u); |
7724 CreateButtonInColumn(1, 0x5Fu); | |
7725 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7726 v12 = 96; |
7727 goto LABEL_39; | |
7728 case 5: | |
473 | 7729 CreateButtonInColumn(0, 0x12u); |
0 | 7730 v13 = 48; |
7731 goto LABEL_9; | |
7732 case 6: | |
473 | 7733 CreateButtonInColumn(0, 0x12u); |
0 | 7734 v13 = 49; |
7735 goto LABEL_9; | |
7736 case 7: | |
473 | 7737 CreateButtonInColumn(0, 0x12u); |
0 | 7738 v13 = 50; |
7739 goto LABEL_9; | |
7740 case 8: | |
473 | 7741 CreateButtonInColumn(0, 0x12u); |
0 | 7742 v13 = 51; |
7743 LABEL_9: | |
473 | 7744 CreateButtonInColumn(1, v13); |
0 | 7745 v14 = 72; |
7746 goto LABEL_41; | |
7747 case 9: | |
473 | 7748 CreateButtonInColumn(0, 0x12u); |
0 | 7749 v15 = 52; |
7750 goto LABEL_13; | |
7751 case 10: | |
473 | 7752 CreateButtonInColumn(0, 0x12u); |
0 | 7753 v15 = 53; |
7754 goto LABEL_13; | |
7755 case 11: | |
473 | 7756 CreateButtonInColumn(0, 0x12u); |
0 | 7757 v15 = 54; |
7758 LABEL_13: | |
473 | 7759 CreateButtonInColumn(1, v15); |
0 | 7760 v14 = 61; |
7761 goto LABEL_41; | |
7762 case 12: | |
473 | 7763 CreateButtonInColumn(0, 0x12u); |
0 | 7764 v16 = 55; |
7765 goto LABEL_37; | |
7766 default: | |
7767 break; | |
7768 } | |
7769 LABEL_43: | |
7770 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7771 } | |
7772 // F8B1E0: using guessed type int dword_F8B1E0; | |
7773 | |
7774 //----- (004B3E1E) -------------------------------------------------------- | |
7775 void __cdecl sub_4B3E1E() | |
7776 { | |
7777 NPCData *v0; // ST40_4@1 | |
7778 signed int v1; // edi@1 | |
165 | 7779 //GUIWindow *v2; // ecx@1 |
0 | 7780 |
167 | 7781 __debugbreak(); |
602 | 7782 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7783 v1 = 0; |
7784 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7785 pDialogueWindow->Release(); | |
165 | 7786 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7787 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7788 { |
832 | 7789 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7790 v1 = 1; |
7791 } | |
832 | 7792 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7793 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7794 } | |
7795 | |
7796 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7797 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7798 { |
467 | 7799 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7800 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7801 ContractSelectText(pEventCode); |
0 | 7802 pDialogueWindow->Release(); |
492 | 7803 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7804 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7805 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7806 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
0 | 7807 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7808 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7809 } |
7810 // F8B19C: using guessed type int dword_F8B19C; | |
7811 | |
7812 //----- (004B3FE5) -------------------------------------------------------- | |
7813 void __fastcall sub_4B3FE5(int a4) | |
7814 { | |
7815 int v1; // edi@1 | |
7816 char *v2; // edi@1 | |
7817 | |
7818 v1 = a4; | |
7819 uDialogueType = 78; | |
827 | 7820 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7821 _4B254D_SkillMasteryTeacher(a4); |
7822 pDialogueWindow->Release(); | |
7823 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7824 v2 = ""; | |
832 | 7825 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7826 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7827 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7828 if ( contract_approved ) |
0 | 7829 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7830 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
0 | 7831 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7832 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7833 } |
7834 // F8B19C: using guessed type int dword_F8B19C; | |
7835 // F8B1A8: using guessed type int dword_F8B1A8; | |
7836 | |
7837 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7838 void NPCHireableDialogPrepare() |
7839 { | |
0 | 7840 signed int v0; // ebx@1 |
7841 NPCData *v1; // edi@1 | |
7842 | |
7843 v0 = 0; | |
459 | 7844 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7845 pDialogueWindow->Release(); |
7846 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7847 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7848 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7849 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7850 0); |
832 | 7851 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7852 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7853 { |
832 | 7854 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7855 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7856 v0 = 1; |
7857 } | |
832 | 7858 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7859 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
0 | 7860 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7861 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7862 } |
7863 | |
7864 //----- (004B4224) -------------------------------------------------------- | |
423 | 7865 void _4B4224_UpdateNPCTopics( int _this ) |
7866 { | |
7867 int num_menu_buttons; // ebx@1 | |
0 | 7868 int i; // ebp@5 |
423 | 7869 // signed int v4; // ebp@9 |
7870 int v6; // eax@16 | |
7871 int v8; // eax@21 | |
7872 int v10; // eax@26 | |
7873 int v12; // eax@31 | |
7874 int v14; // eax@36 | |
7875 int v16; // eax@41 | |
0 | 7876 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7877 | |
423 | 7878 num_menu_buttons = 0; |
459 | 7879 pDialogueNPCCount = (_this + 1); |
0 | 7880 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7881 { | |
7882 pDialogueWindow->Release(); | |
7883 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7884 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7885 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
7886 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
832 | 7887 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
948 | 7888 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0); |
0 | 7889 } |
7890 else | |
7891 { | |
459 | 7892 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7893 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7894 { |
7895 pDialogueWindow->Release(); | |
7896 } | |
7897 else | |
7898 { | |
7899 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7900 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7901 } |
7902 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7903 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7904 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7905 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7906 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7907 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7908 { |
484 | 7909 sub_4B3B42(in_current_building_type); |
0 | 7910 } |
7911 else | |
7912 { | |
7913 if ( v17->joins ) | |
7914 { | |
423 | 7915 num_menu_buttons = 1; |
858 | 7916 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7917 } |
423 | 7918 if ( v17->evt_A) |
7919 { | |
7920 if ( num_menu_buttons < 4 ) | |
7921 { | |
7922 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7923 if ( v6 == 1 || v6 == 2 ) |
832 | 7924 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7925 } |
7926 } | |
7927 if ( v17->evt_B ) | |
7928 { | |
7929 if ( num_menu_buttons < 4 ) | |
7930 { | |
7931 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7932 if ( v8 == 1 || v8 == 2 ) |
832 | 7933 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7934 } |
7935 } | |
7936 if ( v17->evt_C ) | |
7937 { | |
7938 if ( num_menu_buttons < 4 ) | |
7939 { | |
7940 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7941 if ( v10 == 1 || v10 == 2 ) |
832 | 7942 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7943 } |
7944 } | |
7945 | |
7946 if ( v17->evt_D ) | |
7947 { | |
7948 if ( num_menu_buttons < 4 ) | |
7949 { | |
7950 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7951 if ( v12 == 1 || v12 == 2 ) |
832 | 7952 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7953 } |
7954 } | |
7955 if ( v17->evt_E ) | |
7956 { | |
7957 if ( num_menu_buttons < 4 ) | |
7958 { | |
7959 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7960 if ( v14 == 1 || v14 == 2 ) |
832 | 7961 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7962 } |
7963 } | |
7964 if ( v17->evt_F ) | |
7965 { | |
7966 if ( num_menu_buttons < 4 ) | |
7967 { | |
7968 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7969 if ( v16 == 1 || v16 == 2 ) |
832 | 7970 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7971 } |
7972 } | |
7973 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 7974 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7975 } | |
747 | 7976 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7977 } |
7978 | |
0 | 7979 } |
7980 | |
7981 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7982 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7983 { |
0 | 7984 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7985 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7986 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7987 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 7988 } |
7989 | |
7990 //----- (004B46F8) -------------------------------------------------------- | |
7991 int __fastcall sub_4B46F8(int a1) | |
7992 { | |
7993 int v1; // eax@1 | |
7994 int i; // edx@1 | |
7995 | |
7996 v1 = 0; | |
7997 for ( i = 0; i < a1; ++i ) | |
7998 v1 += i + 1; | |
7999 return 1000 * v1; | |
8000 } | |
8001 | |
8002 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8003 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8004 { |
656 | 8005 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8006 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8007 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8008 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8009 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8010 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8011 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8012 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8013 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8014 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8015 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8016 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8017 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8018 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8019 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8020 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8021 //v1 = _this; |
656 | 8022 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8023 //v3 = v1; |
656 | 8024 uDialogueType = newDialogueType; |
8025 if (!speakingNPC->uFlags) | |
8026 { | |
8027 speakingNPC->uFlags = 1; | |
8028 //v3 = uDialogueType; | |
8029 } | |
8030 | |
8031 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8032 { | |
8033 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8034 } | |
8035 else if(newDialogueType == DIALOGUE_76) | |
8036 { | |
8037 if (speakingNPC->Hired()) | |
8038 { | |
8039 v8 = 0; | |
8040 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8041 { | |
8042 v6 = (char *)pNPCStats->pNewNPCData; | |
8043 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8044 { | |
8045 ++v8; | |
8046 v6 += 76; | |
8047 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8048 break; | |
8049 } | |
8050 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8051 v6[8] &= 0x7Fu; | |
8052 } | |
8053 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8054 { | |
8055 v11 = pParty->pHirelings; | |
8056 memset(v11, 0, sizeof(NPCData)); | |
8057 } | |
8058 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8059 { | |
8060 v11 = &pParty->pHirelings[1]; | |
8061 memset(v11, 0, sizeof(NPCData)); | |
8062 } | |
8063 pParty->field_709 = 0; | |
659 | 8064 Party__CountHirelings(); |
656 | 8065 dword_591084 = 0; |
8066 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8067 dword_7241C8 = 0; | |
8068 return; | |
8069 } | |
8070 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8071 { | |
8072 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8073 ShowStatusBarString(v7, 2u); | |
8074 } | |
8075 else | |
8076 { | |
8077 //v9 = v2->uProfession; | |
8078 if ( speakingNPC->uProfession != 51 ) | |
8079 { | |
8080 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8081 if ( pParty->uNumGold < v10 ) | |
8082 { | |
8083 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8084 dialogue_show_profession_details = false; | |
8085 uDialogueType = 13; | |
8086 if ( uActiveCharacter ) | |
8087 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8088 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8089 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8090 if ( !dword_7241C8 ) | |
8091 pGame->Draw(); | |
8092 dword_7241C8 = 0; | |
8093 return; | |
8094 } | |
8095 Party::TakeGold(v10); | |
8096 } | |
8097 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8098 if ( pParty->pHirelings[0].pName ) | |
8099 { | |
8100 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8101 v15 = speakingNPC->pName; | |
8102 v13 = pParty->pHireling2Name; | |
8103 } | |
8104 else | |
8105 { | |
8106 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8107 v15 = speakingNPC->pName; | |
8108 v13 = pParty->pHireling1Name; | |
8109 } | |
8110 strcpy(v13, v15); | |
8111 pParty->field_709 = 0; | |
659 | 8112 Party__CountHirelings(); |
656 | 8113 |
8114 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8115 | |
711 | 8116 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8117 pDialogue_SpeakingActor->uAIState = Removed; |
8118 if ( uActiveCharacter ) | |
8119 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8120 } | |
8121 } | |
8122 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8123 { | |
8124 ArenaFight(); | |
8125 return; | |
8126 } | |
8127 else if(newDialogueType == DIALOGUE_9) | |
8128 { | |
8129 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8130 { | |
8131 if ( speakingNPC->uProfession != 41 ) | |
8132 speakingNPC->bHasUsedTheAbility = 1; | |
8133 | |
8134 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8135 } | |
8136 else | |
8137 { | |
8138 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8139 } | |
8140 } | |
8141 else if(newDialogueType == DIALOGUE_13) | |
8142 { | |
8143 if (!speakingNPC->Hired()) | |
8144 { | |
8145 sub_4B3E1E(); | |
8146 dialogue_show_profession_details = false; | |
8147 } | |
8148 else | |
8149 { | |
8150 v5 = 0; | |
8151 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8152 { | |
8153 v6 = (char *)pNPCStats->pNewNPCData; | |
8154 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8155 { | |
8156 ++v5; | |
8157 v6 += 76; | |
8158 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8159 break; | |
8160 } | |
8161 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8162 v6[8] &= 0x7Fu; | |
8163 } | |
8164 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8165 { | |
8166 v11 = pParty->pHirelings; | |
8167 memset(v11, 0, sizeof(NPCData)); | |
8168 } | |
8169 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8170 { | |
8171 v11 = &pParty->pHirelings[1]; | |
8172 memset(v11, 0, sizeof(NPCData)); | |
8173 } | |
8174 pParty->field_709 = 0; | |
659 | 8175 Party__CountHirelings(); |
656 | 8176 dword_591084 = 0; |
8177 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8178 dword_7241C8 = 0; | |
8179 return; | |
8180 } | |
8181 } | |
8182 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8183 { | |
8184 switch(newDialogueType) | |
8185 { | |
8186 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8187 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8188 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8189 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8190 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8191 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8192 } | |
8193 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8194 sub_4B3FE5(npc_event_id); //200-310 | |
8195 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8196 { //400-410 | |
8197 dword_F8B1D8 = newDialogueType; | |
8198 DrawJoinGuildWindow(npc_event_id - 400); | |
8199 } | |
8200 else | |
8201 { | |
8202 switch ( npc_event_id ) | |
8203 { | |
8204 case 139: | |
8205 sub_4B1ECE(); | |
8206 break; | |
8207 case 311: | |
8208 sub_4BBA85_bounties(); | |
8209 break; | |
8210 case 399: | |
8211 sub_4BBCDD(); | |
8212 break; | |
8213 default: | |
8214 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8215 current_npc_text = 0; |
656 | 8216 EventProcessor(npc_event_id, 0, 1); |
8217 activeLevelDecoration = NULL; | |
8218 break; | |
8219 } | |
8220 } | |
8221 } | |
8222 if ( !dword_7241C8 ) | |
8223 pGame->Draw(); | |
8224 dword_7241C8 = 0; | |
8225 } | |
0 | 8226 |
8227 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8228 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8229 { |
8230 int v6; // edx@8 | |
8231 int v7; // edx@9 | |
8232 int v8; // edx@10 | |
8233 unsigned __int8 v9; // zf@16 | |
8234 char v10; // sf@16 | |
8235 unsigned __int8 v11; // of@16 | |
702 | 8236 bool test; |
0 | 8237 |
907 | 8238 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8239 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8240 return 0; |
907 | 8241 switch( p2DEvents[_2da_idx - 1].uType ) |
8242 { | |
8243 case BildingType_WeaponShop: | |
8244 { | |
8245 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8246 break; | |
8247 } | |
8248 case BildingType_ArmorShop: | |
8249 { | |
8250 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8251 break; | |
8252 } | |
8253 case BildingType_MagicShop: | |
8254 { | |
8255 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8256 break; | |
8257 } | |
8258 case BildingType_AlchemistShop: | |
8259 { | |
8260 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8261 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8262 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8263 break; | |
8264 } | |
8265 default: | |
8266 { | |
8267 test = false; | |
8268 break; | |
8269 } | |
8270 } | |
702 | 8271 return test; |
8272 /* | |
8273 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8274 { |
8275 v11 = __OFSUB__(v5, 2); | |
8276 v9 = v5 == 2; | |
8277 v10 = v5 - 2 < 0; | |
8278 goto LABEL_23; | |
8279 } | |
702 | 8280 if ( p2DEvents[a2 - 1].uType > 2 ) |
8281 { | |
8282 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8283 { |
8284 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8285 return v5 == 16; | |
8286 return 1; | |
8287 } | |
702 | 8288 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8289 return 0; |
702 | 8290 if ( p2DEvents[a2 - 1].uType == 4) |
8291 { | |
8292 if ( v5 < 13 ) | |
8293 return 0; | |
8294 if ( v5 <= 14 ) | |
8295 return 1; | |
8296 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8297 return 0; | |
8298 v11 = __OFSUB__(v3, 771); | |
8299 v9 = v3 == 771; | |
8300 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8301 LABEL_23: |
702 | 8302 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8303 return 0; | |
8304 return 1; | |
8305 } | |
8306 } | |
8307 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8308 { | |
8309 if ( v5 >= 3 ) | |
8310 { | |
8311 v11 = __OFSUB__(v5, 9); | |
8312 v9 = v5 == 9; | |
8313 v10 = v5 - 9 < 0; | |
8314 goto LABEL_23; | |
8315 } | |
0 | 8316 } |
8317 return 0; | |
702 | 8318 */ |
0 | 8319 } |
8320 | |
8321 //----- (004B6478) -------------------------------------------------------- | |
711 | 8322 void sub_4B6478() |
8323 { | |
0 | 8324 GUIWindow *v0; // ebx@1 |
8325 Player *v1; // edi@1 | |
8326 unsigned int v2; // eax@1 | |
8327 signed int v3; // esi@1 | |
8328 int v4; // ebx@1 | |
8329 unsigned int v5; // esi@5 | |
8330 int v6; // edi@6 | |
8331 int result; // eax@13 | |
8332 GUIWindow *v8; // ebx@17 | |
8333 int v9; // eax@17 | |
8334 int v10; // ecx@17 | |
8335 unsigned int v11; // ecx@18 | |
8336 int v12; // eax@20 | |
8337 int v13; // eax@21 | |
8338 GUIButton *v14; // esi@27 | |
8339 int v15; // ecx@27 | |
8340 unsigned int v16; // eax@28 | |
8341 const char *v17; // ebx@29 | |
8342 int v18; // eax@29 | |
8343 unsigned int v19; // ecx@29 | |
8344 int v20; // eax@29 | |
8345 unsigned __int16 v21; // ax@29 | |
8346 unsigned __int16 v22; // ST14_2@36 | |
8347 int v23; // eax@36 | |
8348 const char *v24; // ST18_4@37 | |
8349 unsigned __int16 v25; // ST14_2@37 | |
8350 int v26; // eax@37 | |
8351 int v27; // [sp-4h] [bp-80h]@8 | |
8352 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8353 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8354 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8355 int v31; // [sp+68h] [bp-14h]@1 | |
8356 int v32; // [sp+6Ch] [bp-10h]@1 | |
8357 int v33; // [sp+70h] [bp-Ch]@17 | |
8358 int v34; // [sp+74h] [bp-8h]@17 | |
8359 int v35; // [sp+78h] [bp-4h]@17 | |
8360 | |
336 | 8361 v0 = window_SpeakInHouse; |
8362 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8363 v1 = pPlayers[uActiveCharacter]; |
8364 v28.uFrameX = 483; | |
8365 v28.uFrameWidth = 148; | |
8366 v28.uFrameZ = 334; | |
949 | 8367 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
8368 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
0 | 8369 v2 = 52 * (unsigned int)v0->ptr_1C; |
8370 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8371 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8372 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8373 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8374 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8375 v32 = v4; | |
8376 if ( v4 < v3 / 3 ) | |
8377 { | |
8378 v4 = v3 / 3; | |
8379 v32 = v3 / 3; | |
8380 } | |
749 | 8381 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8382 { |
8383 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8384 { | |
8385 v5 = 0; | |
8386 | |
8387 __debugbreak(); | |
8388 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8389 // or | |
8390 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8391 // or | |
8392 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8393 __debugbreak(); // whacky condition - fix |
0 | 8394 if (false |
8395 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8396 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8397 { |
8398 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8399 } | |
8400 else | |
8401 { | |
8402 if ( pParty->uNumGold < v4 ) | |
8403 { | |
8404 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8405 v27 = 4; | |
8406 } | |
8407 else | |
8408 { | |
8409 Party::TakeGold(v4); | |
8410 *(short *)v6 = 1; | |
8411 v27 = 2; | |
8412 } | |
735 | 8413 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8414 } |
8415 } | |
8416 else | |
8417 { | |
8418 v5 = 0; | |
8419 } | |
437 | 8420 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8421 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8422 { | |
8423 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8424 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8425 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8426 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8427 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8428 }*/ |
8429 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8430 return; // void func |
0 | 8431 } |
484 | 8432 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8433 { |
8434 v24 = pNPCTopics[171].pText; | |
8435 v25 = v31; | |
8436 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8437 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8438 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8439 return ; |
8440 } | |
8441 | |
8442 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8443 return; | |
0 | 8444 v8 = pDialogueWindow; |
8445 v33 = 0; | |
8446 v34 = 0; | |
8447 v29 = pDialogueWindow; | |
8448 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8449 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8450 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8451 if ( v9 >= v10 ) | |
8452 goto LABEL_40; | |
8453 do | |
8454 { | |
832 | 8455 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8456 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8457 { |
8458 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8459 v33 += v12; | |
8460 ++v34; | |
8461 } | |
8462 v13 = v8->pStartingPosActiveItem; | |
8463 ++v35; | |
8464 } | |
8465 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8466 if ( !v34 ) | |
8467 { | |
8468 LABEL_40: | |
135 | 8469 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8470 strcat(pTmpBuf, "\n \n"); |
8471 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8472 v22 = v31; | |
8473 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8474 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8475 return; | |
0 | 8476 } |
8477 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8478 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8479 v32 = (149 - v33) / v34; | |
8480 if ( (149 - v33) / v34 > 32 ) | |
8481 v32 = 32; | |
711 | 8482 |
8483 v35 = v8->pStartingPosActiveItem; | |
0 | 8484 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8485 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8486 { |
8487 v33 = 2; | |
8488 do | |
8489 { | |
8490 v14 = v8->GetControl(v35); | |
832 | 8491 v15 = v14->msg_param - 36; |
135 | 8492 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8493 { |
8494 v16 = 0; | |
8495 if ( !v1->pActiveSkills[v15] ) | |
8496 { | |
8497 v17 = pSkillNames[v15]; | |
8498 v14->uY = v32 + v34; | |
8499 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8500 v19 = v14->uY; | |
8501 v14->uHeight = v18; | |
8502 v20 = v19 + v18 - 1; | |
8503 v14->uW = v20; | |
8504 v34 = v20; | |
8505 v21 = v31; | |
8506 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8507 v21 = v30; | |
8508 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8509 goto LABEL_34; | |
8510 } | |
8511 } | |
8512 else | |
8513 { | |
8514 v16 = 0; | |
8515 } | |
8516 v14->uW = v16; | |
8517 v14->uHeight = v16; | |
8518 v14->uY = v16; | |
8519 LABEL_34: | |
8520 v8 = v29; | |
8521 ++v35; | |
8522 ++v33; | |
711 | 8523 } |
8524 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8525 } | |
8526 return; | |
0 | 8527 } |
8528 | |
8529 //----- (00405CFF) -------------------------------------------------------- | |
8530 void stru262_TurnBased::End(bool bPlaySound) | |
8531 { | |
8532 stru262_TurnBased *v2; // edi@1 | |
8533 int v3; // ebx@1 | |
8534 int v4; // esi@1 | |
8535 unsigned __int8 v5; // zf@1 | |
8536 unsigned __int8 v6; // sf@1 | |
8537 TurnBased_QueueElem *v7; // ecx@2 | |
8538 unsigned __int16 *pAttributes; // ecx@7 | |
8539 size_t v9; // edx@7 | |
8540 unsigned __int16 v10; // ax@8 | |
8541 TurnBased_QueueElem *v11; // ebx@12 | |
8542 ObjectType objType; // eax@13 | |
8543 int objID; // esi@13 | |
8544 int v14; // [sp+Ch] [bp-4h]@11 | |
8545 | |
8546 v2 = this; | |
8547 v3 = 0; | |
8548 v4 = 0; | |
8549 v5 = this->uActorQueueSize == 0; | |
8550 v6 = this->uActorQueueSize < 0; | |
8551 this->field_4 = 0; | |
8552 if ( !(v6 | v5) ) | |
8553 { | |
8554 v7 = this->pQueue; | |
8555 do | |
8556 { | |
848 | 8557 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8558 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8559 ++v4; |
8560 ++v7; | |
8561 } | |
8562 while ( v4 < v2->uActorQueueSize ); | |
8563 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8564 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8565 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8566 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8567 v9 = uNumSpriteObjects; |
0 | 8568 do |
8569 { | |
8570 v10 = *pAttributes; | |
8571 if ( *pAttributes & 4 ) | |
8572 { | |
8573 LOBYTE(v10) = v10 & 0xFB; | |
8574 *pAttributes = v10; | |
8575 } | |
8576 pAttributes += 56; | |
8577 --v9; | |
8578 } | |
8579 while ( v9 ); | |
8580 } | |
8581 v14 = 0; | |
8582 if ( v2->uActorQueueSize > 0 ) | |
8583 { | |
8584 v11 = v2->pQueue; | |
8585 do | |
8586 { | |
848 | 8587 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8588 objID = PID_ID(v11->uPackedID); | |
0 | 8589 if ( objType == OBJECT_Player ) |
8590 { | |
8591 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8592 } | |
8593 else | |
8594 { | |
8595 if ( objType == OBJECT_Actor ) | |
8596 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8597 } | |
8598 ++v14; | |
8599 ++v11; | |
8600 } | |
8601 while ( v14 < v2->uActorQueueSize ); | |
8602 v3 = 0; | |
8603 } | |
8604 pAudioPlayer->StopChannels(-1, -1); | |
8605 if ( bPlaySound != v3 ) | |
8606 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8607 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8608 pEventTimer->StopGameTime(); | |
8609 dword_50C994 = v3; | |
8610 dword_50C998_turnbased_icon_1A = v3; | |
8611 } | |
8612 // 50C994: using guessed type int dword_50C994; | |
8613 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8614 | |
8615 //----- (00405E14) -------------------------------------------------------- | |
8616 void stru262_TurnBased::_405E14() | |
8617 { | |
8618 stru262_TurnBased *v1; // esi@1 | |
8619 int v2; // ecx@1 | |
8620 SpellBuff *v3; // edi@2 | |
8621 Actor *v4; // ebx@3 | |
8622 signed int v5; // edx@20 | |
8623 AIDirection *v6; // esi@21 | |
8624 int v7; // eax@21 | |
8625 int v8; // eax@21 | |
8626 int v9; // eax@22 | |
8627 int v10; // eax@23 | |
8628 int v11; // eax@37 | |
8629 int v12; // eax@44 | |
8630 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8631 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8632 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8633 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8634 int v17; // [sp+5Ch] [bp-10h]@6 |
8635 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8636 int v19; // [sp+64h] [bp-8h]@8 | |
8637 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8638 | |
8639 v1 = this; | |
8640 v2 = 0; | |
8641 v18 = v1; | |
8642 v20 = 0; | |
8643 if ( (signed int)uNumActors > 0 ) | |
8644 { | |
90 | 8645 //v3 = pActors;//[0].pActorBuffs; |
8646 v16 = pActors;//[0].pActorBuffs; | |
8647 v3 = v16->pActorBuffs; | |
0 | 8648 do |
8649 { | |
90 | 8650 v4 = v16; |
8651 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8652 v17 = v2; |
8653 else | |
8654 v17 = 1; | |
8655 v19 = v2; | |
8656 do | |
8657 { | |
8658 if ( v19 != 10 ) | |
8659 { | |
8660 v3->_4585CA(pParty->uTimePlayed); | |
8661 v2 = 0; | |
8662 } | |
8663 ++v19; | |
8664 ++v3; | |
8665 } | |
8666 while ( v19 < 22 ); | |
8667 if ( v17 != v2 | |
8668 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8669 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8670 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8671 if ( !(v4->uAttributes & 0x80) ) | |
8672 { | |
8673 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8674 { | |
8675 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8676 { | |
8677 v5 = v4->uCurrentActionLength; | |
8678 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8679 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8680 { | |
417 | 8681 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8682 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8683 v7 = v4->uAIState; |
8684 memcpy(&v15, v6, sizeof(v15)); | |
8685 v8 = v7 - 4; | |
8686 memcpy(&v14, &v15, sizeof(v14)); | |
8687 if ( v8 ) | |
8688 { | |
8689 v9 = v8 - 1; | |
8690 if ( v9 ) | |
8691 { | |
8692 v10 = v9 - 6; | |
8693 if ( v10 ) | |
8694 { | |
8695 if ( v10 != 8 ) | |
414 | 8696 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8697 } |
8698 } | |
8699 } | |
8700 else | |
8701 { | |
8702 v4->uCurrentActionTime = 0; | |
8703 v4->uCurrentActionLength = 0; | |
8704 v4->uAIState = Dead; | |
8705 v4->UpdateAnimation(); | |
8706 } | |
8707 v1 = v18; | |
8708 v2 = 0; | |
8709 } | |
8710 } | |
8711 } | |
8712 } | |
8713 ++v20; | |
90 | 8714 v3 = v16[1].pActorBuffs; |
8715 ++v16; | |
0 | 8716 } |
8717 while ( (signed int)v20 < (signed int)uNumActors ); | |
8718 } | |
8719 if ( v1->field_4 == 1 ) | |
8720 { | |
8721 v12 = v1->field_8; | |
8722 if ( v12 == 64 ) | |
8723 { | |
8724 v1->_406A63(); | |
8725 } | |
8726 else | |
8727 { | |
8728 if ( v12 > v2 ) | |
8729 { | |
8730 v1->_406B9F(); | |
8731 } | |
8732 else | |
8733 { | |
8734 v1->_406AFE(); | |
8735 v1->field_10 = 100; | |
8736 } | |
8737 } | |
8738 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8739 return; | |
8740 } | |
8741 if ( v1->field_4 == 2 ) | |
8742 { | |
8743 if ( !(v1->field_18 & 1) ) | |
8744 { | |
8745 v11 = v1->field_10; | |
8746 if ( v11 == 100 ) | |
8747 { | |
8748 v1->StartTurn(); | |
8749 LABEL_39: | |
8750 v1->_40652A(); | |
8751 return; | |
8752 } | |
8753 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8754 { | |
8755 v1->_4065B0(); | |
8756 goto LABEL_39; | |
8757 } | |
8758 } | |
8759 v1->NextTurn(); | |
8760 return; | |
8761 } | |
8762 if ( v1->field_4 == 3 ) | |
8763 { | |
8764 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8765 { | |
8766 v1->field_18 &= 0xFFFFFFF7u; | |
8767 v1->field_4 = 1; | |
8768 v1->field_8 = 64; | |
8769 } | |
8770 else | |
8771 { | |
8772 v1->_406FA8(); | |
8773 } | |
8774 } | |
8775 } | |
8776 | |
8777 //----- (0043FDED) -------------------------------------------------------- | |
8778 void PrepareActorRenderList_BLV() | |
8779 { | |
8780 RenderBillboard *v0; // esi@0 | |
8781 unsigned __int16 v3; // ax@3 | |
8782 unsigned int v4; // eax@5 | |
8783 unsigned __int16 v5; // cx@5 | |
8784 int v6; // esi@5 | |
8785 unsigned int v7; // eax@7 | |
8786 int v8; // eax@10 | |
8787 SpriteFrame *v9; // eax@16 | |
8788 SpriteFrame *v10; // ebx@18 | |
8789 //int *v11; // eax@18 | |
8790 int v12; // ecx@28 | |
8791 //IndoorCameraD3D **v14; // eax@36 | |
8792 double v15; // st7@36 | |
8793 float v16; // eax@36 | |
8794 //double v17; // ST30_8@36 | |
8795 signed __int64 v18; // qtt@36 | |
8796 int v19; // ST5C_4@36 | |
8797 signed __int64 v20; // qtt@37 | |
8798 int v21; // ST5C_4@37 | |
8799 signed __int16 v22; // cx@39 | |
8800 int v23; // ST50_4@40 | |
8801 signed int v24; // ecx@40 | |
8802 int v25; // edx@44 | |
8803 __int16 v26; // ax@44 | |
8804 //MonsterDesc *v27; // edx@44 | |
8805 //int v28; // ecx@44 | |
8806 unsigned __int8 v29; // zf@44 | |
8807 unsigned __int8 v30; // sf@44 | |
8808 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8809 int v32; // [sp+1Ch] [bp-38h]@5 | |
8810 int a3; // [sp+20h] [bp-34h]@5 | |
8811 int a2; // [sp+24h] [bp-30h]@5 | |
8812 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8813 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8814 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8815 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8816 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8817 int a6; // [sp+40h] [bp-14h]@34 | |
8818 int v43; // [sp+44h] [bp-10h]@34 | |
8819 int z; // [sp+48h] [bp-Ch]@32 | |
8820 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8821 int x; // [sp+50h] [bp-4h]@32 | |
8822 | |
8823 for (uint i = 0; i < uNumActors; ++i) | |
8824 { | |
8825 auto p = pActors + i; | |
8826 | |
8827 if (p->uAIState == Removed || | |
8828 p->uAIState == Disabled) | |
8829 continue; | |
8830 | |
8831 a5 = p->uSectorID; | |
8832 a2 = p->vPosition.y; | |
8833 a1a = p->vPosition.x; | |
8834 a3 = p->vPosition.z; | |
8835 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8836 LOWORD(v0) = p->uYawAngle; | |
8837 v5 = p->uCurrentActionAnimation; | |
8838 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8839 v32 = v6; | |
8840 if ( pParty->bTurnBasedModeOn ) | |
8841 { | |
8842 if ( v5 == 1 ) | |
8843 { | |
8844 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8845 goto LABEL_10; | |
8846 } | |
8847 } | |
8848 else | |
8849 { | |
8850 if ( v5 == 1 ) | |
8851 { | |
8852 v7 = pBLVRenderParams->field_0_timer_; | |
8853 LABEL_10: | |
8854 v8 = i * 32 + v7; | |
8855 goto LABEL_12; | |
8856 } | |
8857 } | |
8858 v8 = p->uCurrentActionTime; | |
8859 LABEL_12: | |
8860 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8861 v8 = 0; | |
8862 v31 = p->pSpriteIDs[v5]; | |
8863 if (p->uAIState == Resurrected) | |
8864 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8865 else | |
8866 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8867 v41 = 0; | |
8868 v10 = v9; | |
8869 //v11 = (int *)v9->uFlags; | |
8870 if (v9->uFlags & 2) | |
8871 v41 = 2; | |
8872 if (v9->uFlags & 0x40000) | |
8873 v41 |= 0x40u; | |
8874 if (v9->uFlags & 0x20000) | |
8875 LOBYTE(v41) = v41 | 0x80; | |
8876 v0 = (RenderBillboard *)(256 << v6); | |
8877 if ( (unsigned int)v0 & v9->uFlags) | |
8878 v41 |= 4u; | |
8879 if ( v10->uGlowRadius ) | |
8880 { | |
8881 //LOBYTE(v11) = byte_4E94D3; | |
8882 pMobileLightsStack->AddLight( | |
8883 a1a, | |
8884 a2, | |
8885 a3, | |
8886 a5, | |
8887 v10->uGlowRadius, | |
8888 0xFFu, | |
8889 0xFFu, | |
8890 0xFFu, | |
8891 byte_4E94D3); | |
8892 } | |
8893 v12 = 0; | |
8894 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8895 continue; | |
8896 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8897 { | |
8898 ++v12; | |
8899 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8900 goto _continue; | |
8901 } | |
8902 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8903 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8904 continue; | |
8905 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8906 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8907 if (uNumBillboardsToDraw >= 500) | |
8908 break; | |
8909 ++uNumBillboardsToDraw; | |
8910 ++uNumSpritesDrawnThisFrame; | |
8911 p->uAttributes |= 8u; | |
8912 v29 = pRenderer->pRenderD3D == 0; | |
8913 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8914 v0->uPalette = v10->uPaletteIndex; | |
8915 v0->uIndoorSectorID = a5; | |
8916 if ( v29 ) | |
8917 { | |
8918 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8919 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8920 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8921 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8922 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8923 } | |
8924 else | |
8925 { | |
8926 //v14 = &pGame->pIndoorCameraD3D; | |
8927 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8928 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8929 v16 = v0->fov_x; | |
8930 v0->fov_y = v15; | |
8931 //v17 = v16 + 6.7553994e15; | |
8932 LODWORD(v18) = 0; | |
8933 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8934 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8935 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8936 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8937 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8938 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8939 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8940 { | |
8941 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8942 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8943 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8944 goto LABEL_43; |
8945 } | |
8946 } | |
8947 else | |
8948 { | |
8949 v22 = p->pActorBuffs[3].uPower; | |
8950 if ( v22 ) | |
8951 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8952 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8953 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8954 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8955 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8956 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8957 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8958 goto LABEL_44; |
8959 } | |
8960 } | |
8961 LABEL_44: | |
8962 HIWORD(v25) = HIWORD(x); | |
430 | 8963 v0->world_x = a1a; |
8964 v0->world_y = a2; | |
8965 v0->world_z = a3; | |
0 | 8966 v0->uScreenSpaceX = v43; |
8967 v0->uScreenSpaceY = a6; | |
8968 LOWORD(v25) = 0; | |
8969 LOBYTE(v26) = v41; | |
194 | 8970 |
862 | 8971 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8972 v0->actual_z = HIWORD(x); |
862 | 8973 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8974 |
0 | 8975 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8976 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8977 v0->field_1E = v41; | |
8978 v0->pSpriteFrame = v10; | |
8979 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8980 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8981 { | |
8982 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8983 v0->field_1E = v26; | |
8984 } | |
8985 | |
8986 _continue: | |
8987 ; | |
8988 } | |
8989 } | |
8990 | |
8991 //----- (00444732) -------------------------------------------------------- | |
428 | 8992 char *GetEventHintString(unsigned int uEventID) |
8993 { | |
8994 signed int event_index; // edx@1 | |
8995 int event_pos; // esi@4 | |
0 | 8996 char *result; // eax@6 |
428 | 8997 unsigned int str_index; // eax@9 |
8998 int i; // esi@11 | |
8999 _evt_raw* test_evt; | |
9000 _evt_raw* last_evt; | |
9001 | |
9002 event_index = 0; | |
9003 if ( uLevelEVT_NumEvents <= 0 ) | |
9004 return NULL; | |
9005 | |
9006 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9007 while ( 1 ) |
9008 { | |
428 | 9009 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9010 { | |
9011 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9012 last_evt=test_evt; | |
9013 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9014 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9015 break; |
9016 } | |
428 | 9017 ++event_index; |
9018 if ( event_index >= uLevelEVT_NumEvents ) | |
9019 return NULL; | |
9020 } | |
9021 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9022 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9023 { | |
9024 str_index = EVT_DWORD(test_evt->v5); | |
9025 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9026 } |
9027 else | |
9028 { | |
428 | 9029 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9030 { | |
9031 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9032 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9033 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9034 { | |
9035 str_index = EVT_DWORD(test_evt->v5); | |
9036 if ( str_index < 600 ) | |
9037 return (char *)p2DEvents[str_index - 1].pName; | |
9038 } | |
9039 } | |
9040 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9041 } | |
9042 | |
0 | 9043 return result; |
9044 } | |
9045 | |
9046 //----- (00444839) -------------------------------------------------------- | |
9047 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) | |
9048 { | |
9049 unsigned int v9; // ebx@1 | |
9050 int v10; // edi@1 | |
373 | 9051 //signed int v11; // eax@1 |
0 | 9052 unsigned int v12; // eax@6 |
9053 const char *v13; // ST0C_4@6 | |
9054 unsigned int v14; // eax@8 | |
9055 const char *v15; // eax@14 | |
9056 unsigned int v16; // eax@16 | |
9057 unsigned int result; // eax@26 | |
9058 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9059 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9060 char *v20; // [sp-4h] [bp-3Ch]@9 |
9061 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9062 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9063 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9064 | |
9065 v9 = a1; | |
9066 v10 = a2; | |
9067 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9068 dword_59117C_teleportx = x; | |
9069 dword_591178_teleporty = y; | |
9070 dword_591174_teleportz = z; | |
9071 dword_591170_teleport_directiony = directiony; | |
9072 dword_59116C_teleport_directionx = directionx; | |
9073 dword_591168_teleport_speedz = a8; | |
9074 dword_591164_teleport_map_name = (char *)pLocationName; | |
9075 uCurrentHouse_Animation = v9; | |
9076 pEventTimer->Pause(); | |
9077 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9078 |
9079 switch (pParty->alignment) | |
9080 { | |
9081 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9082 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9083 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9084 default: assert(false); | |
9085 } | |
9086 /*v11 = const_2(); | |
0 | 9087 sprintf(pContainer, "evt%02d", v11); |
9088 if ( pParty->uAlignment ) | |
9089 { | |
9090 if ( pParty->uAlignment != 2 ) | |
9091 goto LABEL_6; | |
9092 v19 = "-c"; | |
9093 } | |
9094 else | |
9095 { | |
9096 v19 = "-b"; | |
9097 } | |
373 | 9098 strcat(pContainer, v19);*/ |
9099 | |
9100 //LABEL_6: | |
0 | 9101 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9102 v13 = pHouse_ExitPictures[v10]; | |
9103 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
948 | 9104 pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); |
0 | 9105 if ( v9 ) |
9106 { | |
9107 if ( !v23 ) | |
898 | 9108 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); |
9109 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); | |
0 | 9110 } |
9111 else | |
9112 { | |
9113 if ( !v23 ) | |
9114 { | |
9115 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9116 if ( v14 ) | |
9117 { | |
721 | 9118 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9119 goto LABEL_20; |
9120 } | |
9121 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9122 goto LABEL_19; | |
9123 } | |
9124 } | |
9125 v15 = pLocationName; | |
9126 if ( *pLocationName == 48 ) | |
9127 v15 = pCurrentMapName; | |
9128 v16 = pMapStats->GetMapInfo(v15); | |
9129 if ( v16 ) | |
9130 { | |
721 | 9131 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9132 goto LABEL_20; | |
0 | 9133 } |
9134 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9135 LABEL_19: | |
423 | 9136 strcpy(sHouseName, v21); |
0 | 9137 LABEL_20: |
710 | 9138 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9139 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9140 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9141 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9142 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9143 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9144 result = v23; |
9145 if ( v23 ) | |
9146 uCurrentHouse_Animation = v23; | |
9147 return result; | |
9148 } |