Mercurial > mm7
comparison Indoor.cpp @ 472:7dfe960c323c
BLV_UpdateDoors
author | Nomad |
---|---|
date | Tue, 26 Feb 2013 05:00:40 +0200 |
parents | 0dbf780e247f |
children | 7887a9cf9e7b |
comparison
equal
deleted
inserted
replaced
471:c43f156a95c9 | 472:7dfe960c323c |
---|---|
3480 | 3480 |
3481 | 3481 |
3482 //----- (0046F228) -------------------------------------------------------- | 3482 //----- (0046F228) -------------------------------------------------------- |
3483 void __cdecl BLV_UpdateDoors() | 3483 void __cdecl BLV_UpdateDoors() |
3484 { | 3484 { |
3485 int v0; // ebx@1 | 3485 //int v0; // ebx@1 |
3486 int v1; // edi@1 | 3486 //int v1; // edi@1 |
3487 BLVDoor *v2; // esi@3 | 3487 //BLVDoor *v2; // esi@3 |
3488 unsigned __int16 v3; // ax@3 | 3488 //unsigned __int16 v3; // ax@3 |
3489 unsigned int v4; // ecx@5 | 3489 //unsigned int v4; // ecx@5 |
3490 int v5; // eax@8 | 3490 //int v5; // eax@8 |
3491 int v6; // ecx@8 | 3491 //int v6; // ecx@8 |
3492 int v7; // eax@12 | 3492 //int v7; // eax@12 |
3493 int v8; // eax@16 | 3493 //int v8; // eax@16 |
3494 unsigned __int8 v9; // zf@18 | 3494 //unsigned __int8 v9; // zf@18 |
3495 char v10; // sf@18 | 3495 //char v10; // sf@18 |
3496 unsigned __int8 v11; // of@18 | 3496 //unsigned __int8 v11; // of@18 |
3497 int v12; // edi@19 | 3497 //int v12; // edi@19 |
3498 int v13; // ecx@19 | 3498 //int v13; // ecx@19 |
3499 __int16 v14; // ax@19 | 3499 //__int16 v14; // ax@19 |
3500 BLVFace *v15; // ebx@24 | 3500 BLVFace *v15; // ebx@24 |
3501 unsigned __int16 *v16; // ecx@24 | 3501 //unsigned __int16 *v16; // ecx@24 |
3502 Vec3_short_ *v17; // esi@24 | 3502 Vec3_short_ *v17; // esi@24 |
3503 int v18; // eax@24 | 3503 int v18; // eax@24 |
3504 int v19; // edx@24 | 3504 int v19; // edx@24 |
3505 signed int v20; // eax@24 | 3505 signed int v20; // eax@24 |
3506 Vec3_short_ *v21; // ecx@24 | 3506 //Vec3_short_ *v21; // ecx@24 |
3507 double v22; // st7@24 | 3507 //double v22; // st7@24 |
3508 double v23; // st6@24 | 3508 //double v23; // st6@24 |
3509 int v24; // esi@25 | 3509 int v24; // esi@25 |
3510 int v25; // eax@25 | 3510 int v25; // eax@25 |
3511 BLVDoor *v26; // edi@25 | 3511 //BLVDoor *v26; // edi@25 |
3512 signed __int64 v27; // qtt@27 | 3512 signed __int64 v27; // qtt@27 |
3513 BLVFaceExtra *v28; // esi@32 | 3513 BLVFaceExtra *v28; // esi@32 |
3514 int v29; // ecx@34 | 3514 int v29; // ecx@34 |
3515 int v30; // edx@34 | 3515 int v30; // edx@34 |
3516 unsigned __int64 v31; // qax@34 | 3516 unsigned __int64 v31; // qax@34 |
3517 int v32; // eax@34 | 3517 int v32; // eax@34 |
3518 unsigned __int16 *v33; // eax@35 | 3518 //unsigned __int16 *v33; // eax@35 |
3519 Vec3_short_ *v34; // eax@35 | 3519 Vec3_short_ *v34; // eax@35 |
3520 int v35; // ecx@35 | 3520 int v35; // ecx@35 |
3521 int v36; // edx@35 | 3521 int v36; // edx@35 |
3522 signed int v37; // eax@35 | 3522 signed int v37; // eax@35 |
3523 signed int v38; // edx@35 | 3523 signed int v38; // edx@35 |
3524 int v39; // eax@35 | 3524 int v39; // eax@35 |
3525 int v40; // edx@35 | 3525 int v40; // edx@35 |
3526 unsigned __int8 v41; // cf@35 | 3526 //unsigned __int8 v41; // cf@35 |
3527 unsigned __int16 *v42; // edi@36 | 3527 //unsigned __int16 *v42; // edi@36 |
3528 Vec3_short_ *v43; // edi@36 | 3528 Vec3_short_ *v43; // edi@36 |
3529 int v44; // ecx@36 | 3529 //int v44; // ecx@36 |
3530 int v45; // edi@36 | 3530 //int v45; // edi@36 |
3531 int v46; // ecx@36 | 3531 //int v46; // ecx@36 |
3532 __int16 *v47; // edx@44 | 3532 //__int16 *v47; // edx@44 |
3533 int v48; // ecx@44 | 3533 //int v48; // ecx@44 |
3534 unsigned int v49; // ecx@46 | 3534 unsigned int v49; // ecx@46 |
3535 unsigned __int16 v50; // ax@48 | 3535 unsigned __int16 v50; // ax@48 |
3536 unsigned int v51; // eax@51 | 3536 unsigned int v51; // eax@51 |
3537 unsigned __int16 v52; // ax@54 | 3537 unsigned __int16 v52; // ax@54 |
3538 int v53; // ecx@57 | 3538 int v53; // ecx@57 |
3539 int v54; // edx@57 | 3539 //int v54; // edx@57 |
3540 unsigned __int64 v55; // qax@57 | 3540 unsigned __int64 v55; // qax@57 |
3541 int v56; // ecx@58 | 3541 int v56; // ecx@58 |
3542 int v57; // eax@58 | 3542 int v57; // eax@58 |
3543 int v58; // eax@59 | 3543 //int v58; // eax@59 |
3544 SoundID v59; // [sp-24h] [bp-88h]@12 | 3544 //SoundID v59; // [sp-24h] [bp-88h]@12 |
3545 signed int v60; // [sp-20h] [bp-84h]@12 | 3545 //signed int v60; // [sp-20h] [bp-84h]@12 |
3546 unsigned int v61; // [sp-1Ch] [bp-80h]@12 | 3546 //unsigned int v61; // [sp-1Ch] [bp-80h]@12 |
3547 signed int v62; // [sp-18h] [bp-7Ch]@12 | 3547 //signed int v62; // [sp-18h] [bp-7Ch]@12 |
3548 signed int v63; // [sp-14h] [bp-78h]@12 | 3548 //signed int v63; // [sp-14h] [bp-78h]@12 |
3549 int v64; // [sp-10h] [bp-74h]@12 | 3549 //int v64; // [sp-10h] [bp-74h]@12 |
3550 unsigned int v65; // [sp-Ch] [bp-70h]@12 | 3550 //unsigned int v65; // [sp-Ch] [bp-70h]@12 |
3551 int v66; // [sp-8h] [bp-6Ch]@12 | 3551 //int v66; // [sp-8h] [bp-6Ch]@12 |
3552 int v67; // [sp+8h] [bp-5Ch]@31 | 3552 Vec3_int_ v67; |
3553 int v68; // [sp+Ch] [bp-58h]@34 | 3553 //int v67; // [sp+8h] [bp-5Ch]@31 |
3554 int v69; // [sp+10h] [bp-54h]@34 | 3554 //int v68; // [sp+Ch] [bp-58h]@34 |
3555 int v70; // [sp+14h] [bp-50h]@31 | 3555 //int v69; // [sp+10h] [bp-54h]@34 |
3556 int v71; // [sp+18h] [bp-4Ch]@34 | 3556 Vec3_int_ v70; |
3557 int v72; // [sp+1Ch] [bp-48h]@34 | 3557 //int v70; // [sp+14h] [bp-50h]@31 |
3558 //int v71; // [sp+18h] [bp-4Ch]@34 | |
3559 //int v72; // [sp+1Ch] [bp-48h]@34 | |
3558 int v73; // [sp+20h] [bp-44h]@24 | 3560 int v73; // [sp+20h] [bp-44h]@24 |
3559 __int16 v74; // [sp+24h] [bp-40h]@24 | 3561 //__int16 v74; // [sp+24h] [bp-40h]@24 |
3560 int v75; // [sp+28h] [bp-3Ch]@36 | 3562 int v75; // [sp+28h] [bp-3Ch]@36 |
3561 int v76; // [sp+2Ch] [bp-38h]@36 | 3563 int v76; // [sp+2Ch] [bp-38h]@36 |
3562 int v77; // [sp+30h] [bp-34h]@36 | 3564 int v77; // [sp+30h] [bp-34h]@36 |
3563 int v78; // [sp+34h] [bp-30h]@36 | 3565 //int v78; // [sp+34h] [bp-30h]@36 |
3564 int v79; // [sp+38h] [bp-2Ch]@19 | 3566 //int v79; // [sp+38h] [bp-2Ch]@19 |
3565 unsigned int v80; // [sp+3Ch] [bp-28h]@2 | 3567 //unsigned int v80; // [sp+3Ch] [bp-28h]@2 |
3566 int v81; // [sp+40h] [bp-24h]@1 | 3568 //int v81; // [sp+40h] [bp-24h]@1 |
3567 int v82; // [sp+44h] [bp-20h]@35 | 3569 int v82; // [sp+44h] [bp-20h]@35 |
3568 int v83; // [sp+48h] [bp-1Ch]@34 | 3570 int v83; // [sp+48h] [bp-1Ch]@34 |
3569 int v84; // [sp+4Ch] [bp-18h]@34 | 3571 int v84; // [sp+4Ch] [bp-18h]@34 |
3570 int v85; // [sp+50h] [bp-14h]@19 | 3572 int v85; // [sp+50h] [bp-14h]@19 |
3571 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 | 3573 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 |
3572 BLVDoor *v87; // [sp+58h] [bp-Ch]@3 | 3574 //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 |
3573 int v88; // [sp+5Ch] [bp-8h]@18 | 3575 int v88; // [sp+5Ch] [bp-8h]@18 |
3574 int v89; // [sp+60h] [bp-4h]@6 | 3576 int v89; // [sp+60h] [bp-4h]@6 |
3575 | 3577 |
3576 v0 = 0; | 3578 //v0 = 0; |
3577 v1 = 0; | 3579 //v1 = 0; |
3578 eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; | 3580 eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; |
3579 v81 = 0; | 3581 //v81 = 0; |
3580 if ( pIndoor->uNumDoors > 0 ) | 3582 //if ( pIndoor->uNumDoors > 0 ) |
3581 { | 3583 for (uint i = 0; i < pIndoor->uNumDoors; ++i) |
3582 v80 = 0; | 3584 { |
3583 do | 3585 auto door = pIndoor->pDoors + i; |
3584 { | 3586 //v80 = 0; |
3585 v2 = &pIndoor->pDoors[v80 / 0x50]; | 3587 //do |
3586 v87 = &pIndoor->pDoors[v80 / 0x50]; | 3588 //{ |
3587 v3 = pIndoor->pDoors[v80 / 0x50].uState; | 3589 //v2 = &pIndoor->pDoors[v80 / 0x50]; |
3588 if ( v3 == (short)v0 || v3 == 2 ) | 3590 //v87 = &pIndoor->pDoors[v80 / 0x50]; |
3589 { | 3591 //v3 = door->uState; |
3590 v2->uAttributes &= 0xFFFFFFFDu; | 3592 if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) |
3593 { | |
3594 door->uAttributes &= 0xFFFFFFFDu; | |
3591 goto LABEL_62; | 3595 goto LABEL_62; |
3592 } | 3596 } |
3593 v2->uTimeSinceTriggered += pEventTimer->uTimeElapsed; | 3597 door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; |
3594 v4 = v2->uTimeSinceTriggered; | 3598 //v4 = door->uTimeSinceTriggered; |
3595 if ( v2->uState == 1 ) | 3599 if (door->uState == BLVDoor::Opening) |
3596 { | 3600 { |
3597 v89 = (signed int)(v4 * v2->uCloseSpeed) / 128; | 3601 v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; |
3598 if ( v89 >= v2->uMoveLength ) | 3602 if ( v89 >= door->uMoveLength ) |
3599 { | 3603 { |
3600 v89 = v2->uMoveLength; | 3604 v89 = door->uMoveLength; |
3601 v2->uState = BLVDoor::Open; | 3605 door->uState = BLVDoor::Open; |
3602 LABEL_10: | 3606 LABEL_10: |
3603 if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) | 3607 if ( !(door->uAttributes & 6) && door->uNumVertices != 0) |
3604 { | 3608 { |
3605 v66 = v0; | 3609 //v66 = 0; |
3606 v65 = v0; | 3610 //v65 = 0; |
3607 v64 = v0; | 3611 //v64 = 0; |
3608 v7 = 8 * v1; | 3612 //v7 = 8 * i | OBJECT_BLVDoor; |
3609 v63 = v0; | 3613 //v63 = 0; |
3610 v62 = -1; | 3614 //v62 = -1; |
3611 LOBYTE(v7) = 8 * v1 | 1; | 3615 //LOBYTE(v7) = 8 * i | OBJECT_BLVDoor; |
3612 v61 = v0; | 3616 //v61 = 0; |
3613 v60 = v7; | 3617 //v60 = 8 * i | OBJECT_BLVDoor; |
3614 v59 = (SoundID)((int)eDoorSoundID + 1); | 3618 //v59 = (SoundID)((int)eDoorSoundID + 1); |
3615 LABEL_17: | 3619 //LABEL_17: |
3616 pAudioPlayer->PlaySound(v59, v60, v61, v62, v63, v64, v65, v66); | 3620 pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), 8 * i | OBJECT_BLVDoor, 0, -1, 0, 0, 0, 0); |
3617 goto LABEL_18; | 3621 //goto LABEL_18; |
3618 } | 3622 } |
3619 goto LABEL_18; | 3623 goto LABEL_18; |
3620 } | 3624 } |
3621 } | 3625 } |
3622 else | 3626 else |
3623 { | 3627 { |
3624 v5 = (signed int)(v4 * v2->uOpenSpeed) / 128; | 3628 auto v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; |
3625 v6 = v2->uMoveLength; | 3629 //v6 = door->uMoveLength; |
3626 if ( v5 >= v6 ) | 3630 if ( v5 >= door->uMoveLength) |
3627 { | 3631 { |
3628 v89 = v0; | 3632 v89 = 0; |
3629 v2->uState = (BLVDoor::State)v0; | 3633 door->uState = BLVDoor::Closed; |
3630 goto LABEL_10; | 3634 goto LABEL_10; |
3631 } | 3635 } |
3632 v89 = v6 - v5; | 3636 v89 = door->uMoveLength - v5; |
3633 } | 3637 } |
3634 if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) | 3638 if ( !(door->uAttributes & 6) && door->uNumVertices) |
3635 { | 3639 { |
3636 v66 = v0; | 3640 //v66 = 0; |
3637 v65 = v0; | 3641 //v65 = 0; |
3638 v64 = v0; | 3642 //v64 = 0; |
3639 v8 = 8 * v1; | 3643 //v8 = 8 * i | OBJECT_BLVDoor; |
3640 v63 = v0; | 3644 //v63 = 0; |
3641 v62 = -1; | 3645 //v62 = -1; |
3642 LOBYTE(v8) = 8 * v1 | 1; | 3646 //LOBYTE(v8) = 8 * v1 | 1; |
3643 v61 = 1; | 3647 //v61 = 1; |
3644 v60 = v8; | 3648 //v60 = 8 * i | OBJECT_BLVDoor; |
3645 v59 = eDoorSoundID; | 3649 //v59 = eDoorSoundID; |
3646 goto LABEL_17; | 3650 pAudioPlayer->PlaySound(eDoorSoundID, 8 * i | OBJECT_BLVDoor, 1, -1, 0, 0, 0, 0); |
3651 //goto LABEL_18; | |
3647 } | 3652 } |
3648 LABEL_18: | 3653 LABEL_18: |
3649 v11 = __OFSUB__(v2->uNumVertices, (short)v0); | 3654 //v11 = __OFSUB__(v2->uNumVertices, 0); |
3650 v9 = v2->uNumVertices == (short)v0; | 3655 //v9 = v2->uNumVertices == 0; |
3651 v10 = (signed __int16)(v2->uNumVertices - v0) < 0; | 3656 //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; |
3652 v88 = v0; | 3657 //v88 = 0; |
3653 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) | 3658 //if (door->uNumVertices > 0) |
3654 { | 3659 for (uint j = 0; j < door->uNumVertices; ++j) |
3655 do | 3660 { |
3656 { | 3661 //do |
3657 v12 = v88; | 3662 //{ |
3658 v13 = v2->pVertexIDs[v88]; | 3663 //v12 = v88; |
3659 v85 = v89; | 3664 //v13 = door->pVertexIDs[v88]; |
3660 v79 = v2->vDirection.x; | 3665 //v85 = v89; |
3661 v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | 3666 //v79 = door->vDirection.x; |
3662 v13 *= 6; | 3667 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3663 *(__int16 *)((char *)&pIndoor->pVertices->x + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pXOffsets[v88]; | 3668 //v13 *= 6; |
3664 v85 = v89; | 3669 pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; |
3665 v79 = v2->vDirection.y; | 3670 //v85 = v89; |
3666 v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | 3671 //v79 = door->vDirection.y; |
3667 *(__int16 *)((char *)&pIndoor->pVertices->y + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pYOffsets[v12]; | 3672 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3668 v85 = v89; | 3673 pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; |
3669 v79 = v2->vDirection.z; | 3674 //v85 = v89; |
3670 v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | 3675 //v79 = door->vDirection.z; |
3671 v14 = ((unsigned int)(v79 * v89) >> 16) + v2->pZOffsets[v12]; | 3676 //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3672 ++v88; | 3677 //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; |
3673 *(__int16 *)((char *)&pIndoor->pVertices->z + v13) = v14; | 3678 pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; |
3674 } | 3679 //++v88; |
3675 while ( v88 < v2->uNumVertices ); | 3680 //} |
3676 v1 = v81; | 3681 //while ( v88 < door->uNumVertices ); |
3677 } | 3682 //v1 = v81; |
3678 v11 = __OFSUB__(v2->uNumFaces, (short)v0); | 3683 } |
3679 v9 = v2->uNumFaces == (short)v0; | 3684 //v11 = __OFSUB__(v2->uNumFaces, 0); |
3680 v10 = (signed __int16)(v2->uNumFaces - v0) < 0; | 3685 //v9 = v2->uNumFaces == 0; |
3681 v88 = v0; | 3686 //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; |
3682 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) | 3687 v88 = 0; |
3688 if (door->uNumFaces > 0) | |
3683 { | 3689 { |
3684 while ( 1 ) | 3690 while ( 1 ) |
3685 { | 3691 { |
3686 v15 = &pIndoor->pFaces[v2->pFaceIDs[v88]]; | 3692 v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; |
3687 v16 = v15->pVertexIDs; | 3693 //v16 = v15->pVertexIDs; |
3688 v17 = &pIndoor->pVertices[*v16]; | 3694 v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
3689 v18 = v15->pFacePlane_old.vNormal.y; | 3695 v18 = v15->pFacePlane_old.vNormal.y; |
3690 v73 = *(int *)&v17->x; | 3696 v73 = *(int *)&v17->x; |
3691 v74 = v17->z; | 3697 //v74 = v17->z; |
3692 v19 = v15->pFacePlane_old.vNormal.z; | 3698 v19 = v15->pFacePlane_old.vNormal.z; |
3693 v20 = -(v19 * v74 + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); | 3699 v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); |
3694 v15->pFacePlane_old.dist = v20; | 3700 v15->pFacePlane_old.dist = v20; |
3695 v21 = &pIndoor->pVertices[*v16]; | 3701 //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
3696 v79 = v21->x; | 3702 //v79 = v21->x; |
3697 v22 = (double)v79; | 3703 //v22 = (double)v21->x; |
3698 v23 = (double)v21->y; | 3704 //v23 = (double)v21->y; |
3699 v79 = v21->z; | 3705 //v79 = v21->z; |
3700 v15->pFacePlane.dist = -((double)v79 * v15->pFacePlane.vNormal.z | 3706 v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z |
3701 + v23 * v15->pFacePlane.vNormal.y | 3707 + (double)v17->y * v15->pFacePlane.vNormal.y |
3702 + v22 * v15->pFacePlane.vNormal.x); | 3708 + (double)v17->x * v15->pFacePlane.vNormal.x); |
3703 if ( v19 ) | 3709 if ( v19 ) |
3704 { | 3710 { |
3705 v24 = abs(v20 >> 15); | 3711 v24 = abs(v20 >> 15); |
3706 v25 = abs(v15->pFacePlane_old.vNormal.z); | 3712 v25 = abs(v15->pFacePlane_old.vNormal.z); |
3707 v26 = v87; | 3713 //v26 = v87; |
3708 if ( v24 > v25 ) | 3714 if ( v24 > v25 ) |
3709 Abortf( | 3715 Abortf( |
3710 "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", | 3716 "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", |
3711 v87->uDoorID, | 3717 door->uDoorID, |
3712 v87->pFaceIDs[v88], | 3718 door->pFaceIDs[v88], |
3713 v15->pFacePlane_old.dist, | 3719 v15->pFacePlane_old.dist, |
3714 v15->pFacePlane_old.vNormal.z); | 3720 v15->pFacePlane_old.vNormal.z); |
3715 v79 = v15->pFacePlane_old.vNormal.z; | 3721 //v79 = v15->pFacePlane_old.vNormal.z; |
3716 v85 = v15->pFacePlane_old.dist; | 3722 //v85 = v15->pFacePlane_old.dist; |
3717 LODWORD(v27) = v85 << 16; | 3723 LODWORD(v27) = v15->pFacePlane_old.dist << 16; |
3718 HIDWORD(v27) = v85 >> 16; | 3724 HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; |
3719 v85 = v27 / v79; | 3725 //v85 = v27 / v15->pFacePlane_old.vNormal.z; |
3720 v15->zCalc3 = -(v27 / v79); | 3726 v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; |
3721 } | 3727 } |
3722 else | 3728 /*else |
3723 { | 3729 { |
3724 v26 = v87; | 3730 v26 = v87; |
3725 } | 3731 }*/ |
3726 if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) | 3732 if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) |
3727 v15->_get_normals((Vec3_int_ *)&v70, (Vec3_int_ *)&v67); | 3733 v15->_get_normals(&v70, &v67); |
3728 v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; | 3734 v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; |
3729 if ( !pRenderer->pRenderD3D ) | 3735 if ( !pRenderer->pRenderD3D ) |
3730 { | 3736 { |
3731 if ( !(BYTE2(v15->uAttributes) & 4) ) | 3737 if ( !(BYTE2(v15->uAttributes) & 4) ) |
3732 goto LABEL_59; | 3738 goto LABEL_59; |
3733 v79 = v26->vDirection.x; | 3739 //v79 = door->vDirection.x; |
3734 v83 = (unsigned __int64)(v79 * (signed __int64)v70) >> 16; | 3740 v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; |
3735 v85 = v71; | 3741 //v85 = v71; |
3736 v79 = v26->vDirection.y; | 3742 //v79 = door->vDirection.y; |
3737 v85 = (unsigned __int64)(v79 * (signed __int64)v71) >> 16; | 3743 v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; |
3738 v84 = v72; | 3744 //v84 = v72; |
3739 v79 = v26->vDirection.z; | 3745 //v79 = door->vDirection.z; |
3740 v84 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16; | 3746 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; |
3741 v79 = v83 + v85 + ((unsigned __int64)(v79 * (signed __int64)v72) >> 16); | 3747 //v79 = v83 + v85 + v84; |
3742 v29 = v89; | 3748 v29 = v89; |
3743 v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; | 3749 //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; |
3744 v28->sTextureDeltaU = -((unsigned int)(v79 * v89) >> 16); | 3750 v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; |
3745 v79 = v26->vDirection.x; | 3751 //v79 = door->vDirection.x; |
3746 v85 = (unsigned __int64)(v79 * (signed __int64)v67) >> 16; | 3752 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; |
3747 v83 = v68; | 3753 //v83 = v68; |
3748 v79 = v26->vDirection.y; | 3754 //v79 = door->vDirection.y; |
3749 v83 = (unsigned __int64)(v79 * (signed __int64)v68) >> 16; | 3755 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; |
3750 v84 = v69; | 3756 //v84 = v69; |
3751 v79 = v26->vDirection.z; | 3757 //v79 = door->vDirection.z; |
3752 v84 = (unsigned __int64)(v79 * (signed __int64)v69) >> 16; | 3758 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; |
3753 v30 = v83 + ((unsigned __int64)(v79 * (signed __int64)v69) >> 16); | 3759 //v30 = v83 + v84; |
3754 v79 = v85 + v30; | 3760 //v79 = v85 + v30; |
3755 v31 = (v85 + v30) * (signed __int64)v29; | 3761 v31 = (v85 + v83 + v84) * (signed __int64)v29; |
3756 v83 = v31 >> 16; | 3762 //v83 = v31 >> 16; |
3757 v32 = v31 >> 16; | 3763 v32 = v31 >> 16; |
3758 goto LABEL_58; | 3764 goto LABEL_58; |
3759 } | 3765 } |
3760 v28->sTextureDeltaU = 0; | 3766 v28->sTextureDeltaU = 0; |
3761 v28->sTextureDeltaV = 0; | 3767 v28->sTextureDeltaV = 0; |
3762 v33 = v15->pVertexIDs; | 3768 //v33 = v15->pVertexIDs; |
3763 v85 = 1; | 3769 //v85 = 1; |
3764 v34 = &pIndoor->pVertices[*v33]; | 3770 v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; |
3765 v35 = v34->z; | 3771 v35 = v34->z; |
3766 v36 = v34->y; | 3772 v36 = v34->y; |
3767 v82 = v34->x; | 3773 v82 = v34->x; |
3768 v79 = v36; | 3774 //v79 = v36; |
3769 v37 = v70 * v82 + v71 * v36 + v72 * v35; | 3775 v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; |
3770 v38 = v67 * v82 + v68 * v36 + v35 * v69; | 3776 v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; |
3771 v39 = v37 >> 16; | 3777 v39 = v37 >> 16; |
3772 *v15->pVertexUIDs = v39; | 3778 *v15->pVertexUIDs = v39; |
3773 v40 = v38 >> 16; | 3779 v40 = v38 >> 16; |
3774 *v15->pVertexVIDs = v40; | 3780 *v15->pVertexVIDs = v40; |
3775 v41 = v15->uNumVertices < 1u; | 3781 //v41 = v15->uNumVertices < 1u; |
3776 v9 = v15->uNumVertices == 1; | 3782 //v9 = v15->uNumVertices == 1; |
3777 v83 = v40; | 3783 //v83 = v40; |
3778 v84 = v39; | 3784 v84 = v39; |
3779 v82 = v40; | 3785 v82 = v40; |
3780 if ( !(v41 | v9) ) | 3786 //if (v15->uNumVertices > 1) |
3787 for (uint j = 1; j < v15->uNumVertices; ++j) | |
3781 { | 3788 { |
3782 do | 3789 //do |
3783 { | 3790 //{ |
3784 v42 = v15->pVertexIDs; | 3791 //v42 = v15->pVertexIDs; |
3785 v75 = 2 * v85; | 3792 //v75 = 2 * v85; |
3786 v43 = &pIndoor->pVertices[v42[v85]]; | 3793 v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; |
3787 v79 = v43->z; | 3794 //v79 = v43->z; |
3788 v44 = v43->y; | 3795 //v44 = v43->y; |
3789 v45 = v43->x; | 3796 //v45 = v43->x; |
3790 v78 = v44; | 3797 //v78 = v43->y; |
3791 v76 = (v72 * v79 + v70 * v45 + v71 * v44) >> 16; | 3798 v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; |
3792 v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; | 3799 //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; |
3793 v77 = v46; | 3800 v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; |
3794 if ( v76 < v39 ) | 3801 if ( v76 < v39 ) |
3795 v39 = v76; | 3802 v39 = v76; |
3796 if ( v46 < v40 ) | 3803 if ( v77 < v40 ) |
3797 v83 = v46; | 3804 v40 = v77; |
3798 if ( v76 > v84 ) | 3805 if ( v76 > v84 ) |
3799 v84 = v76; | 3806 v84 = v76; |
3800 if ( v46 > v82 ) | 3807 if ( v77 > v82 ) |
3801 v82 = v46; | 3808 v82 = v77; |
3802 v47 = v15->pVertexUIDs; | 3809 //v40 = v83; |
3803 v48 = v75; | 3810 //v47 = v15->pVertexUIDs; |
3804 ++v85; | 3811 //v48 = v75; |
3805 *(unsigned __int16 *)((char *)v47 + v75) = v76; | 3812 //++v85; |
3806 *(unsigned __int16 *)((char *)v15->pVertexVIDs + v48) = v77; | 3813 v15->pVertexUIDs[j] = v76; |
3807 v40 = v83; | 3814 v15->pVertexVIDs[j] = v77; |
3808 } | 3815 //} |
3809 while ( v85 < v15->uNumVertices ); | 3816 //while ( v85 < v15->uNumVertices ); |
3810 v26 = v87; | 3817 //v26 = v87; |
3811 } | 3818 } |
3812 v49 = v15->uAttributes; | 3819 v49 = v15->uAttributes; |
3813 if ( BYTE1(v49) & 0x10 ) | 3820 if ( BYTE1(v49) & 0x10 ) |
3814 goto LABEL_50; | 3821 goto LABEL_50; |
3815 if ( SBYTE1(v49) < 0 ) | 3822 if ( SBYTE1(v49) < 0 ) |
3834 + *(short *)((signed __int16)v52 != -1 ? 72 * (signed __int16)v52 + 7278780 + 0x1A : 26); | 3841 + *(short *)((signed __int16)v52 != -1 ? 72 * (signed __int16)v52 + 7278780 + 0x1A : 26); |
3835 } | 3842 } |
3836 } | 3843 } |
3837 if ( BYTE2(v15->uAttributes) & 4 ) | 3844 if ( BYTE2(v15->uAttributes) & 4 ) |
3838 { | 3845 { |
3839 v75 = v26->vDirection.x; | 3846 //v75 = door->vDirection.x; |
3840 v84 = (unsigned __int64)(v75 * (signed __int64)v70) >> 16; | 3847 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; |
3841 v82 = v71; | 3848 //v82 = v71; |
3842 v75 = v26->vDirection.y; | 3849 //v75 = door->vDirection.y; |
3843 v82 = (unsigned __int64)(v75 * (signed __int64)v71) >> 16; | 3850 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; |
3844 v83 = v72; | 3851 //v83 = v72; |
3845 v75 = v26->vDirection.z; | 3852 //v75 = door->vDirection.z; |
3846 v83 = (unsigned __int64)(v75 * (signed __int64)v72) >> 16; | 3853 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; |
3847 v75 = v84 + v82 + ((unsigned __int64)(v75 * (signed __int64)v72) >> 16); | 3854 v75 = v84 + v82 + v83; |
3848 v53 = v89; | 3855 v53 = v89; |
3849 v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; | 3856 v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; |
3850 v28->sTextureDeltaU = -((unsigned int)(v75 * v89) >> 16); | 3857 v28->sTextureDeltaU = -v82; |
3851 v75 = v26->vDirection.x; | 3858 //v75 = door->vDirection.x; |
3852 v84 = (unsigned __int64)(v75 * (signed __int64)v67) >> 16; | 3859 v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; |
3853 v82 = v68; | 3860 //v82 = v68; |
3854 v75 = v26->vDirection.y; | 3861 //v75 = door->vDirection.y; |
3855 v82 = (unsigned __int64)(v75 * (signed __int64)v68) >> 16; | 3862 v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; |
3856 v83 = v69; | 3863 //v83 = v69; |
3857 v75 = v26->vDirection.z; | 3864 //v75 = door->vDirection.z; |
3858 v83 = (unsigned __int64)(v75 * (signed __int64)v69) >> 16; | 3865 v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; |
3859 v54 = v82 + ((unsigned __int64)(v75 * (signed __int64)v69) >> 16); | 3866 //v54 = v82 + v83; |
3860 v75 = v84 + v54; | 3867 v75 = v84 + v82 + v83; |
3861 v55 = (v84 + v54) * (signed __int64)v53; | 3868 v55 = v75 * (signed __int64)v53; |
3862 v82 = v55 >> 16; | 3869 //v82 = v55 >> 16; |
3863 v32 = v55 >> 16; | 3870 v32 = v55 >> 16; |
3864 LABEL_58: | 3871 LABEL_58: |
3865 v56 = v88; | 3872 v56 = v88; |
3866 v57 = -v32; | 3873 v57 = -v32; |
3867 v28->sTextureDeltaV = v57; | 3874 v28->sTextureDeltaV = v57; |
3868 v28->sTextureDeltaU += v26->pDeltaUs[v56]; | 3875 v28->sTextureDeltaU += door->pDeltaUs[v56]; |
3869 v28->sTextureDeltaV = v57 + v26->pDeltaVs[v56]; | 3876 v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; |
3870 } | 3877 } |
3871 LABEL_59: | 3878 LABEL_59: |
3872 v58 = v26->uNumFaces; | 3879 //v58 = door->uNumFaces; |
3873 ++v88; | 3880 ++v88; |
3874 if ( v88 >= v58 ) | 3881 if ( v88 >= door->uNumFaces) |
3875 { | 3882 { |
3876 v1 = v81; | 3883 //v1 = v81; |
3877 v0 = 0; | 3884 //v0 = 0; |
3878 goto LABEL_62; | 3885 goto LABEL_62; |
3879 } | 3886 } |
3880 v2 = v87; | 3887 //v2 = v87; |
3881 } | 3888 } |
3882 LOWORD(v39) = v84 | 3889 LOWORD(v39) = v84 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); |
3883 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); | |
3884 LABEL_50: | 3890 LABEL_50: |
3885 v28->sTextureDeltaU -= v39; | 3891 v28->sTextureDeltaU -= v39; |
3886 goto LABEL_51; | 3892 goto LABEL_51; |
3887 } | 3893 } |
3888 LABEL_62: | 3894 LABEL_62: |
3889 v80 += 80; | 3895 ; |
3890 ++v1; | 3896 //v80 += 80; |
3891 v81 = v1; | 3897 //++v1; |
3892 } | 3898 //v81 = v1; |
3893 while ( v1 < pIndoor->uNumDoors ); | 3899 //} |
3900 //while ( v1 < pIndoor->uNumDoors ); | |
3894 } | 3901 } |
3895 } | 3902 } |
3896 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; | 3903 // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; |
3897 | 3904 |
3898 //----- (0046F90C) -------------------------------------------------------- | 3905 //----- (0046F90C) -------------------------------------------------------- |