Mercurial > mm7
annotate mm7_4.cpp @ 962:0423c40d7e88
UpdateWindows and pWindow->Release
author | Ritor1 |
---|---|
date | Tue, 07 May 2013 17:32:23 +0600 |
parents | e9292c58644a |
children | d7f0572335ec |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
198 | 3 #include <assert.h> |
0 | 4 |
341 | 5 #include "MM7.h" |
0 | 6 #include "MapInfo.h" |
7 #include "Game.h" | |
8 #include "GUIWindow.h" | |
9 #include "GUIFont.h" | |
10 #include "Party.h" | |
11 #include "AudioPlayer.h" | |
12 #include "Outdoor.h" | |
13 #include "IndoorCamera.h" | |
14 #include "Overlays.h" | |
15 #include "Monsters.h" | |
16 #include "Arcomage.h" | |
17 #include "LOD.h" | |
18 #include "Actor.h" | |
19 #include "Allocator.h" | |
20 #include "Events.h" | |
21 #include "Viewport.h" | |
22 #include "FrameTableInc.h" | |
23 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
24 #include "SpriteObject.h" |
0 | 25 #include "ObjectList.h" |
26 #include "Chest.h" | |
27 #include "PaletteManager.h" | |
28 #include "DecorationList.h" | |
29 #include "SaveLoad.h" | |
30 #include "stru123.h" | |
31 #include "Time.h" | |
32 #include "IconFrameTable.h" | |
33 #include "GUIProgressBar.h" | |
34 #include "Bink_Smacker.h" | |
35 #include "TileFrameTable.h" | |
36 #include "PlayerFrameTable.h" | |
37 #include "Awards.h" | |
38 #include "Autonotes.h" | |
39 #include "stru160.h" | |
40 #include "TurnEngine.h" | |
41 #include "FactionTable.h" | |
42 #include "StorylineTextTable.h" | |
43 #include "Random.h" | |
924 | 44 #include "CastSpellInfo.h" |
0 | 45 #include "stru298.h" |
46 #include "stru12.h" | |
47 #include "Events2D.h" | |
48 #include "stru159.h" | |
189 | 49 #include "texts.h" |
0 | 50 #include "Log.h" |
629 | 51 #include "UIHouses.h" |
0 | 52 #include "mm7_data.h" |
53 | |
54 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 55 void __cdecl check_event_triggers() |
0 | 56 { |
57 int v0; // eax@1 | |
58 LevelDecoration *v1; // esi@2 | |
59 signed int v2; // edi@2 | |
60 int v3; // ebx@2 | |
61 int v4; // eax@3 | |
62 int v5; // ebx@3 | |
63 unsigned int v6; // ecx@3 | |
64 unsigned int v7; // edx@6 | |
65 unsigned int v8; // edx@8 | |
112 | 66 Actor *v9; // edi@13 |
0 | 67 int v10; // ebx@14 |
68 int v11; // eax@14 | |
69 int v12; // ebx@14 | |
70 unsigned int v13; // ecx@14 | |
71 int v14; // edx@15 | |
72 unsigned int v15; // edx@17 | |
73 unsigned int v16; // edx@19 | |
74 char *v17; // edi@25 | |
75 int v18; // ebx@26 | |
76 int v19; // eax@26 | |
77 int v20; // ebx@26 | |
78 unsigned int v21; // ecx@26 | |
79 int v22; // edx@27 | |
80 unsigned int v23; // edx@29 | |
81 unsigned int v24; // edx@31 | |
82 int v25; // [sp+0h] [bp-24h]@3 | |
83 int v26; // [sp+0h] [bp-24h]@14 | |
84 int v27; // [sp+0h] [bp-24h]@26 | |
85 int v28; // [sp+4h] [bp-20h]@3 | |
86 int v29; // [sp+4h] [bp-20h]@14 | |
87 int v30; // [sp+4h] [bp-20h]@26 | |
88 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
89 int v32; // [sp+Ch] [bp-18h]@2 | |
90 int v33; // [sp+10h] [bp-14h]@2 | |
91 int i; // [sp+14h] [bp-10h]@1 | |
92 int v35; // [sp+18h] [bp-Ch]@2 | |
93 int v36; // [sp+1Ch] [bp-8h]@3 | |
94 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
95 signed int v38; // [sp+20h] [bp-4h]@24 | |
96 | |
97 v0 = 0; | |
98 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
99 { | |
100 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
101 v2 = v1->field_18; | |
102 v3 = v1->vPosition.y; | |
103 v33 = v1->vPosition.x; | |
104 v32 = v1->vPosition.y; | |
105 v35 = v1->vPosition.z; | |
106 v31 = v1->field_18; | |
107 if ( v1->field_2 & 1 ) | |
108 { | |
109 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
110 v25 = abs(v3 - pParty->vPosition.y); | |
111 v28 = abs(v35 - pParty->vPosition.z); | |
112 v4 = v36; | |
113 v5 = v25; | |
114 v6 = v28; | |
115 if ( v36 < v25 ) | |
116 { | |
117 v4 = v25; | |
118 v5 = v36; | |
119 } | |
120 if ( v4 < v28 ) | |
121 { | |
122 v7 = v4; | |
123 v4 = v28; | |
124 v6 = v7; | |
125 } | |
126 if ( v5 < (signed int)v6 ) | |
127 { | |
128 v8 = v6; | |
129 v6 = v5; | |
130 v5 = v8; | |
131 } | |
132 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 133 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 134 } |
135 if ( v1->field_2 & 2 ) | |
136 { | |
137 v37 = 0; | |
138 if ( (signed int)uNumActors > 0 ) | |
139 { | |
112 | 140 v9 = pActors;//[0].vPosition.y; |
0 | 141 do |
142 { | |
112 | 143 v10 = abs(v33 - v9->vPosition.x); |
144 v29 = abs(v32 - v9->vPosition.y); | |
145 v26 = abs(v35 - v9->vPosition.z); | |
0 | 146 v11 = v10; |
147 v12 = v29; | |
148 v13 = v26; | |
149 if ( v11 < v29 ) | |
150 { | |
151 v14 = v11; | |
152 v11 = v29; | |
153 v12 = v14; | |
154 } | |
155 if ( v11 < v26 ) | |
156 { | |
157 v15 = v11; | |
158 v11 = v26; | |
159 v13 = v15; | |
160 } | |
161 if ( v12 < (signed int)v13 ) | |
162 { | |
163 v16 = v13; | |
164 v13 = v12; | |
165 v12 = v16; | |
166 } | |
167 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
168 EventProcessor(v1->field_16_event_id, 0, 1); | |
169 ++v37; | |
112 | 170 ++v9; |
0 | 171 } |
172 while ( v37 < (signed int)uNumActors ); | |
173 } | |
174 } | |
175 if ( v1->field_2 & 4 ) | |
176 { | |
177 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
178 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
179 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
180 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 181 do |
182 { | |
183 v18 = abs(v33 - *((int *)v17 - 1)); | |
184 v30 = abs(v32 - *(int *)v17); | |
185 v27 = abs(v35 - *((int *)v17 + 1)); | |
186 v19 = v18; | |
187 v20 = v30; | |
188 v21 = v27; | |
189 if ( v19 < v30 ) | |
190 { | |
191 v22 = v19; | |
192 v19 = v30; | |
193 v20 = v22; | |
194 } | |
195 if ( v19 < v27 ) | |
196 { | |
197 v23 = v19; | |
198 v19 = v27; | |
199 v21 = v23; | |
200 } | |
201 if ( v20 < (signed int)v21 ) | |
202 { | |
203 v24 = v21; | |
204 v21 = v20; | |
205 v20 = v24; | |
206 } | |
207 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
208 EventProcessor(v1->field_16_event_id, 0, 1); | |
209 ++v38; | |
210 v17 += 112; | |
211 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
212 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 213 } |
214 } | |
215 v0 = i + 1; | |
216 } | |
217 } | |
218 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
219 | |
220 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 221 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 222 { |
223 int v13; // ecx@13 | |
224 signed int v14; // ebx@14 | |
225 int v15; // eax@16 | |
729 | 226 //int v16; // edx@19 |
792 | 227 //int v17; // ST18_4@19 |
228 //signed int v18; // edx@19 | |
229 //signed __int64 v19; // qtt@19 | |
0 | 230 int v21; // eax@27 |
792 | 231 //int v22; // ecx@29 |
0 | 232 signed int v28; // eax@45 |
233 int v29; // ebx@47 | |
234 int v30; // edx@49 | |
830 | 235 //int v31; // ST10_4@49 |
236 //signed int v32; // edx@49 | |
0 | 237 signed __int64 v33; // qtt@49 |
830 | 238 //signed int v34; // eax@54 |
239 //signed int v35; // esi@56 | |
240 //int result; // eax@57 | |
0 | 241 int v38; // edx@62 |
792 | 242 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 243 bool v47; // [sp+24h] [bp-1Ch]@43 |
244 bool v48; // [sp+28h] [bp-18h]@10 | |
245 bool v49; // [sp+28h] [bp-18h]@41 | |
246 bool v50; // [sp+2Ch] [bp-14h]@12 | |
247 signed int v53; // [sp+30h] [bp-10h]@10 | |
248 signed int v54; // [sp+30h] [bp-10h]@41 | |
249 signed int v55; // [sp+34h] [bp-Ch]@1 | |
250 | |
730 | 251 //LOG_DECOMPILATION_WARNING(); |
252 | |
253 static int blv_floor_id[50]; // 00721200 | |
254 static int blv_floor_level[50]; // 007212C8 | |
255 | |
256 static __int16 word_721390_ys[104]; // idb | |
257 static __int16 word_721460_xs[104]; // idb | |
0 | 258 |
259 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 260 v55 = 0; |
0 | 261 for (uint i = 0; i < pSector->uNumFloors; ++i) |
262 { | |
263 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
264 if (pFloor->Clickable()) | |
265 continue; | |
266 | |
792 | 267 assert(pFloor->uNumVertices); |
0 | 268 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
269 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
270 { | |
271 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
272 { | |
730 | 273 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
274 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
275 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
276 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 277 } |
730 | 278 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
279 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
280 | |
792 | 281 v50 = word_721390_ys[0] >= y; |
0 | 282 v53 = 0; |
792 | 283 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
284 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 285 { |
286 if (v53 >= 2) | |
287 break; | |
288 | |
289 v48 = v50; | |
290 v50 = word_721390_ys[j + 1] >= y; | |
730 | 291 |
292 v13 = i; | |
792 | 293 if (v48 == v50) |
294 continue; | |
295 | |
296 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
297 v15 = v14 | word_721460_xs[j] < x; | |
298 | |
299 if (v15 == 3) | |
300 continue; | |
301 else if (!v15) | |
302 ++v53; | |
303 else | |
0 | 304 { |
792 | 305 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 306 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 307 |
308 if (res + word_721460_xs[j] >= x) | |
729 | 309 ++v53; |
0 | 310 } |
792 | 311 } |
312 | |
313 | |
0 | 314 if ( v53 == 1 ) |
315 { | |
316 if ( v55 >= 50 ) | |
317 break; | |
723 | 318 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 319 { |
725 | 320 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 321 } |
322 else | |
323 { | |
871 | 324 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 325 } |
792 | 326 blv_floor_level[v55] = v21; |
327 blv_floor_id[v55] = pSector->pFloors[i]; | |
328 v55++; | |
0 | 329 } |
792 | 330 } |
331 } | |
332 | |
333 | |
0 | 334 if ( pSector->field_0 & 8 ) |
335 { | |
336 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
337 { | |
338 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
339 if (portal->uPolygonType != POLYGON_Floor) | |
340 continue; | |
341 | |
830 | 342 if (!portal->uNumVertices) |
343 continue; | |
344 | |
723 | 345 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
346 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
347 { | |
0 | 348 for (uint j = 0; j < portal->uNumVertices; ++j) |
349 { | |
730 | 350 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
351 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
352 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
353 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
354 } | |
355 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
356 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 357 v54 = 0; |
830 | 358 v47 = word_721390_ys[0] >= y; |
359 | |
360 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 361 { |
830 | 362 v49 = v47; |
0 | 363 if ( v54 >= 2 ) |
364 break; | |
830 | 365 v47 = word_721390_ys[j + 1] >= y; |
0 | 366 if ( v49 != v47 ) |
367 { | |
830 | 368 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
369 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 370 if ( v29 != 3 ) |
371 { | |
723 | 372 if ( !v29 ) |
729 | 373 ++v54; |
374 else | |
375 { | |
830 | 376 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 377 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 378 if (res + word_721460_xs[j] >= x) |
723 | 379 ++v54; |
729 | 380 } |
0 | 381 } |
382 } | |
383 } | |
384 if ( v54 == 1 ) | |
385 { | |
386 if ( v55 >= 50 ) | |
387 break; | |
830 | 388 blv_floor_level[v55] = -29000; |
389 blv_floor_id[v55] = pSector->pPortals[i]; | |
390 v55++; | |
0 | 391 } |
392 } | |
393 } | |
394 } | |
395 if ( v55 == 1 ) | |
396 { | |
730 | 397 *pFaceID = blv_floor_id[0]; |
725 | 398 return blv_floor_level[0]; |
0 | 399 } |
400 if ( !v55 ) | |
401 return -30000; | |
730 | 402 *pFaceID = blv_floor_id[0]; |
725 | 403 //result = blv_floor_level[0]; |
830 | 404 |
405 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 406 { |
725 | 407 if ( blv_floor_level[0] <= z + 5 ) |
408 { | |
409 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 410 continue; |
725 | 411 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 412 *pFaceID = blv_floor_id[v35]; |
717 | 413 continue; |
414 } | |
725 | 415 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
416 { | |
417 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 418 *pFaceID = blv_floor_id[v35]; |
717 | 419 } |
830 | 420 }*/ |
421 | |
422 | |
423 int result = blv_floor_level[0]; | |
424 for (uint i = 1; i < v55; ++i) | |
425 { | |
426 v38 = blv_floor_level[i]; | |
427 if ( result <= z + 5 ) | |
428 { | |
429 if ( v38 > result && v38 <= z + 5 ) | |
430 { | |
431 result = blv_floor_level[i]; | |
432 *pFaceID = blv_floor_id[i]; | |
433 } | |
434 } | |
435 else if ( v38 < result ) | |
436 { | |
437 result = blv_floor_level[i]; | |
438 *pFaceID = blv_floor_id[i]; | |
439 } | |
440 } | |
441 | |
442 return result; | |
0 | 443 } |
444 | |
445 //----- (0046D49E) -------------------------------------------------------- | |
791 | 446 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 447 { |
723 | 448 BSPModel *pBModel; // esi@4 |
449 ODMFace *pFace; // ecx@11 | |
0 | 450 int v14; // edx@20 |
451 signed int v18; // edx@26 | |
452 int v19; // eax@28 | |
453 int v20; // edx@30 | |
454 int v21; // ST1C_4@30 | |
455 signed int v22; // edx@30 | |
456 signed __int64 v23; // qtt@30 | |
457 int v24; // eax@36 | |
458 signed int v25; // ecx@38 | |
459 int result; // eax@42 | |
460 signed int v27; // ecx@43 | |
461 int v28; // edi@44 | |
462 signed int v29; // edx@44 | |
463 int v30; // esi@45 | |
464 int v31; // eax@45 | |
465 ODMFace *v32; // eax@57 | |
466 int v33; // ecx@59 | |
467 int v36; // [sp+14h] [bp-2Ch]@24 | |
468 int v38; // [sp+1Ch] [bp-24h]@2 | |
469 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 470 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
471 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 472 bool v43; // [sp+30h] [bp-10h]@22 |
473 bool v44; // [sp+34h] [bp-Ch]@24 | |
474 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
475 signed int v48; // [sp+58h] [bp+18h]@22 | |
476 signed int v49; // [sp+58h] [bp+18h]@43 | |
477 | |
478 v46 = 1; | |
479 dword_721160[0] = -1; | |
480 dword_721110[0] = -1; | |
791 | 481 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 482 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 483 { |
484 *a6 = 0; | |
725 | 485 return odm_floor_level[0]; |
723 | 486 } |
0 | 487 v38 = 0; |
723 | 488 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
489 { | |
490 pBModel = &pOutdoor->pBModels[v38]; | |
491 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
492 { | |
493 if ( (signed int)pBModel->uNumFaces > 0 ) | |
494 { | |
495 v39 = 0; | |
496 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
497 { | |
498 pFace = &pBModel->pFaces[v39]; | |
499 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
500 && !(pFace->uAttributes & 0x20000000) | |
501 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
502 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 503 { |
723 | 504 if ( pFace->uNumVertices ) |
0 | 505 { |
723 | 506 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 507 { |
723 | 508 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
509 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
510 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
511 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
512 } | |
513 } | |
514 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
515 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
516 v43 = word_720F70[0] >= Y; | |
517 v48 = 0; | |
518 if ( 2 * pFace->uNumVertices > 0 ) | |
519 { | |
520 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
521 { | |
522 if ( v48 >= 2 ) | |
523 break; | |
524 v36 = word_720F70[i + 1]; | |
525 v44 = word_720F70[i + 1] >= Y; | |
526 if ( v43 != v44 ) | |
0 | 527 { |
723 | 528 v18 = word_721040[i + 1] >= X ? 0 : 2; |
529 v19 = v18 | word_721040[i] < X; | |
530 if ( v19 != 3 ) | |
0 | 531 { |
723 | 532 if ( !v19 ) |
740 | 533 ++v48; |
534 else | |
0 | 535 { |
723 | 536 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
537 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
538 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
539 if ( v22 >= X) | |
540 ++v48; | |
0 | 541 } |
542 } | |
543 } | |
723 | 544 v43 = v44; |
545 } | |
546 if ( v48 == 1 ) | |
547 { | |
548 if ( v46 >= 20 ) | |
0 | 549 break; |
723 | 550 if ( pFace->uPolygonType == POLYGON_Floor ) |
551 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
552 else | |
725 | 553 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
554 + HIWORD(pFace->zCalc3); | |
723 | 555 v25 = v46++; |
725 | 556 odm_floor_level[v25] = v24; |
723 | 557 dword_721160[v25] = pBModelNum; |
558 dword_721110[v25] = pFaceNum; | |
0 | 559 } |
560 } | |
561 } | |
723 | 562 ++v39; |
563 } | |
564 } | |
565 } | |
0 | 566 ++v38; |
567 } | |
568 if ( v46 == 1 ) | |
569 { | |
570 *a6 = 0; | |
725 | 571 return odm_floor_level[0]; |
0 | 572 } |
573 v27 = 0; | |
574 if ( v46 <= 1 ) | |
575 *a6 = 0; | |
723 | 576 else |
577 { | |
725 | 578 //v29 = 1; |
723 | 579 for ( v49 = 1; v49 < v46; ++v49 ) |
580 { | |
725 | 581 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 582 { |
583 v27 = v49; | |
725 | 584 //++v29; |
723 | 585 break; |
586 } | |
725 | 587 if ( odm_floor_level[0] > Z + 5 ) |
588 { | |
589 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
590 { | |
591 //++v29; | |
723 | 592 break; |
593 } | |
594 v27 = v49; | |
725 | 595 //++v29; |
723 | 596 break; |
597 } | |
725 | 598 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 599 { |
600 v27 = v49; | |
725 | 601 //++v29; |
723 | 602 } |
603 } | |
604 if ( !v27 ) | |
605 *a6 = 0; | |
606 else | |
607 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
608 } | |
0 | 609 if ( v27 ) |
610 { | |
611 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 612 *pIsOnWater = false; |
613 if ( v32->Fluid()) | |
614 *pIsOnWater = true; | |
0 | 615 } |
725 | 616 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
617 odm_floor_level[0] = odm_floor_level[v27]; | |
618 return odm_floor_level[0]; | |
0 | 619 } |
620 | |
621 //----- (0046D8E3) -------------------------------------------------------- | |
622 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
623 { | |
624 int v4; // ebx@1 | |
625 unsigned int v5; // ecx@1 | |
626 BSPModel *v6; // edi@3 | |
627 ODMFace *v7; // esi@10 | |
628 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
629 signed __int16 *v9; // eax@18 |
0 | 630 int v10; // edx@19 |
631 int v11; // ecx@21 | |
632 int v12; // ecx@23 | |
633 signed int v13; // eax@25 | |
634 int v14; // edx@27 | |
635 int v15; // edx@29 | |
636 int v16; // ST18_4@29 | |
637 signed int v17; // edx@29 | |
638 signed __int64 v18; // qtt@29 | |
639 int v19; // eax@35 | |
640 signed int v20; // ecx@37 | |
641 signed int v22; // ebx@42 | |
642 unsigned int v23; // esi@43 | |
643 int v24; // edx@44 | |
644 int v25; // eax@44 | |
645 int v26; // [sp+Ch] [bp-38h]@7 | |
646 int v27; // [sp+10h] [bp-34h]@21 | |
647 int v28; // [sp+18h] [bp-2Ch]@21 | |
648 int v29; // [sp+1Ch] [bp-28h]@2 | |
649 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
650 signed int v31; // [sp+24h] [bp-20h]@1 | |
651 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
652 int v33; // [sp+2Ch] [bp-18h]@7 | |
653 bool v34; // [sp+30h] [bp-14h]@21 | |
654 bool v35; // [sp+34h] [bp-10h]@23 | |
655 signed int v36; // [sp+38h] [bp-Ch]@17 | |
656 signed int v37; // [sp+38h] [bp-Ch]@21 | |
657 signed int v38; // [sp+38h] [bp-Ch]@42 | |
658 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
659 signed int v40; // [sp+40h] [bp-4h]@1 | |
660 | |
661 dword_720ED0[0] = -1; | |
662 dword_720E80[0] = -1; | |
663 v4 = a1; | |
664 v5 = 0; | |
665 v40 = a2; | |
666 v31 = v4; | |
667 v39 = 1; | |
668 dword_720F20[0] = 10000; | |
669 v32 = 0; | |
670 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
671 { | |
672 v29 = 0; | |
673 do | |
674 { | |
675 v6 = &pOutdoor->pBModels[v29]; | |
676 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
677 { | |
678 if ( v4 >= v6->sMinX ) | |
679 { | |
680 if ( v40 <= v6->sMaxY ) | |
681 { | |
682 if ( v40 >= v6->sMinY ) | |
683 { | |
684 v33 = v5; | |
685 v26 = v6->uNumFaces; | |
686 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
687 { | |
688 v30 = v5; | |
689 while ( 1 ) | |
690 { | |
691 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
692 v8 = v7->uPolygonType; | |
693 if ( (v8 == 5 || v8 == 6) | |
694 && !(BYTE3(v7->uAttributes) & 0x20) | |
695 && v4 <= v7->pBoundingBox.x2 | |
696 && v4 >= v7->pBoundingBox.x1 | |
697 && v40 <= v7->pBoundingBox.y2 | |
698 && v40 >= v7->pBoundingBox.y1 ) | |
699 { | |
700 v36 = v5; | |
701 if ( v7->uNumVertices ) | |
702 { | |
703 v9 = v7->pXInterceptDisplacements; | |
704 do | |
705 { | |
706 v10 = 2 * v36; | |
707 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
708 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
709 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
710 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
711 ++v9; | |
712 } | |
713 while ( v36 < v7->uNumVertices ); | |
714 v4 = v31; | |
715 } | |
716 v27 = 2 * v7->uNumVertices; | |
717 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
718 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
719 v11 = 0; | |
720 v34 = word_720CE0_ys[0] >= v40; | |
721 v37 = 0; | |
722 v28 = 0; | |
723 if ( v27 > 0 ) | |
724 { | |
725 do | |
726 { | |
727 if ( v37 >= 2 ) | |
728 break; | |
729 v12 = v11; | |
730 v4 = v31; | |
731 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
732 if ( v34 != v35 ) | |
733 { | |
734 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
735 v14 = v13 | word_720DB0_xs[v12] < v31; | |
736 if ( v14 != 3 ) | |
737 { | |
738 if ( !v14 | |
739 || (v15 = word_720CE0_ys[v12], | |
740 v16 = word_720CE0_ys[v12 + 1] - v15, | |
741 v17 = v40 - v15, | |
742 LODWORD(v18) = v17 << 16, | |
743 HIDWORD(v18) = v17 >> 16, | |
744 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
745 - (signed int)word_720DB0_xs[v12]) | |
746 * v18 | |
747 / v16) >> 16) | |
748 + word_720DB0_xs[v12]) >= v31) ) | |
749 ++v37; | |
750 } | |
751 } | |
752 v11 = v28 + 1; | |
753 v34 = v35; | |
754 ++v28; | |
755 } | |
756 while ( v28 < v27 ); | |
757 if ( v37 == 1 ) | |
758 { | |
759 if ( v39 >= 20 ) | |
760 break; | |
761 if ( v7->uPolygonType == 5 ) | |
762 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
763 else | |
764 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
765 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
766 + HIWORD(v7->zCalc3); | |
767 v20 = v39++; | |
768 dword_720F20[v20] = v19; | |
769 dword_720ED0[v20] = v32; | |
770 dword_720E80[v20] = v33; | |
771 } | |
772 } | |
773 } | |
774 ++v33; | |
775 v30 += 308; | |
776 if ( v33 >= v26 ) | |
777 break; | |
778 v5 = 0; | |
779 } | |
780 } | |
781 } | |
782 } | |
783 } | |
784 } | |
785 ++v32; | |
786 ++v29; | |
787 v5 = 0; | |
788 } | |
789 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
790 if ( !v39 ) | |
791 { | |
792 *(int *)a4 = 0; | |
793 return dword_720F20[0]; | |
794 } | |
795 } | |
796 v22 = 0; | |
797 v38 = v5; | |
798 if ( v39 <= (signed int)v5 ) | |
799 goto LABEL_54; | |
800 v23 = 0; | |
801 do | |
802 { | |
803 v24 = dword_720F20[v5 / 4]; | |
804 v25 = *(int *)((char *)dword_720F20 + v23); | |
805 if ( v24 == v25 ) | |
806 goto LABEL_50; | |
807 if ( v25 > a3 + 15 ) | |
808 { | |
809 if ( v24 >= v25 ) | |
810 goto LABEL_51; | |
811 LABEL_50: | |
812 v22 = v38; | |
813 v23 = v5; | |
814 goto LABEL_51; | |
815 } | |
816 if ( v24 > v25 && v24 <= a3 + 15 ) | |
817 goto LABEL_50; | |
818 LABEL_51: | |
819 ++v38; | |
820 v5 += 4; | |
821 } | |
822 while ( v38 < v39 ); | |
823 if ( v22 ) | |
824 { | |
825 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
826 return dword_720F20[v22]; | |
827 } | |
828 LABEL_54: | |
829 *(int *)a4 = 0; | |
830 return dword_720F20[v22]; | |
831 } | |
832 | |
138 | 833 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
834 // for a right-handed system, that would be an inverse normal | |
0 | 835 //----- (0046DCC8) -------------------------------------------------------- |
138 | 836 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
837 { | |
838 auto grid_x = WorldPosToGridCellX(pos_x); | |
839 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
840 | |
841 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
842 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
843 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
844 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
845 | |
846 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
847 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
848 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
849 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
850 | |
851 float side1_dx, side1_dy, side1_dz, | |
852 side2_dx, side2_dy, side2_dz; | |
853 | |
854 auto dx = abs(pos_x - grid_pos_x1), | |
855 dz = abs(grid_pos_z1 - pos_z); | |
856 if (dz >= dx) | |
857 { | |
858 side1_dy = (double)(x1z1_y - x1z2_y); | |
859 side2_dy = (double)(x2z2_y - x1z2_y); | |
860 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
861 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
862 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
863 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 864 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 865 /* |\ |
866 side1 | \ | |
867 |____\ | |
868 side 2 */ | |
869 } | |
870 else | |
871 { | |
872 side1_dy = (double)(x2z2_y - x2z1_y); | |
873 side2_dy = (double)(x1z1_y - x2z1_y); | |
874 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
875 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
876 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
877 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
878 | |
879 /* side 2 | |
880 _____ | |
881 \ | | |
882 \ | side 1 | |
883 \| */ | |
884 } | |
885 | |
886 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
887 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
888 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
889 | |
890 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
891 if (fabsf(mag) < 1e-6f) | |
892 { | |
893 out->y = 0; | |
894 out->x = 0; | |
895 out->z = 65536; | |
896 } | |
897 else | |
898 { | |
899 float invmag = 1.0 / mag; | |
900 out->x = invmag * nx * 65536.0; | |
901 out->y = invmag * ny * 65536.0; | |
902 out->z = invmag * nz * 65536.0; | |
903 } | |
904 } | |
905 | |
0 | 906 //----- (0046DEF2) -------------------------------------------------------- |
907 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
908 { | |
909 unsigned int result; // eax@1 | |
910 | |
911 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
912 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 913 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
914 return result; | |
915 } | |
916 | |
917 //----- (0046DF1A) -------------------------------------------------------- | |
918 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
919 { | |
920 Actor *v2; // edi@1 | |
921 unsigned __int16 v3; // ax@1 | |
922 int v4; // esi@6 | |
923 int v5; // ecx@8 | |
924 int v6; // eax@10 | |
925 int v7; // edx@12 | |
926 int v8; // ecx@14 | |
927 int v9; // eax@14 | |
928 int v10; // ebx@14 | |
929 int v11; // esi@14 | |
930 int v12; // ebx@15 | |
931 int v13; // ebx@17 | |
932 unsigned int v14; // eax@20 | |
933 signed int result; // eax@21 | |
934 int v16; // [sp+Ch] [bp-10h]@1 | |
935 int v17; // [sp+10h] [bp-Ch]@14 | |
936 int v18; // [sp+14h] [bp-8h]@14 | |
937 int v19; // [sp+18h] [bp-4h]@14 | |
938 | |
939 v16 = a1; | |
940 v2 = &pActors[a1]; | |
941 v3 = v2->uAIState; | |
942 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
943 goto LABEL_25; | |
944 v4 = v2->uActorRadius; | |
945 if ( a2 ) | |
946 v4 = a2; | |
947 v5 = v2->vPosition.x; | |
948 if ( stru_721530.sMaxX > v5 + v4 | |
949 || stru_721530.sMinX < v5 - v4 | |
950 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
951 || stru_721530.sMinY < v6 - v4 | |
952 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
953 || stru_721530.sMinZ < v7 | |
954 || (v8 = v5 - stru_721530.normal.x, | |
955 v9 = v6 - stru_721530.normal.y, | |
956 v10 = stru_721530.prolly_normal_d + v4, | |
957 v17 = stru_721530.prolly_normal_d + v4, | |
958 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
959 v18 = v8, | |
960 v19 = v9, | |
961 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
962 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
963 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
964 { | |
965 LABEL_25: | |
966 result = 0; | |
967 } | |
968 else | |
969 { | |
295 | 970 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 971 if ( v13 < 0 ) |
972 v13 = 0; | |
973 if ( v13 < stru_721530.field_7C ) | |
974 { | |
975 stru_721530.field_7C = v13; | |
976 v14 = 8 * v16; | |
862 | 977 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 978 stru_721530.uFaceID = v14; |
979 } | |
980 result = 1; | |
981 } | |
982 return result; | |
983 } | |
984 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
985 | |
986 //----- (0046E0B2) -------------------------------------------------------- | |
987 void __cdecl _46E0B2_collide_against_decorations() | |
988 { | |
989 BLVSector *v0; // ebp@1 | |
990 LevelDecoration *v1; // edi@2 | |
991 DecorationDesc *v2; // esi@3 | |
992 int v3; // edx@4 | |
993 int v4; // eax@4 | |
994 int v5; // ecx@6 | |
995 int v6; // ebx@8 | |
996 int v7; // esi@8 | |
997 int v8; // ebx@10 | |
998 int v9; // esi@11 | |
999 int v10; // edi@12 | |
1000 int v11; // eax@12 | |
1001 int v12; // esi@14 | |
1002 unsigned int v13; // eax@17 | |
1003 signed int i; // [sp+4h] [bp-14h]@1 | |
1004 int v15; // [sp+8h] [bp-10h]@10 | |
1005 int v16; // [sp+Ch] [bp-Ch]@10 | |
1006 int v17; // [sp+10h] [bp-8h]@10 | |
1007 int v18; // [sp+14h] [bp-4h]@8 | |
1008 | |
1009 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1010 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1011 { | |
1012 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1013 if ( !(v1->field_2 & 0x20) ) | |
1014 { | |
1015 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1016 if (!v2->CanMoveThrough()) |
0 | 1017 { |
1018 v3 = v2->uRadius; | |
1019 v4 = v1->vPosition.x; | |
1020 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1021 { | |
1022 if ( stru_721530.sMinX >= v4 - v3 ) | |
1023 { | |
1024 v5 = v1->vPosition.y; | |
1025 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1026 { | |
1027 if ( stru_721530.sMinY >= v5 - v3 ) | |
1028 { | |
1029 v6 = v2->uDecorationHeight; | |
1030 v7 = v1->vPosition.z; | |
1031 v18 = v6; | |
1032 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1033 { | |
1034 if ( stru_721530.sMinZ >= v7 ) | |
1035 { | |
1036 v16 = v4 - stru_721530.normal.x; | |
1037 v15 = v5 - stru_721530.normal.y; | |
1038 v8 = stru_721530.prolly_normal_d + v3; | |
1039 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1040 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1041 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1042 { | |
1043 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1044 if ( v9 > 0 ) | |
1045 { | |
1046 v10 = v1->vPosition.z; | |
1047 v11 = stru_721530.normal.z | |
1048 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1049 if ( v11 >= v10 ) | |
1050 { | |
1051 if ( v11 <= v18 + v10 ) | |
1052 { | |
295 | 1053 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1054 if ( v12 < 0 ) |
1055 v12 = 0; | |
1056 if ( v12 < stru_721530.field_7C ) | |
1057 { | |
1058 stru_721530.field_7C = v12; | |
1059 v13 = 8 * v0->pDecorationIDs[i]; | |
1060 LOBYTE(v13) = v13 | 5; | |
1061 stru_721530.uFaceID = v13; | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 } | |
1072 } | |
1073 } | |
1074 } | |
1075 } | |
1076 } | |
1077 | |
1078 //----- (0046E26D) -------------------------------------------------------- | |
1079 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1080 { | |
1081 int v2; // edx@5 | |
1082 unsigned __int16 *v3; // eax@5 | |
1083 unsigned __int16 v4; // ax@6 | |
1084 LevelDecoration *v5; // edi@7 | |
1085 DecorationDesc *v6; // esi@8 | |
1086 int v7; // edx@9 | |
1087 int v8; // eax@9 | |
1088 int v9; // ecx@11 | |
1089 int v10; // ebx@13 | |
1090 int v11; // esi@13 | |
1091 int v12; // ebp@15 | |
1092 int v13; // ebx@15 | |
1093 int v14; // esi@16 | |
1094 int v15; // edi@17 | |
1095 int v16; // eax@17 | |
1096 int v17; // esi@19 | |
1097 char v18; // zf@23 | |
1098 int v19; // [sp+0h] [bp-10h]@15 | |
1099 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1100 int v21; // [sp+8h] [bp-8h]@15 | |
1101 int v22; // [sp+Ch] [bp-4h]@13 | |
1102 | |
1103 if ( a1 >= 0 ) | |
1104 { | |
1105 if ( a1 <= 127 ) | |
1106 { | |
1107 if ( a2 >= 0 ) | |
1108 { | |
1109 if ( a2 <= 127 ) | |
1110 { | |
1111 v2 = a1 + (a2 << 7); | |
1112 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1113 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1114 if ( v3 ) | |
1115 { | |
1116 do | |
1117 { | |
1118 v4 = *v3; | |
848 | 1119 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1120 { |
1121 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1122 if ( !(v5->field_2 & 0x20) ) | |
1123 { | |
1124 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1125 if (!v6->CanMoveThrough()) |
0 | 1126 { |
1127 v7 = v6->uRadius; | |
1128 v8 = v5->vPosition.x; | |
1129 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1130 { | |
1131 if ( stru_721530.sMinX >= v8 - v7 ) | |
1132 { | |
1133 v9 = v5->vPosition.y; | |
1134 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1135 { | |
1136 if ( stru_721530.sMinY >= v9 - v7 ) | |
1137 { | |
1138 v10 = v6->uDecorationHeight; | |
1139 v11 = v5->vPosition.z; | |
1140 v22 = v10; | |
1141 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1142 { | |
1143 if ( stru_721530.sMinZ >= v11 ) | |
1144 { | |
1145 v12 = v8 - stru_721530.normal.x; | |
1146 v19 = v9 - stru_721530.normal.y; | |
1147 v13 = stru_721530.prolly_normal_d + v7; | |
1148 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1149 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1150 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1151 { | |
1152 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1153 if ( v14 > 0 ) | |
1154 { | |
1155 v15 = v5->vPosition.z; | |
1156 v16 = stru_721530.normal.z | |
1157 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1158 if ( v16 >= v15 ) | |
1159 { | |
1160 if ( v16 <= v22 + v15 ) | |
1161 { | |
295 | 1162 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1163 if ( v17 < 0 ) |
1164 v17 = 0; | |
1165 if ( v17 < stru_721530.field_7C ) | |
1166 { | |
1167 stru_721530.field_7C = v17; | |
1168 stru_721530.uFaceID = (signed __int16)*v20; | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 } | |
1178 } | |
1179 } | |
1180 } | |
1181 } | |
1182 } | |
1183 v3 = v20 + 1; | |
1184 v18 = *v20 == 0; | |
1185 ++v20; | |
1186 } | |
1187 while ( !v18 ); | |
1188 } | |
1189 } | |
1190 } | |
1191 } | |
1192 } | |
1193 } | |
1194 | |
1195 //----- (00486F92) -------------------------------------------------------- | |
1196 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1197 { | |
1198 Span *v0; // ebx@1 | |
1199 int v1; // eax@2 | |
1200 Edge *v2; // ecx@3 | |
1201 Edge *v3; // edx@3 | |
1202 Edge *v4; // esi@6 | |
1203 Edge *v5; // eax@7 | |
1204 Edge *v6; // ecx@8 | |
1205 Surf *v7; // esi@11 | |
1206 double v8; // st7@13 | |
1207 Surf *v9; // edi@13 | |
1208 double v10; // st6@13 | |
1209 double v11; // st7@14 | |
1210 signed __int64 v12; // qax@14 | |
1211 stru148 *v13; // eax@15 | |
1212 Span *v14; // ecx@17 | |
1213 double v15; // st7@28 | |
1214 signed __int64 v16; // qax@28 | |
1215 stru148 *v17; // eax@29 | |
1216 Span *v18; // ecx@31 | |
1217 Edge *i; // eax@40 | |
1218 Edge *v20; // ecx@43 | |
1219 Edge *v21; // esi@44 | |
1220 double v22; // st7@45 | |
1221 Edge *v23; // edx@48 | |
1222 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1223 float v25; // [sp+14h] [bp-Ch]@3 | |
1224 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1225 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1226 | |
1227 v0 = pSpans; | |
1228 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1229 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1230 stru_80C9A4.pSurf = &stru_80C980; |
1231 stru_80C980.pPrev = &stru_80C980; | |
1232 stru_80C980.pNext = &stru_80C980; | |
693 | 1233 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1234 stru_80C980.field_8 = 0.0; |
1235 stru_80C980.field_4 = 0.0; | |
1236 stru_80C9D8.pNext = &stru_80C9A4; | |
1237 stru_80C9D8.pPrev = 0; | |
1238 stru_80C9D8.field_8 = 1; | |
1239 stru_80C9A4.pNext = 0; | |
1240 stru_80C9A4.pPrev = &stru_80C9D8; | |
1241 stru_80C9A4.field_8 = 0; | |
1242 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1243 v27 = pViewport->uViewportTL_Y; |
1244 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1245 { |
1246 LABEL_51: | |
1247 v0->field_8 = -1; | |
1248 } | |
1249 else | |
1250 { | |
693 | 1251 v1 = 52 * pViewport->uViewportTL_Y; |
1252 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1253 while ( 1 ) |
1254 { | |
1255 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1256 v3 = &stru_80C9D8; | |
1257 v25 = (double)(signed int)v27; | |
1258 if ( v2 != &defaultEdge ) | |
1259 { | |
1260 do | |
1261 { | |
1262 while ( 1 ) | |
1263 { | |
1264 v4 = v3->pNext; | |
1265 if ( v2->field_0 <= (double)v4->field_0 ) | |
1266 break; | |
1267 v3 = v3->pNext; | |
1268 } | |
1269 v5 = v2->pNext; | |
1270 v2->pNext = v4; | |
1271 v2->pPrev = v3; | |
1272 v3->pNext->pPrev = v2; | |
1273 v3->pNext = v2; | |
1274 v3 = v2; | |
1275 v2 = v5; | |
1276 } | |
1277 while ( v5 != &defaultEdge ); | |
1278 } | |
1279 v6 = stru_80C9D8.pNext; | |
1280 stru_80C980.field_20 = 0; | |
1281 stru_80C980.field_22 = 1; | |
1282 v26 = stru_80C9D8.pNext; | |
1283 if ( stru_80C9D8.pNext ) | |
1284 { | |
1285 while ( 1 ) | |
1286 { | |
1287 v7 = v6->pSurf; | |
1288 if ( v6->field_8 ) | |
1289 { | |
1290 ++v7->field_22; | |
1291 if ( v7->field_22 == 1 ) | |
1292 { | |
1293 v8 = v6->field_0 + 2.0; | |
1294 v9 = stru_80C980.pNext; | |
1295 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1296 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1297 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1298 + stru_80C980.pNext->field_0 ) | |
1299 { | |
1300 do | |
1301 v9 = v9->pNext; | |
1302 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1303 v7->pNext = v9; | |
1304 v7->pPrev = v9->pPrev; | |
1305 v9->pPrev->pNext = v7; | |
1306 v9->pPrev = v7; | |
1307 } | |
1308 else | |
1309 { | |
1310 v11 = v6->field_0 + 0.5; | |
1311 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1312 v0->field_C = v12; | |
1313 if ( (signed __int16)v12 > 0 ) | |
1314 { | |
1315 v0->field_A = v27; | |
1316 v0->field_8 = v9->field_20; | |
1317 v13 = v9->pParent; | |
1318 v0->pParent = v13; | |
1319 if ( v13 ) | |
1320 { | |
1321 if ( v13->prolly_head ) | |
1322 { | |
1323 v14 = v13->prolly_tail; | |
1324 if ( !v14 ) | |
1325 return; | |
1326 v14->pNext = v0; | |
1327 } | |
1328 else | |
1329 { | |
1330 v13->prolly_head = v0; | |
1331 } | |
1332 v13->prolly_tail = v0; | |
1333 } | |
1334 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1335 return; | |
1336 ++v0; | |
1337 ++pOutdoorCamera->uNumSpans; | |
1338 } | |
1339 v6 = v26; | |
1340 v7->field_20 = (signed __int64)v11; | |
1341 v7->pNext = v9; | |
1342 v9->pPrev = v7; | |
1343 stru_80C980.pNext = v7; | |
1344 v7->pPrev = &stru_80C980; | |
1345 } | |
1346 } | |
1347 } | |
1348 else | |
1349 { | |
1350 --v7->field_22; | |
1351 if ( !v7->field_22 ) | |
1352 { | |
1353 if ( stru_80C980.pNext == v7 ) | |
1354 { | |
1355 v15 = v6->field_0 + 0.5; | |
1356 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1357 v0->field_C = v16; | |
1358 if ( (signed __int16)v16 > 0 ) | |
1359 { | |
1360 v0->field_A = v27; | |
1361 v0->field_8 = v7->field_20; | |
1362 v17 = v7->pParent; | |
1363 v0->pParent = v17; | |
1364 if ( v17 ) | |
1365 { | |
1366 if ( v17->prolly_head ) | |
1367 { | |
1368 v18 = v17->prolly_tail; | |
1369 if ( !v18 ) | |
1370 return; | |
1371 v18->pNext = v0; | |
1372 } | |
1373 else | |
1374 { | |
1375 v17->prolly_head = v0; | |
1376 } | |
1377 v17->prolly_tail = v0; | |
1378 } | |
1379 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1380 return; | |
1381 ++v0; | |
1382 ++pOutdoorCamera->uNumSpans; | |
1383 } | |
1384 v7->pNext->field_20 = (signed __int64)v15; | |
1385 v6 = v26; | |
1386 } | |
1387 v7->pNext->pPrev = v7->pPrev; | |
1388 v7->pPrev->pNext = v7->pNext; | |
1389 } | |
1390 } | |
1391 v26 = v6->pNext; | |
1392 if ( !v26 ) | |
1393 break; | |
1394 v6 = v6->pNext; | |
1395 } | |
1396 } | |
1397 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1398 { | |
1399 i->pPrev->pNext = i->pNext; | |
1400 i->pNext->pPrev = i->pPrev; | |
1401 } | |
1402 v20 = stru_80C9D8.pNext; | |
1403 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1404 break; | |
1405 LABEL_50: | |
1406 ++v27; | |
1407 v1 = v24 + 52; | |
1408 v24 += 52; | |
693 | 1409 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1410 goto LABEL_51; |
1411 } | |
1412 while ( 1 ) | |
1413 { | |
1414 v21 = v20->pNext; | |
1415 if ( !v21 ) | |
1416 break; | |
1417 v22 = v20->field_4 + v20->field_0; | |
1418 v20->field_0 = v22; | |
1419 if ( v22 < stru_80C9D8.field_0 ) | |
1420 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1421 while ( 1 ) | |
1422 { | |
1423 v23 = v20->pPrev; | |
1424 if ( v20->field_0 >= (double)v23->field_0 ) | |
1425 break; | |
1426 v23->pNext = v20->pNext; | |
1427 v20->pNext->pPrev = v23; | |
1428 v23->pPrev->pNext = v20; | |
1429 v20->pPrev = v23->pPrev; | |
1430 v20->pNext = v23; | |
1431 v23->pPrev = v20; | |
1432 } | |
1433 v20 = v21; | |
1434 if ( v21 == &stru_80C9A4 ) | |
1435 goto LABEL_50; | |
1436 } | |
1437 } | |
1438 } | |
1439 // 4EC3EC: using guessed type Edge defaultEdge; | |
1440 | |
1441 //----- (00487355) -------------------------------------------------------- | |
1442 bool OutdoorCamera::_487355() | |
1443 { | |
1444 int v0; // esi@1 | |
1445 stru148 *v1; // edi@2 | |
1446 bool result; // eax@3 | |
1447 | |
1448 v0 = 0; | |
1449 if ( pOutdoorCamera->numStru148s > 0 ) | |
1450 { | |
1451 v1 = array_77EC08; | |
1452 do | |
1453 { | |
1454 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1455 ++v0; | |
1456 ++v1; | |
1457 } | |
1458 while ( v0 < pOutdoorCamera->numStru148s ); | |
1459 } | |
1460 return result; | |
1461 } | |
1462 | |
1463 //----- (00487DA9) -------------------------------------------------------- | |
1464 void __cdecl sub_487DA9() | |
1465 { | |
1466 char *v0; // eax@1 | |
1467 | |
1468 v0 = &array_77EC08[0].field_108; | |
1469 do | |
1470 { | |
1471 *v0 = 0; | |
1472 v0 += 268; | |
1473 } | |
1474 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1475 } | |
1476 | |
1477 //----- (00487DBE) -------------------------------------------------------- | |
1478 void Software_ResetNewEdges() | |
1479 { | |
1480 int v0; // ecx@1 | |
1481 Edge **v1; // eax@1 | |
1482 signed int v2; // eax@3 | |
1483 | |
1484 v0 = 0; | |
1485 v1 = ptr_80CA10; | |
1486 do | |
1487 { | |
1488 ++v0; | |
1489 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1490 *v1 = 0; | |
1491 ++v1; | |
1492 } | |
1493 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1494 v2 = 2000; | |
1495 do | |
1496 { | |
1497 pSurfs->field_22 = 0; | |
1498 --v2; | |
1499 } | |
1500 while ( v2 ); | |
1501 } | |
1502 // 4EC3EC: using guessed type Edge defaultEdge; | |
1503 | |
1504 //----- (0048958E) -------------------------------------------------------- | |
1505 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1506 { | |
1507 stru12_MemoryBlock *v2; // esi@1 | |
1508 void *v3; // eax@1 | |
1509 void *v4; // ecx@1 | |
1510 stru12_MemoryBlock *result; // eax@1 | |
1511 | |
1512 v2 = this; | |
1513 v3 = operator new(8 * a2 + 16); | |
1514 v2->pBlockBase = v3; | |
848 | 1515 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1516 result = v2; |
1517 v2->pAlignedBlock = v4; | |
1518 } | |
1519 | |
1520 //----- (004895B7) -------------------------------------------------------- | |
1521 stru12::stru12(stru11 *pStru11) | |
1522 { | |
1523 stru12 *v2; // esi@1 | |
1524 | |
1525 v2 = this; | |
1526 this->field_44 = 0x41000000u; | |
1527 this->field_4C = 0x46000000u; | |
1528 //this->vdestructor_ptr = stru12::_4898E6; | |
1529 this->field_48 = 0; | |
1530 this->field_50 = 0; | |
1531 this->field_54 = 0x33D6BF95u; | |
1532 this->field_58 = 0; | |
1533 | |
1534 for (int i = 0; i < 12; ++i) | |
1535 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1536 /* | |
1537 v3 = (stru12_MemoryBlock *)operator new(8u); | |
1538 if ( v3 ) | |
1539 v4 = AllocAlignedMem(v3, 640); | |
1540 else | |
1541 v4 = 0; | |
1542 v2->pMemBlocks[0] = v4; | |
1543 /*v5 = (stru12_MemoryBlock *)operator new(8u); | |
1544 if ( v5 ) | |
1545 v6 = AllocAlignedMem(v5, 640); | |
1546 else | |
1547 v6 = 0; | |
1548 v2->pMemBlocks[1] = v6; | |
1549 v7 = (stru12_MemoryBlock *)operator new(8u); | |
1550 if ( v7 ) | |
1551 v8 = AllocAlignedMem(v7, 640); | |
1552 else | |
1553 v8 = 0; | |
1554 v2->pMemBlocks[2] = v8; | |
1555 v9 = (stru12_MemoryBlock *)operator new(8u); | |
1556 if ( v9 ) | |
1557 v10 = AllocAlignedMem(v9, 640); | |
1558 else | |
1559 v10 = 0; | |
1560 v2->pMemBlocks[3] = v10; | |
1561 v11 = (stru12_MemoryBlock *)operator new(8u); | |
1562 if ( v11 ) | |
1563 v12 = AllocAlignedMem(v11, 640); | |
1564 else | |
1565 v12 = 0; | |
1566 v2->pMemBlocks[4] = v12; | |
1567 v13 = (stru12_MemoryBlock *)operator new(8u); | |
1568 if ( v13 ) | |
1569 v14 = AllocAlignedMem(v13, 640); | |
1570 else | |
1571 v14 = 0; | |
1572 v2->pMemBlocks[5] = v14; | |
1573 v15 = (stru12_MemoryBlock *)operator new(8u); | |
1574 if ( v15 ) | |
1575 v16 = AllocAlignedMem(v15, 640); | |
1576 else | |
1577 v16 = 0; | |
1578 v2->pMemBlocks[6] = v16; | |
1579 v17 = (stru12_MemoryBlock *)operator new(8u); | |
1580 if ( v17 ) | |
1581 v18 = AllocAlignedMem(v17, 640); | |
1582 else | |
1583 v18 = 0; | |
1584 v2->pMemBlocks[7] = v18; | |
1585 v19 = (stru12_MemoryBlock *)operator new(8u); | |
1586 if ( v19 ) | |
1587 v20 = AllocAlignedMem(v19, 640); | |
1588 else | |
1589 v20 = 0; | |
1590 v2->pMemBlocks[8] = v20; | |
1591 v21 = (stru12_MemoryBlock *)operator new(8u); | |
1592 if ( v21 ) | |
1593 v22 = AllocAlignedMem(v21, 640); | |
1594 else | |
1595 v22 = 0; | |
1596 v2->pMemBlocks[9] = v22; | |
1597 v23 = (stru12_MemoryBlock *)operator new(8u); | |
1598 if ( v23 ) | |
1599 v24 = AllocAlignedMem(v23, 640); | |
1600 else | |
1601 v24 = 0; | |
1602 v2->pMemBlocks[10] = v24; | |
1603 v25 = (stru12_MemoryBlock *)operator new(8u); | |
1604 if ( v25 ) | |
1605 v26 = AllocAlignedMem(v25, 640); | |
1606 else | |
1607 v26 = 0; | |
1608 v2->field_8C = 0; | |
1609 v2->pMemBlocks[11] = v26;*/ | |
1610 } | |
1611 | |
1612 //----- (00489810) -------------------------------------------------------- | |
1613 stru12::~stru12() | |
1614 { | |
1615 for (int i = 0; i < 12; ++i) | |
1616 delete pMemBlocks[i]; | |
1617 /*if ( v2 ) | |
1618 stru12_MemoryBlock::dtor(v2, 1); | |
1619 v3 = v1->pMemBlocks[1]; | |
1620 if ( v3 ) | |
1621 stru12_MemoryBlock::dtor(v3, 1); | |
1622 v4 = v1->pMemBlocks[2]; | |
1623 if ( v4 ) | |
1624 stru12_MemoryBlock::dtor(v4, 1); | |
1625 v5 = v1->pMemBlocks[3]; | |
1626 if ( v5 ) | |
1627 stru12_MemoryBlock::dtor(v5, 1); | |
1628 v6 = v1->pMemBlocks[4]; | |
1629 if ( v6 ) | |
1630 stru12_MemoryBlock::dtor(v6, 1); | |
1631 v7 = v1->pMemBlocks[5]; | |
1632 if ( v7 ) | |
1633 stru12_MemoryBlock::dtor(v7, 1); | |
1634 v8 = v1->pMemBlocks[6]; | |
1635 if ( v8 ) | |
1636 stru12_MemoryBlock::dtor(v8, 1); | |
1637 v9 = v1->pMemBlocks[7]; | |
1638 if ( v9 ) | |
1639 stru12_MemoryBlock::dtor(v9, 1); | |
1640 v10 = v1->pMemBlocks[8]; | |
1641 if ( v10 ) | |
1642 stru12_MemoryBlock::dtor(v10, 1); | |
1643 v11 = v1->pMemBlocks[9]; | |
1644 if ( v11 ) | |
1645 stru12_MemoryBlock::dtor(v11, 1); | |
1646 v12 = v1->pMemBlocks[10]; | |
1647 if ( v12 ) | |
1648 stru12_MemoryBlock::dtor(v12, 1); | |
1649 v13 = v1->pMemBlocks[11]; | |
1650 if ( v13 ) | |
1651 stru12_MemoryBlock::dtor(v13, 1);*/ | |
1652 } | |
1653 | |
1654 //----- (004898BF) -------------------------------------------------------- | |
1655 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1656 { | |
1657 stru12_MemoryBlock *v2; // esi@1 | |
1658 void *v3; // ST00_4@1 | |
1659 | |
1660 v2 = this; | |
1661 v3 = this->pBlockBase; | |
1662 this->pAlignedBlock = 0; | |
1663 free(v3); | |
1664 v2->pBlockBase = 0; | |
1665 /*if ( a2 & 1 ) | |
1666 free(v2);*/ | |
1667 } | |
1668 | |
1669 //----- (004898E6) -------------------------------------------------------- | |
1670 void stru12::_4898E6() | |
1671 { | |
1672 void *v1; // eax@1 | |
1673 void *v2; // edx@1 | |
1674 char *v3; // edi@2 | |
1675 double v4; // st7@2 | |
1676 char *v5; // ebx@2 | |
1677 double v6; // st6@3 | |
1678 double v7; // st5@3 | |
1679 double v8; // st4@3 | |
1680 int v9; // esi@3 | |
1681 double v10; // st3@3 | |
1682 float v11; // ST34_4@5 | |
1683 double v12; // st6@10 | |
1684 double v13; // ST0C_8@10 | |
1685 char *v14; // [sp+14h] [bp-44h]@2 | |
1686 char *v15; // [sp+18h] [bp-40h]@2 | |
1687 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1688 char *v17; // [sp+20h] [bp-38h]@2 | |
1689 char *v18; // [sp+24h] [bp-34h]@2 | |
1690 float v19; // [sp+30h] [bp-28h]@3 | |
1691 float v20; // [sp+38h] [bp-20h]@3 | |
1692 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1693 int v22; // [sp+40h] [bp-18h]@1 | |
1694 char *v23; // [sp+44h] [bp-14h]@2 | |
1695 char *v24; // [sp+48h] [bp-10h]@2 | |
1696 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1697 float v26; // [sp+50h] [bp-8h]@3 | |
1698 float v27; // [sp+54h] [bp-4h]@3 | |
1699 | |
731 | 1700 __debugbreak(); |
0 | 1701 v22 = 0; |
1702 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1703 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1704 if ( this->field_8C > 0 ) | |
1705 { | |
1706 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1707 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1708 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1709 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1710 v25 = (int)v1 - (int)v2; | |
1711 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1712 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1713 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1714 v4 = 1.0; | |
1715 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1716 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1717 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1718 do | |
1719 { | |
1720 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1721 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1722 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1723 v7 = pIndoorCamera->fRotationYCosine; | |
1724 v8 = pIndoorCamera->fRotationYSine; | |
1725 v20 = pIndoorCamera->fRotationXCosine; | |
1726 v19 = pIndoorCamera->fRotationXSine; | |
1727 v9 = (int)((char *)v2 + (int)v21); | |
1728 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1729 if ( pIndoorCamera->sRotationX ) | |
1730 { | |
1731 v11 = v10; | |
1732 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1733 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1734 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1735 } | |
1736 else | |
1737 { | |
1738 *(float *)v9 = v10; | |
1739 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1740 *(float *)((char *)v2 + (int)v5) = v6; | |
1741 } | |
1742 if ( *(float *)v9 >= 8.0 ) | |
1743 { | |
1744 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1745 { | |
1746 *(int *)v2 = 0; | |
1747 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1748 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1749 - v12 * *(float *)((char *)v2 + (int)v3); | |
1750 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1751 - v12 * *(float *)((char *)v2 + (int)v5); | |
1752 *(float *)((char *)v2 + (int)v16) = v4 | |
1753 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1754 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1755 v13 = *(float *)v9 + 6.7553994e15; | |
1756 v4 = 1.0; | |
1757 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1758 } | |
1759 else | |
1760 { | |
1761 *(int *)v2 = 2; | |
1762 } | |
1763 } | |
1764 else | |
1765 { | |
1766 *(int *)v2 = 1; | |
1767 } | |
1768 ++v22; | |
1769 v2 = (char *)v2 + 4; | |
1770 } | |
1771 while ( v22 < this->field_8C ); | |
1772 } | |
1773 this->field_8C = 0; | |
1774 } | |
1775 | |
1776 //----- (0048A959) -------------------------------------------------------- | |
1777 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1778 { | |
1779 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1780 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1781 b = (uColor & 0x000000FF) / 255.0f; | |
1782 | |
1783 float h, s, v; | |
1784 RGB2HSV(&h, &s, r, g, b, &v); | |
1785 | |
1786 if ( h_replace != -1.0 ) | |
1787 h = h_replace; | |
1788 if ( s_replace != -1.0 ) | |
1789 s = s_replace; | |
1790 if ( v_replace != -1.0 ) | |
1791 v = v_replace; | |
1792 HSV2RGB(&r, &g, &b, h, s, v); | |
1793 | |
1794 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1795 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1796 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1797 } | |
1798 | |
1799 //----- (0048B561) -------------------------------------------------------- | |
1800 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2) | |
1801 { | |
1802 //v2 = a2 - 0.5; | |
1803 //v3 = v2 + 6.7553994e15; | |
1804 int v4 = floorf(a2 - 0.5f + 0.5f); | |
1805 //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0; | |
1806 //v5 = v7 + 6.7553994e15; | |
1807 //return LODWORD(v5) | (v4 << 16); | |
1808 int v5 = floorf((a2 - v4) * 65536.0f + 0.5f); | |
1809 return v5 | (v4 << 16); | |
1810 } | |
1811 | |
1812 //----- (00491E3A) -------------------------------------------------------- | |
1813 void __cdecl sub_491E3A() | |
1814 { | |
1815 Player *v0; // ebx@1 | |
1816 signed int v1; // esi@3 | |
1817 char *v2; // eax@4 | |
1818 unsigned int v3; // eax@7 | |
1819 unsigned int v4; // edx@8 | |
1820 char *v5; // ecx@9 | |
1821 int v6; // edi@17 | |
1822 Texture *v7; // ebx@18 | |
1823 struct IDirect3DTexture2 **v8; // eax@19 | |
1824 struct IDirect3DTexture2 *v9; // eax@20 | |
1825 struct IDirectDrawSurface **v10; // eax@22 | |
1826 struct IDirectDrawSurface *v11; // eax@23 | |
1827 int v12; // eax@26 | |
1828 | |
1829 v0 = pParty->pPlayers; | |
1830 do | |
1831 { | |
203 | 1832 if (SoundSetAction[24][0]) |
0 | 1833 { |
1834 v1 = 0; | |
764 | 1835 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1836 { |
1837 LABEL_7: | |
1838 v3 = 0; | |
1839 } | |
1840 else | |
1841 { | |
1842 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1843 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1844 { |
1845 ++v1; | |
1846 v2 += 120; | |
764 | 1847 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1848 goto LABEL_7; |
1849 } | |
1850 v3 = v1; | |
1851 } | |
764 | 1852 pSoundList->UnloadSound(v3, 1); |
0 | 1853 v4 = 0; |
764 | 1854 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1855 { |
1856 LABEL_12: | |
1857 v4 = 0; | |
1858 } | |
1859 else | |
1860 { | |
1861 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1862 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1863 { |
1864 ++v4; | |
1865 v5 += 120; | |
764 | 1866 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1867 goto LABEL_12; |
1868 } | |
1869 } | |
764 | 1870 pSoundList->UnloadSound(v4, 1); |
0 | 1871 } |
1872 ++v0; | |
1873 } | |
1874 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1875 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1876 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1877 { |
1878 v7 = &pIcons_LOD->pTextures[v6]; | |
1879 do | |
1880 { | |
1881 v7->Release(); | |
1882 v8 = pIcons_LOD->pHardwareTextures; | |
1883 if ( v8 ) | |
1884 { | |
1885 v9 = v8[v6]; | |
1886 if ( v9 ) | |
1887 { | |
1888 v9->Release(); | |
1889 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1890 } | |
1891 } | |
1892 v10 = pIcons_LOD->pHardwareSurfaces; | |
1893 if ( v10 ) | |
1894 { | |
1895 v11 = v10[v6]; | |
1896 if ( v11 ) | |
1897 { | |
1898 v11->Release(); | |
1899 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1900 } | |
1901 } | |
1902 --v6; | |
1903 --v7; | |
1904 } | |
33 | 1905 while ( v6 >= pIcons_LOD->pFacesLock ); |
1906 } | |
1907 v12 = pIcons_LOD->pFacesLock; | |
1908 pIcons_LOD->pFacesLock = 0; | |
0 | 1909 pIcons_LOD->uNumLoadedFiles = v12; |
1910 } | |
1911 // 4ED498: using guessed type char byte_4ED498; | |
1912 | |
1913 //----- (0049387A) -------------------------------------------------------- | |
1914 int CycleCharacter(unsigned int _this) | |
1915 { | |
1916 signed int result; // eax@1 | |
1917 signed int v2; // ecx@2 | |
1918 signed int v3; // ecx@8 | |
1919 | |
1920 result = uActiveCharacter; | |
1921 if ( _this ) | |
1922 { | |
1923 v2 = 0; | |
1924 while ( 1 ) | |
1925 { | |
1926 --result; | |
1927 if ( result < 1 ) | |
1928 result = 4; | |
1929 if ( !pPlayers[result]->uTimeToRecovery ) | |
1930 break; | |
1931 ++v2; | |
1932 if ( v2 >= 4 ) | |
1933 return uActiveCharacter; | |
1934 } | |
1935 } | |
1936 else | |
1937 { | |
1938 v3 = 0; | |
1939 while ( 1 ) | |
1940 { | |
1941 ++result; | |
1942 if ( result > 4 ) | |
1943 result = 1; | |
1944 if ( !pPlayers[result]->uTimeToRecovery ) | |
1945 break; | |
1946 ++v3; | |
1947 if ( v3 >= 4 ) | |
1948 return uActiveCharacter; | |
1949 } | |
1950 } | |
1951 return result; | |
1952 } | |
1953 | |
1954 //----- (004938D1) -------------------------------------------------------- | |
1955 void __fastcall Rest(unsigned int uHoursToSleep) | |
1956 { | |
1957 unsigned int v1; // esi@1 | |
1958 double v2; // st7@3 | |
1959 Player **v3; // esi@3 | |
1960 | |
1961 v1 = uHoursToSleep; | |
1962 if ( uHoursToSleep > 240 ) | |
1963 InitializeActors(); | |
1964 v2 = (double)(7680 * v1) * 0.033333335; | |
1965 pParty->uTimePlayed += (signed __int64)v2; | |
1966 v3 = &pPlayers[1]; | |
1967 do | |
1968 { | |
1969 (*v3)->Recover((signed __int64)v2); | |
1970 ++v3; | |
1971 } | |
1972 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1973 _494035_timed_effects__water_walking_damage__etc(); | |
1974 } | |
1975 | |
1976 //----- (00493938) -------------------------------------------------------- | |
1977 int __cdecl _493938_regenerate() | |
1978 { | |
1979 int v0; // edi@1 | |
1980 signed __int64 v1; // qax@1 | |
1981 int v2; // ecx@1 | |
1982 int result; // eax@1 | |
1983 int v4; // eax@2 | |
1984 int v5; // edi@5 | |
112 | 1985 int *v6; // ecx@5 |
0 | 1986 char v7; // sf@5 |
112 | 1987 int *v8; // ecx@10 |
0 | 1988 int v9; // edi@15 |
1989 signed int v10; // eax@15 | |
1990 __int16 *v11; // edx@16 | |
1991 int v12; // eax@20 | |
1992 int v13; // ebx@20 | |
1993 unsigned int *v14; // esi@21 | |
1994 unsigned int v15; // ecx@21 | |
1995 unsigned int v16; // eax@21 | |
1996 int v17; // edx@21 | |
1997 int v18; // eax@21 | |
1998 signed int v19; // eax@21 | |
1999 signed int v20; // ebx@25 | |
2000 Player *v21; // esi@25 | |
2001 ITEM_EQUIP_TYPE v22; // edi@30 | |
2002 //int v23; // edx@31 | |
2003 signed int v24; // ecx@32 | |
2004 signed int v25; // eax@33 | |
2005 int v26; // eax@35 | |
2006 int v27; // eax@36 | |
2007 int v28; // eax@37 | |
2008 int v29; // eax@40 | |
2009 int v30; // eax@41 | |
2010 signed int v31; // ecx@53 | |
2011 char *v32; // eax@53 | |
2012 char *v33; // edi@82 | |
2013 int v34; // ecx@88 | |
2014 int v35; // eax@88 | |
2015 char *v36; // edi@99 | |
2016 int v37; // edi@104 | |
2017 int v38; // edi@106 | |
2018 int v39; // edi@111 | |
2019 int v40; // ecx@113 | |
2020 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
|
2021 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 2022 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
2023 int v44; // [sp+210h] [bp-20h]@22 | |
2024 int v45; // [sp+214h] [bp-1Ch]@25 | |
2025 int v46; // [sp+218h] [bp-18h]@25 | |
2026 int v47; // [sp+21Ch] [bp-14h]@25 | |
2027 int v48; // [sp+220h] [bp-10h]@25 | |
2028 int v49; // [sp+224h] [bp-Ch]@24 | |
2029 int v50; // [sp+228h] [bp-8h]@25 | |
2030 int v51; // [sp+22Ch] [bp-4h]@2 | |
2031 | |
2032 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
2033 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
2034 v2 = (signed int)v1 / 60; | |
2035 result = (signed int)v1 / 60 + 5; | |
2036 if ( v0 >= result ) | |
2037 { | |
2038 v51 = 0; | |
2039 v4 = (v0 - v2) / 5; | |
2040 if (pParty->FlyActive()) | |
2041 { | |
2042 if ( pParty->bFlying ) | |
2043 { | |
569 | 2044 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
2045 { // colliding with something in the air - fall down | |
2046 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
2047 //__debugbreak(); | |
2048 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000]; | |
112 | 2049 v7 = *v6 < v5; |
2050 *v6 -= v5; | |
0 | 2051 if ( v7 ) |
2052 { | |
112 | 2053 *v6 = 0; |
0 | 2054 pParty->uFlags &= 0xFFFFFFBFu; |
2055 pParty->bFlying = 0; | |
2056 v51 = 1; | |
2057 } | |
2058 } | |
2059 } | |
2060 } | |
569 | 2061 |
0 | 2062 if (pParty->WaterWalkActive()) |
2063 { | |
569 | 2064 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
2065 { | |
2066 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
2067 { // taking on water | |
2068 //__debugbreak(); | |
2069 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000]; | |
112 | 2070 v7 = *v8 < v4; |
2071 *v8 -= v4; | |
0 | 2072 if ( v7 ) |
2073 { | |
112 | 2074 *v8 = 0; |
569 | 2075 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 2076 v51 = 1; |
2077 } | |
2078 } | |
2079 } | |
2080 } | |
569 | 2081 |
0 | 2082 if (pParty->ImmolationActive()) |
2083 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2084 //SpriteObject::SpriteObject(&a1); |
0 | 2085 v9 = 0; |
2086 a3.z = 0; | |
2087 a3.y = 0; | |
2088 a3.x = 0; | |
2089 a1.stru_24.Reset(); | |
822 | 2090 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
2091 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 2092 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2093 a1.uType = 1070; |
822 | 2094 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 2095 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
2096 { | |
2097 LABEL_19: | |
2098 LOWORD(v10) = 0; | |
2099 } | |
2100 else | |
2101 { | |
2102 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 2103 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 2104 { |
2105 ++v10; | |
2106 v11 += 28; | |
2107 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
2108 goto LABEL_19; | |
2109 } | |
2110 } | |
2111 a1.uObjectDescID = v10; | |
2112 a1.field_60_distance_related_prolly_lod = 0; | |
2113 v12 = 8 * pParty->pPartyBuffs[10].uCaster; | |
303 | 2114 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 2115 a1.uAttributes = 0; |
2116 a1.uSectorID = 0; | |
2117 a1.uSpriteFrameID = 0; | |
822 | 2118 a1.spell_caster_pid = v12; |
0 | 2119 a1.uFacing = 0; |
2120 a1.uSoundID = 0; | |
2121 v13 = sub_46A89E((int)v41, 100, 307); | |
2122 if ( v13 > 0 ) | |
2123 { | |
2124 do | |
2125 { | |
2126 v14 = (unsigned int *)&v41[4 * v9]; | |
2127 v15 = *v14; | |
2128 v16 = *v14; | |
2129 a1.vPosition.x = pActors[v16].vPosition.x; | |
2130 v17 = pActors[v16].vPosition.y; | |
2131 a1.vPosition.z = pActors[v16].vPosition.z; | |
2132 v18 = 8 * v15; | |
862 | 2133 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2134 a1.vPosition.y = v17; |
823 | 2135 a1.spell_target_pid = v18; |
0 | 2136 v19 = a1.Create(0, 0, 0, 0); |
862 | 2137 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2138 ++v9; |
2139 } | |
2140 while ( v9 < v13 ); | |
2141 } | |
2142 } | |
2143 v44 = 0; | |
248 | 2144 if (PartyHasDragon()) |
0 | 2145 v44 = 1; |
2146 v49 = 0; | |
2147 LABEL_25: | |
2148 v20 = 0; | |
2149 v21 = &pParty->pPlayers[v49]; | |
2150 v50 = 0; | |
2151 v47 = 0; | |
2152 v45 = 0; | |
2153 v48 = 0; | |
2154 v46 = 0; | |
255 | 2155 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2156 v50 = 1; |
135 | 2157 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2158 v48 = 1; |
2159 v22 = (ITEM_EQUIP_TYPE)0; | |
2160 while ( 1 ) | |
2161 { | |
2162 if ( v21->HasItemEquipped(v22) ) | |
2163 { | |
2164 //v23 = v21->pEquipment.pIndices; | |
2165 auto _idx = v21->pEquipment.pIndices[v22]; | |
2166 v24 = v21->pInventoryItems[_idx].uItemID; | |
2167 if ( v24 > 134 ) | |
2168 { | |
2169 if ( v24 == 529 ) | |
2170 goto LABEL_43; | |
2171 if ( v24 == 535 ) | |
2172 goto LABEL_44; | |
2173 if ( v24 == 515 ) | |
2174 { | |
2175 v47 = 1; | |
2176 } | |
2177 else | |
2178 { | |
2179 if ( v24 == 532 ) | |
2180 goto LABEL_50; | |
2181 } | |
2182 } | |
2183 else | |
2184 { | |
377 | 2185 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2186 if ( v25 <= 50 ) |
2187 { | |
2188 if ( v25 != 50 ) | |
2189 { | |
2190 v26 = v25 - 37; | |
2191 if ( v26 ) | |
2192 { | |
2193 v27 = v26 - 1; | |
2194 if ( !v27 ) | |
2195 goto LABEL_50; | |
2196 v28 = v27 - 6; | |
2197 if ( v28 ) | |
2198 { | |
2199 if ( v28 != 3 ) | |
2200 goto LABEL_51; | |
2201 LABEL_50: | |
2202 v50 = 1; | |
2203 goto LABEL_51; | |
2204 } | |
2205 } | |
2206 } | |
2207 LABEL_44: | |
2208 v20 = 1; | |
2209 goto LABEL_51; | |
2210 } | |
2211 v29 = v25 - 54; | |
2212 if ( !v29 ) | |
2213 goto LABEL_44; | |
2214 v30 = v29 - 1; | |
2215 if ( !v30 ) | |
2216 goto LABEL_50; | |
2217 if ( v30 == 11 ) | |
2218 { | |
2219 LABEL_43: | |
2220 v20 = 1; | |
2221 v50 = 1; | |
2222 goto LABEL_51; | |
2223 } | |
2224 } | |
2225 } | |
2226 LABEL_51: | |
2227 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2228 if ( (signed int)v22 >= 16 ) | |
2229 { | |
2230 if ( v48 ) | |
2231 { | |
2232 v31 = 0; | |
2233 v32 = (char *)v21->pInventoryItems; | |
2234 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2235 { | |
2236 ++v31; | |
2237 v32 += 36; | |
2238 if ( v31 >= 138 ) | |
2239 goto LABEL_59; | |
2240 } | |
2241 v48 = 0; | |
2242 v45 = 1; | |
2243 } | |
2244 LABEL_59: | |
2245 if ( v21->pConditions[17] ) | |
2246 v46 = 1; | |
2247 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2248 { | |
2249 ++v21->sHealth; | |
2250 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2251 v21->sHealth = v21->GetMaxHealth(); | |
2252 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2253 { | |
2254 LODWORD(v21->pConditions[13]) = 0; | |
2255 HIDWORD(v21->pConditions[13]) = 0; | |
2256 } | |
2257 v51 = 1; | |
2258 } | |
2259 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2260 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2261 && !v21->pConditions[14] | |
2262 && !v21->pConditions[16] ) | |
2263 { | |
2264 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2265 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2266 v21->sHealth = v21->GetMaxHealth(); | |
2267 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2268 { | |
2269 LODWORD(v21->pConditions[13]) = 0; | |
2270 HIDWORD(v21->pConditions[13]) = 0; | |
2271 } | |
2272 v51 = 1; | |
2273 } | |
2274 if ( v50 ) | |
2275 { | |
2276 v33 = (char *)&v21->sMana; | |
2277 ++*(int *)v33; | |
2278 if ( v21->sMana > v21->GetMaxMana() ) | |
2279 *(int *)v33 = v21->GetMaxMana(); | |
2280 v51 = 1; | |
2281 } | |
2282 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2283 { | |
2284 v34 = LODWORD(v21->pConditions[13]); | |
2285 --v21->sHealth; | |
2286 v35 = v21->sHealth; | |
2287 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2288 v21->pConditions[13] = pParty->uTimePlayed; | |
2289 if ( v35 < 1 ) | |
2290 { | |
2291 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2292 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2293 { | |
2294 v21->pConditions[13] = pParty->uTimePlayed; | |
2295 } | |
2296 else | |
2297 { | |
2298 if ( !v21->pConditions[14] ) | |
2299 v21->pConditions[14] = pParty->uTimePlayed; | |
2300 } | |
2301 } | |
2302 v51 = 1; | |
2303 } | |
2304 if ( v45 ) | |
2305 { | |
2306 v36 = (char *)&v21->sMana; | |
2307 ++*(int *)v36; | |
2308 if ( v21->sMana > v21->GetMaxMana() ) | |
2309 *(int *)v36 = v21->GetMaxMana(); | |
2310 } | |
2311 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2312 { | |
2313 v37 = v21->sHealth; | |
2314 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2315 v21->sHealth = v37 - 2; | |
2316 v38 = v21->sMana; | |
2317 if ( v38 > v21->GetMaxMana() / 2 ) | |
2318 v21->sMana = v38 - 2; | |
2319 } | |
2320 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2321 { | |
2322 v39 = v21->sHealth; | |
2323 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2324 v21->sHealth = v39 - 1; | |
2325 v40 = v21->sMana; | |
2326 if ( v40 > 0 ) | |
2327 v21->sMana = v40 - 1; | |
2328 } | |
2329 ++v49; | |
2330 if ( v49 >= 4 ) | |
2331 { | |
2332 result = HIDWORD(pParty->uTimePlayed); | |
2333 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2334 if ( !viewparams->bRedrawGameUI ) | |
2335 { | |
2336 result = v51; | |
2337 viewparams->bRedrawGameUI = v51; | |
2338 } | |
2339 return result; | |
2340 } | |
2341 goto LABEL_25; | |
2342 } | |
2343 } | |
2344 } | |
2345 return result; | |
2346 } | |
2347 | |
2348 //----- (00493F79) -------------------------------------------------------- | |
351 | 2349 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2350 { |
2351 signed __int64 v2; // ST2C_8@1 | |
2352 signed __int64 v3; // qax@1 | |
351 | 2353 //signed __int64 v4; // ST1C_8@1 |
0 | 2354 unsigned __int64 v5; // qax@1 |
2355 unsigned int v6; // ebx@1 | |
2356 | |
2357 v2 = (signed __int64)((double)a2 * 0.234375); | |
2358 v3 = v2 / 60 / 60; | |
351 | 2359 //v4 = v3; |
0 | 2360 v5 = (unsigned int)v3 / 0x18; |
2361 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2362 _this->field_0_expire_second = v2 % 60; |
2363 _this->field_4_expire_minute = v2 / 60 % 60; | |
2364 _this->field_8_expire_hour = v3 % 24; | |
2365 _this->field_10_expire_week = v5 / 7 & 3; | |
2366 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2367 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2368 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2369 } |
2370 | |
2371 //----- (00494035) -------------------------------------------------------- | |
2372 void __cdecl _494035_timed_effects__water_walking_damage__etc() | |
2373 { | |
2374 signed __int64 v0; // qax@1 | |
2375 signed __int64 v1; // ST30_8@1 | |
2376 signed __int64 v2; // ST38_8@1 | |
2377 unsigned __int64 v3; // qax@1 | |
2378 unsigned int v4; // edi@1 | |
2379 //signed int v5; // eax@4 | |
2380 //char *v6; // ecx@5 | |
2381 //Player *v7; // esi@8 | |
2382 //char *v8; // ecx@12 | |
766 | 2383 //Player *pPlayer; // esi@15 |
0 | 2384 //void *v10; // esi@25 |
2385 unsigned int v11; // ecx@27 | |
2386 signed int v12; // edi@29 | |
2387 Player *v13; // ecx@30 | |
2388 Player *v14; // esi@35 | |
2389 double v15; // st7@35 | |
2390 Player **v16; // esi@43 | |
2391 Player *v17; // edi@44 | |
2392 double v18; // st7@44 | |
816 | 2393 //float v19; // ST28_4@48 |
2394 //double v20; // ST38_8@48 | |
0 | 2395 Player *v21; // esi@51 |
2396 signed int v22; // edi@53 | |
2397 int v23; // eax@59 | |
2398 int v24; // ecx@60 | |
2399 int v25; // eax@63 | |
2400 int v26; // ecx@64 | |
2401 int v27; // eax@67 | |
2402 int v28; // ecx@68 | |
2403 int v29; // eax@71 | |
2404 int v30; // ecx@72 | |
2405 int v31; // eax@75 | |
2406 int v32; // ecx@76 | |
2407 int v33; // eax@79 | |
2408 int v34; // ecx@80 | |
2409 int v35; // eax@83 | |
2410 int v36; // ecx@84 | |
2411 int v37; // eax@87 | |
2412 int v38; // ecx@88 | |
2413 int v39; // eax@91 | |
2414 int v40; // ecx@92 | |
2415 int v41; // eax@95 | |
2416 int v42; // ecx@96 | |
2417 bool v43; // ebx@102 | |
2418 //SpellBuff *v44; // edi@104 | |
2419 //signed int v45; // ebp@104 | |
2420 bool v46; // edi@111 | |
2421 //SpellBuff *v47; // esi@113 | |
2422 //Player **v48; // esi@119 | |
2423 //signed int v49; // edi@121 | |
2424 //char *v50; // esi@122 | |
2425 signed int v51; // edx@128 | |
2426 signed int v52; // ecx@130 | |
2427 int v53; // eax@131 | |
2428 Player *v54; // eax@141 | |
766 | 2429 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2430 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2431 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2432 int v58; // [sp-4h] [bp-34h]@33 |
2433 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2434 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2435 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2436 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2437 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2438 signed int a2a; // [sp+18h] [bp-18h]@47 |
2439 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2440 | |
766 | 2441 //a2 = pParty->uCurrentHour; |
0 | 2442 v61 = pParty->uDaysPlayed; |
816 | 2443 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2444 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2445 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2446 v1 = v0; |
2447 v0 /= 60i64; | |
2448 v2 = v0; | |
2449 v3 = (unsigned int)v0 / 24; | |
2450 v4 = (unsigned int)(v3 / 7) >> 2; | |
2451 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2452 pParty->uCurrentMinute = v1 % 60; | |
2453 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2454 pParty->uCurrentHour = v2 % 24; | |
2455 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2456 pParty->uCurrentMonth = v4 % 12; | |
352 | 2457 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2458 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2459 { |
2460 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2461 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2462 | |
2463 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2464 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2465 | |
766 | 2466 ++pParty->days_played_without_rest; |
2467 if (pParty->days_played_without_rest > 1) | |
0 | 2468 { |
2469 for (uint i = 0; i < 4; ++i) | |
766 | 2470 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2471 | |
2472 if (pParty->uNumFoodRations) | |
2473 Party::TakeFood(1); | |
0 | 2474 else |
2475 for (uint i = 0; i < 4; ++i) | |
766 | 2476 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2477 | |
2478 if (pParty->days_played_without_rest > 3) | |
2479 for (uint i = 0; i < 4; ++i) | |
0 | 2480 { |
766 | 2481 auto player = pParty->pPlayers + i; |
2482 | |
2483 player->Zero(); | |
2484 | |
2485 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2486 { |
767 | 2487 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2488 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2489 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2490 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2491 } |
2492 } | |
766 | 2493 } |
2494 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2495 pOutdoor->SetFog(); |
2496 | |
2497 for (uint i = 0; i < 4; ++i) | |
2498 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2499 } | |
766 | 2500 |
0 | 2501 v11 = LODWORD(pParty->uTimePlayed); |
2502 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2503 { | |
2504 v12 = 1; | |
2505 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2506 viewparams->bRedrawGameUI = 1; | |
2507 while ( 1 ) | |
2508 { | |
2509 if ( pPlayers[v12]->WearsItem(516, 3) | |
99 | 2510 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2511 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2512 { |
2513 v58 = 0; | |
2514 } | |
2515 else | |
2516 { | |
2517 v58 = 0; | |
2518 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2519 { | |
2520 v14 = pPlayers[v12]; | |
2521 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
2522 v14->ReceiveDamage((signed __int64)v15, 0); | |
2523 if ( pParty->uFlags & 4 ) | |
2524 { | |
783 | 2525 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2526 GameUI_Footer_TimeLeft = 128; | |
0 | 2527 } |
2528 goto LABEL_39; | |
2529 } | |
2530 v13 = pPlayers[v12]; | |
2531 } | |
130 | 2532 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2533 LABEL_39: |
2534 ++v12; | |
2535 if ( v12 > 4 ) | |
2536 { | |
2537 v11 = LODWORD(pParty->uTimePlayed); | |
2538 break; | |
2539 } | |
2540 } | |
2541 } | |
2542 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2543 { | |
2544 viewparams->bRedrawGameUI = 1; | |
2545 pParty->field_6FC = v11 + 128; | |
2546 v16 = &pPlayers[1]; | |
2547 do | |
2548 { | |
2549 v17 = *v16; | |
2550 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
2551 v17->ReceiveDamage((signed __int64)v18, 0); | |
2552 if ( pParty->uFlags & 0x200 ) | |
2553 { | |
783 | 2554 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2555 GameUI_Footer_TimeLeft = 128; | |
0 | 2556 } |
2557 ++v16; | |
2558 } | |
2559 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2560 } | |
2561 _493938_regenerate(); | |
2562 v65 = 4; | |
816 | 2563 a2a = pEventTimer->uTimeElapsed; |
2564 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2565 { | |
2566 //v19 = (double)(signed int)prev_time * 0.5; | |
2567 //v20 = v19 + 6.7553994e15; | |
2568 a2a *= 0.5f; | |
2569 if (a2a < 1) | |
0 | 2570 a2a = 1; |
2571 } | |
2572 v62 = &pPlayers[1]; | |
2573 do | |
2574 { | |
2575 v21 = *v62; | |
2576 if ( (*v62)->uTimeToRecovery ) | |
2577 v21->Recover(a2a); | |
2578 v22 = v21->sHealth; | |
2579 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2580 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2581 { | |
2582 if ( v22 >= 1 ) | |
2583 goto LABEL_59; | |
2584 v59 = 0; | |
2585 v56 = 13; | |
2586 } | |
2587 else | |
2588 { | |
2589 v59 = 0; | |
2590 v56 = 14; | |
2591 } | |
2592 v21->SetCondition(v56, v59); | |
2593 LABEL_59: | |
2594 v23 = (int)&v21->field_E0; | |
2595 if ( v21->field_E0 ) | |
2596 { | |
816 | 2597 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2598 if ( v24 > 0 ) |
2599 { | |
2600 *(int *)v23 = v24; | |
2601 } | |
2602 else | |
2603 { | |
2604 *(int *)v23 = 0; | |
2605 viewparams->bRedrawGameUI = 1; | |
2606 } | |
2607 } | |
2608 v25 = (int)&v21->field_E4; | |
2609 if ( v21->field_E4 ) | |
2610 { | |
816 | 2611 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2612 if ( v26 > 0 ) |
2613 { | |
2614 *(int *)v25 = v26; | |
2615 } | |
2616 else | |
2617 { | |
2618 *(int *)v25 = 0; | |
2619 viewparams->bRedrawGameUI = 1; | |
2620 } | |
2621 } | |
2622 v27 = (int)&v21->field_E8; | |
2623 if ( v21->field_E8 ) | |
2624 { | |
816 | 2625 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2626 if ( v28 > 0 ) |
2627 { | |
2628 *(int *)v27 = v28; | |
2629 } | |
2630 else | |
2631 { | |
2632 *(int *)v27 = 0; | |
2633 viewparams->bRedrawGameUI = 1; | |
2634 } | |
2635 } | |
2636 v29 = (int)&v21->field_EC; | |
2637 if ( v21->field_EC ) | |
2638 { | |
816 | 2639 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2640 if ( v30 > 0 ) |
2641 { | |
2642 *(int *)v29 = v30; | |
2643 } | |
2644 else | |
2645 { | |
2646 *(int *)v29 = 0; | |
2647 viewparams->bRedrawGameUI = 1; | |
2648 } | |
2649 } | |
2650 v31 = (int)&v21->field_F0; | |
2651 if ( v21->field_F0 ) | |
2652 { | |
816 | 2653 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2654 if ( v32 > 0 ) |
2655 { | |
2656 *(int *)v31 = v32; | |
2657 } | |
2658 else | |
2659 { | |
2660 *(int *)v31 = 0; | |
2661 viewparams->bRedrawGameUI = 1; | |
2662 } | |
2663 } | |
2664 v33 = (int)&v21->field_F4; | |
2665 if ( v21->field_F4 ) | |
2666 { | |
816 | 2667 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2668 if ( v34 > 0 ) |
2669 { | |
2670 *(int *)v33 = v34; | |
2671 } | |
2672 else | |
2673 { | |
2674 *(int *)v33 = 0; | |
2675 viewparams->bRedrawGameUI = 1; | |
2676 } | |
2677 } | |
2678 v35 = (int)&v21->field_F8; | |
2679 if ( v21->field_F8 ) | |
2680 { | |
816 | 2681 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2682 if ( v36 > 0 ) |
2683 { | |
2684 *(int *)v35 = v36; | |
2685 } | |
2686 else | |
2687 { | |
2688 *(int *)v35 = 0; | |
2689 viewparams->bRedrawGameUI = 1; | |
2690 } | |
2691 } | |
2692 v37 = (int)&v21->field_FC; | |
2693 if ( v21->field_FC ) | |
2694 { | |
816 | 2695 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2696 if ( v38 > 0 ) |
2697 { | |
2698 *(int *)v37 = v38; | |
2699 } | |
2700 else | |
2701 { | |
2702 *(int *)v37 = 0; | |
2703 viewparams->bRedrawGameUI = 1; | |
2704 } | |
2705 } | |
2706 v39 = (int)&v21->field_100; | |
2707 if ( v21->field_100 ) | |
2708 { | |
816 | 2709 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2710 if ( v40 > 0 ) |
2711 { | |
2712 *(int *)v39 = v40; | |
2713 } | |
2714 else | |
2715 { | |
2716 *(int *)v39 = 0; | |
2717 viewparams->bRedrawGameUI = 1; | |
2718 } | |
2719 } | |
2720 v41 = (int)&v21->field_104; | |
2721 if ( v21->field_104 ) | |
2722 { | |
816 | 2723 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2724 if ( v42 > 0 ) |
2725 { | |
2726 *(int *)v41 = v42; | |
2727 } | |
2728 else | |
2729 { | |
2730 *(int *)v41 = 0; | |
2731 viewparams->bRedrawGameUI = 1; | |
2732 } | |
2733 } | |
2734 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2735 --v65; | |
2736 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2737 | |
2738 for (uint k = 0; k < 24; ++k) | |
2739 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2740 | |
2741 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2742 v21->SetCondition(1u, 0); | |
2743 ++v62; | |
2744 } | |
2745 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
2746 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | |
2747 | |
2748 for (uint i = 0; i < 20; ++i) | |
2749 { | |
2750 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2751 viewparams->bRedrawGameUI = 1; | |
2752 } | |
2753 | |
2754 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | |
2755 { | |
2756 for (uint i = 0; i < 4; ++i) | |
2757 pParty->pPlayers[i].SetCondition(1, 0); | |
2758 } | |
2759 | |
2760 for (uint i = 0; i < 2; ++i) | |
2761 { | |
2762 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2763 if (pBuf->uExpireTime == 0) | |
2764 continue; | |
2765 | |
2766 if ( !(pBuf->uFlags & 1) ) | |
2767 { | |
2768 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2769 { | |
2770 pBuf->Reset(); | |
2771 if (dword_4EE07C[i] == 7 ) | |
2772 pParty->bFlying = false; | |
2773 } | |
2774 } | |
2775 } | |
2776 | |
2777 v51 = v65; | |
2778 if ( v65 ) | |
2779 goto LABEL_135; | |
151 | 2780 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2781 { |
2782 v52 = (signed int)&pPlayers[1]; | |
2783 while ( 1 ) | |
2784 { | |
2785 v53 = *(int *)v52; | |
2786 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2787 break; | |
2788 v52 += 4; | |
2789 if ( v52 > (signed int)&pPlayers[4] ) | |
2790 goto LABEL_135; | |
2791 } | |
2792 *(int *)(v53 + 16) = 0; | |
2793 *(int *)(v53 + 20) = 0; | |
2794 v51 = 1; | |
2795 LABEL_135: | |
151 | 2796 if ( pCurrentScreen != SCREEN_REST |
0 | 2797 && (!v51 || dword_5C35C0) ) |
2798 uGameState = 8; | |
2799 } | |
2800 if ( uActiveCharacter ) | |
2801 { | |
151 | 2802 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2803 { |
2804 v54 = pPlayers[uActiveCharacter]; | |
2805 if ( v54->pConditions[2] | |
2806 || v54->pConditions[12] | |
2807 || v54->pConditions[13] | |
2808 || v54->pConditions[14] | |
2809 || v54->pConditions[15] | |
2810 || v54->pConditions[16] ) | |
2811 { | |
2812 viewparams->bRedrawGameUI = 1; | |
2813 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2814 } | |
2815 } | |
2816 } | |
2817 } | |
2818 | |
2819 //----- (00494820) -------------------------------------------------------- | |
758 | 2820 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2821 { |
2822 signed int v1; // eax@1 | |
2823 | |
2824 v1 = 5; | |
758 | 2825 if ( a1 % 24 >= 5 ) |
0 | 2826 v1 = 29; |
758 | 2827 return v1 - a1 % 24; |
0 | 2828 } |
2829 | |
2830 //----- (00494836) -------------------------------------------------------- | |
2831 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2832 { | |
2833 int v3; // esi@1 | |
2834 int result; // eax@1 | |
2835 stru339_spell_sound *v5; // ebx@1 | |
2836 int *v6; // edi@2 | |
2837 unsigned int v7; // eax@3 | |
2838 int v8; // [sp+Ch] [bp-8h]@3 | |
2839 int v9; // [sp+10h] [bp-4h]@2 | |
2840 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2841 | |
2842 v3 = 0; | |
2843 result = word_4EE088_sound_ids[uSoundID]; | |
2844 v5 = this; | |
2845 a2a = word_4EE088_sound_ids[uSoundID]; | |
2846 if ( result ) | |
2847 { | |
2848 v9 = 0; | |
2849 v6 = this->pSoundsOffsets; | |
2850 do | |
2851 { | |
2852 v7 = a2a++; | |
2853 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2854 if ( !result ) | |
2855 break; | |
2856 a6 += 4; | |
2857 result = v8 + 256; | |
2858 *v6 = v3; | |
2859 v3 += result; | |
2860 ++v9; | |
2861 *(v6 - 2) = result; | |
2862 ++v6; | |
2863 } | |
2864 while ( v9 < 2 ); | |
2865 } | |
2866 return result; | |
2867 } | |
2868 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2869 | |
2870 //----- (00494AED) -------------------------------------------------------- | |
130 | 2871 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2872 { |
2873 unsigned int _uNumFrames; // edx@1 | |
2874 unsigned int result; // eax@1 | |
2875 PlayerFrame *v4; // ecx@2 | |
2876 | |
2877 _uNumFrames = this->uNumFrames; | |
2878 result = 0; | |
2879 if ( (signed int)this->uNumFrames <= 0 ) | |
2880 { | |
2881 LABEL_5: | |
2882 result = 0; | |
2883 } | |
2884 else | |
2885 { | |
2886 v4 = this->pFrames; | |
130 | 2887 while ( v4->expression != expression ) |
0 | 2888 { |
2889 ++result; | |
2890 ++v4; | |
2891 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2892 goto LABEL_5; | |
2893 } | |
2894 } | |
2895 return result; | |
2896 } | |
2897 | |
2898 //----- (00494B10) -------------------------------------------------------- | |
2899 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2900 { | |
2901 unsigned int v3; // esi@1 | |
2902 PlayerFrame *v4; // edi@1 | |
2903 PlayerFrame *v5; // ecx@1 | |
2904 __int16 v6; // dx@2 | |
2905 int v7; // edx@3 | |
2906 char *i; // eax@3 | |
2907 int v9; // ecx@5 | |
2908 PlayerFrame *result; // eax@6 | |
2909 | |
2910 v3 = uFramesetID; | |
2911 v4 = this->pFrames; | |
2912 v5 = &v4[uFramesetID]; | |
2913 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2914 { | |
2915 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2916 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2917 { | |
2918 v9 = *(short *)i; | |
2919 if ( v7 <= v9 ) | |
2920 break; | |
2921 v7 -= v9; | |
2922 ++v3; | |
2923 } | |
2924 result = &v4[v3]; | |
2925 } | |
2926 else | |
2927 { | |
2928 result = &v4[uFramesetID]; | |
2929 } | |
2930 return result; | |
2931 } | |
2932 | |
2933 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2934 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2935 { |
2936 PlayerFrameTable *v4; // edi@1 | |
2937 int v5; // esi@1 | |
2938 int v6; // eax@2 | |
2939 | |
2940 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2941 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2942 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
|
2943 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2944 *pAnimTime = v5; |
0 | 2945 } |
2946 else | |
2947 { | |
2948 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2949 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2950 *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
|
2951 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2952 return &v4->pFrames[*pFramesetID]; |
0 | 2953 } |
2954 | |
2955 //----- (00494BC3) -------------------------------------------------------- | |
2956 void PlayerFrameTable::ToFile() | |
2957 { | |
2958 PlayerFrameTable *v1; // esi@1 | |
2959 FILE *v2; // eax@1 | |
2960 FILE *v3; // edi@1 | |
2961 | |
2962 auto Str = this; | |
2963 | |
2964 v1 = Str; | |
2965 v2 = fopen("data\\dpft.bin", "wb"); | |
2966 v3 = v2; | |
2967 if ( !v2 ) | |
2968 Abortf("Unable to save dpft.bin!"); | |
2969 fwrite(v1, 4u, 1u, v2); | |
2970 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2971 fclose(v3); | |
2972 } | |
2973 | |
2974 //----- (00494C0F) -------------------------------------------------------- | |
2975 void PlayerFrameTable::FromFile(void *pSerialized) | |
2976 { | |
2977 uNumFrames = *(int *)pSerialized; | |
2978 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2979 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2980 } | |
2981 | |
2982 //----- (00494C5A) -------------------------------------------------------- | |
2983 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2984 { | |
2985 PlayerFrameTable *v2; // ebx@1 | |
2986 FILE *v3; // eax@1 | |
2987 int v4; // esi@3 | |
2988 void *v5; // eax@10 | |
2989 FILE *v6; // ST0C_4@12 | |
2990 char *i; // eax@12 | |
2991 __int16 v8; // ax@15 | |
2992 const char *v9; // ST10_4@15 | |
2993 unsigned __int16 v10; // ax@15 | |
2994 const char *v11; // ST0C_4@15 | |
2995 int j; // esi@15 | |
2996 int v13; // eax@17 | |
2997 int v14; // edx@22 | |
2998 int v15; // ecx@23 | |
2999 int v16; // eax@24 | |
3000 signed int k; // eax@27 | |
3001 PlayerFrame *v18; // edx@28 | |
3002 int v19; // esi@28 | |
3003 int l; // ecx@29 | |
3004 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3005 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
3006 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
3007 int v25; // [sp+2F8h] [bp-Ch]@3 | |
3008 int v26; // [sp+2FCh] [bp-8h]@3 | |
3009 FILE *File; // [sp+300h] [bp-4h]@1 | |
3010 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
3011 | |
3012 v2 = this; | |
3013 //TileTable::dtor((TileTable *)this); | |
3014 v3 = fopen(Args, "r"); | |
3015 File = v3; | |
3016 if ( !v3 ) | |
3017 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
3018 v4 = 0; | |
3019 v25 = 0; | |
3020 v26 = 1; | |
3021 if ( fgets(&Buf, 490, v3) ) | |
3022 { | |
3023 do | |
3024 { | |
3025 *strchr(&Buf, 10) = 0; | |
703 | 3026 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3027 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
3028 { | |
3029 if ( v24.uPropCount < 3 ) | |
0 | 3030 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
3031 ++v25; | |
3032 } | |
3033 ++v26; | |
3034 } | |
3035 while ( fgets(&Buf, 490, File) ); | |
3036 v4 = v25; | |
3037 } | |
3038 v2->uNumFrames = v4; | |
3039 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
3040 v2->pFrames = (PlayerFrame *)v5; | |
3041 if ( !v5 ) | |
3042 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
3043 v6 = File; | |
3044 v2->uNumFrames = 0; | |
3045 fseek(v6, 0, 0); | |
3046 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3047 { | |
3048 *strchr(&Buf, 10) = 0; | |
703 | 3049 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 3050 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 3051 { |
3052 v8 = atoi(v24.pProperties[0]); | |
3053 v9 = v24.pProperties[1]; | |
130 | 3054 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 3055 v10 = atoi(v9); |
3056 v11 = v24.pProperties[2]; | |
3057 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
3058 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
3059 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
3060 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 3061 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 3062 { |
3063 if ( !_strcmpi(v24.pProperties[j], "New") ) | |
3064 { | |
3065 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
3066 *(char *)v13 |= 4u; | |
3067 } | |
3068 } | |
3069 ++v2->uNumFrames; | |
3070 } | |
3071 } | |
3072 fclose(File); | |
3073 v14 = 0; | |
3074 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
3075 { | |
3076 v15 = 0; | |
3077 do | |
3078 { | |
3079 v16 = (int)&v2->pFrames[v15]; | |
3080 if ( !(*(char *)(v16 + 18) & 4) ) | |
3081 *(char *)(v16 + 8) |= 1u; | |
3082 ++v14; | |
3083 ++v15; | |
3084 } | |
3085 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
3086 } | |
3087 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
3088 { | |
3089 v18 = v2->pFrames; | |
3090 Argsa = (int)&v18[k]; | |
3091 v19 = *(short *)(Argsa + 4); | |
3092 if ( *(char *)(Argsa + 8) & 1 ) | |
3093 { | |
3094 ++k; | |
3095 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
3096 { | |
3097 v19 += *(short *)(l + 4); | |
3098 ++k; | |
3099 } | |
3100 LOWORD(v19) = v18[k].uAnimTime + v19; | |
3101 } | |
3102 ++k; | |
3103 } | |
3104 return 1; | |
3105 } | |
3106 | |
3107 //----- (00494F3A) -------------------------------------------------------- | |
3108 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
3109 { | |
3110 IconFrameTable *v2; // esi@1 | |
3111 int v3; // ebx@1 | |
3112 unsigned int uID; // edi@1 | |
3113 unsigned int result; // eax@4 | |
3114 | |
3115 v2 = this; | |
3116 v3 = 0; | |
3117 uID = 0; | |
3118 if ( (signed int)this->uNumIcons <= 0 ) | |
3119 { | |
3120 LABEL_4: | |
3121 result = 0; | |
3122 } | |
3123 else | |
3124 { | |
3125 while ( _strcmpi(pIconName, v2->pIcons[v3].pAnimationName) ) | |
3126 { | |
3127 ++uID; | |
3128 ++v3; | |
3129 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3130 goto LABEL_4; | |
3131 } | |
3132 result = uID; | |
3133 } | |
3134 return result; | |
3135 } | |
3136 | |
3137 //----- (00494F70) -------------------------------------------------------- | |
3138 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3139 { | |
3140 IconFrame *v3; // edi@1 | |
3141 IconFrame *v4; // ecx@1 | |
3142 __int16 v5; // dx@2 | |
3143 int v6; // edx@3 | |
3144 unsigned int v7; // eax@3 | |
3145 char *i; // ecx@3 | |
3146 int v9; // esi@5 | |
3147 IconFrame *result; // eax@6 | |
3148 | |
3149 v3 = this->pIcons; | |
3150 v4 = &v3[uIconID]; | |
3151 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3152 { | |
3153 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3154 v7 = uIconID; | |
3155 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3156 { | |
3157 v9 = *(short *)i; | |
3158 if ( v6 <= v9 ) | |
3159 break; | |
3160 v6 -= v9; | |
3161 ++v7; | |
3162 } | |
3163 result = &v3[v7]; | |
3164 } | |
3165 else | |
3166 { | |
3167 result = &v3[uIconID]; | |
3168 } | |
3169 return result; | |
3170 } | |
3171 | |
3172 //----- (00494FBF) -------------------------------------------------------- | |
3173 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3174 { | |
3175 IconFrameTable *v2; // esi@1 | |
3176 unsigned int v3; // edi@3 | |
3177 const char *i; // eax@3 | |
3178 IconFrame *v5; // eax@5 | |
3179 | |
3180 v2 = this; | |
3181 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3182 { | |
3183 v3 = uIconID; | |
3184 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3185 { | |
3186 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3187 v5 = v2->pIcons; | |
3188 if ( !(v5[v3].uFlags & 1) ) | |
3189 break; | |
3190 ++v3; | |
3191 } | |
3192 } | |
3193 } | |
3194 | |
3195 //----- (0049500A) -------------------------------------------------------- | |
3196 void IconFrameTable::ToFile() | |
3197 { | |
3198 IconFrameTable *v1; // esi@1 | |
3199 FILE *v2; // eax@1 | |
3200 FILE *v3; // edi@1 | |
3201 | |
3202 auto Str = this; | |
3203 | |
3204 v1 = Str; | |
3205 v2 = fopen("data\\dift.bin", "wb"); | |
3206 v3 = v2; | |
3207 if ( !v2 ) | |
3208 Abortf("Unable to save dift.bin!"); | |
3209 fwrite(v1, 4u, 1u, v2); | |
3210 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3211 fclose(v3); | |
3212 } | |
3213 | |
3214 //----- (00495056) -------------------------------------------------------- | |
3215 void IconFrameTable::FromFile(void *pSerialized) | |
3216 { | |
3217 uNumIcons = *(int *)pSerialized; | |
3218 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3219 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3220 } | |
3221 | |
3222 //----- (0049509D) -------------------------------------------------------- | |
3223 int IconFrameTable::FromFileTxt(const char *Args) | |
3224 { | |
3225 IconFrameTable *v2; // ebx@1 | |
3226 FILE *v3; // eax@1 | |
3227 int v4; // esi@3 | |
3228 void *v5; // eax@10 | |
3229 FILE *v6; // ST0C_4@12 | |
3230 char *i; // eax@12 | |
3231 const char *v8; // ST00_4@15 | |
3232 int v9; // eax@16 | |
3233 int v10; // edx@20 | |
3234 int v11; // ecx@21 | |
3235 int v12; // eax@22 | |
3236 signed int j; // edx@25 | |
3237 IconFrame *v14; // ecx@26 | |
3238 int v15; // esi@26 | |
3239 int k; // eax@27 | |
3240 signed int result; // eax@11 | |
3241 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3242 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3243 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3244 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3245 int v22; // [sp+2FCh] [bp-8h]@3 | |
3246 FILE *File; // [sp+300h] [bp-4h]@1 | |
3247 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3248 | |
3249 v2 = this; | |
3250 //TileTable::dtor((TileTable *)this); | |
3251 v3 = fopen(Args, "r"); | |
3252 File = v3; | |
3253 if ( !v3 ) | |
3254 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3255 v4 = 0; | |
3256 v21 = 0; | |
3257 v22 = 1; | |
3258 if ( fgets(&Buf, 490, v3) ) | |
3259 { | |
3260 do | |
3261 { | |
3262 *strchr(&Buf, 10) = 0; | |
3263 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3264 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3265 { | |
3266 if ( v20.uPropCount < 3 ) | |
0 | 3267 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3268 ++v21; | |
3269 } | |
3270 ++v22; | |
3271 } | |
3272 while ( fgets(&Buf, 490, File) ); | |
3273 v4 = v21; | |
3274 } | |
3275 v2->uNumIcons = v4; | |
3276 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3277 v2->pIcons = (IconFrame *)v5; | |
3278 if ( v5 ) | |
3279 { | |
3280 v6 = File; | |
3281 v2->uNumIcons = 0; | |
3282 fseek(v6, 0, 0); | |
3283 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3284 { | |
3285 *strchr(&Buf, 10) = 0; | |
3286 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3287 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3288 { |
3289 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3290 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3291 v8 = v20.pProperties[2]; | |
3292 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
3293 if ( !_strcmpi(v8, "new") ) | |
3294 { | |
3295 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3296 *(char *)v9 |= 4u; | |
3297 } | |
3298 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3299 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3300 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3301 } | |
3302 } | |
3303 fclose(File); | |
3304 v10 = 0; | |
3305 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3306 { | |
3307 v11 = 0; | |
3308 do | |
3309 { | |
3310 v12 = (int)&v2->pIcons[v11]; | |
3311 if ( !(*(char *)(v12 + 60) & 4) ) | |
3312 *(char *)(v12 + 28) |= 1u; | |
3313 ++v10; | |
3314 ++v11; | |
3315 } | |
3316 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3317 } | |
3318 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3319 { | |
3320 v14 = v2->pIcons; | |
3321 Argsa = (int)&v14[j]; | |
3322 v15 = *(short *)(Argsa + 24); | |
3323 if ( *(char *)(Argsa + 28) & 1 ) | |
3324 { | |
3325 ++j; | |
3326 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3327 { | |
3328 v15 += *(short *)(k + 24); | |
3329 ++j; | |
3330 } | |
3331 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3332 } | |
3333 ++j; | |
3334 } | |
3335 result = 1; | |
3336 } | |
3337 else | |
3338 { | |
3339 fclose(File); | |
3340 result = 0; | |
3341 } | |
3342 return result; | |
3343 } | |
3344 | |
3345 //----- (00495366) -------------------------------------------------------- | |
3346 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3347 { | |
3348 int v2; // edi@1 | |
3349 int v3; // edx@2 | |
3350 int v4; // esi@3 | |
3351 int v5; // ebx@5 | |
3352 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3353 signed int v8; // [sp+10h] [bp-10h]@1 | |
3354 int **v9; // [sp+14h] [bp-Ch]@4 | |
3355 signed int v10; // [sp+18h] [bp-8h]@3 | |
3356 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3357 | |
3358 v2 = a1; | |
3359 v11 = a2; | |
3360 v8 = 0; | |
3361 v7 = 0; | |
3362 if ( dword_AE336C == a1 ) | |
3363 { | |
3364 v3 = dword_AE3370; | |
3365 } | |
3366 else | |
3367 { | |
3368 v4 = a2; | |
3369 dword_AE336C = a1; | |
3370 v10 = 0; | |
3371 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3372 goto LABEL_17; | |
3373 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3374 do | |
3375 { | |
3376 v5 = tolower(*(char *)*v9); | |
3377 if ( v5 == tolower(v2) ) | |
3378 { | |
3379 if ( v8 ) | |
3380 v7 = v10; | |
3381 else | |
3382 v8 = v10; | |
3383 } | |
3384 ++v10; | |
3385 v9 += 2; | |
3386 } | |
3387 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3388 if ( v8 && v8 != v7 ) | |
3389 v3 = v8 + rand() % (v7 - v8); | |
3390 else | |
3391 LABEL_17: | |
3392 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3393 } | |
3394 dword_AE3370 = v3; | |
3395 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3396 } | |
3397 // AE336C: using guessed type int dword_AE336C; | |
3398 // AE3370: using guessed type int dword_AE3370; | |
3399 | |
3400 //----- (00495430) -------------------------------------------------------- | |
607 | 3401 char * GetReputationString( signed int a1 ) |
3402 { | |
566 | 3403 if (a1 >= 25) |
3404 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3405 else if (a1 >= 6) | |
3406 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3407 else if (a1 >= -5) | |
3408 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3409 else if (a1 >= -24) | |
3410 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3411 else |
566 | 3412 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3413 } |
3414 | |
3415 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3416 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3417 { |
3418 unsigned __int8 v6; // bl@1 | |
3419 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3420 //NPCData *v9; // eax@4 |
250 | 3421 //size_t v10; // eax@6 |
0 | 3422 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3423 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3424 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3425 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3426 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3427 //int v16; // edx@10 |
0 | 3428 int v17; // eax@10 |
3429 signed __int64 v18; // qax@18 | |
3430 unsigned int v19; // edi@32 | |
3431 unsigned __int8 *v20; // ebx@32 | |
3432 int v21; // ecx@34 | |
3433 __int16 v22; // ax@34 | |
3434 int v23; // edx@39 | |
3435 int v24; // eax@39 | |
3436 int v25; // eax@45 | |
3437 float *v26; // esi@68 | |
3438 float v27; // ST18_4@68 | |
3439 signed int v28; // eax@68 | |
3440 int v29; // eax@68 | |
3441 float v30; // ST18_4@72 | |
3442 signed int v31; // eax@72 | |
3443 float v32; // ST18_4@74 | |
3444 signed int v33; // eax@74 | |
3445 double v34; // st7@75 | |
3446 float v35; // ST18_4@76 | |
3447 signed int v36; // eax@76 | |
3448 float *v37; // esi@78 | |
3449 float v38; // ST18_4@78 | |
3450 int v39; // eax@78 | |
3451 float v40; // ST18_4@82 | |
3452 int v41; // eax@82 | |
3453 float v42; // ST18_4@83 | |
3454 int v43; // eax@83 | |
3455 float v44; // ST18_4@85 | |
3456 int v45; // eax@85 | |
3457 const char *v46; // eax@86 | |
3458 unsigned int v47; // eax@87 | |
3459 float v48; // ST18_4@97 | |
3460 __int64 v49; // ST14_8@107 | |
3461 int v50; // eax@107 | |
3462 int v51; // eax@108 | |
3463 Player *v52; // eax@109 | |
3464 int v53; // [sp-4h] [bp-13Ch]@107 | |
3465 int v54; // [sp+0h] [bp-138h]@107 | |
3466 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3467 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3468 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3469 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3470 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3471 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3472 //Player *v61; // [sp+124h] [bp-14h]@3 |
3473 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3474 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3475 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3476 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3477 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 |
0 | 3480 |
3481 v6 = uPlayerID; | |
249 | 3482 //Str = lpsz; |
0 | 3483 if ( IsBadStringPtrA(lpsz, 1u) ) |
3484 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3485 |
0 | 3486 a1[0] = 0; |
3487 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3488 v59 = TargetColor(255, 255, 155); |
249 | 3489 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3490 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 NPCData *npc = nullptr; |
0 | 3493 if ( dword_5C35D4 ) |
248 | 3494 { |
463 | 3495 //__debugbreak(); // fix |
459 | 3496 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
|
3497 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3498 else |
602 | 3499 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3500 //v65 = v9; |
250 | 3501 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3502 //v64 = 0; |
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 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3505 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3506 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3507 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3508 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3509 for (int i = 0, dst = 0; i < len; ++i) |
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 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3512 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3513 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3514 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3515 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3516 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3517 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3518 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3519 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3520 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3521 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3522 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 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
|
3525 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 case 2: |
0 | 3532 v11 = pPlayer->pName; |
254
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 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 case 5: |
0 | 3539 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3540 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3541 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3542 { | |
3543 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3544 { | |
3545 if ( v18 < 20 ) | |
3546 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3547 } | |
3548 else | |
3549 { | |
3550 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3551 } | |
3552 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3553 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3554 case 6: |
0 | 3555 if ( pPlayer->uSex ) |
3556 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3557 else | |
3558 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 case 7: |
0 | 3561 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3562 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 case 8: |
0 | 3567 v19 = 0; |
3568 v63 = 0; | |
484 | 3569 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3570 do |
3571 { | |
3572 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3573 { | |
3574 v21 = v63; | |
3575 v22 = word_4EE150[v19]; | |
3576 ++v63; | |
3577 v55[v21] = v22; | |
3578 } | |
3579 ++v19; | |
3580 } | |
3581 while ( v19 < 28 ); | |
3582 if ( v63 ) | |
3583 { | |
3584 v23 = rand() % v63; | |
3585 v24 = dword_A74CDC; | |
3586 if ( dword_A74CDC == -1 ) | |
3587 { | |
3588 v24 = v23; | |
3589 dword_A74CDC = v23; | |
3590 } | |
492 | 3591 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3592 } |
3593 else | |
3594 { | |
3595 v11 = (char *)pNPCTopics[55].pText; | |
3596 } | |
249 | 3597 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3603 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3604 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3605 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3606 case 10: |
0 | 3607 if ( pPlayer->uSex ) |
3608 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3609 else | |
3610 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3611 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3612 case 11: |
0 | 3613 v25 = GetPartyReputation(); |
3614 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3616 v25 = npc->rep; |
0 | 3617 LABEL_46: |
3618 if ( v25 >= 25 ) | |
3619 { | |
3620 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3621 } | |
3622 else | |
3623 { | |
3624 if ( v25 < 6 ) | |
3625 { | |
3626 if ( v25 >= -5 ) | |
3627 { | |
3628 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3629 } | |
3630 else | |
3631 { | |
3632 if ( v25 < -24 ) | |
3633 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3634 else | |
3635 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3636 } | |
3637 } | |
3638 else | |
3639 { | |
3640 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3641 } | |
3642 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3643 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3644 case 13: |
0 | 3645 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3646 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3648 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3649 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3650 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3651 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3652 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3653 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3654 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3656 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3657 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3658 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3662 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3663 i += 2; |
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 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3666 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3668 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3669 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3671 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3672 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3674 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3675 case 17: |
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 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
|
3678 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 pay_percentage = 1; |
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 sprintf(a1, "%lu", pay_percentage); |
250 | 3682 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3684 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3685 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3688 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 sprintf(a1, "%lu", v51); |
0 | 3696 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3697 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3698 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3699 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3714 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3718 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3719 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3720 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3721 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3722 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3723 switch ( a5 ) |
3724 { | |
3725 case 3: | |
3726 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3727 v45 = a3->GetValue(); |
0 | 3728 v29 = pPlayer->_4B8213(v45, v44); |
3729 break; | |
3730 case 4: | |
3731 v29 = pPlayer->_4B824B(*v37); | |
3732 break; | |
3733 case 5: | |
3734 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3735 v43 = a3->GetValue(); |
0 | 3736 v29 = pPlayer->_4B8265(v43, v42); |
3737 break; | |
3738 case 6: | |
3739 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3740 v41 = a3->GetValue(); |
0 | 3741 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3742 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3743 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3744 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3745 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3746 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3747 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3748 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3749 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3750 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3751 v28 = a3->GetValue(); |
749 | 3752 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3753 if ( a5 == 3 ) |
3754 { | |
3755 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3756 v36 = a3->GetValue(); |
917 | 3757 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3758 if (a3->Broken()) |
0 | 3759 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3760 goto _continue_sprintf; |
0 | 3761 } |
3762 if ( a5 != 4 ) | |
3763 { | |
3764 if ( a5 == 5 ) | |
3765 { | |
3766 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3767 v33 = a3->GetValue(); |
916 | 3768 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3769 } |
3770 else | |
3771 { | |
3772 if ( a5 == 6 ) | |
3773 { | |
3774 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3775 v31 = a3->GetValue(); |
917 | 3776 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3777 if (a3->Broken()) |
0 | 3778 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3779 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3780 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3781 goto _continue_sprintf; |
0 | 3782 } |
3783 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3784 _continue_sprintf: |
0 | 3785 sprintf(a1, "%lu", v29); |
250 | 3786 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3787 goto _continue_strcat; |
0 | 3788 } |
3789 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3790 |
0 | 3791 v48 = v34; |
916 | 3792 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3793 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3794 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3795 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3796 case 28: |
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 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3799 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3800 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3801 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3802 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3803 case 29: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3804 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3805 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3806 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3807 v48 = v34; |
916 | 3808 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3809 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3810 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3811 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3812 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3813 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3814 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3815 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3816 sub_493F79(&v57, *a6); |
351 | 3817 v54 = v57.field_18_expire_year; |
3818 v53 = v57.field_C_expire_day + 1; | |
3819 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3820 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3821 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3822 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3823 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3824 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3825 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3826 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3827 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3828 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3829 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3830 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3831 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3832 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3833 default: |
0 | 3834 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3835 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3836 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3837 goto _continue_strcat; |
484 | 3838 v49 = pParty->field_3C._s_times[v17-51]; |
3839 | |
0 | 3840 sub_493F79(&v56, v49); |
351 | 3841 v54 = v56.field_18_expire_year; |
3842 v53 = v56.field_C_expire_day + 1; | |
3843 v50 = v56.field_14_exprie_month; | |
0 | 3844 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3845 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3846 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3847 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3848 } |
0 | 3849 } |
3850 return pTmpBuf2; | |
3851 } | |
3852 | |
3853 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3854 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3855 { |
734 | 3856 //stru154 *v3; // edi@1 |
3857 //signed int v4; // eax@1 | |
3858 //signed int result; // eax@9 | |
3859 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3860 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3861 float v7; |
0 | 3862 |
3863 v.x = 0.0; | |
3864 v.y = 0.0; | |
3865 v.z = 0.0; | |
734 | 3866 GetFacePlane(a2, a3, &v, &v7); |
3867 | |
3868 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3869 polygonType = POLYGON_VerticalWall; | |
3870 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3871 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3872 polygonType = POLYGON_Floor; | |
0 | 3873 else |
734 | 3874 polygonType = POLYGON_InBetweenFloorAndWall; |
3875 | |
3876 face_plane.vNormal.x = v.x; | |
3877 face_plane.vNormal.y = v.y; | |
3878 face_plane.vNormal.z = v.z; | |
3879 face_plane.dist = v7; | |
0 | 3880 } |
3881 | |
3882 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3883 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3884 { |
734 | 3885 if (fabsf(pNormal->z) < 1e-6f) |
3886 polygonType = POLYGON_VerticalWall; | |
3887 else if (fabsf(pNormal->x) < 1e-6f && | |
3888 fabsf(pNormal->y) < 1e-6f) | |
3889 polygonType = POLYGON_Floor; | |
0 | 3890 else |
734 | 3891 polygonType = POLYGON_InBetweenFloorAndWall; |
3892 | |
3893 face_plane.vNormal.x = pNormal->x; | |
3894 face_plane.dist = dist; | |
3895 face_plane.vNormal.y = pNormal->y; | |
3896 face_plane.vNormal.z = pNormal->z; | |
0 | 3897 } |
3898 | |
3899 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3900 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3901 { |
3902 ODMFace *v5; // ebx@1 | |
734 | 3903 //int v6; // eax@1 |
3904 //unsigned __int16 *v7; // ebx@2 | |
3905 //Vec3_int_ *v8; // eax@3 | |
0 | 3906 Vec3_int_ *v9; // ecx@3 |
734 | 3907 //double v10; // st7@3 |
3908 //int v11; // ecx@3 | |
0 | 3909 Vec3_int_ *v12; // ecx@3 |
734 | 3910 //double v13; // st7@3 |
3911 //double v14; // st6@3 | |
3912 //double v15; // st5@3 | |
3913 //int v16; // ecx@3 | |
0 | 3914 Vec3_int_ *v17; // eax@3 |
734 | 3915 //double v18; // st5@3 |
0 | 3916 Vec3_float_ *v19; // eax@3 |
734 | 3917 //int result; // eax@8 |
3918 //float v21; // ecx@10 | |
3919 //double v22; // st7@10 | |
3920 //double v23; // st6@10 | |
0 | 3921 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3922 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3923 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3924 float v27; // [sp+20h] [bp-48h]@3 | |
3925 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3926 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3927 //float v30; // [sp+30h] [bp-38h]@3 | |
3928 //float v31; // [sp+34h] [bp-34h]@3 | |
3929 //float v32; // [sp+38h] [bp-30h]@3 | |
3930 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3931 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3932 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3933 //float v36; // [sp+50h] [bp-18h]@3 | |
3934 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3935 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3936 //int v39; // [sp+64h] [bp-4h]@1 |
3937 | |
3938 //v39 = 0; | |
0 | 3939 v1.x = 0.0; |
3940 v5 = pFace; | |
734 | 3941 //v6 = pFace->uNumVertices; |
0 | 3942 v1.y = 0.0; |
3943 v1.z = 0.0; | |
734 | 3944 |
3945 if (pFace->uNumVertices >= 2) | |
3946 { | |
3947 int i = 0; | |
3948 while ( i < pFace->uNumVertices - 2 ) | |
3949 { | |
3950 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3951 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3952 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
3953 | |
3954 v1.x = v12->x - v9->x; | |
3955 v26 = v17->x - v12->x; | |
3956 v1.y = v12->y - v9->y; | |
3957 v27 = v17->y - v12->y; | |
3958 v1.z = v12->z - v9->z; | |
3959 v28 = v17->z - v12->z; | |
0 | 3960 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3961 v38.x = v19->x; | |
3962 v38.y = v19->y; | |
3963 v38.z = v19->z; | |
734 | 3964 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3965 { | |
3966 v38.Normalize(); | |
3967 | |
3968 pOutNormal->x = v38.x; | |
3969 pOutNormal->y = v38.y; | |
3970 pOutNormal->z = v38.z; | |
3971 | |
3972 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3973 return; | |
3974 } | |
3975 } | |
3976 } | |
3977 | |
3978 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3979 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3980 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3981 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3982 } |
3983 | |
3984 //----- (0049D700) -------------------------------------------------------- | |
3985 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3986 { | |
3987 unsigned int v1; // eax@1 | |
3988 int v2; // ecx@1 | |
3989 unsigned int v3; // eax@1 | |
3990 | |
3991 v1 = uDim; | |
3992 v2 = 0; | |
3993 v3 = v1 - 1; | |
3994 while ( v3 & 1 ) | |
3995 { | |
3996 v3 >>= 1; | |
3997 ++v2; | |
3998 } | |
3999 return v3 == 0 ? v2 : 0; | |
4000 } | |
4001 | |
4002 //----- (004A19D8) -------------------------------------------------------- | |
737 | 4003 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 4004 { |
737 | 4005 /*signed __int64 v2; // ST10_8@1 |
0 | 4006 double v3; // st7@1 |
4007 float v4; // ST24_4@1 | |
4008 double v5; // ST10_8@1 | |
4009 int v6; // ST1C_4@1 | |
4010 float v7; // ST24_4@1 | |
4011 double v8; // ST10_8@1 | |
4012 unsigned __int8 v9; // ST20_1@1 | |
4013 float v10; // ST24_4@1 | |
4014 double v11; // ST10_8@1 | |
4015 float v12; // ST24_4@1 | |
737 | 4016 double v13; // ST08_8@1*/ |
4017 | |
4018 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
4019 (a2 >> 24) / 255.0f * 255.0f), | |
4020 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
4021 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
4022 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
4023 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
4024 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
4025 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
4026 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
4027 /*v2 = a1 >> 24; | |
4028 v3 = (double)v2 / 255.0f; | |
4029 HIDWORD(v2) = 0; | |
0 | 4030 LODWORD(v2) = a2 >> 24; |
737 | 4031 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 4032 v5 = v4 + 6.7553994e15; |
4033 v6 = LODWORD(v5); | |
737 | 4034 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 4035 v8 = v7 + 6.7553994e15; |
4036 v9 = LOBYTE(v8); | |
737 | 4037 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 4038 v11 = v10 + 6.7553994e15; |
737 | 4039 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 4040 v13 = v12 + 6.7553994e15; |
737 | 4041 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 4042 } |
4043 | |
4044 //----- (004A46E6) -------------------------------------------------------- | |
4045 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
4046 { | |
4047 int v5; // eax@1 | |
4048 int z; // eax@1 | |
4049 unsigned int v7; // eax@9 | |
4050 unsigned int v8; // ecx@9 | |
4051 int v9; // eax@9 | |
4052 unsigned int v10; // eax@10 | |
4053 int *v11; // esi@10 | |
4054 int *v12; // edi@10 | |
4055 int v13; // ecx@10 | |
4056 int v14; // edx@10 | |
4057 unsigned int v15; // eax@22 | |
4058 int *v16; // esi@22 | |
4059 int *v17; // edi@22 | |
4060 int v18; // ecx@22 | |
4061 int v19; // edx@22 | |
4062 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
4063 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
4064 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
4065 signed int v23; // [sp+20h] [bp+Ch]@1 | |
4066 | |
4067 v5 = a4; | |
4068 v23 = _z >> 16; | |
4069 z = x + v5; | |
693 | 4070 if ( z >= (signed int)pViewport->uViewportTL_X |
4071 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
4072 && y >= (signed int)pViewport->uViewportTL_Y | |
4073 && y <= (signed int)pViewport->uViewportBR_Y ) | |
4074 { | |
4075 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
4076 x = pViewport->uViewportTL_X; | |
4077 if ( z > (signed int)pViewport->uViewportBR_X ) | |
4078 z = pViewport->uViewportBR_X; | |
0 | 4079 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
4080 v22 = z - x; | |
4081 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
4082 v7 = lightColor >> 3; | |
4083 v8 = lightColor & 0xF0; | |
4084 v9 = v7 & 0x1E0000; | |
4085 if ( pRenderer->uTargetGBits == 5 ) | |
4086 { | |
4087 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
4088 v11 = (int *)pTarget; | |
4089 v12 = pTargetZ; | |
4090 v13 = v22; | |
4091 v14 = (v10 << 16) | v10; | |
4092 z = (unsigned __int8)pTarget & 2; | |
4093 if ( (unsigned __int8)pTarget & 2 ) | |
4094 { | |
4095 z = (unsigned int)*pTargetZ >> 16; | |
4096 if ( z > v23 ) | |
4097 { | |
4098 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
4099 *pTarget = z; | |
4100 } | |
4101 v13 = v22 - 1; | |
4102 v11 = (int *)(pTarget + 1); | |
4103 v12 = pTargetZ + 1; | |
4104 } | |
4105 while ( v13 != 1 ) | |
4106 { | |
4107 if ( v13 < 1 ) | |
4108 return z; | |
4109 z = (unsigned int)*v12 >> 16; | |
4110 if ( z <= v23 ) | |
4111 { | |
4112 v13 -= 2; | |
4113 ++v11; | |
4114 v12 += 2; | |
4115 } | |
4116 else | |
4117 { | |
4118 v12 += 2; | |
4119 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4120 v13 -= 2; | |
4121 *v11 = z; | |
4122 ++v11; | |
4123 } | |
4124 } | |
4125 z = (unsigned int)*v12 >> 16; | |
4126 if ( z > v23 ) | |
4127 { | |
4128 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4129 *(short *)v11 = z; | |
4130 } | |
4131 } | |
4132 else | |
4133 { | |
4134 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4135 v16 = (int *)pTarget; | |
4136 v17 = pTargetZ; | |
4137 v18 = v22; | |
4138 v19 = (v15 << 16) | v15; | |
4139 z = (unsigned __int8)pTarget & 2; | |
4140 if ( (unsigned __int8)pTarget & 2 ) | |
4141 { | |
4142 z = (unsigned int)*pTargetZ >> 16; | |
4143 if ( z > v23 ) | |
4144 { | |
4145 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4146 *pTarget = z; | |
4147 } | |
4148 v18 = v22 - 1; | |
4149 v16 = (int *)(pTarget + 1); | |
4150 v17 = pTargetZ + 1; | |
4151 } | |
4152 while ( v18 != 1 ) | |
4153 { | |
4154 if ( v18 < 1 ) | |
4155 return z; | |
4156 z = (unsigned int)*v17 >> 16; | |
4157 if ( z <= v23 ) | |
4158 { | |
4159 v18 -= 2; | |
4160 ++v16; | |
4161 v17 += 2; | |
4162 } | |
4163 else | |
4164 { | |
4165 v17 += 2; | |
4166 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4167 v18 -= 2; | |
4168 *v16 = z; | |
4169 ++v16; | |
4170 } | |
4171 } | |
4172 z = (unsigned int)*v17 >> 16; | |
4173 if ( z > v23 ) | |
4174 { | |
4175 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4176 *(short *)v16 = z; | |
4177 } | |
4178 } | |
4179 } | |
4180 return z; | |
4181 } | |
4182 | |
4183 //----- (004A57E9) -------------------------------------------------------- | |
4184 void __cdecl Present_ColorKey() | |
4185 { | |
4186 HRESULT v0; // eax@3 | |
4187 HRESULT v1; // eax@3 | |
4188 HRESULT v2; // eax@3 | |
4189 HRESULT v3; // eax@3 | |
4190 HRESULT v4; // eax@3 | |
4191 RECT a2; // [sp+4h] [bp-14h]@3 | |
4192 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4193 | |
4194 if ( !pRenderer->uNumSceneBegins ) | |
4195 { | |
4196 if ( pRenderer->field_40110 ) | |
4197 { | |
693 | 4198 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4199 a2.left = 0; |
4200 a2.top = 0; | |
4201 a2.right = 640; | |
4202 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4203 a2.right = 640; | |
4204 a2.left = 0; | |
693 | 4205 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4206 a2.bottom = 480; |
4207 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4208 0, | |
693 | 4209 pViewport->uViewportBR_Y + 1, |
0 | 4210 pRenderer->pColorKeySurface4, |
4211 &a2, | |
4212 16u)); | |
693 | 4213 a2.right = pViewport->uViewportTL_X; |
4214 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4215 a2.left = 0; |
693 | 4216 a2.top = pViewport->uViewportTL_Y; |
0 | 4217 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4218 0, | |
693 | 4219 pViewport->uViewportTL_Y, |
0 | 4220 pRenderer->pColorKeySurface4, |
4221 &a2, | |
4222 16u)); | |
693 | 4223 a2.left = pViewport->uViewportBR_X; |
4224 a2.top = pViewport->uViewportTL_Y; | |
0 | 4225 a2.right = 640; |
693 | 4226 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4227 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4228 pViewport->uViewportBR_X, |
4229 pViewport->uViewportTL_Y, | |
0 | 4230 pRenderer->pColorKeySurface4, |
4231 &a2, | |
4232 16u)); | |
693 | 4233 a2.right = pViewport->uViewportBR_X; |
4234 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4235 a2.left = pViewport->uViewportTL_X; | |
4236 a2.top = pViewport->uViewportTL_Y; | |
0 | 4237 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4238 pViewport->uViewportTL_X, |
4239 pViewport->uViewportTL_Y, | |
0 | 4240 pRenderer->pColorKeySurface4, |
4241 &a2, | |
4242 17u)); | |
4243 } | |
4244 } | |
4245 } | |
4246 | |
4247 //----- (004A597D) -------------------------------------------------------- | |
4248 void Present_NoColorKey() | |
4249 { | |
4250 //unsigned __int16 *v0; // eax@4 | |
4251 unsigned __int16 *v1; // esi@4 | |
4252 void *v2; // edi@4 | |
4253 //signed int v4; // ebx@4 | |
4254 //signed int v5; // ebx@6 | |
4255 //void *v6; // edi@7 | |
4256 //const void *v7; // esi@7 | |
4257 signed int v8; // ebx@8 | |
4258 int v9; // eax@10 | |
4259 unsigned int v10; // esi@10 | |
4260 unsigned __int32 v11; // edi@10 | |
4261 //int v12; // ecx@10 | |
4262 unsigned int v13; // ebx@10 | |
4263 int v14; // eax@11 | |
4264 int v15; // eax@13 | |
4265 int v16; // eax@14 | |
4266 int v17; // eax@16 | |
4267 HRESULT v18; // eax@22 | |
4268 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4269 int v20; // [sp+88h] [bp-1Ch]@10 | |
4270 int v21; // [sp+8Ch] [bp-18h]@10 | |
4271 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4272 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4273 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4274 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4275 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4276 | |
4277 if ( !pRenderer->uNumSceneBegins ) | |
4278 { | |
4279 if ( pRenderer->field_40110 ) | |
4280 { | |
4281 memset(&Dst, 0, 0x7Cu); | |
4282 Dst.dwSize = 124; | |
168 | 4283 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4284 { |
4285 //v26 = Dst.lpSurface; | |
4286 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4287 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4288 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4289 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4290 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4291 v1 = pRenderer->pTargetSurface; | |
4292 v2 = Dst.lpSurface; | |
4293 | |
4294 | |
4295 /*for (uint y = 0; y < 480; ++y) | |
4296 { | |
4297 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4298 for (uint x = 0; x < 640; ++x) | |
4299 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4300 }*/ | |
4301 | |
4302 auto pSrc = pRenderer->pTargetSurface; | |
4303 auto pDst = (__int16 *)Dst.lpSurface; | |
4304 | |
4305 for (uint y = 0; y < 8; ++y) | |
4306 memcpy(pDst + y * Dst.lPitch / 2, | |
4307 | |
4308 pSrc + y * 640, 640 * sizeof(__int16)); | |
4309 | |
4310 for (uint y = 8; y < 352; ++y) | |
4311 { | |
4312 memcpy(pDst + y * Dst.lPitch / 2, | |
4313 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4314 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4315 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4316 } |
4317 | |
121 | 4318 for (uint y = 352; y < 480; ++y) |
0 | 4319 memcpy(pDst + y * Dst.lPitch / 2, |
4320 pSrc + y * 640, 640 * sizeof(__int16)); | |
4321 | |
4322 | |
693 | 4323 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4324 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4325 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4326 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4327 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4328 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4329 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4330 v21 = 4 * v9 + 1280; | |
4331 | |
121 | 4332 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4333 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4334 v10 = (int)pSrc_x1y1; | |
4335 v11 = (int)pDst_x1y1; | |
693 | 4336 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4337 v13 = v24; |
4338 | |
693 | 4339 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4340 { |
4341 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4342 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4343 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4344 { |
4345 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4346 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4347 } | |
4348 } | |
4349 | |
4350 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4351 | |
4352 /* while ( 1 ) | |
4353 { | |
4354 while ( 1 ) | |
4355 { | |
4356 v14 = *(int *)v10; | |
4357 v10 += 4; | |
4358 if ( v14 == v13 ) | |
4359 break; | |
4360 if ( (short)v14 == (short)v13 ) | |
4361 { | |
4362 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4363 v11 += 4; | |
4364 --uHalfWidth; | |
4365 if ( !uHalfWidth ) | |
4366 goto LABEL_21; | |
4367 } | |
4368 else | |
4369 { | |
4370 v15 = __ROL__(v14, 16); | |
4371 if ( (short)v15 == (short)v13 ) | |
4372 { | |
4373 v17 = __ROR__(v15, 16); | |
4374 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4375 v11 += 4; | |
4376 --uHalfWidth; | |
4377 if ( !uHalfWidth ) | |
4378 goto LABEL_21; | |
4379 } | |
4380 else | |
4381 { | |
4382 v16 = __ROR__(v15, 16); | |
4383 *(int *)v11 = v16; | |
4384 v11 += 4; | |
4385 --uHalfWidth; | |
4386 if ( !uHalfWidth ) | |
4387 goto LABEL_21; | |
4388 } | |
4389 } | |
4390 } | |
4391 v11 += 4; | |
4392 --uHalfWidth; | |
4393 if ( !uHalfWidth ) | |
4394 { | |
4395 LABEL_21: | |
4396 v10 += v21; | |
4397 v11 += v22; | |
4398 uHalfWidth = v20; | |
4399 if ( !--uNumLines ) | |
4400 { | |
4401 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4402 return; | |
4403 } | |
4404 } | |
4405 }*/ | |
4406 } | |
4407 } | |
4408 } | |
4409 } | |
4410 | |
4411 //----- (004A7063) -------------------------------------------------------- | |
4412 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4413 { | |
4414 float v2; // ST1C_4@1 | |
4415 double v3; // ST14_8@1 | |
4416 signed int v4; // ebx@1 | |
4417 float v5; // ST1C_4@1 | |
4418 double v6; // ST14_8@1 | |
4419 signed int v7; // edi@1 | |
4420 double v8; // ST0C_8@1 | |
4421 signed int v9; // esi@1 | |
4422 signed int v10; // ecx@1 | |
4423 double v12; // [sp+8h] [bp-18h]@1 | |
4424 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4425 | |
4426 v2 = (double)(uDiffuse >> 24) * a2; | |
4427 v3 = v2 + 6.7553994e15; | |
4428 v4 = LODWORD(v3); | |
4429 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4430 v6 = v5 + 6.7553994e15; | |
4431 v7 = LODWORD(v6); | |
4432 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4433 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4434 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4435 v9 = LODWORD(v8); | |
4436 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4437 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4438 v10 = LODWORD(v12); | |
4439 if ( v4 > 255 ) | |
4440 v4 = 255; | |
4441 if ( v4 < 0 ) | |
4442 v4 = 0; | |
4443 if ( SHIDWORD(v13) > 255 ) | |
4444 v7 = 255; | |
4445 if ( v7 < 0 ) | |
4446 v7 = 0; | |
4447 if ( (signed int)v13 > 255 ) | |
4448 v9 = 255; | |
4449 if ( v9 < 0 ) | |
4450 v9 = 0; | |
4451 if ( SLODWORD(v12) > 255 ) | |
4452 v10 = 255; | |
4453 if ( v10 < 0 ) | |
4454 v10 = 0; | |
4455 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4456 } | |
4457 | |
4458 //----- (004AD504) -------------------------------------------------------- | |
711 | 4459 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4460 { |
4461 int result; // eax@1 | |
711 | 4462 signed int v2; // ebx@1 |
0 | 4463 BLVFace *v3; // esi@3 |
4464 Texture *v4; // edi@6 | |
4465 int v5; // eax@7 | |
4466 int v6; // edx@7 | |
4467 int v7; // ecx@7 | |
4468 int v8; // ebx@8 | |
4469 int v9; // eax@8 | |
4470 int v10; // ebx@8 | |
4471 unsigned int v11; // ebx@9 | |
4472 int v12; // esi@10 | |
4473 int v13; // eax@13 | |
4474 unsigned __int16 *v14; // eax@13 | |
4475 unsigned int v15; // eax@14 | |
4476 unsigned __int16 *v16; // ebx@14 | |
4477 int v17; // eax@15 | |
4478 int v18; // ebx@15 | |
4479 int v19; // esi@15 | |
4480 int v20; // ecx@15 | |
4481 int v21; // eax@15 | |
4482 stru193_math *v22; // ebx@15 | |
4483 int v23; // eax@15 | |
4484 char *v24; // esi@16 | |
4485 int v25; // eax@18 | |
4486 int v26; // eax@18 | |
4487 int v27; // eax@20 | |
4488 signed int v28; // esi@20 | |
4489 signed int v29; // edx@20 | |
4490 signed int v30; // esi@20 | |
4491 signed int v31; // edi@20 | |
4492 int v32; // esi@20 | |
4493 int v33; // eax@26 | |
4494 int *v34; // esi@27 | |
4495 unsigned __int16 *v35; // edi@27 | |
4496 unsigned int v36; // edx@27 | |
4497 int v37; // ebx@27 | |
4498 char v38; // cl@27 | |
4499 char v39; // ch@27 | |
4500 int v40; // ebx@29 | |
4501 int v41; // edx@29 | |
4502 unsigned int v42; // ebx@30 | |
4503 int v43; // edx@30 | |
4504 int v44; // eax@33 | |
4505 int *v45; // esi@34 | |
4506 unsigned __int16 *v46; // edi@34 | |
4507 unsigned int v47; // edx@34 | |
4508 int v48; // ebx@34 | |
4509 char v49; // cl@34 | |
4510 char v50; // ch@34 | |
4511 int v51; // ebx@36 | |
4512 int v52; // edx@36 | |
4513 unsigned __int16 v53; // bx@37 | |
4514 int v54; // edx@37 | |
4515 int v55; // eax@40 | |
4516 int v56; // eax@41 | |
4517 int *v57; // esi@42 | |
4518 unsigned __int16 *v58; // edi@42 | |
4519 unsigned int v59; // edx@42 | |
4520 int v60; // ebx@42 | |
4521 char v61; // cl@42 | |
4522 char v62; // ch@42 | |
4523 unsigned int v63; // ebx@44 | |
4524 int v64; // edx@44 | |
4525 unsigned int v65; // ebx@44 | |
4526 int v66; // edx@44 | |
4527 unsigned int v67; // ebx@45 | |
4528 int v68; // edx@45 | |
4529 int v69; // ebx@45 | |
4530 int v70; // edx@45 | |
4531 int v71; // eax@48 | |
4532 int *v72; // esi@49 | |
4533 unsigned __int16 *v73; // edi@49 | |
4534 unsigned int v74; // edx@49 | |
4535 int v75; // ebx@49 | |
4536 char v76; // cl@49 | |
4537 char v77; // ch@49 | |
4538 unsigned int v78; // ebx@51 | |
4539 int v79; // edx@51 | |
4540 unsigned int v80; // ebx@51 | |
4541 int v81; // edx@51 | |
4542 unsigned int v82; // ebx@52 | |
4543 int v83; // edx@52 | |
4544 int v84; // ebx@52 | |
4545 int v85; // edx@52 | |
4546 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4547 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4548 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4549 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4550 int v90; // [sp+1Ch] [bp-88h]@20 | |
4551 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4552 int v92; // [sp+24h] [bp-80h]@7 | |
4553 int i; // [sp+28h] [bp-7Ch]@7 | |
4554 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4555 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4556 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4557 int v97; // [sp+38h] [bp-6Ch]@15 | |
4558 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4559 int v99; // [sp+40h] [bp-64h]@9 | |
4560 int v100; // [sp+44h] [bp-60h]@24 | |
4561 int v101; // [sp+48h] [bp-5Ch]@10 | |
4562 int v102; // [sp+4Ch] [bp-58h]@20 | |
4563 int v103; // [sp+50h] [bp-54h]@20 | |
4564 int v104; // [sp+54h] [bp-50h]@9 | |
4565 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4566 int v106; // [sp+5Ch] [bp-48h]@24 | |
4567 int v107; // [sp+60h] [bp-44h]@20 | |
4568 int v108; // [sp+64h] [bp-40h]@20 | |
4569 int v109; // [sp+68h] [bp-3Ch]@20 | |
4570 int v110; // [sp+6Ch] [bp-38h]@15 | |
4571 int v111; // [sp+70h] [bp-34h]@20 | |
4572 int a1; // [sp+74h] [bp-30h]@12 | |
4573 int a2; // [sp+78h] [bp-2Ch]@9 | |
4574 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4575 int v115; // [sp+80h] [bp-24h]@18 | |
4576 int v116; // [sp+84h] [bp-20h]@7 | |
4577 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4578 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4579 int *v119; // [sp+90h] [bp-14h]@13 | |
4580 int v120; // [sp+94h] [bp-10h]@15 | |
4581 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4582 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4583 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4584 | |
4585 result = pRenderer->uTargetSurfacePitch; | |
711 | 4586 v2 = sFaceID; |
0 | 4587 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4588 if ( sFaceID >= 0 ) |
4589 { | |
4590 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4591 { | |
4592 v3 = &pIndoor->pFaces[sFaceID]; | |
4593 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4594 if ( !pRenderer->pRenderD3D ) |
4595 { | |
711 | 4596 result = sub_423B5D(sFaceID); |
0 | 4597 if ( result ) |
4598 { | |
4599 result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
4600 if ( result ) | |
4601 { | |
4602 result = (int)v3->GetTexture(); | |
4603 v4 = (Texture *)result; | |
4604 v96 = (Texture *)result; | |
4605 if ( result ) | |
4606 { | |
4607 v5 = *(short *)(result + 38); | |
4608 LOBYTE(v3->uAttributes) |= 0x80u; | |
4609 v92 = v5; | |
4610 sub_4AE5F1(v2); | |
4611 ++pBLVRenderParams->field_84; | |
4612 v6 = stru_F8AD28.pDeltaUV[0]; | |
4613 v116 = stru_F8AD28.pDeltaUV[1]; | |
4614 v7 = 0; | |
4615 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4616 { | |
4617 v8 = v116; | |
4618 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4619 v9 = 4 * v7 + 16297672; | |
4620 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4621 } | |
4622 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4623 result = stru_F8A590._viewport_space_y; | |
4624 a2 = stru_F8A590._viewport_space_y; | |
4625 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4626 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4627 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4628 v87 = v4->pLevelOfDetail1; |
4629 v88 = v4->pLevelOfDetail2; | |
4630 v89 = v4->pLevelOfDetail3; | |
4631 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4632 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4633 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4634 { | |
4635 v12 = 2 * stru_F8A590._viewport_space_y; | |
4636 v101 = 2 * stru_F8A590._viewport_space_y; | |
4637 while ( 1 ) | |
4638 { | |
4639 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4640 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4641 if ( LOBYTE(viewparams->field_20) ) | |
4642 { | |
4643 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4644 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4645 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4646 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4647 - pBLVRenderParams->uViewportX]; | |
4648 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4649 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4650 - pBLVRenderParams->uViewportX]; | |
4651 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4652 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4653 - pBLVRenderParams->uViewportX]; | |
4654 v123 = (unsigned int)v16; | |
4655 } | |
4656 else | |
4657 { | |
4658 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4659 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4660 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4661 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4662 } | |
4663 v117 = (unsigned int)v14; | |
4664 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4665 v18 = stru_F81018.field_0.field_10; | |
4666 LOWORD(v17) = 0; | |
4667 v97 = stru_F8AD28.field_0 | v17; | |
4668 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4669 v19 = stru_F81018.field_0.field_4 >> i; | |
4670 v20 = 11 - v18; | |
4671 v116 = stru_F81018.field_0.field_8 >> i; | |
4672 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4673 v22 = stru_5C6E00; | |
4674 v122 = (unsigned __int16 *)v20; | |
323 | 4675 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4676 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4677 v120 = v116 + 4 * v23; |
4678 if ( v123 < v117 ) | |
4679 { | |
4680 v24 = (char *)&stru_F81018.field_34.field_8; | |
4681 v114 = &stru_F81018.field_34.field_8; | |
4682 a1 += 16; | |
4683 while ( 1 ) | |
4684 { | |
4685 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4686 v25 = *((int *)v24 - 2); | |
4687 LOWORD(v25) = 0; | |
4688 v115 = v97; | |
4689 v26 = stru_F8AD28.field_0 | v25; | |
4690 if ( v97 <= (unsigned int)v26 ) | |
4691 v115 = v26; | |
4692 v97 = v26; | |
4693 v27 = *((int *)v24 - 11); | |
4694 v28 = *((int *)v24 - 1); | |
4695 v105 = (&v86)[4 * v27]; | |
4696 v111 = v27 + 16; | |
4697 v29 = v4->uWidthMinus1; | |
4698 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4699 v107 = v29 >> v27; | |
4700 v30 = v28 >> i; | |
4701 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4702 v31 = *v114 >> i; | |
4703 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4704 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4705 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4706 v108 = (signed int)(v116 - v121) >> 4; |
4707 v103 = (v90 - v120) >> 4; | |
4708 v32 = v123 + 32; | |
4709 if ( LOBYTE(viewparams->field_20) ) | |
4710 v32 = v123 + 64; | |
4711 if ( v32 > v117 ) | |
4712 v32 = v117; | |
4713 v118 = v32; | |
4714 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4715 v106 = (signed int)(v32 - v123) >> 1; | |
4716 if ( v110 >> 16 == v100 >> 16 ) | |
4717 { | |
4718 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4719 if ( LOBYTE(viewparams->field_20) ) | |
4720 { | |
4721 v44 = v123; | |
4722 if ( v123 < v118 ) | |
4723 { | |
4724 v45 = v119; | |
4725 v46 = v122; | |
4726 v47 = v121; | |
4727 v48 = v120; | |
4728 v49 = v111; | |
4729 v50 = v109; | |
4730 if ( v106 & 2 ) | |
4731 { | |
4732 *v119 = v115; | |
4733 v45 -= 2; | |
4734 v44 = v123 + 4; | |
4735 goto LABEL_37; | |
4736 } | |
4737 do | |
4738 { | |
4739 v44 += 8; | |
4740 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4741 v52 = v115; | |
4742 LOWORD(v51) = v46[v51]; | |
4743 *v45 = v115; | |
4744 v45[1] = v52; | |
4745 v45[640] = v52; | |
4746 v45[641] = v52; | |
4747 *(short *)(v44 - 8) = v51; | |
4748 *(short *)(v44 - 6) = v51; | |
4749 *(short *)(v44 + 1272) = v51; | |
4750 *(short *)(v44 + 1274) = v51; | |
4751 v45[2] = v52; | |
4752 v45[3] = v52; | |
4753 v45[642] = v52; | |
4754 v45[643] = v52; | |
4755 v121 += v108; | |
4756 v120 += v103; | |
4757 v47 = v121; | |
4758 v48 = v120; | |
4759 LABEL_37: | |
4760 v45 += 4; | |
4761 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4762 v54 = v108; | |
4763 *(short *)(v44 - 4) = v53; | |
4764 *(short *)(v44 - 2) = v53; | |
4765 *(short *)(v44 + 1276) = v53; | |
4766 *(short *)(v44 + 1278) = v53; | |
4767 v121 += v54; | |
4768 v120 += v103; | |
4769 v47 = v121; | |
4770 v48 = v120; | |
4771 } | |
4772 while ( v44 < v118 ); | |
4773 v123 = v44; | |
4774 v119 = v45; | |
4775 } | |
4776 } | |
4777 else | |
4778 { | |
4779 v33 = v123; | |
4780 if ( v123 < v118 ) | |
4781 { | |
4782 v34 = v119; | |
4783 v35 = v122; | |
4784 v36 = v121; | |
4785 v37 = v120; | |
4786 v38 = v111; | |
4787 v39 = v109; | |
4788 if ( v106 & 1 ) | |
4789 { | |
4790 *v119 = v115; | |
4791 --v34; | |
4792 v33 = v123 + 2; | |
4793 goto LABEL_30; | |
4794 } | |
4795 do | |
4796 { | |
4797 v33 += 4; | |
4798 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4799 v41 = v115; | |
4800 LOWORD(v40) = v35[v40]; | |
4801 *v34 = v115; | |
4802 *(short *)(v33 - 4) = v40; | |
4803 v34[1] = v41; | |
4804 v121 += v108; | |
4805 v120 += v103; | |
4806 v36 = v121; | |
4807 v37 = v120; | |
4808 LABEL_30: | |
4809 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4810 v34 += 2; | |
4811 v43 = v108; | |
4812 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4813 v121 += v43; | |
4814 v120 += v103; | |
4815 v36 = v121; | |
4816 v37 = v120; | |
4817 } | |
4818 while ( v33 < v118 ); | |
4819 v123 = v33; | |
4820 v119 = v34; | |
4821 } | |
4822 } | |
4823 } | |
4824 else | |
4825 { | |
4826 v55 = v110 - ((v100 - v110) >> 4); | |
4827 v110 = (v100 - v110) >> 4; | |
4828 v122 = (unsigned __int16 *)v55; | |
4829 if ( LOBYTE(viewparams->field_20) ) | |
4830 { | |
4831 v71 = v123; | |
4832 if ( v123 < v118 ) | |
4833 { | |
4834 v72 = v119; | |
4835 v73 = v94; | |
4836 v74 = v121; | |
4837 v75 = v120; | |
4838 v76 = v111; | |
4839 v77 = v109; | |
4840 if ( v106 & 2 ) | |
4841 { | |
4842 *v119 = v115; | |
4843 v72 += 2; | |
4844 v71 = v123 + 4; | |
4845 goto LABEL_52; | |
4846 } | |
4847 do | |
4848 { | |
4849 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4850 v79 = (int)((char *)v122 + v110); | |
4851 v71 += 8; | |
4852 v122 = (unsigned __int16 *)v79; | |
4853 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4854 v81 = v115; | |
4855 LOWORD(v80) = v73[v80]; | |
4856 *v72 = v115; | |
4857 v72[1] = v81; | |
4858 v72[640] = v81; | |
4859 v72[641] = v81; | |
4860 *(short *)(v71 - 8) = v80; | |
4861 *(short *)(v71 - 6) = v80; | |
4862 *(short *)(v71 + 1272) = v80; | |
4863 *(short *)(v71 + 1274) = v80; | |
4864 v72[2] = v81; | |
4865 v72[3] = v81; | |
4866 v72[642] = v81; | |
4867 v72[643] = v81; | |
4868 v121 += v108; | |
4869 v120 += v103; | |
4870 v74 = v121; | |
4871 v75 = v120; | |
4872 v72 += 4; | |
4873 LABEL_52: | |
4874 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4875 v83 = (int)((char *)v122 + v110); | |
4876 v84 = v105[v82]; | |
4877 v122 = (unsigned __int16 *)v83; | |
4878 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4879 v85 = v108; | |
4880 *(short *)(v71 - 4) = v84; | |
4881 *(short *)(v71 - 2) = v84; | |
4882 *(short *)(v71 + 1276) = v84; | |
4883 *(short *)(v71 + 1278) = v84; | |
4884 v121 += v85; | |
4885 v120 += v103; | |
4886 v74 = v121; | |
4887 v75 = v120; | |
4888 } | |
4889 while ( v71 < v118 ); | |
4890 v123 = v71; | |
4891 v119 = v72; | |
4892 } | |
4893 } | |
4894 else | |
4895 { | |
4896 v56 = v123; | |
4897 if ( v123 < v118 ) | |
4898 { | |
4899 v57 = v119; | |
4900 v58 = v94; | |
4901 v59 = v121; | |
4902 v60 = v120; | |
4903 v61 = v111; | |
4904 v62 = v109; | |
4905 if ( v106 & 1 ) | |
4906 { | |
4907 *v119 = v115; | |
4908 ++v57; | |
4909 v56 = v123 + 2; | |
4910 goto LABEL_45; | |
4911 } | |
4912 do | |
4913 { | |
4914 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4915 v64 = (int)((char *)v122 + v110); | |
4916 v56 += 4; | |
4917 v122 = (unsigned __int16 *)v64; | |
4918 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4919 v66 = v115; | |
4920 LOWORD(v65) = v58[v65]; | |
4921 *v57 = v115; | |
4922 *(short *)(v56 - 4) = v65; | |
4923 v57[1] = v66; | |
4924 v121 += v108; | |
4925 v120 += v103; | |
4926 v59 = v121; | |
4927 v60 = v120; | |
4928 v57 += 2; | |
4929 LABEL_45: | |
4930 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4931 v68 = (int)((char *)v122 + v110); | |
4932 v69 = v105[v67]; | |
4933 v122 = (unsigned __int16 *)v68; | |
4934 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4935 v70 = v108; | |
4936 *(short *)(v56 - 2) = v69; | |
4937 v121 += v70; | |
4938 v120 += v103; | |
4939 v59 = v121; | |
4940 v60 = v120; | |
4941 } | |
4942 while ( v56 < v118 ); | |
4943 v123 = v56; | |
4944 v119 = v57; | |
4945 } | |
4946 } | |
4947 } | |
4948 v114 += 13; | |
4949 v110 = v100; | |
4950 a1 += 16; | |
4951 v4 = v96; | |
4952 v121 = v116; | |
4953 v120 = v90; | |
4954 if ( v123 >= v117 ) | |
4955 break; | |
4956 v24 = (char *)v114; | |
4957 v22 = stru_5C6E00; | |
4958 } | |
4959 } | |
4960 ++a2; | |
4961 v98 += v95; | |
4962 result = a2; | |
4963 v101 += 2; | |
4964 v99 += 640; | |
4965 if ( a2 > stru_F8A590._viewport_space_w ) | |
4966 break; | |
4967 v12 = v101; | |
4968 result = a2; | |
4969 v11 = v98; | |
4970 } | |
4971 } | |
4972 } | |
4973 } | |
4974 } | |
4975 } | |
4976 } | |
4977 } | |
4978 return result; | |
4979 } | |
4980 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4981 | |
4982 //----- (004ADD1D) -------------------------------------------------------- | |
4983 void __fastcall sub_4ADD1D(int uFaceID) | |
4984 { | |
4985 int v1; // edi@1 | |
4986 BLVFace *v2; // esi@3 | |
4987 signed int v3; // ebx@4 | |
4988 Texture *v4; // edi@9 | |
4989 signed int v5; // eax@9 | |
4990 char *v6; // edi@12 | |
4991 signed int v7; // eax@15 | |
4992 unsigned int v8; // eax@16 | |
4993 __int16 v9; // cx@19 | |
4994 unsigned __int8 *v10; // eax@19 | |
4995 unsigned __int16 *v11; // eax@19 | |
4996 int v12; // edi@19 | |
4997 int v13; // ebx@20 | |
4998 stru352 *v14; // esi@20 | |
4999 DWORD v15; // eax@22 | |
5000 signed int v16; // ecx@22 | |
5001 signed int v17; // ST68_4@22 | |
5002 int v18; // eax@22 | |
5003 int v19; // ecx@22 | |
5004 unsigned int v20; // esi@23 | |
5005 int v21; // edi@23 | |
5006 int v22; // eax@23 | |
5007 int *v23; // ebx@24 | |
5008 int v24; // edx@24 | |
5009 int v25; // ebx@25 | |
5010 unsigned __int16 v26; // cx@25 | |
5011 int v27; // edx@26 | |
5012 unsigned __int16 v28; // cx@26 | |
5013 unsigned __int8 v29; // sf@27 | |
5014 unsigned __int8 v30; // of@27 | |
5015 unsigned int v31; // esi@29 | |
5016 int v32; // edi@29 | |
5017 unsigned __int16 *v33; // eax@29 | |
5018 int *v34; // ebx@30 | |
5019 int v35; // edx@30 | |
5020 int v36; // ebx@31 | |
5021 unsigned __int16 v37; // cx@31 | |
5022 int v38; // edx@32 | |
5023 unsigned __int16 v39; // cx@32 | |
5024 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
5025 int v41; // [sp-Ch] [bp-68h]@15 | |
5026 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
5027 signed int v43; // [sp+14h] [bp-48h]@12 | |
5028 signed int v44; // [sp+14h] [bp-48h]@22 | |
5029 int v45; // [sp+1Ch] [bp-40h]@22 | |
5030 int v46; // [sp+20h] [bp-3Ch]@22 | |
5031 int v47; // [sp+24h] [bp-38h]@19 | |
5032 char v48; // [sp+28h] [bp-34h]@19 | |
5033 int v49; // [sp+2Ch] [bp-30h]@19 | |
5034 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
5035 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
5036 int v52; // [sp+38h] [bp-24h]@22 | |
5037 int v53; // [sp+3Ch] [bp-20h]@22 | |
5038 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
5039 int v55; // [sp+40h] [bp-1Ch]@20 | |
5040 int v56; // [sp+44h] [bp-18h]@20 | |
5041 stru352 *i; // [sp+48h] [bp-14h]@20 | |
5042 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
5043 int v59; // [sp+50h] [bp-Ch]@4 | |
5044 int v60; // [sp+50h] [bp-Ch]@19 | |
5045 int v61; // [sp+54h] [bp-8h]@22 | |
5046 int *v62; // [sp+58h] [bp-4h]@23 | |
5047 int *v63; // [sp+58h] [bp-4h]@29 | |
5048 | |
5049 v1 = uFaceID; | |
5050 v42 = pRenderer->uTargetSurfacePitch; | |
5051 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
5052 { | |
5053 v2 = &pIndoor->pFaces[uFaceID]; | |
5054 if ( pRenderer->pRenderD3D ) | |
5055 { | |
5056 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
5057 v59 = v3; | |
5058 } | |
5059 else | |
5060 { | |
5061 v59 = sub_423B5D(uFaceID); | |
5062 v3 = v59; | |
5063 } | |
5064 if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
5065 { | |
5066 v4 = v2->GetTexture(); | |
5067 v5 = 0; | |
5068 if ( v4 ) | |
5069 { | |
5070 if ( pRenderer->pRenderD3D ) | |
5071 { | |
5072 if ( v3 > 0 ) | |
5073 { | |
5074 v54 = v3; | |
5075 v43 = v3; | |
5076 v6 = (char *)&array_507D30[0].v; | |
5077 do | |
5078 { | |
5079 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
5080 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
5081 v6 += 48; | |
5082 --v54; | |
5083 } | |
5084 while ( v54 ); | |
5085 v3 = v59; | |
5086 v5 = v43; | |
5087 } | |
5088 v7 = v5; | |
5089 v41 = stru_F8AD28.field_0; | |
5090 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
5091 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
5092 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
5093 { | |
5094 v40 = v2->GetTexture(); | |
5095 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
5096 } | |
5097 else | |
5098 { | |
5099 v40 = v2->GetTexture(); | |
5100 v8 = v2->uBitmapID; | |
5101 } | |
5102 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
5103 } | |
5104 else | |
5105 { | |
5106 v49 = v4->uWidthMinus1; | |
5107 v47 = v4->uHeightMinus1 << 16; | |
5108 v9 = 16 - v4->uWidthLn2; | |
710 | 5109 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 5110 LOBYTE(v2->uAttributes) |= 0x80u; |
5111 v48 = v9; | |
5112 v50 = v10; | |
5113 sub_4AF412(); | |
5114 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5115 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
5116 v12 = stru_F8A590._viewport_space_y; | |
5117 v51 = v11; | |
5118 v60 = stru_F8A590._viewport_space_y; | |
5119 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5120 { | |
5121 v13 = 2 * stru_F8A590._viewport_space_y; | |
5122 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5123 v55 = 2 * stru_F8A590._viewport_space_y; | |
5124 v56 = 640 * stru_F8A590._viewport_space_y; | |
5125 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5126 { | |
5127 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5128 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5129 v15 = GetTickCount(); | |
5130 v16 = v14->field_0; | |
5131 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5132 v45 = v14->field_4 >> 3; | |
5133 v44 = v16 >> 3; | |
5134 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5135 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5136 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5137 v18 = v14->field_28; | |
5138 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5139 LOWORD(v18) = 0; | |
5140 v46 = stru_F8AD28.field_0 | v18; | |
5141 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5142 if ( LOBYTE(viewparams->field_20) ) | |
5143 { | |
5144 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5145 - pBLVRenderParams->uViewportX]; | |
5146 v31 = v44; | |
5147 v32 = v45; | |
5148 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5149 + 2 * v19 | |
5150 - pBLVRenderParams->uViewportX]; | |
5151 if ( v61 & 1 ) | |
5152 { | |
5153 --v61; | |
5154 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5155 + 2 * v19 | |
5156 - pBLVRenderParams->uViewportX | |
5157 - 2]; | |
5158 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5159 - pBLVRenderParams->uViewportX]; | |
5160 v35 = v46; | |
5161 v63 += 2; | |
5162 goto LABEL_32; | |
5163 } | |
5164 while ( 1 ) | |
5165 { | |
5166 v30 = __OFSUB__(v61, 2); | |
5167 v29 = v61 - 2 < 0; | |
5168 v61 -= 2; | |
5169 if ( v29 ^ v30 ) | |
5170 break; | |
5171 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5172 v31 += v52; | |
5173 v37 = v51[v36]; | |
5174 v32 += v53; | |
5175 v34 = v63; | |
5176 v35 = v46; | |
5177 *v33 = v37; | |
5178 v33[1] = v37; | |
5179 v33[640] = v37; | |
5180 v33[641] = v37; | |
5181 v63 += 4; | |
5182 v34[2] = v46; | |
5183 v34[3] = v46; | |
5184 v34[642] = v46; | |
5185 v34[643] = v46; | |
5186 LABEL_32: | |
5187 *v34 = v35; | |
5188 v34[1] = v35; | |
5189 v34[640] = v35; | |
5190 v34[641] = v35; | |
5191 v38 = v49 & (v31 >> 16); | |
5192 v33 += 4; | |
5193 v31 += v52; | |
5194 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5195 v32 += v53; | |
5196 *(v33 - 2) = v39; | |
5197 *(v33 - 1) = v39; | |
5198 v33[638] = v39; | |
5199 v33[639] = v39; | |
5200 } | |
5201 } | |
5202 else | |
5203 { | |
5204 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5205 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5206 v20 = v44; | |
5207 v21 = v45; | |
5208 v22 = (int)v58; | |
5209 if ( v61 & 1 ) | |
5210 { | |
5211 --v61; | |
5212 v22 = (int)(v58 - 1); | |
5213 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5214 v24 = v46; | |
5215 ++v62; | |
5216 goto LABEL_26; | |
5217 } | |
5218 while ( 1 ) | |
5219 { | |
5220 v30 = __OFSUB__(v61, 2); | |
5221 v29 = v61 - 2 < 0; | |
5222 v61 -= 2; | |
5223 if ( v29 ^ v30 ) | |
5224 break; | |
5225 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5226 v20 += v52; | |
5227 v26 = v51[v25]; | |
5228 v21 += v53; | |
5229 v23 = v62; | |
5230 v24 = v46; | |
5231 *(short *)v22 = v26; | |
5232 v62 += 2; | |
5233 v23[1] = v46; | |
5234 LABEL_26: | |
5235 *v23 = v24; | |
5236 v27 = v49 & (v20 >> 16); | |
5237 v22 += 4; | |
5238 v20 += v52; | |
5239 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5240 v21 += v53; | |
5241 *(short *)(v22 - 2) = v28; | |
5242 } | |
5243 } | |
5244 ++v60; | |
5245 ++i; | |
5246 v56 += 640; | |
5247 v55 += 2; | |
5248 if ( v60 > stru_F8A590._viewport_space_w ) | |
5249 break; | |
5250 v13 = v55; | |
5251 v12 = v60; | |
5252 } | |
5253 } | |
5254 } | |
5255 } | |
5256 } | |
5257 } | |
5258 } | |
5259 | |
5260 //----- (004AE1E7) -------------------------------------------------------- | |
5261 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5262 { | |
5263 int v3; // ebx@1 | |
5264 int v4; // edi@1 | |
5265 int v5; // esi@1 | |
5266 signed __int64 v6; // qtt@3 | |
5267 int v7; // esi@3 | |
5268 int v8; // eax@5 | |
5269 int result; // eax@5 | |
5270 int v10; // edx@5 | |
5271 int v11; // [sp+Ch] [bp-8h]@1 | |
5272 int v12; // [sp+1Ch] [bp+8h]@2 | |
5273 | |
5274 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5275 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5276 v11 = a1; | |
5277 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5278 + stru_F8AD28.field_7C | |
5279 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5280 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5281 { | |
5282 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5283 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5284 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5285 } | |
5286 else | |
5287 { | |
5288 v7 = 1073741824; | |
5289 } | |
5290 v8 = stru_F8AD28.vec_9C.z; | |
5291 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5292 + stru_F8AD28.vec_8C.x | |
5293 + v4 * stru_F8AD28.vec_8C.y) | |
5294 * (signed __int64)v7) >> 16) | |
5295 + stru_F8AD28.field_98; | |
5296 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5297 v10 = result + stru_F8AD28.field_A8; | |
5298 stru_F83B80[v11].field_28 = v7; | |
5299 stru_F83B80[v11].field_4 = v10; | |
5300 return result; | |
5301 } | |
5302 | |
5303 //----- (004AE313) -------------------------------------------------------- | |
5304 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5305 { | |
5306 int _dy; // ebx@1 | |
5307 int _dx; // edi@1 | |
5308 int v5; // ecx@1 | |
5309 int v6; // esi@1 | |
5310 int v7; // ST18_4@2 | |
5311 signed __int64 v8; // qtt@3 | |
5312 unsigned int v9; // ecx@3 | |
5313 int result; // eax@8 | |
5314 int v11; // [sp+Ch] [bp-8h]@1 | |
5315 | |
5316 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5317 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5318 ++pBLVRenderParams->field_88; | |
5319 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5320 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5321 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5322 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5323 { | |
5324 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5325 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5326 v9 = v8 / v11; | |
5327 } | |
5328 else | |
5329 { | |
5330 v9 = 0x40000000u; | |
5331 } | |
5332 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5333 p->field_0 = v9; | |
5334 else | |
5335 p->field_0 = stru_F8AD28.field_34; | |
5336 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5337 * (signed __int64)(signed int)v9) >> 16) | |
5338 + stru_F8AD28.field_98 | |
5339 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5340 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5341 * (signed __int64)(signed int)v9) >> 16) | |
5342 + stru_F8AD28.field_A8 | |
5343 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5344 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5345 if ( result < 369620 || bUseLoResSprites ) | |
5346 { | |
5347 if ( result < 184810 ) | |
5348 p->field_10 = result > 92405; | |
5349 else | |
5350 p->field_10 = 2; | |
5351 } | |
5352 else | |
5353 { | |
5354 p->field_10 = 3; | |
5355 } | |
5356 return result; | |
5357 } | |
5358 | |
5359 //----- (004AE491) -------------------------------------------------------- | |
5360 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5361 { | |
5362 signed int v2; // eax@1 | |
5363 signed int v3; // edi@1 | |
5364 int v4; // ecx@1 | |
5365 int v5; // esi@2 | |
5366 int v6; // eax@2 | |
5367 int v7; // ebx@2 | |
5368 unsigned int v8; // ecx@2 | |
5369 int v9; // edx@5 | |
5370 int v10; // edx@7 | |
5371 unsigned int v11; // eax@8 | |
5372 int v13; // [sp+4h] [bp-18h]@2 | |
5373 int v14; // [sp+8h] [bp-14h]@2 | |
5374 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5375 int v16; // [sp+14h] [bp-8h]@1 | |
5376 int v17; // [sp+18h] [bp-4h]@1 | |
5377 | |
5378 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5379 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5380 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5381 v4 = 0; | |
5382 v15 = v2; | |
5383 v16 = 0; | |
5384 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5385 { | |
5386 do | |
5387 { | |
5388 v5 = v16; | |
5389 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5390 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5391 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5392 v7 = v13; | |
5393 v8 = v14; | |
5394 if ( v6 < v13 ) | |
5395 { | |
5396 v6 = v13; | |
5397 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5398 } | |
5399 if ( v6 < v14 ) | |
5400 { | |
5401 v9 = v6; | |
5402 v6 = v14; | |
5403 v8 = v9; | |
5404 } | |
5405 if ( v7 < (signed int)v8 ) | |
5406 { | |
5407 v10 = v8; | |
5408 v8 = v7; | |
5409 v7 = v10; | |
5410 } | |
5411 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5412 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5413 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5414 ++v16; | |
5415 v2 = v15; | |
5416 } | |
5417 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5418 v4 = 0; | |
5419 } | |
5420 if ( stru_F8AD28.field_3E4 != v4 ) | |
5421 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5422 if ( v17 >= v4 ) | |
5423 { | |
5424 if ( v17 > 2031616 ) | |
5425 v17 = 2031616; | |
5426 } | |
5427 else | |
5428 { | |
5429 v17 = v4; | |
5430 } | |
5431 ++pBLVRenderParams->field_8C; | |
5432 return v17; | |
5433 } | |
5434 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5435 | |
5436 //----- (004AE5F1) -------------------------------------------------------- | |
5437 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5438 { | |
5439 BLVFace *v1; // esi@1 | |
5440 BLVFaceExtra *v2; // ebx@1 | |
5441 int v3; // eax@1 | |
5442 int v4; // edi@1 | |
5443 Texture *v5; // edi@1 | |
5444 int v6; // eax@1 | |
5445 unsigned int v7; // eax@1 | |
5446 unsigned int v8; // ecx@1 | |
5447 unsigned int v9; // eax@1 | |
5448 unsigned int v10; // ecx@5 | |
5449 int v11; // edi@10 | |
5450 int v12; // ecx@10 | |
5451 int v13; // eax@10 | |
5452 int v14; // edx@10 | |
5453 int v15; // ebx@12 | |
5454 double v16; // st7@16 | |
5455 int v17; // eax@16 | |
5456 char *v18; // ebx@17 | |
5457 int v19; // ecx@19 | |
5458 int v20; // eax@19 | |
5459 int v21; // edx@21 | |
5460 int v22; // eax@23 | |
5461 int v23; // ST04_4@26 | |
5462 int v24; // edi@26 | |
5463 double v25; // st6@26 | |
5464 int v26; // eax@26 | |
5465 double v27; // st6@26 | |
5466 int v28; // ecx@26 | |
5467 char v29; // al@26 | |
5468 int v30; // edx@28 | |
5469 int v31; // ecx@28 | |
5470 BLVLightMM7 *v32; // ecx@32 | |
5471 int v33; // edi@33 | |
5472 int v34; // edx@33 | |
5473 int v35; // eax@33 | |
5474 int v36; // edi@35 | |
5475 int v37; // edx@37 | |
5476 int v38; // ebx@39 | |
5477 int v39; // edi@42 | |
5478 int v40; // eax@42 | |
5479 char *v41; // ebx@45 | |
5480 signed int v42; // ecx@47 | |
5481 int v43; // edi@47 | |
5482 int v44; // eax@49 | |
5483 int v45; // edx@51 | |
5484 int v46; // eax@53 | |
5485 int v47; // ST04_4@55 | |
5486 int v48; // edi@55 | |
5487 double v49; // st6@55 | |
5488 int v50; // eax@55 | |
5489 double v51; // st6@55 | |
5490 int v52; // eax@55 | |
5491 int v53; // ecx@57 | |
5492 int v54; // ecx@58 | |
5493 int v55; // ecx@59 | |
5494 int v56; // edx@62 | |
5495 int v57; // ecx@62 | |
5496 int v58; // eax@63 | |
5497 int v59; // edx@64 | |
5498 int v60; // ecx@67 | |
5499 int v61; // edx@67 | |
5500 int v62; // eax@68 | |
5501 int v63; // edx@69 | |
5502 signed int v64; // ecx@72 | |
5503 double v65; // st7@75 | |
5504 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5505 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5506 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5507 int v69; // [sp+28h] [bp-18h]@10 | |
5508 int v70; // [sp+2Ch] [bp-14h]@10 | |
5509 int X; // [sp+30h] [bp-10h]@10 | |
5510 int v72; // [sp+34h] [bp-Ch]@10 | |
5511 int v73; // [sp+38h] [bp-8h]@10 | |
5512 int v74; // [sp+3Ch] [bp-4h]@10 | |
5513 | |
5514 v1 = &pIndoor->pFaces[uFaceID]; | |
5515 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5516 v3 = v1->uBitmapID; | |
5517 v4 = v1->uBitmapID; | |
5518 v68 = v2; | |
5519 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5520 v6 = 8 * uFaceID; | |
862 | 5521 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5522 stru_F8AD28.field_0 = v6; |
5523 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5524 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5525 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5526 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5527 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5528 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5529 v7 = GetTickCount(); | |
5530 v8 = v1->uAttributes; | |
5531 v9 = v7 >> 3; | |
5532 if ( v8 & 4 ) | |
5533 { | |
5534 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5535 } | |
5536 else | |
5537 { | |
5538 if ( v8 & 0x20 ) | |
5539 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5540 } | |
5541 v10 = v1->uAttributes; | |
5542 if ( BYTE1(v10) & 8 ) | |
5543 { | |
5544 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5545 } | |
5546 else | |
5547 { | |
5548 if ( v10 & 0x40 ) | |
5549 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5550 } | |
5551 v1->_get_normals(&v67, &v66); | |
5552 stru_F8AD28.vec_14.x = v67.x; | |
5553 stru_F8AD28.vec_14.y = v67.y; | |
5554 stru_F8AD28.vec_14.z = v67.z; | |
5555 stru_F8AD28.vec_20.x = v66.x; | |
5556 stru_F8AD28.vec_20.y = v66.y; | |
5557 stru_F8AD28.vec_20.z = v66.z; | |
5558 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5559 if ( pBLVRenderParams->sPartyRotX ) | |
5560 { | |
5561 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5562 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5563 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5564 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5565 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5566 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5567 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5568 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5569 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5570 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5571 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5572 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5573 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5574 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5575 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5576 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5577 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5578 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5579 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5580 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5581 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5582 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5583 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5584 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5585 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5586 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5587 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5588 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5589 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5590 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5591 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5592 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5593 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5594 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5595 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5596 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5597 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5598 v13 = pBLVRenderParams->vPartyPos.y; | |
5599 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5600 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5601 v14 = pBLVRenderParams->vPartyPos.x; | |
5602 } | |
5603 else | |
5604 { | |
5605 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5606 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5607 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5608 - v70; | |
5609 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5610 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5611 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5612 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5613 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5614 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5615 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5616 - v70; | |
5617 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5618 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5619 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5620 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5621 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5622 - v70; | |
5623 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5624 v14 = pBLVRenderParams->vPartyPos.x; | |
5625 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5626 v13 = pBLVRenderParams->vPartyPos.y; | |
5627 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5628 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5629 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5630 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5631 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5632 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5633 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5634 } | |
5635 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5636 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5637 + stru_F8AD28.plane_4.dist | |
5638 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5639 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5640 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5641 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5642 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5643 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5644 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5645 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5646 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5647 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5648 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5649 v15 = v70; | |
5650 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5651 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5652 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5653 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5654 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5655 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5656 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5657 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5658 stru_F8AD28.field_38 = 0; | |
5659 stru_F8AD28.field_A8 = -(X | |
5660 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5661 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5662 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5663 { | |
5664 stru_F8AD28.field_3E4 = 1; | |
5665 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5666 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5667 stru_F8AD28.field_3F0 = v68->field_1E; | |
5668 stru_F8AD28.field_3F4 = v68->field_20; | |
5669 } | |
5670 else | |
5671 { | |
5672 stru_F8AD28.field_3E4 = 0; | |
5673 } | |
5674 v16 = 0.0039215689; | |
5675 v17 = 116 * v1->uSectorID; | |
5676 v69 = v17; | |
5677 v74 = 0; | |
5678 v73 = 0; | |
5679 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5680 v70 = pMobileLightsStack->uNumLightsActive; | |
5681 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5682 { | |
5683 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5684 do | |
5685 { | |
5686 if ( v74 >= 20 ) | |
5687 break; | |
5688 v19 = *((short *)v18 + 2); | |
5689 v20 = *((short *)v18 - 1); | |
5690 if ( v20 > v1->pBounding.x1 - v19 ) | |
5691 { | |
5692 if ( v20 < v19 + v1->pBounding.x2 ) | |
5693 { | |
5694 v21 = *(short *)v18; | |
5695 if ( v21 > v1->pBounding.y1 - v19 ) | |
5696 { | |
5697 if ( v21 < v19 + v1->pBounding.y2 ) | |
5698 { | |
5699 v22 = *((short *)v18 + 1); | |
5700 if ( v22 > v1->pBounding.z1 - v19 ) | |
5701 { | |
5702 if ( v22 < v19 + v1->pBounding.z2 ) | |
5703 { | |
5704 X = (v1->pFacePlane_old.dist | |
5705 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5706 + v21 * v1->pFacePlane_old.vNormal.y | |
5707 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5708 if ( X <= v19 ) | |
5709 { | |
5710 v23 = X; | |
5711 v24 = v74; | |
5712 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5713 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5714 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5715 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5716 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5717 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5718 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5719 v25 = (double)(signed int)v68 * v16; | |
5720 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5721 v26 = (unsigned __int8)v18[8]; | |
5722 *(float *)(v24 * 4 + 16297992) = v25; | |
5723 v27 = (double)(signed int)v68; | |
5724 v68 = (BLVFaceExtra *)v26; | |
5725 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5726 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5727 v16 = 0.0039215689; | |
5728 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5729 v28 = v74; | |
5730 v29 = v18[9]; | |
5731 ++v74; | |
5732 stru_F8AD28._blv_lights_types[v28] = v29; | |
5733 } | |
5734 } | |
5735 } | |
5736 } | |
5737 } | |
5738 } | |
5739 } | |
5740 ++v73; | |
5741 v18 += 18; | |
5742 v17 = v69; | |
5743 } | |
5744 while ( v73 < v70 ); | |
5745 } | |
5746 v30 = 0; | |
5747 v73 = 0; | |
5748 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5749 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5750 if ( v31 > 0 ) | |
5751 { | |
5752 while ( v74 < 20 ) | |
5753 { | |
5754 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5755 if ( !(v32->uAtributes & 8) ) | |
5756 { | |
5757 v33 = v1->pBounding.x1; | |
5758 v34 = v32->vPosition.x; | |
5759 X = v32->uBrightness; | |
5760 v35 = v32->uRadius; | |
5761 v68 = (BLVFaceExtra *)v32->uRadius; | |
5762 if ( v34 > v33 - v35 ) | |
5763 { | |
5764 if ( v34 < v35 + v1->pBounding.x2 ) | |
5765 { | |
5766 v36 = v32->vPosition.y; | |
5767 if ( v36 > v1->pBounding.y1 - v35 ) | |
5768 { | |
5769 if ( v36 < v35 + v1->pBounding.y2 ) | |
5770 { | |
5771 v37 = v32->vPosition.z; | |
5772 if ( v37 > v1->pBounding.z1 - v35 ) | |
5773 { | |
5774 if ( v37 < v35 + v1->pBounding.z2 ) | |
5775 { | |
5776 v38 = (v1->pFacePlane_old.dist | |
5777 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5778 + v37 * v1->pFacePlane_old.vNormal.z | |
5779 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5780 if ( v38 >= 0 ) | |
5781 { | |
5782 if ( v38 <= v35 && v35 ) | |
5783 { | |
5784 v39 = v74; | |
5785 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5786 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5787 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5788 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5789 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5790 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5791 v68 = (BLVFaceExtra *)v32->uRed; | |
5792 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5793 v68 = (BLVFaceExtra *)v32->uGreen; | |
5794 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5795 v68 = (BLVFaceExtra *)v32->uBlue; | |
5796 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5797 v16 = 0.0039215689; | |
5798 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5799 v40 = v74++; | |
5800 stru_F8AD28._blv_lights_types[v40] = 1; | |
5801 } | |
5802 } | |
5803 } | |
5804 } | |
5805 } | |
5806 } | |
5807 } | |
5808 } | |
5809 } | |
5810 v30 = v73++ + 1; | |
5811 if ( v73 >= v70 ) | |
5812 break; | |
5813 v17 = v69; | |
5814 } | |
5815 } | |
5816 v73 = 0; | |
5817 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5818 { | |
5819 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5820 do | |
5821 { | |
5822 if ( v74 >= 20 ) | |
5823 break; | |
5824 v42 = *((short *)v41 + 2); | |
5825 v43 = *((short *)v41 - 1); | |
5826 if ( v43 > v1->pBounding.x1 - v42 ) | |
5827 { | |
5828 if ( v43 < v42 + v1->pBounding.x2 ) | |
5829 { | |
5830 v44 = *(short *)v41; | |
5831 if ( v44 > v1->pBounding.y1 - v42 ) | |
5832 { | |
5833 if ( v44 < v42 + v1->pBounding.y2 ) | |
5834 { | |
5835 v45 = *((short *)v41 + 1); | |
5836 if ( v45 > v1->pBounding.z1 - v42 ) | |
5837 { | |
5838 if ( v45 < v42 + v1->pBounding.z2 ) | |
5839 { | |
5840 v46 = (v1->pFacePlane_old.dist | |
5841 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5842 + v43 * v1->pFacePlane_old.vNormal.x | |
5843 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5844 v69 = v46; | |
5845 if ( v46 >= 0 ) | |
5846 { | |
5847 if ( v46 <= v42 ) | |
5848 { | |
5849 v47 = v69; | |
5850 v48 = v74; | |
5851 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5852 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5853 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5854 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5855 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5856 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5857 v49 = (double)(signed int)v68 * v16; | |
5858 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5859 v50 = (unsigned __int8)v41[8]; | |
5860 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5861 v51 = (double)(signed int)v68; | |
5862 v68 = (BLVFaceExtra *)v50; | |
5863 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5864 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5865 v16 = 0.0039215689; | |
5866 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5867 v52 = v74++; | |
5868 stru_F8AD28._blv_lights_types[v52] = 1; | |
5869 } | |
5870 } | |
5871 } | |
5872 } | |
5873 } | |
5874 } | |
5875 } | |
5876 } | |
5877 ++v73; | |
5878 v41 += 12; | |
5879 } | |
5880 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5881 } | |
5882 stru_F8AD28.uNumLightsApplied = v74; | |
5883 v53 = v1->pBounding.x2; | |
5884 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5885 { | |
5886 v55 = v1->pBounding.x1; | |
5887 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5888 v54 = 0; | |
5889 else | |
5890 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5891 } | |
5892 else | |
5893 { | |
5894 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5895 } | |
5896 v56 = v1->pBounding.y2; | |
5897 v57 = v54 * v54; | |
5898 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5899 { | |
5900 v59 = v1->pBounding.y1; | |
5901 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5902 v58 = 0; | |
5903 else | |
5904 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5905 } | |
5906 else | |
5907 { | |
5908 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5909 } | |
5910 v60 = v58 * v58 + v57; | |
5911 v61 = v1->pBounding.z2; | |
5912 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5913 { | |
5914 v63 = v1->pBounding.z1; | |
5915 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5916 v62 = 0; | |
5917 else | |
5918 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5919 } | |
5920 else | |
5921 { | |
5922 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5923 } | |
5924 v64 = v62 * v62 + v60; | |
5925 if ( v64 ) | |
295 | 5926 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5927 else |
5928 stru_F8AD28.field_34 = 0; | |
5929 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5930 v65 = (double)(signed int)v68; | |
5931 if ( v65 >= 655.36 ) | |
5932 { | |
5933 if ( v65 >= 26214.4 ) | |
5934 { | |
5935 if ( v65 >= 45875.2 ) | |
5936 { | |
5937 stru_F8AD28.field_44 = 8; | |
5938 stru_F8AD28.field_48 = 3; | |
5939 } | |
5940 else | |
5941 { | |
5942 stru_F8AD28.field_44 = 16; | |
5943 stru_F8AD28.field_48 = 4; | |
5944 } | |
5945 } | |
5946 else | |
5947 { | |
5948 stru_F8AD28.field_44 = 32; | |
5949 stru_F8AD28.field_48 = 5; | |
5950 } | |
5951 } | |
5952 else | |
5953 { | |
5954 stru_F8AD28.field_44 = 64; | |
5955 stru_F8AD28.field_48 = 6; | |
5956 } | |
5957 } | |
5958 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5959 | |
5960 //----- (004AF412) -------------------------------------------------------- | |
5961 int __cdecl sub_4AF412() | |
5962 { | |
5963 int v0; // ST20_4@2 | |
5964 int v1; // ST20_4@2 | |
5965 int v2; // ST20_4@2 | |
5966 int v3; // esi@2 | |
5967 int v4; // ST20_4@2 | |
5968 int v5; // ecx@2 | |
5969 int v6; // ebx@2 | |
5970 int v7; // edi@2 | |
5971 int v8; // edx@2 | |
5972 int v9; // eax@2 | |
5973 int result; // eax@4 | |
5974 | |
5975 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5976 stru_F8AD28.vec_20.y = -65536; | |
5977 stru_F8AD28.plane_4.vNormal.x = 0; | |
5978 stru_F8AD28.plane_4.vNormal.y = 0; | |
5979 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5980 stru_F8AD28.vec_14.x = 65536; | |
5981 stru_F8AD28.vec_14.y = 0; | |
5982 stru_F8AD28.vec_14.z = 0; | |
5983 stru_F8AD28.vec_20.x = 0; | |
5984 stru_F8AD28.vec_20.z = 0; | |
5985 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5986 if ( pBLVRenderParams->sPartyRotX ) | |
5987 { | |
5988 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5989 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5990 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5991 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5992 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5993 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5994 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5995 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5996 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5997 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5998 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5999 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6000 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6001 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6002 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6003 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6004 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6005 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6006 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6007 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6008 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6009 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6010 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6011 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6012 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6013 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6014 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
6015 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
6016 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6017 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6018 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6019 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6020 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6021 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6022 v6 = pBLVRenderParams->vPartyPos.z; | |
6023 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
6024 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
6025 v8 = pBLVRenderParams->vPartyPos.y; | |
6026 v9 = pBLVRenderParams->vPartyPos.x; | |
6027 } | |
6028 else | |
6029 { | |
6030 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6031 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6032 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6033 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6034 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
6035 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
6036 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6037 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
6038 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6039 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6040 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6041 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
6042 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6043 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6044 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
6045 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
6046 v8 = pBLVRenderParams->vPartyPos.y; | |
6047 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
6048 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
6049 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
6050 v9 = pBLVRenderParams->vPartyPos.x; | |
6051 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
6052 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
6053 v6 = pBLVRenderParams->vPartyPos.z; | |
6054 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
6055 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
6056 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
6057 } | |
6058 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
6059 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
6060 + stru_F8AD28.plane_4.dist | |
6061 + stru_F8AD28.plane_4.vNormal.x * v9 | |
6062 + stru_F8AD28.plane_4.vNormal.z * v6; | |
6063 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6064 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
6065 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
6066 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
6067 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
6068 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
6069 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
6070 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
6071 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
6072 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
6073 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
6074 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
6075 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
6076 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
6077 result = 0; | |
6078 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
6079 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
6080 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
6081 stru_F8AD28.field_38 = 0; | |
6082 stru_F8AD28.field_3E4 = 0; | |
6083 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
6084 stru_F8AD28.uNumLightsApplied = 0; | |
6085 stru_F8AD28.field_34 = 0; | |
6086 return result; | |
6087 } | |
6088 | |
6089 //----- (004B1447) -------------------------------------------------------- | |
6090 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
6091 { | |
6092 signed int v3; // esi@1 | |
6093 char v4; // sf@8 | |
6094 int v5; // eax@8 | |
6095 unsigned __int64 v6; // qax@12 | |
6096 DDM_DLV_Header *v7; // eax@14 | |
6097 Player **v8; // edi@18 | |
6098 Player *result; // eax@19 | |
735 | 6099 //char *v10; // esi@20 |
0 | 6100 |
6101 v3 = 0; | |
6102 if ( a2 ) | |
6103 { | |
6104 if ( a2 != 1 ) | |
6105 { | |
6106 if ( a2 == 2 ) | |
6107 v3 = 2; | |
6108 goto LABEL_13; | |
6109 } | |
6110 v3 = 2; | |
6111 } | |
6112 else | |
6113 { | |
6114 v3 = 1; | |
6115 } | |
6116 if ( pParty->uFine < 4000000 ) | |
6117 { | |
6118 v4 = a3 + pParty->uFine < 0; | |
6119 v5 = a3 + pParty->uFine; | |
6120 pParty->uFine += a3; | |
6121 if ( v4 ) | |
6122 { | |
6123 v5 = 0; | |
6124 pParty->uFine = 0; | |
6125 } | |
6126 if ( v5 > 4000000 ) | |
6127 pParty->uFine = 4000000; | |
6128 } | |
487 | 6129 |
6130 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6131 | |
0 | 6132 LABEL_13: |
463 | 6133 pParty->InTheShopFlags[a1] = 1; |
0 | 6134 if ( v3 ) |
6135 { | |
6136 v7 = &pOutdoor->ddm; | |
6137 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6138 v7 = &pIndoor->dlv; | |
6139 v7->uReputation += v3; | |
6140 if ( v7->uReputation > 10000 ) | |
6141 v7->uReputation = 10000; | |
6142 } | |
6143 v8 = &pPlayers[1]; | |
6144 do | |
6145 { | |
6146 result = *v8; | |
6147 if ( pParty->uFine ) | |
6148 { | |
735 | 6149 //v10 = result->_guilds_member_bits; |
484 | 6150 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6151 if ( !(short)result ) |
735 | 6152 __debugbreak(); |
501 | 6153 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6154 } |
6155 ++v8; | |
6156 } | |
6157 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6158 return result; | |
6159 } | |
6160 | |
6161 //----- (004B1523) -------------------------------------------------------- | |
762 | 6162 void __thiscall sub_4B1523(int *_this) |
0 | 6163 { |
6164 int v1; // esi@1 | |
6165 int v2; // edx@1 | |
6166 unsigned int v3; // eax@2 | |
6167 int v4; // eax@4 | |
6168 LONG v5; // ecx@4 | |
6169 int v6; // eax@10 | |
6170 char *v7; // ST44_4@12 | |
6171 unsigned __int16 v8; // ax@12 | |
6172 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6173 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6174 POINT a2; // [sp+64h] [bp-10h]@1 | |
6175 int v13; // [sp+6Ch] [bp-8h]@4 | |
6176 int v14; // [sp+70h] [bp-4h]@4 | |
6177 | |
6178 v1 = *_this - 399; | |
6179 v2 = (*_this - 400) % 11 + 1; | |
6180 v11 = 4 * (*_this - 400) / 11; | |
6181 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6182 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6183 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6184 else | |
6185 v3 = 30; | |
6186 a1.Hint = 0; | |
6187 a1.uFrameY = v3; | |
6188 a1.uFrameWidth = 328; | |
6189 a1.uFrameHeight = 68; | |
6190 a1.uFrameX = 90; | |
6191 a1.uFrameZ = 417; | |
6192 a1.uFrameW = v3 + 67; | |
6193 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6194 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6195 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6196 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6197 v5 = a2.y; | |
6198 if ( v14 > a2.y ) | |
6199 v5 = v14; | |
6200 if ( v13 > v5 ) | |
6201 v5 = v13; | |
6202 if ( v4 > v5 ) | |
6203 v5 = v4; | |
262 | 6204 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", |
6205 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6206 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6207 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6208 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6209 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6210 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6211 a1.uFrameHeight += v6; | |
6212 if ( (signed int)a1.uFrameHeight < 150 ) | |
6213 a1.uFrameHeight = 150; | |
819 | 6214 a1.uFrameWidth = game_viewport_width; |
0 | 6215 a1.DrawMessageBox(0); |
6216 a1.uFrameWidth -= 12; | |
6217 a1.uFrameHeight -= 12; | |
6218 v7 = pSpellStats->pInfos[v1].pName; | |
6219 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6220 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6221 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6222 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
6223 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6224 a1.uFrameZ = a1.uFrameX + 107; | |
6225 a1.uFrameWidth = 108; | |
6226 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6227 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6228 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6229 } |
6230 | |
6231 //----- (004B1784) -------------------------------------------------------- | |
6232 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6233 { | |
6234 Player *pPlayer; // ebx@1 | |
6235 bool result; // eax@2 | |
6236 unsigned __int16 v2; // ST0C_2@3 | |
6237 int v3; // eax@3 | |
6238 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6239 | |
6240 pPlayer = pPlayers[uActiveCharacter]; | |
6241 if ( pPlayer->CanAct() ) | |
6242 { | |
6243 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6244 result = 1; | |
6245 } | |
6246 else | |
6247 { | |
6248 pDialogueWindow->pNumPresenceButton = 0; | |
6249 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6250 v4.uFrameX = 483; | |
6251 v4.uFrameWidth = 148; | |
6252 v4.uFrameZ = 334; | |
6253 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6254 // "%s is in no condition to %s" | |
6255 // "do anything" | |
949 | 6256 v2 = TargetColor(255, 255, 0x9Bu); |
0 | 6257 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6258 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6259 result = 0; | |
6260 } | |
6261 return result; | |
6262 } | |
6263 // F8B1E0: using guessed type int dword_F8B1E0; | |
6264 | |
6265 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6266 void __cdecl ShowPopupShopItem() |
0 | 6267 { |
6268 POINT *v1; // esi@5 | |
6269 unsigned int v2; // eax@5 | |
6270 int v3; // ecx@5 | |
6271 POINT *v4; // esi@12 | |
6272 int v5; // eax@12 | |
6273 unsigned int v6; // eax@13 | |
6274 ItemGen *v7; // ecx@13 | |
6275 signed int v8; // esi@17 | |
6276 unsigned int v9; // eax@19 | |
475 | 6277 POINT v10; // [sp+8h] [bp-44h]@12 |
6278 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6279 POINT v12; // [sp+18h] [bp-34h]@18 | |
6280 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6281 POINT v14; // [sp+28h] [bp-24h]@17 | |
6282 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6283 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6284 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6285 |
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; |
907 | 6297 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6298 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6299 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6300 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6301 return; |
907 | 6302 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6303 return; |
6304 } | |
749 | 6305 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6306 return; |
6307 } | |
475 | 6308 v4 = pMouse->GetCursorPos(&v11); |
6309 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6310 if ( !v5 ) |
6311 return; | |
336 | 6312 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6313 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6314 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6315 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6316 GameUI_DrawItemInfo(v7); | |
6317 return; | |
0 | 6318 } |
874 | 6319 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6320 { |
6321 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6322 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6323 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6324 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6325 if ( v5 ) | |
336 | 6326 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6327 } |
6328 } | |
6329 // F8B198: using guessed type int dword_F8B198; | |
6330 // F8B19C: using guessed type int dword_F8B19C; | |
6331 | |
6332 //----- (004B1BDB) -------------------------------------------------------- | |
6333 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6334 { | |
6335 signed __int64 v1; // ST2C_8@1 | |
6336 signed __int64 v2; // qax@1 | |
6337 signed __int64 v3; // ST1C_8@1 | |
6338 unsigned __int64 v4; // qax@1 | |
6339 unsigned int v5; // ebx@1 | |
112 | 6340 Player *v6; // ebx@1 |
0 | 6341 |
6342 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6343 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6344 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6345 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6346 v2 = v1 / 60 / 60; | |
6347 v3 = v2; | |
6348 v4 = (unsigned int)v2 / 0x18; | |
6349 v5 = (unsigned int)(v4 / 7) >> 2; | |
6350 pParty->uCurrentTimeSecond = v1 % 60; | |
6351 pParty->uCurrentMinute = v1 / 60 % 60; | |
6352 pParty->uCurrentHour = v3 % 24; | |
6353 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6354 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6355 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6356 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6357 pParty->RestAndHeal(); |
6358 dword_507B94 = 1; | |
112 | 6359 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6360 do |
6361 { | |
112 | 6362 v6->uTimeToRecovery = 0; |
6363 memset(&v6->uTimeToRecovery, 0, 4u); | |
6364 ++v6; | |
6365 } | |
6366 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6367 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6368 } |
6369 // 507B94: using guessed type int dword_507B94; | |
6370 | |
6371 //----- (004B1D27) -------------------------------------------------------- | |
6372 void __cdecl sub_4B1D27() | |
6373 { | |
6374 int v0; // edx@2 | |
6375 unsigned int v1; // ecx@7 | |
6376 signed int v2; // edi@10 | |
6377 int v3; // esi@10 | |
6378 __int16 v4; // ax@15 | |
6379 signed int v5; // edi@20 | |
6380 int v6; // esi@20 | |
6381 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6382 | |
484 | 6383 if ( in_current_building_type > 0 ) |
0 | 6384 { |
6385 v0 = 3; | |
484 | 6386 if ( in_current_building_type > BildingType_MagicShop ) |
6387 { | |
6388 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6389 { |
6390 if ( !dword_F8B1E4 ) | |
6391 return; | |
6392 } | |
6393 else | |
6394 { | |
484 | 6395 if ( in_current_building_type != BildingType_Temple ) |
0 | 6396 return; |
6397 } | |
336 | 6398 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6399 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6400 return; |
6401 } | |
336 | 6402 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6403 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6404 { |
6405 if ( pParty->uNumGold <= 0x2710 ) | |
6406 { | |
6407 if ( !dword_F8B1E4 ) | |
6408 return; | |
6409 v0 = 4; | |
907 | 6410 PlayHouseSound(v1, (HouseSoundID)v0); |
6411 return; | |
0 | 6412 } |
735 | 6413 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6414 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6415 { | |
6416 v5 = 0; | |
6417 v6 = 1; | |
6418 do | |
6419 { | |
6420 if ( pPlayers[v6]->CanAct() ) | |
6421 v7[v5++] = v6; | |
6422 ++v6; | |
6423 } | |
6424 while ( v6 <= 4 ); | |
6425 if ( v5 ) | |
6426 { | |
6427 qword_A750D8 = 256i64; | |
6428 word_A750E0 = 80; | |
6429 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6430 word_A750E2 = v4; |
6431 return; | |
0 | 6432 } |
6433 } | |
6434 } | |
6435 else | |
6436 { | |
6437 if ( !qword_A750D8 ) | |
6438 { | |
6439 v2 = 0; | |
6440 v3 = 1; | |
6441 do | |
6442 { | |
6443 if ( pPlayers[v3]->CanAct() ) | |
6444 v7[v2++] = v3; | |
6445 ++v3; | |
6446 } | |
6447 while ( v3 <= 4 ); | |
6448 if ( v2 ) | |
6449 { | |
6450 qword_A750D8 = 256i64; | |
6451 word_A750E0 = 80; | |
6452 v4 = LOWORD(v7[rand() % v2]); | |
6453 word_A750E2 = v4; | |
6454 return; | |
6455 } | |
6456 } | |
6457 } | |
6458 } | |
6459 } | |
6460 | |
6461 //----- (004B1ECE) -------------------------------------------------------- | |
6462 void __cdecl sub_4B1ECE() | |
6463 { | |
6464 __int16 *v0; // edi@1 | |
6465 int v1; // ebx@3 | |
6466 Player *v2; // esi@3 | |
6467 int v3; // eax@4 | |
6468 signed int v4; // eax@9 | |
6469 int v5; // ebx@11 | |
89 | 6470 Player *v6; // esi@13 |
6471 ItemGen *v7; // eax@14 | |
0 | 6472 signed int v8; // edi@14 |
89 | 6473 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6474 signed int v10; // [sp+10h] [bp-8h]@13 |
6475 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6476 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6477 |
484 | 6478 contract_approved = 0; |
0 | 6479 v11 = 0; |
6480 uDialogueType = 84; | |
827 | 6481 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6482 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6483 while ( 1 ) | |
6484 { | |
484 | 6485 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6486 { |
6487 v1 = 0; | |
6488 v2 = pParty->pPlayers; | |
6489 do | |
6490 { | |
89 | 6491 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6492 if ( v3 ) |
6493 break; | |
6494 ++v2; | |
6495 ++v1; | |
6496 } | |
6497 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6498 if ( v1 == 4 ) | |
6499 break; | |
6500 } | |
6501 ++v11; | |
6502 v0 += 2; | |
89 | 6503 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6504 break; | |
6505 } | |
6506 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6507 { | |
827 | 6508 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6509 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6510 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6511 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6512 } | |
484 | 6513 if ( contract_approved == 601 ) |
0 | 6514 { |
6515 v5 = 0; | |
89 | 6516 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6517 v9 = 0; |
6518 while ( 1 ) | |
6519 { | |
135 | 6520 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6521 { |
6522 v10 = 0; | |
89 | 6523 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6524 do |
6525 { | |
89 | 6526 v7 = v6->pInventoryItems; |
0 | 6527 v8 = 138; |
6528 do | |
6529 { | |
89 | 6530 if ( v7->uItemID == 601 ) |
0 | 6531 { |
377 | 6532 if ( !v7->uHolderPlayer ) |
89 | 6533 v9 = v7; |
377 | 6534 if ( v7->uHolderPlayer == v5 ) |
0 | 6535 v10 = 1; |
6536 } | |
89 | 6537 ++v7; |
0 | 6538 --v8; |
6539 } | |
6540 while ( v8 ); | |
89 | 6541 ++v6; |
6542 } | |
6543 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6544 if ( !v10 ) |
6545 break; | |
6546 } | |
89 | 6547 ++v12; |
0 | 6548 ++v5; |
89 | 6549 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6550 return; |
6551 } | |
6552 if ( v9 ) | |
377 | 6553 v9->uHolderPlayer = v5; |
0 | 6554 } |
6555 } | |
6556 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6557 // 722B3C: using guessed type int dword_722B3C; | |
6558 // 722B44: using guessed type int dword_722B44; | |
6559 // F8B1A8: using guessed type int dword_F8B1A8; | |
6560 | |
6561 //----- (004B2001) -------------------------------------------------------- | |
459 | 6562 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6563 { | |
6564 //signed int v1; // eax@1 | |
6565 NPCData *pCurrentNPCInfo; // ebp@1 | |
6566 int pEventNumber; // ecx@8 | |
0 | 6567 Player *v4; // esi@20 |
467 | 6568 //int v5; // eax@28 |
6569 //int v6; // eax@31 | |
6570 //int v7; // eax@34 | |
6571 //int v8; // eax@37 | |
6572 //int v9; // eax@40 | |
6573 //unsigned int v10; // eax@43 | |
0 | 6574 char *v12; // eax@53 |
6575 char *v13; // eax@56 | |
6576 char *v14; // eax@57 | |
6577 char *v15; // eax@58 | |
467 | 6578 //unsigned int v16; // ebp@62 |
0 | 6579 char *v17; // ecx@63 |
6580 char *v18; // eax@65 | |
6581 const char *v19; // ecx@68 | |
248 | 6582 //unsigned int v20; // eax@69 |
467 | 6583 signed int pPrice; // ecx@70 |
0 | 6584 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6585 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6586 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6587 //int v25; // [sp-4h] [bp-10h]@49 |
6588 | |
459 | 6589 uDialogueType = uMessageParam + 1; |
6590 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6591 if ( uMessageParam <= 24 ) |
460 | 6592 { |
459 | 6593 switch ( uMessageParam ) |
6594 { | |
6595 case 13: | |
827 | 6596 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6597 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6598 NPCHireableDialogPrepare(); |
459 | 6599 dialogue_show_profession_details = false; |
6600 goto _return; | |
6601 case 19: | |
6602 pEventNumber = pCurrentNPCInfo->evt_A; | |
6603 break; | |
6604 case 20: | |
6605 pEventNumber = pCurrentNPCInfo->evt_B; | |
6606 break; | |
6607 case 21: | |
6608 pEventNumber = pCurrentNPCInfo->evt_C; | |
6609 break; | |
6610 case 22: | |
6611 pEventNumber = pCurrentNPCInfo->evt_D; | |
6612 break; | |
6613 case 23: | |
6614 pEventNumber = pCurrentNPCInfo->evt_E; | |
6615 break; | |
6616 case 24: | |
6617 pEventNumber = pCurrentNPCInfo->evt_F; | |
6618 break; | |
6619 default: | |
467 | 6620 goto _return; |
6621 } | |
6622 /*switch ( pEventNumber ) | |
6623 { | |
6624 case 139: | |
6625 sub_4B1ECE(); | |
6626 goto _return; | |
6627 case 311: | |
6628 sub_4BBA85_bounties(); | |
6629 goto _return; | |
6630 }*/ | |
459 | 6631 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6632 { | |
6633 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6634 { | |
6635 if ( pEventNumber == 139 ) | |
0 | 6636 { |
6637 sub_4B1ECE(); | |
6638 } | |
6639 else | |
6640 { | |
459 | 6641 if ( pEventNumber == 311 ) |
0 | 6642 { |
6643 sub_4BBA85_bounties(); | |
6644 } | |
6645 else | |
6646 { | |
827 | 6647 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6648 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6649 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6650 activeLevelDecoration = NULL; |
0 | 6651 } |
6652 } | |
6653 } | |
6654 else | |
6655 { | |
459 | 6656 dword_F8B1D8 = uMessageParam; |
6657 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6658 } |
6659 } | |
6660 else | |
6661 { | |
459 | 6662 sub_4B3FE5(pEventNumber); |
0 | 6663 } |
6664 goto _return; | |
460 | 6665 } |
459 | 6666 if ( uMessageParam != 76 ) |
6667 { | |
6668 if ( uMessageParam == 77 ) | |
6669 { | |
467 | 6670 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6671 if (dialogue_show_profession_details) |
459 | 6672 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6673 else |
459 | 6674 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6675 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6676 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6677 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6678 current_npc_text = v18; |
0 | 6679 } |
6680 else | |
6681 { | |
459 | 6682 if ( uMessageParam == 79 ) |
0 | 6683 { |
484 | 6684 if ( contract_approved ) |
0 | 6685 { |
267 | 6686 Party::TakeGold(gold_transaction_amount); |
0 | 6687 if ( uActiveCharacter ) |
6688 { | |
492 | 6689 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6690 *(short *)v12 &= 0x3Fu; |
6691 switch ( dword_F8B1B0 ) | |
6692 { | |
6693 case 2: | |
492 | 6694 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6695 *v15 |= 0x40u; |
6696 break; | |
6697 case 3: | |
492 | 6698 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6699 *v14 |= 0x80u; |
6700 break; | |
6701 case 4: | |
492 | 6702 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6703 v13[1] |= 1u; |
6704 break; | |
6705 } | |
187 | 6706 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6707 } |
437 | 6708 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6709 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6710 { |
6711 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6712 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6713 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6714 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6715 }*/ |
0 | 6716 } |
6717 } | |
6718 else | |
6719 { | |
492 | 6720 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6721 { |
267 | 6722 Party::TakeGold(gold_transaction_amount); |
0 | 6723 v4 = pParty->pPlayers; |
6724 do | |
6725 { | |
492 | 6726 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6727 ++v4; |
6728 } | |
6729 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6730 switch ( dword_F8B1D8 ) | |
6731 { | |
6732 case 19: | |
467 | 6733 pEventNumber = pCurrentNPCInfo->evt_A; |
6734 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6735 pCurrentNPCInfo->evt_A = 0; |
0 | 6736 break; |
6737 case 20: | |
467 | 6738 pEventNumber = pCurrentNPCInfo->evt_B; |
6739 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6740 pCurrentNPCInfo->evt_B = 0; |
0 | 6741 break; |
6742 case 21: | |
467 | 6743 pEventNumber = pCurrentNPCInfo->evt_C; |
6744 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6745 pCurrentNPCInfo->evt_C = 0; |
0 | 6746 break; |
6747 case 22: | |
467 | 6748 pEventNumber = pCurrentNPCInfo->evt_D; |
6749 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6750 pCurrentNPCInfo->evt_D = 0; |
0 | 6751 break; |
6752 case 23: | |
467 | 6753 pEventNumber = pCurrentNPCInfo->evt_E; |
6754 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6755 pCurrentNPCInfo->evt_E = 0; |
0 | 6756 break; |
6757 case 24: | |
467 | 6758 pEventNumber = pCurrentNPCInfo->evt_F; |
6759 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6760 pCurrentNPCInfo->evt_F = 0; | |
0 | 6761 break; |
6762 } | |
437 | 6763 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6764 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6765 { |
6766 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6767 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6768 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6769 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6770 }*/ |
467 | 6771 //v11 = uActiveCharacter; |
0 | 6772 if ( uActiveCharacter ) |
6773 { | |
467 | 6774 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6775 goto _return; |
6776 } | |
6777 } | |
6778 } | |
6779 } | |
6780 goto _return; | |
6781 } | |
6782 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6783 { | |
467 | 6784 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6785 goto _return; |
6786 } | |
459 | 6787 if ( pCurrentNPCInfo->uProfession != 51 ) |
6788 { | |
467 | 6789 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6790 if ( pParty->uNumGold < pPrice ) | |
6791 { | |
6792 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6793 dialogue_show_profession_details = false; |
0 | 6794 uDialogueType = 13; |
827 | 6795 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6796 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6797 if ( uActiveCharacter ) |
248 | 6798 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6799 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6800 goto _return; | |
6801 } | |
6802 Party::TakeGold(pPrice); | |
0 | 6803 } |
147 | 6804 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6805 pCurrentNPCInfo->uFlags |= 128; |
0 | 6806 pParty->field_709 = 0; |
659 | 6807 Party__CountHirelings(); |
0 | 6808 if ( pParty->pHirelings[0].pName ) |
6809 { | |
459 | 6810 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6811 v24 = pCurrentNPCInfo->pName; | |
0 | 6812 v22 = pParty->pHireling2Name; |
6813 } | |
6814 else | |
6815 { | |
459 | 6816 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6817 v24 = pCurrentNPCInfo->pName; | |
0 | 6818 v22 = pParty->pHireling1Name; |
6819 } | |
6820 strcpy(v22, v24); | |
6821 pParty->field_709 = 0; | |
659 | 6822 Party__CountHirelings(); |
480 | 6823 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6824 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6825 |
6826 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6827 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6828 { |
6829 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
6830 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
6831 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6832 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6833 }*/ |
0 | 6834 if ( uActiveCharacter ) |
467 | 6835 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6836 _return: |
460 | 6837 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6838 } |
6839 | |
6840 //----- (004B254D) -------------------------------------------------------- | |
6841 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6842 { | |
955 | 6843 //Player *v1; // esi@1 |
0 | 6844 int v2; // edx@1 |
6845 int v3; // ecx@1 | |
6846 int v4; // edi@1 | |
955 | 6847 int pClassType; // eax@7 |
0 | 6848 int v6; // eax@7 |
6849 int v7; // ebx@7 | |
955 | 6850 //int v8; // ebx@8 |
0 | 6851 signed int v9; // esi@8 |
6852 int v10; // eax@8 | |
6853 char *v11; // ecx@8 | |
6854 int v12; // edi@9 | |
6855 char *v13; // edx@9 | |
6856 signed int v14; // edi@10 | |
6857 unsigned int v16; // eax@29 | |
955 | 6858 //int v17; // eax@36 |
0 | 6859 char v18; // cl@46 |
6860 __int16 v19; // dx@56 | |
6861 int v20; // eax@60 | |
955 | 6862 //char *v21; // [sp-Ch] [bp-38h]@82 |
6863 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6864 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6865 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6866 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6867 //int v26; // [sp-4h] [bp-30h]@38 |
6868 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6869 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6870 int v29; // [sp+10h] [bp-1Ch]@13 | |
6871 int v30; // [sp+14h] [bp-18h]@15 | |
6872 int v31; // [sp+18h] [bp-14h]@16 | |
6873 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6874 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6875 int v34; // [sp+24h] [bp-8h]@7 |
6876 char *v35; // [sp+28h] [bp-4h]@1 | |
6877 | |
484 | 6878 contract_approved = 0; |
0 | 6879 v2 = (_this - 200) % 3; |
6880 v3 = (_this - 200) / 3; | |
6881 v4 = v2; | |
6882 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6883 dword_F8B1AC_award_bit_number = v3; |
0 | 6884 if ( v2 ) |
6885 { | |
6886 if ( v2 == 1 ) | |
6887 { | |
267 | 6888 gold_transaction_amount = 5000; |
0 | 6889 dword_F8B1B0 = 3; |
6890 } | |
6891 else | |
6892 { | |
6893 if ( v2 == 2 ) | |
6894 { | |
267 | 6895 gold_transaction_amount = 8000; |
0 | 6896 dword_F8B1B0 = 4; |
6897 } | |
6898 } | |
6899 } | |
6900 else | |
6901 { | |
267 | 6902 gold_transaction_amount = 2000; |
0 | 6903 dword_F8B1B0 = 2; |
6904 } | |
955 | 6905 pClassType = pPlayers[uActiveCharacter]->classType; |
6906 //v33 = pClassType; | |
6907 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6908 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6909 v7 = a1[0] & 0x3F; |
6910 v34 = v2 + 2; | |
6911 if ( v6 < v2 + 2 ) | |
6912 { | |
955 | 6913 //v8 = v33; |
0 | 6914 v9 = 0; |
955 | 6915 v10 = pClassType - pClassType % 4; |
6916 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6917 do |
6918 { | |
6919 v12 = (unsigned __int8)*v11; | |
6920 v13 = &v28[4 * v9]; | |
6921 *(int *)v13 = 0; | |
6922 if ( v12 < v34 ) | |
6923 { | |
6924 v14 = 1; | |
6925 } | |
6926 else | |
6927 { | |
6928 v14 = 1; | |
6929 *(int *)v13 = 1; | |
6930 } | |
6931 ++v9; | |
6932 v11 += 37; | |
6933 } | |
6934 while ( v9 < 4 ); | |
6935 if ( v29 == v14 ) | |
6936 { | |
6937 v25 = pClassNames[v10 + 1]; | |
6938 } | |
6939 else | |
6940 { | |
955 | 6941 if ( v30 == v14 )//crash |
0 | 6942 { |
6943 if ( v31 == v14 ) | |
6944 { | |
955 | 6945 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6946 return pTmpBuf; |
6947 } | |
6948 v25 = pClassNames[v10 + 2]; | |
6949 } | |
6950 else | |
6951 { | |
6952 if ( v31 != v14 ) | |
6953 { | |
955 | 6954 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
6955 return pTmpBuf; | |
0 | 6956 } |
6957 v25 = pClassNames[v10 + 3]; | |
6958 } | |
6959 } | |
955 | 6960 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6961 return pTmpBuf; |
6962 } | |
955 | 6963 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6964 return (char *)pNPCTopics[122].pText; |
6965 if ( !v7 ) | |
6966 return (char *)pNPCTopics[131].pText; | |
6967 v16 = SkillToMastery(a1[0]); | |
6968 if ( (signed int)v16 > v4 + 1 ) | |
6969 return (char *)pNPCTopics[v4 + 128].pText; | |
6970 if ( v34 != 2 ) | |
6971 { | |
6972 if ( v34 == 3 ) | |
6973 { | |
6974 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6975 { | |
492 | 6976 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6977 { |
6978 case 12: | |
6979 case 13: | |
6980 case 14: | |
6981 case 15: | |
6982 case 16: | |
6983 case 17: | |
6984 case 18: | |
267 | 6985 gold_transaction_amount = 4000; |
0 | 6986 goto LABEL_42; |
6987 case 19: | |
6988 v19 = 114; | |
955 | 6989 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6990 return v35; | |
6991 if ( !gold_transaction_amount ) | |
6992 goto LABEL_79; | |
6993 goto LABEL_42; | |
0 | 6994 case 20: |
6995 v19 = 110; | |
484 | 6996 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6997 return v35; |
955 | 6998 if ( !gold_transaction_amount ) |
6999 goto LABEL_79; | |
7000 goto LABEL_42; | |
0 | 7001 case 22: |
955 | 7002 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
7003 if ( v20 < 50 ) | |
7004 return v35; | |
7005 if ( !gold_transaction_amount ) | |
7006 goto LABEL_79; | |
7007 goto LABEL_42; | |
0 | 7008 case 24: |
267 | 7009 gold_transaction_amount = 2500; |
955 | 7010 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 7011 if ( v20 < 50 ) |
7012 return v35; | |
955 | 7013 if ( !gold_transaction_amount ) |
7014 goto LABEL_79; | |
7015 goto LABEL_42; | |
7016 case 36: | |
7017 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
7018 if ( v20 < 50 ) | |
7019 return v35; | |
7020 if ( !gold_transaction_amount ) | |
7021 goto LABEL_79; | |
7022 goto LABEL_42; | |
0 | 7023 case 21: |
7024 case 23: | |
7025 case 25: | |
7026 case 26: | |
7027 case 29: | |
7028 case 32: | |
7029 case 34: | |
7030 case 35: | |
267 | 7031 gold_transaction_amount = 2500; |
0 | 7032 goto LABEL_42; |
7033 case 8: | |
7034 case 9: | |
7035 case 10: | |
7036 case 11: | |
267 | 7037 gold_transaction_amount = 3000; |
0 | 7038 goto LABEL_42; |
7039 case 7: | |
955 | 7040 gold_transaction_amount = 0; |
7041 if ( !gold_transaction_amount ) | |
7042 goto LABEL_79; | |
7043 goto LABEL_42; | |
7044 default: | |
7045 if ( !gold_transaction_amount ) | |
7046 goto LABEL_79; | |
7047 goto LABEL_42; | |
0 | 7048 } |
955 | 7049 gold_transaction_amount = 0; |
7050 if ( !gold_transaction_amount ) | |
7051 goto LABEL_79; | |
7052 goto LABEL_42; | |
0 | 7053 } |
7054 } | |
7055 else | |
7056 { | |
7057 if ( v34 != 4 ) | |
7058 { | |
955 | 7059 if ( !gold_transaction_amount ) |
7060 goto LABEL_79; | |
7061 goto LABEL_42; | |
0 | 7062 } |
7063 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
7064 { | |
492 | 7065 switch ( dword_F8B1AC_award_bit_number ) |
0 | 7066 { |
7067 case 19: | |
955 | 7068 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
7069 { | |
7070 if ( !gold_transaction_amount ) | |
7071 goto LABEL_79; | |
7072 goto LABEL_42; | |
7073 } | |
7074 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
7075 { | |
7076 if ( !gold_transaction_amount ) | |
7077 goto LABEL_79; | |
7078 goto LABEL_42; | |
7079 } | |
7080 return v35; | |
0 | 7081 case 20: |
955 | 7082 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
7083 { | |
7084 if ( !gold_transaction_amount ) | |
7085 goto LABEL_79; | |
7086 goto LABEL_42; | |
7087 } | |
7088 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
7089 { | |
7090 if ( !gold_transaction_amount ) | |
7091 goto LABEL_79; | |
7092 goto LABEL_42; | |
7093 } | |
0 | 7094 return v35; |
7095 case 30: | |
955 | 7096 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 7097 if ( (v18 & 0x3Fu) < 0xA ) |
7098 return v35; | |
955 | 7099 if ( !gold_transaction_amount ) |
7100 goto LABEL_79; | |
7101 goto LABEL_42; | |
7102 case 31: | |
7103 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
7104 if ( (v18 & 0x3Fu) < 0xA ) | |
7105 return v35; | |
7106 if ( !gold_transaction_amount ) | |
7107 goto LABEL_79; | |
7108 goto LABEL_42; | |
0 | 7109 case 21: |
7110 case 23: | |
7111 case 24: | |
7112 case 25: | |
7113 case 26: | |
7114 case 29: | |
7115 case 32: | |
7116 case 34: | |
7117 case 35: | |
267 | 7118 gold_transaction_amount = 6000; |
0 | 7119 goto LABEL_42; |
7120 case 8: | |
7121 case 9: | |
7122 case 10: | |
7123 case 11: | |
267 | 7124 gold_transaction_amount = 7000; |
0 | 7125 goto LABEL_42; |
7126 case 7: | |
7127 break; | |
955 | 7128 default: |
7129 if ( !gold_transaction_amount ) | |
7130 goto LABEL_79; | |
7131 goto LABEL_42; | |
0 | 7132 } |
267 | 7133 gold_transaction_amount = 0; |
955 | 7134 if ( !gold_transaction_amount ) |
7135 goto LABEL_79; | |
7136 goto LABEL_42; | |
0 | 7137 } |
7138 } | |
7139 return v35; | |
7140 } | |
7141 if ( v7 < 4 ) | |
7142 return v35; | |
492 | 7143 if ( dword_F8B1AC_award_bit_number > 27 ) |
7144 { | |
7145 if ( dword_F8B1AC_award_bit_number != 29 | |
7146 && dword_F8B1AC_award_bit_number != 32 | |
7147 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7148 { |
267 | 7149 if ( !gold_transaction_amount ) |
0 | 7150 goto LABEL_79; |
7151 goto LABEL_42; | |
7152 } | |
267 | 7153 gold_transaction_amount = 500; |
955 | 7154 if ( !gold_transaction_amount ) |
7155 goto LABEL_79; | |
7156 goto LABEL_42; | |
0 | 7157 } |
492 | 7158 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7159 { |
7160 gold_transaction_amount = 500; | |
7161 if ( !gold_transaction_amount ) | |
7162 goto LABEL_79; | |
7163 goto LABEL_42; | |
7164 } | |
492 | 7165 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7166 { |
267 | 7167 gold_transaction_amount = 0; |
0 | 7168 goto LABEL_79; |
7169 } | |
492 | 7170 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7171 { |
7172 if ( !gold_transaction_amount ) | |
7173 goto LABEL_79; | |
7174 goto LABEL_42; | |
7175 } | |
492 | 7176 if ( dword_F8B1AC_award_bit_number > 18 ) |
7177 { | |
7178 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7179 { |
7180 if ( !gold_transaction_amount ) | |
7181 goto LABEL_79; | |
7182 goto LABEL_42; | |
7183 } | |
7184 gold_transaction_amount = 500; | |
7185 if ( !gold_transaction_amount ) | |
7186 goto LABEL_79; | |
7187 goto LABEL_42; | |
0 | 7188 } |
267 | 7189 gold_transaction_amount = 1000; |
0 | 7190 LABEL_42: |
267 | 7191 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7192 return (char *)pNPCTopics[124].pText; |
7193 LABEL_79: | |
484 | 7194 contract_approved = 1; |
0 | 7195 if ( v34 == 2 ) |
7196 { | |
955 | 7197 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
7198 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò | |
7199 return pTmpBuf2; | |
0 | 7200 } |
7201 if ( v34 == 3 ) | |
7202 { | |
955 | 7203 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7204 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð | |
7205 return pTmpBuf2; | |
0 | 7206 } |
7207 if ( v34 == 4 ) | |
955 | 7208 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7209 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð | |
0 | 7210 return pTmpBuf2; |
7211 } | |
7212 | |
7213 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7214 const char * ContractSelectText( int pEventCode ) |
7215 { | |
7216 static const int dialogue_base=110; | |
484 | 7217 contract_approved = 0; |
492 | 7218 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7219 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7220 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7221 { | |
492 | 7222 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7223 { | |
7224 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7225 } |
7226 else | |
7227 { | |
267 | 7228 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7229 { |
484 | 7230 contract_approved = 1; |
492 | 7231 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7232 } |
7233 else | |
7234 { | |
492 | 7235 return pNPCTopics[dialogue_base+14].pText; |
0 | 7236 } |
7237 } | |
7238 } | |
7239 else | |
7240 { | |
492 | 7241 return pNPCTopics[dialogue_base+12].pText; |
0 | 7242 } |
7243 } | |
7244 | |
7245 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7246 void SimpleHouseAndBoatsDialog() |
0 | 7247 { |
7248 char *v0; // esi@3 | |
7249 char *v1; // ST1C_4@3 | |
7250 char *v2; // eax@3 | |
7251 const char *v3; // ST1C_4@5 | |
7252 int v4; // eax@5 | |
7253 unsigned int i; // eax@5 | |
7254 NPCData *v6; // esi@6 | |
7255 unsigned __int16 v7; // bx@6 | |
7256 unsigned int v8; // eax@6 | |
7257 int v9; // eax@11 | |
7258 unsigned int v10; // ecx@12 | |
7259 int v11; // eax@12 | |
7260 int v12; // esi@12 | |
7261 char *v13; // eax@12 | |
7262 GUIWindow *v14; // ebx@13 | |
7263 char *v15; // esi@14 | |
7264 GUIButton *v16; // eax@15 | |
7265 unsigned int v17; // ecx@15 | |
7266 int v18; // ecx@17 | |
7267 int v19; // ecx@18 | |
7268 int v20; // ecx@19 | |
7269 int v21; // ecx@20 | |
7270 int v22; // ecx@21 | |
7271 unsigned int v23; // ecx@23 | |
7272 int v24; // ecx@35 | |
7273 int v25; // ecx@36 | |
7274 int v26; // ecx@37 | |
7275 int v27; // ecx@38 | |
7276 int v28; // ecx@39 | |
7277 char *v29; // esi@42 | |
7278 unsigned int v30; // ST20_4@42 | |
7279 int v31; // ST1C_4@42 | |
7280 unsigned int v32; // eax@42 | |
7281 char *v33; // eax@43 | |
7282 int v34; // esi@51 | |
7283 int v35; // eax@51 | |
7284 unsigned int v36; // edi@51 | |
7285 GUIButton *v37; // eax@52 | |
7286 int v38; // eax@52 | |
7287 signed int v39; // ecx@54 | |
7288 int v40; // edi@57 | |
7289 GUIButton *v41; // eax@60 | |
7290 GUIButton *v42; // esi@60 | |
7291 const char *v43; // ebx@60 | |
7292 int v44; // eax@60 | |
7293 unsigned int v45; // ecx@60 | |
7294 unsigned __int16 v46; // ax@60 | |
7295 GUIFont *v47; // ebx@64 | |
7296 int v48; // esi@64 | |
7297 char *v49; // eax@66 | |
7298 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7299 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7300 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7301 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7302 int v55; // [sp+10Ch] [bp-10h]@6 | |
7303 int v56; // [sp+110h] [bp-Ch]@13 | |
7304 char *pInString; // [sp+114h] [bp-8h]@12 | |
7305 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7306 | |
7307 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7308 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7309 { |
7310 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7311 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7312 a1.uFrameX = 493; | |
7313 a1.uFrameWidth = 126; | |
7314 a1.uFrameZ = 366; | |
7315 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7316 a1.uFrameX = 483; | |
7317 a1.uFrameWidth = 148; | |
7318 a1.uFrameZ = 334; | |
434 | 7319 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7320 if ( !v2 ) |
7321 { | |
721 | 7322 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7323 v2 = pTmpBuf; |
7324 } | |
7325 v3 = v2; | |
7326 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7327 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7328 return; | |
0 | 7329 } |
7330 a1.uFrameWidth -= 10; | |
7331 a1.uFrameZ -= 10; | |
459 | 7332 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7333 v6 = v58; |
949 | 7334 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7335 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7336 v8 = v6->uProfession; |
7337 if ( v8 ) | |
264 | 7338 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7339 else |
7340 strcpy(pTmpBuf, v6->pName); | |
7341 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7342 if ( !dword_591080 ) | |
7343 { | |
7344 if ( !uDialogueType ) | |
7345 { | |
7346 v9 = v6->greet; | |
7347 if ( v9 ) | |
7348 { | |
7349 v10 = v6->uFlags; | |
819 | 7350 a1.uFrameWidth = game_viewport_width; |
0 | 7351 a1.uFrameZ = 452; |
7352 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7353 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7354 v12 = v11 + 7; | |
7355 pRenderer->_4A6A68( | |
7356 8u, | |
7357 352 - (v11 + 7), | |
7358 (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7359 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); | |
7360 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); | |
7361 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7362 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7363 } | |
7364 } | |
7365 } | |
7366 v14 = pDialogueWindow; | |
7367 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7368 v52.uFrameX = 483; | |
7369 v52.uFrameWidth = 148; | |
7370 v52.uFrameZ = 334; | |
7371 v56 = v52.pStartingPosActiveItem; | |
7372 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7373 { | |
348 | 7374 v15 = "";//(char *)v54; |
0 | 7375 while ( 1 ) |
7376 { | |
7377 v16 = v52.GetControl(v56); | |
832 | 7378 v17 = v16->msg_param; |
0 | 7379 pInString = (char *)v16; |
7380 if ( (signed int)v17 > 24 ) | |
7381 { | |
7382 v24 = v17 - 76; | |
7383 if ( !v24 ) | |
7384 { | |
7385 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7386 goto LABEL_49; | |
7387 } | |
7388 v25 = v24 - 1; | |
7389 if ( !v25 ) | |
7390 { | |
7391 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7392 goto LABEL_49; | |
7393 } | |
7394 v26 = v25 - 2; | |
7395 if ( !v26 ) | |
7396 { | |
7397 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7398 LABEL_44: | |
7399 v15 = v33; | |
7400 LABEL_45: | |
7401 v16 = (GUIButton *)pInString; | |
7402 goto LABEL_49; | |
7403 } | |
7404 v27 = v26 - 3; | |
7405 if ( !v27 ) | |
7406 { | |
459 | 7407 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7408 goto LABEL_44; |
7409 } | |
7410 v28 = v27 - 1; | |
7411 if ( !v28 ) | |
7412 { | |
7413 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7414 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7415 v31 = *(int *)v29; |
949 | 7416 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 7417 sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); |
7418 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7419 current_npc_text = pTmpBuf2; |
0 | 7420 v15 = ""; |
7421 goto LABEL_45; | |
7422 } | |
7423 if ( v28 != 10 ) | |
7424 goto LABEL_41; | |
7425 } | |
7426 else | |
7427 { | |
7428 if ( v17 == 24 ) | |
7429 { | |
291 | 7430 v23 = v58->evt_F; |
0 | 7431 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7432 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7433 if ( !v15 ) |
7434 { | |
832 | 7435 v16->msg_param = 0; |
0 | 7436 v15 = ""; |
7437 } | |
7438 goto LABEL_49; | |
7439 } | |
7440 v18 = v17 - 13; | |
7441 if ( v18 ) | |
7442 { | |
7443 v19 = v18 - 6; | |
7444 if ( !v19 ) | |
7445 { | |
291 | 7446 v23 = v58->evt_A; |
0 | 7447 goto LABEL_33; |
7448 } | |
7449 v20 = v19 - 1; | |
7450 if ( !v20 ) | |
7451 { | |
291 | 7452 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7453 if ( !v15 ) |
7454 { | |
832 | 7455 v16->msg_param = 0; |
0 | 7456 v15 = ""; |
7457 } | |
7458 if ( uDialogueType != 84 ) | |
7459 goto LABEL_49; | |
484 | 7460 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7461 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7462 current_npc_text = pTmpBuf2; | |
0 | 7463 goto LABEL_45; |
7464 } | |
7465 v21 = v20 - 1; | |
7466 if ( !v21 ) | |
7467 { | |
291 | 7468 v23 = v58->evt_C; |
0 | 7469 goto LABEL_33; |
7470 } | |
7471 v22 = v21 - 1; | |
7472 if ( !v22 ) | |
7473 { | |
291 | 7474 v23 = v58->evt_D; |
0 | 7475 goto LABEL_33; |
7476 } | |
7477 if ( v22 == 1 ) | |
7478 { | |
291 | 7479 v23 = v58->evt_E; |
0 | 7480 goto LABEL_33; |
7481 } | |
7482 LABEL_41: | |
7483 v15 = ""; | |
7484 goto LABEL_49; | |
7485 } | |
7486 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7487 } | |
7488 LABEL_49: | |
7489 strcpy(v16->pButtonName, v15); | |
7490 ++v56; | |
7491 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7492 { | |
7493 v14 = pDialogueWindow; | |
7494 break; | |
7495 } | |
7496 } | |
7497 } | |
7498 v34 = 0; | |
949 | 7499 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7500 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7501 v36 = v14->pStartingPosActiveItem; |
7502 v55 = v35; | |
7503 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7504 + pDialogueWindow->pStartingPosActiveItem ) | |
7505 { | |
7506 v37 = v14->GetControl(v36); | |
7507 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7508 v14 = pDialogueWindow; | |
7509 v34 += v38; | |
7510 ++v36; | |
7511 } | |
7512 v39 = v14->pNumPresenceButton; | |
7513 if ( v39 ) | |
7514 { | |
7515 v58 = (NPCData *)((174 - v34) / v39); | |
7516 if ( (signed int)v58 > 32 ) | |
7517 v58 = (NPCData *)32; | |
7518 pInString = (char *)2; | |
7519 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7520 v56 = v14->pStartingPosActiveItem; | |
7521 i = v56; | |
7522 if ( (signed int)i < (signed int)(i + v39) ) | |
7523 { | |
7524 while ( 1 ) | |
7525 { | |
7526 v41 = v14->GetControl(i); | |
7527 v42 = v41; | |
7528 v43 = v41->pButtonName; | |
7529 v41->uY = (unsigned int)((char *)v58 + v40); | |
7530 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7531 v45 = v42->uY; | |
7532 v42->uHeight = v44; | |
7533 v40 = v45 + v44 - 1; | |
7534 v42->uW = v40; | |
7535 v46 = v55; | |
7536 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7537 v46 = v54; | |
7538 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7539 v14 = pDialogueWindow; | |
7540 ++pInString; | |
7541 ++v56; | |
7542 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7543 if ( v56 >= (signed int)i ) | |
7544 break; | |
7545 i = v56; | |
7546 } | |
7547 } | |
7548 } | |
827 | 7549 if ( current_npc_text ) |
0 | 7550 { |
7551 w.uFrameWidth = 458; | |
7552 w.uFrameZ = 457; | |
7553 v47 = pFontArrus; | |
827 | 7554 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7555 if ( 352 - v48 < 8 ) |
7556 { | |
7557 v47 = pFontCreate; | |
827 | 7558 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7559 } |
7560 pRenderer->_4A6A68( | |
7561 8u, | |
7562 352 - v48, | |
7563 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), | |
7564 (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); | |
7565 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); | |
827 | 7566 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7567 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7568 } | |
0 | 7569 } |
7570 | |
7571 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7572 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7573 { |
832 | 7574 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7575 } |
7576 | |
7577 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7578 void sub_4B3A72( int a1 ) |
7579 { | |
7580 int num_buttons; // esi@1 | |
7581 | |
7582 num_buttons = 0; | |
0 | 7583 if ( a1 == 21 ) |
7584 { | |
473 | 7585 CreateButtonInColumn(0, 0x66u); |
7586 num_buttons = 2; | |
7587 CreateButtonInColumn(1, 0x67u); | |
7588 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7589 { | |
7590 num_buttons = 3; | |
7591 CreateButtonInColumn(2, 0x68u); | |
7592 } | |
7593 } | |
7594 pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); | |
0 | 7595 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7596 } | |
7597 // F8B1E0: using guessed type int dword_F8B1E0; | |
7598 | |
7599 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7600 void sub_4B3AD4( signed int a1 ) |
7601 { | |
0 | 7602 if ( a1 > 0 ) |
7603 { | |
7604 if ( a1 <= 3 ) | |
7605 { | |
473 | 7606 CreateButtonInColumn(0, 3u); |
7607 CreateButtonInColumn(1, 4u); | |
7608 CreateButtonInColumn(2, 5u); | |
7609 pDialogueWindow->_41D08F(3, 1, 0, 2); | |
0 | 7610 } |
7611 if ( a1 == 4 ) | |
7612 { | |
473 | 7613 CreateButtonInColumn(0, 3u); |
7614 CreateButtonInColumn(1, 4u); | |
7615 pDialogueWindow->_41D08F(2, 1, 0, 2); | |
7616 } | |
7617 } | |
0 | 7618 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7619 } | |
7620 // F8B1E0: using guessed type int dword_F8B1E0; | |
7621 | |
7622 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7623 void sub_4B3B42( signed int a1 ) |
7624 { | |
0 | 7625 int v1; // ecx@18 |
7626 int v2; // ecx@19 | |
7627 int v3; // ecx@20 | |
7628 signed int v4; // esi@22 | |
7629 signed int v5; // eax@22 | |
7630 unsigned int v6; // edx@24 | |
7631 int v7; // ecx@24 | |
7632 int result; // eax@43 | |
7633 int v9; // [sp-10h] [bp-14h]@28 | |
7634 int v10; // [sp-Ch] [bp-10h]@28 | |
7635 int v11; // [sp-8h] [bp-Ch]@28 | |
7636 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7637 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7638 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7639 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7640 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7641 int v17; // [sp-4h] [bp-8h]@28 | |
7642 | |
7643 if ( a1 > 13 ) | |
7644 { | |
7645 if ( a1 > 22 ) | |
7646 { | |
7647 if ( a1 == 23 ) | |
7648 { | |
473 | 7649 CreateButtonInColumn(0, 0xAu); |
7650 CreateButtonInColumn(1, 0xBu); | |
0 | 7651 v14 = 96; |
7652 LABEL_41: | |
473 | 7653 CreateButtonInColumn(2, v14); |
0 | 7654 v17 = 2; |
7655 v11 = 0; | |
7656 v10 = 1; | |
7657 v9 = 3; | |
7658 goto LABEL_42; | |
7659 } | |
7660 if ( a1 <= 26 ) | |
7661 goto LABEL_43; | |
7662 if ( a1 > 28 ) | |
7663 { | |
7664 if ( a1 != 30 ) | |
7665 goto LABEL_43; | |
473 | 7666 CreateButtonInColumn(0, 0x11u); |
0 | 7667 v16 = 96; |
7668 goto LABEL_37; | |
7669 } | |
473 | 7670 CreateButtonInColumn(0, 0x69u); |
7671 CreateButtonInColumn(1, 0x6Au); | |
7672 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7673 v12 = 108; |
7674 } | |
7675 else | |
7676 { | |
7677 if ( a1 == 22 ) | |
7678 { | |
473 | 7679 CreateButtonInColumn(0, 7u); |
0 | 7680 v16 = 8; |
7681 goto LABEL_37; | |
7682 } | |
7683 v1 = a1 - 14; | |
7684 if ( !v1 ) | |
7685 { | |
473 | 7686 CreateButtonInColumn(0, 0x12u); |
7687 CreateButtonInColumn(1, 0x30u); | |
7688 CreateButtonInColumn(2, 0x31u); | |
7689 CreateButtonInColumn(3, 0x32u); | |
7690 CreateButtonInColumn(4, 0x33u); | |
0 | 7691 v17 = 2; |
7692 v11 = 0; | |
7693 v10 = 1; | |
7694 v9 = 5; | |
7695 goto LABEL_42; | |
7696 } | |
7697 v2 = v1 - 1; | |
7698 if ( v2 ) | |
7699 { | |
7700 v3 = v2 - 2; | |
7701 if ( v3 ) | |
7702 { | |
7703 if ( v3 != 4 ) | |
7704 goto LABEL_43; | |
473 | 7705 CreateButtonInColumn(0, 0xFu); |
7706 CreateButtonInColumn(1, 0x10u); | |
0 | 7707 v4 = 3; |
473 | 7708 CreateButtonInColumn(2, 0x60u); |
336 | 7709 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7710 if ( v5 < 108 || v5 > 120 ) |
7711 goto LABEL_28; | |
7712 v4 = 4; | |
7713 v6 = 101; | |
7714 v7 = 3; | |
7715 } | |
7716 else | |
7717 { | |
7718 v4 = 1; | |
473 | 7719 CreateButtonInColumn(0, 0x63u); |
0 | 7720 if ( !pParty->uFine ) |
7721 { | |
7722 LABEL_28: | |
7723 v17 = 2; | |
7724 v11 = 0; | |
7725 v10 = 1; | |
7726 v9 = v4; | |
7727 LABEL_42: | |
7728 pDialogueWindow->_41D08F(v9, v10, v11, v17); | |
7729 goto LABEL_43; | |
7730 } | |
7731 v4 = 2; | |
7732 v7 = 1; | |
7733 v6 = 100; | |
7734 } | |
473 | 7735 CreateButtonInColumn(v7, v6); |
0 | 7736 goto LABEL_28; |
7737 } | |
473 | 7738 CreateButtonInColumn(0, 0x12u); |
7739 CreateButtonInColumn(1, 0x34u); | |
7740 CreateButtonInColumn(2, 0x35u); | |
0 | 7741 v12 = 54; |
7742 } | |
7743 LABEL_39: | |
473 | 7744 CreateButtonInColumn(3, v12); |
0 | 7745 v17 = 2; |
7746 v11 = 0; | |
7747 v10 = 1; | |
7748 v9 = 4; | |
7749 goto LABEL_42; | |
7750 } | |
7751 if ( a1 == 13 ) | |
7752 { | |
473 | 7753 CreateButtonInColumn(0, 0x12u); |
0 | 7754 v16 = 56; |
7755 LABEL_37: | |
473 | 7756 CreateButtonInColumn(1, v16); |
0 | 7757 v17 = 2; |
7758 v11 = 0; | |
7759 v10 = 1; | |
7760 v9 = 2; | |
7761 goto LABEL_42; | |
7762 } | |
7763 switch ( a1 ) | |
7764 { | |
7765 case 1: | |
7766 case 2: | |
7767 case 3: | |
7768 case 4: | |
473 | 7769 CreateButtonInColumn(0, 2u); |
7770 CreateButtonInColumn(1, 0x5Fu); | |
7771 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7772 v12 = 96; |
7773 goto LABEL_39; | |
7774 case 5: | |
473 | 7775 CreateButtonInColumn(0, 0x12u); |
0 | 7776 v13 = 48; |
7777 goto LABEL_9; | |
7778 case 6: | |
473 | 7779 CreateButtonInColumn(0, 0x12u); |
0 | 7780 v13 = 49; |
7781 goto LABEL_9; | |
7782 case 7: | |
473 | 7783 CreateButtonInColumn(0, 0x12u); |
0 | 7784 v13 = 50; |
7785 goto LABEL_9; | |
7786 case 8: | |
473 | 7787 CreateButtonInColumn(0, 0x12u); |
0 | 7788 v13 = 51; |
7789 LABEL_9: | |
473 | 7790 CreateButtonInColumn(1, v13); |
0 | 7791 v14 = 72; |
7792 goto LABEL_41; | |
7793 case 9: | |
473 | 7794 CreateButtonInColumn(0, 0x12u); |
0 | 7795 v15 = 52; |
7796 goto LABEL_13; | |
7797 case 10: | |
473 | 7798 CreateButtonInColumn(0, 0x12u); |
0 | 7799 v15 = 53; |
7800 goto LABEL_13; | |
7801 case 11: | |
473 | 7802 CreateButtonInColumn(0, 0x12u); |
0 | 7803 v15 = 54; |
7804 LABEL_13: | |
473 | 7805 CreateButtonInColumn(1, v15); |
0 | 7806 v14 = 61; |
7807 goto LABEL_41; | |
7808 case 12: | |
473 | 7809 CreateButtonInColumn(0, 0x12u); |
0 | 7810 v16 = 55; |
7811 goto LABEL_37; | |
7812 default: | |
7813 break; | |
7814 } | |
7815 LABEL_43: | |
7816 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7817 } | |
7818 // F8B1E0: using guessed type int dword_F8B1E0; | |
7819 | |
7820 //----- (004B3E1E) -------------------------------------------------------- | |
7821 void __cdecl sub_4B3E1E() | |
7822 { | |
7823 NPCData *v0; // ST40_4@1 | |
7824 signed int v1; // edi@1 | |
165 | 7825 //GUIWindow *v2; // ecx@1 |
0 | 7826 |
167 | 7827 __debugbreak(); |
602 | 7828 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7829 v1 = 0; |
7830 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7831 pDialogueWindow->Release(); | |
165 | 7832 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7833 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7834 { |
832 | 7835 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7836 v1 = 1; |
7837 } | |
832 | 7838 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 7839 pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); |
7840 } | |
7841 | |
7842 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7843 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7844 { |
467 | 7845 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7846 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7847 ContractSelectText(pEventCode); |
0 | 7848 pDialogueWindow->Release(); |
492 | 7849 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7850 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7851 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7852 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
0 | 7853 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7854 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7855 } |
7856 // F8B19C: using guessed type int dword_F8B19C; | |
7857 | |
7858 //----- (004B3FE5) -------------------------------------------------------- | |
7859 void __fastcall sub_4B3FE5(int a4) | |
7860 { | |
7861 int v1; // edi@1 | |
7862 char *v2; // edi@1 | |
7863 | |
7864 v1 = a4; | |
7865 uDialogueType = 78; | |
827 | 7866 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7867 _4B254D_SkillMasteryTeacher(a4); |
7868 pDialogueWindow->Release(); | |
7869 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7870 v2 = ""; | |
832 | 7871 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7872 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7873 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7874 if ( contract_approved ) |
0 | 7875 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7876 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
0 | 7877 pDialogueWindow->_41D08F(1, 1, 0, 2); |
747 | 7878 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7879 } |
7880 // F8B19C: using guessed type int dword_F8B19C; | |
7881 // F8B1A8: using guessed type int dword_F8B1A8; | |
7882 | |
7883 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7884 void NPCHireableDialogPrepare() |
7885 { | |
0 | 7886 signed int v0; // ebx@1 |
7887 NPCData *v1; // edi@1 | |
7888 | |
7889 v0 = 0; | |
459 | 7890 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7891 pDialogueWindow->Release(); |
7892 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7893 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7894 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7895 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7896 0); |
832 | 7897 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7898 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7899 { |
832 | 7900 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7901 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7902 v0 = 1; |
7903 } | |
832 | 7904 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7905 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
0 | 7906 pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); |
747 | 7907 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7908 } |
7909 | |
7910 //----- (004B4224) -------------------------------------------------------- | |
423 | 7911 void _4B4224_UpdateNPCTopics( int _this ) |
7912 { | |
7913 int num_menu_buttons; // ebx@1 | |
0 | 7914 int i; // ebp@5 |
423 | 7915 // signed int v4; // ebp@9 |
7916 int v6; // eax@16 | |
7917 int v8; // eax@21 | |
7918 int v10; // eax@26 | |
7919 int v12; // eax@31 | |
7920 int v14; // eax@36 | |
7921 int v16; // eax@41 | |
0 | 7922 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7923 | |
423 | 7924 num_menu_buttons = 0; |
459 | 7925 pDialogueNPCCount = (_this + 1); |
0 | 7926 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7927 { | |
7928 pDialogueWindow->Release(); | |
7929 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7930 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7931 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
7932 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
832 | 7933 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
948 | 7934 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0); |
0 | 7935 } |
7936 else | |
7937 { | |
459 | 7938 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7939 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7940 { |
7941 pDialogueWindow->Release(); | |
7942 } | |
7943 else | |
7944 { | |
7945 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7946 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7947 } |
7948 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7949 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7950 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7951 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7952 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7953 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7954 { |
484 | 7955 sub_4B3B42(in_current_building_type); |
0 | 7956 } |
7957 else | |
7958 { | |
7959 if ( v17->joins ) | |
7960 { | |
423 | 7961 num_menu_buttons = 1; |
858 | 7962 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7963 } |
423 | 7964 if ( v17->evt_A) |
7965 { | |
7966 if ( num_menu_buttons < 4 ) | |
7967 { | |
7968 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7969 if ( v6 == 1 || v6 == 2 ) |
832 | 7970 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7971 } |
7972 } | |
7973 if ( v17->evt_B ) | |
7974 { | |
7975 if ( num_menu_buttons < 4 ) | |
7976 { | |
7977 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7978 if ( v8 == 1 || v8 == 2 ) |
832 | 7979 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7980 } |
7981 } | |
7982 if ( v17->evt_C ) | |
7983 { | |
7984 if ( num_menu_buttons < 4 ) | |
7985 { | |
7986 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7987 if ( v10 == 1 || v10 == 2 ) |
832 | 7988 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7989 } |
7990 } | |
7991 | |
7992 if ( v17->evt_D ) | |
7993 { | |
7994 if ( num_menu_buttons < 4 ) | |
7995 { | |
7996 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7997 if ( v12 == 1 || v12 == 2 ) |
832 | 7998 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7999 } |
8000 } | |
8001 if ( v17->evt_E ) | |
8002 { | |
8003 if ( num_menu_buttons < 4 ) | |
8004 { | |
8005 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 8006 if ( v14 == 1 || v14 == 2 ) |
832 | 8007 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 8008 } |
8009 } | |
8010 if ( v17->evt_F ) | |
8011 { | |
8012 if ( num_menu_buttons < 4 ) | |
8013 { | |
8014 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 8015 if ( v16 == 1 || v16 == 2 ) |
832 | 8016 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 8017 } |
8018 } | |
8019 pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); | |
0 | 8020 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
8021 } | |
747 | 8022 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 8023 } |
8024 | |
0 | 8025 } |
8026 | |
8027 //----- (004B46A5) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8028 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8029 { |
0 | 8030 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8031 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8032 v4 = pFontLucida->AlignText_Center(450, sText); |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
8033 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); |
0 | 8034 } |
8035 | |
8036 //----- (004B46F8) -------------------------------------------------------- | |
8037 int __fastcall sub_4B46F8(int a1) | |
8038 { | |
8039 int v1; // eax@1 | |
8040 int i; // edx@1 | |
8041 | |
8042 v1 = 0; | |
8043 for ( i = 0; i < a1; ++i ) | |
8044 v1 += i + 1; | |
8045 return 1000 * v1; | |
8046 } | |
8047 | |
8048 //----- (004BC49B) -------------------------------------------------------- | |
651 | 8049 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 8050 { |
656 | 8051 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8052 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8053 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8054 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8055 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8056 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8057 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8058 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8059 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8060 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8061 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8062 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8063 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8064 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8065 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8066 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8067 //v1 = _this; |
656 | 8068 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
8069 //v3 = v1; |
656 | 8070 uDialogueType = newDialogueType; |
8071 if (!speakingNPC->uFlags) | |
8072 { | |
8073 speakingNPC->uFlags = 1; | |
8074 //v3 = uDialogueType; | |
8075 } | |
8076 | |
8077 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
8078 { | |
8079 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
8080 } | |
8081 else if(newDialogueType == DIALOGUE_76) | |
8082 { | |
8083 if (speakingNPC->Hired()) | |
8084 { | |
8085 v8 = 0; | |
8086 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8087 { | |
8088 v6 = (char *)pNPCStats->pNewNPCData; | |
8089 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8090 { | |
8091 ++v8; | |
8092 v6 += 76; | |
8093 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8094 break; | |
8095 } | |
8096 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
8097 v6[8] &= 0x7Fu; | |
8098 } | |
8099 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8100 { | |
8101 v11 = pParty->pHirelings; | |
8102 memset(v11, 0, sizeof(NPCData)); | |
8103 } | |
8104 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8105 { | |
8106 v11 = &pParty->pHirelings[1]; | |
8107 memset(v11, 0, sizeof(NPCData)); | |
8108 } | |
8109 pParty->field_709 = 0; | |
659 | 8110 Party__CountHirelings(); |
656 | 8111 dword_591084 = 0; |
8112 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8113 dword_7241C8 = 0; | |
8114 return; | |
8115 } | |
8116 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
8117 { | |
8118 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
8119 ShowStatusBarString(v7, 2u); | |
8120 } | |
8121 else | |
8122 { | |
8123 //v9 = v2->uProfession; | |
8124 if ( speakingNPC->uProfession != 51 ) | |
8125 { | |
8126 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8127 if ( pParty->uNumGold < v10 ) | |
8128 { | |
8129 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8130 dialogue_show_profession_details = false; | |
8131 uDialogueType = 13; | |
8132 if ( uActiveCharacter ) | |
8133 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8134 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8135 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8136 if ( !dword_7241C8 ) | |
8137 pGame->Draw(); | |
8138 dword_7241C8 = 0; | |
8139 return; | |
8140 } | |
8141 Party::TakeGold(v10); | |
8142 } | |
8143 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8144 if ( pParty->pHirelings[0].pName ) | |
8145 { | |
8146 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8147 v15 = speakingNPC->pName; | |
8148 v13 = pParty->pHireling2Name; | |
8149 } | |
8150 else | |
8151 { | |
8152 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8153 v15 = speakingNPC->pName; | |
8154 v13 = pParty->pHireling1Name; | |
8155 } | |
8156 strcpy(v13, v15); | |
8157 pParty->field_709 = 0; | |
659 | 8158 Party__CountHirelings(); |
656 | 8159 |
8160 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8161 | |
711 | 8162 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8163 pDialogue_SpeakingActor->uAIState = Removed; |
8164 if ( uActiveCharacter ) | |
8165 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8166 } | |
8167 } | |
8168 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8169 { | |
8170 ArenaFight(); | |
8171 return; | |
8172 } | |
8173 else if(newDialogueType == DIALOGUE_9) | |
8174 { | |
8175 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8176 { | |
8177 if ( speakingNPC->uProfession != 41 ) | |
8178 speakingNPC->bHasUsedTheAbility = 1; | |
8179 | |
8180 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8181 } | |
8182 else | |
8183 { | |
8184 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8185 } | |
8186 } | |
8187 else if(newDialogueType == DIALOGUE_13) | |
8188 { | |
8189 if (!speakingNPC->Hired()) | |
8190 { | |
8191 sub_4B3E1E(); | |
8192 dialogue_show_profession_details = false; | |
8193 } | |
8194 else | |
8195 { | |
8196 v5 = 0; | |
8197 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8198 { | |
8199 v6 = (char *)pNPCStats->pNewNPCData; | |
8200 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8201 { | |
8202 ++v5; | |
8203 v6 += 76; | |
8204 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8205 break; | |
8206 } | |
8207 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8208 v6[8] &= 0x7Fu; | |
8209 } | |
8210 if ( pParty->pHirelings[0].pName && !_strcmpi(pParty->pHirelings[0].pName, speakingNPC->pName) ) | |
8211 { | |
8212 v11 = pParty->pHirelings; | |
8213 memset(v11, 0, sizeof(NPCData)); | |
8214 } | |
8215 else if ( pParty->pHirelings[1].pName && !_strcmpi(pParty->pHirelings[1].pName, speakingNPC->pName) ) | |
8216 { | |
8217 v11 = &pParty->pHirelings[1]; | |
8218 memset(v11, 0, sizeof(NPCData)); | |
8219 } | |
8220 pParty->field_709 = 0; | |
659 | 8221 Party__CountHirelings(); |
656 | 8222 dword_591084 = 0; |
8223 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8224 dword_7241C8 = 0; | |
8225 return; | |
8226 } | |
8227 } | |
8228 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8229 { | |
8230 switch(newDialogueType) | |
8231 { | |
8232 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8233 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8234 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8235 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8236 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8237 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8238 } | |
8239 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8240 sub_4B3FE5(npc_event_id); //200-310 | |
8241 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8242 { //400-410 | |
8243 dword_F8B1D8 = newDialogueType; | |
8244 DrawJoinGuildWindow(npc_event_id - 400); | |
8245 } | |
8246 else | |
8247 { | |
8248 switch ( npc_event_id ) | |
8249 { | |
8250 case 139: | |
8251 sub_4B1ECE(); | |
8252 break; | |
8253 case 311: | |
8254 sub_4BBA85_bounties(); | |
8255 break; | |
8256 case 399: | |
8257 sub_4BBCDD(); | |
8258 break; | |
8259 default: | |
8260 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8261 current_npc_text = 0; |
656 | 8262 EventProcessor(npc_event_id, 0, 1); |
8263 activeLevelDecoration = NULL; | |
8264 break; | |
8265 } | |
8266 } | |
8267 } | |
8268 if ( !dword_7241C8 ) | |
8269 pGame->Draw(); | |
8270 dword_7241C8 = 0; | |
8271 } | |
0 | 8272 |
8273 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8274 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8275 { |
8276 int v6; // edx@8 | |
8277 int v7; // edx@9 | |
8278 int v8; // edx@10 | |
8279 unsigned __int8 v9; // zf@16 | |
8280 char v10; // sf@16 | |
8281 unsigned __int8 v11; // of@16 | |
702 | 8282 bool test; |
0 | 8283 |
907 | 8284 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8285 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8286 return 0; |
907 | 8287 switch( p2DEvents[_2da_idx - 1].uType ) |
8288 { | |
8289 case BildingType_WeaponShop: | |
8290 { | |
8291 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8292 break; | |
8293 } | |
8294 case BildingType_ArmorShop: | |
8295 { | |
8296 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8297 break; | |
8298 } | |
8299 case BildingType_MagicShop: | |
8300 { | |
8301 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8302 break; | |
8303 } | |
8304 case BildingType_AlchemistShop: | |
8305 { | |
8306 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8307 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8308 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8309 break; | |
8310 } | |
8311 default: | |
8312 { | |
8313 test = false; | |
8314 break; | |
8315 } | |
8316 } | |
702 | 8317 return test; |
8318 /* | |
8319 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8320 { |
8321 v11 = __OFSUB__(v5, 2); | |
8322 v9 = v5 == 2; | |
8323 v10 = v5 - 2 < 0; | |
8324 goto LABEL_23; | |
8325 } | |
702 | 8326 if ( p2DEvents[a2 - 1].uType > 2 ) |
8327 { | |
8328 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8329 { |
8330 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8331 return v5 == 16; | |
8332 return 1; | |
8333 } | |
702 | 8334 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8335 return 0; |
702 | 8336 if ( p2DEvents[a2 - 1].uType == 4) |
8337 { | |
8338 if ( v5 < 13 ) | |
8339 return 0; | |
8340 if ( v5 <= 14 ) | |
8341 return 1; | |
8342 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8343 return 0; | |
8344 v11 = __OFSUB__(v3, 771); | |
8345 v9 = v3 == 771; | |
8346 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8347 LABEL_23: |
702 | 8348 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8349 return 0; | |
8350 return 1; | |
8351 } | |
8352 } | |
8353 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8354 { | |
8355 if ( v5 >= 3 ) | |
8356 { | |
8357 v11 = __OFSUB__(v5, 9); | |
8358 v9 = v5 == 9; | |
8359 v10 = v5 - 9 < 0; | |
8360 goto LABEL_23; | |
8361 } | |
0 | 8362 } |
8363 return 0; | |
702 | 8364 */ |
0 | 8365 } |
8366 | |
8367 //----- (004B6478) -------------------------------------------------------- | |
711 | 8368 void sub_4B6478() |
8369 { | |
0 | 8370 GUIWindow *v0; // ebx@1 |
8371 Player *v1; // edi@1 | |
8372 unsigned int v2; // eax@1 | |
8373 signed int v3; // esi@1 | |
8374 int v4; // ebx@1 | |
8375 unsigned int v5; // esi@5 | |
8376 int v6; // edi@6 | |
8377 int result; // eax@13 | |
8378 GUIWindow *v8; // ebx@17 | |
8379 int v9; // eax@17 | |
8380 int v10; // ecx@17 | |
8381 unsigned int v11; // ecx@18 | |
8382 int v12; // eax@20 | |
8383 int v13; // eax@21 | |
8384 GUIButton *v14; // esi@27 | |
8385 int v15; // ecx@27 | |
8386 unsigned int v16; // eax@28 | |
8387 const char *v17; // ebx@29 | |
8388 int v18; // eax@29 | |
8389 unsigned int v19; // ecx@29 | |
8390 int v20; // eax@29 | |
8391 unsigned __int16 v21; // ax@29 | |
8392 unsigned __int16 v22; // ST14_2@36 | |
8393 int v23; // eax@36 | |
8394 const char *v24; // ST18_4@37 | |
8395 unsigned __int16 v25; // ST14_2@37 | |
8396 int v26; // eax@37 | |
8397 int v27; // [sp-4h] [bp-80h]@8 | |
8398 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8399 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8400 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8401 int v31; // [sp+68h] [bp-14h]@1 | |
8402 int v32; // [sp+6Ch] [bp-10h]@1 | |
8403 int v33; // [sp+70h] [bp-Ch]@17 | |
8404 int v34; // [sp+74h] [bp-8h]@17 | |
8405 int v35; // [sp+78h] [bp-4h]@17 | |
8406 | |
336 | 8407 v0 = window_SpeakInHouse; |
8408 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8409 v1 = pPlayers[uActiveCharacter]; |
8410 v28.uFrameX = 483; | |
8411 v28.uFrameWidth = 148; | |
8412 v28.uFrameZ = 334; | |
949 | 8413 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
8414 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
0 | 8415 v2 = 52 * (unsigned int)v0->ptr_1C; |
8416 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8417 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8418 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8419 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8420 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8421 v32 = v4; | |
8422 if ( v4 < v3 / 3 ) | |
8423 { | |
8424 v4 = v3 / 3; | |
8425 v32 = v3 / 3; | |
8426 } | |
749 | 8427 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8428 { |
8429 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8430 { | |
8431 v5 = 0; | |
8432 | |
8433 __debugbreak(); | |
8434 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8435 // or | |
8436 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8437 // or | |
8438 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8439 __debugbreak(); // whacky condition - fix |
0 | 8440 if (false |
8441 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8442 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8443 { |
8444 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8445 } | |
8446 else | |
8447 { | |
8448 if ( pParty->uNumGold < v4 ) | |
8449 { | |
8450 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8451 v27 = 4; | |
8452 } | |
8453 else | |
8454 { | |
8455 Party::TakeGold(v4); | |
8456 *(short *)v6 = 1; | |
8457 v27 = 2; | |
8458 } | |
735 | 8459 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8460 } |
8461 } | |
8462 else | |
8463 { | |
8464 v5 = 0; | |
8465 } | |
437 | 8466 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8467 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8468 { | |
8469 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
8470 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
8471 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8472 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8473 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8474 }*/ |
8475 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8476 return; // void func |
0 | 8477 } |
484 | 8478 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8479 { |
8480 v24 = pNPCTopics[171].pText; | |
8481 v25 = v31; | |
8482 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8483 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8484 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8485 return ; |
8486 } | |
8487 | |
8488 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8489 return; | |
0 | 8490 v8 = pDialogueWindow; |
8491 v33 = 0; | |
8492 v34 = 0; | |
8493 v29 = pDialogueWindow; | |
8494 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8495 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8496 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8497 if ( v9 >= v10 ) | |
8498 goto LABEL_40; | |
8499 do | |
8500 { | |
832 | 8501 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8502 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8503 { |
8504 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8505 v33 += v12; | |
8506 ++v34; | |
8507 } | |
8508 v13 = v8->pStartingPosActiveItem; | |
8509 ++v35; | |
8510 } | |
8511 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8512 if ( !v34 ) | |
8513 { | |
8514 LABEL_40: | |
135 | 8515 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8516 strcat(pTmpBuf, "\n \n"); |
8517 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8518 v22 = v31; | |
8519 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8520 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8521 return; | |
0 | 8522 } |
8523 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8524 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8525 v32 = (149 - v33) / v34; | |
8526 if ( (149 - v33) / v34 > 32 ) | |
8527 v32 = 32; | |
711 | 8528 |
8529 v35 = v8->pStartingPosActiveItem; | |
0 | 8530 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8531 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8532 { |
8533 v33 = 2; | |
8534 do | |
8535 { | |
8536 v14 = v8->GetControl(v35); | |
832 | 8537 v15 = v14->msg_param - 36; |
135 | 8538 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8539 { |
8540 v16 = 0; | |
8541 if ( !v1->pActiveSkills[v15] ) | |
8542 { | |
8543 v17 = pSkillNames[v15]; | |
8544 v14->uY = v32 + v34; | |
8545 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8546 v19 = v14->uY; | |
8547 v14->uHeight = v18; | |
8548 v20 = v19 + v18 - 1; | |
8549 v14->uW = v20; | |
8550 v34 = v20; | |
8551 v21 = v31; | |
8552 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8553 v21 = v30; | |
8554 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8555 goto LABEL_34; | |
8556 } | |
8557 } | |
8558 else | |
8559 { | |
8560 v16 = 0; | |
8561 } | |
8562 v14->uW = v16; | |
8563 v14->uHeight = v16; | |
8564 v14->uY = v16; | |
8565 LABEL_34: | |
8566 v8 = v29; | |
8567 ++v35; | |
8568 ++v33; | |
711 | 8569 } |
8570 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8571 } | |
8572 return; | |
0 | 8573 } |
8574 | |
8575 //----- (00405CFF) -------------------------------------------------------- | |
8576 void stru262_TurnBased::End(bool bPlaySound) | |
8577 { | |
8578 stru262_TurnBased *v2; // edi@1 | |
8579 int v3; // ebx@1 | |
8580 int v4; // esi@1 | |
8581 unsigned __int8 v5; // zf@1 | |
8582 unsigned __int8 v6; // sf@1 | |
8583 TurnBased_QueueElem *v7; // ecx@2 | |
8584 unsigned __int16 *pAttributes; // ecx@7 | |
8585 size_t v9; // edx@7 | |
8586 unsigned __int16 v10; // ax@8 | |
8587 TurnBased_QueueElem *v11; // ebx@12 | |
8588 ObjectType objType; // eax@13 | |
8589 int objID; // esi@13 | |
8590 int v14; // [sp+Ch] [bp-4h]@11 | |
8591 | |
8592 v2 = this; | |
8593 v3 = 0; | |
8594 v4 = 0; | |
8595 v5 = this->uActorQueueSize == 0; | |
8596 v6 = this->uActorQueueSize < 0; | |
8597 this->field_4 = 0; | |
8598 if ( !(v6 | v5) ) | |
8599 { | |
8600 v7 = this->pQueue; | |
8601 do | |
8602 { | |
848 | 8603 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8604 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8605 ++v4; |
8606 ++v7; | |
8607 } | |
8608 while ( v4 < v2->uActorQueueSize ); | |
8609 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8610 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8611 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8612 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8613 v9 = uNumSpriteObjects; |
0 | 8614 do |
8615 { | |
8616 v10 = *pAttributes; | |
8617 if ( *pAttributes & 4 ) | |
8618 { | |
8619 LOBYTE(v10) = v10 & 0xFB; | |
8620 *pAttributes = v10; | |
8621 } | |
8622 pAttributes += 56; | |
8623 --v9; | |
8624 } | |
8625 while ( v9 ); | |
8626 } | |
8627 v14 = 0; | |
8628 if ( v2->uActorQueueSize > 0 ) | |
8629 { | |
8630 v11 = v2->pQueue; | |
8631 do | |
8632 { | |
848 | 8633 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8634 objID = PID_ID(v11->uPackedID); | |
0 | 8635 if ( objType == OBJECT_Player ) |
8636 { | |
8637 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8638 } | |
8639 else | |
8640 { | |
8641 if ( objType == OBJECT_Actor ) | |
8642 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8643 } | |
8644 ++v14; | |
8645 ++v11; | |
8646 } | |
8647 while ( v14 < v2->uActorQueueSize ); | |
8648 v3 = 0; | |
8649 } | |
8650 pAudioPlayer->StopChannels(-1, -1); | |
8651 if ( bPlaySound != v3 ) | |
8652 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8653 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8654 pEventTimer->StopGameTime(); | |
8655 dword_50C994 = v3; | |
8656 dword_50C998_turnbased_icon_1A = v3; | |
8657 } | |
8658 // 50C994: using guessed type int dword_50C994; | |
8659 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8660 | |
8661 //----- (00405E14) -------------------------------------------------------- | |
8662 void stru262_TurnBased::_405E14() | |
8663 { | |
8664 stru262_TurnBased *v1; // esi@1 | |
8665 int v2; // ecx@1 | |
8666 SpellBuff *v3; // edi@2 | |
8667 Actor *v4; // ebx@3 | |
8668 signed int v5; // edx@20 | |
8669 AIDirection *v6; // esi@21 | |
8670 int v7; // eax@21 | |
8671 int v8; // eax@21 | |
8672 int v9; // eax@22 | |
8673 int v10; // eax@23 | |
8674 int v11; // eax@37 | |
8675 int v12; // eax@44 | |
8676 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8677 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8678 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8679 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8680 int v17; // [sp+5Ch] [bp-10h]@6 |
8681 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8682 int v19; // [sp+64h] [bp-8h]@8 | |
8683 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8684 | |
8685 v1 = this; | |
8686 v2 = 0; | |
8687 v18 = v1; | |
8688 v20 = 0; | |
8689 if ( (signed int)uNumActors > 0 ) | |
8690 { | |
90 | 8691 //v3 = pActors;//[0].pActorBuffs; |
8692 v16 = pActors;//[0].pActorBuffs; | |
8693 v3 = v16->pActorBuffs; | |
0 | 8694 do |
8695 { | |
90 | 8696 v4 = v16; |
8697 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8698 v17 = v2; |
8699 else | |
8700 v17 = 1; | |
8701 v19 = v2; | |
8702 do | |
8703 { | |
8704 if ( v19 != 10 ) | |
8705 { | |
8706 v3->_4585CA(pParty->uTimePlayed); | |
8707 v2 = 0; | |
8708 } | |
8709 ++v19; | |
8710 ++v3; | |
8711 } | |
8712 while ( v19 < 22 ); | |
8713 if ( v17 != v2 | |
8714 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8715 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8716 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8717 if ( !(v4->uAttributes & 0x80) ) | |
8718 { | |
8719 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8720 { | |
8721 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8722 { | |
8723 v5 = v4->uCurrentActionLength; | |
8724 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8725 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8726 { | |
417 | 8727 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8728 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8729 v7 = v4->uAIState; |
8730 memcpy(&v15, v6, sizeof(v15)); | |
8731 v8 = v7 - 4; | |
8732 memcpy(&v14, &v15, sizeof(v14)); | |
8733 if ( v8 ) | |
8734 { | |
8735 v9 = v8 - 1; | |
8736 if ( v9 ) | |
8737 { | |
8738 v10 = v9 - 6; | |
8739 if ( v10 ) | |
8740 { | |
8741 if ( v10 != 8 ) | |
414 | 8742 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8743 } |
8744 } | |
8745 } | |
8746 else | |
8747 { | |
8748 v4->uCurrentActionTime = 0; | |
8749 v4->uCurrentActionLength = 0; | |
8750 v4->uAIState = Dead; | |
8751 v4->UpdateAnimation(); | |
8752 } | |
8753 v1 = v18; | |
8754 v2 = 0; | |
8755 } | |
8756 } | |
8757 } | |
8758 } | |
8759 ++v20; | |
90 | 8760 v3 = v16[1].pActorBuffs; |
8761 ++v16; | |
0 | 8762 } |
8763 while ( (signed int)v20 < (signed int)uNumActors ); | |
8764 } | |
8765 if ( v1->field_4 == 1 ) | |
8766 { | |
8767 v12 = v1->field_8; | |
8768 if ( v12 == 64 ) | |
8769 { | |
8770 v1->_406A63(); | |
8771 } | |
8772 else | |
8773 { | |
8774 if ( v12 > v2 ) | |
8775 { | |
8776 v1->_406B9F(); | |
8777 } | |
8778 else | |
8779 { | |
8780 v1->_406AFE(); | |
8781 v1->field_10 = 100; | |
8782 } | |
8783 } | |
8784 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8785 return; | |
8786 } | |
8787 if ( v1->field_4 == 2 ) | |
8788 { | |
8789 if ( !(v1->field_18 & 1) ) | |
8790 { | |
8791 v11 = v1->field_10; | |
8792 if ( v11 == 100 ) | |
8793 { | |
8794 v1->StartTurn(); | |
8795 LABEL_39: | |
8796 v1->_40652A(); | |
8797 return; | |
8798 } | |
8799 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8800 { | |
8801 v1->_4065B0(); | |
8802 goto LABEL_39; | |
8803 } | |
8804 } | |
8805 v1->NextTurn(); | |
8806 return; | |
8807 } | |
8808 if ( v1->field_4 == 3 ) | |
8809 { | |
8810 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8811 { | |
8812 v1->field_18 &= 0xFFFFFFF7u; | |
8813 v1->field_4 = 1; | |
8814 v1->field_8 = 64; | |
8815 } | |
8816 else | |
8817 { | |
8818 v1->_406FA8(); | |
8819 } | |
8820 } | |
8821 } | |
8822 | |
8823 //----- (0043FDED) -------------------------------------------------------- | |
8824 void PrepareActorRenderList_BLV() | |
8825 { | |
8826 RenderBillboard *v0; // esi@0 | |
8827 unsigned __int16 v3; // ax@3 | |
8828 unsigned int v4; // eax@5 | |
8829 unsigned __int16 v5; // cx@5 | |
8830 int v6; // esi@5 | |
8831 unsigned int v7; // eax@7 | |
8832 int v8; // eax@10 | |
8833 SpriteFrame *v9; // eax@16 | |
8834 SpriteFrame *v10; // ebx@18 | |
8835 //int *v11; // eax@18 | |
8836 int v12; // ecx@28 | |
8837 //IndoorCameraD3D **v14; // eax@36 | |
8838 double v15; // st7@36 | |
8839 float v16; // eax@36 | |
8840 //double v17; // ST30_8@36 | |
8841 signed __int64 v18; // qtt@36 | |
8842 int v19; // ST5C_4@36 | |
8843 signed __int64 v20; // qtt@37 | |
8844 int v21; // ST5C_4@37 | |
8845 signed __int16 v22; // cx@39 | |
8846 int v23; // ST50_4@40 | |
8847 signed int v24; // ecx@40 | |
8848 int v25; // edx@44 | |
8849 __int16 v26; // ax@44 | |
8850 //MonsterDesc *v27; // edx@44 | |
8851 //int v28; // ecx@44 | |
8852 unsigned __int8 v29; // zf@44 | |
8853 unsigned __int8 v30; // sf@44 | |
8854 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8855 int v32; // [sp+1Ch] [bp-38h]@5 | |
8856 int a3; // [sp+20h] [bp-34h]@5 | |
8857 int a2; // [sp+24h] [bp-30h]@5 | |
8858 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8859 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8860 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8861 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8862 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8863 int a6; // [sp+40h] [bp-14h]@34 | |
8864 int v43; // [sp+44h] [bp-10h]@34 | |
8865 int z; // [sp+48h] [bp-Ch]@32 | |
8866 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8867 int x; // [sp+50h] [bp-4h]@32 | |
8868 | |
8869 for (uint i = 0; i < uNumActors; ++i) | |
8870 { | |
8871 auto p = pActors + i; | |
8872 | |
8873 if (p->uAIState == Removed || | |
8874 p->uAIState == Disabled) | |
8875 continue; | |
8876 | |
8877 a5 = p->uSectorID; | |
8878 a2 = p->vPosition.y; | |
8879 a1a = p->vPosition.x; | |
8880 a3 = p->vPosition.z; | |
8881 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8882 LOWORD(v0) = p->uYawAngle; | |
8883 v5 = p->uCurrentActionAnimation; | |
8884 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8885 v32 = v6; | |
8886 if ( pParty->bTurnBasedModeOn ) | |
8887 { | |
8888 if ( v5 == 1 ) | |
8889 { | |
8890 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8891 goto LABEL_10; | |
8892 } | |
8893 } | |
8894 else | |
8895 { | |
8896 if ( v5 == 1 ) | |
8897 { | |
8898 v7 = pBLVRenderParams->field_0_timer_; | |
8899 LABEL_10: | |
8900 v8 = i * 32 + v7; | |
8901 goto LABEL_12; | |
8902 } | |
8903 } | |
8904 v8 = p->uCurrentActionTime; | |
8905 LABEL_12: | |
8906 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8907 v8 = 0; | |
8908 v31 = p->pSpriteIDs[v5]; | |
8909 if (p->uAIState == Resurrected) | |
8910 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8911 else | |
8912 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8913 v41 = 0; | |
8914 v10 = v9; | |
8915 //v11 = (int *)v9->uFlags; | |
8916 if (v9->uFlags & 2) | |
8917 v41 = 2; | |
8918 if (v9->uFlags & 0x40000) | |
8919 v41 |= 0x40u; | |
8920 if (v9->uFlags & 0x20000) | |
8921 LOBYTE(v41) = v41 | 0x80; | |
8922 v0 = (RenderBillboard *)(256 << v6); | |
8923 if ( (unsigned int)v0 & v9->uFlags) | |
8924 v41 |= 4u; | |
8925 if ( v10->uGlowRadius ) | |
8926 { | |
8927 //LOBYTE(v11) = byte_4E94D3; | |
8928 pMobileLightsStack->AddLight( | |
8929 a1a, | |
8930 a2, | |
8931 a3, | |
8932 a5, | |
8933 v10->uGlowRadius, | |
8934 0xFFu, | |
8935 0xFFu, | |
8936 0xFFu, | |
8937 byte_4E94D3); | |
8938 } | |
8939 v12 = 0; | |
8940 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8941 continue; | |
8942 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8943 { | |
8944 ++v12; | |
8945 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8946 goto _continue; | |
8947 } | |
8948 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8949 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8950 continue; | |
8951 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8952 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8953 if (uNumBillboardsToDraw >= 500) | |
8954 break; | |
8955 ++uNumBillboardsToDraw; | |
8956 ++uNumSpritesDrawnThisFrame; | |
8957 p->uAttributes |= 8u; | |
8958 v29 = pRenderer->pRenderD3D == 0; | |
8959 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8960 v0->uPalette = v10->uPaletteIndex; | |
8961 v0->uIndoorSectorID = a5; | |
8962 if ( v29 ) | |
8963 { | |
8964 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8965 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8966 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8967 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8968 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8969 } | |
8970 else | |
8971 { | |
8972 //v14 = &pGame->pIndoorCameraD3D; | |
8973 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8974 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8975 v16 = v0->fov_x; | |
8976 v0->fov_y = v15; | |
8977 //v17 = v16 + 6.7553994e15; | |
8978 LODWORD(v18) = 0; | |
8979 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8980 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8981 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8982 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8983 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8984 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8985 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8986 { | |
8987 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8988 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8989 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8990 goto LABEL_43; |
8991 } | |
8992 } | |
8993 else | |
8994 { | |
8995 v22 = p->pActorBuffs[3].uPower; | |
8996 if ( v22 ) | |
8997 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8998 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8999 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9000 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9001 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 9002 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
9003 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 9004 goto LABEL_44; |
9005 } | |
9006 } | |
9007 LABEL_44: | |
9008 HIWORD(v25) = HIWORD(x); | |
430 | 9009 v0->world_x = a1a; |
9010 v0->world_y = a2; | |
9011 v0->world_z = a3; | |
0 | 9012 v0->uScreenSpaceX = v43; |
9013 v0->uScreenSpaceY = a6; | |
9014 LOWORD(v25) = 0; | |
9015 LOBYTE(v26) = v41; | |
194 | 9016 |
862 | 9017 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 9018 v0->actual_z = HIWORD(x); |
862 | 9019 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 9020 |
0 | 9021 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
9022 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
9023 v0->field_1E = v41; | |
9024 v0->pSpriteFrame = v10; | |
9025 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
9026 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
9027 { | |
9028 HIBYTE(v26) = HIBYTE(v41) | 1; | |
9029 v0->field_1E = v26; | |
9030 } | |
9031 | |
9032 _continue: | |
9033 ; | |
9034 } | |
9035 } | |
9036 | |
9037 //----- (00444732) -------------------------------------------------------- | |
428 | 9038 char *GetEventHintString(unsigned int uEventID) |
9039 { | |
9040 signed int event_index; // edx@1 | |
9041 int event_pos; // esi@4 | |
0 | 9042 char *result; // eax@6 |
428 | 9043 unsigned int str_index; // eax@9 |
9044 int i; // esi@11 | |
9045 _evt_raw* test_evt; | |
9046 _evt_raw* last_evt; | |
9047 | |
9048 event_index = 0; | |
9049 if ( uLevelEVT_NumEvents <= 0 ) | |
9050 return NULL; | |
9051 | |
9052 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 9053 while ( 1 ) |
9054 { | |
428 | 9055 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
9056 { | |
9057 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
9058 last_evt=test_evt; | |
9059 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
9060 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 9061 break; |
9062 } | |
428 | 9063 ++event_index; |
9064 if ( event_index >= uLevelEVT_NumEvents ) | |
9065 return NULL; | |
9066 } | |
9067 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9068 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
9069 { | |
9070 str_index = EVT_DWORD(test_evt->v5); | |
9071 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 9072 } |
9073 else | |
9074 { | |
428 | 9075 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
9076 { | |
9077 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
9078 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
9079 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
9080 { | |
9081 str_index = EVT_DWORD(test_evt->v5); | |
9082 if ( str_index < 600 ) | |
9083 return (char *)p2DEvents[str_index - 1].pName; | |
9084 } | |
9085 } | |
9086 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
9087 } | |
9088 | |
0 | 9089 return result; |
9090 } | |
9091 | |
9092 //----- (00444839) -------------------------------------------------------- | |
9093 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) | |
9094 { | |
9095 unsigned int v9; // ebx@1 | |
9096 int v10; // edi@1 | |
373 | 9097 //signed int v11; // eax@1 |
0 | 9098 unsigned int v12; // eax@6 |
9099 const char *v13; // ST0C_4@6 | |
9100 unsigned int v14; // eax@8 | |
9101 const char *v15; // eax@14 | |
9102 unsigned int v16; // eax@16 | |
9103 unsigned int result; // eax@26 | |
9104 const char *v18; // [sp-8h] [bp-40h]@9 | |
373 | 9105 //const char *v19; // [sp-4h] [bp-3Ch]@2 |
0 | 9106 char *v20; // [sp-4h] [bp-3Ch]@9 |
9107 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
9108 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
9109 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
9110 | |
9111 v9 = a1; | |
9112 v10 = a2; | |
9113 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
9114 dword_59117C_teleportx = x; | |
9115 dword_591178_teleporty = y; | |
9116 dword_591174_teleportz = z; | |
9117 dword_591170_teleport_directiony = directiony; | |
9118 dword_59116C_teleport_directionx = directionx; | |
9119 dword_591168_teleport_speedz = a8; | |
9120 dword_591164_teleport_map_name = (char *)pLocationName; | |
9121 uCurrentHouse_Animation = v9; | |
9122 pEventTimer->Pause(); | |
9123 pAudioPlayer->StopChannels(-1, -1); | |
373 | 9124 |
9125 switch (pParty->alignment) | |
9126 { | |
9127 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
9128 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
9129 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
9130 default: assert(false); | |
9131 } | |
9132 /*v11 = const_2(); | |
0 | 9133 sprintf(pContainer, "evt%02d", v11); |
9134 if ( pParty->uAlignment ) | |
9135 { | |
9136 if ( pParty->uAlignment != 2 ) | |
9137 goto LABEL_6; | |
9138 v19 = "-c"; | |
9139 } | |
9140 else | |
9141 { | |
9142 v19 = "-b"; | |
9143 } | |
373 | 9144 strcat(pContainer, v19);*/ |
9145 | |
9146 //LABEL_6: | |
0 | 9147 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
9148 v13 = pHouse_ExitPictures[v10]; | |
9149 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
948 | 9150 pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); |
0 | 9151 if ( v9 ) |
9152 { | |
9153 if ( !v23 ) | |
898 | 9154 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); |
9155 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); | |
0 | 9156 } |
9157 else | |
9158 { | |
9159 if ( !v23 ) | |
9160 { | |
9161 v14 = pMapStats->GetMapInfo(pCurrentMapName); | |
9162 if ( v14 ) | |
9163 { | |
721 | 9164 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); |
0 | 9165 goto LABEL_20; |
9166 } | |
9167 v21 = pGlobalTXT_LocalizationStrings[79]; | |
9168 goto LABEL_19; | |
9169 } | |
9170 } | |
9171 v15 = pLocationName; | |
9172 if ( *pLocationName == 48 ) | |
9173 v15 = pCurrentMapName; | |
9174 v16 = pMapStats->GetMapInfo(v15); | |
9175 if ( v16 ) | |
9176 { | |
721 | 9177 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); |
9178 goto LABEL_20; | |
0 | 9179 } |
9180 v21 = pGlobalTXT_LocalizationStrings[73]; | |
9181 LABEL_19: | |
423 | 9182 strcpy(sHouseName, v21); |
0 | 9183 LABEL_20: |
710 | 9184 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName); |
0 | 9185 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) |
495 | 9186 if ( pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].uRoomSoundId ) |
735 | 9187 PlayHouseSound(v9, HouseSound_Greeting); |
0 | 9188 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
187 | 9189 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); |
0 | 9190 result = v23; |
9191 if ( v23 ) | |
9192 uCurrentHouse_Animation = v23; | |
9193 return result; | |
9194 } |