MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / UpdateDialog

Method UpdateDialog

editor/ProceduralDialog.cpp:166–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void CProceduralDialog::UpdateDialog() {
167 int n = D3EditState.texdlg_texture;
168
169 // Update procedural box
170 SendDlgItemMessage(IDC_PROCEDURAL_PULLDOWN, CB_RESETCONTENT, 0, 0);
171 for (int i = 0; stricmp("End", ProcNames[i]) != 0; i++) {
172 SendDlgItemMessage(IDC_PROCEDURAL_PULLDOWN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)ProcNames[i]);
173 }
174 SendDlgItemMessage(IDC_PROCEDURAL_PULLDOWN, CB_SELECTSTRING, 0, (LPARAM)(LPCTSTR)ProcNames[m_proc_type]);
175
176 // Update palette box
177 CWnd *texwnd;
178 RECT rect;
179
180 texwnd = GetDlgItem(IDC_PALETTE_VIEW);
181 texwnd->GetWindowRect(&rect);
182 ScreenToClient(&rect);
183
184 int w = rect.right - rect.left;
185 int h = rect.bottom - rect.top;
186
187 Desktop_surf->attach_to_window((unsigned)m_hWnd);
188
189 uint16_t *data = bm_data(m_palette_bitmap, 0);
190
191 for (i = 0; i < h; i++) {
192 float cur_color = 0;
193 float color_delta = 256.0 / (float)w;
194 for (int t = 0; t < w; t++, cur_color += color_delta) {
195 data[i * w + t] = GameTextures[n].procedural->palette[(int)cur_color];
196 }
197 }
198
199 m_PaletteSurf.load(m_palette_bitmap);
200
201 int x = rect.left + ((rect.right - rect.left) / 2) - m_PaletteSurf.width() / 2;
202 int y = rect.top + ((rect.bottom - rect.top) / 2) - m_PaletteSurf.height() / 2;
203
204 Desktop_surf->blt(x, y, &m_PaletteSurf);
205
206 // fill in the combo box for copy procedural data
207 CComboBox *combo;
208 combo = (CComboBox *)GetDlgItem(IDC_PROC_COPY_LIST);
209 combo->ResetContent();
210 for (i = 0; i < MAX_TEXTURES; i++) {
211 if (!GameTextures[i].used)
212 continue;
213 if (i == D3EditState.texdlg_texture)
214 continue;
215 if (!(GameTextures[i].flags & TF_PROCEDURAL))
216 continue;
217 if ((GameTextures[i].flags & TF_WATER_PROCEDURAL))
218 continue;
219 combo->AddString(GameTextures[i].name);
220 }
221 combo->SetCurSel(0);
222}
223

Callers

nothing calls this directly

Calls 7

bm_dataFunction · 0.85
attach_to_windowMethod · 0.80
AddStringMethod · 0.80
loadMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
bltMethod · 0.45

Tested by

no test coverage detected