// FogPropertiesPanel.cpp : implementation file // #include "stdafx.h" #include "mw4gameed2.h" #include "ObjectManager.h" #include "FogPropertiesPanel.h" #include "GameInterface.h" ///////////////////////////////////////////////////////////////////////////// // CFogPropertiesPanel dialog CFogPropertiesPanel::CFogPropertiesPanel(ObjectManager *gobj,UndoCommand **cmd,CWnd* pParent /*=NULL*/) : CPanelDlg(CFogPropertiesPanel::IDD, pParent) { ObjMan=gobj; CmdList=cmd; //{{AFX_DATA_INIT(CFogPropertiesPanel) // NOTE: the ClassWizard will add member initialization here m_GDen = 0.0f; m_GEnd = 0.0f; m_GStart = 0.0f; m_CDensity = 0.0f; m_CEnd = 0.0f; m_CStart = 0.0f; m_HEnd = 0.0f; m_HOpac = 0.0f; m_HStart = 0.0f; m_LDensity = 0.0f; m_LEnd = 0.0f; m_LStart = 0.0f; //}}AFX_DATA_INIT } void CFogPropertiesPanel::DoDataExchange(CDataExchange* pDX) { CPanelDlg::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFogPropertiesPanel) DDX_Text(pDX, IDC_GSTART, m_GStart); DDV_MinMaxFloat(pDX, m_GStart, 0.f, 10000.0f); DDX_Text(pDX, IDC_LDENSITY, m_LDensity); DDV_MinMaxFloat(pDX, m_LDensity, 0.f, 2.f); DDX_Text(pDX, IDC_GDENSITY, m_GDen); DDV_MinMaxFloat(pDX, m_GDen, 0.f, 2.f); DDX_Text(pDX, IDC_GEND, m_GEnd); DDV_MinMaxFloat(pDX, m_GEnd, 0.f, 10000.0f); DDX_Text(pDX, IDC_CDENSITY, m_CDensity); DDV_MinMaxFloat(pDX, m_CDensity, 0.f, 2.f); DDX_Text(pDX, IDC_CEND, m_CEnd); DDV_MinMaxFloat(pDX, m_CEnd, 0.f, 10000.0f); DDX_Text(pDX, IDC_CSTART, m_CStart); DDV_MinMaxFloat(pDX, m_CStart, 0.f, 10000.0f); DDX_Text(pDX, IDC_HEND, m_HEnd); DDV_MinMaxFloat(pDX, m_HEnd, 0.f, 10000.0f); DDX_Text(pDX, IDC_HOPAC, m_HOpac); DDV_MinMaxFloat(pDX, m_HOpac, 0.f, 1.f); DDX_Text(pDX, IDC_HSTART, m_HStart); DDV_MinMaxFloat(pDX, m_HStart, 0.f, 10000.0f); DDX_Text(pDX, IDC_LEND, m_LEnd); DDV_MinMaxFloat(pDX, m_LEnd, 0.f, 10000.0f); DDX_Text(pDX, IDC_LSTART, m_LStart); DDV_MinMaxFloat(pDX, m_LStart, 0.f, 10000.0f); //}}AFX_DATA_MAP } BOOL CFogPropertiesPanel::ValidateData() { if(!CPanelDlg::ValidateData()) return FALSE; if(m_GStart>=m_GEnd || m_HStart>=m_HEnd || m_CStart>=m_CEnd || m_LStart>=m_LEnd) { MessageBox("Incorrect Fog Settings","Input Error",MB_OK); return FALSE; } if(m_GStart<0 || m_GEnd<0 || m_HStart<0 || m_HEnd<0 || m_CStart<0 || m_CEnd<0 || m_LStart<0 || m_LEnd<0) { MessageBox("Fog Settings < 0","Input Error",MB_OK); return FALSE; } if(m_GStart>GetFarClip() || m_GEnd>GetFarClip() || m_HStart>GetFarClip() || m_HEnd>GetFarClip() || m_CStart>GetFarClip() || m_CEnd>GetFarClip() || m_LStart>GetFarClip() || m_LEnd>GetFarClip()) { CString msg; msg.Format("Fog Settings > %5.3f (Far Clip)",GetFarClip()); MessageBox(msg,"Input Error",MB_OK); return FALSE; } return TRUE; } BEGIN_MESSAGE_MAP(CFogPropertiesPanel, CPanelDlg) //{{AFX_MSG_MAP(CFogPropertiesPanel) ON_EN_KILLFOCUS(IDC_HOPAC, OnKillfocusHopac) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFogPropertiesPanel message handlers void CFogPropertiesPanel::OnOK() { UpdateData(TRUE); ObjMan->MisDat.SetGeneralFog(m_GStart,m_GEnd,m_GDen); ObjMan->MisDat.SetCustomFog(m_CStart,m_CEnd,m_CDensity); ObjMan->MisDat.SetLightFog(m_LStart,m_LEnd,m_LDensity); ObjMan->MisDat.SetHeightFog(m_HStart,m_HEnd,m_HOpac); } BOOL CFogPropertiesPanel::OnInitDialog() { CPanelDlg::OnInitDialog(); ObjMan->MisDat.GetGeneralFog(&m_GStart,&m_GEnd,&m_GDen); ObjMan->MisDat.GetCustomFog(&m_CStart,&m_CEnd,&m_CDensity); ObjMan->MisDat.GetLightFog(&m_LStart,&m_LEnd,&m_LDensity); ObjMan->MisDat.GetHeightFog(&m_HStart,&m_HEnd,&m_HOpac); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CFogPropertiesPanel::OnKillfocusHopac() { // TODO: Add your control notification handler code here UpdateData(TRUE); }