📄 regentoolview.cpp
字号:
// InvalidateRect(CRect(0,0,1,1));
Invalidate();
}
void CRegenToolView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int MinPos, MaxPos;
pScrollBar->GetScrollRange(&MinPos, &MaxPos);
switch(nSBCode)
{
case SB_LINEUP:
{
pScrollBar->SetScrollPos(pScrollBar->GetScrollPos() -LINE_SIZE);
if(m_StartImagePos.y - LINE_SIZE > MinPos)
m_StartImagePos.y = pScrollBar->GetScrollPos() -LINE_SIZE;
else
m_StartImagePos.y = MinPos;
}
break;
case SB_LINEDOWN:
{
pScrollBar->SetScrollPos(pScrollBar->GetScrollPos() +LINE_SIZE);
if(m_StartImagePos.y + LINE_SIZE < MaxPos)
m_StartImagePos.y = pScrollBar->GetScrollPos() +LINE_SIZE;
else
m_StartImagePos.y = MaxPos;
}
break;
case SB_PAGEUP:
{
pScrollBar->SetScrollPos(pScrollBar->GetScrollPos() -PAGE_SIZE);
if(m_StartImagePos.y - PAGE_SIZE > MinPos)
m_StartImagePos.y = pScrollBar->GetScrollPos() -PAGE_SIZE;
else
m_StartImagePos.y = MinPos;
}
break;
case SB_PAGEDOWN:
{
pScrollBar->SetScrollPos(pScrollBar->GetScrollPos() +PAGE_SIZE);
if(m_StartImagePos.y + PAGE_SIZE < MaxPos)
m_StartImagePos.y = pScrollBar->GetScrollPos() +PAGE_SIZE;
else
m_StartImagePos.y = MaxPos;
}
break;
case SB_THUMBTRACK:
pScrollBar->SetScrollPos(nPos);
m_StartImagePos.y = nPos;
break;
}
m_VScrollPos = pScrollBar->GetScrollPos();
CFormView::OnVScroll(nSBCode, nPos, pScrollBar);
// InvalidateRect(CRect(0,0,1,1));
Invalidate();
}
/*
void CMyPainterView::ClientToDoc(CPoint& point)
{
CClientDC dc(this);
OnPrepareDC(&dc, NULL);
dc.DPtoLP(&point);
}
*/
/*
width 50, height 50狼 厚飘甘阑 120*120 栏肺犬措
StretchDIBits(hdc,0,0,120,120,0,0,50,50,imgBit,(BITMAPINFO*)&bmpInfoHeader,DIB_RGB_COLORS,SRCCOPY);
150,150 狼 厚飘甘 30*30栏肺 绵家
StretchDIBits(hdc,0,0,30,30,0,0,150,150,imgBit,(BITMAPINFO*)&bmpInfoHeader,DIB_RGB_COLORS,SRCCOPY);
*/
void CRegenToolView::OnSelectChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eSELECT);
m_SelectBtn.SetCheck(TRUE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnMselectnoareaChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eMSELECTNOAREA);
m_MSelectNoAreaBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnMselectareaChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eMSELECTAREA);
m_MSelectAreaBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnDeleteChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eDELETE);
m_DeleteBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnZoominChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eZOOMIN);
m_ZoomInBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnZoomoutChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eZOOMOUT);
m_ZoomOutBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_MoveBtn.SetCheck(FALSE);
}
void CRegenToolView::OnMoveChk()
{
// TODO: Add your control notification handler code here
// SetButtonCheck(eMOVE);
m_MoveBtn.SetCheck(TRUE);
m_SelectBtn.SetCheck(FALSE);
m_MSelectNoAreaBtn.SetCheck(FALSE);
m_MSelectAreaBtn.SetCheck(FALSE);
m_DeleteBtn.SetCheck(FALSE);
m_ZoomInBtn.SetCheck(FALSE);
m_ZoomOutBtn.SetCheck(FALSE);
}
void CRegenToolView::SetButtonCheck(int button)
{
for(int btn = 0; btn < MAX_BUTTON; btn++)
{
if(button == btn)
m_ButtonFlag[btn] = TRUE;
else
m_ButtonFlag[btn] = FALSE;
}
}
DWORD GXPlayerPROC(I4DyuchiGXExecutive* pExecutive,GXMAP_OBJECT_HANDLE gxh,DWORD msg,int arg1,int arg2,void* pData)
{
/*
DWORD dwMotionNum = pExecutive->GXOGetMotionNum(gxh,0);
DWORD dwMotionIndex = pExecutive->GXOGetCurrentMotionIndex(gxh);
DWORD dwFrame = pExecutive->GXOGetCurrentFrame(gxh);
MOTION_DESC motionDesc;
BOOL bHasMotion = pExecutive->GXOGetMotionDesc(gxh,&motionDesc,dwMotionIndex,0);
if (bHasMotion)
{
if (motionDesc.dwLastFrame <= dwFrame)
{
pExecutive->GXOSetCurrentFrame(gxh,0);
dwMotionIndex++;
if (dwMotionIndex > dwMotionNum)
dwMotionIndex = 1;
pExecutive->GXOSetCurrentMotionIndex(gxh,dwMotionIndex);
}
else
pExecutive->GXOSetCurrentFrame(gxh,dwFrame+arg1);
}
g_dwFrameCount++;
DWORD dwMtlNum = pExecutive->GXOGetMaterialNum(gxh,0);
if (dwMtlNum)
{
if (!(g_dwFrameCount % 32))
{
DWORD dwMtlIndex = pExecutive->GXOGetCurrentMaterialIndex(gxh);
dwMtlIndex++;
if (dwMtlIndex > dwMtlNum)
dwMtlIndex = 0;
pExecutive->GXOSetCurrentMaterialIndex(gxh,dwMtlIndex);
}
}
*/
return 0;
}
void CRegenToolView::InitEngine()
{
CWnd * wnd = GetDlgItem(IDC_MAPIMAGE);
CoInitialize(NULL);
char temp[256];
GetCurrentDirectory(256,temp);
// MSG msg;
HRESULT hr;
DISPLAY_INFO DispInfo;
DispInfo.dwWidth = 1024;
DispInfo.dwHeight = 768;
DispInfo.dwBPS = 4;
DispInfo.dispType = WINDOW_WITH_BLT;
///* Load DLL 荤侩
// 刚历 executive狼 DLL阑 肺靛茄促.
g_hExecutiveHandle = LoadLibrary("SS3DExecutiveForMuk.dll");
// DllCreateInstance 绰 3俺狼 浚柳 DLL捞 葛滴 磊脚狼 巴阑 啊瘤绊 乐促.阿 浚柳 COM狼 牢磐其捞胶甫
// 掘霸 秦林绰 窃荐捞促. 老窜 executive狼 巴父 掘绢郴搁 促弗扒 executive檬扁拳 矫俊 磊悼栏肺 掘阑荐 乐促.
CREATE_INSTANCE_FUNC pFunc;
pFunc = (CREATE_INSTANCE_FUNC)GetProcAddress(g_hExecutiveHandle,"DllCreateInstance");
hr = pFunc((void**)&g_pExecutive);
if (hr != S_OK)
{
MessageBox("Executive积己 角菩","Error",MB_OK);
return;
}
if(g_bUsingEnginePack)
{
PACKFILE_NAME_TABLE table[6];
memset(table,0,sizeof(PACKFILE_NAME_TABLE)*6);
strcpy(table[0].szFileName,"effect.pak");
strcpy(table[1].szFileName,"character.pak");
strcpy(table[2].szFileName,"map.pak");
strcpy(table[3].szFileName,"monster.pak");
strcpy(table[4].szFileName,"npc.pak");
strcpy(table[5].szFileName,"cloud.pak");
// geometry DLL狼 捞抚, renderer DLL狼 捞抚阑 持绢林搁 executive啊 舅酒辑 积己,檬扁拳秦霖促.
g_pExecutive->InitializeFileStorageWithoutRegistry("SS3DFileStorage.dll",
12000,4096,128,FILE_ACCESS_METHOD_FILE_OR_PACK,table,6);
}
else
{
// geometry DLL狼 捞抚, renderer DLL狼 捞抚阑 持绢林搁 executive啊 舅酒辑 积己,檬扁拳秦霖促.
g_pExecutive->InitializeFileStorageWithoutRegistry("SS3DFileStorage.dll",
12000,4096,128,FILE_ACCESS_METHOD_ONLY_FILE,NULL,0);
}
g_pExecutive->InitializeWithoutRegistry("SS3DGeometryForMuk.dll","SS3DRendererForMuk.dll",
wnd->GetSafeHwnd(), &DispInfo, 160000, 32,0,1, 0,MHErrorHandleProc);
/*
// Excutive积己
hr = CoCreateInstance(
CLSID_4DyuchiGXExecutive,
NULL,
CLSCTX_INPROC_SERVER,
IID_4DyuchiGXExecutive,
(void**)&g_pExecutive);
if (hr != S_OK)
__asm int 3
// 浚柳狼 executive 檬扁拳.唱赣瘤 哪器惩飘甸篮 executive啊 檬扁拳矫难霖促.
g_pExecutive->Initialize(wnd->m_hWnd,NULL,
4096, // 坷宏璃飘 弥措肮荐
512, // 扼捞飘 弥措肮荐
1024, // 飘府芭 弥措肮荐
32, // 轰器飘 弥措肮荐
32, MHErrorHandleProc); // 单漠 弥措肮荐
*/
// 付快胶肺 墨皋扼甫 力绢窍扁 困茄 秋欺努贰胶 檬扁拳.
g_pMouse = new MToolMouseStatus;
g_pMouse->Initialize( g_pExecutive->GetGeometry());
// GXObject肺靛.
// GXOBJECT_HANDLE fighter = g_pExecutive->CreateGXObject("L008.chr",GXPlayerPROC,0,0);
// executive绰 轰器飘 0锅阑 荤侩且 巴捞促.
g_pExecutive->SetViewport(0);
// 墨皋扼 檬扁拳
VECTOR3 v3From;
v3From.x = 0.0f;
v3From.y = 1000.0f;
v3From.z = 0.0f;
g_pExecutive->GetGeometry()->ResetCamera(&v3From,DEFAULT_NEAR,DEFAULT_FAR,DEFAULT_FOV,0);
// 濒濒窍聪 某腐磐甫 肋 舅酒杭荐啊 绝促.蝴阑 林磊.
DIRECTIONAL_LIGHT_DESC dirLight;
dirLight.v3Dir.x = 0.5f;
dirLight.v3Dir.y = -1.0f;
dirLight.v3Dir.z = 0.5f;
dirLight.dwSpecular = 0xffffffff;
dirLight.dwDiffuse = 0xfffffff;
dirLight.dwAmbient = 0xff202020;
g_pExecutive->GetGeometry()->SetDirectionalLight(&dirLight,0);
g_pExecutive->GetGeometry()->EnableDirectionalLight(0);
g_pExecutive->GetGeometry()->SetShadowFlag(ENABLE_PROJECTION_SHADOW | ENABLE_PROJECTION_TEXMAP);
// m_MonsterChxName[0] = 0;
}
void CRegenToolView::LoadMapImage(CString filename)
{
m_hBMP = (HBITMAP) LoadImage(
NULL,
filename,
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE
);
CWnd * wnd = GetDlgItem(IDC_MAPIMAGE);
m_hdc = ::GetDC(wnd->m_hWnd);
GetObject(m_hBMP, sizeof(BITMAP), &m_bmp);
m_hMemDC = CreateCompatibleDC(m_hdc);
SelectObject(m_hMemDC, m_hBMP);
CRect rect;
CRect ImageBox;
wnd->GetClientRect(&m_ViewWinSize);
m_ImageSize = CRect(0, 0, m_bmp.bmWidth,m_bmp.bmHeight);
if(m_bmp.bmWidth - rect.right <= 0)
m_ImageBoxRect.right = m_bmp.bmWidth;
else
m_ImageBoxRect.right = m_bmp.bmWidth - (m_bmp.bmWidth - rect.right);
if(m_bmp.bmHeight - rect.bottom <= 0)
m_ImageBoxRect.bottom = m_bmp.bmHeight;
else
m_ImageBoxRect.bottom = m_bmp.bmHeight - (m_bmp.bmHeight - rect.bottom);
// 胶农费 Max蔼苞 Range甫 拌魂茄促 ---------------------
int VMaxPos, HMaxPos;
if(m_bmp.bmHeight - rect.bottom)
VMaxPos = m_bmp.bmHeight - rect.bottom;
else
VMaxPos = 0;
if(m_bmp.bmWidth - rect.right)
HMaxPos = m_bmp.bmWidth - rect.right;
else
HMaxPos = 0;
m_ImageVScroll.SetScrollRange(rect.top, VMaxPos);
m_ImageHScroll.SetScrollRange(rect.left, HMaxPos);
// -----------------------------------------------------
SetStartSelectFlag(TRUE);
}
void CRegenToolView::InsertMonster(VECTOR3* TargetPos)
{
DIRECTORYMGR->SetLoadMode(eLM_Monster);
CWnd * wnd = GetDlgItem(IDC_MAPIMAGE);
CRect rect;
// wnd->GetClientRect(&rect);
// VECTOR3 TargetPos = GetXYZFromScreenXY( g_pExecutive->GetGeometry(),
// x, y, pview->GetViewWinRect()->right, pview->GetViewWinRect()->bottom);
// VECTOR3* TargetPos = GetPickedPosition(point.x,point.y);
// if(!TargetPos)
// return;
// 甘俊 阁胶磐 眠啊
// sprintf(temp, "./MonsterData/%s", m_MonsterChxName);
GXOBJECT_HANDLE fighter = g_pExecutive->CreateGXObject(m_MonsterChxName, MHPlayerPROC,0,0);
if(!fighter)
fighter = g_pExecutive->CreateGXObject("L008.chx", MHPlayerPROC,0,0);
VECTOR3 MonsterMapPos;
VECTOR3 MonsterAnger;
float aaa;
g_pExecutive->GXOEnableHFieldApply(fighter);
g_pExecutive->GXOSetPosition(fighter, TargetPos, FALSE);
g_pExecutive->GXOGetPosition(fighter, &MonsterMapPos);
g_pExecutive->GXOGetDirection(fighter, &MonsterAnger, &aaa);
CRegenToolDoc* pDoc = GetDocument();
// ListCtrl俊 眠啊 -------------------------------------
MData data;
WORD count;
if(!m_DataInsertFlag)
count = (WORD)m_MonsterKind.GetCurSel();
else
count = m_DataInsertKind;
data.Group.Format("1");
data.MonsterIdx.Format("%d", GetMonsterIndex());
data.MonsterKind.Format("%d", g_pLoadList->m_MonsterList[count].MonsterKind);
data.x.Format("%4.2f", TargetPos->x);
data.z.Format("%4.2f", TargetPos->z);
data.Flag.Format("0");
AddMonsterList(&data);
// AddMonsterIndex();
//------------------------------------------------------
CString szGroup;
MONSTER_POINT* mp = new MONSTER_POINT;
mp->MonsterGrade = GetMonsterGrade();
mp->MonsterIndex = m_dwMonsterIndex;
mp->MonsterKind = g_pLoadList->m_MonsterList[count].MonsterKind;
mp->SelectCount = m_ListIndex;
mp->point.x = TargetPos->x;
mp->point.y = TargetPos->z;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -