Subversion Repositories Kolibri OS

Rev

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