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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
#include "T2CtrlPalette.h"
#include "T2ImageObj.h"
#include "T2MWControl.h"
#include "T2TowerDoc.h"
#include "T2WorldDef.h"
// T2.exe 44795C
/*static*/ int T2CtrlPalette::sUnknown = 0;
T2CtrlPalette::T2CtrlPalette() {
#line 19
mPauseControl = DEBUG_NEW T2MWControl;
mInViewControl = DEBUG_NEW T2MWControl;
mOutViewControl = DEBUG_NEW T2MWControl;
mMaintControl = DEBUG_NEW T2MWControl;
mEvalControl = DEBUG_NEW T2MWControl;
mTransControl = DEBUG_NEW T2MWControl;
mPriceControl = DEBUG_NEW T2MWControl;
mSliderControl = DEBUG_NEW T2MWControl;
mDocument = NULL;
mWorldDef = NULL;
sUnknown = 0;
mIsSetUp = false;
}
/*virtual*/ T2CtrlPalette::~T2CtrlPalette() {
delete mPauseControl;
delete mInViewControl;
delete mOutViewControl;
delete mMaintControl;
delete mEvalControl;
delete mTransControl;
delete mPriceControl;
delete mSliderControl;
}
BEGIN_MESSAGE_MAP(T2CtrlPalette, CFrameWnd)
ON_WM_CREATE()
ON_WM_QUERYNEWPALETTE()
ON_WM_ERASEBKGND()
ON_WM_CLOSE()
END_MESSAGE_MAP()
/*virtual*/ void T2CtrlPalette::Setup(T2TowerDoc *inDoc) {
mDocument = inDoc;
mWorldDef = inDoc->mWorldDef;
mE4 = AfxRegisterWndClass(CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH));
RECT rect;
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Pause", 0), rect);
mPauseControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2000);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("InView", 0), rect);
mInViewControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2001);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("OutView", 0), rect);
mOutViewControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2006);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Maint", 0), rect);
mMaintControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2004);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Eval", 0), rect);
mEvalControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2003);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Trans", 0), rect);
mTransControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2005);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Price", 0), rect);
mPriceControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2002);
mWorldDef->mImageObj->GetObjectImage(mWorldDef->mImageObj->FindObject("Slider", 0), rect);
mSliderControl->Create(mE4, "", WS_CHILD | WS_VISIBLE, rect, this, 2007);
mPauseControl->Setup(inDoc);
mInViewControl->Setup(inDoc);
mOutViewControl->Setup(inDoc);
mMaintControl->Setup(inDoc);
mEvalControl->Setup(inDoc);
mTransControl->Setup(inDoc);
mPriceControl->Setup(inDoc);
mSliderControl->Setup(inDoc);
mIsSetUp = true;
InvalidateRect(NULL);
}
/*virtual*/ void T2CtrlPalette::vf100(int which) {
mInViewControl->SetData(0);
mOutViewControl->SetData(0);
mMaintControl->SetData(0);
mEvalControl->SetData(0);
mTransControl->SetData(0);
mPriceControl->SetData(0);
int walkRate = mDocument->towerDoc_vf148();
if (walkRate == -1)
walkRate = 0;
else
walkRate = 7 - walkRate;
mSliderControl->SetData(walkRate);
switch (which) {
case 0:
mInViewControl->SetData(100);
break;
case 1:
mOutViewControl->SetData(100);
break;
case 4:
mMaintControl->SetData(100);
break;
case 2:
mEvalControl->SetData(100);
break;
case 5:
mTransControl->SetData(100);
break;
case 3:
mPriceControl->SetData(100);
break;
}
InvalidateRect(NULL);
}
/*virtual*/ void T2CtrlPalette::vf104(int which) {
RECT windowRect;
RECT clientRect;
int flag = 0;
int y;
switch (which) {
case 0:
case 6:
y = 0;
break;
case 1:
y = 0;
flag = 1;
break;
case 4:
y = 21;
mE0 = "Maint";
break;
case 2:
y = 21;
mE0 = "Eval";
break;
case 5:
y = 21;
mE0 = "Trans";
break;
case 3:
y = 21;
mE0 = "Price";
break;
}
GetWindowRect(&windowRect);
GetClientRect(&clientRect);
SetWindowPos(
NULL,
0, 0,
windowRect.right - windowRect.left - clientRect.right + 123,
windowRect.bottom - windowRect.top - clientRect.bottom + 51 + y,
SWP_NOMOVE | SWP_NOZORDER
);
InvalidateRect(NULL);
}
afx_msg int T2CtrlPalette::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
RECT windowRect;
RECT clientRect;
GetWindowRect(&windowRect);
GetClientRect(&clientRect);
SetWindowPos(
NULL,
0, 0,
windowRect.right - windowRect.left - clientRect.right + 123,
windowRect.bottom - windowRect.top - clientRect.bottom + 51,
SWP_NOMOVE | SWP_NOZORDER
);
return 0;
}
afx_msg BOOL T2CtrlPalette::OnQueryNewPalette() {
return CFrameWnd::OnQueryNewPalette();
}
afx_msg BOOL T2CtrlPalette::OnEraseBkgnd(CDC* pDC) {
if (!mDocument)
return CFrameWnd::OnEraseBkgnd(pDC);
pDC->SaveDC();
pDC->SelectPalette(mWorldDef->GetPalette(), false);
RECT rect;
int objectID = mWorldDef->mImageObj->FindObject("CtrlPal");
SetRect(&rect, 0, 0, 123, 51);
mWorldDef->mImageObj->DrawObject(pDC, objectID, rect);
objectID = mWorldDef->mImageObj->FindObject(mE0, 1000);
if (objectID >= 0) {
SetRect(&rect, 0, 51, 123, 72);
mWorldDef->mImageObj->DrawObject(pDC, objectID, rect);
}
pDC->RealizePalette();
pDC->RestoreDC(-1);
return true;
}
afx_msg void T2CtrlPalette::OnClose() {
if (!mDocument)
return;
mDocument->towerDoc_vf198(kTowerDocWindowType0);
}
/*virtual*/ void T2CtrlPalette::vf108() {
}
|