comparison Engine/Graphics/Render.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
comparison
equal deleted inserted replaced
2574:dd36326a9994 2575:a76d408c5132
29 #include "DecorationList.h" 29 #include "DecorationList.h"
30 #include "Engine/Objects/Actor.h" 30 #include "Engine/Objects/Actor.h"
31 #include "Lights.h" 31 #include "Lights.h"
32 #include "Level/Decoration.h" 32 #include "Level/Decoration.h"
33 #include "Vis.h" 33 #include "Vis.h"
34 #include "Engine/Registry.h"
35 #include "Weather.h" 34 #include "Weather.h"
36 #include "Engine/MMT.h" 35 #include "Engine/MMT.h"
37 36
38 37
39 //#pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") 38 //#pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
6368 return (b >> (8 - 5)) | 6367 return (b >> (8 - 5)) |
6369 0x7E0 & (g << (6 + 5 - 8)) | 6368 0x7E0 & (g << (6 + 5 - 8)) |
6370 0xF800 & (r << (6 + 5 + 5 - 8)); 6369 0xF800 & (r << (6 + 5 + 5 - 8));
6371 } 6370 }
6372 6371
6373 void Render::DrawTextureNew(float u, float v, Texture_MM7 *a4)
6374 {
6375 __debugbreak();
6376 }
6377
6378
6379 6372
6380 6373
6381 void Render::DrawTextureCustomHeight(float u, float v, class Image *img, int custom_height) 6374 void Render::DrawTextureCustomHeight(float u, float v, class Image *img, int custom_height)
6382 { 6375 {
6383 unsigned __int16 *v6; // esi@3 6376 unsigned __int16 *v6; // esi@3
6520 } 6513 }
6521 } 6514 }
6522 } 6515 }
6523 6516
6524 //----- (004A6E7E) -------------------------------------------------------- 6517 //----- (004A6E7E) --------------------------------------------------------
6525 void Render::DrawTranslucent(unsigned int a2, unsigned int a3, Texture_MM7 *a4) 6518 void Render::DrawTextureGrayShade(float u, float v, Image *img)
6526 { 6519 {
6527 int v5; // edx@4 6520 DrawMasked(u, v, img, 1, 0x7BEF);
6528 unsigned int v6; // edi@4
6529 unsigned int v7; // edx@5
6530 unsigned int v8; // edx@6
6531 unsigned int v9; // edx@7
6532 unsigned int v10; // edx@8
6533 unsigned int v11; // ebx@9
6534 unsigned int v12; // esi@11
6535 unsigned int v13; // edx@12
6536 unsigned int v14; // ebx@15
6537 unsigned int v15; // esi@17
6538 unsigned int v16; // edi@18
6539 int v18; // [sp+14h] [bp-Ch]@4
6540 int v19; // [sp+18h] [bp-8h]@4
6541 unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4
6542
6543 if ( this->uNumSceneBegins && a4 && a4->pPalette16 )
6544 {
6545 //v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch];
6546 v20 = a4->paletted_pixels;
6547 v5 = a4->uTextureWidth;
6548 v6 = a4->uTextureHeight;
6549 v19 = a4->uTextureWidth;
6550 v18 = a4->uTextureWidth;
6551 int clipped_out_x = a2;
6552 int clipped_out_y = a3;
6553 if ( this->bClip )
6554 {
6555 v7 = this->uClipX;
6556 if ( (signed int)a2 < (signed int)v7 )
6557 {
6558 v8 = v7 - a2;
6559 v20 += v8;
6560 v19 += a2 - this->uClipX;
6561 //v4 += v8;
6562 clipped_out_x = uClipX;
6563 }
6564 v9 = this->uClipY;
6565 if ( (signed int)a3 < (signed int)v9 )
6566 {
6567 v10 = v9 - a3;
6568 v20 += v18 * v10;
6569 v6 = a3 - this->uClipY + a4->uTextureHeight;
6570 //v4 += this->uTargetSurfacePitch * v10;
6571 clipped_out_y = uClipY;
6572 }
6573 v11 = this->uClipX;
6574 v5 = v19;
6575 if ( (signed int)v11 < (signed int)a2 )
6576 v11 = a2;
6577 v12 = this->uClipZ;
6578 if ( (signed int)(v19 + v11) > (signed int)v12 )
6579 {
6580 v13 = this->uClipX;
6581 if ( (signed int)v13 < (signed int)a2 )
6582 v13 = a2;
6583 v5 = v12 - v13;
6584 }
6585 v14 = this->uClipY;
6586 if ( (signed int)v14 < (signed int)a3 )
6587 v14 = a3;
6588 v15 = this->uClipW;
6589 if ( (signed int)(v6 + v14) > (signed int)v15 )
6590 {
6591 v16 = this->uClipY;
6592 if ( (signed int)v16 < (signed int)a3 )
6593 v16 = a3;
6594 v6 = v15 - v16;
6595 }
6596 }
6597
6598 for (uint y = 0; y < v6; ++y)
6599 {
6600 for (int x = 0; x < v5; ++x)
6601 {
6602 if ( *v20 )
6603 WritePixel16(clipped_out_x + x, clipped_out_y + y, ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF);
6604 ++v20;
6605 }
6606 v20 += v18 - v5;
6607 }
6608
6609 /*if ( pRenderer->uTargetGBits == 5 )
6610 {
6611 if ( (signed int)v6 > 0 )
6612 {
6613 v23 = v6;
6614 do
6615 {
6616 if ( v5 > 0 )
6617 {
6618 v21 = v5;
6619 do
6620 {
6621 if ( *v20 )
6622 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF;
6623 ++v4;
6624 ++v20;
6625 --v21;
6626 }
6627 while ( v21 );
6628 }
6629 v20 += v18 - v5;
6630 v17 = v23-- == 1;
6631 v4 += this->uTargetSurfacePitch - v5;
6632 }
6633 while ( !v17 );
6634 }
6635 }
6636 else
6637 {
6638 if ( (signed int)v6 > 0 )
6639 {
6640 v24 = v6;
6641 do
6642 {
6643 if ( v5 > 0 )
6644 {
6645 v22 = v5;
6646 do
6647 {
6648 if ( *v20 )
6649 *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF;
6650 ++v4;
6651 ++v20;
6652 --v22;
6653 }
6654 while ( v22 );
6655 }
6656 v20 += v18 - v5;
6657 v17 = v24-- == 1;
6658 v4 += this->uTargetSurfacePitch - v5;
6659 }
6660 while ( !v17 );
6661 }
6662 }*/
6663 }
6664 } 6521 }
6665 6522
6666 //----- (004A6DF5) -------------------------------------------------------- 6523 //----- (004A6DF5) --------------------------------------------------------
6667 void Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7) 6524 void Render::_4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7)
6668 { 6525 {
6971 } 6828 }
6972 6829
6973 //----- (004A68EF) -------------------------------------------------------- 6830 //----- (004A68EF) --------------------------------------------------------
6974 void Render::DrawTransparentGreenShade(float u, float v, Image *pTexture) 6831 void Render::DrawTransparentGreenShade(float u, float v, Image *pTexture)
6975 { 6832 {
6976 DrawMasked(u, v, pTexture, 0x07E0); 6833 DrawMasked(u, v, pTexture, 0, 0x07E0);
6977 } 6834 }
6978 6835
6979 6836
6980 //----- (004A6776) -------------------------------------------------------- 6837 //----- (004A6776) --------------------------------------------------------
6981 void Render::DrawTransparentRedShade(float u, float v, Image *a4) 6838 void Render::DrawTransparentRedShade(float u, float v, Image *a4)
6982 { 6839 {
6983 DrawMasked(u, v, a4, 0xF800); 6840 DrawMasked(u, v, a4, 0, 0xF800);
6984 } 6841 }
6985 6842
6986 //----- (004A68EF) -------------------------------------------------------- 6843 //----- (004A68EF) --------------------------------------------------------
6987 void Render::DrawMasked(float u, float v, Image *pTexture, unsigned __int16 mask) 6844 void Render::DrawMasked(float u, float v, Image *pTexture, unsigned int color_dimming_level, unsigned __int16 mask)
6988 { 6845 {
6989 unsigned int v5; // ebx@4 6846 unsigned int v5; // ebx@4
6990 int v10; // edx@8 6847 int v10; // edx@8
6991 signed int v11; // edx@9 6848 signed int v11; // edx@9
6992 signed int v12; // esi@12 6849 signed int v12; // esi@12
7070 { 6927 {
7071 if (*pixels & 0xFF000000) 6928 if (*pixels & 0xFF000000)
7072 WritePixel16( 6929 WritePixel16(
7073 clipped_out_x + x, 6930 clipped_out_x + x,
7074 clipped_out_y + y, 6931 clipped_out_y + y,
7075 Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) & mask 6932 (Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) >> color_dimming_level) & mask
7076 ); 6933 );
7077 ++pixels; 6934 ++pixels;
7078 } 6935 }
7079 pixels += v18 - v20; 6936 pixels += v18 - v20;
7080 } 6937 }
7374 pixels += img->GetWidth() - uWidth; 7231 pixels += img->GetWidth() - uWidth;
7375 } 7232 }
7376 } 7233 }
7377 7234
7378 7235
7379 7236 /*
7380 //----- (004A6274) -------------------------------------------------------- 7237 //----- (004A6274) --------------------------------------------------------
7381 void Render::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, Texture_MM7 *pTexture) 7238 void Render::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, Texture_MM7 *pTexture)
7382 { 7239 {
7383 int uHeight; // ebx@4 7240 int uHeight; // ebx@4
7384 unsigned int v11; // edx@9 7241 unsigned int v11; // edx@9
7451 v19 += pTexture->uTextureWidth - uWidth; 7308 v19 += pTexture->uTextureWidth - uWidth;
7452 } 7309 }
7453 } 7310 }
7454 } 7311 }
7455 } 7312 }
7456 } 7313 }*/
7314
7457 7315
7458 //----- (004A612A) -------------------------------------------------------- 7316 //----- (004A612A) --------------------------------------------------------
7459 void Render::ZDrawTextureAlpha(float u, float v, Image *img, int zVal) 7317 void Render::ZDrawTextureAlpha(float u, float v, Image *img, int zVal)
7460 { 7318 {
7461 unsigned int v6; // edx@3 7319 unsigned int v6; // edx@3
7625 } 7483 }
7626 }*/ 7484 }*/
7627 } 7485 }
7628 7486
7629 7487
7630 7488 /*
7631 //----- (004A5EB2) -------------------------------------------------------- 7489 //----- (004A5EB2) --------------------------------------------------------
7632 void Render::DrawTextureTransparentColorKey(signed int x, signed int y, Texture_MM7 *tex) 7490 void Render::DrawTextureTransparentColorKey(signed int x, signed int y, Texture_MM7 *tex)
7633 { 7491 {
7634 int v5; // ebx@4 7492 int v5; // ebx@4
7635 unsigned int v8; // edx@6 7493 unsigned int v8; // edx@6
7712 v19 += v18 - v20; 7570 v19 += v18 - v20;
7713 } 7571 }
7714 } 7572 }
7715 } 7573 }
7716 } 7574 }
7717 } 7575 }*/
7718 7576
7719 7577
7720 7578
7721 //----- (004524D8) -------------------------------------------------------- 7579 //----- (004524D8) --------------------------------------------------------
7722 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) 7580 HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps)