Mercurial > mm7
annotate mm7_4.cpp @ 1226:33b30398e286
m
author | Ritor1 |
---|---|
date | Fri, 07 Jun 2013 22:24:11 +0600 |
parents | 15ad868d972f |
children | ac1b79c498a8 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1110
diff
changeset
|
4 |
198 | 5 #include <assert.h> |
0 | 6 |
1016 | 7 #include "VideoPlayer.h" |
8 #include "Sprites.h" | |
9 #include "BSPModel.h" | |
10 #include "OutdoorCamera.h" | |
11 #include "Mouse.h" | |
12 #include "stru6.h" | |
13 #include "stru11.h" | |
14 #include "stru12.h" | |
15 | |
16 #include "LightmapBuilder.h" | |
341 | 17 #include "MM7.h" |
0 | 18 #include "MapInfo.h" |
19 #include "Game.h" | |
20 #include "GUIWindow.h" | |
21 #include "GUIFont.h" | |
22 #include "Party.h" | |
23 #include "AudioPlayer.h" | |
24 #include "Outdoor.h" | |
25 #include "IndoorCamera.h" | |
26 #include "LOD.h" | |
27 #include "Actor.h" | |
28 #include "Allocator.h" | |
29 #include "Events.h" | |
30 #include "Viewport.h" | |
31 #include "FrameTableInc.h" | |
32 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
33 #include "SpriteObject.h" |
0 | 34 #include "ObjectList.h" |
35 #include "DecorationList.h" | |
36 #include "Time.h" | |
37 #include "IconFrameTable.h" | |
38 #include "PlayerFrameTable.h" | |
39 #include "Awards.h" | |
40 #include "TurnEngine.h" | |
41 #include "Events2D.h" | |
42 #include "stru159.h" | |
189 | 43 #include "texts.h" |
0 | 44 #include "Log.h" |
629 | 45 #include "UIHouses.h" |
0 | 46 #include "mm7_data.h" |
47 | |
48 //----- (0046CC4B) -------------------------------------------------------- | |
783 | 49 void __cdecl check_event_triggers() |
0 | 50 { |
51 int v0; // eax@1 | |
52 LevelDecoration *v1; // esi@2 | |
53 signed int v2; // edi@2 | |
54 int v3; // ebx@2 | |
55 int v4; // eax@3 | |
56 int v5; // ebx@3 | |
57 unsigned int v6; // ecx@3 | |
58 unsigned int v7; // edx@6 | |
59 unsigned int v8; // edx@8 | |
112 | 60 Actor *v9; // edi@13 |
0 | 61 int v10; // ebx@14 |
62 int v11; // eax@14 | |
63 int v12; // ebx@14 | |
64 unsigned int v13; // ecx@14 | |
65 int v14; // edx@15 | |
66 unsigned int v15; // edx@17 | |
67 unsigned int v16; // edx@19 | |
68 char *v17; // edi@25 | |
69 int v18; // ebx@26 | |
70 int v19; // eax@26 | |
71 int v20; // ebx@26 | |
72 unsigned int v21; // ecx@26 | |
73 int v22; // edx@27 | |
74 unsigned int v23; // edx@29 | |
75 unsigned int v24; // edx@31 | |
76 int v25; // [sp+0h] [bp-24h]@3 | |
77 int v26; // [sp+0h] [bp-24h]@14 | |
78 int v27; // [sp+0h] [bp-24h]@26 | |
79 int v28; // [sp+4h] [bp-20h]@3 | |
80 int v29; // [sp+4h] [bp-20h]@14 | |
81 int v30; // [sp+4h] [bp-20h]@26 | |
82 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
83 int v32; // [sp+Ch] [bp-18h]@2 | |
84 int v33; // [sp+10h] [bp-14h]@2 | |
85 int i; // [sp+14h] [bp-10h]@1 | |
86 int v35; // [sp+18h] [bp-Ch]@2 | |
87 int v36; // [sp+1Ch] [bp-8h]@3 | |
88 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
89 signed int v38; // [sp+20h] [bp-4h]@24 | |
90 | |
91 v0 = 0; | |
92 for ( i = 0; i < _6836C8_num_decorations_6807E8; ++i ) | |
93 { | |
94 v1 = &pLevelDecorations[_6807E8_level_decorations_ids[v0]]; | |
95 v2 = v1->field_18; | |
96 v3 = v1->vPosition.y; | |
97 v33 = v1->vPosition.x; | |
98 v32 = v1->vPosition.y; | |
99 v35 = v1->vPosition.z; | |
100 v31 = v1->field_18; | |
101 if ( v1->field_2 & 1 ) | |
102 { | |
103 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
104 v25 = abs(v3 - pParty->vPosition.y); | |
105 v28 = abs(v35 - pParty->vPosition.z); | |
106 v4 = v36; | |
107 v5 = v25; | |
108 v6 = v28; | |
109 if ( v36 < v25 ) | |
110 { | |
111 v4 = v25; | |
112 v5 = v36; | |
113 } | |
114 if ( v4 < v28 ) | |
115 { | |
116 v7 = v4; | |
117 v4 = v28; | |
118 v6 = v7; | |
119 } | |
120 if ( v5 < (signed int)v6 ) | |
121 { | |
122 v8 = v6; | |
123 v6 = v5; | |
124 v5 = v8; | |
125 } | |
126 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
862 | 127 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
0 | 128 } |
129 if ( v1->field_2 & 2 ) | |
130 { | |
131 v37 = 0; | |
132 if ( (signed int)uNumActors > 0 ) | |
133 { | |
112 | 134 v9 = pActors;//[0].vPosition.y; |
0 | 135 do |
136 { | |
112 | 137 v10 = abs(v33 - v9->vPosition.x); |
138 v29 = abs(v32 - v9->vPosition.y); | |
139 v26 = abs(v35 - v9->vPosition.z); | |
0 | 140 v11 = v10; |
141 v12 = v29; | |
142 v13 = v26; | |
143 if ( v11 < v29 ) | |
144 { | |
145 v14 = v11; | |
146 v11 = v29; | |
147 v12 = v14; | |
148 } | |
149 if ( v11 < v26 ) | |
150 { | |
151 v15 = v11; | |
152 v11 = v26; | |
153 v13 = v15; | |
154 } | |
155 if ( v12 < (signed int)v13 ) | |
156 { | |
157 v16 = v13; | |
158 v13 = v12; | |
159 v12 = v16; | |
160 } | |
161 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
162 EventProcessor(v1->field_16_event_id, 0, 1); | |
163 ++v37; | |
112 | 164 ++v9; |
0 | 165 } |
166 while ( v37 < (signed int)uNumActors ); | |
167 } | |
168 } | |
169 if ( v1->field_2 & 4 ) | |
170 { | |
171 v38 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
172 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
173 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
174 v17 = (char *)&pSpriteObjects[0].vPosition.y; |
0 | 175 do |
176 { | |
177 v18 = abs(v33 - *((int *)v17 - 1)); | |
178 v30 = abs(v32 - *(int *)v17); | |
179 v27 = abs(v35 - *((int *)v17 + 1)); | |
180 v19 = v18; | |
181 v20 = v30; | |
182 v21 = v27; | |
183 if ( v19 < v30 ) | |
184 { | |
185 v22 = v19; | |
186 v19 = v30; | |
187 v20 = v22; | |
188 } | |
189 if ( v19 < v27 ) | |
190 { | |
191 v23 = v19; | |
192 v19 = v27; | |
193 v21 = v23; | |
194 } | |
195 if ( v20 < (signed int)v21 ) | |
196 { | |
197 v24 = v21; | |
198 v21 = v20; | |
199 v20 = v24; | |
200 } | |
201 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
202 EventProcessor(v1->field_16_event_id, 0, 1); | |
203 ++v38; | |
204 v17 += 112; | |
205 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
206 while ( v38 < (signed int)uNumSpriteObjects ); |
0 | 207 } |
208 } | |
209 v0 = i + 1; | |
210 } | |
211 } | |
212 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | |
213 | |
214 //----- (0046CEC3) -------------------------------------------------------- | |
723 | 215 int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) |
0 | 216 { |
217 int v13; // ecx@13 | |
218 signed int v14; // ebx@14 | |
219 int v15; // eax@16 | |
729 | 220 //int v16; // edx@19 |
792 | 221 //int v17; // ST18_4@19 |
222 //signed int v18; // edx@19 | |
223 //signed __int64 v19; // qtt@19 | |
0 | 224 int v21; // eax@27 |
792 | 225 //int v22; // ecx@29 |
0 | 226 signed int v28; // eax@45 |
227 int v29; // ebx@47 | |
228 int v30; // edx@49 | |
830 | 229 //int v31; // ST10_4@49 |
230 //signed int v32; // edx@49 | |
0 | 231 signed __int64 v33; // qtt@49 |
830 | 232 //signed int v34; // eax@54 |
233 //signed int v35; // esi@56 | |
234 //int result; // eax@57 | |
0 | 235 int v38; // edx@62 |
792 | 236 //int v44; // [sp+20h] [bp-20h]@10 |
0 | 237 bool v47; // [sp+24h] [bp-1Ch]@43 |
238 bool v48; // [sp+28h] [bp-18h]@10 | |
239 bool v49; // [sp+28h] [bp-18h]@41 | |
240 bool v50; // [sp+2Ch] [bp-14h]@12 | |
241 signed int v53; // [sp+30h] [bp-10h]@10 | |
242 signed int v54; // [sp+30h] [bp-10h]@41 | |
243 signed int v55; // [sp+34h] [bp-Ch]@1 | |
244 | |
730 | 245 //LOG_DECOMPILATION_WARNING(); |
246 | |
247 static int blv_floor_id[50]; // 00721200 | |
248 static int blv_floor_level[50]; // 007212C8 | |
249 | |
250 static __int16 word_721390_ys[104]; // idb | |
251 static __int16 word_721460_xs[104]; // idb | |
0 | 252 |
253 auto pSector = &pIndoor->pSectors[uSectorID]; | |
792 | 254 v55 = 0; |
0 | 255 for (uint i = 0; i < pSector->uNumFloors; ++i) |
256 { | |
257 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; | |
258 if (pFloor->Clickable()) | |
259 continue; | |
260 | |
792 | 261 assert(pFloor->uNumVertices); |
0 | 262 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
263 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | |
264 { | |
265 for (uint j = 0; j < pFloor->uNumVertices; ++j) | |
266 { | |
730 | 267 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
268 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | |
269 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | |
270 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | |
0 | 271 } |
730 | 272 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; |
273 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | |
274 | |
792 | 275 v50 = word_721390_ys[0] >= y; |
0 | 276 v53 = 0; |
792 | 277 |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
792
diff
changeset
|
278 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
792 | 279 { |
280 if (v53 >= 2) | |
281 break; | |
282 | |
283 v48 = v50; | |
284 v50 = word_721390_ys[j + 1] >= y; | |
730 | 285 |
286 v13 = i; | |
792 | 287 if (v48 == v50) |
288 continue; | |
289 | |
290 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | |
1110 | 291 v15 = v14 | (word_721460_xs[j] < x); |
792 | 292 |
293 if (v15 == 3) | |
294 continue; | |
295 else if (!v15) | |
296 ++v53; | |
297 else | |
0 | 298 { |
792 | 299 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 300 auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); |
792 | 301 |
302 if (res + word_721460_xs[j] >= x) | |
729 | 303 ++v53; |
0 | 304 } |
792 | 305 } |
306 | |
307 | |
0 | 308 if ( v53 == 1 ) |
309 { | |
310 if ( v55 >= 50 ) | |
311 break; | |
723 | 312 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
0 | 313 { |
725 | 314 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; |
0 | 315 } |
316 else | |
317 { | |
871 | 318 v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); |
0 | 319 } |
792 | 320 blv_floor_level[v55] = v21; |
321 blv_floor_id[v55] = pSector->pFloors[i]; | |
322 v55++; | |
0 | 323 } |
792 | 324 } |
325 } | |
326 | |
327 | |
0 | 328 if ( pSector->field_0 & 8 ) |
329 { | |
330 for (uint i = 0; i < pSector->uNumPortals; ++i) | |
331 { | |
332 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | |
333 if (portal->uPolygonType != POLYGON_Floor) | |
334 continue; | |
335 | |
830 | 336 if (!portal->uNumVertices) |
337 continue; | |
338 | |
723 | 339 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
340 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | |
341 { | |
0 | 342 for (uint j = 0; j < portal->uNumVertices; ++j) |
343 { | |
730 | 344 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
345 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | |
346 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | |
347 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | |
348 } | |
349 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | |
350 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | |
0 | 351 v54 = 0; |
830 | 352 v47 = word_721390_ys[0] >= y; |
353 | |
354 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | |
0 | 355 { |
830 | 356 v49 = v47; |
0 | 357 if ( v54 >= 2 ) |
358 break; | |
830 | 359 v47 = word_721390_ys[j + 1] >= y; |
0 | 360 if ( v49 != v47 ) |
361 { | |
830 | 362 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
363 v29 = v28 | (word_721460_xs[j] < x); | |
0 | 364 if ( v29 != 3 ) |
365 { | |
723 | 366 if ( !v29 ) |
729 | 367 ++v54; |
368 else | |
369 { | |
830 | 370 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
871 | 371 auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
830 | 372 if (res + word_721460_xs[j] >= x) |
723 | 373 ++v54; |
729 | 374 } |
0 | 375 } |
376 } | |
377 } | |
378 if ( v54 == 1 ) | |
379 { | |
380 if ( v55 >= 50 ) | |
381 break; | |
830 | 382 blv_floor_level[v55] = -29000; |
383 blv_floor_id[v55] = pSector->pPortals[i]; | |
384 v55++; | |
0 | 385 } |
386 } | |
387 } | |
388 } | |
389 if ( v55 == 1 ) | |
390 { | |
730 | 391 *pFaceID = blv_floor_id[0]; |
725 | 392 return blv_floor_level[0]; |
0 | 393 } |
394 if ( !v55 ) | |
395 return -30000; | |
730 | 396 *pFaceID = blv_floor_id[0]; |
725 | 397 //result = blv_floor_level[0]; |
830 | 398 |
399 /*for ( v35 = 1; v35 < v55; ++v35 ) | |
0 | 400 { |
725 | 401 if ( blv_floor_level[0] <= z + 5 ) |
402 { | |
403 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | |
717 | 404 continue; |
725 | 405 blv_floor_level[0] = blv_floor_level[v35]; |
730 | 406 *pFaceID = blv_floor_id[v35]; |
717 | 407 continue; |
408 } | |
725 | 409 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
410 { | |
411 blv_floor_level[0] = blv_floor_level[v35]; | |
730 | 412 *pFaceID = blv_floor_id[v35]; |
717 | 413 } |
830 | 414 }*/ |
415 | |
416 | |
417 int result = blv_floor_level[0]; | |
418 for (uint i = 1; i < v55; ++i) | |
419 { | |
420 v38 = blv_floor_level[i]; | |
421 if ( result <= z + 5 ) | |
422 { | |
423 if ( v38 > result && v38 <= z + 5 ) | |
424 { | |
425 result = blv_floor_level[i]; | |
426 *pFaceID = blv_floor_id[i]; | |
427 } | |
428 } | |
429 else if ( v38 < result ) | |
430 { | |
431 result = blv_floor_level[i]; | |
432 *pFaceID = blv_floor_id[i]; | |
433 } | |
434 } | |
435 | |
436 return result; | |
0 | 437 } |
438 | |
439 //----- (0046D49E) -------------------------------------------------------- | |
791 | 440 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
0 | 441 { |
723 | 442 BSPModel *pBModel; // esi@4 |
443 ODMFace *pFace; // ecx@11 | |
0 | 444 int v14; // edx@20 |
445 signed int v18; // edx@26 | |
446 int v19; // eax@28 | |
447 int v20; // edx@30 | |
448 int v21; // ST1C_4@30 | |
449 signed int v22; // edx@30 | |
450 signed __int64 v23; // qtt@30 | |
451 int v24; // eax@36 | |
452 signed int v25; // ecx@38 | |
453 int result; // eax@42 | |
454 signed int v27; // ecx@43 | |
455 int v28; // edi@44 | |
456 signed int v29; // edx@44 | |
457 int v30; // esi@45 | |
458 int v31; // eax@45 | |
459 ODMFace *v32; // eax@57 | |
460 int v33; // ecx@59 | |
461 int v36; // [sp+14h] [bp-2Ch]@24 | |
462 int v38; // [sp+1Ch] [bp-24h]@2 | |
463 int v39; // [sp+20h] [bp-20h]@9 | |
723 | 464 signed int pBModelNum; // [sp+28h] [bp-18h]@1 |
465 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
0 | 466 bool v43; // [sp+30h] [bp-10h]@22 |
467 bool v44; // [sp+34h] [bp-Ch]@24 | |
468 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
469 signed int v48; // [sp+58h] [bp+18h]@22 | |
470 signed int v49; // [sp+58h] [bp+18h]@43 | |
471 | |
472 v46 = 1; | |
473 dword_721160[0] = -1; | |
474 dword_721110[0] = -1; | |
791 | 475 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
0 | 476 if ( (signed int)pOutdoor->uNumBModels <= 0 ) |
723 | 477 { |
478 *a6 = 0; | |
725 | 479 return odm_floor_level[0]; |
723 | 480 } |
0 | 481 v38 = 0; |
723 | 482 for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) |
483 { | |
484 pBModel = &pOutdoor->pBModels[v38]; | |
485 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
486 { | |
487 if ( (signed int)pBModel->uNumFaces > 0 ) | |
488 { | |
489 v39 = 0; | |
490 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
491 { | |
492 pFace = &pBModel->pFaces[v39]; | |
493 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
494 && !(pFace->uAttributes & 0x20000000) | |
495 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
496 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
0 | 497 { |
723 | 498 if ( pFace->uNumVertices ) |
0 | 499 { |
723 | 500 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
0 | 501 { |
723 | 502 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; |
503 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
504 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
505 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
506 } | |
507 } | |
508 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
509 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
510 v43 = word_720F70[0] >= Y; | |
511 v48 = 0; | |
512 if ( 2 * pFace->uNumVertices > 0 ) | |
513 { | |
514 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
515 { | |
516 if ( v48 >= 2 ) | |
517 break; | |
518 v36 = word_720F70[i + 1]; | |
519 v44 = word_720F70[i + 1] >= Y; | |
520 if ( v43 != v44 ) | |
0 | 521 { |
723 | 522 v18 = word_721040[i + 1] >= X ? 0 : 2; |
1110 | 523 v19 = v18 | (word_721040[i] < X); |
723 | 524 if ( v19 != 3 ) |
0 | 525 { |
723 | 526 if ( !v19 ) |
740 | 527 ++v48; |
528 else | |
0 | 529 { |
723 | 530 LODWORD(v23) = (Y - word_720F70[i]) << 16; |
531 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
532 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
533 if ( v22 >= X) | |
534 ++v48; | |
0 | 535 } |
536 } | |
537 } | |
723 | 538 v43 = v44; |
539 } | |
540 if ( v48 == 1 ) | |
541 { | |
542 if ( v46 >= 20 ) | |
0 | 543 break; |
723 | 544 if ( pFace->uPolygonType == POLYGON_Floor ) |
545 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
546 else | |
725 | 547 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) |
548 + HIWORD(pFace->zCalc3); | |
723 | 549 v25 = v46++; |
725 | 550 odm_floor_level[v25] = v24; |
723 | 551 dword_721160[v25] = pBModelNum; |
552 dword_721110[v25] = pFaceNum; | |
0 | 553 } |
554 } | |
555 } | |
723 | 556 ++v39; |
557 } | |
558 } | |
559 } | |
0 | 560 ++v38; |
561 } | |
562 if ( v46 == 1 ) | |
563 { | |
564 *a6 = 0; | |
725 | 565 return odm_floor_level[0]; |
0 | 566 } |
567 v27 = 0; | |
568 if ( v46 <= 1 ) | |
569 *a6 = 0; | |
723 | 570 else |
571 { | |
725 | 572 //v29 = 1; |
723 | 573 for ( v49 = 1; v49 < v46; ++v49 ) |
574 { | |
725 | 575 if ( odm_floor_level[v49] == odm_floor_level[0] ) |
723 | 576 { |
577 v27 = v49; | |
725 | 578 //++v29; |
723 | 579 break; |
580 } | |
725 | 581 if ( odm_floor_level[0] > Z + 5 ) |
582 { | |
583 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
584 { | |
585 //++v29; | |
723 | 586 break; |
587 } | |
588 v27 = v49; | |
725 | 589 //++v29; |
723 | 590 break; |
591 } | |
725 | 592 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) |
723 | 593 { |
594 v27 = v49; | |
725 | 595 //++v29; |
723 | 596 } |
597 } | |
598 if ( !v27 ) | |
599 *a6 = 0; | |
600 else | |
601 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
602 } | |
0 | 603 if ( v27 ) |
604 { | |
605 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
791 | 606 *pIsOnWater = false; |
607 if ( v32->Fluid()) | |
608 *pIsOnWater = true; | |
0 | 609 } |
725 | 610 if ( odm_floor_level[v27] >= odm_floor_level[0] ) |
611 odm_floor_level[0] = odm_floor_level[v27]; | |
612 return odm_floor_level[0]; | |
0 | 613 } |
614 | |
615 //----- (0046D8E3) -------------------------------------------------------- | |
616 int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4) | |
617 { | |
618 int v4; // ebx@1 | |
619 unsigned int v5; // ecx@1 | |
620 BSPModel *v6; // edi@3 | |
621 ODMFace *v7; // esi@10 | |
622 unsigned __int8 v8; // al@10 | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
659
diff
changeset
|
623 signed __int16 *v9; // eax@18 |
0 | 624 int v10; // edx@19 |
625 int v11; // ecx@21 | |
626 int v12; // ecx@23 | |
627 signed int v13; // eax@25 | |
628 int v14; // edx@27 | |
629 int v15; // edx@29 | |
630 int v16; // ST18_4@29 | |
631 signed int v17; // edx@29 | |
632 signed __int64 v18; // qtt@29 | |
633 int v19; // eax@35 | |
634 signed int v20; // ecx@37 | |
635 signed int v22; // ebx@42 | |
636 unsigned int v23; // esi@43 | |
637 int v24; // edx@44 | |
638 int v25; // eax@44 | |
639 int v26; // [sp+Ch] [bp-38h]@7 | |
640 int v27; // [sp+10h] [bp-34h]@21 | |
641 int v28; // [sp+18h] [bp-2Ch]@21 | |
642 int v29; // [sp+1Ch] [bp-28h]@2 | |
643 unsigned int v30; // [sp+20h] [bp-24h]@8 | |
644 signed int v31; // [sp+24h] [bp-20h]@1 | |
645 signed int v32; // [sp+28h] [bp-1Ch]@1 | |
646 int v33; // [sp+2Ch] [bp-18h]@7 | |
647 bool v34; // [sp+30h] [bp-14h]@21 | |
648 bool v35; // [sp+34h] [bp-10h]@23 | |
649 signed int v36; // [sp+38h] [bp-Ch]@17 | |
650 signed int v37; // [sp+38h] [bp-Ch]@21 | |
651 signed int v38; // [sp+38h] [bp-Ch]@42 | |
652 signed int v39; // [sp+3Ch] [bp-8h]@1 | |
653 signed int v40; // [sp+40h] [bp-4h]@1 | |
654 | |
655 dword_720ED0[0] = -1; | |
656 dword_720E80[0] = -1; | |
657 v4 = a1; | |
658 v5 = 0; | |
659 v40 = a2; | |
660 v31 = v4; | |
661 v39 = 1; | |
662 dword_720F20[0] = 10000; | |
663 v32 = 0; | |
664 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
665 { | |
666 v29 = 0; | |
667 do | |
668 { | |
669 v6 = &pOutdoor->pBModels[v29]; | |
670 if ( v4 <= pOutdoor->pBModels[v29].sMaxX ) | |
671 { | |
672 if ( v4 >= v6->sMinX ) | |
673 { | |
674 if ( v40 <= v6->sMaxY ) | |
675 { | |
676 if ( v40 >= v6->sMinY ) | |
677 { | |
678 v33 = v5; | |
679 v26 = v6->uNumFaces; | |
680 if ( (signed int)v6->uNumFaces > (signed int)v5 ) | |
681 { | |
682 v30 = v5; | |
683 while ( 1 ) | |
684 { | |
685 v7 = (ODMFace *)((char *)v6->pFaces + v30); | |
686 v8 = v7->uPolygonType; | |
687 if ( (v8 == 5 || v8 == 6) | |
688 && !(BYTE3(v7->uAttributes) & 0x20) | |
689 && v4 <= v7->pBoundingBox.x2 | |
690 && v4 >= v7->pBoundingBox.x1 | |
691 && v40 <= v7->pBoundingBox.y2 | |
692 && v40 >= v7->pBoundingBox.y1 ) | |
693 { | |
694 v36 = v5; | |
695 if ( v7->uNumVertices ) | |
696 { | |
697 v9 = v7->pXInterceptDisplacements; | |
698 do | |
699 { | |
700 v10 = 2 * v36; | |
701 word_720DB0_xs[2 * v36] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].x); | |
702 word_720CE0_ys[2 * v36] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 60)].y); | |
703 word_720DB0_xs[2 * v36++ + 1] = *v9 + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].x); | |
704 word_720CE0_ys[v10 + 1] = v9[20] + LOWORD(v6->pVertices.pVertices[*(v9 - 59)].y); | |
705 ++v9; | |
706 } | |
707 while ( v36 < v7->uNumVertices ); | |
708 v4 = v31; | |
709 } | |
710 v27 = 2 * v7->uNumVertices; | |
711 word_720DB0_xs[2 * v7->uNumVertices] = word_720DB0_xs[0]; | |
712 word_720CE0_ys[v27] = word_720CE0_ys[0]; | |
713 v11 = 0; | |
714 v34 = word_720CE0_ys[0] >= v40; | |
715 v37 = 0; | |
716 v28 = 0; | |
717 if ( v27 > 0 ) | |
718 { | |
719 do | |
720 { | |
721 if ( v37 >= 2 ) | |
722 break; | |
723 v12 = v11; | |
724 v4 = v31; | |
725 v35 = word_720CE0_ys[v12 + 1] >= v40; | |
726 if ( v34 != v35 ) | |
727 { | |
728 v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2; | |
1110 | 729 v14 = v13 | (word_720DB0_xs[v12] < v31); |
0 | 730 if ( v14 != 3 ) |
731 { | |
732 if ( !v14 | |
733 || (v15 = word_720CE0_ys[v12], | |
734 v16 = word_720CE0_ys[v12 + 1] - v15, | |
735 v17 = v40 - v15, | |
736 LODWORD(v18) = v17 << 16, | |
737 HIDWORD(v18) = v17 >> 16, | |
738 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v12 + 1] | |
739 - (signed int)word_720DB0_xs[v12]) | |
740 * v18 | |
741 / v16) >> 16) | |
742 + word_720DB0_xs[v12]) >= v31) ) | |
743 ++v37; | |
744 } | |
745 } | |
746 v11 = v28 + 1; | |
747 v34 = v35; | |
748 ++v28; | |
749 } | |
750 while ( v28 < v27 ); | |
751 if ( v37 == 1 ) | |
752 { | |
753 if ( v39 >= 20 ) | |
754 break; | |
755 if ( v7->uPolygonType == 5 ) | |
756 v19 = v6->pVertices.pVertices[v7->pVertexIDs[0]].z; | |
757 else | |
758 v19 = ((unsigned __int64)(v7->zCalc1 * (signed __int64)v4) >> 16) | |
759 + ((unsigned __int64)(v7->zCalc2 * (signed __int64)v40) >> 16) | |
760 + HIWORD(v7->zCalc3); | |
761 v20 = v39++; | |
762 dword_720F20[v20] = v19; | |
763 dword_720ED0[v20] = v32; | |
764 dword_720E80[v20] = v33; | |
765 } | |
766 } | |
767 } | |
768 ++v33; | |
769 v30 += 308; | |
770 if ( v33 >= v26 ) | |
771 break; | |
772 v5 = 0; | |
773 } | |
774 } | |
775 } | |
776 } | |
777 } | |
778 } | |
779 ++v32; | |
780 ++v29; | |
781 v5 = 0; | |
782 } | |
783 while ( v32 < (signed int)pOutdoor->uNumBModels ); | |
784 if ( !v39 ) | |
785 { | |
786 *(int *)a4 = 0; | |
787 return dword_720F20[0]; | |
788 } | |
789 } | |
790 v22 = 0; | |
791 v38 = v5; | |
792 if ( v39 <= (signed int)v5 ) | |
793 goto LABEL_54; | |
794 v23 = 0; | |
795 do | |
796 { | |
797 v24 = dword_720F20[v5 / 4]; | |
798 v25 = *(int *)((char *)dword_720F20 + v23); | |
799 if ( v24 == v25 ) | |
800 goto LABEL_50; | |
801 if ( v25 > a3 + 15 ) | |
802 { | |
803 if ( v24 >= v25 ) | |
804 goto LABEL_51; | |
805 LABEL_50: | |
806 v22 = v38; | |
807 v23 = v5; | |
808 goto LABEL_51; | |
809 } | |
810 if ( v24 > v25 && v24 <= a3 + 15 ) | |
811 goto LABEL_50; | |
812 LABEL_51: | |
813 ++v38; | |
814 v5 += 4; | |
815 } | |
816 while ( v38 < v39 ); | |
817 if ( v22 ) | |
818 { | |
819 *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6); | |
820 return dword_720F20[v22]; | |
821 } | |
822 LABEL_54: | |
823 *(int *)a4 = 0; | |
824 return dword_720F20[v22]; | |
825 } | |
826 | |
138 | 827 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
828 // for a right-handed system, that would be an inverse normal | |
0 | 829 //----- (0046DCC8) -------------------------------------------------------- |
138 | 830 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) |
831 { | |
832 auto grid_x = WorldPosToGridCellX(pos_x); | |
833 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
834 | |
835 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
836 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
837 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
838 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
839 | |
840 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
841 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
842 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
843 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
844 | |
845 float side1_dx, side1_dy, side1_dz, | |
846 side2_dx, side2_dy, side2_dz; | |
847 | |
848 auto dx = abs(pos_x - grid_pos_x1), | |
849 dz = abs(grid_pos_z1 - pos_z); | |
850 if (dz >= dx) | |
851 { | |
852 side1_dy = (double)(x1z1_y - x1z2_y); | |
853 side2_dy = (double)(x2z2_y - x1z2_y); | |
854 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
855 side1_dx = (double)(grid_pos_x1 - grid_pos_x1); | |
856 side2_dz = (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
857 side1_dz = (double)(grid_pos_z2 - grid_pos_z2); // z1 - z2 | |
434 | 858 Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
138 | 859 /* |\ |
860 side1 | \ | |
861 |____\ | |
862 side 2 */ | |
863 } | |
864 else | |
865 { | |
866 side1_dy = (double)(x2z2_y - x2z1_y); | |
867 side2_dy = (double)(x1z1_y - x2z1_y); | |
868 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
869 side1_dx = (double)(grid_pos_x2 - grid_pos_x2); | |
870 side2_dz = (double)(grid_pos_z1 - grid_pos_z1); | |
871 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
872 | |
873 /* side 2 | |
874 _____ | |
875 \ | | |
876 \ | side 1 | |
877 \| */ | |
878 } | |
879 | |
880 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
881 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
882 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
883 | |
884 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
885 if (fabsf(mag) < 1e-6f) | |
886 { | |
887 out->y = 0; | |
888 out->x = 0; | |
889 out->z = 65536; | |
890 } | |
891 else | |
892 { | |
893 float invmag = 1.0 / mag; | |
894 out->x = invmag * nx * 65536.0; | |
895 out->y = invmag * ny * 65536.0; | |
896 out->z = invmag * nz * 65536.0; | |
897 } | |
898 } | |
899 | |
0 | 900 //----- (0046DEF2) -------------------------------------------------------- |
901 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID) | |
902 { | |
903 unsigned int result; // eax@1 | |
904 | |
905 result = uLayingItemID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
906 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 ) |
0 | 907 result = _46BFFA_check_object_intercept(uLayingItemID, a2); |
908 return result; | |
909 } | |
910 | |
911 //----- (0046DF1A) -------------------------------------------------------- | |
912 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
913 { | |
914 Actor *v2; // edi@1 | |
915 unsigned __int16 v3; // ax@1 | |
916 int v4; // esi@6 | |
917 int v5; // ecx@8 | |
918 int v6; // eax@10 | |
919 int v7; // edx@12 | |
920 int v8; // ecx@14 | |
921 int v9; // eax@14 | |
922 int v10; // ebx@14 | |
923 int v11; // esi@14 | |
924 int v12; // ebx@15 | |
925 int v13; // ebx@17 | |
926 unsigned int v14; // eax@20 | |
927 signed int result; // eax@21 | |
928 int v16; // [sp+Ch] [bp-10h]@1 | |
929 int v17; // [sp+10h] [bp-Ch]@14 | |
930 int v18; // [sp+14h] [bp-8h]@14 | |
931 int v19; // [sp+18h] [bp-4h]@14 | |
932 | |
933 v16 = a1; | |
934 v2 = &pActors[a1]; | |
935 v3 = v2->uAIState; | |
936 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
937 goto LABEL_25; | |
938 v4 = v2->uActorRadius; | |
939 if ( a2 ) | |
940 v4 = a2; | |
941 v5 = v2->vPosition.x; | |
942 if ( stru_721530.sMaxX > v5 + v4 | |
943 || stru_721530.sMinX < v5 - v4 | |
944 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
945 || stru_721530.sMinY < v6 - v4 | |
946 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
947 || stru_721530.sMinZ < v7 | |
948 || (v8 = v5 - stru_721530.normal.x, | |
949 v9 = v6 - stru_721530.normal.y, | |
950 v10 = stru_721530.prolly_normal_d + v4, | |
951 v17 = stru_721530.prolly_normal_d + v4, | |
952 v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16, | |
953 v18 = v8, | |
954 v19 = v9, | |
955 abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10) | |
956 || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0) | |
957 || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
958 { | |
959 LABEL_25: | |
960 result = 0; | |
961 } | |
962 else | |
963 { | |
295 | 964 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); |
0 | 965 if ( v13 < 0 ) |
966 v13 = 0; | |
967 if ( v13 < stru_721530.field_7C ) | |
968 { | |
969 stru_721530.field_7C = v13; | |
970 v14 = 8 * v16; | |
862 | 971 LOBYTE(v14) = PID(OBJECT_Actor,v16); |
0 | 972 stru_721530.uFaceID = v14; |
973 } | |
974 result = 1; | |
975 } | |
976 return result; | |
977 } | |
978 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); | |
979 | |
980 //----- (0046E0B2) -------------------------------------------------------- | |
981 void __cdecl _46E0B2_collide_against_decorations() | |
982 { | |
983 BLVSector *v0; // ebp@1 | |
984 LevelDecoration *v1; // edi@2 | |
985 DecorationDesc *v2; // esi@3 | |
986 int v3; // edx@4 | |
987 int v4; // eax@4 | |
988 int v5; // ecx@6 | |
989 int v6; // ebx@8 | |
990 int v7; // esi@8 | |
991 int v8; // ebx@10 | |
992 int v9; // esi@11 | |
993 int v10; // edi@12 | |
994 int v11; // eax@12 | |
995 int v12; // esi@14 | |
996 unsigned int v13; // eax@17 | |
997 signed int i; // [sp+4h] [bp-14h]@1 | |
998 int v15; // [sp+8h] [bp-10h]@10 | |
999 int v16; // [sp+Ch] [bp-Ch]@10 | |
1000 int v17; // [sp+10h] [bp-8h]@10 | |
1001 int v18; // [sp+14h] [bp-4h]@8 | |
1002 | |
1003 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
1004 for ( i = 0; i < v0->uNumDecorations; ++i ) | |
1005 { | |
1006 v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; | |
1007 if ( !(v1->field_2 & 0x20) ) | |
1008 { | |
1009 v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; | |
380 | 1010 if (!v2->CanMoveThrough()) |
0 | 1011 { |
1012 v3 = v2->uRadius; | |
1013 v4 = v1->vPosition.x; | |
1014 if ( stru_721530.sMaxX <= v4 + v3 ) | |
1015 { | |
1016 if ( stru_721530.sMinX >= v4 - v3 ) | |
1017 { | |
1018 v5 = v1->vPosition.y; | |
1019 if ( stru_721530.sMaxY <= v5 + v3 ) | |
1020 { | |
1021 if ( stru_721530.sMinY >= v5 - v3 ) | |
1022 { | |
1023 v6 = v2->uDecorationHeight; | |
1024 v7 = v1->vPosition.z; | |
1025 v18 = v6; | |
1026 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
1027 { | |
1028 if ( stru_721530.sMinZ >= v7 ) | |
1029 { | |
1030 v16 = v4 - stru_721530.normal.x; | |
1031 v15 = v5 - stru_721530.normal.y; | |
1032 v8 = stru_721530.prolly_normal_d + v3; | |
1033 v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
1034 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1035 if ( abs(v17) <= stru_721530.prolly_normal_d + v3 ) | |
1036 { | |
1037 v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16; | |
1038 if ( v9 > 0 ) | |
1039 { | |
1040 v10 = v1->vPosition.z; | |
1041 v11 = stru_721530.normal.z | |
1042 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16); | |
1043 if ( v11 >= v10 ) | |
1044 { | |
1045 if ( v11 <= v18 + v10 ) | |
1046 { | |
295 | 1047 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17); |
0 | 1048 if ( v12 < 0 ) |
1049 v12 = 0; | |
1050 if ( v12 < stru_721530.field_7C ) | |
1051 { | |
1052 stru_721530.field_7C = v12; | |
1053 v13 = 8 * v0->pDecorationIDs[i]; | |
1054 LOBYTE(v13) = v13 | 5; | |
1055 stru_721530.uFaceID = v13; | |
1056 } | |
1057 } | |
1058 } | |
1059 } | |
1060 } | |
1061 } | |
1062 } | |
1063 } | |
1064 } | |
1065 } | |
1066 } | |
1067 } | |
1068 } | |
1069 } | |
1070 } | |
1071 | |
1072 //----- (0046E26D) -------------------------------------------------------- | |
1073 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2) | |
1074 { | |
1075 int v2; // edx@5 | |
1076 unsigned __int16 *v3; // eax@5 | |
1077 unsigned __int16 v4; // ax@6 | |
1078 LevelDecoration *v5; // edi@7 | |
1079 DecorationDesc *v6; // esi@8 | |
1080 int v7; // edx@9 | |
1081 int v8; // eax@9 | |
1082 int v9; // ecx@11 | |
1083 int v10; // ebx@13 | |
1084 int v11; // esi@13 | |
1085 int v12; // ebp@15 | |
1086 int v13; // ebx@15 | |
1087 int v14; // esi@16 | |
1088 int v15; // edi@17 | |
1089 int v16; // eax@17 | |
1090 int v17; // esi@19 | |
1091 char v18; // zf@23 | |
1092 int v19; // [sp+0h] [bp-10h]@15 | |
1093 unsigned __int16 *v20; // [sp+4h] [bp-Ch]@5 | |
1094 int v21; // [sp+8h] [bp-8h]@15 | |
1095 int v22; // [sp+Ch] [bp-4h]@13 | |
1096 | |
1097 if ( a1 >= 0 ) | |
1098 { | |
1099 if ( a1 <= 127 ) | |
1100 { | |
1101 if ( a2 >= 0 ) | |
1102 { | |
1103 if ( a2 <= 127 ) | |
1104 { | |
1105 v2 = a1 + (a2 << 7); | |
1106 v3 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1107 v20 = &pOutdoor->pFaceIDLIST[pOutdoor->pOMAP[v2]]; | |
1108 if ( v3 ) | |
1109 { | |
1110 do | |
1111 { | |
1112 v4 = *v3; | |
848 | 1113 if ( PID_TYPE(v4) == OBJECT_Decoration) |
0 | 1114 { |
1115 v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; | |
1116 if ( !(v5->field_2 & 0x20) ) | |
1117 { | |
1118 v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; | |
380 | 1119 if (!v6->CanMoveThrough()) |
0 | 1120 { |
1121 v7 = v6->uRadius; | |
1122 v8 = v5->vPosition.x; | |
1123 if ( stru_721530.sMaxX <= v8 + v7 ) | |
1124 { | |
1125 if ( stru_721530.sMinX >= v8 - v7 ) | |
1126 { | |
1127 v9 = v5->vPosition.y; | |
1128 if ( stru_721530.sMaxY <= v9 + v7 ) | |
1129 { | |
1130 if ( stru_721530.sMinY >= v9 - v7 ) | |
1131 { | |
1132 v10 = v6->uDecorationHeight; | |
1133 v11 = v5->vPosition.z; | |
1134 v22 = v10; | |
1135 if ( stru_721530.sMaxZ <= v11 + v10 ) | |
1136 { | |
1137 if ( stru_721530.sMinZ >= v11 ) | |
1138 { | |
1139 v12 = v8 - stru_721530.normal.x; | |
1140 v19 = v9 - stru_721530.normal.y; | |
1141 v13 = stru_721530.prolly_normal_d + v7; | |
1142 v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y | |
1143 - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
1144 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 ) | |
1145 { | |
1146 v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16; | |
1147 if ( v14 > 0 ) | |
1148 { | |
1149 v15 = v5->vPosition.z; | |
1150 v16 = stru_721530.normal.z | |
1151 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16); | |
1152 if ( v16 >= v15 ) | |
1153 { | |
1154 if ( v16 <= v22 + v15 ) | |
1155 { | |
295 | 1156 v17 = v14 - integer_sqrt(v13 * v13 - v21 * v21); |
0 | 1157 if ( v17 < 0 ) |
1158 v17 = 0; | |
1159 if ( v17 < stru_721530.field_7C ) | |
1160 { | |
1161 stru_721530.field_7C = v17; | |
1162 stru_721530.uFaceID = (signed __int16)*v20; | |
1163 } | |
1164 } | |
1165 } | |
1166 } | |
1167 } | |
1168 } | |
1169 } | |
1170 } | |
1171 } | |
1172 } | |
1173 } | |
1174 } | |
1175 } | |
1176 } | |
1177 v3 = v20 + 1; | |
1178 v18 = *v20 == 0; | |
1179 ++v20; | |
1180 } | |
1181 while ( !v18 ); | |
1182 } | |
1183 } | |
1184 } | |
1185 } | |
1186 } | |
1187 } | |
1188 | |
1189 //----- (00486F92) -------------------------------------------------------- | |
1190 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
1191 { | |
1192 Span *v0; // ebx@1 | |
1193 int v1; // eax@2 | |
1194 Edge *v2; // ecx@3 | |
1195 Edge *v3; // edx@3 | |
1196 Edge *v4; // esi@6 | |
1197 Edge *v5; // eax@7 | |
1198 Edge *v6; // ecx@8 | |
1199 Surf *v7; // esi@11 | |
1200 double v8; // st7@13 | |
1201 Surf *v9; // edi@13 | |
1202 double v10; // st6@13 | |
1203 double v11; // st7@14 | |
1204 signed __int64 v12; // qax@14 | |
1205 stru148 *v13; // eax@15 | |
1206 Span *v14; // ecx@17 | |
1207 double v15; // st7@28 | |
1208 signed __int64 v16; // qax@28 | |
1209 stru148 *v17; // eax@29 | |
1210 Span *v18; // ecx@31 | |
1211 Edge *i; // eax@40 | |
1212 Edge *v20; // ecx@43 | |
1213 Edge *v21; // esi@44 | |
1214 double v22; // st7@45 | |
1215 Edge *v23; // edx@48 | |
1216 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
1217 float v25; // [sp+14h] [bp-Ch]@3 | |
1218 Edge *v26; // [sp+18h] [bp-8h]@8 | |
1219 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
1220 | |
1221 v0 = pSpans; | |
1222 stru_80C9D8.pSurf = &stru_80C980; | |
693 | 1223 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1224 stru_80C9A4.pSurf = &stru_80C980; |
1225 stru_80C980.pPrev = &stru_80C980; | |
1226 stru_80C980.pNext = &stru_80C980; | |
693 | 1227 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
0 | 1228 stru_80C980.field_8 = 0.0; |
1229 stru_80C980.field_4 = 0.0; | |
1230 stru_80C9D8.pNext = &stru_80C9A4; | |
1231 stru_80C9D8.pPrev = 0; | |
1232 stru_80C9D8.field_8 = 1; | |
1233 stru_80C9A4.pNext = 0; | |
1234 stru_80C9A4.pPrev = &stru_80C9D8; | |
1235 stru_80C9A4.field_8 = 0; | |
1236 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
693 | 1237 v27 = pViewport->uViewportTL_Y; |
1238 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
0 | 1239 { |
1240 LABEL_51: | |
1241 v0->field_8 = -1; | |
1242 } | |
1243 else | |
1244 { | |
693 | 1245 v1 = 52 * pViewport->uViewportTL_Y; |
1246 v24 = 52 * pViewport->uViewportTL_Y; | |
0 | 1247 while ( 1 ) |
1248 { | |
1249 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
1250 v3 = &stru_80C9D8; | |
1251 v25 = (double)(signed int)v27; | |
1252 if ( v2 != &defaultEdge ) | |
1253 { | |
1254 do | |
1255 { | |
1256 while ( 1 ) | |
1257 { | |
1258 v4 = v3->pNext; | |
1259 if ( v2->field_0 <= (double)v4->field_0 ) | |
1260 break; | |
1261 v3 = v3->pNext; | |
1262 } | |
1263 v5 = v2->pNext; | |
1264 v2->pNext = v4; | |
1265 v2->pPrev = v3; | |
1266 v3->pNext->pPrev = v2; | |
1267 v3->pNext = v2; | |
1268 v3 = v2; | |
1269 v2 = v5; | |
1270 } | |
1271 while ( v5 != &defaultEdge ); | |
1272 } | |
1273 v6 = stru_80C9D8.pNext; | |
1274 stru_80C980.field_20 = 0; | |
1275 stru_80C980.field_22 = 1; | |
1276 v26 = stru_80C9D8.pNext; | |
1277 if ( stru_80C9D8.pNext ) | |
1278 { | |
1279 while ( 1 ) | |
1280 { | |
1281 v7 = v6->pSurf; | |
1282 if ( v6->field_8 ) | |
1283 { | |
1284 ++v7->field_22; | |
1285 if ( v7->field_22 == 1 ) | |
1286 { | |
1287 v8 = v6->field_0 + 2.0; | |
1288 v9 = stru_80C980.pNext; | |
1289 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
1290 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
1291 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
1292 + stru_80C980.pNext->field_0 ) | |
1293 { | |
1294 do | |
1295 v9 = v9->pNext; | |
1296 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
1297 v7->pNext = v9; | |
1298 v7->pPrev = v9->pPrev; | |
1299 v9->pPrev->pNext = v7; | |
1300 v9->pPrev = v7; | |
1301 } | |
1302 else | |
1303 { | |
1304 v11 = v6->field_0 + 0.5; | |
1305 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
1306 v0->field_C = v12; | |
1307 if ( (signed __int16)v12 > 0 ) | |
1308 { | |
1309 v0->field_A = v27; | |
1310 v0->field_8 = v9->field_20; | |
1311 v13 = v9->pParent; | |
1312 v0->pParent = v13; | |
1313 if ( v13 ) | |
1314 { | |
1315 if ( v13->prolly_head ) | |
1316 { | |
1317 v14 = v13->prolly_tail; | |
1318 if ( !v14 ) | |
1319 return; | |
1320 v14->pNext = v0; | |
1321 } | |
1322 else | |
1323 { | |
1324 v13->prolly_head = v0; | |
1325 } | |
1326 v13->prolly_tail = v0; | |
1327 } | |
1328 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1329 return; | |
1330 ++v0; | |
1331 ++pOutdoorCamera->uNumSpans; | |
1332 } | |
1333 v6 = v26; | |
1334 v7->field_20 = (signed __int64)v11; | |
1335 v7->pNext = v9; | |
1336 v9->pPrev = v7; | |
1337 stru_80C980.pNext = v7; | |
1338 v7->pPrev = &stru_80C980; | |
1339 } | |
1340 } | |
1341 } | |
1342 else | |
1343 { | |
1344 --v7->field_22; | |
1345 if ( !v7->field_22 ) | |
1346 { | |
1347 if ( stru_80C980.pNext == v7 ) | |
1348 { | |
1349 v15 = v6->field_0 + 0.5; | |
1350 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
1351 v0->field_C = v16; | |
1352 if ( (signed __int16)v16 > 0 ) | |
1353 { | |
1354 v0->field_A = v27; | |
1355 v0->field_8 = v7->field_20; | |
1356 v17 = v7->pParent; | |
1357 v0->pParent = v17; | |
1358 if ( v17 ) | |
1359 { | |
1360 if ( v17->prolly_head ) | |
1361 { | |
1362 v18 = v17->prolly_tail; | |
1363 if ( !v18 ) | |
1364 return; | |
1365 v18->pNext = v0; | |
1366 } | |
1367 else | |
1368 { | |
1369 v17->prolly_head = v0; | |
1370 } | |
1371 v17->prolly_tail = v0; | |
1372 } | |
1373 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
1374 return; | |
1375 ++v0; | |
1376 ++pOutdoorCamera->uNumSpans; | |
1377 } | |
1378 v7->pNext->field_20 = (signed __int64)v15; | |
1379 v6 = v26; | |
1380 } | |
1381 v7->pNext->pPrev = v7->pPrev; | |
1382 v7->pPrev->pNext = v7->pNext; | |
1383 } | |
1384 } | |
1385 v26 = v6->pNext; | |
1386 if ( !v26 ) | |
1387 break; | |
1388 v6 = v6->pNext; | |
1389 } | |
1390 } | |
1391 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
1392 { | |
1393 i->pPrev->pNext = i->pNext; | |
1394 i->pNext->pPrev = i->pPrev; | |
1395 } | |
1396 v20 = stru_80C9D8.pNext; | |
1397 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
1398 break; | |
1399 LABEL_50: | |
1400 ++v27; | |
1401 v1 = v24 + 52; | |
1402 v24 += 52; | |
693 | 1403 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
0 | 1404 goto LABEL_51; |
1405 } | |
1406 while ( 1 ) | |
1407 { | |
1408 v21 = v20->pNext; | |
1409 if ( !v21 ) | |
1410 break; | |
1411 v22 = v20->field_4 + v20->field_0; | |
1412 v20->field_0 = v22; | |
1413 if ( v22 < stru_80C9D8.field_0 ) | |
1414 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
1415 while ( 1 ) | |
1416 { | |
1417 v23 = v20->pPrev; | |
1418 if ( v20->field_0 >= (double)v23->field_0 ) | |
1419 break; | |
1420 v23->pNext = v20->pNext; | |
1421 v20->pNext->pPrev = v23; | |
1422 v23->pPrev->pNext = v20; | |
1423 v20->pPrev = v23->pPrev; | |
1424 v20->pNext = v23; | |
1425 v23->pPrev = v20; | |
1426 } | |
1427 v20 = v21; | |
1428 if ( v21 == &stru_80C9A4 ) | |
1429 goto LABEL_50; | |
1430 } | |
1431 } | |
1432 } | |
1433 // 4EC3EC: using guessed type Edge defaultEdge; | |
1434 | |
1435 //----- (00487355) -------------------------------------------------------- | |
1436 bool OutdoorCamera::_487355() | |
1437 { | |
1438 int v0; // esi@1 | |
1439 stru148 *v1; // edi@2 | |
1440 bool result; // eax@3 | |
1441 | |
1442 v0 = 0; | |
1443 if ( pOutdoorCamera->numStru148s > 0 ) | |
1444 { | |
1445 v1 = array_77EC08; | |
1446 do | |
1447 { | |
1448 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
1449 ++v0; | |
1450 ++v1; | |
1451 } | |
1452 while ( v0 < pOutdoorCamera->numStru148s ); | |
1453 } | |
1454 return result; | |
1455 } | |
1456 | |
1457 //----- (00487DA9) -------------------------------------------------------- | |
1458 void __cdecl sub_487DA9() | |
1459 { | |
1460 char *v0; // eax@1 | |
1461 | |
1462 v0 = &array_77EC08[0].field_108; | |
1463 do | |
1464 { | |
1465 *v0 = 0; | |
1466 v0 += 268; | |
1467 } | |
1468 while ( (signed int)v0 < (signed int)&pVerticesSR_801A10[4] ); | |
1469 } | |
1470 | |
1471 //----- (00487DBE) -------------------------------------------------------- | |
1472 void Software_ResetNewEdges() | |
1473 { | |
1474 int v0; // ecx@1 | |
1475 Edge **v1; // eax@1 | |
1476 signed int v2; // eax@3 | |
1477 | |
1478 v0 = 0; | |
1479 v1 = ptr_80CA10; | |
1480 do | |
1481 { | |
1482 ++v0; | |
1483 *((int *)&pNewEdges[v0] - 9) = (int)&defaultEdge; | |
1484 *v1 = 0; | |
1485 ++v1; | |
1486 } | |
1487 while ( (signed int)v1 < (signed int)&unk_80D190 ); | |
1488 v2 = 2000; | |
1489 do | |
1490 { | |
1491 pSurfs->field_22 = 0; | |
1492 --v2; | |
1493 } | |
1494 while ( v2 ); | |
1495 } | |
1496 // 4EC3EC: using guessed type Edge defaultEdge; | |
1497 | |
1498 //----- (0048958E) -------------------------------------------------------- | |
1499 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
1500 { | |
1501 stru12_MemoryBlock *v2; // esi@1 | |
1502 void *v3; // eax@1 | |
1503 void *v4; // ecx@1 | |
1504 stru12_MemoryBlock *result; // eax@1 | |
1505 | |
1506 v2 = this; | |
1507 v3 = operator new(8 * a2 + 16); | |
1508 v2->pBlockBase = v3; | |
848 | 1509 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); |
0 | 1510 result = v2; |
1511 v2->pAlignedBlock = v4; | |
1512 } | |
1513 | |
1514 //----- (004895B7) -------------------------------------------------------- | |
1515 stru12::stru12(stru11 *pStru11) | |
1516 { | |
1517 stru12 *v2; // esi@1 | |
1518 | |
1519 v2 = this; | |
1520 this->field_44 = 0x41000000u; | |
1521 this->field_4C = 0x46000000u; | |
1522 //this->vdestructor_ptr = stru12::_4898E6; | |
1523 this->field_48 = 0; | |
1524 this->field_50 = 0; | |
1525 this->field_54 = 0x33D6BF95u; | |
1526 this->field_58 = 0; | |
1527 | |
1528 for (int i = 0; i < 12; ++i) | |
1529 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
1530 } | |
1531 | |
1532 //----- (00489810) -------------------------------------------------------- | |
1533 stru12::~stru12() | |
1534 { | |
1535 for (int i = 0; i < 12; ++i) | |
1536 delete pMemBlocks[i]; | |
1537 } | |
1538 | |
1539 //----- (004898BF) -------------------------------------------------------- | |
1540 stru12_MemoryBlock::~stru12_MemoryBlock() | |
1541 { | |
1542 stru12_MemoryBlock *v2; // esi@1 | |
1543 void *v3; // ST00_4@1 | |
1544 | |
1545 v2 = this; | |
1546 v3 = this->pBlockBase; | |
1547 this->pAlignedBlock = 0; | |
1548 free(v3); | |
1549 v2->pBlockBase = 0; | |
1550 /*if ( a2 & 1 ) | |
1551 free(v2);*/ | |
1552 } | |
1553 | |
1554 //----- (004898E6) -------------------------------------------------------- | |
1555 void stru12::_4898E6() | |
1556 { | |
1557 void *v1; // eax@1 | |
1558 void *v2; // edx@1 | |
1559 char *v3; // edi@2 | |
1560 double v4; // st7@2 | |
1561 char *v5; // ebx@2 | |
1562 double v6; // st6@3 | |
1563 double v7; // st5@3 | |
1564 double v8; // st4@3 | |
1565 int v9; // esi@3 | |
1566 double v10; // st3@3 | |
1567 float v11; // ST34_4@5 | |
1568 double v12; // st6@10 | |
1569 double v13; // ST0C_8@10 | |
1570 char *v14; // [sp+14h] [bp-44h]@2 | |
1571 char *v15; // [sp+18h] [bp-40h]@2 | |
1572 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
1573 char *v17; // [sp+20h] [bp-38h]@2 | |
1574 char *v18; // [sp+24h] [bp-34h]@2 | |
1575 float v19; // [sp+30h] [bp-28h]@3 | |
1576 float v20; // [sp+38h] [bp-20h]@3 | |
1577 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
1578 int v22; // [sp+40h] [bp-18h]@1 | |
1579 char *v23; // [sp+44h] [bp-14h]@2 | |
1580 char *v24; // [sp+48h] [bp-10h]@2 | |
1581 int v25; // [sp+4Ch] [bp-Ch]@2 | |
1582 float v26; // [sp+50h] [bp-8h]@3 | |
1583 float v27; // [sp+54h] [bp-4h]@3 | |
1584 | |
731 | 1585 __debugbreak(); |
0 | 1586 v22 = 0; |
1587 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
1588 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
1589 if ( this->field_8C > 0 ) | |
1590 { | |
1591 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
1592 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
1593 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
1594 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
1595 v25 = (int)v1 - (int)v2; | |
1596 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
1597 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
1598 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
1599 v4 = 1.0; | |
1600 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
1601 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
1602 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
1603 do | |
1604 { | |
1605 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
1606 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
1607 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
1608 v7 = pIndoorCamera->fRotationYCosine; | |
1609 v8 = pIndoorCamera->fRotationYSine; | |
1610 v20 = pIndoorCamera->fRotationXCosine; | |
1611 v19 = pIndoorCamera->fRotationXSine; | |
1612 v9 = (int)((char *)v2 + (int)v21); | |
1613 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
1614 if ( pIndoorCamera->sRotationX ) | |
1615 { | |
1616 v11 = v10; | |
1617 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
1618 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1619 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
1620 } | |
1621 else | |
1622 { | |
1623 *(float *)v9 = v10; | |
1624 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
1625 *(float *)((char *)v2 + (int)v5) = v6; | |
1626 } | |
1627 if ( *(float *)v9 >= 8.0 ) | |
1628 { | |
1629 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
1630 { | |
1631 *(int *)v2 = 0; | |
1632 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
1633 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
1634 - v12 * *(float *)((char *)v2 + (int)v3); | |
1635 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
1636 - v12 * *(float *)((char *)v2 + (int)v5); | |
1637 *(float *)((char *)v2 + (int)v16) = v4 | |
1638 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
1639 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
1640 v13 = *(float *)v9 + 6.7553994e15; | |
1641 v4 = 1.0; | |
1642 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
1643 } | |
1644 else | |
1645 { | |
1646 *(int *)v2 = 2; | |
1647 } | |
1648 } | |
1649 else | |
1650 { | |
1651 *(int *)v2 = 1; | |
1652 } | |
1653 ++v22; | |
1654 v2 = (char *)v2 + 4; | |
1655 } | |
1656 while ( v22 < this->field_8C ); | |
1657 } | |
1658 this->field_8C = 0; | |
1659 } | |
1660 | |
1661 //----- (0048A959) -------------------------------------------------------- | |
1662 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | |
1663 { | |
1664 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f, | |
1665 g = ((uColor & 0x0000FF00) >> 8) / 255.0f, | |
1666 b = (uColor & 0x000000FF) / 255.0f; | |
1667 | |
1668 float h, s, v; | |
1669 RGB2HSV(&h, &s, r, g, b, &v); | |
1670 | |
1671 if ( h_replace != -1.0 ) | |
1672 h = h_replace; | |
1673 if ( s_replace != -1.0 ) | |
1674 s = s_replace; | |
1675 if ( v_replace != -1.0 ) | |
1676 v = v_replace; | |
1677 HSV2RGB(&r, &g, &b, h, s, v); | |
1678 | |
1679 return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) | | |
1680 (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) | | |
1681 ((uint)floorf(b * 255.0f + 0.5f) & 0xFF); | |
1682 } | |
1683 | |
1684 //----- (0048B561) -------------------------------------------------------- | |
1029 | 1685 int fixpoint_from_float(float val) |
0 | 1686 { |
1029 | 1687 // float X.Yf -> int XXXX YYYY |
1688 int left = floorf((val - 0.5f) + 0.5f); | |
1689 int right = floorf((val - left) * 65536.0f); | |
1690 return (left << 16) | right; | |
0 | 1691 } |
1692 | |
1693 //----- (00491E3A) -------------------------------------------------------- | |
1694 void __cdecl sub_491E3A() | |
1695 { | |
1696 Player *v0; // ebx@1 | |
1697 signed int v1; // esi@3 | |
1698 char *v2; // eax@4 | |
1699 unsigned int v3; // eax@7 | |
1700 unsigned int v4; // edx@8 | |
1701 char *v5; // ecx@9 | |
1702 int v6; // edi@17 | |
1703 Texture *v7; // ebx@18 | |
1704 struct IDirect3DTexture2 **v8; // eax@19 | |
1705 struct IDirect3DTexture2 *v9; // eax@20 | |
1706 struct IDirectDrawSurface **v10; // eax@22 | |
1707 struct IDirectDrawSurface *v11; // eax@23 | |
1708 int v12; // eax@26 | |
1709 | |
1710 v0 = pParty->pPlayers; | |
1711 do | |
1712 { | |
203 | 1713 if (SoundSetAction[24][0]) |
0 | 1714 { |
1715 v1 = 0; | |
764 | 1716 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1717 { |
1718 LABEL_7: | |
1719 v3 = 0; | |
1720 } | |
1721 else | |
1722 { | |
1723 v2 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1724 while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 ) |
0 | 1725 { |
1726 ++v1; | |
1727 v2 += 120; | |
764 | 1728 if ( v1 >= (signed int)pSoundList->sNumSounds ) |
0 | 1729 goto LABEL_7; |
1730 } | |
1731 v3 = v1; | |
1732 } | |
764 | 1733 pSoundList->UnloadSound(v3, 1); |
0 | 1734 v4 = 0; |
764 | 1735 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 1736 { |
1737 LABEL_12: | |
1738 v4 = 0; | |
1739 } | |
1740 else | |
1741 { | |
1742 v5 = (char *)&pSoundList->pSounds->uSoundID; | |
203 | 1743 while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 ) |
0 | 1744 { |
1745 ++v4; | |
1746 v5 += 120; | |
764 | 1747 if ( (signed int)v4 >= (signed int)pSoundList->sNumSounds ) |
0 | 1748 goto LABEL_12; |
1749 } | |
1750 } | |
764 | 1751 pSoundList->UnloadSound(v4, 1); |
0 | 1752 } |
1753 ++v0; | |
1754 } | |
1755 while ( (signed int)v0 < (signed int)pParty->pHirelings ); | |
1756 v6 = pIcons_LOD->uNumLoadedFiles - 1; | |
33 | 1757 if ( v6 >= pIcons_LOD->pFacesLock ) |
0 | 1758 { |
1759 v7 = &pIcons_LOD->pTextures[v6]; | |
1760 do | |
1761 { | |
1762 v7->Release(); | |
1763 v8 = pIcons_LOD->pHardwareTextures; | |
1764 if ( v8 ) | |
1765 { | |
1766 v9 = v8[v6]; | |
1767 if ( v9 ) | |
1768 { | |
1769 v9->Release(); | |
1770 pIcons_LOD->pHardwareTextures[v6] = 0; | |
1771 } | |
1772 } | |
1773 v10 = pIcons_LOD->pHardwareSurfaces; | |
1774 if ( v10 ) | |
1775 { | |
1776 v11 = v10[v6]; | |
1777 if ( v11 ) | |
1778 { | |
1779 v11->Release(); | |
1780 pIcons_LOD->pHardwareSurfaces[v6] = 0; | |
1781 } | |
1782 } | |
1783 --v6; | |
1784 --v7; | |
1785 } | |
33 | 1786 while ( v6 >= pIcons_LOD->pFacesLock ); |
1787 } | |
1788 v12 = pIcons_LOD->pFacesLock; | |
1789 pIcons_LOD->pFacesLock = 0; | |
0 | 1790 pIcons_LOD->uNumLoadedFiles = v12; |
1791 } | |
1792 // 4ED498: using guessed type char byte_4ED498; | |
1793 | |
1794 //----- (0049387A) -------------------------------------------------------- | |
1795 int CycleCharacter(unsigned int _this) | |
1796 { | |
1797 signed int result; // eax@1 | |
1798 signed int v2; // ecx@2 | |
1799 signed int v3; // ecx@8 | |
1800 | |
1801 result = uActiveCharacter; | |
1802 if ( _this ) | |
1803 { | |
1804 v2 = 0; | |
1805 while ( 1 ) | |
1806 { | |
1807 --result; | |
1808 if ( result < 1 ) | |
1809 result = 4; | |
1810 if ( !pPlayers[result]->uTimeToRecovery ) | |
1811 break; | |
1812 ++v2; | |
1813 if ( v2 >= 4 ) | |
1814 return uActiveCharacter; | |
1815 } | |
1816 } | |
1817 else | |
1818 { | |
1819 v3 = 0; | |
1820 while ( 1 ) | |
1821 { | |
1822 ++result; | |
1823 if ( result > 4 ) | |
1824 result = 1; | |
1825 if ( !pPlayers[result]->uTimeToRecovery ) | |
1826 break; | |
1827 ++v3; | |
1828 if ( v3 >= 4 ) | |
1829 return uActiveCharacter; | |
1830 } | |
1831 } | |
1832 return result; | |
1833 } | |
1834 //----- (004938D1) -------------------------------------------------------- | |
1835 void __fastcall Rest(unsigned int uHoursToSleep) | |
1836 { | |
1837 unsigned int v1; // esi@1 | |
1838 double v2; // st7@3 | |
1839 Player **v3; // esi@3 | |
1840 | |
1841 v1 = uHoursToSleep; | |
1842 if ( uHoursToSleep > 240 ) | |
1843 InitializeActors(); | |
1844 v2 = (double)(7680 * v1) * 0.033333335; | |
1845 pParty->uTimePlayed += (signed __int64)v2; | |
1846 v3 = &pPlayers[1]; | |
1847 do | |
1848 { | |
1849 (*v3)->Recover((signed __int64)v2); | |
1850 ++v3; | |
1851 } | |
1852 while ( (signed int)v3 <= (signed int)&pPlayers[4] ); | |
1853 _494035_timed_effects__water_walking_damage__etc(); | |
1854 } | |
1855 | |
1856 //----- (00493938) -------------------------------------------------------- | |
1857 int __cdecl _493938_regenerate() | |
1858 { | |
1859 int v0; // edi@1 | |
1860 signed __int64 v1; // qax@1 | |
1861 int v2; // ecx@1 | |
1862 int result; // eax@1 | |
1863 int v4; // eax@2 | |
1864 int v5; // edi@5 | |
112 | 1865 int *v6; // ecx@5 |
0 | 1866 char v7; // sf@5 |
112 | 1867 int *v8; // ecx@10 |
0 | 1868 int v9; // edi@15 |
1869 signed int v10; // eax@15 | |
1870 __int16 *v11; // edx@16 | |
1871 int v12; // eax@20 | |
1872 int v13; // ebx@20 | |
1873 unsigned int *v14; // esi@21 | |
1874 unsigned int v15; // ecx@21 | |
1875 unsigned int v16; // eax@21 | |
1876 int v17; // edx@21 | |
1877 int v18; // eax@21 | |
1878 signed int v19; // eax@21 | |
1879 signed int v20; // ebx@25 | |
1880 Player *v21; // esi@25 | |
1881 ITEM_EQUIP_TYPE v22; // edi@30 | |
1882 //int v23; // edx@31 | |
1883 signed int v24; // ecx@32 | |
1884 signed int v25; // eax@33 | |
1885 int v26; // eax@35 | |
1886 int v27; // eax@36 | |
1887 int v28; // eax@37 | |
1888 int v29; // eax@40 | |
1889 int v30; // eax@41 | |
1890 signed int v31; // ecx@53 | |
1891 char *v32; // eax@53 | |
1892 char *v33; // edi@82 | |
1893 int v34; // ecx@88 | |
1894 int v35; // eax@88 | |
1895 char *v36; // edi@99 | |
1896 int v37; // edi@104 | |
1897 int v38; // edi@106 | |
1898 int v39; // edi@111 | |
1899 int v40; // ecx@113 | |
1900 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
|
1901 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 |
0 | 1902 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 |
1903 int v44; // [sp+210h] [bp-20h]@22 | |
1904 int v45; // [sp+214h] [bp-1Ch]@25 | |
1905 int v46; // [sp+218h] [bp-18h]@25 | |
1906 int v47; // [sp+21Ch] [bp-14h]@25 | |
1907 int v48; // [sp+220h] [bp-10h]@25 | |
1908 int v49; // [sp+224h] [bp-Ch]@24 | |
1909 int v50; // [sp+228h] [bp-8h]@25 | |
1910 int v51; // [sp+22Ch] [bp-4h]@2 | |
1911 | |
1912 v0 = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | |
1913 v1 = (signed __int64)((double)pParty->uLastRegenerationTime * 0.234375); | |
1914 v2 = (signed int)v1 / 60; | |
1915 result = (signed int)v1 / 60 + 5; | |
1916 if ( v0 >= result ) | |
1917 { | |
1918 v51 = 0; | |
1919 v4 = (v0 - v2) / 5; | |
1920 if (pParty->FlyActive()) | |
1921 { | |
1922 if ( pParty->bFlying ) | |
1923 { | |
569 | 1924 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) ) |
1925 { // colliding with something in the air - fall down | |
1926 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower; | |
1927 //__debugbreak(); | |
1167 | 1928 v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000]; |
112 | 1929 v7 = *v6 < v5; |
1930 *v6 -= v5; | |
0 | 1931 if ( v7 ) |
1932 { | |
112 | 1933 *v6 = 0; |
0 | 1934 pParty->uFlags &= 0xFFFFFFBFu; |
1935 pParty->bFlying = 0; | |
1936 v51 = 1; | |
1937 } | |
1938 } | |
1939 } | |
1940 } | |
569 | 1941 |
0 | 1942 if (pParty->WaterWalkActive()) |
1943 { | |
569 | 1944 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) |
1945 { | |
1946 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) | |
1947 { // taking on water | |
1948 //__debugbreak(); | |
1167 | 1949 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; |
112 | 1950 v7 = *v8 < v4; |
1951 *v8 -= v4; | |
0 | 1952 if ( v7 ) |
1953 { | |
112 | 1954 *v8 = 0; |
569 | 1955 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 1956 v51 = 1; |
1957 } | |
1958 } | |
1959 } | |
1960 } | |
569 | 1961 |
0 | 1962 if (pParty->ImmolationActive()) |
1963 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1964 //SpriteObject::SpriteObject(&a1); |
0 | 1965 v9 = 0; |
1966 a3.z = 0; | |
1967 a3.y = 0; | |
1968 a3.x = 0; | |
1969 a1.stru_24.Reset(); | |
822 | 1970 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower; |
1971 a1.spell_skill = pParty->ImmolationSkillLevel(); | |
0 | 1972 v10 = 0; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1973 a1.uType = 1070; |
822 | 1974 a1.spell_id = SPELL_FIRE_IMMOLATION; |
0 | 1975 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1976 { | |
1977 LABEL_19: | |
1978 LOWORD(v10) = 0; | |
1979 } | |
1980 else | |
1981 { | |
1982 v11 = &pObjectList->pObjects->uObjectID; | |
924 | 1983 while ( stru_4E3ACC[8].uType != *v11 ) |
0 | 1984 { |
1985 ++v10; | |
1986 v11 += 28; | |
1987 if ( v10 >= (signed int)pObjectList->uNumObjects ) | |
1988 goto LABEL_19; | |
1989 } | |
1990 } | |
1991 a1.uObjectDescID = v10; | |
1992 a1.field_60_distance_related_prolly_lod = 0; | |
1167 | 1993 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; |
303 | 1994 LOBYTE(v12) = v12 | OBJECT_Player; |
0 | 1995 a1.uAttributes = 0; |
1996 a1.uSectorID = 0; | |
1997 a1.uSpriteFrameID = 0; | |
822 | 1998 a1.spell_caster_pid = v12; |
0 | 1999 a1.uFacing = 0; |
2000 a1.uSoundID = 0; | |
2001 v13 = sub_46A89E((int)v41, 100, 307); | |
2002 if ( v13 > 0 ) | |
2003 { | |
2004 do | |
2005 { | |
2006 v14 = (unsigned int *)&v41[4 * v9]; | |
2007 v15 = *v14; | |
2008 v16 = *v14; | |
2009 a1.vPosition.x = pActors[v16].vPosition.x; | |
2010 v17 = pActors[v16].vPosition.y; | |
2011 a1.vPosition.z = pActors[v16].vPosition.z; | |
2012 v18 = 8 * v15; | |
862 | 2013 LOBYTE(v18) = PID(OBJECT_Actor,v15); |
0 | 2014 a1.vPosition.y = v17; |
823 | 2015 a1.spell_target_pid = v18; |
0 | 2016 v19 = a1.Create(0, 0, 0, 0); |
862 | 2017 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); |
0 | 2018 ++v9; |
2019 } | |
2020 while ( v9 < v13 ); | |
2021 } | |
2022 } | |
2023 v44 = 0; | |
248 | 2024 if (PartyHasDragon()) |
0 | 2025 v44 = 1; |
2026 v49 = 0; | |
2027 LABEL_25: | |
2028 v20 = 0; | |
2029 v21 = &pParty->pPlayers[v49]; | |
2030 v50 = 0; | |
2031 v47 = 0; | |
2032 v45 = 0; | |
2033 v48 = 0; | |
2034 v46 = 0; | |
255 | 2035 if ( v44 && v21->classType == PLAYER_CLASS_WARLOCK ) |
0 | 2036 v50 = 1; |
135 | 2037 if ( v21->classType == PLAYER_CLASS_LICH ) |
0 | 2038 v48 = 1; |
2039 v22 = (ITEM_EQUIP_TYPE)0; | |
2040 while ( 1 ) | |
2041 { | |
2042 if ( v21->HasItemEquipped(v22) ) | |
2043 { | |
2044 //v23 = v21->pEquipment.pIndices; | |
2045 auto _idx = v21->pEquipment.pIndices[v22]; | |
2046 v24 = v21->pInventoryItems[_idx].uItemID; | |
2047 if ( v24 > 134 ) | |
2048 { | |
2049 if ( v24 == 529 ) | |
2050 goto LABEL_43; | |
2051 if ( v24 == 535 ) | |
2052 goto LABEL_44; | |
2053 if ( v24 == 515 ) | |
2054 { | |
2055 v47 = 1; | |
2056 } | |
2057 else | |
2058 { | |
2059 if ( v24 == 532 ) | |
2060 goto LABEL_50; | |
2061 } | |
2062 } | |
2063 else | |
2064 { | |
377 | 2065 v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; |
0 | 2066 if ( v25 <= 50 ) |
2067 { | |
2068 if ( v25 != 50 ) | |
2069 { | |
2070 v26 = v25 - 37; | |
2071 if ( v26 ) | |
2072 { | |
2073 v27 = v26 - 1; | |
2074 if ( !v27 ) | |
2075 goto LABEL_50; | |
2076 v28 = v27 - 6; | |
2077 if ( v28 ) | |
2078 { | |
2079 if ( v28 != 3 ) | |
2080 goto LABEL_51; | |
2081 LABEL_50: | |
2082 v50 = 1; | |
2083 goto LABEL_51; | |
2084 } | |
2085 } | |
2086 } | |
2087 LABEL_44: | |
2088 v20 = 1; | |
2089 goto LABEL_51; | |
2090 } | |
2091 v29 = v25 - 54; | |
2092 if ( !v29 ) | |
2093 goto LABEL_44; | |
2094 v30 = v29 - 1; | |
2095 if ( !v30 ) | |
2096 goto LABEL_50; | |
2097 if ( v30 == 11 ) | |
2098 { | |
2099 LABEL_43: | |
2100 v20 = 1; | |
2101 v50 = 1; | |
2102 goto LABEL_51; | |
2103 } | |
2104 } | |
2105 } | |
2106 LABEL_51: | |
2107 v22 = (ITEM_EQUIP_TYPE)((int)v22 + 1); | |
2108 if ( (signed int)v22 >= 16 ) | |
2109 { | |
2110 if ( v48 ) | |
2111 { | |
2112 v31 = 0; | |
2113 v32 = (char *)v21->pInventoryItems; | |
2114 while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) | |
2115 { | |
2116 ++v31; | |
2117 v32 += 36; | |
2118 if ( v31 >= 138 ) | |
2119 goto LABEL_59; | |
2120 } | |
2121 v48 = 0; | |
2122 v45 = 1; | |
2123 } | |
2124 LABEL_59: | |
2125 if ( v21->pConditions[17] ) | |
2126 v46 = 1; | |
2127 if ( v20 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2128 { | |
2129 ++v21->sHealth; | |
2130 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2131 v21->sHealth = v21->GetMaxHealth(); | |
2132 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2133 { | |
2134 LODWORD(v21->pConditions[13]) = 0; | |
2135 HIDWORD(v21->pConditions[13]) = 0; | |
2136 } | |
2137 v51 = 1; | |
2138 } | |
2139 if ( SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) >= 0 | |
2140 && (SHIDWORD(v21->pPlayerBuffs[12].uExpireTime) > 0 || LODWORD(v21->pPlayerBuffs[12].uExpireTime)) | |
2141 && !v21->pConditions[14] | |
2142 && !v21->pConditions[16] ) | |
2143 { | |
2144 v21->sHealth += 5 * v21->pPlayerBuffs[12].uPower; | |
2145 if ( v21->sHealth > v21->GetMaxHealth() ) | |
2146 v21->sHealth = v21->GetMaxHealth(); | |
2147 if ( v21->pConditions[13] && v21->sHealth > 0 ) | |
2148 { | |
2149 LODWORD(v21->pConditions[13]) = 0; | |
2150 HIDWORD(v21->pConditions[13]) = 0; | |
2151 } | |
2152 v51 = 1; | |
2153 } | |
2154 if ( v50 ) | |
2155 { | |
2156 v33 = (char *)&v21->sMana; | |
2157 ++*(int *)v33; | |
2158 if ( v21->sMana > v21->GetMaxMana() ) | |
2159 *(int *)v33 = v21->GetMaxMana(); | |
2160 v51 = 1; | |
2161 } | |
2162 if ( v47 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2163 { | |
2164 v34 = LODWORD(v21->pConditions[13]); | |
2165 --v21->sHealth; | |
2166 v35 = v21->sHealth; | |
2167 if ( !(HIDWORD(v21->pConditions[13]) | v34) && v35 < 0 ) | |
2168 v21->pConditions[13] = pParty->uTimePlayed; | |
2169 if ( v35 < 1 ) | |
2170 { | |
2171 if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
2172 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2173 { | |
2174 v21->pConditions[13] = pParty->uTimePlayed; | |
2175 } | |
2176 else | |
2177 { | |
2178 if ( !v21->pConditions[14] ) | |
2179 v21->pConditions[14] = pParty->uTimePlayed; | |
2180 } | |
2181 } | |
2182 v51 = 1; | |
2183 } | |
2184 if ( v45 ) | |
2185 { | |
2186 v36 = (char *)&v21->sMana; | |
2187 ++*(int *)v36; | |
2188 if ( v21->sMana > v21->GetMaxMana() ) | |
2189 *(int *)v36 = v21->GetMaxMana(); | |
2190 } | |
2191 if ( v48 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2192 { | |
2193 v37 = v21->sHealth; | |
2194 if ( v37 > v21->GetMaxHealth() / 2 ) | |
2195 v21->sHealth = v37 - 2; | |
2196 v38 = v21->sMana; | |
2197 if ( v38 > v21->GetMaxMana() / 2 ) | |
2198 v21->sMana = v38 - 2; | |
2199 } | |
2200 if ( v46 && !v21->pConditions[14] && !v21->pConditions[16] ) | |
2201 { | |
2202 v39 = v21->sHealth; | |
2203 if ( v39 > v21->GetMaxHealth() / 2 ) | |
2204 v21->sHealth = v39 - 1; | |
2205 v40 = v21->sMana; | |
2206 if ( v40 > 0 ) | |
2207 v21->sMana = v40 - 1; | |
2208 } | |
2209 ++v49; | |
2210 if ( v49 >= 4 ) | |
2211 { | |
2212 result = HIDWORD(pParty->uTimePlayed); | |
2213 pParty->uLastRegenerationTime = pParty->uTimePlayed; | |
2214 if ( !viewparams->bRedrawGameUI ) | |
2215 { | |
2216 result = v51; | |
2217 viewparams->bRedrawGameUI = v51; | |
2218 } | |
2219 return result; | |
2220 } | |
2221 goto LABEL_25; | |
2222 } | |
2223 } | |
2224 } | |
2225 return result; | |
2226 } | |
2227 | |
2228 //----- (00493F79) -------------------------------------------------------- | |
351 | 2229 void sub_493F79(stru351_summoned_item *_this, __int64 a2) |
0 | 2230 { |
2231 signed __int64 v2; // ST2C_8@1 | |
2232 signed __int64 v3; // qax@1 | |
351 | 2233 //signed __int64 v4; // ST1C_8@1 |
0 | 2234 unsigned __int64 v5; // qax@1 |
2235 unsigned int v6; // ebx@1 | |
2236 | |
2237 v2 = (signed __int64)((double)a2 * 0.234375); | |
2238 v3 = v2 / 60 / 60; | |
351 | 2239 //v4 = v3; |
0 | 2240 v5 = (unsigned int)v3 / 0x18; |
2241 v6 = (unsigned int)(v5 / 7) >> 2; | |
351 | 2242 _this->field_0_expire_second = v2 % 60; |
2243 _this->field_4_expire_minute = v2 / 60 % 60; | |
2244 _this->field_8_expire_hour = v3 % 24; | |
2245 _this->field_10_expire_week = v5 / 7 & 3; | |
2246 _this->field_C_expire_day = (unsigned int)v5 % 0x1C; | |
2247 _this->field_14_exprie_month = v6 % 0xC; | |
352 | 2248 _this->field_18_expire_year = v6 / 0xC + game_starting_year; |
0 | 2249 } |
2250 | |
2251 //----- (00494035) -------------------------------------------------------- | |
1031 | 2252 void _494035_timed_effects__water_walking_damage__etc() |
0 | 2253 { |
2254 signed __int64 v0; // qax@1 | |
2255 signed __int64 v1; // ST30_8@1 | |
2256 signed __int64 v2; // ST38_8@1 | |
2257 unsigned __int64 v3; // qax@1 | |
2258 unsigned int v4; // edi@1 | |
2259 //signed int v5; // eax@4 | |
2260 //char *v6; // ecx@5 | |
2261 //Player *v7; // esi@8 | |
2262 //char *v8; // ecx@12 | |
766 | 2263 //Player *pPlayer; // esi@15 |
0 | 2264 //void *v10; // esi@25 |
2265 unsigned int v11; // ecx@27 | |
2266 signed int v12; // edi@29 | |
2267 Player *v13; // ecx@30 | |
2268 Player *v14; // esi@35 | |
2269 double v15; // st7@35 | |
2270 Player **v16; // esi@43 | |
2271 Player *v17; // edi@44 | |
2272 double v18; // st7@44 | |
816 | 2273 //float v19; // ST28_4@48 |
2274 //double v20; // ST38_8@48 | |
0 | 2275 Player *v21; // esi@51 |
2276 signed int v22; // edi@53 | |
2277 int v23; // eax@59 | |
2278 int v24; // ecx@60 | |
2279 int v25; // eax@63 | |
2280 int v26; // ecx@64 | |
2281 int v27; // eax@67 | |
2282 int v28; // ecx@68 | |
2283 int v29; // eax@71 | |
2284 int v30; // ecx@72 | |
2285 int v31; // eax@75 | |
2286 int v32; // ecx@76 | |
2287 int v33; // eax@79 | |
2288 int v34; // ecx@80 | |
2289 int v35; // eax@83 | |
2290 int v36; // ecx@84 | |
2291 int v37; // eax@87 | |
2292 int v38; // ecx@88 | |
2293 int v39; // eax@91 | |
2294 int v40; // ecx@92 | |
2295 int v41; // eax@95 | |
2296 int v42; // ecx@96 | |
2297 bool v43; // ebx@102 | |
2298 //SpellBuff *v44; // edi@104 | |
2299 //signed int v45; // ebp@104 | |
2300 bool v46; // edi@111 | |
2301 //SpellBuff *v47; // esi@113 | |
2302 //Player **v48; // esi@119 | |
2303 //signed int v49; // edi@121 | |
2304 //char *v50; // esi@122 | |
2305 signed int v51; // edx@128 | |
2306 signed int v52; // ecx@130 | |
2307 int v53; // eax@131 | |
2308 Player *v54; // eax@141 | |
766 | 2309 //unsigned int v55; // [sp-8h] [bp-38h]@18 |
0 | 2310 unsigned int v56; // [sp-8h] [bp-38h]@55 |
766 | 2311 //int v57; // [sp-4h] [bp-34h]@18 |
0 | 2312 int v58; // [sp-4h] [bp-34h]@33 |
2313 int v59; // [sp-4h] [bp-34h]@55 | |
816 | 2314 //unsigned int v60; // [sp+10h] [bp-20h]@1 |
0 | 2315 unsigned int v61; // [sp+14h] [bp-1Ch]@1 |
2316 Player **v62; // [sp+14h] [bp-1Ch]@50 | |
766 | 2317 //unsigned int a2; // [sp+18h] [bp-18h]@1 |
0 | 2318 signed int a2a; // [sp+18h] [bp-18h]@47 |
2319 signed int v65; // [sp+1Ch] [bp-14h]@47 | |
2320 | |
766 | 2321 //a2 = pParty->uCurrentHour; |
0 | 2322 v61 = pParty->uDaysPlayed; |
816 | 2323 //auto prev_time = pEventTimer->uTimeElapsed; |
766 | 2324 pParty->uTimePlayed += pEventTimer->uTimeElapsed; |
2325 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; | |
0 | 2326 v1 = v0; |
2327 v0 /= 60i64; | |
2328 v2 = v0; | |
2329 v3 = (unsigned int)v0 / 24; | |
2330 v4 = (unsigned int)(v3 / 7) >> 2; | |
2331 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | |
2332 pParty->uCurrentMinute = v1 % 60; | |
2333 pParty->uCurrentMonthWeek = v3 / 7 & 3; | |
2334 pParty->uCurrentHour = v2 % 24; | |
2335 pParty->uDaysPlayed = (unsigned int)v3 % 28; | |
2336 pParty->uCurrentMonth = v4 % 12; | |
352 | 2337 pParty->uCurrentYear = v4 / 0xC + game_starting_year; |
766 | 2338 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns |
0 | 2339 { |
2340 pParty->pHirelings[0].bHasUsedTheAbility = false; | |
2341 pParty->pHirelings[1].bHasUsedTheAbility = false; | |
2342 | |
2343 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2344 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; | |
2345 | |
766 | 2346 ++pParty->days_played_without_rest; |
2347 if (pParty->days_played_without_rest > 1) | |
0 | 2348 { |
2349 for (uint i = 0; i < 4; ++i) | |
766 | 2350 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0); |
2351 | |
2352 if (pParty->uNumFoodRations) | |
2353 Party::TakeFood(1); | |
0 | 2354 else |
2355 for (uint i = 0; i < 4; ++i) | |
766 | 2356 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; |
2357 | |
2358 if (pParty->days_played_without_rest > 3) | |
2359 for (uint i = 0; i < 4; ++i) | |
0 | 2360 { |
766 | 2361 auto player = pParty->pPlayers + i; |
2362 | |
2363 player->Zero(); | |
2364 | |
2365 if (!player->Pertified() && !player->Eradicated() && !player->Dead()) | |
0 | 2366 { |
767 | 2367 if (rand() % 100 < 5 * pParty->days_played_without_rest) |
766 | 2368 player->SetCondition(Player::Condition_Dead, 0); |
767 | 2369 if (rand() % 100 < 10 * pParty->days_played_without_rest) |
766 | 2370 player->SetCondition(Player::Condition_Insane, 0); |
0 | 2371 } |
2372 } | |
766 | 2373 } |
2374 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
0 | 2375 pOutdoor->SetFog(); |
2376 | |
2377 for (uint i = 0; i < 4; ++i) | |
2378 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
2379 } | |
766 | 2380 |
0 | 2381 v11 = LODWORD(pParty->uTimePlayed); |
2382 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | |
2383 { | |
2384 v12 = 1; | |
2385 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; | |
2386 viewparams->bRedrawGameUI = 1; | |
2387 while ( 1 ) | |
2388 { | |
1080 | 2389 if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) |
99 | 2390 || pPlayers[v12]->HasEnchantedItemEquipped(71) |
2391 || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) | |
0 | 2392 { |
2393 v58 = 0; | |
2394 } | |
2395 else | |
2396 { | |
2397 v58 = 0; | |
2398 if ( !sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v12) ) | |
2399 { | |
2400 v14 = pPlayers[v12]; | |
2401 v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; | |
1036 | 2402 v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE); |
0 | 2403 if ( pParty->uFlags & 4 ) |
2404 { | |
783 | 2405 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]); |
2406 GameUI_Footer_TimeLeft = 128; | |
0 | 2407 } |
2408 goto LABEL_39; | |
2409 } | |
2410 v13 = pPlayers[v12]; | |
2411 } | |
130 | 2412 v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58); |
0 | 2413 LABEL_39: |
2414 ++v12; | |
2415 if ( v12 > 4 ) | |
2416 { | |
2417 v11 = LODWORD(pParty->uTimePlayed); | |
2418 break; | |
2419 } | |
2420 } | |
2421 } | |
2422 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) | |
2423 { | |
2424 viewparams->bRedrawGameUI = 1; | |
2425 pParty->field_6FC = v11 + 128; | |
2426 v16 = &pPlayers[1]; | |
2427 do | |
2428 { | |
2429 v17 = *v16; | |
2430 v18 = (double)(*v16)->GetMaxHealth() * 0.1; | |
1036 | 2431 v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); |
0 | 2432 if ( pParty->uFlags & 0x200 ) |
2433 { | |
783 | 2434 strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]); |
2435 GameUI_Footer_TimeLeft = 128; | |
0 | 2436 } |
2437 ++v16; | |
2438 } | |
2439 while ( (signed int)v16 <= (signed int)&pPlayers[4] ); | |
2440 } | |
2441 _493938_regenerate(); | |
2442 v65 = 4; | |
816 | 2443 a2a = pEventTimer->uTimeElapsed; |
2444 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) | |
2445 { | |
2446 //v19 = (double)(signed int)prev_time * 0.5; | |
2447 //v20 = v19 + 6.7553994e15; | |
2448 a2a *= 0.5f; | |
2449 if (a2a < 1) | |
0 | 2450 a2a = 1; |
2451 } | |
2452 v62 = &pPlayers[1]; | |
2453 do | |
2454 { | |
2455 v21 = *v62; | |
2456 if ( (*v62)->uTimeToRecovery ) | |
2457 v21->Recover(a2a); | |
2458 v22 = v21->sHealth; | |
2459 if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 | |
2460 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) | |
2461 { | |
2462 if ( v22 >= 1 ) | |
2463 goto LABEL_59; | |
2464 v59 = 0; | |
2465 v56 = 13; | |
2466 } | |
2467 else | |
2468 { | |
2469 v59 = 0; | |
2470 v56 = 14; | |
2471 } | |
2472 v21->SetCondition(v56, v59); | |
2473 LABEL_59: | |
2474 v23 = (int)&v21->field_E0; | |
2475 if ( v21->field_E0 ) | |
2476 { | |
816 | 2477 v24 = *(int *)v23 - pEventTimer->uTimeElapsed; |
0 | 2478 if ( v24 > 0 ) |
2479 { | |
2480 *(int *)v23 = v24; | |
2481 } | |
2482 else | |
2483 { | |
2484 *(int *)v23 = 0; | |
2485 viewparams->bRedrawGameUI = 1; | |
2486 } | |
2487 } | |
2488 v25 = (int)&v21->field_E4; | |
2489 if ( v21->field_E4 ) | |
2490 { | |
816 | 2491 v26 = *(int *)v25 - pEventTimer->uTimeElapsed; |
0 | 2492 if ( v26 > 0 ) |
2493 { | |
2494 *(int *)v25 = v26; | |
2495 } | |
2496 else | |
2497 { | |
2498 *(int *)v25 = 0; | |
2499 viewparams->bRedrawGameUI = 1; | |
2500 } | |
2501 } | |
2502 v27 = (int)&v21->field_E8; | |
2503 if ( v21->field_E8 ) | |
2504 { | |
816 | 2505 v28 = *(int *)v27 - pEventTimer->uTimeElapsed; |
0 | 2506 if ( v28 > 0 ) |
2507 { | |
2508 *(int *)v27 = v28; | |
2509 } | |
2510 else | |
2511 { | |
2512 *(int *)v27 = 0; | |
2513 viewparams->bRedrawGameUI = 1; | |
2514 } | |
2515 } | |
2516 v29 = (int)&v21->field_EC; | |
2517 if ( v21->field_EC ) | |
2518 { | |
816 | 2519 v30 = *(int *)v29 - pEventTimer->uTimeElapsed; |
0 | 2520 if ( v30 > 0 ) |
2521 { | |
2522 *(int *)v29 = v30; | |
2523 } | |
2524 else | |
2525 { | |
2526 *(int *)v29 = 0; | |
2527 viewparams->bRedrawGameUI = 1; | |
2528 } | |
2529 } | |
2530 v31 = (int)&v21->field_F0; | |
2531 if ( v21->field_F0 ) | |
2532 { | |
816 | 2533 v32 = *(int *)v31 - pEventTimer->uTimeElapsed; |
0 | 2534 if ( v32 > 0 ) |
2535 { | |
2536 *(int *)v31 = v32; | |
2537 } | |
2538 else | |
2539 { | |
2540 *(int *)v31 = 0; | |
2541 viewparams->bRedrawGameUI = 1; | |
2542 } | |
2543 } | |
2544 v33 = (int)&v21->field_F4; | |
2545 if ( v21->field_F4 ) | |
2546 { | |
816 | 2547 v34 = *(int *)v33 - pEventTimer->uTimeElapsed; |
0 | 2548 if ( v34 > 0 ) |
2549 { | |
2550 *(int *)v33 = v34; | |
2551 } | |
2552 else | |
2553 { | |
2554 *(int *)v33 = 0; | |
2555 viewparams->bRedrawGameUI = 1; | |
2556 } | |
2557 } | |
2558 v35 = (int)&v21->field_F8; | |
2559 if ( v21->field_F8 ) | |
2560 { | |
816 | 2561 v36 = *(int *)v35 - pEventTimer->uTimeElapsed; |
0 | 2562 if ( v36 > 0 ) |
2563 { | |
2564 *(int *)v35 = v36; | |
2565 } | |
2566 else | |
2567 { | |
2568 *(int *)v35 = 0; | |
2569 viewparams->bRedrawGameUI = 1; | |
2570 } | |
2571 } | |
2572 v37 = (int)&v21->field_FC; | |
2573 if ( v21->field_FC ) | |
2574 { | |
816 | 2575 v38 = *(int *)v37 - pEventTimer->uTimeElapsed; |
0 | 2576 if ( v38 > 0 ) |
2577 { | |
2578 *(int *)v37 = v38; | |
2579 } | |
2580 else | |
2581 { | |
2582 *(int *)v37 = 0; | |
2583 viewparams->bRedrawGameUI = 1; | |
2584 } | |
2585 } | |
2586 v39 = (int)&v21->field_100; | |
2587 if ( v21->field_100 ) | |
2588 { | |
816 | 2589 v40 = *(int *)v39 - pEventTimer->uTimeElapsed; |
0 | 2590 if ( v40 > 0 ) |
2591 { | |
2592 *(int *)v39 = v40; | |
2593 } | |
2594 else | |
2595 { | |
2596 *(int *)v39 = 0; | |
2597 viewparams->bRedrawGameUI = 1; | |
2598 } | |
2599 } | |
2600 v41 = (int)&v21->field_104; | |
2601 if ( v21->field_104 ) | |
2602 { | |
816 | 2603 v42 = *(int *)v41 - pEventTimer->uTimeElapsed; |
0 | 2604 if ( v42 > 0 ) |
2605 { | |
2606 *(int *)v41 = v42; | |
2607 } | |
2608 else | |
2609 { | |
2610 *(int *)v41 = 0; | |
2611 viewparams->bRedrawGameUI = 1; | |
2612 } | |
2613 } | |
2614 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | |
2615 --v65; | |
2616 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | |
2617 | |
2618 for (uint k = 0; k < 24; ++k) | |
2619 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); | |
2620 | |
2621 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | |
2622 v21->SetCondition(1u, 0); | |
2623 ++v62; | |
2624 } | |
2625 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | |
1167 | 2626 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; |
0 | 2627 |
2628 for (uint i = 0; i < 20; ++i) | |
2629 { | |
2630 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) | |
2631 viewparams->bRedrawGameUI = 1; | |
2632 } | |
2633 | |
1167 | 2634 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) |
0 | 2635 { |
2636 for (uint i = 0; i < 4; ++i) | |
2637 pParty->pPlayers[i].SetCondition(1, 0); | |
2638 } | |
2639 | |
2640 for (uint i = 0; i < 2; ++i) | |
2641 { | |
2642 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; | |
2643 if (pBuf->uExpireTime == 0) | |
2644 continue; | |
2645 | |
2646 if ( !(pBuf->uFlags & 1) ) | |
2647 { | |
2648 if (!pPlayers[pBuf->uCaster]->CanAct()) | |
2649 { | |
2650 pBuf->Reset(); | |
2651 if (dword_4EE07C[i] == 7 ) | |
2652 pParty->bFlying = false; | |
2653 } | |
2654 } | |
2655 } | |
2656 | |
2657 v51 = v65; | |
2658 if ( v65 ) | |
2659 goto LABEL_135; | |
151 | 2660 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2661 { |
2662 v52 = (signed int)&pPlayers[1]; | |
2663 while ( 1 ) | |
2664 { | |
2665 v53 = *(int *)v52; | |
2666 if ( *(_QWORD *)(*(int *)v52 + 16) ) | |
2667 break; | |
2668 v52 += 4; | |
2669 if ( v52 > (signed int)&pPlayers[4] ) | |
2670 goto LABEL_135; | |
2671 } | |
2672 *(int *)(v53 + 16) = 0; | |
2673 *(int *)(v53 + 20) = 0; | |
2674 v51 = 1; | |
2675 LABEL_135: | |
151 | 2676 if ( pCurrentScreen != SCREEN_REST |
0 | 2677 && (!v51 || dword_5C35C0) ) |
981 | 2678 uGameState = GAME_STATE_PARTY_DIED; |
0 | 2679 } |
2680 if ( uActiveCharacter ) | |
2681 { | |
151 | 2682 if ( pCurrentScreen != SCREEN_REST ) |
0 | 2683 { |
2684 v54 = pPlayers[uActiveCharacter]; | |
2685 if ( v54->pConditions[2] | |
2686 || v54->pConditions[12] | |
2687 || v54->pConditions[13] | |
2688 || v54->pConditions[14] | |
2689 || v54->pConditions[15] | |
2690 || v54->pConditions[16] ) | |
2691 { | |
2692 viewparams->bRedrawGameUI = 1; | |
2693 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
2694 } | |
2695 } | |
2696 } | |
2697 } | |
2698 | |
2699 //----- (00494820) -------------------------------------------------------- | |
758 | 2700 unsigned int __fastcall _494820_training_time(unsigned int a1) |
0 | 2701 { |
2702 signed int v1; // eax@1 | |
2703 | |
2704 v1 = 5; | |
758 | 2705 if ( a1 % 24 >= 5 ) |
0 | 2706 v1 = 29; |
758 | 2707 return v1 - a1 % 24; |
0 | 2708 } |
2709 | |
2710 //----- (00494836) -------------------------------------------------------- | |
2711 int stru339_spell_sound::_494836(int uSoundID, int a6) | |
2712 { | |
2713 int v3; // esi@1 | |
2714 int result; // eax@1 | |
2715 stru339_spell_sound *v5; // ebx@1 | |
2716 int *v6; // edi@2 | |
2717 unsigned int v7; // eax@3 | |
2718 int v8; // [sp+Ch] [bp-8h]@3 | |
2719 int v9; // [sp+10h] [bp-4h]@2 | |
2720 int a2a; // [sp+1Ch] [bp+8h]@1 | |
2721 | |
2722 v3 = 0; | |
2723 result = word_4EE088_sound_ids[uSoundID]; | |
2724 v5 = this; | |
2725 a2a = word_4EE088_sound_ids[uSoundID]; | |
2726 if ( result ) | |
2727 { | |
2728 v9 = 0; | |
2729 v6 = this->pSoundsOffsets; | |
2730 do | |
2731 { | |
2732 v7 = a2a++; | |
2733 result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6); | |
2734 if ( !result ) | |
2735 break; | |
2736 a6 += 4; | |
2737 result = v8 + 256; | |
2738 *v6 = v3; | |
2739 v3 += result; | |
2740 ++v9; | |
2741 *(v6 - 2) = result; | |
2742 ++v6; | |
2743 } | |
2744 while ( v9 < 2 ); | |
2745 } | |
2746 return result; | |
2747 } | |
2748 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
2749 | |
2750 //----- (00494AED) -------------------------------------------------------- | |
130 | 2751 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression) |
0 | 2752 { |
2753 unsigned int _uNumFrames; // edx@1 | |
2754 unsigned int result; // eax@1 | |
2755 PlayerFrame *v4; // ecx@2 | |
2756 | |
2757 _uNumFrames = this->uNumFrames; | |
2758 result = 0; | |
2759 if ( (signed int)this->uNumFrames <= 0 ) | |
2760 { | |
2761 LABEL_5: | |
2762 result = 0; | |
2763 } | |
2764 else | |
2765 { | |
2766 v4 = this->pFrames; | |
130 | 2767 while ( v4->expression != expression ) |
0 | 2768 { |
2769 ++result; | |
2770 ++v4; | |
2771 if ( (signed int)result >= (signed int)_uNumFrames ) | |
2772 goto LABEL_5; | |
2773 } | |
2774 } | |
2775 return result; | |
2776 } | |
2777 | |
2778 //----- (00494B10) -------------------------------------------------------- | |
2779 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID) | |
2780 { | |
2781 unsigned int v3; // esi@1 | |
2782 PlayerFrame *v4; // edi@1 | |
2783 PlayerFrame *v5; // ecx@1 | |
2784 __int16 v6; // dx@2 | |
2785 int v7; // edx@3 | |
2786 char *i; // eax@3 | |
2787 int v9; // ecx@5 | |
2788 PlayerFrame *result; // eax@6 | |
2789 | |
2790 v3 = uFramesetID; | |
2791 v4 = this->pFrames; | |
2792 v5 = &v4[uFramesetID]; | |
2793 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
2794 { | |
2795 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6; | |
2796 for ( i = (char *)&v5->uAnimTime; ; i += 10 ) | |
2797 { | |
2798 v9 = *(short *)i; | |
2799 if ( v7 <= v9 ) | |
2800 break; | |
2801 v7 -= v9; | |
2802 ++v3; | |
2803 } | |
2804 result = &v4[v3]; | |
2805 } | |
2806 else | |
2807 { | |
2808 result = &v4[uFramesetID]; | |
2809 } | |
2810 return result; | |
2811 } | |
2812 | |
2813 //----- (00494B5E) -------------------------------------------------------- | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2814 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4) |
0 | 2815 { |
2816 PlayerFrameTable *v4; // edi@1 | |
2817 int v5; // esi@1 | |
2818 int v6; // eax@2 | |
2819 | |
2820 v4 = this; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2821 v5 = a4 + *pAnimTime; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2822 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
|
2823 { |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2824 *pAnimTime = v5; |
0 | 2825 } |
2826 else | |
2827 { | |
2828 v6 = rand() % 4 + 21; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2829 *pFramesetID = v6; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2830 *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
|
2831 } |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
2832 return &v4->pFrames[*pFramesetID]; |
0 | 2833 } |
2834 | |
2835 //----- (00494BC3) -------------------------------------------------------- | |
2836 void PlayerFrameTable::ToFile() | |
2837 { | |
2838 PlayerFrameTable *v1; // esi@1 | |
2839 FILE *v2; // eax@1 | |
2840 FILE *v3; // edi@1 | |
2841 | |
2842 auto Str = this; | |
2843 | |
2844 v1 = Str; | |
2845 v2 = fopen("data\\dpft.bin", "wb"); | |
2846 v3 = v2; | |
2847 if ( !v2 ) | |
2848 Abortf("Unable to save dpft.bin!"); | |
2849 fwrite(v1, 4u, 1u, v2); | |
2850 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3); | |
2851 fclose(v3); | |
2852 } | |
2853 | |
2854 //----- (00494C0F) -------------------------------------------------------- | |
2855 void PlayerFrameTable::FromFile(void *pSerialized) | |
2856 { | |
2857 uNumFrames = *(int *)pSerialized; | |
2858 pFrames = (PlayerFrame *)pAllocator->AllocNamedChunk(pFrames, 10 * uNumFrames, "P Frames"); | |
2859 memcpy(pFrames, (char *)pSerialized + 4, 10 * uNumFrames); | |
2860 } | |
2861 | |
2862 //----- (00494C5A) -------------------------------------------------------- | |
2863 int PlayerFrameTable::FromFileTxt(const char *Args) | |
2864 { | |
2865 PlayerFrameTable *v2; // ebx@1 | |
2866 FILE *v3; // eax@1 | |
2867 int v4; // esi@3 | |
2868 void *v5; // eax@10 | |
2869 FILE *v6; // ST0C_4@12 | |
2870 char *i; // eax@12 | |
2871 __int16 v8; // ax@15 | |
2872 const char *v9; // ST10_4@15 | |
2873 unsigned __int16 v10; // ax@15 | |
2874 const char *v11; // ST0C_4@15 | |
2875 int j; // esi@15 | |
2876 int v13; // eax@17 | |
2877 int v14; // edx@22 | |
2878 int v15; // ecx@23 | |
2879 int v16; // eax@24 | |
2880 signed int k; // eax@27 | |
2881 PlayerFrame *v18; // edx@28 | |
2882 int v19; // esi@28 | |
2883 int l; // ecx@29 | |
2884 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
2885 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4 | |
2886 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4 | |
2887 int v25; // [sp+2F8h] [bp-Ch]@3 | |
2888 int v26; // [sp+2FCh] [bp-8h]@3 | |
2889 FILE *File; // [sp+300h] [bp-4h]@1 | |
2890 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
2891 | |
2892 v2 = this; | |
2893 //TileTable::dtor((TileTable *)this); | |
2894 v3 = fopen(Args, "r"); | |
2895 File = v3; | |
2896 if ( !v3 ) | |
2897 Abortf("PlayerFrameTable::load - Unable to open file: %s.", Args); | |
2898 v4 = 0; | |
2899 v25 = 0; | |
2900 v26 = 1; | |
2901 if ( fgets(&Buf, 490, v3) ) | |
2902 { | |
2903 do | |
2904 { | |
2905 *strchr(&Buf, 10) = 0; | |
703 | 2906 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2907 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
2908 { | |
2909 if ( v24.uPropCount < 3 ) | |
0 | 2910 Abortf("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26); |
2911 ++v25; | |
2912 } | |
2913 ++v26; | |
2914 } | |
2915 while ( fgets(&Buf, 490, File) ); | |
2916 v4 = v25; | |
2917 } | |
2918 v2->uNumFrames = v4; | |
2919 v5 = pAllocator->AllocNamedChunk(v2->pFrames, 10 * v4, "P Frames"); | |
2920 v2->pFrames = (PlayerFrame *)v5; | |
2921 if ( !v5 ) | |
2922 Abortf("PlayerFrameTable::load - Out of Memory!"); | |
2923 v6 = File; | |
2924 v2->uNumFrames = 0; | |
2925 fseek(v6, 0, 0); | |
2926 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
2927 { | |
2928 *strchr(&Buf, 10) = 0; | |
703 | 2929 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24)); |
701 | 2930 if ( v24.uPropCount && *v24.pProperties[0] != 47 ) |
0 | 2931 { |
2932 v8 = atoi(v24.pProperties[0]); | |
2933 v9 = v24.pProperties[1]; | |
130 | 2934 v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8; |
0 | 2935 v10 = atoi(v9); |
2936 v11 = v24.pProperties[2]; | |
2937 v2->pFrames[v2->uNumFrames].uTextureID = v10; | |
2938 v2->pFrames[v2->uNumFrames].uAnimTime = atoi(v11); | |
2939 v2->pFrames[v2->uNumFrames].uAnimLength = 0; | |
2940 v2->pFrames[v2->uNumFrames].uFlags = 0; | |
701 | 2941 for ( j = 3; j < v24.uPropCount; ++j ) |
0 | 2942 { |
1104 | 2943 if ( !_stricmp(v24.pProperties[j], "New") ) |
0 | 2944 { |
2945 v13 = (int)&v2->pFrames[v2->uNumFrames].uFlags; | |
2946 *(char *)v13 |= 4u; | |
2947 } | |
2948 } | |
2949 ++v2->uNumFrames; | |
2950 } | |
2951 } | |
2952 fclose(File); | |
2953 v14 = 0; | |
2954 if ( (signed int)(v2->uNumFrames - 1) > 0 ) | |
2955 { | |
2956 v15 = 0; | |
2957 do | |
2958 { | |
2959 v16 = (int)&v2->pFrames[v15]; | |
2960 if ( !(*(char *)(v16 + 18) & 4) ) | |
2961 *(char *)(v16 + 8) |= 1u; | |
2962 ++v14; | |
2963 ++v15; | |
2964 } | |
2965 while ( v14 < (signed int)(v2->uNumFrames - 1) ); | |
2966 } | |
2967 for ( k = 0; k < (signed int)v2->uNumFrames; *(short *)(Argsa + 6) = v19 ) | |
2968 { | |
2969 v18 = v2->pFrames; | |
2970 Argsa = (int)&v18[k]; | |
2971 v19 = *(short *)(Argsa + 4); | |
2972 if ( *(char *)(Argsa + 8) & 1 ) | |
2973 { | |
2974 ++k; | |
2975 for ( l = (int)&v18[k]; *(char *)(l + 8) & 1; l += 10 ) | |
2976 { | |
2977 v19 += *(short *)(l + 4); | |
2978 ++k; | |
2979 } | |
2980 LOWORD(v19) = v18[k].uAnimTime + v19; | |
2981 } | |
2982 ++k; | |
2983 } | |
2984 return 1; | |
2985 } | |
2986 | |
2987 //----- (00494F3A) -------------------------------------------------------- | |
2988 unsigned int IconFrameTable::FindIcon(const char *pIconName) | |
2989 { | |
2990 IconFrameTable *v2; // esi@1 | |
2991 int v3; // ebx@1 | |
2992 unsigned int uID; // edi@1 | |
2993 unsigned int result; // eax@4 | |
2994 | |
2995 v2 = this; | |
2996 v3 = 0; | |
2997 uID = 0; | |
2998 if ( (signed int)this->uNumIcons <= 0 ) | |
2999 { | |
3000 LABEL_4: | |
3001 result = 0; | |
3002 } | |
3003 else | |
3004 { | |
1104 | 3005 while ( _stricmp(pIconName, v2->pIcons[v3].pAnimationName) ) |
0 | 3006 { |
3007 ++uID; | |
3008 ++v3; | |
3009 if ( (signed int)uID >= (signed int)v2->uNumIcons ) | |
3010 goto LABEL_4; | |
3011 } | |
3012 result = uID; | |
3013 } | |
3014 return result; | |
3015 } | |
3016 | |
3017 //----- (00494F70) -------------------------------------------------------- | |
3018 IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) | |
3019 { | |
3020 IconFrame *v3; // edi@1 | |
3021 IconFrame *v4; // ecx@1 | |
3022 __int16 v5; // dx@2 | |
3023 int v6; // edx@3 | |
3024 unsigned int v7; // eax@3 | |
3025 char *i; // ecx@3 | |
3026 int v9; // esi@5 | |
3027 IconFrame *result; // eax@6 | |
3028 | |
3029 v3 = this->pIcons; | |
3030 v4 = &v3[uIconID]; | |
3031 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 ) | |
3032 { | |
3033 v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)v5; | |
3034 v7 = uIconID; | |
3035 for ( i = (char *)&v4->uAnimTime; ; i += 32 ) | |
3036 { | |
3037 v9 = *(short *)i; | |
3038 if ( v6 <= v9 ) | |
3039 break; | |
3040 v6 -= v9; | |
3041 ++v7; | |
3042 } | |
3043 result = &v3[v7]; | |
3044 } | |
3045 else | |
3046 { | |
3047 result = &v3[uIconID]; | |
3048 } | |
3049 return result; | |
3050 } | |
3051 | |
3052 //----- (00494FBF) -------------------------------------------------------- | |
3053 void IconFrameTable::InitializeAnimation(unsigned int uIconID) | |
3054 { | |
3055 IconFrameTable *v2; // esi@1 | |
3056 unsigned int v3; // edi@3 | |
3057 const char *i; // eax@3 | |
3058 IconFrame *v5; // eax@5 | |
3059 | |
3060 v2 = this; | |
3061 if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) | |
3062 { | |
3063 v3 = uIconID; | |
3064 for ( i = this->pIcons[uIconID].pTextureName; ; i = v5[v3].pTextureName ) | |
3065 { | |
3066 v2->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); | |
3067 v5 = v2->pIcons; | |
3068 if ( !(v5[v3].uFlags & 1) ) | |
3069 break; | |
3070 ++v3; | |
3071 } | |
3072 } | |
3073 } | |
3074 | |
3075 //----- (0049500A) -------------------------------------------------------- | |
3076 void IconFrameTable::ToFile() | |
3077 { | |
3078 IconFrameTable *v1; // esi@1 | |
3079 FILE *v2; // eax@1 | |
3080 FILE *v3; // edi@1 | |
3081 | |
3082 auto Str = this; | |
3083 | |
3084 v1 = Str; | |
3085 v2 = fopen("data\\dift.bin", "wb"); | |
3086 v3 = v2; | |
3087 if ( !v2 ) | |
3088 Abortf("Unable to save dift.bin!"); | |
3089 fwrite(v1, 4u, 1u, v2); | |
3090 fwrite(v1->pIcons, 0x20u, v1->uNumIcons, v3); | |
3091 fclose(v3); | |
3092 } | |
3093 | |
3094 //----- (00495056) -------------------------------------------------------- | |
3095 void IconFrameTable::FromFile(void *pSerialized) | |
3096 { | |
3097 uNumIcons = *(int *)pSerialized; | |
3098 pIcons = (IconFrame *)pAllocator->AllocNamedChunk(pIcons, 32 * uNumIcons, "I Frames"); | |
3099 memcpy(pIcons, (char *)pSerialized + 4, 32 * uNumIcons); | |
3100 } | |
3101 | |
3102 //----- (0049509D) -------------------------------------------------------- | |
3103 int IconFrameTable::FromFileTxt(const char *Args) | |
3104 { | |
3105 IconFrameTable *v2; // ebx@1 | |
3106 FILE *v3; // eax@1 | |
3107 int v4; // esi@3 | |
3108 void *v5; // eax@10 | |
3109 FILE *v6; // ST0C_4@12 | |
3110 char *i; // eax@12 | |
3111 const char *v8; // ST00_4@15 | |
3112 int v9; // eax@16 | |
3113 int v10; // edx@20 | |
3114 int v11; // ecx@21 | |
3115 int v12; // eax@22 | |
3116 signed int j; // edx@25 | |
3117 IconFrame *v14; // ecx@26 | |
3118 int v15; // esi@26 | |
3119 int k; // eax@27 | |
3120 signed int result; // eax@11 | |
3121 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
3122 FrameTableTxtLine v19; // [sp+200h] [bp-104h]@4 | |
3123 FrameTableTxtLine v20; // [sp+27Ch] [bp-88h]@4 | |
3124 int v21; // [sp+2F8h] [bp-Ch]@3 | |
3125 int v22; // [sp+2FCh] [bp-8h]@3 | |
3126 FILE *File; // [sp+300h] [bp-4h]@1 | |
3127 int Argsa; // [sp+30Ch] [bp+8h]@26 | |
3128 | |
3129 v2 = this; | |
3130 //TileTable::dtor((TileTable *)this); | |
3131 v3 = fopen(Args, "r"); | |
3132 File = v3; | |
3133 if ( !v3 ) | |
3134 Abortf("IconFrameTable::load - Unable to open file: %s.", Args); | |
3135 v4 = 0; | |
3136 v21 = 0; | |
3137 v22 = 1; | |
3138 if ( fgets(&Buf, 490, v3) ) | |
3139 { | |
3140 do | |
3141 { | |
3142 *strchr(&Buf, 10) = 0; | |
3143 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3144 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
3145 { | |
3146 if ( v20.uPropCount < 3 ) | |
0 | 3147 Abortf("IconFrameTable::loadText, too few arguments, %s line %i.", Args, v22); |
3148 ++v21; | |
3149 } | |
3150 ++v22; | |
3151 } | |
3152 while ( fgets(&Buf, 490, File) ); | |
3153 v4 = v21; | |
3154 } | |
3155 v2->uNumIcons = v4; | |
3156 v5 = pAllocator->AllocNamedChunk(v2->pIcons, 32 * v4, "I Frames"); | |
3157 v2->pIcons = (IconFrame *)v5; | |
3158 if ( v5 ) | |
3159 { | |
3160 v6 = File; | |
3161 v2->uNumIcons = 0; | |
3162 fseek(v6, 0, 0); | |
3163 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
3164 { | |
3165 *strchr(&Buf, 10) = 0; | |
3166 memcpy(&v20, frame_table_txt_parser(&Buf, &v19), sizeof(v20)); | |
701 | 3167 if ( v20.uPropCount && *v20.pProperties[0] != 47 ) |
0 | 3168 { |
3169 strcpy(v2->pIcons[v2->uNumIcons].pAnimationName, v20.pProperties[0]); | |
3170 strcpy(v2->pIcons[v2->uNumIcons].pTextureName, v20.pProperties[1]); | |
3171 v8 = v20.pProperties[2]; | |
3172 v2->pIcons[v2->uNumIcons].uFlags = 0; | |
1104 | 3173 if ( !_stricmp(v8, "new") ) |
0 | 3174 { |
3175 v9 = (int)&v2->pIcons[v2->uNumIcons].uFlags; | |
3176 *(char *)v9 |= 4u; | |
3177 } | |
3178 v2->pIcons[v2->uNumIcons].uAnimTime = atoi(v20.pProperties[3]); | |
3179 v2->pIcons[v2->uNumIcons].uAnimLength = 0; | |
3180 v2->pIcons[v2->uNumIcons++].uTextureID = 0; | |
3181 } | |
3182 } | |
3183 fclose(File); | |
3184 v10 = 0; | |
3185 if ( (signed int)(v2->uNumIcons - 1) > 0 ) | |
3186 { | |
3187 v11 = 0; | |
3188 do | |
3189 { | |
3190 v12 = (int)&v2->pIcons[v11]; | |
3191 if ( !(*(char *)(v12 + 60) & 4) ) | |
3192 *(char *)(v12 + 28) |= 1u; | |
3193 ++v10; | |
3194 ++v11; | |
3195 } | |
3196 while ( v10 < (signed int)(v2->uNumIcons - 1) ); | |
3197 } | |
3198 for ( j = 0; j < (signed int)v2->uNumIcons; *(short *)(Argsa + 26) = v15 ) | |
3199 { | |
3200 v14 = v2->pIcons; | |
3201 Argsa = (int)&v14[j]; | |
3202 v15 = *(short *)(Argsa + 24); | |
3203 if ( *(char *)(Argsa + 28) & 1 ) | |
3204 { | |
3205 ++j; | |
3206 for ( k = (int)&v14[j]; *(char *)(k + 28) & 1; k += 32 ) | |
3207 { | |
3208 v15 += *(short *)(k + 24); | |
3209 ++j; | |
3210 } | |
3211 LOWORD(v15) = v14[j].uAnimTime + v15; | |
3212 } | |
3213 ++j; | |
3214 } | |
3215 result = 1; | |
3216 } | |
3217 else | |
3218 { | |
3219 fclose(File); | |
3220 result = 0; | |
3221 } | |
3222 return result; | |
3223 } | |
3224 | |
3225 //----- (00495366) -------------------------------------------------------- | |
3226 char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2) | |
3227 { | |
3228 int v2; // edi@1 | |
3229 int v3; // edx@2 | |
3230 int v4; // esi@3 | |
3231 int v5; // ebx@5 | |
3232 signed int v7; // [sp+Ch] [bp-14h]@1 | |
3233 signed int v8; // [sp+10h] [bp-10h]@1 | |
3234 int **v9; // [sp+14h] [bp-Ch]@4 | |
3235 signed int v10; // [sp+18h] [bp-8h]@3 | |
3236 unsigned __int8 v11; // [sp+1Ch] [bp-4h]@1 | |
3237 | |
3238 v2 = a1; | |
3239 v11 = a2; | |
3240 v8 = 0; | |
3241 v7 = 0; | |
3242 if ( dword_AE336C == a1 ) | |
3243 { | |
3244 v3 = dword_AE3370; | |
3245 } | |
3246 else | |
3247 { | |
3248 v4 = a2; | |
3249 dword_AE336C = a1; | |
3250 v10 = 0; | |
3251 if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 ) | |
3252 goto LABEL_17; | |
3253 v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4); | |
3254 do | |
3255 { | |
3256 v5 = tolower(*(char *)*v9); | |
3257 if ( v5 == tolower(v2) ) | |
3258 { | |
3259 if ( v8 ) | |
3260 v7 = v10; | |
3261 else | |
3262 v8 = v10; | |
3263 } | |
3264 ++v10; | |
3265 v9 += 2; | |
3266 } | |
3267 while ( v10 < (signed int)pNPCStats->uNumNPCNames[v4] ); | |
3268 if ( v8 && v8 != v7 ) | |
3269 v3 = v8 + rand() % (v7 - v8); | |
3270 else | |
3271 LABEL_17: | |
3272 v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4]; | |
3273 } | |
3274 dword_AE3370 = v3; | |
3275 return pNPCStats->pNPCNames[0][v11 + 2 * v3]; | |
3276 } | |
3277 // AE336C: using guessed type int dword_AE336C; | |
3278 // AE3370: using guessed type int dword_AE3370; | |
3279 | |
3280 //----- (00495430) -------------------------------------------------------- | |
607 | 3281 char * GetReputationString( signed int a1 ) |
3282 { | |
566 | 3283 if (a1 >= 25) |
3284 return pGlobalTXT_LocalizationStrings[379]; // Hated | |
3285 else if (a1 >= 6) | |
3286 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly | |
3287 else if (a1 >= -5) | |
3288 return pGlobalTXT_LocalizationStrings[399]; // Neutral; | |
3289 else if (a1 >= -24) | |
3290 return pGlobalTXT_LocalizationStrings[402]; // Friendly | |
0 | 3291 else |
566 | 3292 return pGlobalTXT_LocalizationStrings[434]; // Respected; |
0 | 3293 } |
3294 | |
3295 //----- (00495461) -------------------------------------------------------- | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3296 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) |
0 | 3297 { |
3298 unsigned __int8 v6; // bl@1 | |
3299 Player *pPlayer; // ebx@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3300 //NPCData *v9; // eax@4 |
250 | 3301 //size_t v10; // eax@6 |
0 | 3302 char *v11; // esi@7 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3303 //int v12; // edx@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3304 //ItemGen *v13; // edi@7 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3305 //char v14; // cl@8 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3306 //char *v15; // ecx@10 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3307 //int v16; // edx@10 |
0 | 3308 int v17; // eax@10 |
3309 signed __int64 v18; // qax@18 | |
3310 unsigned int v19; // edi@32 | |
3311 unsigned __int8 *v20; // ebx@32 | |
3312 int v21; // ecx@34 | |
3313 __int16 v22; // ax@34 | |
3314 int v23; // edx@39 | |
3315 int v24; // eax@39 | |
3316 int v25; // eax@45 | |
3317 float *v26; // esi@68 | |
3318 float v27; // ST18_4@68 | |
3319 signed int v28; // eax@68 | |
3320 int v29; // eax@68 | |
3321 float v30; // ST18_4@72 | |
3322 signed int v31; // eax@72 | |
3323 float v32; // ST18_4@74 | |
3324 signed int v33; // eax@74 | |
3325 double v34; // st7@75 | |
3326 float v35; // ST18_4@76 | |
3327 signed int v36; // eax@76 | |
3328 float *v37; // esi@78 | |
3329 float v38; // ST18_4@78 | |
3330 int v39; // eax@78 | |
3331 float v40; // ST18_4@82 | |
3332 int v41; // eax@82 | |
3333 float v42; // ST18_4@83 | |
3334 int v43; // eax@83 | |
3335 float v44; // ST18_4@85 | |
3336 int v45; // eax@85 | |
3337 const char *v46; // eax@86 | |
3338 unsigned int v47; // eax@87 | |
3339 float v48; // ST18_4@97 | |
3340 __int64 v49; // ST14_8@107 | |
3341 int v50; // eax@107 | |
3342 int v51; // eax@108 | |
3343 Player *v52; // eax@109 | |
3344 int v53; // [sp-4h] [bp-13Ch]@107 | |
3345 int v54; // [sp+0h] [bp-138h]@107 | |
3346 __int16 v55[56]; // [sp+10h] [bp-128h]@34 | |
351 | 3347 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107 |
3348 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115 | |
0 | 3349 char a1[100]; // [sp+B8h] [bp-80h]@3 |
3350 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3351 //size_t v60; // [sp+120h] [bp-18h]@3 |
249 | 3352 //Player *v61; // [sp+124h] [bp-14h]@3 |
3353 //char *Str; // [sp+128h] [bp-10h]@1 | |
0 | 3354 int v63; // [sp+12Ch] [bp-Ch]@32 |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3355 //int v64; // [sp+130h] [bp-8h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3356 //NPCData *v65; // [sp+134h] [bp-4h]@6 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3357 //int packed; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3358 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3359 |
0 | 3360 |
3361 v6 = uPlayerID; | |
249 | 3362 //Str = lpsz; |
0 | 3363 if ( IsBadStringPtrA(lpsz, 1u) ) |
3364 return "Invalid String Passed"; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3365 |
0 | 3366 a1[0] = 0; |
3367 pPlayer = &pParty->pPlayers[v6]; | |
949 | 3368 v59 = TargetColor(255, 255, 155); |
249 | 3369 //v61 = pPlayer; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3370 memset(pTmpBuf2, 0, sizeof(pTmpBuf2)); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3371 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3372 NPCData *npc = nullptr; |
0 | 3373 if ( dword_5C35D4 ) |
248 | 3374 { |
463 | 3375 //__debugbreak(); // fix |
459 | 3376 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
|
3377 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3378 else |
602 | 3379 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3380 //v65 = v9; |
250 | 3381 //v10 = 0; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3382 //v64 = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3383 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3384 //int i = 0; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3385 //if ( (signed int)v60 > 0 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3386 v11 = a4; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3387 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3388 auto len = strlen(lpsz); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3389 for (int i = 0, dst = 0; i < len; ++i) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3390 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3391 //v12 = v64; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3392 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3393 //while ( 1 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3394 //{ |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3395 char c = lpsz[i]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3396 if (c != '%') |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3397 pTmpBuf2[dst++] = c; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3398 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3399 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3400 //v15 = &lpsz[v12 + 1]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3401 //v16 = (unsigned __int8)lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3402 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3403 //v17 = packed - 528;// 10 * '0' + '0' |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3404 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
|
3405 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3406 switch ( v17 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3407 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3408 case 1: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3409 v11 = npc->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3410 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3411 case 2: |
0 | 3412 v11 = pPlayer->pName; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3413 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3414 case 3: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3415 case 4: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3416 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3417 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3418 case 5: |
0 | 3419 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; |
3420 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" | |
3421 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) | |
3422 { | |
3423 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) | |
3424 { | |
3425 if ( v18 < 20 ) | |
3426 v11 = pGlobalTXT_LocalizationStrings[396];// "day" | |
3427 } | |
3428 else | |
3429 { | |
3430 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" | |
3431 } | |
3432 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3433 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3434 case 6: |
0 | 3435 if ( pPlayer->uSex ) |
3436 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" | |
3437 else | |
3438 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3439 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3440 case 7: |
0 | 3441 if ( pPlayer->uSex ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3442 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3443 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3444 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3445 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3446 case 8: |
0 | 3447 v19 = 0; |
3448 v63 = 0; | |
484 | 3449 v20 = (unsigned __int8 *)pPlayer->_guilds_member_bits; |
0 | 3450 do |
3451 { | |
3452 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[v19]) ) | |
3453 { | |
3454 v21 = v63; | |
3455 v22 = word_4EE150[v19]; | |
3456 ++v63; | |
3457 v55[v21] = v22; | |
3458 } | |
3459 ++v19; | |
3460 } | |
3461 while ( v19 < 28 ); | |
3462 if ( v63 ) | |
3463 { | |
3464 v23 = rand() % v63; | |
3465 v24 = dword_A74CDC; | |
3466 if ( dword_A74CDC == -1 ) | |
3467 { | |
3468 v24 = v23; | |
3469 dword_A74CDC = v23; | |
3470 } | |
492 | 3471 v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; |
0 | 3472 } |
3473 else | |
3474 { | |
3475 v11 = (char *)pNPCTopics[55].pText; | |
3476 } | |
249 | 3477 //pPlayer = v61; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3478 //v13 = a3; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3479 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3480 case 9: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3481 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3482 v11 = pGlobalTXT_LocalizationStrings[384];// "her" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3483 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3484 v11 = pGlobalTXT_LocalizationStrings[383];// "his" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3485 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3486 case 10: |
0 | 3487 if ( pPlayer->uSex ) |
3488 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" | |
3489 else | |
3490 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3491 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3492 case 11: |
0 | 3493 v25 = GetPartyReputation(); |
3494 goto LABEL_46; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3495 case 12: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3496 v25 = npc->rep; |
0 | 3497 LABEL_46: |
3498 if ( v25 >= 25 ) | |
3499 { | |
3500 v11 = pGlobalTXT_LocalizationStrings[379]; | |
3501 } | |
3502 else | |
3503 { | |
3504 if ( v25 < 6 ) | |
3505 { | |
3506 if ( v25 >= -5 ) | |
3507 { | |
3508 v11 = pGlobalTXT_LocalizationStrings[399]; | |
3509 } | |
3510 else | |
3511 { | |
3512 if ( v25 < -24 ) | |
3513 v11 = pGlobalTXT_LocalizationStrings[434]; | |
3514 else | |
3515 v11 = pGlobalTXT_LocalizationStrings[402]; | |
3516 } | |
3517 } | |
3518 else | |
3519 { | |
3520 v11 = pGlobalTXT_LocalizationStrings[392]; | |
3521 } | |
3522 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3523 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3524 case 13: |
0 | 3525 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3526 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3527 case 14: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3528 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3529 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3530 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3531 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3532 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
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 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3535 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3536 case 15: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3537 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3538 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3539 _continue_strcat: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3540 strcat(pTmpBuf2, v11); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3541 dst = strlen(pTmpBuf2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3542 //v64 += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3543 i += 2; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3544 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3545 break; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3546 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3547 case 16: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3548 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3549 if ( npc->uSex ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3550 v11 = pGlobalTXT_LocalizationStrings[391];// "sister" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3551 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3552 v11 = pGlobalTXT_LocalizationStrings[390];// "brother" |
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 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3555 case 17: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3556 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3557 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
|
3558 if (!pay_percentage) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3559 pay_percentage = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3560 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3561 sprintf(a1, "%lu", pay_percentage); |
250 | 3562 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3563 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3564 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3565 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3566 case 18: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3567 case 19: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3568 case 20: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3569 case 21: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3570 case 22: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3571 case 26: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3572 _continue_strncpy: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3573 strncpy(a1, lpsz + i + 1, 2); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3574 v51 = atoi(a1); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3575 sprintf(a1, "%lu", v51); |
0 | 3576 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3577 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3578 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3579 case 23: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3580 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3581 v47 = pMapStats->GetMapInfo(pCurrentMapName); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3582 if ( v47 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3583 v11 = pMapStats->pInfos[v47].pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3584 else |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3585 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown" |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3586 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3587 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3588 case 24: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3589 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3590 v46 = a3->GetDisplayName(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3591 sprintf(a1, format_4E2D80, v59, v46); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3592 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3593 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3594 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3595 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3596 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3597 case 25: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3598 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3599 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3600 v38 = *v37; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3601 v39 = a3->GetValue(); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3602 v29 = pPlayer->_4B8233(v39, v38); |
0 | 3603 switch ( a5 ) |
3604 { | |
3605 case 3: | |
3606 v44 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3607 v45 = a3->GetValue(); |
0 | 3608 v29 = pPlayer->_4B8213(v45, v44); |
3609 break; | |
3610 case 4: | |
3611 v29 = pPlayer->_4B824B(*v37); | |
3612 break; | |
3613 case 5: | |
3614 v42 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3615 v43 = a3->GetValue(); |
0 | 3616 v29 = pPlayer->_4B8265(v43, v42); |
3617 break; | |
3618 case 6: | |
3619 v40 = *v37; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3620 v41 = a3->GetValue(); |
0 | 3621 v29 = pPlayer->_4B8213(v41, v40) / 2; |
3622 break; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3623 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3624 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3625 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3626 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3627 case 27: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3628 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3629 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
0 | 3630 v27 = *v26; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3631 v28 = a3->GetValue(); |
749 | 3632 v29 = pPlayer->GetBuyingPrice(v28, v27); |
0 | 3633 if ( a5 == 3 ) |
3634 { | |
3635 v35 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3636 v36 = a3->GetValue(); |
917 | 3637 v29 = pPlayer->GetPriceSell(v36, v35); |
315 | 3638 if (a3->Broken()) |
0 | 3639 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3640 goto _continue_sprintf; |
0 | 3641 } |
3642 if ( a5 != 4 ) | |
3643 { | |
3644 if ( a5 == 5 ) | |
3645 { | |
3646 v32 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3647 v33 = a3->GetValue(); |
916 | 3648 v29 = pPlayer->GetPriceRepair(v33, v32); |
0 | 3649 } |
3650 else | |
3651 { | |
3652 if ( a5 == 6 ) | |
3653 { | |
3654 v30 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3655 v31 = a3->GetValue(); |
917 | 3656 v29 = pPlayer->GetPriceSell(v31, v30) / 2; |
315 | 3657 if (a3->Broken()) |
0 | 3658 v29 = 1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3659 if (!v29) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3660 v29 = 1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3661 goto _continue_sprintf; |
0 | 3662 } |
3663 } | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3664 _continue_sprintf: |
0 | 3665 sprintf(a1, "%lu", v29); |
250 | 3666 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3667 goto _continue_strcat; |
0 | 3668 } |
3669 v34 = *v26; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3670 |
0 | 3671 v48 = v34; |
916 | 3672 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3673 goto _continue_sprintf; |
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 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3676 case 28: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3677 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3678 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3679 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3680 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3681 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3682 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3683 case 29: |
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 //v34 = p2DEvents_minus1__20[13 * (signed int)a4]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3686 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3687 v48 = v34; |
916 | 3688 v29 = pPlayer->GetPriceIdentification(v48); |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3689 goto _continue_sprintf; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3690 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3691 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3692 case 30: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3693 { |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3694 if ( !a6 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3695 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3696 sub_493F79(&v57, *a6); |
351 | 3697 v54 = v57.field_18_expire_year; |
3698 v53 = v57.field_C_expire_day + 1; | |
3699 v50 = v57.field_14_exprie_month; | |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3700 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3701 v11 = a1; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3702 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3703 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3704 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3705 case 31: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3706 case 32: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3707 case 33: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3708 case 34: |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3709 v52 = &pParty->pPlayers[v17 - 31]; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3710 v11 = v52->pName; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3711 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3712 |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3713 default: |
0 | 3714 if ( v17 <= 50 || v17 > 70 ) |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3715 goto _continue_strncpy; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3716 if ( v17 - 51 >= 20 ) |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3717 goto _continue_strcat; |
484 | 3718 v49 = pParty->field_3C._s_times[v17-51]; |
3719 | |
0 | 3720 sub_493F79(&v56, v49); |
351 | 3721 v54 = v56.field_18_expire_year; |
3722 v53 = v56.field_C_expire_day + 1; | |
3723 v50 = v56.field_14_exprie_month; | |
0 | 3724 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); |
250 | 3725 v11 = a1; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3726 goto _continue_strcat; |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3727 } |
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
3728 } |
0 | 3729 } |
3730 return pTmpBuf2; | |
3731 } | |
3732 | |
3733 //----- (0049B04D) -------------------------------------------------------- | |
734 | 3734 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3) |
0 | 3735 { |
734 | 3736 //stru154 *v3; // edi@1 |
3737 //signed int v4; // eax@1 | |
3738 //signed int result; // eax@9 | |
3739 //signed int v6; // [sp-8h] [bp-18h]@8 | |
0 | 3740 Vec3_float_ v; // [sp+4h] [bp-Ch]@1 |
734 | 3741 float v7; |
0 | 3742 |
3743 v.x = 0.0; | |
3744 v.y = 0.0; | |
3745 v.z = 0.0; | |
734 | 3746 GetFacePlane(a2, a3, &v, &v7); |
3747 | |
3748 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f) | |
3749 polygonType = POLYGON_VerticalWall; | |
3750 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f && | |
3751 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f) | |
3752 polygonType = POLYGON_Floor; | |
0 | 3753 else |
734 | 3754 polygonType = POLYGON_InBetweenFloorAndWall; |
3755 | |
3756 face_plane.vNormal.x = v.x; | |
3757 face_plane.vNormal.y = v.y; | |
3758 face_plane.vNormal.z = v.z; | |
3759 face_plane.dist = v7; | |
0 | 3760 } |
3761 | |
3762 //----- (0049B0C9) -------------------------------------------------------- | |
734 | 3763 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist) |
0 | 3764 { |
734 | 3765 if (fabsf(pNormal->z) < 1e-6f) |
3766 polygonType = POLYGON_VerticalWall; | |
3767 else if (fabsf(pNormal->x) < 1e-6f && | |
3768 fabsf(pNormal->y) < 1e-6f) | |
3769 polygonType = POLYGON_Floor; | |
0 | 3770 else |
734 | 3771 polygonType = POLYGON_InBetweenFloorAndWall; |
3772 | |
3773 face_plane.vNormal.x = pNormal->x; | |
3774 face_plane.dist = dist; | |
3775 face_plane.vNormal.y = pNormal->y; | |
3776 face_plane.vNormal.z = pNormal->z; | |
0 | 3777 } |
3778 | |
3779 //----- (0049B13D) -------------------------------------------------------- | |
734 | 3780 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist) |
0 | 3781 { |
3782 ODMFace *v5; // ebx@1 | |
734 | 3783 //int v6; // eax@1 |
3784 //unsigned __int16 *v7; // ebx@2 | |
3785 //Vec3_int_ *v8; // eax@3 | |
0 | 3786 Vec3_int_ *v9; // ecx@3 |
734 | 3787 //double v10; // st7@3 |
3788 //int v11; // ecx@3 | |
0 | 3789 Vec3_int_ *v12; // ecx@3 |
734 | 3790 //double v13; // st7@3 |
3791 //double v14; // st6@3 | |
3792 //double v15; // st5@3 | |
3793 //int v16; // ecx@3 | |
0 | 3794 Vec3_int_ *v17; // eax@3 |
734 | 3795 //double v18; // st5@3 |
0 | 3796 Vec3_float_ *v19; // eax@3 |
734 | 3797 //int result; // eax@8 |
3798 //float v21; // ecx@10 | |
3799 //double v22; // st7@10 | |
3800 //double v23; // st6@10 | |
0 | 3801 Vec3_float_ v2; // [sp+4h] [bp-64h]@3 |
734 | 3802 //float v25; // [sp+18h] [bp-50h]@3 |
0 | 3803 float v26; // [sp+1Ch] [bp-4Ch]@3 |
3804 float v27; // [sp+20h] [bp-48h]@3 | |
3805 float v28; // [sp+24h] [bp-44h]@3 | |
734 | 3806 //float v29; // [sp+2Ch] [bp-3Ch]@3 |
3807 //float v30; // [sp+30h] [bp-38h]@3 | |
3808 //float v31; // [sp+34h] [bp-34h]@3 | |
3809 //float v32; // [sp+38h] [bp-30h]@3 | |
3810 //float v33; // [sp+3Ch] [bp-2Ch]@3 | |
0 | 3811 Vec3_float_ v1; // [sp+40h] [bp-28h]@1 |
734 | 3812 //float v35; // [sp+4Ch] [bp-1Ch]@3 |
3813 //float v36; // [sp+50h] [bp-18h]@3 | |
3814 //float v37; // [sp+54h] [bp-14h]@3 | |
0 | 3815 Vec3_float_ v38; // [sp+58h] [bp-10h]@3 |
734 | 3816 //int v39; // [sp+64h] [bp-4h]@1 |
3817 | |
3818 //v39 = 0; | |
0 | 3819 v1.x = 0.0; |
3820 v5 = pFace; | |
734 | 3821 //v6 = pFace->uNumVertices; |
0 | 3822 v1.y = 0.0; |
3823 v1.z = 0.0; | |
734 | 3824 |
3825 if (pFace->uNumVertices >= 2) | |
3826 { | |
3827 int i = 0; | |
3828 while ( i < pFace->uNumVertices - 2 ) | |
3829 { | |
3830 v9 = &pVertices->pVertices[pFace->pVertexIDs[i]]; | |
3831 v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]]; | |
3832 v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]]; | |
1093 | 3833 i++; |
734 | 3834 v1.x = v12->x - v9->x; |
3835 v26 = v17->x - v12->x; | |
3836 v1.y = v12->y - v9->y; | |
3837 v27 = v17->y - v12->y; | |
3838 v1.z = v12->z - v9->z; | |
3839 v28 = v17->z - v12->z; | |
0 | 3840 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28); |
3841 v38.x = v19->x; | |
3842 v38.y = v19->y; | |
3843 v38.z = v19->z; | |
734 | 3844 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0) |
3845 { | |
3846 v38.Normalize(); | |
3847 | |
3848 pOutNormal->x = v38.x; | |
3849 pOutNormal->y = v38.y; | |
3850 pOutNormal->z = v38.z; | |
3851 | |
3852 *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z); | |
3853 return; | |
3854 } | |
3855 } | |
3856 } | |
3857 | |
3858 pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16); | |
3859 pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16); | |
3860 pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16); | |
3861 *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16); | |
0 | 3862 } |
3863 | |
3864 //----- (0049D700) -------------------------------------------------------- | |
3865 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim) | |
3866 { | |
3867 unsigned int v1; // eax@1 | |
3868 int v2; // ecx@1 | |
3869 unsigned int v3; // eax@1 | |
3870 | |
3871 v1 = uDim; | |
3872 v2 = 0; | |
3873 v3 = v1 - 1; | |
3874 while ( v3 & 1 ) | |
3875 { | |
3876 v3 >>= 1; | |
3877 ++v2; | |
3878 } | |
3879 return v3 == 0 ? v2 : 0; | |
3880 } | |
3881 | |
3882 //----- (004A19D8) -------------------------------------------------------- | |
737 | 3883 unsigned int BlendColors(unsigned int a1, unsigned int a2) |
0 | 3884 { |
737 | 3885 /*signed __int64 v2; // ST10_8@1 |
0 | 3886 double v3; // st7@1 |
3887 float v4; // ST24_4@1 | |
3888 double v5; // ST10_8@1 | |
3889 int v6; // ST1C_4@1 | |
3890 float v7; // ST24_4@1 | |
3891 double v8; // ST10_8@1 | |
3892 unsigned __int8 v9; // ST20_1@1 | |
3893 float v10; // ST24_4@1 | |
3894 double v11; // ST10_8@1 | |
3895 float v12; // ST24_4@1 | |
737 | 3896 double v13; // ST08_8@1*/ |
3897 | |
3898 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f * | |
3899 (a2 >> 24) / 255.0f * 255.0f), | |
3900 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f * | |
3901 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f), | |
3902 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f * | |
3903 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f), | |
3904 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f * | |
3905 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f); | |
3906 return (alpha << 24) | (red << 16) | (green << 8) | blue; | |
3907 /*v2 = a1 >> 24; | |
3908 v3 = (double)v2 / 255.0f; | |
3909 HIDWORD(v2) = 0; | |
0 | 3910 LODWORD(v2) = a2 >> 24; |
737 | 3911 v4 = v3 * (double)v2 / 255.0f * 255.0; |
0 | 3912 v5 = v4 + 6.7553994e15; |
3913 v6 = LODWORD(v5); | |
737 | 3914 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0; |
0 | 3915 v8 = v7 + 6.7553994e15; |
3916 v9 = LOBYTE(v8); | |
737 | 3917 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0; |
0 | 3918 v11 = v10 + 6.7553994e15; |
737 | 3919 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; |
0 | 3920 v13 = v12 + 6.7553994e15; |
737 | 3921 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ |
0 | 3922 } |
3923 | |
3924 //----- (004A46E6) -------------------------------------------------------- | |
3925 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) | |
3926 { | |
3927 int v5; // eax@1 | |
3928 int z; // eax@1 | |
3929 unsigned int v7; // eax@9 | |
3930 unsigned int v8; // ecx@9 | |
3931 int v9; // eax@9 | |
3932 unsigned int v10; // eax@10 | |
3933 int *v11; // esi@10 | |
3934 int *v12; // edi@10 | |
3935 int v13; // ecx@10 | |
3936 int v14; // edx@10 | |
3937 unsigned int v15; // eax@22 | |
3938 int *v16; // esi@22 | |
3939 int *v17; // edi@22 | |
3940 int v18; // ecx@22 | |
3941 int v19; // edx@22 | |
3942 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 | |
3943 int *pTargetZ; // [sp+10h] [bp-4h]@9 | |
3944 unsigned int v22; // [sp+1Ch] [bp+8h]@9 | |
3945 signed int v23; // [sp+20h] [bp+Ch]@1 | |
3946 | |
3947 v5 = a4; | |
3948 v23 = _z >> 16; | |
3949 z = x + v5; | |
693 | 3950 if ( z >= (signed int)pViewport->uViewportTL_X |
3951 && (signed int)x <= (signed int)pViewport->uViewportBR_X | |
3952 && y >= (signed int)pViewport->uViewportTL_Y | |
3953 && y <= (signed int)pViewport->uViewportBR_Y ) | |
3954 { | |
3955 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) | |
3956 x = pViewport->uViewportTL_X; | |
3957 if ( z > (signed int)pViewport->uViewportBR_X ) | |
3958 z = pViewport->uViewportBR_X; | |
0 | 3959 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
3960 v22 = z - x; | |
3961 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | |
3962 v7 = lightColor >> 3; | |
3963 v8 = lightColor & 0xF0; | |
3964 v9 = v7 & 0x1E0000; | |
3965 if ( pRenderer->uTargetGBits == 5 ) | |
3966 { | |
3967 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; | |
3968 v11 = (int *)pTarget; | |
3969 v12 = pTargetZ; | |
3970 v13 = v22; | |
3971 v14 = (v10 << 16) | v10; | |
3972 z = (unsigned __int8)pTarget & 2; | |
3973 if ( (unsigned __int8)pTarget & 2 ) | |
3974 { | |
3975 z = (unsigned int)*pTargetZ >> 16; | |
3976 if ( z > v23 ) | |
3977 { | |
3978 z = v14 + ((*pTarget & 0x7BDEu) >> 1); | |
3979 *pTarget = z; | |
3980 } | |
3981 v13 = v22 - 1; | |
3982 v11 = (int *)(pTarget + 1); | |
3983 v12 = pTargetZ + 1; | |
3984 } | |
3985 while ( v13 != 1 ) | |
3986 { | |
3987 if ( v13 < 1 ) | |
3988 return z; | |
3989 z = (unsigned int)*v12 >> 16; | |
3990 if ( z <= v23 ) | |
3991 { | |
3992 v13 -= 2; | |
3993 ++v11; | |
3994 v12 += 2; | |
3995 } | |
3996 else | |
3997 { | |
3998 v12 += 2; | |
3999 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); | |
4000 v13 -= 2; | |
4001 *v11 = z; | |
4002 ++v11; | |
4003 } | |
4004 } | |
4005 z = (unsigned int)*v12 >> 16; | |
4006 if ( z > v23 ) | |
4007 { | |
4008 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); | |
4009 *(short *)v11 = z; | |
4010 } | |
4011 } | |
4012 else | |
4013 { | |
4014 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; | |
4015 v16 = (int *)pTarget; | |
4016 v17 = pTargetZ; | |
4017 v18 = v22; | |
4018 v19 = (v15 << 16) | v15; | |
4019 z = (unsigned __int8)pTarget & 2; | |
4020 if ( (unsigned __int8)pTarget & 2 ) | |
4021 { | |
4022 z = (unsigned int)*pTargetZ >> 16; | |
4023 if ( z > v23 ) | |
4024 { | |
4025 z = v19 + ((*pTarget & 0xF7DEu) >> 1); | |
4026 *pTarget = z; | |
4027 } | |
4028 v18 = v22 - 1; | |
4029 v16 = (int *)(pTarget + 1); | |
4030 v17 = pTargetZ + 1; | |
4031 } | |
4032 while ( v18 != 1 ) | |
4033 { | |
4034 if ( v18 < 1 ) | |
4035 return z; | |
4036 z = (unsigned int)*v17 >> 16; | |
4037 if ( z <= v23 ) | |
4038 { | |
4039 v18 -= 2; | |
4040 ++v16; | |
4041 v17 += 2; | |
4042 } | |
4043 else | |
4044 { | |
4045 v17 += 2; | |
4046 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); | |
4047 v18 -= 2; | |
4048 *v16 = z; | |
4049 ++v16; | |
4050 } | |
4051 } | |
4052 z = (unsigned int)*v17 >> 16; | |
4053 if ( z > v23 ) | |
4054 { | |
4055 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); | |
4056 *(short *)v16 = z; | |
4057 } | |
4058 } | |
4059 } | |
4060 return z; | |
4061 } | |
4062 | |
4063 //----- (004A57E9) -------------------------------------------------------- | |
4064 void __cdecl Present_ColorKey() | |
4065 { | |
4066 HRESULT v0; // eax@3 | |
4067 HRESULT v1; // eax@3 | |
4068 HRESULT v2; // eax@3 | |
4069 HRESULT v3; // eax@3 | |
4070 HRESULT v4; // eax@3 | |
4071 RECT a2; // [sp+4h] [bp-14h]@3 | |
4072 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 | |
4073 | |
4074 if ( !pRenderer->uNumSceneBegins ) | |
4075 { | |
4076 if ( pRenderer->field_40110 ) | |
4077 { | |
693 | 4078 a2.bottom = pViewport->uViewportTL_Y; |
0 | 4079 a2.left = 0; |
4080 a2.top = 0; | |
4081 a2.right = 640; | |
4082 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | |
4083 a2.right = 640; | |
4084 a2.left = 0; | |
693 | 4085 a2.top = pViewport->uViewportBR_Y + 1; |
0 | 4086 a2.bottom = 480; |
4087 ErrD3D(pRenderer->pBackBuffer4->BltFast( | |
4088 0, | |
693 | 4089 pViewport->uViewportBR_Y + 1, |
0 | 4090 pRenderer->pColorKeySurface4, |
4091 &a2, | |
4092 16u)); | |
693 | 4093 a2.right = pViewport->uViewportTL_X; |
4094 a2.bottom = pViewport->uViewportBR_Y + 1; | |
0 | 4095 a2.left = 0; |
693 | 4096 a2.top = pViewport->uViewportTL_Y; |
0 | 4097 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
4098 0, | |
693 | 4099 pViewport->uViewportTL_Y, |
0 | 4100 pRenderer->pColorKeySurface4, |
4101 &a2, | |
4102 16u)); | |
693 | 4103 a2.left = pViewport->uViewportBR_X; |
4104 a2.top = pViewport->uViewportTL_Y; | |
0 | 4105 a2.right = 640; |
693 | 4106 a2.bottom = pViewport->uViewportBR_Y + 1; |
0 | 4107 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4108 pViewport->uViewportBR_X, |
4109 pViewport->uViewportTL_Y, | |
0 | 4110 pRenderer->pColorKeySurface4, |
4111 &a2, | |
4112 16u)); | |
693 | 4113 a2.right = pViewport->uViewportBR_X; |
4114 a2.bottom = pViewport->uViewportBR_Y + 1; | |
4115 a2.left = pViewport->uViewportTL_X; | |
4116 a2.top = pViewport->uViewportTL_Y; | |
0 | 4117 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
693 | 4118 pViewport->uViewportTL_X, |
4119 pViewport->uViewportTL_Y, | |
0 | 4120 pRenderer->pColorKeySurface4, |
4121 &a2, | |
4122 17u)); | |
4123 } | |
4124 } | |
4125 } | |
4126 | |
4127 //----- (004A597D) -------------------------------------------------------- | |
4128 void Present_NoColorKey() | |
4129 { | |
4130 //unsigned __int16 *v0; // eax@4 | |
4131 unsigned __int16 *v1; // esi@4 | |
4132 void *v2; // edi@4 | |
4133 //signed int v4; // ebx@4 | |
4134 //signed int v5; // ebx@6 | |
4135 //void *v6; // edi@7 | |
4136 //const void *v7; // esi@7 | |
4137 signed int v8; // ebx@8 | |
4138 int v9; // eax@10 | |
4139 unsigned int v10; // esi@10 | |
4140 unsigned __int32 v11; // edi@10 | |
4141 //int v12; // ecx@10 | |
4142 unsigned int v13; // ebx@10 | |
4143 int v14; // eax@11 | |
4144 int v15; // eax@13 | |
4145 int v16; // eax@14 | |
4146 int v17; // eax@16 | |
4147 HRESULT v18; // eax@22 | |
4148 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 | |
4149 int v20; // [sp+88h] [bp-1Ch]@10 | |
4150 int v21; // [sp+8Ch] [bp-18h]@10 | |
4151 __int32 v22; // [sp+90h] [bp-14h]@10 | |
4152 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 | |
4153 unsigned int v24; // [sp+98h] [bp-Ch]@4 | |
4154 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 | |
4155 //LPVOID v26; // [sp+A0h] [bp-4h]@4 | |
4156 | |
4157 if ( !pRenderer->uNumSceneBegins ) | |
4158 { | |
4159 if ( pRenderer->field_40110 ) | |
4160 { | |
4161 memset(&Dst, 0, 0x7Cu); | |
4162 Dst.dwSize = 124; | |
168 | 4163 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) |
0 | 4164 { |
4165 //v26 = Dst.lpSurface; | |
4166 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; | |
4167 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | | |
4168 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); | |
4169 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; | |
4170 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; | |
4171 v1 = pRenderer->pTargetSurface; | |
4172 v2 = Dst.lpSurface; | |
4173 | |
4174 | |
4175 /*for (uint y = 0; y < 480; ++y) | |
4176 { | |
4177 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); | |
4178 for (uint x = 0; x < 640; ++x) | |
4179 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; | |
4180 }*/ | |
4181 | |
4182 auto pSrc = pRenderer->pTargetSurface; | |
4183 auto pDst = (__int16 *)Dst.lpSurface; | |
4184 | |
4185 for (uint y = 0; y < 8; ++y) | |
4186 memcpy(pDst + y * Dst.lPitch / 2, | |
4187 | |
4188 pSrc + y * 640, 640 * sizeof(__int16)); | |
4189 | |
4190 for (uint y = 8; y < 352; ++y) | |
4191 { | |
4192 memcpy(pDst + y * Dst.lPitch / 2, | |
4193 pSrc + y * 640, 8 * sizeof(__int16)); | |
819 | 4194 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2, |
4195 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16)); | |
0 | 4196 } |
4197 | |
121 | 4198 for (uint y = 352; y < 480; ++y) |
0 | 4199 memcpy(pDst + y * Dst.lPitch / 2, |
4200 pSrc + y * 640, 640 * sizeof(__int16)); | |
4201 | |
4202 | |
693 | 4203 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4204 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
693 | 4205 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
0 | 4206 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
693 | 4207 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
0 | 4208 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
4209 v22 = 4 * ((Dst.lPitch / 4) + v9); | |
4210 v21 = 4 * v9 + 1280; | |
4211 | |
121 | 4212 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
0 | 4213 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
4214 v10 = (int)pSrc_x1y1; | |
4215 v11 = (int)pDst_x1y1; | |
693 | 4216 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
0 | 4217 v13 = v24; |
4218 | |
693 | 4219 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
0 | 4220 { |
4221 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | |
4222 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | |
693 | 4223 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
0 | 4224 { |
4225 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | |
4226 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | |
4227 } | |
4228 } | |
4229 | |
4230 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4231 | |
4232 /* while ( 1 ) | |
4233 { | |
4234 while ( 1 ) | |
4235 { | |
4236 v14 = *(int *)v10; | |
4237 v10 += 4; | |
4238 if ( v14 == v13 ) | |
4239 break; | |
4240 if ( (short)v14 == (short)v13 ) | |
4241 { | |
4242 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000; | |
4243 v11 += 4; | |
4244 --uHalfWidth; | |
4245 if ( !uHalfWidth ) | |
4246 goto LABEL_21; | |
4247 } | |
4248 else | |
4249 { | |
4250 v15 = __ROL__(v14, 16); | |
4251 if ( (short)v15 == (short)v13 ) | |
4252 { | |
4253 v17 = __ROR__(v15, 16); | |
4254 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17; | |
4255 v11 += 4; | |
4256 --uHalfWidth; | |
4257 if ( !uHalfWidth ) | |
4258 goto LABEL_21; | |
4259 } | |
4260 else | |
4261 { | |
4262 v16 = __ROR__(v15, 16); | |
4263 *(int *)v11 = v16; | |
4264 v11 += 4; | |
4265 --uHalfWidth; | |
4266 if ( !uHalfWidth ) | |
4267 goto LABEL_21; | |
4268 } | |
4269 } | |
4270 } | |
4271 v11 += 4; | |
4272 --uHalfWidth; | |
4273 if ( !uHalfWidth ) | |
4274 { | |
4275 LABEL_21: | |
4276 v10 += v21; | |
4277 v11 += v22; | |
4278 uHalfWidth = v20; | |
4279 if ( !--uNumLines ) | |
4280 { | |
4281 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); | |
4282 return; | |
4283 } | |
4284 } | |
4285 }*/ | |
4286 } | |
4287 } | |
4288 } | |
4289 } | |
4290 | |
4291 //----- (004A7063) -------------------------------------------------------- | |
4292 int __thiscall sub_4A7063(unsigned int uDiffuse, float a2) | |
4293 { | |
4294 float v2; // ST1C_4@1 | |
4295 double v3; // ST14_8@1 | |
4296 signed int v4; // ebx@1 | |
4297 float v5; // ST1C_4@1 | |
4298 double v6; // ST14_8@1 | |
4299 signed int v7; // edi@1 | |
4300 double v8; // ST0C_8@1 | |
4301 signed int v9; // esi@1 | |
4302 signed int v10; // ecx@1 | |
4303 double v12; // [sp+8h] [bp-18h]@1 | |
4304 unsigned __int64 v13; // [sp+18h] [bp-8h]@1 | |
4305 | |
4306 v2 = (double)(uDiffuse >> 24) * a2; | |
4307 v3 = v2 + 6.7553994e15; | |
4308 v4 = LODWORD(v3); | |
4309 v5 = (double)((uDiffuse >> 16) & 0xFF) * a2; | |
4310 v6 = v5 + 6.7553994e15; | |
4311 v7 = LODWORD(v6); | |
4312 *((float *)&v6 + 1) = (double)((unsigned __int16)uDiffuse >> 8) * a2; | |
4313 v8 = *((float *)&v6 + 1) + 6.7553994e15; | |
4314 v13 = __PAIR__(LODWORD(v6), LODWORD(v8)); | |
4315 v9 = LODWORD(v8); | |
4316 *((float *)&v6 + 1) = (double)(unsigned __int8)uDiffuse * a2; | |
4317 v12 = *((float *)&v6 + 1) + 6.7553994e15; | |
4318 v10 = LODWORD(v12); | |
4319 if ( v4 > 255 ) | |
4320 v4 = 255; | |
4321 if ( v4 < 0 ) | |
4322 v4 = 0; | |
4323 if ( SHIDWORD(v13) > 255 ) | |
4324 v7 = 255; | |
4325 if ( v7 < 0 ) | |
4326 v7 = 0; | |
4327 if ( (signed int)v13 > 255 ) | |
4328 v9 = 255; | |
4329 if ( v9 < 0 ) | |
4330 v9 = 0; | |
4331 if ( SLODWORD(v12) > 255 ) | |
4332 v10 = 255; | |
4333 if ( v10 < 0 ) | |
4334 v10 = 0; | |
4335 return v10 | ((v9 | ((v7 | (v4 << 8)) << 8)) << 8); | |
4336 } | |
4337 | |
4338 //----- (004AD504) -------------------------------------------------------- | |
711 | 4339 int __fastcall sub_4AD504(signed int sFaceID) |
0 | 4340 { |
4341 int result; // eax@1 | |
711 | 4342 signed int v2; // ebx@1 |
0 | 4343 BLVFace *v3; // esi@3 |
4344 Texture *v4; // edi@6 | |
4345 int v5; // eax@7 | |
4346 int v6; // edx@7 | |
4347 int v7; // ecx@7 | |
4348 int v8; // ebx@8 | |
4349 int v9; // eax@8 | |
4350 int v10; // ebx@8 | |
4351 unsigned int v11; // ebx@9 | |
4352 int v12; // esi@10 | |
4353 int v13; // eax@13 | |
4354 unsigned __int16 *v14; // eax@13 | |
4355 unsigned int v15; // eax@14 | |
4356 unsigned __int16 *v16; // ebx@14 | |
4357 int v17; // eax@15 | |
4358 int v18; // ebx@15 | |
4359 int v19; // esi@15 | |
4360 int v20; // ecx@15 | |
4361 int v21; // eax@15 | |
4362 stru193_math *v22; // ebx@15 | |
4363 int v23; // eax@15 | |
4364 char *v24; // esi@16 | |
4365 int v25; // eax@18 | |
4366 int v26; // eax@18 | |
4367 int v27; // eax@20 | |
4368 signed int v28; // esi@20 | |
4369 signed int v29; // edx@20 | |
4370 signed int v30; // esi@20 | |
4371 signed int v31; // edi@20 | |
4372 int v32; // esi@20 | |
4373 int v33; // eax@26 | |
4374 int *v34; // esi@27 | |
4375 unsigned __int16 *v35; // edi@27 | |
4376 unsigned int v36; // edx@27 | |
4377 int v37; // ebx@27 | |
4378 char v38; // cl@27 | |
4379 char v39; // ch@27 | |
4380 int v40; // ebx@29 | |
4381 int v41; // edx@29 | |
4382 unsigned int v42; // ebx@30 | |
4383 int v43; // edx@30 | |
4384 int v44; // eax@33 | |
4385 int *v45; // esi@34 | |
4386 unsigned __int16 *v46; // edi@34 | |
4387 unsigned int v47; // edx@34 | |
4388 int v48; // ebx@34 | |
4389 char v49; // cl@34 | |
4390 char v50; // ch@34 | |
4391 int v51; // ebx@36 | |
4392 int v52; // edx@36 | |
4393 unsigned __int16 v53; // bx@37 | |
4394 int v54; // edx@37 | |
4395 int v55; // eax@40 | |
4396 int v56; // eax@41 | |
4397 int *v57; // esi@42 | |
4398 unsigned __int16 *v58; // edi@42 | |
4399 unsigned int v59; // edx@42 | |
4400 int v60; // ebx@42 | |
4401 char v61; // cl@42 | |
4402 char v62; // ch@42 | |
4403 unsigned int v63; // ebx@44 | |
4404 int v64; // edx@44 | |
4405 unsigned int v65; // ebx@44 | |
4406 int v66; // edx@44 | |
4407 unsigned int v67; // ebx@45 | |
4408 int v68; // edx@45 | |
4409 int v69; // ebx@45 | |
4410 int v70; // edx@45 | |
4411 int v71; // eax@48 | |
4412 int *v72; // esi@49 | |
4413 unsigned __int16 *v73; // edi@49 | |
4414 unsigned int v74; // edx@49 | |
4415 int v75; // ebx@49 | |
4416 char v76; // cl@49 | |
4417 char v77; // ch@49 | |
4418 unsigned int v78; // ebx@51 | |
4419 int v79; // edx@51 | |
4420 unsigned int v80; // ebx@51 | |
4421 int v81; // edx@51 | |
4422 unsigned int v82; // ebx@52 | |
4423 int v83; // edx@52 | |
4424 int v84; // ebx@52 | |
4425 int v85; // edx@52 | |
4426 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
4427 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
4428 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
4429 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
4430 int v90; // [sp+1Ch] [bp-88h]@20 | |
4431 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
4432 int v92; // [sp+24h] [bp-80h]@7 | |
4433 int i; // [sp+28h] [bp-7Ch]@7 | |
4434 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
4435 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
4436 Texture *v96; // [sp+34h] [bp-70h]@6 | |
4437 int v97; // [sp+38h] [bp-6Ch]@15 | |
4438 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
4439 int v99; // [sp+40h] [bp-64h]@9 | |
4440 int v100; // [sp+44h] [bp-60h]@24 | |
4441 int v101; // [sp+48h] [bp-5Ch]@10 | |
4442 int v102; // [sp+4Ch] [bp-58h]@20 | |
4443 int v103; // [sp+50h] [bp-54h]@20 | |
4444 int v104; // [sp+54h] [bp-50h]@9 | |
4445 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
4446 int v106; // [sp+5Ch] [bp-48h]@24 | |
4447 int v107; // [sp+60h] [bp-44h]@20 | |
4448 int v108; // [sp+64h] [bp-40h]@20 | |
4449 int v109; // [sp+68h] [bp-3Ch]@20 | |
4450 int v110; // [sp+6Ch] [bp-38h]@15 | |
4451 int v111; // [sp+70h] [bp-34h]@20 | |
4452 int a1; // [sp+74h] [bp-30h]@12 | |
4453 int a2; // [sp+78h] [bp-2Ch]@9 | |
4454 int *v114; // [sp+7Ch] [bp-28h]@16 | |
4455 int v115; // [sp+80h] [bp-24h]@18 | |
4456 int v116; // [sp+84h] [bp-20h]@7 | |
4457 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
4458 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
4459 int *v119; // [sp+90h] [bp-14h]@13 | |
4460 int v120; // [sp+94h] [bp-10h]@15 | |
4461 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
4462 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
4463 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
4464 | |
4465 result = pRenderer->uTargetSurfacePitch; | |
711 | 4466 v2 = sFaceID; |
0 | 4467 v95 = pRenderer->uTargetSurfacePitch; |
711 | 4468 if ( sFaceID >= 0 ) |
4469 { | |
4470 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
4471 { | |
4472 v3 = &pIndoor->pFaces[sFaceID]; | |
4473 v91 = &pIndoor->pFaces[sFaceID]; | |
0 | 4474 if ( !pRenderer->pRenderD3D ) |
4475 { | |
711 | 4476 result = sub_423B5D(sFaceID); |
0 | 4477 if ( result ) |
4478 { | |
1226 | 4479 result = isVisibleRoom(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); |
0 | 4480 if ( result ) |
4481 { | |
4482 result = (int)v3->GetTexture(); | |
4483 v4 = (Texture *)result; | |
4484 v96 = (Texture *)result; | |
4485 if ( result ) | |
4486 { | |
4487 v5 = *(short *)(result + 38); | |
4488 LOBYTE(v3->uAttributes) |= 0x80u; | |
4489 v92 = v5; | |
4490 sub_4AE5F1(v2); | |
4491 ++pBLVRenderParams->field_84; | |
4492 v6 = stru_F8AD28.pDeltaUV[0]; | |
4493 v116 = stru_F8AD28.pDeltaUV[1]; | |
4494 v7 = 0; | |
4495 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
4496 { | |
4497 v8 = v116; | |
4498 stru_F8AD28._blv_lights_xs[v7] += v6; | |
4499 v9 = 4 * v7 + 16297672; | |
4500 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
4501 } | |
4502 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
4503 result = stru_F8A590._viewport_space_y; | |
4504 a2 = stru_F8A590._viewport_space_y; | |
4505 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4506 v99 = 640 * stru_F8A590._viewport_space_y; | |
710 | 4507 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4508 v87 = v4->pLevelOfDetail1; |
4509 v88 = v4->pLevelOfDetail2; | |
4510 v89 = v4->pLevelOfDetail3; | |
4511 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
4512 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
4513 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
4514 { | |
4515 v12 = 2 * stru_F8A590._viewport_space_y; | |
4516 v101 = 2 * stru_F8A590._viewport_space_y; | |
4517 while ( 1 ) | |
4518 { | |
4519 a1 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4520 sub_4AE313(a1, result, &stru_F81018.field_0); | |
4521 if ( LOBYTE(viewparams->field_20) ) | |
4522 { | |
4523 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
4524 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
4525 * (*(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4526 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
4527 - pBLVRenderParams->uViewportX]; | |
4528 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
4529 + 2 * *(__int16 *)((char *)stru_F8A590.array_18 + v12) | |
4530 - pBLVRenderParams->uViewportX]; | |
4531 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
4532 + 2 * *(__int16 *)((char *)stru_F8A590.array_3D8 + v12) | |
4533 - pBLVRenderParams->uViewportX]; | |
4534 v123 = (unsigned int)v16; | |
4535 } | |
4536 else | |
4537 { | |
4538 v13 = *(__int16 *)((char *)stru_F8A590.array_18 + v12); | |
4539 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
4540 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
4541 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.array_3D8 + v12)]; | |
4542 } | |
4543 v117 = (unsigned int)v14; | |
4544 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
4545 v18 = stru_F81018.field_0.field_10; | |
4546 LOWORD(v17) = 0; | |
4547 v97 = stru_F8AD28.field_0 | v17; | |
4548 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
4549 v19 = stru_F81018.field_0.field_4 >> i; | |
4550 v20 = 11 - v18; | |
4551 v116 = stru_F81018.field_0.field_8 >> i; | |
4552 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
4553 v22 = stru_5C6E00; | |
4554 v122 = (unsigned __int16 *)v20; | |
323 | 4555 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); |
4556 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
0 | 4557 v120 = v116 + 4 * v23; |
4558 if ( v123 < v117 ) | |
4559 { | |
4560 v24 = (char *)&stru_F81018.field_34.field_8; | |
4561 v114 = &stru_F81018.field_34.field_8; | |
4562 a1 += 16; | |
4563 while ( 1 ) | |
4564 { | |
4565 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
4566 v25 = *((int *)v24 - 2); | |
4567 LOWORD(v25) = 0; | |
4568 v115 = v97; | |
4569 v26 = stru_F8AD28.field_0 | v25; | |
4570 if ( v97 <= (unsigned int)v26 ) | |
4571 v115 = v26; | |
4572 v97 = v26; | |
4573 v27 = *((int *)v24 - 11); | |
4574 v28 = *((int *)v24 - 1); | |
4575 v105 = (&v86)[4 * v27]; | |
4576 v111 = v27 + 16; | |
4577 v29 = v4->uWidthMinus1; | |
4578 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
4579 v107 = v29 >> v27; | |
4580 v30 = v28 >> i; | |
4581 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
4582 v31 = *v114 >> i; | |
4583 v122 = (unsigned __int16 *)(11 - v27); | |
323 | 4584 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); |
4585 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
0 | 4586 v108 = (signed int)(v116 - v121) >> 4; |
4587 v103 = (v90 - v120) >> 4; | |
4588 v32 = v123 + 32; | |
4589 if ( LOBYTE(viewparams->field_20) ) | |
4590 v32 = v123 + 64; | |
4591 if ( v32 > v117 ) | |
4592 v32 = v117; | |
4593 v118 = v32; | |
4594 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
4595 v106 = (signed int)(v32 - v123) >> 1; | |
4596 if ( v110 >> 16 == v100 >> 16 ) | |
4597 { | |
4598 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
4599 if ( LOBYTE(viewparams->field_20) ) | |
4600 { | |
4601 v44 = v123; | |
4602 if ( v123 < v118 ) | |
4603 { | |
4604 v45 = v119; | |
4605 v46 = v122; | |
4606 v47 = v121; | |
4607 v48 = v120; | |
4608 v49 = v111; | |
4609 v50 = v109; | |
4610 if ( v106 & 2 ) | |
4611 { | |
4612 *v119 = v115; | |
4613 v45 -= 2; | |
4614 v44 = v123 + 4; | |
4615 goto LABEL_37; | |
4616 } | |
4617 do | |
4618 { | |
4619 v44 += 8; | |
4620 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
4621 v52 = v115; | |
4622 LOWORD(v51) = v46[v51]; | |
4623 *v45 = v115; | |
4624 v45[1] = v52; | |
4625 v45[640] = v52; | |
4626 v45[641] = v52; | |
4627 *(short *)(v44 - 8) = v51; | |
4628 *(short *)(v44 - 6) = v51; | |
4629 *(short *)(v44 + 1272) = v51; | |
4630 *(short *)(v44 + 1274) = v51; | |
4631 v45[2] = v52; | |
4632 v45[3] = v52; | |
4633 v45[642] = v52; | |
4634 v45[643] = v52; | |
4635 v121 += v108; | |
4636 v120 += v103; | |
4637 v47 = v121; | |
4638 v48 = v120; | |
4639 LABEL_37: | |
4640 v45 += 4; | |
4641 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
4642 v54 = v108; | |
4643 *(short *)(v44 - 4) = v53; | |
4644 *(short *)(v44 - 2) = v53; | |
4645 *(short *)(v44 + 1276) = v53; | |
4646 *(short *)(v44 + 1278) = v53; | |
4647 v121 += v54; | |
4648 v120 += v103; | |
4649 v47 = v121; | |
4650 v48 = v120; | |
4651 } | |
4652 while ( v44 < v118 ); | |
4653 v123 = v44; | |
4654 v119 = v45; | |
4655 } | |
4656 } | |
4657 else | |
4658 { | |
4659 v33 = v123; | |
4660 if ( v123 < v118 ) | |
4661 { | |
4662 v34 = v119; | |
4663 v35 = v122; | |
4664 v36 = v121; | |
4665 v37 = v120; | |
4666 v38 = v111; | |
4667 v39 = v109; | |
4668 if ( v106 & 1 ) | |
4669 { | |
4670 *v119 = v115; | |
4671 --v34; | |
4672 v33 = v123 + 2; | |
4673 goto LABEL_30; | |
4674 } | |
4675 do | |
4676 { | |
4677 v33 += 4; | |
4678 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4679 v41 = v115; | |
4680 LOWORD(v40) = v35[v40]; | |
4681 *v34 = v115; | |
4682 *(short *)(v33 - 4) = v40; | |
4683 v34[1] = v41; | |
4684 v121 += v108; | |
4685 v120 += v103; | |
4686 v36 = v121; | |
4687 v37 = v120; | |
4688 LABEL_30: | |
4689 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
4690 v34 += 2; | |
4691 v43 = v108; | |
4692 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
4693 v121 += v43; | |
4694 v120 += v103; | |
4695 v36 = v121; | |
4696 v37 = v120; | |
4697 } | |
4698 while ( v33 < v118 ); | |
4699 v123 = v33; | |
4700 v119 = v34; | |
4701 } | |
4702 } | |
4703 } | |
4704 else | |
4705 { | |
4706 v55 = v110 - ((v100 - v110) >> 4); | |
4707 v110 = (v100 - v110) >> 4; | |
4708 v122 = (unsigned __int16 *)v55; | |
4709 if ( LOBYTE(viewparams->field_20) ) | |
4710 { | |
4711 v71 = v123; | |
4712 if ( v123 < v118 ) | |
4713 { | |
4714 v72 = v119; | |
4715 v73 = v94; | |
4716 v74 = v121; | |
4717 v75 = v120; | |
4718 v76 = v111; | |
4719 v77 = v109; | |
4720 if ( v106 & 2 ) | |
4721 { | |
4722 *v119 = v115; | |
4723 v72 += 2; | |
4724 v71 = v123 + 4; | |
4725 goto LABEL_52; | |
4726 } | |
4727 do | |
4728 { | |
4729 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4730 v79 = (int)((char *)v122 + v110); | |
4731 v71 += 8; | |
4732 v122 = (unsigned __int16 *)v79; | |
4733 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
4734 v81 = v115; | |
4735 LOWORD(v80) = v73[v80]; | |
4736 *v72 = v115; | |
4737 v72[1] = v81; | |
4738 v72[640] = v81; | |
4739 v72[641] = v81; | |
4740 *(short *)(v71 - 8) = v80; | |
4741 *(short *)(v71 - 6) = v80; | |
4742 *(short *)(v71 + 1272) = v80; | |
4743 *(short *)(v71 + 1274) = v80; | |
4744 v72[2] = v81; | |
4745 v72[3] = v81; | |
4746 v72[642] = v81; | |
4747 v72[643] = v81; | |
4748 v121 += v108; | |
4749 v120 += v103; | |
4750 v74 = v121; | |
4751 v75 = v120; | |
4752 v72 += 4; | |
4753 LABEL_52: | |
4754 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
4755 v83 = (int)((char *)v122 + v110); | |
4756 v84 = v105[v82]; | |
4757 v122 = (unsigned __int16 *)v83; | |
4758 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
4759 v85 = v108; | |
4760 *(short *)(v71 - 4) = v84; | |
4761 *(short *)(v71 - 2) = v84; | |
4762 *(short *)(v71 + 1276) = v84; | |
4763 *(short *)(v71 + 1278) = v84; | |
4764 v121 += v85; | |
4765 v120 += v103; | |
4766 v74 = v121; | |
4767 v75 = v120; | |
4768 } | |
4769 while ( v71 < v118 ); | |
4770 v123 = v71; | |
4771 v119 = v72; | |
4772 } | |
4773 } | |
4774 else | |
4775 { | |
4776 v56 = v123; | |
4777 if ( v123 < v118 ) | |
4778 { | |
4779 v57 = v119; | |
4780 v58 = v94; | |
4781 v59 = v121; | |
4782 v60 = v120; | |
4783 v61 = v111; | |
4784 v62 = v109; | |
4785 if ( v106 & 1 ) | |
4786 { | |
4787 *v119 = v115; | |
4788 ++v57; | |
4789 v56 = v123 + 2; | |
4790 goto LABEL_45; | |
4791 } | |
4792 do | |
4793 { | |
4794 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4795 v64 = (int)((char *)v122 + v110); | |
4796 v56 += 4; | |
4797 v122 = (unsigned __int16 *)v64; | |
4798 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
4799 v66 = v115; | |
4800 LOWORD(v65) = v58[v65]; | |
4801 *v57 = v115; | |
4802 *(short *)(v56 - 4) = v65; | |
4803 v57[1] = v66; | |
4804 v121 += v108; | |
4805 v120 += v103; | |
4806 v59 = v121; | |
4807 v60 = v120; | |
4808 v57 += 2; | |
4809 LABEL_45: | |
4810 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
4811 v68 = (int)((char *)v122 + v110); | |
4812 v69 = v105[v67]; | |
4813 v122 = (unsigned __int16 *)v68; | |
4814 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
4815 v70 = v108; | |
4816 *(short *)(v56 - 2) = v69; | |
4817 v121 += v70; | |
4818 v120 += v103; | |
4819 v59 = v121; | |
4820 v60 = v120; | |
4821 } | |
4822 while ( v56 < v118 ); | |
4823 v123 = v56; | |
4824 v119 = v57; | |
4825 } | |
4826 } | |
4827 } | |
4828 v114 += 13; | |
4829 v110 = v100; | |
4830 a1 += 16; | |
4831 v4 = v96; | |
4832 v121 = v116; | |
4833 v120 = v90; | |
4834 if ( v123 >= v117 ) | |
4835 break; | |
4836 v24 = (char *)v114; | |
4837 v22 = stru_5C6E00; | |
4838 } | |
4839 } | |
4840 ++a2; | |
4841 v98 += v95; | |
4842 result = a2; | |
4843 v101 += 2; | |
4844 v99 += 640; | |
4845 if ( a2 > stru_F8A590._viewport_space_w ) | |
4846 break; | |
4847 v12 = v101; | |
4848 result = a2; | |
4849 v11 = v98; | |
4850 } | |
4851 } | |
4852 } | |
4853 } | |
4854 } | |
4855 } | |
4856 } | |
4857 } | |
4858 return result; | |
4859 } | |
4860 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4861 | |
4862 //----- (004ADD1D) -------------------------------------------------------- | |
4863 void __fastcall sub_4ADD1D(int uFaceID) | |
4864 { | |
4865 int v1; // edi@1 | |
4866 BLVFace *v2; // esi@3 | |
4867 signed int v3; // ebx@4 | |
4868 Texture *v4; // edi@9 | |
4869 signed int v5; // eax@9 | |
4870 char *v6; // edi@12 | |
4871 signed int v7; // eax@15 | |
4872 unsigned int v8; // eax@16 | |
4873 __int16 v9; // cx@19 | |
4874 unsigned __int8 *v10; // eax@19 | |
4875 unsigned __int16 *v11; // eax@19 | |
4876 int v12; // edi@19 | |
4877 int v13; // ebx@20 | |
4878 stru352 *v14; // esi@20 | |
4879 DWORD v15; // eax@22 | |
4880 signed int v16; // ecx@22 | |
4881 signed int v17; // ST68_4@22 | |
4882 int v18; // eax@22 | |
4883 int v19; // ecx@22 | |
4884 unsigned int v20; // esi@23 | |
4885 int v21; // edi@23 | |
4886 int v22; // eax@23 | |
4887 int *v23; // ebx@24 | |
4888 int v24; // edx@24 | |
4889 int v25; // ebx@25 | |
4890 unsigned __int16 v26; // cx@25 | |
4891 int v27; // edx@26 | |
4892 unsigned __int16 v28; // cx@26 | |
4893 unsigned __int8 v29; // sf@27 | |
4894 unsigned __int8 v30; // of@27 | |
4895 unsigned int v31; // esi@29 | |
4896 int v32; // edi@29 | |
4897 unsigned __int16 *v33; // eax@29 | |
4898 int *v34; // ebx@30 | |
4899 int v35; // edx@30 | |
4900 int v36; // ebx@31 | |
4901 unsigned __int16 v37; // cx@31 | |
4902 int v38; // edx@32 | |
4903 unsigned __int16 v39; // cx@32 | |
4904 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
4905 int v41; // [sp-Ch] [bp-68h]@15 | |
4906 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
4907 signed int v43; // [sp+14h] [bp-48h]@12 | |
4908 signed int v44; // [sp+14h] [bp-48h]@22 | |
4909 int v45; // [sp+1Ch] [bp-40h]@22 | |
4910 int v46; // [sp+20h] [bp-3Ch]@22 | |
4911 int v47; // [sp+24h] [bp-38h]@19 | |
4912 char v48; // [sp+28h] [bp-34h]@19 | |
4913 int v49; // [sp+2Ch] [bp-30h]@19 | |
4914 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
4915 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
4916 int v52; // [sp+38h] [bp-24h]@22 | |
4917 int v53; // [sp+3Ch] [bp-20h]@22 | |
4918 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
4919 int v55; // [sp+40h] [bp-1Ch]@20 | |
4920 int v56; // [sp+44h] [bp-18h]@20 | |
4921 stru352 *i; // [sp+48h] [bp-14h]@20 | |
4922 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
4923 int v59; // [sp+50h] [bp-Ch]@4 | |
4924 int v60; // [sp+50h] [bp-Ch]@19 | |
4925 int v61; // [sp+54h] [bp-8h]@22 | |
4926 int *v62; // [sp+58h] [bp-4h]@23 | |
4927 int *v63; // [sp+58h] [bp-4h]@29 | |
4928 | |
4929 v1 = uFaceID; | |
4930 v42 = pRenderer->uTargetSurfacePitch; | |
4931 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
4932 { | |
4933 v2 = &pIndoor->pFaces[uFaceID]; | |
4934 if ( pRenderer->pRenderD3D ) | |
4935 { | |
4936 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
4937 v59 = v3; | |
4938 } | |
4939 else | |
4940 { | |
4941 v59 = sub_423B5D(uFaceID); | |
4942 v3 = v59; | |
4943 } | |
1226 | 4944 if ( v3 && (pRenderer->pRenderD3D || isVisibleRoom(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) |
0 | 4945 { |
4946 v4 = v2->GetTexture(); | |
4947 v5 = 0; | |
4948 if ( v4 ) | |
4949 { | |
4950 if ( pRenderer->pRenderD3D ) | |
4951 { | |
4952 if ( v3 > 0 ) | |
4953 { | |
4954 v54 = v3; | |
4955 v43 = v3; | |
4956 v6 = (char *)&array_507D30[0].v; | |
4957 do | |
4958 { | |
4959 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
4960 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
4961 v6 += 48; | |
4962 --v54; | |
4963 } | |
4964 while ( v54 ); | |
4965 v3 = v59; | |
4966 v5 = v43; | |
4967 } | |
4968 v7 = v5; | |
4969 v41 = stru_F8AD28.field_0; | |
4970 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
4971 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
4972 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
4973 { | |
4974 v40 = v2->GetTexture(); | |
4975 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
4976 } | |
4977 else | |
4978 { | |
4979 v40 = v2->GetTexture(); | |
4980 v8 = v2->uBitmapID; | |
4981 } | |
4982 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
4983 } | |
4984 else | |
4985 { | |
4986 v49 = v4->uWidthMinus1; | |
4987 v47 = v4->uHeightMinus1 << 16; | |
4988 v9 = 16 - v4->uWidthLn2; | |
710 | 4989 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4990 LOBYTE(v2->uAttributes) |= 0x80u; |
4991 v48 = v9; | |
4992 v50 = v10; | |
4993 sub_4AF412(); | |
4994 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
4995 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
4996 v12 = stru_F8A590._viewport_space_y; | |
4997 v51 = v11; | |
4998 v60 = stru_F8A590._viewport_space_y; | |
4999 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5000 { | |
5001 v13 = 2 * stru_F8A590._viewport_space_y; | |
5002 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
5003 v55 = 2 * stru_F8A590._viewport_space_y; | |
5004 v56 = 640 * stru_F8A590._viewport_space_y; | |
5005 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
5006 { | |
5007 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.array_18 + v13), v12); | |
5008 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
5009 v15 = GetTickCount(); | |
5010 v16 = v14->field_0; | |
5011 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
5012 v45 = v14->field_4 >> 3; | |
5013 v44 = v16 >> 3; | |
5014 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
5015 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
5016 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5017 v18 = v14->field_28; | |
5018 v19 = *(__int16 *)((char *)stru_F8A590.array_18 + v13); | |
5019 LOWORD(v18) = 0; | |
5020 v46 = stru_F8AD28.field_0 | v18; | |
5021 v61 = *(__int16 *)((char *)stru_F8A590.array_3D8 + v13) - v19; | |
5022 if ( LOBYTE(viewparams->field_20) ) | |
5023 { | |
5024 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5025 - pBLVRenderParams->uViewportX]; | |
5026 v31 = v44; | |
5027 v32 = v45; | |
5028 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5029 + 2 * v19 | |
5030 - pBLVRenderParams->uViewportX]; | |
5031 if ( v61 & 1 ) | |
5032 { | |
5033 --v61; | |
5034 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
5035 + 2 * v19 | |
5036 - pBLVRenderParams->uViewportX | |
5037 - 2]; | |
5038 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
5039 - pBLVRenderParams->uViewportX]; | |
5040 v35 = v46; | |
5041 v63 += 2; | |
5042 goto LABEL_32; | |
5043 } | |
5044 while ( 1 ) | |
5045 { | |
5046 v30 = __OFSUB__(v61, 2); | |
5047 v29 = v61 - 2 < 0; | |
5048 v61 -= 2; | |
5049 if ( v29 ^ v30 ) | |
5050 break; | |
5051 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
5052 v31 += v52; | |
5053 v37 = v51[v36]; | |
5054 v32 += v53; | |
5055 v34 = v63; | |
5056 v35 = v46; | |
5057 *v33 = v37; | |
5058 v33[1] = v37; | |
5059 v33[640] = v37; | |
5060 v33[641] = v37; | |
5061 v63 += 4; | |
5062 v34[2] = v46; | |
5063 v34[3] = v46; | |
5064 v34[642] = v46; | |
5065 v34[643] = v46; | |
5066 LABEL_32: | |
5067 *v34 = v35; | |
5068 v34[1] = v35; | |
5069 v34[640] = v35; | |
5070 v34[641] = v35; | |
5071 v38 = v49 & (v31 >> 16); | |
5072 v33 += 4; | |
5073 v31 += v52; | |
5074 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
5075 v32 += v53; | |
5076 *(v33 - 2) = v39; | |
5077 *(v33 - 1) = v39; | |
5078 v33[638] = v39; | |
5079 v33[639] = v39; | |
5080 } | |
5081 } | |
5082 else | |
5083 { | |
5084 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
5085 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5086 v20 = v44; | |
5087 v21 = v45; | |
5088 v22 = (int)v58; | |
5089 if ( v61 & 1 ) | |
5090 { | |
5091 --v61; | |
5092 v22 = (int)(v58 - 1); | |
5093 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
5094 v24 = v46; | |
5095 ++v62; | |
5096 goto LABEL_26; | |
5097 } | |
5098 while ( 1 ) | |
5099 { | |
5100 v30 = __OFSUB__(v61, 2); | |
5101 v29 = v61 - 2 < 0; | |
5102 v61 -= 2; | |
5103 if ( v29 ^ v30 ) | |
5104 break; | |
5105 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
5106 v20 += v52; | |
5107 v26 = v51[v25]; | |
5108 v21 += v53; | |
5109 v23 = v62; | |
5110 v24 = v46; | |
5111 *(short *)v22 = v26; | |
5112 v62 += 2; | |
5113 v23[1] = v46; | |
5114 LABEL_26: | |
5115 *v23 = v24; | |
5116 v27 = v49 & (v20 >> 16); | |
5117 v22 += 4; | |
5118 v20 += v52; | |
5119 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
5120 v21 += v53; | |
5121 *(short *)(v22 - 2) = v28; | |
5122 } | |
5123 } | |
5124 ++v60; | |
5125 ++i; | |
5126 v56 += 640; | |
5127 v55 += 2; | |
5128 if ( v60 > stru_F8A590._viewport_space_w ) | |
5129 break; | |
5130 v13 = v55; | |
5131 v12 = v60; | |
5132 } | |
5133 } | |
5134 } | |
5135 } | |
5136 } | |
5137 } | |
5138 } | |
5139 | |
5140 //----- (004AE1E7) -------------------------------------------------------- | |
5141 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
5142 { | |
5143 int v3; // ebx@1 | |
5144 int v4; // edi@1 | |
5145 int v5; // esi@1 | |
5146 signed __int64 v6; // qtt@3 | |
5147 int v7; // esi@3 | |
5148 int v8; // eax@5 | |
5149 int result; // eax@5 | |
5150 int v10; // edx@5 | |
5151 int v11; // [sp+Ch] [bp-8h]@1 | |
5152 int v12; // [sp+1Ch] [bp+8h]@2 | |
5153 | |
5154 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
5155 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
5156 v11 = a1; | |
5157 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
5158 + stru_F8AD28.field_7C | |
5159 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
5160 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
5161 { | |
5162 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
5163 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
5164 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
5165 } | |
5166 else | |
5167 { | |
5168 v7 = 1073741824; | |
5169 } | |
5170 v8 = stru_F8AD28.vec_9C.z; | |
5171 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
5172 + stru_F8AD28.vec_8C.x | |
5173 + v4 * stru_F8AD28.vec_8C.y) | |
5174 * (signed __int64)v7) >> 16) | |
5175 + stru_F8AD28.field_98; | |
5176 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
5177 v10 = result + stru_F8AD28.field_A8; | |
5178 stru_F83B80[v11].field_28 = v7; | |
5179 stru_F83B80[v11].field_4 = v10; | |
5180 return result; | |
5181 } | |
5182 | |
5183 //----- (004AE313) -------------------------------------------------------- | |
5184 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
5185 { | |
5186 int _dy; // ebx@1 | |
5187 int _dx; // edi@1 | |
5188 int v5; // ecx@1 | |
5189 int v6; // esi@1 | |
5190 int v7; // ST18_4@2 | |
5191 signed __int64 v8; // qtt@3 | |
5192 unsigned int v9; // ecx@3 | |
5193 int result; // eax@8 | |
5194 int v11; // [sp+Ch] [bp-8h]@1 | |
5195 | |
5196 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
5197 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
5198 ++pBLVRenderParams->field_88; | |
5199 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
5200 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5201 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
5202 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
5203 { | |
5204 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
5205 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
5206 v9 = v8 / v11; | |
5207 } | |
5208 else | |
5209 { | |
5210 v9 = 0x40000000u; | |
5211 } | |
5212 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
5213 p->field_0 = v9; | |
5214 else | |
5215 p->field_0 = stru_F8AD28.field_34; | |
5216 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
5217 * (signed __int64)(signed int)v9) >> 16) | |
5218 + stru_F8AD28.field_98 | |
5219 + (stru_F8AD28.pDeltaUV[0] << 16); | |
5220 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
5221 * (signed __int64)(signed int)v9) >> 16) | |
5222 + stru_F8AD28.field_A8 | |
5223 + (stru_F8AD28.pDeltaUV[1] << 16); | |
5224 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
5225 if ( result < 369620 || bUseLoResSprites ) | |
5226 { | |
5227 if ( result < 184810 ) | |
5228 p->field_10 = result > 92405; | |
5229 else | |
5230 p->field_10 = 2; | |
5231 } | |
5232 else | |
5233 { | |
5234 p->field_10 = 3; | |
5235 } | |
5236 return result; | |
5237 } | |
5238 | |
5239 //----- (004AE491) -------------------------------------------------------- | |
5240 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
5241 { | |
5242 signed int v2; // eax@1 | |
5243 signed int v3; // edi@1 | |
5244 int v4; // ecx@1 | |
5245 int v5; // esi@2 | |
5246 int v6; // eax@2 | |
5247 int v7; // ebx@2 | |
5248 unsigned int v8; // ecx@2 | |
5249 int v9; // edx@5 | |
5250 int v10; // edx@7 | |
5251 unsigned int v11; // eax@8 | |
5252 int v13; // [sp+4h] [bp-18h]@2 | |
5253 int v14; // [sp+8h] [bp-14h]@2 | |
5254 signed int v15; // [sp+Ch] [bp-10h]@1 | |
5255 int v16; // [sp+14h] [bp-8h]@1 | |
5256 int v17; // [sp+18h] [bp-4h]@1 | |
5257 | |
5258 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
5259 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
5260 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
5261 v4 = 0; | |
5262 v15 = v2; | |
5263 v16 = 0; | |
5264 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5265 { | |
5266 do | |
5267 { | |
5268 v5 = v16; | |
5269 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
5270 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
5271 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5272 v7 = v13; | |
5273 v8 = v14; | |
5274 if ( v6 < v13 ) | |
5275 { | |
5276 v6 = v13; | |
5277 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
5278 } | |
5279 if ( v6 < v14 ) | |
5280 { | |
5281 v9 = v6; | |
5282 v6 = v14; | |
5283 v8 = v9; | |
5284 } | |
5285 if ( v7 < (signed int)v8 ) | |
5286 { | |
5287 v10 = v8; | |
5288 v8 = v7; | |
5289 v7 = v10; | |
5290 } | |
5291 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
5292 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
5293 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
5294 ++v16; | |
5295 v2 = v15; | |
5296 } | |
5297 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
5298 v4 = 0; | |
5299 } | |
5300 if ( stru_F8AD28.field_3E4 != v4 ) | |
5301 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
5302 if ( v17 >= v4 ) | |
5303 { | |
5304 if ( v17 > 2031616 ) | |
5305 v17 = 2031616; | |
5306 } | |
5307 else | |
5308 { | |
5309 v17 = v4; | |
5310 } | |
5311 ++pBLVRenderParams->field_8C; | |
5312 return v17; | |
5313 } | |
5314 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
5315 | |
5316 //----- (004AE5F1) -------------------------------------------------------- | |
5317 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
5318 { | |
5319 BLVFace *v1; // esi@1 | |
5320 BLVFaceExtra *v2; // ebx@1 | |
5321 int v3; // eax@1 | |
5322 int v4; // edi@1 | |
5323 Texture *v5; // edi@1 | |
5324 int v6; // eax@1 | |
5325 unsigned int v7; // eax@1 | |
5326 unsigned int v8; // ecx@1 | |
5327 unsigned int v9; // eax@1 | |
5328 unsigned int v10; // ecx@5 | |
5329 int v11; // edi@10 | |
5330 int v12; // ecx@10 | |
5331 int v13; // eax@10 | |
5332 int v14; // edx@10 | |
5333 int v15; // ebx@12 | |
5334 double v16; // st7@16 | |
5335 int v17; // eax@16 | |
5336 char *v18; // ebx@17 | |
5337 int v19; // ecx@19 | |
5338 int v20; // eax@19 | |
5339 int v21; // edx@21 | |
5340 int v22; // eax@23 | |
5341 int v23; // ST04_4@26 | |
5342 int v24; // edi@26 | |
5343 double v25; // st6@26 | |
5344 int v26; // eax@26 | |
5345 double v27; // st6@26 | |
5346 int v28; // ecx@26 | |
5347 char v29; // al@26 | |
5348 int v30; // edx@28 | |
5349 int v31; // ecx@28 | |
5350 BLVLightMM7 *v32; // ecx@32 | |
5351 int v33; // edi@33 | |
5352 int v34; // edx@33 | |
5353 int v35; // eax@33 | |
5354 int v36; // edi@35 | |
5355 int v37; // edx@37 | |
5356 int v38; // ebx@39 | |
5357 int v39; // edi@42 | |
5358 int v40; // eax@42 | |
5359 char *v41; // ebx@45 | |
5360 signed int v42; // ecx@47 | |
5361 int v43; // edi@47 | |
5362 int v44; // eax@49 | |
5363 int v45; // edx@51 | |
5364 int v46; // eax@53 | |
5365 int v47; // ST04_4@55 | |
5366 int v48; // edi@55 | |
5367 double v49; // st6@55 | |
5368 int v50; // eax@55 | |
5369 double v51; // st6@55 | |
5370 int v52; // eax@55 | |
5371 int v53; // ecx@57 | |
5372 int v54; // ecx@58 | |
5373 int v55; // ecx@59 | |
5374 int v56; // edx@62 | |
5375 int v57; // ecx@62 | |
5376 int v58; // eax@63 | |
5377 int v59; // edx@64 | |
5378 int v60; // ecx@67 | |
5379 int v61; // edx@67 | |
5380 int v62; // eax@68 | |
5381 int v63; // edx@69 | |
5382 signed int v64; // ecx@72 | |
5383 double v65; // st7@75 | |
5384 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
5385 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
5386 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
5387 int v69; // [sp+28h] [bp-18h]@10 | |
5388 int v70; // [sp+2Ch] [bp-14h]@10 | |
5389 int X; // [sp+30h] [bp-10h]@10 | |
5390 int v72; // [sp+34h] [bp-Ch]@10 | |
5391 int v73; // [sp+38h] [bp-8h]@10 | |
5392 int v74; // [sp+3Ch] [bp-4h]@10 | |
5393 | |
5394 v1 = &pIndoor->pFaces[uFaceID]; | |
5395 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
5396 v3 = v1->uBitmapID; | |
5397 v4 = v1->uBitmapID; | |
5398 v68 = v2; | |
5399 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
5400 v6 = 8 * uFaceID; | |
862 | 5401 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); |
0 | 5402 stru_F8AD28.field_0 = v6; |
5403 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
5404 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
5405 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
5406 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
5407 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
5408 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
5409 v7 = GetTickCount(); | |
5410 v8 = v1->uAttributes; | |
5411 v9 = v7 >> 3; | |
5412 if ( v8 & 4 ) | |
5413 { | |
5414 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
5415 } | |
5416 else | |
5417 { | |
5418 if ( v8 & 0x20 ) | |
5419 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
5420 } | |
5421 v10 = v1->uAttributes; | |
5422 if ( BYTE1(v10) & 8 ) | |
5423 { | |
5424 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
5425 } | |
5426 else | |
5427 { | |
5428 if ( v10 & 0x40 ) | |
5429 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
5430 } | |
5431 v1->_get_normals(&v67, &v66); | |
5432 stru_F8AD28.vec_14.x = v67.x; | |
5433 stru_F8AD28.vec_14.y = v67.y; | |
5434 stru_F8AD28.vec_14.z = v67.z; | |
5435 stru_F8AD28.vec_20.x = v66.x; | |
5436 stru_F8AD28.vec_20.y = v66.y; | |
5437 stru_F8AD28.vec_20.z = v66.z; | |
5438 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
5439 if ( pBLVRenderParams->sPartyRotX ) | |
5440 { | |
5441 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5442 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
5443 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5444 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
5445 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5446 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5447 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5448 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5449 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5450 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5451 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5452 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5453 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5454 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5455 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5456 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5457 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5458 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5459 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5460 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5461 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
5462 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5463 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
5464 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5465 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5466 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5467 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5468 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5469 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5470 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5471 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5472 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5473 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5474 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5475 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5476 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
5477 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
5478 v13 = pBLVRenderParams->vPartyPos.y; | |
5479 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5480 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5481 v14 = pBLVRenderParams->vPartyPos.x; | |
5482 } | |
5483 else | |
5484 { | |
5485 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5486 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5487 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5488 - v70; | |
5489 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5490 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5491 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5492 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5493 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5494 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5495 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5496 - v70; | |
5497 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5498 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5499 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5500 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5501 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5502 - v70; | |
5503 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
5504 v14 = pBLVRenderParams->vPartyPos.x; | |
5505 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5506 v13 = pBLVRenderParams->vPartyPos.y; | |
5507 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5508 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5509 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5510 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5511 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5512 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5513 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5514 } | |
5515 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5516 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
5517 + stru_F8AD28.plane_4.dist | |
5518 + stru_F8AD28.plane_4.vNormal.y * v13 | |
5519 + stru_F8AD28.plane_4.vNormal.x * v14; | |
5520 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5521 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5522 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5523 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5524 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5525 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5526 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5527 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5528 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
5529 v15 = v70; | |
5530 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
5531 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5532 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
5533 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5534 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5535 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
5536 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
5537 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
5538 stru_F8AD28.field_38 = 0; | |
5539 stru_F8AD28.field_A8 = -(X | |
5540 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
5541 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
5542 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
5543 { | |
5544 stru_F8AD28.field_3E4 = 1; | |
5545 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
5546 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
5547 stru_F8AD28.field_3F0 = v68->field_1E; | |
5548 stru_F8AD28.field_3F4 = v68->field_20; | |
5549 } | |
5550 else | |
5551 { | |
5552 stru_F8AD28.field_3E4 = 0; | |
5553 } | |
5554 v16 = 0.0039215689; | |
5555 v17 = 116 * v1->uSectorID; | |
5556 v69 = v17; | |
5557 v74 = 0; | |
5558 v73 = 0; | |
5559 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
5560 v70 = pMobileLightsStack->uNumLightsActive; | |
5561 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
5562 { | |
5563 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
5564 do | |
5565 { | |
5566 if ( v74 >= 20 ) | |
5567 break; | |
5568 v19 = *((short *)v18 + 2); | |
5569 v20 = *((short *)v18 - 1); | |
5570 if ( v20 > v1->pBounding.x1 - v19 ) | |
5571 { | |
5572 if ( v20 < v19 + v1->pBounding.x2 ) | |
5573 { | |
5574 v21 = *(short *)v18; | |
5575 if ( v21 > v1->pBounding.y1 - v19 ) | |
5576 { | |
5577 if ( v21 < v19 + v1->pBounding.y2 ) | |
5578 { | |
5579 v22 = *((short *)v18 + 1); | |
5580 if ( v22 > v1->pBounding.z1 - v19 ) | |
5581 { | |
5582 if ( v22 < v19 + v1->pBounding.z2 ) | |
5583 { | |
5584 X = (v1->pFacePlane_old.dist | |
5585 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
5586 + v21 * v1->pFacePlane_old.vNormal.y | |
5587 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
5588 if ( X <= v19 ) | |
5589 { | |
5590 v23 = X; | |
5591 v24 = v74; | |
5592 stru_F8AD28._blv_lights_radii[v74] = v19; | |
5593 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
5594 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
5595 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
5596 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
5597 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
5598 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
5599 v25 = (double)(signed int)v68 * v16; | |
5600 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
5601 v26 = (unsigned __int8)v18[8]; | |
5602 *(float *)(v24 * 4 + 16297992) = v25; | |
5603 v27 = (double)(signed int)v68; | |
5604 v68 = (BLVFaceExtra *)v26; | |
5605 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
5606 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
5607 v16 = 0.0039215689; | |
5608 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
5609 v28 = v74; | |
5610 v29 = v18[9]; | |
5611 ++v74; | |
5612 stru_F8AD28._blv_lights_types[v28] = v29; | |
5613 } | |
5614 } | |
5615 } | |
5616 } | |
5617 } | |
5618 } | |
5619 } | |
5620 ++v73; | |
5621 v18 += 18; | |
5622 v17 = v69; | |
5623 } | |
5624 while ( v73 < v70 ); | |
5625 } | |
5626 v30 = 0; | |
5627 v73 = 0; | |
5628 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5629 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
5630 if ( v31 > 0 ) | |
5631 { | |
5632 while ( v74 < 20 ) | |
5633 { | |
5634 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
5635 if ( !(v32->uAtributes & 8) ) | |
5636 { | |
5637 v33 = v1->pBounding.x1; | |
5638 v34 = v32->vPosition.x; | |
5639 X = v32->uBrightness; | |
5640 v35 = v32->uRadius; | |
5641 v68 = (BLVFaceExtra *)v32->uRadius; | |
5642 if ( v34 > v33 - v35 ) | |
5643 { | |
5644 if ( v34 < v35 + v1->pBounding.x2 ) | |
5645 { | |
5646 v36 = v32->vPosition.y; | |
5647 if ( v36 > v1->pBounding.y1 - v35 ) | |
5648 { | |
5649 if ( v36 < v35 + v1->pBounding.y2 ) | |
5650 { | |
5651 v37 = v32->vPosition.z; | |
5652 if ( v37 > v1->pBounding.z1 - v35 ) | |
5653 { | |
5654 if ( v37 < v35 + v1->pBounding.z2 ) | |
5655 { | |
5656 v38 = (v1->pFacePlane_old.dist | |
5657 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
5658 + v37 * v1->pFacePlane_old.vNormal.z | |
5659 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
5660 if ( v38 >= 0 ) | |
5661 { | |
5662 if ( v38 <= v35 && v35 ) | |
5663 { | |
5664 v39 = v74; | |
5665 stru_F8AD28._blv_lights_radii[v74] = v35; | |
5666 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
5667 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
5668 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
5669 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
5670 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
5671 v68 = (BLVFaceExtra *)v32->uRed; | |
5672 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
5673 v68 = (BLVFaceExtra *)v32->uGreen; | |
5674 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
5675 v68 = (BLVFaceExtra *)v32->uBlue; | |
5676 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
5677 v16 = 0.0039215689; | |
5678 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
5679 v40 = v74++; | |
5680 stru_F8AD28._blv_lights_types[v40] = 1; | |
5681 } | |
5682 } | |
5683 } | |
5684 } | |
5685 } | |
5686 } | |
5687 } | |
5688 } | |
5689 } | |
5690 v30 = v73++ + 1; | |
5691 if ( v73 >= v70 ) | |
5692 break; | |
5693 v17 = v69; | |
5694 } | |
5695 } | |
5696 v73 = 0; | |
5697 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
5698 { | |
5699 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
5700 do | |
5701 { | |
5702 if ( v74 >= 20 ) | |
5703 break; | |
5704 v42 = *((short *)v41 + 2); | |
5705 v43 = *((short *)v41 - 1); | |
5706 if ( v43 > v1->pBounding.x1 - v42 ) | |
5707 { | |
5708 if ( v43 < v42 + v1->pBounding.x2 ) | |
5709 { | |
5710 v44 = *(short *)v41; | |
5711 if ( v44 > v1->pBounding.y1 - v42 ) | |
5712 { | |
5713 if ( v44 < v42 + v1->pBounding.y2 ) | |
5714 { | |
5715 v45 = *((short *)v41 + 1); | |
5716 if ( v45 > v1->pBounding.z1 - v42 ) | |
5717 { | |
5718 if ( v45 < v42 + v1->pBounding.z2 ) | |
5719 { | |
5720 v46 = (v1->pFacePlane_old.dist | |
5721 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
5722 + v43 * v1->pFacePlane_old.vNormal.x | |
5723 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
5724 v69 = v46; | |
5725 if ( v46 >= 0 ) | |
5726 { | |
5727 if ( v46 <= v42 ) | |
5728 { | |
5729 v47 = v69; | |
5730 v48 = v74; | |
5731 stru_F8AD28._blv_lights_radii[v74] = v42; | |
5732 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
5733 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
5734 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
5735 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
5736 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
5737 v49 = (double)(signed int)v68 * v16; | |
5738 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
5739 v50 = (unsigned __int8)v41[8]; | |
5740 stru_F8AD28._blv_lights_rs[v48] = v49; | |
5741 v51 = (double)(signed int)v68; | |
5742 v68 = (BLVFaceExtra *)v50; | |
5743 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
5744 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
5745 v16 = 0.0039215689; | |
5746 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
5747 v52 = v74++; | |
5748 stru_F8AD28._blv_lights_types[v52] = 1; | |
5749 } | |
5750 } | |
5751 } | |
5752 } | |
5753 } | |
5754 } | |
5755 } | |
5756 } | |
5757 ++v73; | |
5758 v41 += 12; | |
5759 } | |
5760 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
5761 } | |
5762 stru_F8AD28.uNumLightsApplied = v74; | |
5763 v53 = v1->pBounding.x2; | |
5764 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
5765 { | |
5766 v55 = v1->pBounding.x1; | |
5767 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
5768 v54 = 0; | |
5769 else | |
5770 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
5771 } | |
5772 else | |
5773 { | |
5774 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
5775 } | |
5776 v56 = v1->pBounding.y2; | |
5777 v57 = v54 * v54; | |
5778 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
5779 { | |
5780 v59 = v1->pBounding.y1; | |
5781 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
5782 v58 = 0; | |
5783 else | |
5784 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
5785 } | |
5786 else | |
5787 { | |
5788 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
5789 } | |
5790 v60 = v58 * v58 + v57; | |
5791 v61 = v1->pBounding.z2; | |
5792 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
5793 { | |
5794 v63 = v1->pBounding.z1; | |
5795 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
5796 v62 = 0; | |
5797 else | |
5798 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
5799 } | |
5800 else | |
5801 { | |
5802 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
5803 } | |
5804 v64 = v62 * v62 + v60; | |
5805 if ( v64 ) | |
295 | 5806 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; |
0 | 5807 else |
5808 stru_F8AD28.field_34 = 0; | |
5809 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
5810 v65 = (double)(signed int)v68; | |
5811 if ( v65 >= 655.36 ) | |
5812 { | |
5813 if ( v65 >= 26214.4 ) | |
5814 { | |
5815 if ( v65 >= 45875.2 ) | |
5816 { | |
5817 stru_F8AD28.field_44 = 8; | |
5818 stru_F8AD28.field_48 = 3; | |
5819 } | |
5820 else | |
5821 { | |
5822 stru_F8AD28.field_44 = 16; | |
5823 stru_F8AD28.field_48 = 4; | |
5824 } | |
5825 } | |
5826 else | |
5827 { | |
5828 stru_F8AD28.field_44 = 32; | |
5829 stru_F8AD28.field_48 = 5; | |
5830 } | |
5831 } | |
5832 else | |
5833 { | |
5834 stru_F8AD28.field_44 = 64; | |
5835 stru_F8AD28.field_48 = 6; | |
5836 } | |
5837 } | |
5838 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
5839 | |
5840 //----- (004AF412) -------------------------------------------------------- | |
5841 int __cdecl sub_4AF412() | |
5842 { | |
5843 int v0; // ST20_4@2 | |
5844 int v1; // ST20_4@2 | |
5845 int v2; // ST20_4@2 | |
5846 int v3; // esi@2 | |
5847 int v4; // ST20_4@2 | |
5848 int v5; // ecx@2 | |
5849 int v6; // ebx@2 | |
5850 int v7; // edi@2 | |
5851 int v8; // edx@2 | |
5852 int v9; // eax@2 | |
5853 int result; // eax@4 | |
5854 | |
5855 stru_F8AD28.plane_4.vNormal.z = -65536; | |
5856 stru_F8AD28.vec_20.y = -65536; | |
5857 stru_F8AD28.plane_4.vNormal.x = 0; | |
5858 stru_F8AD28.plane_4.vNormal.y = 0; | |
5859 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
5860 stru_F8AD28.vec_14.x = 65536; | |
5861 stru_F8AD28.vec_14.y = 0; | |
5862 stru_F8AD28.vec_14.z = 0; | |
5863 stru_F8AD28.vec_20.x = 0; | |
5864 stru_F8AD28.vec_20.z = 0; | |
5865 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
5866 if ( pBLVRenderParams->sPartyRotX ) | |
5867 { | |
5868 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5869 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5870 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5871 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5872 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5873 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5874 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5875 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5876 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5877 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5878 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
5879 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5880 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5881 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5882 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5883 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5884 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5885 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5886 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5887 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5888 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5889 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5890 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5891 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5892 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5893 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5894 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
5895 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
5896 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5897 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5898 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5899 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5900 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5901 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5902 v6 = pBLVRenderParams->vPartyPos.z; | |
5903 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
5904 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
5905 v8 = pBLVRenderParams->vPartyPos.y; | |
5906 v9 = pBLVRenderParams->vPartyPos.x; | |
5907 } | |
5908 else | |
5909 { | |
5910 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5911 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5912 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5913 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5914 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
5915 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5916 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5917 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
5918 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5919 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5920 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5921 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
5922 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5923 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5924 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
5925 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
5926 v8 = pBLVRenderParams->vPartyPos.y; | |
5927 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
5928 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
5929 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
5930 v9 = pBLVRenderParams->vPartyPos.x; | |
5931 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
5932 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
5933 v6 = pBLVRenderParams->vPartyPos.z; | |
5934 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
5935 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
5936 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
5937 } | |
5938 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
5939 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
5940 + stru_F8AD28.plane_4.dist | |
5941 + stru_F8AD28.plane_4.vNormal.x * v9 | |
5942 + stru_F8AD28.plane_4.vNormal.z * v6; | |
5943 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5944 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
5945 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
5946 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
5947 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
5948 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
5949 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
5950 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
5951 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
5952 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
5953 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
5954 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
5955 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
5956 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
5957 result = 0; | |
5958 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
5959 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
5960 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
5961 stru_F8AD28.field_38 = 0; | |
5962 stru_F8AD28.field_3E4 = 0; | |
5963 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
5964 stru_F8AD28.uNumLightsApplied = 0; | |
5965 stru_F8AD28.field_34 = 0; | |
5966 return result; | |
5967 } | |
5968 | |
5969 //----- (004B1447) -------------------------------------------------------- | |
5970 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | |
5971 { | |
5972 signed int v3; // esi@1 | |
5973 char v4; // sf@8 | |
5974 int v5; // eax@8 | |
5975 unsigned __int64 v6; // qax@12 | |
5976 DDM_DLV_Header *v7; // eax@14 | |
5977 Player **v8; // edi@18 | |
5978 Player *result; // eax@19 | |
735 | 5979 //char *v10; // esi@20 |
0 | 5980 |
5981 v3 = 0; | |
5982 if ( a2 ) | |
5983 { | |
5984 if ( a2 != 1 ) | |
5985 { | |
5986 if ( a2 == 2 ) | |
5987 v3 = 2; | |
5988 goto LABEL_13; | |
5989 } | |
5990 v3 = 2; | |
5991 } | |
5992 else | |
5993 { | |
5994 v3 = 1; | |
5995 } | |
5996 if ( pParty->uFine < 4000000 ) | |
5997 { | |
5998 v4 = a3 + pParty->uFine < 0; | |
5999 v5 = a3 + pParty->uFine; | |
6000 pParty->uFine += a3; | |
6001 if ( v4 ) | |
6002 { | |
6003 v5 = 0; | |
6004 pParty->uFine = 0; | |
6005 } | |
6006 if ( v5 > 4000000 ) | |
6007 pParty->uFine = 4000000; | |
6008 } | |
487 | 6009 |
6010 pParty->field_3C._shop_ban_times[a1] = pParty->uTimePlayed + 368640; | |
6011 | |
0 | 6012 LABEL_13: |
463 | 6013 pParty->InTheShopFlags[a1] = 1; |
0 | 6014 if ( v3 ) |
6015 { | |
6016 v7 = &pOutdoor->ddm; | |
6017 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6018 v7 = &pIndoor->dlv; | |
6019 v7->uReputation += v3; | |
6020 if ( v7->uReputation > 10000 ) | |
6021 v7->uReputation = 10000; | |
6022 } | |
6023 v8 = &pPlayers[1]; | |
6024 do | |
6025 { | |
6026 result = *v8; | |
6027 if ( pParty->uFine ) | |
6028 { | |
735 | 6029 //v10 = result->_guilds_member_bits; |
484 | 6030 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->_guilds_member_bits, 1); |
0 | 6031 if ( !(short)result ) |
735 | 6032 __debugbreak(); |
501 | 6033 //result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
0 | 6034 } |
6035 ++v8; | |
6036 } | |
6037 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | |
6038 return result; | |
6039 } | |
6040 | |
6041 //----- (004B1523) -------------------------------------------------------- | |
762 | 6042 void __thiscall sub_4B1523(int *_this) |
0 | 6043 { |
6044 int v1; // esi@1 | |
6045 int v2; // edx@1 | |
6046 unsigned int v3; // eax@2 | |
6047 int v4; // eax@4 | |
6048 LONG v5; // ecx@4 | |
6049 int v6; // eax@10 | |
6050 char *v7; // ST44_4@12 | |
6051 unsigned __int16 v8; // ax@12 | |
6052 GUIWindow a1; // [sp+Ch] [bp-68h]@4 | |
6053 unsigned int v11; // [sp+60h] [bp-14h]@1 | |
6054 POINT a2; // [sp+64h] [bp-10h]@1 | |
6055 int v13; // [sp+6Ch] [bp-8h]@4 | |
6056 int v14; // [sp+70h] [bp-4h]@4 | |
6057 | |
6058 v1 = *_this - 399; | |
6059 v2 = (*_this - 400) % 11 + 1; | |
6060 v11 = 4 * (*_this - 400) / 11; | |
6061 sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); | |
6062 if ( pMouse->GetCursorPos(&a2)->y <= 320 ) | |
6063 v3 = pMouse->GetCursorPos(&a2)->y + 30; | |
6064 else | |
6065 v3 = 30; | |
6066 a1.Hint = 0; | |
6067 a1.uFrameY = v3; | |
6068 a1.uFrameWidth = 328; | |
6069 a1.uFrameHeight = 68; | |
6070 a1.uFrameX = 90; | |
6071 a1.uFrameZ = 417; | |
6072 a1.uFrameW = v3 + 67; | |
6073 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); | |
6074 v14 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); | |
6075 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); | |
6076 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]); | |
6077 v5 = a2.y; | |
6078 if ( v14 > a2.y ) | |
6079 v5 = v14; | |
6080 if ( v13 > v5 ) | |
6081 v5 = v13; | |
6082 if ( v4 > v5 ) | |
6083 v5 = v4; | |
262 | 6084 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", |
6085 pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431], // "Normal" | |
6086 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433], // "Expert" | |
6087 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432], // "Master" | |
6088 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96], // "Grand" | |
6089 v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc); | |
0 | 6090 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0); |
6091 a1.uFrameHeight += v6; | |
6092 if ( (signed int)a1.uFrameHeight < 150 ) | |
6093 a1.uFrameHeight = 150; | |
819 | 6094 a1.uFrameWidth = game_viewport_width; |
0 | 6095 a1.DrawMessageBox(0); |
6096 a1.uFrameWidth -= 12; | |
6097 a1.uFrameHeight -= 12; | |
6098 v7 = pSpellStats->pInfos[v1].pName; | |
6099 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; | |
6100 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
949 | 6101 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 6102 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); |
6103 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); | |
6104 a1.uFrameZ = a1.uFrameX + 107; | |
6105 a1.uFrameWidth = 108; | |
6106 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); | |
6107 sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1)); | |
762 | 6108 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3); |
0 | 6109 } |
6110 | |
6111 //----- (004B1784) -------------------------------------------------------- | |
6112 bool __cdecl sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
6113 { | |
6114 Player *pPlayer; // ebx@1 | |
6115 bool result; // eax@2 | |
6116 unsigned __int16 v2; // ST0C_2@3 | |
6117 int v3; // eax@3 | |
6118 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
6119 | |
6120 pPlayer = pPlayers[uActiveCharacter]; | |
6121 if ( pPlayer->CanAct() ) | |
6122 { | |
6123 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
6124 result = 1; | |
6125 } | |
6126 else | |
6127 { | |
6128 pDialogueWindow->pNumPresenceButton = 0; | |
6129 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
6130 v4.uFrameX = 483; | |
6131 v4.uFrameWidth = 148; | |
6132 v4.uFrameZ = 334; | |
6133 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
6134 // "%s is in no condition to %s" | |
6135 // "do anything" | |
949 | 6136 v2 = TargetColor(255, 255, 0x9Bu); |
0 | 6137 v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0); |
6138 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u); | |
6139 result = 0; | |
6140 } | |
6141 return result; | |
6142 } | |
6143 // F8B1E0: using guessed type int dword_F8B1E0; | |
6144 | |
6145 //----- (004B1A2D) -------------------------------------------------------- | |
907 | 6146 void __cdecl ShowPopupShopItem() |
0 | 6147 { |
6148 POINT *v1; // esi@5 | |
6149 unsigned int v2; // eax@5 | |
6150 int v3; // ecx@5 | |
6151 POINT *v4; // esi@12 | |
6152 int v5; // eax@12 | |
6153 unsigned int v6; // eax@13 | |
6154 ItemGen *v7; // ecx@13 | |
6155 signed int v8; // esi@17 | |
6156 unsigned int v9; // eax@19 | |
475 | 6157 POINT v10; // [sp+8h] [bp-44h]@12 |
6158 POINT v11; // [sp+10h] [bp-3Ch]@12 | |
6159 POINT v12; // [sp+18h] [bp-34h]@18 | |
6160 POINT v13; // [sp+20h] [bp-2Ch]@17 | |
6161 POINT v14; // [sp+28h] [bp-24h]@17 | |
6162 POINT v15; // [sp+30h] [bp-1Ch]@17 | |
6163 POINT v16; // [sp+38h] [bp-14h]@5 | |
0 | 6164 POINT a2; // [sp+40h] [bp-Ch]@5 |
907 | 6165 |
484 | 6166 if ( in_current_building_type <= 0 ) |
0 | 6167 return; |
484 | 6168 if ( in_current_building_type <= BildingType_AlchemistShop ) |
0 | 6169 { |
749 | 6170 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
6171 { | |
6172 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) | |
0 | 6173 return; |
749 | 6174 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) |
0 | 6175 { |
475 | 6176 v8 = pMouse->GetCursorPos(&v15)->x - 14; |
907 | 6177 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); |
475 | 6178 if ( pMouse->GetCursorPos(&v13)->x <= 13 |
6179 || pMouse->GetCursorPos(&v12)->x >= 462 | |
907 | 6180 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) |
0 | 6181 return; |
907 | 6182 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); |
0 | 6183 return; |
6184 } | |
749 | 6185 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) |
0 | 6186 return; |
6187 } | |
475 | 6188 v4 = pMouse->GetCursorPos(&v11); |
6189 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; | |
0 | 6190 if ( !v5 ) |
6191 return; | |
336 | 6192 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); |
0 | 6193 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); |
749 | 6194 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) |
907 | 6195 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1]; |
6196 GameUI_DrawItemInfo(v7); | |
6197 return; | |
0 | 6198 } |
874 | 6199 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) |
0 | 6200 { |
6201 v1 = pMouse->GetCursorPos(&a2); | |
475 | 6202 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; |
0 | 6203 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
907 | 6204 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; |
6205 if ( v5 ) | |
336 | 6206 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)); |
0 | 6207 } |
6208 } | |
6209 // F8B198: using guessed type int dword_F8B198; | |
6210 // F8B19C: using guessed type int dword_F8B19C; | |
6211 | |
6212 //----- (004B1BDB) -------------------------------------------------------- | |
6213 void __stdcall RestAndHeal(__int64 uNumMinutes) | |
6214 { | |
6215 signed __int64 v1; // ST2C_8@1 | |
6216 signed __int64 v2; // qax@1 | |
6217 signed __int64 v3; // ST1C_8@1 | |
6218 unsigned __int64 v4; // qax@1 | |
6219 unsigned int v5; // ebx@1 | |
112 | 6220 Player *v6; // ebx@1 |
0 | 6221 |
6222 pParty->pHirelings[0].bHasUsedTheAbility = 0; | |
6223 pParty->pHirelings[1].bHasUsedTheAbility = 0; | |
6224 pParty->uTimePlayed += (signed __int64)((double)(7680 * uNumMinutes) * 0.033333335); | |
6225 v1 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | |
6226 v2 = v1 / 60 / 60; | |
6227 v3 = v2; | |
6228 v4 = (unsigned int)v2 / 0x18; | |
6229 v5 = (unsigned int)(v4 / 7) >> 2; | |
6230 pParty->uCurrentTimeSecond = v1 % 60; | |
6231 pParty->uCurrentMinute = v1 / 60 % 60; | |
6232 pParty->uCurrentHour = v3 % 24; | |
6233 pParty->uCurrentMonthWeek = v4 / 7 & 3; | |
6234 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; | |
6235 pParty->uCurrentMonth = v5 % 0xC; | |
352 | 6236 pParty->uCurrentYear = v5 / 0xC + game_starting_year; |
0 | 6237 pParty->RestAndHeal(); |
6238 dword_507B94 = 1; | |
112 | 6239 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; |
0 | 6240 do |
6241 { | |
112 | 6242 v6->uTimeToRecovery = 0; |
6243 memset(&v6->uTimeToRecovery, 0, 4u); | |
6244 ++v6; | |
6245 } | |
6246 while ( v6 <= &pParty->pPlayers[3] ); | |
130 | 6247 pParty->UpdatePlayersAndHirelingsEmotions(); |
0 | 6248 } |
6249 // 507B94: using guessed type int dword_507B94; | |
6250 | |
6251 //----- (004B1D27) -------------------------------------------------------- | |
6252 void __cdecl sub_4B1D27() | |
6253 { | |
6254 int v0; // edx@2 | |
6255 unsigned int v1; // ecx@7 | |
6256 signed int v2; // edi@10 | |
6257 int v3; // esi@10 | |
6258 __int16 v4; // ax@15 | |
6259 signed int v5; // edi@20 | |
6260 int v6; // esi@20 | |
6261 int v7[4]; // [sp+Ch] [bp-10h]@12 | |
6262 | |
484 | 6263 if ( in_current_building_type > 0 ) |
0 | 6264 { |
6265 v0 = 3; | |
484 | 6266 if ( in_current_building_type > BildingType_MagicShop ) |
6267 { | |
6268 if ( in_current_building_type == BildingType_Bank ) | |
0 | 6269 { |
6270 if ( !dword_F8B1E4 ) | |
6271 return; | |
6272 } | |
6273 else | |
6274 { | |
484 | 6275 if ( in_current_building_type != BildingType_Temple ) |
0 | 6276 return; |
6277 } | |
336 | 6278 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
735 | 6279 PlayHouseSound(v1, (HouseSoundID)v0); |
0 | 6280 return; |
6281 } | |
336 | 6282 v1 = (unsigned int)window_SpeakInHouse->ptr_1C; |
484 | 6283 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed ) |
0 | 6284 { |
6285 if ( pParty->uNumGold <= 0x2710 ) | |
6286 { | |
6287 if ( !dword_F8B1E4 ) | |
6288 return; | |
6289 v0 = 4; | |
907 | 6290 PlayHouseSound(v1, (HouseSoundID)v0); |
6291 return; | |
0 | 6292 } |
735 | 6293 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3)); |
0 | 6294 if ( !dword_F8B1E4 && !qword_A750D8 ) |
6295 { | |
6296 v5 = 0; | |
6297 v6 = 1; | |
6298 do | |
6299 { | |
6300 if ( pPlayers[v6]->CanAct() ) | |
6301 v7[v5++] = v6; | |
6302 ++v6; | |
6303 } | |
6304 while ( v6 <= 4 ); | |
6305 if ( v5 ) | |
6306 { | |
6307 qword_A750D8 = 256i64; | |
6308 word_A750E0 = 80; | |
6309 v4 = LOWORD(v7[rand() % v5]); | |
907 | 6310 word_A750E2 = v4; |
6311 return; | |
0 | 6312 } |
6313 } | |
6314 } | |
6315 else | |
6316 { | |
6317 if ( !qword_A750D8 ) | |
6318 { | |
6319 v2 = 0; | |
6320 v3 = 1; | |
6321 do | |
6322 { | |
6323 if ( pPlayers[v3]->CanAct() ) | |
6324 v7[v2++] = v3; | |
6325 ++v3; | |
6326 } | |
6327 while ( v3 <= 4 ); | |
6328 if ( v2 ) | |
6329 { | |
6330 qword_A750D8 = 256i64; | |
6331 word_A750E0 = 80; | |
6332 v4 = LOWORD(v7[rand() % v2]); | |
6333 word_A750E2 = v4; | |
6334 return; | |
6335 } | |
6336 } | |
6337 } | |
6338 } | |
6339 } | |
6340 | |
6341 //----- (004B1ECE) -------------------------------------------------------- | |
6342 void __cdecl sub_4B1ECE() | |
6343 { | |
6344 __int16 *v0; // edi@1 | |
6345 int v1; // ebx@3 | |
6346 Player *v2; // esi@3 | |
6347 int v3; // eax@4 | |
6348 signed int v4; // eax@9 | |
6349 int v5; // ebx@11 | |
89 | 6350 Player *v6; // esi@13 |
6351 ItemGen *v7; // eax@14 | |
0 | 6352 signed int v8; // edi@14 |
89 | 6353 ItemGen *v9; // [sp+Ch] [bp-Ch]@11 |
0 | 6354 signed int v10; // [sp+10h] [bp-8h]@13 |
6355 int v11; // [sp+14h] [bp-4h]@1 | |
89 | 6356 Player *v12; // [sp+14h] [bp-4h]@11 |
0 | 6357 |
484 | 6358 contract_approved = 0; |
0 | 6359 v11 = 0; |
6360 uDialogueType = 84; | |
827 | 6361 current_npc_text = (char *)pNPCTopics[667].pText; |
0 | 6362 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; |
6363 while ( 1 ) | |
6364 { | |
484 | 6365 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) ) |
0 | 6366 { |
6367 v1 = 0; | |
6368 v2 = pParty->pPlayers; | |
6369 do | |
6370 { | |
89 | 6371 LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1)); |
0 | 6372 if ( v3 ) |
6373 break; | |
6374 ++v2; | |
6375 ++v1; | |
6376 } | |
6377 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
6378 if ( v1 == 4 ) | |
6379 break; | |
6380 } | |
6381 ++v11; | |
6382 v0 += 2; | |
89 | 6383 if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) |
6384 break; | |
6385 } | |
6386 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) | |
6387 { | |
827 | 6388 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful |
89 | 6389 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
484 | 6390 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; |
89 | 6391 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); |
6392 } | |
484 | 6393 if ( contract_approved == 601 ) |
0 | 6394 { |
6395 v5 = 0; | |
89 | 6396 v12 = pParty->pPlayers;//[0].uClass; |
0 | 6397 v9 = 0; |
6398 while ( 1 ) | |
6399 { | |
135 | 6400 if ( v12->classType == PLAYER_CLASS_LICH ) |
0 | 6401 { |
6402 v10 = 0; | |
89 | 6403 v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; |
0 | 6404 do |
6405 { | |
89 | 6406 v7 = v6->pInventoryItems; |
0 | 6407 v8 = 138; |
6408 do | |
6409 { | |
89 | 6410 if ( v7->uItemID == 601 ) |
0 | 6411 { |
377 | 6412 if ( !v7->uHolderPlayer ) |
89 | 6413 v9 = v7; |
377 | 6414 if ( v7->uHolderPlayer == v5 ) |
0 | 6415 v10 = 1; |
6416 } | |
89 | 6417 ++v7; |
0 | 6418 --v8; |
6419 } | |
6420 while ( v8 ); | |
89 | 6421 ++v6; |
6422 } | |
6423 while ( v6 <= &pParty->pPlayers[3] ); | |
0 | 6424 if ( !v10 ) |
6425 break; | |
6426 } | |
89 | 6427 ++v12; |
0 | 6428 ++v5; |
89 | 6429 if ( v12 > &pParty->pPlayers[3] ) |
0 | 6430 return; |
6431 } | |
6432 if ( v9 ) | |
377 | 6433 v9->uHolderPlayer = v5; |
0 | 6434 } |
6435 } | |
6436 // 4F08EC: using guessed type int dword_4F08EC[]; | |
6437 // 722B3C: using guessed type int dword_722B3C; | |
6438 // 722B44: using guessed type int dword_722B44; | |
6439 // F8B1A8: using guessed type int dword_F8B1A8; | |
6440 | |
6441 //----- (004B2001) -------------------------------------------------------- | |
459 | 6442 void __fastcall ClickNPCTopic(signed int uMessageParam) |
6443 { | |
6444 //signed int v1; // eax@1 | |
6445 NPCData *pCurrentNPCInfo; // ebp@1 | |
6446 int pEventNumber; // ecx@8 | |
0 | 6447 Player *v4; // esi@20 |
467 | 6448 //int v5; // eax@28 |
6449 //int v6; // eax@31 | |
6450 //int v7; // eax@34 | |
6451 //int v8; // eax@37 | |
6452 //int v9; // eax@40 | |
6453 //unsigned int v10; // eax@43 | |
0 | 6454 char *v12; // eax@53 |
6455 char *v13; // eax@56 | |
6456 char *v14; // eax@57 | |
6457 char *v15; // eax@58 | |
467 | 6458 //unsigned int v16; // ebp@62 |
0 | 6459 char *v17; // ecx@63 |
6460 char *v18; // eax@65 | |
6461 const char *v19; // ecx@68 | |
248 | 6462 //unsigned int v20; // eax@69 |
467 | 6463 signed int pPrice; // ecx@70 |
0 | 6464 char *v22; // [sp-Ch] [bp-18h]@73 |
467 | 6465 //int v23; // [sp-8h] [bp-14h]@49 |
0 | 6466 char *v24; // [sp-8h] [bp-14h]@73 |
467 | 6467 //int v25; // [sp-4h] [bp-10h]@49 |
6468 | |
459 | 6469 uDialogueType = uMessageParam + 1; |
6470 pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; | |
467 | 6471 if ( uMessageParam <= 24 ) |
460 | 6472 { |
459 | 6473 switch ( uMessageParam ) |
6474 { | |
6475 case 13: | |
827 | 6476 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); |
6477 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
607 | 6478 NPCHireableDialogPrepare(); |
459 | 6479 dialogue_show_profession_details = false; |
6480 goto _return; | |
6481 case 19: | |
6482 pEventNumber = pCurrentNPCInfo->evt_A; | |
6483 break; | |
6484 case 20: | |
6485 pEventNumber = pCurrentNPCInfo->evt_B; | |
6486 break; | |
6487 case 21: | |
6488 pEventNumber = pCurrentNPCInfo->evt_C; | |
6489 break; | |
6490 case 22: | |
6491 pEventNumber = pCurrentNPCInfo->evt_D; | |
6492 break; | |
6493 case 23: | |
6494 pEventNumber = pCurrentNPCInfo->evt_E; | |
6495 break; | |
6496 case 24: | |
6497 pEventNumber = pCurrentNPCInfo->evt_F; | |
6498 break; | |
6499 default: | |
467 | 6500 goto _return; |
6501 } | |
6502 /*switch ( pEventNumber ) | |
6503 { | |
6504 case 139: | |
6505 sub_4B1ECE(); | |
6506 goto _return; | |
6507 case 311: | |
6508 sub_4BBA85_bounties(); | |
6509 goto _return; | |
6510 }*/ | |
459 | 6511 if ( pEventNumber < 200 || pEventNumber > 310 ) |
6512 { | |
6513 if ( pEventNumber < 400 || pEventNumber > 410 ) | |
6514 { | |
6515 if ( pEventNumber == 139 ) | |
0 | 6516 { |
6517 sub_4B1ECE(); | |
6518 } | |
6519 else | |
6520 { | |
459 | 6521 if ( pEventNumber == 311 ) |
0 | 6522 { |
6523 sub_4BBA85_bounties(); | |
6524 } | |
6525 else | |
6526 { | |
827 | 6527 current_npc_text = 0; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6528 activeLevelDecoration = (LevelDecoration*)1; |
459 | 6529 EventProcessor(pEventNumber, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
6530 activeLevelDecoration = NULL; |
0 | 6531 } |
6532 } | |
6533 } | |
6534 else | |
6535 { | |
459 | 6536 dword_F8B1D8 = uMessageParam; |
6537 DrawJoinGuildWindow(pEventNumber - 400); | |
0 | 6538 } |
6539 } | |
6540 else | |
6541 { | |
459 | 6542 sub_4B3FE5(pEventNumber); |
0 | 6543 } |
6544 goto _return; | |
460 | 6545 } |
459 | 6546 if ( uMessageParam != 76 ) |
6547 { | |
6548 if ( uMessageParam == 77 ) | |
6549 { | |
467 | 6550 //v16 = pCurrentNPCInfo->uProfession; |
248 | 6551 if (dialogue_show_profession_details) |
459 | 6552 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
0 | 6553 else |
459 | 6554 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; |
827 | 6555 current_npc_text = v17; |
254
d1af3319bc44
BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents:
250
diff
changeset
|
6556 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); |
248 | 6557 dialogue_show_profession_details = ~dialogue_show_profession_details; |
827 | 6558 current_npc_text = v18; |
0 | 6559 } |
6560 else | |
6561 { | |
459 | 6562 if ( uMessageParam == 79 ) |
0 | 6563 { |
484 | 6564 if ( contract_approved ) |
0 | 6565 { |
267 | 6566 Party::TakeGold(gold_transaction_amount); |
0 | 6567 if ( uActiveCharacter ) |
6568 { | |
492 | 6569 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6570 *(short *)v12 &= 0x3Fu; |
6571 switch ( dword_F8B1B0 ) | |
6572 { | |
6573 case 2: | |
492 | 6574 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6575 *v15 |= 0x40u; |
6576 break; | |
6577 case 3: | |
492 | 6578 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6579 *v14 |= 0x80u; |
6580 break; | |
6581 case 4: | |
492 | 6582 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; |
0 | 6583 v13[1] |= 1u; |
6584 break; | |
6585 } | |
187 | 6586 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0); |
0 | 6587 } |
437 | 6588 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6589 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6590 { |
990 | 6591 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6592 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6593 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6594 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6595 }*/ |
0 | 6596 } |
6597 } | |
6598 else | |
6599 { | |
492 | 6600 if ( uMessageParam == 82 && contract_approved ) //join guild |
0 | 6601 { |
267 | 6602 Party::TakeGold(gold_transaction_amount); |
0 | 6603 v4 = pParty->pPlayers; |
6604 do | |
6605 { | |
492 | 6606 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); |
0 | 6607 ++v4; |
6608 } | |
6609 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
6610 switch ( dword_F8B1D8 ) | |
6611 { | |
6612 case 19: | |
467 | 6613 pEventNumber = pCurrentNPCInfo->evt_A; |
6614 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6615 pCurrentNPCInfo->evt_A = 0; |
0 | 6616 break; |
6617 case 20: | |
467 | 6618 pEventNumber = pCurrentNPCInfo->evt_B; |
6619 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6620 pCurrentNPCInfo->evt_B = 0; |
0 | 6621 break; |
6622 case 21: | |
467 | 6623 pEventNumber = pCurrentNPCInfo->evt_C; |
6624 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6625 pCurrentNPCInfo->evt_C = 0; |
0 | 6626 break; |
6627 case 22: | |
467 | 6628 pEventNumber = pCurrentNPCInfo->evt_D; |
6629 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6630 pCurrentNPCInfo->evt_D = 0; |
0 | 6631 break; |
6632 case 23: | |
467 | 6633 pEventNumber = pCurrentNPCInfo->evt_E; |
6634 if ( pEventNumber >= 400 && pEventNumber <= 416 ) | |
459 | 6635 pCurrentNPCInfo->evt_E = 0; |
0 | 6636 break; |
6637 case 24: | |
467 | 6638 pEventNumber = pCurrentNPCInfo->evt_F; |
6639 if ( pEventNumber >= 400 && pEventNumber <= 416) | |
6640 pCurrentNPCInfo->evt_F = 0; | |
0 | 6641 break; |
6642 } | |
437 | 6643 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
6644 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6645 { |
990 | 6646 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6647 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6648 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6649 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6650 }*/ |
467 | 6651 //v11 = uActiveCharacter; |
0 | 6652 if ( uActiveCharacter ) |
6653 { | |
467 | 6654 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); |
0 | 6655 goto _return; |
6656 } | |
6657 } | |
6658 } | |
6659 } | |
6660 goto _return; | |
6661 } | |
6662 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
6663 { | |
467 | 6664 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" |
0 | 6665 goto _return; |
6666 } | |
459 | 6667 if ( pCurrentNPCInfo->uProfession != 51 ) |
6668 { | |
467 | 6669 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; |
6670 if ( pParty->uNumGold < pPrice ) | |
6671 { | |
6672 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | |
248 | 6673 dialogue_show_profession_details = false; |
0 | 6674 uDialogueType = 13; |
827 | 6675 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; |
6676 current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); | |
0 | 6677 if ( uActiveCharacter ) |
248 | 6678 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); |
467 | 6679 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
6680 goto _return; | |
6681 } | |
6682 Party::TakeGold(pPrice); | |
0 | 6683 } |
147 | 6684 //LOBYTE(v2->uFlags) |= 0x80u; |
655 | 6685 pCurrentNPCInfo->uFlags |= 128; |
0 | 6686 pParty->field_709 = 0; |
1035 | 6687 pParty->CountHirelings(); |
0 | 6688 if ( pParty->pHirelings[0].pName ) |
6689 { | |
459 | 6690 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1])); |
6691 v24 = pCurrentNPCInfo->pName; | |
0 | 6692 v22 = pParty->pHireling2Name; |
6693 } | |
6694 else | |
6695 { | |
459 | 6696 memcpy(pParty->pHirelings, pCurrentNPCInfo, 0x4Cu); |
6697 v24 = pCurrentNPCInfo->pName; | |
0 | 6698 v22 = pParty->pHireling1Name; |
6699 } | |
6700 strcpy(v22, v24); | |
6701 pParty->field_709 = 0; | |
1035 | 6702 pParty->CountHirelings(); |
480 | 6703 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); |
747 | 6704 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
437 | 6705 |
6706 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
6707 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 6708 { |
990 | 6709 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 6710 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
6711 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6712 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 6713 }*/ |
0 | 6714 if ( uActiveCharacter ) |
467 | 6715 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); |
0 | 6716 _return: |
460 | 6717 pVideoPlayer->_4BF5B2();//HouseVideo |
0 | 6718 } |
6719 | |
6720 //----- (004B254D) -------------------------------------------------------- | |
6721 char *__thiscall _4B254D_SkillMasteryTeacher(int _this) | |
6722 { | |
955 | 6723 //Player *v1; // esi@1 |
0 | 6724 int v2; // edx@1 |
6725 int v3; // ecx@1 | |
6726 int v4; // edi@1 | |
955 | 6727 int pClassType; // eax@7 |
0 | 6728 int v6; // eax@7 |
6729 int v7; // ebx@7 | |
955 | 6730 //int v8; // ebx@8 |
0 | 6731 signed int v9; // esi@8 |
6732 int v10; // eax@8 | |
6733 char *v11; // ecx@8 | |
6734 int v12; // edi@9 | |
6735 char *v13; // edx@9 | |
6736 signed int v14; // edi@10 | |
6737 unsigned int v16; // eax@29 | |
955 | 6738 //int v17; // eax@36 |
0 | 6739 char v18; // cl@46 |
6740 __int16 v19; // dx@56 | |
6741 int v20; // eax@60 | |
955 | 6742 //char *v21; // [sp-Ch] [bp-38h]@82 |
6743 //const char *v22; // [sp-8h] [bp-34h]@21 | |
6744 //unsigned int v23; // [sp-8h] [bp-34h]@38 | |
6745 //char *v24; // [sp-8h] [bp-34h]@82 | |
0 | 6746 char *v25; // [sp-4h] [bp-30h]@14 |
955 | 6747 //int v26; // [sp-4h] [bp-30h]@38 |
6748 //int v27; // [sp-4h] [bp-30h]@82 | |
0 | 6749 char v28[4]; // [sp+Ch] [bp-20h]@9 |
6750 int v29; // [sp+10h] [bp-1Ch]@13 | |
6751 int v30; // [sp+14h] [bp-18h]@15 | |
6752 int v31; // [sp+18h] [bp-14h]@16 | |
6753 unsigned __int16 a1[2]; // [sp+1Ch] [bp-10h]@7 | |
955 | 6754 //int v33; // [sp+20h] [bp-Ch]@7 |
0 | 6755 int v34; // [sp+24h] [bp-8h]@7 |
6756 char *v35; // [sp+28h] [bp-4h]@1 | |
6757 | |
484 | 6758 contract_approved = 0; |
0 | 6759 v2 = (_this - 200) % 3; |
6760 v3 = (_this - 200) / 3; | |
6761 v4 = v2; | |
6762 v35 = (char *)pNPCTopics[127].pText; | |
492 | 6763 dword_F8B1AC_award_bit_number = v3; |
0 | 6764 if ( v2 ) |
6765 { | |
6766 if ( v2 == 1 ) | |
6767 { | |
267 | 6768 gold_transaction_amount = 5000; |
0 | 6769 dword_F8B1B0 = 3; |
6770 } | |
6771 else | |
6772 { | |
6773 if ( v2 == 2 ) | |
6774 { | |
267 | 6775 gold_transaction_amount = 8000; |
0 | 6776 dword_F8B1B0 = 4; |
6777 } | |
6778 } | |
6779 } | |
6780 else | |
6781 { | |
267 | 6782 gold_transaction_amount = 2000; |
0 | 6783 dword_F8B1B0 = 2; |
6784 } | |
955 | 6785 pClassType = pPlayers[uActiveCharacter]->classType; |
6786 //v33 = pClassType; | |
6787 v6 = byte_4ED970_skill_learn_ability_by_class_table[pClassType][v3]; | |
6788 *(int *)a1 = pPlayers[uActiveCharacter]->pActiveSkills[v3]; | |
0 | 6789 v7 = a1[0] & 0x3F; |
6790 v34 = v2 + 2; | |
6791 if ( v6 < v2 + 2 ) | |
6792 { | |
955 | 6793 //v8 = v33; |
0 | 6794 v9 = 0; |
955 | 6795 v10 = pClassType - pClassType % 4; |
6796 v11 = &byte_4ED970_skill_learn_ability_by_class_table[pClassType - pClassType % 4][v3]; | |
0 | 6797 do |
6798 { | |
6799 v12 = (unsigned __int8)*v11; | |
6800 v13 = &v28[4 * v9]; | |
6801 *(int *)v13 = 0; | |
6802 if ( v12 < v34 ) | |
6803 { | |
6804 v14 = 1; | |
6805 } | |
6806 else | |
6807 { | |
6808 v14 = 1; | |
6809 *(int *)v13 = 1; | |
6810 } | |
6811 ++v9; | |
6812 v11 += 37; | |
6813 } | |
6814 while ( v9 < 4 ); | |
6815 if ( v29 == v14 ) | |
6816 { | |
6817 v25 = pClassNames[v10 + 1]; | |
6818 } | |
6819 else | |
6820 { | |
955 | 6821 if ( v30 == v14 )//crash |
0 | 6822 { |
6823 if ( v31 == v14 ) | |
6824 { | |
955 | 6825 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6826 return pTmpBuf; |
6827 } | |
6828 v25 = pClassNames[v10 + 2]; | |
6829 } | |
6830 else | |
6831 { | |
6832 if ( v31 != v14 ) | |
6833 { | |
955 | 6834 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. |
6835 return pTmpBuf; | |
0 | 6836 } |
6837 v25 = pClassNames[v10 + 3]; | |
6838 } | |
6839 } | |
955 | 6840 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. |
0 | 6841 return pTmpBuf; |
6842 } | |
955 | 6843 if ( !pPlayers[uActiveCharacter]->CanAct() ) |
0 | 6844 return (char *)pNPCTopics[122].pText; |
6845 if ( !v7 ) | |
6846 return (char *)pNPCTopics[131].pText; | |
6847 v16 = SkillToMastery(a1[0]); | |
6848 if ( (signed int)v16 > v4 + 1 ) | |
6849 return (char *)pNPCTopics[v4 + 128].pText; | |
6850 if ( v34 != 2 ) | |
6851 { | |
6852 if ( v34 == 3 ) | |
6853 { | |
6854 if ( (signed int)v16 >= 2 && v7 >= 7 ) | |
6855 { | |
492 | 6856 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6857 { |
6858 case 12: | |
6859 case 13: | |
6860 case 14: | |
6861 case 15: | |
6862 case 16: | |
6863 case 17: | |
6864 case 18: | |
267 | 6865 gold_transaction_amount = 4000; |
0 | 6866 goto LABEL_42; |
6867 case 19: | |
6868 v19 = 114; | |
955 | 6869 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
6870 return v35; | |
6871 if ( !gold_transaction_amount ) | |
6872 goto LABEL_79; | |
6873 goto LABEL_42; | |
0 | 6874 case 20: |
6875 v19 = 110; | |
484 | 6876 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v19) ) |
0 | 6877 return v35; |
955 | 6878 if ( !gold_transaction_amount ) |
6879 goto LABEL_79; | |
6880 goto LABEL_42; | |
0 | 6881 case 22: |
955 | 6882 v20 = pPlayers[uActiveCharacter]->GetBaseWillpower(); |
6883 if ( v20 < 50 ) | |
6884 return v35; | |
6885 if ( !gold_transaction_amount ) | |
6886 goto LABEL_79; | |
6887 goto LABEL_42; | |
0 | 6888 case 24: |
267 | 6889 gold_transaction_amount = 2500; |
955 | 6890 v20 = pPlayers[uActiveCharacter]->GetBaseEndurance(); |
0 | 6891 if ( v20 < 50 ) |
6892 return v35; | |
955 | 6893 if ( !gold_transaction_amount ) |
6894 goto LABEL_79; | |
6895 goto LABEL_42; | |
6896 case 36: | |
6897 v20 = pPlayers[uActiveCharacter]->GetBaseIntelligence(); | |
6898 if ( v20 < 50 ) | |
6899 return v35; | |
6900 if ( !gold_transaction_amount ) | |
6901 goto LABEL_79; | |
6902 goto LABEL_42; | |
0 | 6903 case 21: |
6904 case 23: | |
6905 case 25: | |
6906 case 26: | |
6907 case 29: | |
6908 case 32: | |
6909 case 34: | |
6910 case 35: | |
267 | 6911 gold_transaction_amount = 2500; |
0 | 6912 goto LABEL_42; |
6913 case 8: | |
6914 case 9: | |
6915 case 10: | |
6916 case 11: | |
267 | 6917 gold_transaction_amount = 3000; |
0 | 6918 goto LABEL_42; |
6919 case 7: | |
955 | 6920 gold_transaction_amount = 0; |
6921 if ( !gold_transaction_amount ) | |
6922 goto LABEL_79; | |
6923 goto LABEL_42; | |
6924 default: | |
6925 if ( !gold_transaction_amount ) | |
6926 goto LABEL_79; | |
6927 goto LABEL_42; | |
0 | 6928 } |
955 | 6929 gold_transaction_amount = 0; |
6930 if ( !gold_transaction_amount ) | |
6931 goto LABEL_79; | |
6932 goto LABEL_42; | |
0 | 6933 } |
6934 } | |
6935 else | |
6936 { | |
6937 if ( v34 != 4 ) | |
6938 { | |
955 | 6939 if ( !gold_transaction_amount ) |
6940 goto LABEL_79; | |
6941 goto LABEL_42; | |
0 | 6942 } |
6943 if ( (signed int)v16 >= 3 && v7 >= 10 ) | |
6944 { | |
492 | 6945 switch ( dword_F8B1AC_award_bit_number ) |
0 | 6946 { |
6947 case 19: | |
955 | 6948 if ( pPlayers[uActiveCharacter]->_49327B(0x22u, 1) == 1 ) |
6949 { | |
6950 if ( !gold_transaction_amount ) | |
6951 goto LABEL_79; | |
6952 goto LABEL_42; | |
6953 } | |
6954 if ( pPlayers[uActiveCharacter]->_49327B(26, 1) == 1 ) | |
6955 { | |
6956 if ( !gold_transaction_amount ) | |
6957 goto LABEL_79; | |
6958 goto LABEL_42; | |
6959 } | |
6960 return v35; | |
0 | 6961 case 20: |
955 | 6962 if ( pPlayers[uActiveCharacter]->_49327B(0x23u, 1) == 1 ) |
6963 { | |
6964 if ( !gold_transaction_amount ) | |
6965 goto LABEL_79; | |
6966 goto LABEL_42; | |
6967 } | |
6968 if ( pPlayers[uActiveCharacter]->_49327B(27, 1) == 1 ) | |
6969 { | |
6970 if ( !gold_transaction_amount ) | |
6971 goto LABEL_79; | |
6972 goto LABEL_42; | |
6973 } | |
0 | 6974 return v35; |
6975 case 30: | |
955 | 6976 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[31]); |
0 | 6977 if ( (v18 & 0x3Fu) < 0xA ) |
6978 return v35; | |
955 | 6979 if ( !gold_transaction_amount ) |
6980 goto LABEL_79; | |
6981 goto LABEL_42; | |
6982 case 31: | |
6983 v18 = LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[30]); | |
6984 if ( (v18 & 0x3Fu) < 0xA ) | |
6985 return v35; | |
6986 if ( !gold_transaction_amount ) | |
6987 goto LABEL_79; | |
6988 goto LABEL_42; | |
0 | 6989 case 21: |
6990 case 23: | |
6991 case 24: | |
6992 case 25: | |
6993 case 26: | |
6994 case 29: | |
6995 case 32: | |
6996 case 34: | |
6997 case 35: | |
267 | 6998 gold_transaction_amount = 6000; |
0 | 6999 goto LABEL_42; |
7000 case 8: | |
7001 case 9: | |
7002 case 10: | |
7003 case 11: | |
267 | 7004 gold_transaction_amount = 7000; |
0 | 7005 goto LABEL_42; |
7006 case 7: | |
7007 break; | |
955 | 7008 default: |
7009 if ( !gold_transaction_amount ) | |
7010 goto LABEL_79; | |
7011 goto LABEL_42; | |
0 | 7012 } |
267 | 7013 gold_transaction_amount = 0; |
955 | 7014 if ( !gold_transaction_amount ) |
7015 goto LABEL_79; | |
7016 goto LABEL_42; | |
0 | 7017 } |
7018 } | |
7019 return v35; | |
7020 } | |
7021 if ( v7 < 4 ) | |
7022 return v35; | |
492 | 7023 if ( dword_F8B1AC_award_bit_number > 27 ) |
7024 { | |
7025 if ( dword_F8B1AC_award_bit_number != 29 | |
7026 && dword_F8B1AC_award_bit_number != 32 | |
7027 && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) | |
0 | 7028 { |
267 | 7029 if ( !gold_transaction_amount ) |
0 | 7030 goto LABEL_79; |
7031 goto LABEL_42; | |
7032 } | |
267 | 7033 gold_transaction_amount = 500; |
955 | 7034 if ( !gold_transaction_amount ) |
7035 goto LABEL_79; | |
7036 goto LABEL_42; | |
0 | 7037 } |
492 | 7038 if ( dword_F8B1AC_award_bit_number >= 23 ) |
955 | 7039 { |
7040 gold_transaction_amount = 500; | |
7041 if ( !gold_transaction_amount ) | |
7042 goto LABEL_79; | |
7043 goto LABEL_42; | |
7044 } | |
492 | 7045 if ( dword_F8B1AC_award_bit_number == 7 ) |
0 | 7046 { |
267 | 7047 gold_transaction_amount = 0; |
0 | 7048 goto LABEL_79; |
7049 } | |
492 | 7050 if ( dword_F8B1AC_award_bit_number <= 7 ) |
955 | 7051 { |
7052 if ( !gold_transaction_amount ) | |
7053 goto LABEL_79; | |
7054 goto LABEL_42; | |
7055 } | |
492 | 7056 if ( dword_F8B1AC_award_bit_number > 18 ) |
7057 { | |
7058 if ( dword_F8B1AC_award_bit_number != 21 ) | |
955 | 7059 { |
7060 if ( !gold_transaction_amount ) | |
7061 goto LABEL_79; | |
7062 goto LABEL_42; | |
7063 } | |
7064 gold_transaction_amount = 500; | |
7065 if ( !gold_transaction_amount ) | |
7066 goto LABEL_79; | |
7067 goto LABEL_42; | |
0 | 7068 } |
267 | 7069 gold_transaction_amount = 1000; |
0 | 7070 LABEL_42: |
267 | 7071 if ( gold_transaction_amount > pParty->uNumGold ) |
0 | 7072 return (char *)pNPCTopics[124].pText; |
7073 LABEL_79: | |
484 | 7074 contract_approved = 1; |
0 | 7075 if ( v34 == 2 ) |
7076 { | |
955 | 7077 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ] |
7078 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò | |
7079 return pTmpBuf2; | |
0 | 7080 } |
7081 if ( v34 == 3 ) | |
7082 { | |
955 | 7083 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7084 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð | |
7085 return pTmpBuf2; | |
0 | 7086 } |
7087 if ( v34 == 4 ) | |
955 | 7088 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], |
7089 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð | |
0 | 7090 return pTmpBuf2; |
7091 } | |
7092 | |
7093 //----- (004B29F2) -------------------------------------------------------- | |
492 | 7094 const char * ContractSelectText( int pEventCode ) |
7095 { | |
7096 static const int dialogue_base=110; | |
484 | 7097 contract_approved = 0; |
492 | 7098 dword_F8B1AC_award_bit_number = pEventCode + 50; |
7099 gold_transaction_amount = price_for_membership[pEventCode]; | |
459 | 7100 if ( pPlayers[uActiveCharacter]->CanAct() ) |
7101 { | |
492 | 7102 if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) |
7103 { | |
7104 return pNPCTopics[dialogue_base+13].pText; | |
0 | 7105 } |
7106 else | |
7107 { | |
267 | 7108 if ( gold_transaction_amount <= pParty->uNumGold ) |
0 | 7109 { |
484 | 7110 contract_approved = 1; |
492 | 7111 return pNPCTopics[pEventCode + dialogue_base].pText; |
0 | 7112 } |
7113 else | |
7114 { | |
492 | 7115 return pNPCTopics[dialogue_base+14].pText; |
0 | 7116 } |
7117 } | |
7118 } | |
7119 else | |
7120 { | |
492 | 7121 return pNPCTopics[dialogue_base+12].pText; |
0 | 7122 } |
7123 } | |
7124 | |
7125 //----- (004B2A74) -------------------------------------------------------- | |
762 | 7126 void SimpleHouseAndBoatsDialog() |
0 | 7127 { |
7128 char *v0; // esi@3 | |
7129 char *v1; // ST1C_4@3 | |
7130 char *v2; // eax@3 | |
7131 const char *v3; // ST1C_4@5 | |
7132 int v4; // eax@5 | |
7133 unsigned int i; // eax@5 | |
7134 NPCData *v6; // esi@6 | |
7135 unsigned __int16 v7; // bx@6 | |
7136 unsigned int v8; // eax@6 | |
7137 int v9; // eax@11 | |
7138 unsigned int v10; // ecx@12 | |
7139 int v11; // eax@12 | |
7140 int v12; // esi@12 | |
7141 char *v13; // eax@12 | |
7142 GUIWindow *v14; // ebx@13 | |
7143 char *v15; // esi@14 | |
7144 GUIButton *v16; // eax@15 | |
7145 unsigned int v17; // ecx@15 | |
7146 int v18; // ecx@17 | |
7147 int v19; // ecx@18 | |
7148 int v20; // ecx@19 | |
7149 int v21; // ecx@20 | |
7150 int v22; // ecx@21 | |
7151 unsigned int v23; // ecx@23 | |
7152 int v24; // ecx@35 | |
7153 int v25; // ecx@36 | |
7154 int v26; // ecx@37 | |
7155 int v27; // ecx@38 | |
7156 int v28; // ecx@39 | |
7157 char *v29; // esi@42 | |
7158 unsigned int v30; // ST20_4@42 | |
7159 int v31; // ST1C_4@42 | |
7160 unsigned int v32; // eax@42 | |
7161 char *v33; // eax@43 | |
7162 int v34; // esi@51 | |
7163 int v35; // eax@51 | |
7164 unsigned int v36; // edi@51 | |
7165 GUIButton *v37; // eax@52 | |
7166 int v38; // eax@52 | |
7167 signed int v39; // ecx@54 | |
7168 int v40; // edi@57 | |
7169 GUIButton *v41; // eax@60 | |
7170 GUIButton *v42; // esi@60 | |
7171 const char *v43; // ebx@60 | |
7172 int v44; // eax@60 | |
7173 unsigned int v45; // ecx@60 | |
7174 unsigned __int16 v46; // ax@60 | |
7175 GUIFont *v47; // ebx@64 | |
7176 int v48; // esi@64 | |
7177 char *v49; // eax@66 | |
7178 GUIWindow w; // [sp+Ch] [bp-110h]@64 | |
7179 GUIWindow v52; // [sp+60h] [bp-BCh]@13 | |
7180 GUIWindow a1; // [sp+B4h] [bp-68h]@1 | |
7181 unsigned int v54; // [sp+108h] [bp-14h]@14 | |
7182 int v55; // [sp+10Ch] [bp-10h]@6 | |
7183 int v56; // [sp+110h] [bp-Ch]@13 | |
7184 char *pInString; // [sp+114h] [bp-8h]@12 | |
7185 NPCData *v58; // [sp+118h] [bp-4h]@6 | |
7186 | |
7187 memcpy(&a1, pDialogueWindow, sizeof(a1)); | |
459 | 7188 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 7189 { |
7190 v0 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7191 v1 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
7192 a1.uFrameX = 493; | |
7193 a1.uFrameWidth = 126; | |
7194 a1.uFrameZ = 366; | |
7195 a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); | |
7196 a1.uFrameX = 483; | |
7197 a1.uFrameWidth = 148; | |
7198 a1.uFrameZ = 334; | |
434 | 7199 v2 = pTransitionStrings[uHouse_ExitPic]; |
0 | 7200 if ( !v2 ) |
7201 { | |
721 | 7202 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); |
0 | 7203 v2 = pTmpBuf; |
7204 } | |
7205 v3 = v2; | |
7206 v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); | |
762 | 7207 a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); |
7208 return; | |
0 | 7209 } |
7210 a1.uFrameWidth -= 10; | |
7211 a1.uFrameZ -= 10; | |
459 | 7212 v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7213 v6 = v58; |
949 | 7214 v55 = TargetColor(0xE1u, 0xCDu, 0x23u); |
7215 v7 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 7216 v8 = v6->uProfession; |
7217 if ( v8 ) | |
264 | 7218 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); |
0 | 7219 else |
7220 strcpy(pTmpBuf, v6->pName); | |
7221 a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u); | |
7222 if ( !dword_591080 ) | |
7223 { | |
7224 if ( !uDialogueType ) | |
7225 { | |
7226 v9 = v6->greet; | |
7227 if ( v9 ) | |
7228 { | |
7229 v10 = v6->uFlags; | |
819 | 7230 a1.uFrameWidth = game_viewport_width; |
0 | 7231 a1.uFrameZ = 452; |
7232 pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); | |
7233 v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); | |
7234 v12 = v11 + 7; | |
973 | 7235 pRenderer->_4A6A68(8, 352 - (v11 + 7), |
7236 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7237 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); | |
0 | 7238 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); |
7239 v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); | |
7240 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); | |
7241 } | |
7242 } | |
7243 } | |
7244 v14 = pDialogueWindow; | |
7245 memcpy(&v52, pDialogueWindow, sizeof(v52)); | |
7246 v52.uFrameX = 483; | |
7247 v52.uFrameWidth = 148; | |
7248 v52.uFrameZ = 334; | |
7249 v56 = v52.pStartingPosActiveItem; | |
7250 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7251 { | |
348 | 7252 v15 = "";//(char *)v54; |
0 | 7253 while ( 1 ) |
7254 { | |
7255 v16 = v52.GetControl(v56); | |
832 | 7256 v17 = v16->msg_param; |
0 | 7257 pInString = (char *)v16; |
7258 if ( (signed int)v17 > 24 ) | |
7259 { | |
7260 v24 = v17 - 76; | |
7261 if ( !v24 ) | |
7262 { | |
7263 v15 = pGlobalTXT_LocalizationStrings[406]; | |
7264 goto LABEL_49; | |
7265 } | |
7266 v25 = v24 - 1; | |
7267 if ( !v25 ) | |
7268 { | |
7269 v15 = pGlobalTXT_LocalizationStrings[407]; | |
7270 goto LABEL_49; | |
7271 } | |
7272 v26 = v25 - 2; | |
7273 if ( !v26 ) | |
7274 { | |
7275 v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); | |
7276 LABEL_44: | |
7277 v15 = v33; | |
7278 LABEL_45: | |
7279 v16 = (GUIButton *)pInString; | |
7280 goto LABEL_49; | |
7281 } | |
7282 v27 = v26 - 3; | |
7283 if ( !v27 ) | |
7284 { | |
459 | 7285 v33 = (char *)ContractSelectText((int)v52.ptr_1C); |
0 | 7286 goto LABEL_44; |
7287 } | |
7288 v28 = v27 - 1; | |
7289 if ( !v28 ) | |
7290 { | |
7291 v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; | |
949 | 7292 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
0 | 7293 v31 = *(int *)v29; |
949 | 7294 v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1033 | 7295 sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30); |
7296 sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); | |
827 | 7297 current_npc_text = pTmpBuf2; |
0 | 7298 v15 = ""; |
7299 goto LABEL_45; | |
7300 } | |
7301 if ( v28 != 10 ) | |
7302 goto LABEL_41; | |
7303 } | |
7304 else | |
7305 { | |
7306 if ( v17 == 24 ) | |
7307 { | |
291 | 7308 v23 = v58->evt_F; |
0 | 7309 LABEL_33: |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
66
diff
changeset
|
7310 v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
0 | 7311 if ( !v15 ) |
7312 { | |
832 | 7313 v16->msg_param = 0; |
0 | 7314 v15 = ""; |
7315 } | |
7316 goto LABEL_49; | |
7317 } | |
7318 v18 = v17 - 13; | |
7319 if ( v18 ) | |
7320 { | |
7321 v19 = v18 - 6; | |
7322 if ( !v19 ) | |
7323 { | |
291 | 7324 v23 = v58->evt_A; |
0 | 7325 goto LABEL_33; |
7326 } | |
7327 v20 = v19 - 1; | |
7328 if ( !v20 ) | |
7329 { | |
291 | 7330 v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; |
0 | 7331 if ( !v15 ) |
7332 { | |
832 | 7333 v16->msg_param = 0; |
0 | 7334 v15 = ""; |
7335 } | |
7336 if ( uDialogueType != 84 ) | |
7337 goto LABEL_49; | |
484 | 7338 sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); |
827 | 7339 sprintf(pTmpBuf2, current_npc_text, pTmpBuf); |
7340 current_npc_text = pTmpBuf2; | |
0 | 7341 goto LABEL_45; |
7342 } | |
7343 v21 = v20 - 1; | |
7344 if ( !v21 ) | |
7345 { | |
291 | 7346 v23 = v58->evt_C; |
0 | 7347 goto LABEL_33; |
7348 } | |
7349 v22 = v21 - 1; | |
7350 if ( !v22 ) | |
7351 { | |
291 | 7352 v23 = v58->evt_D; |
0 | 7353 goto LABEL_33; |
7354 } | |
7355 if ( v22 == 1 ) | |
7356 { | |
291 | 7357 v23 = v58->evt_E; |
0 | 7358 goto LABEL_33; |
7359 } | |
7360 LABEL_41: | |
7361 v15 = ""; | |
7362 goto LABEL_49; | |
7363 } | |
7364 v15 = pGlobalTXT_LocalizationStrings[122]; | |
7365 } | |
7366 LABEL_49: | |
7367 strcpy(v16->pButtonName, v15); | |
7368 ++v56; | |
7369 if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) | |
7370 { | |
7371 v14 = pDialogueWindow; | |
7372 break; | |
7373 } | |
7374 } | |
7375 } | |
7376 v34 = 0; | |
949 | 7377 v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7378 v35 = TargetColor(0xE1u, 0xCDu, 0x23u); | |
0 | 7379 v36 = v14->pStartingPosActiveItem; |
7380 v55 = v35; | |
7381 for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton | |
7382 + pDialogueWindow->pStartingPosActiveItem ) | |
7383 { | |
7384 v37 = v14->GetControl(v36); | |
7385 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); | |
7386 v14 = pDialogueWindow; | |
7387 v34 += v38; | |
7388 ++v36; | |
7389 } | |
7390 v39 = v14->pNumPresenceButton; | |
7391 if ( v39 ) | |
7392 { | |
7393 v58 = (NPCData *)((174 - v34) / v39); | |
7394 if ( (signed int)v58 > 32 ) | |
7395 v58 = (NPCData *)32; | |
7396 pInString = (char *)2; | |
7397 v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; | |
7398 v56 = v14->pStartingPosActiveItem; | |
7399 i = v56; | |
7400 if ( (signed int)i < (signed int)(i + v39) ) | |
7401 { | |
7402 while ( 1 ) | |
7403 { | |
7404 v41 = v14->GetControl(i); | |
7405 v42 = v41; | |
7406 v43 = v41->pButtonName; | |
7407 v41->uY = (unsigned int)((char *)v58 + v40); | |
7408 v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); | |
7409 v45 = v42->uY; | |
7410 v42->uHeight = v44; | |
7411 v40 = v45 + v44 - 1; | |
7412 v42->uW = v40; | |
7413 v46 = v55; | |
7414 if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) | |
7415 v46 = v54; | |
7416 v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); | |
7417 v14 = pDialogueWindow; | |
7418 ++pInString; | |
7419 ++v56; | |
7420 i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
7421 if ( v56 >= (signed int)i ) | |
7422 break; | |
7423 i = v56; | |
7424 } | |
7425 } | |
7426 } | |
827 | 7427 if ( current_npc_text ) |
0 | 7428 { |
7429 w.uFrameWidth = 458; | |
7430 w.uFrameZ = 457; | |
7431 v47 = pFontArrus; | |
827 | 7432 v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7433 if ( 352 - v48 < 8 ) |
7434 { | |
7435 v47 = pFontCreate; | |
827 | 7436 v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
0 | 7437 } |
973 | 7438 pRenderer->_4A6A68(8, 352 - v48, |
7439 pIcons_LOD->GetTexture(uTextureID_Leather), | |
7440 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); | |
0 | 7441 pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); |
827 | 7442 v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); |
762 | 7443 a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); |
7444 } | |
0 | 7445 } |
7446 | |
7447 //----- (004B36CC) -------------------------------------------------------- | |
473 | 7448 void CreateButtonInColumn( int column_pos, unsigned int control_id ) |
782 | 7449 { |
832 | 7450 pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, UIMSG_SelectShopDialogueOption, control_id, 0, "", 0); |
0 | 7451 } |
7452 | |
7453 //----- (004B3A72) -------------------------------------------------------- | |
473 | 7454 void sub_4B3A72( int a1 ) |
7455 { | |
7456 int num_buttons; // esi@1 | |
7457 | |
7458 num_buttons = 0; | |
0 | 7459 if ( a1 == 21 ) |
7460 { | |
473 | 7461 CreateButtonInColumn(0, 0x66u); |
7462 num_buttons = 2; | |
7463 CreateButtonInColumn(1, 0x67u); | |
7464 if ( pParty->HasItem(651) ) //Arcomage Deck | |
7465 { | |
7466 num_buttons = 3; | |
7467 CreateButtonInColumn(2, 0x68u); | |
7468 } | |
7469 } | |
972 | 7470 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); |
0 | 7471 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7472 } | |
7473 // F8B1E0: using guessed type int dword_F8B1E0; | |
7474 | |
7475 //----- (004B3AD4) -------------------------------------------------------- | |
473 | 7476 void sub_4B3AD4( signed int a1 ) |
7477 { | |
0 | 7478 if ( a1 > 0 ) |
7479 { | |
7480 if ( a1 <= 3 ) | |
7481 { | |
473 | 7482 CreateButtonInColumn(0, 3u); |
7483 CreateButtonInColumn(1, 4u); | |
7484 CreateButtonInColumn(2, 5u); | |
972 | 7485 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); |
0 | 7486 } |
7487 if ( a1 == 4 ) | |
7488 { | |
473 | 7489 CreateButtonInColumn(0, 3u); |
7490 CreateButtonInColumn(1, 4u); | |
972 | 7491 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); |
473 | 7492 } |
7493 } | |
0 | 7494 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7495 } | |
7496 // F8B1E0: using guessed type int dword_F8B1E0; | |
7497 | |
7498 //----- (004B3B42) -------------------------------------------------------- | |
473 | 7499 void sub_4B3B42( signed int a1 ) |
7500 { | |
0 | 7501 int v1; // ecx@18 |
7502 int v2; // ecx@19 | |
7503 int v3; // ecx@20 | |
7504 signed int v4; // esi@22 | |
7505 signed int v5; // eax@22 | |
7506 unsigned int v6; // edx@24 | |
7507 int v7; // ecx@24 | |
7508 int result; // eax@43 | |
7509 int v9; // [sp-10h] [bp-14h]@28 | |
7510 int v10; // [sp-Ch] [bp-10h]@28 | |
7511 int v11; // [sp-8h] [bp-Ch]@28 | |
7512 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
7513 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
7514 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
7515 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
7516 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
7517 int v17; // [sp-4h] [bp-8h]@28 | |
7518 | |
7519 if ( a1 > 13 ) | |
7520 { | |
7521 if ( a1 > 22 ) | |
7522 { | |
7523 if ( a1 == 23 ) | |
7524 { | |
473 | 7525 CreateButtonInColumn(0, 0xAu); |
7526 CreateButtonInColumn(1, 0xBu); | |
0 | 7527 v14 = 96; |
7528 LABEL_41: | |
473 | 7529 CreateButtonInColumn(2, v14); |
0 | 7530 v17 = 2; |
7531 v11 = 0; | |
7532 v10 = 1; | |
7533 v9 = 3; | |
7534 goto LABEL_42; | |
7535 } | |
7536 if ( a1 <= 26 ) | |
7537 goto LABEL_43; | |
7538 if ( a1 > 28 ) | |
7539 { | |
7540 if ( a1 != 30 ) | |
7541 goto LABEL_43; | |
473 | 7542 CreateButtonInColumn(0, 0x11u); |
0 | 7543 v16 = 96; |
7544 goto LABEL_37; | |
7545 } | |
473 | 7546 CreateButtonInColumn(0, 0x69u); |
7547 CreateButtonInColumn(1, 0x6Au); | |
7548 CreateButtonInColumn(2, 0x6Bu); | |
0 | 7549 v12 = 108; |
7550 } | |
7551 else | |
7552 { | |
7553 if ( a1 == 22 ) | |
7554 { | |
473 | 7555 CreateButtonInColumn(0, 7u); |
0 | 7556 v16 = 8; |
7557 goto LABEL_37; | |
7558 } | |
7559 v1 = a1 - 14; | |
7560 if ( !v1 ) | |
7561 { | |
473 | 7562 CreateButtonInColumn(0, 0x12u); |
7563 CreateButtonInColumn(1, 0x30u); | |
7564 CreateButtonInColumn(2, 0x31u); | |
7565 CreateButtonInColumn(3, 0x32u); | |
7566 CreateButtonInColumn(4, 0x33u); | |
0 | 7567 v17 = 2; |
7568 v11 = 0; | |
7569 v10 = 1; | |
7570 v9 = 5; | |
7571 goto LABEL_42; | |
7572 } | |
7573 v2 = v1 - 1; | |
7574 if ( v2 ) | |
7575 { | |
7576 v3 = v2 - 2; | |
7577 if ( v3 ) | |
7578 { | |
7579 if ( v3 != 4 ) | |
7580 goto LABEL_43; | |
473 | 7581 CreateButtonInColumn(0, 0xFu); |
7582 CreateButtonInColumn(1, 0x10u); | |
0 | 7583 v4 = 3; |
473 | 7584 CreateButtonInColumn(2, 0x60u); |
336 | 7585 v5 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 7586 if ( v5 < 108 || v5 > 120 ) |
7587 goto LABEL_28; | |
7588 v4 = 4; | |
7589 v6 = 101; | |
7590 v7 = 3; | |
7591 } | |
7592 else | |
7593 { | |
7594 v4 = 1; | |
473 | 7595 CreateButtonInColumn(0, 0x63u); |
0 | 7596 if ( !pParty->uFine ) |
7597 { | |
7598 LABEL_28: | |
7599 v17 = 2; | |
7600 v11 = 0; | |
7601 v10 = 1; | |
7602 v9 = v4; | |
7603 LABEL_42: | |
972 | 7604 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); |
0 | 7605 goto LABEL_43; |
7606 } | |
7607 v4 = 2; | |
7608 v7 = 1; | |
7609 v6 = 100; | |
7610 } | |
473 | 7611 CreateButtonInColumn(v7, v6); |
0 | 7612 goto LABEL_28; |
7613 } | |
473 | 7614 CreateButtonInColumn(0, 0x12u); |
7615 CreateButtonInColumn(1, 0x34u); | |
7616 CreateButtonInColumn(2, 0x35u); | |
0 | 7617 v12 = 54; |
7618 } | |
7619 LABEL_39: | |
473 | 7620 CreateButtonInColumn(3, v12); |
0 | 7621 v17 = 2; |
7622 v11 = 0; | |
7623 v10 = 1; | |
7624 v9 = 4; | |
7625 goto LABEL_42; | |
7626 } | |
7627 if ( a1 == 13 ) | |
7628 { | |
473 | 7629 CreateButtonInColumn(0, 0x12u); |
0 | 7630 v16 = 56; |
7631 LABEL_37: | |
473 | 7632 CreateButtonInColumn(1, v16); |
0 | 7633 v17 = 2; |
7634 v11 = 0; | |
7635 v10 = 1; | |
7636 v9 = 2; | |
7637 goto LABEL_42; | |
7638 } | |
7639 switch ( a1 ) | |
7640 { | |
7641 case 1: | |
7642 case 2: | |
7643 case 3: | |
7644 case 4: | |
473 | 7645 CreateButtonInColumn(0, 2u); |
7646 CreateButtonInColumn(1, 0x5Fu); | |
7647 CreateButtonInColumn(2, 0x5Eu); | |
0 | 7648 v12 = 96; |
7649 goto LABEL_39; | |
7650 case 5: | |
473 | 7651 CreateButtonInColumn(0, 0x12u); |
0 | 7652 v13 = 48; |
7653 goto LABEL_9; | |
7654 case 6: | |
473 | 7655 CreateButtonInColumn(0, 0x12u); |
0 | 7656 v13 = 49; |
7657 goto LABEL_9; | |
7658 case 7: | |
473 | 7659 CreateButtonInColumn(0, 0x12u); |
0 | 7660 v13 = 50; |
7661 goto LABEL_9; | |
7662 case 8: | |
473 | 7663 CreateButtonInColumn(0, 0x12u); |
0 | 7664 v13 = 51; |
7665 LABEL_9: | |
473 | 7666 CreateButtonInColumn(1, v13); |
0 | 7667 v14 = 72; |
7668 goto LABEL_41; | |
7669 case 9: | |
473 | 7670 CreateButtonInColumn(0, 0x12u); |
0 | 7671 v15 = 52; |
7672 goto LABEL_13; | |
7673 case 10: | |
473 | 7674 CreateButtonInColumn(0, 0x12u); |
0 | 7675 v15 = 53; |
7676 goto LABEL_13; | |
7677 case 11: | |
473 | 7678 CreateButtonInColumn(0, 0x12u); |
0 | 7679 v15 = 54; |
7680 LABEL_13: | |
473 | 7681 CreateButtonInColumn(1, v15); |
0 | 7682 v14 = 61; |
7683 goto LABEL_41; | |
7684 case 12: | |
473 | 7685 CreateButtonInColumn(0, 0x12u); |
0 | 7686 v16 = 55; |
7687 goto LABEL_37; | |
7688 default: | |
7689 break; | |
7690 } | |
7691 LABEL_43: | |
7692 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
7693 } | |
7694 // F8B1E0: using guessed type int dword_F8B1E0; | |
7695 | |
7696 //----- (004B3E1E) -------------------------------------------------------- | |
7697 void __cdecl sub_4B3E1E() | |
7698 { | |
7699 NPCData *v0; // ST40_4@1 | |
7700 signed int v1; // edi@1 | |
165 | 7701 //GUIWindow *v2; // ecx@1 |
0 | 7702 |
167 | 7703 __debugbreak(); |
602 | 7704 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
0 | 7705 v1 = 0; |
7706 pDialogueWindow->eWindowType = WINDOW_MainMenu; | |
7707 pDialogueWindow->Release(); | |
165 | 7708 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); |
291 | 7709 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
0 | 7710 { |
832 | 7711 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); |
0 | 7712 v1 = 1; |
7713 } | |
832 | 7714 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
972 | 7715 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); |
0 | 7716 } |
7717 | |
7718 //----- (004B3EF0) -------------------------------------------------------- | |
492 | 7719 void DrawJoinGuildWindow( int pEventCode ) |
747 | 7720 { |
467 | 7721 uDialogueType = 81;//enum JoinGuildDialog |
827 | 7722 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
492 | 7723 ContractSelectText(pEventCode); |
0 | 7724 pDialogueWindow->Release(); |
492 | 7725 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); |
948 | 7726 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
7727 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
7728 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
972 | 7729 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7730 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7731 } |
7732 // F8B19C: using guessed type int dword_F8B19C; | |
7733 | |
7734 //----- (004B3FE5) -------------------------------------------------------- | |
7735 void __fastcall sub_4B3FE5(int a4) | |
7736 { | |
7737 int v1; // edi@1 | |
7738 char *v2; // edi@1 | |
7739 | |
7740 v1 = a4; | |
7741 uDialogueType = 78; | |
827 | 7742 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
0 | 7743 _4B254D_SkillMasteryTeacher(a4); |
7744 pDialogueWindow->Release(); | |
7745 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); | |
7746 v2 = ""; | |
832 | 7747 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
948 | 7748 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7749 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
484 | 7750 if ( contract_approved ) |
0 | 7751 v2 = pGlobalTXT_LocalizationStrings[535]; |
832 | 7752 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); |
972 | 7753 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 7754 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7755 } |
7756 // F8B19C: using guessed type int dword_F8B19C; | |
7757 // F8B1A8: using guessed type int dword_F8B1A8; | |
7758 | |
7759 //----- (004B40E6) -------------------------------------------------------- | |
607 | 7760 void NPCHireableDialogPrepare() |
7761 { | |
0 | 7762 signed int v0; // ebx@1 |
7763 NPCData *v1; // edi@1 | |
7764 | |
7765 v0 = 0; | |
459 | 7766 v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; |
0 | 7767 pDialogueWindow->Release(); |
7768 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); | |
832 | 7769 pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, |
607 | 7770 pGlobalTXT_LocalizationStrings[34], //"Cancel" |
948 | 7771 pIcons_LOD->GetTexture(uExitCancelTextureId), |
0 | 7772 0); |
832 | 7773 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
291 | 7774 if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) |
0 | 7775 { |
832 | 7776 pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Du, 0, |
607 | 7777 pGlobalTXT_LocalizationStrings[407], 0);//"More Information" |
0 | 7778 v0 = 1; |
7779 } | |
832 | 7780 pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, |
607 | 7781 pGlobalTXT_LocalizationStrings[406], 0); //"Hire" |
972 | 7782 pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); |
747 | 7783 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
0 | 7784 } |
7785 | |
7786 //----- (004B4224) -------------------------------------------------------- | |
423 | 7787 void _4B4224_UpdateNPCTopics( int _this ) |
7788 { | |
7789 int num_menu_buttons; // ebx@1 | |
0 | 7790 int i; // ebp@5 |
423 | 7791 // signed int v4; // ebp@9 |
7792 int v6; // eax@16 | |
7793 int v8; // eax@21 | |
7794 int v10; // eax@26 | |
7795 int v12; // eax@31 | |
7796 int v14; // eax@36 | |
7797 int v16; // eax@41 | |
0 | 7798 NPCData *v17; // [sp+10h] [bp-4h]@4 |
7799 | |
423 | 7800 num_menu_buttons = 0; |
459 | 7801 pDialogueNPCCount = (_this + 1); |
0 | 7802 if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
7803 { | |
7804 pDialogueWindow->Release(); | |
7805 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
809 | 7806 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName); |
948 | 7807 pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel" |
7808 pBtn_YES = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF, 1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
832 | 7809 pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0, UIMSG_BF, 1u, 0x20u, sHouseName, 0); |
948 | 7810 pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0); |
0 | 7811 } |
7812 else | |
7813 { | |
459 | 7814 v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; |
749 | 7815 if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) |
0 | 7816 { |
7817 pDialogueWindow->Release(); | |
7818 } | |
7819 else | |
7820 { | |
7821 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
697 | 7822 ((GUIButton *)HouseNPCData[i + 7])->Release(); |
0 | 7823 } |
7824 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | |
832 | 7825 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 7826 pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
948 | 7827 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 7828 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
459 | 7829 if ( pDialogueNPCCount == 1 && dword_591080 ) |
0 | 7830 { |
484 | 7831 sub_4B3B42(in_current_building_type); |
0 | 7832 } |
7833 else | |
7834 { | |
7835 if ( v17->joins ) | |
7836 { | |
423 | 7837 num_menu_buttons = 1; |
858 | 7838 pDialogueWindow->CreateButton(480u, 160u, 140u, 30, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0); |
0 | 7839 } |
423 | 7840 if ( v17->evt_A) |
7841 { | |
7842 if ( num_menu_buttons < 4 ) | |
7843 { | |
7844 v6 = NPC_EventProcessor(v17->evt_A); | |
0 | 7845 if ( v6 == 1 || v6 == 2 ) |
832 | 7846 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u, 0, "", 0); |
423 | 7847 } |
7848 } | |
7849 if ( v17->evt_B ) | |
7850 { | |
7851 if ( num_menu_buttons < 4 ) | |
7852 { | |
7853 v8 = NPC_EventProcessor(v17->evt_B); | |
0 | 7854 if ( v8 == 1 || v8 == 2 ) |
832 | 7855 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x14u, 0, "", 0); |
423 | 7856 } |
7857 } | |
7858 if ( v17->evt_C ) | |
7859 { | |
7860 if ( num_menu_buttons < 4 ) | |
7861 { | |
7862 v10 = NPC_EventProcessor(v17->evt_C); | |
0 | 7863 if ( v10 == 1 || v10 == 2 ) |
832 | 7864 pDialogueWindow->CreateButton( 480u, 30 * num_menu_buttons++ + 160, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x15u, 0, "", 0); |
423 | 7865 } |
7866 } | |
7867 | |
7868 if ( v17->evt_D ) | |
7869 { | |
7870 if ( num_menu_buttons < 4 ) | |
7871 { | |
7872 v12 = NPC_EventProcessor(v17->evt_D); | |
0 | 7873 if ( v12 == 1 || v12 == 2 ) |
832 | 7874 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u, 0, "", 0); |
423 | 7875 } |
7876 } | |
7877 if ( v17->evt_E ) | |
7878 { | |
7879 if ( num_menu_buttons < 4 ) | |
7880 { | |
7881 v14 = NPC_EventProcessor(v17->evt_E); | |
0 | 7882 if ( v14 == 1 || v14 == 2 ) |
832 | 7883 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x17u, 0, "", 0); |
423 | 7884 } |
7885 } | |
7886 if ( v17->evt_F ) | |
7887 { | |
7888 if ( num_menu_buttons < 4 ) | |
7889 { | |
7890 v16 = NPC_EventProcessor(v17->evt_F); | |
0 | 7891 if ( v16 == 1 || v16 == 2 ) |
832 | 7892 pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); |
423 | 7893 } |
7894 } | |
972 | 7895 pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); |
0 | 7896 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; |
7897 } | |
747 | 7898 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
423 | 7899 } |
7900 | |
0 | 7901 } |
7902 | |
7903 //----- (004B46A5) -------------------------------------------------------- | |
1006 | 7904 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) |
7905 { | |
0 | 7906 int v4; // eax@1 |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
470
diff
changeset
|
7907 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); |
1006 | 7908 v4 = pFontLucida->AlignText_Center(450, Str); |
7909 pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, a5, Str, 0, 0, 0); | |
0 | 7910 } |
7911 | |
7912 //----- (004B46F8) -------------------------------------------------------- | |
7913 int __fastcall sub_4B46F8(int a1) | |
7914 { | |
7915 int v1; // eax@1 | |
7916 int i; // edx@1 | |
7917 | |
7918 v1 = 0; | |
7919 for ( i = 0; i < a1; ++i ) | |
7920 v1 += i + 1; | |
7921 return 1000 * v1; | |
7922 } | |
7923 | |
7924 //----- (004BC49B) -------------------------------------------------------- | |
651 | 7925 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType) |
652 | 7926 { |
656 | 7927 //unsigned int v1; // esi@1 |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7928 NPCData *speakingNPC; // ebp@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7929 //unsigned int v3; // eax@1 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7930 int npc_event_id; // ecx@10 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7931 signed int v5; // edi@14 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7932 char *v6; // esi@15 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7933 const char *v7; // ecx@22 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7934 signed int v8; // edi@37 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7935 //unsigned int v9; // eax@56 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7936 unsigned int v10; // ecx@57 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7937 void *v11; // [sp-Ch] [bp-1Ch]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7938 int v12; // [sp-8h] [bp-18h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7939 char *v13; // [sp-8h] [bp-18h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7940 size_t v14; // [sp-4h] [bp-14h]@46 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7941 const char *v15; // [sp-4h] [bp-14h]@60 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7942 |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7943 //v1 = _this; |
656 | 7944 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
7945 //v3 = v1; |
656 | 7946 uDialogueType = newDialogueType; |
7947 if (!speakingNPC->uFlags) | |
7948 { | |
7949 speakingNPC->uFlags = 1; | |
7950 //v3 = uDialogueType; | |
7951 } | |
7952 | |
7953 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS) | |
7954 { | |
7955 dialogue_show_profession_details = ~dialogue_show_profession_details; | |
7956 } | |
7957 else if(newDialogueType == DIALOGUE_76) | |
7958 { | |
7959 if (speakingNPC->Hired()) | |
7960 { | |
7961 v8 = 0; | |
7962 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7963 { | |
7964 v6 = (char *)pNPCStats->pNewNPCData; | |
7965 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
7966 { | |
7967 ++v8; | |
7968 v6 += 76; | |
7969 if ( v8 >= (signed int)pNPCStats->uNumNewNPCs ) | |
7970 break; | |
7971 } | |
7972 if( v8 < (signed int)pNPCStats->uNumNewNPCs ) | |
7973 v6[8] &= 0x7Fu; | |
7974 } | |
1104 | 7975 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 7976 { |
7977 v11 = pParty->pHirelings; | |
7978 memset(v11, 0, sizeof(NPCData)); | |
7979 } | |
1104 | 7980 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 7981 { |
7982 v11 = &pParty->pHirelings[1]; | |
7983 memset(v11, 0, sizeof(NPCData)); | |
7984 } | |
7985 pParty->field_709 = 0; | |
1035 | 7986 pParty->CountHirelings(); |
656 | 7987 dword_591084 = 0; |
7988 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
7989 dword_7241C8 = 0; | |
7990 return; | |
7991 } | |
7992 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) | |
7993 { | |
7994 v7 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" | |
7995 ShowStatusBarString(v7, 2u); | |
7996 } | |
7997 else | |
7998 { | |
7999 //v9 = v2->uProfession; | |
8000 if ( speakingNPC->uProfession != 51 ) | |
8001 { | |
8002 v10 = pNPCStats->pProfessions[speakingNPC->uProfession - 1].uHirePrice; | |
8003 if ( pParty->uNumGold < v10 ) | |
8004 { | |
8005 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
8006 dialogue_show_profession_details = false; | |
8007 uDialogueType = 13; | |
8008 if ( uActiveCharacter ) | |
8009 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); | |
8010 v7 = pGlobalTXT_LocalizationStrings[155]; | |
8011 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8012 if ( !dword_7241C8 ) | |
8013 pGame->Draw(); | |
8014 dword_7241C8 = 0; | |
8015 return; | |
8016 } | |
8017 Party::TakeGold(v10); | |
8018 } | |
8019 LOBYTE(speakingNPC->uFlags) |= 0x80u; | |
8020 if ( pParty->pHirelings[0].pName ) | |
8021 { | |
8022 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1])); | |
8023 v15 = speakingNPC->pName; | |
8024 v13 = pParty->pHireling2Name; | |
8025 } | |
8026 else | |
8027 { | |
8028 memcpy(pParty->pHirelings, speakingNPC, 0x4Cu); | |
8029 v15 = speakingNPC->pName; | |
8030 v13 = pParty->pHireling1Name; | |
8031 } | |
8032 strcpy(v13, v15); | |
8033 pParty->field_709 = 0; | |
1035 | 8034 pParty->CountHirelings(); |
656 | 8035 |
8036 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8037 | |
711 | 8038 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) |
656 | 8039 pDialogue_SpeakingActor->uAIState = Removed; |
8040 if ( uActiveCharacter ) | |
8041 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); | |
8042 } | |
8043 } | |
8044 else if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) | |
8045 { | |
8046 ArenaFight(); | |
8047 return; | |
8048 } | |
8049 else if(newDialogueType == DIALOGUE_9) | |
8050 { | |
8051 if ( !sub_4BB756(speakingNPC->uProfession) ) | |
8052 { | |
8053 if ( speakingNPC->uProfession != 41 ) | |
8054 speakingNPC->bHasUsedTheAbility = 1; | |
8055 | |
8056 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8057 } | |
8058 else | |
8059 { | |
8060 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); //"Your packs are already full!" | |
8061 } | |
8062 } | |
8063 else if(newDialogueType == DIALOGUE_13) | |
8064 { | |
8065 if (!speakingNPC->Hired()) | |
8066 { | |
8067 sub_4B3E1E(); | |
8068 dialogue_show_profession_details = false; | |
8069 } | |
8070 else | |
8071 { | |
8072 v5 = 0; | |
8073 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8074 { | |
8075 v6 = (char *)pNPCStats->pNewNPCData; | |
8076 while ( !(v6[8] & 0x80) || strcmp(speakingNPC->pName, *(const char **)v6) ) | |
8077 { | |
8078 ++v5; | |
8079 v6 += 76; | |
8080 if ( v5 >= (signed int)pNPCStats->uNumNewNPCs ) | |
8081 break; | |
8082 } | |
8083 if ( v5 < (signed int)pNPCStats->uNumNewNPCs ) | |
8084 v6[8] &= 0x7Fu; | |
8085 } | |
1104 | 8086 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) ) |
656 | 8087 { |
8088 v11 = pParty->pHirelings; | |
8089 memset(v11, 0, sizeof(NPCData)); | |
8090 } | |
1104 | 8091 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) ) |
656 | 8092 { |
8093 v11 = &pParty->pHirelings[1]; | |
8094 memset(v11, 0, sizeof(NPCData)); | |
8095 } | |
8096 pParty->field_709 = 0; | |
1035 | 8097 pParty->CountHirelings(); |
656 | 8098 dword_591084 = 0; |
8099 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
8100 dword_7241C8 = 0; | |
8101 return; | |
8102 } | |
8103 } | |
8104 else if(newDialogueType >= 19 && newDialogueType <= 24) | |
8105 { | |
8106 switch(newDialogueType) | |
8107 { | |
8108 case DIALOGUE_19: npc_event_id = speakingNPC->evt_A; break; | |
8109 case DIALOGUE_20: npc_event_id = speakingNPC->evt_B; break; | |
8110 case DIALOGUE_21: npc_event_id = speakingNPC->evt_C; break; | |
8111 case DIALOGUE_22: npc_event_id = speakingNPC->evt_D; break; | |
8112 case DIALOGUE_23: npc_event_id = speakingNPC->evt_E; break; | |
8113 case DIALOGUE_24: npc_event_id = speakingNPC->evt_F; break; | |
8114 } | |
8115 if ( (npc_event_id >= 200) && (npc_event_id <= 310) ) | |
8116 sub_4B3FE5(npc_event_id); //200-310 | |
8117 else if (( npc_event_id >= 400) && (npc_event_id <= 410) ) | |
8118 { //400-410 | |
8119 dword_F8B1D8 = newDialogueType; | |
8120 DrawJoinGuildWindow(npc_event_id - 400); | |
8121 } | |
8122 else | |
8123 { | |
8124 switch ( npc_event_id ) | |
8125 { | |
8126 case 139: | |
8127 sub_4B1ECE(); | |
8128 break; | |
8129 case 311: | |
8130 sub_4BBA85_bounties(); | |
8131 break; | |
8132 case 399: | |
8133 sub_4BBCDD(); | |
8134 break; | |
8135 default: | |
8136 activeLevelDecoration = (LevelDecoration*)1; | |
827 | 8137 current_npc_text = 0; |
656 | 8138 EventProcessor(npc_event_id, 0, 1); |
8139 activeLevelDecoration = NULL; | |
8140 break; | |
8141 } | |
8142 } | |
8143 } | |
8144 if ( !dword_7241C8 ) | |
8145 pGame->Draw(); | |
8146 dword_7241C8 = 0; | |
8147 } | |
0 | 8148 |
8149 //----- (004BDAAF) -------------------------------------------------------- | |
907 | 8150 bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) |
0 | 8151 { |
8152 int v6; // edx@8 | |
8153 int v7; // edx@9 | |
8154 int v8; // edx@10 | |
8155 unsigned __int8 v9; // zf@16 | |
8156 char v10; // sf@16 | |
8157 unsigned __int8 v11; // of@16 | |
702 | 8158 bool test; |
0 | 8159 |
907 | 8160 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) |
8161 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->Stolen()) | |
0 | 8162 return 0; |
907 | 8163 switch( p2DEvents[_2da_idx - 1].uType ) |
8164 { | |
8165 case BildingType_WeaponShop: | |
8166 { | |
8167 test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; | |
8168 break; | |
8169 } | |
8170 case BildingType_ArmorShop: | |
8171 { | |
8172 test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; | |
8173 break; | |
8174 } | |
8175 case BildingType_MagicShop: | |
8176 { | |
8177 test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; | |
8178 break; | |
8179 } | |
8180 case BildingType_AlchemistShop: | |
8181 { | |
8182 test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 | |
8183 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 | |
8184 || (signed int)item->uItemID < 740) && item->uItemID != 771); | |
8185 break; | |
8186 } | |
8187 default: | |
8188 { | |
8189 test = false; | |
8190 break; | |
8191 } | |
8192 } | |
702 | 8193 return test; |
8194 /* | |
8195 if ( p2DEvents[a2 - 1].uType == 1 ) | |
0 | 8196 { |
8197 v11 = __OFSUB__(v5, 2); | |
8198 v9 = v5 == 2; | |
8199 v10 = v5 - 2 < 0; | |
8200 goto LABEL_23; | |
8201 } | |
702 | 8202 if ( p2DEvents[a2 - 1].uType > 2 ) |
8203 { | |
8204 if ( p2DEvents[a2 - 1].uType == 3 ) | |
0 | 8205 { |
8206 if ( pItemsTable->pItems[v4].uSkillType != 38 ) | |
8207 return v5 == 16; | |
8208 return 1; | |
8209 } | |
702 | 8210 if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) |
0 | 8211 return 0; |
702 | 8212 if ( p2DEvents[a2 - 1].uType == 4) |
8213 { | |
8214 if ( v5 < 13 ) | |
8215 return 0; | |
8216 if ( v5 <= 14 ) | |
8217 return 1; | |
8218 if ( v5 != 17 || (signed int)v3 < 740 ) | |
8219 return 0; | |
8220 v11 = __OFSUB__(v3, 771); | |
8221 v9 = v3 == 771; | |
8222 v10 = ((v3 - 771) & 0x80000000u) != 0; | |
0 | 8223 LABEL_23: |
702 | 8224 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) |
8225 return 0; | |
8226 return 1; | |
8227 } | |
8228 } | |
8229 if ( p2DEvents[a2 - 1].uType == 2 ) | |
8230 { | |
8231 if ( v5 >= 3 ) | |
8232 { | |
8233 v11 = __OFSUB__(v5, 9); | |
8234 v9 = v5 == 9; | |
8235 v10 = v5 - 9 < 0; | |
8236 goto LABEL_23; | |
8237 } | |
0 | 8238 } |
8239 return 0; | |
702 | 8240 */ |
0 | 8241 } |
8242 | |
8243 //----- (004B6478) -------------------------------------------------------- | |
711 | 8244 void sub_4B6478() |
8245 { | |
0 | 8246 GUIWindow *v0; // ebx@1 |
8247 Player *v1; // edi@1 | |
8248 unsigned int v2; // eax@1 | |
8249 signed int v3; // esi@1 | |
8250 int v4; // ebx@1 | |
8251 unsigned int v5; // esi@5 | |
8252 int v6; // edi@6 | |
8253 int result; // eax@13 | |
8254 GUIWindow *v8; // ebx@17 | |
8255 int v9; // eax@17 | |
8256 int v10; // ecx@17 | |
8257 unsigned int v11; // ecx@18 | |
8258 int v12; // eax@20 | |
8259 int v13; // eax@21 | |
8260 GUIButton *v14; // esi@27 | |
8261 int v15; // ecx@27 | |
8262 unsigned int v16; // eax@28 | |
8263 const char *v17; // ebx@29 | |
8264 int v18; // eax@29 | |
8265 unsigned int v19; // ecx@29 | |
8266 int v20; // eax@29 | |
8267 unsigned __int16 v21; // ax@29 | |
8268 unsigned __int16 v22; // ST14_2@36 | |
8269 int v23; // eax@36 | |
8270 const char *v24; // ST18_4@37 | |
8271 unsigned __int16 v25; // ST14_2@37 | |
8272 int v26; // eax@37 | |
8273 int v27; // [sp-4h] [bp-80h]@8 | |
8274 GUIWindow v28; // [sp+Ch] [bp-70h]@1 | |
8275 GUIWindow *v29; // [sp+60h] [bp-1Ch]@17 | |
8276 unsigned int v30; // [sp+64h] [bp-18h]@1 | |
8277 int v31; // [sp+68h] [bp-14h]@1 | |
8278 int v32; // [sp+6Ch] [bp-10h]@1 | |
8279 int v33; // [sp+70h] [bp-Ch]@17 | |
8280 int v34; // [sp+74h] [bp-8h]@17 | |
8281 int v35; // [sp+78h] [bp-4h]@17 | |
8282 | |
336 | 8283 v0 = window_SpeakInHouse; |
8284 memcpy(&v28, window_SpeakInHouse, sizeof(v28)); | |
0 | 8285 v1 = pPlayers[uActiveCharacter]; |
8286 v28.uFrameX = 483; | |
8287 v28.uFrameWidth = 148; | |
8288 v28.uFrameZ = 334; | |
949 | 8289 v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); |
8290 v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
0 | 8291 v2 = 52 * (unsigned int)v0->ptr_1C; |
8292 //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100; | |
8293 v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100; | |
8294 //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]); | |
8295 v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
8296 v4 = v3 * (100 - v1->GetMerchant()) / 100; | |
8297 v32 = v4; | |
8298 if ( v4 < v3 / 3 ) | |
8299 { | |
8300 v4 = v3 / 3; | |
8301 v32 = v3 / 3; | |
8302 } | |
749 | 8303 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
0 | 8304 { |
8305 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8306 { | |
8307 v5 = 0; | |
8308 | |
8309 __debugbreak(); | |
8310 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
8311 // or | |
8312 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] | |
8313 // or | |
8314 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
749 | 8315 __debugbreak(); // whacky condition - fix |
0 | 8316 if (false |
8317 //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) | |
607 | 8318 || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) |
0 | 8319 { |
8320 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
8321 } | |
8322 else | |
8323 { | |
8324 if ( pParty->uNumGold < v4 ) | |
8325 { | |
8326 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
8327 v27 = 4; | |
8328 } | |
8329 else | |
8330 { | |
8331 Party::TakeGold(v4); | |
8332 *(short *)v6 = 1; | |
8333 v27 = 2; | |
8334 } | |
735 | 8335 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27); |
0 | 8336 } |
8337 } | |
8338 else | |
8339 { | |
8340 v5 = 0; | |
8341 } | |
437 | 8342 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 8343 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
8344 { | |
990 | 8345 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 8346 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
8347 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
8348 *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; | |
8349 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 8350 }*/ |
8351 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); | |
711 | 8352 return; // void func |
0 | 8353 } |
484 | 8354 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) |
0 | 8355 { |
8356 v24 = pNPCTopics[171].pText; | |
8357 v25 = v31; | |
8358 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); | |
8359 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | |
8360 pDialogueWindow->pNumPresenceButton = 0; | |
711 | 8361 return ; |
8362 } | |
8363 | |
8364 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
8365 return; | |
0 | 8366 v8 = pDialogueWindow; |
8367 v33 = 0; | |
8368 v34 = 0; | |
8369 v29 = pDialogueWindow; | |
8370 v9 = pDialogueWindow->pStartingPosActiveItem; | |
8371 v10 = v9 + pDialogueWindow->pNumPresenceButton; | |
8372 v35 = pDialogueWindow->pStartingPosActiveItem; | |
8373 if ( v9 >= v10 ) | |
8374 goto LABEL_40; | |
8375 do | |
8376 { | |
832 | 8377 v11 = v8->GetControl(v35)->msg_param - 36; |
135 | 8378 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] ) |
0 | 8379 { |
8380 v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0); | |
8381 v33 += v12; | |
8382 ++v34; | |
8383 } | |
8384 v13 = v8->pStartingPosActiveItem; | |
8385 ++v35; | |
8386 } | |
8387 while ( v35 < v8->pNumPresenceButton + v13 ); | |
8388 if ( !v34 ) | |
8389 { | |
8390 LABEL_40: | |
135 | 8391 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); |
0 | 8392 strcat(pTmpBuf, "\n \n"); |
8393 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
8394 v22 = v31; | |
8395 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); | |
711 | 8396 v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); |
8397 return; | |
0 | 8398 } |
8399 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); | |
8400 v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
8401 v32 = (149 - v33) / v34; | |
8402 if ( (149 - v33) / v34 > 32 ) | |
8403 v32 = 32; | |
711 | 8404 |
8405 v35 = v8->pStartingPosActiveItem; | |
0 | 8406 v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; |
711 | 8407 if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) |
0 | 8408 { |
8409 v33 = 2; | |
8410 do | |
8411 { | |
8412 v14 = v8->GetControl(v35); | |
832 | 8413 v15 = v14->msg_param - 36; |
135 | 8414 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] ) |
0 | 8415 { |
8416 v16 = 0; | |
8417 if ( !v1->pActiveSkills[v15] ) | |
8418 { | |
8419 v17 = pSkillNames[v15]; | |
8420 v14->uY = v32 + v34; | |
8421 v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0); | |
8422 v19 = v14->uY; | |
8423 v14->uHeight = v18; | |
8424 v20 = v19 + v18 - 1; | |
8425 v14->uW = v20; | |
8426 v34 = v20; | |
8427 v21 = v31; | |
8428 if ( pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
8429 v21 = v30; | |
8430 v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u); | |
8431 goto LABEL_34; | |
8432 } | |
8433 } | |
8434 else | |
8435 { | |
8436 v16 = 0; | |
8437 } | |
8438 v14->uW = v16; | |
8439 v14->uHeight = v16; | |
8440 v14->uY = v16; | |
8441 LABEL_34: | |
8442 v8 = v29; | |
8443 ++v35; | |
8444 ++v33; | |
711 | 8445 } |
8446 while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); | |
8447 } | |
8448 return; | |
0 | 8449 } |
8450 | |
8451 //----- (00405CFF) -------------------------------------------------------- | |
8452 void stru262_TurnBased::End(bool bPlaySound) | |
8453 { | |
8454 stru262_TurnBased *v2; // edi@1 | |
8455 int v3; // ebx@1 | |
8456 int v4; // esi@1 | |
8457 unsigned __int8 v5; // zf@1 | |
8458 unsigned __int8 v6; // sf@1 | |
8459 TurnBased_QueueElem *v7; // ecx@2 | |
8460 unsigned __int16 *pAttributes; // ecx@7 | |
8461 size_t v9; // edx@7 | |
8462 unsigned __int16 v10; // ax@8 | |
8463 TurnBased_QueueElem *v11; // ebx@12 | |
8464 ObjectType objType; // eax@13 | |
8465 int objID; // esi@13 | |
8466 int v14; // [sp+Ch] [bp-4h]@11 | |
8467 | |
8468 v2 = this; | |
8469 v3 = 0; | |
8470 v4 = 0; | |
8471 v5 = this->uActorQueueSize == 0; | |
8472 v6 = this->uActorQueueSize < 0; | |
8473 this->field_4 = 0; | |
8474 if ( !(v6 | v5) ) | |
8475 { | |
8476 v7 = this->pQueue; | |
8477 do | |
8478 { | |
848 | 8479 if ( PID_TYPE(v7->uPackedID) == OBJECT_Actor ) |
8480 LOBYTE(pActors[PID_ID(v7->uPackedID)].uAttributes) &= 0x7Fu; | |
0 | 8481 ++v4; |
8482 ++v7; | |
8483 } | |
8484 while ( v4 < v2->uActorQueueSize ); | |
8485 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8486 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8487 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8488 pAttributes = &pSpriteObjects[0].uAttributes; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
8489 v9 = uNumSpriteObjects; |
0 | 8490 do |
8491 { | |
8492 v10 = *pAttributes; | |
8493 if ( *pAttributes & 4 ) | |
8494 { | |
8495 LOBYTE(v10) = v10 & 0xFB; | |
8496 *pAttributes = v10; | |
8497 } | |
8498 pAttributes += 56; | |
8499 --v9; | |
8500 } | |
8501 while ( v9 ); | |
8502 } | |
8503 v14 = 0; | |
8504 if ( v2->uActorQueueSize > 0 ) | |
8505 { | |
8506 v11 = v2->pQueue; | |
8507 do | |
8508 { | |
848 | 8509 objType = (ObjectType)PID_TYPE(v11->uPackedID); |
8510 objID = PID_ID(v11->uPackedID); | |
0 | 8511 if ( objType == OBJECT_Player ) |
8512 { | |
8513 pPlayers[objID + 1]->uTimeToRecovery = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8514 } | |
8515 else | |
8516 { | |
8517 if ( objType == OBJECT_Actor ) | |
8518 pActors[objID].pMonsterInfo.uRecoveryTime = (signed __int64)((double)v11->field_4 * 2.133333333333333); | |
8519 } | |
8520 ++v14; | |
8521 ++v11; | |
8522 } | |
8523 while ( v14 < v2->uActorQueueSize ); | |
8524 v3 = 0; | |
8525 } | |
8526 pAudioPlayer->StopChannels(-1, -1); | |
8527 if ( bPlaySound != v3 ) | |
8528 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse), v3, v3, -1, v3, v3, v3, v3); | |
8529 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
8530 pEventTimer->StopGameTime(); | |
8531 dword_50C994 = v3; | |
8532 dword_50C998_turnbased_icon_1A = v3; | |
8533 } | |
8534 // 50C994: using guessed type int dword_50C994; | |
8535 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A; | |
8536 | |
8537 //----- (00405E14) -------------------------------------------------------- | |
8538 void stru262_TurnBased::_405E14() | |
8539 { | |
8540 stru262_TurnBased *v1; // esi@1 | |
8541 int v2; // ecx@1 | |
8542 SpellBuff *v3; // edi@2 | |
8543 Actor *v4; // ebx@3 | |
8544 signed int v5; // edx@20 | |
8545 AIDirection *v6; // esi@21 | |
8546 int v7; // eax@21 | |
8547 int v8; // eax@21 | |
8548 int v9; // eax@22 | |
8549 int v10; // eax@23 | |
8550 int v11; // eax@37 | |
8551 int v12; // eax@44 | |
8552 AIDirection a3; // [sp+4h] [bp-68h]@21 | |
8553 AIDirection v14; // [sp+20h] [bp-4Ch]@21 | |
8554 AIDirection v15; // [sp+3Ch] [bp-30h]@21 | |
90 | 8555 Actor *v16; // [sp+58h] [bp-14h]@2 |
0 | 8556 int v17; // [sp+5Ch] [bp-10h]@6 |
8557 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 | |
8558 int v19; // [sp+64h] [bp-8h]@8 | |
8559 unsigned int v20; // [sp+68h] [bp-4h]@1 | |
8560 | |
8561 v1 = this; | |
8562 v2 = 0; | |
8563 v18 = v1; | |
8564 v20 = 0; | |
8565 if ( (signed int)uNumActors > 0 ) | |
8566 { | |
90 | 8567 //v3 = pActors;//[0].pActorBuffs; |
8568 v16 = pActors;//[0].pActorBuffs; | |
8569 v3 = v16->pActorBuffs; | |
0 | 8570 do |
8571 { | |
90 | 8572 v4 = v16; |
8573 if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) | |
0 | 8574 v17 = v2; |
8575 else | |
8576 v17 = 1; | |
8577 v19 = v2; | |
8578 do | |
8579 { | |
8580 if ( v19 != 10 ) | |
8581 { | |
8582 v3->_4585CA(pParty->uTimePlayed); | |
8583 v2 = 0; | |
8584 } | |
8585 ++v19; | |
8586 ++v3; | |
8587 } | |
8588 while ( v19 < 22 ); | |
8589 if ( v17 != v2 | |
8590 && SHIDWORD(v4->pActorBuffs[3].uExpireTime) <= v2 | |
8591 && (SHIDWORD(v4->pActorBuffs[3].uExpireTime) < v2 || LODWORD(v4->pActorBuffs[3].uExpireTime) <= v2) ) | |
8592 v4->uActorHeight = pMonsterList->pMonsters[v4->pMonsterInfo.uID - 1].uMonsterHeight; | |
8593 if ( !(v4->uAttributes & 0x80) ) | |
8594 { | |
8595 if ( !v4->pActorBuffs[5].uExpireTime ) | |
8596 { | |
8597 if ( !v4->pActorBuffs[6].uExpireTime ) | |
8598 { | |
8599 v5 = v4->uCurrentActionLength; | |
8600 v4->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
8601 if ( (signed int)v4->uCurrentActionTime >= v5 ) | |
8602 { | |
417 | 8603 v17 = ai_near_actors_targets_pid[v20]; |
862 | 8604 v6 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v20), v17, &a3, v2); |
0 | 8605 v7 = v4->uAIState; |
8606 memcpy(&v15, v6, sizeof(v15)); | |
8607 v8 = v7 - 4; | |
8608 memcpy(&v14, &v15, sizeof(v14)); | |
8609 if ( v8 ) | |
8610 { | |
8611 v9 = v8 - 1; | |
8612 if ( v9 ) | |
8613 { | |
8614 v10 = v9 - 6; | |
8615 if ( v10 ) | |
8616 { | |
8617 if ( v10 != 8 ) | |
414 | 8618 Actor::AI_StandOrBored(v20, v17, 32, &v14); |
0 | 8619 } |
8620 } | |
8621 } | |
8622 else | |
8623 { | |
8624 v4->uCurrentActionTime = 0; | |
8625 v4->uCurrentActionLength = 0; | |
8626 v4->uAIState = Dead; | |
8627 v4->UpdateAnimation(); | |
8628 } | |
8629 v1 = v18; | |
8630 v2 = 0; | |
8631 } | |
8632 } | |
8633 } | |
8634 } | |
8635 ++v20; | |
90 | 8636 v3 = v16[1].pActorBuffs; |
8637 ++v16; | |
0 | 8638 } |
8639 while ( (signed int)v20 < (signed int)uNumActors ); | |
8640 } | |
8641 if ( v1->field_4 == 1 ) | |
8642 { | |
8643 v12 = v1->field_8; | |
8644 if ( v12 == 64 ) | |
8645 { | |
8646 v1->_406A63(); | |
8647 } | |
8648 else | |
8649 { | |
8650 if ( v12 > v2 ) | |
8651 { | |
8652 v1->_406B9F(); | |
8653 } | |
8654 else | |
8655 { | |
8656 v1->_406AFE(); | |
8657 v1->field_10 = 100; | |
8658 } | |
8659 } | |
8660 v1->field_8 -= pEventTimer->uTimeElapsed; | |
8661 return; | |
8662 } | |
8663 if ( v1->field_4 == 2 ) | |
8664 { | |
8665 if ( !(v1->field_18 & 1) ) | |
8666 { | |
8667 v11 = v1->field_10; | |
8668 if ( v11 == 100 ) | |
8669 { | |
8670 v1->StartTurn(); | |
8671 LABEL_39: | |
8672 v1->_40652A(); | |
8673 return; | |
8674 } | |
8675 if ( v11 > v2 || v1->pQueue[0].field_4 <= v2 ) | |
8676 { | |
8677 v1->_4065B0(); | |
8678 goto LABEL_39; | |
8679 } | |
8680 } | |
8681 v1->NextTurn(); | |
8682 return; | |
8683 } | |
8684 if ( v1->field_4 == 3 ) | |
8685 { | |
8686 if ( v1->uActionPointsLeft <= v2 || v1->field_18 & 8 ) | |
8687 { | |
8688 v1->field_18 &= 0xFFFFFFF7u; | |
8689 v1->field_4 = 1; | |
8690 v1->field_8 = 64; | |
8691 } | |
8692 else | |
8693 { | |
8694 v1->_406FA8(); | |
8695 } | |
8696 } | |
8697 } | |
8698 | |
8699 //----- (0043FDED) -------------------------------------------------------- | |
8700 void PrepareActorRenderList_BLV() | |
8701 { | |
8702 RenderBillboard *v0; // esi@0 | |
8703 unsigned __int16 v3; // ax@3 | |
8704 unsigned int v4; // eax@5 | |
8705 unsigned __int16 v5; // cx@5 | |
8706 int v6; // esi@5 | |
8707 unsigned int v7; // eax@7 | |
8708 int v8; // eax@10 | |
8709 SpriteFrame *v9; // eax@16 | |
8710 SpriteFrame *v10; // ebx@18 | |
8711 //int *v11; // eax@18 | |
8712 int v12; // ecx@28 | |
8713 //IndoorCameraD3D **v14; // eax@36 | |
8714 double v15; // st7@36 | |
8715 float v16; // eax@36 | |
8716 //double v17; // ST30_8@36 | |
8717 signed __int64 v18; // qtt@36 | |
8718 int v19; // ST5C_4@36 | |
8719 signed __int64 v20; // qtt@37 | |
8720 int v21; // ST5C_4@37 | |
8721 signed __int16 v22; // cx@39 | |
8722 int v23; // ST50_4@40 | |
8723 signed int v24; // ecx@40 | |
8724 int v25; // edx@44 | |
8725 __int16 v26; // ax@44 | |
8726 //MonsterDesc *v27; // edx@44 | |
8727 //int v28; // ecx@44 | |
8728 unsigned __int8 v29; // zf@44 | |
8729 unsigned __int8 v30; // sf@44 | |
8730 unsigned int v31; // [sp-8h] [bp-5Ch]@15 | |
8731 int v32; // [sp+1Ch] [bp-38h]@5 | |
8732 int a3; // [sp+20h] [bp-34h]@5 | |
8733 int a2; // [sp+24h] [bp-30h]@5 | |
8734 int a1a; // [sp+28h] [bp-2Ch]@5 | |
8735 __int16 a5; // [sp+2Ch] [bp-28h]@5 | |
8736 int a5a; // [sp+2Ch] [bp-28h]@36 | |
8737 int a5b; // [sp+2Ch] [bp-28h]@40 | |
8738 __int16 v41; // [sp+3Ch] [bp-18h]@18 | |
8739 int a6; // [sp+40h] [bp-14h]@34 | |
8740 int v43; // [sp+44h] [bp-10h]@34 | |
8741 int z; // [sp+48h] [bp-Ch]@32 | |
8742 signed int y; // [sp+4Ch] [bp-8h]@32 | |
8743 int x; // [sp+50h] [bp-4h]@32 | |
8744 | |
8745 for (uint i = 0; i < uNumActors; ++i) | |
8746 { | |
8747 auto p = pActors + i; | |
8748 | |
8749 if (p->uAIState == Removed || | |
8750 p->uAIState == Disabled) | |
8751 continue; | |
8752 | |
8753 a5 = p->uSectorID; | |
8754 a2 = p->vPosition.y; | |
8755 a1a = p->vPosition.x; | |
8756 a3 = p->vPosition.z; | |
8757 v4 = stru_5C6E00->Atan2(a1a - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
8758 LOWORD(v0) = p->uYawAngle; | |
8759 v5 = p->uCurrentActionAnimation; | |
8760 v6 = ((signed int)((char *)v0 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v4 + stru_5C6E00->uIntegerPi) >> 8) & 7; | |
8761 v32 = v6; | |
8762 if ( pParty->bTurnBasedModeOn ) | |
8763 { | |
8764 if ( v5 == 1 ) | |
8765 { | |
8766 v7 = pMiscTimer->uTotalGameTimeElapsed; | |
8767 goto LABEL_10; | |
8768 } | |
8769 } | |
8770 else | |
8771 { | |
8772 if ( v5 == 1 ) | |
8773 { | |
8774 v7 = pBLVRenderParams->field_0_timer_; | |
8775 LABEL_10: | |
8776 v8 = i * 32 + v7; | |
8777 goto LABEL_12; | |
8778 } | |
8779 } | |
8780 v8 = p->uCurrentActionTime; | |
8781 LABEL_12: | |
8782 if (p->pActorBuffs[5].uExpireTime > 0i64 || p->pActorBuffs[6].uExpireTime > 0i64 ) | |
8783 v8 = 0; | |
8784 v31 = p->pSpriteIDs[v5]; | |
8785 if (p->uAIState == Resurrected) | |
8786 v9 = pSpriteFrameTable->GetFrameBy_x(v31, v8); | |
8787 else | |
8788 v9 = pSpriteFrameTable->GetFrame(v31, v8); | |
8789 v41 = 0; | |
8790 v10 = v9; | |
8791 //v11 = (int *)v9->uFlags; | |
8792 if (v9->uFlags & 2) | |
8793 v41 = 2; | |
8794 if (v9->uFlags & 0x40000) | |
8795 v41 |= 0x40u; | |
8796 if (v9->uFlags & 0x20000) | |
8797 LOBYTE(v41) = v41 | 0x80; | |
8798 v0 = (RenderBillboard *)(256 << v6); | |
8799 if ( (unsigned int)v0 & v9->uFlags) | |
8800 v41 |= 4u; | |
8801 if ( v10->uGlowRadius ) | |
8802 { | |
8803 //LOBYTE(v11) = byte_4E94D3; | |
8804 pMobileLightsStack->AddLight( | |
8805 a1a, | |
8806 a2, | |
8807 a3, | |
8808 a5, | |
8809 v10->uGlowRadius, | |
8810 0xFFu, | |
8811 0xFFu, | |
8812 0xFFu, | |
8813 byte_4E94D3); | |
8814 } | |
8815 v12 = 0; | |
8816 if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) | |
8817 continue; | |
8818 while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) | |
8819 { | |
8820 ++v12; | |
8821 if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) | |
8822 goto _continue; | |
8823 } | |
8824 if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1) | |
8825 || (v0 = (RenderBillboard *)abs(x), (signed int)v0 < abs(y)) ) | |
8826 continue; | |
8827 pGame->pIndoorCameraD3D->Project(x, y, z, &v43, &a6); | |
8828 v0 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
8829 if (uNumBillboardsToDraw >= 500) | |
8830 break; | |
8831 ++uNumBillboardsToDraw; | |
8832 ++uNumSpritesDrawnThisFrame; | |
8833 p->uAttributes |= 8u; | |
8834 v29 = pRenderer->pRenderD3D == 0; | |
8835 v0->uHwSpriteID = v10->pHwSpriteIDs[v32]; | |
8836 v0->uPalette = v10->uPaletteIndex; | |
8837 v0->uIndoorSectorID = a5; | |
8838 if ( v29 ) | |
8839 { | |
8840 LODWORD(v20) = pBLVRenderParams->field_40 << 16; | |
8841 HIDWORD(v20) = pBLVRenderParams->field_40 >> 16; | |
8842 v21 = v20 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8843 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v20 / x) >> 16; |
0 | 8844 a5a = (unsigned __int64)(v10->scale * (signed __int64)v21) >> 16; |
8845 } | |
8846 else | |
8847 { | |
8848 //v14 = &pGame->pIndoorCameraD3D; | |
8849 v0->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
8850 v15 = pGame->pIndoorCameraD3D->fov_y; | |
8851 v16 = v0->fov_x; | |
8852 v0->fov_y = v15; | |
8853 //v17 = v16 + 6.7553994e15; | |
8854 LODWORD(v18) = 0; | |
8855 HIDWORD(v18) = floorf(v16 + 0.5f); | |
8856 v19 = v18 / x; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8857 v0->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v10->scale * v18 / x) >> 16; |
0 | 8858 a5a = (unsigned __int64)(v10->scale * (signed __int64)v19) >> 16; |
8859 } | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8860 v0->_screenspace_y_scaler_packedfloat = a5a; |
0 | 8861 if ( (signed __int64)p->pActorBuffs[3].uExpireTime <= 0 ) |
8862 { | |
8863 if ( (signed __int64)p->pActorBuffs[10].uExpireTime > 0 ) | |
8864 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8865 a5b = (unsigned __int64)(pGame->pStru6Instance->_4A806F(p) * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8866 goto LABEL_43; |
8867 } | |
8868 } | |
8869 else | |
8870 { | |
8871 v22 = p->pActorBuffs[3].uPower; | |
8872 if ( v22 ) | |
8873 { | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8874 v23 = (unsigned __int64)(65536 / (unsigned __int16)v22 * (signed __int64)v0->_screenspace_x_scaler_packedfloat) >> 16; |
0 | 8875 v24 = p->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8876 v0->_screenspace_x_scaler_packedfloat = v23; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8877 a5b = (unsigned __int64)(65536 / v24 * (signed __int64)v0->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 8878 LABEL_43: |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
141
diff
changeset
|
8879 v0->_screenspace_y_scaler_packedfloat = a5b; |
0 | 8880 goto LABEL_44; |
8881 } | |
8882 } | |
8883 LABEL_44: | |
8884 HIWORD(v25) = HIWORD(x); | |
430 | 8885 v0->world_x = a1a; |
8886 v0->world_y = a2; | |
8887 v0->world_z = a3; | |
0 | 8888 v0->uScreenSpaceX = v43; |
8889 v0->uScreenSpaceY = a6; | |
8890 LOWORD(v25) = 0; | |
8891 LOBYTE(v26) = v41; | |
194 | 8892 |
862 | 8893 //v0->sZValue = v25 + (PID(OBJECT_Actor,i)); |
194 | 8894 v0->actual_z = HIWORD(x); |
862 | 8895 v0->object_pid = PID(OBJECT_Actor,i); |
194 | 8896 |
0 | 8897 v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0; |
8898 v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0; | |
8899 v0->field_1E = v41; | |
8900 v0->pSpriteFrame = v10; | |
8901 v0->uTintColor = pMonsterList->pMonsters[p->pMonsterInfo.uID - 1].uTintColor; | |
8902 if ( !v30 && (!(v30 | v29) || LODWORD(p->pActorBuffs[5].uExpireTime)) ) | |
8903 { | |
8904 HIBYTE(v26) = HIBYTE(v41) | 1; | |
8905 v0->field_1E = v26; | |
8906 } | |
8907 | |
8908 _continue: | |
8909 ; | |
8910 } | |
8911 } | |
8912 | |
8913 //----- (00444732) -------------------------------------------------------- | |
428 | 8914 char *GetEventHintString(unsigned int uEventID) |
8915 { | |
8916 signed int event_index; // edx@1 | |
8917 int event_pos; // esi@4 | |
0 | 8918 char *result; // eax@6 |
428 | 8919 unsigned int str_index; // eax@9 |
8920 int i; // esi@11 | |
8921 _evt_raw* test_evt; | |
8922 _evt_raw* last_evt; | |
8923 | |
8924 event_index = 0; | |
8925 if ( uLevelEVT_NumEvents <= 0 ) | |
8926 return NULL; | |
8927 | |
8928 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; | |
0 | 8929 while ( 1 ) |
8930 { | |
428 | 8931 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) |
8932 { | |
8933 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
8934 last_evt=test_evt; | |
8935 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; | |
8936 if ( test_evt->_e_type == EVENT_MouseOver ) | |
0 | 8937 break; |
8938 } | |
428 | 8939 ++event_index; |
8940 if ( event_index >= uLevelEVT_NumEvents ) | |
8941 return NULL; | |
8942 } | |
8943 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8944 if ( test_evt->_e_type== EVENT_SpeakInHouse ) | |
8945 { | |
8946 str_index = EVT_DWORD(test_evt->v5); | |
8947 result = (char *)p2DEvents[str_index - 1].pName; | |
0 | 8948 } |
8949 else | |
8950 { | |
428 | 8951 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) |
8952 { | |
8953 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
8954 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; | |
8955 if ( test_evt->_e_type == EVENT_SpeakInHouse ) | |
8956 { | |
8957 str_index = EVT_DWORD(test_evt->v5); | |
8958 if ( str_index < 600 ) | |
8959 return (char *)p2DEvents[str_index - 1].pName; | |
8960 } | |
8961 } | |
8962 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
8963 } | |
8964 | |
0 | 8965 return result; |
8966 } |