|
|

楼主 |
发表于 2005-6-10 20:55:00
|
显示全部楼层
Re:谁能讲解下:关于地图、屏幕、角色、鼠标他们之间的
//放入物体和角色///////////////////////////////////////////////////////////////////////////////
m_MainRole.RoleFSM();
for(y=ftop;y<fbottom;y++)
//从地图上访开始读取
for(x=fleft;x<fright;x++)
//从地图左边开始读取
{
if(m_MapStruct.titlestruct[x][y].IsObjectKeyPos)
//如果有角色关键坐标
{
int ID=m_MapStruct.titlestruct[x][y].ObjectID;
int n=0;
while(ID!=m_Object.m_ObjectStruct[n].m_nID)
n++;
m_lpDDSScene->BltFast((BACK_X+x-m_Object.m_ObjectStruct[n].m_pKeyPos.x)*TITLE_SIZE,
(BACK_Y+y-m_Object.m_ObjectStruct[n].m_pKeyPos.y)*TITLE_SIZE,
m_Object.m_lpDDSObject[n],
NULL,SrcKey);
//以黑色作为透明色将角色加入后台缓存??
}
//放入NPC角色
for(int h=0;h<m_nNPCRoleCount;h++)
{
if(m_NPCRole[h].m_Role.m_pPos.x/TITLE_SIZE==x
&&m_NPCRole[h].m_Role.m_pPos.y/TITLE_SIZE==y)
{
int rx=m_NPCRole[h].m_Role.m_pPos.x;
int ry=m_NPCRole[h].m_Role.m_pPos.y;
int kx=m_NPCRole[h].m_Role.m_rfstruct.m_pKeyPos.x;
int ky=m_NPCRole[h].m_Role.m_rfstruct.m_pKeyPos.y;
RECT rt;
rt.left=m_NPCRole[h].Step*m_NPCRole[h].m_Role.m_rfstruct.m_nCellWidth;
rt.top=m_NPCRole[h].m_Role.dir*m_NPCRole[h].m_Role.m_rfstruct.m_nCellHeight;
rt.right=rt.left+m_NPCRole[h].m_Role.m_rfstruct.m_nCellWidth;
rt.bottom=rt.top+m_NPCRole[h].m_Role.m_rfstruct.m_nCellHeight;
m_lpDDSScene->BltFast(BACK_X*TITLE_SIZE+rx-kx,BACK_Y*TITLE_SIZE+ry-ky,
m_NPCRole[h].m_lpDDSRole,
&rt,SrcKey);
}
}
//放入主角
if(m_MainRole.m_Role.m_pPos.x/TITLE_SIZE==x
&&m_MainRole.m_Role.m_pPos.y/TITLE_SIZE==y)
{
int rx=m_MainRole.m_Role.m_pPos.x;
int ry=m_MainRole.m_Role.m_pPos.y;
int kx=m_MainRole.m_Role.m_rfstruct.m_pKeyPos.x;
int ky=m_MainRole.m_Role.m_rfstruct.m_pKeyPos.y;
RECT rt;
rt.left=m_MainRole.Step*m_MainRole.m_Role.m_rfstruct.m_nCellWidth;
rt.top=m_MainRole.m_Role.dir*m_MainRole.m_Role.m_rfstruct.m_nCellHeight;
rt.right=rt.left+m_MainRole.m_Role.m_rfstruct.m_nCellWidth;
rt.bottom=rt.top+m_MainRole.m_Role.m_rfstruct.m_nCellHeight;
m_lpDDSScene->BltFast(BACK_X*TITLE_SIZE+rx-kx,BACK_Y*TITLE_SIZE+ry-ky,
m_MainRole.m_lpDDSRole,
&rt,SrcKey);
}
}
|
|