# HG changeset patch # User Ritor1 # Date 1386850028 -21600 # Node ID 52415f8bf7c2fa37014227ab4f59aa61c8eef302 # Parent a869b0376b4819cab8949d090529b093a8210004 RasterLine2D (continue) diff -r a869b0376b48 -r 52415f8bf7c2 Indoor.cpp --- a/Indoor.cpp Thu Dec 12 13:55:42 2013 +0600 +++ b/Indoor.cpp Thu Dec 12 18:07:08 2013 +0600 @@ -2676,9 +2676,6 @@ return true; } - - - //----- (0046F228) -------------------------------------------------------- void BLV_UpdateDoors() { diff -r a869b0376b48 -r 52415f8bf7c2 Mouse.cpp --- a/Mouse.cpp Thu Dec 12 13:55:42 2013 +0600 +++ b/Mouse.cpp Thu Dec 12 18:07:08 2013 +0600 @@ -228,81 +228,61 @@ //----- (00469CCD) -------------------------------------------------------- void Mouse::DrawCursor() { - Mouse *v1; // esi@1 - char v11; // zf@6 - signed int v3; // eax@6 - signed int v4; // ecx@6 - Vec4_int_ *v5; // edx@21 - int v6; // edi@21 - int v7; // ebx@21 - int v8; // eax@29 unsigned int v9; // eax@31 - v1 = this; if ( this->bInitialized ) { if ( !this->field_8 && this->bActive && !this->field_C ) pMouse->_469AE4(); - v11 = v1->field_C == 0; - v3 = v1->uMouseClickX; - v4 = v1->uMouseClickY; - v1->field_F4 = 1; - if ( !v11 ) - goto LABEL_12; + this->field_F4 = 1; + if ( this->field_C ) + { + this->field_F4 = 0; + return; + } if ( pRenderer->bWindowMode ) { - if ( v3 < 0 || v4 < 0 || v3 > 639 || v4 > 479 ) + if ( this->uMouseClickX < 0 || this->uMouseClickY < 0 || this->uMouseClickX > 639 || this->uMouseClickY > 479 ) { -LABEL_12: - v1->field_F4 = 0; + this->field_F4 = 0; return; } } else { - if ( v3 < 0 ) - v3 = 0; - if ( v4 < 0 ) - v4 = 0; - if ( v3 > 639 ) - v3 = 639; - if ( v4 > 479 ) - v4 = 479; + if ( this->uMouseClickX < 0 ) + this->uMouseClickX = 0; + if ( this->uMouseClickY < 0 ) + this->uMouseClickY = 0; + if ( this->uMouseClickX > 639 ) + this->uMouseClickX = 639; + if ( this->uMouseClickY > 479 ) + this->uMouseClickY = 479; } - v5 = &v1->pCursorBitmapRect; - v6 = v3 + v1->uCursorBitmapPitch; - v7 = v4 + v1->field_5C[0]; - v1->pCursorBitmapRect.y = v4; - v1->pCursorBitmapRect.x = v3; - v1->pCursorBitmapRect.z = v6; - v1->pCursorBitmapRect.w = v7; - if ( v3 < 0 ) - v5->x = 0; - if ( v4 < 0 ) - v1->pCursorBitmapRect.y = 0; - if ( v6 > 640 ) - v1->pCursorBitmapRect.z = 640; - if ( v7 > 480 ) - v1->pCursorBitmapRect.w = 480; - v8 = v1->pCursorBitmapRect.z; - v1->bActive = 0; - v1->uCursorBitmapWidth = v8 - v5->x; - v11 = v1->bRedraw == 0; - v1->uCursorBitmapHeight = v1->pCursorBitmapRect.w - v1->pCursorBitmapRect.y; - if ( !v11 ) + this->pCursorBitmapRect.x = this->uMouseClickX; + this->pCursorBitmapRect.w = this->uMouseClickY + this->field_5C[0]; + this->pCursorBitmapRect.y = this->uMouseClickY; + this->pCursorBitmapRect.z = this->uMouseClickX + this->uCursorBitmapPitch; + if ( this->uMouseClickX < 0 ) + this->pCursorBitmapRect.x = 0; + if ( this->uMouseClickY < 0 ) + this->pCursorBitmapRect.y = 0; + if ( this->pCursorBitmapRect.z > 640 ) + this->pCursorBitmapRect.z = 640; + if ( this->pCursorBitmapRect.w > 480 ) + this->pCursorBitmapRect.w = 480; + this->bActive = 0; + this->uCursorBitmapWidth = this->pCursorBitmapRect.z - this->pCursorBitmapRect.x; + this->uCursorBitmapHeight = this->pCursorBitmapRect.w - this->pCursorBitmapRect.y; + if ( this->bRedraw ) { if ( pMouse->ptr_90 ) v9 = 2 * pMouse->uCursorBitmapPitch; else v9 = 0; - pRenderer->_4A6DF5( - v1->pCursorBitmap_sysmem, - v9, - &v1->pCursorBitmapPos, - pRenderer->pTargetSurface, - pRenderer->uTargetSurfacePitch, - &v1->pCursorBitmapRect); - v1->bRedraw = false; + pRenderer->_4A6DF5( this->pCursorBitmap_sysmem, v9, &this->pCursorBitmapPos, pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch, + &this->pCursorBitmapRect);//срабатывает когда берём курсором вещь в инвенторе + this->bRedraw = false; } } } diff -r a869b0376b48 -r 52415f8bf7c2 Render.cpp --- a/Render.cpp Thu Dec 12 13:55:42 2013 +0600 +++ b/Render.cpp Thu Dec 12 18:07:08 2013 +0600 @@ -3563,19 +3563,12 @@ //----- (004A0BEE) -------------------------------------------------------- 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 unsigned int v8; // ebx@5 - int v9; // eax@7 unsigned int v10; // ecx@9 unsigned int v11; // esi@13 int v12; // eax@17 int v13; // eax@21 - Render *v14; // edi@21 - int v15; // eax@25 int v16; // eax@27 - signed int v17; // eax@28 - signed int v18; // edi@30 signed __int64 v19; // qax@41 int v20; // edi@41 unsigned int v21; // edi@46 @@ -3590,8 +3583,6 @@ int v30; // ebx@60 int v31; // edx@61 int v32; // edi@61 - int v34; // [sp+Ch] [bp-10h]@3 - Render *v35; // [sp+10h] [bp-Ch]@1 __int64 v36; // [sp+14h] [bp-8h]@1 signed int v37; // [sp+18h] [bp-4h]@28 unsigned int uXa; // [sp+24h] [bp+8h]@49 @@ -3600,29 +3591,24 @@ int uZa; // [sp+2Ch] [bp+10h]@38 v36 = 0i64; - v6 = this->raster_clip_x; - v35 = this; - if ( (signed int)uX < v6 ) + if ( (signed int)uX < this->raster_clip_x ) HIDWORD(v36) = 8; - v34 = this->raster_clip_z; if ( (signed int)uX > this->raster_clip_z ) - HIDWORD(v36) |= 4u; - v7 = this->raster_clip_y; + HIDWORD(v36) |= 4; v8 = uY; - if ( (signed int)uY < v7 ) - HIDWORD(v36) |= 2u; - v9 = this->raster_clip_w; - if ( (signed int)uY > v9 ) - HIDWORD(v36) |= 1u; + if ( (signed int)uY < this->raster_clip_y ) + HIDWORD(v36) |= 2; + if ( (signed int)uY > this->raster_clip_w ) + HIDWORD(v36) |= 1; v10 = uZ; - if ( (signed int)uZ < v6 ) + if ( (signed int)uZ < this->raster_clip_x ) LODWORD(v36) = 8; - if ( (signed int)uZ > v34 ) + if ( (signed int)uZ > this->raster_clip_z ) LODWORD(v36) = v36 | 4; v11 = uW; - if ( (signed int)uW < v7 ) + if ( (signed int)uW < this->raster_clip_y ) LODWORD(v36) = v36 | 2; - if ( (signed int)uW > v9 ) + if ( (signed int)uW > this->raster_clip_w ) LODWORD(v36) = v36 | 1; LOBYTE(v12) = v36; if ( (unsigned int)v36 & HIDWORD(v36) ) @@ -3656,10 +3642,10 @@ v25 = 0; //__debugbreak(); //target sruface will most likely be 32bits/pixel, but this sub awaits 16 bits - v26 = (unsigned __int16 *)v35->pTargetSurface; + v26 = (unsigned __int16 *)this->pTargetSurface; if ( v26 ) { - if ( (signed int)uXa <= v23 ) + if ( (signed int)uXa <= v23 )//рисуем вертикальную линию { v30 = v23 + 1; if ( v30 > 0 ) @@ -3667,7 +3653,7 @@ v31 = 2 * v24; v32 = 2 * v21; v12 = (int)&v26[v12]; - do + for ( v30; v30; --v30 ) { v25 += uXa; *(short *)v12 = uColor; @@ -3677,12 +3663,10 @@ v25 -= uYb; v12 += v31; } - --v30; } - while ( v30 ); } } - else + else//рисуем горизонтальную линию { v27 = uXa + 1; if ( (signed int)(uXa + 1) > 0 ) @@ -3690,7 +3674,7 @@ v28 = 2 * v21; v29 = 2 * v24; v12 = (int)&v26[v12]; - do + for ( v27; v27; --v27 ) { v25 += uYb; *(short *)v12 = uColor; @@ -3700,9 +3684,7 @@ v25 -= uXa; v12 += v28; } - --v27; } - while ( v27 ); } } } @@ -3713,46 +3695,41 @@ { if ( BYTE4(v36) & 8 ) { - v13 = (signed int)((uW - uY) * (v6 - uX)) / (signed int)(uZ - uX); - v14 = v35; + v13 = (signed int)((uW - uY) * (this->raster_clip_x - uX)) / (signed int)(uZ - uX); v8 = v13 + uY; - uX = v35->raster_clip_x; + uX = this->raster_clip_x; goto LABEL_24; } - v10 = v6; - v11 = (signed int)((uY - uW) * (v6 - uZ)) / (signed int)(uX - uZ) + uW; - } - v14 = v35; + v10 = this->raster_clip_x; + v11 = (signed int)((uY - uW) * (this->raster_clip_x - uZ)) / (signed int)(uX - uZ) + uW; + } LABEL_24: if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) { - v15 = v14->raster_clip_z; + //v15 = this->raster_clip_z; if ( BYTE4(v36) & 4 ) { - v14 = v35; - v8 += (signed int)((v11 - v8) * (v15 - uX)) / (signed int)(v10 - uX); - uX = v35->raster_clip_z; + v8 += (signed int)((v11 - v8) * (this->raster_clip_z - uX)) / (signed int)(v10 - uX); + uX = this->raster_clip_z; } else { - v16 = (signed int)((v8 - v11) * (v15 - v10)) / (signed int)(uX - v10); - v10 = v14->raster_clip_z; + v16 = (signed int)((v8 - v11) * (this->raster_clip_z - v10)) / (signed int)(uX - v10); + v10 = this->raster_clip_z; v11 += v16; } } - v17 = v14->raster_clip_y; v37 = 0; - uYa = v14->raster_clip_y; - if ( (signed int)v8 < v17 ) + uYa = this->raster_clip_y; + if ( (signed int)v8 < this->raster_clip_y ) v37 = 2; - v18 = v14->raster_clip_w; - if ( (signed int)v8 > v18 ) - v37 |= 1u; - if ( (signed int)v11 >= v17 ) + if ( (signed int)v8 > this->raster_clip_w ) + v37 |= 1; + if ( (signed int)v11 >= this->raster_clip_y ) v12 = 0; else v12 = 2; - if ( (signed int)v11 > v18 ) + if ( (signed int)v11 > this->raster_clip_w ) LOBYTE(v12) = v12 | 1; if ( !(v12 & v37) ) { @@ -3763,8 +3740,8 @@ if ( v37 & 2 ) { uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); - LOBYTE(v12) = (char)v35; - v8 = v35->raster_clip_y; + LOBYTE(v12) = (char)this; + v8 = this->raster_clip_y; } else { @@ -3779,14 +3756,14 @@ { if ( v37 & 1 ) { - uX += (signed int)((v10 - uX) * (v35->raster_clip_w - v8)) / (signed int)(v11 - v8); - LOBYTE(v12) = (char)v35; - v8 = v35->raster_clip_w; + uX += (signed int)((v10 - uX) * (this->raster_clip_w - v8)) / (signed int)(v11 - v8); + LOBYTE(v12) = (char)this; + v8 = this->raster_clip_w; } else { - v12 = (signed int)((uX - v10) * (v35->raster_clip_w - v11)) / (signed int)(v8 - v11); - v11 = v35->raster_clip_w; + v12 = (signed int)((uX - v10) * (this->raster_clip_w - v11)) / (signed int)(v8 - v11); + v11 = this->raster_clip_w; v10 += v12; } } @@ -7050,47 +7027,25 @@ //----- (004A6DF5) -------------------------------------------------------- void Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) { - int result; // eax@0 int v8; // ecx@3 - unsigned __int16 *v9; // edi@4 unsigned __int16 *v10; // ebx@4 int v11; // esi@4 - unsigned __int16 *pBitmapa; // [sp+14h] [bp+8h]@3 - unsigned __int16 *pTargeta; // [sp+20h] [bp+14h]@3 if ( !pBitmap || !pTarget) return; - pBitmapa = &pBitmap[pBitmapXY->x + uBitmapPitch * pBitmapXY->y]; - - __debugbreak(); // sub expects 16bit target surface, we may have 32bit - pTargeta = (unsigned short *)pTarget + a7->x + uTargetPitch * a7->y; - v8 = a7->z - a7->x; - v11 = a7->w - a7->y; - if ( v11 > 0 ) - { - v9 = pBitmapa; - v10 = pTargeta; - do - { - if ( v8 > 0 ) - { - result = v8; - do - { - *v9 = *v10; - ++v9; - ++v10; - --result; - } - while ( result ); - } - v9 += uBitmapPitch - v8; - v10 += uTargetPitch - v8; - --v11; - } - while ( v11 ); - } + v8 = a7->z - a7->x; + v11 = a7->w - a7->y; + v10 = (unsigned short *)pTarget + a7->x + uTargetPitch * a7->y; + for ( int y = 0; y < v11; ++y ) + { + for ( int x = 0; x < v8; ++x ) + { + WritePixel16(a7->x + x, a7->y + y, *v10); + ++v10; + } + v10 += uTargetPitch - v8; + } } //----- (004A6D87) -------------------------------------------------------- diff -r a869b0376b48 -r 52415f8bf7c2 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Thu Dec 12 13:55:42 2013 +0600 +++ b/UI/UICharacter.cpp Thu Dec 12 18:07:08 2013 +0600 @@ -1387,11 +1387,11 @@ } else { - if ( item->uAttributes & 2 ) + if ( item->uAttributes & ITEM_BROKEN ) pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); else { - if ( item->uAttributes & 1 ) + if ( item->uAttributes & ITEM_IDENTIFIED ) pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(v127)); else pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(v127)); diff -r a869b0376b48 -r 52415f8bf7c2 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Thu Dec 12 13:55:42 2013 +0600 +++ b/UI/UIPopup.cpp Thu Dec 12 18:07:08 2013 +0600 @@ -485,9 +485,8 @@ memcpy(&pMonsterInfoUI_Doll, &pActors[uActorID], sizeof(pMonsterInfoUI_Doll)); pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; pMonsterInfoUI_Doll.uCurrentActionTime = 0; - v8 = rand(); - v9 = v8 % 256 + 128; - pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128; + v9 = rand() % 256 + 128; + pMonsterInfoUI_Doll.uCurrentActionLength = v9; } if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) @@ -523,11 +522,11 @@ v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); v106.sZValue = 0; v106.uFlags = 0; - pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu); - pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu)); - pRenderer->RasterLine2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu)); - pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu)); - pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu)); + pRenderer->SetRasterClipRect(0, 0, 639, 479); + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная верхняя линия + pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, Color16(0xE1u, 255, 0x9Bu));//горизонтальная нижняя линия + pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//левая вертикальная линия + pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, Color16(0xE1u, 255, 0x9Bu));//правая вертикальная линия if ( pRenderer->pRenderD3D ) { v106.uScreenSpaceY = v115 + v106.uViewportY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; @@ -634,7 +633,7 @@ pDesc.dwWidth * src_x / pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth; uint b = src[idx] & 0x1F; //*dst++ = b | 2 * (src[idx] & 0xFFE0); - pRenderer->WritePixel16(y, x, b | 2 * (src[idx] & 0xFFE0)); + pRenderer->WritePixel16(x, y, b | 2 * (src[idx] & 0xFFE0)); } } pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->Unlock(0);