Subversion Repositories Kolibri OS

Rev

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