Subversion Repositories Kolibri OS

Rev

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

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