comparison Render.cpp @ 639:4f2837124c69

Decoration animations
author Nomad
date Mon, 11 Mar 2013 22:20:05 +0200
parents ccf8b4815a1f
children 431a8b0c2bf1
comparison
equal deleted inserted replaced
638:ccf8b4815a1f 639:4f2837124c69
3483 3483
3484 //----- (0047A95E) -------------------------------------------------------- 3484 //----- (0047A95E) --------------------------------------------------------
3485 void Render::PrepareDecorationsRenderList_ODM() 3485 void Render::PrepareDecorationsRenderList_ODM()
3486 { 3486 {
3487 //char *v0; // esi@2 3487 //char *v0; // esi@2
3488 DecorationDesc *v1; // ebx@6 3488 //DecorationDesc *v1; // ebx@6
3489 __int16 v2; // ax@6 3489 __int16 v2; // ax@6
3490 double v3; // st7@7 3490 double v3; // st7@7
3491 int v4; // eax@9 3491 //int v4; // eax@9
3492 int v5; // edx@9 3492 //int v5; // edx@9
3493 unsigned int v6; // edi@9 3493 unsigned int v6; // edi@9
3494 int v7; // eax@9 3494 int v7; // eax@9
3495 SpriteFrame *v8; // eax@9 3495 SpriteFrame *v8; // eax@9
3496 //SpriteFrame *v9; // edi@9 3496 //SpriteFrame *v9; // edi@9
3497 unsigned __int16 *v10; // eax@9 3497 unsigned __int16 *v10; // eax@9
3515 __int16 v28; // dx@37 3515 __int16 v28; // dx@37
3516 __int16 v29; // cx@37 3516 __int16 v29; // cx@37
3517 int v30; // ecx@37 3517 int v30; // ecx@37
3518 int v31; // ebx@37 3518 int v31; // ebx@37
3519 Particle_sw local_0; // [sp+Ch] [bp-98h]@7 3519 Particle_sw local_0; // [sp+Ch] [bp-98h]@7
3520 int x; // [sp+74h] [bp-30h]@9 3520 //int x; // [sp+74h] [bp-30h]@9
3521 int y; // [sp+78h] [bp-2Ch]@9 3521 //int y; // [sp+78h] [bp-2Ch]@9
3522 //int v35; // [sp+7Ch] [bp-28h]@1 3522 //int v35; // [sp+7Ch] [bp-28h]@1
3523 int v36; // [sp+80h] [bp-24h]@9 3523 //int v36; // [sp+80h] [bp-24h]@9
3524 unsigned __int16 *v37; // [sp+84h] [bp-20h]@9 3524 unsigned __int16 *v37; // [sp+84h] [bp-20h]@9
3525 int v38; // [sp+88h] [bp-1Ch]@9 3525 int v38; // [sp+88h] [bp-1Ch]@9
3526 int v39; // [sp+8Ch] [bp-18h]@24 3526 int v39; // [sp+8Ch] [bp-18h]@24
3527 int v40; // [sp+90h] [bp-14h]@24 3527 int v40; // [sp+90h] [bp-14h]@24
3528 int v41; // [sp+94h] [bp-10h]@24 3528 int v41; // [sp+94h] [bp-10h]@24
3538 for (int i = 0; i < uNumLevelDecorations; ++i) 3538 for (int i = 0; i < uNumLevelDecorations; ++i)
3539 { 3539 {
3540 auto decor = pLevelDecorations + i; 3540 auto decor = pLevelDecorations + i;
3541 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; 3541 auto v0 = (char *)&pLevelDecorations[i].vPosition.y;
3542 3542
3543 if ( (!(*(v0 - 6) & 0x40) || ((LevelDecoration *)(v0 - 8))->_47A825()) && !(*(v0 - 6) & 0x20) ) 3543 if ( (!(decor->field_2 & 0x40) || decor->_47A825()) && !(decor->field_2 & 0x20) )
3544 { 3544 {
3545 v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; 3545 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID];
3546 v2 = v1->uFlags; 3546 auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID;
3547 v2 = decor_desc->uFlags;
3547 if ( (char)v2 >= 0 ) 3548 if ( (char)v2 >= 0 )
3548 { 3549 {
3549 if ( !(v2 & 0x22) ) 3550 if ( !(v2 & 0x22) )
3550 { 3551 {
3551 v4 = *((int *)v0 - 1); 3552 //v4 = decor->vPosition.x;
3552 v5 = *((int *)v0 + 1); 3553 //v5 = decor->vPosition.z;
3553 v6 = pMiscTimer->uTotalGameTimeElapsed; 3554 v6 = pMiscTimer->uTotalGameTimeElapsed;
3554 y = *(int *)v0; 3555 //y = decor->vPosition.y;
3555 x = v4; 3556 //x = decor->vPosition.x;
3556 v36 = v5; 3557 //v36 = decor->vPosition.z;
3557 v7 = abs(v4 + y); 3558 v7 = abs(decor->vPosition.x + decor->vPosition.y);
3558 3559
3559 3560
3560 #pragma region "New: seasons change" 3561 #pragma region "New: seasons change"
3561 extern bool change_seasons; 3562 extern bool change_seasons;
3562 if (change_seasons) 3563 if (change_seasons)
3563 switch (pParty->uCurrentMonth) 3564 switch (pParty->uCurrentMonth)
3564 { 3565 {
3565 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites 3566 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites
3566 case 11: case 0: case 1: // winter 3567 case 11: case 0: case 1: // winter
3567 switch (v1->uSpriteID) 3568 switch (decor_desc->uSpriteID)
3568 { 3569 {
3569 //case 468: //bush02 grows on swamps, which are evergreeen actually 3570 //case 468: //bush02 grows on swamps, which are evergreeen actually
3570 case 548: // flower10 3571 case 548: // flower10
3571 case 547: // flower09 3572 case 547: // flower09
3572 case 541: // flower03 3573 case 541: // flower03
3573 case 539: continue; // flower01 3574 case 539: continue; // flower01
3574 3575
3575 case 483: // tree01 3576 case 483: // tree01
3576 case 486: // tree04 3577 case 486: // tree04
3577 case 492: // tree10 3578 case 492: // tree10
3578 pSpriteFrameTable->InitializeSprite(v1->uSpriteID + 2); 3579 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2);
3579 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID + 2, v6 + v7); 3580 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7);
3580 break; 3581 break;
3581 3582
3582 default: 3583 default:
3583 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3584 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3584 } 3585 }
3585 break; 3586 break;
3586 3587
3587 case 2: case 3: case 4: // spring 3588 case 2: case 3: case 4: // spring
3588 switch (v1->uSpriteID) 3589 switch (decor_desc->uSpriteID)
3589 { 3590 {
3590 } 3591 }
3591 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3592 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3592 break; 3593 break;
3593 3594
3594 case 8: case 9: case 10: // autumn 3595 case 8: case 9: case 10: // autumn
3595 switch (v1->uSpriteID) 3596 switch (decor_desc->uSpriteID)
3596 { 3597 {
3597 //case 468: //bush02 grows on swamps, which are evergreeen actually 3598 //case 468: //bush02 grows on swamps, which are evergreeen actually
3598 case 548: // flower10 3599 case 548: // flower10
3599 case 547: // flower09 3600 case 547: // flower09
3600 case 541: // flower03 3601 case 541: // flower03
3601 case 539: continue; // flower01 3602 case 539: continue; // flower01
3602 3603
3603 case 483: // tree01 3604 case 483: // tree01
3604 case 486: // tree04 3605 case 486: // tree04
3605 case 492: // tree10 3606 case 492: // tree10
3606 pSpriteFrameTable->InitializeSprite(v1->uSpriteID + 1); 3607 pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1);
3607 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID + 1, v6 + v7); 3608 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7);
3608 break; 3609 break;
3609 3610
3610 default: 3611 default:
3611 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3612 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3612 } 3613 }
3613 break; 3614 break;
3614 3615
3615 case 5: case 6: case 7: // summer 3616 case 5: case 6: case 7: // summer
3616 //all green by default 3617 //all green by default
3617 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3618 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3618 break; 3619 break;
3619 3620
3620 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); 3621 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12);
3621 } 3622 }
3622 else 3623 else
3623 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3624 v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3624 #pragma endregion 3625 #pragma endregion
3625 //v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3626 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7);
3626 3627
3627 //v9 = v8; 3628 //v9 = v8;
3628 v42 = v8->uFlags; 3629 v42 = v8->uFlags;
3629 a5 = v8->uGlowRadius; 3630 a5 = v8->uGlowRadius;
3630 v10 = (unsigned __int16 *)stru_5C6E00->Atan2( 3631 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x,
3631 *((int *)v0 - 1) - pIndoorCamera->pos.x, 3632 decor->vPosition.y - pIndoorCamera->pos.y);
3632 *(int *)v0 - pIndoorCamera->pos.y);
3633 v11 = *((int *)v0 + 2); 3633 v11 = *((int *)v0 + 2);
3634 v37 = v10; 3634 v37 = v10;
3635 v12 = v42; 3635 v12 = v42;
3636 v38 = 0; 3636 v38 = 0;
3637 v13 = ((signed int)(stru_5C6E00->uIntegerPi 3637 v13 = ((signed int)(stru_5C6E00->uIntegerPi
3649 LOBYTE(v38) = v38 | 0x80; 3649 LOBYTE(v38) = v38 | 0x80;
3650 if ( a5 ) 3650 if ( a5 )
3651 { 3651 {
3652 if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) 3652 if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights )
3653 { 3653 {
3654 v14 = v1->uColoredLightRed; 3654 v14 = decor_desc->uColoredLightRed;
3655 v15 = v1->uColoredLightGreen; 3655 v15 = decor_desc->uColoredLightGreen;
3656 v16 = v1->uColoredLightBlue; 3656 v16 = decor_desc->uColoredLightBlue;
3657 } 3657 }
3658 else 3658 else
3659 { 3659 {
3660 v16 = 255; 3660 v16 = 255;
3661 v14 = 255; 3661 v14 = 255;
3662 v15 = 255; 3662 v15 = 255;
3663 } 3663 }
3664 b = v16; 3664 b = v16;
3665 pStationaryLightsStack->AddLight( 3665 pStationaryLightsStack->AddLight(
3666 x, 3666 decor->vPosition.x,
3667 y, 3667 decor->vPosition.y,
3668 v36 + v1->uDecorationHeight / 2, 3668 decor->vPosition.z + decor_desc->uDecorationHeight / 2,
3669 a5, 3669 a5,
3670 v14, 3670 v14,
3671 v15, 3671 v15,
3672 v16, 3672 v16,
3673 byte_4E94D0); 3673 byte_4E94D0);
3674 } 3674 }
3675 v17 = (x - pIndoorCamera->pos.x) << 16; 3675 v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16;
3676 if ( pIndoorCamera->sRotationX ) 3676 if ( pIndoorCamera->sRotationX )
3677 { 3677 {
3678 v40 = (y - pIndoorCamera->pos.y) << 16; 3678 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16;
3679 v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) 3679 v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16)
3680 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); 3680 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16);
3681 v42 = v18; 3681 v42 = v18;
3682 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; 3682 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
3683 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; 3683 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16;
3684 v40 = (v36 - pIndoorCamera->pos.z) << 16; 3684 v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16;
3685 v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; 3685 v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16;
3686 v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; 3686 v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16;
3687 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); 3687 v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16);
3688 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); 3688 v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16);
3689 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) 3689 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 )
3736 v29 = v38; 3736 v29 = v38;
3737 v27->uScreenSpaceX = v25; 3737 v27->uScreenSpaceX = v25;
3738 HIBYTE(v29) |= 2u; 3738 HIBYTE(v29) |= 2u;
3739 v27->uPalette = v28; 3739 v27->uPalette = v28;
3740 v27->field_1E = v29; 3740 v27->field_1E = v29;
3741 v27->world_x = x; 3741 v27->world_x = decor->vPosition.x;
3742 v27->world_y = y; 3742 v27->world_y = decor->vPosition.y;
3743 v27->world_z = v36; 3743 v27->world_z = decor->vPosition.z;
3744 v27->uScreenSpaceY = v40; 3744 v27->uScreenSpaceY = v40;
3745 HIWORD(v30) = HIWORD(v39); 3745 HIWORD(v30) = HIWORD(v39);
3746 v31 = 8 * i | OBJECT_Decoration; 3746 v31 = 8 * i | OBJECT_Decoration;
3747 LOWORD(v30) = 0; 3747 LOWORD(v30) = 0;
3748 v27->uIndoorSectorID = 0; 3748 v27->uIndoorSectorID = 0;
3755 goto LABEL_38; 3755 goto LABEL_38;
3756 } 3756 }
3757 } 3757 }
3758 else 3758 else
3759 { 3759 {
3760 v42 = (x - pIndoorCamera->pos.x) << 16; 3760 v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16;
3761 v40 = (y - pIndoorCamera->pos.y) << 16; 3761 v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16;
3762 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; 3762 b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16;
3763 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; 3763 a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
3764 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); 3764 v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16);
3765 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); 3765 v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16);
3766 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) 3766 if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 )
3767 { 3767 {
3768 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; 3768 a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
3769 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; 3769 b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16;
3770 v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; 3770 v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5;
3771 v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; 3771 v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5;
3772 v22 = (v36 - pIndoorCamera->pos.z) << 16; 3772 v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16;
3773 goto LABEL_30; 3773 goto LABEL_30;
3774 } 3774 }
3775 } 3775 }
3776 } 3776 }
3777 } 3777 }