Subversion Repositories Kolibri OS

Rev

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