comparison SpriteObject.cpp @ 1588:e6ac4919b22c

Слияние
author Ritor1
date Mon, 09 Sep 2013 09:13:40 +0600
parents 9a6567c6c76c
children 2d9c8f609a3c
comparison
equal deleted inserted replaced
1587:b42e6f35e03d 1588:e6ac4919b22c
1 #include <assert.h>
2
3 #include "BSPModel.h" 1 #include "BSPModel.h"
4 #include "SpriteObject.h" 2 #include "SpriteObject.h"
5 #include "Party.h" 3 #include "Party.h"
6 #include "TurnEngine.h" 4 #include "TurnEngine.h"
7 #include "MapInfo.h" 5 #include "MapInfo.h"
310 v12 = v1->vPosition.x; 308 v12 = v1->vPosition.x;
311 v1->vPosition.z = v8; 309 v1->vPosition.z = v8;
312 ODM_GetTerrainNormalAt(v12, v11, &v51); 310 ODM_GetTerrainNormalAt(v12, v11, &v51);
313 v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); 311 v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
314 v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16; 312 v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16;
315 v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); 313 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
316 v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16; 314 v1->vVelocity.x += fixpoint_sub0(v56, v51.x);
317 v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); 315 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
318 v1->vVelocity.y += (unsigned int)(v56 * v51.y) >> 16; 316 v1->vVelocity.y += fixpoint_sub0(v56, v51.y);
319 v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16); 317 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
320 v1->vVelocity.z += (unsigned int)(v56 * v51.z) >> 16; 318 v1->vVelocity.z += fixpoint_sub0(v56, v51.z);
321 LABEL_12: 319 LABEL_12:
322 v7 = v54; 320 v7 = v54;
323 goto LABEL_13; 321 goto LABEL_13;
324 } 322 }
325 if ( v10 & 0x40 ) 323 if ( v10 & 0x40 )
395 { 393 {
396 LABEL_92: 394 LABEL_92:
397 stru_721530.field_0 = 0; 395 stru_721530.field_0 = 0;
398 v55 = 0; 396 v55 = 0;
399 stru_721530.prolly_normal_d = v2->uRadius; 397 stru_721530.prolly_normal_d = v2->uRadius;
400 stru_721530.field_C = v2->uHeight; 398 stru_721530.height = v2->uHeight;
401 stru_721530.field_8 = 0; 399 stru_721530.field_8_radius = 0;
402 stru_721530.field_70 = 0; 400 stru_721530.field_70 = 0;
403 while ( 1 ) 401 while ( 1 )
404 { 402 {
405 stru_721530.field_34.x = v1->vPosition.x; 403 stru_721530.position.x = v1->vPosition.x;
406 stru_721530.normal.x = stru_721530.field_34.x; 404 stru_721530.normal.x = stru_721530.position.x;
407 v15 = v1->vPosition.y; 405 v15 = v1->vPosition.y;
408 stru_721530.uSectorID = 0; 406 stru_721530.uSectorID = 0;
409 stru_721530.field_34.y = v15; 407 stru_721530.position.y = v15;
410 stru_721530.normal.y = v15; 408 stru_721530.normal.y = v15;
411 stru_721530.field_34.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1; 409 stru_721530.position.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
412 stru_721530.normal.z = stru_721530.field_34.z; 410 stru_721530.normal.z = stru_721530.position.z;
413 stru_721530.field_1C = v1->vVelocity.x; 411 stru_721530.velocity.x = v1->vVelocity.x;
414 stru_721530.field_20 = v1->vVelocity.y; 412 stru_721530.velocity.y = v1->vVelocity.y;
415 stru_721530.field_24 = v1->vVelocity.z; 413 stru_721530.velocity.z = v1->vVelocity.z;
416 if ( stru_721530._47050A(0) ) 414 if ( stru_721530._47050A(0) )
417 return; 415 return;
418 _46E889_collide_against_bmodels(0); 416 _46E889_collide_against_bmodels(0);
419 v16 = WorldPosToGridCellZ(v1->vPosition.y); 417 v16 = WorldPosToGridCellZ(v1->vPosition.y);
420 v18 = WorldPosToGridCellX(v1->vPosition.x); 418 v18 = WorldPosToGridCellX(v1->vPosition.x);
502 Dst.flt_28 = 1.0; 500 Dst.flt_28 = 1.0;
503 pGame->pParticleEngine->AddParticle(&Dst); 501 pGame->pParticleEngine->AddParticle(&Dst);
504 } 502 }
505 return; 503 return;
506 } 504 }
507 v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); 505 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
508 v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 506 v1->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
509 v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); 507 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
510 v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 508 v1->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
511 v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); 509 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
512 v28 = LOWORD(stru_721530.uSectorID); 510 v28 = LOWORD(stru_721530.uSectorID);
513 v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 511 v1->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
514 v29 = v1->vPosition.z; 512 v29 = v1->vPosition.z;
515 v1->uSectorID = v28; 513 v1->uSectorID = v28;
516 stru_721530.field_70 += stru_721530.field_7C; 514 stru_721530.field_70 += stru_721530.field_7C;
517 if ( v2->uFlags & OBJECT_DESC_INTERACTABLE ) 515 if ( v2->uFlags & OBJECT_DESC_INTERACTABLE )
518 { 516 {
530 v32 = &v31->pFaces[v30 & 0x3F]; 528 v32 = &v31->pFaces[v30 & 0x3F];
531 if ( v32->uPolygonType != 3 ) 529 if ( v32->uPolygonType != 3 )
532 { 530 {
533 v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y 531 v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y
534 + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16; 532 + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16;
535 if ( stru_721530.field_64 >> 3 > v56 ) 533 if ( (stru_721530.speed >> 3) > v56 )
536 v56 = stru_721530.field_64 >> 3; 534 v56 = stru_721530.speed >> 3;
537 v57 = v32->pFacePlane.vNormal.x; 535 v57 = v32->pFacePlane.vNormal.x;
538 v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16; 536 v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16;
539 v58 = v32->pFacePlane.vNormal.y; 537 v58 = v32->pFacePlane.vNormal.y;
540 v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16; 538 v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16;
541 v60 = v32->pFacePlane.vNormal.z; 539 v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16);
542 v60 = ((unsigned __int64)(v56 * (signed __int64)(signed int)v60) >> 16);
543 v1->vVelocity.x += 2 * v57; 540 v1->vVelocity.x += 2 * v57;
544 v1->vVelocity.y += 2 * v58; 541 v1->vVelocity.y += 2 * v58;
545 if ( v32->pFacePlane.vNormal.z <= 32000 ) 542 if ( v32->pFacePlane.vNormal.z <= 32000 )
546 { 543 {
547 v37 = 2 * (short)v60; 544 v37 = 2 * (short)v60;
612 BLVFace *v7; // eax@11 609 BLVFace *v7; // eax@11
613 signed int v8; // ebx@12 610 signed int v8; // ebx@12
614 int v9; // ecx@16 611 int v9; // ecx@16
615 __int16 v10; // di@18 612 __int16 v10; // di@18
616 char v11; // al@19 613 char v11; // al@19
617 int v12; // eax@25 614 //int v12; // eax@25
618 int v13; // eax@31 615 int v13; // eax@31
619 int v14; // ebx@34 616 int v14; // ebx@34
620 signed int v15; // ebx@46 617 signed int v15; // ebx@46
621 BLVFace *v16; // edi@48 618 BLVFace *v16; // edi@48
622 int v17; // eax@50 619 int v17; // eax@50
671 v8 = 0; 668 v8 = 0;
672 LABEL_25: 669 LABEL_25:
673 stru_721530.field_0 = v8; 670 stru_721530.field_0 = v8;
674 uFaceID = v8; 671 uFaceID = v8;
675 stru_721530.prolly_normal_d = pObject->uRadius; 672 stru_721530.prolly_normal_d = pObject->uRadius;
676 v12 = pObject->uHeight; 673
677 stru_721530.field_84 = -1; 674 stru_721530.field_84 = -1;
678 stru_721530.field_C = v12; 675 stru_721530.height = pObject->uHeight;
679 stru_721530.field_8 = v8; 676 stru_721530.field_8_radius = v8;
680 stru_721530.field_70 = v8; 677 stru_721530.field_70 = v8;
681 while ( 1 ) 678 while ( 1 )
682 { 679 {
683 stru_721530.field_34.x = pSpriteObject->vPosition.x; 680 stru_721530.position.x = pSpriteObject->vPosition.x;
684 stru_721530.normal.x = stru_721530.field_34.x; 681 stru_721530.normal.x = stru_721530.position.x;
685 stru_721530.field_34.y = pSpriteObject->vPosition.y; 682 stru_721530.position.y = pSpriteObject->vPosition.y;
686 stru_721530.normal.y = stru_721530.field_34.y; 683 stru_721530.normal.y = stru_721530.position.y;
687 stru_721530.field_34.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1; 684 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
688 stru_721530.normal.z = stru_721530.field_34.z; 685 stru_721530.normal.z = stru_721530.position.z;
689 stru_721530.field_1C = pSpriteObject->vVelocity.x; 686 stru_721530.velocity.x = pSpriteObject->vVelocity.x;
690 stru_721530.field_20 = pSpriteObject->vVelocity.y; 687 stru_721530.velocity.y = pSpriteObject->vVelocity.y;
691 stru_721530.field_24 = pSpriteObject->vVelocity.z; 688 stru_721530.velocity.z = pSpriteObject->vVelocity.z;
692 stru_721530.uSectorID = pSpriteObject->uSectorID; 689 stru_721530.uSectorID = pSpriteObject->uSectorID;
693 if ( stru_721530._47050A(v8) ) 690 if ( stru_721530._47050A(v8) )
694 return; 691 return;
695 v40 = v8; 692 v40 = v8;
696 do 693 do
786 Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34); 783 Dst.uTextureID = pBitmaps_LOD->LoadTexture(v32, v34);
787 Dst.flt_28 = 1.0; 784 Dst.flt_28 = 1.0;
788 pGame->pParticleEngine->AddParticle(&Dst); 785 pGame->pParticleEngine->AddParticle(&Dst);
789 return; 786 return;
790 } 787 }
791 v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 788 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
792 pSpriteObject->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 789 pSpriteObject->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
793 v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 790 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
794 pSpriteObject->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 791 pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
795 v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 792 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
796 pSpriteObject->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 793 pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
797 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); 794 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
798 stru_721530.field_70 += stru_721530.field_7C; 795 stru_721530.field_70 += stru_721530.field_7C;
799 if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) 796 if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
800 return; 797 return;
801 v15 = (signed int)stru_721530.uFaceID >> 3; 798 v15 = (signed int)stru_721530.uFaceID >> 3;
822 v16 = &pIndoor->pFaces[v15]; 819 v16 = &pIndoor->pFaces[v15];
823 if ( v16->uPolygonType != 3 ) 820 if ( v16->uPolygonType != 3 )
824 { 821 {
825 v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z 822 v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z
826 + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; 823 + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16;
827 if ( stru_721530.field_64 >> 3 > v42 ) 824 if ( (stru_721530.speed >> 3) > v42 )
828 v42 = stru_721530.field_64 >> 3; 825 v42 = stru_721530.speed >> 3;
829 v40 = v16->pFacePlane_old.vNormal.x; 826 v40 = v16->pFacePlane_old.vNormal.x;
830 v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; 827 v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16;
831 v41 = v16->pFacePlane_old.vNormal.y; 828 v41 = v16->pFacePlane_old.vNormal.y;
832 v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; 829 v41 = (unsigned __int64)(v42 * (signed __int64)v41) >> 16;
833 v39 = v16->pFacePlane_old.vNormal.z; 830 v39 = v16->pFacePlane_old.vNormal.z;