Mercurial > mm7
changeset 724:737d7fec67f0
Слияние
author | Ritor1 |
---|---|
date | Thu, 21 Mar 2013 16:09:59 +0600 |
parents | 256211e8243a (current diff) af08fc9e29c8 (diff) |
children | 7037f22cd716 |
files | Indoor.cpp Render.cpp Render.h mm7_2.cpp mm7_3.cpp mm7_5.cpp |
diffstat | 10 files changed, 262 insertions(+), 247 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIProgressBar.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/GUIProgressBar.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -214,7 +214,7 @@ goto LABEL_6; pRenderer->DrawTextureRGB(0, 0, &pLoadingBg); - pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); + pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu); pRenderer->Clip(0xACu, 0x1CBu, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 0x1D7u);
--- a/Indoor.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/Indoor.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -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/Render.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/Render.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -4749,10 +4749,10 @@ v1->field_4002C = 0; v1->pActiveZBuffer = 0; v1->pDefaultZBuffer = 0; - v1->field_20_clipy = 0; - v1->field_1C_clipx = 0; - v1->field_24_width = 639; - v1->field_28_height = 479; + v1->raster_clip_y = 0; + v1->raster_clip_x = 0; + v1->raster_clip_z = 639; + v1->raster_clip_w = 479; v1->field_4003C = (int)&unk_4EED80; v1->field_40040 = dword_4EED78; v1->uClipZ = 640; @@ -6294,7 +6294,7 @@ //----- (004A0BEE) -------------------------------------------------------- -char Render::Line2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) +char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) { int v6; // edi@1 int v7; // edx@5 @@ -6333,18 +6333,18 @@ int uZa; // [sp+2Ch] [bp+10h]@38 v36 = 0i64; - v6 = this->field_1C_clipx; + v6 = this->raster_clip_x; v35 = this; if ( (signed int)uX < v6 ) HIDWORD(v36) = 8; - v34 = this->field_24_width; - if ( (signed int)uX > this->field_24_width ) + v34 = this->raster_clip_z; + if ( (signed int)uX > this->raster_clip_z ) HIDWORD(v36) |= 4u; - v7 = this->field_20_clipy; + v7 = this->raster_clip_y; v8 = uY; if ( (signed int)uY < v7 ) HIDWORD(v36) |= 2u; - v9 = this->field_28_height; + v9 = this->raster_clip_w; if ( (signed int)uY > v9 ) HIDWORD(v36) |= 1u; v10 = uZ; @@ -6447,7 +6447,7 @@ v13 = (signed int)((uW - uY) * (v6 - uX)) / (signed int)(uZ - uX); v14 = v35; v8 = v13 + uY; - uX = v35->field_1C_clipx; + uX = v35->raster_clip_x; goto LABEL_24; } v10 = v6; @@ -6457,26 +6457,26 @@ LABEL_24: if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) { - v15 = v14->field_24_width; + v15 = v14->raster_clip_z; if ( BYTE4(v36) & 4 ) { v14 = v35; v8 += (signed int)((v11 - v8) * (v15 - uX)) / (signed int)(v10 - uX); - uX = v35->field_24_width; + uX = v35->raster_clip_z; } else { v16 = (signed int)((v8 - v11) * (v15 - v10)) / (signed int)(uX - v10); - v10 = v14->field_24_width; + v10 = v14->raster_clip_z; v11 += v16; } } - v17 = v14->field_20_clipy; + v17 = v14->raster_clip_y; v37 = 0; - uYa = v14->field_20_clipy; + uYa = v14->raster_clip_y; if ( (signed int)v8 < v17 ) v37 = 2; - v18 = v14->field_28_height; + v18 = v14->raster_clip_w; if ( (signed int)v8 > v18 ) v37 |= 1u; if ( (signed int)v11 >= v17 ) @@ -6495,7 +6495,7 @@ { uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); LOBYTE(v12) = (char)v35; - v8 = v35->field_20_clipy; + v8 = v35->raster_clip_y; } else { @@ -6510,14 +6510,14 @@ { if ( v37 & 1 ) { - uX += (signed int)((v10 - uX) * (v35->field_28_height - v8)) / (signed int)(v11 - v8); + uX += (signed int)((v10 - uX) * (v35->raster_clip_w - v8)) / (signed int)(v11 - v8); LOBYTE(v12) = (char)v35; - v8 = v35->field_28_height; + v8 = v35->raster_clip_w; } else { - v12 = (signed int)((uX - v10) * (v35->field_28_height - v11)) / (signed int)(v8 - v11); - v11 = v35->field_28_height; + v12 = (signed int)((uX - v10) * (v35->raster_clip_w - v11)) / (signed int)(v8 - v11); + v11 = v35->raster_clip_w; v10 += v12; } } @@ -6537,12 +6537,12 @@ //----- (004A0E97) -------------------------------------------------------- -void Render::Clip_v2(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) -{ - this->field_1C_clipx = uX; - this->field_20_clipy = uY; - this->field_24_width = uZ; - this->field_28_height = uW; +void Render::SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) +{ + this->raster_clip_x = uX; + this->raster_clip_y = uY; + this->raster_clip_z = uZ; + this->raster_clip_w = uW; }
--- a/Render.h Thu Mar 21 16:09:44 2013 +0600 +++ b/Render.h Thu Mar 21 16:09:59 2013 +0600 @@ -290,9 +290,9 @@ void CreateSomeTexture(); bool InitializeFullscreen(HWND hWnd); bool SwitchToWindow(HWND hWnd); - char Line2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor); + char RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor); void ClearZBuffer(int a2, int a3); - void Clip_v2(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); + void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); void ParseTargetPixelFormat(); bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags); bool LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags); @@ -380,10 +380,10 @@ int field_10; int field_14; int field_18_locked_pitch; - int field_1C_clipx; - int field_20_clipy; - int field_24_width; - int field_28_height; + int raster_clip_x; + int raster_clip_y; // clipping rect for raster ops + int raster_clip_z; // like RasterLine2D for (mini)map + int raster_clip_w; __int16 field_2C[65536]; __int16 field_2002C[65536]; int field_4002C;
--- a/UIBooks.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/UIBooks.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -1131,7 +1131,7 @@ screenCenter_X = (signed int)(tl_x + br_x) >> 1; screenCenterY = (signed int)(tl_y + br_y) >> 1; surfPitch = pRenderer->uTargetSurfacePitch; - pRenderer->Clip_v2(tl_x, tl_y, br_x, br_y); + pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); v5 = viewparams->field_2C; v6 = viewparams->sViewCenterX; v86 = viewparams->sViewCenterX; @@ -1248,7 +1248,7 @@ v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16; v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; - pRenderer->Line2D( + pRenderer->RasterLine2D( screenCenter_X + v88, screenCenterY - v87, screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), @@ -1283,7 +1283,7 @@ v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; - pRenderer->Line2D( + pRenderer->RasterLine2D( screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), @@ -1401,17 +1401,17 @@ v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); v55 = screenCenterY - (int)v97; - if ( v54 >= pRenderer->field_1C_clipx ) + if ( v54 >= pRenderer->raster_clip_x ) { - if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) + if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) { v74 = v86; if ( v5 > 512 ) { v96 = v55 + 1; black = v55 - 1; - pRenderer->Line2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); - pRenderer->Line2D(v54, black, v54, v96, v86); + pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); + pRenderer->RasterLine2D(v54, black, v54, v96, v86); ++v54; v74 = v86; v72 = v96; @@ -1424,7 +1424,7 @@ v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; v70 = screenCenterY - (int)v97; } - pRenderer->Line2D(v54, v70, v71, v72, v74); + pRenderer->RasterLine2D(v54, v70, v71, v72, v74); } } }
--- a/UIPopup.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/UIPopup.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -820,11 +820,11 @@ v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); v106.sZValue = 0; v106.uFlags = 0; - pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); - pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); - pRenderer->Line2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5); - pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); - pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); + pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu); + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); + pRenderer->RasterLine2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5); + pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); if ( pRenderer->pRenderD3D ) { v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]];
--- a/UiGame.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/UiGame.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -1493,7 +1493,7 @@ } } - //----- (00441D38) -------------------------------------------------------- +//----- (00441D38) -------------------------------------------------------- void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) { int uHeight; // ebx@6 @@ -1526,14 +1526,14 @@ int v47; // eax@108 unsigned int v48; // ebx@114 unsigned int v49; // ST64_4@114 - unsigned int v51; // [sp-10h] [bp-64h]@79 + //unsigned int v51; // [sp-10h] [bp-64h]@79 unsigned int v52; // [sp-10h] [bp-64h]@100 - unsigned int v53; // [sp-Ch] [bp-60h]@79 + //unsigned int v53; // [sp-Ch] [bp-60h]@79 unsigned int v54; // [sp-Ch] [bp-60h]@100 - unsigned int v55; // [sp-8h] [bp-5Ch]@77 + //unsigned int v55; // [sp-8h] [bp-5Ch]@77 unsigned int v56; // [sp-8h] [bp-5Ch]@100 //signed int v57; // [sp-4h] [bp-58h]@54 - unsigned __int16 v58; // [sp-4h] [bp-58h]@77 + //unsigned __int16 v58; // [sp-4h] [bp-58h]@77 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 unsigned __int16 v60; // [sp+10h] [bp-44h]@66 unsigned int v61; // [sp+10h] [bp-44h]@85 @@ -1549,12 +1549,12 @@ int v73; // [sp+2Ch] [bp-28h]@30 int v76; // [sp+34h] [bp-20h]@91 int v77; // [sp+34h] [bp-20h]@108 - int v79; // [sp+38h] [bp-1Ch]@72 - char *a2c; // [sp+40h] [bp-14h]@68 + //int v79; // [sp+38h] [bp-1Ch]@72 + //char *a2c; // [sp+40h] [bp-14h]@68 signed int uCenterY; // [sp+48h] [bp-Ch]@1 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 signed int uWidth; // [sp+5Ch] [bp+8h]@30 - signed int uZe; // [sp+5Ch] [bp+8h]@67 + //signed int uZe; // [sp+5Ch] [bp+8h]@67 signed int uZf; // [sp+5Ch] [bp+8h]@85 signed int uZg; // [sp+5Ch] [bp+8h]@105 unsigned int uWa; // [sp+60h] [bp+Ch]@23 @@ -1577,7 +1577,9 @@ bWizardEyeActive = true; uWizardEyeSkillLevel = 2; } - pRenderer->Clip_v2(uX, uY, uZ - 1, uW - 1); + bWizardEyeActive = true; + uWizardEyeSkillLevel = 3; + pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); uHeight = uW - uY; uWidth = uZ - uX; @@ -1712,7 +1714,7 @@ v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; if ( v15 > 100 ) v15 = 100; - pRenderer->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); + pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); } } @@ -1721,7 +1723,7 @@ { //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; - pRenderer->Line2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom + pRenderer->RasterLine2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), uCenterY @@ -1748,64 +1750,65 @@ uint arrow_idx = floorf(0.5f + 7 * angle); pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); - flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); - v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); + flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 255); + v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0); if (bWizardEyeActive) { - uZe = 0; - //for (uint i = 0; i < uNumSpriteObjects; ++i) - if (uNumSpriteObjects > 0) - { - a2c = (char *)&pSpriteObjects[0].uObjectDescID; - while ( 1 ) + //uZe = 0; + if (uWizardEyeSkillLevel >= 2) + for (uint i = 0; i < uNumSpriteObjects; ++i) + //if (uNumSpriteObjects > 0) + { + auto object = pSpriteObjects + i; + + //a2c = (char *)&pSpriteObjects[0].uObjectDescID; + //while ( 1 ) + //{ + if (!object->uType || !object->uObjectDescID) + continue; + //if (uWizardEyeSkillLevel == 1 + v37 = uCenterX + ((unsigned __int64)((object->vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); + //v79 = (unsigned __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; + //v38 = uCenterY - v79; + v38 = uCenterY - ((signed __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); + if (v37 < pRenderer->raster_clip_x || v37 > pRenderer->raster_clip_z || + v38 < pRenderer->raster_clip_y || v38 > pRenderer->raster_clip_w) + continue; + + assert(uZoom >= 512); + if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) { - if ( !*((short *)a2c - 1) - || !*(short *)a2c - || uWizardEyeSkillLevel == 1 - || (v37 = ((unsigned __int64)((*(int *)(a2c + 2) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uCenterX, - v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16, - v38 = uCenterY - v79, - v37 < pRenderer->field_1C_clipx) - || v37 > pRenderer->field_24_width - || v38 < pRenderer->field_20_clipy - || v38 > pRenderer->field_28_height ) - goto LABEL_83; - if ( pObjectList->pObjects[*(short *)a2c].uFlags & 0x10 ) - break; - if ( (signed int)uZoom > 512 ) - { - pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); - pRenderer->Line2D(v37, v38 - 2, v37, v38 + 1, flagsb); - pRenderer->Line2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); - pRenderer->Line2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); - v37 += 2; - v58 = flagsb; - v55 = v38 + 1; - goto LABEL_81; - } - pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, uCenterY - v79, flagsb); - v58 = flagsb; - v55 = uCenterY - v79; - v53 = v37; - v51 = v38 - 1; -LABEL_82: - pRenderer->Line2D(v37, v51, v53, v55, v58); -LABEL_83: - ++uZe; - a2c += 112; - if ( uZe >= (signed int)uNumSpriteObjects ) - { - goto LABEL_85; - } + pRenderer->RasterLine2D(v37, v38, + v37, v38, v60); + } + else if (uZoom > 512) + { + pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); + pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, flagsb); + pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); + pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); + pRenderer->RasterLine2D(v37 + 2, v38, + v37 + 2, v38 + 1, flagsb); } - v58 = v60; - v55 = uCenterY - v79; -LABEL_81: - v53 = v37; - v51 = uCenterY - v79; - goto LABEL_82; + else + { + pRenderer->RasterLine2D(v37 - 1, v38 - 1, + v37 - 1, v38, flagsb); + pRenderer->RasterLine2D(v37, v38 - 1, + v37, v38, flagsb); + } +//LABEL_82: +//LABEL_83: + //++uZe; + //a2c += 112; + //if ( uZe >= (signed int)uNumSpriteObjects ) + //{ + //goto LABEL_85; + //} + //} } + + LABEL_85: v63 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0); v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 255, 0); @@ -1825,9 +1828,9 @@ v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; v41 = uCenterY - v76; - if ( v40 >= pRenderer->field_1C_clipx ) + if ( v40 >= pRenderer->raster_clip_x ) { - if ( v40 <= pRenderer->field_24_width && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_height ) + if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w ) { uWd = v61; if ( BYTE3(flagsc->uAttributes) & 1 ) @@ -1836,13 +1839,13 @@ uWd = v65; if ( (signed int)uZoom > 1024 ) { - pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); - pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd); - pRenderer->Line2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); + pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); + pRenderer->RasterLine2D(v40, v41 - 2, v40, v41 + 2, uWd); + pRenderer->RasterLine2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); v42 = v41 + 1; v43 = v41 - 1; v44 = v42; - pRenderer->Line2D(v40 - 2, v43, v40 - 2, v42, uWd); + pRenderer->RasterLine2D(v40 - 2, v43, v40 - 2, v42, uWd); v40 += 2; v59 = uWd; v56 = v44; @@ -1851,13 +1854,13 @@ } else { - pRenderer->Line2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); + pRenderer->RasterLine2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); v59 = uWd; v56 = uCenterY - v76; v54 = v40; v52 = v41 - 1; } - pRenderer->Line2D(v40, v52, v54, v56, v59); + pRenderer->RasterLine2D(v40, v52, v54, v56, v59); } } } @@ -1867,6 +1870,8 @@ while ( uZf < (signed int)uNumActors ); } } + + flagsd = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255); uZg = 0; if ( (signed int)uNumLevelDecorations > 0 ) @@ -1881,22 +1886,22 @@ + uCenterX; v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; v47 = uCenterY - v77; - if ( v46 >= pRenderer->field_1C_clipx ) + if ( v46 >= pRenderer->raster_clip_x ) { - if ( v46 <= pRenderer->field_24_width && v47 >= pRenderer->field_20_clipy && v47 <= pRenderer->field_28_height ) + if ( v46 <= pRenderer->raster_clip_z && v47 >= pRenderer->raster_clip_y && v47 <= pRenderer->raster_clip_w ) { if ( (signed int)uZoom > 512 ) { v48 = v47 + 1; v49 = v47 - 1; - pRenderer->Line2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); - pRenderer->Line2D(v46, v49, v46, v48, flagsd); - pRenderer->Line2D(v46 + 1, v49, v46 + 1, v48, flagsd); + pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); + pRenderer->RasterLine2D(v46, v49, v46, v48, flagsd); + pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, flagsd); v45 = lPitchb; } else { - pRenderer->Line2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); + pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); } } }
--- a/mm7_2.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/mm7_2.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -10093,7 +10093,7 @@ dword_6BE364_game_settings_1 |= 0x4000; pGame->InitializeGammaController(); SecondaryInitialization(); - pRenderer->Clip_v2(0, 0, 639u, 479u); + pRenderer->SetRasterClipRect(0, 0, 639u, 479u); FinalInitialization(); Log::Warning(L"MM: entering main loop");
--- a/mm7_3.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/mm7_3.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -11173,19 +11173,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 @@ -11193,17 +11193,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; @@ -11214,7 +11234,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); @@ -11235,23 +11255,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 @@ -11259,24 +11280,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; @@ -11284,39 +11308,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); - } - } + } + } } @@ -11334,15 +11336,15 @@ int v9; // ecx@12 unsigned __int16 v10; // ax@12 int *v11; // eax@20 - char v12; // zf@26 - int v18; // ST5C_4@27 + //char v12; // zf@26 + __int64 v18; // ST5C_4@27 signed __int64 v19; // qtt@28 int v20; // ST5C_4@28 - int v21; // edx@29 + //int v21; // edx@29 __int16 v22; // ax@29 - int v23; // eax@29 + //int v23; // eax@29 SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12 - __int16 a5; // [sp+28h] [bp-34h]@12 + //__int16 a5; // [sp+28h] [bp-34h]@12 int a6; // [sp+2Ch] [bp-30h]@12 int a2; // [sp+30h] [bp-2Ch]@12 int a1; // [sp+34h] [bp-28h]@12 @@ -11369,7 +11371,7 @@ && (v2 < 811 || v2 >= 815) || pGame->pStru6Instance->_4A81CA(p)) { - a5 = p->uSectorID; + //a5 = p->uSectorID; a1 = p->vPosition.x; a2 = p->vPosition.y; a3 = p->vPosition.z; @@ -11389,8 +11391,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 ) @@ -11409,7 +11410,7 @@ a1, a2, a3, - a5, + p->uSectorID, a6, v1->uParticleTrailColorR, v1->uParticleTrailColorG, @@ -11426,15 +11427,27 @@ 1) ) { pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35); - if ( (signed int)uNumBillboardsToDraw >= 500 ) - return; + + assert(uNumBillboardsToDraw < 500); + //if ( (signed int)uNumBillboardsToDraw >= 500 ) + // return; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; p->uAttributes |= 1u; - v12 = pRenderer->pRenderD3D == 0; + //v12 = pRenderer->pRenderD3D == 0; v3->uPalette = v24->uPaletteIndex; - v3->uIndoorSectorID = a5; - if ( v12 ) + v3->uIndoorSectorID = p->uSectorID; + if ( pRenderer->pRenderD3D ) + { + v3->fov_x = pGame->pIndoorCameraD3D->fov_x; + v3->fov_y = pGame->pIndoorCameraD3D->fov_y; + LODWORD(v18) = 0; + HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f); + v18 = v18 / x; + v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16; + v31 = (unsigned __int64)(v24->scale * v18) >> 16; + } + else { LODWORD(v19) = pBLVRenderParams->field_40 << 16; HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; @@ -11442,15 +11455,8 @@ v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; } - else - { - v3->fov_x = pGame->pIndoorCameraD3D->fov_x; - v3->fov_y = pGame->pIndoorCameraD3D->fov_y; - v18 = (int)floorf(v3->fov_x + 0.5f) / x; - v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * (__int64)v18) >> 16; - v31 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16; - } - HIWORD(v21) = HIWORD(x); + //HIWORD(v21) = HIWORD(x); + //LOWORD(v21) = 0; v3->_screenspace_y_scaler_packedfloat = v31; v3->field_1E = v34; v3->world_x = a1; @@ -11460,13 +11466,14 @@ v22 = v35; v3->uTintColor = 0; v3->uScreenSpaceY = v22; - LOWORD(v21) = 0; - v23 = 8 * i; - LOBYTE(v23) = 8 * i | OBJECT_Item; + //v23 = 8 * i; + //LOBYTE(v23) = 8 * i | OBJECT_Item; v3->pSpriteFrame = v24; - v12 = (p->uAttributes & 0x20) == 0; - v3->sZValue = v21 + v23; - if ( !v12 ) + //v12 = (p->uAttributes & 0x20) == 0; + //v3->sZValue = v21 + v23; + v3->actual_z = HIWORD(x); + v3->object_pid = 8 * i | OBJECT_Item; + if (p->uAttributes & 0x20) { if ( !pRenderer->pRenderD3D ) v3->sZValue = 0;
--- a/mm7_5.cpp Thu Mar 21 16:09:44 2013 +0600 +++ b/mm7_5.cpp Thu Mar 21 16:09:59 2013 +0600 @@ -9830,18 +9830,18 @@ v3 = pXYZW; v4 = uColor; pRenderer->BeginScene(); - pRenderer->Clip_v2(0, 0, 639u, 479u); + pRenderer->SetRasterClipRect(0, 0, 639u, 479u); if ( bSolidFill ) { for ( i = v3->y; (signed int)i <= v3->w; ++i ) - pRenderer->Line2D(v3->x, i, v3->z, i, v4); + pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4); } else { - pRenderer->Line2D(v3->x, v3->y, v3->z, v3->y, v4); - pRenderer->Line2D(v3->z, v3->y, v3->z, v3->w, v4); - pRenderer->Line2D(v3->z, v3->w, v3->x, v3->w, v4); - pRenderer->Line2D(v3->x, v3->w, v3->x, v3->y, v4); + pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4); + pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4); + pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4); + pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4); } pRenderer->EndScene(); }