| 164 | } |
| 165 | |
| 166 | void 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 | |