Mercurial > mm7
diff Render.cpp @ 2206:15a327be07e2
DrawSpriteObjects_ODM() cleaned
author | Ritor1 |
---|---|
date | Thu, 06 Feb 2014 00:38:03 +0600 |
parents | 3445abad44c5 |
children | ff8920a40c21 |
line wrap: on
line diff
--- a/Render.cpp Wed Feb 05 17:24:38 2014 +0600 +++ b/Render.cpp Thu Feb 06 00:38:03 2014 +0600 @@ -464,48 +464,18 @@ //----- (0047AF11) -------------------------------------------------------- void Render::DrawSpriteObjects_ODM() { - //char *v0; // edi@2 - //ObjectDesc *v1; // ebx@4 - __int16 v2; // cx@5 - RenderBillboard *v3; // esi@10 - SpriteFrame *v4; // eax@10 - //SpriteFrame *v5; // ebx@10 + SpriteFrame *frame; // eax@10 unsigned int v6; // eax@10 - //int v7; // ecx@10 - //int v8; // edx@10 int v9; // ecx@10 - unsigned __int16 v10; // ax@10 - //int *v11; // eax@14 - int v12; // eax@22 - int v13; // ST3C_4@23 - int v14; // eax@23 - int v15; // ecx@23 - int v16; // ebx@23 int v17; // ecx@25 int v18; // eax@25 - int v19; // ST40_4@26 - int v20; // ecx@26 - int v21; // ST44_4@28 int v22; // ST3C_4@29 signed __int64 v23; // qtt@30 - int v24; // ebx@30 - int v25; // ST3C_4@30 int v26; // eax@31 char v27; // zf@31 - //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 - //__int16 a5; // [sp+10h] [bp-30h]@10 int v30; // [sp+14h] [bp-2Ch]@23 - int v31; // [sp+14h] [bp-2Ch]@29 - __int16 v32; // [sp+14h] [bp-2Ch]@30 - int v33; // [sp+18h] [bp-28h]@23 - int v34; // [sp+18h] [bp-28h]@26 - int v35; // [sp+18h] [bp-28h]@30 - int v36; // [sp+1Ch] [bp-24h]@10 int v37; // [sp+1Ch] [bp-24h]@23 int a6; // [sp+20h] [bp-20h]@10 - int a6a; // [sp+20h] [bp-20h]@23 - int v40; // [sp+24h] [bp-1Ch]@25 - //signed int v41; // [sp+28h] [bp-18h]@1 int v42; // [sp+2Ch] [bp-14h]@23 int y; // [sp+30h] [bp-10h]@10 int x; // [sp+34h] [bp-Ch]@10 @@ -532,136 +502,133 @@ //if ( !(v1->uFlags & 1) ) //{ //v2 = *((short *)v0 - 14) - v2 = object->uType; - if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) + //v2 = object->uType; + if ( (object->uType < 1000 || object->uType >= 10000) && (object->uType < 500 || object->uType >= 600) + || pGame->pStru6Instance->_4A81CA(object) ) { //a5 = *(short *)v0; x = object->vPosition.x; y = object->vPosition.y; z = object->vPosition.z; - v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; - v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); - //v5 = v4; - //v28 = v4; - v36 = v4->uFlags; - a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; + frame = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); + a6 = frame->uGlowRadius * object->field_22_glow_radius_multiplier; v6 = stru_5C6E00->Atan2(object->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); //LOWORD(v7) = object->uFacing; //v8 = v36; - v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; - v10 = v4->pHwSpriteIDs[v9]; - v3->uHwSpriteID = v10; - if ( v36 & 0x20 ) - { - //v8 = v36; - z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; - } - v46 = 0; - if ( v36 & 2 ) - v46 = 2; - //v11 = (int *)(256 << v9); - if ( (256 << v9) & v36 ) - v46 |= 4u; - if ( v36 & 0x40000 ) - v46 |= 0x40u; - if ( v36 & 0x20000 ) - LOBYTE(v46) = v46 | 0x80; - if ( a6 ) - { - //LOBYTE(v11) = _4E94D3_light_type; - pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); - } - v12 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; - if (pGame->pIndoorCameraD3D->sRotationX) - { - v13 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v30 = ((unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - + ((unsigned __int64)(v13 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16); - v37 = (unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; - a6a = (unsigned __int64)(v13 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; - v33 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - v14 = (unsigned __int64)(v30 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16; - v15 = (unsigned __int64)(v33 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16; - v16 = v15 + v14; - v42 = v15 + v14; - if ( v15 + v14 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) - { - v17 = a6a - v37; - v40 = a6a - v37; - v18 = ((unsigned __int64)(v33 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_x) >> 16) - - ((unsigned __int64)(v30 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_x) >> 16); - goto LABEL_29; - } - } - else + v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; + pBillboardRenderList[::uNumBillboardsToDraw].uHwSpriteID = frame->pHwSpriteIDs[v9]; + if ( frame->uFlags & 0x20 ) + { + //v8 = v36; + z -= fixpoint_mul(frame->scale, pSprites_LOD->pSpriteHeaders[(signed __int16)frame->pHwSpriteIDs[v9]].uHeight) / 2; + } + v46 = 0; + if ( frame->uFlags & 2 ) + v46 = 2; + //v11 = (int *)(256 << v9); + if ( (256 << v9) & frame->uFlags ) + v46 |= 4u; + if ( frame->uFlags & 0x40000 ) + v46 |= 0x40u; + if ( frame->uFlags & 0x20000 ) + LOBYTE(v46) = v46 | 0x80; + if ( a6 ) + { + //LOBYTE(v11) = _4E94D3_light_type; + pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); + } + if (pGame->pIndoorCameraD3D->sRotationX) + { + v30 = fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_cosine_y) + + fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_sine_y); + v37 = fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_sine_y); + v42 = fixpoint_mul((z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x) + + fixpoint_mul(v30, pGame->pIndoorCameraD3D->int_cosine_x); + if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) + { + v17 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_cosine_y) - v37; + v18 = fixpoint_mul((z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_cosine_x) + - fixpoint_mul(v30, pGame->pIndoorCameraD3D->int_sine_x); + if ( abs(v42) >= abs(v17) ) + { + LODWORD(v23) = 0; + HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); + + object->uAttributes |= 1; + pBillboardRenderList[::uNumBillboardsToDraw].uPalette = frame->uPaletteIndex; + pBillboardRenderList[::uNumBillboardsToDraw].uIndoorSectorID = object->uSectorID; + pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = fixpoint_mul(frame->scale, v23 / v42); + pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = frame; + pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = fixpoint_mul(frame->scale, v23 / v42); + pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v46; + pBillboardRenderList[::uNumBillboardsToDraw].world_x = x; + pBillboardRenderList[::uNumBillboardsToDraw].world_y = y; + pBillboardRenderList[::uNumBillboardsToDraw].world_z = z; + pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v23 / v42, v17) + 0x8000) >> 16); + pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceY = pViewport->uScreenCenterY - (((unsigned int)fixpoint_mul(v23 / v42, v18) + 0x8000) >> 16); + HIWORD(v26) = HIWORD(v42); + LOWORD(v26) = 0; + pBillboardRenderList[::uNumBillboardsToDraw].sZValue = v26 + (PID(OBJECT_Item,i)); + pBillboardRenderList[::uNumBillboardsToDraw].dimming_level = 0; + pBillboardRenderList[::uNumBillboardsToDraw].sTintColor = 0; + if ( !(object->uAttributes & 0x20) ) { - v34 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v19 = (unsigned __int64)(v12 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16; - v20 = (unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; - v16 = v20 + v19; - v42 = v20 + v19; - if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 ) - { - v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (signed __int64)pGame->pIndoorCameraD3D->int_sine_y) >> 16; - v17 = ((unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v21; - v40 = ((unsigned __int64)(v34 * (signed __int64)pGame->pIndoorCameraD3D->int_cosine_y) >> 16) - v21; - v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; -LABEL_29: - v31 = v18; - v22 = abs(v17); - if ( abs(v16) >= v22 ) - { - LODWORD(v23) = 0; - HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); - v24 = v23 / v42; - v25 = v23 / v42; - LODWORD(v23) = 0; - HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); - v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); - v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); - - //if (::uNumBillboardsToDraw >= 500) - // return; - assert(::uNumBillboardsToDraw < 500); - ++::uNumBillboardsToDraw; - ++uNumSpritesDrawnThisFrame; - - object->uAttributes |= 1; - v3->uPalette = v4->uPaletteIndex; - v3->uIndoorSectorID = object->uSectorID; - v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; - v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; - v3->pSpriteFrame = v4; - v3->_screenspace_y_scaler_packedfloat = v26; - v3->field_1E = v46; - v3->world_x = x; - v3->world_y = y; - v3->world_z = z; - v3->uScreenSpaceX = v35; - v3->uScreenSpaceY = v32; - HIWORD(v26) = HIWORD(v42); - LOWORD(v26) = 0; - v27 = (object->uAttributes & 0x20) == 0; - v3->sZValue = v26 + (PID(OBJECT_Item,i)); - v3->dimming_level = 0; - v3->sTintColor = 0; - if ( !v27 ) - { - if ( !pRenderer->pRenderD3D ) - v3->sZValue = 0; - } - } - goto LABEL_34; - } + if ( !pRenderer->pRenderD3D ) + pBillboardRenderList[::uNumBillboardsToDraw].sZValue = 0; } + //if (::uNumBillboardsToDraw >= 500) + // return; + assert(::uNumBillboardsToDraw < 500); + ++::uNumBillboardsToDraw; + ++uNumSpritesDrawnThisFrame; } - //} -LABEL_34: - ; - //++v41; - //v0 += 112; - //} - //while ( v41 < (signed int)uNumSpriteObjects ); + } + } + else + { + v42 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_sine_y) + + fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_cosine_y); + if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) + { + v17 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_cosine_y) + - fixpoint_mul(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16), pGame->pIndoorCameraD3D->int_sine_y); + v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + if ( abs(v42) >= abs(v17) ) + { + LODWORD(v23) = 0; + HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); + + object->uAttributes |= 1; + pBillboardRenderList[::uNumBillboardsToDraw].uPalette = frame->uPaletteIndex; + pBillboardRenderList[::uNumBillboardsToDraw].uIndoorSectorID = object->uSectorID; + pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = fixpoint_mul(frame->scale, v23 / v42); + pBillboardRenderList[::uNumBillboardsToDraw].pSpriteFrame = frame; + pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = fixpoint_mul(frame->scale, v23 / v42); + pBillboardRenderList[::uNumBillboardsToDraw].field_1E = v46; + pBillboardRenderList[::uNumBillboardsToDraw].world_x = x; + pBillboardRenderList[::uNumBillboardsToDraw].world_y = y; + pBillboardRenderList[::uNumBillboardsToDraw].world_z = z; + pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceX = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v23 / v42, v17) + 0x8000) >> 16); + pBillboardRenderList[::uNumBillboardsToDraw].uScreenSpaceY = pViewport->uScreenCenterY - (((unsigned int)fixpoint_mul(v23 / v42, v18) + 0x8000) >> 16); + HIWORD(v26) = HIWORD(v42); + LOWORD(v26) = 0; + pBillboardRenderList[::uNumBillboardsToDraw].sZValue = v26 + (PID(OBJECT_Item,i)); + pBillboardRenderList[::uNumBillboardsToDraw].dimming_level = 0; + pBillboardRenderList[::uNumBillboardsToDraw].sTintColor = 0; + if ( !(object->uAttributes & 0x20) ) + { + if ( !pRenderer->pRenderD3D ) + pBillboardRenderList[::uNumBillboardsToDraw].sZValue = 0; + } + //if (::uNumBillboardsToDraw >= 500) + // return; + assert(::uNumBillboardsToDraw < 500); + ++::uNumBillboardsToDraw; + ++uNumSpritesDrawnThisFrame; + } + } + } + } } }