现在进行T3DLIB的残余。
#define SCREEN_DARKNESS 0
#define SCREEN_WHITENESS 1
#define SCREEN_SWIPE_X 2
#define SCREEN_SWIPE_Y 3
#define SCREEN_DISOLVE 4
#define SCREEN_SCRUNCH 5
#define SCREEN_BLUENESS 6
#define SCREEN_REDNESS 7
#define SCREEN_GREENNESS 8
int DDRAW_Interface::DDraw_Wait_For_Vsync()
{
m_lpdd->WaitForVerticalBlank( DDWAITVB_BLOCKBEGIN, 0 );
return ( 1 );
}
//绘制矩形
int ddraw_math::Draw_Rectangle(int x1, int y1, int x2, int y2, int color, LPDIRECTDRAWSURFACE7 lpdds)
{
DDBLTFX ddbltfx;
RECT fill_area;
DDRAW_INIT_STRUCT( ddbltfx );
ddbltfx.dwFillColor = color;
fill_area.top = y1;
fill_area.left = x1;
fill_area.bottom = y2;
fill_area.right = x2;
lpdds->Blt( & fill_area, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, & ddbltfx );
return ( 1 );
}
//水平线绘制
void ddraw_math::HLine(int x1, int x2, int y, int color, UCHAR *vbuffer, int lpitch)
{
int temp;
if( y > m_max_clip_y || y < m_min_clip_y )
return;
if( x1 > x2 )
{
temp = x1;
x1 = x2;
x2 = temp;
}
if( x1 > m_max_clip_x || x2 < m_min_clip_x )
return ;
x1 = ( ( x1 < m_min_clip_x ) ? m_min_clip_x : x1 );
x2 = ( ( x2 > m_max_clip_x ) ? m_max_clip_x : x2 );
memset( ( UCHAR * ) ( vbuffer + ( y * lpitch ) + x1 ), ( UCHAR ) color, x2 - x1 + 1 );
}
//16位水平线绘制,转换格式+内联汇编
void ddraw_math::HLine16(int x1, int x2, int y, int color, UCHAR *vbuffer, int lpitch)
{
int temp;
USHORT * vbuffer2 = ( USHORT * ) vbuffer;
lpitch = lpitch >> 1;
if( y > m_max_clip_y || y < m_min_clip_y )
return;
if( x1 > x2 )
{
temp = x1;
x1 = x2;
x2 = temp;
}
if( x1 > m_max_clip_x || x2 < m_min_clip_x )
return ;
x1 = ( ( x1 < m_min_clip_x ) ? m_min_clip_x : x1 );
x2 = ( ( x2 > m_max_clip_x ) ? m_max_clip_x : x2 );
Mem_Set_WORD( ( vbuffer2 + ( y * lpitch ) + x1 ), color, x2 - x1 + 1 );
}
//垂直线绘制
void ddraw_math::VLine(int y1, int y2, int x, int color, UCHAR *vbuffer, int lpitch)
{
UCHAR * start_offset;
int index;
int temp;
if( x > m_max_clip_x || x < m_min_clip_x )
return;
if( y1 > y2 )
{
temp = y1;
y1 = y2;
y2 = temp;
}
if( y1 > m_max_clip_y || y2 < m_min_clip_y )
return ;
y1 = ( ( y1 < m_min_clip_y ) ? m_min_clip_y : y1 );
y2 = ( ( y2 > m_max_clip_y ) ? m_max_clip_y : y2 );
start_offset = vbuffer + ( y1 * lpitch ) + x;
for( int index = 0; index <= y2 - y1; index++ )
{
* start_offset = ( UCHAR ) color;
start_offset += lpitch;
}
}
//16位垂直线绘制
void ddraw_math::VLine16(int y1, int y2, int x, int color, UCHAR *vbuffer, int lpitch)
{
USHORT * start_offset;
int index;
int temp;
lpitch = lpitch >> 1;
if( x > m_max_clip_x || x < m_min_clip_x )
return;
if( y1 > y2 )
{
temp = y1;
y1 = y2;
y2 = temp;
}
if( y1 > m_max_clip_y || y2 < m_min_clip_y )
return ;
y1 = ( ( y1 < m_min_clip_y ) ? m_min_clip_y : y1 );
y2 = ( ( y2 > m_max_clip_y ) ? m_max_clip_y : y2 );
start_offset = ( USHORT * )vbuffer + ( y1 * lpitch ) + x;
for( int index = 0; index <= y2 - y1; index++ )
{
* start_offset = ( UCHAR ) color;
start_offset += lpitch;
}
}
先进行到这里