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

Method OnInitDialog

editor/ProceduralDialog.cpp:83–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82static static_proc_element save_elements[8000];
83BOOL CProceduralDialog::OnInitDialog() {
84 CDialog::OnInitDialog();
85 CWnd::SetTimer(1, 33, NULL); // 30 frames per second
86
87 int save_num = 0;
88 int n = D3EditState.texdlg_texture;
89
90 // Make a temp buffer for our static elements
91 if (GameTextures[n].procedural->num_static_elements > 0) {
92 save_num = GameTextures[n].procedural->num_static_elements;
93 memcpy(save_elements, GameTextures[n].procedural->static_proc_elements, save_num * sizeof(static_proc_element));
94 }
95
96 FreeStaticProceduralsForTexture(n);
97 Sleep(2000);
98
99 AllocateStaticProceduralsForTexture(n, 8000);
100
101 memcpy(GameTextures[n].procedural->static_proc_elements, save_elements, save_num * sizeof(static_proc_element));
102 GameTextures[n].procedural->num_static_elements = save_num;
103
104 m_button_down = 0;
105 m_proc_type = 0;
106 m_size = 255;
107 m_saturate = 0;
108 m_speed = 0;
109 m_frequency = 0;
110 m_cur_color = 255;
111
112 // Allocate bitmap memory
113 CWnd *texwnd;
114 RECT rect;
115
116 texwnd = GetDlgItem(IDC_PALETTE_VIEW);
117 texwnd->GetWindowRect(&rect);
118 ScreenToClient(&rect);
119
120 int w = rect.right - rect.left;
121 int h = rect.bottom - rect.top;
122
123 m_palette_bitmap = bm_AllocBitmap(w, h, ((w * h) / 3) * 2);
124 ASSERT(m_palette_bitmap >= 0);
125 m_PaletteSurf.create(bm_w(m_palette_bitmap, 0), bm_h(m_palette_bitmap, 0), bm_bpp(m_palette_bitmap));
126
127 texwnd = GetDlgItem(IDC_PROCEDURAL_VIEW);
128 texwnd->GetWindowRect(&rect);
129 ScreenToClient(&rect);
130
131 w = rect.right - rect.left;
132 h = rect.bottom - rect.top;
133
134 m_window_bitmap = bm_AllocBitmap(w, h, ((w * h) / 3) * 2);
135 ASSERT(m_window_bitmap >= 0);
136 m_TextureSurf.create(bm_w(m_window_bitmap, 0), bm_h(m_window_bitmap, 0), bm_bpp(m_window_bitmap));
137
138 // Set default slider values
139 m_freq_slider.SetRange(0, MAX_SLIDER_RANGE);
140 m_freq_slider.SetPos(255 - m_frequency);

Callers

nothing calls this directly

Calls 10

bm_AllocBitmapFunction · 0.85
bm_wFunction · 0.85
bm_hFunction · 0.85
bm_bppFunction · 0.85
SleepFunction · 0.50
createMethod · 0.45
SetRangeMethod · 0.45
SetPosMethod · 0.45

Tested by

no test coverage detected