Mercurial > mm7
changeset 707:436ae1842e92
Decorations in blv
author | Nomad |
---|---|
date | Thu, 21 Mar 2013 10:21:46 +0200 |
parents | d6236f6a9882 |
children | af5771589d22 |
files | Indoor.cpp mm7_3.cpp |
diffstat | 2 files changed, 91 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/Indoor.cpp Thu Mar 21 10:21:46 2013 +0200 @@ -75,13 +75,13 @@ //double v3; // ST30_8@6 //double v4; // ST28_8@6 int v5; // eax@4 - int v6; // eax@7 + //int v6; // eax@7 unsigned int v7; // ebx@8 BLVSector *v8; // esi@8 - unsigned __int16 *v9; // edi@8 - int i; // [sp+18h] [bp-8h]@7 + //unsigned __int16 *v9; // edi@8 + //int i; // [sp+18h] [bp-8h]@7 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 - signed int v12; // [sp+1Ch] [bp-4h]@8 + //signed int v12; // [sp+1Ch] [bp-4h]@8 pBLVRenderParams->Reset(_this); pMobileLightsStack->uNumLightsActive = 0; @@ -90,44 +90,47 @@ _unused000 = 0; uNumSpritesDrawnThisFrame = 0; uNumBillboardsToDraw = 0; - if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) + + if ( !byte_4D864C || !(pGame->uFlags & 0x1000) ) // lightspot around party { //v2 = pParty->flt_TorchlightColorB + 6.7553994e15; //v11 = LOBYTE(v2); v5 = 800; if (pParty->TorchlightActive()) - v5 *= pParty->pPartyBuffs[16].uPower; + v5 *= pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; //LOBYTE(v1) = byte_4E94D0; //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; - pMobileLightsStack->AddLight( - pBLVRenderParams->vPartyPos.x, - pBLVRenderParams->vPartyPos.y, - pBLVRenderParams->vPartyPos.z, - pBLVRenderParams->uPartySectorID, - v5, - floorf(pParty->flt_TorchlightColorR + 0.5f), - floorf(pParty->flt_TorchlightColorG + 0.5f), - floorf(pParty->flt_TorchlightColorB + 0.5f), - byte_4E94D0); + pMobileLightsStack->AddLight(pBLVRenderParams->vPartyPos.x, + pBLVRenderParams->vPartyPos.y, + pBLVRenderParams->vPartyPos.z, + pBLVRenderParams->uPartySectorID, + v5, + floorf(pParty->flt_TorchlightColorR + 0.5f), + floorf(pParty->flt_TorchlightColorG + 0.5f), + floorf(pParty->flt_TorchlightColorB + 0.5f), + byte_4E94D0); } PrepareBspRenderList_BLV(); PrepareItemsRenderList_BLV(); PrepareActorRenderList_BLV(); - v6 = 0; - for ( i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i ) + + //v6 = 0; + for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i) { - v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]; - v12 = 0; - v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]]; - v9 = v8->pDecorationIDs; - if ( v8->uNumDecorations > 0 ) + v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]; + //v12 = 0; + v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]]; + //v9 = v8->pDecorationIDs; + + for (uint j = 0; j < v8->uNumDecorations; ++j) + //if ( v8->uNumDecorations > 0 ) { - do - PrepareDecorationsRenderList_BLV(v9[v12++], v7); - while ( v12 < v8->uNumDecorations ); + // do + PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7); + // while ( v12 < v8->uNumDecorations ); } - v6 = i + 1; + //v6 = i + 1; } FindBillboardsLightLevels_BLV(); pGame->PrepareBloodsplats();
--- a/mm7_3.cpp Tue Mar 19 21:53:21 2013 +0400 +++ b/mm7_3.cpp Thu Mar 21 10:21:46 2013 +0200 @@ -11207,19 +11207,19 @@ char v16; // zf@18 IndoorCameraD3D **v17; // eax@19 double v18; // st7@19 - float v19; // eax@19 + //float v19; // eax@19 signed __int64 v20; // qtt@19 signed __int64 v21; // qtt@20 - int v22; // edx@21 - int v23; // eax@21 + //int v22; // edx@21 + //int v23; // eax@21 Particle_sw local_0; // [sp+Ch] [bp-A0h]@3 - double v25; // [sp+74h] [bp-38h]@19 - unsigned int v26; // [sp+7Ch] [bp-30h]@1 + //double v25; // [sp+74h] [bp-38h]@19 + //unsigned int v26; // [sp+7Ch] [bp-30h]@1 int a2; // [sp+80h] [bp-2Ch]@5 int a3; // [sp+84h] [bp-28h]@5 int a1; // [sp+88h] [bp-24h]@5 int v30; // [sp+8Ch] [bp-20h]@7 - float v31; // [sp+90h] [bp-1Ch]@1 + //float v31; // [sp+90h] [bp-1Ch]@1 int a5; // [sp+94h] [bp-18h]@17 int z; // [sp+98h] [bp-14h]@15 int a6; // [sp+9Ch] [bp-10h]@17 @@ -11227,17 +11227,37 @@ int x; // [sp+A4h] [bp-8h]@15 int v37; // [sp+A8h] [bp-4h]@5 - v26 = uDecorationID; - LODWORD(v31) = uSectorID; + //v26 = uDecorationID; + //LODWORD(v31) = uSectorID; v2 = &pLevelDecorations[uDecorationID]; - if ( !(v2->field_2 & 0x20) ) - { + if (v2->field_2 & 0x20) + return; + v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; v4 = v3->uFlags; - if ( (char)v4 >= 0 ) - { - if ( !(v4 & DECORATION_DONT_DRAW) ) - { + if (v3->uFlags & DECORATION_EMITS_FIRE) + { + memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern + v5 = (double)v2->vPosition.x; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + local_0.uDiffuse = 0xFF3C1E; + local_0.x = v5; + local_0.y = (double)v2->vPosition.y; + local_0.z = (double)v2->vPosition.z; + local_0.flt_10 = 0.0; + local_0.flt_14 = 0.0; + local_0.flt_18 = 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); + return; + } + + + if (v4 & DECORATION_DONT_DRAW) + return; + v6 = v2->vPosition.x; v7 = v2->vPosition.z; a2 = v2->vPosition.y; @@ -11248,7 +11268,7 @@ - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); v37 = pBLVRenderParams->field_0_timer_; v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; - if ( pParty->bTurnBasedModeOn == 1 ) + if (pParty->bTurnBasedModeOn) v37 = pMiscTimer->uTotalGameTimeElapsed; v10 = abs(v2->vPosition.x + v2->vPosition.y); v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10); @@ -11269,23 +11289,24 @@ if ( v14 >= abs(y) ) { pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); + v15 = &pBillboardRenderList[uNumBillboardsToDraw]; - if ( (signed int)uNumBillboardsToDraw < 500 ) - { + assert(uNumBillboardsToDraw < 500); + ++uNumBillboardsToDraw; ++uNumDecorationsDrawnThisFrame; v16 = pRenderer->pRenderD3D == 0; v15->uHwSpriteID = v12->pHwSpriteIDs[v9]; v15->uPalette = v12->uPaletteIndex; - v15->uIndoorSectorID = LOWORD(v31); + v15->uIndoorSectorID = uSectorID; if ( v16 ) { LODWORD(v21) = pBLVRenderParams->field_40 << 16; HIDWORD(v21) = pBLVRenderParams->field_40 >> 16; v37 = v21 / x; - LODWORD(v31) = v12->scale; + //LODWORD(v31) = v12->scale; v37 = v21 / x; - v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v21 / x) >> 16; + v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16; v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16; } else @@ -11293,24 +11314,27 @@ v17 = &pGame->pIndoorCameraD3D; v15->fov_x = pGame->pIndoorCameraD3D->fov_x; v18 = (*v17)->fov_y; - v19 = v15->fov_x; + //v19 = v15->fov_x; v15->fov_y = v18; - v31 = v19; - v25 = v19 + 6.7553994e15; + //v31 = v19; + //v25 = v19 + 6.7553994e15; + //v25 = floorf(v15->fov_x + 0.5f); LODWORD(v20) = 0; - HIDWORD(v20) = SLOWORD(v25); + HIDWORD(v20) = floorf(v15->fov_x + 0.5f); v37 = v20 / x; - LODWORD(v31) = v12->scale; - v37 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16; - v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16; - v31 = v15->fov_y; - v25 = v31 + 6.7553994e15; + //LODWORD(v31) = v12->scale; + v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; + v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16; + //v31 = v15->fov_y; + //v25 = v31 + 6.7553994e15; + //v25 = floorf(v15->fov_y + 0.5f); LODWORD(v20) = 0; - HIDWORD(v20) = SLOWORD(v25); + HIDWORD(v20) = floorf(v15->fov_y + 0.5f); v37 = v20 / x; v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; } - HIWORD(v22) = HIWORD(x); + //HIWORD(v22) = HIWORD(x); + //LOWORD(v22) = 0; v15->_screenspace_y_scaler_packedfloat = v37; v15->field_1E = v30; v15->world_x = a1; @@ -11318,39 +11342,17 @@ v15->world_z = a3; v15->uScreenSpaceX = a5; v15->uScreenSpaceY = a6; - v23 = 8 * v26; - LOBYTE(v23) = 8 * v26 | OBJECT_Decoration; - LOWORD(v22) = 0; + //v23 = 8 * uDecorationID; + //LOBYTE(v23) = 8 * uDecorationID | OBJECT_Decoration; //v15->sZValue = v22 + v23; v15->actual_z = HIWORD(x); - v15->object_pid = 8 * v26 | OBJECT_Decoration; + v15->object_pid = 8 * uDecorationID | OBJECT_Decoration; v15->uTintColor = 0; v15->pSpriteFrame = v12; - } - } - } - } - } - else - { - memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern - v5 = (double)v2->vPosition.x; - local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; - local_0.uDiffuse = 0xFF3C1E; - local_0.x = v5; - local_0.y = (double)v2->vPosition.y; - local_0.z = (double)v2->vPosition.z; - local_0.flt_10 = 0.0; - local_0.flt_14 = 0.0; - local_0.flt_18 = 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); - } - } + } + } } @@ -11423,8 +11425,7 @@ if ( v30 & 0x20 ) { v8 = v30; - a3 -= (signed int)((unsigned __int64)(v5->scale - * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; + a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; } v34 = 0; if ( v8 & 2 )