Mercurial > mm7
annotate mm7_4.cpp @ 909:becbb0b11b7d
Слияние
author | Ritor1 |
---|---|
date | Mon, 22 Apr 2013 09:25:22 +0600 |
parents | e2c1cb9b46f6 f3ccfc765502 |
children | 897b10712a1a |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
198 | 3 #include <assert.h> |
0 | 4 |
341 | 5 #include "MM7.h" |
0 | 6 #include "MapInfo.h" |
7 #include "Game.h" | |
8 #include "GUIWindow.h" | |
9 #include "GUIFont.h" | |
10 #include "Party.h" | |
11 #include "AudioPlayer.h" | |
12 #include "Outdoor.h" | |
13 #include "IndoorCamera.h" | |
14 #include "Overlays.h" | |
15 #include "Monsters.h" | |
16 #include "Arcomage.h" | |
17 #include "LOD.h" | |
18 #include "Actor.h" | |
19 #include "Allocator.h" | |
20 #include "Events.h" | |
21 #include "Viewport.h" | |
22 #include "FrameTableInc.h" | |
23 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
24 #include "SpriteObject.h" |
0 | 25 #include "ObjectList.h" |
26 #include "Chest.h" | |
27 #include "PaletteManager.h" | |
28 #include "DecorationList.h" | |
29 #include "SaveLoad.h" | |
30 #include "stru123.h" | |
31 #include "stru287.h" | |
32 #include "Time.h" | |
33 #include "IconFrameTable.h" | |
34 #include "GUIProgressBar.h" | |
35 #include "Bink_Smacker.h" | |
36 #include "TileFrameTable.h" | |
37 #include "PlayerFrameTable.h" | |
38 #include "Awards.h" | |
39 #include "Autonotes.h" | |
40 #include "stru160.h" | |
41 #include "stru279.h" | |
42 #include "TurnEngine.h" | |
43 #include "FactionTable.h" | |
44 #include "StorylineTextTable.h" | |
45 #include "Random.h" | |
46 #include "stru277.h" | |
47 #include "stru298.h" | |
48 #include "stru12.h" | |
49 #include "stru351.h" | |
50 #include "Events2D.h" | |
51 #include "stru159.h" | |
189 | 52 #include "texts.h" |
0 | 53 #include "Log.h" |
629 | 54 #include "UIHouses.h" |
0 | 55 #include "mm7_data.h" |
56 | |
57 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 58 void __cdecl check_event_triggers() |
0 | 59 { |
60 int v0; // eax@1 | |
61 LevelDecoration *v1; // esi@2 | |
62 signed int v2; // edi@2 | |
63 int v3; // ebx@2 | |
64 int v4; // eax@3 | |
65 int v5; // ebx@3 | |
66 unsigned int v6; // ecx@3 | |
67 unsigned int v7; // edx@6 | |
68 unsigned int v8; // edx@8 | |
112 | 69 Actor *v9; // edi@13 |
0 | 70 int v10; // ebx@14 |
71 int v11; // eax@14 | |
72 int v12; // ebx@14 | |
73 unsigned int v13; // ecx@14 | |
74 int v14; // edx@15 | |
75 unsigned int v15; // edx@17 | |
76 unsigned int v16; // edx@19 | |
77 char *v17; // edi@25 | |
78 int v18; // ebx@26 | |
79 int v19; // eax@26 | |
80 int v20; // ebx@26 | |
81 unsigned int v21; // ecx@26 | |
82 int v22; // edx@27 | |
83 unsigned int v23; // edx@29 | |
84 unsigned int v24; // edx@31 | |
85 int v25; // [sp+0h] [bp-24h]@3 | |
86 int v26; // [sp+0h] [bp-24h]@14 | |
87 int v27; // [sp+0h] [bp-24h]@26 | |
88 int v28; // [sp+4h] [bp-20h]@3 | |
89 int v29; // [sp+4h] [bp-20h]@14 | |
90 int v30; // [sp+4h] [bp-20h]@26 | |
91 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
92 int v32; // [sp+Ch] [bp-18h]@2 | |
93 int v33; // [sp+10h] [bp-14h]@2 | |
94 int i; // [sp+14h] [bp-10h]@1 | |
95 int v35; // [sp+18h] [bp-Ch]@2 | |
96 int v36; // [sp+1Ch] [bp-8h]@3 | |
97 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
98 signed int v38; // [sp+20h] [bp-4h]@24 | |
99 | |
100 v0 = 0; | |
101 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
102 { | |
103 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
104 v2 = v1->field_18; | |
105 v3 = v1->vPosition.y; | |
106 v33 = v1->vPosition.x; | |
107 v32 = v1->vPosition.y; | |
108 v35 = v1->vPosition.z; | |
109 v31 = v1->field_18; | |
110 if ( v1->field_2 & 1 ) | |
111 { | |
112 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
113 v25 = abs(v3 - pParty->vPosition.y); | |
114 v28 = abs(v35 - pParty->vPosition.z); | |
115 v4 = v36; | |
116 v5 = v25; | |
117 v6 = v28; | |
118 if ( v36 < v25 ) | |
119 { | |
120 v4 = v25; | |
121 v5 = v36; | |
122 } | |
123 if ( v4 < v28 ) | |
124 { | |
125 v7 = v4; | |
126 v4 = v28; | |
127 v6 = v7; | |
128 } | |
129 if ( v5 < (signed int)v6 ) | |
130 { | |
131 v8 = v6; | |
132 v6 = v5; | |
133 v5 = v8; | |
134 } | |
135 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 136 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 137 } |
138 if ( v1->field_2 & 2 ) | |
139 { | |
140 v37 = 0; | |
141 if ( (signed int)uNumActors > 0 ) | |
142 { | |
112 | 143 v9 = pActors;//[0].vPosition.y; |
0 | 144 do |
145 { | |
112 | 146 v10 = abs(v33 - v9->vPosition.x); |
147 v29 = abs(v32 - v9->vPosition.y); | |
148 v26 = abs(v35 - v9->vPosition.z); | |
0 | 149 v11 = v10; |
150 v12 = v29; | |
151 v13 = v26; | |
152 if ( v11 < v29 ) | |
153 { | |
154 v14 = v11; | |
155 v11 = v29; | |
156 v12 = v14; | |
157 } | |
158 if ( v11 < v26 ) | |
159 { | |
160 v15 = v11; | |
161 v11 = v26; | |
162 v13 = v15; | |
163 } | |
164 if ( v12 < (signed int)v13 ) | |
165 { | |
166 v16 = v13; | |
167 v13 = v12; | |
168 v12 = v16; | |
169 } | |
170 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
171 EventProcessor(v1->field_16_event_id, 0, 1); | |
172 ++v37; | |
112 | 173 ++v9; |
0 | 174 } |
175 while ( v37 < (signed int)uNumActors ); | |
176 } | |
177 } | |
178 if ( v1->field_2 & 4 ) | |
179 { | |
180 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
181 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
182 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
183 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 184 do |
185 { | |
186 v18 = abs(v33 - *((int *)v17 - 1)); | |
187 v30 = abs(v32 - *(int *)v17); | |
188 v27 = abs(v35 - *((int *)v17 + 1)); | |
189 v19 = v18; | |
190 v20 = v30; | |
191 v21 = v27; | |
192 if ( v19 < v30 ) | |
193 { | |
194 v22 = v19; | |
195 v19 = v30; | |
196 v20 = v22; | |
197 } | |
198 if ( v19 < v27 ) | |
199 { | |
200 v23 = v19; | |
201 v19 = v27; | |
202 v21 = v23; | |
203 } | |
204 if ( v20 < (signed int)v21 ) | |
205 { | |
206 v24 = v21; | |
207 v21 = v20; | |
208 v20 = v24; | |
209 } | |
210 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
211 EventProcessor(v1->field_16_event_id, 0, 1); | |
212 ++v38; | |
213 v17 += 112; | |
214 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
215 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 216 } |
217 } | |
218 v0 = i + 1; | |
219 } | |
220 } | |
221 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
222 | |
223 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 224 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 225 { |
226 int v13; // ecx@13 | |
227 signed int v14; // ebx@14 | |
228 int v15; // eax@16 | |
729 | 229 //int v16; // edx@19 |
792 | 230 //int v17; // ST18_4@19 |
231 //signed int v18; // edx@19 | |
232 //signed __int64 v19; // qtt@19 | |
0 | 233 int v21; // eax@27 |
792 | 234 //int v22; // ecx@29 |
0 | 235 signed int v28; // eax@45 |
236 int v29; // ebx@47 | |
237 int v30; // edx@49 | |
830 | 238 //int v31; // ST10_4@49 |
239 //signed int v32; // edx@49 | |
0 | 240 signed __int64 v33; // qtt@49 |
830 | 241 //signed int v34; // eax@54 |
242 //signed int v35; // esi@56 | |
243 //int result; // eax@57 | |
0 | 244 int v38; // edx@62 |
792 | 245 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 246 bool v47; // [sp+24h] [bp-1Ch]@43 |
247 bool v48; // [sp+28h] [bp-18h]@10 | |
248 bool v49; // [sp+28h] [bp-18h]@41 | |
249 bool v50; // [sp+2Ch] [bp-14h]@12 | |
250 signed int v53; // [sp+30h] [bp-10h]@10 | |
251 signed int v54; // [sp+30h] [bp-10h]@41 | |
252 signed int v55; // [sp+34h] [bp-Ch]@1 | |
253 | |
730 | 254 //LOG_DECOMPILATION_WARNING(); |
255 | |
256 static int blv_floor_id[50]; // 00721200 | |
257 static int blv_floor_level[50]; // 007212C8 | |
258 | |
259 static __int16 word_721390_ys[104]; // idb | |
260 static __int16 word_721460_xs[104]; // idb | |
0 | 261 |
262 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 263 v55 = 0; |
0 | 264 for (uint i = 0; i < pSector->uNumFloors; ++i) |
265 { | |
266 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
267 if (pFloor->Clickable()) | |
268 continue; | |
269 | |
792 | 270 assert(pFloor->uNumVertices); |
0 | 271 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
272 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
273 { | |
274 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
275 { | |
730 | 276 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
277 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
278 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
279 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 280 } |
730 | 281 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
282 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
283 | |
792 | 284 v50 = word_721390_ys[0] >= y; |
0 | 285 v53 = 0; |
792 | 286 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
287 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 288 { |
289 if (v53 >= 2) | |
290 break; | |
291 | |
292 v48 = v50; | |
293 v50 = word_721390_ys[j + 1] >= y; | |
730 | 294 |
295 v13 = i; | |
792 | 296 if (v48 == v50) |
297 continue; | |
298 | |
299 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
300 v15 = v14 | word_721460_xs[j] < x; | |
301 | |
302 if (v15 == 3) | |
303 continue; | |
304 else if (!v15) | |
305 ++v53; | |
306 else | |
0 | 307 { |
792 | 308 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 309 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 310 |
311 if (res + word_721460_xs[j] >= x) | |
729 | 312 ++v53; |
0 | 313 } |
792 | 314 } |
315 | |
316 | |
0 | 317 if ( v53 == 1 ) |
318 { | |
319 if ( v55 >= 50 ) | |
320 break; | |
723 | 321 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 322 { |
725 | 323 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 324 } |
325 else | |
326 { | |
871 | 327 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 328 } |
792 | 329 blv_floor_level[v55] = v21; |
330 blv_floor_id[v55] = pSector->pFloors[i]; | |
331 v55++; | |
0 | 332 } |
792 | 333 } |
334 } | |
335 | |
336 | |
0 | 337 if ( pSector->field_0 & 8 ) |
338 { | |
339 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
340 { | |
341 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
342 if (portal->uPolygonType != POLYGON_Floor) | |
343 continue; | |
344 | |
830 | 345 if (!portal->uNumVertices) |
346 continue; | |
347 | |
723 | 348 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
349 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
350 { | |
0 | 351 for (uint j = 0; j < portal->uNumVertices; ++j) |
352 { | |
730 | 353 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
354 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
355 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
356 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
357 } | |
358 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
359 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 360 v54 = 0; |
830 | 361 v47 = word_721390_ys[0] >= y; |
362 | |
363 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 364 { |
830 | 365 v49 = v47; |
0 | 366 if ( v54 >= 2 ) |
367 break; | |
830 | 368 v47 = word_721390_ys[j + 1] >= y; |
0 | 369 if ( v49 != v47 ) |
370 { | |
830 | 371 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
372 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 373 if ( v29 != 3 ) |
374 { | |
723 | 375 if ( !v29 ) |
729 | 376 ++v54; |
377 else | |
378 { | |
830 | 379 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 380 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 381 if (res + word_721460_xs[j] >= x) |
723 | 382 ++v54; |
729 | 383 } |
0 | 384 } |
385 } | |
386 } | |
387 if ( v54 == 1 ) | |
388 { | |
389 if ( v55 >= 50 ) | |
390 break; | |
830 | 391 blv_floor_level[v55] = -29000; |
392 blv_floor_id[v55] = pSector->pPortals[i]; | |
393 v55++; | |
0 | 394 } |
395 } | |
396 } | |
397 } | |
398 if ( v55 == 1 ) | |
399 { | |
730 | 400 *pFaceID = blv_floor_id[0]; |
725 | 401 return blv_floor_level[0]; |
0 | 402 } |
403 if ( !v55 ) | |
404 return -30000; | |
730 | 405 *pFaceID = blv_floor_id[0]; |
725 | 406 //result = blv_floor_level[0]; |
830 | 407 |
408 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 409 { |
725 | 410 if ( blv_floor_level[0] <= z + 5 ) |
411 { | |
412 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 413 continue; |
725 | 414 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 415 *pFaceID = blv_floor_id[v35]; |
717 | 416 continue; |
417 } | |
725 | 418 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
419 { | |
420 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 421 *pFaceID = blv_floor_id[v35]; |
717 | 422 } |
830 | 423 }*/ |
424 | |
425 | |
426 int result = blv_floor_level[0]; | |
427 for (uint i = 1; i < v55; ++i) | |
428 { | |
429 v38 = blv_floor_level[i]; | |
430 if ( result <= z + 5 ) | |
431 { | |
432 if ( v38 > result && v38 <= z + 5 ) | |
433 { | |
434 result = blv_floor_level[i]; | |
435 *pFaceID = blv_floor_id[i]; | |
436 } | |
437 } | |
438 else if ( v38 < result ) | |
439 { | |
440 result = blv_floor_level[i]; | |
441 *pFaceID = blv_floor_id[i]; | |
442 } | |
443 } | |
444 | |
445 return result; | |
0 | 446 } |
447 | |
448 //----- (0046D49E) -------------------------------------------------------- | |
791 | 449 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 450 { |
723 | 451 BSPModel *pBModel; // esi@4 |
452 ODMFace *pFace; // ecx@11 | |
0 | 453 int v14; // edx@20 |
454 signed int v18; // edx@26 | |
455 int v19; // eax@28 | |
456 int v20; // edx@30 | |
457 int v21; // ST1C_4@30 | |
458 signed int v22; // edx@30 | |
459 signed __int64 v23; // qtt@30 | |
460 int v24; // eax@36 | |
461 signed int v25; // ecx@38 | |
462 int result; // eax@42 | |
463 signed int v27; // ecx@43 | |
464 int v28; // edi@44 | |
465 signed int v29; // edx@44 | |
466 int v30; // esi@45 | |
467 int v31; // eax@45 | |
468 ODMFace *v32; // eax@57 | |
469 int v33; // ecx@59 | |
470 int v36; // [sp+14h] [bp-2Ch]@24 | |
471 int v38; // [sp+1Ch] [bp-24h]@2 | |
472 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 473 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
474 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 475 bool v43; // [sp+30h] [bp-10h]@22 |
476 bool v44; // [sp+34h] [bp-Ch]@24 | |
477 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
478 signed int v48; // [sp+58h] [bp+18h]@22 | |
479 signed int v49; // [sp+58h] [bp+18h]@43 | |
480 | |
481 v46 = 1; | |
482 dword_721160[0] = -1; | |
483 dword_721110[0] = -1; | |
791 | 484 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 485 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 486 { |
487 *a6 = 0; | |
725 | 488 return odm_floor_level[0]; |
723 | 489 } |
0 | 490 v38 = 0; |
723 | 491 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
492 { | |
493 pBModel = &pOutdoor->pBModels[v38]; | |
494 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
495 { | |
496 if ( (signed int)pBModel->uNumFaces > 0 ) | |
497 { | |
498 v39 = 0; | |
499 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
500 { | |
501 pFace = &pBModel->pFaces[v39]; | |
502 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
503 && !(pFace->uAttributes & 0x20000000) | |
504 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
505 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 506 { |
723 | 507 if ( pFace->uNumVertices ) |
0 | 508 { |
723 | 509 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 510 { |
723 | 511 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
512 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
513 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
514 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
515 } | |
516 } | |
517 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
518 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
519 v43 = word_720F70[0] >= Y; | |
520 v48 = 0; | |
521 if ( 2 * pFace->uNumVertices > 0 ) | |
522 { | |
523 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
524 { | |
525 if ( v48 >= 2 ) | |
526 break; | |
527 v36 = word_720F70[i + 1]; | |
528 v44 = word_720F70[i + 1] >= Y; | |
529 if ( v43 != v44 ) | |
0 | 530 { |
723 | 531 v18 = word_721040[i + 1] >= X ? 0 : 2; |
532 v19 = v18 | word_721040[i] < X; | |
533 if ( v19 != 3 ) | |
0 | 534 { |
723 | 535 if ( !v19 ) |
740 | 536 ++v48; |
537 else | |
0 | 538 { |
723 | 539 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
540 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
541 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
542 if ( v22 >= X) | |
543 ++v48; | |
0 | 544 } |
545 } | |
546 } | |
723 | 547 v43 = v44; |
548 } | |
549 if ( v48 == 1 ) | |
550 { | |
551 if ( v46 >= 20 ) | |
0 | 552 break; |
723 | 553 if ( pFace->uPolygonType == POLYGON_Floor ) |
554 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
555 else | |
725 | 556 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
557 + HIWORD(pFace->zCalc3); | |
723 | 558 v25 = v46++; |
725 | 559 odm_floor_level[v25] = v24; |
723 | 560 dword_721160[v25] = pBModelNum; |
561 dword_721110[v25] = pFaceNum; | |
0 | 562 } |
563 } | |
564 } | |
723 | 565 ++v39; |
566 } | |
567 } | |
568 } | |
0 | 569 ++v38; |
570 } | |
571 if ( v46 == 1 ) | |
572 { | |
573 *a6 = 0; | |
725 | 574 return odm_floor_level[0]; |
0 | 575 } |
576 v27 = 0; | |
577 if ( v46 <= 1 ) | |
578 *a6 = 0; | |
723 | 579 else |
580 { | |
725 | 581 //v29 = 1; |
723 | 582 for ( v49 = 1; v49 < v46; ++v49 ) |
583 { | |
725 | 584 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 585 { |
586 v27 = v49; | |
725 | 587 //++v29; |
723 | 588 break; |
589 } | |
725 | 590 if ( odm_floor_level[0] > Z + 5 ) |
591 { | |
592 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
593 { | |
594 //++v29; | |
723 | 595 break; |
596 } | |
597 v27 = v49; | |
725 | 598 //++v29; |
723 | 599 break; |
600 } | |
725 | 601 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 602 { |
603 v27 = v49; | |
725 | 604 //++v29; |
723 | 605 } |
606 } | |
607 if ( !v27 ) | |
608 *a6 = 0; | |
609 else | |
610 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
611 } | |
0 | 612 if ( v27 ) |
613 { | |
614 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 615 *pIsOnWater = false; |
616 if ( v32->Fluid()) | |
617 *pIsOnWater = true; | |
0 | 618 } |
725 | 619 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
620 odm_floor_level[0] = odm_floor_level[v27]; | |
621 return odm_floor_level[0]; | |
0 | 622 } |
623 | |
624 //----- (0046D8E3) -------------------------------------------------------- | |
625 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
626 { | |
627 int v4; // ebx@1 | |
628 unsigned int v5; // ecx@1 | |
629 BSPModel *v6; // edi@3 | |
630 ODMFace *v7; // esi@10 | |
631 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
632 signed __int16 *v9; // eax@18 |
0 | 633 int v10; // edx@19 |
634 int v11; // ecx@21 | |
635 int v12; // ecx@23 | |
636 signed int v13; // eax@25 | |
637 int v14; // edx@27 | |
638 int v15; // edx@29 | |
639 int v16; // ST18_4@29 | |
640 signed int v17; // edx@29 | |
641 signed __int64 v18; // qtt@29 | |
642 int v19; // eax@35 | |
643 signed int v20; // ecx@37 | |
644 signed int v22; // ebx@42 | |
645 unsigned int v23; // esi@43 | |
646 int v24; // edx@44 | |
647 int v25; // eax@44 | |
648 int v26; // [sp+Ch] [bp-38h]@7 | |
649 int v27; // [sp+10h] [bp-34h]@21 | |
650 int v28; // [sp+18h] [bp-2Ch]@21 | |
651 int v29; // [sp+1Ch] [bp-28h]@2 | |
652 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
653 signed int v31; // [sp+24h] [bp-20h]@1 | |
654 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
655 int v33; // [sp+2Ch] [bp-18h]@7 | |
656 bool v34; // [sp+30h] [bp-14h]@21 | |
657 bool v35; // [sp+34h] [bp-10h]@23 | |
658 signed int v36; // [sp+38h] [bp-Ch]@17 | |
659 signed int v37; // [sp+38h] [bp-Ch]@21 | |
660 signed int v38; // [sp+38h] [bp-Ch]@42 | |
661 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
662 signed int v40; // [sp+40h] [bp-4h]@1 | |
663 | |
664 dword_720ED0[0] = -1; | |
665 dword_720E80[0] = -1; | |
666 v4 = a1; | |
667 v5 = 0; | |
668 v40 = a2; | |
669 v31 = v4; | |
670 v39 = 1; | |
671 dword_720F20[0] = 10000; | |
672 v32 = 0; | |
673 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
674 { | |
675 v29 = 0; | |
676 do | |
677 { | |
678 v6 = &pOutdoor->pBModels[v29]; | |
679 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
680 { | |
681 if ( v4 >= v6->sMinX ) | |
682 { | |
683 if ( v40 <= v6->sMaxY ) | |
684 { | |
685 if ( v40 >= v6->sMinY ) | |
686 { | |
687 v33 = v5; | |
688 v26 = v6->uNumFaces; | |
689 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
690 { | |
691 v30 = v5; | |
692 while ( 1 ) | |
693 { | |
694 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
695 v8 = v7->uPolygonType; | |
696 if ( (v8 == 5 || v8 == 6) | |
697 && !(BYTE3(v7->uAttributes) & 0x20) | |
698 && v4 <= v7->pBoundingBox.x2 | |
699 && v4 >= v7->pBoundingBox.x1 | |
700 && v40 <= v7->pBoundingBox.y2 | |
701 && v40 >= v7->pBoundingBox.y1 ) | |
702 { | |
703 v36 = v5; | |
704 if ( v7->uNumVertices ) | |
705 { | |
706 v9 = v7->pXInterceptDisplacements; | |
707 do | |
708 { | |
709 v10 = 2 * v36; | |
710 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
711 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
712 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
713 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
714 ++v9; | |
715 } | |
716 while ( v36 < v7->uNumVertices ); | |
717 v4 = v31; | |
718 } | |
719 v27 = 2 * v7->uNumVertices; | |
720 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
721 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
722 v11 = 0; | |
723 v34 = word_720CE0_ys[0] >= v40; | |
724 v37 = 0; | |
725 v28 = 0; | |
726 if ( v27 > 0 ) | |
727 { | |
728 do | |
729 { | |
730 if ( v37 >= 2 ) | |
731 break; | |
732 v12 = v11; | |
733 v4 = v31; | |
734 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
735 if ( v34 != v35 ) | |
736 { | |
737 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
738 v14 = v13 | word_720DB0_xs[v12] < v31; | |
739 if ( v14 != 3 ) | |
740 { | |
741 if ( !v14 | |
742 || (v15 = word_720CE0_ys[v12], | |
743 v16 = word_720CE0_ys[v12 + 1] - v15, | |
744 v17 = v40 - v15, | |
745 LODWORD(v18) = v17 << 16, | |
746 HIDWORD(v18) = v17 >> 16, | |
747 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
748 - (signed int)word_720DB0_xs[v12]) | |
749 * v18 | |
750 / v16) >> 16) | |
751 + word_720DB0_xs[v12]) >= v31) ) | |
752 ++v37; | |
753 } | |
754 } | |
755 v11 = v28 + 1; | |
756 v34 = v35; | |
757 ++v28; | |
758 } | |
759 while ( v28 < v27 ); | |
760 if ( v37 == 1 ) | |
761 { | |
762 if ( v39 >= 20 ) | |
763 break; | |
764 if ( v7->uPolygonType == 5 ) | |
765 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
766 else | |
767 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
768 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
769 + HIWORD(v7->zCalc3); | |
770 v20 = v39++; | |
771 dword_720F20[v20] = v19; | |
772 dword_720ED0[v20] = v32; | |
773 dword_720E80[v20] = v33; | |
774 } | |
775 } | |
776 } | |
777 ++v33; | |
778 v30 += 308; | |
779 if ( v33 >= v26 ) | |
780 break; | |
781 v5 = 0; | |
782 } | |
783 } | |
784 } | |
785 } | |
786 } | |
787 } | |
788 ++v32; | |
789 ++v29; | |
790 v5 = 0; | |
791 } | |
792 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
793 if ( !v39 ) | |
794 { | |
795 *(int *)a4 = 0; | |
796 return dword_720F20[0]; | |
797 } | |
798 } | |
799 v22 = 0; | |
800 v38 = v5; | |
801 if ( v39 <= (signed int)v5 ) | |
802 goto LABEL_54; | |
803 v23 = 0; | |
804 do | |
805 { | |
806 v24 = dword_720F20[v5 / 4]; | |
807 v25 = *(int *)((char *)dword_720F20 + v23); | |
808 if ( v24 == v25 ) | |
809 goto LABEL_50; | |
810 if ( v25 > a3 + 15 ) | |
811 { | |
812 if ( v24 >= v25 ) | |
813 goto LABEL_51; | |
814 LABEL_50: | |
815 v22 = v38; | |
816 v23 = v5; | |
817 goto LABEL_51; | |
818 } | |
819 if ( v24 > v25 && v24 <= a3 + 15 ) | |
820 goto LABEL_50; | |
821 LABEL_51: | |
822 ++v38; | |
823 v5 += 4; | |
824 } | |
825 while ( v38 < v39 ); | |
826 if ( v22 ) | |
827 { | |
828 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
829 return dword_720F20[v22]; | |
830 } | |
831 LABEL_54: | |
832 *(int *)a4 = 0; | |
833 return dword_720F20[v22]; | |
834 } | |
835 | |
138 | 836 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
837 // for a right-handed system, that would be an inverse normal | |
0 | 838 //----- (0046DCC8) -------------------------------------------------------- |
138 | 839 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
840 { | |
841 auto grid_x = WorldPosToGridCellX(pos_x); | |
842 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
843 | |
844 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
845 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
846 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
847 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
848 | |
849 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
850 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
851 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
852 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
853 | |
854 float side1_dx, side1_dy, side1_dz, | |
855 side2_dx, side2_dy, side2_dz; | |
856 | |
857 auto dx = abs(pos_x - grid_pos_x1), | |
858 dz = abs(grid_pos_z1 - pos_z); | |
859 if (dz >= dx) | |
860 { | |
861 side1_dy = (double)(x1z1_y - x1z2_y); | |
862 side2_dy = (double)(x2z2_y - x1z2_y); | |
863 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
864 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
865 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
866 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 867 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 868 /* |\ |
869 side1 | \ | |
870 |____\ | |
871 side 2 */ | |
872 } | |
873 else | |
874 { | |
875 side1_dy = (double)(x2z2_y - x2z1_y); | |
876 side2_dy = (double)(x1z1_y - x2z1_y); | |
877 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
878 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
879 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
880 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
881 | |
882 /* side 2 | |
883 _____ | |
884 \ | | |
885 \ | side 1 | |
886 \| */ | |
887 } | |
888 | |
889 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
890 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
891 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
892 | |
893 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
894 if (fabsf(mag) < 1e-6f) | |
895 { | |
896 out->y = 0; | |
897 out->x = 0; | |
898 out->z = 65536; | |
899 } | |
900 else | |
901 { | |
902 float invmag = 1.0 / mag; | |
903 out->x = invmag * nx * 65536.0; | |
904 out->y = invmag * ny * 65536.0; | |
905 out->z = invmag * nz * 65536.0; | |
906 } | |
907 } | |
908 | |
0 | 909 //----- (0046DEF2) -------------------------------------------------------- |
910 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
911 { | |
912 unsigned int result; // eax@1 | |
913 | |
914 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
915 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 916 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
917 return result; | |
918 } | |
919 | |
920 //----- (0046DF1A) -------------------------------------------------------- | |
921 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
922 { | |
923 Actor *v2; // edi@1 | |
924 unsigned __int16 v3; // ax@1 | |
925 int v4; // esi@6 | |
926 int v5; // ecx@8 | |
927 int v6; // eax@10 | |
928 int v7; // edx@12 | |
929 int v8; // ecx@14 | |
930 int v9; // eax@14 | |
931 int v10; // ebx@14 | |
932 int v11; // esi@14 | |
933 int v12; // ebx@15 | |
934 int v13; // ebx@17 | |
935 unsigned int v14; // eax@20 | |
936 signed int result; // eax@21 | |
937 int v16; // [sp+Ch] [bp-10h]@1 | |
938 int v17; // [sp+10h] [bp-Ch]@14 | |
939 int v18; // [sp+14h] [bp-8h]@14 | |
940 int v19; // [sp+18h] [bp-4h]@14 | |
941 | |
942 v16 = a1; | |
943 v2 = &pActors[a1]; | |
944 v3 = v2->uAIState; | |
945 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
946 goto LABEL_25; | |
947 v4 = v2->uActorRadius; | |
948 if ( a2 ) | |
949 v4 = a2; | |
950 v5 = v2->vPosition.x; | |
951 if ( stru_721530.sMaxX > v5 + v4 | |
952 || stru_721530.sMinX < v5 - v4 | |
953 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
954 || stru_721530.sMinY < v6 - v4 | |
955 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
956 || stru_721530.sMinZ < v7 | |
957 || (v8 = v5 - stru_721530.normal.x, | |
958 v9 = v6 - stru_721530.normal.y, | |
959 v10 = stru_721530.prolly_normal_d + v4, | |
960 v17 = stru_721530.prolly_normal_d + v4, | |
961 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
962 v18 = v8, | |
963 v19 = v9, | |
964 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
965 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
966 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
967 { | |
968 LABEL_25: | |
969 result = 0; | |
970 } | |
971 else | |
972 { | |
295 | 973 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 974 if ( v13 < 0 ) |
975 v13 = 0; | |
976 if ( v13 < stru_721530.field_7C ) | |
977 { | |
978 stru_721530.field_7C = v13; | |
979 v14 = 8 * v16; | |
862 | 980 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 981 stru_721530.uFaceID = v14; |
982 } | |
983 result = 1; | |
984 } | |
985 return result; | |
986 } | |
987 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
988 | |
989 //----- (0046E0B2) -------------------------------------------------------- | |
990 void __cdecl _46E0B2_collide_against_decorations() | |
991 { | |
992 BLVSector *v0; // ebp@1 | |
993 LevelDecoration *v1; // edi@2 | |
994 DecorationDesc *v2; // esi@3 | |
995 int v3; // edx@4 | |
996 int v4; // eax@4 | |
997 int v5; // ecx@6 | |
998 int v6; // ebx@8 | |
999 int v7; // esi@8 | |
1000 int v8; // ebx@10 | |
1001 int v9; // esi@11 | |
1002 int v10; // edi@12 | |
1003 int v11; // eax@12 | |
1004 int v12; // esi@14 | |
1005 unsigned int v13; // eax@17 | |
1006 signed int i; // [sp+4h] [bp-14h]@1 | |
1007 int v15; // [sp+8h] [bp-10h]@10 | |
1008 int v16; // [sp+Ch] [bp-Ch]@10 | |
1009 int v17; // [sp+10h] [bp-8h]@10 | |
1010 int v18; // [sp+14h] [bp-4h]@8 | |
1011 | |
1012 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1013 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1014 { | |
1015 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1016 if ( !(v1->field_2 & 0x20) ) | |
1017 { | |
1018 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1019 if (!v2->CanMoveThrough()) |
0 | 1020 { |
1021 v3 = v2->uRadius; | |
1022 v4 = v1->vPosition.x; | |
1023 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1024 { | |
1025 if ( stru_721530.sMinX >= v4 - v3 ) | |
1026 { | |
1027 v5 = v1->vPosition.y; | |
1028 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1029 { | |
1030 if ( stru_721530.sMinY >= v5 - v3 ) | |
1031 { | |
1032 v6 = v2->uDecorationHeight; | |
1033 v7 = v1->vPosition.z; | |
1034 v18 = v6; | |
1035 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1036 { | |
1037 if ( stru_721530.sMinZ >= v7 ) | |
1038 { | |
1039 v16 = v4 - stru_721530.normal.x; | |
1040 v15 = v5 - stru_721530.normal.y; | |
1041 v8 = stru_721530.prolly_normal_d + v3; | |
1042 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1043 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1044 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1045 { | |
1046 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1047 if ( v9 > 0 ) | |
1048 { | |
1049 v10 = v1->vPosition.z; | |
1050 v11 = stru_721530.normal.z | |
1051 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1052 if ( v11 >= v10 ) | |
1053 { | |
1054 if ( v11 <= v18 + v10 ) | |
1055 { | |
295 | 1056 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1057 if ( v12 < 0 ) |
1058 v12 = 0; | |
1059 if ( v12 < stru_721530.field_7C ) | |
1060 { | |
1061 stru_721530.field_7C = v12; | |
1062 v13 = 8 * v0->pDecorationIDs[i]; | |
1063 LOBYTE(v13) = v13 | 5; | |
1064 stru_721530.uFaceID = v13; | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 } | |
1078 } | |
1079 } | |
1080 | |
1081 //----- (0046E26D) -------------------------------------------------------- | |
1082 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1083 { | |
1084 int v2; // edx@5 | |
1085 unsigned __int16 *v3; // eax@5 | |
1086 unsigned __int16 v4; // ax@6 | |
1087 LevelDecoration *v5; // edi@7 | |
1088 DecorationDesc *v6; // esi@8 | |
1089 int v7; // edx@9 | |
1090 int v8; // eax@9 | |
1091 int v9; // ecx@11 | |
1092 int v10; // ebx@13 | |
1093 int v11; // esi@13 | |
1094 int v12; // ebp@15 | |
1095 int v13; // ebx@15 | |
1096 int v14; // esi@16 | |
1097 int v15; // edi@17 | |
1098 int v16; // eax@17 | |
1099 int v17; // esi@19 | |
1100 char v18; // zf@23 | |
1101 int v19; // [sp+0h] [bp-10h]@15 | |
1102 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1103 int v21; // [sp+8h] [bp-8h]@15 | |
1104 int v22; // [sp+Ch] [bp-4h]@13 | |
1105 | |
1106 if ( a1 >= 0 ) | |
1107 { | |
1108 if ( a1 <= 127 ) | |
1109 { | |
1110 if ( a2 >= 0 ) | |
1111 { | |
1112 if ( a2 <= 127 ) | |
1113 { | |
1114 v2 = a1 + (a2 << 7); | |
1115 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1116 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1117 if ( v3 ) | |
1118 { | |
1119 do | |
1120 { | |
1121 v4 = *v3; | |
848 | 1122 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1123 { |
1124 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1125 if ( !(v5->field_2 & 0x20) ) | |
1126 { | |
1127 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1128 if (!v6->CanMoveThrough()) |
0 | 1129 { |
1130 v7 = v6->uRadius; | |
1131 v8 = v5->vPosition.x; | |
1132 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1133 { | |
1134 if ( stru_721530.sMinX >= v8 - v7 ) | |
1135 { | |
1136 v9 = v5->vPosition.y; | |
1137 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1138 { | |
1139 if ( stru_721530.sMinY >= v9 - v7 ) | |
1140 { | |
1141 v10 = v6->uDecorationHeight; | |
1142 v11 = v5->vPosition.z; | |
1143 v22 = v10; | |
1144 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1145 { | |
1146 if ( stru_721530.sMinZ >= v11 ) | |
1147 { | |
1148 v12 = v8 - stru_721530.normal.x; | |
1149 v19 = v9 - stru_721530.normal.y; | |
1150 v13 = stru_721530.prolly_normal_d + v7; | |
1151 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1152 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1153 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1154 { | |
1155 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1156 if ( v14 > 0 ) | |
1157 { | |
1158 v15 = v5->vPosition.z; | |
1159 v16 = stru_721530.normal.z | |
1160 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1161 if ( v16 >= v15 ) | |
1162 { | |
1163 if ( v16 <= v22 + v15 ) | |
1164 { | |
295 | 1165 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1166 if ( v17 < 0 ) |
1167 v17 = 0; | |
1168 if ( v17 < stru_721530.field_7C ) | |
1169 { | |
1170 stru_721530.field_7C = v17; | |
1171 stru_721530.uFaceID = (signed __int16)*v20; | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 } | |
1184 } | |
1185 } | |
1186 v3 = v20 + 1; | |
1187 v18 = *v20 == 0; | |
1188 ++v20; | |
1189 } | |
1190 while ( !v18 ); | |
1191 } | |
1192 } | |
1193 } | |
1194 } | |
1195 } | |
1196 } | |
1197 | |
1198 //----- (00486F92) -------------------------------------------------------- | |
1199 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1200 { | |
1201 Span *v0; // ebx@1 | |
1202 int v1; // eax@2 | |
1203 Edge *v2; // ecx@3 | |
1204 Edge *v3; // edx@3 | |
1205 Edge *v4; // esi@6 | |
1206 Edge *v5; // eax@7 | |
1207 Edge *v6; // ecx@8 | |
1208 Surf *v7; // esi@11 | |
1209 double v8; // st7@13 | |
1210 Surf *v9; // edi@13 | |
1211 double v10; // st6@13 | |
1212 double v11; // st7@14 | |
1213 signed __int64 v12; // qax@14 | |
1214 stru148 *v13; // eax@15 | |
1215 Span *v14; // ecx@17 | |
1216 double v15; // st7@28 | |
1217 signed __int64 v16; // qax@28 | |
1218 stru148 *v17; // eax@29 | |
1219 Span *v18; // ecx@31 | |
1220 Edge *i; // eax@40 | |
1221 Edge *v20; // ecx@43 | |
1222 Edge *v21; // esi@44 | |
1223 double v22; // st7@45 | |
1224 Edge *v23; // edx@48 | |
1225 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1226 float v25; // [sp+14h] [bp-Ch]@3 | |
1227 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1228 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1229 | |
1230 v0 = pSpans; | |
1231 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1232 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1233 stru_80C9A4.pSurf = &stru_80C980; |
1234 stru_80C980.pPrev = &stru_80C980; | |
1235 stru_80C980.pNext = &stru_80C980; | |
693 | 1236 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1237 stru_80C980.field_8 = 0.0; |
1238 stru_80C980.field_4 = 0.0; | |
1239 stru_80C9D8.pNext = &stru_80C9A4; | |
1240 stru_80C9D8.pPrev = 0; | |
1241 stru_80C9D8.field_8 = 1; | |
1242 stru_80C9A4.pNext = 0; | |
1243 stru_80C9A4.pPrev = &stru_80C9D8; | |
1244 stru_80C9A4.field_8 = 0; | |
1245 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1246 v27 = pViewport->uViewportTL_Y; |
1247 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1248 { |
1249 LABEL_51: | |
1250 v0->field_8 = -1; | |
1251 } | |
1252 else | |
1253 { | |
693 | 1254 v1 = 52 * pViewport->uViewportTL_Y; |
1255 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1256 while ( 1 ) |
1257 { | |
1258 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1259 v3 = &stru_80C9D8; | |
1260 v25 = (double)(signed int)v27; | |
1261 if ( v2 != &defaultEdge ) | |
1262 { | |
1263 do | |
1264 { | |
1265 while ( 1 ) | |
1266 { | |
1267 v4 = v3->pNext; | |
1268 if ( v2->field_0 <= (double)v4->field_0 ) | |
1269 break; | |
1270 v3 = v3->pNext; | |
1271 } | |
1272 v5 = v2->pNext; | |
1273 v2->pNext = v4; | |
1274 v2->pPrev = v3; | |
1275 v3->pNext->pPrev = v2; | |
1276 v3->pNext = v2; | |
1277 v3 = v2; | |
1278 v2 = v5; | |
1279 } | |
1280 while ( v5 != &defaultEdge ); | |
1281 } | |
1282 v6 = stru_80C9D8.pNext; | |
1283 stru_80C980.field_20 = 0; | |
1284 stru_80C980.field_22 = 1; | |
1285 v26 = stru_80C9D8.pNext; | |
1286 if ( stru_80C9D8.pNext ) | |
1287 { | |
1288 while ( 1 ) | |
1289 { | |
1290 v7 = v6->pSurf; | |
1291 if ( v6->field_8 ) | |
1292 { | |
1293 ++v7->field_22; | |
1294 if ( v7->field_22 == 1 ) | |
1295 { | |
1296 v8 = v6->field_0 + 2.0; | |
1297 v9 = stru_80C980.pNext; | |
1298 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1299 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1300 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1301 + stru_80C980.pNext->field_0 ) | |
1302 { | |
1303 do | |
1304 v9 = v9->pNext; | |
1305 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1306 v7->pNext = v9; | |
1307 v7->pPrev = v9->pPrev; | |
1308 v9->pPrev->pNext = v7; | |
1309 v9->pPrev = v7; | |
1310 } | |
1311 else | |
1312 { | |
1313 v11 = v6->field_0 + 0.5; | |
1314 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1315 v0->field_C = v12; | |
1316 if ( (signed __int16)v12 > 0 ) | |
1317 { | |
1318 v0->field_A = v27; | |
1319 v0->field_8 = v9->field_20; | |
1320 v13 = v9->pParent; | |
1321 v0->pParent = v13; | |
1322 if ( v13 ) | |
1323 { | |
1324 if ( v13->prolly_head ) | |
1325 { | |
1326 v14 = v13->prolly_tail; | |
1327 if ( !v14 ) | |
1328 return; | |
1329 v14->pNext = v0; | |
1330 } | |
1331 else | |
1332 { | |
1333 v13->prolly_head = v0; | |
1334 } | |
1335 v13->prolly_tail = v0; | |
1336 } | |
1337 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1338 return; | |
1339 ++v0; | |
1340 ++pOutdoorCamera->uNumSpans; | |
1341 } | |
1342 v6 = v26; | |
1343 v7->field_20 = (signed __int64)v11; | |
1344 v7->pNext = v9; | |
1345 v9->pPrev = v7; | |
1346 stru_80C980.pNext = v7; | |
1347 v7->pPrev = &stru_80C980; | |
1348 } | |
1349 } | |
1350 } | |
1351 else | |
1352 { | |
1353 --v7->field_22; | |
1354 if ( !v7->field_22 ) | |
1355 { | |
1356 if ( stru_80C980.pNext == v7 ) | |
1357 { | |
1358 v15 = v6->field_0 + 0.5; | |
1359 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1360 v0->field_C = v16; | |
1361 if ( (signed __int16)v16 > 0 ) | |
1362 { | |
1363 v0->field_A = v27; | |
1364 v0->field_8 = v7->field_20; | |
1365 v17 = v7->pParent; | |
1366 v0->pParent = v17; | |
1367 if ( v17 ) | |
1368 { | |
1369 if ( v17->prolly_head ) | |
1370 { | |
1371 v18 = v17->prolly_tail; | |
1372 if ( !v18 ) | |
1373 return; | |
1374 v18->pNext = v0; | |
1375 } | |
1376 else | |
1377 { | |
1378 v17->prolly_head = v0; | |
1379 } | |
1380 v17->prolly_tail = v0; | |
1381 } | |
1382 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1383 return; | |
1384 ++v0; | |
1385 ++pOutdoorCamera->uNumSpans; | |
1386 } | |
1387 v7->pNext->field_20 = (signed __int64)v15; | |
1388 v6 = v26; | |
1389 } | |
1390 v7->pNext->pPrev = v7->pPrev; | |
1391 v7->pPrev->pNext = v7->pNext; | |
1392 } | |
1393 } | |
1394 v26 = v6->pNext; | |
1395 if ( !v26 ) | |
1396 break; | |
1397 v6 = v6->pNext; | |
1398 } | |
1399 } | |
1400 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1401 { | |
1402 i->pPrev->pNext = i->pNext; | |
1403 i->pNext->pPrev = i->pPrev; | |
1404 } | |
1405 v20 = stru_80C9D8.pNext; | |
1406 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1407 break; | |
1408 LABEL_50: | |
1409 ++v27; | |
1410 v1 = v24 + 52; | |
1411 v24 += 52; | |
693 | 1412 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1413 goto LABEL_51; |
1414 } | |
1415 while ( 1 ) | |
1416 { | |
1417 v21 = v20->pNext; | |
1418 if ( !v21 ) | |
1419 break; | |
1420 v22 = v20->field_4 + v20->field_0; | |
1421 v20->field_0 = v22; | |
1422 if ( v22 < stru_80C9D8.field_0 ) | |
1423 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1424 while ( 1 ) | |
1425 { | |
1426 v23 = v20->pPrev; | |
1427 if ( v20->field_0 >= (double)v23->field_0 ) | |
1428 break; | |
1429 v23->pNext = v20->pNext; | |
1430 v20->pNext->pPrev = v23; | |
1431 v23->pPrev->pNext = v20; | |
1432 v20->pPrev = v23->pPrev; | |
1433 v20->pNext = v23; | |
1434 v23->pPrev = v20; | |
1435 } | |
1436 v20 = v21; | |
1437 if ( v21 == &stru_80C9A4 ) | |
1438 goto LABEL_50; | |
1439 } | |
1440 } | |
1441 } | |
1442 // 4EC3EC: using guessed type Edge defaultEdge; | |
1443 | |
1444 //----- (00487355) -------------------------------------------------------- | |
1445 bool OutdoorCamera::_487355() | |
1446 { | |
1447 int v0; // esi@1 | |
1448 stru148 *v1; // edi@2 | |
1449 bool result; // eax@3 | |
1450 | |
1451 v0 = 0; | |
1452 if ( pOutdoorCamera->numStru148s > 0 ) | |
1453 { | |
1454 v1 = array_77EC08; | |
1455 do | |
1456 { | |
1457 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1458 ++v0; | |
1459 ++v1; | |
1460 } | |
1461 while ( v0 < pOutdoorCamera->numStru148s ); | |
1462 } | |
1463 return result; | |
1464 } | |
1465 | |
1466 //----- (00487DA9) -------------------------------------------------------- | |
1467 void __cdecl sub_487DA9() | |
1468 { | |
1469 char *v0; // eax@1 | |
1470 | |
1471 v0 = &array_77EC08[0].field_108; | |
1472 do | |
1473 { | |
1474 *v0 = 0; | |
1475 v0 += 268; | |
1476 } | |
1477 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1478 } | |
1479 | |
1480 //----- (00487DBE) -------------------------------------------------------- | |
1481 void Software_ResetNewEdges() | |
1482 { | |
1483 int v0; // ecx@1 | |
1484 Edge **v1; // eax@1 | |
1485 signed int v2; // eax@3 | |
1486 | |
1487 v0 = 0; | |
1488 v1 = ptr_80CA10; | |
1489 do | |
1490 { | |
1491 ++v0; | |
1492 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1493 *v1 = 0; | |
1494 ++v1; | |
1495 } | |
1496 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1497 v2 = 2000; | |
1498 do | |
1499 { | |
1500 pSurfs->field_22 = 0; | |
1501 --v2; | |
1502 } | |
1503 while ( v2 ); | |
1504 } | |
1505 // 4EC3EC: using guessed type Edge defaultEdge; | |
1506 | |
1507 //----- (0048958E) -------------------------------------------------------- | |
1508 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1509 { | |
1510 stru12_MemoryBlock *v2; // esi@1 | |
1511 void *v3; // eax@1 | |
1512 void *v4; // ecx@1 | |
1513 stru12_MemoryBlock *result; // eax@1 | |
1514 | |
1515 v2 = this; | |
1516 v3 = operator new(8 * a2 + 16); | |
1517 v2->pBlockBase = v3; | |
848 | 1518 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1519 result = v2; |
1520 v2->pAlignedBlock = v4; | |
1521 } | |
1522 | |
1523 //----- (004895B7) -------------------------------------------------------- | |
1524 stru12::stru12(stru11 *pStru11) | |
1525 { | |
1526 stru12 *v2; // esi@1 | |
1527 | |
1528 v2 = this; | |
1529 this->field_44 = 0x41000000u; | |
1530 this->field_4C = 0x46000000u; | |
1531 //this->vdestructor_ptr = stru12::_4898E6; | |
1532 this->field_48 = 0; | |
1533 this->field_50 = 0; | |
1534 this->field_54 = 0x33D6BF95u; | |
1535 this->field_58 = 0; | |
1536 | |
1537 for (int i = 0; i < 12; ++i) | |
1538 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1539 /* | |
1540 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1541 if ( v3 ) | |
1542 v4 = AllocAlignedMem(v3, 640); | |
1543 else | |
1544 v4 = 0; | |
1545 v2->pMemBlocks[0] = v4; | |
1546 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1547 if ( v5 ) | |
1548 v6 = AllocAlignedMem(v5, 640); | |
1549 else | |
1550 v6 = 0; | |
1551 v2->pMemBlocks[1] = v6; | |
1552 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1553 if ( v7 ) | |
1554 v8 = AllocAlignedMem(v7, 640); | |
1555 else | |
1556 v8 = 0; | |
1557 v2->pMemBlocks[2] = v8; | |
1558 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1559 if ( v9 ) | |
1560 v10 = AllocAlignedMem(v9, 640); | |
1561 else | |
1562 v10 = 0; | |
1563 v2->pMemBlocks[3] = v10; | |
1564 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1565 if ( v11 ) | |
1566 v12 = AllocAlignedMem(v11, 640); | |
1567 else | |
1568 v12 = 0; | |
1569 v2->pMemBlocks[4] = v12; | |
1570 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1571 if ( v13 ) | |
1572 v14 = AllocAlignedMem(v13, 640); | |
1573 else | |
1574 v14 = 0; | |
1575 v2->pMemBlocks[5] = v14; | |
1576 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1577 if ( v15 ) | |
1578 v16 = AllocAlignedMem(v15, 640); | |
1579 else | |
1580 v16 = 0; | |
1581 v2->pMemBlocks[6] = v16; | |
1582 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1583 if ( v17 ) | |
1584 v18 = AllocAlignedMem(v17, 640); | |
1585 else | |
1586 v18 = 0; | |
1587 v2->pMemBlocks[7] = v18; | |
1588 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1589 if ( v19 ) | |
1590 v20 = AllocAlignedMem(v19, 640); | |
1591 else | |
1592 v20 = 0; | |
1593 v2->pMemBlocks[8] = v20; | |
1594 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1595 if ( v21 ) | |
1596 v22 = AllocAlignedMem(v21, 640); | |
1597 else | |
1598 v22 = 0; | |
1599 v2->pMemBlocks[9] = v22; | |
1600 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1601 if ( v23 ) | |
1602 v24 = AllocAlignedMem(v23, 640); | |
1603 else | |
1604 v24 = 0; | |
1605 v2->pMemBlocks[10] = v24; | |
1606 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1607 if ( v25 ) | |
1608 v26 = AllocAlignedMem(v25, 640); | |
1609 else | |
1610 v26 = 0; | |
1611 v2->field_8C = 0; | |
1612 v2->pMemBlocks[11] = v26;*/ | |
1613 } | |
1614 | |
1615 //----- (00489810) -------------------------------------------------------- | |
1616 stru12::~stru12() | |
1617 { | |
1618 for (int i = 0; i < 12; ++i) | |
1619 delete pMemBlocks[i]; | |
1620 /*if ( v2 ) | |
1621 stru12_MemoryBlock::dtor(v2, 1); | |
1622 v3 = v1->pMemBlocks[1]; | |
1623 if ( v3 ) | |
1624 stru12_MemoryBlock::dtor(v3, 1); | |
1625 v4 = v1->pMemBlocks[2]; | |
1626 if ( v4 ) | |
1627 stru12_MemoryBlock::dtor(v4, 1); | |
1628 v5 = v1->pMemBlocks[3]; | |
1629 if ( v5 ) | |
1630 stru12_MemoryBlock::dtor(v5, 1); | |
1631 v6 = v1->pMemBlocks[4]; | |
1632 if ( v6 ) | |
1633 stru12_MemoryBlock::dtor(v6, 1); | |
1634 v7 = v1->pMemBlocks[5]; | |
1635 if ( v7 ) | |
1636 stru12_MemoryBlock::dtor(v7, 1); | |
1637 v8 = v1->pMemBlocks[6]; | |
1638 if ( v8 ) | |
1639 stru12_MemoryBlock::dtor(v8, 1); | |
1640 v9 = v1->pMemBlocks[7]; | |
1641 if ( v9 ) | |
1642 stru12_MemoryBlock::dtor(v9, 1); | |
1643 v10 = v1->pMemBlocks[8]; | |
1644 if ( v10 ) | |
1645 stru12_MemoryBlock::dtor(v10, 1); | |
1646 v11 = v1->pMemBlocks[9]; | |
1647 if ( v11 ) | |
1648 stru12_MemoryBlock::dtor(v11, 1); | |
1649 v12 = v1->pMemBlocks[10]; | |
1650 if ( v12 ) | |
1651 stru12_MemoryBlock::dtor(v12, 1); | |
1652 v13 = v1->pMemBlocks[11]; | |
1653 if ( v13 ) | |
1654 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1655 } | |
1656 | |
1657 //----- (004898BF) -------------------------------------------------------- | |
1658 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1659 { | |
1660 stru12_MemoryBlock *v2; // esi@1 | |
1661 void *v3; // ST00_4@1 | |
1662 | |
1663 v2 = this; | |
1664 v3 = this->pBlockBase; | |
1665 this->pAlignedBlock = 0; | |
1666 free(v3); | |
1667 v2->pBlockBase = 0; | |
1668 /*if ( a2 & 1 ) | |
1669 free(v2);*/ | |
1670 } | |
1671 | |
1672 //----- (004898E6) -------------------------------------------------------- | |
1673 void stru12::_4898E6() | |
1674 { | |
1675 void *v1; // eax@1 | |
1676 void *v2; // edx@1 | |
1677 char *v3; // edi@2 | |
1678 double v4; // st7@2 | |
1679 char *v5; // ebx@2 | |
1680 double v6; // st6@3 | |
1681 double v7; // st5@3 | |
1682 double v8; // st4@3 | |
1683 int v9; // esi@3 | |
1684 double v10; // st3@3 | |
1685 float v11; // ST34_4@5 | |
1686 double v12; // st6@10 | |
1687 double v13; // ST0C_8@10 | |
1688 char *v14; // [sp+14h] [bp-44h]@2 | |
1689 char *v15; // [sp+18h] [bp-40h]@2 | |
1690 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1691 char *v17; // [sp+20h] [bp-38h]@2 | |
1692 char *v18; // [sp+24h] [bp-34h]@2 | |
1693 float v19; // [sp+30h] [bp-28h]@3 | |
1694 float v20; // [sp+38h] [bp-20h]@3 | |
1695 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1696 int v22; // [sp+40h] [bp-18h]@1 | |
1697 char *v23; // [sp+44h] [bp-14h]@2 | |
1698 char *v24; // [sp+48h] [bp-10h]@2 | |
1699 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1700 float v26; // [sp+50h] [bp-8h]@3 | |
1701 float v27; // [sp+54h] [bp-4h]@3 | |
1702 | |
731 | 1703 __debugbreak(); |
0 | 1704 v22 = 0; |
1705 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1706 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1707 if ( this->field_8C > 0 ) | |
1708 { | |
1709 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1710 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1711 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1712 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1713 v25 = (int)v1 - (int)v2; | |
1714 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1715 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1716 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1717 v4 = 1.0; | |
1718 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1719 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1720 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1721 do | |
1722 { | |
1723 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1724 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1725 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1726 v7 = pIndoorCamera->fRotationYCosine; | |
1727 v8 = pIndoorCamera->fRotationYSine; | |
1728 v20 = pIndoorCamera->fRotationXCosine; | |
1729 v19 = pIndoorCamera->fRotationXSine; | |
1730 v9 = (int)((char *)v2 + (int)v21); | |
1731 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1732 if ( pIndoorCamera->sRotationX ) | |
1733 { | |
1734 v11 = v10; | |
1735 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1736 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1737 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1738 } | |
1739 else | |
1740 { | |
1741 *(float *)v9 = v10; | |
1742 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1743 *(float *)((char *)v2 + (int)v5) = v6; | |
1744 } | |
1745 if ( *(float *)v9 >= 8.0 ) | |
1746 { | |
1747 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1748 { | |
1749 *(int *)v2 = 0; | |
1750 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1751 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1752 - v12 * *(float *)((char *)v2 + (int)v3); | |
1753 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1754 - v12 * *(float *)((char *)v2 + (int)v5); | |
1755 *(float *)((char *)v2 + (int)v16) = v4 | |
1756 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1757 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1758 v13 = *(float *)v9 + 6.7553994e15; | |
1759 v4 = 1.0; | |
1760 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1761 } | |
1762 else | |
1763 { | |
1764 *(int *)v2 = 2; | |
1765 } | |
1766 } | |
1767 else | |
1768 { | |
1769 *(int *)v2 = 1; | |
1770 } | |
1771 ++v22; | |
1772 v2 = (char *)v2 + 4; | |
1773 } | |
1774 while ( v22 < this->field_8C ); | |
1775 } | |
1776 this->field_8C = 0; | |
1777 } | |
1778 | |
1779 //----- (0048A959) -------------------------------------------------------- | |
1780 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1781 { | |
1782 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1783 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1784 b = (uColor & 0x000000FF) / 255.0f; | |
1785 | |
1786 float h, s, v; | |
1787 RGB2HSV(&h, &s, r, g, b, &v); | |
1788 | |
1789 if ( h_replace != -1.0 ) | |
1790 h = h_replace; | |
1791 if ( s_replace != -1.0 ) | |
1792 s = s_replace; | |
1793 if ( v_replace != -1.0 ) | |
1794 v = v_replace; | |
1795 HSV2RGB(&r, &g, &b, h, s, v); | |
1796 | |
1797 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1798 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1799 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1800 } | |
1801 | |
1802 //----- (0048B561) -------------------------------------------------------- | |
1803 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1804 { | |
1805 //v2 = a2 - 0.5; | |
1806 //v3 = v2 + 6.7553994e15; | |
1807 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1808 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1809 //v5 = v7 + 6.7553994e15; | |
1810 //return LODWORD(v5) | (v4 << 16); | |
1811 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1812 return v5 | (v4 << 16); | |
1813 } | |
1814 | |
1815 //----- (00491E3A) -------------------------------------------------------- | |
1816 void __cdecl sub_491E3A() | |
1817 { | |
1818 Player *v0; // ebx@1 | |
1819 signed int v1; // esi@3 | |
1820 char *v2; // eax@4 | |
1821 unsigned int v3; // eax@7 | |
1822 unsigned int v4; // edx@8 | |
1823 char *v5; // ecx@9 | |
1824 int v6; // edi@17 | |
1825 Texture *v7; // ebx@18 | |
1826 struct IDirect3DTexture2 **v8; // eax@19 | |
1827 struct IDirect3DTexture2 *v9; // eax@20 | |
1828 struct IDirectDrawSurface **v10; // eax@22 | |
1829 struct IDirectDrawSurface *v11; // eax@23 | |
1830 int v12; // eax@26 | |
1831 | |
1832 v0 = pParty->pPlayers; | |
1833 do | |
1834 { | |
203 | 1835 if (SoundSetAction[24][0]) |
0 | 1836 { |
1837 v1 = 0; | |
764 | 1838 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1839 { |
1840 LABEL_7: | |
1841 v3 = 0; | |
1842 } | |
1843 else | |
1844 { | |
1845 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1846 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1847 { |
1848 ++v1; | |
1849 v2 += 120; | |
764 | 1850 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1851 goto LABEL_7; |
1852 } | |
1853 v3 = v1; | |
1854 } | |
764 | 1855 pSoundList->UnloadSound(v3, 1); |
0 | 1856 v4 = 0; |
764 | 1857 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1858 { |
1859 LABEL_12: | |
1860 v4 = 0; | |
1861 } | |
1862 else | |
1863 { | |
1864 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1865 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1866 { |
1867 ++v4; | |
1868 v5 += 120; | |
764 | 1869 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1870 goto LABEL_12; |
1871 } | |
1872 } | |
764 | 1873 pSoundList->UnloadSound(v4, 1); |
0 | 1874 } |
1875 ++v0; | |
1876 } | |
1877 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1878 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1879 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1880 { |
1881 v7 = &pIcons_LOD->pTextures[v6]; | |
1882 do | |
1883 { | |
1884 v7->Release(); | |
1885 v8 = pIcons_LOD->pHardwareTextures; | |
1886 if ( v8 ) | |
1887 { | |
1888 v9 = v8[v6]; | |
1889 if ( v9 ) | |
1890 { | |
1891 v9->Release(); | |
1892 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1893 } | |
1894 } | |
1895 v10 = pIcons_LOD->pHardwareSurfaces; | |
1896 if ( v10 ) | |
1897 { | |
1898 v11 = v10[v6]; | |
1899 if ( v11 ) | |
1900 { | |
1901 v11->Release(); | |
1902 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1903 } | |
1904 } | |
1905 --v6; | |
1906 --v7; | |
1907 } | |
33 | 1908 while ( v6 >= pIcons_LOD->pFacesLock ); |
1909 } | |
1910 v12 = pIcons_LOD->pFacesLock; | |
1911 pIcons_LOD->pFacesLock = 0; | |
0 | 1912 pIcons_LOD->uNumLoadedFiles = v12; |
1913 } | |
1914 // 4ED498: using guessed type char byte_4ED498; | |
1915 | |
1916 //----- (0049387A) -------------------------------------------------------- | |
1917 int CycleCharacter(unsigned int _this) | |
1918 { | |
1919 signed int result; // eax@1 | |
1920 signed int v2; // ecx@2 | |
1921 signed int v3; // ecx@8 | |
1922 | |
1923 result = uActiveCharacter; | |
1924 if ( _this ) | |
1925 { | |
1926 v2 = 0; | |
1927 while ( 1 ) | |
1928 { | |
1929 --result; | |
1930 if ( result < 1 ) | |
1931 result = 4; | |
1932 if ( !pPlayers[result]->uTimeToRecovery ) | |
1933 break; | |
1934 ++v2; | |
1935 if ( v2 >= 4 ) | |
1936 return uActiveCharacter; | |
1937 } | |
1938 } | |
1939 else | |
1940 { | |
1941 v3 = 0; | |
1942 while ( 1 ) | |
1943 { | |
1944 ++result; | |
1945 if ( result > 4 ) | |
1946 result = 1; | |
1947 if ( !pPlayers[result]->uTimeToRecovery ) | |
1948 break; | |
1949 ++v3; | |
1950 if ( v3 >= 4 ) | |
1951 return uActiveCharacter; | |
1952 } | |
1953 } | |
1954 return result; | |
1955 } | |
1956 | |
1957 //----- (004938D1) -------------------------------------------------------- | |
1958 void __fastcall Rest(unsigned int uHoursToSleep) | |
1959 { | |
1960 unsigned int v1; // esi@1 | |
1961 double v2; // st7@3 | |
1962 Player **v3; // esi@3 | |
1963 | |
1964 v1 = uHoursToSleep; | |
1965 if ( uHoursToSleep > 240 ) | |
1966 InitializeActors(); | |
1967 v2 = (double)(7680 * v1) * 0.033333335; | |
1968 pParty->uTimePlayed += (signed __int64)v2; | |
1969 v3 = &pPlayers[1]; | |
1970 do | |
1971 { | |
1972 (*v3)->Recover((signed __int64)v2); | |
1973 ++v3; | |
1974 } | |
1975 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1976 _494035_timed_effects__water_walking_damage__etc(); | |
1977 } | |
1978 | |
1979 //----- (00493938) -------------------------------------------------------- | |
1980 int __cdecl _493938_regenerate() | |
1981 { | |
1982 int v0; // edi@1 | |
1983 signed __int64 v1; // qax@1 | |
1984 int v2; // ecx@1 | |
1985 int result; // eax@1 | |
1986 int v4; // eax@2 | |
1987 int v5; // edi@5 | |
112 | 1988 int *v6; // ecx@5 |
0 | 1989 char v7; // sf@5 |
112 | 1990 int *v8; // ecx@10 |
0 | 1991 int v9; // edi@15 |
1992 signed int v10; // eax@15 | |
1993 __int16 *v11; // edx@16 | |
1994 int v12; // eax@20 | |
1995 int v13; // ebx@20 | |
1996 unsigned int *v14; // esi@21 | |
1997 unsigned int v15; // ecx@21 | |
1998 unsigned int v16; // eax@21 | |
1999 int v17; // edx@21 | |
2000 int v18; // eax@21 | |
2001 signed int v19; // eax@21 | |
2002 signed int v20; // ebx@25 | |
2003 Player *v21; // esi@25 | |
2004 ITEM_EQUIP_TYPE v22; // edi@30 | |
2005 //int v23; // edx@31 | |
2006 signed int v24; // ecx@32 | |
2007 signed int v25; // eax@33 | |
2008 int v26; // eax@35 | |
2009 int v27; // eax@36 | |
2010 int v28; // eax@37 | |
2011 int v29; // eax@40 | |
2012 int v30; // eax@41 | |
2013 signed int v31; // ecx@53 | |
2014 char *v32; // eax@53 | |
2015 char *v33; // edi@82 | |
2016 int v34; // ecx@88 | |
2017 int v35; // eax@88 | |
2018 char *v36; // edi@99 | |
2019 int v37; // edi@104 | |
2020 int v38; // edi@106 | |
2021 int v39; // edi@111 | |
2022 int v40; // ecx@113 | |
2023 char v41[400]; // [sp+4h] [bp-22Ch]@20 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2024 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2025 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2026 int v44; // [sp+210h] [bp-20h]@22 | |
2027 int v45; // [sp+214h] [bp-1Ch]@25 | |
2028 int v46; // [sp+218h] [bp-18h]@25 | |
2029 int v47; // [sp+21Ch] [bp-14h]@25 | |
2030 int v48; // [sp+220h] [bp-10h]@25 | |
2031 int v49; // [sp+224h] [bp-Ch]@24 | |
2032 int v50; // [sp+228h] [bp-8h]@25 | |
2033 int v51; // [sp+22Ch] [bp-4h]@2 | |
2034 | |
2035 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2036 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2037 v2 = (signed int)v1 / 60; | |
2038 result = (signed int)v1 / 60 + 5; | |
2039 if ( v0 >= result ) | |
2040 { | |
2041 v51 = 0; | |
2042 v4 = (v0 - v2) / 5; | |
2043 if (pParty->FlyActive()) | |
2044 { | |
2045 if ( pParty->bFlying ) | |
2046 { | |
569 | 2047 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2048 { // colliding with something in the air - fall down | |
2049 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2050 //__debugbreak(); | |
2051 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2052 v7 = *v6 < v5; |
2053 *v6 -= v5; | |
0 | 2054 if ( v7 ) |
2055 { | |
112 | 2056 *v6 = 0; |
0 | 2057 pParty->uFlags &= 0xFFFFFFBFu; |
2058 pParty->bFlying = 0; | |
2059 v51 = 1; | |
2060 } | |
2061 } | |
2062 } | |
2063 } | |
569 | 2064 |
0 | 2065 if (pParty->WaterWalkActive()) |
2066 { | |
569 | 2067 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2068 { | |
2069 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2070 { // taking on water | |
2071 //__debugbreak(); | |
2072 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2073 v7 = *v8 < v4; |
2074 *v8 -= v4; | |
0 | 2075 if ( v7 ) |
2076 { | |
112 | 2077 *v8 = 0; |
569 | 2078 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2079 v51 = 1; |
2080 } | |
2081 } | |
2082 } | |
2083 } | |
569 | 2084 |
0 | 2085 if (pParty->ImmolationActive()) |
2086 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2087 //SpriteObject::SpriteObject(&a1); |
0 | 2088 v9 = 0; |
2089 a3.z = 0; | |
2090 a3.y = 0; | |
2091 a3.x = 0; | |
2092 a1.stru_24.Reset(); | |
822 | 2093 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2094 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2095 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2096 a1.uType = 1070; |
822 | 2097 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2098 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2099 { | |
2100 LABEL_19: | |
2101 LOWORD(v10) = 0; | |
2102 } | |
2103 else | |
2104 { | |
2105 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2106 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2107 { |
2108 ++v10; | |
2109 v11 += 28; | |
2110 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2111 goto LABEL_19; | |
2112 } | |
2113 } | |
2114 a1.uObjectDescID = v10; | |
2115 a1.field_60_distance_related_prolly_lod = 0; | |
2116 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2117 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2118 a1.uAttributes = 0; |
2119 a1.uSectorID = 0; | |
2120 a1.uSpriteFrameID = 0; | |
822 | 2121 a1.spell_caster_pid = v12; |
0 | 2122 a1.uFacing = 0; |
2123 a1.uSoundID = 0; | |
2124 v13 = sub_46A89E((int)v41, 100, 307); | |
2125 if ( v13 > 0 ) | |
2126 { | |
2127 do | |
2128 { | |
2129 v14 = (unsigned int *)&v41[4 * v9]; | |
2130 v15 = *v14; | |
2131 v16 = *v14; | |
2132 a1.vPosition.x = pActors[v16].vPosition.x; | |
2133 v17 = pActors[v16].vPosition.y; | |
2134 a1.vPosition.z = pActors[v16].vPosition.z; | |
2135 v18 = 8 * v15; | |
862 | 2136 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2137 a1.vPosition.y = v17; |
823 | 2138 a1.spell_target_pid = v18; |
0 | 2139 v19 = a1.Create(0, 0, 0, 0); |
862 | 2140 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2141 ++v9; |
2142 } | |
2143 while ( v9 < v13 ); | |
2144 } | |
2145 } | |
2146 v44 = 0; | |
248 | 2147 if (PartyHasDragon()) |
0 | 2148 v44 = 1; |
2149 v49 = 0; | |
2150 LABEL_25: | |
2151 v20 = 0; | |
2152 v21 = &pParty->pPlayers[v49]; | |
2153 v50 = 0; | |
2154 v47 = 0; | |
2155 v45 = 0; | |
2156 v48 = 0; | |
2157 v46 = 0; | |
255 | 2158 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2159 v50 = 1; |
135 | 2160 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2161 v48 = 1; |
2162 v22 = (ITEM_EQUIP_TYPE)0; | |
2163 while ( 1 ) | |
2164 { | |
2165 if ( v21->HasItemEquipped(v22) ) | |
2166 { | |
2167 //v23 = v21->pEquipment.pIndices; | |
2168 auto _idx = v21->pEquipment.pIndices[v22]; | |
2169 v24 = v21->pInventoryItems[_idx].uItemID; | |
2170 if ( v24 > 134 ) | |
2171 { | |
2172 if ( v24 == 529 ) | |
2173 goto LABEL_43; | |
2174 if ( v24 == 535 ) | |
2175 goto LABEL_44; | |
2176 if ( v24 == 515 ) | |
2177 { | |
2178 v47 = 1; | |
2179 } | |
2180 else | |
2181 { | |
2182 if ( v24 == 532 ) | |
2183 goto LABEL_50; | |
2184 } | |
2185 } | |
2186 else | |
2187 { | |
377 | 2188 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2189 if ( v25 <= 50 ) |
2190 { | |
2191 if ( v25 != 50 ) | |
2192 { | |
2193 v26 = v25 - 37; | |
2194 if ( v26 ) | |
2195 { | |
2196 v27 = v26 - 1; | |
2197 if ( !v27 ) | |
2198 goto LABEL_50; | |
2199 v28 = v27 - 6; | |
2200 if ( v28 ) | |
2201 { | |
2202 if ( v28 != 3 ) | |
2203 goto LABEL_51; | |
2204 LABEL_50: | |
2205 v50 = 1; | |
2206 goto LABEL_51; | |
2207 } | |
2208 } | |
2209 } | |
2210 LABEL_44: | |
2211 v20 = 1; | |
2212 goto LABEL_51; | |
2213 } | |
2214 v29 = v25 - 54; | |
2215 if ( !v29 ) | |
2216 goto LABEL_44; | |
2217 v30 = v29 - 1; | |
2218 if ( !v30 ) | |
2219 goto LABEL_50; | |
2220 if ( v30 == 11 ) | |
2221 { | |
2222 LABEL_43: | |
2223 v20 = 1; | |
2224 v50 = 1; | |
2225 goto LABEL_51; | |
2226 } | |
2227 } | |
2228 } | |
2229 LABEL_51: | |
2230 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2231 if ( (signed int)v22 >= 16 ) | |
2232 { | |
2233 if ( v48 ) | |
2234 { | |
2235 v31 = 0; | |
2236 v32 = (char *)v21->pInventoryItems; | |
2237 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2238 { | |
2239 ++v31; | |
2240 v32 += 36; | |
2241 if ( v31 >= 138 ) | |
2242 goto LABEL_59; | |
2243 } | |
2244 v48 = 0; | |
2245 v45 = 1; | |
2246 } | |
2247 LABEL_59: | |
2248 if ( v21->pConditions[17] ) | |
2249 v46 = 1; | |
2250 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2251 { | |
2252 ++v21->sHealth; | |
2253 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2254 v21->sHealth = v21->GetMaxHealth(); | |
2255 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2256 { | |
2257 LODWORD(v21->pConditions[13]) = 0; | |
2258 HIDWORD(v21->pConditions[13]) = 0; | |
2259 } | |
2260 v51 = 1; | |
2261 } | |
2262 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2263 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2264 && !v21->pConditions[14] | |
2265 && !v21->pConditions[16] ) | |
2266 { | |
2267 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2268 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2269 v21->sHealth = v21->GetMaxHealth(); | |
2270 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2271 { | |
2272 LODWORD(v21->pConditions[13]) = 0; | |
2273 HIDWORD(v21->pConditions[13]) = 0; | |
2274 } | |
2275 v51 = 1; | |
2276 } | |
2277 if ( v50 ) | |
2278 { | |
2279 v33 = (char *)&v21->sMana; | |
2280 ++*(int *)v33; | |
2281 if ( v21->sMana > v21->GetMaxMana() ) | |
2282 *(int *)v33 = v21->GetMaxMana(); | |
2283 v51 = 1; | |
2284 } | |
2285 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2286 { | |
2287 v34 = LODWORD(v21->pConditions[13]); | |
2288 --v21->sHealth; | |
2289 v35 = v21->sHealth; | |
2290 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2291 v21->pConditions[13] = pParty->uTimePlayed; | |
2292 if ( v35 < 1 ) | |
2293 { | |
2294 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2295 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2296 { | |
2297 v21->pConditions[13] = pParty->uTimePlayed; | |
2298 } | |
2299 else | |
2300 { | |
2301 if ( !v21->pConditions[14] ) | |
2302 v21->pConditions[14] = pParty->uTimePlayed; | |
2303 } | |
2304 } | |
2305 v51 = 1; | |
2306 } | |
2307 if ( v45 ) | |
2308 { | |
2309 v36 = (char *)&v21->sMana; | |
2310 ++*(int *)v36; | |
2311 if ( v21->sMana > v21->GetMaxMana() ) | |
2312 *(int *)v36 = v21->GetMaxMana(); | |
2313 } | |
2314 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2315 { | |
2316 v37 = v21->sHealth; | |
2317 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2318 v21->sHealth = v37 - 2; | |
2319 v38 = v21->sMana; | |
2320 if ( v38 > v21->GetMaxMana() / 2 ) | |
2321 v21->sMana = v38 - 2; | |
2322 } | |
2323 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2324 { | |
2325 v39 = v21->sHealth; | |
2326 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2327 v21->sHealth = v39 - 1; | |
2328 v40 = v21->sMana; | |
2329 if ( v40 > 0 ) | |
2330 v21->sMana = v40 - 1; | |
2331 } | |
2332 ++v49; | |
2333 if ( v49 >= 4 ) | |
2334 { | |
2335 result = HIDWORD(pParty->uTimePlayed); | |
2336 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2337 if ( !viewparams->bRedrawGameUI ) | |
2338 { | |
2339 result = v51; | |
2340 viewparams->bRedrawGameUI = v51; | |
2341 } | |
2342 return result; | |
2343 } | |
2344 goto LABEL_25; | |
2345 } | |
2346 } | |
2347 } | |
2348 return result; | |
2349 } | |
2350 | |
2351 //----- (00493F79) -------------------------------------------------------- | |
351 | 2352 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2353 { |
2354 signed __int64 v2; // ST2C_8@1 | |
2355 signed __int64 v3; // qax@1 | |
351 | 2356 //signed __int64 v4; // ST1C_8@1 |
0 | 2357 unsigned __int64 v5; // qax@1 |
2358 unsigned int v6; // ebx@1 | |
2359 | |
2360 v2 = (signed __int64)((double)a2 * 0.234375); | |
2361 v3 = v2 / 60 / 60; | |
351 | 2362 //v4 = v3; |
0 | 2363 v5 = (unsigned int)v3 / 0x18; |
2364 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2365 _this->field_0_expire_second = v2 % 60; |
2366 _this->field_4_expire_minute = v2 / 60 % 60; | |
2367 _this->field_8_expire_hour = v3 % 24; | |
2368 _this->field_10_expire_week = v5 / 7 & 3; | |
2369 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2370 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2371 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2372 } |
2373 | |
2374 //----- (00494035) -------------------------------------------------------- | |
2375 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2376 { | |
2377 signed __int64 v0; // qax@1 | |
2378 signed __int64 v1; // ST30_8@1 | |
2379 signed __int64 v2; // ST38_8@1 | |
2380 unsigned __int64 v3; // qax@1 | |
2381 unsigned int v4; // edi@1 | |
2382 //signed int v5; // eax@4 | |
2383 //char *v6; // ecx@5 | |
2384 //Player *v7; // esi@8 | |
2385 //char *v8; // ecx@12 | |
766 | 2386 //Player *pPlayer; // esi@15 |
0 | 2387 //void *v10; // esi@25 |
2388 unsigned int v11; // ecx@27 | |
2389 signed int v12; // edi@29 | |
2390 Player *v13; // ecx@30 | |
2391 Player *v14; // esi@35 | |
2392 double v15; // st7@35 | |
2393 Player **v16; // esi@43 | |
2394 Player *v17; // edi@44 | |
2395 double v18; // st7@44 | |
816 | 2396 //float v19; // ST28_4@48 |
2397 //double v20; // ST38_8@48 | |
0 | 2398 Player *v21; // esi@51 |
2399 signed int v22; // edi@53 | |
2400 int v23; // eax@59 | |
2401 int v24; // ecx@60 | |
2402 int v25; // eax@63 | |
2403 int v26; // ecx@64 | |
2404 int v27; // eax@67 | |
2405 int v28; // ecx@68 | |
2406 int v29; // eax@71 | |
2407 int v30; // ecx@72 | |
2408 int v31; // eax@75 | |
2409 int v32; // ecx@76 | |
2410 int v33; // eax@79 | |
2411 int v34; // ecx@80 | |
2412 int v35; // eax@83 | |
2413 int v36; // ecx@84 | |
2414 int v37; // eax@87 | |
2415 int v38; // ecx@88 | |
2416 int v39; // eax@91 | |
2417 int v40; // ecx@92 | |
2418 int v41; // eax@95 | |
2419 int v42; // ecx@96 | |
2420 bool v43; // ebx@102 | |
2421 //SpellBuff *v44; // edi@104 | |
2422 //signed int v45; // ebp@104 | |
2423 bool v46; // edi@111 | |
2424 //SpellBuff *v47; // esi@113 | |
2425 //Player **v48; // esi@119 | |
2426 //signed int v49; // edi@121 | |
2427 //char *v50; // esi@122 | |
2428 signed int v51; // edx@128 | |
2429 signed int v52; // ecx@130 | |
2430 int v53; // eax@131 | |
2431 Player *v54; // eax@141 | |
766 | 2432 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2433 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2434 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2435 int v58; // [sp-4h] [bp-34h]@33 |
2436 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2437 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2438 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2439 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2440 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2441 signed int a2a; // [sp+18h] [bp-18h]@47 |
2442 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2443 | |
766 | 2444 //a2 = pParty->uCurrentHour; |
0 | 2445 v61 = pParty->uDaysPlayed; |
816 | 2446 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2447 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2448 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2449 v1 = v0; |
2450 v0 /= 60i64; | |
2451 v2 = v0; | |
2452 v3 = (unsigned int)v0 / 24; | |
2453 v4 = (unsigned int)(v3 / 7) >> 2; | |
2454 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2455 pParty->uCurrentMinute = v1 % 60; | |
2456 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2457 pParty->uCurrentHour = v2 % 24; | |
2458 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2459 pParty->uCurrentMonth = v4 % 12; | |
352 | 2460 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2461 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2462 { |
2463 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2464 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2465 | |
2466 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2467 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2468 | |
766 | 2469 ++pParty->days_played_without_rest; |
2470 if (pParty->days_played_without_rest > 1) | |
0 | 2471 { |
2472 for (uint i = 0; i < 4; ++i) | |
766 | 2473 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2474 | |
2475 if (pParty->uNumFoodRations) | |
2476 Party::TakeFood(1); | |
0 | 2477 else |
2478 for (uint i = 0; i < 4; ++i) | |
766 | 2479 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2480 | |
2481 if (pParty->days_played_without_rest > 3) | |
2482 for (uint i = 0; i < 4; ++i) | |
0 | 2483 { |
766 | 2484 auto player = pParty->pPlayers + i; |
2485 | |
2486 player->Zero(); | |
2487 | |
2488 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2489 { |
767 | 2490 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2491 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2492 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2493 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2494 } |
2495 } | |
766 | 2496 } |
2497 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2498 pOutdoor->SetFog(); |
2499 | |
2500 for (uint i = 0; i < 4; ++i) | |
2501 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2502 } | |
766 | 2503 |
0 | 2504 v11 = LODWORD(pParty->uTimePlayed); |
2505 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2506 { | |
2507 v12 = 1; | |
2508 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2509 viewparams->bRedrawGameUI = 1; | |
2510 while ( 1 ) | |
2511 { | |
2512 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2513 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2514 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2515 { |
2516 v58 = 0; | |
2517 } | |
2518 else | |
2519 { | |
2520 v58 = 0; | |
2521 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2522 { | |
2523 v14 = pPlayers[v12]; | |
2524 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2525 v14->ReceiveDamage((signed __int64)v15, 0); | |
2526 if ( pParty->uFlags & 4 ) | |
2527 { | |
783 | 2528 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2529 GameUI_Footer_TimeLeft = 128; | |
0 | 2530 } |
2531 goto LABEL_39; | |
2532 } | |
2533 v13 = pPlayers[v12]; | |
2534 } | |
130 | 2535 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2536 LABEL_39: |
2537 ++v12; | |
2538 if ( v12 > 4 ) | |
2539 { | |
2540 v11 = LODWORD(pParty->uTimePlayed); | |
2541 break; | |
2542 } | |
2543 } | |
2544 } | |
2545 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2546 { | |
2547 viewparams->bRedrawGameUI = 1; | |
2548 pParty->field_6FC = v11 + 128; | |
2549 v16 = &pPlayers[1]; | |
2550 do | |
2551 { | |
2552 v17 = *v16; | |
2553 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2554 v17->ReceiveDamage((signed __int64)v18, 0); | |
2555 if ( pParty->uFlags & 0x200 ) | |
2556 { | |
783 | 2557 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2558 GameUI_Footer_TimeLeft = 128; | |
0 | 2559 } |
2560 ++v16; | |
2561 } | |
2562 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2563 } | |
2564 _493938_regenerate(); | |
2565 v65 = 4; | |
816 | 2566 a2a = pEventTimer->uTimeElapsed; |
2567 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2568 { | |
2569 //v19 = (double)(signed int)prev_time * 0.5; | |
2570 //v20 = v19 + 6.7553994e15; | |
2571 a2a *= 0.5f; | |
2572 if (a2a < 1) | |
0 | 2573 a2a = 1; |
2574 } | |
2575 v62 = &pPlayers[1]; | |
2576 do | |
2577 { | |
2578 v21 = *v62; | |
2579 if ( (*v62)->uTimeToRecovery ) | |
2580 v21->Recover(a2a); | |
2581 v22 = v21->sHealth; | |
2582 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2583 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2584 { | |
2585 if ( v22 >= 1 ) | |
2586 goto LABEL_59; | |
2587 v59 = 0; | |
2588 v56 = 13; | |
2589 } | |
2590 else | |
2591 { | |
2592 v59 = 0; | |
2593 v56 = 14; | |
2594 } | |
2595 v21->SetCondition(v56, v59); | |
2596 LABEL_59: | |
2597 v23 = (int)&v21->field_E0; | |
2598 if ( v21->field_E0 ) | |
2599 { | |
816 | 2600 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2601 if ( v24 > 0 ) |
2602 { | |
2603 *(int *)v23 = v24; | |
2604 } | |
2605 else | |
2606 { | |
2607 *(int *)v23 = 0; | |
2608 viewparams->bRedrawGameUI = 1; | |
2609 } | |
2610 } | |
2611 v25 = (int)&v21->field_E4; | |
2612 if ( v21->field_E4 ) | |
2613 { | |
816 | 2614 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2615 if ( v26 > 0 ) |
2616 { | |
2617 *(int *)v25 = v26; | |
2618 } | |
2619 else | |
2620 { | |
2621 *(int *)v25 = 0; | |
2622 viewparams->bRedrawGameUI = 1; | |
2623 } | |
2624 } | |
2625 v27 = (int)&v21->field_E8; | |
2626 if ( v21->field_E8 ) | |
2627 { | |
816 | 2628 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2629 if ( v28 > 0 ) |
2630 { | |
2631 *(int *)v27 = v28; | |
2632 } | |
2633 else | |
2634 { | |
2635 *(int *)v27 = 0; | |
2636 viewparams->bRedrawGameUI = 1; | |
2637 } | |
2638 } | |
2639 v29 = (int)&v21->field_EC; | |
2640 if ( v21->field_EC ) | |
2641 { | |
816 | 2642 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2643 if ( v30 > 0 ) |
2644 { | |
2645 *(int *)v29 = v30; | |
2646 } | |
2647 else | |
2648 { | |
2649 *(int *)v29 = 0; | |
2650 viewparams->bRedrawGameUI = 1; | |
2651 } | |
2652 } | |
2653 v31 = (int)&v21->field_F0; | |
2654 if ( v21->field_F0 ) | |
2655 { | |
816 | 2656 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2657 if ( v32 > 0 ) |
2658 { | |
2659 *(int *)v31 = v32; | |
2660 } | |
2661 else | |
2662 { | |
2663 *(int *)v31 = 0; | |
2664 viewparams->bRedrawGameUI = 1; | |
2665 } | |
2666 } | |
2667 v33 = (int)&v21->field_F4; | |
2668 if ( v21->field_F4 ) | |
2669 { | |
816 | 2670 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2671 if ( v34 > 0 ) |
2672 { | |
2673 *(int *)v33 = v34; | |
2674 } | |
2675 else | |
2676 { | |
2677 *(int *)v33 = 0; | |
2678 viewparams->bRedrawGameUI = 1; | |
2679 } | |
2680 } | |
2681 v35 = (int)&v21->field_F8; | |
2682 if ( v21->field_F8 ) | |
2683 { | |
816 | 2684 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2685 if ( v36 > 0 ) |
2686 { | |
2687 *(int *)v35 = v36; | |
2688 } | |
2689 else | |
2690 { | |
2691 *(int *)v35 = 0; | |
2692 viewparams->bRedrawGameUI = 1; | |
2693 } | |
2694 } | |
2695 v37 = (int)&v21->field_FC; | |
2696 if ( v21->field_FC ) | |
2697 { | |
816 | 2698 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2699 if ( v38 > 0 ) |
2700 { | |
2701 *(int *)v37 = v38; | |
2702 } | |
2703 else | |
2704 { | |
2705 *(int *)v37 = 0; | |
2706 viewparams->bRedrawGameUI = 1; | |
2707 } | |
2708 } | |
2709 v39 = (int)&v21->field_100; | |
2710 if ( v21->field_100 ) | |
2711 { | |
816 | 2712 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2713 if ( v40 > 0 ) |
2714 { | |
2715 *(int *)v39 = v40; | |
2716 } | |
2717 else | |
2718 { | |
2719 *(int *)v39 = 0; | |
2720 viewparams->bRedrawGameUI = 1; | |
2721 } | |
2722 } | |
2723 v41 = (int)&v21->field_104; | |
2724 if ( v21->field_104 ) | |
2725 { | |
816 | 2726 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2727 if ( v42 > 0 ) |
2728 { | |
2729 *(int *)v41 = v42; | |
2730 } | |
2731 else | |
2732 { | |
2733 *(int *)v41 = 0; | |
2734 viewparams->bRedrawGameUI = 1; | |
2735 } | |
2736 } | |
2737 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2738 --v65; | |
2739 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2740 | |
2741 for (uint k = 0; k < 24; ++k) | |
2742 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2743 | |
2744 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2745 v21->SetCondition(1u, 0); | |
2746 ++v62; | |
2747 } | |
2748 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2749 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2750 | |
2751 for (uint i = 0; i < 20; ++i) | |
2752 { | |
2753 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2754 viewparams->bRedrawGameUI = 1; | |
2755 } | |
2756 | |
2757 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2758 { | |
2759 for (uint i = 0; i < 4; ++i) | |
2760 pParty->pPlayers[i].SetCondition(1, 0); | |
2761 } | |
2762 | |
2763 for (uint i = 0; i < 2; ++i) | |
2764 { | |
2765 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2766 if (pBuf->uExpireTime == 0) | |
2767 continue; | |
2768 | |
2769 if ( !(pBuf->uFlags & 1) ) | |
2770 { | |
2771 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2772 { | |
2773 pBuf->Reset(); | |
2774 if (dword_4EE07C[i] == 7 ) | |
2775 pParty->bFlying = false; | |
2776 } | |
2777 } | |
2778 } | |
2779 | |
2780 v51 = v65; | |
2781 if ( v65 ) | |
2782 goto LABEL_135; | |
151 | 2783 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2784 { |
2785 v52 = (signed int)&pPlayers[1]; | |
2786 while ( 1 ) | |
2787 { | |
2788 v53 = *(int *)v52; | |
2789 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2790 break; | |
2791 v52 += 4; | |
2792 if ( v52 > (signed int)&pPlayers[4] ) | |
2793 goto LABEL_135; | |
2794 } | |
2795 *(int *)(v53 + 16) = 0; | |
2796 *(int *)(v53 + 20) = 0; | |
2797 v51 = 1; | |
2798 LABEL_135: | |
151 | 2799 if ( pCurrentScreen != SCREEN_REST |
0 | 2800 && (!v51 || dword_5C35C0) ) |
2801 uGameState = 8; | |
2802 } | |
2803 if ( uActiveCharacter ) | |
2804 { | |
151 | 2805 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2806 { |
2807 v54 = pPlayers[uActiveCharacter]; | |
2808 if ( v54->pConditions[2] | |
2809 || v54->pConditions[12] | |
2810 || v54->pConditions[13] | |
2811 || v54->pConditions[14] | |
2812 || v54->pConditions[15] | |
2813 || v54->pConditions[16] ) | |
2814 { | |
2815 viewparams->bRedrawGameUI = 1; | |
2816 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2817 } | |
2818 } | |
2819 } | |
2820 } | |
2821 | |
2822 //----- (00494820) -------------------------------------------------------- | |
758 | 2823 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2824 { |
2825 signed int v1; // eax@1 | |
2826 | |
2827 v1 = 5; | |
758 | 2828 if ( a1 % 24 >= 5 ) |
0 | 2829 v1 = 29; |
758 | 2830 return v1 - a1 % 24; |
0 | 2831 } |
2832 | |
2833 //----- (00494836) -------------------------------------------------------- | |
2834 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2835 { | |
2836 int v3; // esi@1 | |
2837 int result; // eax@1 | |
2838 stru339_spell_sound *v5; // ebx@1 | |
2839 int *v6; // edi@2 | |
2840 unsigned int v7; // eax@3 | |
2841 int v8; // [sp+Ch] [bp-8h]@3 | |
2842 int v9; // [sp+10h] [bp-4h]@2 | |
2843 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2844 | |
2845 v3 = 0; | |
2846 result = word_4EE088_sound_ids[uSoundID]; | |
2847 v5 = this; | |
2848 a2a = word_4EE088_sound_ids[uSoundID]; | |
2849 if ( result ) | |
2850 { | |
2851 v9 = 0; | |
2852 v6 = this->pSoundsOffsets; | |
2853 do | |
2854 { | |
2855 v7 = a2a++; | |
2856 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2857 if ( !result ) | |
2858 break; | |
2859 a6 += 4; | |
2860 result = v8 + 256; | |
2861 *v6 = v3; | |
2862 v3 += result; | |
2863 ++v9; | |
2864 *(v6 - 2) = result; | |
2865 ++v6; | |
2866 } | |
2867 while ( v9 < 2 ); | |
2868 } | |
2869 return result; | |
2870 } | |
2871 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2872 | |
2873 //----- (00494AED) -------------------------------------------------------- | |
130 | 2874 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2875 { |
2876 unsigned int _uNumFrames; // edx@1 | |
2877 unsigned int result; // eax@1 | |
2878 PlayerFrame *v4; // ecx@2 | |
2879 | |
2880 _uNumFrames = this->uNumFrames; | |
2881 result = 0; | |
2882 if ( (signed int)this->uNumFrames <= 0 ) | |
2883 { | |
2884 LABEL_5: | |
2885 result = 0; | |
2886 } | |
2887 else | |
2888 { | |
2889 v4 = this->pFrames; | |
130 | 2890 while ( v4->expression != expression ) |
0 | 2891 { |
2892 ++result; | |
2893 ++v4; | |
2894 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2895 goto LABEL_5; | |
2896 } | |
2897 } | |
2898 return result; | |
2899 } | |
2900 | |
2901 //----- (00494B10) -------------------------------------------------------- | |
2902 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2903 { | |
2904 unsigned int v3; // esi@1 | |
2905 PlayerFrame *v4; // edi@1 | |
2906 PlayerFrame *v5; // ecx@1 | |
2907 __int16 v6; // dx@2 | |
2908 int v7; // edx@3 | |
2909 char *i; // eax@3 | |
2910 int v9; // ecx@5 | |
2911 PlayerFrame *result; // eax@6 | |
2912 | |
2913 v3 = uFramesetID; | |
2914 v4 = this->pFrames; | |
2915 v5 = &v4[uFramesetID]; | |
2916 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2917 { | |
2918 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2919 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2920 { | |
2921 v9 = *(short *)i; | |
2922 if ( v7 <= v9 ) | |
2923 break; | |
2924 v7 -= v9; | |
2925 ++v3; | |
2926 } | |
2927 result = &v4[v3]; | |
2928 } | |
2929 else | |
2930 { | |
2931 result = &v4[uFramesetID]; | |
2932 } | |
2933 return result; | |
2934 } | |
2935 | |
2936 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2937 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2938 { |
2939 PlayerFrameTable *v4; // edi@1 | |
2940 int v5; // esi@1 | |
2941 int v6; // eax@2 | |
2942 | |
2943 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2944 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2945 if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime ) |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2946 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2947 *pAnimTime = v5; |
0 | 2948 } |
2949 else | |
2950 { | |
2951 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2952 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2953 *pAnimTime = 8 * v5 % v4->pFrames[v6].uAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2954 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2955 return &v4->pFrames[*pFramesetID]; |
0 | 2956 } |
2957 | |
2958 //----- (00494BC3) -------------------------------------------------------- | |
2959 void PlayerFrameTable::ToFile() | |
2960 { | |
2961 PlayerFrameTable *v1; // esi@1 | |
2962 FILE *v2; // eax@1 | |
2963 FILE *v3; // edi@1 | |
2964 | |
2965 auto Str = this; | |
2966 | |
2967 v1 = Str; | |
2968 v2 = fopen("data\\dpft.bin", "wb"); | |
2969 v3 = v2; | |
2970 if ( !v2 ) | |
2971 Abortf("Unable to save dpft.bin!"); | |
2972 fwrite(v1, 4u, 1u, v2); | |
2973 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2974 fclose(v3); | |
2975 } | |
2976 | |
2977 //----- (00494C0F) -------------------------------------------------------- | |
2978 void PlayerFrameTable::FromFile(void *pSerialized) | |
2979 { | |
2980 uNumFrames = *(int *)pSerialized; | |
2981 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2982 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2983 } | |
2984 | |
2985 //----- (00494C5A) -------------------------------------------------------- | |
2986 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2987 { | |
2988 PlayerFrameTable *v2; // ebx@1 | |
2989 FILE *v3; // eax@1 | |
2990 int v4; // esi@3 | |
2991 void *v5; // eax@10 | |
2992 FILE *v6; // ST0C_4@12 | |
2993 char *i; // eax@12 | |
2994 __int16 v8; // ax@15 | |
2995 const char *v9; // ST10_4@15 | |
2996 unsigned __int16 v10; // ax@15 | |
2997 const char *v11; // ST0C_4@15 | |
2998 int j; // esi@15 | |
2999 int v13; // eax@17 | |
3000 int v14; // edx@22 | |
3001 int v15; // ecx@23 | |
3002 int v16; // eax@24 | |
3003 signed int k; // eax@27 | |
3004 PlayerFrame *v18; // edx@28 | |
3005 int v19; // esi@28 | |
3006 int l; // ecx@29 | |
3007 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3008 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3009 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3010 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3011 int v26; // [sp+2FCh] [bp-8h]@3 | |
3012 FILE *File; // [sp+300h] [bp-4h]@1 | |
3013 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3014 | |
3015 v2 = this; | |
3016 //TileTable::dtor((TileTable *)this); | |
3017 v3 = fopen(Args, "r"); | |
3018 File = v3; | |
3019 if ( !v3 ) | |
3020 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3021 v4 = 0; | |
3022 v25 = 0; | |
3023 v26 = 1; | |
3024 if ( fgets(&Buf, 490, v3) ) | |
3025 { | |
3026 do | |
3027 { | |
3028 *strchr(&Buf, 10) = 0; | |
703 | 3029 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3030 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3031 { | |
3032 if ( v24.uPropCount < 3 ) | |
0 | 3033 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3034 ++v25; | |
3035 } | |
3036 ++v26; | |
3037 } | |
3038 while ( fgets(&Buf, 490, File) ); | |
3039 v4 = v25; | |
3040 } | |
3041 v2->uNumFrames = v4; | |
3042 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3043 v2->pFrames = (PlayerFrame *)v5; | |
3044 if ( !v5 ) | |
3045 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3046 v6 = File; | |
3047 v2->uNumFrames = 0; | |
3048 fseek(v6, 0, 0); | |
3049 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3050 { | |
3051 *strchr(&Buf, 10) = 0; | |
703 | 3052 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3053 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3054 { |
3055 v8 = atoi(v24.pProperties[0]); | |
3056 v9 = v24.pProperties[1]; | |
130 | 3057 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3058 v10 = atoi(v9); |
3059 v11 = v24.pProperties[2]; | |
3060 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3061 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3062 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3063 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3064 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3065 { |
3066 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3067 { | |
3068 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3069 *(char *)v13 |= 4u; | |
3070 } | |
3071 } | |
3072 ++v2->uNumFrames; | |
3073 } | |
3074 } | |
3075 fclose(File); | |
3076 v14 = 0; | |
3077 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3078 { | |
3079 v15 = 0; | |
3080 do | |
3081 { | |
3082 v16 = (int)&v2->pFrames[v15]; | |
3083 if ( !(*(char *)(v16 + 18) & 4) ) | |
3084 *(char *)(v16 + 8) |= 1u; | |
3085 ++v14; | |
3086 ++v15; | |
3087 } | |
3088 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3089 } | |
3090 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3091 { | |
3092 v18 = v2->pFrames; | |
3093 Argsa = (int)&v18[k]; | |
3094 v19 = *(short *)(Argsa + 4); | |
3095 if ( *(char *)(Argsa + 8) & 1 ) | |
3096 { | |
3097 ++k; | |
3098 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3099 { | |
3100 v19 += *(short *)(l + 4); | |
3101 ++k; | |
3102 } | |
3103 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3104 } | |
3105 ++k; | |
3106 } | |
3107 return 1; | |
3108 } | |
3109 | |
3110 //----- (00494F3A) -------------------------------------------------------- | |
3111 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3112 { | |
3113 IconFrameTable *v2; // esi@1 | |
3114 int v3; // ebx@1 | |
3115 unsigned int uID; // edi@1 | |
3116 unsigned int result; // eax@4 | |
3117 | |
3118 v2 = this; | |
3119 v3 = 0; | |
3120 uID = 0; | |
3121 if ( (signed int)this->uNumIcons <= 0 ) | |
3122 { | |
3123 LABEL_4: | |
3124 result = 0; | |
3125 } | |
3126 else | |
3127 { | |
3128 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3129 { | |
3130 ++uID; | |
3131 ++v3; | |
3132 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3133 goto LABEL_4; | |
3134 } | |
3135 result = uID; | |
3136 } | |
3137 return result; | |
3138 } | |
3139 | |
3140 //----- (00494F70) -------------------------------------------------------- | |
3141 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3142 { | |
3143 IconFrame *v3; // edi@1 | |
3144 IconFrame *v4; // ecx@1 | |
3145 __int16 v5; // dx@2 | |
3146 int v6; // edx@3 | |
3147 unsigned int v7; // eax@3 | |
3148 char *i; // ecx@3 | |
3149 int v9; // esi@5 | |
3150 IconFrame *result; // eax@6 | |
3151 | |
3152 v3 = this->pIcons; | |
3153 v4 = &v3[uIconID]; | |
3154 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3155 { | |
3156 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3157 v7 = uIconID; | |
3158 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3159 { | |
3160 v9 = *(short *)i; | |
3161 if ( v6 <= v9 ) | |
3162 break; | |
3163 v6 -= v9; | |
3164 ++v7; | |
3165 } | |
3166 result = &v3[v7]; | |
3167 } | |
3168 else | |
3169 { | |
3170 result = &v3[uIconID]; | |
3171 } | |
3172 return result; | |
3173 } | |
3174 | |
3175 //----- (00494FBF) -------------------------------------------------------- | |
3176 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3177 { | |
3178 IconFrameTable *v2; // esi@1 | |
3179 unsigned int v3; // edi@3 | |
3180 const char *i; // eax@3 | |
3181 IconFrame *v5; // eax@5 | |
3182 | |
3183 v2 = this; | |
3184 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3185 { | |
3186 v3 = uIconID; | |
3187 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3188 { | |
3189 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3190 v5 = v2->pIcons; | |
3191 if ( !(v5[v3].uFlags & 1) ) | |
3192 break; | |
3193 ++v3; | |
3194 } | |
3195 } | |
3196 } | |
3197 | |
3198 //----- (0049500A) -------------------------------------------------------- | |
3199 void IconFrameTable::ToFile() | |
3200 { | |
3201 IconFrameTable *v1; // esi@1 | |
3202 FILE *v2; // eax@1 | |
3203 FILE *v3; // edi@1 | |
3204 | |
3205 auto Str = this; | |
3206 | |
3207 v1 = Str; | |
3208 v2 = fopen("data\\dift.bin", "wb"); | |
3209 v3 = v2; | |
3210 if ( !v2 ) | |
3211 Abortf("Unable to save dift.bin!"); | |
3212 fwrite(v1, 4u, 1u, v2); | |
3213 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3214 fclose(v3); | |
3215 } | |
3216 | |
3217 //----- (00495056) -------------------------------------------------------- | |
3218 void IconFrameTable::FromFile(void *pSerialized) | |
3219 { | |
3220 uNumIcons = *(int *)pSerialized; | |
3221 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3222 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3223 } | |
3224 | |
3225 //----- (0049509D) -------------------------------------------------------- | |
3226 int IconFrameTable::FromFileTxt(const char *Args) | |
3227 { | |
3228 IconFrameTable *v2; // ebx@1 | |
3229 FILE *v3; // eax@1 | |
3230 int v4; // esi@3 | |
3231 void *v5; // eax@10 | |
3232 FILE *v6; // ST0C_4@12 | |
3233 char *i; // eax@12 | |
3234 const char *v8; // ST00_4@15 | |
3235 int v9; // eax@16 | |
3236 int v10; // edx@20 | |
3237 int v11; // ecx@21 | |
3238 int v12; // eax@22 | |
3239 signed int j; // edx@25 | |
3240 IconFrame *v14; // ecx@26 | |
3241 int v15; // esi@26 | |
3242 int k; // eax@27 | |
3243 signed int result; // eax@11 | |
3244 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3245 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3246 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3247 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3248 int v22; // [sp+2FCh] [bp-8h]@3 | |
3249 FILE *File; // [sp+300h] [bp-4h]@1 | |
3250 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3251 | |
3252 v2 = this; | |
3253 //TileTable::dtor((TileTable *)this); | |
3254 v3 = fopen(Args, "r"); | |
3255 File = v3; | |
3256 if ( !v3 ) | |
3257 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3258 v4 = 0; | |
3259 v21 = 0; | |
3260 v22 = 1; | |
3261 if ( fgets(&Buf, 490, v3) ) | |
3262 { | |
3263 do | |
3264 { | |
3265 *strchr(&Buf, 10) = 0; | |
3266 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3267 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3268 { | |
3269 if ( v20.uPropCount < 3 ) | |
0 | 3270 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3271 ++v21; | |
3272 } | |
3273 ++v22; | |
3274 } | |
3275 while ( fgets(&Buf, 490, File) ); | |
3276 v4 = v21; | |
3277 } | |
3278 v2->uNumIcons = v4; | |
3279 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3280 v2->pIcons = (IconFrame *)v5; | |
3281 if ( v5 ) | |
3282 { | |
3283 v6 = File; | |
3284 v2->uNumIcons = 0; | |
3285 fseek(v6, 0, 0); | |
3286 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3287 { | |
3288 *strchr(&Buf, 10) = 0; | |
3289 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3290 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3291 { |
3292 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3293 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3294 v8 = v20.pProperties[2]; | |
3295 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3296 if ( !_strcmpi(v8, "new") ) | |
3297 { | |
3298 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3299 *(char *)v9 |= 4u; | |
3300 } | |
3301 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3302 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3303 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3304 } | |
3305 } | |
3306 fclose(File); | |
3307 v10 = 0; | |
3308 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3309 { | |
3310 v11 = 0; | |
3311 do | |
3312 { | |
3313 v12 = (int)&v2->pIcons[v11]; | |
3314 if ( !(*(char *)(v12 + 60) & 4) ) | |
3315 *(char *)(v12 + 28) |= 1u; | |
3316 ++v10; | |
3317 ++v11; | |
3318 } | |
3319 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3320 } | |
3321 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3322 { | |
3323 v14 = v2->pIcons; | |
3324 Argsa = (int)&v14[j]; | |
3325 v15 = *(short *)(Argsa + 24); | |
3326 if ( *(char *)(Argsa + 28) & 1 ) | |
3327 { | |
3328 ++j; | |
3329 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3330 { | |
3331 v15 += *(short *)(k + 24); | |
3332 ++j; | |
3333 } | |
3334 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3335 } | |
3336 ++j; | |
3337 } | |
3338 result = 1; | |
3339 } | |
3340 else | |
3341 { | |
3342 fclose(File); | |
3343 result = 0; | |
3344 } | |
3345 return result; | |
3346 } | |
3347 | |
3348 //----- (00495366) -------------------------------------------------------- | |
3349 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3350 { | |
3351 int v2; // edi@1 | |
3352 int v3; // edx@2 | |
3353 int v4; // esi@3 | |
3354 int v5; // ebx@5 | |
3355 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3356 signed int v8; // [sp+10h] [bp-10h]@1 | |
3357 int **v9; // [sp+14h] [bp-Ch]@4 | |
3358 signed int v10; // [sp+18h] [bp-8h]@3 | |
3359 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3360 | |
3361 v2 = a1; | |
3362 v11 = a2; | |
3363 v8 = 0; | |
3364 v7 = 0; | |
3365 if ( dword_AE336C == a1 ) | |
3366 { | |
3367 v3 = dword_AE3370; | |
3368 } | |
3369 else | |
3370 { | |
3371 v4 = a2; | |
3372 dword_AE336C = a1; | |
3373 v10 = 0; | |
3374 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3375 goto LABEL_17; | |
3376 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3377 do | |
3378 { | |
3379 v5 = tolower(*(char *)*v9); | |
3380 if ( v5 == tolower(v2) ) | |
3381 { | |
3382 if ( v8 ) | |
3383 v7 = v10; | |
3384 else | |
3385 v8 = v10; | |
3386 } | |
3387 ++v10; | |
3388 v9 += 2; | |
3389 } | |
3390 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3391 if ( v8 && v8 != v7 ) | |
3392 v3 = v8 + rand() % (v7 - v8); | |
3393 else | |
3394 LABEL_17: | |
3395 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3396 } | |
3397 dword_AE3370 = v3; | |
3398 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3399 } | |
3400 // AE336C: using guessed type int dword_AE336C; | |
3401 // AE3370: using guessed type int dword_AE3370; | |
3402 | |
3403 //----- (00495430) -------------------------------------------------------- | |
607 | 3404 char * GetReputationString( signed int a1 ) |
3405 { | |
566 | 3406 if (a1 >= 25) |
3407 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3408 else if (a1 >= 6) | |
3409 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3410 else if (a1 >= -5) | |
3411 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3412 else if (a1 >= -24) | |
3413 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3414 else |
566 | 3415 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3416 } |
3417 | |
3418 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3419 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3420 { |
3421 unsigned __int8 v6; // bl@1 | |
3422 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3423 //NPCData *v9; // eax@4 |
250 | 3424 //size_t v10; // eax@6 |
0 | 3425 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3426 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3427 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3428 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3429 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3430 //int v16; // edx@10 |
0 | 3431 int v17; // eax@10 |
3432 signed __int64 v18; // qax@18 | |
3433 unsigned int v19; // edi@32 | |
3434 unsigned __int8 *v20; // ebx@32 | |
3435 int v21; // ecx@34 | |
3436 __int16 v22; // ax@34 | |
3437 int v23; // edx@39 | |
3438 int v24; // eax@39 | |
3439 int v25; // eax@45 | |
3440 float *v26; // esi@68 | |
3441 float v27; // ST18_4@68 | |
3442 signed int v28; // eax@68 | |
3443 int v29; // eax@68 | |
3444 float v30; // ST18_4@72 | |
3445 signed int v31; // eax@72 | |
3446 float v32; // ST18_4@74 | |
3447 signed int v33; // eax@74 | |
3448 double v34; // st7@75 | |
3449 float v35; // ST18_4@76 | |
3450 signed int v36; // eax@76 | |
3451 float *v37; // esi@78 | |
3452 float v38; // ST18_4@78 | |
3453 int v39; // eax@78 | |
3454 float v40; // ST18_4@82 | |
3455 int v41; // eax@82 | |
3456 float v42; // ST18_4@83 | |
3457 int v43; // eax@83 | |
3458 float v44; // ST18_4@85 | |
3459 int v45; // eax@85 | |
3460 const char *v46; // eax@86 | |
3461 unsigned int v47; // eax@87 | |
3462 float v48; // ST18_4@97 | |
3463 __int64 v49; // ST14_8@107 | |
3464 int v50; // eax@107 | |
3465 int v51; // eax@108 | |
3466 Player *v52; // eax@109 | |
3467 int v53; // [sp-4h] [bp-13Ch]@107 | |
3468 int v54; // [sp+0h] [bp-138h]@107 | |
3469 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3470 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3471 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3472 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3473 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3475 //Player *v61; // [sp+124h] [bp-14h]@3 |
3476 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3477 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3482 |
0 | 3483 |
3484 v6 = uPlayerID; | |
249 | 3485 //Str = lpsz; |
0 | 3486 if ( IsBadStringPtrA(lpsz, 1u) ) |
3487 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3488 |
0 | 3489 a1[0] = 0; |
3490 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3491 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3492 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3493 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3495 NPCData *npc = nullptr; |
0 | 3496 if ( dword_5C35D4 ) |
248 | 3497 { |
463 | 3498 //__debugbreak(); // fix |
459 | 3499 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 else |
602 | 3502 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 //v65 = v9; |
250 | 3504 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3510 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3511 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0'; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3533 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3534 case 2: |
0 | 3535 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 case 5: |
0 | 3542 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3543 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3544 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3545 { | |
3546 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3547 { | |
3548 if ( v18 < 20 ) | |
3549 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3550 } | |
3551 else | |
3552 { | |
3553 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3554 } | |
3555 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 case 6: |
0 | 3558 if ( pPlayer->uSex ) |
3559 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3560 else | |
3561 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 case 7: |
0 | 3564 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 case 8: |
0 | 3570 v19 = 0; |
3571 v63 = 0; | |
484 | 3572 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3573 do |
3574 { | |
3575 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3576 { | |
3577 v21 = v63; | |
3578 v22 = word_4EE150[v19]; | |
3579 ++v63; | |
3580 v55[v21] = v22; | |
3581 } | |
3582 ++v19; | |
3583 } | |
3584 while ( v19 < 28 ); | |
3585 if ( v63 ) | |
3586 { | |
3587 v23 = rand() % v63; | |
3588 v24 = dword_A74CDC; | |
3589 if ( dword_A74CDC == -1 ) | |
3590 { | |
3591 v24 = v23; | |
3592 dword_A74CDC = v23; | |
3593 } | |
492 | 3594 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3595 } |
3596 else | |
3597 { | |
3598 v11 = (char *)pNPCTopics[55].pText; | |
3599 } | |
249 | 3600 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3606 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3608 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3609 case 10: |
0 | 3610 if ( pPlayer->uSex ) |
3611 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3612 else | |
3613 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3614 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 case 11: |
0 | 3616 v25 = GetPartyReputation(); |
3617 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3618 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3619 v25 = npc->rep; |
0 | 3620 LABEL_46: |
3621 if ( v25 >= 25 ) | |
3622 { | |
3623 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3624 } | |
3625 else | |
3626 { | |
3627 if ( v25 < 6 ) | |
3628 { | |
3629 if ( v25 >= -5 ) | |
3630 { | |
3631 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3632 } | |
3633 else | |
3634 { | |
3635 if ( v25 < -24 ) | |
3636 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3637 else | |
3638 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3639 } | |
3640 } | |
3641 else | |
3642 { | |
3643 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3644 } | |
3645 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 case 13: |
0 | 3648 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 sprintf(a1, "%lu", pay_percentage); |
250 | 3685 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 sprintf(a1, "%lu", v51); |
0 | 3699 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3724 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3725 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3726 switch ( a5 ) |
3727 { | |
3728 case 3: | |
3729 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3730 v45 = a3->GetValue(); |
0 | 3731 v29 = pPlayer->_4B8213(v45, v44); |
3732 break; | |
3733 case 4: | |
3734 v29 = pPlayer->_4B824B(*v37); | |
3735 break; | |
3736 case 5: | |
3737 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3738 v43 = a3->GetValue(); |
0 | 3739 v29 = pPlayer->_4B8265(v43, v42); |
3740 break; | |
3741 case 6: | |
3742 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 v41 = a3->GetValue(); |
0 | 3744 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3745 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3748 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3750 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3752 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3753 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3754 v28 = a3->GetValue(); |
749 | 3755 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3756 if ( a5 == 3 ) |
3757 { | |
3758 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3759 v36 = a3->GetValue(); |
0 | 3760 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3761 if (a3->Broken()) |
0 | 3762 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3763 goto _continue_sprintf; |
0 | 3764 } |
3765 if ( a5 != 4 ) | |
3766 { | |
3767 if ( a5 == 5 ) | |
3768 { | |
3769 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3770 v33 = a3->GetValue(); |
0 | 3771 v29 = pPlayer->_4B81C3(v33, v32); |
3772 } | |
3773 else | |
3774 { | |
3775 if ( a5 == 6 ) | |
3776 { | |
3777 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3778 v31 = a3->GetValue(); |
0 | 3779 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3780 if (a3->Broken()) |
0 | 3781 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3782 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3784 goto _continue_sprintf; |
0 | 3785 } |
3786 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 _continue_sprintf: |
0 | 3788 sprintf(a1, "%lu", v29); |
250 | 3789 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 goto _continue_strcat; |
0 | 3791 } |
3792 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 |
0 | 3794 v48 = v34; |
3795 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3797 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3798 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3813 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3818 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3819 sub_493F79(&v57, *a6); |
351 | 3820 v54 = v57.field_18_expire_year; |
3821 v53 = v57.field_C_expire_day + 1; | |
3822 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3830 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3834 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3836 default: |
0 | 3837 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3838 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3839 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3840 goto _continue_strcat; |
484 | 3841 v49 = pParty->field_3C._s_times[v17-51]; |
3842 | |
0 | 3843 sub_493F79(&v56, v49); |
351 | 3844 v54 = v56.field_18_expire_year; |
3845 v53 = v56.field_C_expire_day + 1; | |
3846 v50 = v56.field_14_exprie_month; | |
0 | 3847 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3848 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3849 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3850 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3851 } |
0 | 3852 } |
3853 return pTmpBuf2; | |
3854 } | |
3855 | |
3856 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3857 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3858 { |
734 | 3859 //stru154 *v3; // edi@1 |
3860 //signed int v4; // eax@1 | |
3861 //signed int result; // eax@9 | |
3862 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3863 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3864 float v7; |
0 | 3865 |
3866 v.x = 0.0; | |
3867 v.y = 0.0; | |
3868 v.z = 0.0; | |
734 | 3869 GetFacePlane(a2, a3, &v, &v7); |
3870 | |
3871 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3872 polygonType = POLYGON_VerticalWall; | |
3873 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3874 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3875 polygonType = POLYGON_Floor; | |
0 | 3876 else |
734 | 3877 polygonType = POLYGON_InBetweenFloorAndWall; |
3878 | |
3879 face_plane.vNormal.x = v.x; | |
3880 face_plane.vNormal.y = v.y; | |
3881 face_plane.vNormal.z = v.z; | |
3882 face_plane.dist = v7; | |
0 | 3883 } |
3884 | |
3885 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3886 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3887 { |
734 | 3888 if (fabsf(pNormal->z) < 1e-6f) |
3889 polygonType = POLYGON_VerticalWall; | |
3890 else if (fabsf(pNormal->x) < 1e-6f && | |
3891 fabsf(pNormal->y) < 1e-6f) | |
3892 polygonType = POLYGON_Floor; | |
0 | 3893 else |
734 | 3894 polygonType = POLYGON_InBetweenFloorAndWall; |
3895 | |
3896 face_plane.vNormal.x = pNormal->x; | |
3897 face_plane.dist = dist; | |
3898 face_plane.vNormal.y = pNormal->y; | |
3899 face_plane.vNormal.z = pNormal->z; | |
0 | 3900 } |
3901 | |
3902 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3903 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3904 { |
3905 ODMFace *v5; // ebx@1 | |
734 | 3906 //int v6; // eax@1 |
3907 //unsigned __int16 *v7; // ebx@2 | |
3908 //Vec3_int_ *v8; // eax@3 | |
0 | 3909 Vec3_int_ *v9; // ecx@3 |
734 | 3910 //double v10; // st7@3 |
3911 //int v11; // ecx@3 | |
0 | 3912 Vec3_int_ *v12; // ecx@3 |
734 | 3913 //double v13; // st7@3 |
3914 //double v14; // st6@3 | |
3915 //double v15; // st5@3 | |
3916 //int v16; // ecx@3 | |
0 | 3917 Vec3_int_ *v17; // eax@3 |
734 | 3918 //double v18; // st5@3 |
0 | 3919 Vec3_float_ *v19; // eax@3 |
734 | 3920 //int result; // eax@8 |
3921 //float v21; // ecx@10 | |
3922 //double v22; // st7@10 | |
3923 //double v23; // st6@10 | |
0 | 3924 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3925 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3926 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3927 float v27; // [sp+20h] [bp-48h]@3 | |
3928 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3929 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3930 //float v30; // [sp+30h] [bp-38h]@3 | |
3931 //float v31; // [sp+34h] [bp-34h]@3 | |
3932 //float v32; // [sp+38h] [bp-30h]@3 | |
3933 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3934 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3935 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3936 //float v36; // [sp+50h] [bp-18h]@3 | |
3937 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3938 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3939 //int v39; // [sp+64h] [bp-4h]@1 |
3940 | |
3941 //v39 = 0; | |
0 | 3942 v1.x = 0.0; |
3943 v5 = pFace; | |
734 | 3944 //v6 = pFace->uNumVertices; |
0 | 3945 v1.y = 0.0; |
3946 v1.z = 0.0; | |
734 | 3947 |
3948 if (pFace->uNumVertices >= 2) | |
3949 { | |
3950 int i = 0; | |
3951 while ( i < pFace->uNumVertices - 2 ) | |
3952 { | |
3953 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3954 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3955 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3956 | |
3957 v1.x = v12->x - v9->x; | |
3958 v26 = v17->x - v12->x; | |
3959 v1.y = v12->y - v9->y; | |
3960 v27 = v17->y - v12->y; | |
3961 v1.z = v12->z - v9->z; | |
3962 v28 = v17->z - v12->z; | |
0 | 3963 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3964 v38.x = v19->x; | |
3965 v38.y = v19->y; | |
3966 v38.z = v19->z; | |
734 | 3967 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3968 { | |
3969 v38.Normalize(); | |
3970 | |
3971 pOutNormal->x = v38.x; | |
3972 pOutNormal->y = v38.y; | |
3973 pOutNormal->z = v38.z; | |
3974 | |
3975 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3976 return; | |
3977 } | |
3978 } | |
3979 } | |
3980 | |
3981 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3982 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3983 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3984 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3985 } |
3986 | |
3987 //----- (0049D700) -------------------------------------------------------- | |
3988 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3989 { | |
3990 unsigned int v1; // eax@1 | |
3991 int v2; // ecx@1 | |
3992 unsigned int v3; // eax@1 | |
3993 | |
3994 v1 = uDim; | |
3995 v2 = 0; | |
3996 v3 = v1 - 1; | |
3997 while ( v3 & 1 ) | |
3998 { | |
3999 v3 >>= 1; | |
4000 ++v2; | |
4001 } | |
4002 return v3 == 0 ? v2 : 0; | |
4003 } | |
4004 | |
4005 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4006 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4007 { |
737 | 4008 /*signed __int64 v2; // ST10_8@1 |
0 | 4009 double v3; // st7@1 |
4010 float v4; // ST24_4@1 | |
4011 double v5; // ST10_8@1 | |
4012 int v6; // ST1C_4@1 | |
4013 float v7; // ST24_4@1 | |
4014 double v8; // ST10_8@1 | |
4015 unsigned __int8 v9; // ST20_1@1 | |
4016 float v10; // ST24_4@1 | |
4017 double v11; // ST10_8@1 | |
4018 float v12; // ST24_4@1 | |
737 | 4019 double v13; // ST08_8@1*/ |
4020 | |
4021 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4022 (a2 >> 24) / 255.0f * 255.0f), | |
4023 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4024 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4025 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4026 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4027 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4028 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4029 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4030 /*v2 = a1 >> 24; | |
4031 v3 = (double)v2 / 255.0f; | |
4032 HIDWORD(v2) = 0; | |
0 | 4033 LODWORD(v2) = a2 >> 24; |
737 | 4034 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4035 v5 = v4 + 6.7553994e15; |
4036 v6 = LODWORD(v5); | |
737 | 4037 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4038 v8 = v7 + 6.7553994e15; |
4039 v9 = LOBYTE(v8); | |
737 | 4040 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4041 v11 = v10 + 6.7553994e15; |
737 | 4042 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4043 v13 = v12 + 6.7553994e15; |
737 | 4044 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4045 } |
4046 | |
4047 //----- (004A46E6) -------------------------------------------------------- | |
4048 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4049 { | |
4050 int v5; // eax@1 | |
4051 int z; // eax@1 | |
4052 unsigned int v7; // eax@9 | |
4053 unsigned int v8; // ecx@9 | |
4054 int v9; // eax@9 | |
4055 unsigned int v10; // eax@10 | |
4056 int *v11; // esi@10 | |
4057 int *v12; // edi@10 | |
4058 int v13; // ecx@10 | |
4059 int v14; // edx@10 | |
4060 unsigned int v15; // eax@22 | |
4061 int *v16; // esi@22 | |
4062 int *v17; // edi@22 | |
4063 int v18; // ecx@22 | |
4064 int v19; // edx@22 | |
4065 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4066 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4067 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4068 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4069 | |
4070 v5 = a4; | |
4071 v23 = _z >> 16; | |
4072 z = x + v5; | |
693 | 4073 if ( z >= (signed int)pViewport->uViewportTL_X |
4074 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4075 && y >= (signed int)pViewport->uViewportTL_Y | |
4076 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4077 { | |
4078 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4079 x = pViewport->uViewportTL_X; | |
4080 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4081 z = pViewport->uViewportBR_X; | |
0 | 4082 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4083 v22 = z - x; | |
4084 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4085 v7 = lightColor >> 3; | |
4086 v8 = lightColor & 0xF0; | |
4087 v9 = v7 & 0x1E0000; | |
4088 if ( pRenderer->uTargetGBits == 5 ) | |
4089 { | |
4090 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4091 v11 = (int *)pTarget; | |
4092 v12 = pTargetZ; | |
4093 v13 = v22; | |
4094 v14 = (v10 << 16) | v10; | |
4095 z = (unsigned __int8)pTarget & 2; | |
4096 if ( (unsigned __int8)pTarget & 2 ) | |
4097 { | |
4098 z = (unsigned int)*pTargetZ >> 16; | |
4099 if ( z > v23 ) | |
4100 { | |
4101 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4102 *pTarget = z; | |
4103 } | |
4104 v13 = v22 - 1; | |
4105 v11 = (int *)(pTarget + 1); | |
4106 v12 = pTargetZ + 1; | |
4107 } | |
4108 while ( v13 != 1 ) | |
4109 { | |
4110 if ( v13 < 1 ) | |
4111 return z; | |
4112 z = (unsigned int)*v12 >> 16; | |
4113 if ( z <= v23 ) | |
4114 { | |
4115 v13 -= 2; | |
4116 ++v11; | |
4117 v12 += 2; | |
4118 } | |
4119 else | |
4120 { | |
4121 v12 += 2; | |
4122 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4123 v13 -= 2; | |
4124 *v11 = z; | |
4125 ++v11; | |
4126 } | |
4127 } | |
4128 z = (unsigned int)*v12 >> 16; | |
4129 if ( z > v23 ) | |
4130 { | |
4131 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4132 *(short *)v11 = z; | |
4133 } | |
4134 } | |
4135 else | |
4136 { | |
4137 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4138 v16 = (int *)pTarget; | |
4139 v17 = pTargetZ; | |
4140 v18 = v22; | |
4141 v19 = (v15 << 16) | v15; | |
4142 z = (unsigned __int8)pTarget & 2; | |
4143 if ( (unsigned __int8)pTarget & 2 ) | |
4144 { | |
4145 z = (unsigned int)*pTargetZ >> 16; | |
4146 if ( z > v23 ) | |
4147 { | |
4148 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4149 *pTarget = z; | |
4150 } | |
4151 v18 = v22 - 1; | |
4152 v16 = (int *)(pTarget + 1); | |
4153 v17 = pTargetZ + 1; | |
4154 } | |
4155 while ( v18 != 1 ) | |
4156 { | |
4157 if ( v18 < 1 ) | |
4158 return z; | |
4159 z = (unsigned int)*v17 >> 16; | |
4160 if ( z <= v23 ) | |
4161 { | |
4162 v18 -= 2; | |
4163 ++v16; | |
4164 v17 += 2; | |
4165 } | |
4166 else | |
4167 { | |
4168 v17 += 2; | |
4169 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4170 v18 -= 2; | |
4171 *v16 = z; | |
4172 ++v16; | |
4173 } | |
4174 } | |
4175 z = (unsigned int)*v17 >> 16; | |
4176 if ( z > v23 ) | |
4177 { | |
4178 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4179 *(short *)v16 = z; | |
4180 } | |
4181 } | |
4182 } | |
4183 return z; | |
4184 } | |
4185 | |
4186 //----- (004A57E9) -------------------------------------------------------- | |
4187 void __cdecl Present_ColorKey() | |
4188 { | |
4189 HRESULT v0; // eax@3 | |
4190 HRESULT v1; // eax@3 | |
4191 HRESULT v2; // eax@3 | |
4192 HRESULT v3; // eax@3 | |
4193 HRESULT v4; // eax@3 | |
4194 RECT a2; // [sp+4h] [bp-14h]@3 | |
4195 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4196 | |
4197 if ( !pRenderer->uNumSceneBegins ) | |
4198 { | |
4199 if ( pRenderer->field_40110 ) | |
4200 { | |
693 | 4201 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4202 a2.left = 0; |
4203 a2.top = 0; | |
4204 a2.right = 640; | |
4205 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4206 a2.right = 640; | |
4207 a2.left = 0; | |
693 | 4208 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4209 a2.bottom = 480; |
4210 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4211 0, | |
693 | 4212 pViewport->uViewportBR_Y + 1, |
0 | 4213 pRenderer->pColorKeySurface4, |
4214 &a2, | |
4215 16u)); | |
693 | 4216 a2.right = pViewport->uViewportTL_X; |
4217 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4218 a2.left = 0; |
693 | 4219 a2.top = pViewport->uViewportTL_Y; |
0 | 4220 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4221 0, | |
693 | 4222 pViewport->uViewportTL_Y, |
0 | 4223 pRenderer->pColorKeySurface4, |
4224 &a2, | |
4225 16u)); | |
693 | 4226 a2.left = pViewport->uViewportBR_X; |
4227 a2.top = pViewport->uViewportTL_Y; | |
0 | 4228 a2.right = 640; |
693 | 4229 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4230 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4231 pViewport->uViewportBR_X, |
4232 pViewport->uViewportTL_Y, | |
0 | 4233 pRenderer->pColorKeySurface4, |
4234 &a2, | |
4235 16u)); | |
693 | 4236 a2.right = pViewport->uViewportBR_X; |
4237 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4238 a2.left = pViewport->uViewportTL_X; | |
4239 a2.top = pViewport->uViewportTL_Y; | |
0 | 4240 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4241 pViewport->uViewportTL_X, |
4242 pViewport->uViewportTL_Y, | |
0 | 4243 pRenderer->pColorKeySurface4, |
4244 &a2, | |
4245 17u)); | |
4246 } | |
4247 } | |
4248 } | |
4249 | |
4250 //----- (004A597D) -------------------------------------------------------- | |
4251 void Present_NoColorKey() | |
4252 { | |
4253 //unsigned __int16 *v0; // eax@4 | |
4254 unsigned __int16 *v1; // esi@4 | |
4255 void *v2; // edi@4 | |
4256 //signed int v4; // ebx@4 | |
4257 //signed int v5; // ebx@6 | |
4258 //void *v6; // edi@7 | |
4259 //const void *v7; // esi@7 | |
4260 signed int v8; // ebx@8 | |
4261 int v9; // eax@10 | |
4262 unsigned int v10; // esi@10 | |
4263 unsigned __int32 v11; // edi@10 | |
4264 //int v12; // ecx@10 | |
4265 unsigned int v13; // ebx@10 | |
4266 int v14; // eax@11 | |
4267 int v15; // eax@13 | |
4268 int v16; // eax@14 | |
4269 int v17; // eax@16 | |
4270 HRESULT v18; // eax@22 | |
4271 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4272 int v20; // [sp+88h] [bp-1Ch]@10 | |
4273 int v21; // [sp+8Ch] [bp-18h]@10 | |
4274 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4275 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4276 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4277 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4278 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4279 | |
4280 if ( !pRenderer->uNumSceneBegins ) | |
4281 { | |
4282 if ( pRenderer->field_40110 ) | |
4283 { | |
4284 memset(&Dst, 0, 0x7Cu); | |
4285 Dst.dwSize = 124; | |
168 | 4286 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4287 { |
4288 //v26 = Dst.lpSurface; | |
4289 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4290 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4291 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4292 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4293 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4294 v1 = pRenderer->pTargetSurface; | |
4295 v2 = Dst.lpSurface; | |
4296 | |
4297 | |
4298 /*for (uint y = 0; y < 480; ++y) | |
4299 { | |
4300 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4301 for (uint x = 0; x < 640; ++x) | |
4302 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4303 }*/ | |
4304 | |
4305 auto pSrc = pRenderer->pTargetSurface; | |
4306 auto pDst = (__int16 *)Dst.lpSurface; | |
4307 | |
4308 for (uint y = 0; y < 8; ++y) | |
4309 memcpy(pDst + y * Dst.lPitch / 2, | |
4310 | |
4311 pSrc + y * 640, 640 * sizeof(__int16)); | |
4312 | |
4313 for (uint y = 8; y < 352; ++y) | |
4314 { | |
4315 memcpy(pDst + y * Dst.lPitch / 2, | |
4316 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4317 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4318 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4319 } |
4320 | |
121 | 4321 for (uint y = 352; y < 480; ++y) |
0 | 4322 memcpy(pDst + y * Dst.lPitch / 2, |
4323 pSrc + y * 640, 640 * sizeof(__int16)); | |
4324 | |
4325 | |
693 | 4326 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4327 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4328 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4329 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4330 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4331 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4332 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4333 v21 = 4 * v9 + 1280; | |
4334 | |
121 | 4335 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4336 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4337 v10 = (int)pSrc_x1y1; | |
4338 v11 = (int)pDst_x1y1; | |
693 | 4339 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4340 v13 = v24; |
4341 | |
693 | 4342 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4343 { |
4344 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4345 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4346 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4347 { |
4348 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4349 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4350 } | |
4351 } | |
4352 | |
4353 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4354 | |
4355 /* while ( 1 ) | |
4356 { | |
4357 while ( 1 ) | |
4358 { | |
4359 v14 = *(int *)v10; | |
4360 v10 += 4; | |
4361 if ( v14 == v13 ) | |
4362 break; | |
4363 if ( (short)v14 == (short)v13 ) | |
4364 { | |
4365 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4366 v11 += 4; | |
4367 --uHalfWidth; | |
4368 if ( !uHalfWidth ) | |
4369 goto LABEL_21; | |
4370 } | |
4371 else | |
4372 { | |
4373 v15 = __ROL__(v14, 16); | |
4374 if ( (short)v15 == (short)v13 ) | |
4375 { | |
4376 v17 = __ROR__(v15, 16); | |
4377 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4378 v11 += 4; | |
4379 --uHalfWidth; | |
4380 if ( !uHalfWidth ) | |
4381 goto LABEL_21; | |
4382 } | |
4383 else | |
4384 { | |
4385 v16 = __ROR__(v15, 16); | |
4386 *(int *)v11 = v16; | |
4387 v11 += 4; | |
4388 --uHalfWidth; | |
4389 if ( !uHalfWidth ) | |
4390 goto LABEL_21; | |
4391 } | |
4392 } | |
4393 } | |
4394 v11 += 4; | |
4395 --uHalfWidth; | |
4396 if ( !uHalfWidth ) | |
4397 { | |
4398 LABEL_21: | |
4399 v10 += v21; | |
4400 v11 += v22; | |
4401 uHalfWidth = v20; | |
4402 if ( !--uNumLines ) | |
4403 { | |
4404 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4405 return; | |
4406 } | |
4407 } | |
4408 }*/ | |
4409 } | |
4410 } | |
4411 } | |
4412 } | |
4413 | |
4414 //----- (004A7063) -------------------------------------------------------- | |
4415 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4416 { | |
4417 float v2; // ST1C_4@1 | |
4418 double v3; // ST14_8@1 | |
4419 signed int v4; // ebx@1 | |
4420 float v5; // ST1C_4@1 | |
4421 double v6; // ST14_8@1 | |
4422 signed int v7; // edi@1 | |
4423 double v8; // ST0C_8@1 | |
4424 signed int v9; // esi@1 | |
4425 signed int v10; // ecx@1 | |
4426 double v12; // [sp+8h] [bp-18h]@1 | |
4427 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4428 | |
4429 v2 = (double)(uDiffuse >> 24) * a2; | |
4430 v3 = v2 + 6.7553994e15; | |
4431 v4 = LODWORD(v3); | |
4432 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4433 v6 = v5 + 6.7553994e15; | |
4434 v7 = LODWORD(v6); | |
4435 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4436 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4437 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4438 v9 = LODWORD(v8); | |
4439 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4440 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4441 v10 = LODWORD(v12); | |
4442 if ( v4 > 255 ) | |
4443 v4 = 255; | |
4444 if ( v4 < 0 ) | |
4445 v4 = 0; | |
4446 if ( SHIDWORD(v13) > 255 ) | |
4447 v7 = 255; | |
4448 if ( v7 < 0 ) | |
4449 v7 = 0; | |
4450 if ( (signed int)v13 > 255 ) | |
4451 v9 = 255; | |
4452 if ( v9 < 0 ) | |
4453 v9 = 0; | |
4454 if ( SLODWORD(v12) > 255 ) | |
4455 v10 = 255; | |
4456 if ( v10 < 0 ) | |
4457 v10 = 0; | |
4458 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4459 } | |
4460 | |
4461 //----- (004AD504) -------------------------------------------------------- | |
711 | 4462 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4463 { |
4464 int result; // eax@1 | |
711 | 4465 signed int v2; // ebx@1 |
0 | 4466 BLVFace *v3; // esi@3 |
4467 Texture *v4; // edi@6 | |
4468 int v5; // eax@7 | |
4469 int v6; // edx@7 | |
4470 int v7; // ecx@7 | |
4471 int v8; // ebx@8 | |
4472 int v9; // eax@8 | |
4473 int v10; // ebx@8 | |
4474 unsigned int v11; // ebx@9 | |
4475 int v12; // esi@10 | |
4476 int v13; // eax@13 | |
4477 unsigned __int16 *v14; // eax@13 | |
4478 unsigned int v15; // eax@14 | |
4479 unsigned __int16 *v16; // ebx@14 | |
4480 int v17; // eax@15 | |
4481 int v18; // ebx@15 | |
4482 int v19; // esi@15 | |
4483 int v20; // ecx@15 | |
4484 int v21; // eax@15 | |
4485 stru193_math *v22; // ebx@15 | |
4486 int v23; // eax@15 | |
4487 char *v24; // esi@16 | |
4488 int v25; // eax@18 | |
4489 int v26; // eax@18 | |
4490 int v27; // eax@20 | |
4491 signed int v28; // esi@20 | |
4492 signed int v29; // edx@20 | |
4493 signed int v30; // esi@20 | |
4494 signed int v31; // edi@20 | |
4495 int v32; // esi@20 | |
4496 int v33; // eax@26 | |
4497 int *v34; // esi@27 | |
4498 unsigned __int16 *v35; // edi@27 | |
4499 unsigned int v36; // edx@27 | |
4500 int v37; // ebx@27 | |
4501 char v38; // cl@27 | |
4502 char v39; // ch@27 | |
4503 int v40; // ebx@29 | |
4504 int v41; // edx@29 | |
4505 unsigned int v42; // ebx@30 | |
4506 int v43; // edx@30 | |
4507 int v44; // eax@33 | |
4508 int *v45; // esi@34 | |
4509 unsigned __int16 *v46; // edi@34 | |
4510 unsigned int v47; // edx@34 | |
4511 int v48; // ebx@34 | |
4512 char v49; // cl@34 | |
4513 char v50; // ch@34 | |
4514 int v51; // ebx@36 | |
4515 int v52; // edx@36 | |
4516 unsigned __int16 v53; // bx@37 | |
4517 int v54; // edx@37 | |
4518 int v55; // eax@40 | |
4519 int v56; // eax@41 | |
4520 int *v57; // esi@42 | |
4521 unsigned __int16 *v58; // edi@42 | |
4522 unsigned int v59; // edx@42 | |
4523 int v60; // ebx@42 | |
4524 char v61; // cl@42 | |
4525 char v62; // ch@42 | |
4526 unsigned int v63; // ebx@44 | |
4527 int v64; // edx@44 | |
4528 unsigned int v65; // ebx@44 | |
4529 int v66; // edx@44 | |
4530 unsigned int v67; // ebx@45 | |
4531 int v68; // edx@45 | |
4532 int v69; // ebx@45 | |
4533 int v70; // edx@45 | |
4534 int v71; // eax@48 | |
4535 int *v72; // esi@49 | |
4536 unsigned __int16 *v73; // edi@49 | |
4537 unsigned int v74; // edx@49 | |
4538 int v75; // ebx@49 | |
4539 char v76; // cl@49 | |
4540 char v77; // ch@49 | |
4541 unsigned int v78; // ebx@51 | |
4542 int v79; // edx@51 | |
4543 unsigned int v80; // ebx@51 | |
4544 int v81; // edx@51 | |
4545 unsigned int v82; // ebx@52 | |
4546 int v83; // edx@52 | |
4547 int v84; // ebx@52 | |
4548 int v85; // edx@52 | |
4549 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4550 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4551 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4552 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4553 int v90; // [sp+1Ch] [bp-88h]@20 | |
4554 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4555 int v92; // [sp+24h] [bp-80h]@7 | |
4556 int i; // [sp+28h] [bp-7Ch]@7 | |
4557 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4558 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4559 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4560 int v97; // [sp+38h] [bp-6Ch]@15 | |
4561 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4562 int v99; // [sp+40h] [bp-64h]@9 | |
4563 int v100; // [sp+44h] [bp-60h]@24 | |
4564 int v101; // [sp+48h] [bp-5Ch]@10 | |
4565 int v102; // [sp+4Ch] [bp-58h]@20 | |
4566 int v103; // [sp+50h] [bp-54h]@20 | |
4567 int v104; // [sp+54h] [bp-50h]@9 | |
4568 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4569 int v106; // [sp+5Ch] [bp-48h]@24 | |
4570 int v107; // [sp+60h] [bp-44h]@20 | |
4571 int v108; // [sp+64h] [bp-40h]@20 | |
4572 int v109; // [sp+68h] [bp-3Ch]@20 | |
4573 int v110; // [sp+6Ch] [bp-38h]@15 | |
4574 int v111; // [sp+70h] [bp-34h]@20 | |
4575 int a1; // [sp+74h] [bp-30h]@12 | |
4576 int a2; // [sp+78h] [bp-2Ch]@9 | |
4577 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4578 int v115; // [sp+80h] [bp-24h]@18 | |
4579 int v116; // [sp+84h] [bp-20h]@7 | |
4580 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4581 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4582 int *v119; // [sp+90h] [bp-14h]@13 | |
4583 int v120; // [sp+94h] [bp-10h]@15 | |
4584 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4585 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4586 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4587 | |
4588 result = pRenderer->uTargetSurfacePitch; | |
711 | 4589 v2 = sFaceID; |
0 | 4590 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4591 if ( sFaceID >= 0 ) |
4592 { | |
4593 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4594 { | |
4595 v3 = &pIndoor->pFaces[sFaceID]; | |
4596 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4597 if ( !pRenderer->pRenderD3D ) |
4598 { | |
711 | 4599 result = sub_423B5D(sFaceID); |
0 | 4600 if ( result ) |
4601 { | |
4602 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4603 if ( result ) | |
4604 { | |
4605 result = (int)v3->GetTexture(); | |
4606 v4 = (Texture *)result; | |
4607 v96 = (Texture *)result; | |
4608 if ( result ) | |
4609 { | |
4610 v5 = *(short *)(result + 38); | |
4611 LOBYTE(v3->uAttributes) |= 0x80u; | |
4612 v92 = v5; | |
4613 sub_4AE5F1(v2); | |
4614 ++pBLVRenderParams->field_84; | |
4615 v6 = stru_F8AD28.pDeltaUV[0]; | |
4616 v116 = stru_F8AD28.pDeltaUV[1]; | |
4617 v7 = 0; | |
4618 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4619 { | |
4620 v8 = v116; | |
4621 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4622 v9 = 4 * v7 + 16297672; | |
4623 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4624 } | |
4625 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4626 result = stru_F8A590._viewport_space_y; | |
4627 a2 = stru_F8A590._viewport_space_y; | |
4628 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4629 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4630 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4631 v87 = v4->pLevelOfDetail1; |
4632 v88 = v4->pLevelOfDetail2; | |
4633 v89 = v4->pLevelOfDetail3; | |
4634 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4635 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4636 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4637 { | |
4638 v12 = 2 * stru_F8A590._viewport_space_y; | |
4639 v101 = 2 * stru_F8A590._viewport_space_y; | |
4640 while ( 1 ) | |
4641 { | |
4642 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4643 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4644 if ( LOBYTE(viewparams->field_20) ) | |
4645 { | |
4646 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4647 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4648 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4649 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4650 - pBLVRenderParams->uViewportX]; | |
4651 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4652 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4653 - pBLVRenderParams->uViewportX]; | |
4654 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4655 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4656 - pBLVRenderParams->uViewportX]; | |
4657 v123 = (unsigned int)v16; | |
4658 } | |
4659 else | |
4660 { | |
4661 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4662 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4663 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4664 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4665 } | |
4666 v117 = (unsigned int)v14; | |
4667 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4668 v18 = stru_F81018.field_0.field_10; | |
4669 LOWORD(v17) = 0; | |
4670 v97 = stru_F8AD28.field_0 | v17; | |
4671 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4672 v19 = stru_F81018.field_0.field_4 >> i; | |
4673 v20 = 11 - v18; | |
4674 v116 = stru_F81018.field_0.field_8 >> i; | |
4675 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4676 v22 = stru_5C6E00; | |
4677 v122 = (unsigned __int16 *)v20; | |
323 | 4678 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4679 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4680 v120 = v116 + 4 * v23; |
4681 if ( v123 < v117 ) | |
4682 { | |
4683 v24 = (char *)&stru_F81018.field_34.field_8; | |
4684 v114 = &stru_F81018.field_34.field_8; | |
4685 a1 += 16; | |
4686 while ( 1 ) | |
4687 { | |
4688 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4689 v25 = *((int *)v24 - 2); | |
4690 LOWORD(v25) = 0; | |
4691 v115 = v97; | |
4692 v26 = stru_F8AD28.field_0 | v25; | |
4693 if ( v97 <= (unsigned int)v26 ) | |
4694 v115 = v26; | |
4695 v97 = v26; | |
4696 v27 = *((int *)v24 - 11); | |
4697 v28 = *((int *)v24 - 1); | |
4698 v105 = (&v86)[4 * v27]; | |
4699 v111 = v27 + 16; | |
4700 v29 = v4->uWidthMinus1; | |
4701 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4702 v107 = v29 >> v27; | |
4703 v30 = v28 >> i; | |
4704 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4705 v31 = *v114 >> i; | |
4706 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4707 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4708 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4709 v108 = (signed int)(v116 - v121) >> 4; |
4710 v103 = (v90 - v120) >> 4; | |
4711 v32 = v123 + 32; | |
4712 if ( LOBYTE(viewparams->field_20) ) | |
4713 v32 = v123 + 64; | |
4714 if ( v32 > v117 ) | |
4715 v32 = v117; | |
4716 v118 = v32; | |
4717 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4718 v106 = (signed int)(v32 - v123) >> 1; | |
4719 if ( v110 >> 16 == v100 >> 16 ) | |
4720 { | |
4721 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4722 if ( LOBYTE(viewparams->field_20) ) | |
4723 { | |
4724 v44 = v123; | |
4725 if ( v123 < v118 ) | |
4726 { | |
4727 v45 = v119; | |
4728 v46 = v122; | |
4729 v47 = v121; | |
4730 v48 = v120; | |
4731 v49 = v111; | |
4732 v50 = v109; | |
4733 if ( v106 & 2 ) | |
4734 { | |
4735 *v119 = v115; | |
4736 v45 -= 2; | |
4737 v44 = v123 + 4; | |
4738 goto LABEL_37; | |
4739 } | |
4740 do | |
4741 { | |
4742 v44 += 8; | |
4743 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4744 v52 = v115; | |
4745 LOWORD(v51) = v46[v51]; | |
4746 *v45 = v115; | |
4747 v45[1] = v52; | |
4748 v45[640] = v52; | |
4749 v45[641] = v52; | |
4750 *(short *)(v44 - 8) = v51; | |
4751 *(short *)(v44 - 6) = v51; | |
4752 *(short *)(v44 + 1272) = v51; | |
4753 *(short *)(v44 + 1274) = v51; | |
4754 v45[2] = v52; | |
4755 v45[3] = v52; | |
4756 v45[642] = v52; | |
4757 v45[643] = v52; | |
4758 v121 += v108; | |
4759 v120 += v103; | |
4760 v47 = v121; | |
4761 v48 = v120; | |
4762 LABEL_37: | |
4763 v45 += 4; | |
4764 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4765 v54 = v108; | |
4766 *(short *)(v44 - 4) = v53; | |
4767 *(short *)(v44 - 2) = v53; | |
4768 *(short *)(v44 + 1276) = v53; | |
4769 *(short *)(v44 + 1278) = v53; | |
4770 v121 += v54; | |
4771 v120 += v103; | |
4772 v47 = v121; | |
4773 v48 = v120; | |
4774 } | |
4775 while ( v44 < v118 ); | |
4776 v123 = v44; | |
4777 v119 = v45; | |
4778 } | |
4779 } | |
4780 else | |
4781 { | |
4782 v33 = v123; | |
4783 if ( v123 < v118 ) | |
4784 { | |
4785 v34 = v119; | |
4786 v35 = v122; | |
4787 v36 = v121; | |
4788 v37 = v120; | |
4789 v38 = v111; | |
4790 v39 = v109; | |
4791 if ( v106 & 1 ) | |
4792 { | |
4793 *v119 = v115; | |
4794 --v34; | |
4795 v33 = v123 + 2; | |
4796 goto LABEL_30; | |
4797 } | |
4798 do | |
4799 { | |
4800 v33 += 4; | |
4801 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4802 v41 = v115; | |
4803 LOWORD(v40) = v35[v40]; | |
4804 *v34 = v115; | |
4805 *(short *)(v33 - 4) = v40; | |
4806 v34[1] = v41; | |
4807 v121 += v108; | |
4808 v120 += v103; | |
4809 v36 = v121; | |
4810 v37 = v120; | |
4811 LABEL_30: | |
4812 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4813 v34 += 2; | |
4814 v43 = v108; | |
4815 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4816 v121 += v43; | |
4817 v120 += v103; | |
4818 v36 = v121; | |
4819 v37 = v120; | |
4820 } | |
4821 while ( v33 < v118 ); | |
4822 v123 = v33; | |
4823 v119 = v34; | |
4824 } | |
4825 } | |
4826 } | |
4827 else | |
4828 { | |
4829 v55 = v110 - ((v100 - v110) >> 4); | |
4830 v110 = (v100 - v110) >> 4; | |
4831 v122 = (unsigned __int16 *)v55; | |
4832 if ( LOBYTE(viewparams->field_20) ) | |
4833 { | |
4834 v71 = v123; | |
4835 if ( v123 < v118 ) | |
4836 { | |
4837 v72 = v119; | |
4838 v73 = v94; | |
4839 v74 = v121; | |
4840 v75 = v120; | |
4841 v76 = v111; | |
4842 v77 = v109; | |
4843 if ( v106 & 2 ) | |
4844 { | |
4845 *v119 = v115; | |
4846 v72 += 2; | |
4847 v71 = v123 + 4; | |
4848 goto LABEL_52; | |
4849 } | |
4850 do | |
4851 { | |
4852 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4853 v79 = (int)((char *)v122 + v110); | |
4854 v71 += 8; | |
4855 v122 = (unsigned __int16 *)v79; | |
4856 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4857 v81 = v115; | |
4858 LOWORD(v80) = v73[v80]; | |
4859 *v72 = v115; | |
4860 v72[1] = v81; | |
4861 v72[640] = v81; | |
4862 v72[641] = v81; | |
4863 *(short *)(v71 - 8) = v80; | |
4864 *(short *)(v71 - 6) = v80; | |
4865 *(short *)(v71 + 1272) = v80; | |
4866 *(short *)(v71 + 1274) = v80; | |
4867 v72[2] = v81; | |
4868 v72[3] = v81; | |
4869 v72[642] = v81; | |
4870 v72[643] = v81; | |
4871 v121 += v108; | |
4872 v120 += v103; | |
4873 v74 = v121; | |
4874 v75 = v120; | |
4875 v72 += 4; | |
4876 LABEL_52: | |
4877 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4878 v83 = (int)((char *)v122 + v110); | |
4879 v84 = v105[v82]; | |
4880 v122 = (unsigned __int16 *)v83; | |
4881 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4882 v85 = v108; | |
4883 *(short *)(v71 - 4) = v84; | |
4884 *(short *)(v71 - 2) = v84; | |
4885 *(short *)(v71 + 1276) = v84; | |
4886 *(short *)(v71 + 1278) = v84; | |
4887 v121 += v85; | |
4888 v120 += v103; | |
4889 v74 = v121; | |
4890 v75 = v120; | |
4891 } | |
4892 while ( v71 < v118 ); | |
4893 v123 = v71; | |
4894 v119 = v72; | |
4895 } | |
4896 } | |
4897 else | |
4898 { | |
4899 v56 = v123; | |
4900 if ( v123 < v118 ) | |
4901 { | |
4902 v57 = v119; | |
4903 v58 = v94; | |
4904 v59 = v121; | |
4905 v60 = v120; | |
4906 v61 = v111; | |
4907 v62 = v109; | |
4908 if ( v106 & 1 ) | |
4909 { | |
4910 *v119 = v115; | |
4911 ++v57; | |
4912 v56 = v123 + 2; | |
4913 goto LABEL_45; | |
4914 } | |
4915 do | |
4916 { | |
4917 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4918 v64 = (int)((char *)v122 + v110); | |
4919 v56 += 4; | |
4920 v122 = (unsigned __int16 *)v64; | |
4921 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4922 v66 = v115; | |
4923 LOWORD(v65) = v58[v65]; | |
4924 *v57 = v115; | |
4925 *(short *)(v56 - 4) = v65; | |
4926 v57[1] = v66; | |
4927 v121 += v108; | |
4928 v120 += v103; | |
4929 v59 = v121; | |
4930 v60 = v120; | |
4931 v57 += 2; | |
4932 LABEL_45: | |
4933 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4934 v68 = (int)((char *)v122 + v110); | |
4935 v69 = v105[v67]; | |
4936 v122 = (unsigned __int16 *)v68; | |
4937 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4938 v70 = v108; | |
4939 *(short *)(v56 - 2) = v69; | |
4940 v121 += v70; | |
4941 v120 += v103; | |
4942 v59 = v121; | |
4943 v60 = v120; | |
4944 } | |
4945 while ( v56 < v118 ); | |
4946 v123 = v56; | |
4947 v119 = v57; | |
4948 } | |
4949 } | |
4950 } | |
4951 v114 += 13; | |
4952 v110 = v100; | |
4953 a1 += 16; | |
4954 v4 = v96; | |
4955 v121 = v116; | |
4956 v120 = v90; | |
4957 if ( v123 >= v117 ) | |
4958 break; | |
4959 v24 = (char *)v114; | |
4960 v22 = stru_5C6E00; | |
4961 } | |
4962 } | |
4963 ++a2; | |
4964 v98 += v95; | |
4965 result = a2; | |
4966 v101 += 2; | |
4967 v99 += 640; | |
4968 if ( a2 > stru_F8A590._viewport_space_w ) | |
4969 break; | |
4970 v12 = v101; | |
4971 result = a2; | |
4972 v11 = v98; | |
4973 } | |
4974 } | |
4975 } | |
4976 } | |
4977 } | |
4978 } | |
4979 } | |
4980 } | |
4981 return result; | |
4982 } | |
4983 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4984 | |
4985 //----- (004ADD1D) -------------------------------------------------------- | |
4986 void __fastcall sub_4ADD1D(int uFaceID) | |
4987 { | |
4988 int v1; // edi@1 | |
4989 BLVFace *v2; // esi@3 | |
4990 signed int v3; // ebx@4 | |
4991 Texture *v4; // edi@9 | |
4992 signed int v5; // eax@9 | |
4993 char *v6; // edi@12 | |
4994 signed int v7; // eax@15 | |
4995 unsigned int v8; // eax@16 | |
4996 __int16 v9; // cx@19 | |
4997 unsigned __int8 *v10; // eax@19 | |
4998 unsigned __int16 *v11; // eax@19 | |
4999 int v12; // edi@19 | |
5000 int v13; // ebx@20 | |
5001 stru352 *v14; // esi@20 | |
5002 DWORD v15; // eax@22 | |
5003 signed int v16; // ecx@22 | |
5004 signed int v17; // ST68_4@22 | |
5005 int v18; // eax@22 | |
5006 int v19; // ecx@22 | |
5007 unsigned int v20; // esi@23 | |
5008 int v21; // edi@23 | |
5009 int v22; // eax@23 | |
5010 int *v23; // ebx@24 | |
5011 int v24; // edx@24 | |
5012 int v25; // ebx@25 | |
5013 unsigned __int16 v26; // cx@25 | |
5014 int v27; // edx@26 | |
5015 unsigned __int16 v28; // cx@26 | |
5016 unsigned __int8 v29; // sf@27 | |
5017 unsigned __int8 v30; // of@27 | |
5018 unsigned int v31; // esi@29 | |
5019 int v32; // edi@29 | |
5020 unsigned __int16 *v33; // eax@29 | |
5021 int *v34; // ebx@30 | |
5022 int v35; // edx@30 | |
5023 int v36; // ebx@31 | |
5024 unsigned __int16 v37; // cx@31 | |
5025 int v38; // edx@32 | |
5026 unsigned __int16 v39; // cx@32 | |
5027 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5028 int v41; // [sp-Ch] [bp-68h]@15 | |
5029 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5030 signed int v43; // [sp+14h] [bp-48h]@12 | |
5031 signed int v44; // [sp+14h] [bp-48h]@22 | |
5032 int v45; // [sp+1Ch] [bp-40h]@22 | |
5033 int v46; // [sp+20h] [bp-3Ch]@22 | |
5034 int v47; // [sp+24h] [bp-38h]@19 | |
5035 char v48; // [sp+28h] [bp-34h]@19 | |
5036 int v49; // [sp+2Ch] [bp-30h]@19 | |
5037 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5038 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5039 int v52; // [sp+38h] [bp-24h]@22 | |
5040 int v53; // [sp+3Ch] [bp-20h]@22 | |
5041 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5042 int v55; // [sp+40h] [bp-1Ch]@20 | |
5043 int v56; // [sp+44h] [bp-18h]@20 | |
5044 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5045 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5046 int v59; // [sp+50h] [bp-Ch]@4 | |
5047 int v60; // [sp+50h] [bp-Ch]@19 | |
5048 int v61; // [sp+54h] [bp-8h]@22 | |
5049 int *v62; // [sp+58h] [bp-4h]@23 | |
5050 int *v63; // [sp+58h] [bp-4h]@29 | |
5051 | |
5052 v1 = uFaceID; | |
5053 v42 = pRenderer->uTargetSurfacePitch; | |
5054 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5055 { | |
5056 v2 = &pIndoor->pFaces[uFaceID]; | |
5057 if ( pRenderer->pRenderD3D ) | |
5058 { | |
5059 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5060 v59 = v3; | |
5061 } | |
5062 else | |
5063 { | |
5064 v59 = sub_423B5D(uFaceID); | |
5065 v3 = v59; | |
5066 } | |
5067 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5068 { | |
5069 v4 = v2->GetTexture(); | |
5070 v5 = 0; | |
5071 if ( v4 ) | |
5072 { | |
5073 if ( pRenderer->pRenderD3D ) | |
5074 { | |
5075 if ( v3 > 0 ) | |
5076 { | |
5077 v54 = v3; | |
5078 v43 = v3; | |
5079 v6 = (char *)&array_507D30[0].v; | |
5080 do | |
5081 { | |
5082 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5083 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5084 v6 += 48; | |
5085 --v54; | |
5086 } | |
5087 while ( v54 ); | |
5088 v3 = v59; | |
5089 v5 = v43; | |
5090 } | |
5091 v7 = v5; | |
5092 v41 = stru_F8AD28.field_0; | |
5093 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5094 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5095 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5096 { | |
5097 v40 = v2->GetTexture(); | |
5098 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5099 } | |
5100 else | |
5101 { | |
5102 v40 = v2->GetTexture(); | |
5103 v8 = v2->uBitmapID; | |
5104 } | |
5105 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5106 } | |
5107 else | |
5108 { | |
5109 v49 = v4->uWidthMinus1; | |
5110 v47 = v4->uHeightMinus1 << 16; | |
5111 v9 = 16 - v4->uWidthLn2; | |
710 | 5112 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5113 LOBYTE(v2->uAttributes) |= 0x80u; |
5114 v48 = v9; | |
5115 v50 = v10; | |
5116 sub_4AF412(); | |
5117 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5118 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5119 v12 = stru_F8A590._viewport_space_y; | |
5120 v51 = v11; | |
5121 v60 = stru_F8A590._viewport_space_y; | |
5122 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5123 { | |
5124 v13 = 2 * stru_F8A590._viewport_space_y; | |
5125 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5126 v55 = 2 * stru_F8A590._viewport_space_y; | |
5127 v56 = 640 * stru_F8A590._viewport_space_y; | |
5128 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5129 { | |
5130 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5131 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5132 v15 = GetTickCount(); | |
5133 v16 = v14->field_0; | |
5134 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5135 v45 = v14->field_4 >> 3; | |
5136 v44 = v16 >> 3; | |
5137 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5138 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5139 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5140 v18 = v14->field_28; | |
5141 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5142 LOWORD(v18) = 0; | |
5143 v46 = stru_F8AD28.field_0 | v18; | |
5144 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5145 if ( LOBYTE(viewparams->field_20) ) | |
5146 { | |
5147 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5148 - pBLVRenderParams->uViewportX]; | |
5149 v31 = v44; | |
5150 v32 = v45; | |
5151 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5152 + 2 * v19 | |
5153 - pBLVRenderParams->uViewportX]; | |
5154 if ( v61 & 1 ) | |
5155 { | |
5156 --v61; | |
5157 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5158 + 2 * v19 | |
5159 - pBLVRenderParams->uViewportX | |
5160 - 2]; | |
5161 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5162 - pBLVRenderParams->uViewportX]; | |
5163 v35 = v46; | |
5164 v63 += 2; | |
5165 goto LABEL_32; | |
5166 } | |
5167 while ( 1 ) | |
5168 { | |
5169 v30 = __OFSUB__(v61, 2); | |
5170 v29 = v61 - 2 < 0; | |
5171 v61 -= 2; | |
5172 if ( v29 ^ v30 ) | |
5173 break; | |
5174 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5175 v31 += v52; | |
5176 v37 = v51[v36]; | |
5177 v32 += v53; | |
5178 v34 = v63; | |
5179 v35 = v46; | |
5180 *v33 = v37; | |
5181 v33[1] = v37; | |
5182 v33[640] = v37; | |
5183 v33[641] = v37; | |
5184 v63 += 4; | |
5185 v34[2] = v46; | |
5186 v34[3] = v46; | |
5187 v34[642] = v46; | |
5188 v34[643] = v46; | |
5189 LABEL_32: | |
5190 *v34 = v35; | |
5191 v34[1] = v35; | |
5192 v34[640] = v35; | |
5193 v34[641] = v35; | |
5194 v38 = v49 & (v31 >> 16); | |
5195 v33 += 4; | |
5196 v31 += v52; | |
5197 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5198 v32 += v53; | |
5199 *(v33 - 2) = v39; | |
5200 *(v33 - 1) = v39; | |
5201 v33[638] = v39; | |
5202 v33[639] = v39; | |
5203 } | |
5204 } | |
5205 else | |
5206 { | |
5207 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5208 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5209 v20 = v44; | |
5210 v21 = v45; | |
5211 v22 = (int)v58; | |
5212 if ( v61 & 1 ) | |
5213 { | |
5214 --v61; | |
5215 v22 = (int)(v58 - 1); | |
5216 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5217 v24 = v46; | |
5218 ++v62; | |
5219 goto LABEL_26; | |
5220 } | |
5221 while ( 1 ) | |
5222 { | |
5223 v30 = __OFSUB__(v61, 2); | |
5224 v29 = v61 - 2 < 0; | |
5225 v61 -= 2; | |
5226 if ( v29 ^ v30 ) | |
5227 break; | |
5228 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5229 v20 += v52; | |
5230 v26 = v51[v25]; | |
5231 v21 += v53; | |
5232 v23 = v62; | |
5233 v24 = v46; | |
5234 *(short *)v22 = v26; | |
5235 v62 += 2; | |
5236 v23[1] = v46; | |
5237 LABEL_26: | |
5238 *v23 = v24; | |
5239 v27 = v49 & (v20 >> 16); | |
5240 v22 += 4; | |
5241 v20 += v52; | |
5242 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5243 v21 += v53; | |
5244 *(short *)(v22 - 2) = v28; | |
5245 } | |
5246 } | |
5247 ++v60; | |
5248 ++i; | |
5249 v56 += 640; | |
5250 v55 += 2; | |
5251 if ( v60 > stru_F8A590._viewport_space_w ) | |
5252 break; | |
5253 v13 = v55; | |
5254 v12 = v60; | |
5255 } | |
5256 } | |
5257 } | |
5258 } | |
5259 } | |
5260 } | |
5261 } | |
5262 | |
5263 //----- (004AE1E7) -------------------------------------------------------- | |
5264 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5265 { | |
5266 int v3; // ebx@1 | |
5267 int v4; // edi@1 | |
5268 int v5; // esi@1 | |
5269 signed __int64 v6; // qtt@3 | |
5270 int v7; // esi@3 | |
5271 int v8; // eax@5 | |
5272 int result; // eax@5 | |
5273 int v10; // edx@5 | |
5274 int v11; // [sp+Ch] [bp-8h]@1 | |
5275 int v12; // [sp+1Ch] [bp+8h]@2 | |
5276 | |
5277 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5278 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5279 v11 = a1; | |
5280 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5281 + stru_F8AD28.field_7C | |
5282 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5283 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5284 { | |
5285 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5286 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5287 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5288 } | |
5289 else | |
5290 { | |
5291 v7 = 1073741824; | |
5292 } | |
5293 v8 = stru_F8AD28.vec_9C.z; | |
5294 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5295 + stru_F8AD28.vec_8C.x | |
5296 + v4 * stru_F8AD28.vec_8C.y) | |
5297 * (signed __int64)v7) >> 16) | |
5298 + stru_F8AD28.field_98; | |
5299 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5300 v10 = result + stru_F8AD28.field_A8; | |
5301 stru_F83B80[v11].field_28 = v7; | |
5302 stru_F83B80[v11].field_4 = v10; | |
5303 return result; | |
5304 } | |
5305 | |
5306 //----- (004AE313) -------------------------------------------------------- | |
5307 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5308 { | |
5309 int _dy; // ebx@1 | |
5310 int _dx; // edi@1 | |
5311 int v5; // ecx@1 | |
5312 int v6; // esi@1 | |
5313 int v7; // ST18_4@2 | |
5314 signed __int64 v8; // qtt@3 | |
5315 unsigned int v9; // ecx@3 | |
5316 int result; // eax@8 | |
5317 int v11; // [sp+Ch] [bp-8h]@1 | |
5318 | |
5319 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5320 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5321 ++pBLVRenderParams->field_88; | |
5322 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5323 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5324 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5325 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5326 { | |
5327 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5328 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5329 v9 = v8 / v11; | |
5330 } | |
5331 else | |
5332 { | |
5333 v9 = 0x40000000u; | |
5334 } | |
5335 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5336 p->field_0 = v9; | |
5337 else | |
5338 p->field_0 = stru_F8AD28.field_34; | |
5339 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5340 * (signed __int64)(signed int)v9) >> 16) | |
5341 + stru_F8AD28.field_98 | |
5342 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5343 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5344 * (signed __int64)(signed int)v9) >> 16) | |
5345 + stru_F8AD28.field_A8 | |
5346 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5347 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5348 if ( result < 369620 || bUseLoResSprites ) | |
5349 { | |
5350 if ( result < 184810 ) | |
5351 p->field_10 = result > 92405; | |
5352 else | |
5353 p->field_10 = 2; | |
5354 } | |
5355 else | |
5356 { | |
5357 p->field_10 = 3; | |
5358 } | |
5359 return result; | |
5360 } | |
5361 | |
5362 //----- (004AE491) -------------------------------------------------------- | |
5363 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5364 { | |
5365 signed int v2; // eax@1 | |
5366 signed int v3; // edi@1 | |
5367 int v4; // ecx@1 | |
5368 int v5; // esi@2 | |
5369 int v6; // eax@2 | |
5370 int v7; // ebx@2 | |
5371 unsigned int v8; // ecx@2 | |
5372 int v9; // edx@5 | |
5373 int v10; // edx@7 | |
5374 unsigned int v11; // eax@8 | |
5375 int v13; // [sp+4h] [bp-18h]@2 | |
5376 int v14; // [sp+8h] [bp-14h]@2 | |
5377 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5378 int v16; // [sp+14h] [bp-8h]@1 | |
5379 int v17; // [sp+18h] [bp-4h]@1 | |
5380 | |
5381 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5382 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5383 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5384 v4 = 0; | |
5385 v15 = v2; | |
5386 v16 = 0; | |
5387 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5388 { | |
5389 do | |
5390 { | |
5391 v5 = v16; | |
5392 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5393 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5394 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5395 v7 = v13; | |
5396 v8 = v14; | |
5397 if ( v6 < v13 ) | |
5398 { | |
5399 v6 = v13; | |
5400 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5401 } | |
5402 if ( v6 < v14 ) | |
5403 { | |
5404 v9 = v6; | |
5405 v6 = v14; | |
5406 v8 = v9; | |
5407 } | |
5408 if ( v7 < (signed int)v8 ) | |
5409 { | |
5410 v10 = v8; | |
5411 v8 = v7; | |
5412 v7 = v10; | |
5413 } | |
5414 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5415 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5416 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5417 ++v16; | |
5418 v2 = v15; | |
5419 } | |
5420 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5421 v4 = 0; | |
5422 } | |
5423 if ( stru_F8AD28.field_3E4 != v4 ) | |
5424 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5425 if ( v17 >= v4 ) | |
5426 { | |
5427 if ( v17 > 2031616 ) | |
5428 v17 = 2031616; | |
5429 } | |
5430 else | |
5431 { | |
5432 v17 = v4; | |
5433 } | |
5434 ++pBLVRenderParams->field_8C; | |
5435 return v17; | |
5436 } | |
5437 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5438 | |
5439 //----- (004AE5F1) -------------------------------------------------------- | |
5440 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5441 { | |
5442 BLVFace *v1; // esi@1 | |
5443 BLVFaceExtra *v2; // ebx@1 | |
5444 int v3; // eax@1 | |
5445 int v4; // edi@1 | |
5446 Texture *v5; // edi@1 | |
5447 int v6; // eax@1 | |
5448 unsigned int v7; // eax@1 | |
5449 unsigned int v8; // ecx@1 | |
5450 unsigned int v9; // eax@1 | |
5451 unsigned int v10; // ecx@5 | |
5452 int v11; // edi@10 | |
5453 int v12; // ecx@10 | |
5454 int v13; // eax@10 | |
5455 int v14; // edx@10 | |
5456 int v15; // ebx@12 | |
5457 double v16; // st7@16 | |
5458 int v17; // eax@16 | |
5459 char *v18; // ebx@17 | |
5460 int v19; // ecx@19 | |
5461 int v20; // eax@19 | |
5462 int v21; // edx@21 | |
5463 int v22; // eax@23 | |
5464 int v23; // ST04_4@26 | |
5465 int v24; // edi@26 | |
5466 double v25; // st6@26 | |
5467 int v26; // eax@26 | |
5468 double v27; // st6@26 | |
5469 int v28; // ecx@26 | |
5470 char v29; // al@26 | |
5471 int v30; // edx@28 | |
5472 int v31; // ecx@28 | |
5473 BLVLightMM7 *v32; // ecx@32 | |
5474 int v33; // edi@33 | |
5475 int v34; // edx@33 | |
5476 int v35; // eax@33 | |
5477 int v36; // edi@35 | |
5478 int v37; // edx@37 | |
5479 int v38; // ebx@39 | |
5480 int v39; // edi@42 | |
5481 int v40; // eax@42 | |
5482 char *v41; // ebx@45 | |
5483 signed int v42; // ecx@47 | |
5484 int v43; // edi@47 | |
5485 int v44; // eax@49 | |
5486 int v45; // edx@51 | |
5487 int v46; // eax@53 | |
5488 int v47; // ST04_4@55 | |
5489 int v48; // edi@55 | |
5490 double v49; // st6@55 | |
5491 int v50; // eax@55 | |
5492 double v51; // st6@55 | |
5493 int v52; // eax@55 | |
5494 int v53; // ecx@57 | |
5495 int v54; // ecx@58 | |
5496 int v55; // ecx@59 | |
5497 int v56; // edx@62 | |
5498 int v57; // ecx@62 | |
5499 int v58; // eax@63 | |
5500 int v59; // edx@64 | |
5501 int v60; // ecx@67 | |
5502 int v61; // edx@67 | |
5503 int v62; // eax@68 | |
5504 int v63; // edx@69 | |
5505 signed int v64; // ecx@72 | |
5506 double v65; // st7@75 | |
5507 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5508 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5509 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5510 int v69; // [sp+28h] [bp-18h]@10 | |
5511 int v70; // [sp+2Ch] [bp-14h]@10 | |
5512 int X; // [sp+30h] [bp-10h]@10 | |
5513 int v72; // [sp+34h] [bp-Ch]@10 | |
5514 int v73; // [sp+38h] [bp-8h]@10 | |
5515 int v74; // [sp+3Ch] [bp-4h]@10 | |
5516 | |
5517 v1 = &pIndoor->pFaces[uFaceID]; | |
5518 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5519 v3 = v1->uBitmapID; | |
5520 v4 = v1->uBitmapID; | |
5521 v68 = v2; | |
5522 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5523 v6 = 8 * uFaceID; | |
862 | 5524 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5525 stru_F8AD28.field_0 = v6; |
5526 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5527 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5528 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5529 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5530 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5531 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5532 v7 = GetTickCount(); | |
5533 v8 = v1->uAttributes; | |
5534 v9 = v7 >> 3; | |
5535 if ( v8 & 4 ) | |
5536 { | |
5537 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5538 } | |
5539 else | |
5540 { | |
5541 if ( v8 & 0x20 ) | |
5542 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5543 } | |
5544 v10 = v1->uAttributes; | |
5545 if ( BYTE1(v10) & 8 ) | |
5546 { | |
5547 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5548 } | |
5549 else | |
5550 { | |
5551 if ( v10 & 0x40 ) | |
5552 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5553 } | |
5554 v1->_get_normals(&v67, &v66); | |
5555 stru_F8AD28.vec_14.x = v67.x; | |
5556 stru_F8AD28.vec_14.y = v67.y; | |
5557 stru_F8AD28.vec_14.z = v67.z; | |
5558 stru_F8AD28.vec_20.x = v66.x; | |
5559 stru_F8AD28.vec_20.y = v66.y; | |
5560 stru_F8AD28.vec_20.z = v66.z; | |
5561 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5562 if ( pBLVRenderParams->sPartyRotX ) | |
5563 { | |
5564 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5565 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5566 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5567 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5568 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5569 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5570 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5571 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5572 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5573 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5574 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5575 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5576 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5577 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5578 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5579 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5580 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5581 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5582 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5583 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5584 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5585 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5586 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5587 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5588 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5589 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5590 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5591 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5592 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5593 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5594 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5595 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5596 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5597 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5598 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5599 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5600 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5601 v13 = pBLVRenderParams->vPartyPos.y; | |
5602 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5603 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5604 v14 = pBLVRenderParams->vPartyPos.x; | |
5605 } | |
5606 else | |
5607 { | |
5608 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5609 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5610 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5611 - v70; | |
5612 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5613 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5614 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5615 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5616 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5617 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5618 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5619 - v70; | |
5620 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5621 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5622 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5623 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5624 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5625 - v70; | |
5626 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5627 v14 = pBLVRenderParams->vPartyPos.x; | |
5628 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5629 v13 = pBLVRenderParams->vPartyPos.y; | |
5630 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5631 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5632 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5633 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5634 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5635 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5636 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5637 } | |
5638 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5639 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5640 + stru_F8AD28.plane_4.dist | |
5641 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5642 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5643 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5644 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5645 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5646 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5647 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5648 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5649 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5650 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5651 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5652 v15 = v70; | |
5653 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5654 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5655 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5656 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5657 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5658 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5659 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5660 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5661 stru_F8AD28.field_38 = 0; | |
5662 stru_F8AD28.field_A8 = -(X | |
5663 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5664 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5665 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5666 { | |
5667 stru_F8AD28.field_3E4 = 1; | |
5668 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5669 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5670 stru_F8AD28.field_3F0 = v68->field_1E; | |
5671 stru_F8AD28.field_3F4 = v68->field_20; | |
5672 } | |
5673 else | |
5674 { | |
5675 stru_F8AD28.field_3E4 = 0; | |
5676 } | |
5677 v16 = 0.0039215689; | |
5678 v17 = 116 * v1->uSectorID; | |
5679 v69 = v17; | |
5680 v74 = 0; | |
5681 v73 = 0; | |
5682 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5683 v70 = pMobileLightsStack->uNumLightsActive; | |
5684 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5685 { | |
5686 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5687 do | |
5688 { | |
5689 if ( v74 >= 20 ) | |
5690 break; | |
5691 v19 = *((short *)v18 + 2); | |
5692 v20 = *((short *)v18 - 1); | |
5693 if ( v20 > v1->pBounding.x1 - v19 ) | |
5694 { | |
5695 if ( v20 < v19 + v1->pBounding.x2 ) | |
5696 { | |
5697 v21 = *(short *)v18; | |
5698 if ( v21 > v1->pBounding.y1 - v19 ) | |
5699 { | |
5700 if ( v21 < v19 + v1->pBounding.y2 ) | |
5701 { | |
5702 v22 = *((short *)v18 + 1); | |
5703 if ( v22 > v1->pBounding.z1 - v19 ) | |
5704 { | |
5705 if ( v22 < v19 + v1->pBounding.z2 ) | |
5706 { | |
5707 X = (v1->pFacePlane_old.dist | |
5708 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5709 + v21 * v1->pFacePlane_old.vNormal.y | |
5710 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5711 if ( X <= v19 ) | |
5712 { | |
5713 v23 = X; | |
5714 v24 = v74; | |
5715 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5716 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5717 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5718 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5719 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5720 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5721 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5722 v25 = (double)(signed int)v68 * v16; | |
5723 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5724 v26 = (unsigned __int8)v18[8]; | |
5725 *(float *)(v24 * 4 + 16297992) = v25; | |
5726 v27 = (double)(signed int)v68; | |
5727 v68 = (BLVFaceExtra *)v26; | |
5728 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5729 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5730 v16 = 0.0039215689; | |
5731 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5732 v28 = v74; | |
5733 v29 = v18[9]; | |
5734 ++v74; | |
5735 stru_F8AD28._blv_lights_types[v28] = v29; | |
5736 } | |
5737 } | |
5738 } | |
5739 } | |
5740 } | |
5741 } | |
5742 } | |
5743 ++v73; | |
5744 v18 += 18; | |
5745 v17 = v69; | |
5746 } | |
5747 while ( v73 < v70 ); | |
5748 } | |
5749 v30 = 0; | |
5750 v73 = 0; | |
5751 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5752 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5753 if ( v31 > 0 ) | |
5754 { | |
5755 while ( v74 < 20 ) | |
5756 { | |
5757 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5758 if ( !(v32->uAtributes & 8) ) | |
5759 { | |
5760 v33 = v1->pBounding.x1; | |
5761 v34 = v32->vPosition.x; | |
5762 X = v32->uBrightness; | |
5763 v35 = v32->uRadius; | |
5764 v68 = (BLVFaceExtra *)v32->uRadius; | |
5765 if ( v34 > v33 - v35 ) | |
5766 { | |
5767 if ( v34 < v35 + v1->pBounding.x2 ) | |
5768 { | |
5769 v36 = v32->vPosition.y; | |
5770 if ( v36 > v1->pBounding.y1 - v35 ) | |
5771 { | |
5772 if ( v36 < v35 + v1->pBounding.y2 ) | |
5773 { | |
5774 v37 = v32->vPosition.z; | |
5775 if ( v37 > v1->pBounding.z1 - v35 ) | |
5776 { | |
5777 if ( v37 < v35 + v1->pBounding.z2 ) | |
5778 { | |
5779 v38 = (v1->pFacePlane_old.dist | |
5780 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5781 + v37 * v1->pFacePlane_old.vNormal.z | |
5782 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5783 if ( v38 >= 0 ) | |
5784 { | |
5785 if ( v38 <= v35 && v35 ) | |
5786 { | |
5787 v39 = v74; | |
5788 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5789 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5790 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5791 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5792 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5793 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5794 v68 = (BLVFaceExtra *)v32->uRed; | |
5795 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5796 v68 = (BLVFaceExtra *)v32->uGreen; | |
5797 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5798 v68 = (BLVFaceExtra *)v32->uBlue; | |
5799 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5800 v16 = 0.0039215689; | |
5801 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5802 v40 = v74++; | |
5803 stru_F8AD28._blv_lights_types[v40] = 1; | |
5804 } | |
5805 } | |
5806 } | |
5807 } | |
5808 } | |
5809 } | |
5810 } | |
5811 } | |
5812 } | |
5813 v30 = v73++ + 1; | |
5814 if ( v73 >= v70 ) | |
5815 break; | |
5816 v17 = v69; | |
5817 } | |
5818 } | |
5819 v73 = 0; | |
5820 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5821 { | |
5822 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5823 do | |
5824 { | |
5825 if ( v74 >= 20 ) | |
5826 break; | |
5827 v42 = *((short *)v41 + 2); | |
5828 v43 = *((short *)v41 - 1); | |
5829 if ( v43 > v1->pBounding.x1 - v42 ) | |
5830 { | |
5831 if ( v43 < v42 + v1->pBounding.x2 ) | |
5832 { | |
5833 v44 = *(short *)v41; | |
5834 if ( v44 > v1->pBounding.y1 - v42 ) | |
5835 { | |
5836 if ( v44 < v42 + v1->pBounding.y2 ) | |
5837 { | |
5838 v45 = *((short *)v41 + 1); | |
5839 if ( v45 > v1->pBounding.z1 - v42 ) | |
5840 { | |
5841 if ( v45 < v42 + v1->pBounding.z2 ) | |
5842 { | |
5843 v46 = (v1->pFacePlane_old.dist | |
5844 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5845 + v43 * v1->pFacePlane_old.vNormal.x | |
5846 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5847 v69 = v46; | |
5848 if ( v46 >= 0 ) | |
5849 { | |
5850 if ( v46 <= v42 ) | |
5851 { | |
5852 v47 = v69; | |
5853 v48 = v74; | |
5854 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5855 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5856 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5857 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5858 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5859 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5860 v49 = (double)(signed int)v68 * v16; | |
5861 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5862 v50 = (unsigned __int8)v41[8]; | |
5863 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5864 v51 = (double)(signed int)v68; | |
5865 v68 = (BLVFaceExtra *)v50; | |
5866 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5867 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5868 v16 = 0.0039215689; | |
5869 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5870 v52 = v74++; | |
5871 stru_F8AD28._blv_lights_types[v52] = 1; | |
5872 } | |
5873 } | |
5874 } | |
5875 } | |
5876 } | |
5877 } | |
5878 } | |
5879 } | |
5880 ++v73; | |
5881 v41 += 12; | |
5882 } | |
5883 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5884 } | |
5885 stru_F8AD28.uNumLightsApplied = v74; | |
5886 v53 = v1->pBounding.x2; | |
5887 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5888 { | |
5889 v55 = v1->pBounding.x1; | |
5890 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5891 v54 = 0; | |
5892 else | |
5893 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5894 } | |
5895 else | |
5896 { | |
5897 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5898 } | |
5899 v56 = v1->pBounding.y2; | |
5900 v57 = v54 * v54; | |
5901 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5902 { | |
5903 v59 = v1->pBounding.y1; | |
5904 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5905 v58 = 0; | |
5906 else | |
5907 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5908 } | |
5909 else | |
5910 { | |
5911 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5912 } | |
5913 v60 = v58 * v58 + v57; | |
5914 v61 = v1->pBounding.z2; | |
5915 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5916 { | |
5917 v63 = v1->pBounding.z1; | |
5918 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5919 v62 = 0; | |
5920 else | |
5921 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5922 } | |
5923 else | |
5924 { | |
5925 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5926 } | |
5927 v64 = v62 * v62 + v60; | |
5928 if ( v64 ) | |
295 | 5929 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5930 else |
5931 stru_F8AD28.field_34 = 0; | |
5932 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5933 v65 = (double)(signed int)v68; | |
5934 if ( v65 >= 655.36 ) | |
5935 { | |
5936 if ( v65 >= 26214.4 ) | |
5937 { | |
5938 if ( v65 >= 45875.2 ) | |
5939 { | |
5940 stru_F8AD28.field_44 = 8; | |
5941 stru_F8AD28.field_48 = 3; | |
5942 } | |
5943 else | |
5944 { | |
5945 stru_F8AD28.field_44 = 16; | |
5946 stru_F8AD28.field_48 = 4; | |
5947 } | |
5948 } | |
5949 else | |
5950 { | |
5951 stru_F8AD28.field_44 = 32; | |
5952 stru_F8AD28.field_48 = 5; | |
5953 } | |
5954 } | |
5955 else | |
5956 { | |
5957 stru_F8AD28.field_44 = 64; | |
5958 stru_F8AD28.field_48 = 6; | |
5959 } | |
5960 } | |
5961 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5962 | |
5963 //----- (004AF412) -------------------------------------------------------- | |
5964 int __cdecl sub_4AF412() | |
5965 { | |
5966 int v0; // ST20_4@2 | |
5967 int v1; // ST20_4@2 | |
5968 int v2; // ST20_4@2 | |
5969 int v3; // esi@2 | |
5970 int v4; // ST20_4@2 | |
5971 int v5; // ecx@2 | |
5972 int v6; // ebx@2 | |
5973 int v7; // edi@2 | |
5974 int v8; // edx@2 | |
5975 int v9; // eax@2 | |
5976 int result; // eax@4 | |
5977 | |
5978 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5979 stru_F8AD28.vec_20.y = -65536; | |
5980 stru_F8AD28.plane_4.vNormal.x = 0; | |
5981 stru_F8AD28.plane_4.vNormal.y = 0; | |
5982 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5983 stru_F8AD28.vec_14.x = 65536; | |
5984 stru_F8AD28.vec_14.y = 0; | |
5985 stru_F8AD28.vec_14.z = 0; | |
5986 stru_F8AD28.vec_20.x = 0; | |
5987 stru_F8AD28.vec_20.z = 0; | |
5988 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5989 if ( pBLVRenderParams->sPartyRotX ) | |
5990 { | |
5991 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5992 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5993 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5994 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5995 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5996 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5997 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5998 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5999 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6000 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6001 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
6002 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6003 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6004 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6005 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6006 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6007 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6008 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6009 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6010 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6011 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6012 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6013 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6014 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6015 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6016 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6017 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6018 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6019 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6020 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6021 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6022 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6023 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6024 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6025 v6 = pBLVRenderParams->vPartyPos.z; | |
6026 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6027 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6028 v8 = pBLVRenderParams->vPartyPos.y; | |
6029 v9 = pBLVRenderParams->vPartyPos.x; | |
6030 } | |
6031 else | |
6032 { | |
6033 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6034 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6035 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6036 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6037 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6038 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6039 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6040 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6041 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6042 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6043 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6044 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6045 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6046 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6047 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6048 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6049 v8 = pBLVRenderParams->vPartyPos.y; | |
6050 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6051 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6052 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6053 v9 = pBLVRenderParams->vPartyPos.x; | |
6054 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6055 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6056 v6 = pBLVRenderParams->vPartyPos.z; | |
6057 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6058 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6059 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6060 } | |
6061 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6062 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6063 + stru_F8AD28.plane_4.dist | |
6064 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6065 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6066 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6067 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6068 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6069 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6070 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6071 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6072 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6073 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6074 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6075 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6076 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6077 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6078 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6079 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6080 result = 0; | |
6081 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6082 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6083 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6084 stru_F8AD28.field_38 = 0; | |
6085 stru_F8AD28.field_3E4 = 0; | |
6086 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6087 stru_F8AD28.uNumLightsApplied = 0; | |
6088 stru_F8AD28.field_34 = 0; | |
6089 return result; | |
6090 } | |
6091 | |
6092 //----- (004B1447) -------------------------------------------------------- | |
6093 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6094 { | |
6095 signed int v3; // esi@1 | |
6096 char v4; // sf@8 | |
6097 int v5; // eax@8 | |
6098 unsigned __int64 v6; // qax@12 | |
6099 DDM_DLV_Header *v7; // eax@14 | |
6100 Player **v8; // edi@18 | |
6101 Player *result; // eax@19 | |
735 | 6102 //char *v10; // esi@20 |
0 | 6103 |
6104 v3 = 0; | |
6105 if ( a2 ) | |
6106 { | |
6107 if ( a2 != 1 ) | |
6108 { | |
6109 if ( a2 == 2 ) | |
6110 v3 = 2; | |
6111 goto LABEL_13; | |
6112 } | |
6113 v3 = 2; | |
6114 } | |
6115 else | |
6116 { | |
6117 v3 = 1; | |
6118 } | |
6119 if ( pParty->uFine < 4000000 ) | |
6120 { | |
6121 v4 = a3 + pParty->uFine < 0; | |
6122 v5 = a3 + pParty->uFine; | |
6123 pParty->uFine += a3; | |
6124 if ( v4 ) | |
6125 { | |
6126 v5 = 0; | |
6127 pParty->uFine = 0; | |
6128 } | |
6129 if ( v5 > 4000000 ) | |
6130 pParty->uFine = 4000000; | |
6131 } | |
487 | 6132 |
6133 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6134 | |
0 | 6135 LABEL_13: |
463 | 6136 pParty->InTheShopFlags[a1] = 1; |
0 | 6137 if ( v3 ) |
6138 { | |
6139 v7 = &pOutdoor->ddm; | |
6140 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6141 v7 = &pIndoor->dlv; | |
6142 v7->uReputation += v3; | |
6143 if ( v7->uReputation > 10000 ) | |
6144 v7->uReputation = 10000; | |
6145 } | |
6146 v8 = &pPlayers[1]; | |
6147 do | |
6148 { | |
6149 result = *v8; | |
6150 if ( pParty->uFine ) | |
6151 { | |
735 | 6152 //v10 = result->_guilds_member_bits; |
484 | 6153 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6154 if ( !(short)result ) |
735 | 6155 __debugbreak(); |
501 | 6156 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6157 } |
6158 ++v8; | |
6159 } | |
6160 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6161 return result; | |
6162 } | |
6163 | |
6164 //----- (004B1523) -------------------------------------------------------- | |
762 | 6165 void __thiscall sub_4B1523(int *_this) |
0 | 6166 { |
6167 int v1; // esi@1 | |
6168 int v2; // edx@1 | |
6169 unsigned int v3; // eax@2 | |
6170 int v4; // eax@4 | |
6171 LONG v5; // ecx@4 | |
6172 int v6; // eax@10 | |
6173 char *v7; // ST44_4@12 | |
6174 unsigned __int16 v8; // ax@12 | |
6175 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6176 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6177 POINT a2; // [sp+64h] [bp-10h]@1 | |
6178 int v13; // [sp+6Ch] [bp-8h]@4 | |
6179 int v14; // [sp+70h] [bp-4h]@4 | |
6180 | |
6181 v1 = *_this - 399; | |
6182 v2 = (*_this - 400) % 11 + 1; | |
6183 v11 = 4 * (*_this - 400) / 11; | |
6184 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6185 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6186 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6187 else | |
6188 v3 = 30; | |
6189 a1.Hint = 0; | |
6190 a1.uFrameY = v3; | |
6191 a1.uFrameWidth = 328; | |
6192 a1.uFrameHeight = 68; | |
6193 a1.uFrameX = 90; | |
6194 a1.uFrameZ = 417; | |
6195 a1.uFrameW = v3 + 67; | |
6196 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6197 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6198 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6199 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6200 v5 = a2.y; | |
6201 if ( v14 > a2.y ) | |
6202 v5 = v14; | |
6203 if ( v13 > v5 ) | |
6204 v5 = v13; | |
6205 if ( v4 > v5 ) | |
6206 v5 = v4; | |
262 | 6207 sprintf(pTmpBuf2, "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", |
6208 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6209 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6210 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6211 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6212 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6213 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6214 a1.uFrameHeight += v6; | |
6215 if ( (signed int)a1.uFrameHeight < 150 ) | |
6216 a1.uFrameHeight = 150; | |
819 | 6217 a1.uFrameWidth = game_viewport_width; |
0 | 6218 a1.DrawMessageBox(0); |
6219 a1.uFrameWidth -= 12; | |
6220 a1.uFrameHeight -= 12; | |
6221 v7 = pSpellStats->pInfos[v1].pName; | |
6222 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6223 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6224 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6225 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6226 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6227 a1.uFrameZ = a1.uFrameX + 107; | |
6228 a1.uFrameWidth = 108; | |
6229 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6230 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6231 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6232 } |
6233 | |
6234 //----- (004B1784) -------------------------------------------------------- | |
6235 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6236 { | |
6237 Player *pPlayer; // ebx@1 | |
6238 bool result; // eax@2 | |
6239 unsigned __int16 v2; // ST0C_2@3 | |
6240 int v3; // eax@3 | |
6241 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6242 | |
6243 pPlayer = pPlayers[uActiveCharacter]; | |
6244 if ( pPlayer->CanAct() ) | |
6245 { | |
6246 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6247 result = 1; | |
6248 } | |
6249 else | |
6250 { | |
6251 pDialogueWindow->pNumPresenceButton = 0; | |
6252 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6253 v4.uFrameX = 483; | |
6254 v4.uFrameWidth = 148; | |
6255 v4.uFrameZ = 334; | |
6256 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6257 // "%s is in no condition to %s" | |
6258 // "do anything" | |
758 | 6259 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6260 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6261 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6262 result = 0; | |
6263 } | |
6264 return result; | |
6265 } | |
6266 // F8B1E0: using guessed type int dword_F8B1E0; | |
6267 | |
6268 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6269 void __cdecl ShowPopupShopItem() |
0 | 6270 { |
6271 POINT *v1; // esi@5 | |
6272 unsigned int v2; // eax@5 | |
6273 int v3; // ecx@5 | |
6274 POINT *v4; // esi@12 | |
6275 int v5; // eax@12 | |
6276 unsigned int v6; // eax@13 | |
6277 ItemGen *v7; // ecx@13 | |
6278 signed int v8; // esi@17 | |
6279 unsigned int v9; // eax@19 | |
475 | 6280 POINT v10; // [sp+8h] [bp-44h]@12 |
6281 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6282 POINT v12; // [sp+18h] [bp-34h]@18 | |
6283 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6284 POINT v14; // [sp+28h] [bp-24h]@17 | |
6285 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6286 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6287 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6288 |
484 | 6289 if ( in_current_building_type <= 0 ) |
0 | 6290 return; |
484 | 6291 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6292 { |
749 | 6293 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6294 { | |
6295 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6296 return; |
749 | 6297 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6298 { |
475 | 6299 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6300 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6301 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6302 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6303 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6304 return; |
907 | 6305 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6306 return; |
6307 } | |
749 | 6308 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6309 return; |
6310 } | |
475 | 6311 v4 = pMouse->GetCursorPos(&v11); |
6312 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6313 if ( !v5 ) |
6314 return; | |
336 | 6315 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6316 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6317 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6318 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6319 GameUI_DrawItemInfo(v7); | |
6320 return; | |
0 | 6321 } |
874 | 6322 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6323 { |
6324 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6325 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6326 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6327 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6328 if ( v5 ) | |
336 | 6329 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6330 } |
6331 } | |
6332 // F8B198: using guessed type int dword_F8B198; | |
6333 // F8B19C: using guessed type int dword_F8B19C; | |
6334 | |
6335 //----- (004B1BDB) -------------------------------------------------------- | |
6336 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6337 { | |
6338 signed __int64 v1; // ST2C_8@1 | |
6339 signed __int64 v2; // qax@1 | |
6340 signed __int64 v3; // ST1C_8@1 | |
6341 unsigned __int64 v4; // qax@1 | |
6342 unsigned int v5; // ebx@1 | |
112 | 6343 Player *v6; // ebx@1 |
0 | 6344 |
6345 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6346 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6347 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6348 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6349 v2 = v1 / 60 / 60; | |
6350 v3 = v2; | |
6351 v4 = (unsigned int)v2 / 0x18; | |
6352 v5 = (unsigned int)(v4 / 7) >> 2; | |
6353 pParty->uCurrentTimeSecond = v1 % 60; | |
6354 pParty->uCurrentMinute = v1 / 60 % 60; | |
6355 pParty->uCurrentHour = v3 % 24; | |
6356 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6357 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6358 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6359 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6360 pParty->RestAndHeal(); |
6361 dword_507B94 = 1; | |
112 | 6362 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6363 do |
6364 { | |
112 | 6365 v6->uTimeToRecovery = 0; |
6366 memset(&v6->uTimeToRecovery, 0, 4u); | |
6367 ++v6; | |
6368 } | |
6369 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6370 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6371 } |
6372 // 507B94: using guessed type int dword_507B94; | |
6373 | |
6374 //----- (004B1D27) -------------------------------------------------------- | |
6375 void __cdecl sub_4B1D27() | |
6376 { | |
6377 int v0; // edx@2 | |
6378 unsigned int v1; // ecx@7 | |
6379 signed int v2; // edi@10 | |
6380 int v3; // esi@10 | |
6381 __int16 v4; // ax@15 | |
6382 signed int v5; // edi@20 | |
6383 int v6; // esi@20 | |
6384 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6385 | |
484 | 6386 if ( in_current_building_type > 0 ) |
0 | 6387 { |
6388 v0 = 3; | |
484 | 6389 if ( in_current_building_type > BildingType_MagicShop ) |
6390 { | |
6391 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6392 { |
6393 if ( !dword_F8B1E4 ) | |
6394 return; | |
6395 } | |
6396 else | |
6397 { | |
484 | 6398 if ( in_current_building_type != BildingType_Temple ) |
0 | 6399 return; |
6400 } | |
336 | 6401 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6402 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6403 return; |
6404 } | |
336 | 6405 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6406 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6407 { |
6408 if ( pParty->uNumGold <= 0x2710 ) | |
6409 { | |
6410 if ( !dword_F8B1E4 ) | |
6411 return; | |
6412 v0 = 4; | |
907 | 6413 PlayHouseSound(v1, (HouseSoundID)v0); |
6414 return; | |
0 | 6415 } |
735 | 6416 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6417 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6418 { | |
6419 v5 = 0; | |
6420 v6 = 1; | |
6421 do | |
6422 { | |
6423 if ( pPlayers[v6]->CanAct() ) | |
6424 v7[v5++] = v6; | |
6425 ++v6; | |
6426 } | |
6427 while ( v6 <= 4 ); | |
6428 if ( v5 ) | |
6429 { | |
6430 qword_A750D8 = 256i64; | |
6431 word_A750E0 = 80; | |
6432 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6433 word_A750E2 = v4; |
6434 return; | |
0 | 6435 } |
6436 } | |
6437 } | |
6438 else | |
6439 { | |
6440 if ( !qword_A750D8 ) | |
6441 { | |
6442 v2 = 0; | |
6443 v3 = 1; | |
6444 do | |
6445 { | |
6446 if ( pPlayers[v3]->CanAct() ) | |
6447 v7[v2++] = v3; | |
6448 ++v3; | |
6449 } | |
6450 while ( v3 <= 4 ); | |
6451 if ( v2 ) | |
6452 { | |
6453 qword_A750D8 = 256i64; | |
6454 word_A750E0 = 80; | |
6455 v4 = LOWORD(v7[rand() % v2]); | |
6456 word_A750E2 = v4; | |
6457 return; | |
6458 } | |
6459 } | |
6460 } | |
6461 } | |
6462 } | |
6463 | |
6464 //----- (004B1ECE) -------------------------------------------------------- | |
6465 void __cdecl sub_4B1ECE() | |
6466 { | |
6467 __int16 *v0; // edi@1 | |
6468 int v1; // ebx@3 | |
6469 Player *v2; // esi@3 | |
6470 int v3; // eax@4 | |
6471 signed int v4; // eax@9 | |
6472 int v5; // ebx@11 | |
89 | 6473 Player *v6; // esi@13 |
6474 ItemGen *v7; // eax@14 | |
0 | 6475 signed int v8; // edi@14 |
89 | 6476 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6477 signed int v10; // [sp+10h] [bp-8h]@13 |
6478 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6479 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6480 |
484 | 6481 contract_approved = 0; |
0 | 6482 v11 = 0; |
6483 uDialogueType = 84; | |
827 | 6484 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6485 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6486 while ( 1 ) | |
6487 { | |
484 | 6488 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6489 { |
6490 v1 = 0; | |
6491 v2 = pParty->pPlayers; | |
6492 do | |
6493 { | |
89 | 6494 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6495 if ( v3 ) |
6496 break; | |
6497 ++v2; | |
6498 ++v1; | |
6499 } | |
6500 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6501 if ( v1 == 4 ) | |
6502 break; | |
6503 } | |
6504 ++v11; | |
6505 v0 += 2; | |
89 | 6506 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6507 break; | |
6508 } | |
6509 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6510 { | |
827 | 6511 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6512 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6513 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6514 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6515 } | |
484 | 6516 if ( contract_approved == 601 ) |
0 | 6517 { |
6518 v5 = 0; | |
89 | 6519 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6520 v9 = 0; |
6521 while ( 1 ) | |
6522 { | |
135 | 6523 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6524 { |
6525 v10 = 0; | |
89 | 6526 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6527 do |
6528 { | |
89 | 6529 v7 = v6->pInventoryItems; |
0 | 6530 v8 = 138; |
6531 do | |
6532 { | |
89 | 6533 if ( v7->uItemID == 601 ) |
0 | 6534 { |
377 | 6535 if ( !v7->uHolderPlayer ) |
89 | 6536 v9 = v7; |
377 | 6537 if ( v7->uHolderPlayer == v5 ) |
0 | 6538 v10 = 1; |
6539 } | |
89 | 6540 ++v7; |
0 | 6541 --v8; |
6542 } | |
6543 while ( v8 ); | |
89 | 6544 ++v6; |
6545 } | |
6546 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6547 if ( !v10 ) |
6548 break; | |
6549 } | |
89 | 6550 ++v12; |
0 | 6551 ++v5; |
89 | 6552 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6553 return; |
6554 } | |
6555 if ( v9 ) | |
377 | 6556 v9->uHolderPlayer = v5; |
0 | 6557 } |
6558 } | |
6559 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6560 // 722B3C: using guessed type int dword_722B3C; | |
6561 // 722B44: using guessed type int dword_722B44; | |
6562 // F8B1A8: using guessed type int dword_F8B1A8; | |
6563 | |
6564 //----- (004B2001) -------------------------------------------------------- | |
459 | 6565 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6566 { | |
6567 //signed int v1; // eax@1 | |
6568 NPCData *pCurrentNPCInfo; // ebp@1 | |
6569 int pEventNumber; // ecx@8 | |
0 | 6570 Player *v4; // esi@20 |
467 | 6571 //int v5; // eax@28 |
6572 //int v6; // eax@31 | |
6573 //int v7; // eax@34 | |
6574 //int v8; // eax@37 | |
6575 //int v9; // eax@40 | |
6576 //unsigned int v10; // eax@43 | |
0 | 6577 char *v12; // eax@53 |
6578 char *v13; // eax@56 | |
6579 char *v14; // eax@57 | |
6580 char *v15; // eax@58 | |
467 | 6581 //unsigned int v16; // ebp@62 |
0 | 6582 char *v17; // ecx@63 |
6583 char *v18; // eax@65 | |
6584 const char *v19; // ecx@68 | |
248 | 6585 //unsigned int v20; // eax@69 |
467 | 6586 signed int pPrice; // ecx@70 |
0 | 6587 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6588 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6589 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6590 //int v25; // [sp-4h] [bp-10h]@49 |
6591 | |
459 | 6592 uDialogueType = uMessageParam + 1; |
6593 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6594 if ( uMessageParam <= 24 ) |
460 | 6595 { |
459 | 6596 switch ( uMessageParam ) |
6597 { | |
6598 case 13: | |
827 | 6599 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6600 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6601 NPCHireableDialogPrepare(); |
459 | 6602 dialogue_show_profession_details = false; |
6603 goto _return; | |
6604 case 19: | |
6605 pEventNumber = pCurrentNPCInfo->evt_A; | |
6606 break; | |
6607 case 20: | |
6608 pEventNumber = pCurrentNPCInfo->evt_B; | |
6609 break; | |
6610 case 21: | |
6611 pEventNumber = pCurrentNPCInfo->evt_C; | |
6612 break; | |
6613 case 22: | |
6614 pEventNumber = pCurrentNPCInfo->evt_D; | |
6615 break; | |
6616 case 23: | |
6617 pEventNumber = pCurrentNPCInfo->evt_E; | |
6618 break; | |
6619 case 24: | |
6620 pEventNumber = pCurrentNPCInfo->evt_F; | |
6621 break; | |
6622 default: | |
467 | 6623 goto _return; |
6624 } | |
6625 /*switch ( pEventNumber ) | |
6626 { | |
6627 case 139: | |
6628 sub_4B1ECE(); | |
6629 goto _return; | |
6630 case 311: | |
6631 sub_4BBA85_bounties(); | |
6632 goto _return; | |
6633 }*/ | |
459 | 6634 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6635 { | |
6636 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6637 { | |
6638 if ( pEventNumber == 139 ) | |
0 | 6639 { |
6640 sub_4B1ECE(); | |
6641 } | |
6642 else | |
6643 { | |
459 | 6644 if ( pEventNumber == 311 ) |
0 | 6645 { |
6646 sub_4BBA85_bounties(); | |
6647 } | |
6648 else | |
6649 { | |
827 | 6650 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6651 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6652 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6653 activeLevelDecoration = NULL; |
0 | 6654 } |
6655 } | |
6656 } | |
6657 else | |
6658 { | |
459 | 6659 dword_F8B1D8 = uMessageParam; |
6660 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6661 } |
6662 } | |
6663 else | |
6664 { | |
459 | 6665 sub_4B3FE5(pEventNumber); |
0 | 6666 } |
6667 goto _return; | |
460 | 6668 } |
459 | 6669 if ( uMessageParam != 76 ) |
6670 { | |
6671 if ( uMessageParam == 77 ) | |
6672 { | |
467 | 6673 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6674 if (dialogue_show_profession_details) |
459 | 6675 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6676 else |
459 | 6677 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6678 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6679 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6680 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6681 current_npc_text = v18; |
0 | 6682 } |
6683 else | |
6684 { | |
459 | 6685 if ( uMessageParam == 79 ) |
0 | 6686 { |
484 | 6687 if ( contract_approved ) |
0 | 6688 { |
267 | 6689 Party::TakeGold(gold_transaction_amount); |
0 | 6690 if ( uActiveCharacter ) |
6691 { | |
492 | 6692 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6693 *(short *)v12 &= 0x3Fu; |
6694 switch ( dword_F8B1B0 ) | |
6695 { | |
6696 case 2: | |
492 | 6697 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6698 *v15 |= 0x40u; |
6699 break; | |
6700 case 3: | |
492 | 6701 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6702 *v14 |= 0x80u; |
6703 break; | |
6704 case 4: | |
492 | 6705 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6706 v13[1] |= 1u; |
6707 break; | |
6708 } | |
187 | 6709 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6710 } |
437 | 6711 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6712 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6713 { |
6714 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6715 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6716 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6717 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6718 }*/ |
0 | 6719 } |
6720 } | |
6721 else | |
6722 { | |
492 | 6723 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6724 { |
267 | 6725 Party::TakeGold(gold_transaction_amount); |
0 | 6726 v4 = pParty->pPlayers; |
6727 do | |
6728 { | |
492 | 6729 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6730 ++v4; |
6731 } | |
6732 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6733 switch ( dword_F8B1D8 ) | |
6734 { | |
6735 case 19: | |
467 | 6736 pEventNumber = pCurrentNPCInfo->evt_A; |
6737 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6738 pCurrentNPCInfo->evt_A = 0; |
0 | 6739 break; |
6740 case 20: | |
467 | 6741 pEventNumber = pCurrentNPCInfo->evt_B; |
6742 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6743 pCurrentNPCInfo->evt_B = 0; |
0 | 6744 break; |
6745 case 21: | |
467 | 6746 pEventNumber = pCurrentNPCInfo->evt_C; |
6747 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6748 pCurrentNPCInfo->evt_C = 0; |
0 | 6749 break; |
6750 case 22: | |
467 | 6751 pEventNumber = pCurrentNPCInfo->evt_D; |
6752 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6753 pCurrentNPCInfo->evt_D = 0; |
0 | 6754 break; |
6755 case 23: | |
467 | 6756 pEventNumber = pCurrentNPCInfo->evt_E; |
6757 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6758 pCurrentNPCInfo->evt_E = 0; |
0 | 6759 break; |
6760 case 24: | |
467 | 6761 pEventNumber = pCurrentNPCInfo->evt_F; |
6762 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6763 pCurrentNPCInfo->evt_F = 0; | |
0 | 6764 break; |
6765 } | |
437 | 6766 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6767 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6768 { |
6769 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6770 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6771 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6772 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6773 }*/ |
467 | 6774 //v11 = uActiveCharacter; |
0 | 6775 if ( uActiveCharacter ) |
6776 { | |
467 | 6777 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6778 goto _return; |
6779 } | |
6780 } | |
6781 } | |
6782 } | |
6783 goto _return; | |
6784 } | |
6785 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6786 { | |
467 | 6787 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6788 goto _return; |
6789 } | |
459 | 6790 if ( pCurrentNPCInfo->uProfession != 51 ) |
6791 { | |
467 | 6792 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6793 if ( pParty->uNumGold < pPrice ) | |
6794 { | |
6795 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6796 dialogue_show_profession_details = false; |
0 | 6797 uDialogueType = 13; |
827 | 6798 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6799 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6800 if ( uActiveCharacter ) |
248 | 6801 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6802 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6803 goto _return; | |
6804 } | |
6805 Party::TakeGold(pPrice); | |
0 | 6806 } |
147 | 6807 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6808 pCurrentNPCInfo->uFlags |= 128; |
0 | 6809 pParty->field_709 = 0; |
659 | 6810 Party__CountHirelings(); |
0 | 6811 if ( pParty->pHirelings[0].pName ) |
6812 { | |
459 | 6813 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6814 v24 = pCurrentNPCInfo->pName; | |
0 | 6815 v22 = pParty->pHireling2Name; |
6816 } | |
6817 else | |
6818 { | |
459 | 6819 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6820 v24 = pCurrentNPCInfo->pName; | |
0 | 6821 v22 = pParty->pHireling1Name; |
6822 } | |
6823 strcpy(v22, v24); | |
6824 pParty->field_709 = 0; | |
659 | 6825 Party__CountHirelings(); |
480 | 6826 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6827 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6828 |
6829 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6830 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6831 { |
6832 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6833 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6834 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6835 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6836 }*/ |
0 | 6837 if ( uActiveCharacter ) |
467 | 6838 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6839 _return: |
460 | 6840 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6841 } |
6842 | |
6843 //----- (004B254D) -------------------------------------------------------- | |
6844 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6845 { | |
6846 Player *v1; // esi@1 | |
6847 int v2; // edx@1 | |
6848 int v3; // ecx@1 | |
6849 int v4; // edi@1 | |
6850 int v5; // eax@7 | |
6851 int v6; // eax@7 | |
6852 int v7; // ebx@7 | |
6853 int v8; // ebx@8 | |
6854 signed int v9; // esi@8 | |
6855 int v10; // eax@8 | |
6856 char *v11; // ecx@8 | |
6857 int v12; // edi@9 | |
6858 char *v13; // edx@9 | |
6859 signed int v14; // edi@10 | |
6860 unsigned int v16; // eax@29 | |
6861 int v17; // eax@36 | |
6862 char v18; // cl@46 | |
6863 __int16 v19; // dx@56 | |
6864 int v20; // eax@60 | |
6865 char *v21; // [sp-Ch] [bp-38h]@82 | |
6866 const char *v22; // [sp-8h] [bp-34h]@21 | |
6867 unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6868 char *v24; // [sp-8h] [bp-34h]@82 | |
6869 char *v25; // [sp-4h] [bp-30h]@14 | |
6870 int v26; // [sp-4h] [bp-30h]@38 | |
6871 int v27; // [sp-4h] [bp-30h]@82 | |
6872 char v28[4]; // [sp+Ch] [bp-20h]@9 | |
6873 int v29; // [sp+10h] [bp-1Ch]@13 | |
6874 int v30; // [sp+14h] [bp-18h]@15 | |
6875 int v31; // [sp+18h] [bp-14h]@16 | |
6876 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
6877 int v33; // [sp+20h] [bp-Ch]@7 | |
6878 int v34; // [sp+24h] [bp-8h]@7 | |
6879 char *v35; // [sp+28h] [bp-4h]@1 | |
6880 | |
6881 v1 = pPlayers[uActiveCharacter]; | |
484 | 6882 contract_approved = 0; |
0 | 6883 v2 = (_this - 200) % 3; |
6884 v3 = (_this - 200) / 3; | |
6885 v4 = v2; | |
6886 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6887 dword_F8B1AC_award_bit_number = v3; |
0 | 6888 if ( v2 ) |
6889 { | |
6890 if ( v2 == 1 ) | |
6891 { | |
267 | 6892 gold_transaction_amount = 5000; |
0 | 6893 dword_F8B1B0 = 3; |
6894 } | |
6895 else | |
6896 { | |
6897 if ( v2 == 2 ) | |
6898 { | |
267 | 6899 gold_transaction_amount = 8000; |
0 | 6900 dword_F8B1B0 = 4; |
6901 } | |
6902 } | |
6903 } | |
6904 else | |
6905 { | |
267 | 6906 gold_transaction_amount = 2000; |
0 | 6907 dword_F8B1B0 = 2; |
6908 } | |
135 | 6909 v5 = v1->classType; |
0 | 6910 v33 = v5; |
6911 v6 = byte_4ED970_skill_learn_ability_by_class_table[v5][v3]; | |
6912 *(int *)a1 = v1->pActiveSkills[v3]; | |
6913 v7 = a1[0] & 0x3F; | |
6914 v34 = v2 + 2; | |
6915 if ( v6 < v2 + 2 ) | |
6916 { | |
6917 v8 = v33; | |
6918 v9 = 0; | |
6919 v10 = v33 - v33 % 4; | |
6920 v11 = &byte_4ED970_skill_learn_ability_by_class_table[v33 - v33 % 4][v3]; | |
6921 do | |
6922 { | |
6923 v12 = (unsigned __int8)*v11; | |
6924 v13 = &v28[4 * v9]; | |
6925 *(int *)v13 = 0; | |
6926 if ( v12 < v34 ) | |
6927 { | |
6928 v14 = 1; | |
6929 } | |
6930 else | |
6931 { | |
6932 v14 = 1; | |
6933 *(int *)v13 = 1; | |
6934 } | |
6935 ++v9; | |
6936 v11 += 37; | |
6937 } | |
6938 while ( v9 < 4 ); | |
6939 if ( v29 == v14 ) | |
6940 { | |
6941 v25 = pClassNames[v10 + 1]; | |
6942 } | |
6943 else | |
6944 { | |
6945 if ( v30 == v14 ) | |
6946 { | |
6947 if ( v31 == v14 ) | |
6948 { | |
6949 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]); | |
6950 return pTmpBuf; | |
6951 } | |
6952 v25 = pClassNames[v10 + 2]; | |
6953 } | |
6954 else | |
6955 { | |
6956 if ( v31 != v14 ) | |
6957 { | |
6958 v25 = pClassNames[v8]; | |
6959 v22 = pGlobalTXT_LocalizationStrings[632]; | |
6960 goto LABEL_23; | |
6961 } | |
6962 v25 = pClassNames[v10 + 3]; | |
6963 } | |
6964 } | |
6965 v22 = pGlobalTXT_LocalizationStrings[633]; | |
6966 LABEL_23: | |
6967 sprintf(pTmpBuf, v22, v25); | |
6968 return pTmpBuf; | |
6969 } | |
6970 if ( !v1->CanAct() ) | |
6971 return (char *)pNPCTopics[122].pText; | |
6972 if ( !v7 ) | |
6973 return (char *)pNPCTopics[131].pText; | |
6974 v16 = SkillToMastery(a1[0]); | |
6975 if ( (signed int)v16 > v4 + 1 ) | |
6976 return (char *)pNPCTopics[v4 + 128].pText; | |
6977 if ( v34 != 2 ) | |
6978 { | |
6979 if ( v34 == 3 ) | |
6980 { | |
6981 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6982 { | |
492 | 6983 v17 = dword_F8B1AC_award_bit_number; |
6984 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 6985 { |
6986 default: | |
6987 goto LABEL_41; | |
6988 case 12: | |
6989 case 13: | |
6990 case 14: | |
6991 case 15: | |
6992 case 16: | |
6993 case 17: | |
6994 case 18: | |
267 | 6995 gold_transaction_amount = 4000; |
0 | 6996 goto LABEL_42; |
6997 case 19: | |
6998 v19 = 114; | |
6999 goto LABEL_57; | |
7000 case 20: | |
7001 v19 = 110; | |
7002 LABEL_57: | |
484 | 7003 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 7004 return v35; |
7005 goto LABEL_40; | |
7006 case 22: | |
7007 v20 = v1->GetBaseWillpower(); | |
7008 goto LABEL_61; | |
7009 case 24: | |
267 | 7010 gold_transaction_amount = 2500; |
0 | 7011 v20 = v1->GetBaseEndurance(); |
7012 goto LABEL_61; | |
7013 case 36: | |
7014 v20 = v1->GetBaseIntelligence(); | |
7015 LABEL_61: | |
7016 if ( v20 < 50 ) | |
7017 return v35; | |
7018 goto LABEL_40; | |
7019 case 21: | |
7020 case 23: | |
7021 case 25: | |
7022 case 26: | |
7023 case 29: | |
7024 case 32: | |
7025 case 34: | |
7026 case 35: | |
267 | 7027 gold_transaction_amount = 2500; |
0 | 7028 goto LABEL_42; |
7029 case 8: | |
7030 case 9: | |
7031 case 10: | |
7032 case 11: | |
267 | 7033 gold_transaction_amount = 3000; |
0 | 7034 goto LABEL_42; |
7035 case 7: | |
7036 goto LABEL_67; | |
7037 } | |
7038 goto LABEL_67; | |
7039 } | |
7040 } | |
7041 else | |
7042 { | |
7043 if ( v34 != 4 ) | |
7044 { | |
7045 LABEL_40: | |
492 | 7046 v17 = dword_F8B1AC_award_bit_number; |
0 | 7047 goto LABEL_41; |
7048 } | |
7049 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7050 { | |
492 | 7051 v17 = dword_F8B1AC_award_bit_number; |
7052 switch ( dword_F8B1AC_award_bit_number ) | |
0 | 7053 { |
7054 case 19: | |
7055 if ( v1->_49327B(0x22u, 1) == 1 ) | |
7056 goto LABEL_40; | |
7057 v26 = 1; | |
7058 v23 = 26; | |
7059 goto LABEL_39; | |
7060 default: | |
7061 goto LABEL_41; | |
7062 case 20: | |
7063 if ( v1->_49327B(0x23u, 1) == 1 ) | |
7064 goto LABEL_40; | |
7065 v26 = 1; | |
7066 v23 = 27; | |
7067 LABEL_39: | |
7068 if ( v1->_49327B(v23, v26) == 1 ) | |
7069 goto LABEL_40; | |
7070 return v35; | |
7071 case 30: | |
7072 v18 = LOBYTE(v1->pActiveSkills[31]); | |
7073 goto LABEL_47; | |
7074 case 31: | |
7075 v18 = LOBYTE(v1->pActiveSkills[30]); | |
7076 LABEL_47: | |
7077 if ( (v18 & 0x3Fu) < 0xA ) | |
7078 return v35; | |
7079 goto LABEL_41; | |
7080 case 21: | |
7081 case 23: | |
7082 case 24: | |
7083 case 25: | |
7084 case 26: | |
7085 case 29: | |
7086 case 32: | |
7087 case 34: | |
7088 case 35: | |
267 | 7089 gold_transaction_amount = 6000; |
0 | 7090 goto LABEL_42; |
7091 case 8: | |
7092 case 9: | |
7093 case 10: | |
7094 case 11: | |
267 | 7095 gold_transaction_amount = 7000; |
0 | 7096 goto LABEL_42; |
7097 case 7: | |
7098 break; | |
7099 } | |
7100 LABEL_67: | |
267 | 7101 gold_transaction_amount = 0; |
0 | 7102 goto LABEL_41; |
7103 } | |
7104 } | |
7105 return v35; | |
7106 } | |
7107 if ( v7 < 4 ) | |
7108 return v35; | |
492 | 7109 v17 = dword_F8B1AC_award_bit_number; |
7110 if ( dword_F8B1AC_award_bit_number > 27 ) | |
7111 { | |
7112 if ( dword_F8B1AC_award_bit_number != 29 | |
7113 && dword_F8B1AC_award_bit_number != 32 | |
7114 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7115 { |
7116 LABEL_41: | |
267 | 7117 if ( !gold_transaction_amount ) |
0 | 7118 goto LABEL_79; |
7119 goto LABEL_42; | |
7120 } | |
7121 LABEL_87: | |
267 | 7122 gold_transaction_amount = 500; |
0 | 7123 goto LABEL_41; |
7124 } | |
492 | 7125 if ( dword_F8B1AC_award_bit_number >= 23 ) |
0 | 7126 goto LABEL_87; |
492 | 7127 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7128 { |
267 | 7129 gold_transaction_amount = 0; |
0 | 7130 goto LABEL_79; |
7131 } | |
492 | 7132 if ( dword_F8B1AC_award_bit_number <= 7 ) |
0 | 7133 goto LABEL_41; |
492 | 7134 if ( dword_F8B1AC_award_bit_number > 18 ) |
7135 { | |
7136 if ( dword_F8B1AC_award_bit_number != 21 ) | |
0 | 7137 goto LABEL_41; |
7138 goto LABEL_87; | |
7139 } | |
267 | 7140 gold_transaction_amount = 1000; |
0 | 7141 LABEL_42: |
267 | 7142 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7143 return (char *)pNPCTopics[124].pText; |
7144 LABEL_79: | |
484 | 7145 contract_approved = 1; |
0 | 7146 if ( v34 == 2 ) |
7147 { | |
267 | 7148 v27 = gold_transaction_amount; |
0 | 7149 v24 = pSkillNames[v17]; |
7150 v21 = pGlobalTXT_LocalizationStrings[433]; | |
7151 goto LABEL_90; | |
7152 } | |
7153 if ( v34 == 3 ) | |
7154 { | |
267 | 7155 v27 = gold_transaction_amount; |
0 | 7156 v24 = pSkillNames[v17]; |
7157 v21 = pGlobalTXT_LocalizationStrings[432]; | |
7158 goto LABEL_90; | |
7159 } | |
7160 if ( v34 == 4 ) | |
7161 { | |
267 | 7162 v27 = gold_transaction_amount; |
0 | 7163 v24 = pSkillNames[v17]; |
7164 v21 = pGlobalTXT_LocalizationStrings[225]; | |
7165 LABEL_90: | |
809 | 7166 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); |
0 | 7167 } |
7168 return pTmpBuf2; | |
7169 } | |
7170 | |
7171 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7172 const char * ContractSelectText( int pEventCode ) |
7173 { | |
7174 static const int dialogue_base=110; | |
484 | 7175 contract_approved = 0; |
492 | 7176 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7177 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7178 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7179 { | |
492 | 7180 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7181 { | |
7182 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7183 } |
7184 else | |
7185 { | |
267 | 7186 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7187 { |
484 | 7188 contract_approved = 1; |
492 | 7189 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7190 } |
7191 else | |
7192 { | |
492 | 7193 return pNPCTopics[dialogue_base+14].pText; |
0 | 7194 } |
7195 } | |
7196 } | |
7197 else | |
7198 { | |
492 | 7199 return pNPCTopics[dialogue_base+12].pText; |
0 | 7200 } |
7201 } | |
7202 | |
7203 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7204 void SimpleHouseAndBoatsDialog() |
0 | 7205 { |
7206 char *v0; // esi@3 | |
7207 char *v1; // ST1C_4@3 | |
7208 char *v2; // eax@3 | |
7209 const char *v3; // ST1C_4@5 | |
7210 int v4; // eax@5 | |
7211 unsigned int i; // eax@5 | |
7212 NPCData *v6; // esi@6 | |
7213 unsigned __int16 v7; // bx@6 | |
7214 unsigned int v8; // eax@6 | |
7215 int v9; // eax@11 | |
7216 unsigned int v10; // ecx@12 | |
7217 int v11; // eax@12 | |
7218 int v12; // esi@12 | |
7219 char *v13; // eax@12 | |
7220 GUIWindow *v14; // ebx@13 | |
7221 char *v15; // esi@14 | |
7222 GUIButton *v16; // eax@15 | |
7223 unsigned int v17; // ecx@15 | |
7224 int v18; // ecx@17 | |
7225 int v19; // ecx@18 | |
7226 int v20; // ecx@19 | |
7227 int v21; // ecx@20 | |
7228 int v22; // ecx@21 | |
7229 unsigned int v23; // ecx@23 | |
7230 int v24; // ecx@35 | |
7231 int v25; // ecx@36 | |
7232 int v26; // ecx@37 | |
7233 int v27; // ecx@38 | |
7234 int v28; // ecx@39 | |
7235 char *v29; // esi@42 | |
7236 unsigned int v30; // ST20_4@42 | |
7237 int v31; // ST1C_4@42 | |
7238 unsigned int v32; // eax@42 | |
7239 char *v33; // eax@43 | |
7240 int v34; // esi@51 | |
7241 int v35; // eax@51 | |
7242 unsigned int v36; // edi@51 | |
7243 GUIButton *v37; // eax@52 | |
7244 int v38; // eax@52 | |
7245 signed int v39; // ecx@54 | |
7246 int v40; // edi@57 | |
7247 GUIButton *v41; // eax@60 | |
7248 GUIButton *v42; // esi@60 | |
7249 const char *v43; // ebx@60 | |
7250 int v44; // eax@60 | |
7251 unsigned int v45; // ecx@60 | |
7252 unsigned __int16 v46; // ax@60 | |
7253 GUIFont *v47; // ebx@64 | |
7254 int v48; // esi@64 | |
7255 char *v49; // eax@66 | |
7256 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7257 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7258 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7259 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7260 int v55; // [sp+10Ch] [bp-10h]@6 | |
7261 int v56; // [sp+110h] [bp-Ch]@13 | |
7262 char *pInString; // [sp+114h] [bp-8h]@12 | |
7263 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7264 | |
7265 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7266 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7267 { |
7268 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7269 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7270 a1.uFrameX = 493; | |
7271 a1.uFrameWidth = 126; | |
7272 a1.uFrameZ = 366; | |
7273 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7274 a1.uFrameX = 483; | |
7275 a1.uFrameWidth = 148; | |
7276 a1.uFrameZ = 334; | |
434 | 7277 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7278 if ( !v2 ) |
7279 { | |
721 | 7280 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7281 v2 = pTmpBuf; |
7282 } | |
7283 v3 = v2; | |
7284 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7285 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7286 return; | |
0 | 7287 } |
7288 a1.uFrameWidth -= 10; | |
7289 a1.uFrameZ -= 10; | |
459 | 7290 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7291 v6 = v58; |
7292 v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7293 v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); | |
7294 v8 = v6->uProfession; | |
7295 if ( v8 ) | |
264 | 7296 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7297 else |
7298 strcpy(pTmpBuf, v6->pName); | |
7299 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7300 if ( !dword_591080 ) | |
7301 { | |
7302 if ( !uDialogueType ) | |
7303 { | |
7304 v9 = v6->greet; | |
7305 if ( v9 ) | |
7306 { | |
7307 v10 = v6->uFlags; | |
819 | 7308 a1.uFrameWidth = game_viewport_width; |
0 | 7309 a1.uFrameZ = 452; |
7310 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7311 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7312 v12 = v11 + 7; | |
7313 pRenderer->_4A6A68( | |
7314 8u, | |
7315 352 - (v11 + 7), | |
7316 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7317 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7318 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7319 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7320 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7321 } | |
7322 } | |
7323 } | |
7324 v14 = pDialogueWindow; | |
7325 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7326 v52.uFrameX = 483; | |
7327 v52.uFrameWidth = 148; | |
7328 v52.uFrameZ = 334; | |
7329 v56 = v52.pStartingPosActiveItem; | |
7330 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7331 { | |
348 | 7332 v15 = "";//(char *)v54; |
0 | 7333 while ( 1 ) |
7334 { | |
7335 v16 = v52.GetControl(v56); | |
832 | 7336 v17 = v16->msg_param; |
0 | 7337 pInString = (char *)v16; |
7338 if ( (signed int)v17 > 24 ) | |
7339 { | |
7340 v24 = v17 - 76; | |
7341 if ( !v24 ) | |
7342 { | |
7343 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7344 goto LABEL_49; | |
7345 } | |
7346 v25 = v24 - 1; | |
7347 if ( !v25 ) | |
7348 { | |
7349 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7350 goto LABEL_49; | |
7351 } | |
7352 v26 = v25 - 2; | |
7353 if ( !v26 ) | |
7354 { | |
7355 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7356 LABEL_44: | |
7357 v15 = v33; | |
7358 LABEL_45: | |
7359 v16 = (GUIButton *)pInString; | |
7360 goto LABEL_49; | |
7361 } | |
7362 v27 = v26 - 3; | |
7363 if ( !v27 ) | |
7364 { | |
459 | 7365 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7366 goto LABEL_44; |
7367 } | |
7368 v28 = v27 - 1; | |
7369 if ( !v28 ) | |
7370 { | |
7371 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
7372 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7373 v31 = *(int *)v29; | |
7374 v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
7375 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); | |
7376 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7377 current_npc_text = pTmpBuf2; |
0 | 7378 v15 = ""; |
7379 goto LABEL_45; | |
7380 } | |
7381 if ( v28 != 10 ) | |
7382 goto LABEL_41; | |
7383 } | |
7384 else | |
7385 { | |
7386 if ( v17 == 24 ) | |
7387 { | |
291 | 7388 v23 = v58->evt_F; |
0 | 7389 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7390 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7391 if ( !v15 ) |
7392 { | |
832 | 7393 v16->msg_param = 0; |
0 | 7394 v15 = ""; |
7395 } | |
7396 goto LABEL_49; | |
7397 } | |
7398 v18 = v17 - 13; | |
7399 if ( v18 ) | |
7400 { | |
7401 v19 = v18 - 6; | |
7402 if ( !v19 ) | |
7403 { | |
291 | 7404 v23 = v58->evt_A; |
0 | 7405 goto LABEL_33; |
7406 } | |
7407 v20 = v19 - 1; | |
7408 if ( !v20 ) | |
7409 { | |
291 | 7410 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7411 if ( !v15 ) |
7412 { | |
832 | 7413 v16->msg_param = 0; |
0 | 7414 v15 = ""; |
7415 } | |
7416 if ( uDialogueType != 84 ) | |
7417 goto LABEL_49; | |
484 | 7418 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7419 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7420 current_npc_text = pTmpBuf2; | |
0 | 7421 goto LABEL_45; |
7422 } | |
7423 v21 = v20 - 1; | |
7424 if ( !v21 ) | |
7425 { | |
291 | 7426 v23 = v58->evt_C; |
0 | 7427 goto LABEL_33; |
7428 } | |
7429 v22 = v21 - 1; | |
7430 if ( !v22 ) | |
7431 { | |
291 | 7432 v23 = v58->evt_D; |
0 | 7433 goto LABEL_33; |
7434 } | |
7435 if ( v22 == 1 ) | |
7436 { | |
291 | 7437 v23 = v58->evt_E; |
0 | 7438 goto LABEL_33; |
7439 } | |
7440 LABEL_41: | |
7441 v15 = ""; | |
7442 goto LABEL_49; | |
7443 } | |
7444 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7445 } | |
7446 LABEL_49: | |
7447 strcpy(v16->pButtonName, v15); | |
7448 ++v56; | |
7449 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7450 { | |
7451 v14 = pDialogueWindow; | |
7452 break; | |
7453 } | |
7454 } | |
7455 } | |
7456 v34 = 0; | |
7457 v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
7458 v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
7459 v36 = v14->pStartingPosActiveItem; | |
7460 v55 = v35; | |
7461 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7462 + pDialogueWindow->pStartingPosActiveItem ) | |
7463 { | |
7464 v37 = v14->GetControl(v36); | |
7465 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7466 v14 = pDialogueWindow; | |
7467 v34 += v38; | |
7468 ++v36; | |
7469 } | |
7470 v39 = v14->pNumPresenceButton; | |
7471 if ( v39 ) | |
7472 { | |
7473 v58 = (NPCData *)((174 - v34) / v39); | |
7474 if ( (signed int)v58 > 32 ) | |
7475 v58 = (NPCData *)32; | |
7476 pInString = (char *)2; | |
7477 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7478 v56 = v14->pStartingPosActiveItem; | |
7479 i = v56; | |
7480 if ( (signed int)i < (signed int)(i + v39) ) | |
7481 { | |
7482 while ( 1 ) | |
7483 { | |
7484 v41 = v14->GetControl(i); | |
7485 v42 = v41; | |
7486 v43 = v41->pButtonName; | |
7487 v41->uY = (unsigned int)((char *)v58 + v40); | |
7488 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7489 v45 = v42->uY; | |
7490 v42->uHeight = v44; | |
7491 v40 = v45 + v44 - 1; | |
7492 v42->uW = v40; | |
7493 v46 = v55; | |
7494 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7495 v46 = v54; | |
7496 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7497 v14 = pDialogueWindow; | |
7498 ++pInString; | |
7499 ++v56; | |
7500 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7501 if ( v56 >= (signed int)i ) | |
7502 break; | |
7503 i = v56; | |
7504 } | |
7505 } | |
7506 } | |
827 | 7507 if ( current_npc_text ) |
0 | 7508 { |
7509 w.uFrameWidth = 458; | |
7510 w.uFrameZ = 457; | |
7511 v47 = pFontArrus; | |
827 | 7512 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7513 if ( 352 - v48 < 8 ) |
7514 { | |
7515 v47 = pFontCreate; | |
827 | 7516 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7517 } |
7518 pRenderer->_4A6A68( | |
7519 8u, | |
7520 352 - v48, | |
7521 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7522 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7523 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
827 | 7524 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7525 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7526 } | |
0 | 7527 } |
7528 | |
7529 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7530 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7531 { |
832 | 7532 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7533 } |
7534 | |
7535 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7536 void sub_4B3A72( int a1 ) |
7537 { | |
7538 int num_buttons; // esi@1 | |
7539 | |
7540 num_buttons = 0; | |
0 | 7541 if ( a1 == 21 ) |
7542 { | |
473 | 7543 CreateButtonInColumn(0, 0x66u); |
7544 num_buttons = 2; | |
7545 CreateButtonInColumn(1, 0x67u); | |
7546 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7547 { | |
7548 num_buttons = 3; | |
7549 CreateButtonInColumn(2, 0x68u); | |
7550 } | |
7551 } | |
7552 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7553 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7554 } | |
7555 // F8B1E0: using guessed type int dword_F8B1E0; | |
7556 | |
7557 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7558 void sub_4B3AD4( signed int a1 ) |
7559 { | |
0 | 7560 if ( a1 > 0 ) |
7561 { | |
7562 if ( a1 <= 3 ) | |
7563 { | |
473 | 7564 CreateButtonInColumn(0, 3u); |
7565 CreateButtonInColumn(1, 4u); | |
7566 CreateButtonInColumn(2, 5u); | |
7567 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7568 } |
7569 if ( a1 == 4 ) | |
7570 { | |
473 | 7571 CreateButtonInColumn(0, 3u); |
7572 CreateButtonInColumn(1, 4u); | |
7573 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7574 } | |
7575 } | |
0 | 7576 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7577 } | |
7578 // F8B1E0: using guessed type int dword_F8B1E0; | |
7579 | |
7580 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7581 void sub_4B3B42( signed int a1 ) |
7582 { | |
0 | 7583 int v1; // ecx@18 |
7584 int v2; // ecx@19 | |
7585 int v3; // ecx@20 | |
7586 signed int v4; // esi@22 | |
7587 signed int v5; // eax@22 | |
7588 unsigned int v6; // edx@24 | |
7589 int v7; // ecx@24 | |
7590 int result; // eax@43 | |
7591 int v9; // [sp-10h] [bp-14h]@28 | |
7592 int v10; // [sp-Ch] [bp-10h]@28 | |
7593 int v11; // [sp-8h] [bp-Ch]@28 | |
7594 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7595 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7596 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7597 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7598 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7599 int v17; // [sp-4h] [bp-8h]@28 | |
7600 | |
7601 if ( a1 > 13 ) | |
7602 { | |
7603 if ( a1 > 22 ) | |
7604 { | |
7605 if ( a1 == 23 ) | |
7606 { | |
473 | 7607 CreateButtonInColumn(0, 0xAu); |
7608 CreateButtonInColumn(1, 0xBu); | |
0 | 7609 v14 = 96; |
7610 LABEL_41: | |
473 | 7611 CreateButtonInColumn(2, v14); |
0 | 7612 v17 = 2; |
7613 v11 = 0; | |
7614 v10 = 1; | |
7615 v9 = 3; | |
7616 goto LABEL_42; | |
7617 } | |
7618 if ( a1 <= 26 ) | |
7619 goto LABEL_43; | |
7620 if ( a1 > 28 ) | |
7621 { | |
7622 if ( a1 != 30 ) | |
7623 goto LABEL_43; | |
473 | 7624 CreateButtonInColumn(0, 0x11u); |
0 | 7625 v16 = 96; |
7626 goto LABEL_37; | |
7627 } | |
473 | 7628 CreateButtonInColumn(0, 0x69u); |
7629 CreateButtonInColumn(1, 0x6Au); | |
7630 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7631 v12 = 108; |
7632 } | |
7633 else | |
7634 { | |
7635 if ( a1 == 22 ) | |
7636 { | |
473 | 7637 CreateButtonInColumn(0, 7u); |
0 | 7638 v16 = 8; |
7639 goto LABEL_37; | |
7640 } | |
7641 v1 = a1 - 14; | |
7642 if ( !v1 ) | |
7643 { | |
473 | 7644 CreateButtonInColumn(0, 0x12u); |
7645 CreateButtonInColumn(1, 0x30u); | |
7646 CreateButtonInColumn(2, 0x31u); | |
7647 CreateButtonInColumn(3, 0x32u); | |
7648 CreateButtonInColumn(4, 0x33u); | |
0 | 7649 v17 = 2; |
7650 v11 = 0; | |
7651 v10 = 1; | |
7652 v9 = 5; | |
7653 goto LABEL_42; | |
7654 } | |
7655 v2 = v1 - 1; | |
7656 if ( v2 ) | |
7657 { | |
7658 v3 = v2 - 2; | |
7659 if ( v3 ) | |
7660 { | |
7661 if ( v3 != 4 ) | |
7662 goto LABEL_43; | |
473 | 7663 CreateButtonInColumn(0, 0xFu); |
7664 CreateButtonInColumn(1, 0x10u); | |
0 | 7665 v4 = 3; |
473 | 7666 CreateButtonInColumn(2, 0x60u); |
336 | 7667 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7668 if ( v5 < 108 || v5 > 120 ) |
7669 goto LABEL_28; | |
7670 v4 = 4; | |
7671 v6 = 101; | |
7672 v7 = 3; | |
7673 } | |
7674 else | |
7675 { | |
7676 v4 = 1; | |
473 | 7677 CreateButtonInColumn(0, 0x63u); |
0 | 7678 if ( !pParty->uFine ) |
7679 { | |
7680 LABEL_28: | |
7681 v17 = 2; | |
7682 v11 = 0; | |
7683 v10 = 1; | |
7684 v9 = v4; | |
7685 LABEL_42: | |
7686 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7687 goto LABEL_43; | |
7688 } | |
7689 v4 = 2; | |
7690 v7 = 1; | |
7691 v6 = 100; | |
7692 } | |
473 | 7693 CreateButtonInColumn(v7, v6); |
0 | 7694 goto LABEL_28; |
7695 } | |
473 | 7696 CreateButtonInColumn(0, 0x12u); |
7697 CreateButtonInColumn(1, 0x34u); | |
7698 CreateButtonInColumn(2, 0x35u); | |
0 | 7699 v12 = 54; |
7700 } | |
7701 LABEL_39: | |
473 | 7702 CreateButtonInColumn(3, v12); |
0 | 7703 v17 = 2; |
7704 v11 = 0; | |
7705 v10 = 1; | |
7706 v9 = 4; | |
7707 goto LABEL_42; | |
7708 } | |
7709 if ( a1 == 13 ) | |
7710 { | |
473 | 7711 CreateButtonInColumn(0, 0x12u); |
0 | 7712 v16 = 56; |
7713 LABEL_37: | |
473 | 7714 CreateButtonInColumn(1, v16); |
0 | 7715 v17 = 2; |
7716 v11 = 0; | |
7717 v10 = 1; | |
7718 v9 = 2; | |
7719 goto LABEL_42; | |
7720 } | |
7721 switch ( a1 ) | |
7722 { | |
7723 case 1: | |
7724 case 2: | |
7725 case 3: | |
7726 case 4: | |
473 | 7727 CreateButtonInColumn(0, 2u); |
7728 CreateButtonInColumn(1, 0x5Fu); | |
7729 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7730 v12 = 96; |
7731 goto LABEL_39; | |
7732 case 5: | |
473 | 7733 CreateButtonInColumn(0, 0x12u); |
0 | 7734 v13 = 48; |
7735 goto LABEL_9; | |
7736 case 6: | |
473 | 7737 CreateButtonInColumn(0, 0x12u); |
0 | 7738 v13 = 49; |
7739 goto LABEL_9; | |
7740 case 7: | |
473 | 7741 CreateButtonInColumn(0, 0x12u); |
0 | 7742 v13 = 50; |
7743 goto LABEL_9; | |
7744 case 8: | |
473 | 7745 CreateButtonInColumn(0, 0x12u); |
0 | 7746 v13 = 51; |
7747 LABEL_9: | |
473 | 7748 CreateButtonInColumn(1, v13); |
0 | 7749 v14 = 72; |
7750 goto LABEL_41; | |
7751 case 9: | |
473 | 7752 CreateButtonInColumn(0, 0x12u); |
0 | 7753 v15 = 52; |
7754 goto LABEL_13; | |
7755 case 10: | |
473 | 7756 CreateButtonInColumn(0, 0x12u); |
0 | 7757 v15 = 53; |
7758 goto LABEL_13; | |
7759 case 11: | |
473 | 7760 CreateButtonInColumn(0, 0x12u); |
0 | 7761 v15 = 54; |
7762 LABEL_13: | |
473 | 7763 CreateButtonInColumn(1, v15); |
0 | 7764 v14 = 61; |
7765 goto LABEL_41; | |
7766 case 12: | |
473 | 7767 CreateButtonInColumn(0, 0x12u); |
0 | 7768 v16 = 55; |
7769 goto LABEL_37; | |
7770 default: | |
7771 break; | |
7772 } | |
7773 LABEL_43: | |
7774 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7775 } | |
7776 // F8B1E0: using guessed type int dword_F8B1E0; | |
7777 | |
7778 //----- (004B3E1E) -------------------------------------------------------- | |
7779 void __cdecl sub_4B3E1E() | |
7780 { | |
7781 NPCData *v0; // ST40_4@1 | |
7782 signed int v1; // edi@1 | |
165 | 7783 //GUIWindow *v2; // ecx@1 |
0 | 7784 |
167 | 7785 __debugbreak(); |
602 | 7786 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7787 v1 = 0; |
7788 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7789 pDialogueWindow->Release(); | |
165 | 7790 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7791 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7792 { |
832 | 7793 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7794 v1 = 1; |
7795 } | |
832 | 7796 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);// |
0 | 7797 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7798 } | |
7799 | |
7800 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7801 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7802 { |
467 | 7803 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7804 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7805 ContractSelectText(pEventCode); |
0 | 7806 pDialogueWindow->Release(); |
492 | 7807 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
832 | 7808 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], // Cancel |
7809 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
7810 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7811 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
0 | 7812 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7813 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7814 } |
7815 // F8B19C: using guessed type int dword_F8B19C; | |
7816 | |
7817 //----- (004B3FE5) -------------------------------------------------------- | |
7818 void __fastcall sub_4B3FE5(int a4) | |
7819 { | |
7820 int v1; // edi@1 | |
7821 char *v2; // edi@1 | |
7822 | |
7823 v1 = a4; | |
7824 uDialogueType = 78; | |
827 | 7825 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7826 _4B254D_SkillMasteryTeacher(a4); |
7827 pDialogueWindow->Release(); | |
7828 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7829 v2 = ""; | |
832 | 7830 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7831 pGlobalTXT_LocalizationStrings[34], |
526 | 7832 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7833 0); |
832 | 7834 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7835 if ( contract_approved ) |
0 | 7836 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7837 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
0 | 7838 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7839 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7840 } |
7841 // F8B19C: using guessed type int dword_F8B19C; | |
7842 // F8B1A8: using guessed type int dword_F8B1A8; | |
7843 | |
7844 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7845 void NPCHireableDialogPrepare() |
7846 { | |
0 | 7847 signed int v0; // ebx@1 |
7848 NPCData *v1; // edi@1 | |
7849 | |
7850 v0 = 0; | |
459 | 7851 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7852 pDialogueWindow->Release(); |
7853 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7854 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7855 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
526 | 7856 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7857 0); |
832 | 7858 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7859 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7860 { |
832 | 7861 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7862 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7863 v0 = 1; |
7864 } | |
832 | 7865 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7866 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
0 | 7867 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7868 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7869 } |
7870 | |
7871 //----- (004B4224) -------------------------------------------------------- | |
423 | 7872 void _4B4224_UpdateNPCTopics( int _this ) |
7873 { | |
7874 int num_menu_buttons; // ebx@1 | |
0 | 7875 int i; // ebp@5 |
423 | 7876 // signed int v4; // ebp@9 |
7877 int v6; // eax@16 | |
7878 int v8; // eax@21 | |
7879 int v10; // eax@26 | |
7880 int v12; // eax@31 | |
7881 int v14; // eax@36 | |
7882 int v16; // eax@41 | |
0 | 7883 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7884 | |
423 | 7885 num_menu_buttons = 0; |
459 | 7886 pDialogueNPCCount = (_this + 1); |
0 | 7887 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7888 { | |
7889 pDialogueWindow->Release(); | |
7890 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7891 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
832 | 7892 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0x4Eu, |
0 | 7893 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7894 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
832 | 7895 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, UIMSG_BF, 1u, 0x59u, |
423 | 7896 sHouseName, |
7897 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
832 | 7898 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
7899 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, UIMSG_BF, 1u, 0x59u, sHouseName, 0); | |
0 | 7900 } |
7901 else | |
7902 { | |
459 | 7903 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7904 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7905 { |
7906 pDialogueWindow->Release(); | |
7907 } | |
7908 else | |
7909 { | |
7910 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7911 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7912 } |
7913 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7914 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7915 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 7916 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
832 | 7917 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7918 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7919 { |
484 | 7920 sub_4B3B42(in_current_building_type); |
0 | 7921 } |
7922 else | |
7923 { | |
7924 if ( v17->joins ) | |
7925 { | |
423 | 7926 num_menu_buttons = 1; |
858 | 7927 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7928 } |
423 | 7929 if ( v17->evt_A) |
7930 { | |
7931 if ( num_menu_buttons < 4 ) | |
7932 { | |
7933 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7934 if ( v6 == 1 || v6 == 2 ) |
832 | 7935 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7936 } |
7937 } | |
7938 if ( v17->evt_B ) | |
7939 { | |
7940 if ( num_menu_buttons < 4 ) | |
7941 { | |
7942 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7943 if ( v8 == 1 || v8 == 2 ) |
832 | 7944 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7945 } |
7946 } | |
7947 if ( v17->evt_C ) | |
7948 { | |
7949 if ( num_menu_buttons < 4 ) | |
7950 { | |
7951 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7952 if ( v10 == 1 || v10 == 2 ) |
832 | 7953 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7954 } |
7955 } | |
7956 | |
7957 if ( v17->evt_D ) | |
7958 { | |
7959 if ( num_menu_buttons < 4 ) | |
7960 { | |
7961 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7962 if ( v12 == 1 || v12 == 2 ) |
832 | 7963 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7964 } |
7965 } | |
7966 if ( v17->evt_E ) | |
7967 { | |
7968 if ( num_menu_buttons < 4 ) | |
7969 { | |
7970 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7971 if ( v14 == 1 || v14 == 2 ) |
832 | 7972 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7973 } |
7974 } | |
7975 if ( v17->evt_F ) | |
7976 { | |
7977 if ( num_menu_buttons < 4 ) | |
7978 { | |
7979 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7980 if ( v16 == 1 || v16 == 2 ) |
832 | 7981 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7982 } |
7983 } | |
7984 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 7985 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7986 } | |
747 | 7987 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7988 } |
7989 | |
0 | 7990 } |
7991 | |
7992 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7993 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7994 { |
0 | 7995 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7996 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7997 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7998 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 7999 } |
8000 | |
8001 //----- (004B46F8) -------------------------------------------------------- | |
8002 int __fastcall sub_4B46F8(int a1) | |
8003 { | |
8004 int v1; // eax@1 | |
8005 int i; // edx@1 | |
8006 | |
8007 v1 = 0; | |
8008 for ( i = 0; i < a1; ++i ) | |
8009 v1 += i + 1; | |
8010 return 1000 * v1; | |
8011 } | |
8012 | |
8013 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8014 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8015 { |
656 | 8016 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8017 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8018 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8019 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8020 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8021 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8022 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8023 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8024 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8025 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8026 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8027 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8028 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8029 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8030 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8031 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8032 //v1 = _this; |
656 | 8033 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8034 //v3 = v1; |
656 | 8035 uDialogueType = newDialogueType; |
8036 if (!speakingNPC->uFlags) | |
8037 { | |
8038 speakingNPC->uFlags = 1; | |
8039 //v3 = uDialogueType; | |
8040 } | |
8041 | |
8042 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8043 { | |
8044 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8045 } | |
8046 else if(newDialogueType == DIALOGUE_76) | |
8047 { | |
8048 if (speakingNPC->Hired()) | |
8049 { | |
8050 v8 = 0; | |
8051 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8052 { | |
8053 v6 = (char *)pNPCStats->pNewNPCData; | |
8054 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8055 { | |
8056 ++v8; | |
8057 v6 += 76; | |
8058 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8059 break; | |
8060 } | |
8061 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8062 v6[8] &= 0x7Fu; | |
8063 } | |
8064 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8065 { | |
8066 v11 = pParty->pHirelings; | |
8067 memset(v11, 0, sizeof(NPCData)); | |
8068 } | |
8069 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8070 { | |
8071 v11 = &pParty->pHirelings[1]; | |
8072 memset(v11, 0, sizeof(NPCData)); | |
8073 } | |
8074 pParty->field_709 = 0; | |
659 | 8075 Party__CountHirelings(); |
656 | 8076 dword_591084 = 0; |
8077 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8078 dword_7241C8 = 0; | |
8079 return; | |
8080 } | |
8081 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8082 { | |
8083 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8084 ShowStatusBarString(v7, 2u); | |
8085 } | |
8086 else | |
8087 { | |
8088 //v9 = v2->uProfession; | |
8089 if ( speakingNPC->uProfession != 51 ) | |
8090 { | |
8091 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8092 if ( pParty->uNumGold < v10 ) | |
8093 { | |
8094 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8095 dialogue_show_profession_details = false; | |
8096 uDialogueType = 13; | |
8097 if ( uActiveCharacter ) | |
8098 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8099 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8100 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8101 if ( !dword_7241C8 ) | |
8102 pGame->Draw(); | |
8103 dword_7241C8 = 0; | |
8104 return; | |
8105 } | |
8106 Party::TakeGold(v10); | |
8107 } | |
8108 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8109 if ( pParty->pHirelings[0].pName ) | |
8110 { | |
8111 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8112 v15 = speakingNPC->pName; | |
8113 v13 = pParty->pHireling2Name; | |
8114 } | |
8115 else | |
8116 { | |
8117 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8118 v15 = speakingNPC->pName; | |
8119 v13 = pParty->pHireling1Name; | |
8120 } | |
8121 strcpy(v13, v15); | |
8122 pParty->field_709 = 0; | |
659 | 8123 Party__CountHirelings(); |
656 | 8124 |
8125 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8126 | |
711 | 8127 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8128 pDialogue_SpeakingActor->uAIState = Removed; |
8129 if ( uActiveCharacter ) | |
8130 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8131 } | |
8132 } | |
8133 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8134 { | |
8135 ArenaFight(); | |
8136 return; | |
8137 } | |
8138 else if(newDialogueType == DIALOGUE_9) | |
8139 { | |
8140 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8141 { | |
8142 if ( speakingNPC->uProfession != 41 ) | |
8143 speakingNPC->bHasUsedTheAbility = 1; | |
8144 | |
8145 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8146 } | |
8147 else | |
8148 { | |
8149 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8150 } | |
8151 } | |
8152 else if(newDialogueType == DIALOGUE_13) | |
8153 { | |
8154 if (!speakingNPC->Hired()) | |
8155 { | |
8156 sub_4B3E1E(); | |
8157 dialogue_show_profession_details = false; | |
8158 } | |
8159 else | |
8160 { | |
8161 v5 = 0; | |
8162 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8163 { | |
8164 v6 = (char *)pNPCStats->pNewNPCData; | |
8165 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8166 { | |
8167 ++v5; | |
8168 v6 += 76; | |
8169 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8170 break; | |
8171 } | |
8172 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8173 v6[8] &= 0x7Fu; | |
8174 } | |
8175 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8176 { | |
8177 v11 = pParty->pHirelings; | |
8178 memset(v11, 0, sizeof(NPCData)); | |
8179 } | |
8180 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8181 { | |
8182 v11 = &pParty->pHirelings[1]; | |
8183 memset(v11, 0, sizeof(NPCData)); | |
8184 } | |
8185 pParty->field_709 = 0; | |
659 | 8186 Party__CountHirelings(); |
656 | 8187 dword_591084 = 0; |
8188 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8189 dword_7241C8 = 0; | |
8190 return; | |
8191 } | |
8192 } | |
8193 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8194 { | |
8195 switch(newDialogueType) | |
8196 { | |
8197 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8198 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8199 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8200 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8201 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8202 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8203 } | |
8204 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8205 sub_4B3FE5(npc_event_id); //200-310 | |
8206 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8207 { //400-410 | |
8208 dword_F8B1D8 = newDialogueType; | |
8209 DrawJoinGuildWindow(npc_event_id - 400); | |
8210 } | |
8211 else | |
8212 { | |
8213 switch ( npc_event_id ) | |
8214 { | |
8215 case 139: | |
8216 sub_4B1ECE(); | |
8217 break; | |
8218 case 311: | |
8219 sub_4BBA85_bounties(); | |
8220 break; | |
8221 case 399: | |
8222 sub_4BBCDD(); | |
8223 break; | |
8224 default: | |
8225 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8226 current_npc_text = 0; |
656 | 8227 EventProcessor(npc_event_id, 0, 1); |
8228 activeLevelDecoration = NULL; | |
8229 break; | |
8230 } | |
8231 } | |
8232 } | |
8233 if ( !dword_7241C8 ) | |
8234 pGame->Draw(); | |
8235 dword_7241C8 = 0; | |
8236 } | |
0 | 8237 |
8238 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8239 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8240 { |
8241 int v6; // edx@8 | |
8242 int v7; // edx@9 | |
8243 int v8; // edx@10 | |
8244 unsigned __int8 v9; // zf@16 | |
8245 char v10; // sf@16 | |
8246 unsigned __int8 v11; // of@16 | |
702 | 8247 bool test; |
0 | 8248 |
907 | 8249 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8250 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8251 return 0; |
907 | 8252 switch( p2DEvents[_2da_idx - 1].uType ) |
8253 { | |
8254 case BildingType_WeaponShop: | |
8255 { | |
8256 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8257 break; | |
8258 } | |
8259 case BildingType_ArmorShop: | |
8260 { | |
8261 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8262 break; | |
8263 } | |
8264 case BildingType_MagicShop: | |
8265 { | |
8266 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8267 break; | |
8268 } | |
8269 case BildingType_AlchemistShop: | |
8270 { | |
8271 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8272 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8273 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8274 break; | |
8275 } | |
8276 default: | |
8277 { | |
8278 test = false; | |
8279 break; | |
8280 } | |
8281 } | |
702 | 8282 return test; |
8283 /* | |
8284 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8285 { |
8286 v11 = __OFSUB__(v5, 2); | |
8287 v9 = v5 == 2; | |
8288 v10 = v5 - 2 < 0; | |
8289 goto LABEL_23; | |
8290 } | |
702 | 8291 if ( p2DEvents[a2 - 1].uType > 2 ) |
8292 { | |
8293 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8294 { |
8295 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8296 return v5 == 16; | |
8297 return 1; | |
8298 } | |
702 | 8299 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8300 return 0; |
702 | 8301 if ( p2DEvents[a2 - 1].uType == 4) |
8302 { | |
8303 if ( v5 < 13 ) | |
8304 return 0; | |
8305 if ( v5 <= 14 ) | |
8306 return 1; | |
8307 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8308 return 0; | |
8309 v11 = __OFSUB__(v3, 771); | |
8310 v9 = v3 == 771; | |
8311 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8312 LABEL_23: |
702 | 8313 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8314 return 0; | |
8315 return 1; | |
8316 } | |
8317 } | |
8318 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8319 { | |
8320 if ( v5 >= 3 ) | |
8321 { | |
8322 v11 = __OFSUB__(v5, 9); | |
8323 v9 = v5 == 9; | |
8324 v10 = v5 - 9 < 0; | |
8325 goto LABEL_23; | |
8326 } | |
0 | 8327 } |
8328 return 0; | |
702 | 8329 */ |
0 | 8330 } |
8331 | |
8332 //----- (004B6478) -------------------------------------------------------- | |
711 | 8333 void sub_4B6478() |
8334 { | |
0 | 8335 GUIWindow *v0; // ebx@1 |
8336 Player *v1; // edi@1 | |
8337 unsigned int v2; // eax@1 | |
8338 signed int v3; // esi@1 | |
8339 int v4; // ebx@1 | |
8340 unsigned int v5; // esi@5 | |
8341 int v6; // edi@6 | |
8342 int result; // eax@13 | |
8343 GUIWindow *v8; // ebx@17 | |
8344 int v9; // eax@17 | |
8345 int v10; // ecx@17 | |
8346 unsigned int v11; // ecx@18 | |
8347 int v12; // eax@20 | |
8348 int v13; // eax@21 | |
8349 GUIButton *v14; // esi@27 | |
8350 int v15; // ecx@27 | |
8351 unsigned int v16; // eax@28 | |
8352 const char *v17; // ebx@29 | |
8353 int v18; // eax@29 | |
8354 unsigned int v19; // ecx@29 | |
8355 int v20; // eax@29 | |
8356 unsigned __int16 v21; // ax@29 | |
8357 unsigned __int16 v22; // ST14_2@36 | |
8358 int v23; // eax@36 | |
8359 const char *v24; // ST18_4@37 | |
8360 unsigned __int16 v25; // ST14_2@37 | |
8361 int v26; // eax@37 | |
8362 int v27; // [sp-4h] [bp-80h]@8 | |
8363 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8364 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8365 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8366 int v31; // [sp+68h] [bp-14h]@1 | |
8367 int v32; // [sp+6Ch] [bp-10h]@1 | |
8368 int v33; // [sp+70h] [bp-Ch]@17 | |
8369 int v34; // [sp+74h] [bp-8h]@17 | |
8370 int v35; // [sp+78h] [bp-4h]@17 | |
8371 | |
336 | 8372 v0 = window_SpeakInHouse; |
8373 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8374 v1 = pPlayers[uActiveCharacter]; |
8375 v28.uFrameX = 483; | |
8376 v28.uFrameWidth = 148; | |
8377 v28.uFrameZ = 334; | |
8378 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8379 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8380 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8381 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8382 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8383 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8384 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8385 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8386 v32 = v4; | |
8387 if ( v4 < v3 / 3 ) | |
8388 { | |
8389 v4 = v3 / 3; | |
8390 v32 = v3 / 3; | |
8391 } | |
749 | 8392 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8393 { |
8394 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8395 { | |
8396 v5 = 0; | |
8397 | |
8398 __debugbreak(); | |
8399 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8400 // or | |
8401 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8402 // or | |
8403 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8404 __debugbreak(); // whacky condition - fix |
0 | 8405 if (false |
8406 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8407 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8408 { |
8409 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8410 } | |
8411 else | |
8412 { | |
8413 if ( pParty->uNumGold < v4 ) | |
8414 { | |
8415 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8416 v27 = 4; | |
8417 } | |
8418 else | |
8419 { | |
8420 Party::TakeGold(v4); | |
8421 *(short *)v6 = 1; | |
8422 v27 = 2; | |
8423 } | |
735 | 8424 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8425 } |
8426 } | |
8427 else | |
8428 { | |
8429 v5 = 0; | |
8430 } | |
437 | 8431 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8432 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8433 { | |
8434 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8435 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8436 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8437 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8438 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8439 }*/ |
8440 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8441 return; // void func |
0 | 8442 } |
484 | 8443 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8444 { |
8445 v24 = pNPCTopics[171].pText; | |
8446 v25 = v31; | |
8447 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8448 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8449 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8450 return ; |
8451 } | |
8452 | |
8453 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8454 return; | |
0 | 8455 v8 = pDialogueWindow; |
8456 v33 = 0; | |
8457 v34 = 0; | |
8458 v29 = pDialogueWindow; | |
8459 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8460 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8461 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8462 if ( v9 >= v10 ) | |
8463 goto LABEL_40; | |
8464 do | |
8465 { | |
832 | 8466 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8467 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8468 { |
8469 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8470 v33 += v12; | |
8471 ++v34; | |
8472 } | |
8473 v13 = v8->pStartingPosActiveItem; | |
8474 ++v35; | |
8475 } | |
8476 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8477 if ( !v34 ) | |
8478 { | |
8479 LABEL_40: | |
135 | 8480 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8481 strcat(pTmpBuf, "\n \n"); |
8482 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8483 v22 = v31; | |
8484 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8485 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8486 return; | |
0 | 8487 } |
8488 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8489 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8490 v32 = (149 - v33) / v34; | |
8491 if ( (149 - v33) / v34 > 32 ) | |
8492 v32 = 32; | |
711 | 8493 |
8494 v35 = v8->pStartingPosActiveItem; | |
0 | 8495 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8496 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8497 { |
8498 v33 = 2; | |
8499 do | |
8500 { | |
8501 v14 = v8->GetControl(v35); | |
832 | 8502 v15 = v14->msg_param - 36; |
135 | 8503 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8504 { |
8505 v16 = 0; | |
8506 if ( !v1->pActiveSkills[v15] ) | |
8507 { | |
8508 v17 = pSkillNames[v15]; | |
8509 v14->uY = v32 + v34; | |
8510 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8511 v19 = v14->uY; | |
8512 v14->uHeight = v18; | |
8513 v20 = v19 + v18 - 1; | |
8514 v14->uW = v20; | |
8515 v34 = v20; | |
8516 v21 = v31; | |
8517 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8518 v21 = v30; | |
8519 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8520 goto LABEL_34; | |
8521 } | |
8522 } | |
8523 else | |
8524 { | |
8525 v16 = 0; | |
8526 } | |
8527 v14->uW = v16; | |
8528 v14->uHeight = v16; | |
8529 v14->uY = v16; | |
8530 LABEL_34: | |
8531 v8 = v29; | |
8532 ++v35; | |
8533 ++v33; | |
711 | 8534 } |
8535 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8536 } | |
8537 return; | |
0 | 8538 } |
8539 | |
8540 //----- (00405CFF) -------------------------------------------------------- | |
8541 void stru262_TurnBased::End(bool bPlaySound) | |
8542 { | |
8543 stru262_TurnBased *v2; // edi@1 | |
8544 int v3; // ebx@1 | |
8545 int v4; // esi@1 | |
8546 unsigned __int8 v5; // zf@1 | |
8547 unsigned __int8 v6; // sf@1 | |
8548 TurnBased_QueueElem *v7; // ecx@2 | |
8549 unsigned __int16 *pAttributes; // ecx@7 | |
8550 size_t v9; // edx@7 | |
8551 unsigned __int16 v10; // ax@8 | |
8552 TurnBased_QueueElem *v11; // ebx@12 | |
8553 ObjectType objType; // eax@13 | |
8554 int objID; // esi@13 | |
8555 int v14; // [sp+Ch] [bp-4h]@11 | |
8556 | |
8557 v2 = this; | |
8558 v3 = 0; | |
8559 v4 = 0; | |
8560 v5 = this->uActorQueueSize == 0; | |
8561 v6 = this->uActorQueueSize < 0; | |
8562 this->field_4 = 0; | |
8563 if ( !(v6 | v5) ) | |
8564 { | |
8565 v7 = this->pQueue; | |
8566 do | |
8567 { | |
848 | 8568 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8569 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8570 ++v4; |
8571 ++v7; | |
8572 } | |
8573 while ( v4 < v2->uActorQueueSize ); | |
8574 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8575 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8576 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8577 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8578 v9 = uNumSpriteObjects; |
0 | 8579 do |
8580 { | |
8581 v10 = *pAttributes; | |
8582 if ( *pAttributes & 4 ) | |
8583 { | |
8584 LOBYTE(v10) = v10 & 0xFB; | |
8585 *pAttributes = v10; | |
8586 } | |
8587 pAttributes += 56; | |
8588 --v9; | |
8589 } | |
8590 while ( v9 ); | |
8591 } | |
8592 v14 = 0; | |
8593 if ( v2->uActorQueueSize > 0 ) | |
8594 { | |
8595 v11 = v2->pQueue; | |
8596 do | |
8597 { | |
848 | 8598 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8599 objID = PID_ID(v11->uPackedID); | |
0 | 8600 if ( objType == OBJECT_Player ) |
8601 { | |
8602 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8603 } | |
8604 else | |
8605 { | |
8606 if ( objType == OBJECT_Actor ) | |
8607 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8608 } | |
8609 ++v14; | |
8610 ++v11; | |
8611 } | |
8612 while ( v14 < v2->uActorQueueSize ); | |
8613 v3 = 0; | |
8614 } | |
8615 pAudioPlayer->StopChannels(-1, -1); | |
8616 if ( bPlaySound != v3 ) | |
8617 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8618 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8619 pEventTimer->StopGameTime(); | |
8620 dword_50C994 = v3; | |
8621 dword_50C998_turnbased_icon_1A = v3; | |
8622 } | |
8623 // 50C994: using guessed type int dword_50C994; | |
8624 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8625 | |
8626 //----- (00405E14) -------------------------------------------------------- | |
8627 void stru262_TurnBased::_405E14() | |
8628 { | |
8629 stru262_TurnBased *v1; // esi@1 | |
8630 int v2; // ecx@1 | |
8631 SpellBuff *v3; // edi@2 | |
8632 Actor *v4; // ebx@3 | |
8633 signed int v5; // edx@20 | |
8634 AIDirection *v6; // esi@21 | |
8635 int v7; // eax@21 | |
8636 int v8; // eax@21 | |
8637 int v9; // eax@22 | |
8638 int v10; // eax@23 | |
8639 int v11; // eax@37 | |
8640 int v12; // eax@44 | |
8641 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8642 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8643 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8644 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8645 int v17; // [sp+5Ch] [bp-10h]@6 |
8646 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8647 int v19; // [sp+64h] [bp-8h]@8 | |
8648 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8649 | |
8650 v1 = this; | |
8651 v2 = 0; | |
8652 v18 = v1; | |
8653 v20 = 0; | |
8654 if ( (signed int)uNumActors > 0 ) | |
8655 { | |
90 | 8656 //v3 = pActors;//[0].pActorBuffs; |
8657 v16 = pActors;//[0].pActorBuffs; | |
8658 v3 = v16->pActorBuffs; | |
0 | 8659 do |
8660 { | |
90 | 8661 v4 = v16; |
8662 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8663 v17 = v2; |
8664 else | |
8665 v17 = 1; | |
8666 v19 = v2; | |
8667 do | |
8668 { | |
8669 if ( v19 != 10 ) | |
8670 { | |
8671 v3->_4585CA(pParty->uTimePlayed); | |
8672 v2 = 0; | |
8673 } | |
8674 ++v19; | |
8675 ++v3; | |
8676 } | |
8677 while ( v19 < 22 ); | |
8678 if ( v17 != v2 | |
8679 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8680 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8681 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8682 if ( !(v4->uAttributes & 0x80) ) | |
8683 { | |
8684 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8685 { | |
8686 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8687 { | |
8688 v5 = v4->uCurrentActionLength; | |
8689 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8690 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8691 { | |
417 | 8692 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8693 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8694 v7 = v4->uAIState; |
8695 memcpy(&v15, v6, sizeof(v15)); | |
8696 v8 = v7 - 4; | |
8697 memcpy(&v14, &v15, sizeof(v14)); | |
8698 if ( v8 ) | |
8699 { | |
8700 v9 = v8 - 1; | |
8701 if ( v9 ) | |
8702 { | |
8703 v10 = v9 - 6; | |
8704 if ( v10 ) | |
8705 { | |
8706 if ( v10 != 8 ) | |
414 | 8707 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8708 } |
8709 } | |
8710 } | |
8711 else | |
8712 { | |
8713 v4->uCurrentActionTime = 0; | |
8714 v4->uCurrentActionLength = 0; | |
8715 v4->uAIState = Dead; | |
8716 v4->UpdateAnimation(); | |
8717 } | |
8718 v1 = v18; | |
8719 v2 = 0; | |
8720 } | |
8721 } | |
8722 } | |
8723 } | |
8724 ++v20; | |
90 | 8725 v3 = v16[1].pActorBuffs; |
8726 ++v16; | |
0 | 8727 } |
8728 while ( (signed int)v20 < (signed int)uNumActors ); | |
8729 } | |
8730 if ( v1->field_4 == 1 ) | |
8731 { | |
8732 v12 = v1->field_8; | |
8733 if ( v12 == 64 ) | |
8734 { | |
8735 v1->_406A63(); | |
8736 } | |
8737 else | |
8738 { | |
8739 if ( v12 > v2 ) | |
8740 { | |
8741 v1->_406B9F(); | |
8742 } | |
8743 else | |
8744 { | |
8745 v1->_406AFE(); | |
8746 v1->field_10 = 100; | |
8747 } | |
8748 } | |
8749 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8750 return; | |
8751 } | |
8752 if ( v1->field_4 == 2 ) | |
8753 { | |
8754 if ( !(v1->field_18 & 1) ) | |
8755 { | |
8756 v11 = v1->field_10; | |
8757 if ( v11 == 100 ) | |
8758 { | |
8759 v1->StartTurn(); | |
8760 LABEL_39: | |
8761 v1->_40652A(); | |
8762 return; | |
8763 } | |
8764 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8765 { | |
8766 v1->_4065B0(); | |
8767 goto LABEL_39; | |
8768 } | |
8769 } | |
8770 v1->NextTurn(); | |
8771 return; | |
8772 } | |
8773 if ( v1->field_4 == 3 ) | |
8774 { | |
8775 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8776 { | |
8777 v1->field_18 &= 0xFFFFFFF7u; | |
8778 v1->field_4 = 1; | |
8779 v1->field_8 = 64; | |
8780 } | |
8781 else | |
8782 { | |
8783 v1->_406FA8(); | |
8784 } | |
8785 } | |
8786 } | |
8787 | |
8788 //----- (0043FDED) -------------------------------------------------------- | |
8789 void PrepareActorRenderList_BLV() | |
8790 { | |
8791 RenderBillboard *v0; // esi@0 | |
8792 unsigned __int16 v3; // ax@3 | |
8793 unsigned int v4; // eax@5 | |
8794 unsigned __int16 v5; // cx@5 | |
8795 int v6; // esi@5 | |
8796 unsigned int v7; // eax@7 | |
8797 int v8; // eax@10 | |
8798 SpriteFrame *v9; // eax@16 | |
8799 SpriteFrame *v10; // ebx@18 | |
8800 //int *v11; // eax@18 | |
8801 int v12; // ecx@28 | |
8802 //IndoorCameraD3D **v14; // eax@36 | |
8803 double v15; // st7@36 | |
8804 float v16; // eax@36 | |
8805 //double v17; // ST30_8@36 | |
8806 signed __int64 v18; // qtt@36 | |
8807 int v19; // ST5C_4@36 | |
8808 signed __int64 v20; // qtt@37 | |
8809 int v21; // ST5C_4@37 | |
8810 signed __int16 v22; // cx@39 | |
8811 int v23; // ST50_4@40 | |
8812 signed int v24; // ecx@40 | |
8813 int v25; // edx@44 | |
8814 __int16 v26; // ax@44 | |
8815 //MonsterDesc *v27; // edx@44 | |
8816 //int v28; // ecx@44 | |
8817 unsigned __int8 v29; // zf@44 | |
8818 unsigned __int8 v30; // sf@44 | |
8819 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8820 int v32; // [sp+1Ch] [bp-38h]@5 | |
8821 int a3; // [sp+20h] [bp-34h]@5 | |
8822 int a2; // [sp+24h] [bp-30h]@5 | |
8823 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8824 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8825 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8826 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8827 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8828 int a6; // [sp+40h] [bp-14h]@34 | |
8829 int v43; // [sp+44h] [bp-10h]@34 | |
8830 int z; // [sp+48h] [bp-Ch]@32 | |
8831 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8832 int x; // [sp+50h] [bp-4h]@32 | |
8833 | |
8834 for (uint i = 0; i < uNumActors; ++i) | |
8835 { | |
8836 auto p = pActors + i; | |
8837 | |
8838 if (p->uAIState == Removed || | |
8839 p->uAIState == Disabled) | |
8840 continue; | |
8841 | |
8842 a5 = p->uSectorID; | |
8843 a2 = p->vPosition.y; | |
8844 a1a = p->vPosition.x; | |
8845 a3 = p->vPosition.z; | |
8846 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8847 LOWORD(v0) = p->uYawAngle; | |
8848 v5 = p->uCurrentActionAnimation; | |
8849 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8850 v32 = v6; | |
8851 if ( pParty->bTurnBasedModeOn ) | |
8852 { | |
8853 if ( v5 == 1 ) | |
8854 { | |
8855 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8856 goto LABEL_10; | |
8857 } | |
8858 } | |
8859 else | |
8860 { | |
8861 if ( v5 == 1 ) | |
8862 { | |
8863 v7 = pBLVRenderParams->field_0_timer_; | |
8864 LABEL_10: | |
8865 v8 = i * 32 + v7; | |
8866 goto LABEL_12; | |
8867 } | |
8868 } | |
8869 v8 = p->uCurrentActionTime; | |
8870 LABEL_12: | |
8871 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8872 v8 = 0; | |
8873 v31 = p->pSpriteIDs[v5]; | |
8874 if (p->uAIState == Resurrected) | |
8875 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8876 else | |
8877 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8878 v41 = 0; | |
8879 v10 = v9; | |
8880 //v11 = (int *)v9->uFlags; | |
8881 if (v9->uFlags & 2) | |
8882 v41 = 2; | |
8883 if (v9->uFlags & 0x40000) | |
8884 v41 |= 0x40u; | |
8885 if (v9->uFlags & 0x20000) | |
8886 LOBYTE(v41) = v41 | 0x80; | |
8887 v0 = (RenderBillboard *)(256 << v6); | |
8888 if ( (unsigned int)v0 & v9->uFlags) | |
8889 v41 |= 4u; | |
8890 if ( v10->uGlowRadius ) | |
8891 { | |
8892 //LOBYTE(v11) = byte_4E94D3; | |
8893 pMobileLightsStack->AddLight( | |
8894 a1a, | |
8895 a2, | |
8896 a3, | |
8897 a5, | |
8898 v10->uGlowRadius, | |
8899 0xFFu, | |
8900 0xFFu, | |
8901 0xFFu, | |
8902 byte_4E94D3); | |
8903 } | |
8904 v12 = 0; | |
8905 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8906 continue; | |
8907 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8908 { | |
8909 ++v12; | |
8910 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8911 goto _continue; | |
8912 } | |
8913 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8914 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8915 continue; | |
8916 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8917 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8918 if (uNumBillboardsToDraw >= 500) | |
8919 break; | |
8920 ++uNumBillboardsToDraw; | |
8921 ++uNumSpritesDrawnThisFrame; | |
8922 p->uAttributes |= 8u; | |
8923 v29 = pRenderer->pRenderD3D == 0; | |
8924 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8925 v0->uPalette = v10->uPaletteIndex; | |
8926 v0->uIndoorSectorID = a5; | |
8927 if ( v29 ) | |
8928 { | |
8929 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8930 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8931 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8932 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8933 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8934 } | |
8935 else | |
8936 { | |
8937 //v14 = &pGame->pIndoorCameraD3D; | |
8938 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8939 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8940 v16 = v0->fov_x; | |
8941 v0->fov_y = v15; | |
8942 //v17 = v16 + 6.7553994e15; | |
8943 LODWORD(v18) = 0; | |
8944 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8945 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8946 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8947 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8948 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8949 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8950 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8951 { | |
8952 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8953 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8954 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8955 goto LABEL_43; |
8956 } | |
8957 } | |
8958 else | |
8959 { | |
8960 v22 = p->pActorBuffs[3].uPower; | |
8961 if ( v22 ) | |
8962 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8963 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8964 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8965 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8966 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8967 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8968 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8969 goto LABEL_44; |
8970 } | |
8971 } | |
8972 LABEL_44: | |
8973 HIWORD(v25) = HIWORD(x); | |
430 | 8974 v0->world_x = a1a; |
8975 v0->world_y = a2; | |
8976 v0->world_z = a3; | |
0 | 8977 v0->uScreenSpaceX = v43; |
8978 v0->uScreenSpaceY = a6; | |
8979 LOWORD(v25) = 0; | |
8980 LOBYTE(v26) = v41; | |
194 | 8981 |
862 | 8982 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8983 v0->actual_z = HIWORD(x); |
862 | 8984 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8985 |
0 | 8986 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8987 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8988 v0->field_1E = v41; | |
8989 v0->pSpriteFrame = v10; | |
8990 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8991 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8992 { | |
8993 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8994 v0->field_1E = v26; | |
8995 } | |
8996 | |
8997 _continue: | |
8998 ; | |
8999 } | |
9000 } | |
9001 | |
9002 //----- (00444732) -------------------------------------------------------- | |
428 | 9003 char *GetEventHintString(unsigned int uEventID) |
9004 { | |
9005 signed int event_index; // edx@1 | |
9006 int event_pos; // esi@4 | |
0 | 9007 char *result; // eax@6 |
428 | 9008 unsigned int str_index; // eax@9 |
9009 int i; // esi@11 | |
9010 _evt_raw* test_evt; | |
9011 _evt_raw* last_evt; | |
9012 | |
9013 event_index = 0; | |
9014 if ( uLevelEVT_NumEvents <= 0 ) | |
9015 return NULL; | |
9016 | |
9017 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9018 while ( 1 ) |
9019 { | |
428 | 9020 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9021 { | |
9022 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9023 last_evt=test_evt; | |
9024 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9025 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9026 break; |
9027 } | |
428 | 9028 ++event_index; |
9029 if ( event_index >= uLevelEVT_NumEvents ) | |
9030 return NULL; | |
9031 } | |
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 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9037 } |
9038 else | |
9039 { | |
428 | 9040 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9041 { | |
9042 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9043 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9044 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9045 { | |
9046 str_index = EVT_DWORD(test_evt->v5); | |
9047 if ( str_index < 600 ) | |
9048 return (char *)p2DEvents[str_index - 1].pName; | |
9049 } | |
9050 } | |
9051 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9052 } | |
9053 | |
0 | 9054 return result; |
9055 } | |
9056 | |
9057 //----- (00444839) -------------------------------------------------------- | |
9058 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) | |
9059 { | |
9060 unsigned int v9; // ebx@1 | |
9061 int v10; // edi@1 | |
373 | 9062 //signed int v11; // eax@1 |
0 | 9063 unsigned int v12; // eax@6 |
9064 const char *v13; // ST0C_4@6 | |
9065 unsigned int v14; // eax@8 | |
9066 const char *v15; // eax@14 | |
9067 unsigned int v16; // eax@16 | |
9068 unsigned int result; // eax@26 | |
9069 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9070 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9071 char *v20; // [sp-4h] [bp-3Ch]@9 |
9072 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9073 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9074 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9075 | |
9076 v9 = a1; | |
9077 v10 = a2; | |
9078 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9079 dword_59117C_teleportx = x; | |
9080 dword_591178_teleporty = y; | |
9081 dword_591174_teleportz = z; | |
9082 dword_591170_teleport_directiony = directiony; | |
9083 dword_59116C_teleport_directionx = directionx; | |
9084 dword_591168_teleport_speedz = a8; | |
9085 dword_591164_teleport_map_name = (char *)pLocationName; | |
9086 uCurrentHouse_Animation = v9; | |
9087 pEventTimer->Pause(); | |
9088 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9089 |
9090 switch (pParty->alignment) | |
9091 { | |
9092 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9093 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9094 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9095 default: assert(false); | |
9096 } | |
9097 /*v11 = const_2(); | |
0 | 9098 sprintf(pContainer, "evt%02d", v11); |
9099 if ( pParty->uAlignment ) | |
9100 { | |
9101 if ( pParty->uAlignment != 2 ) | |
9102 goto LABEL_6; | |
9103 v19 = "-c"; | |
9104 } | |
9105 else | |
9106 { | |
9107 v19 = "-b"; | |
9108 } | |
373 | 9109 strcat(pContainer, v19);*/ |
9110 | |
9111 //LABEL_6: | |
0 | 9112 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9113 v13 = pHouse_ExitPictures[v10]; | |
9114 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9115 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9116 if ( v9 ) | |
9117 { | |
9118 if ( !v23 ) | |
898 | 9119 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); |
9120 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); | |
0 | 9121 } |
9122 else | |
9123 { | |
9124 if ( !v23 ) | |
9125 { | |
9126 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9127 if ( v14 ) | |
9128 { | |
721 | 9129 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9130 goto LABEL_20; |
9131 } | |
9132 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9133 goto LABEL_19; | |
9134 } | |
9135 } | |
9136 v15 = pLocationName; | |
9137 if ( *pLocationName == 48 ) | |
9138 v15 = pCurrentMapName; | |
9139 v16 = pMapStats->GetMapInfo(v15); | |
9140 if ( v16 ) | |
9141 { | |
721 | 9142 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9143 goto LABEL_20; | |
0 | 9144 } |
9145 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9146 LABEL_19: | |
423 | 9147 strcpy(sHouseName, v21); |
0 | 9148 LABEL_20: |
710 | 9149 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9150 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9151 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9152 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9153 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9154 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9155 result = v23; |
9156 if ( v23 ) | |
9157 uCurrentHouse_Animation = v23; | |
9158 return result; | |
9159 } |