Subversion Repositories Kolibri OS

Rev

Rev 2748 | Rev 2759 | 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 'd:/kolibri/svn/programs/macros.inc'
  13. include 'd:/kolibri/svn/programs/proc32.inc'
  14. include 'd:/kolibri/svn/programs/develop/libraries/box_lib/load_lib.mac'
  15. include 'mem.inc'
  16. include 'dll.inc'
  17. include 'vox_draw.inc'
  18.  
  19. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  20. caption db 'Voxel editor 11.06.12',0 ;¯®¤¯¨áì ®ª­ 
  21.  
  22. struct FileInfoBlock
  23.         Function dd ?
  24.         Position dd ?
  25.         Flags    dd ?
  26.         Count    dd ?
  27.         Buffer   dd ?
  28.                 db ?
  29.         FileName dd ?
  30. ends
  31.  
  32. run_file_70 FileInfoBlock
  33. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  34.  
  35. fn_toolbar db 'toolbar.png',0
  36. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  37. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*14
  38. image_data_toolbar dd 0
  39.  
  40. max_open_file_size equ 64*1024 ;64 Kb
  41.  
  42.  
  43. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  44.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  45.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  46.                 jmp @f
  47.                         local .path_str
  48.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  49.                         db 0
  50.                 @@:
  51.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  52.                 copy_path .path_str,[32],file_name,0x0
  53.         else
  54.                 copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  55.         end if
  56.  
  57.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  58.         mov [buf],eax
  59.  
  60.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  61.         mov [run_file_70.Function], 0
  62.         mov [run_file_70.Position], 0
  63.         mov [run_file_70.Flags], 0
  64.         mov [run_file_70.Count], dword size
  65.         m2m [run_file_70.Buffer], [buf]
  66.         mov byte[run_file_70+20], 0
  67.         mov [run_file_70.FileName], file_name
  68.         mov ebx,run_file_70
  69.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  70.         cmp ebx,0xffffffff
  71.         je @f
  72.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  73.                 stdcall dword[img_decode], dword[buf],ebx,0
  74.                 mov dword[image_data],eax
  75.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  76.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  77.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  78.                 stdcall dword[img_destroy], dword[image_data]
  79.         @@:
  80. }
  81.  
  82. OT_MAP_X  equ  0
  83. OT_MAP_Y  equ  0
  84. TILE_SIZE equ 10 ;à §¬¥à ª¢ ¤à â¨ª  ­  ¯«®áª®á⨠á á¥ç¥­¨¥¬
  85. OT_CAPT_X_COLOR equ  5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â 
  86. OT_CAPT_Y_COLOR equ 30
  87.  
  88. align 4
  89. start:
  90.         load_libraries l_libs_start,l_libs_end
  91.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  92.         mov     ebp,lib_2
  93.         cmp     dword [ebp+ll_struc_size-4],0
  94.         jz      @f
  95.                 mcall -1 ;exit not correct
  96.         @@:
  97.         mcall 48,3,sc,sizeof.system_colors
  98.         mcall 40,0x27
  99.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  100.  
  101.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
  102.         stdcall [buf2d_create], buf_0z ;ᮧ¤ ­¨¥ ¡ãä¥à  £«ã¡¨­ë
  103.         stdcall [buf2d_create], buf_pl ;ᮧ¤ ­¨¥ ¡ãä¥à  ¤«ï á¥ç¥­¨ï
  104.  
  105.         stdcall [buf2d_vox_brush_create], buf_vox, vox_6_7_z
  106.  
  107.         load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
  108.  
  109.         stdcall mem.Alloc,max_open_file_size
  110.         mov dword[open_file_vox],eax
  111.  
  112.         call but_new_file
  113.  
  114. align 4
  115. red_win:
  116.         call draw_window
  117.  
  118. align 4
  119. still:
  120.         mcall 10
  121.  
  122.         cmp al,1
  123.         jz red_win
  124.         cmp al,2
  125.         jz key
  126.         cmp al,3
  127.         jz button
  128.         cmp al,6
  129.         jne @f
  130.                 mcall 9,procinfo,-1
  131.                 cmp ax,word[procinfo+4]
  132.                 jne @f ;®ª­® ­¥  ªâ¨¢­®
  133.                 call mouse
  134.         @@:
  135.         jmp still
  136.  
  137. align 4
  138. mouse:
  139.         pushad
  140.         mcall 37,2
  141.         bt eax,1 ;right button
  142.         jnc @f
  143.                 mcall 37,1 ;get mouse coords
  144.                 mov ebx,eax
  145.                 shr ebx,16
  146.                 and eax,0xffff
  147.                 stdcall get_buf_color, buf_0
  148.                 stdcall get_buf_color, buf_pl
  149.                 jmp .end_f
  150.         @@:
  151.         bt eax,0 ;left button
  152.         jnc .end_f
  153.                 mcall 37,1 ;get mouse coords
  154.                 mov ebx,eax
  155.                 shr ebx,16
  156.                 and eax,0xffff
  157.  
  158.                 cmp dword[v_pen_mode],2 ;select color
  159.                 jne .end_2
  160.                         stdcall get_buf_color, buf_0
  161.                         stdcall get_buf_color, buf_pl
  162.                         jmp .end_f
  163.                 .end_2:
  164.  
  165.  
  166.                 push eax ebx
  167.                 mov edx,[v_zoom]
  168.                 cmp edx,[scaled_zoom]
  169.                 jle @f
  170.                 ;०¨¬ ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  171.                 sub edx,[scaled_zoom]
  172.                 sub ax,word[buf_0.t]
  173.                 sub bx,word[buf_0.l]
  174.                 stdcall get_mouse_ev_scale, buf_vox, ebx, eax, [scaled_zoom],edx
  175.                 cmp eax,0
  176.                 je @f
  177.                         mov ebx,eax
  178.                         and eax,0x3fffffff
  179.                         rol ebx,2
  180.                         and ebx,3
  181.                         dec ebx
  182.  
  183.                         shl ebx,2
  184.                         add ebx,cam_x
  185.                         mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z]
  186.                         call draw_objects
  187.  
  188.                         pop ebx eax
  189.                         jmp .end_f
  190.                 @@:
  191.                 pop ebx eax
  192.  
  193.  
  194.                 ;eax - mouse coord y
  195.                 ;ebx - mouse coord x
  196.                 movzx edx,word[buf_pl.t]
  197.                 add edx,OT_MAP_Y
  198.                 cmp eax,edx
  199.                 jl .end_f
  200.                         sub eax,edx
  201.                         xor edx,edx
  202.                         mov ecx,TILE_SIZE ;H
  203.                         div ecx
  204.                 movzx edx,word[buf_pl.l]
  205.                 add edx,OT_MAP_X
  206.                 cmp ebx,edx
  207.                 jl .end_f
  208.                         call convert_y ;¯à¥®¡à §®¢ ­¨¥ ª®®à¤¨­ âë y
  209.                         cmp eax,0
  210.                         jge .end_0 ;®£à ­¨ç¥­¨¥ ¯® ­¨¦­¥© ª®®à¤¨­ â¥ y
  211.                                 cmp eax,-1
  212.                                 jne .end_f
  213.                                 ;¬¥­ï¥¬ á¥ç¥­¨¥, ¯®¯ «¨ ­  ª¢ ¤à â¨ª
  214.                                 sub ebx,edx
  215.                                 mov eax,ebx
  216.                                 xor edx,edx
  217.                                 mov ecx,TILE_SIZE ;W
  218.                                 div ecx
  219.                                 mov [n_plane],eax
  220.                                 jmp .end_1
  221.                         .end_0:
  222.                         mov [v_cur_y],eax ;Y-coord
  223.                         sub ebx,edx
  224.                         mov eax,ebx
  225.                         xor edx,edx
  226.                         mov ecx,TILE_SIZE ;W
  227.                         div ecx
  228.                         mov [v_cur_x],eax ;X-coord
  229.  
  230.                         cmp dword[v_pen_mode],0
  231.                         jl .end_1
  232.                         cmp dword[v_pen_mode],1
  233.                         jg .end_1
  234.                                 mov eax,[v_cur_x]
  235.                                 mov ebx,[n_plane]
  236.                                 mov edx,[v_cur_y]
  237.                
  238.                                 mov ecx,[v_zoom]
  239.                                 cmp ecx,[scaled_zoom]
  240.                                 jle .no_c_coord_0
  241.                                         ;¯à¥®¡à §®¢ ­¨¥ ª®®à¤¨­ â, á ãç¥â®¬ 㢥«¨ç¥­¨ï
  242.                                         ;sub ecx,[scaled_zoom] ;¢ ecx ¯à¨à®áâ ¬ áèâ ¡  (ecx>0)
  243.                                         mov ecx,[scaled_zoom]
  244.  
  245.                                         mov edi,[cam_x]
  246.                                         shl edi,cl
  247.                                         add eax,edi
  248.                                         mov edi,[cam_y]
  249.                                         shl edi,cl
  250.                                         add ebx,edi
  251.                                         mov edi,[cam_z]
  252.                                         shl edi,cl
  253.                                         add edx,edi
  254.                                 .no_c_coord_0:
  255.  
  256.                                 ;®â«¨ç î騩áï ¯ à ¬¥âà ¤«ï ä㭪樨 ᮧ¤ ­¨ï ¢®ªá¥«ï
  257.                                 cmp dword[v_pen_mode],1
  258.                                 jne @f
  259.                                         push dword[v_color]
  260.                                 @@:
  261.  
  262.                                 ;¢ë§®¢ ®¡é¨å ¯ à ¬¥â஢ ¤«ï ä㭪権
  263.                                 push dword[v_zoom]
  264.                                 push edx
  265.                                 push ebx
  266.                                 push eax
  267.                                 push dword[open_file_vox]
  268.  
  269.                                 ;¢ë§®¢ ä㭪権
  270.                                 cmp dword[v_pen_mode],1
  271.                                 jne @f
  272.                                         call buf2d_vox_obj_create_node
  273.                                         ;stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom], [v_color]
  274.                                         jmp .end_1
  275.                                 @@:
  276.                                         call buf2d_vox_obj_delete_node
  277.                                         ;stdcall buf2d_vox_obj_delete_node, [open_file_vox], eax,ebx,edx, [v_zoom]
  278.  
  279.                         .end_1:
  280.                         call draw_objects
  281.                         call draw_pok
  282.         .end_f:
  283.         popad
  284.         ret
  285.  
  286. ;input:
  287. ; eax - coord y
  288. ; ebx - coord x
  289. align 4
  290. proc get_buf_color, buf:dword
  291. pushad
  292.         mov edi,[buf]
  293.         cmp ax,buf2d_t
  294.         jl .end_f
  295.         sub ax,buf2d_t
  296.         cmp eax,buf2d_h
  297.         jg .end_f
  298.         cmp bx,buf2d_l
  299.         jl .end_f
  300.         sub bx,buf2d_l
  301.         cmp ebx,buf2d_w
  302.         jg .end_f
  303.                 stdcall [buf2d_get_pixel], edi,ebx,eax
  304.                 mov [v_color],eax
  305.                 ;stdcall [buf2d_filled_rect_by_size], buf_0, 5,3, 8,8,eax
  306.                 ;stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  307.                 mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
  308.                 mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
  309.                 mov edx,[v_color]
  310.                 mcall 13
  311.         .end_f:
  312. popad
  313.         ret
  314. endp
  315.  
  316. ;¯à¥®¡à §®¢ë¢ ¥¬ ª®®à¤¨­ âã y (§­ ç¥­¨¥ ¤®«¦­® 㢥«¨ç¨¢ âìáï á ­¨§ã ¢¢¥àå)
  317. align 4
  318. convert_y:
  319.         push ecx edx
  320.         mov ecx,[v_zoom]
  321.         cmp ecx,[scaled_zoom]
  322.         jle @f
  323.                 mov ecx,[scaled_zoom]
  324.         @@:
  325.         mov edx,1
  326.         cmp ecx,1
  327.         jl @f
  328.                 shl edx,cl
  329.         @@:
  330.         sub edx,eax
  331.         dec edx
  332.         mov eax,edx
  333.         pop edx ecx
  334.         ret
  335.  
  336. align 4
  337. draw_window:
  338. pushad
  339.         mcall 12,1
  340.  
  341.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  342.         xor eax,eax
  343.         mov ebx,(20 shl 16)+550
  344.         mov ecx,(20 shl 16)+415
  345.         mov edx,[sc.work]
  346.         or  edx,(3 shl 24)+0x30000000
  347.         mov edi,caption
  348.         int 0x40
  349.  
  350.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  351.         mov eax,8
  352.         mov ebx,(5 shl 16)+20
  353.         mov ecx,(5 shl 16)+20
  354.         mov edx,3
  355.         mov esi,[sc.work_button]
  356.         int 0x40
  357.  
  358.         mov ebx,(30 shl 16)+20
  359.         mov edx,4
  360.         int 0x40
  361.         add ebx,25 shl 16
  362.         mov edx,5
  363.         int 0x40
  364.         add ebx,30 shl 16
  365.         mov edx,6
  366.         int 0x40
  367.         add ebx,25 shl 16
  368.         mov edx,7
  369.         int 0x40
  370.         add ebx,25 shl 16
  371.         mov edx,8
  372.         int 0x40
  373.         add ebx,25 shl 16
  374.         mov edx,9
  375.         int 0x40
  376.         add ebx,25 shl 16
  377.         mov edx,10
  378.         int 0x40
  379.         add ebx,25 shl 16
  380.         mov edx,11
  381.         int 0x40
  382.         add ebx,25 shl 16
  383.         mov edx,12
  384.         int 0x40
  385.         add ebx,25 shl 16
  386.         mov edx,13
  387.         int 0x40
  388.         add ebx,25 shl 16
  389.         mov edx,14
  390.         int 0x40
  391.         add ebx,25 shl 16
  392.         mov edx,15
  393.         int 0x40
  394.         add ebx,25 shl 16
  395.         mov edx,16
  396.         int 0x40
  397.  
  398.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  399.         mov eax,7
  400.         mov ebx,[image_data_toolbar]
  401.         mov ecx,(16 shl 16)+16
  402.         mov edx,(7 shl 16)+7 ;icon new
  403.         int 0x40
  404.  
  405.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  406.         add edx,(25 shl 16) ;icon open
  407.         int 0x40
  408.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  409.         add edx,(25 shl 16) ;icon save
  410.         int 0x40
  411.  
  412.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  413.         add edx,(30 shl 16) ;
  414.         int 0x40
  415.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  416.         add edx,(25 shl 16) ;
  417.         int 0x40
  418.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  419.         add edx,(25 shl 16) ;
  420.         int 0x40
  421.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  422.         add edx,(25 shl 16) ;
  423.         int 0x40
  424.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  425.         add edx,(25 shl 16) ;
  426.         int 0x40
  427.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  428.         add edx,(25 shl 16) ;
  429.         int 0x40
  430.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  431.         add edx,(25 shl 16) ;
  432.         int 0x40
  433.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  434.         add edx,(25 shl 16) ;
  435.         int 0x40
  436.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  437.         add edx,(25 shl 16) ;
  438.         int 0x40
  439.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  440.         add edx,(25 shl 16) ;
  441.         int 0x40
  442.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  443.         add edx,(25 shl 16) ;
  444.         int 0x40
  445.  
  446.         ; *** à¨á®¢ ­¨¥ ¡ãä¥à®¢ ***
  447.         call draw_objects
  448.         call draw_pok
  449.  
  450.         mcall 12,2
  451. popad
  452.         ret
  453.  
  454. align 4
  455. draw_pok:
  456.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  457.         mov ebx,(365 shl 16)+5
  458.         mov ecx,[sc.work_text]
  459.         or  ecx,0x80000000 ;or (1 shl 30)
  460.         mov edx,txt_zoom
  461.         ;mov edi,[sc.work]
  462.         int 0x40
  463.         add bx,9
  464.         mov edx,txt_cur_x
  465.         int 0x40
  466.         add bx,9
  467.         mov edx,txt_cur_y
  468.         int 0x40
  469.         add bx,9
  470.         mov edx,txt_n_plane
  471.         int 0x40
  472.  
  473.         mov eax,47
  474.         mov ecx,[v_zoom]
  475.         mov ebx,(2 shl 16)
  476.         mov edx,((365+6*9) shl 16)+5
  477.         mov esi,[sc.work_button_text]
  478.         or  esi,(1 shl 30)
  479.         mov edi,[sc.work_button]
  480.         int 0x40 ;¬ áèâ ¡
  481.         mov ebx,(5 shl 16)
  482.         mov ecx,[v_cur_x]
  483.         add edx,(6*2)*65536+9
  484.         int 0x40 ;
  485.         mov ebx,(5 shl 16)
  486.         mov ecx,[v_cur_y]
  487.         add edx,(6*0)*65536+9
  488.         int 0x40 ;
  489.         mov ebx,(5 shl 16)
  490.         mov ecx,[n_plane]
  491.         add edx,(6*0)*65536+9
  492.         int 0x40 ;
  493.  
  494.         mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  495.         mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2
  496.         mov ecx,[sc.work_text]
  497.         or  ecx,0x80000000 ;or (1 shl 30)
  498.         mov edx,txt_color
  499.         int 0x40
  500.  
  501.         mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
  502.         mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
  503.         mov edx,[v_color]
  504.         mcall 13
  505.         ret
  506.  
  507. align 4
  508. key:
  509.         mcall 2
  510.         jmp still
  511.  
  512.  
  513. align 4
  514. button:
  515.         mcall 17
  516.         cmp ah,3
  517.         jne @f
  518.                 call but_new_file
  519.                 call draw_objects
  520.                 call draw_pok
  521.         @@:
  522.         cmp ah,4
  523.         jne @f
  524.                 call but_open_file
  525.         @@:
  526.         cmp ah,5
  527.         jne @f
  528.                 call but_save_file
  529.         @@:
  530.         cmp ah,6
  531.         jne @f
  532.                 call but_1
  533.         @@:
  534.         cmp ah,7
  535.         jne @f
  536.                 call but_2
  537.         @@:
  538.         cmp ah,8
  539.         jne @f
  540.                 call but_3
  541.         @@:
  542.         cmp ah,9
  543.         jne @f
  544.                 call but_4
  545.         @@:
  546.         cmp ah,10
  547.         jne @f
  548.                 call but_5
  549.         @@:
  550.         cmp ah,11
  551.         jne @f
  552.                 call but_6
  553.         @@:
  554.         cmp ah,12
  555.         jne @f
  556.                 call but_7
  557.         @@:
  558.         cmp ah,13
  559.         jne @f
  560.                 call but_8
  561.         @@:
  562.         cmp ah,14
  563.         jne @f
  564.                 mov dword[v_pen_mode],2 ;select color
  565.                 call draw_palete
  566.         @@:
  567.         cmp ah,15
  568.         jne @f
  569.                 call but_light
  570.         @@:
  571.         cmp ah,16
  572.         jne @f
  573.                 call but_rend_2_2
  574.         @@:
  575.         cmp ah,1
  576.         jne still
  577. .exit:
  578.         stdcall [buf2d_delete],buf_0
  579.         stdcall [buf2d_delete],buf_0z
  580.         cmp dword[buf_r_img],0
  581.         je @f
  582.                 stdcall [buf2d_delete],buf_r_img
  583.                 stdcall [buf2d_delete],buf_r_z
  584.         @@:
  585.         stdcall [buf2d_vox_brush_delete], buf_vox
  586.         stdcall mem.Free,[image_data_toolbar]
  587.         stdcall mem.Free,[open_file_vox]
  588.         mcall -1
  589.  
  590. align 4
  591. vox_new_data:
  592.         db 2,0,0,0
  593.         db 000b,001b,010b,011b, 100b,101b,110b,111b ;default table
  594.         dd 0 ;null node
  595.  
  596. align 4
  597. proc but_new_file uses ecx edi esi
  598.         mov ecx,vox_offs_data+4
  599.         mov esi,vox_new_data
  600.         mov edi,[open_file_vox]
  601.         cld
  602.         rep movsb
  603.         ret
  604. endp
  605.  
  606. align 4
  607. open_file_vox dd 0 ;㪠§ â¥«ì ­  ®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  608.  
  609. align 4
  610. but_open_file:
  611.         pushad
  612.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  613.         mov [OpenDialog_data.type],0
  614.         stdcall [OpenDialog_Start],OpenDialog_data
  615.         cmp [OpenDialog_data.status],2
  616.         je .end_open_file
  617.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  618.  
  619.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  620.         mov [run_file_70.Function], 0
  621.         mov [run_file_70.Position], 0
  622.         mov [run_file_70.Flags], 0
  623.         mov dword[run_file_70.Count], max_open_file_size
  624.         m2m [run_file_70.Buffer], [open_file_vox]
  625.         mov byte[run_file_70+20], 0
  626.         mov dword[run_file_70.FileName], openfile_path
  627.         mov ebx,run_file_70
  628.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  629.         cmp ebx,0xffffffff
  630.         je .end_open_file
  631.  
  632.         add ebx,[open_file_vox]
  633.         mov byte[ebx],0 ;­  á«ãç © ¥á«¨ à ­¥¥ ¡ë« ®âªàëâ ä ©« ¡®«ì襣® à §¬¥à  ç¨á⨬ ª®­¥æ ¡ãä¥à  á ä ©«®¬
  634.         mcall 71,1,openfile_path
  635.  
  636.         ;---
  637.         ;
  638.         mov eax,[open_file_vox]
  639.         movzx eax,byte[eax]
  640.         and eax,0xff ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
  641.         mov dword[v_zoom],eax ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
  642.         call draw_objects
  643.         .end_open_file:
  644.         popad
  645.         ret
  646.  
  647. align 4
  648. but_save_file:
  649.         pushad
  650.                 copy_path open_dialog_name,communication_area_default_path,file_name,0
  651.                 mov [OpenDialog_data.type],1
  652.                 stdcall [OpenDialog_Start],OpenDialog_data
  653.                 cmp [OpenDialog_data.status],2
  654.                 je .end_save_file
  655.                 ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  656.  
  657.                 mov eax,dword[v_zoom] ;§ ¤ ¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
  658.                 mov ebx,[open_file_vox]
  659.                 mov byte[ebx],al
  660.  
  661.                 stdcall buf2d_vox_obj_get_size, ebx
  662.                 mov dword[run_file_70.Count], eax ;à §¬¥à ä ©« 
  663.                 mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  664.                 mov [run_file_70.Function], 2
  665.                 mov [run_file_70.Position], 0
  666.                 mov [run_file_70.Flags], 0
  667.                 mov ebx, dword[open_file_vox]
  668.                 mov [run_file_70.Buffer], ebx
  669.                 mov byte[run_file_70+20], 0
  670.                 mov dword[run_file_70.FileName], openfile_path
  671.                 mov ebx,run_file_70
  672.                 int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  673.                 cmp ebx,0xffffffff
  674.                 je .end_save_file
  675.  
  676.                 .end_save_file:
  677.         popad
  678.         ret
  679.  
  680. ;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
  681. align 4
  682. but_1:
  683.         cmp dword[v_zoom],10 ;¬ ªá¨¬ «ì­ë© à §¬¥à, ¤® ª®â®à®£® ¬®¦­® 㢥«¨ç¨âì 2^10=1024
  684.         jge @f
  685.                 inc dword[v_zoom]
  686.                 shl dword[n_plane],1
  687.                 push eax
  688.                 mov eax,[v_zoom]
  689.                 cmp eax,[scaled_zoom]
  690.                 jl .end_0
  691.                         shl dword[cam_x],1
  692.                         shl dword[cam_y],1
  693.                         shl dword[cam_z],1
  694.                 .end_0:
  695.                 pop eax
  696.                 call draw_objects
  697.                 call draw_pok
  698.         @@:
  699.         ret
  700.  
  701. ;㬥­ì襭¨¥ ¬ áèâ ¡ 
  702. align 4
  703. but_2:
  704.         cmp dword[v_zoom],-1
  705.         jl @f
  706.                 dec dword[v_zoom]
  707.                 shr dword[n_plane],1
  708.                 push eax
  709.                 mov eax,[v_zoom]
  710.                 cmp eax,[scaled_zoom]
  711.                 jl .end_0
  712.                         shr dword[cam_x],1
  713.                         shr dword[cam_y],1
  714.                         shr dword[cam_z],1
  715.                 .end_0:
  716.                 pop eax
  717.                 call draw_objects
  718.                 call draw_pok
  719.         @@:
  720.         ret
  721.  
  722. align 4
  723. but_3:
  724.         stdcall vox_obj_rot_z, [open_file_vox]
  725.         call draw_objects
  726.         ret
  727.  
  728. align 4
  729. but_4:
  730.         stdcall vox_obj_rot_x, [open_file_vox]
  731.         call draw_objects
  732.         ret
  733.  
  734. align 4
  735. but_5:
  736.         inc dword[n_plane]
  737.         call draw_objects
  738.         call draw_pok
  739.         ret
  740.  
  741. align 4
  742. but_6:
  743.         cmp dword[n_plane],0
  744.         jle @f
  745.                 dec dword[n_plane]
  746.                 call draw_objects
  747.                 call draw_pok
  748.         @@:
  749.         ret
  750.  
  751. align 4
  752. but_7:
  753.         push eax
  754.         mov eax,dword[v_pen_mode]
  755.         mov dword[v_pen_mode],1 ;draw
  756.         cmp eax,2
  757.         jne @f
  758.                 call draw_objects
  759.         @@:
  760.         pop eax
  761.         ret
  762.  
  763. align 4
  764. but_8:
  765.         push eax
  766.         mov eax,dword[v_pen_mode]
  767.         mov dword[v_pen_mode],0 ;clear
  768.         cmp eax,2
  769.         jne @f
  770.                 call draw_objects
  771.         @@:
  772.         pop eax
  773.         ret
  774.  
  775. align 4
  776. but_light:
  777.         xor dword[mode_light],1
  778.         call draw_objects
  779.         ret
  780.  
  781. align 4
  782. but_rend_2_2:
  783. push edi
  784.         cmp dword[buf_r_img],0
  785.         jne @f
  786.                 ;ᮧ¤ ­¨¥ ¡ãä¥à  ¤«ï ७¤¥à 
  787.                 push ecx esi
  788.                 mov edi,buf_r_img
  789.                 mov esi,buf_0
  790.                 mov ecx,BUF_STRUCT_SIZE
  791.                 cld
  792.                 rep movsb ;ª®¯¨à㥬 ¢á¥ ¯ à ¬¥âàë á ®á­®¢­®£® ¡ãä¥à 
  793.                 mov edi,buf_r_img
  794.                 mov buf2d_data,0
  795.                 shl buf2d_w,1 ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¡ãä¥à 
  796.                 shl buf2d_h,1
  797.                 stdcall [buf2d_create],buf_r_img
  798.  
  799.                 mov edi,buf_r_z
  800.                 mov esi,buf_0z
  801.                 mov ecx,BUF_STRUCT_SIZE
  802.                 cld
  803.                 rep movsb ;ª®¯¨à㥬 ¢á¥ ¯ à ¬¥âàë á ®á­®¢­®£® ¡ãä¥à 
  804.                 mov edi,buf_r_z
  805.                 mov buf2d_data,0
  806.                 shl buf2d_w,1 ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¡ãä¥à 
  807.                 shl buf2d_h,1
  808.                 stdcall [buf2d_create],buf_r_z
  809.                 pop esi ecx
  810.         @@:
  811.         stdcall [buf2d_clear], buf_r_img, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  812.         stdcall [buf2d_clear], buf_r_z, 0 ;ç¨á⨬ ¡ãä¥à
  813.  
  814.         push eax ebx ecx
  815.                 mov eax,[v_zoom]
  816.                 cmp eax,[scaled_zoom]
  817.                 jle .end_scaled
  818.                         ;७¤¥à 㢥«¨ç¥­­®© ç á⨠®¡ê¥ªâ 
  819.                         mov ebx,[scaled_zoom]
  820.                         sub eax,ebx
  821.                         inc ebx
  822.                         stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, 0xd080d0
  823.                         bt dword[mode_light],0
  824.                         jnc @f
  825.                                 stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, ebx, 3
  826.                         @@:
  827.                         xor ebx,ebx
  828.                         xor ecx,ecx
  829.                         mov edi,buf_r_img
  830.                         stdcall [buf2d_img_hdiv2], edi
  831.                         shr buf2d_h,1
  832.                         stdcall [buf2d_img_wdiv2], edi
  833.                         shr buf2d_w,1
  834.                         jmp .show
  835.                 .end_scaled:
  836.  
  837.                 inc eax
  838.                 stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, eax
  839.                 bt dword[mode_light],0
  840.                 jnc @f
  841.                         stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, eax, 3
  842.                 @@:
  843.  
  844.                 mov edi,buf_r_img
  845.                 stdcall [buf2d_img_hdiv2], edi
  846.                 shr buf2d_h,1
  847.                 stdcall [buf2d_img_wdiv2], edi
  848.                 shr buf2d_w,1
  849.  
  850.                 stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom]
  851.                 mov ebx,[buf_0.w]
  852.                 sub ebx,eax
  853.                 shr ebx,1 ;ebx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® £®à¨§®­â «¨
  854.                 stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom]
  855.                 cmp eax,[buf_0.h]
  856.                 jg @f
  857.                         mov ecx,[buf_0.h]
  858.                         sub ecx,eax
  859.                         shr ecx,1 ;ecx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® ¢¥à⨪ «¨
  860.                 @@:
  861.                 .show:
  862.                 stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi
  863.                 shl buf2d_h,1
  864.                 shl buf2d_w,1
  865.         pop ecx ebx eax
  866. pop edi
  867.         stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  868.         ret
  869.  
  870. align 4
  871. draw_palete:
  872.         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  873.         stdcall buf2d_draw_palete, buf_0, 5,3, 9,6, 18, 512
  874.         stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  875.         ret
  876.  
  877. v_zoom dd 3 ;⥪ã騩 ¬ áèâ ¡
  878. v_cur_x dd 0 ;ª®®à¤¨­ â  ªãàá®à  x
  879. v_cur_y dd 0 ;ª®®à¤¨­ â  ªãàá®à  y (­® ®áì ¢ ®¡ê¥ªâ¥ z)
  880. n_plane dd 0 ;¯«®áª®áâì á¥ç¥­¨ï
  881. v_color dd 0xff ;梥⠪ à ­¤ è 
  882. v_pen_mode dd 1 ;०¨¬: 0-áâ¨à ­¨ï, 1-à¨á®¢ ­¨ï
  883. mode_light dd 1 ;०¨¬ ®á¢¥é¥­¨ï
  884. cam_x dd 0
  885. cam_y dd 0
  886. cam_z dd 0
  887. scaled_zoom dd 5 ;¬ áèâ ¡ ¯®á«¥ ª®â®à®£® ­ ç¨­ ¥âáï à¨á®¢ ­¨¥ ç á⨠¨§®¡à ¦¥­¨ï
  888.  
  889. txt_zoom db 'Œ áèâ ¡:',0
  890. txt_cur_x db 'x:',0
  891. txt_cur_y db 'y:',0
  892. txt_n_plane db '‘¥ç¥­¨¥:',0
  893. txt_color db '–¢¥â:',0
  894.  
  895. align 4
  896. draw_objects:
  897.         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  898.         stdcall [buf2d_clear], buf_0z, 0 ;ç¨á⨬ ¡ãä¥à
  899.         stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;ç¨á⨬ ¡ãä¥à
  900.  
  901.         cmp dword[v_pen_mode],2
  902.         jne @f
  903.                 call draw_palete
  904.                 jmp .end_f
  905.         @@:
  906.         push eax ebx ecx
  907.         stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom]
  908.         mov ebx,[buf_0.w]
  909.         sub ebx,eax
  910.         shr ebx,1 ;ebx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® £®à¨§®­â «¨
  911.  
  912.         xor ecx,ecx
  913.         stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom]
  914.         cmp eax,[buf_0.h]
  915.         jg @f
  916.                 mov ecx,[buf_0.h]
  917.                 sub ecx,eax
  918.                 shr ecx,1 ;ecx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯®
  919.         @@:
  920.  
  921.         mov eax,[v_zoom]
  922.         cmp eax,[scaled_zoom]
  923.         jg @f
  924.                 ;®¡ëç­ë© ०¨¬ ¨§®¡à ¦¥­¨ï
  925.                 stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox, [open_file_vox], ebx,ecx, 0, eax
  926.                 stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox], OT_MAP_X,OT_MAP_Y,TILE_SIZE, [v_zoom], [n_plane], 0xd0d0d0
  927.                 bt dword[mode_light],0
  928.                 jnc .end_1
  929.                         stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3
  930.                 .end_1:
  931.                 jmp .end_0
  932.         @@:
  933.                 ;०¨¬ ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  934.                 sub eax,[scaled_zoom]
  935.                 stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, buf_vox,\
  936.                         [open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax
  937.                 stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\
  938.                         OT_MAP_X,OT_MAP_Y,TILE_SIZE, [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax
  939.                 bt dword[mode_light],0
  940.                 jnc .end_2
  941.                         stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, 0,0, 0, [scaled_zoom], 3
  942.                 .end_2:
  943.         .end_0:
  944.  
  945.         pop ecx ebx eax
  946.  
  947.         stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  948.         stdcall [buf2d_draw], buf_pl ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  949.         .end_f:
  950.         ret
  951.  
  952. if 0
  953. ;input:
  954. ; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
  955. ;output:
  956. ; eax - ç¨á«®
  957. align 4
  958. proc conv_str_to_int, buf:dword
  959.         xor eax,eax
  960.         push ebx ecx esi
  961.         xor ebx,ebx
  962.         mov esi,[buf]
  963.         ;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
  964.         xor ecx,ecx
  965.         inc ecx
  966.         cmp byte[esi],'-'
  967.         jne @f
  968.                 dec ecx
  969.                 inc esi
  970.         @@:
  971.  
  972.         cmp word[esi],'0x'
  973.         je .load_digit_16
  974.  
  975.         .load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
  976.                 mov bl,byte[esi]
  977.                 cmp bl,'0'
  978.                 jl @f
  979.                 cmp bl,'9'
  980.                 jg @f
  981.                         sub bl,'0'
  982.                         imul eax,10
  983.                         add eax,ebx
  984.                         inc esi
  985.                         jmp .load_digit_10
  986.         jmp @f
  987.  
  988.         .load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
  989.                 add esi,2
  990.         .cycle_16:
  991.                 mov bl,byte[esi]
  992.                 cmp bl,'0'
  993.                 jl @f
  994.                 cmp bl,'f'
  995.                 jg @f
  996.                 cmp bl,'9'
  997.                 jle .us1
  998.                         cmp bl,'A'
  999.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
  1000.                 .us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
  1001.                 cmp bl,'F'
  1002.                 jle .us2
  1003.                         cmp bl,'a'
  1004.                         jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
  1005.                         sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
  1006.                 .us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
  1007.                         sub bl,'0'
  1008.                         cmp bl,9
  1009.                         jle .cor1
  1010.                                 sub bl,7 ;convert 'A' to '10'
  1011.                         .cor1:
  1012.                         shl eax,4
  1013.                         add eax,ebx
  1014.                         inc esi
  1015.                         jmp .cycle_16
  1016.         @@:
  1017.         cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
  1018.         jne @f
  1019.                 sub ecx,eax
  1020.                 mov eax,ecx
  1021.         @@:
  1022.         pop esi ecx ebx
  1023.         ret
  1024. endp
  1025. end if
  1026.  
  1027. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  1028. align 4
  1029. OpenDialog_data:
  1030. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  1031. .procinfo               dd procinfo     ;+4
  1032. .com_area_name          dd communication_area_name      ;+8
  1033. .com_area               dd 0    ;+12
  1034. .opendir_path           dd plugin_path  ;+16
  1035. .dir_default_path       dd default_dir ;+20
  1036. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  1037. .draw_window            dd draw_window  ;+28
  1038. .status                 dd 0    ;+32
  1039. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  1040. .filename_area          dd filename_area        ;+40
  1041. .filter_area            dd Filter
  1042. .x:
  1043. .x_size                 dw 420 ;+48 ; Window X size
  1044. .x_start                dw 10 ;+50 ; Window X position
  1045. .y:
  1046. .y_size                 dw 320 ;+52 ; Window y size
  1047. .y_start                dw 10 ;+54 ; Window Y position
  1048.  
  1049. default_dir db '/rd/1',0
  1050.  
  1051. communication_area_name:
  1052.         db 'FFFFFFFF_open_dialog',0
  1053. open_dialog_name:
  1054.         db 'opendial',0
  1055. communication_area_default_path:
  1056.         db '/rd/1/File managers/',0
  1057.  
  1058. Filter:
  1059. dd Filter.end - Filter ;.1
  1060. .1:
  1061. db 'VOX',0
  1062. .end:
  1063. db 0
  1064.  
  1065.  
  1066.  
  1067. head_f_i:
  1068. head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
  1069.  
  1070. system_dir_0 db '/sys/lib/'
  1071. lib_name_0 db 'proc_lib.obj',0
  1072. err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
  1073. err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
  1074.  
  1075. system_dir_1 db '/sys/lib/'
  1076. lib_name_1 db 'libimg.obj',0
  1077. err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
  1078. err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
  1079.  
  1080. system_dir_2 db '/sys/lib/'
  1081. lib_name_2 db 'buf2d.obj',0
  1082. err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
  1083. err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
  1084.  
  1085. l_libs_start:
  1086.         lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  1087.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  1088.         lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  1089.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  1090.         lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
  1091.                 err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
  1092. l_libs_end:
  1093.  
  1094. align 4
  1095. import_libimg:
  1096.         dd alib_init1
  1097.         img_is_img  dd aimg_is_img
  1098.         img_info    dd aimg_info
  1099.         img_from_file dd aimg_from_file
  1100.         img_to_file dd aimg_to_file
  1101.         img_from_rgb dd aimg_from_rgb
  1102.         img_to_rgb  dd aimg_to_rgb
  1103.         img_to_rgb2 dd aimg_to_rgb2
  1104.         img_decode  dd aimg_decode
  1105.         img_encode  dd aimg_encode
  1106.         img_create  dd aimg_create
  1107.         img_destroy dd aimg_destroy
  1108.         img_destroy_layer dd aimg_destroy_layer
  1109.         img_count   dd aimg_count
  1110.         img_lock_bits dd aimg_lock_bits
  1111.         img_unlock_bits dd aimg_unlock_bits
  1112.         img_flip    dd aimg_flip
  1113.         img_flip_layer dd aimg_flip_layer
  1114.         img_rotate  dd aimg_rotate
  1115.         img_rotate_layer dd aimg_rotate_layer
  1116.         img_draw    dd aimg_draw
  1117.  
  1118.         dd 0,0
  1119.         alib_init1   db 'lib_init',0
  1120.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  1121.         aimg_info    db 'img_info',0
  1122.         aimg_from_file db 'img_from_file',0
  1123.         aimg_to_file db 'img_to_file',0
  1124.         aimg_from_rgb db 'img_from_rgb',0
  1125.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  1126.         aimg_to_rgb2 db 'img_to_rgb2',0
  1127.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  1128.         aimg_encode  db 'img_encode',0
  1129.         aimg_create  db 'img_create',0
  1130.         aimg_destroy db 'img_destroy',0
  1131.         aimg_destroy_layer db 'img_destroy_layer',0
  1132.         aimg_count   db 'img_count',0
  1133.         aimg_lock_bits db 'img_lock_bits',0
  1134.         aimg_unlock_bits db 'img_unlock_bits',0
  1135.         aimg_flip    db 'img_flip',0
  1136.         aimg_flip_layer db 'img_flip_layer',0
  1137.         aimg_rotate  db 'img_rotate',0
  1138.         aimg_rotate_layer db 'img_rotate_layer',0
  1139.         aimg_draw    db 'img_draw',0
  1140.  
  1141. align 4
  1142. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  1143.         OpenDialog_Init dd aOpenDialog_Init
  1144.         OpenDialog_Start dd aOpenDialog_Start
  1145. dd 0,0
  1146.         aOpenDialog_Init db 'OpenDialog_init',0
  1147.         aOpenDialog_Start db 'OpenDialog_start',0
  1148.  
  1149. align 4
  1150. import_buf2d:
  1151.         init dd sz_init
  1152.         buf2d_create dd sz_buf2d_create
  1153.         buf2d_create_f_img dd sz_buf2d_create_f_img
  1154.         buf2d_clear dd sz_buf2d_clear
  1155.         buf2d_draw dd sz_buf2d_draw
  1156.         buf2d_delete dd sz_buf2d_delete
  1157.         buf2d_line dd sz_buf2d_line
  1158.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  1159.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  1160.         buf2d_circle dd sz_buf2d_circle
  1161.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  1162.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  1163.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  1164.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  1165.         buf2d_bit_blt dd sz_buf2d_bit_blt
  1166.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  1167.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  1168.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  1169.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  1170.         buf2d_draw_text dd sz_buf2d_draw_text
  1171.         buf2d_crop_color dd sz_buf2d_crop_color
  1172.         buf2d_offset_h dd sz_buf2d_offset_h
  1173.         buf2d_flood_fill dd sz_buf2d_flood_fill
  1174.         buf2d_set_pixel dd sz_buf2d_set_pixel
  1175.         buf2d_get_pixel dd sz_buf2d_get_pixel
  1176.         buf2d_vox_brush_create dd sz_buf2d_vox_brush_create
  1177.         buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete
  1178.         buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g
  1179.         buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g
  1180.         buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g
  1181.         buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled
  1182.         buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl
  1183.         buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled
  1184.         buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows
  1185.         dd 0,0
  1186.         sz_init db 'lib_init',0
  1187.         sz_buf2d_create db 'buf2d_create',0
  1188.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  1189.         sz_buf2d_clear db 'buf2d_clear',0
  1190.         sz_buf2d_draw db 'buf2d_draw',0
  1191.         sz_buf2d_delete db 'buf2d_delete',0
  1192.         sz_buf2d_line db 'buf2d_line',0
  1193.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  1194.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  1195.         sz_buf2d_circle db 'buf2d_circle',0
  1196.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  1197.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  1198.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  1199.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  1200.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  1201.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  1202.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  1203.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  1204.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  1205.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  1206.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  1207.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  1208.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  1209.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  1210.         sz_buf2d_get_pixel db 'buf2d_get_pixel',0
  1211.         sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0
  1212.         sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0
  1213.         sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0
  1214.         sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0
  1215.         sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0
  1216.         sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0
  1217.         sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0
  1218.         sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0
  1219.         sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0
  1220.  
  1221. mouse_dd dd 0x0
  1222. sc system_colors
  1223.  
  1224. align 16
  1225. procinfo process_information
  1226.  
  1227. ;¡ãä¥à ®á­®¢­®£® ¨§®¡à ¦¥­¨ï
  1228. align 4
  1229. buf_0: dd 0 ;㪠§ â¥«ì ­  ¤a­ë¥ ¨§®¡à ¦¥­¨ï
  1230. .l: dw 5 ;+4 left
  1231. .t: dw 45 ;+6 top
  1232. .w: dd 192+6 ;+8 w
  1233. .h: dd 224+7 ;+12 h
  1234. .color: dd 0xffffff ;+16 color
  1235.         db 24 ;+20 bit in pixel
  1236.  
  1237. ;¡ãä¥à £«ã¡¨­ë ®á­®¢­®£® ¨§®¡à ¦¥­¨ï
  1238. align 4
  1239. buf_0z: dd 0
  1240.         dw 0 ;+4 left
  1241.         dw 0 ;+6 top
  1242. .w: dd 192+6 ;+8 w
  1243. .h: dd 224+7 ;+12 h
  1244. .color: dd 0 ;+16 color
  1245.         db 32 ;+20 bit in pixel
  1246.  
  1247. ;¡ãä¥à ¤«ï à¨á®¢ ­¨ï á१  ®¡ê¥ªâ 
  1248. align 4
  1249. buf_pl: dd 0
  1250. .l: dw 15+192+6 ;+4 left
  1251. .t: dw 45 ;+6 top
  1252. .w: dd 320 ;+8 w
  1253. .h: dd 330 ;+12 h
  1254. .color: dd 0xffffff ;+16 color
  1255.         db 24 ;+20 bit in pixel
  1256.  
  1257. ;¡ãä¥à ¤«ï ã«ãç襭®£® ७¤¥à 
  1258. align 4
  1259. buf_r_img:
  1260.         rb BUF_STRUCT_SIZE
  1261. align 4
  1262. buf_r_z:
  1263.         rb BUF_STRUCT_SIZE
  1264.  
  1265. ;¤ ­­ë¥ ¤«ï ᮧ¤ ­¨ï ¬¨­¨¬ «ì­®£® ¥¤¨­¨ç­®£® ¢®ªá¥«ï
  1266. align 4
  1267. vox_6_7_z:
  1268. dd 0,0,1,1,0,0,\
  1269.    0,2,2,2,2,0,\
  1270.    2,2,2,2,2,2,\
  1271.    2,3,2,2,3,2,\
  1272.    2,3,3,3,3,2,\
  1273.    0,3,3,3,3,0,\
  1274.    0,0,3,3,0,0
  1275.  
  1276. align 4
  1277. buf_vox:
  1278.         db 6,7,4,3 ;w,h,h_osn,n
  1279.         rb BUF_STRUCT_SIZE*(2+1)
  1280.  
  1281.  
  1282. i_end:
  1283.         rb 2048
  1284. stacktop:
  1285.         sys_path rb 1024
  1286.         file_name:
  1287.                 rb 1024 ;4096
  1288.         library_path rb 1024
  1289.         plugin_path rb 4096
  1290.         openfile_path rb 4096
  1291.         filename_area rb 256
  1292. mem:
  1293.