| 218 | } |
| 219 | |
| 220 | BOOL CWaterProceduralDialog::OnInitDialog() { |
| 221 | CDialog::OnInitDialog(); |
| 222 | |
| 223 | CWnd::SetTimer(1, 33, NULL); // 30 frames per second |
| 224 | |
| 225 | int save_num = 0; |
| 226 | int n = D3EditState.texdlg_texture; |
| 227 | |
| 228 | // Make a temp buffer for our static elements |
| 229 | if (GameTextures[n].procedural->num_static_elements > 0) { |
| 230 | save_num = GameTextures[n].procedural->num_static_elements; |
| 231 | memcpy(save_elements, GameTextures[n].procedural->static_proc_elements, save_num * sizeof(static_proc_element)); |
| 232 | } |
| 233 | |
| 234 | FreeStaticProceduralsForTexture(n); |
| 235 | Sleep(2000); |
| 236 | AllocateStaticProceduralsForTexture(n, 8000); |
| 237 | |
| 238 | memcpy(GameTextures[n].procedural->static_proc_elements, save_elements, save_num * sizeof(static_proc_element)); |
| 239 | GameTextures[n].procedural->num_static_elements = save_num; |
| 240 | |
| 241 | m_button_down = 0; |
| 242 | m_proc_type = 0; |
| 243 | m_size = 1; |
| 244 | m_height = 1; |
| 245 | m_frequency = 0; |
| 246 | |
| 247 | // Alloc bitmap |
| 248 | CWnd *texwnd; |
| 249 | RECT rect; |
| 250 | |
| 251 | texwnd = GetDlgItem(IDC_WATER_PROCEDURAL_VIEW); |
| 252 | texwnd->GetWindowRect(&rect); |
| 253 | ScreenToClient(&rect); |
| 254 | |
| 255 | int w = rect.right - rect.left; |
| 256 | int h = rect.bottom - rect.top; |
| 257 | |
| 258 | m_window_bitmap = bm_AllocBitmap(w, h, ((w * h) / 3) * 2); |
| 259 | ASSERT(m_window_bitmap >= 0); |
| 260 | m_TextureSurf.create(bm_w(m_window_bitmap, 0), bm_h(m_window_bitmap, 0), bm_bpp(m_window_bitmap)); |
| 261 | |
| 262 | m_frequency_slider.SetRange(0, MAX_SLIDER_RANGE); |
| 263 | m_frequency_slider.SetPos(255 - m_frequency); |
| 264 | |
| 265 | m_height_slider.SetRange(1, MAX_SLIDER_RANGE); |
| 266 | m_height_slider.SetPos(m_height); |
| 267 | |
| 268 | m_size_slider.SetRange(1, MAX_SLIDER_RANGE); |
| 269 | m_size_slider.SetPos(m_size); |
| 270 | |
| 271 | m_light_slider.SetRange(0, 12); |
| 272 | m_light_slider.SetPos(GameTextures[n].procedural->light); |
| 273 | |
| 274 | m_thickness_slider.SetRange(0, 12); |
| 275 | m_thickness_slider.SetPos(GameTextures[n].procedural->thickness); |
| 276 | |
| 277 | UpdateDialog(); |
nothing calls this directly
no test coverage detected