Subversion Repositories Kolibri OS

Rev

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