// FXPanel.cpp : implementation file // #include "stdafx.h" #include "mw4gameed2.h" #include "FXPanel.h" #include "GUIFXGenerator.h" #include using namespace Adept; ///////////////////////////////////////////////////////////////////////////// // CFXPanel dialog CFXPanel::CFXPanel(GUIFXGenerator *gobj,UndoCommand **cmd,CWnd* pParent) : CPanelDlg(CFXPanel::IDD, pParent) { MyObj=gobj; CmdLst=cmd; //{{AFX_DATA_INIT(CFXPanel) m_Delay = 0.0f; m_NightOnly = FALSE; m_Random = FALSE; //}}AFX_DATA_INIT } void CFXPanel::DoDataExchange(CDataExchange* pDX) { CPanelDlg::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFXPanel) DDX_Control(pDX, IDC_FXLIST, m_FXList); DDX_Text(pDX, IDC_DELAY, m_Delay); DDX_Check(pDX, IDC_NIGHTONLY, m_NightOnly); DDX_Check(pDX, IDC_RANDOM, m_Random); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CFXPanel, CPanelDlg) //{{AFX_MSG_MAP(CFXPanel) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFXPanel message handlers void CFXPanel::OnOK() { UpdateData(TRUE); if(m_FXList.GetCurSel()>=0) { MyObj->SetEffect(*((ResourceID *)m_FXList.GetItemDataPtr(m_FXList.GetCurSel()))); } MyObj->SetRandom(m_Random?true:false); MyObj->SetDelay(m_Delay); MyObj->SetNightOnly(m_NightOnly?true:false); } void CFXPanel::FillEffectList() { if(Adept::ResourceManager::Instance==NULL) return; Adept::Resource curres; curres.First(NULL); CString res_name,base_name,dir_name; int item; int depth,sp,i; m_FXList.ResetContent(); while(curres.ReadAndNext()) { res_name=(char *)curres.GetName(); res_name.MakeLower(); if(res_name.Right(5).Compare(".data")==NULL) { // This is a Data File base_name=res_name.Mid(res_name.ReverseFind('\\')+1); base_name=base_name.Left(base_name.GetLength()-5); sp=res_name.Find("effects\\"); depth=0; if(sp>=0) for(i=sp;iGetEffect(); int sel=0; if(resid!=ResourceID::Null) { Resource effect_res(resid); sel=-1; int i; for(i=0;iGetEffect()) sel=i; } } m_FXList.SetCurSel(sel); m_Random = MyObj->IsRandom(); m_Delay = MyObj->GetDelay(); m_NightOnly = MyObj->IsNightOnly(); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }