Mercurial > mm7
comparison SpriteObject.cpp @ 2085:52abdea20b9e
Door_switch_animation
author | Ritor1 |
---|---|
date | Wed, 11 Dec 2013 23:12:54 +0600 |
parents | a290d9fbdc95 |
children | 7f403ebf619f |
comparison
equal
deleted
inserted
replaced
2068:a290d9fbdc95 | 2085:52abdea20b9e |
---|---|
204 } | 204 } |
205 | 205 |
206 //----- (00471C03) -------------------------------------------------------- | 206 //----- (00471C03) -------------------------------------------------------- |
207 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) | 207 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) |
208 { | 208 { |
209 //SpriteObject *v1; // esi@1 | |
210 ObjectDesc *object; // ebx@1 | 209 ObjectDesc *object; // ebx@1 |
211 signed int v3; // edx@1 | |
212 int v4; // ecx@1 | |
213 int v5; // ST04_4@1 | |
214 int v6; // eax@1 | 210 int v6; // eax@1 |
215 int v7; // ecx@1 | 211 int v7; // ecx@1 |
216 int v8; // edi@1 | 212 int v8; // edi@1 |
217 int v9; // eax@4 | 213 int v9; // eax@4 |
218 __int16 v10; // ax@7 | |
219 int v11; // edx@11 | |
220 int v12; // ecx@11 | |
221 signed int v13; // edx@14 | |
222 signed int v14; // edx@16 | |
223 int v15; // eax@24 | |
224 int v16; // eax@25 | |
225 int v17; // ST10_4@25 | 214 int v17; // ST10_4@25 |
226 signed int v18; // eax@25 | 215 //signed int v19; // eax@28 |
227 signed int v19; // eax@28 | 216 //Actor *v20; // edi@31 |
228 Actor *v20; // edi@31 | |
229 int v21; // eax@41 | 217 int v21; // eax@41 |
230 int v22; // ecx@43 | 218 int v22; // ecx@43 |
231 __int16 v23; // bx@45 | 219 __int16 v23; // bx@45 |
232 char v24; // al@46 | 220 char v24; // al@46 |
233 signed int i; // edi@50 | 221 signed int i; // edi@50 |
234 int v26; // edi@52 | 222 int v26; // edi@52 |
235 int v27; // eax@52 | 223 int v27; // eax@52 |
236 __int16 v28; // cx@55 | 224 __int16 v28; // cx@55 |
237 int v29; // eax@55 | 225 int v29; // eax@55 |
238 signed int v30; // edi@59 | 226 //signed int v30; // edi@59 |
239 BSPModel *v31; // ecx@61 | 227 BSPModel *bmodel; // ecx@61 |
240 ODMFace *v32; // edi@61 | 228 ODMFace *face; // edi@61 |
241 int v33; // eax@62 | 229 int v33; // eax@62 |
242 int v34; // ecx@62 | 230 int v34; // ecx@62 |
243 int v35; // eax@63 | 231 int v35; // eax@63 |
244 int v36; // ecx@67 | 232 int v36; // ecx@67 |
245 __int16 v37; // ax@67 | 233 __int16 v37; // ax@67 |
246 int v38; // eax@72 | 234 int v38; // eax@72 |
247 int v39; // eax@72 | 235 //int v39; // eax@72 |
248 unsigned __int64 v40; // qax@72 | 236 unsigned __int64 v40; // qax@72 |
249 int v41; // eax@72 | 237 int v41; // eax@72 |
250 unsigned __int8 v42; // sf@74 | 238 unsigned __int8 v42; // sf@74 |
251 unsigned __int8 v43; // of@74 | 239 unsigned __int8 v43; // of@74 |
252 int v44; // eax@77 | 240 int v44; // eax@77 |
256 enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46 | 244 enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46 |
257 int v49; // [sp+Ch] [bp-9Ch]@52 | 245 int v49; // [sp+Ch] [bp-9Ch]@52 |
258 int v50; // [sp+10h] [bp-98h]@52 | 246 int v50; // [sp+10h] [bp-98h]@52 |
259 Vec3_int_ v51; // [sp+14h] [bp-94h]@11 | 247 Vec3_int_ v51; // [sp+14h] [bp-94h]@11 |
260 Particle_sw Dst; // [sp+20h] [bp-88h]@45 | 248 Particle_sw Dst; // [sp+20h] [bp-88h]@45 |
261 unsigned int uLayingItemID_; // [sp+88h] [bp-20h]@1 | |
262 int v54; // [sp+8Ch] [bp-1Ch]@1 | 249 int v54; // [sp+8Ch] [bp-1Ch]@1 |
263 int v55; // [sp+90h] [bp-18h]@1 | 250 int v55; // [sp+90h] [bp-18h]@1 |
264 int v56; // [sp+94h] [bp-14h]@11 | 251 int v56; // [sp+94h] [bp-14h]@11 |
265 int v57; // [sp+98h] [bp-10h]@1 | 252 int v57; // [sp+98h] [bp-10h]@1 |
266 int v58; // [sp+9Ch] [bp-Ch]@1 | 253 int v58; // [sp+9Ch] [bp-Ch]@1 |
267 int on_water; // [sp+A0h] [bp-8h]@1 | 254 int on_water; // [sp+A0h] [bp-8h]@1 |
268 int v60; // [sp+A4h] [bp-4h]@11 | 255 int v60; // [sp+A4h] [bp-4h]@11 |
269 | 256 |
270 uLayingItemID_ = uLayingItemID; | |
271 //v1 = &pSpriteObjects[uLayingItemID]; | |
272 v58 = 0; | 257 v58 = 0; |
273 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; | 258 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; |
274 v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y); | 259 v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y); |
275 v3 = pSpriteObjects[uLayingItemID].vPosition.y; | |
276 v4 = pSpriteObjects[uLayingItemID].vPosition.x; | |
277 v5 = object->uHeight; | |
278 v55 = 0; | 260 v55 = 0; |
279 v6 = ODM_GetFloorLevel(v4, v3, pSpriteObjects[uLayingItemID].vPosition.z, v5, &on_water, &v55, 0); | 261 v6 = ODM_GetFloorLevel(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uHeight, &on_water, &v55, 0); |
280 v7 = v6; | 262 v7 = v6; |
281 v54 = v6; | 263 v54 = v6; |
282 v8 = v6 + 1; | 264 v8 = v6 + 1; |
283 if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 ) | 265 if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 ) |
284 { | 266 { |
285 if ( on_water ) | 267 if ( on_water ) |
286 { | 268 { |
287 v9 = v6 + 60; | 269 v9 = v6 + 60; |
288 if ( v55 ) | 270 if ( v55 ) |
289 v9 = v7 + 30; | 271 v9 = v6 + 30; |
290 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9); | 272 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9); |
291 SpriteObject::OnInteraction(uLayingItemID_); | 273 SpriteObject::OnInteraction(uLayingItemID); |
292 } | 274 } |
293 } | 275 } |
294 else | 276 else |
295 { | 277 { |
296 v58 = 1; | 278 v58 = 1; |
297 } | 279 } |
298 v10 = object->uFlags; | |
299 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) ) | 280 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) ) |
300 { | 281 { |
301 if ( v58 ) | 282 if ( v58 ) |
302 { | 283 { |
303 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | 284 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
304 goto LABEL_13; | 285 goto LABEL_13; |
305 } | 286 } |
306 if ( v57 ) | 287 if ( v57 ) |
307 { | 288 { |
308 v11 = pSpriteObjects[uLayingItemID].vPosition.y; | |
309 v12 = pSpriteObjects[uLayingItemID].vPosition.x; | |
310 pSpriteObjects[uLayingItemID].vPosition.z = v8; | 289 pSpriteObjects[uLayingItemID].vPosition.z = v8; |
311 ODM_GetTerrainNormalAt(v12, v11, &v51); | 290 ODM_GetTerrainNormalAt(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, &v51); |
312 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | 291 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
313 v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16; | 292 v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16; |
314 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); | 293 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); |
315 pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x); | 294 pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x); |
316 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); | 295 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); |
318 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); | 297 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); |
319 pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z); | 298 pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z); |
320 v7 = v54; | 299 v7 = v54; |
321 goto LABEL_13; | 300 goto LABEL_13; |
322 } | 301 } |
323 if ( v10 & 0x40 ) | 302 if ( object->uFlags & OBJECT_DESC_INTERACTABLE ) |
324 { | 303 { |
325 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 ) | 304 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 ) |
326 pSpriteObjects[uLayingItemID].vPosition.z = v8; | 305 pSpriteObjects[uLayingItemID].vPosition.z = v8; |
327 if ( !_46BFFA_check_object_intercept(uLayingItemID_, 0) ) | 306 if ( !_46BFFA_check_object_intercept(uLayingItemID, 0) ) |
328 return; | 307 return; |
329 } | 308 } |
330 pSpriteObjects[uLayingItemID].vPosition.z = v8; | 309 pSpriteObjects[uLayingItemID].vPosition.z = v8; |
331 if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) ) | 310 if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) ) |
332 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | 311 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
333 | 312 |
334 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x); | 313 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x); |
335 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y); | 314 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y); |
336 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z); | 315 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z); |
337 | 316 if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y |
338 if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 ) | 317 + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 ) |
339 { | 318 { |
340 | 319 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
341 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | 320 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
342 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | 321 memset(&Dst, 0, 0x68u); |
343 memset(&Dst, 0, 0x68u); | 322 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x; |
344 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x; | 323 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y; |
345 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y; | 324 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z; |
346 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z; | 325 Dst.r = 0.0; |
347 Dst.r = 0.0; | 326 Dst.g = 0.0; |
348 Dst.g = 0.0; | 327 Dst.b = 0.0; |
349 Dst.b = 0.0; | 328 if (object->uFlags & OBJECT_DESC_TRIAL_FIRE ) |
350 if (object->uFlags & OBJECT_DESC_TRIAL_FIRE ) | 329 { |
351 { | 330 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
352 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | 331 Dst.uDiffuse = 0xFF3C1E; |
353 Dst.uDiffuse = 0xFF3C1E; | 332 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
354 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; | 333 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); |
355 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); | 334 Dst.flt_28 = 1.0; |
356 Dst.flt_28 = 1.0; | 335 pGame->pParticleEngine->AddParticle(&Dst); |
357 pGame->pParticleEngine->AddParticle(&Dst); | 336 } |
358 } | 337 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE) |
359 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE) | 338 { |
360 { | |
361 | |
362 Dst.type = ParticleType_Line; | 339 Dst.type = ParticleType_Line; |
363 Dst.uDiffuse = rand(); | 340 Dst.uDiffuse = rand(); |
364 Dst.timeToLive = 64; | 341 Dst.timeToLive = 64; |
365 Dst.uTextureID = 0; | 342 Dst.uTextureID = 0; |
366 Dst.flt_28 = 1.0; | 343 Dst.flt_28 = 1.0; |
367 pGame->pParticleEngine->AddParticle(&Dst); | 344 pGame->pParticleEngine->AddParticle(&Dst); |
368 } | 345 } |
369 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE ) | 346 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE ) |
370 { | 347 { |
371 Dst.type = ParticleType_Bitmap | ParticleType_8; | 348 Dst.type = ParticleType_Bitmap | ParticleType_8; |
372 Dst.uDiffuse = rand(); | 349 Dst.uDiffuse = rand(); |
373 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; | 350 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
374 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); | 351 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); |
375 Dst.flt_28 = 1.0; | 352 Dst.flt_28 = 1.0; |
376 pGame->pParticleEngine->AddParticle(&Dst); | 353 pGame->pParticleEngine->AddParticle(&Dst); |
377 } | 354 } |
378 return; | 355 return; |
379 } | 356 } |
380 } | 357 } |
381 LABEL_13: | 358 LABEL_13: |
382 if ( pSpriteObjects[uLayingItemID].vPosition.z > v7 | 359 if ( pSpriteObjects[uLayingItemID].vPosition.x >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.x <= 0x8000 |
383 && (v13 = pSpriteObjects[uLayingItemID].vPosition.x, v13 >= -0x8000) | 360 && pSpriteObjects[uLayingItemID].vPosition.y >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.y <= 0x8000 |
384 && v13 <= 0x8000 | 361 && pSpriteObjects[uLayingItemID].vPosition.z > v7 && pSpriteObjects[uLayingItemID].vPosition.z <= 13000 |
385 && (v14 = pSpriteObjects[uLayingItemID].vPosition.y, v14 >= -0x8000) | |
386 && v14 <= 0x8000 | |
387 && pSpriteObjects[uLayingItemID].vPosition.z <= 13000 | |
388 || !(object->uFlags & OBJECT_DESC_INTERACTABLE) ) | 362 || !(object->uFlags & OBJECT_DESC_INTERACTABLE) ) |
389 goto LABEL_92; | 363 goto LABEL_92; |
390 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 ) | 364 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 ) |
391 pSpriteObjects[uLayingItemID].vPosition.z = v8; | 365 pSpriteObjects[uLayingItemID].vPosition.z = v8; |
392 if ( _46BFFA_check_object_intercept(uLayingItemID_, 0) ) | 366 if ( _46BFFA_check_object_intercept(uLayingItemID, 0) ) |
393 { | 367 { |
394 LABEL_92: | 368 LABEL_92: |
395 stru_721530.field_0 = 0; | 369 stru_721530.field_0 = 0; |
396 v55 = 0; | |
397 stru_721530.prolly_normal_d = object->uRadius; | 370 stru_721530.prolly_normal_d = object->uRadius; |
398 stru_721530.height = object->uHeight; | 371 stru_721530.height = object->uHeight; |
399 stru_721530.field_8_radius = 0; | 372 stru_721530.field_8_radius = 0; |
400 stru_721530.field_70 = 0; | 373 stru_721530.field_70 = 0; |
401 while ( 1 ) | 374 for ( v55 = 0; v55 < 100; ++v55 ) |
402 { | 375 { |
403 stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x; | 376 stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x; |
404 stru_721530.normal.x = stru_721530.position.x; | 377 stru_721530.normal.x = stru_721530.position.x; |
405 v15 = pSpriteObjects[uLayingItemID].vPosition.y; | |
406 stru_721530.uSectorID = 0; | 378 stru_721530.uSectorID = 0; |
407 stru_721530.position.y = v15; | 379 stru_721530.position.y = pSpriteObjects[uLayingItemID].vPosition.y; |
408 stru_721530.normal.y = v15; | 380 stru_721530.normal.y = pSpriteObjects[uLayingItemID].vPosition.y; |
409 stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1; | 381 stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1; |
410 stru_721530.normal.z = stru_721530.position.z; | 382 stru_721530.normal.z = stru_721530.position.z; |
411 stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x; | 383 stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
412 stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y; | 384 stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
413 stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z; | 385 stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
414 if ( stru_721530._47050A(0) ) | 386 if ( stru_721530._47050A(0) ) |
415 return; | 387 return; |
416 _46E889_collide_against_bmodels(0); | 388 _46E889_collide_against_bmodels(0); |
417 v16 = WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y); | 389 _46E26D_collide_against_sprites(WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x), WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y)); |
418 v18 = WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x); | |
419 _46E26D_collide_against_sprites(v18, v16); | |
420 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) | 390 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) |
421 _46EF01_collision_chech_player(0); | 391 _46EF01_collision_chech_player(0); |
422 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor) | 392 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor) |
423 { | 393 { |
424 v19 = PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid); | 394 if (( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) >= 0 ) |
425 if (( v19 >= 0 )&&( v19 < (signed int)(uNumActors - 1) )) | 395 &&( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < (signed int)(uNumActors - 1) )) |
426 { | 396 { |
427 | 397 for (v56 =0; v56 < uNumActors; ++v56) |
428 v20 = &pActors[v19]; | 398 { |
429 for (v56 =0; v56 < uNumActors; ++v56) | 399 if ( pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[v56]) ) |
430 { | 400 Actor::_46DF1A_collide_against_actor(v56, 0); |
431 if ( v20->GetActorsRelation(&pActors[v56]) ) | 401 } |
432 Actor::_46DF1A_collide_against_actor(v56, 0); | |
433 | |
434 } | |
435 } | 402 } |
436 } | 403 } |
437 else | 404 else |
438 { | 405 { |
439 for ( i = 0; i < (signed int)uNumActors; ++i ) | 406 for ( i = 0; i < (signed int)uNumActors; ++i ) |
447 if ( v50 ) | 414 if ( v50 ) |
448 v44 = v27 + 30; | 415 v44 = v27 + 30; |
449 else | 416 else |
450 v44 = v54 + 60; | 417 v44 = v54 + 60; |
451 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44); | 418 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44); |
452 SpriteObject::OnInteraction(uLayingItemID_); | 419 SpriteObject::OnInteraction(uLayingItemID); |
453 return; | 420 return; |
454 } | 421 } |
455 if ( stru_721530.field_7C >= stru_721530.field_6C ) | 422 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
456 { | 423 { |
457 pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x; | 424 pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x; |
508 stru_721530.field_70 += stru_721530.field_7C; | 475 stru_721530.field_70 += stru_721530.field_7C; |
509 if ( object->uFlags & OBJECT_DESC_INTERACTABLE ) | 476 if ( object->uFlags & OBJECT_DESC_INTERACTABLE ) |
510 { | 477 { |
511 if ( v29 < v54 ) | 478 if ( v29 < v54 ) |
512 pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1; | 479 pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1; |
513 if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) | 480 if ( !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) |
514 return; | 481 return; |
515 } | 482 } |
516 v30 = (signed int)PID_ID(stru_721530.uFaceID); | |
517 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) | 483 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
518 break; | 484 break; |
519 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) | 485 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
520 { | 486 { |
521 v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | 487 bmodel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; |
522 v32 = &v31->pFaces[v30 & 0x3F]; | 488 face = &bmodel->pFaces[PID_ID(stru_721530.uFaceID) & 0x3F]; |
523 if ( v32->uPolygonType != 3 ) | 489 if ( face->uPolygonType != POLYGON_Floor ) |
524 { | 490 { |
525 v56 = abs(v32->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z + v32->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y | 491 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x |
526 + v32->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16; | 492 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y |
493 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16; | |
527 if ( (stru_721530.speed >> 3) > v56 ) | 494 if ( (stru_721530.speed >> 3) > v56 ) |
528 v56 = stru_721530.speed >> 3; | 495 v56 = stru_721530.speed >> 3; |
529 v57 = v32->pFacePlane.vNormal.x; | 496 v57 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.x) >> 16; |
530 v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16; | 497 v58 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.y) >> 16; |
531 v58 = v32->pFacePlane.vNormal.y; | 498 v60 = (unsigned __int64)(v56 * (signed __int64)face->pFacePlane.vNormal.z) >> 16; |
532 v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16; | |
533 v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16); | |
534 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57; | 499 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57; |
535 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58; | 500 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58; |
536 if ( v32->pFacePlane.vNormal.z <= 32000 ) | 501 if ( face->pFacePlane.vNormal.z <= 32000 ) |
537 { | 502 { |
538 v37 = 2 * (short)v60; | 503 v37 = 2 * (short)v60; |
539 } | 504 } |
540 else | 505 else |
541 { | 506 { |
543 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60; | 508 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60; |
544 v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16; | 509 v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16; |
545 v37 = (unsigned int)(32000 * v36) >> 16; | 510 v37 = (unsigned int)(32000 * v36) >> 16; |
546 } | 511 } |
547 pSpriteObjects[uLayingItemID].vVelocity.z += v37; | 512 pSpriteObjects[uLayingItemID].vVelocity.z += v37; |
548 if ( BYTE3(v32->uAttributes) & 0x10 ) | 513 if ( BYTE3(face->uAttributes) & 0x10 ) |
549 EventProcessor(v32->sCogTriggeredID, 0, 1); | 514 EventProcessor(face->sCogTriggeredID, 0, 1); |
550 goto LABEL_74; | 515 goto LABEL_74; |
551 } | 516 } |
552 v33 = v31->pVertices.pVertices[v32->pVertexIDs[0]].z; | 517 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1; |
553 v34 = pSpriteObjects[uLayingItemID].vVelocity.x; | 518 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x |
554 pSpriteObjects[uLayingItemID].vPosition.z = v33 + 1; | 519 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 ) |
555 if ( pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + v34 * v34 >= 400 ) | 520 { |
556 { | 521 if ( BYTE3(face->uAttributes) & 0x10 ) |
557 if ( BYTE3(v32->uAttributes) & 0x10 ) | 522 EventProcessor(face->sCogTriggeredID, 0, 1); |
558 EventProcessor(v32->sCogTriggeredID, 0, 1); | |
559 goto LABEL_74; | 523 goto LABEL_74; |
560 } | 524 } |
561 LOWORD(v35) = 0; | 525 LOWORD(v35) = 0; |
562 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | 526 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
563 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | 527 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
564 pSpriteObjects[uLayingItemID].vVelocity.y = v35; | 528 pSpriteObjects[uLayingItemID].vVelocity.y = v35; |
565 } | 529 } |
566 LABEL_74: | 530 LABEL_74: |
567 pSpriteObjects[uLayingItemID].vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.x) >> 16); | 531 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x); |
568 pSpriteObjects[uLayingItemID].vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.y) >> 16); | 532 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y); |
569 pSpriteObjects[uLayingItemID].vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.z) >> 16); | 533 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z); |
570 | 534 } |
571 ++v55; | 535 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x |
572 //v43 = __OFSUB__(v55, 100); | 536 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y); |
573 // v42 = v55 - 100 < 0; | 537 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x, |
574 if (v55>=100 )//!(v42 ^ v43) | 538 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y); |
575 return; | 539 pSpriteObjects[uLayingItemID].vVelocity.x = (unsigned __int64)(stru_5C6E00->Cos(v38) * (signed __int64)v57) >> 16; |
576 } | 540 pSpriteObjects[uLayingItemID].vVelocity.y = (unsigned __int64)(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v57) >> 16; |
577 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x); | |
578 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[v30].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[v30].vPosition.y); | |
579 v56 = v38; | |
580 v39 = stru_5C6E00->Cos(v38); | |
581 // v60 = v39; | |
582 v40 = v39 * (signed __int64)v57; | |
583 v58 = v40 >> 16; | |
584 pSpriteObjects[uLayingItemID].vVelocity.x = WORD1(v40); | |
585 v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi); | |
586 // v60 = v41; | |
587 v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16; | |
588 v58 = v35; | |
589 pSpriteObjects[uLayingItemID].vVelocity.y = v35; | |
590 goto LABEL_74; | 541 goto LABEL_74; |
591 } | 542 } |
592 } | 543 } |
593 | 544 |
594 //----- (0047136C) -------------------------------------------------------- | 545 //----- (0047136C) -------------------------------------------------------- |
595 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID) | 546 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID) |
596 { | 547 { |
597 SpriteObject *pSpriteObject; // esi@1 | 548 SpriteObject *pSpriteObject; // esi@1 |
598 ObjectDesc *pObject; // edi@1 | 549 ObjectDesc *pObject; // edi@1 |
599 //int v3; // ST08_4@1 | |
600 //__int16 v4; // ax@5 | |
601 __int16 v5; // ax@7 | |
602 BLVFace *v6; // ecx@11 | |
603 BLVFace *v7; // eax@11 | |
604 signed int v8; // ebx@12 | |
605 int v9; // ecx@16 | 550 int v9; // ecx@16 |
606 __int16 v10; // di@18 | 551 __int16 v10; // di@18 |
607 char v11; // al@19 | |
608 //int v12; // eax@25 | |
609 int v13; // eax@31 | |
610 int v14; // ebx@34 | 552 int v14; // ebx@34 |
611 signed int v15; // ebx@46 | 553 signed int v15; // ebx@46 |
612 BLVFace *v16; // edi@48 | |
613 int v17; // eax@50 | 554 int v17; // eax@50 |
614 int v18; // eax@52 | 555 int v18; // eax@52 |
615 int v19; // ecx@52 | 556 int v19; // ecx@52 |
616 Vec3_short_ *v20; // ecx@53 | 557 Vec3_short_ *v20; // ecx@53 |
617 //int v21; // ecx@57 | |
618 __int16 v22; // ax@57 | 558 __int16 v22; // ax@57 |
619 int v23; // edi@62 | 559 int v23; // edi@62 |
620 //int v24; // edi@62 | |
621 //int v25; // eax@62 | |
622 //unsigned __int64 v26; // qax@62 | |
623 unsigned __int8 v27; // sf@64 | 560 unsigned __int8 v27; // sf@64 |
624 unsigned __int8 v28; // of@64 | 561 unsigned __int8 v28; // of@64 |
625 __int16 v29; // di@67 | 562 __int16 v29; // di@67 |
626 char v30; // al@68 | 563 char v30; // al@68 |
627 const char *v31; // [sp-8h] [bp-98h]@19 | |
628 const char *v32; // [sp-8h] [bp-98h]@68 | |
629 enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19 | |
630 enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68 | |
631 Particle_sw Dst; // [sp+Ch] [bp-84h]@18 | 564 Particle_sw Dst; // [sp+Ch] [bp-84h]@18 |
632 //unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 | |
633 //ObjectDesc *v37; // [sp+78h] [bp-18h]@1 | |
634 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 | 565 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 |
635 int v39; // [sp+80h] [bp-10h]@33 | 566 int v39; // [sp+80h] [bp-10h]@33 |
636 Actor *v39b; | |
637 int v40; // [sp+84h] [bp-Ch]@28 | 567 int v40; // [sp+84h] [bp-Ch]@28 |
638 //int v41; // [sp+88h] [bp-8h]@34 | 568 int v42; // [sp+8Ch] [bp-4h]@4 |
639 int v42; // [sp+8Ch] [bp-4h]@4 | 569 |
640 | |
641 //uLayingItemID_ = uLayingItemID; | |
642 pSpriteObject = &pSpriteObjects[uLayingItemID]; | 570 pSpriteObject = &pSpriteObjects[uLayingItemID]; |
643 pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID]; | 571 pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID]; |
644 //v3 = pSpriteObject->vPosition.x; | |
645 //v37 = &pObjectList->pObjects[pSpriteObject->uObjectDescID]; | |
646 pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z); | 572 pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z); |
647 v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID); | 573 v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID); |
648 if ( abs(pSpriteObject->vPosition.x) > 32767 | 574 if ( abs(pSpriteObject->vPosition.x) > 32767 |
649 || abs(pSpriteObject->vPosition.y) > 32767 | 575 || abs(pSpriteObject->vPosition.y) > 32767 |
650 || abs(pSpriteObject->vPosition.z) > 20000 | 576 || abs(pSpriteObject->vPosition.z) > 20000 |
653 // || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) ) | 579 // || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) ) |
654 { | 580 { |
655 SpriteObject::OnInteraction(uLayingItemID); | 581 SpriteObject::OnInteraction(uLayingItemID); |
656 return; | 582 return; |
657 } | 583 } |
658 v5 = pObject->uFlags; | 584 if ( pObject->uFlags & OBJECT_DESC_NO_GRAVITY )//не падающие объекты |
659 if ( v5 & 0x20 ) | 585 { |
660 { | |
661 LABEL_24: | |
662 v8 = 0; | |
663 LABEL_25: | 586 LABEL_25: |
664 stru_721530.field_0 = v8; | 587 stru_721530.field_0 = 0; |
665 uFaceID = v8; | |
666 stru_721530.prolly_normal_d = pObject->uRadius; | 588 stru_721530.prolly_normal_d = pObject->uRadius; |
667 | |
668 stru_721530.field_84 = -1; | 589 stru_721530.field_84 = -1; |
669 stru_721530.height = pObject->uHeight; | 590 stru_721530.height = pObject->uHeight; |
670 stru_721530.field_8_radius = v8; | 591 stru_721530.field_8_radius = 0; |
671 stru_721530.field_70 = v8; | 592 stru_721530.field_70 = 0; |
672 while ( 1 ) | 593 for ( uFaceID = 0; uFaceID < 100; uFaceID++ ) |
673 { | 594 { |
674 stru_721530.position.x = pSpriteObject->vPosition.x; | 595 stru_721530.position.x = pSpriteObject->vPosition.x; |
596 stru_721530.position.y = pSpriteObject->vPosition.y; | |
597 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1; | |
598 | |
675 stru_721530.normal.x = stru_721530.position.x; | 599 stru_721530.normal.x = stru_721530.position.x; |
676 stru_721530.position.y = pSpriteObject->vPosition.y; | |
677 stru_721530.normal.y = stru_721530.position.y; | 600 stru_721530.normal.y = stru_721530.position.y; |
678 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1; | |
679 stru_721530.normal.z = stru_721530.position.z; | 601 stru_721530.normal.z = stru_721530.position.z; |
602 | |
680 stru_721530.velocity.x = pSpriteObject->vVelocity.x; | 603 stru_721530.velocity.x = pSpriteObject->vVelocity.x; |
681 stru_721530.velocity.y = pSpriteObject->vVelocity.y; | 604 stru_721530.velocity.y = pSpriteObject->vVelocity.y; |
682 stru_721530.velocity.z = pSpriteObject->vVelocity.z; | 605 stru_721530.velocity.z = pSpriteObject->vVelocity.z; |
606 | |
683 stru_721530.uSectorID = pSpriteObject->uSectorID; | 607 stru_721530.uSectorID = pSpriteObject->uSectorID; |
684 if ( stru_721530._47050A(v8) ) | 608 if ( stru_721530._47050A(0) ) |
685 return; | 609 return; |
686 v40 = v8; | 610 |
687 do | 611 for ( v40 = 0; v40 < 100; ++v40 ) |
688 { | 612 { |
689 _46E44E_collide_against_faces_and_portals(0); | 613 _46E44E_collide_against_faces_and_portals(0); |
690 _46E0B2_collide_against_decorations(); | 614 _46E0B2_collide_against_decorations(); |
691 if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player) | 615 if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player) |
692 _46EF01_collision_chech_player(1); | 616 _46EF01_collision_chech_player(1); |
693 v13 = pSpriteObject->spell_caster_pid; | 617 if (PID_TYPE(pSpriteObject->spell_caster_pid) == OBJECT_Actor) |
694 v42 = v8; | 618 { |
695 if (PID_TYPE(v13) == OBJECT_Actor) | 619 for ( v42 = 0; v42 < (signed int)uNumActors; ++v42 ) |
696 { | |
697 if ( (signed int)uNumActors > v8 ) | |
698 { | 620 { |
699 v39b = pActors.data();//[0].word_000086_some_monster_id; | 621 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != pActors[v42].pMonsterInfo.uID ) |
700 do | 622 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius |
701 { | 623 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius); |
702 //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; | |
703 //v14 = (signed __int64)((double)v41 * 0.3333333333333333); | |
704 //v41 = *(short *)(v39 - 38) - 1; | |
705 //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) | |
706 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) | |
707 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius | |
708 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius); | |
709 ++v42; | |
710 ++v39b;// += 836; | |
711 } | |
712 while ( v42 < (signed int)uNumActors ); | |
713 v8 = 0; | |
714 } | 624 } |
715 } | 625 } |
716 else | 626 else |
717 { | 627 { |
718 if ( (signed int)uNumActors > v8 ) | 628 for ( v42 = 0; v42 < (signed int)uNumActors; v42++ ) |
719 { | 629 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius); |
720 v39b = pActors.data();//[0].word_000086_some_monster_id; | |
721 do | |
722 { | |
723 Actor::_46DF1A_collide_against_actor(v42++, pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius); | |
724 ++v39b; | |
725 } | |
726 while ( v42 < (signed int)uNumActors ); | |
727 } | |
728 } | 630 } |
729 if ( _46F04E_collide_against_portals() ) | 631 if ( _46F04E_collide_against_portals() ) |
730 break; | 632 break; |
731 ++v40; | 633 } |
732 } | |
733 while ( v40 < 100 ); | |
734 if ( stru_721530.field_7C >= stru_721530.field_6C ) | 634 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
735 { | 635 { |
736 pSpriteObject->vPosition.x = stru_721530.normal2.x; | 636 pSpriteObject->vPosition.x = stru_721530.normal2.x; |
737 pSpriteObject->vPosition.y = stru_721530.normal2.y; | 637 pSpriteObject->vPosition.y = stru_721530.normal2.y; |
738 pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | 638 pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
739 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); | 639 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); |
740 if ( !(HIBYTE(pObject->uFlags) & 1) ) | 640 if ( !(HIBYTE(pObject->uFlags) & 1) ) |
741 return; | 641 return; |
742 memset(&Dst, v8, 0x68u); | 642 memset(&Dst, 0, 0x68u); |
743 v29 = pObject->uFlags; | |
744 Dst.x = (double)pSpriteObject->vPosition.x; | 643 Dst.x = (double)pSpriteObject->vPosition.x; |
745 Dst.y = (double)pSpriteObject->vPosition.y; | 644 Dst.y = (double)pSpriteObject->vPosition.y; |
746 Dst.z = (double)pSpriteObject->vPosition.z; | 645 Dst.z = (double)pSpriteObject->vPosition.z; |
747 Dst.r = 0.0; | 646 Dst.r = 0.0; |
748 Dst.g = 0.0; | 647 Dst.g = 0.0; |
749 Dst.b = 0.0; | 648 Dst.b = 0.0; |
750 if ( v29 & 0x200 ) | 649 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE ) |
751 { | 650 { |
752 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | 651 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
753 Dst.uDiffuse = 0xFF3C1E; | 652 Dst.uDiffuse = 0xFF3C1E; |
754 v30 = rand(); | 653 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
755 v34 = (TEXTURE_TYPE)v8; | 654 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); |
756 v32 = "effpar01"; | 655 Dst.flt_28 = 1.0; |
757 } | 656 pGame->pParticleEngine->AddParticle(&Dst); |
758 else | 657 return; |
759 { | 658 } |
760 if ( v29 & 0x400 ) | 659 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE ) |
761 { | 660 { |
762 Dst.type = ParticleType_Line; | 661 Dst.type = ParticleType_Line; |
763 Dst.uDiffuse = rand(); | 662 Dst.uDiffuse = rand(); |
764 Dst.timeToLive = 64; | 663 Dst.timeToLive = 64; |
765 Dst.uTextureID = v8; | 664 Dst.uTextureID = 0; |
766 Dst.flt_28 = 1.0; | 665 Dst.flt_28 = 1.0; |
767 pGame->pParticleEngine->AddParticle(&Dst); | 666 pGame->pParticleEngine->AddParticle(&Dst); |
768 return; | 667 return; |
769 } | 668 } |
669 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
670 { | |
770 Dst.type = ParticleType_Bitmap | ParticleType_8; | 671 Dst.type = ParticleType_Bitmap | ParticleType_8; |
771 Dst.uDiffuse = rand(); | 672 Dst.uDiffuse = rand(); |
772 v30 = rand(); | 673 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
773 v34 = (TEXTURE_TYPE)v8; | 674 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); |
774 v32 = "effpar03"; | 675 Dst.flt_28 = 1.0; |
775 } | 676 pGame->pParticleEngine->AddParticle(&Dst); |
776 Dst.timeToLive = (unsigned __int8)(v30 & 0x80) + 128; | 677 } |
777 Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34); | |
778 Dst.flt_28 = 1.0; | |
779 pGame->pParticleEngine->AddParticle(&Dst); | |
780 return; | 678 return; |
781 } | 679 } |
782 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; | 680 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; |
783 pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); | 681 pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); |
784 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; | 682 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; |
785 pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); | 683 pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); |
786 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; | 684 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16; |
787 pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); | 685 pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
788 pSpriteObject->uSectorID = stru_721530.uSectorID; | 686 pSpriteObject->uSectorID = stru_721530.uSectorID; |
789 stru_721530.field_70 += stru_721530.field_7C; | 687 stru_721530.field_70 += stru_721530.field_7C; |
790 if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) | 688 if ( pObject->uFlags & OBJECT_DESC_INTERACTABLE && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) |
791 return; | 689 return; |
792 v15 = (signed int)stru_721530.uFaceID >> 3; | 690 v15 = (signed int)stru_721530.uFaceID >> 3; |
793 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) | 691 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
794 { | 692 { |
795 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); | 693 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); |
796 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, | 694 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, |
797 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); | 695 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); |
798 pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40); | 696 pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40); |
799 pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40); | 697 pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40); |
800 } | 698 } |
801 else | 699 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
802 { | 700 { |
803 if (PID_TYPE(stru_721530.uFaceID) != OBJECT_BModel) | |
804 goto LABEL_64; | |
805 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID); | 701 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID); |
806 v16 = &pIndoor->pFaces[v15]; | 702 if ( pIndoor->pFaces[v15].uPolygonType != POLYGON_Floor ) |
807 if ( v16->uPolygonType != 3 ) | 703 { |
808 { | 704 v42 = abs(pIndoor->pFaces[v15].pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x |
809 v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z | 705 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y |
810 + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; | 706 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z) >> 16; |
811 if ( (stru_721530.speed >> 3) > v42 ) | 707 if ( (stru_721530.speed >> 3) > v42 ) |
812 v42 = stru_721530.speed >> 3; | 708 v42 = stru_721530.speed >> 3; |
813 pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.x); | 709 pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.x); |
814 pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.y); | 710 pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.y); |
815 v39 = fixpoint_mul(v42, v16->pFacePlane_old.vNormal.z); | 711 v39 = fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.z); |
816 if ( v16->pFacePlane_old.vNormal.z <= 32000 ) | 712 if ( pIndoor->pFaces[v15].pFacePlane_old.vNormal.z <= 32000 ) |
817 { | |
818 v22 = 2 * v39; | 713 v22 = 2 * v39; |
819 } | |
820 else | 714 else |
821 { | 715 { |
822 pSpriteObject->vVelocity.z += v39; | 716 pSpriteObject->vVelocity.z += v39; |
823 v22 = fixpoint_mul(32000, v39); | 717 v22 = fixpoint_mul(32000, v39); |
824 } | 718 } |
825 pSpriteObject->vVelocity.z += v22; | 719 pSpriteObject->vVelocity.z += v22; |
826 if ( BYTE3(v16->uAttributes) & 0x10 ) | 720 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 ) |
827 EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); | 721 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1); |
828 goto LABEL_63; | 722 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); |
829 } | 723 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); |
830 if ( pObject->uFlags & 0x80 ) | 724 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); |
831 { | 725 continue; |
832 v17 = -pSpriteObject->vVelocity.z >> 1; | 726 } |
727 if ( pObject->uFlags & OBJECT_DESC_BOUNCE ) | |
728 { | |
729 v17 = -pSpriteObject->vVelocity.z / 2; | |
833 pSpriteObject->vVelocity.z = v17; | 730 pSpriteObject->vVelocity.z = v17; |
834 if ( (signed __int16)v17 < 10 ) | 731 if ( (signed __int16)v17 < 10 ) |
835 pSpriteObject->vVelocity.z = 0; | 732 pSpriteObject->vVelocity.z = 0; |
836 if ( BYTE3(v16->uAttributes) & 0x10 ) | 733 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 ) |
837 EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); | 734 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1); |
838 goto LABEL_63; | 735 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); |
839 } | 736 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); |
840 v18 = pSpriteObject->vVelocity.y; | 737 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); |
841 v19 = pSpriteObject->vVelocity.x; | 738 continue; |
739 } | |
842 pSpriteObject->vVelocity.z = 0; | 740 pSpriteObject->vVelocity.z = 0; |
843 if ( v19 * v19 + v18 * v18 >= 400 ) | 741 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y >= 400 ) |
844 { | 742 { |
845 if ( BYTE3(v16->uAttributes) & 0x10 ) | 743 if ( BYTE3(pIndoor->pFaces[v15].uAttributes) & 0x10 ) |
846 EventProcessor(pIndoor->pFaceExtras[v16->uFaceExtraID].uEventID, 0, 1); | 744 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1); |
847 goto LABEL_63; | 745 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); |
848 } | 746 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); |
849 v20 = pIndoor->pVertices; | 747 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); |
748 continue; | |
749 } | |
850 pSpriteObject->vVelocity.z = 0; | 750 pSpriteObject->vVelocity.z = 0; |
851 pSpriteObject->vVelocity.y = 0; | 751 pSpriteObject->vVelocity.y = 0; |
852 pSpriteObject->vVelocity.x = 0; | 752 pSpriteObject->vVelocity.x = 0; |
853 pSpriteObject->vPosition.z = v20[*v16->pVertexIDs].z + 1; | 753 pSpriteObject->vPosition.z = pIndoor->pVertices[*pIndoor->pFaces[v15].pVertexIDs].z + 1; |
854 } | 754 } |
855 LABEL_63: | |
856 //v2 = v37; | |
857 LABEL_64: | |
858 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); | 755 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); |
859 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); | 756 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); |
860 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); | 757 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); |
861 ++uFaceID; | 758 } |
862 v28 = __OFSUB__(uFaceID, 100); | 759 } |
863 v27 = uFaceID - 100 < 0; | 760 //для падающих объектов(для примера выброс вещи из инвентаря) |
864 if ( !(v27 ^ v28) ) | |
865 return; | |
866 v8 = 0; | |
867 } | |
868 } | |
869 if ( v42 <= pSpriteObject->vPosition.z - 3 ) | 761 if ( v42 <= pSpriteObject->vPosition.z - 3 ) |
870 { | 762 { |
871 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | 763 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
872 goto LABEL_24; | 764 goto LABEL_25; |
873 } | 765 } |
874 if ( !(v5 & 0x40) || _46BFFA_check_object_intercept(uLayingItemID, 0) ) | 766 if ( !(pObject->uFlags & OBJECT_DESC_INTERACTABLE) || _46BFFA_check_object_intercept(uLayingItemID, 0) ) |
875 { | 767 { |
876 v6 = pIndoor->pFaces; | |
877 pSpriteObject->vPosition.z = v42 + 1; | 768 pSpriteObject->vPosition.z = v42 + 1; |
878 v7 = &v6[uFaceID]; | 769 if ( pIndoor->pFaces[uFaceID].uPolygonType == POLYGON_Floor ) |
879 if ( v7->uPolygonType == 3 ) | |
880 { | |
881 v8 = 0; | |
882 pSpriteObject->vVelocity.z = 0; | 770 pSpriteObject->vVelocity.z = 0; |
883 } | |
884 else | 771 else |
885 { | 772 { |
886 if ( v7->pFacePlane_old.vNormal.z < 45000 ) | 773 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 45000 ) |
887 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | 774 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
888 v8 = 0; | |
889 } | 775 } |
890 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); | 776 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x); |
891 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); | 777 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y); |
892 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); | 778 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z); |
893 v9 = pSpriteObject->vVelocity.x; | 779 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) |
894 if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 ) | 780 { |
895 { | 781 pSpriteObject->vVelocity.x = 0; |
896 pSpriteObject->vVelocity.z = v8; | 782 pSpriteObject->vVelocity.y = 0; |
897 pSpriteObject->vVelocity.y = v8; | 783 pSpriteObject->vVelocity.z = 0; |
898 pSpriteObject->vVelocity.x = v8; | 784 if ( !(pObject->uFlags & OBJECT_DESC_NO_SPRITE) ) |
899 if ( !(pObject->uFlags & 1) ) | |
900 return; | 785 return; |
901 memset(&Dst, v8, 0x68u); | 786 memset(&Dst, 0, 0x68u); |
902 v10 = pObject->uFlags; | |
903 Dst.x = (double)pSpriteObject->vPosition.x; | 787 Dst.x = (double)pSpriteObject->vPosition.x; |
904 Dst.y = (double)pSpriteObject->vPosition.y; | 788 Dst.y = (double)pSpriteObject->vPosition.y; |
905 Dst.z = (double)pSpriteObject->vPosition.z; | 789 Dst.z = (double)pSpriteObject->vPosition.z; |
906 Dst.r = 0.0; | 790 Dst.r = 0.0; |
907 Dst.g = 0.0; | 791 Dst.g = 0.0; |
908 Dst.b = 0.0; | 792 Dst.b = 0.0; |
909 if ( v10 & 0x200 ) | 793 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE ) |
910 { | 794 { |
911 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | 795 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
912 Dst.uDiffuse = 0xFF3C1E; | 796 Dst.uDiffuse = 0xFF3C1E; |
913 Dst.flt_28 = 1.0; | 797 Dst.flt_28 = 1.0; |
914 v11 = rand(); | 798 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
915 v33 = (TEXTURE_TYPE)v8; | 799 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); |
916 v31 = "effpar01"; | 800 pGame->pParticleEngine->AddParticle(&Dst); |
917 } | 801 return; |
918 else | 802 } |
919 { | 803 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE ) |
920 if ( v10 & 0x400 ) | 804 { |
921 { | 805 Dst.type = ParticleType_Line; |
922 Dst.type = ParticleType_Line; | 806 Dst.uDiffuse = rand(); |
923 Dst.uDiffuse = rand(); | 807 Dst.timeToLive = 64; |
924 Dst.timeToLive = 64; | 808 Dst.uTextureID = 0; |
925 Dst.uTextureID = v8; | 809 Dst.flt_28 = 1.0; |
926 Dst.flt_28 = 1.0; | 810 pGame->pParticleEngine->AddParticle(&Dst); |
927 pGame->pParticleEngine->AddParticle(&Dst); | 811 return; |
928 return; | 812 } |
929 } | 813 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
814 { | |
930 Dst.type = ParticleType_Bitmap | ParticleType_8; | 815 Dst.type = ParticleType_Bitmap | ParticleType_8; |
931 Dst.uDiffuse = rand(); | 816 Dst.uDiffuse = rand(); |
932 Dst.flt_28 = 1.0; | 817 Dst.flt_28 = 1.0; |
933 v11 = rand(); | 818 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128; |
934 v33 = (TEXTURE_TYPE)v8; | 819 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); |
935 v31 = "effpar03"; | 820 pGame->pParticleEngine->AddParticle(&Dst); |
936 } | 821 } |
937 Dst.timeToLive = (unsigned __int8)(v11 & 0x80) + 128; | |
938 Dst.uTextureID = pBitmaps_LOD->LoadTexture(v31, v33); | |
939 pGame->pParticleEngine->AddParticle(&Dst); | |
940 return; | 822 return; |
941 } | 823 } |
942 goto LABEL_25; | 824 goto LABEL_25; |
943 } | 825 } |
944 } | 826 } |
1030 } | 912 } |
1031 | 913 |
1032 | 914 |
1033 //----- (0042FA22) -------------------------------------------------------- | 915 //----- (0042FA22) -------------------------------------------------------- |
1034 void CompactLayingItemsList() | 916 void CompactLayingItemsList() |
1035 { | 917 { |
1036 int new_obj_pos=0; | 918 int new_obj_pos = 0; |
1037 | 919 |
1038 for (int i=0; i<MAX_SPRITE_OBJECTS; ++i) | 920 for (int i=0; i < MAX_SPRITE_OBJECTS; ++i) |
1039 { | 921 { |
1040 if (pSpriteObjects[i].uObjectDescID) | 922 if (pSpriteObjects[i].uObjectDescID) |
1041 memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject)); | 923 memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject)); |
1042 } | 924 } |
1043 uNumSpriteObjects = new_obj_pos; | 925 uNumSpriteObjects = new_obj_pos; |
1044 } | 926 } |
1045 //----- (00408896) -------------------------------------------------------- | 927 //----- (00408896) -------------------------------------------------------- |
1046 void InitializeSpriteObjects() | 928 void InitializeSpriteObjects() |
1047 { | 929 { |
1048 for (uint i = 0; i < uNumSpriteObjects; ++i) | 930 for (uint i = 0; i < uNumSpriteObjects; ++i) |
1049 { | 931 { |
1050 SpriteObject* item = &pSpriteObjects[i]; | 932 SpriteObject* item = &pSpriteObjects[i]; |
1051 | 933 |
1052 if (item->uType && | 934 if (item->uType && (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & OBJECT_DESC_UNPICKABLE)) |
1053 (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10)) | |
1054 SpriteObject::OnInteraction(i); | 935 SpriteObject::OnInteraction(i); |
1055 } | 936 } |
1056 } | 937 } |
1057 //----- (0046BEF1) -------------------------------------------------------- | 938 //----- (0046BEF1) -------------------------------------------------------- |
1058 void SpriteObject::_46BEF1_apply_spells_aoe() | 939 void SpriteObject::_46BEF1_apply_spells_aoe() |
1059 { | 940 { |
1060 SpriteObject *v1; // edi@1 | 941 //SpriteObject *v1; // edi@1 |
1061 Actor *v2; // esi@2 | 942 //Actor *v2; // esi@2 |
1062 __int16 v3; // fps@4 | 943 //__int16 v3; // fps@4 |
1063 unsigned __int8 v4; // c0@4 | 944 //unsigned __int8 v4; // c0@4 |
1064 unsigned __int8 v5; // c3@4 | 945 //unsigned __int8 v5; // c3@4 |
1065 signed int v6; // [sp+8h] [bp-4h]@1 | 946 //signed int v6; // [sp+8h] [bp-4h]@1 |
1066 | 947 |
1067 int v7,v8,v9,v10,v11; | 948 int v7,v9,v10,v11; |
1068 | 949 __debugbreak();//Ritor1 |
1069 v6 = 0; | |
1070 v1 = this; | |
1071 if ( (signed int)uNumActors > 0 ) | 950 if ( (signed int)uNumActors > 0 ) |
1072 { | 951 { |
1073 v2 = pActors.data();//[0].vPosition.y; | 952 for ( uint i = 0; i < uNumActors; ++i ) |
1074 do | 953 { |
1075 { | 954 if ( pActors[i].CanAct() ) |
1076 if ( v2->CanAct() ) | |
1077 { | 955 { |
1078 //UNDEF(v3); | 956 //UNDEF(v3); |
1079 //.text:0046BF26 movsx eax, word ptr [esi-2] | 957 //.text:0046BF26 movsx eax, word ptr [esi-2] |
1080 //.text:0046BF2A sub eax, [edi+4] | 958 //.text:0046BF2A sub eax, [edi+4] |
1081 //.text:0046BF31 mov [ebp+var_8], eax | 959 //.text:0046BF31 mov [ebp+var_8], eax |
1082 //.text:0046BF37 fild [ebp+var_8] | 960 //.text:0046BF37 fild [ebp+var_8] |
1083 // v7 pushed to stack | 961 // v7 pushed to stack |
1084 v7 = v2->vPosition.x - this->vPosition.x; | 962 v7 = pActors[i].vPosition.x - this->vPosition.x; |
1085 | 963 |
1086 //.text:0046BF2D movsx ecx, word ptr [esi+2] | 964 //.text:0046BF2D movsx ecx, word ptr [esi+2] |
1087 v8 = v2->vPosition.z; | 965 //v8 = pActors[i].vPosition.z; |
1088 | 966 |
1089 //.text:0046BF34 movsx eax, word ptr [esi] | 967 //.text:0046BF34 movsx eax, word ptr [esi] |
1090 //.text:0046BF3A sub eax, [edi+8] | 968 //.text:0046BF3A sub eax, [edi+8] |
1091 //.text:0046BF3D mov [ebp+var_8], eax | 969 //.text:0046BF3D mov [ebp+var_8], eax |
1092 //.text:0046BF44 fild [ebp+var_8] | 970 //.text:0046BF44 fild [ebp+var_8] |
1093 // v9 pushed to stack | 971 // v9 pushed to stack |
1094 v9 = v2->vPosition.y - this->vPosition.y; | 972 v9 = pActors[i].vPosition.y - this->vPosition.y; |
1095 | 973 |
1096 //.text:0046BF40 movsx eax, word ptr [esi-6] | 974 //.text:0046BF40 movsx eax, word ptr [esi-6] |
1097 //.text:0046BF47 sar eax, 1 | 975 //.text:0046BF47 sar eax, 1 |
1098 //.text:0046BF49 add eax, ecx | 976 //.text:0046BF49 add eax, ecx |
1099 //.text:0046BF4B sub eax, [edi+0Ch] | 977 //.text:0046BF4B sub eax, [edi+0Ch] |
1100 //.text:0046BF4E mov [ebp+var_8], eax | 978 //.text:0046BF4E mov [ebp+var_8], eax |
1101 //.text:0046BF51 fild [ebp+var_8] | 979 //.text:0046BF51 fild [ebp+var_8] |
1102 //.text:0046BF58 fld st | 980 //.text:0046BF58 fld st |
1103 // v10 pushed to stack, two times | 981 // v10 pushed to stack, two times |
1104 v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y; | 982 v10 = pActors[i].uActorHeight / 2 + pActors[i].vPosition.z - this->vVelocity.y; |
1105 | 983 |
1106 //.text:0046BF54 movsx eax, word ptr [esi-8] | 984 //.text:0046BF54 movsx eax, word ptr [esi-8] |
1107 //.text:0046BF5A add eax, 100h | 985 //.text:0046BF5A add eax, 100h |
1108 //.text:0046BF63 mov ecx, eax | 986 //.text:0046BF63 mov ecx, eax |
1109 v11 = this->vVelocity.x; | 987 //v11 = this->vVelocity.x; |
1110 | 988 |
1111 //.text:0046BF5F fmul st, st(1) | 989 //.text:0046BF5F fmul st, st(1) |
1112 // stack: v10*v10, v10, v9, v7 | 990 // stack: v10*v10, v10, v9, v7 |
1113 //.text:0046BF61 fld st(2) | 991 //.text:0046BF61 fld st(2) |
1114 // stack: v7, v10*v10, v10, v9, v7 | 992 // stack: v7, v10*v10, v10, v9, v7 |
1116 | 994 |
1117 //.text:0046BF65 fmul st, st(3) | 995 //.text:0046BF65 fmul st, st(3) |
1118 // stack: v7*v9, v10*v10, v10, v9, v7 | 996 // stack: v7*v9, v10*v10, v10, v9, v7 |
1119 | 997 |
1120 //.text:0046BF67 imul ecx, eax | 998 //.text:0046BF67 imul ecx, eax |
1121 v11 = v11 * v11; | 999 v11 = this->vVelocity.x * this->vVelocity.x; |
1122 | 1000 |
1123 //.text:0046BF6A faddp st(1), st | 1001 //.text:0046BF6A faddp st(1), st |
1124 // stack: v10*v10+v7*v9, v10, v9, v7 | 1002 // stack: v10*v10+v7*v9, v10, v9, v7 |
1125 //.text:0046BF6C fld st(3) | 1003 //.text:0046BF6C fld st(3) |
1126 // stack: v7, v10*v10+v7*v9, v10, v9, v7 | 1004 // stack: v7, v10*v10+v7*v9, v10, v9, v7 |
1146 | 1024 |
1147 //.text:0046BF80 test ah, 41h | 1025 //.text:0046BF80 test ah, 41h |
1148 //.text:0046BF83 fstp st | 1026 //.text:0046BF83 fstp st |
1149 //.text:0046BF85 jnz short loc_46BFDD | 1027 //.text:0046BF85 jnz short loc_46BFDD |
1150 | 1028 |
1151 if ( v11 >= v10*v10+v7*v9+v7*v7 ) | 1029 if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 ) |
1152 { | 1030 { |
1153 if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) | 1031 if ( stru_50C198.GetMagicalResistance(&pActors[i], 0xAu) ) |
1154 { | 1032 { |
1155 v2->pActorBuffs[v1->spell_id].Apply( | 1033 pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335), |
1156 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335), | 1034 this->spell_skill, 4, 0, 0); |
1157 v1->spell_skill, | 1035 HIWORD(pActors[i].uAttributes) |= 8; |
1158 4u, | |
1159 0, | |
1160 0); | |
1161 HIWORD(v2->uAttributes) |= 8u; | |
1162 } | 1036 } |
1163 } | 1037 } |
1164 } | 1038 } |
1165 ++v6; | 1039 } |
1166 ++v2; | |
1167 } | |
1168 while ( v6 < (signed int)uNumActors ); | |
1169 } | 1040 } |
1170 } | 1041 } |