Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1275 lines
34 KiB
C++
1275 lines
34 KiB
C++
// EffectEditorView.cpp : implementation of the CEffectEditorView class
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "EffectEditor.h"
|
||
#include "SceneManager.h"
|
||
#include "MainFrm.h"
|
||
#include "EffectEditorDoc.h"
|
||
#include "EffectEditorView.h"
|
||
#include "CommandManager.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CEffectEditorView
|
||
|
||
IMPLEMENT_DYNCREATE(CEffectEditorView, CView)
|
||
|
||
BEGIN_MESSAGE_MAP(CEffectEditorView, CView)
|
||
//{{AFX_MSG_MAP(CEffectEditorView)
|
||
ON_WM_LBUTTONDOWN()
|
||
ON_WM_LBUTTONUP()
|
||
ON_WM_RBUTTONDOWN()
|
||
ON_WM_RBUTTONUP()
|
||
ON_WM_MOUSEMOVE()
|
||
ON_WM_DESTROY()
|
||
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
|
||
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
|
||
ON_COMMAND(ID_FILE_SAVE_AS, OnFileSave)
|
||
ON_COMMAND(ID_EDIT_REDO, OnEditRedo)
|
||
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
|
||
ON_COMMAND(ID_FILE_NEW, OnFileNew)
|
||
ON_COMMAND(ID_CHAR_VISIBLE, OnCharVisible)
|
||
ON_COMMAND(ID_CHAR_INVISIBLE, OnCharInvisible)
|
||
ON_WM_KEYDOWN()
|
||
ON_COMMAND(ID_CHAR_WAIT, OnCharWait)
|
||
ON_COMMAND(ID_CHAR_WALK, OnCharWalk)
|
||
ON_COMMAND(ID_CHAR_ATTACK, OnCharAttack)
|
||
ON_COMMAND(ID_CHAR_ATTACK_ADVANCE, OnCharAttackAdvance)
|
||
ON_COMMAND(ID_CHAR_ATTACK_LEFT, OnCharAttackLeft)
|
||
ON_COMMAND(ID_CHAR_ATTACK_RETREAT, OnCharAttackRetreat)
|
||
ON_COMMAND(ID_CHAR_ATTACK_RIGHT, OnCharAttackRight)
|
||
ON_COMMAND(ID_CHAR_ATTACKED, OnCharAttacked)
|
||
ON_COMMAND(ID_CHAR_BACK, OnCharBack)
|
||
ON_COMMAND(ID_CHAR_BASH, OnCharBash)
|
||
ON_COMMAND(ID_CHAR_CASTING, OnCharCasting)
|
||
ON_COMMAND(ID_CHAR_CRIP_WEAPON, OnCharCripWeapon)
|
||
ON_COMMAND(ID_CHAR_FALLDOWN, OnCharFalldown)
|
||
ON_COMMAND(ID_CHAR_GET_UP, OnCharGetUp)
|
||
ON_COMMAND(ID_CHAR_LEFT, OnCharLeft)
|
||
ON_COMMAND(ID_CHAR_PUT_IN_WEAPON, OnCharPutInWeapon)
|
||
ON_COMMAND(ID_CHAR_REST, OnCharRest)
|
||
ON_COMMAND(ID_CHAR_RESTORE_HAND, OnCharRestoreHand)
|
||
ON_COMMAND(ID_CHAR_RIGHT, OnCharRight)
|
||
ON_COMMAND(ID_CHAR_RUN, OnCharRun)
|
||
ON_COMMAND(ID_CHAR_SIT_DOWN, OnCharSitDown)
|
||
ON_COMMAND(ID_CHAR_STUN, OnCharStun)
|
||
ON_COMMAND(ID_CHAR_TAKE_OUT_WEAPON, OnCharTakeOutWeapon)
|
||
ON_COMMAND(ID_CHAR_NORMAL, OnCharNormal)
|
||
ON_COMMAND(ID_CHAR_BATTLE, OnCharBattle)
|
||
ON_COMMAND(ID_CHAR_BLUNT, OnCharBlunt)
|
||
ON_COMMAND(ID_CHAR_BOW, OnCharBow)
|
||
ON_COMMAND(ID_CHAR_CROSSBOW, OnCharCrossbow)
|
||
ON_COMMAND(ID_CHAR_DAGGER, OnCharDagger)
|
||
ON_COMMAND(ID_CHAR_NOWEAPONB, OnCharNoweaponb)
|
||
ON_COMMAND(ID_CHAR_ONEHAND, OnCharOnehand)
|
||
ON_COMMAND(ID_CHAR_TWOHAND, OnCharTwohand)
|
||
ON_COMMAND(ID_CHAR_M_CAST_BEGIN, OnCharMCastBegin)
|
||
ON_COMMAND(ID_CHAR_M_CASTING1, OnCharMCasting1)
|
||
ON_COMMAND(ID_CHAR_M_CASTING2, OnCharMCasting2)
|
||
ON_COMMAND(ID_CHAR_CAST_BEGIN, OnCharCastBegin)
|
||
ON_COMMAND(ID_CHAR_CASTING2, OnCharCasting2)
|
||
ON_COMMAND(ID_CHAR_BLOW, OnCharBlow)
|
||
ON_COMMAND(ID_CHAR_ROUND_SWING, OnCharRoundSwing)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
CCommandManager g_CommandManager;
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CEffectEditorView construction/destruction
|
||
|
||
CEffectEditorView::CEffectEditorView()
|
||
{
|
||
// TODO: add construction code here
|
||
m_lpEffect = NULL;
|
||
}
|
||
|
||
CEffectEditorView::~CEffectEditorView()
|
||
{
|
||
//delete m_pChr;
|
||
}
|
||
|
||
BOOL CEffectEditorView::PreCreateWindow(CREATESTRUCT& cs)
|
||
{
|
||
// TODO: Modify the Window class or styles here by modifying
|
||
// the CREATESTRUCT cs
|
||
|
||
return CView::PreCreateWindow(cs);
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CEffectEditorView drawing
|
||
|
||
void CEffectEditorView::OnDraw(CDC* pDC)
|
||
{
|
||
CEffectEditorDoc* pDoc = GetDocument();
|
||
ASSERT_VALID(pDoc);
|
||
// TODO: add draw code for native data here
|
||
}
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CEffectEditorView diagnostics
|
||
|
||
#ifdef _DEBUG
|
||
void CEffectEditorView::AssertValid() const
|
||
{
|
||
CView::AssertValid();
|
||
}
|
||
|
||
void CEffectEditorView::Dump(CDumpContext& dc) const
|
||
{
|
||
CView::Dump(dc);
|
||
}
|
||
|
||
CEffectEditorDoc* CEffectEditorView::GetDocument() // non-debug version is inline
|
||
{
|
||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEffectEditorDoc)));
|
||
return (CEffectEditorDoc*)m_pDocument;
|
||
}
|
||
#endif //_DEBUG
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CEffectEditorView message handlers
|
||
|
||
void CEffectEditorView::OnInitialUpdate()
|
||
{
|
||
CView::OnInitialUpdate();
|
||
|
||
// TODO: Add your specialized code here and/or call the base class
|
||
m_bLButtonDown = FALSE;
|
||
m_bRButtonDown = FALSE;
|
||
m_dwPreFrame = 0;
|
||
|
||
srand((unsigned)time(NULL));
|
||
|
||
////////////////////////
|
||
// <20><><EFBFBD>̷<EFBFBD>Ʈ <20><>ü <20><><EFBFBD><EFBFBD> //
|
||
////////////////////////
|
||
if(NULL == (m_lpD3D = Direct3DCreate8(D3D_SDK_VERSION))) return;
|
||
|
||
// Get the current desktop display mode
|
||
D3DDISPLAYMODE d3ddm;
|
||
if(FAILED(m_lpD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm))) return;
|
||
|
||
D3DPRESENT_PARAMETERS d3dpp;
|
||
ZeroMemory(&d3dpp, sizeof(d3dpp));
|
||
d3dpp.Windowed = TRUE;
|
||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||
d3dpp.BackBufferFormat = d3ddm.Format;
|
||
d3dpp.EnableAutoDepthStencil = TRUE;
|
||
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||
|
||
if(FAILED(m_lpD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, this->m_hWnd,
|
||
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &m_lpD3DDevice))) return;
|
||
|
||
HKEY hMPClientReg;
|
||
DWORD dwReadType,dwReadLens;
|
||
dwReadType=0;
|
||
dwReadLens=256;
|
||
char strPath[MAX_PATH], strTemp[MAX_PATH];
|
||
|
||
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\GamaSoft\\MP-Client",0,KEY_READ,&hMPClientReg)==ERROR_SUCCESS &&
|
||
RegQueryValueEx(hMPClientReg, "FX", 0, &dwReadType, (LPBYTE)strPath,&dwReadLens)==ERROR_SUCCESS)
|
||
{
|
||
sprintf(EFFECTTEXTUREPATH, "%s\\Texture\\Effect\\", strPath);
|
||
strcat(strPath, "\\Character\\Data");
|
||
RegCloseKey(hMPClientReg);
|
||
}
|
||
else
|
||
exit(0);
|
||
|
||
CTexture::Init(m_lpD3DDevice);
|
||
////
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\Tex");
|
||
CZ3DRenderable::_Init( m_lpD3DDevice );
|
||
Z3DTexture::_Init( m_lpD3DDevice, strTemp, 0 );
|
||
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\Ani\\");
|
||
g_ContAniKeyPack.SetFilePath( strTemp );
|
||
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\Mesh\\");
|
||
g_ContLODMesh.SetFilePath( strTemp );
|
||
|
||
// Texpiece name table loading
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\Tex\\");
|
||
g_ContTexturePiece.SetFilePath( strTemp );
|
||
|
||
// attachment mesh
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\AMesh\\");
|
||
g_ContAMesh.SetFilePath( strTemp );
|
||
|
||
// texture
|
||
strcpy(strTemp, strPath);
|
||
strcat(strTemp, "\\Texture\\");
|
||
g_ContTexture.SetFilePath( strTemp );
|
||
|
||
if( FALSE == CZ3DCharacterModel::_Init( strPath ) )
|
||
{
|
||
return;
|
||
}
|
||
|
||
if( false == CZ3DGeneralChrModel::_BuildCMDSList() )
|
||
{
|
||
return;
|
||
}
|
||
/////
|
||
m_bCharVisible = TRUE;
|
||
/*
|
||
m_pChr = new CZ3DGeneralChrModel;
|
||
m_pChr->Init( "PC_WOMAN.GCMDS" );
|
||
m_pChr->SetStaticSlot( "FACE", "FACE01" );
|
||
m_pChr->SetStaticSlot( "HAIR", "HAIR02" );
|
||
m_pChr->SetPosition(0.0f, 0.0f, 0.0f);
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
strcpy(m_strMotion, "WAIT");
|
||
m_pChr->SetMotion(m_strMotion);
|
||
m_pChr->SetAttachmentSlot("WEAPON", NULL);
|
||
*/
|
||
/* m_pChr = CSceneManager::AddCharacter("MON_Goblin.GCMDS","FACE01","HAIR01");
|
||
m_pChr->SetPosition(0.0f,0.0f,0.0f);
|
||
m_pChr->SetMotion("WAIT");
|
||
*/
|
||
SetupMatrices();
|
||
|
||
CZ3DCharacterModel::Process();
|
||
CZ3DObject::Process();
|
||
|
||
InitGrid();
|
||
|
||
if(m_lpEffect) { delete m_lpEffect; m_lpEffect = NULL; }
|
||
|
||
m_lpEffect = new CX3DEditEffect;
|
||
m_lpEffect->SetCenter(0.0f, 0.0f, 0.0f);
|
||
m_lpEffect->SetAxis(0.0f, 0.0f, 0.0f);
|
||
m_lpEffect->SetDevice(m_lpD3DDevice);
|
||
m_lpEffect->SetMaxFrame(30);
|
||
m_lpEffect->SetIncFrame(1.0f);
|
||
m_lpEffect->SetFrameTick(1000 / 30);
|
||
m_lpEffect->SetPlay(FALSE);
|
||
m_lpEffect->SetLoop(FALSE);
|
||
|
||
m_dwPickEffect = 0xFFFFFFFF;
|
||
|
||
m_cBackRed = 0;
|
||
m_cBackGreen = 0;
|
||
m_cBackBlue = 0;
|
||
CSceneManager::SetDevice(m_lpD3DDevice);
|
||
|
||
}
|
||
|
||
void CEffectEditorView::SetupMatrices()
|
||
{
|
||
D3DXMATRIX matWorld;
|
||
D3DXMatrixIdentity(&matWorld);
|
||
m_lpD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
|
||
|
||
m_fCameraX = 0.0f;
|
||
m_fCameraY = 130.0f;
|
||
m_fCameraZ = 0.0f;
|
||
m_fCameraRotX = m_fCameraRotY = m_fCameraRotZ = 0.0f;
|
||
m_fYaw = 0.0f;
|
||
m_fRange = -350.0f;
|
||
|
||
vector3 vecCamera = vector3(0.0f, 0.0f, m_fRange);
|
||
quaternion quatAxis;
|
||
quatAxis.Identity();
|
||
quatAxis.Yaw(m_fYaw);
|
||
z3d::VectorRotate(vecCamera, vecCamera, quatAxis);
|
||
|
||
vecCamera.x += m_fCameraX;
|
||
vecCamera.y += m_fCameraY;
|
||
vecCamera.z += m_fCameraZ;
|
||
|
||
D3DXMATRIX matView;
|
||
D3DXMatrixLookAtLH(&matView, (D3DXVECTOR3 *)&vecCamera, &D3DXVECTOR3(m_fCameraX, m_fCameraY, m_fCameraZ),
|
||
&D3DXVECTOR3(0.0f, 1.0f, 0.0f));
|
||
m_lpD3DDevice->SetTransform(D3DTS_VIEW, &matView);
|
||
|
||
D3DXMATRIX matProj;
|
||
D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/3, 1.0f, 1.0f, 1000000.0f);
|
||
m_lpD3DDevice->SetTransform(D3DTS_PROJECTION, &matProj);
|
||
}
|
||
|
||
D3DMATRIX g_matView;
|
||
void CEffectEditorView::Render()
|
||
{
|
||
|
||
// CZ3DObject *body;
|
||
// body = m_pChr->GetSkeletonPartObject("WAIST");
|
||
// matrix *head = body->GetTM();
|
||
// m_lpEffect->SetCenter(head->_41,head->_42,head->_43);
|
||
// CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
|
||
// if(GetFocus()->m_hWnd != mf->m_hWnd) return;
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
if(::GetForegroundWindow() != (HWND)mf->m_hWnd)
|
||
{
|
||
|
||
return;
|
||
}
|
||
m_lpD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(m_cBackRed, m_cBackGreen, m_cBackBlue), 1.0f, 0);
|
||
// if(!m_lpEffect->GetPlay())
|
||
{
|
||
MoveCamera();
|
||
}
|
||
|
||
m_lpD3DDevice->BeginScene();
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
|
||
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||
|
||
m_lpD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||
m_lpD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
|
||
/*
|
||
if(m_bCharVisible)
|
||
{
|
||
CZ3DRenderable::Process();
|
||
m_pChr->Render();
|
||
CZ3DRenderable::SecondProcess();
|
||
}
|
||
*/
|
||
matrix matWorld;
|
||
matWorld.MakeIdent();
|
||
m_lpD3DDevice->SetTransform(D3DTS_WORLD, (D3DMATRIX *)&matWorld);
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||
m_lpD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||
m_lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||
|
||
m_lpD3DDevice->SetVertexShader(LVERTEXFVF);
|
||
|
||
if(!m_lpEffect->GetPlay()) DrawGrid();
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
|
||
|
||
m_lpEffect->GetDevice()->GetTransform(D3DTS_VIEW, &g_matView);
|
||
m_lpEffect->SetViewMatrix((matrix *)&g_matView);
|
||
m_lpEffect->SetStart(true);
|
||
|
||
if(m_lpEffect->GetPlay())
|
||
{
|
||
m_dwTick = GetTickCount();
|
||
if(m_dwTick - m_dwOldTick >= m_lpEffect->GetFrameTick())
|
||
{
|
||
float fFrame = ((m_dwTick - m_dwOldTick) / m_lpEffect->GetFrameTick()) * m_lpEffect->GetIncFrame();
|
||
m_lpEffect->Interpolation(m_dwTick, (float)m_fPlayFrame);
|
||
|
||
CZ3DCharacterModel::Process();
|
||
CZ3DObject::Process();
|
||
|
||
m_dwOldTick = m_dwTick;
|
||
m_fPlayFrame += fFrame;
|
||
}
|
||
m_lpEffect->Render();
|
||
|
||
if(m_fPlayFrame > m_lpEffect->GetMaxFrame())
|
||
{
|
||
if(m_lpEffect->GetLoop())
|
||
{
|
||
m_fPlayFrame = 0.0f;
|
||
m_lpEffect->SetFrame(0.0f);
|
||
// m_pChr->SetMotion(m_strMotion);
|
||
// m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
} else
|
||
{
|
||
m_lpEffect->SetPlay(FALSE);
|
||
}
|
||
}
|
||
} else
|
||
{
|
||
m_lpEffect->Interpolation(0, m_dwPreFrame);
|
||
m_lpEffect->Render();
|
||
}
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||
|
||
if(!m_lpEffect->GetPlay() && m_dwPickEffect != 0xFFFFFFFF)
|
||
{
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
|
||
m_lpD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
|
||
m_lpEffect->RenderPicked(m_dwPickEffect, m_dwPreFrame);
|
||
m_lpD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
|
||
}
|
||
|
||
m_lpD3DDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
|
||
m_lpD3DDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
|
||
m_lpD3DDevice->EndScene();
|
||
|
||
m_lpD3DDevice->Present(NULL, NULL, NULL, NULL);
|
||
}
|
||
|
||
HRESULT CEffectEditorView::InitGrid()
|
||
{
|
||
m_lpGrid[0].v = vector3(-100000.0f, 0.0f, 0.0f);
|
||
m_lpGrid[0].diff = color(0xFF, 0x00, 0x00);
|
||
m_lpGrid[0].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[0].tu = m_lpGrid[0].tv = 0.0f;
|
||
|
||
m_lpGrid[1].v = vector3(100000.0f, 0.0f, 0.0f);
|
||
m_lpGrid[1].diff = color(0xFF, 0x00, 0x00);
|
||
m_lpGrid[1].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[1].tu = m_lpGrid[1].tv = 0.0f;
|
||
|
||
m_lpGrid[2].v = vector3(0.0f, -100000.0f, 0.0f);
|
||
m_lpGrid[2].diff = color(0x00, 0xFF, 0x00);
|
||
m_lpGrid[2].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[2].tu = m_lpGrid[2].tv = 0.0f;
|
||
|
||
m_lpGrid[3].v = vector3(0.0f, 100000.0f, 0.0f);
|
||
m_lpGrid[3].diff = color(0x00, 0xFF, 0x00);
|
||
m_lpGrid[3].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[3].tu = m_lpGrid[3].tv = 0.0f;
|
||
|
||
m_lpGrid[4].v = vector3(0.0f, 0.0f, -100000.0f);
|
||
m_lpGrid[4].diff = color(0x00, 0x00, 0xFF);
|
||
m_lpGrid[4].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[4].tu = m_lpGrid[4].tv = 0.0f;
|
||
|
||
m_lpGrid[5].v = vector3(0.0f, 0.0f, 100000.0f);
|
||
m_lpGrid[5].diff = color(0x00, 0x00, 0xFF);
|
||
m_lpGrid[5].spec = color(0xFF, 0xFF, 0xFF);
|
||
m_lpGrid[5].tu = m_lpGrid[5].tv = 0.0f;
|
||
|
||
return S_OK;
|
||
}
|
||
|
||
void CEffectEditorView::DrawGrid()
|
||
{
|
||
unsigned long Light;
|
||
|
||
m_lpD3DDevice->GetRenderState(D3DRS_LIGHTING, &Light);
|
||
|
||
m_lpD3DDevice->SetTexture(0, NULL);
|
||
|
||
if(Light)
|
||
{
|
||
m_lpD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||
m_lpD3DDevice->DrawPrimitiveUP(D3DPT_LINELIST, 3, m_lpGrid, sizeof(LVertex));
|
||
m_lpD3DDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
|
||
} else
|
||
{
|
||
m_lpD3DDevice->DrawPrimitiveUP(D3DPT_LINELIST, 3, m_lpGrid, sizeof(LVertex));
|
||
}
|
||
}
|
||
|
||
void CEffectEditorView::OnLButtonDown(UINT nFlags, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
m_bLButtonDown = TRUE;
|
||
|
||
CView::OnLButtonDown(nFlags, point);
|
||
}
|
||
|
||
void CEffectEditorView::OnLButtonUp(UINT nFlags, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
if(m_bLButtonDown)
|
||
{
|
||
vector3 vPickRayDir, vPickRayOrig, vPickRayEnd;
|
||
|
||
D3DXMATRIX matProj;
|
||
m_lpD3DDevice->GetTransform(D3DTS_PROJECTION, &matProj);
|
||
|
||
RECT rcClient;
|
||
GetClientRect(&rcClient);
|
||
|
||
// Compute the vector of the pick ray in screen space
|
||
D3DXVECTOR3 v;
|
||
v.x = ( ( ( 2.0f * point.x ) / (rcClient.right - rcClient.left) ) - 1 ) / matProj._11;
|
||
v.y = -( ( ( 2.0f * point.y ) / (rcClient.bottom - rcClient.top) ) - 1 ) / matProj._22;
|
||
v.z = 1.0f;
|
||
|
||
// Get the inverse view matrix
|
||
D3DXMATRIX matView, m;
|
||
m_lpD3DDevice->GetTransform(D3DTS_VIEW, &matView);
|
||
D3DXMatrixInverse(&m, NULL, &matView);
|
||
|
||
// Transform the screen space pick ray into 3D space
|
||
vPickRayDir.x = v.x*m._11 + v.y*m._21 + v.z*m._31;
|
||
vPickRayDir.y = v.x*m._12 + v.y*m._22 + v.z*m._32;
|
||
vPickRayDir.z = v.x*m._13 + v.y*m._23 + v.z*m._33;
|
||
vPickRayOrig.x = m._41;
|
||
vPickRayOrig.y = m._42;
|
||
vPickRayOrig.z = m._43;
|
||
vPickRayEnd = vPickRayOrig + vPickRayDir * 100000.0f;
|
||
|
||
unsigned long dwEffectKind = m_lpEffect->Pick(vPickRayOrig, vPickRayEnd, m_dwPickEffect);
|
||
if(m_dwPickEffect != 0xFFFFFFFF)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->SetActivePage(dwEffectKind);
|
||
|
||
switch(dwEffectKind)
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.SetKeyInfo();
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.SetKeyInfo();
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.SetKeyInfo();
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.SetKeyInfo();
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.SetKeyInfo();
|
||
break;
|
||
|
||
case EFFECT_MESH:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.SetKeyInfo();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
CView::OnLButtonUp(nFlags, point);
|
||
}
|
||
|
||
void CEffectEditorView::OnRButtonDown(UINT nFlags, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
m_bRButtonDown = TRUE;
|
||
m_dwPickEffect = 0xFFFFFFFF;
|
||
m_pointMouseMove = point;
|
||
|
||
CView::OnRButtonDown(nFlags, point);
|
||
}
|
||
|
||
void CEffectEditorView::OnRButtonUp(UINT nFlags, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
m_bRButtonDown = FALSE;
|
||
|
||
CView::OnRButtonUp(nFlags, point);
|
||
}
|
||
|
||
void CEffectEditorView::MoveCamera()
|
||
{
|
||
D3DXVECTOR3 vecT(0.0f, 0.0f, 0.0f);
|
||
|
||
if(!m_bActivite) return;
|
||
|
||
if(GetFocus()->m_hWnd != this->m_hWnd) return;
|
||
|
||
if(KeyPressed(VK_LCONTROL)) return;
|
||
|
||
if(KeyPressed('A')) vecT.x -= 0.5f; // Slide Left
|
||
if(KeyPressed('D')) vecT.x += 0.5f; // Slide Right
|
||
if(KeyPressed('W')) vecT.z += 0.5f; // Move Forward
|
||
if(KeyPressed('S')) vecT.z -= 0.5f; // Move Backward
|
||
if(KeyPressed('Q')) vecT.y -= 0.5f; // Move Up
|
||
if(KeyPressed('E')) vecT.y += 0.5f; // Move Down
|
||
if(KeyPressed('Z'))
|
||
m_fYaw += 0.015f; // Roll Up
|
||
if(KeyPressed('C'))
|
||
m_fYaw -= 0.015f; // Roll Down
|
||
|
||
if(KeyPressed(VK_SHIFT)){
|
||
vecT *= 100.0f;
|
||
}
|
||
|
||
m_fCameraX += vecT.x;
|
||
m_fCameraY += vecT.y;
|
||
m_fRange += vecT.z;
|
||
|
||
vector3 vecCamera = vector3(0.0f, 0.0f, m_fRange);
|
||
quaternion quatAxis;
|
||
quatAxis.Identity();
|
||
quatAxis.Yaw(m_fYaw);
|
||
z3d::VectorRotate(vecCamera, vecCamera, quatAxis);
|
||
|
||
vecCamera.x += m_fCameraX;
|
||
vecCamera.y += m_fCameraY;
|
||
vecCamera.z += m_fCameraZ;
|
||
|
||
D3DXMATRIX matView;
|
||
D3DXMatrixLookAtLH(&matView, (D3DXVECTOR3 *)&vecCamera, &D3DXVECTOR3(m_fCameraX, m_fCameraY, m_fCameraZ),
|
||
&D3DXVECTOR3(0.0f, 1.0f, 0.0f));
|
||
m_lpD3DDevice->SetTransform(D3DTS_VIEW, &matView);
|
||
}
|
||
|
||
void CEffectEditorView::OnMouseMove(UINT nFlags, CPoint point)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
|
||
CView::OnMouseMove(nFlags, point);
|
||
}
|
||
|
||
void CEffectEditorView::OnDestroy()
|
||
{
|
||
CView::OnDestroy();
|
||
|
||
// TODO: Add your message handler code here
|
||
if(m_lpEffect) { delete m_lpEffect; m_lpEffect = NULL; }
|
||
|
||
if(m_lpD3DDevice) { m_lpD3DDevice->Release(); m_lpD3DDevice = NULL; }
|
||
if(m_lpD3D) { m_lpD3D->Release(); m_lpD3D = NULL; }
|
||
}
|
||
|
||
void CEffectEditorView::OnFileOpen()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
char strFilter[50] = "Effect<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(*.eff)|*.eff|<7C><><EFBFBD><EFBFBD>ȭ<EFBFBD><C8AD>(*.*)|*.*||";
|
||
|
||
CFileDialog dlg(TRUE, "*.eff", "Untitled.eff", OFN_HIDEREADONLY | OFN_LONGNAMES, strFilter);
|
||
if(dlg.DoModal() == IDOK)
|
||
{
|
||
CString FileName = dlg.GetPathName();
|
||
int len = strlen((const char *)dlg.GetPathName()) - strlen((const char *)dlg.GetFileName());
|
||
char strPath[MAX_PATH];
|
||
memcpy(strPath, (const char *)dlg.GetPathName(), len);
|
||
strPath[len]= '\0';
|
||
|
||
m_lpEffect->Load((const char *)strPath, (const char *)dlg.GetFileName());
|
||
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.SetMaxFrame(m_lpEffect->GetMaxFrame() + 1);
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.m_sldKeyFrame.SetRange(0, m_lpEffect->GetMaxFrame());
|
||
}
|
||
}
|
||
|
||
void CEffectEditorView::OnFileSave()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
char strFilter[50] = "Effect<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(*.eff)|*.eff|<7C><><EFBFBD><EFBFBD>ȭ<EFBFBD><C8AD>(*.*)|*.*||";
|
||
|
||
CFileDialog dlg(FALSE, "*.eff", "Untitled.eff", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, strFilter);
|
||
if(dlg.DoModal() == IDOK)
|
||
{
|
||
CString FileName = dlg.GetPathName();
|
||
int len = strlen((const char *)dlg.GetPathName()) - strlen((const char *)dlg.GetFileName());
|
||
char strPath[MAX_PATH];
|
||
memcpy(strPath, (const char *)dlg.GetPathName(), len);
|
||
strPath[len]= '\0';
|
||
|
||
m_lpEffect->Save((const char *)strPath, (const char *)dlg.GetFileName());
|
||
}
|
||
}
|
||
|
||
void CEffectEditorView::OnEditRedo()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CCommand *RedoCommand = g_CommandManager.Redo();
|
||
|
||
if(!RedoCommand) return;
|
||
|
||
switch(RedoCommand->GetKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.Redo(RedoCommand);
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.Redo(RedoCommand);
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.Redo(RedoCommand);
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.Redo(RedoCommand);
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.Redo(RedoCommand);
|
||
break;
|
||
}
|
||
}
|
||
|
||
void CEffectEditorView::OnEditUndo()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CCommand *UndoCommand = g_CommandManager.Undo();
|
||
|
||
if(!UndoCommand) return;
|
||
|
||
switch(UndoCommand->GetKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.Undo(UndoCommand);
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.Undo(UndoCommand);
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.Undo(UndoCommand);
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.Undo(UndoCommand);
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.Undo(UndoCommand);
|
||
break;
|
||
}
|
||
}
|
||
|
||
void CEffectEditorView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView)
|
||
{
|
||
// TODO: Add your specialized code here and/or call the base class
|
||
m_bActivite = bActivate;
|
||
|
||
CView::OnActivateView(bActivate, pActivateView, pDeactiveView);
|
||
}
|
||
|
||
void CEffectEditorView::OnFileNew()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
if(m_lpEffect) { delete m_lpEffect; m_lpEffect = NULL; }
|
||
|
||
m_lpEffect = new CX3DEditEffect;
|
||
m_lpEffect->SetCenter(0.0f, 0.0f, 0.0f);
|
||
m_lpEffect->SetAxis(0.0f, 0.0f, 0.0f);
|
||
m_lpEffect->SetDevice(m_lpD3DDevice);
|
||
m_lpEffect->SetMaxFrame(30);
|
||
m_lpEffect->SetIncFrame(1.0f);
|
||
m_lpEffect->SetFrameTick(1000 / 30);
|
||
m_lpEffect->SetPlay(FALSE);
|
||
m_lpEffect->SetLoop(FALSE);
|
||
|
||
m_dwPickEffect = 0xFFFFFFFF;
|
||
|
||
/* CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.InitValue();
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.InitValue();
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.InitValue();
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.InitValue();
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.InitValue();*/
|
||
}
|
||
|
||
void CEffectEditorView::OnCharVisible()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_bCharVisible = TRUE;
|
||
}
|
||
|
||
void CEffectEditorView::OnCharInvisible()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_bCharVisible = FALSE;
|
||
}
|
||
|
||
void CEffectEditorView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||
{
|
||
// TODO: Add your message handler code here and/or call default
|
||
switch(nChar)
|
||
{
|
||
case '1':
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
if(m_dwPreFrame < 2)
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.SetKeyFrame(0);
|
||
else
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.SetKeyFrame(mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwPreFrame - 2);
|
||
|
||
if(0xFFFFFFFF != m_dwPickEffect)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectBase *pEffect = (CX3DEffectBase *)((CX3DEffect *)m_lpEffect)->GetEffect(m_dwPickEffect);
|
||
switch(pEffect->GetEffectKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.SetKeyInfo();
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.SetKeyInfo();
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.SetKeyInfo();
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.SetKeyInfo();
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.SetKeyInfo();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case '2':
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
if(mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwPreFrame >= mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwTotalFrame)
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.SetKeyFrame(mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwTotalFrame - 1);
|
||
else
|
||
mf->m_KeyBar.m_lpKeySheet->m_Page1.SetKeyFrame(mf->m_KeyBar.m_lpKeySheet->m_Page1.m_dwPreFrame);
|
||
|
||
if(0xFFFFFFFF != m_dwPickEffect)
|
||
{
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
CX3DEffectBase *pEffect = (CX3DEffectBase *)((CX3DEffect *)m_lpEffect)->GetEffect(m_dwPickEffect);
|
||
switch(pEffect->GetEffectKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.SetKeyInfo();
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.SetKeyInfo();
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.SetKeyInfo();
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.SetKeyInfo();
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.SetKeyInfo();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case '4':
|
||
m_fPlayFrame = 0.0f;
|
||
m_dwOldTick = GetTickCount() - 33;
|
||
m_lpEffect->SetFrame(0.0f);
|
||
m_lpEffect->SetPlay(TRUE);
|
||
break;
|
||
|
||
case ('[' + 128):
|
||
{
|
||
if(m_dwPickEffect == 0xFFFFFFFF)
|
||
{
|
||
m_dwPickEffect = m_lpEffect->GetEffectSize() - 1;
|
||
}
|
||
else
|
||
{
|
||
if(m_dwPickEffect == 0) m_dwPickEffect = m_lpEffect->GetEffectSize() - 1; else m_dwPickEffect--;
|
||
}
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->SetActivePage(m_lpEffect->GetEffectKind(m_dwPickEffect));
|
||
CX3DEffectBase *pEffect = (CX3DEffectBase *)((CX3DEffect *)m_lpEffect)->GetEffect(m_dwPickEffect);
|
||
switch(pEffect->GetEffectKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.SetKeyInfo();
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.SetKeyInfo();
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.SetKeyInfo();
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.SetKeyInfo();
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.SetKeyInfo();
|
||
break;
|
||
|
||
case EFFECT_MESH:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.SetKeyInfo();
|
||
break;
|
||
}
|
||
SetFocus();
|
||
}
|
||
break;
|
||
|
||
|
||
case (']' + 128):
|
||
{
|
||
if(m_dwPickEffect == 0xFFFFFFFF)
|
||
{
|
||
m_dwPickEffect = 0;
|
||
}
|
||
else
|
||
{
|
||
if(m_dwPickEffect == m_lpEffect->GetEffectSize() - 1) m_dwPickEffect = 0; else m_dwPickEffect++;
|
||
}
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->SetActivePage(m_lpEffect->GetEffectKind(m_dwPickEffect));
|
||
CX3DEffectBase *pEffect = (CX3DEffectBase *)((CX3DEffect *)m_lpEffect)->GetEffect(m_dwPickEffect);
|
||
switch(pEffect->GetEffectKind())
|
||
{
|
||
case 0:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page1.SetKeyInfo();
|
||
break;
|
||
|
||
case 1:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page2.SetKeyInfo();
|
||
break;
|
||
|
||
case 2:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page3.SetKeyInfo();
|
||
break;
|
||
|
||
case 3:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page4.SetKeyInfo();
|
||
break;
|
||
|
||
case 4:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page5.SetKeyInfo();
|
||
break;
|
||
|
||
case EFFECT_MESH:
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.SetKeyInfo();
|
||
break;
|
||
}
|
||
SetFocus();
|
||
}
|
||
break;
|
||
/*
|
||
case ('.'): {
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.SetKeyInfo();
|
||
SetFocus();
|
||
if(mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum < mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectMax-1) {
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum++;
|
||
}
|
||
else {
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum = 0;
|
||
}
|
||
}
|
||
break;
|
||
case ('/'): {
|
||
CMainFrame *mf=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.SetKeyInfo();
|
||
SetFocus();
|
||
if(mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum > 0)
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum--;
|
||
else {
|
||
mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectNum = mf->m_EffectBar.m_lpEffectSheet->m_Page6.m_dwObjectMax -1;
|
||
}
|
||
}
|
||
break;
|
||
*/
|
||
}//switch
|
||
CView::OnKeyDown(nChar, nRepCnt, nFlags);
|
||
}
|
||
|
||
void CEffectEditorView::OnCharWait()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "WAIT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharWalk()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "WALK");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttack()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ATTACK");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttackAdvance()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ATTACK_ADVANCE");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttackLeft()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ATTACK_LEFT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttackRetreat()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ATTACK_RETREAT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttackRight()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ATTACK_RIGHT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharAttacked()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "ATTACKED");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBack()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "WALK_BACK");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBash()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "BASH");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharCasting()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "CASTING");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharCripWeapon()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "GRIP_WEAPON");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharEnd()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "CAST_END");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharFalldown()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
strcpy(m_strMotion, "FALLDOWN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharGetUp()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
m_pChr->SetMotion("SIT_DOWN");
|
||
strcpy(m_strMotion, "GET_UP");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharLeft()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "WALK_LEFT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharPutInWeapon()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "PUT_IN_WEAPON");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharRest()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
m_pChr->SetMotion("SIT_DOWN");
|
||
strcpy(m_strMotion, "REST");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharRestoreHand()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "RESTORE_HAND");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharRight()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "WALK_RIGHT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharRun()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "RUN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharSitDown()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
strcpy(m_strMotion, "SIT_DOWN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharStun()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
strcpy(m_strMotion, "STUN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharTakeOutWeapon()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "TAKE_OUT_WEAPON");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharNormal()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 0);
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBattle()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet("NO_WEAPON_B");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBlunt()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "STAFF");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_BLUNT");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBow()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "COMPOSITE_BOW");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_BOW");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharCrossbow()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "ARBALEST");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_CROSSBOW");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharDagger()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "DAGGER");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_DAGGER");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharNoweaponb()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", NULL);
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "NO_WEAPON_B");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharOnehand()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "PRACTICE_SWORD");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_ONE_HAND");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharTwohand()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetAttachmentSlot("WEAPON", "ANCIENT_SWORD");
|
||
m_pChr->SetAttachmentHolder("WEAPON", 1);
|
||
strcpy(m_strWeaponSeet, "WEAPON_TWO_HAND");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharMCastBegin()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "M_CAST_BEGIN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharMCasting1()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "M_CASTING");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharMCasting2()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "M_CASTING2");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharCastBegin()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "CAST_BEGIN");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharCasting2()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "CASTING2");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharBlow()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "COMBINATION_BLOW");
|
||
}
|
||
|
||
void CEffectEditorView::OnCharRoundSwing()
|
||
{
|
||
// TODO: Add your command handler code here
|
||
m_pChr->SetMotionSheet(m_strWeaponSeet);
|
||
strcpy(m_strMotion, "ROUND_SWING");
|
||
}
|