#include "CT2App.h" #include "T2CtrlPalette.h" #include "T2DlgItem.h" #include "T2MainWindow.h" #include "T2MWControl.h" #include "T2TowerDoc.h" #include "T2WorldDef.h" #include "WalkerDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif WalkerDlg::WalkerDlg() { mDeleteOnClose = true; } /*virtual*/ WalkerDlg::~WalkerDlg() { } void WalkerDlg::Setup(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, const POINT &inPt, T2ImageObj *inImageObj) { mDocument = inDoc; T2DLGTEMPLATE tmpl; tmpl.resID = 7030; tmpl.pt = inPt; tmpl.moduleHandle = inInstance; Realize(inParentWnd, &tmpl, inDoc, inImageObj, inDoc->mWorldDef->GetPalette(), false, inParentWnd, 202, true); ShowWindow(SW_HIDE); } void WalkerDlg::Revert() { if (mFC != 1) { T2DlgItem *item = GetT2DlgItem(107 + mFC); item->SetValue(0); mFC = 1; item = GetT2DlgItem(107 + mFC); item->SetValue(1); } } void WalkerDlg::Save() { T2CtrlPalette *theCtrlPalette = ((CT2App *) AfxGetApp())->mMainWindow->mCtrlPalette; if (!theCtrlPalette) return; T2MWControl *theSlider = theCtrlPalette->mSliderControl; if (!theSlider) return; int value = 0; if (mFC != 0) value = 7 - mFC; theSlider->SetData(value); if (mFC == 0) mDocument->towerDoc_vf14C(-1); else mDocument->towerDoc_vf14C(mFC); } /*virtual*/ void WalkerDlg::OnT2Create() { mFC = mDocument->towerDoc_vf148(); if (mFC == -1) mFC = 0; T2DlgItem *item = GetT2DlgItem(107 + mFC); item->SetValue(1); } /*virtual*/ int WalkerDlg::OnT2DialogCommand(UINT cmd, long data) { int result = 1; WORD w = LOWORD(cmd); if (w >= 107 && w <= 113) { T2DlgItem *item = GetT2DlgItem(107 + mFC); item->SetValue(0); mFC = w - 107; item = GetT2DlgItem(w); item->SetValue(1); } else { result = T2Dialog::OnT2DialogCommand(cmd, data); } return result; }