From c2efba6907fab934a04959b9bb644cf7141cc955 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 23:04:04 +0100 Subject: matched T2DLL as well as i can --- src/T2DLL/SoundDlg.cpp | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'src/T2DLL/SoundDlg.cpp') diff --git a/src/T2DLL/SoundDlg.cpp b/src/T2DLL/SoundDlg.cpp index 20db73d..705bd70 100644 --- a/src/T2DLL/SoundDlg.cpp +++ b/src/T2DLL/SoundDlg.cpp @@ -34,14 +34,17 @@ void SoundDlg::Setup(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, } void SoundDlg::Revert() { - T2DlgItem *theCheck = GetT2DlgItem(100); + T2DlgItemText *theText; + T2DlgItem *theCheck, *theICheck; + + theCheck = GetT2DlgItem(100); theCheck->SetValue(1); for (int i = 0; i < 4; i++) { - T2DlgItem *theICheck = GetT2DlgItem(101 + i); + theICheck = GetT2DlgItem(101 + i); theICheck->SetValue(1); - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(RGB(0, 0, 0)); } @@ -74,22 +77,25 @@ void SoundDlg::Save() { } /*virtual*/ void SoundDlg::OnT2Create() { + T2DlgItem *theCheck, *theICheck; T2SoundPlayer *theSoundPlayer = mDocument->towerDoc_vf134(); - T2DlgItem *theCheck = GetT2DlgItem(100); + theCheck = GetT2DlgItem(100); if (theSoundPlayer->IsSoundOn()) { theCheck->SetValue(1); } else { theCheck->SetValue(0); + + T2DlgItemText *theText; for (int i = 0; i < 4; i++) { - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(RGB(128, 128, 128)); } } unsigned int theMask = theSoundPlayer->GetSEMask(); for (int i = 0; i < 4; i++) { - T2DlgItem *theICheck = GetT2DlgItem(101 + i); + theICheck = GetT2DlgItem(101 + i); if (theMask & masks[i]) theICheck->SetValue(1); else @@ -97,28 +103,29 @@ void SoundDlg::Save() { } } -/*virtual*/ int SoundDlg::OnT2DialogCommand(UINT cmd, long data) { - int result = 1; +/*virtual*/ BOOL SoundDlg::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + COLORREF col; + BOOL done = true; T2DlgItem *theCheck = GetT2DlgItem(100); - BOOL isSoundOn = theCheck->GetValue(); - WORD w = LOWORD(cmd); + BOOL value = theCheck->GetValue(); + WORD id = LOWORD(inWParam); - if (w == 100) { - COLORREF col; - if (isSoundOn) + if (id == 100) { + if (value) col = RGB(0, 0, 0); else col = RGB(128, 128, 128); + T2DlgItemText *theText; for (int i = 0; i < 4; i++) { - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(col); } Invalidate(); - } else if (w >= 101 && w < 105) { - if (!isSoundOn) { - T2DlgItem *theICheck = GetT2DlgItem(w); + } else if (id >= 101 && id < 105) { + if (!value) { + T2DlgItem *theICheck = GetT2DlgItem(id); int oldValue = theICheck->GetValue(); if (oldValue) theICheck->SetValue(0); @@ -126,8 +133,8 @@ void SoundDlg::Save() { theICheck->SetValue(1); } } else { - result = T2Dialog::OnT2DialogCommand(cmd, data); + done = T2Dialog::OnT2DialogCommand(inWParam, inLParam); } - return result; + return done; } -- cgit v1.2.3