Subversion Repositories Kolibri OS

Rev

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