diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/WalkerDlg.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/WalkerDlg.cpp')
-rw-r--r-- | src/T2DLL/WalkerDlg.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/T2DLL/WalkerDlg.cpp b/src/T2DLL/WalkerDlg.cpp new file mode 100644 index 0000000..f93a376 --- /dev/null +++ b/src/T2DLL/WalkerDlg.cpp @@ -0,0 +1,87 @@ +#include "CT2App.h" +#include "T2CtrlPalette.h" +#include "T2DlgItem.h" +#include "T2MainWindow.h" +#include "T2MWControl.h" +#include "T2TowerDoc.h" +#include "T2WorldDef.h" +#include "WalkerDlg.h" + +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; +} |