Subversion Repositories Kolibri OS

Rev

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