Mercurial > mm7
annotate mm7_4.cpp @ 788:f004c7ceb7bd
Слияние
author | Ritor1 |
---|---|
date | Mon, 25 Mar 2013 02:21:14 +0600 |
parents | da80bd2922df b3e08a496778 |
children | 346f7069676a |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
198 | 3 #include <assert.h> |
0 | 4 |
341 | 5 #include "MM7.h" |
0 | 6 #include "MapInfo.h" |
7 #include "Game.h" | |
8 #include "GUIWindow.h" | |
9 #include "GUIButton.h" | |
10 #include "GUIFont.h" | |
11 #include "Party.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Outdoor.h" | |
14 #include "IndoorCamera.h" | |
15 #include "Overlays.h" | |
16 #include "Monsters.h" | |
17 #include "Arcomage.h" | |
18 #include "LOD.h" | |
19 #include "Actor.h" | |
20 #include "Allocator.h" | |
21 #include "Events.h" | |
22 #include "Viewport.h" | |
23 #include "FrameTableInc.h" | |
24 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
25 #include "SpriteObject.h" |
0 | 26 #include "ObjectList.h" |
27 #include "Chest.h" | |
28 #include "PaletteManager.h" | |
29 #include "DecorationList.h" | |
30 #include "SaveLoad.h" | |
31 #include "stru123.h" | |
32 #include "stru287.h" | |
33 #include "Time.h" | |
34 #include "IconFrameTable.h" | |
35 #include "GUIProgressBar.h" | |
36 #include "Bink_Smacker.h" | |
37 #include "TileFrameTable.h" | |
38 #include "PlayerFrameTable.h" | |
39 #include "Awards.h" | |
40 #include "Autonotes.h" | |
41 #include "stru160.h" | |
42 #include "stru279.h" | |
43 #include "TurnEngine.h" | |
44 #include "FactionTable.h" | |
45 #include "StorylineTextTable.h" | |
46 #include "Random.h" | |
47 #include "stru277.h" | |
48 #include "stru298.h" | |
49 #include "stru12.h" | |
50 #include "stru351.h" | |
51 #include "Events2D.h" | |
52 #include "stru159.h" | |
189 | 53 #include "texts.h" |
0 | 54 #include "Log.h" |
629 | 55 #include "UIHouses.h" |
0 | 56 #include "mm7_data.h" |
57 | |
58 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 59 void __cdecl check_event_triggers() |
0 | 60 { |
61 int v0; // eax@1 | |
62 LevelDecoration *v1; // esi@2 | |
63 signed int v2; // edi@2 | |
64 int v3; // ebx@2 | |
65 int v4; // eax@3 | |
66 int v5; // ebx@3 | |
67 unsigned int v6; // ecx@3 | |
68 unsigned int v7; // edx@6 | |
69 unsigned int v8; // edx@8 | |
112 | 70 Actor *v9; // edi@13 |
0 | 71 int v10; // ebx@14 |
72 int v11; // eax@14 | |
73 int v12; // ebx@14 | |
74 unsigned int v13; // ecx@14 | |
75 int v14; // edx@15 | |
76 unsigned int v15; // edx@17 | |
77 unsigned int v16; // edx@19 | |
78 char *v17; // edi@25 | |
79 int v18; // ebx@26 | |
80 int v19; // eax@26 | |
81 int v20; // ebx@26 | |
82 unsigned int v21; // ecx@26 | |
83 int v22; // edx@27 | |
84 unsigned int v23; // edx@29 | |
85 unsigned int v24; // edx@31 | |
86 int v25; // [sp+0h] [bp-24h]@3 | |
87 int v26; // [sp+0h] [bp-24h]@14 | |
88 int v27; // [sp+0h] [bp-24h]@26 | |
89 int v28; // [sp+4h] [bp-20h]@3 | |
90 int v29; // [sp+4h] [bp-20h]@14 | |
91 int v30; // [sp+4h] [bp-20h]@26 | |
92 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
93 int v32; // [sp+Ch] [bp-18h]@2 | |
94 int v33; // [sp+10h] [bp-14h]@2 | |
95 int i; // [sp+14h] [bp-10h]@1 | |
96 int v35; // [sp+18h] [bp-Ch]@2 | |
97 int v36; // [sp+1Ch] [bp-8h]@3 | |
98 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
99 signed int v38; // [sp+20h] [bp-4h]@24 | |
100 | |
101 v0 = 0; | |
102 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
103 { | |
104 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
105 v2 = v1->field_18; | |
106 v3 = v1->vPosition.y; | |
107 v33 = v1->vPosition.x; | |
108 v32 = v1->vPosition.y; | |
109 v35 = v1->vPosition.z; | |
110 v31 = v1->field_18; | |
111 if ( v1->field_2 & 1 ) | |
112 { | |
113 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
114 v25 = abs(v3 - pParty->vPosition.y); | |
115 v28 = abs(v35 - pParty->vPosition.z); | |
116 v4 = v36; | |
117 v5 = v25; | |
118 v6 = v28; | |
119 if ( v36 < v25 ) | |
120 { | |
121 v4 = v25; | |
122 v5 = v36; | |
123 } | |
124 if ( v4 < v28 ) | |
125 { | |
126 v7 = v4; | |
127 v4 = v28; | |
128 v6 = v7; | |
129 } | |
130 if ( v5 < (signed int)v6 ) | |
131 { | |
132 v8 = v6; | |
133 v6 = v5; | |
134 v5 = v8; | |
135 } | |
136 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
137 EventProcessor(v1->field_16_event_id, 8 * i | 5, 1); | |
138 } | |
139 if ( v1->field_2 & 2 ) | |
140 { | |
141 v37 = 0; | |
142 if ( (signed int)uNumActors > 0 ) | |
143 { | |
112 | 144 v9 = pActors;//[0].vPosition.y; |
0 | 145 do |
146 { | |
112 | 147 v10 = abs(v33 - v9->vPosition.x); |
148 v29 = abs(v32 - v9->vPosition.y); | |
149 v26 = abs(v35 - v9->vPosition.z); | |
0 | 150 v11 = v10; |
151 v12 = v29; | |
152 v13 = v26; | |
153 if ( v11 < v29 ) | |
154 { | |
155 v14 = v11; | |
156 v11 = v29; | |
157 v12 = v14; | |
158 } | |
159 if ( v11 < v26 ) | |
160 { | |
161 v15 = v11; | |
162 v11 = v26; | |
163 v13 = v15; | |
164 } | |
165 if ( v12 < (signed int)v13 ) | |
166 { | |
167 v16 = v13; | |
168 v13 = v12; | |
169 v12 = v16; | |
170 } | |
171 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
172 EventProcessor(v1->field_16_event_id, 0, 1); | |
173 ++v37; | |
112 | 174 ++v9; |
0 | 175 } |
176 while ( v37 < (signed int)uNumActors ); | |
177 } | |
178 } | |
179 if ( v1->field_2 & 4 ) | |
180 { | |
181 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
182 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
183 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
184 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 185 do |
186 { | |
187 v18 = abs(v33 - *((int *)v17 - 1)); | |
188 v30 = abs(v32 - *(int *)v17); | |
189 v27 = abs(v35 - *((int *)v17 + 1)); | |
190 v19 = v18; | |
191 v20 = v30; | |
192 v21 = v27; | |
193 if ( v19 < v30 ) | |
194 { | |
195 v22 = v19; | |
196 v19 = v30; | |
197 v20 = v22; | |
198 } | |
199 if ( v19 < v27 ) | |
200 { | |
201 v23 = v19; | |
202 v19 = v27; | |
203 v21 = v23; | |
204 } | |
205 if ( v20 < (signed int)v21 ) | |
206 { | |
207 v24 = v21; | |
208 v21 = v20; | |
209 v20 = v24; | |
210 } | |
211 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
212 EventProcessor(v1->field_16_event_id, 0, 1); | |
213 ++v38; | |
214 v17 += 112; | |
215 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
216 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 217 } |
218 } | |
219 v0 = i + 1; | |
220 } | |
221 } | |
222 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
223 | |
224 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 225 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 226 { |
227 int v13; // ecx@13 | |
228 signed int v14; // ebx@14 | |
229 int v15; // eax@16 | |
729 | 230 //int v16; // edx@19 |
0 | 231 int v17; // ST18_4@19 |
232 signed int v18; // edx@19 | |
233 signed __int64 v19; // qtt@19 | |
234 int v21; // eax@27 | |
235 int v22; // ecx@29 | |
236 signed int v28; // eax@45 | |
237 int v29; // ebx@47 | |
238 int v30; // edx@49 | |
239 int v31; // ST10_4@49 | |
240 signed int v32; // edx@49 | |
241 signed __int64 v33; // qtt@49 | |
242 signed int v34; // eax@54 | |
243 signed int v35; // esi@56 | |
244 int result; // eax@57 | |
245 int v38; // edx@62 | |
246 int v44; // [sp+20h] [bp-20h]@10 | |
247 bool v47; // [sp+24h] [bp-1Ch]@43 | |
248 bool v48; // [sp+28h] [bp-18h]@10 | |
249 bool v49; // [sp+28h] [bp-18h]@41 | |
250 bool v50; // [sp+2Ch] [bp-14h]@12 | |
251 signed int v53; // [sp+30h] [bp-10h]@10 | |
252 signed int v54; // [sp+30h] [bp-10h]@41 | |
253 signed int v55; // [sp+34h] [bp-Ch]@1 | |
254 | |
730 | 255 //LOG_DECOMPILATION_WARNING(); |
256 | |
257 static int blv_floor_id[50]; // 00721200 | |
258 static int blv_floor_level[50]; // 007212C8 | |
259 | |
260 static __int16 word_721390_ys[104]; // idb | |
261 static __int16 word_721460_xs[104]; // idb | |
0 | 262 |
263 auto pSector = &pIndoor->pSectors[uSectorID]; | |
723 | 264 v55 = 1; |
0 | 265 for (uint i = 0; i < pSector->uNumFloors; ++i) |
266 { | |
267 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
268 if (pFloor->Clickable()) | |
269 continue; | |
270 | |
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 } |
281 v44 = 2 * pFloor->uNumVertices; | |
730 | 282 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
283 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
284 | |
285 v48 = word_721390_ys[0] >= y; | |
0 | 286 v53 = 0; |
287 if ( pFloor->uNumVertices > 0 ) | |
288 { | |
723 | 289 for ( int i = 0; i < v44; i++ ) |
0 | 290 { |
291 if ( v53 >= 2 ) | |
292 break; | |
730 | 293 v50 = word_721390_ys[i + 1] >= y; |
294 | |
295 v13 = i; | |
296 if ( v48 != v50 ) | |
0 | 297 { |
730 | 298 v14 = word_721460_xs[i + 1] >= x ? 0 : 2; |
299 v15 = v14 | word_721460_xs[i] < x; | |
729 | 300 |
301 if ( !v15) | |
302 ++v53; | |
303 else | |
304 { | |
730 | 305 //v16 = word_721390_ys[i]; |
306 v17 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
307 v18 = y - word_721390_ys[i]; | |
729 | 308 LODWORD(v19) = v18 << 16; |
309 HIDWORD(v19) = v18 >> 16; | |
730 | 310 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x) |
729 | 311 ++v53; |
312 } | |
313 /*if ( v15 != 3 ) | |
0 | 314 { |
723 | 315 if ( !v15 ) |
316 { | |
730 | 317 LODWORD(v19) = (y - word_721390_ys[i]) << 16; |
318 HIDWORD(v19) = (y - word_721390_ys[i]) >> 16; | |
319 v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]); | |
723 | 320 if ( v16 >= x) |
321 ++v53; | |
322 } | |
729 | 323 }*/ |
0 | 324 } |
325 v48 = v50; | |
723 | 326 } |
0 | 327 if ( v53 == 1 ) |
328 { | |
329 if ( v55 >= 50 ) | |
330 break; | |
723 | 331 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 332 { |
725 | 333 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 334 } |
335 else | |
336 { | |
725 | 337 v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) |
0 | 338 + HIWORD(pFloor->zCalc3); |
339 } | |
340 v22 = v55++; | |
725 | 341 blv_floor_level[v22] = v21; |
730 | 342 blv_floor_id[v22] = pSector->pFloors[i]; |
0 | 343 } |
344 } | |
345 } | |
346 } | |
347 if ( pSector->field_0 & 8 ) | |
348 { | |
349 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
350 { | |
351 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
352 if (portal->uPolygonType != POLYGON_Floor) | |
353 continue; | |
354 | |
723 | 355 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
356 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
357 { | |
0 | 358 for (uint j = 0; j < portal->uNumVertices; ++j) |
359 { | |
730 | 360 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
361 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
362 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
363 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
364 } | |
365 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
366 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 367 v54 = 0; |
730 | 368 v49 = word_721390_ys[0] >= y; |
435 | 369 if ( portal->uNumVertices > 0 ) |
0 | 370 { |
723 | 371 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) |
0 | 372 { |
373 if ( v54 >= 2 ) | |
374 break; | |
730 | 375 v47 = word_721390_ys[i + 1] >= y; |
0 | 376 if ( v49 != v47 ) |
377 { | |
730 | 378 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; |
379 v29 = v28 | word_721460_xs[i] < x; | |
0 | 380 if ( v29 != 3 ) |
381 { | |
723 | 382 if ( !v29 ) |
729 | 383 ++v54; |
384 else | |
385 { | |
730 | 386 //v30 = word_721390_ys[v27]; |
387 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | |
388 v32 = y - word_721390_ys[i]; | |
729 | 389 LODWORD(v33) = v32 << 16; |
390 HIDWORD(v33) = v32 >> 16; | |
730 | 391 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x) |
723 | 392 ++v54; |
729 | 393 } |
0 | 394 } |
395 } | |
396 v49 = v47; | |
397 } | |
398 if ( v54 == 1 ) | |
399 { | |
400 if ( v55 >= 50 ) | |
401 break; | |
402 v34 = v55++; | |
725 | 403 blv_floor_level[v34] = -29000; |
730 | 404 blv_floor_id[v34] = pSector->pPortals[i]; |
0 | 405 } |
406 } | |
407 } | |
408 } | |
409 } | |
410 if ( v55 == 1 ) | |
411 { | |
730 | 412 *pFaceID = blv_floor_id[0]; |
725 | 413 return blv_floor_level[0]; |
0 | 414 } |
415 if ( !v55 ) | |
416 return -30000; | |
730 | 417 *pFaceID = blv_floor_id[0]; |
725 | 418 //result = blv_floor_level[0]; |
0 | 419 if ( v55 > 1 ) |
420 { | |
717 | 421 for ( v35 = 1; v35 < v55; ++v35 ) |
0 | 422 { |
725 | 423 if ( blv_floor_level[0] <= z + 5 ) |
424 { | |
425 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 426 continue; |
725 | 427 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 428 *pFaceID = blv_floor_id[v35]; |
717 | 429 continue; |
430 } | |
725 | 431 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
432 { | |
433 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 434 *pFaceID = blv_floor_id[v35]; |
717 | 435 } |
436 } | |
0 | 437 } |
725 | 438 return blv_floor_level[0]; |
0 | 439 } |
440 | |
441 //----- (0046D49E) -------------------------------------------------------- | |
723 | 442 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7) |
0 | 443 { |
723 | 444 BSPModel *pBModel; // esi@4 |
445 ODMFace *pFace; // ecx@11 | |
0 | 446 int v14; // edx@20 |
447 signed int v18; // edx@26 | |
448 int v19; // eax@28 | |
449 int v20; // edx@30 | |
450 int v21; // ST1C_4@30 | |
451 signed int v22; // edx@30 | |
452 signed __int64 v23; // qtt@30 | |
453 int v24; // eax@36 | |
454 signed int v25; // ecx@38 | |
455 int result; // eax@42 | |
456 signed int v27; // ecx@43 | |
457 int v28; // edi@44 | |
458 signed int v29; // edx@44 | |
459 int v30; // esi@45 | |
460 int v31; // eax@45 | |
461 ODMFace *v32; // eax@57 | |
462 int v33; // ecx@59 | |
463 int v36; // [sp+14h] [bp-2Ch]@24 | |
464 int v38; // [sp+1Ch] [bp-24h]@2 | |
465 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 466 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
467 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 468 bool v43; // [sp+30h] [bp-10h]@22 |
469 bool v44; // [sp+34h] [bp-Ch]@24 | |
470 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
471 signed int v48; // [sp+58h] [bp+18h]@22 | |
472 signed int v49; // [sp+58h] [bp+18h]@43 | |
473 | |
474 v46 = 1; | |
475 dword_721160[0] = -1; | |
476 dword_721110[0] = -1; | |
725 | 477 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7); |
0 | 478 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 479 { |
480 *a6 = 0; | |
725 | 481 return odm_floor_level[0]; |
723 | 482 } |
0 | 483 v38 = 0; |
723 | 484 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
485 { | |
486 pBModel = &pOutdoor->pBModels[v38]; | |
487 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
488 { | |
489 if ( (signed int)pBModel->uNumFaces > 0 ) | |
490 { | |
491 v39 = 0; | |
492 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
493 { | |
494 pFace = &pBModel->pFaces[v39]; | |
495 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
496 && !(pFace->uAttributes & 0x20000000) | |
497 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
498 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 499 { |
723 | 500 if ( pFace->uNumVertices ) |
0 | 501 { |
723 | 502 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 503 { |
723 | 504 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
505 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
506 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
507 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
508 } | |
509 } | |
510 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
511 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
512 v43 = word_720F70[0] >= Y; | |
513 v48 = 0; | |
514 if ( 2 * pFace->uNumVertices > 0 ) | |
515 { | |
516 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
517 { | |
518 if ( v48 >= 2 ) | |
519 break; | |
520 v36 = word_720F70[i + 1]; | |
521 v44 = word_720F70[i + 1] >= Y; | |
522 if ( v43 != v44 ) | |
0 | 523 { |
723 | 524 v18 = word_721040[i + 1] >= X ? 0 : 2; |
525 v19 = v18 | word_721040[i] < X; | |
526 if ( v19 != 3 ) | |
0 | 527 { |
723 | 528 if ( !v19 ) |
740 | 529 ++v48; |
530 else | |
0 | 531 { |
723 | 532 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
533 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
534 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
535 if ( v22 >= X) | |
536 ++v48; | |
0 | 537 } |
538 } | |
539 } | |
723 | 540 v43 = v44; |
541 } | |
542 if ( v48 == 1 ) | |
543 { | |
544 if ( v46 >= 20 ) | |
0 | 545 break; |
723 | 546 if ( pFace->uPolygonType == POLYGON_Floor ) |
547 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
548 else | |
725 | 549 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
550 + HIWORD(pFace->zCalc3); | |
723 | 551 v25 = v46++; |
725 | 552 odm_floor_level[v25] = v24; |
723 | 553 dword_721160[v25] = pBModelNum; |
554 dword_721110[v25] = pFaceNum; | |
0 | 555 } |
556 } | |
557 } | |
723 | 558 ++v39; |
559 } | |
560 } | |
561 } | |
0 | 562 ++v38; |
563 } | |
564 if ( v46 == 1 ) | |
565 { | |
566 *a6 = 0; | |
725 | 567 return odm_floor_level[0]; |
0 | 568 } |
569 v27 = 0; | |
570 if ( v46 <= 1 ) | |
571 *a6 = 0; | |
723 | 572 else |
573 { | |
725 | 574 //v29 = 1; |
723 | 575 for ( v49 = 1; v49 < v46; ++v49 ) |
576 { | |
725 | 577 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 578 { |
579 v27 = v49; | |
725 | 580 //++v29; |
723 | 581 break; |
582 } | |
725 | 583 if ( odm_floor_level[0] > Z + 5 ) |
584 { | |
585 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
586 { | |
587 //++v29; | |
723 | 588 break; |
589 } | |
590 v27 = v49; | |
725 | 591 //++v29; |
723 | 592 break; |
593 } | |
725 | 594 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 595 { |
596 v27 = v49; | |
725 | 597 //++v29; |
723 | 598 } |
599 } | |
600 if ( !v27 ) | |
601 *a6 = 0; | |
602 else | |
603 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
604 } | |
0 | 605 if ( v27 ) |
606 { | |
607 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
608 *a5 = 0; | |
609 if ( v32->uAttributes & 0x10 ) | |
610 *a5 = 1; | |
611 } | |
725 | 612 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
613 odm_floor_level[0] = odm_floor_level[v27]; | |
614 return odm_floor_level[0]; | |
0 | 615 } |
616 | |
617 //----- (0046D8E3) -------------------------------------------------------- | |
618 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
619 { | |
620 int v4; // ebx@1 | |
621 unsigned int v5; // ecx@1 | |
622 BSPModel *v6; // edi@3 | |
623 ODMFace *v7; // esi@10 | |
624 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
625 signed __int16 *v9; // eax@18 |
0 | 626 int v10; // edx@19 |
627 int v11; // ecx@21 | |
628 int v12; // ecx@23 | |
629 signed int v13; // eax@25 | |
630 int v14; // edx@27 | |
631 int v15; // edx@29 | |
632 int v16; // ST18_4@29 | |
633 signed int v17; // edx@29 | |
634 signed __int64 v18; // qtt@29 | |
635 int v19; // eax@35 | |
636 signed int v20; // ecx@37 | |
637 signed int v22; // ebx@42 | |
638 unsigned int v23; // esi@43 | |
639 int v24; // edx@44 | |
640 int v25; // eax@44 | |
641 int v26; // [sp+Ch] [bp-38h]@7 | |
642 int v27; // [sp+10h] [bp-34h]@21 | |
643 int v28; // [sp+18h] [bp-2Ch]@21 | |
644 int v29; // [sp+1Ch] [bp-28h]@2 | |
645 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
646 signed int v31; // [sp+24h] [bp-20h]@1 | |
647 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
648 int v33; // [sp+2Ch] [bp-18h]@7 | |
649 bool v34; // [sp+30h] [bp-14h]@21 | |
650 bool v35; // [sp+34h] [bp-10h]@23 | |
651 signed int v36; // [sp+38h] [bp-Ch]@17 | |
652 signed int v37; // [sp+38h] [bp-Ch]@21 | |
653 signed int v38; // [sp+38h] [bp-Ch]@42 | |
654 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
655 signed int v40; // [sp+40h] [bp-4h]@1 | |
656 | |
657 dword_720ED0[0] = -1; | |
658 dword_720E80[0] = -1; | |
659 v4 = a1; | |
660 v5 = 0; | |
661 v40 = a2; | |
662 v31 = v4; | |
663 v39 = 1; | |
664 dword_720F20[0] = 10000; | |
665 v32 = 0; | |
666 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
667 { | |
668 v29 = 0; | |
669 do | |
670 { | |
671 v6 = &pOutdoor->pBModels[v29]; | |
672 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
673 { | |
674 if ( v4 >= v6->sMinX ) | |
675 { | |
676 if ( v40 <= v6->sMaxY ) | |
677 { | |
678 if ( v40 >= v6->sMinY ) | |
679 { | |
680 v33 = v5; | |
681 v26 = v6->uNumFaces; | |
682 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
683 { | |
684 v30 = v5; | |
685 while ( 1 ) | |
686 { | |
687 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
688 v8 = v7->uPolygonType; | |
689 if ( (v8 == 5 || v8 == 6) | |
690 && !(BYTE3(v7->uAttributes) & 0x20) | |
691 && v4 <= v7->pBoundingBox.x2 | |
692 && v4 >= v7->pBoundingBox.x1 | |
693 && v40 <= v7->pBoundingBox.y2 | |
694 && v40 >= v7->pBoundingBox.y1 ) | |
695 { | |
696 v36 = v5; | |
697 if ( v7->uNumVertices ) | |
698 { | |
699 v9 = v7->pXInterceptDisplacements; | |
700 do | |
701 { | |
702 v10 = 2 * v36; | |
703 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
704 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
705 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
706 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
707 ++v9; | |
708 } | |
709 while ( v36 < v7->uNumVertices ); | |
710 v4 = v31; | |
711 } | |
712 v27 = 2 * v7->uNumVertices; | |
713 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
714 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
715 v11 = 0; | |
716 v34 = word_720CE0_ys[0] >= v40; | |
717 v37 = 0; | |
718 v28 = 0; | |
719 if ( v27 > 0 ) | |
720 { | |
721 do | |
722 { | |
723 if ( v37 >= 2 ) | |
724 break; | |
725 v12 = v11; | |
726 v4 = v31; | |
727 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
728 if ( v34 != v35 ) | |
729 { | |
730 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
731 v14 = v13 | word_720DB0_xs[v12] < v31; | |
732 if ( v14 != 3 ) | |
733 { | |
734 if ( !v14 | |
735 || (v15 = word_720CE0_ys[v12], | |
736 v16 = word_720CE0_ys[v12 + 1] - v15, | |
737 v17 = v40 - v15, | |
738 LODWORD(v18) = v17 << 16, | |
739 HIDWORD(v18) = v17 >> 16, | |
740 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
741 - (signed int)word_720DB0_xs[v12]) | |
742 * v18 | |
743 / v16) >> 16) | |
744 + word_720DB0_xs[v12]) >= v31) ) | |
745 ++v37; | |
746 } | |
747 } | |
748 v11 = v28 + 1; | |
749 v34 = v35; | |
750 ++v28; | |
751 } | |
752 while ( v28 < v27 ); | |
753 if ( v37 == 1 ) | |
754 { | |
755 if ( v39 >= 20 ) | |
756 break; | |
757 if ( v7->uPolygonType == 5 ) | |
758 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
759 else | |
760 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
761 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
762 + HIWORD(v7->zCalc3); | |
763 v20 = v39++; | |
764 dword_720F20[v20] = v19; | |
765 dword_720ED0[v20] = v32; | |
766 dword_720E80[v20] = v33; | |
767 } | |
768 } | |
769 } | |
770 ++v33; | |
771 v30 += 308; | |
772 if ( v33 >= v26 ) | |
773 break; | |
774 v5 = 0; | |
775 } | |
776 } | |
777 } | |
778 } | |
779 } | |
780 } | |
781 ++v32; | |
782 ++v29; | |
783 v5 = 0; | |
784 } | |
785 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
786 if ( !v39 ) | |
787 { | |
788 *(int *)a4 = 0; | |
789 return dword_720F20[0]; | |
790 } | |
791 } | |
792 v22 = 0; | |
793 v38 = v5; | |
794 if ( v39 <= (signed int)v5 ) | |
795 goto LABEL_54; | |
796 v23 = 0; | |
797 do | |
798 { | |
799 v24 = dword_720F20[v5 / 4]; | |
800 v25 = *(int *)((char *)dword_720F20 + v23); | |
801 if ( v24 == v25 ) | |
802 goto LABEL_50; | |
803 if ( v25 > a3 + 15 ) | |
804 { | |
805 if ( v24 >= v25 ) | |
806 goto LABEL_51; | |
807 LABEL_50: | |
808 v22 = v38; | |
809 v23 = v5; | |
810 goto LABEL_51; | |
811 } | |
812 if ( v24 > v25 && v24 <= a3 + 15 ) | |
813 goto LABEL_50; | |
814 LABEL_51: | |
815 ++v38; | |
816 v5 += 4; | |
817 } | |
818 while ( v38 < v39 ); | |
819 if ( v22 ) | |
820 { | |
821 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
822 return dword_720F20[v22]; | |
823 } | |
824 LABEL_54: | |
825 *(int *)a4 = 0; | |
826 return dword_720F20[v22]; | |
827 } | |
828 | |
138 | 829 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
830 // for a right-handed system, that would be an inverse normal | |
0 | 831 //----- (0046DCC8) -------------------------------------------------------- |
138 | 832 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
833 { | |
834 auto grid_x = WorldPosToGridCellX(pos_x); | |
835 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
836 | |
837 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
838 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
839 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
840 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
841 | |
842 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
843 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
844 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
845 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
846 | |
847 float side1_dx, side1_dy, side1_dz, | |
848 side2_dx, side2_dy, side2_dz; | |
849 | |
850 auto dx = abs(pos_x - grid_pos_x1), | |
851 dz = abs(grid_pos_z1 - pos_z); | |
852 if (dz >= dx) | |
853 { | |
854 side1_dy = (double)(x1z1_y - x1z2_y); | |
855 side2_dy = (double)(x2z2_y - x1z2_y); | |
856 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
857 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
858 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
859 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 860 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 861 /* |\ |
862 side1 | \ | |
863 |____\ | |
864 side 2 */ | |
865 } | |
866 else | |
867 { | |
868 side1_dy = (double)(x2z2_y - x2z1_y); | |
869 side2_dy = (double)(x1z1_y - x2z1_y); | |
870 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
871 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
872 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
873 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
874 | |
875 /* side 2 | |
876 _____ | |
877 \ | | |
878 \ | side 1 | |
879 \| */ | |
880 } | |
881 | |
882 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
883 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
884 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
885 | |
886 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
887 if (fabsf(mag) < 1e-6f) | |
888 { | |
889 out->y = 0; | |
890 out->x = 0; | |
891 out->z = 65536; | |
892 } | |
893 else | |
894 { | |
895 float invmag = 1.0 / mag; | |
896 out->x = invmag * nx * 65536.0; | |
897 out->y = invmag * ny * 65536.0; | |
898 out->z = invmag * nz * 65536.0; | |
899 } | |
900 } | |
901 | |
0 | 902 //----- (0046DEF2) -------------------------------------------------------- |
903 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
904 { | |
905 unsigned int result; // eax@1 | |
906 | |
907 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
908 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 909 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
910 return result; | |
911 } | |
912 | |
913 //----- (0046DF1A) -------------------------------------------------------- | |
914 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
915 { | |
916 Actor *v2; // edi@1 | |
917 unsigned __int16 v3; // ax@1 | |
918 int v4; // esi@6 | |
919 int v5; // ecx@8 | |
920 int v6; // eax@10 | |
921 int v7; // edx@12 | |
922 int v8; // ecx@14 | |
923 int v9; // eax@14 | |
924 int v10; // ebx@14 | |
925 int v11; // esi@14 | |
926 int v12; // ebx@15 | |
927 int v13; // ebx@17 | |
928 unsigned int v14; // eax@20 | |
929 signed int result; // eax@21 | |
930 int v16; // [sp+Ch] [bp-10h]@1 | |
931 int v17; // [sp+10h] [bp-Ch]@14 | |
932 int v18; // [sp+14h] [bp-8h]@14 | |
933 int v19; // [sp+18h] [bp-4h]@14 | |
934 | |
935 v16 = a1; | |
936 v2 = &pActors[a1]; | |
937 v3 = v2->uAIState; | |
938 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
939 goto LABEL_25; | |
940 v4 = v2->uActorRadius; | |
941 if ( a2 ) | |
942 v4 = a2; | |
943 v5 = v2->vPosition.x; | |
944 if ( stru_721530.sMaxX > v5 + v4 | |
945 || stru_721530.sMinX < v5 - v4 | |
946 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
947 || stru_721530.sMinY < v6 - v4 | |
948 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
949 || stru_721530.sMinZ < v7 | |
950 || (v8 = v5 - stru_721530.normal.x, | |
951 v9 = v6 - stru_721530.normal.y, | |
952 v10 = stru_721530.prolly_normal_d + v4, | |
953 v17 = stru_721530.prolly_normal_d + v4, | |
954 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
955 v18 = v8, | |
956 v19 = v9, | |
957 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
958 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
959 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
960 { | |
961 LABEL_25: | |
962 result = 0; | |
963 } | |
964 else | |
965 { | |
295 | 966 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 967 if ( v13 < 0 ) |
968 v13 = 0; | |
969 if ( v13 < stru_721530.field_7C ) | |
970 { | |
971 stru_721530.field_7C = v13; | |
972 v14 = 8 * v16; | |
973 LOBYTE(v14) = 8 * v16 | 3; | |
974 stru_721530.uFaceID = v14; | |
975 } | |
976 result = 1; | |
977 } | |
978 return result; | |
979 } | |
980 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
981 | |
982 //----- (0046E0B2) -------------------------------------------------------- | |
983 void __cdecl _46E0B2_collide_against_decorations() | |
984 { | |
985 BLVSector *v0; // ebp@1 | |
986 LevelDecoration *v1; // edi@2 | |
987 DecorationDesc *v2; // esi@3 | |
988 int v3; // edx@4 | |
989 int v4; // eax@4 | |
990 int v5; // ecx@6 | |
991 int v6; // ebx@8 | |
992 int v7; // esi@8 | |
993 int v8; // ebx@10 | |
994 int v9; // esi@11 | |
995 int v10; // edi@12 | |
996 int v11; // eax@12 | |
997 int v12; // esi@14 | |
998 unsigned int v13; // eax@17 | |
999 signed int i; // [sp+4h] [bp-14h]@1 | |
1000 int v15; // [sp+8h] [bp-10h]@10 | |
1001 int v16; // [sp+Ch] [bp-Ch]@10 | |
1002 int v17; // [sp+10h] [bp-8h]@10 | |
1003 int v18; // [sp+14h] [bp-4h]@8 | |
1004 | |
1005 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1006 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1007 { | |
1008 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1009 if ( !(v1->field_2 & 0x20) ) | |
1010 { | |
1011 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1012 if (!v2->CanMoveThrough()) |
0 | 1013 { |
1014 v3 = v2->uRadius; | |
1015 v4 = v1->vPosition.x; | |
1016 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1017 { | |
1018 if ( stru_721530.sMinX >= v4 - v3 ) | |
1019 { | |
1020 v5 = v1->vPosition.y; | |
1021 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1022 { | |
1023 if ( stru_721530.sMinY >= v5 - v3 ) | |
1024 { | |
1025 v6 = v2->uDecorationHeight; | |
1026 v7 = v1->vPosition.z; | |
1027 v18 = v6; | |
1028 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1029 { | |
1030 if ( stru_721530.sMinZ >= v7 ) | |
1031 { | |
1032 v16 = v4 - stru_721530.normal.x; | |
1033 v15 = v5 - stru_721530.normal.y; | |
1034 v8 = stru_721530.prolly_normal_d + v3; | |
1035 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1036 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1037 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1038 { | |
1039 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1040 if ( v9 > 0 ) | |
1041 { | |
1042 v10 = v1->vPosition.z; | |
1043 v11 = stru_721530.normal.z | |
1044 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1045 if ( v11 >= v10 ) | |
1046 { | |
1047 if ( v11 <= v18 + v10 ) | |
1048 { | |
295 | 1049 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1050 if ( v12 < 0 ) |
1051 v12 = 0; | |
1052 if ( v12 < stru_721530.field_7C ) | |
1053 { | |
1054 stru_721530.field_7C = v12; | |
1055 v13 = 8 * v0->pDecorationIDs[i]; | |
1056 LOBYTE(v13) = v13 | 5; | |
1057 stru_721530.uFaceID = v13; | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 | |
1074 //----- (0046E26D) -------------------------------------------------------- | |
1075 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1076 { | |
1077 int v2; // edx@5 | |
1078 unsigned __int16 *v3; // eax@5 | |
1079 unsigned __int16 v4; // ax@6 | |
1080 LevelDecoration *v5; // edi@7 | |
1081 DecorationDesc *v6; // esi@8 | |
1082 int v7; // edx@9 | |
1083 int v8; // eax@9 | |
1084 int v9; // ecx@11 | |
1085 int v10; // ebx@13 | |
1086 int v11; // esi@13 | |
1087 int v12; // ebp@15 | |
1088 int v13; // ebx@15 | |
1089 int v14; // esi@16 | |
1090 int v15; // edi@17 | |
1091 int v16; // eax@17 | |
1092 int v17; // esi@19 | |
1093 char v18; // zf@23 | |
1094 int v19; // [sp+0h] [bp-10h]@15 | |
1095 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1096 int v21; // [sp+8h] [bp-8h]@15 | |
1097 int v22; // [sp+Ch] [bp-4h]@13 | |
1098 | |
1099 if ( a1 >= 0 ) | |
1100 { | |
1101 if ( a1 <= 127 ) | |
1102 { | |
1103 if ( a2 >= 0 ) | |
1104 { | |
1105 if ( a2 <= 127 ) | |
1106 { | |
1107 v2 = a1 + (a2 << 7); | |
1108 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1109 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1110 if ( v3 ) | |
1111 { | |
1112 do | |
1113 { | |
1114 v4 = *v3; | |
141 | 1115 if ( (v4 & 7) == OBJECT_Decoration) |
0 | 1116 { |
1117 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1118 if ( !(v5->field_2 & 0x20) ) | |
1119 { | |
1120 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1121 if (!v6->CanMoveThrough()) |
0 | 1122 { |
1123 v7 = v6->uRadius; | |
1124 v8 = v5->vPosition.x; | |
1125 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1126 { | |
1127 if ( stru_721530.sMinX >= v8 - v7 ) | |
1128 { | |
1129 v9 = v5->vPosition.y; | |
1130 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1131 { | |
1132 if ( stru_721530.sMinY >= v9 - v7 ) | |
1133 { | |
1134 v10 = v6->uDecorationHeight; | |
1135 v11 = v5->vPosition.z; | |
1136 v22 = v10; | |
1137 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1138 { | |
1139 if ( stru_721530.sMinZ >= v11 ) | |
1140 { | |
1141 v12 = v8 - stru_721530.normal.x; | |
1142 v19 = v9 - stru_721530.normal.y; | |
1143 v13 = stru_721530.prolly_normal_d + v7; | |
1144 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1145 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1146 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1147 { | |
1148 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1149 if ( v14 > 0 ) | |
1150 { | |
1151 v15 = v5->vPosition.z; | |
1152 v16 = stru_721530.normal.z | |
1153 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1154 if ( v16 >= v15 ) | |
1155 { | |
1156 if ( v16 <= v22 + v15 ) | |
1157 { | |
295 | 1158 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1159 if ( v17 < 0 ) |
1160 v17 = 0; | |
1161 if ( v17 < stru_721530.field_7C ) | |
1162 { | |
1163 stru_721530.field_7C = v17; | |
1164 stru_721530.uFaceID = (signed __int16)*v20; | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 v3 = v20 + 1; | |
1180 v18 = *v20 == 0; | |
1181 ++v20; | |
1182 } | |
1183 while ( !v18 ); | |
1184 } | |
1185 } | |
1186 } | |
1187 } | |
1188 } | |
1189 } | |
1190 | |
1191 //----- (00486F92) -------------------------------------------------------- | |
1192 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1193 { | |
1194 Span *v0; // ebx@1 | |
1195 int v1; // eax@2 | |
1196 Edge *v2; // ecx@3 | |
1197 Edge *v3; // edx@3 | |
1198 Edge *v4; // esi@6 | |
1199 Edge *v5; // eax@7 | |
1200 Edge *v6; // ecx@8 | |
1201 Surf *v7; // esi@11 | |
1202 double v8; // st7@13 | |
1203 Surf *v9; // edi@13 | |
1204 double v10; // st6@13 | |
1205 double v11; // st7@14 | |
1206 signed __int64 v12; // qax@14 | |
1207 stru148 *v13; // eax@15 | |
1208 Span *v14; // ecx@17 | |
1209 double v15; // st7@28 | |
1210 signed __int64 v16; // qax@28 | |
1211 stru148 *v17; // eax@29 | |
1212 Span *v18; // ecx@31 | |
1213 Edge *i; // eax@40 | |
1214 Edge *v20; // ecx@43 | |
1215 Edge *v21; // esi@44 | |
1216 double v22; // st7@45 | |
1217 Edge *v23; // edx@48 | |
1218 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1219 float v25; // [sp+14h] [bp-Ch]@3 | |
1220 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1221 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1222 | |
1223 v0 = pSpans; | |
1224 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1225 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1226 stru_80C9A4.pSurf = &stru_80C980; |
1227 stru_80C980.pPrev = &stru_80C980; | |
1228 stru_80C980.pNext = &stru_80C980; | |
693 | 1229 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1230 stru_80C980.field_8 = 0.0; |
1231 stru_80C980.field_4 = 0.0; | |
1232 stru_80C9D8.pNext = &stru_80C9A4; | |
1233 stru_80C9D8.pPrev = 0; | |
1234 stru_80C9D8.field_8 = 1; | |
1235 stru_80C9A4.pNext = 0; | |
1236 stru_80C9A4.pPrev = &stru_80C9D8; | |
1237 stru_80C9A4.field_8 = 0; | |
1238 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1239 v27 = pViewport->uViewportTL_Y; |
1240 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1241 { |
1242 LABEL_51: | |
1243 v0->field_8 = -1; | |
1244 } | |
1245 else | |
1246 { | |
693 | 1247 v1 = 52 * pViewport->uViewportTL_Y; |
1248 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1249 while ( 1 ) |
1250 { | |
1251 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1252 v3 = &stru_80C9D8; | |
1253 v25 = (double)(signed int)v27; | |
1254 if ( v2 != &defaultEdge ) | |
1255 { | |
1256 do | |
1257 { | |
1258 while ( 1 ) | |
1259 { | |
1260 v4 = v3->pNext; | |
1261 if ( v2->field_0 <= (double)v4->field_0 ) | |
1262 break; | |
1263 v3 = v3->pNext; | |
1264 } | |
1265 v5 = v2->pNext; | |
1266 v2->pNext = v4; | |
1267 v2->pPrev = v3; | |
1268 v3->pNext->pPrev = v2; | |
1269 v3->pNext = v2; | |
1270 v3 = v2; | |
1271 v2 = v5; | |
1272 } | |
1273 while ( v5 != &defaultEdge ); | |
1274 } | |
1275 v6 = stru_80C9D8.pNext; | |
1276 stru_80C980.field_20 = 0; | |
1277 stru_80C980.field_22 = 1; | |
1278 v26 = stru_80C9D8.pNext; | |
1279 if ( stru_80C9D8.pNext ) | |
1280 { | |
1281 while ( 1 ) | |
1282 { | |
1283 v7 = v6->pSurf; | |
1284 if ( v6->field_8 ) | |
1285 { | |
1286 ++v7->field_22; | |
1287 if ( v7->field_22 == 1 ) | |
1288 { | |
1289 v8 = v6->field_0 + 2.0; | |
1290 v9 = stru_80C980.pNext; | |
1291 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1292 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1293 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1294 + stru_80C980.pNext->field_0 ) | |
1295 { | |
1296 do | |
1297 v9 = v9->pNext; | |
1298 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1299 v7->pNext = v9; | |
1300 v7->pPrev = v9->pPrev; | |
1301 v9->pPrev->pNext = v7; | |
1302 v9->pPrev = v7; | |
1303 } | |
1304 else | |
1305 { | |
1306 v11 = v6->field_0 + 0.5; | |
1307 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1308 v0->field_C = v12; | |
1309 if ( (signed __int16)v12 > 0 ) | |
1310 { | |
1311 v0->field_A = v27; | |
1312 v0->field_8 = v9->field_20; | |
1313 v13 = v9->pParent; | |
1314 v0->pParent = v13; | |
1315 if ( v13 ) | |
1316 { | |
1317 if ( v13->prolly_head ) | |
1318 { | |
1319 v14 = v13->prolly_tail; | |
1320 if ( !v14 ) | |
1321 return; | |
1322 v14->pNext = v0; | |
1323 } | |
1324 else | |
1325 { | |
1326 v13->prolly_head = v0; | |
1327 } | |
1328 v13->prolly_tail = v0; | |
1329 } | |
1330 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1331 return; | |
1332 ++v0; | |
1333 ++pOutdoorCamera->uNumSpans; | |
1334 } | |
1335 v6 = v26; | |
1336 v7->field_20 = (signed __int64)v11; | |
1337 v7->pNext = v9; | |
1338 v9->pPrev = v7; | |
1339 stru_80C980.pNext = v7; | |
1340 v7->pPrev = &stru_80C980; | |
1341 } | |
1342 } | |
1343 } | |
1344 else | |
1345 { | |
1346 --v7->field_22; | |
1347 if ( !v7->field_22 ) | |
1348 { | |
1349 if ( stru_80C980.pNext == v7 ) | |
1350 { | |
1351 v15 = v6->field_0 + 0.5; | |
1352 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1353 v0->field_C = v16; | |
1354 if ( (signed __int16)v16 > 0 ) | |
1355 { | |
1356 v0->field_A = v27; | |
1357 v0->field_8 = v7->field_20; | |
1358 v17 = v7->pParent; | |
1359 v0->pParent = v17; | |
1360 if ( v17 ) | |
1361 { | |
1362 if ( v17->prolly_head ) | |
1363 { | |
1364 v18 = v17->prolly_tail; | |
1365 if ( !v18 ) | |
1366 return; | |
1367 v18->pNext = v0; | |
1368 } | |
1369 else | |
1370 { | |
1371 v17->prolly_head = v0; | |
1372 } | |
1373 v17->prolly_tail = v0; | |
1374 } | |
1375 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1376 return; | |
1377 ++v0; | |
1378 ++pOutdoorCamera->uNumSpans; | |
1379 } | |
1380 v7->pNext->field_20 = (signed __int64)v15; | |
1381 v6 = v26; | |
1382 } | |
1383 v7->pNext->pPrev = v7->pPrev; | |
1384 v7->pPrev->pNext = v7->pNext; | |
1385 } | |
1386 } | |
1387 v26 = v6->pNext; | |
1388 if ( !v26 ) | |
1389 break; | |
1390 v6 = v6->pNext; | |
1391 } | |
1392 } | |
1393 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1394 { | |
1395 i->pPrev->pNext = i->pNext; | |
1396 i->pNext->pPrev = i->pPrev; | |
1397 } | |
1398 v20 = stru_80C9D8.pNext; | |
1399 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1400 break; | |
1401 LABEL_50: | |
1402 ++v27; | |
1403 v1 = v24 + 52; | |
1404 v24 += 52; | |
693 | 1405 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1406 goto LABEL_51; |
1407 } | |
1408 while ( 1 ) | |
1409 { | |
1410 v21 = v20->pNext; | |
1411 if ( !v21 ) | |
1412 break; | |
1413 v22 = v20->field_4 + v20->field_0; | |
1414 v20->field_0 = v22; | |
1415 if ( v22 < stru_80C9D8.field_0 ) | |
1416 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1417 while ( 1 ) | |
1418 { | |
1419 v23 = v20->pPrev; | |
1420 if ( v20->field_0 >= (double)v23->field_0 ) | |
1421 break; | |
1422 v23->pNext = v20->pNext; | |
1423 v20->pNext->pPrev = v23; | |
1424 v23->pPrev->pNext = v20; | |
1425 v20->pPrev = v23->pPrev; | |
1426 v20->pNext = v23; | |
1427 v23->pPrev = v20; | |
1428 } | |
1429 v20 = v21; | |
1430 if ( v21 == &stru_80C9A4 ) | |
1431 goto LABEL_50; | |
1432 } | |
1433 } | |
1434 } | |
1435 // 4EC3EC: using guessed type Edge defaultEdge; | |
1436 | |
1437 //----- (00487355) -------------------------------------------------------- | |
1438 bool OutdoorCamera::_487355() | |
1439 { | |
1440 int v0; // esi@1 | |
1441 stru148 *v1; // edi@2 | |
1442 bool result; // eax@3 | |
1443 | |
1444 v0 = 0; | |
1445 if ( pOutdoorCamera->numStru148s > 0 ) | |
1446 { | |
1447 v1 = array_77EC08; | |
1448 do | |
1449 { | |
1450 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1451 ++v0; | |
1452 ++v1; | |
1453 } | |
1454 while ( v0 < pOutdoorCamera->numStru148s ); | |
1455 } | |
1456 return result; | |
1457 } | |
1458 | |
1459 //----- (00487DA9) -------------------------------------------------------- | |
1460 void __cdecl sub_487DA9() | |
1461 { | |
1462 char *v0; // eax@1 | |
1463 | |
1464 v0 = &array_77EC08[0].field_108; | |
1465 do | |
1466 { | |
1467 *v0 = 0; | |
1468 v0 += 268; | |
1469 } | |
1470 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1471 } | |
1472 | |
1473 //----- (00487DBE) -------------------------------------------------------- | |
1474 void Software_ResetNewEdges() | |
1475 { | |
1476 int v0; // ecx@1 | |
1477 Edge **v1; // eax@1 | |
1478 signed int v2; // eax@3 | |
1479 | |
1480 v0 = 0; | |
1481 v1 = ptr_80CA10; | |
1482 do | |
1483 { | |
1484 ++v0; | |
1485 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1486 *v1 = 0; | |
1487 ++v1; | |
1488 } | |
1489 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1490 v2 = 2000; | |
1491 do | |
1492 { | |
1493 pSurfs->field_22 = 0; | |
1494 --v2; | |
1495 } | |
1496 while ( v2 ); | |
1497 } | |
1498 // 4EC3EC: using guessed type Edge defaultEdge; | |
1499 | |
1500 //----- (0048958E) -------------------------------------------------------- | |
1501 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1502 { | |
1503 stru12_MemoryBlock *v2; // esi@1 | |
1504 void *v3; // eax@1 | |
1505 void *v4; // ecx@1 | |
1506 stru12_MemoryBlock *result; // eax@1 | |
1507 | |
1508 v2 = this; | |
1509 v3 = operator new(8 * a2 + 16); | |
1510 v2->pBlockBase = v3; | |
1511 v4 = (char *)v3 + (-(signed int)v3 & 7); | |
1512 result = v2; | |
1513 v2->pAlignedBlock = v4; | |
1514 } | |
1515 | |
1516 //----- (004895B7) -------------------------------------------------------- | |
1517 stru12::stru12(stru11 *pStru11) | |
1518 { | |
1519 stru12 *v2; // esi@1 | |
1520 | |
1521 v2 = this; | |
1522 this->field_44 = 0x41000000u; | |
1523 this->field_4C = 0x46000000u; | |
1524 //this->vdestructor_ptr = stru12::_4898E6; | |
1525 this->field_48 = 0; | |
1526 this->field_50 = 0; | |
1527 this->field_54 = 0x33D6BF95u; | |
1528 this->field_58 = 0; | |
1529 | |
1530 for (int i = 0; i < 12; ++i) | |
1531 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1532 /* | |
1533 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1534 if ( v3 ) | |
1535 v4 = AllocAlignedMem(v3, 640); | |
1536 else | |
1537 v4 = 0; | |
1538 v2->pMemBlocks[0] = v4; | |
1539 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1540 if ( v5 ) | |
1541 v6 = AllocAlignedMem(v5, 640); | |
1542 else | |
1543 v6 = 0; | |
1544 v2->pMemBlocks[1] = v6; | |
1545 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1546 if ( v7 ) | |
1547 v8 = AllocAlignedMem(v7, 640); | |
1548 else | |
1549 v8 = 0; | |
1550 v2->pMemBlocks[2] = v8; | |
1551 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1552 if ( v9 ) | |
1553 v10 = AllocAlignedMem(v9, 640); | |
1554 else | |
1555 v10 = 0; | |
1556 v2->pMemBlocks[3] = v10; | |
1557 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1558 if ( v11 ) | |
1559 v12 = AllocAlignedMem(v11, 640); | |
1560 else | |
1561 v12 = 0; | |
1562 v2->pMemBlocks[4] = v12; | |
1563 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1564 if ( v13 ) | |
1565 v14 = AllocAlignedMem(v13, 640); | |
1566 else | |
1567 v14 = 0; | |
1568 v2->pMemBlocks[5] = v14; | |
1569 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1570 if ( v15 ) | |
1571 v16 = AllocAlignedMem(v15, 640); | |
1572 else | |
1573 v16 = 0; | |
1574 v2->pMemBlocks[6] = v16; | |
1575 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1576 if ( v17 ) | |
1577 v18 = AllocAlignedMem(v17, 640); | |
1578 else | |
1579 v18 = 0; | |
1580 v2->pMemBlocks[7] = v18; | |
1581 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1582 if ( v19 ) | |
1583 v20 = AllocAlignedMem(v19, 640); | |
1584 else | |
1585 v20 = 0; | |
1586 v2->pMemBlocks[8] = v20; | |
1587 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1588 if ( v21 ) | |
1589 v22 = AllocAlignedMem(v21, 640); | |
1590 else | |
1591 v22 = 0; | |
1592 v2->pMemBlocks[9] = v22; | |
1593 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1594 if ( v23 ) | |
1595 v24 = AllocAlignedMem(v23, 640); | |
1596 else | |
1597 v24 = 0; | |
1598 v2->pMemBlocks[10] = v24; | |
1599 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1600 if ( v25 ) | |
1601 v26 = AllocAlignedMem(v25, 640); | |
1602 else | |
1603 v26 = 0; | |
1604 v2->field_8C = 0; | |
1605 v2->pMemBlocks[11] = v26;*/ | |
1606 } | |
1607 | |
1608 //----- (00489810) -------------------------------------------------------- | |
1609 stru12::~stru12() | |
1610 { | |
1611 for (int i = 0; i < 12; ++i) | |
1612 delete pMemBlocks[i]; | |
1613 /*if ( v2 ) | |
1614 stru12_MemoryBlock::dtor(v2, 1); | |
1615 v3 = v1->pMemBlocks[1]; | |
1616 if ( v3 ) | |
1617 stru12_MemoryBlock::dtor(v3, 1); | |
1618 v4 = v1->pMemBlocks[2]; | |
1619 if ( v4 ) | |
1620 stru12_MemoryBlock::dtor(v4, 1); | |
1621 v5 = v1->pMemBlocks[3]; | |
1622 if ( v5 ) | |
1623 stru12_MemoryBlock::dtor(v5, 1); | |
1624 v6 = v1->pMemBlocks[4]; | |
1625 if ( v6 ) | |
1626 stru12_MemoryBlock::dtor(v6, 1); | |
1627 v7 = v1->pMemBlocks[5]; | |
1628 if ( v7 ) | |
1629 stru12_MemoryBlock::dtor(v7, 1); | |
1630 v8 = v1->pMemBlocks[6]; | |
1631 if ( v8 ) | |
1632 stru12_MemoryBlock::dtor(v8, 1); | |
1633 v9 = v1->pMemBlocks[7]; | |
1634 if ( v9 ) | |
1635 stru12_MemoryBlock::dtor(v9, 1); | |
1636 v10 = v1->pMemBlocks[8]; | |
1637 if ( v10 ) | |
1638 stru12_MemoryBlock::dtor(v10, 1); | |
1639 v11 = v1->pMemBlocks[9]; | |
1640 if ( v11 ) | |
1641 stru12_MemoryBlock::dtor(v11, 1); | |
1642 v12 = v1->pMemBlocks[10]; | |
1643 if ( v12 ) | |
1644 stru12_MemoryBlock::dtor(v12, 1); | |
1645 v13 = v1->pMemBlocks[11]; | |
1646 if ( v13 ) | |
1647 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1648 } | |
1649 | |
1650 //----- (004898BF) -------------------------------------------------------- | |
1651 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1652 { | |
1653 stru12_MemoryBlock *v2; // esi@1 | |
1654 void *v3; // ST00_4@1 | |
1655 | |
1656 v2 = this; | |
1657 v3 = this->pBlockBase; | |
1658 this->pAlignedBlock = 0; | |
1659 free(v3); | |
1660 v2->pBlockBase = 0; | |
1661 /*if ( a2 & 1 ) | |
1662 free(v2);*/ | |
1663 } | |
1664 | |
1665 //----- (004898E6) -------------------------------------------------------- | |
1666 void stru12::_4898E6() | |
1667 { | |
1668 void *v1; // eax@1 | |
1669 void *v2; // edx@1 | |
1670 char *v3; // edi@2 | |
1671 double v4; // st7@2 | |
1672 char *v5; // ebx@2 | |
1673 double v6; // st6@3 | |
1674 double v7; // st5@3 | |
1675 double v8; // st4@3 | |
1676 int v9; // esi@3 | |
1677 double v10; // st3@3 | |
1678 float v11; // ST34_4@5 | |
1679 double v12; // st6@10 | |
1680 double v13; // ST0C_8@10 | |
1681 char *v14; // [sp+14h] [bp-44h]@2 | |
1682 char *v15; // [sp+18h] [bp-40h]@2 | |
1683 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1684 char *v17; // [sp+20h] [bp-38h]@2 | |
1685 char *v18; // [sp+24h] [bp-34h]@2 | |
1686 float v19; // [sp+30h] [bp-28h]@3 | |
1687 float v20; // [sp+38h] [bp-20h]@3 | |
1688 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1689 int v22; // [sp+40h] [bp-18h]@1 | |
1690 char *v23; // [sp+44h] [bp-14h]@2 | |
1691 char *v24; // [sp+48h] [bp-10h]@2 | |
1692 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1693 float v26; // [sp+50h] [bp-8h]@3 | |
1694 float v27; // [sp+54h] [bp-4h]@3 | |
1695 | |
731 | 1696 __debugbreak(); |
0 | 1697 v22 = 0; |
1698 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1699 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1700 if ( this->field_8C > 0 ) | |
1701 { | |
1702 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1703 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1704 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1705 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1706 v25 = (int)v1 - (int)v2; | |
1707 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1708 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1709 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1710 v4 = 1.0; | |
1711 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1712 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1713 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1714 do | |
1715 { | |
1716 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1717 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1718 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1719 v7 = pIndoorCamera->fRotationYCosine; | |
1720 v8 = pIndoorCamera->fRotationYSine; | |
1721 v20 = pIndoorCamera->fRotationXCosine; | |
1722 v19 = pIndoorCamera->fRotationXSine; | |
1723 v9 = (int)((char *)v2 + (int)v21); | |
1724 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1725 if ( pIndoorCamera->sRotationX ) | |
1726 { | |
1727 v11 = v10; | |
1728 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1729 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1730 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1731 } | |
1732 else | |
1733 { | |
1734 *(float *)v9 = v10; | |
1735 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1736 *(float *)((char *)v2 + (int)v5) = v6; | |
1737 } | |
1738 if ( *(float *)v9 >= 8.0 ) | |
1739 { | |
1740 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1741 { | |
1742 *(int *)v2 = 0; | |
1743 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1744 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1745 - v12 * *(float *)((char *)v2 + (int)v3); | |
1746 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1747 - v12 * *(float *)((char *)v2 + (int)v5); | |
1748 *(float *)((char *)v2 + (int)v16) = v4 | |
1749 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1750 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1751 v13 = *(float *)v9 + 6.7553994e15; | |
1752 v4 = 1.0; | |
1753 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1754 } | |
1755 else | |
1756 { | |
1757 *(int *)v2 = 2; | |
1758 } | |
1759 } | |
1760 else | |
1761 { | |
1762 *(int *)v2 = 1; | |
1763 } | |
1764 ++v22; | |
1765 v2 = (char *)v2 + 4; | |
1766 } | |
1767 while ( v22 < this->field_8C ); | |
1768 } | |
1769 this->field_8C = 0; | |
1770 } | |
1771 | |
1772 //----- (0048A959) -------------------------------------------------------- | |
1773 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1774 { | |
1775 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1776 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1777 b = (uColor & 0x000000FF) / 255.0f; | |
1778 | |
1779 float h, s, v; | |
1780 RGB2HSV(&h, &s, r, g, b, &v); | |
1781 | |
1782 if ( h_replace != -1.0 ) | |
1783 h = h_replace; | |
1784 if ( s_replace != -1.0 ) | |
1785 s = s_replace; | |
1786 if ( v_replace != -1.0 ) | |
1787 v = v_replace; | |
1788 HSV2RGB(&r, &g, &b, h, s, v); | |
1789 | |
1790 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1791 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1792 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1793 } | |
1794 | |
1795 //----- (0048B561) -------------------------------------------------------- | |
1796 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1797 { | |
1798 //v2 = a2 - 0.5; | |
1799 //v3 = v2 + 6.7553994e15; | |
1800 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1801 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1802 //v5 = v7 + 6.7553994e15; | |
1803 //return LODWORD(v5) | (v4 << 16); | |
1804 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1805 return v5 | (v4 << 16); | |
1806 } | |
1807 | |
1808 //----- (00491E3A) -------------------------------------------------------- | |
1809 void __cdecl sub_491E3A() | |
1810 { | |
1811 Player *v0; // ebx@1 | |
1812 signed int v1; // esi@3 | |
1813 char *v2; // eax@4 | |
1814 unsigned int v3; // eax@7 | |
1815 unsigned int v4; // edx@8 | |
1816 char *v5; // ecx@9 | |
1817 int v6; // edi@17 | |
1818 Texture *v7; // ebx@18 | |
1819 struct IDirect3DTexture2 **v8; // eax@19 | |
1820 struct IDirect3DTexture2 *v9; // eax@20 | |
1821 struct IDirectDrawSurface **v10; // eax@22 | |
1822 struct IDirectDrawSurface *v11; // eax@23 | |
1823 int v12; // eax@26 | |
1824 | |
1825 v0 = pParty->pPlayers; | |
1826 do | |
1827 { | |
203 | 1828 if (SoundSetAction[24][0]) |
0 | 1829 { |
1830 v1 = 0; | |
764 | 1831 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1832 { |
1833 LABEL_7: | |
1834 v3 = 0; | |
1835 } | |
1836 else | |
1837 { | |
1838 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1839 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1840 { |
1841 ++v1; | |
1842 v2 += 120; | |
764 | 1843 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1844 goto LABEL_7; |
1845 } | |
1846 v3 = v1; | |
1847 } | |
764 | 1848 pSoundList->UnloadSound(v3, 1); |
0 | 1849 v4 = 0; |
764 | 1850 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1851 { |
1852 LABEL_12: | |
1853 v4 = 0; | |
1854 } | |
1855 else | |
1856 { | |
1857 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1858 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1859 { |
1860 ++v4; | |
1861 v5 += 120; | |
764 | 1862 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1863 goto LABEL_12; |
1864 } | |
1865 } | |
764 | 1866 pSoundList->UnloadSound(v4, 1); |
0 | 1867 } |
1868 ++v0; | |
1869 } | |
1870 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1871 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1872 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1873 { |
1874 v7 = &pIcons_LOD->pTextures[v6]; | |
1875 do | |
1876 { | |
1877 v7->Release(); | |
1878 v8 = pIcons_LOD->pHardwareTextures; | |
1879 if ( v8 ) | |
1880 { | |
1881 v9 = v8[v6]; | |
1882 if ( v9 ) | |
1883 { | |
1884 v9->Release(); | |
1885 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1886 } | |
1887 } | |
1888 v10 = pIcons_LOD->pHardwareSurfaces; | |
1889 if ( v10 ) | |
1890 { | |
1891 v11 = v10[v6]; | |
1892 if ( v11 ) | |
1893 { | |
1894 v11->Release(); | |
1895 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1896 } | |
1897 } | |
1898 --v6; | |
1899 --v7; | |
1900 } | |
33 | 1901 while ( v6 >= pIcons_LOD->pFacesLock ); |
1902 } | |
1903 v12 = pIcons_LOD->pFacesLock; | |
1904 pIcons_LOD->pFacesLock = 0; | |
0 | 1905 pIcons_LOD->uNumLoadedFiles = v12; |
1906 } | |
1907 // 4ED498: using guessed type char byte_4ED498; | |
1908 | |
1909 //----- (0049387A) -------------------------------------------------------- | |
1910 int CycleCharacter(unsigned int _this) | |
1911 { | |
1912 signed int result; // eax@1 | |
1913 signed int v2; // ecx@2 | |
1914 signed int v3; // ecx@8 | |
1915 | |
1916 result = uActiveCharacter; | |
1917 if ( _this ) | |
1918 { | |
1919 v2 = 0; | |
1920 while ( 1 ) | |
1921 { | |
1922 --result; | |
1923 if ( result < 1 ) | |
1924 result = 4; | |
1925 if ( !pPlayers[result]->uTimeToRecovery ) | |
1926 break; | |
1927 ++v2; | |
1928 if ( v2 >= 4 ) | |
1929 return uActiveCharacter; | |
1930 } | |
1931 } | |
1932 else | |
1933 { | |
1934 v3 = 0; | |
1935 while ( 1 ) | |
1936 { | |
1937 ++result; | |
1938 if ( result > 4 ) | |
1939 result = 1; | |
1940 if ( !pPlayers[result]->uTimeToRecovery ) | |
1941 break; | |
1942 ++v3; | |
1943 if ( v3 >= 4 ) | |
1944 return uActiveCharacter; | |
1945 } | |
1946 } | |
1947 return result; | |
1948 } | |
1949 | |
1950 //----- (004938D1) -------------------------------------------------------- | |
1951 void __fastcall Rest(unsigned int uHoursToSleep) | |
1952 { | |
1953 unsigned int v1; // esi@1 | |
1954 double v2; // st7@3 | |
1955 Player **v3; // esi@3 | |
1956 | |
1957 v1 = uHoursToSleep; | |
1958 if ( uHoursToSleep > 240 ) | |
1959 InitializeActors(); | |
1960 v2 = (double)(7680 * v1) * 0.033333335; | |
1961 pParty->uTimePlayed += (signed __int64)v2; | |
1962 v3 = &pPlayers[1]; | |
1963 do | |
1964 { | |
1965 (*v3)->Recover((signed __int64)v2); | |
1966 ++v3; | |
1967 } | |
1968 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1969 _494035_timed_effects__water_walking_damage__etc(); | |
1970 } | |
1971 | |
1972 //----- (00493938) -------------------------------------------------------- | |
1973 int __cdecl _493938_regenerate() | |
1974 { | |
1975 int v0; // edi@1 | |
1976 signed __int64 v1; // qax@1 | |
1977 int v2; // ecx@1 | |
1978 int result; // eax@1 | |
1979 int v4; // eax@2 | |
1980 int v5; // edi@5 | |
112 | 1981 int *v6; // ecx@5 |
0 | 1982 char v7; // sf@5 |
112 | 1983 int *v8; // ecx@10 |
0 | 1984 int v9; // edi@15 |
1985 signed int v10; // eax@15 | |
1986 __int16 *v11; // edx@16 | |
1987 int v12; // eax@20 | |
1988 int v13; // ebx@20 | |
1989 unsigned int *v14; // esi@21 | |
1990 unsigned int v15; // ecx@21 | |
1991 unsigned int v16; // eax@21 | |
1992 int v17; // edx@21 | |
1993 int v18; // eax@21 | |
1994 signed int v19; // eax@21 | |
1995 signed int v20; // ebx@25 | |
1996 Player *v21; // esi@25 | |
1997 ITEM_EQUIP_TYPE v22; // edi@30 | |
1998 //int v23; // edx@31 | |
1999 signed int v24; // ecx@32 | |
2000 signed int v25; // eax@33 | |
2001 int v26; // eax@35 | |
2002 int v27; // eax@36 | |
2003 int v28; // eax@37 | |
2004 int v29; // eax@40 | |
2005 int v30; // eax@41 | |
2006 signed int v31; // ecx@53 | |
2007 char *v32; // eax@53 | |
2008 char *v33; // edi@82 | |
2009 int v34; // ecx@88 | |
2010 int v35; // eax@88 | |
2011 char *v36; // edi@99 | |
2012 int v37; // edi@104 | |
2013 int v38; // edi@106 | |
2014 int v39; // edi@111 | |
2015 int v40; // ecx@113 | |
2016 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
|
2017 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2018 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2019 int v44; // [sp+210h] [bp-20h]@22 | |
2020 int v45; // [sp+214h] [bp-1Ch]@25 | |
2021 int v46; // [sp+218h] [bp-18h]@25 | |
2022 int v47; // [sp+21Ch] [bp-14h]@25 | |
2023 int v48; // [sp+220h] [bp-10h]@25 | |
2024 int v49; // [sp+224h] [bp-Ch]@24 | |
2025 int v50; // [sp+228h] [bp-8h]@25 | |
2026 int v51; // [sp+22Ch] [bp-4h]@2 | |
2027 | |
2028 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2029 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2030 v2 = (signed int)v1 / 60; | |
2031 result = (signed int)v1 / 60 + 5; | |
2032 if ( v0 >= result ) | |
2033 { | |
2034 v51 = 0; | |
2035 v4 = (v0 - v2) / 5; | |
2036 if (pParty->FlyActive()) | |
2037 { | |
2038 if ( pParty->bFlying ) | |
2039 { | |
569 | 2040 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2041 { // colliding with something in the air - fall down | |
2042 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2043 //__debugbreak(); | |
2044 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2045 v7 = *v6 < v5; |
2046 *v6 -= v5; | |
0 | 2047 if ( v7 ) |
2048 { | |
112 | 2049 *v6 = 0; |
0 | 2050 pParty->uFlags &= 0xFFFFFFBFu; |
2051 pParty->bFlying = 0; | |
2052 v51 = 1; | |
2053 } | |
2054 } | |
2055 } | |
2056 } | |
569 | 2057 |
0 | 2058 if (pParty->WaterWalkActive()) |
2059 { | |
569 | 2060 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2061 { | |
2062 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2063 { // taking on water | |
2064 //__debugbreak(); | |
2065 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2066 v7 = *v8 < v4; |
2067 *v8 -= v4; | |
0 | 2068 if ( v7 ) |
2069 { | |
112 | 2070 *v8 = 0; |
569 | 2071 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2072 v51 = 1; |
2073 } | |
2074 } | |
2075 } | |
2076 } | |
569 | 2077 |
0 | 2078 if (pParty->ImmolationActive()) |
2079 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2080 //SpriteObject::SpriteObject(&a1); |
0 | 2081 v9 = 0; |
2082 a3.z = 0; | |
2083 a3.y = 0; | |
2084 a3.x = 0; | |
2085 a1.stru_24.Reset(); | |
2086 a1.field_4C = pParty->pPartyBuffs[10].uPower; | |
2087 a1.field_50 = pParty->ImmolationSkillLevel(); | |
2088 v10 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2089 a1.uType = 1070; |
0 | 2090 a1.field_48 = 8; |
2091 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
2092 { | |
2093 LABEL_19: | |
2094 LOWORD(v10) = 0; | |
2095 } | |
2096 else | |
2097 { | |
2098 v11 = &pObjectList->pObjects->uObjectID; | |
488 | 2099 while ( stru_4E3ACC[8].field_0 != *v11 ) |
0 | 2100 { |
2101 ++v10; | |
2102 v11 += 28; | |
2103 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2104 goto LABEL_19; | |
2105 } | |
2106 } | |
2107 a1.uObjectDescID = v10; | |
2108 a1.field_60_distance_related_prolly_lod = 0; | |
2109 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2110 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2111 a1.uAttributes = 0; |
2112 a1.uSectorID = 0; | |
2113 a1.uSpriteFrameID = 0; | |
303 | 2114 a1.field_58_pid = v12; |
0 | 2115 a1.uFacing = 0; |
2116 a1.uSoundID = 0; | |
2117 v13 = sub_46A89E((int)v41, 100, 307); | |
2118 if ( v13 > 0 ) | |
2119 { | |
2120 do | |
2121 { | |
2122 v14 = (unsigned int *)&v41[4 * v9]; | |
2123 v15 = *v14; | |
2124 v16 = *v14; | |
2125 a1.vPosition.x = pActors[v16].vPosition.x; | |
2126 v17 = pActors[v16].vPosition.y; | |
2127 a1.vPosition.z = pActors[v16].vPosition.z; | |
2128 v18 = 8 * v15; | |
2129 LOBYTE(v18) = 8 * v15 | 3; | |
2130 a1.vPosition.y = v17; | |
2131 a1.field_5C = v18; | |
2132 v19 = a1.Create(0, 0, 0, 0); | |
2133 DamageMonsterFromParty(8 * v19 | 2, *v14, &a3); | |
2134 ++v9; | |
2135 } | |
2136 while ( v9 < v13 ); | |
2137 } | |
2138 } | |
2139 v44 = 0; | |
248 | 2140 if (PartyHasDragon()) |
0 | 2141 v44 = 1; |
2142 v49 = 0; | |
2143 LABEL_25: | |
2144 v20 = 0; | |
2145 v21 = &pParty->pPlayers[v49]; | |
2146 v50 = 0; | |
2147 v47 = 0; | |
2148 v45 = 0; | |
2149 v48 = 0; | |
2150 v46 = 0; | |
255 | 2151 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2152 v50 = 1; |
135 | 2153 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2154 v48 = 1; |
2155 v22 = (ITEM_EQUIP_TYPE)0; | |
2156 while ( 1 ) | |
2157 { | |
2158 if ( v21->HasItemEquipped(v22) ) | |
2159 { | |
2160 //v23 = v21->pEquipment.pIndices; | |
2161 auto _idx = v21->pEquipment.pIndices[v22]; | |
2162 v24 = v21->pInventoryItems[_idx].uItemID; | |
2163 if ( v24 > 134 ) | |
2164 { | |
2165 if ( v24 == 529 ) | |
2166 goto LABEL_43; | |
2167 if ( v24 == 535 ) | |
2168 goto LABEL_44; | |
2169 if ( v24 == 515 ) | |
2170 { | |
2171 v47 = 1; | |
2172 } | |
2173 else | |
2174 { | |
2175 if ( v24 == 532 ) | |
2176 goto LABEL_50; | |
2177 } | |
2178 } | |
2179 else | |
2180 { | |
377 | 2181 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2182 if ( v25 <= 50 ) |
2183 { | |
2184 if ( v25 != 50 ) | |
2185 { | |
2186 v26 = v25 - 37; | |
2187 if ( v26 ) | |
2188 { | |
2189 v27 = v26 - 1; | |
2190 if ( !v27 ) | |
2191 goto LABEL_50; | |
2192 v28 = v27 - 6; | |
2193 if ( v28 ) | |
2194 { | |
2195 if ( v28 != 3 ) | |
2196 goto LABEL_51; | |
2197 LABEL_50: | |
2198 v50 = 1; | |
2199 goto LABEL_51; | |
2200 } | |
2201 } | |
2202 } | |
2203 LABEL_44: | |
2204 v20 = 1; | |
2205 goto LABEL_51; | |
2206 } | |
2207 v29 = v25 - 54; | |
2208 if ( !v29 ) | |
2209 goto LABEL_44; | |
2210 v30 = v29 - 1; | |
2211 if ( !v30 ) | |
2212 goto LABEL_50; | |
2213 if ( v30 == 11 ) | |
2214 { | |
2215 LABEL_43: | |
2216 v20 = 1; | |
2217 v50 = 1; | |
2218 goto LABEL_51; | |
2219 } | |
2220 } | |
2221 } | |
2222 LABEL_51: | |
2223 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2224 if ( (signed int)v22 >= 16 ) | |
2225 { | |
2226 if ( v48 ) | |
2227 { | |
2228 v31 = 0; | |
2229 v32 = (char *)v21->pInventoryItems; | |
2230 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2231 { | |
2232 ++v31; | |
2233 v32 += 36; | |
2234 if ( v31 >= 138 ) | |
2235 goto LABEL_59; | |
2236 } | |
2237 v48 = 0; | |
2238 v45 = 1; | |
2239 } | |
2240 LABEL_59: | |
2241 if ( v21->pConditions[17] ) | |
2242 v46 = 1; | |
2243 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2244 { | |
2245 ++v21->sHealth; | |
2246 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2247 v21->sHealth = v21->GetMaxHealth(); | |
2248 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2249 { | |
2250 LODWORD(v21->pConditions[13]) = 0; | |
2251 HIDWORD(v21->pConditions[13]) = 0; | |
2252 } | |
2253 v51 = 1; | |
2254 } | |
2255 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2256 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2257 && !v21->pConditions[14] | |
2258 && !v21->pConditions[16] ) | |
2259 { | |
2260 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2261 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2262 v21->sHealth = v21->GetMaxHealth(); | |
2263 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2264 { | |
2265 LODWORD(v21->pConditions[13]) = 0; | |
2266 HIDWORD(v21->pConditions[13]) = 0; | |
2267 } | |
2268 v51 = 1; | |
2269 } | |
2270 if ( v50 ) | |
2271 { | |
2272 v33 = (char *)&v21->sMana; | |
2273 ++*(int *)v33; | |
2274 if ( v21->sMana > v21->GetMaxMana() ) | |
2275 *(int *)v33 = v21->GetMaxMana(); | |
2276 v51 = 1; | |
2277 } | |
2278 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2279 { | |
2280 v34 = LODWORD(v21->pConditions[13]); | |
2281 --v21->sHealth; | |
2282 v35 = v21->sHealth; | |
2283 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2284 v21->pConditions[13] = pParty->uTimePlayed; | |
2285 if ( v35 < 1 ) | |
2286 { | |
2287 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2288 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2289 { | |
2290 v21->pConditions[13] = pParty->uTimePlayed; | |
2291 } | |
2292 else | |
2293 { | |
2294 if ( !v21->pConditions[14] ) | |
2295 v21->pConditions[14] = pParty->uTimePlayed; | |
2296 } | |
2297 } | |
2298 v51 = 1; | |
2299 } | |
2300 if ( v45 ) | |
2301 { | |
2302 v36 = (char *)&v21->sMana; | |
2303 ++*(int *)v36; | |
2304 if ( v21->sMana > v21->GetMaxMana() ) | |
2305 *(int *)v36 = v21->GetMaxMana(); | |
2306 } | |
2307 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2308 { | |
2309 v37 = v21->sHealth; | |
2310 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2311 v21->sHealth = v37 - 2; | |
2312 v38 = v21->sMana; | |
2313 if ( v38 > v21->GetMaxMana() / 2 ) | |
2314 v21->sMana = v38 - 2; | |
2315 } | |
2316 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2317 { | |
2318 v39 = v21->sHealth; | |
2319 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2320 v21->sHealth = v39 - 1; | |
2321 v40 = v21->sMana; | |
2322 if ( v40 > 0 ) | |
2323 v21->sMana = v40 - 1; | |
2324 } | |
2325 ++v49; | |
2326 if ( v49 >= 4 ) | |
2327 { | |
2328 result = HIDWORD(pParty->uTimePlayed); | |
2329 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2330 if ( !viewparams->bRedrawGameUI ) | |
2331 { | |
2332 result = v51; | |
2333 viewparams->bRedrawGameUI = v51; | |
2334 } | |
2335 return result; | |
2336 } | |
2337 goto LABEL_25; | |
2338 } | |
2339 } | |
2340 } | |
2341 return result; | |
2342 } | |
2343 | |
2344 //----- (00493F79) -------------------------------------------------------- | |
351 | 2345 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2346 { |
2347 signed __int64 v2; // ST2C_8@1 | |
2348 signed __int64 v3; // qax@1 | |
351 | 2349 //signed __int64 v4; // ST1C_8@1 |
0 | 2350 unsigned __int64 v5; // qax@1 |
2351 unsigned int v6; // ebx@1 | |
2352 | |
2353 v2 = (signed __int64)((double)a2 * 0.234375); | |
2354 v3 = v2 / 60 / 60; | |
351 | 2355 //v4 = v3; |
0 | 2356 v5 = (unsigned int)v3 / 0x18; |
2357 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2358 _this->field_0_expire_second = v2 % 60; |
2359 _this->field_4_expire_minute = v2 / 60 % 60; | |
2360 _this->field_8_expire_hour = v3 % 24; | |
2361 _this->field_10_expire_week = v5 / 7 & 3; | |
2362 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2363 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2364 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2365 } |
2366 | |
2367 //----- (00494035) -------------------------------------------------------- | |
2368 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2369 { | |
2370 signed __int64 v0; // qax@1 | |
2371 signed __int64 v1; // ST30_8@1 | |
2372 signed __int64 v2; // ST38_8@1 | |
2373 unsigned __int64 v3; // qax@1 | |
2374 unsigned int v4; // edi@1 | |
2375 //signed int v5; // eax@4 | |
2376 //char *v6; // ecx@5 | |
2377 //Player *v7; // esi@8 | |
2378 //char *v8; // ecx@12 | |
766 | 2379 //Player *pPlayer; // esi@15 |
0 | 2380 //void *v10; // esi@25 |
2381 unsigned int v11; // ecx@27 | |
2382 signed int v12; // edi@29 | |
2383 Player *v13; // ecx@30 | |
2384 Player *v14; // esi@35 | |
2385 double v15; // st7@35 | |
2386 Player **v16; // esi@43 | |
2387 Player *v17; // edi@44 | |
2388 double v18; // st7@44 | |
2389 float v19; // ST28_4@48 | |
2390 double v20; // ST38_8@48 | |
2391 Player *v21; // esi@51 | |
2392 signed int v22; // edi@53 | |
2393 int v23; // eax@59 | |
2394 int v24; // ecx@60 | |
2395 int v25; // eax@63 | |
2396 int v26; // ecx@64 | |
2397 int v27; // eax@67 | |
2398 int v28; // ecx@68 | |
2399 int v29; // eax@71 | |
2400 int v30; // ecx@72 | |
2401 int v31; // eax@75 | |
2402 int v32; // ecx@76 | |
2403 int v33; // eax@79 | |
2404 int v34; // ecx@80 | |
2405 int v35; // eax@83 | |
2406 int v36; // ecx@84 | |
2407 int v37; // eax@87 | |
2408 int v38; // ecx@88 | |
2409 int v39; // eax@91 | |
2410 int v40; // ecx@92 | |
2411 int v41; // eax@95 | |
2412 int v42; // ecx@96 | |
2413 bool v43; // ebx@102 | |
2414 //SpellBuff *v44; // edi@104 | |
2415 //signed int v45; // ebp@104 | |
2416 bool v46; // edi@111 | |
2417 //SpellBuff *v47; // esi@113 | |
2418 //Player **v48; // esi@119 | |
2419 //signed int v49; // edi@121 | |
2420 //char *v50; // esi@122 | |
2421 signed int v51; // edx@128 | |
2422 signed int v52; // ecx@130 | |
2423 int v53; // eax@131 | |
2424 Player *v54; // eax@141 | |
766 | 2425 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2426 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2427 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2428 int v58; // [sp-4h] [bp-34h]@33 |
2429 int v59; // [sp-4h] [bp-34h]@55 | |
2430 unsigned int v60; // [sp+10h] [bp-20h]@1 | |
2431 unsigned int v61; // [sp+14h] [bp-1Ch]@1 | |
2432 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2433 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2434 signed int a2a; // [sp+18h] [bp-18h]@47 |
2435 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2436 | |
766 | 2437 //a2 = pParty->uCurrentHour; |
0 | 2438 v61 = pParty->uDaysPlayed; |
2439 v60 = pEventTimer->uTimeElapsed; | |
766 | 2440 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2441 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2442 v1 = v0; |
2443 v0 /= 60i64; | |
2444 v2 = v0; | |
2445 v3 = (unsigned int)v0 / 24; | |
2446 v4 = (unsigned int)(v3 / 7) >> 2; | |
2447 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2448 pParty->uCurrentMinute = v1 % 60; | |
2449 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2450 pParty->uCurrentHour = v2 % 24; | |
2451 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2452 pParty->uCurrentMonth = v4 % 12; | |
352 | 2453 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2454 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2455 { |
2456 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2457 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2458 | |
2459 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2460 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2461 | |
766 | 2462 ++pParty->days_played_without_rest; |
2463 if (pParty->days_played_without_rest > 1) | |
0 | 2464 { |
2465 for (uint i = 0; i < 4; ++i) | |
766 | 2466 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2467 | |
2468 if (pParty->uNumFoodRations) | |
2469 Party::TakeFood(1); | |
0 | 2470 else |
2471 for (uint i = 0; i < 4; ++i) | |
766 | 2472 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2473 | |
2474 if (pParty->days_played_without_rest > 3) | |
2475 for (uint i = 0; i < 4; ++i) | |
0 | 2476 { |
766 | 2477 auto player = pParty->pPlayers + i; |
2478 | |
2479 player->Zero(); | |
2480 | |
2481 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2482 { |
767 | 2483 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2484 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2485 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2486 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2487 } |
2488 } | |
766 | 2489 } |
2490 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2491 pOutdoor->SetFog(); |
2492 | |
2493 for (uint i = 0; i < 4; ++i) | |
2494 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2495 } | |
766 | 2496 |
0 | 2497 v11 = LODWORD(pParty->uTimePlayed); |
2498 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2499 { | |
2500 v12 = 1; | |
2501 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2502 viewparams->bRedrawGameUI = 1; | |
2503 while ( 1 ) | |
2504 { | |
2505 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2506 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2507 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2508 { |
2509 v58 = 0; | |
2510 } | |
2511 else | |
2512 { | |
2513 v58 = 0; | |
2514 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2515 { | |
2516 v14 = pPlayers[v12]; | |
2517 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2518 v14->ReceiveDamage((signed __int64)v15, 0); | |
2519 if ( pParty->uFlags & 4 ) | |
2520 { | |
783 | 2521 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2522 GameUI_Footer_TimeLeft = 128; | |
0 | 2523 } |
2524 goto LABEL_39; | |
2525 } | |
2526 v13 = pPlayers[v12]; | |
2527 } | |
130 | 2528 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2529 LABEL_39: |
2530 ++v12; | |
2531 if ( v12 > 4 ) | |
2532 { | |
2533 v11 = LODWORD(pParty->uTimePlayed); | |
2534 break; | |
2535 } | |
2536 } | |
2537 } | |
2538 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2539 { | |
2540 viewparams->bRedrawGameUI = 1; | |
2541 pParty->field_6FC = v11 + 128; | |
2542 v16 = &pPlayers[1]; | |
2543 do | |
2544 { | |
2545 v17 = *v16; | |
2546 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2547 v17->ReceiveDamage((signed __int64)v18, 0); | |
2548 if ( pParty->uFlags & 0x200 ) | |
2549 { | |
783 | 2550 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2551 GameUI_Footer_TimeLeft = 128; | |
0 | 2552 } |
2553 ++v16; | |
2554 } | |
2555 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2556 } | |
2557 _493938_regenerate(); | |
2558 v65 = 4; | |
2559 a2a = v60; | |
2560 if ( pParty->uFlags2 & 2 ) | |
2561 { | |
2562 v19 = (double)(signed int)v60 * 0.5; | |
2563 v20 = v19 + 6.7553994e15; | |
2564 a2a = LODWORD(v20); | |
2565 if ( SLODWORD(v20) <= 0 ) | |
2566 a2a = 1; | |
2567 } | |
2568 v62 = &pPlayers[1]; | |
2569 do | |
2570 { | |
2571 v21 = *v62; | |
2572 if ( (*v62)->uTimeToRecovery ) | |
2573 v21->Recover(a2a); | |
2574 v22 = v21->sHealth; | |
2575 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2576 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2577 { | |
2578 if ( v22 >= 1 ) | |
2579 goto LABEL_59; | |
2580 v59 = 0; | |
2581 v56 = 13; | |
2582 } | |
2583 else | |
2584 { | |
2585 v59 = 0; | |
2586 v56 = 14; | |
2587 } | |
2588 v21->SetCondition(v56, v59); | |
2589 LABEL_59: | |
2590 v23 = (int)&v21->field_E0; | |
2591 if ( v21->field_E0 ) | |
2592 { | |
2593 v24 = *(int *)v23 - v60; | |
2594 if ( v24 > 0 ) | |
2595 { | |
2596 *(int *)v23 = v24; | |
2597 } | |
2598 else | |
2599 { | |
2600 *(int *)v23 = 0; | |
2601 viewparams->bRedrawGameUI = 1; | |
2602 } | |
2603 } | |
2604 v25 = (int)&v21->field_E4; | |
2605 if ( v21->field_E4 ) | |
2606 { | |
2607 v26 = *(int *)v25 - v60; | |
2608 if ( v26 > 0 ) | |
2609 { | |
2610 *(int *)v25 = v26; | |
2611 } | |
2612 else | |
2613 { | |
2614 *(int *)v25 = 0; | |
2615 viewparams->bRedrawGameUI = 1; | |
2616 } | |
2617 } | |
2618 v27 = (int)&v21->field_E8; | |
2619 if ( v21->field_E8 ) | |
2620 { | |
2621 v28 = *(int *)v27 - v60; | |
2622 if ( v28 > 0 ) | |
2623 { | |
2624 *(int *)v27 = v28; | |
2625 } | |
2626 else | |
2627 { | |
2628 *(int *)v27 = 0; | |
2629 viewparams->bRedrawGameUI = 1; | |
2630 } | |
2631 } | |
2632 v29 = (int)&v21->field_EC; | |
2633 if ( v21->field_EC ) | |
2634 { | |
2635 v30 = *(int *)v29 - v60; | |
2636 if ( v30 > 0 ) | |
2637 { | |
2638 *(int *)v29 = v30; | |
2639 } | |
2640 else | |
2641 { | |
2642 *(int *)v29 = 0; | |
2643 viewparams->bRedrawGameUI = 1; | |
2644 } | |
2645 } | |
2646 v31 = (int)&v21->field_F0; | |
2647 if ( v21->field_F0 ) | |
2648 { | |
2649 v32 = *(int *)v31 - v60; | |
2650 if ( v32 > 0 ) | |
2651 { | |
2652 *(int *)v31 = v32; | |
2653 } | |
2654 else | |
2655 { | |
2656 *(int *)v31 = 0; | |
2657 viewparams->bRedrawGameUI = 1; | |
2658 } | |
2659 } | |
2660 v33 = (int)&v21->field_F4; | |
2661 if ( v21->field_F4 ) | |
2662 { | |
2663 v34 = *(int *)v33 - v60; | |
2664 if ( v34 > 0 ) | |
2665 { | |
2666 *(int *)v33 = v34; | |
2667 } | |
2668 else | |
2669 { | |
2670 *(int *)v33 = 0; | |
2671 viewparams->bRedrawGameUI = 1; | |
2672 } | |
2673 } | |
2674 v35 = (int)&v21->field_F8; | |
2675 if ( v21->field_F8 ) | |
2676 { | |
2677 v36 = *(int *)v35 - v60; | |
2678 if ( v36 > 0 ) | |
2679 { | |
2680 *(int *)v35 = v36; | |
2681 } | |
2682 else | |
2683 { | |
2684 *(int *)v35 = 0; | |
2685 viewparams->bRedrawGameUI = 1; | |
2686 } | |
2687 } | |
2688 v37 = (int)&v21->field_FC; | |
2689 if ( v21->field_FC ) | |
2690 { | |
2691 v38 = *(int *)v37 - v60; | |
2692 if ( v38 > 0 ) | |
2693 { | |
2694 *(int *)v37 = v38; | |
2695 } | |
2696 else | |
2697 { | |
2698 *(int *)v37 = 0; | |
2699 viewparams->bRedrawGameUI = 1; | |
2700 } | |
2701 } | |
2702 v39 = (int)&v21->field_100; | |
2703 if ( v21->field_100 ) | |
2704 { | |
2705 v40 = *(int *)v39 - v60; | |
2706 if ( v40 > 0 ) | |
2707 { | |
2708 *(int *)v39 = v40; | |
2709 } | |
2710 else | |
2711 { | |
2712 *(int *)v39 = 0; | |
2713 viewparams->bRedrawGameUI = 1; | |
2714 } | |
2715 } | |
2716 v41 = (int)&v21->field_104; | |
2717 if ( v21->field_104 ) | |
2718 { | |
2719 v42 = *(int *)v41 - v60; | |
2720 if ( v42 > 0 ) | |
2721 { | |
2722 *(int *)v41 = v42; | |
2723 } | |
2724 else | |
2725 { | |
2726 *(int *)v41 = 0; | |
2727 viewparams->bRedrawGameUI = 1; | |
2728 } | |
2729 } | |
2730 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2731 --v65; | |
2732 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2733 | |
2734 for (uint k = 0; k < 24; ++k) | |
2735 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2736 | |
2737 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2738 v21->SetCondition(1u, 0); | |
2739 ++v62; | |
2740 } | |
2741 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2742 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2743 | |
2744 for (uint i = 0; i < 20; ++i) | |
2745 { | |
2746 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2747 viewparams->bRedrawGameUI = 1; | |
2748 } | |
2749 | |
2750 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2751 { | |
2752 for (uint i = 0; i < 4; ++i) | |
2753 pParty->pPlayers[i].SetCondition(1, 0); | |
2754 } | |
2755 | |
2756 for (uint i = 0; i < 2; ++i) | |
2757 { | |
2758 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2759 if (pBuf->uExpireTime == 0) | |
2760 continue; | |
2761 | |
2762 if ( !(pBuf->uFlags & 1) ) | |
2763 { | |
2764 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2765 { | |
2766 pBuf->Reset(); | |
2767 if (dword_4EE07C[i] == 7 ) | |
2768 pParty->bFlying = false; | |
2769 } | |
2770 } | |
2771 } | |
2772 | |
2773 v51 = v65; | |
2774 if ( v65 ) | |
2775 goto LABEL_135; | |
151 | 2776 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2777 { |
2778 v52 = (signed int)&pPlayers[1]; | |
2779 while ( 1 ) | |
2780 { | |
2781 v53 = *(int *)v52; | |
2782 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2783 break; | |
2784 v52 += 4; | |
2785 if ( v52 > (signed int)&pPlayers[4] ) | |
2786 goto LABEL_135; | |
2787 } | |
2788 *(int *)(v53 + 16) = 0; | |
2789 *(int *)(v53 + 20) = 0; | |
2790 v51 = 1; | |
2791 LABEL_135: | |
151 | 2792 if ( pCurrentScreen != SCREEN_REST |
0 | 2793 && (!v51 || dword_5C35C0) ) |
2794 uGameState = 8; | |
2795 } | |
2796 if ( uActiveCharacter ) | |
2797 { | |
151 | 2798 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2799 { |
2800 v54 = pPlayers[uActiveCharacter]; | |
2801 if ( v54->pConditions[2] | |
2802 || v54->pConditions[12] | |
2803 || v54->pConditions[13] | |
2804 || v54->pConditions[14] | |
2805 || v54->pConditions[15] | |
2806 || v54->pConditions[16] ) | |
2807 { | |
2808 viewparams->bRedrawGameUI = 1; | |
2809 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2810 } | |
2811 } | |
2812 } | |
2813 } | |
2814 | |
2815 //----- (00494820) -------------------------------------------------------- | |
758 | 2816 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2817 { |
2818 signed int v1; // eax@1 | |
2819 | |
2820 v1 = 5; | |
758 | 2821 if ( a1 % 24 >= 5 ) |
0 | 2822 v1 = 29; |
758 | 2823 return v1 - a1 % 24; |
0 | 2824 } |
2825 | |
2826 //----- (00494836) -------------------------------------------------------- | |
2827 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2828 { | |
2829 int v3; // esi@1 | |
2830 int result; // eax@1 | |
2831 stru339_spell_sound *v5; // ebx@1 | |
2832 int *v6; // edi@2 | |
2833 unsigned int v7; // eax@3 | |
2834 int v8; // [sp+Ch] [bp-8h]@3 | |
2835 int v9; // [sp+10h] [bp-4h]@2 | |
2836 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2837 | |
2838 v3 = 0; | |
2839 result = word_4EE088_sound_ids[uSoundID]; | |
2840 v5 = this; | |
2841 a2a = word_4EE088_sound_ids[uSoundID]; | |
2842 if ( result ) | |
2843 { | |
2844 v9 = 0; | |
2845 v6 = this->pSoundsOffsets; | |
2846 do | |
2847 { | |
2848 v7 = a2a++; | |
2849 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2850 if ( !result ) | |
2851 break; | |
2852 a6 += 4; | |
2853 result = v8 + 256; | |
2854 *v6 = v3; | |
2855 v3 += result; | |
2856 ++v9; | |
2857 *(v6 - 2) = result; | |
2858 ++v6; | |
2859 } | |
2860 while ( v9 < 2 ); | |
2861 } | |
2862 return result; | |
2863 } | |
2864 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2865 | |
2866 //----- (00494AED) -------------------------------------------------------- | |
130 | 2867 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2868 { |
2869 unsigned int _uNumFrames; // edx@1 | |
2870 unsigned int result; // eax@1 | |
2871 PlayerFrame *v4; // ecx@2 | |
2872 | |
2873 _uNumFrames = this->uNumFrames; | |
2874 result = 0; | |
2875 if ( (signed int)this->uNumFrames <= 0 ) | |
2876 { | |
2877 LABEL_5: | |
2878 result = 0; | |
2879 } | |
2880 else | |
2881 { | |
2882 v4 = this->pFrames; | |
130 | 2883 while ( v4->expression != expression ) |
0 | 2884 { |
2885 ++result; | |
2886 ++v4; | |
2887 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2888 goto LABEL_5; | |
2889 } | |
2890 } | |
2891 return result; | |
2892 } | |
2893 | |
2894 //----- (00494B10) -------------------------------------------------------- | |
2895 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2896 { | |
2897 unsigned int v3; // esi@1 | |
2898 PlayerFrame *v4; // edi@1 | |
2899 PlayerFrame *v5; // ecx@1 | |
2900 __int16 v6; // dx@2 | |
2901 int v7; // edx@3 | |
2902 char *i; // eax@3 | |
2903 int v9; // ecx@5 | |
2904 PlayerFrame *result; // eax@6 | |
2905 | |
2906 v3 = uFramesetID; | |
2907 v4 = this->pFrames; | |
2908 v5 = &v4[uFramesetID]; | |
2909 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2910 { | |
2911 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2912 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2913 { | |
2914 v9 = *(short *)i; | |
2915 if ( v7 <= v9 ) | |
2916 break; | |
2917 v7 -= v9; | |
2918 ++v3; | |
2919 } | |
2920 result = &v4[v3]; | |
2921 } | |
2922 else | |
2923 { | |
2924 result = &v4[uFramesetID]; | |
2925 } | |
2926 return result; | |
2927 } | |
2928 | |
2929 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2930 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2931 { |
2932 PlayerFrameTable *v4; // edi@1 | |
2933 int v5; // esi@1 | |
2934 int v6; // eax@2 | |
2935 | |
2936 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2937 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2938 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
|
2939 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2940 *pAnimTime = v5; |
0 | 2941 } |
2942 else | |
2943 { | |
2944 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2945 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2946 *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
|
2947 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2948 return &v4->pFrames[*pFramesetID]; |
0 | 2949 } |
2950 | |
2951 //----- (00494BC3) -------------------------------------------------------- | |
2952 void PlayerFrameTable::ToFile() | |
2953 { | |
2954 PlayerFrameTable *v1; // esi@1 | |
2955 FILE *v2; // eax@1 | |
2956 FILE *v3; // edi@1 | |
2957 | |
2958 auto Str = this; | |
2959 | |
2960 v1 = Str; | |
2961 v2 = fopen("data\\dpft.bin", "wb"); | |
2962 v3 = v2; | |
2963 if ( !v2 ) | |
2964 Abortf("Unable to save dpft.bin!"); | |
2965 fwrite(v1, 4u, 1u, v2); | |
2966 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2967 fclose(v3); | |
2968 } | |
2969 | |
2970 //----- (00494C0F) -------------------------------------------------------- | |
2971 void PlayerFrameTable::FromFile(void *pSerialized) | |
2972 { | |
2973 uNumFrames = *(int *)pSerialized; | |
2974 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2975 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2976 } | |
2977 | |
2978 //----- (00494C5A) -------------------------------------------------------- | |
2979 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2980 { | |
2981 PlayerFrameTable *v2; // ebx@1 | |
2982 FILE *v3; // eax@1 | |
2983 int v4; // esi@3 | |
2984 void *v5; // eax@10 | |
2985 FILE *v6; // ST0C_4@12 | |
2986 char *i; // eax@12 | |
2987 __int16 v8; // ax@15 | |
2988 const char *v9; // ST10_4@15 | |
2989 unsigned __int16 v10; // ax@15 | |
2990 const char *v11; // ST0C_4@15 | |
2991 int j; // esi@15 | |
2992 int v13; // eax@17 | |
2993 int v14; // edx@22 | |
2994 int v15; // ecx@23 | |
2995 int v16; // eax@24 | |
2996 signed int k; // eax@27 | |
2997 PlayerFrame *v18; // edx@28 | |
2998 int v19; // esi@28 | |
2999 int l; // ecx@29 | |
3000 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3001 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3002 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3003 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3004 int v26; // [sp+2FCh] [bp-8h]@3 | |
3005 FILE *File; // [sp+300h] [bp-4h]@1 | |
3006 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3007 | |
3008 v2 = this; | |
3009 //TileTable::dtor((TileTable *)this); | |
3010 v3 = fopen(Args, "r"); | |
3011 File = v3; | |
3012 if ( !v3 ) | |
3013 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3014 v4 = 0; | |
3015 v25 = 0; | |
3016 v26 = 1; | |
3017 if ( fgets(&Buf, 490, v3) ) | |
3018 { | |
3019 do | |
3020 { | |
3021 *strchr(&Buf, 10) = 0; | |
703 | 3022 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3023 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3024 { | |
3025 if ( v24.uPropCount < 3 ) | |
0 | 3026 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3027 ++v25; | |
3028 } | |
3029 ++v26; | |
3030 } | |
3031 while ( fgets(&Buf, 490, File) ); | |
3032 v4 = v25; | |
3033 } | |
3034 v2->uNumFrames = v4; | |
3035 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3036 v2->pFrames = (PlayerFrame *)v5; | |
3037 if ( !v5 ) | |
3038 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3039 v6 = File; | |
3040 v2->uNumFrames = 0; | |
3041 fseek(v6, 0, 0); | |
3042 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3043 { | |
3044 *strchr(&Buf, 10) = 0; | |
703 | 3045 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3046 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3047 { |
3048 v8 = atoi(v24.pProperties[0]); | |
3049 v9 = v24.pProperties[1]; | |
130 | 3050 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3051 v10 = atoi(v9); |
3052 v11 = v24.pProperties[2]; | |
3053 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3054 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3055 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3056 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3057 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3058 { |
3059 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3060 { | |
3061 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3062 *(char *)v13 |= 4u; | |
3063 } | |
3064 } | |
3065 ++v2->uNumFrames; | |
3066 } | |
3067 } | |
3068 fclose(File); | |
3069 v14 = 0; | |
3070 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3071 { | |
3072 v15 = 0; | |
3073 do | |
3074 { | |
3075 v16 = (int)&v2->pFrames[v15]; | |
3076 if ( !(*(char *)(v16 + 18) & 4) ) | |
3077 *(char *)(v16 + 8) |= 1u; | |
3078 ++v14; | |
3079 ++v15; | |
3080 } | |
3081 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3082 } | |
3083 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3084 { | |
3085 v18 = v2->pFrames; | |
3086 Argsa = (int)&v18[k]; | |
3087 v19 = *(short *)(Argsa + 4); | |
3088 if ( *(char *)(Argsa + 8) & 1 ) | |
3089 { | |
3090 ++k; | |
3091 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3092 { | |
3093 v19 += *(short *)(l + 4); | |
3094 ++k; | |
3095 } | |
3096 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3097 } | |
3098 ++k; | |
3099 } | |
3100 return 1; | |
3101 } | |
3102 | |
3103 //----- (00494F3A) -------------------------------------------------------- | |
3104 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3105 { | |
3106 IconFrameTable *v2; // esi@1 | |
3107 int v3; // ebx@1 | |
3108 unsigned int uID; // edi@1 | |
3109 unsigned int result; // eax@4 | |
3110 | |
3111 v2 = this; | |
3112 v3 = 0; | |
3113 uID = 0; | |
3114 if ( (signed int)this->uNumIcons <= 0 ) | |
3115 { | |
3116 LABEL_4: | |
3117 result = 0; | |
3118 } | |
3119 else | |
3120 { | |
3121 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3122 { | |
3123 ++uID; | |
3124 ++v3; | |
3125 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3126 goto LABEL_4; | |
3127 } | |
3128 result = uID; | |
3129 } | |
3130 return result; | |
3131 } | |
3132 | |
3133 //----- (00494F70) -------------------------------------------------------- | |
3134 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3135 { | |
3136 IconFrame *v3; // edi@1 | |
3137 IconFrame *v4; // ecx@1 | |
3138 __int16 v5; // dx@2 | |
3139 int v6; // edx@3 | |
3140 unsigned int v7; // eax@3 | |
3141 char *i; // ecx@3 | |
3142 int v9; // esi@5 | |
3143 IconFrame *result; // eax@6 | |
3144 | |
3145 v3 = this->pIcons; | |
3146 v4 = &v3[uIconID]; | |
3147 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3148 { | |
3149 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3150 v7 = uIconID; | |
3151 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3152 { | |
3153 v9 = *(short *)i; | |
3154 if ( v6 <= v9 ) | |
3155 break; | |
3156 v6 -= v9; | |
3157 ++v7; | |
3158 } | |
3159 result = &v3[v7]; | |
3160 } | |
3161 else | |
3162 { | |
3163 result = &v3[uIconID]; | |
3164 } | |
3165 return result; | |
3166 } | |
3167 | |
3168 //----- (00494FBF) -------------------------------------------------------- | |
3169 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3170 { | |
3171 IconFrameTable *v2; // esi@1 | |
3172 unsigned int v3; // edi@3 | |
3173 const char *i; // eax@3 | |
3174 IconFrame *v5; // eax@5 | |
3175 | |
3176 v2 = this; | |
3177 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3178 { | |
3179 v3 = uIconID; | |
3180 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3181 { | |
3182 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3183 v5 = v2->pIcons; | |
3184 if ( !(v5[v3].uFlags & 1) ) | |
3185 break; | |
3186 ++v3; | |
3187 } | |
3188 } | |
3189 } | |
3190 | |
3191 //----- (0049500A) -------------------------------------------------------- | |
3192 void IconFrameTable::ToFile() | |
3193 { | |
3194 IconFrameTable *v1; // esi@1 | |
3195 FILE *v2; // eax@1 | |
3196 FILE *v3; // edi@1 | |
3197 | |
3198 auto Str = this; | |
3199 | |
3200 v1 = Str; | |
3201 v2 = fopen("data\\dift.bin", "wb"); | |
3202 v3 = v2; | |
3203 if ( !v2 ) | |
3204 Abortf("Unable to save dift.bin!"); | |
3205 fwrite(v1, 4u, 1u, v2); | |
3206 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3207 fclose(v3); | |
3208 } | |
3209 | |
3210 //----- (00495056) -------------------------------------------------------- | |
3211 void IconFrameTable::FromFile(void *pSerialized) | |
3212 { | |
3213 uNumIcons = *(int *)pSerialized; | |
3214 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3215 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3216 } | |
3217 | |
3218 //----- (0049509D) -------------------------------------------------------- | |
3219 int IconFrameTable::FromFileTxt(const char *Args) | |
3220 { | |
3221 IconFrameTable *v2; // ebx@1 | |
3222 FILE *v3; // eax@1 | |
3223 int v4; // esi@3 | |
3224 void *v5; // eax@10 | |
3225 FILE *v6; // ST0C_4@12 | |
3226 char *i; // eax@12 | |
3227 const char *v8; // ST00_4@15 | |
3228 int v9; // eax@16 | |
3229 int v10; // edx@20 | |
3230 int v11; // ecx@21 | |
3231 int v12; // eax@22 | |
3232 signed int j; // edx@25 | |
3233 IconFrame *v14; // ecx@26 | |
3234 int v15; // esi@26 | |
3235 int k; // eax@27 | |
3236 signed int result; // eax@11 | |
3237 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3238 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3239 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3240 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3241 int v22; // [sp+2FCh] [bp-8h]@3 | |
3242 FILE *File; // [sp+300h] [bp-4h]@1 | |
3243 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3244 | |
3245 v2 = this; | |
3246 //TileTable::dtor((TileTable *)this); | |
3247 v3 = fopen(Args, "r"); | |
3248 File = v3; | |
3249 if ( !v3 ) | |
3250 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3251 v4 = 0; | |
3252 v21 = 0; | |
3253 v22 = 1; | |
3254 if ( fgets(&Buf, 490, v3) ) | |
3255 { | |
3256 do | |
3257 { | |
3258 *strchr(&Buf, 10) = 0; | |
3259 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3260 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3261 { | |
3262 if ( v20.uPropCount < 3 ) | |
0 | 3263 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3264 ++v21; | |
3265 } | |
3266 ++v22; | |
3267 } | |
3268 while ( fgets(&Buf, 490, File) ); | |
3269 v4 = v21; | |
3270 } | |
3271 v2->uNumIcons = v4; | |
3272 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3273 v2->pIcons = (IconFrame *)v5; | |
3274 if ( v5 ) | |
3275 { | |
3276 v6 = File; | |
3277 v2->uNumIcons = 0; | |
3278 fseek(v6, 0, 0); | |
3279 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3280 { | |
3281 *strchr(&Buf, 10) = 0; | |
3282 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3283 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3284 { |
3285 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3286 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3287 v8 = v20.pProperties[2]; | |
3288 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3289 if ( !_strcmpi(v8, "new") ) | |
3290 { | |
3291 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3292 *(char *)v9 |= 4u; | |
3293 } | |
3294 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3295 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3296 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3297 } | |
3298 } | |
3299 fclose(File); | |
3300 v10 = 0; | |
3301 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3302 { | |
3303 v11 = 0; | |
3304 do | |
3305 { | |
3306 v12 = (int)&v2->pIcons[v11]; | |
3307 if ( !(*(char *)(v12 + 60) & 4) ) | |
3308 *(char *)(v12 + 28) |= 1u; | |
3309 ++v10; | |
3310 ++v11; | |
3311 } | |
3312 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3313 } | |
3314 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3315 { | |
3316 v14 = v2->pIcons; | |
3317 Argsa = (int)&v14[j]; | |
3318 v15 = *(short *)(Argsa + 24); | |
3319 if ( *(char *)(Argsa + 28) & 1 ) | |
3320 { | |
3321 ++j; | |
3322 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3323 { | |
3324 v15 += *(short *)(k + 24); | |
3325 ++j; | |
3326 } | |
3327 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3328 } | |
3329 ++j; | |
3330 } | |
3331 result = 1; | |
3332 } | |
3333 else | |
3334 { | |
3335 fclose(File); | |
3336 result = 0; | |
3337 } | |
3338 return result; | |
3339 } | |
3340 | |
3341 //----- (00495366) -------------------------------------------------------- | |
3342 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3343 { | |
3344 int v2; // edi@1 | |
3345 int v3; // edx@2 | |
3346 int v4; // esi@3 | |
3347 int v5; // ebx@5 | |
3348 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3349 signed int v8; // [sp+10h] [bp-10h]@1 | |
3350 int **v9; // [sp+14h] [bp-Ch]@4 | |
3351 signed int v10; // [sp+18h] [bp-8h]@3 | |
3352 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3353 | |
3354 v2 = a1; | |
3355 v11 = a2; | |
3356 v8 = 0; | |
3357 v7 = 0; | |
3358 if ( dword_AE336C == a1 ) | |
3359 { | |
3360 v3 = dword_AE3370; | |
3361 } | |
3362 else | |
3363 { | |
3364 v4 = a2; | |
3365 dword_AE336C = a1; | |
3366 v10 = 0; | |
3367 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3368 goto LABEL_17; | |
3369 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3370 do | |
3371 { | |
3372 v5 = tolower(*(char *)*v9); | |
3373 if ( v5 == tolower(v2) ) | |
3374 { | |
3375 if ( v8 ) | |
3376 v7 = v10; | |
3377 else | |
3378 v8 = v10; | |
3379 } | |
3380 ++v10; | |
3381 v9 += 2; | |
3382 } | |
3383 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3384 if ( v8 && v8 != v7 ) | |
3385 v3 = v8 + rand() % (v7 - v8); | |
3386 else | |
3387 LABEL_17: | |
3388 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3389 } | |
3390 dword_AE3370 = v3; | |
3391 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3392 } | |
3393 // AE336C: using guessed type int dword_AE336C; | |
3394 // AE3370: using guessed type int dword_AE3370; | |
3395 | |
3396 //----- (00495430) -------------------------------------------------------- | |
607 | 3397 char * GetReputationString( signed int a1 ) |
3398 { | |
566 | 3399 if (a1 >= 25) |
3400 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3401 else if (a1 >= 6) | |
3402 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3403 else if (a1 >= -5) | |
3404 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3405 else if (a1 >= -24) | |
3406 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3407 else |
566 | 3408 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3409 } |
3410 | |
3411 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3412 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3413 { |
3414 unsigned __int8 v6; // bl@1 | |
3415 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3416 //NPCData *v9; // eax@4 |
250 | 3417 //size_t v10; // eax@6 |
0 | 3418 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3419 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3420 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3421 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3422 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3423 //int v16; // edx@10 |
0 | 3424 int v17; // eax@10 |
3425 signed __int64 v18; // qax@18 | |
3426 unsigned int v19; // edi@32 | |
3427 unsigned __int8 *v20; // ebx@32 | |
3428 int v21; // ecx@34 | |
3429 __int16 v22; // ax@34 | |
3430 int v23; // edx@39 | |
3431 int v24; // eax@39 | |
3432 int v25; // eax@45 | |
3433 float *v26; // esi@68 | |
3434 float v27; // ST18_4@68 | |
3435 signed int v28; // eax@68 | |
3436 int v29; // eax@68 | |
3437 float v30; // ST18_4@72 | |
3438 signed int v31; // eax@72 | |
3439 float v32; // ST18_4@74 | |
3440 signed int v33; // eax@74 | |
3441 double v34; // st7@75 | |
3442 float v35; // ST18_4@76 | |
3443 signed int v36; // eax@76 | |
3444 float *v37; // esi@78 | |
3445 float v38; // ST18_4@78 | |
3446 int v39; // eax@78 | |
3447 float v40; // ST18_4@82 | |
3448 int v41; // eax@82 | |
3449 float v42; // ST18_4@83 | |
3450 int v43; // eax@83 | |
3451 float v44; // ST18_4@85 | |
3452 int v45; // eax@85 | |
3453 const char *v46; // eax@86 | |
3454 unsigned int v47; // eax@87 | |
3455 float v48; // ST18_4@97 | |
3456 __int64 v49; // ST14_8@107 | |
3457 int v50; // eax@107 | |
3458 int v51; // eax@108 | |
3459 Player *v52; // eax@109 | |
3460 int v53; // [sp-4h] [bp-13Ch]@107 | |
3461 int v54; // [sp+0h] [bp-138h]@107 | |
3462 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3463 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3464 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3465 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3466 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3467 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3468 //Player *v61; // [sp+124h] [bp-14h]@3 |
3469 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3470 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3471 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3472 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3473 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3474 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3475 |
0 | 3476 |
3477 v6 = uPlayerID; | |
249 | 3478 //Str = lpsz; |
0 | 3479 if ( IsBadStringPtrA(lpsz, 1u) ) |
3480 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 |
0 | 3482 a1[0] = 0; |
3483 pPlayer = &pParty->pPlayers[v6]; | |
248 | 3484 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); |
249 | 3485 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3486 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3487 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3488 NPCData *npc = nullptr; |
0 | 3489 if ( dword_5C35D4 ) |
248 | 3490 { |
463 | 3491 //__debugbreak(); // fix |
459 | 3492 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
|
3493 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3494 else |
602 | 3495 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3496 //v65 = v9; |
250 | 3497 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3498 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3499 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3501 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3503 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3504 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 for (int i = 0, dst = 0; i < len; ++i) |
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 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 //while ( 1 ) |
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 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 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
|
3521 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3525 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 case 2: |
0 | 3528 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 v11 = a1; |
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 5: |
0 | 3535 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3536 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3537 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3538 { | |
3539 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3540 { | |
3541 if ( v18 < 20 ) | |
3542 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3543 } | |
3544 else | |
3545 { | |
3546 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3547 } | |
3548 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 case 6: |
0 | 3551 if ( pPlayer->uSex ) |
3552 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3553 else | |
3554 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 case 7: |
0 | 3557 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3558 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 case 8: |
0 | 3563 v19 = 0; |
3564 v63 = 0; | |
484 | 3565 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3566 do |
3567 { | |
3568 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3569 { | |
3570 v21 = v63; | |
3571 v22 = word_4EE150[v19]; | |
3572 ++v63; | |
3573 v55[v21] = v22; | |
3574 } | |
3575 ++v19; | |
3576 } | |
3577 while ( v19 < 28 ); | |
3578 if ( v63 ) | |
3579 { | |
3580 v23 = rand() % v63; | |
3581 v24 = dword_A74CDC; | |
3582 if ( dword_A74CDC == -1 ) | |
3583 { | |
3584 v24 = v23; | |
3585 dword_A74CDC = v23; | |
3586 } | |
492 | 3587 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3588 } |
3589 else | |
3590 { | |
3591 v11 = (char *)pNPCTopics[55].pText; | |
3592 } | |
249 | 3593 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 case 10: |
0 | 3603 if ( pPlayer->uSex ) |
3604 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3605 else | |
3606 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3608 case 11: |
0 | 3609 v25 = GetPartyReputation(); |
3610 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3611 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3612 v25 = npc->rep; |
0 | 3613 LABEL_46: |
3614 if ( v25 >= 25 ) | |
3615 { | |
3616 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3617 } | |
3618 else | |
3619 { | |
3620 if ( v25 < 6 ) | |
3621 { | |
3622 if ( v25 >= -5 ) | |
3623 { | |
3624 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3625 } | |
3626 else | |
3627 { | |
3628 if ( v25 < -24 ) | |
3629 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3630 else | |
3631 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3632 } | |
3633 } | |
3634 else | |
3635 { | |
3636 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3637 } | |
3638 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3639 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3640 case 13: |
0 | 3641 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3642 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3644 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3645 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
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 } |
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 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 i += 2; |
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 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3665 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 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
|
3674 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 sprintf(a1, "%lu", pay_percentage); |
250 | 3678 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 sprintf(a1, "%lu", v51); |
0 | 3692 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 v11 = a1; |
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 |
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 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3719 switch ( a5 ) |
3720 { | |
3721 case 3: | |
3722 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3723 v45 = a3->GetValue(); |
0 | 3724 v29 = pPlayer->_4B8213(v45, v44); |
3725 break; | |
3726 case 4: | |
3727 v29 = pPlayer->_4B824B(*v37); | |
3728 break; | |
3729 case 5: | |
3730 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3731 v43 = a3->GetValue(); |
0 | 3732 v29 = pPlayer->_4B8265(v43, v42); |
3733 break; | |
3734 case 6: | |
3735 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3736 v41 = a3->GetValue(); |
0 | 3737 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3738 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3739 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3740 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3741 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3742 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3744 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3746 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 v28 = a3->GetValue(); |
749 | 3748 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3749 if ( a5 == 3 ) |
3750 { | |
3751 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3752 v36 = a3->GetValue(); |
0 | 3753 v29 = pPlayer->_4B8102(v36, v35); |
315 | 3754 if (a3->Broken()) |
0 | 3755 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3756 goto _continue_sprintf; |
0 | 3757 } |
3758 if ( a5 != 4 ) | |
3759 { | |
3760 if ( a5 == 5 ) | |
3761 { | |
3762 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3763 v33 = a3->GetValue(); |
0 | 3764 v29 = pPlayer->_4B81C3(v33, v32); |
3765 } | |
3766 else | |
3767 { | |
3768 if ( a5 == 6 ) | |
3769 { | |
3770 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3771 v31 = a3->GetValue(); |
0 | 3772 v29 = pPlayer->_4B8102(v31, v30) / 2; |
315 | 3773 if (a3->Broken()) |
0 | 3774 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3775 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3776 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3777 goto _continue_sprintf; |
0 | 3778 } |
3779 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 _continue_sprintf: |
0 | 3781 sprintf(a1, "%lu", v29); |
250 | 3782 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3783 goto _continue_strcat; |
0 | 3784 } |
3785 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3786 |
0 | 3787 v48 = v34; |
3788 v29 = pPlayer->_4B8179(v48); | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3789 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3791 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3792 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 goto _continue_strcat; |
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 29: |
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 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 v48 = v34; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 v29 = pPlayer->_4B8179(v48); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3808 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 sub_493F79(&v57, *a6); |
351 | 3813 v54 = v57.field_18_expire_year; |
3814 v53 = v57.field_C_expire_day + 1; | |
3815 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3817 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3818 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3819 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3821 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 default: |
0 | 3830 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 goto _continue_strcat; |
484 | 3834 v49 = pParty->field_3C._s_times[v17-51]; |
3835 | |
0 | 3836 sub_493F79(&v56, v49); |
351 | 3837 v54 = v56.field_18_expire_year; |
3838 v53 = v56.field_C_expire_day + 1; | |
3839 v50 = v56.field_14_exprie_month; | |
0 | 3840 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3841 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3842 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3843 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3844 } |
0 | 3845 } |
3846 return pTmpBuf2; | |
3847 } | |
3848 | |
3849 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3850 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3851 { |
734 | 3852 //stru154 *v3; // edi@1 |
3853 //signed int v4; // eax@1 | |
3854 //signed int result; // eax@9 | |
3855 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3856 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3857 float v7; |
0 | 3858 |
3859 v.x = 0.0; | |
3860 v.y = 0.0; | |
3861 v.z = 0.0; | |
734 | 3862 GetFacePlane(a2, a3, &v, &v7); |
3863 | |
3864 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3865 polygonType = POLYGON_VerticalWall; | |
3866 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3867 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3868 polygonType = POLYGON_Floor; | |
0 | 3869 else |
734 | 3870 polygonType = POLYGON_InBetweenFloorAndWall; |
3871 | |
3872 face_plane.vNormal.x = v.x; | |
3873 face_plane.vNormal.y = v.y; | |
3874 face_plane.vNormal.z = v.z; | |
3875 face_plane.dist = v7; | |
0 | 3876 } |
3877 | |
3878 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3879 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3880 { |
734 | 3881 if (fabsf(pNormal->z) < 1e-6f) |
3882 polygonType = POLYGON_VerticalWall; | |
3883 else if (fabsf(pNormal->x) < 1e-6f && | |
3884 fabsf(pNormal->y) < 1e-6f) | |
3885 polygonType = POLYGON_Floor; | |
0 | 3886 else |
734 | 3887 polygonType = POLYGON_InBetweenFloorAndWall; |
3888 | |
3889 face_plane.vNormal.x = pNormal->x; | |
3890 face_plane.dist = dist; | |
3891 face_plane.vNormal.y = pNormal->y; | |
3892 face_plane.vNormal.z = pNormal->z; | |
0 | 3893 } |
3894 | |
3895 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3896 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3897 { |
3898 ODMFace *v5; // ebx@1 | |
734 | 3899 //int v6; // eax@1 |
3900 //unsigned __int16 *v7; // ebx@2 | |
3901 //Vec3_int_ *v8; // eax@3 | |
0 | 3902 Vec3_int_ *v9; // ecx@3 |
734 | 3903 //double v10; // st7@3 |
3904 //int v11; // ecx@3 | |
0 | 3905 Vec3_int_ *v12; // ecx@3 |
734 | 3906 //double v13; // st7@3 |
3907 //double v14; // st6@3 | |
3908 //double v15; // st5@3 | |
3909 //int v16; // ecx@3 | |
0 | 3910 Vec3_int_ *v17; // eax@3 |
734 | 3911 //double v18; // st5@3 |
0 | 3912 Vec3_float_ *v19; // eax@3 |
734 | 3913 //int result; // eax@8 |
3914 //float v21; // ecx@10 | |
3915 //double v22; // st7@10 | |
3916 //double v23; // st6@10 | |
0 | 3917 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3918 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3919 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3920 float v27; // [sp+20h] [bp-48h]@3 | |
3921 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3922 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3923 //float v30; // [sp+30h] [bp-38h]@3 | |
3924 //float v31; // [sp+34h] [bp-34h]@3 | |
3925 //float v32; // [sp+38h] [bp-30h]@3 | |
3926 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3927 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3928 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3929 //float v36; // [sp+50h] [bp-18h]@3 | |
3930 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3931 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3932 //int v39; // [sp+64h] [bp-4h]@1 |
3933 | |
3934 //v39 = 0; | |
0 | 3935 v1.x = 0.0; |
3936 v5 = pFace; | |
734 | 3937 //v6 = pFace->uNumVertices; |
0 | 3938 v1.y = 0.0; |
3939 v1.z = 0.0; | |
734 | 3940 |
3941 if (pFace->uNumVertices >= 2) | |
3942 { | |
3943 int i = 0; | |
3944 while ( i < pFace->uNumVertices - 2 ) | |
3945 { | |
3946 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3947 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3948 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3949 | |
3950 v1.x = v12->x - v9->x; | |
3951 v26 = v17->x - v12->x; | |
3952 v1.y = v12->y - v9->y; | |
3953 v27 = v17->y - v12->y; | |
3954 v1.z = v12->z - v9->z; | |
3955 v28 = v17->z - v12->z; | |
0 | 3956 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3957 v38.x = v19->x; | |
3958 v38.y = v19->y; | |
3959 v38.z = v19->z; | |
734 | 3960 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3961 { | |
3962 v38.Normalize(); | |
3963 | |
3964 pOutNormal->x = v38.x; | |
3965 pOutNormal->y = v38.y; | |
3966 pOutNormal->z = v38.z; | |
3967 | |
3968 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3969 return; | |
3970 } | |
3971 } | |
3972 } | |
3973 | |
3974 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3975 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3976 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3977 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3978 } |
3979 | |
3980 //----- (0049D700) -------------------------------------------------------- | |
3981 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3982 { | |
3983 unsigned int v1; // eax@1 | |
3984 int v2; // ecx@1 | |
3985 unsigned int v3; // eax@1 | |
3986 | |
3987 v1 = uDim; | |
3988 v2 = 0; | |
3989 v3 = v1 - 1; | |
3990 while ( v3 & 1 ) | |
3991 { | |
3992 v3 >>= 1; | |
3993 ++v2; | |
3994 } | |
3995 return v3 == 0 ? v2 : 0; | |
3996 } | |
3997 | |
3998 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3999 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4000 { |
737 | 4001 /*signed __int64 v2; // ST10_8@1 |
0 | 4002 double v3; // st7@1 |
4003 float v4; // ST24_4@1 | |
4004 double v5; // ST10_8@1 | |
4005 int v6; // ST1C_4@1 | |
4006 float v7; // ST24_4@1 | |
4007 double v8; // ST10_8@1 | |
4008 unsigned __int8 v9; // ST20_1@1 | |
4009 float v10; // ST24_4@1 | |
4010 double v11; // ST10_8@1 | |
4011 float v12; // ST24_4@1 | |
737 | 4012 double v13; // ST08_8@1*/ |
4013 | |
4014 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4015 (a2 >> 24) / 255.0f * 255.0f), | |
4016 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4017 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4018 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4019 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4020 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4021 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4022 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4023 /*v2 = a1 >> 24; | |
4024 v3 = (double)v2 / 255.0f; | |
4025 HIDWORD(v2) = 0; | |
0 | 4026 LODWORD(v2) = a2 >> 24; |
737 | 4027 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4028 v5 = v4 + 6.7553994e15; |
4029 v6 = LODWORD(v5); | |
737 | 4030 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4031 v8 = v7 + 6.7553994e15; |
4032 v9 = LOBYTE(v8); | |
737 | 4033 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4034 v11 = v10 + 6.7553994e15; |
737 | 4035 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4036 v13 = v12 + 6.7553994e15; |
737 | 4037 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4038 } |
4039 | |
4040 //----- (004A46E6) -------------------------------------------------------- | |
4041 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4042 { | |
4043 int v5; // eax@1 | |
4044 int z; // eax@1 | |
4045 unsigned int v7; // eax@9 | |
4046 unsigned int v8; // ecx@9 | |
4047 int v9; // eax@9 | |
4048 unsigned int v10; // eax@10 | |
4049 int *v11; // esi@10 | |
4050 int *v12; // edi@10 | |
4051 int v13; // ecx@10 | |
4052 int v14; // edx@10 | |
4053 unsigned int v15; // eax@22 | |
4054 int *v16; // esi@22 | |
4055 int *v17; // edi@22 | |
4056 int v18; // ecx@22 | |
4057 int v19; // edx@22 | |
4058 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4059 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4060 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4061 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4062 | |
4063 v5 = a4; | |
4064 v23 = _z >> 16; | |
4065 z = x + v5; | |
693 | 4066 if ( z >= (signed int)pViewport->uViewportTL_X |
4067 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4068 && y >= (signed int)pViewport->uViewportTL_Y | |
4069 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4070 { | |
4071 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4072 x = pViewport->uViewportTL_X; | |
4073 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4074 z = pViewport->uViewportBR_X; | |
0 | 4075 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4076 v22 = z - x; | |
4077 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4078 v7 = lightColor >> 3; | |
4079 v8 = lightColor & 0xF0; | |
4080 v9 = v7 & 0x1E0000; | |
4081 if ( pRenderer->uTargetGBits == 5 ) | |
4082 { | |
4083 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4084 v11 = (int *)pTarget; | |
4085 v12 = pTargetZ; | |
4086 v13 = v22; | |
4087 v14 = (v10 << 16) | v10; | |
4088 z = (unsigned __int8)pTarget & 2; | |
4089 if ( (unsigned __int8)pTarget & 2 ) | |
4090 { | |
4091 z = (unsigned int)*pTargetZ >> 16; | |
4092 if ( z > v23 ) | |
4093 { | |
4094 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4095 *pTarget = z; | |
4096 } | |
4097 v13 = v22 - 1; | |
4098 v11 = (int *)(pTarget + 1); | |
4099 v12 = pTargetZ + 1; | |
4100 } | |
4101 while ( v13 != 1 ) | |
4102 { | |
4103 if ( v13 < 1 ) | |
4104 return z; | |
4105 z = (unsigned int)*v12 >> 16; | |
4106 if ( z <= v23 ) | |
4107 { | |
4108 v13 -= 2; | |
4109 ++v11; | |
4110 v12 += 2; | |
4111 } | |
4112 else | |
4113 { | |
4114 v12 += 2; | |
4115 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4116 v13 -= 2; | |
4117 *v11 = z; | |
4118 ++v11; | |
4119 } | |
4120 } | |
4121 z = (unsigned int)*v12 >> 16; | |
4122 if ( z > v23 ) | |
4123 { | |
4124 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4125 *(short *)v11 = z; | |
4126 } | |
4127 } | |
4128 else | |
4129 { | |
4130 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4131 v16 = (int *)pTarget; | |
4132 v17 = pTargetZ; | |
4133 v18 = v22; | |
4134 v19 = (v15 << 16) | v15; | |
4135 z = (unsigned __int8)pTarget & 2; | |
4136 if ( (unsigned __int8)pTarget & 2 ) | |
4137 { | |
4138 z = (unsigned int)*pTargetZ >> 16; | |
4139 if ( z > v23 ) | |
4140 { | |
4141 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4142 *pTarget = z; | |
4143 } | |
4144 v18 = v22 - 1; | |
4145 v16 = (int *)(pTarget + 1); | |
4146 v17 = pTargetZ + 1; | |
4147 } | |
4148 while ( v18 != 1 ) | |
4149 { | |
4150 if ( v18 < 1 ) | |
4151 return z; | |
4152 z = (unsigned int)*v17 >> 16; | |
4153 if ( z <= v23 ) | |
4154 { | |
4155 v18 -= 2; | |
4156 ++v16; | |
4157 v17 += 2; | |
4158 } | |
4159 else | |
4160 { | |
4161 v17 += 2; | |
4162 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4163 v18 -= 2; | |
4164 *v16 = z; | |
4165 ++v16; | |
4166 } | |
4167 } | |
4168 z = (unsigned int)*v17 >> 16; | |
4169 if ( z > v23 ) | |
4170 { | |
4171 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4172 *(short *)v16 = z; | |
4173 } | |
4174 } | |
4175 } | |
4176 return z; | |
4177 } | |
4178 | |
4179 //----- (004A57E9) -------------------------------------------------------- | |
4180 void __cdecl Present_ColorKey() | |
4181 { | |
4182 HRESULT v0; // eax@3 | |
4183 HRESULT v1; // eax@3 | |
4184 HRESULT v2; // eax@3 | |
4185 HRESULT v3; // eax@3 | |
4186 HRESULT v4; // eax@3 | |
4187 RECT a2; // [sp+4h] [bp-14h]@3 | |
4188 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4189 | |
4190 if ( !pRenderer->uNumSceneBegins ) | |
4191 { | |
4192 if ( pRenderer->field_40110 ) | |
4193 { | |
693 | 4194 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4195 a2.left = 0; |
4196 a2.top = 0; | |
4197 a2.right = 640; | |
4198 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4199 a2.right = 640; | |
4200 a2.left = 0; | |
693 | 4201 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4202 a2.bottom = 480; |
4203 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4204 0, | |
693 | 4205 pViewport->uViewportBR_Y + 1, |
0 | 4206 pRenderer->pColorKeySurface4, |
4207 &a2, | |
4208 16u)); | |
693 | 4209 a2.right = pViewport->uViewportTL_X; |
4210 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4211 a2.left = 0; |
693 | 4212 a2.top = pViewport->uViewportTL_Y; |
0 | 4213 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4214 0, | |
693 | 4215 pViewport->uViewportTL_Y, |
0 | 4216 pRenderer->pColorKeySurface4, |
4217 &a2, | |
4218 16u)); | |
693 | 4219 a2.left = pViewport->uViewportBR_X; |
4220 a2.top = pViewport->uViewportTL_Y; | |
0 | 4221 a2.right = 640; |
693 | 4222 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4223 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4224 pViewport->uViewportBR_X, |
4225 pViewport->uViewportTL_Y, | |
0 | 4226 pRenderer->pColorKeySurface4, |
4227 &a2, | |
4228 16u)); | |
693 | 4229 a2.right = pViewport->uViewportBR_X; |
4230 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4231 a2.left = pViewport->uViewportTL_X; | |
4232 a2.top = pViewport->uViewportTL_Y; | |
0 | 4233 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4234 pViewport->uViewportTL_X, |
4235 pViewport->uViewportTL_Y, | |
0 | 4236 pRenderer->pColorKeySurface4, |
4237 &a2, | |
4238 17u)); | |
4239 } | |
4240 } | |
4241 } | |
4242 | |
4243 //----- (004A597D) -------------------------------------------------------- | |
4244 void Present_NoColorKey() | |
4245 { | |
4246 //unsigned __int16 *v0; // eax@4 | |
4247 unsigned __int16 *v1; // esi@4 | |
4248 void *v2; // edi@4 | |
4249 //signed int v4; // ebx@4 | |
4250 //signed int v5; // ebx@6 | |
4251 //void *v6; // edi@7 | |
4252 //const void *v7; // esi@7 | |
4253 signed int v8; // ebx@8 | |
4254 int v9; // eax@10 | |
4255 unsigned int v10; // esi@10 | |
4256 unsigned __int32 v11; // edi@10 | |
4257 //int v12; // ecx@10 | |
4258 unsigned int v13; // ebx@10 | |
4259 int v14; // eax@11 | |
4260 int v15; // eax@13 | |
4261 int v16; // eax@14 | |
4262 int v17; // eax@16 | |
4263 HRESULT v18; // eax@22 | |
4264 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4265 int v20; // [sp+88h] [bp-1Ch]@10 | |
4266 int v21; // [sp+8Ch] [bp-18h]@10 | |
4267 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4268 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4269 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4270 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4271 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4272 | |
4273 if ( !pRenderer->uNumSceneBegins ) | |
4274 { | |
4275 if ( pRenderer->field_40110 ) | |
4276 { | |
4277 memset(&Dst, 0, 0x7Cu); | |
4278 Dst.dwSize = 124; | |
168 | 4279 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4280 { |
4281 //v26 = Dst.lpSurface; | |
4282 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4283 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4284 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4285 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4286 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4287 v1 = pRenderer->pTargetSurface; | |
4288 v2 = Dst.lpSurface; | |
4289 | |
4290 | |
4291 /*for (uint y = 0; y < 480; ++y) | |
4292 { | |
4293 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4294 for (uint x = 0; x < 640; ++x) | |
4295 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4296 }*/ | |
4297 | |
4298 auto pSrc = pRenderer->pTargetSurface; | |
4299 auto pDst = (__int16 *)Dst.lpSurface; | |
4300 | |
4301 for (uint y = 0; y < 8; ++y) | |
4302 memcpy(pDst + y * Dst.lPitch / 2, | |
4303 | |
4304 pSrc + y * 640, 640 * sizeof(__int16)); | |
4305 | |
4306 for (uint y = 8; y < 352; ++y) | |
4307 { | |
4308 memcpy(pDst + y * Dst.lPitch / 2, | |
4309 pSrc + y * 640, 8 * sizeof(__int16)); | |
4310 memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2, | |
4311 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
4312 } | |
4313 | |
121 | 4314 for (uint y = 352; y < 480; ++y) |
0 | 4315 memcpy(pDst + y * Dst.lPitch / 2, |
4316 pSrc + y * 640, 640 * sizeof(__int16)); | |
4317 | |
4318 | |
693 | 4319 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4320 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4321 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4322 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4323 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4324 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4325 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4326 v21 = 4 * v9 + 1280; | |
4327 | |
121 | 4328 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4329 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4330 v10 = (int)pSrc_x1y1; | |
4331 v11 = (int)pDst_x1y1; | |
693 | 4332 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4333 v13 = v24; |
4334 | |
693 | 4335 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4336 { |
4337 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4338 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4339 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4340 { |
4341 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4342 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4343 } | |
4344 } | |
4345 | |
4346 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4347 | |
4348 /* while ( 1 ) | |
4349 { | |
4350 while ( 1 ) | |
4351 { | |
4352 v14 = *(int *)v10; | |
4353 v10 += 4; | |
4354 if ( v14 == v13 ) | |
4355 break; | |
4356 if ( (short)v14 == (short)v13 ) | |
4357 { | |
4358 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4359 v11 += 4; | |
4360 --uHalfWidth; | |
4361 if ( !uHalfWidth ) | |
4362 goto LABEL_21; | |
4363 } | |
4364 else | |
4365 { | |
4366 v15 = __ROL__(v14, 16); | |
4367 if ( (short)v15 == (short)v13 ) | |
4368 { | |
4369 v17 = __ROR__(v15, 16); | |
4370 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4371 v11 += 4; | |
4372 --uHalfWidth; | |
4373 if ( !uHalfWidth ) | |
4374 goto LABEL_21; | |
4375 } | |
4376 else | |
4377 { | |
4378 v16 = __ROR__(v15, 16); | |
4379 *(int *)v11 = v16; | |
4380 v11 += 4; | |
4381 --uHalfWidth; | |
4382 if ( !uHalfWidth ) | |
4383 goto LABEL_21; | |
4384 } | |
4385 } | |
4386 } | |
4387 v11 += 4; | |
4388 --uHalfWidth; | |
4389 if ( !uHalfWidth ) | |
4390 { | |
4391 LABEL_21: | |
4392 v10 += v21; | |
4393 v11 += v22; | |
4394 uHalfWidth = v20; | |
4395 if ( !--uNumLines ) | |
4396 { | |
4397 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4398 return; | |
4399 } | |
4400 } | |
4401 }*/ | |
4402 } | |
4403 } | |
4404 } | |
4405 } | |
4406 | |
4407 //----- (004A7063) -------------------------------------------------------- | |
4408 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4409 { | |
4410 float v2; // ST1C_4@1 | |
4411 double v3; // ST14_8@1 | |
4412 signed int v4; // ebx@1 | |
4413 float v5; // ST1C_4@1 | |
4414 double v6; // ST14_8@1 | |
4415 signed int v7; // edi@1 | |
4416 double v8; // ST0C_8@1 | |
4417 signed int v9; // esi@1 | |
4418 signed int v10; // ecx@1 | |
4419 double v12; // [sp+8h] [bp-18h]@1 | |
4420 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4421 | |
4422 v2 = (double)(uDiffuse >> 24) * a2; | |
4423 v3 = v2 + 6.7553994e15; | |
4424 v4 = LODWORD(v3); | |
4425 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4426 v6 = v5 + 6.7553994e15; | |
4427 v7 = LODWORD(v6); | |
4428 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4429 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4430 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4431 v9 = LODWORD(v8); | |
4432 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4433 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4434 v10 = LODWORD(v12); | |
4435 if ( v4 > 255 ) | |
4436 v4 = 255; | |
4437 if ( v4 < 0 ) | |
4438 v4 = 0; | |
4439 if ( SHIDWORD(v13) > 255 ) | |
4440 v7 = 255; | |
4441 if ( v7 < 0 ) | |
4442 v7 = 0; | |
4443 if ( (signed int)v13 > 255 ) | |
4444 v9 = 255; | |
4445 if ( v9 < 0 ) | |
4446 v9 = 0; | |
4447 if ( SLODWORD(v12) > 255 ) | |
4448 v10 = 255; | |
4449 if ( v10 < 0 ) | |
4450 v10 = 0; | |
4451 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4452 } | |
4453 | |
4454 //----- (004AD504) -------------------------------------------------------- | |
711 | 4455 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4456 { |
4457 int result; // eax@1 | |
711 | 4458 signed int v2; // ebx@1 |
0 | 4459 BLVFace *v3; // esi@3 |
4460 Texture *v4; // edi@6 | |
4461 int v5; // eax@7 | |
4462 int v6; // edx@7 | |
4463 int v7; // ecx@7 | |
4464 int v8; // ebx@8 | |
4465 int v9; // eax@8 | |
4466 int v10; // ebx@8 | |
4467 unsigned int v11; // ebx@9 | |
4468 int v12; // esi@10 | |
4469 int v13; // eax@13 | |
4470 unsigned __int16 *v14; // eax@13 | |
4471 unsigned int v15; // eax@14 | |
4472 unsigned __int16 *v16; // ebx@14 | |
4473 int v17; // eax@15 | |
4474 int v18; // ebx@15 | |
4475 int v19; // esi@15 | |
4476 int v20; // ecx@15 | |
4477 int v21; // eax@15 | |
4478 stru193_math *v22; // ebx@15 | |
4479 int v23; // eax@15 | |
4480 char *v24; // esi@16 | |
4481 int v25; // eax@18 | |
4482 int v26; // eax@18 | |
4483 int v27; // eax@20 | |
4484 signed int v28; // esi@20 | |
4485 signed int v29; // edx@20 | |
4486 signed int v30; // esi@20 | |
4487 signed int v31; // edi@20 | |
4488 int v32; // esi@20 | |
4489 int v33; // eax@26 | |
4490 int *v34; // esi@27 | |
4491 unsigned __int16 *v35; // edi@27 | |
4492 unsigned int v36; // edx@27 | |
4493 int v37; // ebx@27 | |
4494 char v38; // cl@27 | |
4495 char v39; // ch@27 | |
4496 int v40; // ebx@29 | |
4497 int v41; // edx@29 | |
4498 unsigned int v42; // ebx@30 | |
4499 int v43; // edx@30 | |
4500 int v44; // eax@33 | |
4501 int *v45; // esi@34 | |
4502 unsigned __int16 *v46; // edi@34 | |
4503 unsigned int v47; // edx@34 | |
4504 int v48; // ebx@34 | |
4505 char v49; // cl@34 | |
4506 char v50; // ch@34 | |
4507 int v51; // ebx@36 | |
4508 int v52; // edx@36 | |
4509 unsigned __int16 v53; // bx@37 | |
4510 int v54; // edx@37 | |
4511 int v55; // eax@40 | |
4512 int v56; // eax@41 | |
4513 int *v57; // esi@42 | |
4514 unsigned __int16 *v58; // edi@42 | |
4515 unsigned int v59; // edx@42 | |
4516 int v60; // ebx@42 | |
4517 char v61; // cl@42 | |
4518 char v62; // ch@42 | |
4519 unsigned int v63; // ebx@44 | |
4520 int v64; // edx@44 | |
4521 unsigned int v65; // ebx@44 | |
4522 int v66; // edx@44 | |
4523 unsigned int v67; // ebx@45 | |
4524 int v68; // edx@45 | |
4525 int v69; // ebx@45 | |
4526 int v70; // edx@45 | |
4527 int v71; // eax@48 | |
4528 int *v72; // esi@49 | |
4529 unsigned __int16 *v73; // edi@49 | |
4530 unsigned int v74; // edx@49 | |
4531 int v75; // ebx@49 | |
4532 char v76; // cl@49 | |
4533 char v77; // ch@49 | |
4534 unsigned int v78; // ebx@51 | |
4535 int v79; // edx@51 | |
4536 unsigned int v80; // ebx@51 | |
4537 int v81; // edx@51 | |
4538 unsigned int v82; // ebx@52 | |
4539 int v83; // edx@52 | |
4540 int v84; // ebx@52 | |
4541 int v85; // edx@52 | |
4542 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4543 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4544 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4545 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4546 int v90; // [sp+1Ch] [bp-88h]@20 | |
4547 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4548 int v92; // [sp+24h] [bp-80h]@7 | |
4549 int i; // [sp+28h] [bp-7Ch]@7 | |
4550 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4551 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4552 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4553 int v97; // [sp+38h] [bp-6Ch]@15 | |
4554 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4555 int v99; // [sp+40h] [bp-64h]@9 | |
4556 int v100; // [sp+44h] [bp-60h]@24 | |
4557 int v101; // [sp+48h] [bp-5Ch]@10 | |
4558 int v102; // [sp+4Ch] [bp-58h]@20 | |
4559 int v103; // [sp+50h] [bp-54h]@20 | |
4560 int v104; // [sp+54h] [bp-50h]@9 | |
4561 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4562 int v106; // [sp+5Ch] [bp-48h]@24 | |
4563 int v107; // [sp+60h] [bp-44h]@20 | |
4564 int v108; // [sp+64h] [bp-40h]@20 | |
4565 int v109; // [sp+68h] [bp-3Ch]@20 | |
4566 int v110; // [sp+6Ch] [bp-38h]@15 | |
4567 int v111; // [sp+70h] [bp-34h]@20 | |
4568 int a1; // [sp+74h] [bp-30h]@12 | |
4569 int a2; // [sp+78h] [bp-2Ch]@9 | |
4570 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4571 int v115; // [sp+80h] [bp-24h]@18 | |
4572 int v116; // [sp+84h] [bp-20h]@7 | |
4573 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4574 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4575 int *v119; // [sp+90h] [bp-14h]@13 | |
4576 int v120; // [sp+94h] [bp-10h]@15 | |
4577 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4578 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4579 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4580 | |
4581 result = pRenderer->uTargetSurfacePitch; | |
711 | 4582 v2 = sFaceID; |
0 | 4583 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4584 if ( sFaceID >= 0 ) |
4585 { | |
4586 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4587 { | |
4588 v3 = &pIndoor->pFaces[sFaceID]; | |
4589 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4590 if ( !pRenderer->pRenderD3D ) |
4591 { | |
711 | 4592 result = sub_423B5D(sFaceID); |
0 | 4593 if ( result ) |
4594 { | |
4595 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4596 if ( result ) | |
4597 { | |
4598 result = (int)v3->GetTexture(); | |
4599 v4 = (Texture *)result; | |
4600 v96 = (Texture *)result; | |
4601 if ( result ) | |
4602 { | |
4603 v5 = *(short *)(result + 38); | |
4604 LOBYTE(v3->uAttributes) |= 0x80u; | |
4605 v92 = v5; | |
4606 sub_4AE5F1(v2); | |
4607 ++pBLVRenderParams->field_84; | |
4608 v6 = stru_F8AD28.pDeltaUV[0]; | |
4609 v116 = stru_F8AD28.pDeltaUV[1]; | |
4610 v7 = 0; | |
4611 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4612 { | |
4613 v8 = v116; | |
4614 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4615 v9 = 4 * v7 + 16297672; | |
4616 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4617 } | |
4618 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4619 result = stru_F8A590._viewport_space_y; | |
4620 a2 = stru_F8A590._viewport_space_y; | |
4621 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4622 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4623 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4624 v87 = v4->pLevelOfDetail1; |
4625 v88 = v4->pLevelOfDetail2; | |
4626 v89 = v4->pLevelOfDetail3; | |
4627 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4628 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4629 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4630 { | |
4631 v12 = 2 * stru_F8A590._viewport_space_y; | |
4632 v101 = 2 * stru_F8A590._viewport_space_y; | |
4633 while ( 1 ) | |
4634 { | |
4635 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4636 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4637 if ( LOBYTE(viewparams->field_20) ) | |
4638 { | |
4639 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4640 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4641 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4642 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4643 - pBLVRenderParams->uViewportX]; | |
4644 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4645 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4646 - pBLVRenderParams->uViewportX]; | |
4647 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4648 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4649 - pBLVRenderParams->uViewportX]; | |
4650 v123 = (unsigned int)v16; | |
4651 } | |
4652 else | |
4653 { | |
4654 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4655 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4656 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4657 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4658 } | |
4659 v117 = (unsigned int)v14; | |
4660 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4661 v18 = stru_F81018.field_0.field_10; | |
4662 LOWORD(v17) = 0; | |
4663 v97 = stru_F8AD28.field_0 | v17; | |
4664 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4665 v19 = stru_F81018.field_0.field_4 >> i; | |
4666 v20 = 11 - v18; | |
4667 v116 = stru_F81018.field_0.field_8 >> i; | |
4668 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4669 v22 = stru_5C6E00; | |
4670 v122 = (unsigned __int16 *)v20; | |
323 | 4671 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4672 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4673 v120 = v116 + 4 * v23; |
4674 if ( v123 < v117 ) | |
4675 { | |
4676 v24 = (char *)&stru_F81018.field_34.field_8; | |
4677 v114 = &stru_F81018.field_34.field_8; | |
4678 a1 += 16; | |
4679 while ( 1 ) | |
4680 { | |
4681 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4682 v25 = *((int *)v24 - 2); | |
4683 LOWORD(v25) = 0; | |
4684 v115 = v97; | |
4685 v26 = stru_F8AD28.field_0 | v25; | |
4686 if ( v97 <= (unsigned int)v26 ) | |
4687 v115 = v26; | |
4688 v97 = v26; | |
4689 v27 = *((int *)v24 - 11); | |
4690 v28 = *((int *)v24 - 1); | |
4691 v105 = (&v86)[4 * v27]; | |
4692 v111 = v27 + 16; | |
4693 v29 = v4->uWidthMinus1; | |
4694 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4695 v107 = v29 >> v27; | |
4696 v30 = v28 >> i; | |
4697 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4698 v31 = *v114 >> i; | |
4699 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4700 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4701 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4702 v108 = (signed int)(v116 - v121) >> 4; |
4703 v103 = (v90 - v120) >> 4; | |
4704 v32 = v123 + 32; | |
4705 if ( LOBYTE(viewparams->field_20) ) | |
4706 v32 = v123 + 64; | |
4707 if ( v32 > v117 ) | |
4708 v32 = v117; | |
4709 v118 = v32; | |
4710 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4711 v106 = (signed int)(v32 - v123) >> 1; | |
4712 if ( v110 >> 16 == v100 >> 16 ) | |
4713 { | |
4714 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4715 if ( LOBYTE(viewparams->field_20) ) | |
4716 { | |
4717 v44 = v123; | |
4718 if ( v123 < v118 ) | |
4719 { | |
4720 v45 = v119; | |
4721 v46 = v122; | |
4722 v47 = v121; | |
4723 v48 = v120; | |
4724 v49 = v111; | |
4725 v50 = v109; | |
4726 if ( v106 & 2 ) | |
4727 { | |
4728 *v119 = v115; | |
4729 v45 -= 2; | |
4730 v44 = v123 + 4; | |
4731 goto LABEL_37; | |
4732 } | |
4733 do | |
4734 { | |
4735 v44 += 8; | |
4736 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4737 v52 = v115; | |
4738 LOWORD(v51) = v46[v51]; | |
4739 *v45 = v115; | |
4740 v45[1] = v52; | |
4741 v45[640] = v52; | |
4742 v45[641] = v52; | |
4743 *(short *)(v44 - 8) = v51; | |
4744 *(short *)(v44 - 6) = v51; | |
4745 *(short *)(v44 + 1272) = v51; | |
4746 *(short *)(v44 + 1274) = v51; | |
4747 v45[2] = v52; | |
4748 v45[3] = v52; | |
4749 v45[642] = v52; | |
4750 v45[643] = v52; | |
4751 v121 += v108; | |
4752 v120 += v103; | |
4753 v47 = v121; | |
4754 v48 = v120; | |
4755 LABEL_37: | |
4756 v45 += 4; | |
4757 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4758 v54 = v108; | |
4759 *(short *)(v44 - 4) = v53; | |
4760 *(short *)(v44 - 2) = v53; | |
4761 *(short *)(v44 + 1276) = v53; | |
4762 *(short *)(v44 + 1278) = v53; | |
4763 v121 += v54; | |
4764 v120 += v103; | |
4765 v47 = v121; | |
4766 v48 = v120; | |
4767 } | |
4768 while ( v44 < v118 ); | |
4769 v123 = v44; | |
4770 v119 = v45; | |
4771 } | |
4772 } | |
4773 else | |
4774 { | |
4775 v33 = v123; | |
4776 if ( v123 < v118 ) | |
4777 { | |
4778 v34 = v119; | |
4779 v35 = v122; | |
4780 v36 = v121; | |
4781 v37 = v120; | |
4782 v38 = v111; | |
4783 v39 = v109; | |
4784 if ( v106 & 1 ) | |
4785 { | |
4786 *v119 = v115; | |
4787 --v34; | |
4788 v33 = v123 + 2; | |
4789 goto LABEL_30; | |
4790 } | |
4791 do | |
4792 { | |
4793 v33 += 4; | |
4794 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4795 v41 = v115; | |
4796 LOWORD(v40) = v35[v40]; | |
4797 *v34 = v115; | |
4798 *(short *)(v33 - 4) = v40; | |
4799 v34[1] = v41; | |
4800 v121 += v108; | |
4801 v120 += v103; | |
4802 v36 = v121; | |
4803 v37 = v120; | |
4804 LABEL_30: | |
4805 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4806 v34 += 2; | |
4807 v43 = v108; | |
4808 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4809 v121 += v43; | |
4810 v120 += v103; | |
4811 v36 = v121; | |
4812 v37 = v120; | |
4813 } | |
4814 while ( v33 < v118 ); | |
4815 v123 = v33; | |
4816 v119 = v34; | |
4817 } | |
4818 } | |
4819 } | |
4820 else | |
4821 { | |
4822 v55 = v110 - ((v100 - v110) >> 4); | |
4823 v110 = (v100 - v110) >> 4; | |
4824 v122 = (unsigned __int16 *)v55; | |
4825 if ( LOBYTE(viewparams->field_20) ) | |
4826 { | |
4827 v71 = v123; | |
4828 if ( v123 < v118 ) | |
4829 { | |
4830 v72 = v119; | |
4831 v73 = v94; | |
4832 v74 = v121; | |
4833 v75 = v120; | |
4834 v76 = v111; | |
4835 v77 = v109; | |
4836 if ( v106 & 2 ) | |
4837 { | |
4838 *v119 = v115; | |
4839 v72 += 2; | |
4840 v71 = v123 + 4; | |
4841 goto LABEL_52; | |
4842 } | |
4843 do | |
4844 { | |
4845 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4846 v79 = (int)((char *)v122 + v110); | |
4847 v71 += 8; | |
4848 v122 = (unsigned __int16 *)v79; | |
4849 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4850 v81 = v115; | |
4851 LOWORD(v80) = v73[v80]; | |
4852 *v72 = v115; | |
4853 v72[1] = v81; | |
4854 v72[640] = v81; | |
4855 v72[641] = v81; | |
4856 *(short *)(v71 - 8) = v80; | |
4857 *(short *)(v71 - 6) = v80; | |
4858 *(short *)(v71 + 1272) = v80; | |
4859 *(short *)(v71 + 1274) = v80; | |
4860 v72[2] = v81; | |
4861 v72[3] = v81; | |
4862 v72[642] = v81; | |
4863 v72[643] = v81; | |
4864 v121 += v108; | |
4865 v120 += v103; | |
4866 v74 = v121; | |
4867 v75 = v120; | |
4868 v72 += 4; | |
4869 LABEL_52: | |
4870 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4871 v83 = (int)((char *)v122 + v110); | |
4872 v84 = v105[v82]; | |
4873 v122 = (unsigned __int16 *)v83; | |
4874 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4875 v85 = v108; | |
4876 *(short *)(v71 - 4) = v84; | |
4877 *(short *)(v71 - 2) = v84; | |
4878 *(short *)(v71 + 1276) = v84; | |
4879 *(short *)(v71 + 1278) = v84; | |
4880 v121 += v85; | |
4881 v120 += v103; | |
4882 v74 = v121; | |
4883 v75 = v120; | |
4884 } | |
4885 while ( v71 < v118 ); | |
4886 v123 = v71; | |
4887 v119 = v72; | |
4888 } | |
4889 } | |
4890 else | |
4891 { | |
4892 v56 = v123; | |
4893 if ( v123 < v118 ) | |
4894 { | |
4895 v57 = v119; | |
4896 v58 = v94; | |
4897 v59 = v121; | |
4898 v60 = v120; | |
4899 v61 = v111; | |
4900 v62 = v109; | |
4901 if ( v106 & 1 ) | |
4902 { | |
4903 *v119 = v115; | |
4904 ++v57; | |
4905 v56 = v123 + 2; | |
4906 goto LABEL_45; | |
4907 } | |
4908 do | |
4909 { | |
4910 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4911 v64 = (int)((char *)v122 + v110); | |
4912 v56 += 4; | |
4913 v122 = (unsigned __int16 *)v64; | |
4914 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4915 v66 = v115; | |
4916 LOWORD(v65) = v58[v65]; | |
4917 *v57 = v115; | |
4918 *(short *)(v56 - 4) = v65; | |
4919 v57[1] = v66; | |
4920 v121 += v108; | |
4921 v120 += v103; | |
4922 v59 = v121; | |
4923 v60 = v120; | |
4924 v57 += 2; | |
4925 LABEL_45: | |
4926 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4927 v68 = (int)((char *)v122 + v110); | |
4928 v69 = v105[v67]; | |
4929 v122 = (unsigned __int16 *)v68; | |
4930 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4931 v70 = v108; | |
4932 *(short *)(v56 - 2) = v69; | |
4933 v121 += v70; | |
4934 v120 += v103; | |
4935 v59 = v121; | |
4936 v60 = v120; | |
4937 } | |
4938 while ( v56 < v118 ); | |
4939 v123 = v56; | |
4940 v119 = v57; | |
4941 } | |
4942 } | |
4943 } | |
4944 v114 += 13; | |
4945 v110 = v100; | |
4946 a1 += 16; | |
4947 v4 = v96; | |
4948 v121 = v116; | |
4949 v120 = v90; | |
4950 if ( v123 >= v117 ) | |
4951 break; | |
4952 v24 = (char *)v114; | |
4953 v22 = stru_5C6E00; | |
4954 } | |
4955 } | |
4956 ++a2; | |
4957 v98 += v95; | |
4958 result = a2; | |
4959 v101 += 2; | |
4960 v99 += 640; | |
4961 if ( a2 > stru_F8A590._viewport_space_w ) | |
4962 break; | |
4963 v12 = v101; | |
4964 result = a2; | |
4965 v11 = v98; | |
4966 } | |
4967 } | |
4968 } | |
4969 } | |
4970 } | |
4971 } | |
4972 } | |
4973 } | |
4974 return result; | |
4975 } | |
4976 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4977 | |
4978 //----- (004ADD1D) -------------------------------------------------------- | |
4979 void __fastcall sub_4ADD1D(int uFaceID) | |
4980 { | |
4981 int v1; // edi@1 | |
4982 BLVFace *v2; // esi@3 | |
4983 signed int v3; // ebx@4 | |
4984 Texture *v4; // edi@9 | |
4985 signed int v5; // eax@9 | |
4986 char *v6; // edi@12 | |
4987 signed int v7; // eax@15 | |
4988 unsigned int v8; // eax@16 | |
4989 __int16 v9; // cx@19 | |
4990 unsigned __int8 *v10; // eax@19 | |
4991 unsigned __int16 *v11; // eax@19 | |
4992 int v12; // edi@19 | |
4993 int v13; // ebx@20 | |
4994 stru352 *v14; // esi@20 | |
4995 DWORD v15; // eax@22 | |
4996 signed int v16; // ecx@22 | |
4997 signed int v17; // ST68_4@22 | |
4998 int v18; // eax@22 | |
4999 int v19; // ecx@22 | |
5000 unsigned int v20; // esi@23 | |
5001 int v21; // edi@23 | |
5002 int v22; // eax@23 | |
5003 int *v23; // ebx@24 | |
5004 int v24; // edx@24 | |
5005 int v25; // ebx@25 | |
5006 unsigned __int16 v26; // cx@25 | |
5007 int v27; // edx@26 | |
5008 unsigned __int16 v28; // cx@26 | |
5009 unsigned __int8 v29; // sf@27 | |
5010 unsigned __int8 v30; // of@27 | |
5011 unsigned int v31; // esi@29 | |
5012 int v32; // edi@29 | |
5013 unsigned __int16 *v33; // eax@29 | |
5014 int *v34; // ebx@30 | |
5015 int v35; // edx@30 | |
5016 int v36; // ebx@31 | |
5017 unsigned __int16 v37; // cx@31 | |
5018 int v38; // edx@32 | |
5019 unsigned __int16 v39; // cx@32 | |
5020 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5021 int v41; // [sp-Ch] [bp-68h]@15 | |
5022 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5023 signed int v43; // [sp+14h] [bp-48h]@12 | |
5024 signed int v44; // [sp+14h] [bp-48h]@22 | |
5025 int v45; // [sp+1Ch] [bp-40h]@22 | |
5026 int v46; // [sp+20h] [bp-3Ch]@22 | |
5027 int v47; // [sp+24h] [bp-38h]@19 | |
5028 char v48; // [sp+28h] [bp-34h]@19 | |
5029 int v49; // [sp+2Ch] [bp-30h]@19 | |
5030 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5031 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5032 int v52; // [sp+38h] [bp-24h]@22 | |
5033 int v53; // [sp+3Ch] [bp-20h]@22 | |
5034 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5035 int v55; // [sp+40h] [bp-1Ch]@20 | |
5036 int v56; // [sp+44h] [bp-18h]@20 | |
5037 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5038 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5039 int v59; // [sp+50h] [bp-Ch]@4 | |
5040 int v60; // [sp+50h] [bp-Ch]@19 | |
5041 int v61; // [sp+54h] [bp-8h]@22 | |
5042 int *v62; // [sp+58h] [bp-4h]@23 | |
5043 int *v63; // [sp+58h] [bp-4h]@29 | |
5044 | |
5045 v1 = uFaceID; | |
5046 v42 = pRenderer->uTargetSurfacePitch; | |
5047 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5048 { | |
5049 v2 = &pIndoor->pFaces[uFaceID]; | |
5050 if ( pRenderer->pRenderD3D ) | |
5051 { | |
5052 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5053 v59 = v3; | |
5054 } | |
5055 else | |
5056 { | |
5057 v59 = sub_423B5D(uFaceID); | |
5058 v3 = v59; | |
5059 } | |
5060 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5061 { | |
5062 v4 = v2->GetTexture(); | |
5063 v5 = 0; | |
5064 if ( v4 ) | |
5065 { | |
5066 if ( pRenderer->pRenderD3D ) | |
5067 { | |
5068 if ( v3 > 0 ) | |
5069 { | |
5070 v54 = v3; | |
5071 v43 = v3; | |
5072 v6 = (char *)&array_507D30[0].v; | |
5073 do | |
5074 { | |
5075 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5076 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5077 v6 += 48; | |
5078 --v54; | |
5079 } | |
5080 while ( v54 ); | |
5081 v3 = v59; | |
5082 v5 = v43; | |
5083 } | |
5084 v7 = v5; | |
5085 v41 = stru_F8AD28.field_0; | |
5086 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5087 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5088 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5089 { | |
5090 v40 = v2->GetTexture(); | |
5091 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5092 } | |
5093 else | |
5094 { | |
5095 v40 = v2->GetTexture(); | |
5096 v8 = v2->uBitmapID; | |
5097 } | |
5098 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5099 } | |
5100 else | |
5101 { | |
5102 v49 = v4->uWidthMinus1; | |
5103 v47 = v4->uHeightMinus1 << 16; | |
5104 v9 = 16 - v4->uWidthLn2; | |
710 | 5105 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5106 LOBYTE(v2->uAttributes) |= 0x80u; |
5107 v48 = v9; | |
5108 v50 = v10; | |
5109 sub_4AF412(); | |
5110 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5111 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5112 v12 = stru_F8A590._viewport_space_y; | |
5113 v51 = v11; | |
5114 v60 = stru_F8A590._viewport_space_y; | |
5115 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5116 { | |
5117 v13 = 2 * stru_F8A590._viewport_space_y; | |
5118 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5119 v55 = 2 * stru_F8A590._viewport_space_y; | |
5120 v56 = 640 * stru_F8A590._viewport_space_y; | |
5121 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5122 { | |
5123 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5124 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5125 v15 = GetTickCount(); | |
5126 v16 = v14->field_0; | |
5127 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5128 v45 = v14->field_4 >> 3; | |
5129 v44 = v16 >> 3; | |
5130 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5131 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5132 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5133 v18 = v14->field_28; | |
5134 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5135 LOWORD(v18) = 0; | |
5136 v46 = stru_F8AD28.field_0 | v18; | |
5137 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5138 if ( LOBYTE(viewparams->field_20) ) | |
5139 { | |
5140 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5141 - pBLVRenderParams->uViewportX]; | |
5142 v31 = v44; | |
5143 v32 = v45; | |
5144 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5145 + 2 * v19 | |
5146 - pBLVRenderParams->uViewportX]; | |
5147 if ( v61 & 1 ) | |
5148 { | |
5149 --v61; | |
5150 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5151 + 2 * v19 | |
5152 - pBLVRenderParams->uViewportX | |
5153 - 2]; | |
5154 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5155 - pBLVRenderParams->uViewportX]; | |
5156 v35 = v46; | |
5157 v63 += 2; | |
5158 goto LABEL_32; | |
5159 } | |
5160 while ( 1 ) | |
5161 { | |
5162 v30 = __OFSUB__(v61, 2); | |
5163 v29 = v61 - 2 < 0; | |
5164 v61 -= 2; | |
5165 if ( v29 ^ v30 ) | |
5166 break; | |
5167 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5168 v31 += v52; | |
5169 v37 = v51[v36]; | |
5170 v32 += v53; | |
5171 v34 = v63; | |
5172 v35 = v46; | |
5173 *v33 = v37; | |
5174 v33[1] = v37; | |
5175 v33[640] = v37; | |
5176 v33[641] = v37; | |
5177 v63 += 4; | |
5178 v34[2] = v46; | |
5179 v34[3] = v46; | |
5180 v34[642] = v46; | |
5181 v34[643] = v46; | |
5182 LABEL_32: | |
5183 *v34 = v35; | |
5184 v34[1] = v35; | |
5185 v34[640] = v35; | |
5186 v34[641] = v35; | |
5187 v38 = v49 & (v31 >> 16); | |
5188 v33 += 4; | |
5189 v31 += v52; | |
5190 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5191 v32 += v53; | |
5192 *(v33 - 2) = v39; | |
5193 *(v33 - 1) = v39; | |
5194 v33[638] = v39; | |
5195 v33[639] = v39; | |
5196 } | |
5197 } | |
5198 else | |
5199 { | |
5200 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5201 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5202 v20 = v44; | |
5203 v21 = v45; | |
5204 v22 = (int)v58; | |
5205 if ( v61 & 1 ) | |
5206 { | |
5207 --v61; | |
5208 v22 = (int)(v58 - 1); | |
5209 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5210 v24 = v46; | |
5211 ++v62; | |
5212 goto LABEL_26; | |
5213 } | |
5214 while ( 1 ) | |
5215 { | |
5216 v30 = __OFSUB__(v61, 2); | |
5217 v29 = v61 - 2 < 0; | |
5218 v61 -= 2; | |
5219 if ( v29 ^ v30 ) | |
5220 break; | |
5221 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5222 v20 += v52; | |
5223 v26 = v51[v25]; | |
5224 v21 += v53; | |
5225 v23 = v62; | |
5226 v24 = v46; | |
5227 *(short *)v22 = v26; | |
5228 v62 += 2; | |
5229 v23[1] = v46; | |
5230 LABEL_26: | |
5231 *v23 = v24; | |
5232 v27 = v49 & (v20 >> 16); | |
5233 v22 += 4; | |
5234 v20 += v52; | |
5235 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5236 v21 += v53; | |
5237 *(short *)(v22 - 2) = v28; | |
5238 } | |
5239 } | |
5240 ++v60; | |
5241 ++i; | |
5242 v56 += 640; | |
5243 v55 += 2; | |
5244 if ( v60 > stru_F8A590._viewport_space_w ) | |
5245 break; | |
5246 v13 = v55; | |
5247 v12 = v60; | |
5248 } | |
5249 } | |
5250 } | |
5251 } | |
5252 } | |
5253 } | |
5254 } | |
5255 | |
5256 //----- (004AE1E7) -------------------------------------------------------- | |
5257 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5258 { | |
5259 int v3; // ebx@1 | |
5260 int v4; // edi@1 | |
5261 int v5; // esi@1 | |
5262 signed __int64 v6; // qtt@3 | |
5263 int v7; // esi@3 | |
5264 int v8; // eax@5 | |
5265 int result; // eax@5 | |
5266 int v10; // edx@5 | |
5267 int v11; // [sp+Ch] [bp-8h]@1 | |
5268 int v12; // [sp+1Ch] [bp+8h]@2 | |
5269 | |
5270 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5271 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5272 v11 = a1; | |
5273 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5274 + stru_F8AD28.field_7C | |
5275 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5276 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5277 { | |
5278 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5279 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5280 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5281 } | |
5282 else | |
5283 { | |
5284 v7 = 1073741824; | |
5285 } | |
5286 v8 = stru_F8AD28.vec_9C.z; | |
5287 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5288 + stru_F8AD28.vec_8C.x | |
5289 + v4 * stru_F8AD28.vec_8C.y) | |
5290 * (signed __int64)v7) >> 16) | |
5291 + stru_F8AD28.field_98; | |
5292 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5293 v10 = result + stru_F8AD28.field_A8; | |
5294 stru_F83B80[v11].field_28 = v7; | |
5295 stru_F83B80[v11].field_4 = v10; | |
5296 return result; | |
5297 } | |
5298 | |
5299 //----- (004AE313) -------------------------------------------------------- | |
5300 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5301 { | |
5302 int _dy; // ebx@1 | |
5303 int _dx; // edi@1 | |
5304 int v5; // ecx@1 | |
5305 int v6; // esi@1 | |
5306 int v7; // ST18_4@2 | |
5307 signed __int64 v8; // qtt@3 | |
5308 unsigned int v9; // ecx@3 | |
5309 int result; // eax@8 | |
5310 int v11; // [sp+Ch] [bp-8h]@1 | |
5311 | |
5312 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5313 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5314 ++pBLVRenderParams->field_88; | |
5315 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5316 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5317 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5318 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5319 { | |
5320 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5321 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5322 v9 = v8 / v11; | |
5323 } | |
5324 else | |
5325 { | |
5326 v9 = 0x40000000u; | |
5327 } | |
5328 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5329 p->field_0 = v9; | |
5330 else | |
5331 p->field_0 = stru_F8AD28.field_34; | |
5332 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5333 * (signed __int64)(signed int)v9) >> 16) | |
5334 + stru_F8AD28.field_98 | |
5335 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5336 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5337 * (signed __int64)(signed int)v9) >> 16) | |
5338 + stru_F8AD28.field_A8 | |
5339 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5340 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5341 if ( result < 369620 || bUseLoResSprites ) | |
5342 { | |
5343 if ( result < 184810 ) | |
5344 p->field_10 = result > 92405; | |
5345 else | |
5346 p->field_10 = 2; | |
5347 } | |
5348 else | |
5349 { | |
5350 p->field_10 = 3; | |
5351 } | |
5352 return result; | |
5353 } | |
5354 | |
5355 //----- (004AE491) -------------------------------------------------------- | |
5356 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5357 { | |
5358 signed int v2; // eax@1 | |
5359 signed int v3; // edi@1 | |
5360 int v4; // ecx@1 | |
5361 int v5; // esi@2 | |
5362 int v6; // eax@2 | |
5363 int v7; // ebx@2 | |
5364 unsigned int v8; // ecx@2 | |
5365 int v9; // edx@5 | |
5366 int v10; // edx@7 | |
5367 unsigned int v11; // eax@8 | |
5368 int v13; // [sp+4h] [bp-18h]@2 | |
5369 int v14; // [sp+8h] [bp-14h]@2 | |
5370 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5371 int v16; // [sp+14h] [bp-8h]@1 | |
5372 int v17; // [sp+18h] [bp-4h]@1 | |
5373 | |
5374 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5375 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5376 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5377 v4 = 0; | |
5378 v15 = v2; | |
5379 v16 = 0; | |
5380 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5381 { | |
5382 do | |
5383 { | |
5384 v5 = v16; | |
5385 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5386 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5387 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5388 v7 = v13; | |
5389 v8 = v14; | |
5390 if ( v6 < v13 ) | |
5391 { | |
5392 v6 = v13; | |
5393 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5394 } | |
5395 if ( v6 < v14 ) | |
5396 { | |
5397 v9 = v6; | |
5398 v6 = v14; | |
5399 v8 = v9; | |
5400 } | |
5401 if ( v7 < (signed int)v8 ) | |
5402 { | |
5403 v10 = v8; | |
5404 v8 = v7; | |
5405 v7 = v10; | |
5406 } | |
5407 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5408 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5409 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5410 ++v16; | |
5411 v2 = v15; | |
5412 } | |
5413 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5414 v4 = 0; | |
5415 } | |
5416 if ( stru_F8AD28.field_3E4 != v4 ) | |
5417 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5418 if ( v17 >= v4 ) | |
5419 { | |
5420 if ( v17 > 2031616 ) | |
5421 v17 = 2031616; | |
5422 } | |
5423 else | |
5424 { | |
5425 v17 = v4; | |
5426 } | |
5427 ++pBLVRenderParams->field_8C; | |
5428 return v17; | |
5429 } | |
5430 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5431 | |
5432 //----- (004AE5F1) -------------------------------------------------------- | |
5433 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5434 { | |
5435 BLVFace *v1; // esi@1 | |
5436 BLVFaceExtra *v2; // ebx@1 | |
5437 int v3; // eax@1 | |
5438 int v4; // edi@1 | |
5439 Texture *v5; // edi@1 | |
5440 int v6; // eax@1 | |
5441 unsigned int v7; // eax@1 | |
5442 unsigned int v8; // ecx@1 | |
5443 unsigned int v9; // eax@1 | |
5444 unsigned int v10; // ecx@5 | |
5445 int v11; // edi@10 | |
5446 int v12; // ecx@10 | |
5447 int v13; // eax@10 | |
5448 int v14; // edx@10 | |
5449 int v15; // ebx@12 | |
5450 double v16; // st7@16 | |
5451 int v17; // eax@16 | |
5452 char *v18; // ebx@17 | |
5453 int v19; // ecx@19 | |
5454 int v20; // eax@19 | |
5455 int v21; // edx@21 | |
5456 int v22; // eax@23 | |
5457 int v23; // ST04_4@26 | |
5458 int v24; // edi@26 | |
5459 double v25; // st6@26 | |
5460 int v26; // eax@26 | |
5461 double v27; // st6@26 | |
5462 int v28; // ecx@26 | |
5463 char v29; // al@26 | |
5464 int v30; // edx@28 | |
5465 int v31; // ecx@28 | |
5466 BLVLightMM7 *v32; // ecx@32 | |
5467 int v33; // edi@33 | |
5468 int v34; // edx@33 | |
5469 int v35; // eax@33 | |
5470 int v36; // edi@35 | |
5471 int v37; // edx@37 | |
5472 int v38; // ebx@39 | |
5473 int v39; // edi@42 | |
5474 int v40; // eax@42 | |
5475 char *v41; // ebx@45 | |
5476 signed int v42; // ecx@47 | |
5477 int v43; // edi@47 | |
5478 int v44; // eax@49 | |
5479 int v45; // edx@51 | |
5480 int v46; // eax@53 | |
5481 int v47; // ST04_4@55 | |
5482 int v48; // edi@55 | |
5483 double v49; // st6@55 | |
5484 int v50; // eax@55 | |
5485 double v51; // st6@55 | |
5486 int v52; // eax@55 | |
5487 int v53; // ecx@57 | |
5488 int v54; // ecx@58 | |
5489 int v55; // ecx@59 | |
5490 int v56; // edx@62 | |
5491 int v57; // ecx@62 | |
5492 int v58; // eax@63 | |
5493 int v59; // edx@64 | |
5494 int v60; // ecx@67 | |
5495 int v61; // edx@67 | |
5496 int v62; // eax@68 | |
5497 int v63; // edx@69 | |
5498 signed int v64; // ecx@72 | |
5499 double v65; // st7@75 | |
5500 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5501 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5502 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5503 int v69; // [sp+28h] [bp-18h]@10 | |
5504 int v70; // [sp+2Ch] [bp-14h]@10 | |
5505 int X; // [sp+30h] [bp-10h]@10 | |
5506 int v72; // [sp+34h] [bp-Ch]@10 | |
5507 int v73; // [sp+38h] [bp-8h]@10 | |
5508 int v74; // [sp+3Ch] [bp-4h]@10 | |
5509 | |
5510 v1 = &pIndoor->pFaces[uFaceID]; | |
5511 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5512 v3 = v1->uBitmapID; | |
5513 v4 = v1->uBitmapID; | |
5514 v68 = v2; | |
5515 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5516 v6 = 8 * uFaceID; | |
5517 LOBYTE(v6) = 8 * uFaceID | 6; | |
5518 stru_F8AD28.field_0 = v6; | |
5519 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5520 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5521 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5522 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5523 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5524 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5525 v7 = GetTickCount(); | |
5526 v8 = v1->uAttributes; | |
5527 v9 = v7 >> 3; | |
5528 if ( v8 & 4 ) | |
5529 { | |
5530 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5531 } | |
5532 else | |
5533 { | |
5534 if ( v8 & 0x20 ) | |
5535 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5536 } | |
5537 v10 = v1->uAttributes; | |
5538 if ( BYTE1(v10) & 8 ) | |
5539 { | |
5540 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5541 } | |
5542 else | |
5543 { | |
5544 if ( v10 & 0x40 ) | |
5545 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5546 } | |
5547 v1->_get_normals(&v67, &v66); | |
5548 stru_F8AD28.vec_14.x = v67.x; | |
5549 stru_F8AD28.vec_14.y = v67.y; | |
5550 stru_F8AD28.vec_14.z = v67.z; | |
5551 stru_F8AD28.vec_20.x = v66.x; | |
5552 stru_F8AD28.vec_20.y = v66.y; | |
5553 stru_F8AD28.vec_20.z = v66.z; | |
5554 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5555 if ( pBLVRenderParams->sPartyRotX ) | |
5556 { | |
5557 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5558 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5559 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5560 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5561 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5562 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5563 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5564 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5565 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5566 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5567 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5568 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5569 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5570 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5571 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5572 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5573 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5574 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5575 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5576 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5577 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5578 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5579 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5580 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5581 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5582 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5583 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5584 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5585 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5586 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5587 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5588 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5589 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5590 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5591 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5592 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5593 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5594 v13 = pBLVRenderParams->vPartyPos.y; | |
5595 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5596 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5597 v14 = pBLVRenderParams->vPartyPos.x; | |
5598 } | |
5599 else | |
5600 { | |
5601 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5602 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5603 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5604 - v70; | |
5605 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5606 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5607 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5608 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5609 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5610 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5611 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5612 - v70; | |
5613 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5614 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5615 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5616 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5617 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5618 - v70; | |
5619 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5620 v14 = pBLVRenderParams->vPartyPos.x; | |
5621 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5622 v13 = pBLVRenderParams->vPartyPos.y; | |
5623 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5624 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5625 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5626 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5627 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5628 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5629 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5630 } | |
5631 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5632 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5633 + stru_F8AD28.plane_4.dist | |
5634 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5635 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5636 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5637 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5638 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5639 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5640 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5641 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5642 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5643 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5644 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5645 v15 = v70; | |
5646 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5647 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5648 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5649 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5650 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5651 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5652 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5653 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5654 stru_F8AD28.field_38 = 0; | |
5655 stru_F8AD28.field_A8 = -(X | |
5656 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5657 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5658 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5659 { | |
5660 stru_F8AD28.field_3E4 = 1; | |
5661 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5662 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5663 stru_F8AD28.field_3F0 = v68->field_1E; | |
5664 stru_F8AD28.field_3F4 = v68->field_20; | |
5665 } | |
5666 else | |
5667 { | |
5668 stru_F8AD28.field_3E4 = 0; | |
5669 } | |
5670 v16 = 0.0039215689; | |
5671 v17 = 116 * v1->uSectorID; | |
5672 v69 = v17; | |
5673 v74 = 0; | |
5674 v73 = 0; | |
5675 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5676 v70 = pMobileLightsStack->uNumLightsActive; | |
5677 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5678 { | |
5679 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5680 do | |
5681 { | |
5682 if ( v74 >= 20 ) | |
5683 break; | |
5684 v19 = *((short *)v18 + 2); | |
5685 v20 = *((short *)v18 - 1); | |
5686 if ( v20 > v1->pBounding.x1 - v19 ) | |
5687 { | |
5688 if ( v20 < v19 + v1->pBounding.x2 ) | |
5689 { | |
5690 v21 = *(short *)v18; | |
5691 if ( v21 > v1->pBounding.y1 - v19 ) | |
5692 { | |
5693 if ( v21 < v19 + v1->pBounding.y2 ) | |
5694 { | |
5695 v22 = *((short *)v18 + 1); | |
5696 if ( v22 > v1->pBounding.z1 - v19 ) | |
5697 { | |
5698 if ( v22 < v19 + v1->pBounding.z2 ) | |
5699 { | |
5700 X = (v1->pFacePlane_old.dist | |
5701 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5702 + v21 * v1->pFacePlane_old.vNormal.y | |
5703 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5704 if ( X <= v19 ) | |
5705 { | |
5706 v23 = X; | |
5707 v24 = v74; | |
5708 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5709 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5710 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5711 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5712 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5713 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5714 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5715 v25 = (double)(signed int)v68 * v16; | |
5716 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5717 v26 = (unsigned __int8)v18[8]; | |
5718 *(float *)(v24 * 4 + 16297992) = v25; | |
5719 v27 = (double)(signed int)v68; | |
5720 v68 = (BLVFaceExtra *)v26; | |
5721 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5722 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5723 v16 = 0.0039215689; | |
5724 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5725 v28 = v74; | |
5726 v29 = v18[9]; | |
5727 ++v74; | |
5728 stru_F8AD28._blv_lights_types[v28] = v29; | |
5729 } | |
5730 } | |
5731 } | |
5732 } | |
5733 } | |
5734 } | |
5735 } | |
5736 ++v73; | |
5737 v18 += 18; | |
5738 v17 = v69; | |
5739 } | |
5740 while ( v73 < v70 ); | |
5741 } | |
5742 v30 = 0; | |
5743 v73 = 0; | |
5744 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5745 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5746 if ( v31 > 0 ) | |
5747 { | |
5748 while ( v74 < 20 ) | |
5749 { | |
5750 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5751 if ( !(v32->uAtributes & 8) ) | |
5752 { | |
5753 v33 = v1->pBounding.x1; | |
5754 v34 = v32->vPosition.x; | |
5755 X = v32->uBrightness; | |
5756 v35 = v32->uRadius; | |
5757 v68 = (BLVFaceExtra *)v32->uRadius; | |
5758 if ( v34 > v33 - v35 ) | |
5759 { | |
5760 if ( v34 < v35 + v1->pBounding.x2 ) | |
5761 { | |
5762 v36 = v32->vPosition.y; | |
5763 if ( v36 > v1->pBounding.y1 - v35 ) | |
5764 { | |
5765 if ( v36 < v35 + v1->pBounding.y2 ) | |
5766 { | |
5767 v37 = v32->vPosition.z; | |
5768 if ( v37 > v1->pBounding.z1 - v35 ) | |
5769 { | |
5770 if ( v37 < v35 + v1->pBounding.z2 ) | |
5771 { | |
5772 v38 = (v1->pFacePlane_old.dist | |
5773 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5774 + v37 * v1->pFacePlane_old.vNormal.z | |
5775 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5776 if ( v38 >= 0 ) | |
5777 { | |
5778 if ( v38 <= v35 && v35 ) | |
5779 { | |
5780 v39 = v74; | |
5781 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5782 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5783 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5784 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5785 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5786 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5787 v68 = (BLVFaceExtra *)v32->uRed; | |
5788 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5789 v68 = (BLVFaceExtra *)v32->uGreen; | |
5790 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5791 v68 = (BLVFaceExtra *)v32->uBlue; | |
5792 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5793 v16 = 0.0039215689; | |
5794 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5795 v40 = v74++; | |
5796 stru_F8AD28._blv_lights_types[v40] = 1; | |
5797 } | |
5798 } | |
5799 } | |
5800 } | |
5801 } | |
5802 } | |
5803 } | |
5804 } | |
5805 } | |
5806 v30 = v73++ + 1; | |
5807 if ( v73 >= v70 ) | |
5808 break; | |
5809 v17 = v69; | |
5810 } | |
5811 } | |
5812 v73 = 0; | |
5813 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5814 { | |
5815 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5816 do | |
5817 { | |
5818 if ( v74 >= 20 ) | |
5819 break; | |
5820 v42 = *((short *)v41 + 2); | |
5821 v43 = *((short *)v41 - 1); | |
5822 if ( v43 > v1->pBounding.x1 - v42 ) | |
5823 { | |
5824 if ( v43 < v42 + v1->pBounding.x2 ) | |
5825 { | |
5826 v44 = *(short *)v41; | |
5827 if ( v44 > v1->pBounding.y1 - v42 ) | |
5828 { | |
5829 if ( v44 < v42 + v1->pBounding.y2 ) | |
5830 { | |
5831 v45 = *((short *)v41 + 1); | |
5832 if ( v45 > v1->pBounding.z1 - v42 ) | |
5833 { | |
5834 if ( v45 < v42 + v1->pBounding.z2 ) | |
5835 { | |
5836 v46 = (v1->pFacePlane_old.dist | |
5837 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5838 + v43 * v1->pFacePlane_old.vNormal.x | |
5839 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5840 v69 = v46; | |
5841 if ( v46 >= 0 ) | |
5842 { | |
5843 if ( v46 <= v42 ) | |
5844 { | |
5845 v47 = v69; | |
5846 v48 = v74; | |
5847 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5848 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5849 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5850 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5851 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5852 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5853 v49 = (double)(signed int)v68 * v16; | |
5854 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5855 v50 = (unsigned __int8)v41[8]; | |
5856 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5857 v51 = (double)(signed int)v68; | |
5858 v68 = (BLVFaceExtra *)v50; | |
5859 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5860 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5861 v16 = 0.0039215689; | |
5862 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5863 v52 = v74++; | |
5864 stru_F8AD28._blv_lights_types[v52] = 1; | |
5865 } | |
5866 } | |
5867 } | |
5868 } | |
5869 } | |
5870 } | |
5871 } | |
5872 } | |
5873 ++v73; | |
5874 v41 += 12; | |
5875 } | |
5876 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5877 } | |
5878 stru_F8AD28.uNumLightsApplied = v74; | |
5879 v53 = v1->pBounding.x2; | |
5880 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5881 { | |
5882 v55 = v1->pBounding.x1; | |
5883 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5884 v54 = 0; | |
5885 else | |
5886 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5887 } | |
5888 else | |
5889 { | |
5890 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5891 } | |
5892 v56 = v1->pBounding.y2; | |
5893 v57 = v54 * v54; | |
5894 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5895 { | |
5896 v59 = v1->pBounding.y1; | |
5897 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5898 v58 = 0; | |
5899 else | |
5900 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5901 } | |
5902 else | |
5903 { | |
5904 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5905 } | |
5906 v60 = v58 * v58 + v57; | |
5907 v61 = v1->pBounding.z2; | |
5908 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5909 { | |
5910 v63 = v1->pBounding.z1; | |
5911 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5912 v62 = 0; | |
5913 else | |
5914 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5915 } | |
5916 else | |
5917 { | |
5918 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5919 } | |
5920 v64 = v62 * v62 + v60; | |
5921 if ( v64 ) | |
295 | 5922 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5923 else |
5924 stru_F8AD28.field_34 = 0; | |
5925 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5926 v65 = (double)(signed int)v68; | |
5927 if ( v65 >= 655.36 ) | |
5928 { | |
5929 if ( v65 >= 26214.4 ) | |
5930 { | |
5931 if ( v65 >= 45875.2 ) | |
5932 { | |
5933 stru_F8AD28.field_44 = 8; | |
5934 stru_F8AD28.field_48 = 3; | |
5935 } | |
5936 else | |
5937 { | |
5938 stru_F8AD28.field_44 = 16; | |
5939 stru_F8AD28.field_48 = 4; | |
5940 } | |
5941 } | |
5942 else | |
5943 { | |
5944 stru_F8AD28.field_44 = 32; | |
5945 stru_F8AD28.field_48 = 5; | |
5946 } | |
5947 } | |
5948 else | |
5949 { | |
5950 stru_F8AD28.field_44 = 64; | |
5951 stru_F8AD28.field_48 = 6; | |
5952 } | |
5953 } | |
5954 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5955 | |
5956 //----- (004AF412) -------------------------------------------------------- | |
5957 int __cdecl sub_4AF412() | |
5958 { | |
5959 int v0; // ST20_4@2 | |
5960 int v1; // ST20_4@2 | |
5961 int v2; // ST20_4@2 | |
5962 int v3; // esi@2 | |
5963 int v4; // ST20_4@2 | |
5964 int v5; // ecx@2 | |
5965 int v6; // ebx@2 | |
5966 int v7; // edi@2 | |
5967 int v8; // edx@2 | |
5968 int v9; // eax@2 | |
5969 int result; // eax@4 | |
5970 | |
5971 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5972 stru_F8AD28.vec_20.y = -65536; | |
5973 stru_F8AD28.plane_4.vNormal.x = 0; | |
5974 stru_F8AD28.plane_4.vNormal.y = 0; | |
5975 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5976 stru_F8AD28.vec_14.x = 65536; | |
5977 stru_F8AD28.vec_14.y = 0; | |
5978 stru_F8AD28.vec_14.z = 0; | |
5979 stru_F8AD28.vec_20.x = 0; | |
5980 stru_F8AD28.vec_20.z = 0; | |
5981 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5982 if ( pBLVRenderParams->sPartyRotX ) | |
5983 { | |
5984 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5985 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5986 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5987 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5988 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5989 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5990 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5991 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5992 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5993 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5994 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5995 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5996 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5997 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5998 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5999 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6000 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6001 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6002 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6003 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6004 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6005 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6006 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6007 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6008 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6009 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6010 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6011 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6012 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6013 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6014 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6015 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6016 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6017 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6018 v6 = pBLVRenderParams->vPartyPos.z; | |
6019 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6020 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6021 v8 = pBLVRenderParams->vPartyPos.y; | |
6022 v9 = pBLVRenderParams->vPartyPos.x; | |
6023 } | |
6024 else | |
6025 { | |
6026 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6027 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6028 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6029 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6030 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6031 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6032 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6033 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6034 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6035 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6036 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6037 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6038 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6039 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6040 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6041 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6042 v8 = pBLVRenderParams->vPartyPos.y; | |
6043 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6044 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6045 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6046 v9 = pBLVRenderParams->vPartyPos.x; | |
6047 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6048 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6049 v6 = pBLVRenderParams->vPartyPos.z; | |
6050 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6051 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6052 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6053 } | |
6054 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6055 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6056 + stru_F8AD28.plane_4.dist | |
6057 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6058 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6059 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6060 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6061 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6062 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6063 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6064 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6065 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6066 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6067 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6068 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6069 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6070 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6071 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6072 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6073 result = 0; | |
6074 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6075 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6076 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6077 stru_F8AD28.field_38 = 0; | |
6078 stru_F8AD28.field_3E4 = 0; | |
6079 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6080 stru_F8AD28.uNumLightsApplied = 0; | |
6081 stru_F8AD28.field_34 = 0; | |
6082 return result; | |
6083 } | |
6084 | |
6085 //----- (004B1447) -------------------------------------------------------- | |
6086 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6087 { | |
6088 signed int v3; // esi@1 | |
6089 char v4; // sf@8 | |
6090 int v5; // eax@8 | |
6091 unsigned __int64 v6; // qax@12 | |
6092 DDM_DLV_Header *v7; // eax@14 | |
6093 Player **v8; // edi@18 | |
6094 Player *result; // eax@19 | |
735 | 6095 //char *v10; // esi@20 |
0 | 6096 |
6097 v3 = 0; | |
6098 if ( a2 ) | |
6099 { | |
6100 if ( a2 != 1 ) | |
6101 { | |
6102 if ( a2 == 2 ) | |
6103 v3 = 2; | |
6104 goto LABEL_13; | |
6105 } | |
6106 v3 = 2; | |
6107 } | |
6108 else | |
6109 { | |
6110 v3 = 1; | |
6111 } | |
6112 if ( pParty->uFine < 4000000 ) | |
6113 { | |
6114 v4 = a3 + pParty->uFine < 0; | |
6115 v5 = a3 + pParty->uFine; | |
6116 pParty->uFine += a3; | |
6117 if ( v4 ) | |
6118 { | |
6119 v5 = 0; | |
6120 pParty->uFine = 0; | |
6121 } | |
6122 if ( v5 > 4000000 ) | |
6123 pParty->uFine = 4000000; | |
6124 } | |
487 | 6125 |
6126 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6127 | |
0 | 6128 LABEL_13: |
463 | 6129 pParty->InTheShopFlags[a1] = 1; |
0 | 6130 if ( v3 ) |
6131 { | |
6132 v7 = &pOutdoor->ddm; | |
6133 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6134 v7 = &pIndoor->dlv; | |
6135 v7->uReputation += v3; | |
6136 if ( v7->uReputation > 10000 ) | |
6137 v7->uReputation = 10000; | |
6138 } | |
6139 v8 = &pPlayers[1]; | |
6140 do | |
6141 { | |
6142 result = *v8; | |
6143 if ( pParty->uFine ) | |
6144 { | |
735 | 6145 //v10 = result->_guilds_member_bits; |
484 | 6146 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6147 if ( !(short)result ) |
735 | 6148 __debugbreak(); |
501 | 6149 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6150 } |
6151 ++v8; | |
6152 } | |
6153 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6154 return result; | |
6155 } | |
6156 | |
6157 //----- (004B1523) -------------------------------------------------------- | |
762 | 6158 void __thiscall sub_4B1523(int *_this) |
0 | 6159 { |
6160 int v1; // esi@1 | |
6161 int v2; // edx@1 | |
6162 unsigned int v3; // eax@2 | |
6163 int v4; // eax@4 | |
6164 LONG v5; // ecx@4 | |
6165 int v6; // eax@10 | |
6166 char *v7; // ST44_4@12 | |
6167 unsigned __int16 v8; // ax@12 | |
6168 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6169 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6170 POINT a2; // [sp+64h] [bp-10h]@1 | |
6171 int v13; // [sp+6Ch] [bp-8h]@4 | |
6172 int v14; // [sp+70h] [bp-4h]@4 | |
6173 | |
6174 v1 = *_this - 399; | |
6175 v2 = (*_this - 400) % 11 + 1; | |
6176 v11 = 4 * (*_this - 400) / 11; | |
6177 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6178 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6179 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6180 else | |
6181 v3 = 30; | |
6182 a1.Hint = 0; | |
6183 a1.uFrameY = v3; | |
6184 a1.uFrameWidth = 328; | |
6185 a1.uFrameHeight = 68; | |
6186 a1.uFrameX = 90; | |
6187 a1.uFrameZ = 417; | |
6188 a1.uFrameW = v3 + 67; | |
6189 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6190 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6191 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6192 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6193 v5 = a2.y; | |
6194 if ( v14 > a2.y ) | |
6195 v5 = v14; | |
6196 if ( v13 > v5 ) | |
6197 v5 = v13; | |
6198 if ( v4 > v5 ) | |
6199 v5 = v4; | |
262 | 6200 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", |
6201 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6202 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6203 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6204 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6205 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6206 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6207 a1.uFrameHeight += v6; | |
6208 if ( (signed int)a1.uFrameHeight < 150 ) | |
6209 a1.uFrameHeight = 150; | |
6210 a1.uFrameWidth = 460; | |
6211 a1.DrawMessageBox(0); | |
6212 a1.uFrameWidth -= 12; | |
6213 a1.uFrameHeight -= 12; | |
6214 v7 = pSpellStats->pInfos[v1].pName; | |
6215 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6216 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
6217 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
6218 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); | |
6219 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6220 a1.uFrameZ = a1.uFrameX + 107; | |
6221 a1.uFrameWidth = 108; | |
6222 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6223 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6224 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6225 } |
6226 | |
6227 //----- (004B1784) -------------------------------------------------------- | |
6228 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6229 { | |
6230 Player *pPlayer; // ebx@1 | |
6231 bool result; // eax@2 | |
6232 unsigned __int16 v2; // ST0C_2@3 | |
6233 int v3; // eax@3 | |
6234 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6235 | |
6236 pPlayer = pPlayers[uActiveCharacter]; | |
6237 if ( pPlayer->CanAct() ) | |
6238 { | |
6239 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6240 result = 1; | |
6241 } | |
6242 else | |
6243 { | |
6244 pDialogueWindow->pNumPresenceButton = 0; | |
6245 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6246 v4.uFrameX = 483; | |
6247 v4.uFrameWidth = 148; | |
6248 v4.uFrameZ = 334; | |
6249 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6250 // "%s is in no condition to %s" | |
6251 // "do anything" | |
758 | 6252 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu); |
0 | 6253 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6254 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6255 result = 0; | |
6256 } | |
6257 return result; | |
6258 } | |
6259 // F8B1E0: using guessed type int dword_F8B1E0; | |
6260 | |
463 | 6261 //view item details in shop? |
0 | 6262 //----- (004B1A2D) -------------------------------------------------------- |
6263 void __cdecl sub_4B1A2D() | |
6264 { | |
358 | 6265 //Player *v0; // edi@1 |
0 | 6266 POINT *v1; // esi@5 |
6267 unsigned int v2; // eax@5 | |
6268 int v3; // ecx@5 | |
6269 POINT *v4; // esi@12 | |
6270 int v5; // eax@12 | |
6271 unsigned int v6; // eax@13 | |
6272 ItemGen *v7; // ecx@13 | |
6273 signed int v8; // esi@17 | |
6274 unsigned int v9; // eax@19 | |
475 | 6275 POINT v10; // [sp+8h] [bp-44h]@12 |
6276 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6277 POINT v12; // [sp+18h] [bp-34h]@18 | |
6278 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6279 POINT v14; // [sp+28h] [bp-24h]@17 | |
6280 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6281 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6282 POINT a2; // [sp+40h] [bp-Ch]@5 |
6283 int v18; // [sp+48h] [bp-4h]@5 | |
6284 | |
358 | 6285 //v0 = pPlayers[uActiveCharacter]; |
484 | 6286 if ( in_current_building_type <= 0 ) |
0 | 6287 return; |
484 | 6288 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6289 { |
749 | 6290 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6291 { | |
6292 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6293 return; |
749 | 6294 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6295 { |
475 | 6296 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
6297 v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); | |
6298 if ( pMouse->GetCursorPos(&v13)->x <= 13 | |
6299 || pMouse->GetCursorPos(&v12)->x >= 462 | |
358 | 6300 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) |
0 | 6301 return; |
358 | 6302 v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; |
0 | 6303 LABEL_15: |
6304 GameUI_DrawItemInfo(v7); | |
6305 return; | |
6306 } | |
749 | 6307 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6308 return; |
6309 } | |
475 | 6310 v4 = pMouse->GetCursorPos(&v11); |
6311 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6312 v18 = v5; |
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) |
439 | 6318 // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; |
470 | 6319 v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; |
0 | 6320 goto LABEL_15; |
6321 } | |
749 | 6322 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_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; |
6327 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; | |
6328 if ( v18 ) | |
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; |
0 | 6402 LABEL_28: |
735 | 6403 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6404 return; |
6405 } | |
336 | 6406 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6407 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6408 { |
6409 if ( pParty->uNumGold <= 0x2710 ) | |
6410 { | |
6411 if ( !dword_F8B1E4 ) | |
6412 return; | |
6413 v0 = 4; | |
6414 goto LABEL_28; | |
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]); | |
6433 goto LABEL_16; | |
6434 } | |
6435 } | |
6436 } | |
6437 else | |
6438 { | |
6439 if ( !qword_A750D8 ) | |
6440 { | |
6441 v2 = 0; | |
6442 v3 = 1; | |
6443 do | |
6444 { | |
6445 if ( pPlayers[v3]->CanAct() ) | |
6446 v7[v2++] = v3; | |
6447 ++v3; | |
6448 } | |
6449 while ( v3 <= 4 ); | |
6450 if ( v2 ) | |
6451 { | |
6452 qword_A750D8 = 256i64; | |
6453 word_A750E0 = 80; | |
6454 v4 = LOWORD(v7[rand() % v2]); | |
6455 LABEL_16: | |
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; | |
6484 ptr_F8B1E8 = (char *)pNPCTopics[667].pText; | |
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 { | |
651 | 6511 ptr_F8B1E8 = (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: | |
6599 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); | |
6600 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, 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 { | |
6650 ptr_F8B1E8 = 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; |
0 | 6678 ptr_F8B1E8 = 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; |
0 | 6681 ptr_F8B1E8 = v18; |
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; |
459 | 6798 ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6799 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, 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: | |
7166 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27); | |
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; | |
7308 a1.uFrameWidth = 460; | |
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); | |
7336 v17 = v16->uControlParam; | |
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]); | |
7377 ptr_F8B1E8 = pTmpBuf2; | |
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 { | |
7393 v16->uControlParam = 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 { | |
7413 v16->uControlParam = 0; | |
7414 v15 = ""; | |
7415 } | |
7416 if ( uDialogueType != 84 ) | |
7417 goto LABEL_49; | |
484 | 7418 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
0 | 7419 sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); |
7420 ptr_F8B1E8 = pTmpBuf2; | |
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 } | |
7507 if ( ptr_F8B1E8 ) | |
7508 { | |
7509 w.uFrameWidth = 458; | |
7510 w.uFrameZ = 457; | |
7511 v47 = pFontArrus; | |
7512 v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
7513 if ( 352 - v48 < 8 ) | |
7514 { | |
7515 v47 = pFontCreate; | |
7516 v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; | |
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); | |
7524 v49 = FitTextInAWindow(ptr_F8B1E8, 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 { |
473 | 7532 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, 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 { |
165 | 7793 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7794 v1 = 1; |
7795 } | |
165 | 7796 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 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 |
492 | 7804 ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; |
7805 ContractSelectText(pEventCode); | |
0 | 7806 pDialogueWindow->Release(); |
492 | 7807 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
459 | 7808 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], |
526 | 7809 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7810 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
459 | 7811 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 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; | |
7825 ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; | |
7826 _4B254D_SkillMasteryTeacher(a4); | |
7827 pDialogueWindow->Release(); | |
7828 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7829 v2 = ""; | |
492 | 7830 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
0 | 7831 pGlobalTXT_LocalizationStrings[34], |
526 | 7832 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7833 0); |
7834 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
484 | 7835 if ( contract_approved ) |
0 | 7836 v2 = pGlobalTXT_LocalizationStrings[535]; |
7837 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 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); | |
607 | 7854 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, |
7855 pGlobalTXT_LocalizationStrings[34], //"Cancel" | |
526 | 7856 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), |
0 | 7857 0); |
7858 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | |
291 | 7859 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7860 { |
607 | 7861 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, |
7862 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" | |
0 | 7863 v0 = 1; |
7864 } | |
607 | 7865 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, |
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); | |
423 | 7891 sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
7892 pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu, | |
0 | 7893 pGlobalTXT_LocalizationStrings[34],// "Cancel" |
425 | 7894 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0); |
423 | 7895 pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u, 75u, 33u, 1, 0, 0xBFu, 1u, 0x59u, |
7896 sHouseName, | |
7897 (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); | |
424 | 7898 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, 0xBFu, 1u, 0x20u, sHouseName, 0); |
423 | 7899 pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 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); | |
423 | 7914 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, |
0 | 7915 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
526 | 7916 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
0 | 7917 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 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; |
0 | 7927 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 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 ) |
423 | 7935 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x13u, 0, "", 0); |
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 ) |
423 | 7944 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x14u, 0, "", 0); |
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 ) |
423 | 7953 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, 0xAFu, 0x15u, 0, "", 0); |
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 ) |
423 | 7963 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u, 0, "", 0); |
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 ) |
423 | 7972 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x17u, 0, "", 0); |
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 ) |
423 | 7981 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "", 0); |
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; | |
8226 ptr_F8B1E8 = 0; | |
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) -------------------------------------------------------- | |
8239 bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx) | |
8240 { | |
8241 int v2; // edx@1 | |
8242 unsigned int v3; // esi@1 | |
8243 unsigned int v4; // eax@1 | |
8244 signed int v5; // edi@1 | |
8245 int v6; // edx@8 | |
8246 int v7; // edx@9 | |
8247 int v8; // edx@10 | |
8248 unsigned __int8 v9; // zf@16 | |
8249 char v10; // sf@16 | |
8250 unsigned __int8 v11; // of@16 | |
702 | 8251 bool test; |
0 | 8252 |
8253 auto a2 = _2da_idx; | |
8254 //v2 = p2DEvents_minus1___00[26 * a2]; | |
8255 v2 = p2DEvents[a2 - 1].uType; | |
8256 v3 = a1->uItemID; | |
8257 v4 = a1->uItemID; | |
8258 v5 = pItemsTable->pItems[v4].uEquipType; | |
8259 if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771) | |
315 | 8260 && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen()) |
0 | 8261 return 0; |
702 | 8262 switch( p2DEvents[a2 - 1].uType ) |
8263 { | |
8264 case BildingType_WeaponShop: | |
8265 { | |
8266 test = v5 <= 2; | |
8267 break; | |
8268 } | |
8269 case BildingType_ArmorShop: | |
8270 { | |
8271 test = v5 >= 3; | |
8272 break; | |
8273 } | |
8274 case BildingType_MagicShop: | |
8275 { | |
8276 test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16; | |
8277 break; | |
8278 } | |
8279 case BildingType_AlchemistShop: | |
8280 { | |
8281 __debugbreak(); // need to test | |
8282 test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771); | |
8283 break; | |
8284 } | |
8285 default: | |
8286 { | |
8287 test = 0; | |
8288 break; | |
8289 } | |
8290 } | |
8291 | |
8292 return test; | |
8293 /* | |
8294 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8295 { |
8296 v11 = __OFSUB__(v5, 2); | |
8297 v9 = v5 == 2; | |
8298 v10 = v5 - 2 < 0; | |
8299 goto LABEL_23; | |
8300 } | |
702 | 8301 if ( p2DEvents[a2 - 1].uType > 2 ) |
8302 { | |
8303 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8304 { |
8305 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8306 return v5 == 16; | |
8307 return 1; | |
8308 } | |
702 | 8309 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8310 return 0; |
702 | 8311 if ( p2DEvents[a2 - 1].uType == 4) |
8312 { | |
8313 if ( v5 < 13 ) | |
8314 return 0; | |
8315 if ( v5 <= 14 ) | |
8316 return 1; | |
8317 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8318 return 0; | |
8319 v11 = __OFSUB__(v3, 771); | |
8320 v9 = v3 == 771; | |
8321 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8322 LABEL_23: |
702 | 8323 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8324 return 0; | |
8325 return 1; | |
8326 } | |
8327 } | |
8328 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8329 { | |
8330 if ( v5 >= 3 ) | |
8331 { | |
8332 v11 = __OFSUB__(v5, 9); | |
8333 v9 = v5 == 9; | |
8334 v10 = v5 - 9 < 0; | |
8335 goto LABEL_23; | |
8336 } | |
0 | 8337 } |
8338 return 0; | |
702 | 8339 */ |
0 | 8340 } |
8341 | |
8342 //----- (004B6478) -------------------------------------------------------- | |
711 | 8343 void sub_4B6478() |
8344 { | |
0 | 8345 GUIWindow *v0; // ebx@1 |
8346 Player *v1; // edi@1 | |
8347 unsigned int v2; // eax@1 | |
8348 signed int v3; // esi@1 | |
8349 int v4; // ebx@1 | |
8350 unsigned int v5; // esi@5 | |
8351 int v6; // edi@6 | |
8352 int result; // eax@13 | |
8353 GUIWindow *v8; // ebx@17 | |
8354 int v9; // eax@17 | |
8355 int v10; // ecx@17 | |
8356 unsigned int v11; // ecx@18 | |
8357 int v12; // eax@20 | |
8358 int v13; // eax@21 | |
8359 GUIButton *v14; // esi@27 | |
8360 int v15; // ecx@27 | |
8361 unsigned int v16; // eax@28 | |
8362 const char *v17; // ebx@29 | |
8363 int v18; // eax@29 | |
8364 unsigned int v19; // ecx@29 | |
8365 int v20; // eax@29 | |
8366 unsigned __int16 v21; // ax@29 | |
8367 unsigned __int16 v22; // ST14_2@36 | |
8368 int v23; // eax@36 | |
8369 const char *v24; // ST18_4@37 | |
8370 unsigned __int16 v25; // ST14_2@37 | |
8371 int v26; // eax@37 | |
8372 int v27; // [sp-4h] [bp-80h]@8 | |
8373 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8374 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8375 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8376 int v31; // [sp+68h] [bp-14h]@1 | |
8377 int v32; // [sp+6Ch] [bp-10h]@1 | |
8378 int v33; // [sp+70h] [bp-Ch]@17 | |
8379 int v34; // [sp+74h] [bp-8h]@17 | |
8380 int v35; // [sp+78h] [bp-4h]@17 | |
8381 | |
336 | 8382 v0 = window_SpeakInHouse; |
8383 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8384 v1 = pPlayers[uActiveCharacter]; |
8385 v28.uFrameX = 483; | |
8386 v28.uFrameWidth = 148; | |
8387 v28.uFrameZ = 334; | |
8388 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
8389 v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
8390 v2 = 52 * (unsigned int)v0->ptr_1C; | |
8391 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8392 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8393 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8394 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8395 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8396 v32 = v4; | |
8397 if ( v4 < v3 / 3 ) | |
8398 { | |
8399 v4 = v3 / 3; | |
8400 v32 = v3 / 3; | |
8401 } | |
749 | 8402 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8403 { |
8404 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8405 { | |
8406 v5 = 0; | |
8407 | |
8408 __debugbreak(); | |
8409 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8410 // or | |
8411 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8412 // or | |
8413 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8414 __debugbreak(); // whacky condition - fix |
0 | 8415 if (false |
8416 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8417 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8418 { |
8419 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8420 } | |
8421 else | |
8422 { | |
8423 if ( pParty->uNumGold < v4 ) | |
8424 { | |
8425 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8426 v27 = 4; | |
8427 } | |
8428 else | |
8429 { | |
8430 Party::TakeGold(v4); | |
8431 *(short *)v6 = 1; | |
8432 v27 = 2; | |
8433 } | |
735 | 8434 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8435 } |
8436 } | |
8437 else | |
8438 { | |
8439 v5 = 0; | |
8440 } | |
437 | 8441 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8442 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8443 { | |
8444 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8445 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8446 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8447 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8448 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8449 }*/ |
8450 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8451 return; // void func |
0 | 8452 } |
484 | 8453 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8454 { |
8455 v24 = pNPCTopics[171].pText; | |
8456 v25 = v31; | |
8457 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8458 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8459 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8460 return ; |
8461 } | |
8462 | |
8463 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8464 return; | |
0 | 8465 v8 = pDialogueWindow; |
8466 v33 = 0; | |
8467 v34 = 0; | |
8468 v29 = pDialogueWindow; | |
8469 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8470 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8471 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8472 if ( v9 >= v10 ) | |
8473 goto LABEL_40; | |
8474 do | |
8475 { | |
8476 v11 = v8->GetControl(v35)->uControlParam - 36; | |
135 | 8477 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8478 { |
8479 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8480 v33 += v12; | |
8481 ++v34; | |
8482 } | |
8483 v13 = v8->pStartingPosActiveItem; | |
8484 ++v35; | |
8485 } | |
8486 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8487 if ( !v34 ) | |
8488 { | |
8489 LABEL_40: | |
135 | 8490 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8491 strcat(pTmpBuf, "\n \n"); |
8492 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8493 v22 = v31; | |
8494 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8495 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8496 return; | |
0 | 8497 } |
8498 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8499 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8500 v32 = (149 - v33) / v34; | |
8501 if ( (149 - v33) / v34 > 32 ) | |
8502 v32 = 32; | |
711 | 8503 |
8504 v35 = v8->pStartingPosActiveItem; | |
0 | 8505 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8506 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8507 { |
8508 v33 = 2; | |
8509 do | |
8510 { | |
8511 v14 = v8->GetControl(v35); | |
8512 v15 = v14->uControlParam - 36; | |
135 | 8513 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8514 { |
8515 v16 = 0; | |
8516 if ( !v1->pActiveSkills[v15] ) | |
8517 { | |
8518 v17 = pSkillNames[v15]; | |
8519 v14->uY = v32 + v34; | |
8520 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8521 v19 = v14->uY; | |
8522 v14->uHeight = v18; | |
8523 v20 = v19 + v18 - 1; | |
8524 v14->uW = v20; | |
8525 v34 = v20; | |
8526 v21 = v31; | |
8527 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8528 v21 = v30; | |
8529 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8530 goto LABEL_34; | |
8531 } | |
8532 } | |
8533 else | |
8534 { | |
8535 v16 = 0; | |
8536 } | |
8537 v14->uW = v16; | |
8538 v14->uHeight = v16; | |
8539 v14->uY = v16; | |
8540 LABEL_34: | |
8541 v8 = v29; | |
8542 ++v35; | |
8543 ++v33; | |
711 | 8544 } |
8545 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8546 } | |
8547 return; | |
0 | 8548 } |
8549 | |
8550 //----- (00405CFF) -------------------------------------------------------- | |
8551 void stru262_TurnBased::End(bool bPlaySound) | |
8552 { | |
8553 stru262_TurnBased *v2; // edi@1 | |
8554 int v3; // ebx@1 | |
8555 int v4; // esi@1 | |
8556 unsigned __int8 v5; // zf@1 | |
8557 unsigned __int8 v6; // sf@1 | |
8558 TurnBased_QueueElem *v7; // ecx@2 | |
8559 unsigned __int16 *pAttributes; // ecx@7 | |
8560 size_t v9; // edx@7 | |
8561 unsigned __int16 v10; // ax@8 | |
8562 TurnBased_QueueElem *v11; // ebx@12 | |
8563 ObjectType objType; // eax@13 | |
8564 int objID; // esi@13 | |
8565 int v14; // [sp+Ch] [bp-4h]@11 | |
8566 | |
8567 v2 = this; | |
8568 v3 = 0; | |
8569 v4 = 0; | |
8570 v5 = this->uActorQueueSize == 0; | |
8571 v6 = this->uActorQueueSize < 0; | |
8572 this->field_4 = 0; | |
8573 if ( !(v6 | v5) ) | |
8574 { | |
8575 v7 = this->pQueue; | |
8576 do | |
8577 { | |
8578 if ( (v7->uPackedID & 7) == OBJECT_Actor ) | |
8579 LOBYTE(pActors[v7->uPackedID >> 3].uAttributes) &= 0x7Fu; | |
8580 ++v4; | |
8581 ++v7; | |
8582 } | |
8583 while ( v4 < v2->uActorQueueSize ); | |
8584 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8585 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8586 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8587 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8588 v9 = uNumSpriteObjects; |
0 | 8589 do |
8590 { | |
8591 v10 = *pAttributes; | |
8592 if ( *pAttributes & 4 ) | |
8593 { | |
8594 LOBYTE(v10) = v10 & 0xFB; | |
8595 *pAttributes = v10; | |
8596 } | |
8597 pAttributes += 56; | |
8598 --v9; | |
8599 } | |
8600 while ( v9 ); | |
8601 } | |
8602 v14 = 0; | |
8603 if ( v2->uActorQueueSize > 0 ) | |
8604 { | |
8605 v11 = v2->pQueue; | |
8606 do | |
8607 { | |
8608 objType = (ObjectType)(v11->uPackedID & 7); | |
8609 objID = v11->uPackedID >> 3; | |
8610 if ( objType == OBJECT_Player ) | |
8611 { | |
8612 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8613 } | |
8614 else | |
8615 { | |
8616 if ( objType == OBJECT_Actor ) | |
8617 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8618 } | |
8619 ++v14; | |
8620 ++v11; | |
8621 } | |
8622 while ( v14 < v2->uActorQueueSize ); | |
8623 v3 = 0; | |
8624 } | |
8625 pAudioPlayer->StopChannels(-1, -1); | |
8626 if ( bPlaySound != v3 ) | |
8627 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8628 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8629 pEventTimer->StopGameTime(); | |
8630 dword_50C994 = v3; | |
8631 dword_50C998_turnbased_icon_1A = v3; | |
8632 } | |
8633 // 50C994: using guessed type int dword_50C994; | |
8634 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8635 | |
8636 //----- (00405E14) -------------------------------------------------------- | |
8637 void stru262_TurnBased::_405E14() | |
8638 { | |
8639 stru262_TurnBased *v1; // esi@1 | |
8640 int v2; // ecx@1 | |
8641 SpellBuff *v3; // edi@2 | |
8642 Actor *v4; // ebx@3 | |
8643 signed int v5; // edx@20 | |
8644 AIDirection *v6; // esi@21 | |
8645 int v7; // eax@21 | |
8646 int v8; // eax@21 | |
8647 int v9; // eax@22 | |
8648 int v10; // eax@23 | |
8649 int v11; // eax@37 | |
8650 int v12; // eax@44 | |
8651 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8652 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8653 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8654 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8655 int v17; // [sp+5Ch] [bp-10h]@6 |
8656 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8657 int v19; // [sp+64h] [bp-8h]@8 | |
8658 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8659 | |
8660 v1 = this; | |
8661 v2 = 0; | |
8662 v18 = v1; | |
8663 v20 = 0; | |
8664 if ( (signed int)uNumActors > 0 ) | |
8665 { | |
90 | 8666 //v3 = pActors;//[0].pActorBuffs; |
8667 v16 = pActors;//[0].pActorBuffs; | |
8668 v3 = v16->pActorBuffs; | |
0 | 8669 do |
8670 { | |
90 | 8671 v4 = v16; |
8672 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8673 v17 = v2; |
8674 else | |
8675 v17 = 1; | |
8676 v19 = v2; | |
8677 do | |
8678 { | |
8679 if ( v19 != 10 ) | |
8680 { | |
8681 v3->_4585CA(pParty->uTimePlayed); | |
8682 v2 = 0; | |
8683 } | |
8684 ++v19; | |
8685 ++v3; | |
8686 } | |
8687 while ( v19 < 22 ); | |
8688 if ( v17 != v2 | |
8689 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8690 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8691 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8692 if ( !(v4->uAttributes & 0x80) ) | |
8693 { | |
8694 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8695 { | |
8696 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8697 { | |
8698 v5 = v4->uCurrentActionLength; | |
8699 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8700 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8701 { | |
417 | 8702 v17 = ai_near_actors_targets_pid[v20]; |
8703 v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2); | |
0 | 8704 v7 = v4->uAIState; |
8705 memcpy(&v15, v6, sizeof(v15)); | |
8706 v8 = v7 - 4; | |
8707 memcpy(&v14, &v15, sizeof(v14)); | |
8708 if ( v8 ) | |
8709 { | |
8710 v9 = v8 - 1; | |
8711 if ( v9 ) | |
8712 { | |
8713 v10 = v9 - 6; | |
8714 if ( v10 ) | |
8715 { | |
8716 if ( v10 != 8 ) | |
414 | 8717 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8718 } |
8719 } | |
8720 } | |
8721 else | |
8722 { | |
8723 v4->uCurrentActionTime = 0; | |
8724 v4->uCurrentActionLength = 0; | |
8725 v4->uAIState = Dead; | |
8726 v4->UpdateAnimation(); | |
8727 } | |
8728 v1 = v18; | |
8729 v2 = 0; | |
8730 } | |
8731 } | |
8732 } | |
8733 } | |
8734 ++v20; | |
90 | 8735 v3 = v16[1].pActorBuffs; |
8736 ++v16; | |
0 | 8737 } |
8738 while ( (signed int)v20 < (signed int)uNumActors ); | |
8739 } | |
8740 if ( v1->field_4 == 1 ) | |
8741 { | |
8742 v12 = v1->field_8; | |
8743 if ( v12 == 64 ) | |
8744 { | |
8745 v1->_406A63(); | |
8746 } | |
8747 else | |
8748 { | |
8749 if ( v12 > v2 ) | |
8750 { | |
8751 v1->_406B9F(); | |
8752 } | |
8753 else | |
8754 { | |
8755 v1->_406AFE(); | |
8756 v1->field_10 = 100; | |
8757 } | |
8758 } | |
8759 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8760 return; | |
8761 } | |
8762 if ( v1->field_4 == 2 ) | |
8763 { | |
8764 if ( !(v1->field_18 & 1) ) | |
8765 { | |
8766 v11 = v1->field_10; | |
8767 if ( v11 == 100 ) | |
8768 { | |
8769 v1->StartTurn(); | |
8770 LABEL_39: | |
8771 v1->_40652A(); | |
8772 return; | |
8773 } | |
8774 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8775 { | |
8776 v1->_4065B0(); | |
8777 goto LABEL_39; | |
8778 } | |
8779 } | |
8780 v1->NextTurn(); | |
8781 return; | |
8782 } | |
8783 if ( v1->field_4 == 3 ) | |
8784 { | |
8785 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8786 { | |
8787 v1->field_18 &= 0xFFFFFFF7u; | |
8788 v1->field_4 = 1; | |
8789 v1->field_8 = 64; | |
8790 } | |
8791 else | |
8792 { | |
8793 v1->_406FA8(); | |
8794 } | |
8795 } | |
8796 } | |
8797 | |
8798 //----- (0043FDED) -------------------------------------------------------- | |
8799 void PrepareActorRenderList_BLV() | |
8800 { | |
8801 RenderBillboard *v0; // esi@0 | |
8802 unsigned __int16 v3; // ax@3 | |
8803 unsigned int v4; // eax@5 | |
8804 unsigned __int16 v5; // cx@5 | |
8805 int v6; // esi@5 | |
8806 unsigned int v7; // eax@7 | |
8807 int v8; // eax@10 | |
8808 SpriteFrame *v9; // eax@16 | |
8809 SpriteFrame *v10; // ebx@18 | |
8810 //int *v11; // eax@18 | |
8811 int v12; // ecx@28 | |
8812 //IndoorCameraD3D **v14; // eax@36 | |
8813 double v15; // st7@36 | |
8814 float v16; // eax@36 | |
8815 //double v17; // ST30_8@36 | |
8816 signed __int64 v18; // qtt@36 | |
8817 int v19; // ST5C_4@36 | |
8818 signed __int64 v20; // qtt@37 | |
8819 int v21; // ST5C_4@37 | |
8820 signed __int16 v22; // cx@39 | |
8821 int v23; // ST50_4@40 | |
8822 signed int v24; // ecx@40 | |
8823 int v25; // edx@44 | |
8824 __int16 v26; // ax@44 | |
8825 //MonsterDesc *v27; // edx@44 | |
8826 //int v28; // ecx@44 | |
8827 unsigned __int8 v29; // zf@44 | |
8828 unsigned __int8 v30; // sf@44 | |
8829 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8830 int v32; // [sp+1Ch] [bp-38h]@5 | |
8831 int a3; // [sp+20h] [bp-34h]@5 | |
8832 int a2; // [sp+24h] [bp-30h]@5 | |
8833 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8834 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8835 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8836 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8837 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8838 int a6; // [sp+40h] [bp-14h]@34 | |
8839 int v43; // [sp+44h] [bp-10h]@34 | |
8840 int z; // [sp+48h] [bp-Ch]@32 | |
8841 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8842 int x; // [sp+50h] [bp-4h]@32 | |
8843 | |
8844 for (uint i = 0; i < uNumActors; ++i) | |
8845 { | |
8846 auto p = pActors + i; | |
8847 | |
8848 if (p->uAIState == Removed || | |
8849 p->uAIState == Disabled) | |
8850 continue; | |
8851 | |
8852 a5 = p->uSectorID; | |
8853 a2 = p->vPosition.y; | |
8854 a1a = p->vPosition.x; | |
8855 a3 = p->vPosition.z; | |
8856 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8857 LOWORD(v0) = p->uYawAngle; | |
8858 v5 = p->uCurrentActionAnimation; | |
8859 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8860 v32 = v6; | |
8861 if ( pParty->bTurnBasedModeOn ) | |
8862 { | |
8863 if ( v5 == 1 ) | |
8864 { | |
8865 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8866 goto LABEL_10; | |
8867 } | |
8868 } | |
8869 else | |
8870 { | |
8871 if ( v5 == 1 ) | |
8872 { | |
8873 v7 = pBLVRenderParams->field_0_timer_; | |
8874 LABEL_10: | |
8875 v8 = i * 32 + v7; | |
8876 goto LABEL_12; | |
8877 } | |
8878 } | |
8879 v8 = p->uCurrentActionTime; | |
8880 LABEL_12: | |
8881 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8882 v8 = 0; | |
8883 v31 = p->pSpriteIDs[v5]; | |
8884 if (p->uAIState == Resurrected) | |
8885 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8886 else | |
8887 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8888 v41 = 0; | |
8889 v10 = v9; | |
8890 //v11 = (int *)v9->uFlags; | |
8891 if (v9->uFlags & 2) | |
8892 v41 = 2; | |
8893 if (v9->uFlags & 0x40000) | |
8894 v41 |= 0x40u; | |
8895 if (v9->uFlags & 0x20000) | |
8896 LOBYTE(v41) = v41 | 0x80; | |
8897 v0 = (RenderBillboard *)(256 << v6); | |
8898 if ( (unsigned int)v0 & v9->uFlags) | |
8899 v41 |= 4u; | |
8900 if ( v10->uGlowRadius ) | |
8901 { | |
8902 //LOBYTE(v11) = byte_4E94D3; | |
8903 pMobileLightsStack->AddLight( | |
8904 a1a, | |
8905 a2, | |
8906 a3, | |
8907 a5, | |
8908 v10->uGlowRadius, | |
8909 0xFFu, | |
8910 0xFFu, | |
8911 0xFFu, | |
8912 byte_4E94D3); | |
8913 } | |
8914 v12 = 0; | |
8915 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8916 continue; | |
8917 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8918 { | |
8919 ++v12; | |
8920 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8921 goto _continue; | |
8922 } | |
8923 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8924 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8925 continue; | |
8926 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8927 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8928 if (uNumBillboardsToDraw >= 500) | |
8929 break; | |
8930 ++uNumBillboardsToDraw; | |
8931 ++uNumSpritesDrawnThisFrame; | |
8932 p->uAttributes |= 8u; | |
8933 v29 = pRenderer->pRenderD3D == 0; | |
8934 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8935 v0->uPalette = v10->uPaletteIndex; | |
8936 v0->uIndoorSectorID = a5; | |
8937 if ( v29 ) | |
8938 { | |
8939 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8940 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8941 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8942 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8943 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8944 } | |
8945 else | |
8946 { | |
8947 //v14 = &pGame->pIndoorCameraD3D; | |
8948 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8949 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8950 v16 = v0->fov_x; | |
8951 v0->fov_y = v15; | |
8952 //v17 = v16 + 6.7553994e15; | |
8953 LODWORD(v18) = 0; | |
8954 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8955 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8956 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8957 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8958 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8959 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8960 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8961 { | |
8962 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8963 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8964 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8965 goto LABEL_43; |
8966 } | |
8967 } | |
8968 else | |
8969 { | |
8970 v22 = p->pActorBuffs[3].uPower; | |
8971 if ( v22 ) | |
8972 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8973 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8974 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8975 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8976 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8977 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8978 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8979 goto LABEL_44; |
8980 } | |
8981 } | |
8982 LABEL_44: | |
8983 HIWORD(v25) = HIWORD(x); | |
430 | 8984 v0->world_x = a1a; |
8985 v0->world_y = a2; | |
8986 v0->world_z = a3; | |
0 | 8987 v0->uScreenSpaceX = v43; |
8988 v0->uScreenSpaceY = a6; | |
8989 LOWORD(v25) = 0; | |
8990 LOBYTE(v26) = v41; | |
194 | 8991 |
8992 //v0->sZValue = v25 + (8 * i | OBJECT_Actor); | |
8993 v0->actual_z = HIWORD(x); | |
8994 v0->object_pid = v8 * i | OBJECT_Actor; | |
8995 | |
0 | 8996 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8997 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8998 v0->field_1E = v41; | |
8999 v0->pSpriteFrame = v10; | |
9000 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9001 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9002 { | |
9003 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9004 v0->field_1E = v26; | |
9005 } | |
9006 | |
9007 _continue: | |
9008 ; | |
9009 } | |
9010 } | |
9011 | |
9012 //----- (00444732) -------------------------------------------------------- | |
428 | 9013 char *GetEventHintString(unsigned int uEventID) |
9014 { | |
9015 signed int event_index; // edx@1 | |
9016 int event_pos; // esi@4 | |
0 | 9017 char *result; // eax@6 |
428 | 9018 unsigned int str_index; // eax@9 |
9019 int i; // esi@11 | |
9020 _evt_raw* test_evt; | |
9021 _evt_raw* last_evt; | |
9022 | |
9023 event_index = 0; | |
9024 if ( uLevelEVT_NumEvents <= 0 ) | |
9025 return NULL; | |
9026 | |
9027 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9028 while ( 1 ) |
9029 { | |
428 | 9030 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9031 { | |
9032 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9033 last_evt=test_evt; | |
9034 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9035 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9036 break; |
9037 } | |
428 | 9038 ++event_index; |
9039 if ( event_index >= uLevelEVT_NumEvents ) | |
9040 return NULL; | |
9041 } | |
9042 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9043 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9044 { | |
9045 str_index = EVT_DWORD(test_evt->v5); | |
9046 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9047 } |
9048 else | |
9049 { | |
428 | 9050 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9051 { | |
9052 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9053 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9054 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9055 { | |
9056 str_index = EVT_DWORD(test_evt->v5); | |
9057 if ( str_index < 600 ) | |
9058 return (char *)p2DEvents[str_index - 1].pName; | |
9059 } | |
9060 } | |
9061 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9062 } | |
9063 | |
0 | 9064 return result; |
9065 } | |
9066 | |
9067 //----- (00444839) -------------------------------------------------------- | |
9068 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) | |
9069 { | |
9070 unsigned int v9; // ebx@1 | |
9071 int v10; // edi@1 | |
373 | 9072 //signed int v11; // eax@1 |
0 | 9073 unsigned int v12; // eax@6 |
9074 const char *v13; // ST0C_4@6 | |
9075 unsigned int v14; // eax@8 | |
9076 const char *v15; // eax@14 | |
9077 unsigned int v16; // eax@16 | |
9078 unsigned int result; // eax@26 | |
9079 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9080 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9081 char *v20; // [sp-4h] [bp-3Ch]@9 |
9082 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9083 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9084 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9085 | |
9086 v9 = a1; | |
9087 v10 = a2; | |
9088 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9089 dword_59117C_teleportx = x; | |
9090 dword_591178_teleporty = y; | |
9091 dword_591174_teleportz = z; | |
9092 dword_591170_teleport_directiony = directiony; | |
9093 dword_59116C_teleport_directionx = directionx; | |
9094 dword_591168_teleport_speedz = a8; | |
9095 dword_591164_teleport_map_name = (char *)pLocationName; | |
9096 uCurrentHouse_Animation = v9; | |
9097 pEventTimer->Pause(); | |
9098 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9099 |
9100 switch (pParty->alignment) | |
9101 { | |
9102 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9103 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9104 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9105 default: assert(false); | |
9106 } | |
9107 /*v11 = const_2(); | |
0 | 9108 sprintf(pContainer, "evt%02d", v11); |
9109 if ( pParty->uAlignment ) | |
9110 { | |
9111 if ( pParty->uAlignment != 2 ) | |
9112 goto LABEL_6; | |
9113 v19 = "-c"; | |
9114 } | |
9115 else | |
9116 { | |
9117 v19 = "-b"; | |
9118 } | |
373 | 9119 strcat(pContainer, v19);*/ |
9120 | |
9121 //LABEL_6: | |
0 | 9122 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9123 v13 = pHouse_ExitPictures[v10]; | |
9124 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
9125 pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)]; | |
9126 if ( v9 ) | |
9127 { | |
9128 if ( !v23 ) | |
9129 //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
484 | 9130 pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); |
0 | 9131 } |
9132 else | |
9133 { | |
9134 if ( !v23 ) | |
9135 { | |
9136 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9137 if ( v14 ) | |
9138 { | |
721 | 9139 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9140 goto LABEL_20; |
9141 } | |
9142 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9143 goto LABEL_19; | |
9144 } | |
9145 } | |
9146 v15 = pLocationName; | |
9147 if ( *pLocationName == 48 ) | |
9148 v15 = pCurrentMapName; | |
9149 v16 = pMapStats->GetMapInfo(v15); | |
9150 if ( v16 ) | |
9151 { | |
721 | 9152 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9153 goto LABEL_20; | |
0 | 9154 } |
9155 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9156 LABEL_19: | |
423 | 9157 strcpy(sHouseName, v21); |
0 | 9158 LABEL_20: |
710 | 9159 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9160 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9161 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9162 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9163 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9164 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9165 result = v23; |
9166 if ( v23 ) | |
9167 uCurrentHouse_Animation = v23; | |
9168 return result; | |
9169 } |