1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#include "SoundDlg.h"
#include "T2.h"
#include "T2DlgItem.h"
#include "T2DlgItemText.h"
#include "T2MainWindow.h"
#include "T2MWControl.h"
#include "T2SoundPlayer.h"
#include "T2TowerDoc.h"
#include "T2WorldDef.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
SoundDlg::SoundDlg() {
mDeleteOnClose = true;
}
/*virtual*/ SoundDlg::~SoundDlg() {
}
void SoundDlg::Setup(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, const POINT &inPt, T2ImageObj *inImageObj) {
mDocument = inDoc;
T2DLGTEMPLATE tmpl;
tmpl.resID = 7020;
tmpl.pt = inPt;
tmpl.moduleHandle = inInstance;
Realize(inParentWnd, &tmpl, inDoc, inImageObj, inDoc->mWorldDef->GetPalette(), false, inParentWnd, 201, true);
ShowWindow(SW_HIDE);
}
void SoundDlg::Revert() {
T2DlgItemText *theText;
T2DlgItem *theCheck, *theICheck;
theCheck = GetT2DlgItem(100);
theCheck->SetValue(1);
for (int i = 0; i < 4; i++) {
theICheck = GetT2DlgItem(101 + i);
theICheck->SetValue(1);
theText = (T2DlgItemText *) GetT2DlgItem(111 + i);
theText->SetTextColor(RGB(0, 0, 0));
}
Invalidate();
}
// T2DLL.dll 100DBC20
static unsigned int masks[4] = {
9, 2, 0x30, 4
};
void SoundDlg::Save() {
T2SoundPlayer *theSoundPlayer = mDocument->GetSoundPlayer();
T2DlgItem *theCheck = GetT2DlgItem(100);
if (theCheck->GetValue())
theSoundPlayer->SetSoundOn(true);
else
theSoundPlayer->SetSoundOn(false);
unsigned int theMask = theSoundPlayer->GetSEMask();
for (int i = 0; i < 4; i++) {
T2DlgItem *theICheck = GetT2DlgItem(101 + i);
if (theICheck->GetValue())
theMask |= masks[i];
else
theMask &= ~masks[i];
}
theSoundPlayer->SetSEMask(theMask);
}
/*virtual*/ void SoundDlg::OnT2Create() {
T2DlgItem *theCheck, *theICheck;
T2SoundPlayer *theSoundPlayer = mDocument->GetSoundPlayer();
theCheck = GetT2DlgItem(100);
if (theSoundPlayer->IsSoundOn()) {
theCheck->SetValue(1);
} else {
theCheck->SetValue(0);
T2DlgItemText *theText;
for (int i = 0; i < 4; i++) {
theText = (T2DlgItemText *) GetT2DlgItem(111 + i);
theText->SetTextColor(RGB(128, 128, 128));
}
}
unsigned int theMask = theSoundPlayer->GetSEMask();
for (int i = 0; i < 4; i++) {
theICheck = GetT2DlgItem(101 + i);
if (theMask & masks[i])
theICheck->SetValue(1);
else
theICheck->SetValue(0);
}
}
/*virtual*/ BOOL SoundDlg::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) {
COLORREF col;
BOOL done = true;
T2DlgItem *theCheck = GetT2DlgItem(100);
BOOL value = theCheck->GetValue();
WORD id = LOWORD(inWParam);
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++) {
theText = (T2DlgItemText *) GetT2DlgItem(111 + i);
theText->SetTextColor(col);
}
Invalidate();
} else if (id >= 101 && id < 105) {
if (!value) {
T2DlgItem *theICheck = GetT2DlgItem(id);
int oldValue = theICheck->GetValue();
if (oldValue)
theICheck->SetValue(0);
else
theICheck->SetValue(1);
}
} else {
done = T2Dialog::OnT2DialogCommand(inWParam, inLParam);
}
return done;
}
|