comparison mm7_4.cpp @ 2076:0d535449c04f

Слияние
author Ritor1
date Wed, 04 Dec 2013 15:40:38 +0600
parents 2737276390ff
children 3920278a2905
comparison
equal deleted inserted replaced
2075:24033aa2e1f8 2076:0d535449c04f
1587 strcat(pTmpBuf2.data(), pText); 1587 strcat(pTmpBuf2.data(), pText);
1588 dst = strlen(pTmpBuf2.data()); 1588 dst = strlen(pTmpBuf2.data());
1589 i += 2; 1589 i += 2;
1590 break; 1590 break;
1591 case 24:// 1591 case 24://
1592 sprintfex(a1, format_4E2D80, TargetColor(255, 255, 155), a3->GetDisplayName()); 1592 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName());
1593 strcat(pTmpBuf2.data(), a1); 1593 strcat(pTmpBuf2.data(), a1);
1594 dst = strlen(pTmpBuf2.data()); 1594 dst = strlen(pTmpBuf2.data());
1595 i += 2; 1595 i += 2;
1596 break; 1596 break;
1597 case 25: 1597 case 25:
1911 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0; 1911 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
1912 v13 = v12 + 6.7553994e15; 1912 v13 = v12 + 6.7553994e15;
1913 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/ 1913 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
1914 } 1914 }
1915 1915
1916 //----- (004A46E6) -------------------------------------------------------- 1916 void Present32(unsigned __int32 *src, unsigned int src_pitch,
1917 int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) 1917 unsigned __int32 *dst, unsigned int dst_pitch)
1918 { 1918 {
1919 int v5; // eax@1 1919 for (uint y = 0; y < 8; ++y)
1920 int z; // eax@1 1920 memcpy(dst + y * dst_pitch,
1921 unsigned int v7; // eax@9 1921 src + y * src_pitch, src_pitch * sizeof(__int32));
1922 unsigned int v8; // ecx@9 1922
1923 int v9; // eax@9 1923 for (uint y = 8; y < 352; ++y)
1924 unsigned int v10; // eax@10
1925 int *v11; // esi@10
1926 int *v12; // edi@10
1927 int v13; // ecx@10
1928 int v14; // edx@10
1929 unsigned int v15; // eax@22
1930 int *v16; // esi@22
1931 int *v17; // edi@22
1932 int v18; // ecx@22
1933 int v19; // edx@22
1934 unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9
1935 int *pTargetZ; // [sp+10h] [bp-4h]@9
1936 unsigned int v22; // [sp+1Ch] [bp+8h]@9
1937 signed int v23; // [sp+20h] [bp+Ch]@1
1938
1939 v5 = a4;
1940 v23 = _z >> 16;
1941 z = x + v5;
1942 if ( z >= (signed int)pViewport->uViewportTL_X
1943 && (signed int)x <= (signed int)pViewport->uViewportBR_X
1944 && y >= (signed int)pViewport->uViewportTL_Y
1945 && y <= (signed int)pViewport->uViewportBR_Y )
1946 {
1947 if ( (signed int)x < (signed int)pViewport->uViewportTL_X )
1948 x = pViewport->uViewportTL_X;
1949 if ( z > (signed int)pViewport->uViewportBR_X )
1950 z = pViewport->uViewportBR_X;
1951 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
1952 v22 = z - x;
1953 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y];
1954 v7 = lightColor >> 3;
1955 v8 = lightColor & 0xF0;
1956 v9 = v7 & 0x1E0000;
1957 if ( pRenderer->uTargetGBits == 5 )
1958 {
1959 v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4;
1960 v11 = (int *)pTarget;
1961 v12 = pTargetZ;
1962 v13 = v22;
1963 v14 = (v10 << 16) | v10;
1964 z = (unsigned __int8)pTarget & 2;
1965 if ( (unsigned __int8)pTarget & 2 )
1966 {
1967 z = (unsigned int)*pTargetZ >> 16;
1968 if ( z > v23 )
1969 { 1924 {
1970 z = v14 + ((*pTarget & 0x7BDEu) >> 1); 1925 memcpy(dst + y * dst_pitch,
1971 *pTarget = z; 1926 src + y * src_pitch, 8 * sizeof(__int32));
1927 memcpy(dst + 8 + game_viewport_width + y * dst_pitch,
1928 src + 8 + game_viewport_width + y * src_pitch, 174/*172*/ * sizeof(__int32));
1972 } 1929 }
1973 v13 = v22 - 1; 1930
1974 v11 = (int *)(pTarget + 1); 1931 for (uint y = 352; y < 480; ++y)
1975 v12 = pTargetZ + 1; 1932 memcpy(dst + y * dst_pitch,
1976 } 1933 src + y * src_pitch, src_pitch * sizeof(__int32));
1977 while ( v13 != 1 ) 1934
1978 { 1935 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
1979 if ( v13 < 1 )
1980 return z;
1981 z = (unsigned int)*v12 >> 16;
1982 if ( z <= v23 )
1983 { 1936 {
1984 v13 -= 2; 1937 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
1985 ++v11; 1938 {
1986 v12 += 2; 1939 //if (src[x + y * src_pitch] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
1940 if (src[x + y * src_pitch] != 0xFFF8FCF8) // FFF8FCF8 = Color32(Color16(g_mask | b_mask))
1941 dst[x + y * dst_pitch] = src[x + y * src_pitch];
1942 }
1987 } 1943 }
1988 else
1989 {
1990 v12 += 2;
1991 z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1);
1992 v13 -= 2;
1993 *v11 = z;
1994 ++v11;
1995 }
1996 }
1997 z = (unsigned int)*v12 >> 16;
1998 if ( z > v23 )
1999 {
2000 z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1);
2001 *(short *)v11 = z;
2002 }
2003 }
2004 else
2005 {
2006 v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4;
2007 v16 = (int *)pTarget;
2008 v17 = pTargetZ;
2009 v18 = v22;
2010 v19 = (v15 << 16) | v15;
2011 z = (unsigned __int8)pTarget & 2;
2012 if ( (unsigned __int8)pTarget & 2 )
2013 {
2014 z = (unsigned int)*pTargetZ >> 16;
2015 if ( z > v23 )
2016 {
2017 z = v19 + ((*pTarget & 0xF7DEu) >> 1);
2018 *pTarget = z;
2019 }
2020 v18 = v22 - 1;
2021 v16 = (int *)(pTarget + 1);
2022 v17 = pTargetZ + 1;
2023 }
2024 while ( v18 != 1 )
2025 {
2026 if ( v18 < 1 )
2027 return z;
2028 z = (unsigned int)*v17 >> 16;
2029 if ( z <= v23 )
2030 {
2031 v18 -= 2;
2032 ++v16;
2033 v17 += 2;
2034 }
2035 else
2036 {
2037 v17 += 2;
2038 z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1);
2039 v18 -= 2;
2040 *v16 = z;
2041 ++v16;
2042 }
2043 }
2044 z = (unsigned int)*v17 >> 16;
2045 if ( z > v23 )
2046 {
2047 z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1);
2048 *(short *)v16 = z;
2049 }
2050 }
2051 }
2052 return z;
2053 }
2054
2055 //----- (004A57E9) --------------------------------------------------------
2056 void Present_ColorKey()
2057 {
2058 HRESULT v0; // eax@3
2059 HRESULT v1; // eax@3
2060 HRESULT v2; // eax@3
2061 HRESULT v3; // eax@3
2062 HRESULT v4; // eax@3
2063 RECT a2; // [sp+4h] [bp-14h]@3
2064 //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3
2065
2066 if ( !pRenderer->uNumSceneBegins )
2067 {
2068 if ( pRenderer->field_40110 )
2069 {
2070 a2.bottom = pViewport->uViewportTL_Y;
2071 a2.left = 0;
2072 a2.top = 0;
2073 a2.right = 640;
2074 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u));
2075 a2.right = 640;
2076 a2.left = 0;
2077 a2.top = pViewport->uViewportBR_Y + 1;
2078 a2.bottom = 480;
2079 ErrD3D(pRenderer->pBackBuffer4->BltFast(
2080 0,
2081 pViewport->uViewportBR_Y + 1,
2082 pRenderer->pColorKeySurface4,
2083 &a2,
2084 16u));
2085 a2.right = pViewport->uViewportTL_X;
2086 a2.bottom = pViewport->uViewportBR_Y + 1;
2087 a2.left = 0;
2088 a2.top = pViewport->uViewportTL_Y;
2089 ErrD3D(pRenderer->pBackBuffer4->BltFast(
2090 0,
2091 pViewport->uViewportTL_Y,
2092 pRenderer->pColorKeySurface4,
2093 &a2,
2094 16u));
2095 a2.left = pViewport->uViewportBR_X;
2096 a2.top = pViewport->uViewportTL_Y;
2097 a2.right = 640;
2098 a2.bottom = pViewport->uViewportBR_Y + 1;
2099 ErrD3D(pRenderer->pBackBuffer4->BltFast(
2100 pViewport->uViewportBR_X,
2101 pViewport->uViewportTL_Y,
2102 pRenderer->pColorKeySurface4,
2103 &a2,
2104 16u));
2105 a2.right = pViewport->uViewportBR_X;
2106 a2.bottom = pViewport->uViewportBR_Y + 1;
2107 a2.left = pViewport->uViewportTL_X;
2108 a2.top = pViewport->uViewportTL_Y;
2109 ErrD3D(pRenderer->pBackBuffer4->BltFast(
2110 pViewport->uViewportTL_X,
2111 pViewport->uViewportTL_Y,
2112 pRenderer->pColorKeySurface4,
2113 &a2,
2114 17u));
2115 }
2116 }
2117 } 1944 }
2118 1945
2119 //----- (004A597D) -------------------------------------------------------- 1946 //----- (004A597D) --------------------------------------------------------
2120 void Present_NoColorKey() 1947 void Present_NoColorKey()
2121 { 1948 {
2136 int v15; // eax@13 1963 int v15; // eax@13
2137 int v16; // eax@14 1964 int v16; // eax@14
2138 int v17; // eax@16 1965 int v17; // eax@16
2139 HRESULT v18; // eax@22 1966 HRESULT v18; // eax@22
2140 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3 1967 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
2141 int v20; // [sp+88h] [bp-1Ch]@10 1968 //int v20; // [sp+88h] [bp-1Ch]@10
2142 int v21; // [sp+8Ch] [bp-18h]@10 1969 int v21; // [sp+8Ch] [bp-18h]@10
2143 __int32 v22; // [sp+90h] [bp-14h]@10 1970 __int32 v22; // [sp+90h] [bp-14h]@10
2144 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10 1971 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
2145 unsigned int v24; // [sp+98h] [bp-Ch]@4 1972 unsigned int v24; // [sp+98h] [bp-Ch]@4
2146 //unsigned int _this; // [sp+9Ch] [bp-8h]@10 1973 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
2147 //LPVOID v26; // [sp+A0h] [bp-4h]@4 1974 //LPVOID v26; // [sp+A0h] [bp-4h]@4
2148 1975
2149 if ( !pRenderer->uNumSceneBegins ) 1976 if ( !pRenderer->uNumSceneBegins )
2150 { 1977 {
2151 if ( pRenderer->field_40110 ) 1978 if ( pRenderer->using_software_screen_buffer )
2152 { 1979 {
2153 memset(&Dst, 0, 0x7Cu); 1980 memset(&Dst, 0, 0x7Cu);
2154 Dst.dwSize = 124; 1981 Dst.dwSize = 124;
2155 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) 1982 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
2156 { 1983 {
2157 //v26 = Dst.lpSurface; 1984 //v26 = Dst.lpSurface;
2158 pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface; 1985 //pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
2159 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask | 1986 v24 = pRenderer->uTargetGMask | pRenderer->uTargetBMask |
2160 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16); 1987 ((pRenderer->uTargetGMask | pRenderer->uTargetBMask) << 16);
2161 pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface; 1988 //pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
2162 pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch; 1989 //pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
2163 v1 = pRenderer->pTargetSurface; 1990 //v1 = pRenderer->pTargetSurface;
2164 v2 = Dst.lpSurface; 1991 v2 = Dst.lpSurface;
2165 1992
2166 1993
2167 /*for (uint y = 0; y < 480; ++y) 1994 /*for (uint y = 0; y < 480; ++y)
2168 { 1995 {
2169 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch); 1996 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
2170 for (uint x = 0; x < 640; ++x) 1997 for (uint x = 0; x < 640; ++x)
2171 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask; 1998 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
2172 }*/ 1999 }*/
2173 2000
2174 ushort* pSrc = pRenderer->pTargetSurface; 2001 if (!FORCE_16_BITS)
2002 Present32((unsigned __int32 *)pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch, (unsigned __int32 *)Dst.lpSurface, Dst.lPitch / 4);
2003 else
2004 {
2005 ushort* pSrc = (unsigned short *)pRenderer->pTargetSurface;
2175 short* pDst = (__int16 *)Dst.lpSurface; 2006 short* pDst = (__int16 *)Dst.lpSurface;
2176 2007
2177 for (uint y = 0; y < 8; ++y) 2008 for (uint y = 0; y < 8; ++y)
2178 memcpy(pDst + y * Dst.lPitch / 2, 2009 memcpy(pDst + y * Dst.lPitch / 2,
2179 2010
2203 2034
2204 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; 2035 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
2205 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); 2036 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
2206 v10 = (int)pSrc_x1y1; 2037 v10 = (int)pSrc_x1y1;
2207 v11 = (int)pDst_x1y1; 2038 v11 = (int)pDst_x1y1;
2208 int uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; 2039 int uHalfWidth = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
2209 v13 = v24; 2040 v13 = v24;
2210 2041
2211 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) 2042 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
2212 { 2043 {
2213 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, 2044 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
2215 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) 2046 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
2216 { 2047 {
2217 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) 2048 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
2218 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; 2049 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
2219 } 2050 }
2051 }
2220 } 2052 }
2221 2053
2222 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); 2054 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
2223 2055
2224 /* while ( 1 ) 2056 /* while ( 1 )
2421 a1.uFrameWidth -= 12; 2253 a1.uFrameWidth -= 12;
2422 a1.uFrameHeight -= 12; 2254 a1.uFrameHeight -= 12;
2423 v7 = pSpellStats->pInfos[v1].pName; 2255 v7 = pSpellStats->pInfos[v1].pName;
2424 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; 2256 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
2425 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; 2257 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
2426 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); 2258 v8 = Color16(0xFFu, 0xFFu, 0x9Bu);
2427 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); 2259 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
2428 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); 2260 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
2429 a1.uFrameZ = a1.uFrameX + 107; 2261 a1.uFrameZ = a1.uFrameX + 107;
2430 a1.uFrameWidth = 108; 2262 a1.uFrameWidth = 108;
2431 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u); 2263 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);