comparison Render.cpp @ 635:71ecba604995

Season change affects vegetation; bool change_seasons == true - seasons change, otherwise eternal summer
author Nomad
date Mon, 11 Mar 2013 16:54:56 +0200
parents 574cc56e05e9
children d7b14091e434
comparison
equal deleted inserted replaced
631:3d03a3a674bc 635:71ecba604995
3481 int v4; // eax@9 3481 int v4; // eax@9
3482 int v5; // edx@9 3482 int v5; // edx@9
3483 unsigned int v6; // edi@9 3483 unsigned int v6; // edi@9
3484 int v7; // eax@9 3484 int v7; // eax@9
3485 SpriteFrame *v8; // eax@9 3485 SpriteFrame *v8; // eax@9
3486 SpriteFrame *v9; // edi@9 3486 //SpriteFrame *v9; // edi@9
3487 unsigned __int16 *v10; // eax@9 3487 unsigned __int16 *v10; // eax@9
3488 int v11; // ecx@9 3488 int v11; // ecx@9
3489 int v12; // eax@9 3489 int v12; // eax@9
3490 int v13; // ecx@9 3490 int v13; // ecx@9
3491 int v14; // ecx@20 3491 int v14; // ecx@20
3525 //{ 3525 //{
3526 //v0 = (char *)&pLevelDecorations[0].vPosition.y; 3526 //v0 = (char *)&pLevelDecorations[0].vPosition.y;
3527 //do 3527 //do
3528 for (int i = 0; i < uNumLevelDecorations; ++i) 3528 for (int i = 0; i < uNumLevelDecorations; ++i)
3529 { 3529 {
3530 auto decor = pLevelDecorations + i;
3530 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; 3531 auto v0 = (char *)&pLevelDecorations[i].vPosition.y;
3531 3532
3532 if ( (!(*(v0 - 6) & 0x40) || ((LevelDecoration *)(v0 - 8))->_47A825()) && !(*(v0 - 6) & 0x20) ) 3533 if ( (!(*(v0 - 6) & 0x40) || ((LevelDecoration *)(v0 - 8))->_47A825()) && !(*(v0 - 6) & 0x20) )
3533 { 3534 {
3534 v1 = &pDecorationList->pDecorations[*((short *)v0 - 4)]; 3535 v1 = &pDecorationList->pDecorations[decor->uDecorationDescID];
3535 v2 = v1->uFlags; 3536 v2 = v1->uFlags;
3536 if ( (char)v2 >= 0 ) 3537 if ( (char)v2 >= 0 )
3537 { 3538 {
3538 if ( !(v2 & 0x22) ) 3539 if ( !(v2 & 0x22) )
3539 { 3540 {
3542 v6 = pMiscTimer->uTotalGameTimeElapsed; 3543 v6 = pMiscTimer->uTotalGameTimeElapsed;
3543 y = *(int *)v0; 3544 y = *(int *)v0;
3544 x = v4; 3545 x = v4;
3545 v36 = v5; 3546 v36 = v5;
3546 v7 = abs(v4 + y); 3547 v7 = abs(v4 + y);
3547 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7); 3548
3548 v9 = v8; 3549
3550 #pragma region "New: seasons change"
3551 extern bool change_seasons;
3552 if (change_seasons)
3553 switch (pParty->uCurrentMonth)
3554 {
3555 // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites
3556 case 11: case 0: case 1: // winter
3557 switch (v1->uSpriteID)
3558 {
3559 //case 468: //bush02 grows on swamps, which are evergreeen actually
3560 case 548: // flower10
3561 case 547: // flower09
3562 case 541: // flower03
3563 case 539: continue; // flower01
3564
3565 case 483: // tree01
3566 case 486: // tree04
3567 case 492: // tree10
3568 pSpriteFrameTable->InitializeSprite(v1->uSpriteID + 2);
3569 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID + 2, v6 + v7);
3570 break;
3571
3572 default:
3573 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7);
3574 }
3575 break;
3576
3577 case 2: case 3: case 4: // spring
3578 switch (v1->uSpriteID)
3579 {
3580 }
3581 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7);
3582 break;
3583
3584 case 8: case 9: case 10: // autumn
3585 switch (v1->uSpriteID)
3586 {
3587 //case 468: //bush02 grows on swamps, which are evergreeen actually
3588 case 548: // flower10
3589 case 547: // flower09
3590 case 541: // flower03
3591 case 539: continue; // flower01
3592
3593 case 483: // tree01
3594 case 486: // tree04
3595 case 492: // tree10
3596 pSpriteFrameTable->InitializeSprite(v1->uSpriteID + 1);
3597 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID + 1, v6 + v7);
3598 break;
3599
3600 default:
3601 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7);
3602 }
3603 break;
3604
3605 case 5: case 6: case 7: // summer
3606 //all green by default
3607 v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7);
3608 break;
3609
3610 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12);
3611 }
3612 #pragma endregion
3613 //v8 = pSpriteFrameTable->GetFrame(v1->uSpriteID, v6 + v7);
3614
3615 //v9 = v8;
3549 v42 = v8->uFlags; 3616 v42 = v8->uFlags;
3550 a5 = v8->uGlowRadius; 3617 a5 = v8->uGlowRadius;
3551 v10 = (unsigned __int16 *)stru_5C6E00->Atan2( 3618 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(
3552 *((int *)v0 - 1) - pIndoorCamera->pos.x, 3619 *((int *)v0 - 1) - pIndoorCamera->pos.x,
3553 *(int *)v0 - pIndoorCamera->pos.y); 3620 *(int *)v0 - pIndoorCamera->pos.y);
3627 - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); 3694 - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16);
3628 b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; 3695 b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16;
3629 v41 = v24 / v39; 3696 v41 = v24 / v39;
3630 v40 = pViewport->uScreenCenterY 3697 v40 = pViewport->uScreenCenterY
3631 - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); 3698 - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16);
3632 v42 = v9->scale; 3699 v42 = v8->scale;
3633 v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; 3700 v41 = (unsigned __int64)(v42 * v24 / v39) >> 16;
3634 v37 = (unsigned __int16 *)&v9->pHwSpriteIDs[(int)v37]; 3701 v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37];
3635 if ( pRenderer->pRenderD3D ) 3702 if ( pRenderer->pRenderD3D )
3636 { 3703 {
3637 v26 = v41; 3704 v26 = v41;
3638 v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; 3705 v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1;
3639 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; 3706 b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16;
3649 if (::uNumBillboardsToDraw >= 500) 3716 if (::uNumBillboardsToDraw >= 500)
3650 return; 3717 return;
3651 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; 3718 v27 = &pBillboardRenderList[::uNumBillboardsToDraw++];
3652 ++uNumDecorationsDrawnThisFrame; 3719 ++uNumDecorationsDrawnThisFrame;
3653 v27->uHwSpriteID = *v37; 3720 v27->uHwSpriteID = *v37;
3654 v28 = v9->uPaletteIndex; 3721 v28 = v8->uPaletteIndex;
3655 v27->_screenspace_x_scaler_packedfloat = v26; 3722 v27->_screenspace_x_scaler_packedfloat = v26;
3656 v27->_screenspace_y_scaler_packedfloat = v26; 3723 v27->_screenspace_y_scaler_packedfloat = v26;
3657 v29 = v38; 3724 v29 = v38;
3658 v27->uScreenSpaceX = v25; 3725 v27->uScreenSpaceX = v25;
3659 HIBYTE(v29) |= 2u; 3726 HIBYTE(v29) |= 2u;
3667 v31 = 8 * i | OBJECT_Decoration; 3734 v31 = 8 * i | OBJECT_Decoration;
3668 LOWORD(v30) = 0; 3735 LOWORD(v30) = 0;
3669 v27->uIndoorSectorID = 0; 3736 v27->uIndoorSectorID = 0;
3670 v27->sZValue = v30 + v31; 3737 v27->sZValue = v30 + v31;
3671 v27->uPaletteSubindex = 0; 3738 v27->uPaletteSubindex = 0;
3672 v27->pSpriteFrame = v9; 3739 v27->pSpriteFrame = v8;
3673 v27->uTintColor = 0; 3740 v27->uTintColor = 0;
3674 } 3741 }
3675 } 3742 }
3676 goto LABEL_38; 3743 goto LABEL_38;
3677 } 3744 }