Subversion Repositories Kolibri OS

Rev

Rev 7205 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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