Mercurial > mm7
diff Render.cpp @ 1497:19890e50e2f6
Слияние
author | Ritor1 |
---|---|
date | Sun, 01 Sep 2013 17:10:55 +0600 |
parents | ab6bf38b2940 6d21ef91cb2d |
children | af57b3b76fe4 |
line wrap: on
line diff
--- a/Render.cpp Sun Sep 01 17:10:29 2013 +0600 +++ b/Render.cpp Sun Sep 01 17:10:55 2013 +0600 @@ -915,259 +915,259 @@ auto decor = &pLevelDecorations[i]; auto v0 = (char *)&pLevelDecorations[i].vPosition.y; - if ( (!(decor->field_2 & 0x40) || decor->_47A825()) && !(decor->field_2 & 0x20) ) - { - //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; - auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; - v2 = decor_desc->uFlags; - if ( (char)v2 >= 0 ) + if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) + { + //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; + auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; + v2 = decor_desc->uFlags; + if ( (char)v2 >= 0 ) + { + if ( !(v2 & 0x22) ) { - if ( !(v2 & 0x22) ) + //v4 = decor->vPosition.x; + //v5 = decor->vPosition.z; + v6 = pMiscTimer->uTotalGameTimeElapsed; + //y = decor->vPosition.y; + //x = decor->vPosition.x; + //v36 = decor->vPosition.z; + v7 = abs(decor->vPosition.x + decor->vPosition.y); + + + #pragma region "New: seasons change" + extern bool change_seasons; + if (change_seasons) + switch (pParty->uCurrentMonth) + { + // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites + case 11: case 0: case 1: // winter + switch (decor_desc->uSpriteID) + { + //case 468: //bush02 grows on swamps, which are evergreeen actually + case 548: // flower10 + case 547: // flower09 + case 541: // flower03 + case 539: continue; // flower01 + + case 483: // tree01 + case 486: // tree04 + case 492: // tree10 + pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); + break; + + default: + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + } + break; + + case 2: case 3: case 4: // spring + switch (decor_desc->uSpriteID) + { + } + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + break; + + case 8: case 9: case 10: // autumn + switch (decor_desc->uSpriteID) + { + //case 468: //bush02 grows on swamps, which are evergreeen actually + case 548: // flower10 + case 547: // flower09 + case 541: // flower03 + case 539: continue; // flower01 + + case 483: // tree01 + case 486: // tree04 + case 492: // tree10 + pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); + break; + + default: + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + } + break; + + case 5: case 6: case 7: // summer + //all green by default + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + break; + + default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); + } + else + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + #pragma endregion + //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + + //v9 = v8; + v42 = v8->uFlags; + a5 = v8->uGlowRadius; + v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, + decor->vPosition.y - pIndoorCamera->pos.y); + v11 = *((int *)v0 + 2); + v37 = v10; + v12 = v42; + v38 = 0; + v13 = ((signed int)(stru_5C6E00->uIntegerPi + + ((signed int)stru_5C6E00->uIntegerPi >> 3) + + v11 + - (signed int)v37) >> 8) & 7; + v37 = (unsigned __int16 *)v13; + if ( v42 & 2 ) + v38 = 2; + if ( (256 << v13) & v42 ) + v38 |= 4u; + if ( v12 & 0x40000 ) + v38 |= 0x40u; + if ( v12 & 0x20000 ) + LOBYTE(v38) = v38 | 0x80; + if ( a5 ) { - //v4 = decor->vPosition.x; - //v5 = decor->vPosition.z; - v6 = pMiscTimer->uTotalGameTimeElapsed; - //y = decor->vPosition.y; - //x = decor->vPosition.x; - //v36 = decor->vPosition.z; - v7 = abs(decor->vPosition.x + decor->vPosition.y); - - - #pragma region "New: seasons change" - extern bool change_seasons; - if (change_seasons) - switch (pParty->uCurrentMonth) - { - // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites - case 11: case 0: case 1: // winter - switch (decor_desc->uSpriteID) - { - //case 468: //bush02 grows on swamps, which are evergreeen actually - case 548: // flower10 - case 547: // flower09 - case 541: // flower03 - case 539: continue; // flower01 - - case 483: // tree01 - case 486: // tree04 - case 492: // tree10 - pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); - break; - - default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - } - break; - - case 2: case 3: case 4: // spring - switch (decor_desc->uSpriteID) - { - } - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - break; - - case 8: case 9: case 10: // autumn - switch (decor_desc->uSpriteID) - { - //case 468: //bush02 grows on swamps, which are evergreeen actually - case 548: // flower10 - case 547: // flower09 - case 541: // flower03 - case 539: continue; // flower01 - - case 483: // tree01 - case 486: // tree04 - case 492: // tree10 - pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); - break; - - default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - } - break; - - case 5: case 6: case 7: // summer - //all green by default - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - break; - - default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); - } - else - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - #pragma endregion - //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - - //v9 = v8; - v42 = v8->uFlags; - a5 = v8->uGlowRadius; - v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, - decor->vPosition.y - pIndoorCamera->pos.y); - v11 = *((int *)v0 + 2); - v37 = v10; - v12 = v42; - v38 = 0; - v13 = ((signed int)(stru_5C6E00->uIntegerPi - + ((signed int)stru_5C6E00->uIntegerPi >> 3) - + v11 - - (signed int)v37) >> 8) & 7; - v37 = (unsigned __int16 *)v13; - if ( v42 & 2 ) - v38 = 2; - if ( (256 << v13) & v42 ) - v38 |= 4u; - if ( v12 & 0x40000 ) - v38 |= 0x40u; - if ( v12 & 0x20000 ) - LOBYTE(v38) = v38 | 0x80; - if ( a5 ) + if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) { - if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) - { - v14 = decor_desc->uColoredLightRed; - v15 = decor_desc->uColoredLightGreen; - v16 = decor_desc->uColoredLightBlue; - } - else - { - v16 = 255; - v14 = 255; - v15 = 255; - } - b = v16; - pStationaryLightsStack->AddLight( - decor->vPosition.x, - decor->vPosition.y, - decor->vPosition.z + decor_desc->uDecorationHeight / 2, - a5, - v14, - v15, - v16, - byte_4E94D0); - } - v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; - if ( pIndoorCamera->sRotationX ) - { - v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v42 = v18; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; - v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) - { - v21 = a5 - b; - v41 = a5 - b; - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; -LABEL_30: - v42 = v22; - v40 = 2 * abs(v20); - v23 = abs(v21); - if ( v40 >= v23 ) - { - LODWORD(v24) = 0; - HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); - a5 = v24 / v39; - v25 = pViewport->uScreenCenterX - - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); - b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; - v41 = v24 / v39; - v40 = pViewport->uScreenCenterY - - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); - v42 = v8->scale; - v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; - v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; - if ( pRenderer->pRenderD3D ) - { - v26 = v41; - v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; - b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - } - else - { - v26 = v41; - v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; - b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - } - if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) - { - if (::uNumBillboardsToDraw >= 500) - return; - v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; - ++uNumDecorationsDrawnThisFrame; - v27->uHwSpriteID = *v37; - v28 = v8->uPaletteIndex; - v27->_screenspace_x_scaler_packedfloat = v26; - v27->_screenspace_y_scaler_packedfloat = v26; - v29 = v38; - v27->uScreenSpaceX = v25; - HIBYTE(v29) |= 2u; - v27->uPalette = v28; - v27->field_1E = v29; - v27->world_x = decor->vPosition.x; - v27->world_y = decor->vPosition.y; - v27->world_z = decor->vPosition.z; - v27->uScreenSpaceY = v40; - HIWORD(v30) = HIWORD(v39); - v31 = PID(OBJECT_Decoration,i); - LOWORD(v30) = 0; - v27->uIndoorSectorID = 0; - v27->sZValue = v30 + v31; - v27->dimming_level = 0; - v27->pSpriteFrame = v8; - v27->uTintColor = 0; - } - } - goto LABEL_38; - } + v14 = decor_desc->uColoredLightRed; + v15 = decor_desc->uColoredLightGreen; + v16 = decor_desc->uColoredLightBlue; } else { - v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; - v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + v16 = 255; + v14 = 255; + v15 = 255; + } + b = v16; + pStationaryLightsStack->AddLight( + decor->vPosition.x, + decor->vPosition.y, + decor->vPosition.z + decor_desc->uDecorationHeight / 2, + a5, + v14, + v15, + v16, + byte_4E94D0); + } + v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; + if ( pIndoorCamera->sRotationX ) + { + v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; + v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) + + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + v42 = v18; + b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; + v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; + v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; + v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + { + v21 = a5 - b; + v41 = a5 - b; + a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; + v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; +LABEL_30: + v42 = v22; + v40 = 2 * abs(v20); + v23 = abs(v21); + if ( v40 >= v23 ) { - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; - v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; - v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; - goto LABEL_30; + LODWORD(v24) = 0; + HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); + a5 = v24 / v39; + v25 = pViewport->uScreenCenterX + - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); + b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; + v41 = v24 / v39; + v40 = pViewport->uScreenCenterY + - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); + v42 = v8->scale; + v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; + v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; + if ( pRenderer->pRenderD3D ) + { + v26 = v41; + v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; + b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; + } + else + { + v26 = v41; + v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; + b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; + } + if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) + { + if (::uNumBillboardsToDraw >= 500) + return; + v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; + ++uNumDecorationsDrawnThisFrame; + v27->uHwSpriteID = *v37; + v28 = v8->uPaletteIndex; + v27->_screenspace_x_scaler_packedfloat = v26; + v27->_screenspace_y_scaler_packedfloat = v26; + v29 = v38; + v27->uScreenSpaceX = v25; + HIBYTE(v29) |= 2u; + v27->uPalette = v28; + v27->field_1E = v29; + v27->world_x = decor->vPosition.x; + v27->world_y = decor->vPosition.y; + v27->world_z = decor->vPosition.z; + v27->uScreenSpaceY = v40; + HIWORD(v30) = HIWORD(v39); + v31 = PID(OBJECT_Decoration,i); + LOWORD(v30) = 0; + v27->uIndoorSectorID = 0; + v27->sZValue = v30 + v31; + v27->dimming_level = 0; + v27->pSpriteFrame = v8; + v27->uTintColor = 0; + } } + goto LABEL_38; + } + } + else + { + v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; + v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; + b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + { + a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; + v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; + v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; + goto LABEL_30; } } } - else - { - memset(&local_0, 0, 0x68u); - v3 = (double)*((signed int *)v0 - 1); - local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; - local_0.uDiffuse = 0xFF3C1E; - local_0.x = v3; - local_0.y = (double)*(signed int *)v0; - local_0.z = (double)*((signed int *)v0 + 1); - local_0.r = 0.0; - local_0.g = 0.0; - local_0.b = 0.0; - local_0.flt_28 = 1.0; - local_0.timeToLive = (rand() & 0x80) + 128; - local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); - pGame->pParticleEngine->AddParticle(&local_0); - } - } + } + else + { + memset(&local_0, 0, 0x68u); + v3 = (double)*((signed int *)v0 - 1); + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + local_0.uDiffuse = 0xFF3C1E; + local_0.x = v3; + local_0.y = (double)*(signed int *)v0; + local_0.z = (double)*((signed int *)v0 + 1); + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; + local_0.flt_28 = 1.0; + local_0.timeToLive = (rand() & 0x80) + 128; + local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); + pGame->pParticleEngine->AddParticle(&local_0); + } + } LABEL_38: ; //++v35;