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