Rev 2976 | Rev 3047 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2748 | IgorA | 1 | use32 |
2 | org 0x0 |
||
3 | db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт |
||
4 | dd 0x1 |
||
5 | dd start |
||
6 | dd i_end ;размер приложения |
||
7 | dd mem |
||
8 | dd stacktop |
||
9 | dd 0 |
||
10 | dd sys_path |
||
11 | |||
2759 | IgorA | 12 | include '../../../../programs/macros.inc' |
13 | include '../../../../programs/proc32.inc' |
||
14 | include '../../../../programs/develop/libraries/box_lib/load_lib.mac' |
||
3014 | dunkaist | 15 | include '../../../dll.inc' |
2748 | IgorA | 16 | include 'vox_draw.inc' |
17 | |||
18 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
||
2975 | IgorA | 19 | caption db 'Voxel editor 01.10.12',0 ;подпись окна |
2748 | IgorA | 20 | |
21 | struct FileInfoBlock |
||
22 | Function dd ? |
||
23 | Position dd ? |
||
24 | Flags dd ? |
||
25 | Count dd ? |
||
26 | Buffer dd ? |
||
27 | db ? |
||
28 | FileName dd ? |
||
29 | ends |
||
30 | |||
31 | run_file_70 FileInfoBlock |
||
32 | image_data dd 0 ;указатель на временную память. для нужен преобразования изображения |
||
33 | |||
34 | fn_toolbar db 'toolbar.png',0 |
||
35 | IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 |
||
2975 | IgorA | 36 | IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*23 |
2748 | IgorA | 37 | image_data_toolbar dd 0 |
2933 | IgorA | 38 | cursors_count equ 4 |
39 | IMAGE_CURSORS_SIZE equ 4096*cursors_count ;размер картинки с курсорами |
||
2748 | IgorA | 40 | |
2876 | IgorA | 41 | ;значения задаваемые по умолчанию, без ini файла |
42 | ini_def_window_t equ 10 |
||
43 | ini_def_window_l equ 10 |
||
44 | ini_def_window_w equ 550 |
||
45 | ini_def_window_h equ 415 |
||
46 | ini_def_buf_w equ 198 ;=192+6 |
||
47 | ini_def_buf_h equ 231 ;=224+7 |
||
48 | ini_def_s_zoom equ 5 |
||
49 | ini_def_t_size equ 10 |
||
50 | ini_def_color_b equ 0xffffff |
||
51 | ;описание параматров для ini файла |
||
52 | ini_name db 'vox_editor.ini',0 |
||
53 | ini_sec_window db 'Window',0 |
||
54 | key_window_t db 't',0 |
||
55 | key_window_l db 'l',0 |
||
56 | key_window_w db 'w',0 |
||
57 | key_window_h db 'h',0 |
||
58 | key_buf_w db 'buf_w',0 |
||
59 | key_buf_h db 'buf_h',0 |
||
60 | ini_sec_options db 'Options',0 |
||
61 | key_s_zoom db 's_zoom',0 |
||
62 | key_t_size db 'tile_size',0 |
||
63 | key_f_size db 'file_size',0 |
||
64 | key_col_b db 'c_background',0 |
||
2748 | IgorA | 65 | |
66 | macro load_image_file path,buf,size { ;макрос для загрузки изображений |
||
67 | ;path - может быть переменной или строковым параметром |
||
68 | if path eqtype '' ;проверяем задан ли строкой параметр path |
||
69 | jmp @f |
||
70 | local .path_str |
||
71 | .path_str db path ;формируем локальную переменную |
||
72 | db 0 |
||
73 | @@: |
||
74 | ;32 - стандартный адрес по которому должен быть буфер с системным путем |
||
75 | copy_path .path_str,[32],file_name,0x0 |
||
76 | else |
||
77 | copy_path path,[32],file_name,0x0 ;формируем полный путь к файлу изображения, подразумеваем что он в одной папке с программой |
||
78 | end if |
||
79 | |||
80 | stdcall mem.Alloc, dword size ;выделяем память для изображения |
||
81 | mov [buf],eax |
||
82 | |||
83 | mov eax,70 ;70-я функция работа с файлами |
||
84 | mov [run_file_70.Function], 0 |
||
85 | mov [run_file_70.Position], 0 |
||
86 | mov [run_file_70.Flags], 0 |
||
87 | mov [run_file_70.Count], dword size |
||
88 | m2m [run_file_70.Buffer], [buf] |
||
89 | mov byte[run_file_70+20], 0 |
||
90 | mov [run_file_70.FileName], file_name |
||
91 | mov ebx,run_file_70 |
||
92 | int 0x40 ;загружаем файл изображения |
||
93 | cmp ebx,0xffffffff |
||
94 | je @f |
||
95 | ;определяем вид изображения и переводим его во временный буфер image_data |
||
96 | stdcall dword[img_decode], dword[buf],ebx,0 |
||
97 | mov dword[image_data],eax |
||
98 | ;преобразуем изображение к формату rgb |
||
99 | stdcall dword[img_to_rgb2], dword[image_data],dword[buf] |
||
100 | ;удаляем временный буфер image_data |
||
101 | stdcall dword[img_destroy], dword[image_data] |
||
102 | @@: |
||
103 | } |
||
104 | |||
105 | OT_MAP_X equ 0 |
||
106 | OT_MAP_Y equ 0 |
||
2758 | IgorA | 107 | OT_CAPT_X_COLOR equ 5 ;отступ для подписи цвета |
108 | OT_CAPT_Y_COLOR equ 30 |
||
2933 | IgorA | 109 | PEN_MODE_NONE equ -1 |
110 | PEN_MODE_CLEAR equ 0 ;режим стирания |
||
2883 | IgorA | 111 | PEN_MODE_SELECT_COLOR equ 2 ;режим выбора цвета |
2748 | IgorA | 112 | |
113 | align 4 |
||
114 | start: |
||
115 | load_libraries l_libs_start,l_libs_end |
||
116 | ;проверка на сколько удачно загузилась библиотека |
||
117 | mov ebp,lib_2 |
||
118 | cmp dword [ebp+ll_struc_size-4],0 |
||
119 | jz @f |
||
120 | mcall -1 ;exit not correct |
||
121 | @@: |
||
122 | mcall 48,3,sc,sizeof.system_colors |
||
123 | mcall 40,0x27 |
||
124 | stdcall [OpenDialog_Init],OpenDialog_data ;подготовка диалога |
||
125 | |||
2876 | IgorA | 126 | ;--- load ini file --- |
127 | copy_path ini_name,sys_path,file_name,0 |
||
128 | ;window startup pozition |
||
129 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l |
||
130 | mov word[wnd_s_pos+2],ax |
||
131 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w |
||
132 | mov word[wnd_s_pos],ax |
||
133 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t |
||
134 | mov word[wnd_s_pos+6],ax |
||
135 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h |
||
136 | mov word[wnd_s_pos+4],ax |
||
137 | ;image buffer size |
||
138 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_w,ini_def_buf_w |
||
139 | mov [buf_0.w],eax |
||
140 | mov [buf_0z.w],eax |
||
141 | add ax,15 |
||
142 | mov [buf_pl.l],ax ;отступ для правого окна |
||
143 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_h,ini_def_buf_h |
||
144 | mov [buf_0.h],eax |
||
145 | mov [buf_0z.h],eax |
||
146 | ;цвет фона |
||
147 | stdcall dword[ini_get_color],file_name,ini_sec_window,key_col_b,ini_def_color_b |
||
148 | mov [buf_0.color],eax |
||
149 | mov [buf_pl.color],eax |
||
150 | |||
151 | ;мастаб, после которого будет увеличение |
||
152 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_s_zoom,ini_def_s_zoom |
||
153 | mov [scaled_zoom],eax |
||
154 | ;размер квадратика на плоскости сечения |
||
155 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_t_size,ini_def_t_size |
||
156 | mov [tile_size],eax |
||
157 | |||
158 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_f_size,64 |
||
159 | shl eax,10 |
||
160 | mov [max_open_file_size],eax |
||
161 | |||
162 | mov ecx,[scaled_zoom] |
||
163 | xor eax,eax |
||
164 | inc eax |
||
165 | shl eax,cl |
||
166 | imul eax,[tile_size] |
||
167 | mov [buf_pl.w],eax |
||
168 | add eax,[tile_size] |
||
169 | mov [buf_pl.h],eax |
||
170 | |||
2933 | IgorA | 171 | ;*** загрузка курсоров |
172 | load_image_file 'cursors_gr.png',image_data_toolbar,IMAGE_CURSORS_SIZE |
||
173 | stdcall [buf2d_create_f_img], buf_curs_8,[image_data_toolbar] ;создаем буфер |
||
174 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
175 | |||
176 | load_image_file 'cursors.png',image_data_toolbar, IMAGE_CURSORS_SIZE |
||
177 | stdcall [buf2d_create_f_img], buf_curs,[image_data_toolbar] ;создаем буфер |
||
178 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
179 | |||
180 | stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;делаем буфер прозрачности 8бит |
||
181 | stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;делаем буфер rgba 32бит |
||
182 | |||
183 | |||
2748 | IgorA | 184 | stdcall [buf2d_create], buf_0 ;создание буфера изображения |
185 | stdcall [buf2d_create], buf_0z ;создание буфера глубины |
||
186 | stdcall [buf2d_create], buf_pl ;создание буфера для сечения |
||
187 | |||
2975 | IgorA | 188 | stdcall [buf2d_vox_brush_create], buf_vox_g3, vox_6_7_z |
189 | stdcall [buf2d_vox_brush_create], buf_vox_g2, vox_6_4_z |
||
2748 | IgorA | 190 | |
191 | load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE |
||
192 | |||
2876 | IgorA | 193 | stdcall mem.Alloc,[max_open_file_size] |
2748 | IgorA | 194 | mov dword[open_file_vox],eax |
195 | |||
196 | call but_new_file |
||
197 | |||
2933 | IgorA | 198 | ;первоначальная установка курсора |
199 | stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen |
||
200 | |||
2748 | IgorA | 201 | align 4 |
202 | red_win: |
||
203 | call draw_window |
||
204 | |||
205 | align 4 |
||
206 | still: |
||
207 | mcall 10 |
||
208 | |||
209 | cmp al,1 |
||
210 | jz red_win |
||
211 | cmp al,2 |
||
212 | jz key |
||
213 | cmp al,3 |
||
214 | jz button |
||
215 | cmp al,6 |
||
216 | jne @f |
||
217 | mcall 9,procinfo,-1 |
||
218 | cmp ax,word[procinfo+4] |
||
219 | jne @f ;окно не активно |
||
220 | call mouse |
||
221 | @@: |
||
222 | jmp still |
||
223 | |||
224 | align 4 |
||
225 | mouse: |
||
226 | pushad |
||
227 | mcall 37,2 |
||
2758 | IgorA | 228 | bt eax,1 ;right button |
229 | jnc @f |
||
230 | mcall 37,1 ;get mouse coords |
||
231 | mov ebx,eax |
||
232 | shr ebx,16 |
||
233 | and eax,0xffff |
||
234 | stdcall get_buf_color, buf_0 |
||
235 | stdcall get_buf_color, buf_pl |
||
236 | jmp .end_f |
||
237 | @@: |
||
2748 | IgorA | 238 | bt eax,0 ;left button |
239 | jnc .end_f |
||
240 | mcall 37,1 ;get mouse coords |
||
241 | mov ebx,eax |
||
2758 | IgorA | 242 | shr ebx,16 |
2748 | IgorA | 243 | and eax,0xffff |
244 | |||
2883 | IgorA | 245 | cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
2748 | IgorA | 246 | jne .end_2 |
247 | stdcall get_buf_color, buf_0 |
||
248 | stdcall get_buf_color, buf_pl |
||
249 | jmp .end_f |
||
250 | .end_2: |
||
251 | |||
2758 | IgorA | 252 | |
253 | push eax ebx |
||
254 | mov edx,[v_zoom] |
||
255 | cmp edx,[scaled_zoom] |
||
256 | jle @f |
||
257 | ;режим масштабирования изображения |
||
258 | sub edx,[scaled_zoom] |
||
259 | sub ax,word[buf_0.t] |
||
260 | sub bx,word[buf_0.l] |
||
2975 | IgorA | 261 | stdcall get_mouse_ev_scale, [buf_vox], ebx, eax, [scaled_zoom],edx |
2758 | IgorA | 262 | cmp eax,0 |
263 | je @f |
||
264 | mov ebx,eax |
||
265 | and eax,0x3fffffff |
||
266 | rol ebx,2 |
||
267 | and ebx,3 |
||
268 | dec ebx |
||
269 | |||
270 | shl ebx,2 |
||
271 | add ebx,cam_x |
||
272 | mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z] |
||
273 | call draw_objects |
||
274 | |||
275 | pop ebx eax |
||
276 | jmp .end_f |
||
277 | @@: |
||
278 | pop ebx eax |
||
279 | |||
280 | |||
281 | ;eax - mouse coord y |
||
282 | ;ebx - mouse coord x |
||
2748 | IgorA | 283 | movzx edx,word[buf_pl.t] |
284 | add edx,OT_MAP_Y |
||
285 | cmp eax,edx |
||
286 | jl .end_f |
||
287 | sub eax,edx |
||
288 | xor edx,edx |
||
2876 | IgorA | 289 | mov ecx,[tile_size] ;H |
2748 | IgorA | 290 | div ecx |
291 | movzx edx,word[buf_pl.l] |
||
292 | add edx,OT_MAP_X |
||
293 | cmp ebx,edx |
||
294 | jl .end_f |
||
295 | call convert_y ;преобразование координаты y |
||
296 | cmp eax,0 |
||
297 | jge .end_0 ;ограничение по нижней координате y |
||
298 | cmp eax,-1 |
||
299 | jne .end_f |
||
300 | ;меняем сечение, попали на квадратик |
||
301 | sub ebx,edx |
||
302 | mov eax,ebx |
||
303 | xor edx,edx |
||
2876 | IgorA | 304 | mov ecx,[tile_size] ;W |
2748 | IgorA | 305 | div ecx |
306 | mov [n_plane],eax |
||
307 | jmp .end_1 |
||
308 | .end_0: |
||
309 | mov [v_cur_y],eax ;Y-coord |
||
310 | sub ebx,edx |
||
311 | mov eax,ebx |
||
312 | xor edx,edx |
||
2876 | IgorA | 313 | mov ecx,[tile_size] ;W |
2748 | IgorA | 314 | div ecx |
315 | mov [v_cur_x],eax ;X-coord |
||
316 | |||
2933 | IgorA | 317 | cmp dword[v_pen_mode],PEN_MODE_CLEAR |
2758 | IgorA | 318 | jl .end_1 |
2748 | IgorA | 319 | cmp dword[v_pen_mode],1 |
2758 | IgorA | 320 | jg .end_1 |
321 | mov eax,[v_cur_x] |
||
322 | mov ebx,[n_plane] |
||
323 | mov edx,[v_cur_y] |
||
2883 | IgorA | 324 | |
2758 | IgorA | 325 | mov ecx,[v_zoom] |
326 | cmp ecx,[scaled_zoom] |
||
327 | jle .no_c_coord_0 |
||
328 | ;преобразование координат, с учетом увеличения |
||
329 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
330 | mov ecx,[scaled_zoom] |
||
331 | |||
332 | mov edi,[cam_x] |
||
333 | shl edi,cl |
||
334 | add eax,edi |
||
335 | mov edi,[cam_y] |
||
336 | shl edi,cl |
||
337 | add ebx,edi |
||
338 | mov edi,[cam_z] |
||
339 | shl edi,cl |
||
340 | add edx,edi |
||
341 | .no_c_coord_0: |
||
342 | |||
343 | ;отличающийся параметр для функции создания вокселя |
||
344 | cmp dword[v_pen_mode],1 |
||
345 | jne @f |
||
346 | push dword[v_color] |
||
347 | @@: |
||
348 | |||
349 | ;вызов общих параметров для функций |
||
350 | push dword[v_zoom] |
||
351 | push edx |
||
352 | push ebx |
||
353 | push eax |
||
354 | push dword[open_file_vox] |
||
355 | |||
356 | ;вызов функций |
||
357 | cmp dword[v_pen_mode],1 |
||
358 | jne @f |
||
359 | call buf2d_vox_obj_create_node |
||
360 | ;stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom], [v_color] |
||
361 | jmp .end_1 |
||
362 | @@: |
||
363 | call buf2d_vox_obj_delete_node |
||
364 | ;stdcall buf2d_vox_obj_delete_node, [open_file_vox], eax,ebx,edx, [v_zoom] |
||
365 | |||
2748 | IgorA | 366 | .end_1: |
367 | call draw_objects |
||
368 | call draw_pok |
||
369 | .end_f: |
||
370 | popad |
||
371 | ret |
||
372 | |||
2758 | IgorA | 373 | ;input: |
374 | ; eax - coord y |
||
375 | ; ebx - coord x |
||
2748 | IgorA | 376 | align 4 |
2758 | IgorA | 377 | proc get_buf_color, buf:dword |
378 | pushad |
||
2748 | IgorA | 379 | mov edi,[buf] |
380 | cmp ax,buf2d_t |
||
381 | jl .end_f |
||
382 | sub ax,buf2d_t |
||
383 | cmp eax,buf2d_h |
||
384 | jg .end_f |
||
385 | cmp bx,buf2d_l |
||
386 | jl .end_f |
||
387 | sub bx,buf2d_l |
||
388 | cmp ebx,buf2d_w |
||
389 | jg .end_f |
||
390 | stdcall [buf2d_get_pixel], edi,ebx,eax |
||
391 | mov [v_color],eax |
||
2759 | IgorA | 392 | call on_change_color ;отображаем изменения цвета |
2748 | IgorA | 393 | .end_f: |
2758 | IgorA | 394 | popad |
2748 | IgorA | 395 | ret |
396 | endp |
||
397 | |||
398 | ;преобразовываем координату y (значение должно увеличиваться с низу вверх) |
||
399 | align 4 |
||
400 | convert_y: |
||
401 | push ecx edx |
||
402 | mov ecx,[v_zoom] |
||
2758 | IgorA | 403 | cmp ecx,[scaled_zoom] |
404 | jle @f |
||
405 | mov ecx,[scaled_zoom] |
||
406 | @@: |
||
2748 | IgorA | 407 | mov edx,1 |
408 | cmp ecx,1 |
||
2758 | IgorA | 409 | jl @f |
410 | shl edx,cl |
||
2748 | IgorA | 411 | @@: |
412 | sub edx,eax |
||
413 | dec edx |
||
414 | mov eax,edx |
||
415 | pop edx ecx |
||
416 | ret |
||
417 | |||
418 | align 4 |
||
419 | draw_window: |
||
420 | pushad |
||
421 | mcall 12,1 |
||
422 | |||
423 | ; *** рисование главного окна (выполняется 1 раз при запуске) *** |
||
424 | mov edx,[sc.work] |
||
425 | or edx,(3 shl 24)+0x30000000 |
||
426 | mov edi,caption |
||
2876 | IgorA | 427 | mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4] |
2748 | IgorA | 428 | |
429 | ; *** создание кнопок на панель *** |
||
430 | mov eax,8 |
||
431 | mov ebx,(5 shl 16)+20 |
||
432 | mov ecx,(5 shl 16)+20 |
||
433 | mov edx,3 |
||
434 | mov esi,[sc.work_button] |
||
435 | int 0x40 |
||
436 | |||
437 | mov ebx,(30 shl 16)+20 |
||
438 | mov edx,4 |
||
439 | int 0x40 |
||
440 | add ebx,25 shl 16 |
||
441 | mov edx,5 |
||
442 | int 0x40 |
||
443 | add ebx,30 shl 16 |
||
444 | mov edx,6 |
||
445 | int 0x40 |
||
446 | add ebx,25 shl 16 |
||
447 | mov edx,7 |
||
448 | int 0x40 |
||
449 | add ebx,25 shl 16 |
||
450 | mov edx,8 |
||
451 | int 0x40 |
||
452 | add ebx,25 shl 16 |
||
453 | mov edx,9 |
||
454 | int 0x40 |
||
455 | add ebx,25 shl 16 |
||
456 | mov edx,10 |
||
457 | int 0x40 |
||
458 | add ebx,25 shl 16 |
||
459 | mov edx,11 |
||
460 | int 0x40 |
||
461 | add ebx,25 shl 16 |
||
462 | mov edx,12 |
||
463 | int 0x40 |
||
464 | add ebx,25 shl 16 |
||
465 | mov edx,13 |
||
466 | int 0x40 |
||
467 | add ebx,25 shl 16 |
||
468 | mov edx,14 |
||
469 | int 0x40 |
||
470 | add ebx,25 shl 16 |
||
471 | mov edx,15 |
||
472 | int 0x40 |
||
473 | add ebx,25 shl 16 |
||
474 | mov edx,16 |
||
475 | int 0x40 |
||
2883 | IgorA | 476 | add ebx,25 shl 16 |
477 | mov edx,17 |
||
478 | int 0x40 |
||
479 | add ebx,25 shl 16 |
||
480 | mov edx,18 |
||
481 | int 0x40 |
||
482 | add ebx,25 shl 16 |
||
483 | mov edx,19 |
||
484 | int 0x40 |
||
485 | add ebx,25 shl 16 |
||
486 | mov edx,20 |
||
487 | int 0x40 |
||
488 | add ebx,25 shl 16 |
||
489 | mov edx,21 |
||
490 | int 0x40 |
||
491 | add ebx,25 shl 16 |
||
492 | mov edx,22 |
||
493 | int 0x40 |
||
494 | add ebx,25 shl 16 |
||
495 | mov edx,23 |
||
496 | int 0x40 |
||
2974 | IgorA | 497 | add ebx,25 shl 16 |
498 | mov edx,24 |
||
499 | int 0x40 |
||
2975 | IgorA | 500 | add ebx,25 shl 16 |
501 | mov edx,25 |
||
502 | int 0x40 |
||
2748 | IgorA | 503 | |
504 | ; *** рисование иконок на кнопках *** |
||
505 | mov eax,7 |
||
506 | mov ebx,[image_data_toolbar] |
||
507 | mov ecx,(16 shl 16)+16 |
||
508 | mov edx,(7 shl 16)+7 ;icon new |
||
509 | int 0x40 |
||
510 | |||
511 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
512 | add edx,(25 shl 16) ;icon open |
||
513 | int 0x40 |
||
514 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
515 | add edx,(25 shl 16) ;icon save |
||
516 | int 0x40 |
||
517 | |||
518 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 519 | add edx,(30 shl 16) ;увелич. масштаб |
2748 | IgorA | 520 | int 0x40 |
521 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 522 | add edx,(25 shl 16) ;уменьш. масштаб |
2748 | IgorA | 523 | int 0x40 |
524 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2975 | IgorA | 525 | add edx,(25 shl 16) ;camera 3g 2g |
526 | int 0x40 |
||
527 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 528 | add edx,(25 shl 16) ;поворот 1 |
2748 | IgorA | 529 | int 0x40 |
530 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 531 | add edx,(25 shl 16) ;поворот 2 |
2748 | IgorA | 532 | int 0x40 |
533 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 534 | add edx,(25 shl 16) ;сдвиг плоскости + |
2748 | IgorA | 535 | int 0x40 |
536 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 537 | add edx,(25 shl 16) ;сдвиг плоскости - |
2748 | IgorA | 538 | int 0x40 |
539 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 540 | add edx,(25 shl 16) ;инструмент карандаш |
2748 | IgorA | 541 | int 0x40 |
542 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 543 | add edx,(25 shl 16) ;инструмент кисть |
2748 | IgorA | 544 | int 0x40 |
545 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 546 | add edx,(25 shl 16) ;инструмент затирачка |
2748 | IgorA | 547 | int 0x40 |
548 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 549 | add edx,(25 shl 16) ;выбор цвета |
2748 | IgorA | 550 | int 0x40 |
551 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 552 | add edx,(25 shl 16) ;освещение |
2748 | IgorA | 553 | int 0x40 |
2883 | IgorA | 554 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
555 | add edx,(25 shl 16) ;рендер 2*2 |
||
556 | int 0x40 |
||
557 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
558 | add edx,(25 shl 16) ;создать кисть |
||
559 | int 0x40 |
||
560 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
561 | add edx,(25 shl 16) ;нарисовать кисть |
||
562 | int 0x40 |
||
563 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2974 | IgorA | 564 | add edx,(25 shl 16) ;удалить кисть |
565 | int 0x40 |
||
566 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 567 | add edx,(25 shl 16) ;ширина кисти -1 |
568 | int 0x40 |
||
569 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
570 | add edx,(25 shl 16) ;ширина кисти +1 |
||
571 | int 0x40 |
||
572 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
573 | add edx,(25 shl 16) ;высота кисти -1 |
||
574 | int 0x40 |
||
575 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
576 | add edx,(25 shl 16) ;высота кисти +1 |
||
577 | int 0x40 |
||
2748 | IgorA | 578 | |
579 | ; *** рисование буферов *** |
||
580 | call draw_objects |
||
581 | call draw_pok |
||
582 | |||
583 | mcall 12,2 |
||
584 | popad |
||
585 | ret |
||
586 | |||
587 | align 4 |
||
588 | draw_pok: |
||
589 | mov eax,47 |
||
590 | mov ecx,[v_zoom] |
||
2759 | IgorA | 591 | mov ebx,(3 shl 16)+(1 shl 31) |
2883 | IgorA | 592 | mov edx,((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 |
2748 | IgorA | 593 | mov esi,[sc.work_button_text] |
594 | or esi,(1 shl 30) |
||
595 | mov edi,[sc.work_button] |
||
596 | int 0x40 ;масштаб |
||
597 | mov ecx,[n_plane] |
||
2883 | IgorA | 598 | add edx,115 shl 16 ;9 |
2759 | IgorA | 599 | int 0x40 ;номер сечения |
2748 | IgorA | 600 | |
2883 | IgorA | 601 | ;обновление параметров курсора |
602 | mov dword[txt_curor.size],0 |
||
603 | mov eax,dword[v_cur_x] |
||
604 | mov edi,txt_curor.size |
||
605 | call convert_int_to_str |
||
606 | stdcall str_cat, edi,txt_mull |
||
607 | mov eax,dword[v_cur_y] |
||
608 | mov edi,txt_buf |
||
609 | call convert_int_to_str |
||
610 | stdcall str_cat, txt_curor.size,edi |
||
611 | stdcall str_cat, txt_curor.size,txt_space ;завершающий пробел |
||
612 | |||
613 | ;обновление параметров кисти |
||
614 | mov dword[txt_brush.size],0 |
||
615 | mov eax,dword[brush_w] |
||
616 | mov edi,txt_brush.size |
||
617 | call convert_int_to_str |
||
618 | stdcall str_cat, edi,txt_mull |
||
619 | mov eax,dword[brush_h] |
||
620 | mov edi,txt_buf |
||
621 | call convert_int_to_str |
||
622 | stdcall str_cat, txt_brush.size,edi |
||
623 | stdcall str_cat, txt_brush.size,txt_space ;завершающий пробел |
||
624 | |||
2758 | IgorA | 625 | mov eax,4 ;рисование текста |
626 | mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2 |
||
627 | mov ecx,[sc.work_text] |
||
628 | or ecx,0x80000000 ;or (1 shl 30) |
||
629 | mov edx,txt_color |
||
630 | int 0x40 |
||
631 | |||
2883 | IgorA | 632 | mov edx,txt_curor |
633 | add ebx,115 shl 16 |
||
634 | or ecx,(1 shl 30) |
||
635 | mov edi,[sc.work] |
||
636 | int 0x40 |
||
637 | |||
638 | mov edx,txt_brush |
||
639 | add ebx,115 shl 16 |
||
640 | int 0x40 |
||
641 | |||
642 | mov edx,txt_zoom |
||
643 | add ebx,115 shl 16 |
||
644 | int 0x40 |
||
645 | |||
646 | mov edx,txt_n_plane |
||
647 | add ebx,115 shl 16 |
||
648 | int 0x40 |
||
649 | |||
2759 | IgorA | 650 | call on_change_color |
651 | ret |
||
652 | |||
653 | align 4 |
||
654 | on_change_color: |
||
655 | pushad |
||
2758 | IgorA | 656 | mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;по оси x |
657 | mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;по оси y |
||
658 | mov edx,[v_color] |
||
659 | mcall 13 |
||
2759 | IgorA | 660 | |
661 | mov ebx,(1 shl 8)+(6 shl 16) |
||
662 | mov ecx,edx |
||
663 | mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2 |
||
664 | mov esi,[sc.work_text] |
||
665 | add esi,(1 shl 30) |
||
666 | mov edi,[sc.work] |
||
667 | mcall 47 |
||
668 | popad |
||
2748 | IgorA | 669 | ret |
670 | |||
671 | align 4 |
||
672 | key: |
||
673 | mcall 2 |
||
674 | jmp still |
||
675 | |||
676 | |||
677 | align 4 |
||
678 | button: |
||
679 | mcall 17 |
||
680 | cmp ah,3 |
||
681 | jne @f |
||
682 | call but_new_file |
||
683 | call draw_objects |
||
684 | call draw_pok |
||
685 | @@: |
||
686 | cmp ah,4 |
||
687 | jne @f |
||
688 | call but_open_file |
||
689 | @@: |
||
690 | cmp ah,5 |
||
691 | jne @f |
||
692 | call but_save_file |
||
693 | @@: |
||
694 | cmp ah,6 |
||
695 | jne @f |
||
2976 | IgorA | 696 | call but_camera_3g_2g |
2748 | IgorA | 697 | @@: |
698 | cmp ah,7 |
||
699 | jne @f |
||
2976 | IgorA | 700 | call but_zoom_p |
2748 | IgorA | 701 | @@: |
702 | cmp ah,8 |
||
703 | jne @f |
||
2976 | IgorA | 704 | call but_zoom_m |
2748 | IgorA | 705 | @@: |
706 | cmp ah,9 |
||
707 | jne @f |
||
2975 | IgorA | 708 | call but_3 |
2748 | IgorA | 709 | @@: |
710 | cmp ah,10 |
||
711 | jne @f |
||
2975 | IgorA | 712 | call but_4 |
2748 | IgorA | 713 | @@: |
714 | cmp ah,11 |
||
715 | jne @f |
||
2975 | IgorA | 716 | call but_plane_inc |
2748 | IgorA | 717 | @@: |
718 | cmp ah,12 |
||
719 | jne @f |
||
2975 | IgorA | 720 | call but_plane_dec |
2748 | IgorA | 721 | @@: |
722 | cmp ah,13 |
||
723 | jne @f |
||
2975 | IgorA | 724 | call but_mode_pen |
2748 | IgorA | 725 | @@: |
726 | cmp ah,14 |
||
727 | jne @f |
||
2975 | IgorA | 728 | call but_mode_brush |
2748 | IgorA | 729 | @@: |
730 | cmp ah,15 |
||
731 | jne @f |
||
2975 | IgorA | 732 | call but_mode_clear |
733 | @@: |
||
734 | cmp ah,16 |
||
735 | jne @f |
||
2933 | IgorA | 736 | stdcall set_pen_mode,PEN_MODE_SELECT_COLOR,3,((9 shl 8)+9) shl 16 |
2883 | IgorA | 737 | call draw_palete |
2748 | IgorA | 738 | @@: |
2975 | IgorA | 739 | cmp ah,17 |
2748 | IgorA | 740 | jne @f |
2883 | IgorA | 741 | call but_light |
742 | @@: |
||
2975 | IgorA | 743 | cmp ah,18 |
2883 | IgorA | 744 | jne @f |
2748 | IgorA | 745 | call but_rend_2_2 |
746 | @@: |
||
2975 | IgorA | 747 | cmp ah,19 |
2883 | IgorA | 748 | jne @f |
749 | call but_brush_copy |
||
750 | @@: |
||
2975 | IgorA | 751 | cmp ah,20 |
2883 | IgorA | 752 | jne @f |
753 | call but_brush_draw |
||
754 | @@: |
||
2975 | IgorA | 755 | cmp ah,21 |
2883 | IgorA | 756 | jne @f |
2974 | IgorA | 757 | call but_brush_clear |
2883 | IgorA | 758 | @@: |
2975 | IgorA | 759 | cmp ah,22 |
2883 | IgorA | 760 | jne @f |
2974 | IgorA | 761 | call but_bru_w_m |
2883 | IgorA | 762 | @@: |
2975 | IgorA | 763 | cmp ah,23 |
2883 | IgorA | 764 | jne @f |
2974 | IgorA | 765 | call but_bru_w_p |
2883 | IgorA | 766 | @@: |
2975 | IgorA | 767 | cmp ah,24 |
2883 | IgorA | 768 | jne @f |
2974 | IgorA | 769 | call but_bru_h_m |
770 | @@: |
||
2975 | IgorA | 771 | cmp ah,25 |
2974 | IgorA | 772 | jne @f |
2883 | IgorA | 773 | call but_bru_h_p |
774 | @@: |
||
2748 | IgorA | 775 | cmp ah,1 |
776 | jne still |
||
777 | .exit: |
||
778 | stdcall [buf2d_delete],buf_0 |
||
779 | stdcall [buf2d_delete],buf_0z |
||
780 | cmp dword[buf_r_img],0 |
||
781 | je @f |
||
782 | stdcall [buf2d_delete],buf_r_img |
||
783 | stdcall [buf2d_delete],buf_r_z |
||
784 | @@: |
||
2975 | IgorA | 785 | stdcall [buf2d_vox_brush_delete], buf_vox_g3 |
786 | stdcall [buf2d_vox_brush_delete], buf_vox_g2 |
||
2933 | IgorA | 787 | stdcall [buf2d_delete],buf_curs |
788 | stdcall [buf2d_delete],buf_curs_8 |
||
2748 | IgorA | 789 | stdcall mem.Free,[image_data_toolbar] |
790 | stdcall mem.Free,[open_file_vox] |
||
791 | mcall -1 |
||
792 | |||
2974 | IgorA | 793 | ;данные для инициализации воксельного объекта |
2748 | IgorA | 794 | align 4 |
795 | vox_new_data: |
||
796 | db 2,0,0,0 |
||
2974 | IgorA | 797 | db 0,1,2,3,4,5,6,7 ;default table |
2748 | IgorA | 798 | dd 0 ;null node |
799 | |||
2974 | IgorA | 800 | ;инициализация воксельного объекта |
2748 | IgorA | 801 | align 4 |
802 | proc but_new_file uses ecx edi esi |
||
803 | mov ecx,vox_offs_data+4 |
||
804 | mov esi,vox_new_data |
||
805 | mov edi,[open_file_vox] |
||
806 | cld |
||
807 | rep movsb |
||
808 | ret |
||
809 | endp |
||
810 | |||
811 | align 4 |
||
812 | open_file_vox dd 0 ;указатель на область для открытия файлов |
||
813 | |||
814 | align 4 |
||
815 | but_open_file: |
||
816 | pushad |
||
817 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
818 | mov [OpenDialog_data.type],0 |
||
819 | stdcall [OpenDialog_Start],OpenDialog_data |
||
820 | cmp [OpenDialog_data.status],2 |
||
821 | je .end_open_file |
||
822 | ;код при удачном открытии диалога |
||
823 | |||
824 | mov eax,70 ;70-я функция работа с файлами |
||
825 | mov [run_file_70.Function], 0 |
||
826 | mov [run_file_70.Position], 0 |
||
827 | mov [run_file_70.Flags], 0 |
||
2876 | IgorA | 828 | m2m dword[run_file_70.Count], dword[max_open_file_size] |
2748 | IgorA | 829 | m2m [run_file_70.Buffer], [open_file_vox] |
830 | mov byte[run_file_70+20], 0 |
||
831 | mov dword[run_file_70.FileName], openfile_path |
||
832 | mov ebx,run_file_70 |
||
833 | int 0x40 ;загружаем файл изображения |
||
834 | cmp ebx,0xffffffff |
||
835 | je .end_open_file |
||
836 | |||
2876 | IgorA | 837 | ;add ebx,[open_file_vox] |
838 | ;mov byte[ebx],0 ;на случай если ранее был открыт файл большего размера чистим конец буфера с файлом |
||
2748 | IgorA | 839 | mcall 71,1,openfile_path |
840 | |||
841 | ;--- |
||
842 | ; |
||
843 | mov eax,[open_file_vox] |
||
844 | movzx eax,byte[eax] |
||
845 | and eax,0xff ;берем масштаб по умолчанию |
||
846 | mov dword[v_zoom],eax ;берем масштаб по умолчанию |
||
2759 | IgorA | 847 | mov dword[cam_x],0 |
848 | mov dword[cam_y],0 |
||
849 | mov dword[cam_z],0 |
||
2748 | IgorA | 850 | call draw_objects |
851 | .end_open_file: |
||
852 | popad |
||
853 | ret |
||
854 | |||
855 | align 4 |
||
856 | but_save_file: |
||
857 | pushad |
||
858 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
859 | mov [OpenDialog_data.type],1 |
||
860 | stdcall [OpenDialog_Start],OpenDialog_data |
||
861 | cmp [OpenDialog_data.status],2 |
||
862 | je .end_save_file |
||
863 | ;код при удачном открытии диалога |
||
864 | |||
865 | mov eax,dword[v_zoom] ;задаем масштаб по умолчанию |
||
866 | mov ebx,[open_file_vox] |
||
867 | mov byte[ebx],al |
||
868 | |||
869 | stdcall buf2d_vox_obj_get_size, ebx |
||
870 | mov dword[run_file_70.Count], eax ;размер файла |
||
871 | mov eax,70 ;70-я функция работа с файлами |
||
872 | mov [run_file_70.Function], 2 |
||
873 | mov [run_file_70.Position], 0 |
||
874 | mov [run_file_70.Flags], 0 |
||
875 | mov ebx, dword[open_file_vox] |
||
876 | mov [run_file_70.Buffer], ebx |
||
877 | mov byte[run_file_70+20], 0 |
||
878 | mov dword[run_file_70.FileName], openfile_path |
||
879 | mov ebx,run_file_70 |
||
880 | int 0x40 ;загружаем файл изображения |
||
881 | cmp ebx,0xffffffff |
||
882 | je .end_save_file |
||
883 | |||
884 | .end_save_file: |
||
885 | popad |
||
886 | ret |
||
887 | |||
2975 | IgorA | 888 | ;смена вида камеры на просмотр 3 и 2 граней |
889 | align 4 |
||
890 | but_camera_3g_2g: |
||
891 | cmp dword[buf_vox],buf_vox_g3 |
||
892 | je @f |
||
893 | mov dword[buf_vox],buf_vox_g3 |
||
894 | jmp .end_0 |
||
895 | @@: |
||
896 | mov dword[buf_vox],buf_vox_g2 |
||
897 | .end_0: |
||
898 | call draw_objects |
||
899 | ret |
||
900 | |||
2758 | IgorA | 901 | ;увеличение масштаба |
2748 | IgorA | 902 | align 4 |
2759 | IgorA | 903 | but_zoom_p: |
2758 | IgorA | 904 | cmp dword[v_zoom],10 ;максимальный размер, до которого можно увеличить 2^10=1024 |
2748 | IgorA | 905 | jge @f |
906 | inc dword[v_zoom] |
||
907 | shl dword[n_plane],1 |
||
2758 | IgorA | 908 | push eax |
909 | mov eax,[v_zoom] |
||
910 | cmp eax,[scaled_zoom] |
||
911 | jl .end_0 |
||
2759 | IgorA | 912 | push ecx |
913 | mov ecx,[scaled_zoom] |
||
914 | xor eax,eax |
||
915 | inc eax |
||
916 | shl eax,cl |
||
2758 | IgorA | 917 | shl dword[cam_x],1 |
918 | shl dword[cam_y],1 |
||
919 | shl dword[cam_z],1 |
||
2759 | IgorA | 920 | cmp eax,[n_plane] |
921 | jg .end_1 |
||
922 | ;коректировка ползунка |
||
923 | sub [n_plane],eax |
||
924 | inc dword[cam_y] |
||
925 | .end_1: |
||
926 | pop ecx |
||
2758 | IgorA | 927 | .end_0: |
928 | pop eax |
||
2748 | IgorA | 929 | call draw_objects |
930 | call draw_pok |
||
931 | @@: |
||
932 | ret |
||
933 | |||
2758 | IgorA | 934 | ;уменьшение масштаба |
2748 | IgorA | 935 | align 4 |
2759 | IgorA | 936 | but_zoom_m: |
937 | cmp dword[v_zoom],1 |
||
2748 | IgorA | 938 | jl @f |
939 | dec dword[v_zoom] |
||
940 | shr dword[n_plane],1 |
||
2758 | IgorA | 941 | push eax |
942 | mov eax,[v_zoom] |
||
943 | cmp eax,[scaled_zoom] |
||
944 | jl .end_0 |
||
945 | shr dword[cam_x],1 |
||
946 | shr dword[cam_y],1 |
||
2759 | IgorA | 947 | jnc .end_1 |
948 | ;коректировка ползунка |
||
949 | push ecx |
||
950 | mov ecx,[scaled_zoom] |
||
951 | dec ecx |
||
952 | xor eax,eax |
||
953 | inc eax |
||
954 | shl eax,cl |
||
955 | add [n_plane],eax |
||
956 | pop ecx |
||
957 | .end_1: |
||
2758 | IgorA | 958 | shr dword[cam_z],1 |
959 | .end_0: |
||
960 | pop eax |
||
2748 | IgorA | 961 | call draw_objects |
962 | call draw_pok |
||
963 | @@: |
||
964 | ret |
||
965 | |||
966 | align 4 |
||
967 | but_3: |
||
968 | stdcall vox_obj_rot_z, [open_file_vox] |
||
969 | call draw_objects |
||
970 | ret |
||
971 | |||
972 | align 4 |
||
973 | but_4: |
||
974 | stdcall vox_obj_rot_x, [open_file_vox] |
||
975 | call draw_objects |
||
976 | ret |
||
977 | |||
2759 | IgorA | 978 | ;сдвигаем плоскость среза |
2748 | IgorA | 979 | align 4 |
2974 | IgorA | 980 | but_plane_inc: |
2759 | IgorA | 981 | push eax ecx |
2748 | IgorA | 982 | inc dword[n_plane] |
2759 | IgorA | 983 | mov eax,[v_zoom] |
984 | cmp eax,[scaled_zoom] |
||
985 | jle .end_0 |
||
986 | ;происходит масштабирование |
||
987 | mov ecx,[scaled_zoom] |
||
988 | xor eax,eax |
||
989 | inc eax |
||
990 | shl eax,cl |
||
991 | cmp eax,[n_plane] |
||
992 | jg @f |
||
993 | mov dword[n_plane],0 |
||
994 | inc dword[cam_y] ;переходим в соседний куб |
||
995 | neg ecx |
||
996 | ;inc ecx |
||
997 | add ecx,[v_zoom] |
||
998 | xor eax,eax |
||
999 | inc eax |
||
1000 | shl eax,cl |
||
1001 | cmp eax,[cam_y] |
||
1002 | jg @f |
||
1003 | mov dword[cam_y],0 ;зацикливаем если вылезли за пределы последнего куба |
||
1004 | @@: |
||
1005 | jmp .end_1 |
||
1006 | .end_0: |
||
1007 | ;масштабирование не происходит |
||
1008 | mov ecx,eax |
||
1009 | xor eax,eax |
||
1010 | inc eax |
||
1011 | shl eax,cl |
||
1012 | cmp eax,[n_plane] |
||
1013 | jg .end_1 |
||
1014 | mov dword[n_plane],0 |
||
1015 | .end_1: |
||
2748 | IgorA | 1016 | call draw_objects |
1017 | call draw_pok |
||
2759 | IgorA | 1018 | pop ecx eax |
2748 | IgorA | 1019 | ret |
1020 | |||
2759 | IgorA | 1021 | ;сдвигаем плоскость среза |
2748 | IgorA | 1022 | align 4 |
2974 | IgorA | 1023 | but_plane_dec: |
2759 | IgorA | 1024 | dec dword[n_plane] |
2748 | IgorA | 1025 | cmp dword[n_plane],0 |
2759 | IgorA | 1026 | jge .end_f |
1027 | push eax ecx |
||
1028 | mov ecx,[scaled_zoom] |
||
1029 | xor eax,eax |
||
1030 | inc eax |
||
1031 | shl eax,cl |
||
1032 | dec eax |
||
1033 | mov dword[n_plane],eax |
||
1034 | |||
1035 | mov eax,[v_zoom] |
||
1036 | cmp eax,[scaled_zoom] |
||
1037 | jle .end_0 |
||
1038 | ;происходит масштабирование |
||
1039 | dec dword[cam_y] ;переходим в соседний куб |
||
1040 | cmp dword[cam_y],0 |
||
1041 | jge .end_0 |
||
1042 | |||
1043 | mov ecx,eax |
||
1044 | sub ecx,[scaled_zoom] |
||
1045 | xor eax,eax |
||
1046 | inc eax |
||
1047 | shl eax,cl |
||
1048 | dec eax |
||
1049 | mov dword[cam_y],eax ;если номер куба оказался меньше 0 исправляем на максимальное значение |
||
1050 | .end_0: |
||
1051 | pop ecx eax |
||
1052 | .end_f: |
||
1053 | call draw_objects |
||
1054 | call draw_pok |
||
2748 | IgorA | 1055 | ret |
1056 | |||
1057 | align 4 |
||
2883 | IgorA | 1058 | but_mode_pen: |
2748 | IgorA | 1059 | push eax |
1060 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1061 | stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen |
2883 | IgorA | 1062 | cmp eax,PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1063 | jne @f |
1064 | call draw_objects |
||
1065 | @@: |
||
1066 | pop eax |
||
1067 | ret |
||
1068 | |||
1069 | align 4 |
||
2883 | IgorA | 1070 | but_mode_brush: |
2748 | IgorA | 1071 | push eax |
1072 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1073 | stdcall set_pen_mode,3,1,((9 shl 8)+9) shl 16 ;brush |
2883 | IgorA | 1074 | cmp eax,PEN_MODE_SELECT_COLOR |
1075 | jne @f |
||
1076 | call draw_objects |
||
1077 | @@: |
||
1078 | pop eax |
||
1079 | ret |
||
1080 | |||
1081 | align 4 |
||
1082 | but_mode_clear: |
||
1083 | push eax |
||
1084 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1085 | stdcall set_pen_mode,PEN_MODE_CLEAR,2,((15 shl 8)+9) shl 16 |
2883 | IgorA | 1086 | cmp eax,PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1087 | jne @f |
1088 | call draw_objects |
||
1089 | @@: |
||
1090 | pop eax |
||
1091 | ret |
||
1092 | |||
1093 | align 4 |
||
1094 | but_light: |
||
1095 | xor dword[mode_light],1 |
||
1096 | call draw_objects |
||
1097 | ret |
||
1098 | |||
1099 | align 4 |
||
1100 | but_rend_2_2: |
||
1101 | push edi |
||
1102 | cmp dword[buf_r_img],0 |
||
1103 | jne @f |
||
1104 | ;создание буфера для рендера |
||
1105 | push ecx esi |
||
1106 | mov edi,buf_r_img |
||
1107 | mov esi,buf_0 |
||
1108 | mov ecx,BUF_STRUCT_SIZE |
||
1109 | cld |
||
1110 | rep movsb ;копируем все параметры с основного буфера |
||
1111 | mov edi,buf_r_img |
||
1112 | mov buf2d_data,0 |
||
1113 | shl buf2d_w,1 ;увеличиваем размер буфера |
||
1114 | shl buf2d_h,1 |
||
1115 | stdcall [buf2d_create],buf_r_img |
||
1116 | |||
1117 | mov edi,buf_r_z |
||
1118 | mov esi,buf_0z |
||
1119 | mov ecx,BUF_STRUCT_SIZE |
||
1120 | cld |
||
1121 | rep movsb ;копируем все параметры с основного буфера |
||
1122 | mov edi,buf_r_z |
||
1123 | mov buf2d_data,0 |
||
1124 | shl buf2d_w,1 ;увеличиваем размер буфера |
||
1125 | shl buf2d_h,1 |
||
1126 | stdcall [buf2d_create],buf_r_z |
||
1127 | pop esi ecx |
||
1128 | @@: |
||
1129 | stdcall [buf2d_clear], buf_r_img, [buf_0.color] ;чистим буфер |
||
1130 | stdcall [buf2d_clear], buf_r_z, 0 ;чистим буфер |
||
1131 | |||
1132 | push eax ebx ecx |
||
1133 | mov eax,[v_zoom] |
||
2758 | IgorA | 1134 | cmp eax,[scaled_zoom] |
1135 | jle .end_scaled |
||
1136 | ;рендер увеличенной части объекта |
||
1137 | mov ebx,[scaled_zoom] |
||
1138 | sub eax,ebx |
||
1139 | inc ebx |
||
2975 | IgorA | 1140 | stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, [buf_vox],\ |
2808 | IgorA | 1141 | [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] |
2758 | IgorA | 1142 | bt dword[mode_light],0 |
1143 | jnc @f |
||
2975 | IgorA | 1144 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, [buf_vox], 0,0, 0, ebx, 3 |
2758 | IgorA | 1145 | @@: |
1146 | xor ebx,ebx |
||
1147 | xor ecx,ecx |
||
1148 | mov edi,buf_r_img |
||
1149 | stdcall [buf2d_img_hdiv2], edi |
||
1150 | shr buf2d_h,1 |
||
1151 | stdcall [buf2d_img_wdiv2], edi |
||
1152 | shr buf2d_w,1 |
||
1153 | jmp .show |
||
1154 | .end_scaled: |
||
1155 | |||
2748 | IgorA | 1156 | inc eax |
2975 | IgorA | 1157 | stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, [buf_vox], [open_file_vox], 0,0, 0, eax |
2815 | IgorA | 1158 | stdcall [buf2d_vox_obj_draw_1g], buf_r_img, buf_r_z, [open_file_vox], 0,0, eax |
2748 | IgorA | 1159 | bt dword[mode_light],0 |
1160 | jnc @f |
||
2975 | IgorA | 1161 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, [buf_vox], 0,0, 0, eax, 3 |
2748 | IgorA | 1162 | @@: |
1163 | |||
1164 | mov edi,buf_r_img |
||
1165 | stdcall [buf2d_img_hdiv2], edi |
||
1166 | shr buf2d_h,1 |
||
1167 | stdcall [buf2d_img_wdiv2], edi |
||
1168 | shr buf2d_w,1 |
||
1169 | |||
2975 | IgorA | 1170 | stdcall [buf2d_vox_obj_get_img_w_3g], [buf_vox],[v_zoom] |
2748 | IgorA | 1171 | mov ebx,[buf_0.w] |
1172 | sub ebx,eax |
||
1173 | shr ebx,1 ;ebx - для центровки маленьких изображений по горизонтали |
||
2975 | IgorA | 1174 | stdcall [buf2d_vox_obj_get_img_h_3g], [buf_vox],[v_zoom] |
2748 | IgorA | 1175 | cmp eax,[buf_0.h] |
1176 | jg @f |
||
1177 | mov ecx,[buf_0.h] |
||
1178 | sub ecx,eax |
||
2758 | IgorA | 1179 | shr ecx,1 ;ecx - для центровки маленьких изображений по вертикали |
1180 | @@: |
||
1181 | .show: |
||
2748 | IgorA | 1182 | stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi |
1183 | shl buf2d_h,1 |
||
1184 | shl buf2d_w,1 |
||
1185 | pop ecx ebx eax |
||
1186 | pop edi |
||
1187 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
||
1188 | ret |
||
1189 | |||
2883 | IgorA | 1190 | ;уменьшаем ширину кисти |
2748 | IgorA | 1191 | align 4 |
2883 | IgorA | 1192 | but_bru_w_m: |
1193 | cmp dword[brush_w],1 |
||
1194 | jle @f |
||
1195 | dec dword[brush_w] |
||
1196 | pushad |
||
1197 | call draw_pok |
||
1198 | call draw_vox_cursor |
||
1199 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
||
1200 | popad |
||
1201 | @@: |
||
1202 | ret |
||
1203 | ;увеличиваем ширину кисти |
||
1204 | align 4 |
||
1205 | but_bru_w_p: |
||
1206 | cmp dword[brush_w],32 |
||
1207 | jge @f |
||
1208 | inc dword[brush_w] |
||
1209 | pushad |
||
1210 | call draw_pok |
||
1211 | call draw_vox_cursor |
||
1212 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
||
1213 | popad |
||
1214 | @@: |
||
1215 | ret |
||
1216 | ;уменьшаем высоту кисти |
||
1217 | align 4 |
||
1218 | but_bru_h_m: |
||
1219 | cmp dword[brush_h],1 |
||
1220 | jle @f |
||
1221 | dec dword[brush_h] |
||
1222 | pushad |
||
1223 | call draw_pok |
||
1224 | call draw_vox_cursor |
||
1225 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
||
1226 | popad |
||
1227 | @@: |
||
1228 | ret |
||
1229 | ;увеличиваем высоту кисти |
||
1230 | align 4 |
||
1231 | but_bru_h_p: |
||
1232 | cmp dword[brush_h],32 |
||
1233 | jge @f |
||
1234 | inc dword[brush_h] |
||
1235 | pushad |
||
1236 | call draw_pok |
||
1237 | call draw_vox_cursor |
||
1238 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
||
1239 | popad |
||
1240 | @@: |
||
1241 | ret |
||
1242 | |||
1243 | align 4 |
||
1244 | but_brush_copy: |
||
1245 | cmp dword[v_pen_mode],3 |
||
1246 | jne .end_f |
||
1247 | pushad |
||
1248 | mov eax,[v_cur_x] |
||
1249 | mov ebx,[n_plane] |
||
1250 | mov edx,[v_cur_y] |
||
1251 | |||
1252 | mov ecx,[v_zoom] |
||
1253 | cmp ecx,[scaled_zoom] |
||
1254 | jle @f |
||
1255 | ;преобразование координат, с учетом увеличения |
||
1256 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1257 | mov ecx,[scaled_zoom] |
||
1258 | |||
1259 | mov edi,[cam_x] |
||
1260 | shl edi,cl |
||
1261 | add eax,edi |
||
1262 | mov edi,[cam_y] |
||
1263 | shl edi,cl |
||
1264 | add ebx,edi |
||
1265 | mov edi,[cam_z] |
||
1266 | shl edi,cl |
||
1267 | add edx,edi |
||
1268 | @@: |
||
1269 | |||
1270 | cld |
||
1271 | mov edi,brush_data |
||
1272 | mov esi,edx |
||
1273 | sub esi,[brush_h] |
||
1274 | .cycle_0: |
||
1275 | mov ecx,[brush_w] |
||
1276 | @@: |
||
1277 | push eax |
||
1278 | stdcall buf2d_vox_obj_node_get_color, [open_file_vox], eax,ebx,edx, [v_zoom] |
||
1279 | cmp eax,[v_color] |
||
1280 | jne .end_0 |
||
1281 | mov eax,1 shl 30 |
||
1282 | .end_0: |
||
1283 | mov dword[edi],eax ;color |
||
1284 | pop eax |
||
1285 | inc eax |
||
1286 | add edi,4 |
||
1287 | loop @b |
||
1288 | dec edx |
||
1289 | sub eax,[brush_w] |
||
1290 | cmp edx,esi |
||
1291 | jg .cycle_0 |
||
1292 | |||
1293 | call draw_objects |
||
1294 | popad |
||
1295 | .end_f: |
||
1296 | ret |
||
1297 | |||
1298 | align 4 |
||
1299 | but_brush_draw: |
||
1300 | cmp dword[v_pen_mode],3 |
||
1301 | jne .end_f |
||
1302 | pushad |
||
1303 | mov eax,[v_cur_x] |
||
1304 | mov ebx,[n_plane] |
||
1305 | mov edx,[v_cur_y] |
||
1306 | |||
1307 | mov ecx,[v_zoom] |
||
1308 | cmp ecx,[scaled_zoom] |
||
1309 | jle @f |
||
1310 | ;преобразование координат, с учетом увеличения |
||
1311 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1312 | mov ecx,[scaled_zoom] |
||
1313 | |||
1314 | mov edi,[cam_x] |
||
1315 | shl edi,cl |
||
1316 | add eax,edi |
||
1317 | mov edi,[cam_y] |
||
1318 | shl edi,cl |
||
1319 | add ebx,edi |
||
1320 | mov edi,[cam_z] |
||
1321 | shl edi,cl |
||
1322 | add edx,edi |
||
1323 | @@: |
||
1324 | |||
1325 | cld |
||
1326 | mov edi,brush_data |
||
1327 | mov esi,edx |
||
1328 | sub esi,[brush_h] |
||
1329 | .cycle_0: |
||
1330 | mov ecx,[brush_w] |
||
1331 | @@: |
||
1332 | bt dword[edi],31 ;бит прозрачности |
||
1333 | jc .end_2 |
||
1334 | bt dword[edi],30 ;бит текущего цвета |
||
1335 | jnc .end_0 |
||
1336 | push dword[v_color] |
||
1337 | jmp .end_1 |
||
1338 | .end_0: |
||
1339 | push dword[edi] |
||
1340 | .end_1: |
||
1341 | stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom] ;, color |
||
1342 | .end_2: |
||
1343 | inc eax |
||
1344 | add edi,4 |
||
1345 | loop @b |
||
1346 | dec edx |
||
1347 | sub eax,[brush_w] |
||
1348 | cmp edx,esi |
||
1349 | jg .cycle_0 |
||
1350 | |||
1351 | call draw_objects |
||
1352 | popad |
||
1353 | .end_f: |
||
1354 | ret |
||
1355 | |||
1356 | align 4 |
||
2974 | IgorA | 1357 | but_brush_clear: |
1358 | cmp dword[v_pen_mode],3 |
||
1359 | jne .end_f |
||
1360 | pushad |
||
1361 | mov eax,[v_cur_x] |
||
1362 | mov ebx,[n_plane] |
||
1363 | mov edx,[v_cur_y] |
||
1364 | |||
1365 | mov ecx,[v_zoom] |
||
1366 | cmp ecx,[scaled_zoom] |
||
1367 | jle @f |
||
1368 | ;преобразование координат, с учетом увеличения |
||
1369 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1370 | mov ecx,[scaled_zoom] |
||
1371 | |||
1372 | mov edi,[cam_x] |
||
1373 | shl edi,cl |
||
1374 | add eax,edi |
||
1375 | mov edi,[cam_y] |
||
1376 | shl edi,cl |
||
1377 | add ebx,edi |
||
1378 | mov edi,[cam_z] |
||
1379 | shl edi,cl |
||
1380 | add edx,edi |
||
1381 | @@: |
||
1382 | |||
1383 | cld |
||
1384 | mov edi,brush_data |
||
1385 | mov esi,edx |
||
1386 | sub esi,[brush_h] |
||
1387 | .cycle_0: |
||
1388 | mov ecx,[brush_w] |
||
1389 | @@: |
||
1390 | bt dword[edi],31 ;бит прозрачности |
||
1391 | jc .end_2 |
||
1392 | stdcall buf2d_vox_obj_delete_node, [open_file_vox], eax,ebx,edx, [v_zoom] |
||
1393 | .end_2: |
||
1394 | inc eax |
||
1395 | add edi,4 |
||
1396 | loop @b |
||
1397 | dec edx |
||
1398 | sub eax,[brush_w] |
||
1399 | cmp edx,esi |
||
1400 | jg .cycle_0 |
||
1401 | |||
1402 | call draw_objects |
||
1403 | popad |
||
1404 | .end_f: |
||
1405 | ret |
||
1406 | |||
1407 | align 4 |
||
2748 | IgorA | 1408 | draw_palete: |
1409 | stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер |
||
2758 | IgorA | 1410 | stdcall buf2d_draw_palete, buf_0, 5,3, 9,6, 18, 512 |
2748 | IgorA | 1411 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
1412 | ret |
||
1413 | |||
2883 | IgorA | 1414 | align 4 |
2758 | IgorA | 1415 | v_zoom dd 3 ;текущий масштаб |
2748 | IgorA | 1416 | v_cur_x dd 0 ;координата курсора x |
1417 | v_cur_y dd 0 ;координата курсора y (но ось в объекте z) |
||
1418 | n_plane dd 0 ;плоскость сечения |
||
1419 | v_color dd 0xff ;цвет карандаша |
||
2933 | IgorA | 1420 | v_pen_mode dd PEN_MODE_NONE ;режим работы курсора (см. константы PEN_MODE_...) |
2748 | IgorA | 1421 | mode_light dd 1 ;режим освещения |
2758 | IgorA | 1422 | cam_x dd 0 |
1423 | cam_y dd 0 |
||
1424 | cam_z dd 0 |
||
1425 | scaled_zoom dd 5 ;масштаб после которого начинается рисование части изображения |
||
2876 | IgorA | 1426 | tile_size dd ? ;размер квадратика на плоскости с сечением |
1427 | max_open_file_size dd ? |
||
2883 | IgorA | 1428 | brush_w dd 5 ;ширина кисти |
1429 | brush_h dd 5 ;высота кисти |
||
1430 | brush_data dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
||
1431 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1432 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1433 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1434 | dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
||
1435 | rd 999 ;32*32-25 |
||
2748 | IgorA | 1436 | |
1437 | txt_zoom db 'Масштаб:',0 |
||
2883 | IgorA | 1438 | txt_curor: db 'Курсор: ' |
1439 | .size: rb 10 |
||
2748 | IgorA | 1440 | txt_n_plane db 'Сечение:',0 |
2758 | IgorA | 1441 | txt_color db 'Цвет:',0 |
2883 | IgorA | 1442 | txt_brush: db 'Кисть: ' |
1443 | .size: rb 10 |
||
1444 | txt_mull db '*',0 |
||
1445 | txt_space db ' ',0 |
||
1446 | txt_buf rb 16 |
||
2748 | IgorA | 1447 | |
1448 | align 4 |
||
1449 | draw_objects: |
||
1450 | stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер |
||
1451 | stdcall [buf2d_clear], buf_0z, 0 ;чистим буфер |
||
1452 | stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;чистим буфер |
||
1453 | |||
2883 | IgorA | 1454 | cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1455 | jne @f |
1456 | call draw_palete |
||
1457 | jmp .end_f |
||
1458 | @@: |
||
2758 | IgorA | 1459 | push eax ebx ecx |
2975 | IgorA | 1460 | stdcall [buf2d_vox_obj_get_img_w_3g], [buf_vox],[v_zoom] |
2758 | IgorA | 1461 | mov ebx,[buf_0.w] |
1462 | sub ebx,eax |
||
1463 | shr ebx,1 ;ebx - для центровки маленьких изображений по горизонтали |
||
2748 | IgorA | 1464 | |
2758 | IgorA | 1465 | xor ecx,ecx |
2975 | IgorA | 1466 | stdcall [buf2d_vox_obj_get_img_h_3g], [buf_vox],[v_zoom] |
2758 | IgorA | 1467 | cmp eax,[buf_0.h] |
1468 | jg @f |
||
1469 | mov ecx,[buf_0.h] |
||
1470 | sub ecx,eax |
||
2975 | IgorA | 1471 | shr ecx,1 ;ecx - для центровки маленьких изображений по вертикали |
2758 | IgorA | 1472 | @@: |
2748 | IgorA | 1473 | |
2758 | IgorA | 1474 | mov eax,[v_zoom] |
1475 | cmp eax,[scaled_zoom] |
||
1476 | jg @f |
||
1477 | ;обычный режим изображения |
||
2975 | IgorA | 1478 | stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, [buf_vox],\ |
2759 | IgorA | 1479 | [open_file_vox], ebx,ecx, 0, eax |
1480 | stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox],\ |
||
2876 | IgorA | 1481 | OT_MAP_X,OT_MAP_Y,[tile_size], eax, [n_plane], [sc.work_graph] |
2815 | IgorA | 1482 | stdcall [buf2d_vox_obj_draw_1g], buf_0, buf_0z,\ |
1483 | [open_file_vox], 0,0, eax |
||
2748 | IgorA | 1484 | bt dword[mode_light],0 |
2758 | IgorA | 1485 | jnc .end_1 |
2975 | IgorA | 1486 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, [buf_vox], ebx,ecx, 0, eax, 3 |
2758 | IgorA | 1487 | .end_1: |
1488 | jmp .end_0 |
||
1489 | @@: |
||
1490 | ;режим масштабирования изображения |
||
1491 | sub eax,[scaled_zoom] |
||
2975 | IgorA | 1492 | stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, [buf_vox],\ |
2758 | IgorA | 1493 | [open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax |
1494 | stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\ |
||
2876 | IgorA | 1495 | OT_MAP_X,OT_MAP_Y,[tile_size], [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax |
2758 | IgorA | 1496 | bt dword[mode_light],0 |
1497 | jnc .end_2 |
||
2975 | IgorA | 1498 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, [buf_vox], 0,0, 0, [scaled_zoom], 3 |
2758 | IgorA | 1499 | .end_2: |
2748 | IgorA | 1500 | .end_0: |
2758 | IgorA | 1501 | pop ecx ebx eax |
2748 | IgorA | 1502 | |
2808 | IgorA | 1503 | call draw_vox_cursor |
2748 | IgorA | 1504 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
1505 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
||
1506 | .end_f: |
||
1507 | ret |
||
1508 | |||
2808 | IgorA | 1509 | ;рисование курсора |
1510 | align 4 |
||
1511 | draw_vox_cursor: |
||
1512 | pushad |
||
1513 | mov ecx,[v_zoom] |
||
1514 | cmp ecx,[scaled_zoom] |
||
1515 | jle @f |
||
1516 | mov ecx,[scaled_zoom] |
||
1517 | @@: |
||
1518 | xor edx,edx |
||
1519 | inc edx |
||
1520 | shl edx,cl |
||
1521 | |||
1522 | mov eax,[v_cur_x] |
||
1523 | cmp eax,edx |
||
1524 | jge .end_f ;курсор за пределами поля |
||
2876 | IgorA | 1525 | mov edi,[tile_size] |
2808 | IgorA | 1526 | imul eax,edi |
1527 | add eax,OT_MAP_X |
||
1528 | mov ebx,edx |
||
1529 | dec ebx |
||
1530 | sub ebx,[v_cur_y] |
||
1531 | imul ebx,edi |
||
1532 | add ebx,OT_MAP_Y |
||
1533 | inc eax |
||
1534 | inc ebx |
||
1535 | sub edi,2 |
||
1536 | stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,edi,[sc.work_graph] |
||
1537 | dec ebx |
||
1538 | add edi,2 |
||
1539 | |||
2883 | IgorA | 1540 | cmp dword[v_pen_mode],3 |
1541 | je .brush |
||
1542 | |||
2808 | IgorA | 1543 | ;горизонтальные линии |
1544 | sub eax,2 |
||
1545 | mov ecx,edi |
||
1546 | imul edi,edx |
||
1547 | shr ecx,1 |
||
1548 | add ebx,ecx ;центровка по середине клетки |
||
1549 | mov ecx,OT_MAP_X |
||
1550 | add edi,ecx |
||
1551 | stdcall [buf2d_line], buf_pl, ecx,ebx, eax,ebx,[sc.work_graph] |
||
2876 | IgorA | 1552 | add eax,[tile_size] |
2808 | IgorA | 1553 | inc eax |
1554 | cmp eax,edi |
||
1555 | jge @f ;если курсор на краю поля |
||
1556 | dec edi |
||
1557 | stdcall [buf2d_line], buf_pl, eax,ebx, edi,ebx,[sc.work_graph] |
||
1558 | @@: |
||
2883 | IgorA | 1559 | jmp .end_f |
2808 | IgorA | 1560 | |
2883 | IgorA | 1561 | ;рамка для кисти |
1562 | .brush: |
||
1563 | dec eax |
||
1564 | mov ecx,[brush_w] |
||
1565 | imul ecx,[tile_size] |
||
1566 | ;mov edi,eax |
||
1567 | mov edi,ecx |
||
1568 | mov esi,[brush_h] |
||
1569 | imul esi,[tile_size] |
||
1570 | stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,esi,[sc.work_graph] |
||
1571 | |||
2808 | IgorA | 1572 | .end_f: |
1573 | popad |
||
1574 | ret |
||
1575 | |||
2933 | IgorA | 1576 | ;hot_p - координаты горячей точки курсора, смещенные на бит 16 ((cx shl 8) + cy) shl 16 |
1577 | align 4 |
||
1578 | proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword |
||
1579 | mov eax,[mode] |
||
1580 | cmp [v_pen_mode],eax |
||
1581 | je @f |
||
1582 | mov [v_pen_mode],eax |
||
1583 | mov edx,[hot_p] |
||
1584 | mov dx,2 ;LOAD_INDIRECT |
||
1585 | mov ecx,[icon] |
||
1586 | shl ecx,12 ;умножаем на 4 кб |
||
1587 | add ecx,[buf_curs.data] |
||
1588 | mcall 37,4 |
||
1589 | |||
1590 | cmp eax,0 |
||
1591 | je @f |
||
1592 | mov [cursor_pointer],eax |
||
1593 | mcall 37,5,[cursor_pointer] |
||
1594 | @@: |
||
1595 | ret |
||
1596 | endp |
||
1597 | |||
2748 | IgorA | 1598 | if 0 |
1599 | ;input: |
||
1600 | ; buf - указатель на строку, число должно быть в 10 или 16 ричном виде |
||
1601 | ;output: |
||
1602 | ; eax - число |
||
1603 | align 4 |
||
1604 | proc conv_str_to_int, buf:dword |
||
1605 | xor eax,eax |
||
1606 | push ebx ecx esi |
||
1607 | xor ebx,ebx |
||
1608 | mov esi,[buf] |
||
1609 | ;определение отрицательных чисел |
||
1610 | xor ecx,ecx |
||
1611 | inc ecx |
||
1612 | cmp byte[esi],'-' |
||
1613 | jne @f |
||
1614 | dec ecx |
||
1615 | inc esi |
||
1616 | @@: |
||
1617 | |||
1618 | cmp word[esi],'0x' |
||
1619 | je .load_digit_16 |
||
1620 | |||
1621 | .load_digit_10: ;считывание 10-тичных цифр |
||
1622 | mov bl,byte[esi] |
||
1623 | cmp bl,'0' |
||
1624 | jl @f |
||
1625 | cmp bl,'9' |
||
1626 | jg @f |
||
1627 | sub bl,'0' |
||
1628 | imul eax,10 |
||
1629 | add eax,ebx |
||
1630 | inc esi |
||
1631 | jmp .load_digit_10 |
||
1632 | jmp @f |
||
1633 | |||
1634 | .load_digit_16: ;считывание 16-ричных цифр |
||
1635 | add esi,2 |
||
1636 | .cycle_16: |
||
1637 | mov bl,byte[esi] |
||
1638 | cmp bl,'0' |
||
1639 | jl @f |
||
1640 | cmp bl,'f' |
||
1641 | jg @f |
||
1642 | cmp bl,'9' |
||
1643 | jle .us1 |
||
1644 | cmp bl,'A' |
||
1645 | jl @f ;отсеиваем символы >'9' и <'A' |
||
1646 | .us1: ;составное условие |
||
1647 | cmp bl,'F' |
||
1648 | jle .us2 |
||
1649 | cmp bl,'a' |
||
1650 | jl @f ;отсеиваем символы >'F' и <'a' |
||
1651 | sub bl,32 ;переводим символы в верхний регистр, для упрощения их последущей обработки |
||
1652 | .us2: ;составное условие |
||
1653 | sub bl,'0' |
||
1654 | cmp bl,9 |
||
1655 | jle .cor1 |
||
1656 | sub bl,7 ;convert 'A' to '10' |
||
1657 | .cor1: |
||
1658 | shl eax,4 |
||
1659 | add eax,ebx |
||
1660 | inc esi |
||
1661 | jmp .cycle_16 |
||
1662 | @@: |
||
1663 | cmp ecx,0 ;если число отрицательное |
||
1664 | jne @f |
||
1665 | sub ecx,eax |
||
1666 | mov eax,ecx |
||
1667 | @@: |
||
1668 | pop esi ecx ebx |
||
1669 | ret |
||
1670 | endp |
||
1671 | end if |
||
1672 | |||
2883 | IgorA | 1673 | ;input: |
1674 | ; eax = value |
||
1675 | ; edi = string buffer |
||
1676 | ;output: |
||
1677 | align 4 |
||
1678 | convert_int_to_str: |
||
1679 | pushad |
||
1680 | mov dword[edi+1],0 |
||
1681 | mov word[edi+5],0 |
||
1682 | call .str |
||
1683 | popad |
||
1684 | ret |
||
1685 | |||
1686 | align 4 |
||
1687 | .str: |
||
1688 | mov ecx,0x0a ;задается система счисления изменяются регистры ebx,eax,ecx,edx входные параметры eax - число |
||
1689 | ;преревод числа в ASCII строку взодные данные ecx=система счисленя edi адрес куда записывать, будем строку, причем конец переменной |
||
1690 | cmp eax,ecx ;сравнить если в eax меньше чем в ecx то перейти на @@-1 т.е. на pop eax |
||
1691 | jb @f |
||
1692 | xor edx,edx ;очистить edx |
||
1693 | div ecx ;разделить - остаток в edx |
||
1694 | push edx ;положить в стек |
||
1695 | ;dec edi ;смещение необходимое для записи с конца строки |
||
1696 | call .str ;перейти на саму себя т.е. вызвать саму себя и так до того момента пока в eax не станет меньше чем в ecx |
||
1697 | pop eax |
||
1698 | @@: ;cmp al,10 ;проверить не меньше ли значение в al чем 10 (для системы счисленя 10 данная команда - лишная)) |
||
1699 | or al,0x30 ;данная команда короче чем две выше |
||
1700 | stosb ;записать элемент из регистра al в ячеку памяти es:edi |
||
1701 | ret ;вернуться чень интересный ход т.к. пока в стеке храниться кол-во вызовов то столько раз мы и будем вызываться |
||
1702 | |||
1703 | align 4 |
||
1704 | proc str_cat, str1:dword, str2:dword |
||
1705 | push eax ecx edi esi |
||
1706 | mov esi,dword[str2] |
||
1707 | stdcall str_len,esi |
||
1708 | mov ecx,eax |
||
1709 | inc ecx |
||
1710 | mov edi,dword[str1] |
||
1711 | stdcall str_len,edi |
||
1712 | add edi,eax |
||
1713 | cld |
||
1714 | repne movsb |
||
1715 | pop esi edi ecx eax |
||
1716 | ret |
||
1717 | endp |
||
1718 | |||
1719 | ;output: |
||
1720 | ; eax = strlen |
||
1721 | align 4 |
||
1722 | proc str_len, str1:dword |
||
1723 | mov eax,[str1] |
||
1724 | @@: |
||
1725 | cmp byte[eax],0 |
||
1726 | je @f |
||
1727 | inc eax |
||
1728 | jmp @b |
||
1729 | @@: |
||
1730 | sub eax,[str1] |
||
1731 | ret |
||
1732 | endp |
||
1733 | |||
2748 | IgorA | 1734 | ;данные для диалога открытия файлов |
1735 | align 4 |
||
1736 | OpenDialog_data: |
||
1737 | .type dd 0 ;0 - открыть, 1 - сохранить, 2 - выбрать дтректорию |
||
1738 | .procinfo dd procinfo ;+4 |
||
1739 | .com_area_name dd communication_area_name ;+8 |
||
1740 | .com_area dd 0 ;+12 |
||
1741 | .opendir_path dd plugin_path ;+16 |
||
1742 | .dir_default_path dd default_dir ;+20 |
||
1743 | .start_path dd file_name ;+24 путь к диалогу открытия файлов |
||
1744 | .draw_window dd draw_window ;+28 |
||
1745 | .status dd 0 ;+32 |
||
1746 | .openfile_path dd openfile_path ;+36 путь к открываемому файлу |
||
1747 | .filename_area dd filename_area ;+40 |
||
1748 | .filter_area dd Filter |
||
1749 | .x: |
||
1750 | .x_size dw 420 ;+48 ; Window X size |
||
1751 | .x_start dw 10 ;+50 ; Window X position |
||
1752 | .y: |
||
1753 | .y_size dw 320 ;+52 ; Window y size |
||
1754 | .y_start dw 10 ;+54 ; Window Y position |
||
1755 | |||
1756 | default_dir db '/rd/1',0 |
||
1757 | |||
1758 | communication_area_name: |
||
1759 | db 'FFFFFFFF_open_dialog',0 |
||
1760 | open_dialog_name: |
||
1761 | db 'opendial',0 |
||
1762 | communication_area_default_path: |
||
1763 | db '/rd/1/File managers/',0 |
||
1764 | |||
1765 | Filter: |
||
1766 | dd Filter.end - Filter ;.1 |
||
1767 | .1: |
||
1768 | db 'VOX',0 |
||
1769 | .end: |
||
1770 | db 0 |
||
1771 | |||
1772 | |||
1773 | |||
1774 | head_f_i: |
||
1775 | head_f_l db 'Системная ошибка',0 |
||
1776 | |||
1777 | system_dir_0 db '/sys/lib/' |
||
1778 | lib_name_0 db 'proc_lib.obj',0 |
||
1779 | err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 |
||
1780 | err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 |
||
1781 | |||
1782 | system_dir_1 db '/sys/lib/' |
||
1783 | lib_name_1 db 'libimg.obj',0 |
||
1784 | err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 |
||
1785 | err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 |
||
1786 | |||
1787 | system_dir_2 db '/sys/lib/' |
||
1788 | lib_name_2 db 'buf2d.obj',0 |
||
1789 | err_msg_found_lib_2 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 |
||
1790 | err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 |
||
1791 | |||
2876 | IgorA | 1792 | system_dir_3 db '/sys/lib/' |
1793 | lib_name_3 db 'libini.obj',0 |
||
1794 | err_msg_found_lib_3 db 'Не найдена библиотека ',39,'libini.obj',39,0 |
||
1795 | err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'libini',39,0 |
||
1796 | |||
2748 | IgorA | 1797 | l_libs_start: |
1798 | lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ |
||
1799 | err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i |
||
1800 | lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ |
||
1801 | err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i |
||
1802 | lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ |
||
1803 | err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i |
||
2876 | IgorA | 1804 | lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\ |
1805 | err_msg_found_lib_3,head_f_l,import_libini,err_msg_import_3,head_f_i |
||
2748 | IgorA | 1806 | l_libs_end: |
1807 | |||
1808 | align 4 |
||
1809 | import_libimg: |
||
1810 | dd alib_init1 |
||
1811 | img_is_img dd aimg_is_img |
||
1812 | img_info dd aimg_info |
||
1813 | img_from_file dd aimg_from_file |
||
1814 | img_to_file dd aimg_to_file |
||
1815 | img_from_rgb dd aimg_from_rgb |
||
1816 | img_to_rgb dd aimg_to_rgb |
||
1817 | img_to_rgb2 dd aimg_to_rgb2 |
||
1818 | img_decode dd aimg_decode |
||
1819 | img_encode dd aimg_encode |
||
1820 | img_create dd aimg_create |
||
1821 | img_destroy dd aimg_destroy |
||
1822 | img_destroy_layer dd aimg_destroy_layer |
||
1823 | img_count dd aimg_count |
||
1824 | img_lock_bits dd aimg_lock_bits |
||
1825 | img_unlock_bits dd aimg_unlock_bits |
||
1826 | img_flip dd aimg_flip |
||
1827 | img_flip_layer dd aimg_flip_layer |
||
1828 | img_rotate dd aimg_rotate |
||
1829 | img_rotate_layer dd aimg_rotate_layer |
||
1830 | img_draw dd aimg_draw |
||
1831 | |||
1832 | dd 0,0 |
||
1833 | alib_init1 db 'lib_init',0 |
||
1834 | aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение |
||
1835 | aimg_info db 'img_info',0 |
||
1836 | aimg_from_file db 'img_from_file',0 |
||
1837 | aimg_to_file db 'img_to_file',0 |
||
1838 | aimg_from_rgb db 'img_from_rgb',0 |
||
1839 | aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB |
||
1840 | aimg_to_rgb2 db 'img_to_rgb2',0 |
||
1841 | aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных |
||
1842 | aimg_encode db 'img_encode',0 |
||
1843 | aimg_create db 'img_create',0 |
||
1844 | aimg_destroy db 'img_destroy',0 |
||
1845 | aimg_destroy_layer db 'img_destroy_layer',0 |
||
1846 | aimg_count db 'img_count',0 |
||
1847 | aimg_lock_bits db 'img_lock_bits',0 |
||
1848 | aimg_unlock_bits db 'img_unlock_bits',0 |
||
1849 | aimg_flip db 'img_flip',0 |
||
1850 | aimg_flip_layer db 'img_flip_layer',0 |
||
1851 | aimg_rotate db 'img_rotate',0 |
||
1852 | aimg_rotate_layer db 'img_rotate_layer',0 |
||
1853 | aimg_draw db 'img_draw',0 |
||
1854 | |||
1855 | align 4 |
||
1856 | proclib_import: ;описание экспортируемых функций |
||
1857 | OpenDialog_Init dd aOpenDialog_Init |
||
1858 | OpenDialog_Start dd aOpenDialog_Start |
||
1859 | dd 0,0 |
||
1860 | aOpenDialog_Init db 'OpenDialog_init',0 |
||
1861 | aOpenDialog_Start db 'OpenDialog_start',0 |
||
1862 | |||
1863 | align 4 |
||
1864 | import_buf2d: |
||
1865 | init dd sz_init |
||
1866 | buf2d_create dd sz_buf2d_create |
||
1867 | buf2d_create_f_img dd sz_buf2d_create_f_img |
||
1868 | buf2d_clear dd sz_buf2d_clear |
||
1869 | buf2d_draw dd sz_buf2d_draw |
||
1870 | buf2d_delete dd sz_buf2d_delete |
||
1871 | buf2d_line dd sz_buf2d_line |
||
1872 | buf2d_rect_by_size dd sz_buf2d_rect_by_size |
||
1873 | buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size |
||
1874 | buf2d_circle dd sz_buf2d_circle |
||
1875 | buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 |
||
1876 | buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 |
||
1877 | buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 |
||
1878 | buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 |
||
1879 | buf2d_bit_blt dd sz_buf2d_bit_blt |
||
1880 | buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp |
||
1881 | buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha |
||
1882 | buf2d_curve_bezier dd sz_buf2d_curve_bezier |
||
1883 | buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix |
||
1884 | buf2d_draw_text dd sz_buf2d_draw_text |
||
1885 | buf2d_crop_color dd sz_buf2d_crop_color |
||
1886 | buf2d_offset_h dd sz_buf2d_offset_h |
||
1887 | buf2d_flood_fill dd sz_buf2d_flood_fill |
||
1888 | buf2d_set_pixel dd sz_buf2d_set_pixel |
||
1889 | buf2d_get_pixel dd sz_buf2d_get_pixel |
||
1890 | buf2d_vox_brush_create dd sz_buf2d_vox_brush_create |
||
1891 | buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete |
||
2758 | IgorA | 1892 | buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g |
1893 | buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g |
||
2815 | IgorA | 1894 | buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g |
2758 | IgorA | 1895 | buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g |
1896 | buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled |
||
2759 | IgorA | 1897 | buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows |
2758 | IgorA | 1898 | buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl |
1899 | buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled |
||
2759 | IgorA | 1900 | |
2748 | IgorA | 1901 | dd 0,0 |
1902 | sz_init db 'lib_init',0 |
||
1903 | sz_buf2d_create db 'buf2d_create',0 |
||
1904 | sz_buf2d_create_f_img db 'buf2d_create_f_img',0 |
||
1905 | sz_buf2d_clear db 'buf2d_clear',0 |
||
1906 | sz_buf2d_draw db 'buf2d_draw',0 |
||
1907 | sz_buf2d_delete db 'buf2d_delete',0 |
||
1908 | sz_buf2d_line db 'buf2d_line',0 |
||
1909 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 |
||
1910 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 |
||
1911 | sz_buf2d_circle db 'buf2d_circle',0 |
||
1912 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 |
||
1913 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 |
||
1914 | sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 |
||
1915 | sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 |
||
1916 | sz_buf2d_bit_blt db 'buf2d_bit_blt',0 |
||
1917 | sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 |
||
1918 | sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 |
||
1919 | sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 |
||
1920 | sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 |
||
1921 | sz_buf2d_draw_text db 'buf2d_draw_text',0 |
||
1922 | sz_buf2d_crop_color db 'buf2d_crop_color',0 |
||
1923 | sz_buf2d_offset_h db 'buf2d_offset_h',0 |
||
1924 | sz_buf2d_flood_fill db 'buf2d_flood_fill',0 |
||
1925 | sz_buf2d_set_pixel db 'buf2d_set_pixel',0 |
||
1926 | sz_buf2d_get_pixel db 'buf2d_get_pixel',0 |
||
1927 | sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 |
||
1928 | sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 |
||
2758 | IgorA | 1929 | sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 |
1930 | sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 |
||
2815 | IgorA | 1931 | sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 |
2758 | IgorA | 1932 | sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 |
1933 | sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 |
||
2759 | IgorA | 1934 | sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 |
2758 | IgorA | 1935 | sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 |
1936 | sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 |
||
2748 | IgorA | 1937 | |
2876 | IgorA | 1938 | align 4 |
1939 | import_libini: |
||
1940 | dd alib_init2 |
||
1941 | ini_get_str dd aini_get_str |
||
1942 | ini_get_int dd aini_get_int |
||
1943 | ini_get_color dd aini_get_color |
||
1944 | dd 0,0 |
||
1945 | alib_init2 db 'lib_init',0 |
||
1946 | aini_get_str db 'ini_get_str',0 |
||
1947 | aini_get_int db 'ini_get_int',0 |
||
1948 | aini_get_color db 'ini_get_color',0 |
||
1949 | |||
2748 | IgorA | 1950 | mouse_dd dd 0x0 |
1951 | sc system_colors |
||
1952 | |||
1953 | align 16 |
||
1954 | procinfo process_information |
||
1955 | |||
1956 | ;буфер основного изображения |
||
1957 | align 4 |
||
1958 | buf_0: dd 0 ;указатель на дaные изображения |
||
1959 | .l: dw 5 ;+4 left |
||
1960 | .t: dw 45 ;+6 top |
||
2758 | IgorA | 1961 | .w: dd 192+6 ;+8 w |
1962 | .h: dd 224+7 ;+12 h |
||
2748 | IgorA | 1963 | .color: dd 0xffffff ;+16 color |
1964 | db 24 ;+20 bit in pixel |
||
1965 | |||
1966 | ;буфер глубины основного изображения |
||
1967 | align 4 |
||
1968 | buf_0z: dd 0 |
||
1969 | dw 0 ;+4 left |
||
1970 | dw 0 ;+6 top |
||
2758 | IgorA | 1971 | .w: dd 192+6 ;+8 w |
1972 | .h: dd 224+7 ;+12 h |
||
2748 | IgorA | 1973 | .color: dd 0 ;+16 color |
1974 | db 32 ;+20 bit in pixel |
||
1975 | |||
1976 | ;буфер для рисования среза объекта |
||
1977 | align 4 |
||
1978 | buf_pl: dd 0 |
||
2758 | IgorA | 1979 | .l: dw 15+192+6 ;+4 left |
2748 | IgorA | 1980 | .t: dw 45 ;+6 top |
1981 | .w: dd 320 ;+8 w |
||
1982 | .h: dd 330 ;+12 h |
||
1983 | .color: dd 0xffffff ;+16 color |
||
1984 | db 24 ;+20 bit in pixel |
||
1985 | |||
1986 | ;буфер для улучшеного рендера |
||
1987 | align 4 |
||
1988 | buf_r_img: |
||
1989 | rb BUF_STRUCT_SIZE |
||
1990 | align 4 |
||
1991 | buf_r_z: |
||
1992 | rb BUF_STRUCT_SIZE |
||
1993 | |||
2933 | IgorA | 1994 | align 4 |
1995 | cursor_pointer dd 0 ;указатель на данные для курсора |
||
1996 | |||
1997 | buf_curs: ;буфер с курсорами |
||
1998 | .data: dd 0 ;указатель на буфер изображения |
||
1999 | dw 0 ;+4 left |
||
2000 | dw 0 ;+6 top |
||
2001 | dd 32 ;+8 w |
||
2002 | dd 32*cursors_count ;+12 h |
||
2003 | dd 0 ;+16 color |
||
2004 | db 24 ;+20 bit in pixel |
||
2005 | |||
2006 | align 4 |
||
2007 | buf_curs_8: ;буфер с прозрачностью для курсоров |
||
2008 | .data: dd 0 ;указатель на буфер изображения |
||
2009 | dw 0 ;+4 left |
||
2010 | dw 0 ;+6 top |
||
2011 | dd 32 ;+8 w |
||
2012 | dd 32*cursors_count ;+12 h |
||
2013 | dd 0 ;+16 color |
||
2014 | db 24 ;+20 bit in pixel |
||
2015 | |||
2748 | IgorA | 2016 | ;данные для создания минимального единичного вокселя |
2017 | align 4 |
||
2975 | IgorA | 2018 | vox_6_7_z: ;воксель где видно 3 грани |
2748 | IgorA | 2019 | dd 0,0,1,1,0,0,\ |
2020 | 0,2,2,2,2,0,\ |
||
2021 | 2,2,2,2,2,2,\ |
||
2022 | 2,3,2,2,3,2,\ |
||
2023 | 2,3,3,3,3,2,\ |
||
2024 | 0,3,3,3,3,0,\ |
||
2025 | 0,0,3,3,0,0 |
||
2026 | |||
2027 | align 4 |
||
2975 | IgorA | 2028 | vox_6_4_z: ;воксель, где видно 2 боковые грани а верхней грани не видно |
2029 | dd 1,2,3,3,2,1,\ |
||
2030 | 1,2,3,3,2,1,\ |
||
2031 | 1,2,3,3,2,1,\ |
||
2032 | 1,2,3,3,2,1 |
||
2033 | |||
2034 | align 4 |
||
2035 | buf_vox dd buf_vox_g3 |
||
2036 | |||
2037 | buf_vox_g3: |
||
2748 | IgorA | 2038 | db 6,7,4,3 ;w,h,h_osn,n |
2876 | IgorA | 2039 | rb BUF_STRUCT_SIZE*(3+1) |
2748 | IgorA | 2040 | |
2975 | IgorA | 2041 | align 4 |
2042 | buf_vox_g2: |
||
2043 | db 6,4,0,3 ;w,h,h_osn,n |
||
2044 | rb BUF_STRUCT_SIZE*(3+1) |
||
2045 | |||
2748 | IgorA | 2046 | i_end: |
2876 | IgorA | 2047 | wnd_s_pos: ;место для настроек стартовой позиции окна |
2048 | rq 0 |
||
2049 | rb 4096 ;2048 |
||
2748 | IgorA | 2050 | stacktop: |
2051 | sys_path rb 1024 |
||
2052 | file_name: |
||
2053 | rb 1024 ;4096 |
||
2054 | library_path rb 1024 |
||
2876 | IgorA | 2055 | plugin_path rb 1024 ;4096 |
2056 | openfile_path rb 1024 ;4096 |
||
2748 | IgorA | 2057 | filename_area rb 256 |
2058 | mem:'a' |